Commit Graph

78 Commits

Author SHA1 Message Date
Weiliang Li 7c213fed71 update Cargo.toml 2019-11-12 11:12:47 +01:00
Andreas Fackler 0e50c2f473 Remove non-threshold keys from NetworkInfo. 2019-08-27 20:51:24 +02:00
Andreas Fackler 8122a10179 Add HoneyBadger::skip_to_epoch. 2019-07-23 13:30:02 +02:00
Vladimir Komendantskiy 10dbf705e4 using serde derive feature 2019-04-02 12:42:51 +02: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
Andreas Fackler 7677f6343c Remove unwrap and expect calls from production code. 2018-12-17 15:38:18 +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 ceb416a6e1 Make received_proposals public.
We are going to need this if we use `HoneyBadger` directly, to replace
`DynamicHoneyBadger::should_propose`.
2018-12-03 17:51:49 +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 9049dd1793 Add a `Params` struct with HB parameters.
This removes some duplication between DHB, HB and their builders.
2018-11-19 14:01:46 +01:00
Andreas Fackler c94e3ff16f Add epoch getters to JoinPlan, HB, DHB and QHB. 2018-11-18 10:48:38 +01:00
Andreas Fackler 767944c0f6 Fix random_value doc comment. 2018-11-12 14:16:21 +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
Andreas Fackler 7f784e7852 Make Step independent of DistAlgorithm. 2018-11-08 08:51:17 +01:00
Andrew Lyjak 9a8836cf15 Rename `ThresholdDecryption` to `ThresholdDecrypt` 2018-11-07 11:13:10 -05:00
Vladimir Komendantskiy 697565c97a
Move sender queue impls out of Honey Badger algorithms (#321)
* moved SenderQueueable impls out of HB algorithm modules and into sender_queue

* added sender_queue::honey_badger
2018-11-06 17:22:28 +00:00
alyjak bb64be55af issue286: make `ThresholdSign` and `ThresholdDecryption` APIs consistent (#316)
* issue286: make `ThresholdSign` and `ThresholdDecryption` APIs consistent

This gives both methods a `set_message(payload)` and a `sign()` method. If `sign` is called prior to
`set_message` or if was already called, then an empty step is returned. Otherwise share messages are
sent out to peers and `try_output` is called.

* Incorporating feedback from review of pull request #316

* Fixing the stack overflow and responding to further feedback

* Updates module documentation to reflect the API change from #286

* adds a new constructor to `ThresholdSign` and `ThresholdDecryption`

The `new_with_<payloadname>` function allows setting payload on construction
instead of as a separate call.
2018-11-06 16:26:48 +00:00
Vladimir Komendantskiy f02bbbb9da Updated documentation and removed a debug print 2018-11-05 14:25:59 +00:00
Vladimir Komendantskiy 3deb5f1bce refactored an error! by adding linearizable epochs and wrote a comment on eras 2018-11-05 11:11:00 +00: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 dcbc065388 clippy and fmt 2018-10-31 01:27:28 -05:00
Logan Collins ad5f725b2e
Merge branch 'master' into optional_threshold_encryption_209 2018-10-31 01:09:35 -05:00
Logan Collins 09833f2b56 remove box in propose 2018-10-31 01:08:09 -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 3ffb1ba48a merge changed step mutability requirements 2018-10-25 14:11:44 -05:00
Logan Collins 00985edc46
Merge branch 'master' into optional_threshold_encryption_209 2018-10-25 13:41:56 -05:00
Logan Collins f88c50f970 forgot to run cargo fmt first. 2018-10-25 13:39:00 -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 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 ca56668547 Address lints 2018-10-24 00:12:12 -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