Skip to main content

Config

Struct Config 

Source
pub struct Config<S, L, B, D, A, R, F, T>
where S: Scheme, L: Config<S>, B: Blocker<PublicKey = S::PublicKey>, D: Digest, A: CertifiableAutomaton<Context = Context<D, S::PublicKey>>, R: Relay, F: Reporter<Activity = Activity<S, D>>, T: Strategy,
{
Show 22 fields pub scheme: S, pub elector: L, pub blocker: B, pub automaton: A, pub relay: R, pub reporter: F, pub track_historical_votes: bool, pub strategy: T, pub partition: String, pub mailbox_size: NonZeroUsize, pub epoch: Epoch, pub floor: Floor<S, D>, pub replay_buffer: NonZeroUsize, pub write_buffer: NonZeroUsize, pub page_cache: CacheRef, pub leader_timeout: Duration, pub certification_timeout: Duration, pub timeout_retry: Duration, pub view_retention: ViewDelta, pub skip: SkipPolicy, pub fetch_timeout: Duration, pub forward: ForwardPolicy,
}
Expand description

Configuration for the consensus engine.

Fields§

§scheme: S

Signing scheme for the consensus engine.

Consensus messages can be signed with a cryptosystem that differs from the static participant identity keys exposed in participants. For example, we can authenticate peers on the network with commonware_cryptography::ed25519 keys while signing votes with shares distributed via commonware_cryptography::bls12381::dkg (which change each epoch). The scheme implementation is responsible for reusing the exact participant ordering carried by participants so that signer indices remain stable across both key spaces; if the order diverges, validators will reject votes as coming from the wrong validator.

Schemes must provide deterministic signatures (a participant must produce the same signature encoding every time it signs the same subject) because Simplex compares encoded votes when detecting equivocation.

§elector: L

Leader election configuration.

Determines how leaders are selected for each view. Built-in options include RoundRobin for deterministic rotation and Random for unpredictable selection using BLS threshold signatures.

§blocker: B

Blocker for the network.

Blocking is handled by commonware_p2p.

§automaton: A

Automaton for the consensus engine.

§relay: R

Relay for the consensus engine.

§reporter: F

Reporter for the consensus engine.

Activity is exported for every tracked view, including votes that arrive up to view_retention views below the highest finalized view; votes below that window are dropped without being reported. Reported votes are not guaranteed to be verified (see crate::simplex::types::Activity). Consider wrapping with crate::simplex::scheme::reporter::AttributableReporter to automatically filter and verify activities based on scheme attributability.

Locally constructed votes are exported only after their journal entries are durable. Network votes are not persisted, so an equivocating sender may have different votes exported before and after a restart.

§track_historical_votes: bool

Track individual votes after certification.

By default, full vote evidence is released when the corresponding certificate is constructed or received, making later conflict reporting and peer blocking best effort. Enabling this retains each recorded vote until its round is pruned, increasing memory usage.

§strategy: T

Strategy for parallel operations.

§partition: String

Partition for the consensus engine.

§mailbox_size: NonZeroUsize

Maximum number of messages to buffer on channels inside the consensus engine before blocking.

§epoch: Epoch

Epoch for the consensus engine. Each running engine should have a unique epoch.

§floor: Floor<S, D>

Certified root for the consensus engine.

§replay_buffer: NonZeroUsize

Number of bytes to buffer when replaying during startup.

§write_buffer: NonZeroUsize

The size of the write buffer to use for each blob in the journal.

§page_cache: CacheRef

Page cache for the journal.

§leader_timeout: Duration

Amount of time to wait for a leader to propose a payload in a view.

§certification_timeout: Duration

Amount of time to wait for certification progress in a view before attempting to skip the view.

This timeout must be greater than the leader timeout.

§timeout_retry: Duration

Amount of time to wait before retrying a nullify broadcast if stuck in a view.

§view_retention: ViewDelta

Number of views behind the finalized tip to track (in memory and in the journal) for recent activity.

§skip: SkipPolicy

Policy governing whether nullify(v) may be broadcast before the normal round deadlines.

§fetch_timeout: Duration

Timeout to wait for a peer to respond to a request.

§forward: ForwardPolicy

Policy for proactively forwarding blocks when entering the next view.

Implementations§

Source§

impl<S: Scheme, L: Config<S>, B: Blocker<PublicKey = S::PublicKey>, D: Digest, A: CertifiableAutomaton<Context = Context<D, S::PublicKey>>, R: Relay, F: Reporter<Activity = Activity<S, D>>, T: Strategy> Config<S, L, B, D, A, R, F, T>

Source

pub fn assert<Rng>(&self, rng: &mut Rng)
where Rng: CryptoRng, S: Scheme<D>,

Assert enforces that all configuration values are valid.

The RNG is used to verify finalized floor certificates.

Auto Trait Implementations§

§

impl<S, L, B, D, A, R, F, T> !RefUnwindSafe for Config<S, L, B, D, A, R, F, T>

§

impl<S, L, B, D, A, R, F, T> !UnwindSafe for Config<S, L, B, D, A, R, F, T>

§

impl<S, L, B, D, A, R, F, T> Freeze for Config<S, L, B, D, A, R, F, T>
where S: Freeze, L: Freeze, B: Freeze, A: Freeze, R: Freeze, F: Freeze, T: Freeze, Floor<S, D>: Freeze,

§

impl<S, L, B, D, A, R, F, T> Send for Config<S, L, B, D, A, R, F, T>
where Floor<S, D>: Send,

§

impl<S, L, B, D, A, R, F, T> Sync for Config<S, L, B, D, A, R, F, T>
where L: Sync, B: Sync, A: Sync, R: Sync, F: Sync, Floor<S, D>: Sync,

§

impl<S, L, B, D, A, R, F, T> Unpin for Config<S, L, B, D, A, R, F, T>
where S: Unpin, L: Unpin, B: Unpin, A: Unpin, R: Unpin, F: Unpin, T: Unpin, Floor<S, D>: Unpin,

§

impl<S, L, B, D, A, R, F, T> UnsafeUnpin for Config<S, L, B, D, A, R, F, T>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FutureExt for T

Source§

fn with_context(self, otel_cx: Context) -> WithContext<Self>

Attaches the provided Context to this type, returning a WithContext wrapper. Read more
Source§

fn with_current_context(self) -> WithContext<Self>

Attaches the current Context to this type, returning a WithContext wrapper. Read more
Source§

impl<A, B, T> HttpServerConnExec<A, B> for T
where B: Body,

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> Threaded<T> for T

Source§

type Rest = ()

The outputs beyond the threaded value.
Source§

fn split(self) -> (T, ())

Splits into the threaded value and the extra outputs.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more