Closed luc-blaeser closed 2 weeks ago
Comparing from 5b36b8b799f7083ee0a77b47928fff42e4a16093 to 6080b3f0087bacf21f46f39683993d5d416a9b0b: In terms of gas, no changes are observed in 5 tests. In terms of size, no changes are observed in 5 tests.
Why didn't the bytecode-verifier in the replica catch this? Do we have Motoko-compiled canisters out there with this bug baked-in?
It is actually only a requirement by Rust, not Wasm. It only affects debug Rust compilation AFAIK. I believe people probably do not release debug Motoko code. So, probably it is okay.
Thank you for the review, Claudio and Gabor!
Rust requires a table offset of at least 1 as the element index 0 is considered invalid and causes a debug null check to panic when called. On the other hand,
elem[0]
can be used by the Motoko backend code, as correct Rust-generated Wasm code does not callelem[0]
.This bug is independent of
wasm32
andwasm64
.This issue has been observed in https://github.com/dfinity/motoko/actions/runs/10703077671/job/29672766216?pr=4683 and happened only on Linux and only under
nix-build
(notnix-shell
).