Commit Graph

530 Commits

Author SHA1 Message Date
c0gent d7e87e4601
Add `Sync` req. on boxed rngs. 2018-10-04 10:08:52 -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
Marc Brinkmann f38b24de2d Change the time limit to five minutes for now, until the CI situation is resolved. 2018-09-17 20:09:16 +02:00
Marc Brinkmann 900ba76e90 Disable beta, use `stable` channel. (#235)
* Disable beta, use `stable` channel.

* Pin to Rust 1.29 stable.

* Streamline clippy operation.

* Fix or disable remaining failing clippy lints.

* Use `$TRAVIS_RUST_VERSION` instead of `stable` to name toolchain.
2018-09-17 14:19:20 +01:00
Marc Brinkmann 422d8ef55b Add a test time limit. (#232)
* Added a default time limit to `NetBuilder`.

* Added environment-variable override via `HBBFT_NO_TIME_LIMIT`.

* Check for time limit exceeded when cranking.

* Fix typos and factual errors in API docs.

* Document time limit setting in tests `README.md`.
2018-09-13 15:19:22 +01:00
Marc Brinkmann 23bc38bbeb Enable overflow-checks and fix a bug that slipped through during their absence. (#231)
* Fixed bug in `average_higher`, due to wrong assumptions about operator precendence.

* Enable overflow checks in `--release` tests.

This will hardly impact test performance, as the heavy lifting is done in the threshold crypto crate. Rough benchmarks showed significant differences only when `overflow-checks` was enable for `[profile.release]` (instead of `[profile.bench]`), causing it to be applied to `threshold_crypto` as well.
2018-09-13 12:03:12 +01:00
Marc Brinkmann 0266a4107c Network dimension strategy for property based tests. (#225)
* 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.
2018-09-11 18:11:04 +01:00
Vladimir Komendantskiy 3c8ea407a2
Merge pull request #227 from poanetwork/mbr-disable-clippy
Temporarily disable clippy.
2018-09-11 16:53:23 +01:00
Marc Brinkmann 0e3cc4501a Temporarily disable clippy. 2018-09-11 16:59:47 +02:00
Andrew Gross 6a727fd281
Merge pull request #224 from poanetwork/ag-README-testing
Update testing instructions
2018-09-05 22:12:36 -06:00
Andrew Gross d8277ed8de Update testing instructions 2018-09-05 16:15:10 -06:00
c0gent 56198e3e1f Add `--test-threads 1` for travis. 2018-09-04 08:38:49 -07:00
c0gent 8ac8bef66c Travis: Enable cpu-specific optimizations.
This is off by default so that binaries can be shared.
2018-09-04 08:38:49 -07:00
Marc Brinkmann 3b6dfcbfc1
Adversary traits (#223)
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.
2018-09-04 14:50:15 +02:00
Andreas Fackler 05b04bba39 Use Formatter debug helpers. 2018-09-03 23:30:17 +02:00
Vladimir Komendantskiy b649dc6268
Spam protection part 1: remote epoch tracking in HoneyBadger (#219)
* spam protection part 1: remote epoch tracking in HoneyBadger

* moved handling of EpochStarted out of EpochState

* allowed EpochStarted from observers

* removed an unnecessary function call

* updated formatting to beta

* removed an unnecessary variable
2018-09-03 11:29:03 +01:00
Marc Brinkmann fc3d578eea
Advance to Rust beta (#221)
Update Rust version to `beta` in CI, paving the way for 1.29 stable.
2018-08-31 15:57:10 +02:00
DrPeterVanNostrand fb606332f6 Pinned threshold_crypto to version 0.1.0. 2018-08-30 10:52:16 -07:00
Vladimir Komendantskiy aa067d29e4
Merge pull request #218 from poanetwork/afck-rename
Rename Agreement to BinaryAgreement.
2018-08-30 10:57:14 +01:00
Andreas Fackler 383d96fdee Rename Agreement to BinaryAgreement. 2018-08-30 11:19:52 +02:00
Andreas Fackler 7276621397 Rename uid to id. 2018-08-29 19:35:52 +02:00
Andreas Fackler f27eed4eef Rename input to handle_input.
Also update `.gitignore` to avoid checking in test logs.
2018-08-29 19:35:52 +02:00
Marc Brinkmann 85550fcf82
New test network implementation (#216)
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`.
2018-08-29 10:09:35 +02:00
Andreas Fackler 51315a56c3 Update docs: missing algorithms, private merkle, whitespace.
* 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.
2018-08-27 17:07:33 +02:00
Igor Barinov 20193ab009 Update README.md
Changed Travis-CI badge to org from com because we build it on travis-ci.org domain at the moment
2018-08-26 15:11:43 +02:00
Marc Brinkmann d459683288 Added commented-out `after_failure` commands to `.travis.yml` to debug `SIGILL` issues. 2018-08-26 14:47:19 +02:00
Andreas Fackler d93ea7b561 Rename CommonSubset to Subset. 2018-08-22 16:20:09 -07:00
Andreas Fackler 6bcf365cf8 Rename CommonCoin to Coin. 2018-08-22 16:20:09 -07:00
Andreas Fackler f7d4860a94 Fix DHB test: wait for lagging nodes.
The Dynamic Honey Badger tests would currently fail _without_ faulty
nodes, because with "first" delivery, all but the first _N - f_ nodes
are lagging indefinitely.

This change makes sure we give lagging nodes a chance to finish the first
phase of the test and arrive at the batch containing the completed
`Remove` event.
2018-08-14 12:08:34 +02:00
Andrew Gross f661e8ace3 Update links
link to threshold crypto
2018-08-12 12:26:33 -07:00
Andreas Fackler e4ddd6a079 Replace ring with tiny-keccak. 2018-08-10 09:23:27 +02:00
Andreas Fackler b90a7bf450 Replace merkle.rs with custom implementation. 2018-08-10 09:23:27 +02:00
Andreas Fackler b7fe494fad Fix build if secure env vars are unavailable. 2018-08-09 22:26:34 +02:00
c0gent ac39de66a8 Make refinements to SyncKeyGen error and fault handling. 2018-08-09 15:44:36 -04:00
DrPeterVanNostrand 8ab58d35d4 Added error handling for mlock errors in threshold_crypto crate. 2018-08-09 15:44:36 -04:00
Andreas Fackler 8cc60698db Move matches from EpochState to SubsetState. 2018-08-09 16:04:09 +02:00