Commit Graph

714 Commits

Author SHA1 Message Date
Andreas Fackler d52be00d0e Fix CI.
Fix a few new Clippy lints, and some broken dependencies.
2020-03-20 10:37:31 +01:00
Andreas Fackler 3b1f587521 Fix QHB loop with 1 validator. 2020-03-20 10:37:31 +01:00
Andreas Fackler 4857b7f9c7 Sort IDs before assigning them indices in NetworkInfo. 2019-12-20 10:38:29 +01:00
Weiliang Li e43baa4b8b fix some clippy warnings 2019-11-12 11:12:47 +01:00
Weiliang Li d6ffccc06e update tiny-keccak 2019-11-12 11:12:47 +01:00
Weiliang Li 41a955906b rev instead of branch in Cargo.toml 2019-11-12 11:12:47 +01:00
Weiliang Li 4c07a5b9f7 update Cargo.toml in testing 2019-11-12 11:12:47 +01:00
Weiliang Li 0132ee5dd3 Update Cargo.toml 2019-11-12 11:12:47 +01:00
Weiliang Li 7c213fed71 update Cargo.toml 2019-11-12 11:12:47 +01:00
davidf 2f12266526 Added accessor to "our_id" for SyncKeyGen 2019-10-15 10:17:16 +02:00
Andreas Fackler 9d6b851466 Accept FnOnce/FnMut where possible. 2019-09-26 12:52:26 +02:00
Andreas Fackler 4e525432c8 Test that self is always omitted from Target. 2019-09-17 09:55:59 +02:00
Andreas Fackler 681cf480b0 Clean up threshold sign tests.
Add a test that actually verifies the signature, and refactors the tests
a bit.
2019-09-05 14:04:03 +02:00
Andreas Fackler fe17fc9850 Remove generic ciphertext argument from Part and Ack messages. 2019-09-03 14:17:55 +02:00
Andreas Fackler 824a43100b Make non-threshold crypto in SyncKeyGen pluggable. 2019-09-03 14:17:55 +02:00
Andreas Fackler ab3da7cf64 Validate JoinPlan. 2019-08-27 20:51:24 +02:00
Andreas Fackler 0e50c2f473 Remove non-threshold keys from NetworkInfo. 2019-08-27 20:51:24 +02:00
Andreas Fackler 66033a9f7f Fix cargo install commands. 2019-08-27 20:51:24 +02:00
Andreas Fackler c146634686 Assert matching keys in NetworkInfo. 2019-08-27 20:51:24 +02:00
Andreas Fackler d15467eb09 Remove NetworkInfo from Broadcast. 2019-08-27 20:51:24 +02:00
Andreas Fackler 8ee999b73f Remove unused Step::new. 2019-08-07 12:24:24 +02:00
Weiliang Li 98aad993e0 Update sync_key_gen.rs
Indent code in comments
2019-08-06 09:17:55 +02:00
Andreas Fackler b0e3ad5d4c Pass AllExcept messages unconditionally. 2019-07-29 12:08:54 +02:00
Andreas Fackler 74e2e93a5d Remove audit exception; fix crossbeam issue. 2019-07-29 12:08:54 +02:00
Andreas Fackler 4b2cff8db7 Increase the Travis timeout. 2019-07-29 12:08:54 +02:00
Andreas Fackler 0e51bb3615 Change the `Target` variants.
`Target` now only has a `Nodes` and an `AllExcept` variant, to specify
a message's target via a whitelist or blacklist. This avoids cloning
the message content and simplifies the code in several places.
2019-07-29 12:08:54 +02:00
Weiliang Li 7078387115 Fix unused error in test and fix markdown format error 2019-07-24 15:39:58 +02:00
Andreas Fackler 51e4809260 Upgrade Travis to Rust 1.36.0, too. 2019-07-23 13:30:02 +02:00
Andreas Fackler ccd96adc35 Re-enable cargo audit; use --ignore instead. 2019-07-23 13:30:02 +02:00
Andreas Fackler bb17bd7a9c Add NetworkInfo::other_ids. 2019-07-23 13:30:02 +02:00
Andreas Fackler 71e1953b25 Temporarily disable cargo audit. 2019-07-23 13:30:02 +02:00
Andreas Fackler 8122a10179 Add HoneyBadger::skip_to_epoch. 2019-07-23 13:30:02 +02:00
Andrew Gross 059e4471cb
Merge pull request #411 from Genysys/master
Added medium post on threshold cryptography to README.md
2019-07-01 11:51:34 -06:00
falcon-updater fe33201b75 Added medium post on threshold cryptography to README.md 2019-06-30 19:24:27 +01:00
Andreas Fackler 003d37ebd6 Update to Rust 1.35.0. 2019-06-18 16:31:17 +02:00
Pawan Dhananjay 61f4ed9800 Optimized broadcast #309 (#405)
* Added extra message types

* Add send functions for new message types

* Store original value message received from proposer

* Modify handle_value for optimized broadcast

* Modify handle_echo for optimized broadcast

* Add handle_echo_hash function for optimized broadcast

* Add handle_can_decode function for optimized broadcast

* Fixes handle_ready and send_echo functions:
1) Modify handle_ready function for optimized broadcast
2) Modify send_echo function to send `Echo` messages to different subset of nodes from
handle_value and handle_ready functions

* Remove value_message and fix typos

* Add functions for filtering all_ids

* Separate send_echo to send_echo_left and send_echo_remaining

* Rename pessimism_factor to fault_estimate

* Remove redundant bools from Broadcast struct

* Fix multiple counting of nodes who sent both `Echo` and `EchoHash` by changing
`echos` map structure

* Allow conflicting `CanDecode`s from same node

* Fix left and right iterators for `Echo` and `EchoHash` messages

* Fixes bugs in left and right iterators and adds additional checks in handle
functions

* Change can_decodes to BTreeMap<Digest, BTreeSet<N>> and fix send_can_decode

* Minor fixes

* Modify send_echo_remaining to take a hash parameter

* Fix bug in left and right iterators.

* Excluding proposer in iterator led to infinite loop when our_id == proposer_id

* Fix bug in handle_echo and compute_output
* send_can_decode call in handle_echo returned early
* compute_output needed `N - f` full `Echo`s to decode

* Refactor `echos` map to take an EchoContent Enum for `Echo` and `EchoHash` messages

* Run rustfmt

* Refactor to avoid index access and multiple map lookups

* Fix comments and minor refactorings.

* Add an`AllExcept(BTreeSet<N>)` type to `Target` enum to enable sending messages
to non-validators from Broadcast.
* Use `Target::AllExcept` in Broadcast to send `Echo` messages to all non-validator nodes.
* Add `AllExcept(_)` match arms for `Target` match expressions.

* Rename `AllExcept` parameter from `known` to `exclude`.

* Modify send_can_decode to send to all nodes who haven't sent an `Echo`.

* Update docs for broadcast

* Improve formatting and add comments for broadcast docs.

* Fix formatting.

* Allow for sending multiple `CanDecode` messages with different hashes.

* Fix comments.

* Fix bug in sending `Echo`s when node has not received `CanDecode`.
2019-06-12 16:02:39 +01: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 a64f62506d
Merge pull request #394 from poanetwork/afck-qhb-duplicate-aux
Fix BA message handling on epoch change.
2019-04-02 13:57:17 +01:00
Andreas Fackler d83ef9cf67
Fix BA message handling on epoch change.
Binary agreement erroneously kept handling queued incoming messages for
an epoch `n`, even if during the handling, the epoch was incremented to
`n + 1`. This caused `DuplicateAux` faults in the tests, but it could
potentially break consensus.
2019-04-02 14:01:27 +02:00
Vladimir Komendantskiy 89ba1f6799 using threshold_crypto 0.3.1 2019-04-02 12:42:51 +02:00
Vladimir Komendantskiy 10dbf705e4 using serde derive feature 2019-04-02 12:42:51 +02:00
Andreas Fackler 2e046906f9 Don't drop re-added peers from sender queue. (#391)
If a previously removed peer gets added back as a validator,
`SenderQueue` now removes that peer from `last_epochs`, so it doesn't
drop it later.
2019-04-01 10:05:46 +01:00
David Forstenlechner 61171bb475 Eliminated the old network simulator (#389)
queuing_honey_badger ported to the new net simulator
2019-03-19 16:55:56 +00:00
David Forstenlechner c1e634ecf2 Ported more integration tests to the new net simulator (#387)
* Ported threshold_sign test to the new framework

* Ported the first three broadcast tests to the new framework

* Extracted messages storting and random swapping to reusable functions

Used to compose ProposeAdversary's behavior without having to duplicate code

* Implemented ProposeAdversary for the new integration testing framework

Added "id()" function to the "NodeMutHandle", required for sending messages to all nodes

ProposeAdversary needs access to all faulty node's netinfo. We follow the example of the binary_agreement_mitm integration test of using an reference counted Mutex to make netinfo available on both Consensus Protocol construction and in the Adversary implementation.
Unlike binary_agreement_mitm every faulty node needs to use its own netinfo for the broadcast algorithm, so we store all nodeinfo structures in a Map instead of just the nodeinfo of the first node.
Ideallly the new network simulation library should provide netinfo similar to the old library to avoid these hideous workarounds.

* Migrated test_broadcast_random_delivery_adv_propose to the new network simulator

Refactored the implementation of ProposeAdversary to closely resemble the behavior in the old network simulator library.
Implemented a pick_random_node function to sort messages for a random node id. Switched from using "inject_message" to joining messages generated by adversaries' temporary Broadcast Consensus Protocols with the Step generated by regular operation.

* Ported RandomAdversary to the new network simulator library

Ported all broadcast integration tests and replaced the old tests with the new.

* Eliminated the old broadcast integration test, replaced with the new

* Ported subset test to the new framework

Adjusted message queue size as suggested by Andreas

* Ported the first three honey_badger tests to the new framework

* Re-implemented FaultyShareAdversary for the new framework

Eliminated the old honey_badger integration tests, replaced with implementations using the new net simulator framework

* Fixed issues reported by clippy

* Fixed issues reported on code review

* Fixed issues reported by clippy

* Implemented a broadcast test dropping messages similar to the tests written in the old framework

* Picking the proposer id at random, verifying all possible output cases

If the proposer is faulty the message queue may starve, but the outputs of all correct nodes need to be empty, if the broadcast protocol produces output nonetheless all correct nodes need to have the same output.
If the proposer was correct all correct nodes need to output its proposed value.

* Eliminated duplicated semicolon

* Consistently using TestRng and proptest in all newly ported tests

* Increased the drop_and_re_add test message limit to 20k per node

* Removed unnecessary closure

* Increased the tolerance for deviations from the expected value range to eliminate random test failures
2019-03-14 13:41:23 +00:00
Andreas Fackler 57455d47ae Fix a SyncKeyGen and a DHB test issue.
`SyncKeyGen` should tolerate duplicate `Part` messages as long as they
are identical.

The `drop_and_re_add` test had an arithmetic overflow, because it tried
to remove more faulty nodes than nodes in total.
2019-03-14 14:09:27 +01:00
Constantine Solovev 3336fa772d Remove a random subset of validators in net_dynamic_hb (#385)
* Choose pivot node at random

* Choose random number of nodes for removing in net_dynamic_hb test

* Docs and code small fixes

* clippy fix

* Cargo fmt for stable toolchain and add rust-toolchain file as well

* Remove rust-toolchain file

* Fix grammar and improve selecting nodes for removing

* Simplify selecting nodes for remove

* Fix tests

* Remove net_dynamic_hb.proptest-regressions file
2019-02-27 16:39:57 +00:00
C.Solovev 0e7edb2be7 Add `honey_badger` getter for `DynamicHoneyBadger` 2019-02-25 18:43:15 +01:00
Vladimir Komendantskiy 5b86543bbf
Merge pull request #382 from RicoGit/small-fixes
Add to .gitignore .idea/ folder and fix test's readme
2019-02-25 11:42:48 +00:00
C.Solovev cc0812193c Add to .gitignore .idea/ folder and fix test's readme 2019-02-25 15:05:08 +04:00
Vladimir Komendantskiy d4a7b19adb
Merge pull request #379 from poanetwork/afck-badge
Add docs.rs and crates.io badges.
2019-01-10 14:21:09 +00:00