Struct ethcore::engines::InstantSeal
source · [−]pub struct InstantSeal<M> { /* private fields */ }
Expand description
An engine which does not provide any consensus mechanism, just seals blocks internally. Only seals blocks which have transactions.
Implementations
sourceimpl<M> InstantSeal<M>
impl<M> InstantSeal<M>
sourcepub fn new(params: InstantSealParams, machine: M) -> Self
pub fn new(params: InstantSealParams, machine: M) -> Self
Returns new instance of InstantSeal over the given state machine.
Trait Implementations
sourceimpl<M: Machine> Engine<M> for InstantSeal<M>
impl<M: Machine> Engine<M> for InstantSeal<M>
sourcefn sealing_state(&self) -> SealingState
fn sealing_state(&self) -> SealingState
Returns the engine’s current sealing state.
sourcefn should_reseal_on_update(&self) -> bool
fn should_reseal_on_update(&self) -> bool
Called in miner.chain_new_blocks
if the engine wishes to update_sealing
after a block was recently sealed. Read more
sourcefn generate_seal(&self, block: &ExecutedBlock, _parent: &Header) -> Seal
fn generate_seal(&self, block: &ExecutedBlock, _parent: &Header) -> Seal
Attempt to seal the block internally. Read more
sourcefn verify_local_seal(&self, _header: &Header) -> Result<(), M::Error>
fn verify_local_seal(&self, _header: &Header) -> Result<(), M::Error>
Verify a locally-generated seal of a header. Read more
sourcefn open_block_header_timestamp(&self, parent_timestamp: u64) -> u64
fn open_block_header_timestamp(&self, parent_timestamp: u64) -> u64
Return a new open block header timestamp based on the parent timestamp.
sourcefn is_timestamp_valid(
&self,
header_timestamp: u64,
parent_timestamp: u64
) -> bool
fn is_timestamp_valid(
&self,
header_timestamp: u64,
parent_timestamp: u64
) -> bool
Check whether the parent timestamp is valid.
sourcefn fork_choice(
&self,
new: &ExtendedHeader,
current: &ExtendedHeader
) -> ForkChoice
fn fork_choice(
&self,
new: &ExtendedHeader,
current: &ExtendedHeader
) -> ForkChoice
Check whether the given new block is the best block, after finalization check.
sourcefn seal_fields(&self, _header: &Header) -> usize
fn seal_fields(&self, _header: &Header) -> usize
The number of additional header fields required for this engine.
sourcefn extra_info(&self, _header: &Header) -> BTreeMap<String, String>
fn extra_info(&self, _header: &Header) -> BTreeMap<String, String>
Additional engine-specific information for the user/developer concerning header
.
sourcefn maximum_uncle_count(&self, _block: BlockNumber) -> usize
fn maximum_uncle_count(&self, _block: BlockNumber) -> usize
Maximum number of uncles a block is allowed to declare.
sourcefn maximum_gas_limit(&self) -> Option<U256>
fn maximum_gas_limit(&self) -> Option<U256>
Optional maximum gas limit.
sourcefn on_new_block(
&self,
_block: &mut ExecutedBlock,
_epoch_begin: bool,
_ancestry: &mut dyn Iterator<Item = ExtendedHeader>
) -> Result<(), M::Error>
fn on_new_block(
&self,
_block: &mut ExecutedBlock,
_epoch_begin: bool,
_ancestry: &mut dyn Iterator<Item = ExtendedHeader>
) -> Result<(), M::Error>
Block transformation functions, before the transactions.
epoch_begin
set to true if this block kicks off an epoch. Read more
sourcefn on_close_block(&self, _block: &mut ExecutedBlock) -> Result<(), M::Error>
fn on_close_block(&self, _block: &mut ExecutedBlock) -> Result<(), M::Error>
Block transformation functions, after the transactions.
sourcefn on_seal_block(&self, _block: &mut ExecutedBlock) -> Result<(), Error>
fn on_seal_block(&self, _block: &mut ExecutedBlock) -> Result<(), Error>
Allow mutating the header during seal generation. Currently only used by Clique.
sourcefn verify_block_basic(&self, _header: &Header) -> Result<(), M::Error>
fn verify_block_basic(&self, _header: &Header) -> Result<(), M::Error>
Phase 1 quick block verification. Only does checks that are cheap. Returns either a null Ok
or a general error detailing the problem with import.
The verification module can optionally avoid checking the seal (check_seal
), if seal verification is disabled this method won’t be called. Read more
sourcefn verify_block_unordered(&self, _header: &Header) -> Result<(), M::Error>
fn verify_block_unordered(&self, _header: &Header) -> Result<(), M::Error>
Phase 2 verification. Perform costly checks such as transaction signatures. Returns either a null Ok
or a general error detailing the problem with import.
The verification module can optionally avoid checking the seal (check_seal
), if seal verification is disabled this method won’t be called. Read more
sourcefn verify_block_family(
&self,
_header: &Header,
_parent: &Header
) -> Result<(), M::Error>
fn verify_block_family(
&self,
_header: &Header,
_parent: &Header
) -> Result<(), M::Error>
Phase 3 verification. Check block information against parent. Returns either a null Ok
or a general error detailing the problem with import.
sourcefn verify_block_external(&self, _header: &Header) -> Result<(), M::Error>
fn verify_block_external(&self, _header: &Header) -> Result<(), M::Error>
Phase 4 verification. Verify block header against potentially external data.
Should only be called when register_client
has been called previously. Read more
sourcefn genesis_epoch_data<'a>(
&self,
_header: &Header,
_state: &Call<'_>
) -> Result<Vec<u8>, String>
fn genesis_epoch_data<'a>(
&self,
_header: &Header,
_state: &Call<'_>
) -> Result<Vec<u8>, String>
Genesis epoch data.
sourcefn signals_epoch_end<'a>(
&self,
_header: &Header,
_aux: AuxiliaryData<'a>
) -> EpochChange<M>
fn signals_epoch_end<'a>(
&self,
_header: &Header,
_aux: AuxiliaryData<'a>
) -> EpochChange<M>
Whether an epoch change is signalled at the given header but will require finality.
If a change can be enacted immediately then return No
from this function but
Yes
from is_epoch_end
. Read more
sourcefn is_epoch_end(
&self,
_chain_head: &Header,
_finalized: &[H256],
_chain: &Headers<'_, Header>,
_transition_store: &PendingTransitionStore<'_>
) -> Option<Vec<u8>>
fn is_epoch_end(
&self,
_chain_head: &Header,
_finalized: &[H256],
_chain: &Headers<'_, Header>,
_transition_store: &PendingTransitionStore<'_>
) -> Option<Vec<u8>>
Whether a block is the end of an epoch. Read more
sourcefn epoch_verifier<'a>(
&self,
_header: &Header,
_proof: &'a [u8]
) -> ConstructedVerifier<'a, M>
fn epoch_verifier<'a>(
&self,
_header: &Header,
_proof: &'a [u8]
) -> ConstructedVerifier<'a, M>
Create an epoch verifier from validation proof and a flag indicating whether finality is required. Read more
sourcefn populate_from_parent(&self, _header: &mut Header, _parent: &Header)
fn populate_from_parent(&self, _header: &mut Header, _parent: &Header)
Populate a header’s fields based on its parent’s header. Usually implements the chain scoring rule based on weight. Read more
sourcefn handle_message(&self, _message: &[u8]) -> Result<(), EngineError>
fn handle_message(&self, _message: &[u8]) -> Result<(), EngineError>
Handle any potential consensus messages; updating consensus state and potentially issuing a new one. Read more
sourcefn set_signer(&self, _signer: Option<Box<dyn EngineSigner>>)
fn set_signer(&self, _signer: Option<Box<dyn EngineSigner>>)
Register a component which signs consensus messages.
sourcefn is_allowed_to_seal(&self) -> bool
fn is_allowed_to_seal(&self) -> bool
Returns whether the current node is a validator and actually may seal a block if AuRa engine is used. Read more
sourcefn sign(&self, _hash: H256) -> Result<Signature, M::Error>
fn sign(&self, _hash: H256) -> Result<Signature, M::Error>
Sign using the EngineSigner, to be used for consensus tx signing.
sourcefn register_client(&self, _client: Weak<M::EngineClient>)
fn register_client(&self, _client: Weak<M::EngineClient>)
Add Client which can be used for sealing, potentially querying the state and sending messages.
sourcefn snapshot_components(&self) -> Option<Box<dyn SnapshotComponents>>
fn snapshot_components(&self) -> Option<Box<dyn SnapshotComponents>>
Create a factory for building snapshot chunks and restoring from them.
Returning None
indicates that this engine doesn’t support snapshot creation. Read more
sourcefn supports_warp(&self) -> bool
fn supports_warp(&self) -> bool
Whether this engine supports warp sync.
sourcefn ancestry_actions(
&self,
_header: &Header,
_ancestry: &mut dyn Iterator<Item = ExtendedHeader>
) -> Vec<AncestryAction>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
fn ancestry_actions(
&self,
_header: &Header,
_ancestry: &mut dyn Iterator<Item = ExtendedHeader>
) -> Vec<AncestryAction>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
A: Allocator,
the ancestry exists.
Returns author should used when executing tx’s for this block.
sourcefn generate_engine_transactions(
&self,
_block: &ExecutedBlock
) -> Result<Vec<SignedTransaction>, Error>
fn generate_engine_transactions(
&self,
_block: &ExecutedBlock
) -> Result<Vec<SignedTransaction>, Error>
Returns a list of transactions for a new block if we are the author. Read more
Auto Trait Implementations
impl<M> RefUnwindSafe for InstantSeal<M> where
M: RefUnwindSafe,
impl<M> Send for InstantSeal<M> where
M: Send,
impl<M> Sync for InstantSeal<M> where
M: Sync,
impl<M> Unpin for InstantSeal<M> where
M: Unpin,
impl<M> UnwindSafe for InstantSeal<M> where
M: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> EthEngine for T where
T: Engine<EthereumMachine>,
impl<T> EthEngine for T where
T: Engine<EthereumMachine>,
sourcefn params(&self) -> &CommonParams
fn params(&self) -> &CommonParams
Get the general parameters of the chain.
sourcefn schedule(&self, block_number: BlockNumber) -> Schedule
fn schedule(&self, block_number: BlockNumber) -> Schedule
Get the EVM schedule for the given block number.
sourcefn builtin(&self, a: &Address, block_number: BlockNumber) -> Option<&Builtin>
fn builtin(&self, a: &Address, block_number: BlockNumber) -> Option<&Builtin>
Attempt to get a handle to a built-in contract. Only returns references to activated built-ins. Read more
sourcefn maximum_extra_data_size(&self) -> usize
fn maximum_extra_data_size(&self) -> usize
Some intrinsic operation parameters; by default they take their value from the spec()
’s engine_params
.
sourcefn account_start_nonce(&self, block: BlockNumber) -> U256
fn account_start_nonce(&self, block: BlockNumber) -> U256
The nonce with which accounts begin at given block.
sourcefn signing_chain_id(&self, env_info: &EnvInfo) -> Option<u64>
fn signing_chain_id(&self, env_info: &EnvInfo) -> Option<u64>
The network ID that transactions should be signed with.
sourcefn create_address_scheme(&self, number: BlockNumber) -> CreateContractAddress
fn create_address_scheme(&self, number: BlockNumber) -> CreateContractAddress
Returns new contract address generation scheme at given block number.
sourcefn verify_transaction_unordered(
&self,
t: UnverifiedTransaction,
header: &Header
) -> Result<SignedTransaction, Error>
fn verify_transaction_unordered(
&self,
t: UnverifiedTransaction,
header: &Header
) -> Result<SignedTransaction, Error>
Unordered verification doesn’t rely on the transaction execution order, i.e. it should only verify stuff that doesn’t assume any previous transactions has already been verified and executed. Read more
sourcefn verify_transaction_basic(
&self,
t: &UnverifiedTransaction,
header: &Header
) -> Result<(), Error>
fn verify_transaction_basic(
&self,
t: &UnverifiedTransaction,
header: &Header
) -> Result<(), Error>
Perform basic/cheap transaction verification. Read more
sourcefn additional_params(&self) -> HashMap<String, String>
fn additional_params(&self) -> HashMap<String, String>
Additional information.
sourcefn decode_transaction(
&self,
transaction: &[u8],
best_block_number: BlockNumber
) -> Result<UnverifiedTransaction, Error>
fn decode_transaction(
&self,
transaction: &[u8],
best_block_number: BlockNumber
) -> Result<UnverifiedTransaction, Error>
Performs pre-validation of RLP decoded transaction before other processing
sourcefn calculate_base_fee(&self, parent: &Header) -> Option<U256>
fn calculate_base_fee(&self, parent: &Header) -> Option<U256>
Calculates base fee for the block that should be mined next. This base fee is calculated based on the parent header (last block in blockchain / best block). Read more
sourcefn min_gas_limit(&self) -> U256
fn min_gas_limit(&self) -> U256
The configured minimum gas limit. Used by AuRa Engine.
sourcefn allow_non_eoa_sender(&self, best_block_number: BlockNumber) -> bool
fn allow_non_eoa_sender(&self, best_block_number: BlockNumber) -> bool
Returns whether transactions from non externally owned accounts (EOA) are allowed in the given block number (see EIP-3607). Read more