Commit graph

106 commits

Author SHA1 Message Date
Luke Parker
c0056643c8
Consolidate file structure in sc_tendermint 2022-10-30 11:08:12 -04:00
Luke Parker
91ae2b7112
Move serai_runtime specific code from tendermint/client to node
Renames serai-consensus to sc_tendermint
2022-10-30 10:54:17 -04:00
Luke Parker
a0e0545c49
Deleted comment code related to PoW 2022-10-30 10:10:17 -04:00
Luke Parker
3d7c12adcd
Create a dedicated file for being a Tendermint authority 2022-10-30 10:08:35 -04:00
Luke Parker
066bc40a88
Merge Verifier into block_import.rs
These two files were largely the same, just hooking into sync structs 
with almost identical imports. As this project shapes up, removing dead 
weight is appreciated.
2022-10-30 06:30:44 -04:00
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
4c2dd9b306
Partial work on correcting pallet calls 2022-10-27 06:29:56 -04:00
Luke Parker
eb418448eb
Update support URL 2022-10-27 05:45:55 -04:00
Luke Parker
fa7a03bf60
Update node to use pallet sessions 2022-10-27 05:23:53 -04:00
Luke Parker
49ab26209d
Add pallet sessions to runtime, create pallet-tendermint 2022-10-27 05:05:41 -04:00
Luke Parker
285152b6e2
Merge weights and signing scheme into validators, documenting needed changes 2022-10-25 02:51:33 -04:00
Luke Parker
5839f44290
Clean up lock acquisition 2022-10-25 02:45:20 -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
b5cb8a9be2
Add a TODO on Tendermint 2022-10-24 05:37:43 -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
78fa292230
Expand sanity checks
Substrate doesn't expect nor officially support children with less work 
than their parents. It's a trick used here. Accordingly, ensure the 
trick's validity.
2022-10-24 04:43:59 -04:00
Luke Parker
b6dddc469f
Consolidate C and I generics into a TendermintClient trait alias 2022-10-24 04:43:25 -04:00
Luke Parker
e8e490de1e
Add an assert to verify proposed children aren't best 2022-10-22 07:57:30 -04:00
Luke Parker
8a682cd25c
Announce blocks
By claiming File, they're not sent ovber the P2P network before they 
have a justification, as desired. Unfortunately, they never were. This 
works around that.
2022-10-22 07:36:13 -04:00
Luke Parker
dee6993ac8
Correct justication import pipeline
Removes JustificationImport as it should never be used.
2022-10-22 06:24:39 -04:00
Luke Parker
4206ed3b18
Don't import justifications multiple times
Also don't broadcast blocks which were solely proposed.
2022-10-22 04:39:27 -04:00
Luke Parker
9b0dca06d0
Provide a way to create the machine
The BasicQueue returned obscures the TendermintImport struct. 
Accordingly, a Future scoped with access is returned upwards, which when 
awaited will create the machine. This makes creating the machine 
optional while maintaining scope boundaries.

Is sufficient to create a 1-node net which produces and finalizes 
blocks.
2022-10-22 03:41:49 -04:00
Luke Parker
39984bd07b
Split import_queue into a series of files 2022-10-22 02:15:22 -04:00
Luke Parker
193281e387
Get the result of block importing 2022-10-22 01:43:07 -04:00
Luke Parker
8ed0f1f1cf
Trigger block importing
Doesn't wait for the response yet, which it needs to.
2022-10-22 00:48:09 -04:00
Luke Parker
5e52817dcd
Modularize to get_proposal 2022-10-22 00:47:38 -04:00
Luke Parker
bf5bdb89c2
Implement block proposal logic 2022-10-21 23:36:24 -04:00
Luke Parker
4bfc8d7954
Reduce chain_spec and use more accurate naming 2022-10-21 21:14:33 -04:00
Luke Parker
422f7e3e2f
Replace panicking todos with stubs and // TODO
Enables progress.
2022-10-21 21:14:05 -04:00
Luke Parker
5019f4cb65
Remove unused macro_use 2022-10-21 06:00:18 -04:00
Luke Parker
802f87385c
Remove substrate/node lib.rs
This shouldn't be used as a library AFAIK. While runtime should be, and 
arguably should even be published, I have yet to see node in the same 
way. Helps tighten API boundaries.
2022-10-21 05:56:53 -04:00
Luke Parker
0218db0084
Update SelectChain documentation 2022-10-21 05:53:15 -04:00
Luke Parker
0a58d66958
Minor tweaks 2022-10-21 05:35:37 -04:00
Luke Parker
f1532356a0
Merge branch 'develop' into tendermint 2022-10-21 05:33:42 -04:00
Luke Parker
c7f8258e0c
Cherry-pick 28308dfe85387fe54c14076089a40c5af1f1b8f7 2022-10-21 05:32:38 -04:00
Luke Parker
b8bff6501e
Move the node over to the new SelectChain 2022-10-21 05:29:01 -04:00
Luke Parker
123b8ad11b
Tendermint SelectChain
This is incompatible with Substrate's expectations, yet should be valid 
for ours
2022-10-21 05:28:26 -04:00