Closed cspramit closed 1 year ago
Some observations:
gas
function with an i64
argument instead of i32
, so since we’ve already burned gas
functions in the global state, we'd have to support both signatures on the host. We shouldn’t burn the preprocessed wasm into a global state anymore as part of 2.0.0 to avoid issues like that in the future, and once that's done, we could migrate to wasm-instrumentwasmi
to a version that depends on 0.45.0. But wasmi
version, which uses 0.45.0, has a lot of breaking changes and is a nontrivial task we could pursue first, possibly before 2.0.0.wasm-utils
optimizer is gone, and the upstream recommendation is to just use binaryen
, which doesn’t offer a similar API but a general shrink level/optimization level compiler-like interface, rather than remove anything not referenced by a vec of exports.externalize_mem
API - this one was a simple to fix as it only injects a memory import, to be always able to inject a memory instance to a Wasm module. I copied and pasted the wasm-utils function over to our codebase.I think it's not worth pursuing the migration before 2.0.0 due to the gas limit injector and stack height limiter changes. We could try:
binaryen
compiler has a better optimizer for unused stuff than the removed one from pwasm-utils (it probably is better as a lot of wasm compilers use it under the hood)CC @georgepisaltu
WIP code is here https://github.com/mpapierski/casper-node/tree/gh-3228-wasm-instrument
wasm-utils crate is apparently archived by the owners and wasm-instrument have the same functionality and is maintaned.