Commit Graph

489 Commits

Author SHA1 Message Date
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 0de5d12525 move import to avoid warning 2018-10-23 23:25:23 -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 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
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 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
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
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
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
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 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
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
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
Andreas Fackler 058044959f Remove itertools dependency. 2018-09-20 11:38:02 +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
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
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 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
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
Andreas Fackler e9b960d020 Fix and clean up the HoneyBadger impl.
* Remove unnecessary recursive method calls.
* Add `handle_message` (without the trait).
* Fix a bug where `handle_message_content` would create an `EpochState`
  with the wrong number.
2018-08-09 16:04:09 +02:00
Andreas Fackler 5cc7b54c06 Split up the broadcast module.
Also, rename broadcast and agreement messages to just `Message`.
2018-08-08 15:46:43 +02:00
Andreas Fackler b017311e49 Split out individual epochs from Honey Badger. 2018-08-06 10:50:30 -07:00
Andreas Fackler 46a8728792 Split out Threshold Decryption from Honey Badger. 2018-08-06 10:50:30 -07:00
c0gent 697ba6f0a8
Add common supertraits and rename related type parameters.
* Add the `Contribution`, `NodeUidT`, and `Message` supertraits.
* Rename type parameters:
  * `Tx` -> `T` or `C`
  * `NodeUid` -> `N`
2018-08-02 14:52:12 -07:00
c0gent f66dbdf3a1
Reorganize `dynamic_honey_badger` and `agreement` modules slightly.
* Move `CoinState` and `Agreement` definitions from `agreement/mod.rs`
  to `.../agreement.rs`.
* Move `DynamicHoneyBadger` definition from `dynamic_honey_badger/mod.rs`
  to `.../dynamic_honey_badger.rs`.
2018-08-02 13:01:57 -07:00
Andreas Fackler dd31758bdf Extract SBV broadcast from agreement. 2018-08-02 12:55:17 +02:00
Andreas Fackler 572fa7b028
Merge pull request #180 from c0gent/c0gent-crypto-pub
Re-export `crypto`.
2018-08-01 19:18:48 +02:00
c0gent affa0eee37
Re-export `crypto`. 2018-08-01 09:56:36 -07:00
Andreas Fackler d19afc2634 Change the QHB criterion for moving on to the next epoch.
`QueueingHoneyBadger` now waits after an output, and only makes its
proposal for the next epoch when:

* there are pending transactions in the queue,
* there are pending key generation or vote messages, or
* _f + 1_ other validators have already made their proposal.

This rule should work well for small networks: With 1 - 3 nodes, it will
produce a new batch whenever at least one of them has transactions to
contribute. In larger networks, it prevents an adversary controlling _f_
nodes from producing lots of empty epochs.

An exception is made for a currently joining validator: We will commit
up to _(N + 1)² + 1_ key generation messages for them, which is the
maximum number a correct node will send.
2018-08-01 18:52:32 +02:00
Andreas Fackler 5591f5ebd0 Split honey_badger into submodules. 2018-08-01 09:56:18 +02:00
Andreas Fackler 7c66ef06ee
Merge pull request #172 from poanetwork/vk-crypto-crate
crypto module moved into its own crate
2018-07-31 22:26:19 +02:00
Vladimir Komendantskiy 062b7150e1
Merge pull request #173 from poanetwork/afck-hb-clear-cs
Fix removal of terminated CS instances in HB.
2018-07-31 15:15:54 +01:00
Vladimir Komendantskiy 6753c12b7c formatting 2018-07-31 12:15:05 +01:00
Vladimir Komendantskiy 77ed1d50d4 separated crypto module into its own crate 2018-07-31 12:15:05 +01:00
Andreas Fackler 47c00016be Remove protobuf support. 2018-07-31 11:58:44 +02:00
Andreas Fackler c448e057f8 Rename BinValues to BoolSet. 2018-07-31 09:42:30 +02:00
Andreas Fackler 4159acf8cd Represent BinValues as a u8. 2018-07-31 09:39:51 +02:00
c0gent 847a79793e
Replace `chain_error` with `failure`
Changes:

* Remove `error_chain` and convert errors to `failure` types.
* Add variants for each possible error generation point.
2018-07-30 15:14:19 -07:00
Andreas Fackler 8346085fb9 Fix removal of terminated CS instances in HB. 2018-07-30 15:02:20 +02:00
Andreas Fackler 78ab9742a9 Avoid heap allocation in BinValues::into_iter. 2018-07-30 13:08:17 +02:00
Andreas Fackler 8beab3d2b4 Log duplicate agreement messages as faults. 2018-07-30 12:04:28 +02:00
Andreas Fackler 3b65f0cead Fix agreement bugs, and refactor a few fields.
* Don't drop `Term` messages from previous epochs. They are still
  relevant for all future epochs.
* Restructure some fields to avoid unnecessary iteration and counting.
* Simplify the fields related to the common coin.
* Reorder the methods, so that the message handlers are all in one
  place.
* Handle the case where the coin value arrives before the required
  number of `Conf` messages.
2018-07-30 11:44:55 +02:00
Vladimir Komendantskiy 6efe6037f2 removed duplicated insertion 2018-07-27 08:24:19 +01:00
Vladimir Komendantskiy 638cde3d71 avoid cloning of Agreement::received_term 2018-07-26 17:55:21 +01:00
Andreas Fackler 08d6abf6b4 Make sure Term messages are handled as BVal, Aux, Conf. 2018-07-26 14:19:01 +02:00
Vladimir Komendantskiy 35edde9007
Merge pull request #167 from poanetwork/afck-queue-fields
Fix bin_values change handling in agreement.
2018-07-26 09:30:03 +01:00
Andreas Fackler cc28f8ecfe
Merge pull request #162 from poanetwork/vk-broadcast-example
Updated the Broadcast doc example to the latest API
2018-07-26 10:17:56 +02:00
Andreas Fackler 4bff2849f9 Fix bin_values change handling in agreement.
* Call `on_bin_values_changed` even if there is only one value.
* Handle the case _f = 0_ correctly: `count_bval` can be equal to both
  _f + 1_ and _2 f + 1_.
2018-07-26 09:34:34 +02:00
Andreas Fackler 27898168e2
Merge pull request #163 from poanetwork/afck-queue-fields
Remove queue fields from Agreement, CommonCoin, Broadcast and CommonSubset.
2018-07-26 08:43:07 +02:00
Andreas Fackler 8d449eceb5
Merge pull request #159 from poanetwork/afck-into-fr
Accept more types in threshold crypto API.
2018-07-26 08:31:54 +02:00
Vladimir Komendantskiy fc074d50e5 removed expect and unnecessary message cloning, added comments 2018-07-25 16:53:15 +01:00
Andreas Fackler 72ff36f2b9 Fix data shard count in Broadcast. 2018-07-25 10:46:39 +02:00
Andreas Fackler 2b904e3490 Make sure QHB always inputs a new batch after output. 2018-07-24 14:46:48 +02:00
Andreas Fackler 9d0f1b3d15 Remove output and message queue from CommonSubset. 2018-07-24 13:12:06 +02:00
Andreas Fackler 990899327e Remove output and message queue from Broadcast. 2018-07-24 12:18:09 +02:00
Vladimir Komendantskiy 883201a9b9 checking the output immediately rather than at the end 2018-07-24 11:09:15 +01:00
Andreas Fackler 30c5805446 Remove output and message queue from CommonCoin. 2018-07-24 11:57:50 +02:00
Andreas Fackler 102fa0e01d Remove output and message queue from Agreement. 2018-07-24 11:43:35 +02:00
Vladimir Komendantskiy aefb812f2a updated the Broadcast doc example to the latest API 2018-07-24 09:51:13 +01:00
Andreas Fackler b89ad6bb5d Rename: try_output_batches. Add CS multi output error. 2018-07-23 21:36:09 +02:00
Andreas Fackler 4327744976 Remove output and message queue from HoneyBadger. 2018-07-23 18:11:45 +02:00
Andreas Fackler 32e1afc24a Add more arithmetic ops to Poly. 2018-07-23 15:56:45 +02:00
Andreas Fackler 984bb49fdc Accept more types in threshold crypto API.
This removes some unnecessary allocation and conversion by accepting
more primitive types and references as the index in threshold decryption
and signing, and as the argument to a polynomial.
2018-07-23 15:56:45 +02:00
Andreas Fackler 9d43e8df59
Merge pull request #150 from poanetwork/vk-api-messages66
Outgoing message API refactoring
2018-07-23 15:43:25 +02:00
Andreas Fackler 432c865d4b Handle initial QHB messages, fix DHB. 2018-07-21 11:30:43 +02:00
Andreas Fackler e14eb5006a Clarify synchrony requirements in SyncKeyGen. 2018-07-20 18:43:28 +02:00
Vladimir Komendantskiy a9346fa2a1 removed an accidental unused import from a merge conflict 2018-07-20 12:58:07 +01:00
Vladimir Komendantskiy bc245f2e67 added a Step for each module 2018-07-20 12:51:06 +01:00
Vladimir Komendantskiy 099fbc999e made Step depend on DistAlgorithm instead of base types 2018-07-20 12:47:19 +01:00
Vladimir Komendantskiy 17339c322c added a typedef for the Queueing HB propose result 2018-07-20 12:44:41 +01:00
Vladimir Komendantskiy ccd1a98c42 optimized function arguments and added a typedef for Simulation Step 2018-07-20 12:44:41 +01:00
Vladimir Komendantskiy 65b3097238 message queue refactoring WIP 2018-07-20 12:43:15 +01:00
Andreas Fackler d787173dd8 Rename DKG messages to Part and Ack. 2018-07-19 12:28:15 +02:00
Andreas Fackler 9159b42150 Add SyncKeyGen::into_network_info. 2018-07-19 12:18:01 +02:00
Andreas Fackler c179ad1e18 Extend sync_key_gen documentation. 2018-07-19 11:32:32 +02:00
Andreas Fackler 7820d5572a
Merge pull request #146 from poanetwork/afck-key-shares
Separate keys and key shares.
2018-07-19 10:24:10 +02:00
Andreas Fackler fb0e35deea Improve DHB docs, address review comments. 2018-07-18 21:41:21 +02:00
Andreas Fackler 52a684eb7f Add example code for `SyncKeyGen` to the docs. 2018-07-18 17:59:28 +02:00
Andreas Fackler 466104bce6 Extend *honey_badger module docs. 2018-07-18 16:46:46 +02:00
Andreas Fackler 15cc6ffddd Separate keys and key shares. 2018-07-18 14:44:35 +02:00
Andreas Fackler 2d9b872484
Merge pull request #130 from poanetwork/vk-api-refactor66
Output API refactored
2018-07-18 14:10:39 +02:00
c0gent 8c1a111f13
Add `Copy` to `PublicKey` derived impls. 2018-07-17 15:38:50 -07:00
Vladimir Komendantskiy 4b88759844 review comments 2018-07-17 18:27:28 +01:00
Vladimir Komendantskiy f704b481ad Merge branch 'master' into vk-api-refactor66 2018-07-16 15:38:25 +01:00
Vladimir Komendantskiy c779d33dd1 Merge branch 'master' into vk-api-refactor66 2018-07-16 15:16:19 +01:00
Andreas Fackler 1f8373ef93 Add a `JoinPlan` to facilitate joining a running DHB network.
With that, a node can join a running network as an observer in any epoch
where key generation starts.
2018-07-16 16:03:36 +02:00
Peter van Nostrand a86f6666b5 Clear 'Poly' and 'BivarPoly' coeffs on drop. 2018-07-16 09:38:27 -04:00
Vladimir Komendantskiy 9979e790aa added must_use to tests and removed Clone from FaultLog 2018-07-16 14:31:21 +01:00
Vladimir Komendantskiy 22195c4b93 Merge branch 'master' into vk-api-refactor66 2018-07-16 14:20:50 +01:00
Vladimir Komendantskiy c6a0090859 removed cloning of FaultLog 2018-07-16 12:33:00 +01:00
Andreas Fackler 55ad2eae44 Fix DHB test with 1 validator; purge key gen msgs.
This adds a bit of special handling to make sure messages don't stay in
the queue forever in the `dynamic_honey_badger` tests, even if there is
only one validator: the problem was that the single validator is always
ready for input, so it never processed incoming messages. However, to
add the new validator, it needs to process the joining node's key
generation messages.

`DynamicHoneyBadger` now also removes committed key generation messages
from the queue, to avoid committing duplicates.
2018-07-15 12:12:27 +02:00
Andreas Fackler 01ad256363
Merge pull request #127 from poanetwork/afck-dhb-votes
Minor fixes and simplifications.
2018-07-15 11:24:00 +02:00
Andreas Fackler 70e8fedb15
Merge pull request #126 from poanetwork/remove-clear-on-drop
Replaced clear-on-drop with 'std::ptr::write_volatile'.
2018-07-15 10:44:59 +02:00
Vladimir Komendantskiy 72f7b1c06d
Merge branch 'master' into afck-dhb-votes 2018-07-14 08:20:02 +01:00
Peter van Nostrand 53a891380f Replaced clear-on-drop with 'std::ptr::write_volatile'. 2018-07-13 20:58:30 -04:00
Vladimir Komendantskiy 993a164ca9 ignored the failing doc test 2018-07-13 23:27:31 +01:00
Vladimir Komendantskiy db9191768b review comments 2018-07-13 22:53:44 +01:00
Vladimir Komendantskiy 03153cf788 Merge branch 'master' into vk-api-refactor66 2018-07-13 22:18:01 +01:00
c0gent 28da78c709
Add QueueingHoneyBadger::dyn_hb.
Needed to retrieve netinfo.
2018-07-13 08:31:03 -07:00
Vladimir Komendantskiy d7a2808774
Merge branch 'master' into vk-api-refactor66 2018-07-13 13:53:21 +01:00
Marc Brinkmann 5336fbe707 Added `RandomAdversary` and the necessary auxiliary functions.
Random adversaries are created for `broadcast` and `honey_badger`.  Random value generation was added for all type-dependencies of these algorithms, causing the `Rand` trait to be implement for a large portion of the codebase.

Additionally, `MessageWithSender` turned into an actual struct, making it much easier to handle. Tuple-like construction is still available through `MessageWithSender::new()`.
2018-07-13 13:27:49 +02:00
Marc Brinkmann a0da8b7385 Added extended example for broadcast api and other docstrings. 2018-07-13 13:27:49 +02:00
Marc Brinkmann 0e6a8aa272 Fix clippy lints.
Extra lints have been added in the latest version of clippy; this fixes four instances of two of the new lints.
2018-07-13 10:52:44 +02:00
Vladimir Komendantskiy 92f0602dd7 formatting omission fix 2018-07-12 22:25:44 +01:00
Vladimir Komendantskiy 7fb1017bb1 changed Step::output to Vec but that didn't fix the dynamic HB test 2018-07-12 21:23:52 +01:00
Andreas Fackler 3f3ac7be13 Minor fixes and simplifications.
* Clear outdated key gen messages from the buffer.
* Process output after proposing, to make `HoneyBadger` work with a
  single validator.
* Print an error if threshold decryption fails.
* Verify decryption shares with the correct ciphertext.
* Insert all ciphertexts from an epoch at once; otherwise contributions
  can be omitted from a batch.
* Remove `BoolWithFaultLog`: It's easier to return a tuple, and it's
  used only in one place now.
* Avoid redundant signature verification in `VoteCounter`.
* Fix the tests for `QueueingHoneyBadger`.
* Use fewer network sizes to speed up tests a bit.
2018-07-12 17:54:27 +02:00
Vladimir Komendantskiy 1254d40147 fixed a starvation issue in Agreement when num_faulty=0 2018-07-12 15:12:06 +01:00
Vladimir Komendantskiy 0ba06fdb76 added step output in DistAlgorithm 2018-07-12 14:54:05 +01:00
Andreas Fackler bfab919c76 Add FaultLog::is_empty. 2018-07-12 09:54:26 +02:00
Andreas Fackler bed019b166 Report faults from VoteCounter. 2018-07-12 09:54:26 +02:00
Andreas Fackler 313fe1da75 Extract vote counter from DHB. 2018-07-12 09:54:26 +02:00
c0gent f0ed2e6e12 Make `*HoneyBadger` types thread safe.
Replaces `Rc` with `Arc`. This allows usage from different threads
which will be necessary for use with Parity.
2018-07-11 16:28:41 -07:00
Andreas Fackler b41ada1809 Split the dynamic_honey_badger module. 2018-07-11 11:36:40 +02:00
Andreas Fackler ca2dd2327e Add back InvalidNodeTransactionSignature fault.
This was accidentally removed due to a merge conflict.
2018-07-10 17:29:58 +02:00
Andreas Fackler c1b4381753 Separate queue from Honey Badger.
This makes Honey Badger a bit more complicated but a lot more flexible:
It is now unaware of transactions and basically just runs one Subset
instance per epoch.

That way, users can use any kind of external queue, control throttling
and prioritization.
2018-07-10 17:29:58 +02:00
Peter van Nostrand 6783ece9b0 Added faulty node logging to algorithms. 2018-07-09 13:45:11 -04:00