From 97468fed4511bc4c68be29689d97520a4a8aead9 Mon Sep 17 00:00:00 2001 From: Andreas Doerr Date: Wed, 3 Mar 2021 15:42:34 +0100 Subject: [PATCH] Track BEEFY validator set (#94) * Track BEEFY validator set * Add validator_set_id to BeefyWorker * Make validattor_set_id optional --- primitives/beefy/src/lib.rs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/primitives/beefy/src/lib.rs b/primitives/beefy/src/lib.rs index 1b3395c46a47b..fcc21590ff5ce 100644 --- a/primitives/beefy/src/lib.rs +++ b/primitives/beefy/src/lib.rs @@ -69,6 +69,15 @@ pub const BEEFY_ENGINE_ID: sp_runtime::ConsensusEngineId = *b"BEEF"; /// A typedef for validator set id. pub type ValidatorSetId = u64; +/// A set of BEEFY authorities, a.k.a. validators. +#[derive(Decode, Encode, Debug)] +pub struct ValidatorSet { + /// Public keys of the validator set elements + pub validators: Vec, + /// Identifier of the validator set + pub id: ValidatorSetId, +} + /// The index of an authority. pub type AuthorityIndex = u32; @@ -80,12 +89,7 @@ pub type MmrRootHash = H256; pub enum ConsensusLog { /// The authorities have changed. #[codec(index = 1)] - AuthoritiesChange { - /// Set of new validators to be used - new_validator_set: Vec, - /// Id for this new set of validators - new_validator_set_id: ValidatorSetId, - }, + AuthoritiesChange(ValidatorSet), /// Disable the authority with given index. #[codec(index = 2)] OnDisabled(AuthorityIndex),