pub fn exec_wasm_direct<R, T>(
        &self,
        module: Module,
        entry_point_name: &str,
        args: RuntimeArgs,
        account: &mut Account,
        authorization_keys: BTreeSet<AccountHash>,
        blocktime: BlockTime,
        deploy_hash: DeployHash,
        gas_limit: Gas,
        address_generator: Rc<RefCell<AddressGenerator>>,
        protocol_version: ProtocolVersion,
        correlation_id: CorrelationId,
        tracking_copy: Rc<RefCell<TrackingCopy<R>>>,
        phase: Phase,
        stack: RuntimeStack,
    ) -> Result<T, Error>
    where
        R: StateReader<Key, StoredValue>,
        R::Error: Into<Error>,
        T: FromBytes + CLTyped,
    {
        let mut named_keys: NamedKeys = account.named_keys().clone();
        let base_key = account.account_hash().into();

        let (instance, mut runtime) = self.create_runtime(
            module,
            EntryPointType::Session,
            args,
            &mut named_keys,
            Default::default(),
            base_key,
            account,
            authorization_keys,
            blocktime,
            deploy_hash,
            gas_limit,
            address_generator,
            protocol_version,
            correlation_id,
            tracking_copy,
            phase,
            stack,
        )?;

        let error: wasmi::Error = match instance.invoke_export(entry_point_name, &[], &mut runtime)
        {
            Err(error) => error,
            Ok(_) => {
                // This duplicates the behavior of runtime sub_call.
                // If `instance.invoke_export` returns `Ok` and the `host_buffer` is `None`, the
                // contract's execution succeeded but did not explicitly call `runtime::ret()`.
                // Treat as though the execution returned the unit type `()` as per Rust
                // functions which don't specify a return value.
                let result = runtime.take_host_buffer().unwrap_or(CLValue::from_t(())?);
                let ret = result.into_t()?;
                *account.named_keys_mut() = named_keys;
                return Ok(ret);
            }
        };

        let return_value: CLValue = match error
            .as_host_error()
            .and_then(|host_error| host_error.downcast_ref::<Error>())
        {
            Some(Error::Ret(_)) => runtime
                .take_host_buffer()
                .ok_or(Error::ExpectedReturnValue)?,
            Some(Error::Revert(code)) => return Err(Error::Revert(*code)),
            Some(error) => return Err(error.clone()),
            _ => return Err(Error::Interpreter(error.into())),
        };

        let ret = return_value.into_t()?;
        *account.named_keys_mut() = named_keys;
        Ok(ret)
    }
/// Used to execute arbitrary wasm; necessary for running system contract installers / upgraders
/// This is not meant to be used for executing system contracts.
Used to execute arbitrary wasm; necessary for running system contract installers / upgraders
This is not meant to be used for executing system contracts.
Used to execute arbitrary wasm ; necessary for running system contract installers / upgraders This is not meant to be used for executing system contracts .
pub fn exec_wasm_direct<R, T>(
        &self,
        module: Module,
        entry_point_name: &str,
        args: RuntimeArgs,
        account: &mut Account,
        authorization_keys: BTreeSet<AccountHash>,
        blocktime: BlockTime,
        deploy_hash: DeployHash,
        gas_limit: Gas,
        address_generator: Rc<RefCell<AddressGenerator>>,
        protocol_version: ProtocolVersion,
        correlation_id: CorrelationId,
        tracking_copy: Rc<RefCell<TrackingCopy<R>>>,
        phase: Phase,
        stack: RuntimeStack,
    ) -> Result<T, Error>
    where
        R: StateReader<Key, StoredValue>,
        R::Error: Into<Error>,
        T: FromBytes + CLTyped,
    {
        let mut named_keys: NamedKeys = account.named_keys().clone();
        let base_key = account.account_hash().into();
        let (instance, mut runtime) = self.create_runtime(
            module,
            EntryPointType::Session,
            args,
            &mut named_keys,
            Default::default(),
            base_key,
            account,
            authorization_keys,
            blocktime,
            deploy_hash,
            gas_limit,
            address_generator,
            protocol_version,
            correlation_id,
            tracking_copy,
            phase,
            stack,
        )?;
        let error: wasmi::Error = match instance.invoke_export(entry_point_name, &[], &mut runtime)
        {
            Err(error) => error,
            Ok(_) => {
                // This duplicates the behavior of runtime sub_call.
                // If `instance.invoke_export` returns `Ok` and the `host_buffer` is `None`, the
                // contract's execution succeeded but did not explicitly call `runtime::ret()`.
                // Treat as though the execution returned the unit type `()` as per Rust
                // functions which don't specify a return value.
                let result = runtime.take_host_buffer().unwrap_or(CLValue::from_t(())?);
                let ret = result.into_t()?;
                *account.named_keys_mut() = named_keys;
                return Ok(ret);
            }
        };
        let return_value: CLValue = match error
            .as_host_error()
            .and_then(|host_error| host_error.downcast_ref::<Error>())
        {
            Some(Error::Ret(_)) => runtime
                .take_host_buffer()
                .ok_or(Error::ExpectedReturnValue)?,
            Some(Error::Revert(code)) => return Err(Error::Revert(*code)),
            Some(error) => return Err(error.clone()),
            _ => return Err(Error::Interpreter(error.into())),
        };
        let ret = return_value.into_t()?;
        *account.named_keys_mut() = named_keys;
        Ok(ret)
    }
pub fn exec_wasm_direct < R , T > ( & self , module : Module , entry_point_name : & str , args : RuntimeArgs , account : & mut Account , authorization_keys : BTreeSet < AccountHash > , blocktime : BlockTime , deploy_hash : DeployHash , gas_limit : Gas , address_generator : Rc < RefCell < AddressGenerator > > , protocol_version : ProtocolVersion , correlation_id : CorrelationId , tracking_copy : Rc < RefCell < TrackingCopy < R > > > , phase : Phase , stack : RuntimeStack , ) -> Result < T , Error > where R : StateReader < Key , StoredValue > , R :: Error : Into < Error > , T : FromBytes + CLTyped , { let mut named_keys : NamedKeys = account . named_keys ( ) . clone ( ) ; let base_key = account . account_hash ( ) . into ( ) ; let ( instance , mut runtime ) = self . create_runtime ( module , EntryPointType :: Session , args , & mut named_keys , Default :: default ( ) , base_key , account , authorization_keys , blocktime , deploy_hash , gas_limit , address_generator , protocol_version , correlation_id , tracking_copy , phase , stack , ) ? ; let error : wasmi :: Error = match instance . invoke_export ( entry_point_name , & [ ] , & mut runtime ) { Err ( error ) => error , Ok ( _ ) => { // This duplicates the behavior of runtime sub_call. // If `instance.invoke_export` returns `Ok` and the `host_buffer` is `None`, the // contract's execution succeeded but did not explicitly call `runtime::ret()`. // Treat as though the execution returned the unit type `()` as per Rust // functions which don't specify a return value. let result = runtime . take_host_buffer ( ) . unwrap_or ( CLValue :: from_t ( ( ) ) ? ) ; let ret = result . into_t ( ) ? ; * account . named_keys_mut ( ) = named_keys ; return Ok ( ret ) ; } } ; let return_value : CLValue = match error . as_host_error ( ) . and_then ( | host_error | host_error . downcast_ref :: < Error > ( ) ) { Some ( Error :: Ret ( _ ) ) => runtime . take_host_buffer ( ) . ok_or ( Error :: ExpectedReturnValue ) ? , Some ( Error :: Revert ( code ) ) => return Err ( Error :: Revert ( * code ) ) , Some ( error ) => return Err ( error . clone ( ) ) , _ => return Err ( Error :: Interpreter ( error . into ( ) ) ) , } ; let ret = return_value . into_t ( ) ? ; * account . named_keys_mut ( ) = named_keys ; Ok ( ret ) }
Used to execute arbitrary wasm; necessary for running system contract installers / upgraders
This is not meant to be used for executing system contracts.
Used to execute arbitrary wasm ; necessary for running system contract installers / upgraders This is not meant to be used for executing system contracts .
&self
module
Module
entry_point_name
&str
args
RuntimeArgs
account
&mut Account
authorization_keys
BTreeSet<AccountHash>
blocktime
BlockTime
deploy_hash
DeployHash
gas_limit
Gas
address_generator
Rc<RefCell<AddressGenerator>>
protocol_version
ProtocolVersion
correlation_id
CorrelationId
tracking_copy
Rc<RefCell<TrackingCopy<R>>>
phase
Phase
stack
RuntimeStack
&self
module
Module
entry_point_name
&str
args
RuntimeArgs
account
&mut Account
authorization_keys
BTreeSet<AccountHash>
blocktime
BlockTime
deploy_hash
DeployHash
gas_limit
Gas
address_generator
Rc<RefCell<AddressGenerator>>
protocol_version
ProtocolVersion
correlation_id
CorrelationId
tracking_copy
Rc<RefCell<TrackingCopy<R>>>
phase
Phase
stack
RuntimeStack