Skip to main content

Config

Trait Config 

Source
pub trait Config<S: Scheme>:
    Clone
    + Send
    + 'static {
    type Elector: Elector<S>;

    // Required method
    fn build(self, participants: &Set<S::PublicKey>) -> Self::Elector;
}
Expand description

Configuration for creating an Elector.

Users create and configure this type, then pass it to the consensus configuration. Consensus will call build internally with the correct participant set to create the initialized Elector.

§Determinism Requirement

Implementations must be deterministic. Honest participants with the same configuration and participant set must select the same leader for each round. This is stronger than returning the same output for identical inputs because honest participants may call Elector::elect with different certificates for the same round. See Elector for the certificate handling requirements.

Required Associated Types§

Source

type Elector: Elector<S>

The initialized elector type.

Required Methods§

Source

fn build(self, participants: &Set<S::PublicKey>) -> Self::Elector

Builds the elector with the given participants.

Called internally by consensus with the correct participant set.

§Panics

Implementations should panic if participants is empty.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<P, V, H> Config<Scheme<P, V>> for Random<H>
where P: PublicKey, V: Variant, H: Hasher,

Source§

impl<S: Scheme, H: Hasher> Config<S> for RoundRobin<H>