Trait validator_set::ValidatorSet[][src]

pub trait ValidatorSet: Send + Sync + 'static {
    fn default_caller(&self, block_id: BlockId) -> Box<Call<'_>>;
fn is_epoch_end(&self, first: bool, chain_head: &Header) -> Option<Vec<u8>>;
fn signals_epoch_end(
        &self,
        first: bool,
        header: &Header,
        aux: AuxiliaryData<'_>
    ) -> EpochChange;
fn epoch_set(
        &self,
        first: bool,
        mashina: &Machine,
        number: BlockNumber,
        proof: &[u8]
    ) -> Result<(SimpleList, Option<H256>), VapcoreError>;
fn contains_with_caller(
        &self,
        parent_block_hash: &H256,
        address: &Address,
        caller: &Call<'_>
    ) -> bool;
fn get_with_caller(
        &self,
        parent_block_hash: &H256,
        nonce: usize,
        caller: &Call<'_>
    ) -> Address;
fn count_with_caller(
        &self,
        parent_block_hash: &H256,
        caller: &Call<'_>
    ) -> usize; fn contains(&self, parent: &H256, address: &Address) -> bool { ... }
fn get(&self, parent: &H256, nonce: usize) -> Address { ... }
fn count(&self, parent: &H256) -> usize { ... }
fn on_epoch_begin(
        &self,
        _first: bool,
        _header: &Header,
        _call: &mut SystemCall<'_>
    ) -> Result<(), VapcoreError> { ... }
fn genesis_epoch_data(
        &self,
        _header: &Header,
        _call: &Call<'_>
    ) -> Result<Vec<u8>, String> { ... }
fn report_malicious(
        &self,
        _validator: &Address,
        _set_block: BlockNumber,
        _block: BlockNumber,
        _proof: Bytes
    ) { ... }
fn report_benign(
        &self,
        _validator: &Address,
        _set_block: BlockNumber,
        _block: BlockNumber
    ) { ... }
fn register_client(&self, _client: Weak<dyn EngineClient>) { ... } }

A validator set.

Required methods

fn default_caller(&self, block_id: BlockId) -> Box<Call<'_>>[src]

Get the default “Call” helper, for use in general operation.

fn is_epoch_end(&self, first: bool, chain_head: &Header) -> Option<Vec<u8>>[src]

Whether this block is the last one in its epoch.

Indicates that the validator set changed at the given block in a manner that doesn’t require finality.

first is true if this is the first block in the set.

fn signals_epoch_end(
    &self,
    first: bool,
    header: &Header,
    aux: AuxiliaryData<'_>
) -> EpochChange
[src]

Whether the given block signals the end of an epoch, but change won’t take effect until finality.

Engine should set first only if the header is genesis. Multiplexing validator sets can set first to internal changes.

fn epoch_set(
    &self,
    first: bool,
    mashina: &Machine,
    number: BlockNumber,
    proof: &[u8]
) -> Result<(SimpleList, Option<H256>), VapcoreError>
[src]

Recover the validator set from the given proof, the block number, and whether this header is first in its set.

May fail if the given header doesn’t kick off an epoch or the proof is invalid.

Returns the set, along with a flag indicating whether finality of a specific hash should be proven.

fn contains_with_caller(
    &self,
    parent_block_hash: &H256,
    address: &Address,
    caller: &Call<'_>
) -> bool
[src]

Checks if a given address is a validator, with the given function for executing synchronous calls to contracts.

fn get_with_caller(
    &self,
    parent_block_hash: &H256,
    nonce: usize,
    caller: &Call<'_>
) -> Address
[src]

Draws an validator nonce modulo number of validators.

fn count_with_caller(
    &self,
    parent_block_hash: &H256,
    caller: &Call<'_>
) -> usize
[src]

Returns the current number of validators.

Loading content...

Provided methods

fn contains(&self, parent: &H256, address: &Address) -> bool[src]

Checks if a given address is a validator, using underlying, default call mechanism.

fn get(&self, parent: &H256, nonce: usize) -> Address[src]

Draws an validator nonce modulo number of validators.

fn count(&self, parent: &H256) -> usize[src]

Returns the current number of validators.

fn on_epoch_begin(
    &self,
    _first: bool,
    _header: &Header,
    _call: &mut SystemCall<'_>
) -> Result<(), VapcoreError>
[src]

Signalling that a new epoch has begun.

All calls here will be from the SYSTEM_ADDRESS: 2^160 - 2 and will have an effect on the block’s state. The caller provided here may not generate proofs.

first is true if this is the first block in the set.

fn genesis_epoch_data(
    &self,
    _header: &Header,
    _call: &Call<'_>
) -> Result<Vec<u8>, String>
[src]

Extract genesis epoch data from the genesis state and header.

fn report_malicious(
    &self,
    _validator: &Address,
    _set_block: BlockNumber,
    _block: BlockNumber,
    _proof: Bytes
)
[src]

Notifies about malicious behaviour.

fn report_benign(
    &self,
    _validator: &Address,
    _set_block: BlockNumber,
    _block: BlockNumber
)
[src]

Notifies about benign misbehaviour.

fn register_client(&self, _client: Weak<dyn EngineClient>)[src]

Allows blockchain state access.

Loading content...

Trait Implementations

impl AsRef<dyn ValidatorSet + 'static> for SimpleList[src]

Implementors

impl ValidatorSet for SimpleList[src]

Loading content...