Commit Graph

714 Commits

Author SHA1 Message Date
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 6bcd6bc499 Replace Coin with ThresholdSign. (#280)
* Avoid redundant hashing in Coin.

* Return the full signature from Coin.

* Rename Coin to ThresholdSign.
2018-10-23 10:49:19 +01:00
Vladimir Komendantskiy 13308906aa
Merge pull request #279 from poanetwork/afck-no-dkg-fault
Log more DKG-related faults, check faults in tests.
2018-10-23 10:27:26 +01: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 e65a470720 WIP 2018-10-21 15:48:01 -05:00
Logan Collins fabd725851 semi sure of these changes, also a bit WIP 2018-10-21 15:47:44 -05:00
Andreas Fackler b3e858a079
Use published threshold_crypto 0.2. (#278)
Also: Follow the soon-to-be-official formatting guidelines:
https://github.com/nrc/rfcs/blob/style-guide/style-guide/cargo.md
2018-10-20 13:42:41 +02:00
Marc Brinkmann ba2390191f Changed the defaults for tracing to `false`. (#277)
* Changed the defaults for tracing to `false`.

* Cleanup envvar handling.

* Update `README.md`.
2018-10-18 16:13:02 +02:00
Vladimir Komendantskiy c5ebdb5347
Merge pull request #276 from poanetwork/afck-perf
Avoid BTreeMap in EpochState.
2018-10-18 11:52:59 +01:00
Andreas Fackler 06515407fc Avoid BTreeMap in EpochState.
Profiling the simulation example (with mock crypto) identified this as a hot
spot, and using a `Vec` instead and returning early where possible
speeds it up.
2018-10-18 12:22:10 +02:00
Logan Collins 813a76bb5f add configuration options for optional/periodic encryption scheduling 2018-10-17 12:27:00 -05:00
Vladimir Komendantskiy f8bf552165
Allowed building a HB with a non-0 starting epoch (#237)
* include the starting epoch in the HB builder

* added DHB starting epoch
2018-10-17 13:28:19 +01:00
Andreas Fackler 8a84109c88 Use threshold_crypto 0.2.0-beta2 to fix overflow. (#273)
* 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.
2018-10-17 12:04:13 +02:00
Marc Brinkmann 26e659079a Added `cargo audit` to CI. 2018-10-16 11:50:46 +02:00
Marc Brinkmann df1471f86d Factored out CI execution into `ci.sh`. 2018-10-16 11:02:05 +02:00
Andreas Fackler 6df72d86cc Reorder: public imports come last. 2018-10-15 13:55:04 +02:00
Andreas Fackler 13b0b04943 Update crypto, add mock crypto for testing. 2018-10-15 13:55:04 +02:00
Vladimir Komendantskiy 3af821dc88
Merge pull request #267 from poanetwork/afck-contributions
Add missing Batch::contributions getter.
2018-10-15 11:41:47 +01:00
Andreas Fackler c5b1b8bc08 Add missing Batch::contributions getter. 2018-10-15 11:44:44 +02:00
Andreas Fackler 00e1674349 Move Message out of broadcast::broadcast. 2018-10-11 22:24:13 +02:00
Andreas Fackler 7345132066 Replace HexBytes with the hex_fmt crate. 2018-10-11 22:24:13 +02:00
Vladimir Komendantskiy b5acac439c
Merge pull request #265 from poanetwork/mbr-remove-push-from-queue
Remove push from queue
2018-10-11 16:11:34 +01:00
Marc Brinkmann bcb151e78d Added some `#[inline]` statements on `TransactionQueue` impl of `Vec`. 2018-10-11 15:44:44 +02:00
Marc Brinkmann 78dd3db474 Remove `push` from `TransactionQueue` trait. 2018-10-11 15:44:10 +02:00
Vladimir Komendantskiy 59444fcf7b Support a global RNG in transaction queue (#257)
* 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
2018-10-11 15:33:03 +02:00
Andrew Gross 7dc92ed34e Minor README updates 2018-10-11 08:45:04 +02:00
Andreas Fackler 8d1361e6ae Split up messaging module. 2018-10-10 17:29:59 +02:00
Andreas Fackler 4cc35587c7 Add `NetworkInfo` to `Batch`.
Instead of just the public key, the batches returned from
`DynamicHoneyBadger` and `QueueingHoneyBadger` now contain the full
`NetworkInfo`, so the user can use the validators' keys for signing and
encryption.
2018-10-10 16:38:41 +02:00
Vladimir Komendantskiy 326616e3b8 Fixed a condition for accepting HB messages in future epochs (#261)
* fixed a condition for accepting HB messages

* corrected the condition
2018-10-10 12:43:23 +02:00
Vladimir Komendantskiy af05c44659 Revert "Spam protection part 1: remote epoch tracking in HoneyBadger (#219)"
This reverts commit b649dc6268.
2018-10-10 11:31:50 +02:00
Andreas Fackler 7002dad54c Remove unused pairing import.
Also use the new `Iterator::flatten`.
2018-10-09 11:53:20 +02:00
c0gent 520083de2e Change license to MIT/Apache-2.0. 2018-10-04 23:32:14 -07:00
c0gent 9d3e264b4f Add `Sync` req. on boxed rngs. 2018-10-04 11:42:00 -07:00
Marc Brinkmann 4b00bda555 Make `DistAlgorithm` require `Send`.
Using `hbbft` in other software that is based on frameworks like [tokio](https://tokio.rs), being `Send` is often a requirement on shared data structures.
2018-10-04 17:52:57 +02:00
Marc Brinkmann 6f0b53436f
Fix test-case shrinking issues (#254)
* Use inverse of `is_bft` function for checking in `average_higher`.

* Inline in `NetworkDimension`.

* Check more invariants when averaging network sizes.

* Added test that finds shrinking regression of `NetworkDimension`.

* Use bijection for shrinking of network dimensions.

* Fix types on dimensions.

* Hide `size` and `faulty` behind accessor methods.

* Make limits dependant on input size.

* Fixed clippy lints.

* Simplify averaging.
2018-10-04 15:52:24 +02:00
Vladimir Komendantskiy 79e5ef19fd
Merge pull request #250 from ErichDonGubler/subset-optimization-option
Make Subset optimization optional
2018-10-04 09:10:07 +01:00
Erich Gubler 2e188ca257 Add a few doc comments, make `SubsetHandler` and `SubsetHandleData` private. 2018-10-03 09:07:20 -06:00
Erich Gubler 13162a2e64 Fix #243: Make Subset optimization optional. 2018-10-03 09:07:20 -06:00
Marc Brinkmann 284b5088b3 Cleanup `handle_part` function. 2018-10-03 14:25:08 +02:00
Marc Brinkmann d2627272fe
Better proptest persistence through deterministic randomness. (#248)
* 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.
2018-10-02 16:24:51 +02:00
Andreas Fackler 1d05ad60fb Fix build failure if deadlinks is already installed. 2018-09-27 18:51:44 +02:00
Andreas Fackler 010f29f337 Run cargo-deadlinks in CI. 2018-09-26 08:44:55 -07:00
Marc Brinkmann f9030c7498 Remove leftover protobuf definitions. 2018-09-25 13:02:07 +02:00
Marc Brinkmann 5033213692
Mention Rust version in `README.md`, since the removal of itertools we now have a hard requirement of 1.29 or higher. (#241) 2018-09-25 10:04:34 +02:00
Andreas Fackler f743e4bc14 Update authors list. 2018-09-20 20:29:19 +02:00
Demi Marie Obenour 679f5784b9 Output Subset messages as received (#233)
* Outputing subset messages as received

This outputs subset messages as they are received.  All tests pass.

* Fix test suite, while still outputing results early

This fixes the test suite, while still outputting results early.

* Actually do the optimization

There is a testsuite failure in the `dynamic_honey_badger` tests.  Is
this a testsuite bug?

* Respond to code review

* Document the meaning of `None` in Subset::broadcast_results

* Fix adding Contributions and fault check

* Fix clippy

* Keep track of nodes that have sent us valid messages

Otherwise, we reject all nodes as faulty.

* Remove excessive debug logging

There is no need to log a quadratic amount of data.

* Re-add check that the observer’s values match

the rest of the nodes.  Also `panic!` if `Done` is ever not the last
value in a series of `SubsetOutput`s.

* Respond to review

* Rename field
2018-09-20 14:34:40 +02:00
Vladimir Komendantskiy 70fe9cd506
Merge pull request #240 from poanetwork/afck-itertools
Remove itertools dependency.
2018-09-20 11:30:27 +01:00
Andreas Fackler 058044959f Remove itertools dependency. 2018-09-20 11:38:02 +02:00