This commit is contained in:
bkchr
2025-06-04 01:17:16 +00:00
parent e187c0d242
commit 6dcdbb1104
4 changed files with 26 additions and 18 deletions
@@ -292,23 +292,27 @@
<p>The version 1 of these functions has been taken as a base rather than the version 2, as a <a href="https://github.com/w3f/PPPs/pull/6">PPP#6</a> deprecating the version 2 of these functions has previously been accepted.</p>
<pre><code class="language-wat">(func $ext_storage_clear_prefix_version_3
(param $maybe_prefix i64) (param $maybe_limit i64)
(param $maybe_cursor_in_out i64) (param $backend_out i32)
(param $unique_out i32) (param $loops_out i32) (return i32))
(param $maybe_cursor_in i64) (param $removal_results_out i32))
(func $ext_default_child_storage_clear_prefix_version_3
(param $child_storage_key i64) (param $prefix i64) (param $maybe_limit i64)
(param $maybe_cursor_in_out i64) (param $backend_out i32)
(param $unique_out i32) (param $loops_out i32) (return i32))
(param $maybe_cursor_in i64) (param $removal_results_out i32))
(func $ext_default_child_storage_kill_version_4
(param $child_storage_key i64) (param $maybe_limit i64)
(param $maybe_cursor_in_out i64) (param $backend_out i32)
(param $unique_out i32) (param $loops_out i32) (return i32))
(param $maybe_cursor_in i64) (param $removal_results_out i32))
</code></pre>
<p>These functions amend already implemented but still unused functions introduced by <a href="https://github.com/w3f/PPPs/pull/7">PPP#7</a>, hence there's no version number change. <code>maybe_limit</code> defines the limit of backend deletions, not counting keys in the current overlay. <code>maybe_cursor_in_out</code> may be used to pass a continuation cursor. The cursor is written into the same field if the limit was reached and not all the keys were cleared; otherwise, <code>None</code> is written. (CAVEAT: It's impossible to determine appropriate buffer size; the approach is discussible). <code>backend_out</code>, <code>unique_out</code> and <code>loops_out</code> parameters contain the memory location where the output is written (respectively, the number of items removed from the backend DB; the number of unique keys removes, including overlay; the number of iterations done). Any of the output parameters may be <code>-1</code>, in which case no output is written. The functions return <code>0</code> to indicate success, or <code>1</code> if <code>maybe_cursor_in_out</code> buffer length was not enough to write the new cursor; in the latter case, <code>None</code> is written to the buffer.</p>
<p>These functions amend already implemented but still unused functions introduced by <a href="https://github.com/w3f/PPPs/pull/7">PPP#7</a>, hence there's no version number change. <code>maybe_limit</code> defines the limit of backend deletions, not counting keys in the current overlay. <code>maybe_cursor_in</code> may be used to pass a continuation cursor. After the operation is completed, a SCALE-encoded <a href="https://spec.polkadot.network/id-cryptography-encoding#defn-varrying-data-type">varying data</a> are written to the provided output buffer. The varying data consists from the following fields, in order:</p>
<ul>
<li><a href="https://spec.polkadot.network/id-cryptography-encoding#defn-option-type">Optional</a> continuation cursor. Absence of the cursor denotes the end of the operation;</li>
<li>32-bit unsigned integer representing the number of items removed from the backend DB;</li>
<li>32-bit unsigned integer representing the number of unique keys removes, including overlay;</li>
<li>32-bit unsigned integer representing the number of iterations done.</li>
</ul>
<p>The size of the output buffer must be determined at the compile time. If the SCALE-encoded data do not fit into the buffer, the data are silently trucated. The caller may determine the truncation by checking the value length data contained in the SCALE-encoded data header.</p>
<pre><code class="language-wat">(func $ext_crypto_ed25519_sign_version_2
(param $key_type_id i32) (param $key i32) (param $msg i64) (param $out i32) (return i32))
(func $ext_crypto_sr25519_sign_version_2
(param $key_type_id i32) (param $key i32) (param $msg i64) (param $out i32) (return i32))
func $ext_crypto_ecdsa_sign_version_2
(func $ext_crypto_ecdsa_sign_version_2
(param $key_type_id i32) (param $key i32) (param $msg i64) (param $out i32) (return i32))
(func $ext_crypto_ecdsa_sign_prehashed_version_2
(param $key_type_id i32) (param $key i32) (param $msg i64) (param $out i32) (return i64))