pub trait Application<E>:
Clone
+ Send
+ 'static{
type SigningScheme: Scheme;
type Context: Epochable;
type Block: Block;
// Required methods
fn propose(
&mut self,
context: (E, Self::Context),
ancestry: impl Ancestry<Self::Block>,
) -> impl Future<Output = Option<Self::Block>> + Send;
fn verify(
&mut self,
context: (E, Self::Context),
ancestry: impl Ancestry<Self::Block>,
) -> impl Future<Output = bool> + Send;
}Expand description
Application is a minimal interface for standard implementations that operate over a stream of epoched blocks.
Required Associated Types§
Sourcetype SigningScheme: Scheme
type SigningScheme: Scheme
The signing scheme used by the application.
Required Methods§
Sourcefn propose(
&mut self,
context: (E, Self::Context),
ancestry: impl Ancestry<Self::Block>,
) -> impl Future<Output = Option<Self::Block>> + Send
fn propose( &mut self, context: (E, Self::Context), ancestry: impl Ancestry<Self::Block>, ) -> impl Future<Output = Option<Self::Block>> + Send
Build a new block on top of the provided parent ancestry. If the build job fails, or the proposer’s slot should be skipped, the implementor should return None.
This future may be cancelled before it completes. Implementations must be cancellation-safe.
Sourcefn verify(
&mut self,
context: (E, Self::Context),
ancestry: impl Ancestry<Self::Block>,
) -> impl Future<Output = bool> + Send
fn verify( &mut self, context: (E, Self::Context), ancestry: impl Ancestry<Self::Block>, ) -> impl Future<Output = bool> + Send
Verify a block produced by the application’s proposer, relative to its ancestry.
This future should not resolve until the implementation can produce a stable verdict.
Return false only when the block is permanently invalid for the supplied context and
ancestry. If validity may still change as additional information becomes available,
continue waiting instead of returning false.
In other words, to abstain from voting, do not resolve this future yet. Keep it pending until the implementation can either prove the block valid, prove it invalid, or the consensus engine cancels the request. Abstaining is not represented by a special return value.
This future may be cancelled before it completes. Implementations must be cancellation-safe.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".