From 9701b23b1f89d43584341ca66d455c6e355e522e Mon Sep 17 00:00:00 2001 From: Graydon Hoare Date: Tue, 6 Aug 2024 19:56:49 -0700 Subject: [PATCH] Repair wasm-smith / wasmi fuzzer, shift to 0.36 --- soroban-env-host/fuzz/Cargo.lock | 11 ++--------- soroban-env-host/fuzz/fuzz_targets/wasmi.rs | 14 +++++++------- 2 files changed, 9 insertions(+), 16 deletions(-) diff --git a/soroban-env-host/fuzz/Cargo.lock b/soroban-env-host/fuzz/Cargo.lock index 585168160..7702d8151 100644 --- a/soroban-env-host/fuzz/Cargo.lock +++ b/soroban-env-host/fuzz/Cargo.lock @@ -170,16 +170,15 @@ dependencies = [ [[package]] name = "curve25519-dalek" -version = "4.1.1" +version = "4.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e89b8c6a2e4b1f45971ad09761aafb85514a84744b67a95e32c3cc1352d1f65c" +checksum = "97fb8b7c4503de7d6ae7b42ab72a5a59857b4c937ec27a3d4539dba95b5ab2be" dependencies = [ "cfg-if", "cpufeatures", "curve25519-dalek-derive", "digest", "fiat-crypto", - "platforms", "rustc_version", "subtle", "zeroize", @@ -606,12 +605,6 @@ dependencies = [ "spki", ] -[[package]] -name = "platforms" -version = "3.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14e6ab3f592e6fb464fc9712d8d6e6912de6473954635fd76a589d832cffcbb0" - [[package]] name = "ppv-lite86" version = "0.2.17" diff --git a/soroban-env-host/fuzz/fuzz_targets/wasmi.rs b/soroban-env-host/fuzz/fuzz_targets/wasmi.rs index 3acb2c77a..9509cb195 100644 --- a/soroban-env-host/fuzz/fuzz_targets/wasmi.rs +++ b/soroban-env-host/fuzz/fuzz_targets/wasmi.rs @@ -1,7 +1,7 @@ #![no_main] use arbitrary::Arbitrary; use libfuzzer_sys::fuzz_target; -use wasmi::{core::ValueType, Engine, Extern, Linker, Module, Store, StoreLimitsBuilder, Value}; +use wasmi_036::{core::ValType, Engine, Extern, Linker, Module, Store, StoreLimitsBuilder, Val}; #[derive(Debug, Arbitrary)] struct WasmiConfig; @@ -53,12 +53,12 @@ impl wasm_smith::Config for WasmiConfig { } } -fn ty_to_arg(ty: &ValueType) -> Value { +fn ty_to_arg(ty: &ValType) -> Val { match ty { - ValueType::I32 => Value::I32(1), - ValueType::I64 => Value::I64(1), - ValueType::F32 => Value::F32(1.0.into()), - ValueType::F64 => Value::F64(1.0.into()), + ValType::I32 => Val::I32(1), + ValType::I64 => Val::I64(1), + ValType::F32 => Val::F32(1.0.into()), + ValType::F64 => Val::F64(1.0.into()), _ => panic!("reference type"), } } @@ -89,7 +89,7 @@ fuzz_target!(|cfg_module: wasm_smith::ConfiguredModule| { let exports = instance.exports(&store); for e in exports { match e.ty(&store) { - wasmi::ExternType::Func(fty) => { + wasmi_036::ExternType::Func(fty) => { args = fty.params().iter().map(ty_to_arg).collect::>(); out = fty.results().iter().map(ty_to_arg).collect::>(); name = Some(e.name().to_string());