Kagome
Polkadot Runtime Engine in C++17
kagome::host_api::HostApi Class Referenceabstract

#include <host_api.hpp>

Inheritance diagram for kagome::host_api::HostApi:
Collaboration diagram for kagome::host_api::HostApi:

Public Member Functions

virtual ~HostApi ()=default
 
virtual void reset ()=0
 
virtual runtime::WasmSpan ext_storage_read_version_1 (runtime::WasmSpan key, runtime::WasmSpan value_out, runtime::WasmOffset offset)=0
 Reads data from storage with the given key. More...
 
virtual void ext_storage_set_version_1 (runtime::WasmSpan key, runtime::WasmSpan value)=0
 Sets the value under a given key into storage. More...
 
virtual runtime::WasmSpan ext_storage_get_version_1 (runtime::WasmSpan key)=0
 Retrieves the value associated with the given key from storage. More...
 
virtual void ext_storage_clear_version_1 (runtime::WasmSpan key_data)=0
 Clears the storage of the given key and its value. More...
 
virtual runtime::WasmSize ext_storage_exists_version_1 (runtime::WasmSpan key_data) const =0
 Checks whether the given key exists in storage. More...
 
virtual void ext_storage_clear_prefix_version_1 (runtime::WasmSpan prefix)=0
 Clear the storage of each key/value pair where the key starts with the given prefix. More...
 
virtual runtime::WasmSpan ext_storage_clear_prefix_version_2 (runtime::WasmSpan prefix, runtime::WasmSpan limit)=0
 Clear the storage of each key/value pair where the key starts with the given prefix. More...
 
virtual runtime::WasmSpan ext_storage_root_version_1 ()=0
 Commits all existing operations and computes the resulting storage root. More...
 
virtual runtime::WasmSpan ext_storage_root_version_2 (runtime::WasmI32 state_version)=0
 Commits all existing operations and computes the resulting storage root. More...
 
virtual runtime::WasmSpan ext_storage_changes_root_version_1 (runtime::WasmSpan parent_hash)=0
 
virtual runtime::WasmSpan ext_storage_next_key_version_1 (runtime::WasmSpan key) const =0
 
virtual void ext_storage_append_version_1 (runtime::WasmSpan key, runtime::WasmSpan value) const =0
 
virtual void ext_storage_start_transaction_version_1 ()=0
 
virtual void ext_storage_rollback_transaction_version_1 ()=0
 
virtual void ext_storage_commit_transaction_version_1 ()=0
 
virtual runtime::WasmPointer ext_trie_blake2_256_root_version_1 (runtime::WasmSpan values_data)=0
 
virtual runtime::WasmPointer ext_trie_blake2_256_ordered_root_version_1 (runtime::WasmSpan values_data)=0
 
virtual runtime::WasmPointer ext_trie_blake2_256_ordered_root_version_2 (runtime::WasmSpan values_data, runtime::WasmI32 state_version)=0
 
virtual runtime::WasmPointer ext_allocator_malloc_version_1 (runtime::WasmSize size)=0
 
virtual void ext_allocator_free_version_1 (runtime::WasmPointer ptr)=0
 
virtual void ext_logging_log_version_1 (runtime::WasmEnum level, runtime::WasmSpan target, runtime::WasmSpan message)=0
 
virtual runtime::WasmEnum ext_logging_max_level_version_1 ()=0
 
virtual void ext_crypto_start_batch_verify_version_1 ()=0
 Starts the verification extension. The extension is a separate background process and is used to parallel-verify signatures which are pushed to the batch with ext_crypto_.._verify. More...
 
virtual int32_t ext_crypto_finish_batch_verify_version_1 ()=0
 Finish verifying the batch of signatures since the last call to this function. Blocks until all the signatures are verified. More...
 
virtual runtime::WasmSpan ext_crypto_secp256k1_ecdsa_recover_version_1 (runtime::WasmPointer sig, runtime::WasmPointer msg)=0
 
virtual runtime::WasmSpan ext_crypto_secp256k1_ecdsa_recover_version_2 (runtime::WasmPointer sig, runtime::WasmPointer msg)=0
 
virtual runtime::WasmSpan ext_crypto_secp256k1_ecdsa_recover_compressed_version_1 (runtime::WasmPointer sig, runtime::WasmPointer msg)=0
 
virtual runtime::WasmSpan ext_crypto_secp256k1_ecdsa_recover_compressed_version_2 (runtime::WasmPointer sig, runtime::WasmPointer msg)=0
 
virtual runtime::WasmPointer ext_hashing_keccak_256_version_1 (runtime::WasmSpan data)=0
 
virtual runtime::WasmPointer ext_hashing_sha2_256_version_1 (runtime::WasmSpan data)=0
 
virtual runtime::WasmPointer ext_hashing_blake2_128_version_1 (runtime::WasmSpan data)=0
 
virtual runtime::WasmPointer ext_hashing_blake2_256_version_1 (runtime::WasmSpan data)=0
 
virtual runtime::WasmPointer ext_hashing_twox_64_version_1 (runtime::WasmSpan data)=0
 
virtual runtime::WasmPointer ext_hashing_twox_128_version_1 (runtime::WasmSpan data)=0
 
virtual runtime::WasmPointer ext_hashing_twox_256_version_1 (runtime::WasmSpan data)=0
 
virtual runtime::WasmSpan ext_crypto_ed25519_public_keys_version_1 (runtime::WasmSize key_type)=0
 
virtual runtime::WasmPointer ext_crypto_ed25519_generate_version_1 (runtime::WasmSize key_type, runtime::WasmSpan seed)=0
 
virtual runtime::WasmSpan ext_crypto_ed25519_sign_version_1 (runtime::WasmSize key_type, runtime::WasmPointer key, runtime::WasmSpan msg_data)=0
 
virtual runtime::WasmSize ext_crypto_ed25519_verify_version_1 (runtime::WasmPointer sig_data, runtime::WasmSpan msg, runtime::WasmPointer pubkey_data)=0
 
virtual runtime::WasmSpan ext_crypto_sr25519_public_keys_version_1 (runtime::WasmSize key_type)=0
 
virtual runtime::WasmPointer ext_crypto_sr25519_generate_version_1 (runtime::WasmSize key_type, runtime::WasmSpan seed)=0
 
virtual runtime::WasmSpan ext_crypto_sr25519_sign_version_1 (runtime::WasmSize key_type, runtime::WasmPointer key, runtime::WasmSpan msg_data)=0
 
virtual int32_t ext_crypto_sr25519_verify_version_1 (runtime::WasmPointer sig_data, runtime::WasmSpan msg, runtime::WasmPointer pubkey_data)=0
 
virtual int32_t ext_crypto_sr25519_verify_version_2 (runtime::WasmPointer sig_data, runtime::WasmSpan msg, runtime::WasmPointer pubkey_data)=0
 
virtual runtime::WasmSpan ext_crypto_ecdsa_public_keys_version_1 (runtime::WasmSize key_type)=0
 
virtual runtime::WasmSpan ext_crypto_ecdsa_sign_version_1 (runtime::WasmSize key_type, runtime::WasmPointer key, runtime::WasmSpan msg_data)=0
 
virtual runtime::WasmSpan ext_crypto_ecdsa_sign_prehashed_version_1 (runtime::WasmSize key_type, runtime::WasmPointer key, runtime::WasmSpan msg_data)=0
 
virtual runtime::WasmPointer ext_crypto_ecdsa_generate_version_1 (runtime::WasmSize key_type, runtime::WasmSpan seed)=0
 Generates an ecdsa key for the given key type using an optional BIP-39 seed and stores it in the keystore. Warning: Panics if the key cannot be generated, such as when an invalid key type or invalid seed was provided. More...
 
virtual int32_t ext_crypto_ecdsa_verify_version_1 (runtime::WasmPointer sig_data, runtime::WasmSpan msg, runtime::WasmPointer pubkey_data)=0
 Verifies an ecdsa signature. Returns true when the verification is either successful or batched. If no batching verification extension is registered, this function will fully verify the signature and return the result. If batching verification is registered, this function will push the data to the batch and return immediately. The caller can then get the result by calling ext_crypto_finish_batch_verify. The verification extension is explained more in detail in ext_crypto_start_batch_verify. More...
 
virtual int32_t ext_crypto_ecdsa_verify_prehashed_version_1 (runtime::WasmPointer sig_data, runtime::WasmSpan msg, runtime::WasmPointer pubkey_data)=0
 Verifies an ecdsa signature. Returns true when the verification is either successful or batched. If no batching verification extension is registered, this function will fully verify the signature and return the result. If batching verification is registered, this function will push the data to the batch and return immediately. The caller can then get the result by calling ext_crypto_finish_batch_verify. The verification extension is explained more in detail in ext_crypto_start_batch_verify. More...
 
virtual runtime::WasmSpan ext_misc_runtime_version_version_1 (runtime::WasmSpan data) const =0
 
virtual void ext_misc_print_hex_version_1 (runtime::WasmSpan data) const =0
 
virtual void ext_misc_print_num_version_1 (uint64_t value) const =0
 
virtual void ext_misc_print_utf8_version_1 (runtime::WasmSpan data) const =0
 
virtual runtime::WasmI32 ext_offchain_is_validator_version_1 ()=0
 Check whether the local node is a potential validator. Even if this function returns 1, it does not mean that any keys are configured or that the validator is registered in the chain. More...
 
virtual runtime::WasmSpan ext_offchain_submit_transaction_version_1 (runtime::WasmSpan data)=0
 Given a SCALE encoded extrinsic, this function submits the extrinsic to the Host's transaction pool, ready to be propagated to remote peers. More...
 
virtual runtime::WasmSpan ext_offchain_network_state_version_1 ()=0
 Returns the SCALE encoded, opaque information about the local node's network state. More...
 
virtual runtime::WasmU64 ext_offchain_timestamp_version_1 ()=0
 Returns current timestamp. More...
 
virtual void ext_offchain_sleep_until_version_1 (runtime::WasmU64 deadline)=0
 Pause the execution until deadline is reached. More...
 
virtual runtime::WasmPointer ext_offchain_random_seed_version_1 ()=0
 Generates a random seed. This is a truly random non deterministic seed generated by the host environment. More...
 
virtual void ext_offchain_local_storage_set_version_1 (runtime::WasmI32 kind, runtime::WasmSpan key, runtime::WasmSpan value)=0
 Sets a value in the local storage. This storage is not part of the consensus, it's only accessible by the offchain worker tasks running on the same machine and is persisted between runs. More...
 
virtual void ext_offchain_local_storage_clear_version_1 (runtime::WasmI32 kind, runtime::WasmSpan key)=0
 Remove a value from the local storage. More...
 
virtual runtime::WasmI32 ext_offchain_local_storage_compare_and_set_version_1 (runtime::WasmI32 kind, runtime::WasmSpan key, runtime::WasmSpan expected, runtime::WasmSpan value)=0
 
virtual runtime::WasmSpan ext_offchain_local_storage_get_version_1 (runtime::WasmI32 kind, runtime::WasmSpan key)=0
 Gets a value from the local storage. More...
 
virtual runtime::WasmSpan ext_offchain_http_request_start_version_1 (runtime::WasmSpan method, runtime::WasmSpan uri, runtime::WasmSpan meta)=0
 Initiates a HTTP request given by the HTTP method and the URL. Returns the id of a newly started request. More...
 
virtual runtime::WasmSpan ext_offchain_http_request_add_header_version_1 (runtime::WasmI32 request_id, runtime::WasmSpan name, runtime::WasmSpan value)=0
 
virtual runtime::WasmSpan ext_offchain_http_request_write_body_version_1 (runtime::WasmI32 request_id, runtime::WasmSpan chunk, runtime::WasmSpan deadline)=0
 
virtual runtime::WasmSpan ext_offchain_http_response_wait_version_1 (runtime::WasmSpan ids, runtime::WasmSpan deadline)=0
 Returns an array of request statuses (the length is the same as IDs). Note that if deadline is not provided the method will block indefinitely, otherwise unready responses will produce DeadlineReached status. More...
 
virtual runtime::WasmSpan ext_offchain_http_response_headers_version_1 (runtime::WasmI32 request_id)=0
 Read all HTTP response headers. Returns an array of key/value pairs. Response headers must be read before the response body. More...
 
virtual runtime::WasmSpan ext_offchain_http_response_read_body_version_1 (runtime::WasmI32 request_id, runtime::WasmSpan buffer, runtime::WasmSpan deadline)=0
 
virtual void ext_offchain_set_authorized_nodes_version_1 (runtime::WasmSpan nodes, runtime::WasmI32 authorized_only)=0
 Set the authorized nodes which are allowed to connect to the local node. This function is offered by the Substrate codebase and is primarily used for custom, non-Polkadot/Kusama chains. It is not required for the public and open Polkadot protocol. More...
 
virtual void ext_offchain_index_set_version_1 (runtime::WasmSpan key, runtime::WasmSpan value)=0
 Write a key value pair to the offchain database in a buffered fashion. More...
 
virtual void ext_offchain_index_clear_version_1 (runtime::WasmSpan key)=0
 Remove a key and its associated value from the offchain database. More...
 
virtual void ext_default_child_storage_set_version_1 (runtime::WasmSpan child_storage_key, runtime::WasmSpan key, runtime::WasmSpan value)=0
 Sets the value under a given key into the child storage. More...
 
virtual runtime::WasmSpan ext_default_child_storage_get_version_1 (runtime::WasmSpan child_storage_key, runtime::WasmSpan key) const =0
 Retrieves the value associated with the given key from the child storage. More...
 
virtual void ext_default_child_storage_clear_version_1 (runtime::WasmSpan child_storage_key, runtime::WasmSpan key)=0
 Clears the storage of the given key and its value from the child storage. More...
 
virtual runtime::WasmSpan ext_default_child_storage_next_key_version_1 (runtime::WasmSpan child_storage_key, runtime::WasmSpan key) const =0
 Gets the next key in storage after the given one in lexicographic order. The key provided to this function may or may not exist in storage. More...
 
virtual runtime::WasmSpan ext_default_child_storage_root_version_1 (runtime::WasmSpan child_storage_key) const =0
 Commits all existing operations and computes the resulting child storage root. More...
 
virtual void ext_default_child_storage_clear_prefix_version_1 (runtime::WasmSpan child_storage_key, runtime::WasmSpan prefix)=0
 Clears the child storage of each key/value pair where the key starts with the given prefix. More...
 
virtual runtime::WasmSpan ext_default_child_storage_read_version_1 (runtime::WasmSpan child_storage_key, runtime::WasmSpan key, runtime::WasmSpan value_out, runtime::WasmOffset offset) const =0
 Gets the given key from storage, placing the value into a buffer and returning the number of bytes that the entry in storage has beyond the offset. More...
 
virtual uint32_t ext_default_child_storage_exists_version_1 (runtime::WasmSpan child_storage_key, runtime::WasmSpan key) const =0
 Checks whether the given key exists in the child storage. More...
 
virtual void ext_default_child_storage_storage_kill_version_1 (runtime::WasmSpan child_storage_key)=0
 Clears an entire child storage. More...
 

Detailed Description

Extensions for the runtime wasm module, which are called by the runtime to access the host functionality

Definition at line 25 of file host_api.hpp.

Constructor & Destructor Documentation

virtual kagome::host_api::HostApi::~HostApi ( )
virtualdefault

Member Function Documentation

virtual void kagome::host_api::HostApi::ext_allocator_free_version_1 ( runtime::WasmPointer  ptr)
pure virtual
See also
Extension::ext_free

Implemented in kagome::host_api::HostApiImpl.

virtual runtime::WasmPointer kagome::host_api::HostApi::ext_allocator_malloc_version_1 ( runtime::WasmSize  size)
pure virtual
See also
Extension::ext_malloc

Implemented in kagome::host_api::HostApiImpl.

virtual runtime::WasmPointer kagome::host_api::HostApi::ext_crypto_ecdsa_generate_version_1 ( runtime::WasmSize  key_type,
runtime::WasmSpan  seed 
)
pure virtual

Generates an ecdsa key for the given key type using an optional BIP-39 seed and stores it in the keystore. Warning: Panics if the key cannot be generated, such as when an invalid key type or invalid seed was provided.

Parameters
key_type_ida 32-bit pointer to the key identifier
seeda pointer-size indicating the SCALE encoded Option containing the BIP-39 seed which must be valid UTF8.
Returns
a 32-bit pointer to the buffer containing the 33-byte compressed public key

Implemented in kagome::host_api::HostApiImpl.

virtual runtime::WasmSpan kagome::host_api::HostApi::ext_crypto_ecdsa_public_keys_version_1 ( runtime::WasmSize  key_type)
pure virtual
See also
Extension::ext_crypto_ecdsa_public_keys

Implemented in kagome::host_api::HostApiImpl.

virtual runtime::WasmSpan kagome::host_api::HostApi::ext_crypto_ecdsa_sign_prehashed_version_1 ( runtime::WasmSize  key_type,
runtime::WasmPointer  key,
runtime::WasmSpan  msg_data 
)
pure virtual

Signs the given message digest with a specified key

Parameters
key_typea 32-bit pointer to the key identifier
keya 32-bit pointer to the buffer containing the 33-byte compressed public key
msg_dataa pointer-size indicating the message that is to be signed
Returns
a pointer-size indicating the SCALE encoded Option containing the signature. The signature is 65-bytes in size, where the first 512-bits represent the signature and the other 8 bits represent the recovery ID. This function returns None if the public key cannot be found in the key store.

Implemented in kagome::host_api::HostApiImpl.

virtual runtime::WasmSpan kagome::host_api::HostApi::ext_crypto_ecdsa_sign_version_1 ( runtime::WasmSize  key_type,
runtime::WasmPointer  key,
runtime::WasmSpan  msg_data 
)
pure virtual
See also
Extension::ext_crypto_ecdsa_sign

Implemented in kagome::host_api::HostApiImpl.

virtual int32_t kagome::host_api::HostApi::ext_crypto_ecdsa_verify_prehashed_version_1 ( runtime::WasmPointer  sig_data,
runtime::WasmSpan  msg,
runtime::WasmPointer  pubkey_data 
)
pure virtual

Verifies an ecdsa signature. Returns true when the verification is either successful or batched. If no batching verification extension is registered, this function will fully verify the signature and return the result. If batching verification is registered, this function will push the data to the batch and return immediately. The caller can then get the result by calling ext_crypto_finish_batch_verify. The verification extension is explained more in detail in ext_crypto_start_batch_verify.

Parameters
siga 32-bit pointer to the buffer containing the 65-byte signature. The signature is 65- bytes in size, where the first 512-bits represent the signature and the other 8 bits represent the recovery ID.
msga pointer-size as defined in Definition D.3 indicating the message that is to be verified.
keya 32-bit pointer to the buffer containing the 33-byte compressed public key.
Returns
a boolean equal to true if the signature is valid, false if otherwise.

Implemented in kagome::host_api::HostApiImpl.

virtual int32_t kagome::host_api::HostApi::ext_crypto_ecdsa_verify_version_1 ( runtime::WasmPointer  sig_data,
runtime::WasmSpan  msg,
runtime::WasmPointer  pubkey_data 
)
pure virtual

Verifies an ecdsa signature. Returns true when the verification is either successful or batched. If no batching verification extension is registered, this function will fully verify the signature and return the result. If batching verification is registered, this function will push the data to the batch and return immediately. The caller can then get the result by calling ext_crypto_finish_batch_verify. The verification extension is explained more in detail in ext_crypto_start_batch_verify.

Parameters
siga 32-bit pointer to the buffer containing the 65-byte signature. The signature is 65- bytes in size, where the first 512-bits represent the signature and the other 8 bits represent the recovery ID.
msga pointer-size as defined in Definition D.3 indicating the message that is to be verified.
keya 32-bit pointer to the buffer containing the 33-byte compressed public key.
Returns
a boolean equal to true if the signature is valid, false if otherwise.

Implemented in kagome::host_api::HostApiImpl.

virtual runtime::WasmPointer kagome::host_api::HostApi::ext_crypto_ed25519_generate_version_1 ( runtime::WasmSize  key_type,
runtime::WasmSpan  seed 
)
pure virtual
See also
Extension::ext_ed25519_generate

Implemented in kagome::host_api::HostApiImpl.

virtual runtime::WasmSpan kagome::host_api::HostApi::ext_crypto_ed25519_public_keys_version_1 ( runtime::WasmSize  key_type)
pure virtual
See also
Extension::ext_ed25519_public_keys

Implemented in kagome::host_api::HostApiImpl.

virtual runtime::WasmSpan kagome::host_api::HostApi::ext_crypto_ed25519_sign_version_1 ( runtime::WasmSize  key_type,
runtime::WasmPointer  key,
runtime::WasmSpan  msg_data 
)
pure virtual
See also
Extension::ext_ed25519_sign

Implemented in kagome::host_api::HostApiImpl.

virtual runtime::WasmSize kagome::host_api::HostApi::ext_crypto_ed25519_verify_version_1 ( runtime::WasmPointer  sig_data,
runtime::WasmSpan  msg,
runtime::WasmPointer  pubkey_data 
)
pure virtual
See also
Extension::ext_ed25519_verify

Implemented in kagome::host_api::HostApiImpl.

virtual int32_t kagome::host_api::HostApi::ext_crypto_finish_batch_verify_version_1 ( )
pure virtual

Finish verifying the batch of signatures since the last call to this function. Blocks until all the signatures are verified.

Exceptions
runtime_errorif no verification extension is registered (ext_crypto_start_batch_verify (E.3.15) tchwas not called.)
Returns
an i32 integer value equal to 1 if all the signatures are valid or a value equal to 0 if one or more of the signatures are invalid.

Implemented in kagome::host_api::HostApiImpl.

virtual runtime::WasmSpan kagome::host_api::HostApi::ext_crypto_secp256k1_ecdsa_recover_compressed_version_1 ( runtime::WasmPointer  sig,
runtime::WasmPointer  msg 
)
pure virtual

Recover secp256k1 public key

Parameters
sigrecoverable 65-byte signature
msgblake2s message hash
Returns
pointer-size value (pointer to buffer and its size) containing scale-encoded variant of compressed public key or error

Implemented in kagome::host_api::HostApiImpl.

virtual runtime::WasmSpan kagome::host_api::HostApi::ext_crypto_secp256k1_ecdsa_recover_compressed_version_2 ( runtime::WasmPointer  sig,
runtime::WasmPointer  msg 
)
pure virtual
virtual runtime::WasmSpan kagome::host_api::HostApi::ext_crypto_secp256k1_ecdsa_recover_version_1 ( runtime::WasmPointer  sig,
runtime::WasmPointer  msg 
)
pure virtual

Recover secp256k1 public key

Parameters
sigrecoverable 65-byte signature
msgblake2s message hash
Returns
pointer-size value (pointer to buffer and its size) containing scale-encoded variant of public key or error

Implemented in kagome::host_api::HostApiImpl.

virtual runtime::WasmSpan kagome::host_api::HostApi::ext_crypto_secp256k1_ecdsa_recover_version_2 ( runtime::WasmPointer  sig,
runtime::WasmPointer  msg 
)
pure virtual
virtual runtime::WasmPointer kagome::host_api::HostApi::ext_crypto_sr25519_generate_version_1 ( runtime::WasmSize  key_type,
runtime::WasmSpan  seed 
)
pure virtual
See also
Extension::ext_sr25519_generate

Implemented in kagome::host_api::HostApiImpl.

virtual runtime::WasmSpan kagome::host_api::HostApi::ext_crypto_sr25519_public_keys_version_1 ( runtime::WasmSize  key_type)
pure virtual
See also
Extension::ext_sr25519_public_keys

Implemented in kagome::host_api::HostApiImpl.

virtual runtime::WasmSpan kagome::host_api::HostApi::ext_crypto_sr25519_sign_version_1 ( runtime::WasmSize  key_type,
runtime::WasmPointer  key,
runtime::WasmSpan  msg_data 
)
pure virtual
See also
Extension::ext_sr25519_sign

Implemented in kagome::host_api::HostApiImpl.

virtual int32_t kagome::host_api::HostApi::ext_crypto_sr25519_verify_version_1 ( runtime::WasmPointer  sig_data,
runtime::WasmSpan  msg,
runtime::WasmPointer  pubkey_data 
)
pure virtual

Verifies an sr25519 signature. Only version 1 of this function supports deprecated Schnorr signatures introduced by the schnorrkel Rust library version 0.1.1 and should only be used for backward compatibility. Returns true when the verification is either successful or batched. If no batching verification extension is registered, this function will fully verify the signature and return the result. If batching verification is registered, this function will push the data to the batch and return immediately. The caller can then get the result by calling ext_crypto_finish_batch_verify The verification extension is explained more in detail in ext_crypto_start_batch_verify

Implemented in kagome::host_api::HostApiImpl.

virtual int32_t kagome::host_api::HostApi::ext_crypto_sr25519_verify_version_2 ( runtime::WasmPointer  sig_data,
runtime::WasmSpan  msg,
runtime::WasmPointer  pubkey_data 
)
pure virtual
virtual void kagome::host_api::HostApi::ext_crypto_start_batch_verify_version_1 ( )
pure virtual

Starts the verification extension. The extension is a separate background process and is used to parallel-verify signatures which are pushed to the batch with ext_crypto_.._verify.

Implemented in kagome::host_api::HostApiImpl.

virtual void kagome::host_api::HostApi::ext_default_child_storage_clear_prefix_version_1 ( runtime::WasmSpan  child_storage_key,
runtime::WasmSpan  prefix 
)
pure virtual

Clears the child storage of each key/value pair where the key starts with the given prefix.

Parameters
child_storage_keya pointer-size indicating the child storage key
prefixa pointer-size indicating the prefix

Implemented in kagome::host_api::HostApiImpl.

virtual void kagome::host_api::HostApi::ext_default_child_storage_clear_version_1 ( runtime::WasmSpan  child_storage_key,
runtime::WasmSpan  key 
)
pure virtual

Clears the storage of the given key and its value from the child storage.

Parameters
child_storage_keya pointer-size indicating the child storage key
keya pointer-size indicating the key

Implemented in kagome::host_api::HostApiImpl.

virtual uint32_t kagome::host_api::HostApi::ext_default_child_storage_exists_version_1 ( runtime::WasmSpan  child_storage_key,
runtime::WasmSpan  key 
) const
pure virtual

Checks whether the given key exists in the child storage.

Parameters
child_storage_keya pointer-size indicating the child storage key
keya pointer-size indicating the key.
Returns
a boolean equal to true if the key does exist, false if otherwise.

Implemented in kagome::host_api::HostApiImpl.

virtual runtime::WasmSpan kagome::host_api::HostApi::ext_default_child_storage_get_version_1 ( runtime::WasmSpan  child_storage_key,
runtime::WasmSpan  key 
) const
pure virtual

Retrieves the value associated with the given key from the child storage.

Parameters
child_storage_keya pointer-size indicating the child storage key
keya pointer-size indicating the key.
Returns
a pointer-size indicating the SCALE encoded Option containing the value.

Implemented in kagome::host_api::HostApiImpl.

virtual runtime::WasmSpan kagome::host_api::HostApi::ext_default_child_storage_next_key_version_1 ( runtime::WasmSpan  child_storage_key,
runtime::WasmSpan  key 
) const
pure virtual

Gets the next key in storage after the given one in lexicographic order. The key provided to this function may or may not exist in storage.

Parameters
child_storage_keya pointer-size indicating the child storage key
keya pointer-size indicating the key.
Returns
a pointer-size indicating the SCALE encoded Option containing the next key in lexicographic order. Returns None if the entry cannot be found.

Implemented in kagome::host_api::HostApiImpl.

virtual runtime::WasmSpan kagome::host_api::HostApi::ext_default_child_storage_read_version_1 ( runtime::WasmSpan  child_storage_key,
runtime::WasmSpan  key,
runtime::WasmSpan  value_out,
runtime::WasmOffset  offset 
) const
pure virtual

Gets the given key from storage, placing the value into a buffer and returning the number of bytes that the entry in storage has beyond the offset.

Parameters
child_storage_keya pointer-size indicating the child storage key
keya pointer-size as defined in Definition D.3 indicating the key.
value_outa pointer-size as defined in Definition D.3 indicating the buffer to which the value will be written to. This function will never write more then the length of the buffer, even if the value's length is bigger.
offsetan i32 integer containing the offset beyond the value should be read from.
Returns
a pointer-size indicating the SCALE encoded Option containing the number of bytes written into the value_out buffer. Returns None if the entry does not exists.

Implemented in kagome::host_api::HostApiImpl.

virtual runtime::WasmSpan kagome::host_api::HostApi::ext_default_child_storage_root_version_1 ( runtime::WasmSpan  child_storage_key) const
pure virtual

Commits all existing operations and computes the resulting child storage root.

Parameters
child_storage_keya pointer-size indicating the child storage key
Returns
a pointer-size indicating the SCALE encoded storage root.

Implemented in kagome::host_api::HostApiImpl.

virtual void kagome::host_api::HostApi::ext_default_child_storage_set_version_1 ( runtime::WasmSpan  child_storage_key,
runtime::WasmSpan  key,
runtime::WasmSpan  value 
)
pure virtual

Sets the value under a given key into the child storage.

Parameters
child_storage_keya pointer-size indicating the child storage key
keya pointer-size indicating the key.
valuea pointer-size indicating the value.

Implemented in kagome::host_api::HostApiImpl.

virtual void kagome::host_api::HostApi::ext_default_child_storage_storage_kill_version_1 ( runtime::WasmSpan  child_storage_key)
pure virtual

Clears an entire child storage.

Parameters
child_storage_keya pointer-size indicating the child storage key

Implemented in kagome::host_api::HostApiImpl.

virtual runtime::WasmPointer kagome::host_api::HostApi::ext_hashing_blake2_128_version_1 ( runtime::WasmSpan  data)
pure virtual
virtual runtime::WasmPointer kagome::host_api::HostApi::ext_hashing_blake2_256_version_1 ( runtime::WasmSpan  data)
pure virtual
virtual runtime::WasmPointer kagome::host_api::HostApi::ext_hashing_keccak_256_version_1 ( runtime::WasmSpan  data)
pure virtual
virtual runtime::WasmPointer kagome::host_api::HostApi::ext_hashing_sha2_256_version_1 ( runtime::WasmSpan  data)
pure virtual
virtual runtime::WasmPointer kagome::host_api::HostApi::ext_hashing_twox_128_version_1 ( runtime::WasmSpan  data)
pure virtual
virtual runtime::WasmPointer kagome::host_api::HostApi::ext_hashing_twox_256_version_1 ( runtime::WasmSpan  data)
pure virtual
virtual runtime::WasmPointer kagome::host_api::HostApi::ext_hashing_twox_64_version_1 ( runtime::WasmSpan  data)
pure virtual
virtual void kagome::host_api::HostApi::ext_logging_log_version_1 ( runtime::WasmEnum  level,
runtime::WasmSpan  target,
runtime::WasmSpan  message 
)
pure virtual

Print a log message

Parameters
level- log level of the message
targetpointer-size value of the message source
messagepointer-size value of the message content

Implemented in kagome::host_api::HostApiImpl.

virtual runtime::WasmEnum kagome::host_api::HostApi::ext_logging_max_level_version_1 ( )
pure virtual

Get host max log level

Implemented in kagome::host_api::HostApiImpl.

virtual void kagome::host_api::HostApi::ext_misc_print_hex_version_1 ( runtime::WasmSpan  data) const
pure virtual

Print a hex value

Parameters
datapointer-size to an array of bytes with hex

Implemented in kagome::host_api::HostApiImpl.

virtual void kagome::host_api::HostApi::ext_misc_print_num_version_1 ( uint64_t  value) const
pure virtual

Print a number

Parameters
value- number to be printed

Implemented in kagome::host_api::HostApiImpl.

virtual void kagome::host_api::HostApi::ext_misc_print_utf8_version_1 ( runtime::WasmSpan  data) const
pure virtual

Print a UTF-8-encoded string

Parameters
datapointer-size to an array of bytes with UTF-8

Implemented in kagome::host_api::HostApiImpl.

virtual runtime::WasmSpan kagome::host_api::HostApi::ext_misc_runtime_version_version_1 ( runtime::WasmSpan  data) const
pure virtual
virtual runtime::WasmSpan kagome::host_api::HostApi::ext_offchain_http_request_add_header_version_1 ( runtime::WasmI32  request_id,
runtime::WasmSpan  name,
runtime::WasmSpan  value 
)
pure virtual
virtual runtime::WasmSpan kagome::host_api::HostApi::ext_offchain_http_request_start_version_1 ( runtime::WasmSpan  method,
runtime::WasmSpan  uri,
runtime::WasmSpan  meta 
)
pure virtual

Initiates a HTTP request given by the HTTP method and the URL. Returns the id of a newly started request.

1 (func $ext_offchain_http_request_start_version_1
2  (param $method i64)
3  (param $uri i64)
4  (param $meta i64)
5  (result i64)
6 )
Parameters
methoda pointer-size indicating the HTTP method. Possible values are "GET" and "POST"
uria pointer-size indicating the URI
metaa future-reserved field containing additional, SCALE encoded parameters. Currently, an empty array should be passed
Returns
a pointer-size indicating the SCALE encoded Result containing the i16 ID of the newly started request. On failure no additionally data is provided. The cause of failure is implementation specific

Implemented in kagome::host_api::HostApiImpl.

virtual runtime::WasmSpan kagome::host_api::HostApi::ext_offchain_http_request_write_body_version_1 ( runtime::WasmI32  request_id,
runtime::WasmSpan  chunk,
runtime::WasmSpan  deadline 
)
pure virtual
virtual runtime::WasmSpan kagome::host_api::HostApi::ext_offchain_http_response_headers_version_1 ( runtime::WasmI32  request_id)
pure virtual

Read all HTTP response headers. Returns an array of key/value pairs. Response headers must be read before the response body.

1 (func $ext_offchain_http_response_headers_version_1
2  (param $request_id i32)
3  (result i64)
4 )
Parameters
request_idan i32 integer indicating the ID of the started request
Returns
a pointer-size indicating a SCALE encoded array of key/value pairs

Implemented in kagome::host_api::HostApiImpl.

virtual runtime::WasmSpan kagome::host_api::HostApi::ext_offchain_http_response_read_body_version_1 ( runtime::WasmI32  request_id,
runtime::WasmSpan  buffer,
runtime::WasmSpan  deadline 
)
pure virtual
virtual runtime::WasmSpan kagome::host_api::HostApi::ext_offchain_http_response_wait_version_1 ( runtime::WasmSpan  ids,
runtime::WasmSpan  deadline 
)
pure virtual

Returns an array of request statuses (the length is the same as IDs). Note that if deadline is not provided the method will block indefinitely, otherwise unready responses will produce DeadlineReached status.

1 (func $ext_offchain_http_response_wait_version_1
2  (param $ids i64)
3  (param $deadline i64)
4  (result i64)
5 )
Parameters
idsa pointer-size indicating the SCALE encoded array of started request IDs
deadlinea pointer-size indicating the SCALE encoded Option containing the UNIX timestamp. Passing None blocks indefinitely
Returns
a pointer-size indicating the SCALE encoded array of request statuses

Implemented in kagome::host_api::HostApiImpl.

virtual void kagome::host_api::HostApi::ext_offchain_index_clear_version_1 ( runtime::WasmSpan  key)
pure virtual

Remove a key and its associated value from the offchain database.

1 (func $ext_offchain_index_clear_version_1 (param $key i64))
Parameters
keya pointer-size indicating the key

Implemented in kagome::host_api::HostApiImpl.

virtual void kagome::host_api::HostApi::ext_offchain_index_set_version_1 ( runtime::WasmSpan  key,
runtime::WasmSpan  value 
)
pure virtual

Write a key value pair to the offchain database in a buffered fashion.

1 (func $ext_offchain_index_set_version_1
2  (param $key i64)
3  (param $value i64)
4 )
Parameters
keya pointer-size indicating the key
valuea pointer-size indicating the value

Implemented in kagome::host_api::HostApiImpl.

virtual runtime::WasmI32 kagome::host_api::HostApi::ext_offchain_is_validator_version_1 ( )
pure virtual

Check whether the local node is a potential validator. Even if this function returns 1, it does not mean that any keys are configured or that the validator is registered in the chain.

1 (func $ext_offchain_is_validator_version_1 (return i8))
Returns
a boolean equal to true if the node is a validator, false if otherwise

Implemented in kagome::host_api::HostApiImpl.

virtual void kagome::host_api::HostApi::ext_offchain_local_storage_clear_version_1 ( runtime::WasmI32  kind,
runtime::WasmSpan  key 
)
pure virtual

Remove a value from the local storage.

1 (func $ext_offchain_local_storage_clear_version_1
2  (param $kind i32)
3  (param $key i64)
4 )
Parameters
kindan i32 integer indicating the storage kind. A value equal to 1 is used for a persistent storage and a value equal to 2 for local storage
keya pointer-size indicating the key

Implemented in kagome::host_api::HostApiImpl.

virtual runtime::WasmI32 kagome::host_api::HostApi::ext_offchain_local_storage_compare_and_set_version_1 ( runtime::WasmI32  kind,
runtime::WasmSpan  key,
runtime::WasmSpan  expected,
runtime::WasmSpan  value 
)
pure virtual
virtual runtime::WasmSpan kagome::host_api::HostApi::ext_offchain_local_storage_get_version_1 ( runtime::WasmI32  kind,
runtime::WasmSpan  key 
)
pure virtual

Gets a value from the local storage.

1 (func $ext_offchain_local_storage_get_version_1
2  (param $kind i32)
3  (param $key i64)
4  (result i64)
5 )
Parameters
kindan i32 integer indicating the storage kind. A value equal to 1 is used for a persistent storage and a value equal to 2 for local storage
keya pointer-size indicating the key
Returns
a pointer-size indicating the SCALE encoded Option containing the value or the corresponding key

Implemented in kagome::host_api::HostApiImpl.

virtual void kagome::host_api::HostApi::ext_offchain_local_storage_set_version_1 ( runtime::WasmI32  kind,
runtime::WasmSpan  key,
runtime::WasmSpan  value 
)
pure virtual

Sets a value in the local storage. This storage is not part of the consensus, it's only accessible by the offchain worker tasks running on the same machine and is persisted between runs.

1 (func $ext_offchain_local_storage_set_version_1
2  (param $kind i32)
3  (param $key i64)
4  (param $value i64)
5 )
Parameters
kindan i32 integer indicating the storage kind. A value equal to 1 is used for a persistent storage and a value equal to 2 for local storage
keya pointer-size indicating the key
valuea pointer-size indicating the value

Implemented in kagome::host_api::HostApiImpl.

virtual runtime::WasmSpan kagome::host_api::HostApi::ext_offchain_network_state_version_1 ( )
pure virtual

Returns the SCALE encoded, opaque information about the local node's network state.

1 (func $ext_offchain_network_state_version_1 (result i64))
Returns
SCALE encoded Result. On success it contains the OpaqueNetworkState structure. On failure, an empty value is yielded where its cause is implementation specific

Implemented in kagome::host_api::HostApiImpl.

virtual runtime::WasmPointer kagome::host_api::HostApi::ext_offchain_random_seed_version_1 ( )
pure virtual

Generates a random seed. This is a truly random non deterministic seed generated by the host environment.

1 (func $ext_offchain_random_seed_version_1 (result i32))
Returns
a 32-bit pointer to the buffer containing the 256-bit seed

Implemented in kagome::host_api::HostApiImpl.

virtual void kagome::host_api::HostApi::ext_offchain_set_authorized_nodes_version_1 ( runtime::WasmSpan  nodes,
runtime::WasmI32  authorized_only 
)
pure virtual

Set the authorized nodes which are allowed to connect to the local node. This function is offered by the Substrate codebase and is primarily used for custom, non-Polkadot/Kusama chains. It is not required for the public and open Polkadot protocol.

1 (func $ext_offchain_set_authorized_nodes_version_1
2  (param $nodes i64)
3  (param $authorized_only i32)
4 )
Parameters
nodesa pointer-size indicating the SCALE encoded array of libp2p PeerId's. Invalid PeerId's are silently ignored
authorized_onlyIf set to 1, then only the authorized nodes are allowed to connect to the local node (whitelist). All other nodes are rejected. If set to 0, then no such restriction is placed

Implemented in kagome::host_api::HostApiImpl.

virtual void kagome::host_api::HostApi::ext_offchain_sleep_until_version_1 ( runtime::WasmU64  deadline)
pure virtual

Pause the execution until deadline is reached.

1 (func $ext_offchain_sleep_until_version_1 (param $deadline u64))
Parameters
deadlinean u64 integer indicating the current UNIX timestamp (milliseconds)

Implemented in kagome::host_api::HostApiImpl.

virtual runtime::WasmSpan kagome::host_api::HostApi::ext_offchain_submit_transaction_version_1 ( runtime::WasmSpan  data)
pure virtual

Given a SCALE encoded extrinsic, this function submits the extrinsic to the Host's transaction pool, ready to be propagated to remote peers.

1 (func $ext_offchain_submit_transaction_version_1
2  (param $data i64)
3  (return i64)
4 )
Parameters
databyte array storing the encoded extrinsic
Returns
SCALE encoded Result. Neither on success or failure is there any additional data provided

Implemented in kagome::host_api::HostApiImpl.

virtual runtime::WasmU64 kagome::host_api::HostApi::ext_offchain_timestamp_version_1 ( )
pure virtual

Returns current timestamp.

1 (func $ext_offchain_timestamp_version_1 (result u64))
Returns
an u64 integer indicating the current UNIX timestamp (milliseconds)

Implemented in kagome::host_api::HostApiImpl.

virtual void kagome::host_api::HostApi::ext_storage_append_version_1 ( runtime::WasmSpan  key,
runtime::WasmSpan  value 
) const
pure virtual

Appends the scale encoded value to the scale encoded storage item at the given key

Parameters
keymemory span containing key
valuememory span containing value that should be appended to storage item under the
key
Note
This assumes specific format of the storage item. Also there is no way to undo this operation.

Implemented in kagome::host_api::HostApiImpl.

virtual runtime::WasmSpan kagome::host_api::HostApi::ext_storage_changes_root_version_1 ( runtime::WasmSpan  parent_hash)
pure virtual

Commits all existing operations and gets the resulting change root. The parent hash is a SCALE encoded change root.

Parameters
parent_hashwasm span containing parent hash
Returns
wasm span containing scale-encoded optional change root

Implemented in kagome::host_api::HostApiImpl.

virtual void kagome::host_api::HostApi::ext_storage_clear_prefix_version_1 ( runtime::WasmSpan  prefix)
pure virtual

Clear the storage of each key/value pair where the key starts with the given prefix.

Parameters
prefixmemory span containing prefix

Implemented in kagome::host_api::HostApiImpl.

virtual runtime::WasmSpan kagome::host_api::HostApi::ext_storage_clear_prefix_version_2 ( runtime::WasmSpan  prefix,
runtime::WasmSpan  limit 
)
pure virtual

Clear the storage of each key/value pair where the key starts with the given prefix.

Parameters
prefixmemory span containing prefix
limitof entries to be removed

Implemented in kagome::host_api::HostApiImpl.

virtual void kagome::host_api::HostApi::ext_storage_clear_version_1 ( runtime::WasmSpan  key_data)
pure virtual

Clears the storage of the given key and its value.

Parameters
key_datamemory span containing key

Implemented in kagome::host_api::HostApiImpl.

virtual void kagome::host_api::HostApi::ext_storage_commit_transaction_version_1 ( )
pure virtual

Commit the last transaction started by ext_storage_start_transaction. Any changes made during that transaction are committed to the main state.

Implemented in kagome::host_api::HostApiImpl.

virtual runtime::WasmSize kagome::host_api::HostApi::ext_storage_exists_version_1 ( runtime::WasmSpan  key_data) const
pure virtual

Checks whether the given key exists in storage.

Parameters
key_datamemory span containing key
Returns
an i32 integer value equal to 1 if the key exists or a value equal to 0 if otherwise.

Implemented in kagome::host_api::HostApiImpl.

virtual runtime::WasmSpan kagome::host_api::HostApi::ext_storage_get_version_1 ( runtime::WasmSpan  key)
pure virtual

Retrieves the value associated with the given key from storage.

Parameters
keykey memory span containing key
Returns
value memory span containing scale-encoded optional value

Implemented in kagome::host_api::HostApiImpl.

virtual runtime::WasmSpan kagome::host_api::HostApi::ext_storage_next_key_version_1 ( runtime::WasmSpan  key) const
pure virtual

Gets the next key in storage after the given one in lexicographic order.

Parameters
keymemory span containing key
Returns
wasm span containing scale-encoded optional next key

Implemented in kagome::host_api::HostApiImpl.

virtual runtime::WasmSpan kagome::host_api::HostApi::ext_storage_read_version_1 ( runtime::WasmSpan  key,
runtime::WasmSpan  value_out,
runtime::WasmOffset  offset 
)
pure virtual

Reads data from storage with the given key.

Parameters
keypointer-size to the key
value_outpointer-size to the read data
offsetin bytes from the data block begin should be read

Implemented in kagome::host_api::HostApiImpl.

virtual void kagome::host_api::HostApi::ext_storage_rollback_transaction_version_1 ( )
pure virtual

Rollback the last transaction started by ext_storage_start_transaction. Any changes made during that transaction are discarded.

Implemented in kagome::host_api::HostApiImpl.

virtual runtime::WasmSpan kagome::host_api::HostApi::ext_storage_root_version_1 ( )
pure virtual

Commits all existing operations and computes the resulting storage root.

Returns
memory span containing scale-encoded storage root

Implemented in kagome::host_api::HostApiImpl.

virtual runtime::WasmSpan kagome::host_api::HostApi::ext_storage_root_version_2 ( runtime::WasmI32  state_version)
pure virtual

Commits all existing operations and computes the resulting storage root.

Parameters
state_version- is using state version, where 0 - state version 1 1 - node hashes
Returns
pointer to memory containing scale-encoded storage root

Implemented in kagome::host_api::HostApiImpl.

virtual void kagome::host_api::HostApi::ext_storage_set_version_1 ( runtime::WasmSpan  key,
runtime::WasmSpan  value 
)
pure virtual

Sets the value under a given key into storage.

Parameters
keymemory span containing key
valuememory span containing value

Implemented in kagome::host_api::HostApiImpl.

virtual void kagome::host_api::HostApi::ext_storage_start_transaction_version_1 ( )
pure virtual

Start a new nested transaction. This allows to either commit or roll back all changes that are made after this call. For every transaction there must be a matching call to either ext_storage_rollback_transaction or ext_storage_commit_transaction.

Implemented in kagome::host_api::HostApiImpl.

virtual runtime::WasmPointer kagome::host_api::HostApi::ext_trie_blake2_256_ordered_root_version_1 ( runtime::WasmSpan  values_data)
pure virtual

Conducts a 256-bit Blake2 trie root formed from the enumerated items.

Parameters
values_datawasm span containing the enumerated items from which the trie root gets formed. The items consist of a SCALE encoded array containing only values, where the corresponding key of each value is the index of the item in the array, starting at 0. The keys are little-endian, fixed-size integers.
Returns
wasm span containing the 256-bit trie root result

Implemented in kagome::host_api::HostApiImpl.

virtual runtime::WasmPointer kagome::host_api::HostApi::ext_trie_blake2_256_ordered_root_version_2 ( runtime::WasmSpan  values_data,
runtime::WasmI32  state_version 
)
pure virtual
virtual runtime::WasmPointer kagome::host_api::HostApi::ext_trie_blake2_256_root_version_1 ( runtime::WasmSpan  values_data)
pure virtual

Conducts a 256-bit Blake2 trie root formed from the iterated items.

Parameters
values_datawasm span containing the iterated items from which the trie root gets formed. The items consist of a SCALE encoded array containing arbitrary key/value pairs.
Returns
wasm span containing the 256-bit trie root result

Implemented in kagome::host_api::HostApiImpl.

virtual void kagome::host_api::HostApi::reset ( )
pure virtual

The documentation for this class was generated from the following file: