Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
Track BEEFY validator set (#94)
Browse files Browse the repository at this point in the history
* Track BEEFY validator set

* Add validator_set_id to BeefyWorker

* Make validattor_set_id optional
  • Loading branch information
adoerr authored Mar 3, 2021
1 parent 0f09a95 commit 97468fe
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions primitives/beefy/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<AuthorityId> {
/// Public keys of the validator set elements
pub validators: Vec<AuthorityId>,
/// Identifier of the validator set
pub id: ValidatorSetId,
}

/// The index of an authority.
pub type AuthorityIndex = u32;

Expand All @@ -80,12 +89,7 @@ pub type MmrRootHash = H256;
pub enum ConsensusLog<AuthorityId: Codec> {
/// The authorities have changed.
#[codec(index = 1)]
AuthoritiesChange {
/// Set of new validators to be used
new_validator_set: Vec<AuthorityId>,
/// Id for this new set of validators
new_validator_set_id: ValidatorSetId,
},
AuthoritiesChange(ValidatorSet<AuthorityId>),
/// Disable the authority with given index.
#[codec(index = 2)]
OnDisabled(AuthorityIndex),
Expand Down

0 comments on commit 97468fe

Please sign in to comment.