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.
This commit is contained in:
Luke Parker 2022-10-30 01:22:11 -04:00
parent 9a54317743
commit 8d3efd6259
No known key found for this signature in database
GPG key ID: F9F1386DB1E119B6
3 changed files with 6 additions and 5 deletions

View file

@ -1,4 +1,5 @@
use std::{
convert::TryInto,
pin::Pin,
sync::{Arc, RwLock},
task::{Poll, Context},
@ -115,8 +116,8 @@ where
0,
(
// Header::Number: TryInto<u64> doesn't implement Debug and can't be unwrapped
match best.try_into() {
Ok(best) => BlockNumber(best),
match TryInto::<u64>::try_into(best) {
Ok(best) => BlockNumber(best + 1),
Err(_) => panic!("BlockNumber exceeded u64"),
},
Commit::<TendermintValidators<B, Be, C>>::decode(

View file

@ -25,7 +25,7 @@ struct TendermintValidatorsStruct {
weights: Vec<u64>,
keys: Pair, // TODO: sp_keystore
lookup: Vec<Public>, // TODO: sessions
lookup: Vec<Public>,
}
impl TendermintValidatorsStruct {

View file

@ -157,7 +157,7 @@ impl<N: Network + 'static> TendermintMachine<N> {
fn timeout(&self, step: Step) -> Instant {
let mut round_time = Duration::from_secs(N::BLOCK_TIME.into());
round_time *= self.round.0 + 1;
let step_time = round_time / 3;
let step_time = round_time / 3; // TODO: Non-uniform timeouts
let offset = match step {
Step::Propose => step_time,