substrate
substrate copied to clipboard
Upgrade wasm-opt to 0.111.0
This upgrades binaryen to version 111.
Binaryen (and wasm-opt) now enables the SignExt
and MutableGlobals
features by default, which are also enabled in the LLVM backend. In the future Binaryen will align its default feature selection with the LLVM backend.
This is probably is ok for wasm-builder - wasmi supports both these.
This also points to potential future optimizations by explicitly turning on more features that wasmi supports but that aren't enabled in wasm-opt by default.
The changelog for 0.111.0.
Per comments in https://github.com/paritytech/cargo-contract/pull/888 and https://github.com/paritytech/cargo-contract/pull/891, it seems that wasmi requires turning on the signext and mutable globals features explicitly (or perhaps they can be disabled). I haven't looked at whether substrate does this or not. The cargo-contract
devs decided to disable these features by calling mvp_features_only
.
In contracts we disable everything that is not MVP. Reason is that every feature/instruction needs to be metered and adding more features makes this harder. For the runtime it is similarly true: We depend on wasm_instrument
to inject stack height metering into PvF. This crate basically only deals with the MVP properly.
I suggest we also add a call to mvp_features_only
to reject anything using features early. The only feature we use and allow is mutable global. So this needs to be enabled.
Looking at the actual invocation of wasm-opt now, I see the code already sets mvp_features_only, so I think this is good as-is.
I also see that wasm-opt is not being used to run optimizations, just to strip dwarf, so perhaps it doesn't even matter what features are enabled.
bot merge