mirror of
https://github.com/serai-dex/serai.git
synced 2025-12-10 05:09:22 +00:00
Move substrate/consensus/tendermint to substrate/tendermint
This commit is contained in:
@@ -17,6 +17,7 @@ members = [
|
|||||||
"processor",
|
"processor",
|
||||||
|
|
||||||
"substrate/runtime",
|
"substrate/runtime",
|
||||||
|
"substrate/tendermint",
|
||||||
"substrate/consensus",
|
"substrate/consensus",
|
||||||
"substrate/node",
|
"substrate/node",
|
||||||
|
|
||||||
|
|||||||
11
substrate/tendermint/Cargo.toml
Normal file
11
substrate/tendermint/Cargo.toml
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
[package]
|
||||||
|
name = "tendermint-machine"
|
||||||
|
version = "0.1.0"
|
||||||
|
description = "An implementation of the Tendermint state machine in Rust"
|
||||||
|
license = "MIT"
|
||||||
|
repository = "https://github.com/serai-dex/serai/tree/develop/substrate/tendermint"
|
||||||
|
authors = ["Luke Parker <lukeparker5132@gmail.com>"]
|
||||||
|
edition = "2021"
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
tokio = "1"
|
||||||
21
substrate/tendermint/LICENSE
Normal file
21
substrate/tendermint/LICENSE
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2022 Luke Parker
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
52
substrate/tendermint/README.md
Normal file
52
substrate/tendermint/README.md
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
# 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 hash function, signature protocol, and block
|
||||||
|
definition accordingly. It is not intended to work with the Cosmos SDK, solely
|
||||||
|
be an implementation of the
|
||||||
|
[academic protocol](https://arxiv.org/pdf/1807.04938.pdf).
|
||||||
|
|
||||||
|
### Paper
|
||||||
|
|
||||||
|
The [paper](https://arxiv.org/abs/1807.04938) describes the algorithm with
|
||||||
|
pseudocode on page 6. This pseudocode is written as a series of conditions for
|
||||||
|
advancement. This is extremely archaic, as its a fraction of the actually
|
||||||
|
required code. This is due to its hand-waving away of data tracking, lack of
|
||||||
|
comments (beyond the entire rest of the paper, of course), and lack of
|
||||||
|
specification regarding faulty nodes.
|
||||||
|
|
||||||
|
While the "hand-waving" is both legitimate and expected, as it's not the paper's
|
||||||
|
job to describe a full message processing loop nor efficient variable handling,
|
||||||
|
it does leave behind ambiguities and annoyances, not to mention an overall
|
||||||
|
structure which cannot be directly translated. This section is meant to be a
|
||||||
|
description of it as used for translation.
|
||||||
|
|
||||||
|
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
|
||||||
|
```
|
||||||
|
|
||||||
|
Remaining:
|
||||||
|
|
||||||
|
```
|
||||||
|
36-43 First proposal with prevotes -> precommit Some
|
||||||
|
57-60 on timeout propose
|
||||||
|
61-64 on timeout prevote
|
||||||
|
65-67 on timeout precommit
|
||||||
|
```
|
||||||
Reference in New Issue
Block a user