`Target` now only has a `Nodes` and an `AllExcept` variant, to specify
a message's target via a whitelist or blacklist. This avoids cloning
the message content and simplifies the code in several places.
* Added extra message types
* Add send functions for new message types
* Store original value message received from proposer
* Modify handle_value for optimized broadcast
* Modify handle_echo for optimized broadcast
* Add handle_echo_hash function for optimized broadcast
* Add handle_can_decode function for optimized broadcast
* Fixes handle_ready and send_echo functions:
1) Modify handle_ready function for optimized broadcast
2) Modify send_echo function to send `Echo` messages to different subset of nodes from
handle_value and handle_ready functions
* Remove value_message and fix typos
* Add functions for filtering all_ids
* Separate send_echo to send_echo_left and send_echo_remaining
* Rename pessimism_factor to fault_estimate
* Remove redundant bools from Broadcast struct
* Fix multiple counting of nodes who sent both `Echo` and `EchoHash` by changing
`echos` map structure
* Allow conflicting `CanDecode`s from same node
* Fix left and right iterators for `Echo` and `EchoHash` messages
* Fixes bugs in left and right iterators and adds additional checks in handle
functions
* Change can_decodes to BTreeMap<Digest, BTreeSet<N>> and fix send_can_decode
* Minor fixes
* Modify send_echo_remaining to take a hash parameter
* Fix bug in left and right iterators.
* Excluding proposer in iterator led to infinite loop when our_id == proposer_id
* Fix bug in handle_echo and compute_output
* send_can_decode call in handle_echo returned early
* compute_output needed `N - f` full `Echo`s to decode
* Refactor `echos` map to take an EchoContent Enum for `Echo` and `EchoHash` messages
* Run rustfmt
* Refactor to avoid index access and multiple map lookups
* Fix comments and minor refactorings.
* Add an`AllExcept(BTreeSet<N>)` type to `Target` enum to enable sending messages
to non-validators from Broadcast.
* Use `Target::AllExcept` in Broadcast to send `Echo` messages to all non-validator nodes.
* Add `AllExcept(_)` match arms for `Target` match expressions.
* Rename `AllExcept` parameter from `known` to `exclude`.
* Modify send_can_decode to send to all nodes who haven't sent an `Echo`.
* Update docs for broadcast
* Improve formatting and add comments for broadcast docs.
* Fix formatting.
* Allow for sending multiple `CanDecode` messages with different hashes.
* Fix comments.
* Fix bug in sending `Echo`s when node has not received `CanDecode`.
* 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.
This merges the four maps into a single map, each entry of which tracks
the progress of both the `Broadcast` and the `BinaryAgreement`
subalgorithm for an individual proposer. Two advantages:
* A slight optimization, because the `Broadcast` instance is dropped as
soon as it is not needed anymore.
* The static guarantee that certain impossible situations (inserting a
broadcast value twice) cannot happen.
The module is also split up into smaller files.
Improve the broadcast documentation.
* Reorganize the explanation, separate algorithm from justification.
* Some of the message numbers were wrong.
* Use `[i]` for indices, even in pseudocode.
Since `Broadcast` operates on a `Vec<u8>` anyway, let's not make it
generic in a serializable value. This removes the TODO.
The `data_shard_num` field is also removed; it was redundant now.
Extends all APIs so that the user doesn't need to import the
`DistAlgorithm` trait.
Also, removes the error on inputting too late into `BinaryAgreement`:
whether the input still matters is an implementation detail.
* Use threshold_crypto 0.2.0-beta1 to fix overflow.
* Upgrade to hex_fmt 0.2.
* Depend on threshold_crypto 0.2.0-beta2.
This avoids depending on two different versions of hex_fmt.
* Add support for RNG instantiation in proptests.
* Use `proptest` module strategy to create the rng for `net_dynamic_honey_badger`.
* Use seed generation instead of RNG instantiation in tests.
* Remove fixed RNG in `generate_map`.
* `VirtualNet` now supports setting the random generator through the builder.
* Add missing `time_limit` field to `::std::fmt::Debug` trait implementation on `NetBuilder`.
* Pass an instantiated random number generator through `NewNodeInfo` as a convenience.
* Make the random number generator of `DynamicHoneyBadgerBuilder` configurable, at the cost of now requiring mutability to call `build_first_node()`.
* Ensure RNGs are derive from passed in seed in `net_dynamic_hb` tests.
* Correct inappropriate use of `random::Random` instead of `Rng::gen` to generate dependent values in `binary_agreement`.
The original implementation used `rand::random()`, which will always use the `thread_rng`, ignoring the fact that an RNG has actually been passed in.
* Do not use `OsRng` but passed in RNG instead.
* Use reference/non-reference passing of rngs more in line with the `rand` crates conventions.
* Document `rng` field on `DynamicHoneyBadger`.
* Make `SyncKeyGen` work with the extend (`encrypt_with_rng`) API of `threshold_crypto`.
* Use passed-in random number generator in `HoneyBadger`.
* Create `SubRng` crate in new `util` module to replace `create_rng()`.
* Use an RNG seeded from the configure RNG when reinitializing `DynamicHoneyBadger`.
* Use the correct branch of `threshold_crypto` with support for passing RNGs.
* Make the `merkle` module private.
* Make sure the algorithm names are consistent.
* Add the Threshold Decryption and Synchronous Key Generation algorithms
to the list in the main crate documentation.
* Remove some trailing whitespace from the README.
* Remove checkboxes: all algorithms are implemented.
* Link to the algorithm implementations, not the modules.
* Use relative links in the README.