pub trait ExecutableTransaction<U: UpdatableState>: Sized {
// Required method
fn execute_raw(
&self,
state: &mut TransactionalState<'_, U>,
block_context: &BlockContext,
execution_flags: ExecutionFlags,
) -> TransactionExecutionResult<TransactionExecutionInfo>;
// Provided method
fn execute(
&self,
state: &mut U,
block_context: &BlockContext,
charge_fee: bool,
validate: bool,
) -> TransactionExecutionResult<TransactionExecutionInfo> { ... }
}Required Methods§
Sourcefn execute_raw(
&self,
state: &mut TransactionalState<'_, U>,
block_context: &BlockContext,
execution_flags: ExecutionFlags,
) -> TransactionExecutionResult<TransactionExecutionInfo>
fn execute_raw( &self, state: &mut TransactionalState<'_, U>, block_context: &BlockContext, execution_flags: ExecutionFlags, ) -> TransactionExecutionResult<TransactionExecutionInfo>
Note: In case of execution failure, the state may become corrupted. This means that
any changes made up to the point of failure will persist in the state. To revert these
changes, you should call state.abort(). Alternatively, consider using execute
for automatic handling of such cases.
Provided Methods§
Sourcefn execute(
&self,
state: &mut U,
block_context: &BlockContext,
charge_fee: bool,
validate: bool,
) -> TransactionExecutionResult<TransactionExecutionInfo>
fn execute( &self, state: &mut U, block_context: &BlockContext, charge_fee: bool, validate: bool, ) -> TransactionExecutionResult<TransactionExecutionInfo>
Executes the transaction in a transactional manner (if it fails, given state does not modify).
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.