pub struct NativeExecutor { /* private fields */ }
Implementations§
Source§impl NativeExecutor
impl NativeExecutor
Sourcepub fn new_storage_slots(&self) -> Result<Slots, ContractError>
pub fn new_storage_slots(&self) -> Result<Slots, 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,
) -> Twhere
Calls: FnOnce(&mut Env<'_>) -> T,
pub fn transaction_emulate<Calls, T>(
&self,
contract: Address,
slots: &mut Slots,
calls: Calls,
) -> Twhere
Calls: FnOnce(&mut Env<'_>) -> 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) -> Twhere
Callback: FnOnce(&Env<'_>) -> T,
pub fn with_env_ro<Callback, T>(&self, slots: &Slots, callback: Callback) -> Twhere
Callback: FnOnce(&Env<'_>) -> 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()
.