Struct aptos_vm::move_vm_ext::SessionExt
source · [−]pub struct SessionExt<'r, 'l, S> { /* private fields */ }
Implementations
sourceimpl<'r, 'l, S> SessionExt<'r, 'l, S> where
S: MoveResolverExt,
impl<'r, 'l, S> SessionExt<'r, 'l, S> where
S: MoveResolverExt,
pub fn new(inner: Session<'r, 'l, S>) -> Self
pub fn finish(self) -> VMResult<SessionOutput>
Methods from Deref<Target = Session<'r, 'l, S>>
pub fn execute_entry_function(
&mut self,
module: &ModuleId,
function_name: &IdentStr,
ty_args: Vec<TypeTag, Global>,
args: Vec<impl Borrow<[u8]>, Global>,
gas_status: &mut GasStatus<'_>
) -> Result<SerializedReturnValues, VMError>
pub fn execute_entry_function(
&mut self,
module: &ModuleId,
function_name: &IdentStr,
ty_args: Vec<TypeTag, Global>,
args: Vec<impl Borrow<[u8]>, Global>,
gas_status: &mut GasStatus<'_>
) -> Result<SerializedReturnValues, VMError>
Execute a Move function with the given arguments. This is mainly designed for an external environment to invoke system logic written in Move.
NOTE: There are NO checks on the args
except that they can deserialize into the provided
types.
The ability to deserialize args
into arbitrary types is very powerful, e.g. it can
used to manufacture signer
’s or Coin
’s from raw bytes. It is the responsibility of the
caller (e.g. adapter) to ensure that this power is used responsibly/securely for its
use-case.
The caller MUST ensure
- All types and modules referred to by the type arguments exist.
- The signature is valid for the rules of the adapter
The Move VM MUST return an invariant violation if the caller fails to follow any of the rules above.
The VM will check that the function has public(script) visibility.
Currently if any other error occurs during execution, the Move VM will simply propagate that error back to the outer environment without handling/translating it. This behavior may be revised in the future.
In case an invariant violation occurs, the whole Session should be considered corrupted and one shall not proceed with effect generation.
pub fn execute_function_bypass_visibility(
&mut self,
module: &ModuleId,
function_name: &IdentStr,
ty_args: Vec<TypeTag, Global>,
args: Vec<impl Borrow<[u8]>, Global>,
gas_status: &mut GasStatus<'_>
) -> Result<SerializedReturnValues, VMError>
pub fn execute_function_bypass_visibility(
&mut self,
module: &ModuleId,
function_name: &IdentStr,
ty_args: Vec<TypeTag, Global>,
args: Vec<impl Borrow<[u8]>, Global>,
gas_status: &mut GasStatus<'_>
) -> Result<SerializedReturnValues, VMError>
Similar to execute_entry_function, but it bypasses visibility checks
pub fn execute_script(
&mut self,
script: impl Borrow<[u8]>,
ty_args: Vec<TypeTag, Global>,
args: Vec<impl Borrow<[u8]>, Global>,
gas_status: &mut GasStatus<'_>
) -> Result<SerializedReturnValues, VMError>
pub fn execute_script(
&mut self,
script: impl Borrow<[u8]>,
ty_args: Vec<TypeTag, Global>,
args: Vec<impl Borrow<[u8]>, Global>,
gas_status: &mut GasStatus<'_>
) -> Result<SerializedReturnValues, VMError>
Execute a transaction script.
The Move VM MUST return a user error (in other words, an error that’s not an invariant violation) if
- The script fails to deserialize or verify. Not all expressible signatures are valid.
See
move_bytecode_verifier::script_signature
for the rules. - Type arguments refer to a non-existent type.
- Arguments (senders included) fail to deserialize or fail to match the signature of the script function.
If any other error occurs during execution, the Move VM MUST propagate that error back to the caller. Besides, no user input should cause the Move VM to return an invariant violation.
In case an invariant violation occurs, the whole Session should be considered corrupted and one shall not proceed with effect generation.
pub fn publish_module(
&mut self,
module: Vec<u8, Global>,
sender: AccountAddress,
gas_status: &mut GasStatus<'_>
) -> Result<(), VMError>
pub fn publish_module(
&mut self,
module: Vec<u8, Global>,
sender: AccountAddress,
gas_status: &mut GasStatus<'_>
) -> Result<(), VMError>
Publish the given module.
The Move VM MUST return a user error, i.e., an error that’s not an invariant violation, if
- The module fails to deserialize or verify.
- The sender address does not match that of the module.
- (Republishing-only) the module to be updated is not backward compatible with the old module.
- (Republishing-only) the module to be updated introduces cyclic dependencies.
The Move VM should not be able to produce other user errors. Besides, no user input should cause the Move VM to return an invariant violation.
In case an invariant violation occurs, the whole Session should be considered corrupted and one shall not proceed with effect generation.
pub fn publish_module_bundle(
&mut self,
modules: Vec<Vec<u8, Global>, Global>,
sender: AccountAddress,
gas_status: &mut GasStatus<'_>
) -> Result<(), VMError>
pub fn publish_module_bundle(
&mut self,
modules: Vec<Vec<u8, Global>, Global>,
sender: AccountAddress,
gas_status: &mut GasStatus<'_>
) -> Result<(), VMError>
Publish a series of modules.
The Move VM MUST return a user error, i.e., an error that’s not an invariant violation, if
any module fails to deserialize or verify (see the full list of failing conditions in the
publish_module
API). The publishing of the module series is an all-or-nothing action:
either all modules are published to the data store or none is.
Similar to the publish_module
API, the Move VM should not be able to produce other user
errors. Besides, no user input should cause the Move VM to return an invariant violation.
In case an invariant violation occurs, the whole Session should be considered corrupted and one shall not proceed with effect generation.
pub fn num_mutated_accounts(&self, sender: &AccountAddress) -> u64
pub fn load_script(
&self,
script: impl Borrow<[u8]>,
ty_args: Vec<TypeTag, Global>
) -> Result<LoadedFunctionInstantiation, VMError>
pub fn load_script(
&self,
script: impl Borrow<[u8]>,
ty_args: Vec<TypeTag, Global>
) -> Result<LoadedFunctionInstantiation, VMError>
Load a script and all of its types into cache
pub fn load_function(
&self,
module_id: &ModuleId,
function_name: &IdentStr,
type_arguments: &[TypeTag]
) -> Result<LoadedFunctionInstantiation, VMError>
pub fn load_function(
&self,
module_id: &ModuleId,
function_name: &IdentStr,
type_arguments: &[TypeTag]
) -> Result<LoadedFunctionInstantiation, VMError>
Load a module, a function, and all of its types into cache
pub fn load_type(&self, type_tag: &TypeTag) -> Result<Type, VMError>
pub fn get_type_layout(
&self,
type_tag: &TypeTag
) -> Result<MoveTypeLayout, VMError>
pub fn get_struct_type(
&self,
index: CachedStructIndex
) -> Option<Arc<StructType>>
pub fn get_struct_type(
&self,
index: CachedStructIndex
) -> Option<Arc<StructType>>
Fetch a struct type from cache, if the index is in bounds Helpful when paired with load_type, or any other API that returns ‘Type’
pub fn get_data_store(&mut self) -> &mut dyn DataStore
Trait Implementations
sourceimpl<'r, 'l, S> Deref for SessionExt<'r, 'l, S>
impl<'r, 'l, S> Deref for SessionExt<'r, 'l, S>
Auto Trait Implementations
impl<'r, 'l, S> !RefUnwindSafe for SessionExt<'r, 'l, S>
impl<'r, 'l, S> !Send for SessionExt<'r, 'l, S>
impl<'r, 'l, S> !Sync for SessionExt<'r, 'l, S>
impl<'r, 'l, S> Unpin for SessionExt<'r, 'l, S>
impl<'r, 'l, S> !UnwindSafe for SessionExt<'r, 'l, S>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<T> Pointable for T
impl<T> Pointable for T
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more