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.
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.