Trait tuxedo_core::inherents::InherentHooks
source · pub trait InherentHooks: SimpleConstraintChecker + Sized {
type Error: Encode + IsFatalError;
const INHERENT_IDENTIFIER: InherentIdentifier;
// Required methods
fn create_inherent<V: Verifier>(
authoring_inherent_data: &InherentData,
previous_inherent: (Transaction<V, Self>, H256)
) -> Transaction<V, Self>;
fn check_inherent<V>(
importing_inherent_data: &InherentData,
inherent: Transaction<V, Self>,
results: &mut CheckInherentsResult
);
// Provided method
fn genesis_transactions<V: Verifier>() -> Vec<Transaction<V, Self>> { ... }
}
Expand description
Tuxedo’s controlled interface around Substrate’s concept of inherents.
This interface assumes that each inherent will appear exactly once in each block. This will be verified off-chain by nodes before block execution begins.
This interface is stricter and more structured, and therefore simpler than FRAME’s.
If you need to do something more powerful (which you probably don’t) and you
understand exactly how Substrate’s block authoring and Tuxedo’s piece aggregation works
(which you probably don’t) you can directly implement the InherentInternal
trait
which is more powerful (and dangerous).
Required Associated Types§
Required Associated Constants§
const INHERENT_IDENTIFIER: InherentIdentifier
Required Methods§
sourcefn create_inherent<V: Verifier>(
authoring_inherent_data: &InherentData,
previous_inherent: (Transaction<V, Self>, H256)
) -> Transaction<V, Self>
fn create_inherent<V: Verifier>( authoring_inherent_data: &InherentData, previous_inherent: (Transaction<V, Self>, H256) ) -> Transaction<V, Self>
Create the inherent extrinsic to insert into a block that is being authored locally. The inherent data is supplied by the authoring node.
sourcefn check_inherent<V>(
importing_inherent_data: &InherentData,
inherent: Transaction<V, Self>,
results: &mut CheckInherentsResult
)
fn check_inherent<V>( importing_inherent_data: &InherentData, inherent: Transaction<V, Self>, results: &mut CheckInherentsResult )
Perform off-chain pre-execution checks on the inherent. The inherent data is supplied by the importing node. The inherent data available here is not guaranteed to be the same as what is available at authoring time.
Provided Methods§
sourcefn genesis_transactions<V: Verifier>() -> Vec<Transaction<V, Self>>
fn genesis_transactions<V: Verifier>() -> Vec<Transaction<V, Self>>
Return the genesis transactions that are required for this inherent.