Commit Graph

426 Commits

Author SHA1 Message Date
Jason Rhinelander ce9d0a9c1e Storage server RPC improvements
Improves the oxend<->storage server communications protocol:

- pass storage server HTTPS port as part of the storage server ping
(which already carries the also-required OMQ port) rather than needing
to provide it when starting up oxend.  --storage-server-port is now
obsolete (and ignored, if specified).
- Fix up the internal API to use `storage_https_port` and
`storage_omq_port` rather than `storage_port` and `storage_lmq_port`.
- Redo and the SS ping RPC endpoint so that it is less verbose and more
closely matches the lokinet endpoint; instead of:

    { "version_major": 2, "version_minor": 0, "version_patch": 9, "storage_lmq_port": 22222 }

we now expect:

    { "version": [2,0,9], "https_port": 11111, "omq_port": 22222 }

- Tweaks the (not-yet-released) SS proof key names: "s"->"shp" and "slp"->"sop"
2021-04-08 13:42:33 -03:00
Sean Darcy ded6e6bbf4 Add multiple decommission reasons to output. 2021-03-26 15:25:12 -03:00
Sean Darcy 10c3c3f0df print reason for decommission 2021-03-26 15:25:12 -03:00
Jason Rhinelander 2fb0dbcaa3 Tweak uptime proof times; reduce times for testnet
This makes uptime proof times network-dependent, and tweaks them a bit.
Also converts the times to type-safe std::chrono types rather than
macros.

Mainnet/testnet/devnet:

- Send the first proof 30s after startup rather than waiting 2 minutes.
- Check for whether we need to send a proof every 30s rather than every
5mins.

Mainnet:

Other times unchanged.

Testnet/devnet:

- Send proofs every 10min instead of 1h, and consider nodes to be down
after 21m instead of 2h5m.

Fakechain:

- Send 5s after startup, check every 5s, and send every 1min.
- Expiry after 2min5s

Also remove the cmake debug option for short proofs since the fakechain
changes above basically incorporate what it did.
2021-03-25 11:46:23 -03:00
Sean 650ea6f4a2
bump HF versions (#1420)
* bump HF versions, schedule testnet HF
2021-03-24 21:17:58 -03:00
Jason Rhinelander c719d45518 Fix lokimq -> oxenmq namespace that crept in
A recent PR started off prior to the rebrand code and was apparently
still using the legacy header names.
2021-03-16 21:09:43 -03:00
Sean Darcy 90232dd217 shorten wire names 2021-02-09 11:54:27 +11:00
Sean Darcy 2ba4438e6a RPC to return SS and lokinet versions, renaming variables 2021-02-09 11:54:19 +11:00
Sean Darcy b720e8ace6 Serialize the uptime proof using btencoding 2021-02-09 11:54:00 +11:00
Sean Darcy c0de851d1d Added versions for SS and lokinet to be saved to core, generate_uptime_proof adds them to the proof 2021-02-09 11:52:31 +11:00
Jason Rhinelander 466a1317d2 Rename lokimq -> oxenmq 2021-01-14 19:35:00 -04:00
Sean Darcy 432dc319a9 executable names changed 2021-01-04 14:19:42 +11:00
Sean Darcy 0396698ee7 initial loki -> oxen pass 2021-01-04 11:09:45 +11:00
Sean Darcy ed5b946c0a quorumnet message for timestamp requests
random sampling of service nodes, call timestamp lmq message

checks timestamp of 5 service nodes, if local time is 30 seconds different from 80% of the nodes tested then warn user

tracks external timesync status and timestamp participation of service nodes

clean up includes

new template struct for participation history, individual types for participation entry

refactor checking participation

update select_randomly, move the testing for variance overflow

version locks, bump to 8.1.5

explicit casting for mac & clang

note to remove after hard fork

timestamp debugging log messages

debugging messages for before timesync - before message sent

logging errord with compiling

print version and change add_command to add_request_command

log if statement test

std::to_string replaced with tools::view_guts for x25519 key

check if my sn is active before sending timestamp requests

logging the failures

checking if statement for success of message

more logging, if guards arn't passing

more logging, successfully tests if service node might be out of sync

more tests before we decide we are out of sync

logging output if sn isn't passing tests

if check_participation fails then disconnect

print timestamp status

remove saving variance from the participation history

reduce MIN_TIME_IN_S_BEFORE_VOTING

reset participation history on recommission

undo reduction in startup time

reduce log levels

Set hardfork time in testnet
2020-12-18 16:05:51 +11:00
Jason Rhinelander 62b88d4006 Add debugging to SN vote disallowing 2020-12-10 03:07:53 -04:00
Jason Rhinelander 4f9f39c6ab Remove nonce (replace with 0) from stake unlock
There is no reason at all to sign a *different* message in every stake
unlock; signatures already have their own nonce.

Having something that serves no purpose is worse than not having it
(because it leads to questions about why such a thing is there), so this
commit removes it by always using 0 as a nonce and comments about it.

Removing this from the broadcast tx would require a new tx extra field
so that isn't worth doing for now (but can be done in the future if we
change the tx extra structure for unlocks).

This also simplifies the nonce-to-hash code and fixes an endian bug in
it.
2020-12-04 15:08:02 -04:00
Jason Rhinelander 74db1800ef Annotate and split up ring signature code
We use generate_ring_signature and check_ring_signature somewhat
inappropriately to sign and check a signature of a single key image.
While it works for that, the full ring signature algorithm adds quite a
bit of complexity that we don't need (and simply doesn't run) for the
key image proof included in stake transactions and exported key images
from the wallet.

This splits it up, makes the key image interface considerably simpler,
and adds annotation comments through it (and also adds comments into the
"main" signature code).

This is a necessary step to getting stake transactions and key image
exports working with Ledger, without implementing the full ring
signature (because that is quite involved, and not needed for most of
these cases).

Also remove unused gen/check_ring_signatures interfaces: The raw pointer
code is never called, except through the vector version and one place in
the test suite, so just remove it and make the vector version the main
implementation.
2020-12-03 13:43:07 -04:00
Jason Rhinelander 67f4e990d2 Remove MLSAG generation
The blockchain only accepts CLSAG txes now, so no need to keep the MLSAG
generation code around.  (MLSAG verification stays, of course).
2020-11-30 00:47:12 -04:00
Jason Rhinelander e8a340e9be Make RingCT and RangeProof types type-safe enum classes 2020-11-30 00:47:12 -04:00
Jason Rhinelander b627b3b4bb Move epee includes under "epee/..."
This ends epee's include pollution.
2020-10-24 12:46:27 -03:00
Jason Rhinelander 78833f9d69 Remove deprecated epee code 2020-10-24 12:46:26 -03:00
Jason Rhinelander b7dd5e8911 Target macos 10.12
When targetting macos <10.14 macos won't allow use of anything from
C++17 that throws, such as:
- std::get on a variant
- std::visit
- std::optional::value()
- std::any_cast

This avoids all of these.

For std::get, we either replace with std::get_if (where appropriate), or
else use a `var::get` implementation of std::get added to lokimq (also
updated here).  (This `var` namespace is just an `std` alias everywhere
*except* old target macos).

For std::visit, likewise lokimq adds an var::visit implementation for
old macos that we use.

std::optional::value() uses weren't useful anyway as everywhere it calls
them we've already checked that the option has a value, in which case we
can use `*opt` (which doesn't check for contents and throw).

std::any just has to be avoided as far as I can tell, but the one place
we used it is only ever a block, so I just replaced it with a `const
block*`.
2020-10-18 11:18:08 -03: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 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 ee19af8a42 Pulse: Add more logging for when quorum signatures fail 2020-09-27 18:21:45 +10:00
Doyle 4d589f7cec blockchain: Log more useful data 2020-09-27 16:38:19 +10:00
Doyle ceff8d560c Pulse: Account for dust in portions payout >= HF16
- We also remove the distinction between service_node_total and
service_node_paid. Previously the portions payout may still have some
remainder dust loki that was not distributed, and or distributed to the
miner as the difference between the pay out and the base reward was
added to the miner.

This is still the case for backwards compatibility before HF16. After
HF16, dust is not allowed and everything is split with the remainder
dust going to the 1st contributor in the Service Node (the operator).
2020-09-26 13:52:39 +10:00
Doyle 103477ac20 block_reward_parts: base_miner_fee -> miner_fee 2020-09-26 13:52:39 +10:00
Doyle 3e8b450016 Pulse: Compute contributor portion of rewards for coinbase 2020-09-26 13:52:39 +10:00
Doyle 37e842fe86
Pulse: Record participation uniquely (#1283)
- Avoid situations where rescanning/syncing the chain pre records the
node participation when it may not be relevant anymore (i.e. someone
restarting their node would re-record historical non-participation in
blocks and prime them for re-voting off a particular node).
2020-09-26 13:51:50 +10:00
Jason Rhinelander c4750bcde5
Merge pull request #1271 from Doy-lee/PulseBlockTXPenalty
Pulse: Block TX Penalty from SN Reward
2020-09-23 23:37:45 -03:00
Doyle c986888fcf Pulse: Record Pulse participation globally on network
- Instead of the Pulse quorums validators recording participation
between each other- so failures may not manifest in a decommission until
the several common nodes align and agree to vote off the node.

Voting now occurs when blocks arrives, validators participating in the
generation of the block are marked. This is shared information between
all nodes syncing the chain so decommissions are more readily agreeable
and acted upon in the Obligation quorums immediately.
2020-09-23 15:15:16 +10:00
Doyle 320e999be7 Pulse: Apply block limit penalty on SN reward
The reward pre-hf16 is removed from the miner as they are the block
producer. After Pulse, the block producer changes to the Service Node.
Here we subtract the penalty from the Service Node Leader (the node at
the top of the Service Node List irrespective of round or even after PoW
the fallback).

https://github.com/loki-project/loki-core/issues/1267
2020-09-23 10:25:40 +10:00
Jason Rhinelander caf5e59984 Merge branch 'pulse' into dev 2020-09-18 17:40:25 -03:00
Jason Rhinelander 3f67de11df network_version_16 += _pulse 2020-09-18 16:39:50 -03:00
Jason Rhinelander 9818bb1dd1 Revert miner reward check from 48b13ae0db
The miner reward includes atomic dust resulting from truncation errors
of the other amounts, so this test for exact miner amounts failed (on
current mainnet blocks, particularly ones with lots of SN reward
recipients where such dust is likely).
2020-09-18 16:26:05 -03:00
Doyle 48b13ae0db Pulse: Avoid 0 amount output in coinbase more strictly
- 0 amount outputs can still be generated if the portions was too low
for splitting the reward amount. An example where this can happen is on
alternative rounds, splitting the TX fee to the alternative quorum, if
the portions is too low we could potentially get a 0 output which would
be interpreted as RCT and cause some bugs on the chain.

The fix here is always check each output is > 0 before generating the
output in the miner tx.

- Also explicitly check the miner output amount when validating miner
transactions. Previously we only check the sum of the outputs match the
total expected amounts, and the service node outputs match our expected
rewards (and so i.e. no explicit checking on miner amount at any point).
2020-09-18 13:50:06 -03:00
Doyle 4ceefe4d76 Pulse: Avoid miner, sn coinbase outputs when reward < 0
- Avoid generating any outputs on an alternative round, for the
alternative block producer if the total tx fee was 0.

- Remove the 1 atomic loki awarded to the miner in HF16 (previously kept
to 1 for making sure tests work, whilst implementing the new block
reward split)
2020-09-18 13:50:06 -03:00
Doyle ec6642e36f Pulse: On alt rounds, allocate tx fee to alt producer 2020-09-18 13:50:05 -03:00
Doyle 111fe26fa6 Pulse: get_round_timings needs to work with alt blocks
- Make it stop relying on the block and instead the user must pass in
the correct information
2020-09-18 13:50:05 -03:00
Doyle 31b9fbff91 Pulse: Record pulse participation and issue decommission 2020-09-18 13:50:05 -03:00
Doyle 268c0d5b63 Pulse: Fix off by one round timings, remove unused block timings fn
- Fix cached blocks using too old timestamps
2020-09-18 13:50:05 -03:00
Doyle 65cd0faaf2 Pulse: Handle alternative block reorg with Pulse blocks
- Alternative pulse blocks must be verified against the quorum they belong to.
  This updates alt_block_added hook in Service Node List to check the new Pulse
  invariants and on passing allow the alt block to be stored into the DB until
  enough blocks have been checkpointed.

- New reorganization behaviour for the Pulse hard fork. Currently reorganization
  rules work by preferring chains with greater cumulative difficulty and or
  a chain with more checkpoints. Pulse blocks introduces a 'fake' difficulty to
  allow falling back to PoW and continuing the chain with reasonable difficulty.

  If we fall into a position where we have an alt chain of mixed Pulse blocks
  and PoW blocks, difficulty is no longer a valid metric to compare blocks (a
  completely PoW chain could have much higher cumulative difficulty if hash
  power is thrown at it vs Pulse chain with fixed difficulty).

  So starting in HF16 we only reorganize when 2 consecutive checkpoints prevail
  on one chain. This aligns with the idea of a PoS network that is
  governed by the Service Nodes. The chain doesn't essentially recover until
  Pulse is re-enabled and Service Nodes on that chain checkpoint the chain
  again, causing the PoW chain to switch over.

- Generating Pulse Entropy no longer does a confusing +-1 to the height dance
  and always begins from the top block. It now takes a block instead of a height
  since the blocks may be on an alternative chain or the main chain. In the
  former case, we have to query the alternative DB table to grab the blocks to
  work.

- Removes the developer debug hashes in code for entropy.

- Adds core tests to check reorganization works
2020-09-18 13:50:05 -03:00
Doyle b359697e21 Pulse: Check block has pulse components before seeding entropy 2020-09-18 13:50:05 -03:00
Doyle 20cb89679e Pulse: Verify alt blocks from pulse 2020-09-18 13:50:05 -03:00
Doyle 9ba21d0944 Pulse: Check block timestamp conforms to round 2020-09-18 13:47:16 -03:00
Doyle 626d9fee94 sn_list: Reduce overzealous pulse block checks
- We already check these invariants, so convert them to asserts incase
the checks are ever removed from verify_quorum_signatures
2020-09-18 13:47:16 -03:00
Doyle 6c000f9c90 service_nodes: Fix regression in RNG not using same seed 2020-09-18 13:47:16 -03:00
Doyle f53560a022 pulse: Default sn info version to v5 for new entries 2020-09-18 13:47:16 -03:00
Doyle a40c3b3006 Pulse: Fallback to miner must check against block timestamp 2020-09-18 13:47:16 -03:00
Doyle bc318cf5dd Pulse: Don't verify PoW for Pulse Blocks 2020-09-18 13:47:16 -03:00
Doyle ecff118600 temp: Global logs in block verify on blockchain side 2020-09-18 13:47:16 -03:00
Doyle f6ee81fa05 temp: Log L0 block verification to global 2020-09-18 13:47:16 -03:00
Doyle 81afcdd1a6 temp: Raise log levels for debuggin 2020-09-18 13:43:51 -03:00
Doyle 6cf53600e1 Pulse: Add work around for core_tests and fix cast 2020-09-18 13:43:51 -03:00
Doyle 86aff9765e Pulse: Move block verification outside of validate_miner_tx 2020-09-18 13:43:51 -03:00
moneromooo-monero e4b2c3089b Integrate CLSAGs into loki
They are allowed from v16, and MLSAGs are rejected from v16 + 10 blocks.
2020-09-16 20:43:12 -03:00
Doyle dc46e7433e Pulse: Handle round > 255, add debug logs
- Log the generated pulse quorum
- Log the round when a msg signature fails
- Handle round > 255 and revert to allowing PoW blocks
2020-08-19 15:34:36 +10:00
Doyle ad147acc14 Pulse: Handle round > 255, add debug logs
- Log the generated pulse quorum
- Log the round when a msg signature fails
- Handle round > 255 and revert to allowing PoW blocks
2020-08-19 15:26:46 +10:00
Doyle a62ff316e3 Pulse: Queue Block Gen code review
- Rename find_named_argument -> find_prefixed_value
- Update get_current_blockchain_height() comment to specify ability to lock
- Update memcmp(address1, address2) to address1 == address2
- Make create_next_miner_block_template call create_miner_block_template
- Update LMQ x25519 keys only when key has changed
- construct_miner_tx: Use C++17 features
- Pulse: Add log category "Pulse"
- Pulse: Check shutdown before blockchain height
- Pulse: Use get_human_readable_timespan
- Pulse: Switch to MINFO, enable with --log-level +pulse:DEBUG
- Pulse: Add height into context
- Pulse: Remove some default switch cases hiding compiler warnings
- SN: Update hardcoded '9' literals to network_version_9_service_nodes
- Core: Use using namespace std::literals
- Miner: Change num_blocks availability to debug
- RPC: Gate test rpc commands to != MAINNET
- Wallet: Store wallet before deinitialization instead of refresh
2020-08-18 11:59:53 +10:00
Doyle 601e9f77e1 Pulse: Rename participation to validator_bitset 2020-08-18 11:59:53 +10:00
Doyle a821af9a8f Pulse: Update LMQ active pubkeys when proof arrives
- Fixes a edge case that is prevalent in testing when adding nodes to
the network. Presuming an emty SN network, with Pulse once N nodes are
added to the network, the network switches from PoW blocks to Pulse
Blocks which require SN to SN communication.

SN's can't communicate with each other until their uptime proofs are
propagated with the IP bundled and currently LMQ only updates said
communication info when blocks are added, meaning Pulse can never
proceed.

So instead on receipt of an uptime proof we add the comm data to LMQ if
it was accepted and said Service Node is active.
2020-08-18 11:59:53 +10:00
Doyle a67b823fef Pulse: Add edge case for debug 1-2 sized quorums in Pulse 2020-08-18 11:59:53 +10:00
Doyle 00dde17885 Pulse: Improve error messages for SN validate_miner_tx 2020-08-18 11:59:53 +10:00
Doyle 11410837d8 Pulse: Make generating payouts a standalone function 2020-08-18 11:59:53 +10:00
Doyle a6e1f82f7a Pulse: Make active snodes info public, disambiguate next_block_template
- Make active snods info public for Pulse to query the list to allow
  Pulse quorums to be generated outside of the Service Node List.
2020-08-18 11:59:53 +10:00
Doyle 2894296556 Be more careful in developer hash overflows 2020-08-18 11:59:53 +10:00
Doyle d7848eb482 Pulse: Check block nonce is 0 when signatures avail 2020-08-18 11:59:53 +10:00
Doyle 596c6d94fb Pulse: Allow leader to reappear in alternative pulse rounds 2020-08-18 11:59:53 +10:00
Doyle 457fd4d027 Pulse: Change queued_winner->block_leader, verify alt round rewards
Changes naming scheme
 - Block Producer: The Service Node/Miner reponsible for generating the block
 - Block Leader: The Service Node that is at the top of the Service Node
   List queue. They are also by default on pulse round 0, the block producer.
   If that round fails, then the block producer is changed as per the LIP-6
   with multi-block seeding.

This commit also re-writes validate miner TX to repeat some of the
verification code. This appears to be clearer than having multiple
variables that change the verification loop in small ways which was more
error prone than I'd like to tolerate.
2020-08-18 11:59:53 +10:00
Doyle 42c8e8e6e9 Pulse: Embed entropy call into generate pulse quorum
There's no custom code that relies on it at the moment, merge it
together which sets up a simplified way to get different pulse rounds
for tests.
2020-08-18 11:59:53 +10:00
Doyle 2189bd29aa tests: Adjust tests to work with leader validation 2020-08-18 11:59:53 +10:00
Doyle 6741e0da11 Pulse: Validate block producer in service node list 2020-08-18 11:59:53 +10:00
Doyle 95a2ae88bc service_nodes: Rename block_winner to payouts
With Service Node List now generating 2 coinbase rewards, block_winner
is ambiguous, so, distinguish the reward generated for nodes at the top
of the queued list as- queued_winner.
2020-08-18 11:59:53 +10:00
Doyle 4c3e12c6cc Pulse: validate_miner_tx pass in block to service_node_list 2020-08-18 11:59:53 +10:00
Doyle 1be356e15a Pulse: Move verification to block. Add support to core tests.
Verification needs to go to the block, not the header to ensure it does
not get included in the block hash.
2020-08-18 11:59:53 +10:00
Doyle 7b9a468df5 pulse_min_service_nodes: Parameterize with nettype 2020-08-18 11:59:53 +10:00
Doyle 254e6aa80d Code review
- Remove PoW/Difficulty information for Pulse Block printout
- Use unary + to co-erce char's in ostreams
- Avoid epee::string_tools::pod_to_hex for lokimq equivalent
- Express validator bitmask in terms of PULSE_QUORUM_NUM_VALIDATORS
- Fix bug in generating Pulse Quorum, avoiding the use of the 0th
  service node in pulse_candidates
- Switch to std::any for void * context
2020-08-18 11:59:53 +10:00
Doyle 63ba795c7e Pulse: DRY quorum signature verification
- By merging the quorum verification with pre-existing checkpointing
code, checkpoints votes are currently being sorted by the vote index
order. This was also enforced on the pulse signatures.
2020-08-18 11:59:53 +10:00
Doyle c9d3f03f51 Pulse: Uncompress generate_quorums switch statement change
- Pulse is generated in another function so undo the handling of
  3 quorums in one switch case to be piecewise for readability.
2020-08-18 11:59:53 +10:00
Doyle 7883c875e0 Pulse: Support rounds changing the leader/validators in blocks
- Previously we generated quorums based off the previous quorum. To
  incorporate the round, we can no longer pre-compute the quorum.
  Instead it must be calculated when the block arrives, just before the
  Service Node List is changed.
- Add tests to check round changing works
2020-08-18 11:59:53 +10:00
Doyle 80552293a3 blockchain: set verification failed in subsystem, check validator bit masks 2020-08-18 11:59:53 +10:00
Doyle f55a00d87f Pulse: Can use the previous quorum for Pulse
Once a block is added, the next leader is going to generate the Pulse
data based on the Service Node List at that point. (List won't change
until a block is added anyway).

This was failing before because of entropy being generated from the
wrong height not that the quorum was chosen incorrectly.
2020-08-18 11:59:53 +10:00
Doyle a9f1d1c5de Tests: Fix test entropy using wrong height
- Entropy is taken from the blockchain height, (i.e. if top block is block
  100, then the blockchain height is 101). When the Core Tests is generating
  a block in the tests, we haven't added the block to the DB yet, so when
  db.height() is called in the tests, the height returned is 100.

  Whereas when the Blockchain is receiving a block and on validation,
  block 100, has been added to the DB already (added to DB, then we do
  Service Node List validation). So the DB returns a blockchain height of
  101. The 2 inconsistencies causes differences in the source entropy
  for the blockchain.

- Begin moving code to allow creating blocks with custom pulse data in
  tests by introducing loki_create_block_params. The workflow is to get
  loki_chain_generator to return you the parameters to form the next
  valid block. The user can modify the parameters to other valid
  blocks/invalid blocks.

- Change the stable sort to a normal sort to avoid requiring the caller
  side of the API needing to implicitly know that the list given must
  be sorted lexicographically.
2020-08-18 11:59:53 +10:00
Doyle f6c0f19f43 Pulse: Fix incorrect validator quorum selection
We don't want to choose from [0, (partition_index - running_it)) from
the active Service Node list. What we desire is a sliding window that
always considers half of the list.

Once we swap a Service Node into place, 1 service node from the second
half of the list will enter the first half. Otherwise, if we have
exactly PULSE_QUORUM_SIZE nodes to choose from, we would never be able
to fulfill a quorum as there are only half of the nodes to choose from,
(the other half would be in the 2nd half of the list and never
be considered) in the old scheme.
2020-08-18 11:59:53 +10:00
Doyle 475ed74b28 Pulse: Move verification to block. Add support to core tests.
Verification needs to go to the block, not the header to ensure it does
not get included in the block hash.
2020-08-18 11:59:53 +10:00
Doyle 030a506233 Pulse: Move pulse quorum gen to separate function generate_pulse_quorum 2020-08-18 11:59:53 +10:00
Doyle a1c658d814 Pulse: Verify incoming pulse blocks 2020-08-18 11:59:53 +10:00
Doyle 0a4d8319b7 Pulse: Pass std::seed_seq to mt19937_64 2020-08-18 11:59:53 +10:00
Doyle 4994cf1a31 Pulse: Remove unused xor64 2020-08-18 11:59:53 +10:00
Doyle c529504b2f Pulse: Generate quorum_rng_seed with std::seed_seq 2020-08-18 11:59:53 +10:00
Doyle ae29ecb335 Code review, keep nonce, remove HF_VERSION..
- Keep none for blocks
- Remove HF_VERSION_PULSE and prefer network_version_16 for big features
  - Keep HF_VERSION_... for smaller feature flags
- Add operator< for pulse_sort_key
- Avoid erase() in validators gen loop for pulse
2020-08-18 11:59:53 +10:00
Doyle 5a49e03ebf Pulse: Assign pulse quorum to quorum_manager 2020-08-18 11:59:53 +10:00
Doyle e83d38bf01 SN: Turn SN pulse data into proper sort key
Add stable sort to handle ties via public keys. The quorum_index reduces
bias in Service Nodes choosing a lexigraphical closer public key. On
launch all Service Nodes will have this set to 0, but eventually it
will hold a unique value per Service Node.
2020-08-18 11:59:53 +10:00
Doyle d9be78edc9 Pulse: Allow iterating the pulse quorums 2020-08-18 11:59:53 +10:00
Doyle d869c592b8 Pulse: Support generating 1-time quorums for a block 2020-08-18 11:59:53 +10:00
Doyle 40fa4c51db generate_quorums: Switch to case where switch (cleanup prep for Pulse) 2020-08-18 11:59:53 +10:00
Doyle 9b2f3c9263 SN: Rewrite Blink quorum generate to avoid mutating list
Avoid changing the list which may affect future quorum_types (i.e.
Pulse) using a list that has been modified prior by calculating the
Blink quorum.
2020-08-18 11:59:53 +10:00
Jason Rhinelander 963f22c1f2 Fix failure to accept a null-winner block
With a null winner block the `if ((miner_tx.vout.size() - 1) <
winner.payouts.size())` fires, when it shouldn't.  Bypass checks (after
verifying that a null winner is correct) for such a block.
2020-08-17 02:54:45 -03:00
Jason Rhinelander 495ad6d959 Remove obsolete HF checks from uptime code 2020-08-17 02:54:45 -03:00