pub struct NativeExecutor { /* private fields */ }
Implementations§
Source§impl NativeExecutor
impl NativeExecutor
Sourcepub fn new_storage_slots(&self) -> Result<Slots<'static>, ContractError>
pub fn new_storage_slots(&self) -> Result<Slots<'static>, ContractError>
Create a new Slots
instance with system contracts already deployed
Sourcepub fn builder(shard_index: ShardIndex) -> NativeExecutorBuilder
pub fn builder(shard_index: ShardIndex) -> NativeExecutorBuilder
Builder of native executor for specified shard index
Sourcepub fn transaction_verify(
&self,
transaction: Transaction<'_>,
slots: &Slots<'_>,
) -> Result<(), ContractError>
pub fn transaction_verify( &self, transaction: Transaction<'_>, slots: &Slots<'_>, ) -> Result<(), ContractError>
Verify the provided transaction.
Self::transaction_execute()
can be used for transaction execution if needed.
Self::transaction_verify_execute()
can be used to verify and execute a transaction with
a single call.
Sourcepub fn transaction_execute(
&self,
transaction: Transaction<'_>,
slots: &mut Slots<'_>,
) -> Result<(), ContractError>
pub fn transaction_execute( &self, transaction: Transaction<'_>, slots: &mut Slots<'_>, ) -> Result<(), ContractError>
Execute the previously verified transaction.
Self::transaction_verify()
must be used for verification.
Self::transaction_verify_execute()
can be used to verify and execute a transaction with
a single call.
Sourcepub fn transaction_verify_execute(
&self,
transaction: Transaction<'_>,
slots: &mut Slots<'_>,
) -> Result<(), ContractError>
pub fn transaction_verify_execute( &self, transaction: Transaction<'_>, slots: &mut Slots<'_>, ) -> Result<(), ContractError>
Verify and execute provided transaction.
A shortcut for Self::transaction_verify()
+ Self::transaction_execute()
.
Sourcepub fn transaction_emulate<Calls, T>(
&self,
contract: Address,
slots: &mut Slots<'_>,
calls: Calls,
) -> Option<T>
pub fn transaction_emulate<Calls, T>( &self, contract: Address, slots: &mut Slots<'_>, calls: Calls, ) -> Option<T>
Emulate a transaction submitted by contract
with method calls happening inside calls
without going through TxHandler
.
NOTE: This is primarily useful for testing environment, usually changes are done in the
transaction execution using Self::transaction_execute()
.
Returns None
if read-only Slots
instance was given.
Sourcepub fn with_env_ro<Callback, T>(
&self,
slots: &Slots<'_>,
callback: Callback,
) -> T
pub fn with_env_ro<Callback, T>( &self, slots: &Slots<'_>, callback: Callback, ) -> T
Get a read-only Env
instance for calling #[view]
methods on it directly.
For stateful methods, execute a transaction using Self::transaction_execute()
or
emulate one with Self::transaction_emulate()
.