Commit Graph

46 Commits

Author SHA1 Message Date
Weiliang Li e43baa4b8b fix some clippy warnings 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 bb17bd7a9c Add NetworkInfo::other_ids. 2019-07-23 13:30:02 +02:00
Andreas Fackler 003d37ebd6 Update to Rust 1.35.0. 2019-06-18 16:31:17 +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
Vladimir Komendantskiy 14960a148e
Remove peers from sender queue (#352)
* impl. old validator removal from sender queue peer list

* provided current validators for sender queue peer removal

* renamed validators as nodes in the sender queue

* Revert "renamed validators as nodes in the sender queue"

This reverts commit 78e1e1569d5f624c469bf752a5bf874b434a61d2.

* cleaned up the SQ builder and moved removal of old validators to triggers

* computing participant transitions from batches in the sender queue

* added a missing comment

* removing old validators as soon as all messages are delivered up to the last epoch

* review comments

* rejoined Node 0 in the old DHB test

* DHB test uses the first step of the DHB algorithm on the restarted node

* changed test batch verification to account for node 0 removal

* updated net_dynamic_hb test to cope with the removal of node 0

* relaxed verification of batches to only check inclusion of node 0 transactions

* corrected test state transitions in DHB and QHB tests

* added a builder function for a joining QHB

* rejoin the pivot node instead of node 0

* changed VirtualNet::verify_batches to take a full node as an argument

* corrected a variable name

* correction: use the pivot node ID instead of indices

* corrected the pivot node ID

* simplified a find

* simplified a conditional statement

* corrected the inference of expected output in verify_batches

* WIP on DHB and QHB tests; VirtualNet::verify_batches made more general

* readded node 0 in the DHB test when InProgress change is output

* allowed node 0 to miss a few batches while it is removed in the QHB test

* edition and rebase fixes

* refactored the use of process_step

* added VirtualNet functionality of node insertion and removal

* restarting the pivot node after all validators add it as peer

* clippy lints in net_dynamic_hb

* added observer in the QHB test; removed the DHB TestNetwork test

* fixed rng usage in the QHB test

* check output length when verifying batches; comment correction
2018-12-17 13:27:46 +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 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
Vladimir Komendantskiy ee46dd4b81 sender queue implementation 2018-11-05 11:11:00 +00: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
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 85910d8d43 refactor change and make it possible for encryption to be optional 2018-10-23 23:21:59 -05: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 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
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 7276621397 Rename uid to id. 2018-08-29 19:35:52 +02: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
Nick Sanders c5977d1ab8
Revert "Reorganize `dynamic_honey_badger` and `agreement` modules slightly." 2018-08-02 12:24:25 -07:00
c0gent 7824b7a0ea
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 11:24:15 -07:00
Andreas Fackler eeb519862f Simplify Honey Badger tests and example. 2018-08-01 18:52:32 +02:00
Vladimir Komendantskiy 77ed1d50d4 separated crypto module into its own crate 2018-07-31 12:15:05 +01:00
Andreas Fackler 432c865d4b Handle initial QHB messages, fix DHB. 2018-07-21 11:30:43 +02:00
Andreas Fackler 15cc6ffddd Separate keys and key shares. 2018-07-18 14:44:35 +02:00
Vladimir Komendantskiy f704b481ad Merge branch 'master' into vk-api-refactor66 2018-07-16 15:38:25 +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
Vladimir Komendantskiy 9979e790aa added must_use to tests and removed Clone from FaultLog 2018-07-16 14:31:21 +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
Vladimir Komendantskiy 72f7b1c06d
Merge branch 'master' into afck-dhb-votes 2018-07-14 08:20:02 +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
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
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 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
Andreas Fackler 34385746c6 Add start_epoch option and DHB builder. 2018-07-02 14:14:19 +02:00
Andreas Fackler 11149c5e66 Communicate change state in Dynamic HB, add module docs. 2018-07-02 14:14:19 +02:00
Andreas Fackler 7a0b397233 Add node transaction messages to Dynamic HB. 2018-07-02 14:14:19 +02:00
Andreas Fackler 7a335c9771 Remove vote_counts field from dynamic HB. 2018-06-27 11:51:56 +02:00
Andreas Fackler 74fab61dd8 Fix Dynamic HB test. 2018-06-27 11:37:05 +02:00
Andreas Fackler fd8e7a5900 Add DynamicHoneyBadger. 2018-06-26 15:13:04 +02:00