serai/coordinator/tributary/tendermint
Luke Parker e772b8a5f7
Some checks failed
coins/ Tests / test-coins (push) Waiting to run
Coordinator Tests / build (push) Waiting to run
Full Stack Tests / build (push) Waiting to run
Lint / clippy (macos-13) (push) Waiting to run
Lint / clippy (macos-14) (push) Waiting to run
Lint / clippy (ubuntu-latest) (push) Waiting to run
Lint / clippy (windows-latest) (push) Waiting to run
Lint / deny (push) Waiting to run
Lint / fmt (push) Waiting to run
Lint / machete (push) Waiting to run
no-std build / build (push) Waiting to run
Processor Tests / build (push) Waiting to run
Reproducible Runtime / build (push) Waiting to run
Tests / test-infra (push) Waiting to run
Tests / test-substrate (push) Waiting to run
Tests / test-serai-client (push) Waiting to run
Message Queue Tests / build (push) Has been cancelled
common/ Tests / test-common (push) Has been cancelled
crypto/ Tests / test-crypto (push) Has been cancelled
#560 take two, now that #560 has been reverted (#561)
* Clear upons upon round, not block

* Cache the proposal for a round

* Rebase onto develop, which reverted this PR, and re-apply this PR

* Set participation upon participation instead of constantly recalculating

* Cache message instances

* Add missing txn commit

Identified by @akildemir.

* Correct clippy lint identified upon rebase

* Fix tendermint chain sync (#581)

* fix p2p Reqres protocol

* stabilize tributary chain sync

* fix pr comments

---------

Co-authored-by: akildemir <34187742+akildemir@users.noreply.github.com>
2024-07-16 19:42:15 -04:00
..
src #560 take two, now that #560 has been reverted (#561) 2024-07-16 19:42:15 -04:00
tests #560 take two, now that #560 has been reverted (#561) 2024-07-16 19:42:15 -04:00
Cargo.toml Stop validators from equivocating on reboot 2024-03-07 22:56:35 -05:00
LICENSE Create a folder for tributary, the micro-blockchain 2023-04-11 10:18:31 -04:00
README.md Create a folder for tributary, the micro-blockchain 2023-04-11 10:18:31 -04:00

Tendermint

An implementation of the Tendermint state machine in Rust.

This is solely the state machine, intended to be mapped to any arbitrary system. It supports an arbitrary signature scheme, weighting, and block definition accordingly. It is not intended to work with the Cosmos SDK, solely to be an implementation of the academic protocol.

Caveats

  • Only SCALE serialization is supported currently. Ideally, everything from SCALE to borsh to bincode would be supported. SCALE was chosen due to this being under Serai, which uses Substrate, which uses SCALE. Accordingly, when deciding which of the three (mutually incompatible) options to support...

  • The only supported runtime is tokio due to requiring a sleep implementation. Ideally, the runtime choice will be moved to a feature in the future.

  • It is possible for add_block to be called on a block which failed (or never went through in the first place) validation. This is a break from the paper which is accepted here. This is for two reasons.

    1. Serai needing this functionality.
    2. If a block is committed which is invalid, either there's a malicious majority now defining consensus OR the local node is malicious by virtue of being faulty. Considering how either represents a fatal circumstance, except with regards to system like Serai which have their own logic for pseudo-valid blocks, it is accepted as a possible behavior with the caveat any consumers must be aware of it. No machine will vote nor precommit to a block it considers invalid, so for a network with an honest majority, this is a non-issue.

Paper

The paper describes the algorithm with pseudocode on page 6. This pseudocode isn't directly implementable, nor does it specify faulty behavior. Instead, it's solely a series of conditions which trigger events in order to successfully achieve consensus.

The included pseudocode segments can be minimally described as follows:

01-09 Init
10-10 StartRound(0)
11-21 StartRound
22-27 Fresh proposal
28-33 Proposal building off a valid round with prevotes
34-35 2f+1 prevote -> schedule timeout prevote
36-43 First proposal with prevotes -> precommit Some
44-46 2f+1 nil prevote -> precommit nil
47-48 2f+1 precommit -> schedule timeout precommit
49-54 First proposal with precommits -> finalize
55-56 f+1 round > local round, jump
57-60 on timeout propose
61-64 on timeout prevote
65-67 on timeout precommit

The corresponding Rust code implementing these tasks are marked with their related line numbers.