Stop validators from equivocating on reboot

Part of https://github.com/serai-dex/serai/issues/345.

The lack of full DB persistence does mean enough nodes rebooting at the same
time may cause a halt. This will prevent slashes.
This commit is contained in:
Luke Parker
2024-03-07 22:40:04 -05:00
parent 6c8a0bfda6
commit e266bc2e32
8 changed files with 55 additions and 5 deletions

View File

@@ -10,6 +10,8 @@ use parity_scale_codec::{Encode, Decode};
use futures_util::sink::SinkExt;
use tokio::{sync::RwLock, time::sleep};
use serai_db::MemDb;
use tendermint_machine::{
ext::*, SignedMessageFor, SyncedBlockSender, SyncedBlockResultReceiver, MessageSender,
SlashEvent, TendermintMachine, TendermintHandle,
@@ -111,6 +113,8 @@ struct TestNetwork(
#[async_trait]
impl Network for TestNetwork {
type Db = MemDb;
type ValidatorId = TestValidatorId;
type SignatureScheme = TestSignatureScheme;
type Weights = TestWeights;
@@ -170,6 +174,7 @@ impl TestNetwork {
let i = u16::try_from(i).unwrap();
let TendermintHandle { messages, synced_block, synced_block_result, machine } =
TendermintMachine::new(
MemDb::new(),
TestNetwork(i, arc.clone()),
BlockNumber(1),
start_time,