Commit Graph

64 Commits

Author SHA1 Message Date
Andreas Fackler d52be00d0e Fix CI.
Fix a few new Clippy lints, and some broken dependencies.
2020-03-20 10:37:31 +01:00
Weiliang Li e43baa4b8b fix some clippy warnings 2019-11-12 11:12:47 +01:00
Andreas Fackler ab3da7cf64 Validate JoinPlan. 2019-08-27 20:51:24 +02:00
Andreas Fackler 0e50c2f473 Remove non-threshold keys from NetworkInfo. 2019-08-27 20:51:24 +02:00
Andreas Fackler 0e51bb3615 Change the `Target` variants.
`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.
2019-07-29 12:08:54 +02:00
Andreas Fackler 15f7313706 Extract test framework into hbbft_testing crate. (#404)
* 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.
2019-04-26 15:54:11 +01:00
C.Solovev 0e7edb2be7 Add `honey_badger` getter for `DynamicHoneyBadger` 2019-02-25 18:43:15 +01:00
Andreas Fackler bd74cc2fa9 Use Rust 2018 idioms consistently.
Apply `cargo fix --edition-idioms`.
2019-01-09 11:56:40 +01:00
Andreas Fackler 87b1d45d97 Rename DistAlgorithm to ConsensusProtocol. 2019-01-08 14:14:34 +01:00
phahulin 5bfcd6c692 Split FaultKind. (#371) 2019-01-02 13:55:50 +03:00
Andreas Fackler 108ac574bb Migrate to rand 0.6. (#368)
* Migrate to rand 0.6.

* Prefer SliceRandom where it makes sense.
2018-12-27 10:34:34 +01:00
Marc Brinkmann eafa77d5fc OsRng / external RNG Refactoring (#357)
* 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.
2018-12-14 12:51:09 +00:00
Demi Marie Obenour 7fb172cda2 Switch to 2018 edition idioms (#359)
* Switch to 2018 edition idioms

* Fix build with Rust 2018.

* Remove unnecessary cloning, make `max_faulty` const.

* Remove unneeded `extern crate` statements.
2018-12-11 14:44:36 +01:00
Andreas Fackler da3d50d1b0 Fix some TODOs, make key share in net info optional. 2018-11-29 12:45:39 +01:00
Andreas Fackler b2071fe2be Extend the documentation, simplify errors.
This changes and adds several doc comments, adds the `missing_docs` lint
and simplifies some of the error types.
2018-11-27 12:25:50 +01:00
Andreas Fackler ae37879239 Remove the random_value option. 2018-11-22 13:07:58 +01:00
Andreas Fackler c2a76add5d Include the full Params in JoinPlan.
This ensures that a new node runs with exactly the same parameters as
the rest of the network.
2018-11-21 10:28:56 +01:00
Andreas Fackler c94e3ff16f Add epoch getters to JoinPlan, HB, DHB and QHB. 2018-11-18 10:48:38 +01:00
Andreas Fackler e89688bbd8
Allow arbitrary validator set changes in DHB. (#339)
* 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.
2018-11-18 10:17:33 +01:00
Andreas Fackler 30cce9bed8 Add a random_value option to HB and DHB.
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`.
2018-11-12 14:16:21 +01:00
Andreas Fackler d0b96f2dc8 Simplify the sender queue.
Remove the distinction between linearized and regular epochs.
Avoid iterating through the whole outgoing queue on epoch change.
2018-11-08 13:14:43 +01:00
Andrew Lyjak 9a8836cf15 Rename `ThresholdDecryption` to `ThresholdDecrypt` 2018-11-07 11:13:10 -05:00
Andreas Fackler b71f9142f6 Add SenderQueue convenience methods for voting. 2018-11-06 14:12:31 +01:00
Vladimir Komendantskiy a8586efc81 work on review comments 2018-11-05 11:11:00 +00:00
Vladimir Komendantskiy ee46dd4b81 sender queue implementation 2018-11-05 11:11:00 +00:00
Andreas Fackler 13340d7ad0 Remove redundant log statements, minor cleanups. 2018-11-03 15:36:32 +01:00
Logan Collins 700f9b55e3 add encryption schedule to join plan (and batch), remove unnecessary lint supression, style change 2018-10-31 19:44:22 -05:00
Logan Collins ad5f725b2e
Merge branch 'master' into optional_threshold_encryption_209 2018-10-31 01:09:35 -05:00
Andreas Fackler df36258715 Instead of macro_use, use use. 2018-10-30 08:11:03 +01:00
Andreas Fackler c011ef49c5 Make the BA session ID generic. 2018-10-29 09:28:09 +01:00
Logan Collins a91e38e3c5 fmt change + don't skip InProgress for NodeChange 2018-10-27 17:44:08 -05:00
Logan Collins 00985edc46
Merge branch 'master' into optional_threshold_encryption_209 2018-10-25 13:41:56 -05:00
Logan Collins 6b101ca3be skip InProgress state for non-KG changes, revert change to comment, push serialization inside epoch_state, skip threshold_decryption Step, use getter instead of pub(crate) for honey_badger.encryption_schedule 2018-10-25 13:38:16 -05:00
Andreas Fackler f27af31ac7 Improve SyncKeyGen error handling. 2018-10-25 17:22:16 +02:00
Andreas Fackler dda2f54a06
Minor improvements to the Step API. (#292)
* Minor improvements to the Step API.

* Make use of DistAlgorithm::our_id.

* Rename Step::and to join.
2018-10-25 14:44:28 +02:00
Logan Collins 92a32d827d merge from upstream 2018-10-24 15:55:44 -05:00
Logan Collins 982619327b formatting, address pr review concerns, move encryption into epoch_state, turn off borrowed box lint 2018-10-24 15:46:44 -05:00
Andreas Fackler 3981b37fa3 Minor API and documentation improvements. 2018-10-24 17:38:41 +02:00
Andreas Fackler 493b946a4a Use DeserializeOwned where applicable. 2018-10-24 15:03:56 +02:00
Andreas Fackler 6375decbc0 Use derivative for configurable Debug impls. (#283) 2018-10-24 13:01:52 +02:00
Logan Collins 877903aeac apparently nightly and stable cargo fmt have different opinions 2018-10-24 00:23:09 -05:00
Logan Collins 212d9b57b8 run cargo fmt 2018-10-24 00:18:18 -05:00
Logan Collins 40e611c824 merge from upstream 2018-10-23 23:54:54 -05:00
Logan Collins 85910d8d43 refactor change and make it possible for encryption to be optional 2018-10-23 23:21:59 -05:00
Andreas Fackler bc6a67dc01 Extend API to work without DistAlgorithm.
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.
2018-10-23 22:10:28 +02:00
Andreas Fackler ff8fe493d2 Limit the number of buffered key gen messages. 2018-10-23 11:13:55 +02:00
Andreas Fackler 36583de455 Add fault checks to the tests.
The `network` test module now verifies that correct nodes are never
reported as faulty.

The `DuplicateAck` fault is removed for now, because the same ack is
usually handled multiple times in DHB.
2018-10-22 17:23:03 +02:00
Andreas Fackler d49350ecd9 Log more DKG-related faults. 2018-10-22 16:09:00 +02:00
Logan Collins fabd725851 semi sure of these changes, also a bit WIP 2018-10-21 15:47:44 -05:00
Logan Collins 813a76bb5f add configuration options for optional/periodic encryption scheduling 2018-10-17 12:27:00 -05:00