* Extract test framework into hbbft_testing crate.
Also update Rust and some dependencies.
* Rename DHB tests.
They are only called `net_dynamic_hb` because we used to have two test
frameworks and two DHB test modules.
* impl. old validator removal from sender queue peer list
* provided current validators for sender queue peer removal
* renamed validators as nodes in the sender queue
* Revert "renamed validators as nodes in the sender queue"
This reverts commit 78e1e1569d5f624c469bf752a5bf874b434a61d2.
* cleaned up the SQ builder and moved removal of old validators to triggers
* computing participant transitions from batches in the sender queue
* added a missing comment
* removing old validators as soon as all messages are delivered up to the last epoch
* review comments
* rejoined Node 0 in the old DHB test
* DHB test uses the first step of the DHB algorithm on the restarted node
* changed test batch verification to account for node 0 removal
* updated net_dynamic_hb test to cope with the removal of node 0
* relaxed verification of batches to only check inclusion of node 0 transactions
* corrected test state transitions in DHB and QHB tests
* added a builder function for a joining QHB
* rejoin the pivot node instead of node 0
* changed VirtualNet::verify_batches to take a full node as an argument
* corrected a variable name
* correction: use the pivot node ID instead of indices
* corrected the pivot node ID
* simplified a find
* simplified a conditional statement
* corrected the inference of expected output in verify_batches
* WIP on DHB and QHB tests; VirtualNet::verify_batches made more general
* readded node 0 in the DHB test when InProgress change is output
* allowed node 0 to miss a few batches while it is removed in the QHB test
* edition and rebase fixes
* refactored the use of process_step
* added VirtualNet functionality of node insertion and removal
* restarting the pivot node after all validators add it as peer
* clippy lints in net_dynamic_hb
* added observer in the QHB test; removed the DHB TestNetwork test
* fixed rng usage in the QHB test
* check output length when verifying batches; comment correction
* Allow arbitrary validator set changes in DHB.
This replaces `NodeChange` with a full list of IDs and public keys,
instead of just a single to-be-added or to-be-removed node, to allow
completely replacing the set of validators by any arbitrary new set in a
single key generation step.
* Address review comments: added_nodes, comments.
* Fix MessageScheduler::First.
Make sure every node eventually gets to handle its messages.
* adds an RNG argument to the transaction queue
* minimal support of transaction queue RNG in tests
* added the TransactionQueue trait object
* review comments and streamlining of trait bounds
* removed the RNG from the transaction Q and placed it into QueueingHoneyBadger
* formatting fix
Instead of just the public key, the batches returned from
`DynamicHoneyBadger` and `QueueingHoneyBadger` now contain the full
`NetworkInfo`, so the user can use the validators' keys for signing and
encryption.
* spam protection part 1: remote epoch tracking in HoneyBadger
* moved handling of EpochStarted out of EpochState
* allowed EpochStarted from observers
* removed an unnecessary function call
* updated formatting to beta
* removed an unnecessary variable
The Dynamic Honey Badger tests would currently fail _without_ faulty
nodes, because with "first" delivery, all but the first _N - f_ nodes
are lagging indefinitely.
This change makes sure we give lagging nodes a chance to finish the first
phase of the test and arrive at the batch containing the completed
`Remove` event.
* Move `CoinState` and `Agreement` definitions from `agreement/mod.rs`
to `.../agreement.rs`.
* Move `DynamicHoneyBadger` definition from `dynamic_honey_badger/mod.rs`
to `.../dynamic_honey_badger.rs`.
This adds a bit of special handling to make sure messages don't stay in
the queue forever in the `dynamic_honey_badger` tests, even if there is
only one validator: the problem was that the single validator is always
ready for input, so it never processed incoming messages. However, to
add the new validator, it needs to process the joining node's key
generation messages.
`DynamicHoneyBadger` now also removes committed key generation messages
from the queue, to avoid committing duplicates.
Random adversaries are created for `broadcast` and `honey_badger`. Random value generation was added for all type-dependencies of these algorithms, causing the `Rand` trait to be implement for a large portion of the codebase.
Additionally, `MessageWithSender` turned into an actual struct, making it much easier to handle. Tuple-like construction is still available through `MessageWithSender::new()`.
* Clear outdated key gen messages from the buffer.
* Process output after proposing, to make `HoneyBadger` work with a
single validator.
* Print an error if threshold decryption fails.
* Verify decryption shares with the correct ciphertext.
* Insert all ciphertexts from an epoch at once; otherwise contributions
can be omitted from a batch.
* Remove `BoolWithFaultLog`: It's easier to return a tuple, and it's
used only in one place now.
* Avoid redundant signature verification in `VoteCounter`.
* Fix the tests for `QueueingHoneyBadger`.
* Use fewer network sizes to speed up tests a bit.
This makes Honey Badger a bit more complicated but a lot more flexible:
It is now unaware of transactions and basically just runs one Subset
instance per epoch.
That way, users can use any kind of external queue, control throttling
and prioritization.