mirror of
https://github.com/serai-dex/serai.git
synced 2025-12-08 20:29:23 +00:00
Refactor <V, B> to type V, type B
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
use tendermint_machine::ext::{BlockError, Block, Network};
|
||||
use tendermint_machine::ext::*;
|
||||
|
||||
#[derive(Clone, PartialEq)]
|
||||
struct TestBlock {
|
||||
@@ -15,7 +15,10 @@ impl Block for TestBlock {
|
||||
}
|
||||
|
||||
struct TestNetwork;
|
||||
impl Network<u16, TestBlock> for TestNetwork {
|
||||
impl Network for TestNetwork {
|
||||
type ValidatorId = u16;
|
||||
type Block = TestBlock;
|
||||
|
||||
fn total_weight(&self) -> u64 {
|
||||
5
|
||||
}
|
||||
@@ -23,6 +26,10 @@ impl Network<u16, TestBlock> for TestNetwork {
|
||||
[1, 1, 1, 1, 1][usize::try_from(id).unwrap()]
|
||||
}
|
||||
|
||||
fn proposer(&self, number: BlockNumber, round: Round) -> u16 {
|
||||
u16::try_from((number.0 + u32::from(round.0)) % 5).unwrap()
|
||||
}
|
||||
|
||||
fn validate(&mut self, block: TestBlock) -> Result<(), BlockError> {
|
||||
block.valid
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user