Commit graph

13041 commits

Author SHA1 Message Date
Jason Rhinelander
026086613a Fix boost flags, enable LTO 2020-10-14 23:04:53 -03:00
Jason Rhinelander
c4134a589e fix boost macosx target 2020-10-14 22:16:21 -03:00
Jason Rhinelander
68b0f93f5d Apply macosx target BS to static deps 2020-10-14 20:09:03 -03:00
Jason Rhinelander
30f77c2f21 Build with -DARCH_ID to make randomx happy
Also do the static build first so that test binaries pop out faster.
2020-10-14 18:52:32 -03:00
Jason Rhinelander
f9a257c862 Set -maes in CMake rather than source file
clang needs this as well, and while it can do it with pragmas, it's more
complicated and easier to just change the compilation flags for the
source file.
2020-10-14 14:26:16 -03:00
Jason Rhinelander
4788f40344 Set march to core2 for maximum mac compatibility 2020-10-14 02:35:59 -03:00
Jason Rhinelander
de924e80ac MacOS 10.14 compatibility 2020-10-13 18:13:08 -03:00
Doyle
ccffe6cb39 wallet: Add export key images pathological case explanation todo
- Not fixed at the moment as it is abit involved (the entire function
assumes a fixed offset into m_transfers).
2020-10-13 19:37:33 +11:00
Doyle
30f219543f wallet: Re-sort pooled blink outputs when confirmed
Due to prior behaviour of immediately accepting blinks, they get
commited to the wallet's transfers container early. A second view wallet,
that restores the first wallet seed will _not_ see the blinks if it is
generated after the fact as this information is not stored in the
blockchain.

The second view wallet will restore transactions from the blockchain in
the order they were committed to the blockchain (oblivious to any blink
transactions as this is not stored by the blockchain, only those who
see it in the mempool at the time it is relayed would optimistically
save it to their transfers container).

This leads to importing key images breaking as the two wallets expect
_slightly_ different key images at different indexes in their respective
transfer container.

The fix here is to sort all transfers again once we confirm the blink,
placing the transfer into the correct slot in the container. This sort
only occurs within the latest block (as blinks are only relevant at
the tip of the chain) so resorting occurs typically with 1 blocks worth
of transactions for the wallet and so will always be quick and not
expensive.

You can reproduce this bug by checking out the tag v8.1.1

1. Wallet A sends to Wallet B transfer_1 without blink `transfer unimportant WalletB <amount>`
2. Wallet A sends to Wallet B transfer_2 _before_ transfer_1 gets mined into a block `transfer blink WalletB <amount>`
3. Wallet B must receive the Blink and be refreshed _before_ the next block gets mined to commit it to Wallet B's cache.
4. Wait for the next block to get mined and refresh to accept the block

- Wallet B now has instantly confirmed transfer_2 the Blink into the transfer
  container at index 0.

- Wallet B confirms the slow transfer transfer_1 and saves it into transfer
  container at index 1.

Since the network received transfer_1 first in the mempool, it will get
included in the block first with the Blink second. Now Wallet B's
transfers are out of sync with what is visible on the network.

5. export_key_images and import it into a view only wallet based on Wallet B.
6. import_key_images will fail due to the blockchain/wallet cache mismatch.
2020-10-13 19:15:41 +11:00
Jason Rhinelander
09529f4202 Windows build: do a generic build
The default uses -march=cpu which turns on avx2 and fma and other
CPU features that crash on older CPUs.
2020-10-12 15:51:24 -03:00
Jason Rhinelander
424b86da83 Windows build: do a generic build
The default uses -march=cpu which turns on avx2 and fma and other
CPU features that crash on older CPUs.
2020-10-12 15:50:59 -03:00
Doyle
36c975ee6d
Merge pull request #1317 from Doy-lee/MergeGenBlockTemplateStableIntoDev
Merge gen block template fix from stable into dev
2020-10-12 18:23:24 +11:00
Doyle
c619eeedb2 Merge commit 'cf529b8' into dev 2020-10-12 18:21:23 +11:00
Doyle
77f7066cc8 Merge commit 'bf4f62c' into dev 2020-10-12 18:21:12 +11:00
Doyle
0d845ed480 Merge commit 'db1b2d9' into dev 2020-10-12 18:20:54 +11:00
Doyle
6f0077024f Merge commit '15decf4' into dev 2020-10-12 18:19:27 +11:00
Jason Rhinelander
cf529b874f
Merge pull request #1316 from loki-project/dev
Dev to stable with pulse fixes
2020-10-12 04:11:31 -03:00
Doyle
7d15de036e
Merge pull request #1315 from Doy-lee/PulseAssignSortKey
Assign the last height validating pre-hf16 to seed the Pulse sort keys
2020-10-12 18:10:12 +11:00
Doyle
ab0ca3e046 Merge branch 'PulseAssignSortKey' of github.com:doy-lee/loki into PulseAssignSortKey 2020-10-12 18:07:15 +11:00
Doyle
c3b7eedfd7 Pulse: Drop difficulty to 1,000,000 for PoW at the fork height 2020-10-12 18:06:36 +11:00
Jason Rhinelander
125662b74b trace message display fix 2020-10-12 03:53:30 -03:00
Doyle
2ad85c6766 Pulse: Grace period for mainnet SNs until 646151 to upgrade to hotfix 2020-10-12 16:04:15 +11:00
Doyle
1d8a997a23 Pulse: Remigrate the sort key to 0
- Currently nodes that have updated over time will have seeded their
sort key to a different value than everyone else, causing everone to
generate Pulse quorums that are inconsistent with each other.

Instead, set the sort key to 0. Ties in the sort list are currently
dealt with by sorting on the public key itself.
2020-10-12 15:42:33 +11:00
Jason Rhinelander
bf4f62c58a Fix release suffix for stable 2020-10-11 23:00:36 -03:00
Jason Rhinelander
db1b2d9501
Merge pull request #1314 from loki-project/dev
Dev -> stable for 8.1.1 release
2020-10-11 22:51:33 -03:00
Jason Rhinelander
aab63d049e
Merge pull request #1313 from Doy-lee/UsePulseRoundWhenQueryingLatestQuorum
Pulse: Use the latest round when querying quorums via rpc
2020-10-11 22:21:35 -03:00
Doyle
f91f018b09 Pulse: Use the latest round when querying quorums via rpc 2020-10-12 11:42:54 +11:00
Jason Rhinelander
674fa682bb
Bump version (mainly wallet-related fixes) (#1312) 2020-10-12 10:43:29 +11:00
Doyle
2c48efe827
Merge pull request #1310 from jagerman/rpc-last-quorum-of-each
RPC: get latest quorum improvements/fixes
2020-10-12 10:43:12 +11:00
Jason Rhinelander
920966c15d Use constants for checkpoint/blink interval lengths 2020-10-11 00:38:21 -03:00
Jason Rhinelander
cecabb0128 Don't include current pulse quorum before HF16 2020-10-11 00:17:39 -03:00
Jason Rhinelander
26744cd73e RPC: get latest quorum improvements/fixes
This changes the `get_quorum_state` RPC endpoint in two ways:

- If requesting a pulse quorum for a height that includes the current
height (i.e. top block + 1), this returns the current height, round-0
pulse quorum.

- When requesting the latest quorum state (i.e. the no-argument request)
you now get back the latest available quorum of each requested type,
instead of the quorum for the latest available block.  Thus requesting
all types will now give you:
    - the current top-of-the-chain round-0 pulse quorum
    - the top block obligations quorum (no change)
    - the top divisible-by-4 block for checkpoint quorums
    - the top divisible-by-5 block for blink quorums
Previously you would just get whatever quorums existing for the top
height, which often meant just the one-old pulse quorum + top block
obligations quorum, only only checkpoint 25% of the time and blink 20%
of the time.

- Also updated the RPC comments for GET_QUORUM_STATE, both to reflect
the above and to update some parts which were a bit stale.
2020-10-10 22:58:08 -03:00
Doyle
3d063cd895
Merge pull request #1309 from jagerman/rpc-wallet-known-decryption
RPC wallet LNS decryption & fixes
2020-10-09 14:25:42 +11:00
Jason Rhinelander
7e270530d3 Don't cache decrypted LNS values
Our cached value could well be wrong, if another owner (or another copy
of the wallet) has updated it, and so the information we have in the
cache other than the name and type (which don't change) can be
unreliable.

Drop the cached value/owner fields and instead use queried values for
encrypted/owner/backup, and decrypt value on the fly when needed.
2020-10-08 23:18:05 -03:00
Jason Rhinelander
f76c75f28c LNS_OWNERS_TO_NAMES rpc fixes
- Add missing expiration_height serialization.
- Add "include_expired" field (to match LNS_NAMES_TO_OWNERS).
2020-10-08 23:18:05 -03:00
Jason Rhinelander
3715b60810 Fix precedence bug causing expired entries to be returned
We later (potentially) add a "AND expiration_height >= ?", but that was
breaking get_mappings_by_owners because we have an "OR" here.
2020-10-08 23:18:05 -03:00
Jason Rhinelander
cbcb530877 Fix unwired lns_renew_mapping endpoint 2020-10-08 23:18:05 -03:00
Jason Rhinelander
e6c2cdaefa wallet RPC: make lns_known_names return record with optional decryption
This saves the GUI wallet, in particular, a lot of work: previously it
had to get the values from loki-wallet-rpc, then make a request to lokid
to retrieve the records, then for each of those make another call to the
wallet-rpc to decrypt the value.

This lets lns_known_names do it all in one request.
2020-10-08 23:17:59 -03:00
Doyle
15decf44e1
get_block_template: Allow unaccounted dust in construct_miner_tx (#1306)
- On some of the SN's who are queued for payout, requesting a block
template with it fails because we end up paying less than the total
amount allocated.

This was previously solved by having a `service_node_paid` in
`reward_parts` that I removed to simplify `reward_parts`.

This is only a client side sanity check and does not affect consensus.
The rest of the codebase uses the original calculate_sums_of_portions on
the total allocated reward (which when it does the division out, the
remainder is not included in the payouts and the verifying code expects
that, so everything should continue to work fine).
2020-10-09 09:55:47 +11:00
Jason Rhinelander
d3a7a9cef7
Fix LNS cache storage via RPC wallet (#1307)
- Add a wallet function to convert the type string into a type value
- Remove the lns buy/update/renew overloads that take a string; callers
  should use the above instead to convert (and check) the type.
- Fix rpc wallet cache entries to set the proper type in the lns cache
  instead of always inserting session type.
2020-10-09 09:51:10 +11:00
Jason Rhinelander
d16899104e
Close established HTTP requests when trying to shut down (#1308)
Currently we only close the listening HTTP socket(s) but not established
connections, which means a client make repeated keep-alive requests will
keep the HTTP server alive for potentially a very long time when we're
trying to shut down or restart.

This commit changes the logic to more forcefully close request
connections with the next reply, so that we properly shut down within a
few seconds but give clients a chance to finish up their current
request.
2020-10-09 09:48:24 +11:00
Jason Rhinelander
e2068a5a33
Merge pull request #1301 from Doy-lee/LNSErrorMessageReturn
LNS: Don't overwrite err message on validation fail
2020-10-06 23:22:36 -03:00
Doyle
49aa6c9ab6
Merge pull request #1304 from jagerman/default-port
Properly append default port to --daemon-address
2020-10-07 13:19:48 +11:00
Jason Rhinelander
26a5d045ac Remove unused variable 2020-10-06 23:09:46 -03:00
Doyle
89cc4c42a3
args: Coerce rpc port to number instead of string (#1303) 2020-10-07 10:40:30 +11:00
Jason Rhinelander
bcec558edb Properly append default port to --daemon-address
Currently the wallet is trying to connect to http://HOSTNAME when you
give just --daemon-address=hostname rather than http://HOSTNAME:22023;
fix it by appending the default port when no port is present, and move
that port addition logic into `set_daemon`.
2020-10-05 22:49:31 -03:00
Doyle
c0c6522ccb LNS: Don't overwrite err message on validation fail
- String_view-ify mapping_type_str
- Use std::optional directly on type in wallet
2020-10-05 12:18:51 +11:00
Jason Rhinelander
27aa2fb9bc Merge remote-tracking branch 'origin/stable' into dev 2020-10-03 23:35:37 -03:00
Jason Rhinelander
bb4fe8a949
Merge pull request #1300 from jagerman/build-tweaks
Small tweaks to build system
2020-10-03 23:32:55 -03:00
Jason Rhinelander
f6c3adfb8e Small tweaks to build system
- make tagged and stable branch builds not add git tag to the tar.xz
  filename
- copy apt-get tweaks (to make it less noisy) from deb branches
- do a faster shallow submodule clone
- remove exclusion for removed is_hdd test
- remove deb_builder (deb building drone code is in its own branches)
- fix upload dir for a tagged build
2020-10-03 23:24:08 -03:00