pub struct DiemVM(_);
Implementations§
source§impl DiemVM
impl DiemVM
pub fn new<S: StateView>(state: &S) -> Self
pub fn new_for_validation<S: StateView>(state: &S) -> Self
pub fn init_with_config( version: DiemVersion, on_chain_config: VMConfig, publishing_option: VMPublishingOption ) -> Self
pub fn internals(&self) -> DiemVMInternals<'_>
sourcepub fn failed_transaction_cleanup<S: MoveResolver>(
&self,
error_code: VMStatus,
gas_status: &mut GasStatus<'_>,
txn_data: &TransactionMetadata,
storage: &S,
account_currency_symbol: &IdentStr,
log_context: &AdapterLogSchema
) -> TransactionOutput
pub fn failed_transaction_cleanup<S: MoveResolver>( &self, error_code: VMStatus, gas_status: &mut GasStatus<'_>, txn_data: &TransactionMetadata, storage: &S, account_currency_symbol: &IdentStr, log_context: &AdapterLogSchema ) -> TransactionOutput
Generates a transaction output for a transaction that encountered errors during the execution process. This is public for now only for tests.
pub fn execute_writeset_transaction<S: MoveResolver + StateView>( &self, storage: &S, writeset_payload: &WriteSetPayload, txn_data: TransactionMetadata, log_context: &AdapterLogSchema ) -> Result<(VMStatus, TransactionOutput), VMStatus>
sourcepub fn execute_block_and_keep_vm_status(
transactions: Vec<Transaction>,
state_view: &dyn StateView
) -> Result<Vec<(VMStatus, TransactionOutput)>, VMStatus>
pub fn execute_block_and_keep_vm_status( transactions: Vec<Transaction>, state_view: &dyn StateView ) -> Result<Vec<(VMStatus, TransactionOutput)>, VMStatus>
Alternate form of ‘execute_block’ that keeps the vm_status before it goes into the
TransactionOutput
Trait Implementations§
source§impl VMExecutor for DiemVM
impl VMExecutor for DiemVM
source§fn execute_block(
transactions: Vec<Transaction>,
state_view: &dyn StateView
) -> Result<Vec<TransactionOutput>, VMStatus>
fn execute_block( transactions: Vec<Transaction>, state_view: &dyn StateView ) -> Result<Vec<TransactionOutput>, VMStatus>
Execute a block of transactions
. The output vector will have the exact same length as the
input vector. The discarded transactions will be marked as TransactionStatus::Discard
and
have an empty WriteSet
. Also state_view
is immutable, and does not have interior
mutability. Writes to be applied to the data view are encoded in the write set part of a
transaction output.
source§impl VMValidator for DiemVM
impl VMValidator for DiemVM
source§fn validate_transaction(
&self,
transaction: SignedTransaction,
state_view: &dyn StateView
) -> VMValidatorResult
fn validate_transaction( &self, transaction: SignedTransaction, state_view: &dyn StateView ) -> VMValidatorResult
Determine if a transaction is valid. Will return None
if the transaction is accepted,
Some(Err)
if the VM rejects it, with Err
as an error code. Verification performs the
following steps:
- The signature on the
SignedTransaction
matches the public key included in the transaction - The script to be executed is under given specific configuration.
- Invokes
DiemAccount.prologue
, which checks properties such as the transaction has the right sequence number and the sender has enough balance to pay for the gas. TBD: - Transaction arguments matches the main function’s type signature. We don’t check this item for now and would execute the check at execution time.