pub struct Marshaled<E, A, B, C, H, Z, S, ES>where
E: Rng + Storage + Spawner + Metrics + Clock,
A: Application<E>,
B: CertifiableBlock<Context = Context<Commitment, <Z::Scheme as Verifier>::PublicKey>>,
C: CodingScheme,
H: Hasher,
Z: Provider<Scope = Epoch, Scheme: Scheme<Commitment>>,
S: Strategy,
ES: Epocher,{ /* private fields */ }Expand description
An Application adapter that handles epoch transitions and erasure coded broadcast.
This wrapper intercepts consensus operations to enforce epoch boundaries. It prevents blocks from being produced outside their valid epoch and handles the special case of re-proposing boundary blocks during epoch transitions.
Implementations§
Source§impl<E, A, B, C, H, Z, S, ES> Marshaled<E, A, B, C, H, Z, S, ES>where
E: Rng + Storage + Spawner + Metrics + Clock,
A: Application<E, Block = B, SigningScheme = Z::Scheme, Context = Context<Commitment, <Z::Scheme as Verifier>::PublicKey>>,
B: CertifiableBlock<Context = <A as Application<E>>::Context>,
C: CodingScheme,
H: Hasher,
Z: Provider<Scope = Epoch, Scheme: Scheme<Commitment>>,
S: Strategy,
ES: Epocher,
impl<E, A, B, C, H, Z, S, ES> Marshaled<E, A, B, C, H, Z, S, ES>where
E: Rng + Storage + Spawner + Metrics + Clock,
A: Application<E, Block = B, SigningScheme = Z::Scheme, Context = Context<Commitment, <Z::Scheme as Verifier>::PublicKey>>,
B: CertifiableBlock<Context = <A as Application<E>>::Context>,
C: CodingScheme,
H: Hasher,
Z: Provider<Scope = Epoch, Scheme: Scheme<Commitment>>,
S: Strategy,
ES: Epocher,
Sourcepub fn new(context: E, cfg: MarshaledConfig<A, B, C, H, Z, S, ES>) -> Self
pub fn new(context: E, cfg: MarshaledConfig<A, B, C, H, Z, S, ES>) -> Self
Trait Implementations§
Source§impl<E, A, B, C, H, Z, S, ES> Automaton for Marshaled<E, A, B, C, H, Z, S, ES>where
E: Rng + Storage + Spawner + Metrics + Clock,
A: Application<E, Block = B, SigningScheme = Z::Scheme, Context = Context<Commitment, <Z::Scheme as Verifier>::PublicKey>>,
B: CertifiableBlock<Context = <A as Application<E>>::Context>,
C: CodingScheme,
H: Hasher,
Z: Provider<Scope = Epoch, Scheme: Scheme<Commitment>>,
S: Strategy,
ES: Epocher,
impl<E, A, B, C, H, Z, S, ES> Automaton for Marshaled<E, A, B, C, H, Z, S, ES>where
E: Rng + Storage + Spawner + Metrics + Clock,
A: Application<E, Block = B, SigningScheme = Z::Scheme, Context = Context<Commitment, <Z::Scheme as Verifier>::PublicKey>>,
B: CertifiableBlock<Context = <A as Application<E>>::Context>,
C: CodingScheme,
H: Hasher,
Z: Provider<Scope = Epoch, Scheme: Scheme<Commitment>>,
S: Strategy,
ES: Epocher,
Source§async fn propose(
&mut self,
consensus_context: Context<Commitment, <Z::Scheme as Verifier>::PublicKey>,
) -> Receiver<Self::Digest>
async fn propose( &mut self, consensus_context: Context<Commitment, <Z::Scheme as Verifier>::PublicKey>, ) -> Receiver<Self::Digest>
Proposes a new block or re-proposes the epoch boundary block.
This method builds a new block from the underlying application unless the parent block is the last block in the current epoch. When at an epoch boundary, it re-proposes the boundary block to avoid creating blocks that would be invalidated by the epoch transition.
The proposal operation is spawned in a background task and returns a receiver that will
contain the proposed block’s commitment when ready. The block is staged before the
commitment is delivered and handed to marshal when consensus requests the relay
broadcast, which persists it after the shards are sent. The resulting sync handle is
awaited only at certification so it overlaps consensus voting. The commitment does not
imply durability on its own. CertifiableAutomaton::certify awaits the registered
certification gate before the finalize vote.
Source§async fn verify(
&mut self,
consensus_context: Context<Self::Digest, <Z::Scheme as Verifier>::PublicKey>,
payload: Self::Digest,
) -> Receiver<bool>
async fn verify( &mut self, consensus_context: Context<Self::Digest, <Z::Scheme as Verifier>::PublicKey>, payload: Self::Digest, ) -> Receiver<bool>
Verifies a received shard for a given round.
This method validates that:
- The coding configuration matches the expected configuration for the current scheme.
- The commitment’s context digest matches the consensus context (unless this is a re-proposal).
- The shard is contained within the consensus commitment.
Verification is spawned in a background task and returns a receiver that will contain the verification result. Additionally, this method kicks off deferred verification to start block verification early (hidden behind shard validity and network latency).
Source§type Digest = Commitment
type Digest = Commitment
Source§impl<E, A, B, C, H, Z, S, ES> CertifiableAutomaton for Marshaled<E, A, B, C, H, Z, S, ES>where
E: Rng + Storage + Spawner + Metrics + Clock,
A: Application<E, Block = B, SigningScheme = Z::Scheme, Context = Context<Commitment, <Z::Scheme as Verifier>::PublicKey>>,
B: CertifiableBlock<Context = <A as Application<E>>::Context>,
C: CodingScheme,
H: Hasher,
Z: Provider<Scope = Epoch, Scheme: Scheme<Commitment>>,
S: Strategy,
ES: Epocher,
impl<E, A, B, C, H, Z, S, ES> CertifiableAutomaton for Marshaled<E, A, B, C, H, Z, S, ES>where
E: Rng + Storage + Spawner + Metrics + Clock,
A: Application<E, Block = B, SigningScheme = Z::Scheme, Context = Context<Commitment, <Z::Scheme as Verifier>::PublicKey>>,
B: CertifiableBlock<Context = <A as Application<E>>::Context>,
C: CodingScheme,
H: Hasher,
Z: Provider<Scope = Epoch, Scheme: Scheme<Commitment>>,
S: Strategy,
ES: Epocher,
Source§impl<E, A, B, C, H, Z, S, ES> Clone for Marshaled<E, A, B, C, H, Z, S, ES>where
E: Rng + Storage + Spawner + Metrics + Clock,
A: Application<E>,
B: CertifiableBlock<Context = Context<Commitment, <Z::Scheme as Verifier>::PublicKey>>,
C: CodingScheme,
H: Hasher,
Z: Provider<Scope = Epoch, Scheme: Scheme<Commitment>>,
S: Strategy,
ES: Epocher,
impl<E, A, B, C, H, Z, S, ES> Clone for Marshaled<E, A, B, C, H, Z, S, ES>where
E: Rng + Storage + Spawner + Metrics + Clock,
A: Application<E>,
B: CertifiableBlock<Context = Context<Commitment, <Z::Scheme as Verifier>::PublicKey>>,
C: CodingScheme,
H: Hasher,
Z: Provider<Scope = Epoch, Scheme: Scheme<Commitment>>,
S: Strategy,
ES: Epocher,
Source§impl<E, A, B, C, H, Z, S, ES> Relay for Marshaled<E, A, B, C, H, Z, S, ES>where
E: Rng + Storage + Spawner + Metrics + Clock,
A: Application<E, Block = B, Context = Context<Commitment, <Z::Scheme as Verifier>::PublicKey>>,
B: CertifiableBlock<Context = <A as Application<E>>::Context>,
C: CodingScheme,
H: Hasher,
Z: Provider<Scope = Epoch, Scheme: Scheme<Commitment>>,
S: Strategy,
ES: Epocher,
impl<E, A, B, C, H, Z, S, ES> Relay for Marshaled<E, A, B, C, H, Z, S, ES>where
E: Rng + Storage + Spawner + Metrics + Clock,
A: Application<E, Block = B, Context = Context<Commitment, <Z::Scheme as Verifier>::PublicKey>>,
B: CertifiableBlock<Context = <A as Application<E>>::Context>,
C: CodingScheme,
H: Hasher,
Z: Provider<Scope = Epoch, Scheme: Scheme<Commitment>>,
S: Strategy,
ES: Epocher,
Source§type Digest = Commitment
type Digest = Commitment
Source§type PublicKey = <<Z as Provider>::Scheme as Verifier>::PublicKey
type PublicKey = <<Z as Provider>::Scheme as Verifier>::PublicKey
Source§impl<E, A, B, C, H, Z, S, ES> Reporter for Marshaled<E, A, B, C, H, Z, S, ES>where
E: Rng + Storage + Spawner + Metrics + Clock,
A: Application<E, Block = B, Context = Context<Commitment, <Z::Scheme as Verifier>::PublicKey>> + Reporter<Activity = Update<B>>,
B: CertifiableBlock<Context = <A as Application<E>>::Context>,
C: CodingScheme,
H: Hasher,
Z: Provider<Scope = Epoch, Scheme: Scheme<Commitment>>,
S: Strategy,
ES: Epocher,
impl<E, A, B, C, H, Z, S, ES> Reporter for Marshaled<E, A, B, C, H, Z, S, ES>where
E: Rng + Storage + Spawner + Metrics + Clock,
A: Application<E, Block = B, Context = Context<Commitment, <Z::Scheme as Verifier>::PublicKey>> + Reporter<Activity = Update<B>>,
B: CertifiableBlock<Context = <A as Application<E>>::Context>,
C: CodingScheme,
H: Hasher,
Z: Provider<Scope = Epoch, Scheme: Scheme<Commitment>>,
S: Strategy,
ES: Epocher,
Auto Trait Implementations§
impl<E, A, B, C, H, Z, S, ES> !RefUnwindSafe for Marshaled<E, A, B, C, H, Z, S, ES>
impl<E, A, B, C, H, Z, S, ES> !UnwindSafe for Marshaled<E, A, B, C, H, Z, S, ES>
impl<E, A, B, C, H, Z, S, ES> Freeze for Marshaled<E, A, B, C, H, Z, S, ES>
impl<E, A, B, C, H, Z, S, ES> Send for Marshaled<E, A, B, C, H, Z, S, ES>
impl<E, A, B, C, H, Z, S, ES> Sync for Marshaled<E, A, B, C, H, Z, S, ES>
impl<E, A, B, C, H, Z, S, ES> Unpin for Marshaled<E, A, B, C, H, Z, S, ES>
impl<E, A, B, C, H, Z, S, ES> UnsafeUnpin for Marshaled<E, A, B, C, H, Z, S, ES>where
<Z as Provider>::Scheme: for<'a> Sized,
A: UnsafeUnpin,
Z: UnsafeUnpin,
ES: UnsafeUnpin,
S: UnsafeUnpin,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
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