referrerpolicy=no-referrer-when-downgrade

Trait pallet_revive::SyscallDoc

source ·
pub trait SyscallDoc {
Show 51 methods // Required methods fn noop(); fn set_storage( flags: u32, key_ptr: u32, key_len: u32, value_ptr: u32, value_len: u32, ) -> u32; fn clear_storage(flags: u32, key_ptr: u32, key_len: u32) -> u32; fn get_storage( flags: u32, key_ptr: u32, key_len: u32, out_ptr: u32, out_len_ptr: u32, ) -> ReturnErrorCode; fn contains_storage(flags: u32, key_ptr: u32, key_len: u32) -> u32; fn take_storage( flags: u32, key_ptr: u32, key_len: u32, out_ptr: u32, out_len_ptr: u32, ) -> ReturnErrorCode; fn call( flags: u32, callee_ptr: u32, ref_time_limit: u64, proof_size_limit: u64, deposit_ptr: u32, value_ptr: u32, input_data_ptr: u32, input_data_len: u32, output_ptr: u32, output_len_ptr: u32, ) -> ReturnErrorCode; fn delegate_call( flags: u32, address_ptr: u32, ref_time_limit: u64, proof_size_limit: u64, deposit_ptr: u32, input_data_ptr: u32, input_data_len: u32, output_ptr: u32, output_len_ptr: u32, ) -> ReturnErrorCode; fn instantiate( code_hash_ptr: u32, ref_time_limit: u64, proof_size_limit: u64, deposit_ptr: u32, value_ptr: u32, input_data_ptr: u32, input_data_len: u32, address_ptr: u32, output_ptr: u32, output_len_ptr: u32, salt_ptr: u32, ) -> ReturnErrorCode; fn terminate(beneficiary_ptr: u32); fn input(out_ptr: u32, out_len_ptr: u32); fn seal_return(flags: u32, data_ptr: u32, data_len: u32); fn caller(out_ptr: u32); fn origin(out_ptr: u32); fn is_contract(account_ptr: u32) -> u32; fn code_hash(addr_ptr: u32, out_ptr: u32); fn code_size(addr_ptr: u32, out_ptr: u32); fn own_code_hash(out_ptr: u32); fn caller_is_origin() -> u32; fn caller_is_root() -> u32; fn address(out_ptr: u32); fn weight_to_fee(ref_time_limit: u64, proof_size_limit: u64, out_ptr: u32); fn weight_left(out_ptr: u32, out_len_ptr: u32); fn get_immutable_data(out_ptr: u32, out_len_ptr: u32); fn set_immutable_data(ptr: u32, len: u32); fn balance(out_ptr: u32); fn balance_of(addr_ptr: u32, out_ptr: u32); fn chain_id(out_ptr: u32); fn value_transferred(out_ptr: u32); fn now(out_ptr: u32); fn minimum_balance(out_ptr: u32); fn deposit_event( topics_ptr: u32, num_topic: u32, data_ptr: u32, data_len: u32, ); fn block_number(out_ptr: u32); fn block_hash(block_number_ptr: u32, out_ptr: u32); fn hash_sha2_256(input_ptr: u32, input_len: u32, output_ptr: u32); fn hash_keccak_256(input_ptr: u32, input_len: u32, output_ptr: u32); fn hash_blake2_256(input_ptr: u32, input_len: u32, output_ptr: u32); fn hash_blake2_128(input_ptr: u32, input_len: u32, output_ptr: u32); fn call_chain_extension( id: u32, input_ptr: u32, input_len: u32, output_ptr: u32, output_len_ptr: u32, ) -> u32; fn debug_message(str_ptr: u32, str_len: u32) -> ReturnErrorCode; fn call_runtime(call_ptr: u32, call_len: u32) -> ReturnErrorCode; fn xcm_execute(msg_ptr: u32, msg_len: u32) -> ReturnErrorCode; fn xcm_send( dest_ptr: u32, dest_len: u32, msg_ptr: u32, msg_len: u32, output_ptr: u32, ) -> ReturnErrorCode; fn ecdsa_recover( signature_ptr: u32, message_hash_ptr: u32, output_ptr: u32, ) -> ReturnErrorCode; fn sr25519_verify( signature_ptr: u32, pub_key_ptr: u32, message_len: u32, message_ptr: u32, ) -> ReturnErrorCode; fn set_code_hash(code_hash_ptr: u32) -> ReturnErrorCode; fn ecdsa_to_eth_address(key_ptr: u32, out_ptr: u32) -> ReturnErrorCode; fn lock_delegate_dependency(code_hash_ptr: u32); fn unlock_delegate_dependency(code_hash_ptr: u32); fn return_data_size(out_ptr: u32); fn return_data_copy(out_ptr: u32, out_len_ptr: u32, offset: u32);
}
Expand description

Documentation of the syscalls (host functions) available to contracts.

Each of the functions in this trait represent a function that is callable by the contract. Guests use the function name as the import symbol.

§Note

This module is not meant to be used by any code. Rather, it is meant to be consumed by humans through rustdoc.

Required Methods§

source

fn noop()

Noop function used to benchmark the time it takes to execute an empty function.

§Unstable API

This API is not standardized and only available for testing.

source

fn set_storage( flags: u32, key_ptr: u32, key_len: u32, value_ptr: u32, value_len: u32, ) -> u32

Set the value at the given key in the contract storage. See [pallet_revive_uapi::HostFn::set_storage_v2]

§Required API version

This API was added in version 0.

source

fn clear_storage(flags: u32, key_ptr: u32, key_len: u32) -> u32

Clear the value at the given key in the contract storage. See [pallet_revive_uapi::HostFn::clear_storage]

§Required API version

This API was added in version 0.

source

fn get_storage( flags: u32, key_ptr: u32, key_len: u32, out_ptr: u32, out_len_ptr: u32, ) -> ReturnErrorCode

Retrieve the value under the given key from storage. See [pallet_revive_uapi::HostFn::get_storage]

§Required API version

This API was added in version 0.

source

fn contains_storage(flags: u32, key_ptr: u32, key_len: u32) -> u32

Checks whether there is a value stored under the given key. See [pallet_revive_uapi::HostFn::contains_storage]

§Required API version

This API was added in version 0.

source

fn take_storage( flags: u32, key_ptr: u32, key_len: u32, out_ptr: u32, out_len_ptr: u32, ) -> ReturnErrorCode

Retrieve and remove the value under the given key from storage. See [pallet_revive_uapi::HostFn::take_storage]

§Required API version

This API was added in version 0.

source

fn call( flags: u32, callee_ptr: u32, ref_time_limit: u64, proof_size_limit: u64, deposit_ptr: u32, value_ptr: u32, input_data_ptr: u32, input_data_len: u32, output_ptr: u32, output_len_ptr: u32, ) -> ReturnErrorCode

Make a call to another contract. See [pallet_revive_uapi::HostFn::call].

§Required API version

This API was added in version 0.

source

fn delegate_call( flags: u32, address_ptr: u32, ref_time_limit: u64, proof_size_limit: u64, deposit_ptr: u32, input_data_ptr: u32, input_data_len: u32, output_ptr: u32, output_len_ptr: u32, ) -> ReturnErrorCode

Execute code in the context (storage, caller, value) of the current contract. See [pallet_revive_uapi::HostFn::delegate_call].

§Required API version

This API was added in version 0.

source

fn instantiate( code_hash_ptr: u32, ref_time_limit: u64, proof_size_limit: u64, deposit_ptr: u32, value_ptr: u32, input_data_ptr: u32, input_data_len: u32, address_ptr: u32, output_ptr: u32, output_len_ptr: u32, salt_ptr: u32, ) -> ReturnErrorCode

Instantiate a contract with the specified code hash. See [pallet_revive_uapi::HostFn::instantiate].

§Required API version

This API was added in version 0.

source

fn terminate(beneficiary_ptr: u32)

Remove the calling account and transfer remaining free balance. See [pallet_revive_uapi::HostFn::terminate].

§Required API version

This API was added in version 0.

source

fn input(out_ptr: u32, out_len_ptr: u32)

Stores the input passed by the caller into the supplied buffer. See [pallet_revive_uapi::HostFn::input].

§Required API version

This API was added in version 0.

source

fn seal_return(flags: u32, data_ptr: u32, data_len: u32)

Cease contract execution and save a data buffer as a result of the execution. See [pallet_revive_uapi::HostFn::return_value].

§Required API version

This API was added in version 0.

source

fn caller(out_ptr: u32)

Stores the address of the caller into the supplied buffer. See [pallet_revive_uapi::HostFn::caller].

§Required API version

This API was added in version 0.

source

fn origin(out_ptr: u32)

Stores the address of the call stack origin into the supplied buffer. See [pallet_revive_uapi::HostFn::origin].

§Required API version

This API was added in version 0.

source

fn is_contract(account_ptr: u32) -> u32

Checks whether a specified address belongs to a contract. See [pallet_revive_uapi::HostFn::is_contract].

§Required API version

This API was added in version 0.

source

fn code_hash(addr_ptr: u32, out_ptr: u32)

Retrieve the code hash for a specified contract address. See [pallet_revive_uapi::HostFn::code_hash].

§Required API version

This API was added in version 0.

source

fn code_size(addr_ptr: u32, out_ptr: u32)

Retrieve the code size for a given contract address. See [pallet_revive_uapi::HostFn::code_size].

§Required API version

This API was added in version 0.

source

fn own_code_hash(out_ptr: u32)

Retrieve the code hash of the currently executing contract. See [pallet_revive_uapi::HostFn::own_code_hash].

§Required API version

This API was added in version 0.

source

fn caller_is_origin() -> u32

Checks whether the caller of the current contract is the origin of the whole call stack. See [pallet_revive_uapi::HostFn::caller_is_origin].

§Required API version

This API was added in version 0.

source

fn caller_is_root() -> u32

Checks whether the caller of the current contract is root. See [pallet_revive_uapi::HostFn::caller_is_root].

§Required API version

This API was added in version 0.

source

fn address(out_ptr: u32)

Stores the address of the current contract into the supplied buffer. See [pallet_revive_uapi::HostFn::address].

§Required API version

This API was added in version 0.

source

fn weight_to_fee(ref_time_limit: u64, proof_size_limit: u64, out_ptr: u32)

Stores the price for the specified amount of weight into the supplied buffer. See [pallet_revive_uapi::HostFn::weight_to_fee].

§Required API version

This API was added in version 0.

source

fn weight_left(out_ptr: u32, out_len_ptr: u32)

Stores the amount of weight left into the supplied buffer. See [pallet_revive_uapi::HostFn::weight_left].

§Required API version

This API was added in version 0.

source

fn get_immutable_data(out_ptr: u32, out_len_ptr: u32)

Stores the immutable data into the supplied buffer. See [pallet_revive_uapi::HostFn::get_immutable_data].

§Required API version

This API was added in version 0.

source

fn set_immutable_data(ptr: u32, len: u32)

Attaches the supplied immutable data to the currently executing contract. See [pallet_revive_uapi::HostFn::set_immutable_data].

§Required API version

This API was added in version 0.

source

fn balance(out_ptr: u32)

Stores the free balance of the current account into the supplied buffer. See [pallet_revive_uapi::HostFn::balance].

§Required API version

This API was added in version 0.

source

fn balance_of(addr_ptr: u32, out_ptr: u32)

Stores the free balance of the supplied address into the supplied buffer. See [pallet_revive_uapi::HostFn::balance].

§Required API version

This API was added in version 0.

source

fn chain_id(out_ptr: u32)

Returns the chain ID. See [pallet_revive_uapi::HostFn::chain_id].

§Required API version

This API was added in version 0.

source

fn value_transferred(out_ptr: u32)

Stores the value transferred along with this call/instantiate into the supplied buffer. See [pallet_revive_uapi::HostFn::value_transferred].

§Required API version

This API was added in version 0.

source

fn now(out_ptr: u32)

Load the latest block timestamp into the supplied buffer See [pallet_revive_uapi::HostFn::now].

§Required API version

This API was added in version 0.

source

fn minimum_balance(out_ptr: u32)

Stores the minimum balance (a.k.a. existential deposit) into the supplied buffer. See [pallet_revive_uapi::HostFn::minimum_balance].

§Required API version

This API was added in version 0.

source

fn deposit_event(topics_ptr: u32, num_topic: u32, data_ptr: u32, data_len: u32)

Deposit a contract event with the data buffer and optional list of topics. See [pallet_revive_uapi::HostFn::deposit_event]

§Required API version

This API was added in version 0.

source

fn block_number(out_ptr: u32)

Stores the current block number of the current contract into the supplied buffer. See [pallet_revive_uapi::HostFn::block_number].

§Required API version

This API was added in version 0.

source

fn block_hash(block_number_ptr: u32, out_ptr: u32)

Stores the block hash at given block height into the supplied buffer. See [pallet_revive_uapi::HostFn::block_hash].

§Required API version

This API was added in version 0.

source

fn hash_sha2_256(input_ptr: u32, input_len: u32, output_ptr: u32)

Computes the SHA2 256-bit hash on the given input buffer. See [pallet_revive_uapi::HostFn::hash_sha2_256].

§Required API version

This API was added in version 0.

source

fn hash_keccak_256(input_ptr: u32, input_len: u32, output_ptr: u32)

Computes the KECCAK 256-bit hash on the given input buffer. See [pallet_revive_uapi::HostFn::hash_keccak_256].

§Required API version

This API was added in version 0.

source

fn hash_blake2_256(input_ptr: u32, input_len: u32, output_ptr: u32)

Computes the BLAKE2 256-bit hash on the given input buffer. See [pallet_revive_uapi::HostFn::hash_blake2_256].

§Required API version

This API was added in version 0.

source

fn hash_blake2_128(input_ptr: u32, input_len: u32, output_ptr: u32)

Computes the BLAKE2 128-bit hash on the given input buffer. See [pallet_revive_uapi::HostFn::hash_blake2_128].

§Required API version

This API was added in version 0.

source

fn call_chain_extension( id: u32, input_ptr: u32, input_len: u32, output_ptr: u32, output_len_ptr: u32, ) -> u32

Call into the chain extension provided by the chain if any. See [pallet_revive_uapi::HostFn::call_chain_extension].

§Unstable API

This API is not standardized and only available for testing.

source

fn debug_message(str_ptr: u32, str_len: u32) -> ReturnErrorCode

Emit a custom debug message. See [pallet_revive_uapi::HostFn::debug_message].

§Required API version

This API was added in version 0.

source

fn call_runtime(call_ptr: u32, call_len: u32) -> ReturnErrorCode

Call some dispatchable of the runtime. See [frame_support::traits::call_runtime].

§Unstable API

This API is not standardized and only available for testing.

source

fn xcm_execute(msg_ptr: u32, msg_len: u32) -> ReturnErrorCode

Execute an XCM program locally, using the contract’s address as the origin. See [pallet_revive_uapi::HostFn::execute_xcm].

§Unstable API

This API is not standardized and only available for testing.

source

fn xcm_send( dest_ptr: u32, dest_len: u32, msg_ptr: u32, msg_len: u32, output_ptr: u32, ) -> ReturnErrorCode

Send an XCM program from the contract to the specified destination. See [pallet_revive_uapi::HostFn::send_xcm].

§Unstable API

This API is not standardized and only available for testing.

source

fn ecdsa_recover( signature_ptr: u32, message_hash_ptr: u32, output_ptr: u32, ) -> ReturnErrorCode

Recovers the ECDSA public key from the given message hash and signature. See [pallet_revive_uapi::HostFn::ecdsa_recover].

§Required API version

This API was added in version 0.

source

fn sr25519_verify( signature_ptr: u32, pub_key_ptr: u32, message_len: u32, message_ptr: u32, ) -> ReturnErrorCode

Verify a sr25519 signature See [pallet_revive_uapi::HostFn::sr25519_verify].

§Required API version

This API was added in version 0.

source

fn set_code_hash(code_hash_ptr: u32) -> ReturnErrorCode

Replace the contract code at the specified address with new code. See [pallet_revive_uapi::HostFn::set_code_hash].

Disabled until the internal implementation takes care of collecting the immutable data of the new code hash.

§Unstable API

This API is not standardized and only available for testing.

source

fn ecdsa_to_eth_address(key_ptr: u32, out_ptr: u32) -> ReturnErrorCode

Calculates Ethereum address from the ECDSA compressed public key and stores See [pallet_revive_uapi::HostFn::ecdsa_to_eth_address].

§Required API version

This API was added in version 0.

source

fn lock_delegate_dependency(code_hash_ptr: u32)

Adds a new delegate dependency to the contract. See [pallet_revive_uapi::HostFn::lock_delegate_dependency].

§Required API version

This API was added in version 0.

source

fn unlock_delegate_dependency(code_hash_ptr: u32)

Removes the delegate dependency from the contract. see [pallet_revive_uapi::HostFn::unlock_delegate_dependency].

§Required API version

This API was added in version 0.

source

fn return_data_size(out_ptr: u32)

Stores the length of the data returned by the last call into the supplied buffer. See [pallet_revive_uapi::HostFn::return_data_size].

§Required API version

This API was added in version 0.

source

fn return_data_copy(out_ptr: u32, out_len_ptr: u32, offset: u32)

Stores data returned by the last call, starting from offset, into the supplied buffer. See [pallet_revive_uapi::HostFn::return_data].

§Required API version

This API was added in version 0.

Object Safety§

This trait is not object safe.

Implementors§