* 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
* Use `OsRng` in place of `thread_rng`.
This changes the defaults of any builder by instantiating an `OsRng` instead of
a `thread_rng`, the former being much more secure than the latter.
Additionally, all the unit tests that still instantiate RNGs manually used `OsRng`s
as well; while there is no actual need for this level of security in tests, the performance overhead is very small and random number generation complexity has such a small impact on these tests that the convenience of being able to ban `thread_rng` from the codebase altogether, setting a good example and avoid issues when refactoring later greatly outweigh the negatives.
* Instead of storing random number generators in the various consensus algorithm instances, pass them in from the outside whenever they are needed.
This changes a large amount of interfaces (and in this commit is only partially done, since `DistAlgorithm` needs to be fundamentally altered as well.
It also obsoletes parts of the `util` module.
* Added an `R: Rng` type parameter to both methods of `DistAlgorithm`, forcing callers to pass in their own Rngs.
* Fixed documentation grammar and spelling in some of the altered interfaces due to RNG refactoring.
* Move `rng` argument to the end of the argument for most functions.
Also includes a reformatting due to Rust 1.30.
* Updated tests, accomodate `rng`-API changes.
* Fixed remaining compilation issues with new RNG code.
* Fix illegal `self` import outside curly braces.
* Cleaned up comments and fixed broken definition of `broadcast_input`.
* Updated existing test cases to properly work with static dispatch randomness.
* Do not use boxed `Rng`s for key generation in test networks.
* Use the passed-in `Rng` in `ReorderingAdversary`, instead of storing a boxed one.
* Fixed clippy lints after refactoring.
* Removed some no-longer necessary manual `fmt::Debug` implementations in test framework.
* Use `OsRng` even in tests in `binary_agreement_mitm`.
* Use a proper deterministic RNG in tests `binary_agreement_mitm`.
* Refactor `examples/simulation.rs` by not using `ThreadRng`, passing generic `Rng` parameters throughout and using a type alias instead of a newtype as the `Transaction`.
* Remove `thread_rng` use from `examples/node.rs`.
* Explicitly construct `InternalContrib` in `DynamicHoneyBadger::propose`.
* Fixed typo in description of `DistAlgorithm` trait.
* Added missing debug implementations for various test networking parts.
* Initial proptest parts added, including network dimensions.
* Use a test configuration for proptests.
* Tweaks and documentation.
* Improved documentation for `net_dynamic_hb` test.
* Added two missing `;`.
* Allow insane topology creation.
* Renamed `is_sane()` to `is_bft`, `halfway` to `average_higher` and improved comments per suggestions.
* Rename `NetworkTopology` -> `NetworkDimension`.
* Silence newly added clippy warning.
* Smoothed `README.md`.
* Remove workaround for beta/nightly again.
* Caved in to clippy and changed the bft condition.
Added a new adversary API, which changes how adversaries in tests can affect the network and nodes, restricting them to the capabilities listed in the HBBFT paper.
Added new virtual network implementation for tests.
Added `net::VirtualNet` as an upcoming replacement for the current networking implementation in the test, along with auxiliary functions. The new system allows easier manipulation through implemented adversaries, better reporting and should offer a more friendly API.
Documentation for the functionality can be found in `tests/README.md`.