diff --git a/test/runtimes/hostapi/hostapi_runtime.compact.wasm b/test/runtimes/hostapi/hostapi_runtime.compact.wasm index a85b3150e..88c9a7969 100644 Binary files a/test/runtimes/hostapi/hostapi_runtime.compact.wasm and b/test/runtimes/hostapi/hostapi_runtime.compact.wasm differ diff --git a/test/runtimes/hostapi/src/lib.rs b/test/runtimes/hostapi/src/lib.rs index 3fae6773a..fcc023fa3 100644 --- a/test/runtimes/hostapi/src/lib.rs +++ b/test/runtimes/hostapi/src/lib.rs @@ -20,6 +20,7 @@ extern "C" { fn ext_storage_clear_prefix_version_2(key: u64, limit: u64) -> u64; fn ext_storage_append_version_1(key: u64, value: u64); fn ext_storage_root_version_1() -> u64; + fn ext_storage_root_version_2(version: u32) -> u64; fn ext_storage_next_key_version_1(key: u64) -> u64; // OffChain API @@ -37,7 +38,9 @@ extern "C" { fn ext_default_child_storage_storage_kill_version_3(child: u64, limit: u64) -> u64; fn ext_default_child_storage_exists_version_1(child: u64, key: u64) -> i32; fn ext_default_child_storage_clear_prefix_version_1(child: u64, key: u64); + fn ext_default_child_storage_clear_prefix_version_2(child: u64, key: u64, limit: u64) -> u64; fn ext_default_child_storage_root_version_1(child: u64) -> u64; + fn ext_default_child_storage_root_version_2(child: u64, version: u32) -> u64; fn ext_default_child_storage_next_key_version_1(child: u64, key: u64) -> u64; // Crypto API @@ -72,10 +75,14 @@ extern "C" { // Trie API fn ext_trie_blake2_256_root_version_1(data: u64) -> u32; + fn ext_trie_blake2_256_root_version_2(data: u64, version: u32) -> u32; fn ext_trie_blake2_256_ordered_root_version_1(data: u64) -> u32; + fn ext_trie_blake2_256_ordered_root_version_2(data: u64, version: u32) -> u32; fn ext_trie_blake2_256_verify_proof_version_1(a: u32, b: u64, c: u64, d: u64) -> u32; + fn ext_trie_blake2_256_verify_proof_version_2(a: u32, b: u64, c: u64, d: u64, v: u32) -> u32; // Offchain + fn ext_offchain_index_clear_version_1(key: u64); fn ext_offchain_local_storage_clear_version_1(kind: u32, key: u64); fn ext_offchain_http_request_start_version_1(method: u64, uri: u64, meta: u64) -> u64; fn ext_offchain_http_request_add_header_version_1(id: u32, key: u64, value: u64) -> u64; @@ -191,6 +198,15 @@ sp_core::wasm_export_functions! { } } + fn rtm_ext_storage_root_version_2(version: u32) -> Vec { + unsafe { + let value = ext_storage_root_version_2( + version, + ); + from_mem(value) + } + } + fn rtm_ext_storage_next_key_version_1(key: Vec) -> Option> { unsafe { let value = ext_storage_next_key_version_1(key.as_re_ptr()); @@ -336,6 +352,23 @@ sp_core::wasm_export_functions! { } } + + fn rtm_ext_default_child_storage_clear_prefix_version_2( + child: Vec, + key: Vec, + limit: Option, + ) -> Option> { + let limit = limit.encode(); + unsafe { + let value = ext_default_child_storage_clear_prefix_version_2( + child.as_re_ptr(), + key.as_re_ptr(), + limit.as_re_ptr(), + ); + Decode::decode(&mut from_mem(value).as_slice()).unwrap() + } + } + fn rtm_ext_default_child_storage_root_version_1(child: Vec) -> Vec { unsafe { let value = ext_default_child_storage_root_version_1( @@ -345,6 +378,16 @@ sp_core::wasm_export_functions! { } } + fn rtm_ext_default_child_storage_root_version_2(child: Vec, version: u32) -> Vec { + unsafe { + let value = ext_default_child_storage_root_version_2( + child.as_re_ptr(), + version, + ); + from_mem(value) + } + } + fn rtm_ext_default_child_storage_next_key_version_1( child_key: Vec, key_data: Vec @@ -560,6 +603,17 @@ sp_core::wasm_export_functions! { } } + fn rtm_ext_trie_blake2_256_root_version_2(data: Vec<(Vec, Vec)>, version: u32) -> Vec { + let data = data.encode(); + unsafe { + let value = ext_trie_blake2_256_root_version_2( + data.as_re_ptr(), + version, + ); + std::slice::from_raw_parts(value as *mut u8, 32).to_vec() + } + } + fn rtm_ext_trie_blake2_256_ordered_root_version_1(data: Vec>) -> Vec { let data = data.encode(); unsafe { @@ -570,6 +624,17 @@ sp_core::wasm_export_functions! { } } + fn rtm_ext_trie_blake2_256_ordered_root_version_2(data: Vec>, version: u32) -> Vec { + let data = data.encode(); + unsafe { + let value = ext_trie_blake2_256_ordered_root_version_2( + data.as_re_ptr(), + version, + ); + std::slice::from_raw_parts(value as *mut u8, 32).to_vec() + } + } + fn rtm_ext_trie_blake2_256_verify_proof_version_1(root: Vec, proof: Vec>, key: Vec, v: Vec) -> u32 { let proofEnc = proof.encode(); unsafe { @@ -582,6 +647,26 @@ sp_core::wasm_export_functions! { } } + fn rtm_ext_trie_blake2_256_verify_proof_version_2(root: Vec, proof: Vec>, key: Vec, v: Vec, version: u32) -> u32 { + let proofEnc = proof.encode(); + unsafe { + ext_trie_blake2_256_verify_proof_version_2( + root.as_ptr() as u32, + proofEnc.as_re_ptr(), + key.as_re_ptr(), + v.as_re_ptr(), + version, + ) as u32 + } + } + + fn rtm_ext_offchain_index_clear_version_1(key: Vec) { + unsafe { + let _ = ext_offchain_index_clear_version_1( + key.as_re_ptr()); + } + } + fn rtm_ext_offchain_local_storage_clear_version_1(kind: [u8; 4], key: Vec) { unsafe { let _ = ext_offchain_local_storage_clear_version_1(