Skip to content

WASM runtime contains float instructions (Rust 1.87+) #4604

@StackOverflowExcept1on

Description

@StackOverflowExcept1on

Problem

This symbol contains f32 and f64 instructions:

<wasm_encoder::core::code::Instruction as wasm_encoder::Encode>::encode
_ZN78_$LT$wasm_encoder..core..code..Instruction$u20$as$u20$wasm_encoder..Encode$GT$6encode17h8a39893690564deaE

It is called from gear_wasm_instrument::module::Module::Module::serialize::h7ef2cbb7b0ace4cb.
Possible source:

Steps

Compile WASM runtime with new toolchain:

Patch
diff --git a/docker/Dockerfile b/docker/Dockerfile
index 9a8b879ed..c4081ef2d 100644
--- a/docker/Dockerfile
+++ b/docker/Dockerfile
@@ -2,7 +2,7 @@
 FROM amazonlinux:2023 as builder
 
 ARG PROFILE=production
-ARG TOOLCHAIN=nightly-2025-01-09
+ARG TOOLCHAIN=nightly-2025-04-14
 
 RUN yum update -y && \
     yum install -y clang gcc git gzip make tar wget unzip && \
diff --git a/ethexe/docker/ethexe_builder.Dockerfile b/ethexe/docker/ethexe_builder.Dockerfile
index 23f31b9a3..1e8c742c4 100644
--- a/ethexe/docker/ethexe_builder.Dockerfile
+++ b/ethexe/docker/ethexe_builder.Dockerfile
@@ -21,8 +21,8 @@ RUN wget https://sh.rustup.rs/rustup-init.sh
 RUN chmod +x rustup-init.sh
 RUN ./rustup-init.sh -y
 ENV PATH="/root/.cargo/bin:$PATH"
-RUN rustup toolchain install nightly-2025-01-09
-RUN rustup target add wasm32v1-none --toolchain nightly-2025-01-09
+RUN rustup toolchain install nightly-2025-04-14
+RUN rustup target add wasm32v1-none --toolchain nightly-2025-04-14
 
 # Build
 RUN cargo build -p ethexe-cli --profile $PROFILE
diff --git a/examples/incomplete-async-payloads/src/wasm.rs b/examples/incomplete-async-payloads/src/wasm.rs
index 4c1e595fe..c19bfee2e 100644
--- a/examples/incomplete-async-payloads/src/wasm.rs
+++ b/examples/incomplete-async-payloads/src/wasm.rs
@@ -19,7 +19,6 @@
 use crate::Command;
 use gstd::{
     msg::{self, MessageHandle},
-    prelude::*,
     ActorId,
 };
 
diff --git a/examples/init-wait-reply-exit/src/wasm.rs b/examples/init-wait-reply-exit/src/wasm.rs
index b8ee47f70..f2b37c001 100644
--- a/examples/init-wait-reply-exit/src/wasm.rs
+++ b/examples/init-wait-reply-exit/src/wasm.rs
@@ -1,7 +1,4 @@
-use gstd::{
-    exec, msg,
-    prelude::{vec, *},
-};
+use gstd::{exec, msg, prelude::vec};
 
 #[gstd::async_init]
 async fn init() {
diff --git a/examples/sync-duplicate/src/wasm.rs b/examples/sync-duplicate/src/wasm.rs
index 963c62b8a..63b6de2ea 100644
--- a/examples/sync-duplicate/src/wasm.rs
+++ b/examples/sync-duplicate/src/wasm.rs
@@ -16,7 +16,7 @@
 // You should have received a copy of the GNU General Public License
 // along with this program. If not, see <https://www.gnu.org/licenses/>.
 
-use gstd::{msg, prelude::*, ActorId};
+use gstd::{msg, ActorId};
 
 static mut COUNTER: i32 = 0;
 static mut DESTINATION: ActorId = ActorId::zero();
diff --git a/lazy-pages/src/sys/unix.rs b/lazy-pages/src/sys/unix.rs
index 1123510f0..5da93a391 100644
--- a/lazy-pages/src/sys/unix.rs
+++ b/lazy-pages/src/sys/unix.rs
@@ -171,7 +171,7 @@ fn init_for_thread_internal() -> Result<(), ThreadInitError> {
                 0,
             )
         };
-        if ptr == libc::MAP_FAILED {
+        if ptr::eq(ptr, libc::MAP_FAILED) {
             return Err(ThreadInitError::Mmap(errno::errno()));
         }
 
diff --git a/rust-toolchain.toml b/rust-toolchain.toml
index c6847cb7c..a533f3f71 100644
--- a/rust-toolchain.toml
+++ b/rust-toolchain.toml
@@ -1,4 +1,4 @@
 [toolchain]
-channel = "nightly-2025-01-09"
+channel = "nightly-2025-04-14"
 components = [ "llvm-tools" ]
 targets = [ "wasm32v1-none" ]
diff --git a/utils/wasm-optimizer/src/cargo_toolchain.rs b/utils/wasm-optimizer/src/cargo_toolchain.rs
index d8a06d34a..0b12db9b3 100644
--- a/utils/wasm-optimizer/src/cargo_toolchain.rs
+++ b/utils/wasm-optimizer/src/cargo_toolchain.rs
@@ -34,7 +34,7 @@ pub(crate) struct Toolchain(String);
 
 impl Toolchain {
     /// This is a version of nightly toolchain, tested on our CI.
-    const PINNED_NIGHTLY_TOOLCHAIN: &'static str = "nightly-2025-01-09";
+    const PINNED_NIGHTLY_TOOLCHAIN: &'static str = "nightly-2025-04-14";
 
     /// Returns `Toolchain` representing the recommended nightly version.
     pub fn recommended_nightly() -> Self {
@@ -60,7 +60,7 @@ impl Toolchain {
             let channels = TOOLCHAIN_CHANNELS.join("|");
             let pattern = format!(r"(?:{channels})(?:-\d{{4}}-\d{{2}}-\d{{2}})?");
             // Note this regex gives you a guaranteed match of the channel[-date] as group 0,
-            // for example: `nightly-2025-01-09
+            // for example: `nightly-2025-04-14
             Regex::new(&pattern).unwrap()
         });
./scripts/gear.sh build node --release --locked
cargo build -p wasm-proc
./target/debug/wasm-proc --check-runtime-imports target/release/wbuild/vara-runtime/vara_runtime.compact.wasm
Error: "Error with `target/release/wbuild/vara-runtime/vara_runtime.compact.wasm`: Deserialization error: Unsupported instruction: F32Load { memarg: MemArg { align: 2, max_align: 2, offset: 4, memory: 0 } }"

Possible Solution

No response

Notes

No response

Relevant Log Output

No response

Metadata

Metadata

Labels

C0-bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions