* 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.
* Ported threshold_sign test to the new framework
* Ported the first three broadcast tests to the new framework
* Extracted messages storting and random swapping to reusable functions
Used to compose ProposeAdversary's behavior without having to duplicate code
* Implemented ProposeAdversary for the new integration testing framework
Added "id()" function to the "NodeMutHandle", required for sending messages to all nodes
ProposeAdversary needs access to all faulty node's netinfo. We follow the example of the binary_agreement_mitm integration test of using an reference counted Mutex to make netinfo available on both Consensus Protocol construction and in the Adversary implementation.
Unlike binary_agreement_mitm every faulty node needs to use its own netinfo for the broadcast algorithm, so we store all nodeinfo structures in a Map instead of just the nodeinfo of the first node.
Ideallly the new network simulation library should provide netinfo similar to the old library to avoid these hideous workarounds.
* Migrated test_broadcast_random_delivery_adv_propose to the new network simulator
Refactored the implementation of ProposeAdversary to closely resemble the behavior in the old network simulator library.
Implemented a pick_random_node function to sort messages for a random node id. Switched from using "inject_message" to joining messages generated by adversaries' temporary Broadcast Consensus Protocols with the Step generated by regular operation.
* Ported RandomAdversary to the new network simulator library
Ported all broadcast integration tests and replaced the old tests with the new.
* Eliminated the old broadcast integration test, replaced with the new
* Ported subset test to the new framework
Adjusted message queue size as suggested by Andreas
* Ported the first three honey_badger tests to the new framework
* Re-implemented FaultyShareAdversary for the new framework
Eliminated the old honey_badger integration tests, replaced with implementations using the new net simulator framework
* Fixed issues reported by clippy
* Fixed issues reported on code review
* Fixed issues reported by clippy
* Implemented a broadcast test dropping messages similar to the tests written in the old framework
* Picking the proposer id at random, verifying all possible output cases
If the proposer is faulty the message queue may starve, but the outputs of all correct nodes need to be empty, if the broadcast protocol produces output nonetheless all correct nodes need to have the same output.
If the proposer was correct all correct nodes need to output its proposed value.
* Eliminated duplicated semicolon
* Consistently using TestRng and proptest in all newly ported tests
* Increased the drop_and_re_add test message limit to 20k per node
* Removed unnecessary closure
* Increased the tolerance for deviations from the expected value range to eliminate random test failures
This includes a threshold signature in each batch that can be used as a
pseudorandom value.
Also moves `EncryptionSchedule` from `threshold_decrypt` to
`honey_badger`.
* 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
* 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
* 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.
This allows the caller to address nodes by ID instead of by index.
Also contains a few other minor changes that will be needed for
`DynamicHoneyBadger`.