Trait sp_consensus::Proposer
source · pub trait Proposer<B: BlockT> {
type Error: From<Error> + Error + 'static;
type Transaction: Default + Send + 'static;
type Proposal: Future<Output = Result<Proposal<B, Self::Transaction, Self::Proof>, Self::Error>> + Send + Unpin + 'static;
type ProofRecording: ProofRecording<Proof = Self::Proof> + Send + Sync + 'static;
type Proof: Send + Sync + 'static;
// Required method
fn propose(
self,
inherent_data: InherentData,
inherent_digests: Digest,
max_duration: Duration,
block_size_limit: Option<usize>
) -> Self::Proposal;
}
Expand description
Logic for a proposer.
This will encapsulate creation and evaluation of proposals at a specific block.
Proposers are generic over bits of “consensus data” which are engine-specific.
Required Associated Types§
sourcetype Error: From<Error> + Error + 'static
type Error: From<Error> + Error + 'static
Error type which can occur when proposing or evaluating.
sourcetype Transaction: Default + Send + 'static
type Transaction: Default + Send + 'static
The transaction type used by the backend.
sourcetype Proposal: Future<Output = Result<Proposal<B, Self::Transaction, Self::Proof>, Self::Error>> + Send + Unpin + 'static
type Proposal: Future<Output = Result<Proposal<B, Self::Transaction, Self::Proof>, Self::Error>> + Send + Unpin + 'static
Future that resolves to a committed proposal with an optional proof.
sourcetype ProofRecording: ProofRecording<Proof = Self::Proof> + Send + Sync + 'static
type ProofRecording: ProofRecording<Proof = Self::Proof> + Send + Sync + 'static
The supported proof recording by the implementator of this trait. See ProofRecording
for more information.
sourcetype Proof: Send + Sync + 'static
type Proof: Send + Sync + 'static
The proof type used by Self::ProofRecording
.
Required Methods§
sourcefn propose(
self,
inherent_data: InherentData,
inherent_digests: Digest,
max_duration: Duration,
block_size_limit: Option<usize>
) -> Self::Proposal
fn propose( self, inherent_data: InherentData, inherent_digests: Digest, max_duration: Duration, block_size_limit: Option<usize> ) -> Self::Proposal
Create a proposal.
Gets the inherent_data
and inherent_digests
as input for the proposal. Additionally
a maximum duration for building this proposal is given. If building the proposal takes
longer than this maximum, the proposal will be very likely discarded.
If block_size_limit
is given, the proposer should push transactions until the block size
limit is hit. Depending on the finalize_block
implementation of the runtime, it probably
incorporates other operations (that are happening after the block limit is hit). So,
when the block size estimation also includes a proof that is recorded alongside the block
production, the proof can still grow. This means that the block_size_limit
should not be
the hard limit of what is actually allowed.