pub struct SessionExt<'r, 'l, S> { /* private fields */ }

Implementations

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>

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.

Similar to execute_entry_function, but it bypasses visibility checks

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.

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.

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.

Load a script and all of its types into cache

Load a module, a function, and all of its types into cache

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’

Trait Implementations

The resulting type after dereferencing.

Dereferences the value.

Mutably dereferences the value.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The alignment of pointer.

The type for initializers.

Initializes a with the given initializer. Read more

Dereferences the given pointer. Read more

Mutably dereferences the given pointer. Read more

Drops the object pointed to by the given pointer. Read more

Should always be Self

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more