Struct sc_basic_authorship::ProposerFactory
source · pub struct ProposerFactory<A, B, C, PR> { /* private fields */ }Expand description
Proposer factory.
Implementations§
source§impl<A, B, C> ProposerFactory<A, B, C, DisableProofRecording>
impl<A, B, C> ProposerFactory<A, B, C, DisableProofRecording>
sourcepub fn new(
spawn_handle: impl SpawnNamed + 'static,
client: Arc<C>,
transaction_pool: Arc<A>,
prometheus: Option<&PrometheusRegistry>,
telemetry: Option<TelemetryHandle>
) -> Self
pub fn new( spawn_handle: impl SpawnNamed + 'static, client: Arc<C>, transaction_pool: Arc<A>, prometheus: Option<&PrometheusRegistry>, telemetry: Option<TelemetryHandle> ) -> Self
Create a new proposer factory.
Proof recording will be disabled when using proposers built by this instance to build blocks.
source§impl<A, B, C> ProposerFactory<A, B, C, EnableProofRecording>
impl<A, B, C> ProposerFactory<A, B, C, EnableProofRecording>
sourcepub fn with_proof_recording(
spawn_handle: impl SpawnNamed + 'static,
client: Arc<C>,
transaction_pool: Arc<A>,
prometheus: Option<&PrometheusRegistry>,
telemetry: Option<TelemetryHandle>
) -> Self
pub fn with_proof_recording( spawn_handle: impl SpawnNamed + 'static, client: Arc<C>, transaction_pool: Arc<A>, prometheus: Option<&PrometheusRegistry>, telemetry: Option<TelemetryHandle> ) -> Self
Create a new proposer factory with proof recording enabled.
Each proposer created by this instance will record a proof while building a block.
This will also include the proof into the estimation of the block size. This can be disabled
by calling ProposerFactory::disable_proof_in_block_size_estimation.
sourcepub fn disable_proof_in_block_size_estimation(&mut self)
pub fn disable_proof_in_block_size_estimation(&mut self)
Disable the proof inclusion when estimating the block size.
source§impl<A, B, C, PR> ProposerFactory<A, B, C, PR>
impl<A, B, C, PR> ProposerFactory<A, B, C, PR>
sourcepub fn set_default_block_size_limit(&mut self, limit: usize)
pub fn set_default_block_size_limit(&mut self, limit: usize)
Set the default block size limit in bytes.
The default value for the block size limit is:
DEFAULT_BLOCK_SIZE_LIMIT.
If there is no block size limit passed to [sp_consensus::Proposer::propose], this value
will be used.
sourcepub fn set_soft_deadline(&mut self, percent: Percent)
pub fn set_soft_deadline(&mut self, percent: Percent)
Set soft deadline percentage.
The value is used to compute soft deadline during block production.
The soft deadline indicates where we should stop attempting to add transactions
to the block, which exhaust resources. After soft deadline is reached,
we switch to a fixed-amount mode, in which after we see MAX_SKIPPED_TRANSACTIONS
transactions which exhaust resrouces, we will conclude that the block is full.
Setting the value too low will significantly limit the amount of transactions we try in case they exhaust resources. Setting the value too high can potentially open a DoS vector, where many “exhaust resources” transactions are being tried with no success, hence block producer ends up creating an empty block.
Trait Implementations§
source§impl<A, B, Block, C, PR> Environment<Block> for ProposerFactory<A, B, C, PR>where
A: TransactionPool<Block = Block> + 'static,
B: Backend<Block> + Send + Sync + 'static,
Block: BlockT,
C: BlockBuilderProvider<B, Block, C> + HeaderBackend<Block> + ProvideRuntimeApi<Block> + Send + Sync + 'static,
C::Api: ApiExt<Block> + BlockBuilderApi<Block>,
PR: ProofRecording,
impl<A, B, Block, C, PR> Environment<Block> for ProposerFactory<A, B, C, PR>where A: TransactionPool<Block = Block> + 'static, B: Backend<Block> + Send + Sync + 'static, Block: BlockT, C: BlockBuilderProvider<B, Block, C> + HeaderBackend<Block> + ProvideRuntimeApi<Block> + Send + Sync + 'static, C::Api: ApiExt<Block> + BlockBuilderApi<Block>, PR: ProofRecording,
§type CreateProposer = Ready<Result<<ProposerFactory<A, B, C, PR> as Environment<Block>>::Proposer, <ProposerFactory<A, B, C, PR> as Environment<Block>>::Error>>
type CreateProposer = Ready<Result<<ProposerFactory<A, B, C, PR> as Environment<Block>>::Proposer, <ProposerFactory<A, B, C, PR> as Environment<Block>>::Error>>
Auto Trait Implementations§
impl<A, B, C, PR> !RefUnwindSafe for ProposerFactory<A, B, C, PR>
impl<A, B, C, PR> Send for ProposerFactory<A, B, C, PR>where A: Send + Sync, B: Send, C: Send + Sync, PR: Send,
impl<A, B, C, PR> Sync for ProposerFactory<A, B, C, PR>where A: Send + Sync, B: Sync, C: Send + Sync, PR: Sync,
impl<A, B, C, PR> Unpin for ProposerFactory<A, B, C, PR>where B: Unpin, PR: Unpin,
impl<A, B, C, PR> !UnwindSafe for ProposerFactory<A, B, C, PR>
Blanket Implementations§
source§impl<T> CheckedConversion for T
impl<T> CheckedConversion for T
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, Outer> IsWrappedBy<Outer> for Twhere
Outer: AsRef<T> + AsMut<T> + From<T>,
T: From<Outer>,
impl<T, Outer> IsWrappedBy<Outer> for Twhere Outer: AsRef<T> + AsMut<T> + From<T>, T: From<Outer>,
§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<T> SaturatedConversion for T
impl<T> SaturatedConversion for T
source§fn saturated_from<T>(t: T) -> Selfwhere
Self: UniqueSaturatedFrom<T>,
fn saturated_from<T>(t: T) -> Selfwhere Self: UniqueSaturatedFrom<T>,
source§fn saturated_into<T>(self) -> Twhere
Self: UniqueSaturatedInto<T>,
fn saturated_into<T>(self) -> Twhere Self: UniqueSaturatedInto<T>,
T. Read moresource§impl<S, T> UncheckedInto<T> for Swhere
T: UncheckedFrom<S>,
impl<S, T> UncheckedInto<T> for Swhere T: UncheckedFrom<S>,
source§fn unchecked_into(self) -> T
fn unchecked_into(self) -> T
unchecked_from.source§impl<T, S> UniqueSaturatedInto<T> for Swhere
T: Bounded,
S: TryInto<T>,
impl<T, S> UniqueSaturatedInto<T> for Swhere T: Bounded, S: TryInto<T>,
source§fn unique_saturated_into(self) -> T
fn unique_saturated_into(self) -> T
T.