Trait pallet_revive::SyscallDoc
source · pub trait SyscallDoc {
Show 57 methods
// Required methods
fn noop();
fn set_storage(
flags: u32,
key_ptr: u32,
key_len: u32,
value_ptr: u32,
value_len: u32,
) -> u32;
fn get_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 call_data_size() -> u64;
fn call_data_copy(out_ptr: u32, out_len: u32, offset: u32);
fn call_data_load(out_ptr: u32, offset: u32);
fn seal_return(flags: u32, data_ptr: u32, data_len: u32);
fn caller(out_ptr: u32);
fn origin(out_ptr: u32);
fn code_hash(addr_ptr: u32, out_ptr: u32);
fn code_size(addr_ptr: u32) -> u64;
fn address(out_ptr: u32);
fn weight_to_fee(ref_time_limit: u64, proof_size_limit: u64, out_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 gas_limit() -> u64;
fn value_transferred(out_ptr: u32);
fn gas_price() -> u64;
fn base_fee(out_ptr: u32);
fn now(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_keccak_256(input_ptr: u32, input_len: u32, output_ptr: u32);
fn return_data_size() -> u64;
fn return_data_copy(out_ptr: u32, out_len_ptr: u32, offset: u32);
fn ref_time_left() -> u64;
fn call_chain_extension(
id: u32,
input_ptr: u32,
input_len: u32,
output_ptr: u32,
output_len_ptr: u32,
) -> u32;
fn call_runtime(call_ptr: u32, call_len: u32) -> ReturnErrorCode;
fn caller_is_origin() -> u32;
fn caller_is_root() -> u32;
fn clear_storage(flags: u32, key_ptr: u32, key_len: u32) -> u32;
fn contains_storage(flags: u32, key_ptr: u32, key_len: u32) -> u32;
fn debug_message(str_ptr: u32, str_len: u32) -> ReturnErrorCode;
fn ecdsa_recover(
signature_ptr: u32,
message_hash_ptr: u32,
output_ptr: u32,
) -> ReturnErrorCode;
fn ecdsa_to_eth_address(key_ptr: u32, out_ptr: u32) -> ReturnErrorCode;
fn hash_blake2_128(input_ptr: u32, input_len: u32, output_ptr: u32);
fn hash_blake2_256(input_ptr: u32, input_len: u32, output_ptr: u32);
fn hash_sha2_256(input_ptr: u32, input_len: u32, output_ptr: u32);
fn is_contract(account_ptr: u32) -> u32;
fn lock_delegate_dependency(code_hash_ptr: u32);
fn minimum_balance(out_ptr: u32);
fn own_code_hash(out_ptr: u32);
fn set_code_hash(code_hash_ptr: u32);
fn sr25519_verify(
signature_ptr: u32,
pub_key_ptr: u32,
message_len: u32,
message_ptr: u32,
) -> ReturnErrorCode;
fn unlock_delegate_dependency(code_hash_ptr: u32);
fn take_storage(
flags: u32,
key_ptr: u32,
key_len: u32,
out_ptr: u32,
out_len_ptr: u32,
) -> ReturnErrorCode;
fn terminate(beneficiary_ptr: u32);
fn weight_left(out_ptr: u32, out_len_ptr: u32);
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;
}
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§
sourcefn noop()
fn noop()
Noop function used to benchmark the time it takes to execute an empty function.
Marked as stable because it needs to be called from benchmarks even when the benchmarked parachain has unstable functions disabled.
§Stable API
This API is stable and will never change.
sourcefn set_storage(
flags: u32,
key_ptr: u32,
key_len: u32,
value_ptr: u32,
value_len: u32,
) -> u32
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
]
§Stable API
This API is stable and will never change.
sourcefn get_storage(
flags: u32,
key_ptr: u32,
key_len: u32,
out_ptr: u32,
out_len_ptr: u32,
) -> ReturnErrorCode
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
§Stable API
This API is stable and will never change.
sourcefn 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 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
.
§Stable API
This API is stable and will never change.
sourcefn 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 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
.
§Stable API
This API is stable and will never change.
sourcefn 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 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
.
§Stable API
This API is stable and will never change.
sourcefn call_data_size() -> u64
fn call_data_size() -> u64
Returns the total size of the contract call input data.
See pallet_revive_uapi::HostFn::call_data_size
.
§Stable API
This API is stable and will never change.
sourcefn call_data_copy(out_ptr: u32, out_len: u32, offset: u32)
fn call_data_copy(out_ptr: u32, out_len: u32, offset: u32)
Stores the input passed by the caller into the supplied buffer.
See pallet_revive_uapi::HostFn::call_data_copy
.
§Stable API
This API is stable and will never change.
sourcefn call_data_load(out_ptr: u32, offset: u32)
fn call_data_load(out_ptr: u32, offset: u32)
Stores the U256 value at given call input offset
into the supplied buffer.
See pallet_revive_uapi::HostFn::call_data_load
.
§Stable API
This API is stable and will never change.
sourcefn seal_return(flags: u32, data_ptr: u32, data_len: u32)
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
.
§Stable API
This API is stable and will never change.
sourcefn caller(out_ptr: u32)
fn caller(out_ptr: u32)
Stores the address of the caller into the supplied buffer.
See pallet_revive_uapi::HostFn::caller
.
§Stable API
This API is stable and will never change.
sourcefn origin(out_ptr: u32)
fn origin(out_ptr: u32)
Stores the address of the call stack origin into the supplied buffer.
See pallet_revive_uapi::HostFn::origin
.
§Stable API
This API is stable and will never change.
sourcefn code_hash(addr_ptr: u32, out_ptr: u32)
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
.
§Stable API
This API is stable and will never change.
sourcefn code_size(addr_ptr: u32) -> u64
fn code_size(addr_ptr: u32) -> u64
Retrieve the code size for a given contract address.
See pallet_revive_uapi::HostFn::code_size
.
§Stable API
This API is stable and will never change.
sourcefn address(out_ptr: u32)
fn address(out_ptr: u32)
Stores the address of the current contract into the supplied buffer.
See pallet_revive_uapi::HostFn::address
.
§Stable API
This API is stable and will never change.
sourcefn weight_to_fee(ref_time_limit: u64, proof_size_limit: u64, out_ptr: u32)
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
.
§Stable API
This API is stable and will never change.
sourcefn get_immutable_data(out_ptr: u32, out_len_ptr: u32)
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
.
§Stable API
This API is stable and will never change.
sourcefn set_immutable_data(ptr: u32, len: u32)
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
.
§Stable API
This API is stable and will never change.
sourcefn balance(out_ptr: u32)
fn balance(out_ptr: u32)
Stores the free balance of the current account into the supplied buffer.
See pallet_revive_uapi::HostFn::balance
.
§Stable API
This API is stable and will never change.
sourcefn balance_of(addr_ptr: u32, out_ptr: u32)
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
.
§Stable API
This API is stable and will never change.
sourcefn chain_id(out_ptr: u32)
fn chain_id(out_ptr: u32)
Returns the chain ID.
See pallet_revive_uapi::HostFn::chain_id
.
§Stable API
This API is stable and will never change.
sourcefn gas_limit() -> u64
fn gas_limit() -> u64
Returns the block ref_time limit.
See pallet_revive_uapi::HostFn::gas_limit
.
§Stable API
This API is stable and will never change.
sourcefn value_transferred(out_ptr: u32)
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
.
§Stable API
This API is stable and will never change.
sourcefn gas_price() -> u64
fn gas_price() -> u64
Returns the simulated ethereum GASPRICE
value.
See pallet_revive_uapi::HostFn::gas_price
.
§Stable API
This API is stable and will never change.
sourcefn base_fee(out_ptr: u32)
fn base_fee(out_ptr: u32)
Returns the simulated ethereum BASEFEE
value.
See pallet_revive_uapi::HostFn::base_fee
.
§Stable API
This API is stable and will never change.
sourcefn now(out_ptr: u32)
fn now(out_ptr: u32)
Load the latest block timestamp into the supplied buffer
See pallet_revive_uapi::HostFn::now
.
§Stable API
This API is stable and will never change.
sourcefn deposit_event(topics_ptr: u32, num_topic: u32, data_ptr: u32, data_len: u32)
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
§Stable API
This API is stable and will never change.
sourcefn block_number(out_ptr: u32)
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
.
§Stable API
This API is stable and will never change.
sourcefn block_hash(block_number_ptr: u32, out_ptr: u32)
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
.
§Stable API
This API is stable and will never change.
sourcefn hash_keccak_256(input_ptr: u32, input_len: u32, output_ptr: u32)
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
.
§Stable API
This API is stable and will never change.
sourcefn return_data_size() -> u64
fn return_data_size() -> u64
Stores the length of the data returned by the last call into the supplied buffer.
See pallet_revive_uapi::HostFn::return_data_size
.
§Stable API
This API is stable and will never change.
sourcefn return_data_copy(out_ptr: u32, out_len_ptr: u32, offset: u32)
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
].
§Stable API
This API is stable and will never change.
sourcefn ref_time_left() -> u64
fn ref_time_left() -> u64
Returns the amount of ref_time left.
See pallet_revive_uapi::HostFn::ref_time_left
.
§Stable API
This API is stable and will never change.
sourcefn call_chain_extension(
id: u32,
input_ptr: u32,
input_len: u32,
output_ptr: u32,
output_len_ptr: u32,
) -> u32
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.
sourcefn call_runtime(call_ptr: u32, call_len: u32) -> ReturnErrorCode
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.
sourcefn caller_is_origin() -> u32
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
.
§Unstable API
This API is not standardized and only available for testing.
sourcefn caller_is_root() -> u32
fn caller_is_root() -> u32
Checks whether the caller of the current contract is root.
See pallet_revive_uapi::HostFn::caller_is_root
.
§Unstable API
This API is not standardized and only available for testing.
sourcefn clear_storage(flags: u32, key_ptr: u32, key_len: u32) -> u32
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
§Unstable API
This API is not standardized and only available for testing.
sourcefn contains_storage(flags: u32, key_ptr: u32, key_len: u32) -> u32
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
§Unstable API
This API is not standardized and only available for testing.
sourcefn debug_message(str_ptr: u32, str_len: u32) -> ReturnErrorCode
fn debug_message(str_ptr: u32, str_len: u32) -> ReturnErrorCode
Emit a custom debug message.
See pallet_revive_uapi::HostFn::debug_message
.
§Unstable API
This API is not standardized and only available for testing.
sourcefn ecdsa_recover(
signature_ptr: u32,
message_hash_ptr: u32,
output_ptr: u32,
) -> ReturnErrorCode
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
.
§Unstable API
This API is not standardized and only available for testing.
sourcefn ecdsa_to_eth_address(key_ptr: u32, out_ptr: u32) -> ReturnErrorCode
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
.
§Unstable API
This API is not standardized and only available for testing.
sourcefn hash_blake2_128(input_ptr: u32, input_len: u32, output_ptr: u32)
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
.
§Unstable API
This API is not standardized and only available for testing.
sourcefn hash_blake2_256(input_ptr: u32, input_len: u32, output_ptr: u32)
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
.
§Unstable API
This API is not standardized and only available for testing.
sourcefn hash_sha2_256(input_ptr: u32, input_len: u32, output_ptr: u32)
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
.
§Unstable API
This API is not standardized and only available for testing.
sourcefn is_contract(account_ptr: u32) -> u32
fn is_contract(account_ptr: u32) -> u32
Checks whether a specified address belongs to a contract.
See pallet_revive_uapi::HostFn::is_contract
.
§Unstable API
This API is not standardized and only available for testing.
sourcefn lock_delegate_dependency(code_hash_ptr: u32)
fn lock_delegate_dependency(code_hash_ptr: u32)
Adds a new delegate dependency to the contract.
See pallet_revive_uapi::HostFn::lock_delegate_dependency
.
§Unstable API
This API is not standardized and only available for testing.
sourcefn minimum_balance(out_ptr: u32)
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
.
§Unstable API
This API is not standardized and only available for testing.
sourcefn own_code_hash(out_ptr: u32)
fn own_code_hash(out_ptr: u32)
Retrieve the code hash of the currently executing contract.
See pallet_revive_uapi::HostFn::own_code_hash
.
§Unstable API
This API is not standardized and only available for testing.
sourcefn set_code_hash(code_hash_ptr: u32)
fn set_code_hash(code_hash_ptr: u32)
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.
sourcefn sr25519_verify(
signature_ptr: u32,
pub_key_ptr: u32,
message_len: u32,
message_ptr: u32,
) -> ReturnErrorCode
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
.
§Unstable API
This API is not standardized and only available for testing.
sourcefn unlock_delegate_dependency(code_hash_ptr: u32)
fn unlock_delegate_dependency(code_hash_ptr: u32)
Removes the delegate dependency from the contract.
see pallet_revive_uapi::HostFn::unlock_delegate_dependency
.
§Unstable API
This API is not standardized and only available for testing.
sourcefn take_storage(
flags: u32,
key_ptr: u32,
key_len: u32,
out_ptr: u32,
out_len_ptr: u32,
) -> ReturnErrorCode
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
§Unstable API
This API is not standardized and only available for testing.
sourcefn terminate(beneficiary_ptr: u32)
fn terminate(beneficiary_ptr: u32)
Remove the calling account and transfer remaining free balance.
See pallet_revive_uapi::HostFn::terminate
.
§Unstable API
This API is not standardized and only available for testing.
sourcefn weight_left(out_ptr: u32, out_len_ptr: u32)
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
.
§Unstable API
This API is not standardized and only available for testing.
sourcefn xcm_execute(msg_ptr: u32, msg_len: u32) -> ReturnErrorCode
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.
sourcefn xcm_send(
dest_ptr: u32,
dest_len: u32,
msg_ptr: u32,
msg_len: u32,
output_ptr: u32,
) -> ReturnErrorCode
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.