Commit Graph

489 Commits

Author SHA1 Message Date
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
Andreas Fackler 6248e4079f Fix Subset for a single validator. 2018-07-09 11:38:56 +02:00
Vladimir Komendantskiy 90e468ecf6
Merge pull request #101 from poanetwork/afck-docs
Add module-level Agreement, Coin and Subset documentation.
2018-07-05 17:39:09 +01:00
Andreas Fackler c42f606644 Fix module docs. (Review comments.) 2018-07-05 17:51:55 +02:00
Andreas Fackler 3f53964ac4 Add max_future_epochs parameter to DynamicHoneyBadger. 2018-07-05 11:47:19 +02:00
Andreas Fackler 93ca149757 Apply rustfmt and expand HB doc comment. 2018-07-05 11:47:19 +02:00
c0gent 2408e012fe Add type to `HoneyBadgerBuilder`. 2018-07-05 11:47:19 +02:00
Andreas Fackler 1a3016d94d Add Honey Badger builder. 2018-07-05 11:47:19 +02:00
Andreas Fackler 0f92010fe4 Add a max_future_epochs option to Honey Badger.
This delays handling of messages from epochs that are too far ahead.
2018-07-05 11:47:19 +02:00
Andreas Fackler f05e087492 Improve mod docs (review comments). 2018-07-05 11:45:30 +02:00
Andreas Fackler 2a30860bb0 Add agreement module-level docs. 2018-07-05 11:45:30 +02:00
Andreas Fackler f22999a37f Move the Subset docs to the module level. 2018-07-05 11:45:30 +02:00
Andreas Fackler daab0eb564 Add coin docs, change parity computation.
This makes the signature parity computation take into account all bits,
not just the last one of each byte.
2018-07-05 11:45:30 +02:00
Marc Brinkmann 5e8b26cfc3 Implemented `Rand` for `SecretKey`. 2018-07-04 16:43:17 +02:00
Andreas Fackler a4b691fd33 Improve dynamic HB doc comments. 2018-07-02 14:25:08 +02:00
Andreas Fackler 34385746c6 Add start_epoch option and DHB builder. 2018-07-02 14:14:19 +02:00
Andreas Fackler 515bd14a23 Restart Honey Badger when DKG starts for joining validator.
That way the user can be sure that if they forward all `Target::All`
messages after the first batch mentioning a joining validator, they
don't miss any messages relevant for that joining node.
2018-07-02 14:14:19 +02:00
Andreas Fackler bbc27e8a66 Update terminology: "observers" and "validators" 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
Marc Brinkmann a6c920e88e Remove unused feature, allowing compilation on stable again.
There is no evidence that [optin_builtin_traits](https://doc.rust-lang.org/beta/unstable-book/language-features/optin-builtin-traits.html) are used any longer (the keyword `auto` does not even show up in the codebase).

Removing this features allow compilation on stable Rust 1.27 and possible earlier versions.
2018-07-01 18:09:21 +02:00
Andreas Fackler 33eadc94ef Apply code review comments; improve broadcast docs. 2018-06-28 21:46:51 +02:00
Andreas Fackler 824a23775d Move broadcast docs to module-level.
Also replaces the word "good" with "correct".
2018-06-28 12:49:11 +02:00
Andreas Fackler 2b4f77f11c Avoid redundant key computations. 2018-06-27 14:47:05 +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 a2c213d0aa Replace convert_transaction with From. 2018-06-26 15:13:04 +02:00
Andreas Fackler fd8e7a5900 Add DynamicHoneyBadger. 2018-06-26 15:13:04 +02:00
Andreas Fackler f202ccfeb8 Compute is_peer on NetworkInfo creation. 2018-06-26 14:52:53 +02:00
Andreas Fackler aaec3d4074 Simplify observer/peer-specific code.
Extract some methods to make the branches more readable.
2018-06-26 14:50:06 +02:00
Andreas Fackler 2db67df325 Rename is_full_node to is_peer. 2018-06-26 10:57:44 +02:00
Andreas Fackler 2a5f9f1bfe Allow observer nodes in all algorithms.
This allows nodes to join the network without sending any messages
themselves. They can't give any input and just observe the outcome.

Closes #81
2018-06-26 09:17:12 +02:00
Andreas Fackler b3b3994ec1
Merge pull request #82 from poanetwork/vk-test-decryption-shares
An adversary sending faulty decryption shares
2018-06-26 09:06:33 +02:00
Vladimir Komendantskiy 11ec39879b created an adversary to test against faulty decryption shares 2018-06-25 19:22:08 +01:00
Andreas Fackler 062b35ab3a Make SyncKeyGen NodeUid-aware.
This allows the caller to address nodes by ID instead of by index.

Also contains a few other minor changes that will be needed for
`DynamicHoneyBadger`.
2018-06-25 13:07:31 +02:00
Vladimir Komendantskiy 7be2510e36 swapped False and True coins 2018-06-22 17:39:55 +01:00
Vladimir Komendantskiy 7a4fc37628 implemented an optimistic random common coin schedule 2018-06-22 10:39:55 +01:00
Vladimir Komendantskiy 4c2e92e63d removed the obsolete Bls12 type parameters 2018-06-22 10:17:11 +01:00
Vladimir Komendantskiy 5778cedb1c removed the unneeded pending_verification 2018-06-22 10:12:38 +01:00
Vladimir Komendantskiy f2893c5f54 Revert "removed the unneeded pending_verification and added clone-less shares in messages"
This reverts commit 10c442af475ca764badede674715142a1fd06fdb.
2018-06-22 10:12:38 +01:00
Vladimir Komendantskiy b7a0d64924 removed the unneeded pending_verification and added clone-less shares in messages 2018-06-22 10:12:38 +01:00
Vladimir Komendantskiy 69b42d5032 added verification of decryption shares as soon as they can be verified 2018-06-22 10:12:38 +01:00
Vladimir Komendantskiy 5b0d331a69 review comments 2018-06-22 10:12:38 +01:00
Vladimir Komendantskiy 5811ead460 derived instance fixes after serde option removal 2018-06-22 10:12:38 +01:00
Vladimir Komendantskiy af03158e00 tries to decrypt and output a batch on epoch update from already received messages 2018-06-22 10:12:38 +01:00
Vladimir Komendantskiy c7f4994e3a threshold encryption of proposals in HoneyBadger 2018-06-22 10:12:38 +01:00
Andreas Fackler 67dbada49f Improve documentation. 2018-06-22 10:17:44 +02:00
Andreas Fackler e11f183db2 Remove generic E: Engine from crypto. 2018-06-22 10:08:23 +02:00
Andreas Fackler 7eb487f329 Implement SyncKeyGen.
This is a _synchronous_ key generation algorithm. We will use it in
`DynamicHoneyBadger`, on top of `HoneyBadger` to satisfy the synchrony
requirements.

It can also be used independently e.g. on top of a blockchain.
2018-06-22 10:06:29 +02:00
Peter van Nostrand 73368b7a32 Fix formatting. 2018-06-21 13:06:48 -04:00
Peter van Nostrand 05da712c20 Added clear-on-drop secret-keys to 'NetworkInfo'. 2018-06-21 12:08:48 -04:00
Andreas Fackler a47123c4dd Improve Hash impl for Ciphertext.
This formulation makes it harder to forget updating the `Hash`
implementation if the `Ciphertext` type changes.
2018-06-20 22:09:43 +02:00
Andreas Fackler 1f27fa6891 Implement Hash for "public" cryptographic types.
This adds a `Hash` implementation for public keys, commitments,
ciphertexts and signatures — types that might make sense to be included
in special transactions. The `DynamicHoneyBadger` implementation will
require some of them.
2018-06-20 22:09:43 +02:00
Andreas Fackler 6484242afc Simplify serde implementations, add Ciphertext. 2018-06-20 10:43:59 +02:00
Andreas Fackler 83f8d61402 Support serde by default.
This removes the `serialization-serde` feature, since serde is already
used internally and therefore a dependency anyway.
2018-06-20 10:21:52 +02:00
Andreas Fackler c84c60d826 Rename crypto::keygen to crypto::poly. 2018-06-20 10:05:03 +02:00
Vladimir Komendantskiy 1436d85455
Merge pull request #63 from poanetwork/afck-hb-whose-batch
Return proposer info from HoneyBadger.
2018-06-19 09:53:52 +01:00
Andreas Fackler 66f396e01c Remove more NodeUid trait bounds.
Use a `BTreeMap` instead of `HashMap` in `NetworkInfo`. The number of
nodes can't grow very large anyway.
2018-06-18 16:37:07 +02:00
Andreas Fackler 3f707a8e12 Return proposer info from HoneyBadger.
Also, consistently name generic arguments, and remove some unused trait
bounds.
2018-06-18 16:19:54 +02:00
Andreas Fackler 3bf86453c3 Restructure crate-level docs, replace honest with correct. 2018-06-15 17:52:17 +02:00
Andreas Fackler e392f4c3af Add some crate-level documentation. 2018-06-14 17:44:43 +02:00
Vladimir Komendantskiy 3ed63a1507 formatting 2018-06-14 14:10:05 +01:00
Vladimir Komendantskiy 82b4250f0d added the broadcast proposer ID in the common coin nonce 2018-06-14 13:36:48 +01:00
Vladimir Komendantskiy 994600bcf6 renamed a fn argument for readability 2018-06-14 12:43:18 +01:00
Vladimir Komendantskiy 3393052b4b review comment coverage 2018-06-14 12:28:38 +01:00
Vladimir Komendantskiy 5008d11ada Revert "the set of node indices of common coin shares is now computed only once"
This reverts commit e9808efc61.
2018-06-14 10:05:05 +01:00
Vladimir Komendantskiy e9808efc61 the set of node indices of common coin shares is now computed only once 2018-06-13 22:05:11 +01:00
Vladimir Komendantskiy b82ac64148 note in the broadcast example about the use of keys 2018-06-13 18:24:35 +01:00
Vladimir Komendantskiy 4dbef3968d fixed early update of Agreement epoch 2018-06-13 15:18:27 +01:00
Vladimir Komendantskiy d5794cb5fe extended the common coin nonce with a global UID and the top-level epoch 2018-06-13 15:18:27 +01:00
Vladimir Komendantskiy e116c6c171 added tests for the common coin 2018-06-13 15:17:11 +01:00
Vladimir Komendantskiy f4b6c90c8c added a queue of incoming common coin signature shares 2018-06-13 15:17:11 +01:00
Vladimir Komendantskiy 94049e8636 fixed propagation of common coin messages to the top level 2018-06-13 15:17:11 +01:00
Vladimir Komendantskiy 40eeee90fc protobuf serialization 2018-06-13 15:17:11 +01:00
Vladimir Komendantskiy 122f1fc6f1 updated the tests with key initialisation 2018-06-13 15:15:41 +01:00
Vladimir Komendantskiy cf45a4e3cb common coin implementation 2018-06-13 15:15:41 +01:00
Vladimir Komendantskiy b6587a21e8 get_coin interface to Common Coin 2018-06-13 15:09:12 +01:00
Vladimir Komendantskiy 17dc9df78e Common Coin module template; added keys in NetworkInfo 2018-06-13 15:09:12 +01:00
Andreas Fackler 6cc2302e61 Implement polynomials for distributed key generation. 2018-06-11 16:45:08 +02:00
Vladimir Komendantskiy d1362ed500
Merge pull request #56 from poanetwork/vk-term-agreement
Added Term messages in Agreement and enabled early termination
2018-06-08 09:06:46 +01:00
Vladimir Komendantskiy dc4475ba82 for each node, never count both Aux and Term messages 2018-06-07 20:29:51 +01:00
Vladimir Komendantskiy 35d5ad106a added Term messages in Agreement and enabled early termination 2018-06-07 20:06:44 +01:00
Andreas Fackler cf9521c565 Don't return an error on deserialization failure. 2018-05-31 16:32:54 +02:00
Andreas Fackler fc599232aa Add logging to simulation example. 2018-05-31 14:28:10 +02:00
Andreas Fackler f970272d3e Add bandwidth and CPU to the simulation. 2018-05-31 14:28:10 +02:00
Andreas Fackler 1fd7155e31 Remove unused CommonSubset error variants. 2018-05-31 09:37:00 +02:00
Andreas Fackler 9859002e1b Don't panic on shards of unequal size. 2018-05-31 09:12:15 +02:00
Andreas Fackler bb61d0c5ab Ignore messages in Agreement after termination. 2018-05-30 17:33:24 +02:00
Andreas Fackler f700ae82d0 Remove unused code from CommonSubset. 2018-05-30 15:50:16 +02:00
Andreas Fackler c91fa13213 Make Broadcast handle large payloads. 2018-05-30 15:40:15 +02:00
Andreas Fackler a0a8582f0b Expand crypto tests. 2018-05-30 14:15:54 +02:00
Andreas Fackler 661bae6438 Implement threshold encryption. 2018-05-30 13:50:09 +02:00
Andreas Fackler 45a7c07106 Implement simple encryption. 2018-05-30 11:42:17 +02:00
Andreas Fackler 0017a2a7c0 Make public keys and signatures serializable. 2018-05-30 10:08:43 +02:00
Andreas Fackler 56ab6a5037 Simplify hash_g2. 2018-05-29 21:59:21 +02:00
Andreas Fackler 527b1c8c17 Use SHA256 and byteorder in hash_g2. 2018-05-29 17:59:50 +02:00
Andreas Fackler d999792234 Implement threshold signatures. 2018-05-29 17:06:02 +02:00
Vladimir Komendantskiy ede1c7d157 moved the own ID membership test to the NetworkInfo constructor 2018-05-29 14:58:17 +01:00
Vladimir Komendantskiy 98f5304d4c top-level interface now requires providing a NetworkInfo parameter 2018-05-29 14:53:01 +01:00
Vladimir Komendantskiy d09f3e26b4 introduced common shared network information 2018-05-29 14:53:01 +01:00
Vladimir Komendantskiy 2aac22f083 comment updates 2018-05-28 11:54:37 +01:00
Vladimir Komendantskiy 82643fb442 formatting 2018-05-24 19:48:10 +01:00
Vladimir Komendantskiy 67c7bf4f8b updated protobuf serialisation 2018-05-24 19:11:56 +01:00
Vladimir Komendantskiy 111ed03a47 review comments taken into account 2018-05-24 18:52:58 +01:00
Vladimir Komendantskiy 43a47e1f46 lints checked 2018-05-23 23:19:48 +01:00
Vladimir Komendantskiy 72d5cecbb9 Fixed non-termination in the suggested Cobalt fix.
The non-termination was due to the direct use of `bin_values` when invoking the
common coin. The fix amounts to making the CONF round depend only on the subset
of `bin_values` sent in the CONF message.
2018-05-23 23:00:19 +01:00
Vladimir Komendantskiy 751bb57ace CONF round added to Agreement 2018-05-23 18:38:33 +01:00
Andreas Fackler 9a0622f3f2 Update Rust, re-enable rustfmt. 2018-05-21 11:26:42 +02:00
Peter van Nostrand 19b982284b Added error-chain error handling. 2018-05-20 07:51:33 -04:00
Andreas Fackler ca65a014d6 Use an unambiguous name for proposer ID. 2018-05-19 17:17:02 +02:00
Andreas Fackler ab89dabde9 Add a few explaining comments. 2018-05-19 17:10:30 +02:00
Andreas Fackler b8a2463d1c Extend tests and fix CommonSubset.
Verify termination and more outputs.

`CommonSubset` now instantiates `Agreement` with the correct ID.
2018-05-19 15:56:49 +02:00
Vladimir Komendantskiy 962a618ffd ported Common Subset tests to TestNetwork 2018-05-18 22:04:09 +01:00
Andreas Fackler d5f9c4d40d Fix Agreement and re-enable HoneyBadger test. 2018-05-17 17:38:45 +02:00
Andreas Fackler 50d007b954 Remove protoc dep, use new MerkleTree methods. 2018-05-17 16:50:47 +02:00
Andreas Fackler 500ec81b2f Add a network simulation example. 2018-05-17 12:52:07 +02:00
Vladimir Komendantskiy a0627b2550 review comments taken 2018-05-17 11:36:09 +01:00
Vladimir Komendantskiy c8c8e1bb1f added a latch for the decided value in Agreement to remember the output value 2018-05-17 10:43:56 +01:00
Vladimir Komendantskiy 0c386276b1 defined a DistAlgorithm instance of Agreement 2018-05-16 22:50:23 +01:00
Andreas Fackler 4164af1702 Generalize TestNetwork and test HoneyBadger. 2018-05-16 16:21:30 +02:00
Vladimir Komendantskiy 5f916c4d08 formatting and lint check 2018-05-15 22:25:41 +01:00
Vladimir Komendantskiy c8034da332 corrected the CommonSubset module and test to decide on a map of values insetead of a set 2018-05-15 18:18:05 +01:00
Vladimir Komendantskiy ff3e819a4f a better check for when bin_values becomes non-empty 2018-05-15 16:00:37 +01:00
Vladimir Komendantskiy 322373a5ae started using the set of sent agreement values 2018-05-15 15:47:54 +01:00
Vladimir Komendantskiy eadd233fe4 added the Common Subset test module 2018-05-15 15:44:47 +01:00
Andreas Fackler 66898aee30 In agreement, set sent_bval correctly. 2018-05-15 16:15:41 +02:00
Andreas Fackler b8c534da2b Rename has_output to decided, add output iterator. 2018-05-15 16:05:55 +02:00
Andreas Fackler 3895949cf6 Fix broadcast for size < 4, and test more network sizes. 2018-05-15 15:53:37 +02:00
Andreas Fackler 10d9aa73e3 Rename UnexpectedMessage error. 2018-05-15 15:48:43 +02:00
Andreas Fackler 5528fc2de8 Define a common DistAlgorithm trait.
This will allow us to deduplicate network simulations in tests for the
different algorithms. More generally, it facilitates writing general
tools and applying them to all distributed algorithms.
2018-05-15 15:48:43 +02:00
Andreas Fackler b543b771a7 Rename util to fmt. 2018-05-15 08:31:13 +02:00
Andreas Fackler e2c66e9a0a Add optional serde support.
If the feature "serialization-serde" is specified, protocol messages
implement serde's `Serialize` and `Deserialize` traits.

Close #18
2018-05-14 18:32:59 +02:00
Andreas Fackler e8838f1491 Make protobuf support optional.
Protobuf support is now only built if the feature
"serialization-protobuf" is enabled.

Close #19
2018-05-14 17:29:04 +02:00
Vladimir Komendantskiy a20ee74254 added a test for Binary Agreement with 4 proposers 2018-05-14 12:35:28 +01:00
Andreas Fackler 71fa32c18f Remove interior mutability.
The `RwLock` is not needed anymore, since the broadcast implementation
doesn't handle any threading internally.
2018-05-14 09:35:34 +02:00
Andreas Fackler 0d005ebdc9 Fix build with protobuf 1.6.0.
Protobuf made backwards-incompatible changes but didn't increment the
major version, thus breaking the build.
2018-05-12 16:33:54 +02:00
Andreas Fackler 38cdd596a2 Start implementing the top-level Honey Badger algorithm.
This also contains a few fixes for the `common_subset` module:
* Rename `common_subset::Output` to `Message` to avoid confusing it
  with the value that the algorithm outputs as a result.
* Implement dispatch of messages to the right instance within
  `CommonSubset`, in a way that is transparent to the user.
2018-05-12 16:09:07 +02:00
Andreas Fackler 36183b1e27 Simplify the message types. 2018-05-10 17:52:12 +02:00
Vladimir Komendantskiy 57ff64cce0 correction: Agreement outputs a value only once 2018-05-10 12:44:33 +01:00
Vladimir Komendantskiy 68e6a7ae2d added the missing agreement broadcast message on epoch change 2018-05-10 12:33:01 +01:00
Vladimir Komendantskiy fb50e38ead replaced the map of estimated values with only one optional value for the current epoch 2018-05-10 12:09:22 +01:00
Vladimir Komendantskiy cf33bac533 added the proposer ID to common_subset::handle_broadcast and mae it an interface fn 2018-05-10 11:01:25 +01:00
Vladimir Komendantskiy 51ef11b55c fixed the count of matching AUX messages 2018-05-10 10:07:22 +01:00
Vladimir Komendantskiy 259d5369b0 corrected the count of AUX messages 2018-05-10 10:07:22 +01:00
Vladimir Komendantskiy b6a6bb35ea clear the received AUX messages on every epoch update 2018-05-10 10:07:22 +01:00
Vladimir Komendantskiy e0005a672b removed the separate field in Agreement and corrected computation of estimated values 2018-05-10 10:07:22 +01:00
Vladimir Komendantskiy 3e35cc665b added element_proposer_id to the Agreement input to the Common Subset algorithm 2018-05-10 10:07:22 +01:00
Vladimir Komendantskiy 394462c88b changed code according to review comments 2018-05-10 10:07:22 +01:00
Vladimir Komendantskiy 5215156ec5 defined the output from the Common Subset algorithm 2018-05-10 10:02:03 +01:00
Vladimir Komendantskiy d3b974f888 Binary Agreement implementation and its wiring into Common Subset 2018-05-10 10:02:03 +01:00
Andreas Fackler 047307be46 Revert to earlier ProtoIo implementation.
This fixes the issue where sometimes messages were skipped.
2018-05-09 14:18:12 +02:00
Andreas Fackler c790a1feba Improve example logging, add BinaryPath. 2018-05-09 13:38:49 +02:00
Andreas Fackler b98bbe9dcd Fix broadcast and example, enable more tests.
This fixes several issues with the broadcast algorithm and enables the
previously ignored tests that now pass:
* Don't decide on a root hash based on anyone's `Echo` message.
* Work around the `merkle` crate's inability to produce the proof of the
  `i`-th leaf for a given index `i`.
* Ignore messages from unknown nodes.
* Avoid decoding multiple times.
* Document the full algorithm.
* Don't count multiple `Echo` or `Ready` messages coming from the same
  node.
* Fix index computation for a given proof.
* Move `BroadcastMessage` into `broadcast` to make the module more
  self-contained.

The example now only executes a single broadcast instance, expecting the
first node (the one with the lexicographically lowest address) to
propose a value. A shell script is added that runs for example nodes.

Use env_logger instead of simple_logger, so the log level can be controlled
with an environment variable. You can e.g. log all output from the broadcast
test and the crate itself in debug mode with:
RUST_LOG=hbbft=debug,broadcast=debug

Some debugging messages are more concise now and use hexadecimal
notation instead of printing arrays of decimal values.

An indentation error in the Travis script is also fixed.
2018-05-08 17:04:38 +02:00
Vladimir Komendantskiy dda1570bfc Merge branch 'afck--examples' of github.com:poanetwork/hbbft 2018-05-06 22:49:41 +01:00
Andreas Fackler eec3102cbf Move node to examples, deduplicate code. 2018-05-05 17:54:29 +02:00
Andreas Fackler 7826987af1 added a Travis configuration file, fixed Clippy lints 2018-05-05 09:53:29 +02:00
Andreas Fackler e2cd4ca1b7 added (ignored) regression tests for some of the broadcast issues 2018-05-04 11:14:19 +02:00
Andreas Fackler 8bced81438 removed some unnecessary cloning
This also adds a few TODOs to the broadcast implementation: Some of
these issues need a regression test. (Oh, and a fix!)
2018-05-04 09:58:21 +02:00
Vladimir Komendantskiy cde3a879e5 modified Agreement::set_input to output a BVAL message 2018-05-03 10:13:41 +01:00
Vladimir Komendantskiy d64dec2bd1 added Agreement message type and protobuf boilerplate 2018-05-03 10:10:35 +01:00
Andreas Fackler babbd2f36a fixed broadcast failure with malicious value proposal 2018-05-03 11:07:37 +03:00
Andreas Fackler 0f3377c8e9 made broadcast handle its own echo and value messages 2018-05-03 08:47:31 +03:00
Vladimir Komendantskiy 13407c8774 Merge branch 'master' of github.com:poanetwork/hbbft 2018-05-02 15:47:54 +01:00
Vladimir Komendantskiy 98e3cf76a3 implementation of the last clause in Figure 4 2018-05-02 15:47:30 +01:00
Andreas Fackler 7096251b91 extended tests, make broadcast output only once 2018-05-02 16:34:54 +03:00
Vladimir Komendantskiy 7b04d5e084 created broadcast and agreement instances in Common Subset 2018-05-02 14:10:26 +01:00
Vladimir Komendantskiy 389855839f wrote CommonSubset::on_agreement_result and made related updates in agreement.rs 2018-05-02 11:57:28 +01:00
Vladimir Komendantskiy fbb69baa3c updated Common Subset with the new NodeUid type parameter 2018-05-02 08:15:47 +01:00
Vladimir Komendantskiy 579abbf415 merged changes in common_subset.rs into master 2018-05-01 20:21:13 +01:00
Vladimir Komendantskiy a792a209b5 Common Subset handler for input messages 2018-05-01 18:12:05 +01:00
Andreas Fackler f710806b17 test broadcast in a single thread 2018-05-01 19:38:11 +03:00
Vladimir Komendantskiy bb765cbb06 propose_value function in Broadcast 2018-05-01 15:28:31 +01:00
Vladimir Komendantskiy 2daaf7baf2 rewrote part of Common Subset to call Broadcast via a callback handler 2018-05-01 15:09:08 +01:00
Andreas Fackler d7882bae9c added Broadcast::handle_broadcast_message 2018-05-01 17:01:29 +03:00
Andreas Fackler 6117e11a9e applied rustfmt 2018-04-30 18:55:51 +03:00
Andreas Fackler f399ed2c07 fixed Clippy lint warnings 2018-04-30 18:50:24 +03:00
Vladimir Komendantskiy 329adc3c2b ported sharding and sending out Merkle tree proofs 2018-04-27 13:19:39 +01:00
Vladimir Komendantskiy 3ae0984733 fixed a potential RwLock panic in the Common Subset handler 2018-04-26 18:49:57 +01:00
Vladimir Komendantskiy eef846550f added the ACS algorithm with one clause not ready yet 2018-04-26 14:22:18 +01:00
Vladimir Komendantskiy 17678da06d separated the handler of remote broadcast messages into a fn for slightly better readability 2018-04-25 21:26:10 +01:00
Vladimir Komendantskiy db06e75d4e broadcast READY message handler ported from the older version 2018-04-25 21:00:22 +01:00
Vladimir Komendantskiy 8cd1f4748d broadcast ECHO message handler and mutable access solution for writeable state of broadcast 2018-04-25 20:41:46 +01:00
Vladimir Komendantskiy c7020e7b6a broadcast VALUE remote message handler written 2018-04-25 14:07:16 +01:00
Vladimir Komendantskiy 5428d928cc added receiver threads for remote nodes in the broadcast test 2018-04-25 10:59:46 +01:00
Vladimir Komendantskiy 93617f797d removed unnecessary mutability requirements 2018-04-25 10:59:46 +01:00
Vladimir Komendantskiy 08ff34c2a7 removed the algo error type, replacing it with type constraints and drafted adding handlers to a test node 2018-04-25 10:59:46 +01:00
Vladimir Komendantskiy 92d8c0d71a fold was not using the variable capturing the sequential data; I fixed that 2018-04-25 10:59:46 +01:00
Vladimir Komendantskiy 36cb880186 introduced a message handler trait and corrected the type of message handler container 2018-04-25 10:59:46 +01:00
Vladimir Komendantskiy 629c54494c added send_remote for sending a queue of messages to remote nodes through channels 2018-04-25 10:59:46 +01:00
Vladimir Komendantskiy b5e47d9a4f wrote essentials of the message loop and updated the message queue with required handles 2018-04-25 10:59:46 +01:00
Vladimir Komendantskiy 875f3cecbe updated the message loop state adding messages queued for sending to remote nodes 2018-04-25 10:59:46 +01:00
Vladimir Komendantskiy f801f0c1b0 test prototype of a message loop implementation 2018-04-25 10:59:46 +01:00
Vladimir Komendantskiy 7b82228b57 basic types for message passing between algorithms 2018-04-25 10:59:46 +01:00
Vladimir Komendantskiy 27e5ee679e Internal messaging was being stopped before broadcast threads finished. Corrected that. 2018-04-20 09:42:15 +01:00
Vladimir Komendantskiy b1cc8aee15 removed unused test module and refactored handling of Result using combinators 2018-04-16 15:17:36 +01:00
Vladimir Komendantskiy cdd86cbd6a added error handling in the local messaging task, so that channel errors don't cause a panic 2018-04-16 14:03:32 +01:00
Andreas Fackler 0494b4925d fixed value encoding, shortened debug messages
This adds a length byte to the values before padding with 0, so that we
can omit the padding at the end again. Shards are not converted to the
type parameter `T` anymore, because they are not necessarily valid
representations of a `T` value, e.g. valid UTF-8, as in the tests.

It also shortens some debug messages by printing byte arrays as
hexadecimal, and eliding some bytes.
2018-04-14 12:27:17 +02:00
Andreas Fackler fc3e502c5a fixed test build 2018-04-14 10:40:06 +02:00
Vladimir Komendantskiy d9bc81fe5f integration test of broadcast mostly ready; there is a thread termination issue however 2018-04-13 18:28:41 +01:00
Vladimir Komendantskiy efdb4467c5 added broadcast integration test concept 2018-04-12 17:17:33 +01:00
Vladimir Komendantskiy 40575402c8 replaced AsRef constraint by more precise Hashable and corrected doc example 2018-04-11 17:57:30 +01:00