Updates the requirements on [wasmi](https://github.com/paritytech/wasmi) to permit the latest version. <details> <summary>Release notes</summary> <p><em>Sourced from <a href="https://github.com/paritytech/wasmi/releases">wasmi's releases</a>.</em></p> <blockquote> <h2>v0.31.0 - 2023-07-31</h2> <h3>Added</h3> <ul> <li>Added <code>ResourceLimiter</code> API known from Wasmtime. (<a href="https://redirect.github.com/paritytech/wasmi/pull/737">paritytech/wasmi#737</a>) <ul> <li>This API allows to limit growable Wasm resources such as Wasm tables and linear memories.</li> <li>Special thanks to <a href="https://github.com/graydon">Graydon Hoare</a> for contributing this feature!</li> </ul> </li> </ul> <h3>Fixes</h3> <ul> <li>Fixed a bug were <code>Module::len_globals</code> internal API returned length of linear memories instead. (<a href="https://redirect.github.com/paritytech/wasmi/pull/741">paritytech/wasmi#741</a>)</li> </ul> <h3>Changed</h3> <ul> <li>Removed <code>intx</code> crate dependency. (<a href="https://redirect.github.com/paritytech/wasmi/pull/727">paritytech/wasmi#727</a>) <ul> <li>The dependence on the <code>intx</code> crate was accidental and not really required at any time.</li> </ul> </li> <li>Optimized <code>f64.const</code> instructions for <code>f64</code> constant values that can losslessly be encoded as 32-bit <code>f32</code> value. (<a href="https://redirect.github.com/paritytech/wasmi/pull/746">paritytech/wasmi#746</a>)</li> </ul> <h3>Dev. Note</h3> <ul> <li>We now publish and record graphs of benchmarks over time. (<a href="https://redirect.github.com/paritytech/wasmi/pull/740">paritytech/wasmi#740</a>) <ul> <li>This allows <code>wasmi</code> developers to better inspect performance changes over longer periods of time.</li> </ul> </li> <li>Updated dev. dependencies: <ul> <li><code>criterion 0.4.0</code> -> <code>0.5.0</code></li> <li><code>wast 0.52.0</code> -> <code>0.62.0</code></li> </ul> </li> </ul> </blockquote> </details> <details> <summary>Changelog</summary> <p><em>Sourced from <a href="https://github.com/paritytech/wasmi/blob/master/CHANGELOG.md">wasmi's changelog</a>.</em></p> <blockquote> <h2>[<code>0.31.0</code>] - 2023-07-31</h2> <h3>Added</h3> <ul> <li>Added <code>ResourceLimiter</code> API known from Wasmtime. (<a href="https://redirect.github.com/paritytech/wasmi/pull/737">paritytech/wasmi#737</a>) <ul> <li>This API allows to limit growable Wasm resources such as Wasm tables and linear memories.</li> <li>Special thanks to <a href="https://github.com/graydon">Graydon Hoare</a> for contributing this feature!</li> </ul> </li> </ul> <h3>Fixes</h3> <ul> <li>Fixed a bug were <code>Module::len_globals</code> internal API returned length of linear memories instead. (<a href="https://redirect.github.com/paritytech/wasmi/pull/741">paritytech/wasmi#741</a>)</li> </ul> <h3>Changed</h3> <ul> <li>Removed <code>intx</code> crate dependency. (<a href="https://redirect.github.com/paritytech/wasmi/pull/727">paritytech/wasmi#727</a>) <ul> <li>The dependence on the <code>intx</code> crate was accidental and not really required at any time.</li> </ul> </li> <li>Optimized <code>f64.const</code> instructions for <code>f64</code> constant values that can losslessly be encoded as 32-bit <code>f32</code> value. (<a href="https://redirect.github.com/paritytech/wasmi/pull/746">paritytech/wasmi#746</a>)</li> </ul> <h3>Dev. Note</h3> <ul> <li>We now publish and record graphs of benchmarks over time. (<a href="https://redirect.github.com/paritytech/wasmi/pull/740">paritytech/wasmi#740</a>) <ul> <li>This allows <code>wasmi</code> developers to better inspect performance changes over longer periods of time.</li> </ul> </li> <li>Updated dev. dependencies: <ul> <li><code>criterion 0.4.0</code> -> <code>0.5.0</code></li> <li><code>wast 0.52.0</code> -> <code>0.62.0</code></li> </ul> </li> </ul> <h2>[<code>0.30.0</code>] - 2023-05-28</h2> <h3>Changed</h3> <ul> <li>Optimized <code>wasmi</code> bytecode memory consumption. (<a href="https://redirect.github.com/paritytech/wasmi/pull/718">paritytech/wasmi#718</a>) <ul> <li>This reduced the memory consumption of <code>wasmi</code> bytecode by organizing the instructions into so-called instruction words, effectively reducing the amount of bytes required per <code>wasmi</code> instruction 16 bytes to 8 bytes. There was an experiment with 4 bytes but experiments confirmed that 8 bytes per instruction word was the sweetspot for <code>wasmi</code> execution and translation performance.</li> <li>This did not affect execution performance too much but we saw performance improvements for translation from Wasm to <code>wasmi</code> bytecode by roughly 15-20%.</li> </ul> </li> <li>Optimized <code>call</code> and <code>return_call</code> for Wasm module internal calls. (<a href="https://redirect.github.com/paritytech/wasmi/pull/724">paritytech/wasmi#724</a>) <ul> <li><code>wasmi</code> bytecode now differentiates between calls to Wasm module internal functions and imported functions which allows the <code>wasmi</code> bytecode executor to perform the common internal calls more efficiently.</li> <li>This led to an execution performance improvement across the board but especially for call intense workloads of up to 30% in some test cases.</li> </ul> </li> </ul> <h2>[<code>0.29.0</code>] - 2023-03-20</h2> <h3>Added</h3> <ul> <li>Added support for <code>extended-const</code> Wasm proposal. (<a href="https://redirect.github.com/paritytech/wasmi/pull/707">paritytech/wasmi#707</a>)</li> </ul> <!-- raw HTML omitted --> </blockquote> <p>... (truncated)</p> </details> <details> <summary>Commits</summary> <ul> <li><a href="https://github.com/paritytech/wasmi/commit/983ef37b3e2acf38a898e191c9bbbd2bc2c05da7"><code>983ef37</code></a> Prepare <code>wasmi</code> release for version <code>0.31.0</code> (<a href="https://redirect.github.com/paritytech/wasmi/issues/748">#748</a>)</li> <li><a href="https://github.com/paritytech/wasmi/commit/af8c588c9059c5299da812958d7a71dc024d2938"><code>af8c588</code></a> Publishing benchmarks for graphs (<a href="https://redirect.github.com/paritytech/wasmi/issues/740">#740</a>)</li> <li><a href="https://github.com/paritytech/wasmi/commit/ee577f268db3bc8b95c685205517c37b4800fa68"><code>ee577f2</code></a> Refactor <code>reftype</code> <code>Transposer</code> conversion utility (<a href="https://redirect.github.com/paritytech/wasmi/issues/747">#747</a>)</li> <li><a href="https://github.com/paritytech/wasmi/commit/ed12feb9f286d13bbdce50491c4d50487319f316"><code>ed12feb</code></a> Add <code>F64Const32</code> instruction (<a href="https://redirect.github.com/paritytech/wasmi/issues/746">#746</a>)</li> <li><a href="https://github.com/paritytech/wasmi/commit/fbe1810a209f8884883333963b6d03c7421c5e5f"><code>fbe1810</code></a> Fix <code>clippy</code> warning (<a href="https://redirect.github.com/paritytech/wasmi/issues/745">#745</a>)</li> <li><a href="https://github.com/paritytech/wasmi/commit/e5fdb7fe32b9151dff6a39c8a4d516817cc72dc2"><code>e5fdb7f</code></a> fixes <a href="https://redirect.github.com/paritytech/wasmi/issues/735">#735</a>: copy paste typo (<a href="https://redirect.github.com/paritytech/wasmi/issues/741">#741</a>)</li> <li><a href="https://github.com/paritytech/wasmi/commit/4860ecc877a6e13a8c4924be6d8f287f126752ad"><code>4860ecc</code></a> Support for <code>ResourceLimiter</code> API (<a href="https://redirect.github.com/paritytech/wasmi/issues/737">#737</a>)</li> <li><a href="https://github.com/paritytech/wasmi/commit/799995da7afb0ae02bb4fd1c9f242fe07c7ad824"><code>799995d</code></a> make <code>ConstRef</code> based on <code>u32</code> instead of <code>intx::U24</code> (<a href="https://redirect.github.com/paritytech/wasmi/issues/727">#727</a>)</li> <li><a href="https://github.com/paritytech/wasmi/commit/4fb164ce6b9a06af65923596711f5988384d6e13"><code>4fb164c</code></a> Prepare release of <code>wasmi</code> version <code>0.30.0</code> (<a href="https://redirect.github.com/paritytech/wasmi/issues/726">#726</a>)</li> <li><a href="https://github.com/paritytech/wasmi/commit/a6165a6ff9ad07f525b3352b0ab4442da32e0f7f"><code>a6165a6</code></a> smol clean-up (<a href="https://redirect.github.com/paritytech/wasmi/issues/725">#725</a>)</li> <li>Additional commits viewable in <a href="https://github.com/paritytech/wasmi/compare/v0.29.0...v0.31.0">compare view</a></li> </ul> </details> <br /> Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- <details> <summary>Dependabot commands and options</summary> <br /> You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) </details> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
wasm-instrument
A Rust library containing a collection of wasm module instrumentations and transformations mainly useful for wasm based block chains and smart contracts.
Provided functionality
This is a non exhaustive list of provided functionality. Please check out the documentation for details.
Gas Metering
Add gas metering to your platform by injecting the necessary code directly into the wasm module. This allows having a uniform gas metering implementation across different execution engines (interpreters, JIT compilers).
Stack Height Limiter
Neither the wasm standard nor any sufficiently complex execution engine specifies how many items on the wasm stack are supported before the execution aborts or malfunctions. Even the same execution engine on different operating systems or host architectures could support a different number of stack items and be well within its rights.
This is the kind of indeterminism that can lead to consensus failures when used in a blockchain context.
To address this issue we can inject some code that meters the stack height at runtime and aborts the execution when it reaches a predefined limit. Choosing this limit suffciently small so that it is smaller than what any reasonably parameterized execution engine would support solves the issue: All execution engines would reach the injected limit before hitting any implementation specific limitation.
License
wasm-instrument is distributed under the terms of both the MIT license and the
Apache License (Version 2.0), at your choice.
See LICENSE-APACHE, and LICENSE-MIT for details.
Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted
for inclusion in wasm-instrument by you, as defined in the Apache-2.0 license, shall be
dual licensed as above, without any additional terms or conditions.