diff --git a/arbitrator/prover/test-cases/dynamic.wat b/arbitrator/prover/test-cases/dynamic.wat index 5d9ca1b14..97c55ba80 100644 --- a/arbitrator/prover/test-cases/dynamic.wat +++ b/arbitrator/prover/test-cases/dynamic.wat @@ -12,7 +12,7 @@ ;; WAVM Module hash (data (i32.const 0x000) - "\3a\eb\a0\67\68\ef\f5\f9\4e\ec\84\88\ac\54\b7\b7\07\a5\12\9c\fb\73\50\37\33\d9\9e\90\ea\72\97\8c") ;; user + "\87\12\6b\19\8a\ce\0c\ba\00\6a\ab\9b\b7\45\bb\0a\ac\48\4d\6b\b8\b5\f9\03\a2\99\8f\64\00\9f\e2\04") ;; user (func $start (local $user i32) (local $internals i32) ;; link in user.wat diff --git a/arbitrator/prover/test-cases/link.wat b/arbitrator/prover/test-cases/link.wat index 7ea72c70e..e033bf0e9 100644 --- a/arbitrator/prover/test-cases/link.wat +++ b/arbitrator/prover/test-cases/link.wat @@ -7,32 +7,32 @@ (import "env" "wavm_halt_and_set_finished" (func $halt )) ;; WAVM module hashes - (data (i32.const 0x000) - "\56\19\01\5f\5d\d4\1f\5a\f8\39\eb\a7\71\a5\8e\e8\a4\d1\3a\dd\ee\2e\75\29\9a\19\cc\89\a5\ab\d3\73") ;; block + (data (i32.const 0x000) + "\eb\12\b0\76\57\15\ad\16\0a\78\54\4d\c7\8d\d4\86\1c\58\a3\ee\77\f9\4a\4e\61\a3\f1\7f\d9\d2\be\8a") ;; block (data (i32.const 0x020) - "\7a\02\20\3c\1a\93\f8\0a\7c\1c\43\b3\95\79\c5\9d\f7\c3\84\5d\be\2e\1a\9d\6f\58\88\87\c0\a2\fe\13") ;; call + "\01\90\21\0c\1d\c8\45\9c\32\ef\a6\00\44\3b\e0\b6\31\70\1f\ce\7a\38\90\1c\e0\c5\40\6d\d8\ce\30\a6") ;; call (data (i32.const 0x040) - "\76\aa\58\26\ed\70\37\00\01\c1\f0\62\4c\cb\23\77\1e\03\a0\e7\34\a8\45\11\c3\bd\de\4e\03\40\4a\5c") ;; indirect + "\e1\a2\fa\8e\81\2a\34\2e\cf\0f\62\46\ba\a4\45\8e\2d\95\2f\ec\1e\79\8f\dc\1b\1c\b8\15\cf\26\02\6c") ;; indirect (data (i32.const 0x060) - "\79\54\72\df\45\56\6f\2f\5f\85\06\60\ec\3b\0a\43\ce\f0\3b\90\75\7d\86\82\d1\8d\c1\fe\da\31\40\bb") ;; const + "\ae\cb\eb\e9\0b\5e\1f\78\1b\66\5b\ff\8a\a4\18\a1\a2\e9\90\26\8b\df\df\95\64\54\82\07\6a\d4\e6\20") ;; const (data (i32.const 0x080) - "\9e\48\3c\16\fb\ec\9b\90\de\34\8f\38\26\a7\41\44\0a\fb\1c\21\f4\e3\76\be\a2\f3\d7\03\4a\1d\9c\a2") ;; div + "\8b\7b\7e\a8\b8\21\c8\d0\2a\80\7c\1e\4b\6d\0d\07\f3\2d\8b\4e\f1\6b\e4\44\03\cf\05\66\9b\09\be\6d") ;; div (data (i32.const 0x0a0) - "\38\cb\94\a1\4d\d1\ab\9a\29\b0\f7\5e\c7\f0\cb\db\1d\f5\fe\34\52\8e\26\7a\25\c8\a8\8e\d4\a4\16\f9") ;; globals + "\da\4a\41\74\d6\2e\20\36\8e\cb\8e\5d\45\12\1c\28\1d\c4\8f\1d\77\92\9f\07\a8\6b\35\ea\89\2e\f9\72") ;; globals (data (i32.const 0x0c0) - "\36\62\29\c5\f3\d2\3e\8e\21\02\8d\ef\95\04\2d\d8\a5\1b\08\2d\30\d7\6b\6c\85\83\4b\19\be\8e\dd\ba") ;; if-else + "\3f\ec\7c\06\04\b2\0d\99\bb\10\85\61\91\ea\b6\97\a7\a2\d1\19\67\2e\7c\d9\17\d4\6b\45\e8\4b\83\4b") ;; if-else (data (i32.const 0x0e0) - "\98\5d\8a\d6\ac\09\6b\bd\cc\ca\7c\87\a9\20\db\11\5f\b1\28\e1\a1\51\70\8a\9f\46\bf\f0\f8\c8\d0\e2") ;; locals + "\30\12\24\71\df\9f\a9\f8\9c\33\9b\37\a7\08\f5\aa\5f\53\68\b4\e4\de\66\bb\73\ff\30\29\47\5f\50\e5") ;; locals (data (i32.const 0x100) - "\9a\cc\60\ec\96\44\53\09\1c\0c\2e\19\42\f2\b4\db\56\a7\d4\40\2e\36\f3\03\33\43\05\de\ea\c5\6b\47") ;; loop + "\f3\95\dd\a7\e1\d7\df\94\06\ca\93\0f\53\bf\66\ce\1a\aa\b2\30\68\08\64\b5\5b\61\54\2c\1d\62\e8\25") ;; loop (data (i32.const 0x120) - "\2b\d8\a0\ed\09\1c\47\03\b1\55\d7\a6\b0\bd\24\68\e0\0b\92\a6\b8\fe\2c\71\b4\c7\bf\40\05\6d\f4\2d") ;; math + "\8c\a3\63\7c\4e\70\f7\79\13\0c\9a\94\5e\63\3b\a9\06\80\9f\a6\51\0e\32\34\e0\9d\78\05\6a\30\98\0f") ;; math (data (i32.const 0x140) - "\7e\01\98\c8\a1\f4\74\be\92\8c\2c\ec\5d\5f\be\04\65\b1\c0\74\43\71\c3\63\00\db\20\b3\a9\17\9b\ac") ;; iops + "\47\f7\4f\9c\21\51\4f\52\24\ea\d3\37\5c\bf\a9\1b\1a\5f\ef\22\a5\2a\60\30\c5\52\18\90\6b\b1\51\e5") ;; iops (data (i32.const 0x160) - "\3a\eb\a0\67\68\ef\f5\f9\4e\ec\84\88\ac\54\b7\b7\07\a5\12\9c\fb\73\50\37\33\d9\9e\90\ea\72\97\8c") ;; user + "\87\12\6b\19\8a\ce\0c\ba\00\6a\ab\9b\b7\45\bb\0a\ac\48\4d\6b\b8\b5\f9\03\a2\99\8f\64\00\9f\e2\04") ;; user (data (i32.const 0x180) - "\fa\91\57\09\98\8a\54\d2\d5\96\71\13\da\71\ae\80\eb\b1\b3\68\5e\90\d7\8e\0e\7d\a2\c4\d8\d9\72\cf") ;; return + "\ee\47\08\f6\47\b2\10\88\1f\89\86\e7\e3\79\6b\b2\77\43\f1\4e\ee\cf\45\4a\9b\7c\d7\c4\5b\63\b6\d7") ;; return (func $start (local $counter i32) diff --git a/arbitrator/tools/module_roots/Cargo.lock b/arbitrator/tools/module_roots/Cargo.lock index fe4f163d5..248a632d0 100644 --- a/arbitrator/tools/module_roots/Cargo.lock +++ b/arbitrator/tools/module_roots/Cargo.lock @@ -127,6 +127,12 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" +[[package]] +name = "bitflags" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1" + [[package]] name = "bitvec" version = "1.0.1" @@ -266,7 +272,7 @@ checksum = "a0610544180c38b88101fecf2dd634b174a62eef6946f84dfc6a7127512b381c" dependencies = [ "ansi_term", "atty", - "bitflags", + "bitflags 1.3.2", "strsim 0.8.0", "textwrap", "unicode-width", @@ -565,7 +571,7 @@ version = "1.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "add9a102807b524ec050363f09e06f1504214b0e1c7797f64261c891022dce8b" dependencies = [ - "bitflags", + "bitflags 1.3.2", "byteorder", "lazy_static", "proc-macro-error", @@ -660,15 +666,6 @@ version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" -[[package]] -name = "form_urlencoded" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456" -dependencies = [ - "percent-encoding", -] - [[package]] name = "funty" version = "2.0.0" @@ -783,16 +780,6 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" -[[package]] -name = "idna" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6" -dependencies = [ - "unicode-bidi", - "unicode-normalization", -] - [[package]] name = "indenter" version = "0.3.3" @@ -930,9 +917,9 @@ dependencies = [ [[package]] name = "memoffset" -version = "0.8.0" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d61c719bcfbcf5d62b3a09efa6088de8c54bc0bfcd3ea7ae39fcc186108b8de1" +checksum = "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a" dependencies = [ "autocfg", ] @@ -1156,12 +1143,6 @@ dependencies = [ "windows-targets", ] -[[package]] -name = "percent-encoding" -version = "2.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" - [[package]] name = "pin-project-lite" version = "0.2.13" @@ -1311,7 +1292,7 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" dependencies = [ - "bitflags", + "bitflags 1.3.2", ] [[package]] @@ -1332,7 +1313,7 @@ version = "3.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "76e189c2369884dce920945e2ddf79b3dff49e071a167dd1817fa9c4c00d512e" dependencies = [ - "bitflags", + "bitflags 1.3.2", "libc", "mach", "winapi", @@ -1785,27 +1766,12 @@ version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" -[[package]] -name = "unicode-bidi" -version = "0.3.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75" - [[package]] name = "unicode-ident" version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" -[[package]] -name = "unicode-normalization" -version = "0.1.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a56d1686db2308d901306f92a263857ef59ea39678a5458e7cb17f01415101f5" -dependencies = [ - "tinyvec", -] - [[package]] name = "unicode-segmentation" version = "1.11.0" @@ -1818,17 +1784,6 @@ version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e51733f11c9c4f72aa0c160008246859e340b00807569a0da0e7a1079b27ba85" -[[package]] -name = "url" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31e6302e3bb753d46e83516cae55ae196fc0c309407cf11ab35cc51a4c2a4633" -dependencies = [ - "form_urlencoded", - "idna", - "percent-encoding", -] - [[package]] name = "uuid" version = "1.7.0" @@ -1878,29 +1833,6 @@ dependencies = [ "wasm-bindgen-shared", ] -[[package]] -name = "wasm-bindgen-downcast" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5dac026d43bcca6e7ce1c0956ba68f59edf6403e8e930a5d891be72c31a44340" -dependencies = [ - "js-sys", - "once_cell", - "wasm-bindgen", - "wasm-bindgen-downcast-macros", -] - -[[package]] -name = "wasm-bindgen-downcast-macros" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5020cfa87c7cecefef118055d44e3c1fc122c7ec25701d528ee458a0b45f38f" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - [[package]] name = "wasm-bindgen-macro" version = "0.2.92" @@ -1941,7 +1873,7 @@ dependencies = [ [[package]] name = "wasmer" -version = "4.2.3" +version = "4.2.8" dependencies = [ "bytes", "cfg-if 1.0.0", @@ -1955,8 +1887,8 @@ dependencies = [ "shared-buffer", "target-lexicon", "thiserror", + "tracing", "wasm-bindgen", - "wasm-bindgen-downcast", "wasmer-compiler", "wasmer-compiler-cranelift", "wasmer-derive", @@ -1968,7 +1900,7 @@ dependencies = [ [[package]] name = "wasmer-compiler" -version = "4.2.3" +version = "4.2.8" dependencies = [ "backtrace", "bytes", @@ -1993,7 +1925,7 @@ dependencies = [ [[package]] name = "wasmer-compiler-cranelift" -version = "4.2.3" +version = "4.2.8" dependencies = [ "cranelift-codegen", "cranelift-entity", @@ -2010,7 +1942,7 @@ dependencies = [ [[package]] name = "wasmer-compiler-singlepass" -version = "4.2.3" +version = "4.2.8" dependencies = [ "byteorder", "dynasm", @@ -2027,7 +1959,7 @@ dependencies = [ [[package]] name = "wasmer-derive" -version = "4.2.3" +version = "4.2.8" dependencies = [ "proc-macro-error", "proc-macro2", @@ -2037,7 +1969,7 @@ dependencies = [ [[package]] name = "wasmer-types" -version = "4.2.3" +version = "4.2.8" dependencies = [ "bytecheck", "enum-iterator", @@ -2051,7 +1983,7 @@ dependencies = [ [[package]] name = "wasmer-vm" -version = "4.2.3" +version = "4.2.8" dependencies = [ "backtrace", "cc", @@ -2077,12 +2009,13 @@ dependencies = [ [[package]] name = "wasmparser" -version = "0.95.0" +version = "0.121.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2ea896273ea99b15132414be1da01ab0d8836415083298ecaffbe308eaac87a" +checksum = "9dbe55c8f9d0dbd25d9447a5a889ff90c0cc3feaa7395310d3d826b2c703eaab" dependencies = [ - "indexmap 1.9.3", - "url", + "bitflags 2.5.0", + "indexmap 2.2.5", + "semver", ] [[package]] diff --git a/arbitrator/tools/module_roots/src/main.rs b/arbitrator/tools/module_roots/src/main.rs index eae9bcef2..32e476484 100644 --- a/arbitrator/tools/module_roots/src/main.rs +++ b/arbitrator/tools/module_roots/src/main.rs @@ -1,6 +1,7 @@ // Copyright 2023, Offchain Labs, Inc. // For license information, see https://github.com/OffchainLabs/nitro/blob/master/LICENSE +use arbutil::Bytes32; use eyre::{Result, WrapErr}; use prover::{machine::GlobalState, utils::file_bytes, Machine}; use std::{collections::HashMap, fmt::Display, path::PathBuf, sync::Arc}; @@ -45,7 +46,10 @@ fn main() -> Result<()> { relocate!(module); let error = || format!("failed to read module at {}", module.to_string_lossy()); let wasm = file_bytes(&module).wrap_err_with(error)?; - let hash = mach.add_program(&wasm, 1, true).wrap_err_with(error)?; + let code = &Bytes32::default(); + let hash = mach + .add_program(&wasm, code, 1, true) + .wrap_err_with(error)?; let name = module.file_stem().unwrap().to_string_lossy(); stylus.push((name.to_owned(), hash)); println!("{} {}", name, hash);