pub trait ConstraintChecker: Debug + Encode + Decode + Clone {
type Error: Debug;
// Required methods
fn check(
&self,
input_data: &[DynamicallyTypedData],
evicted_input_data: &[DynamicallyTypedData],
peek_data: &[DynamicallyTypedData],
output_data: &[DynamicallyTypedData]
) -> Result<TransactionPriority, Self::Error>;
fn is_inherent(&self) -> bool;
fn create_inherents<V: Verifier>(
authoring_inherent_data: &InherentData,
previous_inherents: Vec<(Transaction<V, Self>, H256)>
) -> Vec<Transaction<V, Self>>;
fn check_inherents<V: Verifier>(
importing_inherent_data: &InherentData,
inherents: Vec<Transaction<V, Self>>,
results: &mut CheckInherentsResult
);
fn genesis_transactions<V: Verifier>() -> Vec<Transaction<V, Self>>;
}
Expand description
The raw and fully powerful ConstraintChecker
interface used by the
Tuxedo Executive.
You should never manually manually implement this trait. If you are:
- Working on a simple non-inherent constraint checker -> Use the
SimpleConstraintChecker
trait instead and rely on its blanket implementation. - Working on an inherent constraint checker -> Implement
SimpleConstraintChecker
andInherentHooks
and use theInherentAdapter
wrapper type. - Considering an aggregate constraint checker that is part inherent, part not -> let the macro handle it for you.
If you are trying to implement some complex inherent logic that requires the interaction of multiple inherents, or features a variable number of inherents in each block, you might be able to express it by implementing this trait, but such designs are probably too complicated. Think long and hard before implementing this trait directly.
Required Associated Types§
Required Methods§
sourcefn check(
&self,
input_data: &[DynamicallyTypedData],
evicted_input_data: &[DynamicallyTypedData],
peek_data: &[DynamicallyTypedData],
output_data: &[DynamicallyTypedData]
) -> Result<TransactionPriority, Self::Error>
fn check( &self, input_data: &[DynamicallyTypedData], evicted_input_data: &[DynamicallyTypedData], peek_data: &[DynamicallyTypedData], output_data: &[DynamicallyTypedData] ) -> Result<TransactionPriority, Self::Error>
The on chain logic that makes the final check for whether a transaction is valid.
sourcefn is_inherent(&self) -> bool
fn is_inherent(&self) -> bool
Tells whether this extrinsic is an inherent or not. If you return true here, you must provide the correct inherent hooks above.
sourcefn create_inherents<V: Verifier>(
authoring_inherent_data: &InherentData,
previous_inherents: Vec<(Transaction<V, Self>, H256)>
) -> Vec<Transaction<V, Self>>
fn create_inherents<V: Verifier>( authoring_inherent_data: &InherentData, previous_inherents: Vec<(Transaction<V, Self>, H256)> ) -> Vec<Transaction<V, Self>>
Create the inherent extrinsics to insert into a block that is being authored locally. The inherent data is supplied by the authoring node.
sourcefn check_inherents<V: Verifier>(
importing_inherent_data: &InherentData,
inherents: Vec<Transaction<V, Self>>,
results: &mut CheckInherentsResult
)
fn check_inherents<V: Verifier>( importing_inherent_data: &InherentData, inherents: Vec<Transaction<V, Self>>, results: &mut CheckInherentsResult )
Perform off-chain pre-execution checks on the inherents. The inherent data is supplied by the importing node. The inherent data available here is not necessarily the same as what is available at authoring time.
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 the inherents.