Commit graph

10588 commits

Author SHA1 Message Date
doyle
99ebd16d06 Move operator<<(stream, tx_extra_loki_name_system) above check_condition 2020-03-11 21:29:08 +11:00
Doyle
b74a5c1c08 LNS: Print name hash when requesting names to owners
LNS: Don't display quotes around name hash
2020-03-11 18:46:15 +11:00
Doyle
46e3868725
Merge pull request #1067 from Doy-lee/BlockRewardTestFixes
Block reward change fixes for core_tests
2020-03-11 18:39:09 +11:00
Doyle
77e1b0e135 Add workaround for non-existent miner fee in HF16
HF16 removes the miner fee. This breaks a lot of assumptions in the
testing code which blanket mines are bunch of blocks to fund the miner
wallet which we use throughout the test.

Instead, on tests that require use of hardforks later than HF16, the
generated hard-fork table allocates at least 60 blocks prior to the
block reward changes in HF15 and 16. The 60 blocks was chosen as it's
the largest number of blocks that tests use to accumulate funds for the
miner meaning all tests should continue working with this change.

We could also opt for generating a Service Node for the default miner so
that they get funds, but this brough up additional testing suite errors.
In the interest of time, this is the least intrusive but working way to
get tests running for the upcoming hard fork.
2020-03-11 18:37:41 +11:00
Doyle
a493386664 Bulletproof tests fixes for changed block reward
The bulletproof tests are inherited from Monero. They do not use change
addresses, so the difference between the incoming and outgoing amount is
set as the fee.

If the fee is greater than the block reward, in blockchain.cpp when
validating blocks we derive the base reward via block_reward - fee (i.e.
subtracting the fee from the block reward gives you the base reward).

For whatever reason, the Monero test doesn't use a change address, which
is where this extra amount would be redirected. I don't have a strong
enough understanding of what this test is doing, so I've once again
adjusted the values such that the fee (remainder) will never be larger
than the block reward, so block validation will still produce a base
reward that doesn't overflow past -0.
2020-03-11 18:37:41 +11:00
Doyle
28a040e547
Merge pull request #1061 from jagerman/block-reward-lrc6
Change block reward for HF15 & 16 as per LRC-6
2020-03-11 18:36:58 +11:00
Jason Rhinelander
32d84f92a8
Add testnet HF-15 fork height (#1066) 2020-03-11 17:27:35 +11:00
Doyle
5d50feb2f3
Merge pull request #1064 from jagerman/blink-fix
Blink fix
2020-03-11 17:05:29 +11:00
Maxim Shishmarev
8153f1a71b
Bump min storage server version requirement to 2.0.0 (#1065) 2020-03-11 17:01:44 +11:00
Jason Rhinelander
b963731715 Fix blink test coin generation
The --regtest/fakechain mode that blink uses no longer generates enough
mining rewards to submit blink registrations under the LRC-6 change
(with HF16 mining rewards ta 0).  This commit changes two things:

- fakechain now goes hf7-8-9-...-16 instead of jumping immediately from
hf7 to hf16 at height 2; this ensures that there are *some* mining
rewards (before hf16) that can be used to register SNs and thus get
additional rewards.

- the registration logic is adapted to work with the more blocks needed
under HF16 SN rewards before submitting registrations.
2020-03-11 02:23:44 -03:00
Jason Rhinelander
4ff472f9f1 quorumnet blink fix: reply using a ConnectionID instead of pubkey
ConnectionID's are loki-mq's (new from quorumnet) way of replying to a
specific connection; replying by pubkey now only works for service
nodes, while sending via ConnectionID is designed to work for any
connections.

The existing code was using the pubkey, which failed to send a reply
from the blink quorum when the initiator was not itself a service node.
2020-03-11 02:21:55 -03:00
Jason Rhinelander
d9a3afdd54
gcc is (correctly) throwing a misleading indent warning here (#1063)
Fix with braces.
2020-03-11 15:31:10 +11:00
Jason Rhinelander
a049869470
Add arm64 build to allow_failures (#1062)
It often hits the 50 minute limit (it seems to require some luck and/or
ccache'ed previous compilations) to consistently finish on time, so move
it to allowed failures so it doesn't cause github ci failures.
2020-03-11 14:23:06 +11:00
Jason Rhinelander
1e7b6612c1 Add HF16 miner fee = 1 sat temporary hack
We'll come back and fix this by properly dropping the miner tx when we
actually implement the HF16 changes.
2020-03-10 23:58:39 -03:00
Doyle
146b6327f1 Add type check to polymorphic keys/signatures
I opted for just a enum instead of pulling in mapbox::variant for
simplicity. mapbox::variant saves a few lines of code for easily
capturing the type at assignment, whereas here we have helper functions
for assigning type.
2020-03-11 13:53:14 +11:00
Jason Rhinelander
e496c27f2f Remove unused functions 2020-03-10 23:28:22 -03:00
Maxim Shishmarev
5cdf090539
Add storage server lokimq port (#1056)
* Add storage server lokimq port

* Don't hash storage lmq port until HF15

* Parse storage lmq port from ping
2020-03-11 12:35:36 +11:00
Doyle
7be1ff5a32 Fix rebase bugs 2020-03-11 10:58:05 +11:00
Doyle
f900cd0382 Rewrite error reporting to use check_condition 2020-03-11 10:58:05 +11:00
Doyle
22764de4ea Move sql_run_statement get_mappings into separate function 2020-03-11 10:58:05 +11:00
Doyle
2125af28d4 LNS: bitwise operators for extra_field, removing uneeded KV_*OPT 2020-03-11 10:58:05 +11:00
Doyle
00befd0605 Remove constexpr on member functions due to gcc 5.* bug
/home/travis/build/loki-project/loki-core/src/cryptonote_basic/tx_extra.h:422:20: error: enclosing class of constexpr non-static member function ‘void cryptonote::tx_extra_loki_name_system::set_field(lns::extra_field)’ is not a literal type
     constexpr void set_field    (lns::extra_field bit)       { fields = static_cast<lns::extra_field>(static_cast<uint8_t>(fields) | static_cast<uint8_t>(bit)); }
2020-03-11 10:58:05 +11:00
Doyle
9bce68992a CoreTests: Updates to LNS records don't update register_height
Register height is only updated when a mapping is renewed or when first
purchasing the mapping, i.e the register height. Before we assumed,
register_height was changed on every update, but, you are given the TXID
of the transaction already which by extension gives you the
register_height so that was also somewhat redundant.
2020-03-11 10:58:05 +11:00
Doyle
61ebda92c8 Rewrite reorgs to handle LNS TX updates
Updates are granular and can update individual fields of a LNS TX,
meaning when we reorg- restoring a record to its proper state can
potentially require searching further back than the detach height.

The following scenario, copied from a comment in loki_name_system.cpp
-----------------------------------------------------------------------------------------------
Detach Logic: Simple Case
-----------------------------------------------------------------------------------------------
LNS Buy    @ Height 100: LNS Record={field1=a1, field2=b1, field3=c1}
LNS Update @ Height 200: LNS Record={field1=a2                      }
LNS Update @ Height 300: LNS Record={           field2=b2           }
LNS Update @ Height 400: LNS Record={                      field3=c2}

Blockchain detaches to height 301, the target LNS record now looks like
                                    {field1=a2, field2=b2, field3=c1}

Our current LNS record looks like
                                    {field1=a2, field2=b2, field3=c3}

To rebuild our record, find the closest LNS Update that is earlier than the
detach height. If we run out of transactions to run back to, then the LNS
entry is just deleted.

-----------------------------------------------------------------------------------------------
Detach Logic: Advance Case
-----------------------------------------------------------------------------------------------
LNS Buy    @ Height 100: LNS Record={field1=a1, field2=b1, field3=c1}
LNS Update @ Height 200: LNS Record={field1=a2                      }
LNS Update @ Height 300: LNS Record={           field2=b2           }
LNS Update @ Height 400: LNS Record={                      field3=c2}
LNS Update @ Height 500: LNS Record={field1=a3, field2=b3, field3=c3}
LNS Update @ Height 600: LNS Record={                      field3=c4}

Blockchain detaches to height 401, the target LNS record now looks like
                                    {field1=a2, field2=b2, field3=c2}

Our current LNS record looks like
                                    {field1=a3, field2=b3, field3=c4}

To get all the fields back, we can't just replay the latest LNS update
transactions in reverse chronological order back to the detach height,
otherwise we miss the update to field1=a2 and field2=b2.

To rebuild our LNS record, we need to iterate back until we find all the
TX's that updated the LNS field(s) until all fields have been reverted to
a state representative of pre-detach height.

i.e. Go back to the closest LNS record to the detach height, at height 300.
Next, iterate back until all LNS fields have been updated at a point in
time before the detach height (i.e. height 200 with field=a2).
2020-03-11 10:58:05 +11:00
Doyle
81dff49468 Support updating individual fields via LNS update txs 2020-03-11 10:58:05 +11:00
Doyle
c3801abcc7 LNS s/row/column, was using row where column should be 2020-03-11 10:58:05 +11:00
Doyle
d54f117469 Owner is optional, if not specified it will use the current wallet 2020-03-11 10:58:05 +11:00
Doyle
9b3a25326a Move null checks to general validate section, use macro for error reporting 2020-03-11 10:58:05 +11:00
Doyle
aaf078d4f2 Rename data/entry -> lns_extra, bit_field_* -> field_* 2020-03-11 10:58:05 +11:00
Doyle
1bff385cac Add support for backup owners and allow updating LNS fields 2020-03-11 10:58:05 +11:00
Doyle
08ac9bb254 Update SQL commands to handle backup owner keys 2020-03-11 10:58:05 +11:00
Doyle
7819046b08 Make LNS take generic keys/sigs where it can for owner keys 2020-03-11 10:58:05 +11:00
Doyle
ee02eea89f SQL injection fix, index optimize, general code warts 2020-03-11 10:58:05 +11:00
Doyle
20e41ed74a Use prepare_tx_extra .. helper to gen signature 2020-03-11 10:58:05 +11:00
Doyle
d7507a65b5 Actually add make update signature to simplewallet interface 2020-03-11 10:58:05 +11:00
Doyle
68782a76df Add standalone LNS signature generator for CLI/RPC wallet 2020-03-11 10:58:05 +11:00
Doyle
5dd5723332 Prefix LNS commands with lns, instead of <verb> lns <action> 2020-03-11 10:58:05 +11:00
Doyle
91036eb2ad Revise LNS documenation to reflect actual implementation 2020-03-11 10:58:05 +11:00
Doyle
8c31535955 Update tests not using verify_lns_mapping_record 2020-03-11 10:58:05 +11:00
Doyle
e1424c5c5d Check LNS record is loaded 2020-03-11 10:58:05 +11:00
Doyle
da8e448a27 Use helper function to verify LNS records in tests
So that when adding new fields to records, updating the helper will
trigger compile errors on pre-existing record checks. There have been
several updates to mapping records that weren't being tested over the
lifetime of implementing LNS.
2020-03-11 10:58:05 +11:00
Doyle
218af8ce8c Bake SQL arguments into get_mappings sql 2020-03-11 10:58:05 +11:00
Doyle
f743a5491f DRY combining mapping and owner table together 2020-03-11 10:58:05 +11:00
Doyle
aefdbbcae4 Update SQL commands to handle backup owner keys 2020-03-11 10:58:05 +11:00
Doyle
43f7119cb1 Make generic crypto be comparable 2020-03-11 10:58:05 +11:00
Doyle
33cfc7ab31 Verify owner/backup owner when validating LNS txs 2020-03-11 10:58:05 +11:00
Doyle
9071ecbc92 Make LNS take generic keys/sigs where it can for owner keys 2020-03-11 10:58:05 +11:00
Doyle
e905be5ebf Add generic_[key|signature] to handle monero/ed25519 keys 2020-03-11 10:58:05 +11:00
Doyle
2d79c1effe Update documentation for LNS commands 2020-03-11 10:58:05 +11:00
Jason Rhinelander
6010fed40f Update test suite & add test for LRC-6 rewards 2020-03-10 18:01:28 -03:00