pub struct Engine<E: Clock + Rng + CryptoRng + Spawner + Storage + Metrics, S: Scheme<D>, L: Elector<S>, B: Blocker<PublicKey = S::PublicKey>, D: Digest, A: CertifiableAutomaton<Context = Context<D, S::PublicKey>, Digest = D>, R: Relay<Digest = D>, F: Reporter<Activity = Activity<S, D>>> { /* private fields */ }Expand description
Instance of simplex consensus engine.
Implementations§
Source§impl<E: Clock + Rng + CryptoRng + Spawner + Storage + Metrics, S: Scheme<D>, L: Elector<S>, B: Blocker<PublicKey = S::PublicKey>, D: Digest, A: CertifiableAutomaton<Context = Context<D, S::PublicKey>, Digest = D>, R: Relay<Digest = D>, F: Reporter<Activity = Activity<S, D>>> Engine<E, S, L, B, D, A, R, F>
impl<E: Clock + Rng + CryptoRng + Spawner + Storage + Metrics, S: Scheme<D>, L: Elector<S>, B: Blocker<PublicKey = S::PublicKey>, D: Digest, A: CertifiableAutomaton<Context = Context<D, S::PublicKey>, Digest = D>, R: Relay<Digest = D>, F: Reporter<Activity = Activity<S, D>>> Engine<E, S, L, B, D, A, R, F>
Sourcepub fn new(context: E, cfg: Config<S, L, B, D, A, R, F>) -> Self
pub fn new(context: E, cfg: Config<S, L, B, D, A, R, F>) -> Self
Create a new simplex consensus engine.
Sourcepub fn start(
self,
vote_network: (impl Sender<PublicKey = S::PublicKey>, impl Receiver<PublicKey = S::PublicKey>),
certificate_network: (impl Sender<PublicKey = S::PublicKey>, impl Receiver<PublicKey = S::PublicKey>),
resolver_network: (impl Sender<PublicKey = S::PublicKey>, impl Receiver<PublicKey = S::PublicKey>),
) -> Handle<()>
pub fn start( self, vote_network: (impl Sender<PublicKey = S::PublicKey>, impl Receiver<PublicKey = S::PublicKey>), certificate_network: (impl Sender<PublicKey = S::PublicKey>, impl Receiver<PublicKey = S::PublicKey>), resolver_network: (impl Sender<PublicKey = S::PublicKey>, impl Receiver<PublicKey = S::PublicKey>), ) -> Handle<()>
Start the simplex consensus engine.
This will also rebuild the state of the engine from provided Journal.
§Network Channels
The engine requires three separate network channels, each carrying votes or certificates to help drive the consensus engine.
§vote_network
Carries individual votes:
Notarize: Vote to notarize a proposalNullify: Vote to skip a viewFinalize: Vote to finalize a notarized proposal
These messages are sent to the batcher, which performs batch signature verification before forwarding valid votes to the voter for aggregation.
§certificate_network
Carries certificates:
Notarization: Proof that a proposal was notarizedNullification: Proof that a view was skippedFinalization: Proof that a proposal was finalized
Certificates are broadcast on this channel as soon as they are constructed
from collected votes. We separate this from the vote_network to optimistically
allow for certificate processing to short-circuit vote processing (if we receive
a certificate before processing pending votes, we can skip them).
§resolver_network
Used for request-response certificate fetching. When a node needs to catch up on a view it missed (e.g., to verify a proposal’s parent), it uses this channel to request certificates from peers. The resolver handles rate limiting, retries, and peer selection for these requests.
Auto Trait Implementations§
impl<E, S, L, B, D, A, R, F> Freeze for Engine<E, S, L, B, D, A, R, F>
impl<E, S, L, B, D, A, R, F> !RefUnwindSafe for Engine<E, S, L, B, D, A, R, F>
impl<E, S, L, B, D, A, R, F> Send for Engine<E, S, L, B, D, A, R, F>
impl<E, S, L, B, D, A, R, F> Sync for Engine<E, S, L, B, D, A, R, F>
impl<E, S, L, B, D, A, R, F> Unpin for Engine<E, S, L, B, D, A, R, F>
impl<E, S, L, B, D, A, R, F> !UnwindSafe for Engine<E, S, L, B, D, A, R, F>
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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