Commit graph

41 commits

Author SHA1 Message Date
Luke Parker
f37adf4feb
Remove machine from TendermintImport
It's not used there at all.
2022-10-30 06:29:37 -04:00
Luke Parker
aee0bde45d
Connect broadcast 2022-10-30 05:37:23 -04:00
Luke Parker
6c54289fb4
Connect the Tendermint machine to a GossipEngine 2022-10-30 05:16:25 -04:00
Luke Parker
1af6117155
Move TendermintMachine from start_num, time to last_num, time
Provides an explicitly clear API clearer to program around.

Also adds additional time code to handle an edge case.
2022-10-30 04:27:15 -04:00
Luke Parker
edb2e00db7
Remove the Future triggering the machine for an async fn
Enables passing data in, such as the network.
2022-10-30 04:08:33 -04:00
Luke Parker
6838d5c922
Clean generics in Tendermint with a monolith with associated types 2022-10-30 03:26:31 -04:00
Luke Parker
8d3efd6259
Correct Substrate Tendermint start block
The Tendermint machine uses the passed in number as the block's being 
worked on number. Substrate passed in the already finalized block's 
number.

Also updates misc comments.
2022-10-30 01:22:11 -04:00
Luke Parker
9a54317743
Basic Gossip Validator 2022-10-30 01:21:10 -04:00
Luke Parker
a0c892dfc3
Use the validators list from the session pallet 2022-10-29 06:00:58 -04:00
Luke Parker
f91c081f30
Fix the stub round robin
At some point, the modulus was removed causing it to exceed the 
validators list and stop proposing.
2022-10-27 08:49:36 -04:00
Luke Parker
5c08fa9701
TendermintApi, compilation fixes 2022-10-27 08:44:53 -04:00
Luke Parker
66f7663cb2
Redo Tendermint folder structure 2022-10-27 06:33:58 -04:00
Luke Parker
9b8f2f4487
More misc bug fixes 2022-10-24 06:18:16 -04:00
Luke Parker
05be5c14c3
Misc bug fixes 2022-10-24 05:52:40 -04:00
Luke Parker
a7f4804749
Move Commit from including the round to including the round's end_time
The round was usable to build the current clock in an accumulated 
fashion, relative to the previous round. The end time is the absolute 
metric of it, which can be used to calculate the round number (with all 
previous end times).

Substrate now builds off the best block, not genesis, using the end time 
included in the justification to start its machine in a synchronized 
state.

Knowing the end time of a round, or the round in which block was 
committed to, is necessary for nodes to sync up with Tendermint. 
Encoding it in the commit ensures it's long lasting and makes it readily 
available, without the load of an entire transaction.
2022-10-24 05:28:21 -04:00
Luke Parker
b9c091c5d0
When resetting, use the end time of the round which was committed to
The machine reset to the end time of the current round. For a delayed 
network connection, a machine may move ahead in rounds and only later 
realize a prior round succeeded. Despite acknowledging that round's 
success, it would maintain its delay when moving to the next block, 
bricking it.

Done by tracking the end time for each round as they occur.
2022-10-24 04:48:17 -04:00
Luke Parker
193281e387
Get the result of block importing 2022-10-22 01:43:07 -04:00
Luke Parker
bf5bdb89c2
Implement block proposal logic 2022-10-21 23:36:24 -04:00
Luke Parker
5c46edbe98
Implement tendermint_machine::Block for Substrate Blocks
Unfortunately, this immediately makes Tendermint machine capable of 
deployment as  crate since it uses a git reference. In the future, a 
Cargo.toml patch section for serai/substrate should be investigated. 
This is being done regardless as it's the quickest way forward and this 
is for Serai.
2022-10-21 02:06:48 -04:00
Luke Parker
9db42f7d83
Minor SignatureScheme API changes 2022-10-20 03:40:46 -04:00
Luke Parker
ff41e9f031
Correct timing issues
1) Commit didn't include the round, leaving the clock in question.

2) Machines started with a local time, instead of a proper start time.

3) Machines immediately started the next block instead of waiting for 
the block time.
2022-10-20 00:21:14 -04:00
Luke Parker
6b56510da9
Remove async recursion
Greatly increases safety as well by ensuring only one message is 
processed at once.
2022-10-17 12:04:59 -04:00
Luke Parker
8b6eb1172f
Litany of bug fixes
Also attempts to make the code more readable while updating/correcting 
documentation.
2022-10-17 10:37:30 -04:00
Luke Parker
5724f52816
Sign the ID directly instead of its SCALE encoding
For a hash, which is fixed-size, these should be the same yet this helps 
move past the dependency on SCALE. It also, for any type where the two 
values are different, smooths integration.
2022-10-17 08:16:01 -04:00
Luke Parker
f28d412f78
Document tendermint 2022-10-17 08:07:23 -04:00
Luke Parker
0501ff259e
Tidy README 2022-10-17 03:15:22 -04:00
Luke Parker
6155d12160
Dedicated Commit object
Restores sig aggregation API.
2022-10-17 03:15:13 -04:00
Luke Parker
b993ff1cc8
Provide a dedicated signature in Precommit of just the block hash
Greatly simplifies verifying when syncing.
2022-10-17 02:32:45 -04:00
Luke Parker
1c71e25234
Make the infinite test non-infinite 2022-10-16 10:25:36 -04:00
Luke Parker
329a48c19d
Implement usage of the signature scheme 2022-10-16 10:20:29 -04:00
Luke Parker
987aa5189a
Implement serialization via parity's scale codec
Ideally, this would be generic. Unfortunately, the generic API serde 
doesn't natively support borsh, nor SCALE, and while there is a serde 
SCALE crate, it's old. While it may be complete, it's not worth working 
with.

While we could still grab bincode, and a variety of other formats, it 
wasn't worth it to go custom and for Serai, we'll be using SCALE almost 
everywhere anyways.
2022-10-16 10:06:27 -04:00
Luke Parker
85962c00a9
Define a signature scheme trait 2022-10-16 09:42:33 -04:00
Luke Parker
a0bc9dc3e5
Misc cleanup 2022-10-16 09:16:44 -04:00
Luke Parker
c53c15fd95
Finish timeouts 2022-10-16 09:09:14 -04:00
Luke Parker
3b2352baed
Fix test 2022-10-16 09:09:05 -04:00
Luke Parker
079eee931a
Calculate timeouts 2022-10-16 07:54:07 -04:00
Luke Parker
77ba1c00e2
Successfully compiling 2022-10-16 07:30:11 -04:00
Luke Parker
f79321233d
Refactor <V, B> to type V, type B 2022-10-16 03:55:39 -04:00
Luke Parker
a5f1ddaf1b
Refactor out external parts to generics
Also creates a dedicated file for the message log.
2022-10-16 03:29:55 -04:00
Luke Parker
1237c41c53
Delete the old paper doc 2022-10-16 03:29:16 -04:00
Luke Parker
ccd4ef193c
Move substrate/consensus/tendermint to substrate/tendermint 2022-10-16 01:32:54 -04:00