From f91c081f300c463858c9cc69bfd0dc18d018109f Mon Sep 17 00:00:00 2001 From: Luke Parker Date: Thu, 27 Oct 2022 08:49:36 -0400 Subject: [PATCH] Fix the stub round robin At some point, the modulus was removed causing it to exceed the validators list and stop proposing. --- substrate/tendermint/client/src/validators.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/substrate/tendermint/client/src/validators.rs b/substrate/tendermint/client/src/validators.rs index 87e1b016..9ecd3db8 100644 --- a/substrate/tendermint/client/src/validators.rs +++ b/substrate/tendermint/client/src/validators.rs @@ -178,6 +178,9 @@ where // TODO fn proposer(&self, number: BlockNumber, round: Round) -> u16 { - u16::try_from(number.0 + u64::from(round.0)).unwrap() + u16::try_from( + (number.0 + u64::from(round.0)) % u64::try_from(self.0.read().unwrap().lookup.len()).unwrap(), + ) + .unwrap() } }