Commit graph

6938 commits

Author SHA1 Message Date
Doyle
bc19fc7013
Merge pull request #846 from jagerman/sn-gov-fees
Use pre-penalty base reward for non-miner block reward
2019-09-20 09:32:29 +10:00
Doyle
16ba84413b Report portential decomission and recommission for your node
When processing a quorum for a block, if you are not in the quorum to
validate other nodes, check if you're a node that is going to be tested.
If you are, check based on your current data if you're potentially
a candidate to be decommissioned/deregistered and if so report it to the
console log.

Note that this is only a heuristic and ultimately the decision lies on
what the the other Service Nodes perceive the current state of your node
is (i.e. if they're acting malicious then you will be deregistered
irrespectively).
2019-09-19 17:46:21 +10:00
Doyle
c41bfbdfe4 Add +detail to print_sn|print_n_status, display checkpoint and reachability 2019-09-19 17:42:19 +10:00
Doyle
4b7b134b30
Include the tip of the chain when recalculating difficulty (#847) 2019-09-19 17:38:34 +10:00
Doyle
a94c1587d1 Remove sychronization check on receipt of uptime
If a peer views the destination peer as not synchronizing, then the
destination peer should just accept the uptime proof, rather than accept
it and then conditionally relay it depending on whether or not you are
synchronizing at the point of attempting to relay (which you could
transition into synchronizing state interim between accepting and
attempting to relay the proof).
2019-09-19 16:58:09 +10:00
Jason Rhinelander
cedfae5d68 Renamed and reorganized fee calculations 2019-09-19 01:20:16 -03:00
Jason Rhinelander
025d1aee28 Use pre-penalty base reward for non-miner block reward
The miner base reward can be optionally reduced if the block producer
chooses to take extra tx fees beyond the median block limit, but that
shouldn't affect SN or governance fees (since they receive none of the
tx fees, they shouldn't pay any penalty for adding extra txes).

This changes the code starting with HF13 to use the unpenalized base
reward for the SN and goverance fee calculations.
2019-09-18 23:28:41 -03:00
Doyle
409cf4faee Relay proofs back to source, but don't relay your proof again
Otherwise we get into a ping-pong situation as follows
Node1 sends uptime ->
Node2 receives uptime and relays it back to Node1 for acknowledgement ->
Node1 receives it, handle_uptime_proof returns true to acknowledge ->
Node1 tries to resend to the same peers again

Instead, if we receive our own uptime proof, then acknowledge but don't
send on. If the we are missing an uptime proof it will have been
submitted automatically by the daemon itself instead of using my own
proof relayed by other nodes.
2019-09-18 15:37:32 +10:00
Doyle
aedf023dc9 Add message on receipt of your own uptime proof from network 2019-09-18 15:21:59 +10:00
Doyle
15049119ec
Merge pull request #472 from Doy-lee/RevertWerror
Revert "Remove -Werror"
2019-09-17 09:21:39 +10:00
Jason Rhinelander
5b67df6f55 Silence gcc 9 warnings & fix potential unaligned access
Silences:

    src/blockchain_db/lmdb/db_lmdb.cpp: In member function ‘virtual void cryptonote::BlockchainLMDB::open(const string&, cryptonote::network_type, int)’:
    src/blockchain_db/lmdb/db_lmdb.cpp:1473:63: error: type qualifiers ignored on cast result type [-Werror=ignored-qualifiers]
     1473 |     if (db_version > static_cast<decltype(db_version)>(VERSION))
          |                                                               ^
    src/blockchain_db/lmdb/db_lmdb.cpp:1480:68: error: type qualifiers ignored on cast result type [-Werror=ignored-qualifiers]
     1480 |     else if (db_version < static_cast<decltype(db_version)>(VERSION))
          |                                                                    ^

which happens because the `decltype()` here is const, and gcc apparently
now apparently warns on a cast to a const cast result.

While here I also noticed and fixed what looks like an unaligned access
that could be a potential problem on non-x86 architectures.
2019-09-15 23:10:55 -03:00
Doyle
a75813e2b5 ifdef x86 CPUID to avoid 'cpuid' defined but not used error 2019-09-16 11:10:00 +10:00
moneromooo-monero
fa0a50ad38 rpc: work around a GCC 7.4.0 (at least) bug
In static member function ‘static boost::optional<cryptonote::rpc::output_distribution_data> cryptonote::rpc::RpcHandler::get_output_distribution(const std::function<bool(long unsigned int, long unsigned int, long unsigned int, long unsigned int&, std::vector<long unsigned int>&, long unsigned int&)>&, uint64_t, uint64_t, uint64_t, const std::function<crypto::hash(long unsigned int)>&, bool, uint64_t)’:
cc1plus: warning: ‘void* __builtin_memset(void*, int, long unsigned int)’: specified size 18446744073709551536 exceeds maximum object size 9223372036854775807 [-Wstringop-overflow=]
2019-09-16 10:50:07 +10:00
Doyle
8692b6fb37 Avoid VLA when array size known at compile time, ISO C90 compiler error 2019-09-16 10:47:52 +10:00
Doyle
97c7c0f5fd Revert "Remove -Werror"
This reverts commit 707c2f836b.
2019-09-16 10:09:34 +10:00
Doyle
a38d4310f7
Don't constexpr operator< otherwise gitlab-ci complains (#839) 2019-09-13 17:46:32 +10:00
Doyle
cbd22735d7
Add hard fork date for testnet to v13 (#833) 2019-09-13 16:31:58 +10:00
Doyle
ce85eccf72
Rescan difficulty periodically, fix incorrect timestamps/difficulties in rescan (#835)
* Rescan difficulty periodically, fix incorrect timestamps/difficulties in rescan

* Code review
2019-09-13 15:46:15 +10:00
Doyle
adc7c9aa02
Don't verify checkpoints until after HF13 (#834) 2019-09-13 13:13:40 +10:00
Doyle
6689f70d09
Check wallet is connected before entering trigger happy exception functions (#838) 2019-09-13 13:10:47 +10:00
sachaaaaa
b54f492199 New wallet rpc command get_transfers_csv (#749)
* new wallet rpc command `get_transfers_csv`

* Refactor get_transfers: hoist down to wallet2 and use it in simplewallet and wallet_rpc
2019-09-13 12:54:26 +10:00
Doyle
54af5572ea
Don't allow duplicate ip changes for the same height (#831) 2019-09-11 16:14:24 +10:00
Doyle
b76df2bdfa
Clean up core tests (#830)
* Fix core test for test_deregister_on_split for hf13 and reorganize tests

* Rename service_nodes tests to loki_tests

* Actually commit new files
2019-09-11 16:04:58 +10:00
Doyle
7c7ba6baea
Check checkpoints for all alt blocks along the alt chain (#829)
If you receive a historical checkpoint on your canonical chain that
conflicts with the current blocks, when receiving a new block on the
alternative chain that matches the checkpoints, we should enumerate
along that alt chain how many blocks match checkpoints for reorganizing
to.

Otherwise, upon receiving alt blocks, we only check the latest block
despite having possibly received new checkpoints for blocks in the past.
2019-09-11 15:46:57 +10:00
Doyle
2e3d35fe0c
Merge pull request #827 from Doy-lee/RememberCheckpointsFromAltChain
Store alt checkpoints into the db to be applied on reorg
2019-09-11 15:45:36 +10:00
Doyle
bee57acc15 Skip V1 txs when iterating through the blockchain 2019-09-11 15:40:18 +10:00
Doyle
1db5eedb63 Add static assert on blob_header to check for alignment 2019-09-11 15:38:21 +10:00
Doyle
ea3bd74cd0 Update for_alt_blocks to support checkpoint blobs 2019-09-11 10:19:19 +10:00
Doyle
3fd0face4e Store alt checkpoints into the db to be applied on reorg 2019-09-10 17:59:17 +10:00
Doyle
50228e2a0e Merge branch 'dev' into AlternativeQuorums 2019-09-10 12:31:03 +10:00
Doyle
b9109c59fd Fix race condition on querying get_info during a reorg
This is particularly evident in integration tests were get_info/status
is called programatically frequently.
2019-09-10 10:24:34 +10:00
Doyle
5ca1d075d8 Only use greater pow alt chain if it has more checkpoints
Add migratory code for new alt_block_data_t.checkpointed field

Code review

Redo switch to alt chain logic to handle PoW properly

We always switch to the chain with prevailing checkpoints. If an old
chain reappears with more checkpoints it will be rebroadcasted and at
that point we will switch over then. So here we restore the old
behaviour regarding keeping alt chains around or not depending on the
scenario that caused the chain switch
2019-09-10 10:24:34 +10:00
Doyle
39987729ab
Update soft-forking checks to be effective HF13 (#825)
Code review

m_oldest_allowable_alternative_block -> m_immutable_height
2019-09-10 10:04:44 +10:00
Maxim Shishmarev
d7761fa894 Bump min SS version to 1.0.6 (#826) 2019-09-10 09:59:48 +10:00
Doyle
0b92e9ba89 Code review 2019-09-09 11:14:19 +10:00
Doyle
8cf7e0f5ca Add migration code for service node state format updates
Also gate some troublesome slow changes that slow down pre-hf12 changes
2019-09-06 14:41:55 +10:00
Doyle
d2b619ea9a Revamp core_tests linear_chain_generator to support state_t
Remove using crypto, using cryptonote, using epee in chaingen

Add loki prefix to data structures, cleanup warts

Remove the need for get_static_keys(), remove useless functions and
attempt to remove some pointless function overloading that puts too many
levels of indirection and makes it harder to follow code execution.

Rehaul tests further, persist test generator when replaying through core

The class used to generate the testing events to replay through core is
now preserved. This subtle change simplifies a big chunk of core testing
in that we can remove the need for using callbacks to track events in
the events vector.

Add preliminary checkpoint/alt service node tests

Allow inlining of fail cases for test conditions

Add more checkpoint core tests

add_block in generator is parameterised with checkpoints

Add test to check chain with equal checkpoints

Add test for chain reorging when recieving enough votes for checkpoint
2019-09-06 14:41:55 +10:00
Doyle
35c84359d4 Handle quorums needing to be stored in the previous state_t 2019-09-06 14:41:55 +10:00
Doyle
62c0da64e3 Remove Blockchain dependency in service_node_list::state_t 2019-09-06 14:41:55 +10:00
Doyle
b4efc82e6b Remove using select_winner twice in block reward check
Also promote the std::pair of <address, portions> to a struct for
readability.

Readjust block_winner to ensure test case passes
2019-09-06 14:41:55 +10:00
Doyle
4724a7436f Incorporate checkpoint validation into syncing step
Fix checkpoint verification check and add messages
2019-09-06 14:41:55 +10:00
Doyle
15ff209db0 Add alt block added hook
Move service node list methods to state_t methods

Add querying state from alt blocks and put key image parsing into function

Incorporate hash into state_t to find alt states

Add a way to query alternate testing quorums

Rebase cleanup
2019-09-06 14:41:55 +10:00
Maxim Shishmarev
b91e690a62 Add storage server reachability field; test it with quorums (#820)
* Add storage server reachability field; test it with quorums

* Improve method names

* Address review comments
2019-09-02 13:06:15 +10:00
Doyle
add6051a8f
make get_checkpoints_range faster by using lmdb cursor as iterator (#819)
* make get_checkpoints_range faster by using lmdb cursor as iterator

* Update clamp to be more compliant with convention
2019-08-30 13:54:49 +10:00
Jason Rhinelander
d028a76c67 Update testnet & stagenet seed nodes (#818) 2019-08-29 14:38:28 +10:00
Doyle
9fe3097e4d
Separate long term service node state into archive from recent history set (#815) 2019-08-27 13:28:46 +10:00
Jason Rhinelander
d0893a232a Rename result -> failure to improve readability 2019-08-26 23:52:30 -03:00
Jason Rhinelander
0350ccfc9a Switch to per-byte + per-output fees, reduce max multiplier
This switches loki 5.x to use a fee formula of

    SIZE * PER_BYTE + OUTPUTS * PER_OUTPUT

where we reduce the PER_BYTE fee back to what it was in 3.x; and with
the PER_OUTPUT fee set to 0.02 LOKI.  This compares to the 4.x fee of:

    SIZE * PER_BYTE * 80

(the *80 multiple was introduced in 4.x).

It also reduces the multiplier for the maximum priority level to 125
instead of 1000 because 1000 produced uselessly high tx fees.  The new
multipliers go up 5x at each level: {1, 5, 25, 125} while previously
they went {1, 5, 25, 1000}.

As for the base change: we added the *80 multiplier in 4.x because we
wanted to make a theoretical de-anonymizing tx spam attack more costly.
The unanticipated consequence was that we also made *large* transactions
(such as sweeps) considerably more costly despite the fact that these
transactions typically only create 2 outputs.

This better captures what we meant to do in 4.x (making output creation
relatively more expensive) without making large txes (e.g. sweeps
required for staking) highly expensive.

The end effect is that the fee for a minimum-sized, 1-input/2-output
transaction should stay roughly the same (slightly over 0.04 LOKI),
while a 100-input/2-output transction (a typical spend or sweep from a
wallet with lots of smaller rewards) will drop in fee by somewhere
around 95%.

The most efficient theoretical deanonymizing tx spamming of this sort
was a 1-input/16-output transaction which will become about 2.5x as
expensive as currently the case in v4.x.
2019-08-26 17:42:30 -03:00
Jason Rhinelander
43ae4f72e1 Remove obsolete hard fork wallet code
This commit prunes the various code paths in wallet that can't happen
anymore.  Aside from removing a bunch of dead code, this also removes a
bunch of `use_fork_rules` calls (each of which add an RPC call).
2019-08-24 20:55:59 -03:00
Jason Rhinelander
c455a908fa Silence gcc 9 warnings
GCC 9 has two new warnings that we trigger:

    warning: implicitly-declared ‘T::T(const T&)’ is deprecated [-Wdeprecated-copy]
    note: because ‘T’ has user-provided ‘T& T::operator=(const T&)’

and:

    warning: redundant move in return statement [-Wredundant-move]

This addresses them.
2019-08-22 21:54:21 -03:00