Kagome
Polkadot Runtime Engine in C++17
|
#include <host_api.hpp>
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... | |
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.
|
virtualdefault |
|
pure virtual |
Implemented in kagome::host_api::HostApiImpl.
|
pure virtual |
Implemented in kagome::host_api::HostApiImpl.
|
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.
key_type_id | a 32-bit pointer to the key identifier |
seed | a pointer-size indicating the SCALE encoded Option containing the BIP-39 seed which must be valid UTF8. |
Implemented in kagome::host_api::HostApiImpl.
|
pure virtual |
Implemented in kagome::host_api::HostApiImpl.
|
pure virtual |
Signs the given message digest with a specified key
key_type | a 32-bit pointer to the key identifier |
key | a 32-bit pointer to the buffer containing the 33-byte compressed public key |
msg_data | a pointer-size indicating the message that is to be signed |
Implemented in kagome::host_api::HostApiImpl.
|
pure virtual |
Implemented in kagome::host_api::HostApiImpl.
|
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.
sig | a 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. |
msg | a pointer-size as defined in Definition D.3 indicating the message that is to be verified. |
key | a 32-bit pointer to the buffer containing the 33-byte compressed public key. |
Implemented in kagome::host_api::HostApiImpl.
|
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.
sig | a 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. |
msg | a pointer-size as defined in Definition D.3 indicating the message that is to be verified. |
key | a 32-bit pointer to the buffer containing the 33-byte compressed public key. |
Implemented in kagome::host_api::HostApiImpl.
|
pure virtual |
Implemented in kagome::host_api::HostApiImpl.
|
pure virtual |
Implemented in kagome::host_api::HostApiImpl.
|
pure virtual |
Implemented in kagome::host_api::HostApiImpl.
|
pure virtual |
Implemented in kagome::host_api::HostApiImpl.
|
pure virtual |
Finish verifying the batch of signatures since the last call to this function. Blocks until all the signatures are verified.
runtime_error | if no verification extension is registered (ext_crypto_start_batch_verify (E.3.15) tchwas not called.) |
Implemented in kagome::host_api::HostApiImpl.
|
pure virtual |
Recover secp256k1 public key
sig | recoverable 65-byte signature |
msg | blake2s message hash |
Implemented in kagome::host_api::HostApiImpl.
|
pure virtual |
Implemented in kagome::host_api::HostApiImpl.
|
pure virtual |
Recover secp256k1 public key
sig | recoverable 65-byte signature |
msg | blake2s message hash |
Implemented in kagome::host_api::HostApiImpl.
|
pure virtual |
Implemented in kagome::host_api::HostApiImpl.
|
pure virtual |
Implemented in kagome::host_api::HostApiImpl.
|
pure virtual |
Implemented in kagome::host_api::HostApiImpl.
|
pure virtual |
Implemented in kagome::host_api::HostApiImpl.
|
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.
|
pure virtual |
Implemented in kagome::host_api::HostApiImpl.
|
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.
|
pure virtual |
Clears the child storage of each key/value pair where the key starts with the given prefix.
child_storage_key | a pointer-size indicating the child storage key |
prefix | a pointer-size indicating the prefix |
Implemented in kagome::host_api::HostApiImpl.
|
pure virtual |
Clears the storage of the given key and its value from the child storage.
child_storage_key | a pointer-size indicating the child storage key |
key | a pointer-size indicating the key |
Implemented in kagome::host_api::HostApiImpl.
|
pure virtual |
Checks whether the given key exists in the child storage.
child_storage_key | a pointer-size indicating the child storage key |
key | a pointer-size indicating the key. |
Implemented in kagome::host_api::HostApiImpl.
|
pure virtual |
Retrieves the value associated with the given key from the child storage.
child_storage_key | a pointer-size indicating the child storage key |
key | a pointer-size indicating the key. |
Implemented in kagome::host_api::HostApiImpl.
|
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.
child_storage_key | a pointer-size indicating the child storage key |
key | a pointer-size indicating the key. |
Implemented in kagome::host_api::HostApiImpl.
|
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.
child_storage_key | a pointer-size indicating the child storage key |
key | a pointer-size as defined in Definition D.3 indicating the key. |
value_out | a 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. |
offset | an i32 integer containing the offset beyond the value should be read from. |
Implemented in kagome::host_api::HostApiImpl.
|
pure virtual |
Commits all existing operations and computes the resulting child storage root.
child_storage_key | a pointer-size indicating the child storage key |
Implemented in kagome::host_api::HostApiImpl.
|
pure virtual |
Sets the value under a given key into the child storage.
child_storage_key | a pointer-size indicating the child storage key |
key | a pointer-size indicating the key. |
value | a pointer-size indicating the value. |
Implemented in kagome::host_api::HostApiImpl.
|
pure virtual |
Clears an entire child storage.
child_storage_key | a pointer-size indicating the child storage key |
Implemented in kagome::host_api::HostApiImpl.
|
pure virtual |
Implemented in kagome::host_api::HostApiImpl.
|
pure virtual |
Implemented in kagome::host_api::HostApiImpl.
|
pure virtual |
Implemented in kagome::host_api::HostApiImpl.
|
pure virtual |
Implemented in kagome::host_api::HostApiImpl.
|
pure virtual |
Implemented in kagome::host_api::HostApiImpl.
|
pure virtual |
Implemented in kagome::host_api::HostApiImpl.
|
pure virtual |
Implemented in kagome::host_api::HostApiImpl.
|
pure virtual |
Print a log message
level | - log level of the message |
target | pointer-size value of the message source |
message | pointer-size value of the message content |
Implemented in kagome::host_api::HostApiImpl.
|
pure virtual |
Get host max log level
Implemented in kagome::host_api::HostApiImpl.
|
pure virtual |
Print a hex value
data | pointer-size to an array of bytes with hex |
Implemented in kagome::host_api::HostApiImpl.
|
pure virtual |
|
pure virtual |
Print a UTF-8-encoded string
data | pointer-size to an array of bytes with UTF-8 |
Implemented in kagome::host_api::HostApiImpl.
|
pure virtual |
Implemented in kagome::host_api::HostApiImpl.
|
pure virtual |
|
pure virtual |
Initiates a HTTP request given by the HTTP method and the URL. Returns the id of a newly started request.
method | a pointer-size indicating the HTTP method. Possible values are "GET" and "POST" |
uri | a pointer-size indicating the URI |
meta | a future-reserved field containing additional, SCALE encoded parameters. Currently, an empty array should be passed |
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.
|
pure virtual |
|
pure virtual |
Read all HTTP response headers. Returns an array of key/value pairs. Response headers must be read before the response body.
request_id | an i32 integer indicating the ID of the started request |
Implemented in kagome::host_api::HostApiImpl.
|
pure virtual |
|
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.
ids | a pointer-size indicating the SCALE encoded array of started request IDs |
deadline | a pointer-size indicating the SCALE encoded Option containing the UNIX timestamp. Passing None blocks indefinitely |
Implemented in kagome::host_api::HostApiImpl.
|
pure virtual |
Remove a key and its associated value from the offchain database.
key | a pointer-size indicating the key |
Implemented in kagome::host_api::HostApiImpl.
|
pure virtual |
Write a key value pair to the offchain database in a buffered fashion.
key | a pointer-size indicating the key |
value | a pointer-size indicating the value |
Implemented in kagome::host_api::HostApiImpl.
|
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.
Implemented in kagome::host_api::HostApiImpl.
|
pure virtual |
Remove a value from the local storage.
kind | an 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 |
key | a pointer-size indicating the key |
Implemented in kagome::host_api::HostApiImpl.
|
pure virtual |
|
pure virtual |
Gets a value from the local storage.
kind | an 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 |
key | a pointer-size indicating the key |
Option
containing the value or the corresponding key Implemented in kagome::host_api::HostApiImpl.
|
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.
kind | an 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 |
key | a pointer-size indicating the key |
value | a pointer-size indicating the value |
Implemented in kagome::host_api::HostApiImpl.
|
pure virtual |
Returns the SCALE encoded, opaque information about the local node's network state.
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.
|
pure virtual |
Generates a random seed. This is a truly random non deterministic seed generated by the host environment.
Implemented in kagome::host_api::HostApiImpl.
|
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.
nodes | a pointer-size indicating the SCALE encoded array of libp2p PeerId's. Invalid PeerId's are silently ignored |
authorized_only | If 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.
|
pure virtual |
Pause the execution until deadline
is reached.
deadline | an u64 integer indicating the current UNIX timestamp (milliseconds) |
Implemented in kagome::host_api::HostApiImpl.
|
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.
data | byte array storing the encoded extrinsic |
Result
. Neither on success or failure is there any additional data provided Implemented in kagome::host_api::HostApiImpl.
|
pure virtual |
Returns current timestamp.
Implemented in kagome::host_api::HostApiImpl.
|
pure virtual |
Appends the scale encoded value to the scale encoded storage item at the given key
key | memory span containing key |
value | memory span containing value that should be appended to storage item under the |
key |
Implemented in kagome::host_api::HostApiImpl.
|
pure virtual |
Commits all existing operations and gets the resulting change root. The parent hash is a SCALE encoded change root.
parent_hash | wasm span containing parent hash |
Implemented in kagome::host_api::HostApiImpl.
|
pure virtual |
Clear the storage of each key/value pair where the key starts with the given prefix.
prefix | memory span containing prefix |
Implemented in kagome::host_api::HostApiImpl.
|
pure virtual |
Clear the storage of each key/value pair where the key starts with the given prefix.
prefix | memory span containing prefix |
limit | of entries to be removed |
Implemented in kagome::host_api::HostApiImpl.
|
pure virtual |
Clears the storage of the given key and its value.
key_data | memory span containing key |
Implemented in kagome::host_api::HostApiImpl.
|
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.
|
pure virtual |
Checks whether the given key exists in storage.
key_data | memory span containing key |
Implemented in kagome::host_api::HostApiImpl.
|
pure virtual |
Retrieves the value associated with the given key from storage.
key | key memory span containing key |
Implemented in kagome::host_api::HostApiImpl.
|
pure virtual |
Gets the next key in storage after the given one in lexicographic order.
key | memory span containing key |
Implemented in kagome::host_api::HostApiImpl.
|
pure virtual |
Reads data from storage with the given key.
key | pointer-size to the key |
value_out | pointer-size to the read data |
offset | in bytes from the data block begin should be read |
Implemented in kagome::host_api::HostApiImpl.
|
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.
|
pure virtual |
Commits all existing operations and computes the resulting storage root.
Implemented in kagome::host_api::HostApiImpl.
|
pure virtual |
Commits all existing operations and computes the resulting storage root.
state_version | - is using state version, where 0 - state version 1 1 - node hashes |
Implemented in kagome::host_api::HostApiImpl.
|
pure virtual |
Sets the value under a given key into storage.
key | memory span containing key |
value | memory span containing value |
Implemented in kagome::host_api::HostApiImpl.
|
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.
|
pure virtual |
Conducts a 256-bit Blake2 trie root formed from the enumerated items.
values_data | wasm 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. |
Implemented in kagome::host_api::HostApiImpl.
|
pure virtual |
Implemented in kagome::host_api::HostApiImpl.
|
pure virtual |
Conducts a 256-bit Blake2 trie root formed from the iterated items.
values_data | wasm 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. |
Implemented in kagome::host_api::HostApiImpl.
|
pure virtual |
Implemented in kagome::host_api::HostApiImpl.