Kagome
Polkadot Runtime Engine in C++17
kagome::host_api::HostApiImpl Class Reference

#include <host_api_impl.hpp>

Inheritance diagram for kagome::host_api::HostApiImpl:
Collaboration diagram for kagome::host_api::HostApiImpl:

Public Member Functions

 HostApiImpl ()=delete
 
 HostApiImpl (const OffchainExtensionConfig &offchain_config, std::shared_ptr< const runtime::MemoryProvider > memory_provider, std::shared_ptr< const runtime::CoreApiFactory > core_provider, std::shared_ptr< runtime::TrieStorageProvider > storage_provider, std::shared_ptr< const crypto::Sr25519Provider > sr25519_provider, std::shared_ptr< const crypto::EcdsaProvider > ecdsa_provider, std::shared_ptr< const crypto::Ed25519Provider > ed25519_provider, std::shared_ptr< const crypto::Secp256k1Provider > secp256k1_provider, std::shared_ptr< const crypto::Hasher > hasher, std::shared_ptr< crypto::CryptoStore > crypto_store, std::shared_ptr< const crypto::Bip39Provider > bip39_provider, std::shared_ptr< offchain::OffchainPersistentStorage > offchain_persistent_storage, std::shared_ptr< offchain::OffchainWorkerPool > offchain_worker_pool)
 
 ~HostApiImpl () override=default
 
void reset () override
 
runtime::WasmSpan ext_storage_read_version_1 (runtime::WasmSpan key, runtime::WasmSpan value_out, runtime::WasmOffset offset) override
 Reads data from storage with the given key. More...
 
void ext_storage_set_version_1 (runtime::WasmSpan key, runtime::WasmSpan value) override
 Sets the value under a given key into storage. More...
 
runtime::WasmSpan ext_storage_get_version_1 (runtime::WasmSpan key) override
 Retrieves the value associated with the given key from storage. More...
 
void ext_storage_clear_version_1 (runtime::WasmSpan key_data) override
 Clears the storage of the given key and its value. More...
 
runtime::WasmSize ext_storage_exists_version_1 (runtime::WasmSpan key_data) const override
 Checks whether the given key exists in storage. More...
 
void ext_storage_clear_prefix_version_1 (runtime::WasmSpan prefix) override
 Clear the storage of each key/value pair where the key starts with the given prefix. More...
 
runtime::WasmSpan ext_storage_clear_prefix_version_2 (runtime::WasmSpan prefix, runtime::WasmSpan limit) override
 Clear the storage of each key/value pair where the key starts with the given prefix. More...
 
runtime::WasmSpan ext_storage_root_version_1 () override
 Commits all existing operations and computes the resulting storage root. More...
 
runtime::WasmSpan ext_storage_root_version_2 (runtime::WasmI32 state_version) override
 Commits all existing operations and computes the resulting storage root. More...
 
runtime::WasmSpan ext_storage_changes_root_version_1 (runtime::WasmSpan parent_hash) override
 
void ext_storage_start_transaction_version_1 () override
 
void ext_storage_rollback_transaction_version_1 () override
 
void ext_storage_commit_transaction_version_1 () override
 
runtime::WasmSpan ext_storage_next_key_version_1 (runtime::WasmSpan key) const override
 
void ext_storage_append_version_1 (runtime::WasmSpan key, runtime::WasmSpan value) const override
 
runtime::WasmPointer ext_trie_blake2_256_root_version_1 (runtime::WasmSpan values_data) override
 
runtime::WasmPointer ext_trie_blake2_256_ordered_root_version_1 (runtime::WasmSpan values_data) override
 
runtime::WasmPointer ext_trie_blake2_256_ordered_root_version_2 (runtime::WasmSpan values_data, runtime::WasmI32 state_version) override
 
runtime::WasmPointer ext_allocator_malloc_version_1 (runtime::WasmSize size) override
 
void ext_allocator_free_version_1 (runtime::WasmPointer ptr) override
 
void ext_crypto_start_batch_verify_version_1 () override
 Crypto extensions v1. More...
 
int32_t ext_crypto_finish_batch_verify_version_1 () override
 Finish verifying the batch of signatures since the last call to this function. Blocks until all the signatures are verified. More...
 
runtime::WasmSpan ext_crypto_secp256k1_ecdsa_recover_version_1 (runtime::WasmPointer sig, runtime::WasmPointer msg) override
 
runtime::WasmSpan ext_crypto_secp256k1_ecdsa_recover_version_2 (runtime::WasmPointer sig, runtime::WasmPointer msg) override
 
runtime::WasmSpan ext_crypto_secp256k1_ecdsa_recover_compressed_version_1 (runtime::WasmPointer sig, runtime::WasmPointer msg) override
 
runtime::WasmSpan ext_crypto_secp256k1_ecdsa_recover_compressed_version_2 (runtime::WasmPointer sig, runtime::WasmPointer msg) override
 
runtime::WasmSpan ext_crypto_ed25519_public_keys_version_1 (runtime::WasmSize key_type) override
 
runtime::WasmPointer ext_crypto_ed25519_generate_version_1 (runtime::WasmSize key_type, runtime::WasmSpan seed) override
 
runtime::WasmSpan ext_crypto_ed25519_sign_version_1 (runtime::WasmSize key_type, runtime::WasmPointer key, runtime::WasmSpan msg_data) override
 
runtime::WasmSize ext_crypto_ed25519_verify_version_1 (runtime::WasmPointer sig_data, runtime::WasmSpan msg, runtime::WasmPointer pubkey_data) override
 
runtime::WasmSpan ext_crypto_sr25519_public_keys_version_1 (runtime::WasmSize key_type) override
 
runtime::WasmPointer ext_crypto_sr25519_generate_version_1 (runtime::WasmSize key_type, runtime::WasmSpan seed) override
 
runtime::WasmSpan ext_crypto_sr25519_sign_version_1 (runtime::WasmSize key_type, runtime::WasmPointer key, runtime::WasmSpan msg_data) override
 
int32_t ext_crypto_sr25519_verify_version_1 (runtime::WasmPointer sig_data, runtime::WasmSpan msg, runtime::WasmPointer pubkey_data) override
 
int32_t ext_crypto_sr25519_verify_version_2 (runtime::WasmPointer, runtime::WasmSpan, runtime::WasmPointer) override
 
runtime::WasmSpan ext_crypto_ecdsa_public_keys_version_1 (runtime::WasmSize key_type) override
 
runtime::WasmSpan ext_crypto_ecdsa_sign_version_1 (runtime::WasmSize key_type, runtime::WasmPointer key, runtime::WasmSpan msg_data) override
 
runtime::WasmSpan ext_crypto_ecdsa_sign_prehashed_version_1 (runtime::WasmSize key_type, runtime::WasmPointer key, runtime::WasmSpan msg_data) override
 
runtime::WasmPointer ext_crypto_ecdsa_generate_version_1 (runtime::WasmSize key_type_id, runtime::WasmSpan seed) override
 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...
 
int32_t ext_crypto_ecdsa_verify_version_1 (runtime::WasmPointer sig, runtime::WasmSpan msg, runtime::WasmPointer key) override
 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...
 
int32_t ext_crypto_ecdsa_verify_prehashed_version_1 (runtime::WasmPointer sig, runtime::WasmSpan msg, runtime::WasmPointer key) override
 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...
 
runtime::WasmPointer ext_hashing_keccak_256_version_1 (runtime::WasmSpan data) override
 
runtime::WasmPointer ext_hashing_sha2_256_version_1 (runtime::WasmSpan data) override
 
runtime::WasmPointer ext_hashing_blake2_128_version_1 (runtime::WasmSpan data) override
 
runtime::WasmPointer ext_hashing_blake2_256_version_1 (runtime::WasmSpan data) override
 
runtime::WasmPointer ext_hashing_twox_64_version_1 (runtime::WasmSpan data) override
 
runtime::WasmPointer ext_hashing_twox_128_version_1 (runtime::WasmSpan data) override
 
runtime::WasmPointer ext_hashing_twox_256_version_1 (runtime::WasmSpan data) override
 
void ext_logging_log_version_1 (runtime::WasmEnum level, runtime::WasmSpan target, runtime::WasmSpan message) override
 
runtime::WasmEnum ext_logging_max_level_version_1 () override
 
runtime::WasmSpan ext_misc_runtime_version_version_1 (runtime::WasmSpan data) const override
 
void ext_misc_print_hex_version_1 (runtime::WasmSpan data) const override
 
void ext_misc_print_num_version_1 (uint64_t value) const override
 
void ext_misc_print_utf8_version_1 (runtime::WasmSpan data) const override
 
runtime::WasmI32 ext_offchain_is_validator_version_1 () override
 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...
 
runtime::WasmSpan ext_offchain_submit_transaction_version_1 (runtime::WasmSpan data) override
 Given a SCALE encoded extrinsic, this function submits the extrinsic to the Host's transaction pool, ready to be propagated to remote peers. More...
 
runtime::WasmSpan ext_offchain_network_state_version_1 () override
 Returns the SCALE encoded, opaque information about the local node's network state. More...
 
runtime::WasmU64 ext_offchain_timestamp_version_1 () override
 Returns current timestamp. More...
 
void ext_offchain_sleep_until_version_1 (runtime::WasmU64 deadline) override
 Pause the execution until deadline is reached. More...
 
runtime::WasmPointer ext_offchain_random_seed_version_1 () override
 Generates a random seed. This is a truly random non deterministic seed generated by the host environment. More...
 
void ext_offchain_local_storage_set_version_1 (runtime::WasmI32 kind, runtime::WasmSpan key, runtime::WasmSpan value) override
 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...
 
void ext_offchain_local_storage_clear_version_1 (runtime::WasmI32 kind, runtime::WasmSpan key) override
 Remove a value from the local storage. More...
 
runtime::WasmI32 ext_offchain_local_storage_compare_and_set_version_1 (runtime::WasmI32 kind, runtime::WasmSpan key, runtime::WasmSpan expected, runtime::WasmSpan value) override
 
runtime::WasmSpan ext_offchain_local_storage_get_version_1 (runtime::WasmI32 kind, runtime::WasmSpan key) override
 Gets a value from the local storage. More...
 
runtime::WasmSpan ext_offchain_http_request_start_version_1 (runtime::WasmSpan method, runtime::WasmSpan uri, runtime::WasmSpan meta) override
 Initiates a HTTP request given by the HTTP method and the URL. Returns the id of a newly started request. More...
 
runtime::WasmSpan ext_offchain_http_request_add_header_version_1 (runtime::WasmI32 request_id, runtime::WasmSpan name, runtime::WasmSpan value) override
 
runtime::WasmSpan ext_offchain_http_request_write_body_version_1 (runtime::WasmI32 request_id, runtime::WasmSpan chunk, runtime::WasmSpan deadline) override
 
runtime::WasmSpan ext_offchain_http_response_wait_version_1 (runtime::WasmSpan ids, runtime::WasmSpan deadline) override
 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...
 
runtime::WasmSpan ext_offchain_http_response_headers_version_1 (runtime::WasmI32 request_id) override
 Read all HTTP response headers. Returns an array of key/value pairs. Response headers must be read before the response body. More...
 
runtime::WasmSpan ext_offchain_http_response_read_body_version_1 (runtime::WasmI32 request_id, runtime::WasmSpan buffer, runtime::WasmSpan deadline) override
 
void ext_offchain_set_authorized_nodes_version_1 (runtime::WasmSpan nodes, runtime::WasmI32 authorized_only) override
 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...
 
void ext_offchain_index_set_version_1 (runtime::WasmSpan key, runtime::WasmSpan value) override
 Write a key value pair to the offchain database in a buffered fashion. More...
 
void ext_offchain_index_clear_version_1 (runtime::WasmSpan key) override
 Remove a key and its associated value from the offchain database. More...
 
void ext_default_child_storage_set_version_1 (runtime::WasmSpan child_storage_key, runtime::WasmSpan key, runtime::WasmSpan value) override
 Sets the value under a given key into the child storage. More...
 
runtime::WasmSpan ext_default_child_storage_get_version_1 (runtime::WasmSpan child_storage_key, runtime::WasmSpan key) const override
 Retrieves the value associated with the given key from the child storage. More...
 
void ext_default_child_storage_clear_version_1 (runtime::WasmSpan child_storage_key, runtime::WasmSpan key) override
 Clears the storage of the given key and its value from the child storage. More...
 
runtime::WasmSpan ext_default_child_storage_next_key_version_1 (runtime::WasmSpan child_storage_key, runtime::WasmSpan key) const override
 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...
 
runtime::WasmSpan ext_default_child_storage_root_version_1 (runtime::WasmSpan child_storage_key) const override
 Commits all existing operations and computes the resulting child storage root. More...
 
void ext_default_child_storage_clear_prefix_version_1 (runtime::WasmSpan child_storage_key, runtime::WasmSpan prefix) override
 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 override
 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 override
 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) override
 Clears an entire child storage. More...
 
- Public Member Functions inherited from kagome::host_api::HostApi
virtual ~HostApi ()=default
 

Private Attributes

std::shared_ptr< const runtime::MemoryProvidermemory_provider_
 
std::shared_ptr< runtime::TrieStorageProviderstorage_provider_
 
CryptoExtension crypto_ext_
 
IOExtension io_ext_
 
MemoryExtension memory_ext_
 
MiscExtension misc_ext_
 
StorageExtension storage_ext_
 
ChildStorageExtension child_storage_ext_
 
OffchainExtension offchain_ext_
 

Static Private Attributes

static constexpr uint64_t DEFAULT_CHAIN_ID = 42
 

Detailed Description

Fair implementation of the extensions interface

Definition at line 33 of file host_api_impl.hpp.

Constructor & Destructor Documentation

kagome::host_api::HostApiImpl::HostApiImpl ( )
delete
kagome::host_api::HostApiImpl::HostApiImpl ( const OffchainExtensionConfig offchain_config,
std::shared_ptr< const runtime::MemoryProvider memory_provider,
std::shared_ptr< const runtime::CoreApiFactory core_provider,
std::shared_ptr< runtime::TrieStorageProvider storage_provider,
std::shared_ptr< const crypto::Sr25519Provider sr25519_provider,
std::shared_ptr< const crypto::EcdsaProvider ecdsa_provider,
std::shared_ptr< const crypto::Ed25519Provider ed25519_provider,
std::shared_ptr< const crypto::Secp256k1Provider secp256k1_provider,
std::shared_ptr< const crypto::Hasher hasher,
std::shared_ptr< crypto::CryptoStore crypto_store,
std::shared_ptr< const crypto::Bip39Provider bip39_provider,
std::shared_ptr< offchain::OffchainPersistentStorage offchain_persistent_storage,
std::shared_ptr< offchain::OffchainWorkerPool offchain_worker_pool 
)

Definition at line 21 of file host_api_impl.cpp.

kagome::host_api::HostApiImpl::~HostApiImpl ( )
overridedefault

Member Function Documentation

void kagome::host_api::HostApiImpl::ext_allocator_free_version_1 ( runtime::WasmPointer  ptr)
overridevirtual
See also
Extension::ext_free

Implements kagome::host_api::HostApi.

Definition at line 163 of file host_api_impl.cpp.

runtime::WasmPointer kagome::host_api::HostApiImpl::ext_allocator_malloc_version_1 ( runtime::WasmSize  size)
overridevirtual
See also
Extension::ext_malloc

Implements kagome::host_api::HostApi.

Definition at line 158 of file host_api_impl.cpp.

runtime::WasmPointer kagome::host_api::HostApiImpl::ext_crypto_ecdsa_generate_version_1 ( runtime::WasmSize  key_type,
runtime::WasmSpan  seed 
)
overridevirtual

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

Implements kagome::host_api::HostApi.

Definition at line 267 of file host_api_impl.cpp.

runtime::WasmSpan kagome::host_api::HostApiImpl::ext_crypto_ecdsa_public_keys_version_1 ( runtime::WasmSize  key_type)
overridevirtual
See also
Extension::ext_crypto_ecdsa_public_keys

Implements kagome::host_api::HostApi.

Definition at line 247 of file host_api_impl.cpp.

runtime::WasmSpan kagome::host_api::HostApiImpl::ext_crypto_ecdsa_sign_prehashed_version_1 ( runtime::WasmSize  key_type,
runtime::WasmPointer  key,
runtime::WasmSpan  msg_data 
)
overridevirtual

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.

Implements kagome::host_api::HostApi.

Definition at line 259 of file host_api_impl.cpp.

runtime::WasmSpan kagome::host_api::HostApiImpl::ext_crypto_ecdsa_sign_version_1 ( runtime::WasmSize  key_type,
runtime::WasmPointer  key,
runtime::WasmSpan  msg_data 
)
overridevirtual
See also
Extension::ext_crypto_ecdsa_sign

Implements kagome::host_api::HostApi.

Definition at line 252 of file host_api_impl.cpp.

int32_t kagome::host_api::HostApiImpl::ext_crypto_ecdsa_verify_prehashed_version_1 ( runtime::WasmPointer  sig_data,
runtime::WasmSpan  msg,
runtime::WasmPointer  pubkey_data 
)
overridevirtual

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.

Implements kagome::host_api::HostApi.

Definition at line 279 of file host_api_impl.cpp.

int32_t kagome::host_api::HostApiImpl::ext_crypto_ecdsa_verify_version_1 ( runtime::WasmPointer  sig_data,
runtime::WasmSpan  msg,
runtime::WasmPointer  pubkey_data 
)
overridevirtual

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.

Implements kagome::host_api::HostApi.

Definition at line 272 of file host_api_impl.cpp.

runtime::WasmPointer kagome::host_api::HostApiImpl::ext_crypto_ed25519_generate_version_1 ( runtime::WasmSize  key_type,
runtime::WasmSpan  seed 
)
overridevirtual
See also
Extension::ext_ed25519_generate

Implements kagome::host_api::HostApi.

Definition at line 192 of file host_api_impl.cpp.

runtime::WasmSpan kagome::host_api::HostApiImpl::ext_crypto_ed25519_public_keys_version_1 ( runtime::WasmSize  key_type)
overridevirtual
See also
Extension::ext_ed25519_public_keys

Implements kagome::host_api::HostApi.

Definition at line 187 of file host_api_impl.cpp.

runtime::WasmSpan kagome::host_api::HostApiImpl::ext_crypto_ed25519_sign_version_1 ( runtime::WasmSize  key_type,
runtime::WasmPointer  key,
runtime::WasmSpan  msg_data 
)
overridevirtual
See also
Extension::ext_ed25519_sign

Implements kagome::host_api::HostApi.

Definition at line 197 of file host_api_impl.cpp.

runtime::WasmSize kagome::host_api::HostApiImpl::ext_crypto_ed25519_verify_version_1 ( runtime::WasmPointer  sig_data,
runtime::WasmSpan  msg,
runtime::WasmPointer  pubkey_data 
)
overridevirtual
See also
Extension::ext_ed25519_verify

Implements kagome::host_api::HostApi.

Definition at line 205 of file host_api_impl.cpp.

int32_t kagome::host_api::HostApiImpl::ext_crypto_finish_batch_verify_version_1 ( )
overridevirtual

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.

Implements kagome::host_api::HostApi.

Definition at line 183 of file host_api_impl.cpp.

runtime::WasmSpan kagome::host_api::HostApiImpl::ext_crypto_secp256k1_ecdsa_recover_compressed_version_1 ( runtime::WasmPointer  sig,
runtime::WasmPointer  msg 
)
overridevirtual

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

Implements kagome::host_api::HostApi.

Definition at line 353 of file host_api_impl.cpp.

runtime::WasmSpan kagome::host_api::HostApiImpl::ext_crypto_secp256k1_ecdsa_recover_compressed_version_2 ( runtime::WasmPointer  sig,
runtime::WasmPointer  msg 
)
overridevirtual

Implements kagome::host_api::HostApi.

Definition at line 360 of file host_api_impl.cpp.

runtime::WasmSpan kagome::host_api::HostApiImpl::ext_crypto_secp256k1_ecdsa_recover_version_1 ( runtime::WasmPointer  sig,
runtime::WasmPointer  msg 
)
overridevirtual

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

Implements kagome::host_api::HostApi.

Definition at line 342 of file host_api_impl.cpp.

runtime::WasmSpan kagome::host_api::HostApiImpl::ext_crypto_secp256k1_ecdsa_recover_version_2 ( runtime::WasmPointer  sig,
runtime::WasmPointer  msg 
)
overridevirtual

Implements kagome::host_api::HostApi.

Definition at line 347 of file host_api_impl.cpp.

runtime::WasmPointer kagome::host_api::HostApiImpl::ext_crypto_sr25519_generate_version_1 ( runtime::WasmSize  key_type,
runtime::WasmSpan  seed 
)
overridevirtual
See also
Extension::ext_sr25519_generate

Implements kagome::host_api::HostApi.

Definition at line 218 of file host_api_impl.cpp.

runtime::WasmSpan kagome::host_api::HostApiImpl::ext_crypto_sr25519_public_keys_version_1 ( runtime::WasmSize  key_type)
overridevirtual
See also
Extension::ext_sr25519_public_keys

Implements kagome::host_api::HostApi.

Definition at line 213 of file host_api_impl.cpp.

runtime::WasmSpan kagome::host_api::HostApiImpl::ext_crypto_sr25519_sign_version_1 ( runtime::WasmSize  key_type,
runtime::WasmPointer  key,
runtime::WasmSpan  msg_data 
)
overridevirtual
See also
Extension::ext_sr25519_sign

Implements kagome::host_api::HostApi.

Definition at line 223 of file host_api_impl.cpp.

int32_t kagome::host_api::HostApiImpl::ext_crypto_sr25519_verify_version_1 ( runtime::WasmPointer  sig_data,
runtime::WasmSpan  msg,
runtime::WasmPointer  pubkey_data 
)
overridevirtual

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

Implements kagome::host_api::HostApi.

Definition at line 231 of file host_api_impl.cpp.

int32_t kagome::host_api::HostApiImpl::ext_crypto_sr25519_verify_version_2 ( runtime::WasmPointer  sig_data,
runtime::WasmSpan  msg,
runtime::WasmPointer  pubkey_data 
)
overridevirtual

Implements kagome::host_api::HostApi.

Definition at line 239 of file host_api_impl.cpp.

void kagome::host_api::HostApiImpl::ext_crypto_start_batch_verify_version_1 ( )
overridevirtual

Crypto extensions v1.

Implements kagome::host_api::HostApi.

Definition at line 179 of file host_api_impl.cpp.

void kagome::host_api::HostApiImpl::ext_default_child_storage_clear_prefix_version_1 ( runtime::WasmSpan  child_storage_key,
runtime::WasmSpan  prefix 
)
overridevirtual

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

Implements kagome::host_api::HostApi.

Definition at line 509 of file host_api_impl.cpp.

void kagome::host_api::HostApiImpl::ext_default_child_storage_clear_version_1 ( runtime::WasmSpan  child_storage_key,
runtime::WasmSpan  key 
)
overridevirtual

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

Implements kagome::host_api::HostApi.

Definition at line 491 of file host_api_impl.cpp.

uint32_t kagome::host_api::HostApiImpl::ext_default_child_storage_exists_version_1 ( runtime::WasmSpan  child_storage_key,
runtime::WasmSpan  key 
) const
overridevirtual

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.

Implements kagome::host_api::HostApi.

Definition at line 524 of file host_api_impl.cpp.

runtime::WasmSpan kagome::host_api::HostApiImpl::ext_default_child_storage_get_version_1 ( runtime::WasmSpan  child_storage_key,
runtime::WasmSpan  key 
) const
overridevirtual

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.

Implements kagome::host_api::HostApi.

Definition at line 485 of file host_api_impl.cpp.

runtime::WasmSpan kagome::host_api::HostApiImpl::ext_default_child_storage_next_key_version_1 ( runtime::WasmSpan  child_storage_key,
runtime::WasmSpan  key 
) const
overridevirtual

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.

Implements kagome::host_api::HostApi.

Definition at line 497 of file host_api_impl.cpp.

runtime::WasmSpan kagome::host_api::HostApiImpl::ext_default_child_storage_read_version_1 ( runtime::WasmSpan  child_storage_key,
runtime::WasmSpan  key,
runtime::WasmSpan  value_out,
runtime::WasmOffset  offset 
) const
overridevirtual

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.

Implements kagome::host_api::HostApi.

Definition at line 515 of file host_api_impl.cpp.

runtime::WasmSpan kagome::host_api::HostApiImpl::ext_default_child_storage_root_version_1 ( runtime::WasmSpan  child_storage_key) const
overridevirtual

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.

Implements kagome::host_api::HostApi.

Definition at line 503 of file host_api_impl.cpp.

void kagome::host_api::HostApiImpl::ext_default_child_storage_set_version_1 ( runtime::WasmSpan  child_storage_key,
runtime::WasmSpan  key,
runtime::WasmSpan  value 
)
overridevirtual

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.

Implements kagome::host_api::HostApi.

Definition at line 477 of file host_api_impl.cpp.

void kagome::host_api::HostApiImpl::ext_default_child_storage_storage_kill_version_1 ( runtime::WasmSpan  child_storage_key)
overridevirtual

Clears an entire child storage.

Parameters
child_storage_keya pointer-size indicating the child storage key

Implements kagome::host_api::HostApi.

Definition at line 530 of file host_api_impl.cpp.

runtime::WasmPointer kagome::host_api::HostApiImpl::ext_hashing_blake2_128_version_1 ( runtime::WasmSpan  data)
overridevirtual

Implements kagome::host_api::HostApi.

Definition at line 299 of file host_api_impl.cpp.

runtime::WasmPointer kagome::host_api::HostApiImpl::ext_hashing_blake2_256_version_1 ( runtime::WasmSpan  data)
overridevirtual

Implements kagome::host_api::HostApi.

Definition at line 304 of file host_api_impl.cpp.

runtime::WasmPointer kagome::host_api::HostApiImpl::ext_hashing_keccak_256_version_1 ( runtime::WasmSpan  data)
overridevirtual

Implements kagome::host_api::HostApi.

Definition at line 289 of file host_api_impl.cpp.

runtime::WasmPointer kagome::host_api::HostApiImpl::ext_hashing_sha2_256_version_1 ( runtime::WasmSpan  data)
overridevirtual

Implements kagome::host_api::HostApi.

Definition at line 294 of file host_api_impl.cpp.

runtime::WasmPointer kagome::host_api::HostApiImpl::ext_hashing_twox_128_version_1 ( runtime::WasmSpan  data)
overridevirtual

Implements kagome::host_api::HostApi.

Definition at line 314 of file host_api_impl.cpp.

runtime::WasmPointer kagome::host_api::HostApiImpl::ext_hashing_twox_256_version_1 ( runtime::WasmSpan  data)
overridevirtual

Implements kagome::host_api::HostApi.

Definition at line 319 of file host_api_impl.cpp.

runtime::WasmPointer kagome::host_api::HostApiImpl::ext_hashing_twox_64_version_1 ( runtime::WasmSpan  data)
overridevirtual

Implements kagome::host_api::HostApi.

Definition at line 309 of file host_api_impl.cpp.

void kagome::host_api::HostApiImpl::ext_logging_log_version_1 ( runtime::WasmEnum  level,
runtime::WasmSpan  target,
runtime::WasmSpan  message 
)
overridevirtual

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

Implements kagome::host_api::HostApi.

Definition at line 167 of file host_api_impl.cpp.

runtime::WasmEnum kagome::host_api::HostApiImpl::ext_logging_max_level_version_1 ( )
overridevirtual

Get host max log level

Implements kagome::host_api::HostApi.

Definition at line 173 of file host_api_impl.cpp.

void kagome::host_api::HostApiImpl::ext_misc_print_hex_version_1 ( runtime::WasmSpan  data) const
overridevirtual

Print a hex value

Parameters
datapointer-size to an array of bytes with hex

Implements kagome::host_api::HostApi.

Definition at line 329 of file host_api_impl.cpp.

void kagome::host_api::HostApiImpl::ext_misc_print_num_version_1 ( uint64_t  value) const
overridevirtual

Print a number

Parameters
value- number to be printed

Implements kagome::host_api::HostApi.

Definition at line 333 of file host_api_impl.cpp.

void kagome::host_api::HostApiImpl::ext_misc_print_utf8_version_1 ( runtime::WasmSpan  data) const
overridevirtual

Print a UTF-8-encoded string

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

Implements kagome::host_api::HostApi.

Definition at line 337 of file host_api_impl.cpp.

runtime::WasmSpan kagome::host_api::HostApiImpl::ext_misc_runtime_version_version_1 ( runtime::WasmSpan  data) const
overridevirtual

Implements kagome::host_api::HostApi.

Definition at line 324 of file host_api_impl.cpp.

runtime::WasmSpan kagome::host_api::HostApiImpl::ext_offchain_http_request_add_header_version_1 ( runtime::WasmI32  request_id,
runtime::WasmSpan  name,
runtime::WasmSpan  value 
)
overridevirtual
runtime::WasmSpan kagome::host_api::HostApiImpl::ext_offchain_http_request_start_version_1 ( runtime::WasmSpan  method,
runtime::WasmSpan  uri,
runtime::WasmSpan  meta 
)
overridevirtual

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

Implements kagome::host_api::HostApi.

Definition at line 420 of file host_api_impl.cpp.

runtime::WasmSpan kagome::host_api::HostApiImpl::ext_offchain_http_request_write_body_version_1 ( runtime::WasmI32  request_id,
runtime::WasmSpan  chunk,
runtime::WasmSpan  deadline 
)
overridevirtual
runtime::WasmSpan kagome::host_api::HostApiImpl::ext_offchain_http_response_headers_version_1 ( runtime::WasmI32  request_id)
overridevirtual

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

Implements kagome::host_api::HostApi.

Definition at line 448 of file host_api_impl.cpp.

runtime::WasmSpan kagome::host_api::HostApiImpl::ext_offchain_http_response_read_body_version_1 ( runtime::WasmI32  request_id,
runtime::WasmSpan  buffer,
runtime::WasmSpan  deadline 
)
overridevirtual
runtime::WasmSpan kagome::host_api::HostApiImpl::ext_offchain_http_response_wait_version_1 ( runtime::WasmSpan  ids,
runtime::WasmSpan  deadline 
)
overridevirtual

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

Implements kagome::host_api::HostApi.

Definition at line 442 of file host_api_impl.cpp.

void kagome::host_api::HostApiImpl::ext_offchain_index_clear_version_1 ( runtime::WasmSpan  key)
overridevirtual

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

Implements kagome::host_api::HostApi.

Definition at line 473 of file host_api_impl.cpp.

void kagome::host_api::HostApiImpl::ext_offchain_index_set_version_1 ( runtime::WasmSpan  key,
runtime::WasmSpan  value 
)
overridevirtual

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

Implements kagome::host_api::HostApi.

Definition at line 468 of file host_api_impl.cpp.

runtime::WasmI32 kagome::host_api::HostApiImpl::ext_offchain_is_validator_version_1 ( )
overridevirtual

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

Implements kagome::host_api::HostApi.

Definition at line 368 of file host_api_impl.cpp.

void kagome::host_api::HostApiImpl::ext_offchain_local_storage_clear_version_1 ( runtime::WasmI32  kind,
runtime::WasmSpan  key 
)
overridevirtual

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

Implements kagome::host_api::HostApi.

Definition at line 400 of file host_api_impl.cpp.

runtime::WasmI32 kagome::host_api::HostApiImpl::ext_offchain_local_storage_compare_and_set_version_1 ( runtime::WasmI32  kind,
runtime::WasmSpan  key,
runtime::WasmSpan  expected,
runtime::WasmSpan  value 
)
overridevirtual
runtime::WasmSpan kagome::host_api::HostApiImpl::ext_offchain_local_storage_get_version_1 ( runtime::WasmI32  kind,
runtime::WasmSpan  key 
)
overridevirtual

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

Implements kagome::host_api::HostApi.

Definition at line 415 of file host_api_impl.cpp.

void kagome::host_api::HostApiImpl::ext_offchain_local_storage_set_version_1 ( runtime::WasmI32  kind,
runtime::WasmSpan  key,
runtime::WasmSpan  value 
)
overridevirtual

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

Implements kagome::host_api::HostApi.

Definition at line 394 of file host_api_impl.cpp.

runtime::WasmSpan kagome::host_api::HostApiImpl::ext_offchain_network_state_version_1 ( )
overridevirtual

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

Implements kagome::host_api::HostApi.

Definition at line 377 of file host_api_impl.cpp.

runtime::WasmPointer kagome::host_api::HostApiImpl::ext_offchain_random_seed_version_1 ( )
overridevirtual

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

Implements kagome::host_api::HostApi.

Definition at line 390 of file host_api_impl.cpp.

void kagome::host_api::HostApiImpl::ext_offchain_set_authorized_nodes_version_1 ( runtime::WasmSpan  nodes,
runtime::WasmI32  authorized_only 
)
overridevirtual

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

Implements kagome::host_api::HostApi.

Definition at line 462 of file host_api_impl.cpp.

void kagome::host_api::HostApiImpl::ext_offchain_sleep_until_version_1 ( runtime::WasmU64  deadline)
overridevirtual

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)

Implements kagome::host_api::HostApi.

Definition at line 385 of file host_api_impl.cpp.

runtime::WasmSpan kagome::host_api::HostApiImpl::ext_offchain_submit_transaction_version_1 ( runtime::WasmSpan  data)
overridevirtual

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

Implements kagome::host_api::HostApi.

Definition at line 372 of file host_api_impl.cpp.

runtime::WasmU64 kagome::host_api::HostApiImpl::ext_offchain_timestamp_version_1 ( )
overridevirtual

Returns current timestamp.

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

Implements kagome::host_api::HostApi.

Definition at line 381 of file host_api_impl.cpp.

void kagome::host_api::HostApiImpl::ext_storage_append_version_1 ( runtime::WasmSpan  key,
runtime::WasmSpan  value 
) const
overridevirtual

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.

Implements kagome::host_api::HostApi.

Definition at line 81 of file host_api_impl.cpp.

runtime::WasmSpan kagome::host_api::HostApiImpl::ext_storage_changes_root_version_1 ( runtime::WasmSpan  parent_hash)
overridevirtual

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

Implements kagome::host_api::HostApi.

Definition at line 124 of file host_api_impl.cpp.

void kagome::host_api::HostApiImpl::ext_storage_clear_prefix_version_1 ( runtime::WasmSpan  prefix)
overridevirtual

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

Parameters
prefixmemory span containing prefix

Implements kagome::host_api::HostApi.

Definition at line 105 of file host_api_impl.cpp.

runtime::WasmSpan kagome::host_api::HostApiImpl::ext_storage_clear_prefix_version_2 ( runtime::WasmSpan  prefix,
runtime::WasmSpan  limit 
)
overridevirtual

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

Implements kagome::host_api::HostApi.

Definition at line 110 of file host_api_impl.cpp.

void kagome::host_api::HostApiImpl::ext_storage_clear_version_1 ( runtime::WasmSpan  key_data)
overridevirtual

Clears the storage of the given key and its value.

Parameters
key_datamemory span containing key

Implements kagome::host_api::HostApi.

Definition at line 96 of file host_api_impl.cpp.

void kagome::host_api::HostApiImpl::ext_storage_commit_transaction_version_1 ( )
overridevirtual

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

Implements kagome::host_api::HostApi.

Definition at line 137 of file host_api_impl.cpp.

runtime::WasmSize kagome::host_api::HostApiImpl::ext_storage_exists_version_1 ( runtime::WasmSpan  key_data) const
overridevirtual

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.

Implements kagome::host_api::HostApi.

Definition at line 100 of file host_api_impl.cpp.

runtime::WasmSpan kagome::host_api::HostApiImpl::ext_storage_get_version_1 ( runtime::WasmSpan  key)
overridevirtual

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

Implements kagome::host_api::HostApi.

Definition at line 91 of file host_api_impl.cpp.

runtime::WasmSpan kagome::host_api::HostApiImpl::ext_storage_next_key_version_1 ( runtime::WasmSpan  key) const
overridevirtual

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

Implements kagome::host_api::HostApi.

Definition at line 76 of file host_api_impl.cpp.

runtime::WasmSpan kagome::host_api::HostApiImpl::ext_storage_read_version_1 ( runtime::WasmSpan  key,
runtime::WasmSpan  value_out,
runtime::WasmOffset  offset 
)
overridevirtual

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

Implements kagome::host_api::HostApi.

Definition at line 69 of file host_api_impl.cpp.

void kagome::host_api::HostApiImpl::ext_storage_rollback_transaction_version_1 ( )
overridevirtual

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

Implements kagome::host_api::HostApi.

Definition at line 133 of file host_api_impl.cpp.

runtime::WasmSpan kagome::host_api::HostApiImpl::ext_storage_root_version_1 ( )
overridevirtual

Commits all existing operations and computes the resulting storage root.

Returns
memory span containing scale-encoded storage root

Implements kagome::host_api::HostApi.

Definition at line 115 of file host_api_impl.cpp.

runtime::WasmSpan kagome::host_api::HostApiImpl::ext_storage_root_version_2 ( runtime::WasmI32  state_version)
overridevirtual

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

Implements kagome::host_api::HostApi.

Definition at line 119 of file host_api_impl.cpp.

void kagome::host_api::HostApiImpl::ext_storage_set_version_1 ( runtime::WasmSpan  key,
runtime::WasmSpan  value 
)
overridevirtual

Sets the value under a given key into storage.

Parameters
keymemory span containing key
valuememory span containing value

Implements kagome::host_api::HostApi.

Definition at line 86 of file host_api_impl.cpp.

void kagome::host_api::HostApiImpl::ext_storage_start_transaction_version_1 ( )
overridevirtual

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.

Implements kagome::host_api::HostApi.

Definition at line 129 of file host_api_impl.cpp.

runtime::WasmPointer kagome::host_api::HostApiImpl::ext_trie_blake2_256_ordered_root_version_1 ( runtime::WasmSpan  values_data)
overridevirtual

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

Implements kagome::host_api::HostApi.

Definition at line 146 of file host_api_impl.cpp.

runtime::WasmPointer kagome::host_api::HostApiImpl::ext_trie_blake2_256_ordered_root_version_2 ( runtime::WasmSpan  values_data,
runtime::WasmI32  state_version 
)
overridevirtual

Implements kagome::host_api::HostApi.

Definition at line 151 of file host_api_impl.cpp.

runtime::WasmPointer kagome::host_api::HostApiImpl::ext_trie_blake2_256_root_version_1 ( runtime::WasmSpan  values_data)
overridevirtual

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

Implements kagome::host_api::HostApi.

Definition at line 141 of file host_api_impl.cpp.

void kagome::host_api::HostApiImpl::reset ( )
overridevirtual

Implements kagome::host_api::HostApi.

Definition at line 65 of file host_api_impl.cpp.

Member Data Documentation

ChildStorageExtension kagome::host_api::HostApiImpl::child_storage_ext_
private

Definition at line 347 of file host_api_impl.hpp.

CryptoExtension kagome::host_api::HostApiImpl::crypto_ext_
private

Definition at line 342 of file host_api_impl.hpp.

constexpr uint64_t kagome::host_api::HostApiImpl::DEFAULT_CHAIN_ID = 42
staticprivate

Definition at line 337 of file host_api_impl.hpp.

IOExtension kagome::host_api::HostApiImpl::io_ext_
private

Definition at line 343 of file host_api_impl.hpp.

MemoryExtension kagome::host_api::HostApiImpl::memory_ext_
private

Definition at line 344 of file host_api_impl.hpp.

std::shared_ptr<const runtime::MemoryProvider> kagome::host_api::HostApiImpl::memory_provider_
private

Definition at line 339 of file host_api_impl.hpp.

MiscExtension kagome::host_api::HostApiImpl::misc_ext_
private

Definition at line 345 of file host_api_impl.hpp.

OffchainExtension kagome::host_api::HostApiImpl::offchain_ext_
private

Definition at line 348 of file host_api_impl.hpp.

StorageExtension kagome::host_api::HostApiImpl::storage_ext_
private

Definition at line 346 of file host_api_impl.hpp.

std::shared_ptr<runtime::TrieStorageProvider> kagome::host_api::HostApiImpl::storage_provider_
private

Definition at line 340 of file host_api_impl.hpp.


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