Commit Graph

557 Commits

Author SHA1 Message Date
Luke Parker
5839f44290 Clean up lock acquisition 2022-10-25 02:45:20 -04:00
TheArchitect108
ccdb834e6e fixes caching issues (#139)
* fixes caching issues

* update comment
2022-10-24 23:48:11 -05: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
4859e8c27e Merge branch 'develop' into tendermint 2022-10-23 21:01:39 -04:00
Luke Parker
42a711ee51 Replace the Serai scripts volume for directly copying the files
This should probably be done for the other images as well.
2022-10-23 21:01:11 -04:00
Luke Parker
7ecf8b22cf Mark all sh files as executable 2022-10-23 20:39:37 -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
adfc9a5d1d Merge branch 'develop' into tendermint 2022-10-21 22:33:41 -04:00
GitHub Actions
595b2da433 Update nightly 2022-10-21 21:26:27 -05:00
Luke Parker
a03a04bcc6 Simplify monthly nightly update workflow 2022-10-21 22:25:32 -04:00
Luke Parker
22713493d8 Move from set-output to $GITHUB_OUTPUT
https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/
2022-10-21 22:19:01 -04:00
Luke Parker
e8df74e295 Merge branch 'develop' into tendermint 2022-10-21 22:02:45 -04:00
Luke Parker
b72af5e185 cargo update
The new ink release should enable using the latest Rust nightly, without 
issue.
2022-10-21 21:40:50 -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
Luke Parker
fcb9148fc9 Merge branch 'develop' into tendermint 2022-10-21 03:17:21 -04:00
Luke Parker
976948e9d9 Update Cargo.tomls for substrate packages 2022-10-21 03:17:02 -04:00
Luke Parker
c0432e122c Update consensus/lib.rs from PoW to Tendermint
Not possible to be used as the previous consensus could. It will not
produce blocks nor does it currenly even instantiate a machine. This is
just he next step.
2022-10-21 02:38:06 -04:00
Luke Parker
3b08633445 BlockImport, JustificationImport, Verifier, and import_queue function 2022-10-21 02:18:51 -04:00
Luke Parker
bdd0b42419 Move logic into TendermintImport itself
Multiple traits exist to verify/handle blocks. I'm unsure exactly when 
each will be called in the pipeline, so the easiest solution is to have 
every step run every check.

That would be extremely computationally expensive if we ran EVERY check, 
yet we rely on Substrate for execution (and according checks), which are 
limited to just the actual import function.

Since we're calling this code from many places, it makes sense for it to 
be consolidated under TendermintImport.
2022-10-21 02:17:40 -04:00
Luke Parker
56afb13ed5 Move documentation to the top of the file 2022-10-21 02:14:48 -04:00
Luke Parker
2cf1573c52 Dummy Weights 2022-10-21 02:13:44 -04:00
Luke Parker
21fd56d4d3 Remove extraneous clone 2022-10-21 01:08:15 -05: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
280683142a Rename import to import_queue 2022-10-20 04:28:26 -04:00
Luke Parker
49a26e5841 Properly use check_block 2022-10-20 04:27:53 -04:00
Luke Parker
eb59dd5a55 Initial work on an import queue 2022-10-20 03:50:06 -04:00