Trait sov_modules_api::hooks::TxHooks
source · pub trait TxHooks {
type Context: Context;
// Required methods
fn pre_dispatch_tx_hook(
&self,
tx: &Transaction<Self::Context>,
working_set: &mut WorkingSet<<Self::Context as Spec>::Storage>
) -> Result<<Self::Context as Spec>::Address>;
fn post_dispatch_tx_hook(
&self,
tx: &Transaction<Self::Context>,
working_set: &mut WorkingSet<<Self::Context as Spec>::Storage>
) -> Result<()>;
}
Expand description
Hooks that execute within the StateTransitionFunction::apply_blob
function for each processed transaction.
Required Associated Types§
Required Methods§
sourcefn pre_dispatch_tx_hook(
&self,
tx: &Transaction<Self::Context>,
working_set: &mut WorkingSet<<Self::Context as Spec>::Storage>
) -> Result<<Self::Context as Spec>::Address>
fn pre_dispatch_tx_hook( &self, tx: &Transaction<Self::Context>, working_set: &mut WorkingSet<<Self::Context as Spec>::Storage> ) -> Result<<Self::Context as Spec>::Address>
Runs just before a transaction is dispatched to an appropriate module. TODO: Why does it return address? Does it implies that it should do signature verification. Can other code rely on that assumption?
sourcefn post_dispatch_tx_hook(
&self,
tx: &Transaction<Self::Context>,
working_set: &mut WorkingSet<<Self::Context as Spec>::Storage>
) -> Result<()>
fn post_dispatch_tx_hook( &self, tx: &Transaction<Self::Context>, working_set: &mut WorkingSet<<Self::Context as Spec>::Storage> ) -> Result<()>
Runs after the tx is dispatched to an appropriate module. IF this hook returns error rollup panics