From 6532ad6c7f81dfcd7d6034ffd481b9285de62c8e Mon Sep 17 00:00:00 2001 From: Paul Schoenfelder Date: Tue, 16 Sep 2025 17:22:15 -0400 Subject: [PATCH 01/19] wip: update vm to 0.18 --- Cargo.lock | 633 ++++++++++++++++-- Cargo.toml | 21 +- codegen/masm/src/emit/binary.rs | 100 ++- codegen/masm/src/emit/felt.rs | 11 +- codegen/masm/src/emit/int32.rs | 133 ++-- codegen/masm/src/emit/int64.rs | 37 +- codegen/masm/src/emit/mem.rs | 93 +-- codegen/masm/src/emit/mod.rs | 58 +- codegen/masm/src/emit/primop.rs | 15 +- codegen/masm/src/emit/smallint.rs | 24 +- codegen/masm/src/emit/unary.rs | 131 ++-- codegen/masm/src/lower/component.rs | 41 +- codegen/masm/src/lower/lowering.rs | 7 +- midenc-compile/src/stages/assemble.rs | 17 +- midenc-debug/src/exec/executor.rs | 5 +- midenc-debug/src/exec/host.rs | 34 +- midenc-session/src/emit.rs | 2 +- midenc-session/src/libs.rs | 2 +- .../src/node_tests/helpers.rs | 13 +- .../src/rust_masm_tests/examples.rs | 36 +- 20 files changed, 999 insertions(+), 414 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index aa68e40f3..fa27126c2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -34,6 +34,16 @@ version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" +[[package]] +name = "aead" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d122413f284cf2d62fb1b7db97e02edb8cda96d769b16e443a4f6195e35662b0" +dependencies = [ + "crypto-common", + "generic-array", +] + [[package]] name = "ahash" version = "0.8.12" @@ -243,12 +253,24 @@ dependencies = [ "backtrace", ] +[[package]] +name = "base16ct" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" + [[package]] name = "base64" version = "0.22.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" +[[package]] +name = "base64ct" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55248b47b0caf0546f7988906588779981c43bb1bc9d0c44087278f80cdb44ba" + [[package]] name = "bech32" version = "0.11.0" @@ -430,7 +452,7 @@ dependencies = [ "clap", "env_logger", "log", - "miden-mast-package", + "miden-mast-package 0.18.0", "midenc-compile", "midenc-session", "parse_arg 0.1.6", @@ -547,6 +569,30 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" +[[package]] +name = "chacha20" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3613f74bd2eac03dad61bd53dbe620703d4371614fe0bc3b9f04dd36fe4e818" +dependencies = [ + "cfg-if", + "cipher", + "cpufeatures", +] + +[[package]] +name = "chacha20poly1305" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10cd79432192d1c0f4e1a0fef9527696cc039165d729fb41b3f4f4f354c2dc35" +dependencies = [ + "aead", + "chacha20", + "cipher", + "poly1305", + "zeroize", +] + [[package]] name = "chrono" version = "0.4.41" @@ -588,6 +634,17 @@ dependencies = [ "half", ] +[[package]] +name = "cipher" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" +dependencies = [ + "crypto-common", + "inout", + "zeroize", +] + [[package]] name = "clap" version = "4.5.41" @@ -699,6 +756,12 @@ dependencies = [ "windows-sys 0.60.2", ] +[[package]] +name = "const-oid" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" + [[package]] name = "const-random" version = "0.1.18" @@ -876,6 +939,18 @@ version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "460fbee9c2c2f33933d720630a6a0bac33ba7053db5344fac858d4b8952d77d5" +[[package]] +name = "crypto-bigint" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76" +dependencies = [ + "generic-array", + "rand_core 0.6.4", + "subtle", + "zeroize", +] + [[package]] name = "crypto-common" version = "0.1.6" @@ -883,6 +958,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" dependencies = [ "generic-array", + "rand_core 0.6.4", "typenum", ] @@ -959,6 +1035,16 @@ dependencies = [ "deadpool-runtime", ] +[[package]] +name = "der" +version = "0.7.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7c1832837b905bbfb5101e07cc24c8deddf52f93225eee6ead5f4d63d53ddcb" +dependencies = [ + "const-oid", + "zeroize", +] + [[package]] name = "deranged" version = "0.4.0" @@ -1014,7 +1100,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ "block-buffer", + "const-oid", "crypto-common", + "subtle", ] [[package]] @@ -1055,12 +1143,46 @@ version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8975ffdaa0ef3661bfe02dbdcc06c9f829dfafe6a3c474de366a8d5e44276921" +[[package]] +name = "ecdsa" +version = "0.16.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee27f32b5c5292967d2d4a9d7f1e0b0aed2c15daded5a60300e4abb9d8020bca" +dependencies = [ + "der", + "digest", + "elliptic-curve", + "rfc6979", + "signature", + "spki", +] + [[package]] name = "either" version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719" +[[package]] +name = "elliptic-curve" +version = "0.13.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47" +dependencies = [ + "base16ct", + "crypto-bigint", + "digest", + "ff", + "generic-array", + "group", + "hkdf", + "pkcs8", + "rand_core 0.6.4", + "sec1", + "subtle", + "zeroize", +] + [[package]] name = "ena" version = "0.14.3" @@ -1076,6 +1198,18 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "34aa73646ffb006b8f5147f3dc182bd4bcb190227ce861fc4a4844bf8e3cb2c0" +[[package]] +name = "enum_dispatch" +version = "0.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa18ce2bc66555b3218614519ac839ddb759a7d6720732f979ef8d13be147ecd" +dependencies = [ + "once_cell", + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "env_filter" version = "0.1.3" @@ -1153,6 +1287,16 @@ version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" +[[package]] +name = "ff" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0b50bfb653653f9ca9095b427bed08ab8d75a137839d9ad64eb11810d5b6393" +dependencies = [ + "rand_core 0.6.4", + "subtle", +] + [[package]] name = "filetime" version = "0.2.25" @@ -1181,6 +1325,18 @@ dependencies = [ "miniz_oxide", ] +[[package]] +name = "flume" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da0e4dd2a88388a1f4ccc7c9ce104604dab68d9f408dc34cd45823d5a9069095" +dependencies = [ + "futures-core", + "futures-sink", + "nanorand", + "spin", +] + [[package]] name = "fnv" version = "1.0.7" @@ -1352,6 +1508,7 @@ checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" dependencies = [ "typenum", "version_check", + "zeroize", ] [[package]] @@ -1361,8 +1518,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "335ff9f135e4384c8150d6f27c6daed433577f86b4750418338c01a1a2528592" dependencies = [ "cfg-if", + "js-sys", "libc", "wasi 0.11.1+wasi-snapshot-preview1", + "wasm-bindgen", ] [[package]] @@ -1665,6 +1824,17 @@ dependencies = [ "regex-syntax", ] +[[package]] +name = "group" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" +dependencies = [ + "ff", + "rand_core 0.6.4", + "subtle", +] + [[package]] name = "h2" version = "0.4.11" @@ -1761,6 +1931,24 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" +[[package]] +name = "hkdf" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b5f8eb2ad728638ea2c7d47a21db23b7b58a72ed6a38256b8a1849f15fbbdf7" +dependencies = [ + "hmac", +] + +[[package]] +name = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest", +] + [[package]] name = "home" version = "0.5.11" @@ -2082,6 +2270,15 @@ version = "2.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f4c7245a08504955605670dbf141fceab975f15ca21570696aebe9d2e71576bd" +[[package]] +name = "inout" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "879f10e63c20629ecabbb64a8010319738c66a5cd0c29b02d63d272b03751d01" +dependencies = [ + "generic-array", +] + [[package]] name = "instability" version = "0.3.9" @@ -2250,6 +2447,20 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "k256" +version = "0.13.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6e3919bbaa2945715f0bb6d3934a173d1e9a59ac23767fbaaef277265a7411b" +dependencies = [ + "cfg-if", + "ecdsa", + "elliptic-curve", + "once_cell", + "sha2", + "signature", +] + [[package]] name = "keccak" version = "0.1.5" @@ -2618,7 +2829,19 @@ version = "0.17.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "db750ce0c58f51ba786c7391f392c4b77e0c83a44c5096672d4d0270d3cc7763" dependencies = [ - "miden-core", + "miden-core 0.17.1", + "thiserror 2.0.12", + "winter-air", + "winter-prover", +] + +[[package]] +name = "miden-air" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09f7f7261ba4f1ff0175138936c45e306ef773289cd697657e3120004f7a1a9f" +dependencies = [ + "miden-core 0.18.0", "thiserror 2.0.12", "winter-air", "winter-prover", @@ -2631,9 +2854,23 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "82575d8479aad3966be3defdc17911264bfdc99f9a7bb185180eec57c6bda9f5" dependencies = [ "log", - "miden-assembly-syntax", - "miden-core", - "miden-mast-package", + "miden-assembly-syntax 0.17.1", + "miden-core 0.17.1", + "miden-mast-package 0.17.1", + "smallvec", + "thiserror 2.0.12", +] + +[[package]] +name = "miden-assembly" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7719656b8064503cb84405ed9d9124025b4e90731f4577d0dc747242d483ea4" +dependencies = [ + "log", + "miden-assembly-syntax 0.18.0", + "miden-core 0.18.0", + "miden-mast-package 0.18.0", "smallvec", "thiserror 2.0.12", ] @@ -2648,9 +2885,9 @@ dependencies = [ "lalrpop", "lalrpop-util", "log", - "miden-core", - "miden-debug-types", - "miden-utils-diagnostics", + "miden-core 0.17.1", + "miden-debug-types 0.17.1", + "miden-utils-diagnostics 0.17.1", "midenc-hir-type 0.1.5", "regex", "rustc_version 0.4.1", @@ -2659,6 +2896,28 @@ dependencies = [ "thiserror 2.0.12", ] +[[package]] +name = "miden-assembly-syntax" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b343d32937785e508c2ea094e11f5d9aca6f0dda37ee1cf4aa7c3309ae9c089" +dependencies = [ + "aho-corasick", + "lalrpop", + "lalrpop-util", + "log", + "miden-core 0.18.0", + "miden-debug-types 0.18.0", + "miden-utils-diagnostics 0.18.0", + "midenc-hir-type 0.4.2", + "proptest", + "regex", + "rustc_version 0.4.1", + "semver 1.0.26", + "smallvec", + "thiserror 2.0.12", +] + [[package]] name = "miden-base" version = "0.7.0" @@ -2725,8 +2984,25 @@ version = "0.17.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "571a943a923e5fb3f1bed534f41a1542c531ad2aec87dc0d5699af1709fbcea6" dependencies = [ - "miden-crypto", - "miden-debug-types", + "miden-crypto 0.15.9", + "miden-debug-types 0.17.1", + "miden-formatting", + "num-derive", + "num-traits", + "thiserror 2.0.12", + "winter-math", + "winter-utils", +] + +[[package]] +name = "miden-core" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fbcdfc12e9ef7ac5731f1bfd5985486292696a3bcf974667e3680d9c4d7f9c87" +dependencies = [ + "enum_dispatch", + "miden-crypto 0.17.0", + "miden-debug-types 0.18.0", "miden-formatting", "num-derive", "num-traits", @@ -2755,6 +3031,34 @@ dependencies = [ "winter-utils", ] +[[package]] +name = "miden-crypto" +version = "0.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b8c283ed3017d58d9b648d9b1099f26abff52b185ecbb7b91ff4fb406c286b7" +dependencies = [ + "blake3", + "cc", + "chacha20poly1305", + "flume", + "getrandom 0.2.16", + "glob", + "hkdf", + "k256", + "num", + "num-complex", + "rand 0.9.2", + "rand_chacha 0.9.0", + "rand_core 0.9.3", + "rand_hc", + "sha3", + "thiserror 2.0.12", + "winter-crypto", + "winter-math", + "winter-utils", + "zeroize", +] + [[package]] name = "miden-debug-types" version = "0.17.1" @@ -2762,10 +3066,27 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "93a4b53092da70aa4c9b75acc85e1c7b4d8202ce89487d2271ebdc2defcb08d6" dependencies = [ "memchr", - "miden-crypto", + "miden-crypto 0.15.9", "miden-formatting", "miden-miette", - "miden-utils-sync", + "miden-utils-sync 0.17.1", + "paste", + "serde", + "serde_spanned 1.0.0", + "thiserror 2.0.12", +] + +[[package]] +name = "miden-debug-types" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb09918a959cad19c181568dfd3580324f72429d1ba818d90d0b04fb36a4f715" +dependencies = [ + "memchr", + "miden-crypto 0.17.0", + "miden-formatting", + "miden-miette", + "miden-utils-sync 0.18.0", "paste", "serde", "serde_spanned 1.0.0", @@ -2788,9 +3109,9 @@ dependencies = [ "anyhow", "fs2", "miden-client", - "miden-core", + "miden-core 0.18.0", "miden-integration-tests", - "miden-mast-package", + "miden-mast-package 0.18.0", "miden-objects", "midenc-frontend-wasm", "rand 0.9.2", @@ -2812,11 +3133,11 @@ dependencies = [ "filetime", "glob", "log", - "miden-assembly", - "miden-core", - "miden-mast-package", + "miden-assembly 0.18.0", + "miden-core 0.18.0", + "miden-mast-package 0.18.0", "miden-objects", - "miden-processor", + "miden-processor 0.18.0", "midenc-codegen-masm", "midenc-compile", "midenc-debug", @@ -2840,10 +3161,10 @@ version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d97cbdddaf0c2edae3b2844db1d2a4746d498e2d865ac0ff5d76b700a9221e71" dependencies = [ - "miden-assembly", + "miden-assembly 0.17.1", "miden-objects", - "miden-processor", - "miden-stdlib", + "miden-processor 0.17.1", + "miden-stdlib 0.17.1", "regex", "thiserror 2.0.12", "walkdir", @@ -2856,8 +3177,20 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "57efbfaea75eeb07d448c04aefce241bf8f23ea11600a669d897280551819992" dependencies = [ "derive_more", - "miden-assembly-syntax", - "miden-core", + "miden-assembly-syntax 0.17.1", + "miden-core 0.17.1", +] + +[[package]] +name = "miden-mast-package" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "125bfb772948874e78d154f0b9a4caf22ea839c45aa6e72d2daeb23fda0775c1" +dependencies = [ + "derive_more", + "miden-assembly-syntax 0.18.0", + "miden-core 0.18.0", + "thiserror 2.0.12", ] [[package]] @@ -2922,11 +3255,11 @@ checksum = "a16bce60bda18cfeaa49e99e35307c6f45297bfe2f0e18c009fa356edd552e70" dependencies = [ "bech32", "getrandom 0.3.3", - "miden-assembly", - "miden-core", - "miden-crypto", - "miden-processor", - "miden-utils-sync", + "miden-assembly 0.17.1", + "miden-core 0.17.1", + "miden-crypto 0.15.9", + "miden-processor 0.17.1", + "miden-utils-sync 0.17.1", "miden-verifier", "semver 1.0.26", "serde", @@ -2940,10 +3273,26 @@ version = "0.17.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e3c033f51b575b5a70b763dc0bc05062b6562a8286c6d0c144eaff92da8f214f" dependencies = [ - "miden-air", - "miden-core", - "miden-debug-types", - "miden-utils-diagnostics", + "miden-air 0.17.1", + "miden-core 0.17.1", + "miden-debug-types 0.17.1", + "miden-utils-diagnostics 0.17.1", + "thiserror 2.0.12", + "tracing", + "winter-prover", +] + +[[package]] +name = "miden-processor" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8074e1e08aa5ac1b570f8e23275127f75aedf3b28eda615b9699018776c7169e" +dependencies = [ + "miden-air 0.18.0", + "miden-core 0.18.0", + "miden-debug-types 0.18.0", + "miden-utils-diagnostics 0.18.0", + "paste", "thiserror 2.0.12", "tracing", "winter-prover", @@ -2955,9 +3304,9 @@ version = "0.17.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "50d2479d594077a0f66b50a5bb1441bdf3824426a6c6b5ddda0b4df3031b0f2f" dependencies = [ - "miden-air", - "miden-debug-types", - "miden-processor", + "miden-air 0.17.1", + "miden-debug-types 0.17.1", + "miden-processor 0.17.1", "tracing", "winter-maybe-async", "winter-prover", @@ -2995,10 +3344,25 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5f6d69ecc86e53b9e732b66ef198d444a7c853676fd79e875dc3523dba33d70d" dependencies = [ "env_logger", - "miden-assembly", - "miden-core", - "miden-processor", - "miden-utils-sync", + "miden-assembly 0.17.1", + "miden-core 0.17.1", + "miden-processor 0.17.1", + "miden-utils-sync 0.17.1", + "thiserror 2.0.12", +] + +[[package]] +name = "miden-stdlib" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94e78035c073f88709af30eb7823390b05eaeb6692a8eac869f309ba836968d9" +dependencies = [ + "env_logger", + "miden-assembly 0.18.0", + "miden-core 0.18.0", + "miden-crypto 0.17.0", + "miden-processor 0.18.0", + "miden-utils-sync 0.18.0", "thiserror 2.0.12", ] @@ -3034,7 +3398,7 @@ checksum = "21e3b4f65ef4d94f071b354e5c8cec01aff311bf9f9376bbf905b98c6955eeb8" dependencies = [ "miden-lib", "miden-objects", - "miden-processor", + "miden-processor 0.17.1", "miden-prover", "miden-verifier", "rand 0.9.2", @@ -3048,8 +3412,21 @@ version = "0.17.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7d640d80ce3438275b13d0d400901e5bbf3179737818d91d4e84f747a480fd8b" dependencies = [ - "miden-crypto", - "miden-debug-types", + "miden-crypto 0.15.9", + "miden-debug-types 0.17.1", + "miden-miette", + "paste", + "tracing", +] + +[[package]] +name = "miden-utils-diagnostics" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6619048a6027feb08af62adb6a26a959a7e817987f4c4baa208a775eda550c4" +dependencies = [ + "miden-crypto 0.17.0", + "miden-debug-types 0.18.0", "miden-miette", "paste", "tracing", @@ -3066,14 +3443,25 @@ dependencies = [ "parking_lot", ] +[[package]] +name = "miden-utils-sync" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc49b00e9c15ef7e67debed489e9d4dbe3b12dbf91d98e815bf6a6768ff60a9d" +dependencies = [ + "lock_api", + "loom", + "parking_lot", +] + [[package]] name = "miden-verifier" version = "0.17.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3104dce8b4668639aa97aa748a98aab0ea33c103e06ef5c3fd12445ab3bd2387" dependencies = [ - "miden-air", - "miden-core", + "miden-air 0.17.1", + "miden-core 0.17.1", "thiserror 2.0.12", "tracing", "winter-verifier", @@ -3105,12 +3493,12 @@ dependencies = [ "inventory", "itertools 0.14.0", "log", - "miden-assembly", - "miden-assembly-syntax", - "miden-core", + "miden-assembly 0.18.0", + "miden-assembly-syntax 0.18.0", + "miden-core 0.18.0", "miden-lib", - "miden-mast-package", - "miden-processor", + "miden-mast-package 0.18.0", + "miden-processor 0.18.0", "miden-thiserror", "midenc-dialect-arith", "midenc-dialect-cf", @@ -3134,8 +3522,8 @@ dependencies = [ "clap", "inventory", "log", - "miden-assembly", - "miden-mast-package", + "miden-assembly 0.18.0", + "miden-mast-package 0.18.0", "miden-thiserror", "midenc-codegen-masm", "midenc-dialect-hir", @@ -3156,12 +3544,12 @@ dependencies = [ "futures", "glob", "log", - "miden-assembly", - "miden-core", - "miden-debug-types", + "miden-assembly 0.18.0", + "miden-core 0.18.0", + "miden-debug-types 0.18.0", "miden-lib", - "miden-mast-package", - "miden-processor", + "miden-mast-package 0.18.0", + "miden-processor 0.18.0", "miden-thiserror", "midenc-codegen-masm", "midenc-hir", @@ -3261,7 +3649,7 @@ dependencies = [ "gimli", "indexmap", "log", - "miden-core", + "miden-core 0.18.0", "miden-thiserror", "midenc-dialect-arith", "midenc-dialect-cf", @@ -3290,7 +3678,7 @@ dependencies = [ "intrusive-collections", "inventory", "log", - "miden-core", + "miden-core 0.18.0", "miden-thiserror", "midenc-hir-macros", "midenc-hir-symbol", @@ -3381,6 +3769,17 @@ dependencies = [ "thiserror 2.0.12", ] +[[package]] +name = "midenc-hir-type" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7798671ffbf6596de00619a9abaec67dc26965b891328c9d65c4cb6007597d50" +dependencies = [ + "miden-formatting", + "smallvec", + "thiserror 2.0.12", +] + [[package]] name = "midenc-hir-type" version = "0.4.3" @@ -3400,13 +3799,13 @@ dependencies = [ "clap", "inventory", "log", - "miden-assembly", - "miden-assembly-syntax", - "miden-core", - "miden-debug-types", + "miden-assembly 0.18.0", + "miden-assembly-syntax 0.18.0", + "miden-core 0.18.0", + "miden-debug-types 0.18.0", "miden-lib", - "miden-mast-package", - "miden-stdlib", + "miden-mast-package 0.18.0", + "miden-stdlib 0.18.0", "miden-thiserror", "midenc-hir-macros", "midenc-hir-symbol", @@ -3489,6 +3888,15 @@ dependencies = [ "rand 0.8.5", ] +[[package]] +name = "nanorand" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a51313c5820b0b02bd422f4b44776fbf47961755c74ce64afc73bfad10226c3" +dependencies = [ + "getrandom 0.2.16", +] + [[package]] name = "new_debug_unreachable" version = "1.0.6" @@ -3680,6 +4088,12 @@ version = "11.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d6790f58c7ff633d8771f42965289203411a5e5c68388703c06e14f24770b41e" +[[package]] +name = "opaque-debug" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381" + [[package]] name = "openssl-probe" version = "0.1.6" @@ -3905,6 +4319,16 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" +[[package]] +name = "pkcs8" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" +dependencies = [ + "der", + "spki", +] + [[package]] name = "pkg-config" version = "0.3.32" @@ -3952,6 +4376,17 @@ dependencies = [ "plotters-backend", ] +[[package]] +name = "poly1305" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8159bd90725d2df49889a078b54f4f79e87f1f8a8444194cdca81d38f5393abf" +dependencies = [ + "cpufeatures", + "opaque-debug", + "universal-hash", +] + [[package]] name = "portable-atomic" version = "1.11.1" @@ -4038,9 +4473,9 @@ dependencies = [ [[package]] name = "proptest" -version = "1.7.0" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6fcdab19deb5195a31cf7726a210015ff1496ba1464fd42cb4f537b8b01b471f" +checksum = "2bb0be07becd10686a0bb407298fb425360a5c44a663774406340c59a22de4ce" dependencies = [ "bit-set", "bit-vec", @@ -4282,6 +4717,15 @@ dependencies = [ "getrandom 0.3.3", ] +[[package]] +name = "rand_hc" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b363d4f6370f88d62bf586c80405657bde0f0e1b8945d47d2ad59b906cb4f54" +dependencies = [ + "rand_core 0.6.4", +] + [[package]] name = "rand_xorshift" version = "0.4.0" @@ -4395,6 +4839,16 @@ dependencies = [ "windows-sys 0.59.0", ] +[[package]] +name = "rfc6979" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dd2a808d456c4a54e300a23e9f5a67e122c3024119acbfd73e3bf664491cb2" +dependencies = [ + "hmac", + "subtle", +] + [[package]] name = "rhai" version = "1.22.2" @@ -4636,6 +5090,20 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" +[[package]] +name = "sec1" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" +dependencies = [ + "base16ct", + "der", + "generic-array", + "pkcs8", + "subtle", + "zeroize", +] + [[package]] name = "security-framework" version = "3.2.0" @@ -4864,6 +5332,16 @@ dependencies = [ "libc", ] +[[package]] +name = "signature" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" +dependencies = [ + "digest", + "rand_core 0.6.4", +] + [[package]] name = "similar" version = "2.7.0" @@ -4923,6 +5401,19 @@ name = "spin" version = "0.9.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" +dependencies = [ + "lock_api", +] + +[[package]] +name = "spki" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d" +dependencies = [ + "base64ct", + "der", +] [[package]] name = "stable_deref_trait" @@ -5741,6 +6232,16 @@ version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "323402cff2dd658f39ca17c789b502021b3f18707c91cdf22e3838e1b4023817" +[[package]] +name = "universal-hash" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc1de2c688dc15305988b563c3854064043356019f97a4b46276fe734c4f07ea" +dependencies = [ + "crypto-common", + "subtle", +] + [[package]] name = "untrusted" version = "0.9.0" diff --git a/Cargo.toml b/Cargo.toml index 6c8d4f4af..e4129a63a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -73,20 +73,20 @@ inventory = "0.3" log = "0.4" # Miden Dependencies -miden-assembly = { version = "0.17.1", default-features = false } -miden-core = { version = "0.17.1", default-features = false } -miden-debug-types = { version = "0.17.1", default-features = false } -miden-assembly-syntax = { version = "0.17.1", default-features = false } +miden-assembly = { version = "0.18.0", default-features = false } +miden-core = { version = "0.18.0", default-features = false } +miden-debug-types = { version = "0.18.0", default-features = false } +miden-assembly-syntax = { version = "0.18.0", default-features = false } miden-formatting = { version = "0.1", default-features = false } miden-lib = { version = "0.11.0", default-features = false, features = [ "with-debug-info", ] } miden-objects = { version = "0.11.0", default-features = false } -miden-processor = { version = "0.17.1", default-features = false } -miden-stdlib = { version = "0.17.1", default-features = false, features = [ +miden-processor = { version = "0.18.0", default-features = false } +miden-stdlib = { version = "0.18.0", default-features = false, features = [ "with-debug-info", ] } -miden-mast-package = { version = "0.17.1", default-features = false } +miden-mast-package = { version = "0.18.0", default-features = false } miette = { package = "miden-miette", version = "7.1.1" } paste = "1.0" parking_lot = "0.12" @@ -156,12 +156,19 @@ midenc-expect-test = { path = "tools/expect-test" } [patch.crates-io] #miden-assembly = { git = "https://github.com/0xMiden/miden-vm", rev = "614cd7f9b52f45238b0ab59c71ebb49325051e5d" } +#miden-assembly = { path = "../miden-vm/assembly" } +#miden-assembly-syntax = { path = "../miden-vm/assembly-syntax" } #miden-core = { git = "https://github.com/0xMiden/miden-vm", rev = "614cd7f9b52f45238b0ab59c71ebb49325051e5d" } +#miden-core = { path = "../miden-vm/core" } #miden-client = { git = "https://github.com/0xMiden/miden-client", rev = "f98ae87fc3f77e269c3c1e412d1b8ac650aa6fe3" } +#miden-debug-types = { path = "../miden-vm/crates/debug/types" } #miden-processor = { git = "https://github.com/0xMiden/miden-vm", rev = "614cd7f9b52f45238b0ab59c71ebb49325051e5d" } +#miden-processor = { path = "../miden-vm/processor" } #miden-lib = { git = "https://github.com/0xMiden/miden-base", rev = "64ba4d0f8a077dd7d8f2643ebafa155f95b1c241" } #miden-stdlib = { git = "https://github.com/0xMiden/miden-vm", rev = "614cd7f9b52f45238b0ab59c71ebb49325051e5d" } +#miden-stdlib = { path = "../miden-vm/stdlib" } #miden-mast-package = { git = "https://github.com/0xMiden/miden-vm", rev = "614cd7f9b52f45238b0ab59c71ebb49325051e5d" } +#miden-mast-package = { path = "../miden-vm/package" } [profile.dev] diff --git a/codegen/masm/src/emit/binary.rs b/codegen/masm/src/emit/binary.rs index e314be957..198913f75 100644 --- a/codegen/masm/src/emit/binary.rs +++ b/codegen/masm/src/emit/binary.rs @@ -149,10 +149,8 @@ impl OpEmitter<'_> { assert_eq!(ty, imm.ty(), "expected gt operands to be the same type"); match &ty { Type::Felt => { - self.emit_all( - [masm::Instruction::PushFelt(imm.as_felt().unwrap()), masm::Instruction::Gt], - span, - ); + self.push_immediate(imm, span); + self.emit(masm::Instruction::Gt, span); } Type::U64 => { self.push_u64(imm.as_u64().unwrap(), span); @@ -163,13 +161,11 @@ impl OpEmitter<'_> { self.gt_i64(span); } Type::U32 | Type::U16 | Type::U8 | Type::I1 => { - self.emit_all( - [masm::Instruction::PushU32(imm.as_u32().unwrap()), masm::Instruction::U32Gt], - span, - ); + self.push_immediate(imm, span); + self.emit(masm::Instruction::U32Gt, span); } Type::I32 => { - self.emit(masm::Instruction::PushU32(imm.as_i32().unwrap() as u32), span); + self.push_immediate(imm, span); self.raw_exec("intrinsics::i32::is_gt", span); } ty => unimplemented!("gt is not yet implemented for {ty}"), @@ -208,10 +204,8 @@ impl OpEmitter<'_> { assert_eq!(ty, imm.ty(), "expected gte operands to be the same type"); match &ty { Type::Felt => { - self.emit_all( - [masm::Instruction::PushFelt(imm.as_felt().unwrap()), masm::Instruction::Gte], - span, - ); + self.push_immediate(imm, span); + self.emit(masm::Instruction::Gte, span); } Type::U64 => { self.push_u64(imm.as_u64().unwrap(), span); @@ -222,13 +216,11 @@ impl OpEmitter<'_> { self.gte_i64(span); } Type::U32 | Type::U16 | Type::U8 | Type::I1 => { - self.emit_all( - [masm::Instruction::PushU32(imm.as_u32().unwrap()), masm::Instruction::U32Gte], - span, - ); + self.push_immediate(imm, span); + self.emit(masm::Instruction::U32Gte, span); } Type::I32 => { - self.emit(masm::Instruction::PushU32(imm.as_i32().unwrap() as u32), span); + self.push_immediate(imm, span); self.raw_exec("intrinsics::i32::is_gte", span); } ty => unimplemented!("gte is not yet implemented for {ty}"), @@ -267,10 +259,8 @@ impl OpEmitter<'_> { assert_eq!(ty, imm.ty(), "expected lt operands to be the same type"); match &ty { Type::Felt => { - self.emit_all( - [masm::Instruction::PushFelt(imm.as_felt().unwrap()), masm::Instruction::Lt], - span, - ); + self.push_immediate(imm, span); + self.emit(masm::Instruction::Lt, span); } Type::U64 => { self.push_u64(imm.as_u64().unwrap(), span); @@ -281,13 +271,11 @@ impl OpEmitter<'_> { self.lt_i64(span); } Type::U32 | Type::U16 | Type::U8 | Type::I1 => { - self.emit_all( - [masm::Instruction::PushU32(imm.as_u32().unwrap()), masm::Instruction::U32Lt], - span, - ); + self.push_immediate(imm, span); + self.emit(masm::Instruction::U32Lt, span); } Type::I32 => { - self.emit(masm::Instruction::PushU32(imm.as_i32().unwrap() as u32), span); + self.push_immediate(imm, span); self.raw_exec("intrinsics::i32::is_lt", span); } ty => unimplemented!("lt is not yet implemented for {ty}"), @@ -326,10 +314,8 @@ impl OpEmitter<'_> { assert_eq!(ty, imm.ty(), "expected lte operands to be the same type"); match &ty { Type::Felt => { - self.emit_all( - [masm::Instruction::PushFelt(imm.as_felt().unwrap()), masm::Instruction::Lte], - span, - ); + self.push_immediate(imm, span); + self.emit(masm::Instruction::Lte, span); } Type::U64 => { self.push_u64(imm.as_u64().unwrap(), span); @@ -340,13 +326,11 @@ impl OpEmitter<'_> { self.lte_i64(span); } Type::U32 | Type::U16 | Type::U8 | Type::I1 => { - self.emit_all( - [masm::Instruction::PushU32(imm.as_u32().unwrap()), masm::Instruction::U32Lte], - span, - ); + self.push_immediate(imm, span); + self.emit(masm::Instruction::U32Lte, span); } Type::I32 => { - self.emit(masm::Instruction::PushU32(imm.as_i32().unwrap() as u32), span); + self.push_immediate(imm, span); self.raw_exec("intrinsics::i32::is_lte", span); } ty => unimplemented!("lte is not yet implemented for {ty}"), @@ -889,7 +873,7 @@ impl OpEmitter<'_> { ); } Type::I32 => { - self.emit(masm::Instruction::PushU8(exp), span); + self.emit_push(exp, span); self.raw_exec("intrinsics::i32::ipow", span); } ty @ (Type::U16 | Type::U8) => { @@ -926,10 +910,8 @@ impl OpEmitter<'_> { let ty = lhs.ty(); assert_eq!(ty, imm.ty(), "expected and operands to be the same type"); assert_eq!(ty, Type::I1, "expected and operands to be of boolean type"); - self.emit_all( - [masm::Instruction::PushU8(imm.as_bool().unwrap() as u8), masm::Instruction::And], - span, - ); + self.push_immediate(imm, span); + self.emit(masm::Instruction::And, span); self.push(ty); } @@ -949,10 +931,8 @@ impl OpEmitter<'_> { let ty = lhs.ty(); assert_eq!(ty, imm.ty(), "expected or operands to be the same type"); assert_eq!(ty, Type::I1, "expected or operands to be of boolean type"); - self.emit_all( - [masm::Instruction::PushU8(imm.as_bool().unwrap() as u8), masm::Instruction::Or], - span, - ); + self.push_immediate(imm, span); + self.emit(masm::Instruction::Or, span); self.push(ty); } @@ -972,10 +952,8 @@ impl OpEmitter<'_> { let ty = lhs.ty(); assert_eq!(ty, imm.ty(), "expected xor operands to be the same type"); assert_eq!(ty, Type::I1, "expected xor operands to be of boolean type"); - self.emit_all( - [masm::Instruction::PushU8(imm.as_bool().unwrap() as u8), masm::Instruction::Xor], - span, - ); + self.push_immediate(imm, span); + self.emit(masm::Instruction::Xor, span); self.push(ty); } @@ -1077,10 +1055,10 @@ impl OpEmitter<'_> { Type::I32 | Type::I16 | Type::I8 => { self.band_imm_u32(imm.as_i64().unwrap() as u64 as u32, span) } - Type::I1 => self.emit_all( - [masm::Instruction::PushU8(imm.as_bool().unwrap() as u8), masm::Instruction::And], - span, - ), + Type::I1 => { + self.push_immediate(imm, span); + self.emit(masm::Instruction::And, span); + } ty if !ty.is_integer() => { panic!("invalid binary operand: band expects integer operands, got {ty}") } @@ -1187,10 +1165,10 @@ impl OpEmitter<'_> { Type::I32 | Type::I16 | Type::I8 => { self.bor_imm_u32(imm.as_i64().unwrap() as u64 as u32, span) } - Type::I1 => self.emit_all( - [masm::Instruction::PushU8(imm.as_bool().unwrap().into()), masm::Instruction::And], - span, - ), + Type::I1 => { + self.push_immediate(imm, span); + self.emit(masm::Instruction::And, span); + } ty if !ty.is_integer() => { panic!("invalid binary operand: bor expects integer operands, got {ty}") } @@ -1305,10 +1283,10 @@ impl OpEmitter<'_> { self.bxor_imm_u32(imm.as_i64().unwrap() as u64 as u32, span); self.trunc_int32(ty.size_in_bits() as u32, span); } - Type::I1 => self.emit_all( - [masm::Instruction::PushU8(imm.as_bool().unwrap().into()), masm::Instruction::Xor], - span, - ), + Type::I1 => { + self.push_immediate(imm, span); + self.emit(masm::Instruction::Xor, span); + } ty if !ty.is_integer() => { panic!("invalid binary operand: bxor expects integer operands, got {ty}") } diff --git a/codegen/masm/src/emit/felt.rs b/codegen/masm/src/emit/felt.rs index 36eae3f08..b08ab8395 100644 --- a/codegen/masm/src/emit/felt.rs +++ b/codegen/masm/src/emit/felt.rs @@ -44,14 +44,9 @@ impl OpEmitter<'_> { /// `[a, ..] => [0, 0, a_hi, a_lo]` #[inline] pub fn felt_to_i128(&mut self, span: SourceSpan) { - self.emit_all( - [ - masm::Instruction::U32Split, - masm::Instruction::PushFelt(ZERO), - masm::Instruction::PushFelt(ZERO), - ], - span, - ); + self.emit(masm::Instruction::U32Split, span); + self.emit_push(ZERO, span); + self.emit_push(ZERO, span); } /// Convert a field element to u64 by zero-extension. diff --git a/codegen/masm/src/emit/int32.rs b/codegen/masm/src/emit/int32.rs index b20e6f7ec..8c8cb8fca 100644 --- a/codegen/masm/src/emit/int32.rs +++ b/codegen/masm/src/emit/int32.rs @@ -19,7 +19,8 @@ impl OpEmitter<'_> { /// `[a, ..] => [a & mask, ..]` #[inline] pub fn const_mask_u32(&mut self, mask: u32, span: SourceSpan) { - self.emit_all([masm::Instruction::PushU32(mask), masm::Instruction::U32And], span); + self.emit_push(mask, span); + self.emit(masm::Instruction::U32And, span); } /// Emits code to apply a 32-bit mask, `mask`, to a u32 value, `input`. @@ -182,15 +183,9 @@ impl OpEmitter<'_> { self.emit(movup_from_offset(n as usize), span); self.select_int32(a, b, span); } else { - self.emit_all( - [ - masm::Instruction::PushU32(b), - masm::Instruction::PushU32(a), - movup_from_offset(n as usize + 2), - masm::Instruction::CDrop, - ], - span, - ); + self.emit_push(b, span); + self.emit_push(a, span); + self.emit_all([movup_from_offset(n as usize + 2), masm::Instruction::CDrop], span); } } @@ -209,15 +204,9 @@ impl OpEmitter<'_> { self.emit(dup_from_offset(n as usize), span); self.select_int32(a, b, span); } else { - self.emit_all( - [ - masm::Instruction::PushU32(b), - masm::Instruction::PushU32(a), - dup_from_offset(n as usize + 2), - masm::Instruction::CDrop, - ], - span, - ); + self.emit_push(b, span); + self.emit_push(a, span); + self.emit_all([dup_from_offset(n as usize + 2), masm::Instruction::CDrop], span); } } @@ -227,15 +216,9 @@ impl OpEmitter<'_> { /// /// `[c, a, b, ..] => [d, ..] where d is c == 1 ? a : b` pub fn select_int32(&mut self, a: u32, b: u32, span: SourceSpan) { - self.emit_all( - [ - masm::Instruction::PushU32(b), - masm::Instruction::PushU32(a), - masm::Instruction::MovUp2, - masm::Instruction::CDrop, - ], - span, - ); + self.emit_push(b, span); + self.emit_push(a, span); + self.emit_all([masm::Instruction::MovUp2, masm::Instruction::CDrop], span); } /// Convert an i32/u32 value on the stack to a signed N-bit integer value @@ -304,18 +287,13 @@ impl OpEmitter<'_> { // Mask the value and ensure that the unused bits above the N-bit range are 0 let reserved = 32 - n; let mask = (2u32.pow(reserved) - 1) << n; - self.emit_all( - [ - // Copy the input - masm::Instruction::Dup1, - // Apply the mask - masm::Instruction::PushU32(mask), - masm::Instruction::U32And, - // Assert the masked value is all 0s - masm::Instruction::Assertz, - ], - span, - ); + // Copy the input + self.emit(masm::Instruction::Dup1, span); + // Apply the mask + self.emit_push(mask, span); + self.emit(masm::Instruction::U32And, span); + // Assert the masked value is all 0s + self.emit(masm::Instruction::Assertz, span); } /// Convert an i32/u32 value on the stack to an unsigned N-bit integer value @@ -326,18 +304,13 @@ impl OpEmitter<'_> { // Mask the value and ensure that the unused bits above the N-bit range are 0 let reserved = 32 - n; let mask = (2u32.pow(reserved) - 1) << n; - self.emit_all( - [ - // Copy the input - masm::Instruction::Dup1, - // Apply the mask - masm::Instruction::PushU32(mask), - masm::Instruction::U32And, - // Assert the masked value is all 0s - masm::Instruction::EqImm(Felt::ZERO.into()), - ], - span, - ); + // Copy the input + self.emit(masm::Instruction::Dup1, span); + // Apply the mask + self.emit_push(mask, span); + self.emit(masm::Instruction::U32And, span); + // Assert the masked value is all 0s + self.emit(masm::Instruction::EqImm(Felt::ZERO.into()), span); } /// Emit code to truncate a 32-bit value on top of the operand stack, to N bits, where N is <= @@ -373,7 +346,14 @@ impl OpEmitter<'_> { let num_bits = n % 32; let num_elements = (n / 32) + (num_bits > 0) as u32; let needed = num_elements - 1; - self.emit_n(needed as usize, masm::Instruction::PushU32(0), span); + self.emit_n( + needed as usize, + masm::Instruction::Push(masm::Immediate::Value(masm::Span::new( + span, + Felt::ZERO.into(), + ))), + span, + ); } /// Emit code to sign-extend a signed 32-bit value to N bits, where N <= 128 @@ -415,13 +395,13 @@ impl OpEmitter<'_> { /// Push a u32 value on the stack #[inline(always)] pub fn push_u32(&mut self, i: u32, span: SourceSpan) { - self.emit(masm::Instruction::PushU32(i), span); + self.emit_push(i, span); } /// Push a i32 value on the stack #[inline(always)] pub fn push_i32(&mut self, i: i32, span: SourceSpan) { - self.emit(masm::Instruction::PushU32(i as u32), span); + self.emit_push(i as u32, span); } /// This is the inverse operation of the Miden VM `u32split` instruction. @@ -517,11 +497,11 @@ impl OpEmitter<'_> { self.add_imm_u32(imm as u32, overflow, span) } Overflow::Checked => { - self.emit(masm::Instruction::PushU32(imm as u32), span); + self.emit_push(imm as u32, span); self.raw_exec("intrinsics::i32::checked_add", span); } Overflow::Overflowing => { - self.emit(masm::Instruction::PushU32(imm as u32), span); + self.emit_push(imm as u32, span); self.raw_exec("intrinsics::i32::overflowing_add", span); } } @@ -600,11 +580,11 @@ impl OpEmitter<'_> { self.sub_imm_u32(imm as u32, overflow, span) } Overflow::Checked => { - self.emit(masm::Instruction::PushU32(imm as u32), span); + self.emit_push(imm as u32, span); self.raw_exec("intrinsics::i32::checked_sub", span); } Overflow::Overflowing => { - self.emit(masm::Instruction::PushU32(imm as u32), span); + self.emit_push(imm as u32, span); self.raw_exec("intrinsics::i32::overflowing_sub", span); } } @@ -653,7 +633,8 @@ impl OpEmitter<'_> { pub fn mul_imm_u32(&mut self, imm: u32, overflow: Overflow, span: SourceSpan) { match imm { 0 => { - self.emit_all([masm::Instruction::Drop, masm::Instruction::PushU32(0)], span); + self.emit(masm::Instruction::Drop, span); + self.emit_push(0u32, span); } 1 => (), imm => { @@ -694,20 +675,21 @@ impl OpEmitter<'_> { pub fn mul_imm_i32(&mut self, imm: i32, overflow: Overflow, span: SourceSpan) { match imm { 0 => { - self.emit_all([masm::Instruction::Drop, masm::Instruction::PushU32(0)], span); + self.emit(masm::Instruction::Drop, span); + self.emit_push(0u32, span); } 1 => (), imm => match overflow { Overflow::Unchecked | Overflow::Wrapping => { - self.emit(masm::Instruction::PushU32(imm as u32), span); + self.emit_push(imm as u32, span); self.raw_exec("intrinsics::i32::wrapping_mul", span); } Overflow::Checked => { - self.emit(masm::Instruction::PushU32(imm as u32), span); + self.emit_push(imm as u32, span); self.raw_exec("intrinsics::i32::checked_mul", span) } Overflow::Overflowing => { - self.emit(masm::Instruction::PushU32(imm as u32), span); + self.emit_push(imm as u32, span); self.raw_exec("intrinsics::i32::overflowing_mul", span); } }, @@ -748,7 +730,7 @@ impl OpEmitter<'_> { /// This operation is checked, so if the operand or result are not valid i32, execution traps. pub fn checked_div_imm_i32(&mut self, imm: i32, span: SourceSpan) { assert_ne!(imm, 0, "division by zero is not allowed"); - self.emit(masm::Instruction::PushU32(imm as u32), span); + self.emit_push(imm as u32, span); self.raw_exec("intrinsics::i32::checked_div", span); } @@ -848,7 +830,8 @@ impl OpEmitter<'_> { /// /// This operation is checked, if the operand or result are not valid u32, execution traps. pub fn band_imm_u32(&mut self, imm: u32, span: SourceSpan) { - self.emit_all([masm::Instruction::PushU32(imm), masm::Instruction::U32And], span); + self.emit_push(imm, span); + self.emit(masm::Instruction::U32And, span); } /// Pops two u32 values off the stack, `b` and `a`, and performs `a | b` @@ -862,7 +845,8 @@ impl OpEmitter<'_> { /// /// This operation is checked, if the operand or result are not valid u32, execution traps. pub fn bor_imm_u32(&mut self, imm: u32, span: SourceSpan) { - self.emit_all([masm::Instruction::PushU32(imm), masm::Instruction::U32Or], span); + self.emit_push(imm, span); + self.emit(masm::Instruction::U32Or, span); } /// Pops two u32 values off the stack, `b` and `a`, and performs `a ^ b` @@ -876,7 +860,8 @@ impl OpEmitter<'_> { /// /// This operation is checked, if the operand or result are not valid u32, execution traps. pub fn bxor_imm_u32(&mut self, imm: u32, span: SourceSpan) { - self.emit_all([masm::Instruction::PushU32(imm), masm::Instruction::U32Xor], span); + self.emit_push(imm, span); + self.emit(masm::Instruction::U32Xor, span); } /// Pops a u32 value off the stack, `a`, and performs `!a` @@ -934,7 +919,7 @@ impl OpEmitter<'_> { /// This operation is checked, if the operand or result are not valid i32, execution traps. pub fn shr_imm_i32(&mut self, imm: u32, span: SourceSpan) { assert!(imm < 32, "invalid shift value: must be < 32, got {imm}"); - self.emit(masm::Instruction::PushU32(imm), span); + self.emit_push(imm, span); self.raw_exec("intrinsics::i32::checked_shr", span); } @@ -993,14 +978,15 @@ impl OpEmitter<'_> { /// /// This operation is checked, if the operand or result are not valid u32, execution traps. pub fn min_imm_u32(&mut self, imm: u32, span: SourceSpan) { - self.emit_all([masm::Instruction::PushU32(imm), masm::Instruction::U32Min], span); + self.emit_push(imm, span); + self.emit(masm::Instruction::U32Min, span); } /// Pops a i32 value off the stack, `a`, and puts the result of `min(a, imm)` on the stack /// /// This operation is checked, if the operand or result are not valid i32, execution traps. pub fn min_imm_i32(&mut self, imm: i32, span: SourceSpan) { - self.emit(masm::Instruction::PushU32(imm as u32), span); + self.emit_push(imm as u32, span); self.raw_exec("intrinsics::i32::min", span); } @@ -1024,14 +1010,15 @@ impl OpEmitter<'_> { /// /// This operation is checked, if the operand or result are not valid u32, execution traps. pub fn max_imm_u32(&mut self, imm: u32, span: SourceSpan) { - self.emit_all([masm::Instruction::PushU32(imm), masm::Instruction::U32Max], span); + self.emit_push(imm, span); + self.emit(masm::Instruction::U32Max, span); } /// Pops a i32 value off the stack, `a`, and puts the result of `max(a, imm)` on the stack /// /// This operation is checked, if the operand or result are not valid i32, execution traps. pub fn max_imm_i32(&mut self, imm: i32, span: SourceSpan) { - self.emit(masm::Instruction::PushU32(imm as u32), span); + self.emit_push(imm as u32, span); self.raw_exec("intrinsics::i32::max", span); } } diff --git a/codegen/masm/src/emit/int64.rs b/codegen/masm/src/emit/int64.rs index 8fca61cdf..2a18ead5a 100644 --- a/codegen/masm/src/emit/int64.rs +++ b/codegen/masm/src/emit/int64.rs @@ -37,12 +37,11 @@ impl OpEmitter<'_> { masm::Instruction::Assertz, // Check that the remaining bits fit in range masm::Instruction::Dup0, - masm::Instruction::PushFelt(Felt::new(2u64.pow(n) - 1)), - masm::Instruction::U32Lte, - masm::Instruction::Assert, ], span, ); + self.emit_push(Felt::new(2u64.pow(n) - 1), span); + self.emit_all([masm::Instruction::U32Lte, masm::Instruction::Assert], span); } /// Convert an i64 value to a signed N-bit integer, where N <= 32 @@ -87,12 +86,12 @@ impl OpEmitter<'_> { let value_bits = (2u64.pow(n - 1) - 1) as u32; // [sign_bits, is_unsigned, x_lo] self.const_mask_u32(!value_bits, span); + // [sign_bits, sign_bits, ..] + self.emit(masm::Instruction::Dup0, span); + // [0, sign_bits, sign_bits, is_unsigned, x_lo] + self.emit_push(0u32, span); self.emit_all( [ - // [sign_bits, sign_bits, ..] - masm::Instruction::Dup0, - // [0, sign_bits, sign_bits, is_unsigned, x_lo] - masm::Instruction::PushU32(0), // [is_unsigned, 0, sign_bits, sign_bits, x_lo] masm::Instruction::MovUp3, // [expected_sign_bits, sign_bits, x_lo] @@ -555,15 +554,9 @@ impl OpEmitter<'_> { pub fn mul_imm_i64(&mut self, imm: i64, overflow: Overflow, span: SourceSpan) { match imm { 0 => { - self.emit_all( - [ - masm::Instruction::Drop, - masm::Instruction::Drop, - masm::Instruction::PushU32(0), - masm::Instruction::PushU32(0), - ], - span, - ); + self.emit_all([masm::Instruction::Drop, masm::Instruction::Drop], span); + self.emit_push(0u32, span); + self.emit_push(0u32, span); } 1 => (), imm => match overflow { @@ -721,7 +714,7 @@ impl OpEmitter<'_> { /// This operation is checked, if the operand or result are not valid i64, execution traps. pub fn shr_imm_i64(&mut self, imm: u32, span: SourceSpan) { assert!(imm < 63, "invalid shift value: must be < 63, got {imm}"); - self.emit(masm::Instruction::PushU32(imm), span); + self.emit_push(imm, span); self.raw_exec("intrinsics::i64::checked_shr", span); } @@ -763,10 +756,16 @@ pub fn to_raw_parts(value: u64) -> (u32, u32) { pub fn from_raw_parts(lo: u32, hi: u32, block: &mut Vec, span: SourceSpan) { block.push(masm::Op::Inst(Span::new( span, - masm::Instruction::PushFelt(Felt::new(lo as u64)), + masm::Instruction::Push(masm::Immediate::Value(Span::new( + span, + Felt::new(lo as u64).into(), + ))), ))); block.push(masm::Op::Inst(Span::new( span, - masm::Instruction::PushFelt(Felt::new(hi as u64)), + masm::Instruction::Push(masm::Immediate::Value(Span::new( + span, + Felt::new(hi as u64).into(), + ))), ))); } diff --git a/codegen/masm/src/emit/mem.rs b/codegen/masm/src/emit/mem.rs index 44adb4a1a..bb6a0b541 100644 --- a/codegen/masm/src/emit/mem.rs +++ b/codegen/masm/src/emit/mem.rs @@ -117,16 +117,15 @@ impl OpEmitter<'_> { span, ); } else { - self.emit_all([masm::Instruction::PushU8(0), masm::Instruction::Swap1], span); + self.emit_push(0u8, span); + self.emit(masm::Instruction::Swap1, span); } } /// Push a [NativePtr] value to the operand stack in the expected stack representation. fn push_native_ptr(&mut self, ptr: NativePtr, span: SourceSpan) { - self.emit_all( - [masm::Instruction::PushU8(ptr.offset), masm::Instruction::PushU32(ptr.addr)], - span, - ); + self.emit_push(ptr.offset, span); + self.emit_push(ptr.addr, span); } /// Load a field element from a naturally aligned address, either immediate or dynamic @@ -207,11 +206,12 @@ impl OpEmitter<'_> { 16 => 0xffff, _ => unreachable!("load_small called with non-small type"), }; - self.emit_all([masm::Instruction::PushU32(mask), masm::Instruction::U32And], span); + self.emit_push(mask as u32, span); + self.emit(masm::Instruction::U32And, span); return; } else { - self.emit(masm::Instruction::PushU32(imm.addr), span); - self.emit(masm::Instruction::PushU8(imm.offset), span); + self.emit_push(imm.addr, span); + self.emit_push(imm.offset, span); } } @@ -228,11 +228,11 @@ impl OpEmitter<'_> { self.emit(masm::Instruction::Swap1, span); // [byte_offset, loaded_word, element_addr] // Shift right by (offset * 8) bits to get our byte at the low end + self.emit_push(8u8, span); // [8, byte_offset, loaded_word, element_addr] self.emit_all( [ - masm::Instruction::PushU8(8), // [8, byte_offset, loaded_word, element_addr] masm::Instruction::U32WrappingMul, // [offset*8, loaded_word, element_addr] - masm::Instruction::U32Shr, // [shifted_word, element_addr] + masm::Instruction::U32Shr, // [shifted_word, element_addr] ], span, ); @@ -249,7 +249,8 @@ impl OpEmitter<'_> { _ => unreachable!("load_small called with non-small type"), }; - self.emit_all([masm::Instruction::PushU32(mask), masm::Instruction::U32And], span); + self.emit_push(mask as u32, span); + self.emit(masm::Instruction::U32And, span); } fn load_double_word_imm(&mut self, ptr: NativePtr, span: SourceSpan) { @@ -607,8 +608,12 @@ impl OpEmitter<'_> { // trap if it overflows masm::Instruction::Dup1, // [dst, i, dst, count, value] masm::Instruction::Dup1, // [i, dst, i, dst, count, value] - masm::Instruction::PushU32(value_size), /* [value_size, i, - * dst, ..] */ + ], + span, + ); + body_emitter.emit_push(value_size, span); // [value_size, i, * dst, ..] + body_emitter.emit_all( + [ masm::Instruction::U32OverflowingMadd, // [value_size * i + dst, i, dst, count, value] masm::Instruction::Assertz, // [aligned_dst, i, dst, count, value..] ], @@ -641,14 +646,12 @@ impl OpEmitter<'_> { // Switch back to original block and emit loop header and 'while.true' instruction // // Loop header - prepare to loop until `count` iterations have been performed - self.emit_all( - [ - // [dst, count, value..] - masm::Instruction::PushU32(0), // [i, dst, count, value..] - masm::Instruction::Dup2, // [count, i, dst, count, value..] - masm::Instruction::PushFelt(Felt::ZERO), - masm::Instruction::Gte, // [count > 0, i, dst, count, value..] - ], + // [dst, count, value..] + self.emit_push(0u32, span); // [i, dst, count, value..] + self.emit(masm::Instruction::Dup2, span); // [count, i, dst, count, value..] + self.emit_push(Felt::ZERO, span); + self.emit( + masm::Instruction::Gte, // [count > 0, i, dst, count, value..] span, ); self.current_block.push(masm::Op::While { @@ -752,12 +755,22 @@ impl OpEmitter<'_> { // [i, src, dst, count] masm::Instruction::Dup2, // [dst, i, src, dst, count] masm::Instruction::Dup1, // [i, dst, i, src, dst, count] - masm::Instruction::PushU32(value_size), // [offset, i, dst, i, src, dst, count] + ], + span, + ); + body_emitter.emit_push(value_size, span); // [offset, i, dst, i, src, dst, count] + body_emitter.emit_all( + [ masm::Instruction::U32OverflowingMadd, masm::Instruction::Assertz, // [new_dst := i * offset + dst, i, src, dst, count] masm::Instruction::Dup2, // [src, new_dst, i, src, dst, count] masm::Instruction::Dup2, // [i, src, new_dst, i, src, dst, count] - masm::Instruction::PushU32(value_size), // [offset, i, src, new_dst, i, src, dst, count] + ], + span, + ); + body_emitter.emit_push(value_size, span); // [offset, i, src, new_dst, i, src, dst, count] + body_emitter.emit_all( + [ masm::Instruction::U32OverflowingMadd, masm::Instruction::Assertz, // [new_src := i * offset + src, new_dst, i, src, dst, count] ], @@ -791,14 +804,13 @@ impl OpEmitter<'_> { // Switch back to original block and emit loop header and 'while.true' instruction // // Loop header - prepare to loop until `count` iterations have been performed - self.emit_all( - [ - // [src, dst, count] - masm::Instruction::PushU32(0), // [i, src, dst, count] - masm::Instruction::Dup3, // [count, i, src, dst, count] - masm::Instruction::PushFelt(Felt::ZERO), - masm::Instruction::Gte, // [count > 0, i, src, dst, count] - ], + + // [src, dst, count] + self.emit_push(0u32, span); // [i, src, dst, count] + self.emit(masm::Instruction::Dup3, span); // [count, i, src, dst, count] + self.emit_push(Felt::ZERO, span); + self.emit( + masm::Instruction::Gte, // [count > 0, i, src, dst, count] span, ); self.current_block.push(masm::Op::While { @@ -963,12 +975,12 @@ impl OpEmitter<'_> { // Calculate bit offset and create mask let type_size_mask = (1u32 << type_size) - 1; + self.emit(masm::Instruction::Dup2, span); // [offset, prev, addr, offset, value] + self.emit_push(8u8, span); // [8, offset, prev, addr, offset, value] + self.emit(masm::Instruction::U32WrappingMul, span); // [bit_offset, prev, addr, offset, value] + self.emit_push(type_size_mask, span); // [type_mask, bit_offset, prev, addr, offset, value] self.emit_all( [ - masm::Instruction::Dup2, // [offset, prev, addr, offset, value] - masm::Instruction::PushU8(8), // [8, offset, prev, addr, offset, value] - masm::Instruction::U32WrappingMul, // [bit_offset, prev, addr, offset, value] - masm::Instruction::PushU32(type_size_mask), // [type_mask, bit_offset, prev, addr, offset, value] masm::Instruction::Swap1, // [bit_offset, type_mask, prev, addr, offset, value] masm::Instruction::U32Shl, // [shifted_mask, prev, addr, offset, value] masm::Instruction::U32Not, // [mask, prev, addr, offset, value] @@ -981,9 +993,14 @@ impl OpEmitter<'_> { // Shift value to correct position and combine self.emit_all( [ - masm::Instruction::MovUp3, // [value, masked_prev, addr, offset] - masm::Instruction::MovUp3, // [offset, value, masked_prev, addr] - masm::Instruction::PushU8(8), // [8, offset, value, masked_prev, addr] + masm::Instruction::MovUp3, // [value, masked_prev, addr, offset] + masm::Instruction::MovUp3, // [offset, value, masked_prev, addr] + ], + span, + ); + self.emit_push(8u8, span); // [8, offset, value, masked_prev, addr] + self.emit_all( + [ masm::Instruction::U32WrappingMul, // [bit_offset, value, masked_prev, addr] masm::Instruction::U32Shl, // [shifted_value, masked_prev, addr] masm::Instruction::U32Or, // [new_value, addr] diff --git a/codegen/masm/src/emit/mod.rs b/codegen/masm/src/emit/mod.rs index 3fa0a1e3f..30f121483 100644 --- a/codegen/masm/src/emit/mod.rs +++ b/codegen/masm/src/emit/mod.rs @@ -219,6 +219,17 @@ impl<'a> OpEmitter<'a> { self.current_block.push(Op::Inst(Span::new(span, inst))); } + /// Emit a `push` instruction of `value` to the current block + #[inline] + pub fn emit_push( + &mut self, + value: impl Into, + span: SourceSpan, + ) { + let inst = masm::Instruction::Push(masm::Immediate::Value(Span::new(span, value.into()))); + self.current_block.push(Op::Inst(Span::new(span, inst))); + } + /// Emit `n` copies of `op` to the current block #[inline(always)] pub fn emit_n(&mut self, count: usize, inst: masm::Instruction, span: SourceSpan) { @@ -275,18 +286,18 @@ impl<'a> OpEmitter<'a> { #[inline] pub fn push_immediate(&mut self, imm: Immediate, span: SourceSpan) { match imm { - Immediate::I1(i) => self.emit(masm::Instruction::PushU8(i as u8), span), - Immediate::I8(i) => self.emit(masm::Instruction::PushU8(i as u8), span), - Immediate::U8(i) => self.emit(masm::Instruction::PushU8(i), span), - Immediate::U16(i) => self.emit(masm::Instruction::PushU32(i as u32), span), - Immediate::I16(i) => self.emit(masm::Instruction::PushU32(i as u16 as u32), span), - Immediate::U32(i) => self.emit(masm::Instruction::PushU32(i), span), - Immediate::I32(i) => self.emit(masm::Instruction::PushU32(i as u32), span), + Immediate::I1(i) => self.emit_push(i as u8, span), + Immediate::I8(i) => self.emit_push(i as u8, span), + Immediate::U8(i) => self.emit_push(i, span), + Immediate::U16(i) => self.emit_push(i, span), + Immediate::I16(i) => self.emit_push(i as u16, span), + Immediate::U32(i) => self.emit_push(i, span), + Immediate::I32(i) => self.emit_push(i as u32, span), Immediate::U64(i) => self.push_u64(i, span), Immediate::I64(i) => self.push_i64(i, span), Immediate::U128(i) => self.push_u128(i, span), Immediate::I128(i) => self.push_i128(i, span), - Immediate::Felt(i) => self.emit(masm::Instruction::PushFelt(i), span), + Immediate::Felt(i) => self.emit_push(i, span), Immediate::F64(_) => unimplemented!("floating-point immediates are not supported"), } } @@ -720,6 +731,14 @@ mod tests { use super::*; use crate::masm::{self, Op}; + macro_rules! push { + ($x:expr) => { + Op::Inst(Span::unknown(masm::Instruction::Push(masm::Immediate::Value(Span::unknown( + miden_assembly_syntax::parser::PushValue::from($x), + ))))) + }; + } + #[test] fn op_emitter_stack_manipulation_test() { let mut block = Vec::default(); @@ -744,22 +763,13 @@ mod tests { { let ops = emitter.current_block(); assert_eq!(ops.len(), 7); - assert_eq!(&ops[0], &Op::Inst(Span::new(span, masm::Instruction::PushU32(1)))); - assert_eq!(&ops[1], &Op::Inst(Span::new(span, masm::Instruction::PushU32(2)))); - assert_eq!(&ops[2], &Op::Inst(Span::new(span, masm::Instruction::PushU8(3)))); - assert_eq!( - &ops[3], - &Op::Inst(Span::new(span, masm::Instruction::PushFelt(Felt::ZERO))) - ); - assert_eq!(&ops[4], &Op::Inst(Span::new(span, masm::Instruction::PushFelt(Felt::ONE)))); - assert_eq!( - &ops[5], - &Op::Inst(Span::new(span, masm::Instruction::PushFelt(Felt::new(u32::MAX as u64)))) - ); - assert_eq!( - &ops[6], - &Op::Inst(Span::new(span, masm::Instruction::PushFelt(Felt::new(3)))) - ); + assert_eq!(&ops[0], &push!(1u32)); + assert_eq!(&ops[1], &push!(2u32)); + assert_eq!(&ops[2], &push!(3u32)); + assert_eq!(&ops[3], &push!(Felt::ZERO)); + assert_eq!(&ops[4], &push!(Felt::ONE)); + assert_eq!(&ops[5], &push!(Felt::new(u32::MAX as u64))); + assert_eq!(&ops[6], &push!(Felt::new(3))); } assert_eq!(emitter.stack()[0], five); diff --git a/codegen/masm/src/emit/primop.rs b/codegen/masm/src/emit/primop.rs index 70793b29e..1ea4ab75b 100644 --- a/codegen/masm/src/emit/primop.rs +++ b/codegen/masm/src/emit/primop.rs @@ -27,12 +27,10 @@ impl OpEmitter<'_> { Type::I128 | Type::U128 => { self.emit_all( [ - masm::Instruction::PushWord(WordValue([ - Felt::ZERO, - Felt::ZERO, - Felt::ZERO, - Felt::ONE, - ])), + masm::Instruction::Push(masm::Immediate::Value(masm::Span::new( + span, + WordValue([Felt::ZERO, Felt::ZERO, Felt::ZERO, Felt::ONE]).into(), + ))), masm::Instruction::AssertEqw, ], span, @@ -70,7 +68,10 @@ impl OpEmitter<'_> { Type::U128 | Type::I128 => { self.emit_all( [ - masm::Instruction::PushWord(WordValue([Felt::ZERO; 4])), + masm::Instruction::Push(masm::Immediate::Value(masm::Span::new( + span, + WordValue([Felt::ZERO; 4]).into(), + ))), masm::Instruction::AssertEqw, ], span, diff --git a/codegen/masm/src/emit/smallint.rs b/codegen/masm/src/emit/smallint.rs index bd1e040b7..1c314cd2c 100644 --- a/codegen/masm/src/emit/smallint.rs +++ b/codegen/masm/src/emit/smallint.rs @@ -33,7 +33,7 @@ impl OpEmitter<'_> { assert_valid_integer_size!(n, 1, 32); match n { // i1 is never signed - 1 => self.emit(masm::Instruction::PushU32(0), span), + 1 => self.emit_push(0u32, span), n => self.is_const_flag_set_u32(1 << (n - 1), span), } } @@ -70,13 +70,13 @@ impl OpEmitter<'_> { #[inline] pub fn int_to_u64(&mut self, n: u32, span: SourceSpan) { self.assert_unsigned_smallint(n, span); - self.emit(masm::Instruction::PushU32(0), span); + self.emit_push(0u32, span); } /// Convert an unsigned N-bit integer to u64 #[inline(always)] pub fn uint_to_u64(&mut self, _: u32, span: SourceSpan) { - self.emit(masm::Instruction::PushU32(0), span); + self.emit_push(0u32, span); } /// Convert a signed N-bit integer to i128 @@ -89,7 +89,9 @@ impl OpEmitter<'_> { #[inline(always)] pub fn uint_to_i128(&mut self, _n: u32, span: SourceSpan) { // zero-extend to i128 - self.emit_n(3, masm::Instruction::PushU32(0), span); + for _ in 0..3 { + self.emit_push(0u32, span); + } } /// Sign-extend the N-bit value on the stack to M-bits, where M is >= N and <= 256. @@ -317,17 +319,17 @@ impl OpEmitter<'_> { match overflow { Overflow::Unchecked => (), Overflow::Checked => self.int32_to_uint(n, span), - Overflow::Wrapping => self.emit_all( - [masm::Instruction::PushU32(2u32.pow(n)), masm::Instruction::U32Mod], - span, - ), + Overflow::Wrapping => { + self.emit_push(2u32.pow(n), span); + self.emit(masm::Instruction::U32Mod, span); + } Overflow::Overflowing => { self.try_int32_to_uint(n, span); + // move result to top, and wrap it at 2^n + self.emit(masm::Instruction::Swap1, span); + self.emit_push(2u32.pow(n), span); self.emit_all( [ - // move result to top, and wrap it at 2^n - masm::Instruction::Swap1, - masm::Instruction::PushU32(2u32.pow(n)), masm::Instruction::U32Mod, // move is_valid flag to top, and invert it masm::Instruction::Swap1, diff --git a/codegen/masm/src/emit/unary.rs b/codegen/masm/src/emit/unary.rs index 7c9607097..328d2b65a 100644 --- a/codegen/masm/src/emit/unary.rs +++ b/codegen/masm/src/emit/unary.rs @@ -299,7 +299,7 @@ impl OpEmitter<'_> { (Type::I32, Type::I64 | Type::I128) => self.sext_int32(dst_bits, span), (Type::I32, Type::U64) => { self.assert_i32(span); - self.emit(masm::Instruction::PushU32(0), span); + self.emit_push(0u32, span); } (Type::I32, Type::U32) => { self.assert_i32(span); @@ -322,19 +322,13 @@ impl OpEmitter<'_> { (Type::I16, Type::U8 | Type::I1) => self.int32_to_int(dst_bits, span), (Type::I16, Type::I8) => self.int32_to_int(dst_bits, span), (Type::I8, Type::I1) => { - self.emit_all( - [ - // Assert that input is either 0 or 1 - // - // NOTE: The comparison here is unsigned, so the sign - // bit being set will make the i8 larger than 0 or 1 - masm::Instruction::Dup0, - masm::Instruction::PushU32(2), - masm::Instruction::Lt, - masm::Instruction::Assert, - ], - span, - ); + // Assert that input is either 0 or 1 + // + // NOTE: The comparison here is unsigned, so the sign + // bit being set will make the i8 larger than 0 or 1 + self.emit(masm::Instruction::Dup0, span); + self.emit_push(2u32, span); + self.emit_all([masm::Instruction::Lt, masm::Instruction::Assert], span); } // i1 (Type::I1, _) => self.zext_smallint(src_bits, dst_bits, span), @@ -419,9 +413,9 @@ impl OpEmitter<'_> { self.clz(span); let bits = ty.size_in_bits(); // ilog2 is bits - clz - 1 + self.emit_push(bits as u8, span); self.emit_all( [ - masm::Instruction::PushU8(bits as u8), masm::Instruction::Swap1, masm::Instruction::Sub, masm::Instruction::U32OverflowingSubImm(1.into()), @@ -448,7 +442,8 @@ impl OpEmitter<'_> { Type::I1 => { // 2^0 == 1 let _ = self.stack.pop(); - self.emit_all([masm::Instruction::Drop, masm::Instruction::PushU8(0)], span); + self.emit(masm::Instruction::Drop, span); + self.emit_push(0u8, span); self.push(Type::U32); } ty if !ty.is_integer() => { @@ -542,15 +537,15 @@ impl OpEmitter<'_> { span, ); self.raw_exec("std::math::u64::clz", span); // [lo_clz, hi_clz] + // Add the low bit leading zeros to those of the high bits, if the high + // bits are all zeros; otherwise return only the + // high bit count + self.emit_push(0u32, span); // [0, lo_clz, hi_clz] + self.emit(masm::Instruction::Dup2, span); // [hi_clz, 0, lo_clz, hi_clz] + self.emit_push(Felt::new(32), span); self.emit_all( [ - // Add the low bit leading zeros to those of the high bits, if the high - // bits are all zeros; otherwise return only the - // high bit count - masm::Instruction::PushU32(0), // [0, lo_clz, hi_clz] - masm::Instruction::Dup2, // [hi_clz, 0, lo_clz, hi_clz] - masm::Instruction::PushFelt(Felt::new(32)), - masm::Instruction::Lt, // [hi_clz < 32, 0, lo_clz, hi_clz] + masm::Instruction::Lt, // [hi_clz < 32, 0, lo_clz, hi_clz] masm::Instruction::CDrop, // [hi_clz < 32 ? 0 : lo_clz, hi_clz] masm::Instruction::Add, ], @@ -626,14 +621,14 @@ impl OpEmitter<'_> { span, ); self.raw_exec("std::math::u64::clo", span); // [lo_clo, hi_clo] + // Add the low bit leading ones to those of the high bits, if the high bits + // are all one; otherwise return only the high bit count + self.emit_push(0u32, span); // [0, lo_clo, hi_clo] + self.emit(masm::Instruction::Dup2, span); // [hi_clo, 0, lo_clo, hi_clo] + self.emit_push(Felt::new(32), span); self.emit_all( [ - // Add the low bit leading ones to those of the high bits, if the high bits - // are all one; otherwise return only the high bit count - masm::Instruction::PushU32(0), // [0, lo_clo, hi_clo] - masm::Instruction::Dup2, // [hi_clo, 0, lo_clo, hi_clo] - masm::Instruction::PushFelt(Felt::new(32)), - masm::Instruction::Lt, // [hi_clo < 32, 0, lo_clo, hi_clo] + masm::Instruction::Lt, // [hi_clo < 32, 0, lo_clo, hi_clo] masm::Instruction::CDrop, // [hi_clo < 32 ? 0 : lo_clo, hi_clo] masm::Instruction::Add, ], @@ -649,10 +644,11 @@ impl OpEmitter<'_> { // MASM u32clo instruction for values of (i|u)16 type, so to get // the correct count, we need to bitwise-OR in a 16 bits of leading // ones, then subtract that from the final count. + // + // OR in the leading 16 ones + self.emit_push(u32::MAX << 16, span); self.emit_all( [ - // OR in the leading 16 ones - masm::Instruction::PushU32(u32::MAX << 16), masm::Instruction::U32Or, // Obtain the count masm::Instruction::U32Clo, @@ -667,10 +663,11 @@ impl OpEmitter<'_> { // MASM u32clo instruction for values of (i|u)8 type, so as with the // 16-bit values, we need to bitwise-OR in 24 bits of leading ones, // then subtract them from the final count. + // + // OR in the leading 24 ones + self.emit_push(u32::MAX << 8, span); self.emit_all( [ - // OR in the leading 24 ones - masm::Instruction::PushU32(u32::MAX << 8), masm::Instruction::U32Or, // Obtain the count masm::Instruction::U32Clo, @@ -716,16 +713,16 @@ impl OpEmitter<'_> { span, ); self.raw_exec("std::math::u64::ctz", span); // [lo_ctz, hi_ctz] + // Add the high bit trailing zeros to those of the low bits, if the low + // bits are all zero; otherwise return only the low + // bit count + self.emit(masm::Instruction::Swap1, span); + self.emit_push(0u32, span); // [0, hi_ctz, lo_ctz] + self.emit(masm::Instruction::Dup2, span); // [lo_ctz, 0, hi_ctz, lo_ctz] + self.emit_push(Felt::new(32), span); self.emit_all( [ - // Add the high bit trailing zeros to those of the low bits, if the low - // bits are all zero; otherwise return only the low - // bit count - masm::Instruction::Swap1, - masm::Instruction::PushU32(0), // [0, hi_ctz, lo_ctz] - masm::Instruction::Dup2, // [lo_ctz, 0, hi_ctz, lo_ctz] - masm::Instruction::PushFelt(Felt::new(32)), - masm::Instruction::Lt, // [lo_ctz < 32, 0, hi_ctz, lo_ctz] + masm::Instruction::Lt, // [lo_ctz < 32, 0, hi_ctz, lo_ctz] masm::Instruction::CDrop, // [lo_ctz < 32 ? 0 : hi_ctz, lo_ctz] masm::Instruction::Add, ], @@ -736,17 +733,18 @@ impl OpEmitter<'_> { Type::I32 | Type::U32 => self.emit(masm::Instruction::U32Ctz, span), Type::I16 | Type::U16 => { // Clamp the total number of trailing zeros to 16 + + // Obtain the count + self.emit(masm::Instruction::U32Ctz, span); + // Clamp to 16 + // operand_stack: [16, ctz] + self.emit_push(16u8, span); + // operand_stack: [ctz, 16, ctz] + self.emit(masm::Instruction::Dup1, span); + // operand_stack: [ctz >= 16, 16, ctz] + self.emit_push(Felt::new(16), span); self.emit_all( [ - // Obtain the count - masm::Instruction::U32Ctz, - // Clamp to 16 - // operand_stack: [16, ctz] - masm::Instruction::PushU8(16), - // operand_stack: [ctz, 16, ctz] - masm::Instruction::Dup1, - // operand_stack: [ctz >= 16, 16, ctz] - masm::Instruction::PushFelt(Felt::new(16)), masm::Instruction::Gte, // operand_stack: [actual_ctz] masm::Instruction::CDrop, @@ -756,17 +754,18 @@ impl OpEmitter<'_> { } Type::I8 | Type::U8 => { // Clamp the total number of trailing zeros to 8 + + // Obtain the count + self.emit(masm::Instruction::U32Ctz, span); + // Clamp to 8 + // operand_stack: [8, ctz] + self.emit_push(8u8, span); + // operand_stack: [ctz, 8, ctz] + self.emit(masm::Instruction::Dup1, span); + // operand_stack: [ctz >= 8, 8, ctz] + self.emit_push(Felt::new(8), span); self.emit_all( [ - // Obtain the count - masm::Instruction::U32Ctz, - // Clamp to 8 - // operand_stack: [8, ctz] - masm::Instruction::PushU8(8), - // operand_stack: [ctz, 8, ctz] - masm::Instruction::Dup1, - // operand_stack: [ctz >= 8, 8, ctz] - masm::Instruction::PushFelt(Felt::new(8)), masm::Instruction::Gte, // operand_stack: [actual_ctz] masm::Instruction::CDrop, @@ -810,15 +809,15 @@ impl OpEmitter<'_> { span, ); self.raw_exec("std::math::u64::cto", span); // [lo_cto, hi_cto] + // Add the high bit trailing ones to those of the low bits, if the low bits + // are all one; otherwise return only the low bit count + self.emit(masm::Instruction::Swap1, span); + self.emit_push(0u32, span); // [0, hi_cto, lo_cto] + self.emit(masm::Instruction::Dup2, span); // [lo_cto, 0, hi_cto, lo_cto] + self.emit_push(Felt::new(32), span); self.emit_all( [ - // Add the high bit trailing ones to those of the low bits, if the low bits - // are all one; otherwise return only the low bit count - masm::Instruction::Swap1, - masm::Instruction::PushU32(0), // [0, hi_cto, lo_cto] - masm::Instruction::Dup2, // [lo_cto, 0, hi_cto, lo_cto] - masm::Instruction::PushFelt(Felt::new(32)), - masm::Instruction::Lt, // [lo_cto < 32, 0, hi_cto, lo_cto] + masm::Instruction::Lt, // [lo_cto < 32, 0, hi_cto, lo_cto] masm::Instruction::CDrop, // [lo_cto < 32 ? 0 : hi_cto, lo_cto] masm::Instruction::Add, ], diff --git a/codegen/masm/src/lower/component.rs b/codegen/masm/src/lower/component.rs index 0767f9143..fd26fbf79 100644 --- a/codegen/masm/src/lower/component.rs +++ b/codegen/masm/src/lower/component.rs @@ -97,7 +97,8 @@ impl ToMasmComponent for builtin::Component { let rodata = data_segments_to_rodata(&link_info)?; let kernel = if matches!(context.session().options.target, TargetEnv::Rollup { .. }) { - Some(miden_lib::transaction::TransactionKernel::kernel()) + todo!() + //Some(miden_lib::transaction::TransactionKernel::kernel()) } else { None }; @@ -184,7 +185,10 @@ impl MasmComponentBuilder<'_> { // Heap metadata initialization let heap_base = self.component.heap_base; - self.init_body.push(masm::Op::Inst(Span::new(span, Inst::PushU32(heap_base)))); + self.init_body.push(masm::Op::Inst(Span::new( + span, + Inst::Push(masm::Immediate::Value(Span::unknown(heap_base.into()))), + ))); let heap_init = masm::ProcedureName::new("heap_init").unwrap(); let memory_intrinsics = masm::LibraryPath::new("intrinsics::mem").unwrap(); self.init_body.push(Op::Inst(Span::new( @@ -332,17 +336,26 @@ impl MasmComponentBuilder<'_> { let word = rodata.digest.as_elements(); let word_value = [word[0], word[1], word[2], word[3]]; - self.init_body - .push(Op::Inst(Span::new(span, Inst::PushWord(WordValue(word_value))))); + self.init_body.push(Op::Inst(Span::new( + span, + Inst::Push(masm::Immediate::Value(Span::unknown(WordValue(word_value).into()))), + ))); // Move rodata from the advice map, using the commitment as key, to the advice stack self.init_body .push(Op::Inst(Span::new(span, Inst::SysEvent(masm::SystemEventNode::PushMapVal)))); // write_ptr assert!(rodata.start.is_word_aligned(), "rodata segments must be word-aligned"); - self.init_body.push(Op::Inst(Span::new(span, Inst::PushU32(rodata.start.addr)))); + self.init_body.push(Op::Inst(Span::new( + span, + Inst::Push(masm::Immediate::Value(Span::unknown(rodata.start.addr.into()))), + ))); // num_words - self.init_body - .push(Op::Inst(Span::new(span, Inst::PushU32(rodata.size_in_words() as u32)))); + self.init_body.push(Op::Inst(Span::new( + span, + Inst::Push(masm::Immediate::Value(Span::unknown( + (rodata.size_in_words() as u32).into(), + ))), + ))); // [num_words, write_ptr, COM, ..] -> [write_ptr'] self.init_body.push(Op::Inst(Span::new( span, @@ -477,6 +490,7 @@ impl MasmModuleBuilder<'_> { struct MasmFunctionBuilder { span: midenc_hir::SourceSpan, name: masm::ProcedureName, + signature: masm::FunctionType, visibility: masm::Visibility, num_locals: u16, } @@ -511,9 +525,19 @@ impl MasmFunctionBuilder { .into_report() })?; + let sig = function.signature(); + let args = sig.params.iter().map(|param| masm::TypeExpr::from(param.ty.clone())).collect(); + let results = sig + .results + .iter() + .map(|result| masm::TypeExpr::from(result.ty.clone())) + .collect(); + let signature = masm::FunctionType::new(sig.cc, args, results); + Ok(Self { span: function.span(), name, + signature, visibility, num_locals, }) @@ -590,12 +614,13 @@ impl MasmFunctionBuilder { let Self { span, name, + signature, visibility, num_locals, } = self; let mut procedure = masm::Procedure::new(span, visibility, name, num_locals, body); - + procedure.set_signature(signature); procedure.extend_invoked(invoked); Ok(procedure) diff --git a/codegen/masm/src/lower/lowering.rs b/codegen/masm/src/lower/lowering.rs index d9f5ade33..633c116c5 100644 --- a/codegen/masm/src/lower/lowering.rs +++ b/codegen/masm/src/lower/lowering.rs @@ -288,7 +288,10 @@ stack on exit from 'after': {:#?} emitter.stack = stack_on_loop_exit; // Always enter loop on first iteration - emitter.emit_op(masm::Op::Inst(Span::new(span, masm::Instruction::PushU8(1)))); + emitter.emit_op(masm::Op::Inst(Span::new( + span, + masm::Instruction::Push(masm::Immediate::Value(Span::new(span, 1u8.into()))), + ))); emitter.emit_op(masm::Op::While { span, body: loop_body, @@ -465,7 +468,7 @@ impl HirLowering for ub::Unreachable { // always fails to guarantee this, i.e. assert(false) let span = self.span(); let mut op_emitter = emitter.emitter(); - op_emitter.emit(masm::Instruction::PushU32(0), span); + op_emitter.emit_push(0u32, span); op_emitter.emit(masm::Instruction::Assert, span); Ok(()) diff --git a/midenc-compile/src/stages/assemble.rs b/midenc-compile/src/stages/assemble.rs index 32159467a..d0a12053a 100644 --- a/midenc-compile/src/stages/assemble.rs +++ b/midenc-compile/src/stages/assemble.rs @@ -1,4 +1,4 @@ -use alloc::{string::ToString, vec::Vec}; +use alloc::{string::ToString, vec, vec::Vec}; use miden_assembly::ast::QualifiedProcedureName; use miden_mast_package::{Dependency, MastArtifact, Package, PackageExport}; @@ -82,6 +82,7 @@ fn build_package(mast: MastArtifact, outputs: &CodegenOutput, session: &Session) name, digest, signature, + attributes: Default::default(), }); } } @@ -92,10 +93,22 @@ fn build_package(mast: MastArtifact, outputs: &CodegenOutput, session: &Session) let account_component_metadata_bytes = outputs.account_component_metadata_bytes.clone(); + let sections = match account_component_metadata_bytes { + Some(bytes) => { + vec![miden_mast_package::Section::new( + miden_mast_package::SectionId::ACCOUNT_COMPONENT_METADATA, + bytes, + )] + } + None => vec![], + }; + miden_mast_package::Package { name, + version: None, + description: None, mast, manifest, - account_component_metadata_bytes, + sections, } } diff --git a/midenc-debug/src/exec/executor.rs b/midenc-debug/src/exec/executor.rs index d37c7e0ec..04ac36313 100644 --- a/midenc-debug/src/exec/executor.rs +++ b/midenc-debug/src/exec/executor.rs @@ -44,8 +44,9 @@ impl Executor { pub fn new(args: Vec) -> Self { let mut resolver = MemDependencyResolverByDigest::default(); resolver.add(*STDLIB.digest(), STDLIB.clone().into()); - let base_lib = miden_lib::MidenLib::default().as_ref().clone(); - resolver.add(*base_lib.digest(), Arc::new(base_lib).into()); + //TODO + //let base_lib = miden_lib::MidenLib::default().as_ref().clone(); + //resolver.add(*base_lib.digest(), Arc::new(base_lib).into()); Self { stack: StackInputs::new(args).expect("invalid stack inputs"), advice: AdviceInputs::default(), diff --git a/midenc-debug/src/exec/host.rs b/midenc-debug/src/exec/host.rs index f59899f4a..515cea3cc 100644 --- a/midenc-debug/src/exec/host.rs +++ b/midenc-debug/src/exec/host.rs @@ -4,8 +4,8 @@ use miden_assembly::SourceManager; use miden_core::Word; use miden_debug_types::{Location, SourceFile, SourceSpan}; use miden_processor::{ - AdviceInputs, AdviceProvider, BaseHost, EventHandlerRegistry, ExecutionError, KvMap, - MastForest, MastForestStore, MemMastForestStore, ProcessState, RowIndex, SyncHost, + AdviceInputs, AdviceProvider, BaseHost, EventHandlerRegistry, ExecutionError, MastForest, + MastForestStore, MemMastForestStore, ProcessState, RowIndex, SyncHost, }; use super::{TraceEvent, TraceHandler}; @@ -68,10 +68,6 @@ impl BaseHost for DebuggerHost where S: SourceManager, { - fn get_mast_forest(&self, node_digest: &Word) -> Option> { - self.store.get(node_digest) - } - fn get_label_and_source_file( &self, location: &Location, @@ -112,8 +108,32 @@ where fn on_event( &mut self, process: &ProcessState, - event_id: u32, ) -> Result, miden_processor::EventError> { Ok(Vec::new()) } + + fn get_mast_forest(&self, node_digest: &Word) -> Option> { + self.store.get(node_digest) + } +} + +impl miden_processor::AsyncHost for DebuggerHost +where + S: SourceManager, +{ + fn get_mast_forest( + &self, + node_digest: &Word, + ) -> impl miden_processor::FutureMaybeSend>> { + core::future::ready(self.store.get(node_digest)) + } + + fn on_event( + &mut self, + process: &ProcessState<'_>, + ) -> impl miden_processor::FutureMaybeSend< + Result, miden_processor::EventError>, + > { + core::future::ready(Ok(Vec::new())) + } } diff --git a/midenc-session/src/emit.rs b/midenc-session/src/emit.rs index 1fb8a9b35..324d66585 100644 --- a/midenc-session/src/emit.rs +++ b/midenc-session/src/emit.rs @@ -279,7 +279,7 @@ impl Emit for miden_assembly::Library { struct LibraryTextFormatter<'a>(&'a miden_assembly::Library); impl miden_core::prettier::PrettyPrint for LibraryTextFormatter<'_> { fn render(&self) -> miden_core::prettier::Document { - use miden_core::prettier::*; + use miden_core::{mast::MastNodeExt, prettier::*}; let mast_forest = self.0.mast_forest(); let mut library_doc = Document::Empty; diff --git a/midenc-session/src/libs.rs b/midenc-session/src/libs.rs index fde87fbd1..0077d0983 100644 --- a/midenc-session/src/libs.rs +++ b/midenc-session/src/libs.rs @@ -115,7 +115,7 @@ impl LinkLibrary { // Handle libraries shipped with the compiler, or via Miden crates match self.name.as_ref() { "std" => return Ok((*STDLIB).as_ref().clone()), - "base" => return Ok(miden_lib::MidenLib::default().as_ref().clone()), + "base" => todo!(), /*return Ok(miden_lib::MidenLib::default().as_ref().clone()),*/ _ => (), } diff --git a/tests/integration-node/src/node_tests/helpers.rs b/tests/integration-node/src/node_tests/helpers.rs index fa57f33f3..05782d8c2 100644 --- a/tests/integration-node/src/node_tests/helpers.rs +++ b/tests/integration-node/src/node_tests/helpers.rs @@ -1,6 +1,6 @@ //! Common helper functions for node tests -use std::{collections::BTreeSet, sync::Arc}; +use std::{borrow::Borrow, collections::BTreeSet, sync::Arc}; use miden_client::{ account::{ @@ -23,7 +23,7 @@ use miden_client::{ }; use miden_core::{Felt, FieldElement, Word}; use miden_integration_tests::CompilerTestBuilder; -use miden_mast_package::Package; +use miden_mast_package::{Package, SectionId}; use miden_objects::{ account::{ AccountBuilder, AccountComponent, AccountComponentMetadata, AccountComponentTemplate, @@ -96,7 +96,14 @@ pub async fn create_account_with_component( package: Arc, config: AccountCreationConfig, ) -> Result { - let account_component = match package.account_component_metadata_bytes.as_deref() { + let account_component_metadata = package.sections.iter().find_map(|s| { + if &s.id == &SectionId::ACCOUNT_COMPONENT_METADATA { + Some(s.data.borrow()) + } else { + None + } + }); + let account_component = match account_component_metadata { None => panic!("no account component metadata present"), Some(bytes) => { let metadata = AccountComponentMetadata::read_from_bytes(bytes).unwrap(); diff --git a/tests/integration/src/rust_masm_tests/examples.rs b/tests/integration/src/rust_masm_tests/examples.rs index ab88d370a..28c48b6b5 100644 --- a/tests/integration/src/rust_masm_tests/examples.rs +++ b/tests/integration/src/rust_masm_tests/examples.rs @@ -1,7 +1,7 @@ -use std::{collections::VecDeque, sync::Arc}; +use std::{borrow::Borrow, collections::VecDeque, sync::Arc}; use miden_core::utils::{Deserializable, Serializable}; -use miden_mast_package::Package; +use miden_mast_package::{Package, SectionId}; use miden_objects::account::AccountComponentMetadata; use midenc_debug::{Executor, ToMidenRepr}; use midenc_expect_test::{expect, expect_file}; @@ -24,9 +24,19 @@ fn storage_example() { test.expect_ir(expect_file!["../../expected/examples/storage_example.hir"]); test.expect_masm(expect_file!["../../expected/examples/storage_example.masm"]); let package = test.compiled_package(); - let account_component_metadata_bytes = - package.as_ref().account_component_metadata_bytes.clone().unwrap(); - let toml = AccountComponentMetadata::read_from_bytes(&account_component_metadata_bytes) + let account_component_metadata_bytes = package + .as_ref() + .sections + .iter() + .find_map(|s| { + if s.id == SectionId::ACCOUNT_COMPONENT_METADATA { + Some(s.data.borrow()) + } else { + None + } + }) + .unwrap(); + let toml = AccountComponentMetadata::read_from_bytes(account_component_metadata_bytes) .unwrap() .as_toml() .unwrap(); @@ -225,9 +235,19 @@ fn counter_contract() { test_release.expect_ir(expect_file!["../../expected/examples/counter.hir"]); test_release.expect_masm(expect_file!["../../expected/examples/counter.masm"]); let package = test_release.compiled_package(); - let account_component_metadata_bytes = - package.as_ref().account_component_metadata_bytes.clone().unwrap(); - let toml = AccountComponentMetadata::read_from_bytes(&account_component_metadata_bytes) + let account_component_metadata_bytes = package + .as_ref() + .sections + .iter() + .find_map(|s| { + if s.id == SectionId::ACCOUNT_COMPONENT_METADATA { + Some(s.data.borrow()) + } else { + None + } + }) + .unwrap(); + let toml = AccountComponentMetadata::read_from_bytes(account_component_metadata_bytes) .unwrap() .as_toml() .unwrap(); From 3c9eaf169c414522f19dbff170dbf4ade6c76171 Mon Sep 17 00:00:00 2001 From: Paul Schoenfelder Date: Wed, 17 Sep 2025 17:16:45 -0400 Subject: [PATCH 02/19] build: switch workspace crates to crates.io version of midenc-hir-type Now that midenc-hir-type is used by miden-assembly-syntax, and its types are re-exported there - it is necessary for compiler crates to depend on the same version as miden-assembly-syntax to allow for passing those types between APIs of the compiler, miden-assembly-syntax, and miden-mast-package. If we instead retained a direct path dependency on the source of midenc-hir-type, Cargo would see the dependencies as effectively different versions, and therefore make it impossible to pass types between those crates as they would not be considered the same anymore. Manual conversion would be possible, but undesirable. Since we plan to split out midenc-hir-type eventually anyway (or at the very least, do what this commit does and treat it as an entirely separate crate from the rest of the compiler), this change makes that transition easier, at the expense of being a bit confusing when making changes to midenc-hir-type that need to be propagated to crates.io first in order to meaningfully test the full compiler pipeline with those changes. --- Cargo.lock | 12 +++++++----- Cargo.toml | 2 +- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index fa27126c2..4ee09a901 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2909,7 +2909,7 @@ dependencies = [ "miden-core 0.18.0", "miden-debug-types 0.18.0", "miden-utils-diagnostics 0.18.0", - "midenc-hir-type 0.4.2", + "midenc-hir-type 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", "proptest", "regex", "rustc_version 0.4.1", @@ -3682,7 +3682,7 @@ dependencies = [ "miden-thiserror", "midenc-hir-macros", "midenc-hir-symbol", - "midenc-hir-type 0.4.3", + "midenc-hir-type 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", "midenc-session", "pretty_assertions", "rustc-demangle", @@ -3771,11 +3771,11 @@ dependencies = [ [[package]] name = "midenc-hir-type" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7798671ffbf6596de00619a9abaec67dc26965b891328c9d65c4cb6007597d50" +version = "0.4.3" dependencies = [ "miden-formatting", + "serde", + "serde_repr", "smallvec", "thiserror 2.0.12", ] @@ -3783,6 +3783,8 @@ dependencies = [ [[package]] name = "midenc-hir-type" version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d4cfab04baffdda3fb9eafa5f873604059b89a1699aa95e4f1057397a69f0b5" dependencies = [ "miden-formatting", "serde", diff --git a/Cargo.toml b/Cargo.toml index e4129a63a..b8db15bce 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -144,7 +144,7 @@ midenc-hir-eval = { version = "0.5.0", path = "eval" } midenc-hir-macros = { version = "0.5.0", path = "hir-macros" } midenc-hir-symbol = { version = "0.5.0", path = "hir-symbol" } midenc-hir-transform = { version = "0.5.0", path = "hir-transform" } -midenc-hir-type = { version = "0.4.3", path = "hir-type" } +midenc-hir-type = { version = "0.4.3" } midenc-frontend-wasm = { version = "0.5.0", path = "frontend/wasm" } midenc-compile = { version = "0.5.0", path = "midenc-compile" } midenc-driver = { version = "0.5.0", path = "midenc-driver" } From ed9f2eca201bcb20b44371771994f42dd5f287ed Mon Sep 17 00:00:00 2001 From: Paul Schoenfelder Date: Fri, 3 Oct 2025 13:26:51 -0400 Subject: [PATCH 03/19] driver: split out midenc-debug into separate repo, simplify driver --- .vscode/launch.json | 21 +- Cargo.lock | 555 +++------ Cargo.toml | 27 +- midenc-debug/CHANGELOG.md | 127 -- midenc-debug/Cargo.toml | 46 - midenc-debug/README.md | 4 - midenc-debug/src/cli.rs | 139 --- midenc-debug/src/config.rs | 298 ----- midenc-debug/src/debug/breakpoint.rs | 173 --- midenc-debug/src/debug/memory.rs | 265 ---- midenc-debug/src/debug/mod.rs | 9 - midenc-debug/src/debug/stacktrace.rs | 559 --------- midenc-debug/src/exec/executor.rs | 403 ------- midenc-debug/src/exec/host.rs | 139 --- midenc-debug/src/exec/mod.rs | 11 - midenc-debug/src/exec/state.rs | 158 --- midenc-debug/src/exec/trace.rs | 220 ---- midenc-debug/src/felt.rs | 1072 ----------------- midenc-debug/src/lib.rs | 125 -- midenc-debug/src/logger.rs | 76 -- midenc-debug/src/ui/action.rs | 39 - midenc-debug/src/ui/app.rs | 282 ----- midenc-debug/src/ui/mod.rs | 9 - midenc-debug/src/ui/pages/home.rs | 447 ------- midenc-debug/src/ui/pages/mod.rs | 65 - midenc-debug/src/ui/panes/breakpoints.rs | 249 ---- midenc-debug/src/ui/panes/debug.rs | 134 --- midenc-debug/src/ui/panes/disasm.rs | 125 -- midenc-debug/src/ui/panes/footer.rs | 205 ---- midenc-debug/src/ui/panes/header.rs | 36 - midenc-debug/src/ui/panes/mod.rs | 63 - midenc-debug/src/ui/panes/source_code.rs | 503 -------- midenc-debug/src/ui/panes/stack.rs | 100 -- midenc-debug/src/ui/panes/stacktrace.rs | 154 --- midenc-debug/src/ui/state.rs | 302 ----- midenc-debug/src/ui/syntax_highlighting.rs | 459 ------- midenc-debug/src/ui/tui.rs | 253 ---- midenc-debug/testdata/rodata-sample.bin | Bin 27 -> 0 bytes midenc-driver/Cargo.toml | 5 +- midenc-driver/src/midenc.rs | 174 +-- midenc/Cargo.toml | 2 +- tests/integration-node/Cargo.toml | 5 +- .../node_tests/counter_contract_rust_auth.rs | 9 +- tests/integration/Cargo.toml | 2 +- .../integration/src/codegen/intrinsics/mem.rs | 2 +- .../abi_transform/advice_map.rs | 8 +- .../rust_masm_tests/abi_transform/stdlib.rs | 8 +- .../abi_transform/tx_kernel.rs | 6 +- tests/integration/src/rust_masm_tests/apps.rs | 2 +- .../src/rust_masm_tests/examples.rs | 17 +- .../src/rust_masm_tests/instructions.rs | 14 +- .../src/rust_masm_tests/intrinsics.rs | 2 +- tests/integration/src/rust_masm_tests/mod.rs | 6 +- tests/integration/src/testing/eval.rs | 8 +- tests/integration/src/testing/initializer.rs | 2 +- 55 files changed, 251 insertions(+), 7873 deletions(-) delete mode 100644 midenc-debug/CHANGELOG.md delete mode 100644 midenc-debug/Cargo.toml delete mode 100644 midenc-debug/README.md delete mode 100644 midenc-debug/src/cli.rs delete mode 100644 midenc-debug/src/config.rs delete mode 100644 midenc-debug/src/debug/breakpoint.rs delete mode 100644 midenc-debug/src/debug/memory.rs delete mode 100644 midenc-debug/src/debug/mod.rs delete mode 100644 midenc-debug/src/debug/stacktrace.rs delete mode 100644 midenc-debug/src/exec/executor.rs delete mode 100644 midenc-debug/src/exec/host.rs delete mode 100644 midenc-debug/src/exec/mod.rs delete mode 100644 midenc-debug/src/exec/state.rs delete mode 100644 midenc-debug/src/exec/trace.rs delete mode 100644 midenc-debug/src/felt.rs delete mode 100644 midenc-debug/src/lib.rs delete mode 100644 midenc-debug/src/logger.rs delete mode 100644 midenc-debug/src/ui/action.rs delete mode 100644 midenc-debug/src/ui/app.rs delete mode 100644 midenc-debug/src/ui/mod.rs delete mode 100644 midenc-debug/src/ui/pages/home.rs delete mode 100644 midenc-debug/src/ui/pages/mod.rs delete mode 100644 midenc-debug/src/ui/panes/breakpoints.rs delete mode 100644 midenc-debug/src/ui/panes/debug.rs delete mode 100644 midenc-debug/src/ui/panes/disasm.rs delete mode 100644 midenc-debug/src/ui/panes/footer.rs delete mode 100644 midenc-debug/src/ui/panes/header.rs delete mode 100644 midenc-debug/src/ui/panes/mod.rs delete mode 100644 midenc-debug/src/ui/panes/source_code.rs delete mode 100644 midenc-debug/src/ui/panes/stack.rs delete mode 100644 midenc-debug/src/ui/panes/stacktrace.rs delete mode 100644 midenc-debug/src/ui/state.rs delete mode 100644 midenc-debug/src/ui/syntax_highlighting.rs delete mode 100644 midenc-debug/src/ui/tui.rs delete mode 100644 midenc-debug/testdata/rodata-sample.bin diff --git a/.vscode/launch.json b/.vscode/launch.json index fb2af45c7..c54492dca 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -97,11 +97,11 @@ { "type": "lldb", "request": "launch", - "name": "Debug unit tests in library 'midenc_frontend_wasm2'", + "name": "Debug unit tests in library 'midenc_frontend_wasm'", "cargo": { - "args": ["test", "--no-run", "--lib", "--package=midenc-frontend-wasm2"], + "args": ["test", "--no-run", "--lib", "--package=midenc-frontend-wasm"], "filter": { - "name": "midenc_frontend_wasm2", + "name": "midenc_frontend_wasm", "kind": "lib" } }, @@ -169,21 +169,6 @@ "cwd": "${workspaceFolder}", "sourceLanguages": ["rust"] }, - { - "type": "lldb", - "request": "launch", - "name": "Debug unit tests in library 'midenc_debug'", - "cargo": { - "args": ["test", "--no-run", "--lib", "--package=midenc-debug"], - "filter": { - "name": "midenc_debug", - "kind": "lib" - } - }, - "args": [], - "cwd": "${workspaceFolder}", - "sourceLanguages": ["rust"] - }, { "type": "lldb", "request": "launch", diff --git a/Cargo.lock b/Cargo.lock index 4ee09a901..05173d312 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -452,7 +452,7 @@ dependencies = [ "clap", "env_logger", "log", - "miden-mast-package 0.18.0", + "miden-mast-package", "midenc-compile", "midenc-session", "parse_arg 0.1.6", @@ -1006,35 +1006,6 @@ dependencies = [ "syn", ] -[[package]] -name = "deadpool" -version = "0.12.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ed5957ff93768adf7a65ab167a17835c3d2c3c50d084fe305174c112f468e2f" -dependencies = [ - "deadpool-runtime", - "num_cpus", - "tokio", -] - -[[package]] -name = "deadpool-runtime" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "092966b41edc516079bdf31ec78a2e0588d1d0c08f78b91d8307215928642b2b" -dependencies = [ - "tokio", -] - -[[package]] -name = "deadpool-sync" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "524bc3df0d57e98ecd022e21ba31166c2625e7d3e5bcc4510efaeeab4abcab04" -dependencies = [ - "deadpool-runtime", -] - [[package]] name = "der" version = "0.7.10" @@ -1265,12 +1236,6 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2acce4a10f12dc2fb14a218589d4f1f62ef011b2d0cc4b3cb1bba8e94da14649" -[[package]] -name = "fallible-streaming-iterator" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7360491ce676a36bf9bb3c56c1aa791658183a54d2744120f27285738d90465a" - [[package]] name = "faster-hex" version = "0.10.0" @@ -1894,15 +1859,6 @@ dependencies = [ "foldhash", ] -[[package]] -name = "hashlink" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7382cf6263419f2d8df38c55d7da83da5c18aef87fc7a7fc1fb1e344edfe14c1" -dependencies = [ - "hashbrown 0.15.4", -] - [[package]] name = "heapless" version = "0.8.0" @@ -2559,17 +2515,6 @@ dependencies = [ "redox_syscall", ] -[[package]] -name = "libsqlite3-sys" -version = "0.34.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91632f3b4fb6bd1d72aa3d78f41ffecfcf2b1a6648d8c241dbe7dbfaf4875e15" -dependencies = [ - "cc", - "pkg-config", - "vcpkg", -] - [[package]] name = "libssh2-sys" version = "0.3.1" @@ -2823,44 +2768,18 @@ dependencies = [ "wit-bindgen", ] -[[package]] -name = "miden-air" -version = "0.17.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db750ce0c58f51ba786c7391f392c4b77e0c83a44c5096672d4d0270d3cc7763" -dependencies = [ - "miden-core 0.17.1", - "thiserror 2.0.12", - "winter-air", - "winter-prover", -] - [[package]] name = "miden-air" version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09f7f7261ba4f1ff0175138936c45e306ef773289cd697657e3120004f7a1a9f" dependencies = [ - "miden-core 0.18.0", + "miden-core", "thiserror 2.0.12", "winter-air", "winter-prover", ] -[[package]] -name = "miden-assembly" -version = "0.17.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82575d8479aad3966be3defdc17911264bfdc99f9a7bb185180eec57c6bda9f5" -dependencies = [ - "log", - "miden-assembly-syntax 0.17.1", - "miden-core 0.17.1", - "miden-mast-package 0.17.1", - "smallvec", - "thiserror 2.0.12", -] - [[package]] name = "miden-assembly" version = "0.18.0" @@ -2868,30 +2787,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c7719656b8064503cb84405ed9d9124025b4e90731f4577d0dc747242d483ea4" dependencies = [ "log", - "miden-assembly-syntax 0.18.0", - "miden-core 0.18.0", - "miden-mast-package 0.18.0", - "smallvec", - "thiserror 2.0.12", -] - -[[package]] -name = "miden-assembly-syntax" -version = "0.17.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7b3588ce15920c0bff47e8bf8c6ca9e0a7a539ff93014cb5ec3c665f60bc0f1" -dependencies = [ - "aho-corasick", - "lalrpop", - "lalrpop-util", - "log", - "miden-core 0.17.1", - "miden-debug-types 0.17.1", - "miden-utils-diagnostics 0.17.1", - "midenc-hir-type 0.1.5", - "regex", - "rustc_version 0.4.1", - "semver 1.0.26", + "miden-assembly-syntax", + "miden-core", + "miden-mast-package", "smallvec", "thiserror 2.0.12", ] @@ -2906,9 +2804,9 @@ dependencies = [ "lalrpop", "lalrpop-util", "log", - "miden-core 0.18.0", - "miden-debug-types 0.18.0", - "miden-utils-diagnostics 0.18.0", + "miden-core", + "miden-debug-types", + "miden-utils-diagnostics", "midenc-hir-type 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", "proptest", "regex", @@ -2932,7 +2830,7 @@ name = "miden-base-macros" version = "0.7.0" dependencies = [ "heck", - "miden-objects", + "miden-objects 0.12.0 (git+https://github.com/0xMiden/miden-base?rev=8a50c8f98529f9a78655385e3e78a6de44db9316)", "proc-macro2", "quote", "semver 1.0.26", @@ -2949,19 +2847,17 @@ dependencies = [ [[package]] name = "miden-client" -version = "0.11.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d6d100dc163a259a942d2883803c94fedce6f8e2e93beda8f1fc071f0258a40" +version = "0.12.0" +source = "git+https://github.com/0xMiden/miden-client?rev=4099516c08c9a56c6d1271fddfc798f40da0d702#4099516c08c9a56c6d1271fddfc798f40da0d702" dependencies = [ "anyhow", "async-trait", "chrono", - "deadpool", - "deadpool-sync", + "getrandom 0.3.3", "hex", - "miden-lib", + "miden-lib 0.12.0 (git+https://github.com/0xMiden/miden-base?branch=next)", "miden-node-proto-build", - "miden-objects", + "miden-objects 0.12.0 (git+https://github.com/0xMiden/miden-base?branch=next)", "miden-remote-prover-client", "miden-tx", "miette", @@ -2969,40 +2865,23 @@ dependencies = [ "prost-build", "protox 0.7.2", "rand 0.9.2", - "rusqlite", - "rusqlite_migration", "thiserror 2.0.12", "tonic", "tonic-build", + "tonic-web-wasm-client", "tracing", "web-sys", ] [[package]] name = "miden-core" -version = "0.17.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "571a943a923e5fb3f1bed534f41a1542c531ad2aec87dc0d5699af1709fbcea6" -dependencies = [ - "miden-crypto 0.15.9", - "miden-debug-types 0.17.1", - "miden-formatting", - "num-derive", - "num-traits", - "thiserror 2.0.12", - "winter-math", - "winter-utils", -] - -[[package]] -name = "miden-core" -version = "0.18.0" +version = "0.18.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbcdfc12e9ef7ac5731f1bfd5985486292696a3bcf974667e3680d9c4d7f9c87" +checksum = "97d53557ea0e5e529675c562c1a90eb5afc242fdac14d1f85b98d770304f9a24" dependencies = [ "enum_dispatch", - "miden-crypto 0.17.0", - "miden-debug-types 0.18.0", + "miden-crypto", + "miden-debug-types", "miden-formatting", "num-derive", "num-traits", @@ -3011,26 +2890,6 @@ dependencies = [ "winter-utils", ] -[[package]] -name = "miden-crypto" -version = "0.15.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4329275a11c7d8328b14a7129b21d40183056dcd0d871c3069be6e550d6ca40" -dependencies = [ - "blake3", - "cc", - "glob", - "num", - "num-complex", - "rand 0.9.2", - "rand_core 0.9.3", - "sha3", - "thiserror 2.0.12", - "winter-crypto", - "winter-math", - "winter-utils", -] - [[package]] name = "miden-crypto" version = "0.17.0" @@ -3060,33 +2919,46 @@ dependencies = [ ] [[package]] -name = "miden-debug-types" -version = "0.17.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93a4b53092da70aa4c9b75acc85e1c7b4d8202ce89487d2271ebdc2defcb08d6" +name = "miden-debug" +version = "0.4.1" dependencies = [ - "memchr", - "miden-crypto 0.15.9", - "miden-formatting", - "miden-miette", - "miden-utils-sync 0.17.1", - "paste", + "clap", + "crossterm", + "env_logger", + "futures", + "glob", + "log", + "miden-assembly", + "miden-assembly-syntax", + "miden-core", + "miden-debug-types", + "miden-mast-package", + "miden-processor", + "miden-thiserror", + "proptest", + "ratatui", + "rustc-demangle", "serde", - "serde_spanned 1.0.0", - "thiserror 2.0.12", + "signal-hook", + "smallvec", + "syntect", + "tokio", + "tokio-util", + "toml 0.8.23", + "tui-input", ] [[package]] name = "miden-debug-types" -version = "0.18.0" +version = "0.18.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb09918a959cad19c181568dfd3580324f72429d1ba818d90d0b04fb36a4f715" +checksum = "188d28a5d7df27e4735095e717845a4558b2d121f822f66e8cc2ddfddf92d5bc" dependencies = [ "memchr", - "miden-crypto 0.17.0", + "miden-crypto", "miden-formatting", "miden-miette", - "miden-utils-sync 0.18.0", + "miden-utils-sync", "paste", "serde", "serde_spanned 1.0.0", @@ -3109,10 +2981,10 @@ dependencies = [ "anyhow", "fs2", "miden-client", - "miden-core 0.18.0", + "miden-core", "miden-integration-tests", - "miden-mast-package 0.18.0", - "miden-objects", + "miden-mast-package", + "miden-objects 0.12.0 (git+https://github.com/0xMiden/miden-base?rev=8a50c8f98529f9a78655385e3e78a6de44db9316)", "midenc-frontend-wasm", "rand 0.9.2", "temp-dir", @@ -3133,14 +3005,14 @@ dependencies = [ "filetime", "glob", "log", - "miden-assembly 0.18.0", - "miden-core 0.18.0", - "miden-mast-package 0.18.0", - "miden-objects", - "miden-processor 0.18.0", + "miden-assembly", + "miden-core", + "miden-debug", + "miden-mast-package", + "miden-objects 0.12.0 (git+https://github.com/0xMiden/miden-base?rev=8a50c8f98529f9a78655385e3e78a6de44db9316)", + "miden-processor", "midenc-codegen-masm", "midenc-compile", - "midenc-debug", "midenc-dialect-arith", "midenc-dialect-cf", "midenc-dialect-hir", @@ -3157,39 +3029,47 @@ dependencies = [ [[package]] name = "miden-lib" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d97cbdddaf0c2edae3b2844db1d2a4746d498e2d865ac0ff5d76b700a9221e71" +version = "0.12.0" +source = "git+https://github.com/0xMiden/miden-base?branch=next#8a50c8f98529f9a78655385e3e78a6de44db9316" dependencies = [ - "miden-assembly 0.17.1", - "miden-objects", - "miden-processor 0.17.1", - "miden-stdlib 0.17.1", + "Inflector", + "fs-err", + "miden-assembly", + "miden-core", + "miden-objects 0.12.0 (git+https://github.com/0xMiden/miden-base?branch=next)", + "miden-processor", + "miden-stdlib", "regex", "thiserror 2.0.12", "walkdir", ] [[package]] -name = "miden-mast-package" -version = "0.17.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57efbfaea75eeb07d448c04aefce241bf8f23ea11600a669d897280551819992" +name = "miden-lib" +version = "0.12.0" +source = "git+https://github.com/0xMiden/miden-base?rev=8a50c8f98529f9a78655385e3e78a6de44db9316#8a50c8f98529f9a78655385e3e78a6de44db9316" dependencies = [ - "derive_more", - "miden-assembly-syntax 0.17.1", - "miden-core 0.17.1", + "Inflector", + "fs-err", + "miden-assembly", + "miden-core", + "miden-objects 0.12.0 (git+https://github.com/0xMiden/miden-base?rev=8a50c8f98529f9a78655385e3e78a6de44db9316)", + "miden-processor", + "miden-stdlib", + "regex", + "thiserror 2.0.12", + "walkdir", ] [[package]] name = "miden-mast-package" -version = "0.18.0" +version = "0.18.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "125bfb772948874e78d154f0b9a4caf22ea839c45aa6e72d2daeb23fda0775c1" +checksum = "6e1777c12930a070feed3f5c777db8374ba71bc36f153223c48cd9ee82cde3f4" dependencies = [ "derive_more", - "miden-assembly-syntax 0.18.0", - "miden-core 0.18.0", + "miden-assembly-syntax", + "miden-core", "thiserror 2.0.12", ] @@ -3237,11 +3117,11 @@ dependencies = [ [[package]] name = "miden-node-proto-build" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1674a01e850ad65e8cdd7fa864b728dddc17e3d90944b1ff96933211bb1c806b" +version = "0.12.0" +source = "git+https://github.com/0xMiden/miden-node?branch=next#c99e200016942fd45f57415de819444891857003" dependencies = [ - "anyhow", + "fs-err", + "miette", "prost", "protox 0.8.0", "tonic-build", @@ -3249,49 +3129,54 @@ dependencies = [ [[package]] name = "miden-objects" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a16bce60bda18cfeaa49e99e35307c6f45297bfe2f0e18c009fa356edd552e70" +version = "0.12.0" +source = "git+https://github.com/0xMiden/miden-base?branch=next#8a50c8f98529f9a78655385e3e78a6de44db9316" dependencies = [ "bech32", "getrandom 0.3.3", - "miden-assembly 0.17.1", - "miden-core 0.17.1", - "miden-crypto 0.15.9", - "miden-processor 0.17.1", - "miden-utils-sync 0.17.1", + "miden-assembly", + "miden-core", + "miden-crypto", + "miden-mast-package", + "miden-processor", + "miden-utils-sync", "miden-verifier", "semver 1.0.26", "serde", "thiserror 2.0.12", - "toml 0.8.23", + "toml 0.9.2", ] [[package]] -name = "miden-processor" -version = "0.17.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3c033f51b575b5a70b763dc0bc05062b6562a8286c6d0c144eaff92da8f214f" +name = "miden-objects" +version = "0.12.0" +source = "git+https://github.com/0xMiden/miden-base?rev=8a50c8f98529f9a78655385e3e78a6de44db9316#8a50c8f98529f9a78655385e3e78a6de44db9316" dependencies = [ - "miden-air 0.17.1", - "miden-core 0.17.1", - "miden-debug-types 0.17.1", - "miden-utils-diagnostics 0.17.1", + "bech32", + "getrandom 0.3.3", + "miden-assembly", + "miden-core", + "miden-crypto", + "miden-mast-package", + "miden-processor", + "miden-utils-sync", + "miden-verifier", + "semver 1.0.26", + "serde", "thiserror 2.0.12", - "tracing", - "winter-prover", + "toml 0.9.2", ] [[package]] name = "miden-processor" -version = "0.18.0" +version = "0.18.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8074e1e08aa5ac1b570f8e23275127f75aedf3b28eda615b9699018776c7169e" +checksum = "eac41df96664be720b0fbffd9c132a35a0432b5d2e625ba191a83b0d89646a2c" dependencies = [ - "miden-air 0.18.0", - "miden-core 0.18.0", - "miden-debug-types 0.18.0", - "miden-utils-diagnostics 0.18.0", + "miden-air", + "miden-core", + "miden-debug-types", + "miden-utils-diagnostics", "paste", "thiserror 2.0.12", "tracing", @@ -3300,13 +3185,13 @@ dependencies = [ [[package]] name = "miden-prover" -version = "0.17.1" +version = "0.18.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50d2479d594077a0f66b50a5bb1441bdf3824426a6c6b5ddda0b4df3031b0f2f" +checksum = "5ab58a684b0133195fbf2583d3759635fbf1fd796d3a1608752509f279be0b30" dependencies = [ - "miden-air 0.17.1", - "miden-debug-types 0.17.1", - "miden-processor 0.17.1", + "miden-air", + "miden-debug-types", + "miden-processor", "tracing", "winter-maybe-async", "winter-prover", @@ -3314,13 +3199,12 @@ dependencies = [ [[package]] name = "miden-remote-prover-client" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a421a9b5e8f09bda3d91a2d17f7d6804107bd5bb775a61a82b4fe47204d1f3ae" +version = "0.12.0" +source = "git+https://github.com/0xMiden/miden-node?branch=next#c99e200016942fd45f57415de819444891857003" dependencies = [ "getrandom 0.3.3", "miden-node-proto-build", - "miden-objects", + "miden-objects 0.12.0 (git+https://github.com/0xMiden/miden-base?branch=next)", "miden-tx", "miette", "prost", @@ -3337,20 +3221,6 @@ dependencies = [ name = "miden-sdk-alloc" version = "0.7.0" -[[package]] -name = "miden-stdlib" -version = "0.17.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f6d69ecc86e53b9e732b66ef198d444a7c853676fd79e875dc3523dba33d70d" -dependencies = [ - "env_logger", - "miden-assembly 0.17.1", - "miden-core 0.17.1", - "miden-processor 0.17.1", - "miden-utils-sync 0.17.1", - "thiserror 2.0.12", -] - [[package]] name = "miden-stdlib" version = "0.18.0" @@ -3358,11 +3228,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94e78035c073f88709af30eb7823390b05eaeb6692a8eac869f309ba836968d9" dependencies = [ "env_logger", - "miden-assembly 0.18.0", - "miden-core 0.18.0", - "miden-crypto 0.17.0", - "miden-processor 0.18.0", - "miden-utils-sync 0.18.0", + "miden-assembly", + "miden-core", + "miden-crypto", + "miden-processor", + "miden-utils-sync", "thiserror 2.0.12", ] @@ -3392,13 +3262,12 @@ dependencies = [ [[package]] name = "miden-tx" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21e3b4f65ef4d94f071b354e5c8cec01aff311bf9f9376bbf905b98c6955eeb8" +version = "0.12.0" +source = "git+https://github.com/0xMiden/miden-base?branch=next#8a50c8f98529f9a78655385e3e78a6de44db9316" dependencies = [ - "miden-lib", - "miden-objects", - "miden-processor 0.17.1", + "miden-lib 0.12.0 (git+https://github.com/0xMiden/miden-base?branch=next)", + "miden-objects 0.12.0 (git+https://github.com/0xMiden/miden-base?branch=next)", + "miden-processor", "miden-prover", "miden-verifier", "rand 0.9.2", @@ -3408,25 +3277,12 @@ dependencies = [ [[package]] name = "miden-utils-diagnostics" -version = "0.17.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d640d80ce3438275b13d0d400901e5bbf3179737818d91d4e84f747a480fd8b" -dependencies = [ - "miden-crypto 0.15.9", - "miden-debug-types 0.17.1", - "miden-miette", - "paste", - "tracing", -] - -[[package]] -name = "miden-utils-diagnostics" -version = "0.18.0" +version = "0.18.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6619048a6027feb08af62adb6a26a959a7e817987f4c4baa208a775eda550c4" +checksum = "fa555f9ee912ca23317d75fab2a65380b8191de66715237c228cf09165266dec" dependencies = [ - "miden-crypto 0.17.0", - "miden-debug-types 0.18.0", + "miden-crypto", + "miden-debug-types", "miden-miette", "paste", "tracing", @@ -3434,20 +3290,9 @@ dependencies = [ [[package]] name = "miden-utils-sync" -version = "0.17.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccf49e1fbfefeb58de992767ae7b0b6200885e342f4dd43c510daefce9539b95" -dependencies = [ - "lock_api", - "loom", - "parking_lot", -] - -[[package]] -name = "miden-utils-sync" -version = "0.18.0" +version = "0.18.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc49b00e9c15ef7e67debed489e9d4dbe3b12dbf91d98e815bf6a6768ff60a9d" +checksum = "e1873b21e18ba6ab6c697f155a2adb8f35f5ac386f6bb41ae7c207b2ad683642" dependencies = [ "lock_api", "loom", @@ -3456,12 +3301,12 @@ dependencies = [ [[package]] name = "miden-verifier" -version = "0.17.1" +version = "0.18.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3104dce8b4668639aa97aa748a98aab0ea33c103e06ef5c3fd12445ab3bd2387" +checksum = "759989d95534d658ad6a9d7946bbe617814611a1b89b42e944462ea8ffb4de9d" dependencies = [ - "miden-air 0.17.1", - "miden-core 0.17.1", + "miden-air", + "miden-core", "thiserror 2.0.12", "tracing", "winter-verifier", @@ -3493,12 +3338,12 @@ dependencies = [ "inventory", "itertools 0.14.0", "log", - "miden-assembly 0.18.0", - "miden-assembly-syntax 0.18.0", - "miden-core 0.18.0", - "miden-lib", - "miden-mast-package 0.18.0", - "miden-processor 0.18.0", + "miden-assembly", + "miden-assembly-syntax", + "miden-core", + "miden-lib 0.12.0 (git+https://github.com/0xMiden/miden-base?rev=8a50c8f98529f9a78655385e3e78a6de44db9316)", + "miden-mast-package", + "miden-processor", "miden-thiserror", "midenc-dialect-arith", "midenc-dialect-cf", @@ -3522,8 +3367,8 @@ dependencies = [ "clap", "inventory", "log", - "miden-assembly 0.18.0", - "miden-mast-package 0.18.0", + "miden-assembly", + "miden-mast-package", "miden-thiserror", "midenc-codegen-masm", "midenc-dialect-hir", @@ -3535,36 +3380,6 @@ dependencies = [ "wat", ] -[[package]] -name = "midenc-debug" -version = "0.5.0" -dependencies = [ - "clap", - "crossterm", - "futures", - "glob", - "log", - "miden-assembly 0.18.0", - "miden-core 0.18.0", - "miden-debug-types 0.18.0", - "miden-lib", - "miden-mast-package 0.18.0", - "miden-processor 0.18.0", - "miden-thiserror", - "midenc-codegen-masm", - "midenc-hir", - "midenc-session", - "proptest", - "ratatui", - "serde", - "signal-hook", - "syntect", - "tokio", - "tokio-util", - "toml 0.8.23", - "tui-input", -] - [[package]] name = "midenc-dialect-arith" version = "0.5.0" @@ -3626,7 +3441,6 @@ dependencies = [ "log", "miden-thiserror", "midenc-compile", - "midenc-debug", "midenc-hir", "midenc-session", ] @@ -3649,7 +3463,7 @@ dependencies = [ "gimli", "indexmap", "log", - "miden-core 0.18.0", + "miden-core", "miden-thiserror", "midenc-dialect-arith", "midenc-dialect-cf", @@ -3678,7 +3492,7 @@ dependencies = [ "intrusive-collections", "inventory", "log", - "miden-core 0.18.0", + "miden-core", "miden-thiserror", "midenc-hir-macros", "midenc-hir-symbol", @@ -3758,17 +3572,6 @@ dependencies = [ "midenc-session", ] -[[package]] -name = "midenc-hir-type" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e381ba23e4f57ffa0d6039113f6d6004e5b8c7ae6cb909329b48f2ab525e8680" -dependencies = [ - "miden-formatting", - "smallvec", - "thiserror 2.0.12", -] - [[package]] name = "midenc-hir-type" version = "0.4.3" @@ -3801,13 +3604,13 @@ dependencies = [ "clap", "inventory", "log", - "miden-assembly 0.18.0", - "miden-assembly-syntax 0.18.0", - "miden-core 0.18.0", - "miden-debug-types 0.18.0", - "miden-lib", - "miden-mast-package 0.18.0", - "miden-stdlib 0.18.0", + "miden-assembly", + "miden-assembly-syntax", + "miden-core", + "miden-debug-types", + "miden-lib 0.12.0 (git+https://github.com/0xMiden/miden-base?rev=8a50c8f98529f9a78655385e3e78a6de44db9316)", + "miden-mast-package", + "miden-stdlib", "miden-thiserror", "midenc-hir-macros", "midenc-hir-symbol", @@ -4026,16 +3829,6 @@ dependencies = [ "libm", ] -[[package]] -name = "num_cpus" -version = "1.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91df4bbde75afed763b708b7eee1e8e7651e02d97f6d5dd763e89367e957b23b" -dependencies = [ - "hermit-abi", - "libc", -] - [[package]] name = "object" version = "0.36.7" @@ -4893,30 +4686,6 @@ dependencies = [ "windows-sys 0.52.0", ] -[[package]] -name = "rusqlite" -version = "0.36.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3de23c3319433716cf134eed225fe9986bc24f63bed9be9f20c329029e672dc7" -dependencies = [ - "bitflags 2.9.1", - "fallible-iterator", - "fallible-streaming-iterator", - "hashlink", - "libsqlite3-sys", - "smallvec", -] - -[[package]] -name = "rusqlite_migration" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a324f81362b5cd8f2eeef82d032172fdf2ca70aeec64962ff55a56874fe5ec41" -dependencies = [ - "log", - "rusqlite", -] - [[package]] name = "rustc-demangle" version = "0.1.25" diff --git a/Cargo.toml b/Cargo.toml index b8db15bce..a2a4e9585 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,7 +14,6 @@ members = [ "hir-type", "midenc", "midenc-compile", - "midenc-debug", "midenc-driver", "midenc-session", "sdk/*", @@ -73,20 +72,21 @@ inventory = "0.3" log = "0.4" # Miden Dependencies -miden-assembly = { version = "0.18.0", default-features = false } -miden-core = { version = "0.18.0", default-features = false } -miden-debug-types = { version = "0.18.0", default-features = false } -miden-assembly-syntax = { version = "0.18.0", default-features = false } +miden-assembly = { version = "0.18", default-features = false } +miden-core = { version = "0.18", default-features = false } +miden-debug = { version = "0.4.1" } +miden-debug-types = { version = "0.18", default-features = false } +miden-assembly-syntax = { version = "0.18", default-features = false } miden-formatting = { version = "0.1", default-features = false } -miden-lib = { version = "0.11.0", default-features = false, features = [ +miden-lib = { version = "0.12", default-features = false, features = [ "with-debug-info", ] } -miden-objects = { version = "0.11.0", default-features = false } -miden-processor = { version = "0.18.0", default-features = false } -miden-stdlib = { version = "0.18.0", default-features = false, features = [ +miden-objects = { version = "0.12", default-features = false } +miden-processor = { version = "0.18", default-features = false } +miden-stdlib = { version = "0.18", default-features = false, features = [ "with-debug-info", ] } -miden-mast-package = { version = "0.18.0", default-features = false } +miden-mast-package = { version = "0.18", default-features = false } miette = { package = "miden-miette", version = "7.1.1" } paste = "1.0" parking_lot = "0.12" @@ -148,7 +148,6 @@ midenc-hir-type = { version = "0.4.3" } midenc-frontend-wasm = { version = "0.5.0", path = "frontend/wasm" } midenc-compile = { version = "0.5.0", path = "midenc-compile" } midenc-driver = { version = "0.5.0", path = "midenc-driver" } -midenc-debug = { version = "0.5.0", path = "midenc-debug" } midenc-session = { version = "0.5.0", path = "midenc-session" } cargo-miden = { version = "0.5.0", path = "tools/cargo-miden" } miden-integration-tests = { path = "tests/integration" } @@ -160,11 +159,13 @@ midenc-expect-test = { path = "tools/expect-test" } #miden-assembly-syntax = { path = "../miden-vm/assembly-syntax" } #miden-core = { git = "https://github.com/0xMiden/miden-vm", rev = "614cd7f9b52f45238b0ab59c71ebb49325051e5d" } #miden-core = { path = "../miden-vm/core" } -#miden-client = { git = "https://github.com/0xMiden/miden-client", rev = "f98ae87fc3f77e269c3c1e412d1b8ac650aa6fe3" } +miden-client = { git = "https://github.com/0xMiden/miden-client", rev = "4099516c08c9a56c6d1271fddfc798f40da0d702" } +miden-debug = { path = "../miden-debug" } #miden-debug-types = { path = "../miden-vm/crates/debug/types" } #miden-processor = { git = "https://github.com/0xMiden/miden-vm", rev = "614cd7f9b52f45238b0ab59c71ebb49325051e5d" } #miden-processor = { path = "../miden-vm/processor" } -#miden-lib = { git = "https://github.com/0xMiden/miden-base", rev = "64ba4d0f8a077dd7d8f2643ebafa155f95b1c241" } +miden-lib = { git = "https://github.com/0xMiden/miden-base", rev = "8a50c8f98529f9a78655385e3e78a6de44db9316" } +miden-objects = { git = "https://github.com/0xMiden/miden-base", rev = "8a50c8f98529f9a78655385e3e78a6de44db9316" } #miden-stdlib = { git = "https://github.com/0xMiden/miden-vm", rev = "614cd7f9b52f45238b0ab59c71ebb49325051e5d" } #miden-stdlib = { path = "../miden-vm/stdlib" } #miden-mast-package = { git = "https://github.com/0xMiden/miden-vm", rev = "614cd7f9b52f45238b0ab59c71ebb49325051e5d" } diff --git a/midenc-debug/CHANGELOG.md b/midenc-debug/CHANGELOG.md deleted file mode 100644 index b04a7fdd6..000000000 --- a/midenc-debug/CHANGELOG.md +++ /dev/null @@ -1,127 +0,0 @@ -# Changelog -All notable changes to this project will be documented in this file. - -The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), -and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). - -## [Unreleased] - -## [0.5.0](https://github.com/0xMiden/compiler/compare/midenc-debug-v0.4.1...midenc-debug-v0.5.0) - 2025-11-05 - -### Added - -- remove advice_map iteration from `load_mast_forest` function -- update `DebuggerHost` -- fix bytes_from_words_test -- update tests in debug -- update executor.rs -- update source_code.rs -- update executor.rs -- use new `Uri` struct for paths -- update uses of `LineNumber` and `ColumnNumber` - -### Fixed - -- apply cargo clippy changes -- update VM's MAX_CYCLES - -### Other - -- Revert "Merge pull request #700 from 0xMiden/revert-docs-merge" -- Revert "Merge pull request #692 from 0xMiden/chore/docusaurus-migration-next" -- *(README)* add docs section explainer -- replace uses of felt array with Word::new -- replace miden_processor::Digest in favor of miden_core::Word -- update host.rs -- replace AdviceProvides with MemAdviceProvider - -## [0.4.1](https://github.com/0xMiden/compiler/compare/midenc-debug-v0.4.0...midenc-debug-v0.4.1) - 2025-09-03 - -### Other - -- Add 128-bit wide arithmetic support to the compiler. - -## [0.4.0](https://github.com/0xMiden/compiler/compare/midenc-debug-v0.1.5...midenc-debug-v0.4.0) - 2025-08-15 - -### Fixed - -- handle empty iterator returned by `into_remainder()` -- remove incorrect(order) `FromMidenRepr::from_words()` for `[Felt; 4]` - -### Other - -- update Rust toolchain nightly-2025-07-20 (1.90.0-nightly) -- add `test_hmerge` integration test for `hmerge` Rust API - -## [0.1.5](https://github.com/0xMiden/compiler/compare/midenc-debug-v0.1.0...midenc-debug-v0.1.5) - 2025-07-01 - -### Fixed - -- invoke `init` in the lifting function prologue, load the advice - -### Other - -- add format for entrypoint option - -## [0.0.8](https://github.com/0xMiden/compiler/compare/midenc-debug-v0.0.7...midenc-debug-v0.0.8) - 2025-04-24 - -### Added -- *(types)* clean up hir-type for use outside the compiler -- *(codegen)* migrate to element-addressable vm -- add custom dependencies to `Executor` resolver, -- *(cargo-miden)* support building Wasm component from a Cargo project - -### Fixed -- *(codegen)* incomplete global/data segment lowering - -### Other -- *(codegen)* implement initial tests for load_sw/load_dw intrinsics -- update rust toolchain, clean up deps -- enrich Miden package loading error with the file path -- rename hir2 crates -- disable compilation of old hir crates, clean up deps -- switch uses of hir crates to hir2 -- update to the latest `miden-mast-package` (renamed from -- update the Miden VM with updated `miden-package` crate -- update rust toolchain to 1-16 nightly @ 1.86.0 -- Update midenc-debug/src/exec/executor.rs -- fix doc test false positive -- switch to `Package` without rodata, -- [**breaking**] move `Package` to `miden-package` in the VM repo - -## [0.0.7](https://github.com/0xPolygonMiden/compiler/compare/midenc-debug-v0.0.6...midenc-debug-v0.0.7) - 2024-09-17 - -### Other -- update rust toolchain - -## [0.0.6](https://github.com/0xpolygonmiden/compiler/compare/midenc-debug-v0.0.5...midenc-debug-v0.0.6) - 2024-09-06 - -### Added -- implement 'midenc run' command - -### Other -- revisit/update documentation and guides -- switch all crates to a single workspace version (0.0.5) - -## [0.0.2](https://github.com/0xPolygonMiden/compiler/compare/midenc-debug-v0.0.1...midenc-debug-v0.0.2) - 2024-08-30 - -### Fixed -- *(codegen)* broken return via pointer transformation -- *(debugger)* infinite loop in breakpoint id computation - -### Other -- fix clippy warnings in tests - -## [0.0.1](https://github.com/0xPolygonMiden/compiler/compare/midenc-debug-v0.0.0...midenc-debug-v0.0.1) - 2024-08-16 - -### Other -- set `midenc-debug` version to `0.0.0` to be in sync with crates.io -- clean up naming in midenc-debug -- rename midenc-runner to midenc-debug -- fix typos ([#243](https://github.com/0xPolygonMiden/compiler/pull/243)) -- a few minor improvements -- set up mdbook deploy -- add guides for compiling rust->masm -- add mdbook skeleton -- provide some initial usage instructions -- Initial commit diff --git a/midenc-debug/Cargo.toml b/midenc-debug/Cargo.toml deleted file mode 100644 index c96335432..000000000 --- a/midenc-debug/Cargo.toml +++ /dev/null @@ -1,46 +0,0 @@ -[package] -name = "midenc-debug" -description = "An interactive debugger for Miden VM programs" -version.workspace = true -rust-version.workspace = true -authors.workspace = true -repository.workspace = true -homepage.workspace = true -documentation.workspace = true -categories.workspace = true -keywords.workspace = true -license.workspace = true -readme.workspace = true -edition.workspace = true - -[dependencies] -clap.workspace = true -log.workspace = true -glob = "0.3.1" -miden-assembly.workspace = true -miden-core.workspace = true -miden-lib.workspace = true -miden-debug-types.workspace = true -miden-mast-package.workspace = true -miden-processor.workspace = true -midenc-session.workspace = true -midenc-codegen-masm.workspace = true -midenc-hir.workspace = true -thiserror.workspace = true -toml.workspace = true -proptest.workspace = true -serde.workspace = true -ratatui = "0.29.0" -crossterm = { version = "0.28.1", features = ["event-stream"] } -tui-input = "0.11" -tokio.workspace = true -tokio-util = "0.7.11" -futures = "0.3.30" -signal-hook = "0.3.17" -syntect = { version = "5.2.0", default-features = false, features = [ - "parsing", - "default-syntaxes", - "default-themes", - "yaml-load", - "regex-onig", -] } diff --git a/midenc-debug/README.md b/midenc-debug/README.md deleted file mode 100644 index 6c0bbef1c..000000000 --- a/midenc-debug/README.md +++ /dev/null @@ -1,4 +0,0 @@ -# Miden Debugger - -See the [documentation](../docs/usage/debugger.md) for more details on what is provided by this -crate, and how to use it. diff --git a/midenc-debug/src/cli.rs b/midenc-debug/src/cli.rs deleted file mode 100644 index b21194542..000000000 --- a/midenc-debug/src/cli.rs +++ /dev/null @@ -1,139 +0,0 @@ -use std::{ffi::OsString, path::PathBuf, sync::Arc}; - -use clap::{ColorChoice, Parser}; -use midenc_session::{ - add_target_link_libraries, - diagnostics::{DefaultSourceManager, Emitter}, - ColorChoice as MDColorChoice, InputFile, LinkLibrary, Options, ProjectType, Session, TargetEnv, -}; - -/// Run a compiled Miden program with the Miden VM -#[derive(Default, Debug, Parser)] -#[command(name = "debug")] -pub struct Debugger { - /// The working directory for the compiler - /// - /// By default this will be the working directory the compiler is executed from - #[arg(long, value_name = "DIR", help_heading = "Output")] - pub working_dir: Option, - /// The path to the root directory of the Miden toolchain libraries - /// - /// By default this is assumed to be ~/.miden/toolchains/ - #[arg( - long, - value_name = "DIR", - env = "MIDENC_SYSROOT", - help_heading = "Compiler" - )] - pub sysroot: Option, - /// Whether, and how, to color terminal output - #[arg( - long, - value_enum, - default_value_t = ColorChoice::Auto, - default_missing_value = "auto", - num_args(0..=1), - help_heading = "Diagnostics" - )] - pub color: ColorChoice, - /// The target environment to compile for - #[arg( - long, - value_name = "TARGET", - default_value_t = TargetEnv::Base, - help_heading = "Compiler" - )] - pub target: TargetEnv, - /// Specify the function to call as the entrypoint for the program - /// in the format `::` - #[arg(long, help_heading = "Compiler", hide(true))] - pub entrypoint: Option, - /// Specify one or more search paths for link libraries requested via `-l` - #[arg( - long = "search-path", - short = 'L', - value_name = "PATH", - help_heading = "Linker" - )] - pub search_path: Vec, - /// Link compiled projects to the specified library NAME. - /// - /// The optional KIND can be provided to indicate what type of library it is. - /// - /// NAME must either be an absolute path (with extension when applicable), or - /// a library namespace (no extension). The former will be used as the path - /// to load the library, without looking for it in the library search paths, - /// while the latter will be located in the search path based on its KIND. - /// - /// See below for valid KINDs: - #[arg( - long = "link-library", - short = 'l', - value_name = "[KIND=]NAME", - value_delimiter = ',', - next_line_help(true), - help_heading = "Linker" - )] - pub link_libraries: Vec, -} - -impl Debugger { - /// Construct a [Compiler] programatically - pub fn new_session(inputs: I, emitter: Option>, argv: A) -> Session - where - I: IntoIterator, - A: IntoIterator, - S: Into + Clone, - { - let argv = [OsString::from("run")] - .into_iter() - .chain(argv.into_iter().map(|arg| arg.into())); - let mut matches = ::command() - .try_get_matches_from(argv) - .unwrap_or_else(|err| err.exit()); - - let opts = ::from_arg_matches_mut(&mut matches) - .map_err(format_error::) - .unwrap_or_else(|err| err.exit()); - - let inputs = inputs.into_iter().collect(); - opts.into_session(inputs, emitter) - } - - /// Use this configuration to obtain a [Session] used for compilation - pub fn into_session( - self, - inputs: Vec, - emitter: Option>, - ) -> Session { - let cwd = self - .working_dir - .unwrap_or_else(|| std::env::current_dir().expect("no working directory available")); - - // Map clap color choices to internal color choice - let color = match self.color { - ColorChoice::Auto => MDColorChoice::Auto, - ColorChoice::Always => MDColorChoice::Always, - ColorChoice::Never => MDColorChoice::Never, - }; - - // Consolidate all compiler options - let mut options = Options::new(None, self.target, ProjectType::Program, cwd, self.sysroot) - .with_color(color); - options.search_paths = self.search_path; - - let link_libraries = add_target_link_libraries(self.link_libraries, &self.target); - options.link_libraries = link_libraries; - - options.entrypoint = self.entrypoint; - - let target_dir = std::env::temp_dir(); - let source_manager = Arc::new(DefaultSourceManager::default()); - Session::new(inputs, None, None, target_dir, options, emitter, source_manager) - } -} - -fn format_error(err: clap::Error) -> clap::Error { - let mut cmd = I::command(); - err.format(&mut cmd) -} diff --git a/midenc-debug/src/config.rs b/midenc-debug/src/config.rs deleted file mode 100644 index af6a28cd7..000000000 --- a/midenc-debug/src/config.rs +++ /dev/null @@ -1,298 +0,0 @@ -use std::{ - collections::BTreeMap, - ffi::OsStr, - path::{Path, PathBuf}, -}; - -use miden_processor::{AdviceInputs, ExecutionOptions, Felt as RawFelt, StackInputs}; -use serde::Deserialize; - -use crate::Felt; - -#[derive(Debug, Clone, Default, Deserialize)] -#[serde(try_from = "DebuggerConfigFile")] -pub struct DebuggerConfig { - pub inputs: StackInputs, - pub advice_inputs: AdviceInputs, - pub options: ExecutionOptions, -} - -impl TryFrom for DebuggerConfig { - type Error = String; - - #[inline] - fn try_from(mut file: DebuggerConfigFile) -> Result { - Self::from_inputs_file(file, None) - } -} - -impl DebuggerConfig { - pub fn parse_file

(path: P) -> std::io::Result - where - P: AsRef, - { - let path = path.as_ref(); - let content = std::fs::read_to_string(path)?; - - let file = toml::from_str::(&content).map_err(std::io::Error::other)?; - Self::from_inputs_file(file, path.parent().map(|p| p.to_path_buf())) - .map_err(std::io::Error::other) - } - - pub fn parse_str(content: &str) -> Result { - let file = toml::from_str::(content).map_err(|err| err.to_string())?; - - Self::from_inputs_file(file, None) - } - - fn from_inputs_file( - mut file: DebuggerConfigFile, - _cwd: Option, - ) -> Result { - let inputs = StackInputs::new(file.inputs.stack.into_iter().map(|felt| felt.0).collect()) - .map_err(|err| format!("invalid value for 'stack': {err}"))?; - let advice_inputs = AdviceInputs::default() - .with_stack(file.inputs.advice.stack.into_iter().rev().map(|felt| felt.0)) - .with_map(file.inputs.advice.map.into_iter().map(|entry| { - (entry.digest.0, entry.values.into_iter().map(|felt| felt.0).collect::>()) - })); - - Ok(Self { - inputs, - advice_inputs, - options: file.options, - }) - } -} - -#[derive(Debug, Clone, Default, Deserialize)] -#[serde(default)] -struct DebuggerConfigFile { - inputs: Inputs, - #[serde(deserialize_with = "deserialize_execution_options")] - options: ExecutionOptions, -} - -#[derive(Debug, Clone, Default, Deserialize)] -#[serde(default)] -struct Inputs { - /// The contents of the operand stack, top is leftmost - stack: Vec, - /// The inputs to the advice provider - advice: Advice, -} - -#[derive(Debug, Clone, Default, Deserialize)] -#[serde(default)] -struct Advice { - /// The contents of the advice stack, top is leftmost - stack: Vec, - /// Entries to populate the advice map with - map: Vec, -} - -#[derive(Debug, Clone, Deserialize)] -struct AdviceMapEntry { - digest: Word, - /// Values that will be pushed to the advice stack when this entry is requested - #[serde(default)] - values: Vec, -} - -impl clap::builder::ValueParserFactory for DebuggerConfig { - type Parser = DebuggerConfigParser; - - fn value_parser() -> Self::Parser { - DebuggerConfigParser - } -} - -#[doc(hidden)] -#[derive(Clone)] -pub struct DebuggerConfigParser; -impl clap::builder::TypedValueParser for DebuggerConfigParser { - type Value = DebuggerConfig; - - fn parse_ref( - &self, - _cmd: &clap::Command, - _arg: Option<&clap::Arg>, - value: &OsStr, - ) -> Result { - use clap::error::{Error, ErrorKind}; - - let inputs_path = Path::new(value); - if !inputs_path.is_file() { - return Err(Error::raw( - ErrorKind::InvalidValue, - format!("invalid inputs file: '{}' is not a file", inputs_path.display()), - )); - } - - let content = std::fs::read_to_string(inputs_path).map_err(|err| { - Error::raw(ErrorKind::ValueValidation, format!("failed to read inputs file: {err}")) - })?; - let inputs_file = toml::from_str::(&content).map_err(|err| { - Error::raw(ErrorKind::ValueValidation, format!("invalid inputs file: {err}")) - })?; - - DebuggerConfig::from_inputs_file(inputs_file, Some(inputs_path.to_path_buf())).map_err( - |err| Error::raw(ErrorKind::ValueValidation, format!("invalid inputs file: {err}")), - ) - } -} - -#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord)] -struct Word(miden_core::Word); -impl<'de> Deserialize<'de> for Word { - fn deserialize(deserializer: D) -> Result - where - D: serde::Deserializer<'de>, - { - let digest = String::deserialize(deserializer)?; - miden_core::Word::try_from(&digest) - .map_err(|err| serde::de::Error::custom(format!("invalid digest: {err}"))) - .map(Self) - } -} - -fn deserialize_rodata_bytes<'de, D>(deserializer: D) -> Result, D::Error> -where - D: serde::Deserializer<'de>, -{ - use midenc_hir::constants::ConstantData; - - String::deserialize(deserializer).and_then(|hex| { - ConstantData::from_str_be(hex.as_str()) - .map_err(|err| serde::de::Error::custom(format!("invalid rodata: {err}"))) - .map(Vec::::from) - }) -} - -fn deserialize_execution_options<'de, D>(deserializer: D) -> Result -where - D: serde::Deserializer<'de>, -{ - #[derive(Default, Deserialize)] - #[serde(default)] - struct ExecOptions { - max_cycles: Option, - expected_cycles: u32, - } - - ExecOptions::deserialize(deserializer).and_then(|opts| { - ExecutionOptions::new( - opts.max_cycles, - opts.expected_cycles, - /* enable_tracing= */ true, - /* enable_debugging= */ true, - ) - .map(|exec_opts| exec_opts.with_debugging(true)) - .map_err(|err| serde::de::Error::custom(format!("invalid execution options: {err}"))) - }) -} - -#[cfg(test)] -mod tests { - use toml::toml; - - use super::*; - - #[test] - fn debugger_config_empty() { - let text = toml::to_string_pretty(&toml! { - [inputs] - [options] - }) - .unwrap(); - - let file = toml::from_str::(&text).unwrap(); - let expected_inputs = StackInputs::new(vec![]).unwrap(); - assert_eq!(file.inputs.as_ref(), expected_inputs.as_ref()); - assert!(file.advice_inputs.stack.is_empty()); - assert!(file.options.enable_tracing()); - assert!(file.options.enable_debugging()); - assert_eq!(file.options.max_cycles(), ExecutionOptions::MAX_CYCLES); - assert_eq!(file.options.expected_cycles(), 64); - } - - #[test] - fn debugger_config_with_options() { - let text = toml::to_string_pretty(&toml! { - [inputs] - [options] - max_cycles = 1000 - }) - .unwrap(); - - let file = DebuggerConfig::parse_str(&text).unwrap(); - let expected_inputs = StackInputs::new(vec![]).unwrap(); - assert_eq!(file.inputs.as_ref(), expected_inputs.as_ref()); - assert!(file.advice_inputs.stack.is_empty()); - assert!(file.options.enable_tracing()); - assert!(file.options.enable_debugging()); - assert_eq!(file.options.max_cycles(), 1000); - assert_eq!(file.options.expected_cycles(), 64); - } - - #[test] - fn debugger_config_with_operands() { - let text = toml::to_string_pretty(&toml! { - [inputs] - stack = [1, 2, 3] - - [options] - max_cycles = 1000 - }) - .unwrap(); - - let file = DebuggerConfig::parse_str(&text).unwrap(); - let expected_inputs = - StackInputs::new(vec![RawFelt::new(1), RawFelt::new(2), RawFelt::new(3)]).unwrap(); - assert_eq!(file.inputs.as_ref(), expected_inputs.as_ref()); - assert!(file.advice_inputs.stack.is_empty()); - assert!(file.options.enable_tracing()); - assert!(file.options.enable_debugging()); - assert_eq!(file.options.max_cycles(), 1000); - assert_eq!(file.options.expected_cycles(), 64); - } - - #[test] - fn debugger_config_with_advice() { - let text = toml::to_string_pretty(&toml! { - [inputs] - stack = [1, 2, 0x3] - - [inputs.advice] - stack = [1, 2, 3, 4] - - [[inputs.advice.map]] - digest = "0x3cff5b58a573dc9d25fd3c57130cc57e5b1b381dc58b5ae3594b390c59835e63" - values = [1, 2, 3, 4] - - [options] - max_cycles = 1000 - }) - .unwrap(); - let digest = miden_core::Word::try_from( - "0x3cff5b58a573dc9d25fd3c57130cc57e5b1b381dc58b5ae3594b390c59835e63", - ) - .unwrap(); - let file = DebuggerConfig::parse_str(&text).unwrap_or_else(|err| panic!("{err}")); - let expected_inputs = - StackInputs::new(vec![RawFelt::new(1), RawFelt::new(2), RawFelt::new(3)]).unwrap(); - assert_eq!(file.inputs.as_ref(), expected_inputs.as_ref()); - assert_eq!( - file.advice_inputs.stack, - &[RawFelt::new(4), RawFelt::new(3), RawFelt::new(2), RawFelt::new(1)] - ); - assert_eq!( - file.advice_inputs.map.get(&digest).map(|value| value.as_ref()), - Some([RawFelt::new(1), RawFelt::new(2), RawFelt::new(3), RawFelt::new(4)].as_slice()) - ); - assert!(file.options.enable_tracing()); - assert!(file.options.enable_debugging()); - assert_eq!(file.options.max_cycles(), 1000); - assert_eq!(file.options.expected_cycles(), 64); - } -} diff --git a/midenc-debug/src/debug/breakpoint.rs b/midenc-debug/src/debug/breakpoint.rs deleted file mode 100644 index 4e7c74de8..000000000 --- a/midenc-debug/src/debug/breakpoint.rs +++ /dev/null @@ -1,173 +0,0 @@ -use std::{ops::Deref, path::Path, str::FromStr}; - -use glob::Pattern; -use miden_processor::VmState; - -use super::ResolvedLocation; - -#[derive(Debug, Clone, PartialEq, Eq)] -pub struct Breakpoint { - pub id: u8, - pub creation_cycle: usize, - pub ty: BreakpointType, -} - -impl Default for Breakpoint { - fn default() -> Self { - Self { - id: 0, - creation_cycle: 0, - ty: BreakpointType::Step, - } - } -} - -impl Breakpoint { - /// Return the number of cycles this breakpoint indicates we should skip, or `None` if the - /// number of cycles is context-specific, or the breakpoint is triggered by something other - /// than cycle count. - pub fn cycles_to_skip(&self, current_cycle: usize) -> Option { - let cycles_passed = current_cycle - self.creation_cycle; - match &self.ty { - BreakpointType::Step => Some(1), - BreakpointType::StepN(n) => Some(n.saturating_sub(cycles_passed)), - BreakpointType::StepTo(to) if to >= ¤t_cycle => Some(to.abs_diff(current_cycle)), - _ => None, - } - } -} -impl Deref for Breakpoint { - type Target = BreakpointType; - - #[inline] - fn deref(&self) -> &Self::Target { - &self.ty - } -} - -#[derive(Debug, Clone, PartialEq, Eq)] -pub enum BreakpointType { - /// Break at next cycle - Step, - /// Skip N cycles - StepN(usize), - /// Break at a given cycle - StepTo(usize), - /// Break at the first cycle of the next instruction - Next, - /// Break when we exit the current call frame - Finish, - /// Break when any cycle corresponds to a source location whose file matches PATTERN - File(Pattern), - /// Break when any cycle corresponds to a source location whose file matches PATTERN and occurs - /// on LINE - Line { pattern: Pattern, line: u32 }, - /// Break anytime the given operation occurs - Opcode(miden_core::Operation), - /// Break when any cycle causes us to push a frame for PROCEDURE on the call stack - Called(Pattern), -} -impl BreakpointType { - /// Return true if this breakpoint indicates we should break for `current_op` - pub fn should_break_for(&self, current_op: &miden_core::Operation) -> bool { - match self { - Self::Opcode(op) => current_op == op, - _ => false, - } - } - - /// Return true if this breakpoint indicates we should break on entry to `procedure` - pub fn should_break_in(&self, procedure: &str) -> bool { - match self { - Self::Called(pattern) => pattern.matches(procedure), - _ => false, - } - } - - /// Return true if this breakpoint indicates we should break at `loc` - pub fn should_break_at(&self, loc: &ResolvedLocation) -> bool { - match self { - Self::File(pattern) => { - pattern.matches_path(Path::new(loc.source_file.deref().content().uri().as_str())) - } - Self::Line { pattern, line } if line == &loc.line => { - pattern.matches_path(Path::new(loc.source_file.deref().content().uri().as_str())) - } - _ => false, - } - } - - /// Returns true if this breakpoint is internal to the debugger (i.e. not creatable via :b) - pub fn is_internal(&self) -> bool { - matches!(self, BreakpointType::Next | BreakpointType::Step | BreakpointType::Finish) - } - - /// Returns true if this breakpoint is removed upon being hit - pub fn is_one_shot(&self) -> bool { - matches!( - self, - BreakpointType::Next - | BreakpointType::Finish - | BreakpointType::Step - | BreakpointType::StepN(_) - | BreakpointType::StepTo(_) - ) - } -} - -impl FromStr for BreakpointType { - type Err = String; - - fn from_str(s: &str) -> Result { - let s = s.trim(); - - // b next - // b finish - // b after {n} - // b for {opcode} - // b at {cycle} - // b in {procedure} - // b {file}[:{line}] - if s == "next" { - return Ok(BreakpointType::Next); - } - if s == "finish" { - return Ok(BreakpointType::Finish); - } - if let Some(n) = s.strip_prefix("after ") { - let n = n.trim().parse::().map_err(|err| { - format!("invalid breakpoint expression: could not parse cycle count: {err}") - })?; - return Ok(BreakpointType::StepN(n)); - } - if let Some(_opcode) = s.strip_prefix("for ") { - todo!() - } - if let Some(cycle) = s.strip_prefix("at ") { - let cycle = cycle.trim().parse::().map_err(|err| { - format!("invalid breakpoint expression: could not parse cycle value: {err}") - })?; - return Ok(BreakpointType::StepTo(cycle)); - } - if let Some(procedure) = s.strip_prefix("in ") { - let pattern = Pattern::new(procedure.trim()) - .map_err(|err| format!("invalid breakpoint expression: bad pattern: {err}"))?; - return Ok(BreakpointType::Called(pattern)); - } - match s.split_once(':') { - Some((file, line)) => { - let pattern = Pattern::new(file.trim()) - .map_err(|err| format!("invalid breakpoint expression: bad pattern: {err}"))?; - let line = line.trim().parse::().map_err(|err| { - format!("invalid breakpoint expression: could not parse line: {err}") - })?; - Ok(BreakpointType::Line { pattern, line }) - } - None => { - let pattern = Pattern::new(s.trim()) - .map_err(|err| format!("invalid breakpoint expression: bad pattern: {err}"))?; - Ok(BreakpointType::File(pattern)) - } - } - } -} diff --git a/midenc-debug/src/debug/memory.rs b/midenc-debug/src/debug/memory.rs deleted file mode 100644 index 133e7bb83..000000000 --- a/midenc-debug/src/debug/memory.rs +++ /dev/null @@ -1,265 +0,0 @@ -use std::{ - ffi::{OsStr, OsString}, - fmt, - str::FromStr, - sync::Arc, -}; - -use clap::{Parser, ValueEnum}; -use midenc_codegen_masm::NativePtr; -use midenc_hir::{ArrayType, PointerType, Type}; - -#[derive(Debug, Clone, PartialEq, Eq)] -pub struct ReadMemoryExpr { - pub addr: NativePtr, - pub ty: Type, - pub count: u8, - pub mode: MemoryMode, - pub format: FormatType, -} -impl FromStr for ReadMemoryExpr { - type Err = String; - - fn from_str(s: &str) -> Result { - let argv = s.split_whitespace(); - let args = Read::parse(argv)?; - - let ty = args.ty.unwrap_or_else(|| Type::from(ArrayType::new(Type::Felt, 4))); - let addr = match args.mode { - MemoryMode::Word => NativePtr::new(args.addr, 0), - MemoryMode::Byte => NativePtr::from_ptr(args.addr), - }; - Ok(Self { - addr, - ty, - count: args.count, - mode: args.mode, - format: args.format, - }) - } -} - -#[derive(Default, Debug, Parser)] -#[command(name = "read")] -pub struct Read { - /// The memory address to start reading from - #[arg(required(true), value_name = "ADDR", value_parser(parse_address))] - pub addr: u32, - /// The type of value to read from ADDR, defaults to 'word' - #[arg( - short = 't', - long = "type", - value_name = "TYPE", - value_parser(TypeParser) - )] - pub ty: Option, - /// The number of values to read - #[arg(short = 'c', long = "count", value_name = "N", default_value_t = 1)] - pub count: u8, - /// The addressing mode to use - #[arg( - short = 'm', - long = "mode", - value_name = "MODE", - default_value_t = MemoryMode::Word, - value_parser(MemoryModeParser) - )] - pub mode: MemoryMode, - /// The format to use when printing integral values - #[arg( - short = 'f', - long = "format", - value_name = "FORMAT", - default_value_t = FormatType::Decimal, - value_parser(FormatTypeParser) - )] - pub format: FormatType, -} -impl Read { - pub fn parse(argv: I) -> Result - where - I: IntoIterator, - S: Into + Clone, - { - let command = ::command() - .disable_help_flag(true) - .disable_version_flag(true) - .disable_colored_help(true) - .no_binary_name(true); - - let mut matches = command.try_get_matches_from(argv).map_err(|err| err.to_string())?; - ::from_arg_matches_mut(&mut matches) - .map_err(|err| err.to_string()) - } -} - -#[doc(hidden)] -#[derive(Clone)] -struct TypeParser; -impl clap::builder::TypedValueParser for TypeParser { - type Value = Type; - - fn parse_ref( - &self, - _cmd: &clap::Command, - _arg: Option<&clap::Arg>, - value: &OsStr, - ) -> Result { - use clap::error::{Error, ErrorKind}; - - let value = value.to_str().ok_or_else(|| Error::new(ErrorKind::InvalidUtf8))?; - - Ok(match value { - "i1" => Type::I1, - "i8" => Type::I8, - "i16" => Type::I16, - "i32" => Type::I32, - "i64" => Type::I64, - "i128" => Type::I128, - "u8" => Type::U8, - "u16" => Type::U16, - "u32" => Type::U32, - "u64" => Type::U64, - "u128" => Type::U128, - "felt" => Type::Felt, - "word" => Type::from(ArrayType::new(Type::Felt, 4)), - "ptr" | "pointer" => Type::from(PointerType::new(Type::U32)), - _ => { - return Err(Error::raw( - ErrorKind::InvalidValue, - format!("invalid/unsupported type '{value}'"), - )) - } - }) - } -} - -fn parse_address(s: &str) -> Result { - if let Some(s) = s.strip_prefix("0x") { - u32::from_str_radix(s, 16).map_err(|err| format!("invalid memory address: {err}")) - } else if s.is_empty() { - Err(format!("expected memory address at '{s}'")) - } else { - s.parse::().map_err(|err| format!("invalid memory address: {err}")) - } -} - -#[derive(Default, Debug, Copy, Clone, PartialEq, Eq, ValueEnum)] -pub enum MemoryMode { - #[default] - Word, - Byte, -} -impl fmt::Display for MemoryMode { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - match self { - Self::Word => f.write_str("word"), - Self::Byte => f.write_str("byte"), - } - } -} -impl FromStr for MemoryMode { - type Err = String; - - fn from_str(s: &str) -> Result { - match s { - "w" | "word" | "words" | "miden" => Ok(Self::Word), - "b" | "byte" | "bytes" | "rust" => Ok(Self::Byte), - _ => Err(format!("invalid memory mode '{s}'")), - } - } -} - -#[doc(hidden)] -#[derive(Clone)] -struct MemoryModeParser; -impl clap::builder::TypedValueParser for MemoryModeParser { - type Value = MemoryMode; - - fn possible_values( - &self, - ) -> Option + '_>> { - use clap::builder::PossibleValue; - Some(Box::new( - [ - PossibleValue::new("words").aliases(["w", "word", "miden"]), - PossibleValue::new("bytes").aliases(["b", "byte", "rust"]), - ] - .into_iter(), - )) - } - - fn parse_ref( - &self, - _cmd: &clap::Command, - _arg: Option<&clap::Arg>, - value: &OsStr, - ) -> Result { - use clap::error::{Error, ErrorKind}; - - let value = value.to_str().ok_or_else(|| Error::new(ErrorKind::InvalidUtf8))?; - value.parse().map_err(|err| Error::raw(ErrorKind::InvalidValue, err)) - } -} - -#[derive(Default, Debug, Copy, Clone, PartialEq, Eq)] -pub enum FormatType { - #[default] - Decimal, - Hex, - Binary, -} -impl fmt::Display for FormatType { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - match self { - Self::Decimal => f.write_str("decimal"), - Self::Hex => f.write_str("hex"), - Self::Binary => f.write_str("binary"), - } - } -} -impl FromStr for FormatType { - type Err = String; - - fn from_str(s: &str) -> Result { - match s { - "d" | "decimal" => Ok(Self::Decimal), - "x" | "hex" | "hexadecimal" => Ok(Self::Hex), - "b" | "bin" | "binary" | "bits" => Ok(Self::Binary), - _ => Err(format!("invalid format type '{s}'")), - } - } -} - -#[doc(hidden)] -#[derive(Clone)] -struct FormatTypeParser; -impl clap::builder::TypedValueParser for FormatTypeParser { - type Value = FormatType; - - fn possible_values( - &self, - ) -> Option + '_>> { - use clap::builder::PossibleValue; - Some(Box::new( - [ - PossibleValue::new("decimal").alias("d"), - PossibleValue::new("hex").aliases(["x", "hexadecimal"]), - PossibleValue::new("binary").aliases(["b", "bin", "bits"]), - ] - .into_iter(), - )) - } - - fn parse_ref( - &self, - _cmd: &clap::Command, - _arg: Option<&clap::Arg>, - value: &OsStr, - ) -> Result { - use clap::error::{Error, ErrorKind}; - - let value = value.to_str().ok_or_else(|| Error::new(ErrorKind::InvalidUtf8))?; - value.parse().map_err(|err| Error::raw(ErrorKind::InvalidValue, err)) - } -} diff --git a/midenc-debug/src/debug/mod.rs b/midenc-debug/src/debug/mod.rs deleted file mode 100644 index 6272b98a7..000000000 --- a/midenc-debug/src/debug/mod.rs +++ /dev/null @@ -1,9 +0,0 @@ -mod breakpoint; -mod memory; -mod stacktrace; - -pub use self::{ - breakpoint::{Breakpoint, BreakpointType}, - memory::{FormatType, MemoryMode, ReadMemoryExpr}, - stacktrace::{CallFrame, CallStack, CurrentFrame, OpDetail, ResolvedLocation, StackTrace}, -}; diff --git a/midenc-debug/src/debug/stacktrace.rs b/midenc-debug/src/debug/stacktrace.rs deleted file mode 100644 index 32aeb08b9..000000000 --- a/midenc-debug/src/debug/stacktrace.rs +++ /dev/null @@ -1,559 +0,0 @@ -use std::{ - borrow::Cow, - cell::{OnceCell, RefCell}, - collections::{BTreeMap, BTreeSet, VecDeque}, - fmt, - path::Path, - rc::Rc, - sync::Arc, -}; - -use miden_core::AssemblyOp; -use miden_debug_types::Location; -use miden_processor::{Operation, RowIndex, VmState}; -use midenc_hir::demangle::demangle; -use midenc_session::{ - diagnostics::{SourceFile, SourceSpan}, - Session, -}; - -use crate::TraceEvent; - -#[derive(Debug, Clone)] -struct SpanContext { - frame_index: usize, - location: Option, -} - -pub struct CallStack { - trace_events: Rc>>, - contexts: BTreeSet>, - frames: Vec, - block_stack: Vec>, -} -impl CallStack { - pub fn new(trace_events: Rc>>) -> Self { - Self { - trace_events, - contexts: BTreeSet::default(), - frames: vec![], - block_stack: vec![], - } - } - - pub fn stacktrace<'a>( - &'a self, - recent: &'a VecDeque, - session: &'a Session, - ) -> StackTrace<'a> { - StackTrace::new(self, recent, session) - } - - pub fn current_frame(&self) -> Option<&CallFrame> { - self.frames.last() - } - - pub fn current_frame_mut(&mut self) -> Option<&mut CallFrame> { - self.frames.last_mut() - } - - pub fn nth_frame(&self, n: usize) -> Option<&CallFrame> { - self.frames.iter().nth_back(n) - } - - pub fn frames(&self) -> &[CallFrame] { - self.frames.as_slice() - } - - /// Updates the call stack from `state` - /// - /// Returns the call frame exited this cycle, if any - pub fn next(&mut self, state: &VmState) -> Option { - if let Some(op) = state.op { - // Do not do anything if this cycle is a continuation of the last instruction - //let skip = state.asmop.as_ref().map(|op| op.cycle_idx() > 1).unwrap_or(false); - //if skip { - //return; - //} - - // Get the current procedure name context, if available - let procedure = - state.asmop.as_ref().map(|op| self.cache_procedure_name(op.context_name())); - /* - if procedure.is_none() { - dbg!(self.frames.last().map(|frame| frame.procedure.as_deref())); - dbg!(self.block_stack.last().map(|ctx| ctx.as_ref())); - } - */ - // Handle trace events for this cycle - let event = self.trace_events.borrow().get(&state.clk).copied(); - log::trace!("handling {op} at cycle {}: {:?}", state.clk, &event); - let popped_frame = self.handle_trace_event(event, procedure.as_ref()); - let is_frame_end = popped_frame.is_some(); - - // These ops we do not record in call frame details - let ignore = matches!( - op, - Operation::Join - | Operation::Split - | Operation::Span - | Operation::Respan - | Operation::End - ); - - // Manage block stack - match op { - Operation::Span => { - if let Some(asmop) = state.asmop.as_ref() { - log::debug!("{asmop:#?}"); - self.block_stack.push(Some(SpanContext { - frame_index: self.frames.len().saturating_sub(1), - location: asmop.as_ref().location().cloned(), - })); - } else { - self.block_stack.push(None); - } - } - Operation::End => { - self.block_stack.pop(); - } - Operation::Join | Operation::Split => { - self.block_stack.push(None); - } - _ => (), - } - - if ignore || is_frame_end { - return popped_frame; - } - - // Attempt to supply procedure context from the current span context, if needed + - // available - let (procedure, asmop) = match procedure { - proc @ Some(_) => { - (proc, state.asmop.as_ref().map(|info| info.as_ref()).map(Cow::Borrowed)) - } - None => match self.block_stack.last() { - Some(Some(span_ctx)) => { - let proc = - self.frames.get(span_ctx.frame_index).and_then(|f| f.procedure.clone()); - let info = state - .asmop - .as_ref() - .map(|info| info.as_ref()) - .map(Cow::Borrowed) - .or_else(|| { - let context_name = - proc.as_deref().unwrap_or("").to_string(); - let raw_asmop = miden_core::AssemblyOp::new( - span_ctx.location.clone(), - context_name, - 1, - op.to_string(), - false, - ); - Some(Cow::Owned(raw_asmop)) - }); - (proc, info) - } - _ => (None, state.asmop.as_ref().map(|info| info.as_ref()).map(Cow::Borrowed)), - }, - }; - - // Use the current frame's procedure context, if no other more precise context is - // available - let procedure = - procedure.or_else(|| self.frames.last().and_then(|f| f.procedure.clone())); - - // Do we have a frame? If not, create one - if self.frames.is_empty() { - self.frames.push(CallFrame::new(procedure.clone())); - } - - let current_frame = self.frames.last_mut().unwrap(); - - // Does the current frame have a procedure context/location? Use the one from this op if - // so - let procedure_context_updated = - current_frame.procedure.is_none() && procedure.is_some(); - if procedure_context_updated { - current_frame.procedure.clone_from(&procedure); - } - - // If this is the frame pointer prologue/epilogue drop the last op, which should be a - // push - if matches!(op, Operation::FmpUpdate) { - current_frame.context.pop_back(); - } - - // Push op into call frame if this is any op other than `nop` or frame setup - if !matches!(op, Operation::Noop | Operation::FmpUpdate) { - let cycle_idx = state.asmop.as_ref().map(|info| info.cycle_idx()).unwrap_or(1); - current_frame.push(op, cycle_idx, asmop.as_deref()); - } - - // Check if we should also update the caller frame's exec detail - let num_frames = self.frames.len(); - if procedure_context_updated && num_frames > 1 { - let caller_frame = &mut self.frames[num_frames - 2]; - if let Some(OpDetail::Exec { ref mut callee }) = caller_frame.context.back_mut() { - if callee.is_none() { - *callee = procedure; - } - } - } - } - - None - } - - // Get or cache procedure name/context as `Rc` - fn cache_procedure_name(&mut self, context_name: &str) -> Rc { - match self.contexts.get(context_name) { - Some(name) => Rc::clone(name), - None => { - let name = Rc::from(context_name.to_string().into_boxed_str()); - self.contexts.insert(Rc::clone(&name)); - name - } - } - } - - fn handle_trace_event( - &mut self, - event: Option, - procedure: Option<&Rc>, - ) -> Option { - // Do we need to handle any frame events? - if let Some(event) = event { - match event { - TraceEvent::FrameStart => { - // Record the fact that we exec'd a new procedure in the op context - if let Some(current_frame) = self.frames.last_mut() { - current_frame.push_exec(procedure.cloned()); - } - // Push a new frame - self.frames.push(CallFrame::new(procedure.cloned())); - } - TraceEvent::Unknown(code) => log::debug!("unknown trace event: {code}"), - TraceEvent::FrameEnd => { - return self.frames.pop(); - } - _ => (), - } - } - None - } -} - -pub struct CallFrame { - procedure: Option>, - context: VecDeque, - display_name: std::cell::OnceCell>, - finishing: bool, -} -impl CallFrame { - pub fn new(procedure: Option>) -> Self { - Self { - procedure, - context: Default::default(), - display_name: Default::default(), - finishing: false, - } - } - - pub fn procedure(&self, strip_prefix: &str) -> Option> { - self.procedure.as_ref()?; - let name = self.display_name.get_or_init(|| { - let name = self.procedure.as_deref().unwrap(); - let name = match name.split_once("::") { - Some((module, rest)) if module == strip_prefix => demangle(rest), - _ => demangle(name), - }; - Rc::from(name.into_boxed_str()) - }); - Some(Rc::clone(name)) - } - - pub fn push_exec(&mut self, callee: Option>) { - if self.context.len() == 5 { - self.context.pop_front(); - } - - self.context.push_back(OpDetail::Exec { callee }); - } - - pub fn push(&mut self, opcode: Operation, cycle_idx: u8, op: Option<&AssemblyOp>) { - if cycle_idx > 1 { - // Should we ignore this op? - let skip = self.context.back().map(|detail| matches!(detail, OpDetail::Full { op, .. } | OpDetail::Basic { op } if op == &opcode)).unwrap_or(false); - if skip { - return; - } - } - - if self.context.len() == 5 { - self.context.pop_front(); - } - - match op { - Some(op) => { - let location = op.location().cloned(); - self.context.push_back(OpDetail::Full { - op: opcode, - location, - resolved: Default::default(), - }); - } - None => { - // If this instruction does not have a location, inherit the location - // of the previous op in the frame, if one is present - if let Some(loc) = self.context.back().map(|op| op.location().cloned()) { - self.context.push_back(OpDetail::Full { - op: opcode, - location: loc, - resolved: Default::default(), - }); - } else { - self.context.push_back(OpDetail::Basic { op: opcode }); - } - } - } - } - - pub fn last_location(&self) -> Option<&Location> { - match self.context.back() { - Some(OpDetail::Full { location, .. }) => { - let loc = location.as_ref(); - if loc.is_none() { - dbg!(&self.context); - } - loc - } - Some(OpDetail::Basic { .. }) => None, - Some(OpDetail::Exec { .. }) => { - let op = self.context.iter().rev().nth(1)?; - op.location() - } - None => None, - } - } - - pub fn last_resolved(&self, session: &Session) -> Option<&ResolvedLocation> { - self.context.back().and_then(|op| op.resolve(session)) - } - - pub fn recent(&self) -> &VecDeque { - &self.context - } - - #[inline(always)] - pub fn should_break_on_exit(&self) -> bool { - self.finishing - } - - #[inline(always)] - pub fn break_on_exit(&mut self) { - self.finishing = true; - } -} - -#[derive(Debug, Clone)] -pub enum OpDetail { - Full { - op: Operation, - location: Option, - resolved: OnceCell>, - }, - Exec { - callee: Option>, - }, - Basic { - op: Operation, - }, -} -impl OpDetail { - pub fn callee(&self, strip_prefix: &str) -> Option> { - match self { - Self::Exec { callee: None } => Some(Box::from("")), - Self::Exec { - callee: Some(ref callee), - } => { - let name = match callee.split_once("::") { - Some((module, rest)) if module == strip_prefix => demangle(rest), - _ => demangle(callee), - }; - Some(name.into_boxed_str()) - } - _ => None, - } - } - - pub fn display(&self) -> String { - match self { - Self::Full { op, .. } | Self::Basic { op } => format!("{op}"), - Self::Exec { - callee: Some(callee), - } => format!("exec.{callee}"), - Self::Exec { callee: None } => "exec.".to_string(), - } - } - - pub fn opcode(&self) -> Operation { - match self { - Self::Full { op, .. } | Self::Basic { op } => *op, - Self::Exec { .. } => panic!("no opcode associated with execs"), - } - } - - pub fn location(&self) -> Option<&Location> { - match self { - Self::Full { ref location, .. } => location.as_ref(), - Self::Basic { .. } | Self::Exec { .. } => None, - } - } - - pub fn resolve(&self, session: &Session) -> Option<&ResolvedLocation> { - use midenc_session::diagnostics::SourceManagerExt; - - match self { - Self::Full { - location: Some(ref loc), - ref resolved, - .. - } => resolved - .get_or_init(|| { - let path = Path::new(loc.uri().as_str()); - let source_file = if path.exists() { - session.source_manager.load_file(path).ok()? - } else { - session.source_manager.get_by_uri(loc.uri())? - }; - let span = SourceSpan::new(source_file.id(), loc.start..loc.end); - let file_line_col = source_file.location(span); - Some(ResolvedLocation { - source_file, - line: file_line_col.line.to_u32(), - col: file_line_col.column.to_u32(), - span, - }) - }) - .as_ref(), - _ => None, - } - } -} - -#[derive(Debug, Clone)] -pub struct ResolvedLocation { - pub source_file: Arc, - // TODO(fabrio): Use LineNumber and ColumnNumber instead of raw `u32`. - pub line: u32, - pub col: u32, - pub span: SourceSpan, -} -impl fmt::Display for ResolvedLocation { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - write!(f, "{}:{}:{}", self.source_file.uri().as_str(), self.line, self.col) - } -} - -pub struct CurrentFrame { - pub procedure: Option>, - pub location: Option, -} - -pub struct StackTrace<'a> { - callstack: &'a CallStack, - recent: &'a VecDeque, - session: &'a Session, - current_frame: Option, -} - -impl<'a> StackTrace<'a> { - pub fn new( - callstack: &'a CallStack, - recent: &'a VecDeque, - session: &'a Session, - ) -> Self { - let current_frame = callstack.current_frame().map(|frame| { - let location = frame.last_resolved(session).cloned(); - let procedure = frame.procedure(session.name()); - CurrentFrame { - procedure, - location, - } - }); - Self { - callstack, - recent, - session, - current_frame, - } - } - - pub fn current_frame(&self) -> Option<&CurrentFrame> { - self.current_frame.as_ref() - } -} - -impl fmt::Display for StackTrace<'_> { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - use std::fmt::Write; - - let session_name = self.session.name(); - let num_frames = self.callstack.frames.len(); - - writeln!(f, "\nStack Trace:")?; - - for (i, frame) in self.callstack.frames.iter().enumerate() { - let is_top = i + 1 == num_frames; - let name = frame.procedure(session_name); - let name = name.as_deref().unwrap_or(""); - if is_top { - write!(f, " `-> {name}")?; - } else { - write!(f, " |-> {name}")?; - } - if let Some(resolved) = frame.last_resolved(self.session) { - write!(f, " in {resolved}")?; - } else { - write!(f, " in ")?; - } - if is_top { - // Print op context - let context_size = frame.context.len(); - writeln!(f, ":\n\nLast {context_size} Instructions (of current frame):")?; - for (i, op) in frame.context.iter().enumerate() { - let is_last = i + 1 == context_size; - if let Some(callee) = op.callee(session_name) { - write!(f, " | exec.{callee}")?; - } else { - write!(f, " | {}", &op.opcode())?; - } - if is_last { - writeln!(f, "\n `-> ")?; - } else { - f.write_char('\n')?; - } - } - - let context_size = self.recent.len(); - writeln!(f, "\n\nLast {context_size} Instructions (any frame):")?; - for (i, op) in self.recent.iter().enumerate() { - let is_last = i + 1 == context_size; - if is_last { - writeln!(f, " | {}", &op)?; - writeln!(f, " `-> ")?; - } else { - writeln!(f, " | {}", &op)?; - } - } - } else { - f.write_char('\n')?; - } - } - - Ok(()) - } -} diff --git a/midenc-debug/src/exec/executor.rs b/midenc-debug/src/exec/executor.rs deleted file mode 100644 index 04ac36313..000000000 --- a/midenc-debug/src/exec/executor.rs +++ /dev/null @@ -1,403 +0,0 @@ -use std::{ - cell::RefCell, - collections::{BTreeMap, BTreeSet, VecDeque}, - ops::Deref, - rc::Rc, - sync::Arc, -}; - -use miden_assembly::Library as CompiledLibrary; -use miden_core::{Program, StackInputs, Word}; -use miden_debug_types::SourceManagerExt; -use miden_mast_package::{ - Dependency, DependencyName, DependencyResolver, LocalResolvedDependency, MastArtifact, - MemDependencyResolverByDigest, ResolvedDependency, -}; -use miden_processor::{ - AdviceInputs, AdviceProvider, ContextId, ExecutionError, Felt, MastForest, Process, - ProcessState, RowIndex, StackOutputs, VmState, VmStateIterator, -}; -use midenc_codegen_masm::{NativePtr, Rodata}; -use midenc_hir::Type; -use midenc_session::{ - diagnostics::{IntoDiagnostic, Report}, - LinkLibrary, Session, STDLIB, -}; - -use super::{DebugExecutor, DebuggerHost, ExecutionTrace, TraceEvent}; -use crate::{debug::CallStack, FromMidenRepr, TestFelt}; - -/// The [Executor] is responsible for executing a program with the Miden VM. -/// -/// It is used by either converting it into a [DebugExecutor], and using that to -/// manage execution step-by-step, such as is done by the debugger; or by running -/// the program to completion and obtaining an [ExecutionTrace], which can be used -/// to introspect the final program state. -pub struct Executor { - stack: StackInputs, - advice: AdviceInputs, - libraries: Vec>, - dependency_resolver: MemDependencyResolverByDigest, -} -impl Executor { - /// Construct an executor with the given arguments on the operand stack - pub fn new(args: Vec) -> Self { - let mut resolver = MemDependencyResolverByDigest::default(); - resolver.add(*STDLIB.digest(), STDLIB.clone().into()); - //TODO - //let base_lib = miden_lib::MidenLib::default().as_ref().clone(); - //resolver.add(*base_lib.digest(), Arc::new(base_lib).into()); - Self { - stack: StackInputs::new(args).expect("invalid stack inputs"), - advice: AdviceInputs::default(), - libraries: Default::default(), - dependency_resolver: resolver, - } - } - - /// Construct the executor with the given inputs and adds dependencies from the given package - pub fn for_package( - package: &miden_mast_package::Package, - args: I, - session: &Session, - ) -> Result - where - I: IntoIterator, - { - use midenc_hir::formatter::DisplayHex; - log::debug!( - "creating executor for package '{}' (digest={})", - package.name, - DisplayHex::new(&package.digest().as_bytes()) - ); - let mut exec = Self::new(args.into_iter().collect()); - let dependencies = package.manifest.dependencies(); - exec.with_dependencies(dependencies)?; - log::debug!("executor created"); - Ok(exec) - } - - /// Adds dependencies to the executor - pub fn with_dependencies<'a>( - &mut self, - dependencies: impl Iterator, - ) -> Result<&mut Self, Report> { - use midenc_hir::formatter::DisplayHex; - - for dep in dependencies { - match self.dependency_resolver.resolve(dep) { - Some(resolution) => { - log::debug!("dependency {dep:?} resolved to {resolution:?}"); - log::debug!("loading library from package dependency: {dep:?}"); - match resolution { - ResolvedDependency::Local(LocalResolvedDependency::Library(lib)) => { - let library = lib.as_ref(); - self.with_mast_forest(lib.mast_forest().clone()); - } - ResolvedDependency::Local(LocalResolvedDependency::Package(pkg)) => { - if let MastArtifact::Library(lib) = &pkg.mast { - self.with_mast_forest(lib.mast_forest().clone()); - } else { - Err(Report::msg(format!( - "expected package {} to contain library", - pkg.name - )))?; - } - } - } - } - None => panic!("{dep:?} not found in resolver"), - } - } - - log::debug!("executor created"); - - Ok(self) - } - - /// Set the contents of memory for the shadow stack frame of the entrypoint - pub fn with_advice_inputs(&mut self, advice: AdviceInputs) -> &mut Self { - self.advice.extend(advice); - self - } - - /// Add a [CompiledLibrary] to the execution context - pub fn with_library(&mut self, lib: &CompiledLibrary) -> &mut Self { - self.libraries.push(lib.mast_forest().clone()); - self - } - - /// Add a [MastForest] to the execution context - pub fn with_mast_forest(&mut self, mast: Arc) -> &mut Self { - self.libraries.push(mast); - self - } - - /// Convert this [Executor] into a [DebugExecutor], which captures much more information - /// about the program being executed, and must be stepped manually. - pub fn into_debug(mut self, program: &Program, session: &Session) -> DebugExecutor { - log::debug!("creating debug executor"); - - let advice_provider = AdviceProvider::from(self.advice.clone()); - let mut host = DebuggerHost::new(advice_provider, session.source_manager.clone()); - for lib in core::mem::take(&mut self.libraries) { - host.load_mast_forest(lib); - } - - let trace_events: Rc>> = Rc::new(Default::default()); - let frame_start_events = Rc::clone(&trace_events); - host.register_trace_handler(TraceEvent::FrameStart, move |clk, event| { - frame_start_events.borrow_mut().insert(clk, event); - }); - let frame_end_events = Rc::clone(&trace_events); - host.register_trace_handler(TraceEvent::FrameEnd, move |clk, event| { - frame_end_events.borrow_mut().insert(clk, event); - }); - let assertion_events = Rc::clone(&trace_events); - host.register_assert_failed_tracer(move |clk, event| { - assertion_events.borrow_mut().insert(clk, event); - }); - - let mut process = Process::new_debug(program.kernel().clone(), self.stack, self.advice); - let process_state: ProcessState = (&mut process).into(); - let root_context = process_state.ctx(); - let result = process.execute(program, &mut host); - let stack_outputs = result.as_ref().map(|so| so.clone()).unwrap_or_default(); - let mut iter = VmStateIterator::new(process, result); - let mut callstack = CallStack::new(trace_events); - DebugExecutor { - iter, - stack_outputs, - contexts: Default::default(), - root_context, - current_context: root_context, - callstack, - recent: VecDeque::with_capacity(5), - last: None, - cycle: 0, - stopped: false, - } - } - - /// Execute the given program until termination, producing a trace - pub fn capture_trace(mut self, program: &Program, session: &Session) -> ExecutionTrace { - let mut executor = self.into_debug(program, session); - while let Some(step) = executor.next() { - if step.is_err() { - return executor.into_execution_trace(); - } - } - executor.into_execution_trace() - } - - /// Execute the given program, producing a trace - #[track_caller] - pub fn execute(mut self, program: &Program, session: &Session) -> ExecutionTrace { - let mut executor = self.into_debug(program, session); - while let Some(step) = executor.next() { - if let Err(err) = step { - render_execution_error(err, &executor, session); - } - - if log::log_enabled!(target: "executor", log::Level::Trace) { - let step = step.unwrap(); - if let Some(op) = step.op.as_ref() { - if let Some(asmop) = step.asmop.as_ref() { - dbg!(&step.stack); - let source_loc = asmop.as_ref().location().map(|loc| { - let path = std::path::Path::new(loc.uri().path()); - let file = - session.diagnostics.source_manager_ref().load_file(path).unwrap(); - (file, loc.start) - }); - if let Some((source_file, line_start)) = source_loc { - let line_number = source_file.content().line_index(line_start).number(); - log::trace!(target: "executor", "in {} (located at {}:{})", asmop.context_name(), source_file.deref().uri().as_str(), &line_number); - } else { - log::trace!(target: "executor", "in {} (no source location available)", asmop.context_name()); - } - log::trace!(target: "executor", " executed `{op:?}` of `{}` (cycle {}/{})", asmop.op(), asmop.cycle_idx(), asmop.num_cycles()); - log::trace!(target: "executor", " stack state: {:#?}", &step.stack); - } - } - } - - /* - if let Some(op) = state.op { - match op { - miden_core::Operation::MLoad => { - let load_addr = last_state - .as_ref() - .map(|state| state.stack[0].as_int()) - .unwrap(); - let loaded = match state - .memory - .binary_search_by_key(&load_addr, |&(addr, _)| addr) - { - Ok(index) => state.memory[index].1[0].as_int(), - Err(_) => 0, - }; - //dbg!(load_addr, loaded, format!("{loaded:08x}")); - } - miden_core::Operation::MLoadW => { - let load_addr = last_state - .as_ref() - .map(|state| state.stack[0].as_int()) - .unwrap(); - let loaded = match state - .memory - .binary_search_by_key(&load_addr, |&(addr, _)| addr) - { - Ok(index) => { - let word = state.memory[index].1; - [ - word[0].as_int(), - word[1].as_int(), - word[2].as_int(), - word[3].as_int(), - ] - } - Err(_) => [0; 4], - }; - let loaded_bytes = { - let word = loaded; - let a = (word[0] as u32).to_be_bytes(); - let b = (word[1] as u32).to_be_bytes(); - let c = (word[2] as u32).to_be_bytes(); - let d = (word[3] as u32).to_be_bytes(); - let bytes = [ - a[0], a[1], a[2], a[3], b[0], b[1], b[2], b[3], c[0], c[1], - c[2], c[3], d[0], d[1], d[2], d[3], - ]; - u128::from_be_bytes(bytes) - }; - //dbg!(load_addr, loaded, format!("{loaded_bytes:032x}")); - } - miden_core::Operation::MStore => { - let store_addr = last_state - .as_ref() - .map(|state| state.stack[0].as_int()) - .unwrap(); - let stored = match state - .memory - .binary_search_by_key(&store_addr, |&(addr, _)| addr) - { - Ok(index) => state.memory[index].1[0].as_int(), - Err(_) => 0, - }; - //dbg!(store_addr, stored, format!("{stored:08x}")); - } - miden_core::Operation::MStoreW => { - let store_addr = last_state - .as_ref() - .map(|state| state.stack[0].as_int()) - .unwrap(); - let stored = { - let memory = state - .memory - .iter() - .find_map(|(addr, word)| { - if addr == &store_addr { - Some(word) - } else { - None - } - }) - .unwrap(); - let a = memory[0].as_int(); - let b = memory[1].as_int(); - let c = memory[2].as_int(); - let d = memory[3].as_int(); - [a, b, c, d] - }; - let stored_bytes = { - let word = stored; - let a = (word[0] as u32).to_be_bytes(); - let b = (word[1] as u32).to_be_bytes(); - let c = (word[2] as u32).to_be_bytes(); - let d = (word[3] as u32).to_be_bytes(); - let bytes = [ - a[0], a[1], a[2], a[3], b[0], b[1], b[2], b[3], c[0], c[1], - c[2], c[3], d[0], d[1], d[2], d[3], - ]; - u128::from_be_bytes(bytes) - }; - //dbg!(store_addr, stored, format!("{stored_bytes:032x}")); - } - _ => (), - } - } - */ - } - - executor.into_execution_trace() - } - - /// Execute a program, parsing the operand stack outputs as a value of type `T` - pub fn execute_into(self, program: &Program, session: &Session) -> T - where - T: FromMidenRepr + PartialEq, - { - let out = self.execute(program, session); - out.parse_result().expect("invalid result") - } - - pub fn dependency_resolver_mut(&mut self) -> &mut MemDependencyResolverByDigest { - &mut self.dependency_resolver - } -} - -#[track_caller] -fn render_execution_error( - err: ExecutionError, - execution_state: &DebugExecutor, - session: &Session, -) -> ! { - use midenc_session::diagnostics::{miette::miette, reporting::PrintDiagnostic, LabeledSpan}; - - let stacktrace = execution_state.callstack.stacktrace(&execution_state.recent, session); - - eprintln!("{stacktrace}"); - - if let Some(last_state) = execution_state.last.as_ref() { - let stack = last_state.stack.iter().map(|elem| elem.as_int()); - let stack = midenc_hir::formatter::DisplayValues::new(stack); - let fmp = last_state.fmp.as_int(); - eprintln!( - "\nLast Known State (at most recent instruction which succeeded): - | Frame Pointer: {fmp} (starts at 2^30) - | Operand Stack: [{stack}] - " - ); - - let mut labels = vec![]; - if let Some(span) = stacktrace - .current_frame() - .and_then(|frame| frame.location.as_ref()) - .map(|loc| loc.span) - { - labels.push(LabeledSpan::new_with_span( - None, - span.start().to_usize()..span.end().to_usize(), - )); - } - let report = miette!( - labels = labels, - "program execution failed at step {step} (cycle {cycle}): {err}", - step = execution_state.cycle, - cycle = last_state.clk, - ); - let report = match stacktrace - .current_frame() - .and_then(|frame| frame.location.as_ref()) - .map(|loc| loc.source_file.clone()) - { - Some(source) => report.with_source_code(source), - None => report, - }; - - panic!("{}", PrintDiagnostic::new(report)); - } else { - panic!("program execution failed at step {step}: {err}", step = execution_state.cycle); - } -} diff --git a/midenc-debug/src/exec/host.rs b/midenc-debug/src/exec/host.rs deleted file mode 100644 index 515cea3cc..000000000 --- a/midenc-debug/src/exec/host.rs +++ /dev/null @@ -1,139 +0,0 @@ -use std::{collections::BTreeMap, num::NonZeroU32, sync::Arc}; - -use miden_assembly::SourceManager; -use miden_core::Word; -use miden_debug_types::{Location, SourceFile, SourceSpan}; -use miden_processor::{ - AdviceInputs, AdviceProvider, BaseHost, EventHandlerRegistry, ExecutionError, MastForest, - MastForestStore, MemMastForestStore, ProcessState, RowIndex, SyncHost, -}; - -use super::{TraceEvent, TraceHandler}; - -/// This is an implementation of [BaseHost] which is essentially [miden_processor::DefaultHost], -/// but extended with additional functionality for debugging, in particular it manages trace -/// events that record the entry or exit of a procedure call frame. -#[derive(Default)] -pub struct DebuggerHost { - adv_provider: AdviceProvider, - store: MemMastForestStore, - tracing_callbacks: BTreeMap>>, - event_handlers: EventHandlerRegistry, - on_assert_failed: Option>, - source_manager: Arc, -} -impl DebuggerHost -where - S: SourceManager, -{ - /// Construct a new instance of [DebuggerHost] with the given advice provider. - pub fn new(adv_provider: AdviceProvider, source_manager: S) -> Self { - Self { - adv_provider, - store: Default::default(), - tracing_callbacks: Default::default(), - event_handlers: EventHandlerRegistry::default(), - on_assert_failed: None, - source_manager: Arc::new(source_manager), - } - } - - /// Register a trace handler for `event` - pub fn register_trace_handler(&mut self, event: TraceEvent, callback: F) - where - F: FnMut(RowIndex, TraceEvent) + 'static, - { - let key = match event { - TraceEvent::AssertionFailed(None) => u32::MAX, - ev => ev.into(), - }; - self.tracing_callbacks.entry(key).or_default().push(Box::new(callback)); - } - - /// Register a handler to be called when an assertion in the VM fails - pub fn register_assert_failed_tracer(&mut self, callback: F) - where - F: FnMut(RowIndex, TraceEvent) + 'static, - { - self.on_assert_failed = Some(Box::new(callback)); - } - - /// Load `forest` into the MAST store for this host - pub fn load_mast_forest(&mut self, forest: Arc) { - self.store.insert(forest); - } -} - -impl BaseHost for DebuggerHost -where - S: SourceManager, -{ - fn get_label_and_source_file( - &self, - location: &Location, - ) -> (SourceSpan, Option>) { - let maybe_file = self.source_manager.get_by_uri(location.uri()); - let span = self.source_manager.location_to_span(location.clone()).unwrap_or_default(); - (span, maybe_file) - } - - fn on_trace( - &mut self, - process: &mut ProcessState, - trace_id: u32, - ) -> Result<(), ExecutionError> { - let event = TraceEvent::from(trace_id); - let clk = process.clk(); - if let Some(handlers) = self.tracing_callbacks.get_mut(&trace_id) { - for handler in handlers.iter_mut() { - handler(clk, event); - } - } - Ok(()) - } - - fn on_assert_failed(&mut self, process: &ProcessState, err_code: miden_core::Felt) { - let clk = process.clk(); - if let Some(handler) = self.on_assert_failed.as_mut() { - // TODO: We're truncating the error code here, but we may need to handle the full range - handler(clk, TraceEvent::AssertionFailed(NonZeroU32::new(err_code.as_int() as u32))); - } - } -} - -impl SyncHost for DebuggerHost -where - S: SourceManager, -{ - fn on_event( - &mut self, - process: &ProcessState, - ) -> Result, miden_processor::EventError> { - Ok(Vec::new()) - } - - fn get_mast_forest(&self, node_digest: &Word) -> Option> { - self.store.get(node_digest) - } -} - -impl miden_processor::AsyncHost for DebuggerHost -where - S: SourceManager, -{ - fn get_mast_forest( - &self, - node_digest: &Word, - ) -> impl miden_processor::FutureMaybeSend>> { - core::future::ready(self.store.get(node_digest)) - } - - fn on_event( - &mut self, - process: &ProcessState<'_>, - ) -> impl miden_processor::FutureMaybeSend< - Result, miden_processor::EventError>, - > { - core::future::ready(Ok(Vec::new())) - } -} diff --git a/midenc-debug/src/exec/mod.rs b/midenc-debug/src/exec/mod.rs deleted file mode 100644 index 0b0aa9829..000000000 --- a/midenc-debug/src/exec/mod.rs +++ /dev/null @@ -1,11 +0,0 @@ -mod executor; -mod host; -mod state; -mod trace; - -pub use self::{ - executor::Executor, - host::DebuggerHost, - state::{DebugExecutor, MemoryChiplet}, - trace::{ExecutionTrace, TraceEvent, TraceHandler}, -}; diff --git a/midenc-debug/src/exec/state.rs b/midenc-debug/src/exec/state.rs deleted file mode 100644 index bcb36f601..000000000 --- a/midenc-debug/src/exec/state.rs +++ /dev/null @@ -1,158 +0,0 @@ -use std::{ - collections::{BTreeSet, VecDeque}, - rc::Rc, -}; - -use miden_core::Word; -use miden_processor::{ - ContextId, ExecutionError, MemoryAddress, MemoryError, Operation, RowIndex, StackOutputs, - VmState, VmStateIterator, -}; - -use super::ExecutionTrace; -use crate::{CallFrame, CallStack, TestFelt}; - -/// A special version of [crate::Executor] which provides finer-grained control over execution, -/// and captures a ton of information about the program being executed, so as to make it possible -/// to introspect everything about the program and the state of the VM at a given cycle. -/// -/// This is used by the debugger to execute programs, and provide all of the functionality made -/// available by the TUI. -pub struct DebugExecutor { - /// The underlying [VmStateIterator] being driven - pub iter: VmStateIterator, - /// The final outcome of the program being executed - pub stack_outputs: StackOutputs, - /// The set of contexts allocated during execution so far - pub contexts: BTreeSet, - /// The root context - pub root_context: ContextId, - /// The current context at `cycle` - pub current_context: ContextId, - /// The current call stack - pub callstack: CallStack, - /// A sliding window of the last 5 operations successfully executed by the VM - pub recent: VecDeque, - /// The most recent [VmState] produced by the [VmStateIterator] - pub last: Option, - /// The current clock cycle - pub cycle: usize, - /// Whether or not execution has terminated - pub stopped: bool, -} - -impl DebugExecutor { - /// Advance the program state by one cycle. - /// - /// If the program has already reached its termination state, it returns the same result - /// as the previous time it was called. - /// - /// Returns the call frame exited this cycle, if any - pub fn step(&mut self) -> Result, ExecutionError> { - if self.stopped { - return Ok(None); - } - match self.iter.next() { - Some(Ok(state)) => { - self.cycle += 1; - if self.current_context != state.ctx { - self.contexts.insert(state.ctx); - self.current_context = state.ctx; - } - - if let Some(op) = state.op { - if self.recent.len() == 5 { - self.recent.pop_front(); - } - self.recent.push_back(op); - } - - let exited = self.callstack.next(&state); - - self.last = Some(state); - - Ok(exited) - } - Some(Err(err)) => { - self.stopped = true; - Err(err) - } - None => { - self.stopped = true; - Ok(None) - } - } - } - - /// Consume the [DebugExecutor], converting it into an [ExecutionTrace] at the current cycle. - pub fn into_execution_trace(self) -> ExecutionTrace { - let last_cycle = self.cycle; - let trace_len_summary = *self.iter.trace_len_summary(); - let (_, _, _, chiplets, _) = self.iter.into_parts(); - let chiplets = Rc::new(chiplets); - - let chiplets0 = chiplets.clone(); - let get_state_at = move |context, clk| chiplets0.memory.get_state_at(context, clk); - let chiplets1 = chiplets.clone(); - let get_word = move |context, addr| chiplets1.memory.get_word(context, addr); - let get_value = move |context, addr| chiplets.memory.get_value(context, addr); - - let memory = MemoryChiplet { - get_value: Box::new(get_value), - get_word: Box::new(get_word), - get_state_at: Box::new(get_state_at), - }; - - ExecutionTrace { - root_context: self.root_context, - last_cycle: RowIndex::from(last_cycle), - memory, - outputs: self.stack_outputs, - trace_len_summary, - } - } -} -impl core::iter::FusedIterator for DebugExecutor {} -impl Iterator for DebugExecutor { - type Item = Result; - - #[inline] - fn next(&mut self) -> Option { - if self.stopped { - return None; - } - match self.step() { - Ok(_) => self.last.clone().map(Ok), - Err(err) => Some(Err(err)), - } - } -} - -// Dirty, gross, horrible hack until miden_processor::chiplets::Chiplets is exported -pub struct MemoryChiplet { - get_value: Box Option>, - get_word: Box Result, MemoryError>>, - #[allow(clippy::type_complexity)] - get_state_at: Box Vec<(MemoryAddress, miden_core::Felt)>>, -} - -impl MemoryChiplet { - #[inline] - pub fn get_value(&self, context: ContextId, addr: u32) -> Option { - (self.get_value)(context, addr) - } - - #[inline] - pub fn get_word(&self, context: ContextId, addr: u32) -> Result, MemoryError> { - (self.get_word)(context, addr) - } - - #[inline] - pub fn get_mem_state_at( - &self, - context: ContextId, - clk: RowIndex, - ) -> Vec<(MemoryAddress, miden_core::Felt)> { - (self.get_state_at)(context, clk) - } -} diff --git a/midenc-debug/src/exec/trace.rs b/midenc-debug/src/exec/trace.rs deleted file mode 100644 index f385e3d30..000000000 --- a/midenc-debug/src/exec/trace.rs +++ /dev/null @@ -1,220 +0,0 @@ -use std::{ - cell::RefCell, - collections::{BTreeMap, BTreeSet, VecDeque}, - rc::Rc, -}; - -use miden_assembly::Library as CompiledLibrary; -use miden_core::{FieldElement, Program, StackInputs, Word}; -use miden_processor::{ - AdviceInputs, ContextId, ExecutionError, Felt, MastForest, Process, ProcessState, RowIndex, - StackOutputs, TraceLenSummary, VmState, VmStateIterator, -}; -use midenc_codegen_masm::NativePtr; -pub use midenc_codegen_masm::TraceEvent; -use midenc_hir::{SmallVec, ToSmallVec, Type}; -use midenc_session::Session; - -use super::MemoryChiplet; -use crate::{debug::CallStack, DebuggerHost, FromMidenRepr, TestFelt}; - -/// A callback to be executed when a [TraceEvent] occurs at a given clock cycle -pub type TraceHandler = dyn FnMut(RowIndex, TraceEvent); - -/// Occurs when an attempt to read memory of the VM fails -#[derive(Debug, thiserror::Error)] -pub enum MemoryReadError { - #[error("attempted to read beyond end of linear memory")] - OutOfBounds, - #[error("unaligned reads are not supported yet")] - UnalignedRead, -} - -/// An [ExecutionTrace] represents a final state of a program that was executed. -/// -/// It can be used to examine the program results, and the memory of the program at -/// any cycle up to the last cycle. It is typically used for those purposes once -/// execution of a program terminates. -pub struct ExecutionTrace { - pub(super) root_context: ContextId, - pub(super) last_cycle: RowIndex, - pub(super) memory: MemoryChiplet, - pub(super) outputs: StackOutputs, - pub(super) trace_len_summary: TraceLenSummary, -} - -impl ExecutionTrace { - /// Parse the program outputs on the operand stack as a value of type `T` - pub fn parse_result(&self) -> Option - where - T: FromMidenRepr, - { - let size = ::size_in_felts(); - let stack = self.outputs.stack_truncated(size); - if stack.len() < size { - return None; - } - dbg!(stack); - let mut stack = stack.to_vec(); - stack.reverse(); - dbg!(&stack); - Some(::pop_from_stack(&mut stack)) - } - - /// Consume the [ExecutionTrace], extracting just the outputs on the operand stack - #[inline] - pub fn into_outputs(self) -> StackOutputs { - self.outputs - } - - /// Return a reference to the operand stack outputs - #[inline] - pub fn outputs(&self) -> &StackOutputs { - &self.outputs - } - - /// Return a reference to the trace length summary - #[inline] - pub fn trace_len_summary(&self) -> &TraceLenSummary { - &self.trace_len_summary - } - - /// Read the word at the given Miden memory address - pub fn read_memory_word(&self, addr: u32) -> Option { - self.read_memory_word_in_context(addr, self.root_context, self.last_cycle) - } - - /// Read the word at the given Miden memory address, under `ctx`, at cycle `clk` - pub fn read_memory_word_in_context( - &self, - addr: u32, - ctx: ContextId, - clk: RowIndex, - ) -> Option { - use miden_core::FieldElement; - - const ZERO: Word = Word::new([Felt::ZERO; 4]); - - Some( - self.memory - .get_word(ctx, addr) - .unwrap_or_else(|err| panic!("{err}")) - .unwrap_or(ZERO), - ) - } - - /// Read the word at the given Miden memory address and element offset - #[track_caller] - pub fn read_memory_element(&self, addr: u32) -> Option { - self.memory.get_value(self.root_context, addr) - } - - /// Read the word at the given Miden memory address and element offset, under `ctx`, at cycle - /// `clk` - #[track_caller] - pub fn read_memory_element_in_context( - &self, - addr: u32, - ctx: ContextId, - _clk: RowIndex, - ) -> Option { - self.memory.get_value(ctx, addr) - } - - /// Read a raw byte vector from `addr`, under `ctx`, at cycle `clk`, sufficient to hold a value - /// of type `ty` - pub fn read_bytes_for_type( - &self, - addr: NativePtr, - ty: &Type, - ctx: ContextId, - clk: RowIndex, - ) -> Result, MemoryReadError> { - const U32_MASK: u64 = u32::MAX as u64; - let size = ty.size_in_bytes(); - let mut buf = Vec::with_capacity(size); - - let size_in_felts = ty.size_in_felts(); - let mut elems = Vec::with_capacity(size_in_felts); - - if addr.is_element_aligned() { - for i in 0..size_in_felts { - let addr = addr.addr.checked_add(i as u32).ok_or(MemoryReadError::OutOfBounds)?; - elems.push(self.read_memory_element_in_context(addr, ctx, clk).unwrap_or_default()); - } - } else { - return Err(MemoryReadError::UnalignedRead); - } - - let mut needed = size - buf.len(); - for elem in elems { - let bytes = ((elem.as_int() & U32_MASK) as u32).to_be_bytes(); - let take = core::cmp::min(needed, 4); - buf.extend(&bytes[0..take]); - needed -= take; - } - - Ok(buf) - } - - /// Read a value of the given type, given an address in Rust's address space - #[track_caller] - pub fn read_from_rust_memory(&self, addr: u32) -> Option - where - T: core::any::Any + FromMidenRepr, - { - self.read_from_rust_memory_in_context(addr, self.root_context, self.last_cycle) - } - - /// Read a value of the given type, given an address in Rust's address space, under `ctx`, at - /// cycle `clk` - #[track_caller] - pub fn read_from_rust_memory_in_context( - &self, - addr: u32, - ctx: ContextId, - clk: RowIndex, - ) -> Option - where - T: core::any::Any + FromMidenRepr, - { - use core::any::TypeId; - - let ptr = NativePtr::from_ptr(addr); - if TypeId::of::() == TypeId::of::() { - assert_eq!(ptr.offset, 0, "cannot read values of type Felt from unaligned addresses"); - } - assert_eq!(ptr.offset, 0, "support for unaligned reads is not yet implemented"); - match ::size_in_felts() { - 1 => { - let felt = self.read_memory_element_in_context(ptr.addr, ctx, clk)?; - Some(T::from_felts(&[felt])) - } - 2 => { - let lo = self.read_memory_element_in_context(ptr.addr, ctx, clk)?; - let hi = self.read_memory_element_in_context(ptr.addr + 1, ctx, clk)?; - Some(T::from_felts(&[lo, hi])) - } - 3 => { - let lo_l = self.read_memory_element_in_context(ptr.addr, ctx, clk)?; - let lo_h = self.read_memory_element_in_context(ptr.addr + 1, ctx, clk)?; - let hi_l = self.read_memory_element_in_context(ptr.addr + 2, ctx, clk)?; - Some(T::from_felts(&[lo_l, lo_h, hi_l])) - } - n => { - assert_ne!(n, 0); - let num_words = n.next_multiple_of(4) / 4; - let mut words = SmallVec::<[_; 2]>::with_capacity(num_words); - for word_index in 0..(num_words as u32) { - let addr = ptr.addr + (word_index * 4); - let mut word = self.read_memory_word(addr)?; - word.reverse(); - dbg!(word_index, word); - words.push(word); - } - words.resize(num_words, Word::new([Felt::ZERO; 4])); - Some(T::from_words(&words)) - } - } - } -} diff --git a/midenc-debug/src/felt.rs b/midenc-debug/src/felt.rs deleted file mode 100644 index 497dc94da..000000000 --- a/midenc-debug/src/felt.rs +++ /dev/null @@ -1,1072 +0,0 @@ -use std::collections::VecDeque; - -use miden_core::{FieldElement, StarkField, Word}; -use miden_processor::Felt as RawFelt; -use midenc_hir::{smallvec, SmallVec}; -use proptest::{ - arbitrary::Arbitrary, - strategy::{BoxedStrategy, Strategy}, -}; -use serde::Deserialize; - -pub trait ToMidenRepr { - /// Convert this type into its raw byte representation - /// - /// The order of bytes in the resulting vector should be little-endian, i.e. the least - /// significant bytes come first. - fn to_bytes(&self) -> SmallVec<[u8; 16]>; - /// Convert this type into one or more field elements, where the order of the elements is such - /// that the byte representation of `self` is in little-endian order, i.e. the least significant - /// bytes come first. - fn to_felts(&self) -> SmallVec<[RawFelt; 4]> { - let bytes = self.to_bytes(); - let num_felts = bytes.len().next_multiple_of(4) / 4; - let mut felts = SmallVec::<[RawFelt; 4]>::with_capacity(num_felts); - let mut chunks = bytes.into_iter().array_chunks::<4>(); - for chunk in chunks.by_ref() { - felts.push(RawFelt::new(u32::from_ne_bytes(chunk) as u64)); - } - if let Some(remainder) = chunks.into_remainder().filter(|r| r.len() > 0) { - if remainder.len() > 0 { - let mut chunk = [0u8; 4]; - for (i, byte) in remainder.enumerate() { - chunk[i] = byte; - } - felts.push(RawFelt::new(u32::from_ne_bytes(chunk) as u64)); - } - } - felts - } - /// Convert this type into one or more words, zero-padding as needed, such that: - /// - /// * The field elements within each word is in little-endian order, i.e. the least significant - /// bytes of come first. - /// * Each word, if pushed on the operand stack element-by-element, would leave the element - /// with the most significant bytes on top of the stack (including padding) - fn to_words(&self) -> SmallVec<[Word; 1]> { - let felts = self.to_felts(); - let num_words = felts.len().next_multiple_of(4) / 4; - let mut words = SmallVec::<[Word; 1]>::with_capacity(num_words); - let mut chunks = felts.into_iter().array_chunks::<4>(); - for mut word in chunks.by_ref() { - word.reverse(); - words.push(Word::new(word)); - } - if let Some(remainder) = chunks.into_remainder().filter(|r| r.len() > 0) { - if remainder.len() > 0 { - let mut word = [RawFelt::ZERO; 4]; - for (i, felt) in remainder.enumerate() { - word[i] = felt; - } - word.reverse(); - words.push(Word::new(word)); - } - } - words - } - - /// Push this value on the given operand stack using [Self::to_felts] representation - fn push_to_operand_stack(&self, stack: &mut Vec) { - let felts = self.to_felts(); - for felt in felts.into_iter().rev() { - stack.push(felt); - } - } - - /// Push this value in its [Self::to_words] representation, on the given stack. - /// - /// This function is designed for encoding values that will be placed on the advice stack and - /// copied into Miden VM memory by the compiler-emitted test harness. - /// - /// Returns the number of words that were pushed on the stack - fn push_words_to_advice_stack(&self, stack: &mut Vec) -> usize { - let words = self.to_words(); - let num_words = words.len(); - for word in words.into_iter().rev() { - for felt in word.into_iter() { - stack.push(felt); - } - } - num_words - } -} - -pub trait FromMidenRepr: Sized { - /// Returns the size of this type as encoded by [ToMidenRepr::to_felts] - fn size_in_felts() -> usize; - /// Extract a value of this type from `bytes`, where: - /// - /// * It is assumed that bytes is always padded out to 4 byte alignment - /// * It is assumed that the bytes are in little-endian order, as encoded by [ToMidenRepr] - fn from_bytes(bytes: &[u8]) -> Self; - /// Extract a value of this type as encoded in a vector of field elements, where: - /// - /// * The order of the field elements is little-endian, i.e. the element holding the least - /// significant bytes comes first. - fn from_felts(felts: &[RawFelt]) -> Self { - let mut bytes = SmallVec::<[u8; 16]>::with_capacity(felts.len() * 4); - for felt in felts { - let chunk = (felt.as_int() as u32).to_ne_bytes(); - bytes.extend(chunk); - } - Self::from_bytes(&bytes) - } - /// Extract a value of this type as encoded in a vector of words, where: - /// - /// * The order of the words is little-endian, i.e. the word holding the least significant - /// bytes comes first. - /// * The order of the field elements in each word is in big-endian order, i.e. the element - /// with the most significant byte is at the start of the word, and the element with the - /// least significant byte is at the end of the word. This corresponds to the order in - /// which elements are placed on the operand stack when preparing to read or write them - /// from Miden's memory. - fn from_words(words: &[Word]) -> Self { - let mut felts = SmallVec::<[RawFelt; 4]>::with_capacity(words.len() * 4); - for word in words { - for felt in word.iter().copied().rev() { - felts.push(felt); - } - } - Self::from_felts(&felts) - } - - /// Pop a value of this type from `stack` based on the canonical representation of this type - /// on the operand stack when writing it to memory (and as read from memory). - fn pop_from_stack(stack: &mut Vec) -> Self { - let needed = Self::size_in_felts(); - let mut felts = SmallVec::<[RawFelt; 4]>::with_capacity(needed); - for _ in 0..needed { - felts.push(stack.pop().unwrap()); - } - Self::from_felts(&felts) - } -} - -impl ToMidenRepr for bool { - fn to_bytes(&self) -> SmallVec<[u8; 16]> { - smallvec![*self as u8] - } - - fn to_felts(&self) -> SmallVec<[RawFelt; 4]> { - smallvec![RawFelt::new(*self as u64)] - } - - fn push_to_operand_stack(&self, stack: &mut Vec) { - stack.push(RawFelt::new(*self as u64)); - } -} - -impl FromMidenRepr for bool { - #[inline(always)] - fn size_in_felts() -> usize { - 1 - } - - fn from_bytes(bytes: &[u8]) -> Self { - match bytes[0] { - 0 => false, - 1 => true, - n => panic!("invalid byte representation for boolean: {n:0x}"), - } - } - - fn from_felts(felts: &[RawFelt]) -> Self { - match felts[0].as_int() { - 0 => false, - 1 => true, - n => panic!("invalid byte representation for boolean: {n:0x}"), - } - } - - fn pop_from_stack(stack: &mut Vec) -> Self { - match stack.pop().unwrap().as_int() { - 0 => false, - 1 => true, - n => panic!("invalid byte representation for boolean: {n:0x}"), - } - } -} - -impl ToMidenRepr for u8 { - fn to_bytes(&self) -> SmallVec<[u8; 16]> { - smallvec![*self] - } - - fn to_felts(&self) -> SmallVec<[RawFelt; 4]> { - smallvec![RawFelt::new(*self as u64)] - } - - fn push_to_operand_stack(&self, stack: &mut Vec) { - stack.push(RawFelt::new(*self as u64)); - } -} - -impl FromMidenRepr for u8 { - #[inline(always)] - fn size_in_felts() -> usize { - 1 - } - - #[inline(always)] - fn from_bytes(bytes: &[u8]) -> Self { - bytes[0] - } - - fn from_felts(felts: &[RawFelt]) -> Self { - felts[0].as_int() as u8 - } - - fn pop_from_stack(stack: &mut Vec) -> Self { - stack.pop().unwrap().as_int() as u8 - } -} - -impl ToMidenRepr for i8 { - fn to_bytes(&self) -> SmallVec<[u8; 16]> { - smallvec![*self as u8] - } - - fn to_felts(&self) -> SmallVec<[RawFelt; 4]> { - smallvec![RawFelt::new(*self as u8 as u64)] - } - - fn push_to_operand_stack(&self, stack: &mut Vec) { - stack.push(RawFelt::new(*self as u8 as u64)); - } -} - -impl FromMidenRepr for i8 { - #[inline(always)] - fn size_in_felts() -> usize { - 1 - } - - #[inline(always)] - fn from_bytes(bytes: &[u8]) -> Self { - bytes[0] as i8 - } - - fn from_felts(felts: &[RawFelt]) -> Self { - felts[0].as_int() as u8 as i8 - } - - fn pop_from_stack(stack: &mut Vec) -> Self { - stack.pop().unwrap().as_int() as u8 as i8 - } -} - -impl ToMidenRepr for u16 { - fn to_bytes(&self) -> SmallVec<[u8; 16]> { - SmallVec::from_slice(&self.to_ne_bytes()) - } - - fn to_felts(&self) -> SmallVec<[RawFelt; 4]> { - smallvec![RawFelt::new(*self as u64)] - } - - fn push_to_operand_stack(&self, stack: &mut Vec) { - stack.push(RawFelt::new(*self as u64)); - } -} - -impl FromMidenRepr for u16 { - #[inline(always)] - fn size_in_felts() -> usize { - 1 - } - - fn from_bytes(bytes: &[u8]) -> Self { - assert!(bytes.len() >= 2); - u16::from_ne_bytes([bytes[0], bytes[1]]) - } - - fn from_felts(felts: &[RawFelt]) -> Self { - felts[0].as_int() as u16 - } - - fn pop_from_stack(stack: &mut Vec) -> Self { - stack.pop().unwrap().as_int() as u16 - } -} - -impl ToMidenRepr for i16 { - fn to_bytes(&self) -> SmallVec<[u8; 16]> { - SmallVec::from_slice(&self.to_ne_bytes()) - } - - fn to_felts(&self) -> SmallVec<[RawFelt; 4]> { - smallvec![RawFelt::new(*self as u16 as u64)] - } - - fn push_to_operand_stack(&self, stack: &mut Vec) { - stack.push(RawFelt::new(*self as u16 as u64)); - } -} - -impl FromMidenRepr for i16 { - #[inline(always)] - fn size_in_felts() -> usize { - 1 - } - - fn from_bytes(bytes: &[u8]) -> Self { - assert!(bytes.len() >= 2); - i16::from_ne_bytes([bytes[0], bytes[1]]) - } - - fn from_felts(felts: &[RawFelt]) -> Self { - felts[0].as_int() as u16 as i16 - } - - fn pop_from_stack(stack: &mut Vec) -> Self { - stack.pop().unwrap().as_int() as u16 as i16 - } -} - -impl ToMidenRepr for u32 { - fn to_bytes(&self) -> SmallVec<[u8; 16]> { - SmallVec::from_slice(&self.to_ne_bytes()) - } - - fn to_felts(&self) -> SmallVec<[RawFelt; 4]> { - smallvec![RawFelt::new(*self as u64)] - } - - fn push_to_operand_stack(&self, stack: &mut Vec) { - stack.push(RawFelt::new(*self as u64)); - } -} - -impl FromMidenRepr for u32 { - #[inline(always)] - fn size_in_felts() -> usize { - 1 - } - - fn from_bytes(bytes: &[u8]) -> Self { - assert!(bytes.len() >= 4); - u32::from_ne_bytes([bytes[0], bytes[1], bytes[2], bytes[3]]) - } - - fn from_felts(felts: &[RawFelt]) -> Self { - felts[0].as_int() as u32 - } - - fn pop_from_stack(stack: &mut Vec) -> Self { - stack.pop().unwrap().as_int() as u32 - } -} - -impl ToMidenRepr for i32 { - fn to_bytes(&self) -> SmallVec<[u8; 16]> { - SmallVec::from_slice(&self.to_ne_bytes()) - } - - fn to_felts(&self) -> SmallVec<[RawFelt; 4]> { - smallvec![RawFelt::new(*self as u32 as u64)] - } - - fn push_to_operand_stack(&self, stack: &mut Vec) { - stack.push(RawFelt::new(*self as u32 as u64)); - } -} - -impl FromMidenRepr for i32 { - #[inline(always)] - fn size_in_felts() -> usize { - 1 - } - - fn from_bytes(bytes: &[u8]) -> Self { - assert!(bytes.len() >= 4); - i32::from_ne_bytes([bytes[0], bytes[1], bytes[2], bytes[3]]) - } - - fn from_felts(felts: &[RawFelt]) -> Self { - felts[0].as_int() as u32 as i32 - } - - fn pop_from_stack(stack: &mut Vec) -> Self { - stack.pop().unwrap().as_int() as u32 as i32 - } -} - -impl ToMidenRepr for u64 { - fn to_bytes(&self) -> SmallVec<[u8; 16]> { - SmallVec::from_slice(&self.to_be_bytes()) - } - - fn to_felts(&self) -> SmallVec<[RawFelt; 4]> { - let bytes = self.to_be_bytes(); - let hi = u32::from_be_bytes([bytes[0], bytes[1], bytes[2], bytes[3]]); - let lo = u32::from_be_bytes([bytes[4], bytes[5], bytes[6], bytes[7]]); - smallvec![RawFelt::new(hi as u64), RawFelt::new(lo as u64)] - } -} - -impl FromMidenRepr for u64 { - #[inline(always)] - fn size_in_felts() -> usize { - 2 - } - - fn from_bytes(bytes: &[u8]) -> Self { - assert!(bytes.len() >= 8); - u64::from_be_bytes([ - bytes[0], bytes[1], bytes[2], bytes[3], bytes[4], bytes[5], bytes[6], bytes[7], - ]) - } - - fn from_felts(felts: &[RawFelt]) -> Self { - assert!(felts.len() >= 2); - let hi = (felts[0].as_int() as u32).to_be_bytes(); - let lo = (felts[1].as_int() as u32).to_be_bytes(); - u64::from_be_bytes([hi[0], hi[1], hi[2], hi[3], lo[0], lo[1], lo[2], lo[3]]) - } -} - -impl ToMidenRepr for i64 { - fn to_bytes(&self) -> SmallVec<[u8; 16]> { - SmallVec::from_slice(&self.to_be_bytes()) - } - - fn to_felts(&self) -> SmallVec<[RawFelt; 4]> { - (*self as u64).to_felts() - } -} - -impl FromMidenRepr for i64 { - #[inline(always)] - fn size_in_felts() -> usize { - 2 - } - - fn from_bytes(bytes: &[u8]) -> Self { - u64::from_bytes(bytes) as i64 - } - - fn from_felts(felts: &[RawFelt]) -> Self { - u64::from_felts(felts) as i64 - } -} - -impl ToMidenRepr for u128 { - fn to_bytes(&self) -> SmallVec<[u8; 16]> { - SmallVec::from_slice(&self.to_be_bytes()) - } - - fn to_felts(&self) -> SmallVec<[RawFelt; 4]> { - let bytes = self.to_be_bytes(); - let hi_h = - RawFelt::new(u32::from_be_bytes([bytes[0], bytes[1], bytes[2], bytes[3]]) as u64); - let hi_l = - RawFelt::new(u32::from_be_bytes([bytes[4], bytes[5], bytes[6], bytes[7]]) as u64); - let lo_h = - RawFelt::new(u32::from_be_bytes([bytes[8], bytes[9], bytes[10], bytes[11]]) as u64); - let lo_l = - RawFelt::new(u32::from_be_bytes([bytes[12], bytes[13], bytes[14], bytes[15]]) as u64); - - // The 64-bit limbs are little endian, (lo, hi), but the 32-bit limbs of those 64-bit - // values are big endian, (lo_h, lo_l) and (hi_h, hi_l). - smallvec![lo_h, lo_l, hi_h, hi_l] - } -} - -impl FromMidenRepr for u128 { - #[inline(always)] - fn size_in_felts() -> usize { - 4 - } - - fn from_bytes(bytes: &[u8]) -> Self { - assert!(bytes.len() >= 16); - u128::from_be_bytes([ - bytes[0], bytes[1], bytes[2], bytes[3], bytes[4], bytes[5], bytes[6], bytes[7], - bytes[8], bytes[9], bytes[10], bytes[11], bytes[12], bytes[13], bytes[14], bytes[15], - ]) - } - - fn from_felts(felts: &[RawFelt]) -> Self { - assert!(felts.len() >= 4); - let hi_h = (felts[0].as_int() as u32).to_be_bytes(); - let hi_l = (felts[1].as_int() as u32).to_be_bytes(); - let lo_h = (felts[2].as_int() as u32).to_be_bytes(); - let lo_l = (felts[3].as_int() as u32).to_be_bytes(); - u128::from_be_bytes([ - hi_h[0], hi_h[1], hi_h[2], hi_h[3], hi_l[0], hi_l[1], hi_l[2], hi_l[3], lo_h[0], - lo_h[1], lo_h[2], lo_h[3], lo_l[0], lo_l[1], lo_l[2], lo_l[3], - ]) - } -} - -impl ToMidenRepr for i128 { - fn to_bytes(&self) -> SmallVec<[u8; 16]> { - SmallVec::from_slice(&self.to_be_bytes()) - } - - fn to_felts(&self) -> SmallVec<[RawFelt; 4]> { - (*self as u128).to_felts() - } -} - -impl FromMidenRepr for i128 { - #[inline(always)] - fn size_in_felts() -> usize { - 4 - } - - fn from_bytes(bytes: &[u8]) -> Self { - u128::from_bytes(bytes) as i128 - } - - fn from_felts(felts: &[RawFelt]) -> Self { - u128::from_felts(felts) as i128 - } -} - -impl ToMidenRepr for RawFelt { - fn to_bytes(&self) -> SmallVec<[u8; 16]> { - panic!("field elements have no canonical byte representation") - } - - fn to_felts(&self) -> SmallVec<[RawFelt; 4]> { - smallvec![*self] - } - - fn to_words(&self) -> SmallVec<[Word; 1]> { - let mut word = [RawFelt::ZERO; 4]; - word[0] = *self; - smallvec![Word::new(word)] - } -} - -impl FromMidenRepr for RawFelt { - #[inline(always)] - fn size_in_felts() -> usize { - 1 - } - - fn from_bytes(bytes: &[u8]) -> Self { - panic!("field elements have no canonical byte representation") - } - - #[inline(always)] - fn from_felts(felts: &[RawFelt]) -> Self { - felts[0] - } - - #[inline(always)] - fn from_words(words: &[Word]) -> Self { - words[0][0] - } -} - -impl ToMidenRepr for Felt { - fn to_bytes(&self) -> SmallVec<[u8; 16]> { - panic!("field elements have no canonical byte representation") - } - - fn to_felts(&self) -> SmallVec<[RawFelt; 4]> { - smallvec![self.0] - } - - fn to_words(&self) -> SmallVec<[Word; 1]> { - let mut word = [RawFelt::ZERO; 4]; - word[0] = self.0; - smallvec![Word::new(word)] - } -} - -impl FromMidenRepr for Felt { - #[inline(always)] - fn size_in_felts() -> usize { - 1 - } - - fn from_bytes(bytes: &[u8]) -> Self { - panic!("field elements have no canonical byte representation") - } - - #[inline(always)] - fn from_felts(felts: &[RawFelt]) -> Self { - Felt(felts[0]) - } - - #[inline(always)] - fn from_words(words: &[Word]) -> Self { - Felt(words[0][0]) - } -} - -impl ToMidenRepr for [u8; N] { - #[inline] - fn to_bytes(&self) -> SmallVec<[u8; 16]> { - SmallVec::from_slice(self) - } -} - -impl FromMidenRepr for [u8; N] { - #[inline(always)] - fn size_in_felts() -> usize { - N.next_multiple_of(4) / 4 - } - - fn from_bytes(bytes: &[u8]) -> Self { - assert!(bytes.len() >= N, "insufficient bytes"); - Self::try_from(&bytes[..N]).unwrap() - } -} - -impl FromMidenRepr for [Felt; 4] { - #[inline(always)] - fn size_in_felts() -> usize { - 4 - } - - fn from_bytes(bytes: &[u8]) -> Self { - panic!("field elements have no canonical byte representation") - } - - #[inline(always)] - fn from_felts(felts: &[RawFelt]) -> Self { - [Felt(felts[0]), Felt(felts[1]), Felt(felts[2]), Felt(felts[3])] - } -} - -/// Convert a byte array to an equivalent vector of words -/// -/// Given a byte slice laid out like so: -/// -/// [b0, b1, b2, b3, b4, b5, b6, b7, .., b31] -/// -/// This will produce a vector of words laid out like so: -/// -/// [[{b12, ..b15}, {b8..b11}, {b4, ..b7}, {b0, ..b3}], [{b31, ..}, ..]] -/// -/// In short, it produces words that when placed on the stack and written to memory word-by-word, -/// the original bytes will be laid out in Miden's memory in the correct order. -pub fn bytes_to_words(bytes: &[u8]) -> Vec<[RawFelt; 4]> { - // 1. Chunk bytes up into felts - let mut iter = bytes.iter().array_chunks::<4>(); - let padded_bytes = bytes.len().next_multiple_of(16); - let num_felts = padded_bytes / 4; - let mut buf = Vec::with_capacity(num_felts); - for chunk in iter.by_ref() { - let n = u32::from_ne_bytes([*chunk[0], *chunk[1], *chunk[2], *chunk[3]]); - buf.push(n); - } - // Zero-pad the buffer to nearest whole element - if let Some(rest) = iter.into_remainder().filter(|r| r.len() > 0) { - if rest.len() > 0 { - let mut n_buf = [0u8; 4]; - for (i, byte) in rest.into_iter().enumerate() { - n_buf[i] = *byte; - } - buf.push(u32::from_ne_bytes(n_buf)); - } - } - // Zero-pad the buffer to nearest whole word - buf.resize(num_felts, 0); - // Chunk into words, and push them in largest-address first order - let num_words = num_felts / 4; - let mut words = Vec::with_capacity(num_words); - let mut iter = buf.into_iter().map(|elem| RawFelt::new(elem as u64)).array_chunks::<4>(); - for mut word in iter.by_ref() { - word.reverse(); - words.push(word); - } - if let Some(extra) = iter.into_remainder().filter(|r| r.len() > 0) { - if extra.len() > 0 { - let mut word = [RawFelt::ZERO; 4]; - for (i, felt) in extra.enumerate() { - word[i] = felt; - } - word.reverse(); - words.push(word); - } - } - words -} - -/// Wrapper around `miden_processor::Felt` that implements useful traits that are not implemented -/// for that type. -#[derive(Debug, Copy, Clone, PartialEq, Eq)] -pub struct Felt(pub RawFelt); -impl Felt { - #[inline] - pub fn new(value: u64) -> Self { - Self(RawFelt::new(value)) - } -} - -impl<'de> Deserialize<'de> for Felt { - fn deserialize(deserializer: D) -> Result - where - D: serde::Deserializer<'de>, - { - u64::deserialize(deserializer).and_then(|n| { - if n > RawFelt::MODULUS { - Err(serde::de::Error::custom( - "invalid field element value: exceeds the field modulus", - )) - } else { - RawFelt::try_from(n).map(Felt).map_err(|err| { - serde::de::Error::custom(format!("invalid field element value: {err}")) - }) - } - }) - } -} - -impl clap::builder::ValueParserFactory for Felt { - type Parser = FeltParser; - - fn value_parser() -> Self::Parser { - FeltParser - } -} - -#[doc(hidden)] -#[derive(Clone)] -pub struct FeltParser; -impl clap::builder::TypedValueParser for FeltParser { - type Value = Felt; - - fn parse_ref( - &self, - _cmd: &clap::Command, - _arg: Option<&clap::Arg>, - value: &std::ffi::OsStr, - ) -> Result { - use clap::error::{Error, ErrorKind}; - - let value = value.to_str().ok_or_else(|| Error::new(ErrorKind::InvalidUtf8))?.trim(); - value.parse().map_err(|err| Error::raw(ErrorKind::ValueValidation, err)) - } -} - -impl core::str::FromStr for Felt { - type Err = String; - - fn from_str(s: &str) -> Result { - let value = if let Some(value) = s.strip_prefix("0x") { - u64::from_str_radix(value, 16) - .map_err(|err| format!("invalid field element value: {err}"))? - } else { - s.parse::().map_err(|err| format!("invalid field element value: {err}"))? - }; - - if value > RawFelt::MODULUS { - Err("invalid field element value: exceeds the field modulus".to_string()) - } else { - RawFelt::try_from(value).map(Felt) - } - } -} - -impl From for miden_processor::Felt { - fn from(f: Felt) -> Self { - f.0 - } -} - -impl From for Felt { - fn from(b: bool) -> Self { - Self(RawFelt::from(b as u32)) - } -} - -impl From for Felt { - fn from(t: u8) -> Self { - Self(t.into()) - } -} - -impl From for Felt { - fn from(t: i8) -> Self { - Self((t as u8).into()) - } -} - -impl From for Felt { - fn from(t: i16) -> Self { - Self((t as u16).into()) - } -} - -impl From for Felt { - fn from(t: u16) -> Self { - Self(t.into()) - } -} - -impl From for Felt { - fn from(t: i32) -> Self { - Self((t as u32).into()) - } -} - -impl From for Felt { - fn from(t: u32) -> Self { - Self(t.into()) - } -} - -impl From for Felt { - fn from(t: u64) -> Self { - Self(RawFelt::new(t)) - } -} - -impl From for Felt { - fn from(t: i64) -> Self { - Self(RawFelt::new(t as u64)) - } -} - -// Reverse Felt to Rust types conversion - -impl From for bool { - fn from(f: Felt) -> Self { - f.0.as_int() != 0 - } -} - -impl From for u8 { - fn from(f: Felt) -> Self { - f.0.as_int() as u8 - } -} - -impl From for i8 { - fn from(f: Felt) -> Self { - f.0.as_int() as i8 - } -} - -impl From for u16 { - fn from(f: Felt) -> Self { - f.0.as_int() as u16 - } -} - -impl From for i16 { - fn from(f: Felt) -> Self { - f.0.as_int() as i16 - } -} - -impl From for u32 { - fn from(f: Felt) -> Self { - f.0.as_int() as u32 - } -} - -impl From for i32 { - fn from(f: Felt) -> Self { - f.0.as_int() as i32 - } -} - -impl From for u64 { - fn from(f: Felt) -> Self { - f.0.as_int() - } -} - -impl From for i64 { - fn from(f: Felt) -> Self { - f.0.as_int() as i64 - } -} - -impl Arbitrary for Felt { - type Parameters = (); - type Strategy = BoxedStrategy; - - fn arbitrary_with(_args: Self::Parameters) -> Self::Strategy { - use miden_core::StarkField; - (0u64..RawFelt::MODULUS).prop_map(|v| Felt(RawFelt::new(v))).boxed() - } -} - -#[cfg(test)] -mod tests { - use std::collections::VecDeque; - - use miden_core::Word; - - use super::{bytes_to_words, FromMidenRepr, ToMidenRepr}; - - #[test] - fn bool_roundtrip() { - let encoded = true.to_bytes(); - let decoded = ::from_bytes(&encoded); - assert!(decoded); - - let encoded = true.to_felts(); - let decoded = ::from_felts(&encoded); - assert!(decoded); - - let encoded = true.to_words(); - let decoded = ::from_words(&encoded); - assert!(decoded); - - let mut stack = Vec::default(); - true.push_to_operand_stack(&mut stack); - let popped = ::pop_from_stack(&mut stack); - assert!(popped); - } - - #[test] - fn u8_roundtrip() { - let encoded = u8::MAX.to_bytes(); - let decoded = ::from_bytes(&encoded); - assert_eq!(decoded, u8::MAX); - - let encoded = u8::MAX.to_felts(); - let decoded = ::from_felts(&encoded); - assert_eq!(decoded, u8::MAX); - - let encoded = u8::MAX.to_words(); - let decoded = ::from_words(&encoded); - assert_eq!(decoded, u8::MAX); - - let mut stack = Vec::default(); - u8::MAX.push_to_operand_stack(&mut stack); - let popped = ::pop_from_stack(&mut stack); - assert_eq!(popped, u8::MAX); - } - - #[test] - fn u16_roundtrip() { - let encoded = u16::MAX.to_bytes(); - let decoded = ::from_bytes(&encoded); - assert_eq!(decoded, u16::MAX); - - let encoded = u16::MAX.to_felts(); - let decoded = ::from_felts(&encoded); - assert_eq!(decoded, u16::MAX); - - let encoded = u16::MAX.to_words(); - let decoded = ::from_words(&encoded); - assert_eq!(decoded, u16::MAX); - - let mut stack = Vec::default(); - u16::MAX.push_to_operand_stack(&mut stack); - let popped = ::pop_from_stack(&mut stack); - assert_eq!(popped, u16::MAX); - } - - #[test] - fn u32_roundtrip() { - let encoded = u32::MAX.to_bytes(); - let decoded = ::from_bytes(&encoded); - assert_eq!(decoded, u32::MAX); - - let encoded = u32::MAX.to_felts(); - let decoded = ::from_felts(&encoded); - assert_eq!(decoded, u32::MAX); - - let encoded = u32::MAX.to_words(); - let decoded = ::from_words(&encoded); - assert_eq!(decoded, u32::MAX); - - let mut stack = Vec::default(); - u32::MAX.push_to_operand_stack(&mut stack); - let popped = ::pop_from_stack(&mut stack); - assert_eq!(popped, u32::MAX); - } - - #[test] - fn u64_roundtrip() { - let encoded = u64::MAX.to_bytes(); - let decoded = ::from_bytes(&encoded); - assert_eq!(decoded, u64::MAX); - - let encoded = u64::MAX.to_felts(); - let decoded = ::from_felts(&encoded); - assert_eq!(decoded, u64::MAX); - - let encoded = u64::MAX.to_words(); - let decoded = ::from_words(&encoded); - assert_eq!(decoded, u64::MAX); - - let mut stack = Vec::default(); - u64::MAX.push_to_operand_stack(&mut stack); - let popped = ::pop_from_stack(&mut stack); - assert_eq!(popped, u64::MAX); - } - - #[test] - fn u128_roundtrip() { - let encoded = u128::MAX.to_bytes(); - let decoded = ::from_bytes(&encoded); - assert_eq!(decoded, u128::MAX); - - let encoded = u128::MAX.to_felts(); - let decoded = ::from_felts(&encoded); - assert_eq!(decoded, u128::MAX); - - let encoded = u128::MAX.to_words(); - let decoded = ::from_words(&encoded); - assert_eq!(decoded, u128::MAX); - - let mut stack = Vec::default(); - u128::MAX.push_to_operand_stack(&mut stack); - let popped = ::pop_from_stack(&mut stack); - assert_eq!(popped, u128::MAX); - } - - #[test] - fn byte_array_roundtrip() { - let bytes = [0, 1, 2, 3, 4, 5, 6, 7]; - - let encoded = bytes.to_felts(); - let decoded = <[u8; 8] as FromMidenRepr>::from_felts(&encoded); - assert_eq!(decoded, bytes); - - let encoded = bytes.to_words(); - let decoded = <[u8; 8] as FromMidenRepr>::from_words(&encoded); - assert_eq!(decoded, bytes); - - let mut stack = Vec::default(); - bytes.push_to_operand_stack(&mut stack); - let popped = <[u8; 8] as FromMidenRepr>::pop_from_stack(&mut stack); - assert_eq!(popped, bytes); - } - - #[test] - fn bytes_to_words_test() { - let bytes = [ - 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, - 25, 26, 27, 28, 29, 30, 31, 32, - ]; - let words = bytes_to_words(&bytes); - assert_eq!(words.len(), 2); - // Words should be in little-endian order, elements of the word should be in big-endian - assert_eq!(words[0][3].as_int() as u32, u32::from_ne_bytes([1, 2, 3, 4])); - assert_eq!(words[0][2].as_int() as u32, u32::from_ne_bytes([5, 6, 7, 8])); - assert_eq!(words[0][1].as_int() as u32, u32::from_ne_bytes([9, 10, 11, 12])); - assert_eq!(words[0][0].as_int() as u32, u32::from_ne_bytes([13, 14, 15, 16])); - - // Make sure bytes_to_words and to_words agree - let to_words_output = bytes.to_words(); - assert_eq!(Word::new(words[0]), to_words_output[0]); - } - - #[test] - fn bytes_from_words_test() { - let bytes = [ - 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, - 25, 26, 27, 28, 29, 30, 31, 32, - ]; - let words_as_bytes = bytes_to_words(&bytes); - - let words = vec![Word::new(words_as_bytes[0]), Word::new(words_as_bytes[1])]; - - let out = <[u8; 32] as FromMidenRepr>::from_words(&words); - - assert_eq!(&out, &bytes); - } -} diff --git a/midenc-debug/src/lib.rs b/midenc-debug/src/lib.rs deleted file mode 100644 index f76d9119f..000000000 --- a/midenc-debug/src/lib.rs +++ /dev/null @@ -1,125 +0,0 @@ -#![feature(iter_array_chunks)] -#![allow(unused)] - -mod cli; -mod config; -mod debug; -mod exec; -mod felt; -mod logger; -mod ui; - -use std::rc::Rc; - -use midenc_session::{ - diagnostics::{IntoDiagnostic, Report}, - HumanDuration, Session, -}; - -pub use self::{ - cli::Debugger, - config::DebuggerConfig, - debug::*, - exec::*, - felt::{bytes_to_words, Felt, Felt as TestFelt, FromMidenRepr, ToMidenRepr}, -}; - -pub type ExecutionResult = Result; - -pub fn run( - inputs: Option, - args: Vec, - session: Rc, - logger: Box, -) -> ExecutionResult<()> { - let mut builder = tokio::runtime::Builder::new_current_thread(); - let rt = builder.enable_all().build().into_diagnostic()?; - rt.block_on(async move { start_ui(inputs, args, session, logger).await }) -} - -pub fn run_noninteractively( - inputs: Option, - args: Vec, - num_outputs: usize, - session: Rc, -) -> ExecutionResult<()> { - use std::time::Instant; - - use midenc_hir::formatter::ToHex; - - println!("==============================================================================="); - println!("Run program: {}", session.inputs[0].file_name()); - println!("-------------------------------------------------------------------------------"); - - let state = ui::State::from_inputs(inputs, args, session)?; - - println!( - "Executed program with hash {} in {}", - state.package.digest().to_hex(), - HumanDuration::from(state.execution_duration), - ); - - // write the stack outputs to the screen. - println!("Output: {:?}", state.execution_trace.outputs().stack_truncated(num_outputs)); - - // calculate the percentage of padded rows - let trace_len_summary = state.execution_trace.trace_len_summary(); - let padding_percentage = (trace_len_summary.padded_trace_len() - trace_len_summary.trace_len()) - * 100 - / trace_len_summary.padded_trace_len(); - - // print the required cycles for each component - println!( - "VM cycles: {} extended to {} steps ({}% padding). -├── Stack rows: {} -├── Range checker rows: {} -└── Chiplets rows: {} -├── Hash chiplet rows: {} -├── Bitwise chiplet rows: {} -├── Memory chiplet rows: {} -└── Kernel ROM rows: {}", - trace_len_summary.trace_len(), - trace_len_summary.padded_trace_len(), - padding_percentage, - trace_len_summary.main_trace_len(), - trace_len_summary.range_trace_len(), - trace_len_summary.chiplets_trace_len().trace_len(), - trace_len_summary.chiplets_trace_len().hash_chiplet_len(), - trace_len_summary.chiplets_trace_len().bitwise_chiplet_len(), - trace_len_summary.chiplets_trace_len().memory_chiplet_len(), - trace_len_summary.chiplets_trace_len().kernel_rom_len(), - ); - - Ok(()) -} - -pub fn trace( - _options: Option, - _args: Vec, - _session: Rc, -) -> ExecutionResult { - todo!() -} - -pub async fn start_ui( - inputs: Option, - args: Vec, - session: Rc, - logger: Box, -) -> Result<(), Report> { - use ratatui::crossterm as term; - - logger::DebugLogger::install(logger); - - let original_hook = std::panic::take_hook(); - std::panic::set_hook(Box::new(move |panic_info| { - let _ = term::terminal::disable_raw_mode(); - let _ = term::execute!(std::io::stdout(), term::terminal::LeaveAlternateScreen); - original_hook(panic_info); - })); - - let mut app = ui::App::new(inputs, args, session).await?; - app.run().await?; - - Ok(()) -} diff --git a/midenc-debug/src/logger.rs b/midenc-debug/src/logger.rs deleted file mode 100644 index 8e3e1bfe4..000000000 --- a/midenc-debug/src/logger.rs +++ /dev/null @@ -1,76 +0,0 @@ -use std::{ - borrow::Cow, - collections::VecDeque, - sync::{Arc, LazyLock, Mutex}, -}; - -use log::{Level, Log}; - -static LOGGER: LazyLock = LazyLock::new(DebugLogger::default); - -#[derive(Default)] -struct DebugLoggerImpl { - inner: Option>, - captured: VecDeque, -} - -pub struct LogEntry { - pub level: Level, - pub file: Option>, - pub line: Option, - pub message: String, -} - -#[derive(Default, Clone)] -pub struct DebugLogger(Arc>); -impl Log for DebugLogger { - fn enabled(&self, _metadata: &log::Metadata) -> bool { - true - } - - fn log(&self, record: &log::Record) { - let file = record - .file_static() - .map(Cow::Borrowed) - .or_else(|| record.file().map(|f| f.to_string()).map(Cow::Owned)); - let entry = LogEntry { - level: record.level(), - file, - line: record.line(), - message: format!("{}", record.args()), - }; - let mut guard = self.0.lock().unwrap(); - guard.captured.push_back(entry); - if guard.captured.len() > 100 { - guard.captured.pop_front(); - } - if let Some(inner) = guard.inner.as_ref() { - if inner.enabled(record.metadata()) { - inner.log(record); - } - } - } - - fn flush(&self) {} -} -impl DebugLogger { - pub fn install(inner: Box) { - let logger = &*LOGGER; - logger.set_inner(inner); - log::set_logger(logger).unwrap_or_else(|err| panic!("failed to install logger: {err}")); - log::set_max_level(log::LevelFilter::Trace); - } - - pub fn get() -> &'static Self { - &LOGGER - } - - pub fn take_captured(&self) -> VecDeque { - let mut guard = self.0.lock().unwrap(); - core::mem::take(&mut guard.captured) - } - - fn set_inner(&self, logger: Box) { - drop(self.0.lock().unwrap().inner.replace(logger)); - } -} diff --git a/midenc-debug/src/ui/action.rs b/midenc-debug/src/ui/action.rs deleted file mode 100644 index 83ebe30ac..000000000 --- a/midenc-debug/src/ui/action.rs +++ /dev/null @@ -1,39 +0,0 @@ -type Command = String; -type Args = Option; - -#[derive(Debug, Clone, PartialEq, Eq)] -pub enum Action { - Tick, - Render, - Resize(u16, u16), - Suspend, - Resume, - Quit, - Refresh, - Error(String), - Help, - FocusNext, - FocusPrev, - Focus, - UnFocus, - Up, - Down, - Submit, - Update, - Tab(u32), - TabNext, - TabPrev, - Go, - Back, - ToggleFullScreen, - StatusLine(String), - TimedStatusLine(String, u64), - FocusFooter(Command, Args), - FooterResult(Command, Args), - Noop, - ClosePopup, - ShowDebug, - Continue, - Delete, - Reload, -} diff --git a/midenc-debug/src/ui/app.rs b/midenc-debug/src/ui/app.rs deleted file mode 100644 index 4959ecf50..000000000 --- a/midenc-debug/src/ui/app.rs +++ /dev/null @@ -1,282 +0,0 @@ -use std::{collections::HashMap, rc::Rc}; - -use midenc_session::{ - diagnostics::{IntoDiagnostic, Report}, - Session, -}; -use ratatui::{ - crossterm::event::KeyEvent, - layout::{Constraint, Layout}, - prelude::Rect, -}; -use tokio::sync::mpsc; - -use super::{ - pages::{home::Home, Page}, - panes::{debug::DebugPane, footer::FooterPane, header::HeaderPane, Pane}, - state::{InputMode, State}, - tui, Action, -}; - -#[derive(Debug, Default, Copy, Clone, PartialEq, Eq, Hash)] -pub enum Mode { - #[default] - Home, -} - -pub struct App { - pub pages: Vec>, - pub keybindings: KeyBindings, - pub active_page: usize, - pub footer: FooterPane, - pub header: HeaderPane, - pub popup: Option>, - pub last_tick_key_events: Vec, - pub mode: Mode, - pub state: State, - pub should_quit: bool, - pub should_suspend: bool, -} - -pub type KeyBindings = HashMap, Action>>; - -impl App { - pub async fn new( - inputs: Option, - args: Vec, - session: Rc, - ) -> Result { - let state = State::from_inputs(inputs, args, session)?; - let home = Home::new()?; - Ok(Self { - pages: vec![Box::new(home)], - keybindings: Default::default(), - active_page: 0, - footer: FooterPane::new(), - header: HeaderPane::new(), - popup: None, - last_tick_key_events: vec![], - mode: Mode::Home, - state, - should_quit: false, - should_suspend: false, - }) - } - - pub async fn run(&mut self) -> Result<(), Report> { - let (action_tx, mut action_rx) = mpsc::unbounded_channel::(); - - let mut tui = tui::Tui::new()? - .tick_rate(4.0) // 4 ticks per second - .frame_rate(30.0); // 30 frames per second - - // Starts event handler, enters raw mode, enters alternate screen - tui.enter()?; - - for page in self.pages.iter_mut() { - page.register_action_handler(action_tx.clone())?; - } - - for page in self.pages.iter_mut() { - page.init(&self.state)?; - page.focus()?; - } - - self.header.init(&self.state)?; - self.footer.init(&self.state)?; - - loop { - if let Some(evt) = tui.next().await { - let mut stop_event_propagation = self - .popup - .as_mut() - .and_then(|pane| pane.handle_events(evt.clone(), &mut self.state).ok()) - .map(|response| match response { - Some(tui::EventResponse::Continue(action)) => { - action_tx.send(action).ok(); - false - } - Some(tui::EventResponse::Stop(action)) => { - action_tx.send(action).ok(); - true - } - _ => false, - }) - .unwrap_or(false); - stop_event_propagation = stop_event_propagation - || self - .pages - .get_mut(self.active_page) - .and_then(|page| page.handle_events(evt.clone(), &mut self.state).ok()) - .map(|response| match response { - Some(tui::EventResponse::Continue(action)) => { - action_tx.send(action).ok(); - false - } - Some(tui::EventResponse::Stop(action)) => { - action_tx.send(action).ok(); - true - } - _ => false, - }) - .unwrap_or(false); - stop_event_propagation = stop_event_propagation - || self - .footer - .handle_events(evt.clone(), &mut self.state) - .map(|response| match response { - Some(tui::EventResponse::Continue(action)) => { - action_tx.send(action).ok(); - false - } - Some(tui::EventResponse::Stop(action)) => { - action_tx.send(action).ok(); - true - } - _ => false, - }) - .unwrap_or(false); - - if !stop_event_propagation { - match evt { - tui::Event::Quit if self.state.input_mode == InputMode::Normal => { - action_tx.send(Action::Quit).into_diagnostic()? - } - tui::Event::Tick => action_tx.send(Action::Tick).into_diagnostic()?, - tui::Event::Render => action_tx.send(Action::Render).into_diagnostic()?, - tui::Event::Resize(x, y) => { - action_tx.send(Action::Resize(x, y)).into_diagnostic()? - } - tui::Event::Key(key) => { - if let Some(keymap) = self.keybindings.get(&self.mode) { - if let Some(action) = keymap.get(&vec![key]) { - action_tx.send(action.clone()).into_diagnostic()?; - } else { - // If the key was not handled as a single key action, - // then consider it for multi-key combinations. - self.last_tick_key_events.push(key); - - if let Some(action) = keymap.get(&self.last_tick_key_events) { - action_tx.send(action.clone()).into_diagnostic()?; - } - } - } - } - _ => (), - } - } - } - - while let Ok(action) = action_rx.try_recv() { - if action != Action::Tick && action != Action::Render { - log::debug!("{action:?}"); - } - match action { - Action::Tick => { - self.last_tick_key_events.clear(); - } - Action::Quit if self.state.input_mode == InputMode::Normal => { - self.should_quit = true - } - Action::Suspend => self.should_suspend = true, - Action::Resume => self.should_suspend = false, - Action::Resize(w, h) => { - tui.resize(Rect::new(0, 0, w, h)).into_diagnostic()?; - tui.draw(|f| { - self.draw(f).unwrap_or_else(|err| { - action_tx - .send(Action::Error(format!("Failed to draw: {err:?}"))) - .unwrap(); - }) - }) - .into_diagnostic()?; - } - Action::Render => { - tui.draw(|f| { - self.draw(f).unwrap_or_else(|err| { - action_tx - .send(Action::Error(format!("Failed to draw {err:?}"))) - .unwrap() - }) - }) - .into_diagnostic()?; - } - Action::ShowDebug => { - let debug_popup = DebugPane::default(); - self.popup = Some(Box::new(debug_popup)); - } - Action::ClosePopup => { - if self.popup.is_some() { - self.popup = None; - } - } - _ => (), - } - - if let Some(popup) = self.popup.as_mut() { - if let Some(action) = popup.update(action.clone(), &mut self.state)? { - action_tx.send(action).into_diagnostic()?; - } - } else if let Some(page) = self.pages.get_mut(self.active_page) { - if let Some(action) = page.update(action.clone(), &mut self.state)? { - action_tx.send(action).into_diagnostic()?; - } - } - - if let Some(action) = self.header.update(action.clone(), &mut self.state)? { - action_tx.send(action).into_diagnostic()?; - } - - if let Some(action) = self.footer.update(action.clone(), &mut self.state)? { - action_tx.send(action).into_diagnostic()?; - } - } - - if self.should_suspend { - tui.suspend()?; - action_tx.send(Action::Resume).into_diagnostic()?; - tui = tui::Tui::new()?; - tui.enter()?; - } else if self.should_quit { - tui.stop()?; - break; - } - } - - // stops event handler, exits raw mode, exits alternate screen - tui.exit()?; - - Ok(()) - } - - fn draw(&mut self, frame: &mut tui::Frame<'_>) -> Result<(), Report> { - let vertical_layout = - Layout::vertical(vec![Constraint::Max(1), Constraint::Fill(1), Constraint::Max(1)]) - .split(frame.area()); - - self.header.draw(frame, vertical_layout[0], &self.state)?; - - if let Some(page) = self.pages.get_mut(self.active_page) { - page.draw(frame, vertical_layout[1], &self.state)?; - } - - if let Some(popup) = self.popup.as_mut() { - let popup_vertical_layout = Layout::vertical(vec![ - Constraint::Fill(1), - popup.height_constraint(), - Constraint::Fill(1), - ]) - .split(frame.area()); - let popup_layout = Layout::horizontal(vec![ - Constraint::Fill(1), - Constraint::Percentage(80), - Constraint::Fill(1), - ]) - .split(popup_vertical_layout[1]); - popup.draw(frame, popup_layout[1], &self.state)?; - } - - self.footer.draw(frame, vertical_layout[2], &self.state)?; - Ok(()) - } -} diff --git a/midenc-debug/src/ui/mod.rs b/midenc-debug/src/ui/mod.rs deleted file mode 100644 index aad5746fa..000000000 --- a/midenc-debug/src/ui/mod.rs +++ /dev/null @@ -1,9 +0,0 @@ -mod action; -mod app; -mod pages; -mod panes; -mod state; -mod syntax_highlighting; -mod tui; - -pub use self::{action::Action, app::App, state::State}; diff --git a/midenc-debug/src/ui/pages/home.rs b/midenc-debug/src/ui/pages/home.rs deleted file mode 100644 index f0e11e586..000000000 --- a/midenc-debug/src/ui/pages/home.rs +++ /dev/null @@ -1,447 +0,0 @@ -use midenc_session::diagnostics::{IntoDiagnostic, Report}; -use ratatui::{ - crossterm::{ - self, - event::{KeyCode, KeyEvent}, - }, - prelude::*, -}; -use tokio::sync::mpsc::UnboundedSender; - -use crate::{ - ui::{ - action::Action, - pages::Page, - panes::{ - breakpoints::BreakpointsPane, disasm::DisassemblyPane, source_code::SourceCodePane, - stack::OperandStackPane, stacktrace::StackTracePane, Pane, - }, - state::{InputMode, State}, - tui::EventResponse, - }, - Breakpoint, BreakpointType, ReadMemoryExpr, -}; - -#[derive(Default)] -pub struct Home { - command_tx: Option>, - panes: Vec>, - focused_pane_index: usize, - fullscreen_pane_index: Option, -} - -impl Home { - pub fn new() -> Result { - let focused_border_style = Style::default().fg(Color::LightGreen); - - Ok(Self { - command_tx: None, - panes: vec![ - Box::new(SourceCodePane::new(true, focused_border_style)), - Box::new(DisassemblyPane::new(false, focused_border_style)), - Box::new(StackTracePane::new(false, focused_border_style)), - Box::new(OperandStackPane::new(false, focused_border_style)), - Box::new(BreakpointsPane::new(false, focused_border_style)), - ], - - focused_pane_index: 0, - fullscreen_pane_index: None, - }) - } -} - -impl Page for Home { - fn init(&mut self, state: &State) -> Result<(), Report> { - for pane in self.panes.iter_mut() { - pane.init(state)?; - } - Ok(()) - } - - fn focus(&mut self) -> Result<(), Report> { - if let Some(command_tx) = &self.command_tx { - const ARROW: &str = symbols::scrollbar::HORIZONTAL.end; - let status_line = - format!("[l,h {ARROW} pane movement] [: {ARROW} commands] [q {ARROW} quit]"); - command_tx.send(Action::StatusLine(status_line)).into_diagnostic()?; - } - Ok(()) - } - - fn register_action_handler(&mut self, tx: UnboundedSender) -> Result<(), Report> { - self.command_tx = Some(tx); - Ok(()) - } - - fn update(&mut self, action: Action, state: &mut State) -> Result, Report> { - let mut actions: Vec> = vec![]; - match action { - Action::Tick => {} - Action::FocusNext => { - let next_index = self.focused_pane_index.saturating_add(1) % self.panes.len(); - if let Some(pane) = self.panes.get_mut(self.focused_pane_index) { - actions.push(pane.update(Action::UnFocus, state)?); - } - self.focused_pane_index = next_index; - if let Some(pane) = self.panes.get_mut(self.focused_pane_index) { - actions.push(pane.update(Action::Focus, state)?); - } - } - Action::FocusPrev => { - let prev_index = - self.focused_pane_index.saturating_add(self.panes.len() - 1) % self.panes.len(); - if let Some(pane) = self.panes.get_mut(self.focused_pane_index) { - actions.push(pane.update(Action::UnFocus, state)?); - } - self.focused_pane_index = prev_index; - if let Some(pane) = self.panes.get_mut(self.focused_pane_index) { - actions.push(pane.update(Action::Focus, state)?); - } - } - Action::Update => { - for pane in self.panes.iter_mut() { - actions.push(pane.update(action.clone(), state)?); - } - } - Action::ToggleFullScreen => { - self.fullscreen_pane_index = - self.fullscreen_pane_index.map_or(Some(self.focused_pane_index), |_| None); - } - Action::FocusFooter(..) => { - if let Some(pane) = self.panes.get_mut(self.focused_pane_index) { - actions.push(pane.update(Action::UnFocus, state)?); - } - } - Action::FooterResult(cmd, Some(args)) if cmd.eq(":") => { - if let Some(pane) = self.panes.get_mut(self.focused_pane_index) { - pane.update(Action::Focus, state)?; - } - // Dispatch commands of the form: CMD [ARGS..] - match args.split_once(' ') { - Some((cmd, rest)) => match cmd.trim() { - "b" | "break" | "breakpoint" => match rest.parse::() { - Ok(ty) => { - state.create_breakpoint(ty); - actions.push(Some(Action::TimedStatusLine( - "breakpoint created".to_string(), - 1, - ))); - } - Err(err) => { - actions.push(Some(Action::TimedStatusLine(err, 5))); - } - }, - "r" | "read" => match rest.parse::() { - Ok(expr) => match state.read_memory(&expr) { - Ok(result) => actions.push(Some(Action::StatusLine(result))), - Err(err) => actions.push(Some(Action::TimedStatusLine(err, 5))), - }, - Err(err) => actions.push(Some(Action::TimedStatusLine(err, 5))), - }, - _ => { - log::debug!("unknown command with arguments: '{cmd} {args}'"); - actions.push(Some(Action::TimedStatusLine("unknown command".into(), 1))) - } - }, - None => match args.trim() { - "q" | "quit" => actions.push(Some(Action::Quit)), - "reload" => { - actions.push(Some(Action::Reload)); - } - "debug" => { - actions.push(Some(Action::ShowDebug)); - } - invalid => { - log::debug!("unknown command: '{invalid}'"); - actions.push(Some(Action::TimedStatusLine("unknown command".into(), 1))) - } - }, - } - } - Action::FooterResult(_cmd, None) => { - if let Some(pane) = self.panes.get_mut(self.focused_pane_index) { - actions.push(pane.update(Action::Focus, state)?); - } - } - Action::Continue => { - let start_cycle = state.executor.cycle; - let mut breakpoints = core::mem::take(&mut state.breakpoints); - state.stopped = false; - let stopped = loop { - // If stepping the program results in the program terminating succesfully, stop - if state.executor.stopped { - break true; - } - - let mut consume_most_recent_finish = false; - match state.executor.step() { - Ok(Some(exited)) if exited.should_break_on_exit() => { - consume_most_recent_finish = true; - } - Ok(_) => (), - Err(err) => { - // Execution terminated with an error - state.execution_failed = Some(err); - break true; - } - } - - if breakpoints.is_empty() { - // No breakpoint management needed, keep executing - continue; - } - - let (op, is_op_boundary, proc, loc) = match state.executor.last.as_ref() { - Some(last_state) => { - let op = last_state.op; - let is_boundary = last_state - .asmop - .as_ref() - .map(|info| info.cycle_idx() == 1) - .unwrap_or(false); - let (proc, loc) = match state.executor.callstack.current_frame() { - Some(frame) => { - let loc = frame - .recent() - .back() - .and_then(|detail| detail.resolve(&state.session)) - .cloned(); - (frame.procedure(state.session.name()), loc) - } - None => (None, None), - }; - (op, is_boundary, proc, loc) - } - None => (None, false, None, None), - }; - - // Remove all breakpoints triggered at this cycle - let current_cycle = state.executor.cycle; - let cycles_stepped = current_cycle - start_cycle; - breakpoints.retain_mut(|bp| { - if let Some(n) = bp.cycles_to_skip(current_cycle) { - if cycles_stepped >= n { - let retained = !bp.is_one_shot(); - if retained { - state.breakpoints_hit.push(bp.clone()); - } else { - state.breakpoints_hit.push(core::mem::take(bp)); - } - return retained; - } else { - return true; - } - } - - if cycles_stepped > 0 - && is_op_boundary - && matches!(&bp.ty, BreakpointType::Next) - { - state.breakpoints_hit.push(core::mem::take(bp)); - return false; - } - - if let Some(loc) = loc.as_ref() { - if bp.should_break_at(loc) { - let retained = !bp.is_one_shot(); - if retained { - state.breakpoints_hit.push(bp.clone()); - } else { - state.breakpoints_hit.push(core::mem::take(bp)); - } - return retained; - } - } - - if let Some(proc) = proc.as_deref() { - if bp.should_break_in(proc) { - let retained = !bp.is_one_shot(); - if retained { - state.breakpoints_hit.push(bp.clone()); - } else { - state.breakpoints_hit.push(core::mem::take(bp)); - } - return retained; - } - } - - true - }); - - if consume_most_recent_finish { - if let Some(id) = breakpoints.iter().rev().find_map(|bp| { - if matches!(bp.ty, BreakpointType::Finish) { - Some(bp.id) - } else { - None - } - }) { - breakpoints.retain(|bp| bp.id != id); - break true; - } - } - - if !state.breakpoints_hit.is_empty() { - break true; - } - }; - - // Restore the breakpoints state - state.breakpoints = breakpoints; - - // Ensure that if we yield to the runtime, that we resume executing when - // resumed, unless we specifically stopped for a breakpoint or other condition - state.stopped = stopped; - - // Report program termination to the user - if stopped && state.executor.stopped { - if let Some(err) = state.execution_failed.as_ref() { - actions.push(Some(Action::StatusLine(err.to_string()))); - } else { - actions.push(Some(Action::StatusLine( - "program terminated successfully".to_string(), - ))); - } - } - - // Update the UI with latest state - for pane in self.panes.iter_mut() { - actions.push(pane.update(Action::Update, state)?); - } - } - Action::Reload => match state.reload() { - Ok(_) => { - for pane in self.panes.iter_mut() { - actions.push(pane.update(Action::Reload, state)?); - } - } - Err(err) => { - actions.push(Some(Action::TimedStatusLine(err.to_string(), 5))); - } - }, - _ => { - if let Some(pane) = self.panes.get_mut(self.focused_pane_index) { - actions.push(pane.update(action, state)?); - } - } - } - - if let Some(tx) = &mut self.command_tx { - actions.into_iter().flatten().for_each(|action| { - tx.send(action).ok(); - }); - } - Ok(None) - } - - fn handle_key_events( - &mut self, - key: KeyEvent, - state: &mut State, - ) -> Result>, Report> { - match state.input_mode { - InputMode::Normal => { - let response = match key.code { - KeyCode::Right | KeyCode::Char('l') | KeyCode::Char('L') => { - EventResponse::Stop(Action::FocusNext) - } - KeyCode::Left | KeyCode::Char('h') | KeyCode::Char('H') => { - EventResponse::Stop(Action::FocusPrev) - } - KeyCode::Down | KeyCode::Char('j') | KeyCode::Char('J') => { - EventResponse::Stop(Action::Down) - } - KeyCode::Up | KeyCode::Char('k') | KeyCode::Char('K') => { - EventResponse::Stop(Action::Up) - } - KeyCode::Char('g') | KeyCode::Char('G') => EventResponse::Stop(Action::Go), - KeyCode::Backspace | KeyCode::Char('b') | KeyCode::Char('B') => { - EventResponse::Stop(Action::Back) - } - KeyCode::Char('f') | KeyCode::Char('F') => { - EventResponse::Stop(Action::ToggleFullScreen) - } - KeyCode::Char(c) if ('1'..='9').contains(&c) => { - EventResponse::Stop(Action::Tab(c.to_digit(10).unwrap_or(0) - 1)) - } - KeyCode::Char(']') => EventResponse::Stop(Action::TabNext), - KeyCode::Char('[') => EventResponse::Stop(Action::TabPrev), - KeyCode::Char(':') => { - EventResponse::Stop(Action::FocusFooter(":".into(), None)) - } - KeyCode::Char('q') => EventResponse::Stop(Action::Quit), - KeyCode::Char('e') => { - state.create_breakpoint(BreakpointType::Finish); - state.stopped = false; - EventResponse::Stop(Action::Continue) - } - // Only step if we're stopped, and execution has not terminated - KeyCode::Char('s') if state.stopped && !state.executor.stopped => { - state.create_breakpoint(BreakpointType::Step); - state.stopped = false; - EventResponse::Stop(Action::Continue) - } - // Only step-next if we're stopped, and execution has not terminated - KeyCode::Char('n') if state.stopped && !state.executor.stopped => { - state.create_breakpoint(BreakpointType::Next); - state.stopped = false; - EventResponse::Stop(Action::Continue) - } - // Only resume execution if we're stopped, and execution has not terminated - KeyCode::Char('c') if state.stopped && !state.executor.stopped => { - state.stopped = false; - EventResponse::Stop(Action::Continue) - } - // Do not try to continue if execution has terminated, but warn user - KeyCode::Char('c' | 's' | 'n') if state.stopped && state.executor.stopped => { - EventResponse::Stop(Action::TimedStatusLine( - "program has terminated, cannot continue".to_string(), - 3, - )) - } - KeyCode::Char('d') => EventResponse::Stop(Action::Delete), - _ => { - return Ok(None); - } - }; - Ok(Some(response)) - } - InputMode::Insert => Ok(None), - InputMode::Command => Ok(None), - } - } - - fn draw(&mut self, frame: &mut Frame<'_>, area: Rect, state: &State) -> Result<(), Report> { - if let Some(fullscreen_pane_index) = self.fullscreen_pane_index { - self.panes[fullscreen_pane_index].draw(frame, area, state)?; - } else { - let outer_layout = Layout::default() - .direction(Direction::Horizontal) - .constraints(vec![Constraint::Fill(3), Constraint::Fill(1)]) - .split(area); - - let left_panes = Layout::default() - .direction(Direction::Vertical) - .constraints(vec![ - self.panes[0].height_constraint(), - self.panes[1].height_constraint(), - self.panes[2].height_constraint(), - ]) - .split(outer_layout[0]); - - let right_panes = Layout::default() - .direction(Direction::Vertical) - .constraints(vec![ - self.panes[3].height_constraint(), - self.panes[4].height_constraint(), - ]) - .split(outer_layout[1]); - self.panes[0].draw(frame, left_panes[0], state)?; - self.panes[1].draw(frame, left_panes[1], state)?; - self.panes[2].draw(frame, left_panes[2], state)?; - self.panes[3].draw(frame, right_panes[0], state)?; - self.panes[4].draw(frame, right_panes[1], state)?; - } - Ok(()) - } -} diff --git a/midenc-debug/src/ui/pages/mod.rs b/midenc-debug/src/ui/pages/mod.rs deleted file mode 100644 index dc6288ade..000000000 --- a/midenc-debug/src/ui/pages/mod.rs +++ /dev/null @@ -1,65 +0,0 @@ -use crossterm::event::{KeyEvent, MouseEvent}; -use midenc_session::diagnostics::Report; -use ratatui::layout::Rect; -use tokio::sync::mpsc::UnboundedSender; - -use crate::ui::{ - action::Action, - state::State, - tui::{Event, EventResponse, Frame}, -}; - -pub mod home; - -pub trait Page { - fn register_action_handler(&mut self, _tx: UnboundedSender) -> Result<(), Report> { - Ok(()) - } - - fn init(&mut self, _state: &State) -> Result<(), Report> { - Ok(()) - } - - fn focus(&mut self) -> Result<(), Report> { - Ok(()) - } - - fn unfocus(&mut self) -> Result<(), Report> { - Ok(()) - } - - fn handle_events( - &mut self, - event: Event, - state: &mut State, - ) -> Result>, Report> { - let r = match event { - Event::Key(key_event) => self.handle_key_events(key_event, state)?, - Event::Mouse(mouse_event) => self.handle_mouse_events(mouse_event, state)?, - _ => None, - }; - Ok(r) - } - - fn handle_key_events( - &mut self, - _key: KeyEvent, - _state: &mut State, - ) -> Result>, Report> { - Ok(None) - } - - fn handle_mouse_events( - &mut self, - _mouse: MouseEvent, - _state: &mut State, - ) -> Result>, Report> { - Ok(None) - } - - fn update(&mut self, _action: Action, _state: &mut State) -> Result, Report> { - Ok(None) - } - - fn draw(&mut self, f: &mut Frame<'_>, area: Rect, state: &State) -> Result<(), Report>; -} diff --git a/midenc-debug/src/ui/panes/breakpoints.rs b/midenc-debug/src/ui/panes/breakpoints.rs deleted file mode 100644 index 4405cc125..000000000 --- a/midenc-debug/src/ui/panes/breakpoints.rs +++ /dev/null @@ -1,249 +0,0 @@ -use midenc_session::diagnostics::{Report, SourceId, SourceSpan}; -use ratatui::{ - prelude::*, - widgets::{block::*, *}, -}; - -use crate::{ - ui::{action::Action, panes::Pane, state::State, tui::Frame}, - Breakpoint, BreakpointType, ResolvedLocation, -}; - -pub struct BreakpointsPane { - focused: bool, - focused_border_style: Style, - breakpoint_selected: Option, - breakpoints_hit: Vec, - breakpoint_cycle: usize, -} - -impl BreakpointsPane { - pub fn new(focused: bool, focused_border_style: Style) -> Self { - Self { - focused, - focused_border_style, - breakpoint_selected: None, - breakpoints_hit: vec![], - breakpoint_cycle: 0, - } - } - - fn border_style(&self) -> Style { - match self.focused { - true => self.focused_border_style, - false => Style::default(), - } - } - - fn border_type(&self) -> BorderType { - match self.focused { - true => BorderType::Thick, - false => BorderType::Plain, - } - } -} - -impl Pane for BreakpointsPane { - fn height_constraint(&self) -> Constraint { - match self.focused { - true => Constraint::Fill(5), - false => Constraint::Fill(5), - } - } - - fn init(&mut self, state: &State) -> Result<(), Report> { - self.breakpoint_cycle = state.executor.cycle; - self.breakpoints_hit.clear(); - self.breakpoint_selected = None; - Ok(()) - } - - fn update(&mut self, action: Action, state: &mut State) -> Result, Report> { - match action { - Action::Focus => { - self.focused = true; - } - Action::UnFocus => { - self.focused = false; - } - Action::Down => { - if let Some(prev) = self.breakpoint_selected.take() { - self.breakpoint_selected = state - .breakpoints - .iter() - .find_map(|bp| if bp.id > prev { Some(bp.id) } else { None }) - .or_else(|| state.breakpoints.first().map(|bp| bp.id)); - } else { - self.breakpoint_selected = state.breakpoints.first().map(|bp| bp.id); - } - return Ok(Some(Action::Update)); - } - Action::Up => { - if let Some(prev) = self.breakpoint_selected.take() { - self.breakpoint_selected = state - .breakpoints - .iter() - .rev() - .find_map(|bp| if bp.id < prev { Some(bp.id) } else { None }) - .or_else(|| state.breakpoints.last().map(|bp| bp.id)); - } else { - self.breakpoint_selected = state.breakpoints.last().map(|bp| bp.id); - } - return Ok(Some(Action::Update)); - } - Action::Delete => { - if let Some(prev) = self.breakpoint_selected.take() { - state.breakpoints.retain(|bp| bp.id != prev); - let select_next = state - .breakpoints - .iter() - .find_map(|bp| if bp.id > prev { Some(bp.id) } else { None }) - .or_else(|| state.breakpoints.first().map(|bp| bp.id)); - self.breakpoint_selected = select_next; - } - } - Action::Reload => { - self.init(state)?; - } - Action::Update => { - if self.breakpoint_cycle < state.executor.cycle { - self.breakpoints_hit.clear(); - self.breakpoints_hit.append(&mut state.breakpoints_hit); - if let Some(prev) = self.breakpoint_selected { - if self.breakpoints_hit.iter().any(|bp| bp.id == prev && bp.is_one_shot()) { - self.breakpoint_selected = None; - } - } - } - self.breakpoint_cycle = state.executor.cycle; - } - _ => {} - } - - Ok(None) - } - - fn draw(&mut self, frame: &mut Frame<'_>, area: Rect, state: &State) -> Result<(), Report> { - use crate::Breakpoint; - - let mut breakpoints = self - .breakpoints_hit - .iter() - .map(|bp| (true, bp)) - .chain(state.breakpoints.iter().filter_map(|bp| { - if self.breakpoints_hit.iter().any(|hit| hit.id == bp.id) { - None - } else { - Some((false, bp)) - } - })) - .filter(|(_, bp)| !bp.is_internal()) - .collect::>(); - breakpoints.sort_by_key(|(_, bp)| bp.id); - let user_created_breakpoints = breakpoints.len(); - let user_breakpoints_hit = - self.breakpoints_hit.iter().filter(|bp| !bp.is_internal()).count(); - - let fg = Color::White; - let bg = Color::Black; - let yellow = Color::Yellow; - let gray = Color::Gray; - let fg_hit = Color::Red; - let bg_hit = Color::Black; - let yellow_hit = Color::LightRed; - let gray_hit = Color::DarkGray; - let selected_index = if let Some(id) = self.breakpoint_selected { - breakpoints.iter().position(|(_, bp)| bp.id == id) - } else { - None - }; - let lines = breakpoints - .into_iter() - .map(|(is_hit, bp)| { - let (fg, bg, gray, yellow) = if is_hit { - (fg_hit, bg_hit, gray_hit, yellow_hit) - } else { - (fg, bg, gray, yellow) - }; - let yellow = Style::default().fg(yellow).bg(bg); - let gray = Style::default().fg(gray).bg(bg); - let gutter = if is_hit { - Span::styled("! ", Color::Red) - } else { - Span::styled("", Style::default()) - }; - let line = match &bp.ty { - BreakpointType::Next | BreakpointType::Step | BreakpointType::Finish => { - unreachable!() - } - BreakpointType::StepN(n) => Line::from(vec![ - gutter, - Span::styled("cycle:", yellow), - Span::styled(format!("{}", bp.creation_cycle + *n), gray), - ]), - BreakpointType::StepTo(cycle) => Line::from(vec![ - gutter, - Span::styled("cycle:", yellow), - Span::styled(format!("{cycle}"), gray), - ]), - BreakpointType::File(ref pattern) => Line::from(vec![ - gutter, - Span::styled("file:", yellow), - Span::styled(pattern.as_str(), gray), - ]), - BreakpointType::Line { ref pattern, line } => Line::from(vec![ - gutter, - Span::styled("file:", yellow), - Span::styled(pattern.as_str(), gray), - Span::styled(format!(":{line}"), yellow), - ]), - BreakpointType::Called(ref pattern) => Line::from(vec![ - gutter, - Span::styled("proc:", yellow), - Span::styled(pattern.as_str(), gray), - ]), - BreakpointType::Opcode(ref op) => Line::from(vec![ - gutter, - Span::styled("opcode:", yellow), - Span::styled(format!("{op}"), gray), - ]), - }; - if is_hit { - line.patch_style(Style::default().add_modifier(Modifier::BOLD)) - } else { - line - } - }) - .collect::>(); - - let list = List::new(lines) - .block(Block::default().borders(Borders::ALL)) - .highlight_symbol(symbols::scrollbar::HORIZONTAL.end) - .highlight_spacing(HighlightSpacing::Always) - .highlight_style(Style::default().add_modifier(Modifier::BOLD)); - let mut list_state = ListState::default().with_selected(selected_index); - - let pane = Block::default() - .title("Breakpoints") - .borders(Borders::ALL) - .border_style(self.border_style()) - .border_type(self.border_type()); - let pane = if user_breakpoints_hit > 0 { - pane.title_bottom( - Line::styled( - format!( - " {user_breakpoints_hit} of {user_created_breakpoints} hit this cycle", - ), - Style::default().add_modifier(Modifier::ITALIC), - ) - .right_aligned(), - ) - } else { - pane - }; - - frame.render_stateful_widget(list, area, &mut list_state); - frame.render_widget(pane, area); - Ok(()) - } -} diff --git a/midenc-debug/src/ui/panes/debug.rs b/midenc-debug/src/ui/panes/debug.rs deleted file mode 100644 index 417fc2c32..000000000 --- a/midenc-debug/src/ui/panes/debug.rs +++ /dev/null @@ -1,134 +0,0 @@ -use std::collections::VecDeque; - -use crossterm::event::KeyCode; -use midenc_session::diagnostics::Report; -use ratatui::{ - prelude::*, - widgets::{block::*, *}, -}; - -use crate::{ - logger::{DebugLogger, LogEntry}, - ui::{ - action::Action, - panes::Pane, - state::{InputMode, State}, - tui::{EventResponse, Frame}, - }, -}; - -pub struct DebugPane { - logger: &'static DebugLogger, - entries: VecDeque, - selected_entry: Option, -} -impl Default for DebugPane { - fn default() -> Self { - Self { - logger: DebugLogger::get(), - entries: Default::default(), - selected_entry: None, - } - } -} - -impl DebugPane { - fn level_color(level: log::Level) -> Color { - use log::Level; - match level { - Level::Trace => Color::LightCyan, - Level::Debug => Color::LightMagenta, - Level::Info => Color::LightGreen, - Level::Warn => Color::LightYellow, - Level::Error => Color::LightRed, - } - } -} - -impl Pane for DebugPane { - fn height_constraint(&self) -> Constraint { - Constraint::Fill(3) - } - - fn handle_key_events( - &mut self, - key: crossterm::event::KeyEvent, - state: &mut State, - ) -> Result>, Report> { - match state.input_mode { - InputMode::Normal => { - let response = match key.code { - KeyCode::Down | KeyCode::Char('j') | KeyCode::Char('J') => { - EventResponse::Stop(Action::Down) - } - KeyCode::Up | KeyCode::Char('k') | KeyCode::Char('K') => { - EventResponse::Stop(Action::Up) - } - KeyCode::Esc => EventResponse::Stop(Action::ClosePopup), - _ => { - return Ok(Some(EventResponse::Stop(Action::Noop))); - } - }; - Ok(Some(response)) - } - InputMode::Insert => Ok(Some(EventResponse::Stop(Action::Noop))), - InputMode::Command => Ok(Some(EventResponse::Stop(Action::Noop))), - } - } - - fn update(&mut self, action: Action, _state: &mut State) -> Result, Report> { - let added = self.logger.take_captured(); - self.entries.extend(added); - match action { - Action::Down => { - let selected_entry = self - .selected_entry - .map(|s| s.saturating_add(1) % self.entries.len()) - .unwrap_or(self.entries.len().saturating_sub(1)); - self.selected_entry = Some(selected_entry); - return Ok(Some(Action::Update)); - } - Action::Up => { - let selected_entry = self - .selected_entry - .map(|s| s.wrapping_sub(1) % self.entries.len()) - .unwrap_or(self.entries.len().saturating_sub(1)); - self.selected_entry = Some(selected_entry); - return Ok(Some(Action::Update)); - } - _ => {} - } - Ok(None) - } - - fn draw(&mut self, frame: &mut Frame<'_>, area: Rect, _state: &State) -> Result<(), Report> { - frame.render_widget(Clear, area); - let items = self.entries.iter().map(|entry| { - Line::from(vec![ - Span::styled(format!(" {:6} | ", entry.level), Self::level_color(entry.level)), - Span::styled(entry.message.as_str(), Self::level_color(entry.level)), - ]) - }); - let selected = if self.entries.is_empty() { - None - } else { - Some(self.selected_entry.unwrap_or(self.entries.len().saturating_sub(1))) - }; - let list = List::new(items) - .block(Block::default().borders(Borders::ALL)) - .highlight_symbol(symbols::scrollbar::HORIZONTAL.end) - .highlight_spacing(HighlightSpacing::Always) - .highlight_style(Style::default().add_modifier(Modifier::BOLD)); - let mut list_state = ListState::default().with_selected(selected); - - frame.render_stateful_widget(list, area, &mut list_state); - frame.render_widget( - Block::default() - .borders(Borders::ALL) - .title("Debug Log") - .style(Style::default()), - area, - ); - Ok(()) - } -} diff --git a/midenc-debug/src/ui/panes/disasm.rs b/midenc-debug/src/ui/panes/disasm.rs deleted file mode 100644 index d7c75315a..000000000 --- a/midenc-debug/src/ui/panes/disasm.rs +++ /dev/null @@ -1,125 +0,0 @@ -use midenc_session::diagnostics::{Report, SourceId, SourceSpan}; -use ratatui::{ - prelude::*, - widgets::{block::*, *}, -}; - -use crate::{ - ui::{action::Action, panes::Pane, state::State, tui::Frame}, - ResolvedLocation, -}; - -pub struct DisassemblyPane { - focused: bool, - focused_border_style: Style, -} - -impl DisassemblyPane { - pub fn new(focused: bool, focused_border_style: Style) -> Self { - Self { - focused, - focused_border_style, - } - } - - fn border_style(&self) -> Style { - match self.focused { - true => self.focused_border_style, - false => Style::default(), - } - } - - fn border_type(&self) -> BorderType { - match self.focused { - true => BorderType::Thick, - false => BorderType::Plain, - } - } -} - -impl Pane for DisassemblyPane { - fn height_constraint(&self) -> Constraint { - match self.focused { - true => Constraint::Max(7), - false => Constraint::Max(7), - } - } - - fn update(&mut self, action: Action, _state: &mut State) -> Result, Report> { - match action { - Action::Focus => { - self.focused = true; - } - Action::UnFocus => { - self.focused = false; - } - _ => {} - } - - Ok(None) - } - - fn draw(&mut self, frame: &mut Frame<'_>, area: Rect, state: &State) -> Result<(), Report> { - let (current_proc, lines) = match state.executor.callstack.current_frame() { - None => { - let proc = Line::from("in ").right_aligned(); - ( - proc, - state - .executor - .recent - .iter() - .map(|op| Line::from(vec![Span::styled(format!(" | {op}"), Color::White)])) - .collect::>(), - ) - } - Some(frame) => { - let proc = frame - .procedure(state.session.name()) - .map(|proc| Line::from(format!("in {proc}"))) - .unwrap_or_else(|| Line::from("in ")) - .right_aligned(); - ( - proc, - frame - .recent() - .iter() - .map(|op| { - Line::from(vec![Span::styled( - format!(" | {}", &op.display()), - Color::White, - )]) - }) - .collect::>(), - ) - } - }; - let selected_line = lines.len().saturating_sub(1); - - let list = List::new(lines) - .block(Block::default().borders(Borders::ALL)) - .highlight_symbol(symbols::scrollbar::HORIZONTAL.end) - .highlight_spacing(HighlightSpacing::Always) - .highlight_style(Style::default().add_modifier(Modifier::BOLD)); - let mut list_state = ListState::default().with_selected(Some(selected_line)); - - frame.render_stateful_widget(list, area, &mut list_state); - frame.render_widget( - Block::default() - .title("Disassembly") - .borders(Borders::ALL) - .border_style(self.border_style()) - .border_type(self.border_type()) - .title_bottom(current_proc) - .title( - Line::styled( - format!(" at cycle {}", state.executor.cycle), - Style::default().add_modifier(Modifier::ITALIC), - ) - .right_aligned(), - ), - area, - ); - Ok(()) - } -} diff --git a/midenc-debug/src/ui/panes/footer.rs b/midenc-debug/src/ui/panes/footer.rs deleted file mode 100644 index 8e43b1389..000000000 --- a/midenc-debug/src/ui/panes/footer.rs +++ /dev/null @@ -1,205 +0,0 @@ -use std::{collections::VecDeque, time::Instant}; - -use midenc_session::diagnostics::Report; -use ratatui::{ - crossterm::{ - self, - event::{Event, KeyCode, KeyEvent}, - }, - prelude::*, - widgets::Paragraph, -}; -use tui_input::{backend::crossterm::EventHandler, Input}; - -use crate::ui::{ - action::Action, - panes::Pane, - state::{InputMode, State}, - tui::{EventResponse, Frame}, -}; - -struct TimedStatusLine { - created: Instant, - show_time: u64, - status_line: String, -} - -struct Config { - max_command_history: usize, -} - -static CONFIG: Config = Config { - max_command_history: 20, -}; - -#[derive(Default)] -pub struct FooterPane { - focused: bool, - input: Input, - command: String, - status_line: String, - timed_status_line: Option, - command_history: VecDeque, - command_history_index: Option, -} - -impl FooterPane { - pub fn new() -> Self { - Self { - focused: false, - ..Default::default() - } - } - - fn get_status_line(&mut self) -> &String { - if self - .timed_status_line - .as_ref() - .is_some_and(|tsl| tsl.created.elapsed().as_secs() < tsl.show_time) - { - return &self.timed_status_line.as_ref().unwrap().status_line; - } - self.timed_status_line = None; - &self.status_line - } -} - -impl Pane for FooterPane { - fn height_constraint(&self) -> Constraint { - Constraint::Max(1) - } - - fn handle_key_events( - &mut self, - key: KeyEvent, - state: &mut State, - ) -> Result>, Report> { - match state.input_mode { - InputMode::Command => { - self.input.handle_event(&Event::Key(key)); - let response = match key.code { - KeyCode::Enter => { - let command = self.input.to_string(); - if !command.is_empty() { - self.command_history.push_front(self.input.to_string()); - self.command_history.truncate(CONFIG.max_command_history); - self.command_history_index = None; - } - Some(EventResponse::Stop(Action::FooterResult( - self.command.clone(), - Some(command), - ))) - } - KeyCode::Esc => { - self.command_history_index = None; - Some(EventResponse::Stop(Action::FooterResult(self.command.clone(), None))) - } - KeyCode::Up if !self.command_history.is_empty() => { - let history_index = self - .command_history_index - .map(|idx| idx.saturating_add(1) % self.command_history.len()) - .unwrap_or(0); - self.input = self - .input - .clone() - .with_value(self.command_history[history_index].clone()); - self.command_history_index = Some(history_index); - None - } - KeyCode::Down if !self.command_history.is_empty() => { - let history_index = self - .command_history_index - .map(|idx| { - idx.saturating_add(self.command_history.len() - 1) - % self.command_history.len() - }) - .unwrap_or(self.command_history.len() - 1); - self.input = self - .input - .clone() - .with_value(self.command_history[history_index].clone()); - self.command_history_index = Some(history_index); - None - } - _ => None, - }; - Ok(response) - } - _ => Ok(None), - } - } - - fn update(&mut self, action: Action, state: &mut State) -> Result, Report> { - match action { - Action::FocusFooter(cmd, args) => { - self.focused = true; - state.input_mode = InputMode::Command; - if let Some(args) = args { - self.input = self.input.clone().with_value(args); - } else { - self.input = self.input.clone().with_value("".into()); - } - self.command = cmd; - Ok(Some(Action::Update)) - } - Action::FooterResult(..) => { - state.input_mode = InputMode::Normal; - self.focused = false; - Ok(Some(Action::Update)) - } - Action::StatusLine(status_line) => { - self.status_line = status_line; - Ok(None) - } - Action::TimedStatusLine(status_line, show_time) => { - self.timed_status_line = Some(TimedStatusLine { - status_line, - show_time, - created: Instant::now(), - }); - Ok(None) - } - _ => Ok(None), - } - } - - fn draw(&mut self, frame: &mut Frame<'_>, area: Rect, state: &State) -> Result<(), Report> { - if self.focused { - let mut area = area; - area.width = area.width.saturating_sub(4); - - let width = area.width.max(3); - let scroll = self.input.visual_scroll(width as usize - self.command.len()); - let input = Paragraph::new(Line::from(vec![ - Span::styled(&self.command, Style::default().fg(Color::LightBlue)), - Span::styled(self.input.value(), Style::default()), - ])) - .scroll((0, scroll as u16)); - frame.render_widget(input, area); - - frame.set_cursor_position(Position::new( - area.x - + ((self.input.visual_cursor()).max(scroll) - scroll) as u16 - + self.command.len() as u16, - area.y + 1, - )); - } else { - frame.render_widget( - Line::from(vec![Span::styled(self.get_status_line(), Style::default())]) - .style(Style::default().fg(Color::DarkGray)), - area, - ); - } - frame.render_widget( - Line::from(vec![match state.input_mode { - InputMode::Normal => Span::from("[N]"), - InputMode::Insert => Span::from("[I]"), - InputMode::Command => Span::from("[C]"), - }]) - .right_aligned(), - area, - ); - - Ok(()) - } -} diff --git a/midenc-debug/src/ui/panes/header.rs b/midenc-debug/src/ui/panes/header.rs deleted file mode 100644 index 14f39617d..000000000 --- a/midenc-debug/src/ui/panes/header.rs +++ /dev/null @@ -1,36 +0,0 @@ -use midenc_session::diagnostics::Report; -use ratatui::prelude::*; - -use crate::ui::{panes::Pane, state::State, tui::Frame}; - -#[derive(Default)] -pub struct HeaderPane; - -impl HeaderPane { - pub const fn new() -> Self { - Self - } -} - -impl Pane for HeaderPane { - fn height_constraint(&self) -> Constraint { - Constraint::Max(1) - } - - fn draw(&mut self, frame: &mut Frame<'_>, area: Rect, state: &State) -> Result<(), Report> { - frame.render_widget( - Line::from(vec![ - Span::styled( - format!("[ Miden Debugger {} ", symbols::DOT), - Style::default().fg(Color::Blue), - ), - Span::styled("0.1.0", Style::default().fg(Color::LightCyan)), - Span::styled("]", Style::default().fg(Color::Blue)), - ]) - .right_aligned(), - area, - ); - - Ok(()) - } -} diff --git a/midenc-debug/src/ui/panes/mod.rs b/midenc-debug/src/ui/panes/mod.rs deleted file mode 100644 index 6038fdf70..000000000 --- a/midenc-debug/src/ui/panes/mod.rs +++ /dev/null @@ -1,63 +0,0 @@ -use midenc_session::diagnostics::Report; -use ratatui::{ - crossterm::event::{self, KeyEvent, MouseEvent}, - layout::{Constraint, Rect}, -}; - -use super::{ - action::Action, - state::State, - tui::{Event, EventResponse, Frame}, -}; - -pub mod breakpoints; -pub mod debug; -pub mod disasm; -pub mod footer; -pub mod header; -pub mod source_code; -pub mod stack; -pub mod stacktrace; - -pub trait Pane { - fn init(&mut self, _state: &State) -> Result<(), Report> { - Ok(()) - } - - fn height_constraint(&self) -> Constraint; - - fn handle_events( - &mut self, - event: Event, - state: &mut State, - ) -> Result>, Report> { - let r = match event { - Event::Key(key_event) => self.handle_key_events(key_event, state)?, - Event::Mouse(mouse_event) => self.handle_mouse_events(mouse_event, state)?, - _ => None, - }; - Ok(r) - } - - fn handle_key_events( - &mut self, - _key: KeyEvent, - _state: &mut State, - ) -> Result>, Report> { - Ok(None) - } - - fn handle_mouse_events( - &mut self, - _mouse: MouseEvent, - _state: &mut State, - ) -> Result>, Report> { - Ok(None) - } - - fn update(&mut self, _action: Action, _state: &mut State) -> Result, Report> { - Ok(None) - } - - fn draw(&mut self, f: &mut Frame<'_>, area: Rect, state: &State) -> Result<(), Report>; -} diff --git a/midenc-debug/src/ui/panes/source_code.rs b/midenc-debug/src/ui/panes/source_code.rs deleted file mode 100644 index 7187a0357..000000000 --- a/midenc-debug/src/ui/panes/source_code.rs +++ /dev/null @@ -1,503 +0,0 @@ -use std::{collections::BTreeMap, ops::Deref, sync::Arc}; - -use miden_assembly::diagnostics::SourceCode; -use midenc_session::diagnostics::{LineIndex, Report, SourceFile, SourceId, SourceSpan}; -use ratatui::{ - prelude::*, - widgets::{block::*, *}, -}; - -use crate::{ - ui::{ - action::Action, - panes::Pane, - state::State, - syntax_highlighting::{Highlighter, HighlighterState, NoopHighlighter, SyntectHighlighter}, - tui::Frame, - }, - ResolvedLocation, -}; - -pub struct SourceCodePane { - focused: bool, - current_source_id: SourceId, - current_span: SourceSpan, - current_line: u32, - current_col: u32, - num_lines: u32, - selected_line: u32, - syntax_highlighter: Box, - syntax_highlighting_states: BTreeMap>, - current_file: Option, - theme: Theme, -} - -struct HighlightedFile { - source_file: Arc, - /// The syntax highlighted lines of `source_file`, cached so that patching - /// them with the current selected line can be done efficiently - lines: Vec>>, - selected_line: u32, - selected_span: SourceSpan, - gutter_width: u8, -} - -impl SourceCodePane { - fn highlight_file(&mut self, resolved: &ResolvedLocation) -> HighlightedFile { - let highlighter_state = self - .syntax_highlighting_states - .entry(resolved.source_file.id()) - .or_insert_with(|| { - let span_contents = resolved - .source_file - .read_span(&resolved.source_file.source_span().into(), 0, 0) - .expect("failed to read span of file"); - self.syntax_highlighter.start_highlighter_state(span_contents.as_ref()) - }); - let resolved_span = resolved.span.into_slice_index(); - let content = resolved.source_file.content(); - let last_line = content.last_line_index(); - let max_line_no = last_line.number().to_usize(); - let gutter_width = max_line_no.ilog10() as u8; - let lines = (0..(max_line_no - 1)) - .map(|line_index| { - let line_index = miden_debug_types::LineIndex::from(line_index as u32); - let line_no = line_index.number().to_u32(); - let span = content.line_range(line_index).expect("invalid line index"); - let span = span.start.to_usize()..span.end.to_usize(); - - let line_content = strip_newline(&content.as_bytes()[span.start..span.end]); - - // Only highlight a portion of the line if the full span fits on that line - let is_highlighted = span.contains(&resolved_span.start) - && span.contains(&resolved_span.end) - && span != resolved_span; - - let line_content = - strip_newline(&content.as_bytes()[span.start..span.end]).into_owned(); - let highlighted = if is_highlighted { - let selection = if resolved.span.is_empty() { - // Select the closest character to the span - //let start = core::cmp::max(span.start, resolved_span.start); - //let end = core::cmp::min(span.end, resolved_span.end.saturating_add(1)); - //(start - span.start)..(end - span.start) - 0..(span.end - span.start) - } else { - (resolved_span.start - span.start)..(resolved_span.end - span.start) - }; - highlighter_state.highlight_line_with_selection( - line_content.into(), - selection, - self.theme.current_span, - ) - } else { - highlighter_state.highlight_line(line_content.into()) - }; - - highlighted - }) - .collect::>(); - - HighlightedFile { - source_file: resolved.source_file.clone(), - lines, - selected_line: resolved.line, - selected_span: resolved.span, - gutter_width, - } - } - - /// Get the cached lines of the source file, or compute them for the first time - /// if the file has changed. - /// - /// Each line consists of a vector of styled [Span]s, so that we can modify the - /// styles based on the relevant source span. - fn current_source_lines(&mut self, resolved: &ResolvedLocation) -> Vec>> { - let file_changed = self - .current_file - .as_ref() - .map(|file| file.source_file.id() != resolved.source_file.id()) - .unwrap_or(true); - - // NOTE: We could cache all of the files we highlight, but that could get memory-dense - if file_changed { - let file = self.highlight_file(resolved); - let lines = file.lines.clone(); - self.current_file = Some(file); - lines - } else { - self.current_file.as_ref().unwrap().lines.clone() - } - } - - /// Get the [ResolvedLocation] for the current state - fn current_location(&self, state: &State) -> Option { - match state.executor.callstack.current_frame() { - Some(frame) => { - let resolved = frame.last_resolved(&state.session); - resolved.cloned() - } - None if !self.current_source_id.is_unknown() => { - let source_file = state.session.source_manager.get(self.current_source_id).ok(); - source_file.map(|src| ResolvedLocation { - source_file: src, - line: self.current_line, - col: self.current_col, - span: self.current_span, - }) - } - None => { - // Render empty source pane - None - } - } - } -} - -struct Theme { - focused_border_style: Style, - current_line: Style, - current_span: Style, - line_number: Style, - gutter_border: Style, -} -impl Default for Theme { - fn default() -> Self { - Self { - focused_border_style: Style::default(), - current_line: Style::default() - .bg(Color::Black) - .fg(Color::White) - .add_modifier(Modifier::BOLD), - current_span: Style::default() - .fg(Color::White) - .bg(Color::DarkGray) - .add_modifier(Modifier::BOLD), - line_number: Style::default(), - gutter_border: Style::default(), - } - } -} -impl Theme { - pub fn patch_from_syntect(&mut self, theme: &syntect::highlighting::Theme) { - use crate::ui::syntax_highlighting::convert_color; - if let Some(bg) = theme.settings.line_highlight.map(convert_color) { - self.current_line.bg = Some(bg); - } - if let Some(bg) = theme.settings.selection.map(convert_color) { - self.current_span.bg = Some(bg); - } - if let Some(fg) = theme.settings.selection_foreground.map(convert_color) { - self.current_span.fg = Some(fg); - } - if let Some(bg) = theme.settings.gutter.map(convert_color) { - self.line_number.bg = Some(bg); - self.gutter_border.bg = Some(bg); - } - if let Some(fg) = theme.settings.gutter_foreground.map(convert_color) { - self.line_number.fg = Some(fg); - self.gutter_border.fg = Some(fg); - } - } -} - -impl SourceCodePane { - pub fn new(focused: bool, focused_border_style: Style) -> Self { - let theme = Theme { - focused_border_style, - ..Default::default() - }; - Self { - focused, - current_source_id: SourceId::UNKNOWN, - num_lines: 0, - selected_line: 0, - current_line: 0, - current_col: 0, - current_span: SourceSpan::default(), - syntax_highlighter: Box::new(NoopHighlighter), - syntax_highlighting_states: Default::default(), - current_file: None, - theme, - } - } - - fn reload(&mut self, state: &State) { - self.current_source_id = SourceId::UNKNOWN; - self.current_span = SourceSpan::default(); - self.current_line = 0; - self.current_col = 0; - self.num_lines = 0; - self.selected_line = 0; - self.current_file = None; - - if let Some(frame) = state.executor.callstack.current_frame() { - if let Some(loc) = frame.last_resolved(&state.session) { - self.current_source_id = loc.source_file.id(); - self.current_span = loc.span; - self.current_line = loc.line; - self.current_col = loc.col; - self.num_lines = loc.source_file.line_count() as u32; - self.selected_line = loc.line; - } - } - } - - fn border_style(&self) -> Style { - match self.focused { - true => self.theme.focused_border_style, - false => Style::default(), - } - } - - fn border_type(&self) -> BorderType { - match self.focused { - true => BorderType::Thick, - false => BorderType::Plain, - } - } - - fn enable_syntax_highlighting(&mut self, state: &State) { - use std::io::IsTerminal; - - use midenc_session::ColorChoice; - - let nocolor = !state.session.options.color.should_attempt_color(); - if nocolor { - return; - } - - let syntax_set = syntect::parsing::SyntaxSet::load_defaults_nonewlines(); - let theme_set = syntect::highlighting::ThemeSet::load_defaults(); - let theme = theme_set.themes["base16-eighties.dark"].clone(); - self.theme.patch_from_syntect(&theme); - self.syntax_highlighter = Box::new(SyntectHighlighter::new(syntax_set, theme, false)); - } -} - -impl Pane for SourceCodePane { - fn init(&mut self, state: &State) -> Result<(), Report> { - self.enable_syntax_highlighting(state); - - if let Some(frame) = state.executor.callstack.current_frame() { - if let Some(loc) = frame.last_resolved(&state.session) { - self.current_source_id = loc.source_file.id(); - self.current_span = loc.span; - self.current_line = loc.line; - self.current_col = loc.col; - self.num_lines = loc.source_file.line_count() as u32; - self.selected_line = loc.line; - } - } - - Ok(()) - } - - fn height_constraint(&self) -> Constraint { - match self.focused { - true => Constraint::Fill(3), - false => Constraint::Fill(3), - } - } - - fn update(&mut self, action: Action, state: &mut State) -> Result, Report> { - match action { - Action::Down => { - if self.num_lines > 0 { - self.selected_line = self.selected_line.saturating_add(1) % self.num_lines; - } - return Ok(Some(Action::Update)); - } - Action::Up => { - if self.num_lines > 0 { - self.selected_line = - self.selected_line.saturating_add(self.num_lines.saturating_sub(1)) - % self.num_lines; - } - return Ok(Some(Action::Update)); - } - Action::Focus => { - self.focused = true; - static STATUS_LINE: &str = "[j,k → movement]"; - return Ok(Some(Action::TimedStatusLine(STATUS_LINE.into(), 3))); - } - Action::UnFocus => { - self.focused = false; - } - Action::Submit => {} - Action::Update | Action::Reload => { - if action == Action::Reload { - self.reload(state); - } - - if let Some(frame) = state.executor.callstack.current_frame() { - if let Some(loc) = frame.last_resolved(&state.session) { - let source_id = loc.source_file.id(); - if source_id != self.current_source_id { - self.current_source_id = source_id; - self.num_lines = loc.source_file.line_count() as u32; - self.selected_line = loc.line; - } else if self.selected_line != loc.line { - self.selected_line = loc.line; - } - self.current_span = loc.span; - self.current_line = loc.line; - self.current_col = loc.col; - } - } - } - _ => {} - } - - Ok(None) - } - - fn draw(&mut self, frame: &mut Frame<'_>, area: Rect, state: &State) -> Result<(), Report> { - let resolved = self.current_location(state); - if resolved.is_none() { - frame.render_widget( - Block::default() - .title("Source Code") - .borders(Borders::ALL) - .border_style(self.border_style()) - .border_type(self.border_type()) - .title_bottom( - Line::from("no source code available for current instruction") - .right_aligned(), - ) - .title( - Line::styled("nofile", Style::default().add_modifier(Modifier::ITALIC)) - .right_aligned(), - ), - area, - ); - return Ok(()); - } - - let resolved = unsafe { resolved.unwrap_unchecked() }; - - // Get the cached (highlighted) lines for the current source file - let mut lines = self.current_source_lines(&resolved); - let selected_line = resolved.line.saturating_sub(1) as usize; - // Extract the current selected line as a vector of raw syntect parts - let selected_line_deconstructed = lines[selected_line] - .iter() - .map(|span| { - ( - crate::ui::syntax_highlighting::convert_to_syntect_style(span.style, false), - span.content.as_ref(), - ) - }) - .collect::>(); - - // Modify the selected line's highlighting style to reflect the selection - let syntect_style = syntect::highlighting::StyleModifier { - foreground: self - .theme - .current_span - .fg - .map(crate::ui::syntax_highlighting::convert_to_syntect_color), - background: self - .theme - .current_span - .bg - .map(crate::ui::syntax_highlighting::convert_to_syntect_color), - font_style: if self.theme.current_span.add_modifier.is_empty() { - None - } else { - Some(crate::ui::syntax_highlighting::convert_to_font_style( - self.theme.current_span.add_modifier, - )) - }, - }; - let span = resolved - .source_file - .content() - .line_range((selected_line as u32).into()) - .unwrap(); - let resolved_span = resolved.span.into_slice_index(); - let selected = if resolved.span.is_empty() { - // Select the closest character to the span - 0..(span.end.to_usize() - span.start.to_usize()) - } else { - (resolved_span.start - span.start.to_usize()) - ..(resolved_span.end - span.start.to_usize()) - }; - let highlighter_state = - self.syntax_highlighting_states.get_mut(&resolved.source_file.id()).unwrap(); - let mut parts = syntect::util::modify_range( - selected_line_deconstructed.as_slice(), - selected, - syntect_style, - ) - .into_iter() - .map(|(style, str)| { - Span::styled( - str.to_string(), - crate::ui::syntax_highlighting::convert_style(style, true), - ) - }) - .collect(); - lines[selected_line].clear(); - lines[selected_line].append(&mut parts); - - let gutter_width = self.current_file.as_ref().unwrap().gutter_width as usize; - let lines = lines.into_iter().enumerate().map(|(line_index, highlighted_parts)| { - let line_number_style = if line_index == selected_line { - self.theme.current_line - } else { - self.theme.line_number - }; - Line::from_iter( - [ - Span::styled( - format!("{line_no:gutter_width$}", line_no = line_index + 1), - line_number_style, - ), - Span::styled(" | ", line_number_style), - ] - .into_iter() - .chain(highlighted_parts), - ) - }); - - // Render the syntax-highlighted lines - let selected_line = self.selected_line.saturating_sub(1); - let list = List::new(lines) - .block(Block::default().borders(Borders::ALL)) - .highlight_symbol(symbols::scrollbar::HORIZONTAL.end) - .highlight_spacing(HighlightSpacing::Always) - .scroll_padding(15); - let mut list_state = ListState::default().with_selected(Some(selected_line as usize)); - - frame.render_stateful_widget(list, area, &mut list_state); - frame.render_widget( - Block::default() - .title("Source Code") - .borders(Borders::ALL) - .border_style(self.border_style()) - .border_type(self.border_type()) - .title_bottom( - Line::from(format!("{} of {}", self.selected_line, self.num_lines,)) - .right_aligned(), - ) - .title( - Line::styled( - resolved.source_file.deref().uri().as_str(), - Style::default().add_modifier(Modifier::ITALIC), - ) - .right_aligned(), - ), - area, - ); - Ok(()) - } -} - -fn strip_newline(s: &[u8]) -> std::borrow::Cow<'_, str> { - if let Some(sans_newline) = s.strip_suffix(b"\n") { - String::from_utf8_lossy(sans_newline) - } else { - String::from_utf8_lossy(s) - } -} diff --git a/midenc-debug/src/ui/panes/stack.rs b/midenc-debug/src/ui/panes/stack.rs deleted file mode 100644 index cbfc56298..000000000 --- a/midenc-debug/src/ui/panes/stack.rs +++ /dev/null @@ -1,100 +0,0 @@ -use midenc_session::diagnostics::{Report, SourceId, SourceSpan}; -use ratatui::{ - prelude::*, - widgets::{block::*, *}, -}; - -use crate::{ - ui::{action::Action, panes::Pane, state::State, tui::Frame}, - ResolvedLocation, -}; - -pub struct OperandStackPane { - focused: bool, - focused_border_style: Style, -} - -impl OperandStackPane { - pub fn new(focused: bool, focused_border_style: Style) -> Self { - Self { - focused, - focused_border_style, - } - } - - fn border_style(&self) -> Style { - match self.focused { - true => self.focused_border_style, - false => Style::default(), - } - } - - fn border_type(&self) -> BorderType { - match self.focused { - true => BorderType::Thick, - false => BorderType::Plain, - } - } -} - -impl Pane for OperandStackPane { - fn height_constraint(&self) -> Constraint { - match self.focused { - true => Constraint::Max(30), - false => Constraint::Max(30), - } - } - - fn update(&mut self, action: Action, _state: &mut State) -> Result, Report> { - match action { - Action::Focus => { - self.focused = true; - } - Action::UnFocus => { - self.focused = false; - } - _ => {} - } - - Ok(None) - } - - fn draw(&mut self, frame: &mut Frame<'_>, area: Rect, state: &State) -> Result<(), Report> { - let lines = match state.executor.last.as_ref() { - None => vec![], - Some(state) => state - .stack - .iter() - .rev() - .map(|item| Line::from(Span::styled(format!(" {}", item.as_int()), Color::White))) - .collect(), - }; - - let depth = lines.len(); - let selected_line = depth.saturating_sub(1); - let list = List::new(lines) - .block(Block::default().borders(Borders::ALL)) - .highlight_symbol(symbols::scrollbar::HORIZONTAL.end) - .highlight_spacing(HighlightSpacing::Always) - .highlight_style(Style::default().add_modifier(Modifier::BOLD)); - let mut list_state = ListState::default().with_selected(Some(selected_line)); - - frame.render_stateful_widget(list, area, &mut list_state); - frame.render_widget( - Block::default() - .title("Operand Stack") - .borders(Borders::ALL) - .border_style(self.border_style()) - .border_type(self.border_type()) - .title_bottom( - Line::styled( - format!("depth is {depth}"), - Style::default().add_modifier(Modifier::ITALIC), - ) - .right_aligned(), - ), - area, - ); - Ok(()) - } -} diff --git a/midenc-debug/src/ui/panes/stacktrace.rs b/midenc-debug/src/ui/panes/stacktrace.rs deleted file mode 100644 index 17b9bc882..000000000 --- a/midenc-debug/src/ui/panes/stacktrace.rs +++ /dev/null @@ -1,154 +0,0 @@ -use midenc_session::diagnostics::{Report, SourceId, SourceSpan}; -use ratatui::{ - prelude::*, - widgets::{block::*, *}, -}; - -use crate::{ - ui::{action::Action, panes::Pane, state::State, tui::Frame}, - ResolvedLocation, -}; - -pub struct StackTracePane { - focused: bool, - focused_border_style: Style, -} - -impl StackTracePane { - pub fn new(focused: bool, focused_border_style: Style) -> Self { - Self { - focused, - focused_border_style, - } - } - - fn border_style(&self) -> Style { - match self.focused { - true => self.focused_border_style, - false => Style::default(), - } - } - - fn border_type(&self) -> BorderType { - match self.focused { - true => BorderType::Thick, - false => BorderType::Plain, - } - } -} - -impl Pane for StackTracePane { - fn height_constraint(&self) -> Constraint { - match self.focused { - true => Constraint::Max(15), - false => Constraint::Max(15), - } - } - - fn update(&mut self, action: Action, _state: &mut State) -> Result, Report> { - match action { - Action::Focus => { - self.focused = true; - } - Action::UnFocus => { - self.focused = false; - } - _ => {} - } - - Ok(None) - } - - fn draw(&mut self, frame: &mut Frame<'_>, area: Rect, state: &State) -> Result<(), Report> { - let mut lines = Vec::default(); - let num_frames = state.executor.callstack.frames().len(); - for (i, frame) in state.executor.callstack.frames().iter().enumerate() { - let is_top = i + 1 == num_frames; - let mut parts = vec![]; - /* - let gutter = if is_top { - Span::styled(" `-> ", Color::Magenta) - } else { - Span::styled(" |-> ", Color::Gray) - }; - */ - let gutter = Span::styled(" ", Color::White); - parts.push(gutter); - let name = frame.procedure(state.session.name()); - let name = name.as_deref().unwrap_or("").to_string(); - let name = if is_top { - Span::styled(name, Color::Gray) - } else { - Span::styled( - name, - Style::default().fg(Color::White).bg(Color::Black).add_modifier(Modifier::BOLD), - ) - }; - parts.push(name); - if let Some(resolved) = frame.last_resolved(&state.session) { - parts.push(Span::styled(" in ", Color::DarkGray)); - let path = std::path::Path::new(resolved.source_file.as_ref().uri().as_str()); - let path = path - .strip_prefix(state.session.options.current_dir.as_path()) - .ok() - .unwrap_or(path); - let path_str = path.to_string_lossy(); - let max_width = (area.as_size().width as usize).saturating_sub(4); - let path_width = path_str.chars().count(); - if path_width >= max_width { - let trim_min = path_width - max_width; - let mut taken = 0; - let mut components = path.components(); - while taken < trim_min { - match components.next() { - Some(std::path::Component::CurDir) => break, - Some( - std::path::Component::ParentDir - | std::path::Component::Prefix(_) - | std::path::Component::RootDir, - ) => continue, - Some(std::path::Component::Normal(c)) => { - let c = c.to_string_lossy(); - taken += c.chars().count(); - } - None => break, - } - } - parts.push(Span::styled( - format!("{}", components.as_path().display()), - Color::Cyan, - )); - } else { - parts.push(Span::styled(path_str, Color::Cyan)); - } - parts.push(Span::styled( - format!(" {}:{}", resolved.line, resolved.col), - Color::Green, - )); - } else { - parts.push(Span::styled(" in ", Color::DarkGray)); - } - lines.push(Line::from(parts)); - } - - let selected_line = lines.len().saturating_sub(1); - - let list = List::new(lines) - .block(Block::default().borders(Borders::ALL)) - .highlight_symbol(symbols::scrollbar::HORIZONTAL.end) - .highlight_spacing(HighlightSpacing::Always) - .highlight_style(Style::default().add_modifier(Modifier::BOLD)); - let mut list_state = ListState::default().with_selected(Some(selected_line)); - - frame.render_stateful_widget(list, area, &mut list_state); - frame.render_widget( - Block::default() - .title("Stack Trace") - .borders(Borders::ALL) - .border_style(self.border_style()) - .border_type(self.border_type()), - area, - ); - Ok(()) - } -} diff --git a/midenc-debug/src/ui/state.rs b/midenc-debug/src/ui/state.rs deleted file mode 100644 index 2ea4d0295..000000000 --- a/midenc-debug/src/ui/state.rs +++ /dev/null @@ -1,302 +0,0 @@ -use std::{rc::Rc, sync::Arc}; - -use miden_assembly::Library; -use miden_core::{utils::Deserializable, FieldElement}; -use miden_processor::{Felt, Program, StackInputs}; -use midenc_session::{ - diagnostics::{IntoDiagnostic, Report, SourceSpan, Span, WrapErr}, - InputType, Session, -}; - -use crate::{ - Breakpoint, BreakpointType, DebugExecutor, DebuggerConfig, ExecutionTrace, ReadMemoryExpr, -}; - -pub struct State { - pub package: Arc, - pub inputs: DebuggerConfig, - pub executor: DebugExecutor, - pub execution_trace: ExecutionTrace, - pub execution_failed: Option, - pub session: Rc, - pub input_mode: InputMode, - pub breakpoints: Vec, - pub breakpoints_hit: Vec, - pub next_breakpoint_id: u8, - pub stopped: bool, - pub execution_duration: std::time::Duration, -} - -#[derive(Default, Debug, Copy, Clone, PartialEq, Eq)] -pub enum InputMode { - #[default] - Normal, - Insert, - Command, -} - -impl State { - pub fn from_inputs( - inputs: Option, - mut args: Vec, - session: Rc, - ) -> Result { - let mut inputs = inputs.unwrap_or_default(); - if !args.is_empty() { - args.reverse(); - inputs.inputs = StackInputs::new(args).into_diagnostic()?; - } - let args = inputs.inputs.iter().copied().rev().collect::>(); - let package = load_package(&session)?; - - let mut executor = crate::Executor::for_package(&package.clone(), args.clone(), &session)?; - executor.with_advice_inputs(inputs.advice_inputs.clone()); - for link_library in session.options.link_libraries.iter() { - let lib = link_library.load(&session)?; - executor.with_library(&lib); - } - - let program = package.unwrap_program(); - let executor = executor.into_debug(&program, &session); - - // Execute the program until it terminates to capture a full trace for use during debugging - let mut trace_executor = crate::Executor::for_package(&package, args, &session)?; - trace_executor.with_advice_inputs(inputs.advice_inputs.clone()); - for link_library in session.options.link_libraries.iter() { - let lib = link_library.load(&session)?; - trace_executor.with_library(&lib); - } - - let now = std::time::Instant::now(); - let execution_trace = trace_executor.capture_trace(&program, &session); - let execution_duration = now.elapsed(); - - Ok(Self { - package, - inputs, - executor, - execution_trace, - execution_failed: None, - session, - input_mode: InputMode::Normal, - breakpoints: vec![], - breakpoints_hit: vec![], - next_breakpoint_id: 0, - stopped: true, - execution_duration, - }) - } - - pub fn reload(&mut self) -> Result<(), Report> { - log::debug!("reloading program"); - let package = load_package(&self.session)?; - let args = self.inputs.inputs.iter().copied().rev().collect::>(); - - let mut executor = crate::Executor::for_package(&package, args.clone(), &self.session)?; - executor.with_advice_inputs(self.inputs.advice_inputs.clone()); - for link_library in self.session.options.link_libraries.iter() { - let lib = link_library.load(&self.session)?; - executor.with_library(&lib); - } - let program = package.unwrap_program(); - let executor = executor.into_debug(&program, &self.session); - - // Execute the program until it terminates to capture a full trace for use during debugging - let mut trace_executor = crate::Executor::for_package(&package, args, &self.session)?; - trace_executor.with_advice_inputs(self.inputs.advice_inputs.clone()); - for link_library in self.session.options.link_libraries.iter() { - let lib = link_library.load(&self.session)?; - trace_executor.with_library(&lib); - } - let execution_trace = trace_executor.capture_trace(&program, &self.session); - - self.package = package; - self.executor = executor; - self.execution_trace = execution_trace; - self.execution_failed = None; - self.breakpoints_hit.clear(); - let breakpoints = core::mem::take(&mut self.breakpoints); - self.breakpoints.reserve(breakpoints.len()); - self.next_breakpoint_id = 0; - self.stopped = true; - for bp in breakpoints { - self.create_breakpoint(bp.ty); - } - Ok(()) - } - - pub fn create_breakpoint(&mut self, ty: BreakpointType) { - let id = self.next_breakpoint_id(); - let creation_cycle = self.executor.cycle; - log::trace!("created breakpoint with id {id} at cycle {creation_cycle}"); - if matches!(ty, BreakpointType::Finish) { - if let Some(frame) = self.executor.callstack.current_frame_mut() { - frame.break_on_exit(); - } - } - self.breakpoints.push(Breakpoint { - id, - creation_cycle, - ty, - }); - } - - fn next_breakpoint_id(&mut self) -> u8 { - let mut candidate = self.next_breakpoint_id; - let mut initial = candidate; - let mut next = candidate.wrapping_add(1); - loop { - assert_ne!(initial, next, "unable to allocate a breakpoint id: too many breakpoints"); - if self - .breakpoints - .iter() - .chain(self.breakpoints_hit.iter()) - .any(|bp| bp.id == candidate) - { - candidate = next; - next = candidate.wrapping_add(1); - continue; - } - self.next_breakpoint_id = next; - break candidate; - } - } -} - -macro_rules! write_with_format_type { - ($out:ident, $read_expr:ident, $value:expr) => { - match $read_expr.format { - crate::FormatType::Decimal => write!(&mut $out, "{}", $value).unwrap(), - crate::FormatType::Hex => write!(&mut $out, "{:0x}", $value).unwrap(), - crate::FormatType::Binary => write!(&mut $out, "{:0b}", $value).unwrap(), - } - }; -} - -impl State { - pub fn read_memory(&self, expr: &ReadMemoryExpr) -> Result { - use core::fmt::Write; - - use midenc_hir::Type; - - let cycle = miden_processor::RowIndex::from(self.executor.cycle); - let context = self.executor.current_context; - let mut output = String::new(); - if expr.count > 1 { - return Err("-count with value > 1 is not yet implemented".into()); - } else if matches!(expr.ty, Type::Felt) { - if !expr.addr.is_element_aligned() { - return Err( - "read failed: type 'felt' must be aligned to an element boundary".into() - ); - } - let felt = self - .execution_trace - .read_memory_element_in_context(expr.addr.addr, context, cycle) - .unwrap_or(Felt::ZERO); - write_with_format_type!(output, expr, felt.as_int()); - } else if matches!( - expr.ty, - Type::Array(ref array_ty) if array_ty.element_type() == &Type::Felt && array_ty.len() == 4 - ) { - if !expr.addr.is_word_aligned() { - return Err("read failed: type 'word' must be aligned to a word boundary".into()); - } - let word = self.execution_trace.read_memory_word(expr.addr.addr).unwrap_or_default(); - output.push('['); - for (i, elem) in word.iter().enumerate() { - if i > 0 { - output.push_str(", "); - } - write_with_format_type!(output, expr, elem.as_int()); - } - output.push(']'); - } else { - let bytes = self - .execution_trace - .read_bytes_for_type(expr.addr, &expr.ty, context, cycle) - .map_err(|err| format!("invalid read: {err}"))?; - match &expr.ty { - Type::I1 => match expr.format { - crate::FormatType::Decimal => write!(&mut output, "{}", bytes[0] != 0).unwrap(), - crate::FormatType::Hex => { - write!(&mut output, "{:#0x}", (bytes[0] != 0) as u8).unwrap() - } - crate::FormatType::Binary => { - write!(&mut output, "{:#0b}", (bytes[0] != 0) as u8).unwrap() - } - }, - Type::I8 => write_with_format_type!(output, expr, bytes[0] as i8), - Type::U8 => write_with_format_type!(output, expr, bytes[0]), - Type::I16 => { - write_with_format_type!(output, expr, i16::from_be_bytes([bytes[0], bytes[1]])) - } - Type::U16 => { - write_with_format_type!(output, expr, u16::from_be_bytes([bytes[0], bytes[1]])) - } - Type::I32 => write_with_format_type!( - output, - expr, - i32::from_be_bytes([bytes[0], bytes[1], bytes[2], bytes[3]]) - ), - Type::U32 => write_with_format_type!( - output, - expr, - u32::from_be_bytes([bytes[0], bytes[1], bytes[2], bytes[3]]) - ), - ty @ (Type::I64 | Type::U64) => { - let mut hi = - u32::from_be_bytes([bytes[0], bytes[1], bytes[2], bytes[3]]) as u64; - let mut lo = - u32::from_be_bytes([bytes[4], bytes[5], bytes[6], bytes[7]]) as u64; - let val = (hi * 2u64.pow(32)) + lo; - if matches!(ty, Type::I64) { - write_with_format_type!(output, expr, val as i64) - } else { - write_with_format_type!(output, expr, val) - } - } - ty => { - return Err(format!("support for reads of type '{ty}' are not implemented yet")) - } - } - } - - Ok(output) - } -} - -fn load_package(session: &Session) -> Result, Report> { - let package = match &session.inputs[0].file { - InputType::Real(ref path) => { - let bytes = std::fs::read(path).into_diagnostic()?; - miden_mast_package::Package::read_from_bytes(&bytes) - .map(Arc::new) - .map_err(|e| { - Report::msg(format!( - "failed to load Miden package from {}: {e}", - path.display() - )) - })? - } - InputType::Stdin { input, .. } => { - miden_mast_package::Package::read_from_bytes(input.as_slice()) - .map(Arc::new) - .map_err(|e| Report::msg(format!("failed to load Miden package from stdin: {e}")))? - } - }; - - if let Some(entry) = session.options.entrypoint.as_ref() { - // Input must be a library, not a program - let id = entry - .parse::() - .map_err(|_| Report::msg(format!("invalid function identifier: '{entry}'")))?; - if !package.is_library() { - return Err(Report::msg("cannot use --entrypoint with executable packages")); - } - - package.make_executable(&id).map(Arc::new) - } else { - Ok(package) - } -} diff --git a/midenc-debug/src/ui/syntax_highlighting.rs b/midenc-debug/src/ui/syntax_highlighting.rs deleted file mode 100644 index 5b55babe9..000000000 --- a/midenc-debug/src/ui/syntax_highlighting.rs +++ /dev/null @@ -1,459 +0,0 @@ -use std::{borrow::Cow, ops::Range, path::Path, rc::Rc}; - -mod syntax { - pub(super) use syntect::{ - highlighting::{ - Color, FontStyle, HighlightIterator, HighlightState, Highlighter, Style, StyleModifier, - Theme, ThemeSet, - }, - parsing::{ParseState, ScopeStack, SyntaxReference, SyntaxSet}, - }; -} - -use midenc_session::diagnostics::miette::SpanContents; -use ratatui::{ - style::{Color, Modifier, Style}, - text::{Line, Span}, -}; - -pub trait Highlighter { - /// Creates a new [HighlighterState] to begin parsing and highlighting - /// a [SpanContents]. - /// - /// The [GraphicalReportHandler](crate::GraphicalReportHandler) will call - /// this method at the start of rendering a [SpanContents]. - /// - /// The [SpanContents] is provided as input only so that the [Highlighter] - /// can detect language syntax and make other initialization decisions prior - /// to highlighting, but it is not intended that the Highlighter begin - /// highlighting at this point. The returned [HighlighterState] is - /// responsible for the actual rendering. - fn start_highlighter_state(&self, source: &dyn SpanContents<'_>) -> Box; -} - -/// A stateful highlighter that incrementally highlights lines of a particular -/// source code. -/// -/// The [GraphicalReportHandler](crate::GraphicalReportHandler) -/// will create a highlighter state by calling -/// [start_highlighter_state](Highlighter::start_highlighter_state) at the -/// start of rendering, then it will iteratively call -/// [highlight_line](HighlighterState::highlight_line) to render individual -/// highlighted lines. This allows [Highlighter] implementations to maintain -/// mutable parsing and highlighting state. -pub trait HighlighterState { - /// Highlight an individual line from the source code by returning a vector of [Styled] - /// regions. - fn highlight_line<'a>(&mut self, line: Cow<'a, str>) -> Vec>; - fn highlight_line_with_selection<'a>( - &mut self, - line: Cow<'a, str>, - selected: Range, - style: Style, - ) -> Vec>; -} - -/// The fallback syntax highlighter. -/// -/// This simply returns a line without any styling at all -#[derive(Debug, Clone)] -pub struct NoopHighlighter; - -impl Highlighter for NoopHighlighter { - fn start_highlighter_state(&self, _source: &dyn SpanContents<'_>) -> Box { - Box::new(NoopHighlighterState) - } -} - -impl Default for NoopHighlighter { - fn default() -> Self { - NoopHighlighter - } -} - -/// The fallback highlighter state. -#[derive(Debug, Clone)] -pub struct NoopHighlighterState; - -impl HighlighterState for NoopHighlighterState { - fn highlight_line<'a>(&mut self, line: Cow<'a, str>) -> Vec> { - vec![Span::raw(line)] - } - - fn highlight_line_with_selection<'a>( - &mut self, - line: Cow<'a, str>, - selected: Range, - style: Style, - ) -> Vec> { - default_line_with_selection(line, selected, style) - } -} - -fn default_line_with_selection( - line: Cow<'_, str>, - selected: Range, - style: Style, -) -> Vec> { - let prefix_content = - core::str::from_utf8(&line.as_bytes()[..selected.start]).expect("invalid selection"); - let selected_content = - core::str::from_utf8(&line.as_bytes()[selected.clone()]).expect("invalid selection"); - let suffix_content = - core::str::from_utf8(&line.as_bytes()[selected.end..]).expect("invalid selection"); - let (selected_content, suffix_content) = if suffix_content.is_empty() { - (selected_content.strip_suffix('\n').unwrap_or(selected_content), suffix_content) - } else { - (selected_content, suffix_content.strip_suffix('\n').unwrap_or(suffix_content)) - }; - vec![ - Span::raw(prefix_content.to_string()), - Span::styled(selected_content.to_string(), style), - Span::raw(suffix_content.to_string()), - ] -} - -/// Syntax highlighting provided by [syntect](https://docs.rs/syntect/latest/syntect/). -/// -/// Currently only 24-bit truecolor output is supported due to syntect themes -/// representing color as RGBA. -#[derive(Debug, Clone)] -pub struct SyntectHighlighter { - theme: &'static syntax::Theme, - syntax_set: Rc, - use_bg_color: bool, -} - -impl Default for SyntectHighlighter { - fn default() -> Self { - let theme_set = syntax::ThemeSet::load_defaults(); - let theme = theme_set.themes["base16-ocean.dark"].clone(); - Self::new_themed(theme, false) - } -} - -impl Highlighter for SyntectHighlighter { - fn start_highlighter_state(&self, source: &dyn SpanContents<'_>) -> Box { - if let Some(syntax) = self.detect_syntax(source) { - let highlighter = syntax::Highlighter::new(self.theme); - let parse_state = syntax::ParseState::new(syntax); - let highlight_state = - syntax::HighlightState::new(&highlighter, syntax::ScopeStack::new()); - Box::new(SyntectHighlighterState { - syntax_set: Rc::clone(&self.syntax_set), - highlighter, - parse_state, - highlight_state, - use_bg_color: self.use_bg_color, - }) - } else { - Box::new(NoopHighlighterState) - } - } -} - -impl SyntectHighlighter { - /// Create a syntect highlighter with the given theme and syntax set. - pub fn new(syntax_set: syntax::SyntaxSet, theme: syntax::Theme, use_bg_color: bool) -> Self { - // This simplifies a lot of things API-wise, we only ever really have one of these anyway - let theme = Box::leak(Box::new(theme)); - Self { - theme, - syntax_set: Rc::new(syntax_set), - use_bg_color, - } - } - - /// Create a syntect highlighter with the given theme and the default syntax set. - pub fn new_themed(theme: syntax::Theme, use_bg_color: bool) -> Self { - Self::new(syntax::SyntaxSet::load_defaults_nonewlines(), theme, use_bg_color) - } - - /// Determine syntect SyntaxReference to use for given SourceCode - fn detect_syntax(&self, contents: &dyn SpanContents<'_>) -> Option<&syntax::SyntaxReference> { - // use language if given - if let Some(language) = contents.language() { - return self.syntax_set.find_syntax_by_name(language); - } - // otherwise try to use any file extension provided in the name - if let Some(name) = contents.name() { - if let Some(ext) = Path::new(name).extension() { - return self.syntax_set.find_syntax_by_extension(ext.to_string_lossy().as_ref()); - } - } - // finally, attempt to guess syntax based on first line - self.syntax_set.find_syntax_by_first_line( - core::str::from_utf8(contents.data()).ok()?.split('\n').next()?, - ) - } -} - -/// Stateful highlighting iterator for [SyntectHighlighter] -#[derive(Debug)] -pub(crate) struct SyntectHighlighterState<'h> { - syntax_set: Rc, - highlighter: syntax::Highlighter<'h>, - parse_state: syntax::ParseState, - highlight_state: syntax::HighlightState, - use_bg_color: bool, -} - -impl HighlighterState for SyntectHighlighterState<'_> { - fn highlight_line<'a>(&mut self, line: Cow<'a, str>) -> Vec> { - if let Ok(ops) = self.parse_state.parse_line(&line, &self.syntax_set) { - let use_bg_color = self.use_bg_color; - syntax::HighlightIterator::new( - &mut self.highlight_state, - &ops, - &line, - &self.highlighter, - ) - .map(|(style, str)| Span::styled(str.to_string(), convert_style(style, use_bg_color))) - .collect() - } else { - vec![Span::raw(line)] - } - } - - fn highlight_line_with_selection<'a>( - &mut self, - line: Cow<'a, str>, - selected: Range, - style: Style, - ) -> Vec> { - if let Ok(ops) = self.parse_state.parse_line(&line, &self.syntax_set) { - let use_bg_color = self.use_bg_color; - let parts = syntax::HighlightIterator::new( - &mut self.highlight_state, - &ops, - &line, - &self.highlighter, - ) - .collect::>(); - let syntect_style = syntax::StyleModifier { - foreground: style.fg.map(convert_to_syntect_color), - background: style.bg.map(convert_to_syntect_color), - font_style: if style.add_modifier.is_empty() { - None - } else { - Some(convert_to_font_style(style.add_modifier)) - }, - }; - syntect::util::modify_range(&parts, selected, syntect_style) - .into_iter() - .map(|(style, str)| { - Span::styled(str.to_string(), convert_style(style, use_bg_color)) - }) - .collect() - } else { - default_line_with_selection(line, selected, style) - } - } -} - -/// Convert syntect [syntax::Style] into ratatui [Style] */ -#[inline] -pub fn convert_style(syntect_style: syntax::Style, use_bg_color: bool) -> Style { - let style = if use_bg_color { - let fg = blend_fg_color(syntect_style); - let bg = convert_color(syntect_style.background); - Style::new().fg(fg).bg(bg) - } else { - let fg = convert_color(syntect_style.foreground); - Style::new().fg(fg) - }; - let mods = convert_font_style(syntect_style.font_style); - style.add_modifier(mods) -} - -pub fn convert_to_syntect_style(style: Style, use_bg_color: bool) -> syntax::Style { - let fg = style.fg.map(convert_to_syntect_color); - let bg = style.bg.map(convert_to_syntect_color); - let fs = convert_to_font_style(style.add_modifier); - syntax::Style { - foreground: fg.unwrap_or(convert_to_syntect_color(Color::White)), - background: bg.unwrap_or(convert_to_syntect_color(Color::Black)), - font_style: fs, - } -} - -/// Blend foreground RGB into background RGB according to alpha channel -#[inline] -fn blend_fg_color(syntect_style: syntax::Style) -> Color { - let fg = syntect_style.foreground; - if fg.a == 0xff { - return convert_color(fg); - } - let bg = syntect_style.background; - let ratio = fg.a as u32; - let r = (fg.r as u32 * ratio + bg.r as u32 * (255 - ratio)) / 255; - let g = (fg.g as u32 * ratio + bg.g as u32 * (255 - ratio)) / 255; - let b = (fg.b as u32 * ratio + bg.b as u32 * (255 - ratio)) / 255; - Color::from_u32(u32::from_be_bytes([0, r as u8, g as u8, b as u8])) -} - -/// Convert syntect color into ratatui color -/// -/// Note: ignores alpha channel. use [`blend_fg_color`] if you need that -#[inline] -pub fn convert_color(color: syntax::Color) -> Color { - Color::from_u32(u32::from_be_bytes([color.a, color.r, color.g, color.b])) -} - -/// Convert syntect font style into ratatui modifiers -#[inline] -fn convert_font_style(font_style: syntax::FontStyle) -> Modifier { - use syntax::FontStyle; - - let mut mods = Modifier::default(); - if font_style.contains(FontStyle::BOLD) { - mods.insert(Modifier::BOLD); - } - if font_style.contains(FontStyle::ITALIC) { - mods.insert(Modifier::ITALIC); - } - if font_style.contains(FontStyle::UNDERLINE) { - mods.insert(Modifier::UNDERLINED); - } - mods -} - -pub fn convert_to_font_style(mods: Modifier) -> syntax::FontStyle { - use syntax::FontStyle; - - let mut style = FontStyle::default(); - if mods.contains(Modifier::BOLD) { - style.insert(FontStyle::BOLD); - } - if mods.contains(Modifier::ITALIC) { - style.insert(FontStyle::ITALIC); - } - if mods.contains(Modifier::UNDERLINED) { - style.insert(FontStyle::UNDERLINE); - } - style -} - -pub fn convert_to_syntect_color(color: Color) -> syntax::Color { - match color { - Color::Rgb(r, g, b) => syntax::Color { r, g, b, a: 0 }, - Color::Indexed(code) => convert_to_syntect_color(match code { - 0 => Color::Black, - 1 => Color::Red, - 2 => Color::Green, - 3 => Color::Yellow, - 4 => Color::Blue, - 5 => Color::Magenta, - 6 => Color::Cyan, - 7 => Color::Gray, - 8 => Color::DarkGray, - 9 => Color::LightRed, - 10 => Color::LightGreen, - 11 => Color::LightYellow, - 12 => Color::LightBlue, - 13 => Color::LightMagenta, - 14 => Color::LightCyan, - 15 => Color::White, - code => panic!("unrecognized ansi color index: {code}"), - }), - Color::Black => syntax::Color { - r: 0, - g: 0, - b: 0, - a: u8::MAX, - }, - Color::Green => syntax::Color { - r: 0, - g: 128, - b: 0, - a: u8::MAX, - }, - Color::LightGreen => syntax::Color { - r: 0, - g: 255, - b: 0, - a: u8::MAX, - }, - Color::Red => syntax::Color { - r: 128, - g: 0, - b: 0, - a: u8::MAX, - }, - Color::LightRed => syntax::Color { - r: 255, - g: 0, - b: 0, - a: u8::MAX, - }, - Color::Yellow => syntax::Color { - r: 128, - g: 128, - b: 0, - a: u8::MAX, - }, - Color::LightYellow => syntax::Color { - r: 255, - g: 255, - b: 0, - a: u8::MAX, - }, - Color::Blue => syntax::Color { - r: 0, - g: 0, - b: 128, - a: u8::MAX, - }, - Color::LightBlue => syntax::Color { - r: 0, - g: 0, - b: 255, - a: u8::MAX, - }, - Color::DarkGray => syntax::Color { - r: 128, - g: 128, - b: 128, - a: u8::MAX, - }, - Color::Gray => syntax::Color { - r: 192, - g: 192, - b: 192, - a: u8::MAX, - }, - Color::White => syntax::Color { - r: 255, - g: 255, - b: 255, - a: u8::MAX, - }, - Color::Magenta => syntax::Color { - r: 128, - g: 0, - b: 128, - a: u8::MAX, - }, - Color::LightMagenta => syntax::Color { - r: 255, - g: 0, - b: 255, - a: u8::MAX, - }, - Color::Cyan => syntax::Color { - r: 0, - g: 128, - b: 128, - a: u8::MAX, - }, - Color::LightCyan => syntax::Color { - r: 0, - g: 255, - b: 255, - a: u8::MAX, - }, - Color::Reset => { - panic!("invalid syntax color: reset cannot be used for syntax highlighting") - } - } -} diff --git a/midenc-debug/src/ui/tui.rs b/midenc-debug/src/ui/tui.rs deleted file mode 100644 index 2ba99737f..000000000 --- a/midenc-debug/src/ui/tui.rs +++ /dev/null @@ -1,253 +0,0 @@ -use std::{ - ops::{Deref, DerefMut}, - time::Duration, -}; - -use futures::{FutureExt, StreamExt}; -use midenc_session::diagnostics::{IntoDiagnostic, Report, WrapErr}; -use ratatui::{ - backend::CrosstermBackend as Backend, - crossterm::{ - self, cursor, - event::{ - DisableBracketedPaste, DisableMouseCapture, EnableBracketedPaste, EnableMouseCapture, - Event as CrosstermEvent, KeyEvent, KeyEventKind, MouseEvent, - }, - terminal::{EnterAlternateScreen, LeaveAlternateScreen}, - }, -}; -use tokio::{ - sync::mpsc::{self, UnboundedReceiver, UnboundedSender}, - task::JoinHandle, -}; -use tokio_util::sync::CancellationToken; - -pub type Frame<'a> = ratatui::Frame<'a>; - -#[derive(Clone, Debug)] -pub enum Event { - Init, - Quit, - Error, - Closed, - Tick, - Render, - FocusGained, - FocusLost, - Paste(String), - Key(KeyEvent), - Mouse(MouseEvent), - Resize(u16, u16), -} - -pub enum EventResponse { - Continue(T), - Stop(T), -} - -pub struct Tui { - pub terminal: ratatui::Terminal>, - pub task: JoinHandle<()>, - pub cancellation_token: CancellationToken, - pub event_rx: UnboundedReceiver, - pub event_tx: UnboundedSender, - pub frame_rate: f64, - pub tick_rate: f64, - pub mouse: bool, - pub paste: bool, -} - -impl Tui { - pub fn new() -> Result { - let tick_rate = 4.0; - let frame_rate = 60.0; - let terminal = ratatui::Terminal::new(Backend::new(std::io::stdout())).into_diagnostic()?; - let (event_tx, event_rx) = mpsc::unbounded_channel(); - let cancellation_token = CancellationToken::new(); - let task = tokio::spawn(async {}); - let mouse = false; - let paste = false; - Ok(Self { - terminal, - task, - cancellation_token, - event_rx, - event_tx, - frame_rate, - tick_rate, - mouse, - paste, - }) - } - - pub fn tick_rate(mut self, tick_rate: f64) -> Self { - self.tick_rate = tick_rate; - self - } - - pub fn frame_rate(mut self, frame_rate: f64) -> Self { - self.frame_rate = frame_rate; - self - } - - pub fn mouse(mut self, mouse: bool) -> Self { - self.mouse = mouse; - self - } - - pub fn paste(mut self, paste: bool) -> Self { - self.paste = paste; - self - } - - pub fn start(&mut self) { - let tick_delay = std::time::Duration::from_secs_f64(1.0 / self.tick_rate); - let render_delay = std::time::Duration::from_secs_f64(1.0 / self.frame_rate); - self.cancel(); - self.cancellation_token = CancellationToken::new(); - let _cancellation_token = self.cancellation_token.clone(); - let _event_tx = self.event_tx.clone(); - self.task = tokio::spawn(async move { - let mut reader = ::crossterm::event::EventStream::new(); - let mut tick_interval = tokio::time::interval(tick_delay); - let mut render_interval = tokio::time::interval(render_delay); - _event_tx.send(Event::Init).unwrap(); - loop { - let tick_delay = tick_interval.tick(); - let render_delay = render_interval.tick(); - let crossterm_event = reader.next().fuse(); - tokio::select! { - _ = _cancellation_token.cancelled() => { - break; - } - maybe_event = crossterm_event => { - match maybe_event { - Some(Ok(evt)) => { - match evt { - CrosstermEvent::Key(key) => { - if key.kind == KeyEventKind::Press { - _event_tx.send(Event::Key(key)).unwrap(); - } - }, - CrosstermEvent::Mouse(mouse) => { - _event_tx.send(Event::Mouse(mouse)).unwrap(); - }, - CrosstermEvent::Resize(x, y) => { - _event_tx.send(Event::Resize(x, y)).unwrap(); - }, - CrosstermEvent::FocusLost => { - _event_tx.send(Event::FocusLost).unwrap(); - }, - CrosstermEvent::FocusGained => { - _event_tx.send(Event::FocusGained).unwrap(); - }, - CrosstermEvent::Paste(s) => { - _event_tx.send(Event::Paste(s)).unwrap(); - }, - } - } - Some(Err(_)) => { - _event_tx.send(Event::Error).unwrap(); - } - None => {}, - } - }, - _ = tick_delay => { - _event_tx.send(Event::Tick).unwrap(); - }, - _ = render_delay => { - _event_tx.send(Event::Render).unwrap(); - }, - } - } - }); - } - - pub fn stop(&self) -> Result<(), Report> { - self.cancel(); - let mut counter = 0; - while !self.task.is_finished() { - std::thread::sleep(Duration::from_millis(1)); - counter += 1; - if counter > 50 { - self.task.abort(); - } - if counter > 100 { - log::debug!("Failed to abort task in 100 milliseconds for unknown reason"); - break; - } - } - Ok(()) - } - - pub fn enter(&mut self) -> Result<(), Report> { - crossterm::terminal::enable_raw_mode().into_diagnostic()?; - crossterm::execute!(std::io::stderr(), EnterAlternateScreen, cursor::Hide) - .into_diagnostic()?; - if self.mouse { - crossterm::execute!(std::io::stderr(), EnableMouseCapture).into_diagnostic()?; - } - if self.paste { - crossterm::execute!(std::io::stderr(), EnableBracketedPaste).into_diagnostic()?; - } - self.start(); - Ok(()) - } - - pub fn exit(&mut self) -> Result<(), Report> { - self.stop()?; - if crossterm::terminal::is_raw_mode_enabled().into_diagnostic()? { - self.flush().into_diagnostic()?; - if self.paste { - crossterm::execute!(std::io::stderr(), DisableBracketedPaste).into_diagnostic()?; - } - if self.mouse { - crossterm::execute!(std::io::stderr(), DisableMouseCapture).into_diagnostic()?; - } - crossterm::execute!(std::io::stderr(), LeaveAlternateScreen, cursor::Show) - .into_diagnostic()?; - crossterm::terminal::disable_raw_mode().into_diagnostic()?; - } - Ok(()) - } - - pub fn cancel(&self) { - self.cancellation_token.cancel(); - } - - pub fn suspend(&mut self) -> Result<(), Report> { - self.exit()?; - #[cfg(not(windows))] - signal_hook::low_level::raise(signal_hook::consts::signal::SIGTSTP).into_diagnostic()?; - Ok(()) - } - - pub fn resume(&mut self) -> Result<(), Report> { - self.enter()?; - Ok(()) - } - - pub async fn next(&mut self) -> Option { - self.event_rx.recv().await - } -} - -impl Deref for Tui { - type Target = ratatui::Terminal>; - - fn deref(&self) -> &Self::Target { - &self.terminal - } -} - -impl DerefMut for Tui { - fn deref_mut(&mut self) -> &mut Self::Target { - &mut self.terminal - } -} - -impl Drop for Tui { - fn drop(&mut self) { - self.exit().unwrap(); - } -} diff --git a/midenc-debug/testdata/rodata-sample.bin b/midenc-debug/testdata/rodata-sample.bin deleted file mode 100644 index 042f38fab14297d273bd94df0d1593c4808de9e7..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 27 icmc~u&B@7ED9, - /// Number of outputs on the operand stack to print - #[arg(long, short = 'n', default_value_t = 16)] - num_outputs: usize, - /// Arguments to place on the operand stack before calling the program entrypoint. - /// - /// Arguments will be pushed on the operand stack in the order of appearance, - /// - /// Example: `-- a b` will push `a` on the stack, then `b`. - /// - /// These arguments must be valid field element values expressed in decimal format. - /// - /// NOTE: These arguments will override any stack values provided via --inputs - #[arg(last(true), value_name = "ARGV")] - args: Vec, - #[command(flatten)] - options: debugger::Debugger, - }, - /// Run a program under the interactive Miden VM debugger + /// The input file to compile /// - /// This command starts a TUI-based interactive debugger with the given program loaded. - #[cfg(feature = "debug")] - Debug { - /// Specify the path to a Miden program file to execute. - /// - /// Miden Assembly programs are emitted by the compiler with a `.masl` extension. - /// - /// You may use `-` as a file name to read a file from stdin. - #[arg(required(true), value_name = "FILE")] - input: InputFile, - /// Specify the path to a file containing program inputs. - /// - /// Program inputs are stack and advice provider values which the program can - /// access during execution. The inputs file is a TOML file which describes - /// what the inputs are, or where to source them from. - #[arg(long, value_name = "FILE")] - inputs: Option, - /// Arguments to place on the operand stack before calling the program entrypoint. - /// - /// Arguments will be pushed on the operand stack in the order of appearance, - /// - /// Example: `-- a b` will push `a` on the stack, then `b`. - /// - /// These arguments must be valid field element values expressed in decimal format. - /// - /// NOTE: These arguments will override any stack values provided via --inputs - #[arg(last(true), value_name = "ARGV")] - args: Vec, - #[command(flatten)] - options: debugger::Debugger, - }, + /// You may specify `-` to read from stdin, otherwise you must provide a path + #[arg(required(true), value_name = "FILE")] + input: InputFile, + #[command(flatten)] + options: compile::Compiler, } impl Midenc { @@ -135,72 +51,24 @@ impl Midenc { A: IntoIterator, { let command = ::command(); - let command = command.mut_subcommand("compile", midenc_session::flags::register_flags); + let command = midenc_session::flags::register_flags(command); let mut matches = command.try_get_matches_from(args).map_err(ClapDiagnostic::from)?; - let compile_matches = matches.subcommand_matches("compile").cloned().unwrap_or_default(); - let cli = ::from_arg_matches_mut(&mut matches) - .map_err(format_error::) - .map_err(ClapDiagnostic::from)?; - - cli.invoke(cwd.into(), emitter, logger, filter, compile_matches) - } + let Self { input, mut options } = + ::from_arg_matches_mut(&mut matches) + .map_err(format_error::) + .map_err(ClapDiagnostic::from)?; - fn invoke( - self, - cwd: PathBuf, - emitter: Option>, - logger: Box, - filter: log::LevelFilter, - matches: clap::ArgMatches, - ) -> Result<(), Report> { - match self.command { - Commands::Compile { input, mut options } => { - log::set_boxed_logger(logger) - .unwrap_or_else(|err| panic!("failed to install logger: {err}")); - log::set_max_level(filter); - if options.working_dir.is_none() { - options.working_dir = Some(cwd); - } - let session = Rc::new( - options.into_session(vec![input], emitter).with_extra_flags(matches.into()), - ); - let context = Rc::new(Context::new(session)); - compile::compile(context) - } - #[cfg(feature = "debug")] - Commands::Run { - input, - inputs, - args, - num_outputs, - mut options, - } => { - log::set_boxed_logger(logger) - .unwrap_or_else(|err| panic!("failed to install logger: {err}")); - log::set_max_level(filter); - if options.working_dir.is_none() { - options.working_dir = Some(cwd); - } - let session = options.into_session(vec![input], emitter); - let args = args.into_iter().map(|felt| felt.0).collect(); - debugger::run_noninteractively(inputs, args, num_outputs, Rc::new(session)) - } - #[cfg(feature = "debug")] - Commands::Debug { - input, - inputs, - args, - mut options, - } => { - if options.working_dir.is_none() { - options.working_dir = Some(cwd); - } - let session = options.into_session(vec![input], emitter); - let args = args.into_iter().map(|felt| felt.0).collect(); - debugger::run(inputs, args, Rc::new(session), logger) - } + log::set_boxed_logger(logger) + .unwrap_or_else(|err| panic!("failed to install logger: {err}")); + log::set_max_level(filter); + if options.working_dir.is_none() { + options.working_dir = Some(cwd.into()); } + let session = + Rc::new(options.into_session(vec![input], emitter).with_extra_flags(matches.into())); + let context = Rc::new(Context::new(session)); + compile::compile(context) } } diff --git a/midenc/Cargo.toml b/midenc/Cargo.toml index bb94c3460..4bce0a691 100644 --- a/midenc/Cargo.toml +++ b/midenc/Cargo.toml @@ -16,4 +16,4 @@ edition.workspace = true [dependencies] env_logger.workspace = true human-panic = "2.0" -midenc-driver = { workspace = true, features = ["all"] } +midenc-driver = { workspace = true, features = ["std"] } diff --git a/tests/integration-node/Cargo.toml b/tests/integration-node/Cargo.toml index 377df7f81..4c95fe0ec 100644 --- a/tests/integration-node/Cargo.toml +++ b/tests/integration-node/Cargo.toml @@ -14,10 +14,7 @@ publish = false [dependencies] anyhow.workspace = true fs2 = "0.4" -miden-client = { version = "0.11", features = [ - "tonic", - "sqlite", -] } +miden-client = { version = "0.12", features = ["std"] } miden-core.workspace = true miden-mast-package.workspace = true miden-objects = { workspace = true, features = ["std"] } diff --git a/tests/integration-node/src/node_tests/counter_contract_rust_auth.rs b/tests/integration-node/src/node_tests/counter_contract_rust_auth.rs index 89e1eea0a..2e6d68302 100644 --- a/tests/integration-node/src/node_tests/counter_contract_rust_auth.rs +++ b/tests/integration-node/src/node_tests/counter_contract_rust_auth.rs @@ -13,6 +13,7 @@ use miden_client::{ Client, DebugMode, Word, }; use miden_core::{Felt, FieldElement}; +use miden_mast_package::SectionId; use rand::{rngs::StdRng, RngCore}; use super::helpers::*; @@ -56,7 +57,13 @@ async fn create_counter_account_with_rust_rpo_auth( }; // Build counter component from template/metadata with initial storage - let account_component = match component_package.account_component_metadata_bytes.as_deref() { + let account_component = match component_package.sections.iter().find_map(|s| { + if s.id == SectionId::ACCOUNT_COMPONENT_METADATA { + Some(s.data.as_ref()) + } else { + None + } + }) { None => panic!("no account component metadata present"), Some(bytes) => { let metadata = AccountComponentMetadata::read_from_bytes(bytes).unwrap(); diff --git a/tests/integration/Cargo.toml b/tests/integration/Cargo.toml index b20cd711d..1cf9f7911 100644 --- a/tests/integration/Cargo.toml +++ b/tests/integration/Cargo.toml @@ -24,6 +24,7 @@ miden-core.workspace = true miden-mast-package.workspace = true miden-objects = { workspace = true, features = ["std"] } miden-processor.workspace = true +miden-debug = { workspace = true, features = ["proptest"] } midenc-dialect-arith.workspace = true midenc-dialect-cf.workspace = true midenc-dialect-hir.workspace = true @@ -33,7 +34,6 @@ midenc-hir-eval.workspace = true midenc-codegen-masm.workspace = true midenc-session.workspace = true midenc-compile.workspace = true -midenc-debug.workspace = true cargo-miden.workspace = true wasmprinter = "0.227" proptest.workspace = true diff --git a/tests/integration/src/codegen/intrinsics/mem.rs b/tests/integration/src/codegen/intrinsics/mem.rs index 192e1d311..1442e2edd 100644 --- a/tests/integration/src/codegen/intrinsics/mem.rs +++ b/tests/integration/src/codegen/intrinsics/mem.rs @@ -1,6 +1,6 @@ use std::borrow::Cow; -use midenc_debug::ToMidenRepr; +use miden_debug::ToMidenRepr; use midenc_dialect_arith::ArithOpBuilder; use midenc_dialect_hir::HirOpBuilder; use midenc_hir::{ diff --git a/tests/integration/src/rust_masm_tests/abi_transform/advice_map.rs b/tests/integration/src/rust_masm_tests/abi_transform/advice_map.rs index 3015874d4..34f9c971a 100644 --- a/tests/integration/src/rust_masm_tests/abi_transform/advice_map.rs +++ b/tests/integration/src/rust_masm_tests/abi_transform/advice_map.rs @@ -2,8 +2,8 @@ use core::panic; use std::collections::VecDeque; use miden_core::{utils::group_slice_elements, FieldElement, StarkField}; +use miden_debug::{Executor, Felt as TestFelt, FromMidenRepr, ToMidenRepr}; use miden_processor::AdviceInputs; -use midenc_debug::{Executor, FromMidenRepr, TestFelt, ToMidenRepr}; use midenc_expect_test::expect_file; use midenc_frontend_wasm::WasmTranslationConfig; use midenc_hir::Felt; @@ -87,10 +87,10 @@ fn test_adv_load_preimage() { Felt::new(out_addr as u64), ]; - let mut exec = Executor::for_package(&package, args.to_vec(), &test.session) - .expect("Failed to create executor"); + let mut exec = + Executor::for_package(&package, args.to_vec()).expect("Failed to create executor"); exec.with_advice_inputs(AdviceInputs::default().with_map(advice_map)); - let trace = exec.execute(&package.unwrap_program(), &test.session); + let trace = exec.execute(&package.unwrap_program(), test.session.source_manager.clone()); let result_ptr = out_addr; // Read the Vec metadata from memory (capacity, ptr, len, padding) diff --git a/tests/integration/src/rust_masm_tests/abi_transform/stdlib.rs b/tests/integration/src/rust_masm_tests/abi_transform/stdlib.rs index 2c7c0dac1..a41246697 100644 --- a/tests/integration/src/rust_masm_tests/abi_transform/stdlib.rs +++ b/tests/integration/src/rust_masm_tests/abi_transform/stdlib.rs @@ -2,8 +2,8 @@ use core::panic; use std::collections::VecDeque; use miden_core::{utils::group_slice_elements, FieldElement}; +use miden_debug::{Executor, Felt as TestFelt, ToMidenRepr}; use miden_processor::AdviceInputs; -use midenc_debug::{Executor, TestFelt, ToMidenRepr}; use midenc_expect_test::expect_file; use midenc_frontend_wasm::WasmTranslationConfig; use midenc_hir::Felt; @@ -109,8 +109,8 @@ fn test_hash_elements() { // Run the Rust and compiled MASM code against a bunch of random inputs and compare the results let config = proptest::test_runner::Config::with_cases(32); - // let res = TestRunner::new(config).run(&any::<[midenc_debug::Felt; 8]>(), move |test_felts| { - let res = TestRunner::new(config).run(&any::>(), move |test_felts| { + // let res = TestRunner::new(config).run(&any::<[miden_debug::Felt; 8]>(), move |test_felts| { + let res = TestRunner::new(config).run(&any::>(), move |test_felts| { let raw_felts: Vec = test_felts.into_iter().map(From::from).collect(); dbg!(raw_felts.len()); @@ -192,7 +192,7 @@ fn test_hash_words() { let config = proptest::test_runner::Config::with_cases(32); let res = - TestRunner::new(config).run(&any::>(), move |test_words| { + TestRunner::new(config).run(&any::>(), move |test_words| { let raw_words: Vec<[Felt; 4]> = test_words .into_iter() .map(|w| [w[0].into(), w[1].into(), w[2].into(), w[3].into()]) diff --git a/tests/integration/src/rust_masm_tests/abi_transform/tx_kernel.rs b/tests/integration/src/rust_masm_tests/abi_transform/tx_kernel.rs index a4c3a14be..0006a0775 100644 --- a/tests/integration/src/rust_masm_tests/abi_transform/tx_kernel.rs +++ b/tests/integration/src/rust_masm_tests/abi_transform/tx_kernel.rs @@ -2,8 +2,8 @@ use std::fmt::Write; use miden_assembly::LibraryPath; use miden_core::{Felt, FieldElement}; +use miden_debug::Executor; use miden_processor::ExecutionError; -use midenc_debug::Executor; use midenc_expect_test::expect_file; use midenc_frontend_wasm::WasmTranslationConfig; use midenc_session::{diagnostics::Report, Emit}; @@ -68,8 +68,8 @@ end test.expect_masm(expect_file![format!("../../../expected/{artifact_name}.masm")]); let package = test.compiled_package(); - let exec = Executor::for_package(&package, vec![], &test.session)?; - let _ = exec.execute(&package.unwrap_program(), &test.session); + let exec = Executor::for_package(&package, vec![])?; + let _ = exec.execute(&package.unwrap_program(), test.session.source_manager.clone()); Ok(()) } diff --git a/tests/integration/src/rust_masm_tests/apps.rs b/tests/integration/src/rust_masm_tests/apps.rs index 162b32cf7..167718c1e 100644 --- a/tests/integration/src/rust_masm_tests/apps.rs +++ b/tests/integration/src/rust_masm_tests/apps.rs @@ -1,6 +1,6 @@ use std::collections::VecDeque; -use midenc_debug::Executor; +use miden_debug::Executor; use midenc_expect_test::expect_file; use midenc_frontend_wasm::WasmTranslationConfig; use midenc_hir::Felt; diff --git a/tests/integration/src/rust_masm_tests/examples.rs b/tests/integration/src/rust_masm_tests/examples.rs index 28c48b6b5..17f9f26e2 100644 --- a/tests/integration/src/rust_masm_tests/examples.rs +++ b/tests/integration/src/rust_masm_tests/examples.rs @@ -1,9 +1,9 @@ use std::{borrow::Borrow, collections::VecDeque, sync::Arc}; use miden_core::utils::{Deserializable, Serializable}; +use miden_debug::{Executor, ToMidenRepr}; use miden_mast_package::{Package, SectionId}; use miden_objects::account::AccountComponentMetadata; -use midenc_debug::{Executor, ToMidenRepr}; use midenc_expect_test::{expect, expect_file}; use midenc_frontend_wasm::WasmTranslationConfig; use midenc_hir::{ @@ -86,9 +86,10 @@ fn fibonacci() { .run(&(1u32..30), move |a| { let rust_out = expected_fib(a); let args = a.to_felts(); - let exec = Executor::for_package(&package, args, &test.session) + let exec = Executor::for_package(&package, args) .map_err(|err| TestCaseError::fail(err.to_string()))?; - let output: u32 = exec.execute_into(&package.unwrap_program(), &test.session); + let output: u32 = + exec.execute_into(&package.unwrap_program(), test.session.source_manager.clone()); dbg!(output); prop_assert_eq!(rust_out, output); Ok(()) @@ -129,9 +130,10 @@ fn collatz() { .run(&(1u32..30), move |a| { let rust_out = expected(a); let args = a.to_felts(); - let exec = Executor::for_package(&package, args, &test.session) + let exec = Executor::for_package(&package, args) .map_err(|err| TestCaseError::fail(err.to_string()))?; - let output: u32 = exec.execute_into(&package.unwrap_program(), &test.session); + let output: u32 = + exec.execute_into(&package.unwrap_program(), test.session.source_manager.clone()); dbg!(output); prop_assert_eq!(rust_out, output); Ok(()) @@ -209,9 +211,10 @@ fn is_prime() { prop_assert_eq!(rust_out as i32, result); let args = a.to_felts(); - let exec = Executor::for_package(&package, args, &test.session) + let exec = Executor::for_package(&package, args) .map_err(|err| TestCaseError::fail(err.to_string()))?; - let output: u32 = exec.execute_into(&package.unwrap_program(), &test.session); + let output: u32 = + exec.execute_into(&package.unwrap_program(), test.session.source_manager.clone()); dbg!(output); prop_assert_eq!(rust_out as u32, output); Ok(()) diff --git a/tests/integration/src/rust_masm_tests/instructions.rs b/tests/integration/src/rust_masm_tests/instructions.rs index 30fddce42..326b07576 100644 --- a/tests/integration/src/rust_masm_tests/instructions.rs +++ b/tests/integration/src/rust_masm_tests/instructions.rs @@ -1,5 +1,5 @@ use miden_core::{Felt, FieldElement, Word}; -use midenc_debug::ToMidenRepr; +use miden_debug::ToMidenRepr; use midenc_expect_test::expect_file; use midenc_frontend_wasm::WasmTranslationConfig; use midenc_hir::SmallVec; @@ -442,7 +442,7 @@ fn test_hmerge() { // Run the Rust and compiled MASM code against a bunch of random inputs and compare the results let config = proptest::test_runner::Config::with_cases(16); let res = TestRunner::new(config).run( - &any::<([midenc_debug::Felt; 4], [midenc_debug::Felt; 4])>(), + &any::<([miden_debug::Felt; 4], [miden_debug::Felt; 4])>(), move |(felts_in1, felts_in2)| { let raw_felts_in1: [Felt; 4] = [ felts_in1[0].into(), @@ -460,11 +460,11 @@ fn test_hmerge() { let digests_in = [miden_core::Word::from(raw_felts_in1), miden_core::Word::from(raw_felts_in2)]; let digest_out = miden_core::crypto::hash::Rpo256::merge(&digests_in); - let felts_out: [midenc_debug::Felt; 4] = [ - midenc_debug::Felt(digest_out[0]), - midenc_debug::Felt(digest_out[1]), - midenc_debug::Felt(digest_out[2]), - midenc_debug::Felt(digest_out[3]), + let felts_out: [miden_debug::Felt; 4] = [ + miden_debug::Felt(digest_out[0]), + miden_debug::Felt(digest_out[1]), + miden_debug::Felt(digest_out[2]), + miden_debug::Felt(digest_out[3]), ]; let args = [ diff --git a/tests/integration/src/rust_masm_tests/intrinsics.rs b/tests/integration/src/rust_masm_tests/intrinsics.rs index ae3b25073..0f3899974 100644 --- a/tests/integration/src/rust_masm_tests/intrinsics.rs +++ b/tests/integration/src/rust_masm_tests/intrinsics.rs @@ -1,7 +1,7 @@ use core::panic; use miden_core::Felt; -use midenc_debug::{TestFelt, ToMidenRepr}; +use miden_debug::{Felt as TestFelt, ToMidenRepr}; use midenc_expect_test::expect_file; use midenc_frontend_wasm::WasmTranslationConfig; use proptest::{ diff --git a/tests/integration/src/rust_masm_tests/mod.rs b/tests/integration/src/rust_masm_tests/mod.rs index 7f94c936f..31a39c8c5 100644 --- a/tests/integration/src/rust_masm_tests/mod.rs +++ b/tests/integration/src/rust_masm_tests/mod.rs @@ -4,7 +4,7 @@ use std::{collections::VecDeque, sync::Arc}; use miden_core::Felt; -use midenc_debug::{Executor, FromMidenRepr}; +use miden_debug::{Executor, FromMidenRepr}; use midenc_session::Session; use proptest::{prop_assert_eq, test_runner::TestCaseError}; @@ -26,9 +26,9 @@ pub fn run_masm_vs_rust( where T: Clone + FromMidenRepr + PartialEq + std::fmt::Debug, { - let exec = Executor::for_package(package, args.iter().copied(), session) + let exec = Executor::for_package(package, args.iter().copied()) .map_err(|err| TestCaseError::fail(err.to_string()))?; - let output = exec.execute_into(&package.unwrap_program(), session); + let output = exec.execute_into(&package.unwrap_program(), session.source_manager.clone()); std::dbg!(&output); prop_assert_eq!(rust_out.clone(), output, "VM output mismatch"); // TODO: Uncomment after https://github.com/0xMiden/compiler/issues/228 is fixed diff --git a/tests/integration/src/testing/eval.rs b/tests/integration/src/testing/eval.rs index 2b405cf56..22ec52996 100644 --- a/tests/integration/src/testing/eval.rs +++ b/tests/integration/src/testing/eval.rs @@ -1,7 +1,7 @@ use miden_core::{Felt, FieldElement}; +use miden_debug::{ExecutionTrace, Executor, FromMidenRepr}; use miden_processor::AdviceInputs; use midenc_compile::LinkOutput; -use midenc_debug::{ExecutionTrace, Executor, FromMidenRepr}; use midenc_session::Session; use proptest::test_runner::TestCaseError; @@ -43,7 +43,7 @@ where value.push_words_to_advice_stack(&mut advice_stack) as u32 } Initializer::MemoryBytes { bytes, .. } => { - let words = midenc_debug::bytes_to_words(bytes); + let words = miden_debug::bytes_to_words(bytes); let num_words = words.len() as u32; for word in words.into_iter().rev() { for felt in word.into_iter() { @@ -102,7 +102,7 @@ where // Push the number of initializers on the advice stack advice_stack.push(Felt::new(num_initializers)); - let mut exec = Executor::for_package(package, args.to_vec(), session) + let mut exec = Executor::for_package(package, args.to_vec()) .map_err(|err| TestCaseError::fail(format_report(err)))?; // Reverse the stack contents, so that the correct order is preserved after MemAdviceProvider @@ -111,7 +111,7 @@ where exec.with_advice_inputs(AdviceInputs::default().with_stack(advice_stack)); - let trace = exec.execute(&package.unwrap_program(), session); + let trace = exec.execute(&package.unwrap_program(), session.source_manager.clone()); verify_trace(&trace)?; dbg!(trace.outputs()); diff --git a/tests/integration/src/testing/initializer.rs b/tests/integration/src/testing/initializer.rs index 12326cd1d..7165de99a 100644 --- a/tests/integration/src/testing/initializer.rs +++ b/tests/integration/src/testing/initializer.rs @@ -1,7 +1,7 @@ use std::borrow::Cow; use miden_core::{Felt, Word}; -use midenc_debug::ToMidenRepr; +use miden_debug::ToMidenRepr; /// An [Initializer] represents a known initialization pattern that is handled by the compiler- /// emitted test harness, when enabled. From a6c4d68c182fdae15e3d52f5e3578f901f015e5c Mon Sep 17 00:00:00 2001 From: Paul Schoenfelder Date: Mon, 10 Nov 2025 22:22:13 -0500 Subject: [PATCH 04/19] migrate to 0.19 refactor: ditch `cargo-generate` and implement copying from a git repo and templating --- Cargo.lock | 1856 +++++------------ Cargo.toml | 22 +- codegen/masm/intrinsics/advice.masm | 5 +- codegen/masm/intrinsics/crypto.masm | 6 +- codegen/masm/intrinsics/mem.masm | 2 +- codegen/masm/src/artifact.rs | 7 +- codegen/masm/src/emit/mem.rs | 20 +- codegen/masm/src/emit/mod.rs | 2 +- codegen/masm/src/lib.rs | 2 +- codegen/masm/src/lower/component.rs | 3 +- examples/auth-component-no-auth/Cargo.lock | 632 +++++- examples/auth-component-no-auth/src/lib.rs | 2 +- .../auth-component-rpo-falcon512/Cargo.lock | 632 +++++- examples/basic-wallet-tx-script/Cargo.lock | 634 +++++- examples/basic-wallet-tx-script/src/lib.rs | 3 +- examples/basic-wallet/Cargo.lock | 634 +++++- examples/basic-wallet/src/lib.rs | 4 +- examples/counter-contract/Cargo.lock | 634 +++++- examples/counter-note/Cargo.lock | 634 +++++- examples/p2id-note/Cargo.lock | 634 +++++- examples/p2id-note/src/lib.rs | 4 +- examples/storage-example/Cargo.lock | 634 +++++- frontend/wasm/CHANGELOG.md | 2 +- frontend/wasm/src/miden_abi/transform.rs | 55 +- frontend/wasm/src/miden_abi/tx_kernel.rs | 6 +- .../wasm/src/miden_abi/tx_kernel/account.rs | 73 +- .../tx_kernel/{note.rs => active_note.rs} | 4 +- .../src/miden_abi/tx_kernel/output_note.rs | 49 + frontend/wasm/src/miden_abi/tx_kernel/tx.rs | 41 +- hir-symbol/src/symbols.toml | 5 + midenc-session/src/libs.rs | 2 +- .../src/account_component_metadata.rs | 2 +- sdk/base-sys/src/bindings/account.rs | 24 +- .../src/bindings/{note.rs => active_note.rs} | 10 +- sdk/base-sys/src/bindings/mod.rs | 3 +- sdk/base-sys/src/bindings/output_note.rs | 62 + sdk/base-sys/src/bindings/storage.rs | 8 +- sdk/base-sys/src/bindings/tx.rs | 73 - sdk/base-sys/stubs/account.rs | 28 +- .../stubs/{note.rs => active_note.rs} | 10 +- sdk/base-sys/stubs/lib.rs | 3 +- sdk/base-sys/stubs/output_note.rs | 25 + sdk/base-sys/stubs/tx.rs | 27 - sdk/stdlib-sys/src/intrinsics/advice.rs | 2 +- tests/integration-node/Cargo.toml | 3 +- .../integration-node/src/local_node/setup.rs | 2 +- .../src/node_tests/basic_wallet.rs | 20 +- .../src/node_tests/counter_contract.rs | 18 +- .../node_tests/counter_contract_no_auth.rs | 18 +- .../node_tests/counter_contract_rust_auth.rs | 47 +- .../src/node_tests/helpers.rs | 93 +- tests/integration/Cargo.toml | 1 + .../abi_transform_stdlib_blake3_hash.masm | 18 +- .../abi_transform_tx_kernel_get_id.hir | 6 +- .../abi_transform_tx_kernel_get_id.wat | 4 +- .../abi_transform_tx_kernel_get_inputs_4.hir | 20 +- .../abi_transform_tx_kernel_get_inputs_4.masm | 194 +- .../abi_transform_tx_kernel_get_inputs_4.wat | 18 +- tests/integration/expected/add_felt.masm | 8 +- tests/integration/expected/add_i128.masm | 5 +- tests/integration/expected/add_i16.masm | 5 +- tests/integration/expected/add_i32.masm | 5 +- tests/integration/expected/add_i64.masm | 5 +- tests/integration/expected/add_i8.masm | 5 +- tests/integration/expected/add_u128.masm | 5 +- tests/integration/expected/add_u16.masm | 5 +- tests/integration/expected/add_u32.masm | 5 +- tests/integration/expected/add_u64.masm | 5 +- tests/integration/expected/add_u8.masm | 5 +- .../expected/adv_load_preimage.masm | 76 +- tests/integration/expected/and_bool.masm | 5 +- tests/integration/expected/band_i16.masm | 5 +- tests/integration/expected/band_i32.masm | 5 +- tests/integration/expected/band_i64.masm | 5 +- tests/integration/expected/band_i8.masm | 5 +- tests/integration/expected/band_u16.masm | 5 +- tests/integration/expected/band_u32.masm | 5 +- tests/integration/expected/band_u64.masm | 5 +- tests/integration/expected/band_u8.masm | 5 +- tests/integration/expected/bnot_bool.masm | 5 +- tests/integration/expected/bnot_i16.masm | 5 +- tests/integration/expected/bnot_i32.masm | 5 +- tests/integration/expected/bnot_i64.masm | 5 +- tests/integration/expected/bnot_i8.masm | 5 +- tests/integration/expected/bnot_u16.masm | 5 +- tests/integration/expected/bnot_u32.masm | 5 +- tests/integration/expected/bnot_u64.masm | 5 +- tests/integration/expected/bnot_u8.masm | 5 +- tests/integration/expected/bor_i16.masm | 5 +- tests/integration/expected/bor_i32.masm | 5 +- tests/integration/expected/bor_i64.masm | 5 +- tests/integration/expected/bor_i8.masm | 5 +- tests/integration/expected/bor_u16.masm | 5 +- tests/integration/expected/bor_u32.masm | 5 +- tests/integration/expected/bor_u64.masm | 5 +- tests/integration/expected/bor_u8.masm | 5 +- tests/integration/expected/bxor_i16.masm | 5 +- tests/integration/expected/bxor_i32.masm | 5 +- tests/integration/expected/bxor_i64.masm | 5 +- tests/integration/expected/bxor_i8.masm | 5 +- tests/integration/expected/bxor_u16.masm | 5 +- tests/integration/expected/bxor_u32.masm | 5 +- tests/integration/expected/bxor_u64.masm | 5 +- tests/integration/expected/bxor_u8.masm | 5 +- tests/integration/expected/collatz.masm | 5 +- .../expected/core::cmp::max_u8_u8.masm | 5 +- .../expected/core::cmp::min_i32_i32.masm | 5 +- .../expected/core::cmp::min_u32_u32.masm | 5 +- .../expected/core::cmp::min_u8_u8.masm | 5 +- tests/integration/expected/div_felt.masm | 8 +- tests/integration/expected/eq_felt.masm | 8 +- tests/integration/expected/eq_i16.masm | 5 +- tests/integration/expected/eq_i32.masm | 5 +- tests/integration/expected/eq_i64.masm | 5 +- tests/integration/expected/eq_i8.masm | 5 +- tests/integration/expected/eq_u16.masm | 5 +- tests/integration/expected/eq_u32.masm | 5 +- tests/integration/expected/eq_u64.masm | 5 +- tests/integration/expected/eq_u8.masm | 5 +- .../examples/auth_component_no_auth.hir | 34 +- .../examples/auth_component_no_auth.masm | 60 +- .../examples/auth_component_no_auth.wat | 12 +- .../examples/auth_component_rpo_falcon512.hir | 44 +- .../auth_component_rpo_falcon512.masm | 138 +- .../examples/auth_component_rpo_falcon512.wat | 12 +- .../expected/examples/basic_wallet.hir | 797 ++++--- .../expected/examples/basic_wallet.masm | 307 +-- .../expected/examples/basic_wallet.wat | 66 +- .../examples/basic_wallet_tx_script.hir | 12 +- .../examples/basic_wallet_tx_script.masm | 186 +- .../examples/basic_wallet_tx_script.wat | 10 +- .../integration/expected/examples/counter.hir | 22 +- .../expected/examples/counter.masm | 95 +- .../integration/expected/examples/counter.wat | 10 +- .../expected/examples/counter_note.masm | 42 +- tests/integration/expected/examples/fib.masm | 5 +- tests/integration/expected/examples/p2id.hir | 42 +- tests/integration/expected/examples/p2id.masm | 172 +- tests/integration/expected/examples/p2id.wat | 36 +- .../expected/examples/storage_example.hir | 36 +- .../expected/examples/storage_example.masm | 103 +- .../expected/examples/storage_example.wat | 14 +- tests/integration/expected/func_arg_same.masm | 8 +- tests/integration/expected/ge_felt.masm | 8 +- tests/integration/expected/ge_i32.masm | 5 +- tests/integration/expected/ge_i64.masm | 5 +- tests/integration/expected/ge_u16.masm | 5 +- tests/integration/expected/ge_u32.masm | 5 +- tests/integration/expected/ge_u64.masm | 5 +- tests/integration/expected/ge_u8.masm | 5 +- tests/integration/expected/gt_felt.masm | 8 +- tests/integration/expected/gt_i32.masm | 5 +- tests/integration/expected/gt_i64.masm | 5 +- tests/integration/expected/gt_u16.masm | 5 +- tests/integration/expected/gt_u32.masm | 5 +- tests/integration/expected/gt_u64.masm | 5 +- tests/integration/expected/gt_u8.masm | 5 +- tests/integration/expected/hash_elements.masm | 48 +- tests/integration/expected/hash_words.masm | 45 +- tests/integration/expected/hmerge.masm | 8 +- tests/integration/expected/is_prime.masm | 5 +- tests/integration/expected/le_felt.masm | 8 +- tests/integration/expected/le_i32.masm | 5 +- tests/integration/expected/le_i64.masm | 5 +- tests/integration/expected/le_u16.masm | 5 +- tests/integration/expected/le_u32.masm | 5 +- tests/integration/expected/le_u64.masm | 5 +- tests/integration/expected/le_u8.masm | 5 +- tests/integration/expected/lt_felt.masm | 8 +- tests/integration/expected/lt_i32.masm | 5 +- tests/integration/expected/lt_i64.masm | 5 +- tests/integration/expected/lt_u16.masm | 5 +- tests/integration/expected/lt_u32.masm | 5 +- tests/integration/expected/lt_u64.masm | 5 +- tests/integration/expected/lt_u8.masm | 5 +- tests/integration/expected/mul_felt.masm | 8 +- tests/integration/expected/mul_i128.masm | 5 +- tests/integration/expected/mul_i32.masm | 5 +- tests/integration/expected/mul_i64.masm | 5 +- tests/integration/expected/mul_u128.masm | 5 +- tests/integration/expected/mul_u16.masm | 5 +- tests/integration/expected/mul_u32.masm | 5 +- tests/integration/expected/mul_u64.masm | 5 +- tests/integration/expected/mul_u8.masm | 5 +- tests/integration/expected/neg_felt.masm | 8 +- tests/integration/expected/neg_i16.masm | 5 +- tests/integration/expected/neg_i32.masm | 5 +- tests/integration/expected/neg_i64.masm | 5 +- tests/integration/expected/neg_i8.masm | 5 +- tests/integration/expected/or_bool.masm | 5 +- .../rust_sdk/component_macros_account.masm | 81 +- .../rust_sdk/component_macros_note.masm | 46 +- .../expected/rust_sdk/cross_ctx_account.masm | 32 +- .../rust_sdk/cross_ctx_account_word.masm | 104 +- .../rust_sdk/cross_ctx_account_word_arg.masm | 66 +- .../expected/rust_sdk/cross_ctx_note.masm | 37 +- .../rust_sdk/cross_ctx_note_word.masm | 105 +- .../rust_sdk/cross_ctx_note_word_arg.masm | 49 +- .../rust_sdk/rust_sdk_swapp_note_bindings.hir | 36 +- .../rust_sdk_swapp_note_bindings.masm | 93 +- .../rust_sdk/rust_sdk_swapp_note_bindings.wat | 28 +- tests/integration/expected/shl_i16.masm | 5 +- tests/integration/expected/shl_i32.masm | 5 +- tests/integration/expected/shl_i64.masm | 5 +- tests/integration/expected/shl_i8.masm | 5 +- tests/integration/expected/shl_u16.masm | 5 +- tests/integration/expected/shl_u32.masm | 5 +- tests/integration/expected/shl_u64.masm | 5 +- tests/integration/expected/shl_u8.masm | 5 +- tests/integration/expected/shr_i64.masm | 5 +- tests/integration/expected/shr_u16.masm | 5 +- tests/integration/expected/shr_u32.masm | 5 +- tests/integration/expected/shr_u64.masm | 5 +- tests/integration/expected/shr_u8.masm | 5 +- tests/integration/expected/sub_felt.masm | 8 +- tests/integration/expected/sub_i128.masm | 5 +- tests/integration/expected/sub_i16.masm | 5 +- tests/integration/expected/sub_i32.masm | 5 +- tests/integration/expected/sub_i64.masm | 5 +- tests/integration/expected/sub_i8.masm | 5 +- tests/integration/expected/sub_u128.masm | 5 +- tests/integration/expected/sub_u16.masm | 5 +- tests/integration/expected/sub_u32.masm | 5 +- tests/integration/expected/sub_u64.masm | 5 +- tests/integration/expected/sub_u8.masm | 5 +- tests/integration/expected/types/array.masm | 10 +- tests/integration/expected/types/enum.masm | 10 +- .../expected/types/static_mut.masm | 12 +- tests/integration/expected/vec_alloc_vec.masm | 59 +- tests/integration/expected/xor_bool.masm | 5 +- .../abi_transform/advice_map.rs | 16 +- .../abi_transform/tx_kernel.rs | 21 +- .../src/rust_masm_tests/examples.rs | 33 +- tests/integration/src/rust_masm_tests/mod.rs | 20 +- .../src/rust_masm_tests/rust_sdk/macros.rs | 8 +- .../src/rust_masm_tests/rust_sdk/mod.rs | 43 +- .../src/rust_masm_tests/wit_sdk.rs | 20 +- tests/integration/src/testing/eval.rs | 17 +- .../rust-sdk/account-test/src/lib.rs | 8 +- tests/rust-apps-wasm/rust-sdk/add/Cargo.lock | 634 +++++- .../component-macros-account/Cargo.lock | 622 +++++- .../rust-sdk/component-macros-note/Cargo.lock | 622 +++++- .../cross-ctx-account-word-arg/Cargo.lock | 634 +++++- .../cross-ctx-account-word/Cargo.lock | 634 +++++- .../rust-sdk/cross-ctx-account/Cargo.lock | 634 +++++- .../cross-ctx-note-word-arg/Cargo.lock | 634 +++++- .../rust-sdk/cross-ctx-note-word/Cargo.lock | 634 +++++- .../rust-sdk/cross-ctx-note/Cargo.lock | 634 +++++- tools/cargo-miden/Cargo.toml | 4 +- .../src/commands/example_project.rs | 8 +- tools/cargo-miden/src/commands/new_project.rs | 5 +- tools/cargo-miden/src/lib.rs | 1 + tools/cargo-miden/src/template.rs | 580 ++++++ 253 files changed, 14352 insertions(+), 3979 deletions(-) rename frontend/wasm/src/miden_abi/tx_kernel/{note.rs => active_note.rs} (92%) create mode 100644 frontend/wasm/src/miden_abi/tx_kernel/output_note.rs rename sdk/base-sys/src/bindings/{note.rs => active_note.rs} (91%) create mode 100644 sdk/base-sys/src/bindings/output_note.rs rename sdk/base-sys/stubs/{note.rs => active_note.rs} (71%) create mode 100644 sdk/base-sys/stubs/output_note.rs create mode 100644 tools/cargo-miden/src/template.rs diff --git a/Cargo.lock b/Cargo.lock index 05173d312..744c7ccfd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -51,8 +51,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5a15f179cd60c4584b8a8c596927aadc462e27f2ca70c04e0071964a73ba7a75" dependencies = [ "cfg-if", - "const-random", - "getrandom 0.3.3", "once_cell", "version_check", "zerocopy", @@ -67,15 +65,6 @@ dependencies = [ "memchr", ] -[[package]] -name = "aligned" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "377e4c0ba83e4431b10df45c1d4666f178ea9c552cac93e60c3a88bf32785923" -dependencies = [ - "as-slice", -] - [[package]] name = "allocator-api2" version = "0.2.21" @@ -177,15 +166,6 @@ version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" -[[package]] -name = "as-slice" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "516b6b4f0e40d50dcda9365d53964ec74560ad4284da2e7fc97122cd83174516" -dependencies = [ - "stable_deref_trait", -] - [[package]] name = "ascii-canvas" version = "4.0.0" @@ -212,17 +192,6 @@ version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" -[[package]] -name = "auth-git2" -version = "0.5.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4888bf91cce63baf1670512d0f12b5d636179a4abbad6504812ac8ab124b3efe" -dependencies = [ - "dirs", - "git2", - "terminal-prompt", -] - [[package]] name = "autocfg" version = "1.5.0" @@ -369,7 +338,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "234113d19d0d7d613b40e86fb654acf958910802bcceab913a4f9e7cda03b1a4" dependencies = [ "memchr", - "regex-automata", "serde", ] @@ -400,57 +368,15 @@ dependencies = [ "serde", ] -[[package]] -name = "cargo-generate" -version = "0.23.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85a4d22feb993dd24d64547c18f4603c082c9bf10299b46cd372c5c258d5fdb7" -dependencies = [ - "anstyle", - "anyhow", - "auth-git2", - "cargo-util-schemas", - "clap", - "console 0.16.0", - "dialoguer", - "env_logger", - "fs-err", - "git2", - "gix-config", - "heck", - "home", - "ignore", - "indexmap", - "indicatif", - "liquid", - "liquid-core", - "liquid-derive", - "liquid-lib", - "log", - "names", - "paste", - "regex", - "remove_dir_all", - "rhai", - "sanitize-filename", - "semver 1.0.26", - "serde", - "tempfile", - "thiserror 2.0.12", - "time", - "toml 0.8.23", - "walkdir", -] - [[package]] name = "cargo-miden" version = "0.5.0" dependencies = [ "anyhow", - "cargo-generate", "cargo_metadata", "clap", "env_logger", + "liquid", "log", "miden-mast-package", "midenc-compile", @@ -460,7 +386,9 @@ dependencies = [ "semver 1.0.26", "serde", "serde_json", + "tempfile", "toml_edit 0.23.4", + "walkdir", ] [[package]] @@ -495,22 +423,6 @@ dependencies = [ "windows-sys 0.59.0", ] -[[package]] -name = "cargo-util-schemas" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7dc1a6f7b5651af85774ae5a34b4e8be397d9cf4bc063b7e6dbd99a841837830" -dependencies = [ - "semver 1.0.26", - "serde", - "serde-untagged", - "serde-value", - "thiserror 2.0.12", - "toml 0.8.23", - "unicode-xid", - "url", -] - [[package]] name = "cargo_metadata" version = "0.19.2" @@ -563,12 +475,6 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9555578bc9e57714c812a1f84e4fc5b4d21fcb063490c624de019f7464c91268" -[[package]] -name = "cfg_aliases" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" - [[package]] name = "chacha20" version = "0.9.1" @@ -604,7 +510,7 @@ dependencies = [ "js-sys", "num-traits", "wasm-bindgen", - "windows-link", + "windows-link 0.1.3", ] [[package]] @@ -665,7 +571,6 @@ dependencies = [ "anstyle", "clap_lex", "strsim", - "terminal_size 0.4.2", ] [[package]] @@ -730,58 +635,12 @@ dependencies = [ "syn", ] -[[package]] -name = "console" -version = "0.15.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "054ccb5b10f9f2cbf51eb355ca1d05c2d279ce1804688d0db74b4733a5aeafd8" -dependencies = [ - "encode_unicode", - "libc", - "once_cell", - "unicode-width 0.2.0", - "windows-sys 0.59.0", -] - -[[package]] -name = "console" -version = "0.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e09ced7ebbccb63b4c65413d821f2e00ce54c5ca4514ddc6b3c892fdbcbc69d" -dependencies = [ - "encode_unicode", - "libc", - "once_cell", - "unicode-width 0.2.0", - "windows-sys 0.60.2", -] - [[package]] name = "const-oid" version = "0.9.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" -[[package]] -name = "const-random" -version = "0.1.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87e00182fe74b066627d63b85fd550ac2998d4b0bd86bfed477a0ae4c7c71359" -dependencies = [ - "const-random-macro", -] - -[[package]] -name = "const-random-macro" -version = "0.1.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9d839f2a20b0aee515dc581a6172f2321f96cab76c1a38a4c584a194955390e" -dependencies = [ - "getrandom 0.2.16", - "once_cell", - "tiny-keccak", -] - [[package]] name = "constant_time_eq" version = "0.3.1" @@ -963,12 +822,30 @@ dependencies = [ ] [[package]] -name = "cvt" -version = "0.1.2" +name = "curve25519-dalek" +version = "4.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2ae9bf77fbf2d39ef573205d554d87e86c12f1994e9ea335b0651b9b278bcf1" +checksum = "97fb8b7c4503de7d6ae7b42ab72a5a59857b4c937ec27a3d4539dba95b5ab2be" dependencies = [ "cfg-if", + "cpufeatures", + "curve25519-dalek-derive", + "digest", + "fiat-crypto", + "rustc_version 0.4.1", + "subtle", + "zeroize", +] + +[[package]] +name = "curve25519-dalek-derive" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" +dependencies = [ + "proc-macro2", + "quote", + "syn", ] [[package]] @@ -1006,6 +883,36 @@ dependencies = [ "syn", ] +[[package]] +name = "deadpool" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0be2b1d1d6ec8d846f05e137292d0b89133caf95ef33695424c09568bdd39b1b" +dependencies = [ + "deadpool-runtime", + "lazy_static", + "num_cpus", + "tokio", +] + +[[package]] +name = "deadpool-runtime" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "092966b41edc516079bdf31ec78a2e0588d1d0c08f78b91d8307215928642b2b" +dependencies = [ + "tokio", +] + +[[package]] +name = "deadpool-sync" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "524bc3df0d57e98ecd022e21ba31166c2625e7d3e5bcc4510efaeeab4abcab04" +dependencies = [ + "deadpool-runtime", +] + [[package]] name = "der" version = "0.7.10" @@ -1045,19 +952,6 @@ dependencies = [ "syn", ] -[[package]] -name = "dialoguer" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "658bce805d770f407bc62102fca7c2c64ceef2fbcb2b8bd19d2765ce093980de" -dependencies = [ - "console 0.15.11", - "shell-words", - "tempfile", - "thiserror 1.0.69", - "zeroize", -] - [[package]] name = "diff" version = "0.1.13" @@ -1076,38 +970,6 @@ dependencies = [ "subtle", ] -[[package]] -name = "dirs" -version = "6.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3e8aa94d75141228480295a7d0e7feb620b1a5ad9f12bc40be62411e38cce4e" -dependencies = [ - "dirs-sys", -] - -[[package]] -name = "dirs-sys" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e01a3366d27ee9890022452ee61b2b63a67e6f13f58900b651ff5665f0bb1fab" -dependencies = [ - "libc", - "option-ext", - "redox_users", - "windows-sys 0.60.2", -] - -[[package]] -name = "displaydoc" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "dissimilar" version = "1.0.10" @@ -1128,6 +990,30 @@ dependencies = [ "spki", ] +[[package]] +name = "ed25519" +version = "2.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "115531babc129696a58c64a4fef0a8bf9e9698629fb97e9e40767d235cfbcd53" +dependencies = [ + "pkcs8", + "signature", +] + +[[package]] +name = "ed25519-dalek" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70e796c081cee67dc755e1a36a0a172b897fab85fc3f6bc48307991f64e4eca9" +dependencies = [ + "curve25519-dalek", + "ed25519", + "serde", + "sha2", + "subtle", + "zeroize", +] + [[package]] name = "either" version = "1.15.0" @@ -1163,12 +1049,6 @@ dependencies = [ "log", ] -[[package]] -name = "encode_unicode" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34aa73646ffb006b8f5147f3dc182bd4bcb190227ce861fc4a4844bf8e3cb2c0" - [[package]] name = "enum_dispatch" version = "0.3.13" @@ -1210,16 +1090,6 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" -[[package]] -name = "erased-serde" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e004d887f51fcb9fef17317a2f3525c887d8aa3f4f50fed920816a688284a5b7" -dependencies = [ - "serde", - "typeid", -] - [[package]] name = "errno" version = "0.3.13" @@ -1237,14 +1107,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2acce4a10f12dc2fb14a218589d4f1f62ef011b2d0cc4b3cb1bba8e94da14649" [[package]] -name = "faster-hex" -version = "0.10.0" +name = "fallible-streaming-iterator" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7223ae2d2f179b803433d9c830478527e92b8117eab39460edae7f1614d9fb73" -dependencies = [ - "heapless", - "serde", -] +checksum = "7360491ce676a36bf9bb3c56c1aa791658183a54d2744120f27285738d90465a" [[package]] name = "fastrand" @@ -1262,6 +1128,12 @@ dependencies = [ "subtle", ] +[[package]] +name = "fiat-crypto" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28dea519a9695b9977216879a3ebfddf92f1c08c05d984f8996aecd6ecdc811d" + [[package]] name = "filetime" version = "0.2.25" @@ -1315,13 +1187,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" [[package]] -name = "form_urlencoded" -version = "1.2.1" +name = "foldhash" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456" -dependencies = [ - "percent-encoding", -] +checksum = "77ce24cb58228fbb8aa041425bb1050850ac19177686ea6e0f41a70416f56fdb" [[package]] name = "fs-err" @@ -1342,20 +1211,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "fs_at" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14af6c9694ea25db25baa2a1788703b9e7c6648dcaeeebeb98f7561b5384c036" -dependencies = [ - "aligned", - "cfg-if", - "cvt", - "libc", - "nix", - "windows-sys 0.52.0", -] - [[package]] name = "funty" version = "2.0.0" @@ -1514,297 +1369,40 @@ dependencies = [ ] [[package]] -name = "git2" -version = "0.20.2" +name = "glob" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2deb07a133b1520dc1a5690e9bd08950108873d7ed5de38dcc74d3b5ebffa110" -dependencies = [ - "bitflags 2.9.1", - "libc", - "libgit2-sys", - "log", - "openssl-probe", - "openssl-sys", - "url", -] +checksum = "a8d1add55171497b4705a648c6b583acafb01d58050a51727785f0b2c8e0a2b2" [[package]] -name = "gix-actor" -version = "0.35.2" +name = "globset" +version = "0.4.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58ebbb8f41071c7cf318a0b1db667c34e1df49db7bf387d282a4e61a3b97882c" +checksum = "54a1028dfc5f5df5da8a56a73e6c153c9a9708ec57232470703592a3f18e49f5" dependencies = [ + "aho-corasick", "bstr", - "gix-date", - "gix-utils", - "itoa", - "thiserror 2.0.12", - "winnow", + "log", + "regex-automata", + "regex-syntax", ] [[package]] -name = "gix-config" -version = "0.45.1" +name = "group" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48f3c8f357ae049bfb77493c2ec9010f58cfc924ae485e1116c3718fc0f0d881" +checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" dependencies = [ - "bstr", - "gix-config-value", - "gix-features", - "gix-glob", - "gix-path", - "gix-ref", - "gix-sec", - "memchr", - "once_cell", - "smallvec", - "thiserror 2.0.12", - "unicode-bom", - "winnow", + "ff", + "rand_core 0.6.4", + "subtle", ] [[package]] -name = "gix-config-value" -version = "0.15.1" +name = "h2" +version = "0.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f012703eb67e263c6c1fc96649fec47694dd3e5d2a91abfc65e4a6a6dc85309" -dependencies = [ - "bitflags 2.9.1", - "bstr", - "gix-path", - "libc", - "thiserror 2.0.12", -] - -[[package]] -name = "gix-date" -version = "0.10.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7235bdf4d9d54a6901928e3a37f91c16f419e6957f520ed929c3d292b84226e" -dependencies = [ - "bstr", - "itoa", - "jiff", - "smallvec", - "thiserror 2.0.12", -] - -[[package]] -name = "gix-features" -version = "0.42.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56f4399af6ec4fd9db84dd4cf9656c5c785ab492ab40a7c27ea92b4241923fed" -dependencies = [ - "gix-path", - "gix-trace", - "gix-utils", - "libc", - "prodash", - "walkdir", -] - -[[package]] -name = "gix-fs" -version = "0.15.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67a0637149b4ef24d3ea55f81f77231401c8463fae6da27331c987957eb597c7" -dependencies = [ - "bstr", - "fastrand", - "gix-features", - "gix-path", - "gix-utils", - "thiserror 2.0.12", -] - -[[package]] -name = "gix-glob" -version = "0.20.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90181472925b587f6079698f79065ff64786e6d6c14089517a1972bca99fb6e9" -dependencies = [ - "bitflags 2.9.1", - "bstr", - "gix-features", - "gix-path", -] - -[[package]] -name = "gix-hash" -version = "0.18.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d4900562c662852a6b42e2ef03442eccebf24f047d8eab4f23bc12ef0d785d8" -dependencies = [ - "faster-hex", - "gix-features", - "sha1-checked", - "thiserror 2.0.12", -] - -[[package]] -name = "gix-hashtable" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5b5cb3c308b4144f2612ff64e32130e641279fcf1a84d8d40dad843b4f64904" -dependencies = [ - "gix-hash", - "hashbrown 0.14.5", - "parking_lot", -] - -[[package]] -name = "gix-lock" -version = "17.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "570f8b034659f256366dc90f1a24924902f20acccd6a15be96d44d1269e7a796" -dependencies = [ - "gix-tempfile", - "gix-utils", - "thiserror 2.0.12", -] - -[[package]] -name = "gix-object" -version = "0.49.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d957ca3640c555d48bb27f8278c67169fa1380ed94f6452c5590742524c40fbb" -dependencies = [ - "bstr", - "gix-actor", - "gix-date", - "gix-features", - "gix-hash", - "gix-hashtable", - "gix-path", - "gix-utils", - "gix-validate", - "itoa", - "smallvec", - "thiserror 2.0.12", - "winnow", -] - -[[package]] -name = "gix-path" -version = "0.10.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6279d323d925ad4790602105ae27df4b915e7a7d81e4cdba2603121c03ad111" -dependencies = [ - "bstr", - "gix-trace", - "gix-validate", - "home", - "once_cell", - "thiserror 2.0.12", -] - -[[package]] -name = "gix-ref" -version = "0.52.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1b7985657029684d759f656b09abc3e2c73085596d5cdb494428823970a7762" -dependencies = [ - "gix-actor", - "gix-features", - "gix-fs", - "gix-hash", - "gix-lock", - "gix-object", - "gix-path", - "gix-tempfile", - "gix-utils", - "gix-validate", - "memmap2", - "thiserror 2.0.12", - "winnow", -] - -[[package]] -name = "gix-sec" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0dabbc78c759ecc006b970339394951b2c8e1e38a37b072c105b80b84c308fd" -dependencies = [ - "bitflags 2.9.1", - "gix-path", - "libc", - "windows-sys 0.59.0", -] - -[[package]] -name = "gix-tempfile" -version = "17.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c750e8c008453a2dba67a2b0d928b7716e05da31173a3f5e351d5457ad4470aa" -dependencies = [ - "gix-fs", - "libc", - "once_cell", - "parking_lot", - "tempfile", -] - -[[package]] -name = "gix-trace" -version = "0.1.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2ccaf54b0b1743a695b482ca0ab9d7603744d8d10b2e5d1a332fef337bee658" - -[[package]] -name = "gix-utils" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5351af2b172caf41a3728eb4455326d84e0d70fe26fc4de74ab0bd37df4191c5" -dependencies = [ - "fastrand", - "unicode-normalization", -] - -[[package]] -name = "gix-validate" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77b9e00cacde5b51388d28ed746c493b18a6add1f19b5e01d686b3b9ece66d4d" -dependencies = [ - "bstr", - "thiserror 2.0.12", -] - -[[package]] -name = "glob" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8d1add55171497b4705a648c6b583acafb01d58050a51727785f0b2c8e0a2b2" - -[[package]] -name = "globset" -version = "0.4.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54a1028dfc5f5df5da8a56a73e6c153c9a9708ec57232470703592a3f18e49f5" -dependencies = [ - "aho-corasick", - "bstr", - "log", - "regex-automata", - "regex-syntax", -] - -[[package]] -name = "group" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" -dependencies = [ - "ff", - "rand_core 0.6.4", - "subtle", -] - -[[package]] -name = "h2" -version = "0.4.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17da50a276f1e01e0ba6c029e47b7100754904ee8a278f886546e98575380785" +checksum = "17da50a276f1e01e0ba6c029e47b7100754904ee8a278f886546e98575380785" dependencies = [ "atomic-waker", "bytes", @@ -1829,15 +1427,6 @@ dependencies = [ "crunchy", ] -[[package]] -name = "hash32" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47d60b12902ba28e2730cd37e95b8c9223af2808df9e902d4df49588d1470606" -dependencies = [ - "byteorder", -] - [[package]] name = "hashbrown" version = "0.14.5" @@ -1856,17 +1445,29 @@ checksum = "5971ac85611da7067dbfcabef3c70ebb5606018acd9e2a3903a0da507521e0d5" dependencies = [ "allocator-api2", "equivalent", - "foldhash", + "foldhash 0.1.5", ] [[package]] -name = "heapless" -version = "0.8.0" +name = "hashbrown" +version = "0.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0bfb9eb618601c89945a70e254898da93b13be0388091d42117462b265bb3fad" +checksum = "5419bdc4f6a9207fbeba6d11b604d481addf78ecd10c11ad51e76c2f6482748d" dependencies = [ - "hash32", - "stable_deref_trait", + "allocator-api2", + "equivalent", + "foldhash 0.2.0", + "rayon", + "serde", +] + +[[package]] +name = "hashlink" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7382cf6263419f2d8df38c55d7da83da5c18aef87fc7a7fc1fb1e344edfe14c1" +dependencies = [ + "hashbrown 0.15.4", ] [[package]] @@ -1905,15 +1506,6 @@ dependencies = [ "digest", ] -[[package]] -name = "home" -version = "0.5.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "589533453244b0995c858700322199b2becb13b627df2851f64a2775d024abcf" -dependencies = [ - "windows-sys 0.59.0", -] - [[package]] name = "http" version = "1.3.1" @@ -1972,7 +1564,7 @@ dependencies = [ "os_info", "serde", "serde_derive", - "toml 0.9.2", + "toml 0.9.8", "uuid", ] @@ -2025,7 +1617,7 @@ dependencies = [ "hyper", "libc", "pin-project-lite", - "socket2", + "socket2 0.5.10", "tokio", "tower-service", "tracing", @@ -2055,92 +1647,6 @@ dependencies = [ "cc", ] -[[package]] -name = "icu_collections" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "200072f5d0e3614556f94a9930d5dc3e0662a652823904c3a75dc3b0af7fee47" -dependencies = [ - "displaydoc", - "potential_utf", - "yoke", - "zerofrom", - "zerovec", -] - -[[package]] -name = "icu_locale_core" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0cde2700ccaed3872079a65fb1a78f6c0a36c91570f28755dda67bc8f7d9f00a" -dependencies = [ - "displaydoc", - "litemap", - "tinystr", - "writeable", - "zerovec", -] - -[[package]] -name = "icu_normalizer" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "436880e8e18df4d7bbc06d58432329d6458cc84531f7ac5f024e93deadb37979" -dependencies = [ - "displaydoc", - "icu_collections", - "icu_normalizer_data", - "icu_properties", - "icu_provider", - "smallvec", - "zerovec", -] - -[[package]] -name = "icu_normalizer_data" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00210d6893afc98edb752b664b8890f0ef174c8adbb8d0be9710fa66fbbf72d3" - -[[package]] -name = "icu_properties" -version = "2.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "016c619c1eeb94efb86809b015c58f479963de65bdb6253345c1a1276f22e32b" -dependencies = [ - "displaydoc", - "icu_collections", - "icu_locale_core", - "icu_properties_data", - "icu_provider", - "potential_utf", - "zerotrie", - "zerovec", -] - -[[package]] -name = "icu_properties_data" -version = "2.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "298459143998310acd25ffe6810ed544932242d3f07083eee1084d83a71bd632" - -[[package]] -name = "icu_provider" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03c80da27b5f4187909049ee2d72f276f0d9f99a42c306bd0131ecfe04d8e5af" -dependencies = [ - "displaydoc", - "icu_locale_core", - "stable_deref_trait", - "tinystr", - "writeable", - "yoke", - "zerofrom", - "zerotrie", - "zerovec", -] - [[package]] name = "id-arena" version = "2.2.1" @@ -2153,27 +1659,6 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" -[[package]] -name = "idna" -version = "1.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "686f825264d630750a544639377bae737628043f20d38bbc029e8f29ea968a7e" -dependencies = [ - "idna_adapter", - "smallvec", - "utf8_iter", -] - -[[package]] -name = "idna_adapter" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3acae9609540aa318d1bc588455225fb2085b9ed0c4f6bd0d9d5bcd86f1a0344" -dependencies = [ - "icu_normalizer", - "icu_properties", -] - [[package]] name = "ignore" version = "0.4.23" @@ -2198,26 +1683,14 @@ checksum = "ce23b50ad8242c51a442f3ff322d56b02f08852c77e4c0b4d3fd684abc89c683" [[package]] name = "indexmap" -version = "2.10.0" +version = "2.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe4cd85333e22411419a0bcae1297d25e58c9443848b11dc6a86fefe8c78a661" +checksum = "6717a8d2a5a929a1a2eb43a12812498ed141a0bcfb7e8f7844fbdbe4303bba9f" dependencies = [ "equivalent", - "hashbrown 0.15.4", + "hashbrown 0.16.0", "serde", -] - -[[package]] -name = "indicatif" -version = "0.18.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70a646d946d06bedbbc4cac4c218acf4bbf2d87757a784857025f4d447e4e1cd" -dependencies = [ - "console 0.16.0", - "portable-atomic", - "unicode-width 0.2.0", - "unit-prefix", - "web-time", + "serde_core", ] [[package]] @@ -2248,15 +1721,6 @@ dependencies = [ "syn", ] -[[package]] -name = "instant" -version = "0.1.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0242819d153cba4b4b05a5a8f2a7e9bbf97b6055b2a002b395c96b5ff3c0222" -dependencies = [ - "cfg-if", -] - [[package]] name = "intrusive-collections" version = "0.9.7" @@ -2275,17 +1739,6 @@ dependencies = [ "rustversion", ] -[[package]] -name = "io-uring" -version = "0.7.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b86e202f00093dcba4275d4636b93ef9dd75d025ae560d2521b45ea28ab49013" -dependencies = [ - "bitflags 2.9.1", - "cfg-if", - "libc", -] - [[package]] name = "is-terminal" version = "0.4.16" @@ -2349,12 +1802,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "be1f93b8b1eb69c77f24bbb0afdf66f54b632ee39af40ca21c4365a1d7347e49" dependencies = [ "jiff-static", - "jiff-tzdb-platform", "log", "portable-atomic", "portable-atomic-util", "serde", - "windows-sys 0.59.0", ] [[package]] @@ -2368,21 +1819,6 @@ dependencies = [ "syn", ] -[[package]] -name = "jiff-tzdb" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1283705eb0a21404d2bfd6eef2a7593d240bc42a0bdb39db0ad6fa2ec026524" - -[[package]] -name = "jiff-tzdb-platform" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "875a5a69ac2bab1a891711cf5eccbec1ce0341ea805560dcd90b7a2e925132e8" -dependencies = [ - "jiff-tzdb", -] - [[package]] name = "jobserver" version = "0.1.33" @@ -2484,20 +1920,6 @@ version = "0.2.174" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1171693293099992e19cddea4e8b849964e9846f4acee11b3948bcc337be8776" -[[package]] -name = "libgit2-sys" -version = "0.18.2+1.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c42fe03df2bd3c53a3a9c7317ad91d80c81cd1fb0caec8d7cc4cd2bfa10c222" -dependencies = [ - "cc", - "libc", - "libssh2-sys", - "libz-sys", - "openssl-sys", - "pkg-config", -] - [[package]] name = "libm" version = "0.2.15" @@ -2516,27 +1938,12 @@ dependencies = [ ] [[package]] -name = "libssh2-sys" -version = "0.3.1" +name = "libsqlite3-sys" +version = "0.34.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "220e4f05ad4a218192533b300327f5150e809b54c4ec83b5a1d91833601811b9" +checksum = "91632f3b4fb6bd1d72aa3d78f41ffecfcf2b1a6648d8c241dbe7dbfaf4875e15" dependencies = [ "cc", - "libc", - "libz-sys", - "openssl-sys", - "pkg-config", - "vcpkg", -] - -[[package]] -name = "libz-sys" -version = "1.1.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b70e7a7df205e92a1a4cd9aaae7898dac0aa555503cc0a649494d0d60e7651d" -dependencies = [ - "cc", - "libc", "pkg-config", "vcpkg", ] @@ -2613,12 +2020,6 @@ dependencies = [ "unicode-segmentation", ] -[[package]] -name = "litemap" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "241eaef5fd12c88705a01fc1066c48c4b36e0dd4377dcdc7ec3942cea7a69956" - [[package]] name = "lock_api" version = "0.4.13" @@ -2770,11 +2171,12 @@ dependencies = [ [[package]] name = "miden-air" -version = "0.18.0" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09f7f7261ba4f1ff0175138936c45e306ef773289cd697657e3120004f7a1a9f" +checksum = "06acfd2ddc25b68f9d23d2add3f15c0ec3f9890ce6418409d71bea9dc6590bd0" dependencies = [ "miden-core", + "miden-utils-indexing", "thiserror 2.0.12", "winter-air", "winter-prover", @@ -2782,9 +2184,9 @@ dependencies = [ [[package]] name = "miden-assembly" -version = "0.18.0" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7719656b8064503cb84405ed9d9124025b4e90731f4577d0dc747242d483ea4" +checksum = "d1219b9e48bb286b58a23bb65cf74baa1b24ddbcb462ca625b38186674571047" dependencies = [ "log", "miden-assembly-syntax", @@ -2796,9 +2198,9 @@ dependencies = [ [[package]] name = "miden-assembly-syntax" -version = "0.18.0" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b343d32937785e508c2ea094e11f5d9aca6f0dda37ee1cf4aa7c3309ae9c089" +checksum = "1eeaef2853061c54527bb2664c0c832ce3d1f80847c79512455fec3b93057f2a" dependencies = [ "aho-corasick", "lalrpop", @@ -2830,7 +2232,7 @@ name = "miden-base-macros" version = "0.7.0" dependencies = [ "heck", - "miden-objects 0.12.0 (git+https://github.com/0xMiden/miden-base?rev=8a50c8f98529f9a78655385e3e78a6de44db9316)", + "miden-objects", "proc-macro2", "quote", "semver 1.0.26", @@ -2848,41 +2250,68 @@ dependencies = [ [[package]] name = "miden-client" version = "0.12.0" -source = "git+https://github.com/0xMiden/miden-client?rev=4099516c08c9a56c6d1271fddfc798f40da0d702#4099516c08c9a56c6d1271fddfc798f40da0d702" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe3170c04004fefbb579facfdbc94889202e862998bb0ec49af687353b1982b1" dependencies = [ "anyhow", "async-trait", "chrono", + "futures", "getrandom 0.3.3", "hex", - "miden-lib 0.12.0 (git+https://github.com/0xMiden/miden-base?branch=next)", + "miden-lib", "miden-node-proto-build", - "miden-objects 0.12.0 (git+https://github.com/0xMiden/miden-base?branch=next)", + "miden-note-transport-proto-build", + "miden-objects", "miden-remote-prover-client", "miden-tx", "miette", - "prost", + "prost 0.14.1", "prost-build", + "prost-types 0.14.1", "protox 0.7.2", - "rand 0.9.2", + "rand", "thiserror 2.0.12", "tonic", "tonic-build", + "tonic-health", + "tonic-prost", + "tonic-prost-build", "tonic-web-wasm-client", "tracing", "web-sys", ] +[[package]] +name = "miden-client-sqlite-store" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3f74888dbb2269093a1fc38cd14e0ec71413f41a2eb24ebb5a9bb138f661311" +dependencies = [ + "anyhow", + "async-trait", + "chrono", + "deadpool", + "deadpool-sync", + "miden-client", + "miden-objects", + "rusqlite", + "rusqlite_migration", + "thiserror 2.0.12", + "tokio", +] + [[package]] name = "miden-core" -version = "0.18.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97d53557ea0e5e529675c562c1a90eb5afc242fdac14d1f85b98d770304f9a24" +checksum = "452a00429d05c416001ec0578291eb88e115cf94fc22b3308267abfdcd813440" dependencies = [ "enum_dispatch", "miden-crypto", "miden-debug-types", "miden-formatting", + "miden-utils-indexing", "num-derive", "num-traits", "thiserror 2.0.12", @@ -2892,35 +2321,50 @@ dependencies = [ [[package]] name = "miden-crypto" -version = "0.17.0" +version = "0.18.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b8c283ed3017d58d9b648d9b1099f26abff52b185ecbb7b91ff4fb406c286b7" +checksum = "7eb82051002f9c64878d3b105a7b924de1ee92019231923380cf4ecd7b824f9a" dependencies = [ "blake3", "cc", "chacha20poly1305", + "ed25519-dalek", "flume", - "getrandom 0.2.16", "glob", + "hashbrown 0.16.0", "hkdf", "k256", + "miden-crypto-derive", "num", "num-complex", - "rand 0.9.2", - "rand_chacha 0.9.0", + "rand", + "rand_chacha", "rand_core 0.9.3", "rand_hc", + "rayon", "sha3", + "subtle", "thiserror 2.0.12", "winter-crypto", "winter-math", "winter-utils", - "zeroize", + "x25519-dalek", +] + +[[package]] +name = "miden-crypto-derive" +version = "0.18.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2222f37355ea975f40acd3c098a437574a31a4d8a2c193cf4e9fead2beede577" +dependencies = [ + "quote", + "syn", ] [[package]] name = "miden-debug" version = "0.4.1" +source = "git+https://github.com/0xMiden/miden-debug?rev=0cfdc623f51c721ff7812a0f70836ffaea182898#0cfdc623f51c721ff7812a0f70836ffaea182898" dependencies = [ "clap", "crossterm", @@ -2950,18 +2394,19 @@ dependencies = [ [[package]] name = "miden-debug-types" -version = "0.18.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "188d28a5d7df27e4735095e717845a4558b2d121f822f66e8cc2ddfddf92d5bc" +checksum = "97eed62ac0ca7420e49148fd306c74786b23a8d31df6da6277c671ba3e5c619a" dependencies = [ "memchr", "miden-crypto", "miden-formatting", "miden-miette", + "miden-utils-indexing", "miden-utils-sync", "paste", "serde", - "serde_spanned 1.0.0", + "serde_spanned 1.0.3", "thiserror 2.0.12", ] @@ -2981,12 +2426,13 @@ dependencies = [ "anyhow", "fs2", "miden-client", + "miden-client-sqlite-store", "miden-core", "miden-integration-tests", "miden-mast-package", - "miden-objects 0.12.0 (git+https://github.com/0xMiden/miden-base?rev=8a50c8f98529f9a78655385e3e78a6de44db9316)", + "miden-objects", "midenc-frontend-wasm", - "rand 0.9.2", + "rand", "temp-dir", "tokio", "uuid", @@ -3008,8 +2454,9 @@ dependencies = [ "miden-assembly", "miden-core", "miden-debug", + "miden-lib", "miden-mast-package", - "miden-objects 0.12.0 (git+https://github.com/0xMiden/miden-base?rev=8a50c8f98529f9a78655385e3e78a6de44db9316)", + "miden-objects", "miden-processor", "midenc-codegen-masm", "midenc-compile", @@ -3029,31 +2476,15 @@ dependencies = [ [[package]] name = "miden-lib" -version = "0.12.0" -source = "git+https://github.com/0xMiden/miden-base?branch=next#8a50c8f98529f9a78655385e3e78a6de44db9316" -dependencies = [ - "Inflector", - "fs-err", - "miden-assembly", - "miden-core", - "miden-objects 0.12.0 (git+https://github.com/0xMiden/miden-base?branch=next)", - "miden-processor", - "miden-stdlib", - "regex", - "thiserror 2.0.12", - "walkdir", -] - -[[package]] -name = "miden-lib" -version = "0.12.0" -source = "git+https://github.com/0xMiden/miden-base?rev=8a50c8f98529f9a78655385e3e78a6de44db9316#8a50c8f98529f9a78655385e3e78a6de44db9316" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44abeb7f67252547fa54605e61e89256fa546e2f25de382ccac78a1ced07ff88" dependencies = [ "Inflector", "fs-err", "miden-assembly", "miden-core", - "miden-objects 0.12.0 (git+https://github.com/0xMiden/miden-base?rev=8a50c8f98529f9a78655385e3e78a6de44db9316)", + "miden-objects", "miden-processor", "miden-stdlib", "regex", @@ -3063,9 +2494,9 @@ dependencies = [ [[package]] name = "miden-mast-package" -version = "0.18.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e1777c12930a070feed3f5c777db8374ba71bc36f153223c48cd9ee82cde3f4" +checksum = "1d13e6ba2b357551598f13396ed52f8f21aa99979aa3b338bb5521feeda19c8a" dependencies = [ "derive_more", "miden-assembly-syntax", @@ -3117,77 +2548,76 @@ dependencies = [ [[package]] name = "miden-node-proto-build" -version = "0.12.0" -source = "git+https://github.com/0xMiden/miden-node?branch=next#c99e200016942fd45f57415de819444891857003" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c26ad2f622716259baf57990226a7285290f6ef5e98bc69028a6727a19a2d7ad" dependencies = [ "fs-err", "miette", - "prost", - "protox 0.8.0", - "tonic-build", + "protox 0.9.0", + "tonic-prost-build", ] [[package]] -name = "miden-objects" -version = "0.12.0" -source = "git+https://github.com/0xMiden/miden-base?branch=next#8a50c8f98529f9a78655385e3e78a6de44db9316" +name = "miden-note-transport-proto-build" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "86d7a7b3a64c71d33f771d32cde58559207819a64ada9add0acb31857e111b9d" dependencies = [ - "bech32", - "getrandom 0.3.3", - "miden-assembly", - "miden-core", - "miden-crypto", - "miden-mast-package", - "miden-processor", - "miden-utils-sync", - "miden-verifier", - "semver 1.0.26", - "serde", - "thiserror 2.0.12", - "toml 0.9.2", + "fs-err", + "miette", + "protox 0.9.0", + "tonic-prost-build", ] [[package]] name = "miden-objects" -version = "0.12.0" -source = "git+https://github.com/0xMiden/miden-base?rev=8a50c8f98529f9a78655385e3e78a6de44db9316#8a50c8f98529f9a78655385e3e78a6de44db9316" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ef49472012d00be68f68dcbb13b4f28867fb6271c76c014bc555ef6e8e0958a" dependencies = [ "bech32", "getrandom 0.3.3", "miden-assembly", + "miden-assembly-syntax", "miden-core", "miden-crypto", "miden-mast-package", "miden-processor", "miden-utils-sync", "miden-verifier", + "rand", "semver 1.0.26", "serde", "thiserror 2.0.12", - "toml 0.9.2", + "toml 0.9.8", ] [[package]] name = "miden-processor" -version = "0.18.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eac41df96664be720b0fbffd9c132a35a0432b5d2e625ba191a83b0d89646a2c" +checksum = "d2ef77929651b8755965cde8f589bd38e2345a619d54cab6427f91aa23c47f6a" dependencies = [ + "itertools 0.14.0", "miden-air", "miden-core", "miden-debug-types", "miden-utils-diagnostics", + "miden-utils-indexing", "paste", + "rayon", "thiserror 2.0.12", + "tokio", "tracing", "winter-prover", ] [[package]] name = "miden-prover" -version = "0.18.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ab58a684b0133195fbf2583d3759635fbf1fd796d3a1608752509f279be0b30" +checksum = "84c30a5d10baeec17b9336de8544cb7f9b96b32de757c4cfb8d95ee0521bb5cd" dependencies = [ "miden-air", "miden-debug-types", @@ -3199,21 +2629,21 @@ dependencies = [ [[package]] name = "miden-remote-prover-client" -version = "0.12.0" -source = "git+https://github.com/0xMiden/miden-node?branch=next#c99e200016942fd45f57415de819444891857003" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "045f5ef567fe03b0c515a73c62b33ea9a69b4e54d6b538e23fa3837f25ea09fc" dependencies = [ "getrandom 0.3.3", "miden-node-proto-build", - "miden-objects 0.12.0 (git+https://github.com/0xMiden/miden-base?branch=next)", + "miden-objects", "miden-tx", "miette", - "prost", - "prost-build", - "protox 0.8.0", + "prost 0.14.1", "thiserror 2.0.12", "tokio", "tonic", - "tonic-build", + "tonic-prost", + "tonic-prost-build", "tonic-web-wasm-client", ] @@ -3223,11 +2653,12 @@ version = "0.7.0" [[package]] name = "miden-stdlib" -version = "0.18.0" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94e78035c073f88709af30eb7823390b05eaeb6692a8eac869f309ba836968d9" +checksum = "5e90a5de45a1e6213ff17b66fff8accde0bbc64264e2c22bbcb9a895f8f3b767" dependencies = [ "env_logger", + "fs-err", "miden-assembly", "miden-core", "miden-crypto", @@ -3262,24 +2693,25 @@ dependencies = [ [[package]] name = "miden-tx" -version = "0.12.0" -source = "git+https://github.com/0xMiden/miden-base?branch=next#8a50c8f98529f9a78655385e3e78a6de44db9316" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8d0ddcbaaa1002b954525212ebfa7ee097e6af9d26847b3d977b3ffa9f3edeb" dependencies = [ - "miden-lib 0.12.0 (git+https://github.com/0xMiden/miden-base?branch=next)", - "miden-objects 0.12.0 (git+https://github.com/0xMiden/miden-base?branch=next)", + "miden-lib", + "miden-objects", "miden-processor", "miden-prover", "miden-verifier", - "rand 0.9.2", + "rand", "thiserror 2.0.12", "tokio", ] [[package]] name = "miden-utils-diagnostics" -version = "0.18.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa555f9ee912ca23317d75fab2a65380b8191de66715237c228cf09165266dec" +checksum = "1a3ff4c019d96539a7066626efb4dce5c9fb7b0e44e961b0c2571e78f34236d5" dependencies = [ "miden-crypto", "miden-debug-types", @@ -3288,11 +2720,20 @@ dependencies = [ "tracing", ] +[[package]] +name = "miden-utils-indexing" +version = "0.19.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c798250bee4e856d4f18c161e91cdcbef1906f6614d00cf0063b47031c0f8cc6" +dependencies = [ + "thiserror 2.0.12", +] + [[package]] name = "miden-utils-sync" -version = "0.18.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1873b21e18ba6ab6c697f155a2adb8f35f5ac386f6bb41ae7c207b2ad683642" +checksum = "feebe7d896c013ea74dbc98de978836606356a044d4ed3b61ded54d3b319d89f" dependencies = [ "lock_api", "loom", @@ -3301,9 +2742,9 @@ dependencies = [ [[package]] name = "miden-verifier" -version = "0.18.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "759989d95534d658ad6a9d7946bbe617814611a1b89b42e944462ea8ffb4de9d" +checksum = "b8f8e47b78bba1fe1b31faee8f12aafd95385f6d6a8b108b03e92f5d743bb29f" dependencies = [ "miden-air", "miden-core", @@ -3341,7 +2782,7 @@ dependencies = [ "miden-assembly", "miden-assembly-syntax", "miden-core", - "miden-lib 0.12.0 (git+https://github.com/0xMiden/miden-base?rev=8a50c8f98529f9a78655385e3e78a6de44db9316)", + "miden-lib", "miden-mast-package", "miden-processor", "miden-thiserror", @@ -3608,7 +3049,7 @@ dependencies = [ "miden-assembly-syntax", "miden-core", "miden-debug-types", - "miden-lib 0.12.0 (git+https://github.com/0xMiden/miden-base?rev=8a50c8f98529f9a78655385e3e78a6de44db9316)", + "miden-lib", "miden-mast-package", "miden-stdlib", "miden-thiserror", @@ -3684,15 +3125,6 @@ version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1d87ecb2933e8aeadb3e3a02b828fed80a7528047e68b4f424523a0981a3a084" -[[package]] -name = "names" -version = "0.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7bddcd3bf5144b6392de80e04c347cd7fab2508f6df16a85fc496ecd5cec39bc" -dependencies = [ - "rand 0.8.5", -] - [[package]] name = "nanorand" version = "0.7.0" @@ -3708,34 +3140,13 @@ version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "650eef8c711430f1a879fdd01d4745a7deea475becfb90269c06775983bbf086" -[[package]] -name = "nix" -version = "0.29.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71e2746dc3a24dd78b3cfcb7be93368c6de9963d30f43a6a73998a9cf4b17b46" -dependencies = [ - "bitflags 2.9.1", - "cfg-if", - "cfg_aliases", - "libc", -] - -[[package]] -name = "normpath" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8911957c4b1549ac0dc74e30db9c8b0e66ddcd6d7acc33098f4c63a64a6d7ed" -dependencies = [ - "windows-sys 0.59.0", -] - [[package]] name = "nu-ansi-term" version = "0.50.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5" dependencies = [ - "windows-sys 0.60.2", + "windows-sys 0.61.2", ] [[package]] @@ -3829,6 +3240,16 @@ dependencies = [ "libm", ] +[[package]] +name = "num_cpus" +version = "1.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91df4bbde75afed763b708b7eee1e8e7651e02d97f6d5dd763e89367e957b23b" +dependencies = [ + "hermit-abi", + "libc", +] + [[package]] name = "object" version = "0.36.7" @@ -3845,9 +3266,6 @@ name = "once_cell" version = "1.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" -dependencies = [ - "portable-atomic", -] [[package]] name = "once_cell_polyfill" @@ -3895,33 +3313,6 @@ version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d05e27ee213611ffe7d6348b942e8f942b37114c00cc03cec254295a4a17852e" -[[package]] -name = "openssl-sys" -version = "0.9.109" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90096e2e47630d78b7d1c20952dc621f957103f8bc2c8359ec81290d75238571" -dependencies = [ - "cc", - "libc", - "pkg-config", - "vcpkg", -] - -[[package]] -name = "option-ext" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" - -[[package]] -name = "ordered-float" -version = "2.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68f19d67e5a2795c94e73e0bb1cc1a7edeb2e28efd39e2e1c9b7a40c1108b11c" -dependencies = [ - "num-traits", -] - [[package]] name = "os_info" version = "3.12.0" @@ -4197,15 +3588,6 @@ dependencies = [ "portable-atomic", ] -[[package]] -name = "potential_utf" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5a7c30837279ca13e7c867e9e40053bc68740f988cb07f7ca6df43cc734b585" -dependencies = [ - "zerovec", -] - [[package]] name = "powerfmt" version = "0.2.0" @@ -4256,16 +3638,6 @@ dependencies = [ "unicode-ident", ] -[[package]] -name = "prodash" -version = "29.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f04bb108f648884c23b98a0e940ebc2c93c0c3b89f04dbaf7eb8256ce617d1bc" -dependencies = [ - "log", - "parking_lot", -] - [[package]] name = "proptest" version = "1.8.0" @@ -4277,8 +3649,8 @@ dependencies = [ "bitflags 2.9.1", "lazy_static", "num-traits", - "rand 0.9.2", - "rand_chacha 0.9.0", + "rand", + "rand_chacha", "rand_xorshift", "regex-syntax", "rusty-fork", @@ -4293,24 +3665,36 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2796faa41db3ec313a31f7624d9286acf277b52de526150b7e69f3debf891ee5" dependencies = [ "bytes", - "prost-derive", + "prost-derive 0.13.5", +] + +[[package]] +name = "prost" +version = "0.14.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7231bd9b3d3d33c86b58adbac74b5ec0ad9f496b19d22801d773636feaa95f3d" +dependencies = [ + "bytes", + "prost-derive 0.14.1", ] [[package]] name = "prost-build" -version = "0.13.5" +version = "0.14.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be769465445e8c1474e9c5dac2018218498557af32d9ed057325ec9a41ae81bf" +checksum = "ac6c3320f9abac597dcbc668774ef006702672474aad53c6d596b62e487b40b1" dependencies = [ "heck", - "itertools 0.14.0", + "itertools 0.10.5", "log", "multimap", "once_cell", "petgraph 0.7.1", "prettyplease", - "prost", - "prost-types", + "prost 0.14.1", + "prost-types 0.14.1", + "pulldown-cmark", + "pulldown-cmark-to-cmark", "regex", "syn", "tempfile", @@ -4323,7 +3707,20 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a56d757972c98b346a9b766e3f02746cde6dd1cd1d1d563472929fdd74bec4d" dependencies = [ "anyhow", - "itertools 0.14.0", + "itertools 0.10.5", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "prost-derive" +version = "0.14.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9120690fafc389a67ba3803df527d0ec9cbbc9cc45e4cc20b332996dfb672425" +dependencies = [ + "anyhow", + "itertools 0.10.5", "proc-macro2", "quote", "syn", @@ -4338,20 +3735,20 @@ dependencies = [ "logos 0.14.4", "miette", "once_cell", - "prost", - "prost-types", + "prost 0.13.5", + "prost-types 0.13.5", ] [[package]] name = "prost-reflect" -version = "0.15.3" +version = "0.16.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37587d5a8a1b3dc9863403d084fc2254b91ab75a702207098837950767e2260b" +checksum = "89a3ac73ec9a9118131a4594c9d336631a07852220a1d0ae03ee36b04503a063" dependencies = [ "logos 0.15.0", "miette", - "prost", - "prost-types", + "prost 0.14.1", + "prost-types 0.14.1", ] [[package]] @@ -4360,7 +3757,16 @@ version = "0.13.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "52c2c1bf36ddb1a1c396b3601a3cec27c2462e45f07c386894ec3ccf5332bd16" dependencies = [ - "prost", + "prost 0.13.5", +] + +[[package]] +name = "prost-types" +version = "0.14.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9b4db3d6da204ed77bb26ba83b6122a73aeb2e87e25fbf7ad2e84c4ccbf8f72" +dependencies = [ + "prost 0.14.1", ] [[package]] @@ -4371,25 +3777,25 @@ checksum = "6f352af331bf637b8ecc720f7c87bf903d2571fa2e14a66e9b2558846864b54a" dependencies = [ "bytes", "miette", - "prost", + "prost 0.13.5", "prost-reflect 0.14.7", - "prost-types", + "prost-types 0.13.5", "protox-parse 0.7.0", "thiserror 1.0.69", ] [[package]] name = "protox" -version = "0.8.0" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "424c2bd294b69c49b949f3619362bc3c5d28298cd1163b6d1a62df37c16461aa" +checksum = "8555716f64c546306ddf3383065dc40d4232609e79e0a4c50e94e87d54f30fb4" dependencies = [ "bytes", "miette", - "prost", - "prost-reflect 0.15.3", - "prost-types", - "protox-parse 0.8.0", + "prost 0.14.1", + "prost-reflect 0.16.2", + "prost-types 0.14.1", + "protox-parse 0.9.0", "thiserror 2.0.12", ] @@ -4401,22 +3807,42 @@ checksum = "a3a462d115462c080ae000c29a47f0b3985737e5d3a995fcdbcaa5c782068dde" dependencies = [ "logos 0.14.4", "miette", - "prost-types", + "prost-types 0.13.5", "thiserror 1.0.69", ] [[package]] name = "protox-parse" -version = "0.8.0" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57927f9dbeeffcce7192404deee6157a640cbb3fe8ac11eabbe571565949ab75" +checksum = "072eee358134396a4643dff81cfff1c255c9fbd3fb296be14bdb6a26f9156366" dependencies = [ "logos 0.15.0", "miette", - "prost-types", + "prost-types 0.14.1", "thiserror 2.0.12", ] +[[package]] +name = "pulldown-cmark" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e8bbe1a966bd2f362681a44f6edce3c2310ac21e4d5067a6e7ec396297a6ea0" +dependencies = [ + "bitflags 2.9.1", + "memchr", + "unicase", +] + +[[package]] +name = "pulldown-cmark-to-cmark" +version = "21.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8246feae3db61428fd0bb94285c690b460e4517d83152377543ca802357785f1" +dependencies = [ + "pulldown-cmark", +] + [[package]] name = "quick-error" version = "1.2.3" @@ -4453,37 +3879,16 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09" -[[package]] -name = "rand" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" -dependencies = [ - "libc", - "rand_chacha 0.3.1", - "rand_core 0.6.4", -] - [[package]] name = "rand" version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1" dependencies = [ - "rand_chacha 0.9.0", + "rand_chacha", "rand_core 0.9.3", ] -[[package]] -name = "rand_chacha" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" -dependencies = [ - "ppv-lite86", - "rand_core 0.6.4", -] - [[package]] name = "rand_chacha" version = "0.9.0" @@ -4580,22 +3985,11 @@ dependencies = [ "bitflags 2.9.1", ] -[[package]] -name = "redox_users" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd6f9d3d47bdd2ad6945c5015a226ec6155d0bcdfd8f7cd29f86b71f8de99d2b" -dependencies = [ - "getrandom 0.2.16", - "libredox", - "thiserror 2.0.12", -] - [[package]] name = "regex" -version = "1.11.1" +version = "1.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191" +checksum = "843bc0191f75f3e22651ae5f1e72939ab2f72a4bc30fa80a066bd66edefc24d4" dependencies = [ "aho-corasick", "memchr", @@ -4605,9 +3999,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.9" +version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908" +checksum = "5276caf25ac86c8d810222b3dbb938e512c55c6831a10f3e6ed1c93b84041f1c" dependencies = [ "aho-corasick", "memchr", @@ -4620,20 +4014,6 @@ version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" -[[package]] -name = "remove_dir_all" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "808cc0b475acf76adf36f08ca49429b12aad9f678cb56143d5b3cb49b9a1dd08" -dependencies = [ - "cfg-if", - "cvt", - "fs_at", - "libc", - "normpath", - "windows-sys 0.59.0", -] - [[package]] name = "rfc6979" version = "0.4.0" @@ -4645,45 +4025,41 @@ dependencies = [ ] [[package]] -name = "rhai" -version = "1.22.2" +name = "ring" +version = "0.17.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2780e813b755850e50b178931aaf94ed24f6817f46aaaf5d21c13c12d939a249" +checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7" dependencies = [ - "ahash", - "bitflags 2.9.1", - "instant", - "num-traits", - "once_cell", - "rhai_codegen", - "smallvec", - "smartstring", - "thin-vec", + "cc", + "cfg-if", + "getrandom 0.2.16", + "libc", + "untrusted", + "windows-sys 0.52.0", ] [[package]] -name = "rhai_codegen" -version = "2.2.0" +name = "rusqlite" +version = "0.36.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5a11a05ee1ce44058fa3d5961d05194fdbe3ad6b40f904af764d81b86450e6b" +checksum = "3de23c3319433716cf134eed225fe9986bc24f63bed9be9f20c329029e672dc7" dependencies = [ - "proc-macro2", - "quote", - "syn", + "bitflags 2.9.1", + "fallible-iterator", + "fallible-streaming-iterator", + "hashlink", + "libsqlite3-sys", + "smallvec", ] [[package]] -name = "ring" -version = "0.17.14" +name = "rusqlite_migration" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7" +checksum = "a324f81362b5cd8f2eeef82d032172fdf2ca70aeec64962ff55a56874fe5ec41" dependencies = [ - "cc", - "cfg-if", - "getrandom 0.2.16", - "libc", - "untrusted", - "windows-sys 0.52.0", + "log", + "rusqlite", ] [[package]] @@ -4831,15 +4207,6 @@ dependencies = [ "winapi-util", ] -[[package]] -name = "sanitize-filename" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc984f4f9ceb736a7bb755c3e3bd17dc56370af2600c9780dcc48c66453da34d" -dependencies = [ - "regex", -] - [[package]] name = "schannel" version = "0.1.27" @@ -4924,39 +4291,28 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "serde" -version = "1.0.219" +version = "1.0.228" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6" +checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e" dependencies = [ + "serde_core", "serde_derive", ] [[package]] -name = "serde-untagged" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "299d9c19d7d466db4ab10addd5703e4c615dec2a5a16dbbafe191045e87ee66e" -dependencies = [ - "erased-serde", - "serde", - "typeid", -] - -[[package]] -name = "serde-value" -version = "0.7.0" +name = "serde_core" +version = "1.0.228" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3a1a3341211875ef120e117ea7fd5228530ae7e7036a779fdc9117be6b3282c" +checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad" dependencies = [ - "ordered-float", - "serde", + "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.219" +version = "1.0.228" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00" +checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" dependencies = [ "proc-macro2", "quote", @@ -4997,32 +4353,11 @@ dependencies = [ [[package]] name = "serde_spanned" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40734c41988f7306bb04f0ecf60ec0f3f1caa34290e4e8ea471dcd3346483b83" -dependencies = [ - "serde", -] - -[[package]] -name = "sha1" -version = "0.10.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" -dependencies = [ - "cfg-if", - "cpufeatures", - "digest", -] - -[[package]] -name = "sha1-checked" -version = "0.10.0" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89f599ac0c323ebb1c6082821a54962b839832b03984598375bff3975b804423" +checksum = "e24345aa0fe688594e73770a5f6d1b216508b4f93484c0026d521acd30134392" dependencies = [ - "digest", - "sha1", + "serde_core", ] [[package]] @@ -5061,12 +4396,6 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "45bb67a18fa91266cc7807181f62f9178a6873bfad7dc788c42e6430db40184f" -[[package]] -name = "shell-words" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24188a676b6ae68c3b2cb3a01be17fbf7240ce009799bb56d5b1409051e78fde" - [[package]] name = "shlex" version = "1.3.0" @@ -5140,17 +4469,6 @@ dependencies = [ "serde", ] -[[package]] -name = "smartstring" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fb72c633efbaa2dd666986505016c32c3044395ceaf881518399d2f4127ee29" -dependencies = [ - "autocfg", - "static_assertions", - "version_check", -] - [[package]] name = "smawk" version = "0.3.2" @@ -5167,6 +4485,16 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "socket2" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17129e116933cf371d018bb80ae557e889637989d8638274fb25622827b03881" +dependencies = [ + "libc", + "windows-sys 0.60.2", +] + [[package]] name = "spin" version = "0.9.8" @@ -5291,17 +4619,6 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0bf256ce5efdfa370213c1dabab5935a12e49f2c58d15e9eac2870d3b4f27263" -[[package]] -name = "synstructure" -version = "0.13.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "syntect" version = "5.2.0" @@ -5360,7 +4677,7 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2111ef44dae28680ae9752bb89409e7310ca33a8c621ebe7b106cf5c928b3ac0" dependencies = [ - "windows-sys 0.60.2", + "windows-sys 0.61.2", ] [[package]] @@ -5372,16 +4689,6 @@ dependencies = [ "winapi-util", ] -[[package]] -name = "terminal-prompt" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "572818b3472910acbd5dff46a3413715c18e934b071ab2ba464a7b2c2af16376" -dependencies = [ - "libc", - "winapi", -] - [[package]] name = "terminal_size" version = "0.3.0" @@ -5413,12 +4720,6 @@ dependencies = [ "unicode-width 0.2.0", ] -[[package]] -name = "thin-vec" -version = "0.2.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "144f754d318415ac792f9d69fc87abbbfc043ce2ef041c60f16ad828f638717d" - [[package]] name = "thiserror" version = "1.0.69" @@ -5499,25 +4800,6 @@ dependencies = [ "time-core", ] -[[package]] -name = "tiny-keccak" -version = "2.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c9d3793400a45f954c52e73d068316d76b6f4e36977e3fcebb13a2721e80237" -dependencies = [ - "crunchy", -] - -[[package]] -name = "tinystr" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d4f6d1145dcb577acf783d4e601bc1d76a13337bb54e6233add580b07344c8b" -dependencies = [ - "displaydoc", - "zerovec", -] - [[package]] name = "tinytemplate" version = "1.2.1" @@ -5528,44 +4810,26 @@ dependencies = [ "serde_json", ] -[[package]] -name = "tinyvec" -version = "1.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09b3661f17e86524eccd4371ab0429194e0d7c008abb45f7a7495b1719463c71" -dependencies = [ - "tinyvec_macros", -] - -[[package]] -name = "tinyvec_macros" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" - [[package]] name = "tokio" -version = "1.46.1" +version = "1.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0cc3a2344dafbe23a245241fe8b09735b521110d30fcefbbd5feb1797ca35d17" +checksum = "ff360e02eab121e0bc37a2d3b4d4dc622e6eda3a8e5253d5435ecf5bd4c68408" dependencies = [ - "backtrace", "bytes", - "io-uring", "libc", "mio", "pin-project-lite", - "slab", - "socket2", + "socket2 0.6.1", "tokio-macros", - "windows-sys 0.52.0", + "windows-sys 0.61.2", ] [[package]] name = "tokio-macros" -version = "2.5.0" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e06d43f1345a3bcd39f6a56dbb7dcab2ba47e68e8ac134855e7e2bdbaf8cab8" +checksum = "af407857209536a95c8e56f8231ef2c2e2aff839b22e07a1ffcbc617e9db9fa5" dependencies = [ "proc-macro2", "quote", @@ -5591,6 +4855,7 @@ dependencies = [ "futures-core", "pin-project-lite", "tokio", + "tokio-util", ] [[package]] @@ -5621,14 +4886,14 @@ dependencies = [ [[package]] name = "toml" -version = "0.9.2" +version = "0.9.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed0aee96c12fa71097902e0bb061a5e1ebd766a6636bb605ba401c45c1650eac" +checksum = "f0dc8b1fb61449e27716ec0e1bdf0f6b8f3e8f6b05391e8497b8b6d7804ea6d8" dependencies = [ "indexmap", - "serde", - "serde_spanned 1.0.0", - "toml_datetime 0.7.0", + "serde_core", + "serde_spanned 1.0.3", + "toml_datetime 0.7.3", "toml_parser", "toml_writer", "winnow", @@ -5645,11 +4910,11 @@ dependencies = [ [[package]] name = "toml_datetime" -version = "0.7.0" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bade1c3e902f58d73d3f294cd7f20391c1cb2fbcb643b73566bc773971df91e3" +checksum = "f2cdb639ebbc97961c51720f858597f7f24c4fc295327923af55b74c3c724533" dependencies = [ - "serde", + "serde_core", ] [[package]] @@ -5674,8 +4939,8 @@ checksum = "7211ff1b8f0d3adae1663b7da9ffe396eabe1ca25f0b0bee42b0da29a9ddce93" dependencies = [ "indexmap", "serde", - "serde_spanned 1.0.0", - "toml_datetime 0.7.0", + "serde_spanned 1.0.3", + "toml_datetime 0.7.3", "toml_parser", "toml_writer", "winnow", @@ -5683,9 +4948,9 @@ dependencies = [ [[package]] name = "toml_parser" -version = "1.0.2" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b551886f449aa90d4fe2bdaa9f4a2577ad2dde302c61ecf262d80b116db95c10" +checksum = "c0cbe268d35bdb4bb5a56a2de88d0ad0eb70af5384a99d648cd4b3d04039800e" dependencies = [ "winnow", ] @@ -5698,15 +4963,15 @@ checksum = "5d99f8c9a7727884afe522e9bd5edbfc91a3312b36a77b5fb8926e4c31a41801" [[package]] name = "toml_writer" -version = "1.0.2" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcc842091f2def52017664b53082ecbbeb5c7731092bad69d2c63050401dfd64" +checksum = "df8b2b54733674ad286d16267dcfc7a71ed5c776e4ac7aa3c3e2561f7c637bf2" [[package]] name = "tonic" -version = "0.13.1" +version = "0.14.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e581ba15a835f4d9ea06c55ab1bd4dce26fc53752c69a04aac00703bfb49ba9" +checksum = "eb7613188ce9f7df5bfe185db26c5814347d110db17920415cf2fbcad85e7203" dependencies = [ "async-trait", "base64", @@ -5720,9 +4985,9 @@ dependencies = [ "hyper-util", "percent-encoding", "pin-project", - "prost", "rustls-native-certs", - "socket2", + "socket2 0.6.1", + "sync_wrapper", "tokio", "tokio-rustls", "tokio-stream", @@ -5734,23 +4999,61 @@ dependencies = [ [[package]] name = "tonic-build" -version = "0.13.1" +version = "0.14.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c40aaccc9f9eccf2cd82ebc111adc13030d23e887244bc9cfa5d1d636049de3" +dependencies = [ + "prettyplease", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tonic-health" +version = "0.14.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a82868bf299e0a1d2e8dce0dc33a46c02d6f045b2c1f1d6cc8dc3d0bf1812ef" +dependencies = [ + "prost 0.14.1", + "tokio", + "tokio-stream", + "tonic", + "tonic-prost", +] + +[[package]] +name = "tonic-prost" +version = "0.14.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "66bd50ad6ce1252d87ef024b3d64fe4c3cf54a86fb9ef4c631fdd0ded7aeaa67" +dependencies = [ + "bytes", + "prost 0.14.1", + "tonic", +] + +[[package]] +name = "tonic-prost-build" +version = "0.14.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eac6f67be712d12f0b41328db3137e0d0757645d8904b4cb7d51cd9c2279e847" +checksum = "b4a16cba4043dc3ff43fcb3f96b4c5c154c64cbd18ca8dce2ab2c6a451d058a2" dependencies = [ "prettyplease", "proc-macro2", "prost-build", - "prost-types", + "prost-types 0.14.1", "quote", "syn", + "tempfile", + "tonic-build", ] [[package]] name = "tonic-web-wasm-client" -version = "0.7.1" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "66e3bb7acca55e6790354be650f4042d418fcf8e2bc42ac382348f2b6bf057e5" +checksum = "898cd44be5e23e59d2956056538f1d6b3c5336629d384ffd2d92e76f87fb98ff" dependencies = [ "base64", "byteorder", @@ -5882,7 +5185,7 @@ dependencies = [ "serde_json", "target-triple", "termcolor", - "toml 0.9.2", + "toml 0.9.8", ] [[package]] @@ -5911,12 +5214,6 @@ version = "2.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6af6ae20167a9ece4bcb41af5b80f8a1f1df981f6391189ce00fd257af04126a" -[[package]] -name = "typeid" -version = "1.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc7d623258602320d5c55d1bc22793b57daff0ec7efc270ea7d55ce1d5f5471c" - [[package]] name = "typenum" version = "1.18.0" @@ -5936,10 +5233,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eaea85b334db583fe3274d12b4cd1880032beab409c0d774be044d4480ab9a94" [[package]] -name = "unicode-bom" -version = "2.0.3" +name = "unicase" +version = "2.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7eec5d1121208364f6793f7d2e222bf75a915c19557537745b195b253dd64217" +checksum = "75b844d17643ee918803943289730bec8aac480150456169e647ed0b576ba539" [[package]] name = "unicode-ident" @@ -5953,15 +5250,6 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3b09c83c3c29d37506a3e260c08c03743a6bb66a9cd432c6934ab501a190571f" -[[package]] -name = "unicode-normalization" -version = "0.1.24" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5033c97c4262335cded6d6fc3e5c18ab755e1a3dc96376350f3d8e9f009ad956" -dependencies = [ - "tinyvec", -] - [[package]] name = "unicode-segmentation" version = "1.12.0" @@ -5997,12 +5285,6 @@ version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" -[[package]] -name = "unit-prefix" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "323402cff2dd658f39ca17c789b502021b3f18707c91cdf22e3838e1b4023817" - [[package]] name = "universal-hash" version = "0.5.1" @@ -6019,23 +5301,6 @@ version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" -[[package]] -name = "url" -version = "2.5.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32f8b686cadd1473f4bd0117a5d28d36b1ade384ea9b5069a1c40aefed7fda60" -dependencies = [ - "form_urlencoded", - "idna", - "percent-encoding", -] - -[[package]] -name = "utf8_iter" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" - [[package]] name = "utf8parse" version = "0.2.2" @@ -6316,16 +5581,6 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "web-time" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a6580f308b1fad9207618087a65c04e7a10bc77e02c8e84e9b00dd4b12fa0bb" -dependencies = [ - "js-sys", - "wasm-bindgen", -] - [[package]] name = "winapi" version = "0.3.9" @@ -6348,7 +5603,7 @@ version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" dependencies = [ - "windows-sys 0.59.0", + "windows-sys 0.48.0", ] [[package]] @@ -6366,7 +5621,7 @@ dependencies = [ "windows-collections", "windows-core", "windows-future", - "windows-link", + "windows-link 0.1.3", "windows-numerics", ] @@ -6387,7 +5642,7 @@ checksum = "c0fdd3ddb90610c7638aa2b3a3ab2904fb9e5cdbecc643ddb3647212781c4ae3" dependencies = [ "windows-implement", "windows-interface", - "windows-link", + "windows-link 0.1.3", "windows-result", "windows-strings", ] @@ -6399,7 +5654,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fc6a41e98427b19fe4b73c550f060b59fa592d7d686537eebf9385621bfbad8e" dependencies = [ "windows-core", - "windows-link", + "windows-link 0.1.3", "windows-threading", ] @@ -6431,6 +5686,12 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5e6ad25900d524eaabdbbb96d20b4311e1e7ae1699af4fb28c17ae66c80d798a" +[[package]] +name = "windows-link" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" + [[package]] name = "windows-numerics" version = "0.2.0" @@ -6438,7 +5699,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9150af68066c4c5c07ddc0ce30421554771e528bde427614c61038bc2c92c2b1" dependencies = [ "windows-core", - "windows-link", + "windows-link 0.1.3", ] [[package]] @@ -6447,7 +5708,7 @@ version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "56f42bd332cc6c8eac5af113fc0c1fd6a8fd2aa08a0119358686e5160d0586c6" dependencies = [ - "windows-link", + "windows-link 0.1.3", ] [[package]] @@ -6456,7 +5717,7 @@ version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "56e6c93f3a0c3b36176cb1327a4958a0353d5d166c2a35cb268ace15e91d3b57" dependencies = [ - "windows-link", + "windows-link 0.1.3", ] [[package]] @@ -6495,6 +5756,15 @@ dependencies = [ "windows-targets 0.53.2", ] +[[package]] +name = "windows-sys" +version = "0.61.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" +dependencies = [ + "windows-link 0.2.1", +] + [[package]] name = "windows-targets" version = "0.48.5" @@ -6548,7 +5818,7 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b66463ad2e0ea3bbf808b7f1d371311c80e115c0b71d60efc142cafbcfb057a6" dependencies = [ - "windows-link", + "windows-link 0.1.3", ] [[package]] @@ -6691,9 +5961,9 @@ checksum = "271414315aff87387382ec3d271b52d7ae78726f5d44ac98b4f4030c91880486" [[package]] name = "winnow" -version = "0.7.12" +version = "0.7.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3edebf492c8125044983378ecb5766203ad3b4c2f7a922bd7dd207f6d443e95" +checksum = "21a0236b59786fed61e2a80582dd500fe61f18b5dca67a4a067d0bc9039339cf" dependencies = [ "memchr", ] @@ -6887,12 +6157,6 @@ dependencies = [ "wasmparser 0.239.0", ] -[[package]] -name = "writeable" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea2f10b9bb0928dfb1b42b65e1f9e36f7f54dbdf08457afefb38afcdec4fa2bb" - [[package]] name = "wyz" version = "0.5.1" @@ -6902,6 +6166,16 @@ dependencies = [ "tap", ] +[[package]] +name = "x25519-dalek" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7e468321c81fb07fa7f4c636c3972b9100f0346e5b6a9f2bd0603a52f7ed277" +dependencies = [ + "curve25519-dalek", + "rand_core 0.6.4", +] + [[package]] name = "yaml-rust" version = "0.4.5" @@ -6917,30 +6191,6 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cfe53a6657fd280eaa890a3bc59152892ffa3e30101319d168b781ed6529b049" -[[package]] -name = "yoke" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f41bb01b8226ef4bfd589436a297c53d118f65921786300e427be8d487695cc" -dependencies = [ - "serde", - "stable_deref_trait", - "yoke-derive", - "zerofrom", -] - -[[package]] -name = "yoke-derive" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38da3c9736e16c5d3c8c597a9aaa5d1fa565d0532ae05e27c24aa62fb32c0ab6" -dependencies = [ - "proc-macro2", - "quote", - "syn", - "synstructure", -] - [[package]] name = "zerocopy" version = "0.8.26" @@ -6961,62 +6211,8 @@ dependencies = [ "syn", ] -[[package]] -name = "zerofrom" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50cc42e0333e05660c3587f3bf9d0478688e15d870fab3346451ce7f8c9fbea5" -dependencies = [ - "zerofrom-derive", -] - -[[package]] -name = "zerofrom-derive" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d71e5d6e06ab090c67b5e44993ec16b72dcbaabc526db883a360057678b48502" -dependencies = [ - "proc-macro2", - "quote", - "syn", - "synstructure", -] - [[package]] name = "zeroize" version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" - -[[package]] -name = "zerotrie" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36f0bbd478583f79edad978b407914f61b2972f5af6fa089686016be8f9af595" -dependencies = [ - "displaydoc", - "yoke", - "zerofrom", -] - -[[package]] -name = "zerovec" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a05eb080e015ba39cc9e23bbe5e7fb04d5fb040350f99f34e338d5fdd294428" -dependencies = [ - "yoke", - "zerofrom", - "zerovec-derive", -] - -[[package]] -name = "zerovec-derive" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b96237efa0c878c64bd89c436f661be4e46b2f3eff1ebb976f7ef2321d2f58f" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] diff --git a/Cargo.toml b/Cargo.toml index a2a4e9585..6b5ad286e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -72,21 +72,21 @@ inventory = "0.3" log = "0.4" # Miden Dependencies -miden-assembly = { version = "0.18", default-features = false } -miden-core = { version = "0.18", default-features = false } +miden-assembly = { version = "0.19", default-features = false } +miden-core = { version = "0.19", default-features = false } miden-debug = { version = "0.4.1" } -miden-debug-types = { version = "0.18", default-features = false } -miden-assembly-syntax = { version = "0.18", default-features = false } +miden-debug-types = { version = "0.19", default-features = false } +miden-assembly-syntax = { version = "0.19", default-features = false } miden-formatting = { version = "0.1", default-features = false } miden-lib = { version = "0.12", default-features = false, features = [ "with-debug-info", ] } miden-objects = { version = "0.12", default-features = false } -miden-processor = { version = "0.18", default-features = false } -miden-stdlib = { version = "0.18", default-features = false, features = [ +miden-processor = { version = "0.19", default-features = false } +miden-stdlib = { version = "0.19", default-features = false, features = [ "with-debug-info", ] } -miden-mast-package = { version = "0.18", default-features = false } +miden-mast-package = { version = "0.19", default-features = false } miette = { package = "miden-miette", version = "7.1.1" } paste = "1.0" parking_lot = "0.12" @@ -159,13 +159,13 @@ midenc-expect-test = { path = "tools/expect-test" } #miden-assembly-syntax = { path = "../miden-vm/assembly-syntax" } #miden-core = { git = "https://github.com/0xMiden/miden-vm", rev = "614cd7f9b52f45238b0ab59c71ebb49325051e5d" } #miden-core = { path = "../miden-vm/core" } -miden-client = { git = "https://github.com/0xMiden/miden-client", rev = "4099516c08c9a56c6d1271fddfc798f40da0d702" } -miden-debug = { path = "../miden-debug" } +#miden-client = { git = "https://github.com/0xMiden/miden-client", rev = "4099516c08c9a56c6d1271fddfc798f40da0d702" } +miden-debug = { git = "https://github.com/0xMiden/miden-debug", rev = "0cfdc623f51c721ff7812a0f70836ffaea182898" } #miden-debug-types = { path = "../miden-vm/crates/debug/types" } #miden-processor = { git = "https://github.com/0xMiden/miden-vm", rev = "614cd7f9b52f45238b0ab59c71ebb49325051e5d" } #miden-processor = { path = "../miden-vm/processor" } -miden-lib = { git = "https://github.com/0xMiden/miden-base", rev = "8a50c8f98529f9a78655385e3e78a6de44db9316" } -miden-objects = { git = "https://github.com/0xMiden/miden-base", rev = "8a50c8f98529f9a78655385e3e78a6de44db9316" } +#miden-lib = { git = "https://github.com/0xMiden/miden-base", rev = "8a50c8f98529f9a78655385e3e78a6de44db9316" } +#miden-objects = { git = "https://github.com/0xMiden/miden-base", rev = "8a50c8f98529f9a78655385e3e78a6de44db9316" } #miden-stdlib = { git = "https://github.com/0xMiden/miden-vm", rev = "614cd7f9b52f45238b0ab59c71ebb49325051e5d" } #miden-stdlib = { path = "../miden-vm/stdlib" } #miden-mast-package = { git = "https://github.com/0xMiden/miden-vm", rev = "614cd7f9b52f45238b0ab59c71ebb49325051e5d" } diff --git a/codegen/masm/intrinsics/advice.masm b/codegen/masm/intrinsics/advice.masm index 34199f809..c943b6af5 100644 --- a/codegen/masm/intrinsics/advice.masm +++ b/codegen/masm/intrinsics/advice.masm @@ -26,12 +26,13 @@ end #! Emits an event to request a Falcon signature loaded to the advice stack #! MSG and PK are expected to be on the operand stack. +#! Emits the canonical `miden::auth::request` event introduced in node/client 0.12. #! #! Inputs: [msg3, msg2, msg1, msg0, pk3, pk2, pk1, pk0, ...] #! Outputs: [...] +const.AUTH_REQUEST_EVENT=event("miden::auth::request") export.emit_falcon_sig_to_stack - # 131087 == FALCON_SIG_TO_STACK from miden contracts - emit.131087 + emit.AUTH_REQUEST_EVENT dropw dropw end diff --git a/codegen/masm/intrinsics/crypto.masm b/codegen/masm/intrinsics/crypto.masm index 005c11308..c9cb81455 100644 --- a/codegen/masm/intrinsics/crypto.masm +++ b/codegen/masm/intrinsics/crypto.masm @@ -15,7 +15,7 @@ export.hmerge div padw movup.4 - mem_loadw + mem_loadw_be # Stack: [a3, a2, a1, a0, digests_ptr, result_ptr, ...] # Load second digest (B) from digests_ptr + 16 (4 felts * 4 bytes) @@ -26,7 +26,7 @@ export.hmerge div padw movup.4 - mem_loadw + mem_loadw_be # Stack: [b3, b2, b1, b0, a3, a2, a1, a0, result_ptr, ...] # The hmerge instruction expects [B, A] on the stack, which we already have @@ -40,7 +40,7 @@ export.hmerge push.4 div # Stack: [result_ptr/4, r0, r1, r2, r3, ...] - mem_storew + mem_storew_be # Stack: [r0, r1, r2, r3, ...] # Clean up diff --git a/codegen/masm/intrinsics/mem.masm b/codegen/masm/intrinsics/mem.masm index ee95ce0c6..24d2300c7 100644 --- a/codegen/masm/intrinsics/mem.masm +++ b/codegen/masm/intrinsics/mem.masm @@ -45,7 +45,7 @@ export.heap_init # [heap_base] push.0 # [0, heap_base, heap_base] swap.1 # [heap_base, 0, heap_base] push.MAGIC # [MAGIC, heap_base, heap_size(0), heap_top(heap_base)] - mem_storew.HEAP_INFO_ADDR + mem_storew_be.HEAP_INFO_ADDR dropw end diff --git a/codegen/masm/src/artifact.rs b/codegen/masm/src/artifact.rs index 993cff293..c29c6415b 100644 --- a/codegen/masm/src/artifact.rs +++ b/codegen/masm/src/artifact.rs @@ -357,7 +357,7 @@ impl MasmComponent { } fn emit_test_harness(&self, block: &mut masm::Block) { - use masm::{Instruction as Inst, IntValue, Op}; + use masm::{Instruction as Inst, IntValue, Op, PushValue}; use miden_core::{Felt, FieldElement}; let span = SourceSpan::default(); @@ -373,7 +373,7 @@ impl MasmComponent { // => [inits, inits] block.push(Op::Inst(Span::new(span, Inst::Dup0))); // => [inits > 0, inits] - block.push(Op::Inst(Span::new(span, Inst::Push(IntValue::U8(0).into())))); + block.push(Op::Inst(Span::new(span, Inst::Push(PushValue::Int(IntValue::U8(0)).into())))); block.push(Op::Inst(Span::new(span, Inst::Gt))); // Step 3: Loop until `inits == 0` @@ -412,7 +412,8 @@ impl MasmComponent { // => [inits', inits'] loop_body.push(Op::Inst(Span::new(span, Inst::Dup0))); // => [inits' > 0, inits'] - loop_body.push(Op::Inst(Span::new(span, Inst::Push(IntValue::U8(0).into())))); + loop_body + .push(Op::Inst(Span::new(span, Inst::Push(PushValue::Int(IntValue::U8(0)).into())))); loop_body.push(Op::Inst(Span::new(span, Inst::Gt))); // Step 4: Enter (or skip) loop diff --git a/codegen/masm/src/emit/mem.rs b/codegen/masm/src/emit/mem.rs index bb6a0b541..667e3349d 100644 --- a/codegen/masm/src/emit/mem.rs +++ b/codegen/masm/src/emit/mem.rs @@ -283,16 +283,9 @@ impl OpEmitter<'_> { if ptr.is_word_aligned() { self.emit_all( [ - // [w3, w2, w1, w0] - masm::Instruction::PadW, - masm::Instruction::MemLoadWImm(ptr.addr.into()), - // Swap the element order to lowest-address-first - // [w2, w1, w0, w3] - masm::Instruction::MovDn3, - // [w1, w0, w2, w3] - masm::Instruction::MovDn2, // [w0, w1, w2, w3] - masm::Instruction::Swap1, + masm::Instruction::PadW, + masm::Instruction::MemLoadWLeImm(ptr.addr.into()), masm::Instruction::U32AssertW, ], span, @@ -836,15 +829,8 @@ impl OpEmitter<'_> { [ // Stack: [a, b, c, d] masm::Instruction::U32AssertW, - // Swap to highest-address-first order - // [d, b, c, a] - masm::Instruction::Swap3, - // [c, d, b, a] - masm::Instruction::MovUp2, - // [d, c, b, a] - masm::Instruction::Swap1, // Write to heap - masm::Instruction::MemStoreWImm(ptr.addr.into()), + masm::Instruction::MemStoreWLeImm(ptr.addr.into()), masm::Instruction::DropW, ], span, diff --git a/codegen/masm/src/emit/mod.rs b/codegen/masm/src/emit/mod.rs index 30f121483..758f0e9f5 100644 --- a/codegen/masm/src/emit/mod.rs +++ b/codegen/masm/src/emit/mod.rs @@ -765,7 +765,7 @@ mod tests { assert_eq!(ops.len(), 7); assert_eq!(&ops[0], &push!(1u32)); assert_eq!(&ops[1], &push!(2u32)); - assert_eq!(&ops[2], &push!(3u32)); + assert_eq!(&ops[2], &push!(3u8)); assert_eq!(&ops[3], &push!(Felt::ZERO)); assert_eq!(&ops[4], &push!(Felt::ONE)); assert_eq!(&ops[5], &push!(Felt::new(u32::MAX as u64))); diff --git a/codegen/masm/src/lib.rs b/codegen/masm/src/lib.rs index 127c11828..846a88086 100644 --- a/codegen/masm/src/lib.rs +++ b/codegen/masm/src/lib.rs @@ -23,7 +23,7 @@ pub mod masm { pub use miden_assembly_syntax::{ ast::*, debuginfo::{SourceSpan, Span, Spanned}, - parser::IntValue, + parser::{IntValue, PushValue}, KernelLibrary, Library, LibraryNamespace, LibraryPath, }; } diff --git a/codegen/masm/src/lower/component.rs b/codegen/masm/src/lower/component.rs index fd26fbf79..81c9ec8d9 100644 --- a/codegen/masm/src/lower/component.rs +++ b/codegen/masm/src/lower/component.rs @@ -97,8 +97,7 @@ impl ToMasmComponent for builtin::Component { let rodata = data_segments_to_rodata(&link_info)?; let kernel = if matches!(context.session().options.target, TargetEnv::Rollup { .. }) { - todo!() - //Some(miden_lib::transaction::TransactionKernel::kernel()) + Some(miden_lib::transaction::TransactionKernel::kernel()) } else { None }; diff --git a/examples/auth-component-no-auth/Cargo.lock b/examples/auth-component-no-auth/Cargo.lock index 010f3420c..33e90bb3f 100644 --- a/examples/auth-component-no-auth/Cargo.lock +++ b/examples/auth-component-no-auth/Cargo.lock @@ -2,6 +2,16 @@ # It is not intended for manual editing. version = 4 +[[package]] +name = "aead" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d122413f284cf2d62fb1b7db97e02edb8cda96d769b16e443a4f6195e35662b0" +dependencies = [ + "crypto-common", + "generic-array", +] + [[package]] name = "aho-corasick" version = "1.1.3" @@ -51,6 +61,18 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" +[[package]] +name = "base16ct" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" + +[[package]] +name = "base64ct" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55248b47b0caf0546f7988906588779981c43bb1bc9d0c44087278f80cdb44ba" + [[package]] name = "bech32" version = "0.11.0" @@ -122,6 +144,47 @@ version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2fd1289c04a9ea8cb22300a459a72a385d7c73d3259e2ed7dcb2af674838cfa9" +[[package]] +name = "chacha20" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3613f74bd2eac03dad61bd53dbe620703d4371614fe0bc3b9f04dd36fe4e818" +dependencies = [ + "cfg-if", + "cipher", + "cpufeatures", +] + +[[package]] +name = "chacha20poly1305" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10cd79432192d1c0f4e1a0fef9527696cc039165d729fb41b3f4f4f354c2dc35" +dependencies = [ + "aead", + "chacha20", + "cipher", + "poly1305", + "zeroize", +] + +[[package]] +name = "cipher" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" +dependencies = [ + "crypto-common", + "inout", + "zeroize", +] + +[[package]] +name = "const-oid" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" + [[package]] name = "constant_time_eq" version = "0.3.1" @@ -137,6 +200,43 @@ dependencies = [ "libc", ] +[[package]] +name = "crossbeam-deque" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9dd111b7b7f7d55b72c0a6ae361660ee5853c9af73f70c3c2ef6858b950e2e51" +dependencies = [ + "crossbeam-epoch", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.9.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" + +[[package]] +name = "crypto-bigint" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76" +dependencies = [ + "generic-array", + "rand_core 0.6.4", + "subtle", + "zeroize", +] + [[package]] name = "crypto-common" version = "0.1.6" @@ -144,9 +244,47 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" dependencies = [ "generic-array", + "rand_core 0.6.4", "typenum", ] +[[package]] +name = "curve25519-dalek" +version = "4.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97fb8b7c4503de7d6ae7b42ab72a5a59857b4c937ec27a3d4539dba95b5ab2be" +dependencies = [ + "cfg-if", + "cpufeatures", + "curve25519-dalek-derive", + "digest", + "fiat-crypto", + "rustc_version 0.4.1", + "subtle", + "zeroize", +] + +[[package]] +name = "curve25519-dalek-derive" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "der" +version = "0.7.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7c1832837b905bbfb5101e07cc24c8deddf52f93225eee6ead5f4d63d53ddcb" +dependencies = [ + "const-oid", + "zeroize", +] + [[package]] name = "derive_more" version = "2.0.1" @@ -174,7 +312,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ "block-buffer", + "const-oid", "crypto-common", + "subtle", ] [[package]] @@ -183,12 +323,70 @@ version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8975ffdaa0ef3661bfe02dbdcc06c9f829dfafe6a3c474de366a8d5e44276921" +[[package]] +name = "ecdsa" +version = "0.16.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee27f32b5c5292967d2d4a9d7f1e0b0aed2c15daded5a60300e4abb9d8020bca" +dependencies = [ + "der", + "digest", + "elliptic-curve", + "rfc6979", + "signature", + "spki", +] + +[[package]] +name = "ed25519" +version = "2.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "115531babc129696a58c64a4fef0a8bf9e9698629fb97e9e40767d235cfbcd53" +dependencies = [ + "pkcs8", + "signature", +] + +[[package]] +name = "ed25519-dalek" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70e796c081cee67dc755e1a36a0a172b897fab85fc3f6bc48307991f64e4eca9" +dependencies = [ + "curve25519-dalek", + "ed25519", + "serde", + "sha2", + "subtle", + "zeroize", +] + [[package]] name = "either" version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719" +[[package]] +name = "elliptic-curve" +version = "0.13.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47" +dependencies = [ + "base16ct", + "crypto-bigint", + "digest", + "ff", + "generic-array", + "group", + "hkdf", + "pkcs8", + "rand_core 0.6.4", + "sec1", + "subtle", + "zeroize", +] + [[package]] name = "ena" version = "0.14.3" @@ -198,12 +396,40 @@ dependencies = [ "log", ] +[[package]] +name = "enum_dispatch" +version = "0.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa18ce2bc66555b3218614519ac839ddb759a7d6720732f979ef8d13be147ecd" +dependencies = [ + "once_cell", + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "equivalent" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" +[[package]] +name = "ff" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0b50bfb653653f9ca9095b427bed08ab8d75a137839d9ad64eb11810d5b6393" +dependencies = [ + "rand_core 0.6.4", + "subtle", +] + +[[package]] +name = "fiat-crypto" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28dea519a9695b9977216879a3ebfddf92f1c08c05d984f8996aecd6ecdc811d" + [[package]] name = "find-msvc-tools" version = "0.1.1" @@ -216,6 +442,18 @@ version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1d674e81391d1e1ab681a28d99df07927c6d4aa5b027d7da16ba32d1d21ecd99" +[[package]] +name = "flume" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da0e4dd2a88388a1f4ccc7c9ce104604dab68d9f408dc34cd45823d5a9069095" +dependencies = [ + "futures-core", + "futures-sink", + "nanorand", + "spin", +] + [[package]] name = "foldhash" version = "0.1.5" @@ -305,6 +543,20 @@ checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" dependencies = [ "typenum", "version_check", + "zeroize", +] + +[[package]] +name = "getrandom" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "335ff9f135e4384c8150d6f27c6daed433577f86b4750418338c01a1a2528592" +dependencies = [ + "cfg-if", + "js-sys", + "libc", + "wasi 0.11.1+wasi-snapshot-preview1", + "wasm-bindgen", ] [[package]] @@ -317,7 +569,7 @@ dependencies = [ "js-sys", "libc", "r-efi", - "wasi", + "wasi 0.14.4+wasi-0.2.4", "wasm-bindgen", ] @@ -327,6 +579,17 @@ version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0cc23270f6e1808e30a928bdc84dea0b9b4136a8bc82338574f23baf47bbd280" +[[package]] +name = "group" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" +dependencies = [ + "ff", + "rand_core 0.6.4", + "subtle", +] + [[package]] name = "hashbrown" version = "0.15.5" @@ -342,6 +605,24 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" +[[package]] +name = "hkdf" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b5f8eb2ad728638ea2c7d47a21db23b7b58a72ed6a38256b8a1849f15fbbdf7" +dependencies = [ + "hmac", +] + +[[package]] +name = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest", +] + [[package]] name = "id-arena" version = "2.2.1" @@ -365,6 +646,15 @@ dependencies = [ "serde", ] +[[package]] +name = "inout" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "879f10e63c20629ecabbb64a8010319738c66a5cd0c29b02d63d272b03751d01" +dependencies = [ + "generic-array", +] + [[package]] name = "itertools" version = "0.14.0" @@ -390,6 +680,20 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "k256" +version = "0.13.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6e3919bbaa2945715f0bb6d3934a173d1e9a59ac23767fbaaef277265a7411b" +dependencies = [ + "cfg-if", + "ecdsa", + "elliptic-curve", + "once_cell", + "sha2", + "signature", +] + [[package]] name = "keccak" version = "0.1.5" @@ -510,11 +814,12 @@ dependencies = [ [[package]] name = "miden-air" -version = "0.17.2" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2871bc4f392053cd115d4532e4b0fb164791829cc94b35641ed72480547dfd1" +checksum = "06acfd2ddc25b68f9d23d2add3f15c0ec3f9890ce6418409d71bea9dc6590bd0" dependencies = [ "miden-core", + "miden-utils-indexing", "thiserror", "winter-air", "winter-prover", @@ -522,9 +827,9 @@ dependencies = [ [[package]] name = "miden-assembly" -version = "0.17.2" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "345ae47710bbb4c6956dcc669a537c5cf2081879b6238c0df6da50e84a77ea3f" +checksum = "d1219b9e48bb286b58a23bb65cf74baa1b24ddbcb462ca625b38186674571047" dependencies = [ "log", "miden-assembly-syntax", @@ -536,9 +841,9 @@ dependencies = [ [[package]] name = "miden-assembly-syntax" -version = "0.17.2" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ab186ac7061b47415b923cf2da88df505f25c333f7caace80fb7760cf9c0590" +checksum = "1eeaef2853061c54527bb2664c0c832ce3d1f80847c79512455fec3b93057f2a" dependencies = [ "aho-corasick", "lalrpop", @@ -586,13 +891,15 @@ dependencies = [ [[package]] name = "miden-core" -version = "0.17.2" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "395ad0b07592486e02de3ff7f3bff1d7fa81b1a7120f7f0b1027d650d810bbab" +checksum = "452a00429d05c416001ec0578291eb88e115cf94fc22b3308267abfdcd813440" dependencies = [ + "enum_dispatch", "miden-crypto", "miden-debug-types", "miden-formatting", + "miden-utils-indexing", "num-derive", "num-traits", "thiserror", @@ -602,33 +909,54 @@ dependencies = [ [[package]] name = "miden-crypto" -version = "0.15.9" +version = "0.18.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4329275a11c7d8328b14a7129b21d40183056dcd0d871c3069be6e550d6ca40" +checksum = "7eb82051002f9c64878d3b105a7b924de1ee92019231923380cf4ecd7b824f9a" dependencies = [ "blake3", + "chacha20poly1305", + "ed25519-dalek", + "flume", "glob", + "hkdf", + "k256", + "miden-crypto-derive", "num", "num-complex", "rand", - "rand_core", + "rand_chacha", + "rand_core 0.9.3", + "rand_hc", "sha3", + "subtle", "thiserror", "winter-crypto", "winter-math", "winter-utils", + "x25519-dalek", +] + +[[package]] +name = "miden-crypto-derive" +version = "0.18.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2222f37355ea975f40acd3c098a437574a31a4d8a2c193cf4e9fead2beede577" +dependencies = [ + "quote", + "syn", ] [[package]] name = "miden-debug-types" -version = "0.17.2" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c84e5b15ea6fe0f80688fde2d6e4f5a3b66417d2541388b7a6cf967c6a8a2bc0" +checksum = "97eed62ac0ca7420e49148fd306c74786b23a8d31df6da6277c671ba3e5c619a" dependencies = [ "memchr", "miden-crypto", "miden-formatting", "miden-miette", + "miden-utils-indexing", "miden-utils-sync", "paste", "thiserror", @@ -645,13 +973,14 @@ dependencies = [ [[package]] name = "miden-mast-package" -version = "0.17.2" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e9d87c128f467874b272fec318e792385e35b14d200408a10d30909228db864" +checksum = "1d13e6ba2b357551598f13396ed52f8f21aa99979aa3b338bb5521feeda19c8a" dependencies = [ "derive_more", "miden-assembly-syntax", "miden-core", + "thiserror", ] [[package]] @@ -692,33 +1021,41 @@ dependencies = [ [[package]] name = "miden-objects" -version = "0.11.4" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68bdb0ef7d8a30213d991bbe44ef3f64dbb9caeebb89cfd996565a9a7a18dab5" +checksum = "0ef49472012d00be68f68dcbb13b4f28867fb6271c76c014bc555ef6e8e0958a" dependencies = [ "bech32", - "getrandom", + "getrandom 0.3.3", "miden-assembly", + "miden-assembly-syntax", "miden-core", "miden-crypto", + "miden-mast-package", "miden-processor", "miden-utils-sync", "miden-verifier", + "rand", "semver 1.0.26", "thiserror", ] [[package]] name = "miden-processor" -version = "0.17.2" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64304339292cc4e50a7b534197326824eeb21f3ffaadd955be63cc57093854ed" +checksum = "d2ef77929651b8755965cde8f589bd38e2345a619d54cab6427f91aa23c47f6a" dependencies = [ + "itertools", "miden-air", "miden-core", "miden-debug-types", "miden-utils-diagnostics", + "miden-utils-indexing", + "paste", + "rayon", "thiserror", + "tokio", "tracing", "winter-prover", ] @@ -733,9 +1070,9 @@ version = "0.7.0" [[package]] name = "miden-utils-diagnostics" -version = "0.17.2" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e9bf9a2c1cf3e3694d0eb347695a291602a57f817dd001ac838f300799576a69" +checksum = "1a3ff4c019d96539a7066626efb4dce5c9fb7b0e44e961b0c2571e78f34236d5" dependencies = [ "miden-crypto", "miden-debug-types", @@ -744,11 +1081,20 @@ dependencies = [ "tracing", ] +[[package]] +name = "miden-utils-indexing" +version = "0.19.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c798250bee4e856d4f18c161e91cdcbef1906f6614d00cf0063b47031c0f8cc6" +dependencies = [ + "thiserror", +] + [[package]] name = "miden-utils-sync" -version = "0.17.2" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb026e69ae937b2a83bf69ea86577e0ec2450cb22cce163190b9fd42f2972b63" +checksum = "feebe7d896c013ea74dbc98de978836606356a044d4ed3b61ded54d3b319d89f" dependencies = [ "lock_api", "loom", @@ -756,9 +1102,9 @@ dependencies = [ [[package]] name = "miden-verifier" -version = "0.17.2" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72a305e5e2c68d10bcb8e2ed3dc38e54bc3a538acc9eadc154b713d5bb47af22" +checksum = "b8f8e47b78bba1fe1b31faee8f12aafd95385f6d6a8b108b03e92f5d743bb29f" dependencies = [ "miden-air", "miden-core", @@ -769,15 +1115,24 @@ dependencies = [ [[package]] name = "midenc-hir-type" -version = "0.1.5" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e381ba23e4f57ffa0d6039113f6d6004e5b8c7ae6cb909329b48f2ab525e8680" +checksum = "9d4cfab04baffdda3fb9eafa5f873604059b89a1699aa95e4f1057397a69f0b5" dependencies = [ "miden-formatting", "smallvec", "thiserror", ] +[[package]] +name = "nanorand" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a51313c5820b0b02bd422f4b44776fbf47961755c74ce64afc73bfad10226c3" +dependencies = [ + "getrandom 0.2.16", +] + [[package]] name = "new_debug_unreachable" version = "1.0.6" @@ -884,6 +1239,12 @@ version = "1.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" +[[package]] +name = "opaque-debug" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381" + [[package]] name = "owo-colors" version = "4.2.2" @@ -950,6 +1311,36 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" +[[package]] +name = "pkcs8" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" +dependencies = [ + "der", + "spki", +] + +[[package]] +name = "poly1305" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8159bd90725d2df49889a078b54f4f79e87f1f8a8444194cdca81d38f5393abf" +dependencies = [ + "cpufeatures", + "opaque-debug", + "universal-hash", +] + +[[package]] +name = "ppv-lite86" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" +dependencies = [ + "zerocopy", +] + [[package]] name = "precomputed-hash" version = "0.1.1" @@ -996,7 +1387,26 @@ version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1" dependencies = [ - "rand_core", + "rand_core 0.9.3", +] + +[[package]] +name = "rand_chacha" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb" +dependencies = [ + "ppv-lite86", + "rand_core 0.9.3", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom 0.2.16", ] [[package]] @@ -1005,6 +1415,35 @@ version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38" +[[package]] +name = "rand_hc" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b363d4f6370f88d62bf586c80405657bde0f0e1b8945d47d2ad59b906cb4f54" +dependencies = [ + "rand_core 0.6.4", +] + +[[package]] +name = "rayon" +version = "1.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "368f01d005bf8fd9b1206fb6fa653e6c4a81ceb1466406b81792d87c5677a58f" +dependencies = [ + "either", + "rayon-core", +] + +[[package]] +name = "rayon-core" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22e18b0f0062d30d4230b2e85ff77fdfe4326feb054b9783a3460d8435c8ab91" +dependencies = [ + "crossbeam-deque", + "crossbeam-utils", +] + [[package]] name = "redox_syscall" version = "0.5.17" @@ -1016,9 +1455,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.11.2" +version = "1.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23d7fd106d8c02486a8d64e778353d1cffe08ce79ac2e82f540c86d0facf6912" +checksum = "843bc0191f75f3e22651ae5f1e72939ab2f72a4bc30fa80a066bd66edefc24d4" dependencies = [ "aho-corasick", "memchr", @@ -1028,9 +1467,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.10" +version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b9458fa0bfeeac22b5ca447c63aaf45f28439a709ccd244698632f9aa6394d6" +checksum = "5276caf25ac86c8d810222b3dbb938e512c55c6831a10f3e6ed1c93b84041f1c" dependencies = [ "aho-corasick", "memchr", @@ -1043,6 +1482,16 @@ version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "caf4aa5b0f434c91fe5c7f1ecb6a5ece2130b02ad2a590589dda5146df959001" +[[package]] +name = "rfc6979" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dd2a808d456c4a54e300a23e9f5a67e122c3024119acbfd73e3bf664491cb2" +dependencies = [ + "hmac", + "subtle", +] + [[package]] name = "rustc_version" version = "0.2.3" @@ -1094,6 +1543,20 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" +[[package]] +name = "sec1" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" +dependencies = [ + "base16ct", + "der", + "generic-array", + "pkcs8", + "subtle", + "zeroize", +] + [[package]] name = "semver" version = "0.9.0" @@ -1168,6 +1631,17 @@ dependencies = [ "serde", ] +[[package]] +name = "sha2" +version = "0.10.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + [[package]] name = "sha3" version = "0.10.8" @@ -1193,6 +1667,16 @@ version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" +[[package]] +name = "signature" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" +dependencies = [ + "digest", + "rand_core 0.6.4", +] + [[package]] name = "siphasher" version = "1.0.1" @@ -1216,6 +1700,19 @@ name = "spin" version = "0.9.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" +dependencies = [ + "lock_api", +] + +[[package]] +name = "spki" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d" +dependencies = [ + "base64ct", + "der", +] [[package]] name = "string_cache" @@ -1238,6 +1735,12 @@ dependencies = [ "vte", ] +[[package]] +name = "subtle" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" + [[package]] name = "syn" version = "2.0.106" @@ -1313,6 +1816,15 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "tokio" +version = "1.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff360e02eab121e0bc37a2d3b4d4dc622e6eda3a8e5253d5435ecf5bd4c68408" +dependencies = [ + "pin-project-lite", +] + [[package]] name = "toml" version = "0.8.23" @@ -1507,6 +2019,16 @@ version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" +[[package]] +name = "universal-hash" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc1de2c688dc15305988b563c3854064043356019f97a4b46276fe734c4f07ea" +dependencies = [ + "crypto-common", + "subtle", +] + [[package]] name = "valuable" version = "0.1.1" @@ -1538,6 +2060,12 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "wasi" +version = "0.11.1+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" + [[package]] name = "wasi" version = "0.14.4+wasi-0.2.4" @@ -2038,3 +2566,39 @@ dependencies = [ "unicode-xid", "wasmparser", ] + +[[package]] +name = "x25519-dalek" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7e468321c81fb07fa7f4c636c3972b9100f0346e5b6a9f2bd0603a52f7ed277" +dependencies = [ + "curve25519-dalek", + "rand_core 0.6.4", +] + +[[package]] +name = "zerocopy" +version = "0.8.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0894878a5fa3edfd6da3f88c4805f4c8558e2b996227a3d864f47fe11e38282c" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.8.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88d2b8d9c68ad2b9e4340d7832716a4d21a22a1154777ad56ea55c51a9cf3831" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "zeroize" +version = "1.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b97154e67e32c85465826e8bcc1c59429aaaf107c1e4a9e53c8d8ccd5eff88d0" diff --git a/examples/auth-component-no-auth/src/lib.rs b/examples/auth-component-no-auth/src/lib.rs index 2d21cf624..74b12b19d 100644 --- a/examples/auth-component-no-auth/src/lib.rs +++ b/examples/auth-component-no-auth/src/lib.rs @@ -33,7 +33,7 @@ impl Guest for AuthComponent { // translated from MASM at // https://github.com/0xMiden/miden-base/blob/e4912663276ab8eebb24b84d318417cb4ea0bba3/crates/miden-lib/asm/account_components/no_auth.masm?plain=1 let init_comm = account::get_initial_commitment(); - let curr_comm = account::compute_current_commitment(); + let curr_comm = account::compute_commitment(); // check if the account state has changed by comparing initial and final commitments if curr_comm != init_comm { // if the account has been updated, increment the nonce diff --git a/examples/auth-component-rpo-falcon512/Cargo.lock b/examples/auth-component-rpo-falcon512/Cargo.lock index a428e9a92..98adb89b8 100644 --- a/examples/auth-component-rpo-falcon512/Cargo.lock +++ b/examples/auth-component-rpo-falcon512/Cargo.lock @@ -2,6 +2,16 @@ # It is not intended for manual editing. version = 4 +[[package]] +name = "aead" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d122413f284cf2d62fb1b7db97e02edb8cda96d769b16e443a4f6195e35662b0" +dependencies = [ + "crypto-common", + "generic-array", +] + [[package]] name = "aho-corasick" version = "1.1.3" @@ -51,6 +61,18 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" +[[package]] +name = "base16ct" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" + +[[package]] +name = "base64ct" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55248b47b0caf0546f7988906588779981c43bb1bc9d0c44087278f80cdb44ba" + [[package]] name = "bech32" version = "0.11.0" @@ -122,6 +144,47 @@ version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2fd1289c04a9ea8cb22300a459a72a385d7c73d3259e2ed7dcb2af674838cfa9" +[[package]] +name = "chacha20" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3613f74bd2eac03dad61bd53dbe620703d4371614fe0bc3b9f04dd36fe4e818" +dependencies = [ + "cfg-if", + "cipher", + "cpufeatures", +] + +[[package]] +name = "chacha20poly1305" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10cd79432192d1c0f4e1a0fef9527696cc039165d729fb41b3f4f4f354c2dc35" +dependencies = [ + "aead", + "chacha20", + "cipher", + "poly1305", + "zeroize", +] + +[[package]] +name = "cipher" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" +dependencies = [ + "crypto-common", + "inout", + "zeroize", +] + +[[package]] +name = "const-oid" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" + [[package]] name = "constant_time_eq" version = "0.3.1" @@ -137,6 +200,43 @@ dependencies = [ "libc", ] +[[package]] +name = "crossbeam-deque" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9dd111b7b7f7d55b72c0a6ae361660ee5853c9af73f70c3c2ef6858b950e2e51" +dependencies = [ + "crossbeam-epoch", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.9.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" + +[[package]] +name = "crypto-bigint" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76" +dependencies = [ + "generic-array", + "rand_core 0.6.4", + "subtle", + "zeroize", +] + [[package]] name = "crypto-common" version = "0.1.6" @@ -144,9 +244,47 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" dependencies = [ "generic-array", + "rand_core 0.6.4", "typenum", ] +[[package]] +name = "curve25519-dalek" +version = "4.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97fb8b7c4503de7d6ae7b42ab72a5a59857b4c937ec27a3d4539dba95b5ab2be" +dependencies = [ + "cfg-if", + "cpufeatures", + "curve25519-dalek-derive", + "digest", + "fiat-crypto", + "rustc_version 0.4.1", + "subtle", + "zeroize", +] + +[[package]] +name = "curve25519-dalek-derive" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "der" +version = "0.7.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7c1832837b905bbfb5101e07cc24c8deddf52f93225eee6ead5f4d63d53ddcb" +dependencies = [ + "const-oid", + "zeroize", +] + [[package]] name = "derive_more" version = "2.0.1" @@ -174,7 +312,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ "block-buffer", + "const-oid", "crypto-common", + "subtle", ] [[package]] @@ -183,12 +323,70 @@ version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8975ffdaa0ef3661bfe02dbdcc06c9f829dfafe6a3c474de366a8d5e44276921" +[[package]] +name = "ecdsa" +version = "0.16.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee27f32b5c5292967d2d4a9d7f1e0b0aed2c15daded5a60300e4abb9d8020bca" +dependencies = [ + "der", + "digest", + "elliptic-curve", + "rfc6979", + "signature", + "spki", +] + +[[package]] +name = "ed25519" +version = "2.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "115531babc129696a58c64a4fef0a8bf9e9698629fb97e9e40767d235cfbcd53" +dependencies = [ + "pkcs8", + "signature", +] + +[[package]] +name = "ed25519-dalek" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70e796c081cee67dc755e1a36a0a172b897fab85fc3f6bc48307991f64e4eca9" +dependencies = [ + "curve25519-dalek", + "ed25519", + "serde", + "sha2", + "subtle", + "zeroize", +] + [[package]] name = "either" version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719" +[[package]] +name = "elliptic-curve" +version = "0.13.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47" +dependencies = [ + "base16ct", + "crypto-bigint", + "digest", + "ff", + "generic-array", + "group", + "hkdf", + "pkcs8", + "rand_core 0.6.4", + "sec1", + "subtle", + "zeroize", +] + [[package]] name = "ena" version = "0.14.3" @@ -198,12 +396,40 @@ dependencies = [ "log", ] +[[package]] +name = "enum_dispatch" +version = "0.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa18ce2bc66555b3218614519ac839ddb759a7d6720732f979ef8d13be147ecd" +dependencies = [ + "once_cell", + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "equivalent" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" +[[package]] +name = "ff" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0b50bfb653653f9ca9095b427bed08ab8d75a137839d9ad64eb11810d5b6393" +dependencies = [ + "rand_core 0.6.4", + "subtle", +] + +[[package]] +name = "fiat-crypto" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28dea519a9695b9977216879a3ebfddf92f1c08c05d984f8996aecd6ecdc811d" + [[package]] name = "find-msvc-tools" version = "0.1.1" @@ -216,6 +442,18 @@ version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1d674e81391d1e1ab681a28d99df07927c6d4aa5b027d7da16ba32d1d21ecd99" +[[package]] +name = "flume" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da0e4dd2a88388a1f4ccc7c9ce104604dab68d9f408dc34cd45823d5a9069095" +dependencies = [ + "futures-core", + "futures-sink", + "nanorand", + "spin", +] + [[package]] name = "foldhash" version = "0.1.5" @@ -305,6 +543,20 @@ checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" dependencies = [ "typenum", "version_check", + "zeroize", +] + +[[package]] +name = "getrandom" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "335ff9f135e4384c8150d6f27c6daed433577f86b4750418338c01a1a2528592" +dependencies = [ + "cfg-if", + "js-sys", + "libc", + "wasi 0.11.1+wasi-snapshot-preview1", + "wasm-bindgen", ] [[package]] @@ -317,7 +569,7 @@ dependencies = [ "js-sys", "libc", "r-efi", - "wasi", + "wasi 0.14.7+wasi-0.2.4", "wasm-bindgen", ] @@ -327,6 +579,17 @@ version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0cc23270f6e1808e30a928bdc84dea0b9b4136a8bc82338574f23baf47bbd280" +[[package]] +name = "group" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" +dependencies = [ + "ff", + "rand_core 0.6.4", + "subtle", +] + [[package]] name = "hashbrown" version = "0.15.5" @@ -342,6 +605,24 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" +[[package]] +name = "hkdf" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b5f8eb2ad728638ea2c7d47a21db23b7b58a72ed6a38256b8a1849f15fbbdf7" +dependencies = [ + "hmac", +] + +[[package]] +name = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest", +] + [[package]] name = "id-arena" version = "2.2.1" @@ -366,6 +647,15 @@ dependencies = [ "serde_core", ] +[[package]] +name = "inout" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "879f10e63c20629ecabbb64a8010319738c66a5cd0c29b02d63d272b03751d01" +dependencies = [ + "generic-array", +] + [[package]] name = "itertools" version = "0.14.0" @@ -391,6 +681,20 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "k256" +version = "0.13.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6e3919bbaa2945715f0bb6d3934a173d1e9a59ac23767fbaaef277265a7411b" +dependencies = [ + "cfg-if", + "ecdsa", + "elliptic-curve", + "once_cell", + "sha2", + "signature", +] + [[package]] name = "keccak" version = "0.1.5" @@ -511,11 +815,12 @@ dependencies = [ [[package]] name = "miden-air" -version = "0.17.2" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2871bc4f392053cd115d4532e4b0fb164791829cc94b35641ed72480547dfd1" +checksum = "06acfd2ddc25b68f9d23d2add3f15c0ec3f9890ce6418409d71bea9dc6590bd0" dependencies = [ "miden-core", + "miden-utils-indexing", "thiserror", "winter-air", "winter-prover", @@ -523,9 +828,9 @@ dependencies = [ [[package]] name = "miden-assembly" -version = "0.17.2" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "345ae47710bbb4c6956dcc669a537c5cf2081879b6238c0df6da50e84a77ea3f" +checksum = "d1219b9e48bb286b58a23bb65cf74baa1b24ddbcb462ca625b38186674571047" dependencies = [ "log", "miden-assembly-syntax", @@ -537,9 +842,9 @@ dependencies = [ [[package]] name = "miden-assembly-syntax" -version = "0.17.2" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ab186ac7061b47415b923cf2da88df505f25c333f7caace80fb7760cf9c0590" +checksum = "1eeaef2853061c54527bb2664c0c832ce3d1f80847c79512455fec3b93057f2a" dependencies = [ "aho-corasick", "lalrpop", @@ -587,13 +892,15 @@ dependencies = [ [[package]] name = "miden-core" -version = "0.17.2" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "395ad0b07592486e02de3ff7f3bff1d7fa81b1a7120f7f0b1027d650d810bbab" +checksum = "452a00429d05c416001ec0578291eb88e115cf94fc22b3308267abfdcd813440" dependencies = [ + "enum_dispatch", "miden-crypto", "miden-debug-types", "miden-formatting", + "miden-utils-indexing", "num-derive", "num-traits", "thiserror", @@ -603,33 +910,54 @@ dependencies = [ [[package]] name = "miden-crypto" -version = "0.15.9" +version = "0.18.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4329275a11c7d8328b14a7129b21d40183056dcd0d871c3069be6e550d6ca40" +checksum = "7eb82051002f9c64878d3b105a7b924de1ee92019231923380cf4ecd7b824f9a" dependencies = [ "blake3", + "chacha20poly1305", + "ed25519-dalek", + "flume", "glob", + "hkdf", + "k256", + "miden-crypto-derive", "num", "num-complex", "rand", - "rand_core", + "rand_chacha", + "rand_core 0.9.3", + "rand_hc", "sha3", + "subtle", "thiserror", "winter-crypto", "winter-math", "winter-utils", + "x25519-dalek", +] + +[[package]] +name = "miden-crypto-derive" +version = "0.18.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2222f37355ea975f40acd3c098a437574a31a4d8a2c193cf4e9fead2beede577" +dependencies = [ + "quote", + "syn", ] [[package]] name = "miden-debug-types" -version = "0.17.2" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c84e5b15ea6fe0f80688fde2d6e4f5a3b66417d2541388b7a6cf967c6a8a2bc0" +checksum = "97eed62ac0ca7420e49148fd306c74786b23a8d31df6da6277c671ba3e5c619a" dependencies = [ "memchr", "miden-crypto", "miden-formatting", "miden-miette", + "miden-utils-indexing", "miden-utils-sync", "paste", "thiserror", @@ -646,13 +974,14 @@ dependencies = [ [[package]] name = "miden-mast-package" -version = "0.17.2" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e9d87c128f467874b272fec318e792385e35b14d200408a10d30909228db864" +checksum = "1d13e6ba2b357551598f13396ed52f8f21aa99979aa3b338bb5521feeda19c8a" dependencies = [ "derive_more", "miden-assembly-syntax", "miden-core", + "thiserror", ] [[package]] @@ -693,33 +1022,41 @@ dependencies = [ [[package]] name = "miden-objects" -version = "0.11.4" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68bdb0ef7d8a30213d991bbe44ef3f64dbb9caeebb89cfd996565a9a7a18dab5" +checksum = "0ef49472012d00be68f68dcbb13b4f28867fb6271c76c014bc555ef6e8e0958a" dependencies = [ "bech32", - "getrandom", + "getrandom 0.3.3", "miden-assembly", + "miden-assembly-syntax", "miden-core", "miden-crypto", + "miden-mast-package", "miden-processor", "miden-utils-sync", "miden-verifier", + "rand", "semver 1.0.27", "thiserror", ] [[package]] name = "miden-processor" -version = "0.17.2" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64304339292cc4e50a7b534197326824eeb21f3ffaadd955be63cc57093854ed" +checksum = "d2ef77929651b8755965cde8f589bd38e2345a619d54cab6427f91aa23c47f6a" dependencies = [ + "itertools", "miden-air", "miden-core", "miden-debug-types", "miden-utils-diagnostics", + "miden-utils-indexing", + "paste", + "rayon", "thiserror", + "tokio", "tracing", "winter-prover", ] @@ -734,9 +1071,9 @@ version = "0.7.0" [[package]] name = "miden-utils-diagnostics" -version = "0.17.2" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e9bf9a2c1cf3e3694d0eb347695a291602a57f817dd001ac838f300799576a69" +checksum = "1a3ff4c019d96539a7066626efb4dce5c9fb7b0e44e961b0c2571e78f34236d5" dependencies = [ "miden-crypto", "miden-debug-types", @@ -745,11 +1082,20 @@ dependencies = [ "tracing", ] +[[package]] +name = "miden-utils-indexing" +version = "0.19.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c798250bee4e856d4f18c161e91cdcbef1906f6614d00cf0063b47031c0f8cc6" +dependencies = [ + "thiserror", +] + [[package]] name = "miden-utils-sync" -version = "0.17.2" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb026e69ae937b2a83bf69ea86577e0ec2450cb22cce163190b9fd42f2972b63" +checksum = "feebe7d896c013ea74dbc98de978836606356a044d4ed3b61ded54d3b319d89f" dependencies = [ "lock_api", "loom", @@ -757,9 +1103,9 @@ dependencies = [ [[package]] name = "miden-verifier" -version = "0.17.2" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72a305e5e2c68d10bcb8e2ed3dc38e54bc3a538acc9eadc154b713d5bb47af22" +checksum = "b8f8e47b78bba1fe1b31faee8f12aafd95385f6d6a8b108b03e92f5d743bb29f" dependencies = [ "miden-air", "miden-core", @@ -770,15 +1116,24 @@ dependencies = [ [[package]] name = "midenc-hir-type" -version = "0.1.5" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e381ba23e4f57ffa0d6039113f6d6004e5b8c7ae6cb909329b48f2ab525e8680" +checksum = "9d4cfab04baffdda3fb9eafa5f873604059b89a1699aa95e4f1057397a69f0b5" dependencies = [ "miden-formatting", "smallvec", "thiserror", ] +[[package]] +name = "nanorand" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a51313c5820b0b02bd422f4b44776fbf47961755c74ce64afc73bfad10226c3" +dependencies = [ + "getrandom 0.2.16", +] + [[package]] name = "new_debug_unreachable" version = "1.0.6" @@ -885,6 +1240,12 @@ version = "1.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" +[[package]] +name = "opaque-debug" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381" + [[package]] name = "owo-colors" version = "4.2.2" @@ -951,6 +1312,36 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" +[[package]] +name = "pkcs8" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" +dependencies = [ + "der", + "spki", +] + +[[package]] +name = "poly1305" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8159bd90725d2df49889a078b54f4f79e87f1f8a8444194cdca81d38f5393abf" +dependencies = [ + "cpufeatures", + "opaque-debug", + "universal-hash", +] + +[[package]] +name = "ppv-lite86" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" +dependencies = [ + "zerocopy", +] + [[package]] name = "precomputed-hash" version = "0.1.1" @@ -997,7 +1388,26 @@ version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1" dependencies = [ - "rand_core", + "rand_core 0.9.3", +] + +[[package]] +name = "rand_chacha" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb" +dependencies = [ + "ppv-lite86", + "rand_core 0.9.3", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom 0.2.16", ] [[package]] @@ -1006,6 +1416,35 @@ version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38" +[[package]] +name = "rand_hc" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b363d4f6370f88d62bf586c80405657bde0f0e1b8945d47d2ad59b906cb4f54" +dependencies = [ + "rand_core 0.6.4", +] + +[[package]] +name = "rayon" +version = "1.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "368f01d005bf8fd9b1206fb6fa653e6c4a81ceb1466406b81792d87c5677a58f" +dependencies = [ + "either", + "rayon-core", +] + +[[package]] +name = "rayon-core" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22e18b0f0062d30d4230b2e85ff77fdfe4326feb054b9783a3460d8435c8ab91" +dependencies = [ + "crossbeam-deque", + "crossbeam-utils", +] + [[package]] name = "redox_syscall" version = "0.5.17" @@ -1017,9 +1456,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.11.2" +version = "1.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23d7fd106d8c02486a8d64e778353d1cffe08ce79ac2e82f540c86d0facf6912" +checksum = "843bc0191f75f3e22651ae5f1e72939ab2f72a4bc30fa80a066bd66edefc24d4" dependencies = [ "aho-corasick", "memchr", @@ -1029,9 +1468,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.10" +version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b9458fa0bfeeac22b5ca447c63aaf45f28439a709ccd244698632f9aa6394d6" +checksum = "5276caf25ac86c8d810222b3dbb938e512c55c6831a10f3e6ed1c93b84041f1c" dependencies = [ "aho-corasick", "memchr", @@ -1044,6 +1483,16 @@ version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "caf4aa5b0f434c91fe5c7f1ecb6a5ece2130b02ad2a590589dda5146df959001" +[[package]] +name = "rfc6979" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dd2a808d456c4a54e300a23e9f5a67e122c3024119acbfd73e3bf664491cb2" +dependencies = [ + "hmac", + "subtle", +] + [[package]] name = "rustc_version" version = "0.2.3" @@ -1095,6 +1544,20 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" +[[package]] +name = "sec1" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" +dependencies = [ + "base16ct", + "der", + "generic-array", + "pkcs8", + "subtle", + "zeroize", +] + [[package]] name = "semver" version = "0.9.0" @@ -1180,6 +1643,17 @@ dependencies = [ "serde_core", ] +[[package]] +name = "sha2" +version = "0.10.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + [[package]] name = "sha3" version = "0.10.8" @@ -1205,6 +1679,16 @@ version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" +[[package]] +name = "signature" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" +dependencies = [ + "digest", + "rand_core 0.6.4", +] + [[package]] name = "siphasher" version = "1.0.1" @@ -1228,6 +1712,19 @@ name = "spin" version = "0.9.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" +dependencies = [ + "lock_api", +] + +[[package]] +name = "spki" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d" +dependencies = [ + "base64ct", + "der", +] [[package]] name = "string_cache" @@ -1250,6 +1747,12 @@ dependencies = [ "vte", ] +[[package]] +name = "subtle" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" + [[package]] name = "syn" version = "2.0.106" @@ -1325,6 +1828,15 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "tokio" +version = "1.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff360e02eab121e0bc37a2d3b4d4dc622e6eda3a8e5253d5435ecf5bd4c68408" +dependencies = [ + "pin-project-lite", +] + [[package]] name = "toml" version = "0.8.23" @@ -1519,6 +2031,16 @@ version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" +[[package]] +name = "universal-hash" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc1de2c688dc15305988b563c3854064043356019f97a4b46276fe734c4f07ea" +dependencies = [ + "crypto-common", + "subtle", +] + [[package]] name = "valuable" version = "0.1.1" @@ -1550,6 +2072,12 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "wasi" +version = "0.11.1+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" + [[package]] name = "wasi" version = "0.14.7+wasi-0.2.4" @@ -2053,3 +2581,39 @@ dependencies = [ "unicode-xid", "wasmparser", ] + +[[package]] +name = "x25519-dalek" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7e468321c81fb07fa7f4c636c3972b9100f0346e5b6a9f2bd0603a52f7ed277" +dependencies = [ + "curve25519-dalek", + "rand_core 0.6.4", +] + +[[package]] +name = "zerocopy" +version = "0.8.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0894878a5fa3edfd6da3f88c4805f4c8558e2b996227a3d864f47fe11e38282c" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.8.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88d2b8d9c68ad2b9e4340d7832716a4d21a22a1154777ad56ea55c51a9cf3831" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "zeroize" +version = "1.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b97154e67e32c85465826e8bcc1c59429aaaf107c1e4a9e53c8d8ccd5eff88d0" diff --git a/examples/basic-wallet-tx-script/Cargo.lock b/examples/basic-wallet-tx-script/Cargo.lock index d10c6834b..e0443e1b7 100644 --- a/examples/basic-wallet-tx-script/Cargo.lock +++ b/examples/basic-wallet-tx-script/Cargo.lock @@ -2,6 +2,16 @@ # It is not intended for manual editing. version = 4 +[[package]] +name = "aead" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d122413f284cf2d62fb1b7db97e02edb8cda96d769b16e443a4f6195e35662b0" +dependencies = [ + "crypto-common", + "generic-array", +] + [[package]] name = "aho-corasick" version = "1.1.3" @@ -44,6 +54,18 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" +[[package]] +name = "base16ct" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" + +[[package]] +name = "base64ct" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55248b47b0caf0546f7988906588779981c43bb1bc9d0c44087278f80cdb44ba" + [[package]] name = "basic-wallet-tx-script" version = "0.1.0" @@ -121,6 +143,47 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9555578bc9e57714c812a1f84e4fc5b4d21fcb063490c624de019f7464c91268" +[[package]] +name = "chacha20" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3613f74bd2eac03dad61bd53dbe620703d4371614fe0bc3b9f04dd36fe4e818" +dependencies = [ + "cfg-if", + "cipher", + "cpufeatures", +] + +[[package]] +name = "chacha20poly1305" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10cd79432192d1c0f4e1a0fef9527696cc039165d729fb41b3f4f4f354c2dc35" +dependencies = [ + "aead", + "chacha20", + "cipher", + "poly1305", + "zeroize", +] + +[[package]] +name = "cipher" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" +dependencies = [ + "crypto-common", + "inout", + "zeroize", +] + +[[package]] +name = "const-oid" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" + [[package]] name = "constant_time_eq" version = "0.3.1" @@ -136,6 +199,43 @@ dependencies = [ "libc", ] +[[package]] +name = "crossbeam-deque" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9dd111b7b7f7d55b72c0a6ae361660ee5853c9af73f70c3c2ef6858b950e2e51" +dependencies = [ + "crossbeam-epoch", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.9.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" + +[[package]] +name = "crypto-bigint" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76" +dependencies = [ + "generic-array", + "rand_core 0.6.4", + "subtle", + "zeroize", +] + [[package]] name = "crypto-common" version = "0.1.6" @@ -143,9 +243,47 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" dependencies = [ "generic-array", + "rand_core 0.6.4", "typenum", ] +[[package]] +name = "curve25519-dalek" +version = "4.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97fb8b7c4503de7d6ae7b42ab72a5a59857b4c937ec27a3d4539dba95b5ab2be" +dependencies = [ + "cfg-if", + "cpufeatures", + "curve25519-dalek-derive", + "digest", + "fiat-crypto", + "rustc_version 0.4.1", + "subtle", + "zeroize", +] + +[[package]] +name = "curve25519-dalek-derive" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "der" +version = "0.7.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7c1832837b905bbfb5101e07cc24c8deddf52f93225eee6ead5f4d63d53ddcb" +dependencies = [ + "const-oid", + "zeroize", +] + [[package]] name = "derive_more" version = "2.0.1" @@ -173,7 +311,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ "block-buffer", + "const-oid", "crypto-common", + "subtle", ] [[package]] @@ -182,12 +322,70 @@ version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8975ffdaa0ef3661bfe02dbdcc06c9f829dfafe6a3c474de366a8d5e44276921" +[[package]] +name = "ecdsa" +version = "0.16.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee27f32b5c5292967d2d4a9d7f1e0b0aed2c15daded5a60300e4abb9d8020bca" +dependencies = [ + "der", + "digest", + "elliptic-curve", + "rfc6979", + "signature", + "spki", +] + +[[package]] +name = "ed25519" +version = "2.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "115531babc129696a58c64a4fef0a8bf9e9698629fb97e9e40767d235cfbcd53" +dependencies = [ + "pkcs8", + "signature", +] + +[[package]] +name = "ed25519-dalek" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70e796c081cee67dc755e1a36a0a172b897fab85fc3f6bc48307991f64e4eca9" +dependencies = [ + "curve25519-dalek", + "ed25519", + "serde", + "sha2", + "subtle", + "zeroize", +] + [[package]] name = "either" version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719" +[[package]] +name = "elliptic-curve" +version = "0.13.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47" +dependencies = [ + "base16ct", + "crypto-bigint", + "digest", + "ff", + "generic-array", + "group", + "hkdf", + "pkcs8", + "rand_core 0.6.4", + "sec1", + "subtle", + "zeroize", +] + [[package]] name = "ena" version = "0.14.3" @@ -197,18 +395,58 @@ dependencies = [ "log", ] +[[package]] +name = "enum_dispatch" +version = "0.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa18ce2bc66555b3218614519ac839ddb759a7d6720732f979ef8d13be147ecd" +dependencies = [ + "once_cell", + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "equivalent" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" +[[package]] +name = "ff" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0b50bfb653653f9ca9095b427bed08ab8d75a137839d9ad64eb11810d5b6393" +dependencies = [ + "rand_core 0.6.4", + "subtle", +] + +[[package]] +name = "fiat-crypto" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28dea519a9695b9977216879a3ebfddf92f1c08c05d984f8996aecd6ecdc811d" + [[package]] name = "fixedbitset" version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1d674e81391d1e1ab681a28d99df07927c6d4aa5b027d7da16ba32d1d21ecd99" +[[package]] +name = "flume" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da0e4dd2a88388a1f4ccc7c9ce104604dab68d9f408dc34cd45823d5a9069095" +dependencies = [ + "futures-core", + "futures-sink", + "nanorand", + "spin", +] + [[package]] name = "foldhash" version = "0.1.5" @@ -298,6 +536,20 @@ checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" dependencies = [ "typenum", "version_check", + "zeroize", +] + +[[package]] +name = "getrandom" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "335ff9f135e4384c8150d6f27c6daed433577f86b4750418338c01a1a2528592" +dependencies = [ + "cfg-if", + "js-sys", + "libc", + "wasi 0.11.1+wasi-snapshot-preview1", + "wasm-bindgen", ] [[package]] @@ -310,7 +562,7 @@ dependencies = [ "js-sys", "libc", "r-efi", - "wasi", + "wasi 0.14.2+wasi-0.2.4", "wasm-bindgen", ] @@ -320,6 +572,17 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a8d1add55171497b4705a648c6b583acafb01d58050a51727785f0b2c8e0a2b2" +[[package]] +name = "group" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" +dependencies = [ + "ff", + "rand_core 0.6.4", + "subtle", +] + [[package]] name = "hashbrown" version = "0.15.4" @@ -335,6 +598,24 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" +[[package]] +name = "hkdf" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b5f8eb2ad728638ea2c7d47a21db23b7b58a72ed6a38256b8a1849f15fbbdf7" +dependencies = [ + "hmac", +] + +[[package]] +name = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest", +] + [[package]] name = "id-arena" version = "2.2.1" @@ -358,6 +639,15 @@ dependencies = [ "serde", ] +[[package]] +name = "inout" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "879f10e63c20629ecabbb64a8010319738c66a5cd0c29b02d63d272b03751d01" +dependencies = [ + "generic-array", +] + [[package]] name = "itertools" version = "0.14.0" @@ -383,6 +673,20 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "k256" +version = "0.13.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6e3919bbaa2945715f0bb6d3934a173d1e9a59ac23767fbaaef277265a7411b" +dependencies = [ + "cfg-if", + "ecdsa", + "elliptic-curve", + "once_cell", + "sha2", + "signature", +] + [[package]] name = "keccak" version = "0.1.5" @@ -503,11 +807,12 @@ dependencies = [ [[package]] name = "miden-air" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db750ce0c58f51ba786c7391f392c4b77e0c83a44c5096672d4d0270d3cc7763" +checksum = "06acfd2ddc25b68f9d23d2add3f15c0ec3f9890ce6418409d71bea9dc6590bd0" dependencies = [ "miden-core", + "miden-utils-indexing", "thiserror", "winter-air", "winter-prover", @@ -515,9 +820,9 @@ dependencies = [ [[package]] name = "miden-assembly" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82575d8479aad3966be3defdc17911264bfdc99f9a7bb185180eec57c6bda9f5" +checksum = "d1219b9e48bb286b58a23bb65cf74baa1b24ddbcb462ca625b38186674571047" dependencies = [ "log", "miden-assembly-syntax", @@ -529,9 +834,9 @@ dependencies = [ [[package]] name = "miden-assembly-syntax" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7b3588ce15920c0bff47e8bf8c6ca9e0a7a539ff93014cb5ec3c665f60bc0f1" +checksum = "1eeaef2853061c54527bb2664c0c832ce3d1f80847c79512455fec3b93057f2a" dependencies = [ "aho-corasick", "lalrpop", @@ -579,13 +884,15 @@ dependencies = [ [[package]] name = "miden-core" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "571a943a923e5fb3f1bed534f41a1542c531ad2aec87dc0d5699af1709fbcea6" +checksum = "452a00429d05c416001ec0578291eb88e115cf94fc22b3308267abfdcd813440" dependencies = [ + "enum_dispatch", "miden-crypto", "miden-debug-types", "miden-formatting", + "miden-utils-indexing", "num-derive", "num-traits", "thiserror", @@ -595,33 +902,54 @@ dependencies = [ [[package]] name = "miden-crypto" -version = "0.15.9" +version = "0.18.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4329275a11c7d8328b14a7129b21d40183056dcd0d871c3069be6e550d6ca40" +checksum = "7eb82051002f9c64878d3b105a7b924de1ee92019231923380cf4ecd7b824f9a" dependencies = [ "blake3", + "chacha20poly1305", + "ed25519-dalek", + "flume", "glob", + "hkdf", + "k256", + "miden-crypto-derive", "num", "num-complex", "rand", - "rand_core", + "rand_chacha", + "rand_core 0.9.3", + "rand_hc", "sha3", + "subtle", "thiserror", "winter-crypto", "winter-math", "winter-utils", + "x25519-dalek", +] + +[[package]] +name = "miden-crypto-derive" +version = "0.18.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2222f37355ea975f40acd3c098a437574a31a4d8a2c193cf4e9fead2beede577" +dependencies = [ + "quote", + "syn", ] [[package]] name = "miden-debug-types" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93a4b53092da70aa4c9b75acc85e1c7b4d8202ce89487d2271ebdc2defcb08d6" +checksum = "97eed62ac0ca7420e49148fd306c74786b23a8d31df6da6277c671ba3e5c619a" dependencies = [ "memchr", "miden-crypto", "miden-formatting", "miden-miette", + "miden-utils-indexing", "miden-utils-sync", "paste", "thiserror", @@ -638,13 +966,14 @@ dependencies = [ [[package]] name = "miden-mast-package" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57efbfaea75eeb07d448c04aefce241bf8f23ea11600a669d897280551819992" +checksum = "1d13e6ba2b357551598f13396ed52f8f21aa99979aa3b338bb5521feeda19c8a" dependencies = [ "derive_more", "miden-assembly-syntax", "miden-core", + "thiserror", ] [[package]] @@ -685,33 +1014,41 @@ dependencies = [ [[package]] name = "miden-objects" -version = "0.11.2" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a16bce60bda18cfeaa49e99e35307c6f45297bfe2f0e18c009fa356edd552e70" +checksum = "0ef49472012d00be68f68dcbb13b4f28867fb6271c76c014bc555ef6e8e0958a" dependencies = [ "bech32", - "getrandom", + "getrandom 0.3.3", "miden-assembly", + "miden-assembly-syntax", "miden-core", "miden-crypto", + "miden-mast-package", "miden-processor", "miden-utils-sync", "miden-verifier", + "rand", "semver 1.0.26", "thiserror", ] [[package]] name = "miden-processor" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3c033f51b575b5a70b763dc0bc05062b6562a8286c6d0c144eaff92da8f214f" +checksum = "d2ef77929651b8755965cde8f589bd38e2345a619d54cab6427f91aa23c47f6a" dependencies = [ + "itertools", "miden-air", "miden-core", "miden-debug-types", "miden-utils-diagnostics", + "miden-utils-indexing", + "paste", + "rayon", "thiserror", + "tokio", "tracing", "winter-prover", ] @@ -726,9 +1063,9 @@ version = "0.7.0" [[package]] name = "miden-utils-diagnostics" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d640d80ce3438275b13d0d400901e5bbf3179737818d91d4e84f747a480fd8b" +checksum = "1a3ff4c019d96539a7066626efb4dce5c9fb7b0e44e961b0c2571e78f34236d5" dependencies = [ "miden-crypto", "miden-debug-types", @@ -737,11 +1074,20 @@ dependencies = [ "tracing", ] +[[package]] +name = "miden-utils-indexing" +version = "0.19.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c798250bee4e856d4f18c161e91cdcbef1906f6614d00cf0063b47031c0f8cc6" +dependencies = [ + "thiserror", +] + [[package]] name = "miden-utils-sync" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccf49e1fbfefeb58de992767ae7b0b6200885e342f4dd43c510daefce9539b95" +checksum = "feebe7d896c013ea74dbc98de978836606356a044d4ed3b61ded54d3b319d89f" dependencies = [ "lock_api", "loom", @@ -749,9 +1095,9 @@ dependencies = [ [[package]] name = "miden-verifier" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3104dce8b4668639aa97aa748a98aab0ea33c103e06ef5c3fd12445ab3bd2387" +checksum = "b8f8e47b78bba1fe1b31faee8f12aafd95385f6d6a8b108b03e92f5d743bb29f" dependencies = [ "miden-air", "miden-core", @@ -762,15 +1108,24 @@ dependencies = [ [[package]] name = "midenc-hir-type" -version = "0.1.5" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e381ba23e4f57ffa0d6039113f6d6004e5b8c7ae6cb909329b48f2ab525e8680" +checksum = "9d4cfab04baffdda3fb9eafa5f873604059b89a1699aa95e4f1057397a69f0b5" dependencies = [ "miden-formatting", "smallvec", "thiserror", ] +[[package]] +name = "nanorand" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a51313c5820b0b02bd422f4b44776fbf47961755c74ce64afc73bfad10226c3" +dependencies = [ + "getrandom 0.2.16", +] + [[package]] name = "new_debug_unreachable" version = "1.0.6" @@ -878,6 +1233,12 @@ version = "1.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" +[[package]] +name = "opaque-debug" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381" + [[package]] name = "overload" version = "0.1.1" @@ -950,6 +1311,36 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" +[[package]] +name = "pkcs8" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" +dependencies = [ + "der", + "spki", +] + +[[package]] +name = "poly1305" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8159bd90725d2df49889a078b54f4f79e87f1f8a8444194cdca81d38f5393abf" +dependencies = [ + "cpufeatures", + "opaque-debug", + "universal-hash", +] + +[[package]] +name = "ppv-lite86" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" +dependencies = [ + "zerocopy", +] + [[package]] name = "precomputed-hash" version = "0.1.1" @@ -996,7 +1387,26 @@ version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1" dependencies = [ - "rand_core", + "rand_core 0.9.3", +] + +[[package]] +name = "rand_chacha" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb" +dependencies = [ + "ppv-lite86", + "rand_core 0.9.3", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom 0.2.16", ] [[package]] @@ -1005,6 +1415,35 @@ version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38" +[[package]] +name = "rand_hc" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b363d4f6370f88d62bf586c80405657bde0f0e1b8945d47d2ad59b906cb4f54" +dependencies = [ + "rand_core 0.6.4", +] + +[[package]] +name = "rayon" +version = "1.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "368f01d005bf8fd9b1206fb6fa653e6c4a81ceb1466406b81792d87c5677a58f" +dependencies = [ + "either", + "rayon-core", +] + +[[package]] +name = "rayon-core" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22e18b0f0062d30d4230b2e85ff77fdfe4326feb054b9783a3460d8435c8ab91" +dependencies = [ + "crossbeam-deque", + "crossbeam-utils", +] + [[package]] name = "redox_syscall" version = "0.5.14" @@ -1016,13 +1455,13 @@ dependencies = [ [[package]] name = "regex" -version = "1.11.1" +version = "1.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191" +checksum = "843bc0191f75f3e22651ae5f1e72939ab2f72a4bc30fa80a066bd66edefc24d4" dependencies = [ "aho-corasick", "memchr", - "regex-automata 0.4.9", + "regex-automata 0.4.13", "regex-syntax 0.8.5", ] @@ -1037,9 +1476,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.9" +version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908" +checksum = "5276caf25ac86c8d810222b3dbb938e512c55c6831a10f3e6ed1c93b84041f1c" dependencies = [ "aho-corasick", "memchr", @@ -1058,6 +1497,16 @@ version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" +[[package]] +name = "rfc6979" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dd2a808d456c4a54e300a23e9f5a67e122c3024119acbfd73e3bf664491cb2" +dependencies = [ + "hmac", + "subtle", +] + [[package]] name = "rustc_version" version = "0.2.3" @@ -1109,6 +1558,20 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" +[[package]] +name = "sec1" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" +dependencies = [ + "base16ct", + "der", + "generic-array", + "pkcs8", + "subtle", + "zeroize", +] + [[package]] name = "semver" version = "0.9.0" @@ -1183,6 +1646,17 @@ dependencies = [ "serde", ] +[[package]] +name = "sha2" +version = "0.10.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + [[package]] name = "sha3" version = "0.10.8" @@ -1208,6 +1682,16 @@ version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" +[[package]] +name = "signature" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" +dependencies = [ + "digest", + "rand_core 0.6.4", +] + [[package]] name = "siphasher" version = "1.0.1" @@ -1231,6 +1715,19 @@ name = "spin" version = "0.9.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" +dependencies = [ + "lock_api", +] + +[[package]] +name = "spki" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d" +dependencies = [ + "base64ct", + "der", +] [[package]] name = "string_cache" @@ -1253,6 +1750,12 @@ dependencies = [ "vte", ] +[[package]] +name = "subtle" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" + [[package]] name = "syn" version = "2.0.106" @@ -1328,6 +1831,15 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "tokio" +version = "1.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff360e02eab121e0bc37a2d3b4d4dc622e6eda3a8e5253d5435ecf5bd4c68408" +dependencies = [ + "pin-project-lite", +] + [[package]] name = "toml" version = "0.8.23" @@ -1522,6 +2034,16 @@ version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" +[[package]] +name = "universal-hash" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc1de2c688dc15305988b563c3854064043356019f97a4b46276fe734c4f07ea" +dependencies = [ + "crypto-common", + "subtle", +] + [[package]] name = "valuable" version = "0.1.1" @@ -1553,6 +2075,12 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "wasi" +version = "0.11.1+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" + [[package]] name = "wasi" version = "0.14.2+wasi-0.2.4" @@ -2062,3 +2590,39 @@ dependencies = [ "unicode-xid", "wasmparser", ] + +[[package]] +name = "x25519-dalek" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7e468321c81fb07fa7f4c636c3972b9100f0346e5b6a9f2bd0603a52f7ed277" +dependencies = [ + "curve25519-dalek", + "rand_core 0.6.4", +] + +[[package]] +name = "zerocopy" +version = "0.8.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0894878a5fa3edfd6da3f88c4805f4c8558e2b996227a3d864f47fe11e38282c" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.8.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88d2b8d9c68ad2b9e4340d7832716a4d21a22a1154777ad56ea55c51a9cf3831" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "zeroize" +version = "1.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b97154e67e32c85465826e8bcc1c59429aaaf107c1e4a9e53c8d8ccd5eff88d0" diff --git a/examples/basic-wallet-tx-script/src/lib.rs b/examples/basic-wallet-tx-script/src/lib.rs index f5d0fbfbe..469d59a88 100644 --- a/examples/basic-wallet-tx-script/src/lib.rs +++ b/examples/basic-wallet-tx-script/src/lib.rs @@ -35,8 +35,7 @@ fn run(arg: Word) { let note_type = input[NOTE_TYPE_INDEX]; let execution_hint = input[EXECUTION_HINT_INDEX]; let recipient: [Felt; 4] = input[RECIPIENT_START..RECIPIENT_END].try_into().unwrap(); - let note_idx = - tx::create_note(tag.into(), aux, note_type.into(), execution_hint, recipient.into()); + let note_idx = output_note::create(tag.into(), aux, note_type.into(), execution_hint, recipient.into()); let asset: [Felt; 4] = input[ASSET_START..ASSET_END].try_into().unwrap(); basic_wallet::move_asset_to_note(asset.into(), note_idx); } diff --git a/examples/basic-wallet/Cargo.lock b/examples/basic-wallet/Cargo.lock index d19933301..9bd4627b8 100644 --- a/examples/basic-wallet/Cargo.lock +++ b/examples/basic-wallet/Cargo.lock @@ -2,6 +2,16 @@ # It is not intended for manual editing. version = 4 +[[package]] +name = "aead" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d122413f284cf2d62fb1b7db97e02edb8cda96d769b16e443a4f6195e35662b0" +dependencies = [ + "crypto-common", + "generic-array", +] + [[package]] name = "aho-corasick" version = "1.1.3" @@ -44,6 +54,18 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" +[[package]] +name = "base16ct" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" + +[[package]] +name = "base64ct" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55248b47b0caf0546f7988906588779981c43bb1bc9d0c44087278f80cdb44ba" + [[package]] name = "basic_wallet" version = "0.1.0" @@ -121,6 +143,47 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9555578bc9e57714c812a1f84e4fc5b4d21fcb063490c624de019f7464c91268" +[[package]] +name = "chacha20" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3613f74bd2eac03dad61bd53dbe620703d4371614fe0bc3b9f04dd36fe4e818" +dependencies = [ + "cfg-if", + "cipher", + "cpufeatures", +] + +[[package]] +name = "chacha20poly1305" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10cd79432192d1c0f4e1a0fef9527696cc039165d729fb41b3f4f4f354c2dc35" +dependencies = [ + "aead", + "chacha20", + "cipher", + "poly1305", + "zeroize", +] + +[[package]] +name = "cipher" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" +dependencies = [ + "crypto-common", + "inout", + "zeroize", +] + +[[package]] +name = "const-oid" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" + [[package]] name = "constant_time_eq" version = "0.3.1" @@ -136,6 +199,43 @@ dependencies = [ "libc", ] +[[package]] +name = "crossbeam-deque" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9dd111b7b7f7d55b72c0a6ae361660ee5853c9af73f70c3c2ef6858b950e2e51" +dependencies = [ + "crossbeam-epoch", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.9.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" + +[[package]] +name = "crypto-bigint" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76" +dependencies = [ + "generic-array", + "rand_core 0.6.4", + "subtle", + "zeroize", +] + [[package]] name = "crypto-common" version = "0.1.6" @@ -143,9 +243,47 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" dependencies = [ "generic-array", + "rand_core 0.6.4", "typenum", ] +[[package]] +name = "curve25519-dalek" +version = "4.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97fb8b7c4503de7d6ae7b42ab72a5a59857b4c937ec27a3d4539dba95b5ab2be" +dependencies = [ + "cfg-if", + "cpufeatures", + "curve25519-dalek-derive", + "digest", + "fiat-crypto", + "rustc_version 0.4.1", + "subtle", + "zeroize", +] + +[[package]] +name = "curve25519-dalek-derive" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "der" +version = "0.7.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7c1832837b905bbfb5101e07cc24c8deddf52f93225eee6ead5f4d63d53ddcb" +dependencies = [ + "const-oid", + "zeroize", +] + [[package]] name = "derive_more" version = "2.0.1" @@ -173,7 +311,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ "block-buffer", + "const-oid", "crypto-common", + "subtle", ] [[package]] @@ -182,12 +322,70 @@ version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8975ffdaa0ef3661bfe02dbdcc06c9f829dfafe6a3c474de366a8d5e44276921" +[[package]] +name = "ecdsa" +version = "0.16.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee27f32b5c5292967d2d4a9d7f1e0b0aed2c15daded5a60300e4abb9d8020bca" +dependencies = [ + "der", + "digest", + "elliptic-curve", + "rfc6979", + "signature", + "spki", +] + +[[package]] +name = "ed25519" +version = "2.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "115531babc129696a58c64a4fef0a8bf9e9698629fb97e9e40767d235cfbcd53" +dependencies = [ + "pkcs8", + "signature", +] + +[[package]] +name = "ed25519-dalek" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70e796c081cee67dc755e1a36a0a172b897fab85fc3f6bc48307991f64e4eca9" +dependencies = [ + "curve25519-dalek", + "ed25519", + "serde", + "sha2", + "subtle", + "zeroize", +] + [[package]] name = "either" version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719" +[[package]] +name = "elliptic-curve" +version = "0.13.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47" +dependencies = [ + "base16ct", + "crypto-bigint", + "digest", + "ff", + "generic-array", + "group", + "hkdf", + "pkcs8", + "rand_core 0.6.4", + "sec1", + "subtle", + "zeroize", +] + [[package]] name = "ena" version = "0.14.3" @@ -197,18 +395,58 @@ dependencies = [ "log", ] +[[package]] +name = "enum_dispatch" +version = "0.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa18ce2bc66555b3218614519ac839ddb759a7d6720732f979ef8d13be147ecd" +dependencies = [ + "once_cell", + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "equivalent" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" +[[package]] +name = "ff" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0b50bfb653653f9ca9095b427bed08ab8d75a137839d9ad64eb11810d5b6393" +dependencies = [ + "rand_core 0.6.4", + "subtle", +] + +[[package]] +name = "fiat-crypto" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28dea519a9695b9977216879a3ebfddf92f1c08c05d984f8996aecd6ecdc811d" + [[package]] name = "fixedbitset" version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1d674e81391d1e1ab681a28d99df07927c6d4aa5b027d7da16ba32d1d21ecd99" +[[package]] +name = "flume" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da0e4dd2a88388a1f4ccc7c9ce104604dab68d9f408dc34cd45823d5a9069095" +dependencies = [ + "futures-core", + "futures-sink", + "nanorand", + "spin", +] + [[package]] name = "foldhash" version = "0.1.5" @@ -298,6 +536,20 @@ checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" dependencies = [ "typenum", "version_check", + "zeroize", +] + +[[package]] +name = "getrandom" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "335ff9f135e4384c8150d6f27c6daed433577f86b4750418338c01a1a2528592" +dependencies = [ + "cfg-if", + "js-sys", + "libc", + "wasi 0.11.1+wasi-snapshot-preview1", + "wasm-bindgen", ] [[package]] @@ -310,7 +562,7 @@ dependencies = [ "js-sys", "libc", "r-efi", - "wasi", + "wasi 0.14.2+wasi-0.2.4", "wasm-bindgen", ] @@ -320,6 +572,17 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a8d1add55171497b4705a648c6b583acafb01d58050a51727785f0b2c8e0a2b2" +[[package]] +name = "group" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" +dependencies = [ + "ff", + "rand_core 0.6.4", + "subtle", +] + [[package]] name = "hashbrown" version = "0.15.4" @@ -335,6 +598,24 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" +[[package]] +name = "hkdf" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b5f8eb2ad728638ea2c7d47a21db23b7b58a72ed6a38256b8a1849f15fbbdf7" +dependencies = [ + "hmac", +] + +[[package]] +name = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest", +] + [[package]] name = "id-arena" version = "2.2.1" @@ -358,6 +639,15 @@ dependencies = [ "serde", ] +[[package]] +name = "inout" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "879f10e63c20629ecabbb64a8010319738c66a5cd0c29b02d63d272b03751d01" +dependencies = [ + "generic-array", +] + [[package]] name = "itertools" version = "0.14.0" @@ -383,6 +673,20 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "k256" +version = "0.13.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6e3919bbaa2945715f0bb6d3934a173d1e9a59ac23767fbaaef277265a7411b" +dependencies = [ + "cfg-if", + "ecdsa", + "elliptic-curve", + "once_cell", + "sha2", + "signature", +] + [[package]] name = "keccak" version = "0.1.5" @@ -503,11 +807,12 @@ dependencies = [ [[package]] name = "miden-air" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db750ce0c58f51ba786c7391f392c4b77e0c83a44c5096672d4d0270d3cc7763" +checksum = "06acfd2ddc25b68f9d23d2add3f15c0ec3f9890ce6418409d71bea9dc6590bd0" dependencies = [ "miden-core", + "miden-utils-indexing", "thiserror", "winter-air", "winter-prover", @@ -515,9 +820,9 @@ dependencies = [ [[package]] name = "miden-assembly" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82575d8479aad3966be3defdc17911264bfdc99f9a7bb185180eec57c6bda9f5" +checksum = "d1219b9e48bb286b58a23bb65cf74baa1b24ddbcb462ca625b38186674571047" dependencies = [ "log", "miden-assembly-syntax", @@ -529,9 +834,9 @@ dependencies = [ [[package]] name = "miden-assembly-syntax" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7b3588ce15920c0bff47e8bf8c6ca9e0a7a539ff93014cb5ec3c665f60bc0f1" +checksum = "1eeaef2853061c54527bb2664c0c832ce3d1f80847c79512455fec3b93057f2a" dependencies = [ "aho-corasick", "lalrpop", @@ -579,13 +884,15 @@ dependencies = [ [[package]] name = "miden-core" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "571a943a923e5fb3f1bed534f41a1542c531ad2aec87dc0d5699af1709fbcea6" +checksum = "452a00429d05c416001ec0578291eb88e115cf94fc22b3308267abfdcd813440" dependencies = [ + "enum_dispatch", "miden-crypto", "miden-debug-types", "miden-formatting", + "miden-utils-indexing", "num-derive", "num-traits", "thiserror", @@ -595,33 +902,54 @@ dependencies = [ [[package]] name = "miden-crypto" -version = "0.15.9" +version = "0.18.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4329275a11c7d8328b14a7129b21d40183056dcd0d871c3069be6e550d6ca40" +checksum = "7eb82051002f9c64878d3b105a7b924de1ee92019231923380cf4ecd7b824f9a" dependencies = [ "blake3", + "chacha20poly1305", + "ed25519-dalek", + "flume", "glob", + "hkdf", + "k256", + "miden-crypto-derive", "num", "num-complex", "rand", - "rand_core", + "rand_chacha", + "rand_core 0.9.3", + "rand_hc", "sha3", + "subtle", "thiserror", "winter-crypto", "winter-math", "winter-utils", + "x25519-dalek", +] + +[[package]] +name = "miden-crypto-derive" +version = "0.18.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2222f37355ea975f40acd3c098a437574a31a4d8a2c193cf4e9fead2beede577" +dependencies = [ + "quote", + "syn", ] [[package]] name = "miden-debug-types" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93a4b53092da70aa4c9b75acc85e1c7b4d8202ce89487d2271ebdc2defcb08d6" +checksum = "97eed62ac0ca7420e49148fd306c74786b23a8d31df6da6277c671ba3e5c619a" dependencies = [ "memchr", "miden-crypto", "miden-formatting", "miden-miette", + "miden-utils-indexing", "miden-utils-sync", "paste", "thiserror", @@ -638,13 +966,14 @@ dependencies = [ [[package]] name = "miden-mast-package" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57efbfaea75eeb07d448c04aefce241bf8f23ea11600a669d897280551819992" +checksum = "1d13e6ba2b357551598f13396ed52f8f21aa99979aa3b338bb5521feeda19c8a" dependencies = [ "derive_more", "miden-assembly-syntax", "miden-core", + "thiserror", ] [[package]] @@ -685,33 +1014,41 @@ dependencies = [ [[package]] name = "miden-objects" -version = "0.11.2" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a16bce60bda18cfeaa49e99e35307c6f45297bfe2f0e18c009fa356edd552e70" +checksum = "0ef49472012d00be68f68dcbb13b4f28867fb6271c76c014bc555ef6e8e0958a" dependencies = [ "bech32", - "getrandom", + "getrandom 0.3.3", "miden-assembly", + "miden-assembly-syntax", "miden-core", "miden-crypto", + "miden-mast-package", "miden-processor", "miden-utils-sync", "miden-verifier", + "rand", "semver 1.0.26", "thiserror", ] [[package]] name = "miden-processor" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3c033f51b575b5a70b763dc0bc05062b6562a8286c6d0c144eaff92da8f214f" +checksum = "d2ef77929651b8755965cde8f589bd38e2345a619d54cab6427f91aa23c47f6a" dependencies = [ + "itertools", "miden-air", "miden-core", "miden-debug-types", "miden-utils-diagnostics", + "miden-utils-indexing", + "paste", + "rayon", "thiserror", + "tokio", "tracing", "winter-prover", ] @@ -726,9 +1063,9 @@ version = "0.7.0" [[package]] name = "miden-utils-diagnostics" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d640d80ce3438275b13d0d400901e5bbf3179737818d91d4e84f747a480fd8b" +checksum = "1a3ff4c019d96539a7066626efb4dce5c9fb7b0e44e961b0c2571e78f34236d5" dependencies = [ "miden-crypto", "miden-debug-types", @@ -737,11 +1074,20 @@ dependencies = [ "tracing", ] +[[package]] +name = "miden-utils-indexing" +version = "0.19.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c798250bee4e856d4f18c161e91cdcbef1906f6614d00cf0063b47031c0f8cc6" +dependencies = [ + "thiserror", +] + [[package]] name = "miden-utils-sync" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccf49e1fbfefeb58de992767ae7b0b6200885e342f4dd43c510daefce9539b95" +checksum = "feebe7d896c013ea74dbc98de978836606356a044d4ed3b61ded54d3b319d89f" dependencies = [ "lock_api", "loom", @@ -749,9 +1095,9 @@ dependencies = [ [[package]] name = "miden-verifier" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3104dce8b4668639aa97aa748a98aab0ea33c103e06ef5c3fd12445ab3bd2387" +checksum = "b8f8e47b78bba1fe1b31faee8f12aafd95385f6d6a8b108b03e92f5d743bb29f" dependencies = [ "miden-air", "miden-core", @@ -762,15 +1108,24 @@ dependencies = [ [[package]] name = "midenc-hir-type" -version = "0.1.5" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e381ba23e4f57ffa0d6039113f6d6004e5b8c7ae6cb909329b48f2ab525e8680" +checksum = "9d4cfab04baffdda3fb9eafa5f873604059b89a1699aa95e4f1057397a69f0b5" dependencies = [ "miden-formatting", "smallvec", "thiserror", ] +[[package]] +name = "nanorand" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a51313c5820b0b02bd422f4b44776fbf47961755c74ce64afc73bfad10226c3" +dependencies = [ + "getrandom 0.2.16", +] + [[package]] name = "new_debug_unreachable" version = "1.0.6" @@ -878,6 +1233,12 @@ version = "1.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" +[[package]] +name = "opaque-debug" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381" + [[package]] name = "overload" version = "0.1.1" @@ -950,6 +1311,36 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" +[[package]] +name = "pkcs8" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" +dependencies = [ + "der", + "spki", +] + +[[package]] +name = "poly1305" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8159bd90725d2df49889a078b54f4f79e87f1f8a8444194cdca81d38f5393abf" +dependencies = [ + "cpufeatures", + "opaque-debug", + "universal-hash", +] + +[[package]] +name = "ppv-lite86" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" +dependencies = [ + "zerocopy", +] + [[package]] name = "precomputed-hash" version = "0.1.1" @@ -996,7 +1387,26 @@ version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1" dependencies = [ - "rand_core", + "rand_core 0.9.3", +] + +[[package]] +name = "rand_chacha" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb" +dependencies = [ + "ppv-lite86", + "rand_core 0.9.3", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom 0.2.16", ] [[package]] @@ -1005,6 +1415,35 @@ version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38" +[[package]] +name = "rand_hc" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b363d4f6370f88d62bf586c80405657bde0f0e1b8945d47d2ad59b906cb4f54" +dependencies = [ + "rand_core 0.6.4", +] + +[[package]] +name = "rayon" +version = "1.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "368f01d005bf8fd9b1206fb6fa653e6c4a81ceb1466406b81792d87c5677a58f" +dependencies = [ + "either", + "rayon-core", +] + +[[package]] +name = "rayon-core" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22e18b0f0062d30d4230b2e85ff77fdfe4326feb054b9783a3460d8435c8ab91" +dependencies = [ + "crossbeam-deque", + "crossbeam-utils", +] + [[package]] name = "redox_syscall" version = "0.5.14" @@ -1016,13 +1455,13 @@ dependencies = [ [[package]] name = "regex" -version = "1.11.1" +version = "1.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191" +checksum = "843bc0191f75f3e22651ae5f1e72939ab2f72a4bc30fa80a066bd66edefc24d4" dependencies = [ "aho-corasick", "memchr", - "regex-automata 0.4.9", + "regex-automata 0.4.13", "regex-syntax 0.8.5", ] @@ -1037,9 +1476,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.9" +version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908" +checksum = "5276caf25ac86c8d810222b3dbb938e512c55c6831a10f3e6ed1c93b84041f1c" dependencies = [ "aho-corasick", "memchr", @@ -1058,6 +1497,16 @@ version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" +[[package]] +name = "rfc6979" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dd2a808d456c4a54e300a23e9f5a67e122c3024119acbfd73e3bf664491cb2" +dependencies = [ + "hmac", + "subtle", +] + [[package]] name = "rustc_version" version = "0.2.3" @@ -1109,6 +1558,20 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" +[[package]] +name = "sec1" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" +dependencies = [ + "base16ct", + "der", + "generic-array", + "pkcs8", + "subtle", + "zeroize", +] + [[package]] name = "semver" version = "0.9.0" @@ -1183,6 +1646,17 @@ dependencies = [ "serde", ] +[[package]] +name = "sha2" +version = "0.10.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + [[package]] name = "sha3" version = "0.10.8" @@ -1208,6 +1682,16 @@ version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" +[[package]] +name = "signature" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" +dependencies = [ + "digest", + "rand_core 0.6.4", +] + [[package]] name = "siphasher" version = "1.0.1" @@ -1231,6 +1715,19 @@ name = "spin" version = "0.9.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" +dependencies = [ + "lock_api", +] + +[[package]] +name = "spki" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d" +dependencies = [ + "base64ct", + "der", +] [[package]] name = "string_cache" @@ -1253,6 +1750,12 @@ dependencies = [ "vte", ] +[[package]] +name = "subtle" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" + [[package]] name = "syn" version = "2.0.106" @@ -1328,6 +1831,15 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "tokio" +version = "1.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff360e02eab121e0bc37a2d3b4d4dc622e6eda3a8e5253d5435ecf5bd4c68408" +dependencies = [ + "pin-project-lite", +] + [[package]] name = "toml" version = "0.8.23" @@ -1522,6 +2034,16 @@ version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" +[[package]] +name = "universal-hash" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc1de2c688dc15305988b563c3854064043356019f97a4b46276fe734c4f07ea" +dependencies = [ + "crypto-common", + "subtle", +] + [[package]] name = "valuable" version = "0.1.1" @@ -1553,6 +2075,12 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "wasi" +version = "0.11.1+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" + [[package]] name = "wasi" version = "0.14.2+wasi-0.2.4" @@ -2062,3 +2590,39 @@ dependencies = [ "unicode-xid", "wasmparser", ] + +[[package]] +name = "x25519-dalek" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7e468321c81fb07fa7f4c636c3972b9100f0346e5b6a9f2bd0603a52f7ed277" +dependencies = [ + "curve25519-dalek", + "rand_core 0.6.4", +] + +[[package]] +name = "zerocopy" +version = "0.8.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0894878a5fa3edfd6da3f88c4805f4c8558e2b996227a3d864f47fe11e38282c" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.8.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88d2b8d9c68ad2b9e4340d7832716a4d21a22a1154777ad56ea55c51a9cf3831" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "zeroize" +version = "1.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b97154e67e32c85465826e8bcc1c59429aaaf107c1e4a9e53c8d8ccd5eff88d0" diff --git a/examples/basic-wallet/src/lib.rs b/examples/basic-wallet/src/lib.rs index 1f20806c1..df4410e17 100644 --- a/examples/basic-wallet/src/lib.rs +++ b/examples/basic-wallet/src/lib.rs @@ -6,7 +6,7 @@ // // extern crate alloc; -use miden::{account, component, tx, Asset, NoteIdx}; +use miden::{account, component, output_note, Asset, NoteIdx}; #[component] struct MyAccount; @@ -33,6 +33,6 @@ impl MyAccount { /// * `note_idx` - The index of the note to receive the asset pub fn move_asset_to_note(&self, asset: Asset, note_idx: NoteIdx) { let asset = account::remove_asset(asset); - tx::add_asset_to_note(asset, note_idx); + output_note::add_asset(asset, note_idx); } } diff --git a/examples/counter-contract/Cargo.lock b/examples/counter-contract/Cargo.lock index 004f5e4a7..f488a5aae 100644 --- a/examples/counter-contract/Cargo.lock +++ b/examples/counter-contract/Cargo.lock @@ -2,6 +2,16 @@ # It is not intended for manual editing. version = 4 +[[package]] +name = "aead" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d122413f284cf2d62fb1b7db97e02edb8cda96d769b16e443a4f6195e35662b0" +dependencies = [ + "crypto-common", + "generic-array", +] + [[package]] name = "aho-corasick" version = "1.1.3" @@ -44,6 +54,18 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" +[[package]] +name = "base16ct" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" + +[[package]] +name = "base64ct" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55248b47b0caf0546f7988906588779981c43bb1bc9d0c44087278f80cdb44ba" + [[package]] name = "bech32" version = "0.11.0" @@ -114,6 +136,47 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9555578bc9e57714c812a1f84e4fc5b4d21fcb063490c624de019f7464c91268" +[[package]] +name = "chacha20" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3613f74bd2eac03dad61bd53dbe620703d4371614fe0bc3b9f04dd36fe4e818" +dependencies = [ + "cfg-if", + "cipher", + "cpufeatures", +] + +[[package]] +name = "chacha20poly1305" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10cd79432192d1c0f4e1a0fef9527696cc039165d729fb41b3f4f4f354c2dc35" +dependencies = [ + "aead", + "chacha20", + "cipher", + "poly1305", + "zeroize", +] + +[[package]] +name = "cipher" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" +dependencies = [ + "crypto-common", + "inout", + "zeroize", +] + +[[package]] +name = "const-oid" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" + [[package]] name = "constant_time_eq" version = "0.3.1" @@ -136,6 +199,43 @@ dependencies = [ "libc", ] +[[package]] +name = "crossbeam-deque" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9dd111b7b7f7d55b72c0a6ae361660ee5853c9af73f70c3c2ef6858b950e2e51" +dependencies = [ + "crossbeam-epoch", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.9.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" + +[[package]] +name = "crypto-bigint" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76" +dependencies = [ + "generic-array", + "rand_core 0.6.4", + "subtle", + "zeroize", +] + [[package]] name = "crypto-common" version = "0.1.6" @@ -143,9 +243,47 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" dependencies = [ "generic-array", + "rand_core 0.6.4", "typenum", ] +[[package]] +name = "curve25519-dalek" +version = "4.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97fb8b7c4503de7d6ae7b42ab72a5a59857b4c937ec27a3d4539dba95b5ab2be" +dependencies = [ + "cfg-if", + "cpufeatures", + "curve25519-dalek-derive", + "digest", + "fiat-crypto", + "rustc_version 0.4.1", + "subtle", + "zeroize", +] + +[[package]] +name = "curve25519-dalek-derive" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "der" +version = "0.7.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7c1832837b905bbfb5101e07cc24c8deddf52f93225eee6ead5f4d63d53ddcb" +dependencies = [ + "const-oid", + "zeroize", +] + [[package]] name = "derive_more" version = "2.0.1" @@ -173,7 +311,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ "block-buffer", + "const-oid", "crypto-common", + "subtle", ] [[package]] @@ -182,12 +322,70 @@ version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8975ffdaa0ef3661bfe02dbdcc06c9f829dfafe6a3c474de366a8d5e44276921" +[[package]] +name = "ecdsa" +version = "0.16.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee27f32b5c5292967d2d4a9d7f1e0b0aed2c15daded5a60300e4abb9d8020bca" +dependencies = [ + "der", + "digest", + "elliptic-curve", + "rfc6979", + "signature", + "spki", +] + +[[package]] +name = "ed25519" +version = "2.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "115531babc129696a58c64a4fef0a8bf9e9698629fb97e9e40767d235cfbcd53" +dependencies = [ + "pkcs8", + "signature", +] + +[[package]] +name = "ed25519-dalek" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70e796c081cee67dc755e1a36a0a172b897fab85fc3f6bc48307991f64e4eca9" +dependencies = [ + "curve25519-dalek", + "ed25519", + "serde", + "sha2", + "subtle", + "zeroize", +] + [[package]] name = "either" version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719" +[[package]] +name = "elliptic-curve" +version = "0.13.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47" +dependencies = [ + "base16ct", + "crypto-bigint", + "digest", + "ff", + "generic-array", + "group", + "hkdf", + "pkcs8", + "rand_core 0.6.4", + "sec1", + "subtle", + "zeroize", +] + [[package]] name = "ena" version = "0.14.3" @@ -197,18 +395,58 @@ dependencies = [ "log", ] +[[package]] +name = "enum_dispatch" +version = "0.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa18ce2bc66555b3218614519ac839ddb759a7d6720732f979ef8d13be147ecd" +dependencies = [ + "once_cell", + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "equivalent" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" +[[package]] +name = "ff" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0b50bfb653653f9ca9095b427bed08ab8d75a137839d9ad64eb11810d5b6393" +dependencies = [ + "rand_core 0.6.4", + "subtle", +] + +[[package]] +name = "fiat-crypto" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28dea519a9695b9977216879a3ebfddf92f1c08c05d984f8996aecd6ecdc811d" + [[package]] name = "fixedbitset" version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1d674e81391d1e1ab681a28d99df07927c6d4aa5b027d7da16ba32d1d21ecd99" +[[package]] +name = "flume" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da0e4dd2a88388a1f4ccc7c9ce104604dab68d9f408dc34cd45823d5a9069095" +dependencies = [ + "futures-core", + "futures-sink", + "nanorand", + "spin", +] + [[package]] name = "foldhash" version = "0.1.5" @@ -298,6 +536,20 @@ checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" dependencies = [ "typenum", "version_check", + "zeroize", +] + +[[package]] +name = "getrandom" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "335ff9f135e4384c8150d6f27c6daed433577f86b4750418338c01a1a2528592" +dependencies = [ + "cfg-if", + "js-sys", + "libc", + "wasi 0.11.1+wasi-snapshot-preview1", + "wasm-bindgen", ] [[package]] @@ -310,7 +562,7 @@ dependencies = [ "js-sys", "libc", "r-efi", - "wasi", + "wasi 0.14.2+wasi-0.2.4", "wasm-bindgen", ] @@ -320,6 +572,17 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a8d1add55171497b4705a648c6b583acafb01d58050a51727785f0b2c8e0a2b2" +[[package]] +name = "group" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" +dependencies = [ + "ff", + "rand_core 0.6.4", + "subtle", +] + [[package]] name = "hashbrown" version = "0.15.4" @@ -335,6 +598,24 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" +[[package]] +name = "hkdf" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b5f8eb2ad728638ea2c7d47a21db23b7b58a72ed6a38256b8a1849f15fbbdf7" +dependencies = [ + "hmac", +] + +[[package]] +name = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest", +] + [[package]] name = "id-arena" version = "2.2.1" @@ -358,6 +639,15 @@ dependencies = [ "serde", ] +[[package]] +name = "inout" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "879f10e63c20629ecabbb64a8010319738c66a5cd0c29b02d63d272b03751d01" +dependencies = [ + "generic-array", +] + [[package]] name = "itertools" version = "0.14.0" @@ -383,6 +673,20 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "k256" +version = "0.13.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6e3919bbaa2945715f0bb6d3934a173d1e9a59ac23767fbaaef277265a7411b" +dependencies = [ + "cfg-if", + "ecdsa", + "elliptic-curve", + "once_cell", + "sha2", + "signature", +] + [[package]] name = "keccak" version = "0.1.5" @@ -503,11 +807,12 @@ dependencies = [ [[package]] name = "miden-air" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db750ce0c58f51ba786c7391f392c4b77e0c83a44c5096672d4d0270d3cc7763" +checksum = "06acfd2ddc25b68f9d23d2add3f15c0ec3f9890ce6418409d71bea9dc6590bd0" dependencies = [ "miden-core", + "miden-utils-indexing", "thiserror", "winter-air", "winter-prover", @@ -515,9 +820,9 @@ dependencies = [ [[package]] name = "miden-assembly" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82575d8479aad3966be3defdc17911264bfdc99f9a7bb185180eec57c6bda9f5" +checksum = "d1219b9e48bb286b58a23bb65cf74baa1b24ddbcb462ca625b38186674571047" dependencies = [ "log", "miden-assembly-syntax", @@ -529,9 +834,9 @@ dependencies = [ [[package]] name = "miden-assembly-syntax" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7b3588ce15920c0bff47e8bf8c6ca9e0a7a539ff93014cb5ec3c665f60bc0f1" +checksum = "1eeaef2853061c54527bb2664c0c832ce3d1f80847c79512455fec3b93057f2a" dependencies = [ "aho-corasick", "lalrpop", @@ -579,13 +884,15 @@ dependencies = [ [[package]] name = "miden-core" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "571a943a923e5fb3f1bed534f41a1542c531ad2aec87dc0d5699af1709fbcea6" +checksum = "452a00429d05c416001ec0578291eb88e115cf94fc22b3308267abfdcd813440" dependencies = [ + "enum_dispatch", "miden-crypto", "miden-debug-types", "miden-formatting", + "miden-utils-indexing", "num-derive", "num-traits", "thiserror", @@ -595,33 +902,54 @@ dependencies = [ [[package]] name = "miden-crypto" -version = "0.15.9" +version = "0.18.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4329275a11c7d8328b14a7129b21d40183056dcd0d871c3069be6e550d6ca40" +checksum = "7eb82051002f9c64878d3b105a7b924de1ee92019231923380cf4ecd7b824f9a" dependencies = [ "blake3", + "chacha20poly1305", + "ed25519-dalek", + "flume", "glob", + "hkdf", + "k256", + "miden-crypto-derive", "num", "num-complex", "rand", - "rand_core", + "rand_chacha", + "rand_core 0.9.3", + "rand_hc", "sha3", + "subtle", "thiserror", "winter-crypto", "winter-math", "winter-utils", + "x25519-dalek", +] + +[[package]] +name = "miden-crypto-derive" +version = "0.18.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2222f37355ea975f40acd3c098a437574a31a4d8a2c193cf4e9fead2beede577" +dependencies = [ + "quote", + "syn", ] [[package]] name = "miden-debug-types" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93a4b53092da70aa4c9b75acc85e1c7b4d8202ce89487d2271ebdc2defcb08d6" +checksum = "97eed62ac0ca7420e49148fd306c74786b23a8d31df6da6277c671ba3e5c619a" dependencies = [ "memchr", "miden-crypto", "miden-formatting", "miden-miette", + "miden-utils-indexing", "miden-utils-sync", "paste", "thiserror", @@ -638,13 +966,14 @@ dependencies = [ [[package]] name = "miden-mast-package" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57efbfaea75eeb07d448c04aefce241bf8f23ea11600a669d897280551819992" +checksum = "1d13e6ba2b357551598f13396ed52f8f21aa99979aa3b338bb5521feeda19c8a" dependencies = [ "derive_more", "miden-assembly-syntax", "miden-core", + "thiserror", ] [[package]] @@ -685,33 +1014,41 @@ dependencies = [ [[package]] name = "miden-objects" -version = "0.11.2" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a16bce60bda18cfeaa49e99e35307c6f45297bfe2f0e18c009fa356edd552e70" +checksum = "0ef49472012d00be68f68dcbb13b4f28867fb6271c76c014bc555ef6e8e0958a" dependencies = [ "bech32", - "getrandom", + "getrandom 0.3.3", "miden-assembly", + "miden-assembly-syntax", "miden-core", "miden-crypto", + "miden-mast-package", "miden-processor", "miden-utils-sync", "miden-verifier", + "rand", "semver 1.0.26", "thiserror", ] [[package]] name = "miden-processor" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3c033f51b575b5a70b763dc0bc05062b6562a8286c6d0c144eaff92da8f214f" +checksum = "d2ef77929651b8755965cde8f589bd38e2345a619d54cab6427f91aa23c47f6a" dependencies = [ + "itertools", "miden-air", "miden-core", "miden-debug-types", "miden-utils-diagnostics", + "miden-utils-indexing", + "paste", + "rayon", "thiserror", + "tokio", "tracing", "winter-prover", ] @@ -726,9 +1063,9 @@ version = "0.7.0" [[package]] name = "miden-utils-diagnostics" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d640d80ce3438275b13d0d400901e5bbf3179737818d91d4e84f747a480fd8b" +checksum = "1a3ff4c019d96539a7066626efb4dce5c9fb7b0e44e961b0c2571e78f34236d5" dependencies = [ "miden-crypto", "miden-debug-types", @@ -737,11 +1074,20 @@ dependencies = [ "tracing", ] +[[package]] +name = "miden-utils-indexing" +version = "0.19.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c798250bee4e856d4f18c161e91cdcbef1906f6614d00cf0063b47031c0f8cc6" +dependencies = [ + "thiserror", +] + [[package]] name = "miden-utils-sync" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccf49e1fbfefeb58de992767ae7b0b6200885e342f4dd43c510daefce9539b95" +checksum = "feebe7d896c013ea74dbc98de978836606356a044d4ed3b61ded54d3b319d89f" dependencies = [ "lock_api", "loom", @@ -749,9 +1095,9 @@ dependencies = [ [[package]] name = "miden-verifier" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3104dce8b4668639aa97aa748a98aab0ea33c103e06ef5c3fd12445ab3bd2387" +checksum = "b8f8e47b78bba1fe1b31faee8f12aafd95385f6d6a8b108b03e92f5d743bb29f" dependencies = [ "miden-air", "miden-core", @@ -762,15 +1108,24 @@ dependencies = [ [[package]] name = "midenc-hir-type" -version = "0.1.5" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e381ba23e4f57ffa0d6039113f6d6004e5b8c7ae6cb909329b48f2ab525e8680" +checksum = "9d4cfab04baffdda3fb9eafa5f873604059b89a1699aa95e4f1057397a69f0b5" dependencies = [ "miden-formatting", "smallvec", "thiserror", ] +[[package]] +name = "nanorand" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a51313c5820b0b02bd422f4b44776fbf47961755c74ce64afc73bfad10226c3" +dependencies = [ + "getrandom 0.2.16", +] + [[package]] name = "new_debug_unreachable" version = "1.0.6" @@ -878,6 +1233,12 @@ version = "1.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" +[[package]] +name = "opaque-debug" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381" + [[package]] name = "overload" version = "0.1.1" @@ -950,6 +1311,36 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" +[[package]] +name = "pkcs8" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" +dependencies = [ + "der", + "spki", +] + +[[package]] +name = "poly1305" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8159bd90725d2df49889a078b54f4f79e87f1f8a8444194cdca81d38f5393abf" +dependencies = [ + "cpufeatures", + "opaque-debug", + "universal-hash", +] + +[[package]] +name = "ppv-lite86" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" +dependencies = [ + "zerocopy", +] + [[package]] name = "precomputed-hash" version = "0.1.1" @@ -996,7 +1387,26 @@ version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1" dependencies = [ - "rand_core", + "rand_core 0.9.3", +] + +[[package]] +name = "rand_chacha" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb" +dependencies = [ + "ppv-lite86", + "rand_core 0.9.3", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom 0.2.16", ] [[package]] @@ -1005,6 +1415,35 @@ version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38" +[[package]] +name = "rand_hc" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b363d4f6370f88d62bf586c80405657bde0f0e1b8945d47d2ad59b906cb4f54" +dependencies = [ + "rand_core 0.6.4", +] + +[[package]] +name = "rayon" +version = "1.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "368f01d005bf8fd9b1206fb6fa653e6c4a81ceb1466406b81792d87c5677a58f" +dependencies = [ + "either", + "rayon-core", +] + +[[package]] +name = "rayon-core" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22e18b0f0062d30d4230b2e85ff77fdfe4326feb054b9783a3460d8435c8ab91" +dependencies = [ + "crossbeam-deque", + "crossbeam-utils", +] + [[package]] name = "redox_syscall" version = "0.5.14" @@ -1016,13 +1455,13 @@ dependencies = [ [[package]] name = "regex" -version = "1.11.1" +version = "1.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191" +checksum = "843bc0191f75f3e22651ae5f1e72939ab2f72a4bc30fa80a066bd66edefc24d4" dependencies = [ "aho-corasick", "memchr", - "regex-automata 0.4.9", + "regex-automata 0.4.13", "regex-syntax 0.8.5", ] @@ -1037,9 +1476,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.9" +version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908" +checksum = "5276caf25ac86c8d810222b3dbb938e512c55c6831a10f3e6ed1c93b84041f1c" dependencies = [ "aho-corasick", "memchr", @@ -1058,6 +1497,16 @@ version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" +[[package]] +name = "rfc6979" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dd2a808d456c4a54e300a23e9f5a67e122c3024119acbfd73e3bf664491cb2" +dependencies = [ + "hmac", + "subtle", +] + [[package]] name = "rustc_version" version = "0.2.3" @@ -1109,6 +1558,20 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" +[[package]] +name = "sec1" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" +dependencies = [ + "base16ct", + "der", + "generic-array", + "pkcs8", + "subtle", + "zeroize", +] + [[package]] name = "semver" version = "0.9.0" @@ -1183,6 +1646,17 @@ dependencies = [ "serde", ] +[[package]] +name = "sha2" +version = "0.10.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + [[package]] name = "sha3" version = "0.10.8" @@ -1208,6 +1682,16 @@ version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" +[[package]] +name = "signature" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" +dependencies = [ + "digest", + "rand_core 0.6.4", +] + [[package]] name = "siphasher" version = "1.0.1" @@ -1231,6 +1715,19 @@ name = "spin" version = "0.9.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" +dependencies = [ + "lock_api", +] + +[[package]] +name = "spki" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d" +dependencies = [ + "base64ct", + "der", +] [[package]] name = "string_cache" @@ -1253,6 +1750,12 @@ dependencies = [ "vte", ] +[[package]] +name = "subtle" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" + [[package]] name = "syn" version = "2.0.106" @@ -1328,6 +1831,15 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "tokio" +version = "1.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff360e02eab121e0bc37a2d3b4d4dc622e6eda3a8e5253d5435ecf5bd4c68408" +dependencies = [ + "pin-project-lite", +] + [[package]] name = "toml" version = "0.8.23" @@ -1522,6 +2034,16 @@ version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" +[[package]] +name = "universal-hash" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc1de2c688dc15305988b563c3854064043356019f97a4b46276fe734c4f07ea" +dependencies = [ + "crypto-common", + "subtle", +] + [[package]] name = "valuable" version = "0.1.1" @@ -1553,6 +2075,12 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "wasi" +version = "0.11.1+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" + [[package]] name = "wasi" version = "0.14.2+wasi-0.2.4" @@ -2062,3 +2590,39 @@ dependencies = [ "unicode-xid", "wasmparser", ] + +[[package]] +name = "x25519-dalek" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7e468321c81fb07fa7f4c636c3972b9100f0346e5b6a9f2bd0603a52f7ed277" +dependencies = [ + "curve25519-dalek", + "rand_core 0.6.4", +] + +[[package]] +name = "zerocopy" +version = "0.8.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0894878a5fa3edfd6da3f88c4805f4c8558e2b996227a3d864f47fe11e38282c" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.8.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88d2b8d9c68ad2b9e4340d7832716a4d21a22a1154777ad56ea55c51a9cf3831" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "zeroize" +version = "1.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b97154e67e32c85465826e8bcc1c59429aaaf107c1e4a9e53c8d8ccd5eff88d0" diff --git a/examples/counter-note/Cargo.lock b/examples/counter-note/Cargo.lock index e144cf9a7..e5b0c193b 100644 --- a/examples/counter-note/Cargo.lock +++ b/examples/counter-note/Cargo.lock @@ -2,6 +2,16 @@ # It is not intended for manual editing. version = 4 +[[package]] +name = "aead" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d122413f284cf2d62fb1b7db97e02edb8cda96d769b16e443a4f6195e35662b0" +dependencies = [ + "crypto-common", + "generic-array", +] + [[package]] name = "aho-corasick" version = "1.1.3" @@ -44,6 +54,18 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" +[[package]] +name = "base16ct" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" + +[[package]] +name = "base64ct" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55248b47b0caf0546f7988906588779981c43bb1bc9d0c44087278f80cdb44ba" + [[package]] name = "bech32" version = "0.11.0" @@ -114,6 +136,47 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9555578bc9e57714c812a1f84e4fc5b4d21fcb063490c624de019f7464c91268" +[[package]] +name = "chacha20" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3613f74bd2eac03dad61bd53dbe620703d4371614fe0bc3b9f04dd36fe4e818" +dependencies = [ + "cfg-if", + "cipher", + "cpufeatures", +] + +[[package]] +name = "chacha20poly1305" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10cd79432192d1c0f4e1a0fef9527696cc039165d729fb41b3f4f4f354c2dc35" +dependencies = [ + "aead", + "chacha20", + "cipher", + "poly1305", + "zeroize", +] + +[[package]] +name = "cipher" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" +dependencies = [ + "crypto-common", + "inout", + "zeroize", +] + +[[package]] +name = "const-oid" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" + [[package]] name = "constant_time_eq" version = "0.3.1" @@ -136,6 +199,43 @@ dependencies = [ "libc", ] +[[package]] +name = "crossbeam-deque" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9dd111b7b7f7d55b72c0a6ae361660ee5853c9af73f70c3c2ef6858b950e2e51" +dependencies = [ + "crossbeam-epoch", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.9.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" + +[[package]] +name = "crypto-bigint" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76" +dependencies = [ + "generic-array", + "rand_core 0.6.4", + "subtle", + "zeroize", +] + [[package]] name = "crypto-common" version = "0.1.6" @@ -143,9 +243,47 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" dependencies = [ "generic-array", + "rand_core 0.6.4", "typenum", ] +[[package]] +name = "curve25519-dalek" +version = "4.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97fb8b7c4503de7d6ae7b42ab72a5a59857b4c937ec27a3d4539dba95b5ab2be" +dependencies = [ + "cfg-if", + "cpufeatures", + "curve25519-dalek-derive", + "digest", + "fiat-crypto", + "rustc_version 0.4.1", + "subtle", + "zeroize", +] + +[[package]] +name = "curve25519-dalek-derive" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "der" +version = "0.7.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7c1832837b905bbfb5101e07cc24c8deddf52f93225eee6ead5f4d63d53ddcb" +dependencies = [ + "const-oid", + "zeroize", +] + [[package]] name = "derive_more" version = "2.0.1" @@ -173,7 +311,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ "block-buffer", + "const-oid", "crypto-common", + "subtle", ] [[package]] @@ -182,12 +322,70 @@ version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8975ffdaa0ef3661bfe02dbdcc06c9f829dfafe6a3c474de366a8d5e44276921" +[[package]] +name = "ecdsa" +version = "0.16.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee27f32b5c5292967d2d4a9d7f1e0b0aed2c15daded5a60300e4abb9d8020bca" +dependencies = [ + "der", + "digest", + "elliptic-curve", + "rfc6979", + "signature", + "spki", +] + +[[package]] +name = "ed25519" +version = "2.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "115531babc129696a58c64a4fef0a8bf9e9698629fb97e9e40767d235cfbcd53" +dependencies = [ + "pkcs8", + "signature", +] + +[[package]] +name = "ed25519-dalek" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70e796c081cee67dc755e1a36a0a172b897fab85fc3f6bc48307991f64e4eca9" +dependencies = [ + "curve25519-dalek", + "ed25519", + "serde", + "sha2", + "subtle", + "zeroize", +] + [[package]] name = "either" version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719" +[[package]] +name = "elliptic-curve" +version = "0.13.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47" +dependencies = [ + "base16ct", + "crypto-bigint", + "digest", + "ff", + "generic-array", + "group", + "hkdf", + "pkcs8", + "rand_core 0.6.4", + "sec1", + "subtle", + "zeroize", +] + [[package]] name = "ena" version = "0.14.3" @@ -197,18 +395,58 @@ dependencies = [ "log", ] +[[package]] +name = "enum_dispatch" +version = "0.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa18ce2bc66555b3218614519ac839ddb759a7d6720732f979ef8d13be147ecd" +dependencies = [ + "once_cell", + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "equivalent" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" +[[package]] +name = "ff" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0b50bfb653653f9ca9095b427bed08ab8d75a137839d9ad64eb11810d5b6393" +dependencies = [ + "rand_core 0.6.4", + "subtle", +] + +[[package]] +name = "fiat-crypto" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28dea519a9695b9977216879a3ebfddf92f1c08c05d984f8996aecd6ecdc811d" + [[package]] name = "fixedbitset" version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1d674e81391d1e1ab681a28d99df07927c6d4aa5b027d7da16ba32d1d21ecd99" +[[package]] +name = "flume" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da0e4dd2a88388a1f4ccc7c9ce104604dab68d9f408dc34cd45823d5a9069095" +dependencies = [ + "futures-core", + "futures-sink", + "nanorand", + "spin", +] + [[package]] name = "foldhash" version = "0.1.5" @@ -298,6 +536,20 @@ checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" dependencies = [ "typenum", "version_check", + "zeroize", +] + +[[package]] +name = "getrandom" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "335ff9f135e4384c8150d6f27c6daed433577f86b4750418338c01a1a2528592" +dependencies = [ + "cfg-if", + "js-sys", + "libc", + "wasi 0.11.1+wasi-snapshot-preview1", + "wasm-bindgen", ] [[package]] @@ -310,7 +562,7 @@ dependencies = [ "js-sys", "libc", "r-efi", - "wasi", + "wasi 0.14.2+wasi-0.2.4", "wasm-bindgen", ] @@ -320,6 +572,17 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a8d1add55171497b4705a648c6b583acafb01d58050a51727785f0b2c8e0a2b2" +[[package]] +name = "group" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" +dependencies = [ + "ff", + "rand_core 0.6.4", + "subtle", +] + [[package]] name = "hashbrown" version = "0.15.4" @@ -335,6 +598,24 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" +[[package]] +name = "hkdf" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b5f8eb2ad728638ea2c7d47a21db23b7b58a72ed6a38256b8a1849f15fbbdf7" +dependencies = [ + "hmac", +] + +[[package]] +name = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest", +] + [[package]] name = "id-arena" version = "2.2.1" @@ -358,6 +639,15 @@ dependencies = [ "serde", ] +[[package]] +name = "inout" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "879f10e63c20629ecabbb64a8010319738c66a5cd0c29b02d63d272b03751d01" +dependencies = [ + "generic-array", +] + [[package]] name = "itertools" version = "0.14.0" @@ -383,6 +673,20 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "k256" +version = "0.13.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6e3919bbaa2945715f0bb6d3934a173d1e9a59ac23767fbaaef277265a7411b" +dependencies = [ + "cfg-if", + "ecdsa", + "elliptic-curve", + "once_cell", + "sha2", + "signature", +] + [[package]] name = "keccak" version = "0.1.5" @@ -503,11 +807,12 @@ dependencies = [ [[package]] name = "miden-air" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db750ce0c58f51ba786c7391f392c4b77e0c83a44c5096672d4d0270d3cc7763" +checksum = "06acfd2ddc25b68f9d23d2add3f15c0ec3f9890ce6418409d71bea9dc6590bd0" dependencies = [ "miden-core", + "miden-utils-indexing", "thiserror", "winter-air", "winter-prover", @@ -515,9 +820,9 @@ dependencies = [ [[package]] name = "miden-assembly" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82575d8479aad3966be3defdc17911264bfdc99f9a7bb185180eec57c6bda9f5" +checksum = "d1219b9e48bb286b58a23bb65cf74baa1b24ddbcb462ca625b38186674571047" dependencies = [ "log", "miden-assembly-syntax", @@ -529,9 +834,9 @@ dependencies = [ [[package]] name = "miden-assembly-syntax" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7b3588ce15920c0bff47e8bf8c6ca9e0a7a539ff93014cb5ec3c665f60bc0f1" +checksum = "1eeaef2853061c54527bb2664c0c832ce3d1f80847c79512455fec3b93057f2a" dependencies = [ "aho-corasick", "lalrpop", @@ -579,13 +884,15 @@ dependencies = [ [[package]] name = "miden-core" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "571a943a923e5fb3f1bed534f41a1542c531ad2aec87dc0d5699af1709fbcea6" +checksum = "452a00429d05c416001ec0578291eb88e115cf94fc22b3308267abfdcd813440" dependencies = [ + "enum_dispatch", "miden-crypto", "miden-debug-types", "miden-formatting", + "miden-utils-indexing", "num-derive", "num-traits", "thiserror", @@ -595,33 +902,54 @@ dependencies = [ [[package]] name = "miden-crypto" -version = "0.15.9" +version = "0.18.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4329275a11c7d8328b14a7129b21d40183056dcd0d871c3069be6e550d6ca40" +checksum = "7eb82051002f9c64878d3b105a7b924de1ee92019231923380cf4ecd7b824f9a" dependencies = [ "blake3", + "chacha20poly1305", + "ed25519-dalek", + "flume", "glob", + "hkdf", + "k256", + "miden-crypto-derive", "num", "num-complex", "rand", - "rand_core", + "rand_chacha", + "rand_core 0.9.3", + "rand_hc", "sha3", + "subtle", "thiserror", "winter-crypto", "winter-math", "winter-utils", + "x25519-dalek", +] + +[[package]] +name = "miden-crypto-derive" +version = "0.18.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2222f37355ea975f40acd3c098a437574a31a4d8a2c193cf4e9fead2beede577" +dependencies = [ + "quote", + "syn", ] [[package]] name = "miden-debug-types" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93a4b53092da70aa4c9b75acc85e1c7b4d8202ce89487d2271ebdc2defcb08d6" +checksum = "97eed62ac0ca7420e49148fd306c74786b23a8d31df6da6277c671ba3e5c619a" dependencies = [ "memchr", "miden-crypto", "miden-formatting", "miden-miette", + "miden-utils-indexing", "miden-utils-sync", "paste", "thiserror", @@ -638,13 +966,14 @@ dependencies = [ [[package]] name = "miden-mast-package" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57efbfaea75eeb07d448c04aefce241bf8f23ea11600a669d897280551819992" +checksum = "1d13e6ba2b357551598f13396ed52f8f21aa99979aa3b338bb5521feeda19c8a" dependencies = [ "derive_more", "miden-assembly-syntax", "miden-core", + "thiserror", ] [[package]] @@ -685,33 +1014,41 @@ dependencies = [ [[package]] name = "miden-objects" -version = "0.11.2" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a16bce60bda18cfeaa49e99e35307c6f45297bfe2f0e18c009fa356edd552e70" +checksum = "0ef49472012d00be68f68dcbb13b4f28867fb6271c76c014bc555ef6e8e0958a" dependencies = [ "bech32", - "getrandom", + "getrandom 0.3.3", "miden-assembly", + "miden-assembly-syntax", "miden-core", "miden-crypto", + "miden-mast-package", "miden-processor", "miden-utils-sync", "miden-verifier", + "rand", "semver 1.0.26", "thiserror", ] [[package]] name = "miden-processor" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3c033f51b575b5a70b763dc0bc05062b6562a8286c6d0c144eaff92da8f214f" +checksum = "d2ef77929651b8755965cde8f589bd38e2345a619d54cab6427f91aa23c47f6a" dependencies = [ + "itertools", "miden-air", "miden-core", "miden-debug-types", "miden-utils-diagnostics", + "miden-utils-indexing", + "paste", + "rayon", "thiserror", + "tokio", "tracing", "winter-prover", ] @@ -726,9 +1063,9 @@ version = "0.7.0" [[package]] name = "miden-utils-diagnostics" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d640d80ce3438275b13d0d400901e5bbf3179737818d91d4e84f747a480fd8b" +checksum = "1a3ff4c019d96539a7066626efb4dce5c9fb7b0e44e961b0c2571e78f34236d5" dependencies = [ "miden-crypto", "miden-debug-types", @@ -737,11 +1074,20 @@ dependencies = [ "tracing", ] +[[package]] +name = "miden-utils-indexing" +version = "0.19.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c798250bee4e856d4f18c161e91cdcbef1906f6614d00cf0063b47031c0f8cc6" +dependencies = [ + "thiserror", +] + [[package]] name = "miden-utils-sync" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccf49e1fbfefeb58de992767ae7b0b6200885e342f4dd43c510daefce9539b95" +checksum = "feebe7d896c013ea74dbc98de978836606356a044d4ed3b61ded54d3b319d89f" dependencies = [ "lock_api", "loom", @@ -749,9 +1095,9 @@ dependencies = [ [[package]] name = "miden-verifier" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3104dce8b4668639aa97aa748a98aab0ea33c103e06ef5c3fd12445ab3bd2387" +checksum = "b8f8e47b78bba1fe1b31faee8f12aafd95385f6d6a8b108b03e92f5d743bb29f" dependencies = [ "miden-air", "miden-core", @@ -762,15 +1108,24 @@ dependencies = [ [[package]] name = "midenc-hir-type" -version = "0.1.5" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e381ba23e4f57ffa0d6039113f6d6004e5b8c7ae6cb909329b48f2ab525e8680" +checksum = "9d4cfab04baffdda3fb9eafa5f873604059b89a1699aa95e4f1057397a69f0b5" dependencies = [ "miden-formatting", "smallvec", "thiserror", ] +[[package]] +name = "nanorand" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a51313c5820b0b02bd422f4b44776fbf47961755c74ce64afc73bfad10226c3" +dependencies = [ + "getrandom 0.2.16", +] + [[package]] name = "new_debug_unreachable" version = "1.0.6" @@ -878,6 +1233,12 @@ version = "1.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" +[[package]] +name = "opaque-debug" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381" + [[package]] name = "overload" version = "0.1.1" @@ -950,6 +1311,36 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" +[[package]] +name = "pkcs8" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" +dependencies = [ + "der", + "spki", +] + +[[package]] +name = "poly1305" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8159bd90725d2df49889a078b54f4f79e87f1f8a8444194cdca81d38f5393abf" +dependencies = [ + "cpufeatures", + "opaque-debug", + "universal-hash", +] + +[[package]] +name = "ppv-lite86" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" +dependencies = [ + "zerocopy", +] + [[package]] name = "precomputed-hash" version = "0.1.1" @@ -996,7 +1387,26 @@ version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1" dependencies = [ - "rand_core", + "rand_core 0.9.3", +] + +[[package]] +name = "rand_chacha" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb" +dependencies = [ + "ppv-lite86", + "rand_core 0.9.3", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom 0.2.16", ] [[package]] @@ -1005,6 +1415,35 @@ version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38" +[[package]] +name = "rand_hc" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b363d4f6370f88d62bf586c80405657bde0f0e1b8945d47d2ad59b906cb4f54" +dependencies = [ + "rand_core 0.6.4", +] + +[[package]] +name = "rayon" +version = "1.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "368f01d005bf8fd9b1206fb6fa653e6c4a81ceb1466406b81792d87c5677a58f" +dependencies = [ + "either", + "rayon-core", +] + +[[package]] +name = "rayon-core" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22e18b0f0062d30d4230b2e85ff77fdfe4326feb054b9783a3460d8435c8ab91" +dependencies = [ + "crossbeam-deque", + "crossbeam-utils", +] + [[package]] name = "redox_syscall" version = "0.5.14" @@ -1016,13 +1455,13 @@ dependencies = [ [[package]] name = "regex" -version = "1.11.1" +version = "1.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191" +checksum = "843bc0191f75f3e22651ae5f1e72939ab2f72a4bc30fa80a066bd66edefc24d4" dependencies = [ "aho-corasick", "memchr", - "regex-automata 0.4.9", + "regex-automata 0.4.13", "regex-syntax 0.8.5", ] @@ -1037,9 +1476,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.9" +version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908" +checksum = "5276caf25ac86c8d810222b3dbb938e512c55c6831a10f3e6ed1c93b84041f1c" dependencies = [ "aho-corasick", "memchr", @@ -1058,6 +1497,16 @@ version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" +[[package]] +name = "rfc6979" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dd2a808d456c4a54e300a23e9f5a67e122c3024119acbfd73e3bf664491cb2" +dependencies = [ + "hmac", + "subtle", +] + [[package]] name = "rustc_version" version = "0.2.3" @@ -1109,6 +1558,20 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" +[[package]] +name = "sec1" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" +dependencies = [ + "base16ct", + "der", + "generic-array", + "pkcs8", + "subtle", + "zeroize", +] + [[package]] name = "semver" version = "0.9.0" @@ -1183,6 +1646,17 @@ dependencies = [ "serde", ] +[[package]] +name = "sha2" +version = "0.10.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + [[package]] name = "sha3" version = "0.10.8" @@ -1208,6 +1682,16 @@ version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" +[[package]] +name = "signature" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" +dependencies = [ + "digest", + "rand_core 0.6.4", +] + [[package]] name = "siphasher" version = "1.0.1" @@ -1231,6 +1715,19 @@ name = "spin" version = "0.9.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" +dependencies = [ + "lock_api", +] + +[[package]] +name = "spki" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d" +dependencies = [ + "base64ct", + "der", +] [[package]] name = "string_cache" @@ -1253,6 +1750,12 @@ dependencies = [ "vte", ] +[[package]] +name = "subtle" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" + [[package]] name = "syn" version = "2.0.106" @@ -1328,6 +1831,15 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "tokio" +version = "1.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff360e02eab121e0bc37a2d3b4d4dc622e6eda3a8e5253d5435ecf5bd4c68408" +dependencies = [ + "pin-project-lite", +] + [[package]] name = "toml" version = "0.8.23" @@ -1522,6 +2034,16 @@ version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" +[[package]] +name = "universal-hash" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc1de2c688dc15305988b563c3854064043356019f97a4b46276fe734c4f07ea" +dependencies = [ + "crypto-common", + "subtle", +] + [[package]] name = "valuable" version = "0.1.1" @@ -1553,6 +2075,12 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "wasi" +version = "0.11.1+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" + [[package]] name = "wasi" version = "0.14.2+wasi-0.2.4" @@ -2062,3 +2590,39 @@ dependencies = [ "unicode-xid", "wasmparser", ] + +[[package]] +name = "x25519-dalek" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7e468321c81fb07fa7f4c636c3972b9100f0346e5b6a9f2bd0603a52f7ed277" +dependencies = [ + "curve25519-dalek", + "rand_core 0.6.4", +] + +[[package]] +name = "zerocopy" +version = "0.8.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0894878a5fa3edfd6da3f88c4805f4c8558e2b996227a3d864f47fe11e38282c" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.8.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88d2b8d9c68ad2b9e4340d7832716a4d21a22a1154777ad56ea55c51a9cf3831" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "zeroize" +version = "1.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b97154e67e32c85465826e8bcc1c59429aaaf107c1e4a9e53c8d8ccd5eff88d0" diff --git a/examples/p2id-note/Cargo.lock b/examples/p2id-note/Cargo.lock index b79abeaee..009599686 100644 --- a/examples/p2id-note/Cargo.lock +++ b/examples/p2id-note/Cargo.lock @@ -2,6 +2,16 @@ # It is not intended for manual editing. version = 4 +[[package]] +name = "aead" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d122413f284cf2d62fb1b7db97e02edb8cda96d769b16e443a4f6195e35662b0" +dependencies = [ + "crypto-common", + "generic-array", +] + [[package]] name = "aho-corasick" version = "1.1.3" @@ -44,6 +54,18 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" +[[package]] +name = "base16ct" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" + +[[package]] +name = "base64ct" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55248b47b0caf0546f7988906588779981c43bb1bc9d0c44087278f80cdb44ba" + [[package]] name = "bech32" version = "0.11.0" @@ -114,6 +136,47 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9555578bc9e57714c812a1f84e4fc5b4d21fcb063490c624de019f7464c91268" +[[package]] +name = "chacha20" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3613f74bd2eac03dad61bd53dbe620703d4371614fe0bc3b9f04dd36fe4e818" +dependencies = [ + "cfg-if", + "cipher", + "cpufeatures", +] + +[[package]] +name = "chacha20poly1305" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10cd79432192d1c0f4e1a0fef9527696cc039165d729fb41b3f4f4f354c2dc35" +dependencies = [ + "aead", + "chacha20", + "cipher", + "poly1305", + "zeroize", +] + +[[package]] +name = "cipher" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" +dependencies = [ + "crypto-common", + "inout", + "zeroize", +] + +[[package]] +name = "const-oid" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" + [[package]] name = "constant_time_eq" version = "0.3.1" @@ -129,6 +192,43 @@ dependencies = [ "libc", ] +[[package]] +name = "crossbeam-deque" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9dd111b7b7f7d55b72c0a6ae361660ee5853c9af73f70c3c2ef6858b950e2e51" +dependencies = [ + "crossbeam-epoch", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.9.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" + +[[package]] +name = "crypto-bigint" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76" +dependencies = [ + "generic-array", + "rand_core 0.6.4", + "subtle", + "zeroize", +] + [[package]] name = "crypto-common" version = "0.1.6" @@ -136,9 +236,47 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" dependencies = [ "generic-array", + "rand_core 0.6.4", "typenum", ] +[[package]] +name = "curve25519-dalek" +version = "4.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97fb8b7c4503de7d6ae7b42ab72a5a59857b4c937ec27a3d4539dba95b5ab2be" +dependencies = [ + "cfg-if", + "cpufeatures", + "curve25519-dalek-derive", + "digest", + "fiat-crypto", + "rustc_version 0.4.1", + "subtle", + "zeroize", +] + +[[package]] +name = "curve25519-dalek-derive" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "der" +version = "0.7.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7c1832837b905bbfb5101e07cc24c8deddf52f93225eee6ead5f4d63d53ddcb" +dependencies = [ + "const-oid", + "zeroize", +] + [[package]] name = "derive_more" version = "2.0.1" @@ -166,7 +304,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ "block-buffer", + "const-oid", "crypto-common", + "subtle", ] [[package]] @@ -175,12 +315,70 @@ version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8975ffdaa0ef3661bfe02dbdcc06c9f829dfafe6a3c474de366a8d5e44276921" +[[package]] +name = "ecdsa" +version = "0.16.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee27f32b5c5292967d2d4a9d7f1e0b0aed2c15daded5a60300e4abb9d8020bca" +dependencies = [ + "der", + "digest", + "elliptic-curve", + "rfc6979", + "signature", + "spki", +] + +[[package]] +name = "ed25519" +version = "2.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "115531babc129696a58c64a4fef0a8bf9e9698629fb97e9e40767d235cfbcd53" +dependencies = [ + "pkcs8", + "signature", +] + +[[package]] +name = "ed25519-dalek" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70e796c081cee67dc755e1a36a0a172b897fab85fc3f6bc48307991f64e4eca9" +dependencies = [ + "curve25519-dalek", + "ed25519", + "serde", + "sha2", + "subtle", + "zeroize", +] + [[package]] name = "either" version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719" +[[package]] +name = "elliptic-curve" +version = "0.13.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47" +dependencies = [ + "base16ct", + "crypto-bigint", + "digest", + "ff", + "generic-array", + "group", + "hkdf", + "pkcs8", + "rand_core 0.6.4", + "sec1", + "subtle", + "zeroize", +] + [[package]] name = "ena" version = "0.14.3" @@ -190,18 +388,58 @@ dependencies = [ "log", ] +[[package]] +name = "enum_dispatch" +version = "0.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa18ce2bc66555b3218614519ac839ddb759a7d6720732f979ef8d13be147ecd" +dependencies = [ + "once_cell", + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "equivalent" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" +[[package]] +name = "ff" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0b50bfb653653f9ca9095b427bed08ab8d75a137839d9ad64eb11810d5b6393" +dependencies = [ + "rand_core 0.6.4", + "subtle", +] + +[[package]] +name = "fiat-crypto" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28dea519a9695b9977216879a3ebfddf92f1c08c05d984f8996aecd6ecdc811d" + [[package]] name = "fixedbitset" version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1d674e81391d1e1ab681a28d99df07927c6d4aa5b027d7da16ba32d1d21ecd99" +[[package]] +name = "flume" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da0e4dd2a88388a1f4ccc7c9ce104604dab68d9f408dc34cd45823d5a9069095" +dependencies = [ + "futures-core", + "futures-sink", + "nanorand", + "spin", +] + [[package]] name = "foldhash" version = "0.1.5" @@ -291,6 +529,20 @@ checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" dependencies = [ "typenum", "version_check", + "zeroize", +] + +[[package]] +name = "getrandom" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "335ff9f135e4384c8150d6f27c6daed433577f86b4750418338c01a1a2528592" +dependencies = [ + "cfg-if", + "js-sys", + "libc", + "wasi 0.11.1+wasi-snapshot-preview1", + "wasm-bindgen", ] [[package]] @@ -303,7 +555,7 @@ dependencies = [ "js-sys", "libc", "r-efi", - "wasi", + "wasi 0.14.2+wasi-0.2.4", "wasm-bindgen", ] @@ -313,6 +565,17 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a8d1add55171497b4705a648c6b583acafb01d58050a51727785f0b2c8e0a2b2" +[[package]] +name = "group" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" +dependencies = [ + "ff", + "rand_core 0.6.4", + "subtle", +] + [[package]] name = "hashbrown" version = "0.15.4" @@ -328,6 +591,24 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" +[[package]] +name = "hkdf" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b5f8eb2ad728638ea2c7d47a21db23b7b58a72ed6a38256b8a1849f15fbbdf7" +dependencies = [ + "hmac", +] + +[[package]] +name = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest", +] + [[package]] name = "id-arena" version = "2.2.1" @@ -351,6 +632,15 @@ dependencies = [ "serde", ] +[[package]] +name = "inout" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "879f10e63c20629ecabbb64a8010319738c66a5cd0c29b02d63d272b03751d01" +dependencies = [ + "generic-array", +] + [[package]] name = "itertools" version = "0.14.0" @@ -376,6 +666,20 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "k256" +version = "0.13.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6e3919bbaa2945715f0bb6d3934a173d1e9a59ac23767fbaaef277265a7411b" +dependencies = [ + "cfg-if", + "ecdsa", + "elliptic-curve", + "once_cell", + "sha2", + "signature", +] + [[package]] name = "keccak" version = "0.1.5" @@ -496,11 +800,12 @@ dependencies = [ [[package]] name = "miden-air" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db750ce0c58f51ba786c7391f392c4b77e0c83a44c5096672d4d0270d3cc7763" +checksum = "06acfd2ddc25b68f9d23d2add3f15c0ec3f9890ce6418409d71bea9dc6590bd0" dependencies = [ "miden-core", + "miden-utils-indexing", "thiserror", "winter-air", "winter-prover", @@ -508,9 +813,9 @@ dependencies = [ [[package]] name = "miden-assembly" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82575d8479aad3966be3defdc17911264bfdc99f9a7bb185180eec57c6bda9f5" +checksum = "d1219b9e48bb286b58a23bb65cf74baa1b24ddbcb462ca625b38186674571047" dependencies = [ "log", "miden-assembly-syntax", @@ -522,9 +827,9 @@ dependencies = [ [[package]] name = "miden-assembly-syntax" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7b3588ce15920c0bff47e8bf8c6ca9e0a7a539ff93014cb5ec3c665f60bc0f1" +checksum = "1eeaef2853061c54527bb2664c0c832ce3d1f80847c79512455fec3b93057f2a" dependencies = [ "aho-corasick", "lalrpop", @@ -572,13 +877,15 @@ dependencies = [ [[package]] name = "miden-core" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "571a943a923e5fb3f1bed534f41a1542c531ad2aec87dc0d5699af1709fbcea6" +checksum = "452a00429d05c416001ec0578291eb88e115cf94fc22b3308267abfdcd813440" dependencies = [ + "enum_dispatch", "miden-crypto", "miden-debug-types", "miden-formatting", + "miden-utils-indexing", "num-derive", "num-traits", "thiserror", @@ -588,33 +895,54 @@ dependencies = [ [[package]] name = "miden-crypto" -version = "0.15.9" +version = "0.18.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4329275a11c7d8328b14a7129b21d40183056dcd0d871c3069be6e550d6ca40" +checksum = "7eb82051002f9c64878d3b105a7b924de1ee92019231923380cf4ecd7b824f9a" dependencies = [ "blake3", + "chacha20poly1305", + "ed25519-dalek", + "flume", "glob", + "hkdf", + "k256", + "miden-crypto-derive", "num", "num-complex", "rand", - "rand_core", + "rand_chacha", + "rand_core 0.9.3", + "rand_hc", "sha3", + "subtle", "thiserror", "winter-crypto", "winter-math", "winter-utils", + "x25519-dalek", +] + +[[package]] +name = "miden-crypto-derive" +version = "0.18.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2222f37355ea975f40acd3c098a437574a31a4d8a2c193cf4e9fead2beede577" +dependencies = [ + "quote", + "syn", ] [[package]] name = "miden-debug-types" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93a4b53092da70aa4c9b75acc85e1c7b4d8202ce89487d2271ebdc2defcb08d6" +checksum = "97eed62ac0ca7420e49148fd306c74786b23a8d31df6da6277c671ba3e5c619a" dependencies = [ "memchr", "miden-crypto", "miden-formatting", "miden-miette", + "miden-utils-indexing", "miden-utils-sync", "paste", "thiserror", @@ -631,13 +959,14 @@ dependencies = [ [[package]] name = "miden-mast-package" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57efbfaea75eeb07d448c04aefce241bf8f23ea11600a669d897280551819992" +checksum = "1d13e6ba2b357551598f13396ed52f8f21aa99979aa3b338bb5521feeda19c8a" dependencies = [ "derive_more", "miden-assembly-syntax", "miden-core", + "thiserror", ] [[package]] @@ -678,33 +1007,41 @@ dependencies = [ [[package]] name = "miden-objects" -version = "0.11.2" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a16bce60bda18cfeaa49e99e35307c6f45297bfe2f0e18c009fa356edd552e70" +checksum = "0ef49472012d00be68f68dcbb13b4f28867fb6271c76c014bc555ef6e8e0958a" dependencies = [ "bech32", - "getrandom", + "getrandom 0.3.3", "miden-assembly", + "miden-assembly-syntax", "miden-core", "miden-crypto", + "miden-mast-package", "miden-processor", "miden-utils-sync", "miden-verifier", + "rand", "semver 1.0.26", "thiserror", ] [[package]] name = "miden-processor" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3c033f51b575b5a70b763dc0bc05062b6562a8286c6d0c144eaff92da8f214f" +checksum = "d2ef77929651b8755965cde8f589bd38e2345a619d54cab6427f91aa23c47f6a" dependencies = [ + "itertools", "miden-air", "miden-core", "miden-debug-types", "miden-utils-diagnostics", + "miden-utils-indexing", + "paste", + "rayon", "thiserror", + "tokio", "tracing", "winter-prover", ] @@ -719,9 +1056,9 @@ version = "0.7.0" [[package]] name = "miden-utils-diagnostics" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d640d80ce3438275b13d0d400901e5bbf3179737818d91d4e84f747a480fd8b" +checksum = "1a3ff4c019d96539a7066626efb4dce5c9fb7b0e44e961b0c2571e78f34236d5" dependencies = [ "miden-crypto", "miden-debug-types", @@ -730,11 +1067,20 @@ dependencies = [ "tracing", ] +[[package]] +name = "miden-utils-indexing" +version = "0.19.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c798250bee4e856d4f18c161e91cdcbef1906f6614d00cf0063b47031c0f8cc6" +dependencies = [ + "thiserror", +] + [[package]] name = "miden-utils-sync" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccf49e1fbfefeb58de992767ae7b0b6200885e342f4dd43c510daefce9539b95" +checksum = "feebe7d896c013ea74dbc98de978836606356a044d4ed3b61ded54d3b319d89f" dependencies = [ "lock_api", "loom", @@ -742,9 +1088,9 @@ dependencies = [ [[package]] name = "miden-verifier" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3104dce8b4668639aa97aa748a98aab0ea33c103e06ef5c3fd12445ab3bd2387" +checksum = "b8f8e47b78bba1fe1b31faee8f12aafd95385f6d6a8b108b03e92f5d743bb29f" dependencies = [ "miden-air", "miden-core", @@ -755,15 +1101,24 @@ dependencies = [ [[package]] name = "midenc-hir-type" -version = "0.1.5" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e381ba23e4f57ffa0d6039113f6d6004e5b8c7ae6cb909329b48f2ab525e8680" +checksum = "9d4cfab04baffdda3fb9eafa5f873604059b89a1699aa95e4f1057397a69f0b5" dependencies = [ "miden-formatting", "smallvec", "thiserror", ] +[[package]] +name = "nanorand" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a51313c5820b0b02bd422f4b44776fbf47961755c74ce64afc73bfad10226c3" +dependencies = [ + "getrandom 0.2.16", +] + [[package]] name = "new_debug_unreachable" version = "1.0.6" @@ -871,6 +1226,12 @@ version = "1.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" +[[package]] +name = "opaque-debug" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381" + [[package]] name = "overload" version = "0.1.1" @@ -950,6 +1311,36 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" +[[package]] +name = "pkcs8" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" +dependencies = [ + "der", + "spki", +] + +[[package]] +name = "poly1305" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8159bd90725d2df49889a078b54f4f79e87f1f8a8444194cdca81d38f5393abf" +dependencies = [ + "cpufeatures", + "opaque-debug", + "universal-hash", +] + +[[package]] +name = "ppv-lite86" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" +dependencies = [ + "zerocopy", +] + [[package]] name = "precomputed-hash" version = "0.1.1" @@ -996,7 +1387,26 @@ version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1" dependencies = [ - "rand_core", + "rand_core 0.9.3", +] + +[[package]] +name = "rand_chacha" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb" +dependencies = [ + "ppv-lite86", + "rand_core 0.9.3", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom 0.2.16", ] [[package]] @@ -1005,6 +1415,35 @@ version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38" +[[package]] +name = "rand_hc" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b363d4f6370f88d62bf586c80405657bde0f0e1b8945d47d2ad59b906cb4f54" +dependencies = [ + "rand_core 0.6.4", +] + +[[package]] +name = "rayon" +version = "1.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "368f01d005bf8fd9b1206fb6fa653e6c4a81ceb1466406b81792d87c5677a58f" +dependencies = [ + "either", + "rayon-core", +] + +[[package]] +name = "rayon-core" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22e18b0f0062d30d4230b2e85ff77fdfe4326feb054b9783a3460d8435c8ab91" +dependencies = [ + "crossbeam-deque", + "crossbeam-utils", +] + [[package]] name = "redox_syscall" version = "0.5.14" @@ -1016,13 +1455,13 @@ dependencies = [ [[package]] name = "regex" -version = "1.11.1" +version = "1.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191" +checksum = "843bc0191f75f3e22651ae5f1e72939ab2f72a4bc30fa80a066bd66edefc24d4" dependencies = [ "aho-corasick", "memchr", - "regex-automata 0.4.9", + "regex-automata 0.4.13", "regex-syntax 0.8.5", ] @@ -1037,9 +1476,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.9" +version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908" +checksum = "5276caf25ac86c8d810222b3dbb938e512c55c6831a10f3e6ed1c93b84041f1c" dependencies = [ "aho-corasick", "memchr", @@ -1058,6 +1497,16 @@ version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" +[[package]] +name = "rfc6979" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dd2a808d456c4a54e300a23e9f5a67e122c3024119acbfd73e3bf664491cb2" +dependencies = [ + "hmac", + "subtle", +] + [[package]] name = "rustc_version" version = "0.2.3" @@ -1109,6 +1558,20 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" +[[package]] +name = "sec1" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" +dependencies = [ + "base16ct", + "der", + "generic-array", + "pkcs8", + "subtle", + "zeroize", +] + [[package]] name = "semver" version = "0.9.0" @@ -1183,6 +1646,17 @@ dependencies = [ "serde", ] +[[package]] +name = "sha2" +version = "0.10.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + [[package]] name = "sha3" version = "0.10.8" @@ -1208,6 +1682,16 @@ version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" +[[package]] +name = "signature" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" +dependencies = [ + "digest", + "rand_core 0.6.4", +] + [[package]] name = "siphasher" version = "1.0.1" @@ -1231,6 +1715,19 @@ name = "spin" version = "0.9.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" +dependencies = [ + "lock_api", +] + +[[package]] +name = "spki" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d" +dependencies = [ + "base64ct", + "der", +] [[package]] name = "string_cache" @@ -1253,6 +1750,12 @@ dependencies = [ "vte", ] +[[package]] +name = "subtle" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" + [[package]] name = "syn" version = "2.0.106" @@ -1328,6 +1831,15 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "tokio" +version = "1.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff360e02eab121e0bc37a2d3b4d4dc622e6eda3a8e5253d5435ecf5bd4c68408" +dependencies = [ + "pin-project-lite", +] + [[package]] name = "toml" version = "0.8.23" @@ -1522,6 +2034,16 @@ version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" +[[package]] +name = "universal-hash" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc1de2c688dc15305988b563c3854064043356019f97a4b46276fe734c4f07ea" +dependencies = [ + "crypto-common", + "subtle", +] + [[package]] name = "valuable" version = "0.1.1" @@ -1553,6 +2075,12 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "wasi" +version = "0.11.1+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" + [[package]] name = "wasi" version = "0.14.2+wasi-0.2.4" @@ -2062,3 +2590,39 @@ dependencies = [ "unicode-xid", "wasmparser", ] + +[[package]] +name = "x25519-dalek" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7e468321c81fb07fa7f4c636c3972b9100f0346e5b6a9f2bd0603a52f7ed277" +dependencies = [ + "curve25519-dalek", + "rand_core 0.6.4", +] + +[[package]] +name = "zerocopy" +version = "0.8.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0894878a5fa3edfd6da3f88c4805f4c8558e2b996227a3d864f47fe11e38282c" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.8.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88d2b8d9c68ad2b9e4340d7832716a4d21a22a1154777ad56ea55c51a9cf3831" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "zeroize" +version = "1.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b97154e67e32c85465826e8bcc1c59429aaaf107c1e4a9e53c8d8ccd5eff88d0" diff --git a/examples/p2id-note/src/lib.rs b/examples/p2id-note/src/lib.rs index 0d6886ab9..a05e577bb 100644 --- a/examples/p2id-note/src/lib.rs +++ b/examples/p2id-note/src/lib.rs @@ -13,7 +13,7 @@ use crate::bindings::miden::basic_wallet::basic_wallet::receive_asset; #[note_script] fn run(_arg: Word) { - let inputs = note::get_inputs(); + let inputs = active_note::get_inputs(); let target_account_id_prefix = inputs[0]; let target_account_id_suffix = inputs[1]; @@ -21,7 +21,7 @@ fn run(_arg: Word) { let current_account = account::get_id(); assert_eq!(current_account, target_account); - let assets = note::get_assets(); + let assets = active_note::get_assets(); for asset in assets { receive_asset(asset); } diff --git a/examples/storage-example/Cargo.lock b/examples/storage-example/Cargo.lock index 491a2c1f6..137d8dd2a 100644 --- a/examples/storage-example/Cargo.lock +++ b/examples/storage-example/Cargo.lock @@ -2,6 +2,16 @@ # It is not intended for manual editing. version = 4 +[[package]] +name = "aead" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d122413f284cf2d62fb1b7db97e02edb8cda96d769b16e443a4f6195e35662b0" +dependencies = [ + "crypto-common", + "generic-array", +] + [[package]] name = "aho-corasick" version = "1.1.3" @@ -44,6 +54,18 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" +[[package]] +name = "base16ct" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" + +[[package]] +name = "base64ct" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55248b47b0caf0546f7988906588779981c43bb1bc9d0c44087278f80cdb44ba" + [[package]] name = "bech32" version = "0.11.0" @@ -114,6 +136,47 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9555578bc9e57714c812a1f84e4fc5b4d21fcb063490c624de019f7464c91268" +[[package]] +name = "chacha20" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3613f74bd2eac03dad61bd53dbe620703d4371614fe0bc3b9f04dd36fe4e818" +dependencies = [ + "cfg-if", + "cipher", + "cpufeatures", +] + +[[package]] +name = "chacha20poly1305" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10cd79432192d1c0f4e1a0fef9527696cc039165d729fb41b3f4f4f354c2dc35" +dependencies = [ + "aead", + "chacha20", + "cipher", + "poly1305", + "zeroize", +] + +[[package]] +name = "cipher" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" +dependencies = [ + "crypto-common", + "inout", + "zeroize", +] + +[[package]] +name = "const-oid" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" + [[package]] name = "constant_time_eq" version = "0.3.1" @@ -129,6 +192,43 @@ dependencies = [ "libc", ] +[[package]] +name = "crossbeam-deque" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9dd111b7b7f7d55b72c0a6ae361660ee5853c9af73f70c3c2ef6858b950e2e51" +dependencies = [ + "crossbeam-epoch", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.9.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" + +[[package]] +name = "crypto-bigint" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76" +dependencies = [ + "generic-array", + "rand_core 0.6.4", + "subtle", + "zeroize", +] + [[package]] name = "crypto-common" version = "0.1.6" @@ -136,9 +236,47 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" dependencies = [ "generic-array", + "rand_core 0.6.4", "typenum", ] +[[package]] +name = "curve25519-dalek" +version = "4.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97fb8b7c4503de7d6ae7b42ab72a5a59857b4c937ec27a3d4539dba95b5ab2be" +dependencies = [ + "cfg-if", + "cpufeatures", + "curve25519-dalek-derive", + "digest", + "fiat-crypto", + "rustc_version 0.4.1", + "subtle", + "zeroize", +] + +[[package]] +name = "curve25519-dalek-derive" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "der" +version = "0.7.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7c1832837b905bbfb5101e07cc24c8deddf52f93225eee6ead5f4d63d53ddcb" +dependencies = [ + "const-oid", + "zeroize", +] + [[package]] name = "derive_more" version = "2.0.1" @@ -166,7 +304,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ "block-buffer", + "const-oid", "crypto-common", + "subtle", ] [[package]] @@ -175,12 +315,70 @@ version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8975ffdaa0ef3661bfe02dbdcc06c9f829dfafe6a3c474de366a8d5e44276921" +[[package]] +name = "ecdsa" +version = "0.16.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee27f32b5c5292967d2d4a9d7f1e0b0aed2c15daded5a60300e4abb9d8020bca" +dependencies = [ + "der", + "digest", + "elliptic-curve", + "rfc6979", + "signature", + "spki", +] + +[[package]] +name = "ed25519" +version = "2.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "115531babc129696a58c64a4fef0a8bf9e9698629fb97e9e40767d235cfbcd53" +dependencies = [ + "pkcs8", + "signature", +] + +[[package]] +name = "ed25519-dalek" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70e796c081cee67dc755e1a36a0a172b897fab85fc3f6bc48307991f64e4eca9" +dependencies = [ + "curve25519-dalek", + "ed25519", + "serde", + "sha2", + "subtle", + "zeroize", +] + [[package]] name = "either" version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719" +[[package]] +name = "elliptic-curve" +version = "0.13.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47" +dependencies = [ + "base16ct", + "crypto-bigint", + "digest", + "ff", + "generic-array", + "group", + "hkdf", + "pkcs8", + "rand_core 0.6.4", + "sec1", + "subtle", + "zeroize", +] + [[package]] name = "ena" version = "0.14.3" @@ -190,18 +388,58 @@ dependencies = [ "log", ] +[[package]] +name = "enum_dispatch" +version = "0.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa18ce2bc66555b3218614519ac839ddb759a7d6720732f979ef8d13be147ecd" +dependencies = [ + "once_cell", + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "equivalent" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" +[[package]] +name = "ff" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0b50bfb653653f9ca9095b427bed08ab8d75a137839d9ad64eb11810d5b6393" +dependencies = [ + "rand_core 0.6.4", + "subtle", +] + +[[package]] +name = "fiat-crypto" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28dea519a9695b9977216879a3ebfddf92f1c08c05d984f8996aecd6ecdc811d" + [[package]] name = "fixedbitset" version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1d674e81391d1e1ab681a28d99df07927c6d4aa5b027d7da16ba32d1d21ecd99" +[[package]] +name = "flume" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da0e4dd2a88388a1f4ccc7c9ce104604dab68d9f408dc34cd45823d5a9069095" +dependencies = [ + "futures-core", + "futures-sink", + "nanorand", + "spin", +] + [[package]] name = "foldhash" version = "0.1.5" @@ -291,6 +529,20 @@ checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" dependencies = [ "typenum", "version_check", + "zeroize", +] + +[[package]] +name = "getrandom" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "335ff9f135e4384c8150d6f27c6daed433577f86b4750418338c01a1a2528592" +dependencies = [ + "cfg-if", + "js-sys", + "libc", + "wasi 0.11.1+wasi-snapshot-preview1", + "wasm-bindgen", ] [[package]] @@ -303,7 +555,7 @@ dependencies = [ "js-sys", "libc", "r-efi", - "wasi", + "wasi 0.14.2+wasi-0.2.4", "wasm-bindgen", ] @@ -313,6 +565,17 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a8d1add55171497b4705a648c6b583acafb01d58050a51727785f0b2c8e0a2b2" +[[package]] +name = "group" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" +dependencies = [ + "ff", + "rand_core 0.6.4", + "subtle", +] + [[package]] name = "hashbrown" version = "0.15.4" @@ -328,6 +591,24 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" +[[package]] +name = "hkdf" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b5f8eb2ad728638ea2c7d47a21db23b7b58a72ed6a38256b8a1849f15fbbdf7" +dependencies = [ + "hmac", +] + +[[package]] +name = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest", +] + [[package]] name = "id-arena" version = "2.2.1" @@ -351,6 +632,15 @@ dependencies = [ "serde", ] +[[package]] +name = "inout" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "879f10e63c20629ecabbb64a8010319738c66a5cd0c29b02d63d272b03751d01" +dependencies = [ + "generic-array", +] + [[package]] name = "itertools" version = "0.14.0" @@ -376,6 +666,20 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "k256" +version = "0.13.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6e3919bbaa2945715f0bb6d3934a173d1e9a59ac23767fbaaef277265a7411b" +dependencies = [ + "cfg-if", + "ecdsa", + "elliptic-curve", + "once_cell", + "sha2", + "signature", +] + [[package]] name = "keccak" version = "0.1.5" @@ -496,11 +800,12 @@ dependencies = [ [[package]] name = "miden-air" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db750ce0c58f51ba786c7391f392c4b77e0c83a44c5096672d4d0270d3cc7763" +checksum = "06acfd2ddc25b68f9d23d2add3f15c0ec3f9890ce6418409d71bea9dc6590bd0" dependencies = [ "miden-core", + "miden-utils-indexing", "thiserror", "winter-air", "winter-prover", @@ -508,9 +813,9 @@ dependencies = [ [[package]] name = "miden-assembly" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82575d8479aad3966be3defdc17911264bfdc99f9a7bb185180eec57c6bda9f5" +checksum = "d1219b9e48bb286b58a23bb65cf74baa1b24ddbcb462ca625b38186674571047" dependencies = [ "log", "miden-assembly-syntax", @@ -522,9 +827,9 @@ dependencies = [ [[package]] name = "miden-assembly-syntax" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7b3588ce15920c0bff47e8bf8c6ca9e0a7a539ff93014cb5ec3c665f60bc0f1" +checksum = "1eeaef2853061c54527bb2664c0c832ce3d1f80847c79512455fec3b93057f2a" dependencies = [ "aho-corasick", "lalrpop", @@ -572,13 +877,15 @@ dependencies = [ [[package]] name = "miden-core" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "571a943a923e5fb3f1bed534f41a1542c531ad2aec87dc0d5699af1709fbcea6" +checksum = "452a00429d05c416001ec0578291eb88e115cf94fc22b3308267abfdcd813440" dependencies = [ + "enum_dispatch", "miden-crypto", "miden-debug-types", "miden-formatting", + "miden-utils-indexing", "num-derive", "num-traits", "thiserror", @@ -588,33 +895,54 @@ dependencies = [ [[package]] name = "miden-crypto" -version = "0.15.9" +version = "0.18.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4329275a11c7d8328b14a7129b21d40183056dcd0d871c3069be6e550d6ca40" +checksum = "7eb82051002f9c64878d3b105a7b924de1ee92019231923380cf4ecd7b824f9a" dependencies = [ "blake3", + "chacha20poly1305", + "ed25519-dalek", + "flume", "glob", + "hkdf", + "k256", + "miden-crypto-derive", "num", "num-complex", "rand", - "rand_core", + "rand_chacha", + "rand_core 0.9.3", + "rand_hc", "sha3", + "subtle", "thiserror", "winter-crypto", "winter-math", "winter-utils", + "x25519-dalek", +] + +[[package]] +name = "miden-crypto-derive" +version = "0.18.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2222f37355ea975f40acd3c098a437574a31a4d8a2c193cf4e9fead2beede577" +dependencies = [ + "quote", + "syn", ] [[package]] name = "miden-debug-types" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93a4b53092da70aa4c9b75acc85e1c7b4d8202ce89487d2271ebdc2defcb08d6" +checksum = "97eed62ac0ca7420e49148fd306c74786b23a8d31df6da6277c671ba3e5c619a" dependencies = [ "memchr", "miden-crypto", "miden-formatting", "miden-miette", + "miden-utils-indexing", "miden-utils-sync", "paste", "thiserror", @@ -631,13 +959,14 @@ dependencies = [ [[package]] name = "miden-mast-package" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57efbfaea75eeb07d448c04aefce241bf8f23ea11600a669d897280551819992" +checksum = "1d13e6ba2b357551598f13396ed52f8f21aa99979aa3b338bb5521feeda19c8a" dependencies = [ "derive_more", "miden-assembly-syntax", "miden-core", + "thiserror", ] [[package]] @@ -678,33 +1007,41 @@ dependencies = [ [[package]] name = "miden-objects" -version = "0.11.2" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a16bce60bda18cfeaa49e99e35307c6f45297bfe2f0e18c009fa356edd552e70" +checksum = "0ef49472012d00be68f68dcbb13b4f28867fb6271c76c014bc555ef6e8e0958a" dependencies = [ "bech32", - "getrandom", + "getrandom 0.3.3", "miden-assembly", + "miden-assembly-syntax", "miden-core", "miden-crypto", + "miden-mast-package", "miden-processor", "miden-utils-sync", "miden-verifier", + "rand", "semver 1.0.26", "thiserror", ] [[package]] name = "miden-processor" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3c033f51b575b5a70b763dc0bc05062b6562a8286c6d0c144eaff92da8f214f" +checksum = "d2ef77929651b8755965cde8f589bd38e2345a619d54cab6427f91aa23c47f6a" dependencies = [ + "itertools", "miden-air", "miden-core", "miden-debug-types", "miden-utils-diagnostics", + "miden-utils-indexing", + "paste", + "rayon", "thiserror", + "tokio", "tracing", "winter-prover", ] @@ -719,9 +1056,9 @@ version = "0.7.0" [[package]] name = "miden-utils-diagnostics" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d640d80ce3438275b13d0d400901e5bbf3179737818d91d4e84f747a480fd8b" +checksum = "1a3ff4c019d96539a7066626efb4dce5c9fb7b0e44e961b0c2571e78f34236d5" dependencies = [ "miden-crypto", "miden-debug-types", @@ -730,11 +1067,20 @@ dependencies = [ "tracing", ] +[[package]] +name = "miden-utils-indexing" +version = "0.19.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c798250bee4e856d4f18c161e91cdcbef1906f6614d00cf0063b47031c0f8cc6" +dependencies = [ + "thiserror", +] + [[package]] name = "miden-utils-sync" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccf49e1fbfefeb58de992767ae7b0b6200885e342f4dd43c510daefce9539b95" +checksum = "feebe7d896c013ea74dbc98de978836606356a044d4ed3b61ded54d3b319d89f" dependencies = [ "lock_api", "loom", @@ -742,9 +1088,9 @@ dependencies = [ [[package]] name = "miden-verifier" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3104dce8b4668639aa97aa748a98aab0ea33c103e06ef5c3fd12445ab3bd2387" +checksum = "b8f8e47b78bba1fe1b31faee8f12aafd95385f6d6a8b108b03e92f5d743bb29f" dependencies = [ "miden-air", "miden-core", @@ -755,15 +1101,24 @@ dependencies = [ [[package]] name = "midenc-hir-type" -version = "0.1.5" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e381ba23e4f57ffa0d6039113f6d6004e5b8c7ae6cb909329b48f2ab525e8680" +checksum = "9d4cfab04baffdda3fb9eafa5f873604059b89a1699aa95e4f1057397a69f0b5" dependencies = [ "miden-formatting", "smallvec", "thiserror", ] +[[package]] +name = "nanorand" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a51313c5820b0b02bd422f4b44776fbf47961755c74ce64afc73bfad10226c3" +dependencies = [ + "getrandom 0.2.16", +] + [[package]] name = "new_debug_unreachable" version = "1.0.6" @@ -871,6 +1226,12 @@ version = "1.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" +[[package]] +name = "opaque-debug" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381" + [[package]] name = "overload" version = "0.1.1" @@ -943,6 +1304,36 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" +[[package]] +name = "pkcs8" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" +dependencies = [ + "der", + "spki", +] + +[[package]] +name = "poly1305" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8159bd90725d2df49889a078b54f4f79e87f1f8a8444194cdca81d38f5393abf" +dependencies = [ + "cpufeatures", + "opaque-debug", + "universal-hash", +] + +[[package]] +name = "ppv-lite86" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" +dependencies = [ + "zerocopy", +] + [[package]] name = "precomputed-hash" version = "0.1.1" @@ -989,7 +1380,26 @@ version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1" dependencies = [ - "rand_core", + "rand_core 0.9.3", +] + +[[package]] +name = "rand_chacha" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb" +dependencies = [ + "ppv-lite86", + "rand_core 0.9.3", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom 0.2.16", ] [[package]] @@ -998,6 +1408,35 @@ version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38" +[[package]] +name = "rand_hc" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b363d4f6370f88d62bf586c80405657bde0f0e1b8945d47d2ad59b906cb4f54" +dependencies = [ + "rand_core 0.6.4", +] + +[[package]] +name = "rayon" +version = "1.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "368f01d005bf8fd9b1206fb6fa653e6c4a81ceb1466406b81792d87c5677a58f" +dependencies = [ + "either", + "rayon-core", +] + +[[package]] +name = "rayon-core" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22e18b0f0062d30d4230b2e85ff77fdfe4326feb054b9783a3460d8435c8ab91" +dependencies = [ + "crossbeam-deque", + "crossbeam-utils", +] + [[package]] name = "redox_syscall" version = "0.5.14" @@ -1009,13 +1448,13 @@ dependencies = [ [[package]] name = "regex" -version = "1.11.1" +version = "1.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191" +checksum = "843bc0191f75f3e22651ae5f1e72939ab2f72a4bc30fa80a066bd66edefc24d4" dependencies = [ "aho-corasick", "memchr", - "regex-automata 0.4.9", + "regex-automata 0.4.13", "regex-syntax 0.8.5", ] @@ -1030,9 +1469,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.9" +version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908" +checksum = "5276caf25ac86c8d810222b3dbb938e512c55c6831a10f3e6ed1c93b84041f1c" dependencies = [ "aho-corasick", "memchr", @@ -1051,6 +1490,16 @@ version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" +[[package]] +name = "rfc6979" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dd2a808d456c4a54e300a23e9f5a67e122c3024119acbfd73e3bf664491cb2" +dependencies = [ + "hmac", + "subtle", +] + [[package]] name = "rustc_version" version = "0.2.3" @@ -1102,6 +1551,20 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" +[[package]] +name = "sec1" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" +dependencies = [ + "base16ct", + "der", + "generic-array", + "pkcs8", + "subtle", + "zeroize", +] + [[package]] name = "semver" version = "0.9.0" @@ -1176,6 +1639,17 @@ dependencies = [ "serde", ] +[[package]] +name = "sha2" +version = "0.10.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + [[package]] name = "sha3" version = "0.10.8" @@ -1201,6 +1675,16 @@ version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" +[[package]] +name = "signature" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" +dependencies = [ + "digest", + "rand_core 0.6.4", +] + [[package]] name = "siphasher" version = "1.0.1" @@ -1224,6 +1708,19 @@ name = "spin" version = "0.9.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" +dependencies = [ + "lock_api", +] + +[[package]] +name = "spki" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d" +dependencies = [ + "base64ct", + "der", +] [[package]] name = "storage-example" @@ -1253,6 +1750,12 @@ dependencies = [ "vte", ] +[[package]] +name = "subtle" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" + [[package]] name = "syn" version = "2.0.106" @@ -1328,6 +1831,15 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "tokio" +version = "1.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff360e02eab121e0bc37a2d3b4d4dc622e6eda3a8e5253d5435ecf5bd4c68408" +dependencies = [ + "pin-project-lite", +] + [[package]] name = "toml" version = "0.8.23" @@ -1522,6 +2034,16 @@ version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" +[[package]] +name = "universal-hash" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc1de2c688dc15305988b563c3854064043356019f97a4b46276fe734c4f07ea" +dependencies = [ + "crypto-common", + "subtle", +] + [[package]] name = "valuable" version = "0.1.1" @@ -1553,6 +2075,12 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "wasi" +version = "0.11.1+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" + [[package]] name = "wasi" version = "0.14.2+wasi-0.2.4" @@ -2062,3 +2590,39 @@ dependencies = [ "unicode-xid", "wasmparser", ] + +[[package]] +name = "x25519-dalek" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7e468321c81fb07fa7f4c636c3972b9100f0346e5b6a9f2bd0603a52f7ed277" +dependencies = [ + "curve25519-dalek", + "rand_core 0.6.4", +] + +[[package]] +name = "zerocopy" +version = "0.8.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0894878a5fa3edfd6da3f88c4805f4c8558e2b996227a3d864f47fe11e38282c" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.8.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88d2b8d9c68ad2b9e4340d7832716a4d21a22a1154777ad56ea55c51a9cf3831" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "zeroize" +version = "1.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b97154e67e32c85465826e8bcc1c59429aaaf107c1e4a9e53c8d8ccd5eff88d0" diff --git a/frontend/wasm/CHANGELOG.md b/frontend/wasm/CHANGELOG.md index 95e332d3f..0331c3472 100644 --- a/frontend/wasm/CHANGELOG.md +++ b/frontend/wasm/CHANGELOG.md @@ -55,7 +55,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed -- `tx:add_asset_to_note` Miden SDK bindings +- `output_note:add_asset` Miden SDK bindings - #631 Aligned data segments overlap the `BumpAlloc` instance - update Miden SDK `AccountId` type and `account::get_id()` for two diff --git a/frontend/wasm/src/miden_abi/transform.rs b/frontend/wasm/src/miden_abi/transform.rs index e5b5d857f..273fa05ce 100644 --- a/frontend/wasm/src/miden_abi/transform.rs +++ b/frontend/wasm/src/miden_abi/transform.rs @@ -71,37 +71,54 @@ fn get_transform_strategy(path: &SymbolPath) -> Option { _ => None, }, symbols::Miden => match components.next()?.as_symbol_name() { - symbols::Account => { + symbols::NativeAccount => { match components.next_if(|c| c.is_leaf())?.as_symbol_name().as_str() { - tx_kernel::account::INCR_NONCE - | tx_kernel::account::GET_NONCE - | tx_kernel::account::GET_BALANCE => Some(TransformStrategy::NoTransform), tx_kernel::account::ADD_ASSET - | tx_kernel::account::GET_ID | tx_kernel::account::REMOVE_ASSET - | tx_kernel::account::GET_INITIAL_COMMITMENT - | tx_kernel::account::COMPUTE_CURRENT_COMMITMENT | tx_kernel::account::COMPUTE_DELTA_COMMITMENT - | tx_kernel::account::GET_STORAGE_ITEM | tx_kernel::account::SET_STORAGE_ITEM - | tx_kernel::account::GET_STORAGE_MAP_ITEM | tx_kernel::account::SET_STORAGE_MAP_ITEM => { Some(TransformStrategy::ReturnViaPointer) } + tx_kernel::account::INCR_NONCE => Some(TransformStrategy::NoTransform), + _ => None, + } + } + symbols::ActiveAccount => { + match components.next_if(|c| c.is_leaf())?.as_symbol_name().as_str() { + tx_kernel::account::GET_NONCE | tx_kernel::account::GET_BALANCE => { + Some(TransformStrategy::NoTransform) + } + tx_kernel::account::GET_ID + | tx_kernel::account::GET_INITIAL_COMMITMENT + | tx_kernel::account::COMPUTE_COMMITMENT + | tx_kernel::account::GET_STORAGE_ITEM + | tx_kernel::account::GET_STORAGE_MAP_ITEM => { + Some(TransformStrategy::ReturnViaPointer) + } + _ => None, + } + } + symbols::ActiveNote => { + match components.next_if(|c| c.is_leaf())?.as_symbol_name().as_str() { + tx_kernel::active_note::GET_INPUTS => Some(TransformStrategy::ListReturn), + tx_kernel::active_note::GET_ASSETS => Some(TransformStrategy::ListReturn), + tx_kernel::active_note::GET_SENDER + | tx_kernel::active_note::GET_SCRIPT_ROOT + | tx_kernel::active_note::GET_SERIAL_NUMBER => { + Some(TransformStrategy::ReturnViaPointer) + } + _ => None, + } + } + symbols::OutputNote => { + match components.next_if(|c| c.is_leaf())?.as_symbol_name().as_str() { + tx_kernel::output_note::CREATE => Some(TransformStrategy::NoTransform), + tx_kernel::output_note::ADD_ASSET => Some(TransformStrategy::NoTransform), _ => None, } } - symbols::Note => match components.next_if(|c| c.is_leaf())?.as_symbol_name().as_str() { - tx_kernel::note::GET_INPUTS => Some(TransformStrategy::ListReturn), - tx_kernel::note::GET_ASSETS => Some(TransformStrategy::ListReturn), - tx_kernel::note::GET_SENDER - | tx_kernel::note::GET_SCRIPT_ROOT - | tx_kernel::note::GET_SERIAL_NUMBER => Some(TransformStrategy::ReturnViaPointer), - _ => None, - }, symbols::Tx => match components.next_if(|c| c.is_leaf())?.as_symbol_name().as_str() { - tx_kernel::tx::CREATE_NOTE => Some(TransformStrategy::NoTransform), - tx_kernel::tx::ADD_ASSET_TO_NOTE => Some(TransformStrategy::ReturnViaPointer), tx_kernel::tx::GET_BLOCK_NUMBER => Some(TransformStrategy::NoTransform), tx_kernel::tx::GET_INPUT_NOTES_COMMITMENT | tx_kernel::tx::GET_OUTPUT_NOTES_COMMITMENT => { diff --git a/frontend/wasm/src/miden_abi/tx_kernel.rs b/frontend/wasm/src/miden_abi/tx_kernel.rs index 6d92e1109..5970912d6 100644 --- a/frontend/wasm/src/miden_abi/tx_kernel.rs +++ b/frontend/wasm/src/miden_abi/tx_kernel.rs @@ -1,7 +1,8 @@ //! Function types and lowering for tx kernel API functions pub(crate) mod account; -pub(crate) mod note; +pub(crate) mod active_note; +pub(crate) mod output_note; pub(crate) mod tx; use midenc_hir_symbol::sync::LazyLock; @@ -12,7 +13,8 @@ pub(crate) fn signatures() -> &'static ModuleFunctionTypeMap { static TYPES: LazyLock = LazyLock::new(|| { let mut m: ModuleFunctionTypeMap = Default::default(); m.extend(account::signatures()); - m.extend(note::signatures()); + m.extend(active_note::signatures()); + m.extend(output_note::signatures()); m.extend(tx::signatures()); m }); diff --git a/frontend/wasm/src/miden_abi/tx_kernel/account.rs b/frontend/wasm/src/miden_abi/tx_kernel/account.rs index 40012c6e6..62de74f21 100644 --- a/frontend/wasm/src/miden_abi/tx_kernel/account.rs +++ b/frontend/wasm/src/miden_abi/tx_kernel/account.rs @@ -6,11 +6,16 @@ use midenc_hir::{ use crate::miden_abi::{FunctionTypeMap, ModuleFunctionTypeMap}; -pub const MODULE_ID: &str = "miden::account"; -pub(crate) const MODULE_PREFIX: &[SymbolNameComponent] = &[ +pub(crate) const NATIVE_MODULE_PREFIX: &[SymbolNameComponent] = &[ SymbolNameComponent::Root, SymbolNameComponent::Component(symbols::Miden), - SymbolNameComponent::Component(symbols::Account), + SymbolNameComponent::Component(symbols::NativeAccount), +]; + +pub(crate) const ACTIVE_MODULE_PREFIX: &[SymbolNameComponent] = &[ + SymbolNameComponent::Root, + SymbolNameComponent::Component(symbols::Miden), + SymbolNameComponent::Component(symbols::ActiveAccount), ]; pub const ADD_ASSET: &str = "add_asset"; @@ -18,7 +23,7 @@ pub const REMOVE_ASSET: &str = "remove_asset"; pub const GET_ID: &str = "get_id"; pub const GET_NONCE: &str = "get_nonce"; pub const GET_INITIAL_COMMITMENT: &str = "get_initial_commitment"; -pub const COMPUTE_CURRENT_COMMITMENT: &str = "compute_current_commitment"; +pub const COMPUTE_COMMITMENT: &str = "compute_commitment"; pub const COMPUTE_DELTA_COMMITMENT: &str = "compute_delta_commitment"; pub const GET_STORAGE_ITEM: &str = "get_item"; pub const SET_STORAGE_ITEM: &str = "set_item"; @@ -29,34 +34,21 @@ pub const GET_BALANCE: &str = "get_balance"; pub(crate) fn signatures() -> ModuleFunctionTypeMap { let mut m: ModuleFunctionTypeMap = Default::default(); - let mut account: FunctionTypeMap = Default::default(); - account.insert( + + let mut native_account: FunctionTypeMap = Default::default(); + native_account.insert( Symbol::from(ADD_ASSET), FunctionType::new(CallConv::Wasm, [Felt, Felt, Felt, Felt], [Felt, Felt, Felt, Felt]), ); - account.insert( + native_account.insert( Symbol::from(REMOVE_ASSET), FunctionType::new(CallConv::Wasm, [Felt, Felt, Felt, Felt], [Felt, Felt, Felt, Felt]), ); - account.insert(Symbol::from(GET_ID), FunctionType::new(CallConv::Wasm, [], [Felt, Felt])); - account.insert(Symbol::from(GET_NONCE), FunctionType::new(CallConv::Wasm, [], [Felt])); - account.insert( - Symbol::from(GET_INITIAL_COMMITMENT), - FunctionType::new(CallConv::Wasm, [], [Felt, Felt, Felt, Felt]), - ); - account.insert( - Symbol::from(COMPUTE_CURRENT_COMMITMENT), - FunctionType::new(CallConv::Wasm, [], [Felt, Felt, Felt, Felt]), - ); - account.insert( + native_account.insert( Symbol::from(COMPUTE_DELTA_COMMITMENT), FunctionType::new(CallConv::Wasm, [], [Felt, Felt, Felt, Felt]), ); - account.insert( - Symbol::from(GET_STORAGE_ITEM), - FunctionType::new(CallConv::Wasm, [Felt], [Felt, Felt, Felt, Felt]), - ); - account.insert( + native_account.insert( Symbol::from(SET_STORAGE_ITEM), FunctionType::new( CallConv::Wasm, @@ -64,11 +56,7 @@ pub(crate) fn signatures() -> ModuleFunctionTypeMap { [Felt, Felt, Felt, Felt, Felt, Felt, Felt, Felt], ), ); - account.insert( - Symbol::from(GET_STORAGE_MAP_ITEM), - FunctionType::new(CallConv::Wasm, [Felt, Felt, Felt, Felt, Felt], [Felt, Felt, Felt, Felt]), - ); - account.insert( + native_account.insert( Symbol::from(SET_STORAGE_MAP_ITEM), FunctionType::new( CallConv::Wasm, @@ -76,11 +64,34 @@ pub(crate) fn signatures() -> ModuleFunctionTypeMap { [Felt, Felt, Felt, Felt, Felt, Felt, Felt, Felt], ), ); - account.insert(Symbol::from(INCR_NONCE), FunctionType::new(CallConv::Wasm, [], [Felt])); - account.insert( + native_account.insert(Symbol::from(INCR_NONCE), FunctionType::new(CallConv::Wasm, [], [Felt])); + m.insert(SymbolPath::from_iter(NATIVE_MODULE_PREFIX.iter().copied()), native_account); + + let mut active_account: FunctionTypeMap = Default::default(); + active_account + .insert(Symbol::from(GET_ID), FunctionType::new(CallConv::Wasm, [], [Felt, Felt])); + active_account.insert(Symbol::from(GET_NONCE), FunctionType::new(CallConv::Wasm, [], [Felt])); + active_account.insert( + Symbol::from(GET_INITIAL_COMMITMENT), + FunctionType::new(CallConv::Wasm, [], [Felt, Felt, Felt, Felt]), + ); + active_account.insert( + Symbol::from(COMPUTE_COMMITMENT), + FunctionType::new(CallConv::Wasm, [], [Felt, Felt, Felt, Felt]), + ); + active_account.insert( + Symbol::from(GET_STORAGE_ITEM), + FunctionType::new(CallConv::Wasm, [Felt], [Felt, Felt, Felt, Felt]), + ); + active_account.insert( + Symbol::from(GET_STORAGE_MAP_ITEM), + FunctionType::new(CallConv::Wasm, [Felt, Felt, Felt, Felt, Felt], [Felt, Felt, Felt, Felt]), + ); + active_account.insert( Symbol::from(GET_BALANCE), FunctionType::new(CallConv::Wasm, [Felt, Felt], [Felt]), ); - m.insert(SymbolPath::from_iter(MODULE_PREFIX.iter().copied()), account); + m.insert(SymbolPath::from_iter(ACTIVE_MODULE_PREFIX.iter().copied()), active_account); + m } diff --git a/frontend/wasm/src/miden_abi/tx_kernel/note.rs b/frontend/wasm/src/miden_abi/tx_kernel/active_note.rs similarity index 92% rename from frontend/wasm/src/miden_abi/tx_kernel/note.rs rename to frontend/wasm/src/miden_abi/tx_kernel/active_note.rs index 75347508f..ee980f362 100644 --- a/frontend/wasm/src/miden_abi/tx_kernel/note.rs +++ b/frontend/wasm/src/miden_abi/tx_kernel/active_note.rs @@ -6,11 +6,11 @@ use midenc_hir::{ use crate::miden_abi::{FunctionTypeMap, ModuleFunctionTypeMap}; -pub const MODULE_ID: &str = "miden::note"; +pub const MODULE_ID: &str = "miden::active_note"; pub(crate) const MODULE_PREFIX: &[SymbolNameComponent] = &[ SymbolNameComponent::Root, SymbolNameComponent::Component(symbols::Miden), - SymbolNameComponent::Component(symbols::Note), + SymbolNameComponent::Component(symbols::ActiveNote), ]; pub const GET_INPUTS: &str = "get_inputs"; diff --git a/frontend/wasm/src/miden_abi/tx_kernel/output_note.rs b/frontend/wasm/src/miden_abi/tx_kernel/output_note.rs new file mode 100644 index 000000000..bc86867f8 --- /dev/null +++ b/frontend/wasm/src/miden_abi/tx_kernel/output_note.rs @@ -0,0 +1,49 @@ +use midenc_hir::{ + interner::{symbols, Symbol}, + CallConv, FunctionType, SymbolNameComponent, SymbolPath, + Type::*, +}; + +use crate::miden_abi::{FunctionTypeMap, ModuleFunctionTypeMap}; + +pub const MODULE_ID: &str = "miden::output_note"; +pub(crate) const MODULE_PREFIX: &[SymbolNameComponent] = &[ + SymbolNameComponent::Root, + SymbolNameComponent::Component(symbols::Miden), + SymbolNameComponent::Component(symbols::OutputNote), +]; + +pub const CREATE: &str = "create"; +pub const ADD_ASSET: &str = "add_asset"; + +pub(crate) fn signatures() -> ModuleFunctionTypeMap { + let mut m: ModuleFunctionTypeMap = Default::default(); + let mut output_note: FunctionTypeMap = Default::default(); + output_note.insert( + Symbol::from(CREATE), + FunctionType::new( + CallConv::Wasm, + [ + Felt, // tag + Felt, // aux + Felt, // note_type + Felt, // execution hint + Felt, Felt, Felt, Felt, // recipient components + ], + [Felt], + ), + ); + output_note.insert( + Symbol::from(ADD_ASSET), + FunctionType::new( + CallConv::Wasm, + [ + Felt, Felt, Felt, Felt, // asset components + Felt, // note_idx + ], + [], + ), + ); + m.insert(SymbolPath::from_iter(MODULE_PREFIX.iter().copied()), output_note); + m +} diff --git a/frontend/wasm/src/miden_abi/tx_kernel/tx.rs b/frontend/wasm/src/miden_abi/tx_kernel/tx.rs index 6fbc0605e..7c3678dbb 100644 --- a/frontend/wasm/src/miden_abi/tx_kernel/tx.rs +++ b/frontend/wasm/src/miden_abi/tx_kernel/tx.rs @@ -13,53 +13,22 @@ pub(crate) const MODULE_PREFIX: &[SymbolNameComponent] = &[ SymbolNameComponent::Component(symbols::Tx), ]; -pub const CREATE_NOTE: &str = "create_note"; -pub const ADD_ASSET_TO_NOTE: &str = "add_asset_to_note"; pub const GET_BLOCK_NUMBER: &str = "get_block_number"; pub const GET_INPUT_NOTES_COMMITMENT: &str = "get_input_notes_commitment"; pub const GET_OUTPUT_NOTES_COMMITMENT: &str = "get_output_notes_commitment"; pub(crate) fn signatures() -> ModuleFunctionTypeMap { let mut m: ModuleFunctionTypeMap = Default::default(); - let mut note: FunctionTypeMap = Default::default(); - note.insert( - Symbol::from(CREATE_NOTE), - FunctionType::new( - CallConv::Wasm, - [ - Felt, // tag - Felt, // aux - Felt, // note_type - Felt, // execution-hint - // recipient (4 felts) - Felt, Felt, Felt, Felt, - ], - [Felt], - ), - ); - note.insert( - Symbol::from(ADD_ASSET_TO_NOTE), - FunctionType::new( - CallConv::Wasm, - [ - Felt, Felt, Felt, Felt, // asset (4 felts) - Felt, // note_idx - ], - [ - Felt, Felt, Felt, Felt, // asset (4 felts) - Felt, // note_idx - ], - ), - ); - note.insert(Symbol::from(GET_BLOCK_NUMBER), FunctionType::new(CallConv::Wasm, [], [Felt])); - note.insert( + let mut tx: FunctionTypeMap = Default::default(); + tx.insert(Symbol::from(GET_BLOCK_NUMBER), FunctionType::new(CallConv::Wasm, [], [Felt])); + tx.insert( Symbol::from(GET_INPUT_NOTES_COMMITMENT), FunctionType::new(CallConv::Wasm, [], [Felt, Felt, Felt, Felt]), ); - note.insert( + tx.insert( Symbol::from(GET_OUTPUT_NOTES_COMMITMENT), FunctionType::new(CallConv::Wasm, [], [Felt, Felt, Felt, Felt]), ); - m.insert(SymbolPath::from_iter(MODULE_PREFIX.iter().copied()), note); + m.insert(SymbolPath::from_iter(MODULE_PREFIX.iter().copied()), tx); m } diff --git a/hir-symbol/src/symbols.toml b/hir-symbol/src/symbols.toml index acb1e4b65..e19817031 100644 --- a/hir-symbol/src/symbols.toml +++ b/hir-symbol/src/symbols.toml @@ -102,6 +102,10 @@ ub = {} [modules] account = {} +native_account = {} +active_account = {} +active_note = {} +input_note = {} blake3 = {} crypto = {} debug = {} @@ -113,6 +117,7 @@ advice = {} miden = {} mem = {} note = {} +output_note = {} rpo_falcon512 = {} std = {} tx = {} diff --git a/midenc-session/src/libs.rs b/midenc-session/src/libs.rs index 0077d0983..fde87fbd1 100644 --- a/midenc-session/src/libs.rs +++ b/midenc-session/src/libs.rs @@ -115,7 +115,7 @@ impl LinkLibrary { // Handle libraries shipped with the compiler, or via Miden crates match self.name.as_ref() { "std" => return Ok((*STDLIB).as_ref().clone()), - "base" => todo!(), /*return Ok(miden_lib::MidenLib::default().as_ref().clone()),*/ + "base" => return Ok(miden_lib::MidenLib::default().as_ref().clone()), _ => (), } diff --git a/sdk/base-macros/src/account_component_metadata.rs b/sdk/base-macros/src/account_component_metadata.rs index 601419a02..8223d93b4 100644 --- a/sdk/base-macros/src/account_component_metadata.rs +++ b/sdk/base-macros/src/account_component_metadata.rs @@ -61,7 +61,7 @@ impl AccountComponentMetadataBuilder { StorageValueName::new(name).expect("well formed storage value name"); match type_name.as_str() { "StorageMap" => { - let mut map_repr = MapRepresentation::new(vec![], storage_value_name); + let mut map_repr = MapRepresentation::new_value(vec![], storage_value_name); if let Some(description) = description { map_repr = map_repr.with_description(description); } diff --git a/sdk/base-sys/src/bindings/account.rs b/sdk/base-sys/src/bindings/account.rs index 2b9752b88..138858381 100644 --- a/sdk/base-sys/src/bindings/account.rs +++ b/sdk/base-sys/src/bindings/account.rs @@ -4,24 +4,24 @@ use super::types::{AccountId, Asset}; #[allow(improper_ctypes)] extern "C" { - #[link_name = "miden::account::get_id"] + #[link_name = "miden::active_account::get_id"] pub fn extern_account_get_id(ptr: *mut AccountId); - #[link_name = "miden::account::remove_asset"] + #[link_name = "miden::native_account::remove_asset"] pub fn extern_account_remove_asset(_: Felt, _: Felt, _: Felt, _: Felt, ptr: *mut Asset); - #[link_name = "miden::account::get_nonce"] + #[link_name = "miden::active_account::get_nonce"] pub fn extern_account_get_nonce() -> Felt; - #[link_name = "miden::account::incr_nonce"] + #[link_name = "miden::native_account::incr_nonce"] pub fn extern_account_incr_nonce() -> Felt; - #[link_name = "miden::account::get_initial_commitment"] + #[link_name = "miden::active_account::get_initial_commitment"] pub fn extern_account_get_initial_commitment(ptr: *mut Word); - #[link_name = "miden::account::compute_current_commitment"] - pub fn extern_account_compute_current_commitment(ptr: *mut Word); - #[link_name = "miden::account::compute_delta_commitment"] + #[link_name = "miden::active_account::compute_commitment"] + pub fn extern_account_compute_commitment(ptr: *mut Word); + #[link_name = "miden::native_account::compute_delta_commitment"] pub fn extern_account_compute_delta_commitment(ptr: *mut Word); // Resolved via stub rlib at core Wasm link time - #[link_name = "miden::account::add_asset"] + #[link_name = "miden::native_account::add_asset"] pub fn extern_account_add_asset(_: Felt, _: Felt, _: Felt, _: Felt, ptr: *mut Asset); - #[link_name = "miden::account::get_balance"] + #[link_name = "miden::active_account::get_balance"] pub fn extern_account_get_balance(faucet_id_prefix: Felt, faucet_id_suffix: Felt) -> Felt; } @@ -106,10 +106,10 @@ pub fn get_initial_commitment() -> Word { /// Computes and returns the commitment of the current account data. #[inline] -pub fn compute_current_commitment() -> Word { +pub fn compute_commitment() -> Word { unsafe { let mut ret_area = ::core::mem::MaybeUninit::::uninit(); - extern_account_compute_current_commitment(ret_area.as_mut_ptr()); + extern_account_compute_commitment(ret_area.as_mut_ptr()); ret_area.assume_init().reverse() } } diff --git a/sdk/base-sys/src/bindings/note.rs b/sdk/base-sys/src/bindings/active_note.rs similarity index 91% rename from sdk/base-sys/src/bindings/note.rs rename to sdk/base-sys/src/bindings/active_note.rs index 72e64785d..02a3ccc13 100644 --- a/sdk/base-sys/src/bindings/note.rs +++ b/sdk/base-sys/src/bindings/active_note.rs @@ -7,15 +7,15 @@ use super::{AccountId, Asset}; #[allow(improper_ctypes)] extern "C" { - #[link_name = "miden::note::get_inputs"] + #[link_name = "miden::active_note::get_inputs"] pub fn extern_note_get_inputs(ptr: *mut Felt) -> usize; - #[link_name = "miden::note::get_assets"] + #[link_name = "miden::active_note::get_assets"] pub fn extern_note_get_assets(ptr: *mut Felt) -> usize; - #[link_name = "miden::note::get_sender"] + #[link_name = "miden::active_note::get_sender"] pub fn extern_note_get_sender(ptr: *mut AccountId); - #[link_name = "miden::note::get_script_root"] + #[link_name = "miden::active_note::get_script_root"] pub fn extern_note_get_script_root(ptr: *mut Word); - #[link_name = "miden::note::get_serial_number"] + #[link_name = "miden::active_note::get_serial_number"] pub fn extern_note_get_serial_number(ptr: *mut Word); } diff --git a/sdk/base-sys/src/bindings/mod.rs b/sdk/base-sys/src/bindings/mod.rs index 118126aab..5fe3b737a 100644 --- a/sdk/base-sys/src/bindings/mod.rs +++ b/sdk/base-sys/src/bindings/mod.rs @@ -9,7 +9,8 @@ //! - In MASM procedures: These are pushed/popped from the stack in reverse order [e3, e2, e1, e0] pub mod account; -pub mod note; +pub mod active_note; +pub mod output_note; pub mod storage; pub mod tx; mod types; diff --git a/sdk/base-sys/src/bindings/output_note.rs b/sdk/base-sys/src/bindings/output_note.rs new file mode 100644 index 000000000..bd40e2293 --- /dev/null +++ b/sdk/base-sys/src/bindings/output_note.rs @@ -0,0 +1,62 @@ +use miden_stdlib_sys::Felt; + +use super::types::{Asset, NoteIdx, NoteType, Recipient, Tag}; + +#[allow(improper_ctypes)] +extern "C" { + #[link_name = "miden::output_note::create"] + pub fn extern_output_note_create( + tag: Tag, + aux: Felt, + note_type: NoteType, + execution_hint: Felt, + recipient_f0: Felt, + recipient_f1: Felt, + recipient_f2: Felt, + recipient_f3: Felt, + ) -> NoteIdx; + + #[link_name = "miden::output_note::add_asset"] + pub fn extern_output_note_add_asset( + asset_f0: Felt, + asset_f1: Felt, + asset_f2: Felt, + asset_f3: Felt, + note_idx: NoteIdx, + ); +} + +/// Creates a new output note and returns its index. +pub fn create( + tag: Tag, + aux: Felt, + note_type: NoteType, + execution_hint: Felt, + recipient: Recipient, +) -> NoteIdx { + unsafe { + extern_output_note_create( + tag, + aux, + note_type, + execution_hint, + recipient.inner[3], + recipient.inner[2], + recipient.inner[1], + recipient.inner[0], + ) + } +} + +/// Adds the asset to the output note specified by `note_idx`. +pub fn add_asset(asset: Asset, note_idx: NoteIdx) { + unsafe { + extern_output_note_add_asset( + asset.inner[3], + asset.inner[2], + asset.inner[1], + asset.inner[0], + note_idx, + ); + } +} diff --git a/sdk/base-sys/src/bindings/storage.rs b/sdk/base-sys/src/bindings/storage.rs index ea8ed370f..a65359fc9 100644 --- a/sdk/base-sys/src/bindings/storage.rs +++ b/sdk/base-sys/src/bindings/storage.rs @@ -4,10 +4,10 @@ use super::StorageCommitmentRoot; #[allow(improper_ctypes)] extern "C" { - #[link_name = "miden::account::get_item"] + #[link_name = "miden::active_account::get_item"] pub fn extern_get_storage_item(index: Felt, ptr: *mut Word); - #[link_name = "miden::account::set_item"] + #[link_name = "miden::native_account::set_item"] pub fn extern_set_storage_item( index: Felt, v0: Felt, @@ -17,7 +17,7 @@ extern "C" { ptr: *mut (StorageCommitmentRoot, Word), ); - #[link_name = "miden::account::get_map_item"] + #[link_name = "miden::active_account::get_map_item"] pub fn extern_get_storage_map_item( index: Felt, k0: Felt, @@ -27,7 +27,7 @@ extern "C" { ptr: *mut Word, ); - #[link_name = "miden::account::set_map_item"] + #[link_name = "miden::native_account::set_map_item"] pub fn extern_set_storage_map_item( index: Felt, k0: Felt, diff --git a/sdk/base-sys/src/bindings/tx.rs b/sdk/base-sys/src/bindings/tx.rs index 98ec9779f..723338aae 100644 --- a/sdk/base-sys/src/bindings/tx.rs +++ b/sdk/base-sys/src/bindings/tx.rs @@ -1,31 +1,7 @@ use miden_stdlib_sys::{Felt, Word}; -use super::types::{Asset, NoteIdx, NoteType, Recipient, Tag}; - #[allow(improper_ctypes)] extern "C" { - #[link_name = "miden::tx::create_note"] - pub fn extern_tx_create_note( - tag: Tag, - aux: Felt, - note_type: NoteType, - execution_hint: Felt, - recipient_f0: Felt, - recipient_f1: Felt, - recipient_f2: Felt, - recipient_f3: Felt, - ) -> NoteIdx; - - #[link_name = "miden::tx::add_asset_to_note"] - pub fn extern_tx_add_asset_to_note( - asset_f0: Felt, - asset_f1: Felt, - asset_f2: Felt, - asset_f3: Felt, - note_idx: NoteIdx, - result: *mut (Asset, NoteIdx), - ); - #[link_name = "miden::tx::get_block_number"] pub fn extern_tx_get_block_number() -> Felt; @@ -36,55 +12,6 @@ extern "C" { pub fn extern_tx_get_output_notes_commitment(ptr: *mut Word); } -/// Creates a new note. asset is the asset to be included in the note. tag is -/// the tag to be included in the note. recipient is the recipient of the note. -/// Returns the id of the created note. -pub fn create_note( - tag: Tag, - aux: Felt, - note_type: NoteType, - execution_hint: Felt, - recipient: Recipient, -) -> NoteIdx { - unsafe { - extern_tx_create_note( - tag, - aux, - note_type, - execution_hint, - recipient.inner[3], - recipient.inner[2], - recipient.inner[1], - recipient.inner[0], - ) - } -} - -/// Adds the asset to the note specified by the index. -/// -/// # Arguments -/// * `asset` - The asset to be added to the note -/// * `note_idx` - The index of the note to which the asset will be added -/// -/// # Returns -/// A tuple containing the same asset and note_idx -pub fn add_asset_to_note(asset: Asset, note_idx: NoteIdx) -> (Asset, NoteIdx) { - unsafe { - let mut ret_area = ::core::mem::MaybeUninit::<(Asset, NoteIdx)>::uninit(); - extern_tx_add_asset_to_note( - asset.inner[3], - asset.inner[2], - asset.inner[1], - asset.inner[0], - note_idx, - ret_area.as_mut_ptr(), - ); - - let (asset, note_idx) = ret_area.assume_init(); - (asset.reverse(), note_idx) - } -} - /// Returns the current block number. pub fn get_block_number() -> Felt { unsafe { extern_tx_get_block_number() } diff --git a/sdk/base-sys/stubs/account.rs b/sdk/base-sys/stubs/account.rs index 118c16872..47e5ee2a9 100644 --- a/sdk/base-sys/stubs/account.rs +++ b/sdk/base-sys/stubs/account.rs @@ -4,47 +4,47 @@ use core::ffi::c_void; /// /// Unreachable stub for `add-asset` import (extern_account_add_asset). /// Signature matches the Wasm lowering used by the SDK: (f32, f32, f32, f32, i32) -#[export_name = "miden::account::add_asset"] +#[export_name = "miden::native_account::add_asset"] pub extern "C" fn add_asset_plain(_a0: f32, _a1: f32, _a2: f32, _a3: f32, _out: *mut c_void) { unsafe { core::hint::unreachable_unchecked() } } -#[export_name = "miden::account::remove_asset"] +#[export_name = "miden::native_account::remove_asset"] pub extern "C" fn remove_asset_plain(_a0: f32, _a1: f32, _a2: f32, _a3: f32, _out: *mut c_void) { unsafe { core::hint::unreachable_unchecked() } } -#[export_name = "miden::account::get_id"] +#[export_name = "miden::active_account::get_id"] pub extern "C" fn account_get_id_plain(_out: *mut c_void) { unsafe { core::hint::unreachable_unchecked() } } -#[export_name = "miden::account::get_nonce"] +#[export_name = "miden::active_account::get_nonce"] pub extern "C" fn account_get_nonce_plain() -> f32 { unsafe { core::hint::unreachable_unchecked() } } -#[export_name = "miden::account::get_initial_commitment"] +#[export_name = "miden::active_account::get_initial_commitment"] pub extern "C" fn account_get_initial_commitment_plain(_out: *mut c_void) { unsafe { core::hint::unreachable_unchecked() } } -#[export_name = "miden::account::compute_current_commitment"] -pub extern "C" fn account_compute_current_commitment_plain(_out: *mut c_void) { +#[export_name = "miden::active_account::compute_commitment"] +pub extern "C" fn account_compute_commitment_plain(_out: *mut c_void) { unsafe { core::hint::unreachable_unchecked() } } -#[export_name = "miden::account::compute_delta_commitment"] +#[export_name = "miden::native_account::compute_delta_commitment"] pub extern "C" fn account_compute_delta_commitment_plain(_out: *mut c_void) { unsafe { core::hint::unreachable_unchecked() } } -#[export_name = "miden::account::get_item"] +#[export_name = "miden::active_account::get_item"] pub extern "C" fn account_get_item_plain(_index: f32, _out: *mut c_void) { unsafe { core::hint::unreachable_unchecked() } } -#[export_name = "miden::account::set_item"] +#[export_name = "miden::native_account::set_item"] pub extern "C" fn account_set_item_plain( _index: f32, _v0: f32, @@ -56,7 +56,7 @@ pub extern "C" fn account_set_item_plain( unsafe { core::hint::unreachable_unchecked() } } -#[export_name = "miden::account::get_map_item"] +#[export_name = "miden::active_account::get_map_item"] pub extern "C" fn account_get_map_item_plain( _index: f32, _k0: f32, @@ -68,7 +68,7 @@ pub extern "C" fn account_get_map_item_plain( unsafe { core::hint::unreachable_unchecked() } } -#[export_name = "miden::account::set_map_item"] +#[export_name = "miden::native_account::set_map_item"] pub extern "C" fn account_set_map_item_plain( _index: f32, _k0: f32, @@ -84,12 +84,12 @@ pub extern "C" fn account_set_map_item_plain( unsafe { core::hint::unreachable_unchecked() } } -#[export_name = "miden::account::incr_nonce"] +#[export_name = "miden::native_account::incr_nonce"] pub extern "C" fn account_incr_nonce_plain() -> f32 { unsafe { core::hint::unreachable_unchecked() } } -#[export_name = "miden::account::get_balance"] +#[export_name = "miden::active_account::get_balance"] pub extern "C" fn account_get_balance_plain(_prefix: f32, _suffix: f32) -> f32 { unsafe { core::hint::unreachable_unchecked() } } diff --git a/sdk/base-sys/stubs/note.rs b/sdk/base-sys/stubs/active_note.rs similarity index 71% rename from sdk/base-sys/stubs/note.rs rename to sdk/base-sys/stubs/active_note.rs index 549ef9363..46e1b87c9 100644 --- a/sdk/base-sys/stubs/note.rs +++ b/sdk/base-sys/stubs/active_note.rs @@ -1,27 +1,27 @@ use core::ffi::c_void; /// Note interface stubs -#[export_name = "miden::note::get_inputs"] +#[export_name = "miden::active_note::get_inputs"] pub extern "C" fn note_get_inputs_plain(_ptr: *mut c_void) -> usize { unsafe { core::hint::unreachable_unchecked() } } -#[export_name = "miden::note::get_assets"] +#[export_name = "miden::active_note::get_assets"] pub extern "C" fn note_get_assets_plain(_ptr: *mut c_void) -> usize { unsafe { core::hint::unreachable_unchecked() } } -#[export_name = "miden::note::get_sender"] +#[export_name = "miden::active_note::get_sender"] pub extern "C" fn note_get_sender_plain(_ptr: *mut c_void) { unsafe { core::hint::unreachable_unchecked() } } -#[export_name = "miden::note::get_script_root"] +#[export_name = "miden::active_note::get_script_root"] pub extern "C" fn note_get_script_root_plain(_ptr: *mut c_void) { unsafe { core::hint::unreachable_unchecked() } } -#[export_name = "miden::note::get_serial_number"] +#[export_name = "miden::active_note::get_serial_number"] pub extern "C" fn note_get_serial_number_plain(_ptr: *mut c_void) { unsafe { core::hint::unreachable_unchecked() } } diff --git a/sdk/base-sys/stubs/lib.rs b/sdk/base-sys/stubs/lib.rs index 8badd074e..e0908142c 100644 --- a/sdk/base-sys/stubs/lib.rs +++ b/sdk/base-sys/stubs/lib.rs @@ -7,7 +7,8 @@ //! the calls appropriately. They are not part of the crate sources. mod account; -mod note; +mod active_note; +mod output_note; mod tx; // No panic handler here; the stubs are packaged as a single object into a diff --git a/sdk/base-sys/stubs/output_note.rs b/sdk/base-sys/stubs/output_note.rs new file mode 100644 index 000000000..3fa3cd215 --- /dev/null +++ b/sdk/base-sys/stubs/output_note.rs @@ -0,0 +1,25 @@ +/// Output note interface stubs +#[export_name = "miden::output_note::create"] +pub extern "C" fn output_note_create_plain( + _tag: f32, + _aux: f32, + _note_type: f32, + _execution_hint: f32, + _r0: f32, + _r1: f32, + _r2: f32, + _r3: f32, +) -> f32 { + unsafe { core::hint::unreachable_unchecked() } +} + +#[export_name = "miden::output_note::add_asset"] +pub extern "C" fn output_note_add_asset_plain( + _a0: f32, + _a1: f32, + _a2: f32, + _a3: f32, + _note_idx: f32, +) { + unsafe { core::hint::unreachable_unchecked() } +} diff --git a/sdk/base-sys/stubs/tx.rs b/sdk/base-sys/stubs/tx.rs index 37b06f9a2..899fca0cc 100644 --- a/sdk/base-sys/stubs/tx.rs +++ b/sdk/base-sys/stubs/tx.rs @@ -1,32 +1,5 @@ use core::ffi::c_void; -/// Tx interface stubs -#[export_name = "miden::tx::create_note"] -pub extern "C" fn tx_create_note_plain( - _tag: f32, - _aux: f32, - _note_type: f32, - _execution_hint: f32, - _r0: f32, - _r1: f32, - _r2: f32, - _r3: f32, -) -> f32 { - unsafe { core::hint::unreachable_unchecked() } -} - -#[export_name = "miden::tx::add_asset_to_note"] -pub extern "C" fn tx_add_asset_to_note_plain( - _a0: f32, - _a1: f32, - _a2: f32, - _a3: f32, - _note_idx: f32, - _out: *mut c_void, -) { - unsafe { core::hint::unreachable_unchecked() } -} - #[export_name = "miden::tx::get_block_number"] pub extern "C" fn tx_get_block_number_plain() -> f32 { unsafe { core::hint::unreachable_unchecked() } diff --git a/sdk/stdlib-sys/src/intrinsics/advice.rs b/sdk/stdlib-sys/src/intrinsics/advice.rs index bd1bad527..0426c50e6 100644 --- a/sdk/stdlib-sys/src/intrinsics/advice.rs +++ b/sdk/stdlib-sys/src/intrinsics/advice.rs @@ -20,7 +20,7 @@ pub fn adv_push_mapvaln(key: Word) -> Felt { extern "C" { /// Emits an event to request a Falcon signature for the provided message/public key. - /// This maps to a single MASM instruction: `emit.131087`. + /// This maps to the MASM instruction: `emit.AUTH_REQUEST_EVENT`. #[link_name = "intrinsics::advice::emit_falcon_sig_to_stack"] fn extern_emit_falcon_sig_to_stack( msg0: Felt, diff --git a/tests/integration-node/Cargo.toml b/tests/integration-node/Cargo.toml index 4c95fe0ec..a0032fce9 100644 --- a/tests/integration-node/Cargo.toml +++ b/tests/integration-node/Cargo.toml @@ -14,7 +14,8 @@ publish = false [dependencies] anyhow.workspace = true fs2 = "0.4" -miden-client = { version = "0.12", features = ["std"] } +miden-client = { version = "0.12", features = ["std", "tonic"] } +miden-client-sqlite-store = { version = "0.12" } miden-core.workspace = true miden-mast-package.workspace = true miden-objects = { workspace = true, features = ["std"] } diff --git a/tests/integration-node/src/local_node/setup.rs b/tests/integration-node/src/local_node/setup.rs index 8da8f87ef..51ecbfec7 100644 --- a/tests/integration-node/src/local_node/setup.rs +++ b/tests/integration-node/src/local_node/setup.rs @@ -11,7 +11,7 @@ use super::{process::kill_process, sync::read_pid, COORD_DIR}; // the compatible miden-node version. Both should typically use the same major.minor version. /// The exact miden-node version that is compatible with the miden-client version used in tests -const MIDEN_NODE_VERSION: &str = "0.11.1"; +const MIDEN_NODE_VERSION: &str = "0.12.0"; /// Manages the lifecycle of a local Miden node instance pub struct LocalMidenNode; diff --git a/tests/integration-node/src/node_tests/basic_wallet.rs b/tests/integration-node/src/node_tests/basic_wallet.rs index 5cc267108..a673e559d 100644 --- a/tests/integration-node/src/node_tests/basic_wallet.rs +++ b/tests/integration-node/src/node_tests/basic_wallet.rs @@ -93,12 +93,8 @@ pub fn test_basic_wallet_p2id_local() { .build() .unwrap(); - let mint_tx_result = - client.new_transaction(faucet_account.id(), mint_request).await.unwrap(); - let mint_tx_id = mint_tx_result.executed_transaction().id(); - eprintln!("Created mint transaction. Tx ID: {mint_tx_id:?}"); - - client.submit_transaction(mint_tx_result).await.unwrap(); + let mint_tx_id = + client.submit_new_transaction(faucet_account.id(), mint_request).await.unwrap(); eprintln!("Submitted mint transaction. Tx ID: {mint_tx_id:?}"); eprintln!("\n=== Step 2: Alice attempts to consume mint note ==="); @@ -108,14 +104,12 @@ pub fn test_basic_wallet_p2id_local() { .build() .unwrap(); - let consume_tx = client - .new_transaction(alice_account.id(), consume_request) + let _consume_tx_id = client + .submit_new_transaction(alice_account.id(), consume_request) .await .map_err(|e| format!("{e:?}")) .unwrap(); - client.submit_transaction(consume_tx).await.unwrap(); - eprintln!("\n=== Checking Alice's account has the minted asset ==="); assert_account_has_fungible_asset( @@ -169,12 +163,10 @@ pub fn test_basic_wallet_p2id_local() { .build() .unwrap(); - let consume_tx = client.new_transaction(bob_account.id(), consume_request).await.unwrap(); - let consume_tx_id = consume_tx.executed_transaction().id(); + let consume_tx_id = + client.submit_new_transaction(bob_account.id(), consume_request).await.unwrap(); eprintln!("Bob created consume transaction. Tx ID: {consume_tx_id:?}"); - client.submit_transaction(consume_tx).await.unwrap(); - eprintln!("\n=== Step 6: Checking Bob's account has the transferred asset ==="); assert_account_has_fungible_asset( diff --git a/tests/integration-node/src/node_tests/counter_contract.rs b/tests/integration-node/src/node_tests/counter_contract.rs index 5670b933f..c1d792450 100644 --- a/tests/integration-node/src/node_tests/counter_contract.rs +++ b/tests/integration-node/src/node_tests/counter_contract.rs @@ -101,7 +101,7 @@ pub fn test_counter_contract_local() { .unwrap(); let tx_result = client - .new_transaction(counter_account.id(), note_request) + .execute_transaction(counter_account.id(), note_request) .await .map_err(|e| { eprintln!("Transaction creation error: {e}"); @@ -116,7 +116,12 @@ pub fn test_counter_contract_local() { let executed_tx_output_note = executed_transaction.output_notes().get_note(0); assert_eq!(executed_tx_output_note.id(), counter_note.id()); let create_note_tx_id = executed_transaction.id(); - client.submit_transaction(tx_result).await.unwrap(); + let proven_tx = client.prove_transaction(&tx_result).await.unwrap(); + let submission_height = client + .submit_proven_transaction(proven_tx, tx_result.tx_inputs().clone()) + .await + .unwrap(); + client.apply_transaction(&tx_result, submission_height).await.unwrap(); eprintln!("Created counter note tx: {create_note_tx_id:?}"); // Consume the note to increment the counter @@ -126,7 +131,7 @@ pub fn test_counter_contract_local() { .unwrap(); let tx_result = client - .new_transaction(counter_account.id(), consume_request) + .execute_transaction(counter_account.id(), consume_request) .await .map_err(|e| { eprintln!("Note consumption transaction error: {e}"); @@ -138,7 +143,12 @@ pub fn test_counter_contract_local() { &tx_result.executed_transaction().id() ); - client.submit_transaction(tx_result).await.unwrap(); + let proven_tx = client.prove_transaction(&tx_result).await.unwrap(); + let submission_height = client + .submit_proven_transaction(proven_tx, tx_result.tx_inputs().clone()) + .await + .unwrap(); + client.apply_transaction(&tx_result, submission_height).await.unwrap(); let sync_result = client.sync_state().await.unwrap(); eprintln!("Synced to block: {}", sync_result.block_num); diff --git a/tests/integration-node/src/node_tests/counter_contract_no_auth.rs b/tests/integration-node/src/node_tests/counter_contract_no_auth.rs index 110a6a74c..bb3ac5aca 100644 --- a/tests/integration-node/src/node_tests/counter_contract_no_auth.rs +++ b/tests/integration-node/src/node_tests/counter_contract_no_auth.rs @@ -117,7 +117,7 @@ pub fn test_counter_contract_no_auth_local() { .unwrap(); let tx_result = client - .new_transaction(sender_account.id(), note_request) + .execute_transaction(sender_account.id(), note_request) .await .map_err(|e| { eprintln!("Transaction creation error: {e}"); @@ -129,7 +129,12 @@ pub fn test_counter_contract_no_auth_local() { let executed_tx_output_note = executed_transaction.output_notes().get_note(0); assert_eq!(executed_tx_output_note.id(), counter_note.id()); let create_note_tx_id = executed_transaction.id(); - client.submit_transaction(tx_result).await.unwrap(); + let proven_tx = client.prove_transaction(&tx_result).await.unwrap(); + let submission_height = client + .submit_proven_transaction(proven_tx, tx_result.tx_inputs().clone()) + .await + .unwrap(); + client.apply_transaction(&tx_result, submission_height).await.unwrap(); eprintln!("Created counter note tx: {create_note_tx_id:?}"); // Consume the note with the counter account @@ -139,7 +144,7 @@ pub fn test_counter_contract_no_auth_local() { .unwrap(); let tx_result = client - .new_transaction(counter_account.id(), consume_request) + .execute_transaction(counter_account.id(), consume_request) .await .map_err(|e| { eprintln!("Note consumption transaction error: {e}"); @@ -151,7 +156,12 @@ pub fn test_counter_contract_no_auth_local() { &tx_result.executed_transaction().id() ); - client.submit_transaction(tx_result).await.unwrap(); + let proven_tx = client.prove_transaction(&tx_result).await.unwrap(); + let submission_height = client + .submit_proven_transaction(proven_tx, tx_result.tx_inputs().clone()) + .await + .unwrap(); + client.apply_transaction(&tx_result, submission_height).await.unwrap(); let sync_result = client.sync_state().await.unwrap(); eprintln!("Synced to block: {}", sync_result.block_num); diff --git a/tests/integration-node/src/node_tests/counter_contract_rust_auth.rs b/tests/integration-node/src/node_tests/counter_contract_rust_auth.rs index 2e6d68302..10ffc65dd 100644 --- a/tests/integration-node/src/node_tests/counter_contract_rust_auth.rs +++ b/tests/integration-node/src/node_tests/counter_contract_rust_auth.rs @@ -6,14 +6,16 @@ use miden_client::{ account::StorageMap, - auth::AuthSecretKey, + auth::{AuthSecretKey, PublicKeyCommitment}, keystore::FilesystemKeyStore, transaction::{OutputNote, TransactionRequestBuilder}, utils::Deserializable, Client, DebugMode, Word, }; +use miden_client_sqlite_store::ClientBuilderSqliteExt; use miden_core::{Felt, FieldElement}; use miden_mast_package::SectionId; +use miden_objects::crypto::dsa::rpo_falcon512::SecretKey; use rand::{rngs::StdRng, RngCore}; use super::helpers::*; @@ -48,7 +50,7 @@ async fn create_counter_account_with_rust_rpo_auth( component_package: std::sync::Arc, auth_component_package: std::sync::Arc, keystore: std::sync::Arc>, -) -> Result<(miden_client::account::Account, Word), miden_client::ClientError> { +) -> Result { use std::collections::BTreeSet; use miden_objects::account::{ @@ -85,8 +87,8 @@ async fn create_counter_account_with_rust_rpo_auth( }; // Build the Rust-compiled auth component with public key commitment in slot 0 - let key_pair = miden_client::crypto::SecretKey::with_rng(client.rng()); - let pk_commitment = miden_objects::Word::from(key_pair.public_key()); + let key_pair = SecretKey::with_rng(client.rng()); + let pk_commitment: Word = PublicKeyCommitment::from(key_pair.public_key()).into(); let mut auth_component = AccountComponent::new( auth_component_package.unwrap_library().as_ref().clone(), vec![StorageSlot::Value(pk_commitment)], @@ -100,7 +102,7 @@ async fn create_counter_account_with_rust_rpo_auth( let _ = client.sync_state().await?; - let (account, seed) = AccountBuilder::new(init_seed) + let account = AccountBuilder::new(init_seed) .account_type(AccountType::RegularAccountUpdatableCode) .storage_mode(AccountStorageMode::Public) .with_auth_component(auth_component) @@ -109,11 +111,11 @@ async fn create_counter_account_with_rust_rpo_auth( .build() .unwrap(); - client.add_account(&account, Some(seed), false).await?; + client.add_account(&account, false).await?; keystore.add_key(&AuthSecretKey::RpoFalcon512(key_pair)).unwrap(); - Ok((account, seed)) + Ok(account) } /// Verify that another client (without the RPO-Falcon512 key) cannot create notes for @@ -138,7 +140,7 @@ pub fn test_counter_contract_rust_auth_blocks_unauthorized_note_creation() { .await .expect("Failed to setup test infrastructure"); - let (counter_account, counter_seed) = create_counter_account_with_rust_rpo_auth( + let counter_account = create_counter_account_with_rust_rpo_auth( &mut client, contract_package.clone(), rpo_auth_package.clone(), @@ -173,28 +175,32 @@ pub fn test_counter_contract_rust_auth_blocks_unauthorized_note_creation() { .own_output_notes(vec![OutputNote::Full(own_note.clone())]) .build() .unwrap(); - let ok_tx = client - .new_transaction(counter_account.id(), own_request) + let tx_result = client + .execute_transaction(counter_account.id(), own_request.clone()) .await .expect("authorized client should be able to create a note"); - assert_eq!(ok_tx.executed_transaction().output_notes().num_notes(), 1); - assert_eq!(ok_tx.executed_transaction().output_notes().get_note(0).id(), own_note.id()); - client.submit_transaction(ok_tx).await.unwrap(); + assert_eq!(tx_result.executed_transaction().output_notes().num_notes(), 1); + assert_eq!(tx_result.executed_transaction().output_notes().get_note(0).id(), own_note.id()); + + let proven_tx = client.prove_transaction(&tx_result).await.unwrap(); + let submission_height = client + .submit_proven_transaction(proven_tx, tx_result.tx_inputs().clone()) + .await + .unwrap(); + client.apply_transaction(&tx_result, submission_height).await.unwrap(); // Create a separate client with its own empty keystore (no key for counter account) let attacker_dir = temp_dir::TempDir::with_prefix("attacker_client_") .expect("Failed to create temp directory"); let rpc_url = node_handle.rpc_url().to_string(); let endpoint = miden_client::rpc::Endpoint::try_from(rpc_url.as_str()).unwrap(); - let rpc_api = - std::sync::Arc::new(miden_client::rpc::TonicRpcClient::new(&endpoint, 10_000)); - let attacker_store_path = - attacker_dir.path().join("store.sqlite3").to_str().unwrap().to_string(); + let rpc_api = std::sync::Arc::new(miden_client::rpc::GrpcClient::new(&endpoint, 10_000)); + let attacker_store_path = attacker_dir.path().join("store.sqlite3"); let attacker_keystore_path = attacker_dir.path().join("keystore"); let mut attacker_client = miden_client::builder::ClientBuilder::new() .rpc(rpc_api) - .sqlite_store(&attacker_store_path) + .sqlite_store(attacker_store_path.clone()) .filesystem_keystore(attacker_keystore_path.to_str().unwrap()) .in_debug_mode(DebugMode::Enabled) .build() @@ -204,7 +210,7 @@ pub fn test_counter_contract_rust_auth_blocks_unauthorized_note_creation() { // The attacker needs the account record locally to attempt building a tx // Reuse the same account object; seed is not needed for reading/state queries attacker_client - .add_account(&counter_account, Some(counter_seed), false) + .add_account(&counter_account, false) .await .expect("failed to add account to attacker client"); @@ -222,7 +228,8 @@ pub fn test_counter_contract_rust_auth_blocks_unauthorized_note_creation() { .build() .unwrap(); - let result = attacker_client.new_transaction(counter_account.id(), forged_request).await; + let result = + attacker_client.execute_transaction(counter_account.id(), forged_request).await; assert!( result.is_err(), diff --git a/tests/integration-node/src/node_tests/helpers.rs b/tests/integration-node/src/node_tests/helpers.rs index 05782d8c2..93360efc1 100644 --- a/tests/integration-node/src/node_tests/helpers.rs +++ b/tests/integration-node/src/node_tests/helpers.rs @@ -1,6 +1,6 @@ //! Common helper functions for node tests -use std::{borrow::Borrow, collections::BTreeSet, sync::Arc}; +use std::{borrow::Borrow, collections::BTreeSet, path::Path, sync::Arc}; use miden_client::{ account::{ @@ -8,19 +8,20 @@ use miden_client::{ Account, AccountId, AccountStorageMode, AccountType, StorageSlot, }, asset::{FungibleAsset, TokenSymbol}, - auth::AuthSecretKey, + auth::{AuthSecretKey, PublicKeyCommitment}, builder::ClientBuilder, - crypto::{FeltRng, RpoRandomCoin, SecretKey}, + crypto::{rpo_falcon512::SecretKey, FeltRng, RpoRandomCoin}, keystore::FilesystemKeyStore, note::{ Note, NoteExecutionHint, NoteInputs, NoteMetadata, NoteRecipient, NoteScript, NoteTag, NoteType, }, - rpc::{Endpoint, TonicRpcClient}, + rpc::{Endpoint, GrpcClient}, transaction::{TransactionRequestBuilder, TransactionScript}, utils::Deserializable, Client, ClientError, }; +use miden_client_sqlite_store::ClientBuilderSqliteExt; use miden_core::{Felt, FieldElement, Word}; use miden_integration_tests::CompilerTestBuilder; use miden_mast_package::{Package, SectionId}; @@ -50,7 +51,7 @@ pub async fn setup_test_infrastructure( // Initialize RPC connection let endpoint = Endpoint::try_from(rpc_url.as_str()).expect("Failed to create endpoint"); let timeout_ms = 10_000; - let rpc_api = Arc::new(TonicRpcClient::new(&endpoint, timeout_ms)); + let rpc_api = Arc::new(GrpcClient::new(&endpoint, timeout_ms)); // Initialize keystore let keystore_path = temp_dir.path().join("keystore"); @@ -60,7 +61,7 @@ pub async fn setup_test_infrastructure( let store_path = temp_dir.path().join("store.sqlite3").to_str().unwrap().to_string(); let builder = ClientBuilder::new() .rpc(rpc_api) - .sqlite_store(&store_path) + .sqlite_store(Path::new(&store_path).to_path_buf()) .filesystem_keystore(keystore_path.to_str().unwrap()) .in_debug_mode(miden_client::DebugMode::Enabled); let client = builder.build().await?; @@ -97,7 +98,7 @@ pub async fn create_account_with_component( config: AccountCreationConfig, ) -> Result { let account_component_metadata = package.sections.iter().find_map(|s| { - if &s.id == &SectionId::ACCOUNT_COMPONENT_METADATA { + if s.id == SectionId::ACCOUNT_COMPONENT_METADATA { Some(s.data.borrow()) } else { None @@ -135,7 +136,9 @@ pub async fn create_account_with_component( let mut builder = AccountBuilder::new(init_seed) .account_type(config.account_type) .storage_mode(config.storage_mode) - .with_auth_component(AuthRpoFalcon512::new(key_pair.public_key())); + .with_auth_component(AuthRpoFalcon512::new(PublicKeyCommitment::from( + key_pair.public_key().to_commitment(), + ))); if config.with_basic_wallet { builder = builder.with_component(BasicWallet); @@ -143,11 +146,11 @@ pub async fn create_account_with_component( builder = builder.with_component(account_component); - let (account, seed) = builder.build().unwrap_or_else(|e| { + let account = builder.build().unwrap_or_else(|e| { eprintln!("failed to build account with custom auth component: {e}"); panic!("failed to build account with custom auth component") }); - client.add_account(&account, Some(seed), false).await?; + client.add_account(&account, false).await?; keystore.add_key(&AuthSecretKey::RpoFalcon512(key_pair)).unwrap(); Ok(account) @@ -172,11 +175,13 @@ pub async fn create_basic_wallet_account( let builder = AccountBuilder::new(init_seed) .account_type(config.account_type) .storage_mode(config.storage_mode) - .with_auth_component(AuthRpoFalcon512::new(key_pair.public_key())) + .with_auth_component(AuthRpoFalcon512::new(PublicKeyCommitment::from( + key_pair.public_key().to_commitment(), + ))) .with_component(BasicWallet); - let (account, seed) = builder.build().unwrap(); - client.add_account(&account, Some(seed), false).await?; + let account = builder.build().unwrap(); + client.add_account(&account, false).await?; keystore.add_key(&AuthSecretKey::RpoFalcon512(key_pair)).unwrap(); Ok(account) @@ -190,28 +195,31 @@ pub async fn create_account_with_component_and_auth_package( config: AccountCreationConfig, ) -> Result { // Build the main account component from its template metadata - let account_component = match component_package.account_component_metadata_bytes.as_deref() { - None => panic!("no account component metadata present"), - Some(bytes) => { - let metadata = AccountComponentMetadata::read_from_bytes(bytes).unwrap(); - let template = AccountComponentTemplate::new( - metadata, - component_package.unwrap_library().as_ref().clone(), - ); - - let component = - AccountComponent::new(template.library().clone(), config.storage_slots.clone()) - .unwrap(); - - // Use supported types from config if provided, otherwise default to RegularAccountUpdatableCode - let supported_types = if let Some(types) = &config.supported_types { - BTreeSet::from_iter(types.iter().cloned()) - } else { - BTreeSet::from_iter([AccountType::RegularAccountUpdatableCode]) - }; + let account_component_metadata_section = component_package + .sections + .iter() + .find(|s| s.id == SectionId::ACCOUNT_COMPONENT_METADATA) + .expect("no account component metadata found"); + let account_component = { + let bytes = account_component_metadata_section.data.as_ref(); + let metadata = AccountComponentMetadata::read_from_bytes(bytes).unwrap(); + let template = AccountComponentTemplate::new( + metadata, + component_package.unwrap_library().as_ref().clone(), + ); + + let component = + AccountComponent::new(template.library().clone(), config.storage_slots.clone()) + .unwrap(); + + // Use supported types from config if provided, otherwise default to RegularAccountUpdatableCode + let supported_types = if let Some(types) = &config.supported_types { + BTreeSet::from_iter(types.iter().cloned()) + } else { + BTreeSet::from_iter([AccountType::RegularAccountUpdatableCode]) + }; - component.with_supported_types(supported_types) - } + component.with_supported_types(supported_types) }; // Build the authentication component from the compiled library (no storage) @@ -245,8 +253,8 @@ pub async fn create_account_with_component_and_auth_package( builder = builder.with_component(account_component); - let (account, seed) = builder.build().unwrap(); - client.add_account(&account, Some(seed), false).await?; + let account = builder.build().unwrap(); + client.add_account(&account, false).await?; // No keystore key needed for no-auth auth component Ok(account) @@ -268,11 +276,13 @@ pub async fn create_fungible_faucet_account( let builder = AccountBuilder::new(init_seed) .account_type(AccountType::FungibleFaucet) .storage_mode(AccountStorageMode::Public) - .with_auth_component(AuthRpoFalcon512::new(key_pair.public_key())) + .with_auth_component(AuthRpoFalcon512::new(PublicKeyCommitment::from( + key_pair.public_key().to_commitment(), + ))) .with_component(BasicFungibleFaucet::new(token_symbol, decimals, max_supply).unwrap()); - let (account, seed) = builder.build().unwrap(); - client.add_account(&account, Some(seed), false).await?; + let account = builder.build().unwrap(); + client.add_account(&account, false).await?; keystore.add_key(&AuthSecretKey::RpoFalcon512(key_pair)).unwrap(); Ok(account) @@ -497,10 +507,7 @@ pub async fn send_asset_to_account( .build() .unwrap(); - let tx = client.new_transaction(sender_account_id, tx_request).await?; - let tx_id = tx.executed_transaction().id(); - - client.submit_transaction(tx).await?; + let tx_id = client.submit_new_transaction(sender_account_id, tx_request).await?; // Create the Note that the recipient will consume let assets = miden_client::note::NoteAssets::new(vec![asset.into()]).unwrap(); diff --git a/tests/integration/Cargo.toml b/tests/integration/Cargo.toml index 1cf9f7911..db7d1c519 100644 --- a/tests/integration/Cargo.toml +++ b/tests/integration/Cargo.toml @@ -35,6 +35,7 @@ midenc-codegen-masm.workspace = true midenc-session.workspace = true midenc-compile.workspace = true cargo-miden.workspace = true +miden-lib.workspace = true wasmprinter = "0.227" proptest.workspace = true sha2 = "0.10" diff --git a/tests/integration/expected/abi_transform_stdlib_blake3_hash.masm b/tests/integration/expected/abi_transform_stdlib_blake3_hash.masm index eef78a4b4..f8e5f095a 100644 --- a/tests/integration/expected/abi_transform_stdlib_blake3_hash.masm +++ b/tests/integration/expected/abi_transform_stdlib_blake3_hash.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -12,7 +12,8 @@ end # mod root_ns:root@1.0.0::abi_transform_stdlib_blake3_hash -export.entrypoint +@callconv("C") +pub proc entrypoint(i32, i32) push.1114112 u32divmod.4 swap.1 @@ -250,7 +251,18 @@ export.entrypoint nop end -proc.std::crypto::hashes::blake3::hash_1to1 +@callconv("C") +proc std::crypto::hashes::blake3::hash_1to1( + i32, + i32, + i32, + i32, + i32, + i32, + i32, + i32, + i32 +) trace.240 nop exec.::std::crypto::hashes::blake3::hash_1to1 diff --git a/tests/integration/expected/abi_transform_tx_kernel_get_id.hir b/tests/integration/expected/abi_transform_tx_kernel_get_id.hir index 2b17dfbea..9e8abc779 100644 --- a/tests/integration/expected/abi_transform_tx_kernel_get_id.hir +++ b/tests/integration/expected/abi_transform_tx_kernel_get_id.hir @@ -231,7 +231,7 @@ builtin.component root_ns:root@1.0.0 { hir.store v154, v152; v155 = arith.constant 8 : i32; v156 = arith.add v152, v155 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_id/miden::account::get_id(v156) + hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_id/miden::active_account::get_id(v156) v158 = arith.constant 8 : u32; v157 = hir.bitcast v152 : u32; v159 = arith.add v157, v158 : u32 #[overflow = checked]; @@ -267,9 +267,9 @@ builtin.component root_ns:root@1.0.0 { builtin.ret v182; }; - private builtin.function @miden::account::get_id(v183: i32) { + private builtin.function @miden::active_account::get_id(v183: i32) { ^block32(v183: i32): - v184, v185 = hir.exec @miden/account/get_id() : felt, felt + v184, v185 = hir.exec @miden/active_account/get_id() : felt, felt v186 = hir.bitcast v183 : u32; v187 = hir.int_to_ptr v186 : ptr; hir.store v187, v184; diff --git a/tests/integration/expected/abi_transform_tx_kernel_get_id.wat b/tests/integration/expected/abi_transform_tx_kernel_get_id.wat index 01367e560..a9879a280 100644 --- a/tests/integration/expected/abi_transform_tx_kernel_get_id.wat +++ b/tests/integration/expected/abi_transform_tx_kernel_get_id.wat @@ -152,7 +152,7 @@ local.get 1 i32.const 8 i32.add - call $miden::account::get_id + call $miden::active_account::get_id local.get 0 local.get 1 i64.load offset=8 align=4 @@ -170,7 +170,7 @@ i32.gt_u select ) - (func $miden::account::get_id (;8;) (type 0) (param i32) + (func $miden::active_account::get_id (;8;) (type 0) (param i32) unreachable ) (func $cabi_realloc (;9;) (type 2) (param i32 i32 i32 i32) (result i32) diff --git a/tests/integration/expected/abi_transform_tx_kernel_get_inputs_4.hir b/tests/integration/expected/abi_transform_tx_kernel_get_inputs_4.hir index d1f2e2261..dec6f4119 100644 --- a/tests/integration/expected/abi_transform_tx_kernel_get_inputs_4.hir +++ b/tests/integration/expected/abi_transform_tx_kernel_get_inputs_4.hir @@ -12,7 +12,7 @@ builtin.component root_ns:root@1.0.0 { hir.store v7, v5; v8 = arith.constant 4 : i32; v9 = arith.add v5, v8 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/miden_base_sys::bindings::note::get_inputs(v9) + hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/miden_base_sys::bindings::active_note::get_inputs(v9) v11 = arith.constant 12 : u32; v10 = hir.bitcast v5 : u32; v12 = arith.add v10, v11 : u32 #[overflow = checked]; @@ -154,7 +154,7 @@ builtin.component root_ns:root@1.0.0 { private builtin.function @__rustc::__rust_alloc(v95: i32, v96: i32) -> i32 { ^block11(v95: i32, v96: i32): - v98 = arith.constant 1048640 : i32; + v98 = arith.constant 1048648 : i32; v99 = hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/::alloc(v98, v96, v95) : i32 builtin.ret v99; }; @@ -166,7 +166,7 @@ builtin.component root_ns:root@1.0.0 { private builtin.function @__rustc::__rust_realloc(v103: i32, v104: i32, v105: i32, v106: i32) -> i32 { ^block15(v103: i32, v104: i32, v105: i32, v106: i32): - v108 = arith.constant 1048640 : i32; + v108 = arith.constant 1048648 : i32; v109 = hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/::alloc(v108, v105, v106) : i32 v775 = arith.constant 0 : i32; v110 = arith.constant 0 : i32; @@ -213,7 +213,7 @@ builtin.component root_ns:root@1.0.0 { private builtin.function @__rustc::__rust_alloc_zeroed(v136: i32, v137: i32) -> i32 { ^block20(v136: i32, v137: i32): - v139 = arith.constant 1048640 : i32; + v139 = arith.constant 1048648 : i32; v140 = hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/::alloc(v139, v137, v136) : i32 v784 = arith.constant 0 : i32; v141 = arith.constant 0 : i32; @@ -459,7 +459,7 @@ builtin.component root_ns:root@1.0.0 { ub.unreachable ; }; - private builtin.function @miden_base_sys::bindings::note::get_inputs(v305: i32) { + private builtin.function @miden_base_sys::bindings::active_note::get_inputs(v305: i32) { ^block44(v305: i32): v307 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__stack_pointer : ptr v308 = hir.bitcast v307 : ptr; @@ -469,7 +469,7 @@ builtin.component root_ns:root@1.0.0 { v312 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__stack_pointer : ptr v313 = hir.bitcast v312 : ptr; hir.store v313, v311; - v318 = arith.constant 1048620 : i32; + v318 = arith.constant 1048628 : i32; v316 = arith.constant 4 : i32; v314 = arith.constant 8 : i32; v315 = arith.add v311, v314 : i32 #[overflow = wrapping]; @@ -494,7 +494,7 @@ builtin.component root_ns:root@1.0.0 { v334 = hir.bitcast v332 : u32; v336 = arith.shr v334, v838 : u32; v337 = hir.bitcast v336 : i32; - v338 = hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/miden::note::get_inputs(v337) : i32 + v338 = hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/miden::active_note::get_inputs(v337) : i32 v844 = arith.constant 8 : u32; v339 = hir.bitcast v305 : u32; v341 = arith.add v339, v844 : u32 #[overflow = checked]; @@ -1013,9 +1013,9 @@ builtin.component root_ns:root@1.0.0 { builtin.ret v691; }; - private builtin.function @miden::note::get_inputs(v692: i32) -> i32 { + private builtin.function @miden::active_note::get_inputs(v692: i32) -> i32 { ^block91(v692: i32): - v693, v694 = hir.exec @miden/note/get_inputs(v692) : i32, i32 + v693, v694 = hir.exec @miden/active_note/get_inputs(v692) : i32, i32 builtin.ret v693; }; @@ -1102,6 +1102,6 @@ builtin.component root_ns:root@1.0.0 { builtin.ret_imm 1048576; }; - builtin.segment readonly @1048576 = 0x000000010000002100000019000000290010000000000073722e65746f6e2f73676e69646e69622f6372732f302e372e302d7379732d657361622d6e6564696d; + builtin.segment readonly @1048576 = 0x00000001000000210000001900000030001000000000000073722e65746f6e5f6576697463612f73676e69646e69622f6372732f302e372e302d7379732d657361622d6e6564696d; }; }; \ No newline at end of file diff --git a/tests/integration/expected/abi_transform_tx_kernel_get_inputs_4.masm b/tests/integration/expected/abi_transform_tx_kernel_get_inputs_4.masm index c5b1d7505..ce2a7d870 100644 --- a/tests/integration/expected/abi_transform_tx_kernel_get_inputs_4.masm +++ b/tests/integration/expected/abi_transform_tx_kernel_get_inputs_4.masm @@ -1,27 +1,30 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init trace.252 - push.[1401399710535556876,5110350579171046467,11284637462410625470,4413703774666677263] + push.[2866421088928114421,8591108593910809698,14973632783658664026,11239996622085430565] adv.push_mapval push.262144 - push.4 + push.5 trace.240 exec.::std::mem::pipe_preimage_to_memory trace.252 drop push.1048576 u32assert - mem_store.278544 + mem_store.278552 end # mod root_ns:root@1.0.0::abi_transform_tx_kernel_get_inputs_4 -export.entrypoint - push.1114176 +@callconv("C") +pub proc entrypoint( + +) + push.1114208 u32divmod.4 swap.1 trace.240 @@ -31,7 +34,7 @@ export.entrypoint nop push.16 u32wrapping_sub - push.1114176 + push.1114208 dup.1 swap.1 u32divmod.4 @@ -46,7 +49,7 @@ export.entrypoint u32wrapping_add trace.240 nop - exec.::root_ns:root@1.0.0::abi_transform_tx_kernel_get_inputs_4::miden_base_sys::bindings::note::get_inputs + exec.::root_ns:root@1.0.0::abi_transform_tx_kernel_get_inputs_4::miden_base_sys::bindings::active_note::get_inputs trace.252 nop push.12 @@ -273,7 +276,7 @@ export.entrypoint push.16 movup.2 u32wrapping_add - push.1114176 + push.1114208 u32divmod.4 swap.1 trace.240 @@ -299,8 +302,9 @@ export.entrypoint end end -proc.__rustc::__rust_alloc - push.1048640 +@callconv("C") +proc __rustc::__rust_alloc(i32, i32) -> i32 + push.1048648 movup.2 swap.1 trace.240 @@ -310,14 +314,16 @@ proc.__rustc::__rust_alloc nop end -proc.__rustc::__rust_dealloc +@callconv("C") +proc __rustc::__rust_dealloc(i32, i32, i32) drop drop drop end -proc.__rustc::__rust_realloc - push.1048640 +@callconv("C") +proc __rustc::__rust_realloc(i32, i32, i32, i32) -> i32 + push.1048648 dup.4 swap.2 swap.4 @@ -419,8 +425,9 @@ proc.__rustc::__rust_realloc end end -proc.__rustc::__rust_alloc_zeroed - push.1048640 +@callconv("C") +proc __rustc::__rust_alloc_zeroed(i32, i32) -> i32 + push.1048648 dup.1 swap.2 swap.3 @@ -494,11 +501,19 @@ proc.__rustc::__rust_alloc_zeroed end end -proc.__rustc::__rust_no_alloc_shim_is_unstable_v2 +@callconv("C") +proc __rustc::__rust_no_alloc_shim_is_unstable_v2( + +) nop end -proc.::alloc +@callconv("C") +proc ::alloc( + i32, + i32, + i32 +) -> i32 push.16 push.0 push.16 @@ -673,7 +688,10 @@ proc.::alloc end end -proc.intrinsics::mem::heap_base +@callconv("C") +proc intrinsics::mem::heap_base( + +) -> i32 trace.240 nop exec.::intrinsics::mem::heap_base @@ -681,8 +699,14 @@ proc.intrinsics::mem::heap_base nop end -proc.alloc::raw_vec::RawVecInner::with_capacity_in - push.1114176 +@callconv("C") +proc alloc::raw_vec::RawVecInner::with_capacity_in( + i32, + i32, + i32, + i32 +) + push.1114208 u32divmod.4 swap.1 trace.240 @@ -692,7 +716,7 @@ proc.alloc::raw_vec::RawVecInner::with_capacity_in nop push.16 u32wrapping_sub - push.1114176 + push.1114208 dup.1 swap.1 u32divmod.4 @@ -810,7 +834,7 @@ proc.alloc::raw_vec::RawVecInner::with_capacity_in nop push.16 u32wrapping_add - push.1114176 + push.1114208 u32divmod.4 swap.1 trace.240 @@ -849,8 +873,11 @@ proc.alloc::raw_vec::RawVecInner::with_capacity_in end end -proc.miden_base_sys::bindings::note::get_inputs - push.1114176 +@callconv("C") +proc miden_base_sys::bindings::active_note::get_inputs( + i32 +) + push.1114208 u32divmod.4 swap.1 trace.240 @@ -860,7 +887,7 @@ proc.miden_base_sys::bindings::note::get_inputs nop push.16 u32wrapping_sub - push.1114176 + push.1114208 dup.1 swap.1 u32divmod.4 @@ -870,7 +897,7 @@ proc.miden_base_sys::bindings::note::get_inputs exec.::intrinsics::mem::store_sw trace.252 nop - push.1048620 + push.1048628 push.4 push.8 dup.3 @@ -923,7 +950,7 @@ proc.miden_base_sys::bindings::note::get_inputs u32shr trace.240 nop - exec.::root_ns:root@1.0.0::abi_transform_tx_kernel_get_inputs_4::miden::note::get_inputs + exec.::root_ns:root@1.0.0::abi_transform_tx_kernel_get_inputs_4::miden::active_note::get_inputs trace.252 nop push.8 @@ -976,7 +1003,7 @@ proc.miden_base_sys::bindings::note::get_inputs nop push.16 u32wrapping_add - push.1114176 + push.1114208 u32divmod.4 swap.1 trace.240 @@ -986,20 +1013,30 @@ proc.miden_base_sys::bindings::note::get_inputs nop end -proc.>::from +@callconv("C") +proc >::from( + i32 +) -> felt nop end -proc.intrinsics::felt::from_u32 +@callconv("C") +proc intrinsics::felt::from_u32(i32) -> felt nop end -proc.intrinsics::felt::assert_eq +@callconv("C") +proc intrinsics::felt::assert_eq(felt, felt) assert_eq end -proc.alloc::raw_vec::RawVecInner::deallocate - push.1114176 +@callconv("C") +proc alloc::raw_vec::RawVecInner::deallocate( + i32, + i32, + i32 +) + push.1114208 u32divmod.4 swap.1 trace.240 @@ -1009,7 +1046,7 @@ proc.alloc::raw_vec::RawVecInner::deallocate nop push.16 u32wrapping_sub - push.1114176 + push.1114208 dup.1 swap.1 u32divmod.4 @@ -1100,7 +1137,7 @@ proc.alloc::raw_vec::RawVecInner::deallocate end push.16 u32wrapping_add - push.1114176 + push.1114208 u32divmod.4 swap.1 trace.240 @@ -1110,8 +1147,15 @@ proc.alloc::raw_vec::RawVecInner::deallocate nop end -proc.alloc::raw_vec::RawVecInner::try_allocate_in - push.1114176 +@callconv("C") +proc alloc::raw_vec::RawVecInner::try_allocate_in( + i32, + i32, + i32, + i32, + i32 +) + push.1114208 u32divmod.4 swap.1 trace.240 @@ -1121,7 +1165,7 @@ proc.alloc::raw_vec::RawVecInner::try_allocate_in nop push.16 u32wrapping_sub - push.1114176 + push.1114208 dup.1 swap.1 u32divmod.4 @@ -1506,7 +1550,7 @@ proc.alloc::raw_vec::RawVecInner::try_allocate_in nop push.16 u32wrapping_add - push.1114176 + push.1114208 u32divmod.4 swap.1 trace.240 @@ -1516,8 +1560,13 @@ proc.alloc::raw_vec::RawVecInner::try_allocate_in nop end -proc.::allocate - push.1114176 +@callconv("C") +proc ::allocate( + i32, + i32, + i32 +) + push.1114208 u32divmod.4 swap.1 trace.240 @@ -1527,7 +1576,7 @@ proc.::allocate nop push.16 u32wrapping_sub - push.1114176 + push.1114208 dup.1 swap.1 u32divmod.4 @@ -1620,7 +1669,7 @@ proc.::allocate nop push.16 u32wrapping_add - push.1114176 + push.1114208 u32divmod.4 swap.1 trace.240 @@ -1630,7 +1679,13 @@ proc.::allocate nop end -proc.alloc::alloc::Global::alloc_impl +@callconv("C") +proc alloc::alloc::Global::alloc_impl( + i32, + i32, + i32, + i32 +) push.0 push.0 dup.4 @@ -1702,7 +1757,13 @@ proc.alloc::alloc::Global::alloc_impl nop end -proc.alloc::raw_vec::RawVecInner::current_memory +@callconv("C") +proc alloc::raw_vec::RawVecInner::current_memory( + i32, + i32, + i32, + i32 +) push.0 push.0 dup.5 @@ -1828,7 +1889,12 @@ proc.alloc::raw_vec::RawVecInner::current_memory nop end -proc.::deallocate +@callconv("C") +proc ::deallocate( + i32, + i32, + i32 +) push.0 push.0 dup.4 @@ -1849,7 +1915,8 @@ proc.::deallocate end end -proc.alloc::raw_vec::handle_error +@callconv("C") +proc alloc::raw_vec::handle_error(i32, i32, i32) drop drop drop @@ -1857,7 +1924,8 @@ proc.alloc::raw_vec::handle_error assert end -proc.core::ptr::alignment::Alignment::max +@callconv("C") +proc core::ptr::alignment::Alignment::max(i32, i32) -> i32 push.0 dup.2 dup.2 @@ -1867,17 +1935,19 @@ proc.core::ptr::alignment::Alignment::max cdrop end -proc.miden::note::get_inputs +@callconv("C") +proc miden::active_note::get_inputs(i32) -> i32 trace.240 nop - exec.::miden::note::get_inputs + exec.::miden::active_note::get_inputs trace.252 nop swap.1 drop end -export.cabi_realloc +@callconv("C") +pub proc cabi_realloc(i32, i32, i32, i32) -> i32 trace.240 nop exec.::root_ns:root@1.0.0::abi_transform_tx_kernel_get_inputs_4::cabi_realloc_wit_bindgen_0_46_0 @@ -1885,7 +1955,8 @@ export.cabi_realloc nop end -proc.alloc::alloc::alloc +@callconv("C") +proc alloc::alloc::alloc(i32, i32) -> i32 trace.240 nop exec.::root_ns:root@1.0.0::abi_transform_tx_kernel_get_inputs_4::__rustc::__rust_no_alloc_shim_is_unstable_v2 @@ -1899,7 +1970,8 @@ proc.alloc::alloc::alloc nop end -export.cabi_realloc_wit_bindgen_0_46_0 +@callconv("C") +pub proc cabi_realloc_wit_bindgen_0_46_0(i32, i32, i32, i32) -> i32 trace.240 nop exec.::root_ns:root@1.0.0::abi_transform_tx_kernel_get_inputs_4::wit_bindgen::rt::cabi_realloc @@ -1907,7 +1979,13 @@ export.cabi_realloc_wit_bindgen_0_46_0 nop end -proc.wit_bindgen::rt::cabi_realloc +@callconv("C") +proc wit_bindgen::rt::cabi_realloc( + i32, + i32, + i32, + i32 +) -> i32 push.0 dup.2 neq @@ -1988,15 +2066,15 @@ proc.wit_bindgen::rt::cabi_realloc end end -# mod miden::note +# mod miden::active_note -export.get_inputs +pub proc get_inputs push.4294967295 push.1 push.2 push.3 dup.4 - mem_storew + mem_storew_be dropw push.4 end diff --git a/tests/integration/expected/abi_transform_tx_kernel_get_inputs_4.wat b/tests/integration/expected/abi_transform_tx_kernel_get_inputs_4.wat index ed97b21a5..bc9e8e923 100644 --- a/tests/integration/expected/abi_transform_tx_kernel_get_inputs_4.wat +++ b/tests/integration/expected/abi_transform_tx_kernel_get_inputs_4.wat @@ -29,7 +29,7 @@ local.get 0 i32.const 4 i32.add - call $miden_base_sys::bindings::note::get_inputs + call $miden_base_sys::bindings::active_note::get_inputs local.get 0 i32.load offset=12 local.tee 1 @@ -90,7 +90,7 @@ unreachable ) (func $__rustc::__rust_alloc (;1;) (type 1) (param i32 i32) (result i32) - i32.const 1048640 + i32.const 1048648 local.get 1 local.get 0 call $::alloc @@ -98,7 +98,7 @@ (func $__rustc::__rust_dealloc (;2;) (type 2) (param i32 i32 i32)) (func $__rustc::__rust_realloc (;3;) (type 3) (param i32 i32 i32 i32) (result i32) block ;; label = @1 - i32.const 1048640 + i32.const 1048648 local.get 2 local.get 3 call $::alloc @@ -123,7 +123,7 @@ ) (func $__rustc::__rust_alloc_zeroed (;4;) (type 1) (param i32 i32) (result i32) block ;; label = @1 - i32.const 1048640 + i32.const 1048648 local.get 1 local.get 0 call $::alloc @@ -261,7 +261,7 @@ i32.add global.set $__stack_pointer ) - (func $miden_base_sys::bindings::note::get_inputs (;9;) (type 7) (param i32) + (func $miden_base_sys::bindings::active_note::get_inputs (;9;) (type 7) (param i32) (local i32 i32 i32) global.get $__stack_pointer i32.const 16 @@ -273,7 +273,7 @@ i32.add i32.const 4 i32.const 4 - i32.const 1048620 + i32.const 1048628 call $alloc::raw_vec::RawVecInner::with_capacity_in local.get 1 i32.load offset=8 @@ -284,7 +284,7 @@ local.tee 3 i32.const 2 i32.shr_u - call $miden::note::get_inputs + call $miden::active_note::get_inputs i32.store offset=8 local.get 0 local.get 3 @@ -564,7 +564,7 @@ i32.gt_u select ) - (func $miden::note::get_inputs (;21;) (type 11) (param i32) (result i32) + (func $miden::active_note::get_inputs (;21;) (type 11) (param i32) (result i32) unreachable ) (func $cabi_realloc (;22;) (type 3) (param i32 i32 i32 i32) (result i32) @@ -615,5 +615,5 @@ end local.get 2 ) - (data $.rodata (;0;) (i32.const 1048576) "miden-base-sys-0.7.0/src/bindings/note.rs\00\00\00\00\00\10\00)\00\00\00\19\00\00\00!\00\00\00\01\00\00\00") + (data $.rodata (;0;) (i32.const 1048576) "miden-base-sys-0.7.0/src/bindings/active_note.rs\00\00\00\00\00\00\10\000\00\00\00\19\00\00\00!\00\00\00\01\00\00\00") ) diff --git a/tests/integration/expected/add_felt.masm b/tests/integration/expected/add_felt.masm index 10c6974b8..a874a030f 100644 --- a/tests/integration/expected/add_felt.masm +++ b/tests/integration/expected/add_felt.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -12,7 +12,8 @@ end # mod root_ns:root@1.0.0::add_felt -export.entrypoint +@callconv("C") +pub proc entrypoint(felt, felt) -> felt trace.240 nop exec.::root_ns:root@1.0.0::add_felt::intrinsics::felt::add @@ -20,7 +21,8 @@ export.entrypoint nop end -proc.intrinsics::felt::add +@callconv("C") +proc intrinsics::felt::add(felt, felt) -> felt add end diff --git a/tests/integration/expected/add_i128.masm b/tests/integration/expected/add_i128.masm index 18a7e088e..1206791be 100644 --- a/tests/integration/expected/add_i128.masm +++ b/tests/integration/expected/add_i128.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -18,7 +18,8 @@ end # mod root_ns:root@1.0.0::test_rust_c232a9b0045c768c9a1fca4d8a419280b591a50dcbebe88fe280529cdd423ec0 -export.entrypoint +@callconv("C") +pub proc entrypoint(i32, [u32; 2], [u32; 2], [u32; 2], [u32; 2]) movdn.4 movup.3 movup.3 diff --git a/tests/integration/expected/add_i16.masm b/tests/integration/expected/add_i16.masm index e79bfdcba..01c03e416 100644 --- a/tests/integration/expected/add_i16.masm +++ b/tests/integration/expected/add_i16.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -18,7 +18,8 @@ end # mod root_ns:root@1.0.0::test_rust_06c525756fe79253a5d667de4160df5c89e45269648c98bb21fd9430caec0b19 -export.entrypoint +@callconv("C") +pub proc entrypoint(i32, i32) -> i32 u32wrapping_add end diff --git a/tests/integration/expected/add_i32.masm b/tests/integration/expected/add_i32.masm index 77c61bb48..a6bb1271f 100644 --- a/tests/integration/expected/add_i32.masm +++ b/tests/integration/expected/add_i32.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -18,7 +18,8 @@ end # mod root_ns:root@1.0.0::test_rust_e52816950d9b2deff10441c5aff28d88268e921c4c01a207c8743d871bd3a69f -export.entrypoint +@callconv("C") +pub proc entrypoint(i32, i32) -> i32 u32wrapping_add end diff --git a/tests/integration/expected/add_i64.masm b/tests/integration/expected/add_i64.masm index f7b1eecd1..315c42e67 100644 --- a/tests/integration/expected/add_i64.masm +++ b/tests/integration/expected/add_i64.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -18,7 +18,8 @@ end # mod root_ns:root@1.0.0::test_rust_cc1ebe8ed410a033febcc7c6a7e1b2473b2337e0dff32b08d3c91be5bbc2cc0a -export.entrypoint +@callconv("C") +pub proc entrypoint([u32; 2], [u32; 2]) -> [u32; 2] trace.240 nop exec.::std::math::u64::wrapping_add diff --git a/tests/integration/expected/add_i8.masm b/tests/integration/expected/add_i8.masm index ae2ceaa39..8435cf793 100644 --- a/tests/integration/expected/add_i8.masm +++ b/tests/integration/expected/add_i8.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -18,7 +18,8 @@ end # mod root_ns:root@1.0.0::test_rust_62ba1afb3113b5a2557098b909eff557cd716bf21b07843db3bfb765ff41e9f7 -export.entrypoint +@callconv("C") +pub proc entrypoint(i32, i32) -> i32 u32wrapping_add end diff --git a/tests/integration/expected/add_u128.masm b/tests/integration/expected/add_u128.masm index 947269b5e..7cceaba19 100644 --- a/tests/integration/expected/add_u128.masm +++ b/tests/integration/expected/add_u128.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -18,7 +18,8 @@ end # mod root_ns:root@1.0.0::test_rust_08840461ad34cd3a46fc6a8d8f1a1282c51e37f56df328c1bc8d26d8c7a38f10 -export.entrypoint +@callconv("C") +pub proc entrypoint(i32, [u32; 2], [u32; 2], [u32; 2], [u32; 2]) movdn.4 movup.3 movup.3 diff --git a/tests/integration/expected/add_u16.masm b/tests/integration/expected/add_u16.masm index 226aff79d..dacb36b13 100644 --- a/tests/integration/expected/add_u16.masm +++ b/tests/integration/expected/add_u16.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -18,7 +18,8 @@ end # mod root_ns:root@1.0.0::test_rust_41c5fa21fe36fdf84a953669187b56426048e7b2f08e8de91e3e989c579ed46f -export.entrypoint +@callconv("C") +pub proc entrypoint(i32, i32) -> i32 push.65535 movdn.2 u32wrapping_add diff --git a/tests/integration/expected/add_u32.masm b/tests/integration/expected/add_u32.masm index ff020eee0..fc6471bf9 100644 --- a/tests/integration/expected/add_u32.masm +++ b/tests/integration/expected/add_u32.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -18,7 +18,8 @@ end # mod root_ns:root@1.0.0::test_rust_2aac0275c4e31b615b4d6bf7d39869ccab374d5df702b3ef708ea7f981b4073c -export.entrypoint +@callconv("C") +pub proc entrypoint(i32, i32) -> i32 u32wrapping_add end diff --git a/tests/integration/expected/add_u64.masm b/tests/integration/expected/add_u64.masm index 143ad5e58..b921264c1 100644 --- a/tests/integration/expected/add_u64.masm +++ b/tests/integration/expected/add_u64.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -18,7 +18,8 @@ end # mod root_ns:root@1.0.0::test_rust_2c24c814fbf0c5ee22a60f52279e8f7639d56708da347e071f1130dc19dc9c07 -export.entrypoint +@callconv("C") +pub proc entrypoint([u32; 2], [u32; 2]) -> [u32; 2] trace.240 nop exec.::std::math::u64::wrapping_add diff --git a/tests/integration/expected/add_u8.masm b/tests/integration/expected/add_u8.masm index 73d568513..34aeea1a4 100644 --- a/tests/integration/expected/add_u8.masm +++ b/tests/integration/expected/add_u8.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -18,7 +18,8 @@ end # mod root_ns:root@1.0.0::test_rust_9c74aa9695b645cec4339ff01ac3e35e31b39b1feb0dfeef6ee7c94789fbcfce -export.entrypoint +@callconv("C") +pub proc entrypoint(i32, i32) -> i32 push.255 movdn.2 u32wrapping_add diff --git a/tests/integration/expected/adv_load_preimage.masm b/tests/integration/expected/adv_load_preimage.masm index d951d7085..74ace7d60 100644 --- a/tests/integration/expected/adv_load_preimage.masm +++ b/tests/integration/expected/adv_load_preimage.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -20,7 +20,8 @@ end # mod root_ns:root@1.0.0::adv_load_preimage -export.entrypoint +@callconv("C") +pub proc entrypoint(i32, felt, felt, felt, felt) push.1114176 u32divmod.4 swap.1 @@ -475,7 +476,8 @@ export.entrypoint end end -proc.__rustc::__rust_alloc +@callconv("C") +proc __rustc::__rust_alloc(i32, i32) -> i32 push.1048636 movup.2 swap.1 @@ -486,7 +488,8 @@ proc.__rustc::__rust_alloc nop end -proc.__rustc::__rust_alloc_zeroed +@callconv("C") +proc __rustc::__rust_alloc_zeroed(i32, i32) -> i32 push.1048636 dup.1 swap.2 @@ -561,11 +564,19 @@ proc.__rustc::__rust_alloc_zeroed end end -proc.__rustc::__rust_no_alloc_shim_is_unstable_v2 +@callconv("C") +proc __rustc::__rust_no_alloc_shim_is_unstable_v2( + +) nop end -proc.::alloc +@callconv("C") +proc ::alloc( + i32, + i32, + i32 +) -> i32 push.16 push.0 push.16 @@ -740,7 +751,10 @@ proc.::alloc end end -proc.intrinsics::mem::heap_base +@callconv("C") +proc intrinsics::mem::heap_base( + +) -> i32 trace.240 nop exec.::intrinsics::mem::heap_base @@ -748,7 +762,8 @@ proc.intrinsics::mem::heap_base nop end -proc.intrinsics::felt::from_u64_unchecked +@callconv("C") +proc intrinsics::felt::from_u64_unchecked([u32; 2]) -> felt dup.1 dup.1 push.1 @@ -763,19 +778,23 @@ proc.intrinsics::felt::from_u64_unchecked add end -proc.intrinsics::felt::from_u32 +@callconv("C") +proc intrinsics::felt::from_u32(i32) -> felt nop end -proc.intrinsics::felt::as_u64 +@callconv("C") +proc intrinsics::felt::as_u64(felt) -> [u32; 2] u32split end -proc.intrinsics::felt::assert_eq +@callconv("C") +proc intrinsics::felt::assert_eq(felt, felt) assert_eq end -proc.intrinsics::advice::adv_push_mapvaln +@callconv("C") +proc intrinsics::advice::adv_push_mapvaln(felt, felt, felt, felt) -> felt trace.240 nop exec.::intrinsics::advice::adv_push_mapvaln @@ -783,7 +802,8 @@ proc.intrinsics::advice::adv_push_mapvaln nop end -proc.std::mem::pipe_preimage_to_memory +@callconv("C") +proc std::mem::pipe_preimage_to_memory(felt, i32, felt, felt, felt, felt) -> i32 trace.240 nop exec.::std::mem::pipe_preimage_to_memory @@ -791,7 +811,14 @@ proc.std::mem::pipe_preimage_to_memory nop end -proc.alloc::raw_vec::RawVecInner::try_allocate_in +@callconv("C") +proc alloc::raw_vec::RawVecInner::try_allocate_in( + i32, + i32, + i32, + i32, + i32 +) push.1114176 u32divmod.4 swap.1 @@ -1197,7 +1224,12 @@ proc.alloc::raw_vec::RawVecInner::try_allocate_in nop end -proc.::allocate +@callconv("C") +proc ::allocate( + i32, + i32, + i32 +) push.1114176 u32divmod.4 swap.1 @@ -1311,7 +1343,13 @@ proc.::allocate nop end -proc.alloc::alloc::Global::alloc_impl +@callconv("C") +proc alloc::alloc::Global::alloc_impl( + i32, + i32, + i32, + i32 +) push.0 push.0 dup.4 @@ -1383,7 +1421,8 @@ proc.alloc::alloc::Global::alloc_impl nop end -proc.alloc::raw_vec::handle_error +@callconv("C") +proc alloc::raw_vec::handle_error(i32, i32, i32) drop drop drop @@ -1391,7 +1430,8 @@ proc.alloc::raw_vec::handle_error assert end -proc.core::ptr::alignment::Alignment::max +@callconv("C") +proc core::ptr::alignment::Alignment::max(i32, i32) -> i32 push.0 dup.2 dup.2 diff --git a/tests/integration/expected/and_bool.masm b/tests/integration/expected/and_bool.masm index 1c574e596..218b104a1 100644 --- a/tests/integration/expected/and_bool.masm +++ b/tests/integration/expected/and_bool.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -18,7 +18,8 @@ end # mod root_ns:root@1.0.0::test_rust_f19303d702f807a0f2b8aebdfd8b2b6ae52ee927040711d5dfd94aac9e67f2c7 -export.entrypoint +@callconv("C") +pub proc entrypoint(i32, i32) -> i32 u32and end diff --git a/tests/integration/expected/band_i16.masm b/tests/integration/expected/band_i16.masm index a9dcd7af5..a42dacd8f 100644 --- a/tests/integration/expected/band_i16.masm +++ b/tests/integration/expected/band_i16.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -18,7 +18,8 @@ end # mod root_ns:root@1.0.0::test_rust_34638703ab78fea8050898ab92e28a6a09cade611d4a9a3601c8667b275e57ee -export.entrypoint +@callconv("C") +pub proc entrypoint(i32, i32) -> i32 u32and end diff --git a/tests/integration/expected/band_i32.masm b/tests/integration/expected/band_i32.masm index 98af1e079..745ba7808 100644 --- a/tests/integration/expected/band_i32.masm +++ b/tests/integration/expected/band_i32.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -18,7 +18,8 @@ end # mod root_ns:root@1.0.0::test_rust_9ee88137407daefa6fa252f24e800d9fc4690951edfe7f8303f2f5225ed6eea3 -export.entrypoint +@callconv("C") +pub proc entrypoint(i32, i32) -> i32 u32and end diff --git a/tests/integration/expected/band_i64.masm b/tests/integration/expected/band_i64.masm index c9ea01c35..b9bdfe325 100644 --- a/tests/integration/expected/band_i64.masm +++ b/tests/integration/expected/band_i64.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -18,7 +18,8 @@ end # mod root_ns:root@1.0.0::test_rust_fdee33d480318f3f6165aabcaf90e290011f2d459d009ce9a6ea019e73b0e6b4 -export.entrypoint +@callconv("C") +pub proc entrypoint([u32; 2], [u32; 2]) -> [u32; 2] trace.240 nop exec.::std::math::u64::and diff --git a/tests/integration/expected/band_i8.masm b/tests/integration/expected/band_i8.masm index 93e2ae29c..9c93cfd52 100644 --- a/tests/integration/expected/band_i8.masm +++ b/tests/integration/expected/band_i8.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -18,7 +18,8 @@ end # mod root_ns:root@1.0.0::test_rust_a20ca31834cfb559286ab8bbb00ce2e657f38ec95d8459342621bc218581241d -export.entrypoint +@callconv("C") +pub proc entrypoint(i32, i32) -> i32 u32and end diff --git a/tests/integration/expected/band_u16.masm b/tests/integration/expected/band_u16.masm index 8fdd30a02..6649c8583 100644 --- a/tests/integration/expected/band_u16.masm +++ b/tests/integration/expected/band_u16.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -18,7 +18,8 @@ end # mod root_ns:root@1.0.0::test_rust_41457a077e1338454c33613079552cd2abe9d4fd50975cf8d2d8d9ee664dfbb6 -export.entrypoint +@callconv("C") +pub proc entrypoint(i32, i32) -> i32 u32and end diff --git a/tests/integration/expected/band_u32.masm b/tests/integration/expected/band_u32.masm index b678ce1cb..7949c1312 100644 --- a/tests/integration/expected/band_u32.masm +++ b/tests/integration/expected/band_u32.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -18,7 +18,8 @@ end # mod root_ns:root@1.0.0::test_rust_82d1878f26a40c75c635298e80f65f7a5aac492ad99eb90909a97ab273f4c1ad -export.entrypoint +@callconv("C") +pub proc entrypoint(i32, i32) -> i32 u32and end diff --git a/tests/integration/expected/band_u64.masm b/tests/integration/expected/band_u64.masm index 4e0777c7d..d6c5ccba9 100644 --- a/tests/integration/expected/band_u64.masm +++ b/tests/integration/expected/band_u64.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -18,7 +18,8 @@ end # mod root_ns:root@1.0.0::test_rust_8509e2e84a91835b60f651a4adb33e43024ab7f31520e5ee5b5a97f181859a40 -export.entrypoint +@callconv("C") +pub proc entrypoint([u32; 2], [u32; 2]) -> [u32; 2] trace.240 nop exec.::std::math::u64::and diff --git a/tests/integration/expected/band_u8.masm b/tests/integration/expected/band_u8.masm index 859b3560b..c59aadff3 100644 --- a/tests/integration/expected/band_u8.masm +++ b/tests/integration/expected/band_u8.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -18,7 +18,8 @@ end # mod root_ns:root@1.0.0::test_rust_3be102ea36db2b23b9f6f0e34bfb210f4f562d75c14b2d53d64bdcc630a44aa6 -export.entrypoint +@callconv("C") +pub proc entrypoint(i32, i32) -> i32 u32and end diff --git a/tests/integration/expected/bnot_bool.masm b/tests/integration/expected/bnot_bool.masm index b0358e3e4..e7620b61c 100644 --- a/tests/integration/expected/bnot_bool.masm +++ b/tests/integration/expected/bnot_bool.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -18,7 +18,8 @@ end # mod root_ns:root@1.0.0::test_rust_77ff166ebf5be0d308b881f765d5f8ef913f838ea7e86a97499b030fa1c0f3f4 -export.entrypoint +@callconv("C") +pub proc entrypoint(i32) -> i32 push.1 u32xor end diff --git a/tests/integration/expected/bnot_i16.masm b/tests/integration/expected/bnot_i16.masm index 7e7d36549..ac7f96e09 100644 --- a/tests/integration/expected/bnot_i16.masm +++ b/tests/integration/expected/bnot_i16.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -18,7 +18,8 @@ end # mod root_ns:root@1.0.0::test_rust_e24d4ca783335c84dc5ae676aec479bda06baf4852fc00f30dac4021d07cf59f -export.entrypoint +@callconv("C") +pub proc entrypoint(i32) -> i32 push.4294967295 u32xor end diff --git a/tests/integration/expected/bnot_i32.masm b/tests/integration/expected/bnot_i32.masm index dfdfc233a..b44839e9a 100644 --- a/tests/integration/expected/bnot_i32.masm +++ b/tests/integration/expected/bnot_i32.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -18,7 +18,8 @@ end # mod root_ns:root@1.0.0::test_rust_0d63a98a6809a92584f1dbaab4dfd841caaf9cab88744275bd4ed034006fc6ed -export.entrypoint +@callconv("C") +pub proc entrypoint(i32) -> i32 push.4294967295 u32xor end diff --git a/tests/integration/expected/bnot_i64.masm b/tests/integration/expected/bnot_i64.masm index 1d848322d..0d2acc101 100644 --- a/tests/integration/expected/bnot_i64.masm +++ b/tests/integration/expected/bnot_i64.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -18,7 +18,8 @@ end # mod root_ns:root@1.0.0::test_rust_b907170bd28f219043267cdd24dc67337632f05fcaab8f9a4efb14def28e8e3e -export.entrypoint +@callconv("C") +pub proc entrypoint([u32; 2]) -> [u32; 2] push.4294967295 push.4294967295 trace.240 diff --git a/tests/integration/expected/bnot_i8.masm b/tests/integration/expected/bnot_i8.masm index 1d9ba18f3..ac85380ad 100644 --- a/tests/integration/expected/bnot_i8.masm +++ b/tests/integration/expected/bnot_i8.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -18,7 +18,8 @@ end # mod root_ns:root@1.0.0::test_rust_1f608e193c7b4c41422a7e789e491655410126a59a757a5572c1ed81892c7c0b -export.entrypoint +@callconv("C") +pub proc entrypoint(i32) -> i32 push.4294967295 u32xor end diff --git a/tests/integration/expected/bnot_u16.masm b/tests/integration/expected/bnot_u16.masm index ab891ead8..2d5c95ac7 100644 --- a/tests/integration/expected/bnot_u16.masm +++ b/tests/integration/expected/bnot_u16.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -18,7 +18,8 @@ end # mod root_ns:root@1.0.0::test_rust_801b0e92eabaaba12053c65b60b81c5cb57e2d5bf386ab548321cf375005baea -export.entrypoint +@callconv("C") +pub proc entrypoint(i32) -> i32 push.65535 u32xor end diff --git a/tests/integration/expected/bnot_u32.masm b/tests/integration/expected/bnot_u32.masm index feae5fa98..4ce9beb05 100644 --- a/tests/integration/expected/bnot_u32.masm +++ b/tests/integration/expected/bnot_u32.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -18,7 +18,8 @@ end # mod root_ns:root@1.0.0::test_rust_dc5405fd1533a0bda8a8715a70ef89a33300844687446825e2ae7bfc5a34655a -export.entrypoint +@callconv("C") +pub proc entrypoint(i32) -> i32 push.4294967295 u32xor end diff --git a/tests/integration/expected/bnot_u64.masm b/tests/integration/expected/bnot_u64.masm index 82079d84f..466a668ac 100644 --- a/tests/integration/expected/bnot_u64.masm +++ b/tests/integration/expected/bnot_u64.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -18,7 +18,8 @@ end # mod root_ns:root@1.0.0::test_rust_345f3c1e58fe5c9ef31421da6a362d9cadbf519ad68045840229e8b76f58a4f4 -export.entrypoint +@callconv("C") +pub proc entrypoint([u32; 2]) -> [u32; 2] push.4294967295 push.4294967295 trace.240 diff --git a/tests/integration/expected/bnot_u8.masm b/tests/integration/expected/bnot_u8.masm index 6dcd87b8f..b0764405f 100644 --- a/tests/integration/expected/bnot_u8.masm +++ b/tests/integration/expected/bnot_u8.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -18,7 +18,8 @@ end # mod root_ns:root@1.0.0::test_rust_5e3a237ba6b351b72bc4ac66517613ffe85ccd4b728c40b405f3a9ff93506063 -export.entrypoint +@callconv("C") +pub proc entrypoint(i32) -> i32 push.255 u32xor end diff --git a/tests/integration/expected/bor_i16.masm b/tests/integration/expected/bor_i16.masm index a2ea47f9e..1dbf87d4e 100644 --- a/tests/integration/expected/bor_i16.masm +++ b/tests/integration/expected/bor_i16.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -18,7 +18,8 @@ end # mod root_ns:root@1.0.0::test_rust_44e33b9e14fa2be1f40cdd20712edb995a941e3a1a153b46fb87e39dcbcdebc1 -export.entrypoint +@callconv("C") +pub proc entrypoint(i32, i32) -> i32 u32or end diff --git a/tests/integration/expected/bor_i32.masm b/tests/integration/expected/bor_i32.masm index 533074be7..70a33561d 100644 --- a/tests/integration/expected/bor_i32.masm +++ b/tests/integration/expected/bor_i32.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -18,7 +18,8 @@ end # mod root_ns:root@1.0.0::test_rust_e24b176dbd0fa5b54e01370fc307f6f1a06748cd8946e58e7d1469dceadc6d92 -export.entrypoint +@callconv("C") +pub proc entrypoint(i32, i32) -> i32 u32or end diff --git a/tests/integration/expected/bor_i64.masm b/tests/integration/expected/bor_i64.masm index 2d1eca6c1..8fd5c1cdb 100644 --- a/tests/integration/expected/bor_i64.masm +++ b/tests/integration/expected/bor_i64.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -18,7 +18,8 @@ end # mod root_ns:root@1.0.0::test_rust_19d92981d2d7f148eaa97011bd0bd979fbc793cadadb334c67791824f38e7bf8 -export.entrypoint +@callconv("C") +pub proc entrypoint([u32; 2], [u32; 2]) -> [u32; 2] trace.240 nop exec.::std::math::u64::or diff --git a/tests/integration/expected/bor_i8.masm b/tests/integration/expected/bor_i8.masm index eacd6f757..8dbd5921e 100644 --- a/tests/integration/expected/bor_i8.masm +++ b/tests/integration/expected/bor_i8.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -18,7 +18,8 @@ end # mod root_ns:root@1.0.0::test_rust_6b279a51e04f2b6fc0be10e9ad685e34fcfc2cbc2c726847699f4721f48e3713 -export.entrypoint +@callconv("C") +pub proc entrypoint(i32, i32) -> i32 u32or end diff --git a/tests/integration/expected/bor_u16.masm b/tests/integration/expected/bor_u16.masm index cb0dfae2f..0f94176f1 100644 --- a/tests/integration/expected/bor_u16.masm +++ b/tests/integration/expected/bor_u16.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -18,7 +18,8 @@ end # mod root_ns:root@1.0.0::test_rust_fe8fe146eac1710c2c8529e4df4810118e471d0c279c48e765ff28ad800d1aab -export.entrypoint +@callconv("C") +pub proc entrypoint(i32, i32) -> i32 u32or end diff --git a/tests/integration/expected/bor_u32.masm b/tests/integration/expected/bor_u32.masm index d5ee7afa7..bd58a5089 100644 --- a/tests/integration/expected/bor_u32.masm +++ b/tests/integration/expected/bor_u32.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -18,7 +18,8 @@ end # mod root_ns:root@1.0.0::test_rust_e3bb04a56c487ecfc0dd1c57e0d354745ffb321466dc47bd02d51513cc6980d1 -export.entrypoint +@callconv("C") +pub proc entrypoint(i32, i32) -> i32 u32or end diff --git a/tests/integration/expected/bor_u64.masm b/tests/integration/expected/bor_u64.masm index 6351632b2..083fcafa8 100644 --- a/tests/integration/expected/bor_u64.masm +++ b/tests/integration/expected/bor_u64.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -18,7 +18,8 @@ end # mod root_ns:root@1.0.0::test_rust_e8616ef7e15d87b491a1dbcccfe42b1dcb7a90b965c27549b2b5d9604d28acee -export.entrypoint +@callconv("C") +pub proc entrypoint([u32; 2], [u32; 2]) -> [u32; 2] trace.240 nop exec.::std::math::u64::or diff --git a/tests/integration/expected/bor_u8.masm b/tests/integration/expected/bor_u8.masm index 6ceaa3dd0..244b827d4 100644 --- a/tests/integration/expected/bor_u8.masm +++ b/tests/integration/expected/bor_u8.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -18,7 +18,8 @@ end # mod root_ns:root@1.0.0::test_rust_a0d8359c86d6548c3cdc5448b2a38351e3498e1db98a8d3d4bbbc27afa05af09 -export.entrypoint +@callconv("C") +pub proc entrypoint(i32, i32) -> i32 u32or end diff --git a/tests/integration/expected/bxor_i16.masm b/tests/integration/expected/bxor_i16.masm index 77a83dd45..4eea528bc 100644 --- a/tests/integration/expected/bxor_i16.masm +++ b/tests/integration/expected/bxor_i16.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -18,7 +18,8 @@ end # mod root_ns:root@1.0.0::test_rust_cb1e0c1a18c279735e94c50dd925290caa430ac65188eb20eb437a4391d25640 -export.entrypoint +@callconv("C") +pub proc entrypoint(i32, i32) -> i32 u32xor end diff --git a/tests/integration/expected/bxor_i32.masm b/tests/integration/expected/bxor_i32.masm index 9e98ce9a7..3296b8b5d 100644 --- a/tests/integration/expected/bxor_i32.masm +++ b/tests/integration/expected/bxor_i32.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -18,7 +18,8 @@ end # mod root_ns:root@1.0.0::test_rust_1c4d375403281e14e710bf442e5556c06e5933dce447f206252657b1345611f0 -export.entrypoint +@callconv("C") +pub proc entrypoint(i32, i32) -> i32 u32xor end diff --git a/tests/integration/expected/bxor_i64.masm b/tests/integration/expected/bxor_i64.masm index f5033bf81..a4830ee6b 100644 --- a/tests/integration/expected/bxor_i64.masm +++ b/tests/integration/expected/bxor_i64.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -18,7 +18,8 @@ end # mod root_ns:root@1.0.0::test_rust_bbe2169ccd3bb4080a705f38ed5ef633d3af9e172e8f9b41ae4ee10f8059e176 -export.entrypoint +@callconv("C") +pub proc entrypoint([u32; 2], [u32; 2]) -> [u32; 2] trace.240 nop exec.::std::math::u64::xor diff --git a/tests/integration/expected/bxor_i8.masm b/tests/integration/expected/bxor_i8.masm index 74b1bb60f..bd9bd9550 100644 --- a/tests/integration/expected/bxor_i8.masm +++ b/tests/integration/expected/bxor_i8.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -18,7 +18,8 @@ end # mod root_ns:root@1.0.0::test_rust_da1dfc177b6a72c28237264497437ada8ba555111d180be7b99b1d60791da41c -export.entrypoint +@callconv("C") +pub proc entrypoint(i32, i32) -> i32 u32xor end diff --git a/tests/integration/expected/bxor_u16.masm b/tests/integration/expected/bxor_u16.masm index 108cc0247..ff8c7d983 100644 --- a/tests/integration/expected/bxor_u16.masm +++ b/tests/integration/expected/bxor_u16.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -18,7 +18,8 @@ end # mod root_ns:root@1.0.0::test_rust_255d3558f03d3b3be3d933d40e9ae32b53db7dd904e40aafd5677d694056c91b -export.entrypoint +@callconv("C") +pub proc entrypoint(i32, i32) -> i32 u32xor end diff --git a/tests/integration/expected/bxor_u32.masm b/tests/integration/expected/bxor_u32.masm index fd09b382b..72a1e8e1a 100644 --- a/tests/integration/expected/bxor_u32.masm +++ b/tests/integration/expected/bxor_u32.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -18,7 +18,8 @@ end # mod root_ns:root@1.0.0::test_rust_b25131cea5088f57eb35dec78eb814ce753ab95c1f4faf8447870d9b6d1525dd -export.entrypoint +@callconv("C") +pub proc entrypoint(i32, i32) -> i32 u32xor end diff --git a/tests/integration/expected/bxor_u64.masm b/tests/integration/expected/bxor_u64.masm index 3142d4a30..f08164607 100644 --- a/tests/integration/expected/bxor_u64.masm +++ b/tests/integration/expected/bxor_u64.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -18,7 +18,8 @@ end # mod root_ns:root@1.0.0::test_rust_ab1d59bc3952451e2ac6a22333bf5458760622594546976d2d1488d607497ae7 -export.entrypoint +@callconv("C") +pub proc entrypoint([u32; 2], [u32; 2]) -> [u32; 2] trace.240 nop exec.::std::math::u64::xor diff --git a/tests/integration/expected/bxor_u8.masm b/tests/integration/expected/bxor_u8.masm index ba2825b6c..d5bb463bf 100644 --- a/tests/integration/expected/bxor_u8.masm +++ b/tests/integration/expected/bxor_u8.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -18,7 +18,8 @@ end # mod root_ns:root@1.0.0::test_rust_e442bdf6f0faa5b55270b06bb284534cce773aa9180fde57cdeeeddf42bb21e6 -export.entrypoint +@callconv("C") +pub proc entrypoint(i32, i32) -> i32 u32xor end diff --git a/tests/integration/expected/collatz.masm b/tests/integration/expected/collatz.masm index 5659061ee..1d10172b4 100644 --- a/tests/integration/expected/collatz.masm +++ b/tests/integration/expected/collatz.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -12,7 +12,8 @@ end # mod root_ns:root@1.0.0::collatz -export.entrypoint +@callconv("C") +pub proc entrypoint(i32) -> i32 push.0 swap.1 push.1 diff --git a/tests/integration/expected/core::cmp::max_u8_u8.masm b/tests/integration/expected/core::cmp::max_u8_u8.masm index de4849e10..915431ef4 100644 --- a/tests/integration/expected/core::cmp::max_u8_u8.masm +++ b/tests/integration/expected/core::cmp::max_u8_u8.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -18,7 +18,8 @@ end # mod root_ns:root@1.0.0::test_rust_adcf2f13ea1f22958c5a92d1674643acc093416b0b2de0fee390636adfcf090a -export.entrypoint +@callconv("C") +pub proc entrypoint(i32, i32) -> i32 push.0 dup.1 dup.3 diff --git a/tests/integration/expected/core::cmp::min_i32_i32.masm b/tests/integration/expected/core::cmp::min_i32_i32.masm index 9f53d02c4..b797a3b95 100644 --- a/tests/integration/expected/core::cmp::min_i32_i32.masm +++ b/tests/integration/expected/core::cmp::min_i32_i32.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -18,7 +18,8 @@ end # mod root_ns:root@1.0.0::test_rust_473cae57ec6aea1b2fa1e6ffdabf82016fbf6e38e3acdf12f2f612d1044a9d0c -export.entrypoint +@callconv("C") +pub proc entrypoint(i32, i32) -> i32 push.0 dup.2 dup.2 diff --git a/tests/integration/expected/core::cmp::min_u32_u32.masm b/tests/integration/expected/core::cmp::min_u32_u32.masm index 47d889167..8d20e3f7b 100644 --- a/tests/integration/expected/core::cmp::min_u32_u32.masm +++ b/tests/integration/expected/core::cmp::min_u32_u32.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -18,7 +18,8 @@ end # mod root_ns:root@1.0.0::test_rust_d58f2727da94ef76690ba318a633249545f9e38779d69d96f04c561d52921cd4 -export.entrypoint +@callconv("C") +pub proc entrypoint(i32, i32) -> i32 push.0 dup.1 dup.3 diff --git a/tests/integration/expected/core::cmp::min_u8_u8.masm b/tests/integration/expected/core::cmp::min_u8_u8.masm index 70074d8b3..da73e0439 100644 --- a/tests/integration/expected/core::cmp::min_u8_u8.masm +++ b/tests/integration/expected/core::cmp::min_u8_u8.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -18,7 +18,8 @@ end # mod root_ns:root@1.0.0::test_rust_86004120286ad9607be152901a86f66a999ee9dd70f4520b4ba4d6af29300327 -export.entrypoint +@callconv("C") +pub proc entrypoint(i32, i32) -> i32 push.0 dup.1 dup.3 diff --git a/tests/integration/expected/div_felt.masm b/tests/integration/expected/div_felt.masm index a3712e043..ffe319f53 100644 --- a/tests/integration/expected/div_felt.masm +++ b/tests/integration/expected/div_felt.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -12,7 +12,8 @@ end # mod root_ns:root@1.0.0::div_felt -export.entrypoint +@callconv("C") +pub proc entrypoint(felt, felt) -> felt trace.240 nop exec.::root_ns:root@1.0.0::div_felt::intrinsics::felt::div @@ -20,7 +21,8 @@ export.entrypoint nop end -proc.intrinsics::felt::div +@callconv("C") +proc intrinsics::felt::div(felt, felt) -> felt swap.1 div end diff --git a/tests/integration/expected/eq_felt.masm b/tests/integration/expected/eq_felt.masm index 74b2aa969..9dacb11d9 100644 --- a/tests/integration/expected/eq_felt.masm +++ b/tests/integration/expected/eq_felt.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -12,7 +12,8 @@ end # mod root_ns:root@1.0.0::eq_felt -export.entrypoint +@callconv("C") +pub proc entrypoint(felt, felt) -> i32 trace.240 nop exec.::root_ns:root@1.0.0::eq_felt::intrinsics::felt::eq @@ -22,7 +23,8 @@ export.entrypoint eq end -proc.intrinsics::felt::eq +@callconv("C") +proc intrinsics::felt::eq(felt, felt) -> i32 eq end diff --git a/tests/integration/expected/eq_i16.masm b/tests/integration/expected/eq_i16.masm index 70d3b8a1a..37f9bf398 100644 --- a/tests/integration/expected/eq_i16.masm +++ b/tests/integration/expected/eq_i16.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -18,7 +18,8 @@ end # mod root_ns:root@1.0.0::test_rust_517fb449f17b407495bba1888d666bc76885dc2541249b2f6cfe05173973099e -export.entrypoint +@callconv("C") +pub proc entrypoint(i32, i32) -> i32 eq end diff --git a/tests/integration/expected/eq_i32.masm b/tests/integration/expected/eq_i32.masm index fa5b90ea7..987fcdfed 100644 --- a/tests/integration/expected/eq_i32.masm +++ b/tests/integration/expected/eq_i32.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -18,7 +18,8 @@ end # mod root_ns:root@1.0.0::test_rust_3a92b0607377b819decb1029f8199a70990302e258cc8ee55f612c4d879c74f4 -export.entrypoint +@callconv("C") +pub proc entrypoint(i32, i32) -> i32 eq end diff --git a/tests/integration/expected/eq_i64.masm b/tests/integration/expected/eq_i64.masm index a76ad3882..84480b6c4 100644 --- a/tests/integration/expected/eq_i64.masm +++ b/tests/integration/expected/eq_i64.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -18,7 +18,8 @@ end # mod root_ns:root@1.0.0::test_rust_bcf098a70fb61198130acb429b0b2900b9c9d11c5cab0241410bb862be7ce2a8 -export.entrypoint +@callconv("C") +pub proc entrypoint([u32; 2], [u32; 2]) -> i32 trace.240 nop exec.::std::math::u64::eq diff --git a/tests/integration/expected/eq_i8.masm b/tests/integration/expected/eq_i8.masm index b3547e844..fc7e6b3f0 100644 --- a/tests/integration/expected/eq_i8.masm +++ b/tests/integration/expected/eq_i8.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -18,7 +18,8 @@ end # mod root_ns:root@1.0.0::test_rust_c2c2ad0caabf21644314027afcbfb75555fa063ab09504517a70196ddd47c892 -export.entrypoint +@callconv("C") +pub proc entrypoint(i32, i32) -> i32 eq end diff --git a/tests/integration/expected/eq_u16.masm b/tests/integration/expected/eq_u16.masm index 9deed334a..1cd5b3003 100644 --- a/tests/integration/expected/eq_u16.masm +++ b/tests/integration/expected/eq_u16.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -18,7 +18,8 @@ end # mod root_ns:root@1.0.0::test_rust_5e53494a4e3a0adfb638a6e562baf4c446d2f54c63ea6d33dec923896f12cea8 -export.entrypoint +@callconv("C") +pub proc entrypoint(i32, i32) -> i32 eq end diff --git a/tests/integration/expected/eq_u32.masm b/tests/integration/expected/eq_u32.masm index 396d8ea31..f541edde3 100644 --- a/tests/integration/expected/eq_u32.masm +++ b/tests/integration/expected/eq_u32.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -18,7 +18,8 @@ end # mod root_ns:root@1.0.0::test_rust_528be949250a0d0dcd9cd0e4c74a012863f8f305b2ac8043a575d81640315ac0 -export.entrypoint +@callconv("C") +pub proc entrypoint(i32, i32) -> i32 eq end diff --git a/tests/integration/expected/eq_u64.masm b/tests/integration/expected/eq_u64.masm index f8aa123b9..5e8532b76 100644 --- a/tests/integration/expected/eq_u64.masm +++ b/tests/integration/expected/eq_u64.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -18,7 +18,8 @@ end # mod root_ns:root@1.0.0::test_rust_90e3e1f038c3b9b7ba2a8c0e9313f59dc3bc3f54fe235a4c5c325df06e46d3b0 -export.entrypoint +@callconv("C") +pub proc entrypoint([u32; 2], [u32; 2]) -> i32 trace.240 nop exec.::std::math::u64::eq diff --git a/tests/integration/expected/eq_u8.masm b/tests/integration/expected/eq_u8.masm index 63b7b38a9..15b3e6c7d 100644 --- a/tests/integration/expected/eq_u8.masm +++ b/tests/integration/expected/eq_u8.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -18,7 +18,8 @@ end # mod root_ns:root@1.0.0::test_rust_909444ffebd8fe6b867a4d7833f385ece2e4ae4363fd04241342e9bef1affc93 -export.entrypoint +@callconv("C") +pub proc entrypoint(i32, i32) -> i32 eq end diff --git a/tests/integration/expected/examples/auth_component_no_auth.hir b/tests/integration/expected/examples/auth_component_no_auth.hir index a4d1ad560..c6157e73a 100644 --- a/tests/integration/expected/examples/auth_component_no_auth.hir +++ b/tests/integration/expected/examples/auth_component_no_auth.hir @@ -23,7 +23,7 @@ builtin.component miden:base/authentication-component@1.0.0 { hir.exec @miden:base/authentication-component@1.0.0/auth_component_no_auth/wit_bindgen::rt::run_ctors_once() v12 = arith.constant 32 : i32; v13 = arith.add v9, v12 : i32 #[overflow = wrapping]; - hir.exec @miden:base/authentication-component@1.0.0/auth_component_no_auth/miden::account::get_initial_commitment(v13) + hir.exec @miden:base/authentication-component@1.0.0/auth_component_no_auth/miden::active_account::get_initial_commitment(v13) v15 = arith.constant 40 : u32; v14 = hir.bitcast v9 : u32; v16 = arith.add v14, v15 : u32 #[overflow = checked]; @@ -61,7 +61,7 @@ builtin.component miden:base/authentication-component@1.0.0 { hir.exec @miden:base/authentication-component@1.0.0/auth_component_no_auth/miden_stdlib_sys::intrinsics::word::Word::reverse(v9, v41) v381 = arith.constant 32 : i32; v43 = arith.add v9, v381 : i32 #[overflow = wrapping]; - hir.exec @miden:base/authentication-component@1.0.0/auth_component_no_auth/miden::account::compute_current_commitment(v43) + hir.exec @miden:base/authentication-component@1.0.0/auth_component_no_auth/miden::active_account::compute_commitment(v43) v380 = arith.constant 40 : u32; v44 = hir.bitcast v9 : u32; v46 = arith.add v44, v380 : u32 #[overflow = checked]; @@ -121,7 +121,7 @@ builtin.component miden:base/authentication-component@1.0.0 { v90 = hir.bitcast v89 : i32; v92 = arith.neq v90, v4 : i1; v327, v328, v329 = scf.if v92 : i32, i32, u32 { - ^block42: + ^block43: v318 = arith.constant 0 : u32; v322 = ub.poison i32 : i32; scf.yield v9, v322, v318; @@ -151,7 +151,7 @@ builtin.component miden:base/authentication-component@1.0.0 { v111 = hir.bitcast v110 : i32; v113 = arith.neq v111, v366 : i1; v334, v335, v336 = scf.if v113 : i32, i32, u32 { - ^block41: + ^block42: v364 = arith.constant 0 : u32; v365 = ub.poison i32 : i32; scf.yield v9, v365, v364; @@ -181,7 +181,7 @@ builtin.component miden:base/authentication-component@1.0.0 { v132 = hir.bitcast v131 : i32; v134 = arith.neq v132, v359 : i1; v340, v341, v342 = scf.if v134 : i32, i32, u32 { - ^block40: + ^block41: v357 = arith.constant 0 : u32; v358 = ub.poison i32 : i32; scf.yield v9, v358, v357; @@ -226,11 +226,11 @@ builtin.component miden:base/authentication-component@1.0.0 { v330 = scf.index_switch v329 : i32 case 0 { ^block12: - v156 = hir.exec @miden:base/authentication-component@1.0.0/auth_component_no_auth/miden::account::incr_nonce() : felt + v156 = hir.exec @miden:base/authentication-component@1.0.0/auth_component_no_auth/miden::native_account::incr_nonce() : felt scf.yield v327; } default { - ^block46: + ^block47: scf.yield v328; }; v349 = arith.constant 64 : i32; @@ -314,7 +314,7 @@ builtin.component miden:base/authentication-component@1.0.0 { v218 = arith.add v194, v217 : i32 #[overflow = wrapping]; v188 = arith.constant 0 : i32; v443, v444, v445, v446, v447, v448 = scf.while v188, v194, v218, v186 : i32, i32, i32, i32, i32, i32 { - ^block57(v449: i32, v450: i32, v451: i32, v452: i32): + ^block58(v449: i32, v450: i32, v451: i32, v452: i32): v471 = arith.constant 0 : i32; v221 = arith.constant 8 : i32; v222 = arith.eq v449, v221 : i1; @@ -322,7 +322,7 @@ builtin.component miden:base/authentication-component@1.0.0 { v224 = hir.bitcast v223 : i32; v226 = arith.neq v224, v471 : i1; v437, v438 = scf.if v226 : i32, i32 { - ^block56: + ^block57: v397 = ub.poison i32 : i32; scf.yield v397, v397; } else { @@ -368,7 +368,7 @@ builtin.component miden:base/authentication-component@1.0.0 { v430 = arith.trunc v442 : i1; scf.condition v430, v437, v439, v438, v440, v450, v452; } do { - ^block58(v453: i32, v454: i32, v455: i32, v456: i32, v457: i32, v458: i32): + ^block59(v453: i32, v454: i32, v455: i32, v456: i32, v457: i32, v458: i32): scf.yield v453, v454, v455, v456; }; v464 = arith.constant 8 : u32; @@ -409,9 +409,9 @@ builtin.component miden:base/authentication-component@1.0.0 { builtin.ret v278; }; - private builtin.function @miden::account::get_initial_commitment(v280: i32) { + private builtin.function @miden::active_account::get_initial_commitment(v280: i32) { ^block29(v280: i32): - v281, v282, v283, v284 = hir.exec @miden/account/get_initial_commitment() : felt, felt, felt, felt + v281, v282, v283, v284 = hir.exec @miden/active_account/get_initial_commitment() : felt, felt, felt, felt v285 = hir.bitcast v280 : u32; v286 = hir.int_to_ptr v285 : ptr; hir.store v286, v281; @@ -430,9 +430,9 @@ builtin.component miden:base/authentication-component@1.0.0 { builtin.ret ; }; - private builtin.function @miden::account::compute_current_commitment(v296: i32) { + private builtin.function @miden::active_account::compute_commitment(v296: i32) { ^block33(v296: i32): - v297, v298, v299, v300 = hir.exec @miden/account/compute_current_commitment() : felt, felt, felt, felt + v297, v298, v299, v300 = hir.exec @miden/active_account/compute_commitment() : felt, felt, felt, felt v301 = hir.bitcast v296 : u32; v302 = hir.int_to_ptr v301 : ptr; hir.store v302, v297; @@ -451,9 +451,9 @@ builtin.component miden:base/authentication-component@1.0.0 { builtin.ret ; }; - private builtin.function @miden::account::incr_nonce() -> felt { + private builtin.function @miden::native_account::incr_nonce() -> felt { ^block35: - v312 = hir.exec @miden/account/incr_nonce() : felt + v312 = hir.exec @miden/native_account/incr_nonce() : felt builtin.ret v312; }; @@ -469,7 +469,7 @@ builtin.component miden:base/authentication-component@1.0.0 { }; public builtin.function @auth__procedure(v314: felt, v315: felt, v316: felt, v317: felt) { - ^block37(v314: felt, v315: felt, v316: felt, v317: felt): + ^block38(v314: felt, v315: felt, v316: felt, v317: felt): hir.exec @miden:base/authentication-component@1.0.0/auth_component_no_auth/miden:base/authentication-component@1.0.0#auth-procedure(v314, v315, v316, v317) builtin.ret ; }; diff --git a/tests/integration/expected/examples/auth_component_no_auth.masm b/tests/integration/expected/examples/auth_component_no_auth.masm index 63a38a148..d3a9e54c8 100644 --- a/tests/integration/expected/examples/auth_component_no_auth.masm +++ b/tests/integration/expected/examples/auth_component_no_auth.masm @@ -1,6 +1,7 @@ # mod miden:base/authentication-component@1.0.0 -export.auth__procedure +@callconv("canon-lift") +pub proc auth__procedure(felt, felt, felt, felt) exec.::miden:base/authentication-component@1.0.0::init trace.240 nop @@ -10,7 +11,7 @@ export.auth__procedure exec.::std::sys::truncate_stack end -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -33,15 +34,27 @@ end # mod miden:base/authentication-component@1.0.0::auth_component_no_auth -proc.__wasm_call_ctors +@callconv("C") +proc __wasm_call_ctors( + +) nop end -proc.auth_component_no_auth::bindings::__link_custom_section_describing_imports +@callconv("C") +proc auth_component_no_auth::bindings::__link_custom_section_describing_imports( + +) nop end -proc.miden:base/authentication-component@1.0.0#auth-procedure +@callconv("C") +proc miden:base/authentication-component@1.0.0#auth-procedure( + felt, + felt, + felt, + felt +) drop drop drop @@ -76,7 +89,7 @@ proc.miden:base/authentication-component@1.0.0#auth-procedure u32wrapping_add trace.240 nop - exec.::miden:base/authentication-component@1.0.0::auth_component_no_auth::miden::account::get_initial_commitment + exec.::miden:base/authentication-component@1.0.0::auth_component_no_auth::miden::active_account::get_initial_commitment trace.252 nop push.40 @@ -161,7 +174,7 @@ proc.miden:base/authentication-component@1.0.0#auth-procedure u32wrapping_add trace.240 nop - exec.::miden:base/authentication-component@1.0.0::auth_component_no_auth::miden::account::compute_current_commitment + exec.::miden:base/authentication-component@1.0.0::auth_component_no_auth::miden::active_account::compute_commitment trace.252 nop push.40 @@ -461,7 +474,7 @@ proc.miden:base/authentication-component@1.0.0#auth-procedure drop trace.240 nop - exec.::miden:base/authentication-component@1.0.0::auth_component_no_auth::miden::account::incr_nonce + exec.::miden:base/authentication-component@1.0.0::auth_component_no_auth::miden::native_account::incr_nonce trace.252 nop drop @@ -480,7 +493,10 @@ proc.miden:base/authentication-component@1.0.0#auth-procedure nop end -proc.wit_bindgen::rt::run_ctors_once +@callconv("C") +proc wit_bindgen::rt::run_ctors_once( + +) push.1114148 u32divmod.4 swap.1 @@ -551,7 +567,11 @@ proc.wit_bindgen::rt::run_ctors_once end end -proc.miden_stdlib_sys::intrinsics::word::Word::reverse +@callconv("C") +proc miden_stdlib_sys::intrinsics::word::Word::reverse( + i32, + i32 +) push.1114144 u32divmod.4 swap.1 @@ -812,14 +832,16 @@ proc.miden_stdlib_sys::intrinsics::word::Word::reverse nop end -proc.intrinsics::felt::eq +@callconv("C") +proc intrinsics::felt::eq(felt, felt) -> i32 eq end -proc.miden::account::get_initial_commitment +@callconv("C") +proc miden::active_account::get_initial_commitment(i32) trace.240 nop - exec.::miden::account::get_initial_commitment + exec.::miden::active_account::get_initial_commitment trace.252 nop movup.4 @@ -871,10 +893,11 @@ proc.miden::account::get_initial_commitment nop end -proc.miden::account::compute_current_commitment +@callconv("C") +proc miden::active_account::compute_commitment(i32) trace.240 nop - exec.::miden::account::compute_current_commitment + exec.::miden::active_account::compute_commitment trace.252 nop movup.4 @@ -926,10 +949,13 @@ proc.miden::account::compute_current_commitment nop end -proc.miden::account::incr_nonce +@callconv("C") +proc miden::native_account::incr_nonce( + +) -> felt trace.240 nop - exec.::miden::account::incr_nonce + exec.::miden::native_account::incr_nonce trace.252 nop end diff --git a/tests/integration/expected/examples/auth_component_no_auth.wat b/tests/integration/expected/examples/auth_component_no_auth.wat index 1178f86c7..7f6a0a377 100644 --- a/tests/integration/expected/examples/auth_component_no_auth.wat +++ b/tests/integration/expected/examples/auth_component_no_auth.wat @@ -36,7 +36,7 @@ local.get 4 i32.const 32 i32.add - call $miden::account::get_initial_commitment + call $miden::active_account::get_initial_commitment local.get 4 local.get 4 i64.load offset=40 @@ -53,7 +53,7 @@ local.get 4 i32.const 32 i32.add - call $miden::account::compute_current_commitment + call $miden::active_account::compute_commitment local.get 4 local.get 4 i64.load offset=40 @@ -104,7 +104,7 @@ i32.eq br_if 1 (;@1;) end - call $miden::account::incr_nonce + call $miden::native_account::incr_nonce drop end local.get 4 @@ -191,13 +191,13 @@ (func $intrinsics::felt::eq (;5;) (type 3) (param f32 f32) (result i32) unreachable ) - (func $miden::account::get_initial_commitment (;6;) (type 4) (param i32) + (func $miden::active_account::get_initial_commitment (;6;) (type 4) (param i32) unreachable ) - (func $miden::account::compute_current_commitment (;7;) (type 4) (param i32) + (func $miden::active_account::compute_commitment (;7;) (type 4) (param i32) unreachable ) - (func $miden::account::incr_nonce (;8;) (type 5) (result f32) + (func $miden::native_account::incr_nonce (;8;) (type 5) (result f32) unreachable ) (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") diff --git a/tests/integration/expected/examples/auth_component_rpo_falcon512.hir b/tests/integration/expected/examples/auth_component_rpo_falcon512.hir index c6af8a36d..3ca45e658 100644 --- a/tests/integration/expected/examples/auth_component_rpo_falcon512.hir +++ b/tests/integration/expected/examples/auth_component_rpo_falcon512.hir @@ -22,10 +22,10 @@ builtin.component miden:base/authentication-component@1.0.0 { hir.store v16, v14; hir.exec @miden:base/authentication-component@1.0.0/auth_component_rpo_falcon512/wit_bindgen::rt::run_ctors_once() v17 = hir.exec @miden:base/authentication-component@1.0.0/auth_component_rpo_falcon512/miden_base_sys::bindings::tx::get_block_number() : felt - v18 = hir.exec @miden:base/authentication-component@1.0.0/auth_component_rpo_falcon512/miden::account::incr_nonce() : felt + v18 = hir.exec @miden:base/authentication-component@1.0.0/auth_component_rpo_falcon512/miden::native_account::incr_nonce() : felt v19 = arith.constant 80 : i32; v20 = arith.add v14, v19 : i32 #[overflow = wrapping]; - hir.exec @miden:base/authentication-component@1.0.0/auth_component_rpo_falcon512/miden::account::compute_delta_commitment(v20) + hir.exec @miden:base/authentication-component@1.0.0/auth_component_rpo_falcon512/miden::native_account::compute_delta_commitment(v20) v22 = arith.constant 88 : u32; v21 = hir.bitcast v14 : u32; v23 = arith.add v21, v22 : u32 #[overflow = checked]; @@ -190,7 +190,7 @@ builtin.component miden:base/authentication-component@1.0.0 { v154 = arith.add v14, v153 : i32 #[overflow = wrapping]; v814 = arith.constant 0 : i32; v747, v748, v749, v750, v751, v752, v753, v754, v755, v756, v757, v758 = scf.while v814, v14, v154, v152, v145, v138, v131 : i32, i32, i32, felt, felt, felt, felt, i32, felt, felt, felt, felt { - ^block85(v759: i32, v760: i32, v761: i32, v762: felt, v763: felt, v764: felt, v765: felt): + ^block86(v759: i32, v760: i32, v761: i32, v762: felt, v763: felt, v764: felt, v765: felt): v812 = arith.constant 0 : i32; v813 = arith.constant 32 : i32; v157 = arith.eq v759, v813 : i1; @@ -198,7 +198,7 @@ builtin.component miden:base/authentication-component@1.0.0 { v159 = hir.bitcast v158 : i32; v161 = arith.neq v159, v812 : i1; v738, v739 = scf.if v161 : i32, i32 { - ^block84: + ^block85: v661 = ub.poison i32 : i32; scf.yield v661, v661; } else { @@ -228,7 +228,7 @@ builtin.component miden:base/authentication-component@1.0.0 { v728 = arith.trunc v746 : i1; scf.condition v728, v738, v740, v739, v741, v742, v743, v744, v760, v762, v763, v764, v765; } do { - ^block86(v766: i32, v767: i32, v768: i32, v769: felt, v770: felt, v771: felt, v772: felt, v773: i32, v774: felt, v775: felt, v776: felt, v777: felt): + ^block87(v766: i32, v767: i32, v768: i32, v769: felt, v770: felt, v771: felt, v772: felt, v773: i32, v774: felt, v775: felt, v776: felt, v777: felt): scf.yield v766, v767, v768, v769, v770, v771, v772; }; v172 = arith.constant 108 : u32; @@ -271,7 +271,7 @@ builtin.component miden:base/authentication-component@1.0.0 { v202 = hir.exec @miden:base/authentication-component@1.0.0/auth_component_rpo_falcon512/>::from(v798) : felt v797 = arith.constant 80 : i32; v204 = arith.add v754, v797 : i32 #[overflow = wrapping]; - hir.exec @miden:base/authentication-component@1.0.0/auth_component_rpo_falcon512/miden::account::get_item(v202, v204) + hir.exec @miden:base/authentication-component@1.0.0/auth_component_rpo_falcon512/miden::active_account::get_item(v202, v204) v796 = arith.constant 88 : u32; v205 = hir.bitcast v754 : u32; v207 = arith.add v205, v796 : u32 #[overflow = checked]; @@ -506,7 +506,7 @@ builtin.component miden:base/authentication-component@1.0.0 { v378 = hir.bitcast v377 : i32; v380 = arith.neq v378, v888 : i1; v882, v883, v884 = scf.if v380 : i32, i32, i32 { - ^block95: + ^block96: v860 = ub.poison i32 : i32; scf.yield v860, v860, v860; } else { @@ -537,7 +537,7 @@ builtin.component miden:base/authentication-component@1.0.0 { v876 = arith.trunc v886 : i1; scf.condition v876, v882, v883, v884; } do { - ^block94(v873: i32, v874: i32, v875: i32): + ^block95(v873: i32, v874: i32, v875: i32): scf.yield v873, v874, v875; }; builtin.ret ; @@ -633,7 +633,7 @@ builtin.component miden:base/authentication-component@1.0.0 { v474 = arith.add v450, v473 : i32 #[overflow = wrapping]; v444 = arith.constant 0 : i32; v950, v951, v952, v953, v954, v955 = scf.while v444, v450, v474, v442 : i32, i32, i32, i32, i32, i32 { - ^block103(v956: i32, v957: i32, v958: i32, v959: i32): + ^block104(v956: i32, v957: i32, v958: i32, v959: i32): v978 = arith.constant 0 : i32; v477 = arith.constant 8 : i32; v478 = arith.eq v956, v477 : i1; @@ -641,7 +641,7 @@ builtin.component miden:base/authentication-component@1.0.0 { v480 = hir.bitcast v479 : i32; v482 = arith.neq v480, v978 : i1; v944, v945 = scf.if v482 : i32, i32 { - ^block102: + ^block103: v904 = ub.poison i32 : i32; scf.yield v904, v904; } else { @@ -687,7 +687,7 @@ builtin.component miden:base/authentication-component@1.0.0 { v937 = arith.trunc v949 : i1; scf.condition v937, v944, v946, v945, v947, v957, v959; } do { - ^block104(v960: i32, v961: i32, v962: i32, v963: i32, v964: i32, v965: i32): + ^block105(v960: i32, v961: i32, v962: i32, v963: i32, v964: i32, v965: i32): scf.yield v960, v961, v962, v963; }; v971 = arith.constant 8 : u32; @@ -772,9 +772,9 @@ builtin.component miden:base/authentication-component@1.0.0 { builtin.ret ; }; - private builtin.function @miden::account::compute_delta_commitment(v576: i32) { + private builtin.function @miden::native_account::compute_delta_commitment(v576: i32) { ^block61(v576: i32): - v577, v578, v579, v580 = hir.exec @miden/account/compute_delta_commitment() : felt, felt, felt, felt + v577, v578, v579, v580 = hir.exec @miden/native_account/compute_delta_commitment() : felt, felt, felt, felt v581 = hir.bitcast v576 : u32; v582 = hir.int_to_ptr v581 : ptr; hir.store v582, v577; @@ -793,9 +793,9 @@ builtin.component miden:base/authentication-component@1.0.0 { builtin.ret ; }; - private builtin.function @miden::account::get_item(v592: felt, v593: i32) { + private builtin.function @miden::active_account::get_item(v592: felt, v593: i32) { ^block65(v592: felt, v593: i32): - v594, v595, v596, v597 = hir.exec @miden/account/get_item(v592) : felt, felt, felt, felt + v594, v595, v596, v597 = hir.exec @miden/active_account/get_item(v592) : felt, felt, felt, felt v598 = hir.bitcast v593 : u32; v599 = hir.int_to_ptr v598 : ptr; hir.store v599, v594; @@ -814,20 +814,20 @@ builtin.component miden:base/authentication-component@1.0.0 { builtin.ret ; }; - private builtin.function @miden::account::incr_nonce() -> felt { - ^block67: - v609 = hir.exec @miden/account/incr_nonce() : felt + private builtin.function @miden::native_account::incr_nonce() -> felt { + ^block68: + v609 = hir.exec @miden/native_account/incr_nonce() : felt builtin.ret v609; }; private builtin.function @miden::tx::get_block_number() -> felt { - ^block69: + ^block70: v611 = hir.exec @miden/tx/get_block_number() : felt builtin.ret v611; }; private builtin.function @miden::tx::get_input_notes_commitment(v613: i32) { - ^block72(v613: i32): + ^block73(v613: i32): v614, v615, v616, v617 = hir.exec @miden/tx/get_input_notes_commitment() : felt, felt, felt, felt v618 = hir.bitcast v613 : u32; v619 = hir.int_to_ptr v618 : ptr; @@ -848,7 +848,7 @@ builtin.component miden:base/authentication-component@1.0.0 { }; private builtin.function @miden::tx::get_output_notes_commitment(v629: i32) { - ^block74(v629: i32): + ^block75(v629: i32): v630, v631, v632, v633 = hir.exec @miden/tx/get_output_notes_commitment() : felt, felt, felt, felt v634 = hir.bitcast v629 : u32; v635 = hir.int_to_ptr v634 : ptr; @@ -880,7 +880,7 @@ builtin.component miden:base/authentication-component@1.0.0 { }; public builtin.function @auth__procedure(v645: felt, v646: felt, v647: felt, v648: felt) { - ^block76(v645: felt, v646: felt, v647: felt, v648: felt): + ^block77(v645: felt, v646: felt, v647: felt, v648: felt): hir.exec @miden:base/authentication-component@1.0.0/auth_component_rpo_falcon512/miden:base/authentication-component@1.0.0#auth-procedure(v645, v646, v647, v648) builtin.ret ; }; diff --git a/tests/integration/expected/examples/auth_component_rpo_falcon512.masm b/tests/integration/expected/examples/auth_component_rpo_falcon512.masm index d505249fa..79e235966 100644 --- a/tests/integration/expected/examples/auth_component_rpo_falcon512.masm +++ b/tests/integration/expected/examples/auth_component_rpo_falcon512.masm @@ -1,6 +1,7 @@ # mod miden:base/authentication-component@1.0.0 -export.auth__procedure +@callconv("canon-lift") +pub proc auth__procedure(felt, felt, felt, felt) exec.::miden:base/authentication-component@1.0.0::init trace.240 nop @@ -10,7 +11,7 @@ export.auth__procedure exec.::std::sys::truncate_stack end -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -33,15 +34,27 @@ end # mod miden:base/authentication-component@1.0.0::auth_component_rpo_falcon512 -proc.__wasm_call_ctors +@callconv("C") +proc __wasm_call_ctors( + +) nop end -proc.auth_component_rpo_falcon512::bindings::__link_custom_section_describing_imports +@callconv("C") +proc auth_component_rpo_falcon512::bindings::__link_custom_section_describing_imports( + +) nop end -proc.miden:base/authentication-component@1.0.0#auth-procedure +@callconv("C") +proc miden:base/authentication-component@1.0.0#auth-procedure( + felt, + felt, + felt, + felt +) drop drop drop @@ -78,7 +91,7 @@ proc.miden:base/authentication-component@1.0.0#auth-procedure nop trace.240 nop - exec.::miden:base/authentication-component@1.0.0::auth_component_rpo_falcon512::miden::account::incr_nonce + exec.::miden:base/authentication-component@1.0.0::auth_component_rpo_falcon512::miden::native_account::incr_nonce trace.252 nop push.80 @@ -86,7 +99,7 @@ proc.miden:base/authentication-component@1.0.0#auth-procedure u32wrapping_add trace.240 nop - exec.::miden:base/authentication-component@1.0.0::auth_component_rpo_falcon512::miden::account::compute_delta_commitment + exec.::miden:base/authentication-component@1.0.0::auth_component_rpo_falcon512::miden::native_account::compute_delta_commitment trace.252 nop push.88 @@ -654,7 +667,7 @@ proc.miden:base/authentication-component@1.0.0#auth-procedure swap.1 trace.240 nop - exec.::miden:base/authentication-component@1.0.0::auth_component_rpo_falcon512::miden::account::get_item + exec.::miden:base/authentication-component@1.0.0::auth_component_rpo_falcon512::miden::active_account::get_item trace.252 nop push.88 @@ -844,7 +857,10 @@ proc.miden:base/authentication-component@1.0.0#auth-procedure nop end -proc.wit_bindgen::rt::run_ctors_once +@callconv("C") +proc wit_bindgen::rt::run_ctors_once( + +) push.1114148 u32divmod.4 swap.1 @@ -915,7 +931,10 @@ proc.wit_bindgen::rt::run_ctors_once end end -proc.miden_base_sys::bindings::tx::get_block_number +@callconv("C") +proc miden_base_sys::bindings::tx::get_block_number( + +) -> felt trace.240 nop exec.::miden:base/authentication-component@1.0.0::auth_component_rpo_falcon512::miden::tx::get_block_number @@ -923,7 +942,10 @@ proc.miden_base_sys::bindings::tx::get_block_number nop end -proc.miden_base_sys::bindings::tx::get_input_notes_commitment +@callconv("C") +proc miden_base_sys::bindings::tx::get_input_notes_commitment( + i32 +) push.1114144 u32divmod.4 swap.1 @@ -1036,7 +1058,10 @@ proc.miden_base_sys::bindings::tx::get_input_notes_commitment nop end -proc.miden_base_sys::bindings::tx::get_output_notes_commitment +@callconv("C") +proc miden_base_sys::bindings::tx::get_output_notes_commitment( + i32 +) push.1114144 u32divmod.4 swap.1 @@ -1149,7 +1174,12 @@ proc.miden_base_sys::bindings::tx::get_output_notes_commitment nop end -proc.core::ptr::swap_nonoverlapping_bytes::swap_nonoverlapping_chunks +@callconv("C") +proc core::ptr::swap_nonoverlapping_bytes::swap_nonoverlapping_chunks( + i32, + i32, + i32 +) movup.2 push.1 while.true @@ -1228,7 +1258,12 @@ proc.core::ptr::swap_nonoverlapping_bytes::swap_nonoverlapping_chunks drop end -proc.miden_stdlib_sys::intrinsics::advice::adv_insert +@callconv("C") +proc miden_stdlib_sys::intrinsics::advice::adv_insert( + i32, + i32, + i32 +) push.12 dup.1 add @@ -1318,12 +1353,19 @@ proc.miden_stdlib_sys::intrinsics::advice::adv_insert nop end -proc.>::from +@callconv("C") +proc >::from( + i32 +) -> felt push.255 u32and end -proc.miden_stdlib_sys::intrinsics::word::Word::reverse +@callconv("C") +proc miden_stdlib_sys::intrinsics::word::Word::reverse( + i32, + i32 +) push.1114144 u32divmod.4 swap.1 @@ -1584,15 +1626,27 @@ proc.miden_stdlib_sys::intrinsics::word::Word::reverse nop end -proc.intrinsics::felt::from_u32 +@callconv("C") +proc intrinsics::felt::from_u32(i32) -> felt nop end -proc.intrinsics::felt::assert_eq +@callconv("C") +proc intrinsics::felt::assert_eq(felt, felt) assert_eq end -proc.intrinsics::advice::emit_falcon_sig_to_stack +@callconv("C") +proc intrinsics::advice::emit_falcon_sig_to_stack( + felt, + felt, + felt, + felt, + felt, + felt, + felt, + felt +) trace.240 nop exec.::intrinsics::advice::emit_falcon_sig_to_stack @@ -1600,7 +1654,8 @@ proc.intrinsics::advice::emit_falcon_sig_to_stack nop end -proc.intrinsics::advice::adv_insert_mem +@callconv("C") +proc intrinsics::advice::adv_insert_mem(felt, felt, felt, felt, i32, i32) trace.240 nop exec.::intrinsics::advice::adv_insert_mem @@ -1608,7 +1663,8 @@ proc.intrinsics::advice::adv_insert_mem nop end -proc.std::crypto::hashes::rpo::hash_memory_words +@callconv("C") +proc std::crypto::hashes::rpo::hash_memory_words(i32, i32, i32) trace.240 nop exec.::std::crypto::hashes::rpo::hash_memory_words @@ -1663,7 +1719,17 @@ proc.std::crypto::hashes::rpo::hash_memory_words nop end -proc.std::crypto::dsa::rpo_falcon512::verify +@callconv("C") +proc std::crypto::dsa::rpo_falcon512::verify( + felt, + felt, + felt, + felt, + felt, + felt, + felt, + felt +) trace.240 nop exec.::std::crypto::dsa::rpo_falcon512::verify @@ -1671,10 +1737,11 @@ proc.std::crypto::dsa::rpo_falcon512::verify nop end -proc.miden::account::compute_delta_commitment +@callconv("C") +proc miden::native_account::compute_delta_commitment(i32) trace.240 nop - exec.::miden::account::compute_delta_commitment + exec.::miden::native_account::compute_delta_commitment trace.252 nop movup.4 @@ -1726,10 +1793,11 @@ proc.miden::account::compute_delta_commitment nop end -proc.miden::account::get_item +@callconv("C") +proc miden::active_account::get_item(felt, i32) trace.240 nop - exec.::miden::account::get_item + exec.::miden::active_account::get_item trace.252 nop movup.4 @@ -1781,15 +1849,21 @@ proc.miden::account::get_item nop end -proc.miden::account::incr_nonce +@callconv("C") +proc miden::native_account::incr_nonce( + +) -> felt trace.240 nop - exec.::miden::account::incr_nonce + exec.::miden::native_account::incr_nonce trace.252 nop end -proc.miden::tx::get_block_number +@callconv("C") +proc miden::tx::get_block_number( + +) -> felt trace.240 nop exec.::miden::tx::get_block_number @@ -1797,7 +1871,8 @@ proc.miden::tx::get_block_number nop end -proc.miden::tx::get_input_notes_commitment +@callconv("C") +proc miden::tx::get_input_notes_commitment(i32) trace.240 nop exec.::miden::tx::get_input_notes_commitment @@ -1852,7 +1927,8 @@ proc.miden::tx::get_input_notes_commitment nop end -proc.miden::tx::get_output_notes_commitment +@callconv("C") +proc miden::tx::get_output_notes_commitment(i32) trace.240 nop exec.::miden::tx::get_output_notes_commitment diff --git a/tests/integration/expected/examples/auth_component_rpo_falcon512.wat b/tests/integration/expected/examples/auth_component_rpo_falcon512.wat index d7a9e4b38..971c63bc7 100644 --- a/tests/integration/expected/examples/auth_component_rpo_falcon512.wat +++ b/tests/integration/expected/examples/auth_component_rpo_falcon512.wat @@ -40,12 +40,12 @@ call $wit_bindgen::rt::run_ctors_once call $miden_base_sys::bindings::tx::get_block_number local.set 5 - call $miden::account::incr_nonce + call $miden::native_account::incr_nonce local.set 6 local.get 4 i32.const 80 i32.add - call $miden::account::compute_delta_commitment + call $miden::native_account::compute_delta_commitment local.get 4 local.get 4 i64.load offset=88 @@ -180,7 +180,7 @@ local.get 4 i32.const 80 i32.add - call $miden::account::get_item + call $miden::active_account::get_item local.get 4 local.get 4 i64.load offset=88 @@ -437,13 +437,13 @@ (func $std::crypto::dsa::rpo_falcon512::verify (;16;) (type 8) (param f32 f32 f32 f32 f32 f32 f32 f32) unreachable ) - (func $miden::account::compute_delta_commitment (;17;) (type 3) (param i32) + (func $miden::native_account::compute_delta_commitment (;17;) (type 3) (param i32) unreachable ) - (func $miden::account::get_item (;18;) (type 10) (param f32 i32) + (func $miden::active_account::get_item (;18;) (type 10) (param f32 i32) unreachable ) - (func $miden::account::incr_nonce (;19;) (type 2) (result f32) + (func $miden::native_account::incr_nonce (;19;) (type 2) (result f32) unreachable ) (func $miden::tx::get_block_number (;20;) (type 2) (result f32) diff --git a/tests/integration/expected/examples/basic_wallet.hir b/tests/integration/expected/examples/basic_wallet.hir index 2787844b3..2febd36fc 100644 --- a/tests/integration/expected/examples/basic_wallet.hir +++ b/tests/integration/expected/examples/basic_wallet.hir @@ -32,30 +32,30 @@ builtin.component miden:basic-wallet/basic-wallet@0.1.0 { v19 = arith.constant 8 : u32; v18 = hir.bitcast v9 : u32; v20 = arith.add v18, v19 : u32 #[overflow = checked]; - v449 = arith.constant 4 : u32; - v22 = arith.mod v20, v449 : u32; + v375 = arith.constant 4 : u32; + v22 = arith.mod v20, v375 : u32; hir.assertz v22 #[code = 250]; v23 = hir.int_to_ptr v20 : ptr; hir.store v23, v2; - v448 = arith.constant 4 : u32; + v374 = arith.constant 4 : u32; v24 = hir.bitcast v9 : u32; - v26 = arith.add v24, v448 : u32 #[overflow = checked]; - v447 = arith.constant 4 : u32; - v28 = arith.mod v26, v447 : u32; + v26 = arith.add v24, v374 : u32 #[overflow = checked]; + v373 = arith.constant 4 : u32; + v28 = arith.mod v26, v373 : u32; hir.assertz v28 #[code = 250]; v29 = hir.int_to_ptr v26 : ptr; hir.store v29, v1; v30 = hir.bitcast v9 : u32; - v446 = arith.constant 4 : u32; - v32 = arith.mod v30, v446 : u32; + v372 = arith.constant 4 : u32; + v32 = arith.mod v30, v372 : u32; hir.assertz v32 #[code = 250]; v33 = hir.int_to_ptr v30 : ptr; hir.store v33, v0; v34 = arith.constant 16 : i32; v35 = arith.add v9, v34 : i32 #[overflow = wrapping]; hir.exec @miden:basic-wallet/basic-wallet@0.1.0/basic_wallet/miden_base_sys::bindings::account::add_asset(v35, v9) - v445 = arith.constant 32 : i32; - v37 = arith.add v9, v445 : i32 #[overflow = wrapping]; + v371 = arith.constant 32 : i32; + v37 = arith.add v9, v371 : i32 #[overflow = wrapping]; v38 = builtin.global_symbol @miden:basic-wallet/basic-wallet@0.1.0/basic_wallet/__stack_pointer : ptr v39 = hir.bitcast v38 : ptr; hir.store v39, v37; @@ -67,7 +67,7 @@ builtin.component miden:basic-wallet/basic-wallet@0.1.0 { v46 = builtin.global_symbol @miden:basic-wallet/basic-wallet@0.1.0/basic_wallet/__stack_pointer : ptr v47 = hir.bitcast v46 : ptr; v48 = hir.load v47 : i32; - v49 = arith.constant 64 : i32; + v49 = arith.constant 32 : i32; v50 = arith.sub v48, v49 : i32 #[overflow = wrapping]; v51 = builtin.global_symbol @miden:basic-wallet/basic-wallet@0.1.0/basic_wallet/__stack_pointer : ptr v52 = hir.bitcast v51 : ptr; @@ -84,482 +84,399 @@ builtin.component miden:basic-wallet/basic-wallet@0.1.0 { v60 = arith.constant 8 : u32; v59 = hir.bitcast v50 : u32; v61 = arith.add v59, v60 : u32 #[overflow = checked]; - v455 = arith.constant 4 : u32; - v63 = arith.mod v61, v455 : u32; + v381 = arith.constant 4 : u32; + v63 = arith.mod v61, v381 : u32; hir.assertz v63 #[code = 250]; v64 = hir.int_to_ptr v61 : ptr; hir.store v64, v42; - v454 = arith.constant 4 : u32; + v380 = arith.constant 4 : u32; v65 = hir.bitcast v50 : u32; - v67 = arith.add v65, v454 : u32 #[overflow = checked]; - v453 = arith.constant 4 : u32; - v69 = arith.mod v67, v453 : u32; + v67 = arith.add v65, v380 : u32 #[overflow = checked]; + v379 = arith.constant 4 : u32; + v69 = arith.mod v67, v379 : u32; hir.assertz v69 #[code = 250]; v70 = hir.int_to_ptr v67 : ptr; hir.store v70, v41; v71 = hir.bitcast v50 : u32; - v452 = arith.constant 4 : u32; - v73 = arith.mod v71, v452 : u32; + v378 = arith.constant 4 : u32; + v73 = arith.mod v71, v378 : u32; hir.assertz v73 #[code = 250]; v74 = hir.int_to_ptr v71 : ptr; hir.store v74, v40; v75 = arith.constant 16 : i32; v76 = arith.add v50, v75 : i32 #[overflow = wrapping]; hir.exec @miden:basic-wallet/basic-wallet@0.1.0/basic_wallet/miden_base_sys::bindings::account::remove_asset(v76, v50) - v451 = arith.constant 16 : i32; - v80 = arith.add v50, v451 : i32 #[overflow = wrapping]; - v77 = arith.constant 32 : i32; - v78 = arith.add v50, v77 : i32 #[overflow = wrapping]; - hir.exec @miden:basic-wallet/basic-wallet@0.1.0/basic_wallet/miden_base_sys::bindings::tx::add_asset_to_note(v78, v80, v44) - v450 = arith.constant 64 : i32; - v82 = arith.add v50, v450 : i32 #[overflow = wrapping]; - v83 = builtin.global_symbol @miden:basic-wallet/basic-wallet@0.1.0/basic_wallet/__stack_pointer : ptr - v84 = hir.bitcast v83 : ptr; - hir.store v84, v82; + v377 = arith.constant 16 : i32; + v78 = arith.add v50, v377 : i32 #[overflow = wrapping]; + hir.exec @miden:basic-wallet/basic-wallet@0.1.0/basic_wallet/miden_base_sys::bindings::output_note::add_asset(v78, v44) + v376 = arith.constant 32 : i32; + v80 = arith.add v50, v376 : i32 #[overflow = wrapping]; + v81 = builtin.global_symbol @miden:basic-wallet/basic-wallet@0.1.0/basic_wallet/__stack_pointer : ptr + v82 = hir.bitcast v81 : ptr; + hir.store v82, v80; builtin.ret ; }; private builtin.function @wit_bindgen::rt::run_ctors_once() { ^block13: - v86 = builtin.global_symbol @miden:basic-wallet/basic-wallet@0.1.0/basic_wallet/GOT.data.internal.__memory_base : ptr - v87 = hir.bitcast v86 : ptr; - v88 = hir.load v87 : i32; - v89 = arith.constant 1048584 : i32; - v90 = arith.add v88, v89 : i32 #[overflow = wrapping]; - v91 = hir.bitcast v90 : u32; - v92 = hir.int_to_ptr v91 : ptr; - v93 = hir.load v92 : u8; - v85 = arith.constant 0 : i32; - v94 = arith.zext v93 : u32; - v95 = hir.bitcast v94 : i32; - v97 = arith.neq v95, v85 : i1; - scf.if v97{ + v84 = builtin.global_symbol @miden:basic-wallet/basic-wallet@0.1.0/basic_wallet/GOT.data.internal.__memory_base : ptr + v85 = hir.bitcast v84 : ptr; + v86 = hir.load v85 : i32; + v87 = arith.constant 1048584 : i32; + v88 = arith.add v86, v87 : i32 #[overflow = wrapping]; + v89 = hir.bitcast v88 : u32; + v90 = hir.int_to_ptr v89 : ptr; + v91 = hir.load v90 : u8; + v83 = arith.constant 0 : i32; + v92 = arith.zext v91 : u32; + v93 = hir.bitcast v92 : i32; + v95 = arith.neq v93, v83 : i1; + scf.if v95{ ^block15: scf.yield ; } else { ^block16: - v98 = builtin.global_symbol @miden:basic-wallet/basic-wallet@0.1.0/basic_wallet/GOT.data.internal.__memory_base : ptr - v99 = hir.bitcast v98 : ptr; - v100 = hir.load v99 : i32; + v96 = builtin.global_symbol @miden:basic-wallet/basic-wallet@0.1.0/basic_wallet/GOT.data.internal.__memory_base : ptr + v97 = hir.bitcast v96 : ptr; + v98 = hir.load v97 : i32; hir.exec @miden:basic-wallet/basic-wallet@0.1.0/basic_wallet/__wasm_call_ctors() - v457 = arith.constant 1 : u8; - v459 = arith.constant 1048584 : i32; - v102 = arith.add v100, v459 : i32 #[overflow = wrapping]; - v106 = hir.bitcast v102 : u32; - v107 = hir.int_to_ptr v106 : ptr; - hir.store v107, v457; + v383 = arith.constant 1 : u8; + v385 = arith.constant 1048584 : i32; + v100 = arith.add v98, v385 : i32 #[overflow = wrapping]; + v104 = hir.bitcast v100 : u32; + v105 = hir.int_to_ptr v104 : ptr; + hir.store v105, v383; scf.yield ; }; builtin.ret ; }; - private builtin.function @miden_base_sys::bindings::account::add_asset(v108: i32, v109: i32) { - ^block17(v108: i32, v109: i32): - v111 = arith.constant 12 : u32; - v110 = hir.bitcast v109 : u32; - v112 = arith.add v110, v111 : u32 #[overflow = checked]; - v113 = arith.constant 4 : u32; - v114 = arith.mod v112, v113 : u32; - hir.assertz v114 #[code = 250]; - v115 = hir.int_to_ptr v112 : ptr; - v116 = hir.load v115 : felt; - v118 = arith.constant 8 : u32; - v117 = hir.bitcast v109 : u32; - v119 = arith.add v117, v118 : u32 #[overflow = checked]; - v463 = arith.constant 4 : u32; - v121 = arith.mod v119, v463 : u32; - hir.assertz v121 #[code = 250]; - v122 = hir.int_to_ptr v119 : ptr; - v123 = hir.load v122 : felt; - v462 = arith.constant 4 : u32; - v124 = hir.bitcast v109 : u32; - v126 = arith.add v124, v462 : u32 #[overflow = checked]; - v461 = arith.constant 4 : u32; - v128 = arith.mod v126, v461 : u32; - hir.assertz v128 #[code = 250]; - v129 = hir.int_to_ptr v126 : ptr; - v130 = hir.load v129 : felt; - v131 = hir.bitcast v109 : u32; - v460 = arith.constant 4 : u32; - v133 = arith.mod v131, v460 : u32; - hir.assertz v133 #[code = 250]; - v134 = hir.int_to_ptr v131 : ptr; - v135 = hir.load v134 : felt; - hir.exec @miden:basic-wallet/basic-wallet@0.1.0/basic_wallet/miden::account::add_asset(v116, v123, v130, v135, v108) + private builtin.function @miden_base_sys::bindings::account::add_asset(v106: i32, v107: i32) { + ^block17(v106: i32, v107: i32): + v109 = arith.constant 12 : u32; + v108 = hir.bitcast v107 : u32; + v110 = arith.add v108, v109 : u32 #[overflow = checked]; + v111 = arith.constant 4 : u32; + v112 = arith.mod v110, v111 : u32; + hir.assertz v112 #[code = 250]; + v113 = hir.int_to_ptr v110 : ptr; + v114 = hir.load v113 : felt; + v116 = arith.constant 8 : u32; + v115 = hir.bitcast v107 : u32; + v117 = arith.add v115, v116 : u32 #[overflow = checked]; + v389 = arith.constant 4 : u32; + v119 = arith.mod v117, v389 : u32; + hir.assertz v119 #[code = 250]; + v120 = hir.int_to_ptr v117 : ptr; + v121 = hir.load v120 : felt; + v388 = arith.constant 4 : u32; + v122 = hir.bitcast v107 : u32; + v124 = arith.add v122, v388 : u32 #[overflow = checked]; + v387 = arith.constant 4 : u32; + v126 = arith.mod v124, v387 : u32; + hir.assertz v126 #[code = 250]; + v127 = hir.int_to_ptr v124 : ptr; + v128 = hir.load v127 : felt; + v129 = hir.bitcast v107 : u32; + v386 = arith.constant 4 : u32; + v131 = arith.mod v129, v386 : u32; + hir.assertz v131 #[code = 250]; + v132 = hir.int_to_ptr v129 : ptr; + v133 = hir.load v132 : felt; + hir.exec @miden:basic-wallet/basic-wallet@0.1.0/basic_wallet/miden::native_account::add_asset(v114, v121, v128, v133, v106) builtin.ret ; }; - private builtin.function @miden_base_sys::bindings::account::remove_asset(v136: i32, v137: i32) { - ^block19(v136: i32, v137: i32): - v139 = builtin.global_symbol @miden:basic-wallet/basic-wallet@0.1.0/basic_wallet/__stack_pointer : ptr - v140 = hir.bitcast v139 : ptr; - v141 = hir.load v140 : i32; - v142 = arith.constant 32 : i32; - v143 = arith.sub v141, v142 : i32 #[overflow = wrapping]; - v144 = builtin.global_symbol @miden:basic-wallet/basic-wallet@0.1.0/basic_wallet/__stack_pointer : ptr - v145 = hir.bitcast v144 : ptr; - hir.store v145, v143; - v147 = arith.constant 12 : u32; - v146 = hir.bitcast v137 : u32; - v148 = arith.add v146, v147 : u32 #[overflow = checked]; - v149 = arith.constant 4 : u32; - v150 = arith.mod v148, v149 : u32; - hir.assertz v150 #[code = 250]; - v151 = hir.int_to_ptr v148 : ptr; - v152 = hir.load v151 : felt; - v154 = arith.constant 8 : u32; - v153 = hir.bitcast v137 : u32; - v155 = arith.add v153, v154 : u32 #[overflow = checked]; - v473 = arith.constant 4 : u32; - v157 = arith.mod v155, v473 : u32; - hir.assertz v157 #[code = 250]; - v158 = hir.int_to_ptr v155 : ptr; - v159 = hir.load v158 : felt; - v472 = arith.constant 4 : u32; - v160 = hir.bitcast v137 : u32; - v162 = arith.add v160, v472 : u32 #[overflow = checked]; - v471 = arith.constant 4 : u32; - v164 = arith.mod v162, v471 : u32; - hir.assertz v164 #[code = 250]; - v165 = hir.int_to_ptr v162 : ptr; - v166 = hir.load v165 : felt; - v167 = hir.bitcast v137 : u32; - v470 = arith.constant 4 : u32; - v169 = arith.mod v167, v470 : u32; - hir.assertz v169 #[code = 250]; - v170 = hir.int_to_ptr v167 : ptr; - v171 = hir.load v170 : felt; - hir.exec @miden:basic-wallet/basic-wallet@0.1.0/basic_wallet/miden::account::remove_asset(v152, v159, v166, v171, v143) - v469 = arith.constant 8 : u32; - v172 = hir.bitcast v143 : u32; - v174 = arith.add v172, v469 : u32 #[overflow = checked]; - v468 = arith.constant 8 : u32; - v176 = arith.mod v174, v468 : u32; - hir.assertz v176 #[code = 250]; - v177 = hir.int_to_ptr v174 : ptr; - v178 = hir.load v177 : i64; - v180 = arith.constant 24 : u32; - v179 = hir.bitcast v143 : u32; - v181 = arith.add v179, v180 : u32 #[overflow = checked]; - v467 = arith.constant 8 : u32; - v183 = arith.mod v181, v467 : u32; - hir.assertz v183 #[code = 250]; - v184 = hir.int_to_ptr v181 : ptr; - hir.store v184, v178; - v185 = hir.bitcast v143 : u32; - v466 = arith.constant 8 : u32; - v187 = arith.mod v185, v466 : u32; - hir.assertz v187 #[code = 250]; - v188 = hir.int_to_ptr v185 : ptr; - v189 = hir.load v188 : i64; - v191 = arith.constant 16 : u32; - v190 = hir.bitcast v143 : u32; - v192 = arith.add v190, v191 : u32 #[overflow = checked]; - v465 = arith.constant 8 : u32; - v194 = arith.mod v192, v465 : u32; - hir.assertz v194 #[code = 250]; - v195 = hir.int_to_ptr v192 : ptr; - hir.store v195, v189; - v196 = arith.constant 16 : i32; - v197 = arith.add v143, v196 : i32 #[overflow = wrapping]; - hir.exec @miden:basic-wallet/basic-wallet@0.1.0/basic_wallet/miden_stdlib_sys::intrinsics::word::Word::reverse(v136, v197) - v464 = arith.constant 32 : i32; - v199 = arith.add v143, v464 : i32 #[overflow = wrapping]; - v200 = builtin.global_symbol @miden:basic-wallet/basic-wallet@0.1.0/basic_wallet/__stack_pointer : ptr - v201 = hir.bitcast v200 : ptr; - hir.store v201, v199; + private builtin.function @miden_base_sys::bindings::account::remove_asset(v134: i32, v135: i32) { + ^block19(v134: i32, v135: i32): + v137 = builtin.global_symbol @miden:basic-wallet/basic-wallet@0.1.0/basic_wallet/__stack_pointer : ptr + v138 = hir.bitcast v137 : ptr; + v139 = hir.load v138 : i32; + v140 = arith.constant 32 : i32; + v141 = arith.sub v139, v140 : i32 #[overflow = wrapping]; + v142 = builtin.global_symbol @miden:basic-wallet/basic-wallet@0.1.0/basic_wallet/__stack_pointer : ptr + v143 = hir.bitcast v142 : ptr; + hir.store v143, v141; + v145 = arith.constant 12 : u32; + v144 = hir.bitcast v135 : u32; + v146 = arith.add v144, v145 : u32 #[overflow = checked]; + v147 = arith.constant 4 : u32; + v148 = arith.mod v146, v147 : u32; + hir.assertz v148 #[code = 250]; + v149 = hir.int_to_ptr v146 : ptr; + v150 = hir.load v149 : felt; + v152 = arith.constant 8 : u32; + v151 = hir.bitcast v135 : u32; + v153 = arith.add v151, v152 : u32 #[overflow = checked]; + v399 = arith.constant 4 : u32; + v155 = arith.mod v153, v399 : u32; + hir.assertz v155 #[code = 250]; + v156 = hir.int_to_ptr v153 : ptr; + v157 = hir.load v156 : felt; + v398 = arith.constant 4 : u32; + v158 = hir.bitcast v135 : u32; + v160 = arith.add v158, v398 : u32 #[overflow = checked]; + v397 = arith.constant 4 : u32; + v162 = arith.mod v160, v397 : u32; + hir.assertz v162 #[code = 250]; + v163 = hir.int_to_ptr v160 : ptr; + v164 = hir.load v163 : felt; + v165 = hir.bitcast v135 : u32; + v396 = arith.constant 4 : u32; + v167 = arith.mod v165, v396 : u32; + hir.assertz v167 #[code = 250]; + v168 = hir.int_to_ptr v165 : ptr; + v169 = hir.load v168 : felt; + hir.exec @miden:basic-wallet/basic-wallet@0.1.0/basic_wallet/miden::native_account::remove_asset(v150, v157, v164, v169, v141) + v395 = arith.constant 8 : u32; + v170 = hir.bitcast v141 : u32; + v172 = arith.add v170, v395 : u32 #[overflow = checked]; + v394 = arith.constant 8 : u32; + v174 = arith.mod v172, v394 : u32; + hir.assertz v174 #[code = 250]; + v175 = hir.int_to_ptr v172 : ptr; + v176 = hir.load v175 : i64; + v178 = arith.constant 24 : u32; + v177 = hir.bitcast v141 : u32; + v179 = arith.add v177, v178 : u32 #[overflow = checked]; + v393 = arith.constant 8 : u32; + v181 = arith.mod v179, v393 : u32; + hir.assertz v181 #[code = 250]; + v182 = hir.int_to_ptr v179 : ptr; + hir.store v182, v176; + v183 = hir.bitcast v141 : u32; + v392 = arith.constant 8 : u32; + v185 = arith.mod v183, v392 : u32; + hir.assertz v185 #[code = 250]; + v186 = hir.int_to_ptr v183 : ptr; + v187 = hir.load v186 : i64; + v189 = arith.constant 16 : u32; + v188 = hir.bitcast v141 : u32; + v190 = arith.add v188, v189 : u32 #[overflow = checked]; + v391 = arith.constant 8 : u32; + v192 = arith.mod v190, v391 : u32; + hir.assertz v192 #[code = 250]; + v193 = hir.int_to_ptr v190 : ptr; + hir.store v193, v187; + v194 = arith.constant 16 : i32; + v195 = arith.add v141, v194 : i32 #[overflow = wrapping]; + hir.exec @miden:basic-wallet/basic-wallet@0.1.0/basic_wallet/miden_stdlib_sys::intrinsics::word::Word::reverse(v134, v195) + v390 = arith.constant 32 : i32; + v197 = arith.add v141, v390 : i32 #[overflow = wrapping]; + v198 = builtin.global_symbol @miden:basic-wallet/basic-wallet@0.1.0/basic_wallet/__stack_pointer : ptr + v199 = hir.bitcast v198 : ptr; + hir.store v199, v197; builtin.ret ; }; - private builtin.function @miden_base_sys::bindings::tx::add_asset_to_note(v202: i32, v203: i32, v204: felt) { - ^block21(v202: i32, v203: i32, v204: felt): - v206 = builtin.global_symbol @miden:basic-wallet/basic-wallet@0.1.0/basic_wallet/__stack_pointer : ptr - v207 = hir.bitcast v206 : ptr; - v208 = hir.load v207 : i32; - v209 = arith.constant 48 : i32; - v210 = arith.sub v208, v209 : i32 #[overflow = wrapping]; - v211 = builtin.global_symbol @miden:basic-wallet/basic-wallet@0.1.0/basic_wallet/__stack_pointer : ptr - v212 = hir.bitcast v211 : ptr; - hir.store v212, v210; - v214 = arith.constant 12 : u32; - v213 = hir.bitcast v203 : u32; - v215 = arith.add v213, v214 : u32 #[overflow = checked]; - v216 = arith.constant 4 : u32; - v217 = arith.mod v215, v216 : u32; - hir.assertz v217 #[code = 250]; - v218 = hir.int_to_ptr v215 : ptr; - v219 = hir.load v218 : felt; - v221 = arith.constant 8 : u32; - v220 = hir.bitcast v203 : u32; - v222 = arith.add v220, v221 : u32 #[overflow = checked]; - v486 = arith.constant 4 : u32; - v224 = arith.mod v222, v486 : u32; - hir.assertz v224 #[code = 250]; - v225 = hir.int_to_ptr v222 : ptr; - v226 = hir.load v225 : felt; - v485 = arith.constant 4 : u32; - v227 = hir.bitcast v203 : u32; - v229 = arith.add v227, v485 : u32 #[overflow = checked]; - v484 = arith.constant 4 : u32; - v231 = arith.mod v229, v484 : u32; - hir.assertz v231 #[code = 250]; - v232 = hir.int_to_ptr v229 : ptr; - v233 = hir.load v232 : felt; - v234 = hir.bitcast v203 : u32; - v483 = arith.constant 4 : u32; - v236 = arith.mod v234, v483 : u32; - hir.assertz v236 #[code = 250]; - v237 = hir.int_to_ptr v234 : ptr; - v238 = hir.load v237 : felt; - hir.exec @miden:basic-wallet/basic-wallet@0.1.0/basic_wallet/miden::tx::add_asset_to_note(v219, v226, v233, v238, v204, v210) - v482 = arith.constant 8 : u32; - v239 = hir.bitcast v210 : u32; - v241 = arith.add v239, v482 : u32 #[overflow = checked]; - v481 = arith.constant 8 : u32; - v243 = arith.mod v241, v481 : u32; - hir.assertz v243 #[code = 250]; - v244 = hir.int_to_ptr v241 : ptr; - v245 = hir.load v244 : i64; - v247 = arith.constant 40 : u32; - v246 = hir.bitcast v210 : u32; - v248 = arith.add v246, v247 : u32 #[overflow = checked]; - v480 = arith.constant 8 : u32; - v250 = arith.mod v248, v480 : u32; - hir.assertz v250 #[code = 250]; - v251 = hir.int_to_ptr v248 : ptr; - hir.store v251, v245; - v252 = hir.bitcast v210 : u32; - v479 = arith.constant 8 : u32; - v254 = arith.mod v252, v479 : u32; - hir.assertz v254 #[code = 250]; - v255 = hir.int_to_ptr v252 : ptr; - v256 = hir.load v255 : i64; - v258 = arith.constant 32 : u32; - v257 = hir.bitcast v210 : u32; - v259 = arith.add v257, v258 : u32 #[overflow = checked]; - v478 = arith.constant 8 : u32; - v261 = arith.mod v259, v478 : u32; - hir.assertz v261 #[code = 250]; - v262 = hir.int_to_ptr v259 : ptr; - hir.store v262, v256; - v264 = arith.constant 16 : u32; - v263 = hir.bitcast v210 : u32; - v265 = arith.add v263, v264 : u32 #[overflow = checked]; - v477 = arith.constant 4 : u32; - v267 = arith.mod v265, v477 : u32; - hir.assertz v267 #[code = 250]; - v268 = hir.int_to_ptr v265 : ptr; - v269 = hir.load v268 : felt; - v270 = arith.constant 32 : i32; - v271 = arith.add v210, v270 : i32 #[overflow = wrapping]; - hir.exec @miden:basic-wallet/basic-wallet@0.1.0/basic_wallet/miden_stdlib_sys::intrinsics::word::Word::reverse(v202, v271) - v476 = arith.constant 16 : u32; - v272 = hir.bitcast v202 : u32; - v274 = arith.add v272, v476 : u32 #[overflow = checked]; - v475 = arith.constant 4 : u32; - v276 = arith.mod v274, v475 : u32; - hir.assertz v276 #[code = 250]; - v277 = hir.int_to_ptr v274 : ptr; - hir.store v277, v269; - v474 = arith.constant 48 : i32; - v279 = arith.add v210, v474 : i32 #[overflow = wrapping]; - v280 = builtin.global_symbol @miden:basic-wallet/basic-wallet@0.1.0/basic_wallet/__stack_pointer : ptr - v281 = hir.bitcast v280 : ptr; - hir.store v281, v279; + private builtin.function @miden_base_sys::bindings::output_note::add_asset(v200: i32, v201: felt) { + ^block21(v200: i32, v201: felt): + v203 = arith.constant 12 : u32; + v202 = hir.bitcast v200 : u32; + v204 = arith.add v202, v203 : u32 #[overflow = checked]; + v205 = arith.constant 4 : u32; + v206 = arith.mod v204, v205 : u32; + hir.assertz v206 #[code = 250]; + v207 = hir.int_to_ptr v204 : ptr; + v208 = hir.load v207 : felt; + v210 = arith.constant 8 : u32; + v209 = hir.bitcast v200 : u32; + v211 = arith.add v209, v210 : u32 #[overflow = checked]; + v403 = arith.constant 4 : u32; + v213 = arith.mod v211, v403 : u32; + hir.assertz v213 #[code = 250]; + v214 = hir.int_to_ptr v211 : ptr; + v215 = hir.load v214 : felt; + v402 = arith.constant 4 : u32; + v216 = hir.bitcast v200 : u32; + v218 = arith.add v216, v402 : u32 #[overflow = checked]; + v401 = arith.constant 4 : u32; + v220 = arith.mod v218, v401 : u32; + hir.assertz v220 #[code = 250]; + v221 = hir.int_to_ptr v218 : ptr; + v222 = hir.load v221 : felt; + v223 = hir.bitcast v200 : u32; + v400 = arith.constant 4 : u32; + v225 = arith.mod v223, v400 : u32; + hir.assertz v225 #[code = 250]; + v226 = hir.int_to_ptr v223 : ptr; + v227 = hir.load v226 : felt; + hir.exec @miden:basic-wallet/basic-wallet@0.1.0/basic_wallet/miden::output_note::add_asset(v208, v215, v222, v227, v201) builtin.ret ; }; - private builtin.function @miden_stdlib_sys::intrinsics::word::Word::reverse(v282: i32, v283: i32) { - ^block23(v282: i32, v283: i32): - v286 = builtin.global_symbol @miden:basic-wallet/basic-wallet@0.1.0/basic_wallet/__stack_pointer : ptr - v287 = hir.bitcast v286 : ptr; - v288 = hir.load v287 : i32; - v289 = arith.constant 16 : i32; - v290 = arith.sub v288, v289 : i32 #[overflow = wrapping]; - v292 = arith.constant 8 : u32; - v291 = hir.bitcast v283 : u32; - v293 = arith.add v291, v292 : u32 #[overflow = checked]; - v573 = arith.constant 8 : u32; - v295 = arith.mod v293, v573 : u32; - hir.assertz v295 #[code = 250]; - v296 = hir.int_to_ptr v293 : ptr; - v297 = hir.load v296 : i64; - v572 = arith.constant 8 : u32; - v298 = hir.bitcast v290 : u32; - v300 = arith.add v298, v572 : u32 #[overflow = checked]; - v301 = arith.constant 4 : u32; - v302 = arith.mod v300, v301 : u32; - hir.assertz v302 #[code = 250]; - v303 = hir.int_to_ptr v300 : ptr; - hir.store v303, v297; - v304 = hir.bitcast v283 : u32; - v571 = arith.constant 8 : u32; - v306 = arith.mod v304, v571 : u32; - hir.assertz v306 #[code = 250]; - v307 = hir.int_to_ptr v304 : ptr; - v308 = hir.load v307 : i64; - v309 = hir.bitcast v290 : u32; - v570 = arith.constant 4 : u32; - v311 = arith.mod v309, v570 : u32; - hir.assertz v311 #[code = 250]; - v312 = hir.int_to_ptr v309 : ptr; - hir.store v312, v308; - v313 = arith.constant 12 : i32; - v314 = arith.add v290, v313 : i32 #[overflow = wrapping]; - v284 = arith.constant 0 : i32; - v541, v542, v543, v544, v545, v546 = scf.while v284, v290, v314, v282 : i32, i32, i32, i32, i32, i32 { - ^block50(v547: i32, v548: i32, v549: i32, v550: i32): - v569 = arith.constant 0 : i32; - v317 = arith.constant 8 : i32; - v318 = arith.eq v547, v317 : i1; - v319 = arith.zext v318 : u32; - v320 = hir.bitcast v319 : i32; - v322 = arith.neq v320, v569 : i1; - v535, v536 = scf.if v322 : i32, i32 { + private builtin.function @miden_stdlib_sys::intrinsics::word::Word::reverse(v228: i32, v229: i32) { + ^block23(v228: i32, v229: i32): + v232 = builtin.global_symbol @miden:basic-wallet/basic-wallet@0.1.0/basic_wallet/__stack_pointer : ptr + v233 = hir.bitcast v232 : ptr; + v234 = hir.load v233 : i32; + v235 = arith.constant 16 : i32; + v236 = arith.sub v234, v235 : i32 #[overflow = wrapping]; + v238 = arith.constant 8 : u32; + v237 = hir.bitcast v229 : u32; + v239 = arith.add v237, v238 : u32 #[overflow = checked]; + v490 = arith.constant 8 : u32; + v241 = arith.mod v239, v490 : u32; + hir.assertz v241 #[code = 250]; + v242 = hir.int_to_ptr v239 : ptr; + v243 = hir.load v242 : i64; + v489 = arith.constant 8 : u32; + v244 = hir.bitcast v236 : u32; + v246 = arith.add v244, v489 : u32 #[overflow = checked]; + v247 = arith.constant 4 : u32; + v248 = arith.mod v246, v247 : u32; + hir.assertz v248 #[code = 250]; + v249 = hir.int_to_ptr v246 : ptr; + hir.store v249, v243; + v250 = hir.bitcast v229 : u32; + v488 = arith.constant 8 : u32; + v252 = arith.mod v250, v488 : u32; + hir.assertz v252 #[code = 250]; + v253 = hir.int_to_ptr v250 : ptr; + v254 = hir.load v253 : i64; + v255 = hir.bitcast v236 : u32; + v487 = arith.constant 4 : u32; + v257 = arith.mod v255, v487 : u32; + hir.assertz v257 #[code = 250]; + v258 = hir.int_to_ptr v255 : ptr; + hir.store v258, v254; + v259 = arith.constant 12 : i32; + v260 = arith.add v236, v259 : i32 #[overflow = wrapping]; + v230 = arith.constant 0 : i32; + v458, v459, v460, v461, v462, v463 = scf.while v230, v236, v260, v228 : i32, i32, i32, i32, i32, i32 { + ^block50(v464: i32, v465: i32, v466: i32, v467: i32): + v486 = arith.constant 0 : i32; + v263 = arith.constant 8 : i32; + v264 = arith.eq v464, v263 : i1; + v265 = arith.zext v264 : u32; + v266 = hir.bitcast v265 : i32; + v268 = arith.neq v266, v486 : i1; + v452, v453 = scf.if v268 : i32, i32 { ^block49: - v495 = ub.poison i32 : i32; - scf.yield v495, v495; + v412 = ub.poison i32 : i32; + scf.yield v412, v412; } else { ^block28: - v324 = arith.add v548, v547 : i32 #[overflow = wrapping]; - v325 = hir.bitcast v324 : u32; - v568 = arith.constant 4 : u32; - v327 = arith.mod v325, v568 : u32; - hir.assertz v327 #[code = 250]; - v328 = hir.int_to_ptr v325 : ptr; - v329 = hir.load v328 : felt; - v331 = hir.bitcast v549 : u32; - v567 = arith.constant 4 : u32; - v333 = arith.mod v331, v567 : u32; - hir.assertz v333 #[code = 250]; - v334 = hir.int_to_ptr v331 : ptr; - v335 = hir.load v334 : i32; - v336 = hir.bitcast v324 : u32; - v566 = arith.constant 4 : u32; - v338 = arith.mod v336, v566 : u32; - hir.assertz v338 #[code = 250]; - v339 = hir.int_to_ptr v336 : ptr; - hir.store v339, v335; - v340 = hir.bitcast v549 : u32; - v565 = arith.constant 4 : u32; - v342 = arith.mod v340, v565 : u32; - hir.assertz v342 #[code = 250]; - v343 = hir.int_to_ptr v340 : ptr; - hir.store v343, v329; - v346 = arith.constant -4 : i32; - v347 = arith.add v549, v346 : i32 #[overflow = wrapping]; - v344 = arith.constant 4 : i32; - v345 = arith.add v547, v344 : i32 #[overflow = wrapping]; - scf.yield v345, v347; + v270 = arith.add v465, v464 : i32 #[overflow = wrapping]; + v271 = hir.bitcast v270 : u32; + v485 = arith.constant 4 : u32; + v273 = arith.mod v271, v485 : u32; + hir.assertz v273 #[code = 250]; + v274 = hir.int_to_ptr v271 : ptr; + v275 = hir.load v274 : felt; + v277 = hir.bitcast v466 : u32; + v484 = arith.constant 4 : u32; + v279 = arith.mod v277, v484 : u32; + hir.assertz v279 #[code = 250]; + v280 = hir.int_to_ptr v277 : ptr; + v281 = hir.load v280 : i32; + v282 = hir.bitcast v270 : u32; + v483 = arith.constant 4 : u32; + v284 = arith.mod v282, v483 : u32; + hir.assertz v284 #[code = 250]; + v285 = hir.int_to_ptr v282 : ptr; + hir.store v285, v281; + v286 = hir.bitcast v466 : u32; + v482 = arith.constant 4 : u32; + v288 = arith.mod v286, v482 : u32; + hir.assertz v288 #[code = 250]; + v289 = hir.int_to_ptr v286 : ptr; + hir.store v289, v275; + v292 = arith.constant -4 : i32; + v293 = arith.add v466, v292 : i32 #[overflow = wrapping]; + v290 = arith.constant 4 : i32; + v291 = arith.add v464, v290 : i32 #[overflow = wrapping]; + scf.yield v291, v293; }; - v563 = ub.poison i32 : i32; - v538 = cf.select v322, v563, v550 : i32; - v564 = ub.poison i32 : i32; - v537 = cf.select v322, v564, v548 : i32; - v494 = arith.constant 1 : u32; - v487 = arith.constant 0 : u32; - v540 = cf.select v322, v487, v494 : u32; - v528 = arith.trunc v540 : i1; - scf.condition v528, v535, v537, v536, v538, v548, v550; + v480 = ub.poison i32 : i32; + v455 = cf.select v268, v480, v467 : i32; + v481 = ub.poison i32 : i32; + v454 = cf.select v268, v481, v465 : i32; + v411 = arith.constant 1 : u32; + v404 = arith.constant 0 : u32; + v457 = cf.select v268, v404, v411 : u32; + v445 = arith.trunc v457 : i1; + scf.condition v445, v452, v454, v453, v455, v465, v467; } do { - ^block51(v551: i32, v552: i32, v553: i32, v554: i32, v555: i32, v556: i32): - scf.yield v551, v552, v553, v554; + ^block51(v468: i32, v469: i32, v470: i32, v471: i32, v472: i32, v473: i32): + scf.yield v468, v469, v470, v471; }; - v562 = arith.constant 8 : u32; - v349 = hir.bitcast v545 : u32; - v351 = arith.add v349, v562 : u32 #[overflow = checked]; - v561 = arith.constant 4 : u32; - v353 = arith.mod v351, v561 : u32; - hir.assertz v353 #[code = 250]; - v354 = hir.int_to_ptr v351 : ptr; - v355 = hir.load v354 : i64; - v560 = arith.constant 8 : u32; - v356 = hir.bitcast v546 : u32; - v358 = arith.add v356, v560 : u32 #[overflow = checked]; - v559 = arith.constant 8 : u32; - v360 = arith.mod v358, v559 : u32; - hir.assertz v360 #[code = 250]; - v361 = hir.int_to_ptr v358 : ptr; - hir.store v361, v355; - v362 = hir.bitcast v545 : u32; - v558 = arith.constant 4 : u32; - v364 = arith.mod v362, v558 : u32; - hir.assertz v364 #[code = 250]; - v365 = hir.int_to_ptr v362 : ptr; - v366 = hir.load v365 : i64; - v367 = hir.bitcast v546 : u32; - v557 = arith.constant 8 : u32; - v369 = arith.mod v367, v557 : u32; - hir.assertz v369 #[code = 250]; - v370 = hir.int_to_ptr v367 : ptr; - hir.store v370, v366; + v479 = arith.constant 8 : u32; + v295 = hir.bitcast v462 : u32; + v297 = arith.add v295, v479 : u32 #[overflow = checked]; + v478 = arith.constant 4 : u32; + v299 = arith.mod v297, v478 : u32; + hir.assertz v299 #[code = 250]; + v300 = hir.int_to_ptr v297 : ptr; + v301 = hir.load v300 : i64; + v477 = arith.constant 8 : u32; + v302 = hir.bitcast v463 : u32; + v304 = arith.add v302, v477 : u32 #[overflow = checked]; + v476 = arith.constant 8 : u32; + v306 = arith.mod v304, v476 : u32; + hir.assertz v306 #[code = 250]; + v307 = hir.int_to_ptr v304 : ptr; + hir.store v307, v301; + v308 = hir.bitcast v462 : u32; + v475 = arith.constant 4 : u32; + v310 = arith.mod v308, v475 : u32; + hir.assertz v310 #[code = 250]; + v311 = hir.int_to_ptr v308 : ptr; + v312 = hir.load v311 : i64; + v313 = hir.bitcast v463 : u32; + v474 = arith.constant 8 : u32; + v315 = arith.mod v313, v474 : u32; + hir.assertz v315 #[code = 250]; + v316 = hir.int_to_ptr v313 : ptr; + hir.store v316, v312; builtin.ret ; }; - private builtin.function @miden::account::add_asset(v371: felt, v372: felt, v373: felt, v374: felt, v375: i32) { - ^block29(v371: felt, v372: felt, v373: felt, v374: felt, v375: i32): - v376, v377, v378, v379 = hir.exec @miden/account/add_asset(v371, v372, v373, v374) : felt, felt, felt, felt - v380 = hir.bitcast v375 : u32; - v381 = hir.int_to_ptr v380 : ptr; - hir.store v381, v376; - v382 = arith.constant 4 : u32; - v383 = arith.add v380, v382 : u32 #[overflow = checked]; - v384 = hir.int_to_ptr v383 : ptr; - hir.store v384, v377; - v385 = arith.constant 8 : u32; - v386 = arith.add v380, v385 : u32 #[overflow = checked]; - v387 = hir.int_to_ptr v386 : ptr; - hir.store v387, v378; - v388 = arith.constant 12 : u32; - v389 = arith.add v380, v388 : u32 #[overflow = checked]; - v390 = hir.int_to_ptr v389 : ptr; - hir.store v390, v379; + private builtin.function @miden::native_account::add_asset(v317: felt, v318: felt, v319: felt, v320: felt, v321: i32) { + ^block29(v317: felt, v318: felt, v319: felt, v320: felt, v321: i32): + v322, v323, v324, v325 = hir.exec @miden/native_account/add_asset(v317, v318, v319, v320) : felt, felt, felt, felt + v326 = hir.bitcast v321 : u32; + v327 = hir.int_to_ptr v326 : ptr; + hir.store v327, v322; + v328 = arith.constant 4 : u32; + v329 = arith.add v326, v328 : u32 #[overflow = checked]; + v330 = hir.int_to_ptr v329 : ptr; + hir.store v330, v323; + v331 = arith.constant 8 : u32; + v332 = arith.add v326, v331 : u32 #[overflow = checked]; + v333 = hir.int_to_ptr v332 : ptr; + hir.store v333, v324; + v334 = arith.constant 12 : u32; + v335 = arith.add v326, v334 : u32 #[overflow = checked]; + v336 = hir.int_to_ptr v335 : ptr; + hir.store v336, v325; builtin.ret ; }; - private builtin.function @miden::account::remove_asset(v391: felt, v392: felt, v393: felt, v394: felt, v395: i32) { - ^block33(v391: felt, v392: felt, v393: felt, v394: felt, v395: i32): - v396, v397, v398, v399 = hir.exec @miden/account/remove_asset(v391, v392, v393, v394) : felt, felt, felt, felt - v400 = hir.bitcast v395 : u32; - v401 = hir.int_to_ptr v400 : ptr; - hir.store v401, v396; - v402 = arith.constant 4 : u32; - v403 = arith.add v400, v402 : u32 #[overflow = checked]; - v404 = hir.int_to_ptr v403 : ptr; - hir.store v404, v397; - v405 = arith.constant 8 : u32; - v406 = arith.add v400, v405 : u32 #[overflow = checked]; - v407 = hir.int_to_ptr v406 : ptr; - hir.store v407, v398; - v408 = arith.constant 12 : u32; - v409 = arith.add v400, v408 : u32 #[overflow = checked]; - v410 = hir.int_to_ptr v409 : ptr; - hir.store v410, v399; + private builtin.function @miden::native_account::remove_asset(v337: felt, v338: felt, v339: felt, v340: felt, v341: i32) { + ^block33(v337: felt, v338: felt, v339: felt, v340: felt, v341: i32): + v342, v343, v344, v345 = hir.exec @miden/native_account/remove_asset(v337, v338, v339, v340) : felt, felt, felt, felt + v346 = hir.bitcast v341 : u32; + v347 = hir.int_to_ptr v346 : ptr; + hir.store v347, v342; + v348 = arith.constant 4 : u32; + v349 = arith.add v346, v348 : u32 #[overflow = checked]; + v350 = hir.int_to_ptr v349 : ptr; + hir.store v350, v343; + v351 = arith.constant 8 : u32; + v352 = arith.add v346, v351 : u32 #[overflow = checked]; + v353 = hir.int_to_ptr v352 : ptr; + hir.store v353, v344; + v354 = arith.constant 12 : u32; + v355 = arith.add v346, v354 : u32 #[overflow = checked]; + v356 = hir.int_to_ptr v355 : ptr; + hir.store v356, v345; builtin.ret ; }; - private builtin.function @miden::tx::add_asset_to_note(v411: felt, v412: felt, v413: felt, v414: felt, v415: felt, v416: i32) { - ^block35(v411: felt, v412: felt, v413: felt, v414: felt, v415: felt, v416: i32): - v417, v418, v419, v420, v421 = hir.exec @miden/tx/add_asset_to_note(v411, v412, v413, v414, v415) : felt, felt, felt, felt, felt - v422 = hir.bitcast v416 : u32; - v423 = hir.int_to_ptr v422 : ptr; - hir.store v423, v417; - v424 = arith.constant 4 : u32; - v425 = arith.add v422, v424 : u32 #[overflow = checked]; - v426 = hir.int_to_ptr v425 : ptr; - hir.store v426, v418; - v427 = arith.constant 8 : u32; - v428 = arith.add v422, v427 : u32 #[overflow = checked]; - v429 = hir.int_to_ptr v428 : ptr; - hir.store v429, v419; - v430 = arith.constant 12 : u32; - v431 = arith.add v422, v430 : u32 #[overflow = checked]; - v432 = hir.int_to_ptr v431 : ptr; - hir.store v432, v420; - v433 = arith.constant 16 : u32; - v434 = arith.add v422, v433 : u32 #[overflow = checked]; - v435 = hir.int_to_ptr v434 : ptr; - hir.store v435, v421; + private builtin.function @miden::output_note::add_asset(v357: felt, v358: felt, v359: felt, v360: felt, v361: felt) { + ^block35(v357: felt, v358: felt, v359: felt, v360: felt, v361: felt): + hir.exec @miden/output_note/add_asset(v357, v358, v359, v360, v361) builtin.ret ; }; @@ -574,15 +491,15 @@ builtin.component miden:basic-wallet/basic-wallet@0.1.0 { builtin.segment @1048576 = 0x0000000100000001; }; - public builtin.function @receive-asset(v436: felt, v437: felt, v438: felt, v439: felt) { - ^block38(v436: felt, v437: felt, v438: felt, v439: felt): - hir.exec @miden:basic-wallet/basic-wallet@0.1.0/basic_wallet/miden:basic-wallet/basic-wallet@0.1.0#receive-asset(v436, v437, v438, v439) + public builtin.function @receive-asset(v362: felt, v363: felt, v364: felt, v365: felt) { + ^block38(v362: felt, v363: felt, v364: felt, v365: felt): + hir.exec @miden:basic-wallet/basic-wallet@0.1.0/basic_wallet/miden:basic-wallet/basic-wallet@0.1.0#receive-asset(v362, v363, v364, v365) builtin.ret ; }; - public builtin.function @move-asset-to-note(v440: felt, v441: felt, v442: felt, v443: felt, v444: felt) { - ^block40(v440: felt, v441: felt, v442: felt, v443: felt, v444: felt): - hir.exec @miden:basic-wallet/basic-wallet@0.1.0/basic_wallet/miden:basic-wallet/basic-wallet@0.1.0#move-asset-to-note(v440, v441, v442, v443, v444) + public builtin.function @move-asset-to-note(v366: felt, v367: felt, v368: felt, v369: felt, v370: felt) { + ^block40(v366: felt, v367: felt, v368: felt, v369: felt, v370: felt): + hir.exec @miden:basic-wallet/basic-wallet@0.1.0/basic_wallet/miden:basic-wallet/basic-wallet@0.1.0#move-asset-to-note(v366, v367, v368, v369, v370) builtin.ret ; }; }; \ No newline at end of file diff --git a/tests/integration/expected/examples/basic_wallet.masm b/tests/integration/expected/examples/basic_wallet.masm index fa173799a..cb029cd9a 100644 --- a/tests/integration/expected/examples/basic_wallet.masm +++ b/tests/integration/expected/examples/basic_wallet.masm @@ -1,6 +1,7 @@ # mod miden:basic-wallet/basic-wallet@0.1.0 -export.receive-asset +@callconv("canon-lift") +pub proc receive-asset(felt, felt, felt, felt) exec.::miden:basic-wallet/basic-wallet@0.1.0::init trace.240 nop @@ -10,7 +11,8 @@ export.receive-asset exec.::std::sys::truncate_stack end -export.move-asset-to-note +@callconv("canon-lift") +pub proc move-asset-to-note(felt, felt, felt, felt, felt) exec.::miden:basic-wallet/basic-wallet@0.1.0::init trace.240 nop @@ -20,7 +22,7 @@ export.move-asset-to-note exec.::std::sys::truncate_stack end -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -43,15 +45,22 @@ end # mod miden:basic-wallet/basic-wallet@0.1.0::basic_wallet -proc.__wasm_call_ctors +@callconv("C") +proc __wasm_call_ctors( + +) nop end -proc.basic_wallet::bindings::__link_custom_section_describing_imports +@callconv("C") +proc basic_wallet::bindings::__link_custom_section_describing_imports( + +) nop end -proc.miden:basic-wallet/basic-wallet@0.1.0#receive-asset +@callconv("C") +proc miden:basic-wallet/basic-wallet@0.1.0#receive-asset(felt, felt, felt, felt) push.1114144 u32divmod.4 swap.1 @@ -172,7 +181,14 @@ proc.miden:basic-wallet/basic-wallet@0.1.0#receive-asset nop end -proc.miden:basic-wallet/basic-wallet@0.1.0#move-asset-to-note +@callconv("C") +proc miden:basic-wallet/basic-wallet@0.1.0#move-asset-to-note( + felt, + felt, + felt, + felt, + felt +) push.1114144 u32divmod.4 swap.1 @@ -181,7 +197,7 @@ proc.miden:basic-wallet/basic-wallet@0.1.0#move-asset-to-note exec.::intrinsics::mem::load_sw trace.252 nop - push.64 + push.32 u32wrapping_sub push.1114144 dup.1 @@ -284,18 +300,14 @@ proc.miden:basic-wallet/basic-wallet@0.1.0#move-asset-to-note push.16 dup.1 u32wrapping_add - push.32 - dup.2 - u32wrapping_add movup.2 - swap.3 - movdn.2 + swap.1 trace.240 nop - exec.::miden:basic-wallet/basic-wallet@0.1.0::basic_wallet::miden_base_sys::bindings::tx::add_asset_to_note + exec.::miden:basic-wallet/basic-wallet@0.1.0::basic_wallet::miden_base_sys::bindings::output_note::add_asset trace.252 nop - push.64 + push.32 u32wrapping_add push.1114144 u32divmod.4 @@ -307,7 +319,10 @@ proc.miden:basic-wallet/basic-wallet@0.1.0#move-asset-to-note nop end -proc.wit_bindgen::rt::run_ctors_once +@callconv("C") +proc wit_bindgen::rt::run_ctors_once( + +) push.1114148 u32divmod.4 swap.1 @@ -378,7 +393,11 @@ proc.wit_bindgen::rt::run_ctors_once end end -proc.miden_base_sys::bindings::account::add_asset +@callconv("C") +proc miden_base_sys::bindings::account::add_asset( + i32, + i32 +) push.12 dup.2 add @@ -448,12 +467,16 @@ proc.miden_base_sys::bindings::account::add_asset swap.2 trace.240 nop - exec.::miden:basic-wallet/basic-wallet@0.1.0::basic_wallet::miden::account::add_asset + exec.::miden:basic-wallet/basic-wallet@0.1.0::basic_wallet::miden::native_account::add_asset trace.252 nop end -proc.miden_base_sys::bindings::account::remove_asset +@callconv("C") +proc miden_base_sys::bindings::account::remove_asset( + i32, + i32 +) push.1114144 u32divmod.4 swap.1 @@ -546,7 +569,7 @@ proc.miden_base_sys::bindings::account::remove_asset swap.4 trace.240 nop - exec.::miden:basic-wallet/basic-wallet@0.1.0::basic_wallet::miden::account::remove_asset + exec.::miden:basic-wallet/basic-wallet@0.1.0::basic_wallet::miden::native_account::remove_asset trace.252 nop push.8 @@ -635,29 +658,13 @@ proc.miden_base_sys::bindings::account::remove_asset nop end -proc.miden_base_sys::bindings::tx::add_asset_to_note - push.1114144 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.48 - u32wrapping_sub - push.1114144 - dup.1 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop +@callconv("C") +proc miden_base_sys::bindings::output_note::add_asset( + i32, + felt +) push.12 - dup.3 + dup.1 add u32assert push.4 @@ -674,7 +681,7 @@ proc.miden_base_sys::bindings::tx::add_asset_to_note trace.252 nop push.8 - dup.4 + dup.2 add u32assert push.4 @@ -691,7 +698,7 @@ proc.miden_base_sys::bindings::tx::add_asset_to_note trace.252 nop push.4 - dup.5 + dup.3 add u32assert push.4 @@ -707,101 +714,7 @@ proc.miden_base_sys::bindings::tx::add_asset_to_note exec.::intrinsics::mem::load_felt trace.252 nop - movup.5 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_felt - trace.252 - nop - dup.4 - swap.1 - swap.3 - swap.1 - swap.5 - swap.7 - swap.4 - trace.240 - nop - exec.::miden:basic-wallet/basic-wallet@0.1.0::basic_wallet::miden::tx::add_asset_to_note - trace.252 - nop - push.8 - dup.2 - add - u32assert - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_dw - trace.252 - nop - push.40 - dup.4 - add - u32assert - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_dw - trace.252 - nop - dup.1 - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_dw - trace.252 - nop - push.32 - dup.4 - add - u32assert - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_dw - trace.252 - nop - push.16 - dup.2 - add - u32assert + movup.3 push.4 dup.1 swap.1 @@ -815,45 +728,20 @@ proc.miden_base_sys::bindings::tx::add_asset_to_note exec.::intrinsics::mem::load_felt trace.252 nop - push.32 - dup.3 - u32wrapping_add - dup.2 - trace.240 - nop - exec.::miden:basic-wallet/basic-wallet@0.1.0::basic_wallet::miden_stdlib_sys::intrinsics::word::Word::reverse - trace.252 - nop - push.16 - movup.2 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop - push.48 - u32wrapping_add - push.1114144 - u32divmod.4 - swap.1 + movdn.3 + swap.2 trace.240 nop - exec.::intrinsics::mem::store_sw + exec.::miden:basic-wallet/basic-wallet@0.1.0::basic_wallet::miden::output_note::add_asset trace.252 nop end -proc.miden_stdlib_sys::intrinsics::word::Word::reverse +@callconv("C") +proc miden_stdlib_sys::intrinsics::word::Word::reverse( + i32, + i32 +) push.1114144 u32divmod.4 swap.1 @@ -1114,10 +1002,11 @@ proc.miden_stdlib_sys::intrinsics::word::Word::reverse nop end -proc.miden::account::add_asset +@callconv("C") +proc miden::native_account::add_asset(felt, felt, felt, felt, i32) trace.240 nop - exec.::miden::account::add_asset + exec.::miden::native_account::add_asset trace.252 nop movup.4 @@ -1169,10 +1058,11 @@ proc.miden::account::add_asset nop end -proc.miden::account::remove_asset +@callconv("C") +proc miden::native_account::remove_asset(felt, felt, felt, felt, i32) trace.240 nop - exec.::miden::account::remove_asset + exec.::miden::native_account::remove_asset trace.252 nop movup.4 @@ -1224,70 +1114,11 @@ proc.miden::account::remove_asset nop end -proc.miden::tx::add_asset_to_note - trace.240 - nop - exec.::miden::tx::add_asset_to_note - trace.252 - nop - movup.5 - dup.0 - movup.2 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop - push.4 - dup.1 - add - u32assert - movup.2 - swap.1 - u32divmod.4 - swap.1 +@callconv("C") +proc miden::output_note::add_asset(felt, felt, felt, felt, felt) trace.240 nop - exec.::intrinsics::mem::store_felt - trace.252 - nop - push.8 - dup.1 - add - u32assert - movup.2 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop - push.12 - dup.1 - add - u32assert - movup.2 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop - push.16 - add - u32assert - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt + exec.::miden::output_note::add_asset trace.252 nop end diff --git a/tests/integration/expected/examples/basic_wallet.wat b/tests/integration/expected/examples/basic_wallet.wat index 342508337..3e58886d8 100644 --- a/tests/integration/expected/examples/basic_wallet.wat +++ b/tests/integration/expected/examples/basic_wallet.wat @@ -18,9 +18,8 @@ (type (;1;) (func (param f32 f32 f32 f32))) (type (;2;) (func (param f32 f32 f32 f32 f32))) (type (;3;) (func (param i32 i32))) - (type (;4;) (func (param i32 i32 f32))) + (type (;4;) (func (param i32 f32))) (type (;5;) (func (param f32 f32 f32 f32 i32))) - (type (;6;) (func (param f32 f32 f32 f32 f32 i32))) (table (;0;) 2 2 funcref) (memory (;0;) 17) (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) @@ -64,7 +63,7 @@ (func $miden:basic-wallet/basic-wallet@0.1.0#move-asset-to-note (;3;) (type 2) (param f32 f32 f32 f32 f32) (local i32) global.get $__stack_pointer - i32.const 64 + i32.const 32 i32.sub local.tee 5 global.set $__stack_pointer @@ -87,15 +86,12 @@ local.get 5 call $miden_base_sys::bindings::account::remove_asset local.get 5 - i32.const 32 - i32.add - local.get 5 i32.const 16 i32.add local.get 4 - call $miden_base_sys::bindings::tx::add_asset_to_note + call $miden_base_sys::bindings::output_note::add_asset local.get 5 - i32.const 64 + i32.const 32 i32.add global.set $__stack_pointer ) @@ -127,7 +123,7 @@ local.get 1 f32.load local.get 0 - call $miden::account::add_asset + call $miden::native_account::add_asset ) (func $miden_base_sys::bindings::account::remove_asset (;6;) (type 3) (param i32 i32) (local i32) @@ -145,7 +141,7 @@ local.get 1 f32.load local.get 2 - call $miden::account::remove_asset + call $miden::native_account::remove_asset local.get 2 local.get 2 i64.load offset=8 @@ -164,47 +160,17 @@ i32.add global.set $__stack_pointer ) - (func $miden_base_sys::bindings::tx::add_asset_to_note (;7;) (type 4) (param i32 i32 f32) - (local i32) - global.get $__stack_pointer - i32.const 48 - i32.sub - local.tee 3 - global.set $__stack_pointer - local.get 1 + (func $miden_base_sys::bindings::output_note::add_asset (;7;) (type 4) (param i32 f32) + local.get 0 f32.load offset=12 - local.get 1 + local.get 0 f32.load offset=8 - local.get 1 - f32.load offset=4 - local.get 1 - f32.load - local.get 2 - local.get 3 - call $miden::tx::add_asset_to_note - local.get 3 - local.get 3 - i64.load offset=8 - i64.store offset=40 - local.get 3 - local.get 3 - i64.load - i64.store offset=32 - local.get 3 - f32.load offset=16 - local.set 2 local.get 0 - local.get 3 - i32.const 32 - i32.add - call $miden_stdlib_sys::intrinsics::word::Word::reverse + f32.load offset=4 local.get 0 - local.get 2 - f32.store offset=16 - local.get 3 - i32.const 48 - i32.add - global.set $__stack_pointer + f32.load + local.get 1 + call $miden::output_note::add_asset ) (func $miden_stdlib_sys::intrinsics::word::Word::reverse (;8;) (type 3) (param i32 i32) (local i32 i32 i32 f32) @@ -264,13 +230,13 @@ i64.load align=4 i64.store ) - (func $miden::account::add_asset (;9;) (type 5) (param f32 f32 f32 f32 i32) + (func $miden::native_account::add_asset (;9;) (type 5) (param f32 f32 f32 f32 i32) unreachable ) - (func $miden::account::remove_asset (;10;) (type 5) (param f32 f32 f32 f32 i32) + (func $miden::native_account::remove_asset (;10;) (type 5) (param f32 f32 f32 f32 i32) unreachable ) - (func $miden::tx::add_asset_to_note (;11;) (type 6) (param f32 f32 f32 f32 f32 i32) + (func $miden::output_note::add_asset (;11;) (type 2) (param f32 f32 f32 f32 f32) unreachable ) (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") diff --git a/tests/integration/expected/examples/basic_wallet_tx_script.hir b/tests/integration/expected/examples/basic_wallet_tx_script.hir index e2ec9ff9e..5fd44a641 100644 --- a/tests/integration/expected/examples/basic_wallet_tx_script.hir +++ b/tests/integration/expected/examples/basic_wallet_tx_script.hir @@ -369,7 +369,7 @@ builtin.component miden:base/transaction-script@1.0.0 { hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/>::from(v272, v274) v967 = arith.constant 64 : i32; v276 = arith.add v101, v967 : i32 #[overflow = wrapping]; - v277 = hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/miden_base_sys::bindings::tx::create_note(v213, v208, v201, v194, v276) : felt + v277 = hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/miden_base_sys::bindings::output_note::create(v213, v208, v201, v194, v276) : felt v282 = arith.constant 1048672 : i32; v283 = arith.add v270, v282 : i32 #[overflow = wrapping]; v281 = arith.constant 12 : i32; @@ -665,7 +665,7 @@ builtin.component miden:base/transaction-script@1.0.0 { builtin.ret v483; }; - private builtin.function @miden_base_sys::bindings::tx::create_note(v485: felt, v486: felt, v487: felt, v488: felt, v489: i32) -> felt { + private builtin.function @miden_base_sys::bindings::output_note::create(v485: felt, v486: felt, v487: felt, v488: felt, v489: i32) -> felt { ^block54(v485: felt, v486: felt, v487: felt, v488: felt, v489: i32): v492 = arith.constant 12 : u32; v491 = hir.bitcast v489 : u32; @@ -697,7 +697,7 @@ builtin.component miden:base/transaction-script@1.0.0 { hir.assertz v514 #[code = 250]; v515 = hir.int_to_ptr v512 : ptr; v516 = hir.load v515 : felt; - v517 = hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/miden::tx::create_note(v485, v486, v487, v488, v497, v504, v511, v516) : felt + v517 = hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/miden::output_note::create(v485, v486, v487, v488, v497, v504, v511, v516) : felt builtin.ret v517; }; @@ -1245,9 +1245,9 @@ builtin.component miden:base/transaction-script@1.0.0 { builtin.ret v894; }; - private builtin.function @miden::tx::create_note(v895: felt, v896: felt, v897: felt, v898: felt, v899: felt, v900: felt, v901: felt, v902: felt) -> felt { + private builtin.function @miden::output_note::create(v895: felt, v896: felt, v897: felt, v898: felt, v899: felt, v900: felt, v901: felt, v902: felt) -> felt { ^block114(v895: felt, v896: felt, v897: felt, v898: felt, v899: felt, v900: felt, v901: felt, v902: felt): - v903 = hir.exec @miden/tx/create_note(v895, v896, v897, v898, v899, v900, v901, v902) : felt + v903 = hir.exec @miden/output_note/create(v895, v896, v897, v898, v899, v900, v901, v902) : felt builtin.ret v903; }; @@ -1261,7 +1261,7 @@ builtin.component miden:base/transaction-script@1.0.0 { builtin.segment readonly @1048576 = 0x0073722e62696c2f6372730073722e6d656d2f62696c6474732f6372732f302e372e302d7379732d62696c6474732d6e6564696d; - builtin.segment @1048628 = 0x00000021000000280000000a0010002900000025000000250000000a0010002900000021000000970000002800100000000000010000000100000001; + builtin.segment @1048628 = 0x00000021000000270000000a0010002900000025000000250000000a0010002900000021000000970000002800100000000000010000000100000001; }; public builtin.function @run(v905: felt, v906: felt, v907: felt, v908: felt) { diff --git a/tests/integration/expected/examples/basic_wallet_tx_script.masm b/tests/integration/expected/examples/basic_wallet_tx_script.masm index 08c50f65b..343dafb85 100644 --- a/tests/integration/expected/examples/basic_wallet_tx_script.masm +++ b/tests/integration/expected/examples/basic_wallet_tx_script.masm @@ -1,6 +1,7 @@ # mod miden:base/transaction-script@1.0.0 -export.run +@callconv("canon-lift") +pub proc run(felt, felt, felt, felt) exec.::miden:base/transaction-script@1.0.0::init trace.240 nop @@ -10,12 +11,12 @@ export.run exec.::std::sys::truncate_stack end -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init trace.252 - push.[6451311627802649628,13408805836566352167,15533908529537497744,16330195584285026872] + push.[18126909968619574227,17760723618876885851,16026017854059965402,12528080323114809843] adv.push_mapval push.262144 push.7 @@ -33,7 +34,14 @@ end # mod miden:base/transaction-script@1.0.0::basic_wallet_tx_script -proc.basic_wallet_tx_script::bindings::miden::basic_wallet::basic_wallet::move_asset_to_note::wit_import9 +@callconv("C") +proc basic_wallet_tx_script::bindings::miden::basic_wallet::basic_wallet::move_asset_to_note::wit_import9( + felt, + felt, + felt, + felt, + felt +) trace.240 nop call.::miden:basic-wallet/basic-wallet@0.1.0::move-asset-to-note @@ -41,11 +49,19 @@ proc.basic_wallet_tx_script::bindings::miden::basic_wallet::basic_wallet::move_a nop end -proc.__wasm_call_ctors +@callconv("C") +proc __wasm_call_ctors( + +) nop end -proc.core::slice::index::slice_end_index_len_fail +@callconv("C") +proc core::slice::index::slice_end_index_len_fail( + i32, + i32, + i32 +) trace.240 nop exec.::miden:base/transaction-script@1.0.0::basic_wallet_tx_script::core::slice::::copy_from_slice::len_mismatch_fail::do_panic::runtime @@ -55,7 +71,14 @@ proc.core::slice::index::slice_end_index_len_fail assert end -proc. as core::ops::index::Index>::index +@callconv("C") +proc as core::ops::index::Index>::index( + i32, + i32, + i32, + i32, + i32 +) push.8 dup.2 add @@ -159,7 +182,8 @@ proc. as core::ops::index::Index>::index end end -proc.__rustc::__rust_alloc +@callconv("C") +proc __rustc::__rust_alloc(i32, i32) -> i32 push.1114244 u32divmod.4 swap.1 @@ -179,13 +203,15 @@ proc.__rustc::__rust_alloc nop end -proc.__rustc::__rust_dealloc +@callconv("C") +proc __rustc::__rust_dealloc(i32, i32, i32) drop drop drop end -proc.__rustc::__rust_alloc_zeroed +@callconv("C") +proc __rustc::__rust_alloc_zeroed(i32, i32) -> i32 push.1114244 u32divmod.4 swap.1 @@ -269,11 +295,15 @@ proc.__rustc::__rust_alloc_zeroed end end -proc.basic_wallet_tx_script::bindings::__link_custom_section_describing_imports +@callconv("C") +proc basic_wallet_tx_script::bindings::__link_custom_section_describing_imports( + +) nop end -proc.miden:base/transaction-script@1.0.0#run +@callconv("C") +proc miden:base/transaction-script@1.0.0#run(felt, felt, felt, felt) push.1114240 u32divmod.4 swap.1 @@ -802,7 +832,7 @@ proc.miden:base/transaction-script@1.0.0#run movdn.5 trace.240 nop - exec.::miden:base/transaction-script@1.0.0::basic_wallet_tx_script::miden_base_sys::bindings::tx::create_note + exec.::miden:base/transaction-script@1.0.0::basic_wallet_tx_script::miden_base_sys::bindings::output_note::create trace.252 nop push.1048672 @@ -1058,11 +1088,17 @@ proc.miden:base/transaction-script@1.0.0#run end end -proc.__rustc::__rust_no_alloc_shim_is_unstable_v2 +@callconv("C") +proc __rustc::__rust_no_alloc_shim_is_unstable_v2( + +) nop end -proc.wit_bindgen::rt::run_ctors_once +@callconv("C") +proc wit_bindgen::rt::run_ctors_once( + +) push.1114244 u32divmod.4 swap.1 @@ -1133,7 +1169,12 @@ proc.wit_bindgen::rt::run_ctors_once end end -proc.::alloc +@callconv("C") +proc ::alloc( + i32, + i32, + i32 +) -> i32 push.16 push.0 push.16 @@ -1308,7 +1349,10 @@ proc.::alloc end end -proc.intrinsics::mem::heap_base +@callconv("C") +proc intrinsics::mem::heap_base( + +) -> i32 trace.240 nop exec.::intrinsics::mem::heap_base @@ -1316,7 +1360,14 @@ proc.intrinsics::mem::heap_base nop end -proc.miden_base_sys::bindings::tx::create_note +@callconv("C") +proc miden_base_sys::bindings::output_note::create( + felt, + felt, + felt, + felt, + i32 +) -> felt push.12 dup.5 add @@ -1392,12 +1443,16 @@ proc.miden_base_sys::bindings::tx::create_note swap.4 trace.240 nop - exec.::miden:base/transaction-script@1.0.0::basic_wallet_tx_script::miden::tx::create_note + exec.::miden:base/transaction-script@1.0.0::basic_wallet_tx_script::miden::output_note::create trace.252 nop end -proc.>::from +@callconv("C") +proc >::from( + i32, + i32 +) push.8 dup.2 add @@ -1462,7 +1517,8 @@ proc. felt dup.1 dup.1 push.1 @@ -1477,19 +1533,23 @@ proc.intrinsics::felt::from_u64_unchecked add end -proc.intrinsics::felt::from_u32 +@callconv("C") +proc intrinsics::felt::from_u32(i32) -> felt nop end -proc.intrinsics::felt::as_u64 +@callconv("C") +proc intrinsics::felt::as_u64(felt) -> [u32; 2] u32split end -proc.intrinsics::felt::assert_eq +@callconv("C") +proc intrinsics::felt::assert_eq(felt, felt) assert_eq end -proc.intrinsics::advice::adv_push_mapvaln +@callconv("C") +proc intrinsics::advice::adv_push_mapvaln(felt, felt, felt, felt) -> felt trace.240 nop exec.::intrinsics::advice::adv_push_mapvaln @@ -1497,7 +1557,8 @@ proc.intrinsics::advice::adv_push_mapvaln nop end -proc.std::mem::pipe_preimage_to_memory +@callconv("C") +proc std::mem::pipe_preimage_to_memory(felt, i32, felt, felt, felt, felt) -> i32 trace.240 nop exec.::std::mem::pipe_preimage_to_memory @@ -1505,7 +1566,12 @@ proc.std::mem::pipe_preimage_to_memory nop end -proc.alloc::raw_vec::RawVecInner::deallocate +@callconv("C") +proc alloc::raw_vec::RawVecInner::deallocate( + i32, + i32, + i32 +) push.1114240 u32divmod.4 swap.1 @@ -1617,7 +1683,14 @@ proc.alloc::raw_vec::RawVecInner::deallocate nop end -proc.alloc::raw_vec::RawVecInner::try_allocate_in +@callconv("C") +proc alloc::raw_vec::RawVecInner::try_allocate_in( + i32, + i32, + i32, + i32, + i32 +) push.1114240 u32divmod.4 swap.1 @@ -2023,7 +2096,12 @@ proc.alloc::raw_vec::RawVecInner::try_allocate_in nop end -proc.::allocate +@callconv("C") +proc ::allocate( + i32, + i32, + i32 +) push.1114240 u32divmod.4 swap.1 @@ -2137,7 +2215,13 @@ proc.::allocate nop end -proc.alloc::alloc::Global::alloc_impl +@callconv("C") +proc alloc::alloc::Global::alloc_impl( + i32, + i32, + i32, + i32 +) push.0 push.0 dup.4 @@ -2209,7 +2293,13 @@ proc.alloc::alloc::Global::alloc_impl nop end -proc.alloc::raw_vec::RawVecInner::current_memory +@callconv("C") +proc alloc::raw_vec::RawVecInner::current_memory( + i32, + i32, + i32, + i32 +) push.0 push.0 dup.5 @@ -2335,7 +2425,12 @@ proc.alloc::raw_vec::RawVecInner::current_memory nop end -proc.::deallocate +@callconv("C") +proc ::deallocate( + i32, + i32, + i32 +) push.0 push.0 dup.4 @@ -2356,7 +2451,8 @@ proc.::deallocate end end -proc.alloc::raw_vec::handle_error +@callconv("C") +proc alloc::raw_vec::handle_error(i32, i32, i32) drop drop drop @@ -2364,7 +2460,12 @@ proc.alloc::raw_vec::handle_error assert end -proc.core::slice::::copy_from_slice::len_mismatch_fail::do_panic::runtime +@callconv("C") +proc core::slice::::copy_from_slice::len_mismatch_fail::do_panic::runtime( + i32, + i32, + i32 +) drop drop drop @@ -2372,7 +2473,8 @@ proc.core::slice::::copy_from_slice::len_mismatch_fail::do_panic::runt assert end -proc.core::ptr::alignment::Alignment::max +@callconv("C") +proc core::ptr::alignment::Alignment::max(i32, i32) -> i32 push.0 dup.2 dup.2 @@ -2382,10 +2484,20 @@ proc.core::ptr::alignment::Alignment::max cdrop end -proc.miden::tx::create_note +@callconv("C") +proc miden::output_note::create( + felt, + felt, + felt, + felt, + felt, + felt, + felt, + felt +) -> felt trace.240 nop - exec.::miden::tx::create_note + exec.::miden::output_note::create trace.252 nop end diff --git a/tests/integration/expected/examples/basic_wallet_tx_script.wat b/tests/integration/expected/examples/basic_wallet_tx_script.wat index 5719043e2..37d8426b0 100644 --- a/tests/integration/expected/examples/basic_wallet_tx_script.wat +++ b/tests/integration/expected/examples/basic_wallet_tx_script.wat @@ -259,7 +259,7 @@ local.get 4 i32.const 64 i32.add - call $miden_base_sys::bindings::tx::create_note + call $miden_base_sys::bindings::output_note::create local.set 0 local.get 4 local.get 4 @@ -431,7 +431,7 @@ (func $intrinsics::mem::heap_base (;12;) (type 7) (result i32) unreachable ) - (func $miden_base_sys::bindings::tx::create_note (;13;) (type 8) (param f32 f32 f32 f32 i32) (result f32) + (func $miden_base_sys::bindings::output_note::create (;13;) (type 8) (param f32 f32 f32 f32 i32) (result f32) local.get 0 local.get 1 local.get 2 @@ -444,7 +444,7 @@ f32.load offset=4 local.get 4 f32.load - call $miden::tx::create_note + call $miden::output_note::create ) (func $>::from (;14;) (type 9) (param i32 i32) local.get 0 @@ -734,11 +734,11 @@ i32.gt_u select ) - (func $miden::tx::create_note (;30;) (type 17) (param f32 f32 f32 f32 f32 f32 f32 f32) (result f32) + (func $miden::output_note::create (;30;) (type 17) (param f32 f32 f32 f32 f32 f32 f32 f32) (result f32) unreachable ) (data $.rodata (;0;) (i32.const 1048576) "miden-stdlib-sys-0.7.0/src/stdlib/mem.rs\00src/lib.rs\00") - (data $.data (;1;) (i32.const 1048628) "\01\00\00\00\01\00\00\00\01\00\00\00\00\00\10\00(\00\00\00\97\00\00\00!\00\00\00)\00\10\00\0a\00\00\00%\00\00\00%\00\00\00)\00\10\00\0a\00\00\00(\00\00\00!\00\00\00") + (data $.data (;1;) (i32.const 1048628) "\01\00\00\00\01\00\00\00\01\00\00\00\00\00\10\00(\00\00\00\97\00\00\00!\00\00\00)\00\10\00\0a\00\00\00%\00\00\00%\00\00\00)\00\10\00\0a\00\00\00'\00\00\00!\00\00\00") ) (alias export 0 "word" (type (;4;))) (alias export 1 "move-asset-to-note" (func (;0;))) diff --git a/tests/integration/expected/examples/counter.hir b/tests/integration/expected/examples/counter.hir index 07ac995d0..8d02ac4c7 100644 --- a/tests/integration/expected/examples/counter.hir +++ b/tests/integration/expected/examples/counter.hir @@ -47,7 +47,7 @@ builtin.component miden:counter-contract/counter@0.1.0 { hir.assertz v35 #[code = 250]; v36 = hir.int_to_ptr v33 : ptr; v37 = hir.load v36 : felt; - hir.exec @miden:counter-contract/counter@0.1.0/counter_contract/miden::account::get_map_item(v11, v18, v25, v32, v37, v7) + hir.exec @miden:counter-contract/counter@0.1.0/counter_contract/miden::active_account::get_map_item(v11, v18, v25, v32, v37, v7) v495 = arith.constant 8 : u32; v38 = hir.bitcast v7 : u32; v40 = arith.add v38, v495 : u32 #[overflow = checked]; @@ -264,7 +264,7 @@ builtin.component miden:counter-contract/counter@0.1.0 { v204 = hir.load v203 : felt; v517 = arith.constant 64 : i32; v206 = arith.add v128, v517 : i32 #[overflow = wrapping]; - hir.exec @miden:counter-contract/counter@0.1.0/counter_contract/miden::account::set_map_item(v176, v138, v136, v134, v132, v183, v190, v197, v204, v206) + hir.exec @miden:counter-contract/counter@0.1.0/counter_contract/miden::native_account::set_map_item(v176, v138, v136, v134, v132, v183, v190, v197, v204, v206) v208 = arith.constant 72 : u32; v207 = hir.bitcast v128 : u32; v209 = arith.add v207, v208 : u32 #[overflow = checked]; @@ -428,7 +428,7 @@ builtin.component miden:counter-contract/counter@0.1.0 { v331 = arith.add v307, v330 : i32 #[overflow = wrapping]; v301 = arith.constant 0 : i32; v589, v590, v591, v592, v593, v594 = scf.while v301, v307, v331, v299 : i32, i32, i32, i32, i32, i32 { - ^block51(v595: i32, v596: i32, v597: i32, v598: i32): + ^block52(v595: i32, v596: i32, v597: i32, v598: i32): v617 = arith.constant 0 : i32; v334 = arith.constant 8 : i32; v335 = arith.eq v595, v334 : i1; @@ -436,7 +436,7 @@ builtin.component miden:counter-contract/counter@0.1.0 { v337 = hir.bitcast v336 : i32; v339 = arith.neq v337, v617 : i1; v583, v584 = scf.if v339 : i32, i32 { - ^block50: + ^block51: v543 = ub.poison i32 : i32; scf.yield v543, v543; } else { @@ -482,7 +482,7 @@ builtin.component miden:counter-contract/counter@0.1.0 { v576 = arith.trunc v588 : i1; scf.condition v576, v583, v585, v584, v586, v596, v598; } do { - ^block52(v599: i32, v600: i32, v601: i32, v602: i32, v603: i32, v604: i32): + ^block53(v599: i32, v600: i32, v601: i32, v602: i32, v603: i32, v604: i32): scf.yield v599, v600, v601, v602; }; v610 = arith.constant 8 : u32; @@ -569,9 +569,9 @@ builtin.component miden:counter-contract/counter@0.1.0 { builtin.ret v424; }; - private builtin.function @miden::account::get_map_item(v426: felt, v427: felt, v428: felt, v429: felt, v430: felt, v431: i32) { + private builtin.function @miden::active_account::get_map_item(v426: felt, v427: felt, v428: felt, v429: felt, v430: felt, v431: i32) { ^block33(v426: felt, v427: felt, v428: felt, v429: felt, v430: felt, v431: i32): - v432, v433, v434, v435 = hir.exec @miden/account/get_map_item(v426, v427, v428, v429, v430) : felt, felt, felt, felt + v432, v433, v434, v435 = hir.exec @miden/active_account/get_map_item(v426, v427, v428, v429, v430) : felt, felt, felt, felt v436 = hir.bitcast v431 : u32; v437 = hir.int_to_ptr v436 : ptr; hir.store v437, v432; @@ -590,9 +590,9 @@ builtin.component miden:counter-contract/counter@0.1.0 { builtin.ret ; }; - private builtin.function @miden::account::set_map_item(v447: felt, v448: felt, v449: felt, v450: felt, v451: felt, v452: felt, v453: felt, v454: felt, v455: felt, v456: i32) { + private builtin.function @miden::native_account::set_map_item(v447: felt, v448: felt, v449: felt, v450: felt, v451: felt, v452: felt, v453: felt, v454: felt, v455: felt, v456: i32) { ^block37(v447: felt, v448: felt, v449: felt, v450: felt, v451: felt, v452: felt, v453: felt, v454: felt, v455: felt, v456: i32): - v457, v458, v459, v460, v461, v462, v463, v464 = hir.exec @miden/account/set_map_item(v447, v448, v449, v450, v451, v452, v453, v454, v455) : felt, felt, felt, felt, felt, felt, felt, felt + v457, v458, v459, v460, v461, v462, v463, v464 = hir.exec @miden/native_account/set_map_item(v447, v448, v449, v450, v451, v452, v453, v454, v455) : felt, felt, felt, felt, felt, felt, felt, felt v465 = hir.bitcast v456 : u32; v466 = hir.int_to_ptr v465 : ptr; hir.store v466, v457; @@ -639,13 +639,13 @@ builtin.component miden:counter-contract/counter@0.1.0 { }; public builtin.function @get-count() -> felt { - ^block39: + ^block40: v488 = hir.exec @miden:counter-contract/counter@0.1.0/counter_contract/miden:counter-contract/counter@0.1.0#get-count() : felt builtin.ret v488; }; public builtin.function @increment-count() -> felt { - ^block41: + ^block42: v489 = hir.exec @miden:counter-contract/counter@0.1.0/counter_contract/miden:counter-contract/counter@0.1.0#increment-count() : felt builtin.ret v489; }; diff --git a/tests/integration/expected/examples/counter.masm b/tests/integration/expected/examples/counter.masm index 3c7459013..ac1d4d356 100644 --- a/tests/integration/expected/examples/counter.masm +++ b/tests/integration/expected/examples/counter.masm @@ -1,6 +1,9 @@ # mod miden:counter-contract/counter@0.1.0 -export.get-count +@callconv("canon-lift") +pub proc get-count( + +) -> felt exec.::miden:counter-contract/counter@0.1.0::init trace.240 nop @@ -10,7 +13,10 @@ export.get-count exec.::std::sys::truncate_stack end -export.increment-count +@callconv("canon-lift") +pub proc increment-count( + +) -> felt exec.::miden:counter-contract/counter@0.1.0::init trace.240 nop @@ -20,7 +26,7 @@ export.increment-count exec.::std::sys::truncate_stack end -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -43,11 +49,18 @@ end # mod miden:counter-contract/counter@0.1.0::counter_contract -proc.__wasm_call_ctors +@callconv("C") +proc __wasm_call_ctors( + +) nop end -proc.miden_base_sys::bindings::storage::get_map_item +@callconv("C") +proc miden_base_sys::bindings::storage::get_map_item( + i32, + i32 +) push.1114144 u32divmod.4 swap.1 @@ -149,7 +162,7 @@ proc.miden_base_sys::bindings::storage::get_map_item swap.5 trace.240 nop - exec.::miden:counter-contract/counter@0.1.0::counter_contract::miden::account::get_map_item + exec.::miden:counter-contract/counter@0.1.0::counter_contract::miden::active_account::get_map_item trace.252 nop push.8 @@ -238,11 +251,17 @@ proc.miden_base_sys::bindings::storage::get_map_item nop end -proc.counter_contract::bindings::__link_custom_section_describing_imports +@callconv("C") +proc counter_contract::bindings::__link_custom_section_describing_imports( + +) nop end -proc.miden:counter-contract/counter@0.1.0#get-count +@callconv("C") +proc miden:counter-contract/counter@0.1.0#get-count( + +) -> felt push.1114144 u32divmod.4 swap.1 @@ -397,7 +416,10 @@ proc.miden:counter-contract/counter@0.1.0#get-count nop end -proc.miden:counter-contract/counter@0.1.0#increment-count +@callconv("C") +proc miden:counter-contract/counter@0.1.0#increment-count( + +) -> felt push.1114144 u32divmod.4 swap.1 @@ -659,7 +681,7 @@ proc.miden:counter-contract/counter@0.1.0#increment-count swap.5 trace.240 nop - exec.::miden:counter-contract/counter@0.1.0::counter_contract::miden::account::set_map_item + exec.::miden:counter-contract/counter@0.1.0::counter_contract::miden::native_account::set_map_item trace.252 nop push.72 @@ -832,7 +854,10 @@ proc.miden:counter-contract/counter@0.1.0#increment-count nop end -proc.wit_bindgen::rt::run_ctors_once +@callconv("C") +proc wit_bindgen::rt::run_ctors_once( + +) push.1114148 u32divmod.4 swap.1 @@ -903,12 +928,19 @@ proc.wit_bindgen::rt::run_ctors_once end end -proc.>::from +@callconv("C") +proc >::from( + i32 +) -> felt push.255 u32and end -proc.miden_stdlib_sys::intrinsics::word::Word::reverse +@callconv("C") +proc miden_stdlib_sys::intrinsics::word::Word::reverse( + i32, + i32 +) push.1114144 u32divmod.4 swap.1 @@ -1169,7 +1201,11 @@ proc.miden_stdlib_sys::intrinsics::word::Word::reverse nop end -proc.>::from +@callconv("C") +proc >::from( + i32, + felt +) push.0 trace.240 nop @@ -1257,18 +1293,21 @@ proc. felt add end -proc.intrinsics::felt::from_u32 +@callconv("C") +proc intrinsics::felt::from_u32(i32) -> felt nop end -proc.miden::account::get_map_item +@callconv("C") +proc miden::active_account::get_map_item(felt, felt, felt, felt, felt, i32) trace.240 nop - exec.::miden::account::get_map_item + exec.::miden::active_account::get_map_item trace.252 nop movup.4 @@ -1320,10 +1359,22 @@ proc.miden::account::get_map_item nop end -proc.miden::account::set_map_item - trace.240 - nop - exec.::miden::account::set_map_item +@callconv("C") +proc miden::native_account::set_map_item( + felt, + felt, + felt, + felt, + felt, + felt, + felt, + felt, + felt, + i32 +) + trace.240 + nop + exec.::miden::native_account::set_map_item trace.252 nop movup.8 diff --git a/tests/integration/expected/examples/counter.wat b/tests/integration/expected/examples/counter.wat index dcb506101..588e147f1 100644 --- a/tests/integration/expected/examples/counter.wat +++ b/tests/integration/expected/examples/counter.wat @@ -42,7 +42,7 @@ local.get 1 f32.load local.get 2 - call $miden::account::get_map_item + call $miden::active_account::get_map_item local.get 2 local.get 2 i64.load offset=8 @@ -169,7 +169,7 @@ local.get 0 i32.const 64 i32.add - call $miden::account::set_map_item + call $miden::native_account::set_map_item local.get 0 local.get 0 i64.load offset=72 @@ -320,14 +320,14 @@ (func $intrinsics::felt::from_u32 (;10;) (type 3) (param i32) (result f32) unreachable ) - (func $miden::account::get_map_item (;11;) (type 6) (param f32 f32 f32 f32 f32 i32) + (func $miden::active_account::get_map_item (;11;) (type 6) (param f32 f32 f32 f32 f32 i32) unreachable ) - (func $miden::account::set_map_item (;12;) (type 7) (param f32 f32 f32 f32 f32 f32 f32 f32 f32 i32) + (func $miden::native_account::set_map_item (;12;) (type 7) (param f32 f32 f32 f32 f32 f32 f32 f32 f32 i32) unreachable ) (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") - (@custom "rodata,miden_account" (after data) "!counter-contract\95A simple example of a Miden counter contract using the Account Storage API\0b0.1.0\03\01\03\01\00\01\13count_map\019counter contract storage map") + (@custom "rodata,miden_account" (after data) "!counter-contract\95A simple example of a Miden counter contract using the Account Storage API\0b0.1.0\03\01\03\01\00\00\13count_map\019counter contract storage map\01\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00") ) (alias export 0 "felt" (type (;1;))) (core instance (;0;) (instantiate 0)) diff --git a/tests/integration/expected/examples/counter_note.masm b/tests/integration/expected/examples/counter_note.masm index 9e8acfd47..22ca175c3 100644 --- a/tests/integration/expected/examples/counter_note.masm +++ b/tests/integration/expected/examples/counter_note.masm @@ -1,6 +1,7 @@ # mod miden:base/note-script@1.0.0 -export.run +@callconv("canon-lift") +pub proc run(felt, felt, felt, felt) exec.::miden:base/note-script@1.0.0::init trace.240 nop @@ -10,7 +11,7 @@ export.run exec.::std::sys::truncate_stack end -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -33,7 +34,10 @@ end # mod miden:base/note-script@1.0.0::counter_note -proc.counter_note::bindings::miden::counter_contract::counter::get_count::wit_import0 +@callconv("C") +proc counter_note::bindings::miden::counter_contract::counter::get_count::wit_import0( + +) -> felt trace.240 nop call.::miden:counter-contract/counter@0.1.0::get-count @@ -41,7 +45,10 @@ proc.counter_note::bindings::miden::counter_contract::counter::get_count::wit_im nop end -proc.counter_note::bindings::miden::counter_contract::counter::increment_count::wit_import0 +@callconv("C") +proc counter_note::bindings::miden::counter_contract::counter::increment_count::wit_import0( + +) -> felt trace.240 nop call.::miden:counter-contract/counter@0.1.0::increment-count @@ -49,15 +56,22 @@ proc.counter_note::bindings::miden::counter_contract::counter::increment_count:: nop end -proc.__wasm_call_ctors +@callconv("C") +proc __wasm_call_ctors( + +) nop end -proc.counter_note::bindings::__link_custom_section_describing_imports +@callconv("C") +proc counter_note::bindings::__link_custom_section_describing_imports( + +) nop end -proc.miden:base/note-script@1.0.0#run +@callconv("C") +proc miden:base/note-script@1.0.0#run(felt, felt, felt, felt) drop drop drop @@ -102,7 +116,10 @@ proc.miden:base/note-script@1.0.0#run nop end -proc.wit_bindgen::rt::run_ctors_once +@callconv("C") +proc wit_bindgen::rt::run_ctors_once( + +) push.1114148 u32divmod.4 swap.1 @@ -173,15 +190,18 @@ proc.wit_bindgen::rt::run_ctors_once end end -proc.intrinsics::felt::add +@callconv("C") +proc intrinsics::felt::add(felt, felt) -> felt add end -proc.intrinsics::felt::from_u32 +@callconv("C") +proc intrinsics::felt::from_u32(i32) -> felt nop end -proc.intrinsics::felt::assert_eq +@callconv("C") +proc intrinsics::felt::assert_eq(felt, felt) assert_eq end diff --git a/tests/integration/expected/examples/fib.masm b/tests/integration/expected/examples/fib.masm index 2f7c03ec3..500010e98 100644 --- a/tests/integration/expected/examples/fib.masm +++ b/tests/integration/expected/examples/fib.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -12,7 +12,8 @@ end # mod root_ns:root@1.0.0::fibonacci -export.entrypoint +@callconv("C") +pub proc entrypoint(i32) -> i32 push.0 push.1 movup.2 diff --git a/tests/integration/expected/examples/p2id.hir b/tests/integration/expected/examples/p2id.hir index 443ba22ba..d605a31a6 100644 --- a/tests/integration/expected/examples/p2id.hir +++ b/tests/integration/expected/examples/p2id.hir @@ -16,7 +16,7 @@ builtin.component miden:base/note-script@1.0.0 { v7 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/GOT.data.internal.__memory_base : ptr v8 = hir.bitcast v7 : ptr; v9 = hir.load v8 : i32; - v10 = arith.constant 1048664 : i32; + v10 = arith.constant 1048672 : i32; v11 = arith.add v9, v10 : i32 #[overflow = wrapping]; v12 = hir.exec @miden:base/note-script@1.0.0/p2id/::alloc(v11, v5, v4) : i32 builtin.ret v12; @@ -32,7 +32,7 @@ builtin.component miden:base/note-script@1.0.0 { v19 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/GOT.data.internal.__memory_base : ptr v20 = hir.bitcast v19 : ptr; v21 = hir.load v20 : i32; - v22 = arith.constant 1048664 : i32; + v22 = arith.constant 1048672 : i32; v23 = arith.add v21, v22 : i32 #[overflow = wrapping]; v24 = hir.exec @miden:base/note-script@1.0.0/p2id/::alloc(v23, v17, v16) : i32 v876 = arith.constant 0 : i32; @@ -87,7 +87,7 @@ builtin.component miden:base/note-script@1.0.0 { hir.exec @miden:base/note-script@1.0.0/p2id/wit_bindgen::rt::run_ctors_once() v57 = arith.constant 16 : i32; v58 = arith.add v54, v57 : i32 #[overflow = wrapping]; - hir.exec @miden:base/note-script@1.0.0/p2id/miden_base_sys::bindings::note::get_inputs(v58) + hir.exec @miden:base/note-script@1.0.0/p2id/miden_base_sys::bindings::active_note::get_inputs(v58) v60 = arith.constant 24 : u32; v59 = hir.bitcast v54 : u32; v61 = arith.add v59, v60 : u32 #[overflow = checked]; @@ -178,7 +178,7 @@ builtin.component miden:base/note-script@1.0.0 { ^block26: v116 = arith.constant 28 : i32; v117 = arith.add v54, v116 : i32 #[overflow = wrapping]; - hir.exec @miden:base/note-script@1.0.0/p2id/miden_base_sys::bindings::note::get_assets(v117) + hir.exec @miden:base/note-script@1.0.0/p2id/miden_base_sys::bindings::active_note::get_assets(v117) v119 = arith.constant 36 : u32; v118 = hir.bitcast v54 : u32; v120 = arith.add v118, v119 : u32 #[overflow = checked]; @@ -328,7 +328,7 @@ builtin.component miden:base/note-script@1.0.0 { v208 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/GOT.data.internal.__memory_base : ptr v209 = hir.bitcast v208 : ptr; v210 = hir.load v209 : i32; - v211 = arith.constant 1048668 : i32; + v211 = arith.constant 1048676 : i32; v212 = arith.add v210, v211 : i32 #[overflow = wrapping]; v213 = hir.bitcast v212 : u32; v214 = hir.int_to_ptr v213 : ptr; @@ -347,7 +347,7 @@ builtin.component miden:base/note-script@1.0.0 { v222 = hir.load v221 : i32; hir.exec @miden:base/note-script@1.0.0/p2id/__wasm_call_ctors() v1013 = arith.constant 1 : u8; - v1015 = arith.constant 1048668 : i32; + v1015 = arith.constant 1048676 : i32; v224 = arith.add v222, v1015 : i32 #[overflow = wrapping]; v228 = hir.bitcast v224 : u32; v229 = hir.int_to_ptr v228 : ptr; @@ -574,7 +574,7 @@ builtin.component miden:base/note-script@1.0.0 { hir.store v384, v382; v385 = arith.constant 8 : i32; v386 = arith.add v382, v385 : i32 #[overflow = wrapping]; - hir.exec @miden:base/note-script@1.0.0/p2id/miden::account::get_id(v386) + hir.exec @miden:base/note-script@1.0.0/p2id/miden::active_account::get_id(v386) v388 = arith.constant 8 : u32; v387 = hir.bitcast v382 : u32; v389 = arith.add v387, v388 : u32 #[overflow = checked]; @@ -597,7 +597,7 @@ builtin.component miden:base/note-script@1.0.0 { builtin.ret ; }; - private builtin.function @miden_base_sys::bindings::note::get_inputs(v402: i32) { + private builtin.function @miden_base_sys::bindings::active_note::get_inputs(v402: i32) { ^block56(v402: i32): v404 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr v405 = hir.bitcast v404 : ptr; @@ -610,7 +610,7 @@ builtin.component miden:base/note-script@1.0.0 { v415 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/GOT.data.internal.__memory_base : ptr v416 = hir.bitcast v415 : ptr; v417 = hir.load v416 : i32; - v418 = arith.constant 1048632 : i32; + v418 = arith.constant 1048640 : i32; v419 = arith.add v417, v418 : i32 #[overflow = wrapping]; v413 = arith.constant 4 : i32; v411 = arith.constant 8 : i32; @@ -636,7 +636,7 @@ builtin.component miden:base/note-script@1.0.0 { v435 = hir.bitcast v433 : u32; v437 = arith.shr v435, v1071 : u32; v438 = hir.bitcast v437 : i32; - v439 = hir.exec @miden:base/note-script@1.0.0/p2id/miden::note::get_inputs(v438) : i32 + v439 = hir.exec @miden:base/note-script@1.0.0/p2id/miden::active_note::get_inputs(v438) : i32 v1077 = arith.constant 8 : u32; v440 = hir.bitcast v402 : u32; v442 = arith.add v440, v1077 : u32 #[overflow = checked]; @@ -667,7 +667,7 @@ builtin.component miden:base/note-script@1.0.0 { builtin.ret ; }; - private builtin.function @miden_base_sys::bindings::note::get_assets(v460: i32) { + private builtin.function @miden_base_sys::bindings::active_note::get_assets(v460: i32) { ^block58(v460: i32): v462 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr v463 = hir.bitcast v462 : ptr; @@ -680,7 +680,7 @@ builtin.component miden:base/note-script@1.0.0 { v473 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/GOT.data.internal.__memory_base : ptr v474 = hir.bitcast v473 : ptr; v475 = hir.load v474 : i32; - v476 = arith.constant 1048648 : i32; + v476 = arith.constant 1048656 : i32; v477 = arith.add v475, v476 : i32 #[overflow = wrapping]; v1087 = arith.constant 16 : i32; v469 = arith.constant 8 : i32; @@ -706,7 +706,7 @@ builtin.component miden:base/note-script@1.0.0 { v493 = hir.bitcast v491 : u32; v495 = arith.shr v493, v1079 : u32; v496 = hir.bitcast v495 : i32; - v497 = hir.exec @miden:base/note-script@1.0.0/p2id/miden::note::get_assets(v496) : i32 + v497 = hir.exec @miden:base/note-script@1.0.0/p2id/miden::active_note::get_assets(v496) : i32 v1085 = arith.constant 8 : u32; v498 = hir.bitcast v460 : u32; v500 = arith.add v498, v1085 : u32 #[overflow = checked]; @@ -1214,9 +1214,9 @@ builtin.component miden:base/note-script@1.0.0 { builtin.ret v847; }; - private builtin.function @miden::account::get_id(v848: i32) { + private builtin.function @miden::active_account::get_id(v848: i32) { ^block101(v848: i32): - v849, v850 = hir.exec @miden/account/get_id() : felt, felt + v849, v850 = hir.exec @miden/active_account/get_id() : felt, felt v851 = hir.bitcast v848 : u32; v852 = hir.int_to_ptr v851 : ptr; hir.store v852, v849; @@ -1227,15 +1227,15 @@ builtin.component miden:base/note-script@1.0.0 { builtin.ret ; }; - private builtin.function @miden::note::get_inputs(v856: i32) -> i32 { + private builtin.function @miden::active_note::get_inputs(v856: i32) -> i32 { ^block105(v856: i32): - v857, v858 = hir.exec @miden/note/get_inputs(v856) : i32, i32 + v857, v858 = hir.exec @miden/active_note/get_inputs(v856) : i32, i32 builtin.ret v857; }; - private builtin.function @miden::note::get_assets(v860: i32) -> i32 { + private builtin.function @miden::active_note::get_assets(v860: i32) -> i32 { ^block108(v860: i32): - v861, v862 = hir.exec @miden/note/get_assets(v860) : i32, i32 + v861, v862 = hir.exec @miden/active_note/get_assets(v860) : i32, i32 builtin.ret v861; }; @@ -1247,9 +1247,9 @@ builtin.component miden:base/note-script@1.0.0 { builtin.ret_imm 0; }; - builtin.segment readonly @1048576 = 0x0073722e65746f6e2f73676e69646e69622f6372732f302e372e302d7379732d657361622d6e6564696d; + builtin.segment readonly @1048576 = 0x0073722e65746f6e5f6576697463612f73676e69646e69622f6372732f302e372e302d7379732d657361622d6e6564696d; - builtin.segment @1048620 = 0x0000002200000037000000290010000000000021000000190000002900100000000000010000000100000001; + builtin.segment @1048628 = 0x0000002200000037000000300010000000000021000000190000003000100000000000010000000100000001; }; public builtin.function @run(v864: felt, v865: felt, v866: felt, v867: felt) { diff --git a/tests/integration/expected/examples/p2id.masm b/tests/integration/expected/examples/p2id.masm index d04444f65..2d4ca9b16 100644 --- a/tests/integration/expected/examples/p2id.masm +++ b/tests/integration/expected/examples/p2id.masm @@ -1,6 +1,7 @@ # mod miden:base/note-script@1.0.0 -export.run +@callconv("canon-lift") +pub proc run(felt, felt, felt, felt) exec.::miden:base/note-script@1.0.0::init trace.240 nop @@ -10,12 +11,12 @@ export.run exec.::std::sys::truncate_stack end -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init trace.252 - push.[5382081793031148845,6684015720740591260,3762537607758069840,9612505383776912743] + push.[12978692904443896846,474008017171175642,1341726231212769058,17601533792714095233] adv.push_mapval push.262144 push.6 @@ -33,7 +34,13 @@ end # mod miden:base/note-script@1.0.0::p2id -proc.p2id::bindings::miden::basic_wallet::basic_wallet::receive_asset::wit_import7 +@callconv("C") +proc p2id::bindings::miden::basic_wallet::basic_wallet::receive_asset::wit_import7( + felt, + felt, + felt, + felt +) trace.240 nop call.::miden:basic-wallet/basic-wallet@0.1.0::receive-asset @@ -41,11 +48,15 @@ proc.p2id::bindings::miden::basic_wallet::basic_wallet::receive_asset::wit_impor nop end -proc.__wasm_call_ctors +@callconv("C") +proc __wasm_call_ctors( + +) nop end -proc.__rustc::__rust_alloc +@callconv("C") +proc __rustc::__rust_alloc(i32, i32) -> i32 push.1114212 u32divmod.4 swap.1 @@ -54,7 +65,7 @@ proc.__rustc::__rust_alloc exec.::intrinsics::mem::load_sw trace.252 nop - push.1048664 + push.1048672 u32wrapping_add movup.2 swap.1 @@ -65,13 +76,15 @@ proc.__rustc::__rust_alloc nop end -proc.__rustc::__rust_dealloc +@callconv("C") +proc __rustc::__rust_dealloc(i32, i32, i32) drop drop drop end -proc.__rustc::__rust_alloc_zeroed +@callconv("C") +proc __rustc::__rust_alloc_zeroed(i32, i32) -> i32 push.1114212 u32divmod.4 swap.1 @@ -80,7 +93,7 @@ proc.__rustc::__rust_alloc_zeroed exec.::intrinsics::mem::load_sw trace.252 nop - push.1048664 + push.1048672 u32wrapping_add dup.1 swap.2 @@ -155,11 +168,15 @@ proc.__rustc::__rust_alloc_zeroed end end -proc.p2id::bindings::__link_custom_section_describing_imports +@callconv("C") +proc p2id::bindings::__link_custom_section_describing_imports( + +) nop end -proc.miden:base/note-script@1.0.0#run +@callconv("C") +proc miden:base/note-script@1.0.0#run(felt, felt, felt, felt) drop drop drop @@ -194,7 +211,7 @@ proc.miden:base/note-script@1.0.0#run u32wrapping_add trace.240 nop - exec.::miden:base/note-script@1.0.0::p2id::miden_base_sys::bindings::note::get_inputs + exec.::miden:base/note-script@1.0.0::p2id::miden_base_sys::bindings::active_note::get_inputs trace.252 nop push.24 @@ -360,7 +377,7 @@ proc.miden:base/note-script@1.0.0#run u32wrapping_add trace.240 nop - exec.::miden:base/note-script@1.0.0::p2id::miden_base_sys::bindings::note::get_assets + exec.::miden:base/note-script@1.0.0::p2id::miden_base_sys::bindings::active_note::get_assets trace.252 nop push.36 @@ -654,11 +671,17 @@ proc.miden:base/note-script@1.0.0#run end end -proc.__rustc::__rust_no_alloc_shim_is_unstable_v2 +@callconv("C") +proc __rustc::__rust_no_alloc_shim_is_unstable_v2( + +) nop end -proc.wit_bindgen::rt::run_ctors_once +@callconv("C") +proc wit_bindgen::rt::run_ctors_once( + +) push.1114212 u32divmod.4 swap.1 @@ -667,7 +690,7 @@ proc.wit_bindgen::rt::run_ctors_once exec.::intrinsics::mem::load_sw trace.252 nop - push.1048668 + push.1048676 u32wrapping_add u32divmod.4 swap.1 @@ -702,7 +725,7 @@ proc.wit_bindgen::rt::run_ctors_once trace.252 nop push.1 - push.1048668 + push.1048676 movup.2 u32wrapping_add u32divmod.4 @@ -729,7 +752,12 @@ proc.wit_bindgen::rt::run_ctors_once end end -proc.::alloc +@callconv("C") +proc ::alloc( + i32, + i32, + i32 +) -> i32 push.16 push.0 push.16 @@ -904,7 +932,10 @@ proc.::alloc end end -proc.intrinsics::mem::heap_base +@callconv("C") +proc intrinsics::mem::heap_base( + +) -> i32 trace.240 nop exec.::intrinsics::mem::heap_base @@ -912,7 +943,13 @@ proc.intrinsics::mem::heap_base nop end -proc.alloc::raw_vec::RawVecInner::with_capacity_in +@callconv("C") +proc alloc::raw_vec::RawVecInner::with_capacity_in( + i32, + i32, + i32, + i32 +) push.1114208 u32divmod.4 swap.1 @@ -1080,7 +1117,8 @@ proc.alloc::raw_vec::RawVecInner::with_capacity_in end end -proc.miden_base_sys::bindings::account::get_id +@callconv("C") +proc miden_base_sys::bindings::account::get_id(i32) push.1114208 u32divmod.4 swap.1 @@ -1106,7 +1144,7 @@ proc.miden_base_sys::bindings::account::get_id u32wrapping_add trace.240 nop - exec.::miden:base/note-script@1.0.0::p2id::miden::account::get_id + exec.::miden:base/note-script@1.0.0::p2id::miden::active_account::get_id trace.252 nop push.8 @@ -1152,7 +1190,10 @@ proc.miden_base_sys::bindings::account::get_id nop end -proc.miden_base_sys::bindings::note::get_inputs +@callconv("C") +proc miden_base_sys::bindings::active_note::get_inputs( + i32 +) push.1114208 u32divmod.4 swap.1 @@ -1181,7 +1222,7 @@ proc.miden_base_sys::bindings::note::get_inputs exec.::intrinsics::mem::load_sw trace.252 nop - push.1048632 + push.1048640 u32wrapping_add push.4 push.8 @@ -1235,7 +1276,7 @@ proc.miden_base_sys::bindings::note::get_inputs u32shr trace.240 nop - exec.::miden:base/note-script@1.0.0::p2id::miden::note::get_inputs + exec.::miden:base/note-script@1.0.0::p2id::miden::active_note::get_inputs trace.252 nop push.8 @@ -1298,7 +1339,10 @@ proc.miden_base_sys::bindings::note::get_inputs nop end -proc.miden_base_sys::bindings::note::get_assets +@callconv("C") +proc miden_base_sys::bindings::active_note::get_assets( + i32 +) push.1114208 u32divmod.4 swap.1 @@ -1327,7 +1371,7 @@ proc.miden_base_sys::bindings::note::get_assets exec.::intrinsics::mem::load_sw trace.252 nop - push.1048648 + push.1048656 u32wrapping_add push.16 push.8 @@ -1381,7 +1425,7 @@ proc.miden_base_sys::bindings::note::get_assets u32shr trace.240 nop - exec.::miden:base/note-script@1.0.0::p2id::miden::note::get_assets + exec.::miden:base/note-script@1.0.0::p2id::miden::active_note::get_assets trace.252 nop push.8 @@ -1444,11 +1488,17 @@ proc.miden_base_sys::bindings::note::get_assets nop end -proc.intrinsics::felt::eq +@callconv("C") +proc intrinsics::felt::eq(felt, felt) -> i32 eq end -proc.alloc::raw_vec::RawVecInner::deallocate +@callconv("C") +proc alloc::raw_vec::RawVecInner::deallocate( + i32, + i32, + i32 +) push.1114208 u32divmod.4 swap.1 @@ -1560,7 +1610,14 @@ proc.alloc::raw_vec::RawVecInner::deallocate nop end -proc.alloc::raw_vec::RawVecInner::try_allocate_in +@callconv("C") +proc alloc::raw_vec::RawVecInner::try_allocate_in( + i32, + i32, + i32, + i32, + i32 +) push.1114208 u32divmod.4 swap.1 @@ -1966,7 +2023,12 @@ proc.alloc::raw_vec::RawVecInner::try_allocate_in nop end -proc.::allocate +@callconv("C") +proc ::allocate( + i32, + i32, + i32 +) push.1114208 u32divmod.4 swap.1 @@ -2080,7 +2142,13 @@ proc.::allocate nop end -proc.alloc::alloc::Global::alloc_impl +@callconv("C") +proc alloc::alloc::Global::alloc_impl( + i32, + i32, + i32, + i32 +) push.0 push.0 dup.4 @@ -2152,7 +2220,13 @@ proc.alloc::alloc::Global::alloc_impl nop end -proc.alloc::raw_vec::RawVecInner::current_memory +@callconv("C") +proc alloc::raw_vec::RawVecInner::current_memory( + i32, + i32, + i32, + i32 +) push.0 push.0 dup.5 @@ -2278,7 +2352,12 @@ proc.alloc::raw_vec::RawVecInner::current_memory nop end -proc.::deallocate +@callconv("C") +proc ::deallocate( + i32, + i32, + i32 +) push.0 push.0 dup.4 @@ -2299,7 +2378,8 @@ proc.::deallocate end end -proc.alloc::raw_vec::handle_error +@callconv("C") +proc alloc::raw_vec::handle_error(i32, i32, i32) drop drop drop @@ -2307,7 +2387,8 @@ proc.alloc::raw_vec::handle_error assert end -proc.core::ptr::alignment::Alignment::max +@callconv("C") +proc core::ptr::alignment::Alignment::max(i32, i32) -> i32 push.0 dup.2 dup.2 @@ -2317,10 +2398,11 @@ proc.core::ptr::alignment::Alignment::max cdrop end -proc.miden::account::get_id +@callconv("C") +proc miden::active_account::get_id(i32) trace.240 nop - exec.::miden::account::get_id + exec.::miden::active_account::get_id trace.252 nop movup.2 @@ -2346,20 +2428,22 @@ proc.miden::account::get_id nop end -proc.miden::note::get_inputs +@callconv("C") +proc miden::active_note::get_inputs(i32) -> i32 trace.240 nop - exec.::miden::note::get_inputs + exec.::miden::active_note::get_inputs trace.252 nop swap.1 drop end -proc.miden::note::get_assets +@callconv("C") +proc miden::active_note::get_assets(i32) -> i32 trace.240 nop - exec.::miden::note::get_assets + exec.::miden::active_note::get_assets trace.252 nop swap.1 diff --git a/tests/integration/expected/examples/p2id.wat b/tests/integration/expected/examples/p2id.wat index df333dd13..fb01ef410 100644 --- a/tests/integration/expected/examples/p2id.wat +++ b/tests/integration/expected/examples/p2id.wat @@ -44,7 +44,7 @@ (func $__wasm_call_ctors (;1;) (type 1)) (func $__rustc::__rust_alloc (;2;) (type 2) (param i32 i32) (result i32) global.get $GOT.data.internal.__memory_base - i32.const 1048664 + i32.const 1048672 i32.add local.get 1 local.get 0 @@ -54,7 +54,7 @@ (func $__rustc::__rust_alloc_zeroed (;4;) (type 2) (param i32 i32) (result i32) block ;; label = @1 global.get $GOT.data.internal.__memory_base - i32.const 1048664 + i32.const 1048672 i32.add local.get 1 local.get 0 @@ -84,7 +84,7 @@ local.get 4 i32.const 16 i32.add - call $miden_base_sys::bindings::note::get_inputs + call $miden_base_sys::bindings::active_note::get_inputs block ;; label = @1 block ;; label = @2 local.get 4 @@ -122,7 +122,7 @@ local.get 4 i32.const 28 i32.add - call $miden_base_sys::bindings::note::get_assets + call $miden_base_sys::bindings::active_note::get_assets local.get 4 i32.load offset=36 i32.const 4 @@ -193,7 +193,7 @@ (local i32) block ;; label = @1 global.get $GOT.data.internal.__memory_base - i32.const 1048668 + i32.const 1048676 i32.add i32.load8_u br_if 0 (;@1;) @@ -201,7 +201,7 @@ local.set 0 call $__wasm_call_ctors local.get 0 - i32.const 1048668 + i32.const 1048676 i32.add i32.const 1 i32.store8 @@ -335,7 +335,7 @@ local.get 1 i32.const 8 i32.add - call $miden::account::get_id + call $miden::active_account::get_id local.get 0 local.get 1 i64.load offset=8 align=4 @@ -345,7 +345,7 @@ i32.add global.set $__stack_pointer ) - (func $miden_base_sys::bindings::note::get_inputs (;13;) (type 7) (param i32) + (func $miden_base_sys::bindings::active_note::get_inputs (;13;) (type 7) (param i32) (local i32 i32 i32) global.get $__stack_pointer i32.const 16 @@ -358,7 +358,7 @@ i32.const 4 i32.const 4 global.get $GOT.data.internal.__memory_base - i32.const 1048632 + i32.const 1048640 i32.add call $alloc::raw_vec::RawVecInner::with_capacity_in local.get 1 @@ -370,7 +370,7 @@ local.tee 3 i32.const 2 i32.shr_u - call $miden::note::get_inputs + call $miden::active_note::get_inputs i32.store offset=8 local.get 0 local.get 3 @@ -383,7 +383,7 @@ i32.add global.set $__stack_pointer ) - (func $miden_base_sys::bindings::note::get_assets (;14;) (type 7) (param i32) + (func $miden_base_sys::bindings::active_note::get_assets (;14;) (type 7) (param i32) (local i32 i32 i32) global.get $__stack_pointer i32.const 16 @@ -396,7 +396,7 @@ i32.const 16 i32.const 16 global.get $GOT.data.internal.__memory_base - i32.const 1048648 + i32.const 1048656 i32.add call $alloc::raw_vec::RawVecInner::with_capacity_in local.get 1 @@ -408,7 +408,7 @@ local.tee 3 i32.const 2 i32.shr_u - call $miden::note::get_assets + call $miden::active_note::get_assets i32.store offset=8 local.get 0 local.get 3 @@ -681,17 +681,17 @@ i32.gt_u select ) - (func $miden::account::get_id (;24;) (type 7) (param i32) + (func $miden::active_account::get_id (;24;) (type 7) (param i32) unreachable ) - (func $miden::note::get_inputs (;25;) (type 10) (param i32) (result i32) + (func $miden::active_note::get_inputs (;25;) (type 10) (param i32) (result i32) unreachable ) - (func $miden::note::get_assets (;26;) (type 10) (param i32) (result i32) + (func $miden::active_note::get_assets (;26;) (type 10) (param i32) (result i32) unreachable ) - (data $.rodata (;0;) (i32.const 1048576) "miden-base-sys-0.7.0/src/bindings/note.rs\00") - (data $.data (;1;) (i32.const 1048620) "\01\00\00\00\01\00\00\00\01\00\00\00\00\00\10\00)\00\00\00\19\00\00\00!\00\00\00\00\00\10\00)\00\00\007\00\00\00\22\00\00\00") + (data $.rodata (;0;) (i32.const 1048576) "miden-base-sys-0.7.0/src/bindings/active_note.rs\00") + (data $.data (;1;) (i32.const 1048628) "\01\00\00\00\01\00\00\00\01\00\00\00\00\00\10\000\00\00\00\19\00\00\00!\00\00\00\00\00\10\000\00\00\007\00\00\00\22\00\00\00") ) (alias export 0 "word" (type (;3;))) (alias export 1 "receive-asset" (func (;0;))) diff --git a/tests/integration/expected/examples/storage_example.hir b/tests/integration/expected/examples/storage_example.hir index eb83b823e..874485c15 100644 --- a/tests/integration/expected/examples/storage_example.hir +++ b/tests/integration/expected/examples/storage_example.hir @@ -23,7 +23,7 @@ builtin.component miden:storage-example/foo@1.0.0 { hir.exec @miden:storage-example/foo@1.0.0/storage_example/wit_bindgen::rt::run_ctors_once() v9 = arith.constant 0 : i32; v19 = hir.exec @miden:storage-example/foo@1.0.0/storage_example/>::from(v9) : felt - hir.exec @miden:storage-example/foo@1.0.0/storage_example/miden::account::get_item(v19, v15) + hir.exec @miden:storage-example/foo@1.0.0/storage_example/miden::active_account::get_item(v19, v15) v21 = arith.constant 8 : u32; v20 = hir.bitcast v15 : u32; v22 = arith.add v20, v21 : u32 #[overflow = checked]; @@ -99,7 +99,7 @@ builtin.component miden:storage-example/foo@1.0.0 { v80 = hir.bitcast v79 : i32; v82 = arith.neq v80, v540 : i1; scf.if v82{ - ^block51: + ^block52: scf.yield ; } else { ^block12: @@ -111,7 +111,7 @@ builtin.component miden:storage-example/foo@1.0.0 { v87 = hir.bitcast v86 : i32; v89 = arith.neq v87, v538 : i1; scf.if v89{ - ^block50: + ^block51: scf.yield ; } else { ^block13: @@ -123,7 +123,7 @@ builtin.component miden:storage-example/foo@1.0.0 { v94 = hir.bitcast v93 : i32; v96 = arith.neq v94, v536 : i1; scf.if v96{ - ^block49: + ^block50: scf.yield ; } else { ^block14: @@ -135,7 +135,7 @@ builtin.component miden:storage-example/foo@1.0.0 { v101 = hir.bitcast v100 : i32; v103 = arith.neq v101, v534 : i1; scf.if v103{ - ^block48: + ^block49: scf.yield ; } else { ^block15: @@ -178,7 +178,7 @@ builtin.component miden:storage-example/foo@1.0.0 { v135 = hir.load v134 : felt; v528 = arith.constant 48 : i32; v137 = arith.add v15, v528 : i32 #[overflow = wrapping]; - hir.exec @miden:storage-example/foo@1.0.0/storage_example/miden::account::set_map_item(v107, v7, v6, v5, v4, v114, v121, v128, v135, v137) + hir.exec @miden:storage-example/foo@1.0.0/storage_example/miden::native_account::set_map_item(v107, v7, v6, v5, v4, v114, v121, v128, v135, v137) v527 = arith.constant 56 : u32; v138 = hir.bitcast v15 : u32; v140 = arith.add v138, v527 : u32 #[overflow = checked]; @@ -282,7 +282,7 @@ builtin.component miden:storage-example/foo@1.0.0 { v215 = hir.exec @miden:storage-example/foo@1.0.0/storage_example/>::from(v214) : felt v216 = arith.constant 16 : i32; v217 = arith.add v211, v216 : i32 #[overflow = wrapping]; - hir.exec @miden:storage-example/foo@1.0.0/storage_example/miden::account::get_map_item(v215, v204, v203, v202, v201, v217) + hir.exec @miden:storage-example/foo@1.0.0/storage_example/miden::active_account::get_map_item(v215, v204, v203, v202, v201, v217) v219 = arith.constant 24 : u32; v218 = hir.bitcast v211 : u32; v220 = arith.add v218, v219 : u32 #[overflow = checked]; @@ -415,7 +415,7 @@ builtin.component miden:storage-example/foo@1.0.0 { v317 = arith.add v293, v316 : i32 #[overflow = wrapping]; v287 = arith.constant 0 : i32; v610, v611, v612, v613, v614, v615 = scf.while v287, v293, v317, v285 : i32, i32, i32, i32, i32, i32 { - ^block64(v616: i32, v617: i32, v618: i32, v619: i32): + ^block65(v616: i32, v617: i32, v618: i32, v619: i32): v638 = arith.constant 0 : i32; v320 = arith.constant 8 : i32; v321 = arith.eq v616, v320 : i1; @@ -423,7 +423,7 @@ builtin.component miden:storage-example/foo@1.0.0 { v323 = hir.bitcast v322 : i32; v325 = arith.neq v323, v638 : i1; v604, v605 = scf.if v325 : i32, i32 { - ^block63: + ^block64: v564 = ub.poison i32 : i32; scf.yield v564, v564; } else { @@ -469,7 +469,7 @@ builtin.component miden:storage-example/foo@1.0.0 { v597 = arith.trunc v609 : i1; scf.condition v597, v604, v606, v605, v607, v617, v619; } do { - ^block65(v620: i32, v621: i32, v622: i32, v623: i32, v624: i32, v625: i32): + ^block66(v620: i32, v621: i32, v622: i32, v623: i32, v624: i32, v625: i32): scf.yield v620, v621, v622, v623; }; v631 = arith.constant 8 : u32; @@ -557,9 +557,9 @@ builtin.component miden:storage-example/foo@1.0.0 { builtin.ret v411; }; - private builtin.function @miden::account::get_item(v413: felt, v414: i32) { + private builtin.function @miden::active_account::get_item(v413: felt, v414: i32) { ^block36(v413: felt, v414: i32): - v415, v416, v417, v418 = hir.exec @miden/account/get_item(v413) : felt, felt, felt, felt + v415, v416, v417, v418 = hir.exec @miden/active_account/get_item(v413) : felt, felt, felt, felt v419 = hir.bitcast v414 : u32; v420 = hir.int_to_ptr v419 : ptr; hir.store v420, v415; @@ -578,9 +578,9 @@ builtin.component miden:storage-example/foo@1.0.0 { builtin.ret ; }; - private builtin.function @miden::account::get_map_item(v430: felt, v431: felt, v432: felt, v433: felt, v434: felt, v435: i32) { + private builtin.function @miden::active_account::get_map_item(v430: felt, v431: felt, v432: felt, v433: felt, v434: felt, v435: i32) { ^block40(v430: felt, v431: felt, v432: felt, v433: felt, v434: felt, v435: i32): - v436, v437, v438, v439 = hir.exec @miden/account/get_map_item(v430, v431, v432, v433, v434) : felt, felt, felt, felt + v436, v437, v438, v439 = hir.exec @miden/active_account/get_map_item(v430, v431, v432, v433, v434) : felt, felt, felt, felt v440 = hir.bitcast v435 : u32; v441 = hir.int_to_ptr v440 : ptr; hir.store v441, v436; @@ -599,9 +599,9 @@ builtin.component miden:storage-example/foo@1.0.0 { builtin.ret ; }; - private builtin.function @miden::account::set_map_item(v451: felt, v452: felt, v453: felt, v454: felt, v455: felt, v456: felt, v457: felt, v458: felt, v459: felt, v460: i32) { + private builtin.function @miden::native_account::set_map_item(v451: felt, v452: felt, v453: felt, v454: felt, v455: felt, v456: felt, v457: felt, v458: felt, v459: felt, v460: i32) { ^block42(v451: felt, v452: felt, v453: felt, v454: felt, v455: felt, v456: felt, v457: felt, v458: felt, v459: felt, v460: i32): - v461, v462, v463, v464, v465, v466, v467, v468 = hir.exec @miden/account/set_map_item(v451, v452, v453, v454, v455, v456, v457, v458, v459) : felt, felt, felt, felt, felt, felt, felt, felt + v461, v462, v463, v464, v465, v466, v467, v468 = hir.exec @miden/native_account/set_map_item(v451, v452, v453, v454, v455, v456, v457, v458, v459) : felt, felt, felt, felt, felt, felt, felt, felt v469 = hir.bitcast v460 : u32; v470 = hir.int_to_ptr v469 : ptr; hir.store v470, v461; @@ -648,13 +648,13 @@ builtin.component miden:storage-example/foo@1.0.0 { }; public builtin.function @set-asset-qty(v492: felt, v493: felt, v494: felt, v495: felt, v496: felt, v497: felt, v498: felt, v499: felt, v500: felt) { - ^block44(v492: felt, v493: felt, v494: felt, v495: felt, v496: felt, v497: felt, v498: felt, v499: felt, v500: felt): + ^block45(v492: felt, v493: felt, v494: felt, v495: felt, v496: felt, v497: felt, v498: felt, v499: felt, v500: felt): hir.exec @miden:storage-example/foo@1.0.0/storage_example/miden:storage-example/foo@1.0.0#set-asset-qty(v492, v493, v494, v495, v496, v497, v498, v499, v500) builtin.ret ; }; public builtin.function @get-asset-qty(v501: felt, v502: felt, v503: felt, v504: felt) -> felt { - ^block46(v501: felt, v502: felt, v503: felt, v504: felt): + ^block47(v501: felt, v502: felt, v503: felt, v504: felt): v505 = hir.exec @miden:storage-example/foo@1.0.0/storage_example/miden:storage-example/foo@1.0.0#get-asset-qty(v501, v502, v503, v504) : felt builtin.ret v505; }; diff --git a/tests/integration/expected/examples/storage_example.masm b/tests/integration/expected/examples/storage_example.masm index d24fae756..53f76f656 100644 --- a/tests/integration/expected/examples/storage_example.masm +++ b/tests/integration/expected/examples/storage_example.masm @@ -1,6 +1,7 @@ # mod miden:storage-example/foo@1.0.0 -export.set-asset-qty +@callconv("canon-lift") +pub proc set-asset-qty(felt, felt, felt, felt, felt, felt, felt, felt, felt) exec.::miden:storage-example/foo@1.0.0::init trace.240 nop @@ -10,7 +11,8 @@ export.set-asset-qty exec.::std::sys::truncate_stack end -export.get-asset-qty +@callconv("canon-lift") +pub proc get-asset-qty(felt, felt, felt, felt) -> felt exec.::miden:storage-example/foo@1.0.0::init trace.240 nop @@ -20,7 +22,7 @@ export.get-asset-qty exec.::std::sys::truncate_stack end -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -43,15 +45,32 @@ end # mod miden:storage-example/foo@1.0.0::storage_example -proc.__wasm_call_ctors +@callconv("C") +proc __wasm_call_ctors( + +) nop end -proc.storage_example::bindings::__link_custom_section_describing_imports +@callconv("C") +proc storage_example::bindings::__link_custom_section_describing_imports( + +) nop end -proc.miden:storage-example/foo@1.0.0#set-asset-qty +@callconv("C") +proc miden:storage-example/foo@1.0.0#set-asset-qty( + felt, + felt, + felt, + felt, + felt, + felt, + felt, + felt, + felt +) push.1114144 u32divmod.4 swap.1 @@ -87,7 +106,7 @@ proc.miden:storage-example/foo@1.0.0#set-asset-qty swap.1 trace.240 nop - exec.::miden:storage-example/foo@1.0.0::storage_example::miden::account::get_item + exec.::miden:storage-example/foo@1.0.0::storage_example::miden::active_account::get_item trace.252 nop push.8 @@ -408,7 +427,7 @@ proc.miden:storage-example/foo@1.0.0#set-asset-qty swap.5 trace.240 nop - exec.::miden:storage-example/foo@1.0.0::storage_example::miden::account::set_map_item + exec.::miden:storage-example/foo@1.0.0::storage_example::miden::native_account::set_map_item trace.252 nop push.56 @@ -582,7 +601,13 @@ proc.miden:storage-example/foo@1.0.0#set-asset-qty nop end -proc.miden:storage-example/foo@1.0.0#get-asset-qty +@callconv("C") +proc miden:storage-example/foo@1.0.0#get-asset-qty( + felt, + felt, + felt, + felt +) -> felt push.1114144 u32divmod.4 swap.1 @@ -626,7 +651,7 @@ proc.miden:storage-example/foo@1.0.0#get-asset-qty swap.1 trace.240 nop - exec.::miden:storage-example/foo@1.0.0::storage_example::miden::account::get_map_item + exec.::miden:storage-example/foo@1.0.0::storage_example::miden::active_account::get_map_item trace.252 nop push.24 @@ -736,7 +761,10 @@ proc.miden:storage-example/foo@1.0.0#get-asset-qty nop end -proc.wit_bindgen::rt::run_ctors_once +@callconv("C") +proc wit_bindgen::rt::run_ctors_once( + +) push.1114148 u32divmod.4 swap.1 @@ -807,12 +835,19 @@ proc.wit_bindgen::rt::run_ctors_once end end -proc.>::from +@callconv("C") +proc >::from( + i32 +) -> felt push.255 u32and end -proc.miden_stdlib_sys::intrinsics::word::Word::reverse +@callconv("C") +proc miden_stdlib_sys::intrinsics::word::Word::reverse( + i32, + i32 +) push.1114144 u32divmod.4 swap.1 @@ -1073,7 +1108,11 @@ proc.miden_stdlib_sys::intrinsics::word::Word::reverse nop end -proc.>::from +@callconv("C") +proc >::from( + i32, + felt +) push.0 trace.240 nop @@ -1161,18 +1200,21 @@ proc. felt nop end -proc.intrinsics::felt::eq +@callconv("C") +proc intrinsics::felt::eq(felt, felt) -> i32 eq end -proc.miden::account::get_item +@callconv("C") +proc miden::active_account::get_item(felt, i32) trace.240 nop - exec.::miden::account::get_item + exec.::miden::active_account::get_item trace.252 nop movup.4 @@ -1224,10 +1266,11 @@ proc.miden::account::get_item nop end -proc.miden::account::get_map_item +@callconv("C") +proc miden::active_account::get_map_item(felt, felt, felt, felt, felt, i32) trace.240 nop - exec.::miden::account::get_map_item + exec.::miden::active_account::get_map_item trace.252 nop movup.4 @@ -1279,10 +1322,22 @@ proc.miden::account::get_map_item nop end -proc.miden::account::set_map_item - trace.240 - nop - exec.::miden::account::set_map_item +@callconv("C") +proc miden::native_account::set_map_item( + felt, + felt, + felt, + felt, + felt, + felt, + felt, + felt, + felt, + i32 +) + trace.240 + nop + exec.::miden::native_account::set_map_item trace.252 nop movup.8 diff --git a/tests/integration/expected/examples/storage_example.wat b/tests/integration/expected/examples/storage_example.wat index af8398eaf..ce48da296 100644 --- a/tests/integration/expected/examples/storage_example.wat +++ b/tests/integration/expected/examples/storage_example.wat @@ -43,7 +43,7 @@ i32.const 0 call $>::from local.get 9 - call $miden::account::get_item + call $miden::active_account::get_item local.get 9 local.get 9 i64.load offset=8 @@ -116,7 +116,7 @@ local.get 9 i32.const 48 i32.add - call $miden::account::set_map_item + call $miden::native_account::set_map_item local.get 9 local.get 9 i64.load offset=56 @@ -170,7 +170,7 @@ local.get 4 i32.const 16 i32.add - call $miden::account::get_map_item + call $miden::active_account::get_map_item local.get 4 local.get 4 i64.load offset=24 @@ -305,17 +305,17 @@ (func $intrinsics::felt::eq (;9;) (type 6) (param f32 f32) (result i32) unreachable ) - (func $miden::account::get_item (;10;) (type 7) (param f32 i32) + (func $miden::active_account::get_item (;10;) (type 7) (param f32 i32) unreachable ) - (func $miden::account::get_map_item (;11;) (type 8) (param f32 f32 f32 f32 f32 i32) + (func $miden::active_account::get_map_item (;11;) (type 8) (param f32 f32 f32 f32 f32 i32) unreachable ) - (func $miden::account::set_map_item (;12;) (type 9) (param f32 f32 f32 f32 f32 f32 f32 f32 f32 i32) + (func $miden::native_account::set_map_item (;12;) (type 9) (param f32 f32 f32 f32 f32 f32 f32 f32 f32 i32) unreachable ) (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") - (@custom "rodata,miden_account" (after data) "\1fstorage-example_A simple example of a Miden account storage API\0b0.1.0\03\01\05\00\00\00!owner_public_key\01\15test value9auth::rpo_falcon512::pub_key\01\01\01\1basset_qty_map\01\11test map\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00") + (@custom "rodata,miden_account" (after data) "\1fstorage-example_A simple example of a Miden account storage API\0b0.1.0\03\01\05\00\00\00!owner_public_key\01\15test value9auth::rpo_falcon512::pub_key\01\01\00\1basset_qty_map\01\11test map\01\00\00\00\00\00\00\00\00\00\00\00\00\00\00") ) (alias export 0 "felt" (type (;1;))) (alias export 0 "word" (type (;2;))) diff --git a/tests/integration/expected/func_arg_same.masm b/tests/integration/expected/func_arg_same.masm index a52d0bf49..c569bfd27 100644 --- a/tests/integration/expected/func_arg_same.masm +++ b/tests/integration/expected/func_arg_same.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -12,7 +12,8 @@ end # mod root_ns:root@1.0.0::func_arg_same -export.entrypoint +@callconv("C") +pub proc entrypoint(i32, i32) -> i32 swap.1 drop dup.0 @@ -23,7 +24,8 @@ export.entrypoint nop end -export.intrinsic +@callconv("C") +pub proc intrinsic(i32, i32) -> i32 swap.1 drop end diff --git a/tests/integration/expected/ge_felt.masm b/tests/integration/expected/ge_felt.masm index d5462380b..8cf3645ef 100644 --- a/tests/integration/expected/ge_felt.masm +++ b/tests/integration/expected/ge_felt.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -12,7 +12,8 @@ end # mod root_ns:root@1.0.0::ge_felt -export.entrypoint +@callconv("C") +pub proc entrypoint(felt, felt) -> i32 trace.240 nop exec.::root_ns:root@1.0.0::ge_felt::intrinsics::felt::ge @@ -22,7 +23,8 @@ export.entrypoint neq end -proc.intrinsics::felt::ge +@callconv("C") +proc intrinsics::felt::ge(felt, felt) -> i32 swap.1 gte end diff --git a/tests/integration/expected/ge_i32.masm b/tests/integration/expected/ge_i32.masm index 6f6e80941..bc792fac1 100644 --- a/tests/integration/expected/ge_i32.masm +++ b/tests/integration/expected/ge_i32.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -18,7 +18,8 @@ end # mod root_ns:root@1.0.0::test_rust_1e76175a91b5fc3090baafa017f5a38c53c37f1e1a73be7ebaa886f57b9f86fb -export.entrypoint +@callconv("C") +pub proc entrypoint(i32, i32) -> i32 swap.1 trace.240 nop diff --git a/tests/integration/expected/ge_i64.masm b/tests/integration/expected/ge_i64.masm index 1f66cf70c..7d6aee4b8 100644 --- a/tests/integration/expected/ge_i64.masm +++ b/tests/integration/expected/ge_i64.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -18,7 +18,8 @@ end # mod root_ns:root@1.0.0::test_rust_9edabb66d927b03a3d0e64c65bad79cd5488a5bf59a9059a832f3582c7184d6b -export.entrypoint +@callconv("C") +pub proc entrypoint([u32; 2], [u32; 2]) -> i32 movdn.3 movdn.3 trace.240 diff --git a/tests/integration/expected/ge_u16.masm b/tests/integration/expected/ge_u16.masm index 9256b0c94..5052d7455 100644 --- a/tests/integration/expected/ge_u16.masm +++ b/tests/integration/expected/ge_u16.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -18,7 +18,8 @@ end # mod root_ns:root@1.0.0::test_rust_6b89d656eff2711a9ee50d11f22845c4cbbc0df54339492d30dcf628910850d2 -export.entrypoint +@callconv("C") +pub proc entrypoint(i32, i32) -> i32 swap.1 swap.1 swap.1 diff --git a/tests/integration/expected/ge_u32.masm b/tests/integration/expected/ge_u32.masm index e740e594f..208f360d8 100644 --- a/tests/integration/expected/ge_u32.masm +++ b/tests/integration/expected/ge_u32.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -18,7 +18,8 @@ end # mod root_ns:root@1.0.0::test_rust_a6a04660dda2007e5b39d22340b438c2120c4114b075c90883d9b212365eb5fe -export.entrypoint +@callconv("C") +pub proc entrypoint(i32, i32) -> i32 swap.1 swap.1 swap.1 diff --git a/tests/integration/expected/ge_u64.masm b/tests/integration/expected/ge_u64.masm index cd643deb3..3fbaabd8f 100644 --- a/tests/integration/expected/ge_u64.masm +++ b/tests/integration/expected/ge_u64.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -18,7 +18,8 @@ end # mod root_ns:root@1.0.0::test_rust_b008d40be4d6e94465c1a26de42c380b06e09a3774e7a937bf5c338fd437b333 -export.entrypoint +@callconv("C") +pub proc entrypoint([u32; 2], [u32; 2]) -> i32 movdn.3 movdn.3 movdn.3 diff --git a/tests/integration/expected/ge_u8.masm b/tests/integration/expected/ge_u8.masm index 983f1ba1c..3324f0da7 100644 --- a/tests/integration/expected/ge_u8.masm +++ b/tests/integration/expected/ge_u8.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -18,7 +18,8 @@ end # mod root_ns:root@1.0.0::test_rust_a7d66021fee4ca04dff85edcc2a0482cfea1494683ab39c1ae381746dfbf0d98 -export.entrypoint +@callconv("C") +pub proc entrypoint(i32, i32) -> i32 swap.1 swap.1 swap.1 diff --git a/tests/integration/expected/gt_felt.masm b/tests/integration/expected/gt_felt.masm index 2c30c07b2..f32deecff 100644 --- a/tests/integration/expected/gt_felt.masm +++ b/tests/integration/expected/gt_felt.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -12,7 +12,8 @@ end # mod root_ns:root@1.0.0::gt_felt -export.entrypoint +@callconv("C") +pub proc entrypoint(felt, felt) -> i32 trace.240 nop exec.::root_ns:root@1.0.0::gt_felt::intrinsics::felt::gt @@ -22,7 +23,8 @@ export.entrypoint neq end -proc.intrinsics::felt::gt +@callconv("C") +proc intrinsics::felt::gt(felt, felt) -> i32 swap.1 gt end diff --git a/tests/integration/expected/gt_i32.masm b/tests/integration/expected/gt_i32.masm index 520c7b25d..d1e9a5c66 100644 --- a/tests/integration/expected/gt_i32.masm +++ b/tests/integration/expected/gt_i32.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -18,7 +18,8 @@ end # mod root_ns:root@1.0.0::test_rust_9d2e8775109dcfc1c935f1f5d3649375cc140aedefb7659a7c1d3720c82086ec -export.entrypoint +@callconv("C") +pub proc entrypoint(i32, i32) -> i32 swap.1 trace.240 nop diff --git a/tests/integration/expected/gt_i64.masm b/tests/integration/expected/gt_i64.masm index 8ad8e748d..b3a406ee1 100644 --- a/tests/integration/expected/gt_i64.masm +++ b/tests/integration/expected/gt_i64.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -18,7 +18,8 @@ end # mod root_ns:root@1.0.0::test_rust_7d82f2e08b811f59ed036f725c1b72ca685b95ee301d765a74b8f7da3048058b -export.entrypoint +@callconv("C") +pub proc entrypoint([u32; 2], [u32; 2]) -> i32 movdn.3 movdn.3 trace.240 diff --git a/tests/integration/expected/gt_u16.masm b/tests/integration/expected/gt_u16.masm index 599f813ce..9e2a8872e 100644 --- a/tests/integration/expected/gt_u16.masm +++ b/tests/integration/expected/gt_u16.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -18,7 +18,8 @@ end # mod root_ns:root@1.0.0::test_rust_cacaae112ac2013d020f0f82f9c334edde1d01c5854d6174ba2ebf34c2a8fc37 -export.entrypoint +@callconv("C") +pub proc entrypoint(i32, i32) -> i32 swap.1 swap.1 swap.1 diff --git a/tests/integration/expected/gt_u32.masm b/tests/integration/expected/gt_u32.masm index 5bd2610b2..142f33f64 100644 --- a/tests/integration/expected/gt_u32.masm +++ b/tests/integration/expected/gt_u32.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -18,7 +18,8 @@ end # mod root_ns:root@1.0.0::test_rust_35873b6ce3c76e068032779fcd1e75617c26429a13cc7bcd687d3302885cf1f1 -export.entrypoint +@callconv("C") +pub proc entrypoint(i32, i32) -> i32 swap.1 swap.1 swap.1 diff --git a/tests/integration/expected/gt_u64.masm b/tests/integration/expected/gt_u64.masm index 10bc982b9..fecbb3311 100644 --- a/tests/integration/expected/gt_u64.masm +++ b/tests/integration/expected/gt_u64.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -18,7 +18,8 @@ end # mod root_ns:root@1.0.0::test_rust_6489ee5460bd7aa58670638ded1591ff3f7c6abbcc5423cc0a2f5a4feb1ca663 -export.entrypoint +@callconv("C") +pub proc entrypoint([u32; 2], [u32; 2]) -> i32 movdn.3 movdn.3 movdn.3 diff --git a/tests/integration/expected/gt_u8.masm b/tests/integration/expected/gt_u8.masm index af8700fb3..8f99b7c66 100644 --- a/tests/integration/expected/gt_u8.masm +++ b/tests/integration/expected/gt_u8.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -18,7 +18,8 @@ end # mod root_ns:root@1.0.0::test_rust_455aa9bc12d63425df846020b1734fc76252696200bb44305ecdb2dacce6f789 -export.entrypoint +@callconv("C") +pub proc entrypoint(i32, i32) -> i32 swap.1 swap.1 swap.1 diff --git a/tests/integration/expected/hash_elements.masm b/tests/integration/expected/hash_elements.masm index cc7deffdf..a29386b20 100644 --- a/tests/integration/expected/hash_elements.masm +++ b/tests/integration/expected/hash_elements.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -12,7 +12,8 @@ end # mod root_ns:root@1.0.0::hash_elements -export.entrypoint +@callconv("C") +pub proc entrypoint(i32) -> felt push.1114112 u32divmod.4 swap.1 @@ -235,13 +236,18 @@ export.entrypoint nop end -proc.__rustc::__rust_dealloc +@callconv("C") +proc __rustc::__rust_dealloc(i32, i32, i32) drop drop drop end -proc.miden_stdlib_sys::intrinsics::word::Word::reverse +@callconv("C") +proc miden_stdlib_sys::intrinsics::word::Word::reverse( + i32, + i32 +) push.1114112 u32divmod.4 swap.1 @@ -502,15 +508,18 @@ proc.miden_stdlib_sys::intrinsics::word::Word::reverse nop end -proc.intrinsics::felt::from_u32 +@callconv("C") +proc intrinsics::felt::from_u32(i32) -> felt nop end -proc.intrinsics::felt::assert_eq +@callconv("C") +proc intrinsics::felt::assert_eq(felt, felt) assert_eq end -proc.std::crypto::hashes::rpo::hash_memory +@callconv("C") +proc std::crypto::hashes::rpo::hash_memory(i32, i32, i32) trace.240 nop exec.::std::crypto::hashes::rpo::hash_memory @@ -565,7 +574,8 @@ proc.std::crypto::hashes::rpo::hash_memory nop end -proc.std::crypto::hashes::rpo::hash_memory_words +@callconv("C") +proc std::crypto::hashes::rpo::hash_memory_words(i32, i32, i32) trace.240 nop exec.::std::crypto::hashes::rpo::hash_memory_words @@ -620,7 +630,12 @@ proc.std::crypto::hashes::rpo::hash_memory_words nop end -proc.alloc::raw_vec::RawVecInner::deallocate +@callconv("C") +proc alloc::raw_vec::RawVecInner::deallocate( + i32, + i32, + i32 +) push.1114112 u32divmod.4 swap.1 @@ -732,7 +747,13 @@ proc.alloc::raw_vec::RawVecInner::deallocate nop end -proc.alloc::raw_vec::RawVecInner::current_memory +@callconv("C") +proc alloc::raw_vec::RawVecInner::current_memory( + i32, + i32, + i32, + i32 +) push.0 push.0 dup.5 @@ -858,7 +879,12 @@ proc.alloc::raw_vec::RawVecInner::current_memory nop end -proc.::deallocate +@callconv("C") +proc ::deallocate( + i32, + i32, + i32 +) push.0 push.0 dup.4 diff --git a/tests/integration/expected/hash_words.masm b/tests/integration/expected/hash_words.masm index 45cd58bcc..5e2286524 100644 --- a/tests/integration/expected/hash_words.masm +++ b/tests/integration/expected/hash_words.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -12,7 +12,8 @@ end # mod root_ns:root@1.0.0::hash_words -export.entrypoint +@callconv("C") +pub proc entrypoint(i32) -> felt push.1114112 u32divmod.4 swap.1 @@ -216,13 +217,18 @@ export.entrypoint nop end -proc.__rustc::__rust_dealloc +@callconv("C") +proc __rustc::__rust_dealloc(i32, i32, i32) drop drop drop end -proc.miden_stdlib_sys::intrinsics::word::Word::reverse +@callconv("C") +proc miden_stdlib_sys::intrinsics::word::Word::reverse( + i32, + i32 +) push.1114112 u32divmod.4 swap.1 @@ -483,15 +489,18 @@ proc.miden_stdlib_sys::intrinsics::word::Word::reverse nop end -proc.intrinsics::felt::from_u32 +@callconv("C") +proc intrinsics::felt::from_u32(i32) -> felt nop end -proc.intrinsics::felt::assert_eq +@callconv("C") +proc intrinsics::felt::assert_eq(felt, felt) assert_eq end -proc.std::crypto::hashes::rpo::hash_memory_words +@callconv("C") +proc std::crypto::hashes::rpo::hash_memory_words(i32, i32, i32) trace.240 nop exec.::std::crypto::hashes::rpo::hash_memory_words @@ -546,7 +555,12 @@ proc.std::crypto::hashes::rpo::hash_memory_words nop end -proc.alloc::raw_vec::RawVecInner::deallocate +@callconv("C") +proc alloc::raw_vec::RawVecInner::deallocate( + i32, + i32, + i32 +) push.1114112 u32divmod.4 swap.1 @@ -658,7 +672,13 @@ proc.alloc::raw_vec::RawVecInner::deallocate nop end -proc.alloc::raw_vec::RawVecInner::current_memory +@callconv("C") +proc alloc::raw_vec::RawVecInner::current_memory( + i32, + i32, + i32, + i32 +) push.0 push.0 dup.5 @@ -784,7 +804,12 @@ proc.alloc::raw_vec::RawVecInner::current_memory nop end -proc.::deallocate +@callconv("C") +proc ::deallocate( + i32, + i32, + i32 +) push.0 push.0 dup.4 diff --git a/tests/integration/expected/hmerge.masm b/tests/integration/expected/hmerge.masm index a1fd9247b..55e4fc9b6 100644 --- a/tests/integration/expected/hmerge.masm +++ b/tests/integration/expected/hmerge.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -12,7 +12,8 @@ end # mod root_ns:root@1.0.0::hmerge -export.entrypoint +@callconv("C") +pub proc entrypoint(felt, felt, felt, felt, felt, felt, felt, felt) -> felt push.1114112 u32divmod.4 swap.1 @@ -221,7 +222,8 @@ export.entrypoint nop end -proc.intrinsics::crypto::hmerge +@callconv("C") +proc intrinsics::crypto::hmerge(i32, i32) trace.240 nop exec.::intrinsics::crypto::hmerge diff --git a/tests/integration/expected/is_prime.masm b/tests/integration/expected/is_prime.masm index 65a18a366..23a26c588 100644 --- a/tests/integration/expected/is_prime.masm +++ b/tests/integration/expected/is_prime.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -12,7 +12,8 @@ end # mod root_ns:root@1.0.0::is_prime -export.entrypoint +@callconv("C") +pub proc entrypoint(i32) -> i32 push.0 push.2 dup.2 diff --git a/tests/integration/expected/le_felt.masm b/tests/integration/expected/le_felt.masm index b03d5ebca..2ed564b0f 100644 --- a/tests/integration/expected/le_felt.masm +++ b/tests/integration/expected/le_felt.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -12,7 +12,8 @@ end # mod root_ns:root@1.0.0::le_felt -export.entrypoint +@callconv("C") +pub proc entrypoint(felt, felt) -> i32 swap.1 trace.240 nop @@ -23,7 +24,8 @@ export.entrypoint neq end -proc.intrinsics::felt::le +@callconv("C") +proc intrinsics::felt::le(felt, felt) -> i32 swap.1 lte end diff --git a/tests/integration/expected/le_i32.masm b/tests/integration/expected/le_i32.masm index 51dfb239c..aef1ccaba 100644 --- a/tests/integration/expected/le_i32.masm +++ b/tests/integration/expected/le_i32.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -18,7 +18,8 @@ end # mod root_ns:root@1.0.0::test_rust_92cb575434e29cb53446988749bb020eaeee06891c154db71ddd9e1df57a151a -export.entrypoint +@callconv("C") +pub proc entrypoint(i32, i32) -> i32 swap.1 trace.240 nop diff --git a/tests/integration/expected/le_i64.masm b/tests/integration/expected/le_i64.masm index 339b0856c..09b724b0f 100644 --- a/tests/integration/expected/le_i64.masm +++ b/tests/integration/expected/le_i64.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -18,7 +18,8 @@ end # mod root_ns:root@1.0.0::test_rust_d1d5c9c08b80e76c14cb392695a30c0d0f06df4b14bd1301c713918bb7259fd5 -export.entrypoint +@callconv("C") +pub proc entrypoint([u32; 2], [u32; 2]) -> i32 movdn.3 movdn.3 trace.240 diff --git a/tests/integration/expected/le_u16.masm b/tests/integration/expected/le_u16.masm index e26c33f88..e901be650 100644 --- a/tests/integration/expected/le_u16.masm +++ b/tests/integration/expected/le_u16.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -18,7 +18,8 @@ end # mod root_ns:root@1.0.0::test_rust_8e5b56cf449e682f0de4180f5e5ed7f7dd36f7d96e84a0c17bc979aa91efca6e -export.entrypoint +@callconv("C") +pub proc entrypoint(i32, i32) -> i32 swap.1 swap.1 swap.1 diff --git a/tests/integration/expected/le_u32.masm b/tests/integration/expected/le_u32.masm index 08ab3e34b..141017fb8 100644 --- a/tests/integration/expected/le_u32.masm +++ b/tests/integration/expected/le_u32.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -18,7 +18,8 @@ end # mod root_ns:root@1.0.0::test_rust_bb7287e639f21ae334cbe77ea9953a6971d3586eb3527866fb5a973c6a9d7999 -export.entrypoint +@callconv("C") +pub proc entrypoint(i32, i32) -> i32 swap.1 swap.1 swap.1 diff --git a/tests/integration/expected/le_u64.masm b/tests/integration/expected/le_u64.masm index 355cfea5d..99531ccf9 100644 --- a/tests/integration/expected/le_u64.masm +++ b/tests/integration/expected/le_u64.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -18,7 +18,8 @@ end # mod root_ns:root@1.0.0::test_rust_175cf1929f30f3603a14a8443c3a31ee62ac12c89cd674c497750d11c4b1fcb6 -export.entrypoint +@callconv("C") +pub proc entrypoint([u32; 2], [u32; 2]) -> i32 movdn.3 movdn.3 movdn.3 diff --git a/tests/integration/expected/le_u8.masm b/tests/integration/expected/le_u8.masm index 86dbd9d92..331209ff2 100644 --- a/tests/integration/expected/le_u8.masm +++ b/tests/integration/expected/le_u8.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -18,7 +18,8 @@ end # mod root_ns:root@1.0.0::test_rust_6b31118a71e100e1653e01e16012428a3ef4b388ea4b8aa8f00a0e4ff40c4ad9 -export.entrypoint +@callconv("C") +pub proc entrypoint(i32, i32) -> i32 swap.1 swap.1 swap.1 diff --git a/tests/integration/expected/lt_felt.masm b/tests/integration/expected/lt_felt.masm index 8c60af6d6..755e85297 100644 --- a/tests/integration/expected/lt_felt.masm +++ b/tests/integration/expected/lt_felt.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -12,7 +12,8 @@ end # mod root_ns:root@1.0.0::lt_felt -export.entrypoint +@callconv("C") +pub proc entrypoint(felt, felt) -> i32 swap.1 trace.240 nop @@ -23,7 +24,8 @@ export.entrypoint neq end -proc.intrinsics::felt::lt +@callconv("C") +proc intrinsics::felt::lt(felt, felt) -> i32 swap.1 lt end diff --git a/tests/integration/expected/lt_i32.masm b/tests/integration/expected/lt_i32.masm index 2bdc787b1..48a017559 100644 --- a/tests/integration/expected/lt_i32.masm +++ b/tests/integration/expected/lt_i32.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -18,7 +18,8 @@ end # mod root_ns:root@1.0.0::test_rust_5693119d28cd4640a4976d9000775e22d586752187efa219aae5739cf37d894a -export.entrypoint +@callconv("C") +pub proc entrypoint(i32, i32) -> i32 swap.1 trace.240 nop diff --git a/tests/integration/expected/lt_i64.masm b/tests/integration/expected/lt_i64.masm index 3dc3a1649..56271ef55 100644 --- a/tests/integration/expected/lt_i64.masm +++ b/tests/integration/expected/lt_i64.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -18,7 +18,8 @@ end # mod root_ns:root@1.0.0::test_rust_193ef2ef135ab65a9e3987e493e8cf00a81359975e6bffaf693a15c44afbf24b -export.entrypoint +@callconv("C") +pub proc entrypoint([u32; 2], [u32; 2]) -> i32 movdn.3 movdn.3 trace.240 diff --git a/tests/integration/expected/lt_u16.masm b/tests/integration/expected/lt_u16.masm index d8c285783..6c41d77da 100644 --- a/tests/integration/expected/lt_u16.masm +++ b/tests/integration/expected/lt_u16.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -18,7 +18,8 @@ end # mod root_ns:root@1.0.0::test_rust_66380427a6137e56f56ac9060dff040ec50d21b1cf2dab70538313874bc4a594 -export.entrypoint +@callconv("C") +pub proc entrypoint(i32, i32) -> i32 swap.1 swap.1 swap.1 diff --git a/tests/integration/expected/lt_u32.masm b/tests/integration/expected/lt_u32.masm index 0540350e6..830a9d789 100644 --- a/tests/integration/expected/lt_u32.masm +++ b/tests/integration/expected/lt_u32.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -18,7 +18,8 @@ end # mod root_ns:root@1.0.0::test_rust_1fcb2f151e54a93413cfbf27b720161db50a02b59d060ed448c3ffe2c3c9cc6c -export.entrypoint +@callconv("C") +pub proc entrypoint(i32, i32) -> i32 swap.1 swap.1 swap.1 diff --git a/tests/integration/expected/lt_u64.masm b/tests/integration/expected/lt_u64.masm index 9be51afcf..94e201f85 100644 --- a/tests/integration/expected/lt_u64.masm +++ b/tests/integration/expected/lt_u64.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -18,7 +18,8 @@ end # mod root_ns:root@1.0.0::test_rust_416d83d84b3ae500f053222602966b59099d85bd2706dbbaf20b4eb34e76cf0e -export.entrypoint +@callconv("C") +pub proc entrypoint([u32; 2], [u32; 2]) -> i32 movdn.3 movdn.3 movdn.3 diff --git a/tests/integration/expected/lt_u8.masm b/tests/integration/expected/lt_u8.masm index 3e225630b..059bb7c32 100644 --- a/tests/integration/expected/lt_u8.masm +++ b/tests/integration/expected/lt_u8.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -18,7 +18,8 @@ end # mod root_ns:root@1.0.0::test_rust_b8700ecc87997bcf6eefb8bf0b6e645582a0ad9339bbe24fccc168e4c61e746e -export.entrypoint +@callconv("C") +pub proc entrypoint(i32, i32) -> i32 swap.1 swap.1 swap.1 diff --git a/tests/integration/expected/mul_felt.masm b/tests/integration/expected/mul_felt.masm index 81c2b1ae3..ad5311040 100644 --- a/tests/integration/expected/mul_felt.masm +++ b/tests/integration/expected/mul_felt.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -12,7 +12,8 @@ end # mod root_ns:root@1.0.0::mul_felt -export.entrypoint +@callconv("C") +pub proc entrypoint(felt, felt) -> felt trace.240 nop exec.::root_ns:root@1.0.0::mul_felt::intrinsics::felt::mul @@ -20,7 +21,8 @@ export.entrypoint nop end -proc.intrinsics::felt::mul +@callconv("C") +proc intrinsics::felt::mul(felt, felt) -> felt mul end diff --git a/tests/integration/expected/mul_i128.masm b/tests/integration/expected/mul_i128.masm index e9147c808..986c12f21 100644 --- a/tests/integration/expected/mul_i128.masm +++ b/tests/integration/expected/mul_i128.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -18,7 +18,8 @@ end # mod root_ns:root@1.0.0::test_rust_aef84d8c0f31ef839006490963a826949aaedc9315fd0ca99dc18ddcd7c7205b -export.entrypoint.2 +@callconv("C") +pub proc entrypoint.2(i32, [u32; 2], [u32; 2], [u32; 2], [u32; 2]) dup.2 dup.2 push.0 diff --git a/tests/integration/expected/mul_i32.masm b/tests/integration/expected/mul_i32.masm index 1bcbdf0fd..dbc78ec73 100644 --- a/tests/integration/expected/mul_i32.masm +++ b/tests/integration/expected/mul_i32.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -18,7 +18,8 @@ end # mod root_ns:root@1.0.0::test_rust_4a870fe7a144fba5513f0d246ed1179aba172aab8f12afb574634dd1bb298024 -export.entrypoint +@callconv("C") +pub proc entrypoint(i32, i32) -> i32 trace.240 nop exec.::intrinsics::i32::wrapping_mul diff --git a/tests/integration/expected/mul_i64.masm b/tests/integration/expected/mul_i64.masm index eabbd9360..6270f1d6f 100644 --- a/tests/integration/expected/mul_i64.masm +++ b/tests/integration/expected/mul_i64.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -18,7 +18,8 @@ end # mod root_ns:root@1.0.0::test_rust_ee95318918a451f864b66b576532b422841bcd75ad8a62c4d4d3489a9158c08d -export.entrypoint +@callconv("C") +pub proc entrypoint([u32; 2], [u32; 2]) -> [u32; 2] trace.240 nop exec.::intrinsics::i64::wrapping_mul diff --git a/tests/integration/expected/mul_u128.masm b/tests/integration/expected/mul_u128.masm index 3a5a45a90..5715251be 100644 --- a/tests/integration/expected/mul_u128.masm +++ b/tests/integration/expected/mul_u128.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -18,7 +18,8 @@ end # mod root_ns:root@1.0.0::test_rust_47451efa7b59553058cbdbb88f5ae77d281126afc1fd9ca385bcdeb64d64800e -export.entrypoint.2 +@callconv("C") +pub proc entrypoint.2(i32, [u32; 2], [u32; 2], [u32; 2], [u32; 2]) dup.2 dup.2 push.0 diff --git a/tests/integration/expected/mul_u16.masm b/tests/integration/expected/mul_u16.masm index 141789c36..6d2108a1f 100644 --- a/tests/integration/expected/mul_u16.masm +++ b/tests/integration/expected/mul_u16.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -18,7 +18,8 @@ end # mod root_ns:root@1.0.0::test_rust_1503849cd0d258094fa54f6a7e16334db70e5daa56a5858f344d2a2c90b757d6 -export.entrypoint +@callconv("C") +pub proc entrypoint(i32, i32) -> i32 push.65535 movdn.2 trace.240 diff --git a/tests/integration/expected/mul_u32.masm b/tests/integration/expected/mul_u32.masm index 292731b08..b4ba6bb17 100644 --- a/tests/integration/expected/mul_u32.masm +++ b/tests/integration/expected/mul_u32.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -18,7 +18,8 @@ end # mod root_ns:root@1.0.0::test_rust_774ac315a535180c25b481293c43de2ad5b38b8ed718ccd906a367b8df969453 -export.entrypoint +@callconv("C") +pub proc entrypoint(i32, i32) -> i32 trace.240 nop exec.::intrinsics::i32::wrapping_mul diff --git a/tests/integration/expected/mul_u64.masm b/tests/integration/expected/mul_u64.masm index d627223a6..2a281e9b2 100644 --- a/tests/integration/expected/mul_u64.masm +++ b/tests/integration/expected/mul_u64.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -18,7 +18,8 @@ end # mod root_ns:root@1.0.0::test_rust_ef43647914852c132ded20e7ab9569f69610af521a6074095544ea088f8908ae -export.entrypoint +@callconv("C") +pub proc entrypoint([u32; 2], [u32; 2]) -> [u32; 2] trace.240 nop exec.::intrinsics::i64::wrapping_mul diff --git a/tests/integration/expected/mul_u8.masm b/tests/integration/expected/mul_u8.masm index ca010a6f7..358c99b1a 100644 --- a/tests/integration/expected/mul_u8.masm +++ b/tests/integration/expected/mul_u8.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -18,7 +18,8 @@ end # mod root_ns:root@1.0.0::test_rust_3332f4e22611553fee6834bdfb5edc7af11b545fb7a55941be9fef2efaecf059 -export.entrypoint +@callconv("C") +pub proc entrypoint(i32, i32) -> i32 push.255 movdn.2 trace.240 diff --git a/tests/integration/expected/neg_felt.masm b/tests/integration/expected/neg_felt.masm index ea8d3b6b3..66631fc4f 100644 --- a/tests/integration/expected/neg_felt.masm +++ b/tests/integration/expected/neg_felt.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -12,7 +12,8 @@ end # mod root_ns:root@1.0.0::neg_felt -export.entrypoint +@callconv("C") +pub proc entrypoint(felt, felt) -> felt trace.240 nop exec.::root_ns:root@1.0.0::neg_felt::intrinsics::felt::sub @@ -20,7 +21,8 @@ export.entrypoint nop end -proc.intrinsics::felt::sub +@callconv("C") +proc intrinsics::felt::sub(felt, felt) -> felt swap.1 sub end diff --git a/tests/integration/expected/neg_i16.masm b/tests/integration/expected/neg_i16.masm index 6f760a5e2..013982c33 100644 --- a/tests/integration/expected/neg_i16.masm +++ b/tests/integration/expected/neg_i16.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -18,7 +18,8 @@ end # mod root_ns:root@1.0.0::test_rust_ff799fd5021c298afc16f98dda4d174c028df9b4ad9e425d365d3c1fb3cef25a -export.entrypoint +@callconv("C") +pub proc entrypoint(i32) -> i32 push.0 swap.1 u32wrapping_sub diff --git a/tests/integration/expected/neg_i32.masm b/tests/integration/expected/neg_i32.masm index ad558543c..dd43b7e8e 100644 --- a/tests/integration/expected/neg_i32.masm +++ b/tests/integration/expected/neg_i32.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -18,7 +18,8 @@ end # mod root_ns:root@1.0.0::test_rust_ad225f3904404156f79b92bcde2daa108dc69c4c2e00a61030a898c2fcb6f87c -export.entrypoint +@callconv("C") +pub proc entrypoint(i32) -> i32 push.0 swap.1 u32wrapping_sub diff --git a/tests/integration/expected/neg_i64.masm b/tests/integration/expected/neg_i64.masm index a28f394b0..525c58ddc 100644 --- a/tests/integration/expected/neg_i64.masm +++ b/tests/integration/expected/neg_i64.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -18,7 +18,8 @@ end # mod root_ns:root@1.0.0::test_rust_7e6ecbf37c062a73130e37145b77eb9dd3cce8aa16128ac9fcca7dc837ca562c -export.entrypoint +@callconv("C") +pub proc entrypoint([u32; 2]) -> [u32; 2] push.0 push.0 movdn.3 diff --git a/tests/integration/expected/neg_i8.masm b/tests/integration/expected/neg_i8.masm index 906193217..8d0194e5f 100644 --- a/tests/integration/expected/neg_i8.masm +++ b/tests/integration/expected/neg_i8.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -18,7 +18,8 @@ end # mod root_ns:root@1.0.0::test_rust_7564589530886ab89f7963543a4d7e1529e7436aaa330e5e742ddde3149deefe -export.entrypoint +@callconv("C") +pub proc entrypoint(i32) -> i32 push.0 swap.1 u32wrapping_sub diff --git a/tests/integration/expected/or_bool.masm b/tests/integration/expected/or_bool.masm index e42849ab6..35833fa9d 100644 --- a/tests/integration/expected/or_bool.masm +++ b/tests/integration/expected/or_bool.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -18,7 +18,8 @@ end # mod root_ns:root@1.0.0::test_rust_f1d36010a1862f085dfb5f246228723fc87e291a764ca76107b03554afd7db26 -export.entrypoint +@callconv("C") +pub proc entrypoint(i32, i32) -> i32 u32or end diff --git a/tests/integration/expected/rust_sdk/component_macros_account.masm b/tests/integration/expected/rust_sdk/component_macros_account.masm index f530e9aae..57457c550 100644 --- a/tests/integration/expected/rust_sdk/component_macros_account.masm +++ b/tests/integration/expected/rust_sdk/component_macros_account.masm @@ -1,6 +1,20 @@ # mod miden:component-macros-account/component-macros-account@0.1.0 -export.test-custom-types +@callconv("canon-lift") +pub proc test-custom-types( + felt, + felt, + felt, + felt, + felt, + felt, + felt, + felt, + felt, + felt, + felt, + felt +) -> (felt, felt) exec.::miden:component-macros-account/component-macros-account@0.1.0::init trace.240 nop @@ -35,7 +49,21 @@ export.test-custom-types exec.::std::sys::truncate_stack end -export.test-custom-types2 +@callconv("canon-lift") +pub proc test-custom-types2( + felt, + felt, + felt, + felt, + felt, + felt, + felt, + felt, + felt, + felt, + felt, + felt +) -> (felt, felt) exec.::miden:component-macros-account/component-macros-account@0.1.0::init trace.240 nop @@ -70,7 +98,7 @@ export.test-custom-types2 exec.::std::sys::truncate_stack end -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -93,15 +121,35 @@ end # mod miden:component-macros-account/component-macros-account@0.1.0::component_macros_account -proc.__wasm_call_ctors +@callconv("C") +proc __wasm_call_ctors( + +) nop end -proc.component_macros_account::bindings::__link_custom_section_describing_imports +@callconv("C") +proc component_macros_account::bindings::__link_custom_section_describing_imports( + +) nop end -proc.miden:component-macros-account/component-macros-account@0.1.0#test-custom-types +@callconv("C") +proc miden:component-macros-account/component-macros-account@0.1.0#test-custom-types( + felt, + felt, + felt, + felt, + felt, + felt, + felt, + felt, + felt, + felt, + felt, + felt +) -> i32 swap.1 drop swap.1 @@ -174,7 +222,21 @@ proc.miden:component-macros-account/component-macros-account@0.1.0#test-custom-t nop end -proc.miden:component-macros-account/component-macros-account@0.1.0#test-custom-types2 +@callconv("C") +proc miden:component-macros-account/component-macros-account@0.1.0#test-custom-types2( + felt, + felt, + felt, + felt, + felt, + felt, + felt, + felt, + felt, + felt, + felt, + felt +) -> i32 movup.2 drop movup.2 @@ -247,7 +309,10 @@ proc.miden:component-macros-account/component-macros-account@0.1.0#test-custom-t nop end -proc.wit_bindgen::rt::run_ctors_once +@callconv("C") +proc wit_bindgen::rt::run_ctors_once( + +) push.1114148 u32divmod.4 swap.1 diff --git a/tests/integration/expected/rust_sdk/component_macros_note.masm b/tests/integration/expected/rust_sdk/component_macros_note.masm index 6b908a765..47f39c643 100644 --- a/tests/integration/expected/rust_sdk/component_macros_note.masm +++ b/tests/integration/expected/rust_sdk/component_macros_note.masm @@ -1,6 +1,7 @@ # mod miden:base/note-script@1.0.0 -export.run +@callconv("canon-lift") +pub proc run(felt, felt, felt, felt) exec.::miden:base/note-script@1.0.0::init trace.240 nop @@ -10,7 +11,7 @@ export.run exec.::std::sys::truncate_stack end -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -33,7 +34,22 @@ end # mod miden:base/note-script@1.0.0::component_macros_note -proc.component_macros_note::bindings::miden::component_macros_account::component_macros_account::test_custom_types::wit_import22 +@callconv("C") +proc component_macros_note::bindings::miden::component_macros_account::component_macros_account::test_custom_types::wit_import22( + felt, + felt, + felt, + felt, + felt, + felt, + felt, + felt, + felt, + felt, + felt, + felt, + i32 +) trace.240 nop call.::miden:component-macros-account/component-macros-account@0.1.0::test-custom-types @@ -65,15 +81,22 @@ proc.component_macros_note::bindings::miden::component_macros_account::component nop end -proc.__wasm_call_ctors +@callconv("C") +proc __wasm_call_ctors( + +) nop end -proc.component_macros_note::bindings::__link_custom_section_describing_imports +@callconv("C") +proc component_macros_note::bindings::__link_custom_section_describing_imports( + +) nop end -proc.miden:base/note-script@1.0.0#run +@callconv("C") +proc miden:base/note-script@1.0.0#run(felt, felt, felt, felt) drop drop drop @@ -291,7 +314,10 @@ proc.miden:base/note-script@1.0.0#run end end -proc.wit_bindgen::rt::run_ctors_once +@callconv("C") +proc wit_bindgen::rt::run_ctors_once( + +) push.1114148 u32divmod.4 swap.1 @@ -362,11 +388,13 @@ proc.wit_bindgen::rt::run_ctors_once end end -proc.intrinsics::felt::from_u32 +@callconv("C") +proc intrinsics::felt::from_u32(i32) -> felt nop end -proc.intrinsics::felt::eq +@callconv("C") +proc intrinsics::felt::eq(felt, felt) -> i32 eq end diff --git a/tests/integration/expected/rust_sdk/cross_ctx_account.masm b/tests/integration/expected/rust_sdk/cross_ctx_account.masm index e63e3a05c..e5154ae82 100644 --- a/tests/integration/expected/rust_sdk/cross_ctx_account.masm +++ b/tests/integration/expected/rust_sdk/cross_ctx_account.masm @@ -1,6 +1,7 @@ # mod miden:cross-ctx-account/foo@1.0.0 -export.process-felt +@callconv("canon-lift") +pub proc process-felt(felt) -> felt exec.::miden:cross-ctx-account/foo@1.0.0::init trace.240 nop @@ -10,7 +11,7 @@ export.process-felt exec.::std::sys::truncate_stack end -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -33,15 +34,22 @@ end # mod miden:cross-ctx-account/foo@1.0.0::cross_ctx_account -proc.__wasm_call_ctors +@callconv("C") +proc __wasm_call_ctors( + +) nop end -proc.cross_ctx_account::bindings::__link_custom_section_describing_imports +@callconv("C") +proc cross_ctx_account::bindings::__link_custom_section_describing_imports( + +) nop end -proc.miden:cross-ctx-account/foo@1.0.0#process-felt +@callconv("C") +proc miden:cross-ctx-account/foo@1.0.0#process-felt(felt) -> felt push.1114148 u32divmod.4 swap.1 @@ -107,7 +115,10 @@ proc.miden:cross-ctx-account/foo@1.0.0#process-felt nop end -proc.wit_bindgen::rt::run_ctors_once +@callconv("C") +proc wit_bindgen::rt::run_ctors_once( + +) push.1114148 u32divmod.4 swap.1 @@ -178,15 +189,18 @@ proc.wit_bindgen::rt::run_ctors_once end end -proc.intrinsics::felt::add +@callconv("C") +proc intrinsics::felt::add(felt, felt) -> felt add end -proc.intrinsics::felt::from_u32 +@callconv("C") +proc intrinsics::felt::from_u32(i32) -> felt nop end -proc.intrinsics::felt::as_u64 +@callconv("C") +proc intrinsics::felt::as_u64(felt) -> [u32; 2] u32split end diff --git a/tests/integration/expected/rust_sdk/cross_ctx_account_word.masm b/tests/integration/expected/rust_sdk/cross_ctx_account_word.masm index 4dda13776..0d1ac4b4f 100644 --- a/tests/integration/expected/rust_sdk/cross_ctx_account_word.masm +++ b/tests/integration/expected/rust_sdk/cross_ctx_account_word.masm @@ -1,6 +1,7 @@ # mod miden:cross-ctx-account-word/foo@1.0.0 -export.process-word +@callconv("canon-lift") +pub proc process-word(felt, felt, felt, felt) -> (felt, felt, felt, felt) exec.::miden:cross-ctx-account-word/foo@1.0.0::init trace.240 nop @@ -62,7 +63,13 @@ export.process-word exec.::std::sys::truncate_stack end -export.process-another-word +@callconv("canon-lift") +pub proc process-another-word( + felt, + felt, + felt, + felt +) -> (felt, felt, felt, felt) exec.::miden:cross-ctx-account-word/foo@1.0.0::init trace.240 nop @@ -124,7 +131,8 @@ export.process-another-word exec.::std::sys::truncate_stack end -export.process-felt +@callconv("canon-lift") +pub proc process-felt(felt) -> felt exec.::miden:cross-ctx-account-word/foo@1.0.0::init trace.240 nop @@ -134,7 +142,8 @@ export.process-felt exec.::std::sys::truncate_stack end -export.process-pair +@callconv("canon-lift") +pub proc process-pair(felt, felt) -> (felt, felt) exec.::miden:cross-ctx-account-word/foo@1.0.0::init trace.240 nop @@ -169,7 +178,8 @@ export.process-pair exec.::std::sys::truncate_stack end -export.process-triple +@callconv("canon-lift") +pub proc process-triple(felt, felt, felt) -> (felt, felt, felt) exec.::miden:cross-ctx-account-word/foo@1.0.0::init trace.240 nop @@ -216,7 +226,16 @@ export.process-triple exec.::std::sys::truncate_stack end -export.process-mixed +@callconv("canon-lift") +pub proc process-mixed( + [u32; 2], + felt, + i32, + felt, + i32, + i32, + i32 +) -> ([u32; 2], felt, i32, felt, i32, i32, i32) exec.::miden:cross-ctx-account-word/foo@1.0.0::init trace.240 nop @@ -327,7 +346,8 @@ export.process-mixed exec.::std::sys::truncate_stack end -export.process-nested +@callconv("canon-lift") +pub proc process-nested(felt, felt, felt) -> (felt, felt, felt) exec.::miden:cross-ctx-account-word/foo@1.0.0::init trace.240 nop @@ -377,7 +397,7 @@ export.process-nested exec.::std::sys::truncate_stack end -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -400,15 +420,27 @@ end # mod miden:cross-ctx-account-word/foo@1.0.0::cross_ctx_account_word -proc.__wasm_call_ctors +@callconv("C") +proc __wasm_call_ctors( + +) nop end -proc.cross_ctx_account_word::bindings::__link_custom_section_describing_imports +@callconv("C") +proc cross_ctx_account_word::bindings::__link_custom_section_describing_imports( + +) nop end -proc.miden:cross-ctx-account-word/foo@1.0.0#process-word +@callconv("C") +proc miden:cross-ctx-account-word/foo@1.0.0#process-word( + felt, + felt, + felt, + felt +) -> i32 push.1114148 u32divmod.4 swap.1 @@ -546,7 +578,13 @@ proc.miden:cross-ctx-account-word/foo@1.0.0#process-word nop end -proc.miden:cross-ctx-account-word/foo@1.0.0#process-another-word +@callconv("C") +proc miden:cross-ctx-account-word/foo@1.0.0#process-another-word( + felt, + felt, + felt, + felt +) -> i32 push.1114148 u32divmod.4 swap.1 @@ -684,7 +722,8 @@ proc.miden:cross-ctx-account-word/foo@1.0.0#process-another-word nop end -proc.miden:cross-ctx-account-word/foo@1.0.0#process-felt +@callconv("C") +proc miden:cross-ctx-account-word/foo@1.0.0#process-felt(felt) -> felt trace.240 nop exec.::miden:cross-ctx-account-word/foo@1.0.0::cross_ctx_account_word::wit_bindgen::rt::run_ctors_once @@ -704,7 +743,8 @@ proc.miden:cross-ctx-account-word/foo@1.0.0#process-felt nop end -proc.miden:cross-ctx-account-word/foo@1.0.0#process-pair +@callconv("C") +proc miden:cross-ctx-account-word/foo@1.0.0#process-pair(felt, felt) -> i32 push.1114148 u32divmod.4 swap.1 @@ -780,7 +820,12 @@ proc.miden:cross-ctx-account-word/foo@1.0.0#process-pair nop end -proc.miden:cross-ctx-account-word/foo@1.0.0#process-triple +@callconv("C") +proc miden:cross-ctx-account-word/foo@1.0.0#process-triple( + felt, + felt, + felt +) -> i32 push.1114148 u32divmod.4 swap.1 @@ -887,7 +932,16 @@ proc.miden:cross-ctx-account-word/foo@1.0.0#process-triple nop end -proc.miden:cross-ctx-account-word/foo@1.0.0#process-mixed +@callconv("C") +proc miden:cross-ctx-account-word/foo@1.0.0#process-mixed( + [u32; 2], + felt, + i32, + felt, + i32, + i32, + i32 +) -> i32 push.1114148 u32divmod.4 swap.1 @@ -1112,7 +1166,12 @@ proc.miden:cross-ctx-account-word/foo@1.0.0#process-mixed nop end -proc.miden:cross-ctx-account-word/foo@1.0.0#process-nested +@callconv("C") +proc miden:cross-ctx-account-word/foo@1.0.0#process-nested( + felt, + felt, + felt +) -> i32 push.1114148 u32divmod.4 swap.1 @@ -1219,7 +1278,10 @@ proc.miden:cross-ctx-account-word/foo@1.0.0#process-nested nop end -proc.wit_bindgen::rt::run_ctors_once +@callconv("C") +proc wit_bindgen::rt::run_ctors_once( + +) push.1114148 u32divmod.4 swap.1 @@ -1290,11 +1352,13 @@ proc.wit_bindgen::rt::run_ctors_once end end -proc.intrinsics::felt::add +@callconv("C") +proc intrinsics::felt::add(felt, felt) -> felt add end -proc.intrinsics::felt::from_u32 +@callconv("C") +proc intrinsics::felt::from_u32(i32) -> felt nop end diff --git a/tests/integration/expected/rust_sdk/cross_ctx_account_word_arg.masm b/tests/integration/expected/rust_sdk/cross_ctx_account_word_arg.masm index c0602906f..bb4651b26 100644 --- a/tests/integration/expected/rust_sdk/cross_ctx_account_word_arg.masm +++ b/tests/integration/expected/rust_sdk/cross_ctx_account_word_arg.masm @@ -1,6 +1,24 @@ # mod miden:cross-ctx-account-word-arg/foo@1.0.0 -export.process-word +@callconv("canon-lift") +pub proc process-word( + felt, + felt, + felt, + felt, + felt, + felt, + felt, + felt, + felt, + felt, + felt, + felt, + felt, + felt, + felt, + felt +) -> felt exec.::miden:cross-ctx-account-word-arg/foo@1.0.0::init trace.240 nop @@ -10,7 +28,7 @@ export.process-word exec.::std::sys::truncate_stack end -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -33,15 +51,39 @@ end # mod miden:cross-ctx-account-word-arg/foo@1.0.0::cross_ctx_account_word_arg -proc.__wasm_call_ctors +@callconv("C") +proc __wasm_call_ctors( + +) nop end -proc.cross_ctx_account_word_arg::bindings::__link_custom_section_describing_imports +@callconv("C") +proc cross_ctx_account_word_arg::bindings::__link_custom_section_describing_imports( + +) nop end -proc.miden:cross-ctx-account-word-arg/foo@1.0.0#process-word.1 +@callconv("C") +proc miden:cross-ctx-account-word-arg/foo@1.0.0#process-word.1( + felt, + felt, + felt, + felt, + felt, + felt, + felt, + felt, + felt, + felt, + felt, + felt, + felt, + felt, + felt, + felt +) -> felt trace.240 nop exec.::miden:cross-ctx-account-word-arg/foo@1.0.0::cross_ctx_account_word_arg::wit_bindgen::rt::run_ctors_once @@ -337,7 +379,10 @@ proc.miden:cross-ctx-account-word-arg/foo@1.0.0#process-word.1 nop end -proc.wit_bindgen::rt::run_ctors_once +@callconv("C") +proc wit_bindgen::rt::run_ctors_once( + +) push.1114148 u32divmod.4 swap.1 @@ -408,15 +453,18 @@ proc.wit_bindgen::rt::run_ctors_once end end -proc.intrinsics::felt::add +@callconv("C") +proc intrinsics::felt::add(felt, felt) -> felt add end -proc.intrinsics::felt::from_u32 +@callconv("C") +proc intrinsics::felt::from_u32(i32) -> felt nop end -proc.intrinsics::felt::mul +@callconv("C") +proc intrinsics::felt::mul(felt, felt) -> felt mul end diff --git a/tests/integration/expected/rust_sdk/cross_ctx_note.masm b/tests/integration/expected/rust_sdk/cross_ctx_note.masm index 7649f6abf..4cc1e9f6e 100644 --- a/tests/integration/expected/rust_sdk/cross_ctx_note.masm +++ b/tests/integration/expected/rust_sdk/cross_ctx_note.masm @@ -1,6 +1,7 @@ # mod miden:base/note-script@1.0.0 -export.run +@callconv("canon-lift") +pub proc run(felt, felt, felt, felt) exec.::miden:base/note-script@1.0.0::init trace.240 nop @@ -10,7 +11,7 @@ export.run exec.::std::sys::truncate_stack end -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -33,7 +34,10 @@ end # mod miden:base/note-script@1.0.0::cross_ctx_note -proc.cross_ctx_note::bindings::miden::cross_ctx_account::foo::process_felt::wit_import1 +@callconv("C") +proc cross_ctx_note::bindings::miden::cross_ctx_account::foo::process_felt::wit_import1( + felt +) -> felt trace.240 nop call.::miden:cross-ctx-account/foo@1.0.0::process-felt @@ -41,15 +45,22 @@ proc.cross_ctx_note::bindings::miden::cross_ctx_account::foo::process_felt::wit_ nop end -proc.__wasm_call_ctors +@callconv("C") +proc __wasm_call_ctors( + +) nop end -proc.cross_ctx_note::bindings::__link_custom_section_describing_imports +@callconv("C") +proc cross_ctx_note::bindings::__link_custom_section_describing_imports( + +) nop end -proc.miden:base/note-script@1.0.0#run +@callconv("C") +proc miden:base/note-script@1.0.0#run(felt, felt, felt, felt) drop drop drop @@ -141,7 +152,10 @@ proc.miden:base/note-script@1.0.0#run nop end -proc.wit_bindgen::rt::run_ctors_once +@callconv("C") +proc wit_bindgen::rt::run_ctors_once( + +) push.1114148 u32divmod.4 swap.1 @@ -212,15 +226,18 @@ proc.wit_bindgen::rt::run_ctors_once end end -proc.intrinsics::felt::from_u32 +@callconv("C") +proc intrinsics::felt::from_u32(i32) -> felt nop end -proc.intrinsics::felt::as_u64 +@callconv("C") +proc intrinsics::felt::as_u64(felt) -> [u32; 2] u32split end -proc.intrinsics::felt::assert_eq +@callconv("C") +proc intrinsics::felt::assert_eq(felt, felt) assert_eq end diff --git a/tests/integration/expected/rust_sdk/cross_ctx_note_word.masm b/tests/integration/expected/rust_sdk/cross_ctx_note_word.masm index bed2bbc74..4fb5b0261 100644 --- a/tests/integration/expected/rust_sdk/cross_ctx_note_word.masm +++ b/tests/integration/expected/rust_sdk/cross_ctx_note_word.masm @@ -1,6 +1,7 @@ # mod miden:base/note-script@1.0.0 -export.run +@callconv("canon-lift") +pub proc run(felt, felt, felt, felt) exec.::miden:base/note-script@1.0.0::init trace.240 nop @@ -10,7 +11,7 @@ export.run exec.::std::sys::truncate_stack end -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -33,7 +34,14 @@ end # mod miden:base/note-script@1.0.0::cross_ctx_note_word -proc.cross_ctx_note_word::bindings::miden::cross_ctx_account_word::foo::process_word::wit_import7 +@callconv("C") +proc cross_ctx_note_word::bindings::miden::cross_ctx_account_word::foo::process_word::wit_import7( + felt, + felt, + felt, + felt, + i32 +) trace.240 nop call.::miden:cross-ctx-account-word/foo@1.0.0::process-word @@ -98,7 +106,14 @@ proc.cross_ctx_note_word::bindings::miden::cross_ctx_account_word::foo::process_ nop end -proc.cross_ctx_note_word::bindings::miden::cross_ctx_account_word::foo::process_another_word::wit_import7 +@callconv("C") +proc cross_ctx_note_word::bindings::miden::cross_ctx_account_word::foo::process_another_word::wit_import7( + felt, + felt, + felt, + felt, + i32 +) trace.240 nop call.::miden:cross-ctx-account-word/foo@1.0.0::process-another-word @@ -163,7 +178,10 @@ proc.cross_ctx_note_word::bindings::miden::cross_ctx_account_word::foo::process_ nop end -proc.cross_ctx_note_word::bindings::miden::cross_ctx_account_word::foo::process_felt::wit_import1 +@callconv("C") +proc cross_ctx_note_word::bindings::miden::cross_ctx_account_word::foo::process_felt::wit_import1( + felt +) -> felt trace.240 nop call.::miden:cross-ctx-account-word/foo@1.0.0::process-felt @@ -171,7 +189,12 @@ proc.cross_ctx_note_word::bindings::miden::cross_ctx_account_word::foo::process_ nop end -proc.cross_ctx_note_word::bindings::miden::cross_ctx_account_word::foo::process_pair::wit_import4 +@callconv("C") +proc cross_ctx_note_word::bindings::miden::cross_ctx_account_word::foo::process_pair::wit_import4( + felt, + felt, + i32 +) trace.240 nop call.::miden:cross-ctx-account-word/foo@1.0.0::process-pair @@ -203,7 +226,13 @@ proc.cross_ctx_note_word::bindings::miden::cross_ctx_account_word::foo::process_ nop end -proc.cross_ctx_note_word::bindings::miden::cross_ctx_account_word::foo::process_triple::wit_import5 +@callconv("C") +proc cross_ctx_note_word::bindings::miden::cross_ctx_account_word::foo::process_triple::wit_import5( + felt, + felt, + felt, + i32 +) trace.240 nop call.::miden:cross-ctx-account-word/foo@1.0.0::process-triple @@ -247,7 +276,17 @@ proc.cross_ctx_note_word::bindings::miden::cross_ctx_account_word::foo::process_ nop end -proc.cross_ctx_note_word::bindings::miden::cross_ctx_account_word::foo::process_mixed::wit_import4 +@callconv("C") +proc cross_ctx_note_word::bindings::miden::cross_ctx_account_word::foo::process_mixed::wit_import4( + [u32; 2], + felt, + i32, + felt, + i32, + i32, + i32, + i32 +) trace.240 nop call.::miden:cross-ctx-account-word/foo@1.0.0::process-mixed @@ -371,7 +410,13 @@ proc.cross_ctx_note_word::bindings::miden::cross_ctx_account_word::foo::process_ mem_store end -proc.cross_ctx_note_word::bindings::miden::cross_ctx_account_word::foo::process_nested::wit_import6 +@callconv("C") +proc cross_ctx_note_word::bindings::miden::cross_ctx_account_word::foo::process_nested::wit_import6( + felt, + felt, + felt, + i32 +) trace.240 nop call.::miden:cross-ctx-account-word/foo@1.0.0::process-nested @@ -420,15 +465,22 @@ proc.cross_ctx_note_word::bindings::miden::cross_ctx_account_word::foo::process_ nop end -proc.__wasm_call_ctors +@callconv("C") +proc __wasm_call_ctors( + +) nop end -proc.cross_ctx_note_word::bindings::__link_custom_section_describing_imports +@callconv("C") +proc cross_ctx_note_word::bindings::__link_custom_section_describing_imports( + +) nop end -proc.miden:base/note-script@1.0.0#run +@callconv("C") +proc miden:base/note-script@1.0.0#run(felt, felt, felt, felt) drop drop drop @@ -1381,7 +1433,10 @@ proc.miden:base/note-script@1.0.0#run end end -proc.wit_bindgen::rt::run_ctors_once +@callconv("C") +proc wit_bindgen::rt::run_ctors_once( + +) push.1114148 u32divmod.4 swap.1 @@ -1452,21 +1507,31 @@ proc.wit_bindgen::rt::run_ctors_once end end -proc.>::from +@callconv("C") +proc >::from( + i32 +) -> felt nop end -proc.>::from +@callconv("C") +proc >::from( + i32 +) -> felt push.65535 u32and end -proc.>::from +@callconv("C") +proc >::from( + i32 +) -> felt push.255 u32and end -proc.intrinsics::felt::from_u64_unchecked +@callconv("C") +proc intrinsics::felt::from_u64_unchecked([u32; 2]) -> felt dup.1 dup.1 push.1 @@ -1481,11 +1546,13 @@ proc.intrinsics::felt::from_u64_unchecked add end -proc.intrinsics::felt::from_u32 +@callconv("C") +proc intrinsics::felt::from_u32(i32) -> felt nop end -proc.intrinsics::felt::assert_eq +@callconv("C") +proc intrinsics::felt::assert_eq(felt, felt) assert_eq end diff --git a/tests/integration/expected/rust_sdk/cross_ctx_note_word_arg.masm b/tests/integration/expected/rust_sdk/cross_ctx_note_word_arg.masm index e8c7a800a..1857a734d 100644 --- a/tests/integration/expected/rust_sdk/cross_ctx_note_word_arg.masm +++ b/tests/integration/expected/rust_sdk/cross_ctx_note_word_arg.masm @@ -1,6 +1,7 @@ # mod miden:base/note-script@1.0.0 -export.run +@callconv("canon-lift") +pub proc run(felt, felt, felt, felt) exec.::miden:base/note-script@1.0.0::init trace.240 nop @@ -10,7 +11,7 @@ export.run exec.::std::sys::truncate_stack end -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -33,7 +34,25 @@ end # mod miden:base/note-script@1.0.0::cross_ctx_note_word_arg -proc.cross_ctx_note_word_arg::bindings::miden::cross_ctx_account_word_arg::foo::process_word::wit_import22 +@callconv("C") +proc cross_ctx_note_word_arg::bindings::miden::cross_ctx_account_word_arg::foo::process_word::wit_import22( + felt, + felt, + felt, + felt, + felt, + felt, + felt, + felt, + felt, + felt, + felt, + felt, + felt, + felt, + felt, + felt +) -> felt trace.240 nop call.::miden:cross-ctx-account-word-arg/foo@1.0.0::process-word @@ -41,15 +60,22 @@ proc.cross_ctx_note_word_arg::bindings::miden::cross_ctx_account_word_arg::foo:: nop end -proc.__wasm_call_ctors +@callconv("C") +proc __wasm_call_ctors( + +) nop end -proc.cross_ctx_note_word_arg::bindings::__link_custom_section_describing_imports +@callconv("C") +proc cross_ctx_note_word_arg::bindings::__link_custom_section_describing_imports( + +) nop end -proc.miden:base/note-script@1.0.0#run +@callconv("C") +proc miden:base/note-script@1.0.0#run(felt, felt, felt, felt) drop drop drop @@ -196,7 +222,10 @@ proc.miden:base/note-script@1.0.0#run nop end -proc.wit_bindgen::rt::run_ctors_once +@callconv("C") +proc wit_bindgen::rt::run_ctors_once( + +) push.1114148 u32divmod.4 swap.1 @@ -267,11 +296,13 @@ proc.wit_bindgen::rt::run_ctors_once end end -proc.intrinsics::felt::from_u32 +@callconv("C") +proc intrinsics::felt::from_u32(i32) -> felt nop end -proc.intrinsics::felt::assert_eq +@callconv("C") +proc intrinsics::felt::assert_eq(felt, felt) assert_eq end diff --git a/tests/integration/expected/rust_sdk/rust_sdk_swapp_note_bindings.hir b/tests/integration/expected/rust_sdk/rust_sdk_swapp_note_bindings.hir index e13f3c6f3..ee1fa3442 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_swapp_note_bindings.hir +++ b/tests/integration/expected/rust_sdk/rust_sdk_swapp_note_bindings.hir @@ -138,7 +138,7 @@ builtin.component miden:base/note-script@1.0.0 { hir.exec @miden:base/note-script@1.0.0/rust_sdk_swapp_note_bindings/wit_bindgen::rt::run_ctors_once() v97 = arith.constant 8 : i32; v98 = arith.add v94, v97 : i32 #[overflow = wrapping]; - hir.exec @miden:base/note-script@1.0.0/rust_sdk_swapp_note_bindings/miden_base_sys::bindings::note::get_sender(v98) + hir.exec @miden:base/note-script@1.0.0/rust_sdk_swapp_note_bindings/miden_base_sys::bindings::active_note::get_sender(v98) v100 = arith.constant 12 : u32; v99 = hir.bitcast v94 : u32; v101 = arith.add v99, v100 : u32 #[overflow = checked]; @@ -157,10 +157,10 @@ builtin.component miden:base/note-script@1.0.0 { v112 = hir.load v111 : felt; v113 = arith.constant 16 : i32; v114 = arith.add v94, v113 : i32 #[overflow = wrapping]; - hir.exec @miden:base/note-script@1.0.0/rust_sdk_swapp_note_bindings/miden_base_sys::bindings::note::get_script_root(v114) + hir.exec @miden:base/note-script@1.0.0/rust_sdk_swapp_note_bindings/miden_base_sys::bindings::active_note::get_script_root(v114) v115 = arith.constant 32 : i32; v116 = arith.add v94, v115 : i32 #[overflow = wrapping]; - hir.exec @miden:base/note-script@1.0.0/rust_sdk_swapp_note_bindings/miden_base_sys::bindings::note::get_serial_number(v116) + hir.exec @miden:base/note-script@1.0.0/rust_sdk_swapp_note_bindings/miden_base_sys::bindings::active_note::get_serial_number(v116) v117 = hir.exec @miden:base/note-script@1.0.0/rust_sdk_swapp_note_bindings/miden_base_sys::bindings::account::get_balance(v112, v105) : felt v118 = hir.exec @miden:base/note-script@1.0.0/rust_sdk_swapp_note_bindings/intrinsics::felt::eq(v112, v112) : i32 v88 = arith.constant 0 : i32; @@ -297,11 +297,11 @@ builtin.component miden:base/note-script@1.0.0 { private builtin.function @miden_base_sys::bindings::account::get_balance(v188: felt, v189: felt) -> felt { ^block27(v188: felt, v189: felt): - v191 = hir.exec @miden:base/note-script@1.0.0/rust_sdk_swapp_note_bindings/miden::account::get_balance(v188, v189) : felt + v191 = hir.exec @miden:base/note-script@1.0.0/rust_sdk_swapp_note_bindings/miden::active_account::get_balance(v188, v189) : felt builtin.ret v191; }; - private builtin.function @miden_base_sys::bindings::note::get_sender(v192: i32) { + private builtin.function @miden_base_sys::bindings::active_note::get_sender(v192: i32) { ^block29(v192: i32): v194 = builtin.global_symbol @miden:base/note-script@1.0.0/rust_sdk_swapp_note_bindings/__stack_pointer : ptr v195 = hir.bitcast v194 : ptr; @@ -313,7 +313,7 @@ builtin.component miden:base/note-script@1.0.0 { hir.store v200, v198; v201 = arith.constant 8 : i32; v202 = arith.add v198, v201 : i32 #[overflow = wrapping]; - hir.exec @miden:base/note-script@1.0.0/rust_sdk_swapp_note_bindings/miden::note::get_sender(v202) + hir.exec @miden:base/note-script@1.0.0/rust_sdk_swapp_note_bindings/miden::active_note::get_sender(v202) v204 = arith.constant 8 : u32; v203 = hir.bitcast v198 : u32; v205 = arith.add v203, v204 : u32 #[overflow = checked]; @@ -336,7 +336,7 @@ builtin.component miden:base/note-script@1.0.0 { builtin.ret ; }; - private builtin.function @miden_base_sys::bindings::note::get_script_root(v218: i32) { + private builtin.function @miden_base_sys::bindings::active_note::get_script_root(v218: i32) { ^block31(v218: i32): v220 = builtin.global_symbol @miden:base/note-script@1.0.0/rust_sdk_swapp_note_bindings/__stack_pointer : ptr v221 = hir.bitcast v220 : ptr; @@ -346,7 +346,7 @@ builtin.component miden:base/note-script@1.0.0 { v225 = builtin.global_symbol @miden:base/note-script@1.0.0/rust_sdk_swapp_note_bindings/__stack_pointer : ptr v226 = hir.bitcast v225 : ptr; hir.store v226, v224; - hir.exec @miden:base/note-script@1.0.0/rust_sdk_swapp_note_bindings/miden::note::get_script_root(v224) + hir.exec @miden:base/note-script@1.0.0/rust_sdk_swapp_note_bindings/miden::active_note::get_script_root(v224) v228 = arith.constant 8 : u32; v227 = hir.bitcast v224 : u32; v229 = arith.add v227, v228 : u32 #[overflow = checked]; @@ -388,7 +388,7 @@ builtin.component miden:base/note-script@1.0.0 { builtin.ret ; }; - private builtin.function @miden_base_sys::bindings::note::get_serial_number(v257: i32) { + private builtin.function @miden_base_sys::bindings::active_note::get_serial_number(v257: i32) { ^block33(v257: i32): v259 = builtin.global_symbol @miden:base/note-script@1.0.0/rust_sdk_swapp_note_bindings/__stack_pointer : ptr v260 = hir.bitcast v259 : ptr; @@ -398,7 +398,7 @@ builtin.component miden:base/note-script@1.0.0 { v264 = builtin.global_symbol @miden:base/note-script@1.0.0/rust_sdk_swapp_note_bindings/__stack_pointer : ptr v265 = hir.bitcast v264 : ptr; hir.store v265, v263; - hir.exec @miden:base/note-script@1.0.0/rust_sdk_swapp_note_bindings/miden::note::get_serial_number(v263) + hir.exec @miden:base/note-script@1.0.0/rust_sdk_swapp_note_bindings/miden::active_note::get_serial_number(v263) v267 = arith.constant 8 : u32; v266 = hir.bitcast v263 : u32; v268 = arith.add v266, v267 : u32 #[overflow = checked]; @@ -574,15 +574,15 @@ builtin.component miden:base/note-script@1.0.0 { builtin.ret v388; }; - private builtin.function @miden::account::get_balance(v390: felt, v391: felt) -> felt { + private builtin.function @miden::active_account::get_balance(v390: felt, v391: felt) -> felt { ^block43(v390: felt, v391: felt): - v392 = hir.exec @miden/account/get_balance(v390, v391) : felt + v392 = hir.exec @miden/active_account/get_balance(v390, v391) : felt builtin.ret v392; }; - private builtin.function @miden::note::get_sender(v394: i32) { + private builtin.function @miden::active_note::get_sender(v394: i32) { ^block47(v394: i32): - v395, v396 = hir.exec @miden/note/get_sender() : felt, felt + v395, v396 = hir.exec @miden/active_note/get_sender() : felt, felt v397 = hir.bitcast v394 : u32; v398 = hir.int_to_ptr v397 : ptr; hir.store v398, v395; @@ -593,9 +593,9 @@ builtin.component miden:base/note-script@1.0.0 { builtin.ret ; }; - private builtin.function @miden::note::get_script_root(v402: i32) { + private builtin.function @miden::active_note::get_script_root(v402: i32) { ^block50(v402: i32): - v403, v404, v405, v406 = hir.exec @miden/note/get_script_root() : felt, felt, felt, felt + v403, v404, v405, v406 = hir.exec @miden/active_note/get_script_root() : felt, felt, felt, felt v407 = hir.bitcast v402 : u32; v408 = hir.int_to_ptr v407 : ptr; hir.store v408, v403; @@ -614,9 +614,9 @@ builtin.component miden:base/note-script@1.0.0 { builtin.ret ; }; - private builtin.function @miden::note::get_serial_number(v418: i32) { + private builtin.function @miden::active_note::get_serial_number(v418: i32) { ^block52(v418: i32): - v419, v420, v421, v422 = hir.exec @miden/note/get_serial_number() : felt, felt, felt, felt + v419, v420, v421, v422 = hir.exec @miden/active_note/get_serial_number() : felt, felt, felt, felt v423 = hir.bitcast v418 : u32; v424 = hir.int_to_ptr v423 : ptr; hir.store v424, v419; diff --git a/tests/integration/expected/rust_sdk/rust_sdk_swapp_note_bindings.masm b/tests/integration/expected/rust_sdk/rust_sdk_swapp_note_bindings.masm index 9761fa4f2..1ea381efd 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_swapp_note_bindings.masm +++ b/tests/integration/expected/rust_sdk/rust_sdk_swapp_note_bindings.masm @@ -1,6 +1,7 @@ # mod miden:base/note-script@1.0.0 -export.run +@callconv("canon-lift") +pub proc run(felt, felt, felt, felt) exec.::miden:base/note-script@1.0.0::init trace.240 nop @@ -10,7 +11,7 @@ export.run exec.::std::sys::truncate_stack end -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -33,11 +34,18 @@ end # mod miden:base/note-script@1.0.0::rust_sdk_swapp_note_bindings -proc.__wasm_call_ctors +@callconv("C") +proc __wasm_call_ctors( + +) nop end -proc.::eq +@callconv("C") +proc ::eq( + i32, + i32 +) -> i32 dup.0 push.4 dup.1 @@ -229,11 +237,15 @@ proc.::eq end end -proc.rust_sdk_swapp_note_bindings::bindings::__link_custom_section_describing_imports +@callconv("C") +proc rust_sdk_swapp_note_bindings::bindings::__link_custom_section_describing_imports( + +) nop end -proc.miden:base/note-script@1.0.0#run +@callconv("C") +proc miden:base/note-script@1.0.0#run(felt, felt, felt, felt) drop drop drop @@ -268,7 +280,7 @@ proc.miden:base/note-script@1.0.0#run u32wrapping_add trace.240 nop - exec.::miden:base/note-script@1.0.0::rust_sdk_swapp_note_bindings::miden_base_sys::bindings::note::get_sender + exec.::miden:base/note-script@1.0.0::rust_sdk_swapp_note_bindings::miden_base_sys::bindings::active_note::get_sender trace.252 nop push.12 @@ -310,7 +322,7 @@ proc.miden:base/note-script@1.0.0#run u32wrapping_add trace.240 nop - exec.::miden:base/note-script@1.0.0::rust_sdk_swapp_note_bindings::miden_base_sys::bindings::note::get_script_root + exec.::miden:base/note-script@1.0.0::rust_sdk_swapp_note_bindings::miden_base_sys::bindings::active_note::get_script_root trace.252 nop push.32 @@ -318,7 +330,7 @@ proc.miden:base/note-script@1.0.0#run u32wrapping_add trace.240 nop - exec.::miden:base/note-script@1.0.0::rust_sdk_swapp_note_bindings::miden_base_sys::bindings::note::get_serial_number + exec.::miden:base/note-script@1.0.0::rust_sdk_swapp_note_bindings::miden_base_sys::bindings::active_note::get_serial_number trace.252 nop dup.1 @@ -451,7 +463,10 @@ proc.miden:base/note-script@1.0.0#run end end -proc.wit_bindgen::rt::run_ctors_once +@callconv("C") +proc wit_bindgen::rt::run_ctors_once( + +) push.1114148 u32divmod.4 swap.1 @@ -522,15 +537,22 @@ proc.wit_bindgen::rt::run_ctors_once end end -proc.miden_base_sys::bindings::account::get_balance +@callconv("C") +proc miden_base_sys::bindings::account::get_balance( + felt, + felt +) -> felt trace.240 nop - exec.::miden:base/note-script@1.0.0::rust_sdk_swapp_note_bindings::miden::account::get_balance + exec.::miden:base/note-script@1.0.0::rust_sdk_swapp_note_bindings::miden::active_account::get_balance trace.252 nop end -proc.miden_base_sys::bindings::note::get_sender +@callconv("C") +proc miden_base_sys::bindings::active_note::get_sender( + i32 +) push.1114144 u32divmod.4 swap.1 @@ -556,7 +578,7 @@ proc.miden_base_sys::bindings::note::get_sender u32wrapping_add trace.240 nop - exec.::miden:base/note-script@1.0.0::rust_sdk_swapp_note_bindings::miden::note::get_sender + exec.::miden:base/note-script@1.0.0::rust_sdk_swapp_note_bindings::miden::active_note::get_sender trace.252 nop push.8 @@ -602,7 +624,10 @@ proc.miden_base_sys::bindings::note::get_sender nop end -proc.miden_base_sys::bindings::note::get_script_root +@callconv("C") +proc miden_base_sys::bindings::active_note::get_script_root( + i32 +) push.1114144 u32divmod.4 swap.1 @@ -626,7 +651,7 @@ proc.miden_base_sys::bindings::note::get_script_root dup.0 trace.240 nop - exec.::miden:base/note-script@1.0.0::rust_sdk_swapp_note_bindings::miden::note::get_script_root + exec.::miden:base/note-script@1.0.0::rust_sdk_swapp_note_bindings::miden::active_note::get_script_root trace.252 nop push.8 @@ -715,7 +740,10 @@ proc.miden_base_sys::bindings::note::get_script_root nop end -proc.miden_base_sys::bindings::note::get_serial_number +@callconv("C") +proc miden_base_sys::bindings::active_note::get_serial_number( + i32 +) push.1114144 u32divmod.4 swap.1 @@ -739,7 +767,7 @@ proc.miden_base_sys::bindings::note::get_serial_number dup.0 trace.240 nop - exec.::miden:base/note-script@1.0.0::rust_sdk_swapp_note_bindings::miden::note::get_serial_number + exec.::miden:base/note-script@1.0.0::rust_sdk_swapp_note_bindings::miden::active_note::get_serial_number trace.252 nop push.8 @@ -828,7 +856,11 @@ proc.miden_base_sys::bindings::note::get_serial_number nop end -proc.miden_stdlib_sys::intrinsics::word::Word::reverse +@callconv("C") +proc miden_stdlib_sys::intrinsics::word::Word::reverse( + i32, + i32 +) push.1114144 u32divmod.4 swap.1 @@ -1089,22 +1121,25 @@ proc.miden_stdlib_sys::intrinsics::word::Word::reverse nop end -proc.intrinsics::felt::eq +@callconv("C") +proc intrinsics::felt::eq(felt, felt) -> i32 eq end -proc.miden::account::get_balance +@callconv("C") +proc miden::active_account::get_balance(felt, felt) -> felt trace.240 nop - exec.::miden::account::get_balance + exec.::miden::active_account::get_balance trace.252 nop end -proc.miden::note::get_sender +@callconv("C") +proc miden::active_note::get_sender(i32) trace.240 nop - exec.::miden::note::get_sender + exec.::miden::active_note::get_sender trace.252 nop movup.2 @@ -1130,10 +1165,11 @@ proc.miden::note::get_sender nop end -proc.miden::note::get_script_root +@callconv("C") +proc miden::active_note::get_script_root(i32) trace.240 nop - exec.::miden::note::get_script_root + exec.::miden::active_note::get_script_root trace.252 nop movup.4 @@ -1185,10 +1221,11 @@ proc.miden::note::get_script_root nop end -proc.miden::note::get_serial_number +@callconv("C") +proc miden::active_note::get_serial_number(i32) trace.240 nop - exec.::miden::note::get_serial_number + exec.::miden::active_note::get_serial_number trace.252 nop movup.4 diff --git a/tests/integration/expected/rust_sdk/rust_sdk_swapp_note_bindings.wat b/tests/integration/expected/rust_sdk/rust_sdk_swapp_note_bindings.wat index 5685f9534..a17617e1d 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_swapp_note_bindings.wat +++ b/tests/integration/expected/rust_sdk/rust_sdk_swapp_note_bindings.wat @@ -77,7 +77,7 @@ local.get 4 i32.const 8 i32.add - call $miden_base_sys::bindings::note::get_sender + call $miden_base_sys::bindings::active_note::get_sender local.get 4 f32.load offset=12 local.set 5 @@ -87,11 +87,11 @@ local.get 4 i32.const 16 i32.add - call $miden_base_sys::bindings::note::get_script_root + call $miden_base_sys::bindings::active_note::get_script_root local.get 4 i32.const 32 i32.add - call $miden_base_sys::bindings::note::get_serial_number + call $miden_base_sys::bindings::active_note::get_serial_number local.get 6 local.get 5 call $miden_base_sys::bindings::account::get_balance @@ -162,9 +162,9 @@ (func $miden_base_sys::bindings::account::get_balance (;5;) (type 3) (param f32 f32) (result f32) local.get 0 local.get 1 - call $miden::account::get_balance + call $miden::active_account::get_balance ) - (func $miden_base_sys::bindings::note::get_sender (;6;) (type 4) (param i32) + (func $miden_base_sys::bindings::active_note::get_sender (;6;) (type 4) (param i32) (local i32) global.get $__stack_pointer i32.const 16 @@ -174,7 +174,7 @@ local.get 1 i32.const 8 i32.add - call $miden::note::get_sender + call $miden::active_note::get_sender local.get 0 local.get 1 i64.load offset=8 align=4 @@ -184,7 +184,7 @@ i32.add global.set $__stack_pointer ) - (func $miden_base_sys::bindings::note::get_script_root (;7;) (type 4) (param i32) + (func $miden_base_sys::bindings::active_note::get_script_root (;7;) (type 4) (param i32) (local i32) global.get $__stack_pointer i32.const 32 @@ -192,7 +192,7 @@ local.tee 1 global.set $__stack_pointer local.get 1 - call $miden::note::get_script_root + call $miden::active_note::get_script_root local.get 1 local.get 1 i64.load offset=8 @@ -211,7 +211,7 @@ i32.add global.set $__stack_pointer ) - (func $miden_base_sys::bindings::note::get_serial_number (;8;) (type 4) (param i32) + (func $miden_base_sys::bindings::active_note::get_serial_number (;8;) (type 4) (param i32) (local i32) global.get $__stack_pointer i32.const 32 @@ -219,7 +219,7 @@ local.tee 1 global.set $__stack_pointer local.get 1 - call $miden::note::get_serial_number + call $miden::active_note::get_serial_number local.get 1 local.get 1 i64.load offset=8 @@ -299,16 +299,16 @@ (func $intrinsics::felt::eq (;10;) (type 6) (param f32 f32) (result i32) unreachable ) - (func $miden::account::get_balance (;11;) (type 3) (param f32 f32) (result f32) + (func $miden::active_account::get_balance (;11;) (type 3) (param f32 f32) (result f32) unreachable ) - (func $miden::note::get_sender (;12;) (type 4) (param i32) + (func $miden::active_note::get_sender (;12;) (type 4) (param i32) unreachable ) - (func $miden::note::get_script_root (;13;) (type 4) (param i32) + (func $miden::active_note::get_script_root (;13;) (type 4) (param i32) unreachable ) - (func $miden::note::get_serial_number (;14;) (type 4) (param i32) + (func $miden::active_note::get_serial_number (;14;) (type 4) (param i32) unreachable ) (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") diff --git a/tests/integration/expected/shl_i16.masm b/tests/integration/expected/shl_i16.masm index c844db47a..5f133ba84 100644 --- a/tests/integration/expected/shl_i16.masm +++ b/tests/integration/expected/shl_i16.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -18,7 +18,8 @@ end # mod root_ns:root@1.0.0::test_rust_c3eed17236100365f8c1660de046d9d6663a7b82697275884d4fcb6fa25a7447 -export.entrypoint +@callconv("C") +pub proc entrypoint(i32, i32) -> i32 push.15 movup.2 u32and diff --git a/tests/integration/expected/shl_i32.masm b/tests/integration/expected/shl_i32.masm index d123fe5c4..9587d334a 100644 --- a/tests/integration/expected/shl_i32.masm +++ b/tests/integration/expected/shl_i32.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -18,7 +18,8 @@ end # mod root_ns:root@1.0.0::test_rust_bb1e5acff11c647800da7bb67237f59cfa6dcc846fe64b76bfdce3d151cb1de9 -export.entrypoint +@callconv("C") +pub proc entrypoint(i32, i32) -> i32 swap.1 u32shl end diff --git a/tests/integration/expected/shl_i64.masm b/tests/integration/expected/shl_i64.masm index e6161e350..383e7e303 100644 --- a/tests/integration/expected/shl_i64.masm +++ b/tests/integration/expected/shl_i64.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -18,7 +18,8 @@ end # mod root_ns:root@1.0.0::test_rust_9d7fa5c817c0e8ad40aeb12756fb108047ae365f6bc8c673617a6bc264b3917a -export.entrypoint +@callconv("C") +pub proc entrypoint([u32; 2], [u32; 2]) -> [u32; 2] movdn.3 movdn.3 dup.0 diff --git a/tests/integration/expected/shl_i8.masm b/tests/integration/expected/shl_i8.masm index 991b5bc0b..534fb8730 100644 --- a/tests/integration/expected/shl_i8.masm +++ b/tests/integration/expected/shl_i8.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -18,7 +18,8 @@ end # mod root_ns:root@1.0.0::test_rust_64d9b2f2c2b5e80b282b2d87195903012daf88be2507d12d0bc75d869a811922 -export.entrypoint +@callconv("C") +pub proc entrypoint(i32, i32) -> i32 push.7 movup.2 u32and diff --git a/tests/integration/expected/shl_u16.masm b/tests/integration/expected/shl_u16.masm index a009a0b43..377ab516e 100644 --- a/tests/integration/expected/shl_u16.masm +++ b/tests/integration/expected/shl_u16.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -18,7 +18,8 @@ end # mod root_ns:root@1.0.0::test_rust_3ab387e5fafe4f8316074728a13b9c62413b6215a11492c80aa3e1d10383e008 -export.entrypoint +@callconv("C") +pub proc entrypoint(i32, i32) -> i32 push.65535 push.15 movup.3 diff --git a/tests/integration/expected/shl_u32.masm b/tests/integration/expected/shl_u32.masm index 2a868cf42..13b9fb519 100644 --- a/tests/integration/expected/shl_u32.masm +++ b/tests/integration/expected/shl_u32.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -18,7 +18,8 @@ end # mod root_ns:root@1.0.0::test_rust_3618ee9a49fe14195a2097b20a230da5249d5b99ab7da35b402a7c16f4fa5609 -export.entrypoint +@callconv("C") +pub proc entrypoint(i32, i32) -> i32 swap.1 u32shl end diff --git a/tests/integration/expected/shl_u64.masm b/tests/integration/expected/shl_u64.masm index 20c62fc2b..1ca888e39 100644 --- a/tests/integration/expected/shl_u64.masm +++ b/tests/integration/expected/shl_u64.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -18,7 +18,8 @@ end # mod root_ns:root@1.0.0::test_rust_ef9c837ab7c2bd11aacdf5ad41eb9264c0daecd169f2b4cfe73fd928059744bb -export.entrypoint +@callconv("C") +pub proc entrypoint([u32; 2], [u32; 2]) -> [u32; 2] movdn.3 movdn.3 dup.0 diff --git a/tests/integration/expected/shl_u8.masm b/tests/integration/expected/shl_u8.masm index 7d958853d..cb093478d 100644 --- a/tests/integration/expected/shl_u8.masm +++ b/tests/integration/expected/shl_u8.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -18,7 +18,8 @@ end # mod root_ns:root@1.0.0::test_rust_b211bf2251e0ca4732fe0f4b9390e5838c61a0ef97c8b47f099f8c5ab3657e7f -export.entrypoint +@callconv("C") +pub proc entrypoint(i32, i32) -> i32 push.255 push.7 movup.3 diff --git a/tests/integration/expected/shr_i64.masm b/tests/integration/expected/shr_i64.masm index afd089696..dd6b6591c 100644 --- a/tests/integration/expected/shr_i64.masm +++ b/tests/integration/expected/shr_i64.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -18,7 +18,8 @@ end # mod root_ns:root@1.0.0::test_rust_186d93d83b74a241eb99ffa0ead88d2435a288695c19f22c9c35eecfda978717 -export.entrypoint +@callconv("C") +pub proc entrypoint([u32; 2], [u32; 2]) -> [u32; 2] movdn.3 movdn.3 dup.0 diff --git a/tests/integration/expected/shr_u16.masm b/tests/integration/expected/shr_u16.masm index e9231c36a..b18746e71 100644 --- a/tests/integration/expected/shr_u16.masm +++ b/tests/integration/expected/shr_u16.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -18,7 +18,8 @@ end # mod root_ns:root@1.0.0::test_rust_96d61f728452f9b581e6c765749adb51e9f48ad7e7527bde3c25a5943fa1a541 -export.entrypoint +@callconv("C") +pub proc entrypoint(i32, i32) -> i32 push.15 movup.2 u32and diff --git a/tests/integration/expected/shr_u32.masm b/tests/integration/expected/shr_u32.masm index d7803cd6b..fde213fff 100644 --- a/tests/integration/expected/shr_u32.masm +++ b/tests/integration/expected/shr_u32.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -18,7 +18,8 @@ end # mod root_ns:root@1.0.0::test_rust_98363f37c9b0fb3dc27cafaa81c0eb63c6a764c82cbedfc0da3e37a43e1d2331 -export.entrypoint +@callconv("C") +pub proc entrypoint(i32, i32) -> i32 swap.1 swap.1 swap.1 diff --git a/tests/integration/expected/shr_u64.masm b/tests/integration/expected/shr_u64.masm index f19ea2a42..dd252fb40 100644 --- a/tests/integration/expected/shr_u64.masm +++ b/tests/integration/expected/shr_u64.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -18,7 +18,8 @@ end # mod root_ns:root@1.0.0::test_rust_9efc7a825f7a743a5fc284e5d1f0d3fc1bb239f780841274be29a84565e75592 -export.entrypoint +@callconv("C") +pub proc entrypoint([u32; 2], [u32; 2]) -> [u32; 2] movdn.3 movdn.3 dup.0 diff --git a/tests/integration/expected/shr_u8.masm b/tests/integration/expected/shr_u8.masm index 95dc1777f..f9ca0cf01 100644 --- a/tests/integration/expected/shr_u8.masm +++ b/tests/integration/expected/shr_u8.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -18,7 +18,8 @@ end # mod root_ns:root@1.0.0::test_rust_04fd0cb7f25bc890cc2570ad64142734f4731c48e1507938bd1b769f028cf2c4 -export.entrypoint +@callconv("C") +pub proc entrypoint(i32, i32) -> i32 push.7 movup.2 u32and diff --git a/tests/integration/expected/sub_felt.masm b/tests/integration/expected/sub_felt.masm index c2ae54ef3..8675fb86b 100644 --- a/tests/integration/expected/sub_felt.masm +++ b/tests/integration/expected/sub_felt.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -12,7 +12,8 @@ end # mod root_ns:root@1.0.0::sub_felt -export.entrypoint +@callconv("C") +pub proc entrypoint(felt, felt) -> felt trace.240 nop exec.::root_ns:root@1.0.0::sub_felt::intrinsics::felt::sub @@ -20,7 +21,8 @@ export.entrypoint nop end -proc.intrinsics::felt::sub +@callconv("C") +proc intrinsics::felt::sub(felt, felt) -> felt swap.1 sub end diff --git a/tests/integration/expected/sub_i128.masm b/tests/integration/expected/sub_i128.masm index 371cf817a..f1817ffbe 100644 --- a/tests/integration/expected/sub_i128.masm +++ b/tests/integration/expected/sub_i128.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -18,7 +18,8 @@ end # mod root_ns:root@1.0.0::test_rust_e91108ee147c81774f718f1c0531bff5bc1cdc56c047c1e0475e4e94badee2c8 -export.entrypoint +@callconv("C") +pub proc entrypoint(i32, [u32; 2], [u32; 2], [u32; 2], [u32; 2]) movup.6 movup.6 movup.8 diff --git a/tests/integration/expected/sub_i16.masm b/tests/integration/expected/sub_i16.masm index 522432b71..cb1dc2cd8 100644 --- a/tests/integration/expected/sub_i16.masm +++ b/tests/integration/expected/sub_i16.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -18,7 +18,8 @@ end # mod root_ns:root@1.0.0::test_rust_b6360a7c4709c8e140b5433c6b25904ac7efbab248a7f37933a33b31d5f40c49 -export.entrypoint +@callconv("C") +pub proc entrypoint(i32, i32) -> i32 swap.1 u32wrapping_sub end diff --git a/tests/integration/expected/sub_i32.masm b/tests/integration/expected/sub_i32.masm index 43d10bdeb..67b689eb8 100644 --- a/tests/integration/expected/sub_i32.masm +++ b/tests/integration/expected/sub_i32.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -18,7 +18,8 @@ end # mod root_ns:root@1.0.0::test_rust_6fc6fd0b2e86628d32094545ba25215329fcd62cd1f981d0dbdd2c989eed3a52 -export.entrypoint +@callconv("C") +pub proc entrypoint(i32, i32) -> i32 swap.1 u32wrapping_sub end diff --git a/tests/integration/expected/sub_i64.masm b/tests/integration/expected/sub_i64.masm index 632794135..e15703a9a 100644 --- a/tests/integration/expected/sub_i64.masm +++ b/tests/integration/expected/sub_i64.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -18,7 +18,8 @@ end # mod root_ns:root@1.0.0::test_rust_c2e6cec606b20447e4c5accdc801c32098f0d7cda3811f8c4e38f16911210b8f -export.entrypoint +@callconv("C") +pub proc entrypoint([u32; 2], [u32; 2]) -> [u32; 2] movdn.3 movdn.3 trace.240 diff --git a/tests/integration/expected/sub_i8.masm b/tests/integration/expected/sub_i8.masm index 31181496b..614ba7277 100644 --- a/tests/integration/expected/sub_i8.masm +++ b/tests/integration/expected/sub_i8.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -18,7 +18,8 @@ end # mod root_ns:root@1.0.0::test_rust_c22e1496a88c74570b0e64374e0cf2e7a89efbbc6ead48d3e0471d8654d2afdc -export.entrypoint +@callconv("C") +pub proc entrypoint(i32, i32) -> i32 swap.1 u32wrapping_sub end diff --git a/tests/integration/expected/sub_u128.masm b/tests/integration/expected/sub_u128.masm index 33ef2f9a6..fa43082e1 100644 --- a/tests/integration/expected/sub_u128.masm +++ b/tests/integration/expected/sub_u128.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -18,7 +18,8 @@ end # mod root_ns:root@1.0.0::test_rust_db478c28ad80aa271563ad7738787d5589cd21f31f7c92248f7f1de9cb727546 -export.entrypoint +@callconv("C") +pub proc entrypoint(i32, [u32; 2], [u32; 2], [u32; 2], [u32; 2]) movup.6 movup.6 movup.8 diff --git a/tests/integration/expected/sub_u16.masm b/tests/integration/expected/sub_u16.masm index 88ff236ca..c9b802868 100644 --- a/tests/integration/expected/sub_u16.masm +++ b/tests/integration/expected/sub_u16.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -18,7 +18,8 @@ end # mod root_ns:root@1.0.0::test_rust_d8aa82f0674d72cf16435a3b3f6c248ab8b08b77539ac08b01e393fd53f96cb7 -export.entrypoint +@callconv("C") +pub proc entrypoint(i32, i32) -> i32 push.65535 swap.2 u32wrapping_sub diff --git a/tests/integration/expected/sub_u32.masm b/tests/integration/expected/sub_u32.masm index b130e3214..6e62bb069 100644 --- a/tests/integration/expected/sub_u32.masm +++ b/tests/integration/expected/sub_u32.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -18,7 +18,8 @@ end # mod root_ns:root@1.0.0::test_rust_19bb93ff4625e8bdb6a3470a0b61a142a94458a4ee602822cb8360bf1f07368f -export.entrypoint +@callconv("C") +pub proc entrypoint(i32, i32) -> i32 swap.1 u32wrapping_sub end diff --git a/tests/integration/expected/sub_u64.masm b/tests/integration/expected/sub_u64.masm index a027064f2..3ce89deb3 100644 --- a/tests/integration/expected/sub_u64.masm +++ b/tests/integration/expected/sub_u64.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -18,7 +18,8 @@ end # mod root_ns:root@1.0.0::test_rust_07a967cd239987abbfb9236f41c9268dd55be09bc1efb30f1e4684134ef772b0 -export.entrypoint +@callconv("C") +pub proc entrypoint([u32; 2], [u32; 2]) -> [u32; 2] movdn.3 movdn.3 trace.240 diff --git a/tests/integration/expected/sub_u8.masm b/tests/integration/expected/sub_u8.masm index 9c3400fca..86e0552ac 100644 --- a/tests/integration/expected/sub_u8.masm +++ b/tests/integration/expected/sub_u8.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -18,7 +18,8 @@ end # mod root_ns:root@1.0.0::test_rust_be0120d0a160e710cbd53bd6dc4ac525bbb3596615ae6ec2d5f88c74c069aabe -export.entrypoint +@callconv("C") +pub proc entrypoint(i32, i32) -> i32 push.255 swap.2 u32wrapping_sub diff --git a/tests/integration/expected/types/array.masm b/tests/integration/expected/types/array.masm index dc297481f..c3dbb487b 100644 --- a/tests/integration/expected/types/array.masm +++ b/tests/integration/expected/types/array.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -26,7 +26,8 @@ end # mod root_ns:root@1.0.0::test_rust_d63291a98b435c53f58385d5782fb46f0b0b78bee8e860843e7223106d66f7d6 -export.sum_arr +@callconv("C") +pub proc sum_arr(i32, i32) -> i32 push.0 push.0 dup.3 @@ -101,7 +102,10 @@ export.sum_arr end end -export.__main +@callconv("C") +pub proc __main( + +) -> i32 push.5 push.1048576 trace.240 diff --git a/tests/integration/expected/types/enum.masm b/tests/integration/expected/types/enum.masm index 9643cc827..b65d578e7 100644 --- a/tests/integration/expected/types/enum.masm +++ b/tests/integration/expected/types/enum.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -18,7 +18,8 @@ end # mod root_ns:root@1.0.0::test_rust_f0bb65319ffababec660ada9dd2dd5f137503f60cf9c37332d6f7e171f275824 -export.match_enum +@callconv("C") +pub proc match_enum(i32, i32, i32) -> i32 push.255 movup.3 u32and @@ -47,7 +48,10 @@ export.match_enum end end -export.__main +@callconv("C") +pub proc __main( + +) -> i32 push.0 push.5 push.3 diff --git a/tests/integration/expected/types/static_mut.masm b/tests/integration/expected/types/static_mut.masm index b9fbba4d9..c25ebd893 100644 --- a/tests/integration/expected/types/static_mut.masm +++ b/tests/integration/expected/types/static_mut.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -26,7 +26,10 @@ end # mod root_ns:root@1.0.0::test_rust_e6d553fb1c80aef6e5d6f2891701197bedac471cf510bd2495f99889d9543cd4 -export.global_var_update +@callconv("C") +pub proc global_var_update( + +) push.1048577 push.0 add @@ -76,7 +79,10 @@ export.global_var_update mem_store end -export.__main +@callconv("C") +pub proc __main( + +) -> i32 trace.240 nop exec.::root_ns:root@1.0.0::test_rust_e6d553fb1c80aef6e5d6f2891701197bedac471cf510bd2495f99889d9543cd4::global_var_update diff --git a/tests/integration/expected/vec_alloc_vec.masm b/tests/integration/expected/vec_alloc_vec.masm index bd3e81ccd..243b3c28f 100644 --- a/tests/integration/expected/vec_alloc_vec.masm +++ b/tests/integration/expected/vec_alloc_vec.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -12,7 +12,8 @@ end # mod root_ns:root@1.0.0::vec_alloc_vec -export.entrypoint +@callconv("C") +pub proc entrypoint(i32) -> felt push.1114112 u32divmod.4 swap.1 @@ -262,7 +263,8 @@ export.entrypoint end end -proc.__rustc::__rust_alloc +@callconv("C") +proc __rustc::__rust_alloc(i32, i32) -> i32 push.1048576 movup.2 swap.1 @@ -273,17 +275,26 @@ proc.__rustc::__rust_alloc nop end -proc.__rustc::__rust_dealloc +@callconv("C") +proc __rustc::__rust_dealloc(i32, i32, i32) drop drop drop end -proc.__rustc::__rust_no_alloc_shim_is_unstable_v2 +@callconv("C") +proc __rustc::__rust_no_alloc_shim_is_unstable_v2( + +) nop end -proc.::alloc +@callconv("C") +proc ::alloc( + i32, + i32, + i32 +) -> i32 push.16 push.0 push.16 @@ -458,7 +469,10 @@ proc.::alloc end end -proc.intrinsics::mem::heap_base +@callconv("C") +proc intrinsics::mem::heap_base( + +) -> i32 trace.240 nop exec.::intrinsics::mem::heap_base @@ -466,11 +480,17 @@ proc.intrinsics::mem::heap_base nop end -proc.intrinsics::felt::from_u32 +@callconv("C") +proc intrinsics::felt::from_u32(i32) -> felt nop end -proc.alloc::raw_vec::RawVecInner::deallocate +@callconv("C") +proc alloc::raw_vec::RawVecInner::deallocate( + i32, + i32, + i32 +) push.1114112 u32divmod.4 swap.1 @@ -582,7 +602,13 @@ proc.alloc::raw_vec::RawVecInner::deallocate nop end -proc.alloc::raw_vec::RawVecInner::current_memory +@callconv("C") +proc alloc::raw_vec::RawVecInner::current_memory( + i32, + i32, + i32, + i32 +) push.0 push.0 dup.5 @@ -708,7 +734,12 @@ proc.alloc::raw_vec::RawVecInner::current_memory nop end -proc.::deallocate +@callconv("C") +proc ::deallocate( + i32, + i32, + i32 +) push.0 push.0 dup.4 @@ -729,14 +760,16 @@ proc.::deallocate end end -proc.alloc::alloc::handle_alloc_error +@callconv("C") +proc alloc::alloc::handle_alloc_error(i32, i32) drop drop push.0 assert end -proc.core::ptr::alignment::Alignment::max +@callconv("C") +proc core::ptr::alignment::Alignment::max(i32, i32) -> i32 push.0 dup.2 dup.2 diff --git a/tests/integration/expected/xor_bool.masm b/tests/integration/expected/xor_bool.masm index 1d47abe9e..58413645b 100644 --- a/tests/integration/expected/xor_bool.masm +++ b/tests/integration/expected/xor_bool.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -18,7 +18,8 @@ end # mod root_ns:root@1.0.0::test_rust_12478c1c469cdb8e5c0d08223b9ea0b6f7c1cade83ed772fb79969d2af3004cb -export.entrypoint +@callconv("C") +pub proc entrypoint(i32, i32) -> i32 u32xor end diff --git a/tests/integration/src/rust_masm_tests/abi_transform/advice_map.rs b/tests/integration/src/rust_masm_tests/abi_transform/advice_map.rs index 34f9c971a..b2090df8f 100644 --- a/tests/integration/src/rust_masm_tests/abi_transform/advice_map.rs +++ b/tests/integration/src/rust_masm_tests/abi_transform/advice_map.rs @@ -1,13 +1,14 @@ use core::panic; -use std::collections::VecDeque; +use std::{collections::VecDeque, sync::Arc}; use miden_core::{utils::group_slice_elements, FieldElement, StarkField}; use miden_debug::{Executor, Felt as TestFelt, FromMidenRepr, ToMidenRepr}; +use miden_lib::MidenLib; use miden_processor::AdviceInputs; use midenc_expect_test::expect_file; use midenc_frontend_wasm::WasmTranslationConfig; use midenc_hir::Felt; -use midenc_session::Emit; +use midenc_session::{Emit, STDLIB}; use proptest::{ arbitrary::any, prelude::TestCaseError, @@ -87,8 +88,15 @@ fn test_adv_load_preimage() { Felt::new(out_addr as u64), ]; - let mut exec = - Executor::for_package(&package, args.to_vec()).expect("Failed to create executor"); + let mut exec = Executor::new(args.to_vec()); + let std_library = (*STDLIB).clone(); + exec.dependency_resolver_mut() + .add(*std_library.digest(), std_library.clone().into()); + let base_library = Arc::new(MidenLib::default().as_ref().clone()); + exec.dependency_resolver_mut() + .add(*base_library.digest(), base_library.clone().into()); + exec.with_dependencies(package.manifest.dependencies()) + .expect("Failed to register dependencies"); exec.with_advice_inputs(AdviceInputs::default().with_map(advice_map)); let trace = exec.execute(&package.unwrap_program(), test.session.source_manager.clone()); diff --git a/tests/integration/src/rust_masm_tests/abi_transform/tx_kernel.rs b/tests/integration/src/rust_masm_tests/abi_transform/tx_kernel.rs index 0006a0775..dbaeb7fff 100644 --- a/tests/integration/src/rust_masm_tests/abi_transform/tx_kernel.rs +++ b/tests/integration/src/rust_masm_tests/abi_transform/tx_kernel.rs @@ -1,12 +1,13 @@ -use std::fmt::Write; +use std::{fmt::Write, sync::Arc}; use miden_assembly::LibraryPath; use miden_core::{Felt, FieldElement}; use miden_debug::Executor; +use miden_lib::MidenLib; use miden_processor::ExecutionError; use midenc_expect_test::expect_file; use midenc_frontend_wasm::WasmTranslationConfig; -use midenc_session::{diagnostics::Report, Emit}; +use midenc_session::{diagnostics::Report, Emit, STDLIB}; use crate::CompilerTestBuilder; @@ -32,7 +33,7 @@ fn test_get_inputs(test_name: &str, expected_inputs: Vec) -> Result<(), Rep export.get_inputs push.{expect1}.{expect2}.{expect3}.{expect4} # write word to memory, leaving the pointer on the stack - dup.4 mem_storew dropw + dup.4 mem_storew_be dropw # push the inputs len on the stack push.4 end @@ -44,7 +45,7 @@ end ); let main_fn = format!( r#"() -> () {{ - let v = miden::note::get_inputs(); + let v = miden::active_note::get_inputs(); assert_eq(v.len().into(), felt!(4)); assert_eq(v[0], felt!({expect1})); assert_eq(v[1], felt!({expect2})); @@ -60,7 +61,7 @@ end let config = WasmTranslationConfig::default(); let mut test_builder = CompilerTestBuilder::rust_fn_body_with_sdk(artifact_name.clone(), &main_fn, config, []); - test_builder.link_with_masm_module("miden::note", masm); + test_builder.link_with_masm_module("miden::active_note", masm); let mut test = test_builder.build(); test.expect_wasm(expect_file![format!("../../../expected/{artifact_name}.wat")]); @@ -68,7 +69,15 @@ end test.expect_masm(expect_file![format!("../../../expected/{artifact_name}.masm")]); let package = test.compiled_package(); - let exec = Executor::for_package(&package, vec![])?; + let mut exec = Executor::new(vec![]); + let std_library = (*STDLIB).clone(); + exec.dependency_resolver_mut() + .add(*std_library.digest(), std_library.clone().into()); + let base_library = Arc::new(MidenLib::default().as_ref().clone()); + exec.dependency_resolver_mut() + .add(*base_library.digest(), base_library.clone().into()); + exec.with_dependencies(package.manifest.dependencies())?; + let _ = exec.execute(&package.unwrap_program(), test.session.source_manager.clone()); Ok(()) } diff --git a/tests/integration/src/rust_masm_tests/examples.rs b/tests/integration/src/rust_masm_tests/examples.rs index 17f9f26e2..91a5d1e72 100644 --- a/tests/integration/src/rust_masm_tests/examples.rs +++ b/tests/integration/src/rust_masm_tests/examples.rs @@ -2,6 +2,7 @@ use std::{borrow::Borrow, collections::VecDeque, sync::Arc}; use miden_core::utils::{Deserializable, Serializable}; use miden_debug::{Executor, ToMidenRepr}; +use miden_lib::MidenLib; use miden_mast_package::{Package, SectionId}; use miden_objects::account::AccountComponentMetadata; use midenc_expect_test::{expect, expect_file}; @@ -9,6 +10,7 @@ use midenc_frontend_wasm::WasmTranslationConfig; use midenc_hir::{ interner::Symbol, Felt, FunctionIdent, Ident, Immediate, Op, SourceSpan, SymbolTable, }; +use midenc_session::STDLIB; use prop::test_runner::{Config, TestRunner}; use proptest::prelude::*; @@ -38,7 +40,7 @@ fn storage_example() { .unwrap(); let toml = AccountComponentMetadata::read_from_bytes(account_component_metadata_bytes) .unwrap() - .as_toml() + .to_toml() .unwrap(); expect![[r#" name = "storage-example" @@ -61,6 +63,19 @@ fn storage_example() { .assert_eq(&toml); } +fn executor_with_std(package: &Package, args: Vec) -> Result { + let mut exec = Executor::new(args); + let std_library = (*STDLIB).clone(); + exec.dependency_resolver_mut() + .add(*std_library.digest(), std_library.clone().into()); + let base_library = Arc::new(MidenLib::default().as_ref().clone()); + exec.dependency_resolver_mut() + .add(*base_library.digest(), base_library.clone().into()); + exec.with_dependencies(package.manifest.dependencies()) + .map_err(|err| TestCaseError::fail(err.to_string()))?; + Ok(exec) +} + #[test] fn fibonacci() { fn expected_fib(n: u32) -> u32 { @@ -85,9 +100,7 @@ fn fibonacci() { TestRunner::default() .run(&(1u32..30), move |a| { let rust_out = expected_fib(a); - let args = a.to_felts(); - let exec = Executor::for_package(&package, args) - .map_err(|err| TestCaseError::fail(err.to_string()))?; + let exec = executor_with_std(&package, vec![Felt::new(a as u64)])?; let output: u32 = exec.execute_into(&package.unwrap_program(), test.session.source_manager.clone()); dbg!(output); @@ -129,9 +142,8 @@ fn collatz() { TestRunner::new(Config::with_cases(4)) .run(&(1u32..30), move |a| { let rust_out = expected(a); - let args = a.to_felts(); - let exec = Executor::for_package(&package, args) - .map_err(|err| TestCaseError::fail(err.to_string()))?; + let args = a.to_felts().to_vec(); + let exec = executor_with_std(&package, args)?; let output: u32 = exec.execute_into(&package.unwrap_program(), test.session.source_manager.clone()); dbg!(output); @@ -210,9 +222,8 @@ fn is_prime() { }; prop_assert_eq!(rust_out as i32, result); - let args = a.to_felts(); - let exec = Executor::for_package(&package, args) - .map_err(|err| TestCaseError::fail(err.to_string()))?; + let args = a.to_felts().to_vec(); + let exec = executor_with_std(&package, args)?; let output: u32 = exec.execute_into(&package.unwrap_program(), test.session.source_manager.clone()); dbg!(output); @@ -252,7 +263,7 @@ fn counter_contract() { .unwrap(); let toml = AccountComponentMetadata::read_from_bytes(account_component_metadata_bytes) .unwrap() - .as_toml() + .to_toml() .unwrap(); expect![[r#" name = "counter-contract" diff --git a/tests/integration/src/rust_masm_tests/mod.rs b/tests/integration/src/rust_masm_tests/mod.rs index 31a39c8c5..cdcc68eca 100644 --- a/tests/integration/src/rust_masm_tests/mod.rs +++ b/tests/integration/src/rust_masm_tests/mod.rs @@ -4,10 +4,12 @@ use std::{collections::VecDeque, sync::Arc}; use miden_core::Felt; -use miden_debug::{Executor, FromMidenRepr}; +use miden_debug::{Executor, FromMidenRepr, ToMidenRepr}; use midenc_session::Session; use proptest::{prop_assert_eq, test_runner::TestCaseError}; +use crate::testing::eval_package; + mod abi_transform; mod apps; mod examples; @@ -26,13 +28,13 @@ pub fn run_masm_vs_rust( where T: Clone + FromMidenRepr + PartialEq + std::fmt::Debug, { - let exec = Executor::for_package(package, args.iter().copied()) - .map_err(|err| TestCaseError::fail(err.to_string()))?; - let output = exec.execute_into(&package.unwrap_program(), session.source_manager.clone()); - std::dbg!(&output); - prop_assert_eq!(rust_out.clone(), output, "VM output mismatch"); - // TODO: Uncomment after https://github.com/0xMiden/compiler/issues/228 is fixed - // let emul_out: T = (*execute_emulator(ir_program.clone(), args).first().unwrap()).into(); - // prop_assert_eq!(rust_out, emul_out, "Emulator output mismatch"); + eval_package::(package, None, args, session, |trace| { + let vm_out_felt0 = trace.outputs().get_stack_item(0).unwrap(); + let vm_out_felt1 = trace.outputs().get_stack_item(1).unwrap(); + let vm_out: T = T::from_felts(&[vm_out_felt0, vm_out_felt1]); + dbg!(&vm_out); + prop_assert_eq!(rust_out.clone(), vm_out, "VM output mismatch"); + Ok(()) + })?; Ok(()) } diff --git a/tests/integration/src/rust_masm_tests/rust_sdk/macros.rs b/tests/integration/src/rust_masm_tests/rust_sdk/macros.rs index 299372b41..c6aa89c39 100644 --- a/tests/integration/src/rust_masm_tests/rust_sdk/macros.rs +++ b/tests/integration/src/rust_masm_tests/rust_sdk/macros.rs @@ -35,10 +35,10 @@ fn component_macros_account_and_note() { let note_package = note.compiled_package(); let program = note_package.unwrap_program(); - let mut exec = Executor::new(vec![]); + let mut exec = executor_with_std(vec![]); exec.dependency_resolver_mut() .add(account_package.digest(), account_package.into()); - let dependencies = note_package.manifest.dependencies(); - exec.with_dependencies(dependencies).unwrap(); - exec.execute(&program, ¬e.session); + exec.with_dependencies(note_package.manifest.dependencies()) + .expect("failed to add package dependencies"); + exec.execute(&program, note.session.source_manager.clone()); } diff --git a/tests/integration/src/rust_masm_tests/rust_sdk/mod.rs b/tests/integration/src/rust_masm_tests/rust_sdk/mod.rs index 58f008cb5..9bfccffb2 100644 --- a/tests/integration/src/rust_masm_tests/rust_sdk/mod.rs +++ b/tests/integration/src/rust_masm_tests/rust_sdk/mod.rs @@ -4,12 +4,14 @@ use miden_core::{ utils::{Deserializable, Serializable}, Felt, FieldElement, Word, }; +use miden_debug::Executor; +use miden_lib::MidenLib; use miden_mast_package::Package; use miden_objects::account::{AccountComponentMetadata, AccountComponentTemplate, InitStorageData}; -use midenc_debug::Executor; use midenc_expect_test::expect_file; use midenc_frontend_wasm::WasmTranslationConfig; use midenc_hir::{interner::Symbol, FunctionIdent, Ident, SourceSpan}; +use midenc_session::STDLIB; use crate::{ cargo_proj::project, @@ -19,6 +21,17 @@ use crate::{ mod macros; +fn executor_with_std(args: Vec) -> Executor { + let mut exec = Executor::new(args); + let std_library = (*STDLIB).clone(); + exec.dependency_resolver_mut() + .add(*std_library.digest(), std_library.clone().into()); + let base_library = Arc::new(MidenLib::default().as_ref().clone()); + exec.dependency_resolver_mut() + .add(*base_library.digest(), base_library.clone().into()); + exec +} + #[test] #[ignore = "until https://github.com/0xMiden/compiler/issues/439 is fixed"] fn account() { @@ -84,9 +97,9 @@ use miden::*; #[note_script] fn run(_arg: Word) { - let sender = note::get_sender(); - let script_root = note::get_script_root(); - let serial_number = note::get_serial_number(); + let sender = active_note::get_sender(); + let script_root = active_note::get_script_root(); + let serial_number = active_note::get_serial_number(); let balance = account::get_balance(sender); assert_eq!(sender.prefix, sender.prefix); @@ -165,12 +178,12 @@ fn rust_sdk_cross_ctx_account_and_note() { test.expect_masm(expect_file![format!("../../../expected/rust_sdk/cross_ctx_note.masm")]); let package = test.compiled_package(); let program = package.unwrap_program(); - let mut exec = Executor::new(vec![]); + let mut exec = executor_with_std(vec![]); exec.dependency_resolver_mut() .add(account_package.digest(), account_package.into()); - let dependencies = package.manifest.dependencies(); - exec.with_dependencies(dependencies).unwrap(); - let trace = exec.execute(&program, &test.session); + exec.with_dependencies(package.manifest.dependencies()) + .expect("failed to add package dependencies"); + let trace = exec.execute(&program, test.session.source_manager.clone()); } #[test] @@ -222,11 +235,12 @@ fn rust_sdk_cross_ctx_account_and_note_word() { test.expect_ir(expect_file![format!("../../../expected/rust_sdk/cross_ctx_note_word.hir")]); test.expect_masm(expect_file![format!("../../../expected/rust_sdk/cross_ctx_note_word.masm")]); let package = test.compiled_package(); - let mut exec = Executor::new(vec![]); + let mut exec = executor_with_std(vec![]); exec.dependency_resolver_mut() .add(account_package.digest(), account_package.into()); - exec.with_dependencies(package.manifest.dependencies()).unwrap(); - let trace = exec.execute(&package.unwrap_program(), &test.session); + exec.with_dependencies(package.manifest.dependencies()) + .expect("failed to add package dependencies"); + let trace = exec.execute(&package.unwrap_program(), test.session.source_manager.clone()); } #[test] @@ -293,9 +307,10 @@ fn rust_sdk_cross_ctx_word_arg_account_and_note() { )]); let package = test.compiled_package(); assert!(package.is_program()); - let mut exec = Executor::new(vec![]); + let mut exec = executor_with_std(vec![]); exec.dependency_resolver_mut() .add(account_package.digest(), account_package.into()); - exec.with_dependencies(package.manifest.dependencies()).unwrap(); - let trace = exec.execute(&package.unwrap_program(), &test.session); + exec.with_dependencies(package.manifest.dependencies()) + .expect("failed to add package dependencies"); + let trace = exec.execute(&package.unwrap_program(), test.session.source_manager.clone()); } diff --git a/tests/integration/src/rust_masm_tests/wit_sdk.rs b/tests/integration/src/rust_masm_tests/wit_sdk.rs index 71dc285fc..c636caa75 100644 --- a/tests/integration/src/rust_masm_tests/wit_sdk.rs +++ b/tests/integration/src/rust_masm_tests/wit_sdk.rs @@ -25,10 +25,10 @@ fn sdk() { #[test] fn sdk_basic_wallet() { - let interface_tx = InterfaceIdent::from_full_ident("miden:base/tx@1.0.0"); + let interface_output_note = InterfaceIdent::from_full_ident("miden:base/output-note@1.0.0"); let create_note_ident = InterfaceFunctionIdent { - interface: interface_tx, - function: Symbol::intern("create-note"), + interface: interface_output_note, + function: Symbol::intern("create"), }; let interface_account = InterfaceIdent::from_full_ident("miden:base/account@1.0.0"); let add_asset_ident = InterfaceFunctionIdent { @@ -39,8 +39,18 @@ fn sdk_basic_wallet() { interface: interface_account, function: Symbol::intern("remove-asset"), }; - let expected_imports: HashSet = - [create_note_ident, remove_asset_ident, add_asset_ident].into_iter().collect(); + let output_note_add_asset_ident = InterfaceFunctionIdent { + interface: interface_output_note, + function: Symbol::intern("add-asset"), + }; + let expected_imports: HashSet = [ + create_note_ident, + remove_asset_ident, + add_asset_ident, + output_note_add_asset_ident, + ] + .into_iter() + .collect(); let config = WasmTranslationConfig::default(); let mut test = CompilerTest::rust_source_cargo_component("../rust-apps-wasm/wit-sdk/basic-wallet", config); diff --git a/tests/integration/src/testing/eval.rs b/tests/integration/src/testing/eval.rs index 22ec52996..c0a6b1f56 100644 --- a/tests/integration/src/testing/eval.rs +++ b/tests/integration/src/testing/eval.rs @@ -1,8 +1,11 @@ +use std::sync::Arc; + use miden_core::{Felt, FieldElement}; use miden_debug::{ExecutionTrace, Executor, FromMidenRepr}; +use miden_lib::MidenLib; use miden_processor::AdviceInputs; use midenc_compile::LinkOutput; -use midenc_session::Session; +use midenc_session::{Session, STDLIB}; use proptest::test_runner::TestCaseError; use super::*; @@ -102,7 +105,17 @@ where // Push the number of initializers on the advice stack advice_stack.push(Felt::new(num_initializers)); - let mut exec = Executor::for_package(package, args.to_vec()) + let mut exec = Executor::new(args.to_vec()); + + // Register the standard library so dependencies can be resolved at runtime. + let std_library = (*STDLIB).clone(); + exec.dependency_resolver_mut() + .add(*std_library.digest(), std_library.clone().into()); + let base_library = Arc::new(MidenLib::default().as_ref().clone()); + exec.dependency_resolver_mut() + .add(*base_library.digest(), base_library.clone().into()); + + exec.with_dependencies(package.manifest.dependencies()) .map_err(|err| TestCaseError::fail(format_report(err)))?; // Reverse the stack contents, so that the correct order is preserved after MemAdviceProvider diff --git a/tests/rust-apps-wasm/rust-sdk/account-test/src/lib.rs b/tests/rust-apps-wasm/rust-sdk/account-test/src/lib.rs index 5f481f590..9f31fc6aa 100644 --- a/tests/rust-apps-wasm/rust-sdk/account-test/src/lib.rs +++ b/tests/rust-apps-wasm/rust-sdk/account-test/src/lib.rs @@ -54,7 +54,7 @@ impl Note { #[no_mangle] pub fn note_script() -> Felt { let mut sum = Felt::new(0).unwrap(); - for input in miden::note::get_inputs() { + for input in miden::active_note::get_inputs() { sum = sum + input; } sum @@ -98,6 +98,8 @@ pub fn test_create_note( tag: Tag, note_type: NoteType, recipient: Recipient, -) -> NoteId { - miden::tx::create_note(asset, tag, note_type, recipient) +) -> NoteIdx { + let note_idx = miden::output_note::create(tag, Felt::ZERO, note_type, Felt::ZERO, recipient); + miden::output_note::add_asset(asset, note_idx); + note_idx } diff --git a/tests/rust-apps-wasm/rust-sdk/add/Cargo.lock b/tests/rust-apps-wasm/rust-sdk/add/Cargo.lock index 2b97c0952..625bf0af2 100644 --- a/tests/rust-apps-wasm/rust-sdk/add/Cargo.lock +++ b/tests/rust-apps-wasm/rust-sdk/add/Cargo.lock @@ -2,6 +2,16 @@ # It is not intended for manual editing. version = 4 +[[package]] +name = "aead" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d122413f284cf2d62fb1b7db97e02edb8cda96d769b16e443a4f6195e35662b0" +dependencies = [ + "crypto-common", + "generic-array", +] + [[package]] name = "aho-corasick" version = "1.1.3" @@ -44,6 +54,18 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" +[[package]] +name = "base16ct" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" + +[[package]] +name = "base64ct" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55248b47b0caf0546f7988906588779981c43bb1bc9d0c44087278f80cdb44ba" + [[package]] name = "bech32" version = "0.11.0" @@ -114,6 +136,47 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9555578bc9e57714c812a1f84e4fc5b4d21fcb063490c624de019f7464c91268" +[[package]] +name = "chacha20" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3613f74bd2eac03dad61bd53dbe620703d4371614fe0bc3b9f04dd36fe4e818" +dependencies = [ + "cfg-if", + "cipher", + "cpufeatures", +] + +[[package]] +name = "chacha20poly1305" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10cd79432192d1c0f4e1a0fef9527696cc039165d729fb41b3f4f4f354c2dc35" +dependencies = [ + "aead", + "chacha20", + "cipher", + "poly1305", + "zeroize", +] + +[[package]] +name = "cipher" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" +dependencies = [ + "crypto-common", + "inout", + "zeroize", +] + +[[package]] +name = "const-oid" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" + [[package]] name = "constant_time_eq" version = "0.3.1" @@ -129,6 +192,43 @@ dependencies = [ "libc", ] +[[package]] +name = "crossbeam-deque" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9dd111b7b7f7d55b72c0a6ae361660ee5853c9af73f70c3c2ef6858b950e2e51" +dependencies = [ + "crossbeam-epoch", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.9.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" + +[[package]] +name = "crypto-bigint" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76" +dependencies = [ + "generic-array", + "rand_core 0.6.4", + "subtle", + "zeroize", +] + [[package]] name = "crypto-common" version = "0.1.6" @@ -136,9 +236,47 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" dependencies = [ "generic-array", + "rand_core 0.6.4", "typenum", ] +[[package]] +name = "curve25519-dalek" +version = "4.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97fb8b7c4503de7d6ae7b42ab72a5a59857b4c937ec27a3d4539dba95b5ab2be" +dependencies = [ + "cfg-if", + "cpufeatures", + "curve25519-dalek-derive", + "digest", + "fiat-crypto", + "rustc_version 0.4.1", + "subtle", + "zeroize", +] + +[[package]] +name = "curve25519-dalek-derive" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "der" +version = "0.7.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7c1832837b905bbfb5101e07cc24c8deddf52f93225eee6ead5f4d63d53ddcb" +dependencies = [ + "const-oid", + "zeroize", +] + [[package]] name = "derive_more" version = "2.0.1" @@ -166,7 +304,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ "block-buffer", + "const-oid", "crypto-common", + "subtle", ] [[package]] @@ -175,12 +315,70 @@ version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8975ffdaa0ef3661bfe02dbdcc06c9f829dfafe6a3c474de366a8d5e44276921" +[[package]] +name = "ecdsa" +version = "0.16.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee27f32b5c5292967d2d4a9d7f1e0b0aed2c15daded5a60300e4abb9d8020bca" +dependencies = [ + "der", + "digest", + "elliptic-curve", + "rfc6979", + "signature", + "spki", +] + +[[package]] +name = "ed25519" +version = "2.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "115531babc129696a58c64a4fef0a8bf9e9698629fb97e9e40767d235cfbcd53" +dependencies = [ + "pkcs8", + "signature", +] + +[[package]] +name = "ed25519-dalek" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70e796c081cee67dc755e1a36a0a172b897fab85fc3f6bc48307991f64e4eca9" +dependencies = [ + "curve25519-dalek", + "ed25519", + "serde", + "sha2", + "subtle", + "zeroize", +] + [[package]] name = "either" version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719" +[[package]] +name = "elliptic-curve" +version = "0.13.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47" +dependencies = [ + "base16ct", + "crypto-bigint", + "digest", + "ff", + "generic-array", + "group", + "hkdf", + "pkcs8", + "rand_core 0.6.4", + "sec1", + "subtle", + "zeroize", +] + [[package]] name = "ena" version = "0.14.3" @@ -190,18 +388,58 @@ dependencies = [ "log", ] +[[package]] +name = "enum_dispatch" +version = "0.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa18ce2bc66555b3218614519ac839ddb759a7d6720732f979ef8d13be147ecd" +dependencies = [ + "once_cell", + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "equivalent" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" +[[package]] +name = "ff" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0b50bfb653653f9ca9095b427bed08ab8d75a137839d9ad64eb11810d5b6393" +dependencies = [ + "rand_core 0.6.4", + "subtle", +] + +[[package]] +name = "fiat-crypto" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28dea519a9695b9977216879a3ebfddf92f1c08c05d984f8996aecd6ecdc811d" + [[package]] name = "fixedbitset" version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1d674e81391d1e1ab681a28d99df07927c6d4aa5b027d7da16ba32d1d21ecd99" +[[package]] +name = "flume" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da0e4dd2a88388a1f4ccc7c9ce104604dab68d9f408dc34cd45823d5a9069095" +dependencies = [ + "futures-core", + "futures-sink", + "nanorand", + "spin", +] + [[package]] name = "foldhash" version = "0.1.5" @@ -291,6 +529,20 @@ checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" dependencies = [ "typenum", "version_check", + "zeroize", +] + +[[package]] +name = "getrandom" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "335ff9f135e4384c8150d6f27c6daed433577f86b4750418338c01a1a2528592" +dependencies = [ + "cfg-if", + "js-sys", + "libc", + "wasi 0.11.1+wasi-snapshot-preview1", + "wasm-bindgen", ] [[package]] @@ -303,7 +555,7 @@ dependencies = [ "js-sys", "libc", "r-efi", - "wasi", + "wasi 0.14.2+wasi-0.2.4", "wasm-bindgen", ] @@ -313,6 +565,17 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a8d1add55171497b4705a648c6b583acafb01d58050a51727785f0b2c8e0a2b2" +[[package]] +name = "group" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" +dependencies = [ + "ff", + "rand_core 0.6.4", + "subtle", +] + [[package]] name = "hashbrown" version = "0.15.4" @@ -328,6 +591,24 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" +[[package]] +name = "hkdf" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b5f8eb2ad728638ea2c7d47a21db23b7b58a72ed6a38256b8a1849f15fbbdf7" +dependencies = [ + "hmac", +] + +[[package]] +name = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest", +] + [[package]] name = "id-arena" version = "2.2.1" @@ -351,6 +632,15 @@ dependencies = [ "serde", ] +[[package]] +name = "inout" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "879f10e63c20629ecabbb64a8010319738c66a5cd0c29b02d63d272b03751d01" +dependencies = [ + "generic-array", +] + [[package]] name = "itertools" version = "0.14.0" @@ -376,6 +666,20 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "k256" +version = "0.13.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6e3919bbaa2945715f0bb6d3934a173d1e9a59ac23767fbaaef277265a7411b" +dependencies = [ + "cfg-if", + "ecdsa", + "elliptic-curve", + "once_cell", + "sha2", + "signature", +] + [[package]] name = "keccak" version = "0.1.5" @@ -496,11 +800,12 @@ dependencies = [ [[package]] name = "miden-air" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db750ce0c58f51ba786c7391f392c4b77e0c83a44c5096672d4d0270d3cc7763" +checksum = "06acfd2ddc25b68f9d23d2add3f15c0ec3f9890ce6418409d71bea9dc6590bd0" dependencies = [ "miden-core", + "miden-utils-indexing", "thiserror", "winter-air", "winter-prover", @@ -508,9 +813,9 @@ dependencies = [ [[package]] name = "miden-assembly" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82575d8479aad3966be3defdc17911264bfdc99f9a7bb185180eec57c6bda9f5" +checksum = "d1219b9e48bb286b58a23bb65cf74baa1b24ddbcb462ca625b38186674571047" dependencies = [ "log", "miden-assembly-syntax", @@ -522,9 +827,9 @@ dependencies = [ [[package]] name = "miden-assembly-syntax" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7b3588ce15920c0bff47e8bf8c6ca9e0a7a539ff93014cb5ec3c665f60bc0f1" +checksum = "1eeaef2853061c54527bb2664c0c832ce3d1f80847c79512455fec3b93057f2a" dependencies = [ "aho-corasick", "lalrpop", @@ -572,13 +877,15 @@ dependencies = [ [[package]] name = "miden-core" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "571a943a923e5fb3f1bed534f41a1542c531ad2aec87dc0d5699af1709fbcea6" +checksum = "452a00429d05c416001ec0578291eb88e115cf94fc22b3308267abfdcd813440" dependencies = [ + "enum_dispatch", "miden-crypto", "miden-debug-types", "miden-formatting", + "miden-utils-indexing", "num-derive", "num-traits", "thiserror", @@ -588,33 +895,54 @@ dependencies = [ [[package]] name = "miden-crypto" -version = "0.15.9" +version = "0.18.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4329275a11c7d8328b14a7129b21d40183056dcd0d871c3069be6e550d6ca40" +checksum = "7eb82051002f9c64878d3b105a7b924de1ee92019231923380cf4ecd7b824f9a" dependencies = [ "blake3", + "chacha20poly1305", + "ed25519-dalek", + "flume", "glob", + "hkdf", + "k256", + "miden-crypto-derive", "num", "num-complex", "rand", - "rand_core", + "rand_chacha", + "rand_core 0.9.3", + "rand_hc", "sha3", + "subtle", "thiserror", "winter-crypto", "winter-math", "winter-utils", + "x25519-dalek", +] + +[[package]] +name = "miden-crypto-derive" +version = "0.18.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2222f37355ea975f40acd3c098a437574a31a4d8a2c193cf4e9fead2beede577" +dependencies = [ + "quote", + "syn", ] [[package]] name = "miden-debug-types" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93a4b53092da70aa4c9b75acc85e1c7b4d8202ce89487d2271ebdc2defcb08d6" +checksum = "97eed62ac0ca7420e49148fd306c74786b23a8d31df6da6277c671ba3e5c619a" dependencies = [ "memchr", "miden-crypto", "miden-formatting", "miden-miette", + "miden-utils-indexing", "miden-utils-sync", "paste", "thiserror", @@ -631,13 +959,14 @@ dependencies = [ [[package]] name = "miden-mast-package" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57efbfaea75eeb07d448c04aefce241bf8f23ea11600a669d897280551819992" +checksum = "1d13e6ba2b357551598f13396ed52f8f21aa99979aa3b338bb5521feeda19c8a" dependencies = [ "derive_more", "miden-assembly-syntax", "miden-core", + "thiserror", ] [[package]] @@ -678,33 +1007,41 @@ dependencies = [ [[package]] name = "miden-objects" -version = "0.11.2" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a16bce60bda18cfeaa49e99e35307c6f45297bfe2f0e18c009fa356edd552e70" +checksum = "0ef49472012d00be68f68dcbb13b4f28867fb6271c76c014bc555ef6e8e0958a" dependencies = [ "bech32", - "getrandom", + "getrandom 0.3.3", "miden-assembly", + "miden-assembly-syntax", "miden-core", "miden-crypto", + "miden-mast-package", "miden-processor", "miden-utils-sync", "miden-verifier", + "rand", "semver 1.0.26", "thiserror", ] [[package]] name = "miden-processor" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3c033f51b575b5a70b763dc0bc05062b6562a8286c6d0c144eaff92da8f214f" +checksum = "d2ef77929651b8755965cde8f589bd38e2345a619d54cab6427f91aa23c47f6a" dependencies = [ + "itertools", "miden-air", "miden-core", "miden-debug-types", "miden-utils-diagnostics", + "miden-utils-indexing", + "paste", + "rayon", "thiserror", + "tokio", "tracing", "winter-prover", ] @@ -719,9 +1056,9 @@ version = "0.7.0" [[package]] name = "miden-utils-diagnostics" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d640d80ce3438275b13d0d400901e5bbf3179737818d91d4e84f747a480fd8b" +checksum = "1a3ff4c019d96539a7066626efb4dce5c9fb7b0e44e961b0c2571e78f34236d5" dependencies = [ "miden-crypto", "miden-debug-types", @@ -730,11 +1067,20 @@ dependencies = [ "tracing", ] +[[package]] +name = "miden-utils-indexing" +version = "0.19.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c798250bee4e856d4f18c161e91cdcbef1906f6614d00cf0063b47031c0f8cc6" +dependencies = [ + "thiserror", +] + [[package]] name = "miden-utils-sync" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccf49e1fbfefeb58de992767ae7b0b6200885e342f4dd43c510daefce9539b95" +checksum = "feebe7d896c013ea74dbc98de978836606356a044d4ed3b61ded54d3b319d89f" dependencies = [ "lock_api", "loom", @@ -742,9 +1088,9 @@ dependencies = [ [[package]] name = "miden-verifier" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3104dce8b4668639aa97aa748a98aab0ea33c103e06ef5c3fd12445ab3bd2387" +checksum = "b8f8e47b78bba1fe1b31faee8f12aafd95385f6d6a8b108b03e92f5d743bb29f" dependencies = [ "miden-air", "miden-core", @@ -755,15 +1101,24 @@ dependencies = [ [[package]] name = "midenc-hir-type" -version = "0.1.5" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e381ba23e4f57ffa0d6039113f6d6004e5b8c7ae6cb909329b48f2ab525e8680" +checksum = "9d4cfab04baffdda3fb9eafa5f873604059b89a1699aa95e4f1057397a69f0b5" dependencies = [ "miden-formatting", "smallvec", "thiserror", ] +[[package]] +name = "nanorand" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a51313c5820b0b02bd422f4b44776fbf47961755c74ce64afc73bfad10226c3" +dependencies = [ + "getrandom 0.2.16", +] + [[package]] name = "new_debug_unreachable" version = "1.0.6" @@ -871,6 +1226,12 @@ version = "1.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" +[[package]] +name = "opaque-debug" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381" + [[package]] name = "overload" version = "0.1.1" @@ -943,6 +1304,36 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" +[[package]] +name = "pkcs8" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" +dependencies = [ + "der", + "spki", +] + +[[package]] +name = "poly1305" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8159bd90725d2df49889a078b54f4f79e87f1f8a8444194cdca81d38f5393abf" +dependencies = [ + "cpufeatures", + "opaque-debug", + "universal-hash", +] + +[[package]] +name = "ppv-lite86" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" +dependencies = [ + "zerocopy", +] + [[package]] name = "precomputed-hash" version = "0.1.1" @@ -996,7 +1387,26 @@ version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1" dependencies = [ - "rand_core", + "rand_core 0.9.3", +] + +[[package]] +name = "rand_chacha" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb" +dependencies = [ + "ppv-lite86", + "rand_core 0.9.3", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom 0.2.16", ] [[package]] @@ -1005,6 +1415,35 @@ version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38" +[[package]] +name = "rand_hc" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b363d4f6370f88d62bf586c80405657bde0f0e1b8945d47d2ad59b906cb4f54" +dependencies = [ + "rand_core 0.6.4", +] + +[[package]] +name = "rayon" +version = "1.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "368f01d005bf8fd9b1206fb6fa653e6c4a81ceb1466406b81792d87c5677a58f" +dependencies = [ + "either", + "rayon-core", +] + +[[package]] +name = "rayon-core" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22e18b0f0062d30d4230b2e85ff77fdfe4326feb054b9783a3460d8435c8ab91" +dependencies = [ + "crossbeam-deque", + "crossbeam-utils", +] + [[package]] name = "redox_syscall" version = "0.5.14" @@ -1016,13 +1455,13 @@ dependencies = [ [[package]] name = "regex" -version = "1.11.1" +version = "1.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191" +checksum = "843bc0191f75f3e22651ae5f1e72939ab2f72a4bc30fa80a066bd66edefc24d4" dependencies = [ "aho-corasick", "memchr", - "regex-automata 0.4.9", + "regex-automata 0.4.13", "regex-syntax 0.8.5", ] @@ -1037,9 +1476,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.9" +version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908" +checksum = "5276caf25ac86c8d810222b3dbb938e512c55c6831a10f3e6ed1c93b84041f1c" dependencies = [ "aho-corasick", "memchr", @@ -1058,6 +1497,16 @@ version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" +[[package]] +name = "rfc6979" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dd2a808d456c4a54e300a23e9f5a67e122c3024119acbfd73e3bf664491cb2" +dependencies = [ + "hmac", + "subtle", +] + [[package]] name = "rustc_version" version = "0.2.3" @@ -1109,6 +1558,20 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" +[[package]] +name = "sec1" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" +dependencies = [ + "base16ct", + "der", + "generic-array", + "pkcs8", + "subtle", + "zeroize", +] + [[package]] name = "semver" version = "0.9.0" @@ -1183,6 +1646,17 @@ dependencies = [ "serde", ] +[[package]] +name = "sha2" +version = "0.10.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + [[package]] name = "sha3" version = "0.10.8" @@ -1208,6 +1682,16 @@ version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" +[[package]] +name = "signature" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" +dependencies = [ + "digest", + "rand_core 0.6.4", +] + [[package]] name = "siphasher" version = "1.0.1" @@ -1231,6 +1715,19 @@ name = "spin" version = "0.9.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" +dependencies = [ + "lock_api", +] + +[[package]] +name = "spki" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d" +dependencies = [ + "base64ct", + "der", +] [[package]] name = "string_cache" @@ -1253,6 +1750,12 @@ dependencies = [ "vte", ] +[[package]] +name = "subtle" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" + [[package]] name = "syn" version = "2.0.106" @@ -1328,6 +1831,15 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "tokio" +version = "1.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff360e02eab121e0bc37a2d3b4d4dc622e6eda3a8e5253d5435ecf5bd4c68408" +dependencies = [ + "pin-project-lite", +] + [[package]] name = "toml" version = "0.8.23" @@ -1522,6 +2034,16 @@ version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" +[[package]] +name = "universal-hash" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc1de2c688dc15305988b563c3854064043356019f97a4b46276fe734c4f07ea" +dependencies = [ + "crypto-common", + "subtle", +] + [[package]] name = "valuable" version = "0.1.1" @@ -1553,6 +2075,12 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "wasi" +version = "0.11.1+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" + [[package]] name = "wasi" version = "0.14.2+wasi-0.2.4" @@ -2062,3 +2590,39 @@ dependencies = [ "unicode-xid", "wasmparser", ] + +[[package]] +name = "x25519-dalek" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7e468321c81fb07fa7f4c636c3972b9100f0346e5b6a9f2bd0603a52f7ed277" +dependencies = [ + "curve25519-dalek", + "rand_core 0.6.4", +] + +[[package]] +name = "zerocopy" +version = "0.8.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0894878a5fa3edfd6da3f88c4805f4c8558e2b996227a3d864f47fe11e38282c" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.8.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88d2b8d9c68ad2b9e4340d7832716a4d21a22a1154777ad56ea55c51a9cf3831" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "zeroize" +version = "1.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b97154e67e32c85465826e8bcc1c59429aaaf107c1e4a9e53c8d8ccd5eff88d0" diff --git a/tests/rust-apps-wasm/rust-sdk/component-macros-account/Cargo.lock b/tests/rust-apps-wasm/rust-sdk/component-macros-account/Cargo.lock index 85d08881e..191318e9b 100644 --- a/tests/rust-apps-wasm/rust-sdk/component-macros-account/Cargo.lock +++ b/tests/rust-apps-wasm/rust-sdk/component-macros-account/Cargo.lock @@ -2,6 +2,16 @@ # It is not intended for manual editing. version = 4 +[[package]] +name = "aead" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d122413f284cf2d62fb1b7db97e02edb8cda96d769b16e443a4f6195e35662b0" +dependencies = [ + "crypto-common", + "generic-array", +] + [[package]] name = "aho-corasick" version = "1.1.3" @@ -44,6 +54,18 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" +[[package]] +name = "base16ct" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" + +[[package]] +name = "base64ct" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55248b47b0caf0546f7988906588779981c43bb1bc9d0c44087278f80cdb44ba" + [[package]] name = "bech32" version = "0.11.0" @@ -115,6 +137,41 @@ version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" +[[package]] +name = "chacha20" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3613f74bd2eac03dad61bd53dbe620703d4371614fe0bc3b9f04dd36fe4e818" +dependencies = [ + "cfg-if", + "cipher", + "cpufeatures", +] + +[[package]] +name = "chacha20poly1305" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10cd79432192d1c0f4e1a0fef9527696cc039165d729fb41b3f4f4f354c2dc35" +dependencies = [ + "aead", + "chacha20", + "cipher", + "poly1305", + "zeroize", +] + +[[package]] +name = "cipher" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" +dependencies = [ + "crypto-common", + "inout", + "zeroize", +] + [[package]] name = "component_macros_account" version = "0.1.0" @@ -122,6 +179,12 @@ dependencies = [ "miden", ] +[[package]] +name = "const-oid" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" + [[package]] name = "constant_time_eq" version = "0.3.1" @@ -137,6 +200,43 @@ dependencies = [ "libc", ] +[[package]] +name = "crossbeam-deque" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9dd111b7b7f7d55b72c0a6ae361660ee5853c9af73f70c3c2ef6858b950e2e51" +dependencies = [ + "crossbeam-epoch", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.9.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" + +[[package]] +name = "crypto-bigint" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76" +dependencies = [ + "generic-array", + "rand_core 0.6.4", + "subtle", + "zeroize", +] + [[package]] name = "crypto-common" version = "0.1.6" @@ -144,9 +244,47 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" dependencies = [ "generic-array", + "rand_core 0.6.4", "typenum", ] +[[package]] +name = "curve25519-dalek" +version = "4.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97fb8b7c4503de7d6ae7b42ab72a5a59857b4c937ec27a3d4539dba95b5ab2be" +dependencies = [ + "cfg-if", + "cpufeatures", + "curve25519-dalek-derive", + "digest", + "fiat-crypto", + "rustc_version 0.4.1", + "subtle", + "zeroize", +] + +[[package]] +name = "curve25519-dalek-derive" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "der" +version = "0.7.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7c1832837b905bbfb5101e07cc24c8deddf52f93225eee6ead5f4d63d53ddcb" +dependencies = [ + "const-oid", + "zeroize", +] + [[package]] name = "derive_more" version = "2.0.1" @@ -174,7 +312,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ "block-buffer", + "const-oid", "crypto-common", + "subtle", ] [[package]] @@ -183,12 +323,70 @@ version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8975ffdaa0ef3661bfe02dbdcc06c9f829dfafe6a3c474de366a8d5e44276921" +[[package]] +name = "ecdsa" +version = "0.16.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee27f32b5c5292967d2d4a9d7f1e0b0aed2c15daded5a60300e4abb9d8020bca" +dependencies = [ + "der", + "digest", + "elliptic-curve", + "rfc6979", + "signature", + "spki", +] + +[[package]] +name = "ed25519" +version = "2.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "115531babc129696a58c64a4fef0a8bf9e9698629fb97e9e40767d235cfbcd53" +dependencies = [ + "pkcs8", + "signature", +] + +[[package]] +name = "ed25519-dalek" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70e796c081cee67dc755e1a36a0a172b897fab85fc3f6bc48307991f64e4eca9" +dependencies = [ + "curve25519-dalek", + "ed25519", + "serde", + "sha2", + "subtle", + "zeroize", +] + [[package]] name = "either" version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719" +[[package]] +name = "elliptic-curve" +version = "0.13.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47" +dependencies = [ + "base16ct", + "crypto-bigint", + "digest", + "ff", + "generic-array", + "group", + "hkdf", + "pkcs8", + "rand_core 0.6.4", + "sec1", + "subtle", + "zeroize", +] + [[package]] name = "ena" version = "0.14.3" @@ -198,12 +396,40 @@ dependencies = [ "log", ] +[[package]] +name = "enum_dispatch" +version = "0.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa18ce2bc66555b3218614519ac839ddb759a7d6720732f979ef8d13be147ecd" +dependencies = [ + "once_cell", + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "equivalent" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" +[[package]] +name = "ff" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0b50bfb653653f9ca9095b427bed08ab8d75a137839d9ad64eb11810d5b6393" +dependencies = [ + "rand_core 0.6.4", + "subtle", +] + +[[package]] +name = "fiat-crypto" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28dea519a9695b9977216879a3ebfddf92f1c08c05d984f8996aecd6ecdc811d" + [[package]] name = "find-msvc-tools" version = "0.1.4" @@ -216,6 +442,18 @@ version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1d674e81391d1e1ab681a28d99df07927c6d4aa5b027d7da16ba32d1d21ecd99" +[[package]] +name = "flume" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da0e4dd2a88388a1f4ccc7c9ce104604dab68d9f408dc34cd45823d5a9069095" +dependencies = [ + "futures-core", + "futures-sink", + "nanorand", + "spin", +] + [[package]] name = "foldhash" version = "0.1.5" @@ -305,6 +543,20 @@ checksum = "4bb6743198531e02858aeaea5398fcc883e71851fcbcb5a2f773e2fb6cb1edf2" dependencies = [ "typenum", "version_check", + "zeroize", +] + +[[package]] +name = "getrandom" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "335ff9f135e4384c8150d6f27c6daed433577f86b4750418338c01a1a2528592" +dependencies = [ + "cfg-if", + "js-sys", + "libc", + "wasi", + "wasm-bindgen", ] [[package]] @@ -327,6 +579,17 @@ version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0cc23270f6e1808e30a928bdc84dea0b9b4136a8bc82338574f23baf47bbd280" +[[package]] +name = "group" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" +dependencies = [ + "ff", + "rand_core 0.6.4", + "subtle", +] + [[package]] name = "hashbrown" version = "0.15.5" @@ -348,6 +611,24 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" +[[package]] +name = "hkdf" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b5f8eb2ad728638ea2c7d47a21db23b7b58a72ed6a38256b8a1849f15fbbdf7" +dependencies = [ + "hmac", +] + +[[package]] +name = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest", +] + [[package]] name = "id-arena" version = "2.2.1" @@ -372,6 +653,15 @@ dependencies = [ "serde_core", ] +[[package]] +name = "inout" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "879f10e63c20629ecabbb64a8010319738c66a5cd0c29b02d63d272b03751d01" +dependencies = [ + "generic-array", +] + [[package]] name = "itertools" version = "0.14.0" @@ -397,6 +687,20 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "k256" +version = "0.13.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6e3919bbaa2945715f0bb6d3934a173d1e9a59ac23767fbaaef277265a7411b" +dependencies = [ + "cfg-if", + "ecdsa", + "elliptic-curve", + "once_cell", + "sha2", + "signature", +] + [[package]] name = "keccak" version = "0.1.5" @@ -516,11 +820,12 @@ dependencies = [ [[package]] name = "miden-air" -version = "0.17.2" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2871bc4f392053cd115d4532e4b0fb164791829cc94b35641ed72480547dfd1" +checksum = "06acfd2ddc25b68f9d23d2add3f15c0ec3f9890ce6418409d71bea9dc6590bd0" dependencies = [ "miden-core", + "miden-utils-indexing", "thiserror", "winter-air", "winter-prover", @@ -528,9 +833,9 @@ dependencies = [ [[package]] name = "miden-assembly" -version = "0.17.2" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "345ae47710bbb4c6956dcc669a537c5cf2081879b6238c0df6da50e84a77ea3f" +checksum = "d1219b9e48bb286b58a23bb65cf74baa1b24ddbcb462ca625b38186674571047" dependencies = [ "log", "miden-assembly-syntax", @@ -542,9 +847,9 @@ dependencies = [ [[package]] name = "miden-assembly-syntax" -version = "0.17.2" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ab186ac7061b47415b923cf2da88df505f25c333f7caace80fb7760cf9c0590" +checksum = "1eeaef2853061c54527bb2664c0c832ce3d1f80847c79512455fec3b93057f2a" dependencies = [ "aho-corasick", "lalrpop", @@ -592,13 +897,15 @@ dependencies = [ [[package]] name = "miden-core" -version = "0.17.2" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "395ad0b07592486e02de3ff7f3bff1d7fa81b1a7120f7f0b1027d650d810bbab" +checksum = "452a00429d05c416001ec0578291eb88e115cf94fc22b3308267abfdcd813440" dependencies = [ + "enum_dispatch", "miden-crypto", "miden-debug-types", "miden-formatting", + "miden-utils-indexing", "num-derive", "num-traits", "thiserror", @@ -608,33 +915,54 @@ dependencies = [ [[package]] name = "miden-crypto" -version = "0.15.9" +version = "0.18.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4329275a11c7d8328b14a7129b21d40183056dcd0d871c3069be6e550d6ca40" +checksum = "7eb82051002f9c64878d3b105a7b924de1ee92019231923380cf4ecd7b824f9a" dependencies = [ "blake3", + "chacha20poly1305", + "ed25519-dalek", + "flume", "glob", + "hkdf", + "k256", + "miden-crypto-derive", "num", "num-complex", "rand", - "rand_core", + "rand_chacha", + "rand_core 0.9.3", + "rand_hc", "sha3", + "subtle", "thiserror", "winter-crypto", "winter-math", "winter-utils", + "x25519-dalek", +] + +[[package]] +name = "miden-crypto-derive" +version = "0.18.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2222f37355ea975f40acd3c098a437574a31a4d8a2c193cf4e9fead2beede577" +dependencies = [ + "quote", + "syn", ] [[package]] name = "miden-debug-types" -version = "0.17.2" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c84e5b15ea6fe0f80688fde2d6e4f5a3b66417d2541388b7a6cf967c6a8a2bc0" +checksum = "97eed62ac0ca7420e49148fd306c74786b23a8d31df6da6277c671ba3e5c619a" dependencies = [ "memchr", "miden-crypto", "miden-formatting", "miden-miette", + "miden-utils-indexing", "miden-utils-sync", "paste", "thiserror", @@ -651,13 +979,14 @@ dependencies = [ [[package]] name = "miden-mast-package" -version = "0.17.2" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e9d87c128f467874b272fec318e792385e35b14d200408a10d30909228db864" +checksum = "1d13e6ba2b357551598f13396ed52f8f21aa99979aa3b338bb5521feeda19c8a" dependencies = [ "derive_more", "miden-assembly-syntax", "miden-core", + "thiserror", ] [[package]] @@ -698,33 +1027,41 @@ dependencies = [ [[package]] name = "miden-objects" -version = "0.11.5" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b513a36886b910d71c39b17f37e48179e251fca49cebcbcf57094bef9941f63" +checksum = "0ef49472012d00be68f68dcbb13b4f28867fb6271c76c014bc555ef6e8e0958a" dependencies = [ "bech32", - "getrandom", + "getrandom 0.3.4", "miden-assembly", + "miden-assembly-syntax", "miden-core", "miden-crypto", + "miden-mast-package", "miden-processor", "miden-utils-sync", "miden-verifier", + "rand", "semver 1.0.27", "thiserror", ] [[package]] name = "miden-processor" -version = "0.17.2" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64304339292cc4e50a7b534197326824eeb21f3ffaadd955be63cc57093854ed" +checksum = "d2ef77929651b8755965cde8f589bd38e2345a619d54cab6427f91aa23c47f6a" dependencies = [ + "itertools", "miden-air", "miden-core", "miden-debug-types", "miden-utils-diagnostics", + "miden-utils-indexing", + "paste", + "rayon", "thiserror", + "tokio", "tracing", "winter-prover", ] @@ -739,9 +1076,9 @@ version = "0.7.0" [[package]] name = "miden-utils-diagnostics" -version = "0.17.2" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e9bf9a2c1cf3e3694d0eb347695a291602a57f817dd001ac838f300799576a69" +checksum = "1a3ff4c019d96539a7066626efb4dce5c9fb7b0e44e961b0c2571e78f34236d5" dependencies = [ "miden-crypto", "miden-debug-types", @@ -750,11 +1087,20 @@ dependencies = [ "tracing", ] +[[package]] +name = "miden-utils-indexing" +version = "0.19.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c798250bee4e856d4f18c161e91cdcbef1906f6614d00cf0063b47031c0f8cc6" +dependencies = [ + "thiserror", +] + [[package]] name = "miden-utils-sync" -version = "0.17.2" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb026e69ae937b2a83bf69ea86577e0ec2450cb22cce163190b9fd42f2972b63" +checksum = "feebe7d896c013ea74dbc98de978836606356a044d4ed3b61ded54d3b319d89f" dependencies = [ "lock_api", "loom", @@ -762,9 +1108,9 @@ dependencies = [ [[package]] name = "miden-verifier" -version = "0.17.2" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72a305e5e2c68d10bcb8e2ed3dc38e54bc3a538acc9eadc154b713d5bb47af22" +checksum = "b8f8e47b78bba1fe1b31faee8f12aafd95385f6d6a8b108b03e92f5d743bb29f" dependencies = [ "miden-air", "miden-core", @@ -775,15 +1121,24 @@ dependencies = [ [[package]] name = "midenc-hir-type" -version = "0.1.5" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e381ba23e4f57ffa0d6039113f6d6004e5b8c7ae6cb909329b48f2ab525e8680" +checksum = "9d4cfab04baffdda3fb9eafa5f873604059b89a1699aa95e4f1057397a69f0b5" dependencies = [ "miden-formatting", "smallvec", "thiserror", ] +[[package]] +name = "nanorand" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a51313c5820b0b02bd422f4b44776fbf47961755c74ce64afc73bfad10226c3" +dependencies = [ + "getrandom 0.2.16", +] + [[package]] name = "new_debug_unreachable" version = "1.0.6" @@ -890,6 +1245,12 @@ version = "1.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" +[[package]] +name = "opaque-debug" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381" + [[package]] name = "owo-colors" version = "4.2.3" @@ -956,6 +1317,36 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" +[[package]] +name = "pkcs8" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" +dependencies = [ + "der", + "spki", +] + +[[package]] +name = "poly1305" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8159bd90725d2df49889a078b54f4f79e87f1f8a8444194cdca81d38f5393abf" +dependencies = [ + "cpufeatures", + "opaque-debug", + "universal-hash", +] + +[[package]] +name = "ppv-lite86" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" +dependencies = [ + "zerocopy", +] + [[package]] name = "precomputed-hash" version = "0.1.1" @@ -1002,7 +1393,26 @@ version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1" dependencies = [ - "rand_core", + "rand_core 0.9.3", +] + +[[package]] +name = "rand_chacha" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb" +dependencies = [ + "ppv-lite86", + "rand_core 0.9.3", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom 0.2.16", ] [[package]] @@ -1011,6 +1421,35 @@ version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38" +[[package]] +name = "rand_hc" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b363d4f6370f88d62bf586c80405657bde0f0e1b8945d47d2ad59b906cb4f54" +dependencies = [ + "rand_core 0.6.4", +] + +[[package]] +name = "rayon" +version = "1.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "368f01d005bf8fd9b1206fb6fa653e6c4a81ceb1466406b81792d87c5677a58f" +dependencies = [ + "either", + "rayon-core", +] + +[[package]] +name = "rayon-core" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22e18b0f0062d30d4230b2e85ff77fdfe4326feb054b9783a3460d8435c8ab91" +dependencies = [ + "crossbeam-deque", + "crossbeam-utils", +] + [[package]] name = "redox_syscall" version = "0.5.18" @@ -1049,6 +1488,16 @@ version = "0.8.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a2d987857b319362043e95f5353c0535c1f58eec5336fdfcf626430af7def58" +[[package]] +name = "rfc6979" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dd2a808d456c4a54e300a23e9f5a67e122c3024119acbfd73e3bf664491cb2" +dependencies = [ + "hmac", + "subtle", +] + [[package]] name = "rustc_version" version = "0.2.3" @@ -1100,6 +1549,20 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" +[[package]] +name = "sec1" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" +dependencies = [ + "base16ct", + "der", + "generic-array", + "pkcs8", + "subtle", + "zeroize", +] + [[package]] name = "semver" version = "0.9.0" @@ -1185,6 +1648,17 @@ dependencies = [ "serde_core", ] +[[package]] +name = "sha2" +version = "0.10.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + [[package]] name = "sha3" version = "0.10.8" @@ -1210,6 +1684,16 @@ version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" +[[package]] +name = "signature" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" +dependencies = [ + "digest", + "rand_core 0.6.4", +] + [[package]] name = "siphasher" version = "1.0.1" @@ -1233,6 +1717,19 @@ name = "spin" version = "0.9.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" +dependencies = [ + "lock_api", +] + +[[package]] +name = "spki" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d" +dependencies = [ + "base64ct", + "der", +] [[package]] name = "string_cache" @@ -1255,6 +1752,12 @@ dependencies = [ "vte", ] +[[package]] +name = "subtle" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" + [[package]] name = "syn" version = "2.0.108" @@ -1330,6 +1833,15 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "tokio" +version = "1.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff360e02eab121e0bc37a2d3b4d4dc622e6eda3a8e5253d5435ecf5bd4c68408" +dependencies = [ + "pin-project-lite", +] + [[package]] name = "toml" version = "0.8.23" @@ -1524,6 +2036,16 @@ version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" +[[package]] +name = "universal-hash" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc1de2c688dc15305988b563c3854064043356019f97a4b46276fe734c4f07ea" +dependencies = [ + "crypto-common", + "subtle", +] + [[package]] name = "valuable" version = "0.1.1" @@ -1555,6 +2077,12 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "wasi" +version = "0.11.1+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" + [[package]] name = "wasip2" version = "1.0.1+wasi-0.2.4" @@ -1977,3 +2505,39 @@ dependencies = [ "unicode-xid", "wasmparser", ] + +[[package]] +name = "x25519-dalek" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7e468321c81fb07fa7f4c636c3972b9100f0346e5b6a9f2bd0603a52f7ed277" +dependencies = [ + "curve25519-dalek", + "rand_core 0.6.4", +] + +[[package]] +name = "zerocopy" +version = "0.8.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0894878a5fa3edfd6da3f88c4805f4c8558e2b996227a3d864f47fe11e38282c" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.8.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88d2b8d9c68ad2b9e4340d7832716a4d21a22a1154777ad56ea55c51a9cf3831" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "zeroize" +version = "1.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b97154e67e32c85465826e8bcc1c59429aaaf107c1e4a9e53c8d8ccd5eff88d0" diff --git a/tests/rust-apps-wasm/rust-sdk/component-macros-note/Cargo.lock b/tests/rust-apps-wasm/rust-sdk/component-macros-note/Cargo.lock index b25038dc9..5fd1ff1ee 100644 --- a/tests/rust-apps-wasm/rust-sdk/component-macros-note/Cargo.lock +++ b/tests/rust-apps-wasm/rust-sdk/component-macros-note/Cargo.lock @@ -2,6 +2,16 @@ # It is not intended for manual editing. version = 4 +[[package]] +name = "aead" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d122413f284cf2d62fb1b7db97e02edb8cda96d769b16e443a4f6195e35662b0" +dependencies = [ + "crypto-common", + "generic-array", +] + [[package]] name = "aho-corasick" version = "1.1.3" @@ -44,6 +54,18 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" +[[package]] +name = "base16ct" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" + +[[package]] +name = "base64ct" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55248b47b0caf0546f7988906588779981c43bb1bc9d0c44087278f80cdb44ba" + [[package]] name = "bech32" version = "0.11.0" @@ -115,6 +137,41 @@ version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" +[[package]] +name = "chacha20" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3613f74bd2eac03dad61bd53dbe620703d4371614fe0bc3b9f04dd36fe4e818" +dependencies = [ + "cfg-if", + "cipher", + "cpufeatures", +] + +[[package]] +name = "chacha20poly1305" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10cd79432192d1c0f4e1a0fef9527696cc039165d729fb41b3f4f4f354c2dc35" +dependencies = [ + "aead", + "chacha20", + "cipher", + "poly1305", + "zeroize", +] + +[[package]] +name = "cipher" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" +dependencies = [ + "crypto-common", + "inout", + "zeroize", +] + [[package]] name = "component_macros_note" version = "0.1.0" @@ -122,6 +179,12 @@ dependencies = [ "miden", ] +[[package]] +name = "const-oid" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" + [[package]] name = "constant_time_eq" version = "0.3.1" @@ -137,6 +200,43 @@ dependencies = [ "libc", ] +[[package]] +name = "crossbeam-deque" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9dd111b7b7f7d55b72c0a6ae361660ee5853c9af73f70c3c2ef6858b950e2e51" +dependencies = [ + "crossbeam-epoch", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.9.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" + +[[package]] +name = "crypto-bigint" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76" +dependencies = [ + "generic-array", + "rand_core 0.6.4", + "subtle", + "zeroize", +] + [[package]] name = "crypto-common" version = "0.1.6" @@ -144,9 +244,47 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" dependencies = [ "generic-array", + "rand_core 0.6.4", "typenum", ] +[[package]] +name = "curve25519-dalek" +version = "4.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97fb8b7c4503de7d6ae7b42ab72a5a59857b4c937ec27a3d4539dba95b5ab2be" +dependencies = [ + "cfg-if", + "cpufeatures", + "curve25519-dalek-derive", + "digest", + "fiat-crypto", + "rustc_version 0.4.1", + "subtle", + "zeroize", +] + +[[package]] +name = "curve25519-dalek-derive" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "der" +version = "0.7.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7c1832837b905bbfb5101e07cc24c8deddf52f93225eee6ead5f4d63d53ddcb" +dependencies = [ + "const-oid", + "zeroize", +] + [[package]] name = "derive_more" version = "2.0.1" @@ -174,7 +312,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ "block-buffer", + "const-oid", "crypto-common", + "subtle", ] [[package]] @@ -183,12 +323,70 @@ version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8975ffdaa0ef3661bfe02dbdcc06c9f829dfafe6a3c474de366a8d5e44276921" +[[package]] +name = "ecdsa" +version = "0.16.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee27f32b5c5292967d2d4a9d7f1e0b0aed2c15daded5a60300e4abb9d8020bca" +dependencies = [ + "der", + "digest", + "elliptic-curve", + "rfc6979", + "signature", + "spki", +] + +[[package]] +name = "ed25519" +version = "2.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "115531babc129696a58c64a4fef0a8bf9e9698629fb97e9e40767d235cfbcd53" +dependencies = [ + "pkcs8", + "signature", +] + +[[package]] +name = "ed25519-dalek" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70e796c081cee67dc755e1a36a0a172b897fab85fc3f6bc48307991f64e4eca9" +dependencies = [ + "curve25519-dalek", + "ed25519", + "serde", + "sha2", + "subtle", + "zeroize", +] + [[package]] name = "either" version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719" +[[package]] +name = "elliptic-curve" +version = "0.13.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47" +dependencies = [ + "base16ct", + "crypto-bigint", + "digest", + "ff", + "generic-array", + "group", + "hkdf", + "pkcs8", + "rand_core 0.6.4", + "sec1", + "subtle", + "zeroize", +] + [[package]] name = "ena" version = "0.14.3" @@ -198,12 +396,40 @@ dependencies = [ "log", ] +[[package]] +name = "enum_dispatch" +version = "0.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa18ce2bc66555b3218614519ac839ddb759a7d6720732f979ef8d13be147ecd" +dependencies = [ + "once_cell", + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "equivalent" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" +[[package]] +name = "ff" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0b50bfb653653f9ca9095b427bed08ab8d75a137839d9ad64eb11810d5b6393" +dependencies = [ + "rand_core 0.6.4", + "subtle", +] + +[[package]] +name = "fiat-crypto" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28dea519a9695b9977216879a3ebfddf92f1c08c05d984f8996aecd6ecdc811d" + [[package]] name = "find-msvc-tools" version = "0.1.4" @@ -216,6 +442,18 @@ version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1d674e81391d1e1ab681a28d99df07927c6d4aa5b027d7da16ba32d1d21ecd99" +[[package]] +name = "flume" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da0e4dd2a88388a1f4ccc7c9ce104604dab68d9f408dc34cd45823d5a9069095" +dependencies = [ + "futures-core", + "futures-sink", + "nanorand", + "spin", +] + [[package]] name = "foldhash" version = "0.1.5" @@ -305,6 +543,20 @@ checksum = "4bb6743198531e02858aeaea5398fcc883e71851fcbcb5a2f773e2fb6cb1edf2" dependencies = [ "typenum", "version_check", + "zeroize", +] + +[[package]] +name = "getrandom" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "335ff9f135e4384c8150d6f27c6daed433577f86b4750418338c01a1a2528592" +dependencies = [ + "cfg-if", + "js-sys", + "libc", + "wasi", + "wasm-bindgen", ] [[package]] @@ -327,6 +579,17 @@ version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0cc23270f6e1808e30a928bdc84dea0b9b4136a8bc82338574f23baf47bbd280" +[[package]] +name = "group" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" +dependencies = [ + "ff", + "rand_core 0.6.4", + "subtle", +] + [[package]] name = "hashbrown" version = "0.15.5" @@ -348,6 +611,24 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" +[[package]] +name = "hkdf" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b5f8eb2ad728638ea2c7d47a21db23b7b58a72ed6a38256b8a1849f15fbbdf7" +dependencies = [ + "hmac", +] + +[[package]] +name = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest", +] + [[package]] name = "id-arena" version = "2.2.1" @@ -372,6 +653,15 @@ dependencies = [ "serde_core", ] +[[package]] +name = "inout" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "879f10e63c20629ecabbb64a8010319738c66a5cd0c29b02d63d272b03751d01" +dependencies = [ + "generic-array", +] + [[package]] name = "itertools" version = "0.14.0" @@ -397,6 +687,20 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "k256" +version = "0.13.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6e3919bbaa2945715f0bb6d3934a173d1e9a59ac23767fbaaef277265a7411b" +dependencies = [ + "cfg-if", + "ecdsa", + "elliptic-curve", + "once_cell", + "sha2", + "signature", +] + [[package]] name = "keccak" version = "0.1.5" @@ -516,11 +820,12 @@ dependencies = [ [[package]] name = "miden-air" -version = "0.17.2" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2871bc4f392053cd115d4532e4b0fb164791829cc94b35641ed72480547dfd1" +checksum = "06acfd2ddc25b68f9d23d2add3f15c0ec3f9890ce6418409d71bea9dc6590bd0" dependencies = [ "miden-core", + "miden-utils-indexing", "thiserror", "winter-air", "winter-prover", @@ -528,9 +833,9 @@ dependencies = [ [[package]] name = "miden-assembly" -version = "0.17.2" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "345ae47710bbb4c6956dcc669a537c5cf2081879b6238c0df6da50e84a77ea3f" +checksum = "d1219b9e48bb286b58a23bb65cf74baa1b24ddbcb462ca625b38186674571047" dependencies = [ "log", "miden-assembly-syntax", @@ -542,9 +847,9 @@ dependencies = [ [[package]] name = "miden-assembly-syntax" -version = "0.17.2" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ab186ac7061b47415b923cf2da88df505f25c333f7caace80fb7760cf9c0590" +checksum = "1eeaef2853061c54527bb2664c0c832ce3d1f80847c79512455fec3b93057f2a" dependencies = [ "aho-corasick", "lalrpop", @@ -592,13 +897,15 @@ dependencies = [ [[package]] name = "miden-core" -version = "0.17.2" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "395ad0b07592486e02de3ff7f3bff1d7fa81b1a7120f7f0b1027d650d810bbab" +checksum = "452a00429d05c416001ec0578291eb88e115cf94fc22b3308267abfdcd813440" dependencies = [ + "enum_dispatch", "miden-crypto", "miden-debug-types", "miden-formatting", + "miden-utils-indexing", "num-derive", "num-traits", "thiserror", @@ -608,33 +915,54 @@ dependencies = [ [[package]] name = "miden-crypto" -version = "0.15.9" +version = "0.18.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4329275a11c7d8328b14a7129b21d40183056dcd0d871c3069be6e550d6ca40" +checksum = "7eb82051002f9c64878d3b105a7b924de1ee92019231923380cf4ecd7b824f9a" dependencies = [ "blake3", + "chacha20poly1305", + "ed25519-dalek", + "flume", "glob", + "hkdf", + "k256", + "miden-crypto-derive", "num", "num-complex", "rand", - "rand_core", + "rand_chacha", + "rand_core 0.9.3", + "rand_hc", "sha3", + "subtle", "thiserror", "winter-crypto", "winter-math", "winter-utils", + "x25519-dalek", +] + +[[package]] +name = "miden-crypto-derive" +version = "0.18.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2222f37355ea975f40acd3c098a437574a31a4d8a2c193cf4e9fead2beede577" +dependencies = [ + "quote", + "syn", ] [[package]] name = "miden-debug-types" -version = "0.17.2" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c84e5b15ea6fe0f80688fde2d6e4f5a3b66417d2541388b7a6cf967c6a8a2bc0" +checksum = "97eed62ac0ca7420e49148fd306c74786b23a8d31df6da6277c671ba3e5c619a" dependencies = [ "memchr", "miden-crypto", "miden-formatting", "miden-miette", + "miden-utils-indexing", "miden-utils-sync", "paste", "thiserror", @@ -651,13 +979,14 @@ dependencies = [ [[package]] name = "miden-mast-package" -version = "0.17.2" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e9d87c128f467874b272fec318e792385e35b14d200408a10d30909228db864" +checksum = "1d13e6ba2b357551598f13396ed52f8f21aa99979aa3b338bb5521feeda19c8a" dependencies = [ "derive_more", "miden-assembly-syntax", "miden-core", + "thiserror", ] [[package]] @@ -698,33 +1027,41 @@ dependencies = [ [[package]] name = "miden-objects" -version = "0.11.5" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b513a36886b910d71c39b17f37e48179e251fca49cebcbcf57094bef9941f63" +checksum = "0ef49472012d00be68f68dcbb13b4f28867fb6271c76c014bc555ef6e8e0958a" dependencies = [ "bech32", - "getrandom", + "getrandom 0.3.4", "miden-assembly", + "miden-assembly-syntax", "miden-core", "miden-crypto", + "miden-mast-package", "miden-processor", "miden-utils-sync", "miden-verifier", + "rand", "semver 1.0.27", "thiserror", ] [[package]] name = "miden-processor" -version = "0.17.2" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64304339292cc4e50a7b534197326824eeb21f3ffaadd955be63cc57093854ed" +checksum = "d2ef77929651b8755965cde8f589bd38e2345a619d54cab6427f91aa23c47f6a" dependencies = [ + "itertools", "miden-air", "miden-core", "miden-debug-types", "miden-utils-diagnostics", + "miden-utils-indexing", + "paste", + "rayon", "thiserror", + "tokio", "tracing", "winter-prover", ] @@ -739,9 +1076,9 @@ version = "0.7.0" [[package]] name = "miden-utils-diagnostics" -version = "0.17.2" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e9bf9a2c1cf3e3694d0eb347695a291602a57f817dd001ac838f300799576a69" +checksum = "1a3ff4c019d96539a7066626efb4dce5c9fb7b0e44e961b0c2571e78f34236d5" dependencies = [ "miden-crypto", "miden-debug-types", @@ -750,11 +1087,20 @@ dependencies = [ "tracing", ] +[[package]] +name = "miden-utils-indexing" +version = "0.19.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c798250bee4e856d4f18c161e91cdcbef1906f6614d00cf0063b47031c0f8cc6" +dependencies = [ + "thiserror", +] + [[package]] name = "miden-utils-sync" -version = "0.17.2" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb026e69ae937b2a83bf69ea86577e0ec2450cb22cce163190b9fd42f2972b63" +checksum = "feebe7d896c013ea74dbc98de978836606356a044d4ed3b61ded54d3b319d89f" dependencies = [ "lock_api", "loom", @@ -762,9 +1108,9 @@ dependencies = [ [[package]] name = "miden-verifier" -version = "0.17.2" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72a305e5e2c68d10bcb8e2ed3dc38e54bc3a538acc9eadc154b713d5bb47af22" +checksum = "b8f8e47b78bba1fe1b31faee8f12aafd95385f6d6a8b108b03e92f5d743bb29f" dependencies = [ "miden-air", "miden-core", @@ -775,15 +1121,24 @@ dependencies = [ [[package]] name = "midenc-hir-type" -version = "0.1.5" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e381ba23e4f57ffa0d6039113f6d6004e5b8c7ae6cb909329b48f2ab525e8680" +checksum = "9d4cfab04baffdda3fb9eafa5f873604059b89a1699aa95e4f1057397a69f0b5" dependencies = [ "miden-formatting", "smallvec", "thiserror", ] +[[package]] +name = "nanorand" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a51313c5820b0b02bd422f4b44776fbf47961755c74ce64afc73bfad10226c3" +dependencies = [ + "getrandom 0.2.16", +] + [[package]] name = "new_debug_unreachable" version = "1.0.6" @@ -890,6 +1245,12 @@ version = "1.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" +[[package]] +name = "opaque-debug" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381" + [[package]] name = "owo-colors" version = "4.2.3" @@ -956,6 +1317,36 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" +[[package]] +name = "pkcs8" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" +dependencies = [ + "der", + "spki", +] + +[[package]] +name = "poly1305" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8159bd90725d2df49889a078b54f4f79e87f1f8a8444194cdca81d38f5393abf" +dependencies = [ + "cpufeatures", + "opaque-debug", + "universal-hash", +] + +[[package]] +name = "ppv-lite86" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" +dependencies = [ + "zerocopy", +] + [[package]] name = "precomputed-hash" version = "0.1.1" @@ -1002,7 +1393,26 @@ version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1" dependencies = [ - "rand_core", + "rand_core 0.9.3", +] + +[[package]] +name = "rand_chacha" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb" +dependencies = [ + "ppv-lite86", + "rand_core 0.9.3", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom 0.2.16", ] [[package]] @@ -1011,6 +1421,35 @@ version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38" +[[package]] +name = "rand_hc" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b363d4f6370f88d62bf586c80405657bde0f0e1b8945d47d2ad59b906cb4f54" +dependencies = [ + "rand_core 0.6.4", +] + +[[package]] +name = "rayon" +version = "1.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "368f01d005bf8fd9b1206fb6fa653e6c4a81ceb1466406b81792d87c5677a58f" +dependencies = [ + "either", + "rayon-core", +] + +[[package]] +name = "rayon-core" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22e18b0f0062d30d4230b2e85ff77fdfe4326feb054b9783a3460d8435c8ab91" +dependencies = [ + "crossbeam-deque", + "crossbeam-utils", +] + [[package]] name = "redox_syscall" version = "0.5.18" @@ -1049,6 +1488,16 @@ version = "0.8.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a2d987857b319362043e95f5353c0535c1f58eec5336fdfcf626430af7def58" +[[package]] +name = "rfc6979" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dd2a808d456c4a54e300a23e9f5a67e122c3024119acbfd73e3bf664491cb2" +dependencies = [ + "hmac", + "subtle", +] + [[package]] name = "rustc_version" version = "0.2.3" @@ -1100,6 +1549,20 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" +[[package]] +name = "sec1" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" +dependencies = [ + "base16ct", + "der", + "generic-array", + "pkcs8", + "subtle", + "zeroize", +] + [[package]] name = "semver" version = "0.9.0" @@ -1185,6 +1648,17 @@ dependencies = [ "serde_core", ] +[[package]] +name = "sha2" +version = "0.10.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + [[package]] name = "sha3" version = "0.10.8" @@ -1210,6 +1684,16 @@ version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" +[[package]] +name = "signature" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" +dependencies = [ + "digest", + "rand_core 0.6.4", +] + [[package]] name = "siphasher" version = "1.0.1" @@ -1233,6 +1717,19 @@ name = "spin" version = "0.9.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" +dependencies = [ + "lock_api", +] + +[[package]] +name = "spki" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d" +dependencies = [ + "base64ct", + "der", +] [[package]] name = "string_cache" @@ -1255,6 +1752,12 @@ dependencies = [ "vte", ] +[[package]] +name = "subtle" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" + [[package]] name = "syn" version = "2.0.108" @@ -1330,6 +1833,15 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "tokio" +version = "1.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff360e02eab121e0bc37a2d3b4d4dc622e6eda3a8e5253d5435ecf5bd4c68408" +dependencies = [ + "pin-project-lite", +] + [[package]] name = "toml" version = "0.8.23" @@ -1524,6 +2036,16 @@ version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" +[[package]] +name = "universal-hash" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc1de2c688dc15305988b563c3854064043356019f97a4b46276fe734c4f07ea" +dependencies = [ + "crypto-common", + "subtle", +] + [[package]] name = "valuable" version = "0.1.1" @@ -1555,6 +2077,12 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "wasi" +version = "0.11.1+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" + [[package]] name = "wasip2" version = "1.0.1+wasi-0.2.4" @@ -1977,3 +2505,39 @@ dependencies = [ "unicode-xid", "wasmparser", ] + +[[package]] +name = "x25519-dalek" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7e468321c81fb07fa7f4c636c3972b9100f0346e5b6a9f2bd0603a52f7ed277" +dependencies = [ + "curve25519-dalek", + "rand_core 0.6.4", +] + +[[package]] +name = "zerocopy" +version = "0.8.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0894878a5fa3edfd6da3f88c4805f4c8558e2b996227a3d864f47fe11e38282c" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.8.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88d2b8d9c68ad2b9e4340d7832716a4d21a22a1154777ad56ea55c51a9cf3831" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "zeroize" +version = "1.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b97154e67e32c85465826e8bcc1c59429aaaf107c1e4a9e53c8d8ccd5eff88d0" diff --git a/tests/rust-apps-wasm/rust-sdk/cross-ctx-account-word-arg/Cargo.lock b/tests/rust-apps-wasm/rust-sdk/cross-ctx-account-word-arg/Cargo.lock index ff795bf50..b7eb5b309 100644 --- a/tests/rust-apps-wasm/rust-sdk/cross-ctx-account-word-arg/Cargo.lock +++ b/tests/rust-apps-wasm/rust-sdk/cross-ctx-account-word-arg/Cargo.lock @@ -2,6 +2,16 @@ # It is not intended for manual editing. version = 4 +[[package]] +name = "aead" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d122413f284cf2d62fb1b7db97e02edb8cda96d769b16e443a4f6195e35662b0" +dependencies = [ + "crypto-common", + "generic-array", +] + [[package]] name = "aho-corasick" version = "1.1.3" @@ -44,6 +54,18 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" +[[package]] +name = "base16ct" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" + +[[package]] +name = "base64ct" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55248b47b0caf0546f7988906588779981c43bb1bc9d0c44087278f80cdb44ba" + [[package]] name = "bech32" version = "0.11.0" @@ -114,6 +136,47 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9555578bc9e57714c812a1f84e4fc5b4d21fcb063490c624de019f7464c91268" +[[package]] +name = "chacha20" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3613f74bd2eac03dad61bd53dbe620703d4371614fe0bc3b9f04dd36fe4e818" +dependencies = [ + "cfg-if", + "cipher", + "cpufeatures", +] + +[[package]] +name = "chacha20poly1305" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10cd79432192d1c0f4e1a0fef9527696cc039165d729fb41b3f4f4f354c2dc35" +dependencies = [ + "aead", + "chacha20", + "cipher", + "poly1305", + "zeroize", +] + +[[package]] +name = "cipher" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" +dependencies = [ + "crypto-common", + "inout", + "zeroize", +] + +[[package]] +name = "const-oid" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" + [[package]] name = "constant_time_eq" version = "0.3.1" @@ -136,6 +199,43 @@ dependencies = [ "miden", ] +[[package]] +name = "crossbeam-deque" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9dd111b7b7f7d55b72c0a6ae361660ee5853c9af73f70c3c2ef6858b950e2e51" +dependencies = [ + "crossbeam-epoch", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.9.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" + +[[package]] +name = "crypto-bigint" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76" +dependencies = [ + "generic-array", + "rand_core 0.6.4", + "subtle", + "zeroize", +] + [[package]] name = "crypto-common" version = "0.1.6" @@ -143,9 +243,47 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" dependencies = [ "generic-array", + "rand_core 0.6.4", "typenum", ] +[[package]] +name = "curve25519-dalek" +version = "4.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97fb8b7c4503de7d6ae7b42ab72a5a59857b4c937ec27a3d4539dba95b5ab2be" +dependencies = [ + "cfg-if", + "cpufeatures", + "curve25519-dalek-derive", + "digest", + "fiat-crypto", + "rustc_version 0.4.1", + "subtle", + "zeroize", +] + +[[package]] +name = "curve25519-dalek-derive" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "der" +version = "0.7.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7c1832837b905bbfb5101e07cc24c8deddf52f93225eee6ead5f4d63d53ddcb" +dependencies = [ + "const-oid", + "zeroize", +] + [[package]] name = "derive_more" version = "2.0.1" @@ -173,7 +311,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ "block-buffer", + "const-oid", "crypto-common", + "subtle", ] [[package]] @@ -182,12 +322,70 @@ version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8975ffdaa0ef3661bfe02dbdcc06c9f829dfafe6a3c474de366a8d5e44276921" +[[package]] +name = "ecdsa" +version = "0.16.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee27f32b5c5292967d2d4a9d7f1e0b0aed2c15daded5a60300e4abb9d8020bca" +dependencies = [ + "der", + "digest", + "elliptic-curve", + "rfc6979", + "signature", + "spki", +] + +[[package]] +name = "ed25519" +version = "2.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "115531babc129696a58c64a4fef0a8bf9e9698629fb97e9e40767d235cfbcd53" +dependencies = [ + "pkcs8", + "signature", +] + +[[package]] +name = "ed25519-dalek" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70e796c081cee67dc755e1a36a0a172b897fab85fc3f6bc48307991f64e4eca9" +dependencies = [ + "curve25519-dalek", + "ed25519", + "serde", + "sha2", + "subtle", + "zeroize", +] + [[package]] name = "either" version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719" +[[package]] +name = "elliptic-curve" +version = "0.13.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47" +dependencies = [ + "base16ct", + "crypto-bigint", + "digest", + "ff", + "generic-array", + "group", + "hkdf", + "pkcs8", + "rand_core 0.6.4", + "sec1", + "subtle", + "zeroize", +] + [[package]] name = "ena" version = "0.14.3" @@ -197,18 +395,58 @@ dependencies = [ "log", ] +[[package]] +name = "enum_dispatch" +version = "0.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa18ce2bc66555b3218614519ac839ddb759a7d6720732f979ef8d13be147ecd" +dependencies = [ + "once_cell", + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "equivalent" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" +[[package]] +name = "ff" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0b50bfb653653f9ca9095b427bed08ab8d75a137839d9ad64eb11810d5b6393" +dependencies = [ + "rand_core 0.6.4", + "subtle", +] + +[[package]] +name = "fiat-crypto" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28dea519a9695b9977216879a3ebfddf92f1c08c05d984f8996aecd6ecdc811d" + [[package]] name = "fixedbitset" version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1d674e81391d1e1ab681a28d99df07927c6d4aa5b027d7da16ba32d1d21ecd99" +[[package]] +name = "flume" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da0e4dd2a88388a1f4ccc7c9ce104604dab68d9f408dc34cd45823d5a9069095" +dependencies = [ + "futures-core", + "futures-sink", + "nanorand", + "spin", +] + [[package]] name = "foldhash" version = "0.1.5" @@ -298,6 +536,20 @@ checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" dependencies = [ "typenum", "version_check", + "zeroize", +] + +[[package]] +name = "getrandom" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "335ff9f135e4384c8150d6f27c6daed433577f86b4750418338c01a1a2528592" +dependencies = [ + "cfg-if", + "js-sys", + "libc", + "wasi 0.11.1+wasi-snapshot-preview1", + "wasm-bindgen", ] [[package]] @@ -310,7 +562,7 @@ dependencies = [ "js-sys", "libc", "r-efi", - "wasi", + "wasi 0.14.2+wasi-0.2.4", "wasm-bindgen", ] @@ -320,6 +572,17 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a8d1add55171497b4705a648c6b583acafb01d58050a51727785f0b2c8e0a2b2" +[[package]] +name = "group" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" +dependencies = [ + "ff", + "rand_core 0.6.4", + "subtle", +] + [[package]] name = "hashbrown" version = "0.15.4" @@ -335,6 +598,24 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" +[[package]] +name = "hkdf" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b5f8eb2ad728638ea2c7d47a21db23b7b58a72ed6a38256b8a1849f15fbbdf7" +dependencies = [ + "hmac", +] + +[[package]] +name = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest", +] + [[package]] name = "id-arena" version = "2.2.1" @@ -358,6 +639,15 @@ dependencies = [ "serde", ] +[[package]] +name = "inout" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "879f10e63c20629ecabbb64a8010319738c66a5cd0c29b02d63d272b03751d01" +dependencies = [ + "generic-array", +] + [[package]] name = "itertools" version = "0.14.0" @@ -383,6 +673,20 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "k256" +version = "0.13.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6e3919bbaa2945715f0bb6d3934a173d1e9a59ac23767fbaaef277265a7411b" +dependencies = [ + "cfg-if", + "ecdsa", + "elliptic-curve", + "once_cell", + "sha2", + "signature", +] + [[package]] name = "keccak" version = "0.1.5" @@ -503,11 +807,12 @@ dependencies = [ [[package]] name = "miden-air" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db750ce0c58f51ba786c7391f392c4b77e0c83a44c5096672d4d0270d3cc7763" +checksum = "06acfd2ddc25b68f9d23d2add3f15c0ec3f9890ce6418409d71bea9dc6590bd0" dependencies = [ "miden-core", + "miden-utils-indexing", "thiserror", "winter-air", "winter-prover", @@ -515,9 +820,9 @@ dependencies = [ [[package]] name = "miden-assembly" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82575d8479aad3966be3defdc17911264bfdc99f9a7bb185180eec57c6bda9f5" +checksum = "d1219b9e48bb286b58a23bb65cf74baa1b24ddbcb462ca625b38186674571047" dependencies = [ "log", "miden-assembly-syntax", @@ -529,9 +834,9 @@ dependencies = [ [[package]] name = "miden-assembly-syntax" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7b3588ce15920c0bff47e8bf8c6ca9e0a7a539ff93014cb5ec3c665f60bc0f1" +checksum = "1eeaef2853061c54527bb2664c0c832ce3d1f80847c79512455fec3b93057f2a" dependencies = [ "aho-corasick", "lalrpop", @@ -579,13 +884,15 @@ dependencies = [ [[package]] name = "miden-core" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "571a943a923e5fb3f1bed534f41a1542c531ad2aec87dc0d5699af1709fbcea6" +checksum = "452a00429d05c416001ec0578291eb88e115cf94fc22b3308267abfdcd813440" dependencies = [ + "enum_dispatch", "miden-crypto", "miden-debug-types", "miden-formatting", + "miden-utils-indexing", "num-derive", "num-traits", "thiserror", @@ -595,33 +902,54 @@ dependencies = [ [[package]] name = "miden-crypto" -version = "0.15.9" +version = "0.18.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4329275a11c7d8328b14a7129b21d40183056dcd0d871c3069be6e550d6ca40" +checksum = "7eb82051002f9c64878d3b105a7b924de1ee92019231923380cf4ecd7b824f9a" dependencies = [ "blake3", + "chacha20poly1305", + "ed25519-dalek", + "flume", "glob", + "hkdf", + "k256", + "miden-crypto-derive", "num", "num-complex", "rand", - "rand_core", + "rand_chacha", + "rand_core 0.9.3", + "rand_hc", "sha3", + "subtle", "thiserror", "winter-crypto", "winter-math", "winter-utils", + "x25519-dalek", +] + +[[package]] +name = "miden-crypto-derive" +version = "0.18.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2222f37355ea975f40acd3c098a437574a31a4d8a2c193cf4e9fead2beede577" +dependencies = [ + "quote", + "syn", ] [[package]] name = "miden-debug-types" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93a4b53092da70aa4c9b75acc85e1c7b4d8202ce89487d2271ebdc2defcb08d6" +checksum = "97eed62ac0ca7420e49148fd306c74786b23a8d31df6da6277c671ba3e5c619a" dependencies = [ "memchr", "miden-crypto", "miden-formatting", "miden-miette", + "miden-utils-indexing", "miden-utils-sync", "paste", "thiserror", @@ -638,13 +966,14 @@ dependencies = [ [[package]] name = "miden-mast-package" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57efbfaea75eeb07d448c04aefce241bf8f23ea11600a669d897280551819992" +checksum = "1d13e6ba2b357551598f13396ed52f8f21aa99979aa3b338bb5521feeda19c8a" dependencies = [ "derive_more", "miden-assembly-syntax", "miden-core", + "thiserror", ] [[package]] @@ -685,33 +1014,41 @@ dependencies = [ [[package]] name = "miden-objects" -version = "0.11.2" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a16bce60bda18cfeaa49e99e35307c6f45297bfe2f0e18c009fa356edd552e70" +checksum = "0ef49472012d00be68f68dcbb13b4f28867fb6271c76c014bc555ef6e8e0958a" dependencies = [ "bech32", - "getrandom", + "getrandom 0.3.3", "miden-assembly", + "miden-assembly-syntax", "miden-core", "miden-crypto", + "miden-mast-package", "miden-processor", "miden-utils-sync", "miden-verifier", + "rand", "semver 1.0.26", "thiserror", ] [[package]] name = "miden-processor" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3c033f51b575b5a70b763dc0bc05062b6562a8286c6d0c144eaff92da8f214f" +checksum = "d2ef77929651b8755965cde8f589bd38e2345a619d54cab6427f91aa23c47f6a" dependencies = [ + "itertools", "miden-air", "miden-core", "miden-debug-types", "miden-utils-diagnostics", + "miden-utils-indexing", + "paste", + "rayon", "thiserror", + "tokio", "tracing", "winter-prover", ] @@ -726,9 +1063,9 @@ version = "0.7.0" [[package]] name = "miden-utils-diagnostics" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d640d80ce3438275b13d0d400901e5bbf3179737818d91d4e84f747a480fd8b" +checksum = "1a3ff4c019d96539a7066626efb4dce5c9fb7b0e44e961b0c2571e78f34236d5" dependencies = [ "miden-crypto", "miden-debug-types", @@ -737,11 +1074,20 @@ dependencies = [ "tracing", ] +[[package]] +name = "miden-utils-indexing" +version = "0.19.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c798250bee4e856d4f18c161e91cdcbef1906f6614d00cf0063b47031c0f8cc6" +dependencies = [ + "thiserror", +] + [[package]] name = "miden-utils-sync" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccf49e1fbfefeb58de992767ae7b0b6200885e342f4dd43c510daefce9539b95" +checksum = "feebe7d896c013ea74dbc98de978836606356a044d4ed3b61ded54d3b319d89f" dependencies = [ "lock_api", "loom", @@ -749,9 +1095,9 @@ dependencies = [ [[package]] name = "miden-verifier" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3104dce8b4668639aa97aa748a98aab0ea33c103e06ef5c3fd12445ab3bd2387" +checksum = "b8f8e47b78bba1fe1b31faee8f12aafd95385f6d6a8b108b03e92f5d743bb29f" dependencies = [ "miden-air", "miden-core", @@ -762,15 +1108,24 @@ dependencies = [ [[package]] name = "midenc-hir-type" -version = "0.1.5" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e381ba23e4f57ffa0d6039113f6d6004e5b8c7ae6cb909329b48f2ab525e8680" +checksum = "9d4cfab04baffdda3fb9eafa5f873604059b89a1699aa95e4f1057397a69f0b5" dependencies = [ "miden-formatting", "smallvec", "thiserror", ] +[[package]] +name = "nanorand" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a51313c5820b0b02bd422f4b44776fbf47961755c74ce64afc73bfad10226c3" +dependencies = [ + "getrandom 0.2.16", +] + [[package]] name = "new_debug_unreachable" version = "1.0.6" @@ -878,6 +1233,12 @@ version = "1.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" +[[package]] +name = "opaque-debug" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381" + [[package]] name = "overload" version = "0.1.1" @@ -950,6 +1311,36 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" +[[package]] +name = "pkcs8" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" +dependencies = [ + "der", + "spki", +] + +[[package]] +name = "poly1305" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8159bd90725d2df49889a078b54f4f79e87f1f8a8444194cdca81d38f5393abf" +dependencies = [ + "cpufeatures", + "opaque-debug", + "universal-hash", +] + +[[package]] +name = "ppv-lite86" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" +dependencies = [ + "zerocopy", +] + [[package]] name = "precomputed-hash" version = "0.1.1" @@ -996,7 +1387,26 @@ version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1" dependencies = [ - "rand_core", + "rand_core 0.9.3", +] + +[[package]] +name = "rand_chacha" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb" +dependencies = [ + "ppv-lite86", + "rand_core 0.9.3", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom 0.2.16", ] [[package]] @@ -1005,6 +1415,35 @@ version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38" +[[package]] +name = "rand_hc" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b363d4f6370f88d62bf586c80405657bde0f0e1b8945d47d2ad59b906cb4f54" +dependencies = [ + "rand_core 0.6.4", +] + +[[package]] +name = "rayon" +version = "1.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "368f01d005bf8fd9b1206fb6fa653e6c4a81ceb1466406b81792d87c5677a58f" +dependencies = [ + "either", + "rayon-core", +] + +[[package]] +name = "rayon-core" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22e18b0f0062d30d4230b2e85ff77fdfe4326feb054b9783a3460d8435c8ab91" +dependencies = [ + "crossbeam-deque", + "crossbeam-utils", +] + [[package]] name = "redox_syscall" version = "0.5.14" @@ -1016,13 +1455,13 @@ dependencies = [ [[package]] name = "regex" -version = "1.11.1" +version = "1.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191" +checksum = "843bc0191f75f3e22651ae5f1e72939ab2f72a4bc30fa80a066bd66edefc24d4" dependencies = [ "aho-corasick", "memchr", - "regex-automata 0.4.9", + "regex-automata 0.4.13", "regex-syntax 0.8.5", ] @@ -1037,9 +1476,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.9" +version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908" +checksum = "5276caf25ac86c8d810222b3dbb938e512c55c6831a10f3e6ed1c93b84041f1c" dependencies = [ "aho-corasick", "memchr", @@ -1058,6 +1497,16 @@ version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" +[[package]] +name = "rfc6979" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dd2a808d456c4a54e300a23e9f5a67e122c3024119acbfd73e3bf664491cb2" +dependencies = [ + "hmac", + "subtle", +] + [[package]] name = "rustc_version" version = "0.2.3" @@ -1109,6 +1558,20 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" +[[package]] +name = "sec1" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" +dependencies = [ + "base16ct", + "der", + "generic-array", + "pkcs8", + "subtle", + "zeroize", +] + [[package]] name = "semver" version = "0.9.0" @@ -1183,6 +1646,17 @@ dependencies = [ "serde", ] +[[package]] +name = "sha2" +version = "0.10.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + [[package]] name = "sha3" version = "0.10.8" @@ -1208,6 +1682,16 @@ version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" +[[package]] +name = "signature" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" +dependencies = [ + "digest", + "rand_core 0.6.4", +] + [[package]] name = "siphasher" version = "1.0.1" @@ -1231,6 +1715,19 @@ name = "spin" version = "0.9.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" +dependencies = [ + "lock_api", +] + +[[package]] +name = "spki" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d" +dependencies = [ + "base64ct", + "der", +] [[package]] name = "string_cache" @@ -1253,6 +1750,12 @@ dependencies = [ "vte", ] +[[package]] +name = "subtle" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" + [[package]] name = "syn" version = "2.0.106" @@ -1328,6 +1831,15 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "tokio" +version = "1.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff360e02eab121e0bc37a2d3b4d4dc622e6eda3a8e5253d5435ecf5bd4c68408" +dependencies = [ + "pin-project-lite", +] + [[package]] name = "toml" version = "0.8.23" @@ -1522,6 +2034,16 @@ version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" +[[package]] +name = "universal-hash" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc1de2c688dc15305988b563c3854064043356019f97a4b46276fe734c4f07ea" +dependencies = [ + "crypto-common", + "subtle", +] + [[package]] name = "valuable" version = "0.1.1" @@ -1553,6 +2075,12 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "wasi" +version = "0.11.1+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" + [[package]] name = "wasi" version = "0.14.2+wasi-0.2.4" @@ -2062,3 +2590,39 @@ dependencies = [ "unicode-xid", "wasmparser", ] + +[[package]] +name = "x25519-dalek" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7e468321c81fb07fa7f4c636c3972b9100f0346e5b6a9f2bd0603a52f7ed277" +dependencies = [ + "curve25519-dalek", + "rand_core 0.6.4", +] + +[[package]] +name = "zerocopy" +version = "0.8.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0894878a5fa3edfd6da3f88c4805f4c8558e2b996227a3d864f47fe11e38282c" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.8.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88d2b8d9c68ad2b9e4340d7832716a4d21a22a1154777ad56ea55c51a9cf3831" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "zeroize" +version = "1.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b97154e67e32c85465826e8bcc1c59429aaaf107c1e4a9e53c8d8ccd5eff88d0" diff --git a/tests/rust-apps-wasm/rust-sdk/cross-ctx-account-word/Cargo.lock b/tests/rust-apps-wasm/rust-sdk/cross-ctx-account-word/Cargo.lock index 52e1b40d6..436777d14 100644 --- a/tests/rust-apps-wasm/rust-sdk/cross-ctx-account-word/Cargo.lock +++ b/tests/rust-apps-wasm/rust-sdk/cross-ctx-account-word/Cargo.lock @@ -2,6 +2,16 @@ # It is not intended for manual editing. version = 4 +[[package]] +name = "aead" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d122413f284cf2d62fb1b7db97e02edb8cda96d769b16e443a4f6195e35662b0" +dependencies = [ + "crypto-common", + "generic-array", +] + [[package]] name = "aho-corasick" version = "1.1.3" @@ -44,6 +54,18 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" +[[package]] +name = "base16ct" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" + +[[package]] +name = "base64ct" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55248b47b0caf0546f7988906588779981c43bb1bc9d0c44087278f80cdb44ba" + [[package]] name = "bech32" version = "0.11.0" @@ -114,6 +136,47 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9555578bc9e57714c812a1f84e4fc5b4d21fcb063490c624de019f7464c91268" +[[package]] +name = "chacha20" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3613f74bd2eac03dad61bd53dbe620703d4371614fe0bc3b9f04dd36fe4e818" +dependencies = [ + "cfg-if", + "cipher", + "cpufeatures", +] + +[[package]] +name = "chacha20poly1305" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10cd79432192d1c0f4e1a0fef9527696cc039165d729fb41b3f4f4f354c2dc35" +dependencies = [ + "aead", + "chacha20", + "cipher", + "poly1305", + "zeroize", +] + +[[package]] +name = "cipher" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" +dependencies = [ + "crypto-common", + "inout", + "zeroize", +] + +[[package]] +name = "const-oid" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" + [[package]] name = "constant_time_eq" version = "0.3.1" @@ -136,6 +199,43 @@ dependencies = [ "miden", ] +[[package]] +name = "crossbeam-deque" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9dd111b7b7f7d55b72c0a6ae361660ee5853c9af73f70c3c2ef6858b950e2e51" +dependencies = [ + "crossbeam-epoch", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.9.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" + +[[package]] +name = "crypto-bigint" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76" +dependencies = [ + "generic-array", + "rand_core 0.6.4", + "subtle", + "zeroize", +] + [[package]] name = "crypto-common" version = "0.1.6" @@ -143,9 +243,47 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" dependencies = [ "generic-array", + "rand_core 0.6.4", "typenum", ] +[[package]] +name = "curve25519-dalek" +version = "4.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97fb8b7c4503de7d6ae7b42ab72a5a59857b4c937ec27a3d4539dba95b5ab2be" +dependencies = [ + "cfg-if", + "cpufeatures", + "curve25519-dalek-derive", + "digest", + "fiat-crypto", + "rustc_version 0.4.1", + "subtle", + "zeroize", +] + +[[package]] +name = "curve25519-dalek-derive" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "der" +version = "0.7.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7c1832837b905bbfb5101e07cc24c8deddf52f93225eee6ead5f4d63d53ddcb" +dependencies = [ + "const-oid", + "zeroize", +] + [[package]] name = "derive_more" version = "2.0.1" @@ -173,7 +311,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ "block-buffer", + "const-oid", "crypto-common", + "subtle", ] [[package]] @@ -182,12 +322,70 @@ version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8975ffdaa0ef3661bfe02dbdcc06c9f829dfafe6a3c474de366a8d5e44276921" +[[package]] +name = "ecdsa" +version = "0.16.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee27f32b5c5292967d2d4a9d7f1e0b0aed2c15daded5a60300e4abb9d8020bca" +dependencies = [ + "der", + "digest", + "elliptic-curve", + "rfc6979", + "signature", + "spki", +] + +[[package]] +name = "ed25519" +version = "2.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "115531babc129696a58c64a4fef0a8bf9e9698629fb97e9e40767d235cfbcd53" +dependencies = [ + "pkcs8", + "signature", +] + +[[package]] +name = "ed25519-dalek" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70e796c081cee67dc755e1a36a0a172b897fab85fc3f6bc48307991f64e4eca9" +dependencies = [ + "curve25519-dalek", + "ed25519", + "serde", + "sha2", + "subtle", + "zeroize", +] + [[package]] name = "either" version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719" +[[package]] +name = "elliptic-curve" +version = "0.13.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47" +dependencies = [ + "base16ct", + "crypto-bigint", + "digest", + "ff", + "generic-array", + "group", + "hkdf", + "pkcs8", + "rand_core 0.6.4", + "sec1", + "subtle", + "zeroize", +] + [[package]] name = "ena" version = "0.14.3" @@ -197,18 +395,58 @@ dependencies = [ "log", ] +[[package]] +name = "enum_dispatch" +version = "0.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa18ce2bc66555b3218614519ac839ddb759a7d6720732f979ef8d13be147ecd" +dependencies = [ + "once_cell", + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "equivalent" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" +[[package]] +name = "ff" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0b50bfb653653f9ca9095b427bed08ab8d75a137839d9ad64eb11810d5b6393" +dependencies = [ + "rand_core 0.6.4", + "subtle", +] + +[[package]] +name = "fiat-crypto" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28dea519a9695b9977216879a3ebfddf92f1c08c05d984f8996aecd6ecdc811d" + [[package]] name = "fixedbitset" version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1d674e81391d1e1ab681a28d99df07927c6d4aa5b027d7da16ba32d1d21ecd99" +[[package]] +name = "flume" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da0e4dd2a88388a1f4ccc7c9ce104604dab68d9f408dc34cd45823d5a9069095" +dependencies = [ + "futures-core", + "futures-sink", + "nanorand", + "spin", +] + [[package]] name = "foldhash" version = "0.1.5" @@ -298,6 +536,20 @@ checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" dependencies = [ "typenum", "version_check", + "zeroize", +] + +[[package]] +name = "getrandom" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "335ff9f135e4384c8150d6f27c6daed433577f86b4750418338c01a1a2528592" +dependencies = [ + "cfg-if", + "js-sys", + "libc", + "wasi 0.11.1+wasi-snapshot-preview1", + "wasm-bindgen", ] [[package]] @@ -310,7 +562,7 @@ dependencies = [ "js-sys", "libc", "r-efi", - "wasi", + "wasi 0.14.2+wasi-0.2.4", "wasm-bindgen", ] @@ -320,6 +572,17 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a8d1add55171497b4705a648c6b583acafb01d58050a51727785f0b2c8e0a2b2" +[[package]] +name = "group" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" +dependencies = [ + "ff", + "rand_core 0.6.4", + "subtle", +] + [[package]] name = "hashbrown" version = "0.15.4" @@ -335,6 +598,24 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" +[[package]] +name = "hkdf" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b5f8eb2ad728638ea2c7d47a21db23b7b58a72ed6a38256b8a1849f15fbbdf7" +dependencies = [ + "hmac", +] + +[[package]] +name = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest", +] + [[package]] name = "id-arena" version = "2.2.1" @@ -358,6 +639,15 @@ dependencies = [ "serde", ] +[[package]] +name = "inout" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "879f10e63c20629ecabbb64a8010319738c66a5cd0c29b02d63d272b03751d01" +dependencies = [ + "generic-array", +] + [[package]] name = "itertools" version = "0.14.0" @@ -383,6 +673,20 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "k256" +version = "0.13.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6e3919bbaa2945715f0bb6d3934a173d1e9a59ac23767fbaaef277265a7411b" +dependencies = [ + "cfg-if", + "ecdsa", + "elliptic-curve", + "once_cell", + "sha2", + "signature", +] + [[package]] name = "keccak" version = "0.1.5" @@ -503,11 +807,12 @@ dependencies = [ [[package]] name = "miden-air" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db750ce0c58f51ba786c7391f392c4b77e0c83a44c5096672d4d0270d3cc7763" +checksum = "06acfd2ddc25b68f9d23d2add3f15c0ec3f9890ce6418409d71bea9dc6590bd0" dependencies = [ "miden-core", + "miden-utils-indexing", "thiserror", "winter-air", "winter-prover", @@ -515,9 +820,9 @@ dependencies = [ [[package]] name = "miden-assembly" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82575d8479aad3966be3defdc17911264bfdc99f9a7bb185180eec57c6bda9f5" +checksum = "d1219b9e48bb286b58a23bb65cf74baa1b24ddbcb462ca625b38186674571047" dependencies = [ "log", "miden-assembly-syntax", @@ -529,9 +834,9 @@ dependencies = [ [[package]] name = "miden-assembly-syntax" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7b3588ce15920c0bff47e8bf8c6ca9e0a7a539ff93014cb5ec3c665f60bc0f1" +checksum = "1eeaef2853061c54527bb2664c0c832ce3d1f80847c79512455fec3b93057f2a" dependencies = [ "aho-corasick", "lalrpop", @@ -579,13 +884,15 @@ dependencies = [ [[package]] name = "miden-core" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "571a943a923e5fb3f1bed534f41a1542c531ad2aec87dc0d5699af1709fbcea6" +checksum = "452a00429d05c416001ec0578291eb88e115cf94fc22b3308267abfdcd813440" dependencies = [ + "enum_dispatch", "miden-crypto", "miden-debug-types", "miden-formatting", + "miden-utils-indexing", "num-derive", "num-traits", "thiserror", @@ -595,33 +902,54 @@ dependencies = [ [[package]] name = "miden-crypto" -version = "0.15.9" +version = "0.18.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4329275a11c7d8328b14a7129b21d40183056dcd0d871c3069be6e550d6ca40" +checksum = "7eb82051002f9c64878d3b105a7b924de1ee92019231923380cf4ecd7b824f9a" dependencies = [ "blake3", + "chacha20poly1305", + "ed25519-dalek", + "flume", "glob", + "hkdf", + "k256", + "miden-crypto-derive", "num", "num-complex", "rand", - "rand_core", + "rand_chacha", + "rand_core 0.9.3", + "rand_hc", "sha3", + "subtle", "thiserror", "winter-crypto", "winter-math", "winter-utils", + "x25519-dalek", +] + +[[package]] +name = "miden-crypto-derive" +version = "0.18.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2222f37355ea975f40acd3c098a437574a31a4d8a2c193cf4e9fead2beede577" +dependencies = [ + "quote", + "syn", ] [[package]] name = "miden-debug-types" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93a4b53092da70aa4c9b75acc85e1c7b4d8202ce89487d2271ebdc2defcb08d6" +checksum = "97eed62ac0ca7420e49148fd306c74786b23a8d31df6da6277c671ba3e5c619a" dependencies = [ "memchr", "miden-crypto", "miden-formatting", "miden-miette", + "miden-utils-indexing", "miden-utils-sync", "paste", "thiserror", @@ -638,13 +966,14 @@ dependencies = [ [[package]] name = "miden-mast-package" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57efbfaea75eeb07d448c04aefce241bf8f23ea11600a669d897280551819992" +checksum = "1d13e6ba2b357551598f13396ed52f8f21aa99979aa3b338bb5521feeda19c8a" dependencies = [ "derive_more", "miden-assembly-syntax", "miden-core", + "thiserror", ] [[package]] @@ -685,33 +1014,41 @@ dependencies = [ [[package]] name = "miden-objects" -version = "0.11.2" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a16bce60bda18cfeaa49e99e35307c6f45297bfe2f0e18c009fa356edd552e70" +checksum = "0ef49472012d00be68f68dcbb13b4f28867fb6271c76c014bc555ef6e8e0958a" dependencies = [ "bech32", - "getrandom", + "getrandom 0.3.3", "miden-assembly", + "miden-assembly-syntax", "miden-core", "miden-crypto", + "miden-mast-package", "miden-processor", "miden-utils-sync", "miden-verifier", + "rand", "semver 1.0.26", "thiserror", ] [[package]] name = "miden-processor" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3c033f51b575b5a70b763dc0bc05062b6562a8286c6d0c144eaff92da8f214f" +checksum = "d2ef77929651b8755965cde8f589bd38e2345a619d54cab6427f91aa23c47f6a" dependencies = [ + "itertools", "miden-air", "miden-core", "miden-debug-types", "miden-utils-diagnostics", + "miden-utils-indexing", + "paste", + "rayon", "thiserror", + "tokio", "tracing", "winter-prover", ] @@ -726,9 +1063,9 @@ version = "0.7.0" [[package]] name = "miden-utils-diagnostics" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d640d80ce3438275b13d0d400901e5bbf3179737818d91d4e84f747a480fd8b" +checksum = "1a3ff4c019d96539a7066626efb4dce5c9fb7b0e44e961b0c2571e78f34236d5" dependencies = [ "miden-crypto", "miden-debug-types", @@ -737,11 +1074,20 @@ dependencies = [ "tracing", ] +[[package]] +name = "miden-utils-indexing" +version = "0.19.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c798250bee4e856d4f18c161e91cdcbef1906f6614d00cf0063b47031c0f8cc6" +dependencies = [ + "thiserror", +] + [[package]] name = "miden-utils-sync" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccf49e1fbfefeb58de992767ae7b0b6200885e342f4dd43c510daefce9539b95" +checksum = "feebe7d896c013ea74dbc98de978836606356a044d4ed3b61ded54d3b319d89f" dependencies = [ "lock_api", "loom", @@ -749,9 +1095,9 @@ dependencies = [ [[package]] name = "miden-verifier" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3104dce8b4668639aa97aa748a98aab0ea33c103e06ef5c3fd12445ab3bd2387" +checksum = "b8f8e47b78bba1fe1b31faee8f12aafd95385f6d6a8b108b03e92f5d743bb29f" dependencies = [ "miden-air", "miden-core", @@ -762,15 +1108,24 @@ dependencies = [ [[package]] name = "midenc-hir-type" -version = "0.1.5" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e381ba23e4f57ffa0d6039113f6d6004e5b8c7ae6cb909329b48f2ab525e8680" +checksum = "9d4cfab04baffdda3fb9eafa5f873604059b89a1699aa95e4f1057397a69f0b5" dependencies = [ "miden-formatting", "smallvec", "thiserror", ] +[[package]] +name = "nanorand" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a51313c5820b0b02bd422f4b44776fbf47961755c74ce64afc73bfad10226c3" +dependencies = [ + "getrandom 0.2.16", +] + [[package]] name = "new_debug_unreachable" version = "1.0.6" @@ -878,6 +1233,12 @@ version = "1.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" +[[package]] +name = "opaque-debug" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381" + [[package]] name = "overload" version = "0.1.1" @@ -950,6 +1311,36 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" +[[package]] +name = "pkcs8" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" +dependencies = [ + "der", + "spki", +] + +[[package]] +name = "poly1305" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8159bd90725d2df49889a078b54f4f79e87f1f8a8444194cdca81d38f5393abf" +dependencies = [ + "cpufeatures", + "opaque-debug", + "universal-hash", +] + +[[package]] +name = "ppv-lite86" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" +dependencies = [ + "zerocopy", +] + [[package]] name = "precomputed-hash" version = "0.1.1" @@ -996,7 +1387,26 @@ version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1" dependencies = [ - "rand_core", + "rand_core 0.9.3", +] + +[[package]] +name = "rand_chacha" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb" +dependencies = [ + "ppv-lite86", + "rand_core 0.9.3", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom 0.2.16", ] [[package]] @@ -1005,6 +1415,35 @@ version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38" +[[package]] +name = "rand_hc" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b363d4f6370f88d62bf586c80405657bde0f0e1b8945d47d2ad59b906cb4f54" +dependencies = [ + "rand_core 0.6.4", +] + +[[package]] +name = "rayon" +version = "1.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "368f01d005bf8fd9b1206fb6fa653e6c4a81ceb1466406b81792d87c5677a58f" +dependencies = [ + "either", + "rayon-core", +] + +[[package]] +name = "rayon-core" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22e18b0f0062d30d4230b2e85ff77fdfe4326feb054b9783a3460d8435c8ab91" +dependencies = [ + "crossbeam-deque", + "crossbeam-utils", +] + [[package]] name = "redox_syscall" version = "0.5.14" @@ -1016,13 +1455,13 @@ dependencies = [ [[package]] name = "regex" -version = "1.11.1" +version = "1.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191" +checksum = "843bc0191f75f3e22651ae5f1e72939ab2f72a4bc30fa80a066bd66edefc24d4" dependencies = [ "aho-corasick", "memchr", - "regex-automata 0.4.9", + "regex-automata 0.4.13", "regex-syntax 0.8.5", ] @@ -1037,9 +1476,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.9" +version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908" +checksum = "5276caf25ac86c8d810222b3dbb938e512c55c6831a10f3e6ed1c93b84041f1c" dependencies = [ "aho-corasick", "memchr", @@ -1058,6 +1497,16 @@ version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" +[[package]] +name = "rfc6979" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dd2a808d456c4a54e300a23e9f5a67e122c3024119acbfd73e3bf664491cb2" +dependencies = [ + "hmac", + "subtle", +] + [[package]] name = "rustc_version" version = "0.2.3" @@ -1109,6 +1558,20 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" +[[package]] +name = "sec1" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" +dependencies = [ + "base16ct", + "der", + "generic-array", + "pkcs8", + "subtle", + "zeroize", +] + [[package]] name = "semver" version = "0.9.0" @@ -1183,6 +1646,17 @@ dependencies = [ "serde", ] +[[package]] +name = "sha2" +version = "0.10.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + [[package]] name = "sha3" version = "0.10.8" @@ -1208,6 +1682,16 @@ version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" +[[package]] +name = "signature" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" +dependencies = [ + "digest", + "rand_core 0.6.4", +] + [[package]] name = "siphasher" version = "1.0.1" @@ -1231,6 +1715,19 @@ name = "spin" version = "0.9.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" +dependencies = [ + "lock_api", +] + +[[package]] +name = "spki" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d" +dependencies = [ + "base64ct", + "der", +] [[package]] name = "string_cache" @@ -1253,6 +1750,12 @@ dependencies = [ "vte", ] +[[package]] +name = "subtle" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" + [[package]] name = "syn" version = "2.0.106" @@ -1328,6 +1831,15 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "tokio" +version = "1.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff360e02eab121e0bc37a2d3b4d4dc622e6eda3a8e5253d5435ecf5bd4c68408" +dependencies = [ + "pin-project-lite", +] + [[package]] name = "toml" version = "0.8.23" @@ -1522,6 +2034,16 @@ version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" +[[package]] +name = "universal-hash" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc1de2c688dc15305988b563c3854064043356019f97a4b46276fe734c4f07ea" +dependencies = [ + "crypto-common", + "subtle", +] + [[package]] name = "valuable" version = "0.1.1" @@ -1553,6 +2075,12 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "wasi" +version = "0.11.1+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" + [[package]] name = "wasi" version = "0.14.2+wasi-0.2.4" @@ -2062,3 +2590,39 @@ dependencies = [ "unicode-xid", "wasmparser", ] + +[[package]] +name = "x25519-dalek" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7e468321c81fb07fa7f4c636c3972b9100f0346e5b6a9f2bd0603a52f7ed277" +dependencies = [ + "curve25519-dalek", + "rand_core 0.6.4", +] + +[[package]] +name = "zerocopy" +version = "0.8.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0894878a5fa3edfd6da3f88c4805f4c8558e2b996227a3d864f47fe11e38282c" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.8.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88d2b8d9c68ad2b9e4340d7832716a4d21a22a1154777ad56ea55c51a9cf3831" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "zeroize" +version = "1.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b97154e67e32c85465826e8bcc1c59429aaaf107c1e4a9e53c8d8ccd5eff88d0" diff --git a/tests/rust-apps-wasm/rust-sdk/cross-ctx-account/Cargo.lock b/tests/rust-apps-wasm/rust-sdk/cross-ctx-account/Cargo.lock index b017bfb8d..02f3f1ba3 100644 --- a/tests/rust-apps-wasm/rust-sdk/cross-ctx-account/Cargo.lock +++ b/tests/rust-apps-wasm/rust-sdk/cross-ctx-account/Cargo.lock @@ -2,6 +2,16 @@ # It is not intended for manual editing. version = 4 +[[package]] +name = "aead" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d122413f284cf2d62fb1b7db97e02edb8cda96d769b16e443a4f6195e35662b0" +dependencies = [ + "crypto-common", + "generic-array", +] + [[package]] name = "aho-corasick" version = "1.1.3" @@ -44,6 +54,18 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" +[[package]] +name = "base16ct" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" + +[[package]] +name = "base64ct" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55248b47b0caf0546f7988906588779981c43bb1bc9d0c44087278f80cdb44ba" + [[package]] name = "bech32" version = "0.11.0" @@ -114,6 +136,47 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9555578bc9e57714c812a1f84e4fc5b4d21fcb063490c624de019f7464c91268" +[[package]] +name = "chacha20" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3613f74bd2eac03dad61bd53dbe620703d4371614fe0bc3b9f04dd36fe4e818" +dependencies = [ + "cfg-if", + "cipher", + "cpufeatures", +] + +[[package]] +name = "chacha20poly1305" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10cd79432192d1c0f4e1a0fef9527696cc039165d729fb41b3f4f4f354c2dc35" +dependencies = [ + "aead", + "chacha20", + "cipher", + "poly1305", + "zeroize", +] + +[[package]] +name = "cipher" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" +dependencies = [ + "crypto-common", + "inout", + "zeroize", +] + +[[package]] +name = "const-oid" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" + [[package]] name = "constant_time_eq" version = "0.3.1" @@ -136,6 +199,43 @@ dependencies = [ "miden", ] +[[package]] +name = "crossbeam-deque" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9dd111b7b7f7d55b72c0a6ae361660ee5853c9af73f70c3c2ef6858b950e2e51" +dependencies = [ + "crossbeam-epoch", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.9.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" + +[[package]] +name = "crypto-bigint" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76" +dependencies = [ + "generic-array", + "rand_core 0.6.4", + "subtle", + "zeroize", +] + [[package]] name = "crypto-common" version = "0.1.6" @@ -143,9 +243,47 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" dependencies = [ "generic-array", + "rand_core 0.6.4", "typenum", ] +[[package]] +name = "curve25519-dalek" +version = "4.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97fb8b7c4503de7d6ae7b42ab72a5a59857b4c937ec27a3d4539dba95b5ab2be" +dependencies = [ + "cfg-if", + "cpufeatures", + "curve25519-dalek-derive", + "digest", + "fiat-crypto", + "rustc_version 0.4.1", + "subtle", + "zeroize", +] + +[[package]] +name = "curve25519-dalek-derive" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "der" +version = "0.7.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7c1832837b905bbfb5101e07cc24c8deddf52f93225eee6ead5f4d63d53ddcb" +dependencies = [ + "const-oid", + "zeroize", +] + [[package]] name = "derive_more" version = "2.0.1" @@ -173,7 +311,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ "block-buffer", + "const-oid", "crypto-common", + "subtle", ] [[package]] @@ -182,12 +322,70 @@ version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8975ffdaa0ef3661bfe02dbdcc06c9f829dfafe6a3c474de366a8d5e44276921" +[[package]] +name = "ecdsa" +version = "0.16.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee27f32b5c5292967d2d4a9d7f1e0b0aed2c15daded5a60300e4abb9d8020bca" +dependencies = [ + "der", + "digest", + "elliptic-curve", + "rfc6979", + "signature", + "spki", +] + +[[package]] +name = "ed25519" +version = "2.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "115531babc129696a58c64a4fef0a8bf9e9698629fb97e9e40767d235cfbcd53" +dependencies = [ + "pkcs8", + "signature", +] + +[[package]] +name = "ed25519-dalek" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70e796c081cee67dc755e1a36a0a172b897fab85fc3f6bc48307991f64e4eca9" +dependencies = [ + "curve25519-dalek", + "ed25519", + "serde", + "sha2", + "subtle", + "zeroize", +] + [[package]] name = "either" version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719" +[[package]] +name = "elliptic-curve" +version = "0.13.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47" +dependencies = [ + "base16ct", + "crypto-bigint", + "digest", + "ff", + "generic-array", + "group", + "hkdf", + "pkcs8", + "rand_core 0.6.4", + "sec1", + "subtle", + "zeroize", +] + [[package]] name = "ena" version = "0.14.3" @@ -197,18 +395,58 @@ dependencies = [ "log", ] +[[package]] +name = "enum_dispatch" +version = "0.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa18ce2bc66555b3218614519ac839ddb759a7d6720732f979ef8d13be147ecd" +dependencies = [ + "once_cell", + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "equivalent" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" +[[package]] +name = "ff" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0b50bfb653653f9ca9095b427bed08ab8d75a137839d9ad64eb11810d5b6393" +dependencies = [ + "rand_core 0.6.4", + "subtle", +] + +[[package]] +name = "fiat-crypto" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28dea519a9695b9977216879a3ebfddf92f1c08c05d984f8996aecd6ecdc811d" + [[package]] name = "fixedbitset" version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1d674e81391d1e1ab681a28d99df07927c6d4aa5b027d7da16ba32d1d21ecd99" +[[package]] +name = "flume" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da0e4dd2a88388a1f4ccc7c9ce104604dab68d9f408dc34cd45823d5a9069095" +dependencies = [ + "futures-core", + "futures-sink", + "nanorand", + "spin", +] + [[package]] name = "foldhash" version = "0.1.5" @@ -298,6 +536,20 @@ checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" dependencies = [ "typenum", "version_check", + "zeroize", +] + +[[package]] +name = "getrandom" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "335ff9f135e4384c8150d6f27c6daed433577f86b4750418338c01a1a2528592" +dependencies = [ + "cfg-if", + "js-sys", + "libc", + "wasi 0.11.1+wasi-snapshot-preview1", + "wasm-bindgen", ] [[package]] @@ -310,7 +562,7 @@ dependencies = [ "js-sys", "libc", "r-efi", - "wasi", + "wasi 0.14.2+wasi-0.2.4", "wasm-bindgen", ] @@ -320,6 +572,17 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a8d1add55171497b4705a648c6b583acafb01d58050a51727785f0b2c8e0a2b2" +[[package]] +name = "group" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" +dependencies = [ + "ff", + "rand_core 0.6.4", + "subtle", +] + [[package]] name = "hashbrown" version = "0.15.4" @@ -335,6 +598,24 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" +[[package]] +name = "hkdf" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b5f8eb2ad728638ea2c7d47a21db23b7b58a72ed6a38256b8a1849f15fbbdf7" +dependencies = [ + "hmac", +] + +[[package]] +name = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest", +] + [[package]] name = "id-arena" version = "2.2.1" @@ -358,6 +639,15 @@ dependencies = [ "serde", ] +[[package]] +name = "inout" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "879f10e63c20629ecabbb64a8010319738c66a5cd0c29b02d63d272b03751d01" +dependencies = [ + "generic-array", +] + [[package]] name = "itertools" version = "0.14.0" @@ -383,6 +673,20 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "k256" +version = "0.13.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6e3919bbaa2945715f0bb6d3934a173d1e9a59ac23767fbaaef277265a7411b" +dependencies = [ + "cfg-if", + "ecdsa", + "elliptic-curve", + "once_cell", + "sha2", + "signature", +] + [[package]] name = "keccak" version = "0.1.5" @@ -503,11 +807,12 @@ dependencies = [ [[package]] name = "miden-air" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db750ce0c58f51ba786c7391f392c4b77e0c83a44c5096672d4d0270d3cc7763" +checksum = "06acfd2ddc25b68f9d23d2add3f15c0ec3f9890ce6418409d71bea9dc6590bd0" dependencies = [ "miden-core", + "miden-utils-indexing", "thiserror", "winter-air", "winter-prover", @@ -515,9 +820,9 @@ dependencies = [ [[package]] name = "miden-assembly" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82575d8479aad3966be3defdc17911264bfdc99f9a7bb185180eec57c6bda9f5" +checksum = "d1219b9e48bb286b58a23bb65cf74baa1b24ddbcb462ca625b38186674571047" dependencies = [ "log", "miden-assembly-syntax", @@ -529,9 +834,9 @@ dependencies = [ [[package]] name = "miden-assembly-syntax" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7b3588ce15920c0bff47e8bf8c6ca9e0a7a539ff93014cb5ec3c665f60bc0f1" +checksum = "1eeaef2853061c54527bb2664c0c832ce3d1f80847c79512455fec3b93057f2a" dependencies = [ "aho-corasick", "lalrpop", @@ -579,13 +884,15 @@ dependencies = [ [[package]] name = "miden-core" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "571a943a923e5fb3f1bed534f41a1542c531ad2aec87dc0d5699af1709fbcea6" +checksum = "452a00429d05c416001ec0578291eb88e115cf94fc22b3308267abfdcd813440" dependencies = [ + "enum_dispatch", "miden-crypto", "miden-debug-types", "miden-formatting", + "miden-utils-indexing", "num-derive", "num-traits", "thiserror", @@ -595,33 +902,54 @@ dependencies = [ [[package]] name = "miden-crypto" -version = "0.15.9" +version = "0.18.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4329275a11c7d8328b14a7129b21d40183056dcd0d871c3069be6e550d6ca40" +checksum = "7eb82051002f9c64878d3b105a7b924de1ee92019231923380cf4ecd7b824f9a" dependencies = [ "blake3", + "chacha20poly1305", + "ed25519-dalek", + "flume", "glob", + "hkdf", + "k256", + "miden-crypto-derive", "num", "num-complex", "rand", - "rand_core", + "rand_chacha", + "rand_core 0.9.3", + "rand_hc", "sha3", + "subtle", "thiserror", "winter-crypto", "winter-math", "winter-utils", + "x25519-dalek", +] + +[[package]] +name = "miden-crypto-derive" +version = "0.18.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2222f37355ea975f40acd3c098a437574a31a4d8a2c193cf4e9fead2beede577" +dependencies = [ + "quote", + "syn", ] [[package]] name = "miden-debug-types" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93a4b53092da70aa4c9b75acc85e1c7b4d8202ce89487d2271ebdc2defcb08d6" +checksum = "97eed62ac0ca7420e49148fd306c74786b23a8d31df6da6277c671ba3e5c619a" dependencies = [ "memchr", "miden-crypto", "miden-formatting", "miden-miette", + "miden-utils-indexing", "miden-utils-sync", "paste", "thiserror", @@ -638,13 +966,14 @@ dependencies = [ [[package]] name = "miden-mast-package" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57efbfaea75eeb07d448c04aefce241bf8f23ea11600a669d897280551819992" +checksum = "1d13e6ba2b357551598f13396ed52f8f21aa99979aa3b338bb5521feeda19c8a" dependencies = [ "derive_more", "miden-assembly-syntax", "miden-core", + "thiserror", ] [[package]] @@ -685,33 +1014,41 @@ dependencies = [ [[package]] name = "miden-objects" -version = "0.11.2" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a16bce60bda18cfeaa49e99e35307c6f45297bfe2f0e18c009fa356edd552e70" +checksum = "0ef49472012d00be68f68dcbb13b4f28867fb6271c76c014bc555ef6e8e0958a" dependencies = [ "bech32", - "getrandom", + "getrandom 0.3.3", "miden-assembly", + "miden-assembly-syntax", "miden-core", "miden-crypto", + "miden-mast-package", "miden-processor", "miden-utils-sync", "miden-verifier", + "rand", "semver 1.0.26", "thiserror", ] [[package]] name = "miden-processor" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3c033f51b575b5a70b763dc0bc05062b6562a8286c6d0c144eaff92da8f214f" +checksum = "d2ef77929651b8755965cde8f589bd38e2345a619d54cab6427f91aa23c47f6a" dependencies = [ + "itertools", "miden-air", "miden-core", "miden-debug-types", "miden-utils-diagnostics", + "miden-utils-indexing", + "paste", + "rayon", "thiserror", + "tokio", "tracing", "winter-prover", ] @@ -726,9 +1063,9 @@ version = "0.7.0" [[package]] name = "miden-utils-diagnostics" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d640d80ce3438275b13d0d400901e5bbf3179737818d91d4e84f747a480fd8b" +checksum = "1a3ff4c019d96539a7066626efb4dce5c9fb7b0e44e961b0c2571e78f34236d5" dependencies = [ "miden-crypto", "miden-debug-types", @@ -737,11 +1074,20 @@ dependencies = [ "tracing", ] +[[package]] +name = "miden-utils-indexing" +version = "0.19.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c798250bee4e856d4f18c161e91cdcbef1906f6614d00cf0063b47031c0f8cc6" +dependencies = [ + "thiserror", +] + [[package]] name = "miden-utils-sync" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccf49e1fbfefeb58de992767ae7b0b6200885e342f4dd43c510daefce9539b95" +checksum = "feebe7d896c013ea74dbc98de978836606356a044d4ed3b61ded54d3b319d89f" dependencies = [ "lock_api", "loom", @@ -749,9 +1095,9 @@ dependencies = [ [[package]] name = "miden-verifier" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3104dce8b4668639aa97aa748a98aab0ea33c103e06ef5c3fd12445ab3bd2387" +checksum = "b8f8e47b78bba1fe1b31faee8f12aafd95385f6d6a8b108b03e92f5d743bb29f" dependencies = [ "miden-air", "miden-core", @@ -762,15 +1108,24 @@ dependencies = [ [[package]] name = "midenc-hir-type" -version = "0.1.5" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e381ba23e4f57ffa0d6039113f6d6004e5b8c7ae6cb909329b48f2ab525e8680" +checksum = "9d4cfab04baffdda3fb9eafa5f873604059b89a1699aa95e4f1057397a69f0b5" dependencies = [ "miden-formatting", "smallvec", "thiserror", ] +[[package]] +name = "nanorand" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a51313c5820b0b02bd422f4b44776fbf47961755c74ce64afc73bfad10226c3" +dependencies = [ + "getrandom 0.2.16", +] + [[package]] name = "new_debug_unreachable" version = "1.0.6" @@ -878,6 +1233,12 @@ version = "1.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" +[[package]] +name = "opaque-debug" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381" + [[package]] name = "overload" version = "0.1.1" @@ -950,6 +1311,36 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" +[[package]] +name = "pkcs8" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" +dependencies = [ + "der", + "spki", +] + +[[package]] +name = "poly1305" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8159bd90725d2df49889a078b54f4f79e87f1f8a8444194cdca81d38f5393abf" +dependencies = [ + "cpufeatures", + "opaque-debug", + "universal-hash", +] + +[[package]] +name = "ppv-lite86" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" +dependencies = [ + "zerocopy", +] + [[package]] name = "precomputed-hash" version = "0.1.1" @@ -996,7 +1387,26 @@ version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1" dependencies = [ - "rand_core", + "rand_core 0.9.3", +] + +[[package]] +name = "rand_chacha" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb" +dependencies = [ + "ppv-lite86", + "rand_core 0.9.3", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom 0.2.16", ] [[package]] @@ -1005,6 +1415,35 @@ version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38" +[[package]] +name = "rand_hc" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b363d4f6370f88d62bf586c80405657bde0f0e1b8945d47d2ad59b906cb4f54" +dependencies = [ + "rand_core 0.6.4", +] + +[[package]] +name = "rayon" +version = "1.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "368f01d005bf8fd9b1206fb6fa653e6c4a81ceb1466406b81792d87c5677a58f" +dependencies = [ + "either", + "rayon-core", +] + +[[package]] +name = "rayon-core" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22e18b0f0062d30d4230b2e85ff77fdfe4326feb054b9783a3460d8435c8ab91" +dependencies = [ + "crossbeam-deque", + "crossbeam-utils", +] + [[package]] name = "redox_syscall" version = "0.5.14" @@ -1016,13 +1455,13 @@ dependencies = [ [[package]] name = "regex" -version = "1.11.1" +version = "1.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191" +checksum = "843bc0191f75f3e22651ae5f1e72939ab2f72a4bc30fa80a066bd66edefc24d4" dependencies = [ "aho-corasick", "memchr", - "regex-automata 0.4.9", + "regex-automata 0.4.13", "regex-syntax 0.8.5", ] @@ -1037,9 +1476,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.9" +version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908" +checksum = "5276caf25ac86c8d810222b3dbb938e512c55c6831a10f3e6ed1c93b84041f1c" dependencies = [ "aho-corasick", "memchr", @@ -1058,6 +1497,16 @@ version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" +[[package]] +name = "rfc6979" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dd2a808d456c4a54e300a23e9f5a67e122c3024119acbfd73e3bf664491cb2" +dependencies = [ + "hmac", + "subtle", +] + [[package]] name = "rustc_version" version = "0.2.3" @@ -1109,6 +1558,20 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" +[[package]] +name = "sec1" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" +dependencies = [ + "base16ct", + "der", + "generic-array", + "pkcs8", + "subtle", + "zeroize", +] + [[package]] name = "semver" version = "0.9.0" @@ -1183,6 +1646,17 @@ dependencies = [ "serde", ] +[[package]] +name = "sha2" +version = "0.10.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + [[package]] name = "sha3" version = "0.10.8" @@ -1208,6 +1682,16 @@ version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" +[[package]] +name = "signature" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" +dependencies = [ + "digest", + "rand_core 0.6.4", +] + [[package]] name = "siphasher" version = "1.0.1" @@ -1231,6 +1715,19 @@ name = "spin" version = "0.9.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" +dependencies = [ + "lock_api", +] + +[[package]] +name = "spki" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d" +dependencies = [ + "base64ct", + "der", +] [[package]] name = "string_cache" @@ -1253,6 +1750,12 @@ dependencies = [ "vte", ] +[[package]] +name = "subtle" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" + [[package]] name = "syn" version = "2.0.106" @@ -1328,6 +1831,15 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "tokio" +version = "1.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff360e02eab121e0bc37a2d3b4d4dc622e6eda3a8e5253d5435ecf5bd4c68408" +dependencies = [ + "pin-project-lite", +] + [[package]] name = "toml" version = "0.8.23" @@ -1522,6 +2034,16 @@ version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" +[[package]] +name = "universal-hash" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc1de2c688dc15305988b563c3854064043356019f97a4b46276fe734c4f07ea" +dependencies = [ + "crypto-common", + "subtle", +] + [[package]] name = "valuable" version = "0.1.1" @@ -1553,6 +2075,12 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "wasi" +version = "0.11.1+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" + [[package]] name = "wasi" version = "0.14.2+wasi-0.2.4" @@ -2062,3 +2590,39 @@ dependencies = [ "unicode-xid", "wasmparser", ] + +[[package]] +name = "x25519-dalek" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7e468321c81fb07fa7f4c636c3972b9100f0346e5b6a9f2bd0603a52f7ed277" +dependencies = [ + "curve25519-dalek", + "rand_core 0.6.4", +] + +[[package]] +name = "zerocopy" +version = "0.8.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0894878a5fa3edfd6da3f88c4805f4c8558e2b996227a3d864f47fe11e38282c" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.8.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88d2b8d9c68ad2b9e4340d7832716a4d21a22a1154777ad56ea55c51a9cf3831" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "zeroize" +version = "1.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b97154e67e32c85465826e8bcc1c59429aaaf107c1e4a9e53c8d8ccd5eff88d0" diff --git a/tests/rust-apps-wasm/rust-sdk/cross-ctx-note-word-arg/Cargo.lock b/tests/rust-apps-wasm/rust-sdk/cross-ctx-note-word-arg/Cargo.lock index ca66bb5e4..a2d19d3ba 100644 --- a/tests/rust-apps-wasm/rust-sdk/cross-ctx-note-word-arg/Cargo.lock +++ b/tests/rust-apps-wasm/rust-sdk/cross-ctx-note-word-arg/Cargo.lock @@ -2,6 +2,16 @@ # It is not intended for manual editing. version = 4 +[[package]] +name = "aead" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d122413f284cf2d62fb1b7db97e02edb8cda96d769b16e443a4f6195e35662b0" +dependencies = [ + "crypto-common", + "generic-array", +] + [[package]] name = "aho-corasick" version = "1.1.3" @@ -44,6 +54,18 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" +[[package]] +name = "base16ct" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" + +[[package]] +name = "base64ct" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55248b47b0caf0546f7988906588779981c43bb1bc9d0c44087278f80cdb44ba" + [[package]] name = "bech32" version = "0.11.0" @@ -114,6 +136,47 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9555578bc9e57714c812a1f84e4fc5b4d21fcb063490c624de019f7464c91268" +[[package]] +name = "chacha20" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3613f74bd2eac03dad61bd53dbe620703d4371614fe0bc3b9f04dd36fe4e818" +dependencies = [ + "cfg-if", + "cipher", + "cpufeatures", +] + +[[package]] +name = "chacha20poly1305" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10cd79432192d1c0f4e1a0fef9527696cc039165d729fb41b3f4f4f354c2dc35" +dependencies = [ + "aead", + "chacha20", + "cipher", + "poly1305", + "zeroize", +] + +[[package]] +name = "cipher" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" +dependencies = [ + "crypto-common", + "inout", + "zeroize", +] + +[[package]] +name = "const-oid" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" + [[package]] name = "constant_time_eq" version = "0.3.1" @@ -136,6 +199,43 @@ dependencies = [ "miden", ] +[[package]] +name = "crossbeam-deque" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9dd111b7b7f7d55b72c0a6ae361660ee5853c9af73f70c3c2ef6858b950e2e51" +dependencies = [ + "crossbeam-epoch", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.9.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" + +[[package]] +name = "crypto-bigint" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76" +dependencies = [ + "generic-array", + "rand_core 0.6.4", + "subtle", + "zeroize", +] + [[package]] name = "crypto-common" version = "0.1.6" @@ -143,9 +243,47 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" dependencies = [ "generic-array", + "rand_core 0.6.4", "typenum", ] +[[package]] +name = "curve25519-dalek" +version = "4.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97fb8b7c4503de7d6ae7b42ab72a5a59857b4c937ec27a3d4539dba95b5ab2be" +dependencies = [ + "cfg-if", + "cpufeatures", + "curve25519-dalek-derive", + "digest", + "fiat-crypto", + "rustc_version 0.4.1", + "subtle", + "zeroize", +] + +[[package]] +name = "curve25519-dalek-derive" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "der" +version = "0.7.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7c1832837b905bbfb5101e07cc24c8deddf52f93225eee6ead5f4d63d53ddcb" +dependencies = [ + "const-oid", + "zeroize", +] + [[package]] name = "derive_more" version = "2.0.1" @@ -173,7 +311,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ "block-buffer", + "const-oid", "crypto-common", + "subtle", ] [[package]] @@ -182,12 +322,70 @@ version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8975ffdaa0ef3661bfe02dbdcc06c9f829dfafe6a3c474de366a8d5e44276921" +[[package]] +name = "ecdsa" +version = "0.16.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee27f32b5c5292967d2d4a9d7f1e0b0aed2c15daded5a60300e4abb9d8020bca" +dependencies = [ + "der", + "digest", + "elliptic-curve", + "rfc6979", + "signature", + "spki", +] + +[[package]] +name = "ed25519" +version = "2.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "115531babc129696a58c64a4fef0a8bf9e9698629fb97e9e40767d235cfbcd53" +dependencies = [ + "pkcs8", + "signature", +] + +[[package]] +name = "ed25519-dalek" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70e796c081cee67dc755e1a36a0a172b897fab85fc3f6bc48307991f64e4eca9" +dependencies = [ + "curve25519-dalek", + "ed25519", + "serde", + "sha2", + "subtle", + "zeroize", +] + [[package]] name = "either" version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719" +[[package]] +name = "elliptic-curve" +version = "0.13.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47" +dependencies = [ + "base16ct", + "crypto-bigint", + "digest", + "ff", + "generic-array", + "group", + "hkdf", + "pkcs8", + "rand_core 0.6.4", + "sec1", + "subtle", + "zeroize", +] + [[package]] name = "ena" version = "0.14.3" @@ -197,18 +395,58 @@ dependencies = [ "log", ] +[[package]] +name = "enum_dispatch" +version = "0.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa18ce2bc66555b3218614519ac839ddb759a7d6720732f979ef8d13be147ecd" +dependencies = [ + "once_cell", + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "equivalent" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" +[[package]] +name = "ff" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0b50bfb653653f9ca9095b427bed08ab8d75a137839d9ad64eb11810d5b6393" +dependencies = [ + "rand_core 0.6.4", + "subtle", +] + +[[package]] +name = "fiat-crypto" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28dea519a9695b9977216879a3ebfddf92f1c08c05d984f8996aecd6ecdc811d" + [[package]] name = "fixedbitset" version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1d674e81391d1e1ab681a28d99df07927c6d4aa5b027d7da16ba32d1d21ecd99" +[[package]] +name = "flume" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da0e4dd2a88388a1f4ccc7c9ce104604dab68d9f408dc34cd45823d5a9069095" +dependencies = [ + "futures-core", + "futures-sink", + "nanorand", + "spin", +] + [[package]] name = "foldhash" version = "0.1.5" @@ -298,6 +536,20 @@ checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" dependencies = [ "typenum", "version_check", + "zeroize", +] + +[[package]] +name = "getrandom" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "335ff9f135e4384c8150d6f27c6daed433577f86b4750418338c01a1a2528592" +dependencies = [ + "cfg-if", + "js-sys", + "libc", + "wasi 0.11.1+wasi-snapshot-preview1", + "wasm-bindgen", ] [[package]] @@ -310,7 +562,7 @@ dependencies = [ "js-sys", "libc", "r-efi", - "wasi", + "wasi 0.14.2+wasi-0.2.4", "wasm-bindgen", ] @@ -320,6 +572,17 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a8d1add55171497b4705a648c6b583acafb01d58050a51727785f0b2c8e0a2b2" +[[package]] +name = "group" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" +dependencies = [ + "ff", + "rand_core 0.6.4", + "subtle", +] + [[package]] name = "hashbrown" version = "0.15.4" @@ -335,6 +598,24 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" +[[package]] +name = "hkdf" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b5f8eb2ad728638ea2c7d47a21db23b7b58a72ed6a38256b8a1849f15fbbdf7" +dependencies = [ + "hmac", +] + +[[package]] +name = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest", +] + [[package]] name = "id-arena" version = "2.2.1" @@ -358,6 +639,15 @@ dependencies = [ "serde", ] +[[package]] +name = "inout" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "879f10e63c20629ecabbb64a8010319738c66a5cd0c29b02d63d272b03751d01" +dependencies = [ + "generic-array", +] + [[package]] name = "itertools" version = "0.14.0" @@ -383,6 +673,20 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "k256" +version = "0.13.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6e3919bbaa2945715f0bb6d3934a173d1e9a59ac23767fbaaef277265a7411b" +dependencies = [ + "cfg-if", + "ecdsa", + "elliptic-curve", + "once_cell", + "sha2", + "signature", +] + [[package]] name = "keccak" version = "0.1.5" @@ -503,11 +807,12 @@ dependencies = [ [[package]] name = "miden-air" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db750ce0c58f51ba786c7391f392c4b77e0c83a44c5096672d4d0270d3cc7763" +checksum = "06acfd2ddc25b68f9d23d2add3f15c0ec3f9890ce6418409d71bea9dc6590bd0" dependencies = [ "miden-core", + "miden-utils-indexing", "thiserror", "winter-air", "winter-prover", @@ -515,9 +820,9 @@ dependencies = [ [[package]] name = "miden-assembly" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82575d8479aad3966be3defdc17911264bfdc99f9a7bb185180eec57c6bda9f5" +checksum = "d1219b9e48bb286b58a23bb65cf74baa1b24ddbcb462ca625b38186674571047" dependencies = [ "log", "miden-assembly-syntax", @@ -529,9 +834,9 @@ dependencies = [ [[package]] name = "miden-assembly-syntax" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7b3588ce15920c0bff47e8bf8c6ca9e0a7a539ff93014cb5ec3c665f60bc0f1" +checksum = "1eeaef2853061c54527bb2664c0c832ce3d1f80847c79512455fec3b93057f2a" dependencies = [ "aho-corasick", "lalrpop", @@ -579,13 +884,15 @@ dependencies = [ [[package]] name = "miden-core" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "571a943a923e5fb3f1bed534f41a1542c531ad2aec87dc0d5699af1709fbcea6" +checksum = "452a00429d05c416001ec0578291eb88e115cf94fc22b3308267abfdcd813440" dependencies = [ + "enum_dispatch", "miden-crypto", "miden-debug-types", "miden-formatting", + "miden-utils-indexing", "num-derive", "num-traits", "thiserror", @@ -595,33 +902,54 @@ dependencies = [ [[package]] name = "miden-crypto" -version = "0.15.9" +version = "0.18.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4329275a11c7d8328b14a7129b21d40183056dcd0d871c3069be6e550d6ca40" +checksum = "7eb82051002f9c64878d3b105a7b924de1ee92019231923380cf4ecd7b824f9a" dependencies = [ "blake3", + "chacha20poly1305", + "ed25519-dalek", + "flume", "glob", + "hkdf", + "k256", + "miden-crypto-derive", "num", "num-complex", "rand", - "rand_core", + "rand_chacha", + "rand_core 0.9.3", + "rand_hc", "sha3", + "subtle", "thiserror", "winter-crypto", "winter-math", "winter-utils", + "x25519-dalek", +] + +[[package]] +name = "miden-crypto-derive" +version = "0.18.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2222f37355ea975f40acd3c098a437574a31a4d8a2c193cf4e9fead2beede577" +dependencies = [ + "quote", + "syn", ] [[package]] name = "miden-debug-types" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93a4b53092da70aa4c9b75acc85e1c7b4d8202ce89487d2271ebdc2defcb08d6" +checksum = "97eed62ac0ca7420e49148fd306c74786b23a8d31df6da6277c671ba3e5c619a" dependencies = [ "memchr", "miden-crypto", "miden-formatting", "miden-miette", + "miden-utils-indexing", "miden-utils-sync", "paste", "thiserror", @@ -638,13 +966,14 @@ dependencies = [ [[package]] name = "miden-mast-package" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57efbfaea75eeb07d448c04aefce241bf8f23ea11600a669d897280551819992" +checksum = "1d13e6ba2b357551598f13396ed52f8f21aa99979aa3b338bb5521feeda19c8a" dependencies = [ "derive_more", "miden-assembly-syntax", "miden-core", + "thiserror", ] [[package]] @@ -685,33 +1014,41 @@ dependencies = [ [[package]] name = "miden-objects" -version = "0.11.2" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a16bce60bda18cfeaa49e99e35307c6f45297bfe2f0e18c009fa356edd552e70" +checksum = "0ef49472012d00be68f68dcbb13b4f28867fb6271c76c014bc555ef6e8e0958a" dependencies = [ "bech32", - "getrandom", + "getrandom 0.3.3", "miden-assembly", + "miden-assembly-syntax", "miden-core", "miden-crypto", + "miden-mast-package", "miden-processor", "miden-utils-sync", "miden-verifier", + "rand", "semver 1.0.26", "thiserror", ] [[package]] name = "miden-processor" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3c033f51b575b5a70b763dc0bc05062b6562a8286c6d0c144eaff92da8f214f" +checksum = "d2ef77929651b8755965cde8f589bd38e2345a619d54cab6427f91aa23c47f6a" dependencies = [ + "itertools", "miden-air", "miden-core", "miden-debug-types", "miden-utils-diagnostics", + "miden-utils-indexing", + "paste", + "rayon", "thiserror", + "tokio", "tracing", "winter-prover", ] @@ -726,9 +1063,9 @@ version = "0.7.0" [[package]] name = "miden-utils-diagnostics" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d640d80ce3438275b13d0d400901e5bbf3179737818d91d4e84f747a480fd8b" +checksum = "1a3ff4c019d96539a7066626efb4dce5c9fb7b0e44e961b0c2571e78f34236d5" dependencies = [ "miden-crypto", "miden-debug-types", @@ -737,11 +1074,20 @@ dependencies = [ "tracing", ] +[[package]] +name = "miden-utils-indexing" +version = "0.19.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c798250bee4e856d4f18c161e91cdcbef1906f6614d00cf0063b47031c0f8cc6" +dependencies = [ + "thiserror", +] + [[package]] name = "miden-utils-sync" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccf49e1fbfefeb58de992767ae7b0b6200885e342f4dd43c510daefce9539b95" +checksum = "feebe7d896c013ea74dbc98de978836606356a044d4ed3b61ded54d3b319d89f" dependencies = [ "lock_api", "loom", @@ -749,9 +1095,9 @@ dependencies = [ [[package]] name = "miden-verifier" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3104dce8b4668639aa97aa748a98aab0ea33c103e06ef5c3fd12445ab3bd2387" +checksum = "b8f8e47b78bba1fe1b31faee8f12aafd95385f6d6a8b108b03e92f5d743bb29f" dependencies = [ "miden-air", "miden-core", @@ -762,15 +1108,24 @@ dependencies = [ [[package]] name = "midenc-hir-type" -version = "0.1.5" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e381ba23e4f57ffa0d6039113f6d6004e5b8c7ae6cb909329b48f2ab525e8680" +checksum = "9d4cfab04baffdda3fb9eafa5f873604059b89a1699aa95e4f1057397a69f0b5" dependencies = [ "miden-formatting", "smallvec", "thiserror", ] +[[package]] +name = "nanorand" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a51313c5820b0b02bd422f4b44776fbf47961755c74ce64afc73bfad10226c3" +dependencies = [ + "getrandom 0.2.16", +] + [[package]] name = "new_debug_unreachable" version = "1.0.6" @@ -878,6 +1233,12 @@ version = "1.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" +[[package]] +name = "opaque-debug" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381" + [[package]] name = "overload" version = "0.1.1" @@ -950,6 +1311,36 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" +[[package]] +name = "pkcs8" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" +dependencies = [ + "der", + "spki", +] + +[[package]] +name = "poly1305" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8159bd90725d2df49889a078b54f4f79e87f1f8a8444194cdca81d38f5393abf" +dependencies = [ + "cpufeatures", + "opaque-debug", + "universal-hash", +] + +[[package]] +name = "ppv-lite86" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" +dependencies = [ + "zerocopy", +] + [[package]] name = "precomputed-hash" version = "0.1.1" @@ -996,7 +1387,26 @@ version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1" dependencies = [ - "rand_core", + "rand_core 0.9.3", +] + +[[package]] +name = "rand_chacha" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb" +dependencies = [ + "ppv-lite86", + "rand_core 0.9.3", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom 0.2.16", ] [[package]] @@ -1005,6 +1415,35 @@ version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38" +[[package]] +name = "rand_hc" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b363d4f6370f88d62bf586c80405657bde0f0e1b8945d47d2ad59b906cb4f54" +dependencies = [ + "rand_core 0.6.4", +] + +[[package]] +name = "rayon" +version = "1.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "368f01d005bf8fd9b1206fb6fa653e6c4a81ceb1466406b81792d87c5677a58f" +dependencies = [ + "either", + "rayon-core", +] + +[[package]] +name = "rayon-core" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22e18b0f0062d30d4230b2e85ff77fdfe4326feb054b9783a3460d8435c8ab91" +dependencies = [ + "crossbeam-deque", + "crossbeam-utils", +] + [[package]] name = "redox_syscall" version = "0.5.14" @@ -1016,13 +1455,13 @@ dependencies = [ [[package]] name = "regex" -version = "1.11.1" +version = "1.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191" +checksum = "843bc0191f75f3e22651ae5f1e72939ab2f72a4bc30fa80a066bd66edefc24d4" dependencies = [ "aho-corasick", "memchr", - "regex-automata 0.4.9", + "regex-automata 0.4.13", "regex-syntax 0.8.5", ] @@ -1037,9 +1476,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.9" +version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908" +checksum = "5276caf25ac86c8d810222b3dbb938e512c55c6831a10f3e6ed1c93b84041f1c" dependencies = [ "aho-corasick", "memchr", @@ -1058,6 +1497,16 @@ version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" +[[package]] +name = "rfc6979" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dd2a808d456c4a54e300a23e9f5a67e122c3024119acbfd73e3bf664491cb2" +dependencies = [ + "hmac", + "subtle", +] + [[package]] name = "rustc_version" version = "0.2.3" @@ -1109,6 +1558,20 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" +[[package]] +name = "sec1" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" +dependencies = [ + "base16ct", + "der", + "generic-array", + "pkcs8", + "subtle", + "zeroize", +] + [[package]] name = "semver" version = "0.9.0" @@ -1183,6 +1646,17 @@ dependencies = [ "serde", ] +[[package]] +name = "sha2" +version = "0.10.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + [[package]] name = "sha3" version = "0.10.8" @@ -1208,6 +1682,16 @@ version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" +[[package]] +name = "signature" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" +dependencies = [ + "digest", + "rand_core 0.6.4", +] + [[package]] name = "siphasher" version = "1.0.1" @@ -1231,6 +1715,19 @@ name = "spin" version = "0.9.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" +dependencies = [ + "lock_api", +] + +[[package]] +name = "spki" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d" +dependencies = [ + "base64ct", + "der", +] [[package]] name = "string_cache" @@ -1253,6 +1750,12 @@ dependencies = [ "vte", ] +[[package]] +name = "subtle" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" + [[package]] name = "syn" version = "2.0.106" @@ -1328,6 +1831,15 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "tokio" +version = "1.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff360e02eab121e0bc37a2d3b4d4dc622e6eda3a8e5253d5435ecf5bd4c68408" +dependencies = [ + "pin-project-lite", +] + [[package]] name = "toml" version = "0.8.23" @@ -1522,6 +2034,16 @@ version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" +[[package]] +name = "universal-hash" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc1de2c688dc15305988b563c3854064043356019f97a4b46276fe734c4f07ea" +dependencies = [ + "crypto-common", + "subtle", +] + [[package]] name = "valuable" version = "0.1.1" @@ -1553,6 +2075,12 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "wasi" +version = "0.11.1+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" + [[package]] name = "wasi" version = "0.14.2+wasi-0.2.4" @@ -2062,3 +2590,39 @@ dependencies = [ "unicode-xid", "wasmparser", ] + +[[package]] +name = "x25519-dalek" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7e468321c81fb07fa7f4c636c3972b9100f0346e5b6a9f2bd0603a52f7ed277" +dependencies = [ + "curve25519-dalek", + "rand_core 0.6.4", +] + +[[package]] +name = "zerocopy" +version = "0.8.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0894878a5fa3edfd6da3f88c4805f4c8558e2b996227a3d864f47fe11e38282c" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.8.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88d2b8d9c68ad2b9e4340d7832716a4d21a22a1154777ad56ea55c51a9cf3831" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "zeroize" +version = "1.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b97154e67e32c85465826e8bcc1c59429aaaf107c1e4a9e53c8d8ccd5eff88d0" diff --git a/tests/rust-apps-wasm/rust-sdk/cross-ctx-note-word/Cargo.lock b/tests/rust-apps-wasm/rust-sdk/cross-ctx-note-word/Cargo.lock index d8a5304c8..35eb47e70 100644 --- a/tests/rust-apps-wasm/rust-sdk/cross-ctx-note-word/Cargo.lock +++ b/tests/rust-apps-wasm/rust-sdk/cross-ctx-note-word/Cargo.lock @@ -2,6 +2,16 @@ # It is not intended for manual editing. version = 4 +[[package]] +name = "aead" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d122413f284cf2d62fb1b7db97e02edb8cda96d769b16e443a4f6195e35662b0" +dependencies = [ + "crypto-common", + "generic-array", +] + [[package]] name = "aho-corasick" version = "1.1.3" @@ -44,6 +54,18 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" +[[package]] +name = "base16ct" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" + +[[package]] +name = "base64ct" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55248b47b0caf0546f7988906588779981c43bb1bc9d0c44087278f80cdb44ba" + [[package]] name = "bech32" version = "0.11.0" @@ -114,6 +136,47 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9555578bc9e57714c812a1f84e4fc5b4d21fcb063490c624de019f7464c91268" +[[package]] +name = "chacha20" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3613f74bd2eac03dad61bd53dbe620703d4371614fe0bc3b9f04dd36fe4e818" +dependencies = [ + "cfg-if", + "cipher", + "cpufeatures", +] + +[[package]] +name = "chacha20poly1305" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10cd79432192d1c0f4e1a0fef9527696cc039165d729fb41b3f4f4f354c2dc35" +dependencies = [ + "aead", + "chacha20", + "cipher", + "poly1305", + "zeroize", +] + +[[package]] +name = "cipher" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" +dependencies = [ + "crypto-common", + "inout", + "zeroize", +] + +[[package]] +name = "const-oid" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" + [[package]] name = "constant_time_eq" version = "0.3.1" @@ -136,6 +199,43 @@ dependencies = [ "miden", ] +[[package]] +name = "crossbeam-deque" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9dd111b7b7f7d55b72c0a6ae361660ee5853c9af73f70c3c2ef6858b950e2e51" +dependencies = [ + "crossbeam-epoch", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.9.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" + +[[package]] +name = "crypto-bigint" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76" +dependencies = [ + "generic-array", + "rand_core 0.6.4", + "subtle", + "zeroize", +] + [[package]] name = "crypto-common" version = "0.1.6" @@ -143,9 +243,47 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" dependencies = [ "generic-array", + "rand_core 0.6.4", "typenum", ] +[[package]] +name = "curve25519-dalek" +version = "4.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97fb8b7c4503de7d6ae7b42ab72a5a59857b4c937ec27a3d4539dba95b5ab2be" +dependencies = [ + "cfg-if", + "cpufeatures", + "curve25519-dalek-derive", + "digest", + "fiat-crypto", + "rustc_version 0.4.1", + "subtle", + "zeroize", +] + +[[package]] +name = "curve25519-dalek-derive" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "der" +version = "0.7.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7c1832837b905bbfb5101e07cc24c8deddf52f93225eee6ead5f4d63d53ddcb" +dependencies = [ + "const-oid", + "zeroize", +] + [[package]] name = "derive_more" version = "2.0.1" @@ -173,7 +311,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ "block-buffer", + "const-oid", "crypto-common", + "subtle", ] [[package]] @@ -182,12 +322,70 @@ version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8975ffdaa0ef3661bfe02dbdcc06c9f829dfafe6a3c474de366a8d5e44276921" +[[package]] +name = "ecdsa" +version = "0.16.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee27f32b5c5292967d2d4a9d7f1e0b0aed2c15daded5a60300e4abb9d8020bca" +dependencies = [ + "der", + "digest", + "elliptic-curve", + "rfc6979", + "signature", + "spki", +] + +[[package]] +name = "ed25519" +version = "2.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "115531babc129696a58c64a4fef0a8bf9e9698629fb97e9e40767d235cfbcd53" +dependencies = [ + "pkcs8", + "signature", +] + +[[package]] +name = "ed25519-dalek" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70e796c081cee67dc755e1a36a0a172b897fab85fc3f6bc48307991f64e4eca9" +dependencies = [ + "curve25519-dalek", + "ed25519", + "serde", + "sha2", + "subtle", + "zeroize", +] + [[package]] name = "either" version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719" +[[package]] +name = "elliptic-curve" +version = "0.13.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47" +dependencies = [ + "base16ct", + "crypto-bigint", + "digest", + "ff", + "generic-array", + "group", + "hkdf", + "pkcs8", + "rand_core 0.6.4", + "sec1", + "subtle", + "zeroize", +] + [[package]] name = "ena" version = "0.14.3" @@ -197,18 +395,58 @@ dependencies = [ "log", ] +[[package]] +name = "enum_dispatch" +version = "0.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa18ce2bc66555b3218614519ac839ddb759a7d6720732f979ef8d13be147ecd" +dependencies = [ + "once_cell", + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "equivalent" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" +[[package]] +name = "ff" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0b50bfb653653f9ca9095b427bed08ab8d75a137839d9ad64eb11810d5b6393" +dependencies = [ + "rand_core 0.6.4", + "subtle", +] + +[[package]] +name = "fiat-crypto" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28dea519a9695b9977216879a3ebfddf92f1c08c05d984f8996aecd6ecdc811d" + [[package]] name = "fixedbitset" version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1d674e81391d1e1ab681a28d99df07927c6d4aa5b027d7da16ba32d1d21ecd99" +[[package]] +name = "flume" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da0e4dd2a88388a1f4ccc7c9ce104604dab68d9f408dc34cd45823d5a9069095" +dependencies = [ + "futures-core", + "futures-sink", + "nanorand", + "spin", +] + [[package]] name = "foldhash" version = "0.1.5" @@ -298,6 +536,20 @@ checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" dependencies = [ "typenum", "version_check", + "zeroize", +] + +[[package]] +name = "getrandom" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "335ff9f135e4384c8150d6f27c6daed433577f86b4750418338c01a1a2528592" +dependencies = [ + "cfg-if", + "js-sys", + "libc", + "wasi 0.11.1+wasi-snapshot-preview1", + "wasm-bindgen", ] [[package]] @@ -310,7 +562,7 @@ dependencies = [ "js-sys", "libc", "r-efi", - "wasi", + "wasi 0.14.2+wasi-0.2.4", "wasm-bindgen", ] @@ -320,6 +572,17 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a8d1add55171497b4705a648c6b583acafb01d58050a51727785f0b2c8e0a2b2" +[[package]] +name = "group" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" +dependencies = [ + "ff", + "rand_core 0.6.4", + "subtle", +] + [[package]] name = "hashbrown" version = "0.15.4" @@ -335,6 +598,24 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" +[[package]] +name = "hkdf" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b5f8eb2ad728638ea2c7d47a21db23b7b58a72ed6a38256b8a1849f15fbbdf7" +dependencies = [ + "hmac", +] + +[[package]] +name = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest", +] + [[package]] name = "id-arena" version = "2.2.1" @@ -358,6 +639,15 @@ dependencies = [ "serde", ] +[[package]] +name = "inout" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "879f10e63c20629ecabbb64a8010319738c66a5cd0c29b02d63d272b03751d01" +dependencies = [ + "generic-array", +] + [[package]] name = "itertools" version = "0.14.0" @@ -383,6 +673,20 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "k256" +version = "0.13.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6e3919bbaa2945715f0bb6d3934a173d1e9a59ac23767fbaaef277265a7411b" +dependencies = [ + "cfg-if", + "ecdsa", + "elliptic-curve", + "once_cell", + "sha2", + "signature", +] + [[package]] name = "keccak" version = "0.1.5" @@ -503,11 +807,12 @@ dependencies = [ [[package]] name = "miden-air" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db750ce0c58f51ba786c7391f392c4b77e0c83a44c5096672d4d0270d3cc7763" +checksum = "06acfd2ddc25b68f9d23d2add3f15c0ec3f9890ce6418409d71bea9dc6590bd0" dependencies = [ "miden-core", + "miden-utils-indexing", "thiserror", "winter-air", "winter-prover", @@ -515,9 +820,9 @@ dependencies = [ [[package]] name = "miden-assembly" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82575d8479aad3966be3defdc17911264bfdc99f9a7bb185180eec57c6bda9f5" +checksum = "d1219b9e48bb286b58a23bb65cf74baa1b24ddbcb462ca625b38186674571047" dependencies = [ "log", "miden-assembly-syntax", @@ -529,9 +834,9 @@ dependencies = [ [[package]] name = "miden-assembly-syntax" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7b3588ce15920c0bff47e8bf8c6ca9e0a7a539ff93014cb5ec3c665f60bc0f1" +checksum = "1eeaef2853061c54527bb2664c0c832ce3d1f80847c79512455fec3b93057f2a" dependencies = [ "aho-corasick", "lalrpop", @@ -579,13 +884,15 @@ dependencies = [ [[package]] name = "miden-core" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "571a943a923e5fb3f1bed534f41a1542c531ad2aec87dc0d5699af1709fbcea6" +checksum = "452a00429d05c416001ec0578291eb88e115cf94fc22b3308267abfdcd813440" dependencies = [ + "enum_dispatch", "miden-crypto", "miden-debug-types", "miden-formatting", + "miden-utils-indexing", "num-derive", "num-traits", "thiserror", @@ -595,33 +902,54 @@ dependencies = [ [[package]] name = "miden-crypto" -version = "0.15.9" +version = "0.18.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4329275a11c7d8328b14a7129b21d40183056dcd0d871c3069be6e550d6ca40" +checksum = "7eb82051002f9c64878d3b105a7b924de1ee92019231923380cf4ecd7b824f9a" dependencies = [ "blake3", + "chacha20poly1305", + "ed25519-dalek", + "flume", "glob", + "hkdf", + "k256", + "miden-crypto-derive", "num", "num-complex", "rand", - "rand_core", + "rand_chacha", + "rand_core 0.9.3", + "rand_hc", "sha3", + "subtle", "thiserror", "winter-crypto", "winter-math", "winter-utils", + "x25519-dalek", +] + +[[package]] +name = "miden-crypto-derive" +version = "0.18.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2222f37355ea975f40acd3c098a437574a31a4d8a2c193cf4e9fead2beede577" +dependencies = [ + "quote", + "syn", ] [[package]] name = "miden-debug-types" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93a4b53092da70aa4c9b75acc85e1c7b4d8202ce89487d2271ebdc2defcb08d6" +checksum = "97eed62ac0ca7420e49148fd306c74786b23a8d31df6da6277c671ba3e5c619a" dependencies = [ "memchr", "miden-crypto", "miden-formatting", "miden-miette", + "miden-utils-indexing", "miden-utils-sync", "paste", "thiserror", @@ -638,13 +966,14 @@ dependencies = [ [[package]] name = "miden-mast-package" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57efbfaea75eeb07d448c04aefce241bf8f23ea11600a669d897280551819992" +checksum = "1d13e6ba2b357551598f13396ed52f8f21aa99979aa3b338bb5521feeda19c8a" dependencies = [ "derive_more", "miden-assembly-syntax", "miden-core", + "thiserror", ] [[package]] @@ -685,33 +1014,41 @@ dependencies = [ [[package]] name = "miden-objects" -version = "0.11.2" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a16bce60bda18cfeaa49e99e35307c6f45297bfe2f0e18c009fa356edd552e70" +checksum = "0ef49472012d00be68f68dcbb13b4f28867fb6271c76c014bc555ef6e8e0958a" dependencies = [ "bech32", - "getrandom", + "getrandom 0.3.3", "miden-assembly", + "miden-assembly-syntax", "miden-core", "miden-crypto", + "miden-mast-package", "miden-processor", "miden-utils-sync", "miden-verifier", + "rand", "semver 1.0.26", "thiserror", ] [[package]] name = "miden-processor" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3c033f51b575b5a70b763dc0bc05062b6562a8286c6d0c144eaff92da8f214f" +checksum = "d2ef77929651b8755965cde8f589bd38e2345a619d54cab6427f91aa23c47f6a" dependencies = [ + "itertools", "miden-air", "miden-core", "miden-debug-types", "miden-utils-diagnostics", + "miden-utils-indexing", + "paste", + "rayon", "thiserror", + "tokio", "tracing", "winter-prover", ] @@ -726,9 +1063,9 @@ version = "0.7.0" [[package]] name = "miden-utils-diagnostics" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d640d80ce3438275b13d0d400901e5bbf3179737818d91d4e84f747a480fd8b" +checksum = "1a3ff4c019d96539a7066626efb4dce5c9fb7b0e44e961b0c2571e78f34236d5" dependencies = [ "miden-crypto", "miden-debug-types", @@ -737,11 +1074,20 @@ dependencies = [ "tracing", ] +[[package]] +name = "miden-utils-indexing" +version = "0.19.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c798250bee4e856d4f18c161e91cdcbef1906f6614d00cf0063b47031c0f8cc6" +dependencies = [ + "thiserror", +] + [[package]] name = "miden-utils-sync" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccf49e1fbfefeb58de992767ae7b0b6200885e342f4dd43c510daefce9539b95" +checksum = "feebe7d896c013ea74dbc98de978836606356a044d4ed3b61ded54d3b319d89f" dependencies = [ "lock_api", "loom", @@ -749,9 +1095,9 @@ dependencies = [ [[package]] name = "miden-verifier" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3104dce8b4668639aa97aa748a98aab0ea33c103e06ef5c3fd12445ab3bd2387" +checksum = "b8f8e47b78bba1fe1b31faee8f12aafd95385f6d6a8b108b03e92f5d743bb29f" dependencies = [ "miden-air", "miden-core", @@ -762,15 +1108,24 @@ dependencies = [ [[package]] name = "midenc-hir-type" -version = "0.1.5" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e381ba23e4f57ffa0d6039113f6d6004e5b8c7ae6cb909329b48f2ab525e8680" +checksum = "9d4cfab04baffdda3fb9eafa5f873604059b89a1699aa95e4f1057397a69f0b5" dependencies = [ "miden-formatting", "smallvec", "thiserror", ] +[[package]] +name = "nanorand" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a51313c5820b0b02bd422f4b44776fbf47961755c74ce64afc73bfad10226c3" +dependencies = [ + "getrandom 0.2.16", +] + [[package]] name = "new_debug_unreachable" version = "1.0.6" @@ -878,6 +1233,12 @@ version = "1.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" +[[package]] +name = "opaque-debug" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381" + [[package]] name = "overload" version = "0.1.1" @@ -950,6 +1311,36 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" +[[package]] +name = "pkcs8" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" +dependencies = [ + "der", + "spki", +] + +[[package]] +name = "poly1305" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8159bd90725d2df49889a078b54f4f79e87f1f8a8444194cdca81d38f5393abf" +dependencies = [ + "cpufeatures", + "opaque-debug", + "universal-hash", +] + +[[package]] +name = "ppv-lite86" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" +dependencies = [ + "zerocopy", +] + [[package]] name = "precomputed-hash" version = "0.1.1" @@ -996,7 +1387,26 @@ version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1" dependencies = [ - "rand_core", + "rand_core 0.9.3", +] + +[[package]] +name = "rand_chacha" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb" +dependencies = [ + "ppv-lite86", + "rand_core 0.9.3", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom 0.2.16", ] [[package]] @@ -1005,6 +1415,35 @@ version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38" +[[package]] +name = "rand_hc" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b363d4f6370f88d62bf586c80405657bde0f0e1b8945d47d2ad59b906cb4f54" +dependencies = [ + "rand_core 0.6.4", +] + +[[package]] +name = "rayon" +version = "1.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "368f01d005bf8fd9b1206fb6fa653e6c4a81ceb1466406b81792d87c5677a58f" +dependencies = [ + "either", + "rayon-core", +] + +[[package]] +name = "rayon-core" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22e18b0f0062d30d4230b2e85ff77fdfe4326feb054b9783a3460d8435c8ab91" +dependencies = [ + "crossbeam-deque", + "crossbeam-utils", +] + [[package]] name = "redox_syscall" version = "0.5.14" @@ -1016,13 +1455,13 @@ dependencies = [ [[package]] name = "regex" -version = "1.11.1" +version = "1.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191" +checksum = "843bc0191f75f3e22651ae5f1e72939ab2f72a4bc30fa80a066bd66edefc24d4" dependencies = [ "aho-corasick", "memchr", - "regex-automata 0.4.9", + "regex-automata 0.4.13", "regex-syntax 0.8.5", ] @@ -1037,9 +1476,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.9" +version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908" +checksum = "5276caf25ac86c8d810222b3dbb938e512c55c6831a10f3e6ed1c93b84041f1c" dependencies = [ "aho-corasick", "memchr", @@ -1058,6 +1497,16 @@ version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" +[[package]] +name = "rfc6979" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dd2a808d456c4a54e300a23e9f5a67e122c3024119acbfd73e3bf664491cb2" +dependencies = [ + "hmac", + "subtle", +] + [[package]] name = "rustc_version" version = "0.2.3" @@ -1109,6 +1558,20 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" +[[package]] +name = "sec1" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" +dependencies = [ + "base16ct", + "der", + "generic-array", + "pkcs8", + "subtle", + "zeroize", +] + [[package]] name = "semver" version = "0.9.0" @@ -1183,6 +1646,17 @@ dependencies = [ "serde", ] +[[package]] +name = "sha2" +version = "0.10.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + [[package]] name = "sha3" version = "0.10.8" @@ -1208,6 +1682,16 @@ version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" +[[package]] +name = "signature" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" +dependencies = [ + "digest", + "rand_core 0.6.4", +] + [[package]] name = "siphasher" version = "1.0.1" @@ -1231,6 +1715,19 @@ name = "spin" version = "0.9.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" +dependencies = [ + "lock_api", +] + +[[package]] +name = "spki" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d" +dependencies = [ + "base64ct", + "der", +] [[package]] name = "string_cache" @@ -1253,6 +1750,12 @@ dependencies = [ "vte", ] +[[package]] +name = "subtle" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" + [[package]] name = "syn" version = "2.0.106" @@ -1328,6 +1831,15 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "tokio" +version = "1.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff360e02eab121e0bc37a2d3b4d4dc622e6eda3a8e5253d5435ecf5bd4c68408" +dependencies = [ + "pin-project-lite", +] + [[package]] name = "toml" version = "0.8.23" @@ -1522,6 +2034,16 @@ version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" +[[package]] +name = "universal-hash" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc1de2c688dc15305988b563c3854064043356019f97a4b46276fe734c4f07ea" +dependencies = [ + "crypto-common", + "subtle", +] + [[package]] name = "valuable" version = "0.1.1" @@ -1553,6 +2075,12 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "wasi" +version = "0.11.1+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" + [[package]] name = "wasi" version = "0.14.2+wasi-0.2.4" @@ -2062,3 +2590,39 @@ dependencies = [ "unicode-xid", "wasmparser", ] + +[[package]] +name = "x25519-dalek" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7e468321c81fb07fa7f4c636c3972b9100f0346e5b6a9f2bd0603a52f7ed277" +dependencies = [ + "curve25519-dalek", + "rand_core 0.6.4", +] + +[[package]] +name = "zerocopy" +version = "0.8.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0894878a5fa3edfd6da3f88c4805f4c8558e2b996227a3d864f47fe11e38282c" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.8.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88d2b8d9c68ad2b9e4340d7832716a4d21a22a1154777ad56ea55c51a9cf3831" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "zeroize" +version = "1.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b97154e67e32c85465826e8bcc1c59429aaaf107c1e4a9e53c8d8ccd5eff88d0" diff --git a/tests/rust-apps-wasm/rust-sdk/cross-ctx-note/Cargo.lock b/tests/rust-apps-wasm/rust-sdk/cross-ctx-note/Cargo.lock index 2fde1ad08..2ba3d6797 100644 --- a/tests/rust-apps-wasm/rust-sdk/cross-ctx-note/Cargo.lock +++ b/tests/rust-apps-wasm/rust-sdk/cross-ctx-note/Cargo.lock @@ -2,6 +2,16 @@ # It is not intended for manual editing. version = 4 +[[package]] +name = "aead" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d122413f284cf2d62fb1b7db97e02edb8cda96d769b16e443a4f6195e35662b0" +dependencies = [ + "crypto-common", + "generic-array", +] + [[package]] name = "aho-corasick" version = "1.1.3" @@ -44,6 +54,18 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" +[[package]] +name = "base16ct" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" + +[[package]] +name = "base64ct" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55248b47b0caf0546f7988906588779981c43bb1bc9d0c44087278f80cdb44ba" + [[package]] name = "bech32" version = "0.11.0" @@ -114,6 +136,47 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9555578bc9e57714c812a1f84e4fc5b4d21fcb063490c624de019f7464c91268" +[[package]] +name = "chacha20" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3613f74bd2eac03dad61bd53dbe620703d4371614fe0bc3b9f04dd36fe4e818" +dependencies = [ + "cfg-if", + "cipher", + "cpufeatures", +] + +[[package]] +name = "chacha20poly1305" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10cd79432192d1c0f4e1a0fef9527696cc039165d729fb41b3f4f4f354c2dc35" +dependencies = [ + "aead", + "chacha20", + "cipher", + "poly1305", + "zeroize", +] + +[[package]] +name = "cipher" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" +dependencies = [ + "crypto-common", + "inout", + "zeroize", +] + +[[package]] +name = "const-oid" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" + [[package]] name = "constant_time_eq" version = "0.3.1" @@ -136,6 +199,43 @@ dependencies = [ "miden", ] +[[package]] +name = "crossbeam-deque" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9dd111b7b7f7d55b72c0a6ae361660ee5853c9af73f70c3c2ef6858b950e2e51" +dependencies = [ + "crossbeam-epoch", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.9.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" + +[[package]] +name = "crypto-bigint" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76" +dependencies = [ + "generic-array", + "rand_core 0.6.4", + "subtle", + "zeroize", +] + [[package]] name = "crypto-common" version = "0.1.6" @@ -143,9 +243,47 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" dependencies = [ "generic-array", + "rand_core 0.6.4", "typenum", ] +[[package]] +name = "curve25519-dalek" +version = "4.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97fb8b7c4503de7d6ae7b42ab72a5a59857b4c937ec27a3d4539dba95b5ab2be" +dependencies = [ + "cfg-if", + "cpufeatures", + "curve25519-dalek-derive", + "digest", + "fiat-crypto", + "rustc_version 0.4.1", + "subtle", + "zeroize", +] + +[[package]] +name = "curve25519-dalek-derive" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "der" +version = "0.7.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7c1832837b905bbfb5101e07cc24c8deddf52f93225eee6ead5f4d63d53ddcb" +dependencies = [ + "const-oid", + "zeroize", +] + [[package]] name = "derive_more" version = "2.0.1" @@ -173,7 +311,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ "block-buffer", + "const-oid", "crypto-common", + "subtle", ] [[package]] @@ -182,12 +322,70 @@ version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8975ffdaa0ef3661bfe02dbdcc06c9f829dfafe6a3c474de366a8d5e44276921" +[[package]] +name = "ecdsa" +version = "0.16.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee27f32b5c5292967d2d4a9d7f1e0b0aed2c15daded5a60300e4abb9d8020bca" +dependencies = [ + "der", + "digest", + "elliptic-curve", + "rfc6979", + "signature", + "spki", +] + +[[package]] +name = "ed25519" +version = "2.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "115531babc129696a58c64a4fef0a8bf9e9698629fb97e9e40767d235cfbcd53" +dependencies = [ + "pkcs8", + "signature", +] + +[[package]] +name = "ed25519-dalek" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70e796c081cee67dc755e1a36a0a172b897fab85fc3f6bc48307991f64e4eca9" +dependencies = [ + "curve25519-dalek", + "ed25519", + "serde", + "sha2", + "subtle", + "zeroize", +] + [[package]] name = "either" version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719" +[[package]] +name = "elliptic-curve" +version = "0.13.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47" +dependencies = [ + "base16ct", + "crypto-bigint", + "digest", + "ff", + "generic-array", + "group", + "hkdf", + "pkcs8", + "rand_core 0.6.4", + "sec1", + "subtle", + "zeroize", +] + [[package]] name = "ena" version = "0.14.3" @@ -197,18 +395,58 @@ dependencies = [ "log", ] +[[package]] +name = "enum_dispatch" +version = "0.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa18ce2bc66555b3218614519ac839ddb759a7d6720732f979ef8d13be147ecd" +dependencies = [ + "once_cell", + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "equivalent" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" +[[package]] +name = "ff" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0b50bfb653653f9ca9095b427bed08ab8d75a137839d9ad64eb11810d5b6393" +dependencies = [ + "rand_core 0.6.4", + "subtle", +] + +[[package]] +name = "fiat-crypto" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28dea519a9695b9977216879a3ebfddf92f1c08c05d984f8996aecd6ecdc811d" + [[package]] name = "fixedbitset" version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1d674e81391d1e1ab681a28d99df07927c6d4aa5b027d7da16ba32d1d21ecd99" +[[package]] +name = "flume" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da0e4dd2a88388a1f4ccc7c9ce104604dab68d9f408dc34cd45823d5a9069095" +dependencies = [ + "futures-core", + "futures-sink", + "nanorand", + "spin", +] + [[package]] name = "foldhash" version = "0.1.5" @@ -298,6 +536,20 @@ checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" dependencies = [ "typenum", "version_check", + "zeroize", +] + +[[package]] +name = "getrandom" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "335ff9f135e4384c8150d6f27c6daed433577f86b4750418338c01a1a2528592" +dependencies = [ + "cfg-if", + "js-sys", + "libc", + "wasi 0.11.1+wasi-snapshot-preview1", + "wasm-bindgen", ] [[package]] @@ -310,7 +562,7 @@ dependencies = [ "js-sys", "libc", "r-efi", - "wasi", + "wasi 0.14.2+wasi-0.2.4", "wasm-bindgen", ] @@ -320,6 +572,17 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a8d1add55171497b4705a648c6b583acafb01d58050a51727785f0b2c8e0a2b2" +[[package]] +name = "group" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" +dependencies = [ + "ff", + "rand_core 0.6.4", + "subtle", +] + [[package]] name = "hashbrown" version = "0.15.4" @@ -335,6 +598,24 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" +[[package]] +name = "hkdf" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b5f8eb2ad728638ea2c7d47a21db23b7b58a72ed6a38256b8a1849f15fbbdf7" +dependencies = [ + "hmac", +] + +[[package]] +name = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest", +] + [[package]] name = "id-arena" version = "2.2.1" @@ -358,6 +639,15 @@ dependencies = [ "serde", ] +[[package]] +name = "inout" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "879f10e63c20629ecabbb64a8010319738c66a5cd0c29b02d63d272b03751d01" +dependencies = [ + "generic-array", +] + [[package]] name = "itertools" version = "0.14.0" @@ -383,6 +673,20 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "k256" +version = "0.13.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6e3919bbaa2945715f0bb6d3934a173d1e9a59ac23767fbaaef277265a7411b" +dependencies = [ + "cfg-if", + "ecdsa", + "elliptic-curve", + "once_cell", + "sha2", + "signature", +] + [[package]] name = "keccak" version = "0.1.5" @@ -503,11 +807,12 @@ dependencies = [ [[package]] name = "miden-air" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db750ce0c58f51ba786c7391f392c4b77e0c83a44c5096672d4d0270d3cc7763" +checksum = "06acfd2ddc25b68f9d23d2add3f15c0ec3f9890ce6418409d71bea9dc6590bd0" dependencies = [ "miden-core", + "miden-utils-indexing", "thiserror", "winter-air", "winter-prover", @@ -515,9 +820,9 @@ dependencies = [ [[package]] name = "miden-assembly" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82575d8479aad3966be3defdc17911264bfdc99f9a7bb185180eec57c6bda9f5" +checksum = "d1219b9e48bb286b58a23bb65cf74baa1b24ddbcb462ca625b38186674571047" dependencies = [ "log", "miden-assembly-syntax", @@ -529,9 +834,9 @@ dependencies = [ [[package]] name = "miden-assembly-syntax" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7b3588ce15920c0bff47e8bf8c6ca9e0a7a539ff93014cb5ec3c665f60bc0f1" +checksum = "1eeaef2853061c54527bb2664c0c832ce3d1f80847c79512455fec3b93057f2a" dependencies = [ "aho-corasick", "lalrpop", @@ -579,13 +884,15 @@ dependencies = [ [[package]] name = "miden-core" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "571a943a923e5fb3f1bed534f41a1542c531ad2aec87dc0d5699af1709fbcea6" +checksum = "452a00429d05c416001ec0578291eb88e115cf94fc22b3308267abfdcd813440" dependencies = [ + "enum_dispatch", "miden-crypto", "miden-debug-types", "miden-formatting", + "miden-utils-indexing", "num-derive", "num-traits", "thiserror", @@ -595,33 +902,54 @@ dependencies = [ [[package]] name = "miden-crypto" -version = "0.15.9" +version = "0.18.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4329275a11c7d8328b14a7129b21d40183056dcd0d871c3069be6e550d6ca40" +checksum = "7eb82051002f9c64878d3b105a7b924de1ee92019231923380cf4ecd7b824f9a" dependencies = [ "blake3", + "chacha20poly1305", + "ed25519-dalek", + "flume", "glob", + "hkdf", + "k256", + "miden-crypto-derive", "num", "num-complex", "rand", - "rand_core", + "rand_chacha", + "rand_core 0.9.3", + "rand_hc", "sha3", + "subtle", "thiserror", "winter-crypto", "winter-math", "winter-utils", + "x25519-dalek", +] + +[[package]] +name = "miden-crypto-derive" +version = "0.18.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2222f37355ea975f40acd3c098a437574a31a4d8a2c193cf4e9fead2beede577" +dependencies = [ + "quote", + "syn", ] [[package]] name = "miden-debug-types" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93a4b53092da70aa4c9b75acc85e1c7b4d8202ce89487d2271ebdc2defcb08d6" +checksum = "97eed62ac0ca7420e49148fd306c74786b23a8d31df6da6277c671ba3e5c619a" dependencies = [ "memchr", "miden-crypto", "miden-formatting", "miden-miette", + "miden-utils-indexing", "miden-utils-sync", "paste", "thiserror", @@ -638,13 +966,14 @@ dependencies = [ [[package]] name = "miden-mast-package" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57efbfaea75eeb07d448c04aefce241bf8f23ea11600a669d897280551819992" +checksum = "1d13e6ba2b357551598f13396ed52f8f21aa99979aa3b338bb5521feeda19c8a" dependencies = [ "derive_more", "miden-assembly-syntax", "miden-core", + "thiserror", ] [[package]] @@ -685,33 +1014,41 @@ dependencies = [ [[package]] name = "miden-objects" -version = "0.11.2" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a16bce60bda18cfeaa49e99e35307c6f45297bfe2f0e18c009fa356edd552e70" +checksum = "0ef49472012d00be68f68dcbb13b4f28867fb6271c76c014bc555ef6e8e0958a" dependencies = [ "bech32", - "getrandom", + "getrandom 0.3.3", "miden-assembly", + "miden-assembly-syntax", "miden-core", "miden-crypto", + "miden-mast-package", "miden-processor", "miden-utils-sync", "miden-verifier", + "rand", "semver 1.0.26", "thiserror", ] [[package]] name = "miden-processor" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3c033f51b575b5a70b763dc0bc05062b6562a8286c6d0c144eaff92da8f214f" +checksum = "d2ef77929651b8755965cde8f589bd38e2345a619d54cab6427f91aa23c47f6a" dependencies = [ + "itertools", "miden-air", "miden-core", "miden-debug-types", "miden-utils-diagnostics", + "miden-utils-indexing", + "paste", + "rayon", "thiserror", + "tokio", "tracing", "winter-prover", ] @@ -726,9 +1063,9 @@ version = "0.7.0" [[package]] name = "miden-utils-diagnostics" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d640d80ce3438275b13d0d400901e5bbf3179737818d91d4e84f747a480fd8b" +checksum = "1a3ff4c019d96539a7066626efb4dce5c9fb7b0e44e961b0c2571e78f34236d5" dependencies = [ "miden-crypto", "miden-debug-types", @@ -737,11 +1074,20 @@ dependencies = [ "tracing", ] +[[package]] +name = "miden-utils-indexing" +version = "0.19.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c798250bee4e856d4f18c161e91cdcbef1906f6614d00cf0063b47031c0f8cc6" +dependencies = [ + "thiserror", +] + [[package]] name = "miden-utils-sync" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccf49e1fbfefeb58de992767ae7b0b6200885e342f4dd43c510daefce9539b95" +checksum = "feebe7d896c013ea74dbc98de978836606356a044d4ed3b61ded54d3b319d89f" dependencies = [ "lock_api", "loom", @@ -749,9 +1095,9 @@ dependencies = [ [[package]] name = "miden-verifier" -version = "0.17.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3104dce8b4668639aa97aa748a98aab0ea33c103e06ef5c3fd12445ab3bd2387" +checksum = "b8f8e47b78bba1fe1b31faee8f12aafd95385f6d6a8b108b03e92f5d743bb29f" dependencies = [ "miden-air", "miden-core", @@ -762,15 +1108,24 @@ dependencies = [ [[package]] name = "midenc-hir-type" -version = "0.1.5" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e381ba23e4f57ffa0d6039113f6d6004e5b8c7ae6cb909329b48f2ab525e8680" +checksum = "9d4cfab04baffdda3fb9eafa5f873604059b89a1699aa95e4f1057397a69f0b5" dependencies = [ "miden-formatting", "smallvec", "thiserror", ] +[[package]] +name = "nanorand" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a51313c5820b0b02bd422f4b44776fbf47961755c74ce64afc73bfad10226c3" +dependencies = [ + "getrandom 0.2.16", +] + [[package]] name = "new_debug_unreachable" version = "1.0.6" @@ -878,6 +1233,12 @@ version = "1.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" +[[package]] +name = "opaque-debug" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381" + [[package]] name = "overload" version = "0.1.1" @@ -950,6 +1311,36 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" +[[package]] +name = "pkcs8" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" +dependencies = [ + "der", + "spki", +] + +[[package]] +name = "poly1305" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8159bd90725d2df49889a078b54f4f79e87f1f8a8444194cdca81d38f5393abf" +dependencies = [ + "cpufeatures", + "opaque-debug", + "universal-hash", +] + +[[package]] +name = "ppv-lite86" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" +dependencies = [ + "zerocopy", +] + [[package]] name = "precomputed-hash" version = "0.1.1" @@ -996,7 +1387,26 @@ version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1" dependencies = [ - "rand_core", + "rand_core 0.9.3", +] + +[[package]] +name = "rand_chacha" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb" +dependencies = [ + "ppv-lite86", + "rand_core 0.9.3", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom 0.2.16", ] [[package]] @@ -1005,6 +1415,35 @@ version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38" +[[package]] +name = "rand_hc" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b363d4f6370f88d62bf586c80405657bde0f0e1b8945d47d2ad59b906cb4f54" +dependencies = [ + "rand_core 0.6.4", +] + +[[package]] +name = "rayon" +version = "1.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "368f01d005bf8fd9b1206fb6fa653e6c4a81ceb1466406b81792d87c5677a58f" +dependencies = [ + "either", + "rayon-core", +] + +[[package]] +name = "rayon-core" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22e18b0f0062d30d4230b2e85ff77fdfe4326feb054b9783a3460d8435c8ab91" +dependencies = [ + "crossbeam-deque", + "crossbeam-utils", +] + [[package]] name = "redox_syscall" version = "0.5.14" @@ -1016,13 +1455,13 @@ dependencies = [ [[package]] name = "regex" -version = "1.11.1" +version = "1.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191" +checksum = "843bc0191f75f3e22651ae5f1e72939ab2f72a4bc30fa80a066bd66edefc24d4" dependencies = [ "aho-corasick", "memchr", - "regex-automata 0.4.9", + "regex-automata 0.4.13", "regex-syntax 0.8.5", ] @@ -1037,9 +1476,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.9" +version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908" +checksum = "5276caf25ac86c8d810222b3dbb938e512c55c6831a10f3e6ed1c93b84041f1c" dependencies = [ "aho-corasick", "memchr", @@ -1058,6 +1497,16 @@ version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" +[[package]] +name = "rfc6979" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dd2a808d456c4a54e300a23e9f5a67e122c3024119acbfd73e3bf664491cb2" +dependencies = [ + "hmac", + "subtle", +] + [[package]] name = "rustc_version" version = "0.2.3" @@ -1109,6 +1558,20 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" +[[package]] +name = "sec1" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" +dependencies = [ + "base16ct", + "der", + "generic-array", + "pkcs8", + "subtle", + "zeroize", +] + [[package]] name = "semver" version = "0.9.0" @@ -1183,6 +1646,17 @@ dependencies = [ "serde", ] +[[package]] +name = "sha2" +version = "0.10.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + [[package]] name = "sha3" version = "0.10.8" @@ -1208,6 +1682,16 @@ version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" +[[package]] +name = "signature" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" +dependencies = [ + "digest", + "rand_core 0.6.4", +] + [[package]] name = "siphasher" version = "1.0.1" @@ -1231,6 +1715,19 @@ name = "spin" version = "0.9.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" +dependencies = [ + "lock_api", +] + +[[package]] +name = "spki" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d" +dependencies = [ + "base64ct", + "der", +] [[package]] name = "string_cache" @@ -1253,6 +1750,12 @@ dependencies = [ "vte", ] +[[package]] +name = "subtle" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" + [[package]] name = "syn" version = "2.0.106" @@ -1328,6 +1831,15 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "tokio" +version = "1.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff360e02eab121e0bc37a2d3b4d4dc622e6eda3a8e5253d5435ecf5bd4c68408" +dependencies = [ + "pin-project-lite", +] + [[package]] name = "toml" version = "0.8.23" @@ -1522,6 +2034,16 @@ version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" +[[package]] +name = "universal-hash" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc1de2c688dc15305988b563c3854064043356019f97a4b46276fe734c4f07ea" +dependencies = [ + "crypto-common", + "subtle", +] + [[package]] name = "valuable" version = "0.1.1" @@ -1553,6 +2075,12 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "wasi" +version = "0.11.1+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" + [[package]] name = "wasi" version = "0.14.2+wasi-0.2.4" @@ -2062,3 +2590,39 @@ dependencies = [ "unicode-xid", "wasmparser", ] + +[[package]] +name = "x25519-dalek" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7e468321c81fb07fa7f4c636c3972b9100f0346e5b6a9f2bd0603a52f7ed277" +dependencies = [ + "curve25519-dalek", + "rand_core 0.6.4", +] + +[[package]] +name = "zerocopy" +version = "0.8.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0894878a5fa3edfd6da3f88c4805f4c8558e2b996227a3d864f47fe11e38282c" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.8.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88d2b8d9c68ad2b9e4340d7832716a4d21a22a1154777ad56ea55c51a9cf3831" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "zeroize" +version = "1.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b97154e67e32c85465826e8bcc1c59429aaaf107c1e4a9e53c8d8ccd5eff88d0" diff --git a/tools/cargo-miden/Cargo.toml b/tools/cargo-miden/Cargo.toml index dcced1060..c912ad3dc 100644 --- a/tools/cargo-miden/Cargo.toml +++ b/tools/cargo-miden/Cargo.toml @@ -29,13 +29,15 @@ log.workspace = true clap.workspace = true anyhow.workspace = true cargo_metadata = "0.19" -cargo-generate = "0.23" path-absolutize = "3.1.1" serde.workspace = true serde_json = "1.0" toml_edit = { version = "0.23", features = ["serde"] } semver.workspace = true parse_arg = "0.1.6" +liquid = "0.26" +tempfile = "3.19" +walkdir = "2.5" [dev-dependencies] # Use local paths for dev-only dependency to avoid relying on crates.io during packaging diff --git a/tools/cargo-miden/src/commands/example_project.rs b/tools/cargo-miden/src/commands/example_project.rs index 10533bb6c..8a3370673 100644 --- a/tools/cargo-miden/src/commands/example_project.rs +++ b/tools/cargo-miden/src/commands/example_project.rs @@ -1,7 +1,7 @@ use std::path::{Path, PathBuf}; use anyhow::Context; -use cargo_generate::{GenerateArgs, TemplatePath}; +use crate::template::{generate, GenerateArgs, TemplatePath}; use clap::Args; use toml_edit::{DocumentMut, Item}; @@ -89,7 +89,7 @@ impl ExampleCommand { verbose: true, ..Default::default() }; - cargo_generate::generate(generate_args) + generate(generate_args) .context("Failed to scaffold new Miden project from the template")?; // Process the Cargo.toml to update dependencies and WIT paths @@ -137,7 +137,7 @@ impl ExampleCommand { ..Default::default() }; - cargo_generate::generate(generate_args) + generate(generate_args) .context(format!("Failed to scaffold {project_name} project"))?; let project_path = main_dir.join(project_name); @@ -201,7 +201,7 @@ impl ExampleCommand { ..Default::default() }; - cargo_generate::generate(generate_args) + generate(generate_args) .context(format!("Failed to scaffold {project_name} project"))?; let project_path = main_dir.join(project_name); diff --git a/tools/cargo-miden/src/commands/new_project.rs b/tools/cargo-miden/src/commands/new_project.rs index be1393983..bb6eeca69 100644 --- a/tools/cargo-miden/src/commands/new_project.rs +++ b/tools/cargo-miden/src/commands/new_project.rs @@ -4,7 +4,7 @@ use std::{ }; use anyhow::Context; -use cargo_generate::{GenerateArgs, TemplatePath}; +use crate::template::{generate, GenerateArgs, TemplatePath}; use clap::Args; /// The tag used in checkout of the new project template. @@ -134,7 +134,6 @@ pub struct NewCommand { #[clap(long, hide(true))] pub compiler_branch: Option, } - use crate::utils::set_default_test_compiler; impl NewCommand { @@ -235,7 +234,7 @@ impl NewCommand { define, ..Default::default() }; - let _project_path = cargo_generate::generate(generate_args) + let _project_path = generate(generate_args) .context("Failed to scaffold new Miden project from the template")?; Ok(self.path) diff --git a/tools/cargo-miden/src/lib.rs b/tools/cargo-miden/src/lib.rs index 70f48e5dc..608a4d7e2 100644 --- a/tools/cargo-miden/src/lib.rs +++ b/tools/cargo-miden/src/lib.rs @@ -12,6 +12,7 @@ mod compile_masm; mod config; mod dependencies; mod outputs; +mod template; mod target; mod utils; diff --git a/tools/cargo-miden/src/template.rs b/tools/cargo-miden/src/template.rs new file mode 100644 index 000000000..cbc5ad6aa --- /dev/null +++ b/tools/cargo-miden/src/template.rs @@ -0,0 +1,580 @@ +use std::{ + ffi::OsStr, + fs, + path::{Path, PathBuf}, + process::{Command, Stdio}, +}; + +use anyhow::{bail, Context, Result}; +use liquid::{model::Value, Object, Parser}; +use tempfile::TempDir; +use toml_edit::DocumentMut; +use walkdir::WalkDir; + +/// Describes the source template location. +#[derive(Clone, Debug, Default)] +pub struct TemplatePath { + /// Local filesystem path containing the template. + pub path: Option, + /// Remote git repository hosting the template. + pub git: Option, + /// Git branch to checkout after cloning. + pub branch: Option, + /// Git tag to checkout after cloning. + pub tag: Option, + /// Git revision (commit SHA) to checkout after cloning. + pub rev: Option, + /// Subdirectory inside the template repository that contains the actual template. + pub auto_path: Option, +} + +/// Arguments required to expand a template into a project. +#[derive(Clone, Debug, Default)] +pub struct GenerateArgs { + pub template_path: TemplatePath, + pub destination: Option, + pub name: Option, + pub force: bool, + pub force_git_init: bool, + pub verbose: bool, + pub define: Vec, +} + +/// Expands a project template into the requested destination directory. +pub fn generate(args: GenerateArgs) -> Result { + let project_name = args + .name + .clone() + .context("A project name must be provided to generate a template")?; + + let template_source = prepare_template(&args.template_path)?; + let mut source_root = match &args.template_path.auto_path { + Some(auto_path) => template_source.root.join(auto_path), + None => template_source.root.clone(), + }; + + if !source_root.exists() { + bail!( + "Template directory '{}' does not exist", + source_root.display() + ); + } + + if source_root.join("template").is_dir() { + source_root = source_root.join("template"); + } + + let config = load_template_config(&source_root)?; + + let destination_root = args + .destination + .clone() + .unwrap_or_else(|| std::env::current_dir().expect("current directory is accessible")); + fs::create_dir_all(&destination_root).with_context(|| { + format!( + "Failed to create destination directory '{}'", + destination_root.display() + ) + })?; + + let project_dir = destination_root.join(&project_name); + prepare_destination(&project_dir, args.force)?; + + let crate_name = sanitize_crate_name(&project_name); + let mut variables = build_variable_map(crate_name, &args.define)?; + // Expose the original project name as well. + variables.insert("project_name".into(), Value::scalar(project_name.clone())); + variables.insert("project-name".into(), Value::scalar(project_name.clone())); + + let parser = liquid::ParserBuilder::with_stdlib() + .build() + .context("Failed to initialise Liquid template parser")?; + + render_template(&source_root, &project_dir, &parser, &variables, &config)?; + + if args.force_git_init { + initialise_git_repo(&project_dir)?; + } + + if args.verbose { + log::info!( + "Generated project '{}' in '{}'", + project_name, + project_dir.display() + ); + } + + println!("Created project {}", project_dir.display()); + + Ok(project_dir) +} + +struct TemplateSource { + root: PathBuf, + _keepalive: Option, +} + +fn prepare_template(template_path: &TemplatePath) -> Result { + if let Some(path) = template_path.path.as_ref() { + let root = PathBuf::from(path); + return Ok(TemplateSource { + root, + _keepalive: None, + }); + } + + let repo = template_path + .git + .as_ref() + .context("Template source must specify either `path` or `git`")?; + let temp_dir = TempDir::new().context("Failed to create temporary directory for template")?; + + clone_repository(repo, template_path, temp_dir.path())?; + + Ok(TemplateSource { + root: temp_dir.path().to_path_buf(), + _keepalive: Some(temp_dir), + }) +} + +fn clone_repository(repo: &str, template_path: &TemplatePath, destination: &Path) -> Result<()> { + let mut command = Command::new("git"); + command.arg("clone").arg("--depth").arg("1").arg("--quiet"); + + if let Some(branch) = template_path.branch.as_ref() { + command.arg("--branch").arg(branch); + } else if let Some(tag) = template_path.tag.as_ref() { + command.arg("--branch").arg(tag); + } + + command.arg(repo).arg(destination); + + let status = command + .stdout(Stdio::null()) + .stderr(Stdio::null()) + .status() + .with_context(|| format!("Failed to clone template repository '{repo}'"))?; + if !status.success() { + bail!("`git clone {repo}` exited with {}", status); + } + + if let Some(rev) = template_path.rev.as_ref() { + let status = Command::new("git") + .arg("checkout") + .arg("--quiet") + .arg(rev) + .current_dir(destination) + .stdout(Stdio::null()) + .stderr(Stdio::null()) + .status() + .with_context(|| format!("Failed to checkout revision '{rev}'"))?; + + if !status.success() { + bail!("`git checkout {rev}` exited with {}", status); + } + } + + Ok(()) +} + +fn prepare_destination(project_dir: &Path, force: bool) -> Result<()> { + if project_dir.exists() { + if !project_dir.is_dir() { + bail!( + "Destination '{}' exists and is not a directory", + project_dir.display() + ); + } + + if !force && !is_empty_directory(project_dir)? { + bail!( + "Destination '{}' already exists. Use --force to overwrite.", + project_dir.display() + ); + } + } else { + fs::create_dir_all(project_dir).with_context(|| { + format!( + "Failed to create project directory '{}'", + project_dir.display() + ) + })?; + } + + Ok(()) +} + +fn is_empty_directory(path: &Path) -> Result { + let mut entries = fs::read_dir(path) + .with_context(|| format!("Failed to read destination directory '{}'", path.display()))?; + Ok(entries.next().is_none()) +} + +fn build_variable_map(crate_name: String, define: &[String]) -> Result { + let mut variables = Object::new(); + variables.insert("crate_name".into(), Value::scalar(crate_name)); + + for define_arg in define { + let (key, value) = parse_define(define_arg)?; + variables.insert(key.into(), Value::scalar(value)); + } + + Ok(variables) +} + +fn parse_define(input: &str) -> Result<(String, String)> { + let mut parts = input.splitn(2, '='); + let key = parts + .next() + .context("Invalid define argument: missing key")? + .trim(); + if key.is_empty() { + bail!("Invalid define argument: key must not be empty"); + } + let value = parts + .next() + .context("Invalid define argument: missing value")?; + Ok((key.to_string(), value.to_string())) +} + +fn render_template( + source_root: &Path, + destination: &Path, + parser: &Parser, + variables: &Object, + config: &TemplateConfig, +) -> Result<()> { + for entry in WalkDir::new(source_root) { + let entry = match entry { + Ok(entry) => entry, + Err(err) => { + log::warn!("Skipping template entry due to error: {err}"); + continue; + } + }; + + let relative = match entry.path().strip_prefix(source_root) { + Ok(relative) if relative.as_os_str().is_empty() => continue, + Ok(relative) => relative, + Err(_) => continue, + }; + + if should_ignore(relative, config) { + continue; + } + + if relative.file_name() == Some(OsStr::new("cargo-generate.toml")) { + continue; + } + + if relative + .components() + .any(|component| component.as_os_str() == OsStr::new(".git")) + { + continue; + } + + let target_path = destination.join(relative); + + if entry.file_type().is_dir() { + fs::create_dir_all(&target_path).with_context(|| { + format!("Failed to create directory '{}'", target_path.display()) + })?; + continue; + } + + render_file(entry.path(), &target_path, parser, variables)?; + } + + Ok(()) +} + +fn render_file(source: &Path, destination: &Path, parser: &Parser, variables: &Object) -> Result<()> { + let bytes = fs::read(source).with_context(|| { + format!( + "Failed to read template file '{}'", + source.display() + ) + })?; + + match std::str::from_utf8(&bytes) { + Ok(content) => { + let template = parser + .parse(content) + .with_context(|| format!("Failed to parse template '{}'", source.display()))?; + let rendered = template.render(variables).with_context(|| { + format!( + "Failed to render template '{}'", + source.display() + ) + })?; + fs::write(destination, rendered).with_context(|| { + format!( + "Failed to write rendered file '{}'", + destination.display() + ) + })?; + } + Err(_) => { + // Binary data - copy verbatim. + fs::write(destination, &bytes).with_context(|| { + format!( + "Failed to write binary file '{}'", + destination.display() + ) + })?; + } + } + + // Preserve executable bit when present. + let metadata = fs::metadata(source)?; + fs::set_permissions(destination, metadata.permissions()).with_context(|| { + format!( + "Failed to set permissions on '{}'", + destination.display() + ) + })?; + + Ok(()) +} + +fn initialise_git_repo(project_dir: &Path) -> Result<()> { + let status = Command::new("git") + .arg("init") + .arg("--quiet") + .current_dir(project_dir) + .stdout(Stdio::null()) + .stderr(Stdio::null()) + .status() + .context("Failed to execute `git init`")?; + + if !status.success() { + bail!("`git init` exited with {}", status); + } + + Ok(()) +} + +#[derive(Default)] +struct TemplateConfig { + ignore: Vec, +} + +fn load_template_config(template_root: &Path) -> Result { + let mut config = TemplateConfig::default(); + let config_path = template_root.join("cargo-generate.toml"); + if !config_path.exists() { + return Ok(config); + } + + let contents = fs::read_to_string(&config_path).with_context(|| { + format!( + "Failed to read template configuration '{}'", + config_path.display() + ) + })?; + + let document: DocumentMut = contents + .parse() + .with_context(|| format!("Invalid template configuration '{}'", config_path.display()))?; + + if let Some(ignore) = document + .get("template") + .and_then(|item| item.as_table()) + .and_then(|table| table.get("ignore")) + .and_then(|item| item.as_array()) + { + for value in ignore { + if let Some(value) = value.as_str() { + config.ignore.push(value.to_string()); + } + } + } + + Ok(config) +} + +fn should_ignore(relative_path: &Path, config: &TemplateConfig) -> bool { + config.ignore.iter().any(|pattern| { + let pattern_path = Path::new(pattern); + relative_path.starts_with(pattern_path) + }) +} + +fn sanitize_crate_name(name: &str) -> String { + let mut result = String::with_capacity(name.len()); + for (idx, ch) in name.chars().enumerate() { + match ch { + 'a'..='z' | '0'..='9' => result.push(ch), + 'A'..='Z' => result.push(ch.to_ascii_lowercase()), + '-' | ' ' | '.' => { + if idx != 0 { + result.push('_'); + } else { + result.push('_'); + } + } + '_' => result.push('_'), + _ => result.push('_'), + } + } + if result.starts_with(|c: char| c.is_ascii_digit()) { + format!("_{result}") + } else if result.is_empty() { + "_".into() + } else { + result + } +} + +#[cfg(test)] +mod tests { + use super::*; + use anyhow::Result; + use std::fs; + use tempfile::tempdir; + + #[test] + fn crate_name_is_sanitized() { + assert_eq!(sanitize_crate_name("hello-world"), "hello_world"); + assert_eq!(sanitize_crate_name("HelloWorld"), "helloworld"); + assert_eq!(sanitize_crate_name("123abc"), "_123abc"); + assert_eq!(sanitize_crate_name("with spaces"), "with_spaces"); + assert_eq!(sanitize_crate_name("already_ok"), "already_ok"); + assert_eq!(sanitize_crate_name("@invalid!"), "_invalid_"); + } + + #[test] + fn generate_local_template_renders_all_variables() -> Result<()> { + let template_dir = tempdir()?; + let template_root = template_dir.path().join("template"); + fs::create_dir_all(&template_root)?; + + fs::write( + template_root.join("Cargo.toml"), + r#"# crate={{crate_name}} +name = "{{project_name}}" +package = "miden:{{project-name}}""#, + )?; + + let destination_dir = tempdir()?; + let args = GenerateArgs { + template_path: TemplatePath { + path: Some(template_dir.path().to_string_lossy().into_owned()), + ..Default::default() + }, + destination: Some(destination_dir.path().to_path_buf()), + name: Some("demo-project".into()), + force: true, + ..Default::default() + }; + + let project_dir = generate(args)?; + let rendered = fs::read_to_string(project_dir.join("Cargo.toml"))?; + + assert!(rendered.contains("crate=demo_project")); + assert!(rendered.contains("name = \"demo-project\"")); + assert!(rendered.contains("miden:demo-project")); + + Ok(()) + } + + #[test] + fn generate_supports_auto_path_and_template_subdir() -> Result<()> { + let repo_dir = tempdir()?; + let nested = repo_dir.path().join("nested").join("template"); + fs::create_dir_all(&nested)?; + fs::write(nested.join("README.md"), "{{project_name}}")?; + + let destination_dir = tempdir()?; + let args = GenerateArgs { + template_path: TemplatePath { + path: Some(repo_dir.path().to_string_lossy().into_owned()), + auto_path: Some("nested".into()), + ..Default::default() + }, + destination: Some(destination_dir.path().to_path_buf()), + name: Some("auto_case".into()), + force: true, + ..Default::default() + }; + + let project_dir = generate(args)?; + let rendered = fs::read_to_string(project_dir.join("README.md"))?; + assert!(rendered.contains("auto_case")); + + Ok(()) + } + + #[test] + fn generate_respects_cargo_generate_ignore_entries() -> Result<()> { + let template_dir = tempdir()?; + let template_root = template_dir.path().join("template"); + fs::create_dir_all(template_root.join("skip-me"))?; + fs::create_dir_all(template_root.join("keep-me"))?; + + fs::write( + template_root.join("cargo-generate.toml"), + r#"[template] +ignore = ["skip-me"] +"#, + )?; + + fs::write(template_root.join("keep-me").join("file.txt"), "keep")?; + + let destination_dir = tempdir()?; + let args = GenerateArgs { + template_path: TemplatePath { + path: Some(template_dir.path().to_string_lossy().into_owned()), + ..Default::default() + }, + destination: Some(destination_dir.path().to_path_buf()), + name: Some("ignore-check".into()), + force: true, + ..Default::default() + }; + + let project_dir = generate(args)?; + + assert!(project_dir.join("keep-me").join("file.txt").exists()); + assert!(!project_dir.join("skip-me").exists()); + + Ok(()) + } + + #[test] + fn generate_requires_force_for_non_empty_destination() -> Result<()> { + let template_dir = tempdir()?; + let template_root = template_dir.path().join("template"); + fs::create_dir_all(&template_root)?; + fs::write(template_root.join("file.txt"), "content")?; + + let destination_dir = tempdir()?; + let project_dir = destination_dir.path().join("existing"); + fs::create_dir_all(&project_dir)?; + fs::write(project_dir.join("keep.txt"), "keep")?; + + let args = GenerateArgs { + template_path: TemplatePath { + path: Some(template_dir.path().to_string_lossy().into_owned()), + ..Default::default() + }, + destination: Some(destination_dir.path().to_path_buf()), + name: Some("existing".into()), + force: false, + ..Default::default() + }; + + let err = generate(args).expect_err("expected failure without --force"); + assert!(err.to_string().contains("Use --force to overwrite")); + + Ok(()) + } + + #[test] + fn parse_define_rejects_invalid_inputs() { + assert!(parse_define("missing_value").is_err()); + assert!(parse_define("=value").is_err()); + assert!(parse_define("").is_err()); + } +} From df06b54d710c7fe2d5c76b34e5c3a1e5f26f787a Mon Sep 17 00:00:00 2001 From: Denys Zadorozhnyi Date: Tue, 11 Nov 2025 17:24:49 +0200 Subject: [PATCH 05/19] chore: clippy and formatting --- tools/cargo-miden/src/template.rs | 96 ++++++++++--------------------- 1 file changed, 29 insertions(+), 67 deletions(-) diff --git a/tools/cargo-miden/src/template.rs b/tools/cargo-miden/src/template.rs index cbc5ad6aa..55561ee41 100644 --- a/tools/cargo-miden/src/template.rs +++ b/tools/cargo-miden/src/template.rs @@ -54,10 +54,7 @@ pub fn generate(args: GenerateArgs) -> Result { }; if !source_root.exists() { - bail!( - "Template directory '{}' does not exist", - source_root.display() - ); + bail!("Template directory '{}' does not exist", source_root.display()); } if source_root.join("template").is_dir() { @@ -71,10 +68,7 @@ pub fn generate(args: GenerateArgs) -> Result { .clone() .unwrap_or_else(|| std::env::current_dir().expect("current directory is accessible")); fs::create_dir_all(&destination_root).with_context(|| { - format!( - "Failed to create destination directory '{}'", - destination_root.display() - ) + format!("Failed to create destination directory '{}'", destination_root.display()) })?; let project_dir = destination_root.join(&project_name); @@ -97,11 +91,7 @@ pub fn generate(args: GenerateArgs) -> Result { } if args.verbose { - log::info!( - "Generated project '{}' in '{}'", - project_name, - project_dir.display() - ); + log::info!("Generated project '{}' in '{}'", project_name, project_dir.display()); } println!("Created project {}", project_dir.display()); @@ -180,10 +170,7 @@ fn clone_repository(repo: &str, template_path: &TemplatePath, destination: &Path fn prepare_destination(project_dir: &Path, force: bool) -> Result<()> { if project_dir.exists() { if !project_dir.is_dir() { - bail!( - "Destination '{}' exists and is not a directory", - project_dir.display() - ); + bail!("Destination '{}' exists and is not a directory", project_dir.display()); } if !force && !is_empty_directory(project_dir)? { @@ -194,10 +181,7 @@ fn prepare_destination(project_dir: &Path, force: bool) -> Result<()> { } } else { fs::create_dir_all(project_dir).with_context(|| { - format!( - "Failed to create project directory '{}'", - project_dir.display() - ) + format!("Failed to create project directory '{}'", project_dir.display()) })?; } @@ -224,16 +208,11 @@ fn build_variable_map(crate_name: String, define: &[String]) -> Result { fn parse_define(input: &str) -> Result<(String, String)> { let mut parts = input.splitn(2, '='); - let key = parts - .next() - .context("Invalid define argument: missing key")? - .trim(); + let key = parts.next().context("Invalid define argument: missing key")?.trim(); if key.is_empty() { bail!("Invalid define argument: key must not be empty"); } - let value = parts - .next() - .context("Invalid define argument: missing value")?; + let value = parts.next().context("Invalid define argument: missing value")?; Ok((key.to_string(), value.to_string())) } @@ -289,51 +268,39 @@ fn render_template( Ok(()) } -fn render_file(source: &Path, destination: &Path, parser: &Parser, variables: &Object) -> Result<()> { - let bytes = fs::read(source).with_context(|| { - format!( - "Failed to read template file '{}'", - source.display() - ) - })?; +fn render_file( + source: &Path, + destination: &Path, + parser: &Parser, + variables: &Object, +) -> Result<()> { + let bytes = fs::read(source) + .with_context(|| format!("Failed to read template file '{}'", source.display()))?; match std::str::from_utf8(&bytes) { Ok(content) => { let template = parser .parse(content) .with_context(|| format!("Failed to parse template '{}'", source.display()))?; - let rendered = template.render(variables).with_context(|| { - format!( - "Failed to render template '{}'", - source.display() - ) - })?; + let rendered = template + .render(variables) + .with_context(|| format!("Failed to render template '{}'", source.display()))?; fs::write(destination, rendered).with_context(|| { - format!( - "Failed to write rendered file '{}'", - destination.display() - ) + format!("Failed to write rendered file '{}'", destination.display()) })?; } Err(_) => { // Binary data - copy verbatim. fs::write(destination, &bytes).with_context(|| { - format!( - "Failed to write binary file '{}'", - destination.display() - ) + format!("Failed to write binary file '{}'", destination.display()) })?; } } // Preserve executable bit when present. let metadata = fs::metadata(source)?; - fs::set_permissions(destination, metadata.permissions()).with_context(|| { - format!( - "Failed to set permissions on '{}'", - destination.display() - ) - })?; + fs::set_permissions(destination, metadata.permissions()) + .with_context(|| format!("Failed to set permissions on '{}'", destination.display()))?; Ok(()) } @@ -368,10 +335,7 @@ fn load_template_config(template_root: &Path) -> Result { } let contents = fs::read_to_string(&config_path).with_context(|| { - format!( - "Failed to read template configuration '{}'", - config_path.display() - ) + format!("Failed to read template configuration '{}'", config_path.display()) })?; let document: DocumentMut = contents @@ -403,16 +367,12 @@ fn should_ignore(relative_path: &Path, config: &TemplateConfig) -> bool { fn sanitize_crate_name(name: &str) -> String { let mut result = String::with_capacity(name.len()); - for (idx, ch) in name.chars().enumerate() { + for ch in name.chars() { match ch { 'a'..='z' | '0'..='9' => result.push(ch), 'A'..='Z' => result.push(ch.to_ascii_lowercase()), '-' | ' ' | '.' => { - if idx != 0 { - result.push('_'); - } else { - result.push('_'); - } + result.push('_'); } '_' => result.push('_'), _ => result.push('_'), @@ -429,11 +389,13 @@ fn sanitize_crate_name(name: &str) -> String { #[cfg(test)] mod tests { - use super::*; - use anyhow::Result; use std::fs; + + use anyhow::Result; use tempfile::tempdir; + use super::*; + #[test] fn crate_name_is_sanitized() { assert_eq!(sanitize_crate_name("hello-world"), "hello_world"); From 84aa1ed3a577a3cafcbb59582553973f04b5867e Mon Sep 17 00:00:00 2001 From: Denys Zadorozhnyi Date: Tue, 11 Nov 2025 17:36:50 +0200 Subject: [PATCH 06/19] chore: more formatting and clippy --- tools/cargo-miden/src/commands/example_project.rs | 6 ++++-- tools/cargo-miden/src/commands/new_project.rs | 4 ++-- tools/cargo-miden/src/lib.rs | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/tools/cargo-miden/src/commands/example_project.rs b/tools/cargo-miden/src/commands/example_project.rs index 8a3370673..0de09fb94 100644 --- a/tools/cargo-miden/src/commands/example_project.rs +++ b/tools/cargo-miden/src/commands/example_project.rs @@ -1,11 +1,13 @@ use std::path::{Path, PathBuf}; use anyhow::Context; -use crate::template::{generate, GenerateArgs, TemplatePath}; use clap::Args; use toml_edit::{DocumentMut, Item}; -use crate::utils::compiler_path; +use crate::{ + template::{generate, GenerateArgs, TemplatePath}, + utils::compiler_path, +}; /// Paired project mappings for examples that create multiple related projects const PAIRED_PROJECTS: &[(&str, &str)] = &[("counter-contract", "counter-note")]; diff --git a/tools/cargo-miden/src/commands/new_project.rs b/tools/cargo-miden/src/commands/new_project.rs index bb6eeca69..2d1fa4434 100644 --- a/tools/cargo-miden/src/commands/new_project.rs +++ b/tools/cargo-miden/src/commands/new_project.rs @@ -4,9 +4,10 @@ use std::{ }; use anyhow::Context; -use crate::template::{generate, GenerateArgs, TemplatePath}; use clap::Args; +use crate::template::{generate, GenerateArgs, TemplatePath}; + /// The tag used in checkout of the new project template. /// /// Before changing it make sure the new tag exists in the rust-templates repo and points to the @@ -232,7 +233,6 @@ impl NewCommand { force_git_init: should_git_init, verbose: true, define, - ..Default::default() }; let _project_path = generate(generate_args) .context("Failed to scaffold new Miden project from the template")?; diff --git a/tools/cargo-miden/src/lib.rs b/tools/cargo-miden/src/lib.rs index 608a4d7e2..a89ea083f 100644 --- a/tools/cargo-miden/src/lib.rs +++ b/tools/cargo-miden/src/lib.rs @@ -12,8 +12,8 @@ mod compile_masm; mod config; mod dependencies; mod outputs; -mod template; mod target; +mod template; mod utils; pub use outputs::{BuildOutput, CommandOutput}; From e058d018b13eedc1e86127f76f691b75e176b11c Mon Sep 17 00:00:00 2001 From: Denys Zadorozhnyi Date: Tue, 11 Nov 2025 18:19:00 +0200 Subject: [PATCH 07/19] refactor: add `--single-branch` when cloning a template git repo --- tools/cargo-miden/src/template.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tools/cargo-miden/src/template.rs b/tools/cargo-miden/src/template.rs index 55561ee41..3e89429e5 100644 --- a/tools/cargo-miden/src/template.rs +++ b/tools/cargo-miden/src/template.rs @@ -129,7 +129,12 @@ fn prepare_template(template_path: &TemplatePath) -> Result { fn clone_repository(repo: &str, template_path: &TemplatePath, destination: &Path) -> Result<()> { let mut command = Command::new("git"); - command.arg("clone").arg("--depth").arg("1").arg("--quiet"); + command + .arg("clone") + .arg("--single-branch") + .arg("--depth") + .arg("1") + .arg("--quiet"); if let Some(branch) = template_path.branch.as_ref() { command.arg("--branch").arg(branch); From 2260859168681217ce0ffaada1f7ef45a252a551 Mon Sep 17 00:00:00 2001 From: Denys Zadorozhnyi Date: Tue, 11 Nov 2025 18:41:40 +0200 Subject: [PATCH 08/19] chore: run local network tests sequentially --- .github/workflows/ci.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7afe11229..1c0ab962d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -226,7 +226,9 @@ jobs: fi - name: Test run: | - cargo make test -E 'package(miden-integration-node-tests)' + # Run sequentially as a workaround until + # https://github.com/0xMiden/compiler/issues/766 is resolved + cargo make test -E 'package(miden-integration-node-tests)' --test-threads 1 cargo_publish_dry_run: name: cargo publish dry run From a43e55478a14ff7adac4f4c40c0285182647bc29 Mon Sep 17 00:00:00 2001 From: Denys Zadorozhnyi Date: Tue, 11 Nov 2025 18:44:17 +0200 Subject: [PATCH 09/19] chore: run `cargo update` --- Cargo.lock | 952 +++++++++++++++++++++++++++-------------------------- 1 file changed, 490 insertions(+), 462 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 744c7ccfd..5a1642885 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -20,14 +20,23 @@ checksum = "dfbe277e56a376000877090da837660b4427aad530e3028d44e0bffe4f89a1c1" dependencies = [ "cpp_demangle", "fallible-iterator", - "gimli", + "gimli 0.31.1", "memmap2", - "object", + "object 0.36.7", "rustc-demangle", "smallvec", "typed-arena", ] +[[package]] +name = "addr2line" +version = "0.25.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b5d307320b3181d6d7954e663bd7c774a838b8220fe0593c86d9fb09f498b4b" +dependencies = [ + "gimli 0.32.3", +] + [[package]] name = "adler2" version = "2.0.1" @@ -58,9 +67,9 @@ dependencies = [ [[package]] name = "aho-corasick" -version = "1.1.3" +version = "1.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" +checksum = "ddd31a130427c27518df266943a5308ed92d4b226cc639f5a8f1002816174301" dependencies = [ "memchr", ] @@ -71,12 +80,6 @@ version = "0.2.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" -[[package]] -name = "android-tzdata" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" - [[package]] name = "android_system_properties" version = "0.1.5" @@ -94,9 +97,9 @@ checksum = "4b46cbb362ab8752921c97e041f5e366ee6297bd428a31275b9fcf1e380f7299" [[package]] name = "anstream" -version = "0.6.19" +version = "0.6.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "301af1932e46185686725e0fad2f8f2aa7da69dd70bf6ecc44d6b703844a3933" +checksum = "43d5b281e737544384e969a5ccad3f1cdd24b48086a0fc1b2a5262a26b8f4f4a" dependencies = [ "anstyle", "anstyle-parse", @@ -109,9 +112,9 @@ dependencies = [ [[package]] name = "anstyle" -version = "1.0.11" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "862ed96ca487e809f1c8e5a8447f6ee2cf102f846893800b20cebdf541fc6bbd" +checksum = "5192cca8006f1fd4f7237516f40fa183bb07f8fbdfedaa0036de5ea9b0b45e78" [[package]] name = "anstyle-parse" @@ -124,29 +127,29 @@ dependencies = [ [[package]] name = "anstyle-query" -version = "1.1.3" +version = "1.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c8bdeb6047d8983be085bab0ba1472e6dc604e7041dbf6fcd5e71523014fae9" +checksum = "9e231f6134f61b71076a3eab506c379d4f36122f2af15a9ff04415ea4c3339e2" dependencies = [ - "windows-sys 0.59.0", + "windows-sys 0.60.2", ] [[package]] name = "anstyle-wincon" -version = "3.0.9" +version = "3.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "403f75924867bb1033c59fbf0797484329750cfbe3c4325cd33127941fabc882" +checksum = "3e0633414522a32ffaac8ac6cc8f748e090c5717661fddeea04219e2344f5f2a" dependencies = [ "anstyle", "once_cell_polyfill", - "windows-sys 0.59.0", + "windows-sys 0.60.2", ] [[package]] name = "anyhow" -version = "1.0.98" +version = "1.0.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e16d2d3311acee920a9eb8d33b8cbc1787ce4a264e85f964c2404b969bdcd487" +checksum = "a23eb6b1614318a8071c9b2521f36b424b2c83db5eb3a0fead4a6c0809af6e61" [[package]] name = "anymap2" @@ -177,9 +180,9 @@ dependencies = [ [[package]] name = "async-trait" -version = "0.1.88" +version = "0.1.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e539d3fca749fcee5236ab05e93a52867dd549cc157c8cb7f99595f3cedffdb5" +checksum = "9035ad2d096bed7955a320ee7e2230574d28fd3c3a0f186cbea1ff3c7eed5dbb" dependencies = [ "proc-macro2", "quote", @@ -200,17 +203,17 @@ checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" [[package]] name = "backtrace" -version = "0.3.75" +version = "0.3.76" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6806a6321ec58106fea15becdad98371e28d92ccbc7c8f1b3b6dd724fe8f1002" +checksum = "bb531853791a215d7c62a30daf0dde835f381ab5de4589cfe7c649d2cbe92bd6" dependencies = [ - "addr2line", + "addr2line 0.25.1", "cfg-if", "libc", "miniz_oxide", - "object", + "object 0.37.3", "rustc-demangle", - "windows-targets 0.52.6", + "windows-link 0.2.1", ] [[package]] @@ -278,15 +281,9 @@ checksum = "5e764a1d40d510daf35e07be9eb06e75770908c27d411ee6c92109c9840eaaf7" [[package]] name = "bitflags" -version = "1.3.2" +version = "2.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" - -[[package]] -name = "bitflags" -version = "2.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b8e56985ec62d17e9c1001dc89c88ecd7dc08e47eba5ec7c29c7b5eeecde967" +checksum = "812e12b5285cc515a9c72a5c1d3b6d46a19dac5acfef5265968c166106e31dd3" [[package]] name = "bitvec" @@ -333,9 +330,9 @@ dependencies = [ [[package]] name = "bstr" -version = "1.12.0" +version = "1.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "234113d19d0d7d613b40e86fb654acf958910802bcceab913a4f9e7cda03b1a4" +checksum = "63044e1ae8e69f3b5a92c736ca6269b8d12fa7efe39bf34ddb06d102cf0e2cab" dependencies = [ "memchr", "serde", @@ -361,11 +358,11 @@ checksum = "d71b6127be86fdcfddb610f7182ac57211d4b18a3e9c82eb2d17662f2227ad6a" [[package]] name = "camino" -version = "1.1.10" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0da45bc31171d8d6960122e222a67740df867c1dd53b4d51caa297084c185cab" +checksum = "276a59bf2b2c967788139340c9f0c5b12d7fd6630315c15c217e559de85d2609" dependencies = [ - "serde", + "serde_core", ] [[package]] @@ -383,11 +380,11 @@ dependencies = [ "midenc-session", "parse_arg 0.1.6", "path-absolutize", - "semver 1.0.26", + "semver 1.0.27", "serde", "serde_json", "tempfile", - "toml_edit 0.23.4", + "toml_edit 0.23.7", "walkdir", ] @@ -402,9 +399,9 @@ dependencies = [ [[package]] name = "cargo-util" -version = "0.2.21" +version = "0.2.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c95ec8b2485b20aed818bd7460f8eecc6c87c35c84191b353a3aba9aa1736c36" +checksum = "f97c9ef0f8af69bfcecfe4c17a414d7bb978fe794bc1a38952e27b5c5d87492d" dependencies = [ "anyhow", "core-foundation", @@ -420,7 +417,7 @@ dependencies = [ "tempfile", "tracing", "walkdir", - "windows-sys 0.59.0", + "windows-sys 0.60.2", ] [[package]] @@ -431,10 +428,10 @@ checksum = "dd5eb614ed4c27c5d706420e4320fbe3216ab31fa1c33cd8246ac36dae4479ba" dependencies = [ "camino", "cargo-platform", - "semver 1.0.26", + "semver 1.0.27", "serde", "serde_json", - "thiserror 2.0.12", + "thiserror 2.0.17", ] [[package]] @@ -460,10 +457,11 @@ dependencies = [ [[package]] name = "cc" -version = "1.2.30" +version = "1.2.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "deec109607ca693028562ed836a5f1c4b8bd77755c4e132fc5ce11b0b6211ae7" +checksum = "35900b6c8d709fb1d854671ae27aeaa9eec2f8b01b364e1619a40da3e6fe2afe" dependencies = [ + "find-msvc-tools", "jobserver", "libc", "shlex", @@ -471,9 +469,9 @@ dependencies = [ [[package]] name = "cfg-if" -version = "1.0.1" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9555578bc9e57714c812a1f84e4fc5b4d21fcb063490c624de019f7464c91268" +checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" [[package]] name = "chacha20" @@ -501,16 +499,15 @@ dependencies = [ [[package]] name = "chrono" -version = "0.4.41" +version = "0.4.42" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c469d952047f47f91b68d1cba3f10d63c11d73e4636f24f08daf0278abf01c4d" +checksum = "145052bdd345b87320e369255277e3fb5152762ad123a901ef5c262dd38fe8d2" dependencies = [ - "android-tzdata", "iana-time-zone", "js-sys", "num-traits", "wasm-bindgen", - "windows-link 0.1.3", + "windows-link 0.2.1", ] [[package]] @@ -553,9 +550,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.41" +version = "4.5.51" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be92d32e80243a54711e5d7ce823c35c41c9d929dc4ab58e1276f625841aadf9" +checksum = "4c26d721170e0295f191a69bd9a1f93efcdb0aff38684b61ab5750468972e5f5" dependencies = [ "clap_builder", "clap_derive", @@ -563,9 +560,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.41" +version = "4.5.51" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "707eab41e9622f9139419d573eca0900137718000c517d47da73045f54331c3d" +checksum = "75835f0c7bf681bfd05abe44e965760fea999a5286c6eb2d59883634fd02011a" dependencies = [ "anstream", "anstyle", @@ -575,9 +572,9 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.5.41" +version = "4.5.49" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef4f52386a59ca4c860f7393bcf8abd8dfd91ecccc0f774635ff68e92eeef491" +checksum = "2a0b5487afeab2deb2ff4e03a807ad1a03ac532ff5a2cee5d86884440c7f7671" dependencies = [ "heck", "proc-macro2", @@ -587,9 +584,9 @@ dependencies = [ [[package]] name = "clap_lex" -version = "0.7.5" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b94f61472cee1439c0b966b47e3aca9ae07e45d070759512cd390ea2bebc6675" +checksum = "a1d728cc89cf3aee9ff92b05e62b19ee65a02b5702cff7d5a377e32c6ae29d8d" [[package]] name = "colorchoice" @@ -665,9 +662,9 @@ checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" [[package]] name = "cpp_demangle" -version = "0.4.4" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96e58d342ad113c2b878f16d5d034c03be492ae460cdbc02b7f0f2284d310c7d" +checksum = "f2bb79cb74d735044c972aae58ed0aaa9a837e85b01106a54c39e42e97f62253" dependencies = [ "cfg-if", ] @@ -772,7 +769,7 @@ version = "0.28.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "829d955a0bb380ef178a640b91779e3987da38c9aea133b20614cfed8cdea9c6" dependencies = [ - "bitflags 2.9.1", + "bitflags", "crossterm_winapi", "futures-core", "mio", @@ -925,9 +922,9 @@ dependencies = [ [[package]] name = "deranged" -version = "0.4.0" +version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c9e6a11ca8224451684bc0d7d5a7adbf8f2fd6887261a1cfc3c0432f9d4068e" +checksum = "ececcb659e7ba858fb4f10388c250a7252eb0a27373f1a72b8748afdd248e587" dependencies = [ "powerfmt", ] @@ -1063,9 +1060,9 @@ dependencies = [ [[package]] name = "env_filter" -version = "0.1.3" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "186e05a59d4c50738528153b83b0b0194d3a29507dfec16eccd4b342903397d0" +checksum = "1bf3c259d255ca70051b30e2e95b5446cdb8949ac4cd22c0d7fd634d89f568e2" dependencies = [ "log", "regex", @@ -1092,12 +1089,12 @@ checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" [[package]] name = "errno" -version = "0.3.13" +version = "0.3.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "778e2ac28f6c47af28e4907f13ffd1e1ddbd400980a9abd7c8df189bf578a5ad" +checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" dependencies = [ "libc", - "windows-sys 0.60.2", + "windows-sys 0.61.2", ] [[package]] @@ -1136,16 +1133,22 @@ checksum = "28dea519a9695b9977216879a3ebfddf92f1c08c05d984f8996aecd6ecdc811d" [[package]] name = "filetime" -version = "0.2.25" +version = "0.2.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35c0522e981e68cbfa8c3f978441a5f34b30b96e146b33cd3359176b50fe8586" +checksum = "bc0505cd1b6fa6580283f6bdf70a73fcf4aba1184038c90902b92b3dd0df63ed" dependencies = [ "cfg-if", "libc", "libredox", - "windows-sys 0.59.0", + "windows-sys 0.60.2", ] +[[package]] +name = "find-msvc-tools" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52051878f80a721bb68ebfbc930e07b65ba72f2da88968ea5c06fd6ca3d3a127" + [[package]] name = "fixedbitset" version = "0.5.7" @@ -1154,9 +1157,9 @@ checksum = "1d674e81391d1e1ab681a28d99df07927c6d4aa5b027d7da16ba32d1d21ecd99" [[package]] name = "flate2" -version = "1.1.2" +version = "1.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a3d7db9596fecd151c5f638c0ee5d5bd487b6e0ea232e5dc96d5250f6f94b1d" +checksum = "bfe33edd8e85a12a67454e37f8c75e730830d83e313556ab9ebf9ee7fbeb3bfb" dependencies = [ "crc32fast", "miniz_oxide", @@ -1194,9 +1197,9 @@ checksum = "77ce24cb58228fbb8aa041425bb1050850ac19177686ea6e0f41a70416f56fdb" [[package]] name = "fs-err" -version = "3.1.1" +version = "3.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88d7be93788013f265201256d58f04936a8079ad5dc898743aa20525f503b683" +checksum = "6ad492b2cf1d89d568a43508ab24f98501fe03f2f31c01e1d0fe7366a71745d2" dependencies = [ "autocfg", ] @@ -1308,9 +1311,9 @@ dependencies = [ [[package]] name = "generator" -version = "0.8.5" +version = "0.8.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d18470a76cb7f8ff746cf1f7470914f900252ec36bbc40b569d74b1258446827" +checksum = "605183a538e3e2a9c1038635cc5c2d194e2ee8fd0d1b66b8349fad7dbacce5a2" dependencies = [ "cc", "cfg-if", @@ -1322,9 +1325,9 @@ dependencies = [ [[package]] name = "generic-array" -version = "0.14.7" +version = "0.14.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +checksum = "4bb6743198531e02858aeaea5398fcc883e71851fcbcb5a2f773e2fb6cb1edf2" dependencies = [ "typenum", "version_check", @@ -1340,21 +1343,21 @@ dependencies = [ "cfg-if", "js-sys", "libc", - "wasi 0.11.1+wasi-snapshot-preview1", + "wasi", "wasm-bindgen", ] [[package]] name = "getrandom" -version = "0.3.3" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26145e563e54f2cadc477553f1ec5ee650b00862f0a58bcd12cbdc5f0ea2d2f4" +checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd" dependencies = [ "cfg-if", "js-sys", "libc", "r-efi", - "wasi 0.14.2+wasi-0.2.4", + "wasip2", "wasm-bindgen", ] @@ -1368,17 +1371,23 @@ dependencies = [ "stable_deref_trait", ] +[[package]] +name = "gimli" +version = "0.32.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e629b9b98ef3dd8afe6ca2bd0f89306cec16d43d907889945bc5d6687f2f13c7" + [[package]] name = "glob" -version = "0.3.2" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8d1add55171497b4705a648c6b583acafb01d58050a51727785f0b2c8e0a2b2" +checksum = "0cc23270f6e1808e30a928bdc84dea0b9b4136a8bc82338574f23baf47bbd280" [[package]] name = "globset" -version = "0.4.16" +version = "0.4.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54a1028dfc5f5df5da8a56a73e6c153c9a9708ec57232470703592a3f18e49f5" +checksum = "52dfc19153a48bde0cbd630453615c8151bce3a5adfac7a0aebfbf0a1e1f57e3" dependencies = [ "aho-corasick", "bstr", @@ -1400,9 +1409,9 @@ dependencies = [ [[package]] name = "h2" -version = "0.4.11" +version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17da50a276f1e01e0ba6c029e47b7100754904ee8a278f886546e98575380785" +checksum = "f3c0b69cfcb4e1b9f1bf2f53f95f766e4661169728ec61cd3fe5a0166f2d1386" dependencies = [ "atomic-waker", "bytes", @@ -1419,12 +1428,13 @@ dependencies = [ [[package]] name = "half" -version = "2.6.0" +version = "2.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "459196ed295495a68f7d7fe1d84f6c4b7ff0e21fe3017b2f283c6fac3ad803c9" +checksum = "6ea2d84b969582b4b1864a92dc5d27cd2b77b622a8d79306834f1be5ba20d84b" dependencies = [ "cfg-if", "crunchy", + "zerocopy", ] [[package]] @@ -1439,9 +1449,9 @@ dependencies = [ [[package]] name = "hashbrown" -version = "0.15.4" +version = "0.15.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5971ac85611da7067dbfcabef3c70ebb5606018acd9e2a3903a0da507521e0d5" +checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1" dependencies = [ "allocator-api2", "equivalent", @@ -1467,7 +1477,7 @@ version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7382cf6263419f2d8df38c55d7da83da5c18aef87fc7a7fc1fb1e344edfe14c1" dependencies = [ - "hashbrown 0.15.4", + "hashbrown 0.15.5", ] [[package]] @@ -1554,9 +1564,9 @@ checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" [[package]] name = "human-panic" -version = "2.0.3" +version = "2.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac63a746b187e95d51fe16850eb04d1cfef203f6af98e6c405a6f262ad3df00a" +checksum = "9a8a07a0957cd4a3cad4a1e4ca7cd5ea07fcacef6ebe2e5d0c7935bfc95120d8" dependencies = [ "anstream", "anstyle", @@ -1570,13 +1580,14 @@ dependencies = [ [[package]] name = "hyper" -version = "1.6.0" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc2b571658e38e0c01b1fdca3bbbe93c00d3d71693ff2770043f8c29bc7d6f80" +checksum = "1744436df46f0bde35af3eda22aeaba453aada65d8f1c171cd8a5f59030bd69f" dependencies = [ + "atomic-waker", "bytes", "futures-channel", - "futures-util", + "futures-core", "h2", "http", "http-body", @@ -1584,6 +1595,7 @@ dependencies = [ "httpdate", "itoa", "pin-project-lite", + "pin-utils", "smallvec", "tokio", "want", @@ -1604,9 +1616,9 @@ dependencies = [ [[package]] name = "hyper-util" -version = "0.1.15" +version = "0.1.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f66d5bd4c6f02bf0542fad85d626775bab9258cf795a4256dcaf3161114d1df" +checksum = "3c6995591a8f1380fcb4ba966a252a4b29188d51d2b89e3a252f5305be65aea8" dependencies = [ "bytes", "futures-channel", @@ -1617,7 +1629,7 @@ dependencies = [ "hyper", "libc", "pin-project-lite", - "socket2 0.5.10", + "socket2", "tokio", "tower-service", "tracing", @@ -1625,9 +1637,9 @@ dependencies = [ [[package]] name = "iana-time-zone" -version = "0.1.63" +version = "0.1.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0c919e5debc312ad217002b8048a17b7d83f80703865bbfcfebb0458b0b27d8" +checksum = "33e57f83510bb73707521ebaffa789ec8caf86f9657cad665b092b581d40e9fb" dependencies = [ "android_system_properties", "core-foundation-sys", @@ -1635,7 +1647,7 @@ dependencies = [ "js-sys", "log", "wasm-bindgen", - "windows-core", + "windows-core 0.62.2", ] [[package]] @@ -1661,9 +1673,9 @@ checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" [[package]] name = "ignore" -version = "0.4.23" +version = "0.4.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d89fd380afde86567dfba715db065673989d6253f42b88179abd3eae47bda4b" +checksum = "d3d782a365a015e0f5c04902246139249abf769125006fbe7649e2ee88169b4a" dependencies = [ "crossbeam-deque", "globset", @@ -1677,9 +1689,9 @@ dependencies = [ [[package]] name = "indenter" -version = "0.3.3" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce23b50ad8242c51a442f3ff322d56b02f08852c77e4c0b4d3fd684abc89c683" +checksum = "964de6e86d545b246d84badc0fef527924ace5134f30641c203ef52ba83f58d5" [[package]] name = "indexmap" @@ -1695,9 +1707,12 @@ dependencies = [ [[package]] name = "indoc" -version = "2.0.6" +version = "2.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4c7245a08504955605670dbf141fceab975f15ca21570696aebe9d2e71576bd" +checksum = "79cf5c93f93228cf8efb3ba362535fb11199ac548a09ce117c9b1adc3030d706" +dependencies = [ + "rustversion", +] [[package]] name = "inout" @@ -1732,22 +1747,22 @@ dependencies = [ [[package]] name = "inventory" -version = "0.3.20" +version = "0.3.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab08d7cd2c5897f2c949e5383ea7c7db03fb19130ffcfbf7eda795137ae3cb83" +checksum = "bc61209c082fbeb19919bee74b176221b27223e27b65d781eb91af24eb1fb46e" dependencies = [ "rustversion", ] [[package]] name = "is-terminal" -version = "0.4.16" +version = "0.4.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e04d7f318608d35d4b61ddd75cbdaee86b023ebe2bd5a66ee0915f0bf93095a9" +checksum = "3640c1c38b8e4e43584d8df18be5fc6b0aa314ce6ebf51b53313d4306cca8e46" dependencies = [ "hermit-abi", "libc", - "windows-sys 0.59.0", + "windows-sys 0.61.2", ] [[package]] @@ -1758,9 +1773,9 @@ checksum = "7655c9839580ee829dfacba1d1278c2b7883e50a277ff7541299489d6bdfdc45" [[package]] name = "is_terminal_polyfill" -version = "1.70.1" +version = "1.70.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf" +checksum = "a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695" [[package]] name = "itertools" @@ -1797,22 +1812,22 @@ checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" [[package]] name = "jiff" -version = "0.2.15" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be1f93b8b1eb69c77f24bbb0afdf66f54b632ee39af40ca21c4365a1d7347e49" +checksum = "49cce2b81f2098e7e3efc35bc2e0a6b7abec9d34128283d7a26fa8f32a6dbb35" dependencies = [ "jiff-static", "log", "portable-atomic", "portable-atomic-util", - "serde", + "serde_core", ] [[package]] name = "jiff-static" -version = "0.2.15" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03343451ff899767262ec32146f6d559dd759fdadf42ff0e227c7c48f72594b4" +checksum = "980af8b43c3ad5d8d349ace167ec8170839f753a42d233ba19e08afe1850fa69" dependencies = [ "proc-macro2", "quote", @@ -1821,19 +1836,19 @@ dependencies = [ [[package]] name = "jobserver" -version = "0.1.33" +version = "0.1.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38f262f097c174adebe41eb73d66ae9c06b2844fb0da69969647bbddd9b0538a" +checksum = "9afb3de4395d6b3e67a780b6de64b51c978ecf11cb9a462c66be7d4ca9039d33" dependencies = [ - "getrandom 0.3.3", + "getrandom 0.3.4", "libc", ] [[package]] name = "js-sys" -version = "0.3.77" +version = "0.3.82" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1cfaf33c695fc6e08064efbc1f72ec937429614f25eef83af942d0e227c3a28f" +checksum = "b011eec8cc36da2aab2d5cff675ec18454fad408585853910a202391cf9f8e65" dependencies = [ "once_cell", "wasm-bindgen", @@ -1916,9 +1931,9 @@ checksum = "09edd9e8b54e49e587e4f6295a7d29c3ea94d469cb40ab8ca70b288248a81db2" [[package]] name = "libc" -version = "0.2.174" +version = "0.2.177" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1171693293099992e19cddea4e8b849964e9846f4acee11b3948bcc337be8776" +checksum = "2874a2af47a2325c2001a6e6fad9b16a53b802102b528163885171cf92b15976" [[package]] name = "libm" @@ -1928,11 +1943,11 @@ checksum = "f9fbbcab51052fe104eb5e5d351cf728d30a5be1fe14d9be8a3b097481fb97de" [[package]] name = "libredox" -version = "0.1.6" +version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4488594b9328dee448adb906d8b126d9b7deb7cf5c22161ee591610bb1be83c0" +checksum = "416f7e718bdb06000964960ffa43b4335ad4012ae8b99060261aa4a8088d5ccb" dependencies = [ - "bitflags 2.9.1", + "bitflags", "libc", "redox_syscall", ] @@ -1962,9 +1977,9 @@ checksum = "d26c52dbd32dccf2d10cac7725f8eae5296885fb5703b261f7d0a0739ec807ab" [[package]] name = "linux-raw-sys" -version = "0.9.4" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd945864f07fe9f5371a27ad7b52a172b4b499999f1d97574c9fa68373937e12" +checksum = "df1d3c3b53da64cf5760482273a98e575c651a67eec7f77df96b5b642de8f039" [[package]] name = "liquid" @@ -2022,19 +2037,18 @@ dependencies = [ [[package]] name = "lock_api" -version = "0.4.13" +version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96936507f153605bddfcda068dd804796c84324ed2510809e5b2a624c81da765" +checksum = "224399e74b87b5f3557511d98dff8b14089b3dadafcab6bb93eab67d3aace965" dependencies = [ - "autocfg", "scopeguard", ] [[package]] name = "log" -version = "0.4.27" +version = "0.4.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94" +checksum = "34080505efa8e45a4b816c349525ebe327ceaa8559756f0356cba97ef3bf7432" [[package]] name = "logos" @@ -2047,11 +2061,11 @@ dependencies = [ [[package]] name = "logos" -version = "0.15.0" +version = "0.15.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab6f536c1af4c7cc81edf73da1f8029896e7e1e16a219ef09b184e76a296f3db" +checksum = "ff472f899b4ec2d99161c51f60ff7075eeb3097069a36050d8037a6325eb8154" dependencies = [ - "logos-derive 0.15.0", + "logos-derive 0.15.1", ] [[package]] @@ -2071,9 +2085,9 @@ dependencies = [ [[package]] name = "logos-codegen" -version = "0.15.0" +version = "0.15.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "189bbfd0b61330abea797e5e9276408f2edbe4f822d7ad08685d67419aafb34e" +checksum = "192a3a2b90b0c05b27a0b2c43eecdb7c415e29243acc3f89cc8247a5b693045c" dependencies = [ "beef", "fnv", @@ -2096,11 +2110,11 @@ dependencies = [ [[package]] name = "logos-derive" -version = "0.15.0" +version = "0.15.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebfe8e1a19049ddbfccbd14ac834b215e11b85b90bab0c2dba7c7b92fb5d5cba" +checksum = "605d9697bcd5ef3a42d38efc51541aa3d6a4a25f7ab6d1ed0da5ac632a26b470" dependencies = [ - "logos-codegen 0.15.0", + "logos-codegen 0.15.1", ] [[package]] @@ -2122,7 +2136,7 @@ version = "0.12.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "234cf4f4a04dc1f57e24b96cc0cd600cf2af460d4161ac5ecdd0af8e1f3b2a38" dependencies = [ - "hashbrown 0.15.4", + "hashbrown 0.15.5", ] [[package]] @@ -2136,15 +2150,15 @@ dependencies = [ [[package]] name = "memchr" -version = "2.7.5" +version = "2.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0" +checksum = "f52b00d39961fc5b2736ea853c9cc86238e165017a493d1d5c8eac6bdc4cc273" [[package]] name = "memmap2" -version = "0.9.7" +version = "0.9.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "483758ad303d734cec05e5c12b41d7e93e6a6390c5e9dae6bdeb7c1259012d28" +checksum = "744133e4a0e0a658e1374cf3bf8e415c4052a15a111acd372764c55b4177d490" dependencies = [ "libc", ] @@ -2177,7 +2191,7 @@ checksum = "06acfd2ddc25b68f9d23d2add3f15c0ec3f9890ce6418409d71bea9dc6590bd0" dependencies = [ "miden-core", "miden-utils-indexing", - "thiserror 2.0.12", + "thiserror 2.0.17", "winter-air", "winter-prover", ] @@ -2193,7 +2207,7 @@ dependencies = [ "miden-core", "miden-mast-package", "smallvec", - "thiserror 2.0.12", + "thiserror 2.0.17", ] [[package]] @@ -2213,9 +2227,9 @@ dependencies = [ "proptest", "regex", "rustc_version 0.4.1", - "semver 1.0.26", + "semver 1.0.27", "smallvec", - "thiserror 2.0.12", + "thiserror 2.0.17", ] [[package]] @@ -2235,7 +2249,7 @@ dependencies = [ "miden-objects", "proc-macro2", "quote", - "semver 1.0.26", + "semver 1.0.27", "syn", "toml 0.8.23", ] @@ -2257,7 +2271,7 @@ dependencies = [ "async-trait", "chrono", "futures", - "getrandom 0.3.3", + "getrandom 0.3.4", "hex", "miden-lib", "miden-node-proto-build", @@ -2271,7 +2285,7 @@ dependencies = [ "prost-types 0.14.1", "protox 0.7.2", "rand", - "thiserror 2.0.12", + "thiserror 2.0.17", "tonic", "tonic-build", "tonic-health", @@ -2297,7 +2311,7 @@ dependencies = [ "miden-objects", "rusqlite", "rusqlite_migration", - "thiserror 2.0.12", + "thiserror 2.0.17", "tokio", ] @@ -2314,7 +2328,7 @@ dependencies = [ "miden-utils-indexing", "num-derive", "num-traits", - "thiserror 2.0.12", + "thiserror 2.0.17", "winter-math", "winter-utils", ] @@ -2344,7 +2358,7 @@ dependencies = [ "rayon", "sha3", "subtle", - "thiserror 2.0.12", + "thiserror 2.0.17", "winter-crypto", "winter-math", "winter-utils", @@ -2407,7 +2421,7 @@ dependencies = [ "paste", "serde", "serde_spanned 1.0.3", - "thiserror 2.0.12", + "thiserror 2.0.17", ] [[package]] @@ -2488,7 +2502,7 @@ dependencies = [ "miden-processor", "miden-stdlib", "regex", - "thiserror 2.0.12", + "thiserror 2.0.17", "walkdir", ] @@ -2501,7 +2515,7 @@ dependencies = [ "derive_more", "miden-assembly-syntax", "miden-core", - "thiserror 2.0.12", + "thiserror 2.0.17", ] [[package]] @@ -2530,7 +2544,7 @@ dependencies = [ "syn", "terminal_size 0.3.0", "textwrap", - "thiserror 2.0.12", + "thiserror 2.0.17", "trybuild", "unicode-width 0.1.14", ] @@ -2577,7 +2591,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0ef49472012d00be68f68dcbb13b4f28867fb6271c76c014bc555ef6e8e0958a" dependencies = [ "bech32", - "getrandom 0.3.3", + "getrandom 0.3.4", "miden-assembly", "miden-assembly-syntax", "miden-core", @@ -2587,9 +2601,9 @@ dependencies = [ "miden-utils-sync", "miden-verifier", "rand", - "semver 1.0.26", + "semver 1.0.27", "serde", - "thiserror 2.0.12", + "thiserror 2.0.17", "toml 0.9.8", ] @@ -2607,7 +2621,7 @@ dependencies = [ "miden-utils-indexing", "paste", "rayon", - "thiserror 2.0.12", + "thiserror 2.0.17", "tokio", "tracing", "winter-prover", @@ -2633,13 +2647,13 @@ version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "045f5ef567fe03b0c515a73c62b33ea9a69b4e54d6b538e23fa3837f25ea09fc" dependencies = [ - "getrandom 0.3.3", + "getrandom 0.3.4", "miden-node-proto-build", "miden-objects", "miden-tx", "miette", "prost 0.14.1", - "thiserror 2.0.12", + "thiserror 2.0.17", "tokio", "tonic", "tonic-prost", @@ -2664,7 +2678,7 @@ dependencies = [ "miden-crypto", "miden-processor", "miden-utils-sync", - "thiserror 2.0.12", + "thiserror 2.0.17", ] [[package]] @@ -2703,7 +2717,7 @@ dependencies = [ "miden-prover", "miden-verifier", "rand", - "thiserror 2.0.12", + "thiserror 2.0.17", "tokio", ] @@ -2726,7 +2740,7 @@ version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c798250bee4e856d4f18c161e91cdcbef1906f6614d00cf0063b47031c0f8cc6" dependencies = [ - "thiserror 2.0.12", + "thiserror 2.0.17", ] [[package]] @@ -2748,7 +2762,7 @@ checksum = "b8f8e47b78bba1fe1b31faee8f12aafd95385f6d6a8b108b03e92f5d743bb29f" dependencies = [ "miden-air", "miden-core", - "thiserror 2.0.12", + "thiserror 2.0.17", "tracing", "winter-verifier", ] @@ -2898,10 +2912,10 @@ dependencies = [ name = "midenc-frontend-wasm" version = "0.5.0" dependencies = [ - "addr2line", + "addr2line 0.24.2", "anyhow", "cranelift-entity", - "gimli", + "gimli 0.31.1", "indexmap", "log", "miden-core", @@ -2923,13 +2937,13 @@ name = "midenc-hir" version = "0.5.0" dependencies = [ "anyhow", - "bitflags 2.9.1", + "bitflags", "bitvec", "blink-alloc", "compact_str 0.9.0", "env_logger", "hashbrown 0.14.5", - "hashbrown 0.15.4", + "hashbrown 0.15.5", "intrusive-collections", "inventory", "log", @@ -2942,7 +2956,7 @@ dependencies = [ "pretty_assertions", "rustc-demangle", "rustc-hash", - "semver 1.0.26", + "semver 1.0.27", "smallvec", ] @@ -2994,7 +3008,7 @@ dependencies = [ "Inflector", "compact_str 0.9.0", "hashbrown 0.14.5", - "hashbrown 0.15.4", + "hashbrown 0.15.5", "lock_api", "miden-formatting", "parking_lot", @@ -3021,7 +3035,7 @@ dependencies = [ "serde", "serde_repr", "smallvec", - "thiserror 2.0.12", + "thiserror 2.0.17", ] [[package]] @@ -3034,7 +3048,7 @@ dependencies = [ "serde", "serde_repr", "smallvec", - "thiserror 2.0.12", + "thiserror 2.0.17", ] [[package]] @@ -3073,7 +3087,7 @@ dependencies = [ "supports-color", "supports-hyperlinks", "supports-unicode", - "terminal_size 0.4.2", + "terminal_size 0.4.3", "textwrap", "unicode-width 0.1.14", ] @@ -3096,27 +3110,28 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316" dependencies = [ "adler2", + "simd-adler32", ] [[package]] name = "mio" -version = "1.0.4" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78bed444cc8a2160f01cbcf811ef18cac863ad68ae8ca62092e8db51d51c761c" +checksum = "69d83b0086dc8ecf3ce9ae2874b2d1290252e2a30720bea58a5c6639b0092873" dependencies = [ "libc", "log", - "wasi 0.11.1+wasi-snapshot-preview1", - "windows-sys 0.59.0", + "wasi", + "windows-sys 0.61.2", ] [[package]] name = "miow" -version = "0.6.0" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "359f76430b20a79f9e20e115b3428614e654f04fab314482fc0fda0ebd3c6044" +checksum = "536bfad37a309d62069485248eeaba1e8d9853aaf951caaeaed0585a95346f08" dependencies = [ - "windows-sys 0.48.0", + "windows-sys 0.61.2", ] [[package]] @@ -3261,6 +3276,15 @@ dependencies = [ "ruzstd", ] +[[package]] +name = "object" +version = "0.37.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff76201f031d8863c38aa7f905eca4f53abbfa15f609db4277d44cd8938f33fe" +dependencies = [ + "memchr", +] + [[package]] name = "once_cell" version = "1.21.3" @@ -3269,9 +3293,9 @@ checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" [[package]] name = "once_cell_polyfill" -version = "1.70.1" +version = "1.70.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4895175b425cb1f87721b59f0f286c2092bd4af812243672510e1ac53e2e0ad" +checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe" [[package]] name = "onig" @@ -3279,7 +3303,7 @@ version = "6.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "336b9c63443aceef14bea841b899035ae3abe89b7c486aaf4c5bd8aafedac3f0" dependencies = [ - "bitflags 2.9.1", + "bitflags", "libc", "once_cell", "onig_sys", @@ -3327,15 +3351,15 @@ dependencies = [ [[package]] name = "owo-colors" -version = "4.2.2" +version = "4.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48dd4f4a2c8405440fd0462561f0e5806bd0f77e86f51c761481bdd4018b545e" +checksum = "9c6901729fa79e91a0913333229e9ca5dc725089d1c363b2f4b4760709dc4a52" [[package]] name = "parking_lot" -version = "0.12.4" +version = "0.12.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70d58bf43669b5795d1576d0641cfb6fbb2057bf629506267a92807158584a13" +checksum = "93857453250e3077bd71ff98b6a65ea6621a19bb0f559a85248955ac12c45a1a" dependencies = [ "lock_api", "parking_lot_core", @@ -3343,15 +3367,15 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.9.11" +version = "0.9.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc838d2a56b5b1a6c25f55575dfc605fabb63bb2365f6c2353ef9159aa69e4a5" +checksum = "2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1" dependencies = [ "cfg-if", "libc", "redox_syscall", "smallvec", - "windows-targets 0.52.6", + "windows-link 0.2.1", ] [[package]] @@ -3395,26 +3419,25 @@ dependencies = [ [[package]] name = "percent-encoding" -version = "2.3.1" +version = "2.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" +checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" [[package]] name = "pest" -version = "2.8.1" +version = "2.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1db05f56d34358a8b1066f67cbb203ee3e7ed2ba674a6263a1d5ec6db2204323" +checksum = "989e7521a040efde50c3ab6bbadafbe15ab6dc042686926be59ac35d74607df4" dependencies = [ "memchr", - "thiserror 2.0.12", "ucd-trie", ] [[package]] name = "pest_derive" -version = "2.8.1" +version = "2.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb056d9e8ea77922845ec74a1c4e8fb17e7c218cc4fc11a15c5d25e189aa40bc" +checksum = "187da9a3030dbafabbbfb20cb323b976dc7b7ce91fcd84f2f74d6e31d378e2de" dependencies = [ "pest", "pest_generator", @@ -3422,9 +3445,9 @@ dependencies = [ [[package]] name = "pest_generator" -version = "2.8.1" +version = "2.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87e404e638f781eb3202dc82db6760c8ae8a1eeef7fb3fa8264b2ef280504966" +checksum = "49b401d98f5757ebe97a26085998d6c0eecec4995cad6ab7fc30ffdf4b052843" dependencies = [ "pest", "pest_meta", @@ -3435,9 +3458,9 @@ dependencies = [ [[package]] name = "pest_meta" -version = "2.8.1" +version = "2.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "edd1101f170f5903fde0914f899bb503d9ff5271d7ba76bbb70bea63690cc0d5" +checksum = "72f27a2cfee9f9039c4d86faa5af122a0ac3851441a34865b8a043b46be0065a" dependencies = [ "pest", "sha2", @@ -3460,7 +3483,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8701b58ea97060d5e5b155d383a69952a60943f0e6dfe30b04c287beb0b27455" dependencies = [ "fixedbitset", - "hashbrown 0.15.4", + "hashbrown 0.15.5", "indexmap", ] @@ -3523,9 +3546,9 @@ checksum = "7edddbd0b52d732b21ad9a5fab5c704c14cd949e5e9a1ec5929a24fded1b904c" [[package]] name = "plist" -version = "1.7.4" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3af6b589e163c5a788fab00ce0c0366f6efbb9959c2f9874b224936af7fce7e1" +checksum = "740ebea15c5d1428f910cd1a5f52cebf8d25006245ed8ade92702f4943d91e07" dependencies = [ "base64", "indexmap", @@ -3621,9 +3644,9 @@ dependencies = [ [[package]] name = "prettyplease" -version = "0.2.35" +version = "0.2.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "061c1221631e079b26479d25bbf2275bfe5917ae8419cd7e34f13bfc2aa7539a" +checksum = "479ca8adacdd7ce8f1fb39ce9ecccbfe93a3f1344b3d0d97f20bc0196208f62b" dependencies = [ "proc-macro2", "syn", @@ -3631,23 +3654,22 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.95" +version = "1.0.103" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02b3e5e68a3a1a02aad3ec490a98007cbc13c37cbe84a3cd7b8e406d76e7f778" +checksum = "5ee95bc4ef87b8d5ba32e8b7714ccc834865276eab0aed5c9958d00ec45f49e8" dependencies = [ "unicode-ident", ] [[package]] name = "proptest" -version = "1.8.0" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2bb0be07becd10686a0bb407298fb425360a5c44a663774406340c59a22de4ce" +checksum = "bee689443a2bd0a16ab0348b52ee43e3b2d1b1f931c8aa5c9f8de4c86fbe8c40" dependencies = [ "bit-set", "bit-vec", - "bitflags 2.9.1", - "lazy_static", + "bitflags", "num-traits", "rand", "rand_chacha", @@ -3685,7 +3707,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac6c3320f9abac597dcbc668774ef006702672474aad53c6d596b62e487b40b1" dependencies = [ "heck", - "itertools 0.10.5", + "itertools 0.14.0", "log", "multimap", "once_cell", @@ -3707,7 +3729,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a56d757972c98b346a9b766e3f02746cde6dd1cd1d1d563472929fdd74bec4d" dependencies = [ "anyhow", - "itertools 0.10.5", + "itertools 0.14.0", "proc-macro2", "quote", "syn", @@ -3720,7 +3742,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9120690fafc389a67ba3803df527d0ec9cbbc9cc45e4cc20b332996dfb672425" dependencies = [ "anyhow", - "itertools 0.10.5", + "itertools 0.14.0", "proc-macro2", "quote", "syn", @@ -3745,7 +3767,7 @@ version = "0.16.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "89a3ac73ec9a9118131a4594c9d336631a07852220a1d0ae03ee36b04503a063" dependencies = [ - "logos 0.15.0", + "logos 0.15.1", "miette", "prost 0.14.1", "prost-types 0.14.1", @@ -3796,7 +3818,7 @@ dependencies = [ "prost-reflect 0.16.2", "prost-types 0.14.1", "protox-parse 0.9.0", - "thiserror 2.0.12", + "thiserror 2.0.17", ] [[package]] @@ -3817,10 +3839,10 @@ version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "072eee358134396a4643dff81cfff1c255c9fbd3fb296be14bdb6a26f9156366" dependencies = [ - "logos 0.15.0", + "logos 0.15.1", "miette", "prost-types 0.14.1", - "thiserror 2.0.12", + "thiserror 2.0.17", ] [[package]] @@ -3829,7 +3851,7 @@ version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1e8bbe1a966bd2f362681a44f6edce3c2310ac21e4d5067a6e7ec396297a6ea0" dependencies = [ - "bitflags 2.9.1", + "bitflags", "memchr", "unicase", ] @@ -3851,18 +3873,18 @@ checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" [[package]] name = "quick-xml" -version = "0.38.0" +version = "0.38.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8927b0664f5c5a98265138b7e3f90aa19a6b21353182469ace36d4ac527b7b1b" +checksum = "42a232e7487fc2ef313d96dde7948e7a3c05101870d8985e4fd8d26aedd27b89" dependencies = [ "memchr", ] [[package]] name = "quote" -version = "1.0.40" +version = "1.0.42" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d" +checksum = "a338cc41d27e6cc6dce6cefc13a0729dfbb81c262b1f519331575dd80ef3067f" dependencies = [ "proc-macro2", ] @@ -3914,7 +3936,7 @@ version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38" dependencies = [ - "getrandom 0.3.3", + "getrandom 0.3.4", ] [[package]] @@ -3941,7 +3963,7 @@ version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eabd94c2f37801c20583fc49dd5cd6b0ba68c716787c2dd6ed18571e1e63117b" dependencies = [ - "bitflags 2.9.1", + "bitflags", "cassowary", "compact_str 0.8.1", "crossterm", @@ -3958,9 +3980,9 @@ dependencies = [ [[package]] name = "rayon" -version = "1.10.0" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b418a60154510ca1a002a752ca9714984e21e4241e804d32555251faf8b78ffa" +checksum = "368f01d005bf8fd9b1206fb6fa653e6c4a81ceb1466406b81792d87c5677a58f" dependencies = [ "either", "rayon-core", @@ -3968,9 +3990,9 @@ dependencies = [ [[package]] name = "rayon-core" -version = "1.12.1" +version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1465873a3dfdaa8ae7cb14b4383657caab0b3e8a0aa9ae8e04b044854c8dfce2" +checksum = "22e18b0f0062d30d4230b2e85ff77fdfe4326feb054b9783a3460d8435c8ab91" dependencies = [ "crossbeam-deque", "crossbeam-utils", @@ -3978,11 +4000,11 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.5.14" +version = "0.5.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de3a5d9f0aba1dbcec1cc47f0ff94a4b778fe55bca98a6dfa92e4e094e57b1c4" +checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d" dependencies = [ - "bitflags 2.9.1", + "bitflags", ] [[package]] @@ -4010,9 +4032,9 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.8.5" +version = "0.8.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" +checksum = "7a2d987857b319362043e95f5353c0535c1f58eec5336fdfcf626430af7def58" [[package]] name = "rfc6979" @@ -4044,7 +4066,7 @@ version = "0.36.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3de23c3319433716cf134eed225fe9986bc24f63bed9be9f20c329029e672dc7" dependencies = [ - "bitflags 2.9.1", + "bitflags", "fallible-iterator", "fallible-streaming-iterator", "hashlink", @@ -4064,9 +4086,9 @@ dependencies = [ [[package]] name = "rustc-demangle" -version = "0.1.25" +version = "0.1.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "989e6739f80c4ad5b13e0fd7fe89531180375b18520cc8c82080e4dc4035b84f" +checksum = "56f7d92ca342cea22a06f2121d944b4fd82af56988c270852495420f961d4ace" [[package]] name = "rustc-hash" @@ -4089,7 +4111,7 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" dependencies = [ - "semver 1.0.26", + "semver 1.0.27", ] [[package]] @@ -4098,7 +4120,7 @@ version = "0.38.44" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fdb5bc1ae2baa591800df16c9ca78619bf65c0488b41b96ccec5d11220d8c154" dependencies = [ - "bitflags 2.9.1", + "bitflags", "errno", "libc", "linux-raw-sys 0.4.15", @@ -4107,22 +4129,22 @@ dependencies = [ [[package]] name = "rustix" -version = "1.0.8" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11181fbabf243db407ef8df94a6ce0b2f9a733bd8be4ad02b4eda9602296cac8" +checksum = "cd15f8a2c5551a84d56efdc1cd049089e409ac19a3072d5037a17fd70719ff3e" dependencies = [ - "bitflags 2.9.1", + "bitflags", "errno", "libc", - "linux-raw-sys 0.9.4", - "windows-sys 0.60.2", + "linux-raw-sys 0.11.0", + "windows-sys 0.61.2", ] [[package]] name = "rustls" -version = "0.23.29" +version = "0.23.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2491382039b29b9b11ff08b76ff6c97cf287671dbb74f0be44bda389fffe9bd1" +checksum = "533f54bc6a7d4f647e46ad909549eda97bf5afc1585190ef692b4286b198bd8f" dependencies = [ "log", "once_cell", @@ -4135,9 +4157,9 @@ dependencies = [ [[package]] name = "rustls-native-certs" -version = "0.8.1" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fcff2dd52b58a8d98a70243663a0d234c4e2b79235637849d15913394a247d3" +checksum = "9980d917ebb0c0536119ba501e90834767bffc3d60641457fd84a1f3fd337923" dependencies = [ "openssl-probe", "rustls-pki-types", @@ -4147,18 +4169,18 @@ dependencies = [ [[package]] name = "rustls-pki-types" -version = "1.12.0" +version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "229a4a4c221013e7e1f1a043678c5cc39fe5171437c88fb47151a21e6f5b5c79" +checksum = "94182ad936a0c91c324cd46c6511b9510ed16af436d7b5bab34beab0afd55f7a" dependencies = [ "zeroize", ] [[package]] name = "rustls-webpki" -version = "0.103.4" +version = "0.103.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a17884ae0c1b773f1ccd2bd4a8c72f16da897310a98b0e84bf349ad5ead92fc" +checksum = "2ffdfa2f5286e2247234e03f680868ac2815974dc39e00ea15adc445d0aafe52" dependencies = [ "ring", "rustls-pki-types", @@ -4167,15 +4189,15 @@ dependencies = [ [[package]] name = "rustversion" -version = "1.0.21" +version = "1.0.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a0d197bd2c9dc6e53b84da9556a69ba4cdfab8619eb41a8bd1cc2027a0f6b1d" +checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d" [[package]] name = "rusty-fork" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb3dcc6e454c328bb824492db107ab7c0ae8fcffe4ad210136ef014458c1bc4f" +checksum = "cc6bf79ff24e648f6da1f8d1f011e9cac26491b619e6b9280f2b47f1774e6ee2" dependencies = [ "fnv", "quick-error", @@ -4209,11 +4231,11 @@ dependencies = [ [[package]] name = "schannel" -version = "0.1.27" +version = "0.1.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f29ebaa345f945cec9fbbc532eb307f0fdad8161f281b6369539c8d84876b3d" +checksum = "891d81b926048e76efe18581bf793546b4c0eaf8448d72be8de2bbee5fd166e1" dependencies = [ - "windows-sys 0.59.0", + "windows-sys 0.61.2", ] [[package]] @@ -4244,11 +4266,11 @@ dependencies = [ [[package]] name = "security-framework" -version = "3.2.0" +version = "3.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "271720403f46ca04f7ba6f55d438f8bd878d6b8ca0a1046e8228c4145bcbb316" +checksum = "b3297343eaf830f66ede390ea39da1d462b6b0c1b000f420d0a83f898bbbe6ef" dependencies = [ - "bitflags 2.9.1", + "bitflags", "core-foundation", "core-foundation-sys", "libc", @@ -4257,9 +4279,9 @@ dependencies = [ [[package]] name = "security-framework-sys" -version = "2.14.0" +version = "2.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49db231d56a190491cb4aeda9527f1ad45345af50b0851622a7adb8c03b01c32" +checksum = "cc1f0cbffaac4852523ce30d8bd3c5cdc873501d96ff467ca09b6767bb8cd5c0" dependencies = [ "core-foundation-sys", "libc", @@ -4276,11 +4298,12 @@ dependencies = [ [[package]] name = "semver" -version = "1.0.26" +version = "1.0.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56e6fa9c48d24d85fb3de5ad847117517440f6beceb7798af16b4a87d616b8d0" +checksum = "d767eb0aabc880b29956c35734170f26ed551a859dbd361d140cdbeca61ab1e2" dependencies = [ "serde", + "serde_core", ] [[package]] @@ -4321,14 +4344,15 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.141" +version = "1.0.145" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30b9eff21ebe718216c6ec64e1d9ac57087aad11efc64e32002bce4a0d4c03d3" +checksum = "402a6f66d8c709116cf22f558eab210f5a50187f702eb4d7e5ef38d9a7f1c79c" dependencies = [ "itoa", "memchr", "ryu", "serde", + "serde_core", ] [[package]] @@ -4414,9 +4438,9 @@ dependencies = [ [[package]] name = "signal-hook-mio" -version = "0.2.4" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34db1a06d485c9142248b7a054f034b349b212551f3dfd19c94d45a754a217cd" +checksum = "b75a19a7a740b25bc7944bdee6172368f988763b744e3d4dfe753f6b4ece40cc" dependencies = [ "libc", "mio", @@ -4425,9 +4449,9 @@ dependencies = [ [[package]] name = "signal-hook-registry" -version = "1.4.5" +version = "1.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9203b8055f63a2a00e2f593bb0510367fe707d7ff1e5c872de2f537b339e5410" +checksum = "b2a4719bff48cee6b39d12c020eeb490953ad2443b7055bd0b21fca26bd8c28b" dependencies = [ "libc", ] @@ -4442,6 +4466,12 @@ dependencies = [ "rand_core 0.6.4", ] +[[package]] +name = "simd-adler32" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d66dc143e6b11c1eddc06d5c423cfc97062865baf299914ab64caa38182078fe" + [[package]] name = "similar" version = "2.7.0" @@ -4475,16 +4505,6 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b7c388c1b5e93756d0c740965c41e8822f866621d41acbdf6336a6a168f8840c" -[[package]] -name = "socket2" -version = "0.5.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e22376abed350d73dd1cd119b57ffccad95b4e585a7cda43e286245ce23c0678" -dependencies = [ - "libc", - "windows-sys 0.52.0", -] - [[package]] name = "socket2" version = "0.6.1" @@ -4516,9 +4536,9 @@ dependencies = [ [[package]] name = "stable_deref_trait" -version = "1.2.0" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" +checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" [[package]] name = "static_assertions" @@ -4604,9 +4624,9 @@ checksum = "b7401a30af6cb5818bb64852270bb722533397edcfc7344954a38f420819ece2" [[package]] name = "syn" -version = "2.0.104" +version = "2.0.110" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17b6f705963418cdb9927482fa304bc562ece2fdd4f616084c50b7023b435a40" +checksum = "a99801b5bd34ede4cf3fc688c5919368fea4e4814a4664359503e6015b280aea" dependencies = [ "proc-macro2", "quote", @@ -4621,12 +4641,11 @@ checksum = "0bf256ce5efdfa370213c1dabab5935a12e49f2c58d15e9eac2870d3b4f27263" [[package]] name = "syntect" -version = "5.2.0" +version = "5.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "874dcfa363995604333cf947ae9f751ca3af4522c60886774c4963943b4746b1" +checksum = "656b45c05d95a5704399aeef6bd0ddec7b2b3531b7c9e900abbf7c4d2190c925" dependencies = [ "bincode", - "bitflags 1.3.2", "flate2", "fnv", "once_cell", @@ -4634,8 +4653,7 @@ dependencies = [ "regex-syntax", "serde", "serde_derive", - "serde_json", - "thiserror 1.0.69", + "thiserror 2.0.17", "walkdir", "yaml-rust", ] @@ -4648,9 +4666,9 @@ checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" [[package]] name = "target-triple" -version = "0.1.4" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ac9aa371f599d22256307c24a9d748c041e548cbf599f35d890f9d365361790" +checksum = "591ef38edfb78ca4771ee32cf494cb8771944bee237a9b91fc9c1424ac4b777b" [[package]] name = "temp-dir" @@ -4660,15 +4678,15 @@ checksum = "83176759e9416cf81ee66cb6508dbfe9c96f20b8b56265a39917551c23c70964" [[package]] name = "tempfile" -version = "3.19.1" +version = "3.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7437ac7763b9b123ccf33c338a5cc1bac6f69b45a136c19bdd8a65e3916435bf" +checksum = "2d31c77bdf42a745371d260a26ca7163f1e0924b64afa0b688e61b5a9fa02f16" dependencies = [ "fastrand", - "getrandom 0.3.3", + "getrandom 0.3.4", "once_cell", - "rustix 1.0.8", - "windows-sys 0.59.0", + "rustix 1.1.2", + "windows-sys 0.61.2", ] [[package]] @@ -4701,12 +4719,12 @@ dependencies = [ [[package]] name = "terminal_size" -version = "0.4.2" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45c6481c4829e4cc63825e62c49186a34538b7b2750b73b266581ffb612fb5ed" +checksum = "60b8cb979cb11c32ce1603f8137b22262a9d131aaa5c37b5678025f22b8becd0" dependencies = [ - "rustix 1.0.8", - "windows-sys 0.59.0", + "rustix 1.1.2", + "windows-sys 0.60.2", ] [[package]] @@ -4731,11 +4749,11 @@ dependencies = [ [[package]] name = "thiserror" -version = "2.0.12" +version = "2.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "567b8a2dae586314f7be2a752ec7474332959c6460e02bde30d702a66d488708" +checksum = "f63587ca0f12b72a0600bcba1d40081f830876000bb46dd2337a3051618f4fc8" dependencies = [ - "thiserror-impl 2.0.12", + "thiserror-impl 2.0.17", ] [[package]] @@ -4751,9 +4769,9 @@ dependencies = [ [[package]] name = "thiserror-impl" -version = "2.0.12" +version = "2.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f7cf42b4507d8ea322120659672cf1b9dbb93f8f2d4ecfd6e51350ff5b17a1d" +checksum = "3ff15c8ecd7de3849db632e14d18d2571fa09dfc5ed93479bc4485c7a517c913" dependencies = [ "proc-macro2", "quote", @@ -4771,9 +4789,9 @@ dependencies = [ [[package]] name = "time" -version = "0.3.41" +version = "0.3.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a7619e19bc266e0f9c5e6686659d394bc57973859340060a69221e57dbc0c40" +checksum = "91e7d9e3bb61134e77bde20dd4825b97c010155709965fedf0f49bb138e52a9d" dependencies = [ "deranged", "itoa", @@ -4786,15 +4804,15 @@ dependencies = [ [[package]] name = "time-core" -version = "0.1.4" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9e9a38711f559d9e3ce1cdb06dd7c5b8ea546bc90052da6d06bb76da74bb07c" +checksum = "40868e7c1d2f0b8d73e4a8c7f0ff63af4f6d19be117e90bd73eb1d62cf831c6b" [[package]] name = "time-macros" -version = "0.2.22" +version = "0.2.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3526739392ec93fd8b359c8e98514cb3e8e021beb4e5f597b00a0221f8ed8a49" +checksum = "30cfb0125f12d9c277f35663a0a33f8c30190f4e4574868a330595412d34ebf3" dependencies = [ "num-conv", "time-core", @@ -4820,7 +4838,7 @@ dependencies = [ "libc", "mio", "pin-project-lite", - "socket2 0.6.1", + "socket2", "tokio-macros", "windows-sys 0.61.2", ] @@ -4838,9 +4856,9 @@ dependencies = [ [[package]] name = "tokio-rustls" -version = "0.26.2" +version = "0.26.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e727b36a1a0e8b74c376ac2211e40c2c8af09fb4013c60d910495810f008e9b" +checksum = "1729aa945f29d91ba541258c8df89027d5792d85a8841fb65e8bf0f4ede4ef61" dependencies = [ "rustls", "tokio", @@ -4860,9 +4878,9 @@ dependencies = [ [[package]] name = "tokio-util" -version = "0.7.15" +version = "0.7.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "66a539a9ad6d5d281510d5bd368c973d636c02dbf8a67300bfb6b950696ad7df" +checksum = "2efa149fe76073d6e8fd97ef4f4eca7b67f599660115591483572e406e165594" dependencies = [ "bytes", "futures-core", @@ -4933,12 +4951,12 @@ dependencies = [ [[package]] name = "toml_edit" -version = "0.23.4" +version = "0.23.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7211ff1b8f0d3adae1663b7da9ffe396eabe1ca25f0b0bee42b0da29a9ddce93" +checksum = "6485ef6d0d9b5d0ec17244ff7eb05310113c3f316f2d14200d4de56b3cb98f8d" dependencies = [ "indexmap", - "serde", + "serde_core", "serde_spanned 1.0.3", "toml_datetime 0.7.3", "toml_parser", @@ -4986,7 +5004,7 @@ dependencies = [ "percent-encoding", "pin-project", "rustls-native-certs", - "socket2 0.6.1", + "socket2", "sync_wrapper", "tokio", "tokio-rustls", @@ -5065,7 +5083,7 @@ dependencies = [ "httparse", "js-sys", "pin-project", - "thiserror 2.0.12", + "thiserror 2.0.17", "tonic", "tower-service", "wasm-bindgen", @@ -5174,9 +5192,9 @@ checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" [[package]] name = "trybuild" -version = "1.0.106" +version = "1.0.114" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65af40ad689f2527aebbd37a0a816aea88ff5f774ceabe99de5be02f2f91dae2" +checksum = "3e17e807bff86d2a06b52bca4276746584a78375055b6e45843925ce2802b335" dependencies = [ "dissimilar", "glob", @@ -5216,9 +5234,9 @@ checksum = "6af6ae20167a9ece4bcb41af5b80f8a1f1df981f6391189ce00fd257af04126a" [[package]] name = "typenum" -version = "1.18.0" +version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1dccffe3ce07af9386bfd29e80c0ab1a8205a2fc34e4bcd40364df902cfa8f3f" +checksum = "562d481066bde0658276a35467c4af00bdc6ee726305698a55b86e61d7ad82bb" [[package]] name = "ucd-trie" @@ -5240,9 +5258,9 @@ checksum = "75b844d17643ee918803943289730bec8aac480150456169e647ed0b576ba539" [[package]] name = "unicode-ident" -version = "1.0.18" +version = "1.0.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512" +checksum = "9312f7c4f6ff9069b165498234ce8be658059c6728633667c526e27dc2cf1df5" [[package]] name = "unicode-linebreak" @@ -5309,11 +5327,11 @@ checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" [[package]] name = "uuid" -version = "1.17.0" +version = "1.18.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3cf4199d1e5d15ddd86a694e4d0dffa9c323ce759fea589f00fef9d81cc1931d" +checksum = "2f87b8aa10b915a06587d0dec516c282ff295b475d94abf425d62b57710070a2" dependencies = [ - "getrandom 0.3.3", + "getrandom 0.3.4", "js-sys", "wasm-bindgen", ] @@ -5380,45 +5398,32 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" [[package]] -name = "wasi" -version = "0.14.2+wasi-0.2.4" +name = "wasip2" +version = "1.0.1+wasi-0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9683f9a5a998d873c0d21fcbe3c083009670149a8fab228644b8bd36b2c48cb3" +checksum = "0562428422c63773dad2c345a1882263bbf4d65cf3f42e90921f787ef5ad58e7" dependencies = [ - "wit-bindgen-rt", + "wit-bindgen", ] [[package]] name = "wasm-bindgen" -version = "0.2.100" +version = "0.2.105" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1edc8929d7499fc4e8f0be2262a241556cfc54a0bea223790e71446f2aab1ef5" +checksum = "da95793dfc411fbbd93f5be7715b0578ec61fe87cb1a42b12eb625caa5c5ea60" dependencies = [ "cfg-if", "once_cell", "rustversion", "wasm-bindgen-macro", -] - -[[package]] -name = "wasm-bindgen-backend" -version = "0.2.100" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f0a0651a5c2bc21487bde11ee802ccaf4c51935d0d3d42a6101f98161700bc6" -dependencies = [ - "bumpalo", - "log", - "proc-macro2", - "quote", - "syn", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-futures" -version = "0.4.50" +version = "0.4.55" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "555d470ec0bc3bb57890405e5d4322cc9ea83cebb085523ced7be4144dac1e61" +checksum = "551f88106c6d5e7ccc7cd9a16f312dd3b5d36ea8b4954304657d5dfba115d4a0" dependencies = [ "cfg-if", "js-sys", @@ -5429,9 +5434,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.100" +version = "0.2.105" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fe63fc6d09ed3792bd0897b314f53de8e16568c2b3f7982f468c0bf9bd0b407" +checksum = "04264334509e04a7bf8690f2384ef5265f05143a4bff3889ab7a3269adab59c2" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -5439,44 +5444,44 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.100" +version = "0.2.105" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ae87ea40c9f689fc23f209965b6fb8a99ad69aeeb0231408be24920604395de" +checksum = "420bc339d9f322e562942d52e115d57e950d12d88983a14c79b86859ee6c7ebc" dependencies = [ + "bumpalo", "proc-macro2", "quote", "syn", - "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.100" +version = "0.2.105" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a05d73b933a847d6cccdda8f838a22ff101ad9bf93e33684f39c1f5f0eece3d" +checksum = "76f218a38c84bcb33c25ec7059b07847d465ce0e0a76b995e134a45adcb6af76" dependencies = [ "unicode-ident", ] [[package]] name = "wasm-encoder" -version = "0.235.0" +version = "0.239.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3bc393c395cb621367ff02d854179882b9a351b4e0c93d1397e6090b53a5c2a" +checksum = "5be00faa2b4950c76fe618c409d2c3ea5a3c9422013e079482d78544bb2d184c" dependencies = [ "leb128fmt", - "wasmparser 0.235.0", + "wasmparser 0.239.0", ] [[package]] name = "wasm-encoder" -version = "0.239.0" +version = "0.240.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5be00faa2b4950c76fe618c409d2c3ea5a3c9422013e079482d78544bb2d184c" +checksum = "06d642d8c5ecc083aafe9ceb32809276a304547a3a6eeecceb5d8152598bc71f" dependencies = [ "leb128fmt", - "wasmparser 0.239.0", + "wasmparser 0.240.0", ] [[package]] @@ -5510,32 +5515,32 @@ version = "0.227.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0f51cad774fb3c9461ab9bccc9c62dfb7388397b5deda31bf40e8108ccd678b2" dependencies = [ - "bitflags 2.9.1", + "bitflags", "indexmap", - "semver 1.0.26", + "semver 1.0.27", ] [[package]] name = "wasmparser" -version = "0.235.0" +version = "0.239.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "161296c618fa2d63f6ed5fffd1112937e803cb9ec71b32b01a76321555660917" +checksum = "8c9d90bb93e764f6beabf1d02028c70a2156a6583e63ac4218dd07ef733368b0" dependencies = [ - "bitflags 2.9.1", + "bitflags", + "hashbrown 0.15.5", "indexmap", - "semver 1.0.26", + "semver 1.0.27", ] [[package]] name = "wasmparser" -version = "0.239.0" +version = "0.240.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c9d90bb93e764f6beabf1d02028c70a2156a6583e63ac4218dd07ef733368b0" +checksum = "b722dcf61e0ea47440b53ff83ccb5df8efec57a69d150e4f24882e4eba7e24a4" dependencies = [ - "bitflags 2.9.1", - "hashbrown 0.15.4", + "bitflags", "indexmap", - "semver 1.0.26", + "semver 1.0.27", ] [[package]] @@ -5551,31 +5556,31 @@ dependencies = [ [[package]] name = "wast" -version = "235.0.0" +version = "240.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1eda4293f626c99021bb3a6fbe4fbbe90c0e31a5ace89b5f620af8925de72e13" +checksum = "b0efe1c93db4ac562b9733e3dca19ed7fc878dba29aef22245acf84f13da4a19" dependencies = [ "bumpalo", "leb128fmt", "memchr", "unicode-width 0.2.0", - "wasm-encoder 0.235.0", + "wasm-encoder 0.240.0", ] [[package]] name = "wat" -version = "1.235.0" +version = "1.240.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e777e0327115793cb96ab220b98f85327ec3d11f34ec9e8d723264522ef206aa" +checksum = "4ec9b6eab7ecd4d639d78515e9ea491c9bacf494aa5eda10823bd35992cf8c1e" dependencies = [ "wast", ] [[package]] name = "web-sys" -version = "0.3.77" +version = "0.3.82" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33b6dd2ef9186f1f2072e409e99cd22a975331a6b3591b12c764e0e55c60d5d2" +checksum = "3a1f95c0d03a47f4ae1f7a64643a6bb97465d9b740f0fa8f90ea33915c99a9a1" dependencies = [ "js-sys", "wasm-bindgen", @@ -5599,11 +5604,11 @@ checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" [[package]] name = "winapi-util" -version = "0.1.9" +version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" +checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" dependencies = [ - "windows-sys 0.48.0", + "windows-sys 0.61.2", ] [[package]] @@ -5619,7 +5624,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9babd3a767a4c1aef6900409f85f5d53ce2544ccdfaa86dad48c91782c6d6893" dependencies = [ "windows-collections", - "windows-core", + "windows-core 0.61.2", "windows-future", "windows-link 0.1.3", "windows-numerics", @@ -5631,7 +5636,7 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3beeceb5e5cfd9eb1d76b381630e82c4241ccd0d27f1a39ed41b2760b255c5e8" dependencies = [ - "windows-core", + "windows-core 0.61.2", ] [[package]] @@ -5643,8 +5648,21 @@ dependencies = [ "windows-implement", "windows-interface", "windows-link 0.1.3", - "windows-result", - "windows-strings", + "windows-result 0.3.4", + "windows-strings 0.4.2", +] + +[[package]] +name = "windows-core" +version = "0.62.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8e83a14d34d0623b51dce9581199302a221863196a1dde71a7663a4c2be9deb" +dependencies = [ + "windows-implement", + "windows-interface", + "windows-link 0.2.1", + "windows-result 0.4.1", + "windows-strings 0.5.1", ] [[package]] @@ -5653,16 +5671,16 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fc6a41e98427b19fe4b73c550f060b59fa592d7d686537eebf9385621bfbad8e" dependencies = [ - "windows-core", + "windows-core 0.61.2", "windows-link 0.1.3", "windows-threading", ] [[package]] name = "windows-implement" -version = "0.60.0" +version = "0.60.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a47fddd13af08290e67f4acabf4b459f647552718f683a7b415d290ac744a836" +checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf" dependencies = [ "proc-macro2", "quote", @@ -5671,9 +5689,9 @@ dependencies = [ [[package]] name = "windows-interface" -version = "0.59.1" +version = "0.59.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd9211b69f8dcdfa817bfd14bf1c97c9188afa36f4750130fcdf3f400eca9fa8" +checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358" dependencies = [ "proc-macro2", "quote", @@ -5698,7 +5716,7 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9150af68066c4c5c07ddc0ce30421554771e528bde427614c61038bc2c92c2b1" dependencies = [ - "windows-core", + "windows-core 0.61.2", "windows-link 0.1.3", ] @@ -5711,6 +5729,15 @@ dependencies = [ "windows-link 0.1.3", ] +[[package]] +name = "windows-result" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7781fa89eaf60850ac3d2da7af8e5242a5ea78d1a11c49bf2910bb5a73853eb5" +dependencies = [ + "windows-link 0.2.1", +] + [[package]] name = "windows-strings" version = "0.4.2" @@ -5720,6 +5747,15 @@ dependencies = [ "windows-link 0.1.3", ] +[[package]] +name = "windows-strings" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7837d08f69c77cf6b07689544538e017c1bfcf57e34b4c0ff58e6c2cd3b37091" +dependencies = [ + "windows-link 0.2.1", +] + [[package]] name = "windows-sys" version = "0.48.0" @@ -5753,7 +5789,7 @@ version = "0.60.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f2f500e4d28234f72040990ec9d39e3a6b950f9f22d3dba18416c35882612bcb" dependencies = [ - "windows-targets 0.53.2", + "windows-targets 0.53.5", ] [[package]] @@ -5798,18 +5834,19 @@ dependencies = [ [[package]] name = "windows-targets" -version = "0.53.2" +version = "0.53.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c66f69fcc9ce11da9966ddb31a40968cad001c5bedeb5c2b82ede4253ab48aef" +checksum = "4945f9f551b88e0d65f3db0bc25c33b8acea4d9e41163edf90dcd0b19f9069f3" dependencies = [ - "windows_aarch64_gnullvm 0.53.0", - "windows_aarch64_msvc 0.53.0", - "windows_i686_gnu 0.53.0", - "windows_i686_gnullvm 0.53.0", - "windows_i686_msvc 0.53.0", - "windows_x86_64_gnu 0.53.0", - "windows_x86_64_gnullvm 0.53.0", - "windows_x86_64_msvc 0.53.0", + "windows-link 0.2.1", + "windows_aarch64_gnullvm 0.53.1", + "windows_aarch64_msvc 0.53.1", + "windows_i686_gnu 0.53.1", + "windows_i686_gnullvm 0.53.1", + "windows_i686_msvc 0.53.1", + "windows_x86_64_gnu 0.53.1", + "windows_x86_64_gnullvm 0.53.1", + "windows_x86_64_msvc 0.53.1", ] [[package]] @@ -5835,9 +5872,9 @@ checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" [[package]] name = "windows_aarch64_gnullvm" -version = "0.53.0" +version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86b8d5f90ddd19cb4a147a5fa63ca848db3df085e25fee3cc10b39b6eebae764" +checksum = "a9d8416fa8b42f5c947f8482c43e7d89e73a173cead56d044f6a56104a6d1b53" [[package]] name = "windows_aarch64_msvc" @@ -5853,9 +5890,9 @@ checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" [[package]] name = "windows_aarch64_msvc" -version = "0.53.0" +version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7651a1f62a11b8cbd5e0d42526e55f2c99886c77e007179efff86c2b137e66c" +checksum = "b9d782e804c2f632e395708e99a94275910eb9100b2114651e04744e9b125006" [[package]] name = "windows_i686_gnu" @@ -5871,9 +5908,9 @@ checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" [[package]] name = "windows_i686_gnu" -version = "0.53.0" +version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1dc67659d35f387f5f6c479dc4e28f1d4bb90ddd1a5d3da2e5d97b42d6272c3" +checksum = "960e6da069d81e09becb0ca57a65220ddff016ff2d6af6a223cf372a506593a3" [[package]] name = "windows_i686_gnullvm" @@ -5883,9 +5920,9 @@ checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" [[package]] name = "windows_i686_gnullvm" -version = "0.53.0" +version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ce6ccbdedbf6d6354471319e781c0dfef054c81fbc7cf83f338a4296c0cae11" +checksum = "fa7359d10048f68ab8b09fa71c3daccfb0e9b559aed648a8f95469c27057180c" [[package]] name = "windows_i686_msvc" @@ -5901,9 +5938,9 @@ checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" [[package]] name = "windows_i686_msvc" -version = "0.53.0" +version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "581fee95406bb13382d2f65cd4a908ca7b1e4c2f1917f143ba16efe98a589b5d" +checksum = "1e7ac75179f18232fe9c285163565a57ef8d3c89254a30685b57d83a38d326c2" [[package]] name = "windows_x86_64_gnu" @@ -5919,9 +5956,9 @@ checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" [[package]] name = "windows_x86_64_gnu" -version = "0.53.0" +version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e55b5ac9ea33f2fc1716d1742db15574fd6fc8dadc51caab1c16a3d3b4190ba" +checksum = "9c3842cdd74a865a8066ab39c8a7a473c0778a3f29370b5fd6b4b9aa7df4a499" [[package]] name = "windows_x86_64_gnullvm" @@ -5937,9 +5974,9 @@ checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" [[package]] name = "windows_x86_64_gnullvm" -version = "0.53.0" +version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a6e035dd0599267ce1ee132e51c27dd29437f63325753051e71dd9e42406c57" +checksum = "0ffa179e2d07eee8ad8f57493436566c7cc30ac536a3379fdf008f47f6bb7ae1" [[package]] name = "windows_x86_64_msvc" @@ -5955,9 +5992,9 @@ checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" [[package]] name = "windows_x86_64_msvc" -version = "0.53.0" +version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "271414315aff87387382ec3d271b52d7ae78726f5d44ac98b4f4030c91880486" +checksum = "d6bbff5f0aada427a1e5a6da5f1f98158182f26556f345ac9e04d36d0ebed650" [[package]] name = "winnow" @@ -6080,15 +6117,6 @@ dependencies = [ "wit-parser", ] -[[package]] -name = "wit-bindgen-rt" -version = "0.39.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f42320e61fe2cfd34354ecb597f86f413484a798ba44a8ca1165c58d42da6c1" -dependencies = [ - "bitflags 2.9.1", -] - [[package]] name = "wit-bindgen-rust" version = "0.46.0" @@ -6127,7 +6155,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "88a866b19dba2c94d706ec58c92a4c62ab63e482b4c935d2a085ac94caecb136" dependencies = [ "anyhow", - "bitflags 2.9.1", + "bitflags", "indexmap", "log", "serde", @@ -6149,7 +6177,7 @@ dependencies = [ "id-arena", "indexmap", "log", - "semver 1.0.26", + "semver 1.0.27", "serde", "serde_derive", "serde_json", @@ -6193,18 +6221,18 @@ checksum = "cfe53a6657fd280eaa890a3bc59152892ffa3e30101319d168b781ed6529b049" [[package]] name = "zerocopy" -version = "0.8.26" +version = "0.8.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1039dd0d3c310cf05de012d8a39ff557cb0d23087fd44cad61df08fc31907a2f" +checksum = "0894878a5fa3edfd6da3f88c4805f4c8558e2b996227a3d864f47fe11e38282c" dependencies = [ "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.8.26" +version = "0.8.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ecf5b4cc5364572d7f4c329661bcc82724222973f2cab6f050a4e5c22f75181" +checksum = "88d2b8d9c68ad2b9e4340d7832716a4d21a22a1154777ad56ea55c51a9cf3831" dependencies = [ "proc-macro2", "quote", @@ -6213,6 +6241,6 @@ dependencies = [ [[package]] name = "zeroize" -version = "1.8.1" +version = "1.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" +checksum = "b97154e67e32c85465826e8bcc1c59429aaaf107c1e4a9e53c8d8ccd5eff88d0" From 6db40daf183713a977cbf3e1acc72bbd923219e4 Mon Sep 17 00:00:00 2001 From: Denys Zadorozhnyi Date: Tue, 11 Nov 2025 19:05:24 +0200 Subject: [PATCH 10/19] chore: more clippy --- benches/src/lib.rs | 4 ++-- midenc-session/src/lib.rs | 2 +- tools/cargo-miden/src/commands/example_project.rs | 4 ++-- tools/cargo-miden/src/target.rs | 5 ++--- tools/cargo-miden/src/template.rs | 6 +++--- 5 files changed, 10 insertions(+), 11 deletions(-) diff --git a/benches/src/lib.rs b/benches/src/lib.rs index ff224a423..c7b70bb2d 100644 --- a/benches/src/lib.rs +++ b/benches/src/lib.rs @@ -109,7 +109,7 @@ impl BenchmarkRunner { if !output.status.success() { let stderr = String::from_utf8_lossy(&output.stderr); - return Err(anyhow::anyhow!("cargo miden build failed: {}", stderr)); + return Err(anyhow::anyhow!("cargo miden build failed: {stderr}")); } let compile_time = compile_start.elapsed(); @@ -158,7 +158,7 @@ stack = [{}]"#, if !output.status.success() { let stderr = String::from_utf8_lossy(&output.stderr); - return Err(anyhow::anyhow!("midenc run failed: {}", stderr)); + return Err(anyhow::anyhow!("midenc run failed: {stderr}")); } let stdout = String::from_utf8_lossy(&output.stdout); diff --git a/midenc-session/src/lib.rs b/midenc-session/src/lib.rs index 1fb1742cc..7b5b551fa 100644 --- a/midenc-session/src/lib.rs +++ b/midenc-session/src/lib.rs @@ -472,7 +472,7 @@ impl FromStr for TargetEnv { "rollup:authentication-component" => Ok(Self::Rollup { target: RollupTarget::AuthComponent, }), - _ => Err(anyhow::anyhow!("invalid target environment: {}", s)), + _ => Err(anyhow::anyhow!("invalid target environment: {s}")), } } } diff --git a/tools/cargo-miden/src/commands/example_project.rs b/tools/cargo-miden/src/commands/example_project.rs index 0de09fb94..fed87993a 100644 --- a/tools/cargo-miden/src/commands/example_project.rs +++ b/tools/cargo-miden/src/commands/example_project.rs @@ -68,8 +68,8 @@ impl ExampleCommand { // Check if directory already exists if project_path.exists() { return Err(anyhow::anyhow!( - "Directory '{}' already exists. Please remove it or choose a different location.", - project_name + "Directory '{project_name}' already exists. Please remove it or choose a \ + different location." )); } diff --git a/tools/cargo-miden/src/target.rs b/tools/cargo-miden/src/target.rs index 2fe5cec69..ba5ec33ff 100644 --- a/tools/cargo-miden/src/target.rs +++ b/tools/cargo-miden/src/target.rs @@ -49,9 +49,8 @@ pub fn detect_target_environment(root_pkg: &Package) -> Result { target: RollupTarget::AuthComponent, }), _ => bail!( - "Invalid value '{}' for 'project-kind' in [package.metadata.miden]. Must be one of: \ - 'account', 'note-script', or 'transaction-script'", - kind_str + "Invalid value '{kind_str}' for 'project-kind' in [package.metadata.miden]. Must be \ + one of: 'account', 'note-script', or 'transaction-script'" ), } } diff --git a/tools/cargo-miden/src/template.rs b/tools/cargo-miden/src/template.rs index 3e89429e5..2a1e7ec97 100644 --- a/tools/cargo-miden/src/template.rs +++ b/tools/cargo-miden/src/template.rs @@ -150,7 +150,7 @@ fn clone_repository(repo: &str, template_path: &TemplatePath, destination: &Path .status() .with_context(|| format!("Failed to clone template repository '{repo}'"))?; if !status.success() { - bail!("`git clone {repo}` exited with {}", status); + bail!("`git clone {repo}` exited with {status}"); } if let Some(rev) = template_path.rev.as_ref() { @@ -165,7 +165,7 @@ fn clone_repository(repo: &str, template_path: &TemplatePath, destination: &Path .with_context(|| format!("Failed to checkout revision '{rev}'"))?; if !status.success() { - bail!("`git checkout {rev}` exited with {}", status); + bail!("`git checkout {rev}` exited with {status}"); } } @@ -321,7 +321,7 @@ fn initialise_git_repo(project_dir: &Path) -> Result<()> { .context("Failed to execute `git init`")?; if !status.success() { - bail!("`git init` exited with {}", status); + bail!("`git init` exited with {status}"); } Ok(()) From ed108660590dc41a4b56c044e781838d266e8db4 Mon Sep 17 00:00:00 2001 From: Paul Schoenfelder Date: Tue, 11 Nov 2025 15:11:53 -0500 Subject: [PATCH 11/19] fix: remove midenc-hir-type from workspace deps --- Cargo.toml | 1 - hir/Cargo.toml | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 6b5ad286e..100163384 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -144,7 +144,6 @@ midenc-hir-eval = { version = "0.5.0", path = "eval" } midenc-hir-macros = { version = "0.5.0", path = "hir-macros" } midenc-hir-symbol = { version = "0.5.0", path = "hir-symbol" } midenc-hir-transform = { version = "0.5.0", path = "hir-transform" } -midenc-hir-type = { version = "0.4.3" } midenc-frontend-wasm = { version = "0.5.0", path = "frontend/wasm" } midenc-compile = { version = "0.5.0", path = "midenc-compile" } midenc-driver = { version = "0.5.0", path = "midenc-driver" } diff --git a/hir/Cargo.toml b/hir/Cargo.toml index 990f46e94..ad729b366 100644 --- a/hir/Cargo.toml +++ b/hir/Cargo.toml @@ -29,7 +29,7 @@ inventory.workspace = true log.workspace = true miden-core.workspace = true midenc-hir-symbol.workspace = true -midenc-hir-type.workspace = true +midenc-hir-type = "0.4" midenc-hir-macros.workspace = true midenc-session.workspace = true rustc-hash.workspace = true From a4ab3857b062e9dea25a476023d7674c64bb0166 Mon Sep 17 00:00:00 2001 From: Paul Schoenfelder Date: Tue, 11 Nov 2025 17:48:39 -0500 Subject: [PATCH 12/19] chore: split midenc-hir-type into its own repo --- Cargo.lock | 15 +- Cargo.toml | 1 - hir-type/CHANGELOG.md | 105 ----- hir-type/Cargo.toml | 23 -- hir-type/README.md | 9 - hir-type/src/alignable.rs | 218 ---------- hir-type/src/array_type.rs | 69 ---- hir-type/src/function_type/abi.rs | 194 --------- hir-type/src/function_type/mod.rs | 104 ----- hir-type/src/layout.rs | 660 ------------------------------ hir-type/src/lib.rs | 368 ----------------- hir-type/src/pointer_type.rs | 117 ------ hir-type/src/struct_type.rs | 339 --------------- 13 files changed, 2 insertions(+), 2220 deletions(-) delete mode 100644 hir-type/CHANGELOG.md delete mode 100644 hir-type/Cargo.toml delete mode 100644 hir-type/README.md delete mode 100644 hir-type/src/alignable.rs delete mode 100644 hir-type/src/array_type.rs delete mode 100644 hir-type/src/function_type/abi.rs delete mode 100644 hir-type/src/function_type/mod.rs delete mode 100644 hir-type/src/layout.rs delete mode 100644 hir-type/src/lib.rs delete mode 100644 hir-type/src/pointer_type.rs delete mode 100644 hir-type/src/struct_type.rs diff --git a/Cargo.lock b/Cargo.lock index 5a1642885..4fa57e0ae 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2223,7 +2223,7 @@ dependencies = [ "miden-core", "miden-debug-types", "miden-utils-diagnostics", - "midenc-hir-type 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", + "midenc-hir-type", "proptest", "regex", "rustc_version 0.4.1", @@ -2951,7 +2951,7 @@ dependencies = [ "miden-thiserror", "midenc-hir-macros", "midenc-hir-symbol", - "midenc-hir-type 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", + "midenc-hir-type", "midenc-session", "pretty_assertions", "rustc-demangle", @@ -3027,17 +3027,6 @@ dependencies = [ "midenc-session", ] -[[package]] -name = "midenc-hir-type" -version = "0.4.3" -dependencies = [ - "miden-formatting", - "serde", - "serde_repr", - "smallvec", - "thiserror 2.0.17", -] - [[package]] name = "midenc-hir-type" version = "0.4.3" diff --git a/Cargo.toml b/Cargo.toml index 100163384..95cabac26 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,7 +11,6 @@ members = [ "hir-macros", "hir-symbol", "hir-transform", - "hir-type", "midenc", "midenc-compile", "midenc-driver", diff --git a/hir-type/CHANGELOG.md b/hir-type/CHANGELOG.md deleted file mode 100644 index 0193b8b20..000000000 --- a/hir-type/CHANGELOG.md +++ /dev/null @@ -1,105 +0,0 @@ -# Changelog -All notable changes to this project will be documented in this file. - -The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), -and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). - -## [Unreleased] - -## [0.4.3](https://github.com/0xMiden/compiler/compare/midenc-hir-type-v0.4.2...midenc-hir-type-v0.4.3) - 2025-11-05 - -### Other - -- Revert "Merge pull request #700 from 0xMiden/revert-docs-merge" -- Revert "Merge pull request #692 from 0xMiden/chore/docusaurus-migration-next" -- *(README)* add docs section explainer - -## [0.4.2] - -### Added - -- Added `TypeRepr::BigEndian` to aid in making some existing legacy protocol library types representable in the type system, to be used as a temporary -work-around until we are able to redefine those types in a standard layout - -## [0.4.0](https://github.com/0xMiden/compiler/compare/midenc-hir-type-v0.1.5...midenc-hir-type-v0.4.0) - 2025-08-15 - -### Other - -- update Rust toolchain nightly-2025-07-20 (1.90.0-nightly) - -## [0.0.8](https://github.com/0xMiden/compiler/compare/midenc-hir-type-v0.0.7...midenc-hir-type-v0.0.8) - 2025-04-24 - -### Added -- *(types)* clean up hir-type for use outside the compiler -- implement pretty-print trait for Symbol/Type - -### Other -- treat warnings as compiler errors, -- update rust toolchain, clean up deps -- implement hir dialect ops, flesh out remaining core ir infra - -## [0.0.7](https://github.com/0xPolygonMiden/compiler/compare/midenc-hir-type-v0.0.6...midenc-hir-type-v0.0.7) - 2024-09-17 - -### Other -- fix up new clippy warnings - -## [0.0.6](https://github.com/0xpolygonmiden/compiler/compare/midenc-hir-type-v0.0.5...midenc-hir-type-v0.0.6) - 2024-09-06 - -### Other -- switch all crates to a single workspace version (0.0.5) - -## [0.0.3](https://github.com/0xPolygonMiden/compiler/compare/midenc-hir-type-v0.0.2...midenc-hir-type-v0.0.3) - 2024-08-30 - -### Fixed -- *(codegen)* broken return via pointer transformation - -### Other -- Merge pull request [#284](https://github.com/0xPolygonMiden/compiler/pull/284) from 0xPolygonMiden/bitwalker/abi-transform-test-fixes - -## [0.0.2](https://github.com/0xPolygonMiden/compiler/compare/midenc-hir-type-v0.0.1...midenc-hir-type-v0.0.2) - 2024-08-28 - -### Added -- implement packaging prototype - -## [0.0.1](https://github.com/0xPolygonMiden/compiler/compare/midenc-hir-type-v0.0.0...midenc-hir-type-v0.0.1) - 2024-07-18 - -### Added -- draft Miden ABI function types encoding and retrieval -- introduce Miden ABI component import -- introduce `CanonicalOptions` in IR and translate Wasm -- implement new sexpr-based format for hir -- rewrite type layout functionality -- refactor type layout primitives -- define type compatibility for operators -- provide type representation enum -- implement inline assembly -- distinguish signed/unsigned types, native/emulated pointers - -### Fixed -- issue with i1 widening casts -- felt representation mismatch between rust and miden -- *(ir)* incorrect entries in operand compatibility matrix -- use stabilized next_multiple_of in alignable impls -- switch text representation of the `MidenAbiFunctionType` to s-exp; -- rewrite incorrect type layout code - -### Other -- fix typos ([#243](https://github.com/0xPolygonMiden/compiler/pull/243)) -- Fix descriptions for crates -- set crates versions to 0.0.0, and `publish = false` for tests -- add a description for miden-hir-type crate -- ensure all relevant crates are prefixed with `midenc-` -- since all the Miden ABI transformation happens in the frontend -- add `FunctionType::abi` and ditch redundant `*FunctionType` -- add Wasm component translation support to the integration tests; -- add formatter config, format most crates -- update rust toolchain to latest nightly -- Merge pull request [#100](https://github.com/0xPolygonMiden/compiler/pull/100) from 0xPolygonMiden/greenhat/i89-translate-wasm-cm -- move `LiftedFunctionType` to `miden-hir-type` crate -- set up mdbook deploy -- add guides for compiling rust->masm -- add mdbook skeleton -- rework the ir to better suit wasm->masm -- split up hir crate -- provide some initial usage instructions -- Initial commit diff --git a/hir-type/Cargo.toml b/hir-type/Cargo.toml deleted file mode 100644 index e44e1c174..000000000 --- a/hir-type/Cargo.toml +++ /dev/null @@ -1,23 +0,0 @@ -[package] -name = "midenc-hir-type" -description = "Type system and utilities for Miden HIR" -version = "0.4.3" -rust-version = "1.88" -authors.workspace = true -repository.workspace = true -categories.workspace = true -keywords.workspace = true -license.workspace = true -readme.workspace = true -edition.workspace = true - -[features] -default = ["serde"] -serde = ["dep:serde", "dep:serde_repr", "smallvec/serde"] - -[dependencies] -miden-formatting.workspace = true -smallvec.workspace = true -serde = { workspace = true, optional = true } -serde_repr = { version = "0.1", optional = true } -thiserror = { version = "2.0", default-features = false } diff --git a/hir-type/README.md b/hir-type/README.md deleted file mode 100644 index 0c91f89bc..000000000 --- a/hir-type/README.md +++ /dev/null @@ -1,9 +0,0 @@ -# hir-type - -This crate defines the type system used by Miden's compiler infrastructure, as well as in its assembler and packaging crates. - -See the crate documentation for details on the type system and its APIs. - -# License - -MIT diff --git a/hir-type/src/alignable.rs b/hir-type/src/alignable.rs deleted file mode 100644 index eb9fe2f3a..000000000 --- a/hir-type/src/alignable.rs +++ /dev/null @@ -1,218 +0,0 @@ -/// This trait represents an alignable primitive integer value representing an address -pub trait Alignable { - /// This function computes the offset, in bytes, needed to align `self` upwards so that - /// it is aligned to `align` bytes. - /// - /// The following must be true, or this function will panic: - /// - /// * `align` is non-zero - /// * `align` is a power of two - fn align_offset(self, align: Self) -> Self; - /// This function aligns `self` to the specified alignment (in bytes), aligning upwards. - /// - /// The following must be true, or this function will panic: - /// - /// * `align` is non-zero - /// * `align` is a power of two - /// * `self` + `align` must be less than `Self::MAX` - fn align_up(self, align: Self) -> Self; - - /// Compute the nearest power of two less than or equal to `self` - fn prev_power_of_two(self) -> Self; -} - -macro_rules! alignable { - ($($ty:ty),+) => { - $( - alignable_impl!($ty); - )* - }; -} - -macro_rules! alignable_impl { - ($ty:ty) => { - #[allow(unstable_name_collisions)] - impl Alignable for $ty { - #[inline] - fn align_offset(self, align: Self) -> Self { - self.align_up(align) - self - } - - #[inline] - fn align_up(self, align: Self) -> Self { - assert_ne!(align, 0); - assert!(align.is_power_of_two()); - self.checked_next_multiple_of(align).expect("alignment overflow") - } - - #[inline] - fn prev_power_of_two(self) -> Self { - if self.is_power_of_two() { - self - } else { - core::cmp::max(self.next_power_of_two() / 2, 1) - } - } - } - }; -} - -alignable!(u8, u16, u32, u64, usize); - -#[cfg(test)] -mod tests { - use super::*; - - #[test] - fn alignable_next_multiple_of() { - let addr = 0u32; - assert_eq!(addr.next_multiple_of(1), 0); - assert_eq!(addr.next_multiple_of(2), 0); - assert_eq!(addr.next_multiple_of(4), 0); - assert_eq!(addr.next_multiple_of(8), 0); - assert_eq!(addr.next_multiple_of(16), 0); - assert_eq!(addr.next_multiple_of(32), 0); - - let addr = 1u32; - assert_eq!(addr.next_multiple_of(1), 1); - assert_eq!(addr.next_multiple_of(2), 2); - assert_eq!(addr.next_multiple_of(4), 4); - assert_eq!(addr.next_multiple_of(8), 8); - assert_eq!(addr.next_multiple_of(16), 16); - assert_eq!(addr.next_multiple_of(32), 32); - - let addr = 2u32; - assert_eq!(addr.next_multiple_of(1), 2); - assert_eq!(addr.next_multiple_of(2), 2); - assert_eq!(addr.next_multiple_of(4), 4); - assert_eq!(addr.next_multiple_of(8), 8); - assert_eq!(addr.next_multiple_of(16), 16); - assert_eq!(addr.next_multiple_of(32), 32); - - let addr = 3u32; - assert_eq!(addr.next_multiple_of(1), 3); - assert_eq!(addr.next_multiple_of(2), 4); - assert_eq!(addr.next_multiple_of(4), 4); - assert_eq!(addr.next_multiple_of(8), 8); - assert_eq!(addr.next_multiple_of(16), 16); - assert_eq!(addr.next_multiple_of(32), 32); - - let addr = 127u32; - assert_eq!(addr.next_multiple_of(1), 127); - assert_eq!(addr.next_multiple_of(2), 128); - assert_eq!(addr.next_multiple_of(4), 128); - assert_eq!(addr.next_multiple_of(8), 128); - assert_eq!(addr.next_multiple_of(16), 128); - assert_eq!(addr.next_multiple_of(32), 128); - - let addr = 130u32; - assert_eq!(addr.next_multiple_of(1), 130); - assert_eq!(addr.next_multiple_of(2), 130); - assert_eq!(addr.next_multiple_of(4), 132); - assert_eq!(addr.next_multiple_of(8), 136); - assert_eq!(addr.next_multiple_of(16), 144); - assert_eq!(addr.next_multiple_of(32), 160); - } - - #[test] - fn alignable_align_offset_test() { - let addr = 0u32; - assert_eq!(addr.align_offset(1), 0); - assert_eq!(addr.align_offset(2), 0); - assert_eq!(addr.align_offset(4), 0); - assert_eq!(addr.align_offset(8), 0); - assert_eq!(addr.align_offset(16), 0); - assert_eq!(addr.align_offset(32), 0); - - let addr = 1u32; - assert_eq!(addr.align_offset(1), 0); - assert_eq!(addr.align_offset(2), 1); - assert_eq!(addr.align_offset(4), 3); - assert_eq!(addr.align_offset(8), 7); - assert_eq!(addr.align_offset(16), 15); - assert_eq!(addr.align_offset(32), 31); - - let addr = 2u32; - assert_eq!(addr.align_offset(1), 0); - assert_eq!(addr.align_offset(2), 0); - assert_eq!(addr.align_offset(4), 2); - assert_eq!(addr.align_offset(8), 6); - assert_eq!(addr.align_offset(16), 14); - assert_eq!(addr.align_offset(32), 30); - - let addr = 3u32; - assert_eq!(addr.align_offset(1), 0); - assert_eq!(addr.align_offset(2), 1); - assert_eq!(addr.align_offset(4), 1); - assert_eq!(addr.align_offset(8), 5); - assert_eq!(addr.align_offset(16), 13); - assert_eq!(addr.align_offset(32), 29); - - let addr = 127u32; - assert_eq!(addr.align_offset(1), 0); - assert_eq!(addr.align_offset(2), 1); - assert_eq!(addr.align_offset(4), 1); - assert_eq!(addr.align_offset(8), 1); - assert_eq!(addr.align_offset(16), 1); - assert_eq!(addr.align_offset(32), 1); - - let addr = 130u32; - assert_eq!(addr.align_offset(1), 0); - assert_eq!(addr.align_offset(2), 0); - assert_eq!(addr.align_offset(4), 2); - assert_eq!(addr.align_offset(8), 6); - assert_eq!(addr.align_offset(16), 14); - assert_eq!(addr.align_offset(32), 30); - } - - #[test] - fn alignable_align_up_test() { - let addr = 0u32; - assert_eq!(addr.align_up(1), 0); - assert_eq!(addr.align_up(2), 0); - assert_eq!(addr.align_up(4), 0); - assert_eq!(addr.align_up(8), 0); - assert_eq!(addr.align_up(16), 0); - assert_eq!(addr.align_up(32), 0); - - let addr = 1u32; - assert_eq!(addr.align_up(1), 1); - assert_eq!(addr.align_up(2), 2); - assert_eq!(addr.align_up(4), 4); - assert_eq!(addr.align_up(8), 8); - assert_eq!(addr.align_up(16), 16); - assert_eq!(addr.align_up(32), 32); - - let addr = 2u32; - assert_eq!(addr.align_up(1), 2); - assert_eq!(addr.align_up(2), 2); - assert_eq!(addr.align_up(4), 4); - assert_eq!(addr.align_up(8), 8); - assert_eq!(addr.align_up(16), 16); - assert_eq!(addr.align_up(32), 32); - - let addr = 3u32; - assert_eq!(addr.align_up(1), 3); - assert_eq!(addr.align_up(2), 4); - assert_eq!(addr.align_up(4), 4); - assert_eq!(addr.align_up(8), 8); - assert_eq!(addr.align_up(16), 16); - assert_eq!(addr.align_up(32), 32); - - let addr = 127u32; - assert_eq!(addr.align_up(1), 127); - assert_eq!(addr.align_up(2), 128); - assert_eq!(addr.align_up(4), 128); - assert_eq!(addr.align_up(8), 128); - assert_eq!(addr.align_up(16), 128); - assert_eq!(addr.align_up(32), 128); - - let addr = 130u32; - assert_eq!(addr.align_up(1), 130); - assert_eq!(addr.align_up(2), 130); - assert_eq!(addr.align_up(4), 132); - assert_eq!(addr.align_up(8), 136); - assert_eq!(addr.align_up(16), 144); - assert_eq!(addr.align_up(32), 160); - } -} diff --git a/hir-type/src/array_type.rs b/hir-type/src/array_type.rs deleted file mode 100644 index 6c0e1af11..000000000 --- a/hir-type/src/array_type.rs +++ /dev/null @@ -1,69 +0,0 @@ -use super::{Alignable, Type}; - -/// A fixed-size, homogenous vector type. -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -pub struct ArrayType { - pub ty: Type, - pub len: usize, -} - -impl ArrayType { - /// Create a new [ArrayType] of length `len` and element type of `ty` - pub fn new(ty: Type, len: usize) -> Self { - Self { ty, len } - } - - /// Get the size of this array type - #[allow(clippy::len_without_is_empty)] - pub fn len(&self) -> usize { - self.len - } - - /// Get the element type of this array type - pub fn element_type(&self) -> &Type { - &self.ty - } - - /// Returns true if this array type represents a zero-sized type - pub fn is_zst(&self) -> bool { - self.len == 0 || self.ty.is_zst() - } - - /// Returns the minimum alignment required by this type - pub fn min_alignment(&self) -> usize { - self.ty.min_alignment() - } - - /// Returns the size in bits of this array type - pub fn size_in_bits(&self) -> usize { - match self.len { - // Zero-sized arrays have no size in memory - 0 => 0, - // An array of one element is the same as just the element - 1 => self.ty.size_in_bits(), - // All other arrays require alignment padding between elements - n => { - let min_align = self.ty.min_alignment() * 8; - let element_size = self.ty.size_in_bits(); - let padded_element_size = element_size.align_up(min_align); - element_size + (padded_element_size * (n - 1)) - } - } - } -} - -impl core::fmt::Display for ArrayType { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - use miden_formatting::prettier::PrettyPrint; - self.pretty_print(f) - } -} - -impl miden_formatting::prettier::PrettyPrint for ArrayType { - fn render(&self) -> miden_formatting::prettier::Document { - use miden_formatting::prettier::*; - - const_text("[") + self.ty.render() + const_text("; ") + self.len.render() + const_text("]") - } -} diff --git a/hir-type/src/function_type/abi.rs b/hir-type/src/function_type/abi.rs deleted file mode 100644 index 0bc6ef160..000000000 --- a/hir-type/src/function_type/abi.rs +++ /dev/null @@ -1,194 +0,0 @@ -use core::fmt; - -/// Represents the calling convention of a function. -/// -/// Calling conventions are part of a program's ABI (Application Binary Interface), and defines the -/// contract between caller and callee, by specifying the architecture-specific details of how -/// arguments are passed, results are returned, what effects may/will occur (e.g. context switches), -/// etc. -/// -/// Additionally, calling conventions define the set of allowed types for function arguments and -/// results, and how those types are represented in the target ABI. It may impose additional -/// restrictions on callers, such as only allowing calls under specific conditions. -/// -/// It is not required that callers be functions of the same convention as the callee, it is -/// perfectly acceptable to mix conventions in a program. The only requirement is that the -/// convention used at a given call site, matches the convention of the callee, i.e. it must -/// be the case that caller and callee agree on the convention used for that call. -#[derive(Debug, Copy, Clone, PartialEq, Eq, Default, Hash)] -#[cfg_attr( - feature = "serde", - derive(serde_repr::Serialize_repr, serde_repr::Deserialize_repr) -)] -#[repr(u8)] -pub enum CallConv { - /// This convention passes all arguments and results by value, and thus requires that the types - /// of its arguments and results be valid immediates in the Miden ABI. The representation of - /// those types on the operand stack is specified by the Miden ABI. - /// - /// Additional properties of this convention: - /// - /// * It is always executed in the caller's context - /// * May only be the target of a `exec` or `dynexec` instruction - /// * Must not require more than 16 elements of the operand stack for arguments or results - /// * Callees are expected to preserve the state of the operand stack following the function - /// arguments, such that from the caller's perspective, the effect of the call on the operand - /// stack is as if the function arguments had been popped, and the function results were - /// pushed. - /// - /// This convention is optimal when both caller and callee are in the same language, no context - /// switching is required, and the arguments and results can be passed on the operand stack - /// without the potential for overflow. - Fast, - /// The C calling convention, as specified for System V (x86), adapted to Miden's ABI. - /// - /// The purpose of this convention is to support cross-language interop via a foreign function - /// interface (FFI) based on the C data layout rules. It is specifically designed for interop - /// occurring _within_ the same context. For cross-language, cross-context interop, we require - /// the use of the Wasm Component Model, see the `CanonLift` convention for more. - /// - /// Notable properties of this convention: - /// - /// * It is always executed in the caller's context - /// * May only be the target of a `exec` or `dynexec` instruction - /// * Supports any IR type that corresponds to a valid C type (i.e. structs, arrays, etc.) - /// * Aggregates (structs and arrays) must be returned by reference, where the caller is - /// responsible for allocating the memory to which the return value will be written. The - /// caller passes the pointer to that memory as the first parameter of the function, which - /// must be of matching pointer type, and marked with the `sret` attribute. When the "struct - /// return" protocol is in use, the function does not return any values directly. - /// * Aggregates up to 64 bits may be passed by value, all other structs must be passed by - /// reference. - /// * Integer types up to 128 bits are supported, and are passed by value - /// * Floating-point types are not supported - /// * Callees must preserve the state of the operand stack following the function arguments - /// * If the function arguments require more than 16 elements of the operand stack to represent, - /// then arguments will be spilled to the caller's stack frame, such that no more than 15 - /// elements are required. The caller must then obtain the value of the stack pointer on - /// entry, and offset it to access spilled arguments as desired. The arguments are spilled - /// in reverse order, i.e. the last argument in the argument list has the greatest offset, - /// while the first argument of the argument list to be spilled starts at `sp` (the value - /// of the stack pointer on entry). - /// - /// NOTE: This convention is non-optimal if not being used for cross-language interop. - /// - #[default] - SystemV, - /// This convention is used to represent functions translated from WebAssembly. - /// - /// It has the following properties: - /// - /// * It is always executed in the caller's context - /// * May only be the target of a `exec` or `dynexec` instruction - /// * Only supports IR types which correspond to a valid WebAssembly type. Notably this does - /// not include aggregates (except via reference types, which are not currently supported). - /// * Floating-point types are not allowed, except `f32` which is used to represent field - /// elements in the WebAssembly type system. - /// * Callees must preserve the state of the operand stack following the function arguments - /// * Uses the same argument spilling strategy as the `SystemV` convention - Wasm, - /// This convention represents one of the host-defined primitives of the Wasm Component Model. - /// - /// In particular, this convention corresponds to functions synthesized via a `(canon lift)` - /// declaration, which is used to export a core Wasm function with a Canonical ABI signature. - /// These synthesized functions are responsible for "lowering" arguments out of the Canonical - /// ABI into a `Wasm`-compatible representation, and "lifting" results back into the Canonical - /// ABI. - /// - /// NOTE: Some important details of this calling convention are described by the Canonical ABI - /// spec covering the `canon lift` primitive, as well as how types are lifted/lowered from/to - /// the "flattened" core Wasm type representation. See - /// [this document](https://github.com/WebAssembly/component-model/blob/main/design/mvp/CanonicalABI.md#lifting-and-lowering-values) - /// for those details, and other useful information about the Canonical ABI. - /// - /// It has the following properties: - /// - /// * It is always executed in a new context - /// * May only be the target of a `call` or `dyncall` instruction - /// * May only be called from a `CanonLower` function - /// * Only supports IR types which correspond to a valid Canonical ABI type. Notably this does - /// not include pointer types. No support for `resource` types exists at this time due to - /// limitations of the Miden VM. - /// * Callers must ensure that sensitive data is removed from the first 16 elements of the - /// operand stack when lowering calls to `CanonLift` functions. This compiler will zero-pad - /// the unused portions of the operand stack where applicable. - /// * If the function arguments require more than 16 elements of the operand stack to represent, - /// then arguments will be spilled to the advice provider, as a block of memory (in words) - /// sufficiently large to hold all of the spilled arguments. The block will be hashed and - /// the digest used as the key in the advice map under which the block will be stored. The - /// digest will then be passed by-value to the callee as the first argument. This requires - /// a word (4 elements) of operand stack to be unused, so when spilling arguments, the first - /// 12 elements are preserved, while the rest are spilled. The callee is expected to, as part - /// of its prologue, immediately fetch the spilled arguments from the advice map using the - /// provided digest on top of the operand stack, and write them into the current stack frame. - /// The spilled arguments can then be accessed by computing the offset from the stack pointer - /// to the desired argument. Note that, like the spill strategy for `SystemV`, the spilled - /// arguments will be written into memory in reverse order (the closer to the front of the - /// argument list, the smaller the offset). - /// - /// Unlike `CanonLower`, the details of this calling convention are stable, as it is designed - /// expressly for cross-language, cross-context interop, and is in fact the only supported - /// way to represent cross-context function calls at this time. - CanonLift, - /// This convention represents one of the host-defined primitives of the Wasm Component Model. - /// - /// In particular, this convention corresponds to functions synthesized via a `(canon lower)` - /// declaration, which is used to import a Canonical ABI function into a core Wasm module, - /// by providing a `Wasm`-compatible adapter for the underlying Canonical ABI function. These - /// synthesized functions are responsible for "lifting" the core Wasm arguments into the - /// Canonical ABI representation, and "lowering" the results out of that representation. - /// - /// This convention is identical to `Wasm`, with the following additional properties: - /// - /// * It is the only convention which may contain calls to a `CanonLift` function - /// * Functions using this convention are not allowed to have `Public` visibility - /// * Functions using this convention are considered to be compiler-generated, and thus are - /// aggressively inlined/eliminated where possible. - /// - /// This should be considered an unstable, compiler-internal calling convention, and the details - /// of this convention can change at any time. Currently, it is only used by the Wasm frontend - /// to distinguish functions synthesized from a `(canon lower)`. - CanonLower, - /// This convention is like `Fast`, but indicates that the function implements a syscall as - /// part of a kernel module definition. - /// - /// Additional properties include: - /// - /// * It is always executed in the _root_ context, and therefore a context switch is - /// involved. - /// * This convention may only be called via the `syscall` instruction, and may not be - /// called from another `Kernel` function. - /// * This convention is only permitted on function _definitions_ when emitting a kernel library - /// * In addition to the type restrictions described by the `Fast` convention, it additionally - /// forbids any arguments/results of pointer type, due to the context switch that occurs. - Kernel, -} - -impl CallConv { - /// Returns true if this convention corresponds to one of the two Canonical ABI conventions - pub fn is_wasm_canonical_abi(&self) -> bool { - matches!(self, Self::CanonLift | Self::CanonLower) - } -} - -impl fmt::Display for CallConv { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - use miden_formatting::prettier::PrettyPrint; - self.pretty_print(f) - } -} - -impl miden_formatting::prettier::PrettyPrint for CallConv { - fn render(&self) -> miden_formatting::prettier::Document { - use miden_formatting::prettier::const_text; - - match self { - Self::Fast => const_text("fast"), - Self::SystemV => const_text("C"), - Self::Wasm => const_text("wasm"), - Self::CanonLift => const_text("canon-lift"), - Self::CanonLower => const_text("canon-lower"), - Self::Kernel => const_text("kernel"), - } - } -} diff --git a/hir-type/src/function_type/mod.rs b/hir-type/src/function_type/mod.rs deleted file mode 100644 index c60ce34e5..000000000 --- a/hir-type/src/function_type/mod.rs +++ /dev/null @@ -1,104 +0,0 @@ -mod abi; - -use core::fmt; - -use smallvec::SmallVec; - -pub use self::abi::CallConv; -use super::Type; - -/// This represents the type of a function, i.e. it's parameters and results, and expected calling -/// convention. -/// -/// Function types are reference types, i.e. they are always implicitly a handle/pointer to a -/// function, not a function value. -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -pub struct FunctionType { - /// The calling convention/ABI of the function represented by this type - pub abi: CallConv, - /// The parameter types of this function - pub params: SmallVec<[Type; 4]>, - /// The result types of this function - pub results: SmallVec<[Type; 1]>, -} -impl FunctionType { - /// Create a new function type with the given calling/convention ABI - pub fn new, R: IntoIterator>( - abi: CallConv, - params: P, - results: R, - ) -> Self { - Self { - abi, - params: params.into_iter().collect(), - results: results.into_iter().collect(), - } - } - - /// Set the calling convention/ABI for this function type - pub fn with_calling_convention(mut self, abi: CallConv) -> Self { - self.abi = abi; - self - } - - /// The calling convention/ABI represented by this function type - pub fn calling_convention(&self) -> CallConv { - self.abi - } - - /// The number of parameters expected by the function - pub fn arity(&self) -> usize { - self.params.len() - } - - /// The types of the function parameters as a slice - pub fn params(&self) -> &[Type] { - self.params.as_slice() - } - - /// The types of the function results as a slice - pub fn results(&self) -> &[Type] { - self.results.as_slice() - } -} - -impl fmt::Display for FunctionType { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - use miden_formatting::prettier::PrettyPrint; - self.pretty_print(f) - } -} - -impl miden_formatting::prettier::PrettyPrint for FunctionType { - fn render(&self) -> miden_formatting::prettier::Document { - use alloc::format; - - use miden_formatting::prettier::*; - - let abi = const_text("extern") + text(format!(" \"{}\" ", &self.abi)); - - let params = self.params.iter().enumerate().fold(const_text("("), |acc, (i, param)| { - if i > 0 { - acc + const_text(", ") + param.render() - } else { - acc + param.render() - } - }) + const_text(")"); - - let without_results = abi + const_text("fn") + params; - if self.results.is_empty() { - return without_results; - } - - let results = self.results.iter().enumerate().fold(Document::Empty, |acc, (i, item)| { - if i > 0 { - acc + const_text(", ") + item.render() - } else { - item.render() - } - }); - - without_results + const_text(" -> ") + results - } -} diff --git a/hir-type/src/layout.rs b/hir-type/src/layout.rs deleted file mode 100644 index a8b4acd56..000000000 --- a/hir-type/src/layout.rs +++ /dev/null @@ -1,660 +0,0 @@ -use alloc::{alloc::Layout, collections::VecDeque}; -use core::cmp::{self, Ordering}; - -use smallvec::{smallvec, SmallVec}; - -use super::*; - -const FELT_SIZE: usize = core::mem::size_of::(); -const WORD_SIZE: usize = core::mem::size_of::<[u32; 4]>(); - -impl Type { - /// Convert this type into a vector of types corresponding to how this type - /// will be represented in memory. - /// - /// The largest "part" size is 32 bits, so types that fit in 32 bits remain - /// unchanged. For types larger than 32 bits, they will be broken up into parts - /// that do fit in 32 bits, preserving accurate types to the extent possible. - /// For types smaller than 32 bits, they will be merged into packed structs no - /// larger than 32 bits, to preserve the type information, and make it possible - /// to reason about how to extract parts of the original type. - /// - /// For an example, a struct of type `{ *ptr, u8, u8 }` will be encoded on the - /// operand stack as `[*ptr, {u8, u8}]`, where the first value is the 32-bit pointer - /// field, and the remaining fields are encoded as a 16-bit struct in the second value. - pub fn to_raw_parts(self) -> Option> { - match self { - Type::Unknown => None, - ty => { - let mut parts = SmallVec::<[Type; 4]>::default(); - let (part, mut rest) = ty.split(4); - parts.push(part); - while let Some(ty) = rest.take() { - let (part, remaining) = ty.split(4); - parts.push(part); - rest = remaining; - } - Some(parts) - } - } - } - - /// Split this type into two parts: - /// - /// * The first part is no more than `n` bytes in size, and may contain the type itself if it - /// fits - /// * The second part is None if the first part is smaller than or equal in size to the - /// requested split size - /// * The second part is Some if there is data left in the original type after the split. This - /// part will be a type that attempts to preserve, to the extent possible, the original type - /// structure, but will fall back to an array of bytes if a larger type must be split down - /// the middle somewhere. - pub fn split(self, n: usize) -> (Type, Option) { - if n == 0 { - return (self, None); - } - - let size_in_bytes = self.size_in_bytes(); - if n >= size_in_bytes { - return (self, None); - } - - // The type is larger than the split size - match self { - ty @ (Self::U256 - | Self::I128 - | Self::U128 - | Self::I64 - | Self::U64 - | Self::F64 - | Self::Felt - | Self::I32 - | Self::U32 - | Self::Ptr(_) - | Self::I16 - | Self::U16 - | Self::Function(_)) => { - let len = ty.size_in_bytes(); - let remaining = len - n; - match (n, remaining) { - (0, _) | (_, 0) => unreachable!(), - (1, 1) => (Type::U8, Some(Type::U8)), - (1, remaining) => { - (Type::U8, Some(Type::from(ArrayType::new(Type::U8, remaining)))) - } - (taken, 1) => (Type::from(ArrayType::new(Type::U8, taken)), Some(Type::U8)), - (taken, remaining) => ( - Type::from(ArrayType::new(Type::U8, taken)), - Some(Type::from(ArrayType::new(Type::U8, remaining))), - ), - } - } - Self::Array(array_type) => match &*array_type { - ArrayType { - ty: elem_ty, - len: 1, - } => elem_ty.clone().split(n), - ArrayType { - ty: elem_ty, - len: array_len, - } => { - let elem_size = elem_ty.size_in_bytes(); - if n >= elem_size { - // The requested split consumes 1 or more elements.. - let take = n / elem_size; - let extra = n % elem_size; - if extra == 0 { - // The split is on an element boundary - let split = match take { - 1 => (*elem_ty).clone(), - _ => Self::from(ArrayType::new(elem_ty.clone(), take)), - }; - let rest = match array_len - take { - 0 => unreachable!(), - 1 => elem_ty.clone(), - len => Self::from(ArrayType::new(elem_ty.clone(), len)), - }; - (split, Some(rest)) - } else { - // The element type must be split somewhere in order to get the input type - // down to the requested size - let (partial1, partial2) = (*elem_ty).clone().split(elem_size - extra); - match array_len - take { - 0 => unreachable!(), - 1 => { - let taken = Self::from(ArrayType::new(elem_ty.clone(), take)); - let split = Self::from(StructType::new_with_repr( - TypeRepr::packed(1), - [taken, partial1], - )); - (split, partial2) - } - remaining => { - let remaining_input = - Self::from(ArrayType::new(elem_ty.clone(), remaining)); - let taken = Self::from(ArrayType::new(elem_ty.clone(), take)); - let split = Self::from(StructType::new_with_repr( - TypeRepr::packed(1), - [taken, partial1], - )); - let rest = Self::from(StructType::new_with_repr( - TypeRepr::packed(1), - [partial2.unwrap(), remaining_input], - )); - (split, Some(rest)) - } - } - } - } else { - // The requested split consumes less than one element - let (partial1, partial2) = (*elem_ty).clone().split(n); - let remaining_input = match array_len - 1 { - 0 => unreachable!(), - 1 => (*elem_ty).clone(), - len => Self::from(ArrayType::new(elem_ty.clone(), len - 1)), - }; - let rest = Self::from(StructType::new_with_repr( - TypeRepr::packed(1), - [partial2.unwrap(), remaining_input], - )); - (partial1, Some(rest)) - } - } - }, - Self::Struct(struct_ty) => match &*struct_ty { - StructType { - repr: TypeRepr::Transparent, - fields, - .. - } => { - let underlying = fields - .into_iter() - .find(|f| !f.ty.is_zst()) - .expect("invalid type: expected non-zero sized field"); - underlying.ty.clone().split(n) - } - struct_ty => { - let original_repr = struct_ty.repr; - let original_size = struct_ty.size; - let mut fields = VecDeque::from_iter(struct_ty.fields.iter().cloned()); - let mut split = StructType { - repr: original_repr, - size: 0, - fields: smallvec![], - }; - let mut remaining = StructType { - repr: TypeRepr::packed(1), - size: 0, - fields: smallvec![], - }; - let mut needed: u32 = n.try_into().expect( - "invalid type split: number of bytes is larger than what is representable \ - in memory", - ); - let mut current_offset = 0u32; - while let Some(mut field) = fields.pop_front() { - let padding = field.offset - current_offset; - // If the padding was exactly what was needed, add it to the `split` - // struct, and then place the remaining fields in a new struct - let original_offset = field.offset; - if padding == needed { - split.size += needed; - // Handle the edge case where padding is at the front of the struct - if split.fields.is_empty() { - split.fields.push(StructField { - index: 0, - align: 1, - offset: 0, - ty: Type::from(ArrayType::new(Type::U8, needed as usize)), - }); - } - let mut prev_offset = original_offset; - let mut field_offset = 0; - field.index = 0; - field.offset = field_offset; - remaining.repr = TypeRepr::Default; - remaining.size = original_size - split.size; - remaining.fields.reserve(1 + fields.len()); - field_offset += field.ty.size_in_bytes() as u32; - remaining.fields.push(field); - for (index, mut field) in fields.into_iter().enumerate() { - field.index = (index + 1) as u8; - let align_offset = field.offset - prev_offset; - let field_size = field.ty.size_in_bytes() as u32; - prev_offset = field.offset + field_size; - field.offset = field_offset + align_offset; - field_offset += align_offset; - field_offset += field_size; - remaining.fields.push(field); - } - break; - } - - // If the padding is more than was needed, we fill out the rest of the - // request by padding the size of the `split` struct, and then adjust - // the remaining struct to account for the leftover padding. - if padding > needed { - // The struct size must match the requested split size - split.size += needed; - // Handle the edge case where padding is at the front of the struct - if split.fields.is_empty() { - split.fields.push(StructField { - index: 0, - align: 1, - offset: 0, - ty: Type::from(ArrayType::new(Type::U8, needed as usize)), - }); - } - // What's left must account for what has been split off - let leftover_padding = u16::try_from(padding - needed).expect( - "invalid type: padding is larger than maximum allowed alignment", - ); - let effective_alignment = leftover_padding.prev_power_of_two(); - let align_offset = leftover_padding % effective_alignment; - let default_alignment = cmp::max( - fields.iter().map(|f| f.align).max().unwrap_or(1), - field.align, - ); - let repr = match default_alignment.cmp(&effective_alignment) { - Ordering::Equal => TypeRepr::Default, - Ordering::Greater => TypeRepr::packed(effective_alignment), - Ordering::Less => TypeRepr::align(effective_alignment), - }; - let mut prev_offset = original_offset; - let mut field_offset = align_offset as u32; - field.index = 0; - field.offset = field_offset; - remaining.repr = repr; - remaining.size = original_size - split.size; - remaining.fields.reserve(1 + fields.len()); - field_offset += field.ty.size_in_bytes() as u32; - remaining.fields.push(field); - for (index, mut field) in fields.into_iter().enumerate() { - field.index = (index + 1) as u8; - let align_offset = field.offset - prev_offset; - let field_size = field.ty.size_in_bytes() as u32; - prev_offset = field.offset + field_size; - field.offset = field_offset + align_offset; - field_offset += align_offset; - field_offset += field_size; - remaining.fields.push(field); - } - break; - } - - // The padding must be less than what was needed, so consume it, and - // then process the current field for the rest of the request - split.size += padding; - needed -= padding; - current_offset += padding; - let field_size = field.ty.size_in_bytes() as u32; - // If the field fully satisifies the remainder of the request, then - // finalize the `split` struct, and place remaining fields in a trailing - // struct with an appropriate repr - if field_size == needed { - split.size += field_size; - field.offset = current_offset; - split.fields.push(field); - - debug_assert!( - !fields.is_empty(), - "expected struct that is the exact size of the split request to \ - have been handled elsewhere" - ); - - remaining.repr = original_repr; - remaining.size = original_size - split.size; - remaining.fields.reserve(fields.len()); - let mut prev_offset = current_offset + field_size; - let mut field_offset = 0; - for (index, mut field) in fields.into_iter().enumerate() { - field.index = index as u8; - let align_offset = field.offset - prev_offset; - let field_size = field.ty.size_in_bytes() as u32; - prev_offset = field.offset + field_size; - field.offset = field_offset + align_offset; - field_offset += align_offset; - field_offset += field_size; - remaining.fields.push(field); - } - break; - } - - // If the field is larger than what is needed, we have to split it - if field_size > needed { - split.size += needed; - - // Add the portion needed to `split` - let index = field.index; - let offset = current_offset; - let align = field.align; - let (partial1, partial2) = field.ty.split(needed as usize); - // The second half of the split will always be a type - let partial2 = partial2.unwrap(); - split.fields.push(StructField { - index, - offset, - align, - ty: partial1, - }); - - // Build a struct with the remaining fields and trailing partial field - let mut prev_offset = current_offset + needed; - let mut field_offset = needed + partial2.size_in_bytes() as u32; - remaining.size = original_size - split.size; - remaining.fields.reserve(1 + fields.len()); - remaining.fields.push(StructField { - index: 0, - offset: 1, - align: 1, - ty: partial2, - }); - for (index, mut field) in fields.into_iter().enumerate() { - field.index = (index + 1) as u8; - let align_offset = field.offset - prev_offset; - let field_size = field.ty.size_in_bytes() as u32; - prev_offset = field.offset + needed + field_size; - field.offset = field_offset + align_offset; - field_offset += align_offset; - field_offset += field_size; - remaining.fields.push(field); - } - break; - } - - // We need to process more fields for this request (i.e. field_size < needed) - needed -= field_size; - split.size += field_size; - field.offset = current_offset; - current_offset += field_size; - split.fields.push(field); - } - - let split = if split.fields.len() > 1 { - Type::from(split) - } else { - split.fields.pop().map(|f| f.ty).unwrap() - }; - match remaining.fields.len() { - 0 => (split, None), - 1 => (split, remaining.fields.pop().map(|f| f.ty)), - _ => (split, Some(remaining.into())), - } - } - }, - Type::List(_) => { - todo!("invalid type: list has no defined representation yet, so cannot be split") - } - // These types either have no size, or are 1 byte in size, so must have - // been handled above when checking if the size of the type is <= the - // requested split size - Self::Unknown | Self::Never | Self::I1 | Self::U8 | Self::I8 => { - unreachable!() - } - } - } - - /// Returns the minimum alignment, in bytes, of this type - pub fn min_alignment(&self) -> usize { - match self { - // These types don't have a meaningful alignment, so choose byte-aligned - Self::Unknown | Self::Never => 1, - // Felts must be naturally aligned to a 32-bit boundary (4 bytes) - Self::Felt => 4, - // 256-bit and 128-bit integers must be word-aligned - Self::U256 | Self::I128 | Self::U128 => 16, - // 64-bit integers and floats must be element-aligned - Self::I64 | Self::U64 | Self::F64 => 4, - // 32-bit integers and pointers must be element-aligned - Self::I32 | Self::U32 | Self::Ptr(_) | Self::Function(..) => 4, - // 16-bit integers can be naturally aligned - Self::I16 | Self::U16 => 2, - // 8-bit integers and booleans can be naturally aligned - Self::I8 | Self::U8 | Self::I1 => 1, - // Structs use the minimum alignment of their first field, or 1 if a zero-sized type - Self::Struct(ref struct_ty) => struct_ty.min_alignment(), - // Arrays use the minimum alignment of their element type - Self::Array(ref array_ty) => array_ty.min_alignment(), - // Lists use the minimum alignment of their element type - Self::List(ref element_ty) => element_ty.min_alignment(), - } - } - - /// Returns the size in bits of this type, without alignment padding. - pub fn size_in_bits(&self) -> usize { - match self { - // These types have no representation in memory - Self::Unknown | Self::Never => 0, - // Booleans are represented as i1 - Self::I1 => 1, - // Integers are naturally sized - Self::I8 | Self::U8 => 8, - Self::I16 | Self::U16 => 16, - // Field elements have a range that is almost 64 bits, but because - // our byte-addressable memory model only sees each element as a 32-bit - // chunk, we treat field elements in this model as 32-bit values. This - // has no effect on their available range, just how much memory they are - // assumed to require for storage. - Self::I32 | Self::U32 | Self::Felt => 32, - Self::I64 | Self::U64 | Self::F64 => 64, - Self::I128 | Self::U128 => 128, - Self::U256 => 256, - // Raw pointers are 32-bits, the same size as the native integer width, u32 - Self::Ptr(_) | Self::Function(_) => 32, - // Packed structs have no alignment padding between fields - Self::Struct(ref struct_ty) => struct_ty.size as usize * 8, - Self::Array(ref array_ty) => array_ty.size_in_bits(), - Type::List(_) => todo!( - "invalid type: list has no defined representation yet, so its size cannot be \ - determined" - ), - } - } - - /// Returns the minimum number of bytes required to store a value of this type - pub fn size_in_bytes(&self) -> usize { - let bits = self.size_in_bits(); - (bits / 8) + (!bits.is_multiple_of(8)) as usize - } - - /// Same as `size_in_bytes`, but with sufficient padding to guarantee alignment of the value. - pub fn aligned_size_in_bytes(&self) -> usize { - let align = self.min_alignment(); - let size = self.size_in_bytes(); - // Zero-sized types have no alignment - if size == 0 { - return 0; - } - - // Assuming that a pointer is allocated with the worst possible alignment, - // i.e. it is not aligned on a power-of-two boundary, we can ensure that there - // is enough space to align the pointer to the required minimum alignment and - // still fit it in the allocated block of memory without overflowing its bounds, - // by adding `align` to size. - // - // We panic if padding the size overflows `usize`. - // - // So let's say we have a type with a min alignment of 16, and size of 24. If - // we add 16 to 24, we get 40. We then allocate a block of memory of 40 bytes, - // the pointer of which happens to be at address 0x01. If we align that pointer - // to 0x10 (the next closest aligned address within the block we allocated), - // that consumes 15 bytes of the 40 we have, leaving us with 25 bytes to hold - // our 24 byte value. - size.checked_add(align) - .expect("type cannot meet its minimum alignment requirement due to its size") - } - - /// Returns the size in field elements of this type - pub fn size_in_felts(&self) -> usize { - let bytes = self.size_in_bytes(); - let trailing = bytes % FELT_SIZE; - (bytes / FELT_SIZE) + ((trailing > 0) as usize) - } - - /// Returns the size in words of this type - pub fn size_in_words(&self) -> usize { - let bytes = self.size_in_bytes(); - let trailing = bytes % WORD_SIZE; - (bytes / WORD_SIZE) + ((trailing > 0) as usize) - } - - /// Returns the layout of this type in memory - pub fn layout(&self) -> Layout { - Layout::from_size_align(self.size_in_bytes(), self.min_alignment()) - .expect("invalid layout: the size, when padded for alignment, overflows isize") - } - - /// Returns true if this type can be loaded on to the operand stack - /// - /// The rule for "loadability" is a bit arbitrary, but the purpose is to - /// force users of the IR to either pass large values by reference, or calculate - /// the addresses of the individual fields needed from a large structure or array, - /// and issue loads/stores against those instead. - /// - /// In effect, we reject loads of values that are larger than a single word, as that - /// is the largest value which can be worked with on the operand stack of the Miden VM. - pub fn is_loadable(&self) -> bool { - self.size_in_words() <= WORD_SIZE - } -} - -#[cfg(test)] -mod tests { - use smallvec::smallvec; - - use crate::*; - - #[test] - fn struct_type_test() { - let ptr_ty = Type::from(PointerType::new(Type::U32)); - // A struct with default alignment and padding between fields - let struct_ty = StructType::new([ptr_ty.clone(), Type::U8, Type::I32]); - assert_eq!(struct_ty.min_alignment(), ptr_ty.min_alignment()); - assert_eq!(struct_ty.size(), 12); - assert_eq!( - struct_ty.get(0), - &StructField { - index: 0, - align: 4, - offset: 0, - ty: ptr_ty.clone() - } - ); - assert_eq!( - struct_ty.get(1), - &StructField { - index: 1, - align: 1, - offset: 4, - ty: Type::U8 - } - ); - assert_eq!( - struct_ty.get(2), - &StructField { - index: 2, - align: 4, - offset: 8, - ty: Type::I32 - } - ); - - // A struct with no alignment requirement, and no alignment padding between fields - let struct_ty = - StructType::new_with_repr(TypeRepr::packed(1), [ptr_ty.clone(), Type::U8, Type::I32]); - assert_eq!(struct_ty.min_alignment(), 1); - assert_eq!(struct_ty.size(), 9); - assert_eq!( - struct_ty.get(0), - &StructField { - index: 0, - align: 1, - offset: 0, - ty: ptr_ty.clone() - } - ); - assert_eq!( - struct_ty.get(1), - &StructField { - index: 1, - align: 1, - offset: 4, - ty: Type::U8 - } - ); - assert_eq!( - struct_ty.get(2), - &StructField { - index: 2, - align: 1, - offset: 5, - ty: Type::I32 - } - ); - - // A struct with larger-than-default alignment, but default alignment for the fields - let struct_ty = - StructType::new_with_repr(TypeRepr::align(8), [ptr_ty.clone(), Type::U8, Type::I32]); - assert_eq!(struct_ty.min_alignment(), 8); - assert_eq!(struct_ty.size(), 16); - assert_eq!( - struct_ty.get(0), - &StructField { - index: 0, - align: 4, - offset: 0, - ty: ptr_ty.clone() - } - ); - assert_eq!( - struct_ty.get(1), - &StructField { - index: 1, - align: 1, - offset: 4, - ty: Type::U8 - } - ); - assert_eq!( - struct_ty.get(2), - &StructField { - index: 2, - align: 4, - offset: 8, - ty: Type::I32 - } - ); - } - - #[test] - fn type_to_raw_parts_test() { - let ty = Type::from(ArrayType::new(Type::U8, 5)); - assert_eq!( - ty.to_raw_parts(), - Some(smallvec![Type::from(ArrayType::new(Type::U8, 4)), Type::U8,]) - ); - - let ty = Type::from(ArrayType::new(Type::I16, 3)); - assert_eq!( - ty.to_raw_parts(), - Some(smallvec![Type::from(ArrayType::new(Type::I16, 2)), Type::I16,]) - ); - - let ptr_ty = Type::from(PointerType::new(Type::U32)); - - // Default struct - let ty = Type::from(StructType::new([ptr_ty.clone(), Type::U8, Type::I32])); - assert_eq!(ty.to_raw_parts(), Some(smallvec![ptr_ty.clone(), Type::U8, Type::I32,])); - - // Packed struct - let ty = Type::from(StructType::new_with_repr( - TypeRepr::packed(1), - [ptr_ty.clone(), Type::U8, Type::I32], - )); - let partial_ty = Type::from(StructType::new_with_repr( - TypeRepr::packed(1), - [Type::U8, Type::from(ArrayType::new(Type::U8, 3))], - )); - assert_eq!(ty.to_raw_parts(), Some(smallvec![ptr_ty.clone(), partial_ty, Type::U8])); - } -} diff --git a/hir-type/src/lib.rs b/hir-type/src/lib.rs deleted file mode 100644 index 90128575e..000000000 --- a/hir-type/src/lib.rs +++ /dev/null @@ -1,368 +0,0 @@ -#![no_std] -#![deny(warnings)] - -extern crate alloc; - -mod alignable; -mod array_type; -mod function_type; -mod layout; -mod pointer_type; -mod struct_type; - -use alloc::{boxed::Box, sync::Arc}; -use core::fmt; - -use miden_formatting::prettier::PrettyPrint; - -pub use self::{ - alignable::Alignable, array_type::ArrayType, function_type::*, pointer_type::*, struct_type::*, -}; - -/// Represents the type of a value in the HIR type system -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -pub enum Type { - /// This indicates a failure to type a value, or a value which is untypable - Unknown, - /// This type is the bottom type, and represents divergence, akin to Rust's Never/! type - Never, - /// A 1-bit integer, i.e. a boolean value. - /// - /// When the bit is 1, the value is true; 0 is false. - I1, - /// An 8-bit signed integer. - I8, - /// An 8-bit unsigned integer. - U8, - /// A 16-bit signed integer. - I16, - /// A 16-bit unsigned integer. - U16, - /// A 32-bit signed integer. - I32, - /// A 32-bit unsigned integer. - U32, - /// A 64-bit signed integer. - I64, - /// A 64-bit unsigned integer. - U64, - /// A 128-bit signed integer. - I128, - /// A 128-bit unsigned integer. - U128, - /// A 256-bit unsigned integer. - U256, - /// A 64-bit IEEE-754 floating-point value. - /// - /// NOTE: These are currently unsupported in practice, but is reserved here for future use. - F64, - /// A field element corresponding to the native Miden field (currently the Goldilocks field) - Felt, - /// A pointer to a value in a byte-addressable address space. - /// - /// Pointers of this type are _not_ equivalent to element addresses as referred to in the - /// Miden Assembly documentation, but do have a straightforward conversion. - Ptr(Arc), - /// A compound type of fixed shape and size - Struct(Arc), - /// A vector of fixed size - Array(Arc), - /// A dynamically sized list of values of the given type - /// - /// NOTE: Currently this only exists to support the Wasm Canonical ABI, - /// but it has no defined represenation yet, so in practice cannot be - /// used in most places except during initial translation in the Wasm frontend. - List(Arc), - /// A reference to a function with the given type signature - Function(Arc), -} -impl Type { - /// Returns true if this type is a zero-sized type, which includes: - /// - /// * Types with no size, e.g. `Never` - /// * Zero-sized arrays - /// * Arrays with a zero-sized element type - /// * Structs composed of nothing but zero-sized fields - pub fn is_zst(&self) -> bool { - match self { - Self::Unknown => false, - Self::Never => true, - Self::Array(ref ty) => ty.is_zst(), - Self::Struct(ref struct_ty) => struct_ty.fields.iter().all(|f| f.ty.is_zst()), - Self::I1 - | Self::I8 - | Self::U8 - | Self::I16 - | Self::U16 - | Self::I32 - | Self::U32 - | Self::I64 - | Self::U64 - | Self::I128 - | Self::U128 - | Self::U256 - | Self::F64 - | Self::Felt - | Self::Ptr(_) - | Self::List(_) - | Self::Function(_) => false, - } - } - - /// Returns true if this type is any numeric type - pub fn is_numeric(&self) -> bool { - matches!( - self, - Self::I1 - | Self::I8 - | Self::U8 - | Self::I16 - | Self::U16 - | Self::I32 - | Self::U32 - | Self::I64 - | Self::U64 - | Self::I128 - | Self::U128 - | Self::U256 - | Self::F64 - | Self::Felt - ) - } - - /// Returns true if this type is any integral type - pub fn is_integer(&self) -> bool { - matches!( - self, - Self::I1 - | Self::I8 - | Self::U8 - | Self::I16 - | Self::U16 - | Self::I32 - | Self::U32 - | Self::I64 - | Self::U64 - | Self::I128 - | Self::U128 - | Self::U256 - | Self::Felt - ) - } - - /// Returns true if this type is any signed integral type - pub fn is_signed_integer(&self) -> bool { - matches!(self, Self::I8 | Self::I16 | Self::I32 | Self::I64 | Self::I128) - } - - /// Returns true if this type is any unsigned integral type - pub fn is_unsigned_integer(&self) -> bool { - matches!(self, Self::I1 | Self::U8 | Self::U16 | Self::U32 | Self::U64 | Self::U128) - } - - /// Get this type as its unsigned integral twin, e.g. i32 becomes u32. - /// - /// This function will panic if the type is not an integer type, or has no unsigned - /// representation - pub fn as_unsigned(&self) -> Type { - match self { - Self::I8 | Self::U8 => Self::U8, - Self::I16 | Self::U16 => Self::U16, - Self::I32 | Self::U32 => Self::U32, - Self::I64 | Self::U64 => Self::U64, - Self::I128 | Self::U128 => Self::U128, - Self::Felt => Self::Felt, - ty => panic!("invalid conversion to unsigned integer type: {ty} is not an integer"), - } - } - - /// Get this type as its signed integral twin, e.g. u32 becomes i32. - /// - /// This function will panic if the type is not an integer type, or has no signed representation - pub fn as_signed(&self) -> Type { - match self { - Self::I8 | Self::U8 => Self::I8, - Self::I16 | Self::U16 => Self::I16, - Self::I32 | Self::U32 => Self::I32, - Self::I64 | Self::U64 => Self::I64, - Self::I128 | Self::U128 => Self::I128, - Self::Felt => { - panic!("invalid conversion to signed integer type: felt has no signed equivalent") - } - ty => panic!("invalid conversion to signed integer type: {ty} is not an integer"), - } - } - - /// Returns true if this type is a floating-point type - #[inline] - pub fn is_float(&self) -> bool { - matches!(self, Self::F64) - } - - /// Returns true if this type is the field element type - #[inline] - pub fn is_felt(&self) -> bool { - matches!(self, Self::Felt) - } - - /// Returns true if this type is a pointer type - #[inline] - pub fn is_pointer(&self) -> bool { - matches!(self, Self::Ptr(_)) - } - - /// Returns the type of the pointee, if this type is a pointer type - #[inline] - pub fn pointee(&self) -> Option<&Type> { - match self { - Self::Ptr(ty) => Some(ty.pointee()), - _ => None, - } - } - - /// Returns true if this type is a struct type - #[inline] - pub fn is_struct(&self) -> bool { - matches!(self, Self::Struct(_)) - } - - /// Returns true if this type is an array type - #[inline] - pub fn is_array(&self) -> bool { - matches!(self, Self::Array(_)) - } - - /// Returns true if this type is a dynamically-sized vector/list type - #[inline] - pub fn is_list(&self) -> bool { - matches!(self, Self::List(_)) - } - - /// Returns true if this type is a function reference type - #[inline] - pub fn is_function(&self) -> bool { - matches!(self, Self::Function(_)) - } -} - -impl From for Type { - #[inline] - fn from(ty: StructType) -> Type { - Type::Struct(Arc::new(ty)) - } -} - -impl From> for Type { - #[inline] - fn from(ty: Box) -> Type { - Type::Struct(Arc::from(ty)) - } -} - -impl From> for Type { - #[inline] - fn from(ty: Arc) -> Type { - Type::Struct(ty) - } -} - -impl From for Type { - #[inline] - fn from(ty: ArrayType) -> Type { - Type::Array(Arc::new(ty)) - } -} - -impl From> for Type { - #[inline] - fn from(ty: Box) -> Type { - Type::Array(Arc::from(ty)) - } -} - -impl From> for Type { - #[inline] - fn from(ty: Arc) -> Type { - Type::Array(ty) - } -} - -impl From for Type { - #[inline] - fn from(ty: PointerType) -> Type { - Type::Ptr(Arc::new(ty)) - } -} - -impl From> for Type { - #[inline] - fn from(ty: Box) -> Type { - Type::Ptr(Arc::from(ty)) - } -} - -impl From> for Type { - #[inline] - fn from(ty: Arc) -> Type { - Type::Ptr(ty) - } -} - -impl From for Type { - #[inline] - fn from(ty: FunctionType) -> Type { - Type::Function(Arc::new(ty)) - } -} - -impl From> for Type { - #[inline] - fn from(ty: Box) -> Type { - Type::Function(Arc::from(ty)) - } -} - -impl From> for Type { - #[inline] - fn from(ty: Arc) -> Type { - Type::Function(ty) - } -} - -impl fmt::Display for Type { - /// Print this type for display using the provided module context - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - self.pretty_print(f) - } -} - -impl PrettyPrint for Type { - fn render(&self) -> miden_formatting::prettier::Document { - use miden_formatting::prettier::*; - - match self { - Self::Unknown => const_text("?"), - Self::Never => const_text("!"), - Self::I1 => const_text("i1"), - Self::I8 => const_text("i8"), - Self::U8 => const_text("u8"), - Self::I16 => const_text("i16"), - Self::U16 => const_text("u16"), - Self::I32 => const_text("i32"), - Self::U32 => const_text("u32"), - Self::I64 => const_text("i64"), - Self::U64 => const_text("u64"), - Self::I128 => const_text("i128"), - Self::U128 => const_text("u128"), - Self::U256 => const_text("u256"), - Self::F64 => const_text("f64"), - Self::Felt => const_text("felt"), - Self::Ptr(ptr_ty) => ptr_ty.render(), - Self::Struct(struct_ty) => struct_ty.render(), - Self::Array(array_ty) => array_ty.render(), - Self::List(ty) => const_text("list<") + ty.render() + const_text(">"), - Self::Function(ty) => ty.render(), - } - } -} diff --git a/hir-type/src/pointer_type.rs b/hir-type/src/pointer_type.rs deleted file mode 100644 index 315aa92f3..000000000 --- a/hir-type/src/pointer_type.rs +++ /dev/null @@ -1,117 +0,0 @@ -use core::{fmt, str::FromStr}; - -use super::Type; - -/// A pointer to an object in memory -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -pub struct PointerType { - /// The address space used by pointers of this type. - pub addrspace: AddressSpace, - /// The type of value located at the pointed-to address - pub pointee: Type, -} - -impl PointerType { - /// Create a new byte-addressable pointer type to `pointee` - pub fn new(pointee: Type) -> Self { - Self { - addrspace: AddressSpace::Byte, - pointee, - } - } - - /// Create a new pointer type to `pointee` in `addrspace` - pub fn new_with_address_space(pointee: Type, addrspace: AddressSpace) -> Self { - Self { addrspace, pointee } - } - - /// Returns the type pointed to by pointers of this type - pub fn pointee(&self) -> &Type { - &self.pointee - } - - /// Returns the address space of this pointer type - pub fn addrspace(&self) -> AddressSpace { - self.addrspace - } - - /// Returns true if this pointer type represents a byte pointer - pub fn is_byte_pointer(&self) -> bool { - matches!(self.addrspace, AddressSpace::Byte) - } -} - -impl fmt::Display for PointerType { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - use miden_formatting::prettier::PrettyPrint; - self.pretty_print(f) - } -} - -impl miden_formatting::prettier::PrettyPrint for PointerType { - fn render(&self) -> miden_formatting::prettier::Document { - use miden_formatting::prettier::*; - - const_text("ptr<") - + self.addrspace.render() - + const_text(", ") - + self.pointee.render() - + const_text(">") - } -} - -/// This error is raised when parsing an [AddressSpace] -#[derive(Debug, thiserror::Error)] -pub enum InvalidAddressSpaceError { - #[error("invalid address space identifier: expected 'byte' or 'element'")] - InvalidId, -} - -/// The address space a pointer address is evaluated in. -#[derive(Default, Debug, Copy, Clone, PartialEq, Eq, Hash)] -#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -pub enum AddressSpace { - /// The pointer address is evaluated as a byte address. - /// - /// This is the default unit type for pointers in HIR. - #[default] - Byte, - /// The pointer address is evaluated as an element address. - /// - /// This is the unit type for native Miden VM addresses. - /// - /// All byte-addressable pointers must be converted to element pointers at runtime before - /// loading/storing memory. - Element, -} - -impl fmt::Display for AddressSpace { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - use miden_formatting::prettier::PrettyPrint; - self.pretty_print(f) - } -} - -impl miden_formatting::prettier::PrettyPrint for AddressSpace { - fn render(&self) -> miden_formatting::prettier::Document { - use miden_formatting::prettier::*; - - match self { - Self::Byte => const_text("byte"), - Self::Element => const_text("element"), - } - } -} - -impl FromStr for AddressSpace { - type Err = InvalidAddressSpaceError; - - fn from_str(s: &str) -> Result { - match s { - "byte" => Ok(Self::Byte), - "element" => Ok(Self::Element), - _ => Err(InvalidAddressSpaceError::InvalidId), - } - } -} diff --git a/hir-type/src/struct_type.rs b/hir-type/src/struct_type.rs deleted file mode 100644 index 468c7134b..000000000 --- a/hir-type/src/struct_type.rs +++ /dev/null @@ -1,339 +0,0 @@ -use core::{fmt, num::NonZeroU16}; - -use smallvec::SmallVec; - -use super::{Alignable, Type}; - -/// This represents a structured aggregate type -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -pub struct StructType { - /// The representation to use for this type - pub(crate) repr: TypeRepr, - /// The computed size of this struct - pub(crate) size: u32, - /// The fields of this struct, in the original order specified - /// - /// The actual order of fields in the final layout is determined by the index - /// associated with each field, not the index in this vector, although for `repr(C)` - /// structs they will be the same - pub(crate) fields: SmallVec<[StructField; 2]>, -} - -/// This represents metadata about a field of a [StructType] -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -pub struct StructField { - /// The index of this field in the final layout - pub index: u8, - /// The specified alignment for this field - pub align: u16, - /// The offset of this field relative to the base of the struct - pub offset: u32, - /// The type of this field - pub ty: Type, -} - -/// This represents metadata about how a structured type will be represented in memory -#[derive(Default, Debug, Copy, Clone, PartialEq, Eq, Hash)] -#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -pub enum TypeRepr { - /// This corresponds to the C ABI representation for a given type - #[default] - Default, - /// This modifies the default representation, by raising the minimum alignment. - /// - /// The alignment must be a power of two, e.g. 32, and values from 1 to 2^16 are allowed. - /// - /// The alignment must be greater than the default minimum alignment of the type - /// or this representation has no effect. - Align(NonZeroU16), - /// This modifies the default representation, by lowering the minimum alignment of - /// a type, and in the case of structs, changes the alignments of the fields to be - /// the smaller of the specified alignment and the default alignment. This has the - /// effect of changing the layout of a struct. - /// - /// Notably, `Packed(1)` will result in a struct that has no alignment requirement, - /// and no padding between fields. - /// - /// The alignment must be a power of two, e.g. 32, and values from 1 to 2^16 are allowed. - /// - /// The alignment must be smaller than the default alignment, or this representation - /// has no effect. - Packed(NonZeroU16), - /// This may only be used on structs with no more than one non-zero sized field, and - /// indicates that the representation of that field should be used for the struct. - Transparent, - /// This is equivalent to the default representation, except it indicates that if multiple - /// field elements are required to represent the value on Miden's operand stack (i.e. the - /// value is larger than 4 bytes), then the field elements will be ordered on the operand stack - /// with the highest-addressed bytes at the top. - /// - /// Normally, types are laid out in natural order (i.e. lowest-addressed bytes on top of the - /// stack), and when lowering word-sized loads/stores, we are required to reverse the order - /// of the elements into big-endian order. - /// - /// This representation essentially disables this implicit reversal, keeping elements on the - /// operand stack in the order produced by `mem_loadw`. - /// - /// NOTE: This is meant to be a temporary work around to permit us to represent some legacy - /// types in the transaction kernel API which use a different representation on the operand - /// stack than in memory - this _will_ be deprecated in the future. - BigEndian, -} - -impl TypeRepr { - /// Construct a packed representation with the given alignment - #[inline] - pub fn packed(align: u16) -> Self { - Self::Packed( - NonZeroU16::new(align).expect("invalid alignment: expected value in range 1..=65535"), - ) - } - - /// Construct a representation with the given minimum alignment - #[inline] - pub fn align(align: u16) -> Self { - Self::Align( - NonZeroU16::new(align).expect("invalid alignment: expected value in range 1..=65535"), - ) - } - - /// Return true if this type representation is transparent - pub fn is_transparent(&self) -> bool { - matches!(self, Self::Transparent) - } - - /// Return true if this type representation is packed - pub fn is_packed(&self) -> bool { - matches!(self, Self::Packed(_)) - } - - /// Get the custom alignment given for this type representation, if applicable - pub fn min_alignment(&self) -> Option { - match self { - Self::Packed(align) | Self::Align(align) => Some(align.get() as usize), - _ => None, - } - } -} - -impl StructType { - /// Create a new struct with default representation, i.e. a struct with representation of - /// `TypeRepr::Packed(1)`. - #[inline] - pub fn new>(fields: I) -> Self { - Self::new_with_repr(TypeRepr::Default, fields) - } - - /// Create a new struct with the given representation. - /// - /// This function will panic if the rules of the given representation are violated. - pub fn new_with_repr>(repr: TypeRepr, fields: I) -> Self { - let tys = fields.into_iter().collect::>(); - let mut fields = SmallVec::<[_; 2]>::with_capacity(tys.len()); - let size = match repr { - TypeRepr::Transparent => { - let mut offset = 0u32; - for (index, ty) in tys.into_iter().enumerate() { - let index: u8 = - index.try_into().expect("invalid struct: expected no more than 255 fields"); - let field_size: u32 = ty - .size_in_bytes() - .try_into() - .expect("invalid type: size is larger than 2^32 bytes"); - if field_size == 0 { - fields.push(StructField { - index, - align: 1, - offset, - ty, - }); - } else { - let align = ty.min_alignment().try_into().expect( - "invalid struct field alignment: expected power of two between 1 and \ - 2^16", - ); - assert_eq!( - offset, 0, - "invalid transparent representation for struct: repr(transparent) is \ - only valid for structs with a single non-zero sized field" - ); - fields.push(StructField { - index, - align, - offset, - ty, - }); - offset += field_size; - } - } - offset - } - repr => { - let mut offset = 0u32; - let default_align: u16 = - tys.iter().map(|t| t.min_alignment()).max().unwrap_or(1).try_into().expect( - "invalid struct field alignment: expected power of two between 1 and 2^16", - ); - let align = match repr { - TypeRepr::Align(align) => core::cmp::max(align.get(), default_align), - TypeRepr::Packed(align) => core::cmp::min(align.get(), default_align), - TypeRepr::Transparent | TypeRepr::Default | TypeRepr::BigEndian => { - default_align - } - }; - - for (index, ty) in tys.into_iter().enumerate() { - let index: u8 = - index.try_into().expect("invalid struct: expected no more than 255 fields"); - let field_size: u32 = ty - .size_in_bytes() - .try_into() - .expect("invalid type: size is larger than 2^32 bytes"); - let default_align: u16 = ty.min_alignment().try_into().expect( - "invalid struct field alignment: expected power of two between 1 and 2^16", - ); - let align: u16 = match repr { - TypeRepr::Packed(align) => core::cmp::min(align.get(), default_align), - _ => default_align, - }; - offset += offset.align_offset(align as u32); - fields.push(StructField { - index, - align, - offset, - ty, - }); - offset += field_size; - } - offset.align_up(align as u32) - } - }; - - Self { repr, size, fields } - } - - /// Get the [TypeRepr] for this struct - #[inline] - pub const fn repr(&self) -> TypeRepr { - self.repr - } - - /// Get the minimum alignment for this struct - pub fn min_alignment(&self) -> usize { - self.repr - .min_alignment() - .unwrap_or_else(|| self.fields.iter().map(|f| f.align as usize).max().unwrap_or(1)) - } - - /// Get the total size in bytes required to hold this struct, including alignment padding - #[inline] - pub fn size(&self) -> usize { - self.size as usize - } - - /// Get the struct field at `index`, relative to declaration order. - pub fn get(&self, index: usize) -> &StructField { - &self.fields[index] - } - - /// Get the struct fields as a slice - pub fn fields(&self) -> &[StructField] { - self.fields.as_slice() - } - - /// Returns true if this struct has no fields - pub fn is_empty(&self) -> bool { - self.fields.is_empty() - } - - /// Get the length of this struct (i.e. number of fields) - pub fn len(&self) -> usize { - self.fields.len() - } -} - -impl TryFrom for StructType { - type Error = Type; - - fn try_from(ty: Type) -> Result { - match ty { - Type::Struct(ty) => Ok(alloc::sync::Arc::unwrap_or_clone(ty)), - other => Err(other), - } - } -} - -impl fmt::Display for StructType { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - use miden_formatting::prettier::PrettyPrint; - self.pretty_print(f) - } -} - -impl miden_formatting::prettier::PrettyPrint for StructType { - fn render(&self) -> miden_formatting::prettier::Document { - use miden_formatting::prettier::*; - - let header = match self.repr.render() { - Document::Empty => const_text("struct "), - repr => const_text("struct ") + const_text("#[repr(") + repr + const_text(")] "), - }; - - let singleline = self.fields.iter().enumerate().fold(Document::Empty, |acc, (i, field)| { - if i > 0 { - acc + const_text(", ") + field.render() - } else { - field.render() - } - }); - let multiline = indent( - 4, - self.fields.iter().enumerate().fold(Document::Empty, |acc, (i, field)| { - if i > 0 { - acc + nl() + field.render() - } else { - nl() + field.render() - } - }), - ); - let body = const_text("{") + (singleline | multiline) + const_text("}"); - - header + body - } -} - -impl fmt::Display for StructField { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - fmt::Display::fmt(&self.ty, f) - } -} - -impl miden_formatting::prettier::PrettyPrint for StructField { - fn render(&self) -> miden_formatting::prettier::Document { - self.ty.render() - } -} - -impl fmt::Display for TypeRepr { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - use miden_formatting::prettier::PrettyPrint; - self.pretty_print(f) - } -} - -impl miden_formatting::prettier::PrettyPrint for TypeRepr { - fn render(&self) -> miden_formatting::prettier::Document { - use alloc::format; - - use miden_formatting::prettier::*; - match self { - Self::Default => Document::Empty, - Self::Transparent => const_text("transparent"), - Self::Align(align) => text(format!("align({align})")), - Self::Packed(align) => text(format!("packed({align})")), - Self::BigEndian => const_text("big-endian"), - } - } -} From 0d4e4e7b0bffadb5745d9b707a53accb3621c54f Mon Sep 17 00:00:00 2001 From: Denys Zadorozhnyi Date: Wed, 12 Nov 2025 09:01:00 +0200 Subject: [PATCH 13/19] feature: add `miden-base` MASM bindings for `account`, `tx`, `faucet`, `asset`, `input_note` `output_note` --- frontend/wasm/src/miden_abi/transform.rs | 87 +- frontend/wasm/src/miden_abi/tx_kernel.rs | 6 + .../wasm/src/miden_abi/tx_kernel/account.rs | 63 + .../src/miden_abi/tx_kernel/active_note.rs | 12 + .../wasm/src/miden_abi/tx_kernel/asset.rs | 36 + .../wasm/src/miden_abi/tx_kernel/faucet.rs | 53 + .../src/miden_abi/tx_kernel/input_note.rs | 66 + .../src/miden_abi/tx_kernel/output_note.rs | 20 + frontend/wasm/src/miden_abi/tx_kernel/tx.rs | 24 + hir-symbol/src/symbols.toml | 2 + sdk/base-sys/src/bindings/account.rs | 143 ++ sdk/base-sys/src/bindings/active_note.rs | 34 +- sdk/base-sys/src/bindings/asset.rs | 55 + sdk/base-sys/src/bindings/faucet.rs | 121 ++ sdk/base-sys/src/bindings/input_note.rs | 132 ++ sdk/base-sys/src/bindings/mod.rs | 3 + sdk/base-sys/src/bindings/output_note.rs | 71 +- sdk/base-sys/src/bindings/storage.rs | 40 + sdk/base-sys/src/bindings/tx.rs | 54 + sdk/base-sys/stubs/account.rs | 87 + sdk/base-sys/stubs/active_note.rs | 15 + sdk/base-sys/stubs/asset.rs | 23 + sdk/base-sys/stubs/faucet.rs | 54 + sdk/base-sys/stubs/input_note.rs | 45 + sdk/base-sys/stubs/lib.rs | 3 + sdk/base-sys/stubs/output_note.rs | 25 + sdk/base-sys/stubs/tx.rs | 30 + .../abi_transform_tx_kernel_get_inputs_4.hir | 2 +- .../abi_transform_tx_kernel_get_inputs_4.masm | 2 +- .../abi_transform_tx_kernel_get_inputs_4.wat | 2 +- tests/integration/expected/examples/p2id.hir | 1722 +++++++-------- tests/integration/expected/examples/p2id.masm | 143 +- tests/integration/expected/examples/p2id.wat | 99 +- ...unt_asset_build_fungible_asset_binding.hir | 356 ++++ ...nt_asset_build_fungible_asset_binding.masm | 774 +++++++ ...unt_asset_build_fungible_asset_binding.wat | 211 ++ ...asset_build_non_fungible_asset_binding.hir | 465 +++++ ...sset_build_non_fungible_asset_binding.masm | 1011 +++++++++ ...asset_build_non_fungible_asset_binding.wat | 255 +++ ...sdk_account_compute_commitment_binding.hir | 327 +++ ...dk_account_compute_commitment_binding.masm | 698 +++++++ ...sdk_account_compute_commitment_binding.wat | 181 ++ ...count_compute_delta_commitment_binding.hir | 327 +++ ...ount_compute_delta_commitment_binding.masm | 698 +++++++ ...count_compute_delta_commitment_binding.wat | 181 ++ ...unt_compute_storage_commitment_binding.hir | 327 +++ ...nt_compute_storage_commitment_binding.masm | 698 +++++++ ...unt_compute_storage_commitment_binding.wat | 181 ++ .../rust_sdk_account_faucet_burn_binding.hir | 463 +++++ .../rust_sdk_account_faucet_burn_binding.masm | 972 +++++++++ .../rust_sdk_account_faucet_burn_binding.wat | 254 +++ ...t_faucet_create_fungible_asset_binding.hir | 352 ++++ ..._faucet_create_fungible_asset_binding.masm | 751 +++++++ ...t_faucet_create_fungible_asset_binding.wat | 205 ++ ...ucet_create_non_fungible_asset_binding.hir | 457 ++++ ...cet_create_non_fungible_asset_binding.masm | 962 +++++++++ ...ucet_create_non_fungible_asset_binding.wat | 247 +++ ...ount_faucet_get_total_issuance_binding.hir | 76 + ...unt_faucet_get_total_issuance_binding.masm | 153 ++ ...ount_faucet_get_total_issuance_binding.wat | 73 + ...t_is_non_fungible_asset_issued_binding.hir | 219 ++ ..._is_non_fungible_asset_issued_binding.masm | 433 ++++ ...t_is_non_fungible_asset_issued_binding.wat | 149 ++ .../rust_sdk_account_faucet_mint_binding.hir | 463 +++++ .../rust_sdk_account_faucet_mint_binding.masm | 972 +++++++++ .../rust_sdk_account_faucet_mint_binding.wat | 254 +++ ...dk_account_get_code_commitment_binding.hir | 327 +++ ...k_account_get_code_commitment_binding.masm | 698 +++++++ ...dk_account_get_code_commitment_binding.wat | 181 ++ ...dk_account_get_initial_balance_binding.hir | 86 + ...k_account_get_initial_balance_binding.masm | 169 ++ ...dk_account_get_initial_balance_binding.wat | 82 + ...get_initial_storage_commitment_binding.hir | 327 +++ ...et_initial_storage_commitment_binding.masm | 698 +++++++ ...get_initial_storage_commitment_binding.wat | 181 ++ ...account_get_initial_vault_root_binding.hir | 327 +++ ...ccount_get_initial_vault_root_binding.masm | 698 +++++++ ...account_get_initial_vault_root_binding.wat | 181 ++ ...sdk_account_get_num_procedures_binding.hir | 76 + ...dk_account_get_num_procedures_binding.masm | 153 ++ ...sdk_account_get_num_procedures_binding.wat | 73 + ...sdk_account_get_procedure_root_binding.hir | 337 +++ ...dk_account_get_procedure_root_binding.masm | 713 +++++++ ...sdk_account_get_procedure_root_binding.wat | 190 ++ ...ust_sdk_account_get_vault_root_binding.hir | 327 +++ ...st_sdk_account_get_vault_root_binding.masm | 698 +++++++ ...ust_sdk_account_get_vault_root_binding.wat | 181 ++ ...account_has_non_fungible_asset_binding.hir | 219 ++ ...ccount_has_non_fungible_asset_binding.masm | 438 ++++ ...account_has_non_fungible_asset_binding.wat | 149 ++ ...rust_sdk_account_has_procedure_binding.hir | 181 ++ ...ust_sdk_account_has_procedure_binding.masm | 353 ++++ ...rust_sdk_account_has_procedure_binding.wat | 131 ++ ...count_storage_get_initial_item_binding.hir | 337 +++ ...ount_storage_get_initial_item_binding.masm | 713 +++++++ ...count_storage_get_initial_item_binding.wat | 190 ++ ...t_storage_get_initial_map_item_binding.hir | 418 ++++ ..._storage_get_initial_map_item_binding.masm | 874 ++++++++ ...t_storage_get_initial_map_item_binding.wat | 234 +++ ...ccount_tx_get_block_commitment_binding.hir | 283 +++ ...count_tx_get_block_commitment_binding.masm | 610 ++++++ ...ccount_tx_get_block_commitment_binding.wat | 178 ++ ...dk_account_tx_get_block_number_binding.hir | 82 + ...k_account_tx_get_block_number_binding.masm | 165 ++ ...dk_account_tx_get_block_number_binding.wat | 85 + ...account_tx_get_block_timestamp_binding.hir | 82 + ...ccount_tx_get_block_timestamp_binding.masm | 165 ++ ...account_tx_get_block_timestamp_binding.wat | 85 + ..._tx_get_expiration_block_delta_binding.hir | 82 + ...tx_get_expiration_block_delta_binding.masm | 165 ++ ..._tx_get_expiration_block_delta_binding.wat | 85 + ..._tx_get_input_notes_commitment_binding.hir | 283 +++ ...tx_get_input_notes_commitment_binding.masm | 610 ++++++ ..._tx_get_input_notes_commitment_binding.wat | 178 ++ ...account_tx_get_num_input_notes_binding.hir | 82 + ...ccount_tx_get_num_input_notes_binding.masm | 165 ++ ...account_tx_get_num_input_notes_binding.wat | 85 + ...ccount_tx_get_num_output_notes_binding.hir | 82 + ...count_tx_get_num_output_notes_binding.masm | 165 ++ ...ccount_tx_get_num_output_notes_binding.wat | 85 + ...tx_get_output_notes_commitment_binding.hir | 283 +++ ...x_get_output_notes_commitment_binding.masm | 610 ++++++ ...tx_get_output_notes_commitment_binding.wat | 178 ++ ..._update_expiration_block_delta_binding.hir | 90 + ...update_expiration_block_delta_binding.masm | 173 ++ ..._update_expiration_block_delta_binding.wat | 91 + ...k_account_was_procedure_called_binding.hir | 181 ++ ..._account_was_procedure_called_binding.masm | 353 ++++ ...k_account_was_procedure_called_binding.wat | 131 ++ ...rust_sdk_input_note_get_assets_binding.hir | 958 +++++++++ ...ust_sdk_input_note_get_assets_binding.masm | 1851 +++++++++++++++++ ...rust_sdk_input_note_get_assets_binding.wat | 582 ++++++ ...sdk_input_note_get_assets_info_binding.hir | 319 +++ ...dk_input_note_get_assets_info_binding.masm | 688 ++++++ ...sdk_input_note_get_assets_info_binding.wat | 189 ++ ...sdk_input_note_get_inputs_info_binding.hir | 319 +++ ...dk_input_note_get_inputs_info_binding.masm | 688 ++++++ ...sdk_input_note_get_inputs_info_binding.wat | 189 ++ ...st_sdk_input_note_get_metadata_binding.hir | 350 ++++ ...t_sdk_input_note_get_metadata_binding.masm | 748 +++++++ ...st_sdk_input_note_get_metadata_binding.wat | 199 ++ ...t_sdk_input_note_get_recipient_binding.hir | 400 ++++ ..._sdk_input_note_get_recipient_binding.masm | 860 ++++++++ ...t_sdk_input_note_get_recipient_binding.wat | 225 ++ ...sdk_input_note_get_script_root_binding.hir | 350 ++++ ...dk_input_note_get_script_root_binding.masm | 748 +++++++ ...sdk_input_note_get_script_root_binding.wat | 199 ++ ...rust_sdk_input_note_get_sender_binding.hir | 172 ++ ...ust_sdk_input_note_get_sender_binding.masm | 360 ++++ ...rust_sdk_input_note_get_sender_binding.wat | 129 ++ ...k_input_note_get_serial_number_binding.hir | 350 ++++ ..._input_note_get_serial_number_binding.masm | 748 +++++++ ...k_input_note_get_serial_number_binding.wat | 199 ++ ...sdk_note_add_assets_to_account_binding.hir | 76 + ...dk_note_add_assets_to_account_binding.masm | 153 ++ ...sdk_note_add_assets_to_account_binding.wat | 80 + ...rust_sdk_output_note_add_asset_binding.hir | 214 ++ ...ust_sdk_output_note_add_asset_binding.masm | 434 ++++ ...rust_sdk_output_note_add_asset_binding.wat | 149 ++ .../rust_sdk_output_note_create_binding.hir | 218 ++ .../rust_sdk_output_note_create_binding.masm | 469 +++++ .../rust_sdk_output_note_create_binding.wat | 166 ++ ...ust_sdk_output_note_get_assets_binding.hir | 958 +++++++++ ...st_sdk_output_note_get_assets_binding.masm | 1851 +++++++++++++++++ ...ust_sdk_output_note_get_assets_binding.wat | 582 ++++++ ...dk_output_note_get_assets_info_binding.hir | 319 +++ ...k_output_note_get_assets_info_binding.masm | 688 ++++++ ...dk_output_note_get_assets_info_binding.wat | 189 ++ ...t_sdk_output_note_get_metadata_binding.hir | 350 ++++ ..._sdk_output_note_get_metadata_binding.masm | 748 +++++++ ...t_sdk_output_note_get_metadata_binding.wat | 199 ++ ..._sdk_output_note_get_recipient_binding.hir | 352 ++++ ...sdk_output_note_get_recipient_binding.masm | 751 +++++++ ..._sdk_output_note_get_recipient_binding.wat | 205 ++ .../rust_masm_tests/rust_sdk/base/account.rs | 238 +++ .../rust_masm_tests/rust_sdk/base/asset.rs | 94 + .../rust_masm_tests/rust_sdk/base/faucet.rs | 139 ++ .../rust_sdk/base/input_note.rs | 154 ++ .../src/rust_masm_tests/rust_sdk/base/mod.rs | 9 + .../src/rust_masm_tests/rust_sdk/base/note.rs | 78 + .../rust_sdk/base/output_note.rs | 139 ++ .../src/rust_masm_tests/rust_sdk/base/tx.rs | 142 ++ .../src/rust_masm_tests/rust_sdk/mod.rs | 1 + 183 files changed, 55287 insertions(+), 929 deletions(-) create mode 100644 frontend/wasm/src/miden_abi/tx_kernel/asset.rs create mode 100644 frontend/wasm/src/miden_abi/tx_kernel/faucet.rs create mode 100644 frontend/wasm/src/miden_abi/tx_kernel/input_note.rs create mode 100644 sdk/base-sys/src/bindings/asset.rs create mode 100644 sdk/base-sys/src/bindings/faucet.rs create mode 100644 sdk/base-sys/src/bindings/input_note.rs create mode 100644 sdk/base-sys/stubs/asset.rs create mode 100644 sdk/base-sys/stubs/faucet.rs create mode 100644 sdk/base-sys/stubs/input_note.rs create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_account_asset_build_fungible_asset_binding.hir create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_account_asset_build_fungible_asset_binding.masm create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_account_asset_build_fungible_asset_binding.wat create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_account_asset_build_non_fungible_asset_binding.hir create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_account_asset_build_non_fungible_asset_binding.masm create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_account_asset_build_non_fungible_asset_binding.wat create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_account_compute_commitment_binding.hir create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_account_compute_commitment_binding.masm create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_account_compute_commitment_binding.wat create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_account_compute_delta_commitment_binding.hir create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_account_compute_delta_commitment_binding.masm create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_account_compute_delta_commitment_binding.wat create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_account_compute_storage_commitment_binding.hir create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_account_compute_storage_commitment_binding.masm create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_account_compute_storage_commitment_binding.wat create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_account_faucet_burn_binding.hir create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_account_faucet_burn_binding.masm create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_account_faucet_burn_binding.wat create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_account_faucet_create_fungible_asset_binding.hir create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_account_faucet_create_fungible_asset_binding.masm create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_account_faucet_create_fungible_asset_binding.wat create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_account_faucet_create_non_fungible_asset_binding.hir create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_account_faucet_create_non_fungible_asset_binding.masm create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_account_faucet_create_non_fungible_asset_binding.wat create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_account_faucet_get_total_issuance_binding.hir create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_account_faucet_get_total_issuance_binding.masm create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_account_faucet_get_total_issuance_binding.wat create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_account_faucet_is_non_fungible_asset_issued_binding.hir create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_account_faucet_is_non_fungible_asset_issued_binding.masm create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_account_faucet_is_non_fungible_asset_issued_binding.wat create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_account_faucet_mint_binding.hir create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_account_faucet_mint_binding.masm create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_account_faucet_mint_binding.wat create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_account_get_code_commitment_binding.hir create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_account_get_code_commitment_binding.masm create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_account_get_code_commitment_binding.wat create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_account_get_initial_balance_binding.hir create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_account_get_initial_balance_binding.masm create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_account_get_initial_balance_binding.wat create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_account_get_initial_storage_commitment_binding.hir create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_account_get_initial_storage_commitment_binding.masm create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_account_get_initial_storage_commitment_binding.wat create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_account_get_initial_vault_root_binding.hir create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_account_get_initial_vault_root_binding.masm create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_account_get_initial_vault_root_binding.wat create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_account_get_num_procedures_binding.hir create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_account_get_num_procedures_binding.masm create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_account_get_num_procedures_binding.wat create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_account_get_procedure_root_binding.hir create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_account_get_procedure_root_binding.masm create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_account_get_procedure_root_binding.wat create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_account_get_vault_root_binding.hir create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_account_get_vault_root_binding.masm create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_account_get_vault_root_binding.wat create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_account_has_non_fungible_asset_binding.hir create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_account_has_non_fungible_asset_binding.masm create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_account_has_non_fungible_asset_binding.wat create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_account_has_procedure_binding.hir create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_account_has_procedure_binding.masm create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_account_has_procedure_binding.wat create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_account_storage_get_initial_item_binding.hir create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_account_storage_get_initial_item_binding.masm create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_account_storage_get_initial_item_binding.wat create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_account_storage_get_initial_map_item_binding.hir create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_account_storage_get_initial_map_item_binding.masm create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_account_storage_get_initial_map_item_binding.wat create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_block_commitment_binding.hir create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_block_commitment_binding.masm create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_block_commitment_binding.wat create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_block_number_binding.hir create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_block_number_binding.masm create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_block_number_binding.wat create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_block_timestamp_binding.hir create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_block_timestamp_binding.masm create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_block_timestamp_binding.wat create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_expiration_block_delta_binding.hir create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_expiration_block_delta_binding.masm create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_expiration_block_delta_binding.wat create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_input_notes_commitment_binding.hir create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_input_notes_commitment_binding.masm create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_input_notes_commitment_binding.wat create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_num_input_notes_binding.hir create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_num_input_notes_binding.masm create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_num_input_notes_binding.wat create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_num_output_notes_binding.hir create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_num_output_notes_binding.masm create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_num_output_notes_binding.wat create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_output_notes_commitment_binding.hir create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_output_notes_commitment_binding.masm create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_output_notes_commitment_binding.wat create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_account_tx_update_expiration_block_delta_binding.hir create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_account_tx_update_expiration_block_delta_binding.masm create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_account_tx_update_expiration_block_delta_binding.wat create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_account_was_procedure_called_binding.hir create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_account_was_procedure_called_binding.masm create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_account_was_procedure_called_binding.wat create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_input_note_get_assets_binding.hir create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_input_note_get_assets_binding.masm create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_input_note_get_assets_binding.wat create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_input_note_get_assets_info_binding.hir create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_input_note_get_assets_info_binding.masm create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_input_note_get_assets_info_binding.wat create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_input_note_get_inputs_info_binding.hir create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_input_note_get_inputs_info_binding.masm create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_input_note_get_inputs_info_binding.wat create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_input_note_get_metadata_binding.hir create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_input_note_get_metadata_binding.masm create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_input_note_get_metadata_binding.wat create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_input_note_get_recipient_binding.hir create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_input_note_get_recipient_binding.masm create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_input_note_get_recipient_binding.wat create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_input_note_get_script_root_binding.hir create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_input_note_get_script_root_binding.masm create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_input_note_get_script_root_binding.wat create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_input_note_get_sender_binding.hir create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_input_note_get_sender_binding.masm create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_input_note_get_sender_binding.wat create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_input_note_get_serial_number_binding.hir create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_input_note_get_serial_number_binding.masm create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_input_note_get_serial_number_binding.wat create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_note_add_assets_to_account_binding.hir create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_note_add_assets_to_account_binding.masm create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_note_add_assets_to_account_binding.wat create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_output_note_add_asset_binding.hir create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_output_note_add_asset_binding.masm create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_output_note_add_asset_binding.wat create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_output_note_create_binding.hir create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_output_note_create_binding.masm create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_output_note_create_binding.wat create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_output_note_get_assets_binding.hir create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_output_note_get_assets_binding.masm create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_output_note_get_assets_binding.wat create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_output_note_get_assets_info_binding.hir create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_output_note_get_assets_info_binding.masm create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_output_note_get_assets_info_binding.wat create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_output_note_get_metadata_binding.hir create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_output_note_get_metadata_binding.masm create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_output_note_get_metadata_binding.wat create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_output_note_get_recipient_binding.hir create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_output_note_get_recipient_binding.masm create mode 100644 tests/integration/expected/rust_sdk/rust_sdk_output_note_get_recipient_binding.wat create mode 100644 tests/integration/src/rust_masm_tests/rust_sdk/base/account.rs create mode 100644 tests/integration/src/rust_masm_tests/rust_sdk/base/asset.rs create mode 100644 tests/integration/src/rust_masm_tests/rust_sdk/base/faucet.rs create mode 100644 tests/integration/src/rust_masm_tests/rust_sdk/base/input_note.rs create mode 100644 tests/integration/src/rust_masm_tests/rust_sdk/base/mod.rs create mode 100644 tests/integration/src/rust_masm_tests/rust_sdk/base/note.rs create mode 100644 tests/integration/src/rust_masm_tests/rust_sdk/base/output_note.rs create mode 100644 tests/integration/src/rust_masm_tests/rust_sdk/base/tx.rs diff --git a/frontend/wasm/src/miden_abi/transform.rs b/frontend/wasm/src/miden_abi/transform.rs index 273fa05ce..ae21436ce 100644 --- a/frontend/wasm/src/miden_abi/transform.rs +++ b/frontend/wasm/src/miden_abi/transform.rs @@ -80,32 +80,87 @@ fn get_transform_strategy(path: &SymbolPath) -> Option { | tx_kernel::account::SET_STORAGE_MAP_ITEM => { Some(TransformStrategy::ReturnViaPointer) } - tx_kernel::account::INCR_NONCE => Some(TransformStrategy::NoTransform), + tx_kernel::account::INCR_NONCE | tx_kernel::account::WAS_PROCEDURE_CALLED => { + Some(TransformStrategy::NoTransform) + } _ => None, } } symbols::ActiveAccount => { match components.next_if(|c| c.is_leaf())?.as_symbol_name().as_str() { - tx_kernel::account::GET_NONCE | tx_kernel::account::GET_BALANCE => { - Some(TransformStrategy::NoTransform) - } + tx_kernel::account::GET_NONCE + | tx_kernel::account::GET_BALANCE + | tx_kernel::account::GET_INITIAL_BALANCE + | tx_kernel::account::GET_NUM_PROCEDURES + | tx_kernel::account::HAS_NON_FUNGIBLE_ASSET + | tx_kernel::account::HAS_PROCEDURE => Some(TransformStrategy::NoTransform), tx_kernel::account::GET_ID | tx_kernel::account::GET_INITIAL_COMMITMENT + | tx_kernel::account::GET_CODE_COMMITMENT | tx_kernel::account::COMPUTE_COMMITMENT + | tx_kernel::account::GET_INITIAL_STORAGE_COMMITMENT + | tx_kernel::account::COMPUTE_STORAGE_COMMITMENT | tx_kernel::account::GET_STORAGE_ITEM - | tx_kernel::account::GET_STORAGE_MAP_ITEM => { + | tx_kernel::account::GET_INITIAL_STORAGE_ITEM + | tx_kernel::account::GET_STORAGE_MAP_ITEM + | tx_kernel::account::GET_INITIAL_STORAGE_MAP_ITEM + | tx_kernel::account::GET_INITIAL_VAULT_ROOT + | tx_kernel::account::GET_VAULT_ROOT + | tx_kernel::account::GET_PROCEDURE_ROOT => { Some(TransformStrategy::ReturnViaPointer) } _ => None, } } + symbols::Asset => { + match components.next_if(|c| c.is_leaf())?.as_symbol_name().as_str() { + tx_kernel::asset::BUILD_FUNGIBLE_ASSET + | tx_kernel::asset::BUILD_NON_FUNGIBLE_ASSET => { + Some(TransformStrategy::ReturnViaPointer) + } + _ => None, + } + } + symbols::Faucet => { + match components.next_if(|c| c.is_leaf())?.as_symbol_name().as_str() { + tx_kernel::faucet::CREATE_FUNGIBLE_ASSET + | tx_kernel::faucet::CREATE_NON_FUNGIBLE_ASSET + | tx_kernel::faucet::MINT + | tx_kernel::faucet::BURN => Some(TransformStrategy::ReturnViaPointer), + tx_kernel::faucet::GET_TOTAL_ISSUANCE + | tx_kernel::faucet::IS_NON_FUNGIBLE_ASSET_ISSUED => { + Some(TransformStrategy::NoTransform) + } + _ => None, + } + } symbols::ActiveNote => { match components.next_if(|c| c.is_leaf())?.as_symbol_name().as_str() { tx_kernel::active_note::GET_INPUTS => Some(TransformStrategy::ListReturn), tx_kernel::active_note::GET_ASSETS => Some(TransformStrategy::ListReturn), tx_kernel::active_note::GET_SENDER + | tx_kernel::active_note::GET_RECIPIENT | tx_kernel::active_note::GET_SCRIPT_ROOT - | tx_kernel::active_note::GET_SERIAL_NUMBER => { + | tx_kernel::active_note::GET_SERIAL_NUMBER + | tx_kernel::active_note::GET_METADATA => { + Some(TransformStrategy::ReturnViaPointer) + } + tx_kernel::active_note::ADD_ASSETS_TO_ACCOUNT => { + Some(TransformStrategy::NoTransform) + } + _ => None, + } + } + symbols::InputNote => { + match components.next_if(|c| c.is_leaf())?.as_symbol_name().as_str() { + tx_kernel::input_note::GET_ASSETS => Some(TransformStrategy::ListReturn), + tx_kernel::input_note::GET_ASSETS_INFO + | tx_kernel::input_note::GET_RECIPIENT + | tx_kernel::input_note::GET_METADATA + | tx_kernel::input_note::GET_SENDER + | tx_kernel::input_note::GET_INPUTS_INFO + | tx_kernel::input_note::GET_SCRIPT_ROOT + | tx_kernel::input_note::GET_SERIAL_NUMBER => { Some(TransformStrategy::ReturnViaPointer) } _ => None, @@ -115,15 +170,27 @@ fn get_transform_strategy(path: &SymbolPath) -> Option { match components.next_if(|c| c.is_leaf())?.as_symbol_name().as_str() { tx_kernel::output_note::CREATE => Some(TransformStrategy::NoTransform), tx_kernel::output_note::ADD_ASSET => Some(TransformStrategy::NoTransform), + tx_kernel::output_note::GET_ASSETS => Some(TransformStrategy::ListReturn), + tx_kernel::output_note::GET_ASSETS_INFO + | tx_kernel::output_note::GET_RECIPIENT + | tx_kernel::output_note::GET_METADATA => { + Some(TransformStrategy::ReturnViaPointer) + } _ => None, } } symbols::Tx => match components.next_if(|c| c.is_leaf())?.as_symbol_name().as_str() { - tx_kernel::tx::GET_BLOCK_NUMBER => Some(TransformStrategy::NoTransform), - tx_kernel::tx::GET_INPUT_NOTES_COMMITMENT - | tx_kernel::tx::GET_OUTPUT_NOTES_COMMITMENT => { - Some(TransformStrategy::ReturnViaPointer) + tx_kernel::tx::GET_BLOCK_NUMBER + | tx_kernel::tx::GET_BLOCK_TIMESTAMP + | tx_kernel::tx::GET_NUM_INPUT_NOTES + | tx_kernel::tx::GET_NUM_OUTPUT_NOTES + | tx_kernel::tx::GET_EXPIRATION_BLOCK_DELTA + | tx_kernel::tx::UPDATE_EXPIRATION_BLOCK_DELTA => { + Some(TransformStrategy::NoTransform) } + tx_kernel::tx::GET_INPUT_NOTES_COMMITMENT + | tx_kernel::tx::GET_OUTPUT_NOTES_COMMITMENT + | tx_kernel::tx::GET_BLOCK_COMMITMENT => Some(TransformStrategy::ReturnViaPointer), _ => None, }, _ => None, diff --git a/frontend/wasm/src/miden_abi/tx_kernel.rs b/frontend/wasm/src/miden_abi/tx_kernel.rs index 5970912d6..908b2a2db 100644 --- a/frontend/wasm/src/miden_abi/tx_kernel.rs +++ b/frontend/wasm/src/miden_abi/tx_kernel.rs @@ -2,6 +2,9 @@ pub(crate) mod account; pub(crate) mod active_note; +pub(crate) mod asset; +pub(crate) mod faucet; +pub(crate) mod input_note; pub(crate) mod output_note; pub(crate) mod tx; @@ -14,6 +17,9 @@ pub(crate) fn signatures() -> &'static ModuleFunctionTypeMap { let mut m: ModuleFunctionTypeMap = Default::default(); m.extend(account::signatures()); m.extend(active_note::signatures()); + m.extend(asset::signatures()); + m.extend(faucet::signatures()); + m.extend(input_note::signatures()); m.extend(output_note::signatures()); m.extend(tx::signatures()); m diff --git a/frontend/wasm/src/miden_abi/tx_kernel/account.rs b/frontend/wasm/src/miden_abi/tx_kernel/account.rs index 62de74f21..84dd2e365 100644 --- a/frontend/wasm/src/miden_abi/tx_kernel/account.rs +++ b/frontend/wasm/src/miden_abi/tx_kernel/account.rs @@ -23,14 +23,27 @@ pub const REMOVE_ASSET: &str = "remove_asset"; pub const GET_ID: &str = "get_id"; pub const GET_NONCE: &str = "get_nonce"; pub const GET_INITIAL_COMMITMENT: &str = "get_initial_commitment"; +pub const GET_CODE_COMMITMENT: &str = "get_code_commitment"; pub const COMPUTE_COMMITMENT: &str = "compute_commitment"; pub const COMPUTE_DELTA_COMMITMENT: &str = "compute_delta_commitment"; +pub const GET_INITIAL_STORAGE_COMMITMENT: &str = "get_initial_storage_commitment"; +pub const COMPUTE_STORAGE_COMMITMENT: &str = "compute_storage_commitment"; pub const GET_STORAGE_ITEM: &str = "get_item"; +pub const GET_INITIAL_STORAGE_ITEM: &str = "get_initial_item"; pub const SET_STORAGE_ITEM: &str = "set_item"; pub const GET_STORAGE_MAP_ITEM: &str = "get_map_item"; +pub const GET_INITIAL_STORAGE_MAP_ITEM: &str = "get_initial_map_item"; pub const SET_STORAGE_MAP_ITEM: &str = "set_map_item"; pub const INCR_NONCE: &str = "incr_nonce"; pub const GET_BALANCE: &str = "get_balance"; +pub const GET_INITIAL_BALANCE: &str = "get_initial_balance"; +pub const HAS_NON_FUNGIBLE_ASSET: &str = "has_non_fungible_asset"; +pub const GET_INITIAL_VAULT_ROOT: &str = "get_initial_vault_root"; +pub const GET_VAULT_ROOT: &str = "get_vault_root"; +pub const GET_NUM_PROCEDURES: &str = "get_num_procedures"; +pub const GET_PROCEDURE_ROOT: &str = "get_procedure_root"; +pub const HAS_PROCEDURE: &str = "has_procedure"; +pub const WAS_PROCEDURE_CALLED: &str = "was_procedure_called"; pub(crate) fn signatures() -> ModuleFunctionTypeMap { let mut m: ModuleFunctionTypeMap = Default::default(); @@ -65,6 +78,10 @@ pub(crate) fn signatures() -> ModuleFunctionTypeMap { ), ); native_account.insert(Symbol::from(INCR_NONCE), FunctionType::new(CallConv::Wasm, [], [Felt])); + native_account.insert( + Symbol::from(WAS_PROCEDURE_CALLED), + FunctionType::new(CallConv::Wasm, [Felt, Felt, Felt, Felt], [Felt]), + ); m.insert(SymbolPath::from_iter(NATIVE_MODULE_PREFIX.iter().copied()), native_account); let mut active_account: FunctionTypeMap = Default::default(); @@ -75,22 +92,68 @@ pub(crate) fn signatures() -> ModuleFunctionTypeMap { Symbol::from(GET_INITIAL_COMMITMENT), FunctionType::new(CallConv::Wasm, [], [Felt, Felt, Felt, Felt]), ); + active_account.insert( + Symbol::from(GET_CODE_COMMITMENT), + FunctionType::new(CallConv::Wasm, [], [Felt, Felt, Felt, Felt]), + ); active_account.insert( Symbol::from(COMPUTE_COMMITMENT), FunctionType::new(CallConv::Wasm, [], [Felt, Felt, Felt, Felt]), ); + active_account.insert( + Symbol::from(GET_INITIAL_STORAGE_COMMITMENT), + FunctionType::new(CallConv::Wasm, [], [Felt, Felt, Felt, Felt]), + ); + active_account.insert( + Symbol::from(COMPUTE_STORAGE_COMMITMENT), + FunctionType::new(CallConv::Wasm, [], [Felt, Felt, Felt, Felt]), + ); active_account.insert( Symbol::from(GET_STORAGE_ITEM), FunctionType::new(CallConv::Wasm, [Felt], [Felt, Felt, Felt, Felt]), ); + active_account.insert( + Symbol::from(GET_INITIAL_STORAGE_ITEM), + FunctionType::new(CallConv::Wasm, [Felt], [Felt, Felt, Felt, Felt]), + ); active_account.insert( Symbol::from(GET_STORAGE_MAP_ITEM), FunctionType::new(CallConv::Wasm, [Felt, Felt, Felt, Felt, Felt], [Felt, Felt, Felt, Felt]), ); + active_account.insert( + Symbol::from(GET_INITIAL_STORAGE_MAP_ITEM), + FunctionType::new(CallConv::Wasm, [Felt, Felt, Felt, Felt, Felt], [Felt, Felt, Felt, Felt]), + ); active_account.insert( Symbol::from(GET_BALANCE), FunctionType::new(CallConv::Wasm, [Felt, Felt], [Felt]), ); + active_account.insert( + Symbol::from(GET_INITIAL_BALANCE), + FunctionType::new(CallConv::Wasm, [Felt, Felt], [Felt]), + ); + active_account.insert( + Symbol::from(HAS_NON_FUNGIBLE_ASSET), + FunctionType::new(CallConv::Wasm, [Felt, Felt, Felt, Felt], [Felt]), + ); + active_account.insert( + Symbol::from(GET_INITIAL_VAULT_ROOT), + FunctionType::new(CallConv::Wasm, [], [Felt, Felt, Felt, Felt]), + ); + active_account.insert( + Symbol::from(GET_VAULT_ROOT), + FunctionType::new(CallConv::Wasm, [], [Felt, Felt, Felt, Felt]), + ); + active_account + .insert(Symbol::from(GET_NUM_PROCEDURES), FunctionType::new(CallConv::Wasm, [], [Felt])); + active_account.insert( + Symbol::from(GET_PROCEDURE_ROOT), + FunctionType::new(CallConv::Wasm, [Felt], [Felt, Felt, Felt, Felt]), + ); + active_account.insert( + Symbol::from(HAS_PROCEDURE), + FunctionType::new(CallConv::Wasm, [Felt, Felt, Felt, Felt], [Felt]), + ); m.insert(SymbolPath::from_iter(ACTIVE_MODULE_PREFIX.iter().copied()), active_account); m diff --git a/frontend/wasm/src/miden_abi/tx_kernel/active_note.rs b/frontend/wasm/src/miden_abi/tx_kernel/active_note.rs index ee980f362..e3bdd06fe 100644 --- a/frontend/wasm/src/miden_abi/tx_kernel/active_note.rs +++ b/frontend/wasm/src/miden_abi/tx_kernel/active_note.rs @@ -16,8 +16,11 @@ pub(crate) const MODULE_PREFIX: &[SymbolNameComponent] = &[ pub const GET_INPUTS: &str = "get_inputs"; pub const GET_ASSETS: &str = "get_assets"; pub const GET_SENDER: &str = "get_sender"; +pub const GET_RECIPIENT: &str = "get_recipient"; pub const GET_SCRIPT_ROOT: &str = "get_script_root"; pub const GET_SERIAL_NUMBER: &str = "get_serial_number"; +pub const GET_METADATA: &str = "get_metadata"; +pub const ADD_ASSETS_TO_ACCOUNT: &str = "add_assets_to_account"; pub(crate) fn signatures() -> ModuleFunctionTypeMap { let mut m: ModuleFunctionTypeMap = Default::default(); @@ -25,6 +28,10 @@ pub(crate) fn signatures() -> ModuleFunctionTypeMap { note.insert(Symbol::from(GET_INPUTS), FunctionType::new(CallConv::Wasm, [I32], [I32, I32])); note.insert(Symbol::from(GET_ASSETS), FunctionType::new(CallConv::Wasm, [I32], [I32, I32])); note.insert(Symbol::from(GET_SENDER), FunctionType::new(CallConv::Wasm, [], [Felt, Felt])); + note.insert( + Symbol::from(GET_RECIPIENT), + FunctionType::new(CallConv::Wasm, [], [Felt, Felt, Felt, Felt]), + ); note.insert( Symbol::from(GET_SCRIPT_ROOT), FunctionType::new(CallConv::Wasm, [], [Felt, Felt, Felt, Felt]), @@ -33,6 +40,11 @@ pub(crate) fn signatures() -> ModuleFunctionTypeMap { Symbol::from(GET_SERIAL_NUMBER), FunctionType::new(CallConv::Wasm, [], [Felt, Felt, Felt, Felt]), ); + note.insert( + Symbol::from(GET_METADATA), + FunctionType::new(CallConv::Wasm, [], [Felt, Felt, Felt, Felt]), + ); + note.insert(Symbol::from(ADD_ASSETS_TO_ACCOUNT), FunctionType::new(CallConv::Wasm, [], [])); m.insert(SymbolPath::from_iter(MODULE_PREFIX.iter().copied()), note); m } diff --git a/frontend/wasm/src/miden_abi/tx_kernel/asset.rs b/frontend/wasm/src/miden_abi/tx_kernel/asset.rs new file mode 100644 index 000000000..1159a4edd --- /dev/null +++ b/frontend/wasm/src/miden_abi/tx_kernel/asset.rs @@ -0,0 +1,36 @@ +use midenc_hir::{ + interner::{symbols, Symbol}, + CallConv, FunctionType, SymbolNameComponent, SymbolPath, + Type::*, +}; + +use crate::miden_abi::{FunctionTypeMap, ModuleFunctionTypeMap}; + +pub const MODULE_ID: &str = "miden::asset"; + +fn module_path() -> SymbolPath { + let parts = [ + SymbolNameComponent::Root, + SymbolNameComponent::Component(symbols::Miden), + SymbolNameComponent::Component(Symbol::intern("asset")), + ]; + SymbolPath::from_iter(parts) +} + +pub const BUILD_FUNGIBLE_ASSET: &str = "build_fungible_asset"; +pub const BUILD_NON_FUNGIBLE_ASSET: &str = "build_non_fungible_asset"; + +pub(crate) fn signatures() -> ModuleFunctionTypeMap { + let mut m: ModuleFunctionTypeMap = Default::default(); + let mut funcs: FunctionTypeMap = Default::default(); + funcs.insert( + Symbol::from(BUILD_FUNGIBLE_ASSET), + FunctionType::new(CallConv::Wasm, [Felt, Felt, Felt], [Felt, Felt, Felt, Felt]), + ); + funcs.insert( + Symbol::from(BUILD_NON_FUNGIBLE_ASSET), + FunctionType::new(CallConv::Wasm, [Felt, Felt, Felt, Felt, Felt], [Felt, Felt, Felt, Felt]), + ); + m.insert(module_path(), funcs); + m +} diff --git a/frontend/wasm/src/miden_abi/tx_kernel/faucet.rs b/frontend/wasm/src/miden_abi/tx_kernel/faucet.rs new file mode 100644 index 000000000..ef2633ddc --- /dev/null +++ b/frontend/wasm/src/miden_abi/tx_kernel/faucet.rs @@ -0,0 +1,53 @@ +use midenc_hir::{ + interner::{symbols, Symbol}, + CallConv, FunctionType, SymbolNameComponent, SymbolPath, + Type::*, +}; + +use crate::miden_abi::{FunctionTypeMap, ModuleFunctionTypeMap}; + +pub const MODULE_ID: &str = "miden::faucet"; + +fn module_path() -> SymbolPath { + let parts = [ + SymbolNameComponent::Root, + SymbolNameComponent::Component(symbols::Miden), + SymbolNameComponent::Component(Symbol::intern("faucet")), + ]; + SymbolPath::from_iter(parts) +} + +pub const CREATE_FUNGIBLE_ASSET: &str = "create_fungible_asset"; +pub const CREATE_NON_FUNGIBLE_ASSET: &str = "create_non_fungible_asset"; +pub const MINT: &str = "mint"; +pub const BURN: &str = "burn"; +pub const GET_TOTAL_ISSUANCE: &str = "get_total_issuance"; +pub const IS_NON_FUNGIBLE_ASSET_ISSUED: &str = "is_non_fungible_asset_issued"; + +pub(crate) fn signatures() -> ModuleFunctionTypeMap { + let mut m: ModuleFunctionTypeMap = Default::default(); + let mut funcs: FunctionTypeMap = Default::default(); + funcs.insert( + Symbol::from(CREATE_FUNGIBLE_ASSET), + FunctionType::new(CallConv::Wasm, [Felt], [Felt, Felt, Felt, Felt]), + ); + funcs.insert( + Symbol::from(CREATE_NON_FUNGIBLE_ASSET), + FunctionType::new(CallConv::Wasm, [Felt, Felt, Felt, Felt], [Felt, Felt, Felt, Felt]), + ); + funcs.insert( + Symbol::from(MINT), + FunctionType::new(CallConv::Wasm, [Felt, Felt, Felt, Felt], [Felt, Felt, Felt, Felt]), + ); + funcs.insert( + Symbol::from(BURN), + FunctionType::new(CallConv::Wasm, [Felt, Felt, Felt, Felt], [Felt, Felt, Felt, Felt]), + ); + funcs.insert(Symbol::from(GET_TOTAL_ISSUANCE), FunctionType::new(CallConv::Wasm, [], [Felt])); + funcs.insert( + Symbol::from(IS_NON_FUNGIBLE_ASSET_ISSUED), + FunctionType::new(CallConv::Wasm, [Felt, Felt, Felt, Felt], [Felt]), + ); + m.insert(module_path(), funcs); + m +} diff --git a/frontend/wasm/src/miden_abi/tx_kernel/input_note.rs b/frontend/wasm/src/miden_abi/tx_kernel/input_note.rs new file mode 100644 index 000000000..4b85af7eb --- /dev/null +++ b/frontend/wasm/src/miden_abi/tx_kernel/input_note.rs @@ -0,0 +1,66 @@ +use midenc_hir::{ + interner::{symbols, Symbol}, + CallConv, FunctionType, SymbolNameComponent, SymbolPath, + Type::*, +}; + +use crate::miden_abi::{FunctionTypeMap, ModuleFunctionTypeMap}; + +pub const MODULE_ID: &str = "miden::input_note"; + +fn module_path() -> SymbolPath { + let parts = [ + SymbolNameComponent::Root, + SymbolNameComponent::Component(symbols::Miden), + SymbolNameComponent::Component(Symbol::intern("input_note")), + ]; + SymbolPath::from_iter(parts) +} + +pub const GET_ASSETS_INFO: &str = "get_assets_info"; +pub const GET_ASSETS: &str = "get_assets"; +pub const GET_RECIPIENT: &str = "get_recipient"; +pub const GET_METADATA: &str = "get_metadata"; +pub const GET_SENDER: &str = "get_sender"; +pub const GET_INPUTS_INFO: &str = "get_inputs_info"; +pub const GET_SCRIPT_ROOT: &str = "get_script_root"; +pub const GET_SERIAL_NUMBER: &str = "get_serial_number"; + +pub(crate) fn signatures() -> ModuleFunctionTypeMap { + let mut m: ModuleFunctionTypeMap = Default::default(); + let mut funcs: FunctionTypeMap = Default::default(); + funcs.insert( + Symbol::from(GET_ASSETS_INFO), + FunctionType::new(CallConv::Wasm, [Felt], [Felt, Felt, Felt, Felt, Felt]), + ); + funcs.insert( + Symbol::from(GET_ASSETS), + FunctionType::new(CallConv::Wasm, [I32, Felt], [I32, I32]), + ); + funcs.insert( + Symbol::from(GET_RECIPIENT), + FunctionType::new(CallConv::Wasm, [Felt], [Felt, Felt, Felt, Felt]), + ); + funcs.insert( + Symbol::from(GET_METADATA), + FunctionType::new(CallConv::Wasm, [Felt], [Felt, Felt, Felt, Felt]), + ); + funcs.insert( + Symbol::from(GET_SENDER), + FunctionType::new(CallConv::Wasm, [Felt], [Felt, Felt]), + ); + funcs.insert( + Symbol::from(GET_INPUTS_INFO), + FunctionType::new(CallConv::Wasm, [Felt], [Felt, Felt, Felt, Felt, Felt]), + ); + funcs.insert( + Symbol::from(GET_SCRIPT_ROOT), + FunctionType::new(CallConv::Wasm, [Felt], [Felt, Felt, Felt, Felt]), + ); + funcs.insert( + Symbol::from(GET_SERIAL_NUMBER), + FunctionType::new(CallConv::Wasm, [Felt], [Felt, Felt, Felt, Felt]), + ); + m.insert(module_path(), funcs); + m +} diff --git a/frontend/wasm/src/miden_abi/tx_kernel/output_note.rs b/frontend/wasm/src/miden_abi/tx_kernel/output_note.rs index bc86867f8..77f0d6639 100644 --- a/frontend/wasm/src/miden_abi/tx_kernel/output_note.rs +++ b/frontend/wasm/src/miden_abi/tx_kernel/output_note.rs @@ -15,6 +15,10 @@ pub(crate) const MODULE_PREFIX: &[SymbolNameComponent] = &[ pub const CREATE: &str = "create"; pub const ADD_ASSET: &str = "add_asset"; +pub const GET_ASSETS_INFO: &str = "get_assets_info"; +pub const GET_ASSETS: &str = "get_assets"; +pub const GET_RECIPIENT: &str = "get_recipient"; +pub const GET_METADATA: &str = "get_metadata"; pub(crate) fn signatures() -> ModuleFunctionTypeMap { let mut m: ModuleFunctionTypeMap = Default::default(); @@ -44,6 +48,22 @@ pub(crate) fn signatures() -> ModuleFunctionTypeMap { [], ), ); + output_note.insert( + Symbol::from(GET_ASSETS_INFO), + FunctionType::new(CallConv::Wasm, [Felt], [Felt, Felt, Felt, Felt, Felt]), + ); + output_note.insert( + Symbol::from(GET_ASSETS), + FunctionType::new(CallConv::Wasm, [I32, Felt], [I32, I32]), + ); + output_note.insert( + Symbol::from(GET_RECIPIENT), + FunctionType::new(CallConv::Wasm, [Felt], [Felt, Felt, Felt, Felt]), + ); + output_note.insert( + Symbol::from(GET_METADATA), + FunctionType::new(CallConv::Wasm, [Felt], [Felt, Felt, Felt, Felt]), + ); m.insert(SymbolPath::from_iter(MODULE_PREFIX.iter().copied()), output_note); m } diff --git a/frontend/wasm/src/miden_abi/tx_kernel/tx.rs b/frontend/wasm/src/miden_abi/tx_kernel/tx.rs index 7c3678dbb..6ce07d6e0 100644 --- a/frontend/wasm/src/miden_abi/tx_kernel/tx.rs +++ b/frontend/wasm/src/miden_abi/tx_kernel/tx.rs @@ -14,13 +14,24 @@ pub(crate) const MODULE_PREFIX: &[SymbolNameComponent] = &[ ]; pub const GET_BLOCK_NUMBER: &str = "get_block_number"; +pub const GET_BLOCK_COMMITMENT: &str = "get_block_commitment"; +pub const GET_BLOCK_TIMESTAMP: &str = "get_block_timestamp"; pub const GET_INPUT_NOTES_COMMITMENT: &str = "get_input_notes_commitment"; pub const GET_OUTPUT_NOTES_COMMITMENT: &str = "get_output_notes_commitment"; +pub const GET_NUM_INPUT_NOTES: &str = "get_num_input_notes"; +pub const GET_NUM_OUTPUT_NOTES: &str = "get_num_output_notes"; +pub const GET_EXPIRATION_BLOCK_DELTA: &str = "get_expiration_block_delta"; +pub const UPDATE_EXPIRATION_BLOCK_DELTA: &str = "update_expiration_block_delta"; pub(crate) fn signatures() -> ModuleFunctionTypeMap { let mut m: ModuleFunctionTypeMap = Default::default(); let mut tx: FunctionTypeMap = Default::default(); tx.insert(Symbol::from(GET_BLOCK_NUMBER), FunctionType::new(CallConv::Wasm, [], [Felt])); + tx.insert( + Symbol::from(GET_BLOCK_COMMITMENT), + FunctionType::new(CallConv::Wasm, [], [Felt, Felt, Felt, Felt]), + ); + tx.insert(Symbol::from(GET_BLOCK_TIMESTAMP), FunctionType::new(CallConv::Wasm, [], [Felt])); tx.insert( Symbol::from(GET_INPUT_NOTES_COMMITMENT), FunctionType::new(CallConv::Wasm, [], [Felt, Felt, Felt, Felt]), @@ -29,6 +40,19 @@ pub(crate) fn signatures() -> ModuleFunctionTypeMap { Symbol::from(GET_OUTPUT_NOTES_COMMITMENT), FunctionType::new(CallConv::Wasm, [], [Felt, Felt, Felt, Felt]), ); + tx.insert(Symbol::from(GET_NUM_INPUT_NOTES), FunctionType::new(CallConv::Wasm, [], [Felt])); + tx.insert( + Symbol::from(GET_NUM_OUTPUT_NOTES), + FunctionType::new(CallConv::Wasm, [], [Felt]), + ); + tx.insert( + Symbol::from(GET_EXPIRATION_BLOCK_DELTA), + FunctionType::new(CallConv::Wasm, [], [Felt]), + ); + tx.insert( + Symbol::from(UPDATE_EXPIRATION_BLOCK_DELTA), + FunctionType::new(CallConv::Wasm, [Felt], []), + ); m.insert(SymbolPath::from_iter(MODULE_PREFIX.iter().copied()), tx); m } diff --git a/hir-symbol/src/symbols.toml b/hir-symbol/src/symbols.toml index e19817031..c138ebef6 100644 --- a/hir-symbol/src/symbols.toml +++ b/hir-symbol/src/symbols.toml @@ -106,6 +106,7 @@ native_account = {} active_account = {} active_note = {} input_note = {} +asset = {} blake3 = {} crypto = {} debug = {} @@ -118,6 +119,7 @@ miden = {} mem = {} note = {} output_note = {} +faucet = {} rpo_falcon512 = {} std = {} tx = {} diff --git a/sdk/base-sys/src/bindings/account.rs b/sdk/base-sys/src/bindings/account.rs index 138858381..a796e70d2 100644 --- a/sdk/base-sys/src/bindings/account.rs +++ b/sdk/base-sys/src/bindings/account.rs @@ -18,11 +18,51 @@ extern "C" { pub fn extern_account_compute_commitment(ptr: *mut Word); #[link_name = "miden::native_account::compute_delta_commitment"] pub fn extern_account_compute_delta_commitment(ptr: *mut Word); + #[link_name = "miden::active_account::get_code_commitment"] + pub fn extern_account_get_code_commitment(ptr: *mut Word); + #[link_name = "miden::active_account::get_initial_storage_commitment"] + pub fn extern_account_get_initial_storage_commitment(ptr: *mut Word); + #[link_name = "miden::active_account::compute_storage_commitment"] + pub fn extern_account_compute_storage_commitment(ptr: *mut Word); + #[link_name = "miden::active_account::get_initial_balance"] + pub fn extern_account_get_initial_balance( + faucet_id_prefix: Felt, + faucet_id_suffix: Felt, + ) -> Felt; + #[link_name = "miden::active_account::has_non_fungible_asset"] + pub fn extern_account_has_non_fungible_asset( + asset_3: Felt, + asset_2: Felt, + asset_1: Felt, + asset_0: Felt, + ) -> Felt; + #[link_name = "miden::active_account::get_initial_vault_root"] + pub fn extern_account_get_initial_vault_root(ptr: *mut Word); + #[link_name = "miden::active_account::get_vault_root"] + pub fn extern_account_get_vault_root(ptr: *mut Word); + #[link_name = "miden::active_account::get_num_procedures"] + pub fn extern_account_get_num_procedures() -> Felt; + #[link_name = "miden::active_account::get_procedure_root"] + pub fn extern_account_get_procedure_root(index: Felt, ptr: *mut Word); + #[link_name = "miden::active_account::has_procedure"] + pub fn extern_account_has_procedure( + proc_root_3: Felt, + proc_root_2: Felt, + proc_root_1: Felt, + proc_root_0: Felt, + ) -> Felt; // Resolved via stub rlib at core Wasm link time #[link_name = "miden::native_account::add_asset"] pub fn extern_account_add_asset(_: Felt, _: Felt, _: Felt, _: Felt, ptr: *mut Asset); #[link_name = "miden::active_account::get_balance"] pub fn extern_account_get_balance(faucet_id_prefix: Felt, faucet_id_suffix: Felt) -> Felt; + #[link_name = "miden::native_account::was_procedure_called"] + pub fn extern_account_was_procedure_called( + proc_root_3: Felt, + proc_root_2: Felt, + proc_root_1: Felt, + proc_root_0: Felt, + ) -> Felt; } /// Get the account ID of the currently executing note account. @@ -124,6 +164,36 @@ pub fn compute_delta_commitment() -> Word { } } +/// Returns the code commitment of the active account. +#[inline] +pub fn get_code_commitment() -> Word { + unsafe { + let mut ret_area = ::core::mem::MaybeUninit::::uninit(); + extern_account_get_code_commitment(ret_area.as_mut_ptr()); + ret_area.assume_init().reverse() + } +} + +/// Returns the initial storage commitment of the active account. +#[inline] +pub fn get_initial_storage_commitment() -> Word { + unsafe { + let mut ret_area = ::core::mem::MaybeUninit::::uninit(); + extern_account_get_initial_storage_commitment(ret_area.as_mut_ptr()); + ret_area.assume_init().reverse() + } +} + +/// Computes the latest storage commitment of the active account. +#[inline] +pub fn compute_storage_commitment() -> Word { + unsafe { + let mut ret_area = ::core::mem::MaybeUninit::::uninit(); + extern_account_compute_storage_commitment(ret_area.as_mut_ptr()); + ret_area.assume_init().reverse() + } +} + /// Returns the balance of the fungible asset identified by `faucet_id`. /// /// # Panics @@ -133,3 +203,76 @@ pub fn compute_delta_commitment() -> Word { pub fn get_balance(faucet_id: AccountId) -> Felt { unsafe { extern_account_get_balance(faucet_id.prefix, faucet_id.suffix) } } + +/// Returns the initial balance of the fungible asset identified by `faucet_id`. +#[inline] +pub fn get_initial_balance(faucet_id: AccountId) -> Felt { + unsafe { extern_account_get_initial_balance(faucet_id.prefix, faucet_id.suffix) } +} + +/// Returns `true` if the active account vault currently contains the specified non-fungible asset. +#[inline] +pub fn has_non_fungible_asset(asset: Asset) -> bool { + unsafe { + extern_account_has_non_fungible_asset( + asset.inner[3], + asset.inner[2], + asset.inner[1], + asset.inner[0], + ) != Felt::from_u32(0) + } +} + +/// Returns the storage commitment of the active account vault at the beginning of the transaction. +#[inline] +pub fn get_initial_vault_root() -> Word { + unsafe { + let mut ret_area = ::core::mem::MaybeUninit::::uninit(); + extern_account_get_initial_vault_root(ret_area.as_mut_ptr()); + ret_area.assume_init().reverse() + } +} + +/// Returns the current storage commitment of the active account vault. +#[inline] +pub fn get_vault_root() -> Word { + unsafe { + let mut ret_area = ::core::mem::MaybeUninit::::uninit(); + extern_account_get_vault_root(ret_area.as_mut_ptr()); + ret_area.assume_init().reverse() + } +} + +/// Returns the number of procedures exported by the active account. +#[inline] +pub fn get_num_procedures() -> Felt { + unsafe { extern_account_get_num_procedures() } +} + +/// Returns the procedure root for the procedure at `index`. +#[inline] +pub fn get_procedure_root(index: u8) -> Word { + unsafe { + let mut ret_area = ::core::mem::MaybeUninit::::uninit(); + extern_account_get_procedure_root(index.into(), ret_area.as_mut_ptr()); + ret_area.assume_init().reverse() + } +} + +/// Returns `true` if the procedure identified by `proc_root` exists on the active account. +#[inline] +pub fn has_procedure(proc_root: Word) -> bool { + unsafe { + extern_account_has_procedure(proc_root[3], proc_root[2], proc_root[1], proc_root[0]) + != Felt::from_u32(0) + } +} + +/// Returns `true` if the procedure identified by `proc_root` was called during the transaction. +#[inline] +pub fn was_procedure_called(proc_root: Word) -> bool { + unsafe { + extern_account_was_procedure_called(proc_root[3], proc_root[2], proc_root[1], proc_root[0]) + != Felt::from_u32(0) + } +} diff --git a/sdk/base-sys/src/bindings/active_note.rs b/sdk/base-sys/src/bindings/active_note.rs index 02a3ccc13..89bdbafc6 100644 --- a/sdk/base-sys/src/bindings/active_note.rs +++ b/sdk/base-sys/src/bindings/active_note.rs @@ -3,7 +3,7 @@ use alloc::vec::Vec; use miden_stdlib_sys::{Felt, Word}; -use super::{AccountId, Asset}; +use super::{AccountId, Asset, Recipient}; #[allow(improper_ctypes)] extern "C" { @@ -13,10 +13,16 @@ extern "C" { pub fn extern_note_get_assets(ptr: *mut Felt) -> usize; #[link_name = "miden::active_note::get_sender"] pub fn extern_note_get_sender(ptr: *mut AccountId); + #[link_name = "miden::active_note::get_recipient"] + pub fn extern_note_get_recipient(ptr: *mut Recipient); #[link_name = "miden::active_note::get_script_root"] pub fn extern_note_get_script_root(ptr: *mut Word); #[link_name = "miden::active_note::get_serial_number"] pub fn extern_note_get_serial_number(ptr: *mut Word); + #[link_name = "miden::active_note::get_metadata"] + pub fn extern_note_get_metadata(ptr: *mut Word); + #[link_name = "miden::active_note::add_assets_to_account"] + pub fn extern_note_add_assets_to_account(); } /// Get the inputs of the currently executing note. @@ -72,6 +78,17 @@ pub fn get_sender() -> AccountId { } } +/// Returns the recipient of the note that is currently executing. +pub fn get_recipient() -> Recipient { + unsafe { + let mut ret_area = ::core::mem::MaybeUninit::::uninit(); + extern_note_get_recipient(ret_area.as_mut_ptr()); + let mut recipient = ret_area.assume_init(); + recipient.inner = recipient.inner.reverse(); + recipient + } +} + /// Returns the script root of the currently executing note. pub fn get_script_root() -> Word { unsafe { @@ -89,3 +106,18 @@ pub fn get_serial_number() -> Word { ret_area.assume_init().reverse() } } + +/// Returns the metadata of the note that is currently executing. +pub fn get_metadata() -> Word { + unsafe { + let mut ret_area = ::core::mem::MaybeUninit::::uninit(); + extern_note_get_metadata(ret_area.as_mut_ptr()); + ret_area.assume_init().reverse() + } +} + +/// Moves all assets from the active note into the active account vault. +#[inline] +pub fn add_assets_to_account() { + unsafe { extern_note_add_assets_to_account() } +} diff --git a/sdk/base-sys/src/bindings/asset.rs b/sdk/base-sys/src/bindings/asset.rs new file mode 100644 index 000000000..fa8ce7fbb --- /dev/null +++ b/sdk/base-sys/src/bindings/asset.rs @@ -0,0 +1,55 @@ +use miden_stdlib_sys::{Felt, Word}; + +use super::types::{AccountId, Asset}; + +#[allow(improper_ctypes)] +extern "C" { + #[link_name = "miden::asset::build_fungible_asset"] + pub fn extern_asset_build_fungible_asset( + faucet_id_prefix: Felt, + faucet_id_suffix: Felt, + amount: Felt, + ptr: *mut Asset, + ); + + #[link_name = "miden::asset::build_non_fungible_asset"] + pub fn extern_asset_build_non_fungible_asset( + faucet_id_prefix: Felt, + data_hash_3: Felt, + data_hash_2: Felt, + data_hash_1: Felt, + data_hash_0: Felt, + ptr: *mut Asset, + ); +} + +/// Builds a fungible asset for the faucet identified by `faucet_id` and the provided `amount`. +pub fn build_fungible_asset(faucet_id: AccountId, amount: Felt) -> Asset { + unsafe { + let mut ret_area = ::core::mem::MaybeUninit::::uninit(); + extern_asset_build_fungible_asset( + faucet_id.prefix, + faucet_id.suffix, + amount, + ret_area.as_mut_ptr(), + ); + ret_area.assume_init().reverse() + } +} + +/// Builds a non-fungible asset for the faucet identified by `faucet_id` and the provided +/// `data_hash`. +pub fn build_non_fungible_asset(faucet_id: AccountId, data_hash: Word) -> Asset { + unsafe { + let mut ret_area = ::core::mem::MaybeUninit::::uninit(); + extern_asset_build_non_fungible_asset( + faucet_id.prefix, + data_hash[3], + data_hash[2], + data_hash[1], + data_hash[0], + ret_area.as_mut_ptr(), + ); + ret_area.assume_init().reverse() + } +} diff --git a/sdk/base-sys/src/bindings/faucet.rs b/sdk/base-sys/src/bindings/faucet.rs new file mode 100644 index 000000000..8bea9ce9e --- /dev/null +++ b/sdk/base-sys/src/bindings/faucet.rs @@ -0,0 +1,121 @@ +use miden_stdlib_sys::{Felt, Word}; + +use super::types::Asset; + +#[allow(improper_ctypes)] +extern "C" { + #[link_name = "miden::faucet::create_fungible_asset"] + pub fn extern_faucet_create_fungible_asset(amount: Felt, ptr: *mut Asset); + + #[link_name = "miden::faucet::create_non_fungible_asset"] + pub fn extern_faucet_create_non_fungible_asset( + data_hash_3: Felt, + data_hash_2: Felt, + data_hash_1: Felt, + data_hash_0: Felt, + ptr: *mut Asset, + ); + + #[link_name = "miden::faucet::mint"] + pub fn extern_faucet_mint( + asset_3: Felt, + asset_2: Felt, + asset_1: Felt, + asset_0: Felt, + ptr: *mut Asset, + ); + + #[link_name = "miden::faucet::burn"] + pub fn extern_faucet_burn( + asset_3: Felt, + asset_2: Felt, + asset_1: Felt, + asset_0: Felt, + ptr: *mut Asset, + ); + + #[link_name = "miden::faucet::get_total_issuance"] + pub fn extern_faucet_get_total_issuance() -> Felt; + + #[link_name = "miden::faucet::is_non_fungible_asset_issued"] + pub fn extern_faucet_is_non_fungible_asset_issued( + asset_3: Felt, + asset_2: Felt, + asset_1: Felt, + asset_0: Felt, + ) -> Felt; +} + +/// Creates a fungible asset for the faucet bound to the current transaction. +pub fn create_fungible_asset(amount: Felt) -> Asset { + unsafe { + let mut ret_area = ::core::mem::MaybeUninit::::uninit(); + extern_faucet_create_fungible_asset(amount, ret_area.as_mut_ptr()); + ret_area.assume_init().reverse() + } +} + +/// Creates a non-fungible asset for the faucet bound to the current transaction. +pub fn create_non_fungible_asset(data_hash: Word) -> Asset { + unsafe { + let mut ret_area = ::core::mem::MaybeUninit::::uninit(); + extern_faucet_create_non_fungible_asset( + data_hash[3], + data_hash[2], + data_hash[1], + data_hash[0], + ret_area.as_mut_ptr(), + ); + ret_area.assume_init().reverse() + } +} + +/// Mints the provided asset for the faucet bound to the current transaction. +pub fn mint(asset: Asset) -> Asset { + unsafe { + let mut ret_area = ::core::mem::MaybeUninit::::uninit(); + extern_faucet_mint( + asset.inner[3], + asset.inner[2], + asset.inner[1], + asset.inner[0], + ret_area.as_mut_ptr(), + ); + ret_area.assume_init().reverse() + } +} + +/// Burns the provided asset from the faucet bound to the current transaction. +pub fn burn(asset: Asset) -> Asset { + unsafe { + let mut ret_area = ::core::mem::MaybeUninit::::uninit(); + extern_faucet_burn( + asset.inner[3], + asset.inner[2], + asset.inner[1], + asset.inner[0], + ret_area.as_mut_ptr(), + ); + ret_area.assume_init().reverse() + } +} + +/// Returns the total issuance of the faucet bound to the current transaction. +#[inline] +pub fn get_total_issuance() -> Felt { + unsafe { extern_faucet_get_total_issuance() } +} + +/// Returns `true` if the specified non-fungible `asset` has already been issued by the faucet. +#[inline] +pub fn is_non_fungible_asset_issued(asset: Asset) -> bool { + unsafe { + let result = extern_faucet_is_non_fungible_asset_issued( + asset.inner[3], + asset.inner[2], + asset.inner[1], + asset.inner[0], + ); + result != Felt::from_u32(0) + } +} diff --git a/sdk/base-sys/src/bindings/input_note.rs b/sdk/base-sys/src/bindings/input_note.rs new file mode 100644 index 000000000..d760666ef --- /dev/null +++ b/sdk/base-sys/src/bindings/input_note.rs @@ -0,0 +1,132 @@ +extern crate alloc; +use alloc::vec::Vec; + +use miden_stdlib_sys::{Felt, Word}; + +use super::types::{AccountId, Asset, NoteIdx, Recipient}; + +#[allow(improper_ctypes)] +extern "C" { + #[link_name = "miden::input_note::get_assets_info"] + pub fn extern_input_note_get_assets_info(note_index: Felt, ptr: *mut (Word, Felt)); + + #[link_name = "miden::input_note::get_assets"] + pub fn extern_input_note_get_assets(dest_ptr: *mut Felt, note_index: Felt) -> usize; + + #[link_name = "miden::input_note::get_recipient"] + pub fn extern_input_note_get_recipient(note_index: Felt, ptr: *mut Recipient); + + #[link_name = "miden::input_note::get_metadata"] + pub fn extern_input_note_get_metadata(note_index: Felt, ptr: *mut Word); + + #[link_name = "miden::input_note::get_sender"] + pub fn extern_input_note_get_sender(note_index: Felt, ptr: *mut AccountId); + + #[link_name = "miden::input_note::get_inputs_info"] + pub fn extern_input_note_get_inputs_info(note_index: Felt, ptr: *mut (Word, Felt)); + + #[link_name = "miden::input_note::get_script_root"] + pub fn extern_input_note_get_script_root(note_index: Felt, ptr: *mut Word); + + #[link_name = "miden::input_note::get_serial_number"] + pub fn extern_input_note_get_serial_number(note_index: Felt, ptr: *mut Word); +} + +/// Contains summary information about the assets stored in an input note. +pub struct InputNoteAssetsInfo { + pub commitment: Word, + pub num_assets: Felt, +} + +/// Contains summary information about the inputs stored in an input note. +pub struct InputNoteInputsInfo { + pub commitment: Word, + pub num_inputs: Felt, +} + +/// Returns the assets commitment and asset count for the input note at `note_index`. +pub fn get_assets_info(note_index: NoteIdx) -> InputNoteAssetsInfo { + unsafe { + let mut ret_area = ::core::mem::MaybeUninit::<(Word, Felt)>::uninit(); + extern_input_note_get_assets_info(note_index.inner, ret_area.as_mut_ptr()); + let (commitment, num_assets) = ret_area.assume_init(); + InputNoteAssetsInfo { + commitment: commitment.reverse(), + num_assets, + } + } +} + +/// Returns the assets contained in the input note at `note_index`. +pub fn get_assets(note_index: NoteIdx) -> Vec { + const MAX_ASSETS: usize = 256; + let mut assets: Vec = Vec::with_capacity(MAX_ASSETS); + let num_assets = unsafe { + let ptr = (assets.as_mut_ptr() as usize) / 4; + extern_input_note_get_assets(ptr as *mut Felt, note_index.inner) + }; + unsafe { + assets.set_len(num_assets); + } + assets +} + +/// Returns the recipient of the input note at `note_index`. +pub fn get_recipient(note_index: NoteIdx) -> Recipient { + unsafe { + let mut ret_area = ::core::mem::MaybeUninit::::uninit(); + extern_input_note_get_recipient(note_index.inner, ret_area.as_mut_ptr()); + let mut recipient = ret_area.assume_init(); + recipient.inner = recipient.inner.reverse(); + recipient + } +} + +/// Returns the metadata of the input note at `note_index`. +pub fn get_metadata(note_index: NoteIdx) -> Word { + unsafe { + let mut ret_area = ::core::mem::MaybeUninit::::uninit(); + extern_input_note_get_metadata(note_index.inner, ret_area.as_mut_ptr()); + ret_area.assume_init().reverse() + } +} + +/// Returns the sender of the input note at `note_index`. +pub fn get_sender(note_index: NoteIdx) -> AccountId { + unsafe { + let mut ret_area = ::core::mem::MaybeUninit::::uninit(); + extern_input_note_get_sender(note_index.inner, ret_area.as_mut_ptr()); + ret_area.assume_init() + } +} + +/// Returns the inputs commitment and input count for the input note at `note_index`. +pub fn get_inputs_info(note_index: NoteIdx) -> InputNoteInputsInfo { + unsafe { + let mut ret_area = ::core::mem::MaybeUninit::<(Word, Felt)>::uninit(); + extern_input_note_get_inputs_info(note_index.inner, ret_area.as_mut_ptr()); + let (commitment, num_inputs) = ret_area.assume_init(); + InputNoteInputsInfo { + commitment: commitment.reverse(), + num_inputs, + } + } +} + +/// Returns the script root of the input note at `note_index`. +pub fn get_script_root(note_index: NoteIdx) -> Word { + unsafe { + let mut ret_area = ::core::mem::MaybeUninit::::uninit(); + extern_input_note_get_script_root(note_index.inner, ret_area.as_mut_ptr()); + ret_area.assume_init().reverse() + } +} + +/// Returns the serial number of the input note at `note_index`. +pub fn get_serial_number(note_index: NoteIdx) -> Word { + unsafe { + let mut ret_area = ::core::mem::MaybeUninit::::uninit(); + extern_input_note_get_serial_number(note_index.inner, ret_area.as_mut_ptr()); + ret_area.assume_init().reverse() + } +} diff --git a/sdk/base-sys/src/bindings/mod.rs b/sdk/base-sys/src/bindings/mod.rs index 5fe3b737a..b80c872e9 100644 --- a/sdk/base-sys/src/bindings/mod.rs +++ b/sdk/base-sys/src/bindings/mod.rs @@ -10,6 +10,9 @@ pub mod account; pub mod active_note; +pub mod asset; +pub mod faucet; +pub mod input_note; pub mod output_note; pub mod storage; pub mod tx; diff --git a/sdk/base-sys/src/bindings/output_note.rs b/sdk/base-sys/src/bindings/output_note.rs index bd40e2293..2463d2528 100644 --- a/sdk/base-sys/src/bindings/output_note.rs +++ b/sdk/base-sys/src/bindings/output_note.rs @@ -1,4 +1,7 @@ -use miden_stdlib_sys::Felt; +extern crate alloc; +use alloc::vec::Vec; + +use miden_stdlib_sys::{Felt, Word}; use super::types::{Asset, NoteIdx, NoteType, Recipient, Tag}; @@ -24,6 +27,18 @@ extern "C" { asset_f3: Felt, note_idx: NoteIdx, ); + + #[link_name = "miden::output_note::get_assets_info"] + pub fn extern_output_note_get_assets_info(note_index: Felt, ptr: *mut (Word, Felt)); + + #[link_name = "miden::output_note::get_assets"] + pub fn extern_output_note_get_assets(dest_ptr: *mut Felt, note_index: Felt) -> usize; + + #[link_name = "miden::output_note::get_recipient"] + pub fn extern_output_note_get_recipient(note_index: Felt, ptr: *mut Recipient); + + #[link_name = "miden::output_note::get_metadata"] + pub fn extern_output_note_get_metadata(note_index: Felt, ptr: *mut Word); } /// Creates a new output note and returns its index. @@ -60,3 +75,57 @@ pub fn add_asset(asset: Asset, note_idx: NoteIdx) { ); } } + +/// Contains summary information about the assets of an output note. +pub struct OutputNoteAssetsInfo { + pub commitment: Word, + pub num_assets: Felt, +} + +/// Retrieves the assets commitment and asset count for the output note at `note_index`. +pub fn get_assets_info(note_index: NoteIdx) -> OutputNoteAssetsInfo { + unsafe { + let mut ret_area = ::core::mem::MaybeUninit::<(Word, Felt)>::uninit(); + extern_output_note_get_assets_info(note_index.inner, ret_area.as_mut_ptr()); + let (commitment, num_assets) = ret_area.assume_init(); + OutputNoteAssetsInfo { + commitment: commitment.reverse(), + num_assets, + } + } +} + +/// Returns the assets contained in the output note at `note_index`. +pub fn get_assets(note_index: NoteIdx) -> Vec { + const MAX_ASSETS: usize = 256; + let mut assets: Vec = Vec::with_capacity(MAX_ASSETS); + let num_assets = unsafe { + let ptr = (assets.as_mut_ptr() as usize) / 4; + extern_output_note_get_assets(ptr as *mut Felt, note_index.inner) + }; + unsafe { + assets.set_len(num_assets); + } + assets +} + +/// Returns the recipient of the output note at `note_index`. +pub fn get_recipient(note_index: NoteIdx) -> Recipient { + unsafe { + let mut ret_area = ::core::mem::MaybeUninit::::uninit(); + extern_output_note_get_recipient(note_index.inner, ret_area.as_mut_ptr()); + let recipient = ret_area.assume_init(); + Recipient { + inner: recipient.inner.reverse(), + } + } +} + +/// Returns the metadata of the output note at `note_index`. +pub fn get_metadata(note_index: NoteIdx) -> Word { + unsafe { + let mut ret_area = ::core::mem::MaybeUninit::::uninit(); + extern_output_note_get_metadata(note_index.inner, ret_area.as_mut_ptr()); + ret_area.assume_init().reverse() + } +} diff --git a/sdk/base-sys/src/bindings/storage.rs b/sdk/base-sys/src/bindings/storage.rs index a65359fc9..75d27f2fa 100644 --- a/sdk/base-sys/src/bindings/storage.rs +++ b/sdk/base-sys/src/bindings/storage.rs @@ -7,6 +7,9 @@ extern "C" { #[link_name = "miden::active_account::get_item"] pub fn extern_get_storage_item(index: Felt, ptr: *mut Word); + #[link_name = "miden::active_account::get_initial_item"] + pub fn extern_get_initial_storage_item(index: Felt, ptr: *mut Word); + #[link_name = "miden::native_account::set_item"] pub fn extern_set_storage_item( index: Felt, @@ -27,6 +30,16 @@ extern "C" { ptr: *mut Word, ); + #[link_name = "miden::active_account::get_initial_map_item"] + pub fn extern_get_initial_storage_map_item( + index: Felt, + k0: Felt, + k1: Felt, + k2: Felt, + k3: Felt, + ptr: *mut Word, + ); + #[link_name = "miden::native_account::set_map_item"] pub fn extern_set_storage_map_item( index: Felt, @@ -63,6 +76,16 @@ pub fn get_item(index: u8) -> Word { } } +/// Gets the initial value of an item from the account storage. +#[inline] +pub fn get_initial_item(index: u8) -> Word { + unsafe { + let mut ret_area = ::core::mem::MaybeUninit::::uninit(); + extern_get_initial_storage_item(index.into(), ret_area.as_mut_ptr()); + ret_area.assume_init().reverse() + } +} + /// Sets an item in the account storage. /// /// Inputs: index, value @@ -122,6 +145,23 @@ pub fn get_map_item(index: u8, key: &Word) -> Word { } } +/// Gets the initial value from a storage map. +#[inline] +pub fn get_initial_map_item(index: u8, key: &Word) -> Word { + unsafe { + let mut ret_area = ::core::mem::MaybeUninit::::uninit(); + extern_get_initial_storage_map_item( + index.into(), + key[3], + key[2], + key[1], + key[0], + ret_area.as_mut_ptr(), + ); + ret_area.assume_init().reverse() + } +} + /// Sets a map item in the account storage. /// /// Inputs: index, key, value diff --git a/sdk/base-sys/src/bindings/tx.rs b/sdk/base-sys/src/bindings/tx.rs index 723338aae..b74fac9ae 100644 --- a/sdk/base-sys/src/bindings/tx.rs +++ b/sdk/base-sys/src/bindings/tx.rs @@ -5,11 +5,29 @@ extern "C" { #[link_name = "miden::tx::get_block_number"] pub fn extern_tx_get_block_number() -> Felt; + #[link_name = "miden::tx::get_block_commitment"] + pub fn extern_tx_get_block_commitment(ptr: *mut Word); + + #[link_name = "miden::tx::get_block_timestamp"] + pub fn extern_tx_get_block_timestamp() -> Felt; + #[link_name = "miden::tx::get_input_notes_commitment"] pub fn extern_tx_get_input_notes_commitment(ptr: *mut Word); #[link_name = "miden::tx::get_output_notes_commitment"] pub fn extern_tx_get_output_notes_commitment(ptr: *mut Word); + + #[link_name = "miden::tx::get_num_input_notes"] + pub fn extern_tx_get_num_input_notes() -> Felt; + + #[link_name = "miden::tx::get_num_output_notes"] + pub fn extern_tx_get_num_output_notes() -> Felt; + + #[link_name = "miden::tx::get_expiration_block_delta"] + pub fn extern_tx_get_expiration_block_delta() -> Felt; + + #[link_name = "miden::tx::update_expiration_block_delta"] + pub fn extern_tx_update_expiration_block_delta(delta: Felt); } /// Returns the current block number. @@ -26,6 +44,42 @@ pub fn get_input_notes_commitment() -> Word { } } +/// Returns the block commitment of the reference block. +pub fn get_block_commitment() -> Word { + unsafe { + let mut ret_area = ::core::mem::MaybeUninit::::uninit(); + extern_tx_get_block_commitment(ret_area.as_mut_ptr()); + ret_area.assume_init().reverse() + } +} + +/// Returns the timestamp of the reference block. +pub fn get_block_timestamp() -> Felt { + unsafe { extern_tx_get_block_timestamp() } +} + +/// Returns the total number of input notes consumed by the transaction. +pub fn get_num_input_notes() -> Felt { + unsafe { extern_tx_get_num_input_notes() } +} + +/// Returns the number of output notes created so far in the transaction. +pub fn get_num_output_notes() -> Felt { + unsafe { extern_tx_get_num_output_notes() } +} + +/// Returns the transaction expiration block delta. +pub fn get_expiration_block_delta() -> Felt { + unsafe { extern_tx_get_expiration_block_delta() } +} + +/// Updates the transaction expiration block delta. +pub fn update_expiration_block_delta(delta: Felt) { + unsafe { + extern_tx_update_expiration_block_delta(delta); + } +} + /// Returns the output notes commitment digest. pub fn get_output_notes_commitment() -> Word { unsafe { diff --git a/sdk/base-sys/stubs/account.rs b/sdk/base-sys/stubs/account.rs index 47e5ee2a9..3b766a831 100644 --- a/sdk/base-sys/stubs/account.rs +++ b/sdk/base-sys/stubs/account.rs @@ -39,11 +39,31 @@ pub extern "C" fn account_compute_delta_commitment_plain(_out: *mut c_void) { unsafe { core::hint::unreachable_unchecked() } } +#[export_name = "miden::active_account::get_code_commitment"] +pub extern "C" fn account_get_code_commitment_plain(_out: *mut c_void) { + unsafe { core::hint::unreachable_unchecked() } +} + +#[export_name = "miden::active_account::get_initial_storage_commitment"] +pub extern "C" fn account_get_initial_storage_commitment_plain(_out: *mut c_void) { + unsafe { core::hint::unreachable_unchecked() } +} + +#[export_name = "miden::active_account::compute_storage_commitment"] +pub extern "C" fn account_compute_storage_commitment_plain(_out: *mut c_void) { + unsafe { core::hint::unreachable_unchecked() } +} + #[export_name = "miden::active_account::get_item"] pub extern "C" fn account_get_item_plain(_index: f32, _out: *mut c_void) { unsafe { core::hint::unreachable_unchecked() } } +#[export_name = "miden::active_account::get_initial_item"] +pub extern "C" fn account_get_initial_item_plain(_index: f32, _out: *mut c_void) { + unsafe { core::hint::unreachable_unchecked() } +} + #[export_name = "miden::native_account::set_item"] pub extern "C" fn account_set_item_plain( _index: f32, @@ -68,6 +88,18 @@ pub extern "C" fn account_get_map_item_plain( unsafe { core::hint::unreachable_unchecked() } } +#[export_name = "miden::active_account::get_initial_map_item"] +pub extern "C" fn account_get_initial_map_item_plain( + _index: f32, + _k0: f32, + _k1: f32, + _k2: f32, + _k3: f32, + _out: *mut c_void, +) { + unsafe { core::hint::unreachable_unchecked() } +} + #[export_name = "miden::native_account::set_map_item"] pub extern "C" fn account_set_map_item_plain( _index: f32, @@ -93,3 +125,58 @@ pub extern "C" fn account_incr_nonce_plain() -> f32 { pub extern "C" fn account_get_balance_plain(_prefix: f32, _suffix: f32) -> f32 { unsafe { core::hint::unreachable_unchecked() } } + +#[export_name = "miden::active_account::get_initial_balance"] +pub extern "C" fn account_get_initial_balance_plain(_prefix: f32, _suffix: f32) -> f32 { + unsafe { core::hint::unreachable_unchecked() } +} + +#[export_name = "miden::active_account::has_non_fungible_asset"] +pub extern "C" fn account_has_non_fungible_asset_plain( + _a0: f32, + _a1: f32, + _a2: f32, + _a3: f32, +) -> f32 { + unsafe { core::hint::unreachable_unchecked() } +} + +#[export_name = "miden::active_account::get_initial_vault_root"] +pub extern "C" fn account_get_initial_vault_root_plain(_out: *mut c_void) { + unsafe { core::hint::unreachable_unchecked() } +} + +#[export_name = "miden::active_account::get_vault_root"] +pub extern "C" fn account_get_vault_root_plain(_out: *mut c_void) { + unsafe { core::hint::unreachable_unchecked() } +} + +#[export_name = "miden::active_account::get_num_procedures"] +pub extern "C" fn account_get_num_procedures_plain() -> f32 { + unsafe { core::hint::unreachable_unchecked() } +} + +#[export_name = "miden::active_account::get_procedure_root"] +pub extern "C" fn account_get_procedure_root_plain(_index: f32, _out: *mut c_void) { + unsafe { core::hint::unreachable_unchecked() } +} + +#[export_name = "miden::active_account::has_procedure"] +pub extern "C" fn account_has_procedure_plain( + _r0: f32, + _r1: f32, + _r2: f32, + _r3: f32, +) -> f32 { + unsafe { core::hint::unreachable_unchecked() } +} + +#[export_name = "miden::native_account::was_procedure_called"] +pub extern "C" fn account_was_procedure_called_plain( + _r0: f32, + _r1: f32, + _r2: f32, + _r3: f32, +) -> f32 { + unsafe { core::hint::unreachable_unchecked() } +} diff --git a/sdk/base-sys/stubs/active_note.rs b/sdk/base-sys/stubs/active_note.rs index 46e1b87c9..fc3bc0b13 100644 --- a/sdk/base-sys/stubs/active_note.rs +++ b/sdk/base-sys/stubs/active_note.rs @@ -16,6 +16,11 @@ pub extern "C" fn note_get_sender_plain(_ptr: *mut c_void) { unsafe { core::hint::unreachable_unchecked() } } +#[export_name = "miden::active_note::get_recipient"] +pub extern "C" fn note_get_recipient_plain(_ptr: *mut c_void) { + unsafe { core::hint::unreachable_unchecked() } +} + #[export_name = "miden::active_note::get_script_root"] pub extern "C" fn note_get_script_root_plain(_ptr: *mut c_void) { unsafe { core::hint::unreachable_unchecked() } @@ -25,3 +30,13 @@ pub extern "C" fn note_get_script_root_plain(_ptr: *mut c_void) { pub extern "C" fn note_get_serial_number_plain(_ptr: *mut c_void) { unsafe { core::hint::unreachable_unchecked() } } + +#[export_name = "miden::active_note::get_metadata"] +pub extern "C" fn note_get_metadata_plain(_ptr: *mut c_void) { + unsafe { core::hint::unreachable_unchecked() } +} + +#[export_name = "miden::active_note::add_assets_to_account"] +pub extern "C" fn note_add_assets_to_account_plain() { + unsafe { core::hint::unreachable_unchecked() } +} diff --git a/sdk/base-sys/stubs/asset.rs b/sdk/base-sys/stubs/asset.rs new file mode 100644 index 000000000..3abf1a7ea --- /dev/null +++ b/sdk/base-sys/stubs/asset.rs @@ -0,0 +1,23 @@ +use core::ffi::c_void; + +#[export_name = "miden::asset::build_fungible_asset"] +pub extern "C" fn asset_build_fungible_asset_plain( + _prefix: f32, + _suffix: f32, + _amount: f32, + _out: *mut c_void, +) { + unsafe { core::hint::unreachable_unchecked() } +} + +#[export_name = "miden::asset::build_non_fungible_asset"] +pub extern "C" fn asset_build_non_fungible_asset_plain( + _prefix: f32, + _h0: f32, + _h1: f32, + _h2: f32, + _h3: f32, + _out: *mut c_void, +) { + unsafe { core::hint::unreachable_unchecked() } +} diff --git a/sdk/base-sys/stubs/faucet.rs b/sdk/base-sys/stubs/faucet.rs new file mode 100644 index 000000000..309fb31cb --- /dev/null +++ b/sdk/base-sys/stubs/faucet.rs @@ -0,0 +1,54 @@ +use core::ffi::c_void; + +#[export_name = "miden::faucet::create_fungible_asset"] +pub extern "C" fn faucet_create_fungible_asset_plain(_amount: f32, _out: *mut c_void) { + unsafe { core::hint::unreachable_unchecked() } +} + +#[export_name = "miden::faucet::create_non_fungible_asset"] +pub extern "C" fn faucet_create_non_fungible_asset_plain( + _h0: f32, + _h1: f32, + _h2: f32, + _h3: f32, + _out: *mut c_void, +) { + unsafe { core::hint::unreachable_unchecked() } +} + +#[export_name = "miden::faucet::mint"] +pub extern "C" fn faucet_mint_plain( + _a0: f32, + _a1: f32, + _a2: f32, + _a3: f32, + _out: *mut c_void, +) { + unsafe { core::hint::unreachable_unchecked() } +} + +#[export_name = "miden::faucet::burn"] +pub extern "C" fn faucet_burn_plain( + _a0: f32, + _a1: f32, + _a2: f32, + _a3: f32, + _out: *mut c_void, +) { + unsafe { core::hint::unreachable_unchecked() } +} + +#[export_name = "miden::faucet::get_total_issuance"] +pub extern "C" fn faucet_get_total_issuance_plain() -> f32 { + unsafe { core::hint::unreachable_unchecked() } +} + +#[export_name = "miden::faucet::is_non_fungible_asset_issued"] +pub extern "C" fn faucet_is_non_fungible_asset_issued_plain( + _a0: f32, + _a1: f32, + _a2: f32, + _a3: f32, +) -> f32 { + unsafe { core::hint::unreachable_unchecked() } +} diff --git a/sdk/base-sys/stubs/input_note.rs b/sdk/base-sys/stubs/input_note.rs new file mode 100644 index 000000000..af48cbb91 --- /dev/null +++ b/sdk/base-sys/stubs/input_note.rs @@ -0,0 +1,45 @@ +use core::ffi::c_void; + +/// Input note interface stubs +#[export_name = "miden::input_note::get_assets_info"] +pub extern "C" fn input_note_get_assets_info_plain(_note_index: f32, _out: *mut c_void) { + unsafe { core::hint::unreachable_unchecked() } +} + +#[export_name = "miden::input_note::get_assets"] +pub extern "C" fn input_note_get_assets_plain( + _dest_ptr: *mut c_void, + _note_index: f32, +) -> usize { + unsafe { core::hint::unreachable_unchecked() } +} + +#[export_name = "miden::input_note::get_recipient"] +pub extern "C" fn input_note_get_recipient_plain(_note_index: f32, _out: *mut c_void) { + unsafe { core::hint::unreachable_unchecked() } +} + +#[export_name = "miden::input_note::get_metadata"] +pub extern "C" fn input_note_get_metadata_plain(_note_index: f32, _out: *mut c_void) { + unsafe { core::hint::unreachable_unchecked() } +} + +#[export_name = "miden::input_note::get_sender"] +pub extern "C" fn input_note_get_sender_plain(_note_index: f32, _out: *mut c_void) { + unsafe { core::hint::unreachable_unchecked() } +} + +#[export_name = "miden::input_note::get_inputs_info"] +pub extern "C" fn input_note_get_inputs_info_plain(_note_index: f32, _out: *mut c_void) { + unsafe { core::hint::unreachable_unchecked() } +} + +#[export_name = "miden::input_note::get_script_root"] +pub extern "C" fn input_note_get_script_root_plain(_note_index: f32, _out: *mut c_void) { + unsafe { core::hint::unreachable_unchecked() } +} + +#[export_name = "miden::input_note::get_serial_number"] +pub extern "C" fn input_note_get_serial_number_plain(_note_index: f32, _out: *mut c_void) { + unsafe { core::hint::unreachable_unchecked() } +} diff --git a/sdk/base-sys/stubs/lib.rs b/sdk/base-sys/stubs/lib.rs index e0908142c..3a74f9d96 100644 --- a/sdk/base-sys/stubs/lib.rs +++ b/sdk/base-sys/stubs/lib.rs @@ -7,7 +7,10 @@ //! the calls appropriately. They are not part of the crate sources. mod account; +mod asset; mod active_note; +mod faucet; +mod input_note; mod output_note; mod tx; diff --git a/sdk/base-sys/stubs/output_note.rs b/sdk/base-sys/stubs/output_note.rs index 3fa3cd215..d2a354619 100644 --- a/sdk/base-sys/stubs/output_note.rs +++ b/sdk/base-sys/stubs/output_note.rs @@ -1,3 +1,5 @@ +use core::ffi::c_void; + /// Output note interface stubs #[export_name = "miden::output_note::create"] pub extern "C" fn output_note_create_plain( @@ -23,3 +25,26 @@ pub extern "C" fn output_note_add_asset_plain( ) { unsafe { core::hint::unreachable_unchecked() } } + +#[export_name = "miden::output_note::get_assets_info"] +pub extern "C" fn output_note_get_assets_info_plain(_note_index: f32, _out: *mut c_void) { + unsafe { core::hint::unreachable_unchecked() } +} + +#[export_name = "miden::output_note::get_assets"] +pub extern "C" fn output_note_get_assets_plain( + _dest_ptr: *mut c_void, + _note_index: f32, +) -> usize { + unsafe { core::hint::unreachable_unchecked() } +} + +#[export_name = "miden::output_note::get_recipient"] +pub extern "C" fn output_note_get_recipient_plain(_note_index: f32, _out: *mut c_void) { + unsafe { core::hint::unreachable_unchecked() } +} + +#[export_name = "miden::output_note::get_metadata"] +pub extern "C" fn output_note_get_metadata_plain(_note_index: f32, _out: *mut c_void) { + unsafe { core::hint::unreachable_unchecked() } +} diff --git a/sdk/base-sys/stubs/tx.rs b/sdk/base-sys/stubs/tx.rs index 899fca0cc..4d64c3056 100644 --- a/sdk/base-sys/stubs/tx.rs +++ b/sdk/base-sys/stubs/tx.rs @@ -5,6 +5,16 @@ pub extern "C" fn tx_get_block_number_plain() -> f32 { unsafe { core::hint::unreachable_unchecked() } } +#[export_name = "miden::tx::get_block_commitment"] +pub extern "C" fn tx_get_block_commitment_plain(_out: *mut c_void) { + unsafe { core::hint::unreachable_unchecked() } +} + +#[export_name = "miden::tx::get_block_timestamp"] +pub extern "C" fn tx_get_block_timestamp_plain() -> f32 { + unsafe { core::hint::unreachable_unchecked() } +} + #[export_name = "miden::tx::get_input_notes_commitment"] pub extern "C" fn tx_get_input_notes_commitment_plain(_out: *mut core::ffi::c_void) { unsafe { core::hint::unreachable_unchecked() } @@ -14,3 +24,23 @@ pub extern "C" fn tx_get_input_notes_commitment_plain(_out: *mut core::ffi::c_vo pub extern "C" fn tx_get_output_notes_commitment_plain(_out: *mut core::ffi::c_void) { unsafe { core::hint::unreachable_unchecked() } } + +#[export_name = "miden::tx::get_num_input_notes"] +pub extern "C" fn tx_get_num_input_notes_plain() -> f32 { + unsafe { core::hint::unreachable_unchecked() } +} + +#[export_name = "miden::tx::get_num_output_notes"] +pub extern "C" fn tx_get_num_output_notes_plain() -> f32 { + unsafe { core::hint::unreachable_unchecked() } +} + +#[export_name = "miden::tx::get_expiration_block_delta"] +pub extern "C" fn tx_get_expiration_block_delta_plain() -> f32 { + unsafe { core::hint::unreachable_unchecked() } +} + +#[export_name = "miden::tx::update_expiration_block_delta"] +pub extern "C" fn tx_update_expiration_block_delta_plain(_delta: f32) { + unsafe { core::hint::unreachable_unchecked() } +} diff --git a/tests/integration/expected/abi_transform_tx_kernel_get_inputs_4.hir b/tests/integration/expected/abi_transform_tx_kernel_get_inputs_4.hir index dec6f4119..589ae35fd 100644 --- a/tests/integration/expected/abi_transform_tx_kernel_get_inputs_4.hir +++ b/tests/integration/expected/abi_transform_tx_kernel_get_inputs_4.hir @@ -1102,6 +1102,6 @@ builtin.component root_ns:root@1.0.0 { builtin.ret_imm 1048576; }; - builtin.segment readonly @1048576 = 0x00000001000000210000001900000030001000000000000073722e65746f6e5f6576697463612f73676e69646e69622f6372732f302e372e302d7379732d657361622d6e6564696d; + builtin.segment readonly @1048576 = 0x00000001000000210000001f00000030001000000000000073722e65746f6e5f6576697463612f73676e69646e69622f6372732f302e372e302d7379732d657361622d6e6564696d; }; }; \ No newline at end of file diff --git a/tests/integration/expected/abi_transform_tx_kernel_get_inputs_4.masm b/tests/integration/expected/abi_transform_tx_kernel_get_inputs_4.masm index ce2a7d870..d3828a4d1 100644 --- a/tests/integration/expected/abi_transform_tx_kernel_get_inputs_4.masm +++ b/tests/integration/expected/abi_transform_tx_kernel_get_inputs_4.masm @@ -5,7 +5,7 @@ proc init trace.240 exec.::intrinsics::mem::heap_init trace.252 - push.[2866421088928114421,8591108593910809698,14973632783658664026,11239996622085430565] + push.[4557231304381646024,333629999424525359,2740222180108318868,7644147313808679059] adv.push_mapval push.262144 push.5 diff --git a/tests/integration/expected/abi_transform_tx_kernel_get_inputs_4.wat b/tests/integration/expected/abi_transform_tx_kernel_get_inputs_4.wat index bc9e8e923..60f884cc6 100644 --- a/tests/integration/expected/abi_transform_tx_kernel_get_inputs_4.wat +++ b/tests/integration/expected/abi_transform_tx_kernel_get_inputs_4.wat @@ -615,5 +615,5 @@ end local.get 2 ) - (data $.rodata (;0;) (i32.const 1048576) "miden-base-sys-0.7.0/src/bindings/active_note.rs\00\00\00\00\00\00\10\000\00\00\00\19\00\00\00!\00\00\00\01\00\00\00") + (data $.rodata (;0;) (i32.const 1048576) "miden-base-sys-0.7.0/src/bindings/active_note.rs\00\00\00\00\00\00\10\000\00\00\00\1f\00\00\00!\00\00\00\01\00\00\00") ) diff --git a/tests/integration/expected/examples/p2id.hir b/tests/integration/expected/examples/p2id.hir index d605a31a6..f3a51af24 100644 --- a/tests/integration/expected/examples/p2id.hir +++ b/tests/integration/expected/examples/p2id.hir @@ -35,33 +35,33 @@ builtin.component miden:base/note-script@1.0.0 { v22 = arith.constant 1048672 : i32; v23 = arith.add v21, v22 : i32 #[overflow = wrapping]; v24 = hir.exec @miden:base/note-script@1.0.0/p2id/::alloc(v23, v17, v16) : i32 - v876 = arith.constant 0 : i32; + v905 = arith.constant 0 : i32; v25 = arith.constant 0 : i32; v26 = arith.eq v24, v25 : i1; v27 = arith.zext v26 : u32; v28 = hir.bitcast v27 : i32; - v30 = arith.neq v28, v876 : i1; + v30 = arith.neq v28, v905 : i1; scf.if v30{ ^block16: scf.yield ; } else { ^block17: - v874 = arith.constant 0 : i32; - v875 = arith.constant 0 : i32; - v32 = arith.eq v16, v875 : i1; + v903 = arith.constant 0 : i32; + v904 = arith.constant 0 : i32; + v32 = arith.eq v16, v904 : i1; v33 = arith.zext v32 : u32; v34 = hir.bitcast v33 : i32; - v36 = arith.neq v34, v874 : i1; + v36 = arith.neq v34, v903 : i1; scf.if v36{ - ^block112: + ^block114: scf.yield ; } else { ^block18: - v868 = arith.constant 0 : u8; + v897 = arith.constant 0 : u8; v39 = hir.bitcast v16 : u32; v40 = hir.bitcast v24 : u32; v41 = hir.int_to_ptr v40 : ptr; - hir.mem_set v41, v39, v868; + hir.mem_set v41, v39, v897; scf.yield ; }; scf.yield ; @@ -97,38 +97,38 @@ builtin.component miden:base/note-script@1.0.0 { v64 = hir.int_to_ptr v61 : ptr; v65 = hir.load v64 : i32; v66 = hir.cast v65 : u32; - v934 = scf.index_switch v66 : u32 + v963 = scf.index_switch v66 : u32 case 0 { - ^block117: - v978 = arith.constant 1 : u32; - scf.yield v978; + ^block119: + v1007 = arith.constant 1 : u32; + scf.yield v1007; } case 1 { - ^block118: - v977 = arith.constant 1 : u32; - scf.yield v977; + ^block120: + v1006 = arith.constant 1 : u32; + scf.yield v1006; } default { ^block24: v68 = arith.constant 20 : u32; v67 = hir.bitcast v54 : u32; v69 = arith.add v67, v68 : u32 #[overflow = checked]; - v1011 = arith.constant 4 : u32; - v71 = arith.mod v69, v1011 : u32; + v1040 = arith.constant 4 : u32; + v71 = arith.mod v69, v1040 : u32; hir.assertz v71 #[code = 250]; v72 = hir.int_to_ptr v69 : ptr; v73 = hir.load v72 : i32; - v1010 = arith.constant 4 : u32; + v1039 = arith.constant 4 : u32; v74 = hir.bitcast v73 : u32; - v76 = arith.add v74, v1010 : u32 #[overflow = checked]; - v1009 = arith.constant 4 : u32; - v78 = arith.mod v76, v1009 : u32; + v76 = arith.add v74, v1039 : u32 #[overflow = checked]; + v1038 = arith.constant 4 : u32; + v78 = arith.mod v76, v1038 : u32; hir.assertz v78 #[code = 250]; v79 = hir.int_to_ptr v76 : ptr; v80 = hir.load v79 : felt; v81 = hir.bitcast v73 : u32; - v1008 = arith.constant 4 : u32; - v83 = arith.mod v81, v1008 : u32; + v1037 = arith.constant 4 : u32; + v83 = arith.mod v81, v1037 : u32; hir.assertz v83 #[code = 250]; v84 = hir.int_to_ptr v81 : ptr; v85 = hir.load v84 : felt; @@ -138,16 +138,16 @@ builtin.component miden:base/note-script@1.0.0 { v89 = arith.constant 12 : u32; v88 = hir.bitcast v54 : u32; v90 = arith.add v88, v89 : u32 #[overflow = checked]; - v1007 = arith.constant 4 : u32; - v92 = arith.mod v90, v1007 : u32; + v1036 = arith.constant 4 : u32; + v92 = arith.mod v90, v1036 : u32; hir.assertz v92 #[code = 250]; v93 = hir.int_to_ptr v90 : ptr; v94 = hir.load v93 : felt; v96 = arith.constant 8 : u32; v95 = hir.bitcast v54 : u32; v97 = arith.add v95, v96 : u32 #[overflow = checked]; - v1006 = arith.constant 4 : u32; - v99 = arith.mod v97, v1006 : u32; + v1035 = arith.constant 4 : u32; + v99 = arith.mod v97, v1035 : u32; hir.assertz v99 #[code = 250]; v100 = hir.int_to_ptr v97 : ptr; v101 = hir.load v100 : felt; @@ -158,21 +158,21 @@ builtin.component miden:base/note-script@1.0.0 { v105 = arith.zext v104 : u32; v106 = hir.bitcast v105 : i32; v108 = arith.neq v106, v47 : i1; - v936 = scf.if v108 : u32 { - ^block116: - v886 = arith.constant 1 : u32; - scf.yield v886; + v965 = scf.if v108 : u32 { + ^block118: + v915 = arith.constant 1 : u32; + scf.yield v915; } else { ^block25: v109 = hir.exec @miden:base/note-script@1.0.0/p2id/intrinsics::felt::eq(v94, v80) : i32 - v1004 = arith.constant 0 : i32; - v1005 = arith.constant 1 : i32; - v111 = arith.neq v109, v1005 : i1; + v1033 = arith.constant 0 : i32; + v1034 = arith.constant 1 : i32; + v111 = arith.neq v109, v1034 : i1; v112 = arith.zext v111 : u32; v113 = hir.bitcast v112 : i32; - v115 = arith.neq v113, v1004 : i1; + v115 = arith.neq v113, v1033 : i1; scf.if v115{ - ^block115: + ^block117: scf.yield ; } else { ^block26: @@ -182,139 +182,139 @@ builtin.component miden:base/note-script@1.0.0 { v119 = arith.constant 36 : u32; v118 = hir.bitcast v54 : u32; v120 = arith.add v118, v119 : u32 #[overflow = checked]; - v1003 = arith.constant 4 : u32; - v122 = arith.mod v120, v1003 : u32; + v1032 = arith.constant 4 : u32; + v122 = arith.mod v120, v1032 : u32; hir.assertz v122 #[code = 250]; v123 = hir.int_to_ptr v120 : ptr; v124 = hir.load v123 : i32; v129 = arith.constant 28 : u32; v128 = hir.bitcast v54 : u32; v130 = arith.add v128, v129 : u32 #[overflow = checked]; - v1002 = arith.constant 4 : u32; - v132 = arith.mod v130, v1002 : u32; + v1031 = arith.constant 4 : u32; + v132 = arith.mod v130, v1031 : u32; hir.assertz v132 #[code = 250]; v133 = hir.int_to_ptr v130 : ptr; v134 = hir.load v133 : i32; v136 = arith.constant 32 : u32; v135 = hir.bitcast v54 : u32; v137 = arith.add v135, v136 : u32 #[overflow = checked]; - v1001 = arith.constant 4 : u32; - v139 = arith.mod v137, v1001 : u32; + v1030 = arith.constant 4 : u32; + v139 = arith.mod v137, v1030 : u32; hir.assertz v139 #[code = 250]; v140 = hir.int_to_ptr v137 : ptr; v141 = hir.load v140 : i32; - v1000 = arith.constant 4 : u32; - v127 = arith.shl v124, v1000 : i32; - v954, v955, v956, v957, v958, v959, v960, v961 = scf.while v127, v141, v54, v141, v134 : i32, i32, i32, i32, i32, i32, i32, i32 { - ^block130(v962: i32, v963: i32, v964: i32, v965: i32, v966: i32): - v998 = arith.constant 0 : i32; - v999 = arith.constant 0 : i32; - v144 = arith.eq v962, v999 : i1; + v1029 = arith.constant 4 : u32; + v127 = arith.shl v124, v1029 : i32; + v983, v984, v985, v986, v987, v988, v989, v990 = scf.while v127, v141, v54, v141, v134 : i32, i32, i32, i32, i32, i32, i32, i32 { + ^block132(v991: i32, v992: i32, v993: i32, v994: i32, v995: i32): + v1027 = arith.constant 0 : i32; + v1028 = arith.constant 0 : i32; + v144 = arith.eq v991, v1028 : i1; v145 = arith.zext v144 : u32; v146 = hir.bitcast v145 : i32; - v148 = arith.neq v146, v998 : i1; - v947, v948 = scf.if v148 : i32, i32 { - ^block129: - v887 = ub.poison i32 : i32; - scf.yield v887, v887; + v148 = arith.neq v146, v1027 : i1; + v976, v977 = scf.if v148 : i32, i32 { + ^block131: + v916 = ub.poison i32 : i32; + scf.yield v916, v916; } else { ^block30: - v150 = hir.bitcast v963 : u32; - v997 = arith.constant 4 : u32; - v152 = arith.mod v150, v997 : u32; + v150 = hir.bitcast v992 : u32; + v1026 = arith.constant 4 : u32; + v152 = arith.mod v150, v1026 : u32; hir.assertz v152 #[code = 250]; v153 = hir.int_to_ptr v150 : ptr; v154 = hir.load v153 : felt; - v996 = arith.constant 4 : u32; - v155 = hir.bitcast v963 : u32; - v157 = arith.add v155, v996 : u32 #[overflow = checked]; - v995 = arith.constant 4 : u32; - v159 = arith.mod v157, v995 : u32; + v1025 = arith.constant 4 : u32; + v155 = hir.bitcast v992 : u32; + v157 = arith.add v155, v1025 : u32 #[overflow = checked]; + v1024 = arith.constant 4 : u32; + v159 = arith.mod v157, v1024 : u32; hir.assertz v159 #[code = 250]; v160 = hir.int_to_ptr v157 : ptr; v161 = hir.load v160 : felt; - v994 = arith.constant 8 : u32; - v162 = hir.bitcast v963 : u32; - v164 = arith.add v162, v994 : u32 #[overflow = checked]; - v993 = arith.constant 4 : u32; - v166 = arith.mod v164, v993 : u32; + v1023 = arith.constant 8 : u32; + v162 = hir.bitcast v992 : u32; + v164 = arith.add v162, v1023 : u32 #[overflow = checked]; + v1022 = arith.constant 4 : u32; + v166 = arith.mod v164, v1022 : u32; hir.assertz v166 #[code = 250]; v167 = hir.int_to_ptr v164 : ptr; v168 = hir.load v167 : felt; - v992 = arith.constant 12 : u32; - v169 = hir.bitcast v963 : u32; - v171 = arith.add v169, v992 : u32 #[overflow = checked]; - v991 = arith.constant 4 : u32; - v173 = arith.mod v171, v991 : u32; + v1021 = arith.constant 12 : u32; + v169 = hir.bitcast v992 : u32; + v171 = arith.add v169, v1021 : u32 #[overflow = checked]; + v1020 = arith.constant 4 : u32; + v173 = arith.mod v171, v1020 : u32; hir.assertz v173 #[code = 250]; v174 = hir.int_to_ptr v171 : ptr; v175 = hir.load v174 : felt; hir.exec @miden:base/note-script@1.0.0/p2id/p2id::bindings::miden::basic_wallet::basic_wallet::receive_asset::wit_import7(v154, v161, v168, v175) - v990 = arith.constant 16 : i32; - v179 = arith.add v963, v990 : i32 #[overflow = wrapping]; + v1019 = arith.constant 16 : i32; + v179 = arith.add v992, v1019 : i32 #[overflow = wrapping]; v176 = arith.constant -16 : i32; - v177 = arith.add v962, v176 : i32 #[overflow = wrapping]; + v177 = arith.add v991, v176 : i32 #[overflow = wrapping]; scf.yield v177, v179; }; - v986 = ub.poison i32 : i32; - v951 = cf.select v148, v986, v966 : i32; - v987 = ub.poison i32 : i32; - v950 = cf.select v148, v987, v965 : i32; - v988 = ub.poison i32 : i32; - v949 = cf.select v148, v988, v964 : i32; - v989 = arith.constant 1 : u32; - v878 = arith.constant 0 : u32; - v953 = cf.select v148, v878, v989 : u32; - v931 = arith.trunc v953 : i1; - scf.condition v931, v947, v948, v949, v950, v951, v964, v965, v966; + v1015 = ub.poison i32 : i32; + v980 = cf.select v148, v1015, v995 : i32; + v1016 = ub.poison i32 : i32; + v979 = cf.select v148, v1016, v994 : i32; + v1017 = ub.poison i32 : i32; + v978 = cf.select v148, v1017, v993 : i32; + v1018 = arith.constant 1 : u32; + v907 = arith.constant 0 : u32; + v982 = cf.select v148, v907, v1018 : u32; + v960 = arith.trunc v982 : i1; + scf.condition v960, v976, v977, v978, v979, v980, v993, v994, v995; } do { - ^block131(v967: i32, v968: i32, v969: i32, v970: i32, v971: i32, v972: i32, v973: i32, v974: i32): - scf.yield v967, v968, v969, v970, v971; + ^block133(v996: i32, v997: i32, v998: i32, v999: i32, v1000: i32, v1001: i32, v1002: i32, v1003: i32): + scf.yield v996, v997, v998, v999, v1000; }; v183 = arith.constant 44 : u32; - v182 = hir.bitcast v959 : u32; + v182 = hir.bitcast v988 : u32; v184 = arith.add v182, v183 : u32 #[overflow = checked]; - v985 = arith.constant 4 : u32; - v186 = arith.mod v184, v985 : u32; + v1014 = arith.constant 4 : u32; + v186 = arith.mod v184, v1014 : u32; hir.assertz v186 #[code = 250]; v187 = hir.int_to_ptr v184 : ptr; - hir.store v187, v960; + hir.store v187, v989; v190 = arith.constant 40 : u32; - v189 = hir.bitcast v959 : u32; + v189 = hir.bitcast v988 : u32; v191 = arith.add v189, v190 : u32 #[overflow = checked]; - v984 = arith.constant 4 : u32; - v193 = arith.mod v191, v984 : u32; + v1013 = arith.constant 4 : u32; + v193 = arith.mod v191, v1013 : u32; hir.assertz v193 #[code = 250]; v194 = hir.int_to_ptr v191 : ptr; - hir.store v194, v961; - v983 = arith.constant 16 : i32; + hir.store v194, v990; + v1012 = arith.constant 16 : i32; v195 = arith.constant 40 : i32; - v196 = arith.add v959, v195 : i32 #[overflow = wrapping]; - hir.exec @miden:base/note-script@1.0.0/p2id/alloc::raw_vec::RawVecInner::deallocate(v196, v983, v983) + v196 = arith.add v988, v195 : i32 #[overflow = wrapping]; + hir.exec @miden:base/note-script@1.0.0/p2id/alloc::raw_vec::RawVecInner::deallocate(v196, v1012, v1012) v125 = arith.constant 4 : i32; - v982 = arith.constant 16 : i32; - v200 = arith.add v959, v982 : i32 #[overflow = wrapping]; + v1011 = arith.constant 16 : i32; + v200 = arith.add v988, v1011 : i32 #[overflow = wrapping]; hir.exec @miden:base/note-script@1.0.0/p2id/alloc::raw_vec::RawVecInner::deallocate(v200, v125, v125) - v981 = arith.constant 48 : i32; - v204 = arith.add v959, v981 : i32 #[overflow = wrapping]; + v1010 = arith.constant 48 : i32; + v204 = arith.add v988, v1010 : i32 #[overflow = wrapping]; v205 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr v206 = hir.bitcast v205 : ptr; hir.store v206, v204; scf.yield ; }; - v979 = arith.constant 0 : u32; - v980 = arith.constant 1 : u32; - v975 = cf.select v115, v980, v979 : u32; - scf.yield v975; + v1008 = arith.constant 0 : u32; + v1009 = arith.constant 1 : u32; + v1004 = cf.select v115, v1009, v1008 : u32; + scf.yield v1004; }; - scf.yield v936; + scf.yield v965; }; - v976 = arith.constant 0 : u32; - v946 = arith.eq v934, v976 : i1; - cf.cond_br v946 ^block120, ^block23; + v1005 = arith.constant 0 : u32; + v975 = arith.eq v963, v1005 : i1; + cf.cond_br v975 ^block122, ^block23; ^block23: ub.unreachable ; - ^block120: + ^block122: builtin.ret ; }; @@ -346,12 +346,12 @@ builtin.component miden:base/note-script@1.0.0 { v221 = hir.bitcast v220 : ptr; v222 = hir.load v221 : i32; hir.exec @miden:base/note-script@1.0.0/p2id/__wasm_call_ctors() - v1013 = arith.constant 1 : u8; - v1015 = arith.constant 1048676 : i32; - v224 = arith.add v222, v1015 : i32 #[overflow = wrapping]; + v1042 = arith.constant 1 : u8; + v1044 = arith.constant 1048676 : i32; + v224 = arith.add v222, v1044 : i32 #[overflow = wrapping]; v228 = hir.bitcast v224 : u32; v229 = hir.int_to_ptr v228 : ptr; - hir.store v229, v1013; + hir.store v229, v1042; scf.yield ; }; builtin.ret ; @@ -361,27 +361,27 @@ builtin.component miden:base/note-script@1.0.0 { ^block37(v230: i32, v231: i32, v232: i32): v235 = arith.constant 16 : i32; v234 = arith.constant 0 : i32; - v1017 = arith.constant 16 : u32; + v1046 = arith.constant 16 : u32; v237 = hir.bitcast v231 : u32; - v239 = arith.gt v237, v1017 : i1; + v239 = arith.gt v237, v1046 : i1; v240 = arith.zext v239 : u32; v241 = hir.bitcast v240 : i32; v243 = arith.neq v241, v234 : i1; v244 = cf.select v243, v231, v235 : i32; - v1057 = arith.constant 0 : i32; + v1086 = arith.constant 0 : i32; v245 = arith.constant -1 : i32; v246 = arith.add v244, v245 : i32 #[overflow = wrapping]; v247 = arith.band v244, v246 : i32; - v249 = arith.neq v247, v1057 : i1; - v1026, v1027 = scf.if v249 : i32, u32 { - ^block135: - v1018 = arith.constant 0 : u32; - v1022 = ub.poison i32 : i32; - scf.yield v1022, v1018; + v249 = arith.neq v247, v1086 : i1; + v1055, v1056 = scf.if v249 : i32, u32 { + ^block137: + v1047 = arith.constant 0 : u32; + v1051 = ub.poison i32 : i32; + scf.yield v1051, v1047; } else { ^block40: v251 = hir.exec @miden:base/note-script@1.0.0/p2id/core::ptr::alignment::Alignment::max(v231, v244) : i32 - v1056 = arith.constant 0 : i32; + v1085 = arith.constant 0 : i32; v250 = arith.constant -2147483648 : i32; v252 = arith.sub v250, v251 : i32 #[overflow = wrapping]; v254 = hir.bitcast v252 : u32; @@ -389,18 +389,18 @@ builtin.component miden:base/note-script@1.0.0 { v255 = arith.gt v253, v254 : i1; v256 = arith.zext v255 : u32; v257 = hir.bitcast v256 : i32; - v259 = arith.neq v257, v1056 : i1; - v1041 = scf.if v259 : i32 { - ^block134: - v1055 = ub.poison i32 : i32; - scf.yield v1055; + v259 = arith.neq v257, v1085 : i1; + v1070 = scf.if v259 : i32 { + ^block136: + v1084 = ub.poison i32 : i32; + scf.yield v1084; } else { ^block41: - v1053 = arith.constant 0 : i32; - v265 = arith.sub v1053, v251 : i32 #[overflow = wrapping]; - v1054 = arith.constant -1 : i32; + v1082 = arith.constant 0 : i32; + v265 = arith.sub v1082, v251 : i32 #[overflow = wrapping]; + v1083 = arith.constant -1 : i32; v261 = arith.add v232, v251 : i32 #[overflow = wrapping]; - v263 = arith.add v261, v1054 : i32 #[overflow = wrapping]; + v263 = arith.add v261, v1083 : i32 #[overflow = wrapping]; v266 = arith.band v263, v265 : i32; v267 = hir.bitcast v230 : u32; v268 = arith.constant 4 : u32; @@ -408,51 +408,51 @@ builtin.component miden:base/note-script@1.0.0 { hir.assertz v269 #[code = 250]; v270 = hir.int_to_ptr v267 : ptr; v271 = hir.load v270 : i32; - v1052 = arith.constant 0 : i32; - v273 = arith.neq v271, v1052 : i1; + v1081 = arith.constant 0 : i32; + v273 = arith.neq v271, v1081 : i1; scf.if v273{ - ^block133: + ^block135: scf.yield ; } else { ^block43: v274 = hir.exec @miden:base/note-script@1.0.0/p2id/intrinsics::mem::heap_base() : i32 v275 = hir.mem_size : u32; v281 = hir.bitcast v230 : u32; - v1051 = arith.constant 4 : u32; - v283 = arith.mod v281, v1051 : u32; + v1080 = arith.constant 4 : u32; + v283 = arith.mod v281, v1080 : u32; hir.assertz v283 #[code = 250]; - v1050 = arith.constant 16 : u32; + v1079 = arith.constant 16 : u32; v276 = hir.bitcast v275 : i32; - v279 = arith.shl v276, v1050 : i32; + v279 = arith.shl v276, v1079 : i32; v280 = arith.add v274, v279 : i32 #[overflow = wrapping]; v284 = hir.int_to_ptr v281 : ptr; hir.store v284, v280; scf.yield ; }; v287 = hir.bitcast v230 : u32; - v1049 = arith.constant 4 : u32; - v289 = arith.mod v287, v1049 : u32; + v1078 = arith.constant 4 : u32; + v289 = arith.mod v287, v1078 : u32; hir.assertz v289 #[code = 250]; v290 = hir.int_to_ptr v287 : ptr; v291 = hir.load v290 : i32; - v1047 = arith.constant 0 : i32; - v1048 = arith.constant -1 : i32; - v293 = arith.bxor v291, v1048 : i32; + v1076 = arith.constant 0 : i32; + v1077 = arith.constant -1 : i32; + v293 = arith.bxor v291, v1077 : i32; v295 = hir.bitcast v293 : u32; v294 = hir.bitcast v266 : u32; v296 = arith.gt v294, v295 : i1; v297 = arith.zext v296 : u32; v298 = hir.bitcast v297 : i32; - v300 = arith.neq v298, v1047 : i1; - v1040 = scf.if v300 : i32 { + v300 = arith.neq v298, v1076 : i1; + v1069 = scf.if v300 : i32 { ^block44: - v1046 = arith.constant 0 : i32; - scf.yield v1046; + v1075 = arith.constant 0 : i32; + scf.yield v1075; } else { ^block45: v302 = hir.bitcast v230 : u32; - v1045 = arith.constant 4 : u32; - v304 = arith.mod v302, v1045 : u32; + v1074 = arith.constant 4 : u32; + v304 = arith.mod v302, v1074 : u32; hir.assertz v304 #[code = 250]; v301 = arith.add v291, v266 : i32 #[overflow = wrapping]; v305 = hir.int_to_ptr v302 : ptr; @@ -460,20 +460,20 @@ builtin.component miden:base/note-script@1.0.0 { v307 = arith.add v291, v251 : i32 #[overflow = wrapping]; scf.yield v307; }; - scf.yield v1040; + scf.yield v1069; }; - v1023 = arith.constant 1 : u32; - v1044 = arith.constant 0 : u32; - v1042 = cf.select v259, v1044, v1023 : u32; - scf.yield v1041, v1042; + v1052 = arith.constant 1 : u32; + v1073 = arith.constant 0 : u32; + v1071 = cf.select v259, v1073, v1052 : u32; + scf.yield v1070, v1071; }; - v1043 = arith.constant 0 : u32; - v1039 = arith.eq v1027, v1043 : i1; - cf.cond_br v1039 ^block39, ^block137(v1026); + v1072 = arith.constant 0 : u32; + v1068 = arith.eq v1056, v1072 : i1; + cf.cond_br v1068 ^block39, ^block139(v1055); ^block39: ub.unreachable ; - ^block137(v1019: i32): - builtin.ret v1019; + ^block139(v1048: i32): + builtin.ret v1048; }; private builtin.function @intrinsics::mem::heap_base() -> i32 { @@ -482,761 +482,797 @@ builtin.component miden:base/note-script@1.0.0 { builtin.ret v310; }; - private builtin.function @alloc::raw_vec::RawVecInner::with_capacity_in(v312: i32, v313: i32, v314: i32, v315: i32) { - ^block50(v312: i32, v313: i32, v314: i32, v315: i32): - v317 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v318 = hir.bitcast v317 : ptr; - v319 = hir.load v318 : i32; - v320 = arith.constant 16 : i32; - v321 = arith.sub v319, v320 : i32 #[overflow = wrapping]; - v322 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v323 = hir.bitcast v322 : ptr; - hir.store v323, v321; - v316 = arith.constant 0 : i32; - v326 = arith.constant 256 : i32; - v324 = arith.constant 4 : i32; - v325 = arith.add v321, v324 : i32 #[overflow = wrapping]; - hir.exec @miden:base/note-script@1.0.0/p2id/alloc::raw_vec::RawVecInner::try_allocate_in(v325, v326, v316, v313, v314) - v329 = arith.constant 8 : u32; - v328 = hir.bitcast v321 : u32; - v330 = arith.add v328, v329 : u32 #[overflow = checked]; - v331 = arith.constant 4 : u32; - v332 = arith.mod v330, v331 : u32; - hir.assertz v332 #[code = 250]; - v333 = hir.int_to_ptr v330 : ptr; - v334 = hir.load v333 : i32; - v1068 = arith.constant 4 : u32; - v335 = hir.bitcast v321 : u32; - v337 = arith.add v335, v1068 : u32 #[overflow = checked]; - v1067 = arith.constant 4 : u32; - v339 = arith.mod v337, v1067 : u32; + private builtin.function @alloc::vec::Vec::with_capacity(v312: i32, v313: i32) { + ^block50(v312: i32, v313: i32): + v316 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v317 = hir.bitcast v316 : ptr; + v318 = hir.load v317 : i32; + v319 = arith.constant 16 : i32; + v320 = arith.sub v318, v319 : i32 #[overflow = wrapping]; + v321 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v322 = hir.bitcast v321 : ptr; + hir.store v322, v320; + v1091 = arith.constant 16 : i32; + v323 = arith.constant 8 : i32; + v324 = arith.add v320, v323 : i32 #[overflow = wrapping]; + hir.exec @miden:base/note-script@1.0.0/p2id/alloc::raw_vec::RawVecInner::with_capacity_in(v324, v1091, v1091, v313) + v328 = arith.constant 8 : u32; + v327 = hir.bitcast v320 : u32; + v329 = arith.add v327, v328 : u32 #[overflow = checked]; + v1090 = arith.constant 8 : u32; + v331 = arith.mod v329, v1090 : u32; + hir.assertz v331 #[code = 250]; + v332 = hir.int_to_ptr v329 : ptr; + v333 = hir.load v332 : i64; + v1089 = arith.constant 8 : u32; + v335 = hir.bitcast v312 : u32; + v337 = arith.add v335, v1089 : u32 #[overflow = checked]; + v338 = arith.constant 4 : u32; + v339 = arith.mod v337, v338 : u32; hir.assertz v339 #[code = 250]; + v314 = arith.constant 0 : i32; v340 = hir.int_to_ptr v337 : ptr; - v341 = hir.load v340 : i32; - v1066 = arith.constant 0 : i32; - v342 = arith.constant 1 : i32; - v343 = arith.neq v341, v342 : i1; - v344 = arith.zext v343 : u32; - v345 = hir.bitcast v344 : i32; - v347 = arith.neq v345, v1066 : i1; - cf.cond_br v347 ^block52, ^block53; - ^block52: - v356 = arith.constant 12 : u32; - v355 = hir.bitcast v321 : u32; - v357 = arith.add v355, v356 : u32 #[overflow = checked]; - v1065 = arith.constant 4 : u32; - v359 = arith.mod v357, v1065 : u32; - hir.assertz v359 #[code = 250]; - v360 = hir.int_to_ptr v357 : ptr; - v361 = hir.load v360 : i32; - v1064 = arith.constant 4 : u32; - v362 = hir.bitcast v312 : u32; - v364 = arith.add v362, v1064 : u32 #[overflow = checked]; - v1063 = arith.constant 4 : u32; - v366 = arith.mod v364, v1063 : u32; - hir.assertz v366 #[code = 250]; - v367 = hir.int_to_ptr v364 : ptr; - hir.store v367, v361; - v368 = hir.bitcast v312 : u32; - v1062 = arith.constant 4 : u32; - v370 = arith.mod v368, v1062 : u32; - hir.assertz v370 #[code = 250]; - v371 = hir.int_to_ptr v368 : ptr; - hir.store v371, v334; - v1061 = arith.constant 16 : i32; - v373 = arith.add v321, v1061 : i32 #[overflow = wrapping]; - v374 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v375 = hir.bitcast v374 : ptr; - hir.store v375, v373; + hir.store v340, v314; + v341 = hir.bitcast v312 : u32; + v1088 = arith.constant 4 : u32; + v343 = arith.mod v341, v1088 : u32; + hir.assertz v343 #[code = 250]; + v344 = hir.int_to_ptr v341 : ptr; + hir.store v344, v333; + v1087 = arith.constant 16 : i32; + v346 = arith.add v320, v1087 : i32 #[overflow = wrapping]; + v347 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v348 = hir.bitcast v347 : ptr; + hir.store v348, v346; builtin.ret ; - ^block53: - v1060 = arith.constant 12 : u32; - v348 = hir.bitcast v321 : u32; - v350 = arith.add v348, v1060 : u32 #[overflow = checked]; - v1059 = arith.constant 4 : u32; - v352 = arith.mod v350, v1059 : u32; - hir.assertz v352 #[code = 250]; - v353 = hir.int_to_ptr v350 : ptr; - v354 = hir.load v353 : i32; - hir.exec @miden:base/note-script@1.0.0/p2id/alloc::raw_vec::handle_error(v334, v354, v315) - ub.unreachable ; }; - private builtin.function @miden_base_sys::bindings::account::get_id(v376: i32) { - ^block54(v376: i32): - v378 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v379 = hir.bitcast v378 : ptr; - v380 = hir.load v379 : i32; - v381 = arith.constant 16 : i32; - v382 = arith.sub v380, v381 : i32 #[overflow = wrapping]; - v383 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v384 = hir.bitcast v383 : ptr; - hir.store v384, v382; - v385 = arith.constant 8 : i32; - v386 = arith.add v382, v385 : i32 #[overflow = wrapping]; - hir.exec @miden:base/note-script@1.0.0/p2id/miden::active_account::get_id(v386) - v388 = arith.constant 8 : u32; - v387 = hir.bitcast v382 : u32; - v389 = arith.add v387, v388 : u32 #[overflow = checked]; - v390 = arith.constant 4 : u32; - v391 = arith.mod v389, v390 : u32; - hir.assertz v391 #[code = 250]; - v392 = hir.int_to_ptr v389 : ptr; - v393 = hir.load v392 : i64; - v394 = hir.bitcast v376 : u32; - v1070 = arith.constant 8 : u32; - v396 = arith.mod v394, v1070 : u32; + private builtin.function @alloc::raw_vec::RawVecInner::with_capacity_in(v349: i32, v350: i32, v351: i32, v352: i32) { + ^block52(v349: i32, v350: i32, v351: i32, v352: i32): + v354 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v355 = hir.bitcast v354 : ptr; + v356 = hir.load v355 : i32; + v357 = arith.constant 16 : i32; + v358 = arith.sub v356, v357 : i32 #[overflow = wrapping]; + v359 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v360 = hir.bitcast v359 : ptr; + hir.store v360, v358; + v353 = arith.constant 0 : i32; + v363 = arith.constant 256 : i32; + v361 = arith.constant 4 : i32; + v362 = arith.add v358, v361 : i32 #[overflow = wrapping]; + hir.exec @miden:base/note-script@1.0.0/p2id/alloc::raw_vec::RawVecInner::try_allocate_in(v362, v363, v353, v350, v351) + v366 = arith.constant 8 : u32; + v365 = hir.bitcast v358 : u32; + v367 = arith.add v365, v366 : u32 #[overflow = checked]; + v368 = arith.constant 4 : u32; + v369 = arith.mod v367, v368 : u32; + hir.assertz v369 #[code = 250]; + v370 = hir.int_to_ptr v367 : ptr; + v371 = hir.load v370 : i32; + v1102 = arith.constant 4 : u32; + v372 = hir.bitcast v358 : u32; + v374 = arith.add v372, v1102 : u32 #[overflow = checked]; + v1101 = arith.constant 4 : u32; + v376 = arith.mod v374, v1101 : u32; + hir.assertz v376 #[code = 250]; + v377 = hir.int_to_ptr v374 : ptr; + v378 = hir.load v377 : i32; + v1100 = arith.constant 0 : i32; + v379 = arith.constant 1 : i32; + v380 = arith.neq v378, v379 : i1; + v381 = arith.zext v380 : u32; + v382 = hir.bitcast v381 : i32; + v384 = arith.neq v382, v1100 : i1; + cf.cond_br v384 ^block54, ^block55; + ^block54: + v393 = arith.constant 12 : u32; + v392 = hir.bitcast v358 : u32; + v394 = arith.add v392, v393 : u32 #[overflow = checked]; + v1099 = arith.constant 4 : u32; + v396 = arith.mod v394, v1099 : u32; hir.assertz v396 #[code = 250]; - v397 = hir.int_to_ptr v394 : ptr; - hir.store v397, v393; - v1069 = arith.constant 16 : i32; - v399 = arith.add v382, v1069 : i32 #[overflow = wrapping]; - v400 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v401 = hir.bitcast v400 : ptr; - hir.store v401, v399; + v397 = hir.int_to_ptr v394 : ptr; + v398 = hir.load v397 : i32; + v1098 = arith.constant 4 : u32; + v399 = hir.bitcast v349 : u32; + v401 = arith.add v399, v1098 : u32 #[overflow = checked]; + v1097 = arith.constant 4 : u32; + v403 = arith.mod v401, v1097 : u32; + hir.assertz v403 #[code = 250]; + v404 = hir.int_to_ptr v401 : ptr; + hir.store v404, v398; + v405 = hir.bitcast v349 : u32; + v1096 = arith.constant 4 : u32; + v407 = arith.mod v405, v1096 : u32; + hir.assertz v407 #[code = 250]; + v408 = hir.int_to_ptr v405 : ptr; + hir.store v408, v371; + v1095 = arith.constant 16 : i32; + v410 = arith.add v358, v1095 : i32 #[overflow = wrapping]; + v411 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v412 = hir.bitcast v411 : ptr; + hir.store v412, v410; builtin.ret ; + ^block55: + v1094 = arith.constant 12 : u32; + v385 = hir.bitcast v358 : u32; + v387 = arith.add v385, v1094 : u32 #[overflow = checked]; + v1093 = arith.constant 4 : u32; + v389 = arith.mod v387, v1093 : u32; + hir.assertz v389 #[code = 250]; + v390 = hir.int_to_ptr v387 : ptr; + v391 = hir.load v390 : i32; + hir.exec @miden:base/note-script@1.0.0/p2id/alloc::raw_vec::handle_error(v371, v391, v352) + ub.unreachable ; }; - private builtin.function @miden_base_sys::bindings::active_note::get_inputs(v402: i32) { - ^block56(v402: i32): - v404 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v405 = hir.bitcast v404 : ptr; - v406 = hir.load v405 : i32; - v407 = arith.constant 16 : i32; - v408 = arith.sub v406, v407 : i32 #[overflow = wrapping]; - v409 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v410 = hir.bitcast v409 : ptr; - hir.store v410, v408; - v415 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/GOT.data.internal.__memory_base : ptr + private builtin.function @miden_base_sys::bindings::account::get_id(v413: i32) { + ^block56(v413: i32): + v415 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr v416 = hir.bitcast v415 : ptr; v417 = hir.load v416 : i32; - v418 = arith.constant 1048640 : i32; - v419 = arith.add v417, v418 : i32 #[overflow = wrapping]; - v413 = arith.constant 4 : i32; - v411 = arith.constant 8 : i32; - v412 = arith.add v408, v411 : i32 #[overflow = wrapping]; - hir.exec @miden:base/note-script@1.0.0/p2id/alloc::raw_vec::RawVecInner::with_capacity_in(v412, v413, v413, v419) - v421 = arith.constant 8 : u32; - v420 = hir.bitcast v408 : u32; - v422 = arith.add v420, v421 : u32 #[overflow = checked]; - v423 = arith.constant 4 : u32; - v424 = arith.mod v422, v423 : u32; - hir.assertz v424 #[code = 250]; - v425 = hir.int_to_ptr v422 : ptr; - v426 = hir.load v425 : i32; - v428 = arith.constant 12 : u32; - v427 = hir.bitcast v408 : u32; - v429 = arith.add v427, v428 : u32 #[overflow = checked]; - v1078 = arith.constant 4 : u32; - v431 = arith.mod v429, v1078 : u32; - hir.assertz v431 #[code = 250]; - v432 = hir.int_to_ptr v429 : ptr; - v433 = hir.load v432 : i32; - v1071 = arith.constant 2 : u32; - v435 = hir.bitcast v433 : u32; - v437 = arith.shr v435, v1071 : u32; - v438 = hir.bitcast v437 : i32; - v439 = hir.exec @miden:base/note-script@1.0.0/p2id/miden::active_note::get_inputs(v438) : i32 - v1077 = arith.constant 8 : u32; - v440 = hir.bitcast v402 : u32; - v442 = arith.add v440, v1077 : u32 #[overflow = checked]; - v1076 = arith.constant 4 : u32; - v444 = arith.mod v442, v1076 : u32; - hir.assertz v444 #[code = 250]; - v445 = hir.int_to_ptr v442 : ptr; - hir.store v445, v439; - v1075 = arith.constant 4 : u32; - v446 = hir.bitcast v402 : u32; - v448 = arith.add v446, v1075 : u32 #[overflow = checked]; - v1074 = arith.constant 4 : u32; - v450 = arith.mod v448, v1074 : u32; - hir.assertz v450 #[code = 250]; - v451 = hir.int_to_ptr v448 : ptr; - hir.store v451, v433; - v452 = hir.bitcast v402 : u32; - v1073 = arith.constant 4 : u32; - v454 = arith.mod v452, v1073 : u32; - hir.assertz v454 #[code = 250]; - v455 = hir.int_to_ptr v452 : ptr; - hir.store v455, v426; - v1072 = arith.constant 16 : i32; - v457 = arith.add v408, v1072 : i32 #[overflow = wrapping]; - v458 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v459 = hir.bitcast v458 : ptr; - hir.store v459, v457; + v418 = arith.constant 16 : i32; + v419 = arith.sub v417, v418 : i32 #[overflow = wrapping]; + v420 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v421 = hir.bitcast v420 : ptr; + hir.store v421, v419; + v422 = arith.constant 8 : i32; + v423 = arith.add v419, v422 : i32 #[overflow = wrapping]; + hir.exec @miden:base/note-script@1.0.0/p2id/miden::active_account::get_id(v423) + v425 = arith.constant 8 : u32; + v424 = hir.bitcast v419 : u32; + v426 = arith.add v424, v425 : u32 #[overflow = checked]; + v427 = arith.constant 4 : u32; + v428 = arith.mod v426, v427 : u32; + hir.assertz v428 #[code = 250]; + v429 = hir.int_to_ptr v426 : ptr; + v430 = hir.load v429 : i64; + v431 = hir.bitcast v413 : u32; + v1104 = arith.constant 8 : u32; + v433 = arith.mod v431, v1104 : u32; + hir.assertz v433 #[code = 250]; + v434 = hir.int_to_ptr v431 : ptr; + hir.store v434, v430; + v1103 = arith.constant 16 : i32; + v436 = arith.add v419, v1103 : i32 #[overflow = wrapping]; + v437 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v438 = hir.bitcast v437 : ptr; + hir.store v438, v436; builtin.ret ; }; - private builtin.function @miden_base_sys::bindings::active_note::get_assets(v460: i32) { - ^block58(v460: i32): - v462 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v463 = hir.bitcast v462 : ptr; - v464 = hir.load v463 : i32; - v465 = arith.constant 16 : i32; - v466 = arith.sub v464, v465 : i32 #[overflow = wrapping]; - v467 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v468 = hir.bitcast v467 : ptr; - hir.store v468, v466; - v473 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/GOT.data.internal.__memory_base : ptr - v474 = hir.bitcast v473 : ptr; - v475 = hir.load v474 : i32; - v476 = arith.constant 1048656 : i32; - v477 = arith.add v475, v476 : i32 #[overflow = wrapping]; - v1087 = arith.constant 16 : i32; - v469 = arith.constant 8 : i32; - v470 = arith.add v466, v469 : i32 #[overflow = wrapping]; - hir.exec @miden:base/note-script@1.0.0/p2id/alloc::raw_vec::RawVecInner::with_capacity_in(v470, v1087, v1087, v477) - v479 = arith.constant 8 : u32; - v478 = hir.bitcast v466 : u32; - v480 = arith.add v478, v479 : u32 #[overflow = checked]; - v481 = arith.constant 4 : u32; - v482 = arith.mod v480, v481 : u32; - hir.assertz v482 #[code = 250]; - v483 = hir.int_to_ptr v480 : ptr; - v484 = hir.load v483 : i32; - v486 = arith.constant 12 : u32; - v485 = hir.bitcast v466 : u32; - v487 = arith.add v485, v486 : u32 #[overflow = checked]; - v1086 = arith.constant 4 : u32; - v489 = arith.mod v487, v1086 : u32; - hir.assertz v489 #[code = 250]; - v490 = hir.int_to_ptr v487 : ptr; - v491 = hir.load v490 : i32; - v1079 = arith.constant 2 : u32; - v493 = hir.bitcast v491 : u32; - v495 = arith.shr v493, v1079 : u32; - v496 = hir.bitcast v495 : i32; - v497 = hir.exec @miden:base/note-script@1.0.0/p2id/miden::active_note::get_assets(v496) : i32 - v1085 = arith.constant 8 : u32; - v498 = hir.bitcast v460 : u32; - v500 = arith.add v498, v1085 : u32 #[overflow = checked]; - v1084 = arith.constant 4 : u32; - v502 = arith.mod v500, v1084 : u32; - hir.assertz v502 #[code = 250]; - v503 = hir.int_to_ptr v500 : ptr; - hir.store v503, v497; - v1083 = arith.constant 4 : u32; - v504 = hir.bitcast v460 : u32; - v506 = arith.add v504, v1083 : u32 #[overflow = checked]; - v1082 = arith.constant 4 : u32; - v508 = arith.mod v506, v1082 : u32; - hir.assertz v508 #[code = 250]; - v509 = hir.int_to_ptr v506 : ptr; - hir.store v509, v491; - v510 = hir.bitcast v460 : u32; - v1081 = arith.constant 4 : u32; - v512 = arith.mod v510, v1081 : u32; - hir.assertz v512 #[code = 250]; - v513 = hir.int_to_ptr v510 : ptr; - hir.store v513, v484; - v1080 = arith.constant 16 : i32; - v515 = arith.add v466, v1080 : i32 #[overflow = wrapping]; - v516 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v517 = hir.bitcast v516 : ptr; - hir.store v517, v515; + private builtin.function @miden_base_sys::bindings::active_note::get_inputs(v439: i32) { + ^block58(v439: i32): + v441 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v442 = hir.bitcast v441 : ptr; + v443 = hir.load v442 : i32; + v444 = arith.constant 16 : i32; + v445 = arith.sub v443, v444 : i32 #[overflow = wrapping]; + v446 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v447 = hir.bitcast v446 : ptr; + hir.store v447, v445; + v452 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/GOT.data.internal.__memory_base : ptr + v453 = hir.bitcast v452 : ptr; + v454 = hir.load v453 : i32; + v455 = arith.constant 1048640 : i32; + v456 = arith.add v454, v455 : i32 #[overflow = wrapping]; + v450 = arith.constant 4 : i32; + v448 = arith.constant 8 : i32; + v449 = arith.add v445, v448 : i32 #[overflow = wrapping]; + hir.exec @miden:base/note-script@1.0.0/p2id/alloc::raw_vec::RawVecInner::with_capacity_in(v449, v450, v450, v456) + v458 = arith.constant 8 : u32; + v457 = hir.bitcast v445 : u32; + v459 = arith.add v457, v458 : u32 #[overflow = checked]; + v460 = arith.constant 4 : u32; + v461 = arith.mod v459, v460 : u32; + hir.assertz v461 #[code = 250]; + v462 = hir.int_to_ptr v459 : ptr; + v463 = hir.load v462 : i32; + v465 = arith.constant 12 : u32; + v464 = hir.bitcast v445 : u32; + v466 = arith.add v464, v465 : u32 #[overflow = checked]; + v1112 = arith.constant 4 : u32; + v468 = arith.mod v466, v1112 : u32; + hir.assertz v468 #[code = 250]; + v469 = hir.int_to_ptr v466 : ptr; + v470 = hir.load v469 : i32; + v1105 = arith.constant 2 : u32; + v472 = hir.bitcast v470 : u32; + v474 = arith.shr v472, v1105 : u32; + v475 = hir.bitcast v474 : i32; + v476 = hir.exec @miden:base/note-script@1.0.0/p2id/miden::active_note::get_inputs(v475) : i32 + v1111 = arith.constant 8 : u32; + v477 = hir.bitcast v439 : u32; + v479 = arith.add v477, v1111 : u32 #[overflow = checked]; + v1110 = arith.constant 4 : u32; + v481 = arith.mod v479, v1110 : u32; + hir.assertz v481 #[code = 250]; + v482 = hir.int_to_ptr v479 : ptr; + hir.store v482, v476; + v1109 = arith.constant 4 : u32; + v483 = hir.bitcast v439 : u32; + v485 = arith.add v483, v1109 : u32 #[overflow = checked]; + v1108 = arith.constant 4 : u32; + v487 = arith.mod v485, v1108 : u32; + hir.assertz v487 #[code = 250]; + v488 = hir.int_to_ptr v485 : ptr; + hir.store v488, v470; + v489 = hir.bitcast v439 : u32; + v1107 = arith.constant 4 : u32; + v491 = arith.mod v489, v1107 : u32; + hir.assertz v491 #[code = 250]; + v492 = hir.int_to_ptr v489 : ptr; + hir.store v492, v463; + v1106 = arith.constant 16 : i32; + v494 = arith.add v445, v1106 : i32 #[overflow = wrapping]; + v495 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v496 = hir.bitcast v495 : ptr; + hir.store v496, v494; builtin.ret ; }; - private builtin.function @intrinsics::felt::eq(v518: felt, v519: felt) -> i32 { - ^block60(v518: felt, v519: felt): - v520 = arith.eq v518, v519 : i1; - v521 = hir.cast v520 : i32; - builtin.ret v521; + private builtin.function @miden_base_sys::bindings::active_note::get_assets(v497: i32) { + ^block60(v497: i32): + v499 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v500 = hir.bitcast v499 : ptr; + v501 = hir.load v500 : i32; + v502 = arith.constant 16 : i32; + v503 = arith.sub v501, v502 : i32 #[overflow = wrapping]; + v504 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v505 = hir.bitcast v504 : ptr; + hir.store v505, v503; + v508 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/GOT.data.internal.__memory_base : ptr + v509 = hir.bitcast v508 : ptr; + v510 = hir.load v509 : i32; + v511 = arith.constant 1048656 : i32; + v512 = arith.add v510, v511 : i32 #[overflow = wrapping]; + v506 = arith.constant 4 : i32; + v507 = arith.add v503, v506 : i32 #[overflow = wrapping]; + hir.exec @miden:base/note-script@1.0.0/p2id/alloc::vec::Vec::with_capacity(v507, v512) + v516 = arith.constant 8 : u32; + v515 = hir.bitcast v503 : u32; + v517 = arith.add v515, v516 : u32 #[overflow = checked]; + v518 = arith.constant 4 : u32; + v519 = arith.mod v517, v518 : u32; + hir.assertz v519 #[code = 250]; + v520 = hir.int_to_ptr v517 : ptr; + v521 = hir.load v520 : i32; + v1113 = arith.constant 2 : u32; + v523 = hir.bitcast v521 : u32; + v525 = arith.shr v523, v1113 : u32; + v526 = hir.bitcast v525 : i32; + v527 = hir.exec @miden:base/note-script@1.0.0/p2id/miden::active_note::get_assets(v526) : i32 + v513 = arith.constant 8 : i32; + v514 = arith.add v497, v513 : i32 #[overflow = wrapping]; + v528 = hir.bitcast v514 : u32; + v1118 = arith.constant 4 : u32; + v530 = arith.mod v528, v1118 : u32; + hir.assertz v530 #[code = 250]; + v531 = hir.int_to_ptr v528 : ptr; + hir.store v531, v527; + v1117 = arith.constant 4 : u32; + v532 = hir.bitcast v503 : u32; + v534 = arith.add v532, v1117 : u32 #[overflow = checked]; + v1116 = arith.constant 4 : u32; + v536 = arith.mod v534, v1116 : u32; + hir.assertz v536 #[code = 250]; + v537 = hir.int_to_ptr v534 : ptr; + v538 = hir.load v537 : i64; + v539 = hir.bitcast v497 : u32; + v1115 = arith.constant 4 : u32; + v541 = arith.mod v539, v1115 : u32; + hir.assertz v541 #[code = 250]; + v542 = hir.int_to_ptr v539 : ptr; + hir.store v542, v538; + v1114 = arith.constant 16 : i32; + v544 = arith.add v503, v1114 : i32 #[overflow = wrapping]; + v545 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v546 = hir.bitcast v545 : ptr; + hir.store v546, v544; + builtin.ret ; + }; + + private builtin.function @intrinsics::felt::eq(v547: felt, v548: felt) -> i32 { + ^block62(v547: felt, v548: felt): + v549 = arith.eq v547, v548 : i1; + v550 = hir.cast v549 : i32; + builtin.ret v550; }; - private builtin.function @alloc::raw_vec::RawVecInner::deallocate(v523: i32, v524: i32, v525: i32) { - ^block62(v523: i32, v524: i32, v525: i32): - v527 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v528 = hir.bitcast v527 : ptr; - v529 = hir.load v528 : i32; - v530 = arith.constant 16 : i32; - v531 = arith.sub v529, v530 : i32 #[overflow = wrapping]; - v532 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v533 = hir.bitcast v532 : ptr; - hir.store v533, v531; - v534 = arith.constant 4 : i32; - v535 = arith.add v531, v534 : i32 #[overflow = wrapping]; - hir.exec @miden:base/note-script@1.0.0/p2id/alloc::raw_vec::RawVecInner::current_memory(v535, v523, v524, v525) - v537 = arith.constant 8 : u32; - v536 = hir.bitcast v531 : u32; - v538 = arith.add v536, v537 : u32 #[overflow = checked]; - v539 = arith.constant 4 : u32; - v540 = arith.mod v538, v539 : u32; - hir.assertz v540 #[code = 250]; - v541 = hir.int_to_ptr v538 : ptr; - v542 = hir.load v541 : i32; - v1094 = arith.constant 0 : i32; - v526 = arith.constant 0 : i32; - v544 = arith.eq v542, v526 : i1; - v545 = arith.zext v544 : u32; - v546 = hir.bitcast v545 : i32; - v548 = arith.neq v546, v1094 : i1; - scf.if v548{ - ^block143: + private builtin.function @alloc::raw_vec::RawVecInner::deallocate(v552: i32, v553: i32, v554: i32) { + ^block64(v552: i32, v553: i32, v554: i32): + v556 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v557 = hir.bitcast v556 : ptr; + v558 = hir.load v557 : i32; + v559 = arith.constant 16 : i32; + v560 = arith.sub v558, v559 : i32 #[overflow = wrapping]; + v561 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v562 = hir.bitcast v561 : ptr; + hir.store v562, v560; + v563 = arith.constant 4 : i32; + v564 = arith.add v560, v563 : i32 #[overflow = wrapping]; + hir.exec @miden:base/note-script@1.0.0/p2id/alloc::raw_vec::RawVecInner::current_memory(v564, v552, v553, v554) + v566 = arith.constant 8 : u32; + v565 = hir.bitcast v560 : u32; + v567 = arith.add v565, v566 : u32 #[overflow = checked]; + v568 = arith.constant 4 : u32; + v569 = arith.mod v567, v568 : u32; + hir.assertz v569 #[code = 250]; + v570 = hir.int_to_ptr v567 : ptr; + v571 = hir.load v570 : i32; + v1125 = arith.constant 0 : i32; + v555 = arith.constant 0 : i32; + v573 = arith.eq v571, v555 : i1; + v574 = arith.zext v573 : u32; + v575 = hir.bitcast v574 : i32; + v577 = arith.neq v575, v1125 : i1; + scf.if v577{ + ^block145: scf.yield ; } else { - ^block65: - v1093 = arith.constant 4 : u32; - v549 = hir.bitcast v531 : u32; - v551 = arith.add v549, v1093 : u32 #[overflow = checked]; - v1092 = arith.constant 4 : u32; - v553 = arith.mod v551, v1092 : u32; - hir.assertz v553 #[code = 250]; - v554 = hir.int_to_ptr v551 : ptr; - v555 = hir.load v554 : i32; - v557 = arith.constant 12 : u32; - v556 = hir.bitcast v531 : u32; - v558 = arith.add v556, v557 : u32 #[overflow = checked]; - v1091 = arith.constant 4 : u32; - v560 = arith.mod v558, v1091 : u32; - hir.assertz v560 #[code = 250]; - v561 = hir.int_to_ptr v558 : ptr; - v562 = hir.load v561 : i32; - hir.exec @miden:base/note-script@1.0.0/p2id/::deallocate(v555, v542, v562) + ^block67: + v1124 = arith.constant 4 : u32; + v578 = hir.bitcast v560 : u32; + v580 = arith.add v578, v1124 : u32 #[overflow = checked]; + v1123 = arith.constant 4 : u32; + v582 = arith.mod v580, v1123 : u32; + hir.assertz v582 #[code = 250]; + v583 = hir.int_to_ptr v580 : ptr; + v584 = hir.load v583 : i32; + v586 = arith.constant 12 : u32; + v585 = hir.bitcast v560 : u32; + v587 = arith.add v585, v586 : u32 #[overflow = checked]; + v1122 = arith.constant 4 : u32; + v589 = arith.mod v587, v1122 : u32; + hir.assertz v589 #[code = 250]; + v590 = hir.int_to_ptr v587 : ptr; + v591 = hir.load v590 : i32; + hir.exec @miden:base/note-script@1.0.0/p2id/::deallocate(v584, v571, v591) scf.yield ; }; - v1090 = arith.constant 16 : i32; - v565 = arith.add v531, v1090 : i32 #[overflow = wrapping]; - v566 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v567 = hir.bitcast v566 : ptr; - hir.store v567, v565; + v1121 = arith.constant 16 : i32; + v594 = arith.add v560, v1121 : i32 #[overflow = wrapping]; + v595 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v596 = hir.bitcast v595 : ptr; + hir.store v596, v594; builtin.ret ; }; - private builtin.function @alloc::raw_vec::RawVecInner::try_allocate_in(v568: i32, v569: i32, v570: i32, v571: i32, v572: i32) { - ^block66(v568: i32, v569: i32, v570: i32, v571: i32, v572: i32): - v575 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v576 = hir.bitcast v575 : ptr; - v577 = hir.load v576 : i32; - v578 = arith.constant 16 : i32; - v579 = arith.sub v577, v578 : i32 #[overflow = wrapping]; - v580 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v581 = hir.bitcast v580 : ptr; - hir.store v581, v579; - v591 = hir.bitcast v569 : u32; - v592 = arith.zext v591 : u64; - v593 = hir.bitcast v592 : i64; - v573 = arith.constant 0 : i32; - v586 = arith.sub v573, v571 : i32 #[overflow = wrapping]; - v583 = arith.constant -1 : i32; - v582 = arith.add v571, v572 : i32 #[overflow = wrapping]; - v584 = arith.add v582, v583 : i32 #[overflow = wrapping]; - v587 = arith.band v584, v586 : i32; - v588 = hir.bitcast v587 : u32; - v589 = arith.zext v588 : u64; - v590 = hir.bitcast v589 : i64; - v594 = arith.mul v590, v593 : i64 #[overflow = wrapping]; - v1198 = arith.constant 0 : i32; - v595 = arith.constant 32 : i64; - v597 = hir.cast v595 : u32; - v596 = hir.bitcast v594 : u64; - v598 = arith.shr v596, v597 : u64; - v599 = hir.bitcast v598 : i64; - v600 = arith.trunc v599 : i32; - v602 = arith.neq v600, v1198 : i1; - v1110, v1111, v1112, v1113, v1114, v1115 = scf.if v602 : i32, i32, i32, i32, i32, u32 { - ^block145: - v1095 = arith.constant 0 : u32; - v1102 = ub.poison i32 : i32; - scf.yield v568, v579, v1102, v1102, v1102, v1095; + private builtin.function @alloc::raw_vec::RawVecInner::try_allocate_in(v597: i32, v598: i32, v599: i32, v600: i32, v601: i32) { + ^block68(v597: i32, v598: i32, v599: i32, v600: i32, v601: i32): + v604 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v605 = hir.bitcast v604 : ptr; + v606 = hir.load v605 : i32; + v607 = arith.constant 16 : i32; + v608 = arith.sub v606, v607 : i32 #[overflow = wrapping]; + v609 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v610 = hir.bitcast v609 : ptr; + hir.store v610, v608; + v620 = hir.bitcast v598 : u32; + v621 = arith.zext v620 : u64; + v622 = hir.bitcast v621 : i64; + v602 = arith.constant 0 : i32; + v615 = arith.sub v602, v600 : i32 #[overflow = wrapping]; + v612 = arith.constant -1 : i32; + v611 = arith.add v600, v601 : i32 #[overflow = wrapping]; + v613 = arith.add v611, v612 : i32 #[overflow = wrapping]; + v616 = arith.band v613, v615 : i32; + v617 = hir.bitcast v616 : u32; + v618 = arith.zext v617 : u64; + v619 = hir.bitcast v618 : i64; + v623 = arith.mul v619, v622 : i64 #[overflow = wrapping]; + v1229 = arith.constant 0 : i32; + v624 = arith.constant 32 : i64; + v626 = hir.cast v624 : u32; + v625 = hir.bitcast v623 : u64; + v627 = arith.shr v625, v626 : u64; + v628 = hir.bitcast v627 : i64; + v629 = arith.trunc v628 : i32; + v631 = arith.neq v629, v1229 : i1; + v1141, v1142, v1143, v1144, v1145, v1146 = scf.if v631 : i32, i32, i32, i32, i32, u32 { + ^block147: + v1126 = arith.constant 0 : u32; + v1133 = ub.poison i32 : i32; + scf.yield v597, v608, v1133, v1133, v1133, v1126; } else { - ^block71: - v603 = arith.trunc v594 : i32; - v1197 = arith.constant 0 : i32; - v604 = arith.constant -2147483648 : i32; - v605 = arith.sub v604, v571 : i32 #[overflow = wrapping]; - v607 = hir.bitcast v605 : u32; - v606 = hir.bitcast v603 : u32; - v608 = arith.lte v606, v607 : i1; - v609 = arith.zext v608 : u32; - v610 = hir.bitcast v609 : i32; - v612 = arith.neq v610, v1197 : i1; - v1158 = scf.if v612 : i32 { - ^block69: - v1196 = arith.constant 0 : i32; - v623 = arith.neq v603, v1196 : i1; - v1157 = scf.if v623 : i32 { - ^block73: - v1195 = arith.constant 0 : i32; - v639 = arith.neq v570, v1195 : i1; - v1156 = scf.if v639 : i32 { - ^block76: - v621 = arith.constant 1 : i32; - hir.exec @miden:base/note-script@1.0.0/p2id/alloc::alloc::Global::alloc_impl(v579, v571, v603, v621) - v650 = hir.bitcast v579 : u32; - v695 = arith.constant 4 : u32; - v652 = arith.mod v650, v695 : u32; - hir.assertz v652 #[code = 250]; - v653 = hir.int_to_ptr v650 : ptr; - v654 = hir.load v653 : i32; - scf.yield v654; + ^block73: + v632 = arith.trunc v623 : i32; + v1228 = arith.constant 0 : i32; + v633 = arith.constant -2147483648 : i32; + v634 = arith.sub v633, v600 : i32 #[overflow = wrapping]; + v636 = hir.bitcast v634 : u32; + v635 = hir.bitcast v632 : u32; + v637 = arith.lte v635, v636 : i1; + v638 = arith.zext v637 : u32; + v639 = hir.bitcast v638 : i32; + v641 = arith.neq v639, v1228 : i1; + v1189 = scf.if v641 : i32 { + ^block71: + v1227 = arith.constant 0 : i32; + v652 = arith.neq v632, v1227 : i1; + v1188 = scf.if v652 : i32 { + ^block75: + v1226 = arith.constant 0 : i32; + v668 = arith.neq v599, v1226 : i1; + v1187 = scf.if v668 : i32 { + ^block78: + v650 = arith.constant 1 : i32; + hir.exec @miden:base/note-script@1.0.0/p2id/alloc::alloc::Global::alloc_impl(v608, v600, v632, v650) + v679 = hir.bitcast v608 : u32; + v724 = arith.constant 4 : u32; + v681 = arith.mod v679, v724 : u32; + hir.assertz v681 #[code = 250]; + v682 = hir.int_to_ptr v679 : ptr; + v683 = hir.load v682 : i32; + scf.yield v683; } else { - ^block77: - v640 = arith.constant 8 : i32; - v641 = arith.add v579, v640 : i32 #[overflow = wrapping]; - hir.exec @miden:base/note-script@1.0.0/p2id/::allocate(v641, v571, v603) - v625 = arith.constant 8 : u32; - v642 = hir.bitcast v579 : u32; - v644 = arith.add v642, v625 : u32 #[overflow = checked]; - v1194 = arith.constant 4 : u32; - v646 = arith.mod v644, v1194 : u32; - hir.assertz v646 #[code = 250]; - v647 = hir.int_to_ptr v644 : ptr; - v648 = hir.load v647 : i32; - scf.yield v648; + ^block79: + v669 = arith.constant 8 : i32; + v670 = arith.add v608, v669 : i32 #[overflow = wrapping]; + hir.exec @miden:base/note-script@1.0.0/p2id/::allocate(v670, v600, v632) + v654 = arith.constant 8 : u32; + v671 = hir.bitcast v608 : u32; + v673 = arith.add v671, v654 : u32 #[overflow = checked]; + v1225 = arith.constant 4 : u32; + v675 = arith.mod v673, v1225 : u32; + hir.assertz v675 #[code = 250]; + v676 = hir.int_to_ptr v673 : ptr; + v677 = hir.load v676 : i32; + scf.yield v677; }; - v1192 = arith.constant 0 : i32; - v1193 = arith.constant 0 : i32; - v657 = arith.eq v1156, v1193 : i1; - v658 = arith.zext v657 : u32; - v659 = hir.bitcast v658 : i32; - v661 = arith.neq v659, v1192 : i1; - scf.if v661{ - ^block78: - v1191 = arith.constant 8 : u32; - v678 = hir.bitcast v568 : u32; - v680 = arith.add v678, v1191 : u32 #[overflow = checked]; - v1190 = arith.constant 4 : u32; - v682 = arith.mod v680, v1190 : u32; - hir.assertz v682 #[code = 250]; - v683 = hir.int_to_ptr v680 : ptr; - hir.store v683, v603; - v1189 = arith.constant 4 : u32; - v685 = hir.bitcast v568 : u32; - v687 = arith.add v685, v1189 : u32 #[overflow = checked]; - v1188 = arith.constant 4 : u32; - v689 = arith.mod v687, v1188 : u32; - hir.assertz v689 #[code = 250]; - v690 = hir.int_to_ptr v687 : ptr; - hir.store v690, v571; + v1223 = arith.constant 0 : i32; + v1224 = arith.constant 0 : i32; + v686 = arith.eq v1187, v1224 : i1; + v687 = arith.zext v686 : u32; + v688 = hir.bitcast v687 : i32; + v690 = arith.neq v688, v1223 : i1; + scf.if v690{ + ^block80: + v1222 = arith.constant 8 : u32; + v707 = hir.bitcast v597 : u32; + v709 = arith.add v707, v1222 : u32 #[overflow = checked]; + v1221 = arith.constant 4 : u32; + v711 = arith.mod v709, v1221 : u32; + hir.assertz v711 #[code = 250]; + v712 = hir.int_to_ptr v709 : ptr; + hir.store v712, v632; + v1220 = arith.constant 4 : u32; + v714 = hir.bitcast v597 : u32; + v716 = arith.add v714, v1220 : u32 #[overflow = checked]; + v1219 = arith.constant 4 : u32; + v718 = arith.mod v716, v1219 : u32; + hir.assertz v718 #[code = 250]; + v719 = hir.int_to_ptr v716 : ptr; + hir.store v719, v600; scf.yield ; } else { - ^block79: - v1187 = arith.constant 8 : u32; - v663 = hir.bitcast v568 : u32; - v665 = arith.add v663, v1187 : u32 #[overflow = checked]; - v1186 = arith.constant 4 : u32; - v667 = arith.mod v665, v1186 : u32; - hir.assertz v667 #[code = 250]; - v668 = hir.int_to_ptr v665 : ptr; - hir.store v668, v1156; - v1185 = arith.constant 4 : u32; - v670 = hir.bitcast v568 : u32; - v672 = arith.add v670, v1185 : u32 #[overflow = checked]; - v1184 = arith.constant 4 : u32; - v674 = arith.mod v672, v1184 : u32; - hir.assertz v674 #[code = 250]; - v675 = hir.int_to_ptr v672 : ptr; - hir.store v675, v569; + ^block81: + v1218 = arith.constant 8 : u32; + v692 = hir.bitcast v597 : u32; + v694 = arith.add v692, v1218 : u32 #[overflow = checked]; + v1217 = arith.constant 4 : u32; + v696 = arith.mod v694, v1217 : u32; + hir.assertz v696 #[code = 250]; + v697 = hir.int_to_ptr v694 : ptr; + hir.store v697, v1187; + v1216 = arith.constant 4 : u32; + v699 = hir.bitcast v597 : u32; + v701 = arith.add v699, v1216 : u32 #[overflow = checked]; + v1215 = arith.constant 4 : u32; + v703 = arith.mod v701, v1215 : u32; + hir.assertz v703 #[code = 250]; + v704 = hir.int_to_ptr v701 : ptr; + hir.store v704, v598; scf.yield ; }; - v1182 = arith.constant 0 : i32; - v1183 = arith.constant 1 : i32; - v1155 = cf.select v661, v1183, v1182 : i32; - scf.yield v1155; + v1213 = arith.constant 0 : i32; + v1214 = arith.constant 1 : i32; + v1186 = cf.select v690, v1214, v1213 : i32; + scf.yield v1186; } else { - ^block74: - v1181 = arith.constant 8 : u32; - v624 = hir.bitcast v568 : u32; - v626 = arith.add v624, v1181 : u32 #[overflow = checked]; - v1180 = arith.constant 4 : u32; - v628 = arith.mod v626, v1180 : u32; - hir.assertz v628 #[code = 250]; - v629 = hir.int_to_ptr v626 : ptr; - hir.store v629, v571; - v1179 = arith.constant 4 : u32; - v632 = hir.bitcast v568 : u32; - v634 = arith.add v632, v1179 : u32 #[overflow = checked]; - v1178 = arith.constant 4 : u32; - v636 = arith.mod v634, v1178 : u32; - hir.assertz v636 #[code = 250]; - v1177 = arith.constant 0 : i32; - v637 = hir.int_to_ptr v634 : ptr; - hir.store v637, v1177; - v1176 = arith.constant 0 : i32; - scf.yield v1176; + ^block76: + v1212 = arith.constant 8 : u32; + v653 = hir.bitcast v597 : u32; + v655 = arith.add v653, v1212 : u32 #[overflow = checked]; + v1211 = arith.constant 4 : u32; + v657 = arith.mod v655, v1211 : u32; + hir.assertz v657 #[code = 250]; + v658 = hir.int_to_ptr v655 : ptr; + hir.store v658, v600; + v1210 = arith.constant 4 : u32; + v661 = hir.bitcast v597 : u32; + v663 = arith.add v661, v1210 : u32 #[overflow = checked]; + v1209 = arith.constant 4 : u32; + v665 = arith.mod v663, v1209 : u32; + hir.assertz v665 #[code = 250]; + v1208 = arith.constant 0 : i32; + v666 = hir.int_to_ptr v663 : ptr; + hir.store v666, v1208; + v1207 = arith.constant 0 : i32; + scf.yield v1207; }; - scf.yield v1157; + scf.yield v1188; } else { - ^block72: - v1175 = ub.poison i32 : i32; - scf.yield v1175; + ^block74: + v1206 = ub.poison i32 : i32; + scf.yield v1206; }; - v1170 = arith.constant 0 : u32; - v1103 = arith.constant 1 : u32; - v1163 = cf.select v612, v1103, v1170 : u32; - v1171 = ub.poison i32 : i32; - v1162 = cf.select v612, v579, v1171 : i32; - v1172 = ub.poison i32 : i32; - v1161 = cf.select v612, v568, v1172 : i32; - v1173 = ub.poison i32 : i32; - v1160 = cf.select v612, v1173, v579 : i32; - v1174 = ub.poison i32 : i32; - v1159 = cf.select v612, v1174, v568 : i32; - scf.yield v1159, v1160, v1161, v1158, v1162, v1163; + v1201 = arith.constant 0 : u32; + v1134 = arith.constant 1 : u32; + v1194 = cf.select v641, v1134, v1201 : u32; + v1202 = ub.poison i32 : i32; + v1193 = cf.select v641, v608, v1202 : i32; + v1203 = ub.poison i32 : i32; + v1192 = cf.select v641, v597, v1203 : i32; + v1204 = ub.poison i32 : i32; + v1191 = cf.select v641, v1204, v608 : i32; + v1205 = ub.poison i32 : i32; + v1190 = cf.select v641, v1205, v597 : i32; + scf.yield v1190, v1191, v1192, v1189, v1193, v1194; }; - v1116, v1117, v1118 = scf.index_switch v1115 : i32, i32, i32 + v1147, v1148, v1149 = scf.index_switch v1146 : i32, i32, i32 case 0 { - ^block70: - v1169 = arith.constant 4 : u32; - v615 = hir.bitcast v1110 : u32; - v617 = arith.add v615, v1169 : u32 #[overflow = checked]; - v1168 = arith.constant 4 : u32; - v619 = arith.mod v617, v1168 : u32; - hir.assertz v619 #[code = 250]; - v1167 = arith.constant 0 : i32; - v620 = hir.int_to_ptr v617 : ptr; - hir.store v620, v1167; - v1166 = arith.constant 1 : i32; - scf.yield v1110, v1166, v1111; + ^block72: + v1200 = arith.constant 4 : u32; + v644 = hir.bitcast v1141 : u32; + v646 = arith.add v644, v1200 : u32 #[overflow = checked]; + v1199 = arith.constant 4 : u32; + v648 = arith.mod v646, v1199 : u32; + hir.assertz v648 #[code = 250]; + v1198 = arith.constant 0 : i32; + v649 = hir.int_to_ptr v646 : ptr; + hir.store v649, v1198; + v1197 = arith.constant 1 : i32; + scf.yield v1141, v1197, v1142; } default { - ^block149: - scf.yield v1112, v1113, v1114; + ^block151: + scf.yield v1143, v1144, v1145; }; - v694 = hir.bitcast v1116 : u32; - v1165 = arith.constant 4 : u32; - v696 = arith.mod v694, v1165 : u32; - hir.assertz v696 #[code = 250]; - v697 = hir.int_to_ptr v694 : ptr; - hir.store v697, v1117; - v1164 = arith.constant 16 : i32; - v702 = arith.add v1118, v1164 : i32 #[overflow = wrapping]; - v703 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v704 = hir.bitcast v703 : ptr; - hir.store v704, v702; + v723 = hir.bitcast v1147 : u32; + v1196 = arith.constant 4 : u32; + v725 = arith.mod v723, v1196 : u32; + hir.assertz v725 #[code = 250]; + v726 = hir.int_to_ptr v723 : ptr; + hir.store v726, v1148; + v1195 = arith.constant 16 : i32; + v731 = arith.add v1149, v1195 : i32 #[overflow = wrapping]; + v732 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v733 = hir.bitcast v732 : ptr; + hir.store v733, v731; builtin.ret ; }; - private builtin.function @::allocate(v705: i32, v706: i32, v707: i32) { - ^block80(v705: i32, v706: i32, v707: i32): - v709 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v710 = hir.bitcast v709 : ptr; - v711 = hir.load v710 : i32; - v712 = arith.constant 16 : i32; - v713 = arith.sub v711, v712 : i32 #[overflow = wrapping]; - v714 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v715 = hir.bitcast v714 : ptr; - hir.store v715, v713; - v708 = arith.constant 0 : i32; - v716 = arith.constant 8 : i32; - v717 = arith.add v713, v716 : i32 #[overflow = wrapping]; - hir.exec @miden:base/note-script@1.0.0/p2id/alloc::alloc::Global::alloc_impl(v717, v706, v707, v708) - v720 = arith.constant 12 : u32; - v719 = hir.bitcast v713 : u32; - v721 = arith.add v719, v720 : u32 #[overflow = checked]; - v722 = arith.constant 4 : u32; - v723 = arith.mod v721, v722 : u32; - hir.assertz v723 #[code = 250]; - v724 = hir.int_to_ptr v721 : ptr; - v725 = hir.load v724 : i32; - v727 = arith.constant 8 : u32; - v726 = hir.bitcast v713 : u32; - v728 = arith.add v726, v727 : u32 #[overflow = checked]; - v1203 = arith.constant 4 : u32; - v730 = arith.mod v728, v1203 : u32; - hir.assertz v730 #[code = 250]; - v731 = hir.int_to_ptr v728 : ptr; - v732 = hir.load v731 : i32; - v733 = hir.bitcast v705 : u32; - v1202 = arith.constant 4 : u32; - v735 = arith.mod v733, v1202 : u32; - hir.assertz v735 #[code = 250]; - v736 = hir.int_to_ptr v733 : ptr; - hir.store v736, v732; - v1201 = arith.constant 4 : u32; - v737 = hir.bitcast v705 : u32; - v739 = arith.add v737, v1201 : u32 #[overflow = checked]; - v1200 = arith.constant 4 : u32; - v741 = arith.mod v739, v1200 : u32; - hir.assertz v741 #[code = 250]; - v742 = hir.int_to_ptr v739 : ptr; - hir.store v742, v725; - v1199 = arith.constant 16 : i32; - v744 = arith.add v713, v1199 : i32 #[overflow = wrapping]; - v745 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v746 = hir.bitcast v745 : ptr; - hir.store v746, v744; + private builtin.function @::allocate(v734: i32, v735: i32, v736: i32) { + ^block82(v734: i32, v735: i32, v736: i32): + v738 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v739 = hir.bitcast v738 : ptr; + v740 = hir.load v739 : i32; + v741 = arith.constant 16 : i32; + v742 = arith.sub v740, v741 : i32 #[overflow = wrapping]; + v743 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v744 = hir.bitcast v743 : ptr; + hir.store v744, v742; + v737 = arith.constant 0 : i32; + v745 = arith.constant 8 : i32; + v746 = arith.add v742, v745 : i32 #[overflow = wrapping]; + hir.exec @miden:base/note-script@1.0.0/p2id/alloc::alloc::Global::alloc_impl(v746, v735, v736, v737) + v749 = arith.constant 12 : u32; + v748 = hir.bitcast v742 : u32; + v750 = arith.add v748, v749 : u32 #[overflow = checked]; + v751 = arith.constant 4 : u32; + v752 = arith.mod v750, v751 : u32; + hir.assertz v752 #[code = 250]; + v753 = hir.int_to_ptr v750 : ptr; + v754 = hir.load v753 : i32; + v756 = arith.constant 8 : u32; + v755 = hir.bitcast v742 : u32; + v757 = arith.add v755, v756 : u32 #[overflow = checked]; + v1234 = arith.constant 4 : u32; + v759 = arith.mod v757, v1234 : u32; + hir.assertz v759 #[code = 250]; + v760 = hir.int_to_ptr v757 : ptr; + v761 = hir.load v760 : i32; + v762 = hir.bitcast v734 : u32; + v1233 = arith.constant 4 : u32; + v764 = arith.mod v762, v1233 : u32; + hir.assertz v764 #[code = 250]; + v765 = hir.int_to_ptr v762 : ptr; + hir.store v765, v761; + v1232 = arith.constant 4 : u32; + v766 = hir.bitcast v734 : u32; + v768 = arith.add v766, v1232 : u32 #[overflow = checked]; + v1231 = arith.constant 4 : u32; + v770 = arith.mod v768, v1231 : u32; + hir.assertz v770 #[code = 250]; + v771 = hir.int_to_ptr v768 : ptr; + hir.store v771, v754; + v1230 = arith.constant 16 : i32; + v773 = arith.add v742, v1230 : i32 #[overflow = wrapping]; + v774 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v775 = hir.bitcast v774 : ptr; + hir.store v775, v773; builtin.ret ; }; - private builtin.function @alloc::alloc::Global::alloc_impl(v747: i32, v748: i32, v749: i32, v750: i32) { - ^block82(v747: i32, v748: i32, v749: i32, v750: i32): - v1219 = arith.constant 0 : i32; - v751 = arith.constant 0 : i32; - v752 = arith.eq v749, v751 : i1; - v753 = arith.zext v752 : u32; - v754 = hir.bitcast v753 : i32; - v756 = arith.neq v754, v1219 : i1; - v1215 = scf.if v756 : i32 { - ^block152: - scf.yield v748; + private builtin.function @alloc::alloc::Global::alloc_impl(v776: i32, v777: i32, v778: i32, v779: i32) { + ^block84(v776: i32, v777: i32, v778: i32, v779: i32): + v1250 = arith.constant 0 : i32; + v780 = arith.constant 0 : i32; + v781 = arith.eq v778, v780 : i1; + v782 = arith.zext v781 : u32; + v783 = hir.bitcast v782 : i32; + v785 = arith.neq v783, v1250 : i1; + v1246 = scf.if v785 : i32 { + ^block154: + scf.yield v777; } else { - ^block85: + ^block87: hir.exec @miden:base/note-script@1.0.0/p2id/__rustc::__rust_no_alloc_shim_is_unstable_v2() - v1218 = arith.constant 0 : i32; - v758 = arith.neq v750, v1218 : i1; - v1214 = scf.if v758 : i32 { - ^block86: - v760 = hir.exec @miden:base/note-script@1.0.0/p2id/__rustc::__rust_alloc_zeroed(v749, v748) : i32 - scf.yield v760; + v1249 = arith.constant 0 : i32; + v787 = arith.neq v779, v1249 : i1; + v1245 = scf.if v787 : i32 { + ^block88: + v789 = hir.exec @miden:base/note-script@1.0.0/p2id/__rustc::__rust_alloc_zeroed(v778, v777) : i32 + scf.yield v789; } else { - ^block87: - v759 = hir.exec @miden:base/note-script@1.0.0/p2id/__rustc::__rust_alloc(v749, v748) : i32 - scf.yield v759; + ^block89: + v788 = hir.exec @miden:base/note-script@1.0.0/p2id/__rustc::__rust_alloc(v778, v777) : i32 + scf.yield v788; }; - scf.yield v1214; + scf.yield v1245; }; - v764 = arith.constant 4 : u32; - v763 = hir.bitcast v747 : u32; - v765 = arith.add v763, v764 : u32 #[overflow = checked]; - v1217 = arith.constant 4 : u32; - v767 = arith.mod v765, v1217 : u32; - hir.assertz v767 #[code = 250]; - v768 = hir.int_to_ptr v765 : ptr; - hir.store v768, v749; - v770 = hir.bitcast v747 : u32; - v1216 = arith.constant 4 : u32; - v772 = arith.mod v770, v1216 : u32; - hir.assertz v772 #[code = 250]; - v773 = hir.int_to_ptr v770 : ptr; - hir.store v773, v1215; + v793 = arith.constant 4 : u32; + v792 = hir.bitcast v776 : u32; + v794 = arith.add v792, v793 : u32 #[overflow = checked]; + v1248 = arith.constant 4 : u32; + v796 = arith.mod v794, v1248 : u32; + hir.assertz v796 #[code = 250]; + v797 = hir.int_to_ptr v794 : ptr; + hir.store v797, v778; + v799 = hir.bitcast v776 : u32; + v1247 = arith.constant 4 : u32; + v801 = arith.mod v799, v1247 : u32; + hir.assertz v801 #[code = 250]; + v802 = hir.int_to_ptr v799 : ptr; + hir.store v802, v1246; builtin.ret ; }; - private builtin.function @alloc::raw_vec::RawVecInner::current_memory(v774: i32, v775: i32, v776: i32, v777: i32) { - ^block88(v774: i32, v775: i32, v776: i32, v777: i32): - v1245 = arith.constant 0 : i32; - v778 = arith.constant 0 : i32; - v782 = arith.eq v777, v778 : i1; - v783 = arith.zext v782 : u32; - v784 = hir.bitcast v783 : i32; - v786 = arith.neq v784, v1245 : i1; - v1232, v1233 = scf.if v786 : i32, i32 { - ^block156: - v1244 = arith.constant 0 : i32; - v780 = arith.constant 4 : i32; - scf.yield v780, v1244; + private builtin.function @alloc::raw_vec::RawVecInner::current_memory(v803: i32, v804: i32, v805: i32, v806: i32) { + ^block90(v803: i32, v804: i32, v805: i32, v806: i32): + v1276 = arith.constant 0 : i32; + v807 = arith.constant 0 : i32; + v811 = arith.eq v806, v807 : i1; + v812 = arith.zext v811 : u32; + v813 = hir.bitcast v812 : i32; + v815 = arith.neq v813, v1276 : i1; + v1263, v1264 = scf.if v815 : i32, i32 { + ^block158: + v1275 = arith.constant 0 : i32; + v809 = arith.constant 4 : i32; + scf.yield v809, v1275; } else { - ^block91: - v787 = hir.bitcast v775 : u32; - v822 = arith.constant 4 : u32; - v789 = arith.mod v787, v822 : u32; - hir.assertz v789 #[code = 250]; - v790 = hir.int_to_ptr v787 : ptr; - v791 = hir.load v790 : i32; - v1242 = arith.constant 0 : i32; - v1243 = arith.constant 0 : i32; - v793 = arith.eq v791, v1243 : i1; - v794 = arith.zext v793 : u32; - v795 = hir.bitcast v794 : i32; - v797 = arith.neq v795, v1242 : i1; - v1230 = scf.if v797 : i32 { - ^block155: - v1241 = arith.constant 0 : i32; - scf.yield v1241; + ^block93: + v816 = hir.bitcast v804 : u32; + v851 = arith.constant 4 : u32; + v818 = arith.mod v816, v851 : u32; + hir.assertz v818 #[code = 250]; + v819 = hir.int_to_ptr v816 : ptr; + v820 = hir.load v819 : i32; + v1273 = arith.constant 0 : i32; + v1274 = arith.constant 0 : i32; + v822 = arith.eq v820, v1274 : i1; + v823 = arith.zext v822 : u32; + v824 = hir.bitcast v823 : i32; + v826 = arith.neq v824, v1273 : i1; + v1261 = scf.if v826 : i32 { + ^block157: + v1272 = arith.constant 0 : i32; + scf.yield v1272; } else { - ^block92: - v1240 = arith.constant 4 : u32; - v798 = hir.bitcast v774 : u32; - v800 = arith.add v798, v1240 : u32 #[overflow = checked]; - v1239 = arith.constant 4 : u32; - v802 = arith.mod v800, v1239 : u32; - hir.assertz v802 #[code = 250]; - v803 = hir.int_to_ptr v800 : ptr; - hir.store v803, v776; - v1238 = arith.constant 4 : u32; - v804 = hir.bitcast v775 : u32; - v806 = arith.add v804, v1238 : u32 #[overflow = checked]; - v1237 = arith.constant 4 : u32; - v808 = arith.mod v806, v1237 : u32; - hir.assertz v808 #[code = 250]; - v809 = hir.int_to_ptr v806 : ptr; - v810 = hir.load v809 : i32; - v811 = hir.bitcast v774 : u32; - v1236 = arith.constant 4 : u32; - v813 = arith.mod v811, v1236 : u32; - hir.assertz v813 #[code = 250]; - v814 = hir.int_to_ptr v811 : ptr; - hir.store v814, v810; - v815 = arith.mul v791, v777 : i32 #[overflow = wrapping]; - scf.yield v815; + ^block94: + v1271 = arith.constant 4 : u32; + v827 = hir.bitcast v803 : u32; + v829 = arith.add v827, v1271 : u32 #[overflow = checked]; + v1270 = arith.constant 4 : u32; + v831 = arith.mod v829, v1270 : u32; + hir.assertz v831 #[code = 250]; + v832 = hir.int_to_ptr v829 : ptr; + hir.store v832, v805; + v1269 = arith.constant 4 : u32; + v833 = hir.bitcast v804 : u32; + v835 = arith.add v833, v1269 : u32 #[overflow = checked]; + v1268 = arith.constant 4 : u32; + v837 = arith.mod v835, v1268 : u32; + hir.assertz v837 #[code = 250]; + v838 = hir.int_to_ptr v835 : ptr; + v839 = hir.load v838 : i32; + v840 = hir.bitcast v803 : u32; + v1267 = arith.constant 4 : u32; + v842 = arith.mod v840, v1267 : u32; + hir.assertz v842 #[code = 250]; + v843 = hir.int_to_ptr v840 : ptr; + hir.store v843, v839; + v844 = arith.mul v820, v806 : i32 #[overflow = wrapping]; + scf.yield v844; }; - v816 = arith.constant 8 : i32; - v1235 = arith.constant 4 : i32; - v1231 = cf.select v797, v1235, v816 : i32; - scf.yield v1231, v1230; + v845 = arith.constant 8 : i32; + v1266 = arith.constant 4 : i32; + v1262 = cf.select v826, v1266, v845 : i32; + scf.yield v1262, v1261; }; - v819 = arith.add v774, v1232 : i32 #[overflow = wrapping]; - v821 = hir.bitcast v819 : u32; - v1234 = arith.constant 4 : u32; - v823 = arith.mod v821, v1234 : u32; - hir.assertz v823 #[code = 250]; - v824 = hir.int_to_ptr v821 : ptr; - hir.store v824, v1233; + v848 = arith.add v803, v1263 : i32 #[overflow = wrapping]; + v850 = hir.bitcast v848 : u32; + v1265 = arith.constant 4 : u32; + v852 = arith.mod v850, v1265 : u32; + hir.assertz v852 #[code = 250]; + v853 = hir.int_to_ptr v850 : ptr; + hir.store v853, v1264; builtin.ret ; }; - private builtin.function @::deallocate(v825: i32, v826: i32, v827: i32) { - ^block93(v825: i32, v826: i32, v827: i32): - v1247 = arith.constant 0 : i32; - v828 = arith.constant 0 : i32; - v829 = arith.eq v827, v828 : i1; - v830 = arith.zext v829 : u32; - v831 = hir.bitcast v830 : i32; - v833 = arith.neq v831, v1247 : i1; - scf.if v833{ - ^block95: + private builtin.function @::deallocate(v854: i32, v855: i32, v856: i32) { + ^block95(v854: i32, v855: i32, v856: i32): + v1278 = arith.constant 0 : i32; + v857 = arith.constant 0 : i32; + v858 = arith.eq v856, v857 : i1; + v859 = arith.zext v858 : u32; + v860 = hir.bitcast v859 : i32; + v862 = arith.neq v860, v1278 : i1; + scf.if v862{ + ^block97: scf.yield ; } else { - ^block96: - hir.exec @miden:base/note-script@1.0.0/p2id/__rustc::__rust_dealloc(v825, v827, v826) + ^block98: + hir.exec @miden:base/note-script@1.0.0/p2id/__rustc::__rust_dealloc(v854, v856, v855) scf.yield ; }; builtin.ret ; }; - private builtin.function @alloc::raw_vec::handle_error(v834: i32, v835: i32, v836: i32) { - ^block97(v834: i32, v835: i32, v836: i32): + private builtin.function @alloc::raw_vec::handle_error(v863: i32, v864: i32, v865: i32) { + ^block99(v863: i32, v864: i32, v865: i32): ub.unreachable ; }; - private builtin.function @core::ptr::alignment::Alignment::max(v837: i32, v838: i32) -> i32 { - ^block99(v837: i32, v838: i32): - v845 = arith.constant 0 : i32; - v841 = hir.bitcast v838 : u32; - v840 = hir.bitcast v837 : u32; - v842 = arith.gt v840, v841 : i1; - v843 = arith.zext v842 : u32; - v844 = hir.bitcast v843 : i32; - v846 = arith.neq v844, v845 : i1; - v847 = cf.select v846, v837, v838 : i32; - builtin.ret v847; + private builtin.function @core::ptr::alignment::Alignment::max(v866: i32, v867: i32) -> i32 { + ^block101(v866: i32, v867: i32): + v874 = arith.constant 0 : i32; + v870 = hir.bitcast v867 : u32; + v869 = hir.bitcast v866 : u32; + v871 = arith.gt v869, v870 : i1; + v872 = arith.zext v871 : u32; + v873 = hir.bitcast v872 : i32; + v875 = arith.neq v873, v874 : i1; + v876 = cf.select v875, v866, v867 : i32; + builtin.ret v876; }; - private builtin.function @miden::active_account::get_id(v848: i32) { - ^block101(v848: i32): - v849, v850 = hir.exec @miden/active_account/get_id() : felt, felt - v851 = hir.bitcast v848 : u32; - v852 = hir.int_to_ptr v851 : ptr; - hir.store v852, v849; - v853 = arith.constant 4 : u32; - v854 = arith.add v851, v853 : u32 #[overflow = checked]; - v855 = hir.int_to_ptr v854 : ptr; - hir.store v855, v850; + private builtin.function @miden::active_account::get_id(v877: i32) { + ^block103(v877: i32): + v878, v879 = hir.exec @miden/active_account/get_id() : felt, felt + v880 = hir.bitcast v877 : u32; + v881 = hir.int_to_ptr v880 : ptr; + hir.store v881, v878; + v882 = arith.constant 4 : u32; + v883 = arith.add v880, v882 : u32 #[overflow = checked]; + v884 = hir.int_to_ptr v883 : ptr; + hir.store v884, v879; builtin.ret ; }; - private builtin.function @miden::active_note::get_inputs(v856: i32) -> i32 { - ^block105(v856: i32): - v857, v858 = hir.exec @miden/active_note/get_inputs(v856) : i32, i32 - builtin.ret v857; + private builtin.function @miden::active_note::get_inputs(v885: i32) -> i32 { + ^block107(v885: i32): + v886, v887 = hir.exec @miden/active_note/get_inputs(v885) : i32, i32 + builtin.ret v886; }; - private builtin.function @miden::active_note::get_assets(v860: i32) -> i32 { - ^block108(v860: i32): - v861, v862 = hir.exec @miden/active_note/get_assets(v860) : i32, i32 - builtin.ret v861; + private builtin.function @miden::active_note::get_assets(v889: i32) -> i32 { + ^block110(v889: i32): + v890, v891 = hir.exec @miden/active_note/get_assets(v889) : i32, i32 + builtin.ret v890; }; builtin.global_variable private @#__stack_pointer : i32 { @@ -1249,12 +1285,12 @@ builtin.component miden:base/note-script@1.0.0 { builtin.segment readonly @1048576 = 0x0073722e65746f6e5f6576697463612f73676e69646e69622f6372732f302e372e302d7379732d657361622d6e6564696d; - builtin.segment @1048628 = 0x0000002200000037000000300010000000000021000000190000003000100000000000010000000100000001; + builtin.segment @1048628 = 0x000000220000003d0000003000100000000000210000001f0000003000100000000000010000000100000001; }; - public builtin.function @run(v864: felt, v865: felt, v866: felt, v867: felt) { - ^block110(v864: felt, v865: felt, v866: felt, v867: felt): - hir.exec @miden:base/note-script@1.0.0/p2id/miden:base/note-script@1.0.0#run(v864, v865, v866, v867) + public builtin.function @run(v893: felt, v894: felt, v895: felt, v896: felt) { + ^block112(v893: felt, v894: felt, v895: felt, v896: felt): + hir.exec @miden:base/note-script@1.0.0/p2id/miden:base/note-script@1.0.0#run(v893, v894, v895, v896) builtin.ret ; }; }; \ No newline at end of file diff --git a/tests/integration/expected/examples/p2id.masm b/tests/integration/expected/examples/p2id.masm index 2d4ca9b16..6b155a525 100644 --- a/tests/integration/expected/examples/p2id.masm +++ b/tests/integration/expected/examples/p2id.masm @@ -16,7 +16,7 @@ proc init trace.240 exec.::intrinsics::mem::heap_init trace.252 - push.[12978692904443896846,474008017171175642,1341726231212769058,17601533792714095233] + push.[14053965066302455976,5462514524604701753,12455741123103170362,7752163708621042617] adv.push_mapval push.262144 push.6 @@ -943,6 +943,105 @@ proc intrinsics::mem::heap_base( nop end +@callconv("C") +proc alloc::vec::Vec::with_capacity(i32, i32) + push.1114208 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.16 + u32wrapping_sub + push.1114208 + dup.1 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.16 + push.8 + dup.2 + u32wrapping_add + dup.1 + movup.3 + swap.5 + movdn.3 + swap.2 + swap.1 + trace.240 + nop + exec.::miden:base/note-script@1.0.0::p2id::alloc::raw_vec::RawVecInner::with_capacity_in + trace.252 + nop + push.8 + dup.2 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.8 + dup.3 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + push.0 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + movup.2 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.16 + u32wrapping_add + push.1114208 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop +end + @callconv("C") proc alloc::raw_vec::RawVecInner::with_capacity_in( i32, @@ -1373,16 +1472,12 @@ proc miden_base_sys::bindings::active_note::get_assets( nop push.1048656 u32wrapping_add - push.16 - push.8 - dup.3 + push.4 + dup.2 u32wrapping_add - dup.1 - swap.2 - swap.1 trace.240 nop - exec.::miden:base/note-script@1.0.0::p2id::alloc::raw_vec::RawVecInner::with_capacity_in + exec.::miden:base/note-script@1.0.0::p2id::alloc::vec::Vec::with_capacity trace.252 nop push.8 @@ -1402,25 +1497,8 @@ proc miden_base_sys::bindings::active_note::get_assets( exec.::intrinsics::mem::load_sw trace.252 nop - push.12 - dup.2 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop push.2 - dup.1 + swap.1 swap.1 u32shr trace.240 @@ -1429,9 +1507,8 @@ proc miden_base_sys::bindings::active_note::get_assets( trace.252 nop push.8 - dup.5 - add - u32assert + dup.3 + u32wrapping_add push.4 dup.1 swap.1 @@ -1446,7 +1523,7 @@ proc miden_base_sys::bindings::active_note::get_assets( trace.252 nop push.4 - dup.4 + dup.1 add u32assert push.4 @@ -1459,10 +1536,10 @@ proc miden_base_sys::bindings::active_note::get_assets( swap.1 trace.240 nop - exec.::intrinsics::mem::store_sw + exec.::intrinsics::mem::load_dw trace.252 nop - movup.2 + movup.3 push.4 dup.1 swap.1 @@ -1473,7 +1550,7 @@ proc miden_base_sys::bindings::active_note::get_assets( swap.1 trace.240 nop - exec.::intrinsics::mem::store_sw + exec.::intrinsics::mem::store_dw trace.252 nop push.16 diff --git a/tests/integration/expected/examples/p2id.wat b/tests/integration/expected/examples/p2id.wat index fb01ef410..7c566cbe6 100644 --- a/tests/integration/expected/examples/p2id.wat +++ b/tests/integration/expected/examples/p2id.wat @@ -28,11 +28,12 @@ (type (;3;) (func (param i32 i32 i32))) (type (;4;) (func (param i32 i32 i32) (result i32))) (type (;5;) (func (result i32))) - (type (;6;) (func (param i32 i32 i32 i32))) - (type (;7;) (func (param i32))) - (type (;8;) (func (param f32 f32) (result i32))) - (type (;9;) (func (param i32 i32 i32 i32 i32))) - (type (;10;) (func (param i32) (result i32))) + (type (;6;) (func (param i32 i32))) + (type (;7;) (func (param i32 i32 i32 i32))) + (type (;8;) (func (param i32))) + (type (;9;) (func (param f32 f32) (result i32))) + (type (;10;) (func (param i32 i32 i32 i32 i32))) + (type (;11;) (func (param i32) (result i32))) (import "miden:basic-wallet/basic-wallet@0.1.0" "receive-asset" (func $p2id::bindings::miden::basic_wallet::basic_wallet::receive_asset::wit_import7 (;0;) (type 0))) (table (;0;) 2 2 funcref) (memory (;0;) 17) @@ -282,7 +283,35 @@ (func $intrinsics::mem::heap_base (;10;) (type 5) (result i32) unreachable ) - (func $alloc::raw_vec::RawVecInner::with_capacity_in (;11;) (type 6) (param i32 i32 i32 i32) + (func $alloc::vec::Vec::with_capacity (;11;) (type 6) (param i32 i32) + (local i32 i64) + global.get $__stack_pointer + i32.const 16 + i32.sub + local.tee 2 + global.set $__stack_pointer + local.get 2 + i32.const 8 + i32.add + i32.const 16 + i32.const 16 + local.get 1 + call $alloc::raw_vec::RawVecInner::with_capacity_in + local.get 2 + i64.load offset=8 + local.set 3 + local.get 0 + i32.const 0 + i32.store offset=8 + local.get 0 + local.get 3 + i64.store align=4 + local.get 2 + i32.const 16 + i32.add + global.set $__stack_pointer + ) + (func $alloc::raw_vec::RawVecInner::with_capacity_in (;12;) (type 7) (param i32 i32 i32 i32) (local i32) global.get $__stack_pointer i32.const 16 @@ -325,7 +354,7 @@ i32.add global.set $__stack_pointer ) - (func $miden_base_sys::bindings::account::get_id (;12;) (type 7) (param i32) + (func $miden_base_sys::bindings::account::get_id (;13;) (type 8) (param i32) (local i32) global.get $__stack_pointer i32.const 16 @@ -345,7 +374,7 @@ i32.add global.set $__stack_pointer ) - (func $miden_base_sys::bindings::active_note::get_inputs (;13;) (type 7) (param i32) + (func $miden_base_sys::bindings::active_note::get_inputs (;14;) (type 8) (param i32) (local i32 i32 i32) global.get $__stack_pointer i32.const 16 @@ -383,48 +412,42 @@ i32.add global.set $__stack_pointer ) - (func $miden_base_sys::bindings::active_note::get_assets (;14;) (type 7) (param i32) - (local i32 i32 i32) + (func $miden_base_sys::bindings::active_note::get_assets (;15;) (type 8) (param i32) + (local i32) global.get $__stack_pointer i32.const 16 i32.sub local.tee 1 global.set $__stack_pointer local.get 1 - i32.const 8 + i32.const 4 i32.add - i32.const 16 - i32.const 16 global.get $GOT.data.internal.__memory_base i32.const 1048656 i32.add - call $alloc::raw_vec::RawVecInner::with_capacity_in - local.get 1 - i32.load offset=8 - local.set 2 + call $alloc::vec::Vec::with_capacity local.get 0 + i32.const 8 + i32.add local.get 1 - i32.load offset=12 - local.tee 3 + i32.load offset=8 i32.const 2 i32.shr_u call $miden::active_note::get_assets - i32.store offset=8 - local.get 0 - local.get 3 - i32.store offset=4 - local.get 0 - local.get 2 i32.store + local.get 0 + local.get 1 + i64.load offset=4 align=4 + i64.store align=4 local.get 1 i32.const 16 i32.add global.set $__stack_pointer ) - (func $intrinsics::felt::eq (;15;) (type 8) (param f32 f32) (result i32) + (func $intrinsics::felt::eq (;16;) (type 9) (param f32 f32) (result i32) unreachable ) - (func $alloc::raw_vec::RawVecInner::deallocate (;16;) (type 3) (param i32 i32 i32) + (func $alloc::raw_vec::RawVecInner::deallocate (;17;) (type 3) (param i32 i32 i32) (local i32) global.get $__stack_pointer i32.const 16 @@ -456,7 +479,7 @@ i32.add global.set $__stack_pointer ) - (func $alloc::raw_vec::RawVecInner::try_allocate_in (;17;) (type 9) (param i32 i32 i32 i32 i32) + (func $alloc::raw_vec::RawVecInner::try_allocate_in (;18;) (type 10) (param i32 i32 i32 i32 i32) (local i32 i64) global.get $__stack_pointer i32.const 16 @@ -568,7 +591,7 @@ i32.add global.set $__stack_pointer ) - (func $::allocate (;18;) (type 3) (param i32 i32 i32) + (func $::allocate (;19;) (type 3) (param i32 i32 i32) (local i32) global.get $__stack_pointer i32.const 16 @@ -597,7 +620,7 @@ i32.add global.set $__stack_pointer ) - (func $alloc::alloc::Global::alloc_impl (;19;) (type 6) (param i32 i32 i32 i32) + (func $alloc::alloc::Global::alloc_impl (;20;) (type 7) (param i32 i32 i32 i32) block ;; label = @1 local.get 2 i32.eqz @@ -624,7 +647,7 @@ local.get 1 i32.store ) - (func $alloc::raw_vec::RawVecInner::current_memory (;20;) (type 6) (param i32 i32 i32 i32) + (func $alloc::raw_vec::RawVecInner::current_memory (;21;) (type 7) (param i32 i32 i32 i32) (local i32 i32 i32) i32.const 0 local.set 4 @@ -659,7 +682,7 @@ local.get 4 i32.store ) - (func $::deallocate (;21;) (type 3) (param i32 i32 i32) + (func $::deallocate (;22;) (type 3) (param i32 i32 i32) block ;; label = @1 local.get 2 i32.eqz @@ -670,10 +693,10 @@ call $__rustc::__rust_dealloc end ) - (func $alloc::raw_vec::handle_error (;22;) (type 3) (param i32 i32 i32) + (func $alloc::raw_vec::handle_error (;23;) (type 3) (param i32 i32 i32) unreachable ) - (func $core::ptr::alignment::Alignment::max (;23;) (type 2) (param i32 i32) (result i32) + (func $core::ptr::alignment::Alignment::max (;24;) (type 2) (param i32 i32) (result i32) local.get 0 local.get 1 local.get 0 @@ -681,17 +704,17 @@ i32.gt_u select ) - (func $miden::active_account::get_id (;24;) (type 7) (param i32) + (func $miden::active_account::get_id (;25;) (type 8) (param i32) unreachable ) - (func $miden::active_note::get_inputs (;25;) (type 10) (param i32) (result i32) + (func $miden::active_note::get_inputs (;26;) (type 11) (param i32) (result i32) unreachable ) - (func $miden::active_note::get_assets (;26;) (type 10) (param i32) (result i32) + (func $miden::active_note::get_assets (;27;) (type 11) (param i32) (result i32) unreachable ) (data $.rodata (;0;) (i32.const 1048576) "miden-base-sys-0.7.0/src/bindings/active_note.rs\00") - (data $.data (;1;) (i32.const 1048628) "\01\00\00\00\01\00\00\00\01\00\00\00\00\00\10\000\00\00\00\19\00\00\00!\00\00\00\00\00\10\000\00\00\007\00\00\00\22\00\00\00") + (data $.data (;1;) (i32.const 1048628) "\01\00\00\00\01\00\00\00\01\00\00\00\00\00\10\000\00\00\00\1f\00\00\00!\00\00\00\00\00\10\000\00\00\00=\00\00\00\22\00\00\00") ) (alias export 0 "word" (type (;3;))) (alias export 1 "receive-asset" (func (;0;))) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_asset_build_fungible_asset_binding.hir b/tests/integration/expected/rust_sdk/rust_sdk_account_asset_build_fungible_asset_binding.hir new file mode 100644 index 000000000..6fe709c9c --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_asset_build_fungible_asset_binding.hir @@ -0,0 +1,356 @@ +builtin.component miden:rust-sdk-account-asset-build-fungible-asset-binding/rust-sdk-account-asset-build-fungible-asset-binding@0.0.1 { + builtin.module public @rust_sdk_account_asset_build_fungible_asset_binding { + private builtin.function @__wasm_call_ctors() { + ^block5: + builtin.ret ; + }; + + private builtin.function @rust_sdk_account_asset_build_fungible_asset_binding::bindings::__link_custom_section_describing_imports() { + ^block7: + builtin.ret ; + }; + + private builtin.function @miden:rust-sdk-account-asset-build-fungible-asset-binding/rust-sdk-account-asset-build-fungible-asset-binding@0.0.1#binding() -> i32 { + ^block9: + v2 = builtin.global_symbol @miden:rust-sdk-account-asset-build-fungible-asset-binding/rust-sdk-account-asset-build-fungible-asset-binding@0.0.1/rust_sdk_account_asset_build_fungible_asset_binding/__stack_pointer : ptr + v3 = hir.bitcast v2 : ptr; + v4 = hir.load v3 : i32; + v5 = arith.constant 16 : i32; + v6 = arith.sub v4, v5 : i32 #[overflow = wrapping]; + v7 = builtin.global_symbol @miden:rust-sdk-account-asset-build-fungible-asset-binding/rust-sdk-account-asset-build-fungible-asset-binding@0.0.1/rust_sdk_account_asset_build_fungible_asset_binding/__stack_pointer : ptr + v8 = hir.bitcast v7 : ptr; + hir.store v8, v6; + hir.exec @miden:rust-sdk-account-asset-build-fungible-asset-binding/rust-sdk-account-asset-build-fungible-asset-binding@0.0.1/rust_sdk_account_asset_build_fungible_asset_binding/wit_bindgen::rt::run_ctors_once() + v9 = arith.constant 1 : i32; + v10 = hir.exec @miden:rust-sdk-account-asset-build-fungible-asset-binding/rust-sdk-account-asset-build-fungible-asset-binding@0.0.1/rust_sdk_account_asset_build_fungible_asset_binding/intrinsics::felt::from_u32(v9) : felt + v1 = arith.constant 0 : i32; + v12 = hir.exec @miden:rust-sdk-account-asset-build-fungible-asset-binding/rust-sdk-account-asset-build-fungible-asset-binding@0.0.1/rust_sdk_account_asset_build_fungible_asset_binding/intrinsics::felt::from_u32(v1) : felt + v13 = arith.constant 10 : i32; + v14 = hir.exec @miden:rust-sdk-account-asset-build-fungible-asset-binding/rust-sdk-account-asset-build-fungible-asset-binding@0.0.1/rust_sdk_account_asset_build_fungible_asset_binding/intrinsics::felt::from_u32(v13) : felt + hir.exec @miden:rust-sdk-account-asset-build-fungible-asset-binding/rust-sdk-account-asset-build-fungible-asset-binding@0.0.1/rust_sdk_account_asset_build_fungible_asset_binding/miden_base_sys::bindings::asset::build_fungible_asset(v6, v10, v12, v14) + v15 = builtin.global_symbol @miden:rust-sdk-account-asset-build-fungible-asset-binding/rust-sdk-account-asset-build-fungible-asset-binding@0.0.1/rust_sdk_account_asset_build_fungible_asset_binding/GOT.data.internal.__memory_base : ptr + v16 = hir.bitcast v15 : ptr; + v17 = hir.load v16 : i32; + v18 = arith.constant 1048584 : i32; + v19 = arith.add v17, v18 : i32 #[overflow = wrapping]; + v21 = arith.constant 8 : u32; + v20 = hir.bitcast v6 : u32; + v22 = arith.add v20, v21 : u32 #[overflow = checked]; + v259 = arith.constant 8 : u32; + v24 = arith.mod v22, v259 : u32; + hir.assertz v24 #[code = 250]; + v25 = hir.int_to_ptr v22 : ptr; + v26 = hir.load v25 : i64; + v258 = arith.constant 8 : u32; + v27 = hir.bitcast v19 : u32; + v29 = arith.add v27, v258 : u32 #[overflow = checked]; + v30 = arith.constant 4 : u32; + v31 = arith.mod v29, v30 : u32; + hir.assertz v31 #[code = 250]; + v32 = hir.int_to_ptr v29 : ptr; + hir.store v32, v26; + v33 = hir.bitcast v6 : u32; + v257 = arith.constant 8 : u32; + v35 = arith.mod v33, v257 : u32; + hir.assertz v35 #[code = 250]; + v36 = hir.int_to_ptr v33 : ptr; + v37 = hir.load v36 : i64; + v38 = hir.bitcast v19 : u32; + v256 = arith.constant 4 : u32; + v40 = arith.mod v38, v256 : u32; + hir.assertz v40 #[code = 250]; + v41 = hir.int_to_ptr v38 : ptr; + hir.store v41, v37; + v255 = arith.constant 16 : i32; + v43 = arith.add v6, v255 : i32 #[overflow = wrapping]; + v44 = builtin.global_symbol @miden:rust-sdk-account-asset-build-fungible-asset-binding/rust-sdk-account-asset-build-fungible-asset-binding@0.0.1/rust_sdk_account_asset_build_fungible_asset_binding/__stack_pointer : ptr + v45 = hir.bitcast v44 : ptr; + hir.store v45, v43; + builtin.ret v19; + }; + + private builtin.function @wit_bindgen::rt::run_ctors_once() { + ^block11: + v47 = builtin.global_symbol @miden:rust-sdk-account-asset-build-fungible-asset-binding/rust-sdk-account-asset-build-fungible-asset-binding@0.0.1/rust_sdk_account_asset_build_fungible_asset_binding/GOT.data.internal.__memory_base : ptr + v48 = hir.bitcast v47 : ptr; + v49 = hir.load v48 : i32; + v50 = arith.constant 1048600 : i32; + v51 = arith.add v49, v50 : i32 #[overflow = wrapping]; + v52 = hir.bitcast v51 : u32; + v53 = hir.int_to_ptr v52 : ptr; + v54 = hir.load v53 : u8; + v46 = arith.constant 0 : i32; + v55 = arith.zext v54 : u32; + v56 = hir.bitcast v55 : i32; + v58 = arith.neq v56, v46 : i1; + scf.if v58{ + ^block13: + scf.yield ; + } else { + ^block14: + v59 = builtin.global_symbol @miden:rust-sdk-account-asset-build-fungible-asset-binding/rust-sdk-account-asset-build-fungible-asset-binding@0.0.1/rust_sdk_account_asset_build_fungible_asset_binding/GOT.data.internal.__memory_base : ptr + v60 = hir.bitcast v59 : ptr; + v61 = hir.load v60 : i32; + hir.exec @miden:rust-sdk-account-asset-build-fungible-asset-binding/rust-sdk-account-asset-build-fungible-asset-binding@0.0.1/rust_sdk_account_asset_build_fungible_asset_binding/__wasm_call_ctors() + v261 = arith.constant 1 : u8; + v263 = arith.constant 1048600 : i32; + v63 = arith.add v61, v263 : i32 #[overflow = wrapping]; + v67 = hir.bitcast v63 : u32; + v68 = hir.int_to_ptr v67 : ptr; + hir.store v68, v261; + scf.yield ; + }; + builtin.ret ; + }; + + private builtin.function @miden_base_sys::bindings::asset::build_fungible_asset(v69: i32, v70: felt, v71: felt, v72: felt) { + ^block15(v69: i32, v70: felt, v71: felt, v72: felt): + v74 = builtin.global_symbol @miden:rust-sdk-account-asset-build-fungible-asset-binding/rust-sdk-account-asset-build-fungible-asset-binding@0.0.1/rust_sdk_account_asset_build_fungible_asset_binding/__stack_pointer : ptr + v75 = hir.bitcast v74 : ptr; + v76 = hir.load v75 : i32; + v77 = arith.constant 32 : i32; + v78 = arith.sub v76, v77 : i32 #[overflow = wrapping]; + v79 = builtin.global_symbol @miden:rust-sdk-account-asset-build-fungible-asset-binding/rust-sdk-account-asset-build-fungible-asset-binding@0.0.1/rust_sdk_account_asset_build_fungible_asset_binding/__stack_pointer : ptr + v80 = hir.bitcast v79 : ptr; + hir.store v80, v78; + hir.exec @miden:rust-sdk-account-asset-build-fungible-asset-binding/rust-sdk-account-asset-build-fungible-asset-binding@0.0.1/rust_sdk_account_asset_build_fungible_asset_binding/miden::asset::build_fungible_asset(v70, v71, v72, v78) + v82 = arith.constant 8 : u32; + v81 = hir.bitcast v78 : u32; + v83 = arith.add v81, v82 : u32 #[overflow = checked]; + v268 = arith.constant 8 : u32; + v85 = arith.mod v83, v268 : u32; + hir.assertz v85 #[code = 250]; + v86 = hir.int_to_ptr v83 : ptr; + v87 = hir.load v86 : i64; + v89 = arith.constant 24 : u32; + v88 = hir.bitcast v78 : u32; + v90 = arith.add v88, v89 : u32 #[overflow = checked]; + v267 = arith.constant 8 : u32; + v92 = arith.mod v90, v267 : u32; + hir.assertz v92 #[code = 250]; + v93 = hir.int_to_ptr v90 : ptr; + hir.store v93, v87; + v94 = hir.bitcast v78 : u32; + v266 = arith.constant 8 : u32; + v96 = arith.mod v94, v266 : u32; + hir.assertz v96 #[code = 250]; + v97 = hir.int_to_ptr v94 : ptr; + v98 = hir.load v97 : i64; + v100 = arith.constant 16 : u32; + v99 = hir.bitcast v78 : u32; + v101 = arith.add v99, v100 : u32 #[overflow = checked]; + v265 = arith.constant 8 : u32; + v103 = arith.mod v101, v265 : u32; + hir.assertz v103 #[code = 250]; + v104 = hir.int_to_ptr v101 : ptr; + hir.store v104, v98; + v105 = arith.constant 16 : i32; + v106 = arith.add v78, v105 : i32 #[overflow = wrapping]; + hir.exec @miden:rust-sdk-account-asset-build-fungible-asset-binding/rust-sdk-account-asset-build-fungible-asset-binding@0.0.1/rust_sdk_account_asset_build_fungible_asset_binding/miden_stdlib_sys::intrinsics::word::Word::reverse(v69, v106) + v264 = arith.constant 32 : i32; + v108 = arith.add v78, v264 : i32 #[overflow = wrapping]; + v109 = builtin.global_symbol @miden:rust-sdk-account-asset-build-fungible-asset-binding/rust-sdk-account-asset-build-fungible-asset-binding@0.0.1/rust_sdk_account_asset_build_fungible_asset_binding/__stack_pointer : ptr + v110 = hir.bitcast v109 : ptr; + hir.store v110, v108; + builtin.ret ; + }; + + private builtin.function @miden_stdlib_sys::intrinsics::word::Word::reverse(v111: i32, v112: i32) { + ^block17(v111: i32, v112: i32): + v115 = builtin.global_symbol @miden:rust-sdk-account-asset-build-fungible-asset-binding/rust-sdk-account-asset-build-fungible-asset-binding@0.0.1/rust_sdk_account_asset_build_fungible_asset_binding/__stack_pointer : ptr + v116 = hir.bitcast v115 : ptr; + v117 = hir.load v116 : i32; + v118 = arith.constant 16 : i32; + v119 = arith.sub v117, v118 : i32 #[overflow = wrapping]; + v121 = arith.constant 8 : u32; + v120 = hir.bitcast v112 : u32; + v122 = arith.add v120, v121 : u32 #[overflow = checked]; + v355 = arith.constant 8 : u32; + v124 = arith.mod v122, v355 : u32; + hir.assertz v124 #[code = 250]; + v125 = hir.int_to_ptr v122 : ptr; + v126 = hir.load v125 : i64; + v354 = arith.constant 8 : u32; + v127 = hir.bitcast v119 : u32; + v129 = arith.add v127, v354 : u32 #[overflow = checked]; + v130 = arith.constant 4 : u32; + v131 = arith.mod v129, v130 : u32; + hir.assertz v131 #[code = 250]; + v132 = hir.int_to_ptr v129 : ptr; + hir.store v132, v126; + v133 = hir.bitcast v112 : u32; + v353 = arith.constant 8 : u32; + v135 = arith.mod v133, v353 : u32; + hir.assertz v135 #[code = 250]; + v136 = hir.int_to_ptr v133 : ptr; + v137 = hir.load v136 : i64; + v138 = hir.bitcast v119 : u32; + v352 = arith.constant 4 : u32; + v140 = arith.mod v138, v352 : u32; + hir.assertz v140 #[code = 250]; + v141 = hir.int_to_ptr v138 : ptr; + hir.store v141, v137; + v142 = arith.constant 12 : i32; + v143 = arith.add v119, v142 : i32 #[overflow = wrapping]; + v113 = arith.constant 0 : i32; + v323, v324, v325, v326, v327, v328 = scf.while v113, v119, v143, v111 : i32, i32, i32, i32, i32, i32 { + ^block39(v329: i32, v330: i32, v331: i32, v332: i32): + v351 = arith.constant 0 : i32; + v146 = arith.constant 8 : i32; + v147 = arith.eq v329, v146 : i1; + v148 = arith.zext v147 : u32; + v149 = hir.bitcast v148 : i32; + v151 = arith.neq v149, v351 : i1; + v317, v318 = scf.if v151 : i32, i32 { + ^block38: + v277 = ub.poison i32 : i32; + scf.yield v277, v277; + } else { + ^block22: + v153 = arith.add v330, v329 : i32 #[overflow = wrapping]; + v154 = hir.bitcast v153 : u32; + v350 = arith.constant 4 : u32; + v156 = arith.mod v154, v350 : u32; + hir.assertz v156 #[code = 250]; + v157 = hir.int_to_ptr v154 : ptr; + v158 = hir.load v157 : felt; + v160 = hir.bitcast v331 : u32; + v349 = arith.constant 4 : u32; + v162 = arith.mod v160, v349 : u32; + hir.assertz v162 #[code = 250]; + v163 = hir.int_to_ptr v160 : ptr; + v164 = hir.load v163 : i32; + v165 = hir.bitcast v153 : u32; + v348 = arith.constant 4 : u32; + v167 = arith.mod v165, v348 : u32; + hir.assertz v167 #[code = 250]; + v168 = hir.int_to_ptr v165 : ptr; + hir.store v168, v164; + v169 = hir.bitcast v331 : u32; + v347 = arith.constant 4 : u32; + v171 = arith.mod v169, v347 : u32; + hir.assertz v171 #[code = 250]; + v172 = hir.int_to_ptr v169 : ptr; + hir.store v172, v158; + v175 = arith.constant -4 : i32; + v176 = arith.add v331, v175 : i32 #[overflow = wrapping]; + v173 = arith.constant 4 : i32; + v174 = arith.add v329, v173 : i32 #[overflow = wrapping]; + scf.yield v174, v176; + }; + v345 = ub.poison i32 : i32; + v320 = cf.select v151, v345, v332 : i32; + v346 = ub.poison i32 : i32; + v319 = cf.select v151, v346, v330 : i32; + v276 = arith.constant 1 : u32; + v269 = arith.constant 0 : u32; + v322 = cf.select v151, v269, v276 : u32; + v310 = arith.trunc v322 : i1; + scf.condition v310, v317, v319, v318, v320, v330, v332; + } do { + ^block40(v333: i32, v334: i32, v335: i32, v336: i32, v337: i32, v338: i32): + scf.yield v333, v334, v335, v336; + }; + v344 = arith.constant 8 : u32; + v178 = hir.bitcast v327 : u32; + v180 = arith.add v178, v344 : u32 #[overflow = checked]; + v343 = arith.constant 4 : u32; + v182 = arith.mod v180, v343 : u32; + hir.assertz v182 #[code = 250]; + v183 = hir.int_to_ptr v180 : ptr; + v184 = hir.load v183 : i64; + v342 = arith.constant 8 : u32; + v185 = hir.bitcast v328 : u32; + v187 = arith.add v185, v342 : u32 #[overflow = checked]; + v341 = arith.constant 8 : u32; + v189 = arith.mod v187, v341 : u32; + hir.assertz v189 #[code = 250]; + v190 = hir.int_to_ptr v187 : ptr; + hir.store v190, v184; + v191 = hir.bitcast v327 : u32; + v340 = arith.constant 4 : u32; + v193 = arith.mod v191, v340 : u32; + hir.assertz v193 #[code = 250]; + v194 = hir.int_to_ptr v191 : ptr; + v195 = hir.load v194 : i64; + v196 = hir.bitcast v328 : u32; + v339 = arith.constant 8 : u32; + v198 = arith.mod v196, v339 : u32; + hir.assertz v198 #[code = 250]; + v199 = hir.int_to_ptr v196 : ptr; + hir.store v199, v195; + builtin.ret ; + }; + + private builtin.function @intrinsics::felt::from_u32(v200: i32) -> felt { + ^block23(v200: i32): + v201 = hir.bitcast v200 : felt; + builtin.ret v201; + }; + + private builtin.function @miden::asset::build_fungible_asset(v203: felt, v204: felt, v205: felt, v206: i32) { + ^block25(v203: felt, v204: felt, v205: felt, v206: i32): + v207, v208, v209, v210 = hir.exec @miden/asset/build_fungible_asset(v203, v204, v205) : felt, felt, felt, felt + v211 = hir.bitcast v206 : u32; + v212 = hir.int_to_ptr v211 : ptr; + hir.store v212, v207; + v213 = arith.constant 4 : u32; + v214 = arith.add v211, v213 : u32 #[overflow = checked]; + v215 = hir.int_to_ptr v214 : ptr; + hir.store v215, v208; + v216 = arith.constant 8 : u32; + v217 = arith.add v211, v216 : u32 #[overflow = checked]; + v218 = hir.int_to_ptr v217 : ptr; + hir.store v218, v209; + v219 = arith.constant 12 : u32; + v220 = arith.add v211, v219 : u32 #[overflow = checked]; + v221 = hir.int_to_ptr v220 : ptr; + hir.store v221, v210; + builtin.ret ; + }; + + builtin.global_variable private @#__stack_pointer : i32 { + builtin.ret_imm 1048576; + }; + + builtin.global_variable private @#GOT.data.internal.__memory_base : i32 { + builtin.ret_imm 0; + }; + + builtin.segment @1048576 = 0x0000000100000001; + }; + + public builtin.function @binding() -> felt, felt, felt, felt { + ^block29: + v222 = hir.exec @miden:rust-sdk-account-asset-build-fungible-asset-binding/rust-sdk-account-asset-build-fungible-asset-binding@0.0.1/rust_sdk_account_asset_build_fungible_asset_binding/miden:rust-sdk-account-asset-build-fungible-asset-binding/rust-sdk-account-asset-build-fungible-asset-binding@0.0.1#binding() : i32 + v361 = arith.constant 0 : i32; + v223 = arith.constant 0 : i32; + v224 = arith.add v222, v223 : i32 #[overflow = unchecked]; + v226 = arith.add v224, v361 : i32 #[overflow = unchecked]; + v359 = arith.constant 0 : i32; + v360 = arith.constant 0 : i32; + v228 = arith.add v226, v360 : i32 #[overflow = unchecked]; + v230 = arith.add v228, v359 : i32 #[overflow = unchecked]; + v231 = hir.int_to_ptr v230 : ptr; + v232 = hir.load v231 : felt; + v358 = arith.constant 0 : i32; + v233 = arith.constant 4 : i32; + v234 = arith.add v226, v233 : i32 #[overflow = unchecked]; + v236 = arith.add v234, v358 : i32 #[overflow = unchecked]; + v237 = hir.int_to_ptr v236 : ptr; + v238 = hir.load v237 : felt; + v357 = arith.constant 0 : i32; + v239 = arith.constant 8 : i32; + v240 = arith.add v226, v239 : i32 #[overflow = unchecked]; + v242 = arith.add v240, v357 : i32 #[overflow = unchecked]; + v243 = hir.int_to_ptr v242 : ptr; + v244 = hir.load v243 : felt; + v356 = arith.constant 0 : i32; + v245 = arith.constant 12 : i32; + v246 = arith.add v226, v245 : i32 #[overflow = unchecked]; + v248 = arith.add v246, v356 : i32 #[overflow = unchecked]; + v249 = hir.int_to_ptr v248 : ptr; + v250 = hir.load v249 : felt; + builtin.ret v232, v238, v244, v250; + }; +}; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_asset_build_fungible_asset_binding.masm b/tests/integration/expected/rust_sdk/rust_sdk_account_asset_build_fungible_asset_binding.masm new file mode 100644 index 000000000..50fefd5a6 --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_asset_build_fungible_asset_binding.masm @@ -0,0 +1,774 @@ +# mod miden:rust-sdk-account-asset-build-fungible-asset-binding/rust-sdk-account-asset-build-fungible-asset-binding@0.0.1 + +@callconv("canon-lift") +pub proc binding( + +) -> (felt, felt, felt, felt) + exec.::miden:rust-sdk-account-asset-build-fungible-asset-binding/rust-sdk-account-asset-build-fungible-asset-binding@0.0.1::init + trace.240 + nop + exec.::miden:rust-sdk-account-asset-build-fungible-asset-binding/rust-sdk-account-asset-build-fungible-asset-binding@0.0.1::rust_sdk_account_asset_build_fungible_asset_binding::miden:rust-sdk-account-asset-build-fungible-asset-binding/rust-sdk-account-asset-build-fungible-asset-binding@0.0.1#binding + trace.252 + nop + push.0 + push.0 + movup.2 + u32wrapping_add + u32wrapping_add + push.0 + push.0 + dup.2 + u32wrapping_add + u32wrapping_add + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.0 + push.4 + dup.3 + u32wrapping_add + u32wrapping_add + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.0 + push.8 + dup.4 + u32wrapping_add + u32wrapping_add + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.0 + push.12 + movup.5 + u32wrapping_add + u32wrapping_add + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + movdn.3 + swap.2 + exec.::std::sys::truncate_stack +end + +proc init + push.1179648 + trace.240 + exec.::intrinsics::mem::heap_init + trace.252 + push.[7028007876379170725,18060021366771303825,13412364500725888848,14178532912296021363] + adv.push_mapval + push.262144 + push.1 + trace.240 + exec.::std::mem::pipe_preimage_to_memory + trace.252 + drop + push.1048576 + u32assert + mem_store.278536 + push.0 + u32assert + mem_store.278537 +end + +# mod miden:rust-sdk-account-asset-build-fungible-asset-binding/rust-sdk-account-asset-build-fungible-asset-binding@0.0.1::rust_sdk_account_asset_build_fungible_asset_binding + +@callconv("C") +proc __wasm_call_ctors( + +) + nop +end + +@callconv("C") +proc rust_sdk_account_asset_build_fungible_asset_binding::bindings::__link_custom_section_describing_imports( + +) + nop +end + +@callconv("C") +proc miden:rust-sdk-account-asset-build-fungible-asset-binding/rust-sdk-account-asset-build-fungible-asset-binding@0.0.1#binding( + +) -> i32 + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.16 + u32wrapping_sub + push.1114144 + dup.1 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + trace.240 + nop + exec.::miden:rust-sdk-account-asset-build-fungible-asset-binding/rust-sdk-account-asset-build-fungible-asset-binding@0.0.1::rust_sdk_account_asset_build_fungible_asset_binding::wit_bindgen::rt::run_ctors_once + trace.252 + nop + push.1 + trace.240 + nop + exec.::miden:rust-sdk-account-asset-build-fungible-asset-binding/rust-sdk-account-asset-build-fungible-asset-binding@0.0.1::rust_sdk_account_asset_build_fungible_asset_binding::intrinsics::felt::from_u32 + trace.252 + nop + push.0 + trace.240 + nop + exec.::miden:rust-sdk-account-asset-build-fungible-asset-binding/rust-sdk-account-asset-build-fungible-asset-binding@0.0.1::rust_sdk_account_asset_build_fungible_asset_binding::intrinsics::felt::from_u32 + trace.252 + nop + push.10 + trace.240 + nop + exec.::miden:rust-sdk-account-asset-build-fungible-asset-binding/rust-sdk-account-asset-build-fungible-asset-binding@0.0.1::rust_sdk_account_asset_build_fungible_asset_binding::intrinsics::felt::from_u32 + trace.252 + nop + dup.3 + swap.1 + swap.3 + swap.1 + trace.240 + nop + exec.::miden:rust-sdk-account-asset-build-fungible-asset-binding/rust-sdk-account-asset-build-fungible-asset-binding@0.0.1::rust_sdk_account_asset_build_fungible_asset_binding::miden_base_sys::bindings::asset::build_fungible_asset + trace.252 + nop + push.1114148 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.1048584 + u32wrapping_add + push.8 + dup.2 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.8 + dup.3 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + dup.1 + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + dup.2 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.16 + movup.2 + u32wrapping_add + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop +end + +@callconv("C") +proc wit_bindgen::rt::run_ctors_once( + +) + push.1114148 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.1048600 + u32wrapping_add + u32divmod.4 + swap.1 + swap.1 + dup.1 + mem_load + swap.1 + push.8 + u32wrapping_mul + u32shr + swap.1 + drop + push.255 + u32and + push.0 + swap.1 + neq + if.true + nop + else + push.1114148 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + trace.240 + nop + exec.::miden:rust-sdk-account-asset-build-fungible-asset-binding/rust-sdk-account-asset-build-fungible-asset-binding@0.0.1::rust_sdk_account_asset_build_fungible_asset_binding::__wasm_call_ctors + trace.252 + nop + push.1 + push.1048600 + movup.2 + u32wrapping_add + u32divmod.4 + swap.1 + dup.0 + mem_load + dup.2 + push.8 + u32wrapping_mul + push.255 + swap.1 + u32shl + u32not + swap.1 + u32and + movup.3 + movup.3 + push.8 + u32wrapping_mul + u32shl + u32or + swap.1 + mem_store + end +end + +@callconv("C") +proc miden_base_sys::bindings::asset::build_fungible_asset( + i32, + felt, + felt, + felt +) + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.32 + u32wrapping_sub + push.1114144 + dup.1 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + dup.0 + movup.2 + swap.5 + movdn.2 + swap.1 + swap.4 + swap.1 + swap.3 + trace.240 + nop + exec.::miden:rust-sdk-account-asset-build-fungible-asset-binding/rust-sdk-account-asset-build-fungible-asset-binding@0.0.1::rust_sdk_account_asset_build_fungible_asset_binding::miden::asset::build_fungible_asset + trace.252 + nop + push.8 + dup.1 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.24 + dup.3 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + dup.0 + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.16 + dup.3 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.16 + dup.1 + u32wrapping_add + movup.2 + trace.240 + nop + exec.::miden:rust-sdk-account-asset-build-fungible-asset-binding/rust-sdk-account-asset-build-fungible-asset-binding@0.0.1::rust_sdk_account_asset_build_fungible_asset_binding::miden_stdlib_sys::intrinsics::word::Word::reverse + trace.252 + nop + push.32 + u32wrapping_add + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop +end + +@callconv("C") +proc miden_stdlib_sys::intrinsics::word::Word::reverse( + i32, + i32 +) + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.16 + u32wrapping_sub + push.8 + dup.3 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.8 + dup.3 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + movup.2 + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + dup.2 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.12 + dup.1 + u32wrapping_add + push.0 + movup.2 + swap.1 + push.1 + while.true + push.0 + push.8 + dup.2 + eq + neq + dup.0 + if.true + movup.3 + movup.2 + drop + drop + push.3735929054 + dup.0 + else + dup.2 + dup.2 + u32wrapping_add + dup.0 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + dup.5 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + movup.2 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + dup.4 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.4294967292 + movup.4 + u32wrapping_add + push.4 + movup.3 + u32wrapping_add + end + push.3735929054 + dup.3 + dup.6 + swap.2 + swap.1 + cdrop + push.3735929054 + dup.4 + dup.6 + swap.2 + swap.1 + cdrop + push.1 + push.0 + movup.6 + cdrop + push.1 + u32and + swap.1 + swap.2 + swap.4 + swap.3 + swap.1 + if.true + movup.4 + drop + movup.4 + drop + push.1 + else + push.0 + end + end + drop + drop + drop + drop + push.8 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.8 + dup.4 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + movup.2 + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop +end + +@callconv("C") +proc intrinsics::felt::from_u32(i32) -> felt + nop +end + +@callconv("C") +proc miden::asset::build_fungible_asset(felt, felt, felt, i32) + trace.240 + nop + exec.::miden::asset::build_fungible_asset + trace.252 + nop + movup.4 + dup.0 + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.4 + dup.1 + add + u32assert + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.8 + dup.1 + add + u32assert + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.12 + add + u32assert + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop +end + diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_asset_build_fungible_asset_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_account_asset_build_fungible_asset_binding.wat new file mode 100644 index 000000000..9b631392f --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_asset_build_fungible_asset_binding.wat @@ -0,0 +1,211 @@ +(component + (type (;0;) + (instance + (type (;0;) (record (field "inner" f32))) + (export (;1;) "felt" (type (eq 0))) + (type (;2;) (tuple 1 1 1 1)) + (type (;3;) (record (field "inner" 2))) + (export (;4;) "word" (type (eq 3))) + (type (;5;) (record (field "inner" 4))) + (export (;6;) "asset" (type (eq 5))) + ) + ) + (import "miden:base/core-types@1.0.0" (instance (;0;) (type 0))) + (core module (;0;) + (type (;0;) (func)) + (type (;1;) (func (result i32))) + (type (;2;) (func (param i32 f32 f32 f32))) + (type (;3;) (func (param i32 i32))) + (type (;4;) (func (param i32) (result f32))) + (type (;5;) (func (param f32 f32 f32 i32))) + (table (;0;) 2 2 funcref) + (memory (;0;) 17) + (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) + (global $GOT.data.internal.__memory_base (;1;) i32 i32.const 0) + (export "memory" (memory 0)) + (export "miden:rust-sdk-account-asset-build-fungible-asset-binding/rust-sdk-account-asset-build-fungible-asset-binding@0.0.1#binding" (func $miden:rust-sdk-account-asset-build-fungible-asset-binding/rust-sdk-account-asset-build-fungible-asset-binding@0.0.1#binding)) + (elem (;0;) (i32.const 1) func $rust_sdk_account_asset_build_fungible_asset_binding::bindings::__link_custom_section_describing_imports) + (func $__wasm_call_ctors (;0;) (type 0)) + (func $rust_sdk_account_asset_build_fungible_asset_binding::bindings::__link_custom_section_describing_imports (;1;) (type 0)) + (func $miden:rust-sdk-account-asset-build-fungible-asset-binding/rust-sdk-account-asset-build-fungible-asset-binding@0.0.1#binding (;2;) (type 1) (result i32) + (local i32 i32) + global.get $__stack_pointer + i32.const 16 + i32.sub + local.tee 0 + global.set $__stack_pointer + call $wit_bindgen::rt::run_ctors_once + local.get 0 + i32.const 1 + call $intrinsics::felt::from_u32 + i32.const 0 + call $intrinsics::felt::from_u32 + i32.const 10 + call $intrinsics::felt::from_u32 + call $miden_base_sys::bindings::asset::build_fungible_asset + global.get $GOT.data.internal.__memory_base + i32.const 1048584 + i32.add + local.tee 1 + local.get 0 + i64.load offset=8 + i64.store offset=8 align=4 + local.get 1 + local.get 0 + i64.load + i64.store align=4 + local.get 0 + i32.const 16 + i32.add + global.set $__stack_pointer + local.get 1 + ) + (func $wit_bindgen::rt::run_ctors_once (;3;) (type 0) + (local i32) + block ;; label = @1 + global.get $GOT.data.internal.__memory_base + i32.const 1048600 + i32.add + i32.load8_u + br_if 0 (;@1;) + global.get $GOT.data.internal.__memory_base + local.set 0 + call $__wasm_call_ctors + local.get 0 + i32.const 1048600 + i32.add + i32.const 1 + i32.store8 + end + ) + (func $miden_base_sys::bindings::asset::build_fungible_asset (;4;) (type 2) (param i32 f32 f32 f32) + (local i32) + global.get $__stack_pointer + i32.const 32 + i32.sub + local.tee 4 + global.set $__stack_pointer + local.get 1 + local.get 2 + local.get 3 + local.get 4 + call $miden::asset::build_fungible_asset + local.get 4 + local.get 4 + i64.load offset=8 + i64.store offset=24 + local.get 4 + local.get 4 + i64.load + i64.store offset=16 + local.get 0 + local.get 4 + i32.const 16 + i32.add + call $miden_stdlib_sys::intrinsics::word::Word::reverse + local.get 4 + i32.const 32 + i32.add + global.set $__stack_pointer + ) + (func $miden_stdlib_sys::intrinsics::word::Word::reverse (;5;) (type 3) (param i32 i32) + (local i32 i32 i32 f32) + global.get $__stack_pointer + i32.const 16 + i32.sub + local.tee 2 + local.get 1 + i64.load offset=8 + i64.store offset=8 align=4 + local.get 2 + local.get 1 + i64.load + i64.store align=4 + local.get 2 + i32.const 12 + i32.add + local.set 3 + i32.const 0 + local.set 1 + block ;; label = @1 + loop ;; label = @2 + local.get 1 + i32.const 8 + i32.eq + br_if 1 (;@1;) + local.get 2 + local.get 1 + i32.add + local.tee 4 + f32.load + local.set 5 + local.get 4 + local.get 3 + i32.load + i32.store + local.get 3 + local.get 5 + f32.store + local.get 1 + i32.const 4 + i32.add + local.set 1 + local.get 3 + i32.const -4 + i32.add + local.set 3 + br 0 (;@2;) + end + end + local.get 0 + local.get 2 + i64.load offset=8 align=4 + i64.store offset=8 + local.get 0 + local.get 2 + i64.load align=4 + i64.store + ) + (func $intrinsics::felt::from_u32 (;6;) (type 4) (param i32) (result f32) + unreachable + ) + (func $miden::asset::build_fungible_asset (;7;) (type 5) (param f32 f32 f32 i32) + unreachable + ) + (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") + (@custom "rodata,miden_account" (after data) "grust_sdk_account_asset_build_fungible_asset_binding\01\0b0.0.1\03\01\01\00\00") + ) + (alias export 0 "asset" (type (;1;))) + (core instance (;0;) (instantiate 0)) + (alias core export 0 "memory" (core memory (;0;))) + (type (;2;) (func (result 1))) + (alias core export 0 "miden:rust-sdk-account-asset-build-fungible-asset-binding/rust-sdk-account-asset-build-fungible-asset-binding@0.0.1#binding" (core func (;0;))) + (func (;0;) (type 2) (canon lift (core func 0) (memory 0))) + (alias export 0 "felt" (type (;3;))) + (alias export 0 "word" (type (;4;))) + (alias export 0 "asset" (type (;5;))) + (component (;0;) + (type (;0;) (record (field "inner" f32))) + (import "import-type-felt" (type (;1;) (eq 0))) + (type (;2;) (tuple 1 1 1 1)) + (type (;3;) (record (field "inner" 2))) + (import "import-type-word" (type (;4;) (eq 3))) + (type (;5;) (record (field "inner" 4))) + (import "import-type-asset" (type (;6;) (eq 5))) + (import "import-type-asset0" (type (;7;) (eq 6))) + (type (;8;) (func (result 7))) + (import "import-func-binding" (func (;0;) (type 8))) + (export (;9;) "asset" (type 6)) + (type (;10;) (func (result 9))) + (export (;1;) "binding" (func 0) (func (type 10))) + ) + (instance (;1;) (instantiate 0 + (with "import-func-binding" (func 0)) + (with "import-type-felt" (type 3)) + (with "import-type-word" (type 4)) + (with "import-type-asset" (type 5)) + (with "import-type-asset0" (type 1)) + ) + ) + (export (;2;) "miden:rust-sdk-account-asset-build-fungible-asset-binding/rust-sdk-account-asset-build-fungible-asset-binding@0.0.1" (instance 1)) +) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_asset_build_non_fungible_asset_binding.hir b/tests/integration/expected/rust_sdk/rust_sdk_account_asset_build_non_fungible_asset_binding.hir new file mode 100644 index 000000000..edd07831b --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_asset_build_non_fungible_asset_binding.hir @@ -0,0 +1,465 @@ +builtin.component miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1 { + builtin.module public @rust_sdk_account_asset_build_non_fungible_asset_binding { + private builtin.function @__wasm_call_ctors() { + ^block5: + builtin.ret ; + }; + + private builtin.function @rust_sdk_account_asset_build_non_fungible_asset_binding::bindings::__link_custom_section_describing_imports() { + ^block7: + builtin.ret ; + }; + + private builtin.function @miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1#binding() -> i32 { + ^block9: + v3 = builtin.global_symbol @miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1/rust_sdk_account_asset_build_non_fungible_asset_binding/__stack_pointer : ptr + v4 = hir.bitcast v3 : ptr; + v5 = hir.load v4 : i32; + v6 = arith.constant 32 : i32; + v7 = arith.sub v5, v6 : i32 #[overflow = wrapping]; + v8 = builtin.global_symbol @miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1/rust_sdk_account_asset_build_non_fungible_asset_binding/__stack_pointer : ptr + v9 = hir.bitcast v8 : ptr; + hir.store v9, v7; + hir.exec @miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1/rust_sdk_account_asset_build_non_fungible_asset_binding/wit_bindgen::rt::run_ctors_once() + v11 = arith.constant 1 : i32; + v12 = hir.exec @miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1/rust_sdk_account_asset_build_non_fungible_asset_binding/intrinsics::felt::from_u32(v11) : felt + v1 = arith.constant 0 : i32; + v14 = hir.exec @miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1/rust_sdk_account_asset_build_non_fungible_asset_binding/intrinsics::felt::from_u32(v1) : felt + v443 = arith.constant 0 : i32; + v16 = hir.exec @miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1/rust_sdk_account_asset_build_non_fungible_asset_binding/intrinsics::felt::from_u32(v443) : felt + v442 = arith.constant 0 : i32; + v403, v404, v405, v406, v407, v408, v409, v410 = scf.while v442, v7, v16, v12, v14 : i32, i32, felt, felt, felt, i32, felt, felt { + ^block42(v411: i32, v412: i32, v413: felt, v414: felt, v415: felt): + v441 = arith.constant 0 : i32; + v59 = arith.constant 16 : i32; + v19 = arith.eq v411, v59 : i1; + v20 = arith.zext v19 : u32; + v21 = hir.bitcast v20 : i32; + v23 = arith.neq v21, v441 : i1; + v396 = scf.if v23 : i32 { + ^block41: + v343 = ub.poison i32 : i32; + scf.yield v343; + } else { + ^block14: + v440 = arith.constant 16 : i32; + v26 = arith.add v412, v440 : i32 #[overflow = wrapping]; + v27 = arith.add v26, v411 : i32 #[overflow = wrapping]; + v29 = hir.bitcast v27 : u32; + v38 = arith.constant 4 : u32; + v31 = arith.mod v29, v38 : u32; + hir.assertz v31 #[code = 250]; + v32 = hir.int_to_ptr v29 : ptr; + hir.store v32, v413; + v33 = arith.constant 4 : i32; + v34 = arith.add v411, v33 : i32 #[overflow = wrapping]; + scf.yield v34; + }; + v437 = ub.poison felt : felt; + v400 = cf.select v23, v437, v415 : felt; + v438 = ub.poison felt : felt; + v399 = cf.select v23, v438, v414 : felt; + v344 = ub.poison felt : felt; + v398 = cf.select v23, v344, v413 : felt; + v439 = ub.poison i32 : i32; + v397 = cf.select v23, v439, v412 : i32; + v342 = arith.constant 1 : u32; + v334 = arith.constant 0 : u32; + v402 = cf.select v23, v334, v342 : u32; + v388 = arith.trunc v402 : i1; + scf.condition v388, v396, v397, v398, v399, v400, v412, v414, v415; + } do { + ^block43(v416: i32, v417: i32, v418: felt, v419: felt, v420: felt, v421: i32, v422: felt, v423: felt): + scf.yield v416, v417, v418, v419, v420; + }; + v36 = arith.constant 24 : u32; + v35 = hir.bitcast v408 : u32; + v37 = arith.add v35, v36 : u32 #[overflow = checked]; + v436 = arith.constant 4 : u32; + v39 = arith.mod v37, v436 : u32; + hir.assertz v39 #[code = 250]; + v40 = hir.int_to_ptr v37 : ptr; + v41 = hir.load v40 : i64; + v43 = arith.constant 8 : u32; + v42 = hir.bitcast v408 : u32; + v44 = arith.add v42, v43 : u32 #[overflow = checked]; + v435 = arith.constant 8 : u32; + v46 = arith.mod v44, v435 : u32; + hir.assertz v46 #[code = 250]; + v47 = hir.int_to_ptr v44 : ptr; + hir.store v47, v41; + v49 = arith.constant 16 : u32; + v48 = hir.bitcast v408 : u32; + v50 = arith.add v48, v49 : u32 #[overflow = checked]; + v434 = arith.constant 4 : u32; + v52 = arith.mod v50, v434 : u32; + hir.assertz v52 #[code = 250]; + v53 = hir.int_to_ptr v50 : ptr; + v54 = hir.load v53 : i64; + v55 = hir.bitcast v408 : u32; + v433 = arith.constant 8 : u32; + v57 = arith.mod v55, v433 : u32; + hir.assertz v57 #[code = 250]; + v58 = hir.int_to_ptr v55 : ptr; + hir.store v58, v54; + v432 = arith.constant 16 : i32; + v60 = arith.add v408, v432 : i32 #[overflow = wrapping]; + hir.exec @miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1/rust_sdk_account_asset_build_non_fungible_asset_binding/miden_base_sys::bindings::asset::build_non_fungible_asset(v60, v409, v410, v408) + v63 = builtin.global_symbol @miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1/rust_sdk_account_asset_build_non_fungible_asset_binding/GOT.data.internal.__memory_base : ptr + v64 = hir.bitcast v63 : ptr; + v65 = hir.load v64 : i32; + v66 = arith.constant 1048584 : i32; + v67 = arith.add v65, v66 : i32 #[overflow = wrapping]; + v431 = arith.constant 24 : u32; + v68 = hir.bitcast v408 : u32; + v70 = arith.add v68, v431 : u32 #[overflow = checked]; + v430 = arith.constant 8 : u32; + v72 = arith.mod v70, v430 : u32; + hir.assertz v72 #[code = 250]; + v73 = hir.int_to_ptr v70 : ptr; + v74 = hir.load v73 : i64; + v429 = arith.constant 8 : u32; + v75 = hir.bitcast v67 : u32; + v77 = arith.add v75, v429 : u32 #[overflow = checked]; + v428 = arith.constant 4 : u32; + v79 = arith.mod v77, v428 : u32; + hir.assertz v79 #[code = 250]; + v80 = hir.int_to_ptr v77 : ptr; + hir.store v80, v74; + v427 = arith.constant 16 : u32; + v81 = hir.bitcast v408 : u32; + v83 = arith.add v81, v427 : u32 #[overflow = checked]; + v426 = arith.constant 8 : u32; + v85 = arith.mod v83, v426 : u32; + hir.assertz v85 #[code = 250]; + v86 = hir.int_to_ptr v83 : ptr; + v87 = hir.load v86 : i64; + v88 = hir.bitcast v67 : u32; + v425 = arith.constant 4 : u32; + v90 = arith.mod v88, v425 : u32; + hir.assertz v90 #[code = 250]; + v91 = hir.int_to_ptr v88 : ptr; + hir.store v91, v87; + v424 = arith.constant 32 : i32; + v93 = arith.add v408, v424 : i32 #[overflow = wrapping]; + v94 = builtin.global_symbol @miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1/rust_sdk_account_asset_build_non_fungible_asset_binding/__stack_pointer : ptr + v95 = hir.bitcast v94 : ptr; + hir.store v95, v93; + builtin.ret v67; + }; + + private builtin.function @wit_bindgen::rt::run_ctors_once() { + ^block15: + v97 = builtin.global_symbol @miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1/rust_sdk_account_asset_build_non_fungible_asset_binding/GOT.data.internal.__memory_base : ptr + v98 = hir.bitcast v97 : ptr; + v99 = hir.load v98 : i32; + v100 = arith.constant 1048600 : i32; + v101 = arith.add v99, v100 : i32 #[overflow = wrapping]; + v102 = hir.bitcast v101 : u32; + v103 = hir.int_to_ptr v102 : ptr; + v104 = hir.load v103 : u8; + v96 = arith.constant 0 : i32; + v105 = arith.zext v104 : u32; + v106 = hir.bitcast v105 : i32; + v108 = arith.neq v106, v96 : i1; + scf.if v108{ + ^block17: + scf.yield ; + } else { + ^block18: + v109 = builtin.global_symbol @miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1/rust_sdk_account_asset_build_non_fungible_asset_binding/GOT.data.internal.__memory_base : ptr + v110 = hir.bitcast v109 : ptr; + v111 = hir.load v110 : i32; + hir.exec @miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1/rust_sdk_account_asset_build_non_fungible_asset_binding/__wasm_call_ctors() + v445 = arith.constant 1 : u8; + v447 = arith.constant 1048600 : i32; + v113 = arith.add v111, v447 : i32 #[overflow = wrapping]; + v117 = hir.bitcast v113 : u32; + v118 = hir.int_to_ptr v117 : ptr; + hir.store v118, v445; + scf.yield ; + }; + builtin.ret ; + }; + + private builtin.function @miden_base_sys::bindings::asset::build_non_fungible_asset(v119: i32, v120: felt, v121: felt, v122: i32) { + ^block19(v119: i32, v120: felt, v121: felt, v122: i32): + v124 = builtin.global_symbol @miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1/rust_sdk_account_asset_build_non_fungible_asset_binding/__stack_pointer : ptr + v125 = hir.bitcast v124 : ptr; + v126 = hir.load v125 : i32; + v127 = arith.constant 32 : i32; + v128 = arith.sub v126, v127 : i32 #[overflow = wrapping]; + v129 = builtin.global_symbol @miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1/rust_sdk_account_asset_build_non_fungible_asset_binding/__stack_pointer : ptr + v130 = hir.bitcast v129 : ptr; + hir.store v130, v128; + v132 = arith.constant 12 : u32; + v131 = hir.bitcast v122 : u32; + v133 = arith.add v131, v132 : u32 #[overflow = checked]; + v134 = arith.constant 4 : u32; + v135 = arith.mod v133, v134 : u32; + hir.assertz v135 #[code = 250]; + v136 = hir.int_to_ptr v133 : ptr; + v137 = hir.load v136 : felt; + v139 = arith.constant 8 : u32; + v138 = hir.bitcast v122 : u32; + v140 = arith.add v138, v139 : u32 #[overflow = checked]; + v457 = arith.constant 4 : u32; + v142 = arith.mod v140, v457 : u32; + hir.assertz v142 #[code = 250]; + v143 = hir.int_to_ptr v140 : ptr; + v144 = hir.load v143 : felt; + v456 = arith.constant 4 : u32; + v145 = hir.bitcast v122 : u32; + v147 = arith.add v145, v456 : u32 #[overflow = checked]; + v455 = arith.constant 4 : u32; + v149 = arith.mod v147, v455 : u32; + hir.assertz v149 #[code = 250]; + v150 = hir.int_to_ptr v147 : ptr; + v151 = hir.load v150 : felt; + v152 = hir.bitcast v122 : u32; + v454 = arith.constant 4 : u32; + v154 = arith.mod v152, v454 : u32; + hir.assertz v154 #[code = 250]; + v155 = hir.int_to_ptr v152 : ptr; + v156 = hir.load v155 : felt; + hir.exec @miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1/rust_sdk_account_asset_build_non_fungible_asset_binding/miden::asset::build_non_fungible_asset(v120, v137, v144, v151, v156, v128) + v453 = arith.constant 8 : u32; + v157 = hir.bitcast v128 : u32; + v159 = arith.add v157, v453 : u32 #[overflow = checked]; + v452 = arith.constant 8 : u32; + v161 = arith.mod v159, v452 : u32; + hir.assertz v161 #[code = 250]; + v162 = hir.int_to_ptr v159 : ptr; + v163 = hir.load v162 : i64; + v165 = arith.constant 24 : u32; + v164 = hir.bitcast v128 : u32; + v166 = arith.add v164, v165 : u32 #[overflow = checked]; + v451 = arith.constant 8 : u32; + v168 = arith.mod v166, v451 : u32; + hir.assertz v168 #[code = 250]; + v169 = hir.int_to_ptr v166 : ptr; + hir.store v169, v163; + v170 = hir.bitcast v128 : u32; + v450 = arith.constant 8 : u32; + v172 = arith.mod v170, v450 : u32; + hir.assertz v172 #[code = 250]; + v173 = hir.int_to_ptr v170 : ptr; + v174 = hir.load v173 : i64; + v176 = arith.constant 16 : u32; + v175 = hir.bitcast v128 : u32; + v177 = arith.add v175, v176 : u32 #[overflow = checked]; + v449 = arith.constant 8 : u32; + v179 = arith.mod v177, v449 : u32; + hir.assertz v179 #[code = 250]; + v180 = hir.int_to_ptr v177 : ptr; + hir.store v180, v174; + v181 = arith.constant 16 : i32; + v182 = arith.add v128, v181 : i32 #[overflow = wrapping]; + hir.exec @miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1/rust_sdk_account_asset_build_non_fungible_asset_binding/miden_stdlib_sys::intrinsics::word::Word::reverse(v119, v182) + v448 = arith.constant 32 : i32; + v184 = arith.add v128, v448 : i32 #[overflow = wrapping]; + v185 = builtin.global_symbol @miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1/rust_sdk_account_asset_build_non_fungible_asset_binding/__stack_pointer : ptr + v186 = hir.bitcast v185 : ptr; + hir.store v186, v184; + builtin.ret ; + }; + + private builtin.function @miden_stdlib_sys::intrinsics::word::Word::reverse(v187: i32, v188: i32) { + ^block21(v187: i32, v188: i32): + v191 = builtin.global_symbol @miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1/rust_sdk_account_asset_build_non_fungible_asset_binding/__stack_pointer : ptr + v192 = hir.bitcast v191 : ptr; + v193 = hir.load v192 : i32; + v194 = arith.constant 16 : i32; + v195 = arith.sub v193, v194 : i32 #[overflow = wrapping]; + v197 = arith.constant 8 : u32; + v196 = hir.bitcast v188 : u32; + v198 = arith.add v196, v197 : u32 #[overflow = checked]; + v544 = arith.constant 8 : u32; + v200 = arith.mod v198, v544 : u32; + hir.assertz v200 #[code = 250]; + v201 = hir.int_to_ptr v198 : ptr; + v202 = hir.load v201 : i64; + v543 = arith.constant 8 : u32; + v203 = hir.bitcast v195 : u32; + v205 = arith.add v203, v543 : u32 #[overflow = checked]; + v206 = arith.constant 4 : u32; + v207 = arith.mod v205, v206 : u32; + hir.assertz v207 #[code = 250]; + v208 = hir.int_to_ptr v205 : ptr; + hir.store v208, v202; + v209 = hir.bitcast v188 : u32; + v542 = arith.constant 8 : u32; + v211 = arith.mod v209, v542 : u32; + hir.assertz v211 #[code = 250]; + v212 = hir.int_to_ptr v209 : ptr; + v213 = hir.load v212 : i64; + v214 = hir.bitcast v195 : u32; + v541 = arith.constant 4 : u32; + v216 = arith.mod v214, v541 : u32; + hir.assertz v216 #[code = 250]; + v217 = hir.int_to_ptr v214 : ptr; + hir.store v217, v213; + v218 = arith.constant 12 : i32; + v219 = arith.add v195, v218 : i32 #[overflow = wrapping]; + v189 = arith.constant 0 : i32; + v512, v513, v514, v515, v516, v517 = scf.while v189, v195, v219, v187 : i32, i32, i32, i32, i32, i32 { + ^block52(v518: i32, v519: i32, v520: i32, v521: i32): + v540 = arith.constant 0 : i32; + v222 = arith.constant 8 : i32; + v223 = arith.eq v518, v222 : i1; + v224 = arith.zext v223 : u32; + v225 = hir.bitcast v224 : i32; + v227 = arith.neq v225, v540 : i1; + v506, v507 = scf.if v227 : i32, i32 { + ^block51: + v466 = ub.poison i32 : i32; + scf.yield v466, v466; + } else { + ^block26: + v229 = arith.add v519, v518 : i32 #[overflow = wrapping]; + v230 = hir.bitcast v229 : u32; + v539 = arith.constant 4 : u32; + v232 = arith.mod v230, v539 : u32; + hir.assertz v232 #[code = 250]; + v233 = hir.int_to_ptr v230 : ptr; + v234 = hir.load v233 : felt; + v236 = hir.bitcast v520 : u32; + v538 = arith.constant 4 : u32; + v238 = arith.mod v236, v538 : u32; + hir.assertz v238 #[code = 250]; + v239 = hir.int_to_ptr v236 : ptr; + v240 = hir.load v239 : i32; + v241 = hir.bitcast v229 : u32; + v537 = arith.constant 4 : u32; + v243 = arith.mod v241, v537 : u32; + hir.assertz v243 #[code = 250]; + v244 = hir.int_to_ptr v241 : ptr; + hir.store v244, v240; + v245 = hir.bitcast v520 : u32; + v536 = arith.constant 4 : u32; + v247 = arith.mod v245, v536 : u32; + hir.assertz v247 #[code = 250]; + v248 = hir.int_to_ptr v245 : ptr; + hir.store v248, v234; + v251 = arith.constant -4 : i32; + v252 = arith.add v520, v251 : i32 #[overflow = wrapping]; + v249 = arith.constant 4 : i32; + v250 = arith.add v518, v249 : i32 #[overflow = wrapping]; + scf.yield v250, v252; + }; + v534 = ub.poison i32 : i32; + v509 = cf.select v227, v534, v521 : i32; + v535 = ub.poison i32 : i32; + v508 = cf.select v227, v535, v519 : i32; + v465 = arith.constant 1 : u32; + v458 = arith.constant 0 : u32; + v511 = cf.select v227, v458, v465 : u32; + v499 = arith.trunc v511 : i1; + scf.condition v499, v506, v508, v507, v509, v519, v521; + } do { + ^block53(v522: i32, v523: i32, v524: i32, v525: i32, v526: i32, v527: i32): + scf.yield v522, v523, v524, v525; + }; + v533 = arith.constant 8 : u32; + v254 = hir.bitcast v516 : u32; + v256 = arith.add v254, v533 : u32 #[overflow = checked]; + v532 = arith.constant 4 : u32; + v258 = arith.mod v256, v532 : u32; + hir.assertz v258 #[code = 250]; + v259 = hir.int_to_ptr v256 : ptr; + v260 = hir.load v259 : i64; + v531 = arith.constant 8 : u32; + v261 = hir.bitcast v517 : u32; + v263 = arith.add v261, v531 : u32 #[overflow = checked]; + v530 = arith.constant 8 : u32; + v265 = arith.mod v263, v530 : u32; + hir.assertz v265 #[code = 250]; + v266 = hir.int_to_ptr v263 : ptr; + hir.store v266, v260; + v267 = hir.bitcast v516 : u32; + v529 = arith.constant 4 : u32; + v269 = arith.mod v267, v529 : u32; + hir.assertz v269 #[code = 250]; + v270 = hir.int_to_ptr v267 : ptr; + v271 = hir.load v270 : i64; + v272 = hir.bitcast v517 : u32; + v528 = arith.constant 8 : u32; + v274 = arith.mod v272, v528 : u32; + hir.assertz v274 #[code = 250]; + v275 = hir.int_to_ptr v272 : ptr; + hir.store v275, v271; + builtin.ret ; + }; + + private builtin.function @intrinsics::felt::from_u32(v276: i32) -> felt { + ^block27(v276: i32): + v277 = hir.bitcast v276 : felt; + builtin.ret v277; + }; + + private builtin.function @miden::asset::build_non_fungible_asset(v279: felt, v280: felt, v281: felt, v282: felt, v283: felt, v284: i32) { + ^block29(v279: felt, v280: felt, v281: felt, v282: felt, v283: felt, v284: i32): + v285, v286, v287, v288 = hir.exec @miden/asset/build_non_fungible_asset(v279, v280, v281, v282, v283) : felt, felt, felt, felt + v289 = hir.bitcast v284 : u32; + v290 = hir.int_to_ptr v289 : ptr; + hir.store v290, v285; + v291 = arith.constant 4 : u32; + v292 = arith.add v289, v291 : u32 #[overflow = checked]; + v293 = hir.int_to_ptr v292 : ptr; + hir.store v293, v286; + v294 = arith.constant 8 : u32; + v295 = arith.add v289, v294 : u32 #[overflow = checked]; + v296 = hir.int_to_ptr v295 : ptr; + hir.store v296, v287; + v297 = arith.constant 12 : u32; + v298 = arith.add v289, v297 : u32 #[overflow = checked]; + v299 = hir.int_to_ptr v298 : ptr; + hir.store v299, v288; + builtin.ret ; + }; + + builtin.global_variable private @#__stack_pointer : i32 { + builtin.ret_imm 1048576; + }; + + builtin.global_variable private @#GOT.data.internal.__memory_base : i32 { + builtin.ret_imm 0; + }; + + builtin.segment @1048576 = 0x0000000100000001; + }; + + public builtin.function @binding() -> felt, felt, felt, felt { + ^block33: + v300 = hir.exec @miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1/rust_sdk_account_asset_build_non_fungible_asset_binding/miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1#binding() : i32 + v550 = arith.constant 0 : i32; + v301 = arith.constant 0 : i32; + v302 = arith.add v300, v301 : i32 #[overflow = unchecked]; + v304 = arith.add v302, v550 : i32 #[overflow = unchecked]; + v548 = arith.constant 0 : i32; + v549 = arith.constant 0 : i32; + v306 = arith.add v304, v549 : i32 #[overflow = unchecked]; + v308 = arith.add v306, v548 : i32 #[overflow = unchecked]; + v309 = hir.int_to_ptr v308 : ptr; + v310 = hir.load v309 : felt; + v547 = arith.constant 0 : i32; + v311 = arith.constant 4 : i32; + v312 = arith.add v304, v311 : i32 #[overflow = unchecked]; + v314 = arith.add v312, v547 : i32 #[overflow = unchecked]; + v315 = hir.int_to_ptr v314 : ptr; + v316 = hir.load v315 : felt; + v546 = arith.constant 0 : i32; + v317 = arith.constant 8 : i32; + v318 = arith.add v304, v317 : i32 #[overflow = unchecked]; + v320 = arith.add v318, v546 : i32 #[overflow = unchecked]; + v321 = hir.int_to_ptr v320 : ptr; + v322 = hir.load v321 : felt; + v545 = arith.constant 0 : i32; + v323 = arith.constant 12 : i32; + v324 = arith.add v304, v323 : i32 #[overflow = unchecked]; + v326 = arith.add v324, v545 : i32 #[overflow = unchecked]; + v327 = hir.int_to_ptr v326 : ptr; + v328 = hir.load v327 : felt; + builtin.ret v310, v316, v322, v328; + }; +}; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_asset_build_non_fungible_asset_binding.masm b/tests/integration/expected/rust_sdk/rust_sdk_account_asset_build_non_fungible_asset_binding.masm new file mode 100644 index 000000000..de2fc395d --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_asset_build_non_fungible_asset_binding.masm @@ -0,0 +1,1011 @@ +# mod miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1 + +@callconv("canon-lift") +pub proc binding( + +) -> (felt, felt, felt, felt) + exec.::miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1::init + trace.240 + nop + exec.::miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1::rust_sdk_account_asset_build_non_fungible_asset_binding::miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1#binding + trace.252 + nop + push.0 + push.0 + movup.2 + u32wrapping_add + u32wrapping_add + push.0 + push.0 + dup.2 + u32wrapping_add + u32wrapping_add + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.0 + push.4 + dup.3 + u32wrapping_add + u32wrapping_add + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.0 + push.8 + dup.4 + u32wrapping_add + u32wrapping_add + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.0 + push.12 + movup.5 + u32wrapping_add + u32wrapping_add + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + movdn.3 + swap.2 + exec.::std::sys::truncate_stack +end + +proc init + push.1179648 + trace.240 + exec.::intrinsics::mem::heap_init + trace.252 + push.[7028007876379170725,18060021366771303825,13412364500725888848,14178532912296021363] + adv.push_mapval + push.262144 + push.1 + trace.240 + exec.::std::mem::pipe_preimage_to_memory + trace.252 + drop + push.1048576 + u32assert + mem_store.278536 + push.0 + u32assert + mem_store.278537 +end + +# mod miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1::rust_sdk_account_asset_build_non_fungible_asset_binding + +@callconv("C") +proc __wasm_call_ctors( + +) + nop +end + +@callconv("C") +proc rust_sdk_account_asset_build_non_fungible_asset_binding::bindings::__link_custom_section_describing_imports( + +) + nop +end + +@callconv("C") +proc miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1#binding( + +) -> i32 + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.32 + u32wrapping_sub + push.1114144 + dup.1 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + trace.240 + nop + exec.::miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1::rust_sdk_account_asset_build_non_fungible_asset_binding::wit_bindgen::rt::run_ctors_once + trace.252 + nop + push.1 + trace.240 + nop + exec.::miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1::rust_sdk_account_asset_build_non_fungible_asset_binding::intrinsics::felt::from_u32 + trace.252 + nop + push.0 + trace.240 + nop + exec.::miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1::rust_sdk_account_asset_build_non_fungible_asset_binding::intrinsics::felt::from_u32 + trace.252 + nop + push.0 + trace.240 + nop + exec.::miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1::rust_sdk_account_asset_build_non_fungible_asset_binding::intrinsics::felt::from_u32 + trace.252 + nop + push.0 + swap.1 + swap.2 + swap.4 + swap.1 + push.1 + while.true + push.0 + push.16 + dup.2 + eq + neq + dup.0 + if.true + swap.1 + drop + push.3735929054 + else + push.16 + dup.3 + u32wrapping_add + dup.2 + u32wrapping_add + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + dup.4 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.4 + movup.2 + u32wrapping_add + end + push.3735929054 + dup.2 + dup.7 + swap.2 + swap.1 + cdrop + push.3735929054 + dup.3 + dup.7 + swap.2 + swap.1 + cdrop + push.3735929054 + dup.4 + movup.2 + swap.7 + movdn.2 + cdrop + push.3735929054 + dup.4 + dup.6 + swap.2 + swap.1 + cdrop + push.1 + push.0 + movup.6 + cdrop + push.1 + u32and + swap.1 + swap.2 + swap.3 + swap.5 + swap.6 + swap.4 + swap.1 + if.true + movup.5 + drop + movup.5 + drop + movup.5 + drop + push.1 + else + push.0 + end + end + drop + drop + drop + drop + drop + push.24 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.8 + dup.3 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.16 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + dup.2 + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.16 + dup.1 + u32wrapping_add + dup.1 + movup.2 + swap.4 + movdn.2 + swap.3 + swap.1 + trace.240 + nop + exec.::miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1::rust_sdk_account_asset_build_non_fungible_asset_binding::miden_base_sys::bindings::asset::build_non_fungible_asset + trace.252 + nop + push.1114148 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.1048584 + u32wrapping_add + push.24 + dup.2 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.8 + dup.3 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.16 + dup.2 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + dup.2 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.32 + movup.2 + u32wrapping_add + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop +end + +@callconv("C") +proc wit_bindgen::rt::run_ctors_once( + +) + push.1114148 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.1048600 + u32wrapping_add + u32divmod.4 + swap.1 + swap.1 + dup.1 + mem_load + swap.1 + push.8 + u32wrapping_mul + u32shr + swap.1 + drop + push.255 + u32and + push.0 + swap.1 + neq + if.true + nop + else + push.1114148 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + trace.240 + nop + exec.::miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1::rust_sdk_account_asset_build_non_fungible_asset_binding::__wasm_call_ctors + trace.252 + nop + push.1 + push.1048600 + movup.2 + u32wrapping_add + u32divmod.4 + swap.1 + dup.0 + mem_load + dup.2 + push.8 + u32wrapping_mul + push.255 + swap.1 + u32shl + u32not + swap.1 + u32and + movup.3 + movup.3 + push.8 + u32wrapping_mul + u32shl + u32or + swap.1 + mem_store + end +end + +@callconv("C") +proc miden_base_sys::bindings::asset::build_non_fungible_asset( + i32, + felt, + felt, + i32 +) + movup.2 + drop + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.32 + u32wrapping_sub + push.1114144 + dup.1 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.12 + dup.4 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.8 + dup.5 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.4 + dup.6 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + movup.6 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + dup.4 + movup.2 + swap.3 + movdn.2 + swap.1 + swap.4 + swap.1 + swap.5 + swap.7 + trace.240 + nop + exec.::miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1::rust_sdk_account_asset_build_non_fungible_asset_binding::miden::asset::build_non_fungible_asset + trace.252 + nop + push.8 + dup.2 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.24 + dup.4 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + dup.1 + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.16 + dup.4 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.16 + dup.2 + u32wrapping_add + swap.1 + trace.240 + nop + exec.::miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1::rust_sdk_account_asset_build_non_fungible_asset_binding::miden_stdlib_sys::intrinsics::word::Word::reverse + trace.252 + nop + push.32 + u32wrapping_add + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop +end + +@callconv("C") +proc miden_stdlib_sys::intrinsics::word::Word::reverse( + i32, + i32 +) + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.16 + u32wrapping_sub + push.8 + dup.3 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.8 + dup.3 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + movup.2 + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + dup.2 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.12 + dup.1 + u32wrapping_add + push.0 + movup.2 + swap.1 + push.1 + while.true + push.0 + push.8 + dup.2 + eq + neq + dup.0 + if.true + movup.3 + movup.2 + drop + drop + push.3735929054 + dup.0 + else + dup.2 + dup.2 + u32wrapping_add + dup.0 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + dup.5 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + movup.2 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + dup.4 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.4294967292 + movup.4 + u32wrapping_add + push.4 + movup.3 + u32wrapping_add + end + push.3735929054 + dup.3 + dup.6 + swap.2 + swap.1 + cdrop + push.3735929054 + dup.4 + dup.6 + swap.2 + swap.1 + cdrop + push.1 + push.0 + movup.6 + cdrop + push.1 + u32and + swap.1 + swap.2 + swap.4 + swap.3 + swap.1 + if.true + movup.4 + drop + movup.4 + drop + push.1 + else + push.0 + end + end + drop + drop + drop + drop + push.8 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.8 + dup.4 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + movup.2 + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop +end + +@callconv("C") +proc intrinsics::felt::from_u32(i32) -> felt + nop +end + +@callconv("C") +proc miden::asset::build_non_fungible_asset(felt, felt, felt, felt, felt, i32) + trace.240 + nop + exec.::miden::asset::build_non_fungible_asset + trace.252 + nop + movup.4 + dup.0 + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.4 + dup.1 + add + u32assert + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.8 + dup.1 + add + u32assert + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.12 + add + u32assert + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop +end + diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_asset_build_non_fungible_asset_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_account_asset_build_non_fungible_asset_binding.wat new file mode 100644 index 000000000..b7c5d29ba --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_asset_build_non_fungible_asset_binding.wat @@ -0,0 +1,255 @@ +(component + (type (;0;) + (instance + (type (;0;) (record (field "inner" f32))) + (export (;1;) "felt" (type (eq 0))) + (type (;2;) (tuple 1 1 1 1)) + (type (;3;) (record (field "inner" 2))) + (export (;4;) "word" (type (eq 3))) + (type (;5;) (record (field "inner" 4))) + (export (;6;) "asset" (type (eq 5))) + ) + ) + (import "miden:base/core-types@1.0.0" (instance (;0;) (type 0))) + (core module (;0;) + (type (;0;) (func)) + (type (;1;) (func (result i32))) + (type (;2;) (func (param i32 f32 f32 i32))) + (type (;3;) (func (param i32 i32))) + (type (;4;) (func (param i32) (result f32))) + (type (;5;) (func (param f32 f32 f32 f32 f32 i32))) + (table (;0;) 2 2 funcref) + (memory (;0;) 17) + (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) + (global $GOT.data.internal.__memory_base (;1;) i32 i32.const 0) + (export "memory" (memory 0)) + (export "miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1#binding" (func $miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1#binding)) + (elem (;0;) (i32.const 1) func $rust_sdk_account_asset_build_non_fungible_asset_binding::bindings::__link_custom_section_describing_imports) + (func $__wasm_call_ctors (;0;) (type 0)) + (func $rust_sdk_account_asset_build_non_fungible_asset_binding::bindings::__link_custom_section_describing_imports (;1;) (type 0)) + (func $miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1#binding (;2;) (type 1) (result i32) + (local i32 i32 f32 f32 f32) + global.get $__stack_pointer + i32.const 32 + i32.sub + local.tee 0 + global.set $__stack_pointer + call $wit_bindgen::rt::run_ctors_once + i32.const 0 + local.set 1 + i32.const 1 + call $intrinsics::felt::from_u32 + local.set 2 + i32.const 0 + call $intrinsics::felt::from_u32 + local.set 3 + i32.const 0 + call $intrinsics::felt::from_u32 + local.set 4 + block ;; label = @1 + loop ;; label = @2 + local.get 1 + i32.const 16 + i32.eq + br_if 1 (;@1;) + local.get 0 + i32.const 16 + i32.add + local.get 1 + i32.add + local.get 4 + f32.store + local.get 1 + i32.const 4 + i32.add + local.set 1 + br 0 (;@2;) + end + end + local.get 0 + local.get 0 + i64.load offset=24 align=4 + i64.store offset=8 + local.get 0 + local.get 0 + i64.load offset=16 align=4 + i64.store + local.get 0 + i32.const 16 + i32.add + local.get 2 + local.get 3 + local.get 0 + call $miden_base_sys::bindings::asset::build_non_fungible_asset + global.get $GOT.data.internal.__memory_base + i32.const 1048584 + i32.add + local.tee 1 + local.get 0 + i64.load offset=24 + i64.store offset=8 align=4 + local.get 1 + local.get 0 + i64.load offset=16 + i64.store align=4 + local.get 0 + i32.const 32 + i32.add + global.set $__stack_pointer + local.get 1 + ) + (func $wit_bindgen::rt::run_ctors_once (;3;) (type 0) + (local i32) + block ;; label = @1 + global.get $GOT.data.internal.__memory_base + i32.const 1048600 + i32.add + i32.load8_u + br_if 0 (;@1;) + global.get $GOT.data.internal.__memory_base + local.set 0 + call $__wasm_call_ctors + local.get 0 + i32.const 1048600 + i32.add + i32.const 1 + i32.store8 + end + ) + (func $miden_base_sys::bindings::asset::build_non_fungible_asset (;4;) (type 2) (param i32 f32 f32 i32) + (local i32) + global.get $__stack_pointer + i32.const 32 + i32.sub + local.tee 4 + global.set $__stack_pointer + local.get 1 + local.get 3 + f32.load offset=12 + local.get 3 + f32.load offset=8 + local.get 3 + f32.load offset=4 + local.get 3 + f32.load + local.get 4 + call $miden::asset::build_non_fungible_asset + local.get 4 + local.get 4 + i64.load offset=8 + i64.store offset=24 + local.get 4 + local.get 4 + i64.load + i64.store offset=16 + local.get 0 + local.get 4 + i32.const 16 + i32.add + call $miden_stdlib_sys::intrinsics::word::Word::reverse + local.get 4 + i32.const 32 + i32.add + global.set $__stack_pointer + ) + (func $miden_stdlib_sys::intrinsics::word::Word::reverse (;5;) (type 3) (param i32 i32) + (local i32 i32 i32 f32) + global.get $__stack_pointer + i32.const 16 + i32.sub + local.tee 2 + local.get 1 + i64.load offset=8 + i64.store offset=8 align=4 + local.get 2 + local.get 1 + i64.load + i64.store align=4 + local.get 2 + i32.const 12 + i32.add + local.set 3 + i32.const 0 + local.set 1 + block ;; label = @1 + loop ;; label = @2 + local.get 1 + i32.const 8 + i32.eq + br_if 1 (;@1;) + local.get 2 + local.get 1 + i32.add + local.tee 4 + f32.load + local.set 5 + local.get 4 + local.get 3 + i32.load + i32.store + local.get 3 + local.get 5 + f32.store + local.get 1 + i32.const 4 + i32.add + local.set 1 + local.get 3 + i32.const -4 + i32.add + local.set 3 + br 0 (;@2;) + end + end + local.get 0 + local.get 2 + i64.load offset=8 align=4 + i64.store offset=8 + local.get 0 + local.get 2 + i64.load align=4 + i64.store + ) + (func $intrinsics::felt::from_u32 (;6;) (type 4) (param i32) (result f32) + unreachable + ) + (func $miden::asset::build_non_fungible_asset (;7;) (type 5) (param f32 f32 f32 f32 f32 i32) + unreachable + ) + (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") + (@custom "rodata,miden_account" (after data) "orust_sdk_account_asset_build_non_fungible_asset_binding\01\0b0.0.1\03\01\01\00\00\00\00\00\00\00\00\00\00\00\00\00\00") + ) + (alias export 0 "asset" (type (;1;))) + (core instance (;0;) (instantiate 0)) + (alias core export 0 "memory" (core memory (;0;))) + (type (;2;) (func (result 1))) + (alias core export 0 "miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1#binding" (core func (;0;))) + (func (;0;) (type 2) (canon lift (core func 0) (memory 0))) + (alias export 0 "felt" (type (;3;))) + (alias export 0 "word" (type (;4;))) + (alias export 0 "asset" (type (;5;))) + (component (;0;) + (type (;0;) (record (field "inner" f32))) + (import "import-type-felt" (type (;1;) (eq 0))) + (type (;2;) (tuple 1 1 1 1)) + (type (;3;) (record (field "inner" 2))) + (import "import-type-word" (type (;4;) (eq 3))) + (type (;5;) (record (field "inner" 4))) + (import "import-type-asset" (type (;6;) (eq 5))) + (import "import-type-asset0" (type (;7;) (eq 6))) + (type (;8;) (func (result 7))) + (import "import-func-binding" (func (;0;) (type 8))) + (export (;9;) "asset" (type 6)) + (type (;10;) (func (result 9))) + (export (;1;) "binding" (func 0) (func (type 10))) + ) + (instance (;1;) (instantiate 0 + (with "import-func-binding" (func 0)) + (with "import-type-felt" (type 3)) + (with "import-type-word" (type 4)) + (with "import-type-asset" (type 5)) + (with "import-type-asset0" (type 1)) + ) + ) + (export (;2;) "miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1" (instance 1)) +) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_compute_commitment_binding.hir b/tests/integration/expected/rust_sdk/rust_sdk_account_compute_commitment_binding.hir new file mode 100644 index 000000000..6913bc8b7 --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_compute_commitment_binding.hir @@ -0,0 +1,327 @@ +builtin.component miden:rust-sdk-account-compute-commitment-binding/rust-sdk-account-compute-commitment-binding@0.0.1 { + builtin.module public @rust_sdk_account_compute_commitment_binding { + private builtin.function @__wasm_call_ctors() { + ^block5: + builtin.ret ; + }; + + private builtin.function @rust_sdk_account_compute_commitment_binding::bindings::__link_custom_section_describing_imports() { + ^block7: + builtin.ret ; + }; + + private builtin.function @miden:rust-sdk-account-compute-commitment-binding/rust-sdk-account-compute-commitment-binding@0.0.1#binding() -> i32 { + ^block9: + v2 = builtin.global_symbol @miden:rust-sdk-account-compute-commitment-binding/rust-sdk-account-compute-commitment-binding@0.0.1/rust_sdk_account_compute_commitment_binding/__stack_pointer : ptr + v3 = hir.bitcast v2 : ptr; + v4 = hir.load v3 : i32; + v5 = arith.constant 48 : i32; + v6 = arith.sub v4, v5 : i32 #[overflow = wrapping]; + v7 = builtin.global_symbol @miden:rust-sdk-account-compute-commitment-binding/rust-sdk-account-compute-commitment-binding@0.0.1/rust_sdk_account_compute_commitment_binding/__stack_pointer : ptr + v8 = hir.bitcast v7 : ptr; + hir.store v8, v6; + hir.exec @miden:rust-sdk-account-compute-commitment-binding/rust-sdk-account-compute-commitment-binding@0.0.1/rust_sdk_account_compute_commitment_binding/wit_bindgen::rt::run_ctors_once() + v9 = arith.constant 16 : i32; + v10 = arith.add v6, v9 : i32 #[overflow = wrapping]; + hir.exec @miden:rust-sdk-account-compute-commitment-binding/rust-sdk-account-compute-commitment-binding@0.0.1/rust_sdk_account_compute_commitment_binding/miden::active_account::compute_commitment(v10) + v12 = arith.constant 24 : u32; + v11 = hir.bitcast v6 : u32; + v13 = arith.add v11, v12 : u32 #[overflow = checked]; + v14 = arith.constant 8 : u32; + v15 = arith.mod v13, v14 : u32; + hir.assertz v15 #[code = 250]; + v16 = hir.int_to_ptr v13 : ptr; + v17 = hir.load v16 : i64; + v19 = arith.constant 40 : u32; + v18 = hir.bitcast v6 : u32; + v20 = arith.add v18, v19 : u32 #[overflow = checked]; + v237 = arith.constant 8 : u32; + v22 = arith.mod v20, v237 : u32; + hir.assertz v22 #[code = 250]; + v23 = hir.int_to_ptr v20 : ptr; + hir.store v23, v17; + v25 = arith.constant 16 : u32; + v24 = hir.bitcast v6 : u32; + v26 = arith.add v24, v25 : u32 #[overflow = checked]; + v236 = arith.constant 8 : u32; + v28 = arith.mod v26, v236 : u32; + hir.assertz v28 #[code = 250]; + v29 = hir.int_to_ptr v26 : ptr; + v30 = hir.load v29 : i64; + v32 = arith.constant 32 : u32; + v31 = hir.bitcast v6 : u32; + v33 = arith.add v31, v32 : u32 #[overflow = checked]; + v235 = arith.constant 8 : u32; + v35 = arith.mod v33, v235 : u32; + hir.assertz v35 #[code = 250]; + v36 = hir.int_to_ptr v33 : ptr; + hir.store v36, v30; + v37 = builtin.global_symbol @miden:rust-sdk-account-compute-commitment-binding/rust-sdk-account-compute-commitment-binding@0.0.1/rust_sdk_account_compute_commitment_binding/GOT.data.internal.__memory_base : ptr + v38 = hir.bitcast v37 : ptr; + v39 = hir.load v38 : i32; + v40 = arith.constant 32 : i32; + v41 = arith.add v6, v40 : i32 #[overflow = wrapping]; + hir.exec @miden:rust-sdk-account-compute-commitment-binding/rust-sdk-account-compute-commitment-binding@0.0.1/rust_sdk_account_compute_commitment_binding/miden_stdlib_sys::intrinsics::word::Word::reverse(v6, v41) + v42 = arith.constant 1048584 : i32; + v43 = arith.add v39, v42 : i32 #[overflow = wrapping]; + v234 = arith.constant 8 : u32; + v44 = hir.bitcast v6 : u32; + v46 = arith.add v44, v234 : u32 #[overflow = checked]; + v233 = arith.constant 8 : u32; + v48 = arith.mod v46, v233 : u32; + hir.assertz v48 #[code = 250]; + v49 = hir.int_to_ptr v46 : ptr; + v50 = hir.load v49 : i64; + v232 = arith.constant 8 : u32; + v51 = hir.bitcast v43 : u32; + v53 = arith.add v51, v232 : u32 #[overflow = checked]; + v54 = arith.constant 4 : u32; + v55 = arith.mod v53, v54 : u32; + hir.assertz v55 #[code = 250]; + v56 = hir.int_to_ptr v53 : ptr; + hir.store v56, v50; + v57 = hir.bitcast v6 : u32; + v231 = arith.constant 8 : u32; + v59 = arith.mod v57, v231 : u32; + hir.assertz v59 #[code = 250]; + v60 = hir.int_to_ptr v57 : ptr; + v61 = hir.load v60 : i64; + v62 = hir.bitcast v43 : u32; + v230 = arith.constant 4 : u32; + v64 = arith.mod v62, v230 : u32; + hir.assertz v64 #[code = 250]; + v65 = hir.int_to_ptr v62 : ptr; + hir.store v65, v61; + v229 = arith.constant 48 : i32; + v67 = arith.add v6, v229 : i32 #[overflow = wrapping]; + v68 = builtin.global_symbol @miden:rust-sdk-account-compute-commitment-binding/rust-sdk-account-compute-commitment-binding@0.0.1/rust_sdk_account_compute_commitment_binding/__stack_pointer : ptr + v69 = hir.bitcast v68 : ptr; + hir.store v69, v67; + builtin.ret v43; + }; + + private builtin.function @wit_bindgen::rt::run_ctors_once() { + ^block11: + v71 = builtin.global_symbol @miden:rust-sdk-account-compute-commitment-binding/rust-sdk-account-compute-commitment-binding@0.0.1/rust_sdk_account_compute_commitment_binding/GOT.data.internal.__memory_base : ptr + v72 = hir.bitcast v71 : ptr; + v73 = hir.load v72 : i32; + v74 = arith.constant 1048600 : i32; + v75 = arith.add v73, v74 : i32 #[overflow = wrapping]; + v76 = hir.bitcast v75 : u32; + v77 = hir.int_to_ptr v76 : ptr; + v78 = hir.load v77 : u8; + v70 = arith.constant 0 : i32; + v79 = arith.zext v78 : u32; + v80 = hir.bitcast v79 : i32; + v82 = arith.neq v80, v70 : i1; + scf.if v82{ + ^block13: + scf.yield ; + } else { + ^block14: + v83 = builtin.global_symbol @miden:rust-sdk-account-compute-commitment-binding/rust-sdk-account-compute-commitment-binding@0.0.1/rust_sdk_account_compute_commitment_binding/GOT.data.internal.__memory_base : ptr + v84 = hir.bitcast v83 : ptr; + v85 = hir.load v84 : i32; + hir.exec @miden:rust-sdk-account-compute-commitment-binding/rust-sdk-account-compute-commitment-binding@0.0.1/rust_sdk_account_compute_commitment_binding/__wasm_call_ctors() + v239 = arith.constant 1 : u8; + v241 = arith.constant 1048600 : i32; + v87 = arith.add v85, v241 : i32 #[overflow = wrapping]; + v91 = hir.bitcast v87 : u32; + v92 = hir.int_to_ptr v91 : ptr; + hir.store v92, v239; + scf.yield ; + }; + builtin.ret ; + }; + + private builtin.function @miden_stdlib_sys::intrinsics::word::Word::reverse(v93: i32, v94: i32) { + ^block15(v93: i32, v94: i32): + v97 = builtin.global_symbol @miden:rust-sdk-account-compute-commitment-binding/rust-sdk-account-compute-commitment-binding@0.0.1/rust_sdk_account_compute_commitment_binding/__stack_pointer : ptr + v98 = hir.bitcast v97 : ptr; + v99 = hir.load v98 : i32; + v100 = arith.constant 16 : i32; + v101 = arith.sub v99, v100 : i32 #[overflow = wrapping]; + v103 = arith.constant 8 : u32; + v102 = hir.bitcast v94 : u32; + v104 = arith.add v102, v103 : u32 #[overflow = checked]; + v328 = arith.constant 8 : u32; + v106 = arith.mod v104, v328 : u32; + hir.assertz v106 #[code = 250]; + v107 = hir.int_to_ptr v104 : ptr; + v108 = hir.load v107 : i64; + v327 = arith.constant 8 : u32; + v109 = hir.bitcast v101 : u32; + v111 = arith.add v109, v327 : u32 #[overflow = checked]; + v112 = arith.constant 4 : u32; + v113 = arith.mod v111, v112 : u32; + hir.assertz v113 #[code = 250]; + v114 = hir.int_to_ptr v111 : ptr; + hir.store v114, v108; + v115 = hir.bitcast v94 : u32; + v326 = arith.constant 8 : u32; + v117 = arith.mod v115, v326 : u32; + hir.assertz v117 #[code = 250]; + v118 = hir.int_to_ptr v115 : ptr; + v119 = hir.load v118 : i64; + v120 = hir.bitcast v101 : u32; + v325 = arith.constant 4 : u32; + v122 = arith.mod v120, v325 : u32; + hir.assertz v122 #[code = 250]; + v123 = hir.int_to_ptr v120 : ptr; + hir.store v123, v119; + v124 = arith.constant 12 : i32; + v125 = arith.add v101, v124 : i32 #[overflow = wrapping]; + v95 = arith.constant 0 : i32; + v296, v297, v298, v299, v300, v301 = scf.while v95, v101, v125, v93 : i32, i32, i32, i32, i32, i32 { + ^block35(v302: i32, v303: i32, v304: i32, v305: i32): + v324 = arith.constant 0 : i32; + v128 = arith.constant 8 : i32; + v129 = arith.eq v302, v128 : i1; + v130 = arith.zext v129 : u32; + v131 = hir.bitcast v130 : i32; + v133 = arith.neq v131, v324 : i1; + v290, v291 = scf.if v133 : i32, i32 { + ^block34: + v250 = ub.poison i32 : i32; + scf.yield v250, v250; + } else { + ^block20: + v135 = arith.add v303, v302 : i32 #[overflow = wrapping]; + v136 = hir.bitcast v135 : u32; + v323 = arith.constant 4 : u32; + v138 = arith.mod v136, v323 : u32; + hir.assertz v138 #[code = 250]; + v139 = hir.int_to_ptr v136 : ptr; + v140 = hir.load v139 : felt; + v142 = hir.bitcast v304 : u32; + v322 = arith.constant 4 : u32; + v144 = arith.mod v142, v322 : u32; + hir.assertz v144 #[code = 250]; + v145 = hir.int_to_ptr v142 : ptr; + v146 = hir.load v145 : i32; + v147 = hir.bitcast v135 : u32; + v321 = arith.constant 4 : u32; + v149 = arith.mod v147, v321 : u32; + hir.assertz v149 #[code = 250]; + v150 = hir.int_to_ptr v147 : ptr; + hir.store v150, v146; + v151 = hir.bitcast v304 : u32; + v320 = arith.constant 4 : u32; + v153 = arith.mod v151, v320 : u32; + hir.assertz v153 #[code = 250]; + v154 = hir.int_to_ptr v151 : ptr; + hir.store v154, v140; + v157 = arith.constant -4 : i32; + v158 = arith.add v304, v157 : i32 #[overflow = wrapping]; + v155 = arith.constant 4 : i32; + v156 = arith.add v302, v155 : i32 #[overflow = wrapping]; + scf.yield v156, v158; + }; + v318 = ub.poison i32 : i32; + v293 = cf.select v133, v318, v305 : i32; + v319 = ub.poison i32 : i32; + v292 = cf.select v133, v319, v303 : i32; + v249 = arith.constant 1 : u32; + v242 = arith.constant 0 : u32; + v295 = cf.select v133, v242, v249 : u32; + v283 = arith.trunc v295 : i1; + scf.condition v283, v290, v292, v291, v293, v303, v305; + } do { + ^block36(v306: i32, v307: i32, v308: i32, v309: i32, v310: i32, v311: i32): + scf.yield v306, v307, v308, v309; + }; + v317 = arith.constant 8 : u32; + v160 = hir.bitcast v300 : u32; + v162 = arith.add v160, v317 : u32 #[overflow = checked]; + v316 = arith.constant 4 : u32; + v164 = arith.mod v162, v316 : u32; + hir.assertz v164 #[code = 250]; + v165 = hir.int_to_ptr v162 : ptr; + v166 = hir.load v165 : i64; + v315 = arith.constant 8 : u32; + v167 = hir.bitcast v301 : u32; + v169 = arith.add v167, v315 : u32 #[overflow = checked]; + v314 = arith.constant 8 : u32; + v171 = arith.mod v169, v314 : u32; + hir.assertz v171 #[code = 250]; + v172 = hir.int_to_ptr v169 : ptr; + hir.store v172, v166; + v173 = hir.bitcast v300 : u32; + v313 = arith.constant 4 : u32; + v175 = arith.mod v173, v313 : u32; + hir.assertz v175 #[code = 250]; + v176 = hir.int_to_ptr v173 : ptr; + v177 = hir.load v176 : i64; + v178 = hir.bitcast v301 : u32; + v312 = arith.constant 8 : u32; + v180 = arith.mod v178, v312 : u32; + hir.assertz v180 #[code = 250]; + v181 = hir.int_to_ptr v178 : ptr; + hir.store v181, v177; + builtin.ret ; + }; + + private builtin.function @miden::active_account::compute_commitment(v182: i32) { + ^block21(v182: i32): + v183, v184, v185, v186 = hir.exec @miden/active_account/compute_commitment() : felt, felt, felt, felt + v187 = hir.bitcast v182 : u32; + v188 = hir.int_to_ptr v187 : ptr; + hir.store v188, v183; + v189 = arith.constant 4 : u32; + v190 = arith.add v187, v189 : u32 #[overflow = checked]; + v191 = hir.int_to_ptr v190 : ptr; + hir.store v191, v184; + v192 = arith.constant 8 : u32; + v193 = arith.add v187, v192 : u32 #[overflow = checked]; + v194 = hir.int_to_ptr v193 : ptr; + hir.store v194, v185; + v195 = arith.constant 12 : u32; + v196 = arith.add v187, v195 : u32 #[overflow = checked]; + v197 = hir.int_to_ptr v196 : ptr; + hir.store v197, v186; + builtin.ret ; + }; + + builtin.global_variable private @#__stack_pointer : i32 { + builtin.ret_imm 1048576; + }; + + builtin.global_variable private @#GOT.data.internal.__memory_base : i32 { + builtin.ret_imm 0; + }; + + builtin.segment @1048576 = 0x0000000100000001; + }; + + public builtin.function @binding() -> felt, felt, felt, felt { + ^block25: + v198 = hir.exec @miden:rust-sdk-account-compute-commitment-binding/rust-sdk-account-compute-commitment-binding@0.0.1/rust_sdk_account_compute_commitment_binding/miden:rust-sdk-account-compute-commitment-binding/rust-sdk-account-compute-commitment-binding@0.0.1#binding() : i32 + v199 = arith.constant 0 : i32; + v200 = arith.add v198, v199 : i32 #[overflow = unchecked]; + v332 = arith.constant 0 : i32; + v333 = arith.constant 0 : i32; + v202 = arith.add v200, v333 : i32 #[overflow = unchecked]; + v204 = arith.add v202, v332 : i32 #[overflow = unchecked]; + v205 = hir.int_to_ptr v204 : ptr; + v206 = hir.load v205 : felt; + v331 = arith.constant 0 : i32; + v207 = arith.constant 4 : i32; + v208 = arith.add v200, v207 : i32 #[overflow = unchecked]; + v210 = arith.add v208, v331 : i32 #[overflow = unchecked]; + v211 = hir.int_to_ptr v210 : ptr; + v212 = hir.load v211 : felt; + v330 = arith.constant 0 : i32; + v213 = arith.constant 8 : i32; + v214 = arith.add v200, v213 : i32 #[overflow = unchecked]; + v216 = arith.add v214, v330 : i32 #[overflow = unchecked]; + v217 = hir.int_to_ptr v216 : ptr; + v218 = hir.load v217 : felt; + v329 = arith.constant 0 : i32; + v219 = arith.constant 12 : i32; + v220 = arith.add v200, v219 : i32 #[overflow = unchecked]; + v222 = arith.add v220, v329 : i32 #[overflow = unchecked]; + v223 = hir.int_to_ptr v222 : ptr; + v224 = hir.load v223 : felt; + builtin.ret v206, v212, v218, v224; + }; +}; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_compute_commitment_binding.masm b/tests/integration/expected/rust_sdk/rust_sdk_account_compute_commitment_binding.masm new file mode 100644 index 000000000..9648e63db --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_compute_commitment_binding.masm @@ -0,0 +1,698 @@ +# mod miden:rust-sdk-account-compute-commitment-binding/rust-sdk-account-compute-commitment-binding@0.0.1 + +@callconv("canon-lift") +pub proc binding( + +) -> (felt, felt, felt, felt) + exec.::miden:rust-sdk-account-compute-commitment-binding/rust-sdk-account-compute-commitment-binding@0.0.1::init + trace.240 + nop + exec.::miden:rust-sdk-account-compute-commitment-binding/rust-sdk-account-compute-commitment-binding@0.0.1::rust_sdk_account_compute_commitment_binding::miden:rust-sdk-account-compute-commitment-binding/rust-sdk-account-compute-commitment-binding@0.0.1#binding + trace.252 + nop + push.0 + u32wrapping_add + push.0 + push.0 + dup.2 + u32wrapping_add + u32wrapping_add + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.0 + push.4 + dup.3 + u32wrapping_add + u32wrapping_add + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.0 + push.8 + dup.4 + u32wrapping_add + u32wrapping_add + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.0 + push.12 + movup.5 + u32wrapping_add + u32wrapping_add + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + movdn.3 + swap.2 + exec.::std::sys::truncate_stack +end + +proc init + push.1179648 + trace.240 + exec.::intrinsics::mem::heap_init + trace.252 + push.[7028007876379170725,18060021366771303825,13412364500725888848,14178532912296021363] + adv.push_mapval + push.262144 + push.1 + trace.240 + exec.::std::mem::pipe_preimage_to_memory + trace.252 + drop + push.1048576 + u32assert + mem_store.278536 + push.0 + u32assert + mem_store.278537 +end + +# mod miden:rust-sdk-account-compute-commitment-binding/rust-sdk-account-compute-commitment-binding@0.0.1::rust_sdk_account_compute_commitment_binding + +@callconv("C") +proc __wasm_call_ctors( + +) + nop +end + +@callconv("C") +proc rust_sdk_account_compute_commitment_binding::bindings::__link_custom_section_describing_imports( + +) + nop +end + +@callconv("C") +proc miden:rust-sdk-account-compute-commitment-binding/rust-sdk-account-compute-commitment-binding@0.0.1#binding( + +) -> i32 + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.48 + u32wrapping_sub + push.1114144 + dup.1 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + trace.240 + nop + exec.::miden:rust-sdk-account-compute-commitment-binding/rust-sdk-account-compute-commitment-binding@0.0.1::rust_sdk_account_compute_commitment_binding::wit_bindgen::rt::run_ctors_once + trace.252 + nop + push.16 + dup.1 + u32wrapping_add + trace.240 + nop + exec.::miden:rust-sdk-account-compute-commitment-binding/rust-sdk-account-compute-commitment-binding@0.0.1::rust_sdk_account_compute_commitment_binding::miden::active_account::compute_commitment + trace.252 + nop + push.24 + dup.1 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.40 + dup.3 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.16 + dup.1 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.32 + dup.3 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.1114148 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.32 + dup.2 + u32wrapping_add + dup.2 + trace.240 + nop + exec.::miden:rust-sdk-account-compute-commitment-binding/rust-sdk-account-compute-commitment-binding@0.0.1::rust_sdk_account_compute_commitment_binding::miden_stdlib_sys::intrinsics::word::Word::reverse + trace.252 + nop + push.1048584 + u32wrapping_add + push.8 + dup.2 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.8 + dup.3 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + dup.1 + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + dup.2 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.48 + movup.2 + u32wrapping_add + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop +end + +@callconv("C") +proc wit_bindgen::rt::run_ctors_once( + +) + push.1114148 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.1048600 + u32wrapping_add + u32divmod.4 + swap.1 + swap.1 + dup.1 + mem_load + swap.1 + push.8 + u32wrapping_mul + u32shr + swap.1 + drop + push.255 + u32and + push.0 + swap.1 + neq + if.true + nop + else + push.1114148 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + trace.240 + nop + exec.::miden:rust-sdk-account-compute-commitment-binding/rust-sdk-account-compute-commitment-binding@0.0.1::rust_sdk_account_compute_commitment_binding::__wasm_call_ctors + trace.252 + nop + push.1 + push.1048600 + movup.2 + u32wrapping_add + u32divmod.4 + swap.1 + dup.0 + mem_load + dup.2 + push.8 + u32wrapping_mul + push.255 + swap.1 + u32shl + u32not + swap.1 + u32and + movup.3 + movup.3 + push.8 + u32wrapping_mul + u32shl + u32or + swap.1 + mem_store + end +end + +@callconv("C") +proc miden_stdlib_sys::intrinsics::word::Word::reverse( + i32, + i32 +) + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.16 + u32wrapping_sub + push.8 + dup.3 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.8 + dup.3 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + movup.2 + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + dup.2 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.12 + dup.1 + u32wrapping_add + push.0 + movup.2 + swap.1 + push.1 + while.true + push.0 + push.8 + dup.2 + eq + neq + dup.0 + if.true + movup.3 + movup.2 + drop + drop + push.3735929054 + dup.0 + else + dup.2 + dup.2 + u32wrapping_add + dup.0 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + dup.5 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + movup.2 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + dup.4 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.4294967292 + movup.4 + u32wrapping_add + push.4 + movup.3 + u32wrapping_add + end + push.3735929054 + dup.3 + dup.6 + swap.2 + swap.1 + cdrop + push.3735929054 + dup.4 + dup.6 + swap.2 + swap.1 + cdrop + push.1 + push.0 + movup.6 + cdrop + push.1 + u32and + swap.1 + swap.2 + swap.4 + swap.3 + swap.1 + if.true + movup.4 + drop + movup.4 + drop + push.1 + else + push.0 + end + end + drop + drop + drop + drop + push.8 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.8 + dup.4 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + movup.2 + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop +end + +@callconv("C") +proc miden::active_account::compute_commitment(i32) + trace.240 + nop + exec.::miden::active_account::compute_commitment + trace.252 + nop + movup.4 + dup.0 + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.4 + dup.1 + add + u32assert + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.8 + dup.1 + add + u32assert + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.12 + add + u32assert + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop +end + diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_compute_commitment_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_account_compute_commitment_binding.wat new file mode 100644 index 000000000..6170926eb --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_compute_commitment_binding.wat @@ -0,0 +1,181 @@ +(component + (type (;0;) + (instance + (type (;0;) (record (field "inner" f32))) + (export (;1;) "felt" (type (eq 0))) + (type (;2;) (tuple 1 1 1 1)) + (type (;3;) (record (field "inner" 2))) + (export (;4;) "word" (type (eq 3))) + ) + ) + (import "miden:base/core-types@1.0.0" (instance (;0;) (type 0))) + (core module (;0;) + (type (;0;) (func)) + (type (;1;) (func (result i32))) + (type (;2;) (func (param i32 i32))) + (type (;3;) (func (param i32))) + (table (;0;) 2 2 funcref) + (memory (;0;) 17) + (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) + (global $GOT.data.internal.__memory_base (;1;) i32 i32.const 0) + (export "memory" (memory 0)) + (export "miden:rust-sdk-account-compute-commitment-binding/rust-sdk-account-compute-commitment-binding@0.0.1#binding" (func $miden:rust-sdk-account-compute-commitment-binding/rust-sdk-account-compute-commitment-binding@0.0.1#binding)) + (elem (;0;) (i32.const 1) func $rust_sdk_account_compute_commitment_binding::bindings::__link_custom_section_describing_imports) + (func $__wasm_call_ctors (;0;) (type 0)) + (func $rust_sdk_account_compute_commitment_binding::bindings::__link_custom_section_describing_imports (;1;) (type 0)) + (func $miden:rust-sdk-account-compute-commitment-binding/rust-sdk-account-compute-commitment-binding@0.0.1#binding (;2;) (type 1) (result i32) + (local i32 i32) + global.get $__stack_pointer + i32.const 48 + i32.sub + local.tee 0 + global.set $__stack_pointer + call $wit_bindgen::rt::run_ctors_once + local.get 0 + i32.const 16 + i32.add + call $miden::active_account::compute_commitment + local.get 0 + local.get 0 + i64.load offset=24 + i64.store offset=40 + local.get 0 + local.get 0 + i64.load offset=16 + i64.store offset=32 + global.get $GOT.data.internal.__memory_base + local.set 1 + local.get 0 + local.get 0 + i32.const 32 + i32.add + call $miden_stdlib_sys::intrinsics::word::Word::reverse + local.get 1 + i32.const 1048584 + i32.add + local.tee 1 + local.get 0 + i64.load offset=8 + i64.store offset=8 align=4 + local.get 1 + local.get 0 + i64.load + i64.store align=4 + local.get 0 + i32.const 48 + i32.add + global.set $__stack_pointer + local.get 1 + ) + (func $wit_bindgen::rt::run_ctors_once (;3;) (type 0) + (local i32) + block ;; label = @1 + global.get $GOT.data.internal.__memory_base + i32.const 1048600 + i32.add + i32.load8_u + br_if 0 (;@1;) + global.get $GOT.data.internal.__memory_base + local.set 0 + call $__wasm_call_ctors + local.get 0 + i32.const 1048600 + i32.add + i32.const 1 + i32.store8 + end + ) + (func $miden_stdlib_sys::intrinsics::word::Word::reverse (;4;) (type 2) (param i32 i32) + (local i32 i32 i32 f32) + global.get $__stack_pointer + i32.const 16 + i32.sub + local.tee 2 + local.get 1 + i64.load offset=8 + i64.store offset=8 align=4 + local.get 2 + local.get 1 + i64.load + i64.store align=4 + local.get 2 + i32.const 12 + i32.add + local.set 3 + i32.const 0 + local.set 1 + block ;; label = @1 + loop ;; label = @2 + local.get 1 + i32.const 8 + i32.eq + br_if 1 (;@1;) + local.get 2 + local.get 1 + i32.add + local.tee 4 + f32.load + local.set 5 + local.get 4 + local.get 3 + i32.load + i32.store + local.get 3 + local.get 5 + f32.store + local.get 1 + i32.const 4 + i32.add + local.set 1 + local.get 3 + i32.const -4 + i32.add + local.set 3 + br 0 (;@2;) + end + end + local.get 0 + local.get 2 + i64.load offset=8 align=4 + i64.store offset=8 + local.get 0 + local.get 2 + i64.load align=4 + i64.store + ) + (func $miden::active_account::compute_commitment (;5;) (type 3) (param i32) + unreachable + ) + (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") + (@custom "rodata,miden_account" (after data) "Wrust_sdk_account_compute_commitment_binding\01\0b0.0.1\03\01\01\00\00\00\00\00\00\00\00\00\00") + ) + (alias export 0 "word" (type (;1;))) + (core instance (;0;) (instantiate 0)) + (alias core export 0 "memory" (core memory (;0;))) + (type (;2;) (func (result 1))) + (alias core export 0 "miden:rust-sdk-account-compute-commitment-binding/rust-sdk-account-compute-commitment-binding@0.0.1#binding" (core func (;0;))) + (func (;0;) (type 2) (canon lift (core func 0) (memory 0))) + (alias export 0 "felt" (type (;3;))) + (alias export 0 "word" (type (;4;))) + (component (;0;) + (type (;0;) (record (field "inner" f32))) + (import "import-type-felt" (type (;1;) (eq 0))) + (type (;2;) (tuple 1 1 1 1)) + (type (;3;) (record (field "inner" 2))) + (import "import-type-word" (type (;4;) (eq 3))) + (import "import-type-word0" (type (;5;) (eq 4))) + (type (;6;) (func (result 5))) + (import "import-func-binding" (func (;0;) (type 6))) + (export (;7;) "word" (type 4)) + (type (;8;) (func (result 7))) + (export (;1;) "binding" (func 0) (func (type 8))) + ) + (instance (;1;) (instantiate 0 + (with "import-func-binding" (func 0)) + (with "import-type-felt" (type 3)) + (with "import-type-word" (type 4)) + (with "import-type-word0" (type 1)) + ) + ) + (export (;2;) "miden:rust-sdk-account-compute-commitment-binding/rust-sdk-account-compute-commitment-binding@0.0.1" (instance 1)) +) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_compute_delta_commitment_binding.hir b/tests/integration/expected/rust_sdk/rust_sdk_account_compute_delta_commitment_binding.hir new file mode 100644 index 000000000..26d7889b4 --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_compute_delta_commitment_binding.hir @@ -0,0 +1,327 @@ +builtin.component miden:rust-sdk-account-compute-delta-commitment-binding/rust-sdk-account-compute-delta-commitment-binding@0.0.1 { + builtin.module public @rust_sdk_account_compute_delta_commitment_binding { + private builtin.function @__wasm_call_ctors() { + ^block5: + builtin.ret ; + }; + + private builtin.function @rust_sdk_account_compute_delta_commitment_binding::bindings::__link_custom_section_describing_imports() { + ^block7: + builtin.ret ; + }; + + private builtin.function @miden:rust-sdk-account-compute-delta-commitment-binding/rust-sdk-account-compute-delta-commitment-binding@0.0.1#binding() -> i32 { + ^block9: + v2 = builtin.global_symbol @miden:rust-sdk-account-compute-delta-commitment-binding/rust-sdk-account-compute-delta-commitment-binding@0.0.1/rust_sdk_account_compute_delta_commitment_binding/__stack_pointer : ptr + v3 = hir.bitcast v2 : ptr; + v4 = hir.load v3 : i32; + v5 = arith.constant 48 : i32; + v6 = arith.sub v4, v5 : i32 #[overflow = wrapping]; + v7 = builtin.global_symbol @miden:rust-sdk-account-compute-delta-commitment-binding/rust-sdk-account-compute-delta-commitment-binding@0.0.1/rust_sdk_account_compute_delta_commitment_binding/__stack_pointer : ptr + v8 = hir.bitcast v7 : ptr; + hir.store v8, v6; + hir.exec @miden:rust-sdk-account-compute-delta-commitment-binding/rust-sdk-account-compute-delta-commitment-binding@0.0.1/rust_sdk_account_compute_delta_commitment_binding/wit_bindgen::rt::run_ctors_once() + v9 = arith.constant 16 : i32; + v10 = arith.add v6, v9 : i32 #[overflow = wrapping]; + hir.exec @miden:rust-sdk-account-compute-delta-commitment-binding/rust-sdk-account-compute-delta-commitment-binding@0.0.1/rust_sdk_account_compute_delta_commitment_binding/miden::native_account::compute_delta_commitment(v10) + v12 = arith.constant 24 : u32; + v11 = hir.bitcast v6 : u32; + v13 = arith.add v11, v12 : u32 #[overflow = checked]; + v14 = arith.constant 8 : u32; + v15 = arith.mod v13, v14 : u32; + hir.assertz v15 #[code = 250]; + v16 = hir.int_to_ptr v13 : ptr; + v17 = hir.load v16 : i64; + v19 = arith.constant 40 : u32; + v18 = hir.bitcast v6 : u32; + v20 = arith.add v18, v19 : u32 #[overflow = checked]; + v237 = arith.constant 8 : u32; + v22 = arith.mod v20, v237 : u32; + hir.assertz v22 #[code = 250]; + v23 = hir.int_to_ptr v20 : ptr; + hir.store v23, v17; + v25 = arith.constant 16 : u32; + v24 = hir.bitcast v6 : u32; + v26 = arith.add v24, v25 : u32 #[overflow = checked]; + v236 = arith.constant 8 : u32; + v28 = arith.mod v26, v236 : u32; + hir.assertz v28 #[code = 250]; + v29 = hir.int_to_ptr v26 : ptr; + v30 = hir.load v29 : i64; + v32 = arith.constant 32 : u32; + v31 = hir.bitcast v6 : u32; + v33 = arith.add v31, v32 : u32 #[overflow = checked]; + v235 = arith.constant 8 : u32; + v35 = arith.mod v33, v235 : u32; + hir.assertz v35 #[code = 250]; + v36 = hir.int_to_ptr v33 : ptr; + hir.store v36, v30; + v37 = builtin.global_symbol @miden:rust-sdk-account-compute-delta-commitment-binding/rust-sdk-account-compute-delta-commitment-binding@0.0.1/rust_sdk_account_compute_delta_commitment_binding/GOT.data.internal.__memory_base : ptr + v38 = hir.bitcast v37 : ptr; + v39 = hir.load v38 : i32; + v40 = arith.constant 32 : i32; + v41 = arith.add v6, v40 : i32 #[overflow = wrapping]; + hir.exec @miden:rust-sdk-account-compute-delta-commitment-binding/rust-sdk-account-compute-delta-commitment-binding@0.0.1/rust_sdk_account_compute_delta_commitment_binding/miden_stdlib_sys::intrinsics::word::Word::reverse(v6, v41) + v42 = arith.constant 1048584 : i32; + v43 = arith.add v39, v42 : i32 #[overflow = wrapping]; + v234 = arith.constant 8 : u32; + v44 = hir.bitcast v6 : u32; + v46 = arith.add v44, v234 : u32 #[overflow = checked]; + v233 = arith.constant 8 : u32; + v48 = arith.mod v46, v233 : u32; + hir.assertz v48 #[code = 250]; + v49 = hir.int_to_ptr v46 : ptr; + v50 = hir.load v49 : i64; + v232 = arith.constant 8 : u32; + v51 = hir.bitcast v43 : u32; + v53 = arith.add v51, v232 : u32 #[overflow = checked]; + v54 = arith.constant 4 : u32; + v55 = arith.mod v53, v54 : u32; + hir.assertz v55 #[code = 250]; + v56 = hir.int_to_ptr v53 : ptr; + hir.store v56, v50; + v57 = hir.bitcast v6 : u32; + v231 = arith.constant 8 : u32; + v59 = arith.mod v57, v231 : u32; + hir.assertz v59 #[code = 250]; + v60 = hir.int_to_ptr v57 : ptr; + v61 = hir.load v60 : i64; + v62 = hir.bitcast v43 : u32; + v230 = arith.constant 4 : u32; + v64 = arith.mod v62, v230 : u32; + hir.assertz v64 #[code = 250]; + v65 = hir.int_to_ptr v62 : ptr; + hir.store v65, v61; + v229 = arith.constant 48 : i32; + v67 = arith.add v6, v229 : i32 #[overflow = wrapping]; + v68 = builtin.global_symbol @miden:rust-sdk-account-compute-delta-commitment-binding/rust-sdk-account-compute-delta-commitment-binding@0.0.1/rust_sdk_account_compute_delta_commitment_binding/__stack_pointer : ptr + v69 = hir.bitcast v68 : ptr; + hir.store v69, v67; + builtin.ret v43; + }; + + private builtin.function @wit_bindgen::rt::run_ctors_once() { + ^block11: + v71 = builtin.global_symbol @miden:rust-sdk-account-compute-delta-commitment-binding/rust-sdk-account-compute-delta-commitment-binding@0.0.1/rust_sdk_account_compute_delta_commitment_binding/GOT.data.internal.__memory_base : ptr + v72 = hir.bitcast v71 : ptr; + v73 = hir.load v72 : i32; + v74 = arith.constant 1048600 : i32; + v75 = arith.add v73, v74 : i32 #[overflow = wrapping]; + v76 = hir.bitcast v75 : u32; + v77 = hir.int_to_ptr v76 : ptr; + v78 = hir.load v77 : u8; + v70 = arith.constant 0 : i32; + v79 = arith.zext v78 : u32; + v80 = hir.bitcast v79 : i32; + v82 = arith.neq v80, v70 : i1; + scf.if v82{ + ^block13: + scf.yield ; + } else { + ^block14: + v83 = builtin.global_symbol @miden:rust-sdk-account-compute-delta-commitment-binding/rust-sdk-account-compute-delta-commitment-binding@0.0.1/rust_sdk_account_compute_delta_commitment_binding/GOT.data.internal.__memory_base : ptr + v84 = hir.bitcast v83 : ptr; + v85 = hir.load v84 : i32; + hir.exec @miden:rust-sdk-account-compute-delta-commitment-binding/rust-sdk-account-compute-delta-commitment-binding@0.0.1/rust_sdk_account_compute_delta_commitment_binding/__wasm_call_ctors() + v239 = arith.constant 1 : u8; + v241 = arith.constant 1048600 : i32; + v87 = arith.add v85, v241 : i32 #[overflow = wrapping]; + v91 = hir.bitcast v87 : u32; + v92 = hir.int_to_ptr v91 : ptr; + hir.store v92, v239; + scf.yield ; + }; + builtin.ret ; + }; + + private builtin.function @miden_stdlib_sys::intrinsics::word::Word::reverse(v93: i32, v94: i32) { + ^block15(v93: i32, v94: i32): + v97 = builtin.global_symbol @miden:rust-sdk-account-compute-delta-commitment-binding/rust-sdk-account-compute-delta-commitment-binding@0.0.1/rust_sdk_account_compute_delta_commitment_binding/__stack_pointer : ptr + v98 = hir.bitcast v97 : ptr; + v99 = hir.load v98 : i32; + v100 = arith.constant 16 : i32; + v101 = arith.sub v99, v100 : i32 #[overflow = wrapping]; + v103 = arith.constant 8 : u32; + v102 = hir.bitcast v94 : u32; + v104 = arith.add v102, v103 : u32 #[overflow = checked]; + v328 = arith.constant 8 : u32; + v106 = arith.mod v104, v328 : u32; + hir.assertz v106 #[code = 250]; + v107 = hir.int_to_ptr v104 : ptr; + v108 = hir.load v107 : i64; + v327 = arith.constant 8 : u32; + v109 = hir.bitcast v101 : u32; + v111 = arith.add v109, v327 : u32 #[overflow = checked]; + v112 = arith.constant 4 : u32; + v113 = arith.mod v111, v112 : u32; + hir.assertz v113 #[code = 250]; + v114 = hir.int_to_ptr v111 : ptr; + hir.store v114, v108; + v115 = hir.bitcast v94 : u32; + v326 = arith.constant 8 : u32; + v117 = arith.mod v115, v326 : u32; + hir.assertz v117 #[code = 250]; + v118 = hir.int_to_ptr v115 : ptr; + v119 = hir.load v118 : i64; + v120 = hir.bitcast v101 : u32; + v325 = arith.constant 4 : u32; + v122 = arith.mod v120, v325 : u32; + hir.assertz v122 #[code = 250]; + v123 = hir.int_to_ptr v120 : ptr; + hir.store v123, v119; + v124 = arith.constant 12 : i32; + v125 = arith.add v101, v124 : i32 #[overflow = wrapping]; + v95 = arith.constant 0 : i32; + v296, v297, v298, v299, v300, v301 = scf.while v95, v101, v125, v93 : i32, i32, i32, i32, i32, i32 { + ^block35(v302: i32, v303: i32, v304: i32, v305: i32): + v324 = arith.constant 0 : i32; + v128 = arith.constant 8 : i32; + v129 = arith.eq v302, v128 : i1; + v130 = arith.zext v129 : u32; + v131 = hir.bitcast v130 : i32; + v133 = arith.neq v131, v324 : i1; + v290, v291 = scf.if v133 : i32, i32 { + ^block34: + v250 = ub.poison i32 : i32; + scf.yield v250, v250; + } else { + ^block20: + v135 = arith.add v303, v302 : i32 #[overflow = wrapping]; + v136 = hir.bitcast v135 : u32; + v323 = arith.constant 4 : u32; + v138 = arith.mod v136, v323 : u32; + hir.assertz v138 #[code = 250]; + v139 = hir.int_to_ptr v136 : ptr; + v140 = hir.load v139 : felt; + v142 = hir.bitcast v304 : u32; + v322 = arith.constant 4 : u32; + v144 = arith.mod v142, v322 : u32; + hir.assertz v144 #[code = 250]; + v145 = hir.int_to_ptr v142 : ptr; + v146 = hir.load v145 : i32; + v147 = hir.bitcast v135 : u32; + v321 = arith.constant 4 : u32; + v149 = arith.mod v147, v321 : u32; + hir.assertz v149 #[code = 250]; + v150 = hir.int_to_ptr v147 : ptr; + hir.store v150, v146; + v151 = hir.bitcast v304 : u32; + v320 = arith.constant 4 : u32; + v153 = arith.mod v151, v320 : u32; + hir.assertz v153 #[code = 250]; + v154 = hir.int_to_ptr v151 : ptr; + hir.store v154, v140; + v157 = arith.constant -4 : i32; + v158 = arith.add v304, v157 : i32 #[overflow = wrapping]; + v155 = arith.constant 4 : i32; + v156 = arith.add v302, v155 : i32 #[overflow = wrapping]; + scf.yield v156, v158; + }; + v318 = ub.poison i32 : i32; + v293 = cf.select v133, v318, v305 : i32; + v319 = ub.poison i32 : i32; + v292 = cf.select v133, v319, v303 : i32; + v249 = arith.constant 1 : u32; + v242 = arith.constant 0 : u32; + v295 = cf.select v133, v242, v249 : u32; + v283 = arith.trunc v295 : i1; + scf.condition v283, v290, v292, v291, v293, v303, v305; + } do { + ^block36(v306: i32, v307: i32, v308: i32, v309: i32, v310: i32, v311: i32): + scf.yield v306, v307, v308, v309; + }; + v317 = arith.constant 8 : u32; + v160 = hir.bitcast v300 : u32; + v162 = arith.add v160, v317 : u32 #[overflow = checked]; + v316 = arith.constant 4 : u32; + v164 = arith.mod v162, v316 : u32; + hir.assertz v164 #[code = 250]; + v165 = hir.int_to_ptr v162 : ptr; + v166 = hir.load v165 : i64; + v315 = arith.constant 8 : u32; + v167 = hir.bitcast v301 : u32; + v169 = arith.add v167, v315 : u32 #[overflow = checked]; + v314 = arith.constant 8 : u32; + v171 = arith.mod v169, v314 : u32; + hir.assertz v171 #[code = 250]; + v172 = hir.int_to_ptr v169 : ptr; + hir.store v172, v166; + v173 = hir.bitcast v300 : u32; + v313 = arith.constant 4 : u32; + v175 = arith.mod v173, v313 : u32; + hir.assertz v175 #[code = 250]; + v176 = hir.int_to_ptr v173 : ptr; + v177 = hir.load v176 : i64; + v178 = hir.bitcast v301 : u32; + v312 = arith.constant 8 : u32; + v180 = arith.mod v178, v312 : u32; + hir.assertz v180 #[code = 250]; + v181 = hir.int_to_ptr v178 : ptr; + hir.store v181, v177; + builtin.ret ; + }; + + private builtin.function @miden::native_account::compute_delta_commitment(v182: i32) { + ^block21(v182: i32): + v183, v184, v185, v186 = hir.exec @miden/native_account/compute_delta_commitment() : felt, felt, felt, felt + v187 = hir.bitcast v182 : u32; + v188 = hir.int_to_ptr v187 : ptr; + hir.store v188, v183; + v189 = arith.constant 4 : u32; + v190 = arith.add v187, v189 : u32 #[overflow = checked]; + v191 = hir.int_to_ptr v190 : ptr; + hir.store v191, v184; + v192 = arith.constant 8 : u32; + v193 = arith.add v187, v192 : u32 #[overflow = checked]; + v194 = hir.int_to_ptr v193 : ptr; + hir.store v194, v185; + v195 = arith.constant 12 : u32; + v196 = arith.add v187, v195 : u32 #[overflow = checked]; + v197 = hir.int_to_ptr v196 : ptr; + hir.store v197, v186; + builtin.ret ; + }; + + builtin.global_variable private @#__stack_pointer : i32 { + builtin.ret_imm 1048576; + }; + + builtin.global_variable private @#GOT.data.internal.__memory_base : i32 { + builtin.ret_imm 0; + }; + + builtin.segment @1048576 = 0x0000000100000001; + }; + + public builtin.function @binding() -> felt, felt, felt, felt { + ^block25: + v198 = hir.exec @miden:rust-sdk-account-compute-delta-commitment-binding/rust-sdk-account-compute-delta-commitment-binding@0.0.1/rust_sdk_account_compute_delta_commitment_binding/miden:rust-sdk-account-compute-delta-commitment-binding/rust-sdk-account-compute-delta-commitment-binding@0.0.1#binding() : i32 + v199 = arith.constant 0 : i32; + v200 = arith.add v198, v199 : i32 #[overflow = unchecked]; + v332 = arith.constant 0 : i32; + v333 = arith.constant 0 : i32; + v202 = arith.add v200, v333 : i32 #[overflow = unchecked]; + v204 = arith.add v202, v332 : i32 #[overflow = unchecked]; + v205 = hir.int_to_ptr v204 : ptr; + v206 = hir.load v205 : felt; + v331 = arith.constant 0 : i32; + v207 = arith.constant 4 : i32; + v208 = arith.add v200, v207 : i32 #[overflow = unchecked]; + v210 = arith.add v208, v331 : i32 #[overflow = unchecked]; + v211 = hir.int_to_ptr v210 : ptr; + v212 = hir.load v211 : felt; + v330 = arith.constant 0 : i32; + v213 = arith.constant 8 : i32; + v214 = arith.add v200, v213 : i32 #[overflow = unchecked]; + v216 = arith.add v214, v330 : i32 #[overflow = unchecked]; + v217 = hir.int_to_ptr v216 : ptr; + v218 = hir.load v217 : felt; + v329 = arith.constant 0 : i32; + v219 = arith.constant 12 : i32; + v220 = arith.add v200, v219 : i32 #[overflow = unchecked]; + v222 = arith.add v220, v329 : i32 #[overflow = unchecked]; + v223 = hir.int_to_ptr v222 : ptr; + v224 = hir.load v223 : felt; + builtin.ret v206, v212, v218, v224; + }; +}; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_compute_delta_commitment_binding.masm b/tests/integration/expected/rust_sdk/rust_sdk_account_compute_delta_commitment_binding.masm new file mode 100644 index 000000000..6d57357c6 --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_compute_delta_commitment_binding.masm @@ -0,0 +1,698 @@ +# mod miden:rust-sdk-account-compute-delta-commitment-binding/rust-sdk-account-compute-delta-commitment-binding@0.0.1 + +@callconv("canon-lift") +pub proc binding( + +) -> (felt, felt, felt, felt) + exec.::miden:rust-sdk-account-compute-delta-commitment-binding/rust-sdk-account-compute-delta-commitment-binding@0.0.1::init + trace.240 + nop + exec.::miden:rust-sdk-account-compute-delta-commitment-binding/rust-sdk-account-compute-delta-commitment-binding@0.0.1::rust_sdk_account_compute_delta_commitment_binding::miden:rust-sdk-account-compute-delta-commitment-binding/rust-sdk-account-compute-delta-commitment-binding@0.0.1#binding + trace.252 + nop + push.0 + u32wrapping_add + push.0 + push.0 + dup.2 + u32wrapping_add + u32wrapping_add + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.0 + push.4 + dup.3 + u32wrapping_add + u32wrapping_add + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.0 + push.8 + dup.4 + u32wrapping_add + u32wrapping_add + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.0 + push.12 + movup.5 + u32wrapping_add + u32wrapping_add + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + movdn.3 + swap.2 + exec.::std::sys::truncate_stack +end + +proc init + push.1179648 + trace.240 + exec.::intrinsics::mem::heap_init + trace.252 + push.[7028007876379170725,18060021366771303825,13412364500725888848,14178532912296021363] + adv.push_mapval + push.262144 + push.1 + trace.240 + exec.::std::mem::pipe_preimage_to_memory + trace.252 + drop + push.1048576 + u32assert + mem_store.278536 + push.0 + u32assert + mem_store.278537 +end + +# mod miden:rust-sdk-account-compute-delta-commitment-binding/rust-sdk-account-compute-delta-commitment-binding@0.0.1::rust_sdk_account_compute_delta_commitment_binding + +@callconv("C") +proc __wasm_call_ctors( + +) + nop +end + +@callconv("C") +proc rust_sdk_account_compute_delta_commitment_binding::bindings::__link_custom_section_describing_imports( + +) + nop +end + +@callconv("C") +proc miden:rust-sdk-account-compute-delta-commitment-binding/rust-sdk-account-compute-delta-commitment-binding@0.0.1#binding( + +) -> i32 + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.48 + u32wrapping_sub + push.1114144 + dup.1 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + trace.240 + nop + exec.::miden:rust-sdk-account-compute-delta-commitment-binding/rust-sdk-account-compute-delta-commitment-binding@0.0.1::rust_sdk_account_compute_delta_commitment_binding::wit_bindgen::rt::run_ctors_once + trace.252 + nop + push.16 + dup.1 + u32wrapping_add + trace.240 + nop + exec.::miden:rust-sdk-account-compute-delta-commitment-binding/rust-sdk-account-compute-delta-commitment-binding@0.0.1::rust_sdk_account_compute_delta_commitment_binding::miden::native_account::compute_delta_commitment + trace.252 + nop + push.24 + dup.1 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.40 + dup.3 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.16 + dup.1 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.32 + dup.3 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.1114148 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.32 + dup.2 + u32wrapping_add + dup.2 + trace.240 + nop + exec.::miden:rust-sdk-account-compute-delta-commitment-binding/rust-sdk-account-compute-delta-commitment-binding@0.0.1::rust_sdk_account_compute_delta_commitment_binding::miden_stdlib_sys::intrinsics::word::Word::reverse + trace.252 + nop + push.1048584 + u32wrapping_add + push.8 + dup.2 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.8 + dup.3 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + dup.1 + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + dup.2 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.48 + movup.2 + u32wrapping_add + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop +end + +@callconv("C") +proc wit_bindgen::rt::run_ctors_once( + +) + push.1114148 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.1048600 + u32wrapping_add + u32divmod.4 + swap.1 + swap.1 + dup.1 + mem_load + swap.1 + push.8 + u32wrapping_mul + u32shr + swap.1 + drop + push.255 + u32and + push.0 + swap.1 + neq + if.true + nop + else + push.1114148 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + trace.240 + nop + exec.::miden:rust-sdk-account-compute-delta-commitment-binding/rust-sdk-account-compute-delta-commitment-binding@0.0.1::rust_sdk_account_compute_delta_commitment_binding::__wasm_call_ctors + trace.252 + nop + push.1 + push.1048600 + movup.2 + u32wrapping_add + u32divmod.4 + swap.1 + dup.0 + mem_load + dup.2 + push.8 + u32wrapping_mul + push.255 + swap.1 + u32shl + u32not + swap.1 + u32and + movup.3 + movup.3 + push.8 + u32wrapping_mul + u32shl + u32or + swap.1 + mem_store + end +end + +@callconv("C") +proc miden_stdlib_sys::intrinsics::word::Word::reverse( + i32, + i32 +) + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.16 + u32wrapping_sub + push.8 + dup.3 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.8 + dup.3 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + movup.2 + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + dup.2 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.12 + dup.1 + u32wrapping_add + push.0 + movup.2 + swap.1 + push.1 + while.true + push.0 + push.8 + dup.2 + eq + neq + dup.0 + if.true + movup.3 + movup.2 + drop + drop + push.3735929054 + dup.0 + else + dup.2 + dup.2 + u32wrapping_add + dup.0 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + dup.5 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + movup.2 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + dup.4 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.4294967292 + movup.4 + u32wrapping_add + push.4 + movup.3 + u32wrapping_add + end + push.3735929054 + dup.3 + dup.6 + swap.2 + swap.1 + cdrop + push.3735929054 + dup.4 + dup.6 + swap.2 + swap.1 + cdrop + push.1 + push.0 + movup.6 + cdrop + push.1 + u32and + swap.1 + swap.2 + swap.4 + swap.3 + swap.1 + if.true + movup.4 + drop + movup.4 + drop + push.1 + else + push.0 + end + end + drop + drop + drop + drop + push.8 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.8 + dup.4 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + movup.2 + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop +end + +@callconv("C") +proc miden::native_account::compute_delta_commitment(i32) + trace.240 + nop + exec.::miden::native_account::compute_delta_commitment + trace.252 + nop + movup.4 + dup.0 + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.4 + dup.1 + add + u32assert + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.8 + dup.1 + add + u32assert + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.12 + add + u32assert + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop +end + diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_compute_delta_commitment_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_account_compute_delta_commitment_binding.wat new file mode 100644 index 000000000..bd81f98d2 --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_compute_delta_commitment_binding.wat @@ -0,0 +1,181 @@ +(component + (type (;0;) + (instance + (type (;0;) (record (field "inner" f32))) + (export (;1;) "felt" (type (eq 0))) + (type (;2;) (tuple 1 1 1 1)) + (type (;3;) (record (field "inner" 2))) + (export (;4;) "word" (type (eq 3))) + ) + ) + (import "miden:base/core-types@1.0.0" (instance (;0;) (type 0))) + (core module (;0;) + (type (;0;) (func)) + (type (;1;) (func (result i32))) + (type (;2;) (func (param i32 i32))) + (type (;3;) (func (param i32))) + (table (;0;) 2 2 funcref) + (memory (;0;) 17) + (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) + (global $GOT.data.internal.__memory_base (;1;) i32 i32.const 0) + (export "memory" (memory 0)) + (export "miden:rust-sdk-account-compute-delta-commitment-binding/rust-sdk-account-compute-delta-commitment-binding@0.0.1#binding" (func $miden:rust-sdk-account-compute-delta-commitment-binding/rust-sdk-account-compute-delta-commitment-binding@0.0.1#binding)) + (elem (;0;) (i32.const 1) func $rust_sdk_account_compute_delta_commitment_binding::bindings::__link_custom_section_describing_imports) + (func $__wasm_call_ctors (;0;) (type 0)) + (func $rust_sdk_account_compute_delta_commitment_binding::bindings::__link_custom_section_describing_imports (;1;) (type 0)) + (func $miden:rust-sdk-account-compute-delta-commitment-binding/rust-sdk-account-compute-delta-commitment-binding@0.0.1#binding (;2;) (type 1) (result i32) + (local i32 i32) + global.get $__stack_pointer + i32.const 48 + i32.sub + local.tee 0 + global.set $__stack_pointer + call $wit_bindgen::rt::run_ctors_once + local.get 0 + i32.const 16 + i32.add + call $miden::native_account::compute_delta_commitment + local.get 0 + local.get 0 + i64.load offset=24 + i64.store offset=40 + local.get 0 + local.get 0 + i64.load offset=16 + i64.store offset=32 + global.get $GOT.data.internal.__memory_base + local.set 1 + local.get 0 + local.get 0 + i32.const 32 + i32.add + call $miden_stdlib_sys::intrinsics::word::Word::reverse + local.get 1 + i32.const 1048584 + i32.add + local.tee 1 + local.get 0 + i64.load offset=8 + i64.store offset=8 align=4 + local.get 1 + local.get 0 + i64.load + i64.store align=4 + local.get 0 + i32.const 48 + i32.add + global.set $__stack_pointer + local.get 1 + ) + (func $wit_bindgen::rt::run_ctors_once (;3;) (type 0) + (local i32) + block ;; label = @1 + global.get $GOT.data.internal.__memory_base + i32.const 1048600 + i32.add + i32.load8_u + br_if 0 (;@1;) + global.get $GOT.data.internal.__memory_base + local.set 0 + call $__wasm_call_ctors + local.get 0 + i32.const 1048600 + i32.add + i32.const 1 + i32.store8 + end + ) + (func $miden_stdlib_sys::intrinsics::word::Word::reverse (;4;) (type 2) (param i32 i32) + (local i32 i32 i32 f32) + global.get $__stack_pointer + i32.const 16 + i32.sub + local.tee 2 + local.get 1 + i64.load offset=8 + i64.store offset=8 align=4 + local.get 2 + local.get 1 + i64.load + i64.store align=4 + local.get 2 + i32.const 12 + i32.add + local.set 3 + i32.const 0 + local.set 1 + block ;; label = @1 + loop ;; label = @2 + local.get 1 + i32.const 8 + i32.eq + br_if 1 (;@1;) + local.get 2 + local.get 1 + i32.add + local.tee 4 + f32.load + local.set 5 + local.get 4 + local.get 3 + i32.load + i32.store + local.get 3 + local.get 5 + f32.store + local.get 1 + i32.const 4 + i32.add + local.set 1 + local.get 3 + i32.const -4 + i32.add + local.set 3 + br 0 (;@2;) + end + end + local.get 0 + local.get 2 + i64.load offset=8 align=4 + i64.store offset=8 + local.get 0 + local.get 2 + i64.load align=4 + i64.store + ) + (func $miden::native_account::compute_delta_commitment (;5;) (type 3) (param i32) + unreachable + ) + (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") + (@custom "rodata,miden_account" (after data) "crust_sdk_account_compute_delta_commitment_binding\01\0b0.0.1\03\01\01\00\00\00\00") + ) + (alias export 0 "word" (type (;1;))) + (core instance (;0;) (instantiate 0)) + (alias core export 0 "memory" (core memory (;0;))) + (type (;2;) (func (result 1))) + (alias core export 0 "miden:rust-sdk-account-compute-delta-commitment-binding/rust-sdk-account-compute-delta-commitment-binding@0.0.1#binding" (core func (;0;))) + (func (;0;) (type 2) (canon lift (core func 0) (memory 0))) + (alias export 0 "felt" (type (;3;))) + (alias export 0 "word" (type (;4;))) + (component (;0;) + (type (;0;) (record (field "inner" f32))) + (import "import-type-felt" (type (;1;) (eq 0))) + (type (;2;) (tuple 1 1 1 1)) + (type (;3;) (record (field "inner" 2))) + (import "import-type-word" (type (;4;) (eq 3))) + (import "import-type-word0" (type (;5;) (eq 4))) + (type (;6;) (func (result 5))) + (import "import-func-binding" (func (;0;) (type 6))) + (export (;7;) "word" (type 4)) + (type (;8;) (func (result 7))) + (export (;1;) "binding" (func 0) (func (type 8))) + ) + (instance (;1;) (instantiate 0 + (with "import-func-binding" (func 0)) + (with "import-type-felt" (type 3)) + (with "import-type-word" (type 4)) + (with "import-type-word0" (type 1)) + ) + ) + (export (;2;) "miden:rust-sdk-account-compute-delta-commitment-binding/rust-sdk-account-compute-delta-commitment-binding@0.0.1" (instance 1)) +) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_compute_storage_commitment_binding.hir b/tests/integration/expected/rust_sdk/rust_sdk_account_compute_storage_commitment_binding.hir new file mode 100644 index 000000000..4b3318639 --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_compute_storage_commitment_binding.hir @@ -0,0 +1,327 @@ +builtin.component miden:rust-sdk-account-compute-storage-commitment-binding/rust-sdk-account-compute-storage-commitment-binding@0.0.1 { + builtin.module public @rust_sdk_account_compute_storage_commitment_binding { + private builtin.function @__wasm_call_ctors() { + ^block5: + builtin.ret ; + }; + + private builtin.function @rust_sdk_account_compute_storage_commitment_binding::bindings::__link_custom_section_describing_imports() { + ^block7: + builtin.ret ; + }; + + private builtin.function @miden:rust-sdk-account-compute-storage-commitment-binding/rust-sdk-account-compute-storage-commitment-binding@0.0.1#binding() -> i32 { + ^block9: + v2 = builtin.global_symbol @miden:rust-sdk-account-compute-storage-commitment-binding/rust-sdk-account-compute-storage-commitment-binding@0.0.1/rust_sdk_account_compute_storage_commitment_binding/__stack_pointer : ptr + v3 = hir.bitcast v2 : ptr; + v4 = hir.load v3 : i32; + v5 = arith.constant 48 : i32; + v6 = arith.sub v4, v5 : i32 #[overflow = wrapping]; + v7 = builtin.global_symbol @miden:rust-sdk-account-compute-storage-commitment-binding/rust-sdk-account-compute-storage-commitment-binding@0.0.1/rust_sdk_account_compute_storage_commitment_binding/__stack_pointer : ptr + v8 = hir.bitcast v7 : ptr; + hir.store v8, v6; + hir.exec @miden:rust-sdk-account-compute-storage-commitment-binding/rust-sdk-account-compute-storage-commitment-binding@0.0.1/rust_sdk_account_compute_storage_commitment_binding/wit_bindgen::rt::run_ctors_once() + v9 = arith.constant 16 : i32; + v10 = arith.add v6, v9 : i32 #[overflow = wrapping]; + hir.exec @miden:rust-sdk-account-compute-storage-commitment-binding/rust-sdk-account-compute-storage-commitment-binding@0.0.1/rust_sdk_account_compute_storage_commitment_binding/miden::active_account::compute_storage_commitment(v10) + v12 = arith.constant 24 : u32; + v11 = hir.bitcast v6 : u32; + v13 = arith.add v11, v12 : u32 #[overflow = checked]; + v14 = arith.constant 8 : u32; + v15 = arith.mod v13, v14 : u32; + hir.assertz v15 #[code = 250]; + v16 = hir.int_to_ptr v13 : ptr; + v17 = hir.load v16 : i64; + v19 = arith.constant 40 : u32; + v18 = hir.bitcast v6 : u32; + v20 = arith.add v18, v19 : u32 #[overflow = checked]; + v237 = arith.constant 8 : u32; + v22 = arith.mod v20, v237 : u32; + hir.assertz v22 #[code = 250]; + v23 = hir.int_to_ptr v20 : ptr; + hir.store v23, v17; + v25 = arith.constant 16 : u32; + v24 = hir.bitcast v6 : u32; + v26 = arith.add v24, v25 : u32 #[overflow = checked]; + v236 = arith.constant 8 : u32; + v28 = arith.mod v26, v236 : u32; + hir.assertz v28 #[code = 250]; + v29 = hir.int_to_ptr v26 : ptr; + v30 = hir.load v29 : i64; + v32 = arith.constant 32 : u32; + v31 = hir.bitcast v6 : u32; + v33 = arith.add v31, v32 : u32 #[overflow = checked]; + v235 = arith.constant 8 : u32; + v35 = arith.mod v33, v235 : u32; + hir.assertz v35 #[code = 250]; + v36 = hir.int_to_ptr v33 : ptr; + hir.store v36, v30; + v37 = builtin.global_symbol @miden:rust-sdk-account-compute-storage-commitment-binding/rust-sdk-account-compute-storage-commitment-binding@0.0.1/rust_sdk_account_compute_storage_commitment_binding/GOT.data.internal.__memory_base : ptr + v38 = hir.bitcast v37 : ptr; + v39 = hir.load v38 : i32; + v40 = arith.constant 32 : i32; + v41 = arith.add v6, v40 : i32 #[overflow = wrapping]; + hir.exec @miden:rust-sdk-account-compute-storage-commitment-binding/rust-sdk-account-compute-storage-commitment-binding@0.0.1/rust_sdk_account_compute_storage_commitment_binding/miden_stdlib_sys::intrinsics::word::Word::reverse(v6, v41) + v42 = arith.constant 1048584 : i32; + v43 = arith.add v39, v42 : i32 #[overflow = wrapping]; + v234 = arith.constant 8 : u32; + v44 = hir.bitcast v6 : u32; + v46 = arith.add v44, v234 : u32 #[overflow = checked]; + v233 = arith.constant 8 : u32; + v48 = arith.mod v46, v233 : u32; + hir.assertz v48 #[code = 250]; + v49 = hir.int_to_ptr v46 : ptr; + v50 = hir.load v49 : i64; + v232 = arith.constant 8 : u32; + v51 = hir.bitcast v43 : u32; + v53 = arith.add v51, v232 : u32 #[overflow = checked]; + v54 = arith.constant 4 : u32; + v55 = arith.mod v53, v54 : u32; + hir.assertz v55 #[code = 250]; + v56 = hir.int_to_ptr v53 : ptr; + hir.store v56, v50; + v57 = hir.bitcast v6 : u32; + v231 = arith.constant 8 : u32; + v59 = arith.mod v57, v231 : u32; + hir.assertz v59 #[code = 250]; + v60 = hir.int_to_ptr v57 : ptr; + v61 = hir.load v60 : i64; + v62 = hir.bitcast v43 : u32; + v230 = arith.constant 4 : u32; + v64 = arith.mod v62, v230 : u32; + hir.assertz v64 #[code = 250]; + v65 = hir.int_to_ptr v62 : ptr; + hir.store v65, v61; + v229 = arith.constant 48 : i32; + v67 = arith.add v6, v229 : i32 #[overflow = wrapping]; + v68 = builtin.global_symbol @miden:rust-sdk-account-compute-storage-commitment-binding/rust-sdk-account-compute-storage-commitment-binding@0.0.1/rust_sdk_account_compute_storage_commitment_binding/__stack_pointer : ptr + v69 = hir.bitcast v68 : ptr; + hir.store v69, v67; + builtin.ret v43; + }; + + private builtin.function @wit_bindgen::rt::run_ctors_once() { + ^block11: + v71 = builtin.global_symbol @miden:rust-sdk-account-compute-storage-commitment-binding/rust-sdk-account-compute-storage-commitment-binding@0.0.1/rust_sdk_account_compute_storage_commitment_binding/GOT.data.internal.__memory_base : ptr + v72 = hir.bitcast v71 : ptr; + v73 = hir.load v72 : i32; + v74 = arith.constant 1048600 : i32; + v75 = arith.add v73, v74 : i32 #[overflow = wrapping]; + v76 = hir.bitcast v75 : u32; + v77 = hir.int_to_ptr v76 : ptr; + v78 = hir.load v77 : u8; + v70 = arith.constant 0 : i32; + v79 = arith.zext v78 : u32; + v80 = hir.bitcast v79 : i32; + v82 = arith.neq v80, v70 : i1; + scf.if v82{ + ^block13: + scf.yield ; + } else { + ^block14: + v83 = builtin.global_symbol @miden:rust-sdk-account-compute-storage-commitment-binding/rust-sdk-account-compute-storage-commitment-binding@0.0.1/rust_sdk_account_compute_storage_commitment_binding/GOT.data.internal.__memory_base : ptr + v84 = hir.bitcast v83 : ptr; + v85 = hir.load v84 : i32; + hir.exec @miden:rust-sdk-account-compute-storage-commitment-binding/rust-sdk-account-compute-storage-commitment-binding@0.0.1/rust_sdk_account_compute_storage_commitment_binding/__wasm_call_ctors() + v239 = arith.constant 1 : u8; + v241 = arith.constant 1048600 : i32; + v87 = arith.add v85, v241 : i32 #[overflow = wrapping]; + v91 = hir.bitcast v87 : u32; + v92 = hir.int_to_ptr v91 : ptr; + hir.store v92, v239; + scf.yield ; + }; + builtin.ret ; + }; + + private builtin.function @miden_stdlib_sys::intrinsics::word::Word::reverse(v93: i32, v94: i32) { + ^block15(v93: i32, v94: i32): + v97 = builtin.global_symbol @miden:rust-sdk-account-compute-storage-commitment-binding/rust-sdk-account-compute-storage-commitment-binding@0.0.1/rust_sdk_account_compute_storage_commitment_binding/__stack_pointer : ptr + v98 = hir.bitcast v97 : ptr; + v99 = hir.load v98 : i32; + v100 = arith.constant 16 : i32; + v101 = arith.sub v99, v100 : i32 #[overflow = wrapping]; + v103 = arith.constant 8 : u32; + v102 = hir.bitcast v94 : u32; + v104 = arith.add v102, v103 : u32 #[overflow = checked]; + v328 = arith.constant 8 : u32; + v106 = arith.mod v104, v328 : u32; + hir.assertz v106 #[code = 250]; + v107 = hir.int_to_ptr v104 : ptr; + v108 = hir.load v107 : i64; + v327 = arith.constant 8 : u32; + v109 = hir.bitcast v101 : u32; + v111 = arith.add v109, v327 : u32 #[overflow = checked]; + v112 = arith.constant 4 : u32; + v113 = arith.mod v111, v112 : u32; + hir.assertz v113 #[code = 250]; + v114 = hir.int_to_ptr v111 : ptr; + hir.store v114, v108; + v115 = hir.bitcast v94 : u32; + v326 = arith.constant 8 : u32; + v117 = arith.mod v115, v326 : u32; + hir.assertz v117 #[code = 250]; + v118 = hir.int_to_ptr v115 : ptr; + v119 = hir.load v118 : i64; + v120 = hir.bitcast v101 : u32; + v325 = arith.constant 4 : u32; + v122 = arith.mod v120, v325 : u32; + hir.assertz v122 #[code = 250]; + v123 = hir.int_to_ptr v120 : ptr; + hir.store v123, v119; + v124 = arith.constant 12 : i32; + v125 = arith.add v101, v124 : i32 #[overflow = wrapping]; + v95 = arith.constant 0 : i32; + v296, v297, v298, v299, v300, v301 = scf.while v95, v101, v125, v93 : i32, i32, i32, i32, i32, i32 { + ^block35(v302: i32, v303: i32, v304: i32, v305: i32): + v324 = arith.constant 0 : i32; + v128 = arith.constant 8 : i32; + v129 = arith.eq v302, v128 : i1; + v130 = arith.zext v129 : u32; + v131 = hir.bitcast v130 : i32; + v133 = arith.neq v131, v324 : i1; + v290, v291 = scf.if v133 : i32, i32 { + ^block34: + v250 = ub.poison i32 : i32; + scf.yield v250, v250; + } else { + ^block20: + v135 = arith.add v303, v302 : i32 #[overflow = wrapping]; + v136 = hir.bitcast v135 : u32; + v323 = arith.constant 4 : u32; + v138 = arith.mod v136, v323 : u32; + hir.assertz v138 #[code = 250]; + v139 = hir.int_to_ptr v136 : ptr; + v140 = hir.load v139 : felt; + v142 = hir.bitcast v304 : u32; + v322 = arith.constant 4 : u32; + v144 = arith.mod v142, v322 : u32; + hir.assertz v144 #[code = 250]; + v145 = hir.int_to_ptr v142 : ptr; + v146 = hir.load v145 : i32; + v147 = hir.bitcast v135 : u32; + v321 = arith.constant 4 : u32; + v149 = arith.mod v147, v321 : u32; + hir.assertz v149 #[code = 250]; + v150 = hir.int_to_ptr v147 : ptr; + hir.store v150, v146; + v151 = hir.bitcast v304 : u32; + v320 = arith.constant 4 : u32; + v153 = arith.mod v151, v320 : u32; + hir.assertz v153 #[code = 250]; + v154 = hir.int_to_ptr v151 : ptr; + hir.store v154, v140; + v157 = arith.constant -4 : i32; + v158 = arith.add v304, v157 : i32 #[overflow = wrapping]; + v155 = arith.constant 4 : i32; + v156 = arith.add v302, v155 : i32 #[overflow = wrapping]; + scf.yield v156, v158; + }; + v318 = ub.poison i32 : i32; + v293 = cf.select v133, v318, v305 : i32; + v319 = ub.poison i32 : i32; + v292 = cf.select v133, v319, v303 : i32; + v249 = arith.constant 1 : u32; + v242 = arith.constant 0 : u32; + v295 = cf.select v133, v242, v249 : u32; + v283 = arith.trunc v295 : i1; + scf.condition v283, v290, v292, v291, v293, v303, v305; + } do { + ^block36(v306: i32, v307: i32, v308: i32, v309: i32, v310: i32, v311: i32): + scf.yield v306, v307, v308, v309; + }; + v317 = arith.constant 8 : u32; + v160 = hir.bitcast v300 : u32; + v162 = arith.add v160, v317 : u32 #[overflow = checked]; + v316 = arith.constant 4 : u32; + v164 = arith.mod v162, v316 : u32; + hir.assertz v164 #[code = 250]; + v165 = hir.int_to_ptr v162 : ptr; + v166 = hir.load v165 : i64; + v315 = arith.constant 8 : u32; + v167 = hir.bitcast v301 : u32; + v169 = arith.add v167, v315 : u32 #[overflow = checked]; + v314 = arith.constant 8 : u32; + v171 = arith.mod v169, v314 : u32; + hir.assertz v171 #[code = 250]; + v172 = hir.int_to_ptr v169 : ptr; + hir.store v172, v166; + v173 = hir.bitcast v300 : u32; + v313 = arith.constant 4 : u32; + v175 = arith.mod v173, v313 : u32; + hir.assertz v175 #[code = 250]; + v176 = hir.int_to_ptr v173 : ptr; + v177 = hir.load v176 : i64; + v178 = hir.bitcast v301 : u32; + v312 = arith.constant 8 : u32; + v180 = arith.mod v178, v312 : u32; + hir.assertz v180 #[code = 250]; + v181 = hir.int_to_ptr v178 : ptr; + hir.store v181, v177; + builtin.ret ; + }; + + private builtin.function @miden::active_account::compute_storage_commitment(v182: i32) { + ^block21(v182: i32): + v183, v184, v185, v186 = hir.exec @miden/active_account/compute_storage_commitment() : felt, felt, felt, felt + v187 = hir.bitcast v182 : u32; + v188 = hir.int_to_ptr v187 : ptr; + hir.store v188, v183; + v189 = arith.constant 4 : u32; + v190 = arith.add v187, v189 : u32 #[overflow = checked]; + v191 = hir.int_to_ptr v190 : ptr; + hir.store v191, v184; + v192 = arith.constant 8 : u32; + v193 = arith.add v187, v192 : u32 #[overflow = checked]; + v194 = hir.int_to_ptr v193 : ptr; + hir.store v194, v185; + v195 = arith.constant 12 : u32; + v196 = arith.add v187, v195 : u32 #[overflow = checked]; + v197 = hir.int_to_ptr v196 : ptr; + hir.store v197, v186; + builtin.ret ; + }; + + builtin.global_variable private @#__stack_pointer : i32 { + builtin.ret_imm 1048576; + }; + + builtin.global_variable private @#GOT.data.internal.__memory_base : i32 { + builtin.ret_imm 0; + }; + + builtin.segment @1048576 = 0x0000000100000001; + }; + + public builtin.function @binding() -> felt, felt, felt, felt { + ^block25: + v198 = hir.exec @miden:rust-sdk-account-compute-storage-commitment-binding/rust-sdk-account-compute-storage-commitment-binding@0.0.1/rust_sdk_account_compute_storage_commitment_binding/miden:rust-sdk-account-compute-storage-commitment-binding/rust-sdk-account-compute-storage-commitment-binding@0.0.1#binding() : i32 + v199 = arith.constant 0 : i32; + v200 = arith.add v198, v199 : i32 #[overflow = unchecked]; + v332 = arith.constant 0 : i32; + v333 = arith.constant 0 : i32; + v202 = arith.add v200, v333 : i32 #[overflow = unchecked]; + v204 = arith.add v202, v332 : i32 #[overflow = unchecked]; + v205 = hir.int_to_ptr v204 : ptr; + v206 = hir.load v205 : felt; + v331 = arith.constant 0 : i32; + v207 = arith.constant 4 : i32; + v208 = arith.add v200, v207 : i32 #[overflow = unchecked]; + v210 = arith.add v208, v331 : i32 #[overflow = unchecked]; + v211 = hir.int_to_ptr v210 : ptr; + v212 = hir.load v211 : felt; + v330 = arith.constant 0 : i32; + v213 = arith.constant 8 : i32; + v214 = arith.add v200, v213 : i32 #[overflow = unchecked]; + v216 = arith.add v214, v330 : i32 #[overflow = unchecked]; + v217 = hir.int_to_ptr v216 : ptr; + v218 = hir.load v217 : felt; + v329 = arith.constant 0 : i32; + v219 = arith.constant 12 : i32; + v220 = arith.add v200, v219 : i32 #[overflow = unchecked]; + v222 = arith.add v220, v329 : i32 #[overflow = unchecked]; + v223 = hir.int_to_ptr v222 : ptr; + v224 = hir.load v223 : felt; + builtin.ret v206, v212, v218, v224; + }; +}; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_compute_storage_commitment_binding.masm b/tests/integration/expected/rust_sdk/rust_sdk_account_compute_storage_commitment_binding.masm new file mode 100644 index 000000000..4f2070eed --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_compute_storage_commitment_binding.masm @@ -0,0 +1,698 @@ +# mod miden:rust-sdk-account-compute-storage-commitment-binding/rust-sdk-account-compute-storage-commitment-binding@0.0.1 + +@callconv("canon-lift") +pub proc binding( + +) -> (felt, felt, felt, felt) + exec.::miden:rust-sdk-account-compute-storage-commitment-binding/rust-sdk-account-compute-storage-commitment-binding@0.0.1::init + trace.240 + nop + exec.::miden:rust-sdk-account-compute-storage-commitment-binding/rust-sdk-account-compute-storage-commitment-binding@0.0.1::rust_sdk_account_compute_storage_commitment_binding::miden:rust-sdk-account-compute-storage-commitment-binding/rust-sdk-account-compute-storage-commitment-binding@0.0.1#binding + trace.252 + nop + push.0 + u32wrapping_add + push.0 + push.0 + dup.2 + u32wrapping_add + u32wrapping_add + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.0 + push.4 + dup.3 + u32wrapping_add + u32wrapping_add + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.0 + push.8 + dup.4 + u32wrapping_add + u32wrapping_add + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.0 + push.12 + movup.5 + u32wrapping_add + u32wrapping_add + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + movdn.3 + swap.2 + exec.::std::sys::truncate_stack +end + +proc init + push.1179648 + trace.240 + exec.::intrinsics::mem::heap_init + trace.252 + push.[7028007876379170725,18060021366771303825,13412364500725888848,14178532912296021363] + adv.push_mapval + push.262144 + push.1 + trace.240 + exec.::std::mem::pipe_preimage_to_memory + trace.252 + drop + push.1048576 + u32assert + mem_store.278536 + push.0 + u32assert + mem_store.278537 +end + +# mod miden:rust-sdk-account-compute-storage-commitment-binding/rust-sdk-account-compute-storage-commitment-binding@0.0.1::rust_sdk_account_compute_storage_commitment_binding + +@callconv("C") +proc __wasm_call_ctors( + +) + nop +end + +@callconv("C") +proc rust_sdk_account_compute_storage_commitment_binding::bindings::__link_custom_section_describing_imports( + +) + nop +end + +@callconv("C") +proc miden:rust-sdk-account-compute-storage-commitment-binding/rust-sdk-account-compute-storage-commitment-binding@0.0.1#binding( + +) -> i32 + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.48 + u32wrapping_sub + push.1114144 + dup.1 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + trace.240 + nop + exec.::miden:rust-sdk-account-compute-storage-commitment-binding/rust-sdk-account-compute-storage-commitment-binding@0.0.1::rust_sdk_account_compute_storage_commitment_binding::wit_bindgen::rt::run_ctors_once + trace.252 + nop + push.16 + dup.1 + u32wrapping_add + trace.240 + nop + exec.::miden:rust-sdk-account-compute-storage-commitment-binding/rust-sdk-account-compute-storage-commitment-binding@0.0.1::rust_sdk_account_compute_storage_commitment_binding::miden::active_account::compute_storage_commitment + trace.252 + nop + push.24 + dup.1 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.40 + dup.3 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.16 + dup.1 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.32 + dup.3 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.1114148 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.32 + dup.2 + u32wrapping_add + dup.2 + trace.240 + nop + exec.::miden:rust-sdk-account-compute-storage-commitment-binding/rust-sdk-account-compute-storage-commitment-binding@0.0.1::rust_sdk_account_compute_storage_commitment_binding::miden_stdlib_sys::intrinsics::word::Word::reverse + trace.252 + nop + push.1048584 + u32wrapping_add + push.8 + dup.2 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.8 + dup.3 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + dup.1 + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + dup.2 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.48 + movup.2 + u32wrapping_add + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop +end + +@callconv("C") +proc wit_bindgen::rt::run_ctors_once( + +) + push.1114148 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.1048600 + u32wrapping_add + u32divmod.4 + swap.1 + swap.1 + dup.1 + mem_load + swap.1 + push.8 + u32wrapping_mul + u32shr + swap.1 + drop + push.255 + u32and + push.0 + swap.1 + neq + if.true + nop + else + push.1114148 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + trace.240 + nop + exec.::miden:rust-sdk-account-compute-storage-commitment-binding/rust-sdk-account-compute-storage-commitment-binding@0.0.1::rust_sdk_account_compute_storage_commitment_binding::__wasm_call_ctors + trace.252 + nop + push.1 + push.1048600 + movup.2 + u32wrapping_add + u32divmod.4 + swap.1 + dup.0 + mem_load + dup.2 + push.8 + u32wrapping_mul + push.255 + swap.1 + u32shl + u32not + swap.1 + u32and + movup.3 + movup.3 + push.8 + u32wrapping_mul + u32shl + u32or + swap.1 + mem_store + end +end + +@callconv("C") +proc miden_stdlib_sys::intrinsics::word::Word::reverse( + i32, + i32 +) + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.16 + u32wrapping_sub + push.8 + dup.3 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.8 + dup.3 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + movup.2 + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + dup.2 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.12 + dup.1 + u32wrapping_add + push.0 + movup.2 + swap.1 + push.1 + while.true + push.0 + push.8 + dup.2 + eq + neq + dup.0 + if.true + movup.3 + movup.2 + drop + drop + push.3735929054 + dup.0 + else + dup.2 + dup.2 + u32wrapping_add + dup.0 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + dup.5 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + movup.2 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + dup.4 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.4294967292 + movup.4 + u32wrapping_add + push.4 + movup.3 + u32wrapping_add + end + push.3735929054 + dup.3 + dup.6 + swap.2 + swap.1 + cdrop + push.3735929054 + dup.4 + dup.6 + swap.2 + swap.1 + cdrop + push.1 + push.0 + movup.6 + cdrop + push.1 + u32and + swap.1 + swap.2 + swap.4 + swap.3 + swap.1 + if.true + movup.4 + drop + movup.4 + drop + push.1 + else + push.0 + end + end + drop + drop + drop + drop + push.8 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.8 + dup.4 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + movup.2 + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop +end + +@callconv("C") +proc miden::active_account::compute_storage_commitment(i32) + trace.240 + nop + exec.::miden::active_account::compute_storage_commitment + trace.252 + nop + movup.4 + dup.0 + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.4 + dup.1 + add + u32assert + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.8 + dup.1 + add + u32assert + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.12 + add + u32assert + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop +end + diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_compute_storage_commitment_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_account_compute_storage_commitment_binding.wat new file mode 100644 index 000000000..effe19f48 --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_compute_storage_commitment_binding.wat @@ -0,0 +1,181 @@ +(component + (type (;0;) + (instance + (type (;0;) (record (field "inner" f32))) + (export (;1;) "felt" (type (eq 0))) + (type (;2;) (tuple 1 1 1 1)) + (type (;3;) (record (field "inner" 2))) + (export (;4;) "word" (type (eq 3))) + ) + ) + (import "miden:base/core-types@1.0.0" (instance (;0;) (type 0))) + (core module (;0;) + (type (;0;) (func)) + (type (;1;) (func (result i32))) + (type (;2;) (func (param i32 i32))) + (type (;3;) (func (param i32))) + (table (;0;) 2 2 funcref) + (memory (;0;) 17) + (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) + (global $GOT.data.internal.__memory_base (;1;) i32 i32.const 0) + (export "memory" (memory 0)) + (export "miden:rust-sdk-account-compute-storage-commitment-binding/rust-sdk-account-compute-storage-commitment-binding@0.0.1#binding" (func $miden:rust-sdk-account-compute-storage-commitment-binding/rust-sdk-account-compute-storage-commitment-binding@0.0.1#binding)) + (elem (;0;) (i32.const 1) func $rust_sdk_account_compute_storage_commitment_binding::bindings::__link_custom_section_describing_imports) + (func $__wasm_call_ctors (;0;) (type 0)) + (func $rust_sdk_account_compute_storage_commitment_binding::bindings::__link_custom_section_describing_imports (;1;) (type 0)) + (func $miden:rust-sdk-account-compute-storage-commitment-binding/rust-sdk-account-compute-storage-commitment-binding@0.0.1#binding (;2;) (type 1) (result i32) + (local i32 i32) + global.get $__stack_pointer + i32.const 48 + i32.sub + local.tee 0 + global.set $__stack_pointer + call $wit_bindgen::rt::run_ctors_once + local.get 0 + i32.const 16 + i32.add + call $miden::active_account::compute_storage_commitment + local.get 0 + local.get 0 + i64.load offset=24 + i64.store offset=40 + local.get 0 + local.get 0 + i64.load offset=16 + i64.store offset=32 + global.get $GOT.data.internal.__memory_base + local.set 1 + local.get 0 + local.get 0 + i32.const 32 + i32.add + call $miden_stdlib_sys::intrinsics::word::Word::reverse + local.get 1 + i32.const 1048584 + i32.add + local.tee 1 + local.get 0 + i64.load offset=8 + i64.store offset=8 align=4 + local.get 1 + local.get 0 + i64.load + i64.store align=4 + local.get 0 + i32.const 48 + i32.add + global.set $__stack_pointer + local.get 1 + ) + (func $wit_bindgen::rt::run_ctors_once (;3;) (type 0) + (local i32) + block ;; label = @1 + global.get $GOT.data.internal.__memory_base + i32.const 1048600 + i32.add + i32.load8_u + br_if 0 (;@1;) + global.get $GOT.data.internal.__memory_base + local.set 0 + call $__wasm_call_ctors + local.get 0 + i32.const 1048600 + i32.add + i32.const 1 + i32.store8 + end + ) + (func $miden_stdlib_sys::intrinsics::word::Word::reverse (;4;) (type 2) (param i32 i32) + (local i32 i32 i32 f32) + global.get $__stack_pointer + i32.const 16 + i32.sub + local.tee 2 + local.get 1 + i64.load offset=8 + i64.store offset=8 align=4 + local.get 2 + local.get 1 + i64.load + i64.store align=4 + local.get 2 + i32.const 12 + i32.add + local.set 3 + i32.const 0 + local.set 1 + block ;; label = @1 + loop ;; label = @2 + local.get 1 + i32.const 8 + i32.eq + br_if 1 (;@1;) + local.get 2 + local.get 1 + i32.add + local.tee 4 + f32.load + local.set 5 + local.get 4 + local.get 3 + i32.load + i32.store + local.get 3 + local.get 5 + f32.store + local.get 1 + i32.const 4 + i32.add + local.set 1 + local.get 3 + i32.const -4 + i32.add + local.set 3 + br 0 (;@2;) + end + end + local.get 0 + local.get 2 + i64.load offset=8 align=4 + i64.store offset=8 + local.get 0 + local.get 2 + i64.load align=4 + i64.store + ) + (func $miden::active_account::compute_storage_commitment (;5;) (type 3) (param i32) + unreachable + ) + (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") + (@custom "rodata,miden_account" (after data) "grust_sdk_account_compute_storage_commitment_binding\01\0b0.0.1\03\01\01\00\00") + ) + (alias export 0 "word" (type (;1;))) + (core instance (;0;) (instantiate 0)) + (alias core export 0 "memory" (core memory (;0;))) + (type (;2;) (func (result 1))) + (alias core export 0 "miden:rust-sdk-account-compute-storage-commitment-binding/rust-sdk-account-compute-storage-commitment-binding@0.0.1#binding" (core func (;0;))) + (func (;0;) (type 2) (canon lift (core func 0) (memory 0))) + (alias export 0 "felt" (type (;3;))) + (alias export 0 "word" (type (;4;))) + (component (;0;) + (type (;0;) (record (field "inner" f32))) + (import "import-type-felt" (type (;1;) (eq 0))) + (type (;2;) (tuple 1 1 1 1)) + (type (;3;) (record (field "inner" 2))) + (import "import-type-word" (type (;4;) (eq 3))) + (import "import-type-word0" (type (;5;) (eq 4))) + (type (;6;) (func (result 5))) + (import "import-func-binding" (func (;0;) (type 6))) + (export (;7;) "word" (type 4)) + (type (;8;) (func (result 7))) + (export (;1;) "binding" (func 0) (func (type 8))) + ) + (instance (;1;) (instantiate 0 + (with "import-func-binding" (func 0)) + (with "import-type-felt" (type 3)) + (with "import-type-word" (type 4)) + (with "import-type-word0" (type 1)) + ) + ) + (export (;2;) "miden:rust-sdk-account-compute-storage-commitment-binding/rust-sdk-account-compute-storage-commitment-binding@0.0.1" (instance 1)) +) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_burn_binding.hir b/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_burn_binding.hir new file mode 100644 index 000000000..227665026 --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_burn_binding.hir @@ -0,0 +1,463 @@ +builtin.component miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1 { + builtin.module public @rust_sdk_account_faucet_burn_binding { + private builtin.function @__wasm_call_ctors() { + ^block5: + builtin.ret ; + }; + + private builtin.function @rust_sdk_account_faucet_burn_binding::bindings::__link_custom_section_describing_imports() { + ^block7: + builtin.ret ; + }; + + private builtin.function @miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1#binding() -> i32 { + ^block9: + v3 = builtin.global_symbol @miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1/rust_sdk_account_faucet_burn_binding/__stack_pointer : ptr + v4 = hir.bitcast v3 : ptr; + v5 = hir.load v4 : i32; + v6 = arith.constant 32 : i32; + v7 = arith.sub v5, v6 : i32 #[overflow = wrapping]; + v8 = builtin.global_symbol @miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1/rust_sdk_account_faucet_burn_binding/__stack_pointer : ptr + v9 = hir.bitcast v8 : ptr; + hir.store v9, v7; + hir.exec @miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1/rust_sdk_account_faucet_burn_binding/wit_bindgen::rt::run_ctors_once() + v1 = arith.constant 0 : i32; + v12 = hir.exec @miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1/rust_sdk_account_faucet_burn_binding/intrinsics::felt::from_u32(v1) : felt + v389 = arith.constant 0 : i32; + v368, v369, v370, v371 = scf.while v389, v7, v12 : i32, i32, felt, i32 { + ^block44(v372: i32, v373: i32, v374: felt): + v388 = arith.constant 0 : i32; + v34 = arith.constant 16 : i32; + v15 = arith.eq v372, v34 : i1; + v16 = arith.zext v15 : u32; + v17 = hir.bitcast v16 : i32; + v19 = arith.neq v17, v388 : i1; + v363 = scf.if v19 : i32 { + ^block43: + v334 = ub.poison i32 : i32; + scf.yield v334; + } else { + ^block14: + v387 = arith.constant 16 : i32; + v22 = arith.add v373, v387 : i32 #[overflow = wrapping]; + v23 = arith.add v22, v372 : i32 #[overflow = wrapping]; + v25 = hir.bitcast v23 : u32; + v50 = arith.constant 4 : u32; + v27 = arith.mod v25, v50 : u32; + hir.assertz v27 #[code = 250]; + v28 = hir.int_to_ptr v25 : ptr; + hir.store v28, v374; + v29 = arith.constant 4 : i32; + v30 = arith.add v372, v29 : i32 #[overflow = wrapping]; + scf.yield v30; + }; + v335 = ub.poison felt : felt; + v365 = cf.select v19, v335, v374 : felt; + v386 = ub.poison i32 : i32; + v364 = cf.select v19, v386, v373 : i32; + v333 = arith.constant 1 : u32; + v327 = arith.constant 0 : u32; + v367 = cf.select v19, v327, v333 : u32; + v357 = arith.trunc v367 : i1; + scf.condition v357, v363, v364, v365, v373; + } do { + ^block45(v375: i32, v376: i32, v377: felt, v378: i32): + scf.yield v375, v376, v377; + }; + v31 = builtin.global_symbol @miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1/rust_sdk_account_faucet_burn_binding/GOT.data.internal.__memory_base : ptr + v32 = hir.bitcast v31 : ptr; + v33 = hir.load v32 : i32; + v385 = arith.constant 16 : i32; + v35 = arith.add v371, v385 : i32 #[overflow = wrapping]; + hir.exec @miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1/rust_sdk_account_faucet_burn_binding/>::from(v371, v35) + v384 = arith.constant 16 : i32; + v37 = arith.add v371, v384 : i32 #[overflow = wrapping]; + hir.exec @miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1/rust_sdk_account_faucet_burn_binding/miden_base_sys::bindings::faucet::burn(v37, v371) + v38 = arith.constant 1048584 : i32; + v39 = arith.add v33, v38 : i32 #[overflow = wrapping]; + v41 = arith.constant 24 : u32; + v40 = hir.bitcast v371 : u32; + v42 = arith.add v40, v41 : u32 #[overflow = checked]; + v43 = arith.constant 8 : u32; + v44 = arith.mod v42, v43 : u32; + hir.assertz v44 #[code = 250]; + v45 = hir.int_to_ptr v42 : ptr; + v46 = hir.load v45 : i64; + v383 = arith.constant 8 : u32; + v47 = hir.bitcast v39 : u32; + v49 = arith.add v47, v383 : u32 #[overflow = checked]; + v382 = arith.constant 4 : u32; + v51 = arith.mod v49, v382 : u32; + hir.assertz v51 #[code = 250]; + v52 = hir.int_to_ptr v49 : ptr; + hir.store v52, v46; + v54 = arith.constant 16 : u32; + v53 = hir.bitcast v371 : u32; + v55 = arith.add v53, v54 : u32 #[overflow = checked]; + v381 = arith.constant 8 : u32; + v57 = arith.mod v55, v381 : u32; + hir.assertz v57 #[code = 250]; + v58 = hir.int_to_ptr v55 : ptr; + v59 = hir.load v58 : i64; + v60 = hir.bitcast v39 : u32; + v380 = arith.constant 4 : u32; + v62 = arith.mod v60, v380 : u32; + hir.assertz v62 #[code = 250]; + v63 = hir.int_to_ptr v60 : ptr; + hir.store v63, v59; + v379 = arith.constant 32 : i32; + v65 = arith.add v371, v379 : i32 #[overflow = wrapping]; + v66 = builtin.global_symbol @miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1/rust_sdk_account_faucet_burn_binding/__stack_pointer : ptr + v67 = hir.bitcast v66 : ptr; + hir.store v67, v65; + builtin.ret v39; + }; + + private builtin.function @wit_bindgen::rt::run_ctors_once() { + ^block15: + v69 = builtin.global_symbol @miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1/rust_sdk_account_faucet_burn_binding/GOT.data.internal.__memory_base : ptr + v70 = hir.bitcast v69 : ptr; + v71 = hir.load v70 : i32; + v72 = arith.constant 1048600 : i32; + v73 = arith.add v71, v72 : i32 #[overflow = wrapping]; + v74 = hir.bitcast v73 : u32; + v75 = hir.int_to_ptr v74 : ptr; + v76 = hir.load v75 : u8; + v68 = arith.constant 0 : i32; + v77 = arith.zext v76 : u32; + v78 = hir.bitcast v77 : i32; + v80 = arith.neq v78, v68 : i1; + scf.if v80{ + ^block17: + scf.yield ; + } else { + ^block18: + v81 = builtin.global_symbol @miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1/rust_sdk_account_faucet_burn_binding/GOT.data.internal.__memory_base : ptr + v82 = hir.bitcast v81 : ptr; + v83 = hir.load v82 : i32; + hir.exec @miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1/rust_sdk_account_faucet_burn_binding/__wasm_call_ctors() + v391 = arith.constant 1 : u8; + v393 = arith.constant 1048600 : i32; + v85 = arith.add v83, v393 : i32 #[overflow = wrapping]; + v89 = hir.bitcast v85 : u32; + v90 = hir.int_to_ptr v89 : ptr; + hir.store v90, v391; + scf.yield ; + }; + builtin.ret ; + }; + + private builtin.function @miden_base_sys::bindings::faucet::burn(v91: i32, v92: i32) { + ^block19(v91: i32, v92: i32): + v94 = builtin.global_symbol @miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1/rust_sdk_account_faucet_burn_binding/__stack_pointer : ptr + v95 = hir.bitcast v94 : ptr; + v96 = hir.load v95 : i32; + v97 = arith.constant 32 : i32; + v98 = arith.sub v96, v97 : i32 #[overflow = wrapping]; + v99 = builtin.global_symbol @miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1/rust_sdk_account_faucet_burn_binding/__stack_pointer : ptr + v100 = hir.bitcast v99 : ptr; + hir.store v100, v98; + v102 = arith.constant 12 : u32; + v101 = hir.bitcast v92 : u32; + v103 = arith.add v101, v102 : u32 #[overflow = checked]; + v104 = arith.constant 4 : u32; + v105 = arith.mod v103, v104 : u32; + hir.assertz v105 #[code = 250]; + v106 = hir.int_to_ptr v103 : ptr; + v107 = hir.load v106 : felt; + v109 = arith.constant 8 : u32; + v108 = hir.bitcast v92 : u32; + v110 = arith.add v108, v109 : u32 #[overflow = checked]; + v403 = arith.constant 4 : u32; + v112 = arith.mod v110, v403 : u32; + hir.assertz v112 #[code = 250]; + v113 = hir.int_to_ptr v110 : ptr; + v114 = hir.load v113 : felt; + v402 = arith.constant 4 : u32; + v115 = hir.bitcast v92 : u32; + v117 = arith.add v115, v402 : u32 #[overflow = checked]; + v401 = arith.constant 4 : u32; + v119 = arith.mod v117, v401 : u32; + hir.assertz v119 #[code = 250]; + v120 = hir.int_to_ptr v117 : ptr; + v121 = hir.load v120 : felt; + v122 = hir.bitcast v92 : u32; + v400 = arith.constant 4 : u32; + v124 = arith.mod v122, v400 : u32; + hir.assertz v124 #[code = 250]; + v125 = hir.int_to_ptr v122 : ptr; + v126 = hir.load v125 : felt; + hir.exec @miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1/rust_sdk_account_faucet_burn_binding/miden::faucet::burn(v107, v114, v121, v126, v98) + v399 = arith.constant 8 : u32; + v127 = hir.bitcast v98 : u32; + v129 = arith.add v127, v399 : u32 #[overflow = checked]; + v398 = arith.constant 8 : u32; + v131 = arith.mod v129, v398 : u32; + hir.assertz v131 #[code = 250]; + v132 = hir.int_to_ptr v129 : ptr; + v133 = hir.load v132 : i64; + v135 = arith.constant 24 : u32; + v134 = hir.bitcast v98 : u32; + v136 = arith.add v134, v135 : u32 #[overflow = checked]; + v397 = arith.constant 8 : u32; + v138 = arith.mod v136, v397 : u32; + hir.assertz v138 #[code = 250]; + v139 = hir.int_to_ptr v136 : ptr; + hir.store v139, v133; + v140 = hir.bitcast v98 : u32; + v396 = arith.constant 8 : u32; + v142 = arith.mod v140, v396 : u32; + hir.assertz v142 #[code = 250]; + v143 = hir.int_to_ptr v140 : ptr; + v144 = hir.load v143 : i64; + v146 = arith.constant 16 : u32; + v145 = hir.bitcast v98 : u32; + v147 = arith.add v145, v146 : u32 #[overflow = checked]; + v395 = arith.constant 8 : u32; + v149 = arith.mod v147, v395 : u32; + hir.assertz v149 #[code = 250]; + v150 = hir.int_to_ptr v147 : ptr; + hir.store v150, v144; + v151 = arith.constant 16 : i32; + v152 = arith.add v98, v151 : i32 #[overflow = wrapping]; + hir.exec @miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1/rust_sdk_account_faucet_burn_binding/miden_stdlib_sys::intrinsics::word::Word::reverse(v91, v152) + v394 = arith.constant 32 : i32; + v154 = arith.add v98, v394 : i32 #[overflow = wrapping]; + v155 = builtin.global_symbol @miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1/rust_sdk_account_faucet_burn_binding/__stack_pointer : ptr + v156 = hir.bitcast v155 : ptr; + hir.store v156, v154; + builtin.ret ; + }; + + private builtin.function @>::from(v157: i32, v158: i32) { + ^block21(v157: i32, v158: i32): + v160 = arith.constant 8 : u32; + v159 = hir.bitcast v158 : u32; + v161 = arith.add v159, v160 : u32 #[overflow = checked]; + v162 = arith.constant 4 : u32; + v163 = arith.mod v161, v162 : u32; + hir.assertz v163 #[code = 250]; + v164 = hir.int_to_ptr v161 : ptr; + v165 = hir.load v164 : i64; + v407 = arith.constant 8 : u32; + v166 = hir.bitcast v157 : u32; + v168 = arith.add v166, v407 : u32 #[overflow = checked]; + v406 = arith.constant 8 : u32; + v170 = arith.mod v168, v406 : u32; + hir.assertz v170 #[code = 250]; + v171 = hir.int_to_ptr v168 : ptr; + hir.store v171, v165; + v172 = hir.bitcast v158 : u32; + v405 = arith.constant 4 : u32; + v174 = arith.mod v172, v405 : u32; + hir.assertz v174 #[code = 250]; + v175 = hir.int_to_ptr v172 : ptr; + v176 = hir.load v175 : i64; + v177 = hir.bitcast v157 : u32; + v404 = arith.constant 8 : u32; + v179 = arith.mod v177, v404 : u32; + hir.assertz v179 #[code = 250]; + v180 = hir.int_to_ptr v177 : ptr; + hir.store v180, v176; + builtin.ret ; + }; + + private builtin.function @miden_stdlib_sys::intrinsics::word::Word::reverse(v181: i32, v182: i32) { + ^block23(v181: i32, v182: i32): + v185 = builtin.global_symbol @miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1/rust_sdk_account_faucet_burn_binding/__stack_pointer : ptr + v186 = hir.bitcast v185 : ptr; + v187 = hir.load v186 : i32; + v188 = arith.constant 16 : i32; + v189 = arith.sub v187, v188 : i32 #[overflow = wrapping]; + v191 = arith.constant 8 : u32; + v190 = hir.bitcast v182 : u32; + v192 = arith.add v190, v191 : u32 #[overflow = checked]; + v494 = arith.constant 8 : u32; + v194 = arith.mod v192, v494 : u32; + hir.assertz v194 #[code = 250]; + v195 = hir.int_to_ptr v192 : ptr; + v196 = hir.load v195 : i64; + v493 = arith.constant 8 : u32; + v197 = hir.bitcast v189 : u32; + v199 = arith.add v197, v493 : u32 #[overflow = checked]; + v200 = arith.constant 4 : u32; + v201 = arith.mod v199, v200 : u32; + hir.assertz v201 #[code = 250]; + v202 = hir.int_to_ptr v199 : ptr; + hir.store v202, v196; + v203 = hir.bitcast v182 : u32; + v492 = arith.constant 8 : u32; + v205 = arith.mod v203, v492 : u32; + hir.assertz v205 #[code = 250]; + v206 = hir.int_to_ptr v203 : ptr; + v207 = hir.load v206 : i64; + v208 = hir.bitcast v189 : u32; + v491 = arith.constant 4 : u32; + v210 = arith.mod v208, v491 : u32; + hir.assertz v210 #[code = 250]; + v211 = hir.int_to_ptr v208 : ptr; + hir.store v211, v207; + v212 = arith.constant 12 : i32; + v213 = arith.add v189, v212 : i32 #[overflow = wrapping]; + v183 = arith.constant 0 : i32; + v462, v463, v464, v465, v466, v467 = scf.while v183, v189, v213, v181 : i32, i32, i32, i32, i32, i32 { + ^block54(v468: i32, v469: i32, v470: i32, v471: i32): + v490 = arith.constant 0 : i32; + v216 = arith.constant 8 : i32; + v217 = arith.eq v468, v216 : i1; + v218 = arith.zext v217 : u32; + v219 = hir.bitcast v218 : i32; + v221 = arith.neq v219, v490 : i1; + v456, v457 = scf.if v221 : i32, i32 { + ^block53: + v416 = ub.poison i32 : i32; + scf.yield v416, v416; + } else { + ^block28: + v223 = arith.add v469, v468 : i32 #[overflow = wrapping]; + v224 = hir.bitcast v223 : u32; + v489 = arith.constant 4 : u32; + v226 = arith.mod v224, v489 : u32; + hir.assertz v226 #[code = 250]; + v227 = hir.int_to_ptr v224 : ptr; + v228 = hir.load v227 : felt; + v230 = hir.bitcast v470 : u32; + v488 = arith.constant 4 : u32; + v232 = arith.mod v230, v488 : u32; + hir.assertz v232 #[code = 250]; + v233 = hir.int_to_ptr v230 : ptr; + v234 = hir.load v233 : i32; + v235 = hir.bitcast v223 : u32; + v487 = arith.constant 4 : u32; + v237 = arith.mod v235, v487 : u32; + hir.assertz v237 #[code = 250]; + v238 = hir.int_to_ptr v235 : ptr; + hir.store v238, v234; + v239 = hir.bitcast v470 : u32; + v486 = arith.constant 4 : u32; + v241 = arith.mod v239, v486 : u32; + hir.assertz v241 #[code = 250]; + v242 = hir.int_to_ptr v239 : ptr; + hir.store v242, v228; + v245 = arith.constant -4 : i32; + v246 = arith.add v470, v245 : i32 #[overflow = wrapping]; + v243 = arith.constant 4 : i32; + v244 = arith.add v468, v243 : i32 #[overflow = wrapping]; + scf.yield v244, v246; + }; + v484 = ub.poison i32 : i32; + v459 = cf.select v221, v484, v471 : i32; + v485 = ub.poison i32 : i32; + v458 = cf.select v221, v485, v469 : i32; + v415 = arith.constant 1 : u32; + v408 = arith.constant 0 : u32; + v461 = cf.select v221, v408, v415 : u32; + v449 = arith.trunc v461 : i1; + scf.condition v449, v456, v458, v457, v459, v469, v471; + } do { + ^block55(v472: i32, v473: i32, v474: i32, v475: i32, v476: i32, v477: i32): + scf.yield v472, v473, v474, v475; + }; + v483 = arith.constant 8 : u32; + v248 = hir.bitcast v466 : u32; + v250 = arith.add v248, v483 : u32 #[overflow = checked]; + v482 = arith.constant 4 : u32; + v252 = arith.mod v250, v482 : u32; + hir.assertz v252 #[code = 250]; + v253 = hir.int_to_ptr v250 : ptr; + v254 = hir.load v253 : i64; + v481 = arith.constant 8 : u32; + v255 = hir.bitcast v467 : u32; + v257 = arith.add v255, v481 : u32 #[overflow = checked]; + v480 = arith.constant 8 : u32; + v259 = arith.mod v257, v480 : u32; + hir.assertz v259 #[code = 250]; + v260 = hir.int_to_ptr v257 : ptr; + hir.store v260, v254; + v261 = hir.bitcast v466 : u32; + v479 = arith.constant 4 : u32; + v263 = arith.mod v261, v479 : u32; + hir.assertz v263 #[code = 250]; + v264 = hir.int_to_ptr v261 : ptr; + v265 = hir.load v264 : i64; + v266 = hir.bitcast v467 : u32; + v478 = arith.constant 8 : u32; + v268 = arith.mod v266, v478 : u32; + hir.assertz v268 #[code = 250]; + v269 = hir.int_to_ptr v266 : ptr; + hir.store v269, v265; + builtin.ret ; + }; + + private builtin.function @intrinsics::felt::from_u32(v270: i32) -> felt { + ^block29(v270: i32): + v271 = hir.bitcast v270 : felt; + builtin.ret v271; + }; + + private builtin.function @miden::faucet::burn(v273: felt, v274: felt, v275: felt, v276: felt, v277: i32) { + ^block31(v273: felt, v274: felt, v275: felt, v276: felt, v277: i32): + v278, v279, v280, v281 = hir.exec @miden/faucet/burn(v273, v274, v275, v276) : felt, felt, felt, felt + v282 = hir.bitcast v277 : u32; + v283 = hir.int_to_ptr v282 : ptr; + hir.store v283, v278; + v284 = arith.constant 4 : u32; + v285 = arith.add v282, v284 : u32 #[overflow = checked]; + v286 = hir.int_to_ptr v285 : ptr; + hir.store v286, v279; + v287 = arith.constant 8 : u32; + v288 = arith.add v282, v287 : u32 #[overflow = checked]; + v289 = hir.int_to_ptr v288 : ptr; + hir.store v289, v280; + v290 = arith.constant 12 : u32; + v291 = arith.add v282, v290 : u32 #[overflow = checked]; + v292 = hir.int_to_ptr v291 : ptr; + hir.store v292, v281; + builtin.ret ; + }; + + builtin.global_variable private @#__stack_pointer : i32 { + builtin.ret_imm 1048576; + }; + + builtin.global_variable private @#GOT.data.internal.__memory_base : i32 { + builtin.ret_imm 0; + }; + + builtin.segment @1048576 = 0x0000000100000001; + }; + + public builtin.function @binding() -> felt, felt, felt, felt { + ^block35: + v293 = hir.exec @miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1/rust_sdk_account_faucet_burn_binding/miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1#binding() : i32 + v500 = arith.constant 0 : i32; + v294 = arith.constant 0 : i32; + v295 = arith.add v293, v294 : i32 #[overflow = unchecked]; + v297 = arith.add v295, v500 : i32 #[overflow = unchecked]; + v498 = arith.constant 0 : i32; + v499 = arith.constant 0 : i32; + v299 = arith.add v297, v499 : i32 #[overflow = unchecked]; + v301 = arith.add v299, v498 : i32 #[overflow = unchecked]; + v302 = hir.int_to_ptr v301 : ptr; + v303 = hir.load v302 : felt; + v497 = arith.constant 0 : i32; + v304 = arith.constant 4 : i32; + v305 = arith.add v297, v304 : i32 #[overflow = unchecked]; + v307 = arith.add v305, v497 : i32 #[overflow = unchecked]; + v308 = hir.int_to_ptr v307 : ptr; + v309 = hir.load v308 : felt; + v496 = arith.constant 0 : i32; + v310 = arith.constant 8 : i32; + v311 = arith.add v297, v310 : i32 #[overflow = unchecked]; + v313 = arith.add v311, v496 : i32 #[overflow = unchecked]; + v314 = hir.int_to_ptr v313 : ptr; + v315 = hir.load v314 : felt; + v495 = arith.constant 0 : i32; + v316 = arith.constant 12 : i32; + v317 = arith.add v297, v316 : i32 #[overflow = unchecked]; + v319 = arith.add v317, v495 : i32 #[overflow = unchecked]; + v320 = hir.int_to_ptr v319 : ptr; + v321 = hir.load v320 : felt; + builtin.ret v303, v309, v315, v321; + }; +}; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_burn_binding.masm b/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_burn_binding.masm new file mode 100644 index 000000000..fe64d56b3 --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_burn_binding.masm @@ -0,0 +1,972 @@ +# mod miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1 + +@callconv("canon-lift") +pub proc binding( + +) -> (felt, felt, felt, felt) + exec.::miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1::init + trace.240 + nop + exec.::miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1::rust_sdk_account_faucet_burn_binding::miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1#binding + trace.252 + nop + push.0 + push.0 + movup.2 + u32wrapping_add + u32wrapping_add + push.0 + push.0 + dup.2 + u32wrapping_add + u32wrapping_add + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.0 + push.4 + dup.3 + u32wrapping_add + u32wrapping_add + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.0 + push.8 + dup.4 + u32wrapping_add + u32wrapping_add + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.0 + push.12 + movup.5 + u32wrapping_add + u32wrapping_add + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + movdn.3 + swap.2 + exec.::std::sys::truncate_stack +end + +proc init + push.1179648 + trace.240 + exec.::intrinsics::mem::heap_init + trace.252 + push.[7028007876379170725,18060021366771303825,13412364500725888848,14178532912296021363] + adv.push_mapval + push.262144 + push.1 + trace.240 + exec.::std::mem::pipe_preimage_to_memory + trace.252 + drop + push.1048576 + u32assert + mem_store.278536 + push.0 + u32assert + mem_store.278537 +end + +# mod miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1::rust_sdk_account_faucet_burn_binding + +@callconv("C") +proc __wasm_call_ctors( + +) + nop +end + +@callconv("C") +proc rust_sdk_account_faucet_burn_binding::bindings::__link_custom_section_describing_imports( + +) + nop +end + +@callconv("C") +proc miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1#binding( + +) -> i32 + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.32 + u32wrapping_sub + push.1114144 + dup.1 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + trace.240 + nop + exec.::miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1::rust_sdk_account_faucet_burn_binding::wit_bindgen::rt::run_ctors_once + trace.252 + nop + push.0 + trace.240 + nop + exec.::miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1::rust_sdk_account_faucet_burn_binding::intrinsics::felt::from_u32 + trace.252 + nop + push.0 + movup.2 + swap.1 + push.1 + while.true + push.0 + push.16 + dup.2 + eq + neq + dup.0 + if.true + swap.1 + drop + push.3735929054 + else + push.16 + dup.3 + u32wrapping_add + dup.2 + u32wrapping_add + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + dup.4 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.4 + movup.2 + u32wrapping_add + end + push.3735929054 + dup.2 + movup.2 + swap.5 + movdn.2 + cdrop + push.3735929054 + dup.2 + dup.4 + swap.2 + swap.1 + cdrop + push.1 + push.0 + movup.4 + cdrop + push.1 + u32and + movup.4 + swap.1 + if.true + movup.3 + drop + push.1 + else + push.0 + end + end + drop + drop + drop + push.1114148 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.16 + dup.2 + u32wrapping_add + dup.2 + trace.240 + nop + exec.::miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1::rust_sdk_account_faucet_burn_binding::>::from + trace.252 + nop + push.16 + dup.2 + u32wrapping_add + dup.2 + swap.1 + trace.240 + nop + exec.::miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1::rust_sdk_account_faucet_burn_binding::miden_base_sys::bindings::faucet::burn + trace.252 + nop + push.1048584 + u32wrapping_add + push.24 + dup.2 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.8 + dup.3 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.16 + dup.2 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + dup.2 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.32 + movup.2 + u32wrapping_add + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop +end + +@callconv("C") +proc wit_bindgen::rt::run_ctors_once( + +) + push.1114148 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.1048600 + u32wrapping_add + u32divmod.4 + swap.1 + swap.1 + dup.1 + mem_load + swap.1 + push.8 + u32wrapping_mul + u32shr + swap.1 + drop + push.255 + u32and + push.0 + swap.1 + neq + if.true + nop + else + push.1114148 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + trace.240 + nop + exec.::miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1::rust_sdk_account_faucet_burn_binding::__wasm_call_ctors + trace.252 + nop + push.1 + push.1048600 + movup.2 + u32wrapping_add + u32divmod.4 + swap.1 + dup.0 + mem_load + dup.2 + push.8 + u32wrapping_mul + push.255 + swap.1 + u32shl + u32not + swap.1 + u32and + movup.3 + movup.3 + push.8 + u32wrapping_mul + u32shl + u32or + swap.1 + mem_store + end +end + +@callconv("C") +proc miden_base_sys::bindings::faucet::burn(i32, i32) + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.32 + u32wrapping_sub + push.1114144 + dup.1 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.12 + dup.3 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.8 + dup.4 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.4 + dup.5 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + movup.5 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + dup.4 + swap.1 + swap.3 + swap.1 + swap.4 + trace.240 + nop + exec.::miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1::rust_sdk_account_faucet_burn_binding::miden::faucet::burn + trace.252 + nop + push.8 + dup.1 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.24 + dup.3 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + dup.0 + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.16 + dup.3 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.16 + dup.1 + u32wrapping_add + movup.2 + trace.240 + nop + exec.::miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1::rust_sdk_account_faucet_burn_binding::miden_stdlib_sys::intrinsics::word::Word::reverse + trace.252 + nop + push.32 + u32wrapping_add + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop +end + +@callconv("C") +proc >::from( + i32, + i32 +) + push.8 + dup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.8 + dup.3 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + swap.1 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + movup.2 + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop +end + +@callconv("C") +proc miden_stdlib_sys::intrinsics::word::Word::reverse( + i32, + i32 +) + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.16 + u32wrapping_sub + push.8 + dup.3 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.8 + dup.3 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + movup.2 + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + dup.2 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.12 + dup.1 + u32wrapping_add + push.0 + movup.2 + swap.1 + push.1 + while.true + push.0 + push.8 + dup.2 + eq + neq + dup.0 + if.true + movup.3 + movup.2 + drop + drop + push.3735929054 + dup.0 + else + dup.2 + dup.2 + u32wrapping_add + dup.0 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + dup.5 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + movup.2 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + dup.4 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.4294967292 + movup.4 + u32wrapping_add + push.4 + movup.3 + u32wrapping_add + end + push.3735929054 + dup.3 + dup.6 + swap.2 + swap.1 + cdrop + push.3735929054 + dup.4 + dup.6 + swap.2 + swap.1 + cdrop + push.1 + push.0 + movup.6 + cdrop + push.1 + u32and + swap.1 + swap.2 + swap.4 + swap.3 + swap.1 + if.true + movup.4 + drop + movup.4 + drop + push.1 + else + push.0 + end + end + drop + drop + drop + drop + push.8 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.8 + dup.4 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + movup.2 + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop +end + +@callconv("C") +proc intrinsics::felt::from_u32(i32) -> felt + nop +end + +@callconv("C") +proc miden::faucet::burn(felt, felt, felt, felt, i32) + trace.240 + nop + exec.::miden::faucet::burn + trace.252 + nop + movup.4 + dup.0 + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.4 + dup.1 + add + u32assert + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.8 + dup.1 + add + u32assert + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.12 + add + u32assert + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop +end + diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_burn_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_burn_binding.wat new file mode 100644 index 000000000..61ae53209 --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_burn_binding.wat @@ -0,0 +1,254 @@ +(component + (type (;0;) + (instance + (type (;0;) (record (field "inner" f32))) + (export (;1;) "felt" (type (eq 0))) + (type (;2;) (tuple 1 1 1 1)) + (type (;3;) (record (field "inner" 2))) + (export (;4;) "word" (type (eq 3))) + (type (;5;) (record (field "inner" 4))) + (export (;6;) "asset" (type (eq 5))) + ) + ) + (import "miden:base/core-types@1.0.0" (instance (;0;) (type 0))) + (core module (;0;) + (type (;0;) (func)) + (type (;1;) (func (result i32))) + (type (;2;) (func (param i32 i32))) + (type (;3;) (func (param i32) (result f32))) + (type (;4;) (func (param f32 f32 f32 f32 i32))) + (table (;0;) 2 2 funcref) + (memory (;0;) 17) + (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) + (global $GOT.data.internal.__memory_base (;1;) i32 i32.const 0) + (export "memory" (memory 0)) + (export "miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1#binding" (func $miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1#binding)) + (elem (;0;) (i32.const 1) func $rust_sdk_account_faucet_burn_binding::bindings::__link_custom_section_describing_imports) + (func $__wasm_call_ctors (;0;) (type 0)) + (func $rust_sdk_account_faucet_burn_binding::bindings::__link_custom_section_describing_imports (;1;) (type 0)) + (func $miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1#binding (;2;) (type 1) (result i32) + (local i32 i32 f32) + global.get $__stack_pointer + i32.const 32 + i32.sub + local.tee 0 + global.set $__stack_pointer + call $wit_bindgen::rt::run_ctors_once + i32.const 0 + local.set 1 + i32.const 0 + call $intrinsics::felt::from_u32 + local.set 2 + block ;; label = @1 + loop ;; label = @2 + local.get 1 + i32.const 16 + i32.eq + br_if 1 (;@1;) + local.get 0 + i32.const 16 + i32.add + local.get 1 + i32.add + local.get 2 + f32.store + local.get 1 + i32.const 4 + i32.add + local.set 1 + br 0 (;@2;) + end + end + global.get $GOT.data.internal.__memory_base + local.set 1 + local.get 0 + local.get 0 + i32.const 16 + i32.add + call $>::from + local.get 0 + i32.const 16 + i32.add + local.get 0 + call $miden_base_sys::bindings::faucet::burn + local.get 1 + i32.const 1048584 + i32.add + local.tee 1 + local.get 0 + i64.load offset=24 + i64.store offset=8 align=4 + local.get 1 + local.get 0 + i64.load offset=16 + i64.store align=4 + local.get 0 + i32.const 32 + i32.add + global.set $__stack_pointer + local.get 1 + ) + (func $wit_bindgen::rt::run_ctors_once (;3;) (type 0) + (local i32) + block ;; label = @1 + global.get $GOT.data.internal.__memory_base + i32.const 1048600 + i32.add + i32.load8_u + br_if 0 (;@1;) + global.get $GOT.data.internal.__memory_base + local.set 0 + call $__wasm_call_ctors + local.get 0 + i32.const 1048600 + i32.add + i32.const 1 + i32.store8 + end + ) + (func $miden_base_sys::bindings::faucet::burn (;4;) (type 2) (param i32 i32) + (local i32) + global.get $__stack_pointer + i32.const 32 + i32.sub + local.tee 2 + global.set $__stack_pointer + local.get 1 + f32.load offset=12 + local.get 1 + f32.load offset=8 + local.get 1 + f32.load offset=4 + local.get 1 + f32.load + local.get 2 + call $miden::faucet::burn + local.get 2 + local.get 2 + i64.load offset=8 + i64.store offset=24 + local.get 2 + local.get 2 + i64.load + i64.store offset=16 + local.get 0 + local.get 2 + i32.const 16 + i32.add + call $miden_stdlib_sys::intrinsics::word::Word::reverse + local.get 2 + i32.const 32 + i32.add + global.set $__stack_pointer + ) + (func $>::from (;5;) (type 2) (param i32 i32) + local.get 0 + local.get 1 + i64.load offset=8 align=4 + i64.store offset=8 + local.get 0 + local.get 1 + i64.load align=4 + i64.store + ) + (func $miden_stdlib_sys::intrinsics::word::Word::reverse (;6;) (type 2) (param i32 i32) + (local i32 i32 i32 f32) + global.get $__stack_pointer + i32.const 16 + i32.sub + local.tee 2 + local.get 1 + i64.load offset=8 + i64.store offset=8 align=4 + local.get 2 + local.get 1 + i64.load + i64.store align=4 + local.get 2 + i32.const 12 + i32.add + local.set 3 + i32.const 0 + local.set 1 + block ;; label = @1 + loop ;; label = @2 + local.get 1 + i32.const 8 + i32.eq + br_if 1 (;@1;) + local.get 2 + local.get 1 + i32.add + local.tee 4 + f32.load + local.set 5 + local.get 4 + local.get 3 + i32.load + i32.store + local.get 3 + local.get 5 + f32.store + local.get 1 + i32.const 4 + i32.add + local.set 1 + local.get 3 + i32.const -4 + i32.add + local.set 3 + br 0 (;@2;) + end + end + local.get 0 + local.get 2 + i64.load offset=8 align=4 + i64.store offset=8 + local.get 0 + local.get 2 + i64.load align=4 + i64.store + ) + (func $intrinsics::felt::from_u32 (;7;) (type 3) (param i32) (result f32) + unreachable + ) + (func $miden::faucet::burn (;8;) (type 4) (param f32 f32 f32 f32 i32) + unreachable + ) + (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") + (@custom "rodata,miden_account" (after data) "Irust_sdk_account_faucet_burn_binding\01\0b0.0.1\05\02\03\01") + ) + (alias export 0 "asset" (type (;1;))) + (core instance (;0;) (instantiate 0)) + (alias core export 0 "memory" (core memory (;0;))) + (type (;2;) (func (result 1))) + (alias core export 0 "miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1#binding" (core func (;0;))) + (func (;0;) (type 2) (canon lift (core func 0) (memory 0))) + (alias export 0 "felt" (type (;3;))) + (alias export 0 "word" (type (;4;))) + (alias export 0 "asset" (type (;5;))) + (component (;0;) + (type (;0;) (record (field "inner" f32))) + (import "import-type-felt" (type (;1;) (eq 0))) + (type (;2;) (tuple 1 1 1 1)) + (type (;3;) (record (field "inner" 2))) + (import "import-type-word" (type (;4;) (eq 3))) + (type (;5;) (record (field "inner" 4))) + (import "import-type-asset" (type (;6;) (eq 5))) + (import "import-type-asset0" (type (;7;) (eq 6))) + (type (;8;) (func (result 7))) + (import "import-func-binding" (func (;0;) (type 8))) + (export (;9;) "asset" (type 6)) + (type (;10;) (func (result 9))) + (export (;1;) "binding" (func 0) (func (type 10))) + ) + (instance (;1;) (instantiate 0 + (with "import-func-binding" (func 0)) + (with "import-type-felt" (type 3)) + (with "import-type-word" (type 4)) + (with "import-type-asset" (type 5)) + (with "import-type-asset0" (type 1)) + ) + ) + (export (;2;) "miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1" (instance 1)) +) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_create_fungible_asset_binding.hir b/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_create_fungible_asset_binding.hir new file mode 100644 index 000000000..3c46b0634 --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_create_fungible_asset_binding.hir @@ -0,0 +1,352 @@ +builtin.component miden:rust-sdk-account-faucet-create-fungible-asset-binding/rust-sdk-account-faucet-create-fungible-asset-binding@0.0.1 { + builtin.module public @rust_sdk_account_faucet_create_fungible_asset_binding { + private builtin.function @__wasm_call_ctors() { + ^block5: + builtin.ret ; + }; + + private builtin.function @rust_sdk_account_faucet_create_fungible_asset_binding::bindings::__link_custom_section_describing_imports() { + ^block7: + builtin.ret ; + }; + + private builtin.function @miden:rust-sdk-account-faucet-create-fungible-asset-binding/rust-sdk-account-faucet-create-fungible-asset-binding@0.0.1#binding() -> i32 { + ^block9: + v2 = builtin.global_symbol @miden:rust-sdk-account-faucet-create-fungible-asset-binding/rust-sdk-account-faucet-create-fungible-asset-binding@0.0.1/rust_sdk_account_faucet_create_fungible_asset_binding/__stack_pointer : ptr + v3 = hir.bitcast v2 : ptr; + v4 = hir.load v3 : i32; + v5 = arith.constant 16 : i32; + v6 = arith.sub v4, v5 : i32 #[overflow = wrapping]; + v7 = builtin.global_symbol @miden:rust-sdk-account-faucet-create-fungible-asset-binding/rust-sdk-account-faucet-create-fungible-asset-binding@0.0.1/rust_sdk_account_faucet_create_fungible_asset_binding/__stack_pointer : ptr + v8 = hir.bitcast v7 : ptr; + hir.store v8, v6; + hir.exec @miden:rust-sdk-account-faucet-create-fungible-asset-binding/rust-sdk-account-faucet-create-fungible-asset-binding@0.0.1/rust_sdk_account_faucet_create_fungible_asset_binding/wit_bindgen::rt::run_ctors_once() + v9 = arith.constant 10 : i32; + v10 = hir.exec @miden:rust-sdk-account-faucet-create-fungible-asset-binding/rust-sdk-account-faucet-create-fungible-asset-binding@0.0.1/rust_sdk_account_faucet_create_fungible_asset_binding/intrinsics::felt::from_u32(v9) : felt + hir.exec @miden:rust-sdk-account-faucet-create-fungible-asset-binding/rust-sdk-account-faucet-create-fungible-asset-binding@0.0.1/rust_sdk_account_faucet_create_fungible_asset_binding/miden_base_sys::bindings::faucet::create_fungible_asset(v6, v10) + v11 = builtin.global_symbol @miden:rust-sdk-account-faucet-create-fungible-asset-binding/rust-sdk-account-faucet-create-fungible-asset-binding@0.0.1/rust_sdk_account_faucet_create_fungible_asset_binding/GOT.data.internal.__memory_base : ptr + v12 = hir.bitcast v11 : ptr; + v13 = hir.load v12 : i32; + v14 = arith.constant 1048584 : i32; + v15 = arith.add v13, v14 : i32 #[overflow = wrapping]; + v17 = arith.constant 8 : u32; + v16 = hir.bitcast v6 : u32; + v18 = arith.add v16, v17 : u32 #[overflow = checked]; + v251 = arith.constant 8 : u32; + v20 = arith.mod v18, v251 : u32; + hir.assertz v20 #[code = 250]; + v21 = hir.int_to_ptr v18 : ptr; + v22 = hir.load v21 : i64; + v250 = arith.constant 8 : u32; + v23 = hir.bitcast v15 : u32; + v25 = arith.add v23, v250 : u32 #[overflow = checked]; + v26 = arith.constant 4 : u32; + v27 = arith.mod v25, v26 : u32; + hir.assertz v27 #[code = 250]; + v28 = hir.int_to_ptr v25 : ptr; + hir.store v28, v22; + v29 = hir.bitcast v6 : u32; + v249 = arith.constant 8 : u32; + v31 = arith.mod v29, v249 : u32; + hir.assertz v31 #[code = 250]; + v32 = hir.int_to_ptr v29 : ptr; + v33 = hir.load v32 : i64; + v34 = hir.bitcast v15 : u32; + v248 = arith.constant 4 : u32; + v36 = arith.mod v34, v248 : u32; + hir.assertz v36 #[code = 250]; + v37 = hir.int_to_ptr v34 : ptr; + hir.store v37, v33; + v247 = arith.constant 16 : i32; + v39 = arith.add v6, v247 : i32 #[overflow = wrapping]; + v40 = builtin.global_symbol @miden:rust-sdk-account-faucet-create-fungible-asset-binding/rust-sdk-account-faucet-create-fungible-asset-binding@0.0.1/rust_sdk_account_faucet_create_fungible_asset_binding/__stack_pointer : ptr + v41 = hir.bitcast v40 : ptr; + hir.store v41, v39; + builtin.ret v15; + }; + + private builtin.function @wit_bindgen::rt::run_ctors_once() { + ^block11: + v43 = builtin.global_symbol @miden:rust-sdk-account-faucet-create-fungible-asset-binding/rust-sdk-account-faucet-create-fungible-asset-binding@0.0.1/rust_sdk_account_faucet_create_fungible_asset_binding/GOT.data.internal.__memory_base : ptr + v44 = hir.bitcast v43 : ptr; + v45 = hir.load v44 : i32; + v46 = arith.constant 1048600 : i32; + v47 = arith.add v45, v46 : i32 #[overflow = wrapping]; + v48 = hir.bitcast v47 : u32; + v49 = hir.int_to_ptr v48 : ptr; + v50 = hir.load v49 : u8; + v42 = arith.constant 0 : i32; + v51 = arith.zext v50 : u32; + v52 = hir.bitcast v51 : i32; + v54 = arith.neq v52, v42 : i1; + scf.if v54{ + ^block13: + scf.yield ; + } else { + ^block14: + v55 = builtin.global_symbol @miden:rust-sdk-account-faucet-create-fungible-asset-binding/rust-sdk-account-faucet-create-fungible-asset-binding@0.0.1/rust_sdk_account_faucet_create_fungible_asset_binding/GOT.data.internal.__memory_base : ptr + v56 = hir.bitcast v55 : ptr; + v57 = hir.load v56 : i32; + hir.exec @miden:rust-sdk-account-faucet-create-fungible-asset-binding/rust-sdk-account-faucet-create-fungible-asset-binding@0.0.1/rust_sdk_account_faucet_create_fungible_asset_binding/__wasm_call_ctors() + v253 = arith.constant 1 : u8; + v255 = arith.constant 1048600 : i32; + v59 = arith.add v57, v255 : i32 #[overflow = wrapping]; + v63 = hir.bitcast v59 : u32; + v64 = hir.int_to_ptr v63 : ptr; + hir.store v64, v253; + scf.yield ; + }; + builtin.ret ; + }; + + private builtin.function @miden_base_sys::bindings::faucet::create_fungible_asset(v65: i32, v66: felt) { + ^block15(v65: i32, v66: felt): + v68 = builtin.global_symbol @miden:rust-sdk-account-faucet-create-fungible-asset-binding/rust-sdk-account-faucet-create-fungible-asset-binding@0.0.1/rust_sdk_account_faucet_create_fungible_asset_binding/__stack_pointer : ptr + v69 = hir.bitcast v68 : ptr; + v70 = hir.load v69 : i32; + v71 = arith.constant 32 : i32; + v72 = arith.sub v70, v71 : i32 #[overflow = wrapping]; + v73 = builtin.global_symbol @miden:rust-sdk-account-faucet-create-fungible-asset-binding/rust-sdk-account-faucet-create-fungible-asset-binding@0.0.1/rust_sdk_account_faucet_create_fungible_asset_binding/__stack_pointer : ptr + v74 = hir.bitcast v73 : ptr; + hir.store v74, v72; + hir.exec @miden:rust-sdk-account-faucet-create-fungible-asset-binding/rust-sdk-account-faucet-create-fungible-asset-binding@0.0.1/rust_sdk_account_faucet_create_fungible_asset_binding/miden::faucet::create_fungible_asset(v66, v72) + v76 = arith.constant 8 : u32; + v75 = hir.bitcast v72 : u32; + v77 = arith.add v75, v76 : u32 #[overflow = checked]; + v260 = arith.constant 8 : u32; + v79 = arith.mod v77, v260 : u32; + hir.assertz v79 #[code = 250]; + v80 = hir.int_to_ptr v77 : ptr; + v81 = hir.load v80 : i64; + v83 = arith.constant 24 : u32; + v82 = hir.bitcast v72 : u32; + v84 = arith.add v82, v83 : u32 #[overflow = checked]; + v259 = arith.constant 8 : u32; + v86 = arith.mod v84, v259 : u32; + hir.assertz v86 #[code = 250]; + v87 = hir.int_to_ptr v84 : ptr; + hir.store v87, v81; + v88 = hir.bitcast v72 : u32; + v258 = arith.constant 8 : u32; + v90 = arith.mod v88, v258 : u32; + hir.assertz v90 #[code = 250]; + v91 = hir.int_to_ptr v88 : ptr; + v92 = hir.load v91 : i64; + v94 = arith.constant 16 : u32; + v93 = hir.bitcast v72 : u32; + v95 = arith.add v93, v94 : u32 #[overflow = checked]; + v257 = arith.constant 8 : u32; + v97 = arith.mod v95, v257 : u32; + hir.assertz v97 #[code = 250]; + v98 = hir.int_to_ptr v95 : ptr; + hir.store v98, v92; + v99 = arith.constant 16 : i32; + v100 = arith.add v72, v99 : i32 #[overflow = wrapping]; + hir.exec @miden:rust-sdk-account-faucet-create-fungible-asset-binding/rust-sdk-account-faucet-create-fungible-asset-binding@0.0.1/rust_sdk_account_faucet_create_fungible_asset_binding/miden_stdlib_sys::intrinsics::word::Word::reverse(v65, v100) + v256 = arith.constant 32 : i32; + v102 = arith.add v72, v256 : i32 #[overflow = wrapping]; + v103 = builtin.global_symbol @miden:rust-sdk-account-faucet-create-fungible-asset-binding/rust-sdk-account-faucet-create-fungible-asset-binding@0.0.1/rust_sdk_account_faucet_create_fungible_asset_binding/__stack_pointer : ptr + v104 = hir.bitcast v103 : ptr; + hir.store v104, v102; + builtin.ret ; + }; + + private builtin.function @miden_stdlib_sys::intrinsics::word::Word::reverse(v105: i32, v106: i32) { + ^block17(v105: i32, v106: i32): + v109 = builtin.global_symbol @miden:rust-sdk-account-faucet-create-fungible-asset-binding/rust-sdk-account-faucet-create-fungible-asset-binding@0.0.1/rust_sdk_account_faucet_create_fungible_asset_binding/__stack_pointer : ptr + v110 = hir.bitcast v109 : ptr; + v111 = hir.load v110 : i32; + v112 = arith.constant 16 : i32; + v113 = arith.sub v111, v112 : i32 #[overflow = wrapping]; + v115 = arith.constant 8 : u32; + v114 = hir.bitcast v106 : u32; + v116 = arith.add v114, v115 : u32 #[overflow = checked]; + v347 = arith.constant 8 : u32; + v118 = arith.mod v116, v347 : u32; + hir.assertz v118 #[code = 250]; + v119 = hir.int_to_ptr v116 : ptr; + v120 = hir.load v119 : i64; + v346 = arith.constant 8 : u32; + v121 = hir.bitcast v113 : u32; + v123 = arith.add v121, v346 : u32 #[overflow = checked]; + v124 = arith.constant 4 : u32; + v125 = arith.mod v123, v124 : u32; + hir.assertz v125 #[code = 250]; + v126 = hir.int_to_ptr v123 : ptr; + hir.store v126, v120; + v127 = hir.bitcast v106 : u32; + v345 = arith.constant 8 : u32; + v129 = arith.mod v127, v345 : u32; + hir.assertz v129 #[code = 250]; + v130 = hir.int_to_ptr v127 : ptr; + v131 = hir.load v130 : i64; + v132 = hir.bitcast v113 : u32; + v344 = arith.constant 4 : u32; + v134 = arith.mod v132, v344 : u32; + hir.assertz v134 #[code = 250]; + v135 = hir.int_to_ptr v132 : ptr; + hir.store v135, v131; + v136 = arith.constant 12 : i32; + v137 = arith.add v113, v136 : i32 #[overflow = wrapping]; + v107 = arith.constant 0 : i32; + v315, v316, v317, v318, v319, v320 = scf.while v107, v113, v137, v105 : i32, i32, i32, i32, i32, i32 { + ^block39(v321: i32, v322: i32, v323: i32, v324: i32): + v343 = arith.constant 0 : i32; + v140 = arith.constant 8 : i32; + v141 = arith.eq v321, v140 : i1; + v142 = arith.zext v141 : u32; + v143 = hir.bitcast v142 : i32; + v145 = arith.neq v143, v343 : i1; + v309, v310 = scf.if v145 : i32, i32 { + ^block38: + v269 = ub.poison i32 : i32; + scf.yield v269, v269; + } else { + ^block22: + v147 = arith.add v322, v321 : i32 #[overflow = wrapping]; + v148 = hir.bitcast v147 : u32; + v342 = arith.constant 4 : u32; + v150 = arith.mod v148, v342 : u32; + hir.assertz v150 #[code = 250]; + v151 = hir.int_to_ptr v148 : ptr; + v152 = hir.load v151 : felt; + v154 = hir.bitcast v323 : u32; + v341 = arith.constant 4 : u32; + v156 = arith.mod v154, v341 : u32; + hir.assertz v156 #[code = 250]; + v157 = hir.int_to_ptr v154 : ptr; + v158 = hir.load v157 : i32; + v159 = hir.bitcast v147 : u32; + v340 = arith.constant 4 : u32; + v161 = arith.mod v159, v340 : u32; + hir.assertz v161 #[code = 250]; + v162 = hir.int_to_ptr v159 : ptr; + hir.store v162, v158; + v163 = hir.bitcast v323 : u32; + v339 = arith.constant 4 : u32; + v165 = arith.mod v163, v339 : u32; + hir.assertz v165 #[code = 250]; + v166 = hir.int_to_ptr v163 : ptr; + hir.store v166, v152; + v169 = arith.constant -4 : i32; + v170 = arith.add v323, v169 : i32 #[overflow = wrapping]; + v167 = arith.constant 4 : i32; + v168 = arith.add v321, v167 : i32 #[overflow = wrapping]; + scf.yield v168, v170; + }; + v337 = ub.poison i32 : i32; + v312 = cf.select v145, v337, v324 : i32; + v338 = ub.poison i32 : i32; + v311 = cf.select v145, v338, v322 : i32; + v268 = arith.constant 1 : u32; + v261 = arith.constant 0 : u32; + v314 = cf.select v145, v261, v268 : u32; + v302 = arith.trunc v314 : i1; + scf.condition v302, v309, v311, v310, v312, v322, v324; + } do { + ^block40(v325: i32, v326: i32, v327: i32, v328: i32, v329: i32, v330: i32): + scf.yield v325, v326, v327, v328; + }; + v336 = arith.constant 8 : u32; + v172 = hir.bitcast v319 : u32; + v174 = arith.add v172, v336 : u32 #[overflow = checked]; + v335 = arith.constant 4 : u32; + v176 = arith.mod v174, v335 : u32; + hir.assertz v176 #[code = 250]; + v177 = hir.int_to_ptr v174 : ptr; + v178 = hir.load v177 : i64; + v334 = arith.constant 8 : u32; + v179 = hir.bitcast v320 : u32; + v181 = arith.add v179, v334 : u32 #[overflow = checked]; + v333 = arith.constant 8 : u32; + v183 = arith.mod v181, v333 : u32; + hir.assertz v183 #[code = 250]; + v184 = hir.int_to_ptr v181 : ptr; + hir.store v184, v178; + v185 = hir.bitcast v319 : u32; + v332 = arith.constant 4 : u32; + v187 = arith.mod v185, v332 : u32; + hir.assertz v187 #[code = 250]; + v188 = hir.int_to_ptr v185 : ptr; + v189 = hir.load v188 : i64; + v190 = hir.bitcast v320 : u32; + v331 = arith.constant 8 : u32; + v192 = arith.mod v190, v331 : u32; + hir.assertz v192 #[code = 250]; + v193 = hir.int_to_ptr v190 : ptr; + hir.store v193, v189; + builtin.ret ; + }; + + private builtin.function @intrinsics::felt::from_u32(v194: i32) -> felt { + ^block23(v194: i32): + v195 = hir.bitcast v194 : felt; + builtin.ret v195; + }; + + private builtin.function @miden::faucet::create_fungible_asset(v197: felt, v198: i32) { + ^block25(v197: felt, v198: i32): + v199, v200, v201, v202 = hir.exec @miden/faucet/create_fungible_asset(v197) : felt, felt, felt, felt + v203 = hir.bitcast v198 : u32; + v204 = hir.int_to_ptr v203 : ptr; + hir.store v204, v199; + v205 = arith.constant 4 : u32; + v206 = arith.add v203, v205 : u32 #[overflow = checked]; + v207 = hir.int_to_ptr v206 : ptr; + hir.store v207, v200; + v208 = arith.constant 8 : u32; + v209 = arith.add v203, v208 : u32 #[overflow = checked]; + v210 = hir.int_to_ptr v209 : ptr; + hir.store v210, v201; + v211 = arith.constant 12 : u32; + v212 = arith.add v203, v211 : u32 #[overflow = checked]; + v213 = hir.int_to_ptr v212 : ptr; + hir.store v213, v202; + builtin.ret ; + }; + + builtin.global_variable private @#__stack_pointer : i32 { + builtin.ret_imm 1048576; + }; + + builtin.global_variable private @#GOT.data.internal.__memory_base : i32 { + builtin.ret_imm 0; + }; + + builtin.segment @1048576 = 0x0000000100000001; + }; + + public builtin.function @binding() -> felt, felt, felt, felt { + ^block29: + v214 = hir.exec @miden:rust-sdk-account-faucet-create-fungible-asset-binding/rust-sdk-account-faucet-create-fungible-asset-binding@0.0.1/rust_sdk_account_faucet_create_fungible_asset_binding/miden:rust-sdk-account-faucet-create-fungible-asset-binding/rust-sdk-account-faucet-create-fungible-asset-binding@0.0.1#binding() : i32 + v353 = arith.constant 0 : i32; + v215 = arith.constant 0 : i32; + v216 = arith.add v214, v215 : i32 #[overflow = unchecked]; + v218 = arith.add v216, v353 : i32 #[overflow = unchecked]; + v351 = arith.constant 0 : i32; + v352 = arith.constant 0 : i32; + v220 = arith.add v218, v352 : i32 #[overflow = unchecked]; + v222 = arith.add v220, v351 : i32 #[overflow = unchecked]; + v223 = hir.int_to_ptr v222 : ptr; + v224 = hir.load v223 : felt; + v350 = arith.constant 0 : i32; + v225 = arith.constant 4 : i32; + v226 = arith.add v218, v225 : i32 #[overflow = unchecked]; + v228 = arith.add v226, v350 : i32 #[overflow = unchecked]; + v229 = hir.int_to_ptr v228 : ptr; + v230 = hir.load v229 : felt; + v349 = arith.constant 0 : i32; + v231 = arith.constant 8 : i32; + v232 = arith.add v218, v231 : i32 #[overflow = unchecked]; + v234 = arith.add v232, v349 : i32 #[overflow = unchecked]; + v235 = hir.int_to_ptr v234 : ptr; + v236 = hir.load v235 : felt; + v348 = arith.constant 0 : i32; + v237 = arith.constant 12 : i32; + v238 = arith.add v218, v237 : i32 #[overflow = unchecked]; + v240 = arith.add v238, v348 : i32 #[overflow = unchecked]; + v241 = hir.int_to_ptr v240 : ptr; + v242 = hir.load v241 : felt; + builtin.ret v224, v230, v236, v242; + }; +}; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_create_fungible_asset_binding.masm b/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_create_fungible_asset_binding.masm new file mode 100644 index 000000000..701bc1024 --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_create_fungible_asset_binding.masm @@ -0,0 +1,751 @@ +# mod miden:rust-sdk-account-faucet-create-fungible-asset-binding/rust-sdk-account-faucet-create-fungible-asset-binding@0.0.1 + +@callconv("canon-lift") +pub proc binding( + +) -> (felt, felt, felt, felt) + exec.::miden:rust-sdk-account-faucet-create-fungible-asset-binding/rust-sdk-account-faucet-create-fungible-asset-binding@0.0.1::init + trace.240 + nop + exec.::miden:rust-sdk-account-faucet-create-fungible-asset-binding/rust-sdk-account-faucet-create-fungible-asset-binding@0.0.1::rust_sdk_account_faucet_create_fungible_asset_binding::miden:rust-sdk-account-faucet-create-fungible-asset-binding/rust-sdk-account-faucet-create-fungible-asset-binding@0.0.1#binding + trace.252 + nop + push.0 + push.0 + movup.2 + u32wrapping_add + u32wrapping_add + push.0 + push.0 + dup.2 + u32wrapping_add + u32wrapping_add + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.0 + push.4 + dup.3 + u32wrapping_add + u32wrapping_add + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.0 + push.8 + dup.4 + u32wrapping_add + u32wrapping_add + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.0 + push.12 + movup.5 + u32wrapping_add + u32wrapping_add + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + movdn.3 + swap.2 + exec.::std::sys::truncate_stack +end + +proc init + push.1179648 + trace.240 + exec.::intrinsics::mem::heap_init + trace.252 + push.[7028007876379170725,18060021366771303825,13412364500725888848,14178532912296021363] + adv.push_mapval + push.262144 + push.1 + trace.240 + exec.::std::mem::pipe_preimage_to_memory + trace.252 + drop + push.1048576 + u32assert + mem_store.278536 + push.0 + u32assert + mem_store.278537 +end + +# mod miden:rust-sdk-account-faucet-create-fungible-asset-binding/rust-sdk-account-faucet-create-fungible-asset-binding@0.0.1::rust_sdk_account_faucet_create_fungible_asset_binding + +@callconv("C") +proc __wasm_call_ctors( + +) + nop +end + +@callconv("C") +proc rust_sdk_account_faucet_create_fungible_asset_binding::bindings::__link_custom_section_describing_imports( + +) + nop +end + +@callconv("C") +proc miden:rust-sdk-account-faucet-create-fungible-asset-binding/rust-sdk-account-faucet-create-fungible-asset-binding@0.0.1#binding( + +) -> i32 + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.16 + u32wrapping_sub + push.1114144 + dup.1 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + trace.240 + nop + exec.::miden:rust-sdk-account-faucet-create-fungible-asset-binding/rust-sdk-account-faucet-create-fungible-asset-binding@0.0.1::rust_sdk_account_faucet_create_fungible_asset_binding::wit_bindgen::rt::run_ctors_once + trace.252 + nop + push.10 + trace.240 + nop + exec.::miden:rust-sdk-account-faucet-create-fungible-asset-binding/rust-sdk-account-faucet-create-fungible-asset-binding@0.0.1::rust_sdk_account_faucet_create_fungible_asset_binding::intrinsics::felt::from_u32 + trace.252 + nop + dup.1 + trace.240 + nop + exec.::miden:rust-sdk-account-faucet-create-fungible-asset-binding/rust-sdk-account-faucet-create-fungible-asset-binding@0.0.1::rust_sdk_account_faucet_create_fungible_asset_binding::miden_base_sys::bindings::faucet::create_fungible_asset + trace.252 + nop + push.1114148 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.1048584 + u32wrapping_add + push.8 + dup.2 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.8 + dup.3 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + dup.1 + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + dup.2 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.16 + movup.2 + u32wrapping_add + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop +end + +@callconv("C") +proc wit_bindgen::rt::run_ctors_once( + +) + push.1114148 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.1048600 + u32wrapping_add + u32divmod.4 + swap.1 + swap.1 + dup.1 + mem_load + swap.1 + push.8 + u32wrapping_mul + u32shr + swap.1 + drop + push.255 + u32and + push.0 + swap.1 + neq + if.true + nop + else + push.1114148 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + trace.240 + nop + exec.::miden:rust-sdk-account-faucet-create-fungible-asset-binding/rust-sdk-account-faucet-create-fungible-asset-binding@0.0.1::rust_sdk_account_faucet_create_fungible_asset_binding::__wasm_call_ctors + trace.252 + nop + push.1 + push.1048600 + movup.2 + u32wrapping_add + u32divmod.4 + swap.1 + dup.0 + mem_load + dup.2 + push.8 + u32wrapping_mul + push.255 + swap.1 + u32shl + u32not + swap.1 + u32and + movup.3 + movup.3 + push.8 + u32wrapping_mul + u32shl + u32or + swap.1 + mem_store + end +end + +@callconv("C") +proc miden_base_sys::bindings::faucet::create_fungible_asset( + i32, + felt +) + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.32 + u32wrapping_sub + push.1114144 + dup.1 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + dup.0 + movup.3 + trace.240 + nop + exec.::miden:rust-sdk-account-faucet-create-fungible-asset-binding/rust-sdk-account-faucet-create-fungible-asset-binding@0.0.1::rust_sdk_account_faucet_create_fungible_asset_binding::miden::faucet::create_fungible_asset + trace.252 + nop + push.8 + dup.1 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.24 + dup.3 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + dup.0 + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.16 + dup.3 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.16 + dup.1 + u32wrapping_add + movup.2 + trace.240 + nop + exec.::miden:rust-sdk-account-faucet-create-fungible-asset-binding/rust-sdk-account-faucet-create-fungible-asset-binding@0.0.1::rust_sdk_account_faucet_create_fungible_asset_binding::miden_stdlib_sys::intrinsics::word::Word::reverse + trace.252 + nop + push.32 + u32wrapping_add + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop +end + +@callconv("C") +proc miden_stdlib_sys::intrinsics::word::Word::reverse( + i32, + i32 +) + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.16 + u32wrapping_sub + push.8 + dup.3 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.8 + dup.3 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + movup.2 + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + dup.2 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.12 + dup.1 + u32wrapping_add + push.0 + movup.2 + swap.1 + push.1 + while.true + push.0 + push.8 + dup.2 + eq + neq + dup.0 + if.true + movup.3 + movup.2 + drop + drop + push.3735929054 + dup.0 + else + dup.2 + dup.2 + u32wrapping_add + dup.0 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + dup.5 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + movup.2 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + dup.4 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.4294967292 + movup.4 + u32wrapping_add + push.4 + movup.3 + u32wrapping_add + end + push.3735929054 + dup.3 + dup.6 + swap.2 + swap.1 + cdrop + push.3735929054 + dup.4 + dup.6 + swap.2 + swap.1 + cdrop + push.1 + push.0 + movup.6 + cdrop + push.1 + u32and + swap.1 + swap.2 + swap.4 + swap.3 + swap.1 + if.true + movup.4 + drop + movup.4 + drop + push.1 + else + push.0 + end + end + drop + drop + drop + drop + push.8 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.8 + dup.4 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + movup.2 + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop +end + +@callconv("C") +proc intrinsics::felt::from_u32(i32) -> felt + nop +end + +@callconv("C") +proc miden::faucet::create_fungible_asset(felt, i32) + trace.240 + nop + exec.::miden::faucet::create_fungible_asset + trace.252 + nop + movup.4 + dup.0 + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.4 + dup.1 + add + u32assert + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.8 + dup.1 + add + u32assert + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.12 + add + u32assert + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop +end + diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_create_fungible_asset_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_create_fungible_asset_binding.wat new file mode 100644 index 000000000..19f9746ec --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_create_fungible_asset_binding.wat @@ -0,0 +1,205 @@ +(component + (type (;0;) + (instance + (type (;0;) (record (field "inner" f32))) + (export (;1;) "felt" (type (eq 0))) + (type (;2;) (tuple 1 1 1 1)) + (type (;3;) (record (field "inner" 2))) + (export (;4;) "word" (type (eq 3))) + (type (;5;) (record (field "inner" 4))) + (export (;6;) "asset" (type (eq 5))) + ) + ) + (import "miden:base/core-types@1.0.0" (instance (;0;) (type 0))) + (core module (;0;) + (type (;0;) (func)) + (type (;1;) (func (result i32))) + (type (;2;) (func (param i32 f32))) + (type (;3;) (func (param i32 i32))) + (type (;4;) (func (param i32) (result f32))) + (type (;5;) (func (param f32 i32))) + (table (;0;) 2 2 funcref) + (memory (;0;) 17) + (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) + (global $GOT.data.internal.__memory_base (;1;) i32 i32.const 0) + (export "memory" (memory 0)) + (export "miden:rust-sdk-account-faucet-create-fungible-asset-binding/rust-sdk-account-faucet-create-fungible-asset-binding@0.0.1#binding" (func $miden:rust-sdk-account-faucet-create-fungible-asset-binding/rust-sdk-account-faucet-create-fungible-asset-binding@0.0.1#binding)) + (elem (;0;) (i32.const 1) func $rust_sdk_account_faucet_create_fungible_asset_binding::bindings::__link_custom_section_describing_imports) + (func $__wasm_call_ctors (;0;) (type 0)) + (func $rust_sdk_account_faucet_create_fungible_asset_binding::bindings::__link_custom_section_describing_imports (;1;) (type 0)) + (func $miden:rust-sdk-account-faucet-create-fungible-asset-binding/rust-sdk-account-faucet-create-fungible-asset-binding@0.0.1#binding (;2;) (type 1) (result i32) + (local i32 i32) + global.get $__stack_pointer + i32.const 16 + i32.sub + local.tee 0 + global.set $__stack_pointer + call $wit_bindgen::rt::run_ctors_once + local.get 0 + i32.const 10 + call $intrinsics::felt::from_u32 + call $miden_base_sys::bindings::faucet::create_fungible_asset + global.get $GOT.data.internal.__memory_base + i32.const 1048584 + i32.add + local.tee 1 + local.get 0 + i64.load offset=8 + i64.store offset=8 align=4 + local.get 1 + local.get 0 + i64.load + i64.store align=4 + local.get 0 + i32.const 16 + i32.add + global.set $__stack_pointer + local.get 1 + ) + (func $wit_bindgen::rt::run_ctors_once (;3;) (type 0) + (local i32) + block ;; label = @1 + global.get $GOT.data.internal.__memory_base + i32.const 1048600 + i32.add + i32.load8_u + br_if 0 (;@1;) + global.get $GOT.data.internal.__memory_base + local.set 0 + call $__wasm_call_ctors + local.get 0 + i32.const 1048600 + i32.add + i32.const 1 + i32.store8 + end + ) + (func $miden_base_sys::bindings::faucet::create_fungible_asset (;4;) (type 2) (param i32 f32) + (local i32) + global.get $__stack_pointer + i32.const 32 + i32.sub + local.tee 2 + global.set $__stack_pointer + local.get 1 + local.get 2 + call $miden::faucet::create_fungible_asset + local.get 2 + local.get 2 + i64.load offset=8 + i64.store offset=24 + local.get 2 + local.get 2 + i64.load + i64.store offset=16 + local.get 0 + local.get 2 + i32.const 16 + i32.add + call $miden_stdlib_sys::intrinsics::word::Word::reverse + local.get 2 + i32.const 32 + i32.add + global.set $__stack_pointer + ) + (func $miden_stdlib_sys::intrinsics::word::Word::reverse (;5;) (type 3) (param i32 i32) + (local i32 i32 i32 f32) + global.get $__stack_pointer + i32.const 16 + i32.sub + local.tee 2 + local.get 1 + i64.load offset=8 + i64.store offset=8 align=4 + local.get 2 + local.get 1 + i64.load + i64.store align=4 + local.get 2 + i32.const 12 + i32.add + local.set 3 + i32.const 0 + local.set 1 + block ;; label = @1 + loop ;; label = @2 + local.get 1 + i32.const 8 + i32.eq + br_if 1 (;@1;) + local.get 2 + local.get 1 + i32.add + local.tee 4 + f32.load + local.set 5 + local.get 4 + local.get 3 + i32.load + i32.store + local.get 3 + local.get 5 + f32.store + local.get 1 + i32.const 4 + i32.add + local.set 1 + local.get 3 + i32.const -4 + i32.add + local.set 3 + br 0 (;@2;) + end + end + local.get 0 + local.get 2 + i64.load offset=8 align=4 + i64.store offset=8 + local.get 0 + local.get 2 + i64.load align=4 + i64.store + ) + (func $intrinsics::felt::from_u32 (;6;) (type 4) (param i32) (result f32) + unreachable + ) + (func $miden::faucet::create_fungible_asset (;7;) (type 5) (param f32 i32) + unreachable + ) + (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") + (@custom "rodata,miden_account" (after data) "krust_sdk_account_faucet_create_fungible_asset_binding\01\0b0.0.1\05\02\03\01\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00") + ) + (alias export 0 "asset" (type (;1;))) + (core instance (;0;) (instantiate 0)) + (alias core export 0 "memory" (core memory (;0;))) + (type (;2;) (func (result 1))) + (alias core export 0 "miden:rust-sdk-account-faucet-create-fungible-asset-binding/rust-sdk-account-faucet-create-fungible-asset-binding@0.0.1#binding" (core func (;0;))) + (func (;0;) (type 2) (canon lift (core func 0) (memory 0))) + (alias export 0 "felt" (type (;3;))) + (alias export 0 "word" (type (;4;))) + (alias export 0 "asset" (type (;5;))) + (component (;0;) + (type (;0;) (record (field "inner" f32))) + (import "import-type-felt" (type (;1;) (eq 0))) + (type (;2;) (tuple 1 1 1 1)) + (type (;3;) (record (field "inner" 2))) + (import "import-type-word" (type (;4;) (eq 3))) + (type (;5;) (record (field "inner" 4))) + (import "import-type-asset" (type (;6;) (eq 5))) + (import "import-type-asset0" (type (;7;) (eq 6))) + (type (;8;) (func (result 7))) + (import "import-func-binding" (func (;0;) (type 8))) + (export (;9;) "asset" (type 6)) + (type (;10;) (func (result 9))) + (export (;1;) "binding" (func 0) (func (type 10))) + ) + (instance (;1;) (instantiate 0 + (with "import-func-binding" (func 0)) + (with "import-type-felt" (type 3)) + (with "import-type-word" (type 4)) + (with "import-type-asset" (type 5)) + (with "import-type-asset0" (type 1)) + ) + ) + (export (;2;) "miden:rust-sdk-account-faucet-create-fungible-asset-binding/rust-sdk-account-faucet-create-fungible-asset-binding@0.0.1" (instance 1)) +) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_create_non_fungible_asset_binding.hir b/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_create_non_fungible_asset_binding.hir new file mode 100644 index 000000000..3c51af74d --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_create_non_fungible_asset_binding.hir @@ -0,0 +1,457 @@ +builtin.component miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1 { + builtin.module public @rust_sdk_account_faucet_create_non_fungible_asset_binding { + private builtin.function @__wasm_call_ctors() { + ^block5: + builtin.ret ; + }; + + private builtin.function @rust_sdk_account_faucet_create_non_fungible_asset_binding::bindings::__link_custom_section_describing_imports() { + ^block7: + builtin.ret ; + }; + + private builtin.function @miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1#binding() -> i32 { + ^block9: + v3 = builtin.global_symbol @miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1/rust_sdk_account_faucet_create_non_fungible_asset_binding/__stack_pointer : ptr + v4 = hir.bitcast v3 : ptr; + v5 = hir.load v4 : i32; + v6 = arith.constant 32 : i32; + v7 = arith.sub v5, v6 : i32 #[overflow = wrapping]; + v8 = builtin.global_symbol @miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1/rust_sdk_account_faucet_create_non_fungible_asset_binding/__stack_pointer : ptr + v9 = hir.bitcast v8 : ptr; + hir.store v9, v7; + hir.exec @miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1/rust_sdk_account_faucet_create_non_fungible_asset_binding/wit_bindgen::rt::run_ctors_once() + v1 = arith.constant 0 : i32; + v12 = hir.exec @miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1/rust_sdk_account_faucet_create_non_fungible_asset_binding/intrinsics::felt::from_u32(v1) : felt + v393 = arith.constant 0 : i32; + v366, v367, v368, v369 = scf.while v393, v7, v12 : i32, i32, felt, i32 { + ^block42(v370: i32, v371: i32, v372: felt): + v392 = arith.constant 0 : i32; + v58 = arith.constant 16 : i32; + v15 = arith.eq v370, v58 : i1; + v16 = arith.zext v15 : u32; + v17 = hir.bitcast v16 : i32; + v19 = arith.neq v17, v392 : i1; + v361 = scf.if v19 : i32 { + ^block41: + v332 = ub.poison i32 : i32; + scf.yield v332; + } else { + ^block14: + v391 = arith.constant 16 : i32; + v22 = arith.add v371, v391 : i32 #[overflow = wrapping]; + v23 = arith.add v22, v370 : i32 #[overflow = wrapping]; + v25 = hir.bitcast v23 : u32; + v34 = arith.constant 4 : u32; + v27 = arith.mod v25, v34 : u32; + hir.assertz v27 #[code = 250]; + v28 = hir.int_to_ptr v25 : ptr; + hir.store v28, v372; + v29 = arith.constant 4 : i32; + v30 = arith.add v370, v29 : i32 #[overflow = wrapping]; + scf.yield v30; + }; + v333 = ub.poison felt : felt; + v363 = cf.select v19, v333, v372 : felt; + v390 = ub.poison i32 : i32; + v362 = cf.select v19, v390, v371 : i32; + v331 = arith.constant 1 : u32; + v325 = arith.constant 0 : u32; + v365 = cf.select v19, v325, v331 : u32; + v355 = arith.trunc v365 : i1; + scf.condition v355, v361, v362, v363, v371; + } do { + ^block43(v373: i32, v374: i32, v375: felt, v376: i32): + scf.yield v373, v374, v375; + }; + v32 = arith.constant 24 : u32; + v31 = hir.bitcast v369 : u32; + v33 = arith.add v31, v32 : u32 #[overflow = checked]; + v389 = arith.constant 4 : u32; + v35 = arith.mod v33, v389 : u32; + hir.assertz v35 #[code = 250]; + v36 = hir.int_to_ptr v33 : ptr; + v37 = hir.load v36 : i64; + v39 = arith.constant 8 : u32; + v38 = hir.bitcast v369 : u32; + v40 = arith.add v38, v39 : u32 #[overflow = checked]; + v388 = arith.constant 8 : u32; + v42 = arith.mod v40, v388 : u32; + hir.assertz v42 #[code = 250]; + v43 = hir.int_to_ptr v40 : ptr; + hir.store v43, v37; + v45 = arith.constant 16 : u32; + v44 = hir.bitcast v369 : u32; + v46 = arith.add v44, v45 : u32 #[overflow = checked]; + v387 = arith.constant 4 : u32; + v48 = arith.mod v46, v387 : u32; + hir.assertz v48 #[code = 250]; + v49 = hir.int_to_ptr v46 : ptr; + v50 = hir.load v49 : i64; + v51 = hir.bitcast v369 : u32; + v386 = arith.constant 8 : u32; + v53 = arith.mod v51, v386 : u32; + hir.assertz v53 #[code = 250]; + v54 = hir.int_to_ptr v51 : ptr; + hir.store v54, v50; + v55 = builtin.global_symbol @miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1/rust_sdk_account_faucet_create_non_fungible_asset_binding/GOT.data.internal.__memory_base : ptr + v56 = hir.bitcast v55 : ptr; + v57 = hir.load v56 : i32; + v385 = arith.constant 16 : i32; + v59 = arith.add v369, v385 : i32 #[overflow = wrapping]; + hir.exec @miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1/rust_sdk_account_faucet_create_non_fungible_asset_binding/miden_base_sys::bindings::faucet::create_non_fungible_asset(v59, v369) + v60 = arith.constant 1048584 : i32; + v61 = arith.add v57, v60 : i32 #[overflow = wrapping]; + v384 = arith.constant 24 : u32; + v62 = hir.bitcast v369 : u32; + v64 = arith.add v62, v384 : u32 #[overflow = checked]; + v383 = arith.constant 8 : u32; + v66 = arith.mod v64, v383 : u32; + hir.assertz v66 #[code = 250]; + v67 = hir.int_to_ptr v64 : ptr; + v68 = hir.load v67 : i64; + v382 = arith.constant 8 : u32; + v69 = hir.bitcast v61 : u32; + v71 = arith.add v69, v382 : u32 #[overflow = checked]; + v381 = arith.constant 4 : u32; + v73 = arith.mod v71, v381 : u32; + hir.assertz v73 #[code = 250]; + v74 = hir.int_to_ptr v71 : ptr; + hir.store v74, v68; + v380 = arith.constant 16 : u32; + v75 = hir.bitcast v369 : u32; + v77 = arith.add v75, v380 : u32 #[overflow = checked]; + v379 = arith.constant 8 : u32; + v79 = arith.mod v77, v379 : u32; + hir.assertz v79 #[code = 250]; + v80 = hir.int_to_ptr v77 : ptr; + v81 = hir.load v80 : i64; + v82 = hir.bitcast v61 : u32; + v378 = arith.constant 4 : u32; + v84 = arith.mod v82, v378 : u32; + hir.assertz v84 #[code = 250]; + v85 = hir.int_to_ptr v82 : ptr; + hir.store v85, v81; + v377 = arith.constant 32 : i32; + v87 = arith.add v369, v377 : i32 #[overflow = wrapping]; + v88 = builtin.global_symbol @miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1/rust_sdk_account_faucet_create_non_fungible_asset_binding/__stack_pointer : ptr + v89 = hir.bitcast v88 : ptr; + hir.store v89, v87; + builtin.ret v61; + }; + + private builtin.function @wit_bindgen::rt::run_ctors_once() { + ^block15: + v91 = builtin.global_symbol @miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1/rust_sdk_account_faucet_create_non_fungible_asset_binding/GOT.data.internal.__memory_base : ptr + v92 = hir.bitcast v91 : ptr; + v93 = hir.load v92 : i32; + v94 = arith.constant 1048600 : i32; + v95 = arith.add v93, v94 : i32 #[overflow = wrapping]; + v96 = hir.bitcast v95 : u32; + v97 = hir.int_to_ptr v96 : ptr; + v98 = hir.load v97 : u8; + v90 = arith.constant 0 : i32; + v99 = arith.zext v98 : u32; + v100 = hir.bitcast v99 : i32; + v102 = arith.neq v100, v90 : i1; + scf.if v102{ + ^block17: + scf.yield ; + } else { + ^block18: + v103 = builtin.global_symbol @miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1/rust_sdk_account_faucet_create_non_fungible_asset_binding/GOT.data.internal.__memory_base : ptr + v104 = hir.bitcast v103 : ptr; + v105 = hir.load v104 : i32; + hir.exec @miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1/rust_sdk_account_faucet_create_non_fungible_asset_binding/__wasm_call_ctors() + v395 = arith.constant 1 : u8; + v397 = arith.constant 1048600 : i32; + v107 = arith.add v105, v397 : i32 #[overflow = wrapping]; + v111 = hir.bitcast v107 : u32; + v112 = hir.int_to_ptr v111 : ptr; + hir.store v112, v395; + scf.yield ; + }; + builtin.ret ; + }; + + private builtin.function @miden_base_sys::bindings::faucet::create_non_fungible_asset(v113: i32, v114: i32) { + ^block19(v113: i32, v114: i32): + v116 = builtin.global_symbol @miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1/rust_sdk_account_faucet_create_non_fungible_asset_binding/__stack_pointer : ptr + v117 = hir.bitcast v116 : ptr; + v118 = hir.load v117 : i32; + v119 = arith.constant 32 : i32; + v120 = arith.sub v118, v119 : i32 #[overflow = wrapping]; + v121 = builtin.global_symbol @miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1/rust_sdk_account_faucet_create_non_fungible_asset_binding/__stack_pointer : ptr + v122 = hir.bitcast v121 : ptr; + hir.store v122, v120; + v124 = arith.constant 12 : u32; + v123 = hir.bitcast v114 : u32; + v125 = arith.add v123, v124 : u32 #[overflow = checked]; + v126 = arith.constant 4 : u32; + v127 = arith.mod v125, v126 : u32; + hir.assertz v127 #[code = 250]; + v128 = hir.int_to_ptr v125 : ptr; + v129 = hir.load v128 : felt; + v131 = arith.constant 8 : u32; + v130 = hir.bitcast v114 : u32; + v132 = arith.add v130, v131 : u32 #[overflow = checked]; + v407 = arith.constant 4 : u32; + v134 = arith.mod v132, v407 : u32; + hir.assertz v134 #[code = 250]; + v135 = hir.int_to_ptr v132 : ptr; + v136 = hir.load v135 : felt; + v406 = arith.constant 4 : u32; + v137 = hir.bitcast v114 : u32; + v139 = arith.add v137, v406 : u32 #[overflow = checked]; + v405 = arith.constant 4 : u32; + v141 = arith.mod v139, v405 : u32; + hir.assertz v141 #[code = 250]; + v142 = hir.int_to_ptr v139 : ptr; + v143 = hir.load v142 : felt; + v144 = hir.bitcast v114 : u32; + v404 = arith.constant 4 : u32; + v146 = arith.mod v144, v404 : u32; + hir.assertz v146 #[code = 250]; + v147 = hir.int_to_ptr v144 : ptr; + v148 = hir.load v147 : felt; + hir.exec @miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1/rust_sdk_account_faucet_create_non_fungible_asset_binding/miden::faucet::create_non_fungible_asset(v129, v136, v143, v148, v120) + v403 = arith.constant 8 : u32; + v149 = hir.bitcast v120 : u32; + v151 = arith.add v149, v403 : u32 #[overflow = checked]; + v402 = arith.constant 8 : u32; + v153 = arith.mod v151, v402 : u32; + hir.assertz v153 #[code = 250]; + v154 = hir.int_to_ptr v151 : ptr; + v155 = hir.load v154 : i64; + v157 = arith.constant 24 : u32; + v156 = hir.bitcast v120 : u32; + v158 = arith.add v156, v157 : u32 #[overflow = checked]; + v401 = arith.constant 8 : u32; + v160 = arith.mod v158, v401 : u32; + hir.assertz v160 #[code = 250]; + v161 = hir.int_to_ptr v158 : ptr; + hir.store v161, v155; + v162 = hir.bitcast v120 : u32; + v400 = arith.constant 8 : u32; + v164 = arith.mod v162, v400 : u32; + hir.assertz v164 #[code = 250]; + v165 = hir.int_to_ptr v162 : ptr; + v166 = hir.load v165 : i64; + v168 = arith.constant 16 : u32; + v167 = hir.bitcast v120 : u32; + v169 = arith.add v167, v168 : u32 #[overflow = checked]; + v399 = arith.constant 8 : u32; + v171 = arith.mod v169, v399 : u32; + hir.assertz v171 #[code = 250]; + v172 = hir.int_to_ptr v169 : ptr; + hir.store v172, v166; + v173 = arith.constant 16 : i32; + v174 = arith.add v120, v173 : i32 #[overflow = wrapping]; + hir.exec @miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1/rust_sdk_account_faucet_create_non_fungible_asset_binding/miden_stdlib_sys::intrinsics::word::Word::reverse(v113, v174) + v398 = arith.constant 32 : i32; + v176 = arith.add v120, v398 : i32 #[overflow = wrapping]; + v177 = builtin.global_symbol @miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1/rust_sdk_account_faucet_create_non_fungible_asset_binding/__stack_pointer : ptr + v178 = hir.bitcast v177 : ptr; + hir.store v178, v176; + builtin.ret ; + }; + + private builtin.function @miden_stdlib_sys::intrinsics::word::Word::reverse(v179: i32, v180: i32) { + ^block21(v179: i32, v180: i32): + v183 = builtin.global_symbol @miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1/rust_sdk_account_faucet_create_non_fungible_asset_binding/__stack_pointer : ptr + v184 = hir.bitcast v183 : ptr; + v185 = hir.load v184 : i32; + v186 = arith.constant 16 : i32; + v187 = arith.sub v185, v186 : i32 #[overflow = wrapping]; + v189 = arith.constant 8 : u32; + v188 = hir.bitcast v180 : u32; + v190 = arith.add v188, v189 : u32 #[overflow = checked]; + v494 = arith.constant 8 : u32; + v192 = arith.mod v190, v494 : u32; + hir.assertz v192 #[code = 250]; + v193 = hir.int_to_ptr v190 : ptr; + v194 = hir.load v193 : i64; + v493 = arith.constant 8 : u32; + v195 = hir.bitcast v187 : u32; + v197 = arith.add v195, v493 : u32 #[overflow = checked]; + v198 = arith.constant 4 : u32; + v199 = arith.mod v197, v198 : u32; + hir.assertz v199 #[code = 250]; + v200 = hir.int_to_ptr v197 : ptr; + hir.store v200, v194; + v201 = hir.bitcast v180 : u32; + v492 = arith.constant 8 : u32; + v203 = arith.mod v201, v492 : u32; + hir.assertz v203 #[code = 250]; + v204 = hir.int_to_ptr v201 : ptr; + v205 = hir.load v204 : i64; + v206 = hir.bitcast v187 : u32; + v491 = arith.constant 4 : u32; + v208 = arith.mod v206, v491 : u32; + hir.assertz v208 #[code = 250]; + v209 = hir.int_to_ptr v206 : ptr; + hir.store v209, v205; + v210 = arith.constant 12 : i32; + v211 = arith.add v187, v210 : i32 #[overflow = wrapping]; + v181 = arith.constant 0 : i32; + v462, v463, v464, v465, v466, v467 = scf.while v181, v187, v211, v179 : i32, i32, i32, i32, i32, i32 { + ^block52(v468: i32, v469: i32, v470: i32, v471: i32): + v490 = arith.constant 0 : i32; + v214 = arith.constant 8 : i32; + v215 = arith.eq v468, v214 : i1; + v216 = arith.zext v215 : u32; + v217 = hir.bitcast v216 : i32; + v219 = arith.neq v217, v490 : i1; + v456, v457 = scf.if v219 : i32, i32 { + ^block51: + v416 = ub.poison i32 : i32; + scf.yield v416, v416; + } else { + ^block26: + v221 = arith.add v469, v468 : i32 #[overflow = wrapping]; + v222 = hir.bitcast v221 : u32; + v489 = arith.constant 4 : u32; + v224 = arith.mod v222, v489 : u32; + hir.assertz v224 #[code = 250]; + v225 = hir.int_to_ptr v222 : ptr; + v226 = hir.load v225 : felt; + v228 = hir.bitcast v470 : u32; + v488 = arith.constant 4 : u32; + v230 = arith.mod v228, v488 : u32; + hir.assertz v230 #[code = 250]; + v231 = hir.int_to_ptr v228 : ptr; + v232 = hir.load v231 : i32; + v233 = hir.bitcast v221 : u32; + v487 = arith.constant 4 : u32; + v235 = arith.mod v233, v487 : u32; + hir.assertz v235 #[code = 250]; + v236 = hir.int_to_ptr v233 : ptr; + hir.store v236, v232; + v237 = hir.bitcast v470 : u32; + v486 = arith.constant 4 : u32; + v239 = arith.mod v237, v486 : u32; + hir.assertz v239 #[code = 250]; + v240 = hir.int_to_ptr v237 : ptr; + hir.store v240, v226; + v243 = arith.constant -4 : i32; + v244 = arith.add v470, v243 : i32 #[overflow = wrapping]; + v241 = arith.constant 4 : i32; + v242 = arith.add v468, v241 : i32 #[overflow = wrapping]; + scf.yield v242, v244; + }; + v484 = ub.poison i32 : i32; + v459 = cf.select v219, v484, v471 : i32; + v485 = ub.poison i32 : i32; + v458 = cf.select v219, v485, v469 : i32; + v415 = arith.constant 1 : u32; + v408 = arith.constant 0 : u32; + v461 = cf.select v219, v408, v415 : u32; + v449 = arith.trunc v461 : i1; + scf.condition v449, v456, v458, v457, v459, v469, v471; + } do { + ^block53(v472: i32, v473: i32, v474: i32, v475: i32, v476: i32, v477: i32): + scf.yield v472, v473, v474, v475; + }; + v483 = arith.constant 8 : u32; + v246 = hir.bitcast v466 : u32; + v248 = arith.add v246, v483 : u32 #[overflow = checked]; + v482 = arith.constant 4 : u32; + v250 = arith.mod v248, v482 : u32; + hir.assertz v250 #[code = 250]; + v251 = hir.int_to_ptr v248 : ptr; + v252 = hir.load v251 : i64; + v481 = arith.constant 8 : u32; + v253 = hir.bitcast v467 : u32; + v255 = arith.add v253, v481 : u32 #[overflow = checked]; + v480 = arith.constant 8 : u32; + v257 = arith.mod v255, v480 : u32; + hir.assertz v257 #[code = 250]; + v258 = hir.int_to_ptr v255 : ptr; + hir.store v258, v252; + v259 = hir.bitcast v466 : u32; + v479 = arith.constant 4 : u32; + v261 = arith.mod v259, v479 : u32; + hir.assertz v261 #[code = 250]; + v262 = hir.int_to_ptr v259 : ptr; + v263 = hir.load v262 : i64; + v264 = hir.bitcast v467 : u32; + v478 = arith.constant 8 : u32; + v266 = arith.mod v264, v478 : u32; + hir.assertz v266 #[code = 250]; + v267 = hir.int_to_ptr v264 : ptr; + hir.store v267, v263; + builtin.ret ; + }; + + private builtin.function @intrinsics::felt::from_u32(v268: i32) -> felt { + ^block27(v268: i32): + v269 = hir.bitcast v268 : felt; + builtin.ret v269; + }; + + private builtin.function @miden::faucet::create_non_fungible_asset(v271: felt, v272: felt, v273: felt, v274: felt, v275: i32) { + ^block29(v271: felt, v272: felt, v273: felt, v274: felt, v275: i32): + v276, v277, v278, v279 = hir.exec @miden/faucet/create_non_fungible_asset(v271, v272, v273, v274) : felt, felt, felt, felt + v280 = hir.bitcast v275 : u32; + v281 = hir.int_to_ptr v280 : ptr; + hir.store v281, v276; + v282 = arith.constant 4 : u32; + v283 = arith.add v280, v282 : u32 #[overflow = checked]; + v284 = hir.int_to_ptr v283 : ptr; + hir.store v284, v277; + v285 = arith.constant 8 : u32; + v286 = arith.add v280, v285 : u32 #[overflow = checked]; + v287 = hir.int_to_ptr v286 : ptr; + hir.store v287, v278; + v288 = arith.constant 12 : u32; + v289 = arith.add v280, v288 : u32 #[overflow = checked]; + v290 = hir.int_to_ptr v289 : ptr; + hir.store v290, v279; + builtin.ret ; + }; + + builtin.global_variable private @#__stack_pointer : i32 { + builtin.ret_imm 1048576; + }; + + builtin.global_variable private @#GOT.data.internal.__memory_base : i32 { + builtin.ret_imm 0; + }; + + builtin.segment @1048576 = 0x0000000100000001; + }; + + public builtin.function @binding() -> felt, felt, felt, felt { + ^block33: + v291 = hir.exec @miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1/rust_sdk_account_faucet_create_non_fungible_asset_binding/miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1#binding() : i32 + v500 = arith.constant 0 : i32; + v292 = arith.constant 0 : i32; + v293 = arith.add v291, v292 : i32 #[overflow = unchecked]; + v295 = arith.add v293, v500 : i32 #[overflow = unchecked]; + v498 = arith.constant 0 : i32; + v499 = arith.constant 0 : i32; + v297 = arith.add v295, v499 : i32 #[overflow = unchecked]; + v299 = arith.add v297, v498 : i32 #[overflow = unchecked]; + v300 = hir.int_to_ptr v299 : ptr; + v301 = hir.load v300 : felt; + v497 = arith.constant 0 : i32; + v302 = arith.constant 4 : i32; + v303 = arith.add v295, v302 : i32 #[overflow = unchecked]; + v305 = arith.add v303, v497 : i32 #[overflow = unchecked]; + v306 = hir.int_to_ptr v305 : ptr; + v307 = hir.load v306 : felt; + v496 = arith.constant 0 : i32; + v308 = arith.constant 8 : i32; + v309 = arith.add v295, v308 : i32 #[overflow = unchecked]; + v311 = arith.add v309, v496 : i32 #[overflow = unchecked]; + v312 = hir.int_to_ptr v311 : ptr; + v313 = hir.load v312 : felt; + v495 = arith.constant 0 : i32; + v314 = arith.constant 12 : i32; + v315 = arith.add v295, v314 : i32 #[overflow = unchecked]; + v317 = arith.add v315, v495 : i32 #[overflow = unchecked]; + v318 = hir.int_to_ptr v317 : ptr; + v319 = hir.load v318 : felt; + builtin.ret v301, v307, v313, v319; + }; +}; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_create_non_fungible_asset_binding.masm b/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_create_non_fungible_asset_binding.masm new file mode 100644 index 000000000..2539eb22a --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_create_non_fungible_asset_binding.masm @@ -0,0 +1,962 @@ +# mod miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1 + +@callconv("canon-lift") +pub proc binding( + +) -> (felt, felt, felt, felt) + exec.::miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1::init + trace.240 + nop + exec.::miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1::rust_sdk_account_faucet_create_non_fungible_asset_binding::miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1#binding + trace.252 + nop + push.0 + push.0 + movup.2 + u32wrapping_add + u32wrapping_add + push.0 + push.0 + dup.2 + u32wrapping_add + u32wrapping_add + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.0 + push.4 + dup.3 + u32wrapping_add + u32wrapping_add + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.0 + push.8 + dup.4 + u32wrapping_add + u32wrapping_add + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.0 + push.12 + movup.5 + u32wrapping_add + u32wrapping_add + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + movdn.3 + swap.2 + exec.::std::sys::truncate_stack +end + +proc init + push.1179648 + trace.240 + exec.::intrinsics::mem::heap_init + trace.252 + push.[7028007876379170725,18060021366771303825,13412364500725888848,14178532912296021363] + adv.push_mapval + push.262144 + push.1 + trace.240 + exec.::std::mem::pipe_preimage_to_memory + trace.252 + drop + push.1048576 + u32assert + mem_store.278536 + push.0 + u32assert + mem_store.278537 +end + +# mod miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1::rust_sdk_account_faucet_create_non_fungible_asset_binding + +@callconv("C") +proc __wasm_call_ctors( + +) + nop +end + +@callconv("C") +proc rust_sdk_account_faucet_create_non_fungible_asset_binding::bindings::__link_custom_section_describing_imports( + +) + nop +end + +@callconv("C") +proc miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1#binding( + +) -> i32 + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.32 + u32wrapping_sub + push.1114144 + dup.1 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + trace.240 + nop + exec.::miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1::rust_sdk_account_faucet_create_non_fungible_asset_binding::wit_bindgen::rt::run_ctors_once + trace.252 + nop + push.0 + trace.240 + nop + exec.::miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1::rust_sdk_account_faucet_create_non_fungible_asset_binding::intrinsics::felt::from_u32 + trace.252 + nop + push.0 + movup.2 + swap.1 + push.1 + while.true + push.0 + push.16 + dup.2 + eq + neq + dup.0 + if.true + swap.1 + drop + push.3735929054 + else + push.16 + dup.3 + u32wrapping_add + dup.2 + u32wrapping_add + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + dup.4 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.4 + movup.2 + u32wrapping_add + end + push.3735929054 + dup.2 + movup.2 + swap.5 + movdn.2 + cdrop + push.3735929054 + dup.2 + dup.4 + swap.2 + swap.1 + cdrop + push.1 + push.0 + movup.4 + cdrop + push.1 + u32and + movup.4 + swap.1 + if.true + movup.3 + drop + push.1 + else + push.0 + end + end + drop + drop + drop + push.24 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.8 + dup.3 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.16 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + dup.2 + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.1114148 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.16 + dup.2 + u32wrapping_add + dup.2 + swap.1 + trace.240 + nop + exec.::miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1::rust_sdk_account_faucet_create_non_fungible_asset_binding::miden_base_sys::bindings::faucet::create_non_fungible_asset + trace.252 + nop + push.1048584 + u32wrapping_add + push.24 + dup.2 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.8 + dup.3 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.16 + dup.2 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + dup.2 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.32 + movup.2 + u32wrapping_add + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop +end + +@callconv("C") +proc wit_bindgen::rt::run_ctors_once( + +) + push.1114148 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.1048600 + u32wrapping_add + u32divmod.4 + swap.1 + swap.1 + dup.1 + mem_load + swap.1 + push.8 + u32wrapping_mul + u32shr + swap.1 + drop + push.255 + u32and + push.0 + swap.1 + neq + if.true + nop + else + push.1114148 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + trace.240 + nop + exec.::miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1::rust_sdk_account_faucet_create_non_fungible_asset_binding::__wasm_call_ctors + trace.252 + nop + push.1 + push.1048600 + movup.2 + u32wrapping_add + u32divmod.4 + swap.1 + dup.0 + mem_load + dup.2 + push.8 + u32wrapping_mul + push.255 + swap.1 + u32shl + u32not + swap.1 + u32and + movup.3 + movup.3 + push.8 + u32wrapping_mul + u32shl + u32or + swap.1 + mem_store + end +end + +@callconv("C") +proc miden_base_sys::bindings::faucet::create_non_fungible_asset( + i32, + i32 +) + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.32 + u32wrapping_sub + push.1114144 + dup.1 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.12 + dup.3 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.8 + dup.4 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.4 + dup.5 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + movup.5 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + dup.4 + swap.1 + swap.3 + swap.1 + swap.4 + trace.240 + nop + exec.::miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1::rust_sdk_account_faucet_create_non_fungible_asset_binding::miden::faucet::create_non_fungible_asset + trace.252 + nop + push.8 + dup.1 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.24 + dup.3 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + dup.0 + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.16 + dup.3 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.16 + dup.1 + u32wrapping_add + movup.2 + trace.240 + nop + exec.::miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1::rust_sdk_account_faucet_create_non_fungible_asset_binding::miden_stdlib_sys::intrinsics::word::Word::reverse + trace.252 + nop + push.32 + u32wrapping_add + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop +end + +@callconv("C") +proc miden_stdlib_sys::intrinsics::word::Word::reverse( + i32, + i32 +) + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.16 + u32wrapping_sub + push.8 + dup.3 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.8 + dup.3 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + movup.2 + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + dup.2 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.12 + dup.1 + u32wrapping_add + push.0 + movup.2 + swap.1 + push.1 + while.true + push.0 + push.8 + dup.2 + eq + neq + dup.0 + if.true + movup.3 + movup.2 + drop + drop + push.3735929054 + dup.0 + else + dup.2 + dup.2 + u32wrapping_add + dup.0 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + dup.5 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + movup.2 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + dup.4 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.4294967292 + movup.4 + u32wrapping_add + push.4 + movup.3 + u32wrapping_add + end + push.3735929054 + dup.3 + dup.6 + swap.2 + swap.1 + cdrop + push.3735929054 + dup.4 + dup.6 + swap.2 + swap.1 + cdrop + push.1 + push.0 + movup.6 + cdrop + push.1 + u32and + swap.1 + swap.2 + swap.4 + swap.3 + swap.1 + if.true + movup.4 + drop + movup.4 + drop + push.1 + else + push.0 + end + end + drop + drop + drop + drop + push.8 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.8 + dup.4 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + movup.2 + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop +end + +@callconv("C") +proc intrinsics::felt::from_u32(i32) -> felt + nop +end + +@callconv("C") +proc miden::faucet::create_non_fungible_asset(felt, felt, felt, felt, i32) + trace.240 + nop + exec.::miden::faucet::create_non_fungible_asset + trace.252 + nop + movup.4 + dup.0 + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.4 + dup.1 + add + u32assert + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.8 + dup.1 + add + u32assert + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.12 + add + u32assert + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop +end + diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_create_non_fungible_asset_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_create_non_fungible_asset_binding.wat new file mode 100644 index 000000000..590b22574 --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_create_non_fungible_asset_binding.wat @@ -0,0 +1,247 @@ +(component + (type (;0;) + (instance + (type (;0;) (record (field "inner" f32))) + (export (;1;) "felt" (type (eq 0))) + (type (;2;) (tuple 1 1 1 1)) + (type (;3;) (record (field "inner" 2))) + (export (;4;) "word" (type (eq 3))) + (type (;5;) (record (field "inner" 4))) + (export (;6;) "asset" (type (eq 5))) + ) + ) + (import "miden:base/core-types@1.0.0" (instance (;0;) (type 0))) + (core module (;0;) + (type (;0;) (func)) + (type (;1;) (func (result i32))) + (type (;2;) (func (param i32 i32))) + (type (;3;) (func (param i32) (result f32))) + (type (;4;) (func (param f32 f32 f32 f32 i32))) + (table (;0;) 2 2 funcref) + (memory (;0;) 17) + (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) + (global $GOT.data.internal.__memory_base (;1;) i32 i32.const 0) + (export "memory" (memory 0)) + (export "miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1#binding" (func $miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1#binding)) + (elem (;0;) (i32.const 1) func $rust_sdk_account_faucet_create_non_fungible_asset_binding::bindings::__link_custom_section_describing_imports) + (func $__wasm_call_ctors (;0;) (type 0)) + (func $rust_sdk_account_faucet_create_non_fungible_asset_binding::bindings::__link_custom_section_describing_imports (;1;) (type 0)) + (func $miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1#binding (;2;) (type 1) (result i32) + (local i32 i32 f32) + global.get $__stack_pointer + i32.const 32 + i32.sub + local.tee 0 + global.set $__stack_pointer + call $wit_bindgen::rt::run_ctors_once + i32.const 0 + local.set 1 + i32.const 0 + call $intrinsics::felt::from_u32 + local.set 2 + block ;; label = @1 + loop ;; label = @2 + local.get 1 + i32.const 16 + i32.eq + br_if 1 (;@1;) + local.get 0 + i32.const 16 + i32.add + local.get 1 + i32.add + local.get 2 + f32.store + local.get 1 + i32.const 4 + i32.add + local.set 1 + br 0 (;@2;) + end + end + local.get 0 + local.get 0 + i64.load offset=24 align=4 + i64.store offset=8 + local.get 0 + local.get 0 + i64.load offset=16 align=4 + i64.store + global.get $GOT.data.internal.__memory_base + local.set 1 + local.get 0 + i32.const 16 + i32.add + local.get 0 + call $miden_base_sys::bindings::faucet::create_non_fungible_asset + local.get 1 + i32.const 1048584 + i32.add + local.tee 1 + local.get 0 + i64.load offset=24 + i64.store offset=8 align=4 + local.get 1 + local.get 0 + i64.load offset=16 + i64.store align=4 + local.get 0 + i32.const 32 + i32.add + global.set $__stack_pointer + local.get 1 + ) + (func $wit_bindgen::rt::run_ctors_once (;3;) (type 0) + (local i32) + block ;; label = @1 + global.get $GOT.data.internal.__memory_base + i32.const 1048600 + i32.add + i32.load8_u + br_if 0 (;@1;) + global.get $GOT.data.internal.__memory_base + local.set 0 + call $__wasm_call_ctors + local.get 0 + i32.const 1048600 + i32.add + i32.const 1 + i32.store8 + end + ) + (func $miden_base_sys::bindings::faucet::create_non_fungible_asset (;4;) (type 2) (param i32 i32) + (local i32) + global.get $__stack_pointer + i32.const 32 + i32.sub + local.tee 2 + global.set $__stack_pointer + local.get 1 + f32.load offset=12 + local.get 1 + f32.load offset=8 + local.get 1 + f32.load offset=4 + local.get 1 + f32.load + local.get 2 + call $miden::faucet::create_non_fungible_asset + local.get 2 + local.get 2 + i64.load offset=8 + i64.store offset=24 + local.get 2 + local.get 2 + i64.load + i64.store offset=16 + local.get 0 + local.get 2 + i32.const 16 + i32.add + call $miden_stdlib_sys::intrinsics::word::Word::reverse + local.get 2 + i32.const 32 + i32.add + global.set $__stack_pointer + ) + (func $miden_stdlib_sys::intrinsics::word::Word::reverse (;5;) (type 2) (param i32 i32) + (local i32 i32 i32 f32) + global.get $__stack_pointer + i32.const 16 + i32.sub + local.tee 2 + local.get 1 + i64.load offset=8 + i64.store offset=8 align=4 + local.get 2 + local.get 1 + i64.load + i64.store align=4 + local.get 2 + i32.const 12 + i32.add + local.set 3 + i32.const 0 + local.set 1 + block ;; label = @1 + loop ;; label = @2 + local.get 1 + i32.const 8 + i32.eq + br_if 1 (;@1;) + local.get 2 + local.get 1 + i32.add + local.tee 4 + f32.load + local.set 5 + local.get 4 + local.get 3 + i32.load + i32.store + local.get 3 + local.get 5 + f32.store + local.get 1 + i32.const 4 + i32.add + local.set 1 + local.get 3 + i32.const -4 + i32.add + local.set 3 + br 0 (;@2;) + end + end + local.get 0 + local.get 2 + i64.load offset=8 align=4 + i64.store offset=8 + local.get 0 + local.get 2 + i64.load align=4 + i64.store + ) + (func $intrinsics::felt::from_u32 (;6;) (type 3) (param i32) (result f32) + unreachable + ) + (func $miden::faucet::create_non_fungible_asset (;7;) (type 4) (param f32 f32 f32 f32 i32) + unreachable + ) + (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") + (@custom "rodata,miden_account" (after data) "srust_sdk_account_faucet_create_non_fungible_asset_binding\01\0b0.0.1\05\02\03\01\00\00\00\00\00\00\00\00\00\00\00") + ) + (alias export 0 "asset" (type (;1;))) + (core instance (;0;) (instantiate 0)) + (alias core export 0 "memory" (core memory (;0;))) + (type (;2;) (func (result 1))) + (alias core export 0 "miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1#binding" (core func (;0;))) + (func (;0;) (type 2) (canon lift (core func 0) (memory 0))) + (alias export 0 "felt" (type (;3;))) + (alias export 0 "word" (type (;4;))) + (alias export 0 "asset" (type (;5;))) + (component (;0;) + (type (;0;) (record (field "inner" f32))) + (import "import-type-felt" (type (;1;) (eq 0))) + (type (;2;) (tuple 1 1 1 1)) + (type (;3;) (record (field "inner" 2))) + (import "import-type-word" (type (;4;) (eq 3))) + (type (;5;) (record (field "inner" 4))) + (import "import-type-asset" (type (;6;) (eq 5))) + (import "import-type-asset0" (type (;7;) (eq 6))) + (type (;8;) (func (result 7))) + (import "import-func-binding" (func (;0;) (type 8))) + (export (;9;) "asset" (type 6)) + (type (;10;) (func (result 9))) + (export (;1;) "binding" (func 0) (func (type 10))) + ) + (instance (;1;) (instantiate 0 + (with "import-func-binding" (func 0)) + (with "import-type-felt" (type 3)) + (with "import-type-word" (type 4)) + (with "import-type-asset" (type 5)) + (with "import-type-asset0" (type 1)) + ) + ) + (export (;2;) "miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1" (instance 1)) +) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_get_total_issuance_binding.hir b/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_get_total_issuance_binding.hir new file mode 100644 index 000000000..3e0633ed9 --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_get_total_issuance_binding.hir @@ -0,0 +1,76 @@ +builtin.component miden:rust-sdk-account-faucet-get-total-issuance-binding/rust-sdk-account-faucet-get-total-issuance-binding@0.0.1 { + builtin.module public @rust_sdk_account_faucet_get_total_issuance_binding { + private builtin.function @__wasm_call_ctors() { + ^block5: + builtin.ret ; + }; + + private builtin.function @rust_sdk_account_faucet_get_total_issuance_binding::bindings::__link_custom_section_describing_imports() { + ^block7: + builtin.ret ; + }; + + private builtin.function @miden:rust-sdk-account-faucet-get-total-issuance-binding/rust-sdk-account-faucet-get-total-issuance-binding@0.0.1#binding() -> felt { + ^block9: + hir.exec @miden:rust-sdk-account-faucet-get-total-issuance-binding/rust-sdk-account-faucet-get-total-issuance-binding@0.0.1/rust_sdk_account_faucet_get_total_issuance_binding/wit_bindgen::rt::run_ctors_once() + v1 = hir.exec @miden:rust-sdk-account-faucet-get-total-issuance-binding/rust-sdk-account-faucet-get-total-issuance-binding@0.0.1/rust_sdk_account_faucet_get_total_issuance_binding/miden::faucet::get_total_issuance() : felt + builtin.ret v1; + }; + + private builtin.function @wit_bindgen::rt::run_ctors_once() { + ^block11: + v3 = builtin.global_symbol @miden:rust-sdk-account-faucet-get-total-issuance-binding/rust-sdk-account-faucet-get-total-issuance-binding@0.0.1/rust_sdk_account_faucet_get_total_issuance_binding/GOT.data.internal.__memory_base : ptr + v4 = hir.bitcast v3 : ptr; + v5 = hir.load v4 : i32; + v6 = arith.constant 1048584 : i32; + v7 = arith.add v5, v6 : i32 #[overflow = wrapping]; + v8 = hir.bitcast v7 : u32; + v9 = hir.int_to_ptr v8 : ptr; + v10 = hir.load v9 : u8; + v2 = arith.constant 0 : i32; + v11 = arith.zext v10 : u32; + v12 = hir.bitcast v11 : i32; + v14 = arith.neq v12, v2 : i1; + scf.if v14{ + ^block13: + scf.yield ; + } else { + ^block14: + v15 = builtin.global_symbol @miden:rust-sdk-account-faucet-get-total-issuance-binding/rust-sdk-account-faucet-get-total-issuance-binding@0.0.1/rust_sdk_account_faucet_get_total_issuance_binding/GOT.data.internal.__memory_base : ptr + v16 = hir.bitcast v15 : ptr; + v17 = hir.load v16 : i32; + hir.exec @miden:rust-sdk-account-faucet-get-total-issuance-binding/rust-sdk-account-faucet-get-total-issuance-binding@0.0.1/rust_sdk_account_faucet_get_total_issuance_binding/__wasm_call_ctors() + v29 = arith.constant 1 : u8; + v31 = arith.constant 1048584 : i32; + v19 = arith.add v17, v31 : i32 #[overflow = wrapping]; + v23 = hir.bitcast v19 : u32; + v24 = hir.int_to_ptr v23 : ptr; + hir.store v24, v29; + scf.yield ; + }; + builtin.ret ; + }; + + private builtin.function @miden::faucet::get_total_issuance() -> felt { + ^block15: + v25 = hir.exec @miden/faucet/get_total_issuance() : felt + builtin.ret v25; + }; + + builtin.global_variable private @#__stack_pointer : i32 { + builtin.ret_imm 1048576; + }; + + builtin.global_variable private @#GOT.data.internal.__memory_base : i32 { + builtin.ret_imm 0; + }; + + builtin.segment @1048576 = 0x0000000100000001; + }; + + public builtin.function @binding() -> felt { + ^block19: + v27 = hir.exec @miden:rust-sdk-account-faucet-get-total-issuance-binding/rust-sdk-account-faucet-get-total-issuance-binding@0.0.1/rust_sdk_account_faucet_get_total_issuance_binding/miden:rust-sdk-account-faucet-get-total-issuance-binding/rust-sdk-account-faucet-get-total-issuance-binding@0.0.1#binding() : felt + builtin.ret v27; + }; +}; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_get_total_issuance_binding.masm b/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_get_total_issuance_binding.masm new file mode 100644 index 000000000..44bcf1f77 --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_get_total_issuance_binding.masm @@ -0,0 +1,153 @@ +# mod miden:rust-sdk-account-faucet-get-total-issuance-binding/rust-sdk-account-faucet-get-total-issuance-binding@0.0.1 + +@callconv("canon-lift") +pub proc binding( + +) -> felt + exec.::miden:rust-sdk-account-faucet-get-total-issuance-binding/rust-sdk-account-faucet-get-total-issuance-binding@0.0.1::init + trace.240 + nop + exec.::miden:rust-sdk-account-faucet-get-total-issuance-binding/rust-sdk-account-faucet-get-total-issuance-binding@0.0.1::rust_sdk_account_faucet_get_total_issuance_binding::miden:rust-sdk-account-faucet-get-total-issuance-binding/rust-sdk-account-faucet-get-total-issuance-binding@0.0.1#binding + trace.252 + nop + exec.::std::sys::truncate_stack +end + +proc init + push.1179648 + trace.240 + exec.::intrinsics::mem::heap_init + trace.252 + push.[7028007876379170725,18060021366771303825,13412364500725888848,14178532912296021363] + adv.push_mapval + push.262144 + push.1 + trace.240 + exec.::std::mem::pipe_preimage_to_memory + trace.252 + drop + push.1048576 + u32assert + mem_store.278536 + push.0 + u32assert + mem_store.278537 +end + +# mod miden:rust-sdk-account-faucet-get-total-issuance-binding/rust-sdk-account-faucet-get-total-issuance-binding@0.0.1::rust_sdk_account_faucet_get_total_issuance_binding + +@callconv("C") +proc __wasm_call_ctors( + +) + nop +end + +@callconv("C") +proc rust_sdk_account_faucet_get_total_issuance_binding::bindings::__link_custom_section_describing_imports( + +) + nop +end + +@callconv("C") +proc miden:rust-sdk-account-faucet-get-total-issuance-binding/rust-sdk-account-faucet-get-total-issuance-binding@0.0.1#binding( + +) -> felt + trace.240 + nop + exec.::miden:rust-sdk-account-faucet-get-total-issuance-binding/rust-sdk-account-faucet-get-total-issuance-binding@0.0.1::rust_sdk_account_faucet_get_total_issuance_binding::wit_bindgen::rt::run_ctors_once + trace.252 + nop + trace.240 + nop + exec.::miden:rust-sdk-account-faucet-get-total-issuance-binding/rust-sdk-account-faucet-get-total-issuance-binding@0.0.1::rust_sdk_account_faucet_get_total_issuance_binding::miden::faucet::get_total_issuance + trace.252 + nop +end + +@callconv("C") +proc wit_bindgen::rt::run_ctors_once( + +) + push.1114148 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.1048584 + u32wrapping_add + u32divmod.4 + swap.1 + swap.1 + dup.1 + mem_load + swap.1 + push.8 + u32wrapping_mul + u32shr + swap.1 + drop + push.255 + u32and + push.0 + swap.1 + neq + if.true + nop + else + push.1114148 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + trace.240 + nop + exec.::miden:rust-sdk-account-faucet-get-total-issuance-binding/rust-sdk-account-faucet-get-total-issuance-binding@0.0.1::rust_sdk_account_faucet_get_total_issuance_binding::__wasm_call_ctors + trace.252 + nop + push.1 + push.1048584 + movup.2 + u32wrapping_add + u32divmod.4 + swap.1 + dup.0 + mem_load + dup.2 + push.8 + u32wrapping_mul + push.255 + swap.1 + u32shl + u32not + swap.1 + u32and + movup.3 + movup.3 + push.8 + u32wrapping_mul + u32shl + u32or + swap.1 + mem_store + end +end + +@callconv("C") +proc miden::faucet::get_total_issuance( + +) -> felt + trace.240 + nop + exec.::miden::faucet::get_total_issuance + trace.252 + nop +end + diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_get_total_issuance_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_get_total_issuance_binding.wat new file mode 100644 index 000000000..e0a015d57 --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_get_total_issuance_binding.wat @@ -0,0 +1,73 @@ +(component + (type (;0;) + (instance + (type (;0;) (record (field "inner" f32))) + (export (;1;) "felt" (type (eq 0))) + ) + ) + (import "miden:base/core-types@1.0.0" (instance (;0;) (type 0))) + (core module (;0;) + (type (;0;) (func)) + (type (;1;) (func (result f32))) + (table (;0;) 2 2 funcref) + (memory (;0;) 17) + (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) + (global $GOT.data.internal.__memory_base (;1;) i32 i32.const 0) + (export "memory" (memory 0)) + (export "miden:rust-sdk-account-faucet-get-total-issuance-binding/rust-sdk-account-faucet-get-total-issuance-binding@0.0.1#binding" (func $miden:rust-sdk-account-faucet-get-total-issuance-binding/rust-sdk-account-faucet-get-total-issuance-binding@0.0.1#binding)) + (elem (;0;) (i32.const 1) func $rust_sdk_account_faucet_get_total_issuance_binding::bindings::__link_custom_section_describing_imports) + (func $__wasm_call_ctors (;0;) (type 0)) + (func $rust_sdk_account_faucet_get_total_issuance_binding::bindings::__link_custom_section_describing_imports (;1;) (type 0)) + (func $miden:rust-sdk-account-faucet-get-total-issuance-binding/rust-sdk-account-faucet-get-total-issuance-binding@0.0.1#binding (;2;) (type 1) (result f32) + call $wit_bindgen::rt::run_ctors_once + call $miden::faucet::get_total_issuance + ) + (func $wit_bindgen::rt::run_ctors_once (;3;) (type 0) + (local i32) + block ;; label = @1 + global.get $GOT.data.internal.__memory_base + i32.const 1048584 + i32.add + i32.load8_u + br_if 0 (;@1;) + global.get $GOT.data.internal.__memory_base + local.set 0 + call $__wasm_call_ctors + local.get 0 + i32.const 1048584 + i32.add + i32.const 1 + i32.store8 + end + ) + (func $miden::faucet::get_total_issuance (;4;) (type 1) (result f32) + unreachable + ) + (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") + (@custom "rodata,miden_account" (after data) "erust_sdk_account_faucet_get_total_issuance_binding\01\0b0.0.1\05\02\03\01\00\00") + ) + (alias export 0 "felt" (type (;1;))) + (core instance (;0;) (instantiate 0)) + (alias core export 0 "memory" (core memory (;0;))) + (type (;2;) (func (result 1))) + (alias core export 0 "miden:rust-sdk-account-faucet-get-total-issuance-binding/rust-sdk-account-faucet-get-total-issuance-binding@0.0.1#binding" (core func (;0;))) + (func (;0;) (type 2) (canon lift (core func 0))) + (alias export 0 "felt" (type (;3;))) + (component (;0;) + (type (;0;) (record (field "inner" f32))) + (import "import-type-felt" (type (;1;) (eq 0))) + (import "import-type-felt0" (type (;2;) (eq 1))) + (type (;3;) (func (result 2))) + (import "import-func-binding" (func (;0;) (type 3))) + (export (;4;) "felt" (type 1)) + (type (;5;) (func (result 4))) + (export (;1;) "binding" (func 0) (func (type 5))) + ) + (instance (;1;) (instantiate 0 + (with "import-func-binding" (func 0)) + (with "import-type-felt" (type 3)) + (with "import-type-felt0" (type 1)) + ) + ) + (export (;2;) "miden:rust-sdk-account-faucet-get-total-issuance-binding/rust-sdk-account-faucet-get-total-issuance-binding@0.0.1" (instance 1)) +) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_is_non_fungible_asset_issued_binding.hir b/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_is_non_fungible_asset_issued_binding.hir new file mode 100644 index 000000000..ce629ad80 --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_is_non_fungible_asset_issued_binding.hir @@ -0,0 +1,219 @@ +builtin.component miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk-account-faucet-is-non-fungible-asset-issued-binding@0.0.1 { + builtin.module public @rust_sdk_account_faucet_is_non_fungible_asset_issued_binding { + private builtin.function @__wasm_call_ctors() { + ^block5: + builtin.ret ; + }; + + private builtin.function @rust_sdk_account_faucet_is_non_fungible_asset_issued_binding::bindings::__link_custom_section_describing_imports() { + ^block7: + builtin.ret ; + }; + + private builtin.function @miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk-account-faucet-is-non-fungible-asset-issued-binding@0.0.1#binding() -> felt { + ^block9: + v3 = builtin.global_symbol @miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk-account-faucet-is-non-fungible-asset-issued-binding@0.0.1/rust_sdk_account_faucet_is_non_fungible_asset_issued_binding/__stack_pointer : ptr + v4 = hir.bitcast v3 : ptr; + v5 = hir.load v4 : i32; + v6 = arith.constant 32 : i32; + v7 = arith.sub v5, v6 : i32 #[overflow = wrapping]; + v8 = builtin.global_symbol @miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk-account-faucet-is-non-fungible-asset-issued-binding@0.0.1/rust_sdk_account_faucet_is_non_fungible_asset_issued_binding/__stack_pointer : ptr + v9 = hir.bitcast v8 : ptr; + hir.store v9, v7; + hir.exec @miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk-account-faucet-is-non-fungible-asset-issued-binding@0.0.1/rust_sdk_account_faucet_is_non_fungible_asset_issued_binding/wit_bindgen::rt::run_ctors_once() + v1 = arith.constant 0 : i32; + v12 = hir.exec @miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk-account-faucet-is-non-fungible-asset-issued-binding@0.0.1/rust_sdk_account_faucet_is_non_fungible_asset_issued_binding/intrinsics::felt::from_u32(v1) : felt + v198 = arith.constant 0 : i32; + v176, v177, v178, v179 = scf.while v198, v7, v12 : i32, i32, felt, i32 { + ^block38(v180: i32, v181: i32, v182: felt): + v197 = arith.constant 0 : i32; + v31 = arith.constant 16 : i32; + v15 = arith.eq v180, v31 : i1; + v16 = arith.zext v15 : u32; + v17 = hir.bitcast v16 : i32; + v19 = arith.neq v17, v197 : i1; + v171 = scf.if v19 : i32 { + ^block37: + v142 = ub.poison i32 : i32; + scf.yield v142; + } else { + ^block14: + v196 = arith.constant 16 : i32; + v22 = arith.add v181, v196 : i32 #[overflow = wrapping]; + v23 = arith.add v22, v180 : i32 #[overflow = wrapping]; + v25 = hir.bitcast v23 : u32; + v36 = arith.constant 4 : u32; + v27 = arith.mod v25, v36 : u32; + hir.assertz v27 #[code = 250]; + v28 = hir.int_to_ptr v25 : ptr; + hir.store v28, v182; + v29 = arith.constant 4 : i32; + v30 = arith.add v180, v29 : i32 #[overflow = wrapping]; + scf.yield v30; + }; + v143 = ub.poison felt : felt; + v173 = cf.select v19, v143, v182 : felt; + v195 = ub.poison i32 : i32; + v172 = cf.select v19, v195, v181 : i32; + v141 = arith.constant 1 : u32; + v135 = arith.constant 0 : u32; + v175 = cf.select v19, v135, v141 : u32; + v165 = arith.trunc v175 : i1; + scf.condition v165, v171, v172, v173, v181; + } do { + ^block39(v183: i32, v184: i32, v185: felt, v186: i32): + scf.yield v183, v184, v185; + }; + v194 = arith.constant 16 : i32; + v32 = arith.add v179, v194 : i32 #[overflow = wrapping]; + hir.exec @miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk-account-faucet-is-non-fungible-asset-issued-binding@0.0.1/rust_sdk_account_faucet_is_non_fungible_asset_issued_binding/>::from(v179, v32) + v34 = arith.constant 12 : u32; + v33 = hir.bitcast v179 : u32; + v35 = arith.add v33, v34 : u32 #[overflow = checked]; + v193 = arith.constant 4 : u32; + v37 = arith.mod v35, v193 : u32; + hir.assertz v37 #[code = 250]; + v38 = hir.int_to_ptr v35 : ptr; + v39 = hir.load v38 : felt; + v41 = arith.constant 8 : u32; + v40 = hir.bitcast v179 : u32; + v42 = arith.add v40, v41 : u32 #[overflow = checked]; + v192 = arith.constant 4 : u32; + v44 = arith.mod v42, v192 : u32; + hir.assertz v44 #[code = 250]; + v45 = hir.int_to_ptr v42 : ptr; + v46 = hir.load v45 : felt; + v191 = arith.constant 4 : u32; + v47 = hir.bitcast v179 : u32; + v49 = arith.add v47, v191 : u32 #[overflow = checked]; + v190 = arith.constant 4 : u32; + v51 = arith.mod v49, v190 : u32; + hir.assertz v51 #[code = 250]; + v52 = hir.int_to_ptr v49 : ptr; + v53 = hir.load v52 : felt; + v54 = hir.bitcast v179 : u32; + v189 = arith.constant 4 : u32; + v56 = arith.mod v54, v189 : u32; + hir.assertz v56 #[code = 250]; + v57 = hir.int_to_ptr v54 : ptr; + v58 = hir.load v57 : felt; + v59 = hir.exec @miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk-account-faucet-is-non-fungible-asset-issued-binding@0.0.1/rust_sdk_account_faucet_is_non_fungible_asset_issued_binding/miden::faucet::is_non_fungible_asset_issued(v39, v46, v53, v58) : felt + v188 = arith.constant 0 : i32; + v61 = hir.exec @miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk-account-faucet-is-non-fungible-asset-issued-binding@0.0.1/rust_sdk_account_faucet_is_non_fungible_asset_issued_binding/intrinsics::felt::from_u32(v188) : felt + v62 = hir.exec @miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk-account-faucet-is-non-fungible-asset-issued-binding@0.0.1/rust_sdk_account_faucet_is_non_fungible_asset_issued_binding/intrinsics::felt::eq(v59, v61) : i32 + v63 = arith.constant 1 : i32; + v64 = arith.neq v62, v63 : i1; + v65 = arith.zext v64 : u32; + v66 = hir.bitcast v65 : i32; + v67 = hir.exec @miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk-account-faucet-is-non-fungible-asset-issued-binding@0.0.1/rust_sdk_account_faucet_is_non_fungible_asset_issued_binding/intrinsics::felt::from_u32(v66) : felt + v187 = arith.constant 32 : i32; + v69 = arith.add v179, v187 : i32 #[overflow = wrapping]; + v70 = builtin.global_symbol @miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk-account-faucet-is-non-fungible-asset-issued-binding@0.0.1/rust_sdk_account_faucet_is_non_fungible_asset_issued_binding/__stack_pointer : ptr + v71 = hir.bitcast v70 : ptr; + hir.store v71, v69; + builtin.ret v67; + }; + + private builtin.function @wit_bindgen::rt::run_ctors_once() { + ^block15: + v73 = builtin.global_symbol @miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk-account-faucet-is-non-fungible-asset-issued-binding@0.0.1/rust_sdk_account_faucet_is_non_fungible_asset_issued_binding/GOT.data.internal.__memory_base : ptr + v74 = hir.bitcast v73 : ptr; + v75 = hir.load v74 : i32; + v76 = arith.constant 1048584 : i32; + v77 = arith.add v75, v76 : i32 #[overflow = wrapping]; + v78 = hir.bitcast v77 : u32; + v79 = hir.int_to_ptr v78 : ptr; + v80 = hir.load v79 : u8; + v72 = arith.constant 0 : i32; + v81 = arith.zext v80 : u32; + v82 = hir.bitcast v81 : i32; + v84 = arith.neq v82, v72 : i1; + scf.if v84{ + ^block17: + scf.yield ; + } else { + ^block18: + v85 = builtin.global_symbol @miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk-account-faucet-is-non-fungible-asset-issued-binding@0.0.1/rust_sdk_account_faucet_is_non_fungible_asset_issued_binding/GOT.data.internal.__memory_base : ptr + v86 = hir.bitcast v85 : ptr; + v87 = hir.load v86 : i32; + hir.exec @miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk-account-faucet-is-non-fungible-asset-issued-binding@0.0.1/rust_sdk_account_faucet_is_non_fungible_asset_issued_binding/__wasm_call_ctors() + v200 = arith.constant 1 : u8; + v202 = arith.constant 1048584 : i32; + v89 = arith.add v87, v202 : i32 #[overflow = wrapping]; + v93 = hir.bitcast v89 : u32; + v94 = hir.int_to_ptr v93 : ptr; + hir.store v94, v200; + scf.yield ; + }; + builtin.ret ; + }; + + private builtin.function @>::from(v95: i32, v96: i32) { + ^block19(v95: i32, v96: i32): + v98 = arith.constant 8 : u32; + v97 = hir.bitcast v96 : u32; + v99 = arith.add v97, v98 : u32 #[overflow = checked]; + v100 = arith.constant 4 : u32; + v101 = arith.mod v99, v100 : u32; + hir.assertz v101 #[code = 250]; + v102 = hir.int_to_ptr v99 : ptr; + v103 = hir.load v102 : i64; + v206 = arith.constant 8 : u32; + v104 = hir.bitcast v95 : u32; + v106 = arith.add v104, v206 : u32 #[overflow = checked]; + v205 = arith.constant 8 : u32; + v108 = arith.mod v106, v205 : u32; + hir.assertz v108 #[code = 250]; + v109 = hir.int_to_ptr v106 : ptr; + hir.store v109, v103; + v110 = hir.bitcast v96 : u32; + v204 = arith.constant 4 : u32; + v112 = arith.mod v110, v204 : u32; + hir.assertz v112 #[code = 250]; + v113 = hir.int_to_ptr v110 : ptr; + v114 = hir.load v113 : i64; + v115 = hir.bitcast v95 : u32; + v203 = arith.constant 8 : u32; + v117 = arith.mod v115, v203 : u32; + hir.assertz v117 #[code = 250]; + v118 = hir.int_to_ptr v115 : ptr; + hir.store v118, v114; + builtin.ret ; + }; + + private builtin.function @intrinsics::felt::from_u32(v119: i32) -> felt { + ^block21(v119: i32): + v120 = hir.bitcast v119 : felt; + builtin.ret v120; + }; + + private builtin.function @intrinsics::felt::eq(v122: felt, v123: felt) -> i32 { + ^block23(v122: felt, v123: felt): + v124 = arith.eq v122, v123 : i1; + v125 = hir.cast v124 : i32; + builtin.ret v125; + }; + + private builtin.function @miden::faucet::is_non_fungible_asset_issued(v127: felt, v128: felt, v129: felt, v130: felt) -> felt { + ^block25(v127: felt, v128: felt, v129: felt, v130: felt): + v131 = hir.exec @miden/faucet/is_non_fungible_asset_issued(v127, v128, v129, v130) : felt + builtin.ret v131; + }; + + builtin.global_variable private @#__stack_pointer : i32 { + builtin.ret_imm 1048576; + }; + + builtin.global_variable private @#GOT.data.internal.__memory_base : i32 { + builtin.ret_imm 0; + }; + + builtin.segment @1048576 = 0x0000000100000001; + }; + + public builtin.function @binding() -> felt { + ^block29: + v133 = hir.exec @miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk-account-faucet-is-non-fungible-asset-issued-binding@0.0.1/rust_sdk_account_faucet_is_non_fungible_asset_issued_binding/miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk-account-faucet-is-non-fungible-asset-issued-binding@0.0.1#binding() : felt + builtin.ret v133; + }; +}; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_is_non_fungible_asset_issued_binding.masm b/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_is_non_fungible_asset_issued_binding.masm new file mode 100644 index 000000000..6c5cb0975 --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_is_non_fungible_asset_issued_binding.masm @@ -0,0 +1,433 @@ +# mod miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk-account-faucet-is-non-fungible-asset-issued-binding@0.0.1 + +@callconv("canon-lift") +pub proc binding( + +) -> felt + exec.::miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk-account-faucet-is-non-fungible-asset-issued-binding@0.0.1::init + trace.240 + nop + exec.::miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk-account-faucet-is-non-fungible-asset-issued-binding@0.0.1::rust_sdk_account_faucet_is_non_fungible_asset_issued_binding::miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk-account-faucet-is-non-fungible-asset-issued-binding@0.0.1#binding + trace.252 + nop + exec.::std::sys::truncate_stack +end + +proc init + push.1179648 + trace.240 + exec.::intrinsics::mem::heap_init + trace.252 + push.[7028007876379170725,18060021366771303825,13412364500725888848,14178532912296021363] + adv.push_mapval + push.262144 + push.1 + trace.240 + exec.::std::mem::pipe_preimage_to_memory + trace.252 + drop + push.1048576 + u32assert + mem_store.278536 + push.0 + u32assert + mem_store.278537 +end + +# mod miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk-account-faucet-is-non-fungible-asset-issued-binding@0.0.1::rust_sdk_account_faucet_is_non_fungible_asset_issued_binding + +@callconv("C") +proc __wasm_call_ctors( + +) + nop +end + +@callconv("C") +proc rust_sdk_account_faucet_is_non_fungible_asset_issued_binding::bindings::__link_custom_section_describing_imports( + +) + nop +end + +@callconv("C") +proc miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk-account-faucet-is-non-fungible-asset-issued-binding@0.0.1#binding( + +) -> felt + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.32 + u32wrapping_sub + push.1114144 + dup.1 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + trace.240 + nop + exec.::miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk-account-faucet-is-non-fungible-asset-issued-binding@0.0.1::rust_sdk_account_faucet_is_non_fungible_asset_issued_binding::wit_bindgen::rt::run_ctors_once + trace.252 + nop + push.0 + trace.240 + nop + exec.::miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk-account-faucet-is-non-fungible-asset-issued-binding@0.0.1::rust_sdk_account_faucet_is_non_fungible_asset_issued_binding::intrinsics::felt::from_u32 + trace.252 + nop + push.0 + movup.2 + swap.1 + push.1 + while.true + push.0 + push.16 + dup.2 + eq + neq + dup.0 + if.true + swap.1 + drop + push.3735929054 + else + push.16 + dup.3 + u32wrapping_add + dup.2 + u32wrapping_add + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + dup.4 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.4 + movup.2 + u32wrapping_add + end + push.3735929054 + dup.2 + movup.2 + swap.5 + movdn.2 + cdrop + push.3735929054 + dup.2 + dup.4 + swap.2 + swap.1 + cdrop + push.1 + push.0 + movup.4 + cdrop + push.1 + u32and + movup.4 + swap.1 + if.true + movup.3 + drop + push.1 + else + push.0 + end + end + drop + drop + drop + push.16 + dup.1 + u32wrapping_add + dup.1 + trace.240 + nop + exec.::miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk-account-faucet-is-non-fungible-asset-issued-binding@0.0.1::rust_sdk_account_faucet_is_non_fungible_asset_issued_binding::>::from + trace.252 + nop + push.12 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.8 + dup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.4 + dup.3 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + dup.3 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + movdn.3 + swap.2 + trace.240 + nop + exec.::miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk-account-faucet-is-non-fungible-asset-issued-binding@0.0.1::rust_sdk_account_faucet_is_non_fungible_asset_issued_binding::miden::faucet::is_non_fungible_asset_issued + trace.252 + nop + push.0 + trace.240 + nop + exec.::miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk-account-faucet-is-non-fungible-asset-issued-binding@0.0.1::rust_sdk_account_faucet_is_non_fungible_asset_issued_binding::intrinsics::felt::from_u32 + trace.252 + nop + swap.1 + trace.240 + nop + exec.::miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk-account-faucet-is-non-fungible-asset-issued-binding@0.0.1::rust_sdk_account_faucet_is_non_fungible_asset_issued_binding::intrinsics::felt::eq + trace.252 + nop + push.1 + neq + trace.240 + nop + exec.::miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk-account-faucet-is-non-fungible-asset-issued-binding@0.0.1::rust_sdk_account_faucet_is_non_fungible_asset_issued_binding::intrinsics::felt::from_u32 + trace.252 + nop + push.32 + movup.2 + u32wrapping_add + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop +end + +@callconv("C") +proc wit_bindgen::rt::run_ctors_once( + +) + push.1114148 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.1048584 + u32wrapping_add + u32divmod.4 + swap.1 + swap.1 + dup.1 + mem_load + swap.1 + push.8 + u32wrapping_mul + u32shr + swap.1 + drop + push.255 + u32and + push.0 + swap.1 + neq + if.true + nop + else + push.1114148 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + trace.240 + nop + exec.::miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk-account-faucet-is-non-fungible-asset-issued-binding@0.0.1::rust_sdk_account_faucet_is_non_fungible_asset_issued_binding::__wasm_call_ctors + trace.252 + nop + push.1 + push.1048584 + movup.2 + u32wrapping_add + u32divmod.4 + swap.1 + dup.0 + mem_load + dup.2 + push.8 + u32wrapping_mul + push.255 + swap.1 + u32shl + u32not + swap.1 + u32and + movup.3 + movup.3 + push.8 + u32wrapping_mul + u32shl + u32or + swap.1 + mem_store + end +end + +@callconv("C") +proc >::from( + i32, + i32 +) + push.8 + dup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.8 + dup.3 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + swap.1 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + movup.2 + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop +end + +@callconv("C") +proc intrinsics::felt::from_u32(i32) -> felt + nop +end + +@callconv("C") +proc intrinsics::felt::eq(felt, felt) -> i32 + eq +end + +@callconv("C") +proc miden::faucet::is_non_fungible_asset_issued(felt, felt, felt, felt) -> felt + trace.240 + nop + exec.::miden::faucet::is_non_fungible_asset_issued + trace.252 + nop +end + diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_is_non_fungible_asset_issued_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_is_non_fungible_asset_issued_binding.wat new file mode 100644 index 000000000..560c4cdb7 --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_is_non_fungible_asset_issued_binding.wat @@ -0,0 +1,149 @@ +(component + (type (;0;) + (instance + (type (;0;) (record (field "inner" f32))) + (export (;1;) "felt" (type (eq 0))) + ) + ) + (import "miden:base/core-types@1.0.0" (instance (;0;) (type 0))) + (core module (;0;) + (type (;0;) (func)) + (type (;1;) (func (result f32))) + (type (;2;) (func (param i32 i32))) + (type (;3;) (func (param i32) (result f32))) + (type (;4;) (func (param f32 f32) (result i32))) + (type (;5;) (func (param f32 f32 f32 f32) (result f32))) + (table (;0;) 2 2 funcref) + (memory (;0;) 17) + (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) + (global $GOT.data.internal.__memory_base (;1;) i32 i32.const 0) + (export "memory" (memory 0)) + (export "miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk-account-faucet-is-non-fungible-asset-issued-binding@0.0.1#binding" (func $miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk-account-faucet-is-non-fungible-asset-issued-binding@0.0.1#binding)) + (elem (;0;) (i32.const 1) func $rust_sdk_account_faucet_is_non_fungible_asset_issued_binding::bindings::__link_custom_section_describing_imports) + (func $__wasm_call_ctors (;0;) (type 0)) + (func $rust_sdk_account_faucet_is_non_fungible_asset_issued_binding::bindings::__link_custom_section_describing_imports (;1;) (type 0)) + (func $miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk-account-faucet-is-non-fungible-asset-issued-binding@0.0.1#binding (;2;) (type 1) (result f32) + (local i32 i32 f32) + global.get $__stack_pointer + i32.const 32 + i32.sub + local.tee 0 + global.set $__stack_pointer + call $wit_bindgen::rt::run_ctors_once + i32.const 0 + local.set 1 + i32.const 0 + call $intrinsics::felt::from_u32 + local.set 2 + block ;; label = @1 + loop ;; label = @2 + local.get 1 + i32.const 16 + i32.eq + br_if 1 (;@1;) + local.get 0 + i32.const 16 + i32.add + local.get 1 + i32.add + local.get 2 + f32.store + local.get 1 + i32.const 4 + i32.add + local.set 1 + br 0 (;@2;) + end + end + local.get 0 + local.get 0 + i32.const 16 + i32.add + call $>::from + local.get 0 + f32.load offset=12 + local.get 0 + f32.load offset=8 + local.get 0 + f32.load offset=4 + local.get 0 + f32.load + call $miden::faucet::is_non_fungible_asset_issued + i32.const 0 + call $intrinsics::felt::from_u32 + call $intrinsics::felt::eq + i32.const 1 + i32.ne + call $intrinsics::felt::from_u32 + local.set 2 + local.get 0 + i32.const 32 + i32.add + global.set $__stack_pointer + local.get 2 + ) + (func $wit_bindgen::rt::run_ctors_once (;3;) (type 0) + (local i32) + block ;; label = @1 + global.get $GOT.data.internal.__memory_base + i32.const 1048584 + i32.add + i32.load8_u + br_if 0 (;@1;) + global.get $GOT.data.internal.__memory_base + local.set 0 + call $__wasm_call_ctors + local.get 0 + i32.const 1048584 + i32.add + i32.const 1 + i32.store8 + end + ) + (func $>::from (;4;) (type 2) (param i32 i32) + local.get 0 + local.get 1 + i64.load offset=8 align=4 + i64.store offset=8 + local.get 0 + local.get 1 + i64.load align=4 + i64.store + ) + (func $intrinsics::felt::from_u32 (;5;) (type 3) (param i32) (result f32) + unreachable + ) + (func $intrinsics::felt::eq (;6;) (type 4) (param f32 f32) (result i32) + unreachable + ) + (func $miden::faucet::is_non_fungible_asset_issued (;7;) (type 5) (param f32 f32 f32 f32) (result f32) + unreachable + ) + (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") + (@custom "rodata,miden_account" (after data) "yrust_sdk_account_faucet_is_non_fungible_asset_issued_binding\01\0b0.0.1\05\02\03\01\00\00\00\00\00\00\00\00") + ) + (alias export 0 "felt" (type (;1;))) + (core instance (;0;) (instantiate 0)) + (alias core export 0 "memory" (core memory (;0;))) + (type (;2;) (func (result 1))) + (alias core export 0 "miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk-account-faucet-is-non-fungible-asset-issued-binding@0.0.1#binding" (core func (;0;))) + (func (;0;) (type 2) (canon lift (core func 0))) + (alias export 0 "felt" (type (;3;))) + (component (;0;) + (type (;0;) (record (field "inner" f32))) + (import "import-type-felt" (type (;1;) (eq 0))) + (import "import-type-felt0" (type (;2;) (eq 1))) + (type (;3;) (func (result 2))) + (import "import-func-binding" (func (;0;) (type 3))) + (export (;4;) "felt" (type 1)) + (type (;5;) (func (result 4))) + (export (;1;) "binding" (func 0) (func (type 5))) + ) + (instance (;1;) (instantiate 0 + (with "import-func-binding" (func 0)) + (with "import-type-felt" (type 3)) + (with "import-type-felt0" (type 1)) + ) + ) + (export (;2;) "miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk-account-faucet-is-non-fungible-asset-issued-binding@0.0.1" (instance 1)) +) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_mint_binding.hir b/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_mint_binding.hir new file mode 100644 index 000000000..f22d25f15 --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_mint_binding.hir @@ -0,0 +1,463 @@ +builtin.component miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1 { + builtin.module public @rust_sdk_account_faucet_mint_binding { + private builtin.function @__wasm_call_ctors() { + ^block5: + builtin.ret ; + }; + + private builtin.function @rust_sdk_account_faucet_mint_binding::bindings::__link_custom_section_describing_imports() { + ^block7: + builtin.ret ; + }; + + private builtin.function @miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1#binding() -> i32 { + ^block9: + v3 = builtin.global_symbol @miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1/rust_sdk_account_faucet_mint_binding/__stack_pointer : ptr + v4 = hir.bitcast v3 : ptr; + v5 = hir.load v4 : i32; + v6 = arith.constant 32 : i32; + v7 = arith.sub v5, v6 : i32 #[overflow = wrapping]; + v8 = builtin.global_symbol @miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1/rust_sdk_account_faucet_mint_binding/__stack_pointer : ptr + v9 = hir.bitcast v8 : ptr; + hir.store v9, v7; + hir.exec @miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1/rust_sdk_account_faucet_mint_binding/wit_bindgen::rt::run_ctors_once() + v1 = arith.constant 0 : i32; + v12 = hir.exec @miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1/rust_sdk_account_faucet_mint_binding/intrinsics::felt::from_u32(v1) : felt + v389 = arith.constant 0 : i32; + v368, v369, v370, v371 = scf.while v389, v7, v12 : i32, i32, felt, i32 { + ^block44(v372: i32, v373: i32, v374: felt): + v388 = arith.constant 0 : i32; + v34 = arith.constant 16 : i32; + v15 = arith.eq v372, v34 : i1; + v16 = arith.zext v15 : u32; + v17 = hir.bitcast v16 : i32; + v19 = arith.neq v17, v388 : i1; + v363 = scf.if v19 : i32 { + ^block43: + v334 = ub.poison i32 : i32; + scf.yield v334; + } else { + ^block14: + v387 = arith.constant 16 : i32; + v22 = arith.add v373, v387 : i32 #[overflow = wrapping]; + v23 = arith.add v22, v372 : i32 #[overflow = wrapping]; + v25 = hir.bitcast v23 : u32; + v50 = arith.constant 4 : u32; + v27 = arith.mod v25, v50 : u32; + hir.assertz v27 #[code = 250]; + v28 = hir.int_to_ptr v25 : ptr; + hir.store v28, v374; + v29 = arith.constant 4 : i32; + v30 = arith.add v372, v29 : i32 #[overflow = wrapping]; + scf.yield v30; + }; + v335 = ub.poison felt : felt; + v365 = cf.select v19, v335, v374 : felt; + v386 = ub.poison i32 : i32; + v364 = cf.select v19, v386, v373 : i32; + v333 = arith.constant 1 : u32; + v327 = arith.constant 0 : u32; + v367 = cf.select v19, v327, v333 : u32; + v357 = arith.trunc v367 : i1; + scf.condition v357, v363, v364, v365, v373; + } do { + ^block45(v375: i32, v376: i32, v377: felt, v378: i32): + scf.yield v375, v376, v377; + }; + v31 = builtin.global_symbol @miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1/rust_sdk_account_faucet_mint_binding/GOT.data.internal.__memory_base : ptr + v32 = hir.bitcast v31 : ptr; + v33 = hir.load v32 : i32; + v385 = arith.constant 16 : i32; + v35 = arith.add v371, v385 : i32 #[overflow = wrapping]; + hir.exec @miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1/rust_sdk_account_faucet_mint_binding/>::from(v371, v35) + v384 = arith.constant 16 : i32; + v37 = arith.add v371, v384 : i32 #[overflow = wrapping]; + hir.exec @miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1/rust_sdk_account_faucet_mint_binding/miden_base_sys::bindings::faucet::mint(v37, v371) + v38 = arith.constant 1048584 : i32; + v39 = arith.add v33, v38 : i32 #[overflow = wrapping]; + v41 = arith.constant 24 : u32; + v40 = hir.bitcast v371 : u32; + v42 = arith.add v40, v41 : u32 #[overflow = checked]; + v43 = arith.constant 8 : u32; + v44 = arith.mod v42, v43 : u32; + hir.assertz v44 #[code = 250]; + v45 = hir.int_to_ptr v42 : ptr; + v46 = hir.load v45 : i64; + v383 = arith.constant 8 : u32; + v47 = hir.bitcast v39 : u32; + v49 = arith.add v47, v383 : u32 #[overflow = checked]; + v382 = arith.constant 4 : u32; + v51 = arith.mod v49, v382 : u32; + hir.assertz v51 #[code = 250]; + v52 = hir.int_to_ptr v49 : ptr; + hir.store v52, v46; + v54 = arith.constant 16 : u32; + v53 = hir.bitcast v371 : u32; + v55 = arith.add v53, v54 : u32 #[overflow = checked]; + v381 = arith.constant 8 : u32; + v57 = arith.mod v55, v381 : u32; + hir.assertz v57 #[code = 250]; + v58 = hir.int_to_ptr v55 : ptr; + v59 = hir.load v58 : i64; + v60 = hir.bitcast v39 : u32; + v380 = arith.constant 4 : u32; + v62 = arith.mod v60, v380 : u32; + hir.assertz v62 #[code = 250]; + v63 = hir.int_to_ptr v60 : ptr; + hir.store v63, v59; + v379 = arith.constant 32 : i32; + v65 = arith.add v371, v379 : i32 #[overflow = wrapping]; + v66 = builtin.global_symbol @miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1/rust_sdk_account_faucet_mint_binding/__stack_pointer : ptr + v67 = hir.bitcast v66 : ptr; + hir.store v67, v65; + builtin.ret v39; + }; + + private builtin.function @wit_bindgen::rt::run_ctors_once() { + ^block15: + v69 = builtin.global_symbol @miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1/rust_sdk_account_faucet_mint_binding/GOT.data.internal.__memory_base : ptr + v70 = hir.bitcast v69 : ptr; + v71 = hir.load v70 : i32; + v72 = arith.constant 1048600 : i32; + v73 = arith.add v71, v72 : i32 #[overflow = wrapping]; + v74 = hir.bitcast v73 : u32; + v75 = hir.int_to_ptr v74 : ptr; + v76 = hir.load v75 : u8; + v68 = arith.constant 0 : i32; + v77 = arith.zext v76 : u32; + v78 = hir.bitcast v77 : i32; + v80 = arith.neq v78, v68 : i1; + scf.if v80{ + ^block17: + scf.yield ; + } else { + ^block18: + v81 = builtin.global_symbol @miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1/rust_sdk_account_faucet_mint_binding/GOT.data.internal.__memory_base : ptr + v82 = hir.bitcast v81 : ptr; + v83 = hir.load v82 : i32; + hir.exec @miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1/rust_sdk_account_faucet_mint_binding/__wasm_call_ctors() + v391 = arith.constant 1 : u8; + v393 = arith.constant 1048600 : i32; + v85 = arith.add v83, v393 : i32 #[overflow = wrapping]; + v89 = hir.bitcast v85 : u32; + v90 = hir.int_to_ptr v89 : ptr; + hir.store v90, v391; + scf.yield ; + }; + builtin.ret ; + }; + + private builtin.function @miden_base_sys::bindings::faucet::mint(v91: i32, v92: i32) { + ^block19(v91: i32, v92: i32): + v94 = builtin.global_symbol @miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1/rust_sdk_account_faucet_mint_binding/__stack_pointer : ptr + v95 = hir.bitcast v94 : ptr; + v96 = hir.load v95 : i32; + v97 = arith.constant 32 : i32; + v98 = arith.sub v96, v97 : i32 #[overflow = wrapping]; + v99 = builtin.global_symbol @miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1/rust_sdk_account_faucet_mint_binding/__stack_pointer : ptr + v100 = hir.bitcast v99 : ptr; + hir.store v100, v98; + v102 = arith.constant 12 : u32; + v101 = hir.bitcast v92 : u32; + v103 = arith.add v101, v102 : u32 #[overflow = checked]; + v104 = arith.constant 4 : u32; + v105 = arith.mod v103, v104 : u32; + hir.assertz v105 #[code = 250]; + v106 = hir.int_to_ptr v103 : ptr; + v107 = hir.load v106 : felt; + v109 = arith.constant 8 : u32; + v108 = hir.bitcast v92 : u32; + v110 = arith.add v108, v109 : u32 #[overflow = checked]; + v403 = arith.constant 4 : u32; + v112 = arith.mod v110, v403 : u32; + hir.assertz v112 #[code = 250]; + v113 = hir.int_to_ptr v110 : ptr; + v114 = hir.load v113 : felt; + v402 = arith.constant 4 : u32; + v115 = hir.bitcast v92 : u32; + v117 = arith.add v115, v402 : u32 #[overflow = checked]; + v401 = arith.constant 4 : u32; + v119 = arith.mod v117, v401 : u32; + hir.assertz v119 #[code = 250]; + v120 = hir.int_to_ptr v117 : ptr; + v121 = hir.load v120 : felt; + v122 = hir.bitcast v92 : u32; + v400 = arith.constant 4 : u32; + v124 = arith.mod v122, v400 : u32; + hir.assertz v124 #[code = 250]; + v125 = hir.int_to_ptr v122 : ptr; + v126 = hir.load v125 : felt; + hir.exec @miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1/rust_sdk_account_faucet_mint_binding/miden::faucet::mint(v107, v114, v121, v126, v98) + v399 = arith.constant 8 : u32; + v127 = hir.bitcast v98 : u32; + v129 = arith.add v127, v399 : u32 #[overflow = checked]; + v398 = arith.constant 8 : u32; + v131 = arith.mod v129, v398 : u32; + hir.assertz v131 #[code = 250]; + v132 = hir.int_to_ptr v129 : ptr; + v133 = hir.load v132 : i64; + v135 = arith.constant 24 : u32; + v134 = hir.bitcast v98 : u32; + v136 = arith.add v134, v135 : u32 #[overflow = checked]; + v397 = arith.constant 8 : u32; + v138 = arith.mod v136, v397 : u32; + hir.assertz v138 #[code = 250]; + v139 = hir.int_to_ptr v136 : ptr; + hir.store v139, v133; + v140 = hir.bitcast v98 : u32; + v396 = arith.constant 8 : u32; + v142 = arith.mod v140, v396 : u32; + hir.assertz v142 #[code = 250]; + v143 = hir.int_to_ptr v140 : ptr; + v144 = hir.load v143 : i64; + v146 = arith.constant 16 : u32; + v145 = hir.bitcast v98 : u32; + v147 = arith.add v145, v146 : u32 #[overflow = checked]; + v395 = arith.constant 8 : u32; + v149 = arith.mod v147, v395 : u32; + hir.assertz v149 #[code = 250]; + v150 = hir.int_to_ptr v147 : ptr; + hir.store v150, v144; + v151 = arith.constant 16 : i32; + v152 = arith.add v98, v151 : i32 #[overflow = wrapping]; + hir.exec @miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1/rust_sdk_account_faucet_mint_binding/miden_stdlib_sys::intrinsics::word::Word::reverse(v91, v152) + v394 = arith.constant 32 : i32; + v154 = arith.add v98, v394 : i32 #[overflow = wrapping]; + v155 = builtin.global_symbol @miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1/rust_sdk_account_faucet_mint_binding/__stack_pointer : ptr + v156 = hir.bitcast v155 : ptr; + hir.store v156, v154; + builtin.ret ; + }; + + private builtin.function @>::from(v157: i32, v158: i32) { + ^block21(v157: i32, v158: i32): + v160 = arith.constant 8 : u32; + v159 = hir.bitcast v158 : u32; + v161 = arith.add v159, v160 : u32 #[overflow = checked]; + v162 = arith.constant 4 : u32; + v163 = arith.mod v161, v162 : u32; + hir.assertz v163 #[code = 250]; + v164 = hir.int_to_ptr v161 : ptr; + v165 = hir.load v164 : i64; + v407 = arith.constant 8 : u32; + v166 = hir.bitcast v157 : u32; + v168 = arith.add v166, v407 : u32 #[overflow = checked]; + v406 = arith.constant 8 : u32; + v170 = arith.mod v168, v406 : u32; + hir.assertz v170 #[code = 250]; + v171 = hir.int_to_ptr v168 : ptr; + hir.store v171, v165; + v172 = hir.bitcast v158 : u32; + v405 = arith.constant 4 : u32; + v174 = arith.mod v172, v405 : u32; + hir.assertz v174 #[code = 250]; + v175 = hir.int_to_ptr v172 : ptr; + v176 = hir.load v175 : i64; + v177 = hir.bitcast v157 : u32; + v404 = arith.constant 8 : u32; + v179 = arith.mod v177, v404 : u32; + hir.assertz v179 #[code = 250]; + v180 = hir.int_to_ptr v177 : ptr; + hir.store v180, v176; + builtin.ret ; + }; + + private builtin.function @miden_stdlib_sys::intrinsics::word::Word::reverse(v181: i32, v182: i32) { + ^block23(v181: i32, v182: i32): + v185 = builtin.global_symbol @miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1/rust_sdk_account_faucet_mint_binding/__stack_pointer : ptr + v186 = hir.bitcast v185 : ptr; + v187 = hir.load v186 : i32; + v188 = arith.constant 16 : i32; + v189 = arith.sub v187, v188 : i32 #[overflow = wrapping]; + v191 = arith.constant 8 : u32; + v190 = hir.bitcast v182 : u32; + v192 = arith.add v190, v191 : u32 #[overflow = checked]; + v494 = arith.constant 8 : u32; + v194 = arith.mod v192, v494 : u32; + hir.assertz v194 #[code = 250]; + v195 = hir.int_to_ptr v192 : ptr; + v196 = hir.load v195 : i64; + v493 = arith.constant 8 : u32; + v197 = hir.bitcast v189 : u32; + v199 = arith.add v197, v493 : u32 #[overflow = checked]; + v200 = arith.constant 4 : u32; + v201 = arith.mod v199, v200 : u32; + hir.assertz v201 #[code = 250]; + v202 = hir.int_to_ptr v199 : ptr; + hir.store v202, v196; + v203 = hir.bitcast v182 : u32; + v492 = arith.constant 8 : u32; + v205 = arith.mod v203, v492 : u32; + hir.assertz v205 #[code = 250]; + v206 = hir.int_to_ptr v203 : ptr; + v207 = hir.load v206 : i64; + v208 = hir.bitcast v189 : u32; + v491 = arith.constant 4 : u32; + v210 = arith.mod v208, v491 : u32; + hir.assertz v210 #[code = 250]; + v211 = hir.int_to_ptr v208 : ptr; + hir.store v211, v207; + v212 = arith.constant 12 : i32; + v213 = arith.add v189, v212 : i32 #[overflow = wrapping]; + v183 = arith.constant 0 : i32; + v462, v463, v464, v465, v466, v467 = scf.while v183, v189, v213, v181 : i32, i32, i32, i32, i32, i32 { + ^block54(v468: i32, v469: i32, v470: i32, v471: i32): + v490 = arith.constant 0 : i32; + v216 = arith.constant 8 : i32; + v217 = arith.eq v468, v216 : i1; + v218 = arith.zext v217 : u32; + v219 = hir.bitcast v218 : i32; + v221 = arith.neq v219, v490 : i1; + v456, v457 = scf.if v221 : i32, i32 { + ^block53: + v416 = ub.poison i32 : i32; + scf.yield v416, v416; + } else { + ^block28: + v223 = arith.add v469, v468 : i32 #[overflow = wrapping]; + v224 = hir.bitcast v223 : u32; + v489 = arith.constant 4 : u32; + v226 = arith.mod v224, v489 : u32; + hir.assertz v226 #[code = 250]; + v227 = hir.int_to_ptr v224 : ptr; + v228 = hir.load v227 : felt; + v230 = hir.bitcast v470 : u32; + v488 = arith.constant 4 : u32; + v232 = arith.mod v230, v488 : u32; + hir.assertz v232 #[code = 250]; + v233 = hir.int_to_ptr v230 : ptr; + v234 = hir.load v233 : i32; + v235 = hir.bitcast v223 : u32; + v487 = arith.constant 4 : u32; + v237 = arith.mod v235, v487 : u32; + hir.assertz v237 #[code = 250]; + v238 = hir.int_to_ptr v235 : ptr; + hir.store v238, v234; + v239 = hir.bitcast v470 : u32; + v486 = arith.constant 4 : u32; + v241 = arith.mod v239, v486 : u32; + hir.assertz v241 #[code = 250]; + v242 = hir.int_to_ptr v239 : ptr; + hir.store v242, v228; + v245 = arith.constant -4 : i32; + v246 = arith.add v470, v245 : i32 #[overflow = wrapping]; + v243 = arith.constant 4 : i32; + v244 = arith.add v468, v243 : i32 #[overflow = wrapping]; + scf.yield v244, v246; + }; + v484 = ub.poison i32 : i32; + v459 = cf.select v221, v484, v471 : i32; + v485 = ub.poison i32 : i32; + v458 = cf.select v221, v485, v469 : i32; + v415 = arith.constant 1 : u32; + v408 = arith.constant 0 : u32; + v461 = cf.select v221, v408, v415 : u32; + v449 = arith.trunc v461 : i1; + scf.condition v449, v456, v458, v457, v459, v469, v471; + } do { + ^block55(v472: i32, v473: i32, v474: i32, v475: i32, v476: i32, v477: i32): + scf.yield v472, v473, v474, v475; + }; + v483 = arith.constant 8 : u32; + v248 = hir.bitcast v466 : u32; + v250 = arith.add v248, v483 : u32 #[overflow = checked]; + v482 = arith.constant 4 : u32; + v252 = arith.mod v250, v482 : u32; + hir.assertz v252 #[code = 250]; + v253 = hir.int_to_ptr v250 : ptr; + v254 = hir.load v253 : i64; + v481 = arith.constant 8 : u32; + v255 = hir.bitcast v467 : u32; + v257 = arith.add v255, v481 : u32 #[overflow = checked]; + v480 = arith.constant 8 : u32; + v259 = arith.mod v257, v480 : u32; + hir.assertz v259 #[code = 250]; + v260 = hir.int_to_ptr v257 : ptr; + hir.store v260, v254; + v261 = hir.bitcast v466 : u32; + v479 = arith.constant 4 : u32; + v263 = arith.mod v261, v479 : u32; + hir.assertz v263 #[code = 250]; + v264 = hir.int_to_ptr v261 : ptr; + v265 = hir.load v264 : i64; + v266 = hir.bitcast v467 : u32; + v478 = arith.constant 8 : u32; + v268 = arith.mod v266, v478 : u32; + hir.assertz v268 #[code = 250]; + v269 = hir.int_to_ptr v266 : ptr; + hir.store v269, v265; + builtin.ret ; + }; + + private builtin.function @intrinsics::felt::from_u32(v270: i32) -> felt { + ^block29(v270: i32): + v271 = hir.bitcast v270 : felt; + builtin.ret v271; + }; + + private builtin.function @miden::faucet::mint(v273: felt, v274: felt, v275: felt, v276: felt, v277: i32) { + ^block31(v273: felt, v274: felt, v275: felt, v276: felt, v277: i32): + v278, v279, v280, v281 = hir.exec @miden/faucet/mint(v273, v274, v275, v276) : felt, felt, felt, felt + v282 = hir.bitcast v277 : u32; + v283 = hir.int_to_ptr v282 : ptr; + hir.store v283, v278; + v284 = arith.constant 4 : u32; + v285 = arith.add v282, v284 : u32 #[overflow = checked]; + v286 = hir.int_to_ptr v285 : ptr; + hir.store v286, v279; + v287 = arith.constant 8 : u32; + v288 = arith.add v282, v287 : u32 #[overflow = checked]; + v289 = hir.int_to_ptr v288 : ptr; + hir.store v289, v280; + v290 = arith.constant 12 : u32; + v291 = arith.add v282, v290 : u32 #[overflow = checked]; + v292 = hir.int_to_ptr v291 : ptr; + hir.store v292, v281; + builtin.ret ; + }; + + builtin.global_variable private @#__stack_pointer : i32 { + builtin.ret_imm 1048576; + }; + + builtin.global_variable private @#GOT.data.internal.__memory_base : i32 { + builtin.ret_imm 0; + }; + + builtin.segment @1048576 = 0x0000000100000001; + }; + + public builtin.function @binding() -> felt, felt, felt, felt { + ^block35: + v293 = hir.exec @miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1/rust_sdk_account_faucet_mint_binding/miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1#binding() : i32 + v500 = arith.constant 0 : i32; + v294 = arith.constant 0 : i32; + v295 = arith.add v293, v294 : i32 #[overflow = unchecked]; + v297 = arith.add v295, v500 : i32 #[overflow = unchecked]; + v498 = arith.constant 0 : i32; + v499 = arith.constant 0 : i32; + v299 = arith.add v297, v499 : i32 #[overflow = unchecked]; + v301 = arith.add v299, v498 : i32 #[overflow = unchecked]; + v302 = hir.int_to_ptr v301 : ptr; + v303 = hir.load v302 : felt; + v497 = arith.constant 0 : i32; + v304 = arith.constant 4 : i32; + v305 = arith.add v297, v304 : i32 #[overflow = unchecked]; + v307 = arith.add v305, v497 : i32 #[overflow = unchecked]; + v308 = hir.int_to_ptr v307 : ptr; + v309 = hir.load v308 : felt; + v496 = arith.constant 0 : i32; + v310 = arith.constant 8 : i32; + v311 = arith.add v297, v310 : i32 #[overflow = unchecked]; + v313 = arith.add v311, v496 : i32 #[overflow = unchecked]; + v314 = hir.int_to_ptr v313 : ptr; + v315 = hir.load v314 : felt; + v495 = arith.constant 0 : i32; + v316 = arith.constant 12 : i32; + v317 = arith.add v297, v316 : i32 #[overflow = unchecked]; + v319 = arith.add v317, v495 : i32 #[overflow = unchecked]; + v320 = hir.int_to_ptr v319 : ptr; + v321 = hir.load v320 : felt; + builtin.ret v303, v309, v315, v321; + }; +}; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_mint_binding.masm b/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_mint_binding.masm new file mode 100644 index 000000000..ee80e678f --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_mint_binding.masm @@ -0,0 +1,972 @@ +# mod miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1 + +@callconv("canon-lift") +pub proc binding( + +) -> (felt, felt, felt, felt) + exec.::miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1::init + trace.240 + nop + exec.::miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1::rust_sdk_account_faucet_mint_binding::miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1#binding + trace.252 + nop + push.0 + push.0 + movup.2 + u32wrapping_add + u32wrapping_add + push.0 + push.0 + dup.2 + u32wrapping_add + u32wrapping_add + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.0 + push.4 + dup.3 + u32wrapping_add + u32wrapping_add + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.0 + push.8 + dup.4 + u32wrapping_add + u32wrapping_add + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.0 + push.12 + movup.5 + u32wrapping_add + u32wrapping_add + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + movdn.3 + swap.2 + exec.::std::sys::truncate_stack +end + +proc init + push.1179648 + trace.240 + exec.::intrinsics::mem::heap_init + trace.252 + push.[7028007876379170725,18060021366771303825,13412364500725888848,14178532912296021363] + adv.push_mapval + push.262144 + push.1 + trace.240 + exec.::std::mem::pipe_preimage_to_memory + trace.252 + drop + push.1048576 + u32assert + mem_store.278536 + push.0 + u32assert + mem_store.278537 +end + +# mod miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1::rust_sdk_account_faucet_mint_binding + +@callconv("C") +proc __wasm_call_ctors( + +) + nop +end + +@callconv("C") +proc rust_sdk_account_faucet_mint_binding::bindings::__link_custom_section_describing_imports( + +) + nop +end + +@callconv("C") +proc miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1#binding( + +) -> i32 + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.32 + u32wrapping_sub + push.1114144 + dup.1 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + trace.240 + nop + exec.::miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1::rust_sdk_account_faucet_mint_binding::wit_bindgen::rt::run_ctors_once + trace.252 + nop + push.0 + trace.240 + nop + exec.::miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1::rust_sdk_account_faucet_mint_binding::intrinsics::felt::from_u32 + trace.252 + nop + push.0 + movup.2 + swap.1 + push.1 + while.true + push.0 + push.16 + dup.2 + eq + neq + dup.0 + if.true + swap.1 + drop + push.3735929054 + else + push.16 + dup.3 + u32wrapping_add + dup.2 + u32wrapping_add + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + dup.4 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.4 + movup.2 + u32wrapping_add + end + push.3735929054 + dup.2 + movup.2 + swap.5 + movdn.2 + cdrop + push.3735929054 + dup.2 + dup.4 + swap.2 + swap.1 + cdrop + push.1 + push.0 + movup.4 + cdrop + push.1 + u32and + movup.4 + swap.1 + if.true + movup.3 + drop + push.1 + else + push.0 + end + end + drop + drop + drop + push.1114148 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.16 + dup.2 + u32wrapping_add + dup.2 + trace.240 + nop + exec.::miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1::rust_sdk_account_faucet_mint_binding::>::from + trace.252 + nop + push.16 + dup.2 + u32wrapping_add + dup.2 + swap.1 + trace.240 + nop + exec.::miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1::rust_sdk_account_faucet_mint_binding::miden_base_sys::bindings::faucet::mint + trace.252 + nop + push.1048584 + u32wrapping_add + push.24 + dup.2 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.8 + dup.3 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.16 + dup.2 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + dup.2 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.32 + movup.2 + u32wrapping_add + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop +end + +@callconv("C") +proc wit_bindgen::rt::run_ctors_once( + +) + push.1114148 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.1048600 + u32wrapping_add + u32divmod.4 + swap.1 + swap.1 + dup.1 + mem_load + swap.1 + push.8 + u32wrapping_mul + u32shr + swap.1 + drop + push.255 + u32and + push.0 + swap.1 + neq + if.true + nop + else + push.1114148 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + trace.240 + nop + exec.::miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1::rust_sdk_account_faucet_mint_binding::__wasm_call_ctors + trace.252 + nop + push.1 + push.1048600 + movup.2 + u32wrapping_add + u32divmod.4 + swap.1 + dup.0 + mem_load + dup.2 + push.8 + u32wrapping_mul + push.255 + swap.1 + u32shl + u32not + swap.1 + u32and + movup.3 + movup.3 + push.8 + u32wrapping_mul + u32shl + u32or + swap.1 + mem_store + end +end + +@callconv("C") +proc miden_base_sys::bindings::faucet::mint(i32, i32) + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.32 + u32wrapping_sub + push.1114144 + dup.1 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.12 + dup.3 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.8 + dup.4 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.4 + dup.5 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + movup.5 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + dup.4 + swap.1 + swap.3 + swap.1 + swap.4 + trace.240 + nop + exec.::miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1::rust_sdk_account_faucet_mint_binding::miden::faucet::mint + trace.252 + nop + push.8 + dup.1 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.24 + dup.3 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + dup.0 + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.16 + dup.3 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.16 + dup.1 + u32wrapping_add + movup.2 + trace.240 + nop + exec.::miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1::rust_sdk_account_faucet_mint_binding::miden_stdlib_sys::intrinsics::word::Word::reverse + trace.252 + nop + push.32 + u32wrapping_add + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop +end + +@callconv("C") +proc >::from( + i32, + i32 +) + push.8 + dup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.8 + dup.3 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + swap.1 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + movup.2 + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop +end + +@callconv("C") +proc miden_stdlib_sys::intrinsics::word::Word::reverse( + i32, + i32 +) + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.16 + u32wrapping_sub + push.8 + dup.3 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.8 + dup.3 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + movup.2 + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + dup.2 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.12 + dup.1 + u32wrapping_add + push.0 + movup.2 + swap.1 + push.1 + while.true + push.0 + push.8 + dup.2 + eq + neq + dup.0 + if.true + movup.3 + movup.2 + drop + drop + push.3735929054 + dup.0 + else + dup.2 + dup.2 + u32wrapping_add + dup.0 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + dup.5 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + movup.2 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + dup.4 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.4294967292 + movup.4 + u32wrapping_add + push.4 + movup.3 + u32wrapping_add + end + push.3735929054 + dup.3 + dup.6 + swap.2 + swap.1 + cdrop + push.3735929054 + dup.4 + dup.6 + swap.2 + swap.1 + cdrop + push.1 + push.0 + movup.6 + cdrop + push.1 + u32and + swap.1 + swap.2 + swap.4 + swap.3 + swap.1 + if.true + movup.4 + drop + movup.4 + drop + push.1 + else + push.0 + end + end + drop + drop + drop + drop + push.8 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.8 + dup.4 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + movup.2 + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop +end + +@callconv("C") +proc intrinsics::felt::from_u32(i32) -> felt + nop +end + +@callconv("C") +proc miden::faucet::mint(felt, felt, felt, felt, i32) + trace.240 + nop + exec.::miden::faucet::mint + trace.252 + nop + movup.4 + dup.0 + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.4 + dup.1 + add + u32assert + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.8 + dup.1 + add + u32assert + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.12 + add + u32assert + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop +end + diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_mint_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_mint_binding.wat new file mode 100644 index 000000000..e65684382 --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_mint_binding.wat @@ -0,0 +1,254 @@ +(component + (type (;0;) + (instance + (type (;0;) (record (field "inner" f32))) + (export (;1;) "felt" (type (eq 0))) + (type (;2;) (tuple 1 1 1 1)) + (type (;3;) (record (field "inner" 2))) + (export (;4;) "word" (type (eq 3))) + (type (;5;) (record (field "inner" 4))) + (export (;6;) "asset" (type (eq 5))) + ) + ) + (import "miden:base/core-types@1.0.0" (instance (;0;) (type 0))) + (core module (;0;) + (type (;0;) (func)) + (type (;1;) (func (result i32))) + (type (;2;) (func (param i32 i32))) + (type (;3;) (func (param i32) (result f32))) + (type (;4;) (func (param f32 f32 f32 f32 i32))) + (table (;0;) 2 2 funcref) + (memory (;0;) 17) + (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) + (global $GOT.data.internal.__memory_base (;1;) i32 i32.const 0) + (export "memory" (memory 0)) + (export "miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1#binding" (func $miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1#binding)) + (elem (;0;) (i32.const 1) func $rust_sdk_account_faucet_mint_binding::bindings::__link_custom_section_describing_imports) + (func $__wasm_call_ctors (;0;) (type 0)) + (func $rust_sdk_account_faucet_mint_binding::bindings::__link_custom_section_describing_imports (;1;) (type 0)) + (func $miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1#binding (;2;) (type 1) (result i32) + (local i32 i32 f32) + global.get $__stack_pointer + i32.const 32 + i32.sub + local.tee 0 + global.set $__stack_pointer + call $wit_bindgen::rt::run_ctors_once + i32.const 0 + local.set 1 + i32.const 0 + call $intrinsics::felt::from_u32 + local.set 2 + block ;; label = @1 + loop ;; label = @2 + local.get 1 + i32.const 16 + i32.eq + br_if 1 (;@1;) + local.get 0 + i32.const 16 + i32.add + local.get 1 + i32.add + local.get 2 + f32.store + local.get 1 + i32.const 4 + i32.add + local.set 1 + br 0 (;@2;) + end + end + global.get $GOT.data.internal.__memory_base + local.set 1 + local.get 0 + local.get 0 + i32.const 16 + i32.add + call $>::from + local.get 0 + i32.const 16 + i32.add + local.get 0 + call $miden_base_sys::bindings::faucet::mint + local.get 1 + i32.const 1048584 + i32.add + local.tee 1 + local.get 0 + i64.load offset=24 + i64.store offset=8 align=4 + local.get 1 + local.get 0 + i64.load offset=16 + i64.store align=4 + local.get 0 + i32.const 32 + i32.add + global.set $__stack_pointer + local.get 1 + ) + (func $wit_bindgen::rt::run_ctors_once (;3;) (type 0) + (local i32) + block ;; label = @1 + global.get $GOT.data.internal.__memory_base + i32.const 1048600 + i32.add + i32.load8_u + br_if 0 (;@1;) + global.get $GOT.data.internal.__memory_base + local.set 0 + call $__wasm_call_ctors + local.get 0 + i32.const 1048600 + i32.add + i32.const 1 + i32.store8 + end + ) + (func $miden_base_sys::bindings::faucet::mint (;4;) (type 2) (param i32 i32) + (local i32) + global.get $__stack_pointer + i32.const 32 + i32.sub + local.tee 2 + global.set $__stack_pointer + local.get 1 + f32.load offset=12 + local.get 1 + f32.load offset=8 + local.get 1 + f32.load offset=4 + local.get 1 + f32.load + local.get 2 + call $miden::faucet::mint + local.get 2 + local.get 2 + i64.load offset=8 + i64.store offset=24 + local.get 2 + local.get 2 + i64.load + i64.store offset=16 + local.get 0 + local.get 2 + i32.const 16 + i32.add + call $miden_stdlib_sys::intrinsics::word::Word::reverse + local.get 2 + i32.const 32 + i32.add + global.set $__stack_pointer + ) + (func $>::from (;5;) (type 2) (param i32 i32) + local.get 0 + local.get 1 + i64.load offset=8 align=4 + i64.store offset=8 + local.get 0 + local.get 1 + i64.load align=4 + i64.store + ) + (func $miden_stdlib_sys::intrinsics::word::Word::reverse (;6;) (type 2) (param i32 i32) + (local i32 i32 i32 f32) + global.get $__stack_pointer + i32.const 16 + i32.sub + local.tee 2 + local.get 1 + i64.load offset=8 + i64.store offset=8 align=4 + local.get 2 + local.get 1 + i64.load + i64.store align=4 + local.get 2 + i32.const 12 + i32.add + local.set 3 + i32.const 0 + local.set 1 + block ;; label = @1 + loop ;; label = @2 + local.get 1 + i32.const 8 + i32.eq + br_if 1 (;@1;) + local.get 2 + local.get 1 + i32.add + local.tee 4 + f32.load + local.set 5 + local.get 4 + local.get 3 + i32.load + i32.store + local.get 3 + local.get 5 + f32.store + local.get 1 + i32.const 4 + i32.add + local.set 1 + local.get 3 + i32.const -4 + i32.add + local.set 3 + br 0 (;@2;) + end + end + local.get 0 + local.get 2 + i64.load offset=8 align=4 + i64.store offset=8 + local.get 0 + local.get 2 + i64.load align=4 + i64.store + ) + (func $intrinsics::felt::from_u32 (;7;) (type 3) (param i32) (result f32) + unreachable + ) + (func $miden::faucet::mint (;8;) (type 4) (param f32 f32 f32 f32 i32) + unreachable + ) + (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") + (@custom "rodata,miden_account" (after data) "Irust_sdk_account_faucet_mint_binding\01\0b0.0.1\05\02\03\01") + ) + (alias export 0 "asset" (type (;1;))) + (core instance (;0;) (instantiate 0)) + (alias core export 0 "memory" (core memory (;0;))) + (type (;2;) (func (result 1))) + (alias core export 0 "miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1#binding" (core func (;0;))) + (func (;0;) (type 2) (canon lift (core func 0) (memory 0))) + (alias export 0 "felt" (type (;3;))) + (alias export 0 "word" (type (;4;))) + (alias export 0 "asset" (type (;5;))) + (component (;0;) + (type (;0;) (record (field "inner" f32))) + (import "import-type-felt" (type (;1;) (eq 0))) + (type (;2;) (tuple 1 1 1 1)) + (type (;3;) (record (field "inner" 2))) + (import "import-type-word" (type (;4;) (eq 3))) + (type (;5;) (record (field "inner" 4))) + (import "import-type-asset" (type (;6;) (eq 5))) + (import "import-type-asset0" (type (;7;) (eq 6))) + (type (;8;) (func (result 7))) + (import "import-func-binding" (func (;0;) (type 8))) + (export (;9;) "asset" (type 6)) + (type (;10;) (func (result 9))) + (export (;1;) "binding" (func 0) (func (type 10))) + ) + (instance (;1;) (instantiate 0 + (with "import-func-binding" (func 0)) + (with "import-type-felt" (type 3)) + (with "import-type-word" (type 4)) + (with "import-type-asset" (type 5)) + (with "import-type-asset0" (type 1)) + ) + ) + (export (;2;) "miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1" (instance 1)) +) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_get_code_commitment_binding.hir b/tests/integration/expected/rust_sdk/rust_sdk_account_get_code_commitment_binding.hir new file mode 100644 index 000000000..a76522173 --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_get_code_commitment_binding.hir @@ -0,0 +1,327 @@ +builtin.component miden:rust-sdk-account-get-code-commitment-binding/rust-sdk-account-get-code-commitment-binding@0.0.1 { + builtin.module public @rust_sdk_account_get_code_commitment_binding { + private builtin.function @__wasm_call_ctors() { + ^block5: + builtin.ret ; + }; + + private builtin.function @rust_sdk_account_get_code_commitment_binding::bindings::__link_custom_section_describing_imports() { + ^block7: + builtin.ret ; + }; + + private builtin.function @miden:rust-sdk-account-get-code-commitment-binding/rust-sdk-account-get-code-commitment-binding@0.0.1#binding() -> i32 { + ^block9: + v2 = builtin.global_symbol @miden:rust-sdk-account-get-code-commitment-binding/rust-sdk-account-get-code-commitment-binding@0.0.1/rust_sdk_account_get_code_commitment_binding/__stack_pointer : ptr + v3 = hir.bitcast v2 : ptr; + v4 = hir.load v3 : i32; + v5 = arith.constant 48 : i32; + v6 = arith.sub v4, v5 : i32 #[overflow = wrapping]; + v7 = builtin.global_symbol @miden:rust-sdk-account-get-code-commitment-binding/rust-sdk-account-get-code-commitment-binding@0.0.1/rust_sdk_account_get_code_commitment_binding/__stack_pointer : ptr + v8 = hir.bitcast v7 : ptr; + hir.store v8, v6; + hir.exec @miden:rust-sdk-account-get-code-commitment-binding/rust-sdk-account-get-code-commitment-binding@0.0.1/rust_sdk_account_get_code_commitment_binding/wit_bindgen::rt::run_ctors_once() + v9 = arith.constant 16 : i32; + v10 = arith.add v6, v9 : i32 #[overflow = wrapping]; + hir.exec @miden:rust-sdk-account-get-code-commitment-binding/rust-sdk-account-get-code-commitment-binding@0.0.1/rust_sdk_account_get_code_commitment_binding/miden::active_account::get_code_commitment(v10) + v12 = arith.constant 24 : u32; + v11 = hir.bitcast v6 : u32; + v13 = arith.add v11, v12 : u32 #[overflow = checked]; + v14 = arith.constant 8 : u32; + v15 = arith.mod v13, v14 : u32; + hir.assertz v15 #[code = 250]; + v16 = hir.int_to_ptr v13 : ptr; + v17 = hir.load v16 : i64; + v19 = arith.constant 40 : u32; + v18 = hir.bitcast v6 : u32; + v20 = arith.add v18, v19 : u32 #[overflow = checked]; + v237 = arith.constant 8 : u32; + v22 = arith.mod v20, v237 : u32; + hir.assertz v22 #[code = 250]; + v23 = hir.int_to_ptr v20 : ptr; + hir.store v23, v17; + v25 = arith.constant 16 : u32; + v24 = hir.bitcast v6 : u32; + v26 = arith.add v24, v25 : u32 #[overflow = checked]; + v236 = arith.constant 8 : u32; + v28 = arith.mod v26, v236 : u32; + hir.assertz v28 #[code = 250]; + v29 = hir.int_to_ptr v26 : ptr; + v30 = hir.load v29 : i64; + v32 = arith.constant 32 : u32; + v31 = hir.bitcast v6 : u32; + v33 = arith.add v31, v32 : u32 #[overflow = checked]; + v235 = arith.constant 8 : u32; + v35 = arith.mod v33, v235 : u32; + hir.assertz v35 #[code = 250]; + v36 = hir.int_to_ptr v33 : ptr; + hir.store v36, v30; + v37 = builtin.global_symbol @miden:rust-sdk-account-get-code-commitment-binding/rust-sdk-account-get-code-commitment-binding@0.0.1/rust_sdk_account_get_code_commitment_binding/GOT.data.internal.__memory_base : ptr + v38 = hir.bitcast v37 : ptr; + v39 = hir.load v38 : i32; + v40 = arith.constant 32 : i32; + v41 = arith.add v6, v40 : i32 #[overflow = wrapping]; + hir.exec @miden:rust-sdk-account-get-code-commitment-binding/rust-sdk-account-get-code-commitment-binding@0.0.1/rust_sdk_account_get_code_commitment_binding/miden_stdlib_sys::intrinsics::word::Word::reverse(v6, v41) + v42 = arith.constant 1048584 : i32; + v43 = arith.add v39, v42 : i32 #[overflow = wrapping]; + v234 = arith.constant 8 : u32; + v44 = hir.bitcast v6 : u32; + v46 = arith.add v44, v234 : u32 #[overflow = checked]; + v233 = arith.constant 8 : u32; + v48 = arith.mod v46, v233 : u32; + hir.assertz v48 #[code = 250]; + v49 = hir.int_to_ptr v46 : ptr; + v50 = hir.load v49 : i64; + v232 = arith.constant 8 : u32; + v51 = hir.bitcast v43 : u32; + v53 = arith.add v51, v232 : u32 #[overflow = checked]; + v54 = arith.constant 4 : u32; + v55 = arith.mod v53, v54 : u32; + hir.assertz v55 #[code = 250]; + v56 = hir.int_to_ptr v53 : ptr; + hir.store v56, v50; + v57 = hir.bitcast v6 : u32; + v231 = arith.constant 8 : u32; + v59 = arith.mod v57, v231 : u32; + hir.assertz v59 #[code = 250]; + v60 = hir.int_to_ptr v57 : ptr; + v61 = hir.load v60 : i64; + v62 = hir.bitcast v43 : u32; + v230 = arith.constant 4 : u32; + v64 = arith.mod v62, v230 : u32; + hir.assertz v64 #[code = 250]; + v65 = hir.int_to_ptr v62 : ptr; + hir.store v65, v61; + v229 = arith.constant 48 : i32; + v67 = arith.add v6, v229 : i32 #[overflow = wrapping]; + v68 = builtin.global_symbol @miden:rust-sdk-account-get-code-commitment-binding/rust-sdk-account-get-code-commitment-binding@0.0.1/rust_sdk_account_get_code_commitment_binding/__stack_pointer : ptr + v69 = hir.bitcast v68 : ptr; + hir.store v69, v67; + builtin.ret v43; + }; + + private builtin.function @wit_bindgen::rt::run_ctors_once() { + ^block11: + v71 = builtin.global_symbol @miden:rust-sdk-account-get-code-commitment-binding/rust-sdk-account-get-code-commitment-binding@0.0.1/rust_sdk_account_get_code_commitment_binding/GOT.data.internal.__memory_base : ptr + v72 = hir.bitcast v71 : ptr; + v73 = hir.load v72 : i32; + v74 = arith.constant 1048600 : i32; + v75 = arith.add v73, v74 : i32 #[overflow = wrapping]; + v76 = hir.bitcast v75 : u32; + v77 = hir.int_to_ptr v76 : ptr; + v78 = hir.load v77 : u8; + v70 = arith.constant 0 : i32; + v79 = arith.zext v78 : u32; + v80 = hir.bitcast v79 : i32; + v82 = arith.neq v80, v70 : i1; + scf.if v82{ + ^block13: + scf.yield ; + } else { + ^block14: + v83 = builtin.global_symbol @miden:rust-sdk-account-get-code-commitment-binding/rust-sdk-account-get-code-commitment-binding@0.0.1/rust_sdk_account_get_code_commitment_binding/GOT.data.internal.__memory_base : ptr + v84 = hir.bitcast v83 : ptr; + v85 = hir.load v84 : i32; + hir.exec @miden:rust-sdk-account-get-code-commitment-binding/rust-sdk-account-get-code-commitment-binding@0.0.1/rust_sdk_account_get_code_commitment_binding/__wasm_call_ctors() + v239 = arith.constant 1 : u8; + v241 = arith.constant 1048600 : i32; + v87 = arith.add v85, v241 : i32 #[overflow = wrapping]; + v91 = hir.bitcast v87 : u32; + v92 = hir.int_to_ptr v91 : ptr; + hir.store v92, v239; + scf.yield ; + }; + builtin.ret ; + }; + + private builtin.function @miden_stdlib_sys::intrinsics::word::Word::reverse(v93: i32, v94: i32) { + ^block15(v93: i32, v94: i32): + v97 = builtin.global_symbol @miden:rust-sdk-account-get-code-commitment-binding/rust-sdk-account-get-code-commitment-binding@0.0.1/rust_sdk_account_get_code_commitment_binding/__stack_pointer : ptr + v98 = hir.bitcast v97 : ptr; + v99 = hir.load v98 : i32; + v100 = arith.constant 16 : i32; + v101 = arith.sub v99, v100 : i32 #[overflow = wrapping]; + v103 = arith.constant 8 : u32; + v102 = hir.bitcast v94 : u32; + v104 = arith.add v102, v103 : u32 #[overflow = checked]; + v328 = arith.constant 8 : u32; + v106 = arith.mod v104, v328 : u32; + hir.assertz v106 #[code = 250]; + v107 = hir.int_to_ptr v104 : ptr; + v108 = hir.load v107 : i64; + v327 = arith.constant 8 : u32; + v109 = hir.bitcast v101 : u32; + v111 = arith.add v109, v327 : u32 #[overflow = checked]; + v112 = arith.constant 4 : u32; + v113 = arith.mod v111, v112 : u32; + hir.assertz v113 #[code = 250]; + v114 = hir.int_to_ptr v111 : ptr; + hir.store v114, v108; + v115 = hir.bitcast v94 : u32; + v326 = arith.constant 8 : u32; + v117 = arith.mod v115, v326 : u32; + hir.assertz v117 #[code = 250]; + v118 = hir.int_to_ptr v115 : ptr; + v119 = hir.load v118 : i64; + v120 = hir.bitcast v101 : u32; + v325 = arith.constant 4 : u32; + v122 = arith.mod v120, v325 : u32; + hir.assertz v122 #[code = 250]; + v123 = hir.int_to_ptr v120 : ptr; + hir.store v123, v119; + v124 = arith.constant 12 : i32; + v125 = arith.add v101, v124 : i32 #[overflow = wrapping]; + v95 = arith.constant 0 : i32; + v296, v297, v298, v299, v300, v301 = scf.while v95, v101, v125, v93 : i32, i32, i32, i32, i32, i32 { + ^block35(v302: i32, v303: i32, v304: i32, v305: i32): + v324 = arith.constant 0 : i32; + v128 = arith.constant 8 : i32; + v129 = arith.eq v302, v128 : i1; + v130 = arith.zext v129 : u32; + v131 = hir.bitcast v130 : i32; + v133 = arith.neq v131, v324 : i1; + v290, v291 = scf.if v133 : i32, i32 { + ^block34: + v250 = ub.poison i32 : i32; + scf.yield v250, v250; + } else { + ^block20: + v135 = arith.add v303, v302 : i32 #[overflow = wrapping]; + v136 = hir.bitcast v135 : u32; + v323 = arith.constant 4 : u32; + v138 = arith.mod v136, v323 : u32; + hir.assertz v138 #[code = 250]; + v139 = hir.int_to_ptr v136 : ptr; + v140 = hir.load v139 : felt; + v142 = hir.bitcast v304 : u32; + v322 = arith.constant 4 : u32; + v144 = arith.mod v142, v322 : u32; + hir.assertz v144 #[code = 250]; + v145 = hir.int_to_ptr v142 : ptr; + v146 = hir.load v145 : i32; + v147 = hir.bitcast v135 : u32; + v321 = arith.constant 4 : u32; + v149 = arith.mod v147, v321 : u32; + hir.assertz v149 #[code = 250]; + v150 = hir.int_to_ptr v147 : ptr; + hir.store v150, v146; + v151 = hir.bitcast v304 : u32; + v320 = arith.constant 4 : u32; + v153 = arith.mod v151, v320 : u32; + hir.assertz v153 #[code = 250]; + v154 = hir.int_to_ptr v151 : ptr; + hir.store v154, v140; + v157 = arith.constant -4 : i32; + v158 = arith.add v304, v157 : i32 #[overflow = wrapping]; + v155 = arith.constant 4 : i32; + v156 = arith.add v302, v155 : i32 #[overflow = wrapping]; + scf.yield v156, v158; + }; + v318 = ub.poison i32 : i32; + v293 = cf.select v133, v318, v305 : i32; + v319 = ub.poison i32 : i32; + v292 = cf.select v133, v319, v303 : i32; + v249 = arith.constant 1 : u32; + v242 = arith.constant 0 : u32; + v295 = cf.select v133, v242, v249 : u32; + v283 = arith.trunc v295 : i1; + scf.condition v283, v290, v292, v291, v293, v303, v305; + } do { + ^block36(v306: i32, v307: i32, v308: i32, v309: i32, v310: i32, v311: i32): + scf.yield v306, v307, v308, v309; + }; + v317 = arith.constant 8 : u32; + v160 = hir.bitcast v300 : u32; + v162 = arith.add v160, v317 : u32 #[overflow = checked]; + v316 = arith.constant 4 : u32; + v164 = arith.mod v162, v316 : u32; + hir.assertz v164 #[code = 250]; + v165 = hir.int_to_ptr v162 : ptr; + v166 = hir.load v165 : i64; + v315 = arith.constant 8 : u32; + v167 = hir.bitcast v301 : u32; + v169 = arith.add v167, v315 : u32 #[overflow = checked]; + v314 = arith.constant 8 : u32; + v171 = arith.mod v169, v314 : u32; + hir.assertz v171 #[code = 250]; + v172 = hir.int_to_ptr v169 : ptr; + hir.store v172, v166; + v173 = hir.bitcast v300 : u32; + v313 = arith.constant 4 : u32; + v175 = arith.mod v173, v313 : u32; + hir.assertz v175 #[code = 250]; + v176 = hir.int_to_ptr v173 : ptr; + v177 = hir.load v176 : i64; + v178 = hir.bitcast v301 : u32; + v312 = arith.constant 8 : u32; + v180 = arith.mod v178, v312 : u32; + hir.assertz v180 #[code = 250]; + v181 = hir.int_to_ptr v178 : ptr; + hir.store v181, v177; + builtin.ret ; + }; + + private builtin.function @miden::active_account::get_code_commitment(v182: i32) { + ^block21(v182: i32): + v183, v184, v185, v186 = hir.exec @miden/active_account/get_code_commitment() : felt, felt, felt, felt + v187 = hir.bitcast v182 : u32; + v188 = hir.int_to_ptr v187 : ptr; + hir.store v188, v183; + v189 = arith.constant 4 : u32; + v190 = arith.add v187, v189 : u32 #[overflow = checked]; + v191 = hir.int_to_ptr v190 : ptr; + hir.store v191, v184; + v192 = arith.constant 8 : u32; + v193 = arith.add v187, v192 : u32 #[overflow = checked]; + v194 = hir.int_to_ptr v193 : ptr; + hir.store v194, v185; + v195 = arith.constant 12 : u32; + v196 = arith.add v187, v195 : u32 #[overflow = checked]; + v197 = hir.int_to_ptr v196 : ptr; + hir.store v197, v186; + builtin.ret ; + }; + + builtin.global_variable private @#__stack_pointer : i32 { + builtin.ret_imm 1048576; + }; + + builtin.global_variable private @#GOT.data.internal.__memory_base : i32 { + builtin.ret_imm 0; + }; + + builtin.segment @1048576 = 0x0000000100000001; + }; + + public builtin.function @binding() -> felt, felt, felt, felt { + ^block25: + v198 = hir.exec @miden:rust-sdk-account-get-code-commitment-binding/rust-sdk-account-get-code-commitment-binding@0.0.1/rust_sdk_account_get_code_commitment_binding/miden:rust-sdk-account-get-code-commitment-binding/rust-sdk-account-get-code-commitment-binding@0.0.1#binding() : i32 + v199 = arith.constant 0 : i32; + v200 = arith.add v198, v199 : i32 #[overflow = unchecked]; + v332 = arith.constant 0 : i32; + v333 = arith.constant 0 : i32; + v202 = arith.add v200, v333 : i32 #[overflow = unchecked]; + v204 = arith.add v202, v332 : i32 #[overflow = unchecked]; + v205 = hir.int_to_ptr v204 : ptr; + v206 = hir.load v205 : felt; + v331 = arith.constant 0 : i32; + v207 = arith.constant 4 : i32; + v208 = arith.add v200, v207 : i32 #[overflow = unchecked]; + v210 = arith.add v208, v331 : i32 #[overflow = unchecked]; + v211 = hir.int_to_ptr v210 : ptr; + v212 = hir.load v211 : felt; + v330 = arith.constant 0 : i32; + v213 = arith.constant 8 : i32; + v214 = arith.add v200, v213 : i32 #[overflow = unchecked]; + v216 = arith.add v214, v330 : i32 #[overflow = unchecked]; + v217 = hir.int_to_ptr v216 : ptr; + v218 = hir.load v217 : felt; + v329 = arith.constant 0 : i32; + v219 = arith.constant 12 : i32; + v220 = arith.add v200, v219 : i32 #[overflow = unchecked]; + v222 = arith.add v220, v329 : i32 #[overflow = unchecked]; + v223 = hir.int_to_ptr v222 : ptr; + v224 = hir.load v223 : felt; + builtin.ret v206, v212, v218, v224; + }; +}; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_get_code_commitment_binding.masm b/tests/integration/expected/rust_sdk/rust_sdk_account_get_code_commitment_binding.masm new file mode 100644 index 000000000..ec54e3e12 --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_get_code_commitment_binding.masm @@ -0,0 +1,698 @@ +# mod miden:rust-sdk-account-get-code-commitment-binding/rust-sdk-account-get-code-commitment-binding@0.0.1 + +@callconv("canon-lift") +pub proc binding( + +) -> (felt, felt, felt, felt) + exec.::miden:rust-sdk-account-get-code-commitment-binding/rust-sdk-account-get-code-commitment-binding@0.0.1::init + trace.240 + nop + exec.::miden:rust-sdk-account-get-code-commitment-binding/rust-sdk-account-get-code-commitment-binding@0.0.1::rust_sdk_account_get_code_commitment_binding::miden:rust-sdk-account-get-code-commitment-binding/rust-sdk-account-get-code-commitment-binding@0.0.1#binding + trace.252 + nop + push.0 + u32wrapping_add + push.0 + push.0 + dup.2 + u32wrapping_add + u32wrapping_add + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.0 + push.4 + dup.3 + u32wrapping_add + u32wrapping_add + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.0 + push.8 + dup.4 + u32wrapping_add + u32wrapping_add + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.0 + push.12 + movup.5 + u32wrapping_add + u32wrapping_add + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + movdn.3 + swap.2 + exec.::std::sys::truncate_stack +end + +proc init + push.1179648 + trace.240 + exec.::intrinsics::mem::heap_init + trace.252 + push.[7028007876379170725,18060021366771303825,13412364500725888848,14178532912296021363] + adv.push_mapval + push.262144 + push.1 + trace.240 + exec.::std::mem::pipe_preimage_to_memory + trace.252 + drop + push.1048576 + u32assert + mem_store.278536 + push.0 + u32assert + mem_store.278537 +end + +# mod miden:rust-sdk-account-get-code-commitment-binding/rust-sdk-account-get-code-commitment-binding@0.0.1::rust_sdk_account_get_code_commitment_binding + +@callconv("C") +proc __wasm_call_ctors( + +) + nop +end + +@callconv("C") +proc rust_sdk_account_get_code_commitment_binding::bindings::__link_custom_section_describing_imports( + +) + nop +end + +@callconv("C") +proc miden:rust-sdk-account-get-code-commitment-binding/rust-sdk-account-get-code-commitment-binding@0.0.1#binding( + +) -> i32 + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.48 + u32wrapping_sub + push.1114144 + dup.1 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + trace.240 + nop + exec.::miden:rust-sdk-account-get-code-commitment-binding/rust-sdk-account-get-code-commitment-binding@0.0.1::rust_sdk_account_get_code_commitment_binding::wit_bindgen::rt::run_ctors_once + trace.252 + nop + push.16 + dup.1 + u32wrapping_add + trace.240 + nop + exec.::miden:rust-sdk-account-get-code-commitment-binding/rust-sdk-account-get-code-commitment-binding@0.0.1::rust_sdk_account_get_code_commitment_binding::miden::active_account::get_code_commitment + trace.252 + nop + push.24 + dup.1 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.40 + dup.3 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.16 + dup.1 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.32 + dup.3 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.1114148 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.32 + dup.2 + u32wrapping_add + dup.2 + trace.240 + nop + exec.::miden:rust-sdk-account-get-code-commitment-binding/rust-sdk-account-get-code-commitment-binding@0.0.1::rust_sdk_account_get_code_commitment_binding::miden_stdlib_sys::intrinsics::word::Word::reverse + trace.252 + nop + push.1048584 + u32wrapping_add + push.8 + dup.2 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.8 + dup.3 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + dup.1 + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + dup.2 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.48 + movup.2 + u32wrapping_add + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop +end + +@callconv("C") +proc wit_bindgen::rt::run_ctors_once( + +) + push.1114148 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.1048600 + u32wrapping_add + u32divmod.4 + swap.1 + swap.1 + dup.1 + mem_load + swap.1 + push.8 + u32wrapping_mul + u32shr + swap.1 + drop + push.255 + u32and + push.0 + swap.1 + neq + if.true + nop + else + push.1114148 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + trace.240 + nop + exec.::miden:rust-sdk-account-get-code-commitment-binding/rust-sdk-account-get-code-commitment-binding@0.0.1::rust_sdk_account_get_code_commitment_binding::__wasm_call_ctors + trace.252 + nop + push.1 + push.1048600 + movup.2 + u32wrapping_add + u32divmod.4 + swap.1 + dup.0 + mem_load + dup.2 + push.8 + u32wrapping_mul + push.255 + swap.1 + u32shl + u32not + swap.1 + u32and + movup.3 + movup.3 + push.8 + u32wrapping_mul + u32shl + u32or + swap.1 + mem_store + end +end + +@callconv("C") +proc miden_stdlib_sys::intrinsics::word::Word::reverse( + i32, + i32 +) + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.16 + u32wrapping_sub + push.8 + dup.3 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.8 + dup.3 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + movup.2 + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + dup.2 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.12 + dup.1 + u32wrapping_add + push.0 + movup.2 + swap.1 + push.1 + while.true + push.0 + push.8 + dup.2 + eq + neq + dup.0 + if.true + movup.3 + movup.2 + drop + drop + push.3735929054 + dup.0 + else + dup.2 + dup.2 + u32wrapping_add + dup.0 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + dup.5 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + movup.2 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + dup.4 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.4294967292 + movup.4 + u32wrapping_add + push.4 + movup.3 + u32wrapping_add + end + push.3735929054 + dup.3 + dup.6 + swap.2 + swap.1 + cdrop + push.3735929054 + dup.4 + dup.6 + swap.2 + swap.1 + cdrop + push.1 + push.0 + movup.6 + cdrop + push.1 + u32and + swap.1 + swap.2 + swap.4 + swap.3 + swap.1 + if.true + movup.4 + drop + movup.4 + drop + push.1 + else + push.0 + end + end + drop + drop + drop + drop + push.8 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.8 + dup.4 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + movup.2 + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop +end + +@callconv("C") +proc miden::active_account::get_code_commitment(i32) + trace.240 + nop + exec.::miden::active_account::get_code_commitment + trace.252 + nop + movup.4 + dup.0 + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.4 + dup.1 + add + u32assert + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.8 + dup.1 + add + u32assert + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.12 + add + u32assert + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop +end + diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_get_code_commitment_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_account_get_code_commitment_binding.wat new file mode 100644 index 000000000..e2502890c --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_get_code_commitment_binding.wat @@ -0,0 +1,181 @@ +(component + (type (;0;) + (instance + (type (;0;) (record (field "inner" f32))) + (export (;1;) "felt" (type (eq 0))) + (type (;2;) (tuple 1 1 1 1)) + (type (;3;) (record (field "inner" 2))) + (export (;4;) "word" (type (eq 3))) + ) + ) + (import "miden:base/core-types@1.0.0" (instance (;0;) (type 0))) + (core module (;0;) + (type (;0;) (func)) + (type (;1;) (func (result i32))) + (type (;2;) (func (param i32 i32))) + (type (;3;) (func (param i32))) + (table (;0;) 2 2 funcref) + (memory (;0;) 17) + (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) + (global $GOT.data.internal.__memory_base (;1;) i32 i32.const 0) + (export "memory" (memory 0)) + (export "miden:rust-sdk-account-get-code-commitment-binding/rust-sdk-account-get-code-commitment-binding@0.0.1#binding" (func $miden:rust-sdk-account-get-code-commitment-binding/rust-sdk-account-get-code-commitment-binding@0.0.1#binding)) + (elem (;0;) (i32.const 1) func $rust_sdk_account_get_code_commitment_binding::bindings::__link_custom_section_describing_imports) + (func $__wasm_call_ctors (;0;) (type 0)) + (func $rust_sdk_account_get_code_commitment_binding::bindings::__link_custom_section_describing_imports (;1;) (type 0)) + (func $miden:rust-sdk-account-get-code-commitment-binding/rust-sdk-account-get-code-commitment-binding@0.0.1#binding (;2;) (type 1) (result i32) + (local i32 i32) + global.get $__stack_pointer + i32.const 48 + i32.sub + local.tee 0 + global.set $__stack_pointer + call $wit_bindgen::rt::run_ctors_once + local.get 0 + i32.const 16 + i32.add + call $miden::active_account::get_code_commitment + local.get 0 + local.get 0 + i64.load offset=24 + i64.store offset=40 + local.get 0 + local.get 0 + i64.load offset=16 + i64.store offset=32 + global.get $GOT.data.internal.__memory_base + local.set 1 + local.get 0 + local.get 0 + i32.const 32 + i32.add + call $miden_stdlib_sys::intrinsics::word::Word::reverse + local.get 1 + i32.const 1048584 + i32.add + local.tee 1 + local.get 0 + i64.load offset=8 + i64.store offset=8 align=4 + local.get 1 + local.get 0 + i64.load + i64.store align=4 + local.get 0 + i32.const 48 + i32.add + global.set $__stack_pointer + local.get 1 + ) + (func $wit_bindgen::rt::run_ctors_once (;3;) (type 0) + (local i32) + block ;; label = @1 + global.get $GOT.data.internal.__memory_base + i32.const 1048600 + i32.add + i32.load8_u + br_if 0 (;@1;) + global.get $GOT.data.internal.__memory_base + local.set 0 + call $__wasm_call_ctors + local.get 0 + i32.const 1048600 + i32.add + i32.const 1 + i32.store8 + end + ) + (func $miden_stdlib_sys::intrinsics::word::Word::reverse (;4;) (type 2) (param i32 i32) + (local i32 i32 i32 f32) + global.get $__stack_pointer + i32.const 16 + i32.sub + local.tee 2 + local.get 1 + i64.load offset=8 + i64.store offset=8 align=4 + local.get 2 + local.get 1 + i64.load + i64.store align=4 + local.get 2 + i32.const 12 + i32.add + local.set 3 + i32.const 0 + local.set 1 + block ;; label = @1 + loop ;; label = @2 + local.get 1 + i32.const 8 + i32.eq + br_if 1 (;@1;) + local.get 2 + local.get 1 + i32.add + local.tee 4 + f32.load + local.set 5 + local.get 4 + local.get 3 + i32.load + i32.store + local.get 3 + local.get 5 + f32.store + local.get 1 + i32.const 4 + i32.add + local.set 1 + local.get 3 + i32.const -4 + i32.add + local.set 3 + br 0 (;@2;) + end + end + local.get 0 + local.get 2 + i64.load offset=8 align=4 + i64.store offset=8 + local.get 0 + local.get 2 + i64.load align=4 + i64.store + ) + (func $miden::active_account::get_code_commitment (;5;) (type 3) (param i32) + unreachable + ) + (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") + (@custom "rodata,miden_account" (after data) "Yrust_sdk_account_get_code_commitment_binding\01\0b0.0.1\03\01\01\00\00\00\00\00\00\00\00\00") + ) + (alias export 0 "word" (type (;1;))) + (core instance (;0;) (instantiate 0)) + (alias core export 0 "memory" (core memory (;0;))) + (type (;2;) (func (result 1))) + (alias core export 0 "miden:rust-sdk-account-get-code-commitment-binding/rust-sdk-account-get-code-commitment-binding@0.0.1#binding" (core func (;0;))) + (func (;0;) (type 2) (canon lift (core func 0) (memory 0))) + (alias export 0 "felt" (type (;3;))) + (alias export 0 "word" (type (;4;))) + (component (;0;) + (type (;0;) (record (field "inner" f32))) + (import "import-type-felt" (type (;1;) (eq 0))) + (type (;2;) (tuple 1 1 1 1)) + (type (;3;) (record (field "inner" 2))) + (import "import-type-word" (type (;4;) (eq 3))) + (import "import-type-word0" (type (;5;) (eq 4))) + (type (;6;) (func (result 5))) + (import "import-func-binding" (func (;0;) (type 6))) + (export (;7;) "word" (type 4)) + (type (;8;) (func (result 7))) + (export (;1;) "binding" (func 0) (func (type 8))) + ) + (instance (;1;) (instantiate 0 + (with "import-func-binding" (func 0)) + (with "import-type-felt" (type 3)) + (with "import-type-word" (type 4)) + (with "import-type-word0" (type 1)) + ) + ) + (export (;2;) "miden:rust-sdk-account-get-code-commitment-binding/rust-sdk-account-get-code-commitment-binding@0.0.1" (instance 1)) +) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_get_initial_balance_binding.hir b/tests/integration/expected/rust_sdk/rust_sdk_account_get_initial_balance_binding.hir new file mode 100644 index 000000000..d26bdb565 --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_get_initial_balance_binding.hir @@ -0,0 +1,86 @@ +builtin.component miden:rust-sdk-account-get-initial-balance-binding/rust-sdk-account-get-initial-balance-binding@0.0.1 { + builtin.module public @rust_sdk_account_get_initial_balance_binding { + private builtin.function @__wasm_call_ctors() { + ^block5: + builtin.ret ; + }; + + private builtin.function @rust_sdk_account_get_initial_balance_binding::bindings::__link_custom_section_describing_imports() { + ^block7: + builtin.ret ; + }; + + private builtin.function @miden:rust-sdk-account-get-initial-balance-binding/rust-sdk-account-get-initial-balance-binding@0.0.1#binding() -> felt { + ^block9: + hir.exec @miden:rust-sdk-account-get-initial-balance-binding/rust-sdk-account-get-initial-balance-binding@0.0.1/rust_sdk_account_get_initial_balance_binding/wit_bindgen::rt::run_ctors_once() + v1 = arith.constant 1 : i32; + v2 = hir.exec @miden:rust-sdk-account-get-initial-balance-binding/rust-sdk-account-get-initial-balance-binding@0.0.1/rust_sdk_account_get_initial_balance_binding/intrinsics::felt::from_u32(v1) : felt + v3 = arith.constant 0 : i32; + v4 = hir.exec @miden:rust-sdk-account-get-initial-balance-binding/rust-sdk-account-get-initial-balance-binding@0.0.1/rust_sdk_account_get_initial_balance_binding/intrinsics::felt::from_u32(v3) : felt + v5 = hir.exec @miden:rust-sdk-account-get-initial-balance-binding/rust-sdk-account-get-initial-balance-binding@0.0.1/rust_sdk_account_get_initial_balance_binding/miden::active_account::get_initial_balance(v2, v4) : felt + builtin.ret v5; + }; + + private builtin.function @wit_bindgen::rt::run_ctors_once() { + ^block11: + v7 = builtin.global_symbol @miden:rust-sdk-account-get-initial-balance-binding/rust-sdk-account-get-initial-balance-binding@0.0.1/rust_sdk_account_get_initial_balance_binding/GOT.data.internal.__memory_base : ptr + v8 = hir.bitcast v7 : ptr; + v9 = hir.load v8 : i32; + v10 = arith.constant 1048584 : i32; + v11 = arith.add v9, v10 : i32 #[overflow = wrapping]; + v12 = hir.bitcast v11 : u32; + v13 = hir.int_to_ptr v12 : ptr; + v14 = hir.load v13 : u8; + v6 = arith.constant 0 : i32; + v15 = arith.zext v14 : u32; + v16 = hir.bitcast v15 : i32; + v18 = arith.neq v16, v6 : i1; + scf.if v18{ + ^block13: + scf.yield ; + } else { + ^block14: + v19 = builtin.global_symbol @miden:rust-sdk-account-get-initial-balance-binding/rust-sdk-account-get-initial-balance-binding@0.0.1/rust_sdk_account_get_initial_balance_binding/GOT.data.internal.__memory_base : ptr + v20 = hir.bitcast v19 : ptr; + v21 = hir.load v20 : i32; + hir.exec @miden:rust-sdk-account-get-initial-balance-binding/rust-sdk-account-get-initial-balance-binding@0.0.1/rust_sdk_account_get_initial_balance_binding/__wasm_call_ctors() + v38 = arith.constant 1 : u8; + v40 = arith.constant 1048584 : i32; + v23 = arith.add v21, v40 : i32 #[overflow = wrapping]; + v27 = hir.bitcast v23 : u32; + v28 = hir.int_to_ptr v27 : ptr; + hir.store v28, v38; + scf.yield ; + }; + builtin.ret ; + }; + + private builtin.function @intrinsics::felt::from_u32(v29: i32) -> felt { + ^block15(v29: i32): + v30 = hir.bitcast v29 : felt; + builtin.ret v30; + }; + + private builtin.function @miden::active_account::get_initial_balance(v32: felt, v33: felt) -> felt { + ^block17(v32: felt, v33: felt): + v34 = hir.exec @miden/active_account/get_initial_balance(v32, v33) : felt + builtin.ret v34; + }; + + builtin.global_variable private @#__stack_pointer : i32 { + builtin.ret_imm 1048576; + }; + + builtin.global_variable private @#GOT.data.internal.__memory_base : i32 { + builtin.ret_imm 0; + }; + + builtin.segment @1048576 = 0x0000000100000001; + }; + + public builtin.function @binding() -> felt { + ^block21: + v36 = hir.exec @miden:rust-sdk-account-get-initial-balance-binding/rust-sdk-account-get-initial-balance-binding@0.0.1/rust_sdk_account_get_initial_balance_binding/miden:rust-sdk-account-get-initial-balance-binding/rust-sdk-account-get-initial-balance-binding@0.0.1#binding() : felt + builtin.ret v36; + }; +}; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_get_initial_balance_binding.masm b/tests/integration/expected/rust_sdk/rust_sdk_account_get_initial_balance_binding.masm new file mode 100644 index 000000000..17d403288 --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_get_initial_balance_binding.masm @@ -0,0 +1,169 @@ +# mod miden:rust-sdk-account-get-initial-balance-binding/rust-sdk-account-get-initial-balance-binding@0.0.1 + +@callconv("canon-lift") +pub proc binding( + +) -> felt + exec.::miden:rust-sdk-account-get-initial-balance-binding/rust-sdk-account-get-initial-balance-binding@0.0.1::init + trace.240 + nop + exec.::miden:rust-sdk-account-get-initial-balance-binding/rust-sdk-account-get-initial-balance-binding@0.0.1::rust_sdk_account_get_initial_balance_binding::miden:rust-sdk-account-get-initial-balance-binding/rust-sdk-account-get-initial-balance-binding@0.0.1#binding + trace.252 + nop + exec.::std::sys::truncate_stack +end + +proc init + push.1179648 + trace.240 + exec.::intrinsics::mem::heap_init + trace.252 + push.[7028007876379170725,18060021366771303825,13412364500725888848,14178532912296021363] + adv.push_mapval + push.262144 + push.1 + trace.240 + exec.::std::mem::pipe_preimage_to_memory + trace.252 + drop + push.1048576 + u32assert + mem_store.278536 + push.0 + u32assert + mem_store.278537 +end + +# mod miden:rust-sdk-account-get-initial-balance-binding/rust-sdk-account-get-initial-balance-binding@0.0.1::rust_sdk_account_get_initial_balance_binding + +@callconv("C") +proc __wasm_call_ctors( + +) + nop +end + +@callconv("C") +proc rust_sdk_account_get_initial_balance_binding::bindings::__link_custom_section_describing_imports( + +) + nop +end + +@callconv("C") +proc miden:rust-sdk-account-get-initial-balance-binding/rust-sdk-account-get-initial-balance-binding@0.0.1#binding( + +) -> felt + trace.240 + nop + exec.::miden:rust-sdk-account-get-initial-balance-binding/rust-sdk-account-get-initial-balance-binding@0.0.1::rust_sdk_account_get_initial_balance_binding::wit_bindgen::rt::run_ctors_once + trace.252 + nop + push.1 + trace.240 + nop + exec.::miden:rust-sdk-account-get-initial-balance-binding/rust-sdk-account-get-initial-balance-binding@0.0.1::rust_sdk_account_get_initial_balance_binding::intrinsics::felt::from_u32 + trace.252 + nop + push.0 + trace.240 + nop + exec.::miden:rust-sdk-account-get-initial-balance-binding/rust-sdk-account-get-initial-balance-binding@0.0.1::rust_sdk_account_get_initial_balance_binding::intrinsics::felt::from_u32 + trace.252 + nop + swap.1 + trace.240 + nop + exec.::miden:rust-sdk-account-get-initial-balance-binding/rust-sdk-account-get-initial-balance-binding@0.0.1::rust_sdk_account_get_initial_balance_binding::miden::active_account::get_initial_balance + trace.252 + nop +end + +@callconv("C") +proc wit_bindgen::rt::run_ctors_once( + +) + push.1114148 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.1048584 + u32wrapping_add + u32divmod.4 + swap.1 + swap.1 + dup.1 + mem_load + swap.1 + push.8 + u32wrapping_mul + u32shr + swap.1 + drop + push.255 + u32and + push.0 + swap.1 + neq + if.true + nop + else + push.1114148 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + trace.240 + nop + exec.::miden:rust-sdk-account-get-initial-balance-binding/rust-sdk-account-get-initial-balance-binding@0.0.1::rust_sdk_account_get_initial_balance_binding::__wasm_call_ctors + trace.252 + nop + push.1 + push.1048584 + movup.2 + u32wrapping_add + u32divmod.4 + swap.1 + dup.0 + mem_load + dup.2 + push.8 + u32wrapping_mul + push.255 + swap.1 + u32shl + u32not + swap.1 + u32and + movup.3 + movup.3 + push.8 + u32wrapping_mul + u32shl + u32or + swap.1 + mem_store + end +end + +@callconv("C") +proc intrinsics::felt::from_u32(i32) -> felt + nop +end + +@callconv("C") +proc miden::active_account::get_initial_balance(felt, felt) -> felt + trace.240 + nop + exec.::miden::active_account::get_initial_balance + trace.252 + nop +end + diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_get_initial_balance_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_account_get_initial_balance_binding.wat new file mode 100644 index 000000000..83e879350 --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_get_initial_balance_binding.wat @@ -0,0 +1,82 @@ +(component + (type (;0;) + (instance + (type (;0;) (record (field "inner" f32))) + (export (;1;) "felt" (type (eq 0))) + ) + ) + (import "miden:base/core-types@1.0.0" (instance (;0;) (type 0))) + (core module (;0;) + (type (;0;) (func)) + (type (;1;) (func (result f32))) + (type (;2;) (func (param i32) (result f32))) + (type (;3;) (func (param f32 f32) (result f32))) + (table (;0;) 2 2 funcref) + (memory (;0;) 17) + (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) + (global $GOT.data.internal.__memory_base (;1;) i32 i32.const 0) + (export "memory" (memory 0)) + (export "miden:rust-sdk-account-get-initial-balance-binding/rust-sdk-account-get-initial-balance-binding@0.0.1#binding" (func $miden:rust-sdk-account-get-initial-balance-binding/rust-sdk-account-get-initial-balance-binding@0.0.1#binding)) + (elem (;0;) (i32.const 1) func $rust_sdk_account_get_initial_balance_binding::bindings::__link_custom_section_describing_imports) + (func $__wasm_call_ctors (;0;) (type 0)) + (func $rust_sdk_account_get_initial_balance_binding::bindings::__link_custom_section_describing_imports (;1;) (type 0)) + (func $miden:rust-sdk-account-get-initial-balance-binding/rust-sdk-account-get-initial-balance-binding@0.0.1#binding (;2;) (type 1) (result f32) + call $wit_bindgen::rt::run_ctors_once + i32.const 1 + call $intrinsics::felt::from_u32 + i32.const 0 + call $intrinsics::felt::from_u32 + call $miden::active_account::get_initial_balance + ) + (func $wit_bindgen::rt::run_ctors_once (;3;) (type 0) + (local i32) + block ;; label = @1 + global.get $GOT.data.internal.__memory_base + i32.const 1048584 + i32.add + i32.load8_u + br_if 0 (;@1;) + global.get $GOT.data.internal.__memory_base + local.set 0 + call $__wasm_call_ctors + local.get 0 + i32.const 1048584 + i32.add + i32.const 1 + i32.store8 + end + ) + (func $intrinsics::felt::from_u32 (;4;) (type 2) (param i32) (result f32) + unreachable + ) + (func $miden::active_account::get_initial_balance (;5;) (type 3) (param f32 f32) (result f32) + unreachable + ) + (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") + (@custom "rodata,miden_account" (after data) "Yrust_sdk_account_get_initial_balance_binding\01\0b0.0.1\03\01\01\00\00\00\00\00\00\00\00\00") + ) + (alias export 0 "felt" (type (;1;))) + (core instance (;0;) (instantiate 0)) + (alias core export 0 "memory" (core memory (;0;))) + (type (;2;) (func (result 1))) + (alias core export 0 "miden:rust-sdk-account-get-initial-balance-binding/rust-sdk-account-get-initial-balance-binding@0.0.1#binding" (core func (;0;))) + (func (;0;) (type 2) (canon lift (core func 0))) + (alias export 0 "felt" (type (;3;))) + (component (;0;) + (type (;0;) (record (field "inner" f32))) + (import "import-type-felt" (type (;1;) (eq 0))) + (import "import-type-felt0" (type (;2;) (eq 1))) + (type (;3;) (func (result 2))) + (import "import-func-binding" (func (;0;) (type 3))) + (export (;4;) "felt" (type 1)) + (type (;5;) (func (result 4))) + (export (;1;) "binding" (func 0) (func (type 5))) + ) + (instance (;1;) (instantiate 0 + (with "import-func-binding" (func 0)) + (with "import-type-felt" (type 3)) + (with "import-type-felt0" (type 1)) + ) + ) + (export (;2;) "miden:rust-sdk-account-get-initial-balance-binding/rust-sdk-account-get-initial-balance-binding@0.0.1" (instance 1)) +) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_get_initial_storage_commitment_binding.hir b/tests/integration/expected/rust_sdk/rust_sdk_account_get_initial_storage_commitment_binding.hir new file mode 100644 index 000000000..a009c558d --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_get_initial_storage_commitment_binding.hir @@ -0,0 +1,327 @@ +builtin.component miden:rust-sdk-account-get-initial-storage-commitment-binding/rust-sdk-account-get-initial-storage-commitment-binding@0.0.1 { + builtin.module public @rust_sdk_account_get_initial_storage_commitment_binding { + private builtin.function @__wasm_call_ctors() { + ^block5: + builtin.ret ; + }; + + private builtin.function @rust_sdk_account_get_initial_storage_commitment_binding::bindings::__link_custom_section_describing_imports() { + ^block7: + builtin.ret ; + }; + + private builtin.function @miden:rust-sdk-account-get-initial-storage-commitment-binding/rust-sdk-account-get-initial-storage-commitment-binding@0.0.1#binding() -> i32 { + ^block9: + v2 = builtin.global_symbol @miden:rust-sdk-account-get-initial-storage-commitment-binding/rust-sdk-account-get-initial-storage-commitment-binding@0.0.1/rust_sdk_account_get_initial_storage_commitment_binding/__stack_pointer : ptr + v3 = hir.bitcast v2 : ptr; + v4 = hir.load v3 : i32; + v5 = arith.constant 48 : i32; + v6 = arith.sub v4, v5 : i32 #[overflow = wrapping]; + v7 = builtin.global_symbol @miden:rust-sdk-account-get-initial-storage-commitment-binding/rust-sdk-account-get-initial-storage-commitment-binding@0.0.1/rust_sdk_account_get_initial_storage_commitment_binding/__stack_pointer : ptr + v8 = hir.bitcast v7 : ptr; + hir.store v8, v6; + hir.exec @miden:rust-sdk-account-get-initial-storage-commitment-binding/rust-sdk-account-get-initial-storage-commitment-binding@0.0.1/rust_sdk_account_get_initial_storage_commitment_binding/wit_bindgen::rt::run_ctors_once() + v9 = arith.constant 16 : i32; + v10 = arith.add v6, v9 : i32 #[overflow = wrapping]; + hir.exec @miden:rust-sdk-account-get-initial-storage-commitment-binding/rust-sdk-account-get-initial-storage-commitment-binding@0.0.1/rust_sdk_account_get_initial_storage_commitment_binding/miden::active_account::get_initial_storage_commitment(v10) + v12 = arith.constant 24 : u32; + v11 = hir.bitcast v6 : u32; + v13 = arith.add v11, v12 : u32 #[overflow = checked]; + v14 = arith.constant 8 : u32; + v15 = arith.mod v13, v14 : u32; + hir.assertz v15 #[code = 250]; + v16 = hir.int_to_ptr v13 : ptr; + v17 = hir.load v16 : i64; + v19 = arith.constant 40 : u32; + v18 = hir.bitcast v6 : u32; + v20 = arith.add v18, v19 : u32 #[overflow = checked]; + v237 = arith.constant 8 : u32; + v22 = arith.mod v20, v237 : u32; + hir.assertz v22 #[code = 250]; + v23 = hir.int_to_ptr v20 : ptr; + hir.store v23, v17; + v25 = arith.constant 16 : u32; + v24 = hir.bitcast v6 : u32; + v26 = arith.add v24, v25 : u32 #[overflow = checked]; + v236 = arith.constant 8 : u32; + v28 = arith.mod v26, v236 : u32; + hir.assertz v28 #[code = 250]; + v29 = hir.int_to_ptr v26 : ptr; + v30 = hir.load v29 : i64; + v32 = arith.constant 32 : u32; + v31 = hir.bitcast v6 : u32; + v33 = arith.add v31, v32 : u32 #[overflow = checked]; + v235 = arith.constant 8 : u32; + v35 = arith.mod v33, v235 : u32; + hir.assertz v35 #[code = 250]; + v36 = hir.int_to_ptr v33 : ptr; + hir.store v36, v30; + v37 = builtin.global_symbol @miden:rust-sdk-account-get-initial-storage-commitment-binding/rust-sdk-account-get-initial-storage-commitment-binding@0.0.1/rust_sdk_account_get_initial_storage_commitment_binding/GOT.data.internal.__memory_base : ptr + v38 = hir.bitcast v37 : ptr; + v39 = hir.load v38 : i32; + v40 = arith.constant 32 : i32; + v41 = arith.add v6, v40 : i32 #[overflow = wrapping]; + hir.exec @miden:rust-sdk-account-get-initial-storage-commitment-binding/rust-sdk-account-get-initial-storage-commitment-binding@0.0.1/rust_sdk_account_get_initial_storage_commitment_binding/miden_stdlib_sys::intrinsics::word::Word::reverse(v6, v41) + v42 = arith.constant 1048584 : i32; + v43 = arith.add v39, v42 : i32 #[overflow = wrapping]; + v234 = arith.constant 8 : u32; + v44 = hir.bitcast v6 : u32; + v46 = arith.add v44, v234 : u32 #[overflow = checked]; + v233 = arith.constant 8 : u32; + v48 = arith.mod v46, v233 : u32; + hir.assertz v48 #[code = 250]; + v49 = hir.int_to_ptr v46 : ptr; + v50 = hir.load v49 : i64; + v232 = arith.constant 8 : u32; + v51 = hir.bitcast v43 : u32; + v53 = arith.add v51, v232 : u32 #[overflow = checked]; + v54 = arith.constant 4 : u32; + v55 = arith.mod v53, v54 : u32; + hir.assertz v55 #[code = 250]; + v56 = hir.int_to_ptr v53 : ptr; + hir.store v56, v50; + v57 = hir.bitcast v6 : u32; + v231 = arith.constant 8 : u32; + v59 = arith.mod v57, v231 : u32; + hir.assertz v59 #[code = 250]; + v60 = hir.int_to_ptr v57 : ptr; + v61 = hir.load v60 : i64; + v62 = hir.bitcast v43 : u32; + v230 = arith.constant 4 : u32; + v64 = arith.mod v62, v230 : u32; + hir.assertz v64 #[code = 250]; + v65 = hir.int_to_ptr v62 : ptr; + hir.store v65, v61; + v229 = arith.constant 48 : i32; + v67 = arith.add v6, v229 : i32 #[overflow = wrapping]; + v68 = builtin.global_symbol @miden:rust-sdk-account-get-initial-storage-commitment-binding/rust-sdk-account-get-initial-storage-commitment-binding@0.0.1/rust_sdk_account_get_initial_storage_commitment_binding/__stack_pointer : ptr + v69 = hir.bitcast v68 : ptr; + hir.store v69, v67; + builtin.ret v43; + }; + + private builtin.function @wit_bindgen::rt::run_ctors_once() { + ^block11: + v71 = builtin.global_symbol @miden:rust-sdk-account-get-initial-storage-commitment-binding/rust-sdk-account-get-initial-storage-commitment-binding@0.0.1/rust_sdk_account_get_initial_storage_commitment_binding/GOT.data.internal.__memory_base : ptr + v72 = hir.bitcast v71 : ptr; + v73 = hir.load v72 : i32; + v74 = arith.constant 1048600 : i32; + v75 = arith.add v73, v74 : i32 #[overflow = wrapping]; + v76 = hir.bitcast v75 : u32; + v77 = hir.int_to_ptr v76 : ptr; + v78 = hir.load v77 : u8; + v70 = arith.constant 0 : i32; + v79 = arith.zext v78 : u32; + v80 = hir.bitcast v79 : i32; + v82 = arith.neq v80, v70 : i1; + scf.if v82{ + ^block13: + scf.yield ; + } else { + ^block14: + v83 = builtin.global_symbol @miden:rust-sdk-account-get-initial-storage-commitment-binding/rust-sdk-account-get-initial-storage-commitment-binding@0.0.1/rust_sdk_account_get_initial_storage_commitment_binding/GOT.data.internal.__memory_base : ptr + v84 = hir.bitcast v83 : ptr; + v85 = hir.load v84 : i32; + hir.exec @miden:rust-sdk-account-get-initial-storage-commitment-binding/rust-sdk-account-get-initial-storage-commitment-binding@0.0.1/rust_sdk_account_get_initial_storage_commitment_binding/__wasm_call_ctors() + v239 = arith.constant 1 : u8; + v241 = arith.constant 1048600 : i32; + v87 = arith.add v85, v241 : i32 #[overflow = wrapping]; + v91 = hir.bitcast v87 : u32; + v92 = hir.int_to_ptr v91 : ptr; + hir.store v92, v239; + scf.yield ; + }; + builtin.ret ; + }; + + private builtin.function @miden_stdlib_sys::intrinsics::word::Word::reverse(v93: i32, v94: i32) { + ^block15(v93: i32, v94: i32): + v97 = builtin.global_symbol @miden:rust-sdk-account-get-initial-storage-commitment-binding/rust-sdk-account-get-initial-storage-commitment-binding@0.0.1/rust_sdk_account_get_initial_storage_commitment_binding/__stack_pointer : ptr + v98 = hir.bitcast v97 : ptr; + v99 = hir.load v98 : i32; + v100 = arith.constant 16 : i32; + v101 = arith.sub v99, v100 : i32 #[overflow = wrapping]; + v103 = arith.constant 8 : u32; + v102 = hir.bitcast v94 : u32; + v104 = arith.add v102, v103 : u32 #[overflow = checked]; + v328 = arith.constant 8 : u32; + v106 = arith.mod v104, v328 : u32; + hir.assertz v106 #[code = 250]; + v107 = hir.int_to_ptr v104 : ptr; + v108 = hir.load v107 : i64; + v327 = arith.constant 8 : u32; + v109 = hir.bitcast v101 : u32; + v111 = arith.add v109, v327 : u32 #[overflow = checked]; + v112 = arith.constant 4 : u32; + v113 = arith.mod v111, v112 : u32; + hir.assertz v113 #[code = 250]; + v114 = hir.int_to_ptr v111 : ptr; + hir.store v114, v108; + v115 = hir.bitcast v94 : u32; + v326 = arith.constant 8 : u32; + v117 = arith.mod v115, v326 : u32; + hir.assertz v117 #[code = 250]; + v118 = hir.int_to_ptr v115 : ptr; + v119 = hir.load v118 : i64; + v120 = hir.bitcast v101 : u32; + v325 = arith.constant 4 : u32; + v122 = arith.mod v120, v325 : u32; + hir.assertz v122 #[code = 250]; + v123 = hir.int_to_ptr v120 : ptr; + hir.store v123, v119; + v124 = arith.constant 12 : i32; + v125 = arith.add v101, v124 : i32 #[overflow = wrapping]; + v95 = arith.constant 0 : i32; + v296, v297, v298, v299, v300, v301 = scf.while v95, v101, v125, v93 : i32, i32, i32, i32, i32, i32 { + ^block35(v302: i32, v303: i32, v304: i32, v305: i32): + v324 = arith.constant 0 : i32; + v128 = arith.constant 8 : i32; + v129 = arith.eq v302, v128 : i1; + v130 = arith.zext v129 : u32; + v131 = hir.bitcast v130 : i32; + v133 = arith.neq v131, v324 : i1; + v290, v291 = scf.if v133 : i32, i32 { + ^block34: + v250 = ub.poison i32 : i32; + scf.yield v250, v250; + } else { + ^block20: + v135 = arith.add v303, v302 : i32 #[overflow = wrapping]; + v136 = hir.bitcast v135 : u32; + v323 = arith.constant 4 : u32; + v138 = arith.mod v136, v323 : u32; + hir.assertz v138 #[code = 250]; + v139 = hir.int_to_ptr v136 : ptr; + v140 = hir.load v139 : felt; + v142 = hir.bitcast v304 : u32; + v322 = arith.constant 4 : u32; + v144 = arith.mod v142, v322 : u32; + hir.assertz v144 #[code = 250]; + v145 = hir.int_to_ptr v142 : ptr; + v146 = hir.load v145 : i32; + v147 = hir.bitcast v135 : u32; + v321 = arith.constant 4 : u32; + v149 = arith.mod v147, v321 : u32; + hir.assertz v149 #[code = 250]; + v150 = hir.int_to_ptr v147 : ptr; + hir.store v150, v146; + v151 = hir.bitcast v304 : u32; + v320 = arith.constant 4 : u32; + v153 = arith.mod v151, v320 : u32; + hir.assertz v153 #[code = 250]; + v154 = hir.int_to_ptr v151 : ptr; + hir.store v154, v140; + v157 = arith.constant -4 : i32; + v158 = arith.add v304, v157 : i32 #[overflow = wrapping]; + v155 = arith.constant 4 : i32; + v156 = arith.add v302, v155 : i32 #[overflow = wrapping]; + scf.yield v156, v158; + }; + v318 = ub.poison i32 : i32; + v293 = cf.select v133, v318, v305 : i32; + v319 = ub.poison i32 : i32; + v292 = cf.select v133, v319, v303 : i32; + v249 = arith.constant 1 : u32; + v242 = arith.constant 0 : u32; + v295 = cf.select v133, v242, v249 : u32; + v283 = arith.trunc v295 : i1; + scf.condition v283, v290, v292, v291, v293, v303, v305; + } do { + ^block36(v306: i32, v307: i32, v308: i32, v309: i32, v310: i32, v311: i32): + scf.yield v306, v307, v308, v309; + }; + v317 = arith.constant 8 : u32; + v160 = hir.bitcast v300 : u32; + v162 = arith.add v160, v317 : u32 #[overflow = checked]; + v316 = arith.constant 4 : u32; + v164 = arith.mod v162, v316 : u32; + hir.assertz v164 #[code = 250]; + v165 = hir.int_to_ptr v162 : ptr; + v166 = hir.load v165 : i64; + v315 = arith.constant 8 : u32; + v167 = hir.bitcast v301 : u32; + v169 = arith.add v167, v315 : u32 #[overflow = checked]; + v314 = arith.constant 8 : u32; + v171 = arith.mod v169, v314 : u32; + hir.assertz v171 #[code = 250]; + v172 = hir.int_to_ptr v169 : ptr; + hir.store v172, v166; + v173 = hir.bitcast v300 : u32; + v313 = arith.constant 4 : u32; + v175 = arith.mod v173, v313 : u32; + hir.assertz v175 #[code = 250]; + v176 = hir.int_to_ptr v173 : ptr; + v177 = hir.load v176 : i64; + v178 = hir.bitcast v301 : u32; + v312 = arith.constant 8 : u32; + v180 = arith.mod v178, v312 : u32; + hir.assertz v180 #[code = 250]; + v181 = hir.int_to_ptr v178 : ptr; + hir.store v181, v177; + builtin.ret ; + }; + + private builtin.function @miden::active_account::get_initial_storage_commitment(v182: i32) { + ^block21(v182: i32): + v183, v184, v185, v186 = hir.exec @miden/active_account/get_initial_storage_commitment() : felt, felt, felt, felt + v187 = hir.bitcast v182 : u32; + v188 = hir.int_to_ptr v187 : ptr; + hir.store v188, v183; + v189 = arith.constant 4 : u32; + v190 = arith.add v187, v189 : u32 #[overflow = checked]; + v191 = hir.int_to_ptr v190 : ptr; + hir.store v191, v184; + v192 = arith.constant 8 : u32; + v193 = arith.add v187, v192 : u32 #[overflow = checked]; + v194 = hir.int_to_ptr v193 : ptr; + hir.store v194, v185; + v195 = arith.constant 12 : u32; + v196 = arith.add v187, v195 : u32 #[overflow = checked]; + v197 = hir.int_to_ptr v196 : ptr; + hir.store v197, v186; + builtin.ret ; + }; + + builtin.global_variable private @#__stack_pointer : i32 { + builtin.ret_imm 1048576; + }; + + builtin.global_variable private @#GOT.data.internal.__memory_base : i32 { + builtin.ret_imm 0; + }; + + builtin.segment @1048576 = 0x0000000100000001; + }; + + public builtin.function @binding() -> felt, felt, felt, felt { + ^block25: + v198 = hir.exec @miden:rust-sdk-account-get-initial-storage-commitment-binding/rust-sdk-account-get-initial-storage-commitment-binding@0.0.1/rust_sdk_account_get_initial_storage_commitment_binding/miden:rust-sdk-account-get-initial-storage-commitment-binding/rust-sdk-account-get-initial-storage-commitment-binding@0.0.1#binding() : i32 + v199 = arith.constant 0 : i32; + v200 = arith.add v198, v199 : i32 #[overflow = unchecked]; + v332 = arith.constant 0 : i32; + v333 = arith.constant 0 : i32; + v202 = arith.add v200, v333 : i32 #[overflow = unchecked]; + v204 = arith.add v202, v332 : i32 #[overflow = unchecked]; + v205 = hir.int_to_ptr v204 : ptr; + v206 = hir.load v205 : felt; + v331 = arith.constant 0 : i32; + v207 = arith.constant 4 : i32; + v208 = arith.add v200, v207 : i32 #[overflow = unchecked]; + v210 = arith.add v208, v331 : i32 #[overflow = unchecked]; + v211 = hir.int_to_ptr v210 : ptr; + v212 = hir.load v211 : felt; + v330 = arith.constant 0 : i32; + v213 = arith.constant 8 : i32; + v214 = arith.add v200, v213 : i32 #[overflow = unchecked]; + v216 = arith.add v214, v330 : i32 #[overflow = unchecked]; + v217 = hir.int_to_ptr v216 : ptr; + v218 = hir.load v217 : felt; + v329 = arith.constant 0 : i32; + v219 = arith.constant 12 : i32; + v220 = arith.add v200, v219 : i32 #[overflow = unchecked]; + v222 = arith.add v220, v329 : i32 #[overflow = unchecked]; + v223 = hir.int_to_ptr v222 : ptr; + v224 = hir.load v223 : felt; + builtin.ret v206, v212, v218, v224; + }; +}; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_get_initial_storage_commitment_binding.masm b/tests/integration/expected/rust_sdk/rust_sdk_account_get_initial_storage_commitment_binding.masm new file mode 100644 index 000000000..0e8946c31 --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_get_initial_storage_commitment_binding.masm @@ -0,0 +1,698 @@ +# mod miden:rust-sdk-account-get-initial-storage-commitment-binding/rust-sdk-account-get-initial-storage-commitment-binding@0.0.1 + +@callconv("canon-lift") +pub proc binding( + +) -> (felt, felt, felt, felt) + exec.::miden:rust-sdk-account-get-initial-storage-commitment-binding/rust-sdk-account-get-initial-storage-commitment-binding@0.0.1::init + trace.240 + nop + exec.::miden:rust-sdk-account-get-initial-storage-commitment-binding/rust-sdk-account-get-initial-storage-commitment-binding@0.0.1::rust_sdk_account_get_initial_storage_commitment_binding::miden:rust-sdk-account-get-initial-storage-commitment-binding/rust-sdk-account-get-initial-storage-commitment-binding@0.0.1#binding + trace.252 + nop + push.0 + u32wrapping_add + push.0 + push.0 + dup.2 + u32wrapping_add + u32wrapping_add + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.0 + push.4 + dup.3 + u32wrapping_add + u32wrapping_add + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.0 + push.8 + dup.4 + u32wrapping_add + u32wrapping_add + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.0 + push.12 + movup.5 + u32wrapping_add + u32wrapping_add + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + movdn.3 + swap.2 + exec.::std::sys::truncate_stack +end + +proc init + push.1179648 + trace.240 + exec.::intrinsics::mem::heap_init + trace.252 + push.[7028007876379170725,18060021366771303825,13412364500725888848,14178532912296021363] + adv.push_mapval + push.262144 + push.1 + trace.240 + exec.::std::mem::pipe_preimage_to_memory + trace.252 + drop + push.1048576 + u32assert + mem_store.278536 + push.0 + u32assert + mem_store.278537 +end + +# mod miden:rust-sdk-account-get-initial-storage-commitment-binding/rust-sdk-account-get-initial-storage-commitment-binding@0.0.1::rust_sdk_account_get_initial_storage_commitment_binding + +@callconv("C") +proc __wasm_call_ctors( + +) + nop +end + +@callconv("C") +proc rust_sdk_account_get_initial_storage_commitment_binding::bindings::__link_custom_section_describing_imports( + +) + nop +end + +@callconv("C") +proc miden:rust-sdk-account-get-initial-storage-commitment-binding/rust-sdk-account-get-initial-storage-commitment-binding@0.0.1#binding( + +) -> i32 + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.48 + u32wrapping_sub + push.1114144 + dup.1 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + trace.240 + nop + exec.::miden:rust-sdk-account-get-initial-storage-commitment-binding/rust-sdk-account-get-initial-storage-commitment-binding@0.0.1::rust_sdk_account_get_initial_storage_commitment_binding::wit_bindgen::rt::run_ctors_once + trace.252 + nop + push.16 + dup.1 + u32wrapping_add + trace.240 + nop + exec.::miden:rust-sdk-account-get-initial-storage-commitment-binding/rust-sdk-account-get-initial-storage-commitment-binding@0.0.1::rust_sdk_account_get_initial_storage_commitment_binding::miden::active_account::get_initial_storage_commitment + trace.252 + nop + push.24 + dup.1 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.40 + dup.3 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.16 + dup.1 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.32 + dup.3 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.1114148 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.32 + dup.2 + u32wrapping_add + dup.2 + trace.240 + nop + exec.::miden:rust-sdk-account-get-initial-storage-commitment-binding/rust-sdk-account-get-initial-storage-commitment-binding@0.0.1::rust_sdk_account_get_initial_storage_commitment_binding::miden_stdlib_sys::intrinsics::word::Word::reverse + trace.252 + nop + push.1048584 + u32wrapping_add + push.8 + dup.2 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.8 + dup.3 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + dup.1 + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + dup.2 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.48 + movup.2 + u32wrapping_add + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop +end + +@callconv("C") +proc wit_bindgen::rt::run_ctors_once( + +) + push.1114148 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.1048600 + u32wrapping_add + u32divmod.4 + swap.1 + swap.1 + dup.1 + mem_load + swap.1 + push.8 + u32wrapping_mul + u32shr + swap.1 + drop + push.255 + u32and + push.0 + swap.1 + neq + if.true + nop + else + push.1114148 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + trace.240 + nop + exec.::miden:rust-sdk-account-get-initial-storage-commitment-binding/rust-sdk-account-get-initial-storage-commitment-binding@0.0.1::rust_sdk_account_get_initial_storage_commitment_binding::__wasm_call_ctors + trace.252 + nop + push.1 + push.1048600 + movup.2 + u32wrapping_add + u32divmod.4 + swap.1 + dup.0 + mem_load + dup.2 + push.8 + u32wrapping_mul + push.255 + swap.1 + u32shl + u32not + swap.1 + u32and + movup.3 + movup.3 + push.8 + u32wrapping_mul + u32shl + u32or + swap.1 + mem_store + end +end + +@callconv("C") +proc miden_stdlib_sys::intrinsics::word::Word::reverse( + i32, + i32 +) + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.16 + u32wrapping_sub + push.8 + dup.3 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.8 + dup.3 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + movup.2 + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + dup.2 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.12 + dup.1 + u32wrapping_add + push.0 + movup.2 + swap.1 + push.1 + while.true + push.0 + push.8 + dup.2 + eq + neq + dup.0 + if.true + movup.3 + movup.2 + drop + drop + push.3735929054 + dup.0 + else + dup.2 + dup.2 + u32wrapping_add + dup.0 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + dup.5 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + movup.2 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + dup.4 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.4294967292 + movup.4 + u32wrapping_add + push.4 + movup.3 + u32wrapping_add + end + push.3735929054 + dup.3 + dup.6 + swap.2 + swap.1 + cdrop + push.3735929054 + dup.4 + dup.6 + swap.2 + swap.1 + cdrop + push.1 + push.0 + movup.6 + cdrop + push.1 + u32and + swap.1 + swap.2 + swap.4 + swap.3 + swap.1 + if.true + movup.4 + drop + movup.4 + drop + push.1 + else + push.0 + end + end + drop + drop + drop + drop + push.8 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.8 + dup.4 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + movup.2 + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop +end + +@callconv("C") +proc miden::active_account::get_initial_storage_commitment(i32) + trace.240 + nop + exec.::miden::active_account::get_initial_storage_commitment + trace.252 + nop + movup.4 + dup.0 + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.4 + dup.1 + add + u32assert + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.8 + dup.1 + add + u32assert + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.12 + add + u32assert + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop +end + diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_get_initial_storage_commitment_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_account_get_initial_storage_commitment_binding.wat new file mode 100644 index 000000000..91fa84d87 --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_get_initial_storage_commitment_binding.wat @@ -0,0 +1,181 @@ +(component + (type (;0;) + (instance + (type (;0;) (record (field "inner" f32))) + (export (;1;) "felt" (type (eq 0))) + (type (;2;) (tuple 1 1 1 1)) + (type (;3;) (record (field "inner" 2))) + (export (;4;) "word" (type (eq 3))) + ) + ) + (import "miden:base/core-types@1.0.0" (instance (;0;) (type 0))) + (core module (;0;) + (type (;0;) (func)) + (type (;1;) (func (result i32))) + (type (;2;) (func (param i32 i32))) + (type (;3;) (func (param i32))) + (table (;0;) 2 2 funcref) + (memory (;0;) 17) + (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) + (global $GOT.data.internal.__memory_base (;1;) i32 i32.const 0) + (export "memory" (memory 0)) + (export "miden:rust-sdk-account-get-initial-storage-commitment-binding/rust-sdk-account-get-initial-storage-commitment-binding@0.0.1#binding" (func $miden:rust-sdk-account-get-initial-storage-commitment-binding/rust-sdk-account-get-initial-storage-commitment-binding@0.0.1#binding)) + (elem (;0;) (i32.const 1) func $rust_sdk_account_get_initial_storage_commitment_binding::bindings::__link_custom_section_describing_imports) + (func $__wasm_call_ctors (;0;) (type 0)) + (func $rust_sdk_account_get_initial_storage_commitment_binding::bindings::__link_custom_section_describing_imports (;1;) (type 0)) + (func $miden:rust-sdk-account-get-initial-storage-commitment-binding/rust-sdk-account-get-initial-storage-commitment-binding@0.0.1#binding (;2;) (type 1) (result i32) + (local i32 i32) + global.get $__stack_pointer + i32.const 48 + i32.sub + local.tee 0 + global.set $__stack_pointer + call $wit_bindgen::rt::run_ctors_once + local.get 0 + i32.const 16 + i32.add + call $miden::active_account::get_initial_storage_commitment + local.get 0 + local.get 0 + i64.load offset=24 + i64.store offset=40 + local.get 0 + local.get 0 + i64.load offset=16 + i64.store offset=32 + global.get $GOT.data.internal.__memory_base + local.set 1 + local.get 0 + local.get 0 + i32.const 32 + i32.add + call $miden_stdlib_sys::intrinsics::word::Word::reverse + local.get 1 + i32.const 1048584 + i32.add + local.tee 1 + local.get 0 + i64.load offset=8 + i64.store offset=8 align=4 + local.get 1 + local.get 0 + i64.load + i64.store align=4 + local.get 0 + i32.const 48 + i32.add + global.set $__stack_pointer + local.get 1 + ) + (func $wit_bindgen::rt::run_ctors_once (;3;) (type 0) + (local i32) + block ;; label = @1 + global.get $GOT.data.internal.__memory_base + i32.const 1048600 + i32.add + i32.load8_u + br_if 0 (;@1;) + global.get $GOT.data.internal.__memory_base + local.set 0 + call $__wasm_call_ctors + local.get 0 + i32.const 1048600 + i32.add + i32.const 1 + i32.store8 + end + ) + (func $miden_stdlib_sys::intrinsics::word::Word::reverse (;4;) (type 2) (param i32 i32) + (local i32 i32 i32 f32) + global.get $__stack_pointer + i32.const 16 + i32.sub + local.tee 2 + local.get 1 + i64.load offset=8 + i64.store offset=8 align=4 + local.get 2 + local.get 1 + i64.load + i64.store align=4 + local.get 2 + i32.const 12 + i32.add + local.set 3 + i32.const 0 + local.set 1 + block ;; label = @1 + loop ;; label = @2 + local.get 1 + i32.const 8 + i32.eq + br_if 1 (;@1;) + local.get 2 + local.get 1 + i32.add + local.tee 4 + f32.load + local.set 5 + local.get 4 + local.get 3 + i32.load + i32.store + local.get 3 + local.get 5 + f32.store + local.get 1 + i32.const 4 + i32.add + local.set 1 + local.get 3 + i32.const -4 + i32.add + local.set 3 + br 0 (;@2;) + end + end + local.get 0 + local.get 2 + i64.load offset=8 align=4 + i64.store offset=8 + local.get 0 + local.get 2 + i64.load align=4 + i64.store + ) + (func $miden::active_account::get_initial_storage_commitment (;5;) (type 3) (param i32) + unreachable + ) + (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") + (@custom "rodata,miden_account" (after data) "orust_sdk_account_get_initial_storage_commitment_binding\01\0b0.0.1\03\01\01\00\00\00\00\00\00\00\00\00\00\00\00\00\00") + ) + (alias export 0 "word" (type (;1;))) + (core instance (;0;) (instantiate 0)) + (alias core export 0 "memory" (core memory (;0;))) + (type (;2;) (func (result 1))) + (alias core export 0 "miden:rust-sdk-account-get-initial-storage-commitment-binding/rust-sdk-account-get-initial-storage-commitment-binding@0.0.1#binding" (core func (;0;))) + (func (;0;) (type 2) (canon lift (core func 0) (memory 0))) + (alias export 0 "felt" (type (;3;))) + (alias export 0 "word" (type (;4;))) + (component (;0;) + (type (;0;) (record (field "inner" f32))) + (import "import-type-felt" (type (;1;) (eq 0))) + (type (;2;) (tuple 1 1 1 1)) + (type (;3;) (record (field "inner" 2))) + (import "import-type-word" (type (;4;) (eq 3))) + (import "import-type-word0" (type (;5;) (eq 4))) + (type (;6;) (func (result 5))) + (import "import-func-binding" (func (;0;) (type 6))) + (export (;7;) "word" (type 4)) + (type (;8;) (func (result 7))) + (export (;1;) "binding" (func 0) (func (type 8))) + ) + (instance (;1;) (instantiate 0 + (with "import-func-binding" (func 0)) + (with "import-type-felt" (type 3)) + (with "import-type-word" (type 4)) + (with "import-type-word0" (type 1)) + ) + ) + (export (;2;) "miden:rust-sdk-account-get-initial-storage-commitment-binding/rust-sdk-account-get-initial-storage-commitment-binding@0.0.1" (instance 1)) +) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_get_initial_vault_root_binding.hir b/tests/integration/expected/rust_sdk/rust_sdk_account_get_initial_vault_root_binding.hir new file mode 100644 index 000000000..94e0ffad0 --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_get_initial_vault_root_binding.hir @@ -0,0 +1,327 @@ +builtin.component miden:rust-sdk-account-get-initial-vault-root-binding/rust-sdk-account-get-initial-vault-root-binding@0.0.1 { + builtin.module public @rust_sdk_account_get_initial_vault_root_binding { + private builtin.function @__wasm_call_ctors() { + ^block5: + builtin.ret ; + }; + + private builtin.function @rust_sdk_account_get_initial_vault_root_binding::bindings::__link_custom_section_describing_imports() { + ^block7: + builtin.ret ; + }; + + private builtin.function @miden:rust-sdk-account-get-initial-vault-root-binding/rust-sdk-account-get-initial-vault-root-binding@0.0.1#binding() -> i32 { + ^block9: + v2 = builtin.global_symbol @miden:rust-sdk-account-get-initial-vault-root-binding/rust-sdk-account-get-initial-vault-root-binding@0.0.1/rust_sdk_account_get_initial_vault_root_binding/__stack_pointer : ptr + v3 = hir.bitcast v2 : ptr; + v4 = hir.load v3 : i32; + v5 = arith.constant 48 : i32; + v6 = arith.sub v4, v5 : i32 #[overflow = wrapping]; + v7 = builtin.global_symbol @miden:rust-sdk-account-get-initial-vault-root-binding/rust-sdk-account-get-initial-vault-root-binding@0.0.1/rust_sdk_account_get_initial_vault_root_binding/__stack_pointer : ptr + v8 = hir.bitcast v7 : ptr; + hir.store v8, v6; + hir.exec @miden:rust-sdk-account-get-initial-vault-root-binding/rust-sdk-account-get-initial-vault-root-binding@0.0.1/rust_sdk_account_get_initial_vault_root_binding/wit_bindgen::rt::run_ctors_once() + v9 = arith.constant 16 : i32; + v10 = arith.add v6, v9 : i32 #[overflow = wrapping]; + hir.exec @miden:rust-sdk-account-get-initial-vault-root-binding/rust-sdk-account-get-initial-vault-root-binding@0.0.1/rust_sdk_account_get_initial_vault_root_binding/miden::active_account::get_initial_vault_root(v10) + v12 = arith.constant 24 : u32; + v11 = hir.bitcast v6 : u32; + v13 = arith.add v11, v12 : u32 #[overflow = checked]; + v14 = arith.constant 8 : u32; + v15 = arith.mod v13, v14 : u32; + hir.assertz v15 #[code = 250]; + v16 = hir.int_to_ptr v13 : ptr; + v17 = hir.load v16 : i64; + v19 = arith.constant 40 : u32; + v18 = hir.bitcast v6 : u32; + v20 = arith.add v18, v19 : u32 #[overflow = checked]; + v237 = arith.constant 8 : u32; + v22 = arith.mod v20, v237 : u32; + hir.assertz v22 #[code = 250]; + v23 = hir.int_to_ptr v20 : ptr; + hir.store v23, v17; + v25 = arith.constant 16 : u32; + v24 = hir.bitcast v6 : u32; + v26 = arith.add v24, v25 : u32 #[overflow = checked]; + v236 = arith.constant 8 : u32; + v28 = arith.mod v26, v236 : u32; + hir.assertz v28 #[code = 250]; + v29 = hir.int_to_ptr v26 : ptr; + v30 = hir.load v29 : i64; + v32 = arith.constant 32 : u32; + v31 = hir.bitcast v6 : u32; + v33 = arith.add v31, v32 : u32 #[overflow = checked]; + v235 = arith.constant 8 : u32; + v35 = arith.mod v33, v235 : u32; + hir.assertz v35 #[code = 250]; + v36 = hir.int_to_ptr v33 : ptr; + hir.store v36, v30; + v37 = builtin.global_symbol @miden:rust-sdk-account-get-initial-vault-root-binding/rust-sdk-account-get-initial-vault-root-binding@0.0.1/rust_sdk_account_get_initial_vault_root_binding/GOT.data.internal.__memory_base : ptr + v38 = hir.bitcast v37 : ptr; + v39 = hir.load v38 : i32; + v40 = arith.constant 32 : i32; + v41 = arith.add v6, v40 : i32 #[overflow = wrapping]; + hir.exec @miden:rust-sdk-account-get-initial-vault-root-binding/rust-sdk-account-get-initial-vault-root-binding@0.0.1/rust_sdk_account_get_initial_vault_root_binding/miden_stdlib_sys::intrinsics::word::Word::reverse(v6, v41) + v42 = arith.constant 1048584 : i32; + v43 = arith.add v39, v42 : i32 #[overflow = wrapping]; + v234 = arith.constant 8 : u32; + v44 = hir.bitcast v6 : u32; + v46 = arith.add v44, v234 : u32 #[overflow = checked]; + v233 = arith.constant 8 : u32; + v48 = arith.mod v46, v233 : u32; + hir.assertz v48 #[code = 250]; + v49 = hir.int_to_ptr v46 : ptr; + v50 = hir.load v49 : i64; + v232 = arith.constant 8 : u32; + v51 = hir.bitcast v43 : u32; + v53 = arith.add v51, v232 : u32 #[overflow = checked]; + v54 = arith.constant 4 : u32; + v55 = arith.mod v53, v54 : u32; + hir.assertz v55 #[code = 250]; + v56 = hir.int_to_ptr v53 : ptr; + hir.store v56, v50; + v57 = hir.bitcast v6 : u32; + v231 = arith.constant 8 : u32; + v59 = arith.mod v57, v231 : u32; + hir.assertz v59 #[code = 250]; + v60 = hir.int_to_ptr v57 : ptr; + v61 = hir.load v60 : i64; + v62 = hir.bitcast v43 : u32; + v230 = arith.constant 4 : u32; + v64 = arith.mod v62, v230 : u32; + hir.assertz v64 #[code = 250]; + v65 = hir.int_to_ptr v62 : ptr; + hir.store v65, v61; + v229 = arith.constant 48 : i32; + v67 = arith.add v6, v229 : i32 #[overflow = wrapping]; + v68 = builtin.global_symbol @miden:rust-sdk-account-get-initial-vault-root-binding/rust-sdk-account-get-initial-vault-root-binding@0.0.1/rust_sdk_account_get_initial_vault_root_binding/__stack_pointer : ptr + v69 = hir.bitcast v68 : ptr; + hir.store v69, v67; + builtin.ret v43; + }; + + private builtin.function @wit_bindgen::rt::run_ctors_once() { + ^block11: + v71 = builtin.global_symbol @miden:rust-sdk-account-get-initial-vault-root-binding/rust-sdk-account-get-initial-vault-root-binding@0.0.1/rust_sdk_account_get_initial_vault_root_binding/GOT.data.internal.__memory_base : ptr + v72 = hir.bitcast v71 : ptr; + v73 = hir.load v72 : i32; + v74 = arith.constant 1048600 : i32; + v75 = arith.add v73, v74 : i32 #[overflow = wrapping]; + v76 = hir.bitcast v75 : u32; + v77 = hir.int_to_ptr v76 : ptr; + v78 = hir.load v77 : u8; + v70 = arith.constant 0 : i32; + v79 = arith.zext v78 : u32; + v80 = hir.bitcast v79 : i32; + v82 = arith.neq v80, v70 : i1; + scf.if v82{ + ^block13: + scf.yield ; + } else { + ^block14: + v83 = builtin.global_symbol @miden:rust-sdk-account-get-initial-vault-root-binding/rust-sdk-account-get-initial-vault-root-binding@0.0.1/rust_sdk_account_get_initial_vault_root_binding/GOT.data.internal.__memory_base : ptr + v84 = hir.bitcast v83 : ptr; + v85 = hir.load v84 : i32; + hir.exec @miden:rust-sdk-account-get-initial-vault-root-binding/rust-sdk-account-get-initial-vault-root-binding@0.0.1/rust_sdk_account_get_initial_vault_root_binding/__wasm_call_ctors() + v239 = arith.constant 1 : u8; + v241 = arith.constant 1048600 : i32; + v87 = arith.add v85, v241 : i32 #[overflow = wrapping]; + v91 = hir.bitcast v87 : u32; + v92 = hir.int_to_ptr v91 : ptr; + hir.store v92, v239; + scf.yield ; + }; + builtin.ret ; + }; + + private builtin.function @miden_stdlib_sys::intrinsics::word::Word::reverse(v93: i32, v94: i32) { + ^block15(v93: i32, v94: i32): + v97 = builtin.global_symbol @miden:rust-sdk-account-get-initial-vault-root-binding/rust-sdk-account-get-initial-vault-root-binding@0.0.1/rust_sdk_account_get_initial_vault_root_binding/__stack_pointer : ptr + v98 = hir.bitcast v97 : ptr; + v99 = hir.load v98 : i32; + v100 = arith.constant 16 : i32; + v101 = arith.sub v99, v100 : i32 #[overflow = wrapping]; + v103 = arith.constant 8 : u32; + v102 = hir.bitcast v94 : u32; + v104 = arith.add v102, v103 : u32 #[overflow = checked]; + v328 = arith.constant 8 : u32; + v106 = arith.mod v104, v328 : u32; + hir.assertz v106 #[code = 250]; + v107 = hir.int_to_ptr v104 : ptr; + v108 = hir.load v107 : i64; + v327 = arith.constant 8 : u32; + v109 = hir.bitcast v101 : u32; + v111 = arith.add v109, v327 : u32 #[overflow = checked]; + v112 = arith.constant 4 : u32; + v113 = arith.mod v111, v112 : u32; + hir.assertz v113 #[code = 250]; + v114 = hir.int_to_ptr v111 : ptr; + hir.store v114, v108; + v115 = hir.bitcast v94 : u32; + v326 = arith.constant 8 : u32; + v117 = arith.mod v115, v326 : u32; + hir.assertz v117 #[code = 250]; + v118 = hir.int_to_ptr v115 : ptr; + v119 = hir.load v118 : i64; + v120 = hir.bitcast v101 : u32; + v325 = arith.constant 4 : u32; + v122 = arith.mod v120, v325 : u32; + hir.assertz v122 #[code = 250]; + v123 = hir.int_to_ptr v120 : ptr; + hir.store v123, v119; + v124 = arith.constant 12 : i32; + v125 = arith.add v101, v124 : i32 #[overflow = wrapping]; + v95 = arith.constant 0 : i32; + v296, v297, v298, v299, v300, v301 = scf.while v95, v101, v125, v93 : i32, i32, i32, i32, i32, i32 { + ^block35(v302: i32, v303: i32, v304: i32, v305: i32): + v324 = arith.constant 0 : i32; + v128 = arith.constant 8 : i32; + v129 = arith.eq v302, v128 : i1; + v130 = arith.zext v129 : u32; + v131 = hir.bitcast v130 : i32; + v133 = arith.neq v131, v324 : i1; + v290, v291 = scf.if v133 : i32, i32 { + ^block34: + v250 = ub.poison i32 : i32; + scf.yield v250, v250; + } else { + ^block20: + v135 = arith.add v303, v302 : i32 #[overflow = wrapping]; + v136 = hir.bitcast v135 : u32; + v323 = arith.constant 4 : u32; + v138 = arith.mod v136, v323 : u32; + hir.assertz v138 #[code = 250]; + v139 = hir.int_to_ptr v136 : ptr; + v140 = hir.load v139 : felt; + v142 = hir.bitcast v304 : u32; + v322 = arith.constant 4 : u32; + v144 = arith.mod v142, v322 : u32; + hir.assertz v144 #[code = 250]; + v145 = hir.int_to_ptr v142 : ptr; + v146 = hir.load v145 : i32; + v147 = hir.bitcast v135 : u32; + v321 = arith.constant 4 : u32; + v149 = arith.mod v147, v321 : u32; + hir.assertz v149 #[code = 250]; + v150 = hir.int_to_ptr v147 : ptr; + hir.store v150, v146; + v151 = hir.bitcast v304 : u32; + v320 = arith.constant 4 : u32; + v153 = arith.mod v151, v320 : u32; + hir.assertz v153 #[code = 250]; + v154 = hir.int_to_ptr v151 : ptr; + hir.store v154, v140; + v157 = arith.constant -4 : i32; + v158 = arith.add v304, v157 : i32 #[overflow = wrapping]; + v155 = arith.constant 4 : i32; + v156 = arith.add v302, v155 : i32 #[overflow = wrapping]; + scf.yield v156, v158; + }; + v318 = ub.poison i32 : i32; + v293 = cf.select v133, v318, v305 : i32; + v319 = ub.poison i32 : i32; + v292 = cf.select v133, v319, v303 : i32; + v249 = arith.constant 1 : u32; + v242 = arith.constant 0 : u32; + v295 = cf.select v133, v242, v249 : u32; + v283 = arith.trunc v295 : i1; + scf.condition v283, v290, v292, v291, v293, v303, v305; + } do { + ^block36(v306: i32, v307: i32, v308: i32, v309: i32, v310: i32, v311: i32): + scf.yield v306, v307, v308, v309; + }; + v317 = arith.constant 8 : u32; + v160 = hir.bitcast v300 : u32; + v162 = arith.add v160, v317 : u32 #[overflow = checked]; + v316 = arith.constant 4 : u32; + v164 = arith.mod v162, v316 : u32; + hir.assertz v164 #[code = 250]; + v165 = hir.int_to_ptr v162 : ptr; + v166 = hir.load v165 : i64; + v315 = arith.constant 8 : u32; + v167 = hir.bitcast v301 : u32; + v169 = arith.add v167, v315 : u32 #[overflow = checked]; + v314 = arith.constant 8 : u32; + v171 = arith.mod v169, v314 : u32; + hir.assertz v171 #[code = 250]; + v172 = hir.int_to_ptr v169 : ptr; + hir.store v172, v166; + v173 = hir.bitcast v300 : u32; + v313 = arith.constant 4 : u32; + v175 = arith.mod v173, v313 : u32; + hir.assertz v175 #[code = 250]; + v176 = hir.int_to_ptr v173 : ptr; + v177 = hir.load v176 : i64; + v178 = hir.bitcast v301 : u32; + v312 = arith.constant 8 : u32; + v180 = arith.mod v178, v312 : u32; + hir.assertz v180 #[code = 250]; + v181 = hir.int_to_ptr v178 : ptr; + hir.store v181, v177; + builtin.ret ; + }; + + private builtin.function @miden::active_account::get_initial_vault_root(v182: i32) { + ^block21(v182: i32): + v183, v184, v185, v186 = hir.exec @miden/active_account/get_initial_vault_root() : felt, felt, felt, felt + v187 = hir.bitcast v182 : u32; + v188 = hir.int_to_ptr v187 : ptr; + hir.store v188, v183; + v189 = arith.constant 4 : u32; + v190 = arith.add v187, v189 : u32 #[overflow = checked]; + v191 = hir.int_to_ptr v190 : ptr; + hir.store v191, v184; + v192 = arith.constant 8 : u32; + v193 = arith.add v187, v192 : u32 #[overflow = checked]; + v194 = hir.int_to_ptr v193 : ptr; + hir.store v194, v185; + v195 = arith.constant 12 : u32; + v196 = arith.add v187, v195 : u32 #[overflow = checked]; + v197 = hir.int_to_ptr v196 : ptr; + hir.store v197, v186; + builtin.ret ; + }; + + builtin.global_variable private @#__stack_pointer : i32 { + builtin.ret_imm 1048576; + }; + + builtin.global_variable private @#GOT.data.internal.__memory_base : i32 { + builtin.ret_imm 0; + }; + + builtin.segment @1048576 = 0x0000000100000001; + }; + + public builtin.function @binding() -> felt, felt, felt, felt { + ^block25: + v198 = hir.exec @miden:rust-sdk-account-get-initial-vault-root-binding/rust-sdk-account-get-initial-vault-root-binding@0.0.1/rust_sdk_account_get_initial_vault_root_binding/miden:rust-sdk-account-get-initial-vault-root-binding/rust-sdk-account-get-initial-vault-root-binding@0.0.1#binding() : i32 + v199 = arith.constant 0 : i32; + v200 = arith.add v198, v199 : i32 #[overflow = unchecked]; + v332 = arith.constant 0 : i32; + v333 = arith.constant 0 : i32; + v202 = arith.add v200, v333 : i32 #[overflow = unchecked]; + v204 = arith.add v202, v332 : i32 #[overflow = unchecked]; + v205 = hir.int_to_ptr v204 : ptr; + v206 = hir.load v205 : felt; + v331 = arith.constant 0 : i32; + v207 = arith.constant 4 : i32; + v208 = arith.add v200, v207 : i32 #[overflow = unchecked]; + v210 = arith.add v208, v331 : i32 #[overflow = unchecked]; + v211 = hir.int_to_ptr v210 : ptr; + v212 = hir.load v211 : felt; + v330 = arith.constant 0 : i32; + v213 = arith.constant 8 : i32; + v214 = arith.add v200, v213 : i32 #[overflow = unchecked]; + v216 = arith.add v214, v330 : i32 #[overflow = unchecked]; + v217 = hir.int_to_ptr v216 : ptr; + v218 = hir.load v217 : felt; + v329 = arith.constant 0 : i32; + v219 = arith.constant 12 : i32; + v220 = arith.add v200, v219 : i32 #[overflow = unchecked]; + v222 = arith.add v220, v329 : i32 #[overflow = unchecked]; + v223 = hir.int_to_ptr v222 : ptr; + v224 = hir.load v223 : felt; + builtin.ret v206, v212, v218, v224; + }; +}; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_get_initial_vault_root_binding.masm b/tests/integration/expected/rust_sdk/rust_sdk_account_get_initial_vault_root_binding.masm new file mode 100644 index 000000000..027d4f0ae --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_get_initial_vault_root_binding.masm @@ -0,0 +1,698 @@ +# mod miden:rust-sdk-account-get-initial-vault-root-binding/rust-sdk-account-get-initial-vault-root-binding@0.0.1 + +@callconv("canon-lift") +pub proc binding( + +) -> (felt, felt, felt, felt) + exec.::miden:rust-sdk-account-get-initial-vault-root-binding/rust-sdk-account-get-initial-vault-root-binding@0.0.1::init + trace.240 + nop + exec.::miden:rust-sdk-account-get-initial-vault-root-binding/rust-sdk-account-get-initial-vault-root-binding@0.0.1::rust_sdk_account_get_initial_vault_root_binding::miden:rust-sdk-account-get-initial-vault-root-binding/rust-sdk-account-get-initial-vault-root-binding@0.0.1#binding + trace.252 + nop + push.0 + u32wrapping_add + push.0 + push.0 + dup.2 + u32wrapping_add + u32wrapping_add + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.0 + push.4 + dup.3 + u32wrapping_add + u32wrapping_add + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.0 + push.8 + dup.4 + u32wrapping_add + u32wrapping_add + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.0 + push.12 + movup.5 + u32wrapping_add + u32wrapping_add + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + movdn.3 + swap.2 + exec.::std::sys::truncate_stack +end + +proc init + push.1179648 + trace.240 + exec.::intrinsics::mem::heap_init + trace.252 + push.[7028007876379170725,18060021366771303825,13412364500725888848,14178532912296021363] + adv.push_mapval + push.262144 + push.1 + trace.240 + exec.::std::mem::pipe_preimage_to_memory + trace.252 + drop + push.1048576 + u32assert + mem_store.278536 + push.0 + u32assert + mem_store.278537 +end + +# mod miden:rust-sdk-account-get-initial-vault-root-binding/rust-sdk-account-get-initial-vault-root-binding@0.0.1::rust_sdk_account_get_initial_vault_root_binding + +@callconv("C") +proc __wasm_call_ctors( + +) + nop +end + +@callconv("C") +proc rust_sdk_account_get_initial_vault_root_binding::bindings::__link_custom_section_describing_imports( + +) + nop +end + +@callconv("C") +proc miden:rust-sdk-account-get-initial-vault-root-binding/rust-sdk-account-get-initial-vault-root-binding@0.0.1#binding( + +) -> i32 + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.48 + u32wrapping_sub + push.1114144 + dup.1 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + trace.240 + nop + exec.::miden:rust-sdk-account-get-initial-vault-root-binding/rust-sdk-account-get-initial-vault-root-binding@0.0.1::rust_sdk_account_get_initial_vault_root_binding::wit_bindgen::rt::run_ctors_once + trace.252 + nop + push.16 + dup.1 + u32wrapping_add + trace.240 + nop + exec.::miden:rust-sdk-account-get-initial-vault-root-binding/rust-sdk-account-get-initial-vault-root-binding@0.0.1::rust_sdk_account_get_initial_vault_root_binding::miden::active_account::get_initial_vault_root + trace.252 + nop + push.24 + dup.1 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.40 + dup.3 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.16 + dup.1 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.32 + dup.3 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.1114148 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.32 + dup.2 + u32wrapping_add + dup.2 + trace.240 + nop + exec.::miden:rust-sdk-account-get-initial-vault-root-binding/rust-sdk-account-get-initial-vault-root-binding@0.0.1::rust_sdk_account_get_initial_vault_root_binding::miden_stdlib_sys::intrinsics::word::Word::reverse + trace.252 + nop + push.1048584 + u32wrapping_add + push.8 + dup.2 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.8 + dup.3 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + dup.1 + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + dup.2 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.48 + movup.2 + u32wrapping_add + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop +end + +@callconv("C") +proc wit_bindgen::rt::run_ctors_once( + +) + push.1114148 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.1048600 + u32wrapping_add + u32divmod.4 + swap.1 + swap.1 + dup.1 + mem_load + swap.1 + push.8 + u32wrapping_mul + u32shr + swap.1 + drop + push.255 + u32and + push.0 + swap.1 + neq + if.true + nop + else + push.1114148 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + trace.240 + nop + exec.::miden:rust-sdk-account-get-initial-vault-root-binding/rust-sdk-account-get-initial-vault-root-binding@0.0.1::rust_sdk_account_get_initial_vault_root_binding::__wasm_call_ctors + trace.252 + nop + push.1 + push.1048600 + movup.2 + u32wrapping_add + u32divmod.4 + swap.1 + dup.0 + mem_load + dup.2 + push.8 + u32wrapping_mul + push.255 + swap.1 + u32shl + u32not + swap.1 + u32and + movup.3 + movup.3 + push.8 + u32wrapping_mul + u32shl + u32or + swap.1 + mem_store + end +end + +@callconv("C") +proc miden_stdlib_sys::intrinsics::word::Word::reverse( + i32, + i32 +) + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.16 + u32wrapping_sub + push.8 + dup.3 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.8 + dup.3 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + movup.2 + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + dup.2 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.12 + dup.1 + u32wrapping_add + push.0 + movup.2 + swap.1 + push.1 + while.true + push.0 + push.8 + dup.2 + eq + neq + dup.0 + if.true + movup.3 + movup.2 + drop + drop + push.3735929054 + dup.0 + else + dup.2 + dup.2 + u32wrapping_add + dup.0 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + dup.5 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + movup.2 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + dup.4 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.4294967292 + movup.4 + u32wrapping_add + push.4 + movup.3 + u32wrapping_add + end + push.3735929054 + dup.3 + dup.6 + swap.2 + swap.1 + cdrop + push.3735929054 + dup.4 + dup.6 + swap.2 + swap.1 + cdrop + push.1 + push.0 + movup.6 + cdrop + push.1 + u32and + swap.1 + swap.2 + swap.4 + swap.3 + swap.1 + if.true + movup.4 + drop + movup.4 + drop + push.1 + else + push.0 + end + end + drop + drop + drop + drop + push.8 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.8 + dup.4 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + movup.2 + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop +end + +@callconv("C") +proc miden::active_account::get_initial_vault_root(i32) + trace.240 + nop + exec.::miden::active_account::get_initial_vault_root + trace.252 + nop + movup.4 + dup.0 + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.4 + dup.1 + add + u32assert + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.8 + dup.1 + add + u32assert + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.12 + add + u32assert + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop +end + diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_get_initial_vault_root_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_account_get_initial_vault_root_binding.wat new file mode 100644 index 000000000..2fbe10f7f --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_get_initial_vault_root_binding.wat @@ -0,0 +1,181 @@ +(component + (type (;0;) + (instance + (type (;0;) (record (field "inner" f32))) + (export (;1;) "felt" (type (eq 0))) + (type (;2;) (tuple 1 1 1 1)) + (type (;3;) (record (field "inner" 2))) + (export (;4;) "word" (type (eq 3))) + ) + ) + (import "miden:base/core-types@1.0.0" (instance (;0;) (type 0))) + (core module (;0;) + (type (;0;) (func)) + (type (;1;) (func (result i32))) + (type (;2;) (func (param i32 i32))) + (type (;3;) (func (param i32))) + (table (;0;) 2 2 funcref) + (memory (;0;) 17) + (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) + (global $GOT.data.internal.__memory_base (;1;) i32 i32.const 0) + (export "memory" (memory 0)) + (export "miden:rust-sdk-account-get-initial-vault-root-binding/rust-sdk-account-get-initial-vault-root-binding@0.0.1#binding" (func $miden:rust-sdk-account-get-initial-vault-root-binding/rust-sdk-account-get-initial-vault-root-binding@0.0.1#binding)) + (elem (;0;) (i32.const 1) func $rust_sdk_account_get_initial_vault_root_binding::bindings::__link_custom_section_describing_imports) + (func $__wasm_call_ctors (;0;) (type 0)) + (func $rust_sdk_account_get_initial_vault_root_binding::bindings::__link_custom_section_describing_imports (;1;) (type 0)) + (func $miden:rust-sdk-account-get-initial-vault-root-binding/rust-sdk-account-get-initial-vault-root-binding@0.0.1#binding (;2;) (type 1) (result i32) + (local i32 i32) + global.get $__stack_pointer + i32.const 48 + i32.sub + local.tee 0 + global.set $__stack_pointer + call $wit_bindgen::rt::run_ctors_once + local.get 0 + i32.const 16 + i32.add + call $miden::active_account::get_initial_vault_root + local.get 0 + local.get 0 + i64.load offset=24 + i64.store offset=40 + local.get 0 + local.get 0 + i64.load offset=16 + i64.store offset=32 + global.get $GOT.data.internal.__memory_base + local.set 1 + local.get 0 + local.get 0 + i32.const 32 + i32.add + call $miden_stdlib_sys::intrinsics::word::Word::reverse + local.get 1 + i32.const 1048584 + i32.add + local.tee 1 + local.get 0 + i64.load offset=8 + i64.store offset=8 align=4 + local.get 1 + local.get 0 + i64.load + i64.store align=4 + local.get 0 + i32.const 48 + i32.add + global.set $__stack_pointer + local.get 1 + ) + (func $wit_bindgen::rt::run_ctors_once (;3;) (type 0) + (local i32) + block ;; label = @1 + global.get $GOT.data.internal.__memory_base + i32.const 1048600 + i32.add + i32.load8_u + br_if 0 (;@1;) + global.get $GOT.data.internal.__memory_base + local.set 0 + call $__wasm_call_ctors + local.get 0 + i32.const 1048600 + i32.add + i32.const 1 + i32.store8 + end + ) + (func $miden_stdlib_sys::intrinsics::word::Word::reverse (;4;) (type 2) (param i32 i32) + (local i32 i32 i32 f32) + global.get $__stack_pointer + i32.const 16 + i32.sub + local.tee 2 + local.get 1 + i64.load offset=8 + i64.store offset=8 align=4 + local.get 2 + local.get 1 + i64.load + i64.store align=4 + local.get 2 + i32.const 12 + i32.add + local.set 3 + i32.const 0 + local.set 1 + block ;; label = @1 + loop ;; label = @2 + local.get 1 + i32.const 8 + i32.eq + br_if 1 (;@1;) + local.get 2 + local.get 1 + i32.add + local.tee 4 + f32.load + local.set 5 + local.get 4 + local.get 3 + i32.load + i32.store + local.get 3 + local.get 5 + f32.store + local.get 1 + i32.const 4 + i32.add + local.set 1 + local.get 3 + i32.const -4 + i32.add + local.set 3 + br 0 (;@2;) + end + end + local.get 0 + local.get 2 + i64.load offset=8 align=4 + i64.store offset=8 + local.get 0 + local.get 2 + i64.load align=4 + i64.store + ) + (func $miden::active_account::get_initial_vault_root (;5;) (type 3) (param i32) + unreachable + ) + (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") + (@custom "rodata,miden_account" (after data) "_rust_sdk_account_get_initial_vault_root_binding\01\0b0.0.1\03\01\01\00\00\00\00\00\00") + ) + (alias export 0 "word" (type (;1;))) + (core instance (;0;) (instantiate 0)) + (alias core export 0 "memory" (core memory (;0;))) + (type (;2;) (func (result 1))) + (alias core export 0 "miden:rust-sdk-account-get-initial-vault-root-binding/rust-sdk-account-get-initial-vault-root-binding@0.0.1#binding" (core func (;0;))) + (func (;0;) (type 2) (canon lift (core func 0) (memory 0))) + (alias export 0 "felt" (type (;3;))) + (alias export 0 "word" (type (;4;))) + (component (;0;) + (type (;0;) (record (field "inner" f32))) + (import "import-type-felt" (type (;1;) (eq 0))) + (type (;2;) (tuple 1 1 1 1)) + (type (;3;) (record (field "inner" 2))) + (import "import-type-word" (type (;4;) (eq 3))) + (import "import-type-word0" (type (;5;) (eq 4))) + (type (;6;) (func (result 5))) + (import "import-func-binding" (func (;0;) (type 6))) + (export (;7;) "word" (type 4)) + (type (;8;) (func (result 7))) + (export (;1;) "binding" (func 0) (func (type 8))) + ) + (instance (;1;) (instantiate 0 + (with "import-func-binding" (func 0)) + (with "import-type-felt" (type 3)) + (with "import-type-word" (type 4)) + (with "import-type-word0" (type 1)) + ) + ) + (export (;2;) "miden:rust-sdk-account-get-initial-vault-root-binding/rust-sdk-account-get-initial-vault-root-binding@0.0.1" (instance 1)) +) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_get_num_procedures_binding.hir b/tests/integration/expected/rust_sdk/rust_sdk_account_get_num_procedures_binding.hir new file mode 100644 index 000000000..871bf4a55 --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_get_num_procedures_binding.hir @@ -0,0 +1,76 @@ +builtin.component miden:rust-sdk-account-get-num-procedures-binding/rust-sdk-account-get-num-procedures-binding@0.0.1 { + builtin.module public @rust_sdk_account_get_num_procedures_binding { + private builtin.function @__wasm_call_ctors() { + ^block5: + builtin.ret ; + }; + + private builtin.function @rust_sdk_account_get_num_procedures_binding::bindings::__link_custom_section_describing_imports() { + ^block7: + builtin.ret ; + }; + + private builtin.function @miden:rust-sdk-account-get-num-procedures-binding/rust-sdk-account-get-num-procedures-binding@0.0.1#binding() -> felt { + ^block9: + hir.exec @miden:rust-sdk-account-get-num-procedures-binding/rust-sdk-account-get-num-procedures-binding@0.0.1/rust_sdk_account_get_num_procedures_binding/wit_bindgen::rt::run_ctors_once() + v1 = hir.exec @miden:rust-sdk-account-get-num-procedures-binding/rust-sdk-account-get-num-procedures-binding@0.0.1/rust_sdk_account_get_num_procedures_binding/miden::active_account::get_num_procedures() : felt + builtin.ret v1; + }; + + private builtin.function @wit_bindgen::rt::run_ctors_once() { + ^block11: + v3 = builtin.global_symbol @miden:rust-sdk-account-get-num-procedures-binding/rust-sdk-account-get-num-procedures-binding@0.0.1/rust_sdk_account_get_num_procedures_binding/GOT.data.internal.__memory_base : ptr + v4 = hir.bitcast v3 : ptr; + v5 = hir.load v4 : i32; + v6 = arith.constant 1048584 : i32; + v7 = arith.add v5, v6 : i32 #[overflow = wrapping]; + v8 = hir.bitcast v7 : u32; + v9 = hir.int_to_ptr v8 : ptr; + v10 = hir.load v9 : u8; + v2 = arith.constant 0 : i32; + v11 = arith.zext v10 : u32; + v12 = hir.bitcast v11 : i32; + v14 = arith.neq v12, v2 : i1; + scf.if v14{ + ^block13: + scf.yield ; + } else { + ^block14: + v15 = builtin.global_symbol @miden:rust-sdk-account-get-num-procedures-binding/rust-sdk-account-get-num-procedures-binding@0.0.1/rust_sdk_account_get_num_procedures_binding/GOT.data.internal.__memory_base : ptr + v16 = hir.bitcast v15 : ptr; + v17 = hir.load v16 : i32; + hir.exec @miden:rust-sdk-account-get-num-procedures-binding/rust-sdk-account-get-num-procedures-binding@0.0.1/rust_sdk_account_get_num_procedures_binding/__wasm_call_ctors() + v29 = arith.constant 1 : u8; + v31 = arith.constant 1048584 : i32; + v19 = arith.add v17, v31 : i32 #[overflow = wrapping]; + v23 = hir.bitcast v19 : u32; + v24 = hir.int_to_ptr v23 : ptr; + hir.store v24, v29; + scf.yield ; + }; + builtin.ret ; + }; + + private builtin.function @miden::active_account::get_num_procedures() -> felt { + ^block15: + v25 = hir.exec @miden/active_account/get_num_procedures() : felt + builtin.ret v25; + }; + + builtin.global_variable private @#__stack_pointer : i32 { + builtin.ret_imm 1048576; + }; + + builtin.global_variable private @#GOT.data.internal.__memory_base : i32 { + builtin.ret_imm 0; + }; + + builtin.segment @1048576 = 0x0000000100000001; + }; + + public builtin.function @binding() -> felt { + ^block19: + v27 = hir.exec @miden:rust-sdk-account-get-num-procedures-binding/rust-sdk-account-get-num-procedures-binding@0.0.1/rust_sdk_account_get_num_procedures_binding/miden:rust-sdk-account-get-num-procedures-binding/rust-sdk-account-get-num-procedures-binding@0.0.1#binding() : felt + builtin.ret v27; + }; +}; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_get_num_procedures_binding.masm b/tests/integration/expected/rust_sdk/rust_sdk_account_get_num_procedures_binding.masm new file mode 100644 index 000000000..e9e34a47e --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_get_num_procedures_binding.masm @@ -0,0 +1,153 @@ +# mod miden:rust-sdk-account-get-num-procedures-binding/rust-sdk-account-get-num-procedures-binding@0.0.1 + +@callconv("canon-lift") +pub proc binding( + +) -> felt + exec.::miden:rust-sdk-account-get-num-procedures-binding/rust-sdk-account-get-num-procedures-binding@0.0.1::init + trace.240 + nop + exec.::miden:rust-sdk-account-get-num-procedures-binding/rust-sdk-account-get-num-procedures-binding@0.0.1::rust_sdk_account_get_num_procedures_binding::miden:rust-sdk-account-get-num-procedures-binding/rust-sdk-account-get-num-procedures-binding@0.0.1#binding + trace.252 + nop + exec.::std::sys::truncate_stack +end + +proc init + push.1179648 + trace.240 + exec.::intrinsics::mem::heap_init + trace.252 + push.[7028007876379170725,18060021366771303825,13412364500725888848,14178532912296021363] + adv.push_mapval + push.262144 + push.1 + trace.240 + exec.::std::mem::pipe_preimage_to_memory + trace.252 + drop + push.1048576 + u32assert + mem_store.278536 + push.0 + u32assert + mem_store.278537 +end + +# mod miden:rust-sdk-account-get-num-procedures-binding/rust-sdk-account-get-num-procedures-binding@0.0.1::rust_sdk_account_get_num_procedures_binding + +@callconv("C") +proc __wasm_call_ctors( + +) + nop +end + +@callconv("C") +proc rust_sdk_account_get_num_procedures_binding::bindings::__link_custom_section_describing_imports( + +) + nop +end + +@callconv("C") +proc miden:rust-sdk-account-get-num-procedures-binding/rust-sdk-account-get-num-procedures-binding@0.0.1#binding( + +) -> felt + trace.240 + nop + exec.::miden:rust-sdk-account-get-num-procedures-binding/rust-sdk-account-get-num-procedures-binding@0.0.1::rust_sdk_account_get_num_procedures_binding::wit_bindgen::rt::run_ctors_once + trace.252 + nop + trace.240 + nop + exec.::miden:rust-sdk-account-get-num-procedures-binding/rust-sdk-account-get-num-procedures-binding@0.0.1::rust_sdk_account_get_num_procedures_binding::miden::active_account::get_num_procedures + trace.252 + nop +end + +@callconv("C") +proc wit_bindgen::rt::run_ctors_once( + +) + push.1114148 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.1048584 + u32wrapping_add + u32divmod.4 + swap.1 + swap.1 + dup.1 + mem_load + swap.1 + push.8 + u32wrapping_mul + u32shr + swap.1 + drop + push.255 + u32and + push.0 + swap.1 + neq + if.true + nop + else + push.1114148 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + trace.240 + nop + exec.::miden:rust-sdk-account-get-num-procedures-binding/rust-sdk-account-get-num-procedures-binding@0.0.1::rust_sdk_account_get_num_procedures_binding::__wasm_call_ctors + trace.252 + nop + push.1 + push.1048584 + movup.2 + u32wrapping_add + u32divmod.4 + swap.1 + dup.0 + mem_load + dup.2 + push.8 + u32wrapping_mul + push.255 + swap.1 + u32shl + u32not + swap.1 + u32and + movup.3 + movup.3 + push.8 + u32wrapping_mul + u32shl + u32or + swap.1 + mem_store + end +end + +@callconv("C") +proc miden::active_account::get_num_procedures( + +) -> felt + trace.240 + nop + exec.::miden::active_account::get_num_procedures + trace.252 + nop +end + diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_get_num_procedures_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_account_get_num_procedures_binding.wat new file mode 100644 index 000000000..1407da20a --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_get_num_procedures_binding.wat @@ -0,0 +1,73 @@ +(component + (type (;0;) + (instance + (type (;0;) (record (field "inner" f32))) + (export (;1;) "felt" (type (eq 0))) + ) + ) + (import "miden:base/core-types@1.0.0" (instance (;0;) (type 0))) + (core module (;0;) + (type (;0;) (func)) + (type (;1;) (func (result f32))) + (table (;0;) 2 2 funcref) + (memory (;0;) 17) + (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) + (global $GOT.data.internal.__memory_base (;1;) i32 i32.const 0) + (export "memory" (memory 0)) + (export "miden:rust-sdk-account-get-num-procedures-binding/rust-sdk-account-get-num-procedures-binding@0.0.1#binding" (func $miden:rust-sdk-account-get-num-procedures-binding/rust-sdk-account-get-num-procedures-binding@0.0.1#binding)) + (elem (;0;) (i32.const 1) func $rust_sdk_account_get_num_procedures_binding::bindings::__link_custom_section_describing_imports) + (func $__wasm_call_ctors (;0;) (type 0)) + (func $rust_sdk_account_get_num_procedures_binding::bindings::__link_custom_section_describing_imports (;1;) (type 0)) + (func $miden:rust-sdk-account-get-num-procedures-binding/rust-sdk-account-get-num-procedures-binding@0.0.1#binding (;2;) (type 1) (result f32) + call $wit_bindgen::rt::run_ctors_once + call $miden::active_account::get_num_procedures + ) + (func $wit_bindgen::rt::run_ctors_once (;3;) (type 0) + (local i32) + block ;; label = @1 + global.get $GOT.data.internal.__memory_base + i32.const 1048584 + i32.add + i32.load8_u + br_if 0 (;@1;) + global.get $GOT.data.internal.__memory_base + local.set 0 + call $__wasm_call_ctors + local.get 0 + i32.const 1048584 + i32.add + i32.const 1 + i32.store8 + end + ) + (func $miden::active_account::get_num_procedures (;4;) (type 1) (result f32) + unreachable + ) + (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") + (@custom "rodata,miden_account" (after data) "Wrust_sdk_account_get_num_procedures_binding\01\0b0.0.1\03\01\01\00\00\00\00\00\00\00\00\00\00") + ) + (alias export 0 "felt" (type (;1;))) + (core instance (;0;) (instantiate 0)) + (alias core export 0 "memory" (core memory (;0;))) + (type (;2;) (func (result 1))) + (alias core export 0 "miden:rust-sdk-account-get-num-procedures-binding/rust-sdk-account-get-num-procedures-binding@0.0.1#binding" (core func (;0;))) + (func (;0;) (type 2) (canon lift (core func 0))) + (alias export 0 "felt" (type (;3;))) + (component (;0;) + (type (;0;) (record (field "inner" f32))) + (import "import-type-felt" (type (;1;) (eq 0))) + (import "import-type-felt0" (type (;2;) (eq 1))) + (type (;3;) (func (result 2))) + (import "import-func-binding" (func (;0;) (type 3))) + (export (;4;) "felt" (type 1)) + (type (;5;) (func (result 4))) + (export (;1;) "binding" (func 0) (func (type 5))) + ) + (instance (;1;) (instantiate 0 + (with "import-func-binding" (func 0)) + (with "import-type-felt" (type 3)) + (with "import-type-felt0" (type 1)) + ) + ) + (export (;2;) "miden:rust-sdk-account-get-num-procedures-binding/rust-sdk-account-get-num-procedures-binding@0.0.1" (instance 1)) +) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_get_procedure_root_binding.hir b/tests/integration/expected/rust_sdk/rust_sdk_account_get_procedure_root_binding.hir new file mode 100644 index 000000000..92d033d0d --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_get_procedure_root_binding.hir @@ -0,0 +1,337 @@ +builtin.component miden:rust-sdk-account-get-procedure-root-binding/rust-sdk-account-get-procedure-root-binding@0.0.1 { + builtin.module public @rust_sdk_account_get_procedure_root_binding { + private builtin.function @__wasm_call_ctors() { + ^block5: + builtin.ret ; + }; + + private builtin.function @rust_sdk_account_get_procedure_root_binding::bindings::__link_custom_section_describing_imports() { + ^block7: + builtin.ret ; + }; + + private builtin.function @miden:rust-sdk-account-get-procedure-root-binding/rust-sdk-account-get-procedure-root-binding@0.0.1#binding() -> i32 { + ^block9: + v2 = builtin.global_symbol @miden:rust-sdk-account-get-procedure-root-binding/rust-sdk-account-get-procedure-root-binding@0.0.1/rust_sdk_account_get_procedure_root_binding/__stack_pointer : ptr + v3 = hir.bitcast v2 : ptr; + v4 = hir.load v3 : i32; + v5 = arith.constant 48 : i32; + v6 = arith.sub v4, v5 : i32 #[overflow = wrapping]; + v7 = builtin.global_symbol @miden:rust-sdk-account-get-procedure-root-binding/rust-sdk-account-get-procedure-root-binding@0.0.1/rust_sdk_account_get_procedure_root_binding/__stack_pointer : ptr + v8 = hir.bitcast v7 : ptr; + hir.store v8, v6; + hir.exec @miden:rust-sdk-account-get-procedure-root-binding/rust-sdk-account-get-procedure-root-binding@0.0.1/rust_sdk_account_get_procedure_root_binding/wit_bindgen::rt::run_ctors_once() + v1 = arith.constant 0 : i32; + v10 = hir.exec @miden:rust-sdk-account-get-procedure-root-binding/rust-sdk-account-get-procedure-root-binding@0.0.1/rust_sdk_account_get_procedure_root_binding/>::from(v1) : felt + v11 = arith.constant 16 : i32; + v12 = arith.add v6, v11 : i32 #[overflow = wrapping]; + hir.exec @miden:rust-sdk-account-get-procedure-root-binding/rust-sdk-account-get-procedure-root-binding@0.0.1/rust_sdk_account_get_procedure_root_binding/miden::active_account::get_procedure_root(v10, v12) + v14 = arith.constant 24 : u32; + v13 = hir.bitcast v6 : u32; + v15 = arith.add v13, v14 : u32 #[overflow = checked]; + v16 = arith.constant 8 : u32; + v17 = arith.mod v15, v16 : u32; + hir.assertz v17 #[code = 250]; + v18 = hir.int_to_ptr v15 : ptr; + v19 = hir.load v18 : i64; + v21 = arith.constant 40 : u32; + v20 = hir.bitcast v6 : u32; + v22 = arith.add v20, v21 : u32 #[overflow = checked]; + v245 = arith.constant 8 : u32; + v24 = arith.mod v22, v245 : u32; + hir.assertz v24 #[code = 250]; + v25 = hir.int_to_ptr v22 : ptr; + hir.store v25, v19; + v27 = arith.constant 16 : u32; + v26 = hir.bitcast v6 : u32; + v28 = arith.add v26, v27 : u32 #[overflow = checked]; + v244 = arith.constant 8 : u32; + v30 = arith.mod v28, v244 : u32; + hir.assertz v30 #[code = 250]; + v31 = hir.int_to_ptr v28 : ptr; + v32 = hir.load v31 : i64; + v34 = arith.constant 32 : u32; + v33 = hir.bitcast v6 : u32; + v35 = arith.add v33, v34 : u32 #[overflow = checked]; + v243 = arith.constant 8 : u32; + v37 = arith.mod v35, v243 : u32; + hir.assertz v37 #[code = 250]; + v38 = hir.int_to_ptr v35 : ptr; + hir.store v38, v32; + v39 = builtin.global_symbol @miden:rust-sdk-account-get-procedure-root-binding/rust-sdk-account-get-procedure-root-binding@0.0.1/rust_sdk_account_get_procedure_root_binding/GOT.data.internal.__memory_base : ptr + v40 = hir.bitcast v39 : ptr; + v41 = hir.load v40 : i32; + v42 = arith.constant 32 : i32; + v43 = arith.add v6, v42 : i32 #[overflow = wrapping]; + hir.exec @miden:rust-sdk-account-get-procedure-root-binding/rust-sdk-account-get-procedure-root-binding@0.0.1/rust_sdk_account_get_procedure_root_binding/miden_stdlib_sys::intrinsics::word::Word::reverse(v6, v43) + v44 = arith.constant 1048584 : i32; + v45 = arith.add v41, v44 : i32 #[overflow = wrapping]; + v242 = arith.constant 8 : u32; + v46 = hir.bitcast v6 : u32; + v48 = arith.add v46, v242 : u32 #[overflow = checked]; + v241 = arith.constant 8 : u32; + v50 = arith.mod v48, v241 : u32; + hir.assertz v50 #[code = 250]; + v51 = hir.int_to_ptr v48 : ptr; + v52 = hir.load v51 : i64; + v240 = arith.constant 8 : u32; + v53 = hir.bitcast v45 : u32; + v55 = arith.add v53, v240 : u32 #[overflow = checked]; + v56 = arith.constant 4 : u32; + v57 = arith.mod v55, v56 : u32; + hir.assertz v57 #[code = 250]; + v58 = hir.int_to_ptr v55 : ptr; + hir.store v58, v52; + v59 = hir.bitcast v6 : u32; + v239 = arith.constant 8 : u32; + v61 = arith.mod v59, v239 : u32; + hir.assertz v61 #[code = 250]; + v62 = hir.int_to_ptr v59 : ptr; + v63 = hir.load v62 : i64; + v64 = hir.bitcast v45 : u32; + v238 = arith.constant 4 : u32; + v66 = arith.mod v64, v238 : u32; + hir.assertz v66 #[code = 250]; + v67 = hir.int_to_ptr v64 : ptr; + hir.store v67, v63; + v237 = arith.constant 48 : i32; + v69 = arith.add v6, v237 : i32 #[overflow = wrapping]; + v70 = builtin.global_symbol @miden:rust-sdk-account-get-procedure-root-binding/rust-sdk-account-get-procedure-root-binding@0.0.1/rust_sdk_account_get_procedure_root_binding/__stack_pointer : ptr + v71 = hir.bitcast v70 : ptr; + hir.store v71, v69; + builtin.ret v45; + }; + + private builtin.function @wit_bindgen::rt::run_ctors_once() { + ^block11: + v73 = builtin.global_symbol @miden:rust-sdk-account-get-procedure-root-binding/rust-sdk-account-get-procedure-root-binding@0.0.1/rust_sdk_account_get_procedure_root_binding/GOT.data.internal.__memory_base : ptr + v74 = hir.bitcast v73 : ptr; + v75 = hir.load v74 : i32; + v76 = arith.constant 1048600 : i32; + v77 = arith.add v75, v76 : i32 #[overflow = wrapping]; + v78 = hir.bitcast v77 : u32; + v79 = hir.int_to_ptr v78 : ptr; + v80 = hir.load v79 : u8; + v72 = arith.constant 0 : i32; + v81 = arith.zext v80 : u32; + v82 = hir.bitcast v81 : i32; + v84 = arith.neq v82, v72 : i1; + scf.if v84{ + ^block13: + scf.yield ; + } else { + ^block14: + v85 = builtin.global_symbol @miden:rust-sdk-account-get-procedure-root-binding/rust-sdk-account-get-procedure-root-binding@0.0.1/rust_sdk_account_get_procedure_root_binding/GOT.data.internal.__memory_base : ptr + v86 = hir.bitcast v85 : ptr; + v87 = hir.load v86 : i32; + hir.exec @miden:rust-sdk-account-get-procedure-root-binding/rust-sdk-account-get-procedure-root-binding@0.0.1/rust_sdk_account_get_procedure_root_binding/__wasm_call_ctors() + v247 = arith.constant 1 : u8; + v249 = arith.constant 1048600 : i32; + v89 = arith.add v87, v249 : i32 #[overflow = wrapping]; + v93 = hir.bitcast v89 : u32; + v94 = hir.int_to_ptr v93 : ptr; + hir.store v94, v247; + scf.yield ; + }; + builtin.ret ; + }; + + private builtin.function @>::from(v95: i32) -> felt { + ^block15(v95: i32): + v97 = arith.constant 255 : i32; + v98 = arith.band v95, v97 : i32; + v99 = hir.bitcast v98 : felt; + builtin.ret v99; + }; + + private builtin.function @miden_stdlib_sys::intrinsics::word::Word::reverse(v100: i32, v101: i32) { + ^block17(v100: i32, v101: i32): + v104 = builtin.global_symbol @miden:rust-sdk-account-get-procedure-root-binding/rust-sdk-account-get-procedure-root-binding@0.0.1/rust_sdk_account_get_procedure_root_binding/__stack_pointer : ptr + v105 = hir.bitcast v104 : ptr; + v106 = hir.load v105 : i32; + v107 = arith.constant 16 : i32; + v108 = arith.sub v106, v107 : i32 #[overflow = wrapping]; + v110 = arith.constant 8 : u32; + v109 = hir.bitcast v101 : u32; + v111 = arith.add v109, v110 : u32 #[overflow = checked]; + v336 = arith.constant 8 : u32; + v113 = arith.mod v111, v336 : u32; + hir.assertz v113 #[code = 250]; + v114 = hir.int_to_ptr v111 : ptr; + v115 = hir.load v114 : i64; + v335 = arith.constant 8 : u32; + v116 = hir.bitcast v108 : u32; + v118 = arith.add v116, v335 : u32 #[overflow = checked]; + v119 = arith.constant 4 : u32; + v120 = arith.mod v118, v119 : u32; + hir.assertz v120 #[code = 250]; + v121 = hir.int_to_ptr v118 : ptr; + hir.store v121, v115; + v122 = hir.bitcast v101 : u32; + v334 = arith.constant 8 : u32; + v124 = arith.mod v122, v334 : u32; + hir.assertz v124 #[code = 250]; + v125 = hir.int_to_ptr v122 : ptr; + v126 = hir.load v125 : i64; + v127 = hir.bitcast v108 : u32; + v333 = arith.constant 4 : u32; + v129 = arith.mod v127, v333 : u32; + hir.assertz v129 #[code = 250]; + v130 = hir.int_to_ptr v127 : ptr; + hir.store v130, v126; + v131 = arith.constant 12 : i32; + v132 = arith.add v108, v131 : i32 #[overflow = wrapping]; + v102 = arith.constant 0 : i32; + v304, v305, v306, v307, v308, v309 = scf.while v102, v108, v132, v100 : i32, i32, i32, i32, i32, i32 { + ^block37(v310: i32, v311: i32, v312: i32, v313: i32): + v332 = arith.constant 0 : i32; + v135 = arith.constant 8 : i32; + v136 = arith.eq v310, v135 : i1; + v137 = arith.zext v136 : u32; + v138 = hir.bitcast v137 : i32; + v140 = arith.neq v138, v332 : i1; + v298, v299 = scf.if v140 : i32, i32 { + ^block36: + v258 = ub.poison i32 : i32; + scf.yield v258, v258; + } else { + ^block22: + v142 = arith.add v311, v310 : i32 #[overflow = wrapping]; + v143 = hir.bitcast v142 : u32; + v331 = arith.constant 4 : u32; + v145 = arith.mod v143, v331 : u32; + hir.assertz v145 #[code = 250]; + v146 = hir.int_to_ptr v143 : ptr; + v147 = hir.load v146 : felt; + v149 = hir.bitcast v312 : u32; + v330 = arith.constant 4 : u32; + v151 = arith.mod v149, v330 : u32; + hir.assertz v151 #[code = 250]; + v152 = hir.int_to_ptr v149 : ptr; + v153 = hir.load v152 : i32; + v154 = hir.bitcast v142 : u32; + v329 = arith.constant 4 : u32; + v156 = arith.mod v154, v329 : u32; + hir.assertz v156 #[code = 250]; + v157 = hir.int_to_ptr v154 : ptr; + hir.store v157, v153; + v158 = hir.bitcast v312 : u32; + v328 = arith.constant 4 : u32; + v160 = arith.mod v158, v328 : u32; + hir.assertz v160 #[code = 250]; + v161 = hir.int_to_ptr v158 : ptr; + hir.store v161, v147; + v164 = arith.constant -4 : i32; + v165 = arith.add v312, v164 : i32 #[overflow = wrapping]; + v162 = arith.constant 4 : i32; + v163 = arith.add v310, v162 : i32 #[overflow = wrapping]; + scf.yield v163, v165; + }; + v326 = ub.poison i32 : i32; + v301 = cf.select v140, v326, v313 : i32; + v327 = ub.poison i32 : i32; + v300 = cf.select v140, v327, v311 : i32; + v257 = arith.constant 1 : u32; + v250 = arith.constant 0 : u32; + v303 = cf.select v140, v250, v257 : u32; + v291 = arith.trunc v303 : i1; + scf.condition v291, v298, v300, v299, v301, v311, v313; + } do { + ^block38(v314: i32, v315: i32, v316: i32, v317: i32, v318: i32, v319: i32): + scf.yield v314, v315, v316, v317; + }; + v325 = arith.constant 8 : u32; + v167 = hir.bitcast v308 : u32; + v169 = arith.add v167, v325 : u32 #[overflow = checked]; + v324 = arith.constant 4 : u32; + v171 = arith.mod v169, v324 : u32; + hir.assertz v171 #[code = 250]; + v172 = hir.int_to_ptr v169 : ptr; + v173 = hir.load v172 : i64; + v323 = arith.constant 8 : u32; + v174 = hir.bitcast v309 : u32; + v176 = arith.add v174, v323 : u32 #[overflow = checked]; + v322 = arith.constant 8 : u32; + v178 = arith.mod v176, v322 : u32; + hir.assertz v178 #[code = 250]; + v179 = hir.int_to_ptr v176 : ptr; + hir.store v179, v173; + v180 = hir.bitcast v308 : u32; + v321 = arith.constant 4 : u32; + v182 = arith.mod v180, v321 : u32; + hir.assertz v182 #[code = 250]; + v183 = hir.int_to_ptr v180 : ptr; + v184 = hir.load v183 : i64; + v185 = hir.bitcast v309 : u32; + v320 = arith.constant 8 : u32; + v187 = arith.mod v185, v320 : u32; + hir.assertz v187 #[code = 250]; + v188 = hir.int_to_ptr v185 : ptr; + hir.store v188, v184; + builtin.ret ; + }; + + private builtin.function @miden::active_account::get_procedure_root(v189: felt, v190: i32) { + ^block23(v189: felt, v190: i32): + v191, v192, v193, v194 = hir.exec @miden/active_account/get_procedure_root(v189) : felt, felt, felt, felt + v195 = hir.bitcast v190 : u32; + v196 = hir.int_to_ptr v195 : ptr; + hir.store v196, v191; + v197 = arith.constant 4 : u32; + v198 = arith.add v195, v197 : u32 #[overflow = checked]; + v199 = hir.int_to_ptr v198 : ptr; + hir.store v199, v192; + v200 = arith.constant 8 : u32; + v201 = arith.add v195, v200 : u32 #[overflow = checked]; + v202 = hir.int_to_ptr v201 : ptr; + hir.store v202, v193; + v203 = arith.constant 12 : u32; + v204 = arith.add v195, v203 : u32 #[overflow = checked]; + v205 = hir.int_to_ptr v204 : ptr; + hir.store v205, v194; + builtin.ret ; + }; + + builtin.global_variable private @#__stack_pointer : i32 { + builtin.ret_imm 1048576; + }; + + builtin.global_variable private @#GOT.data.internal.__memory_base : i32 { + builtin.ret_imm 0; + }; + + builtin.segment @1048576 = 0x0000000100000001; + }; + + public builtin.function @binding() -> felt, felt, felt, felt { + ^block27: + v206 = hir.exec @miden:rust-sdk-account-get-procedure-root-binding/rust-sdk-account-get-procedure-root-binding@0.0.1/rust_sdk_account_get_procedure_root_binding/miden:rust-sdk-account-get-procedure-root-binding/rust-sdk-account-get-procedure-root-binding@0.0.1#binding() : i32 + v207 = arith.constant 0 : i32; + v208 = arith.add v206, v207 : i32 #[overflow = unchecked]; + v340 = arith.constant 0 : i32; + v341 = arith.constant 0 : i32; + v210 = arith.add v208, v341 : i32 #[overflow = unchecked]; + v212 = arith.add v210, v340 : i32 #[overflow = unchecked]; + v213 = hir.int_to_ptr v212 : ptr; + v214 = hir.load v213 : felt; + v339 = arith.constant 0 : i32; + v215 = arith.constant 4 : i32; + v216 = arith.add v208, v215 : i32 #[overflow = unchecked]; + v218 = arith.add v216, v339 : i32 #[overflow = unchecked]; + v219 = hir.int_to_ptr v218 : ptr; + v220 = hir.load v219 : felt; + v338 = arith.constant 0 : i32; + v221 = arith.constant 8 : i32; + v222 = arith.add v208, v221 : i32 #[overflow = unchecked]; + v224 = arith.add v222, v338 : i32 #[overflow = unchecked]; + v225 = hir.int_to_ptr v224 : ptr; + v226 = hir.load v225 : felt; + v337 = arith.constant 0 : i32; + v227 = arith.constant 12 : i32; + v228 = arith.add v208, v227 : i32 #[overflow = unchecked]; + v230 = arith.add v228, v337 : i32 #[overflow = unchecked]; + v231 = hir.int_to_ptr v230 : ptr; + v232 = hir.load v231 : felt; + builtin.ret v214, v220, v226, v232; + }; +}; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_get_procedure_root_binding.masm b/tests/integration/expected/rust_sdk/rust_sdk_account_get_procedure_root_binding.masm new file mode 100644 index 000000000..6df837493 --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_get_procedure_root_binding.masm @@ -0,0 +1,713 @@ +# mod miden:rust-sdk-account-get-procedure-root-binding/rust-sdk-account-get-procedure-root-binding@0.0.1 + +@callconv("canon-lift") +pub proc binding( + +) -> (felt, felt, felt, felt) + exec.::miden:rust-sdk-account-get-procedure-root-binding/rust-sdk-account-get-procedure-root-binding@0.0.1::init + trace.240 + nop + exec.::miden:rust-sdk-account-get-procedure-root-binding/rust-sdk-account-get-procedure-root-binding@0.0.1::rust_sdk_account_get_procedure_root_binding::miden:rust-sdk-account-get-procedure-root-binding/rust-sdk-account-get-procedure-root-binding@0.0.1#binding + trace.252 + nop + push.0 + u32wrapping_add + push.0 + push.0 + dup.2 + u32wrapping_add + u32wrapping_add + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.0 + push.4 + dup.3 + u32wrapping_add + u32wrapping_add + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.0 + push.8 + dup.4 + u32wrapping_add + u32wrapping_add + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.0 + push.12 + movup.5 + u32wrapping_add + u32wrapping_add + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + movdn.3 + swap.2 + exec.::std::sys::truncate_stack +end + +proc init + push.1179648 + trace.240 + exec.::intrinsics::mem::heap_init + trace.252 + push.[7028007876379170725,18060021366771303825,13412364500725888848,14178532912296021363] + adv.push_mapval + push.262144 + push.1 + trace.240 + exec.::std::mem::pipe_preimage_to_memory + trace.252 + drop + push.1048576 + u32assert + mem_store.278536 + push.0 + u32assert + mem_store.278537 +end + +# mod miden:rust-sdk-account-get-procedure-root-binding/rust-sdk-account-get-procedure-root-binding@0.0.1::rust_sdk_account_get_procedure_root_binding + +@callconv("C") +proc __wasm_call_ctors( + +) + nop +end + +@callconv("C") +proc rust_sdk_account_get_procedure_root_binding::bindings::__link_custom_section_describing_imports( + +) + nop +end + +@callconv("C") +proc miden:rust-sdk-account-get-procedure-root-binding/rust-sdk-account-get-procedure-root-binding@0.0.1#binding( + +) -> i32 + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.48 + u32wrapping_sub + push.1114144 + dup.1 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + trace.240 + nop + exec.::miden:rust-sdk-account-get-procedure-root-binding/rust-sdk-account-get-procedure-root-binding@0.0.1::rust_sdk_account_get_procedure_root_binding::wit_bindgen::rt::run_ctors_once + trace.252 + nop + push.0 + trace.240 + nop + exec.::miden:rust-sdk-account-get-procedure-root-binding/rust-sdk-account-get-procedure-root-binding@0.0.1::rust_sdk_account_get_procedure_root_binding::>::from + trace.252 + nop + push.16 + dup.2 + u32wrapping_add + swap.1 + trace.240 + nop + exec.::miden:rust-sdk-account-get-procedure-root-binding/rust-sdk-account-get-procedure-root-binding@0.0.1::rust_sdk_account_get_procedure_root_binding::miden::active_account::get_procedure_root + trace.252 + nop + push.24 + dup.1 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.40 + dup.3 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.16 + dup.1 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.32 + dup.3 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.1114148 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.32 + dup.2 + u32wrapping_add + dup.2 + trace.240 + nop + exec.::miden:rust-sdk-account-get-procedure-root-binding/rust-sdk-account-get-procedure-root-binding@0.0.1::rust_sdk_account_get_procedure_root_binding::miden_stdlib_sys::intrinsics::word::Word::reverse + trace.252 + nop + push.1048584 + u32wrapping_add + push.8 + dup.2 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.8 + dup.3 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + dup.1 + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + dup.2 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.48 + movup.2 + u32wrapping_add + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop +end + +@callconv("C") +proc wit_bindgen::rt::run_ctors_once( + +) + push.1114148 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.1048600 + u32wrapping_add + u32divmod.4 + swap.1 + swap.1 + dup.1 + mem_load + swap.1 + push.8 + u32wrapping_mul + u32shr + swap.1 + drop + push.255 + u32and + push.0 + swap.1 + neq + if.true + nop + else + push.1114148 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + trace.240 + nop + exec.::miden:rust-sdk-account-get-procedure-root-binding/rust-sdk-account-get-procedure-root-binding@0.0.1::rust_sdk_account_get_procedure_root_binding::__wasm_call_ctors + trace.252 + nop + push.1 + push.1048600 + movup.2 + u32wrapping_add + u32divmod.4 + swap.1 + dup.0 + mem_load + dup.2 + push.8 + u32wrapping_mul + push.255 + swap.1 + u32shl + u32not + swap.1 + u32and + movup.3 + movup.3 + push.8 + u32wrapping_mul + u32shl + u32or + swap.1 + mem_store + end +end + +@callconv("C") +proc >::from( + i32 +) -> felt + push.255 + u32and +end + +@callconv("C") +proc miden_stdlib_sys::intrinsics::word::Word::reverse( + i32, + i32 +) + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.16 + u32wrapping_sub + push.8 + dup.3 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.8 + dup.3 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + movup.2 + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + dup.2 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.12 + dup.1 + u32wrapping_add + push.0 + movup.2 + swap.1 + push.1 + while.true + push.0 + push.8 + dup.2 + eq + neq + dup.0 + if.true + movup.3 + movup.2 + drop + drop + push.3735929054 + dup.0 + else + dup.2 + dup.2 + u32wrapping_add + dup.0 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + dup.5 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + movup.2 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + dup.4 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.4294967292 + movup.4 + u32wrapping_add + push.4 + movup.3 + u32wrapping_add + end + push.3735929054 + dup.3 + dup.6 + swap.2 + swap.1 + cdrop + push.3735929054 + dup.4 + dup.6 + swap.2 + swap.1 + cdrop + push.1 + push.0 + movup.6 + cdrop + push.1 + u32and + swap.1 + swap.2 + swap.4 + swap.3 + swap.1 + if.true + movup.4 + drop + movup.4 + drop + push.1 + else + push.0 + end + end + drop + drop + drop + drop + push.8 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.8 + dup.4 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + movup.2 + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop +end + +@callconv("C") +proc miden::active_account::get_procedure_root(felt, i32) + trace.240 + nop + exec.::miden::active_account::get_procedure_root + trace.252 + nop + movup.4 + dup.0 + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.4 + dup.1 + add + u32assert + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.8 + dup.1 + add + u32assert + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.12 + add + u32assert + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop +end + diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_get_procedure_root_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_account_get_procedure_root_binding.wat new file mode 100644 index 000000000..61608278d --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_get_procedure_root_binding.wat @@ -0,0 +1,190 @@ +(component + (type (;0;) + (instance + (type (;0;) (record (field "inner" f32))) + (export (;1;) "felt" (type (eq 0))) + (type (;2;) (tuple 1 1 1 1)) + (type (;3;) (record (field "inner" 2))) + (export (;4;) "word" (type (eq 3))) + ) + ) + (import "miden:base/core-types@1.0.0" (instance (;0;) (type 0))) + (core module (;0;) + (type (;0;) (func)) + (type (;1;) (func (result i32))) + (type (;2;) (func (param i32) (result f32))) + (type (;3;) (func (param i32 i32))) + (type (;4;) (func (param f32 i32))) + (table (;0;) 2 2 funcref) + (memory (;0;) 17) + (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) + (global $GOT.data.internal.__memory_base (;1;) i32 i32.const 0) + (export "memory" (memory 0)) + (export "miden:rust-sdk-account-get-procedure-root-binding/rust-sdk-account-get-procedure-root-binding@0.0.1#binding" (func $miden:rust-sdk-account-get-procedure-root-binding/rust-sdk-account-get-procedure-root-binding@0.0.1#binding)) + (elem (;0;) (i32.const 1) func $rust_sdk_account_get_procedure_root_binding::bindings::__link_custom_section_describing_imports) + (func $__wasm_call_ctors (;0;) (type 0)) + (func $rust_sdk_account_get_procedure_root_binding::bindings::__link_custom_section_describing_imports (;1;) (type 0)) + (func $miden:rust-sdk-account-get-procedure-root-binding/rust-sdk-account-get-procedure-root-binding@0.0.1#binding (;2;) (type 1) (result i32) + (local i32 i32) + global.get $__stack_pointer + i32.const 48 + i32.sub + local.tee 0 + global.set $__stack_pointer + call $wit_bindgen::rt::run_ctors_once + i32.const 0 + call $>::from + local.get 0 + i32.const 16 + i32.add + call $miden::active_account::get_procedure_root + local.get 0 + local.get 0 + i64.load offset=24 + i64.store offset=40 + local.get 0 + local.get 0 + i64.load offset=16 + i64.store offset=32 + global.get $GOT.data.internal.__memory_base + local.set 1 + local.get 0 + local.get 0 + i32.const 32 + i32.add + call $miden_stdlib_sys::intrinsics::word::Word::reverse + local.get 1 + i32.const 1048584 + i32.add + local.tee 1 + local.get 0 + i64.load offset=8 + i64.store offset=8 align=4 + local.get 1 + local.get 0 + i64.load + i64.store align=4 + local.get 0 + i32.const 48 + i32.add + global.set $__stack_pointer + local.get 1 + ) + (func $wit_bindgen::rt::run_ctors_once (;3;) (type 0) + (local i32) + block ;; label = @1 + global.get $GOT.data.internal.__memory_base + i32.const 1048600 + i32.add + i32.load8_u + br_if 0 (;@1;) + global.get $GOT.data.internal.__memory_base + local.set 0 + call $__wasm_call_ctors + local.get 0 + i32.const 1048600 + i32.add + i32.const 1 + i32.store8 + end + ) + (func $>::from (;4;) (type 2) (param i32) (result f32) + local.get 0 + i32.const 255 + i32.and + f32.reinterpret_i32 + ) + (func $miden_stdlib_sys::intrinsics::word::Word::reverse (;5;) (type 3) (param i32 i32) + (local i32 i32 i32 f32) + global.get $__stack_pointer + i32.const 16 + i32.sub + local.tee 2 + local.get 1 + i64.load offset=8 + i64.store offset=8 align=4 + local.get 2 + local.get 1 + i64.load + i64.store align=4 + local.get 2 + i32.const 12 + i32.add + local.set 3 + i32.const 0 + local.set 1 + block ;; label = @1 + loop ;; label = @2 + local.get 1 + i32.const 8 + i32.eq + br_if 1 (;@1;) + local.get 2 + local.get 1 + i32.add + local.tee 4 + f32.load + local.set 5 + local.get 4 + local.get 3 + i32.load + i32.store + local.get 3 + local.get 5 + f32.store + local.get 1 + i32.const 4 + i32.add + local.set 1 + local.get 3 + i32.const -4 + i32.add + local.set 3 + br 0 (;@2;) + end + end + local.get 0 + local.get 2 + i64.load offset=8 align=4 + i64.store offset=8 + local.get 0 + local.get 2 + i64.load align=4 + i64.store + ) + (func $miden::active_account::get_procedure_root (;6;) (type 4) (param f32 i32) + unreachable + ) + (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") + (@custom "rodata,miden_account" (after data) "Wrust_sdk_account_get_procedure_root_binding\01\0b0.0.1\03\01\01\00\00\00\00\00\00\00\00\00\00") + ) + (alias export 0 "word" (type (;1;))) + (core instance (;0;) (instantiate 0)) + (alias core export 0 "memory" (core memory (;0;))) + (type (;2;) (func (result 1))) + (alias core export 0 "miden:rust-sdk-account-get-procedure-root-binding/rust-sdk-account-get-procedure-root-binding@0.0.1#binding" (core func (;0;))) + (func (;0;) (type 2) (canon lift (core func 0) (memory 0))) + (alias export 0 "felt" (type (;3;))) + (alias export 0 "word" (type (;4;))) + (component (;0;) + (type (;0;) (record (field "inner" f32))) + (import "import-type-felt" (type (;1;) (eq 0))) + (type (;2;) (tuple 1 1 1 1)) + (type (;3;) (record (field "inner" 2))) + (import "import-type-word" (type (;4;) (eq 3))) + (import "import-type-word0" (type (;5;) (eq 4))) + (type (;6;) (func (result 5))) + (import "import-func-binding" (func (;0;) (type 6))) + (export (;7;) "word" (type 4)) + (type (;8;) (func (result 7))) + (export (;1;) "binding" (func 0) (func (type 8))) + ) + (instance (;1;) (instantiate 0 + (with "import-func-binding" (func 0)) + (with "import-type-felt" (type 3)) + (with "import-type-word" (type 4)) + (with "import-type-word0" (type 1)) + ) + ) + (export (;2;) "miden:rust-sdk-account-get-procedure-root-binding/rust-sdk-account-get-procedure-root-binding@0.0.1" (instance 1)) +) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_get_vault_root_binding.hir b/tests/integration/expected/rust_sdk/rust_sdk_account_get_vault_root_binding.hir new file mode 100644 index 000000000..229e8ad52 --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_get_vault_root_binding.hir @@ -0,0 +1,327 @@ +builtin.component miden:rust-sdk-account-get-vault-root-binding/rust-sdk-account-get-vault-root-binding@0.0.1 { + builtin.module public @rust_sdk_account_get_vault_root_binding { + private builtin.function @__wasm_call_ctors() { + ^block5: + builtin.ret ; + }; + + private builtin.function @rust_sdk_account_get_vault_root_binding::bindings::__link_custom_section_describing_imports() { + ^block7: + builtin.ret ; + }; + + private builtin.function @miden:rust-sdk-account-get-vault-root-binding/rust-sdk-account-get-vault-root-binding@0.0.1#binding() -> i32 { + ^block9: + v2 = builtin.global_symbol @miden:rust-sdk-account-get-vault-root-binding/rust-sdk-account-get-vault-root-binding@0.0.1/rust_sdk_account_get_vault_root_binding/__stack_pointer : ptr + v3 = hir.bitcast v2 : ptr; + v4 = hir.load v3 : i32; + v5 = arith.constant 48 : i32; + v6 = arith.sub v4, v5 : i32 #[overflow = wrapping]; + v7 = builtin.global_symbol @miden:rust-sdk-account-get-vault-root-binding/rust-sdk-account-get-vault-root-binding@0.0.1/rust_sdk_account_get_vault_root_binding/__stack_pointer : ptr + v8 = hir.bitcast v7 : ptr; + hir.store v8, v6; + hir.exec @miden:rust-sdk-account-get-vault-root-binding/rust-sdk-account-get-vault-root-binding@0.0.1/rust_sdk_account_get_vault_root_binding/wit_bindgen::rt::run_ctors_once() + v9 = arith.constant 16 : i32; + v10 = arith.add v6, v9 : i32 #[overflow = wrapping]; + hir.exec @miden:rust-sdk-account-get-vault-root-binding/rust-sdk-account-get-vault-root-binding@0.0.1/rust_sdk_account_get_vault_root_binding/miden::active_account::get_vault_root(v10) + v12 = arith.constant 24 : u32; + v11 = hir.bitcast v6 : u32; + v13 = arith.add v11, v12 : u32 #[overflow = checked]; + v14 = arith.constant 8 : u32; + v15 = arith.mod v13, v14 : u32; + hir.assertz v15 #[code = 250]; + v16 = hir.int_to_ptr v13 : ptr; + v17 = hir.load v16 : i64; + v19 = arith.constant 40 : u32; + v18 = hir.bitcast v6 : u32; + v20 = arith.add v18, v19 : u32 #[overflow = checked]; + v237 = arith.constant 8 : u32; + v22 = arith.mod v20, v237 : u32; + hir.assertz v22 #[code = 250]; + v23 = hir.int_to_ptr v20 : ptr; + hir.store v23, v17; + v25 = arith.constant 16 : u32; + v24 = hir.bitcast v6 : u32; + v26 = arith.add v24, v25 : u32 #[overflow = checked]; + v236 = arith.constant 8 : u32; + v28 = arith.mod v26, v236 : u32; + hir.assertz v28 #[code = 250]; + v29 = hir.int_to_ptr v26 : ptr; + v30 = hir.load v29 : i64; + v32 = arith.constant 32 : u32; + v31 = hir.bitcast v6 : u32; + v33 = arith.add v31, v32 : u32 #[overflow = checked]; + v235 = arith.constant 8 : u32; + v35 = arith.mod v33, v235 : u32; + hir.assertz v35 #[code = 250]; + v36 = hir.int_to_ptr v33 : ptr; + hir.store v36, v30; + v37 = builtin.global_symbol @miden:rust-sdk-account-get-vault-root-binding/rust-sdk-account-get-vault-root-binding@0.0.1/rust_sdk_account_get_vault_root_binding/GOT.data.internal.__memory_base : ptr + v38 = hir.bitcast v37 : ptr; + v39 = hir.load v38 : i32; + v40 = arith.constant 32 : i32; + v41 = arith.add v6, v40 : i32 #[overflow = wrapping]; + hir.exec @miden:rust-sdk-account-get-vault-root-binding/rust-sdk-account-get-vault-root-binding@0.0.1/rust_sdk_account_get_vault_root_binding/miden_stdlib_sys::intrinsics::word::Word::reverse(v6, v41) + v42 = arith.constant 1048584 : i32; + v43 = arith.add v39, v42 : i32 #[overflow = wrapping]; + v234 = arith.constant 8 : u32; + v44 = hir.bitcast v6 : u32; + v46 = arith.add v44, v234 : u32 #[overflow = checked]; + v233 = arith.constant 8 : u32; + v48 = arith.mod v46, v233 : u32; + hir.assertz v48 #[code = 250]; + v49 = hir.int_to_ptr v46 : ptr; + v50 = hir.load v49 : i64; + v232 = arith.constant 8 : u32; + v51 = hir.bitcast v43 : u32; + v53 = arith.add v51, v232 : u32 #[overflow = checked]; + v54 = arith.constant 4 : u32; + v55 = arith.mod v53, v54 : u32; + hir.assertz v55 #[code = 250]; + v56 = hir.int_to_ptr v53 : ptr; + hir.store v56, v50; + v57 = hir.bitcast v6 : u32; + v231 = arith.constant 8 : u32; + v59 = arith.mod v57, v231 : u32; + hir.assertz v59 #[code = 250]; + v60 = hir.int_to_ptr v57 : ptr; + v61 = hir.load v60 : i64; + v62 = hir.bitcast v43 : u32; + v230 = arith.constant 4 : u32; + v64 = arith.mod v62, v230 : u32; + hir.assertz v64 #[code = 250]; + v65 = hir.int_to_ptr v62 : ptr; + hir.store v65, v61; + v229 = arith.constant 48 : i32; + v67 = arith.add v6, v229 : i32 #[overflow = wrapping]; + v68 = builtin.global_symbol @miden:rust-sdk-account-get-vault-root-binding/rust-sdk-account-get-vault-root-binding@0.0.1/rust_sdk_account_get_vault_root_binding/__stack_pointer : ptr + v69 = hir.bitcast v68 : ptr; + hir.store v69, v67; + builtin.ret v43; + }; + + private builtin.function @wit_bindgen::rt::run_ctors_once() { + ^block11: + v71 = builtin.global_symbol @miden:rust-sdk-account-get-vault-root-binding/rust-sdk-account-get-vault-root-binding@0.0.1/rust_sdk_account_get_vault_root_binding/GOT.data.internal.__memory_base : ptr + v72 = hir.bitcast v71 : ptr; + v73 = hir.load v72 : i32; + v74 = arith.constant 1048600 : i32; + v75 = arith.add v73, v74 : i32 #[overflow = wrapping]; + v76 = hir.bitcast v75 : u32; + v77 = hir.int_to_ptr v76 : ptr; + v78 = hir.load v77 : u8; + v70 = arith.constant 0 : i32; + v79 = arith.zext v78 : u32; + v80 = hir.bitcast v79 : i32; + v82 = arith.neq v80, v70 : i1; + scf.if v82{ + ^block13: + scf.yield ; + } else { + ^block14: + v83 = builtin.global_symbol @miden:rust-sdk-account-get-vault-root-binding/rust-sdk-account-get-vault-root-binding@0.0.1/rust_sdk_account_get_vault_root_binding/GOT.data.internal.__memory_base : ptr + v84 = hir.bitcast v83 : ptr; + v85 = hir.load v84 : i32; + hir.exec @miden:rust-sdk-account-get-vault-root-binding/rust-sdk-account-get-vault-root-binding@0.0.1/rust_sdk_account_get_vault_root_binding/__wasm_call_ctors() + v239 = arith.constant 1 : u8; + v241 = arith.constant 1048600 : i32; + v87 = arith.add v85, v241 : i32 #[overflow = wrapping]; + v91 = hir.bitcast v87 : u32; + v92 = hir.int_to_ptr v91 : ptr; + hir.store v92, v239; + scf.yield ; + }; + builtin.ret ; + }; + + private builtin.function @miden_stdlib_sys::intrinsics::word::Word::reverse(v93: i32, v94: i32) { + ^block15(v93: i32, v94: i32): + v97 = builtin.global_symbol @miden:rust-sdk-account-get-vault-root-binding/rust-sdk-account-get-vault-root-binding@0.0.1/rust_sdk_account_get_vault_root_binding/__stack_pointer : ptr + v98 = hir.bitcast v97 : ptr; + v99 = hir.load v98 : i32; + v100 = arith.constant 16 : i32; + v101 = arith.sub v99, v100 : i32 #[overflow = wrapping]; + v103 = arith.constant 8 : u32; + v102 = hir.bitcast v94 : u32; + v104 = arith.add v102, v103 : u32 #[overflow = checked]; + v328 = arith.constant 8 : u32; + v106 = arith.mod v104, v328 : u32; + hir.assertz v106 #[code = 250]; + v107 = hir.int_to_ptr v104 : ptr; + v108 = hir.load v107 : i64; + v327 = arith.constant 8 : u32; + v109 = hir.bitcast v101 : u32; + v111 = arith.add v109, v327 : u32 #[overflow = checked]; + v112 = arith.constant 4 : u32; + v113 = arith.mod v111, v112 : u32; + hir.assertz v113 #[code = 250]; + v114 = hir.int_to_ptr v111 : ptr; + hir.store v114, v108; + v115 = hir.bitcast v94 : u32; + v326 = arith.constant 8 : u32; + v117 = arith.mod v115, v326 : u32; + hir.assertz v117 #[code = 250]; + v118 = hir.int_to_ptr v115 : ptr; + v119 = hir.load v118 : i64; + v120 = hir.bitcast v101 : u32; + v325 = arith.constant 4 : u32; + v122 = arith.mod v120, v325 : u32; + hir.assertz v122 #[code = 250]; + v123 = hir.int_to_ptr v120 : ptr; + hir.store v123, v119; + v124 = arith.constant 12 : i32; + v125 = arith.add v101, v124 : i32 #[overflow = wrapping]; + v95 = arith.constant 0 : i32; + v296, v297, v298, v299, v300, v301 = scf.while v95, v101, v125, v93 : i32, i32, i32, i32, i32, i32 { + ^block35(v302: i32, v303: i32, v304: i32, v305: i32): + v324 = arith.constant 0 : i32; + v128 = arith.constant 8 : i32; + v129 = arith.eq v302, v128 : i1; + v130 = arith.zext v129 : u32; + v131 = hir.bitcast v130 : i32; + v133 = arith.neq v131, v324 : i1; + v290, v291 = scf.if v133 : i32, i32 { + ^block34: + v250 = ub.poison i32 : i32; + scf.yield v250, v250; + } else { + ^block20: + v135 = arith.add v303, v302 : i32 #[overflow = wrapping]; + v136 = hir.bitcast v135 : u32; + v323 = arith.constant 4 : u32; + v138 = arith.mod v136, v323 : u32; + hir.assertz v138 #[code = 250]; + v139 = hir.int_to_ptr v136 : ptr; + v140 = hir.load v139 : felt; + v142 = hir.bitcast v304 : u32; + v322 = arith.constant 4 : u32; + v144 = arith.mod v142, v322 : u32; + hir.assertz v144 #[code = 250]; + v145 = hir.int_to_ptr v142 : ptr; + v146 = hir.load v145 : i32; + v147 = hir.bitcast v135 : u32; + v321 = arith.constant 4 : u32; + v149 = arith.mod v147, v321 : u32; + hir.assertz v149 #[code = 250]; + v150 = hir.int_to_ptr v147 : ptr; + hir.store v150, v146; + v151 = hir.bitcast v304 : u32; + v320 = arith.constant 4 : u32; + v153 = arith.mod v151, v320 : u32; + hir.assertz v153 #[code = 250]; + v154 = hir.int_to_ptr v151 : ptr; + hir.store v154, v140; + v157 = arith.constant -4 : i32; + v158 = arith.add v304, v157 : i32 #[overflow = wrapping]; + v155 = arith.constant 4 : i32; + v156 = arith.add v302, v155 : i32 #[overflow = wrapping]; + scf.yield v156, v158; + }; + v318 = ub.poison i32 : i32; + v293 = cf.select v133, v318, v305 : i32; + v319 = ub.poison i32 : i32; + v292 = cf.select v133, v319, v303 : i32; + v249 = arith.constant 1 : u32; + v242 = arith.constant 0 : u32; + v295 = cf.select v133, v242, v249 : u32; + v283 = arith.trunc v295 : i1; + scf.condition v283, v290, v292, v291, v293, v303, v305; + } do { + ^block36(v306: i32, v307: i32, v308: i32, v309: i32, v310: i32, v311: i32): + scf.yield v306, v307, v308, v309; + }; + v317 = arith.constant 8 : u32; + v160 = hir.bitcast v300 : u32; + v162 = arith.add v160, v317 : u32 #[overflow = checked]; + v316 = arith.constant 4 : u32; + v164 = arith.mod v162, v316 : u32; + hir.assertz v164 #[code = 250]; + v165 = hir.int_to_ptr v162 : ptr; + v166 = hir.load v165 : i64; + v315 = arith.constant 8 : u32; + v167 = hir.bitcast v301 : u32; + v169 = arith.add v167, v315 : u32 #[overflow = checked]; + v314 = arith.constant 8 : u32; + v171 = arith.mod v169, v314 : u32; + hir.assertz v171 #[code = 250]; + v172 = hir.int_to_ptr v169 : ptr; + hir.store v172, v166; + v173 = hir.bitcast v300 : u32; + v313 = arith.constant 4 : u32; + v175 = arith.mod v173, v313 : u32; + hir.assertz v175 #[code = 250]; + v176 = hir.int_to_ptr v173 : ptr; + v177 = hir.load v176 : i64; + v178 = hir.bitcast v301 : u32; + v312 = arith.constant 8 : u32; + v180 = arith.mod v178, v312 : u32; + hir.assertz v180 #[code = 250]; + v181 = hir.int_to_ptr v178 : ptr; + hir.store v181, v177; + builtin.ret ; + }; + + private builtin.function @miden::active_account::get_vault_root(v182: i32) { + ^block21(v182: i32): + v183, v184, v185, v186 = hir.exec @miden/active_account/get_vault_root() : felt, felt, felt, felt + v187 = hir.bitcast v182 : u32; + v188 = hir.int_to_ptr v187 : ptr; + hir.store v188, v183; + v189 = arith.constant 4 : u32; + v190 = arith.add v187, v189 : u32 #[overflow = checked]; + v191 = hir.int_to_ptr v190 : ptr; + hir.store v191, v184; + v192 = arith.constant 8 : u32; + v193 = arith.add v187, v192 : u32 #[overflow = checked]; + v194 = hir.int_to_ptr v193 : ptr; + hir.store v194, v185; + v195 = arith.constant 12 : u32; + v196 = arith.add v187, v195 : u32 #[overflow = checked]; + v197 = hir.int_to_ptr v196 : ptr; + hir.store v197, v186; + builtin.ret ; + }; + + builtin.global_variable private @#__stack_pointer : i32 { + builtin.ret_imm 1048576; + }; + + builtin.global_variable private @#GOT.data.internal.__memory_base : i32 { + builtin.ret_imm 0; + }; + + builtin.segment @1048576 = 0x0000000100000001; + }; + + public builtin.function @binding() -> felt, felt, felt, felt { + ^block25: + v198 = hir.exec @miden:rust-sdk-account-get-vault-root-binding/rust-sdk-account-get-vault-root-binding@0.0.1/rust_sdk_account_get_vault_root_binding/miden:rust-sdk-account-get-vault-root-binding/rust-sdk-account-get-vault-root-binding@0.0.1#binding() : i32 + v199 = arith.constant 0 : i32; + v200 = arith.add v198, v199 : i32 #[overflow = unchecked]; + v332 = arith.constant 0 : i32; + v333 = arith.constant 0 : i32; + v202 = arith.add v200, v333 : i32 #[overflow = unchecked]; + v204 = arith.add v202, v332 : i32 #[overflow = unchecked]; + v205 = hir.int_to_ptr v204 : ptr; + v206 = hir.load v205 : felt; + v331 = arith.constant 0 : i32; + v207 = arith.constant 4 : i32; + v208 = arith.add v200, v207 : i32 #[overflow = unchecked]; + v210 = arith.add v208, v331 : i32 #[overflow = unchecked]; + v211 = hir.int_to_ptr v210 : ptr; + v212 = hir.load v211 : felt; + v330 = arith.constant 0 : i32; + v213 = arith.constant 8 : i32; + v214 = arith.add v200, v213 : i32 #[overflow = unchecked]; + v216 = arith.add v214, v330 : i32 #[overflow = unchecked]; + v217 = hir.int_to_ptr v216 : ptr; + v218 = hir.load v217 : felt; + v329 = arith.constant 0 : i32; + v219 = arith.constant 12 : i32; + v220 = arith.add v200, v219 : i32 #[overflow = unchecked]; + v222 = arith.add v220, v329 : i32 #[overflow = unchecked]; + v223 = hir.int_to_ptr v222 : ptr; + v224 = hir.load v223 : felt; + builtin.ret v206, v212, v218, v224; + }; +}; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_get_vault_root_binding.masm b/tests/integration/expected/rust_sdk/rust_sdk_account_get_vault_root_binding.masm new file mode 100644 index 000000000..7cbc07bab --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_get_vault_root_binding.masm @@ -0,0 +1,698 @@ +# mod miden:rust-sdk-account-get-vault-root-binding/rust-sdk-account-get-vault-root-binding@0.0.1 + +@callconv("canon-lift") +pub proc binding( + +) -> (felt, felt, felt, felt) + exec.::miden:rust-sdk-account-get-vault-root-binding/rust-sdk-account-get-vault-root-binding@0.0.1::init + trace.240 + nop + exec.::miden:rust-sdk-account-get-vault-root-binding/rust-sdk-account-get-vault-root-binding@0.0.1::rust_sdk_account_get_vault_root_binding::miden:rust-sdk-account-get-vault-root-binding/rust-sdk-account-get-vault-root-binding@0.0.1#binding + trace.252 + nop + push.0 + u32wrapping_add + push.0 + push.0 + dup.2 + u32wrapping_add + u32wrapping_add + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.0 + push.4 + dup.3 + u32wrapping_add + u32wrapping_add + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.0 + push.8 + dup.4 + u32wrapping_add + u32wrapping_add + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.0 + push.12 + movup.5 + u32wrapping_add + u32wrapping_add + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + movdn.3 + swap.2 + exec.::std::sys::truncate_stack +end + +proc init + push.1179648 + trace.240 + exec.::intrinsics::mem::heap_init + trace.252 + push.[7028007876379170725,18060021366771303825,13412364500725888848,14178532912296021363] + adv.push_mapval + push.262144 + push.1 + trace.240 + exec.::std::mem::pipe_preimage_to_memory + trace.252 + drop + push.1048576 + u32assert + mem_store.278536 + push.0 + u32assert + mem_store.278537 +end + +# mod miden:rust-sdk-account-get-vault-root-binding/rust-sdk-account-get-vault-root-binding@0.0.1::rust_sdk_account_get_vault_root_binding + +@callconv("C") +proc __wasm_call_ctors( + +) + nop +end + +@callconv("C") +proc rust_sdk_account_get_vault_root_binding::bindings::__link_custom_section_describing_imports( + +) + nop +end + +@callconv("C") +proc miden:rust-sdk-account-get-vault-root-binding/rust-sdk-account-get-vault-root-binding@0.0.1#binding( + +) -> i32 + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.48 + u32wrapping_sub + push.1114144 + dup.1 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + trace.240 + nop + exec.::miden:rust-sdk-account-get-vault-root-binding/rust-sdk-account-get-vault-root-binding@0.0.1::rust_sdk_account_get_vault_root_binding::wit_bindgen::rt::run_ctors_once + trace.252 + nop + push.16 + dup.1 + u32wrapping_add + trace.240 + nop + exec.::miden:rust-sdk-account-get-vault-root-binding/rust-sdk-account-get-vault-root-binding@0.0.1::rust_sdk_account_get_vault_root_binding::miden::active_account::get_vault_root + trace.252 + nop + push.24 + dup.1 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.40 + dup.3 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.16 + dup.1 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.32 + dup.3 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.1114148 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.32 + dup.2 + u32wrapping_add + dup.2 + trace.240 + nop + exec.::miden:rust-sdk-account-get-vault-root-binding/rust-sdk-account-get-vault-root-binding@0.0.1::rust_sdk_account_get_vault_root_binding::miden_stdlib_sys::intrinsics::word::Word::reverse + trace.252 + nop + push.1048584 + u32wrapping_add + push.8 + dup.2 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.8 + dup.3 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + dup.1 + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + dup.2 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.48 + movup.2 + u32wrapping_add + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop +end + +@callconv("C") +proc wit_bindgen::rt::run_ctors_once( + +) + push.1114148 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.1048600 + u32wrapping_add + u32divmod.4 + swap.1 + swap.1 + dup.1 + mem_load + swap.1 + push.8 + u32wrapping_mul + u32shr + swap.1 + drop + push.255 + u32and + push.0 + swap.1 + neq + if.true + nop + else + push.1114148 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + trace.240 + nop + exec.::miden:rust-sdk-account-get-vault-root-binding/rust-sdk-account-get-vault-root-binding@0.0.1::rust_sdk_account_get_vault_root_binding::__wasm_call_ctors + trace.252 + nop + push.1 + push.1048600 + movup.2 + u32wrapping_add + u32divmod.4 + swap.1 + dup.0 + mem_load + dup.2 + push.8 + u32wrapping_mul + push.255 + swap.1 + u32shl + u32not + swap.1 + u32and + movup.3 + movup.3 + push.8 + u32wrapping_mul + u32shl + u32or + swap.1 + mem_store + end +end + +@callconv("C") +proc miden_stdlib_sys::intrinsics::word::Word::reverse( + i32, + i32 +) + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.16 + u32wrapping_sub + push.8 + dup.3 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.8 + dup.3 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + movup.2 + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + dup.2 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.12 + dup.1 + u32wrapping_add + push.0 + movup.2 + swap.1 + push.1 + while.true + push.0 + push.8 + dup.2 + eq + neq + dup.0 + if.true + movup.3 + movup.2 + drop + drop + push.3735929054 + dup.0 + else + dup.2 + dup.2 + u32wrapping_add + dup.0 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + dup.5 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + movup.2 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + dup.4 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.4294967292 + movup.4 + u32wrapping_add + push.4 + movup.3 + u32wrapping_add + end + push.3735929054 + dup.3 + dup.6 + swap.2 + swap.1 + cdrop + push.3735929054 + dup.4 + dup.6 + swap.2 + swap.1 + cdrop + push.1 + push.0 + movup.6 + cdrop + push.1 + u32and + swap.1 + swap.2 + swap.4 + swap.3 + swap.1 + if.true + movup.4 + drop + movup.4 + drop + push.1 + else + push.0 + end + end + drop + drop + drop + drop + push.8 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.8 + dup.4 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + movup.2 + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop +end + +@callconv("C") +proc miden::active_account::get_vault_root(i32) + trace.240 + nop + exec.::miden::active_account::get_vault_root + trace.252 + nop + movup.4 + dup.0 + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.4 + dup.1 + add + u32assert + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.8 + dup.1 + add + u32assert + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.12 + add + u32assert + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop +end + diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_get_vault_root_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_account_get_vault_root_binding.wat new file mode 100644 index 000000000..a557b6123 --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_get_vault_root_binding.wat @@ -0,0 +1,181 @@ +(component + (type (;0;) + (instance + (type (;0;) (record (field "inner" f32))) + (export (;1;) "felt" (type (eq 0))) + (type (;2;) (tuple 1 1 1 1)) + (type (;3;) (record (field "inner" 2))) + (export (;4;) "word" (type (eq 3))) + ) + ) + (import "miden:base/core-types@1.0.0" (instance (;0;) (type 0))) + (core module (;0;) + (type (;0;) (func)) + (type (;1;) (func (result i32))) + (type (;2;) (func (param i32 i32))) + (type (;3;) (func (param i32))) + (table (;0;) 2 2 funcref) + (memory (;0;) 17) + (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) + (global $GOT.data.internal.__memory_base (;1;) i32 i32.const 0) + (export "memory" (memory 0)) + (export "miden:rust-sdk-account-get-vault-root-binding/rust-sdk-account-get-vault-root-binding@0.0.1#binding" (func $miden:rust-sdk-account-get-vault-root-binding/rust-sdk-account-get-vault-root-binding@0.0.1#binding)) + (elem (;0;) (i32.const 1) func $rust_sdk_account_get_vault_root_binding::bindings::__link_custom_section_describing_imports) + (func $__wasm_call_ctors (;0;) (type 0)) + (func $rust_sdk_account_get_vault_root_binding::bindings::__link_custom_section_describing_imports (;1;) (type 0)) + (func $miden:rust-sdk-account-get-vault-root-binding/rust-sdk-account-get-vault-root-binding@0.0.1#binding (;2;) (type 1) (result i32) + (local i32 i32) + global.get $__stack_pointer + i32.const 48 + i32.sub + local.tee 0 + global.set $__stack_pointer + call $wit_bindgen::rt::run_ctors_once + local.get 0 + i32.const 16 + i32.add + call $miden::active_account::get_vault_root + local.get 0 + local.get 0 + i64.load offset=24 + i64.store offset=40 + local.get 0 + local.get 0 + i64.load offset=16 + i64.store offset=32 + global.get $GOT.data.internal.__memory_base + local.set 1 + local.get 0 + local.get 0 + i32.const 32 + i32.add + call $miden_stdlib_sys::intrinsics::word::Word::reverse + local.get 1 + i32.const 1048584 + i32.add + local.tee 1 + local.get 0 + i64.load offset=8 + i64.store offset=8 align=4 + local.get 1 + local.get 0 + i64.load + i64.store align=4 + local.get 0 + i32.const 48 + i32.add + global.set $__stack_pointer + local.get 1 + ) + (func $wit_bindgen::rt::run_ctors_once (;3;) (type 0) + (local i32) + block ;; label = @1 + global.get $GOT.data.internal.__memory_base + i32.const 1048600 + i32.add + i32.load8_u + br_if 0 (;@1;) + global.get $GOT.data.internal.__memory_base + local.set 0 + call $__wasm_call_ctors + local.get 0 + i32.const 1048600 + i32.add + i32.const 1 + i32.store8 + end + ) + (func $miden_stdlib_sys::intrinsics::word::Word::reverse (;4;) (type 2) (param i32 i32) + (local i32 i32 i32 f32) + global.get $__stack_pointer + i32.const 16 + i32.sub + local.tee 2 + local.get 1 + i64.load offset=8 + i64.store offset=8 align=4 + local.get 2 + local.get 1 + i64.load + i64.store align=4 + local.get 2 + i32.const 12 + i32.add + local.set 3 + i32.const 0 + local.set 1 + block ;; label = @1 + loop ;; label = @2 + local.get 1 + i32.const 8 + i32.eq + br_if 1 (;@1;) + local.get 2 + local.get 1 + i32.add + local.tee 4 + f32.load + local.set 5 + local.get 4 + local.get 3 + i32.load + i32.store + local.get 3 + local.get 5 + f32.store + local.get 1 + i32.const 4 + i32.add + local.set 1 + local.get 3 + i32.const -4 + i32.add + local.set 3 + br 0 (;@2;) + end + end + local.get 0 + local.get 2 + i64.load offset=8 align=4 + i64.store offset=8 + local.get 0 + local.get 2 + i64.load align=4 + i64.store + ) + (func $miden::active_account::get_vault_root (;5;) (type 3) (param i32) + unreachable + ) + (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") + (@custom "rodata,miden_account" (after data) "Orust_sdk_account_get_vault_root_binding\01\0b0.0.1\03\01\01\00\00\00\00\00\00\00\00\00\00\00\00\00\00") + ) + (alias export 0 "word" (type (;1;))) + (core instance (;0;) (instantiate 0)) + (alias core export 0 "memory" (core memory (;0;))) + (type (;2;) (func (result 1))) + (alias core export 0 "miden:rust-sdk-account-get-vault-root-binding/rust-sdk-account-get-vault-root-binding@0.0.1#binding" (core func (;0;))) + (func (;0;) (type 2) (canon lift (core func 0) (memory 0))) + (alias export 0 "felt" (type (;3;))) + (alias export 0 "word" (type (;4;))) + (component (;0;) + (type (;0;) (record (field "inner" f32))) + (import "import-type-felt" (type (;1;) (eq 0))) + (type (;2;) (tuple 1 1 1 1)) + (type (;3;) (record (field "inner" 2))) + (import "import-type-word" (type (;4;) (eq 3))) + (import "import-type-word0" (type (;5;) (eq 4))) + (type (;6;) (func (result 5))) + (import "import-func-binding" (func (;0;) (type 6))) + (export (;7;) "word" (type 4)) + (type (;8;) (func (result 7))) + (export (;1;) "binding" (func 0) (func (type 8))) + ) + (instance (;1;) (instantiate 0 + (with "import-func-binding" (func 0)) + (with "import-type-felt" (type 3)) + (with "import-type-word" (type 4)) + (with "import-type-word0" (type 1)) + ) + ) + (export (;2;) "miden:rust-sdk-account-get-vault-root-binding/rust-sdk-account-get-vault-root-binding@0.0.1" (instance 1)) +) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_has_non_fungible_asset_binding.hir b/tests/integration/expected/rust_sdk/rust_sdk_account_has_non_fungible_asset_binding.hir new file mode 100644 index 000000000..06305f989 --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_has_non_fungible_asset_binding.hir @@ -0,0 +1,219 @@ +builtin.component miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has-non-fungible-asset-binding@0.0.1 { + builtin.module public @rust_sdk_account_has_non_fungible_asset_binding { + private builtin.function @__wasm_call_ctors() { + ^block5: + builtin.ret ; + }; + + private builtin.function @rust_sdk_account_has_non_fungible_asset_binding::bindings::__link_custom_section_describing_imports() { + ^block7: + builtin.ret ; + }; + + private builtin.function @miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has-non-fungible-asset-binding@0.0.1#binding() -> felt { + ^block9: + v3 = builtin.global_symbol @miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has-non-fungible-asset-binding@0.0.1/rust_sdk_account_has_non_fungible_asset_binding/__stack_pointer : ptr + v4 = hir.bitcast v3 : ptr; + v5 = hir.load v4 : i32; + v6 = arith.constant 32 : i32; + v7 = arith.sub v5, v6 : i32 #[overflow = wrapping]; + v8 = builtin.global_symbol @miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has-non-fungible-asset-binding@0.0.1/rust_sdk_account_has_non_fungible_asset_binding/__stack_pointer : ptr + v9 = hir.bitcast v8 : ptr; + hir.store v9, v7; + hir.exec @miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has-non-fungible-asset-binding@0.0.1/rust_sdk_account_has_non_fungible_asset_binding/wit_bindgen::rt::run_ctors_once() + v1 = arith.constant 0 : i32; + v12 = hir.exec @miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has-non-fungible-asset-binding@0.0.1/rust_sdk_account_has_non_fungible_asset_binding/intrinsics::felt::from_u32(v1) : felt + v198 = arith.constant 0 : i32; + v176, v177, v178, v179 = scf.while v198, v7, v12 : i32, i32, felt, i32 { + ^block38(v180: i32, v181: i32, v182: felt): + v197 = arith.constant 0 : i32; + v31 = arith.constant 16 : i32; + v15 = arith.eq v180, v31 : i1; + v16 = arith.zext v15 : u32; + v17 = hir.bitcast v16 : i32; + v19 = arith.neq v17, v197 : i1; + v171 = scf.if v19 : i32 { + ^block37: + v142 = ub.poison i32 : i32; + scf.yield v142; + } else { + ^block14: + v196 = arith.constant 16 : i32; + v22 = arith.add v181, v196 : i32 #[overflow = wrapping]; + v23 = arith.add v22, v180 : i32 #[overflow = wrapping]; + v25 = hir.bitcast v23 : u32; + v36 = arith.constant 4 : u32; + v27 = arith.mod v25, v36 : u32; + hir.assertz v27 #[code = 250]; + v28 = hir.int_to_ptr v25 : ptr; + hir.store v28, v182; + v29 = arith.constant 4 : i32; + v30 = arith.add v180, v29 : i32 #[overflow = wrapping]; + scf.yield v30; + }; + v143 = ub.poison felt : felt; + v173 = cf.select v19, v143, v182 : felt; + v195 = ub.poison i32 : i32; + v172 = cf.select v19, v195, v181 : i32; + v141 = arith.constant 1 : u32; + v135 = arith.constant 0 : u32; + v175 = cf.select v19, v135, v141 : u32; + v165 = arith.trunc v175 : i1; + scf.condition v165, v171, v172, v173, v181; + } do { + ^block39(v183: i32, v184: i32, v185: felt, v186: i32): + scf.yield v183, v184, v185; + }; + v194 = arith.constant 16 : i32; + v32 = arith.add v179, v194 : i32 #[overflow = wrapping]; + hir.exec @miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has-non-fungible-asset-binding@0.0.1/rust_sdk_account_has_non_fungible_asset_binding/>::from(v179, v32) + v34 = arith.constant 12 : u32; + v33 = hir.bitcast v179 : u32; + v35 = arith.add v33, v34 : u32 #[overflow = checked]; + v193 = arith.constant 4 : u32; + v37 = arith.mod v35, v193 : u32; + hir.assertz v37 #[code = 250]; + v38 = hir.int_to_ptr v35 : ptr; + v39 = hir.load v38 : felt; + v41 = arith.constant 8 : u32; + v40 = hir.bitcast v179 : u32; + v42 = arith.add v40, v41 : u32 #[overflow = checked]; + v192 = arith.constant 4 : u32; + v44 = arith.mod v42, v192 : u32; + hir.assertz v44 #[code = 250]; + v45 = hir.int_to_ptr v42 : ptr; + v46 = hir.load v45 : felt; + v191 = arith.constant 4 : u32; + v47 = hir.bitcast v179 : u32; + v49 = arith.add v47, v191 : u32 #[overflow = checked]; + v190 = arith.constant 4 : u32; + v51 = arith.mod v49, v190 : u32; + hir.assertz v51 #[code = 250]; + v52 = hir.int_to_ptr v49 : ptr; + v53 = hir.load v52 : felt; + v54 = hir.bitcast v179 : u32; + v189 = arith.constant 4 : u32; + v56 = arith.mod v54, v189 : u32; + hir.assertz v56 #[code = 250]; + v57 = hir.int_to_ptr v54 : ptr; + v58 = hir.load v57 : felt; + v59 = hir.exec @miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has-non-fungible-asset-binding@0.0.1/rust_sdk_account_has_non_fungible_asset_binding/miden::active_account::has_non_fungible_asset(v39, v46, v53, v58) : felt + v188 = arith.constant 0 : i32; + v61 = hir.exec @miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has-non-fungible-asset-binding@0.0.1/rust_sdk_account_has_non_fungible_asset_binding/intrinsics::felt::from_u32(v188) : felt + v62 = hir.exec @miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has-non-fungible-asset-binding@0.0.1/rust_sdk_account_has_non_fungible_asset_binding/intrinsics::felt::eq(v59, v61) : i32 + v63 = arith.constant 1 : i32; + v64 = arith.neq v62, v63 : i1; + v65 = arith.zext v64 : u32; + v66 = hir.bitcast v65 : i32; + v67 = hir.exec @miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has-non-fungible-asset-binding@0.0.1/rust_sdk_account_has_non_fungible_asset_binding/intrinsics::felt::from_u32(v66) : felt + v187 = arith.constant 32 : i32; + v69 = arith.add v179, v187 : i32 #[overflow = wrapping]; + v70 = builtin.global_symbol @miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has-non-fungible-asset-binding@0.0.1/rust_sdk_account_has_non_fungible_asset_binding/__stack_pointer : ptr + v71 = hir.bitcast v70 : ptr; + hir.store v71, v69; + builtin.ret v67; + }; + + private builtin.function @wit_bindgen::rt::run_ctors_once() { + ^block15: + v73 = builtin.global_symbol @miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has-non-fungible-asset-binding@0.0.1/rust_sdk_account_has_non_fungible_asset_binding/GOT.data.internal.__memory_base : ptr + v74 = hir.bitcast v73 : ptr; + v75 = hir.load v74 : i32; + v76 = arith.constant 1048584 : i32; + v77 = arith.add v75, v76 : i32 #[overflow = wrapping]; + v78 = hir.bitcast v77 : u32; + v79 = hir.int_to_ptr v78 : ptr; + v80 = hir.load v79 : u8; + v72 = arith.constant 0 : i32; + v81 = arith.zext v80 : u32; + v82 = hir.bitcast v81 : i32; + v84 = arith.neq v82, v72 : i1; + scf.if v84{ + ^block17: + scf.yield ; + } else { + ^block18: + v85 = builtin.global_symbol @miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has-non-fungible-asset-binding@0.0.1/rust_sdk_account_has_non_fungible_asset_binding/GOT.data.internal.__memory_base : ptr + v86 = hir.bitcast v85 : ptr; + v87 = hir.load v86 : i32; + hir.exec @miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has-non-fungible-asset-binding@0.0.1/rust_sdk_account_has_non_fungible_asset_binding/__wasm_call_ctors() + v200 = arith.constant 1 : u8; + v202 = arith.constant 1048584 : i32; + v89 = arith.add v87, v202 : i32 #[overflow = wrapping]; + v93 = hir.bitcast v89 : u32; + v94 = hir.int_to_ptr v93 : ptr; + hir.store v94, v200; + scf.yield ; + }; + builtin.ret ; + }; + + private builtin.function @>::from(v95: i32, v96: i32) { + ^block19(v95: i32, v96: i32): + v98 = arith.constant 8 : u32; + v97 = hir.bitcast v96 : u32; + v99 = arith.add v97, v98 : u32 #[overflow = checked]; + v100 = arith.constant 4 : u32; + v101 = arith.mod v99, v100 : u32; + hir.assertz v101 #[code = 250]; + v102 = hir.int_to_ptr v99 : ptr; + v103 = hir.load v102 : i64; + v206 = arith.constant 8 : u32; + v104 = hir.bitcast v95 : u32; + v106 = arith.add v104, v206 : u32 #[overflow = checked]; + v205 = arith.constant 8 : u32; + v108 = arith.mod v106, v205 : u32; + hir.assertz v108 #[code = 250]; + v109 = hir.int_to_ptr v106 : ptr; + hir.store v109, v103; + v110 = hir.bitcast v96 : u32; + v204 = arith.constant 4 : u32; + v112 = arith.mod v110, v204 : u32; + hir.assertz v112 #[code = 250]; + v113 = hir.int_to_ptr v110 : ptr; + v114 = hir.load v113 : i64; + v115 = hir.bitcast v95 : u32; + v203 = arith.constant 8 : u32; + v117 = arith.mod v115, v203 : u32; + hir.assertz v117 #[code = 250]; + v118 = hir.int_to_ptr v115 : ptr; + hir.store v118, v114; + builtin.ret ; + }; + + private builtin.function @intrinsics::felt::from_u32(v119: i32) -> felt { + ^block21(v119: i32): + v120 = hir.bitcast v119 : felt; + builtin.ret v120; + }; + + private builtin.function @intrinsics::felt::eq(v122: felt, v123: felt) -> i32 { + ^block23(v122: felt, v123: felt): + v124 = arith.eq v122, v123 : i1; + v125 = hir.cast v124 : i32; + builtin.ret v125; + }; + + private builtin.function @miden::active_account::has_non_fungible_asset(v127: felt, v128: felt, v129: felt, v130: felt) -> felt { + ^block25(v127: felt, v128: felt, v129: felt, v130: felt): + v131 = hir.exec @miden/active_account/has_non_fungible_asset(v127, v128, v129, v130) : felt + builtin.ret v131; + }; + + builtin.global_variable private @#__stack_pointer : i32 { + builtin.ret_imm 1048576; + }; + + builtin.global_variable private @#GOT.data.internal.__memory_base : i32 { + builtin.ret_imm 0; + }; + + builtin.segment @1048576 = 0x0000000100000001; + }; + + public builtin.function @binding() -> felt { + ^block29: + v133 = hir.exec @miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has-non-fungible-asset-binding@0.0.1/rust_sdk_account_has_non_fungible_asset_binding/miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has-non-fungible-asset-binding@0.0.1#binding() : felt + builtin.ret v133; + }; +}; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_has_non_fungible_asset_binding.masm b/tests/integration/expected/rust_sdk/rust_sdk_account_has_non_fungible_asset_binding.masm new file mode 100644 index 000000000..4c9ba8089 --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_has_non_fungible_asset_binding.masm @@ -0,0 +1,438 @@ +# mod miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has-non-fungible-asset-binding@0.0.1 + +@callconv("canon-lift") +pub proc binding( + +) -> felt + exec.::miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has-non-fungible-asset-binding@0.0.1::init + trace.240 + nop + exec.::miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has-non-fungible-asset-binding@0.0.1::rust_sdk_account_has_non_fungible_asset_binding::miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has-non-fungible-asset-binding@0.0.1#binding + trace.252 + nop + exec.::std::sys::truncate_stack +end + +proc init + push.1179648 + trace.240 + exec.::intrinsics::mem::heap_init + trace.252 + push.[7028007876379170725,18060021366771303825,13412364500725888848,14178532912296021363] + adv.push_mapval + push.262144 + push.1 + trace.240 + exec.::std::mem::pipe_preimage_to_memory + trace.252 + drop + push.1048576 + u32assert + mem_store.278536 + push.0 + u32assert + mem_store.278537 +end + +# mod miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has-non-fungible-asset-binding@0.0.1::rust_sdk_account_has_non_fungible_asset_binding + +@callconv("C") +proc __wasm_call_ctors( + +) + nop +end + +@callconv("C") +proc rust_sdk_account_has_non_fungible_asset_binding::bindings::__link_custom_section_describing_imports( + +) + nop +end + +@callconv("C") +proc miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has-non-fungible-asset-binding@0.0.1#binding( + +) -> felt + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.32 + u32wrapping_sub + push.1114144 + dup.1 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + trace.240 + nop + exec.::miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has-non-fungible-asset-binding@0.0.1::rust_sdk_account_has_non_fungible_asset_binding::wit_bindgen::rt::run_ctors_once + trace.252 + nop + push.0 + trace.240 + nop + exec.::miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has-non-fungible-asset-binding@0.0.1::rust_sdk_account_has_non_fungible_asset_binding::intrinsics::felt::from_u32 + trace.252 + nop + push.0 + movup.2 + swap.1 + push.1 + while.true + push.0 + push.16 + dup.2 + eq + neq + dup.0 + if.true + swap.1 + drop + push.3735929054 + else + push.16 + dup.3 + u32wrapping_add + dup.2 + u32wrapping_add + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + dup.4 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.4 + movup.2 + u32wrapping_add + end + push.3735929054 + dup.2 + movup.2 + swap.5 + movdn.2 + cdrop + push.3735929054 + dup.2 + dup.4 + swap.2 + swap.1 + cdrop + push.1 + push.0 + movup.4 + cdrop + push.1 + u32and + movup.4 + swap.1 + if.true + movup.3 + drop + push.1 + else + push.0 + end + end + drop + drop + drop + push.16 + dup.1 + u32wrapping_add + dup.1 + trace.240 + nop + exec.::miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has-non-fungible-asset-binding@0.0.1::rust_sdk_account_has_non_fungible_asset_binding::>::from + trace.252 + nop + push.12 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.8 + dup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.4 + dup.3 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + dup.3 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + movdn.3 + swap.2 + trace.240 + nop + exec.::miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has-non-fungible-asset-binding@0.0.1::rust_sdk_account_has_non_fungible_asset_binding::miden::active_account::has_non_fungible_asset + trace.252 + nop + push.0 + trace.240 + nop + exec.::miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has-non-fungible-asset-binding@0.0.1::rust_sdk_account_has_non_fungible_asset_binding::intrinsics::felt::from_u32 + trace.252 + nop + swap.1 + trace.240 + nop + exec.::miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has-non-fungible-asset-binding@0.0.1::rust_sdk_account_has_non_fungible_asset_binding::intrinsics::felt::eq + trace.252 + nop + push.1 + neq + trace.240 + nop + exec.::miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has-non-fungible-asset-binding@0.0.1::rust_sdk_account_has_non_fungible_asset_binding::intrinsics::felt::from_u32 + trace.252 + nop + push.32 + movup.2 + u32wrapping_add + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop +end + +@callconv("C") +proc wit_bindgen::rt::run_ctors_once( + +) + push.1114148 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.1048584 + u32wrapping_add + u32divmod.4 + swap.1 + swap.1 + dup.1 + mem_load + swap.1 + push.8 + u32wrapping_mul + u32shr + swap.1 + drop + push.255 + u32and + push.0 + swap.1 + neq + if.true + nop + else + push.1114148 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + trace.240 + nop + exec.::miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has-non-fungible-asset-binding@0.0.1::rust_sdk_account_has_non_fungible_asset_binding::__wasm_call_ctors + trace.252 + nop + push.1 + push.1048584 + movup.2 + u32wrapping_add + u32divmod.4 + swap.1 + dup.0 + mem_load + dup.2 + push.8 + u32wrapping_mul + push.255 + swap.1 + u32shl + u32not + swap.1 + u32and + movup.3 + movup.3 + push.8 + u32wrapping_mul + u32shl + u32or + swap.1 + mem_store + end +end + +@callconv("C") +proc >::from( + i32, + i32 +) + push.8 + dup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.8 + dup.3 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + swap.1 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + movup.2 + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop +end + +@callconv("C") +proc intrinsics::felt::from_u32(i32) -> felt + nop +end + +@callconv("C") +proc intrinsics::felt::eq(felt, felt) -> i32 + eq +end + +@callconv("C") +proc miden::active_account::has_non_fungible_asset( + felt, + felt, + felt, + felt +) -> felt + trace.240 + nop + exec.::miden::active_account::has_non_fungible_asset + trace.252 + nop +end + diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_has_non_fungible_asset_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_account_has_non_fungible_asset_binding.wat new file mode 100644 index 000000000..cbba63fa3 --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_has_non_fungible_asset_binding.wat @@ -0,0 +1,149 @@ +(component + (type (;0;) + (instance + (type (;0;) (record (field "inner" f32))) + (export (;1;) "felt" (type (eq 0))) + ) + ) + (import "miden:base/core-types@1.0.0" (instance (;0;) (type 0))) + (core module (;0;) + (type (;0;) (func)) + (type (;1;) (func (result f32))) + (type (;2;) (func (param i32 i32))) + (type (;3;) (func (param i32) (result f32))) + (type (;4;) (func (param f32 f32) (result i32))) + (type (;5;) (func (param f32 f32 f32 f32) (result f32))) + (table (;0;) 2 2 funcref) + (memory (;0;) 17) + (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) + (global $GOT.data.internal.__memory_base (;1;) i32 i32.const 0) + (export "memory" (memory 0)) + (export "miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has-non-fungible-asset-binding@0.0.1#binding" (func $miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has-non-fungible-asset-binding@0.0.1#binding)) + (elem (;0;) (i32.const 1) func $rust_sdk_account_has_non_fungible_asset_binding::bindings::__link_custom_section_describing_imports) + (func $__wasm_call_ctors (;0;) (type 0)) + (func $rust_sdk_account_has_non_fungible_asset_binding::bindings::__link_custom_section_describing_imports (;1;) (type 0)) + (func $miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has-non-fungible-asset-binding@0.0.1#binding (;2;) (type 1) (result f32) + (local i32 i32 f32) + global.get $__stack_pointer + i32.const 32 + i32.sub + local.tee 0 + global.set $__stack_pointer + call $wit_bindgen::rt::run_ctors_once + i32.const 0 + local.set 1 + i32.const 0 + call $intrinsics::felt::from_u32 + local.set 2 + block ;; label = @1 + loop ;; label = @2 + local.get 1 + i32.const 16 + i32.eq + br_if 1 (;@1;) + local.get 0 + i32.const 16 + i32.add + local.get 1 + i32.add + local.get 2 + f32.store + local.get 1 + i32.const 4 + i32.add + local.set 1 + br 0 (;@2;) + end + end + local.get 0 + local.get 0 + i32.const 16 + i32.add + call $>::from + local.get 0 + f32.load offset=12 + local.get 0 + f32.load offset=8 + local.get 0 + f32.load offset=4 + local.get 0 + f32.load + call $miden::active_account::has_non_fungible_asset + i32.const 0 + call $intrinsics::felt::from_u32 + call $intrinsics::felt::eq + i32.const 1 + i32.ne + call $intrinsics::felt::from_u32 + local.set 2 + local.get 0 + i32.const 32 + i32.add + global.set $__stack_pointer + local.get 2 + ) + (func $wit_bindgen::rt::run_ctors_once (;3;) (type 0) + (local i32) + block ;; label = @1 + global.get $GOT.data.internal.__memory_base + i32.const 1048584 + i32.add + i32.load8_u + br_if 0 (;@1;) + global.get $GOT.data.internal.__memory_base + local.set 0 + call $__wasm_call_ctors + local.get 0 + i32.const 1048584 + i32.add + i32.const 1 + i32.store8 + end + ) + (func $>::from (;4;) (type 2) (param i32 i32) + local.get 0 + local.get 1 + i64.load offset=8 align=4 + i64.store offset=8 + local.get 0 + local.get 1 + i64.load align=4 + i64.store + ) + (func $intrinsics::felt::from_u32 (;5;) (type 3) (param i32) (result f32) + unreachable + ) + (func $intrinsics::felt::eq (;6;) (type 4) (param f32 f32) (result i32) + unreachable + ) + (func $miden::active_account::has_non_fungible_asset (;7;) (type 5) (param f32 f32 f32 f32) (result f32) + unreachable + ) + (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") + (@custom "rodata,miden_account" (after data) "_rust_sdk_account_has_non_fungible_asset_binding\01\0b0.0.1\03\01\01\00\00\00\00\00\00") + ) + (alias export 0 "felt" (type (;1;))) + (core instance (;0;) (instantiate 0)) + (alias core export 0 "memory" (core memory (;0;))) + (type (;2;) (func (result 1))) + (alias core export 0 "miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has-non-fungible-asset-binding@0.0.1#binding" (core func (;0;))) + (func (;0;) (type 2) (canon lift (core func 0))) + (alias export 0 "felt" (type (;3;))) + (component (;0;) + (type (;0;) (record (field "inner" f32))) + (import "import-type-felt" (type (;1;) (eq 0))) + (import "import-type-felt0" (type (;2;) (eq 1))) + (type (;3;) (func (result 2))) + (import "import-func-binding" (func (;0;) (type 3))) + (export (;4;) "felt" (type 1)) + (type (;5;) (func (result 4))) + (export (;1;) "binding" (func 0) (func (type 5))) + ) + (instance (;1;) (instantiate 0 + (with "import-func-binding" (func 0)) + (with "import-type-felt" (type 3)) + (with "import-type-felt0" (type 1)) + ) + ) + (export (;2;) "miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has-non-fungible-asset-binding@0.0.1" (instance 1)) +) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_has_procedure_binding.hir b/tests/integration/expected/rust_sdk/rust_sdk_account_has_procedure_binding.hir new file mode 100644 index 000000000..6f3e8613f --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_has_procedure_binding.hir @@ -0,0 +1,181 @@ +builtin.component miden:rust-sdk-account-has-procedure-binding/rust-sdk-account-has-procedure-binding@0.0.1 { + builtin.module public @rust_sdk_account_has_procedure_binding { + private builtin.function @__wasm_call_ctors() { + ^block5: + builtin.ret ; + }; + + private builtin.function @rust_sdk_account_has_procedure_binding::bindings::__link_custom_section_describing_imports() { + ^block7: + builtin.ret ; + }; + + private builtin.function @miden:rust-sdk-account-has-procedure-binding/rust-sdk-account-has-procedure-binding@0.0.1#binding() -> felt { + ^block9: + v3 = builtin.global_symbol @miden:rust-sdk-account-has-procedure-binding/rust-sdk-account-has-procedure-binding@0.0.1/rust_sdk_account_has_procedure_binding/__stack_pointer : ptr + v4 = hir.bitcast v3 : ptr; + v5 = hir.load v4 : i32; + v6 = arith.constant 16 : i32; + v7 = arith.sub v5, v6 : i32 #[overflow = wrapping]; + v8 = builtin.global_symbol @miden:rust-sdk-account-has-procedure-binding/rust-sdk-account-has-procedure-binding@0.0.1/rust_sdk_account_has_procedure_binding/__stack_pointer : ptr + v9 = hir.bitcast v8 : ptr; + hir.store v9, v7; + hir.exec @miden:rust-sdk-account-has-procedure-binding/rust-sdk-account-has-procedure-binding@0.0.1/rust_sdk_account_has_procedure_binding/wit_bindgen::rt::run_ctors_once() + v1 = arith.constant 0 : i32; + v12 = hir.exec @miden:rust-sdk-account-has-procedure-binding/rust-sdk-account-has-procedure-binding@0.0.1/rust_sdk_account_has_procedure_binding/intrinsics::felt::from_u32(v1) : felt + v169 = arith.constant 0 : i32; + v148, v149, v150, v151 = scf.while v169, v7, v12 : i32, i32, felt, i32 { + ^block36(v152: i32, v153: i32, v154: felt): + v167 = arith.constant 0 : i32; + v168 = arith.constant 16 : i32; + v15 = arith.eq v152, v168 : i1; + v16 = arith.zext v15 : u32; + v17 = hir.bitcast v16 : i32; + v19 = arith.neq v17, v167 : i1; + v143 = scf.if v19 : i32 { + ^block35: + v114 = ub.poison i32 : i32; + scf.yield v114; + } else { + ^block14: + v21 = arith.add v153, v152 : i32 #[overflow = wrapping]; + v23 = hir.bitcast v21 : u32; + v32 = arith.constant 4 : u32; + v25 = arith.mod v23, v32 : u32; + hir.assertz v25 #[code = 250]; + v26 = hir.int_to_ptr v23 : ptr; + hir.store v26, v154; + v27 = arith.constant 4 : i32; + v28 = arith.add v152, v27 : i32 #[overflow = wrapping]; + scf.yield v28; + }; + v115 = ub.poison felt : felt; + v145 = cf.select v19, v115, v154 : felt; + v166 = ub.poison i32 : i32; + v144 = cf.select v19, v166, v153 : i32; + v113 = arith.constant 1 : u32; + v107 = arith.constant 0 : u32; + v147 = cf.select v19, v107, v113 : u32; + v137 = arith.trunc v147 : i1; + scf.condition v137, v143, v144, v145, v153; + } do { + ^block37(v155: i32, v156: i32, v157: felt, v158: i32): + scf.yield v155, v156, v157; + }; + v30 = arith.constant 12 : u32; + v29 = hir.bitcast v151 : u32; + v31 = arith.add v29, v30 : u32 #[overflow = checked]; + v165 = arith.constant 4 : u32; + v33 = arith.mod v31, v165 : u32; + hir.assertz v33 #[code = 250]; + v34 = hir.int_to_ptr v31 : ptr; + v35 = hir.load v34 : felt; + v37 = arith.constant 8 : u32; + v36 = hir.bitcast v151 : u32; + v38 = arith.add v36, v37 : u32 #[overflow = checked]; + v164 = arith.constant 4 : u32; + v40 = arith.mod v38, v164 : u32; + hir.assertz v40 #[code = 250]; + v41 = hir.int_to_ptr v38 : ptr; + v42 = hir.load v41 : felt; + v163 = arith.constant 4 : u32; + v43 = hir.bitcast v151 : u32; + v45 = arith.add v43, v163 : u32 #[overflow = checked]; + v162 = arith.constant 4 : u32; + v47 = arith.mod v45, v162 : u32; + hir.assertz v47 #[code = 250]; + v48 = hir.int_to_ptr v45 : ptr; + v49 = hir.load v48 : felt; + v50 = hir.bitcast v151 : u32; + v161 = arith.constant 4 : u32; + v52 = arith.mod v50, v161 : u32; + hir.assertz v52 #[code = 250]; + v53 = hir.int_to_ptr v50 : ptr; + v54 = hir.load v53 : felt; + v55 = hir.exec @miden:rust-sdk-account-has-procedure-binding/rust-sdk-account-has-procedure-binding@0.0.1/rust_sdk_account_has_procedure_binding/miden::active_account::has_procedure(v35, v42, v49, v54) : felt + v160 = arith.constant 0 : i32; + v57 = hir.exec @miden:rust-sdk-account-has-procedure-binding/rust-sdk-account-has-procedure-binding@0.0.1/rust_sdk_account_has_procedure_binding/intrinsics::felt::from_u32(v160) : felt + v58 = hir.exec @miden:rust-sdk-account-has-procedure-binding/rust-sdk-account-has-procedure-binding@0.0.1/rust_sdk_account_has_procedure_binding/intrinsics::felt::eq(v55, v57) : i32 + v59 = arith.constant 1 : i32; + v60 = arith.neq v58, v59 : i1; + v61 = arith.zext v60 : u32; + v62 = hir.bitcast v61 : i32; + v63 = hir.exec @miden:rust-sdk-account-has-procedure-binding/rust-sdk-account-has-procedure-binding@0.0.1/rust_sdk_account_has_procedure_binding/intrinsics::felt::from_u32(v62) : felt + v159 = arith.constant 16 : i32; + v65 = arith.add v151, v159 : i32 #[overflow = wrapping]; + v66 = builtin.global_symbol @miden:rust-sdk-account-has-procedure-binding/rust-sdk-account-has-procedure-binding@0.0.1/rust_sdk_account_has_procedure_binding/__stack_pointer : ptr + v67 = hir.bitcast v66 : ptr; + hir.store v67, v65; + builtin.ret v63; + }; + + private builtin.function @wit_bindgen::rt::run_ctors_once() { + ^block15: + v69 = builtin.global_symbol @miden:rust-sdk-account-has-procedure-binding/rust-sdk-account-has-procedure-binding@0.0.1/rust_sdk_account_has_procedure_binding/GOT.data.internal.__memory_base : ptr + v70 = hir.bitcast v69 : ptr; + v71 = hir.load v70 : i32; + v72 = arith.constant 1048584 : i32; + v73 = arith.add v71, v72 : i32 #[overflow = wrapping]; + v74 = hir.bitcast v73 : u32; + v75 = hir.int_to_ptr v74 : ptr; + v76 = hir.load v75 : u8; + v68 = arith.constant 0 : i32; + v77 = arith.zext v76 : u32; + v78 = hir.bitcast v77 : i32; + v80 = arith.neq v78, v68 : i1; + scf.if v80{ + ^block17: + scf.yield ; + } else { + ^block18: + v81 = builtin.global_symbol @miden:rust-sdk-account-has-procedure-binding/rust-sdk-account-has-procedure-binding@0.0.1/rust_sdk_account_has_procedure_binding/GOT.data.internal.__memory_base : ptr + v82 = hir.bitcast v81 : ptr; + v83 = hir.load v82 : i32; + hir.exec @miden:rust-sdk-account-has-procedure-binding/rust-sdk-account-has-procedure-binding@0.0.1/rust_sdk_account_has_procedure_binding/__wasm_call_ctors() + v171 = arith.constant 1 : u8; + v173 = arith.constant 1048584 : i32; + v85 = arith.add v83, v173 : i32 #[overflow = wrapping]; + v89 = hir.bitcast v85 : u32; + v90 = hir.int_to_ptr v89 : ptr; + hir.store v90, v171; + scf.yield ; + }; + builtin.ret ; + }; + + private builtin.function @intrinsics::felt::from_u32(v91: i32) -> felt { + ^block19(v91: i32): + v92 = hir.bitcast v91 : felt; + builtin.ret v92; + }; + + private builtin.function @intrinsics::felt::eq(v94: felt, v95: felt) -> i32 { + ^block21(v94: felt, v95: felt): + v96 = arith.eq v94, v95 : i1; + v97 = hir.cast v96 : i32; + builtin.ret v97; + }; + + private builtin.function @miden::active_account::has_procedure(v99: felt, v100: felt, v101: felt, v102: felt) -> felt { + ^block23(v99: felt, v100: felt, v101: felt, v102: felt): + v103 = hir.exec @miden/active_account/has_procedure(v99, v100, v101, v102) : felt + builtin.ret v103; + }; + + builtin.global_variable private @#__stack_pointer : i32 { + builtin.ret_imm 1048576; + }; + + builtin.global_variable private @#GOT.data.internal.__memory_base : i32 { + builtin.ret_imm 0; + }; + + builtin.segment @1048576 = 0x0000000100000001; + }; + + public builtin.function @binding() -> felt { + ^block27: + v105 = hir.exec @miden:rust-sdk-account-has-procedure-binding/rust-sdk-account-has-procedure-binding@0.0.1/rust_sdk_account_has_procedure_binding/miden:rust-sdk-account-has-procedure-binding/rust-sdk-account-has-procedure-binding@0.0.1#binding() : felt + builtin.ret v105; + }; +}; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_has_procedure_binding.masm b/tests/integration/expected/rust_sdk/rust_sdk_account_has_procedure_binding.masm new file mode 100644 index 000000000..1e1346464 --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_has_procedure_binding.masm @@ -0,0 +1,353 @@ +# mod miden:rust-sdk-account-has-procedure-binding/rust-sdk-account-has-procedure-binding@0.0.1 + +@callconv("canon-lift") +pub proc binding( + +) -> felt + exec.::miden:rust-sdk-account-has-procedure-binding/rust-sdk-account-has-procedure-binding@0.0.1::init + trace.240 + nop + exec.::miden:rust-sdk-account-has-procedure-binding/rust-sdk-account-has-procedure-binding@0.0.1::rust_sdk_account_has_procedure_binding::miden:rust-sdk-account-has-procedure-binding/rust-sdk-account-has-procedure-binding@0.0.1#binding + trace.252 + nop + exec.::std::sys::truncate_stack +end + +proc init + push.1179648 + trace.240 + exec.::intrinsics::mem::heap_init + trace.252 + push.[7028007876379170725,18060021366771303825,13412364500725888848,14178532912296021363] + adv.push_mapval + push.262144 + push.1 + trace.240 + exec.::std::mem::pipe_preimage_to_memory + trace.252 + drop + push.1048576 + u32assert + mem_store.278536 + push.0 + u32assert + mem_store.278537 +end + +# mod miden:rust-sdk-account-has-procedure-binding/rust-sdk-account-has-procedure-binding@0.0.1::rust_sdk_account_has_procedure_binding + +@callconv("C") +proc __wasm_call_ctors( + +) + nop +end + +@callconv("C") +proc rust_sdk_account_has_procedure_binding::bindings::__link_custom_section_describing_imports( + +) + nop +end + +@callconv("C") +proc miden:rust-sdk-account-has-procedure-binding/rust-sdk-account-has-procedure-binding@0.0.1#binding( + +) -> felt + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.16 + u32wrapping_sub + push.1114144 + dup.1 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + trace.240 + nop + exec.::miden:rust-sdk-account-has-procedure-binding/rust-sdk-account-has-procedure-binding@0.0.1::rust_sdk_account_has_procedure_binding::wit_bindgen::rt::run_ctors_once + trace.252 + nop + push.0 + trace.240 + nop + exec.::miden:rust-sdk-account-has-procedure-binding/rust-sdk-account-has-procedure-binding@0.0.1::rust_sdk_account_has_procedure_binding::intrinsics::felt::from_u32 + trace.252 + nop + push.0 + movup.2 + swap.1 + push.1 + while.true + push.0 + push.16 + dup.2 + eq + neq + dup.0 + if.true + swap.1 + drop + push.3735929054 + else + dup.2 + dup.2 + u32wrapping_add + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + dup.4 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.4 + movup.2 + u32wrapping_add + end + push.3735929054 + dup.2 + movup.2 + swap.5 + movdn.2 + cdrop + push.3735929054 + dup.2 + dup.4 + swap.2 + swap.1 + cdrop + push.1 + push.0 + movup.4 + cdrop + push.1 + u32and + movup.4 + swap.1 + if.true + movup.3 + drop + push.1 + else + push.0 + end + end + drop + drop + drop + push.12 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.8 + dup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.4 + dup.3 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + dup.3 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + movdn.3 + swap.2 + trace.240 + nop + exec.::miden:rust-sdk-account-has-procedure-binding/rust-sdk-account-has-procedure-binding@0.0.1::rust_sdk_account_has_procedure_binding::miden::active_account::has_procedure + trace.252 + nop + push.0 + trace.240 + nop + exec.::miden:rust-sdk-account-has-procedure-binding/rust-sdk-account-has-procedure-binding@0.0.1::rust_sdk_account_has_procedure_binding::intrinsics::felt::from_u32 + trace.252 + nop + swap.1 + trace.240 + nop + exec.::miden:rust-sdk-account-has-procedure-binding/rust-sdk-account-has-procedure-binding@0.0.1::rust_sdk_account_has_procedure_binding::intrinsics::felt::eq + trace.252 + nop + push.1 + neq + trace.240 + nop + exec.::miden:rust-sdk-account-has-procedure-binding/rust-sdk-account-has-procedure-binding@0.0.1::rust_sdk_account_has_procedure_binding::intrinsics::felt::from_u32 + trace.252 + nop + push.16 + movup.2 + u32wrapping_add + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop +end + +@callconv("C") +proc wit_bindgen::rt::run_ctors_once( + +) + push.1114148 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.1048584 + u32wrapping_add + u32divmod.4 + swap.1 + swap.1 + dup.1 + mem_load + swap.1 + push.8 + u32wrapping_mul + u32shr + swap.1 + drop + push.255 + u32and + push.0 + swap.1 + neq + if.true + nop + else + push.1114148 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + trace.240 + nop + exec.::miden:rust-sdk-account-has-procedure-binding/rust-sdk-account-has-procedure-binding@0.0.1::rust_sdk_account_has_procedure_binding::__wasm_call_ctors + trace.252 + nop + push.1 + push.1048584 + movup.2 + u32wrapping_add + u32divmod.4 + swap.1 + dup.0 + mem_load + dup.2 + push.8 + u32wrapping_mul + push.255 + swap.1 + u32shl + u32not + swap.1 + u32and + movup.3 + movup.3 + push.8 + u32wrapping_mul + u32shl + u32or + swap.1 + mem_store + end +end + +@callconv("C") +proc intrinsics::felt::from_u32(i32) -> felt + nop +end + +@callconv("C") +proc intrinsics::felt::eq(felt, felt) -> i32 + eq +end + +@callconv("C") +proc miden::active_account::has_procedure(felt, felt, felt, felt) -> felt + trace.240 + nop + exec.::miden::active_account::has_procedure + trace.252 + nop +end + diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_has_procedure_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_account_has_procedure_binding.wat new file mode 100644 index 000000000..26123d468 --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_has_procedure_binding.wat @@ -0,0 +1,131 @@ +(component + (type (;0;) + (instance + (type (;0;) (record (field "inner" f32))) + (export (;1;) "felt" (type (eq 0))) + ) + ) + (import "miden:base/core-types@1.0.0" (instance (;0;) (type 0))) + (core module (;0;) + (type (;0;) (func)) + (type (;1;) (func (result f32))) + (type (;2;) (func (param i32) (result f32))) + (type (;3;) (func (param f32 f32) (result i32))) + (type (;4;) (func (param f32 f32 f32 f32) (result f32))) + (table (;0;) 2 2 funcref) + (memory (;0;) 17) + (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) + (global $GOT.data.internal.__memory_base (;1;) i32 i32.const 0) + (export "memory" (memory 0)) + (export "miden:rust-sdk-account-has-procedure-binding/rust-sdk-account-has-procedure-binding@0.0.1#binding" (func $miden:rust-sdk-account-has-procedure-binding/rust-sdk-account-has-procedure-binding@0.0.1#binding)) + (elem (;0;) (i32.const 1) func $rust_sdk_account_has_procedure_binding::bindings::__link_custom_section_describing_imports) + (func $__wasm_call_ctors (;0;) (type 0)) + (func $rust_sdk_account_has_procedure_binding::bindings::__link_custom_section_describing_imports (;1;) (type 0)) + (func $miden:rust-sdk-account-has-procedure-binding/rust-sdk-account-has-procedure-binding@0.0.1#binding (;2;) (type 1) (result f32) + (local i32 i32 f32) + global.get $__stack_pointer + i32.const 16 + i32.sub + local.tee 0 + global.set $__stack_pointer + call $wit_bindgen::rt::run_ctors_once + i32.const 0 + local.set 1 + i32.const 0 + call $intrinsics::felt::from_u32 + local.set 2 + block ;; label = @1 + loop ;; label = @2 + local.get 1 + i32.const 16 + i32.eq + br_if 1 (;@1;) + local.get 0 + local.get 1 + i32.add + local.get 2 + f32.store + local.get 1 + i32.const 4 + i32.add + local.set 1 + br 0 (;@2;) + end + end + local.get 0 + f32.load offset=12 + local.get 0 + f32.load offset=8 + local.get 0 + f32.load offset=4 + local.get 0 + f32.load + call $miden::active_account::has_procedure + i32.const 0 + call $intrinsics::felt::from_u32 + call $intrinsics::felt::eq + i32.const 1 + i32.ne + call $intrinsics::felt::from_u32 + local.set 2 + local.get 0 + i32.const 16 + i32.add + global.set $__stack_pointer + local.get 2 + ) + (func $wit_bindgen::rt::run_ctors_once (;3;) (type 0) + (local i32) + block ;; label = @1 + global.get $GOT.data.internal.__memory_base + i32.const 1048584 + i32.add + i32.load8_u + br_if 0 (;@1;) + global.get $GOT.data.internal.__memory_base + local.set 0 + call $__wasm_call_ctors + local.get 0 + i32.const 1048584 + i32.add + i32.const 1 + i32.store8 + end + ) + (func $intrinsics::felt::from_u32 (;4;) (type 2) (param i32) (result f32) + unreachable + ) + (func $intrinsics::felt::eq (;5;) (type 3) (param f32 f32) (result i32) + unreachable + ) + (func $miden::active_account::has_procedure (;6;) (type 4) (param f32 f32 f32 f32) (result f32) + unreachable + ) + (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") + (@custom "rodata,miden_account" (after data) "Mrust_sdk_account_has_procedure_binding\01\0b0.0.1\03\01\01\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00") + ) + (alias export 0 "felt" (type (;1;))) + (core instance (;0;) (instantiate 0)) + (alias core export 0 "memory" (core memory (;0;))) + (type (;2;) (func (result 1))) + (alias core export 0 "miden:rust-sdk-account-has-procedure-binding/rust-sdk-account-has-procedure-binding@0.0.1#binding" (core func (;0;))) + (func (;0;) (type 2) (canon lift (core func 0))) + (alias export 0 "felt" (type (;3;))) + (component (;0;) + (type (;0;) (record (field "inner" f32))) + (import "import-type-felt" (type (;1;) (eq 0))) + (import "import-type-felt0" (type (;2;) (eq 1))) + (type (;3;) (func (result 2))) + (import "import-func-binding" (func (;0;) (type 3))) + (export (;4;) "felt" (type 1)) + (type (;5;) (func (result 4))) + (export (;1;) "binding" (func 0) (func (type 5))) + ) + (instance (;1;) (instantiate 0 + (with "import-func-binding" (func 0)) + (with "import-type-felt" (type 3)) + (with "import-type-felt0" (type 1)) + ) + ) + (export (;2;) "miden:rust-sdk-account-has-procedure-binding/rust-sdk-account-has-procedure-binding@0.0.1" (instance 1)) +) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_storage_get_initial_item_binding.hir b/tests/integration/expected/rust_sdk/rust_sdk_account_storage_get_initial_item_binding.hir new file mode 100644 index 000000000..c8b5b829e --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_storage_get_initial_item_binding.hir @@ -0,0 +1,337 @@ +builtin.component miden:rust-sdk-account-storage-get-initial-item-binding/rust-sdk-account-storage-get-initial-item-binding@0.0.1 { + builtin.module public @rust_sdk_account_storage_get_initial_item_binding { + private builtin.function @__wasm_call_ctors() { + ^block5: + builtin.ret ; + }; + + private builtin.function @rust_sdk_account_storage_get_initial_item_binding::bindings::__link_custom_section_describing_imports() { + ^block7: + builtin.ret ; + }; + + private builtin.function @miden:rust-sdk-account-storage-get-initial-item-binding/rust-sdk-account-storage-get-initial-item-binding@0.0.1#binding() -> i32 { + ^block9: + v2 = builtin.global_symbol @miden:rust-sdk-account-storage-get-initial-item-binding/rust-sdk-account-storage-get-initial-item-binding@0.0.1/rust_sdk_account_storage_get_initial_item_binding/__stack_pointer : ptr + v3 = hir.bitcast v2 : ptr; + v4 = hir.load v3 : i32; + v5 = arith.constant 48 : i32; + v6 = arith.sub v4, v5 : i32 #[overflow = wrapping]; + v7 = builtin.global_symbol @miden:rust-sdk-account-storage-get-initial-item-binding/rust-sdk-account-storage-get-initial-item-binding@0.0.1/rust_sdk_account_storage_get_initial_item_binding/__stack_pointer : ptr + v8 = hir.bitcast v7 : ptr; + hir.store v8, v6; + hir.exec @miden:rust-sdk-account-storage-get-initial-item-binding/rust-sdk-account-storage-get-initial-item-binding@0.0.1/rust_sdk_account_storage_get_initial_item_binding/wit_bindgen::rt::run_ctors_once() + v1 = arith.constant 0 : i32; + v10 = hir.exec @miden:rust-sdk-account-storage-get-initial-item-binding/rust-sdk-account-storage-get-initial-item-binding@0.0.1/rust_sdk_account_storage_get_initial_item_binding/>::from(v1) : felt + v11 = arith.constant 16 : i32; + v12 = arith.add v6, v11 : i32 #[overflow = wrapping]; + hir.exec @miden:rust-sdk-account-storage-get-initial-item-binding/rust-sdk-account-storage-get-initial-item-binding@0.0.1/rust_sdk_account_storage_get_initial_item_binding/miden::active_account::get_initial_item(v10, v12) + v14 = arith.constant 24 : u32; + v13 = hir.bitcast v6 : u32; + v15 = arith.add v13, v14 : u32 #[overflow = checked]; + v16 = arith.constant 8 : u32; + v17 = arith.mod v15, v16 : u32; + hir.assertz v17 #[code = 250]; + v18 = hir.int_to_ptr v15 : ptr; + v19 = hir.load v18 : i64; + v21 = arith.constant 40 : u32; + v20 = hir.bitcast v6 : u32; + v22 = arith.add v20, v21 : u32 #[overflow = checked]; + v245 = arith.constant 8 : u32; + v24 = arith.mod v22, v245 : u32; + hir.assertz v24 #[code = 250]; + v25 = hir.int_to_ptr v22 : ptr; + hir.store v25, v19; + v27 = arith.constant 16 : u32; + v26 = hir.bitcast v6 : u32; + v28 = arith.add v26, v27 : u32 #[overflow = checked]; + v244 = arith.constant 8 : u32; + v30 = arith.mod v28, v244 : u32; + hir.assertz v30 #[code = 250]; + v31 = hir.int_to_ptr v28 : ptr; + v32 = hir.load v31 : i64; + v34 = arith.constant 32 : u32; + v33 = hir.bitcast v6 : u32; + v35 = arith.add v33, v34 : u32 #[overflow = checked]; + v243 = arith.constant 8 : u32; + v37 = arith.mod v35, v243 : u32; + hir.assertz v37 #[code = 250]; + v38 = hir.int_to_ptr v35 : ptr; + hir.store v38, v32; + v39 = builtin.global_symbol @miden:rust-sdk-account-storage-get-initial-item-binding/rust-sdk-account-storage-get-initial-item-binding@0.0.1/rust_sdk_account_storage_get_initial_item_binding/GOT.data.internal.__memory_base : ptr + v40 = hir.bitcast v39 : ptr; + v41 = hir.load v40 : i32; + v42 = arith.constant 32 : i32; + v43 = arith.add v6, v42 : i32 #[overflow = wrapping]; + hir.exec @miden:rust-sdk-account-storage-get-initial-item-binding/rust-sdk-account-storage-get-initial-item-binding@0.0.1/rust_sdk_account_storage_get_initial_item_binding/miden_stdlib_sys::intrinsics::word::Word::reverse(v6, v43) + v44 = arith.constant 1048584 : i32; + v45 = arith.add v41, v44 : i32 #[overflow = wrapping]; + v242 = arith.constant 8 : u32; + v46 = hir.bitcast v6 : u32; + v48 = arith.add v46, v242 : u32 #[overflow = checked]; + v241 = arith.constant 8 : u32; + v50 = arith.mod v48, v241 : u32; + hir.assertz v50 #[code = 250]; + v51 = hir.int_to_ptr v48 : ptr; + v52 = hir.load v51 : i64; + v240 = arith.constant 8 : u32; + v53 = hir.bitcast v45 : u32; + v55 = arith.add v53, v240 : u32 #[overflow = checked]; + v56 = arith.constant 4 : u32; + v57 = arith.mod v55, v56 : u32; + hir.assertz v57 #[code = 250]; + v58 = hir.int_to_ptr v55 : ptr; + hir.store v58, v52; + v59 = hir.bitcast v6 : u32; + v239 = arith.constant 8 : u32; + v61 = arith.mod v59, v239 : u32; + hir.assertz v61 #[code = 250]; + v62 = hir.int_to_ptr v59 : ptr; + v63 = hir.load v62 : i64; + v64 = hir.bitcast v45 : u32; + v238 = arith.constant 4 : u32; + v66 = arith.mod v64, v238 : u32; + hir.assertz v66 #[code = 250]; + v67 = hir.int_to_ptr v64 : ptr; + hir.store v67, v63; + v237 = arith.constant 48 : i32; + v69 = arith.add v6, v237 : i32 #[overflow = wrapping]; + v70 = builtin.global_symbol @miden:rust-sdk-account-storage-get-initial-item-binding/rust-sdk-account-storage-get-initial-item-binding@0.0.1/rust_sdk_account_storage_get_initial_item_binding/__stack_pointer : ptr + v71 = hir.bitcast v70 : ptr; + hir.store v71, v69; + builtin.ret v45; + }; + + private builtin.function @wit_bindgen::rt::run_ctors_once() { + ^block11: + v73 = builtin.global_symbol @miden:rust-sdk-account-storage-get-initial-item-binding/rust-sdk-account-storage-get-initial-item-binding@0.0.1/rust_sdk_account_storage_get_initial_item_binding/GOT.data.internal.__memory_base : ptr + v74 = hir.bitcast v73 : ptr; + v75 = hir.load v74 : i32; + v76 = arith.constant 1048600 : i32; + v77 = arith.add v75, v76 : i32 #[overflow = wrapping]; + v78 = hir.bitcast v77 : u32; + v79 = hir.int_to_ptr v78 : ptr; + v80 = hir.load v79 : u8; + v72 = arith.constant 0 : i32; + v81 = arith.zext v80 : u32; + v82 = hir.bitcast v81 : i32; + v84 = arith.neq v82, v72 : i1; + scf.if v84{ + ^block13: + scf.yield ; + } else { + ^block14: + v85 = builtin.global_symbol @miden:rust-sdk-account-storage-get-initial-item-binding/rust-sdk-account-storage-get-initial-item-binding@0.0.1/rust_sdk_account_storage_get_initial_item_binding/GOT.data.internal.__memory_base : ptr + v86 = hir.bitcast v85 : ptr; + v87 = hir.load v86 : i32; + hir.exec @miden:rust-sdk-account-storage-get-initial-item-binding/rust-sdk-account-storage-get-initial-item-binding@0.0.1/rust_sdk_account_storage_get_initial_item_binding/__wasm_call_ctors() + v247 = arith.constant 1 : u8; + v249 = arith.constant 1048600 : i32; + v89 = arith.add v87, v249 : i32 #[overflow = wrapping]; + v93 = hir.bitcast v89 : u32; + v94 = hir.int_to_ptr v93 : ptr; + hir.store v94, v247; + scf.yield ; + }; + builtin.ret ; + }; + + private builtin.function @>::from(v95: i32) -> felt { + ^block15(v95: i32): + v97 = arith.constant 255 : i32; + v98 = arith.band v95, v97 : i32; + v99 = hir.bitcast v98 : felt; + builtin.ret v99; + }; + + private builtin.function @miden_stdlib_sys::intrinsics::word::Word::reverse(v100: i32, v101: i32) { + ^block17(v100: i32, v101: i32): + v104 = builtin.global_symbol @miden:rust-sdk-account-storage-get-initial-item-binding/rust-sdk-account-storage-get-initial-item-binding@0.0.1/rust_sdk_account_storage_get_initial_item_binding/__stack_pointer : ptr + v105 = hir.bitcast v104 : ptr; + v106 = hir.load v105 : i32; + v107 = arith.constant 16 : i32; + v108 = arith.sub v106, v107 : i32 #[overflow = wrapping]; + v110 = arith.constant 8 : u32; + v109 = hir.bitcast v101 : u32; + v111 = arith.add v109, v110 : u32 #[overflow = checked]; + v336 = arith.constant 8 : u32; + v113 = arith.mod v111, v336 : u32; + hir.assertz v113 #[code = 250]; + v114 = hir.int_to_ptr v111 : ptr; + v115 = hir.load v114 : i64; + v335 = arith.constant 8 : u32; + v116 = hir.bitcast v108 : u32; + v118 = arith.add v116, v335 : u32 #[overflow = checked]; + v119 = arith.constant 4 : u32; + v120 = arith.mod v118, v119 : u32; + hir.assertz v120 #[code = 250]; + v121 = hir.int_to_ptr v118 : ptr; + hir.store v121, v115; + v122 = hir.bitcast v101 : u32; + v334 = arith.constant 8 : u32; + v124 = arith.mod v122, v334 : u32; + hir.assertz v124 #[code = 250]; + v125 = hir.int_to_ptr v122 : ptr; + v126 = hir.load v125 : i64; + v127 = hir.bitcast v108 : u32; + v333 = arith.constant 4 : u32; + v129 = arith.mod v127, v333 : u32; + hir.assertz v129 #[code = 250]; + v130 = hir.int_to_ptr v127 : ptr; + hir.store v130, v126; + v131 = arith.constant 12 : i32; + v132 = arith.add v108, v131 : i32 #[overflow = wrapping]; + v102 = arith.constant 0 : i32; + v304, v305, v306, v307, v308, v309 = scf.while v102, v108, v132, v100 : i32, i32, i32, i32, i32, i32 { + ^block37(v310: i32, v311: i32, v312: i32, v313: i32): + v332 = arith.constant 0 : i32; + v135 = arith.constant 8 : i32; + v136 = arith.eq v310, v135 : i1; + v137 = arith.zext v136 : u32; + v138 = hir.bitcast v137 : i32; + v140 = arith.neq v138, v332 : i1; + v298, v299 = scf.if v140 : i32, i32 { + ^block36: + v258 = ub.poison i32 : i32; + scf.yield v258, v258; + } else { + ^block22: + v142 = arith.add v311, v310 : i32 #[overflow = wrapping]; + v143 = hir.bitcast v142 : u32; + v331 = arith.constant 4 : u32; + v145 = arith.mod v143, v331 : u32; + hir.assertz v145 #[code = 250]; + v146 = hir.int_to_ptr v143 : ptr; + v147 = hir.load v146 : felt; + v149 = hir.bitcast v312 : u32; + v330 = arith.constant 4 : u32; + v151 = arith.mod v149, v330 : u32; + hir.assertz v151 #[code = 250]; + v152 = hir.int_to_ptr v149 : ptr; + v153 = hir.load v152 : i32; + v154 = hir.bitcast v142 : u32; + v329 = arith.constant 4 : u32; + v156 = arith.mod v154, v329 : u32; + hir.assertz v156 #[code = 250]; + v157 = hir.int_to_ptr v154 : ptr; + hir.store v157, v153; + v158 = hir.bitcast v312 : u32; + v328 = arith.constant 4 : u32; + v160 = arith.mod v158, v328 : u32; + hir.assertz v160 #[code = 250]; + v161 = hir.int_to_ptr v158 : ptr; + hir.store v161, v147; + v164 = arith.constant -4 : i32; + v165 = arith.add v312, v164 : i32 #[overflow = wrapping]; + v162 = arith.constant 4 : i32; + v163 = arith.add v310, v162 : i32 #[overflow = wrapping]; + scf.yield v163, v165; + }; + v326 = ub.poison i32 : i32; + v301 = cf.select v140, v326, v313 : i32; + v327 = ub.poison i32 : i32; + v300 = cf.select v140, v327, v311 : i32; + v257 = arith.constant 1 : u32; + v250 = arith.constant 0 : u32; + v303 = cf.select v140, v250, v257 : u32; + v291 = arith.trunc v303 : i1; + scf.condition v291, v298, v300, v299, v301, v311, v313; + } do { + ^block38(v314: i32, v315: i32, v316: i32, v317: i32, v318: i32, v319: i32): + scf.yield v314, v315, v316, v317; + }; + v325 = arith.constant 8 : u32; + v167 = hir.bitcast v308 : u32; + v169 = arith.add v167, v325 : u32 #[overflow = checked]; + v324 = arith.constant 4 : u32; + v171 = arith.mod v169, v324 : u32; + hir.assertz v171 #[code = 250]; + v172 = hir.int_to_ptr v169 : ptr; + v173 = hir.load v172 : i64; + v323 = arith.constant 8 : u32; + v174 = hir.bitcast v309 : u32; + v176 = arith.add v174, v323 : u32 #[overflow = checked]; + v322 = arith.constant 8 : u32; + v178 = arith.mod v176, v322 : u32; + hir.assertz v178 #[code = 250]; + v179 = hir.int_to_ptr v176 : ptr; + hir.store v179, v173; + v180 = hir.bitcast v308 : u32; + v321 = arith.constant 4 : u32; + v182 = arith.mod v180, v321 : u32; + hir.assertz v182 #[code = 250]; + v183 = hir.int_to_ptr v180 : ptr; + v184 = hir.load v183 : i64; + v185 = hir.bitcast v309 : u32; + v320 = arith.constant 8 : u32; + v187 = arith.mod v185, v320 : u32; + hir.assertz v187 #[code = 250]; + v188 = hir.int_to_ptr v185 : ptr; + hir.store v188, v184; + builtin.ret ; + }; + + private builtin.function @miden::active_account::get_initial_item(v189: felt, v190: i32) { + ^block23(v189: felt, v190: i32): + v191, v192, v193, v194 = hir.exec @miden/active_account/get_initial_item(v189) : felt, felt, felt, felt + v195 = hir.bitcast v190 : u32; + v196 = hir.int_to_ptr v195 : ptr; + hir.store v196, v191; + v197 = arith.constant 4 : u32; + v198 = arith.add v195, v197 : u32 #[overflow = checked]; + v199 = hir.int_to_ptr v198 : ptr; + hir.store v199, v192; + v200 = arith.constant 8 : u32; + v201 = arith.add v195, v200 : u32 #[overflow = checked]; + v202 = hir.int_to_ptr v201 : ptr; + hir.store v202, v193; + v203 = arith.constant 12 : u32; + v204 = arith.add v195, v203 : u32 #[overflow = checked]; + v205 = hir.int_to_ptr v204 : ptr; + hir.store v205, v194; + builtin.ret ; + }; + + builtin.global_variable private @#__stack_pointer : i32 { + builtin.ret_imm 1048576; + }; + + builtin.global_variable private @#GOT.data.internal.__memory_base : i32 { + builtin.ret_imm 0; + }; + + builtin.segment @1048576 = 0x0000000100000001; + }; + + public builtin.function @binding() -> felt, felt, felt, felt { + ^block27: + v206 = hir.exec @miden:rust-sdk-account-storage-get-initial-item-binding/rust-sdk-account-storage-get-initial-item-binding@0.0.1/rust_sdk_account_storage_get_initial_item_binding/miden:rust-sdk-account-storage-get-initial-item-binding/rust-sdk-account-storage-get-initial-item-binding@0.0.1#binding() : i32 + v207 = arith.constant 0 : i32; + v208 = arith.add v206, v207 : i32 #[overflow = unchecked]; + v340 = arith.constant 0 : i32; + v341 = arith.constant 0 : i32; + v210 = arith.add v208, v341 : i32 #[overflow = unchecked]; + v212 = arith.add v210, v340 : i32 #[overflow = unchecked]; + v213 = hir.int_to_ptr v212 : ptr; + v214 = hir.load v213 : felt; + v339 = arith.constant 0 : i32; + v215 = arith.constant 4 : i32; + v216 = arith.add v208, v215 : i32 #[overflow = unchecked]; + v218 = arith.add v216, v339 : i32 #[overflow = unchecked]; + v219 = hir.int_to_ptr v218 : ptr; + v220 = hir.load v219 : felt; + v338 = arith.constant 0 : i32; + v221 = arith.constant 8 : i32; + v222 = arith.add v208, v221 : i32 #[overflow = unchecked]; + v224 = arith.add v222, v338 : i32 #[overflow = unchecked]; + v225 = hir.int_to_ptr v224 : ptr; + v226 = hir.load v225 : felt; + v337 = arith.constant 0 : i32; + v227 = arith.constant 12 : i32; + v228 = arith.add v208, v227 : i32 #[overflow = unchecked]; + v230 = arith.add v228, v337 : i32 #[overflow = unchecked]; + v231 = hir.int_to_ptr v230 : ptr; + v232 = hir.load v231 : felt; + builtin.ret v214, v220, v226, v232; + }; +}; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_storage_get_initial_item_binding.masm b/tests/integration/expected/rust_sdk/rust_sdk_account_storage_get_initial_item_binding.masm new file mode 100644 index 000000000..abf18f648 --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_storage_get_initial_item_binding.masm @@ -0,0 +1,713 @@ +# mod miden:rust-sdk-account-storage-get-initial-item-binding/rust-sdk-account-storage-get-initial-item-binding@0.0.1 + +@callconv("canon-lift") +pub proc binding( + +) -> (felt, felt, felt, felt) + exec.::miden:rust-sdk-account-storage-get-initial-item-binding/rust-sdk-account-storage-get-initial-item-binding@0.0.1::init + trace.240 + nop + exec.::miden:rust-sdk-account-storage-get-initial-item-binding/rust-sdk-account-storage-get-initial-item-binding@0.0.1::rust_sdk_account_storage_get_initial_item_binding::miden:rust-sdk-account-storage-get-initial-item-binding/rust-sdk-account-storage-get-initial-item-binding@0.0.1#binding + trace.252 + nop + push.0 + u32wrapping_add + push.0 + push.0 + dup.2 + u32wrapping_add + u32wrapping_add + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.0 + push.4 + dup.3 + u32wrapping_add + u32wrapping_add + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.0 + push.8 + dup.4 + u32wrapping_add + u32wrapping_add + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.0 + push.12 + movup.5 + u32wrapping_add + u32wrapping_add + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + movdn.3 + swap.2 + exec.::std::sys::truncate_stack +end + +proc init + push.1179648 + trace.240 + exec.::intrinsics::mem::heap_init + trace.252 + push.[7028007876379170725,18060021366771303825,13412364500725888848,14178532912296021363] + adv.push_mapval + push.262144 + push.1 + trace.240 + exec.::std::mem::pipe_preimage_to_memory + trace.252 + drop + push.1048576 + u32assert + mem_store.278536 + push.0 + u32assert + mem_store.278537 +end + +# mod miden:rust-sdk-account-storage-get-initial-item-binding/rust-sdk-account-storage-get-initial-item-binding@0.0.1::rust_sdk_account_storage_get_initial_item_binding + +@callconv("C") +proc __wasm_call_ctors( + +) + nop +end + +@callconv("C") +proc rust_sdk_account_storage_get_initial_item_binding::bindings::__link_custom_section_describing_imports( + +) + nop +end + +@callconv("C") +proc miden:rust-sdk-account-storage-get-initial-item-binding/rust-sdk-account-storage-get-initial-item-binding@0.0.1#binding( + +) -> i32 + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.48 + u32wrapping_sub + push.1114144 + dup.1 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + trace.240 + nop + exec.::miden:rust-sdk-account-storage-get-initial-item-binding/rust-sdk-account-storage-get-initial-item-binding@0.0.1::rust_sdk_account_storage_get_initial_item_binding::wit_bindgen::rt::run_ctors_once + trace.252 + nop + push.0 + trace.240 + nop + exec.::miden:rust-sdk-account-storage-get-initial-item-binding/rust-sdk-account-storage-get-initial-item-binding@0.0.1::rust_sdk_account_storage_get_initial_item_binding::>::from + trace.252 + nop + push.16 + dup.2 + u32wrapping_add + swap.1 + trace.240 + nop + exec.::miden:rust-sdk-account-storage-get-initial-item-binding/rust-sdk-account-storage-get-initial-item-binding@0.0.1::rust_sdk_account_storage_get_initial_item_binding::miden::active_account::get_initial_item + trace.252 + nop + push.24 + dup.1 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.40 + dup.3 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.16 + dup.1 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.32 + dup.3 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.1114148 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.32 + dup.2 + u32wrapping_add + dup.2 + trace.240 + nop + exec.::miden:rust-sdk-account-storage-get-initial-item-binding/rust-sdk-account-storage-get-initial-item-binding@0.0.1::rust_sdk_account_storage_get_initial_item_binding::miden_stdlib_sys::intrinsics::word::Word::reverse + trace.252 + nop + push.1048584 + u32wrapping_add + push.8 + dup.2 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.8 + dup.3 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + dup.1 + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + dup.2 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.48 + movup.2 + u32wrapping_add + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop +end + +@callconv("C") +proc wit_bindgen::rt::run_ctors_once( + +) + push.1114148 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.1048600 + u32wrapping_add + u32divmod.4 + swap.1 + swap.1 + dup.1 + mem_load + swap.1 + push.8 + u32wrapping_mul + u32shr + swap.1 + drop + push.255 + u32and + push.0 + swap.1 + neq + if.true + nop + else + push.1114148 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + trace.240 + nop + exec.::miden:rust-sdk-account-storage-get-initial-item-binding/rust-sdk-account-storage-get-initial-item-binding@0.0.1::rust_sdk_account_storage_get_initial_item_binding::__wasm_call_ctors + trace.252 + nop + push.1 + push.1048600 + movup.2 + u32wrapping_add + u32divmod.4 + swap.1 + dup.0 + mem_load + dup.2 + push.8 + u32wrapping_mul + push.255 + swap.1 + u32shl + u32not + swap.1 + u32and + movup.3 + movup.3 + push.8 + u32wrapping_mul + u32shl + u32or + swap.1 + mem_store + end +end + +@callconv("C") +proc >::from( + i32 +) -> felt + push.255 + u32and +end + +@callconv("C") +proc miden_stdlib_sys::intrinsics::word::Word::reverse( + i32, + i32 +) + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.16 + u32wrapping_sub + push.8 + dup.3 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.8 + dup.3 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + movup.2 + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + dup.2 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.12 + dup.1 + u32wrapping_add + push.0 + movup.2 + swap.1 + push.1 + while.true + push.0 + push.8 + dup.2 + eq + neq + dup.0 + if.true + movup.3 + movup.2 + drop + drop + push.3735929054 + dup.0 + else + dup.2 + dup.2 + u32wrapping_add + dup.0 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + dup.5 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + movup.2 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + dup.4 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.4294967292 + movup.4 + u32wrapping_add + push.4 + movup.3 + u32wrapping_add + end + push.3735929054 + dup.3 + dup.6 + swap.2 + swap.1 + cdrop + push.3735929054 + dup.4 + dup.6 + swap.2 + swap.1 + cdrop + push.1 + push.0 + movup.6 + cdrop + push.1 + u32and + swap.1 + swap.2 + swap.4 + swap.3 + swap.1 + if.true + movup.4 + drop + movup.4 + drop + push.1 + else + push.0 + end + end + drop + drop + drop + drop + push.8 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.8 + dup.4 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + movup.2 + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop +end + +@callconv("C") +proc miden::active_account::get_initial_item(felt, i32) + trace.240 + nop + exec.::miden::active_account::get_initial_item + trace.252 + nop + movup.4 + dup.0 + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.4 + dup.1 + add + u32assert + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.8 + dup.1 + add + u32assert + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.12 + add + u32assert + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop +end + diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_storage_get_initial_item_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_account_storage_get_initial_item_binding.wat new file mode 100644 index 000000000..1170355f7 --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_storage_get_initial_item_binding.wat @@ -0,0 +1,190 @@ +(component + (type (;0;) + (instance + (type (;0;) (record (field "inner" f32))) + (export (;1;) "felt" (type (eq 0))) + (type (;2;) (tuple 1 1 1 1)) + (type (;3;) (record (field "inner" 2))) + (export (;4;) "word" (type (eq 3))) + ) + ) + (import "miden:base/core-types@1.0.0" (instance (;0;) (type 0))) + (core module (;0;) + (type (;0;) (func)) + (type (;1;) (func (result i32))) + (type (;2;) (func (param i32) (result f32))) + (type (;3;) (func (param i32 i32))) + (type (;4;) (func (param f32 i32))) + (table (;0;) 2 2 funcref) + (memory (;0;) 17) + (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) + (global $GOT.data.internal.__memory_base (;1;) i32 i32.const 0) + (export "memory" (memory 0)) + (export "miden:rust-sdk-account-storage-get-initial-item-binding/rust-sdk-account-storage-get-initial-item-binding@0.0.1#binding" (func $miden:rust-sdk-account-storage-get-initial-item-binding/rust-sdk-account-storage-get-initial-item-binding@0.0.1#binding)) + (elem (;0;) (i32.const 1) func $rust_sdk_account_storage_get_initial_item_binding::bindings::__link_custom_section_describing_imports) + (func $__wasm_call_ctors (;0;) (type 0)) + (func $rust_sdk_account_storage_get_initial_item_binding::bindings::__link_custom_section_describing_imports (;1;) (type 0)) + (func $miden:rust-sdk-account-storage-get-initial-item-binding/rust-sdk-account-storage-get-initial-item-binding@0.0.1#binding (;2;) (type 1) (result i32) + (local i32 i32) + global.get $__stack_pointer + i32.const 48 + i32.sub + local.tee 0 + global.set $__stack_pointer + call $wit_bindgen::rt::run_ctors_once + i32.const 0 + call $>::from + local.get 0 + i32.const 16 + i32.add + call $miden::active_account::get_initial_item + local.get 0 + local.get 0 + i64.load offset=24 + i64.store offset=40 + local.get 0 + local.get 0 + i64.load offset=16 + i64.store offset=32 + global.get $GOT.data.internal.__memory_base + local.set 1 + local.get 0 + local.get 0 + i32.const 32 + i32.add + call $miden_stdlib_sys::intrinsics::word::Word::reverse + local.get 1 + i32.const 1048584 + i32.add + local.tee 1 + local.get 0 + i64.load offset=8 + i64.store offset=8 align=4 + local.get 1 + local.get 0 + i64.load + i64.store align=4 + local.get 0 + i32.const 48 + i32.add + global.set $__stack_pointer + local.get 1 + ) + (func $wit_bindgen::rt::run_ctors_once (;3;) (type 0) + (local i32) + block ;; label = @1 + global.get $GOT.data.internal.__memory_base + i32.const 1048600 + i32.add + i32.load8_u + br_if 0 (;@1;) + global.get $GOT.data.internal.__memory_base + local.set 0 + call $__wasm_call_ctors + local.get 0 + i32.const 1048600 + i32.add + i32.const 1 + i32.store8 + end + ) + (func $>::from (;4;) (type 2) (param i32) (result f32) + local.get 0 + i32.const 255 + i32.and + f32.reinterpret_i32 + ) + (func $miden_stdlib_sys::intrinsics::word::Word::reverse (;5;) (type 3) (param i32 i32) + (local i32 i32 i32 f32) + global.get $__stack_pointer + i32.const 16 + i32.sub + local.tee 2 + local.get 1 + i64.load offset=8 + i64.store offset=8 align=4 + local.get 2 + local.get 1 + i64.load + i64.store align=4 + local.get 2 + i32.const 12 + i32.add + local.set 3 + i32.const 0 + local.set 1 + block ;; label = @1 + loop ;; label = @2 + local.get 1 + i32.const 8 + i32.eq + br_if 1 (;@1;) + local.get 2 + local.get 1 + i32.add + local.tee 4 + f32.load + local.set 5 + local.get 4 + local.get 3 + i32.load + i32.store + local.get 3 + local.get 5 + f32.store + local.get 1 + i32.const 4 + i32.add + local.set 1 + local.get 3 + i32.const -4 + i32.add + local.set 3 + br 0 (;@2;) + end + end + local.get 0 + local.get 2 + i64.load offset=8 align=4 + i64.store offset=8 + local.get 0 + local.get 2 + i64.load align=4 + i64.store + ) + (func $miden::active_account::get_initial_item (;6;) (type 4) (param f32 i32) + unreachable + ) + (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") + (@custom "rodata,miden_account" (after data) "crust_sdk_account_storage_get_initial_item_binding\01\0b0.0.1\03\01\01\00\00\00\00") + ) + (alias export 0 "word" (type (;1;))) + (core instance (;0;) (instantiate 0)) + (alias core export 0 "memory" (core memory (;0;))) + (type (;2;) (func (result 1))) + (alias core export 0 "miden:rust-sdk-account-storage-get-initial-item-binding/rust-sdk-account-storage-get-initial-item-binding@0.0.1#binding" (core func (;0;))) + (func (;0;) (type 2) (canon lift (core func 0) (memory 0))) + (alias export 0 "felt" (type (;3;))) + (alias export 0 "word" (type (;4;))) + (component (;0;) + (type (;0;) (record (field "inner" f32))) + (import "import-type-felt" (type (;1;) (eq 0))) + (type (;2;) (tuple 1 1 1 1)) + (type (;3;) (record (field "inner" 2))) + (import "import-type-word" (type (;4;) (eq 3))) + (import "import-type-word0" (type (;5;) (eq 4))) + (type (;6;) (func (result 5))) + (import "import-func-binding" (func (;0;) (type 6))) + (export (;7;) "word" (type 4)) + (type (;8;) (func (result 7))) + (export (;1;) "binding" (func 0) (func (type 8))) + ) + (instance (;1;) (instantiate 0 + (with "import-func-binding" (func 0)) + (with "import-type-felt" (type 3)) + (with "import-type-word" (type 4)) + (with "import-type-word0" (type 1)) + ) + ) + (export (;2;) "miden:rust-sdk-account-storage-get-initial-item-binding/rust-sdk-account-storage-get-initial-item-binding@0.0.1" (instance 1)) +) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_storage_get_initial_map_item_binding.hir b/tests/integration/expected/rust_sdk/rust_sdk_account_storage_get_initial_map_item_binding.hir new file mode 100644 index 000000000..6b8215b99 --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_storage_get_initial_map_item_binding.hir @@ -0,0 +1,418 @@ +builtin.component miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1 { + builtin.module public @rust_sdk_account_storage_get_initial_map_item_binding { + private builtin.function @__wasm_call_ctors() { + ^block5: + builtin.ret ; + }; + + private builtin.function @rust_sdk_account_storage_get_initial_map_item_binding::bindings::__link_custom_section_describing_imports() { + ^block7: + builtin.ret ; + }; + + private builtin.function @miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1#binding() -> i32 { + ^block9: + v3 = builtin.global_symbol @miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1/rust_sdk_account_storage_get_initial_map_item_binding/__stack_pointer : ptr + v4 = hir.bitcast v3 : ptr; + v5 = hir.load v4 : i32; + v6 = arith.constant 48 : i32; + v7 = arith.sub v5, v6 : i32 #[overflow = wrapping]; + v8 = builtin.global_symbol @miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1/rust_sdk_account_storage_get_initial_map_item_binding/__stack_pointer : ptr + v9 = hir.bitcast v8 : ptr; + hir.store v9, v7; + hir.exec @miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1/rust_sdk_account_storage_get_initial_map_item_binding/wit_bindgen::rt::run_ctors_once() + v1 = arith.constant 0 : i32; + v12 = hir.exec @miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1/rust_sdk_account_storage_get_initial_map_item_binding/intrinsics::felt::from_u32(v1) : felt + v368 = arith.constant 0 : i32; + v336, v337, v338, v339 = scf.while v368, v7, v12 : i32, i32, felt, i32 { + ^block42(v340: i32, v341: i32, v342: felt): + v367 = arith.constant 0 : i32; + v61 = arith.constant 16 : i32; + v15 = arith.eq v340, v61 : i1; + v16 = arith.zext v15 : u32; + v17 = hir.bitcast v16 : i32; + v19 = arith.neq v17, v367 : i1; + v331 = scf.if v19 : i32 { + ^block41: + v302 = ub.poison i32 : i32; + scf.yield v302; + } else { + ^block14: + v92 = arith.constant 32 : i32; + v22 = arith.add v341, v92 : i32 #[overflow = wrapping]; + v23 = arith.add v22, v340 : i32 #[overflow = wrapping]; + v25 = hir.bitcast v23 : u32; + v34 = arith.constant 4 : u32; + v27 = arith.mod v25, v34 : u32; + hir.assertz v27 #[code = 250]; + v28 = hir.int_to_ptr v25 : ptr; + hir.store v28, v342; + v29 = arith.constant 4 : i32; + v30 = arith.add v340, v29 : i32 #[overflow = wrapping]; + scf.yield v30; + }; + v303 = ub.poison felt : felt; + v333 = cf.select v19, v303, v342 : felt; + v366 = ub.poison i32 : i32; + v332 = cf.select v19, v366, v341 : i32; + v301 = arith.constant 1 : u32; + v295 = arith.constant 0 : u32; + v335 = cf.select v19, v295, v301 : u32; + v325 = arith.trunc v335 : i1; + scf.condition v325, v331, v332, v333, v341; + } do { + ^block43(v343: i32, v344: i32, v345: felt, v346: i32): + scf.yield v343, v344, v345; + }; + v32 = arith.constant 44 : u32; + v31 = hir.bitcast v339 : u32; + v33 = arith.add v31, v32 : u32 #[overflow = checked]; + v365 = arith.constant 4 : u32; + v35 = arith.mod v33, v365 : u32; + hir.assertz v35 #[code = 250]; + v36 = hir.int_to_ptr v33 : ptr; + v37 = hir.load v36 : felt; + v39 = arith.constant 40 : u32; + v38 = hir.bitcast v339 : u32; + v40 = arith.add v38, v39 : u32 #[overflow = checked]; + v364 = arith.constant 4 : u32; + v42 = arith.mod v40, v364 : u32; + hir.assertz v42 #[code = 250]; + v43 = hir.int_to_ptr v40 : ptr; + v44 = hir.load v43 : felt; + v46 = arith.constant 36 : u32; + v45 = hir.bitcast v339 : u32; + v47 = arith.add v45, v46 : u32 #[overflow = checked]; + v363 = arith.constant 4 : u32; + v49 = arith.mod v47, v363 : u32; + hir.assertz v49 #[code = 250]; + v50 = hir.int_to_ptr v47 : ptr; + v51 = hir.load v50 : felt; + v53 = arith.constant 32 : u32; + v52 = hir.bitcast v339 : u32; + v54 = arith.add v52, v53 : u32 #[overflow = checked]; + v362 = arith.constant 4 : u32; + v56 = arith.mod v54, v362 : u32; + hir.assertz v56 #[code = 250]; + v57 = hir.int_to_ptr v54 : ptr; + v58 = hir.load v57 : felt; + v361 = arith.constant 0 : i32; + v60 = hir.exec @miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1/rust_sdk_account_storage_get_initial_map_item_binding/>::from(v361) : felt + v360 = arith.constant 16 : i32; + v62 = arith.add v339, v360 : i32 #[overflow = wrapping]; + hir.exec @miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1/rust_sdk_account_storage_get_initial_map_item_binding/miden::active_account::get_initial_map_item(v60, v37, v44, v51, v58, v62) + v64 = arith.constant 24 : u32; + v63 = hir.bitcast v339 : u32; + v65 = arith.add v63, v64 : u32 #[overflow = checked]; + v66 = arith.constant 8 : u32; + v67 = arith.mod v65, v66 : u32; + hir.assertz v67 #[code = 250]; + v68 = hir.int_to_ptr v65 : ptr; + v69 = hir.load v68 : i64; + v359 = arith.constant 40 : u32; + v70 = hir.bitcast v339 : u32; + v72 = arith.add v70, v359 : u32 #[overflow = checked]; + v358 = arith.constant 8 : u32; + v74 = arith.mod v72, v358 : u32; + hir.assertz v74 #[code = 250]; + v75 = hir.int_to_ptr v72 : ptr; + hir.store v75, v69; + v77 = arith.constant 16 : u32; + v76 = hir.bitcast v339 : u32; + v78 = arith.add v76, v77 : u32 #[overflow = checked]; + v357 = arith.constant 8 : u32; + v80 = arith.mod v78, v357 : u32; + hir.assertz v80 #[code = 250]; + v81 = hir.int_to_ptr v78 : ptr; + v82 = hir.load v81 : i64; + v356 = arith.constant 32 : u32; + v83 = hir.bitcast v339 : u32; + v85 = arith.add v83, v356 : u32 #[overflow = checked]; + v355 = arith.constant 8 : u32; + v87 = arith.mod v85, v355 : u32; + hir.assertz v87 #[code = 250]; + v88 = hir.int_to_ptr v85 : ptr; + hir.store v88, v82; + v89 = builtin.global_symbol @miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1/rust_sdk_account_storage_get_initial_map_item_binding/GOT.data.internal.__memory_base : ptr + v90 = hir.bitcast v89 : ptr; + v91 = hir.load v90 : i32; + v354 = arith.constant 32 : i32; + v93 = arith.add v339, v354 : i32 #[overflow = wrapping]; + hir.exec @miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1/rust_sdk_account_storage_get_initial_map_item_binding/miden_stdlib_sys::intrinsics::word::Word::reverse(v339, v93) + v94 = arith.constant 1048584 : i32; + v95 = arith.add v91, v94 : i32 #[overflow = wrapping]; + v353 = arith.constant 8 : u32; + v96 = hir.bitcast v339 : u32; + v98 = arith.add v96, v353 : u32 #[overflow = checked]; + v352 = arith.constant 8 : u32; + v100 = arith.mod v98, v352 : u32; + hir.assertz v100 #[code = 250]; + v101 = hir.int_to_ptr v98 : ptr; + v102 = hir.load v101 : i64; + v351 = arith.constant 8 : u32; + v103 = hir.bitcast v95 : u32; + v105 = arith.add v103, v351 : u32 #[overflow = checked]; + v350 = arith.constant 4 : u32; + v107 = arith.mod v105, v350 : u32; + hir.assertz v107 #[code = 250]; + v108 = hir.int_to_ptr v105 : ptr; + hir.store v108, v102; + v109 = hir.bitcast v339 : u32; + v349 = arith.constant 8 : u32; + v111 = arith.mod v109, v349 : u32; + hir.assertz v111 #[code = 250]; + v112 = hir.int_to_ptr v109 : ptr; + v113 = hir.load v112 : i64; + v114 = hir.bitcast v95 : u32; + v348 = arith.constant 4 : u32; + v116 = arith.mod v114, v348 : u32; + hir.assertz v116 #[code = 250]; + v117 = hir.int_to_ptr v114 : ptr; + hir.store v117, v113; + v347 = arith.constant 48 : i32; + v119 = arith.add v339, v347 : i32 #[overflow = wrapping]; + v120 = builtin.global_symbol @miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1/rust_sdk_account_storage_get_initial_map_item_binding/__stack_pointer : ptr + v121 = hir.bitcast v120 : ptr; + hir.store v121, v119; + builtin.ret v95; + }; + + private builtin.function @wit_bindgen::rt::run_ctors_once() { + ^block15: + v123 = builtin.global_symbol @miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1/rust_sdk_account_storage_get_initial_map_item_binding/GOT.data.internal.__memory_base : ptr + v124 = hir.bitcast v123 : ptr; + v125 = hir.load v124 : i32; + v126 = arith.constant 1048600 : i32; + v127 = arith.add v125, v126 : i32 #[overflow = wrapping]; + v128 = hir.bitcast v127 : u32; + v129 = hir.int_to_ptr v128 : ptr; + v130 = hir.load v129 : u8; + v122 = arith.constant 0 : i32; + v131 = arith.zext v130 : u32; + v132 = hir.bitcast v131 : i32; + v134 = arith.neq v132, v122 : i1; + scf.if v134{ + ^block17: + scf.yield ; + } else { + ^block18: + v135 = builtin.global_symbol @miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1/rust_sdk_account_storage_get_initial_map_item_binding/GOT.data.internal.__memory_base : ptr + v136 = hir.bitcast v135 : ptr; + v137 = hir.load v136 : i32; + hir.exec @miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1/rust_sdk_account_storage_get_initial_map_item_binding/__wasm_call_ctors() + v370 = arith.constant 1 : u8; + v372 = arith.constant 1048600 : i32; + v139 = arith.add v137, v372 : i32 #[overflow = wrapping]; + v143 = hir.bitcast v139 : u32; + v144 = hir.int_to_ptr v143 : ptr; + hir.store v144, v370; + scf.yield ; + }; + builtin.ret ; + }; + + private builtin.function @>::from(v145: i32) -> felt { + ^block19(v145: i32): + v147 = arith.constant 255 : i32; + v148 = arith.band v145, v147 : i32; + v149 = hir.bitcast v148 : felt; + builtin.ret v149; + }; + + private builtin.function @miden_stdlib_sys::intrinsics::word::Word::reverse(v150: i32, v151: i32) { + ^block21(v150: i32, v151: i32): + v154 = builtin.global_symbol @miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1/rust_sdk_account_storage_get_initial_map_item_binding/__stack_pointer : ptr + v155 = hir.bitcast v154 : ptr; + v156 = hir.load v155 : i32; + v157 = arith.constant 16 : i32; + v158 = arith.sub v156, v157 : i32 #[overflow = wrapping]; + v160 = arith.constant 8 : u32; + v159 = hir.bitcast v151 : u32; + v161 = arith.add v159, v160 : u32 #[overflow = checked]; + v459 = arith.constant 8 : u32; + v163 = arith.mod v161, v459 : u32; + hir.assertz v163 #[code = 250]; + v164 = hir.int_to_ptr v161 : ptr; + v165 = hir.load v164 : i64; + v458 = arith.constant 8 : u32; + v166 = hir.bitcast v158 : u32; + v168 = arith.add v166, v458 : u32 #[overflow = checked]; + v169 = arith.constant 4 : u32; + v170 = arith.mod v168, v169 : u32; + hir.assertz v170 #[code = 250]; + v171 = hir.int_to_ptr v168 : ptr; + hir.store v171, v165; + v172 = hir.bitcast v151 : u32; + v457 = arith.constant 8 : u32; + v174 = arith.mod v172, v457 : u32; + hir.assertz v174 #[code = 250]; + v175 = hir.int_to_ptr v172 : ptr; + v176 = hir.load v175 : i64; + v177 = hir.bitcast v158 : u32; + v456 = arith.constant 4 : u32; + v179 = arith.mod v177, v456 : u32; + hir.assertz v179 #[code = 250]; + v180 = hir.int_to_ptr v177 : ptr; + hir.store v180, v176; + v181 = arith.constant 12 : i32; + v182 = arith.add v158, v181 : i32 #[overflow = wrapping]; + v152 = arith.constant 0 : i32; + v427, v428, v429, v430, v431, v432 = scf.while v152, v158, v182, v150 : i32, i32, i32, i32, i32, i32 { + ^block52(v433: i32, v434: i32, v435: i32, v436: i32): + v455 = arith.constant 0 : i32; + v185 = arith.constant 8 : i32; + v186 = arith.eq v433, v185 : i1; + v187 = arith.zext v186 : u32; + v188 = hir.bitcast v187 : i32; + v190 = arith.neq v188, v455 : i1; + v421, v422 = scf.if v190 : i32, i32 { + ^block51: + v381 = ub.poison i32 : i32; + scf.yield v381, v381; + } else { + ^block26: + v192 = arith.add v434, v433 : i32 #[overflow = wrapping]; + v193 = hir.bitcast v192 : u32; + v454 = arith.constant 4 : u32; + v195 = arith.mod v193, v454 : u32; + hir.assertz v195 #[code = 250]; + v196 = hir.int_to_ptr v193 : ptr; + v197 = hir.load v196 : felt; + v199 = hir.bitcast v435 : u32; + v453 = arith.constant 4 : u32; + v201 = arith.mod v199, v453 : u32; + hir.assertz v201 #[code = 250]; + v202 = hir.int_to_ptr v199 : ptr; + v203 = hir.load v202 : i32; + v204 = hir.bitcast v192 : u32; + v452 = arith.constant 4 : u32; + v206 = arith.mod v204, v452 : u32; + hir.assertz v206 #[code = 250]; + v207 = hir.int_to_ptr v204 : ptr; + hir.store v207, v203; + v208 = hir.bitcast v435 : u32; + v451 = arith.constant 4 : u32; + v210 = arith.mod v208, v451 : u32; + hir.assertz v210 #[code = 250]; + v211 = hir.int_to_ptr v208 : ptr; + hir.store v211, v197; + v214 = arith.constant -4 : i32; + v215 = arith.add v435, v214 : i32 #[overflow = wrapping]; + v212 = arith.constant 4 : i32; + v213 = arith.add v433, v212 : i32 #[overflow = wrapping]; + scf.yield v213, v215; + }; + v449 = ub.poison i32 : i32; + v424 = cf.select v190, v449, v436 : i32; + v450 = ub.poison i32 : i32; + v423 = cf.select v190, v450, v434 : i32; + v380 = arith.constant 1 : u32; + v373 = arith.constant 0 : u32; + v426 = cf.select v190, v373, v380 : u32; + v414 = arith.trunc v426 : i1; + scf.condition v414, v421, v423, v422, v424, v434, v436; + } do { + ^block53(v437: i32, v438: i32, v439: i32, v440: i32, v441: i32, v442: i32): + scf.yield v437, v438, v439, v440; + }; + v448 = arith.constant 8 : u32; + v217 = hir.bitcast v431 : u32; + v219 = arith.add v217, v448 : u32 #[overflow = checked]; + v447 = arith.constant 4 : u32; + v221 = arith.mod v219, v447 : u32; + hir.assertz v221 #[code = 250]; + v222 = hir.int_to_ptr v219 : ptr; + v223 = hir.load v222 : i64; + v446 = arith.constant 8 : u32; + v224 = hir.bitcast v432 : u32; + v226 = arith.add v224, v446 : u32 #[overflow = checked]; + v445 = arith.constant 8 : u32; + v228 = arith.mod v226, v445 : u32; + hir.assertz v228 #[code = 250]; + v229 = hir.int_to_ptr v226 : ptr; + hir.store v229, v223; + v230 = hir.bitcast v431 : u32; + v444 = arith.constant 4 : u32; + v232 = arith.mod v230, v444 : u32; + hir.assertz v232 #[code = 250]; + v233 = hir.int_to_ptr v230 : ptr; + v234 = hir.load v233 : i64; + v235 = hir.bitcast v432 : u32; + v443 = arith.constant 8 : u32; + v237 = arith.mod v235, v443 : u32; + hir.assertz v237 #[code = 250]; + v238 = hir.int_to_ptr v235 : ptr; + hir.store v238, v234; + builtin.ret ; + }; + + private builtin.function @intrinsics::felt::from_u32(v239: i32) -> felt { + ^block27(v239: i32): + v240 = hir.bitcast v239 : felt; + builtin.ret v240; + }; + + private builtin.function @miden::active_account::get_initial_map_item(v242: felt, v243: felt, v244: felt, v245: felt, v246: felt, v247: i32) { + ^block29(v242: felt, v243: felt, v244: felt, v245: felt, v246: felt, v247: i32): + v248, v249, v250, v251 = hir.exec @miden/active_account/get_initial_map_item(v242, v243, v244, v245, v246) : felt, felt, felt, felt + v252 = hir.bitcast v247 : u32; + v253 = hir.int_to_ptr v252 : ptr; + hir.store v253, v248; + v254 = arith.constant 4 : u32; + v255 = arith.add v252, v254 : u32 #[overflow = checked]; + v256 = hir.int_to_ptr v255 : ptr; + hir.store v256, v249; + v257 = arith.constant 8 : u32; + v258 = arith.add v252, v257 : u32 #[overflow = checked]; + v259 = hir.int_to_ptr v258 : ptr; + hir.store v259, v250; + v260 = arith.constant 12 : u32; + v261 = arith.add v252, v260 : u32 #[overflow = checked]; + v262 = hir.int_to_ptr v261 : ptr; + hir.store v262, v251; + builtin.ret ; + }; + + builtin.global_variable private @#__stack_pointer : i32 { + builtin.ret_imm 1048576; + }; + + builtin.global_variable private @#GOT.data.internal.__memory_base : i32 { + builtin.ret_imm 0; + }; + + builtin.segment @1048576 = 0x0000000100000001; + }; + + public builtin.function @binding() -> felt, felt, felt, felt { + ^block33: + v263 = hir.exec @miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1/rust_sdk_account_storage_get_initial_map_item_binding/miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1#binding() : i32 + v264 = arith.constant 0 : i32; + v265 = arith.add v263, v264 : i32 #[overflow = unchecked]; + v463 = arith.constant 0 : i32; + v464 = arith.constant 0 : i32; + v267 = arith.add v265, v464 : i32 #[overflow = unchecked]; + v269 = arith.add v267, v463 : i32 #[overflow = unchecked]; + v270 = hir.int_to_ptr v269 : ptr; + v271 = hir.load v270 : felt; + v462 = arith.constant 0 : i32; + v272 = arith.constant 4 : i32; + v273 = arith.add v265, v272 : i32 #[overflow = unchecked]; + v275 = arith.add v273, v462 : i32 #[overflow = unchecked]; + v276 = hir.int_to_ptr v275 : ptr; + v277 = hir.load v276 : felt; + v461 = arith.constant 0 : i32; + v278 = arith.constant 8 : i32; + v279 = arith.add v265, v278 : i32 #[overflow = unchecked]; + v281 = arith.add v279, v461 : i32 #[overflow = unchecked]; + v282 = hir.int_to_ptr v281 : ptr; + v283 = hir.load v282 : felt; + v460 = arith.constant 0 : i32; + v284 = arith.constant 12 : i32; + v285 = arith.add v265, v284 : i32 #[overflow = unchecked]; + v287 = arith.add v285, v460 : i32 #[overflow = unchecked]; + v288 = hir.int_to_ptr v287 : ptr; + v289 = hir.load v288 : felt; + builtin.ret v271, v277, v283, v289; + }; +}; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_storage_get_initial_map_item_binding.masm b/tests/integration/expected/rust_sdk/rust_sdk_account_storage_get_initial_map_item_binding.masm new file mode 100644 index 000000000..79ccaf420 --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_storage_get_initial_map_item_binding.masm @@ -0,0 +1,874 @@ +# mod miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1 + +@callconv("canon-lift") +pub proc binding( + +) -> (felt, felt, felt, felt) + exec.::miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1::init + trace.240 + nop + exec.::miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1::rust_sdk_account_storage_get_initial_map_item_binding::miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1#binding + trace.252 + nop + push.0 + u32wrapping_add + push.0 + push.0 + dup.2 + u32wrapping_add + u32wrapping_add + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.0 + push.4 + dup.3 + u32wrapping_add + u32wrapping_add + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.0 + push.8 + dup.4 + u32wrapping_add + u32wrapping_add + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.0 + push.12 + movup.5 + u32wrapping_add + u32wrapping_add + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + movdn.3 + swap.2 + exec.::std::sys::truncate_stack +end + +proc init + push.1179648 + trace.240 + exec.::intrinsics::mem::heap_init + trace.252 + push.[7028007876379170725,18060021366771303825,13412364500725888848,14178532912296021363] + adv.push_mapval + push.262144 + push.1 + trace.240 + exec.::std::mem::pipe_preimage_to_memory + trace.252 + drop + push.1048576 + u32assert + mem_store.278536 + push.0 + u32assert + mem_store.278537 +end + +# mod miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1::rust_sdk_account_storage_get_initial_map_item_binding + +@callconv("C") +proc __wasm_call_ctors( + +) + nop +end + +@callconv("C") +proc rust_sdk_account_storage_get_initial_map_item_binding::bindings::__link_custom_section_describing_imports( + +) + nop +end + +@callconv("C") +proc miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1#binding( + +) -> i32 + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.48 + u32wrapping_sub + push.1114144 + dup.1 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + trace.240 + nop + exec.::miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1::rust_sdk_account_storage_get_initial_map_item_binding::wit_bindgen::rt::run_ctors_once + trace.252 + nop + push.0 + trace.240 + nop + exec.::miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1::rust_sdk_account_storage_get_initial_map_item_binding::intrinsics::felt::from_u32 + trace.252 + nop + push.0 + movup.2 + swap.1 + push.1 + while.true + push.0 + push.16 + dup.2 + eq + neq + dup.0 + if.true + swap.1 + drop + push.3735929054 + else + push.32 + dup.3 + u32wrapping_add + dup.2 + u32wrapping_add + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + dup.4 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.4 + movup.2 + u32wrapping_add + end + push.3735929054 + dup.2 + movup.2 + swap.5 + movdn.2 + cdrop + push.3735929054 + dup.2 + dup.4 + swap.2 + swap.1 + cdrop + push.1 + push.0 + movup.4 + cdrop + push.1 + u32and + movup.4 + swap.1 + if.true + movup.3 + drop + push.1 + else + push.0 + end + end + drop + drop + drop + push.44 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.40 + dup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.36 + dup.3 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.32 + dup.4 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.0 + trace.240 + nop + exec.::miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1::rust_sdk_account_storage_get_initial_map_item_binding::>::from + trace.252 + nop + push.16 + dup.6 + u32wrapping_add + movup.2 + swap.4 + movdn.2 + swap.5 + swap.1 + trace.240 + nop + exec.::miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1::rust_sdk_account_storage_get_initial_map_item_binding::miden::active_account::get_initial_map_item + trace.252 + nop + push.24 + dup.1 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.40 + dup.3 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.16 + dup.1 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.32 + dup.3 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.1114148 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.32 + dup.2 + u32wrapping_add + dup.2 + trace.240 + nop + exec.::miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1::rust_sdk_account_storage_get_initial_map_item_binding::miden_stdlib_sys::intrinsics::word::Word::reverse + trace.252 + nop + push.1048584 + u32wrapping_add + push.8 + dup.2 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.8 + dup.3 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + dup.1 + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + dup.2 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.48 + movup.2 + u32wrapping_add + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop +end + +@callconv("C") +proc wit_bindgen::rt::run_ctors_once( + +) + push.1114148 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.1048600 + u32wrapping_add + u32divmod.4 + swap.1 + swap.1 + dup.1 + mem_load + swap.1 + push.8 + u32wrapping_mul + u32shr + swap.1 + drop + push.255 + u32and + push.0 + swap.1 + neq + if.true + nop + else + push.1114148 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + trace.240 + nop + exec.::miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1::rust_sdk_account_storage_get_initial_map_item_binding::__wasm_call_ctors + trace.252 + nop + push.1 + push.1048600 + movup.2 + u32wrapping_add + u32divmod.4 + swap.1 + dup.0 + mem_load + dup.2 + push.8 + u32wrapping_mul + push.255 + swap.1 + u32shl + u32not + swap.1 + u32and + movup.3 + movup.3 + push.8 + u32wrapping_mul + u32shl + u32or + swap.1 + mem_store + end +end + +@callconv("C") +proc >::from( + i32 +) -> felt + push.255 + u32and +end + +@callconv("C") +proc miden_stdlib_sys::intrinsics::word::Word::reverse( + i32, + i32 +) + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.16 + u32wrapping_sub + push.8 + dup.3 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.8 + dup.3 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + movup.2 + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + dup.2 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.12 + dup.1 + u32wrapping_add + push.0 + movup.2 + swap.1 + push.1 + while.true + push.0 + push.8 + dup.2 + eq + neq + dup.0 + if.true + movup.3 + movup.2 + drop + drop + push.3735929054 + dup.0 + else + dup.2 + dup.2 + u32wrapping_add + dup.0 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + dup.5 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + movup.2 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + dup.4 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.4294967292 + movup.4 + u32wrapping_add + push.4 + movup.3 + u32wrapping_add + end + push.3735929054 + dup.3 + dup.6 + swap.2 + swap.1 + cdrop + push.3735929054 + dup.4 + dup.6 + swap.2 + swap.1 + cdrop + push.1 + push.0 + movup.6 + cdrop + push.1 + u32and + swap.1 + swap.2 + swap.4 + swap.3 + swap.1 + if.true + movup.4 + drop + movup.4 + drop + push.1 + else + push.0 + end + end + drop + drop + drop + drop + push.8 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.8 + dup.4 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + movup.2 + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop +end + +@callconv("C") +proc intrinsics::felt::from_u32(i32) -> felt + nop +end + +@callconv("C") +proc miden::active_account::get_initial_map_item( + felt, + felt, + felt, + felt, + felt, + i32 +) + trace.240 + nop + exec.::miden::active_account::get_initial_map_item + trace.252 + nop + movup.4 + dup.0 + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.4 + dup.1 + add + u32assert + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.8 + dup.1 + add + u32assert + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.12 + add + u32assert + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop +end + diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_storage_get_initial_map_item_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_account_storage_get_initial_map_item_binding.wat new file mode 100644 index 000000000..276c8cb58 --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_storage_get_initial_map_item_binding.wat @@ -0,0 +1,234 @@ +(component + (type (;0;) + (instance + (type (;0;) (record (field "inner" f32))) + (export (;1;) "felt" (type (eq 0))) + (type (;2;) (tuple 1 1 1 1)) + (type (;3;) (record (field "inner" 2))) + (export (;4;) "word" (type (eq 3))) + ) + ) + (import "miden:base/core-types@1.0.0" (instance (;0;) (type 0))) + (core module (;0;) + (type (;0;) (func)) + (type (;1;) (func (result i32))) + (type (;2;) (func (param i32) (result f32))) + (type (;3;) (func (param i32 i32))) + (type (;4;) (func (param f32 f32 f32 f32 f32 i32))) + (table (;0;) 2 2 funcref) + (memory (;0;) 17) + (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) + (global $GOT.data.internal.__memory_base (;1;) i32 i32.const 0) + (export "memory" (memory 0)) + (export "miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1#binding" (func $miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1#binding)) + (elem (;0;) (i32.const 1) func $rust_sdk_account_storage_get_initial_map_item_binding::bindings::__link_custom_section_describing_imports) + (func $__wasm_call_ctors (;0;) (type 0)) + (func $rust_sdk_account_storage_get_initial_map_item_binding::bindings::__link_custom_section_describing_imports (;1;) (type 0)) + (func $miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1#binding (;2;) (type 1) (result i32) + (local i32 i32 f32 f32 f32 f32) + global.get $__stack_pointer + i32.const 48 + i32.sub + local.tee 0 + global.set $__stack_pointer + call $wit_bindgen::rt::run_ctors_once + i32.const 0 + local.set 1 + i32.const 0 + call $intrinsics::felt::from_u32 + local.set 2 + block ;; label = @1 + loop ;; label = @2 + local.get 1 + i32.const 16 + i32.eq + br_if 1 (;@1;) + local.get 0 + i32.const 32 + i32.add + local.get 1 + i32.add + local.get 2 + f32.store + local.get 1 + i32.const 4 + i32.add + local.set 1 + br 0 (;@2;) + end + end + local.get 0 + f32.load offset=44 + local.set 2 + local.get 0 + f32.load offset=40 + local.set 3 + local.get 0 + f32.load offset=36 + local.set 4 + local.get 0 + f32.load offset=32 + local.set 5 + i32.const 0 + call $>::from + local.get 2 + local.get 3 + local.get 4 + local.get 5 + local.get 0 + i32.const 16 + i32.add + call $miden::active_account::get_initial_map_item + local.get 0 + local.get 0 + i64.load offset=24 + i64.store offset=40 + local.get 0 + local.get 0 + i64.load offset=16 + i64.store offset=32 + global.get $GOT.data.internal.__memory_base + local.set 1 + local.get 0 + local.get 0 + i32.const 32 + i32.add + call $miden_stdlib_sys::intrinsics::word::Word::reverse + local.get 1 + i32.const 1048584 + i32.add + local.tee 1 + local.get 0 + i64.load offset=8 + i64.store offset=8 align=4 + local.get 1 + local.get 0 + i64.load + i64.store align=4 + local.get 0 + i32.const 48 + i32.add + global.set $__stack_pointer + local.get 1 + ) + (func $wit_bindgen::rt::run_ctors_once (;3;) (type 0) + (local i32) + block ;; label = @1 + global.get $GOT.data.internal.__memory_base + i32.const 1048600 + i32.add + i32.load8_u + br_if 0 (;@1;) + global.get $GOT.data.internal.__memory_base + local.set 0 + call $__wasm_call_ctors + local.get 0 + i32.const 1048600 + i32.add + i32.const 1 + i32.store8 + end + ) + (func $>::from (;4;) (type 2) (param i32) (result f32) + local.get 0 + i32.const 255 + i32.and + f32.reinterpret_i32 + ) + (func $miden_stdlib_sys::intrinsics::word::Word::reverse (;5;) (type 3) (param i32 i32) + (local i32 i32 i32 f32) + global.get $__stack_pointer + i32.const 16 + i32.sub + local.tee 2 + local.get 1 + i64.load offset=8 + i64.store offset=8 align=4 + local.get 2 + local.get 1 + i64.load + i64.store align=4 + local.get 2 + i32.const 12 + i32.add + local.set 3 + i32.const 0 + local.set 1 + block ;; label = @1 + loop ;; label = @2 + local.get 1 + i32.const 8 + i32.eq + br_if 1 (;@1;) + local.get 2 + local.get 1 + i32.add + local.tee 4 + f32.load + local.set 5 + local.get 4 + local.get 3 + i32.load + i32.store + local.get 3 + local.get 5 + f32.store + local.get 1 + i32.const 4 + i32.add + local.set 1 + local.get 3 + i32.const -4 + i32.add + local.set 3 + br 0 (;@2;) + end + end + local.get 0 + local.get 2 + i64.load offset=8 align=4 + i64.store offset=8 + local.get 0 + local.get 2 + i64.load align=4 + i64.store + ) + (func $intrinsics::felt::from_u32 (;6;) (type 2) (param i32) (result f32) + unreachable + ) + (func $miden::active_account::get_initial_map_item (;7;) (type 4) (param f32 f32 f32 f32 f32 i32) + unreachable + ) + (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") + (@custom "rodata,miden_account" (after data) "krust_sdk_account_storage_get_initial_map_item_binding\01\0b0.0.1\03\01\01") + ) + (alias export 0 "word" (type (;1;))) + (core instance (;0;) (instantiate 0)) + (alias core export 0 "memory" (core memory (;0;))) + (type (;2;) (func (result 1))) + (alias core export 0 "miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1#binding" (core func (;0;))) + (func (;0;) (type 2) (canon lift (core func 0) (memory 0))) + (alias export 0 "felt" (type (;3;))) + (alias export 0 "word" (type (;4;))) + (component (;0;) + (type (;0;) (record (field "inner" f32))) + (import "import-type-felt" (type (;1;) (eq 0))) + (type (;2;) (tuple 1 1 1 1)) + (type (;3;) (record (field "inner" 2))) + (import "import-type-word" (type (;4;) (eq 3))) + (import "import-type-word0" (type (;5;) (eq 4))) + (type (;6;) (func (result 5))) + (import "import-func-binding" (func (;0;) (type 6))) + (export (;7;) "word" (type 4)) + (type (;8;) (func (result 7))) + (export (;1;) "binding" (func 0) (func (type 8))) + ) + (instance (;1;) (instantiate 0 + (with "import-func-binding" (func 0)) + (with "import-type-felt" (type 3)) + (with "import-type-word" (type 4)) + (with "import-type-word0" (type 1)) + ) + ) + (export (;2;) "miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1" (instance 1)) +) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_block_commitment_binding.hir b/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_block_commitment_binding.hir new file mode 100644 index 000000000..c91a372b1 --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_block_commitment_binding.hir @@ -0,0 +1,283 @@ +builtin.component miden:base/transaction-script@1.0.0 { + builtin.module public @rust_sdk_account_tx_get_block_commitment_binding { + private builtin.function @__wasm_call_ctors() { + ^block5: + builtin.ret ; + }; + + private builtin.function @rust_sdk_account_tx_get_block_commitment_binding::bindings::__link_custom_section_describing_imports() { + ^block7: + builtin.ret ; + }; + + private builtin.function @miden:base/transaction-script@1.0.0#run(v0: felt, v1: felt, v2: felt, v3: felt) { + ^block9(v0: felt, v1: felt, v2: felt, v3: felt): + v5 = builtin.global_symbol @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_block_commitment_binding/__stack_pointer : ptr + v6 = hir.bitcast v5 : ptr; + v7 = hir.load v6 : i32; + v8 = arith.constant 16 : i32; + v9 = arith.sub v7, v8 : i32 #[overflow = wrapping]; + v10 = builtin.global_symbol @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_block_commitment_binding/__stack_pointer : ptr + v11 = hir.bitcast v10 : ptr; + hir.store v11, v9; + hir.exec @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_block_commitment_binding/wit_bindgen::rt::run_ctors_once() + hir.exec @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_block_commitment_binding/miden_base_sys::bindings::tx::get_block_commitment(v9) + v187 = arith.constant 16 : i32; + v13 = arith.add v9, v187 : i32 #[overflow = wrapping]; + v14 = builtin.global_symbol @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_block_commitment_binding/__stack_pointer : ptr + v15 = hir.bitcast v14 : ptr; + hir.store v15, v13; + builtin.ret ; + }; + + private builtin.function @wit_bindgen::rt::run_ctors_once() { + ^block11: + v17 = builtin.global_symbol @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_block_commitment_binding/GOT.data.internal.__memory_base : ptr + v18 = hir.bitcast v17 : ptr; + v19 = hir.load v18 : i32; + v20 = arith.constant 1048584 : i32; + v21 = arith.add v19, v20 : i32 #[overflow = wrapping]; + v22 = hir.bitcast v21 : u32; + v23 = hir.int_to_ptr v22 : ptr; + v24 = hir.load v23 : u8; + v16 = arith.constant 0 : i32; + v25 = arith.zext v24 : u32; + v26 = hir.bitcast v25 : i32; + v28 = arith.neq v26, v16 : i1; + scf.if v28{ + ^block13: + scf.yield ; + } else { + ^block14: + v29 = builtin.global_symbol @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_block_commitment_binding/GOT.data.internal.__memory_base : ptr + v30 = hir.bitcast v29 : ptr; + v31 = hir.load v30 : i32; + hir.exec @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_block_commitment_binding/__wasm_call_ctors() + v189 = arith.constant 1 : u8; + v191 = arith.constant 1048584 : i32; + v33 = arith.add v31, v191 : i32 #[overflow = wrapping]; + v37 = hir.bitcast v33 : u32; + v38 = hir.int_to_ptr v37 : ptr; + hir.store v38, v189; + scf.yield ; + }; + builtin.ret ; + }; + + private builtin.function @miden_base_sys::bindings::tx::get_block_commitment(v39: i32) { + ^block15(v39: i32): + v41 = builtin.global_symbol @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_block_commitment_binding/__stack_pointer : ptr + v42 = hir.bitcast v41 : ptr; + v43 = hir.load v42 : i32; + v44 = arith.constant 32 : i32; + v45 = arith.sub v43, v44 : i32 #[overflow = wrapping]; + v46 = builtin.global_symbol @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_block_commitment_binding/__stack_pointer : ptr + v47 = hir.bitcast v46 : ptr; + hir.store v47, v45; + hir.exec @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_block_commitment_binding/miden::tx::get_block_commitment(v45) + v49 = arith.constant 8 : u32; + v48 = hir.bitcast v45 : u32; + v50 = arith.add v48, v49 : u32 #[overflow = checked]; + v196 = arith.constant 8 : u32; + v52 = arith.mod v50, v196 : u32; + hir.assertz v52 #[code = 250]; + v53 = hir.int_to_ptr v50 : ptr; + v54 = hir.load v53 : i64; + v56 = arith.constant 24 : u32; + v55 = hir.bitcast v45 : u32; + v57 = arith.add v55, v56 : u32 #[overflow = checked]; + v195 = arith.constant 8 : u32; + v59 = arith.mod v57, v195 : u32; + hir.assertz v59 #[code = 250]; + v60 = hir.int_to_ptr v57 : ptr; + hir.store v60, v54; + v61 = hir.bitcast v45 : u32; + v194 = arith.constant 8 : u32; + v63 = arith.mod v61, v194 : u32; + hir.assertz v63 #[code = 250]; + v64 = hir.int_to_ptr v61 : ptr; + v65 = hir.load v64 : i64; + v67 = arith.constant 16 : u32; + v66 = hir.bitcast v45 : u32; + v68 = arith.add v66, v67 : u32 #[overflow = checked]; + v193 = arith.constant 8 : u32; + v70 = arith.mod v68, v193 : u32; + hir.assertz v70 #[code = 250]; + v71 = hir.int_to_ptr v68 : ptr; + hir.store v71, v65; + v72 = arith.constant 16 : i32; + v73 = arith.add v45, v72 : i32 #[overflow = wrapping]; + hir.exec @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_block_commitment_binding/miden_stdlib_sys::intrinsics::word::Word::reverse(v39, v73) + v192 = arith.constant 32 : i32; + v75 = arith.add v45, v192 : i32 #[overflow = wrapping]; + v76 = builtin.global_symbol @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_block_commitment_binding/__stack_pointer : ptr + v77 = hir.bitcast v76 : ptr; + hir.store v77, v75; + builtin.ret ; + }; + + private builtin.function @miden_stdlib_sys::intrinsics::word::Word::reverse(v78: i32, v79: i32) { + ^block17(v78: i32, v79: i32): + v82 = builtin.global_symbol @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_block_commitment_binding/__stack_pointer : ptr + v83 = hir.bitcast v82 : ptr; + v84 = hir.load v83 : i32; + v85 = arith.constant 16 : i32; + v86 = arith.sub v84, v85 : i32 #[overflow = wrapping]; + v88 = arith.constant 8 : u32; + v87 = hir.bitcast v79 : u32; + v89 = arith.add v87, v88 : u32 #[overflow = checked]; + v283 = arith.constant 8 : u32; + v91 = arith.mod v89, v283 : u32; + hir.assertz v91 #[code = 250]; + v92 = hir.int_to_ptr v89 : ptr; + v93 = hir.load v92 : i64; + v282 = arith.constant 8 : u32; + v94 = hir.bitcast v86 : u32; + v96 = arith.add v94, v282 : u32 #[overflow = checked]; + v97 = arith.constant 4 : u32; + v98 = arith.mod v96, v97 : u32; + hir.assertz v98 #[code = 250]; + v99 = hir.int_to_ptr v96 : ptr; + hir.store v99, v93; + v100 = hir.bitcast v79 : u32; + v281 = arith.constant 8 : u32; + v102 = arith.mod v100, v281 : u32; + hir.assertz v102 #[code = 250]; + v103 = hir.int_to_ptr v100 : ptr; + v104 = hir.load v103 : i64; + v105 = hir.bitcast v86 : u32; + v280 = arith.constant 4 : u32; + v107 = arith.mod v105, v280 : u32; + hir.assertz v107 #[code = 250]; + v108 = hir.int_to_ptr v105 : ptr; + hir.store v108, v104; + v109 = arith.constant 12 : i32; + v110 = arith.add v86, v109 : i32 #[overflow = wrapping]; + v80 = arith.constant 0 : i32; + v251, v252, v253, v254, v255, v256 = scf.while v80, v86, v110, v78 : i32, i32, i32, i32, i32, i32 { + ^block37(v257: i32, v258: i32, v259: i32, v260: i32): + v279 = arith.constant 0 : i32; + v113 = arith.constant 8 : i32; + v114 = arith.eq v257, v113 : i1; + v115 = arith.zext v114 : u32; + v116 = hir.bitcast v115 : i32; + v118 = arith.neq v116, v279 : i1; + v245, v246 = scf.if v118 : i32, i32 { + ^block36: + v205 = ub.poison i32 : i32; + scf.yield v205, v205; + } else { + ^block22: + v120 = arith.add v258, v257 : i32 #[overflow = wrapping]; + v121 = hir.bitcast v120 : u32; + v278 = arith.constant 4 : u32; + v123 = arith.mod v121, v278 : u32; + hir.assertz v123 #[code = 250]; + v124 = hir.int_to_ptr v121 : ptr; + v125 = hir.load v124 : felt; + v127 = hir.bitcast v259 : u32; + v277 = arith.constant 4 : u32; + v129 = arith.mod v127, v277 : u32; + hir.assertz v129 #[code = 250]; + v130 = hir.int_to_ptr v127 : ptr; + v131 = hir.load v130 : i32; + v132 = hir.bitcast v120 : u32; + v276 = arith.constant 4 : u32; + v134 = arith.mod v132, v276 : u32; + hir.assertz v134 #[code = 250]; + v135 = hir.int_to_ptr v132 : ptr; + hir.store v135, v131; + v136 = hir.bitcast v259 : u32; + v275 = arith.constant 4 : u32; + v138 = arith.mod v136, v275 : u32; + hir.assertz v138 #[code = 250]; + v139 = hir.int_to_ptr v136 : ptr; + hir.store v139, v125; + v142 = arith.constant -4 : i32; + v143 = arith.add v259, v142 : i32 #[overflow = wrapping]; + v140 = arith.constant 4 : i32; + v141 = arith.add v257, v140 : i32 #[overflow = wrapping]; + scf.yield v141, v143; + }; + v273 = ub.poison i32 : i32; + v248 = cf.select v118, v273, v260 : i32; + v274 = ub.poison i32 : i32; + v247 = cf.select v118, v274, v258 : i32; + v204 = arith.constant 1 : u32; + v197 = arith.constant 0 : u32; + v250 = cf.select v118, v197, v204 : u32; + v238 = arith.trunc v250 : i1; + scf.condition v238, v245, v247, v246, v248, v258, v260; + } do { + ^block38(v261: i32, v262: i32, v263: i32, v264: i32, v265: i32, v266: i32): + scf.yield v261, v262, v263, v264; + }; + v272 = arith.constant 8 : u32; + v145 = hir.bitcast v255 : u32; + v147 = arith.add v145, v272 : u32 #[overflow = checked]; + v271 = arith.constant 4 : u32; + v149 = arith.mod v147, v271 : u32; + hir.assertz v149 #[code = 250]; + v150 = hir.int_to_ptr v147 : ptr; + v151 = hir.load v150 : i64; + v270 = arith.constant 8 : u32; + v152 = hir.bitcast v256 : u32; + v154 = arith.add v152, v270 : u32 #[overflow = checked]; + v269 = arith.constant 8 : u32; + v156 = arith.mod v154, v269 : u32; + hir.assertz v156 #[code = 250]; + v157 = hir.int_to_ptr v154 : ptr; + hir.store v157, v151; + v158 = hir.bitcast v255 : u32; + v268 = arith.constant 4 : u32; + v160 = arith.mod v158, v268 : u32; + hir.assertz v160 #[code = 250]; + v161 = hir.int_to_ptr v158 : ptr; + v162 = hir.load v161 : i64; + v163 = hir.bitcast v256 : u32; + v267 = arith.constant 8 : u32; + v165 = arith.mod v163, v267 : u32; + hir.assertz v165 #[code = 250]; + v166 = hir.int_to_ptr v163 : ptr; + hir.store v166, v162; + builtin.ret ; + }; + + private builtin.function @miden::tx::get_block_commitment(v167: i32) { + ^block23(v167: i32): + v168, v169, v170, v171 = hir.exec @miden/tx/get_block_commitment() : felt, felt, felt, felt + v172 = hir.bitcast v167 : u32; + v173 = hir.int_to_ptr v172 : ptr; + hir.store v173, v168; + v174 = arith.constant 4 : u32; + v175 = arith.add v172, v174 : u32 #[overflow = checked]; + v176 = hir.int_to_ptr v175 : ptr; + hir.store v176, v169; + v177 = arith.constant 8 : u32; + v178 = arith.add v172, v177 : u32 #[overflow = checked]; + v179 = hir.int_to_ptr v178 : ptr; + hir.store v179, v170; + v180 = arith.constant 12 : u32; + v181 = arith.add v172, v180 : u32 #[overflow = checked]; + v182 = hir.int_to_ptr v181 : ptr; + hir.store v182, v171; + builtin.ret ; + }; + + builtin.global_variable private @#__stack_pointer : i32 { + builtin.ret_imm 1048576; + }; + + builtin.global_variable private @#GOT.data.internal.__memory_base : i32 { + builtin.ret_imm 0; + }; + + builtin.segment @1048576 = 0x0000000100000001; + }; + + public builtin.function @run(v183: felt, v184: felt, v185: felt, v186: felt) { + ^block27(v183: felt, v184: felt, v185: felt, v186: felt): + hir.exec @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_block_commitment_binding/miden:base/transaction-script@1.0.0#run(v183, v184, v185, v186) + builtin.ret ; + }; +}; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_block_commitment_binding.masm b/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_block_commitment_binding.masm new file mode 100644 index 000000000..21e5fbcc8 --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_block_commitment_binding.masm @@ -0,0 +1,610 @@ +# mod miden:base/transaction-script@1.0.0 + +@callconv("canon-lift") +pub proc run(felt, felt, felt, felt) + exec.::miden:base/transaction-script@1.0.0::init + trace.240 + nop + exec.::miden:base/transaction-script@1.0.0::rust_sdk_account_tx_get_block_commitment_binding::miden:base/transaction-script@1.0.0#run + trace.252 + nop + exec.::std::sys::truncate_stack +end + +proc init + push.1179648 + trace.240 + exec.::intrinsics::mem::heap_init + trace.252 + push.[7028007876379170725,18060021366771303825,13412364500725888848,14178532912296021363] + adv.push_mapval + push.262144 + push.1 + trace.240 + exec.::std::mem::pipe_preimage_to_memory + trace.252 + drop + push.1048576 + u32assert + mem_store.278536 + push.0 + u32assert + mem_store.278537 +end + +# mod miden:base/transaction-script@1.0.0::rust_sdk_account_tx_get_block_commitment_binding + +@callconv("C") +proc __wasm_call_ctors( + +) + nop +end + +@callconv("C") +proc rust_sdk_account_tx_get_block_commitment_binding::bindings::__link_custom_section_describing_imports( + +) + nop +end + +@callconv("C") +proc miden:base/transaction-script@1.0.0#run(felt, felt, felt, felt) + drop + drop + drop + drop + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.16 + u32wrapping_sub + push.1114144 + dup.1 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + trace.240 + nop + exec.::miden:base/transaction-script@1.0.0::rust_sdk_account_tx_get_block_commitment_binding::wit_bindgen::rt::run_ctors_once + trace.252 + nop + dup.0 + trace.240 + nop + exec.::miden:base/transaction-script@1.0.0::rust_sdk_account_tx_get_block_commitment_binding::miden_base_sys::bindings::tx::get_block_commitment + trace.252 + nop + push.16 + u32wrapping_add + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop +end + +@callconv("C") +proc wit_bindgen::rt::run_ctors_once( + +) + push.1114148 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.1048584 + u32wrapping_add + u32divmod.4 + swap.1 + swap.1 + dup.1 + mem_load + swap.1 + push.8 + u32wrapping_mul + u32shr + swap.1 + drop + push.255 + u32and + push.0 + swap.1 + neq + if.true + nop + else + push.1114148 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + trace.240 + nop + exec.::miden:base/transaction-script@1.0.0::rust_sdk_account_tx_get_block_commitment_binding::__wasm_call_ctors + trace.252 + nop + push.1 + push.1048584 + movup.2 + u32wrapping_add + u32divmod.4 + swap.1 + dup.0 + mem_load + dup.2 + push.8 + u32wrapping_mul + push.255 + swap.1 + u32shl + u32not + swap.1 + u32and + movup.3 + movup.3 + push.8 + u32wrapping_mul + u32shl + u32or + swap.1 + mem_store + end +end + +@callconv("C") +proc miden_base_sys::bindings::tx::get_block_commitment( + i32 +) + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.32 + u32wrapping_sub + push.1114144 + dup.1 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + dup.0 + trace.240 + nop + exec.::miden:base/transaction-script@1.0.0::rust_sdk_account_tx_get_block_commitment_binding::miden::tx::get_block_commitment + trace.252 + nop + push.8 + dup.1 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.24 + dup.3 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + dup.0 + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.16 + dup.3 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.16 + dup.1 + u32wrapping_add + movup.2 + trace.240 + nop + exec.::miden:base/transaction-script@1.0.0::rust_sdk_account_tx_get_block_commitment_binding::miden_stdlib_sys::intrinsics::word::Word::reverse + trace.252 + nop + push.32 + u32wrapping_add + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop +end + +@callconv("C") +proc miden_stdlib_sys::intrinsics::word::Word::reverse( + i32, + i32 +) + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.16 + u32wrapping_sub + push.8 + dup.3 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.8 + dup.3 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + movup.2 + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + dup.2 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.12 + dup.1 + u32wrapping_add + push.0 + movup.2 + swap.1 + push.1 + while.true + push.0 + push.8 + dup.2 + eq + neq + dup.0 + if.true + movup.3 + movup.2 + drop + drop + push.3735929054 + dup.0 + else + dup.2 + dup.2 + u32wrapping_add + dup.0 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + dup.5 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + movup.2 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + dup.4 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.4294967292 + movup.4 + u32wrapping_add + push.4 + movup.3 + u32wrapping_add + end + push.3735929054 + dup.3 + dup.6 + swap.2 + swap.1 + cdrop + push.3735929054 + dup.4 + dup.6 + swap.2 + swap.1 + cdrop + push.1 + push.0 + movup.6 + cdrop + push.1 + u32and + swap.1 + swap.2 + swap.4 + swap.3 + swap.1 + if.true + movup.4 + drop + movup.4 + drop + push.1 + else + push.0 + end + end + drop + drop + drop + drop + push.8 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.8 + dup.4 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + movup.2 + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop +end + +@callconv("C") +proc miden::tx::get_block_commitment(i32) + trace.240 + nop + exec.::miden::tx::get_block_commitment + trace.252 + nop + movup.4 + dup.0 + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.4 + dup.1 + add + u32assert + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.8 + dup.1 + add + u32assert + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.12 + add + u32assert + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop +end + diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_block_commitment_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_block_commitment_binding.wat new file mode 100644 index 000000000..e0a6b2573 --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_block_commitment_binding.wat @@ -0,0 +1,178 @@ +(component + (type (;0;) + (instance + (type (;0;) (record (field "inner" f32))) + (export (;1;) "felt" (type (eq 0))) + (type (;2;) (tuple 1 1 1 1)) + (type (;3;) (record (field "inner" 2))) + (export (;4;) "word" (type (eq 3))) + ) + ) + (import "miden:base/core-types@1.0.0" (instance (;0;) (type 0))) + (core module (;0;) + (type (;0;) (func)) + (type (;1;) (func (param f32 f32 f32 f32))) + (type (;2;) (func (param i32))) + (type (;3;) (func (param i32 i32))) + (table (;0;) 2 2 funcref) + (memory (;0;) 17) + (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) + (global $GOT.data.internal.__memory_base (;1;) i32 i32.const 0) + (export "memory" (memory 0)) + (export "miden:base/transaction-script@1.0.0#run" (func $miden:base/transaction-script@1.0.0#run)) + (elem (;0;) (i32.const 1) func $rust_sdk_account_tx_get_block_commitment_binding::bindings::__link_custom_section_describing_imports) + (func $__wasm_call_ctors (;0;) (type 0)) + (func $rust_sdk_account_tx_get_block_commitment_binding::bindings::__link_custom_section_describing_imports (;1;) (type 0)) + (func $miden:base/transaction-script@1.0.0#run (;2;) (type 1) (param f32 f32 f32 f32) + (local i32) + global.get $__stack_pointer + i32.const 16 + i32.sub + local.tee 4 + global.set $__stack_pointer + call $wit_bindgen::rt::run_ctors_once + local.get 4 + call $miden_base_sys::bindings::tx::get_block_commitment + local.get 4 + i32.const 16 + i32.add + global.set $__stack_pointer + ) + (func $wit_bindgen::rt::run_ctors_once (;3;) (type 0) + (local i32) + block ;; label = @1 + global.get $GOT.data.internal.__memory_base + i32.const 1048584 + i32.add + i32.load8_u + br_if 0 (;@1;) + global.get $GOT.data.internal.__memory_base + local.set 0 + call $__wasm_call_ctors + local.get 0 + i32.const 1048584 + i32.add + i32.const 1 + i32.store8 + end + ) + (func $miden_base_sys::bindings::tx::get_block_commitment (;4;) (type 2) (param i32) + (local i32) + global.get $__stack_pointer + i32.const 32 + i32.sub + local.tee 1 + global.set $__stack_pointer + local.get 1 + call $miden::tx::get_block_commitment + local.get 1 + local.get 1 + i64.load offset=8 + i64.store offset=24 + local.get 1 + local.get 1 + i64.load + i64.store offset=16 + local.get 0 + local.get 1 + i32.const 16 + i32.add + call $miden_stdlib_sys::intrinsics::word::Word::reverse + local.get 1 + i32.const 32 + i32.add + global.set $__stack_pointer + ) + (func $miden_stdlib_sys::intrinsics::word::Word::reverse (;5;) (type 3) (param i32 i32) + (local i32 i32 i32 f32) + global.get $__stack_pointer + i32.const 16 + i32.sub + local.tee 2 + local.get 1 + i64.load offset=8 + i64.store offset=8 align=4 + local.get 2 + local.get 1 + i64.load + i64.store align=4 + local.get 2 + i32.const 12 + i32.add + local.set 3 + i32.const 0 + local.set 1 + block ;; label = @1 + loop ;; label = @2 + local.get 1 + i32.const 8 + i32.eq + br_if 1 (;@1;) + local.get 2 + local.get 1 + i32.add + local.tee 4 + f32.load + local.set 5 + local.get 4 + local.get 3 + i32.load + i32.store + local.get 3 + local.get 5 + f32.store + local.get 1 + i32.const 4 + i32.add + local.set 1 + local.get 3 + i32.const -4 + i32.add + local.set 3 + br 0 (;@2;) + end + end + local.get 0 + local.get 2 + i64.load offset=8 align=4 + i64.store offset=8 + local.get 0 + local.get 2 + i64.load align=4 + i64.store + ) + (func $miden::tx::get_block_commitment (;6;) (type 2) (param i32) + unreachable + ) + (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") + ) + (alias export 0 "word" (type (;1;))) + (core instance (;0;) (instantiate 0)) + (alias core export 0 "memory" (core memory (;0;))) + (type (;2;) (func (param "arg" 1))) + (alias core export 0 "miden:base/transaction-script@1.0.0#run" (core func (;0;))) + (func (;0;) (type 2) (canon lift (core func 0))) + (alias export 0 "felt" (type (;3;))) + (alias export 0 "word" (type (;4;))) + (component (;0;) + (type (;0;) (record (field "inner" f32))) + (import "import-type-felt" (type (;1;) (eq 0))) + (type (;2;) (tuple 1 1 1 1)) + (type (;3;) (record (field "inner" 2))) + (import "import-type-word" (type (;4;) (eq 3))) + (import "import-type-word0" (type (;5;) (eq 4))) + (type (;6;) (func (param "arg" 5))) + (import "import-func-run" (func (;0;) (type 6))) + (export (;7;) "word" (type 4)) + (type (;8;) (func (param "arg" 7))) + (export (;1;) "run" (func 0) (func (type 8))) + ) + (instance (;1;) (instantiate 0 + (with "import-func-run" (func 0)) + (with "import-type-felt" (type 3)) + (with "import-type-word" (type 4)) + (with "import-type-word0" (type 1)) + ) + ) + (export (;2;) "miden:base/transaction-script@1.0.0" (instance 1)) +) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_block_number_binding.hir b/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_block_number_binding.hir new file mode 100644 index 000000000..039af3aaa --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_block_number_binding.hir @@ -0,0 +1,82 @@ +builtin.component miden:base/transaction-script@1.0.0 { + builtin.module public @rust_sdk_account_tx_get_block_number_binding { + private builtin.function @__wasm_call_ctors() { + ^block5: + builtin.ret ; + }; + + private builtin.function @rust_sdk_account_tx_get_block_number_binding::bindings::__link_custom_section_describing_imports() { + ^block7: + builtin.ret ; + }; + + private builtin.function @miden:base/transaction-script@1.0.0#run(v0: felt, v1: felt, v2: felt, v3: felt) { + ^block9(v0: felt, v1: felt, v2: felt, v3: felt): + hir.exec @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_block_number_binding/wit_bindgen::rt::run_ctors_once() + v4 = hir.exec @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_block_number_binding/miden_base_sys::bindings::tx::get_block_number() : felt + builtin.ret ; + }; + + private builtin.function @wit_bindgen::rt::run_ctors_once() { + ^block11: + v6 = builtin.global_symbol @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_block_number_binding/GOT.data.internal.__memory_base : ptr + v7 = hir.bitcast v6 : ptr; + v8 = hir.load v7 : i32; + v9 = arith.constant 1048584 : i32; + v10 = arith.add v8, v9 : i32 #[overflow = wrapping]; + v11 = hir.bitcast v10 : u32; + v12 = hir.int_to_ptr v11 : ptr; + v13 = hir.load v12 : u8; + v5 = arith.constant 0 : i32; + v14 = arith.zext v13 : u32; + v15 = hir.bitcast v14 : i32; + v17 = arith.neq v15, v5 : i1; + scf.if v17{ + ^block13: + scf.yield ; + } else { + ^block14: + v18 = builtin.global_symbol @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_block_number_binding/GOT.data.internal.__memory_base : ptr + v19 = hir.bitcast v18 : ptr; + v20 = hir.load v19 : i32; + hir.exec @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_block_number_binding/__wasm_call_ctors() + v37 = arith.constant 1 : u8; + v39 = arith.constant 1048584 : i32; + v22 = arith.add v20, v39 : i32 #[overflow = wrapping]; + v26 = hir.bitcast v22 : u32; + v27 = hir.int_to_ptr v26 : ptr; + hir.store v27, v37; + scf.yield ; + }; + builtin.ret ; + }; + + private builtin.function @miden_base_sys::bindings::tx::get_block_number() -> felt { + ^block15: + v29 = hir.exec @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_block_number_binding/miden::tx::get_block_number() : felt + builtin.ret v29; + }; + + private builtin.function @miden::tx::get_block_number() -> felt { + ^block17: + v30 = hir.exec @miden/tx/get_block_number() : felt + builtin.ret v30; + }; + + builtin.global_variable private @#__stack_pointer : i32 { + builtin.ret_imm 1048576; + }; + + builtin.global_variable private @#GOT.data.internal.__memory_base : i32 { + builtin.ret_imm 0; + }; + + builtin.segment @1048576 = 0x0000000100000001; + }; + + public builtin.function @run(v32: felt, v33: felt, v34: felt, v35: felt) { + ^block21(v32: felt, v33: felt, v34: felt, v35: felt): + hir.exec @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_block_number_binding/miden:base/transaction-script@1.0.0#run(v32, v33, v34, v35) + builtin.ret ; + }; +}; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_block_number_binding.masm b/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_block_number_binding.masm new file mode 100644 index 000000000..31e2bba78 --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_block_number_binding.masm @@ -0,0 +1,165 @@ +# mod miden:base/transaction-script@1.0.0 + +@callconv("canon-lift") +pub proc run(felt, felt, felt, felt) + exec.::miden:base/transaction-script@1.0.0::init + trace.240 + nop + exec.::miden:base/transaction-script@1.0.0::rust_sdk_account_tx_get_block_number_binding::miden:base/transaction-script@1.0.0#run + trace.252 + nop + exec.::std::sys::truncate_stack +end + +proc init + push.1179648 + trace.240 + exec.::intrinsics::mem::heap_init + trace.252 + push.[7028007876379170725,18060021366771303825,13412364500725888848,14178532912296021363] + adv.push_mapval + push.262144 + push.1 + trace.240 + exec.::std::mem::pipe_preimage_to_memory + trace.252 + drop + push.1048576 + u32assert + mem_store.278536 + push.0 + u32assert + mem_store.278537 +end + +# mod miden:base/transaction-script@1.0.0::rust_sdk_account_tx_get_block_number_binding + +@callconv("C") +proc __wasm_call_ctors( + +) + nop +end + +@callconv("C") +proc rust_sdk_account_tx_get_block_number_binding::bindings::__link_custom_section_describing_imports( + +) + nop +end + +@callconv("C") +proc miden:base/transaction-script@1.0.0#run(felt, felt, felt, felt) + drop + drop + drop + drop + trace.240 + nop + exec.::miden:base/transaction-script@1.0.0::rust_sdk_account_tx_get_block_number_binding::wit_bindgen::rt::run_ctors_once + trace.252 + nop + trace.240 + nop + exec.::miden:base/transaction-script@1.0.0::rust_sdk_account_tx_get_block_number_binding::miden_base_sys::bindings::tx::get_block_number + trace.252 + nop + drop +end + +@callconv("C") +proc wit_bindgen::rt::run_ctors_once( + +) + push.1114148 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.1048584 + u32wrapping_add + u32divmod.4 + swap.1 + swap.1 + dup.1 + mem_load + swap.1 + push.8 + u32wrapping_mul + u32shr + swap.1 + drop + push.255 + u32and + push.0 + swap.1 + neq + if.true + nop + else + push.1114148 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + trace.240 + nop + exec.::miden:base/transaction-script@1.0.0::rust_sdk_account_tx_get_block_number_binding::__wasm_call_ctors + trace.252 + nop + push.1 + push.1048584 + movup.2 + u32wrapping_add + u32divmod.4 + swap.1 + dup.0 + mem_load + dup.2 + push.8 + u32wrapping_mul + push.255 + swap.1 + u32shl + u32not + swap.1 + u32and + movup.3 + movup.3 + push.8 + u32wrapping_mul + u32shl + u32or + swap.1 + mem_store + end +end + +@callconv("C") +proc miden_base_sys::bindings::tx::get_block_number( + +) -> felt + trace.240 + nop + exec.::miden:base/transaction-script@1.0.0::rust_sdk_account_tx_get_block_number_binding::miden::tx::get_block_number + trace.252 + nop +end + +@callconv("C") +proc miden::tx::get_block_number( + +) -> felt + trace.240 + nop + exec.::miden::tx::get_block_number + trace.252 + nop +end + diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_block_number_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_block_number_binding.wat new file mode 100644 index 000000000..b9ef305d9 --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_block_number_binding.wat @@ -0,0 +1,85 @@ +(component + (type (;0;) + (instance + (type (;0;) (record (field "inner" f32))) + (export (;1;) "felt" (type (eq 0))) + (type (;2;) (tuple 1 1 1 1)) + (type (;3;) (record (field "inner" 2))) + (export (;4;) "word" (type (eq 3))) + ) + ) + (import "miden:base/core-types@1.0.0" (instance (;0;) (type 0))) + (core module (;0;) + (type (;0;) (func)) + (type (;1;) (func (param f32 f32 f32 f32))) + (type (;2;) (func (result f32))) + (table (;0;) 2 2 funcref) + (memory (;0;) 17) + (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) + (global $GOT.data.internal.__memory_base (;1;) i32 i32.const 0) + (export "memory" (memory 0)) + (export "miden:base/transaction-script@1.0.0#run" (func $miden:base/transaction-script@1.0.0#run)) + (elem (;0;) (i32.const 1) func $rust_sdk_account_tx_get_block_number_binding::bindings::__link_custom_section_describing_imports) + (func $__wasm_call_ctors (;0;) (type 0)) + (func $rust_sdk_account_tx_get_block_number_binding::bindings::__link_custom_section_describing_imports (;1;) (type 0)) + (func $miden:base/transaction-script@1.0.0#run (;2;) (type 1) (param f32 f32 f32 f32) + call $wit_bindgen::rt::run_ctors_once + call $miden_base_sys::bindings::tx::get_block_number + drop + ) + (func $wit_bindgen::rt::run_ctors_once (;3;) (type 0) + (local i32) + block ;; label = @1 + global.get $GOT.data.internal.__memory_base + i32.const 1048584 + i32.add + i32.load8_u + br_if 0 (;@1;) + global.get $GOT.data.internal.__memory_base + local.set 0 + call $__wasm_call_ctors + local.get 0 + i32.const 1048584 + i32.add + i32.const 1 + i32.store8 + end + ) + (func $miden_base_sys::bindings::tx::get_block_number (;4;) (type 2) (result f32) + call $miden::tx::get_block_number + ) + (func $miden::tx::get_block_number (;5;) (type 2) (result f32) + unreachable + ) + (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") + ) + (alias export 0 "word" (type (;1;))) + (core instance (;0;) (instantiate 0)) + (alias core export 0 "memory" (core memory (;0;))) + (type (;2;) (func (param "arg" 1))) + (alias core export 0 "miden:base/transaction-script@1.0.0#run" (core func (;0;))) + (func (;0;) (type 2) (canon lift (core func 0))) + (alias export 0 "felt" (type (;3;))) + (alias export 0 "word" (type (;4;))) + (component (;0;) + (type (;0;) (record (field "inner" f32))) + (import "import-type-felt" (type (;1;) (eq 0))) + (type (;2;) (tuple 1 1 1 1)) + (type (;3;) (record (field "inner" 2))) + (import "import-type-word" (type (;4;) (eq 3))) + (import "import-type-word0" (type (;5;) (eq 4))) + (type (;6;) (func (param "arg" 5))) + (import "import-func-run" (func (;0;) (type 6))) + (export (;7;) "word" (type 4)) + (type (;8;) (func (param "arg" 7))) + (export (;1;) "run" (func 0) (func (type 8))) + ) + (instance (;1;) (instantiate 0 + (with "import-func-run" (func 0)) + (with "import-type-felt" (type 3)) + (with "import-type-word" (type 4)) + (with "import-type-word0" (type 1)) + ) + ) + (export (;2;) "miden:base/transaction-script@1.0.0" (instance 1)) +) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_block_timestamp_binding.hir b/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_block_timestamp_binding.hir new file mode 100644 index 000000000..f3bd546d6 --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_block_timestamp_binding.hir @@ -0,0 +1,82 @@ +builtin.component miden:base/transaction-script@1.0.0 { + builtin.module public @rust_sdk_account_tx_get_block_timestamp_binding { + private builtin.function @__wasm_call_ctors() { + ^block5: + builtin.ret ; + }; + + private builtin.function @rust_sdk_account_tx_get_block_timestamp_binding::bindings::__link_custom_section_describing_imports() { + ^block7: + builtin.ret ; + }; + + private builtin.function @miden:base/transaction-script@1.0.0#run(v0: felt, v1: felt, v2: felt, v3: felt) { + ^block9(v0: felt, v1: felt, v2: felt, v3: felt): + hir.exec @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_block_timestamp_binding/wit_bindgen::rt::run_ctors_once() + v4 = hir.exec @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_block_timestamp_binding/miden_base_sys::bindings::tx::get_block_timestamp() : felt + builtin.ret ; + }; + + private builtin.function @wit_bindgen::rt::run_ctors_once() { + ^block11: + v6 = builtin.global_symbol @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_block_timestamp_binding/GOT.data.internal.__memory_base : ptr + v7 = hir.bitcast v6 : ptr; + v8 = hir.load v7 : i32; + v9 = arith.constant 1048584 : i32; + v10 = arith.add v8, v9 : i32 #[overflow = wrapping]; + v11 = hir.bitcast v10 : u32; + v12 = hir.int_to_ptr v11 : ptr; + v13 = hir.load v12 : u8; + v5 = arith.constant 0 : i32; + v14 = arith.zext v13 : u32; + v15 = hir.bitcast v14 : i32; + v17 = arith.neq v15, v5 : i1; + scf.if v17{ + ^block13: + scf.yield ; + } else { + ^block14: + v18 = builtin.global_symbol @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_block_timestamp_binding/GOT.data.internal.__memory_base : ptr + v19 = hir.bitcast v18 : ptr; + v20 = hir.load v19 : i32; + hir.exec @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_block_timestamp_binding/__wasm_call_ctors() + v37 = arith.constant 1 : u8; + v39 = arith.constant 1048584 : i32; + v22 = arith.add v20, v39 : i32 #[overflow = wrapping]; + v26 = hir.bitcast v22 : u32; + v27 = hir.int_to_ptr v26 : ptr; + hir.store v27, v37; + scf.yield ; + }; + builtin.ret ; + }; + + private builtin.function @miden_base_sys::bindings::tx::get_block_timestamp() -> felt { + ^block15: + v29 = hir.exec @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_block_timestamp_binding/miden::tx::get_block_timestamp() : felt + builtin.ret v29; + }; + + private builtin.function @miden::tx::get_block_timestamp() -> felt { + ^block17: + v30 = hir.exec @miden/tx/get_block_timestamp() : felt + builtin.ret v30; + }; + + builtin.global_variable private @#__stack_pointer : i32 { + builtin.ret_imm 1048576; + }; + + builtin.global_variable private @#GOT.data.internal.__memory_base : i32 { + builtin.ret_imm 0; + }; + + builtin.segment @1048576 = 0x0000000100000001; + }; + + public builtin.function @run(v32: felt, v33: felt, v34: felt, v35: felt) { + ^block21(v32: felt, v33: felt, v34: felt, v35: felt): + hir.exec @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_block_timestamp_binding/miden:base/transaction-script@1.0.0#run(v32, v33, v34, v35) + builtin.ret ; + }; +}; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_block_timestamp_binding.masm b/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_block_timestamp_binding.masm new file mode 100644 index 000000000..8a6ca578f --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_block_timestamp_binding.masm @@ -0,0 +1,165 @@ +# mod miden:base/transaction-script@1.0.0 + +@callconv("canon-lift") +pub proc run(felt, felt, felt, felt) + exec.::miden:base/transaction-script@1.0.0::init + trace.240 + nop + exec.::miden:base/transaction-script@1.0.0::rust_sdk_account_tx_get_block_timestamp_binding::miden:base/transaction-script@1.0.0#run + trace.252 + nop + exec.::std::sys::truncate_stack +end + +proc init + push.1179648 + trace.240 + exec.::intrinsics::mem::heap_init + trace.252 + push.[7028007876379170725,18060021366771303825,13412364500725888848,14178532912296021363] + adv.push_mapval + push.262144 + push.1 + trace.240 + exec.::std::mem::pipe_preimage_to_memory + trace.252 + drop + push.1048576 + u32assert + mem_store.278536 + push.0 + u32assert + mem_store.278537 +end + +# mod miden:base/transaction-script@1.0.0::rust_sdk_account_tx_get_block_timestamp_binding + +@callconv("C") +proc __wasm_call_ctors( + +) + nop +end + +@callconv("C") +proc rust_sdk_account_tx_get_block_timestamp_binding::bindings::__link_custom_section_describing_imports( + +) + nop +end + +@callconv("C") +proc miden:base/transaction-script@1.0.0#run(felt, felt, felt, felt) + drop + drop + drop + drop + trace.240 + nop + exec.::miden:base/transaction-script@1.0.0::rust_sdk_account_tx_get_block_timestamp_binding::wit_bindgen::rt::run_ctors_once + trace.252 + nop + trace.240 + nop + exec.::miden:base/transaction-script@1.0.0::rust_sdk_account_tx_get_block_timestamp_binding::miden_base_sys::bindings::tx::get_block_timestamp + trace.252 + nop + drop +end + +@callconv("C") +proc wit_bindgen::rt::run_ctors_once( + +) + push.1114148 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.1048584 + u32wrapping_add + u32divmod.4 + swap.1 + swap.1 + dup.1 + mem_load + swap.1 + push.8 + u32wrapping_mul + u32shr + swap.1 + drop + push.255 + u32and + push.0 + swap.1 + neq + if.true + nop + else + push.1114148 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + trace.240 + nop + exec.::miden:base/transaction-script@1.0.0::rust_sdk_account_tx_get_block_timestamp_binding::__wasm_call_ctors + trace.252 + nop + push.1 + push.1048584 + movup.2 + u32wrapping_add + u32divmod.4 + swap.1 + dup.0 + mem_load + dup.2 + push.8 + u32wrapping_mul + push.255 + swap.1 + u32shl + u32not + swap.1 + u32and + movup.3 + movup.3 + push.8 + u32wrapping_mul + u32shl + u32or + swap.1 + mem_store + end +end + +@callconv("C") +proc miden_base_sys::bindings::tx::get_block_timestamp( + +) -> felt + trace.240 + nop + exec.::miden:base/transaction-script@1.0.0::rust_sdk_account_tx_get_block_timestamp_binding::miden::tx::get_block_timestamp + trace.252 + nop +end + +@callconv("C") +proc miden::tx::get_block_timestamp( + +) -> felt + trace.240 + nop + exec.::miden::tx::get_block_timestamp + trace.252 + nop +end + diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_block_timestamp_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_block_timestamp_binding.wat new file mode 100644 index 000000000..96d17327b --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_block_timestamp_binding.wat @@ -0,0 +1,85 @@ +(component + (type (;0;) + (instance + (type (;0;) (record (field "inner" f32))) + (export (;1;) "felt" (type (eq 0))) + (type (;2;) (tuple 1 1 1 1)) + (type (;3;) (record (field "inner" 2))) + (export (;4;) "word" (type (eq 3))) + ) + ) + (import "miden:base/core-types@1.0.0" (instance (;0;) (type 0))) + (core module (;0;) + (type (;0;) (func)) + (type (;1;) (func (param f32 f32 f32 f32))) + (type (;2;) (func (result f32))) + (table (;0;) 2 2 funcref) + (memory (;0;) 17) + (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) + (global $GOT.data.internal.__memory_base (;1;) i32 i32.const 0) + (export "memory" (memory 0)) + (export "miden:base/transaction-script@1.0.0#run" (func $miden:base/transaction-script@1.0.0#run)) + (elem (;0;) (i32.const 1) func $rust_sdk_account_tx_get_block_timestamp_binding::bindings::__link_custom_section_describing_imports) + (func $__wasm_call_ctors (;0;) (type 0)) + (func $rust_sdk_account_tx_get_block_timestamp_binding::bindings::__link_custom_section_describing_imports (;1;) (type 0)) + (func $miden:base/transaction-script@1.0.0#run (;2;) (type 1) (param f32 f32 f32 f32) + call $wit_bindgen::rt::run_ctors_once + call $miden_base_sys::bindings::tx::get_block_timestamp + drop + ) + (func $wit_bindgen::rt::run_ctors_once (;3;) (type 0) + (local i32) + block ;; label = @1 + global.get $GOT.data.internal.__memory_base + i32.const 1048584 + i32.add + i32.load8_u + br_if 0 (;@1;) + global.get $GOT.data.internal.__memory_base + local.set 0 + call $__wasm_call_ctors + local.get 0 + i32.const 1048584 + i32.add + i32.const 1 + i32.store8 + end + ) + (func $miden_base_sys::bindings::tx::get_block_timestamp (;4;) (type 2) (result f32) + call $miden::tx::get_block_timestamp + ) + (func $miden::tx::get_block_timestamp (;5;) (type 2) (result f32) + unreachable + ) + (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") + ) + (alias export 0 "word" (type (;1;))) + (core instance (;0;) (instantiate 0)) + (alias core export 0 "memory" (core memory (;0;))) + (type (;2;) (func (param "arg" 1))) + (alias core export 0 "miden:base/transaction-script@1.0.0#run" (core func (;0;))) + (func (;0;) (type 2) (canon lift (core func 0))) + (alias export 0 "felt" (type (;3;))) + (alias export 0 "word" (type (;4;))) + (component (;0;) + (type (;0;) (record (field "inner" f32))) + (import "import-type-felt" (type (;1;) (eq 0))) + (type (;2;) (tuple 1 1 1 1)) + (type (;3;) (record (field "inner" 2))) + (import "import-type-word" (type (;4;) (eq 3))) + (import "import-type-word0" (type (;5;) (eq 4))) + (type (;6;) (func (param "arg" 5))) + (import "import-func-run" (func (;0;) (type 6))) + (export (;7;) "word" (type 4)) + (type (;8;) (func (param "arg" 7))) + (export (;1;) "run" (func 0) (func (type 8))) + ) + (instance (;1;) (instantiate 0 + (with "import-func-run" (func 0)) + (with "import-type-felt" (type 3)) + (with "import-type-word" (type 4)) + (with "import-type-word0" (type 1)) + ) + ) + (export (;2;) "miden:base/transaction-script@1.0.0" (instance 1)) +) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_expiration_block_delta_binding.hir b/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_expiration_block_delta_binding.hir new file mode 100644 index 000000000..ea8af3c25 --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_expiration_block_delta_binding.hir @@ -0,0 +1,82 @@ +builtin.component miden:base/transaction-script@1.0.0 { + builtin.module public @rust_sdk_account_tx_get_expiration_block_delta_binding { + private builtin.function @__wasm_call_ctors() { + ^block5: + builtin.ret ; + }; + + private builtin.function @rust_sdk_account_tx_get_expiration_block_delta_binding::bindings::__link_custom_section_describing_imports() { + ^block7: + builtin.ret ; + }; + + private builtin.function @miden:base/transaction-script@1.0.0#run(v0: felt, v1: felt, v2: felt, v3: felt) { + ^block9(v0: felt, v1: felt, v2: felt, v3: felt): + hir.exec @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_expiration_block_delta_binding/wit_bindgen::rt::run_ctors_once() + v4 = hir.exec @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_expiration_block_delta_binding/miden_base_sys::bindings::tx::get_expiration_block_delta() : felt + builtin.ret ; + }; + + private builtin.function @wit_bindgen::rt::run_ctors_once() { + ^block11: + v6 = builtin.global_symbol @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_expiration_block_delta_binding/GOT.data.internal.__memory_base : ptr + v7 = hir.bitcast v6 : ptr; + v8 = hir.load v7 : i32; + v9 = arith.constant 1048584 : i32; + v10 = arith.add v8, v9 : i32 #[overflow = wrapping]; + v11 = hir.bitcast v10 : u32; + v12 = hir.int_to_ptr v11 : ptr; + v13 = hir.load v12 : u8; + v5 = arith.constant 0 : i32; + v14 = arith.zext v13 : u32; + v15 = hir.bitcast v14 : i32; + v17 = arith.neq v15, v5 : i1; + scf.if v17{ + ^block13: + scf.yield ; + } else { + ^block14: + v18 = builtin.global_symbol @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_expiration_block_delta_binding/GOT.data.internal.__memory_base : ptr + v19 = hir.bitcast v18 : ptr; + v20 = hir.load v19 : i32; + hir.exec @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_expiration_block_delta_binding/__wasm_call_ctors() + v37 = arith.constant 1 : u8; + v39 = arith.constant 1048584 : i32; + v22 = arith.add v20, v39 : i32 #[overflow = wrapping]; + v26 = hir.bitcast v22 : u32; + v27 = hir.int_to_ptr v26 : ptr; + hir.store v27, v37; + scf.yield ; + }; + builtin.ret ; + }; + + private builtin.function @miden_base_sys::bindings::tx::get_expiration_block_delta() -> felt { + ^block15: + v29 = hir.exec @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_expiration_block_delta_binding/miden::tx::get_expiration_block_delta() : felt + builtin.ret v29; + }; + + private builtin.function @miden::tx::get_expiration_block_delta() -> felt { + ^block17: + v30 = hir.exec @miden/tx/get_expiration_block_delta() : felt + builtin.ret v30; + }; + + builtin.global_variable private @#__stack_pointer : i32 { + builtin.ret_imm 1048576; + }; + + builtin.global_variable private @#GOT.data.internal.__memory_base : i32 { + builtin.ret_imm 0; + }; + + builtin.segment @1048576 = 0x0000000100000001; + }; + + public builtin.function @run(v32: felt, v33: felt, v34: felt, v35: felt) { + ^block21(v32: felt, v33: felt, v34: felt, v35: felt): + hir.exec @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_expiration_block_delta_binding/miden:base/transaction-script@1.0.0#run(v32, v33, v34, v35) + builtin.ret ; + }; +}; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_expiration_block_delta_binding.masm b/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_expiration_block_delta_binding.masm new file mode 100644 index 000000000..f3adcf86d --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_expiration_block_delta_binding.masm @@ -0,0 +1,165 @@ +# mod miden:base/transaction-script@1.0.0 + +@callconv("canon-lift") +pub proc run(felt, felt, felt, felt) + exec.::miden:base/transaction-script@1.0.0::init + trace.240 + nop + exec.::miden:base/transaction-script@1.0.0::rust_sdk_account_tx_get_expiration_block_delta_binding::miden:base/transaction-script@1.0.0#run + trace.252 + nop + exec.::std::sys::truncate_stack +end + +proc init + push.1179648 + trace.240 + exec.::intrinsics::mem::heap_init + trace.252 + push.[7028007876379170725,18060021366771303825,13412364500725888848,14178532912296021363] + adv.push_mapval + push.262144 + push.1 + trace.240 + exec.::std::mem::pipe_preimage_to_memory + trace.252 + drop + push.1048576 + u32assert + mem_store.278536 + push.0 + u32assert + mem_store.278537 +end + +# mod miden:base/transaction-script@1.0.0::rust_sdk_account_tx_get_expiration_block_delta_binding + +@callconv("C") +proc __wasm_call_ctors( + +) + nop +end + +@callconv("C") +proc rust_sdk_account_tx_get_expiration_block_delta_binding::bindings::__link_custom_section_describing_imports( + +) + nop +end + +@callconv("C") +proc miden:base/transaction-script@1.0.0#run(felt, felt, felt, felt) + drop + drop + drop + drop + trace.240 + nop + exec.::miden:base/transaction-script@1.0.0::rust_sdk_account_tx_get_expiration_block_delta_binding::wit_bindgen::rt::run_ctors_once + trace.252 + nop + trace.240 + nop + exec.::miden:base/transaction-script@1.0.0::rust_sdk_account_tx_get_expiration_block_delta_binding::miden_base_sys::bindings::tx::get_expiration_block_delta + trace.252 + nop + drop +end + +@callconv("C") +proc wit_bindgen::rt::run_ctors_once( + +) + push.1114148 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.1048584 + u32wrapping_add + u32divmod.4 + swap.1 + swap.1 + dup.1 + mem_load + swap.1 + push.8 + u32wrapping_mul + u32shr + swap.1 + drop + push.255 + u32and + push.0 + swap.1 + neq + if.true + nop + else + push.1114148 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + trace.240 + nop + exec.::miden:base/transaction-script@1.0.0::rust_sdk_account_tx_get_expiration_block_delta_binding::__wasm_call_ctors + trace.252 + nop + push.1 + push.1048584 + movup.2 + u32wrapping_add + u32divmod.4 + swap.1 + dup.0 + mem_load + dup.2 + push.8 + u32wrapping_mul + push.255 + swap.1 + u32shl + u32not + swap.1 + u32and + movup.3 + movup.3 + push.8 + u32wrapping_mul + u32shl + u32or + swap.1 + mem_store + end +end + +@callconv("C") +proc miden_base_sys::bindings::tx::get_expiration_block_delta( + +) -> felt + trace.240 + nop + exec.::miden:base/transaction-script@1.0.0::rust_sdk_account_tx_get_expiration_block_delta_binding::miden::tx::get_expiration_block_delta + trace.252 + nop +end + +@callconv("C") +proc miden::tx::get_expiration_block_delta( + +) -> felt + trace.240 + nop + exec.::miden::tx::get_expiration_block_delta + trace.252 + nop +end + diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_expiration_block_delta_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_expiration_block_delta_binding.wat new file mode 100644 index 000000000..f9e7d65c2 --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_expiration_block_delta_binding.wat @@ -0,0 +1,85 @@ +(component + (type (;0;) + (instance + (type (;0;) (record (field "inner" f32))) + (export (;1;) "felt" (type (eq 0))) + (type (;2;) (tuple 1 1 1 1)) + (type (;3;) (record (field "inner" 2))) + (export (;4;) "word" (type (eq 3))) + ) + ) + (import "miden:base/core-types@1.0.0" (instance (;0;) (type 0))) + (core module (;0;) + (type (;0;) (func)) + (type (;1;) (func (param f32 f32 f32 f32))) + (type (;2;) (func (result f32))) + (table (;0;) 2 2 funcref) + (memory (;0;) 17) + (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) + (global $GOT.data.internal.__memory_base (;1;) i32 i32.const 0) + (export "memory" (memory 0)) + (export "miden:base/transaction-script@1.0.0#run" (func $miden:base/transaction-script@1.0.0#run)) + (elem (;0;) (i32.const 1) func $rust_sdk_account_tx_get_expiration_block_delta_binding::bindings::__link_custom_section_describing_imports) + (func $__wasm_call_ctors (;0;) (type 0)) + (func $rust_sdk_account_tx_get_expiration_block_delta_binding::bindings::__link_custom_section_describing_imports (;1;) (type 0)) + (func $miden:base/transaction-script@1.0.0#run (;2;) (type 1) (param f32 f32 f32 f32) + call $wit_bindgen::rt::run_ctors_once + call $miden_base_sys::bindings::tx::get_expiration_block_delta + drop + ) + (func $wit_bindgen::rt::run_ctors_once (;3;) (type 0) + (local i32) + block ;; label = @1 + global.get $GOT.data.internal.__memory_base + i32.const 1048584 + i32.add + i32.load8_u + br_if 0 (;@1;) + global.get $GOT.data.internal.__memory_base + local.set 0 + call $__wasm_call_ctors + local.get 0 + i32.const 1048584 + i32.add + i32.const 1 + i32.store8 + end + ) + (func $miden_base_sys::bindings::tx::get_expiration_block_delta (;4;) (type 2) (result f32) + call $miden::tx::get_expiration_block_delta + ) + (func $miden::tx::get_expiration_block_delta (;5;) (type 2) (result f32) + unreachable + ) + (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") + ) + (alias export 0 "word" (type (;1;))) + (core instance (;0;) (instantiate 0)) + (alias core export 0 "memory" (core memory (;0;))) + (type (;2;) (func (param "arg" 1))) + (alias core export 0 "miden:base/transaction-script@1.0.0#run" (core func (;0;))) + (func (;0;) (type 2) (canon lift (core func 0))) + (alias export 0 "felt" (type (;3;))) + (alias export 0 "word" (type (;4;))) + (component (;0;) + (type (;0;) (record (field "inner" f32))) + (import "import-type-felt" (type (;1;) (eq 0))) + (type (;2;) (tuple 1 1 1 1)) + (type (;3;) (record (field "inner" 2))) + (import "import-type-word" (type (;4;) (eq 3))) + (import "import-type-word0" (type (;5;) (eq 4))) + (type (;6;) (func (param "arg" 5))) + (import "import-func-run" (func (;0;) (type 6))) + (export (;7;) "word" (type 4)) + (type (;8;) (func (param "arg" 7))) + (export (;1;) "run" (func 0) (func (type 8))) + ) + (instance (;1;) (instantiate 0 + (with "import-func-run" (func 0)) + (with "import-type-felt" (type 3)) + (with "import-type-word" (type 4)) + (with "import-type-word0" (type 1)) + ) + ) + (export (;2;) "miden:base/transaction-script@1.0.0" (instance 1)) +) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_input_notes_commitment_binding.hir b/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_input_notes_commitment_binding.hir new file mode 100644 index 000000000..5c1169117 --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_input_notes_commitment_binding.hir @@ -0,0 +1,283 @@ +builtin.component miden:base/transaction-script@1.0.0 { + builtin.module public @rust_sdk_account_tx_get_input_notes_commitment_binding { + private builtin.function @__wasm_call_ctors() { + ^block5: + builtin.ret ; + }; + + private builtin.function @rust_sdk_account_tx_get_input_notes_commitment_binding::bindings::__link_custom_section_describing_imports() { + ^block7: + builtin.ret ; + }; + + private builtin.function @miden:base/transaction-script@1.0.0#run(v0: felt, v1: felt, v2: felt, v3: felt) { + ^block9(v0: felt, v1: felt, v2: felt, v3: felt): + v5 = builtin.global_symbol @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_input_notes_commitment_binding/__stack_pointer : ptr + v6 = hir.bitcast v5 : ptr; + v7 = hir.load v6 : i32; + v8 = arith.constant 16 : i32; + v9 = arith.sub v7, v8 : i32 #[overflow = wrapping]; + v10 = builtin.global_symbol @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_input_notes_commitment_binding/__stack_pointer : ptr + v11 = hir.bitcast v10 : ptr; + hir.store v11, v9; + hir.exec @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_input_notes_commitment_binding/wit_bindgen::rt::run_ctors_once() + hir.exec @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_input_notes_commitment_binding/miden_base_sys::bindings::tx::get_input_notes_commitment(v9) + v187 = arith.constant 16 : i32; + v13 = arith.add v9, v187 : i32 #[overflow = wrapping]; + v14 = builtin.global_symbol @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_input_notes_commitment_binding/__stack_pointer : ptr + v15 = hir.bitcast v14 : ptr; + hir.store v15, v13; + builtin.ret ; + }; + + private builtin.function @wit_bindgen::rt::run_ctors_once() { + ^block11: + v17 = builtin.global_symbol @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_input_notes_commitment_binding/GOT.data.internal.__memory_base : ptr + v18 = hir.bitcast v17 : ptr; + v19 = hir.load v18 : i32; + v20 = arith.constant 1048584 : i32; + v21 = arith.add v19, v20 : i32 #[overflow = wrapping]; + v22 = hir.bitcast v21 : u32; + v23 = hir.int_to_ptr v22 : ptr; + v24 = hir.load v23 : u8; + v16 = arith.constant 0 : i32; + v25 = arith.zext v24 : u32; + v26 = hir.bitcast v25 : i32; + v28 = arith.neq v26, v16 : i1; + scf.if v28{ + ^block13: + scf.yield ; + } else { + ^block14: + v29 = builtin.global_symbol @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_input_notes_commitment_binding/GOT.data.internal.__memory_base : ptr + v30 = hir.bitcast v29 : ptr; + v31 = hir.load v30 : i32; + hir.exec @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_input_notes_commitment_binding/__wasm_call_ctors() + v189 = arith.constant 1 : u8; + v191 = arith.constant 1048584 : i32; + v33 = arith.add v31, v191 : i32 #[overflow = wrapping]; + v37 = hir.bitcast v33 : u32; + v38 = hir.int_to_ptr v37 : ptr; + hir.store v38, v189; + scf.yield ; + }; + builtin.ret ; + }; + + private builtin.function @miden_base_sys::bindings::tx::get_input_notes_commitment(v39: i32) { + ^block15(v39: i32): + v41 = builtin.global_symbol @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_input_notes_commitment_binding/__stack_pointer : ptr + v42 = hir.bitcast v41 : ptr; + v43 = hir.load v42 : i32; + v44 = arith.constant 32 : i32; + v45 = arith.sub v43, v44 : i32 #[overflow = wrapping]; + v46 = builtin.global_symbol @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_input_notes_commitment_binding/__stack_pointer : ptr + v47 = hir.bitcast v46 : ptr; + hir.store v47, v45; + hir.exec @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_input_notes_commitment_binding/miden::tx::get_input_notes_commitment(v45) + v49 = arith.constant 8 : u32; + v48 = hir.bitcast v45 : u32; + v50 = arith.add v48, v49 : u32 #[overflow = checked]; + v196 = arith.constant 8 : u32; + v52 = arith.mod v50, v196 : u32; + hir.assertz v52 #[code = 250]; + v53 = hir.int_to_ptr v50 : ptr; + v54 = hir.load v53 : i64; + v56 = arith.constant 24 : u32; + v55 = hir.bitcast v45 : u32; + v57 = arith.add v55, v56 : u32 #[overflow = checked]; + v195 = arith.constant 8 : u32; + v59 = arith.mod v57, v195 : u32; + hir.assertz v59 #[code = 250]; + v60 = hir.int_to_ptr v57 : ptr; + hir.store v60, v54; + v61 = hir.bitcast v45 : u32; + v194 = arith.constant 8 : u32; + v63 = arith.mod v61, v194 : u32; + hir.assertz v63 #[code = 250]; + v64 = hir.int_to_ptr v61 : ptr; + v65 = hir.load v64 : i64; + v67 = arith.constant 16 : u32; + v66 = hir.bitcast v45 : u32; + v68 = arith.add v66, v67 : u32 #[overflow = checked]; + v193 = arith.constant 8 : u32; + v70 = arith.mod v68, v193 : u32; + hir.assertz v70 #[code = 250]; + v71 = hir.int_to_ptr v68 : ptr; + hir.store v71, v65; + v72 = arith.constant 16 : i32; + v73 = arith.add v45, v72 : i32 #[overflow = wrapping]; + hir.exec @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_input_notes_commitment_binding/miden_stdlib_sys::intrinsics::word::Word::reverse(v39, v73) + v192 = arith.constant 32 : i32; + v75 = arith.add v45, v192 : i32 #[overflow = wrapping]; + v76 = builtin.global_symbol @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_input_notes_commitment_binding/__stack_pointer : ptr + v77 = hir.bitcast v76 : ptr; + hir.store v77, v75; + builtin.ret ; + }; + + private builtin.function @miden_stdlib_sys::intrinsics::word::Word::reverse(v78: i32, v79: i32) { + ^block17(v78: i32, v79: i32): + v82 = builtin.global_symbol @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_input_notes_commitment_binding/__stack_pointer : ptr + v83 = hir.bitcast v82 : ptr; + v84 = hir.load v83 : i32; + v85 = arith.constant 16 : i32; + v86 = arith.sub v84, v85 : i32 #[overflow = wrapping]; + v88 = arith.constant 8 : u32; + v87 = hir.bitcast v79 : u32; + v89 = arith.add v87, v88 : u32 #[overflow = checked]; + v283 = arith.constant 8 : u32; + v91 = arith.mod v89, v283 : u32; + hir.assertz v91 #[code = 250]; + v92 = hir.int_to_ptr v89 : ptr; + v93 = hir.load v92 : i64; + v282 = arith.constant 8 : u32; + v94 = hir.bitcast v86 : u32; + v96 = arith.add v94, v282 : u32 #[overflow = checked]; + v97 = arith.constant 4 : u32; + v98 = arith.mod v96, v97 : u32; + hir.assertz v98 #[code = 250]; + v99 = hir.int_to_ptr v96 : ptr; + hir.store v99, v93; + v100 = hir.bitcast v79 : u32; + v281 = arith.constant 8 : u32; + v102 = arith.mod v100, v281 : u32; + hir.assertz v102 #[code = 250]; + v103 = hir.int_to_ptr v100 : ptr; + v104 = hir.load v103 : i64; + v105 = hir.bitcast v86 : u32; + v280 = arith.constant 4 : u32; + v107 = arith.mod v105, v280 : u32; + hir.assertz v107 #[code = 250]; + v108 = hir.int_to_ptr v105 : ptr; + hir.store v108, v104; + v109 = arith.constant 12 : i32; + v110 = arith.add v86, v109 : i32 #[overflow = wrapping]; + v80 = arith.constant 0 : i32; + v251, v252, v253, v254, v255, v256 = scf.while v80, v86, v110, v78 : i32, i32, i32, i32, i32, i32 { + ^block37(v257: i32, v258: i32, v259: i32, v260: i32): + v279 = arith.constant 0 : i32; + v113 = arith.constant 8 : i32; + v114 = arith.eq v257, v113 : i1; + v115 = arith.zext v114 : u32; + v116 = hir.bitcast v115 : i32; + v118 = arith.neq v116, v279 : i1; + v245, v246 = scf.if v118 : i32, i32 { + ^block36: + v205 = ub.poison i32 : i32; + scf.yield v205, v205; + } else { + ^block22: + v120 = arith.add v258, v257 : i32 #[overflow = wrapping]; + v121 = hir.bitcast v120 : u32; + v278 = arith.constant 4 : u32; + v123 = arith.mod v121, v278 : u32; + hir.assertz v123 #[code = 250]; + v124 = hir.int_to_ptr v121 : ptr; + v125 = hir.load v124 : felt; + v127 = hir.bitcast v259 : u32; + v277 = arith.constant 4 : u32; + v129 = arith.mod v127, v277 : u32; + hir.assertz v129 #[code = 250]; + v130 = hir.int_to_ptr v127 : ptr; + v131 = hir.load v130 : i32; + v132 = hir.bitcast v120 : u32; + v276 = arith.constant 4 : u32; + v134 = arith.mod v132, v276 : u32; + hir.assertz v134 #[code = 250]; + v135 = hir.int_to_ptr v132 : ptr; + hir.store v135, v131; + v136 = hir.bitcast v259 : u32; + v275 = arith.constant 4 : u32; + v138 = arith.mod v136, v275 : u32; + hir.assertz v138 #[code = 250]; + v139 = hir.int_to_ptr v136 : ptr; + hir.store v139, v125; + v142 = arith.constant -4 : i32; + v143 = arith.add v259, v142 : i32 #[overflow = wrapping]; + v140 = arith.constant 4 : i32; + v141 = arith.add v257, v140 : i32 #[overflow = wrapping]; + scf.yield v141, v143; + }; + v273 = ub.poison i32 : i32; + v248 = cf.select v118, v273, v260 : i32; + v274 = ub.poison i32 : i32; + v247 = cf.select v118, v274, v258 : i32; + v204 = arith.constant 1 : u32; + v197 = arith.constant 0 : u32; + v250 = cf.select v118, v197, v204 : u32; + v238 = arith.trunc v250 : i1; + scf.condition v238, v245, v247, v246, v248, v258, v260; + } do { + ^block38(v261: i32, v262: i32, v263: i32, v264: i32, v265: i32, v266: i32): + scf.yield v261, v262, v263, v264; + }; + v272 = arith.constant 8 : u32; + v145 = hir.bitcast v255 : u32; + v147 = arith.add v145, v272 : u32 #[overflow = checked]; + v271 = arith.constant 4 : u32; + v149 = arith.mod v147, v271 : u32; + hir.assertz v149 #[code = 250]; + v150 = hir.int_to_ptr v147 : ptr; + v151 = hir.load v150 : i64; + v270 = arith.constant 8 : u32; + v152 = hir.bitcast v256 : u32; + v154 = arith.add v152, v270 : u32 #[overflow = checked]; + v269 = arith.constant 8 : u32; + v156 = arith.mod v154, v269 : u32; + hir.assertz v156 #[code = 250]; + v157 = hir.int_to_ptr v154 : ptr; + hir.store v157, v151; + v158 = hir.bitcast v255 : u32; + v268 = arith.constant 4 : u32; + v160 = arith.mod v158, v268 : u32; + hir.assertz v160 #[code = 250]; + v161 = hir.int_to_ptr v158 : ptr; + v162 = hir.load v161 : i64; + v163 = hir.bitcast v256 : u32; + v267 = arith.constant 8 : u32; + v165 = arith.mod v163, v267 : u32; + hir.assertz v165 #[code = 250]; + v166 = hir.int_to_ptr v163 : ptr; + hir.store v166, v162; + builtin.ret ; + }; + + private builtin.function @miden::tx::get_input_notes_commitment(v167: i32) { + ^block23(v167: i32): + v168, v169, v170, v171 = hir.exec @miden/tx/get_input_notes_commitment() : felt, felt, felt, felt + v172 = hir.bitcast v167 : u32; + v173 = hir.int_to_ptr v172 : ptr; + hir.store v173, v168; + v174 = arith.constant 4 : u32; + v175 = arith.add v172, v174 : u32 #[overflow = checked]; + v176 = hir.int_to_ptr v175 : ptr; + hir.store v176, v169; + v177 = arith.constant 8 : u32; + v178 = arith.add v172, v177 : u32 #[overflow = checked]; + v179 = hir.int_to_ptr v178 : ptr; + hir.store v179, v170; + v180 = arith.constant 12 : u32; + v181 = arith.add v172, v180 : u32 #[overflow = checked]; + v182 = hir.int_to_ptr v181 : ptr; + hir.store v182, v171; + builtin.ret ; + }; + + builtin.global_variable private @#__stack_pointer : i32 { + builtin.ret_imm 1048576; + }; + + builtin.global_variable private @#GOT.data.internal.__memory_base : i32 { + builtin.ret_imm 0; + }; + + builtin.segment @1048576 = 0x0000000100000001; + }; + + public builtin.function @run(v183: felt, v184: felt, v185: felt, v186: felt) { + ^block27(v183: felt, v184: felt, v185: felt, v186: felt): + hir.exec @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_input_notes_commitment_binding/miden:base/transaction-script@1.0.0#run(v183, v184, v185, v186) + builtin.ret ; + }; +}; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_input_notes_commitment_binding.masm b/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_input_notes_commitment_binding.masm new file mode 100644 index 000000000..90edaabef --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_input_notes_commitment_binding.masm @@ -0,0 +1,610 @@ +# mod miden:base/transaction-script@1.0.0 + +@callconv("canon-lift") +pub proc run(felt, felt, felt, felt) + exec.::miden:base/transaction-script@1.0.0::init + trace.240 + nop + exec.::miden:base/transaction-script@1.0.0::rust_sdk_account_tx_get_input_notes_commitment_binding::miden:base/transaction-script@1.0.0#run + trace.252 + nop + exec.::std::sys::truncate_stack +end + +proc init + push.1179648 + trace.240 + exec.::intrinsics::mem::heap_init + trace.252 + push.[7028007876379170725,18060021366771303825,13412364500725888848,14178532912296021363] + adv.push_mapval + push.262144 + push.1 + trace.240 + exec.::std::mem::pipe_preimage_to_memory + trace.252 + drop + push.1048576 + u32assert + mem_store.278536 + push.0 + u32assert + mem_store.278537 +end + +# mod miden:base/transaction-script@1.0.0::rust_sdk_account_tx_get_input_notes_commitment_binding + +@callconv("C") +proc __wasm_call_ctors( + +) + nop +end + +@callconv("C") +proc rust_sdk_account_tx_get_input_notes_commitment_binding::bindings::__link_custom_section_describing_imports( + +) + nop +end + +@callconv("C") +proc miden:base/transaction-script@1.0.0#run(felt, felt, felt, felt) + drop + drop + drop + drop + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.16 + u32wrapping_sub + push.1114144 + dup.1 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + trace.240 + nop + exec.::miden:base/transaction-script@1.0.0::rust_sdk_account_tx_get_input_notes_commitment_binding::wit_bindgen::rt::run_ctors_once + trace.252 + nop + dup.0 + trace.240 + nop + exec.::miden:base/transaction-script@1.0.0::rust_sdk_account_tx_get_input_notes_commitment_binding::miden_base_sys::bindings::tx::get_input_notes_commitment + trace.252 + nop + push.16 + u32wrapping_add + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop +end + +@callconv("C") +proc wit_bindgen::rt::run_ctors_once( + +) + push.1114148 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.1048584 + u32wrapping_add + u32divmod.4 + swap.1 + swap.1 + dup.1 + mem_load + swap.1 + push.8 + u32wrapping_mul + u32shr + swap.1 + drop + push.255 + u32and + push.0 + swap.1 + neq + if.true + nop + else + push.1114148 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + trace.240 + nop + exec.::miden:base/transaction-script@1.0.0::rust_sdk_account_tx_get_input_notes_commitment_binding::__wasm_call_ctors + trace.252 + nop + push.1 + push.1048584 + movup.2 + u32wrapping_add + u32divmod.4 + swap.1 + dup.0 + mem_load + dup.2 + push.8 + u32wrapping_mul + push.255 + swap.1 + u32shl + u32not + swap.1 + u32and + movup.3 + movup.3 + push.8 + u32wrapping_mul + u32shl + u32or + swap.1 + mem_store + end +end + +@callconv("C") +proc miden_base_sys::bindings::tx::get_input_notes_commitment( + i32 +) + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.32 + u32wrapping_sub + push.1114144 + dup.1 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + dup.0 + trace.240 + nop + exec.::miden:base/transaction-script@1.0.0::rust_sdk_account_tx_get_input_notes_commitment_binding::miden::tx::get_input_notes_commitment + trace.252 + nop + push.8 + dup.1 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.24 + dup.3 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + dup.0 + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.16 + dup.3 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.16 + dup.1 + u32wrapping_add + movup.2 + trace.240 + nop + exec.::miden:base/transaction-script@1.0.0::rust_sdk_account_tx_get_input_notes_commitment_binding::miden_stdlib_sys::intrinsics::word::Word::reverse + trace.252 + nop + push.32 + u32wrapping_add + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop +end + +@callconv("C") +proc miden_stdlib_sys::intrinsics::word::Word::reverse( + i32, + i32 +) + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.16 + u32wrapping_sub + push.8 + dup.3 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.8 + dup.3 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + movup.2 + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + dup.2 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.12 + dup.1 + u32wrapping_add + push.0 + movup.2 + swap.1 + push.1 + while.true + push.0 + push.8 + dup.2 + eq + neq + dup.0 + if.true + movup.3 + movup.2 + drop + drop + push.3735929054 + dup.0 + else + dup.2 + dup.2 + u32wrapping_add + dup.0 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + dup.5 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + movup.2 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + dup.4 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.4294967292 + movup.4 + u32wrapping_add + push.4 + movup.3 + u32wrapping_add + end + push.3735929054 + dup.3 + dup.6 + swap.2 + swap.1 + cdrop + push.3735929054 + dup.4 + dup.6 + swap.2 + swap.1 + cdrop + push.1 + push.0 + movup.6 + cdrop + push.1 + u32and + swap.1 + swap.2 + swap.4 + swap.3 + swap.1 + if.true + movup.4 + drop + movup.4 + drop + push.1 + else + push.0 + end + end + drop + drop + drop + drop + push.8 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.8 + dup.4 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + movup.2 + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop +end + +@callconv("C") +proc miden::tx::get_input_notes_commitment(i32) + trace.240 + nop + exec.::miden::tx::get_input_notes_commitment + trace.252 + nop + movup.4 + dup.0 + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.4 + dup.1 + add + u32assert + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.8 + dup.1 + add + u32assert + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.12 + add + u32assert + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop +end + diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_input_notes_commitment_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_input_notes_commitment_binding.wat new file mode 100644 index 000000000..8a95faf52 --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_input_notes_commitment_binding.wat @@ -0,0 +1,178 @@ +(component + (type (;0;) + (instance + (type (;0;) (record (field "inner" f32))) + (export (;1;) "felt" (type (eq 0))) + (type (;2;) (tuple 1 1 1 1)) + (type (;3;) (record (field "inner" 2))) + (export (;4;) "word" (type (eq 3))) + ) + ) + (import "miden:base/core-types@1.0.0" (instance (;0;) (type 0))) + (core module (;0;) + (type (;0;) (func)) + (type (;1;) (func (param f32 f32 f32 f32))) + (type (;2;) (func (param i32))) + (type (;3;) (func (param i32 i32))) + (table (;0;) 2 2 funcref) + (memory (;0;) 17) + (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) + (global $GOT.data.internal.__memory_base (;1;) i32 i32.const 0) + (export "memory" (memory 0)) + (export "miden:base/transaction-script@1.0.0#run" (func $miden:base/transaction-script@1.0.0#run)) + (elem (;0;) (i32.const 1) func $rust_sdk_account_tx_get_input_notes_commitment_binding::bindings::__link_custom_section_describing_imports) + (func $__wasm_call_ctors (;0;) (type 0)) + (func $rust_sdk_account_tx_get_input_notes_commitment_binding::bindings::__link_custom_section_describing_imports (;1;) (type 0)) + (func $miden:base/transaction-script@1.0.0#run (;2;) (type 1) (param f32 f32 f32 f32) + (local i32) + global.get $__stack_pointer + i32.const 16 + i32.sub + local.tee 4 + global.set $__stack_pointer + call $wit_bindgen::rt::run_ctors_once + local.get 4 + call $miden_base_sys::bindings::tx::get_input_notes_commitment + local.get 4 + i32.const 16 + i32.add + global.set $__stack_pointer + ) + (func $wit_bindgen::rt::run_ctors_once (;3;) (type 0) + (local i32) + block ;; label = @1 + global.get $GOT.data.internal.__memory_base + i32.const 1048584 + i32.add + i32.load8_u + br_if 0 (;@1;) + global.get $GOT.data.internal.__memory_base + local.set 0 + call $__wasm_call_ctors + local.get 0 + i32.const 1048584 + i32.add + i32.const 1 + i32.store8 + end + ) + (func $miden_base_sys::bindings::tx::get_input_notes_commitment (;4;) (type 2) (param i32) + (local i32) + global.get $__stack_pointer + i32.const 32 + i32.sub + local.tee 1 + global.set $__stack_pointer + local.get 1 + call $miden::tx::get_input_notes_commitment + local.get 1 + local.get 1 + i64.load offset=8 + i64.store offset=24 + local.get 1 + local.get 1 + i64.load + i64.store offset=16 + local.get 0 + local.get 1 + i32.const 16 + i32.add + call $miden_stdlib_sys::intrinsics::word::Word::reverse + local.get 1 + i32.const 32 + i32.add + global.set $__stack_pointer + ) + (func $miden_stdlib_sys::intrinsics::word::Word::reverse (;5;) (type 3) (param i32 i32) + (local i32 i32 i32 f32) + global.get $__stack_pointer + i32.const 16 + i32.sub + local.tee 2 + local.get 1 + i64.load offset=8 + i64.store offset=8 align=4 + local.get 2 + local.get 1 + i64.load + i64.store align=4 + local.get 2 + i32.const 12 + i32.add + local.set 3 + i32.const 0 + local.set 1 + block ;; label = @1 + loop ;; label = @2 + local.get 1 + i32.const 8 + i32.eq + br_if 1 (;@1;) + local.get 2 + local.get 1 + i32.add + local.tee 4 + f32.load + local.set 5 + local.get 4 + local.get 3 + i32.load + i32.store + local.get 3 + local.get 5 + f32.store + local.get 1 + i32.const 4 + i32.add + local.set 1 + local.get 3 + i32.const -4 + i32.add + local.set 3 + br 0 (;@2;) + end + end + local.get 0 + local.get 2 + i64.load offset=8 align=4 + i64.store offset=8 + local.get 0 + local.get 2 + i64.load align=4 + i64.store + ) + (func $miden::tx::get_input_notes_commitment (;6;) (type 2) (param i32) + unreachable + ) + (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") + ) + (alias export 0 "word" (type (;1;))) + (core instance (;0;) (instantiate 0)) + (alias core export 0 "memory" (core memory (;0;))) + (type (;2;) (func (param "arg" 1))) + (alias core export 0 "miden:base/transaction-script@1.0.0#run" (core func (;0;))) + (func (;0;) (type 2) (canon lift (core func 0))) + (alias export 0 "felt" (type (;3;))) + (alias export 0 "word" (type (;4;))) + (component (;0;) + (type (;0;) (record (field "inner" f32))) + (import "import-type-felt" (type (;1;) (eq 0))) + (type (;2;) (tuple 1 1 1 1)) + (type (;3;) (record (field "inner" 2))) + (import "import-type-word" (type (;4;) (eq 3))) + (import "import-type-word0" (type (;5;) (eq 4))) + (type (;6;) (func (param "arg" 5))) + (import "import-func-run" (func (;0;) (type 6))) + (export (;7;) "word" (type 4)) + (type (;8;) (func (param "arg" 7))) + (export (;1;) "run" (func 0) (func (type 8))) + ) + (instance (;1;) (instantiate 0 + (with "import-func-run" (func 0)) + (with "import-type-felt" (type 3)) + (with "import-type-word" (type 4)) + (with "import-type-word0" (type 1)) + ) + ) + (export (;2;) "miden:base/transaction-script@1.0.0" (instance 1)) +) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_num_input_notes_binding.hir b/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_num_input_notes_binding.hir new file mode 100644 index 000000000..6c49a6ec8 --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_num_input_notes_binding.hir @@ -0,0 +1,82 @@ +builtin.component miden:base/transaction-script@1.0.0 { + builtin.module public @rust_sdk_account_tx_get_num_input_notes_binding { + private builtin.function @__wasm_call_ctors() { + ^block5: + builtin.ret ; + }; + + private builtin.function @rust_sdk_account_tx_get_num_input_notes_binding::bindings::__link_custom_section_describing_imports() { + ^block7: + builtin.ret ; + }; + + private builtin.function @miden:base/transaction-script@1.0.0#run(v0: felt, v1: felt, v2: felt, v3: felt) { + ^block9(v0: felt, v1: felt, v2: felt, v3: felt): + hir.exec @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_num_input_notes_binding/wit_bindgen::rt::run_ctors_once() + v4 = hir.exec @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_num_input_notes_binding/miden_base_sys::bindings::tx::get_num_input_notes() : felt + builtin.ret ; + }; + + private builtin.function @wit_bindgen::rt::run_ctors_once() { + ^block11: + v6 = builtin.global_symbol @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_num_input_notes_binding/GOT.data.internal.__memory_base : ptr + v7 = hir.bitcast v6 : ptr; + v8 = hir.load v7 : i32; + v9 = arith.constant 1048584 : i32; + v10 = arith.add v8, v9 : i32 #[overflow = wrapping]; + v11 = hir.bitcast v10 : u32; + v12 = hir.int_to_ptr v11 : ptr; + v13 = hir.load v12 : u8; + v5 = arith.constant 0 : i32; + v14 = arith.zext v13 : u32; + v15 = hir.bitcast v14 : i32; + v17 = arith.neq v15, v5 : i1; + scf.if v17{ + ^block13: + scf.yield ; + } else { + ^block14: + v18 = builtin.global_symbol @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_num_input_notes_binding/GOT.data.internal.__memory_base : ptr + v19 = hir.bitcast v18 : ptr; + v20 = hir.load v19 : i32; + hir.exec @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_num_input_notes_binding/__wasm_call_ctors() + v37 = arith.constant 1 : u8; + v39 = arith.constant 1048584 : i32; + v22 = arith.add v20, v39 : i32 #[overflow = wrapping]; + v26 = hir.bitcast v22 : u32; + v27 = hir.int_to_ptr v26 : ptr; + hir.store v27, v37; + scf.yield ; + }; + builtin.ret ; + }; + + private builtin.function @miden_base_sys::bindings::tx::get_num_input_notes() -> felt { + ^block15: + v29 = hir.exec @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_num_input_notes_binding/miden::tx::get_num_input_notes() : felt + builtin.ret v29; + }; + + private builtin.function @miden::tx::get_num_input_notes() -> felt { + ^block17: + v30 = hir.exec @miden/tx/get_num_input_notes() : felt + builtin.ret v30; + }; + + builtin.global_variable private @#__stack_pointer : i32 { + builtin.ret_imm 1048576; + }; + + builtin.global_variable private @#GOT.data.internal.__memory_base : i32 { + builtin.ret_imm 0; + }; + + builtin.segment @1048576 = 0x0000000100000001; + }; + + public builtin.function @run(v32: felt, v33: felt, v34: felt, v35: felt) { + ^block21(v32: felt, v33: felt, v34: felt, v35: felt): + hir.exec @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_num_input_notes_binding/miden:base/transaction-script@1.0.0#run(v32, v33, v34, v35) + builtin.ret ; + }; +}; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_num_input_notes_binding.masm b/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_num_input_notes_binding.masm new file mode 100644 index 000000000..60c8227e3 --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_num_input_notes_binding.masm @@ -0,0 +1,165 @@ +# mod miden:base/transaction-script@1.0.0 + +@callconv("canon-lift") +pub proc run(felt, felt, felt, felt) + exec.::miden:base/transaction-script@1.0.0::init + trace.240 + nop + exec.::miden:base/transaction-script@1.0.0::rust_sdk_account_tx_get_num_input_notes_binding::miden:base/transaction-script@1.0.0#run + trace.252 + nop + exec.::std::sys::truncate_stack +end + +proc init + push.1179648 + trace.240 + exec.::intrinsics::mem::heap_init + trace.252 + push.[7028007876379170725,18060021366771303825,13412364500725888848,14178532912296021363] + adv.push_mapval + push.262144 + push.1 + trace.240 + exec.::std::mem::pipe_preimage_to_memory + trace.252 + drop + push.1048576 + u32assert + mem_store.278536 + push.0 + u32assert + mem_store.278537 +end + +# mod miden:base/transaction-script@1.0.0::rust_sdk_account_tx_get_num_input_notes_binding + +@callconv("C") +proc __wasm_call_ctors( + +) + nop +end + +@callconv("C") +proc rust_sdk_account_tx_get_num_input_notes_binding::bindings::__link_custom_section_describing_imports( + +) + nop +end + +@callconv("C") +proc miden:base/transaction-script@1.0.0#run(felt, felt, felt, felt) + drop + drop + drop + drop + trace.240 + nop + exec.::miden:base/transaction-script@1.0.0::rust_sdk_account_tx_get_num_input_notes_binding::wit_bindgen::rt::run_ctors_once + trace.252 + nop + trace.240 + nop + exec.::miden:base/transaction-script@1.0.0::rust_sdk_account_tx_get_num_input_notes_binding::miden_base_sys::bindings::tx::get_num_input_notes + trace.252 + nop + drop +end + +@callconv("C") +proc wit_bindgen::rt::run_ctors_once( + +) + push.1114148 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.1048584 + u32wrapping_add + u32divmod.4 + swap.1 + swap.1 + dup.1 + mem_load + swap.1 + push.8 + u32wrapping_mul + u32shr + swap.1 + drop + push.255 + u32and + push.0 + swap.1 + neq + if.true + nop + else + push.1114148 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + trace.240 + nop + exec.::miden:base/transaction-script@1.0.0::rust_sdk_account_tx_get_num_input_notes_binding::__wasm_call_ctors + trace.252 + nop + push.1 + push.1048584 + movup.2 + u32wrapping_add + u32divmod.4 + swap.1 + dup.0 + mem_load + dup.2 + push.8 + u32wrapping_mul + push.255 + swap.1 + u32shl + u32not + swap.1 + u32and + movup.3 + movup.3 + push.8 + u32wrapping_mul + u32shl + u32or + swap.1 + mem_store + end +end + +@callconv("C") +proc miden_base_sys::bindings::tx::get_num_input_notes( + +) -> felt + trace.240 + nop + exec.::miden:base/transaction-script@1.0.0::rust_sdk_account_tx_get_num_input_notes_binding::miden::tx::get_num_input_notes + trace.252 + nop +end + +@callconv("C") +proc miden::tx::get_num_input_notes( + +) -> felt + trace.240 + nop + exec.::miden::tx::get_num_input_notes + trace.252 + nop +end + diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_num_input_notes_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_num_input_notes_binding.wat new file mode 100644 index 000000000..291ebc0e8 --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_num_input_notes_binding.wat @@ -0,0 +1,85 @@ +(component + (type (;0;) + (instance + (type (;0;) (record (field "inner" f32))) + (export (;1;) "felt" (type (eq 0))) + (type (;2;) (tuple 1 1 1 1)) + (type (;3;) (record (field "inner" 2))) + (export (;4;) "word" (type (eq 3))) + ) + ) + (import "miden:base/core-types@1.0.0" (instance (;0;) (type 0))) + (core module (;0;) + (type (;0;) (func)) + (type (;1;) (func (param f32 f32 f32 f32))) + (type (;2;) (func (result f32))) + (table (;0;) 2 2 funcref) + (memory (;0;) 17) + (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) + (global $GOT.data.internal.__memory_base (;1;) i32 i32.const 0) + (export "memory" (memory 0)) + (export "miden:base/transaction-script@1.0.0#run" (func $miden:base/transaction-script@1.0.0#run)) + (elem (;0;) (i32.const 1) func $rust_sdk_account_tx_get_num_input_notes_binding::bindings::__link_custom_section_describing_imports) + (func $__wasm_call_ctors (;0;) (type 0)) + (func $rust_sdk_account_tx_get_num_input_notes_binding::bindings::__link_custom_section_describing_imports (;1;) (type 0)) + (func $miden:base/transaction-script@1.0.0#run (;2;) (type 1) (param f32 f32 f32 f32) + call $wit_bindgen::rt::run_ctors_once + call $miden_base_sys::bindings::tx::get_num_input_notes + drop + ) + (func $wit_bindgen::rt::run_ctors_once (;3;) (type 0) + (local i32) + block ;; label = @1 + global.get $GOT.data.internal.__memory_base + i32.const 1048584 + i32.add + i32.load8_u + br_if 0 (;@1;) + global.get $GOT.data.internal.__memory_base + local.set 0 + call $__wasm_call_ctors + local.get 0 + i32.const 1048584 + i32.add + i32.const 1 + i32.store8 + end + ) + (func $miden_base_sys::bindings::tx::get_num_input_notes (;4;) (type 2) (result f32) + call $miden::tx::get_num_input_notes + ) + (func $miden::tx::get_num_input_notes (;5;) (type 2) (result f32) + unreachable + ) + (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") + ) + (alias export 0 "word" (type (;1;))) + (core instance (;0;) (instantiate 0)) + (alias core export 0 "memory" (core memory (;0;))) + (type (;2;) (func (param "arg" 1))) + (alias core export 0 "miden:base/transaction-script@1.0.0#run" (core func (;0;))) + (func (;0;) (type 2) (canon lift (core func 0))) + (alias export 0 "felt" (type (;3;))) + (alias export 0 "word" (type (;4;))) + (component (;0;) + (type (;0;) (record (field "inner" f32))) + (import "import-type-felt" (type (;1;) (eq 0))) + (type (;2;) (tuple 1 1 1 1)) + (type (;3;) (record (field "inner" 2))) + (import "import-type-word" (type (;4;) (eq 3))) + (import "import-type-word0" (type (;5;) (eq 4))) + (type (;6;) (func (param "arg" 5))) + (import "import-func-run" (func (;0;) (type 6))) + (export (;7;) "word" (type 4)) + (type (;8;) (func (param "arg" 7))) + (export (;1;) "run" (func 0) (func (type 8))) + ) + (instance (;1;) (instantiate 0 + (with "import-func-run" (func 0)) + (with "import-type-felt" (type 3)) + (with "import-type-word" (type 4)) + (with "import-type-word0" (type 1)) + ) + ) + (export (;2;) "miden:base/transaction-script@1.0.0" (instance 1)) +) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_num_output_notes_binding.hir b/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_num_output_notes_binding.hir new file mode 100644 index 000000000..703ce084f --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_num_output_notes_binding.hir @@ -0,0 +1,82 @@ +builtin.component miden:base/transaction-script@1.0.0 { + builtin.module public @rust_sdk_account_tx_get_num_output_notes_binding { + private builtin.function @__wasm_call_ctors() { + ^block5: + builtin.ret ; + }; + + private builtin.function @rust_sdk_account_tx_get_num_output_notes_binding::bindings::__link_custom_section_describing_imports() { + ^block7: + builtin.ret ; + }; + + private builtin.function @miden:base/transaction-script@1.0.0#run(v0: felt, v1: felt, v2: felt, v3: felt) { + ^block9(v0: felt, v1: felt, v2: felt, v3: felt): + hir.exec @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_num_output_notes_binding/wit_bindgen::rt::run_ctors_once() + v4 = hir.exec @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_num_output_notes_binding/miden_base_sys::bindings::tx::get_num_output_notes() : felt + builtin.ret ; + }; + + private builtin.function @wit_bindgen::rt::run_ctors_once() { + ^block11: + v6 = builtin.global_symbol @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_num_output_notes_binding/GOT.data.internal.__memory_base : ptr + v7 = hir.bitcast v6 : ptr; + v8 = hir.load v7 : i32; + v9 = arith.constant 1048584 : i32; + v10 = arith.add v8, v9 : i32 #[overflow = wrapping]; + v11 = hir.bitcast v10 : u32; + v12 = hir.int_to_ptr v11 : ptr; + v13 = hir.load v12 : u8; + v5 = arith.constant 0 : i32; + v14 = arith.zext v13 : u32; + v15 = hir.bitcast v14 : i32; + v17 = arith.neq v15, v5 : i1; + scf.if v17{ + ^block13: + scf.yield ; + } else { + ^block14: + v18 = builtin.global_symbol @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_num_output_notes_binding/GOT.data.internal.__memory_base : ptr + v19 = hir.bitcast v18 : ptr; + v20 = hir.load v19 : i32; + hir.exec @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_num_output_notes_binding/__wasm_call_ctors() + v37 = arith.constant 1 : u8; + v39 = arith.constant 1048584 : i32; + v22 = arith.add v20, v39 : i32 #[overflow = wrapping]; + v26 = hir.bitcast v22 : u32; + v27 = hir.int_to_ptr v26 : ptr; + hir.store v27, v37; + scf.yield ; + }; + builtin.ret ; + }; + + private builtin.function @miden_base_sys::bindings::tx::get_num_output_notes() -> felt { + ^block15: + v29 = hir.exec @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_num_output_notes_binding/miden::tx::get_num_output_notes() : felt + builtin.ret v29; + }; + + private builtin.function @miden::tx::get_num_output_notes() -> felt { + ^block17: + v30 = hir.exec @miden/tx/get_num_output_notes() : felt + builtin.ret v30; + }; + + builtin.global_variable private @#__stack_pointer : i32 { + builtin.ret_imm 1048576; + }; + + builtin.global_variable private @#GOT.data.internal.__memory_base : i32 { + builtin.ret_imm 0; + }; + + builtin.segment @1048576 = 0x0000000100000001; + }; + + public builtin.function @run(v32: felt, v33: felt, v34: felt, v35: felt) { + ^block21(v32: felt, v33: felt, v34: felt, v35: felt): + hir.exec @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_num_output_notes_binding/miden:base/transaction-script@1.0.0#run(v32, v33, v34, v35) + builtin.ret ; + }; +}; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_num_output_notes_binding.masm b/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_num_output_notes_binding.masm new file mode 100644 index 000000000..cd52d0afd --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_num_output_notes_binding.masm @@ -0,0 +1,165 @@ +# mod miden:base/transaction-script@1.0.0 + +@callconv("canon-lift") +pub proc run(felt, felt, felt, felt) + exec.::miden:base/transaction-script@1.0.0::init + trace.240 + nop + exec.::miden:base/transaction-script@1.0.0::rust_sdk_account_tx_get_num_output_notes_binding::miden:base/transaction-script@1.0.0#run + trace.252 + nop + exec.::std::sys::truncate_stack +end + +proc init + push.1179648 + trace.240 + exec.::intrinsics::mem::heap_init + trace.252 + push.[7028007876379170725,18060021366771303825,13412364500725888848,14178532912296021363] + adv.push_mapval + push.262144 + push.1 + trace.240 + exec.::std::mem::pipe_preimage_to_memory + trace.252 + drop + push.1048576 + u32assert + mem_store.278536 + push.0 + u32assert + mem_store.278537 +end + +# mod miden:base/transaction-script@1.0.0::rust_sdk_account_tx_get_num_output_notes_binding + +@callconv("C") +proc __wasm_call_ctors( + +) + nop +end + +@callconv("C") +proc rust_sdk_account_tx_get_num_output_notes_binding::bindings::__link_custom_section_describing_imports( + +) + nop +end + +@callconv("C") +proc miden:base/transaction-script@1.0.0#run(felt, felt, felt, felt) + drop + drop + drop + drop + trace.240 + nop + exec.::miden:base/transaction-script@1.0.0::rust_sdk_account_tx_get_num_output_notes_binding::wit_bindgen::rt::run_ctors_once + trace.252 + nop + trace.240 + nop + exec.::miden:base/transaction-script@1.0.0::rust_sdk_account_tx_get_num_output_notes_binding::miden_base_sys::bindings::tx::get_num_output_notes + trace.252 + nop + drop +end + +@callconv("C") +proc wit_bindgen::rt::run_ctors_once( + +) + push.1114148 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.1048584 + u32wrapping_add + u32divmod.4 + swap.1 + swap.1 + dup.1 + mem_load + swap.1 + push.8 + u32wrapping_mul + u32shr + swap.1 + drop + push.255 + u32and + push.0 + swap.1 + neq + if.true + nop + else + push.1114148 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + trace.240 + nop + exec.::miden:base/transaction-script@1.0.0::rust_sdk_account_tx_get_num_output_notes_binding::__wasm_call_ctors + trace.252 + nop + push.1 + push.1048584 + movup.2 + u32wrapping_add + u32divmod.4 + swap.1 + dup.0 + mem_load + dup.2 + push.8 + u32wrapping_mul + push.255 + swap.1 + u32shl + u32not + swap.1 + u32and + movup.3 + movup.3 + push.8 + u32wrapping_mul + u32shl + u32or + swap.1 + mem_store + end +end + +@callconv("C") +proc miden_base_sys::bindings::tx::get_num_output_notes( + +) -> felt + trace.240 + nop + exec.::miden:base/transaction-script@1.0.0::rust_sdk_account_tx_get_num_output_notes_binding::miden::tx::get_num_output_notes + trace.252 + nop +end + +@callconv("C") +proc miden::tx::get_num_output_notes( + +) -> felt + trace.240 + nop + exec.::miden::tx::get_num_output_notes + trace.252 + nop +end + diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_num_output_notes_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_num_output_notes_binding.wat new file mode 100644 index 000000000..a7dd87fd1 --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_num_output_notes_binding.wat @@ -0,0 +1,85 @@ +(component + (type (;0;) + (instance + (type (;0;) (record (field "inner" f32))) + (export (;1;) "felt" (type (eq 0))) + (type (;2;) (tuple 1 1 1 1)) + (type (;3;) (record (field "inner" 2))) + (export (;4;) "word" (type (eq 3))) + ) + ) + (import "miden:base/core-types@1.0.0" (instance (;0;) (type 0))) + (core module (;0;) + (type (;0;) (func)) + (type (;1;) (func (param f32 f32 f32 f32))) + (type (;2;) (func (result f32))) + (table (;0;) 2 2 funcref) + (memory (;0;) 17) + (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) + (global $GOT.data.internal.__memory_base (;1;) i32 i32.const 0) + (export "memory" (memory 0)) + (export "miden:base/transaction-script@1.0.0#run" (func $miden:base/transaction-script@1.0.0#run)) + (elem (;0;) (i32.const 1) func $rust_sdk_account_tx_get_num_output_notes_binding::bindings::__link_custom_section_describing_imports) + (func $__wasm_call_ctors (;0;) (type 0)) + (func $rust_sdk_account_tx_get_num_output_notes_binding::bindings::__link_custom_section_describing_imports (;1;) (type 0)) + (func $miden:base/transaction-script@1.0.0#run (;2;) (type 1) (param f32 f32 f32 f32) + call $wit_bindgen::rt::run_ctors_once + call $miden_base_sys::bindings::tx::get_num_output_notes + drop + ) + (func $wit_bindgen::rt::run_ctors_once (;3;) (type 0) + (local i32) + block ;; label = @1 + global.get $GOT.data.internal.__memory_base + i32.const 1048584 + i32.add + i32.load8_u + br_if 0 (;@1;) + global.get $GOT.data.internal.__memory_base + local.set 0 + call $__wasm_call_ctors + local.get 0 + i32.const 1048584 + i32.add + i32.const 1 + i32.store8 + end + ) + (func $miden_base_sys::bindings::tx::get_num_output_notes (;4;) (type 2) (result f32) + call $miden::tx::get_num_output_notes + ) + (func $miden::tx::get_num_output_notes (;5;) (type 2) (result f32) + unreachable + ) + (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") + ) + (alias export 0 "word" (type (;1;))) + (core instance (;0;) (instantiate 0)) + (alias core export 0 "memory" (core memory (;0;))) + (type (;2;) (func (param "arg" 1))) + (alias core export 0 "miden:base/transaction-script@1.0.0#run" (core func (;0;))) + (func (;0;) (type 2) (canon lift (core func 0))) + (alias export 0 "felt" (type (;3;))) + (alias export 0 "word" (type (;4;))) + (component (;0;) + (type (;0;) (record (field "inner" f32))) + (import "import-type-felt" (type (;1;) (eq 0))) + (type (;2;) (tuple 1 1 1 1)) + (type (;3;) (record (field "inner" 2))) + (import "import-type-word" (type (;4;) (eq 3))) + (import "import-type-word0" (type (;5;) (eq 4))) + (type (;6;) (func (param "arg" 5))) + (import "import-func-run" (func (;0;) (type 6))) + (export (;7;) "word" (type 4)) + (type (;8;) (func (param "arg" 7))) + (export (;1;) "run" (func 0) (func (type 8))) + ) + (instance (;1;) (instantiate 0 + (with "import-func-run" (func 0)) + (with "import-type-felt" (type 3)) + (with "import-type-word" (type 4)) + (with "import-type-word0" (type 1)) + ) + ) + (export (;2;) "miden:base/transaction-script@1.0.0" (instance 1)) +) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_output_notes_commitment_binding.hir b/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_output_notes_commitment_binding.hir new file mode 100644 index 000000000..7d534fe20 --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_output_notes_commitment_binding.hir @@ -0,0 +1,283 @@ +builtin.component miden:base/transaction-script@1.0.0 { + builtin.module public @rust_sdk_account_tx_get_output_notes_commitment_binding { + private builtin.function @__wasm_call_ctors() { + ^block5: + builtin.ret ; + }; + + private builtin.function @rust_sdk_account_tx_get_output_notes_commitment_binding::bindings::__link_custom_section_describing_imports() { + ^block7: + builtin.ret ; + }; + + private builtin.function @miden:base/transaction-script@1.0.0#run(v0: felt, v1: felt, v2: felt, v3: felt) { + ^block9(v0: felt, v1: felt, v2: felt, v3: felt): + v5 = builtin.global_symbol @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_output_notes_commitment_binding/__stack_pointer : ptr + v6 = hir.bitcast v5 : ptr; + v7 = hir.load v6 : i32; + v8 = arith.constant 16 : i32; + v9 = arith.sub v7, v8 : i32 #[overflow = wrapping]; + v10 = builtin.global_symbol @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_output_notes_commitment_binding/__stack_pointer : ptr + v11 = hir.bitcast v10 : ptr; + hir.store v11, v9; + hir.exec @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_output_notes_commitment_binding/wit_bindgen::rt::run_ctors_once() + hir.exec @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_output_notes_commitment_binding/miden_base_sys::bindings::tx::get_output_notes_commitment(v9) + v187 = arith.constant 16 : i32; + v13 = arith.add v9, v187 : i32 #[overflow = wrapping]; + v14 = builtin.global_symbol @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_output_notes_commitment_binding/__stack_pointer : ptr + v15 = hir.bitcast v14 : ptr; + hir.store v15, v13; + builtin.ret ; + }; + + private builtin.function @wit_bindgen::rt::run_ctors_once() { + ^block11: + v17 = builtin.global_symbol @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_output_notes_commitment_binding/GOT.data.internal.__memory_base : ptr + v18 = hir.bitcast v17 : ptr; + v19 = hir.load v18 : i32; + v20 = arith.constant 1048584 : i32; + v21 = arith.add v19, v20 : i32 #[overflow = wrapping]; + v22 = hir.bitcast v21 : u32; + v23 = hir.int_to_ptr v22 : ptr; + v24 = hir.load v23 : u8; + v16 = arith.constant 0 : i32; + v25 = arith.zext v24 : u32; + v26 = hir.bitcast v25 : i32; + v28 = arith.neq v26, v16 : i1; + scf.if v28{ + ^block13: + scf.yield ; + } else { + ^block14: + v29 = builtin.global_symbol @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_output_notes_commitment_binding/GOT.data.internal.__memory_base : ptr + v30 = hir.bitcast v29 : ptr; + v31 = hir.load v30 : i32; + hir.exec @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_output_notes_commitment_binding/__wasm_call_ctors() + v189 = arith.constant 1 : u8; + v191 = arith.constant 1048584 : i32; + v33 = arith.add v31, v191 : i32 #[overflow = wrapping]; + v37 = hir.bitcast v33 : u32; + v38 = hir.int_to_ptr v37 : ptr; + hir.store v38, v189; + scf.yield ; + }; + builtin.ret ; + }; + + private builtin.function @miden_base_sys::bindings::tx::get_output_notes_commitment(v39: i32) { + ^block15(v39: i32): + v41 = builtin.global_symbol @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_output_notes_commitment_binding/__stack_pointer : ptr + v42 = hir.bitcast v41 : ptr; + v43 = hir.load v42 : i32; + v44 = arith.constant 32 : i32; + v45 = arith.sub v43, v44 : i32 #[overflow = wrapping]; + v46 = builtin.global_symbol @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_output_notes_commitment_binding/__stack_pointer : ptr + v47 = hir.bitcast v46 : ptr; + hir.store v47, v45; + hir.exec @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_output_notes_commitment_binding/miden::tx::get_output_notes_commitment(v45) + v49 = arith.constant 8 : u32; + v48 = hir.bitcast v45 : u32; + v50 = arith.add v48, v49 : u32 #[overflow = checked]; + v196 = arith.constant 8 : u32; + v52 = arith.mod v50, v196 : u32; + hir.assertz v52 #[code = 250]; + v53 = hir.int_to_ptr v50 : ptr; + v54 = hir.load v53 : i64; + v56 = arith.constant 24 : u32; + v55 = hir.bitcast v45 : u32; + v57 = arith.add v55, v56 : u32 #[overflow = checked]; + v195 = arith.constant 8 : u32; + v59 = arith.mod v57, v195 : u32; + hir.assertz v59 #[code = 250]; + v60 = hir.int_to_ptr v57 : ptr; + hir.store v60, v54; + v61 = hir.bitcast v45 : u32; + v194 = arith.constant 8 : u32; + v63 = arith.mod v61, v194 : u32; + hir.assertz v63 #[code = 250]; + v64 = hir.int_to_ptr v61 : ptr; + v65 = hir.load v64 : i64; + v67 = arith.constant 16 : u32; + v66 = hir.bitcast v45 : u32; + v68 = arith.add v66, v67 : u32 #[overflow = checked]; + v193 = arith.constant 8 : u32; + v70 = arith.mod v68, v193 : u32; + hir.assertz v70 #[code = 250]; + v71 = hir.int_to_ptr v68 : ptr; + hir.store v71, v65; + v72 = arith.constant 16 : i32; + v73 = arith.add v45, v72 : i32 #[overflow = wrapping]; + hir.exec @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_output_notes_commitment_binding/miden_stdlib_sys::intrinsics::word::Word::reverse(v39, v73) + v192 = arith.constant 32 : i32; + v75 = arith.add v45, v192 : i32 #[overflow = wrapping]; + v76 = builtin.global_symbol @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_output_notes_commitment_binding/__stack_pointer : ptr + v77 = hir.bitcast v76 : ptr; + hir.store v77, v75; + builtin.ret ; + }; + + private builtin.function @miden_stdlib_sys::intrinsics::word::Word::reverse(v78: i32, v79: i32) { + ^block17(v78: i32, v79: i32): + v82 = builtin.global_symbol @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_output_notes_commitment_binding/__stack_pointer : ptr + v83 = hir.bitcast v82 : ptr; + v84 = hir.load v83 : i32; + v85 = arith.constant 16 : i32; + v86 = arith.sub v84, v85 : i32 #[overflow = wrapping]; + v88 = arith.constant 8 : u32; + v87 = hir.bitcast v79 : u32; + v89 = arith.add v87, v88 : u32 #[overflow = checked]; + v283 = arith.constant 8 : u32; + v91 = arith.mod v89, v283 : u32; + hir.assertz v91 #[code = 250]; + v92 = hir.int_to_ptr v89 : ptr; + v93 = hir.load v92 : i64; + v282 = arith.constant 8 : u32; + v94 = hir.bitcast v86 : u32; + v96 = arith.add v94, v282 : u32 #[overflow = checked]; + v97 = arith.constant 4 : u32; + v98 = arith.mod v96, v97 : u32; + hir.assertz v98 #[code = 250]; + v99 = hir.int_to_ptr v96 : ptr; + hir.store v99, v93; + v100 = hir.bitcast v79 : u32; + v281 = arith.constant 8 : u32; + v102 = arith.mod v100, v281 : u32; + hir.assertz v102 #[code = 250]; + v103 = hir.int_to_ptr v100 : ptr; + v104 = hir.load v103 : i64; + v105 = hir.bitcast v86 : u32; + v280 = arith.constant 4 : u32; + v107 = arith.mod v105, v280 : u32; + hir.assertz v107 #[code = 250]; + v108 = hir.int_to_ptr v105 : ptr; + hir.store v108, v104; + v109 = arith.constant 12 : i32; + v110 = arith.add v86, v109 : i32 #[overflow = wrapping]; + v80 = arith.constant 0 : i32; + v251, v252, v253, v254, v255, v256 = scf.while v80, v86, v110, v78 : i32, i32, i32, i32, i32, i32 { + ^block37(v257: i32, v258: i32, v259: i32, v260: i32): + v279 = arith.constant 0 : i32; + v113 = arith.constant 8 : i32; + v114 = arith.eq v257, v113 : i1; + v115 = arith.zext v114 : u32; + v116 = hir.bitcast v115 : i32; + v118 = arith.neq v116, v279 : i1; + v245, v246 = scf.if v118 : i32, i32 { + ^block36: + v205 = ub.poison i32 : i32; + scf.yield v205, v205; + } else { + ^block22: + v120 = arith.add v258, v257 : i32 #[overflow = wrapping]; + v121 = hir.bitcast v120 : u32; + v278 = arith.constant 4 : u32; + v123 = arith.mod v121, v278 : u32; + hir.assertz v123 #[code = 250]; + v124 = hir.int_to_ptr v121 : ptr; + v125 = hir.load v124 : felt; + v127 = hir.bitcast v259 : u32; + v277 = arith.constant 4 : u32; + v129 = arith.mod v127, v277 : u32; + hir.assertz v129 #[code = 250]; + v130 = hir.int_to_ptr v127 : ptr; + v131 = hir.load v130 : i32; + v132 = hir.bitcast v120 : u32; + v276 = arith.constant 4 : u32; + v134 = arith.mod v132, v276 : u32; + hir.assertz v134 #[code = 250]; + v135 = hir.int_to_ptr v132 : ptr; + hir.store v135, v131; + v136 = hir.bitcast v259 : u32; + v275 = arith.constant 4 : u32; + v138 = arith.mod v136, v275 : u32; + hir.assertz v138 #[code = 250]; + v139 = hir.int_to_ptr v136 : ptr; + hir.store v139, v125; + v142 = arith.constant -4 : i32; + v143 = arith.add v259, v142 : i32 #[overflow = wrapping]; + v140 = arith.constant 4 : i32; + v141 = arith.add v257, v140 : i32 #[overflow = wrapping]; + scf.yield v141, v143; + }; + v273 = ub.poison i32 : i32; + v248 = cf.select v118, v273, v260 : i32; + v274 = ub.poison i32 : i32; + v247 = cf.select v118, v274, v258 : i32; + v204 = arith.constant 1 : u32; + v197 = arith.constant 0 : u32; + v250 = cf.select v118, v197, v204 : u32; + v238 = arith.trunc v250 : i1; + scf.condition v238, v245, v247, v246, v248, v258, v260; + } do { + ^block38(v261: i32, v262: i32, v263: i32, v264: i32, v265: i32, v266: i32): + scf.yield v261, v262, v263, v264; + }; + v272 = arith.constant 8 : u32; + v145 = hir.bitcast v255 : u32; + v147 = arith.add v145, v272 : u32 #[overflow = checked]; + v271 = arith.constant 4 : u32; + v149 = arith.mod v147, v271 : u32; + hir.assertz v149 #[code = 250]; + v150 = hir.int_to_ptr v147 : ptr; + v151 = hir.load v150 : i64; + v270 = arith.constant 8 : u32; + v152 = hir.bitcast v256 : u32; + v154 = arith.add v152, v270 : u32 #[overflow = checked]; + v269 = arith.constant 8 : u32; + v156 = arith.mod v154, v269 : u32; + hir.assertz v156 #[code = 250]; + v157 = hir.int_to_ptr v154 : ptr; + hir.store v157, v151; + v158 = hir.bitcast v255 : u32; + v268 = arith.constant 4 : u32; + v160 = arith.mod v158, v268 : u32; + hir.assertz v160 #[code = 250]; + v161 = hir.int_to_ptr v158 : ptr; + v162 = hir.load v161 : i64; + v163 = hir.bitcast v256 : u32; + v267 = arith.constant 8 : u32; + v165 = arith.mod v163, v267 : u32; + hir.assertz v165 #[code = 250]; + v166 = hir.int_to_ptr v163 : ptr; + hir.store v166, v162; + builtin.ret ; + }; + + private builtin.function @miden::tx::get_output_notes_commitment(v167: i32) { + ^block23(v167: i32): + v168, v169, v170, v171 = hir.exec @miden/tx/get_output_notes_commitment() : felt, felt, felt, felt + v172 = hir.bitcast v167 : u32; + v173 = hir.int_to_ptr v172 : ptr; + hir.store v173, v168; + v174 = arith.constant 4 : u32; + v175 = arith.add v172, v174 : u32 #[overflow = checked]; + v176 = hir.int_to_ptr v175 : ptr; + hir.store v176, v169; + v177 = arith.constant 8 : u32; + v178 = arith.add v172, v177 : u32 #[overflow = checked]; + v179 = hir.int_to_ptr v178 : ptr; + hir.store v179, v170; + v180 = arith.constant 12 : u32; + v181 = arith.add v172, v180 : u32 #[overflow = checked]; + v182 = hir.int_to_ptr v181 : ptr; + hir.store v182, v171; + builtin.ret ; + }; + + builtin.global_variable private @#__stack_pointer : i32 { + builtin.ret_imm 1048576; + }; + + builtin.global_variable private @#GOT.data.internal.__memory_base : i32 { + builtin.ret_imm 0; + }; + + builtin.segment @1048576 = 0x0000000100000001; + }; + + public builtin.function @run(v183: felt, v184: felt, v185: felt, v186: felt) { + ^block27(v183: felt, v184: felt, v185: felt, v186: felt): + hir.exec @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_get_output_notes_commitment_binding/miden:base/transaction-script@1.0.0#run(v183, v184, v185, v186) + builtin.ret ; + }; +}; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_output_notes_commitment_binding.masm b/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_output_notes_commitment_binding.masm new file mode 100644 index 000000000..6184171ac --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_output_notes_commitment_binding.masm @@ -0,0 +1,610 @@ +# mod miden:base/transaction-script@1.0.0 + +@callconv("canon-lift") +pub proc run(felt, felt, felt, felt) + exec.::miden:base/transaction-script@1.0.0::init + trace.240 + nop + exec.::miden:base/transaction-script@1.0.0::rust_sdk_account_tx_get_output_notes_commitment_binding::miden:base/transaction-script@1.0.0#run + trace.252 + nop + exec.::std::sys::truncate_stack +end + +proc init + push.1179648 + trace.240 + exec.::intrinsics::mem::heap_init + trace.252 + push.[7028007876379170725,18060021366771303825,13412364500725888848,14178532912296021363] + adv.push_mapval + push.262144 + push.1 + trace.240 + exec.::std::mem::pipe_preimage_to_memory + trace.252 + drop + push.1048576 + u32assert + mem_store.278536 + push.0 + u32assert + mem_store.278537 +end + +# mod miden:base/transaction-script@1.0.0::rust_sdk_account_tx_get_output_notes_commitment_binding + +@callconv("C") +proc __wasm_call_ctors( + +) + nop +end + +@callconv("C") +proc rust_sdk_account_tx_get_output_notes_commitment_binding::bindings::__link_custom_section_describing_imports( + +) + nop +end + +@callconv("C") +proc miden:base/transaction-script@1.0.0#run(felt, felt, felt, felt) + drop + drop + drop + drop + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.16 + u32wrapping_sub + push.1114144 + dup.1 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + trace.240 + nop + exec.::miden:base/transaction-script@1.0.0::rust_sdk_account_tx_get_output_notes_commitment_binding::wit_bindgen::rt::run_ctors_once + trace.252 + nop + dup.0 + trace.240 + nop + exec.::miden:base/transaction-script@1.0.0::rust_sdk_account_tx_get_output_notes_commitment_binding::miden_base_sys::bindings::tx::get_output_notes_commitment + trace.252 + nop + push.16 + u32wrapping_add + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop +end + +@callconv("C") +proc wit_bindgen::rt::run_ctors_once( + +) + push.1114148 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.1048584 + u32wrapping_add + u32divmod.4 + swap.1 + swap.1 + dup.1 + mem_load + swap.1 + push.8 + u32wrapping_mul + u32shr + swap.1 + drop + push.255 + u32and + push.0 + swap.1 + neq + if.true + nop + else + push.1114148 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + trace.240 + nop + exec.::miden:base/transaction-script@1.0.0::rust_sdk_account_tx_get_output_notes_commitment_binding::__wasm_call_ctors + trace.252 + nop + push.1 + push.1048584 + movup.2 + u32wrapping_add + u32divmod.4 + swap.1 + dup.0 + mem_load + dup.2 + push.8 + u32wrapping_mul + push.255 + swap.1 + u32shl + u32not + swap.1 + u32and + movup.3 + movup.3 + push.8 + u32wrapping_mul + u32shl + u32or + swap.1 + mem_store + end +end + +@callconv("C") +proc miden_base_sys::bindings::tx::get_output_notes_commitment( + i32 +) + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.32 + u32wrapping_sub + push.1114144 + dup.1 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + dup.0 + trace.240 + nop + exec.::miden:base/transaction-script@1.0.0::rust_sdk_account_tx_get_output_notes_commitment_binding::miden::tx::get_output_notes_commitment + trace.252 + nop + push.8 + dup.1 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.24 + dup.3 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + dup.0 + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.16 + dup.3 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.16 + dup.1 + u32wrapping_add + movup.2 + trace.240 + nop + exec.::miden:base/transaction-script@1.0.0::rust_sdk_account_tx_get_output_notes_commitment_binding::miden_stdlib_sys::intrinsics::word::Word::reverse + trace.252 + nop + push.32 + u32wrapping_add + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop +end + +@callconv("C") +proc miden_stdlib_sys::intrinsics::word::Word::reverse( + i32, + i32 +) + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.16 + u32wrapping_sub + push.8 + dup.3 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.8 + dup.3 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + movup.2 + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + dup.2 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.12 + dup.1 + u32wrapping_add + push.0 + movup.2 + swap.1 + push.1 + while.true + push.0 + push.8 + dup.2 + eq + neq + dup.0 + if.true + movup.3 + movup.2 + drop + drop + push.3735929054 + dup.0 + else + dup.2 + dup.2 + u32wrapping_add + dup.0 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + dup.5 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + movup.2 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + dup.4 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.4294967292 + movup.4 + u32wrapping_add + push.4 + movup.3 + u32wrapping_add + end + push.3735929054 + dup.3 + dup.6 + swap.2 + swap.1 + cdrop + push.3735929054 + dup.4 + dup.6 + swap.2 + swap.1 + cdrop + push.1 + push.0 + movup.6 + cdrop + push.1 + u32and + swap.1 + swap.2 + swap.4 + swap.3 + swap.1 + if.true + movup.4 + drop + movup.4 + drop + push.1 + else + push.0 + end + end + drop + drop + drop + drop + push.8 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.8 + dup.4 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + movup.2 + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop +end + +@callconv("C") +proc miden::tx::get_output_notes_commitment(i32) + trace.240 + nop + exec.::miden::tx::get_output_notes_commitment + trace.252 + nop + movup.4 + dup.0 + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.4 + dup.1 + add + u32assert + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.8 + dup.1 + add + u32assert + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.12 + add + u32assert + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop +end + diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_output_notes_commitment_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_output_notes_commitment_binding.wat new file mode 100644 index 000000000..c8ce1a761 --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_output_notes_commitment_binding.wat @@ -0,0 +1,178 @@ +(component + (type (;0;) + (instance + (type (;0;) (record (field "inner" f32))) + (export (;1;) "felt" (type (eq 0))) + (type (;2;) (tuple 1 1 1 1)) + (type (;3;) (record (field "inner" 2))) + (export (;4;) "word" (type (eq 3))) + ) + ) + (import "miden:base/core-types@1.0.0" (instance (;0;) (type 0))) + (core module (;0;) + (type (;0;) (func)) + (type (;1;) (func (param f32 f32 f32 f32))) + (type (;2;) (func (param i32))) + (type (;3;) (func (param i32 i32))) + (table (;0;) 2 2 funcref) + (memory (;0;) 17) + (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) + (global $GOT.data.internal.__memory_base (;1;) i32 i32.const 0) + (export "memory" (memory 0)) + (export "miden:base/transaction-script@1.0.0#run" (func $miden:base/transaction-script@1.0.0#run)) + (elem (;0;) (i32.const 1) func $rust_sdk_account_tx_get_output_notes_commitment_binding::bindings::__link_custom_section_describing_imports) + (func $__wasm_call_ctors (;0;) (type 0)) + (func $rust_sdk_account_tx_get_output_notes_commitment_binding::bindings::__link_custom_section_describing_imports (;1;) (type 0)) + (func $miden:base/transaction-script@1.0.0#run (;2;) (type 1) (param f32 f32 f32 f32) + (local i32) + global.get $__stack_pointer + i32.const 16 + i32.sub + local.tee 4 + global.set $__stack_pointer + call $wit_bindgen::rt::run_ctors_once + local.get 4 + call $miden_base_sys::bindings::tx::get_output_notes_commitment + local.get 4 + i32.const 16 + i32.add + global.set $__stack_pointer + ) + (func $wit_bindgen::rt::run_ctors_once (;3;) (type 0) + (local i32) + block ;; label = @1 + global.get $GOT.data.internal.__memory_base + i32.const 1048584 + i32.add + i32.load8_u + br_if 0 (;@1;) + global.get $GOT.data.internal.__memory_base + local.set 0 + call $__wasm_call_ctors + local.get 0 + i32.const 1048584 + i32.add + i32.const 1 + i32.store8 + end + ) + (func $miden_base_sys::bindings::tx::get_output_notes_commitment (;4;) (type 2) (param i32) + (local i32) + global.get $__stack_pointer + i32.const 32 + i32.sub + local.tee 1 + global.set $__stack_pointer + local.get 1 + call $miden::tx::get_output_notes_commitment + local.get 1 + local.get 1 + i64.load offset=8 + i64.store offset=24 + local.get 1 + local.get 1 + i64.load + i64.store offset=16 + local.get 0 + local.get 1 + i32.const 16 + i32.add + call $miden_stdlib_sys::intrinsics::word::Word::reverse + local.get 1 + i32.const 32 + i32.add + global.set $__stack_pointer + ) + (func $miden_stdlib_sys::intrinsics::word::Word::reverse (;5;) (type 3) (param i32 i32) + (local i32 i32 i32 f32) + global.get $__stack_pointer + i32.const 16 + i32.sub + local.tee 2 + local.get 1 + i64.load offset=8 + i64.store offset=8 align=4 + local.get 2 + local.get 1 + i64.load + i64.store align=4 + local.get 2 + i32.const 12 + i32.add + local.set 3 + i32.const 0 + local.set 1 + block ;; label = @1 + loop ;; label = @2 + local.get 1 + i32.const 8 + i32.eq + br_if 1 (;@1;) + local.get 2 + local.get 1 + i32.add + local.tee 4 + f32.load + local.set 5 + local.get 4 + local.get 3 + i32.load + i32.store + local.get 3 + local.get 5 + f32.store + local.get 1 + i32.const 4 + i32.add + local.set 1 + local.get 3 + i32.const -4 + i32.add + local.set 3 + br 0 (;@2;) + end + end + local.get 0 + local.get 2 + i64.load offset=8 align=4 + i64.store offset=8 + local.get 0 + local.get 2 + i64.load align=4 + i64.store + ) + (func $miden::tx::get_output_notes_commitment (;6;) (type 2) (param i32) + unreachable + ) + (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") + ) + (alias export 0 "word" (type (;1;))) + (core instance (;0;) (instantiate 0)) + (alias core export 0 "memory" (core memory (;0;))) + (type (;2;) (func (param "arg" 1))) + (alias core export 0 "miden:base/transaction-script@1.0.0#run" (core func (;0;))) + (func (;0;) (type 2) (canon lift (core func 0))) + (alias export 0 "felt" (type (;3;))) + (alias export 0 "word" (type (;4;))) + (component (;0;) + (type (;0;) (record (field "inner" f32))) + (import "import-type-felt" (type (;1;) (eq 0))) + (type (;2;) (tuple 1 1 1 1)) + (type (;3;) (record (field "inner" 2))) + (import "import-type-word" (type (;4;) (eq 3))) + (import "import-type-word0" (type (;5;) (eq 4))) + (type (;6;) (func (param "arg" 5))) + (import "import-func-run" (func (;0;) (type 6))) + (export (;7;) "word" (type 4)) + (type (;8;) (func (param "arg" 7))) + (export (;1;) "run" (func 0) (func (type 8))) + ) + (instance (;1;) (instantiate 0 + (with "import-func-run" (func 0)) + (with "import-type-felt" (type 3)) + (with "import-type-word" (type 4)) + (with "import-type-word0" (type 1)) + ) + ) + (export (;2;) "miden:base/transaction-script@1.0.0" (instance 1)) +) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_tx_update_expiration_block_delta_binding.hir b/tests/integration/expected/rust_sdk/rust_sdk_account_tx_update_expiration_block_delta_binding.hir new file mode 100644 index 000000000..7c688ec32 --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_tx_update_expiration_block_delta_binding.hir @@ -0,0 +1,90 @@ +builtin.component miden:base/transaction-script@1.0.0 { + builtin.module public @rust_sdk_account_tx_update_expiration_block_delta_binding { + private builtin.function @__wasm_call_ctors() { + ^block5: + builtin.ret ; + }; + + private builtin.function @rust_sdk_account_tx_update_expiration_block_delta_binding::bindings::__link_custom_section_describing_imports() { + ^block7: + builtin.ret ; + }; + + private builtin.function @miden:base/transaction-script@1.0.0#run(v0: felt, v1: felt, v2: felt, v3: felt) { + ^block9(v0: felt, v1: felt, v2: felt, v3: felt): + hir.exec @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_update_expiration_block_delta_binding/wit_bindgen::rt::run_ctors_once() + v4 = arith.constant 42 : i32; + v5 = hir.exec @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_update_expiration_block_delta_binding/intrinsics::felt::from_u32(v4) : felt + hir.exec @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_update_expiration_block_delta_binding/miden_base_sys::bindings::tx::update_expiration_block_delta(v5) + builtin.ret ; + }; + + private builtin.function @wit_bindgen::rt::run_ctors_once() { + ^block11: + v7 = builtin.global_symbol @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_update_expiration_block_delta_binding/GOT.data.internal.__memory_base : ptr + v8 = hir.bitcast v7 : ptr; + v9 = hir.load v8 : i32; + v10 = arith.constant 1048584 : i32; + v11 = arith.add v9, v10 : i32 #[overflow = wrapping]; + v12 = hir.bitcast v11 : u32; + v13 = hir.int_to_ptr v12 : ptr; + v14 = hir.load v13 : u8; + v6 = arith.constant 0 : i32; + v15 = arith.zext v14 : u32; + v16 = hir.bitcast v15 : i32; + v18 = arith.neq v16, v6 : i1; + scf.if v18{ + ^block13: + scf.yield ; + } else { + ^block14: + v19 = builtin.global_symbol @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_update_expiration_block_delta_binding/GOT.data.internal.__memory_base : ptr + v20 = hir.bitcast v19 : ptr; + v21 = hir.load v20 : i32; + hir.exec @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_update_expiration_block_delta_binding/__wasm_call_ctors() + v39 = arith.constant 1 : u8; + v41 = arith.constant 1048584 : i32; + v23 = arith.add v21, v41 : i32 #[overflow = wrapping]; + v27 = hir.bitcast v23 : u32; + v28 = hir.int_to_ptr v27 : ptr; + hir.store v28, v39; + scf.yield ; + }; + builtin.ret ; + }; + + private builtin.function @miden_base_sys::bindings::tx::update_expiration_block_delta(v29: felt) { + ^block15(v29: felt): + hir.exec @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_update_expiration_block_delta_binding/miden::tx::update_expiration_block_delta(v29) + builtin.ret ; + }; + + private builtin.function @intrinsics::felt::from_u32(v30: i32) -> felt { + ^block17(v30: i32): + v31 = hir.bitcast v30 : felt; + builtin.ret v31; + }; + + private builtin.function @miden::tx::update_expiration_block_delta(v33: felt) { + ^block19(v33: felt): + hir.exec @miden/tx/update_expiration_block_delta(v33) + builtin.ret ; + }; + + builtin.global_variable private @#__stack_pointer : i32 { + builtin.ret_imm 1048576; + }; + + builtin.global_variable private @#GOT.data.internal.__memory_base : i32 { + builtin.ret_imm 0; + }; + + builtin.segment @1048576 = 0x0000000100000001; + }; + + public builtin.function @run(v34: felt, v35: felt, v36: felt, v37: felt) { + ^block23(v34: felt, v35: felt, v36: felt, v37: felt): + hir.exec @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_update_expiration_block_delta_binding/miden:base/transaction-script@1.0.0#run(v34, v35, v36, v37) + builtin.ret ; + }; +}; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_tx_update_expiration_block_delta_binding.masm b/tests/integration/expected/rust_sdk/rust_sdk_account_tx_update_expiration_block_delta_binding.masm new file mode 100644 index 000000000..5a3935001 --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_tx_update_expiration_block_delta_binding.masm @@ -0,0 +1,173 @@ +# mod miden:base/transaction-script@1.0.0 + +@callconv("canon-lift") +pub proc run(felt, felt, felt, felt) + exec.::miden:base/transaction-script@1.0.0::init + trace.240 + nop + exec.::miden:base/transaction-script@1.0.0::rust_sdk_account_tx_update_expiration_block_delta_binding::miden:base/transaction-script@1.0.0#run + trace.252 + nop + exec.::std::sys::truncate_stack +end + +proc init + push.1179648 + trace.240 + exec.::intrinsics::mem::heap_init + trace.252 + push.[7028007876379170725,18060021366771303825,13412364500725888848,14178532912296021363] + adv.push_mapval + push.262144 + push.1 + trace.240 + exec.::std::mem::pipe_preimage_to_memory + trace.252 + drop + push.1048576 + u32assert + mem_store.278536 + push.0 + u32assert + mem_store.278537 +end + +# mod miden:base/transaction-script@1.0.0::rust_sdk_account_tx_update_expiration_block_delta_binding + +@callconv("C") +proc __wasm_call_ctors( + +) + nop +end + +@callconv("C") +proc rust_sdk_account_tx_update_expiration_block_delta_binding::bindings::__link_custom_section_describing_imports( + +) + nop +end + +@callconv("C") +proc miden:base/transaction-script@1.0.0#run(felt, felt, felt, felt) + drop + drop + drop + drop + trace.240 + nop + exec.::miden:base/transaction-script@1.0.0::rust_sdk_account_tx_update_expiration_block_delta_binding::wit_bindgen::rt::run_ctors_once + trace.252 + nop + push.42 + trace.240 + nop + exec.::miden:base/transaction-script@1.0.0::rust_sdk_account_tx_update_expiration_block_delta_binding::intrinsics::felt::from_u32 + trace.252 + nop + trace.240 + nop + exec.::miden:base/transaction-script@1.0.0::rust_sdk_account_tx_update_expiration_block_delta_binding::miden_base_sys::bindings::tx::update_expiration_block_delta + trace.252 + nop +end + +@callconv("C") +proc wit_bindgen::rt::run_ctors_once( + +) + push.1114148 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.1048584 + u32wrapping_add + u32divmod.4 + swap.1 + swap.1 + dup.1 + mem_load + swap.1 + push.8 + u32wrapping_mul + u32shr + swap.1 + drop + push.255 + u32and + push.0 + swap.1 + neq + if.true + nop + else + push.1114148 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + trace.240 + nop + exec.::miden:base/transaction-script@1.0.0::rust_sdk_account_tx_update_expiration_block_delta_binding::__wasm_call_ctors + trace.252 + nop + push.1 + push.1048584 + movup.2 + u32wrapping_add + u32divmod.4 + swap.1 + dup.0 + mem_load + dup.2 + push.8 + u32wrapping_mul + push.255 + swap.1 + u32shl + u32not + swap.1 + u32and + movup.3 + movup.3 + push.8 + u32wrapping_mul + u32shl + u32or + swap.1 + mem_store + end +end + +@callconv("C") +proc miden_base_sys::bindings::tx::update_expiration_block_delta( + felt +) + trace.240 + nop + exec.::miden:base/transaction-script@1.0.0::rust_sdk_account_tx_update_expiration_block_delta_binding::miden::tx::update_expiration_block_delta + trace.252 + nop +end + +@callconv("C") +proc intrinsics::felt::from_u32(i32) -> felt + nop +end + +@callconv("C") +proc miden::tx::update_expiration_block_delta(felt) + trace.240 + nop + exec.::miden::tx::update_expiration_block_delta + trace.252 + nop +end + diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_tx_update_expiration_block_delta_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_account_tx_update_expiration_block_delta_binding.wat new file mode 100644 index 000000000..c70f22783 --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_tx_update_expiration_block_delta_binding.wat @@ -0,0 +1,91 @@ +(component + (type (;0;) + (instance + (type (;0;) (record (field "inner" f32))) + (export (;1;) "felt" (type (eq 0))) + (type (;2;) (tuple 1 1 1 1)) + (type (;3;) (record (field "inner" 2))) + (export (;4;) "word" (type (eq 3))) + ) + ) + (import "miden:base/core-types@1.0.0" (instance (;0;) (type 0))) + (core module (;0;) + (type (;0;) (func)) + (type (;1;) (func (param f32 f32 f32 f32))) + (type (;2;) (func (param f32))) + (type (;3;) (func (param i32) (result f32))) + (table (;0;) 2 2 funcref) + (memory (;0;) 17) + (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) + (global $GOT.data.internal.__memory_base (;1;) i32 i32.const 0) + (export "memory" (memory 0)) + (export "miden:base/transaction-script@1.0.0#run" (func $miden:base/transaction-script@1.0.0#run)) + (elem (;0;) (i32.const 1) func $rust_sdk_account_tx_update_expiration_block_delta_binding::bindings::__link_custom_section_describing_imports) + (func $__wasm_call_ctors (;0;) (type 0)) + (func $rust_sdk_account_tx_update_expiration_block_delta_binding::bindings::__link_custom_section_describing_imports (;1;) (type 0)) + (func $miden:base/transaction-script@1.0.0#run (;2;) (type 1) (param f32 f32 f32 f32) + call $wit_bindgen::rt::run_ctors_once + i32.const 42 + call $intrinsics::felt::from_u32 + call $miden_base_sys::bindings::tx::update_expiration_block_delta + ) + (func $wit_bindgen::rt::run_ctors_once (;3;) (type 0) + (local i32) + block ;; label = @1 + global.get $GOT.data.internal.__memory_base + i32.const 1048584 + i32.add + i32.load8_u + br_if 0 (;@1;) + global.get $GOT.data.internal.__memory_base + local.set 0 + call $__wasm_call_ctors + local.get 0 + i32.const 1048584 + i32.add + i32.const 1 + i32.store8 + end + ) + (func $miden_base_sys::bindings::tx::update_expiration_block_delta (;4;) (type 2) (param f32) + local.get 0 + call $miden::tx::update_expiration_block_delta + ) + (func $intrinsics::felt::from_u32 (;5;) (type 3) (param i32) (result f32) + unreachable + ) + (func $miden::tx::update_expiration_block_delta (;6;) (type 2) (param f32) + unreachable + ) + (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") + ) + (alias export 0 "word" (type (;1;))) + (core instance (;0;) (instantiate 0)) + (alias core export 0 "memory" (core memory (;0;))) + (type (;2;) (func (param "arg" 1))) + (alias core export 0 "miden:base/transaction-script@1.0.0#run" (core func (;0;))) + (func (;0;) (type 2) (canon lift (core func 0))) + (alias export 0 "felt" (type (;3;))) + (alias export 0 "word" (type (;4;))) + (component (;0;) + (type (;0;) (record (field "inner" f32))) + (import "import-type-felt" (type (;1;) (eq 0))) + (type (;2;) (tuple 1 1 1 1)) + (type (;3;) (record (field "inner" 2))) + (import "import-type-word" (type (;4;) (eq 3))) + (import "import-type-word0" (type (;5;) (eq 4))) + (type (;6;) (func (param "arg" 5))) + (import "import-func-run" (func (;0;) (type 6))) + (export (;7;) "word" (type 4)) + (type (;8;) (func (param "arg" 7))) + (export (;1;) "run" (func 0) (func (type 8))) + ) + (instance (;1;) (instantiate 0 + (with "import-func-run" (func 0)) + (with "import-type-felt" (type 3)) + (with "import-type-word" (type 4)) + (with "import-type-word0" (type 1)) + ) + ) + (export (;2;) "miden:base/transaction-script@1.0.0" (instance 1)) +) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_was_procedure_called_binding.hir b/tests/integration/expected/rust_sdk/rust_sdk_account_was_procedure_called_binding.hir new file mode 100644 index 000000000..c4b4d0433 --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_was_procedure_called_binding.hir @@ -0,0 +1,181 @@ +builtin.component miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-account-was-procedure-called-binding@0.0.1 { + builtin.module public @rust_sdk_account_was_procedure_called_binding { + private builtin.function @__wasm_call_ctors() { + ^block5: + builtin.ret ; + }; + + private builtin.function @rust_sdk_account_was_procedure_called_binding::bindings::__link_custom_section_describing_imports() { + ^block7: + builtin.ret ; + }; + + private builtin.function @miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-account-was-procedure-called-binding@0.0.1#binding() -> felt { + ^block9: + v3 = builtin.global_symbol @miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-account-was-procedure-called-binding@0.0.1/rust_sdk_account_was_procedure_called_binding/__stack_pointer : ptr + v4 = hir.bitcast v3 : ptr; + v5 = hir.load v4 : i32; + v6 = arith.constant 16 : i32; + v7 = arith.sub v5, v6 : i32 #[overflow = wrapping]; + v8 = builtin.global_symbol @miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-account-was-procedure-called-binding@0.0.1/rust_sdk_account_was_procedure_called_binding/__stack_pointer : ptr + v9 = hir.bitcast v8 : ptr; + hir.store v9, v7; + hir.exec @miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-account-was-procedure-called-binding@0.0.1/rust_sdk_account_was_procedure_called_binding/wit_bindgen::rt::run_ctors_once() + v1 = arith.constant 0 : i32; + v12 = hir.exec @miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-account-was-procedure-called-binding@0.0.1/rust_sdk_account_was_procedure_called_binding/intrinsics::felt::from_u32(v1) : felt + v169 = arith.constant 0 : i32; + v148, v149, v150, v151 = scf.while v169, v7, v12 : i32, i32, felt, i32 { + ^block36(v152: i32, v153: i32, v154: felt): + v167 = arith.constant 0 : i32; + v168 = arith.constant 16 : i32; + v15 = arith.eq v152, v168 : i1; + v16 = arith.zext v15 : u32; + v17 = hir.bitcast v16 : i32; + v19 = arith.neq v17, v167 : i1; + v143 = scf.if v19 : i32 { + ^block35: + v114 = ub.poison i32 : i32; + scf.yield v114; + } else { + ^block14: + v21 = arith.add v153, v152 : i32 #[overflow = wrapping]; + v23 = hir.bitcast v21 : u32; + v32 = arith.constant 4 : u32; + v25 = arith.mod v23, v32 : u32; + hir.assertz v25 #[code = 250]; + v26 = hir.int_to_ptr v23 : ptr; + hir.store v26, v154; + v27 = arith.constant 4 : i32; + v28 = arith.add v152, v27 : i32 #[overflow = wrapping]; + scf.yield v28; + }; + v115 = ub.poison felt : felt; + v145 = cf.select v19, v115, v154 : felt; + v166 = ub.poison i32 : i32; + v144 = cf.select v19, v166, v153 : i32; + v113 = arith.constant 1 : u32; + v107 = arith.constant 0 : u32; + v147 = cf.select v19, v107, v113 : u32; + v137 = arith.trunc v147 : i1; + scf.condition v137, v143, v144, v145, v153; + } do { + ^block37(v155: i32, v156: i32, v157: felt, v158: i32): + scf.yield v155, v156, v157; + }; + v30 = arith.constant 12 : u32; + v29 = hir.bitcast v151 : u32; + v31 = arith.add v29, v30 : u32 #[overflow = checked]; + v165 = arith.constant 4 : u32; + v33 = arith.mod v31, v165 : u32; + hir.assertz v33 #[code = 250]; + v34 = hir.int_to_ptr v31 : ptr; + v35 = hir.load v34 : felt; + v37 = arith.constant 8 : u32; + v36 = hir.bitcast v151 : u32; + v38 = arith.add v36, v37 : u32 #[overflow = checked]; + v164 = arith.constant 4 : u32; + v40 = arith.mod v38, v164 : u32; + hir.assertz v40 #[code = 250]; + v41 = hir.int_to_ptr v38 : ptr; + v42 = hir.load v41 : felt; + v163 = arith.constant 4 : u32; + v43 = hir.bitcast v151 : u32; + v45 = arith.add v43, v163 : u32 #[overflow = checked]; + v162 = arith.constant 4 : u32; + v47 = arith.mod v45, v162 : u32; + hir.assertz v47 #[code = 250]; + v48 = hir.int_to_ptr v45 : ptr; + v49 = hir.load v48 : felt; + v50 = hir.bitcast v151 : u32; + v161 = arith.constant 4 : u32; + v52 = arith.mod v50, v161 : u32; + hir.assertz v52 #[code = 250]; + v53 = hir.int_to_ptr v50 : ptr; + v54 = hir.load v53 : felt; + v55 = hir.exec @miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-account-was-procedure-called-binding@0.0.1/rust_sdk_account_was_procedure_called_binding/miden::native_account::was_procedure_called(v35, v42, v49, v54) : felt + v160 = arith.constant 0 : i32; + v57 = hir.exec @miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-account-was-procedure-called-binding@0.0.1/rust_sdk_account_was_procedure_called_binding/intrinsics::felt::from_u32(v160) : felt + v58 = hir.exec @miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-account-was-procedure-called-binding@0.0.1/rust_sdk_account_was_procedure_called_binding/intrinsics::felt::eq(v55, v57) : i32 + v59 = arith.constant 1 : i32; + v60 = arith.neq v58, v59 : i1; + v61 = arith.zext v60 : u32; + v62 = hir.bitcast v61 : i32; + v63 = hir.exec @miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-account-was-procedure-called-binding@0.0.1/rust_sdk_account_was_procedure_called_binding/intrinsics::felt::from_u32(v62) : felt + v159 = arith.constant 16 : i32; + v65 = arith.add v151, v159 : i32 #[overflow = wrapping]; + v66 = builtin.global_symbol @miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-account-was-procedure-called-binding@0.0.1/rust_sdk_account_was_procedure_called_binding/__stack_pointer : ptr + v67 = hir.bitcast v66 : ptr; + hir.store v67, v65; + builtin.ret v63; + }; + + private builtin.function @wit_bindgen::rt::run_ctors_once() { + ^block15: + v69 = builtin.global_symbol @miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-account-was-procedure-called-binding@0.0.1/rust_sdk_account_was_procedure_called_binding/GOT.data.internal.__memory_base : ptr + v70 = hir.bitcast v69 : ptr; + v71 = hir.load v70 : i32; + v72 = arith.constant 1048584 : i32; + v73 = arith.add v71, v72 : i32 #[overflow = wrapping]; + v74 = hir.bitcast v73 : u32; + v75 = hir.int_to_ptr v74 : ptr; + v76 = hir.load v75 : u8; + v68 = arith.constant 0 : i32; + v77 = arith.zext v76 : u32; + v78 = hir.bitcast v77 : i32; + v80 = arith.neq v78, v68 : i1; + scf.if v80{ + ^block17: + scf.yield ; + } else { + ^block18: + v81 = builtin.global_symbol @miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-account-was-procedure-called-binding@0.0.1/rust_sdk_account_was_procedure_called_binding/GOT.data.internal.__memory_base : ptr + v82 = hir.bitcast v81 : ptr; + v83 = hir.load v82 : i32; + hir.exec @miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-account-was-procedure-called-binding@0.0.1/rust_sdk_account_was_procedure_called_binding/__wasm_call_ctors() + v171 = arith.constant 1 : u8; + v173 = arith.constant 1048584 : i32; + v85 = arith.add v83, v173 : i32 #[overflow = wrapping]; + v89 = hir.bitcast v85 : u32; + v90 = hir.int_to_ptr v89 : ptr; + hir.store v90, v171; + scf.yield ; + }; + builtin.ret ; + }; + + private builtin.function @intrinsics::felt::from_u32(v91: i32) -> felt { + ^block19(v91: i32): + v92 = hir.bitcast v91 : felt; + builtin.ret v92; + }; + + private builtin.function @intrinsics::felt::eq(v94: felt, v95: felt) -> i32 { + ^block21(v94: felt, v95: felt): + v96 = arith.eq v94, v95 : i1; + v97 = hir.cast v96 : i32; + builtin.ret v97; + }; + + private builtin.function @miden::native_account::was_procedure_called(v99: felt, v100: felt, v101: felt, v102: felt) -> felt { + ^block23(v99: felt, v100: felt, v101: felt, v102: felt): + v103 = hir.exec @miden/native_account/was_procedure_called(v99, v100, v101, v102) : felt + builtin.ret v103; + }; + + builtin.global_variable private @#__stack_pointer : i32 { + builtin.ret_imm 1048576; + }; + + builtin.global_variable private @#GOT.data.internal.__memory_base : i32 { + builtin.ret_imm 0; + }; + + builtin.segment @1048576 = 0x0000000100000001; + }; + + public builtin.function @binding() -> felt { + ^block27: + v105 = hir.exec @miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-account-was-procedure-called-binding@0.0.1/rust_sdk_account_was_procedure_called_binding/miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-account-was-procedure-called-binding@0.0.1#binding() : felt + builtin.ret v105; + }; +}; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_was_procedure_called_binding.masm b/tests/integration/expected/rust_sdk/rust_sdk_account_was_procedure_called_binding.masm new file mode 100644 index 000000000..f1aa6eb09 --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_was_procedure_called_binding.masm @@ -0,0 +1,353 @@ +# mod miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-account-was-procedure-called-binding@0.0.1 + +@callconv("canon-lift") +pub proc binding( + +) -> felt + exec.::miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-account-was-procedure-called-binding@0.0.1::init + trace.240 + nop + exec.::miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-account-was-procedure-called-binding@0.0.1::rust_sdk_account_was_procedure_called_binding::miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-account-was-procedure-called-binding@0.0.1#binding + trace.252 + nop + exec.::std::sys::truncate_stack +end + +proc init + push.1179648 + trace.240 + exec.::intrinsics::mem::heap_init + trace.252 + push.[7028007876379170725,18060021366771303825,13412364500725888848,14178532912296021363] + adv.push_mapval + push.262144 + push.1 + trace.240 + exec.::std::mem::pipe_preimage_to_memory + trace.252 + drop + push.1048576 + u32assert + mem_store.278536 + push.0 + u32assert + mem_store.278537 +end + +# mod miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-account-was-procedure-called-binding@0.0.1::rust_sdk_account_was_procedure_called_binding + +@callconv("C") +proc __wasm_call_ctors( + +) + nop +end + +@callconv("C") +proc rust_sdk_account_was_procedure_called_binding::bindings::__link_custom_section_describing_imports( + +) + nop +end + +@callconv("C") +proc miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-account-was-procedure-called-binding@0.0.1#binding( + +) -> felt + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.16 + u32wrapping_sub + push.1114144 + dup.1 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + trace.240 + nop + exec.::miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-account-was-procedure-called-binding@0.0.1::rust_sdk_account_was_procedure_called_binding::wit_bindgen::rt::run_ctors_once + trace.252 + nop + push.0 + trace.240 + nop + exec.::miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-account-was-procedure-called-binding@0.0.1::rust_sdk_account_was_procedure_called_binding::intrinsics::felt::from_u32 + trace.252 + nop + push.0 + movup.2 + swap.1 + push.1 + while.true + push.0 + push.16 + dup.2 + eq + neq + dup.0 + if.true + swap.1 + drop + push.3735929054 + else + dup.2 + dup.2 + u32wrapping_add + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + dup.4 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.4 + movup.2 + u32wrapping_add + end + push.3735929054 + dup.2 + movup.2 + swap.5 + movdn.2 + cdrop + push.3735929054 + dup.2 + dup.4 + swap.2 + swap.1 + cdrop + push.1 + push.0 + movup.4 + cdrop + push.1 + u32and + movup.4 + swap.1 + if.true + movup.3 + drop + push.1 + else + push.0 + end + end + drop + drop + drop + push.12 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.8 + dup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.4 + dup.3 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + dup.3 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + movdn.3 + swap.2 + trace.240 + nop + exec.::miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-account-was-procedure-called-binding@0.0.1::rust_sdk_account_was_procedure_called_binding::miden::native_account::was_procedure_called + trace.252 + nop + push.0 + trace.240 + nop + exec.::miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-account-was-procedure-called-binding@0.0.1::rust_sdk_account_was_procedure_called_binding::intrinsics::felt::from_u32 + trace.252 + nop + swap.1 + trace.240 + nop + exec.::miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-account-was-procedure-called-binding@0.0.1::rust_sdk_account_was_procedure_called_binding::intrinsics::felt::eq + trace.252 + nop + push.1 + neq + trace.240 + nop + exec.::miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-account-was-procedure-called-binding@0.0.1::rust_sdk_account_was_procedure_called_binding::intrinsics::felt::from_u32 + trace.252 + nop + push.16 + movup.2 + u32wrapping_add + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop +end + +@callconv("C") +proc wit_bindgen::rt::run_ctors_once( + +) + push.1114148 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.1048584 + u32wrapping_add + u32divmod.4 + swap.1 + swap.1 + dup.1 + mem_load + swap.1 + push.8 + u32wrapping_mul + u32shr + swap.1 + drop + push.255 + u32and + push.0 + swap.1 + neq + if.true + nop + else + push.1114148 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + trace.240 + nop + exec.::miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-account-was-procedure-called-binding@0.0.1::rust_sdk_account_was_procedure_called_binding::__wasm_call_ctors + trace.252 + nop + push.1 + push.1048584 + movup.2 + u32wrapping_add + u32divmod.4 + swap.1 + dup.0 + mem_load + dup.2 + push.8 + u32wrapping_mul + push.255 + swap.1 + u32shl + u32not + swap.1 + u32and + movup.3 + movup.3 + push.8 + u32wrapping_mul + u32shl + u32or + swap.1 + mem_store + end +end + +@callconv("C") +proc intrinsics::felt::from_u32(i32) -> felt + nop +end + +@callconv("C") +proc intrinsics::felt::eq(felt, felt) -> i32 + eq +end + +@callconv("C") +proc miden::native_account::was_procedure_called(felt, felt, felt, felt) -> felt + trace.240 + nop + exec.::miden::native_account::was_procedure_called + trace.252 + nop +end + diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_was_procedure_called_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_account_was_procedure_called_binding.wat new file mode 100644 index 000000000..69549fbd9 --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_was_procedure_called_binding.wat @@ -0,0 +1,131 @@ +(component + (type (;0;) + (instance + (type (;0;) (record (field "inner" f32))) + (export (;1;) "felt" (type (eq 0))) + ) + ) + (import "miden:base/core-types@1.0.0" (instance (;0;) (type 0))) + (core module (;0;) + (type (;0;) (func)) + (type (;1;) (func (result f32))) + (type (;2;) (func (param i32) (result f32))) + (type (;3;) (func (param f32 f32) (result i32))) + (type (;4;) (func (param f32 f32 f32 f32) (result f32))) + (table (;0;) 2 2 funcref) + (memory (;0;) 17) + (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) + (global $GOT.data.internal.__memory_base (;1;) i32 i32.const 0) + (export "memory" (memory 0)) + (export "miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-account-was-procedure-called-binding@0.0.1#binding" (func $miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-account-was-procedure-called-binding@0.0.1#binding)) + (elem (;0;) (i32.const 1) func $rust_sdk_account_was_procedure_called_binding::bindings::__link_custom_section_describing_imports) + (func $__wasm_call_ctors (;0;) (type 0)) + (func $rust_sdk_account_was_procedure_called_binding::bindings::__link_custom_section_describing_imports (;1;) (type 0)) + (func $miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-account-was-procedure-called-binding@0.0.1#binding (;2;) (type 1) (result f32) + (local i32 i32 f32) + global.get $__stack_pointer + i32.const 16 + i32.sub + local.tee 0 + global.set $__stack_pointer + call $wit_bindgen::rt::run_ctors_once + i32.const 0 + local.set 1 + i32.const 0 + call $intrinsics::felt::from_u32 + local.set 2 + block ;; label = @1 + loop ;; label = @2 + local.get 1 + i32.const 16 + i32.eq + br_if 1 (;@1;) + local.get 0 + local.get 1 + i32.add + local.get 2 + f32.store + local.get 1 + i32.const 4 + i32.add + local.set 1 + br 0 (;@2;) + end + end + local.get 0 + f32.load offset=12 + local.get 0 + f32.load offset=8 + local.get 0 + f32.load offset=4 + local.get 0 + f32.load + call $miden::native_account::was_procedure_called + i32.const 0 + call $intrinsics::felt::from_u32 + call $intrinsics::felt::eq + i32.const 1 + i32.ne + call $intrinsics::felt::from_u32 + local.set 2 + local.get 0 + i32.const 16 + i32.add + global.set $__stack_pointer + local.get 2 + ) + (func $wit_bindgen::rt::run_ctors_once (;3;) (type 0) + (local i32) + block ;; label = @1 + global.get $GOT.data.internal.__memory_base + i32.const 1048584 + i32.add + i32.load8_u + br_if 0 (;@1;) + global.get $GOT.data.internal.__memory_base + local.set 0 + call $__wasm_call_ctors + local.get 0 + i32.const 1048584 + i32.add + i32.const 1 + i32.store8 + end + ) + (func $intrinsics::felt::from_u32 (;4;) (type 2) (param i32) (result f32) + unreachable + ) + (func $intrinsics::felt::eq (;5;) (type 3) (param f32 f32) (result i32) + unreachable + ) + (func $miden::native_account::was_procedure_called (;6;) (type 4) (param f32 f32 f32 f32) (result f32) + unreachable + ) + (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") + (@custom "rodata,miden_account" (after data) "[rust_sdk_account_was_procedure_called_binding\01\0b0.0.1\03\01\01\00\00\00\00\00\00\00\00") + ) + (alias export 0 "felt" (type (;1;))) + (core instance (;0;) (instantiate 0)) + (alias core export 0 "memory" (core memory (;0;))) + (type (;2;) (func (result 1))) + (alias core export 0 "miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-account-was-procedure-called-binding@0.0.1#binding" (core func (;0;))) + (func (;0;) (type 2) (canon lift (core func 0))) + (alias export 0 "felt" (type (;3;))) + (component (;0;) + (type (;0;) (record (field "inner" f32))) + (import "import-type-felt" (type (;1;) (eq 0))) + (import "import-type-felt0" (type (;2;) (eq 1))) + (type (;3;) (func (result 2))) + (import "import-func-binding" (func (;0;) (type 3))) + (export (;4;) "felt" (type 1)) + (type (;5;) (func (result 4))) + (export (;1;) "binding" (func 0) (func (type 5))) + ) + (instance (;1;) (instantiate 0 + (with "import-func-binding" (func 0)) + (with "import-type-felt" (type 3)) + (with "import-type-felt0" (type 1)) + ) + ) + (export (;2;) "miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-account-was-procedure-called-binding@0.0.1" (instance 1)) +) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_assets_binding.hir b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_assets_binding.hir new file mode 100644 index 000000000..5e07e1929 --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_assets_binding.hir @@ -0,0 +1,958 @@ +builtin.component miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1 { + builtin.module public @rust_sdk_input_note_get_assets_binding { + private builtin.function @__wasm_call_ctors() { + ^block5: + builtin.ret ; + }; + + private builtin.function @__rustc::__rust_alloc(v0: i32, v1: i32) -> i32 { + ^block7(v0: i32, v1: i32): + v3 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/GOT.data.internal.__memory_base : ptr + v4 = hir.bitcast v3 : ptr; + v5 = hir.load v4 : i32; + v6 = arith.constant 1048676 : i32; + v7 = arith.add v5, v6 : i32 #[overflow = wrapping]; + v8 = hir.exec @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/::alloc(v7, v1, v0) : i32 + builtin.ret v8; + }; + + private builtin.function @__rustc::__rust_dealloc(v9: i32, v10: i32, v11: i32) { + ^block9(v9: i32, v10: i32, v11: i32): + builtin.ret ; + }; + + private builtin.function @__rustc::__rust_alloc_zeroed(v12: i32, v13: i32) -> i32 { + ^block11(v12: i32, v13: i32): + v15 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/GOT.data.internal.__memory_base : ptr + v16 = hir.bitcast v15 : ptr; + v17 = hir.load v16 : i32; + v18 = arith.constant 1048676 : i32; + v19 = arith.add v17, v18 : i32 #[overflow = wrapping]; + v20 = hir.exec @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/::alloc(v19, v13, v12) : i32 + v668 = arith.constant 0 : i32; + v21 = arith.constant 0 : i32; + v22 = arith.eq v20, v21 : i1; + v23 = arith.zext v22 : u32; + v24 = hir.bitcast v23 : i32; + v26 = arith.neq v24, v668 : i1; + scf.if v26{ + ^block13: + scf.yield ; + } else { + ^block14: + v666 = arith.constant 0 : i32; + v667 = arith.constant 0 : i32; + v28 = arith.eq v12, v667 : i1; + v29 = arith.zext v28 : u32; + v30 = hir.bitcast v29 : i32; + v32 = arith.neq v30, v666 : i1; + scf.if v32{ + ^block94: + scf.yield ; + } else { + ^block15: + v660 = arith.constant 0 : u8; + v35 = hir.bitcast v12 : u32; + v36 = hir.bitcast v20 : u32; + v37 = hir.int_to_ptr v36 : ptr; + hir.mem_set v37, v35, v660; + scf.yield ; + }; + scf.yield ; + }; + builtin.ret v20; + }; + + private builtin.function @rust_sdk_input_note_get_assets_binding::bindings::__link_custom_section_describing_imports() { + ^block16: + builtin.ret ; + }; + + private builtin.function @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1#binding() -> felt { + ^block18: + v42 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/__stack_pointer : ptr + v43 = hir.bitcast v42 : ptr; + v44 = hir.load v43 : i32; + v45 = arith.constant 16 : i32; + v46 = arith.sub v44, v45 : i32 #[overflow = wrapping]; + v47 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/__stack_pointer : ptr + v48 = hir.bitcast v47 : ptr; + hir.store v48, v46; + hir.exec @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/wit_bindgen::rt::run_ctors_once() + v40 = arith.constant 0 : i32; + v52 = hir.exec @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/intrinsics::felt::from_u32(v40) : felt + v49 = arith.constant 4 : i32; + v50 = arith.add v46, v49 : i32 #[overflow = wrapping]; + hir.exec @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/miden_base_sys::bindings::input_note::get_assets(v50, v52) + v54 = arith.constant 12 : u32; + v53 = hir.bitcast v46 : u32; + v55 = arith.add v53, v54 : u32 #[overflow = checked]; + v56 = arith.constant 4 : u32; + v57 = arith.mod v55, v56 : u32; + hir.assertz v57 #[code = 250]; + v58 = hir.int_to_ptr v55 : ptr; + v59 = hir.load v58 : i32; + v60 = hir.exec @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/intrinsics::felt::from_u32(v59) : felt + v670 = arith.constant 16 : i32; + v671 = arith.constant 4 : i32; + v62 = arith.add v46, v671 : i32 #[overflow = wrapping]; + hir.exec @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/alloc::raw_vec::RawVecInner::deallocate(v62, v670, v670) + v669 = arith.constant 16 : i32; + v66 = arith.add v46, v669 : i32 #[overflow = wrapping]; + v67 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/__stack_pointer : ptr + v68 = hir.bitcast v67 : ptr; + hir.store v68, v66; + builtin.ret v60; + }; + + private builtin.function @__rustc::__rust_no_alloc_shim_is_unstable_v2() { + ^block20: + builtin.ret ; + }; + + private builtin.function @wit_bindgen::rt::run_ctors_once() { + ^block22: + v70 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/GOT.data.internal.__memory_base : ptr + v71 = hir.bitcast v70 : ptr; + v72 = hir.load v71 : i32; + v73 = arith.constant 1048680 : i32; + v74 = arith.add v72, v73 : i32 #[overflow = wrapping]; + v75 = hir.bitcast v74 : u32; + v76 = hir.int_to_ptr v75 : ptr; + v77 = hir.load v76 : u8; + v69 = arith.constant 0 : i32; + v78 = arith.zext v77 : u32; + v79 = hir.bitcast v78 : i32; + v81 = arith.neq v79, v69 : i1; + scf.if v81{ + ^block24: + scf.yield ; + } else { + ^block25: + v82 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/GOT.data.internal.__memory_base : ptr + v83 = hir.bitcast v82 : ptr; + v84 = hir.load v83 : i32; + hir.exec @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/__wasm_call_ctors() + v673 = arith.constant 1 : u8; + v675 = arith.constant 1048680 : i32; + v86 = arith.add v84, v675 : i32 #[overflow = wrapping]; + v90 = hir.bitcast v86 : u32; + v91 = hir.int_to_ptr v90 : ptr; + hir.store v91, v673; + scf.yield ; + }; + builtin.ret ; + }; + + private builtin.function @::alloc(v92: i32, v93: i32, v94: i32) -> i32 { + ^block26(v92: i32, v93: i32, v94: i32): + v97 = arith.constant 16 : i32; + v96 = arith.constant 0 : i32; + v677 = arith.constant 16 : u32; + v99 = hir.bitcast v93 : u32; + v101 = arith.gt v99, v677 : i1; + v102 = arith.zext v101 : u32; + v103 = hir.bitcast v102 : i32; + v105 = arith.neq v103, v96 : i1; + v106 = cf.select v105, v93, v97 : i32; + v717 = arith.constant 0 : i32; + v107 = arith.constant -1 : i32; + v108 = arith.add v106, v107 : i32 #[overflow = wrapping]; + v109 = arith.band v106, v108 : i32; + v111 = arith.neq v109, v717 : i1; + v686, v687 = scf.if v111 : i32, u32 { + ^block100: + v678 = arith.constant 0 : u32; + v682 = ub.poison i32 : i32; + scf.yield v682, v678; + } else { + ^block29: + v113 = hir.exec @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/core::ptr::alignment::Alignment::max(v93, v106) : i32 + v716 = arith.constant 0 : i32; + v112 = arith.constant -2147483648 : i32; + v114 = arith.sub v112, v113 : i32 #[overflow = wrapping]; + v116 = hir.bitcast v114 : u32; + v115 = hir.bitcast v94 : u32; + v117 = arith.gt v115, v116 : i1; + v118 = arith.zext v117 : u32; + v119 = hir.bitcast v118 : i32; + v121 = arith.neq v119, v716 : i1; + v701 = scf.if v121 : i32 { + ^block99: + v715 = ub.poison i32 : i32; + scf.yield v715; + } else { + ^block30: + v713 = arith.constant 0 : i32; + v127 = arith.sub v713, v113 : i32 #[overflow = wrapping]; + v714 = arith.constant -1 : i32; + v123 = arith.add v94, v113 : i32 #[overflow = wrapping]; + v125 = arith.add v123, v714 : i32 #[overflow = wrapping]; + v128 = arith.band v125, v127 : i32; + v129 = hir.bitcast v92 : u32; + v130 = arith.constant 4 : u32; + v131 = arith.mod v129, v130 : u32; + hir.assertz v131 #[code = 250]; + v132 = hir.int_to_ptr v129 : ptr; + v133 = hir.load v132 : i32; + v712 = arith.constant 0 : i32; + v135 = arith.neq v133, v712 : i1; + scf.if v135{ + ^block98: + scf.yield ; + } else { + ^block32: + v136 = hir.exec @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/intrinsics::mem::heap_base() : i32 + v137 = hir.mem_size : u32; + v143 = hir.bitcast v92 : u32; + v711 = arith.constant 4 : u32; + v145 = arith.mod v143, v711 : u32; + hir.assertz v145 #[code = 250]; + v710 = arith.constant 16 : u32; + v138 = hir.bitcast v137 : i32; + v141 = arith.shl v138, v710 : i32; + v142 = arith.add v136, v141 : i32 #[overflow = wrapping]; + v146 = hir.int_to_ptr v143 : ptr; + hir.store v146, v142; + scf.yield ; + }; + v149 = hir.bitcast v92 : u32; + v709 = arith.constant 4 : u32; + v151 = arith.mod v149, v709 : u32; + hir.assertz v151 #[code = 250]; + v152 = hir.int_to_ptr v149 : ptr; + v153 = hir.load v152 : i32; + v707 = arith.constant 0 : i32; + v708 = arith.constant -1 : i32; + v155 = arith.bxor v153, v708 : i32; + v157 = hir.bitcast v155 : u32; + v156 = hir.bitcast v128 : u32; + v158 = arith.gt v156, v157 : i1; + v159 = arith.zext v158 : u32; + v160 = hir.bitcast v159 : i32; + v162 = arith.neq v160, v707 : i1; + v700 = scf.if v162 : i32 { + ^block33: + v706 = arith.constant 0 : i32; + scf.yield v706; + } else { + ^block34: + v164 = hir.bitcast v92 : u32; + v705 = arith.constant 4 : u32; + v166 = arith.mod v164, v705 : u32; + hir.assertz v166 #[code = 250]; + v163 = arith.add v153, v128 : i32 #[overflow = wrapping]; + v167 = hir.int_to_ptr v164 : ptr; + hir.store v167, v163; + v169 = arith.add v153, v113 : i32 #[overflow = wrapping]; + scf.yield v169; + }; + scf.yield v700; + }; + v683 = arith.constant 1 : u32; + v704 = arith.constant 0 : u32; + v702 = cf.select v121, v704, v683 : u32; + scf.yield v701, v702; + }; + v703 = arith.constant 0 : u32; + v699 = arith.eq v687, v703 : i1; + cf.cond_br v699 ^block28, ^block102(v686); + ^block28: + ub.unreachable ; + ^block102(v679: i32): + builtin.ret v679; + }; + + private builtin.function @intrinsics::mem::heap_base() -> i32 { + ^block35: + v172 = hir.exec @intrinsics/mem/heap_base() : i32 + builtin.ret v172; + }; + + private builtin.function @alloc::vec::Vec::with_capacity(v174: i32, v175: i32) { + ^block39(v174: i32, v175: i32): + v178 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/__stack_pointer : ptr + v179 = hir.bitcast v178 : ptr; + v180 = hir.load v179 : i32; + v181 = arith.constant 16 : i32; + v182 = arith.sub v180, v181 : i32 #[overflow = wrapping]; + v183 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/__stack_pointer : ptr + v184 = hir.bitcast v183 : ptr; + hir.store v184, v182; + v722 = arith.constant 16 : i32; + v185 = arith.constant 8 : i32; + v186 = arith.add v182, v185 : i32 #[overflow = wrapping]; + hir.exec @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/alloc::raw_vec::RawVecInner::with_capacity_in(v186, v722, v722, v175) + v190 = arith.constant 8 : u32; + v189 = hir.bitcast v182 : u32; + v191 = arith.add v189, v190 : u32 #[overflow = checked]; + v721 = arith.constant 8 : u32; + v193 = arith.mod v191, v721 : u32; + hir.assertz v193 #[code = 250]; + v194 = hir.int_to_ptr v191 : ptr; + v195 = hir.load v194 : i64; + v720 = arith.constant 8 : u32; + v197 = hir.bitcast v174 : u32; + v199 = arith.add v197, v720 : u32 #[overflow = checked]; + v200 = arith.constant 4 : u32; + v201 = arith.mod v199, v200 : u32; + hir.assertz v201 #[code = 250]; + v176 = arith.constant 0 : i32; + v202 = hir.int_to_ptr v199 : ptr; + hir.store v202, v176; + v203 = hir.bitcast v174 : u32; + v719 = arith.constant 4 : u32; + v205 = arith.mod v203, v719 : u32; + hir.assertz v205 #[code = 250]; + v206 = hir.int_to_ptr v203 : ptr; + hir.store v206, v195; + v718 = arith.constant 16 : i32; + v208 = arith.add v182, v718 : i32 #[overflow = wrapping]; + v209 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/__stack_pointer : ptr + v210 = hir.bitcast v209 : ptr; + hir.store v210, v208; + builtin.ret ; + }; + + private builtin.function @alloc::raw_vec::RawVecInner::with_capacity_in(v211: i32, v212: i32, v213: i32, v214: i32) { + ^block41(v211: i32, v212: i32, v213: i32, v214: i32): + v216 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/__stack_pointer : ptr + v217 = hir.bitcast v216 : ptr; + v218 = hir.load v217 : i32; + v219 = arith.constant 16 : i32; + v220 = arith.sub v218, v219 : i32 #[overflow = wrapping]; + v221 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/__stack_pointer : ptr + v222 = hir.bitcast v221 : ptr; + hir.store v222, v220; + v215 = arith.constant 0 : i32; + v225 = arith.constant 256 : i32; + v223 = arith.constant 4 : i32; + v224 = arith.add v220, v223 : i32 #[overflow = wrapping]; + hir.exec @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/alloc::raw_vec::RawVecInner::try_allocate_in(v224, v225, v215, v212, v213) + v228 = arith.constant 8 : u32; + v227 = hir.bitcast v220 : u32; + v229 = arith.add v227, v228 : u32 #[overflow = checked]; + v230 = arith.constant 4 : u32; + v231 = arith.mod v229, v230 : u32; + hir.assertz v231 #[code = 250]; + v232 = hir.int_to_ptr v229 : ptr; + v233 = hir.load v232 : i32; + v733 = arith.constant 4 : u32; + v234 = hir.bitcast v220 : u32; + v236 = arith.add v234, v733 : u32 #[overflow = checked]; + v732 = arith.constant 4 : u32; + v238 = arith.mod v236, v732 : u32; + hir.assertz v238 #[code = 250]; + v239 = hir.int_to_ptr v236 : ptr; + v240 = hir.load v239 : i32; + v731 = arith.constant 0 : i32; + v241 = arith.constant 1 : i32; + v242 = arith.neq v240, v241 : i1; + v243 = arith.zext v242 : u32; + v244 = hir.bitcast v243 : i32; + v246 = arith.neq v244, v731 : i1; + cf.cond_br v246 ^block43, ^block44; + ^block43: + v255 = arith.constant 12 : u32; + v254 = hir.bitcast v220 : u32; + v256 = arith.add v254, v255 : u32 #[overflow = checked]; + v730 = arith.constant 4 : u32; + v258 = arith.mod v256, v730 : u32; + hir.assertz v258 #[code = 250]; + v259 = hir.int_to_ptr v256 : ptr; + v260 = hir.load v259 : i32; + v729 = arith.constant 4 : u32; + v261 = hir.bitcast v211 : u32; + v263 = arith.add v261, v729 : u32 #[overflow = checked]; + v728 = arith.constant 4 : u32; + v265 = arith.mod v263, v728 : u32; + hir.assertz v265 #[code = 250]; + v266 = hir.int_to_ptr v263 : ptr; + hir.store v266, v260; + v267 = hir.bitcast v211 : u32; + v727 = arith.constant 4 : u32; + v269 = arith.mod v267, v727 : u32; + hir.assertz v269 #[code = 250]; + v270 = hir.int_to_ptr v267 : ptr; + hir.store v270, v233; + v726 = arith.constant 16 : i32; + v272 = arith.add v220, v726 : i32 #[overflow = wrapping]; + v273 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/__stack_pointer : ptr + v274 = hir.bitcast v273 : ptr; + hir.store v274, v272; + builtin.ret ; + ^block44: + v725 = arith.constant 12 : u32; + v247 = hir.bitcast v220 : u32; + v249 = arith.add v247, v725 : u32 #[overflow = checked]; + v724 = arith.constant 4 : u32; + v251 = arith.mod v249, v724 : u32; + hir.assertz v251 #[code = 250]; + v252 = hir.int_to_ptr v249 : ptr; + v253 = hir.load v252 : i32; + hir.exec @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/alloc::raw_vec::handle_error(v233, v253, v214) + ub.unreachable ; + }; + + private builtin.function @miden_base_sys::bindings::input_note::get_assets(v275: i32, v276: felt) { + ^block45(v275: i32, v276: felt): + v278 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/__stack_pointer : ptr + v279 = hir.bitcast v278 : ptr; + v280 = hir.load v279 : i32; + v281 = arith.constant 16 : i32; + v282 = arith.sub v280, v281 : i32 #[overflow = wrapping]; + v283 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/__stack_pointer : ptr + v284 = hir.bitcast v283 : ptr; + hir.store v284, v282; + v287 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/GOT.data.internal.__memory_base : ptr + v288 = hir.bitcast v287 : ptr; + v289 = hir.load v288 : i32; + v290 = arith.constant 1048660 : i32; + v291 = arith.add v289, v290 : i32 #[overflow = wrapping]; + v285 = arith.constant 4 : i32; + v286 = arith.add v282, v285 : i32 #[overflow = wrapping]; + hir.exec @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/alloc::vec::Vec::with_capacity(v286, v291) + v295 = arith.constant 8 : u32; + v294 = hir.bitcast v282 : u32; + v296 = arith.add v294, v295 : u32 #[overflow = checked]; + v297 = arith.constant 4 : u32; + v298 = arith.mod v296, v297 : u32; + hir.assertz v298 #[code = 250]; + v299 = hir.int_to_ptr v296 : ptr; + v300 = hir.load v299 : i32; + v734 = arith.constant 2 : u32; + v302 = hir.bitcast v300 : u32; + v304 = arith.shr v302, v734 : u32; + v305 = hir.bitcast v304 : i32; + v306 = hir.exec @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/miden::input_note::get_assets(v305, v276) : i32 + v292 = arith.constant 8 : i32; + v293 = arith.add v275, v292 : i32 #[overflow = wrapping]; + v307 = hir.bitcast v293 : u32; + v739 = arith.constant 4 : u32; + v309 = arith.mod v307, v739 : u32; + hir.assertz v309 #[code = 250]; + v310 = hir.int_to_ptr v307 : ptr; + hir.store v310, v306; + v738 = arith.constant 4 : u32; + v311 = hir.bitcast v282 : u32; + v313 = arith.add v311, v738 : u32 #[overflow = checked]; + v737 = arith.constant 4 : u32; + v315 = arith.mod v313, v737 : u32; + hir.assertz v315 #[code = 250]; + v316 = hir.int_to_ptr v313 : ptr; + v317 = hir.load v316 : i64; + v318 = hir.bitcast v275 : u32; + v736 = arith.constant 4 : u32; + v320 = arith.mod v318, v736 : u32; + hir.assertz v320 #[code = 250]; + v321 = hir.int_to_ptr v318 : ptr; + hir.store v321, v317; + v735 = arith.constant 16 : i32; + v323 = arith.add v282, v735 : i32 #[overflow = wrapping]; + v324 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/__stack_pointer : ptr + v325 = hir.bitcast v324 : ptr; + hir.store v325, v323; + builtin.ret ; + }; + + private builtin.function @intrinsics::felt::from_u32(v326: i32) -> felt { + ^block47(v326: i32): + v327 = hir.bitcast v326 : felt; + builtin.ret v327; + }; + + private builtin.function @alloc::raw_vec::RawVecInner::deallocate(v329: i32, v330: i32, v331: i32) { + ^block49(v329: i32, v330: i32, v331: i32): + v333 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/__stack_pointer : ptr + v334 = hir.bitcast v333 : ptr; + v335 = hir.load v334 : i32; + v336 = arith.constant 16 : i32; + v337 = arith.sub v335, v336 : i32 #[overflow = wrapping]; + v338 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/__stack_pointer : ptr + v339 = hir.bitcast v338 : ptr; + hir.store v339, v337; + v340 = arith.constant 4 : i32; + v341 = arith.add v337, v340 : i32 #[overflow = wrapping]; + hir.exec @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/alloc::raw_vec::RawVecInner::current_memory(v341, v329, v330, v331) + v343 = arith.constant 8 : u32; + v342 = hir.bitcast v337 : u32; + v344 = arith.add v342, v343 : u32 #[overflow = checked]; + v345 = arith.constant 4 : u32; + v346 = arith.mod v344, v345 : u32; + hir.assertz v346 #[code = 250]; + v347 = hir.int_to_ptr v344 : ptr; + v348 = hir.load v347 : i32; + v746 = arith.constant 0 : i32; + v332 = arith.constant 0 : i32; + v350 = arith.eq v348, v332 : i1; + v351 = arith.zext v350 : u32; + v352 = hir.bitcast v351 : i32; + v354 = arith.neq v352, v746 : i1; + scf.if v354{ + ^block108: + scf.yield ; + } else { + ^block52: + v745 = arith.constant 4 : u32; + v355 = hir.bitcast v337 : u32; + v357 = arith.add v355, v745 : u32 #[overflow = checked]; + v744 = arith.constant 4 : u32; + v359 = arith.mod v357, v744 : u32; + hir.assertz v359 #[code = 250]; + v360 = hir.int_to_ptr v357 : ptr; + v361 = hir.load v360 : i32; + v363 = arith.constant 12 : u32; + v362 = hir.bitcast v337 : u32; + v364 = arith.add v362, v363 : u32 #[overflow = checked]; + v743 = arith.constant 4 : u32; + v366 = arith.mod v364, v743 : u32; + hir.assertz v366 #[code = 250]; + v367 = hir.int_to_ptr v364 : ptr; + v368 = hir.load v367 : i32; + hir.exec @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/::deallocate(v361, v348, v368) + scf.yield ; + }; + v742 = arith.constant 16 : i32; + v371 = arith.add v337, v742 : i32 #[overflow = wrapping]; + v372 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/__stack_pointer : ptr + v373 = hir.bitcast v372 : ptr; + hir.store v373, v371; + builtin.ret ; + }; + + private builtin.function @alloc::raw_vec::RawVecInner::try_allocate_in(v374: i32, v375: i32, v376: i32, v377: i32, v378: i32) { + ^block53(v374: i32, v375: i32, v376: i32, v377: i32, v378: i32): + v381 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/__stack_pointer : ptr + v382 = hir.bitcast v381 : ptr; + v383 = hir.load v382 : i32; + v384 = arith.constant 16 : i32; + v385 = arith.sub v383, v384 : i32 #[overflow = wrapping]; + v386 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/__stack_pointer : ptr + v387 = hir.bitcast v386 : ptr; + hir.store v387, v385; + v397 = hir.bitcast v375 : u32; + v398 = arith.zext v397 : u64; + v399 = hir.bitcast v398 : i64; + v379 = arith.constant 0 : i32; + v392 = arith.sub v379, v377 : i32 #[overflow = wrapping]; + v389 = arith.constant -1 : i32; + v388 = arith.add v377, v378 : i32 #[overflow = wrapping]; + v390 = arith.add v388, v389 : i32 #[overflow = wrapping]; + v393 = arith.band v390, v392 : i32; + v394 = hir.bitcast v393 : u32; + v395 = arith.zext v394 : u64; + v396 = hir.bitcast v395 : i64; + v400 = arith.mul v396, v399 : i64 #[overflow = wrapping]; + v850 = arith.constant 0 : i32; + v401 = arith.constant 32 : i64; + v403 = hir.cast v401 : u32; + v402 = hir.bitcast v400 : u64; + v404 = arith.shr v402, v403 : u64; + v405 = hir.bitcast v404 : i64; + v406 = arith.trunc v405 : i32; + v408 = arith.neq v406, v850 : i1; + v762, v763, v764, v765, v766, v767 = scf.if v408 : i32, i32, i32, i32, i32, u32 { + ^block110: + v747 = arith.constant 0 : u32; + v754 = ub.poison i32 : i32; + scf.yield v374, v385, v754, v754, v754, v747; + } else { + ^block58: + v409 = arith.trunc v400 : i32; + v849 = arith.constant 0 : i32; + v410 = arith.constant -2147483648 : i32; + v411 = arith.sub v410, v377 : i32 #[overflow = wrapping]; + v413 = hir.bitcast v411 : u32; + v412 = hir.bitcast v409 : u32; + v414 = arith.lte v412, v413 : i1; + v415 = arith.zext v414 : u32; + v416 = hir.bitcast v415 : i32; + v418 = arith.neq v416, v849 : i1; + v810 = scf.if v418 : i32 { + ^block56: + v848 = arith.constant 0 : i32; + v429 = arith.neq v409, v848 : i1; + v809 = scf.if v429 : i32 { + ^block60: + v847 = arith.constant 0 : i32; + v445 = arith.neq v376, v847 : i1; + v808 = scf.if v445 : i32 { + ^block63: + v427 = arith.constant 1 : i32; + hir.exec @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/alloc::alloc::Global::alloc_impl(v385, v377, v409, v427) + v456 = hir.bitcast v385 : u32; + v501 = arith.constant 4 : u32; + v458 = arith.mod v456, v501 : u32; + hir.assertz v458 #[code = 250]; + v459 = hir.int_to_ptr v456 : ptr; + v460 = hir.load v459 : i32; + scf.yield v460; + } else { + ^block64: + v446 = arith.constant 8 : i32; + v447 = arith.add v385, v446 : i32 #[overflow = wrapping]; + hir.exec @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/::allocate(v447, v377, v409) + v431 = arith.constant 8 : u32; + v448 = hir.bitcast v385 : u32; + v450 = arith.add v448, v431 : u32 #[overflow = checked]; + v846 = arith.constant 4 : u32; + v452 = arith.mod v450, v846 : u32; + hir.assertz v452 #[code = 250]; + v453 = hir.int_to_ptr v450 : ptr; + v454 = hir.load v453 : i32; + scf.yield v454; + }; + v844 = arith.constant 0 : i32; + v845 = arith.constant 0 : i32; + v463 = arith.eq v808, v845 : i1; + v464 = arith.zext v463 : u32; + v465 = hir.bitcast v464 : i32; + v467 = arith.neq v465, v844 : i1; + scf.if v467{ + ^block65: + v843 = arith.constant 8 : u32; + v484 = hir.bitcast v374 : u32; + v486 = arith.add v484, v843 : u32 #[overflow = checked]; + v842 = arith.constant 4 : u32; + v488 = arith.mod v486, v842 : u32; + hir.assertz v488 #[code = 250]; + v489 = hir.int_to_ptr v486 : ptr; + hir.store v489, v409; + v841 = arith.constant 4 : u32; + v491 = hir.bitcast v374 : u32; + v493 = arith.add v491, v841 : u32 #[overflow = checked]; + v840 = arith.constant 4 : u32; + v495 = arith.mod v493, v840 : u32; + hir.assertz v495 #[code = 250]; + v496 = hir.int_to_ptr v493 : ptr; + hir.store v496, v377; + scf.yield ; + } else { + ^block66: + v839 = arith.constant 8 : u32; + v469 = hir.bitcast v374 : u32; + v471 = arith.add v469, v839 : u32 #[overflow = checked]; + v838 = arith.constant 4 : u32; + v473 = arith.mod v471, v838 : u32; + hir.assertz v473 #[code = 250]; + v474 = hir.int_to_ptr v471 : ptr; + hir.store v474, v808; + v837 = arith.constant 4 : u32; + v476 = hir.bitcast v374 : u32; + v478 = arith.add v476, v837 : u32 #[overflow = checked]; + v836 = arith.constant 4 : u32; + v480 = arith.mod v478, v836 : u32; + hir.assertz v480 #[code = 250]; + v481 = hir.int_to_ptr v478 : ptr; + hir.store v481, v375; + scf.yield ; + }; + v834 = arith.constant 0 : i32; + v835 = arith.constant 1 : i32; + v807 = cf.select v467, v835, v834 : i32; + scf.yield v807; + } else { + ^block61: + v833 = arith.constant 8 : u32; + v430 = hir.bitcast v374 : u32; + v432 = arith.add v430, v833 : u32 #[overflow = checked]; + v832 = arith.constant 4 : u32; + v434 = arith.mod v432, v832 : u32; + hir.assertz v434 #[code = 250]; + v435 = hir.int_to_ptr v432 : ptr; + hir.store v435, v377; + v831 = arith.constant 4 : u32; + v438 = hir.bitcast v374 : u32; + v440 = arith.add v438, v831 : u32 #[overflow = checked]; + v830 = arith.constant 4 : u32; + v442 = arith.mod v440, v830 : u32; + hir.assertz v442 #[code = 250]; + v829 = arith.constant 0 : i32; + v443 = hir.int_to_ptr v440 : ptr; + hir.store v443, v829; + v828 = arith.constant 0 : i32; + scf.yield v828; + }; + scf.yield v809; + } else { + ^block59: + v827 = ub.poison i32 : i32; + scf.yield v827; + }; + v822 = arith.constant 0 : u32; + v755 = arith.constant 1 : u32; + v815 = cf.select v418, v755, v822 : u32; + v823 = ub.poison i32 : i32; + v814 = cf.select v418, v385, v823 : i32; + v824 = ub.poison i32 : i32; + v813 = cf.select v418, v374, v824 : i32; + v825 = ub.poison i32 : i32; + v812 = cf.select v418, v825, v385 : i32; + v826 = ub.poison i32 : i32; + v811 = cf.select v418, v826, v374 : i32; + scf.yield v811, v812, v813, v810, v814, v815; + }; + v768, v769, v770 = scf.index_switch v767 : i32, i32, i32 + case 0 { + ^block57: + v821 = arith.constant 4 : u32; + v421 = hir.bitcast v762 : u32; + v423 = arith.add v421, v821 : u32 #[overflow = checked]; + v820 = arith.constant 4 : u32; + v425 = arith.mod v423, v820 : u32; + hir.assertz v425 #[code = 250]; + v819 = arith.constant 0 : i32; + v426 = hir.int_to_ptr v423 : ptr; + hir.store v426, v819; + v818 = arith.constant 1 : i32; + scf.yield v762, v818, v763; + } + default { + ^block114: + scf.yield v764, v765, v766; + }; + v500 = hir.bitcast v768 : u32; + v817 = arith.constant 4 : u32; + v502 = arith.mod v500, v817 : u32; + hir.assertz v502 #[code = 250]; + v503 = hir.int_to_ptr v500 : ptr; + hir.store v503, v769; + v816 = arith.constant 16 : i32; + v508 = arith.add v770, v816 : i32 #[overflow = wrapping]; + v509 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/__stack_pointer : ptr + v510 = hir.bitcast v509 : ptr; + hir.store v510, v508; + builtin.ret ; + }; + + private builtin.function @::allocate(v511: i32, v512: i32, v513: i32) { + ^block67(v511: i32, v512: i32, v513: i32): + v515 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/__stack_pointer : ptr + v516 = hir.bitcast v515 : ptr; + v517 = hir.load v516 : i32; + v518 = arith.constant 16 : i32; + v519 = arith.sub v517, v518 : i32 #[overflow = wrapping]; + v520 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/__stack_pointer : ptr + v521 = hir.bitcast v520 : ptr; + hir.store v521, v519; + v514 = arith.constant 0 : i32; + v522 = arith.constant 8 : i32; + v523 = arith.add v519, v522 : i32 #[overflow = wrapping]; + hir.exec @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/alloc::alloc::Global::alloc_impl(v523, v512, v513, v514) + v526 = arith.constant 12 : u32; + v525 = hir.bitcast v519 : u32; + v527 = arith.add v525, v526 : u32 #[overflow = checked]; + v528 = arith.constant 4 : u32; + v529 = arith.mod v527, v528 : u32; + hir.assertz v529 #[code = 250]; + v530 = hir.int_to_ptr v527 : ptr; + v531 = hir.load v530 : i32; + v533 = arith.constant 8 : u32; + v532 = hir.bitcast v519 : u32; + v534 = arith.add v532, v533 : u32 #[overflow = checked]; + v855 = arith.constant 4 : u32; + v536 = arith.mod v534, v855 : u32; + hir.assertz v536 #[code = 250]; + v537 = hir.int_to_ptr v534 : ptr; + v538 = hir.load v537 : i32; + v539 = hir.bitcast v511 : u32; + v854 = arith.constant 4 : u32; + v541 = arith.mod v539, v854 : u32; + hir.assertz v541 #[code = 250]; + v542 = hir.int_to_ptr v539 : ptr; + hir.store v542, v538; + v853 = arith.constant 4 : u32; + v543 = hir.bitcast v511 : u32; + v545 = arith.add v543, v853 : u32 #[overflow = checked]; + v852 = arith.constant 4 : u32; + v547 = arith.mod v545, v852 : u32; + hir.assertz v547 #[code = 250]; + v548 = hir.int_to_ptr v545 : ptr; + hir.store v548, v531; + v851 = arith.constant 16 : i32; + v550 = arith.add v519, v851 : i32 #[overflow = wrapping]; + v551 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/__stack_pointer : ptr + v552 = hir.bitcast v551 : ptr; + hir.store v552, v550; + builtin.ret ; + }; + + private builtin.function @alloc::alloc::Global::alloc_impl(v553: i32, v554: i32, v555: i32, v556: i32) { + ^block69(v553: i32, v554: i32, v555: i32, v556: i32): + v871 = arith.constant 0 : i32; + v557 = arith.constant 0 : i32; + v558 = arith.eq v555, v557 : i1; + v559 = arith.zext v558 : u32; + v560 = hir.bitcast v559 : i32; + v562 = arith.neq v560, v871 : i1; + v867 = scf.if v562 : i32 { + ^block117: + scf.yield v554; + } else { + ^block72: + hir.exec @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/__rustc::__rust_no_alloc_shim_is_unstable_v2() + v870 = arith.constant 0 : i32; + v564 = arith.neq v556, v870 : i1; + v866 = scf.if v564 : i32 { + ^block73: + v566 = hir.exec @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/__rustc::__rust_alloc_zeroed(v555, v554) : i32 + scf.yield v566; + } else { + ^block74: + v565 = hir.exec @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/__rustc::__rust_alloc(v555, v554) : i32 + scf.yield v565; + }; + scf.yield v866; + }; + v570 = arith.constant 4 : u32; + v569 = hir.bitcast v553 : u32; + v571 = arith.add v569, v570 : u32 #[overflow = checked]; + v869 = arith.constant 4 : u32; + v573 = arith.mod v571, v869 : u32; + hir.assertz v573 #[code = 250]; + v574 = hir.int_to_ptr v571 : ptr; + hir.store v574, v555; + v576 = hir.bitcast v553 : u32; + v868 = arith.constant 4 : u32; + v578 = arith.mod v576, v868 : u32; + hir.assertz v578 #[code = 250]; + v579 = hir.int_to_ptr v576 : ptr; + hir.store v579, v867; + builtin.ret ; + }; + + private builtin.function @alloc::raw_vec::RawVecInner::current_memory(v580: i32, v581: i32, v582: i32, v583: i32) { + ^block75(v580: i32, v581: i32, v582: i32, v583: i32): + v897 = arith.constant 0 : i32; + v584 = arith.constant 0 : i32; + v588 = arith.eq v583, v584 : i1; + v589 = arith.zext v588 : u32; + v590 = hir.bitcast v589 : i32; + v592 = arith.neq v590, v897 : i1; + v884, v885 = scf.if v592 : i32, i32 { + ^block121: + v896 = arith.constant 0 : i32; + v586 = arith.constant 4 : i32; + scf.yield v586, v896; + } else { + ^block78: + v593 = hir.bitcast v581 : u32; + v628 = arith.constant 4 : u32; + v595 = arith.mod v593, v628 : u32; + hir.assertz v595 #[code = 250]; + v596 = hir.int_to_ptr v593 : ptr; + v597 = hir.load v596 : i32; + v894 = arith.constant 0 : i32; + v895 = arith.constant 0 : i32; + v599 = arith.eq v597, v895 : i1; + v600 = arith.zext v599 : u32; + v601 = hir.bitcast v600 : i32; + v603 = arith.neq v601, v894 : i1; + v882 = scf.if v603 : i32 { + ^block120: + v893 = arith.constant 0 : i32; + scf.yield v893; + } else { + ^block79: + v892 = arith.constant 4 : u32; + v604 = hir.bitcast v580 : u32; + v606 = arith.add v604, v892 : u32 #[overflow = checked]; + v891 = arith.constant 4 : u32; + v608 = arith.mod v606, v891 : u32; + hir.assertz v608 #[code = 250]; + v609 = hir.int_to_ptr v606 : ptr; + hir.store v609, v582; + v890 = arith.constant 4 : u32; + v610 = hir.bitcast v581 : u32; + v612 = arith.add v610, v890 : u32 #[overflow = checked]; + v889 = arith.constant 4 : u32; + v614 = arith.mod v612, v889 : u32; + hir.assertz v614 #[code = 250]; + v615 = hir.int_to_ptr v612 : ptr; + v616 = hir.load v615 : i32; + v617 = hir.bitcast v580 : u32; + v888 = arith.constant 4 : u32; + v619 = arith.mod v617, v888 : u32; + hir.assertz v619 #[code = 250]; + v620 = hir.int_to_ptr v617 : ptr; + hir.store v620, v616; + v621 = arith.mul v597, v583 : i32 #[overflow = wrapping]; + scf.yield v621; + }; + v622 = arith.constant 8 : i32; + v887 = arith.constant 4 : i32; + v883 = cf.select v603, v887, v622 : i32; + scf.yield v883, v882; + }; + v625 = arith.add v580, v884 : i32 #[overflow = wrapping]; + v627 = hir.bitcast v625 : u32; + v886 = arith.constant 4 : u32; + v629 = arith.mod v627, v886 : u32; + hir.assertz v629 #[code = 250]; + v630 = hir.int_to_ptr v627 : ptr; + hir.store v630, v885; + builtin.ret ; + }; + + private builtin.function @::deallocate(v631: i32, v632: i32, v633: i32) { + ^block80(v631: i32, v632: i32, v633: i32): + v899 = arith.constant 0 : i32; + v634 = arith.constant 0 : i32; + v635 = arith.eq v633, v634 : i1; + v636 = arith.zext v635 : u32; + v637 = hir.bitcast v636 : i32; + v639 = arith.neq v637, v899 : i1; + scf.if v639{ + ^block82: + scf.yield ; + } else { + ^block83: + hir.exec @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/__rustc::__rust_dealloc(v631, v633, v632) + scf.yield ; + }; + builtin.ret ; + }; + + private builtin.function @alloc::raw_vec::handle_error(v640: i32, v641: i32, v642: i32) { + ^block84(v640: i32, v641: i32, v642: i32): + ub.unreachable ; + }; + + private builtin.function @core::ptr::alignment::Alignment::max(v643: i32, v644: i32) -> i32 { + ^block86(v643: i32, v644: i32): + v651 = arith.constant 0 : i32; + v647 = hir.bitcast v644 : u32; + v646 = hir.bitcast v643 : u32; + v648 = arith.gt v646, v647 : i1; + v649 = arith.zext v648 : u32; + v650 = hir.bitcast v649 : i32; + v652 = arith.neq v650, v651 : i1; + v653 = cf.select v652, v643, v644 : i32; + builtin.ret v653; + }; + + private builtin.function @miden::input_note::get_assets(v654: i32, v655: felt) -> i32 { + ^block88(v654: i32, v655: felt): + v656, v657 = hir.exec @miden/input_note/get_assets(v654, v655) : i32, i32 + builtin.ret v656; + }; + + builtin.global_variable private @#__stack_pointer : i32 { + builtin.ret_imm 1048576; + }; + + builtin.global_variable private @#GOT.data.internal.__memory_base : i32 { + builtin.ret_imm 0; + }; + + builtin.segment readonly @1048576 = 0x0073722e65746f6e5f7475706e692f73676e69646e69622f6372732f7379732d657361622f6b64732f3272656c69706d6f632f6e6564696d2f6372732f6e656572672f73726573552f; + + builtin.segment @1048652 = 0x000000220000003f00000048001000000000000100000001; + }; + + public builtin.function @binding() -> felt { + ^block92: + v659 = hir.exec @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1#binding() : felt + builtin.ret v659; + }; +}; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_assets_binding.masm b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_assets_binding.masm new file mode 100644 index 000000000..03075d3be --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_assets_binding.masm @@ -0,0 +1,1851 @@ +# mod miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1 + +@callconv("canon-lift") +pub proc binding( + +) -> felt + exec.::miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1::init + trace.240 + nop + exec.::miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1::rust_sdk_input_note_get_assets_binding::miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1#binding + trace.252 + nop + exec.::std::sys::truncate_stack +end + +proc init + push.1179648 + trace.240 + exec.::intrinsics::mem::heap_init + trace.252 + push.[12758153388733875847,5578040097872636326,12841885126834632170,7361907792256268865] + adv.push_mapval + push.262144 + push.7 + trace.240 + exec.::std::mem::pipe_preimage_to_memory + trace.252 + drop + push.1048576 + u32assert + mem_store.278560 + push.0 + u32assert + mem_store.278561 +end + +# mod miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1::rust_sdk_input_note_get_assets_binding + +@callconv("C") +proc __wasm_call_ctors( + +) + nop +end + +@callconv("C") +proc __rustc::__rust_alloc(i32, i32) -> i32 + push.1114244 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.1048676 + u32wrapping_add + movup.2 + swap.1 + trace.240 + nop + exec.::miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1::rust_sdk_input_note_get_assets_binding::::alloc + trace.252 + nop +end + +@callconv("C") +proc __rustc::__rust_dealloc(i32, i32, i32) + drop + drop + drop +end + +@callconv("C") +proc __rustc::__rust_alloc_zeroed(i32, i32) -> i32 + push.1114244 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.1048676 + u32wrapping_add + dup.1 + swap.2 + swap.3 + swap.1 + trace.240 + nop + exec.::miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1::rust_sdk_input_note_get_assets_binding::::alloc + trace.252 + nop + push.0 + push.0 + dup.2 + eq + neq + if.true + swap.1 + drop + else + push.0 + push.0 + dup.3 + eq + neq + if.true + swap.1 + drop + else + push.0 + movup.2 + dup.2 + push.0 + dup.2 + push.0 + gte + while.true + dup.1 + dup.1 + push.1 + u32overflowing_madd + assertz + dup.4 + swap.1 + u32divmod.4 + swap.1 + dup.0 + mem_load + dup.2 + push.8 + u32wrapping_mul + push.255 + swap.1 + u32shl + u32not + swap.1 + u32and + movup.3 + movup.3 + push.8 + u32wrapping_mul + u32shl + u32or + swap.1 + mem_store + u32wrapping_add.1 + dup.0 + dup.3 + u32gte + end + dropw + end + end +end + +@callconv("C") +proc rust_sdk_input_note_get_assets_binding::bindings::__link_custom_section_describing_imports( + +) + nop +end + +@callconv("C") +proc miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1#binding( + +) -> felt + push.1114240 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.16 + u32wrapping_sub + push.1114240 + dup.1 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + trace.240 + nop + exec.::miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1::rust_sdk_input_note_get_assets_binding::wit_bindgen::rt::run_ctors_once + trace.252 + nop + push.0 + trace.240 + nop + exec.::miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1::rust_sdk_input_note_get_assets_binding::intrinsics::felt::from_u32 + trace.252 + nop + push.4 + dup.2 + u32wrapping_add + trace.240 + nop + exec.::miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1::rust_sdk_input_note_get_assets_binding::miden_base_sys::bindings::input_note::get_assets + trace.252 + nop + push.12 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + trace.240 + nop + exec.::miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1::rust_sdk_input_note_get_assets_binding::intrinsics::felt::from_u32 + trace.252 + nop + push.16 + push.4 + dup.3 + u32wrapping_add + dup.1 + swap.2 + swap.1 + trace.240 + nop + exec.::miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1::rust_sdk_input_note_get_assets_binding::alloc::raw_vec::RawVecInner::deallocate + trace.252 + nop + push.16 + movup.2 + u32wrapping_add + push.1114240 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop +end + +@callconv("C") +proc __rustc::__rust_no_alloc_shim_is_unstable_v2( + +) + nop +end + +@callconv("C") +proc wit_bindgen::rt::run_ctors_once( + +) + push.1114244 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.1048680 + u32wrapping_add + u32divmod.4 + swap.1 + swap.1 + dup.1 + mem_load + swap.1 + push.8 + u32wrapping_mul + u32shr + swap.1 + drop + push.255 + u32and + push.0 + swap.1 + neq + if.true + nop + else + push.1114244 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + trace.240 + nop + exec.::miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1::rust_sdk_input_note_get_assets_binding::__wasm_call_ctors + trace.252 + nop + push.1 + push.1048680 + movup.2 + u32wrapping_add + u32divmod.4 + swap.1 + dup.0 + mem_load + dup.2 + push.8 + u32wrapping_mul + push.255 + swap.1 + u32shl + u32not + swap.1 + u32and + movup.3 + movup.3 + push.8 + u32wrapping_mul + u32shl + u32or + swap.1 + mem_store + end +end + +@callconv("C") +proc ::alloc( + i32, + i32, + i32 +) -> i32 + push.16 + push.0 + push.16 + dup.4 + swap.1 + u32gt + neq + dup.3 + swap.1 + cdrop + push.0 + push.4294967295 + dup.2 + u32wrapping_add + dup.2 + u32and + neq + if.true + dropw + push.0 + push.3735929054 + else + movup.2 + trace.240 + nop + exec.::miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1::rust_sdk_input_note_get_assets_binding::core::ptr::alignment::Alignment::max + trace.252 + nop + push.0 + push.2147483648 + dup.2 + u32wrapping_sub + dup.4 + swap.1 + u32gt + neq + dup.0 + if.true + movdn.3 + drop + drop + drop + push.3735929054 + else + push.0 + dup.2 + u32wrapping_sub + push.4294967295 + movup.5 + dup.4 + u32wrapping_add + u32wrapping_add + u32and + dup.3 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.0 + neq + if.true + nop + else + trace.240 + nop + exec.::miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1::rust_sdk_input_note_get_assets_binding::intrinsics::mem::heap_base + trace.252 + nop + trace.240 + nop + exec.::intrinsics::mem::memory_size + trace.252 + nop + dup.5 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + push.16 + movup.2 + swap.1 + u32shl + movup.2 + u32wrapping_add + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + end + dup.3 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.0 + push.4294967295 + dup.2 + u32xor + dup.3 + swap.1 + u32gt + neq + if.true + drop + drop + movdn.2 + drop + drop + push.0 + else + movup.4 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + movup.2 + dup.2 + u32wrapping_add + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + movup.2 + u32wrapping_add + end + end + push.1 + push.0 + movup.3 + cdrop + swap.1 + end + push.0 + movup.2 + eq + if.true + drop + push.0 + assert + else + nop + end +end + +@callconv("C") +proc intrinsics::mem::heap_base( + +) -> i32 + trace.240 + nop + exec.::intrinsics::mem::heap_base + trace.252 + nop +end + +@callconv("C") +proc alloc::vec::Vec::with_capacity(i32, i32) + push.1114240 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.16 + u32wrapping_sub + push.1114240 + dup.1 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.16 + push.8 + dup.2 + u32wrapping_add + dup.1 + movup.3 + swap.5 + movdn.3 + swap.2 + swap.1 + trace.240 + nop + exec.::miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1::rust_sdk_input_note_get_assets_binding::alloc::raw_vec::RawVecInner::with_capacity_in + trace.252 + nop + push.8 + dup.2 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.8 + dup.3 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + push.0 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + movup.2 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.16 + u32wrapping_add + push.1114240 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop +end + +@callconv("C") +proc alloc::raw_vec::RawVecInner::with_capacity_in( + i32, + i32, + i32, + i32 +) + push.1114240 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.16 + u32wrapping_sub + push.1114240 + dup.1 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.0 + push.256 + push.4 + dup.3 + u32wrapping_add + movup.4 + swap.6 + movdn.4 + movup.3 + swap.5 + movdn.3 + trace.240 + nop + exec.::miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1::rust_sdk_input_note_get_assets_binding::alloc::raw_vec::RawVecInner::try_allocate_in + trace.252 + nop + push.8 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.4 + dup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.0 + push.1 + movup.2 + neq + neq + if.true + movup.3 + drop + push.12 + dup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.4 + dup.4 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + movup.2 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.16 + u32wrapping_add + push.1114240 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + else + movup.2 + drop + push.12 + movup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + swap.1 + trace.240 + nop + exec.::miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1::rust_sdk_input_note_get_assets_binding::alloc::raw_vec::handle_error + trace.252 + nop + push.0 + assert + end +end + +@callconv("C") +proc miden_base_sys::bindings::input_note::get_assets( + i32, + felt +) + push.1114240 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.16 + u32wrapping_sub + push.1114240 + dup.1 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.1114244 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.1048660 + u32wrapping_add + push.4 + dup.2 + u32wrapping_add + trace.240 + nop + exec.::miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1::rust_sdk_input_note_get_assets_binding::alloc::vec::Vec::with_capacity + trace.252 + nop + push.8 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.2 + swap.1 + swap.1 + u32shr + movup.3 + swap.1 + trace.240 + nop + exec.::miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1::rust_sdk_input_note_get_assets_binding::miden::input_note::get_assets + trace.252 + nop + push.8 + dup.3 + u32wrapping_add + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.4 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + movup.3 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.16 + u32wrapping_add + push.1114240 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop +end + +@callconv("C") +proc intrinsics::felt::from_u32(i32) -> felt + nop +end + +@callconv("C") +proc alloc::raw_vec::RawVecInner::deallocate( + i32, + i32, + i32 +) + push.1114240 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.16 + u32wrapping_sub + push.1114240 + dup.1 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.4 + dup.1 + u32wrapping_add + swap.1 + swap.4 + swap.3 + swap.2 + swap.1 + trace.240 + nop + exec.::miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1::rust_sdk_input_note_get_assets_binding::alloc::raw_vec::RawVecInner::current_memory + trace.252 + nop + push.8 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.0 + push.0 + dup.2 + eq + neq + if.true + drop + else + push.4 + dup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.12 + dup.3 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + movdn.2 + trace.240 + nop + exec.::miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1::rust_sdk_input_note_get_assets_binding::::deallocate + trace.252 + nop + end + push.16 + u32wrapping_add + push.1114240 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop +end + +@callconv("C") +proc alloc::raw_vec::RawVecInner::try_allocate_in( + i32, + i32, + i32, + i32, + i32 +) + push.1114240 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.16 + u32wrapping_sub + push.1114240 + dup.1 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + dup.2 + push.0 + push.0 + dup.7 + u32wrapping_sub + push.4294967295 + movup.9 + dup.9 + u32wrapping_add + u32wrapping_add + u32and + push.0 + trace.240 + nop + exec.::intrinsics::i64::wrapping_mul + trace.252 + nop + push.0 + push.32 + push.0 + dup.0 + push.2147483648 + u32and + eq.2147483648 + assertz + assertz + dup.0 + push.4294967295 + u32lte + assert + dup.3 + dup.3 + movup.2 + trace.240 + nop + exec.::std::math::u64::shr + trace.252 + nop + drop + neq + if.true + drop + drop + movup.2 + drop + movup.2 + drop + movup.2 + drop + push.0 + push.3735929054 + dup.0 + dup.1 + swap.4 + swap.1 + swap.3 + swap.5 + else + drop + push.0 + push.2147483648 + dup.7 + u32wrapping_sub + dup.2 + swap.1 + u32lte + neq + dup.0 + if.true + push.0 + dup.2 + neq + if.true + push.0 + movup.6 + neq + if.true + push.1 + dup.3 + dup.7 + dup.4 + swap.2 + trace.240 + nop + exec.::miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1::rust_sdk_input_note_get_assets_binding::alloc::alloc::Global::alloc_impl + trace.252 + nop + dup.2 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + else + push.8 + dup.3 + u32wrapping_add + dup.6 + dup.3 + swap.2 + trace.240 + nop + exec.::miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1::rust_sdk_input_note_get_assets_binding::::allocate + trace.252 + nop + push.8 + dup.3 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + end + push.0 + push.0 + dup.2 + eq + neq + dup.0 + if.true + movup.6 + movup.2 + drop + drop + push.8 + dup.5 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + movup.3 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.4 + dup.4 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + movup.5 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + else + movup.7 + movup.4 + drop + drop + push.8 + dup.5 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.4 + dup.4 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + movup.5 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + end + push.0 + push.1 + movup.2 + cdrop + else + movup.2 + swap.5 + movdn.2 + swap.4 + swap.1 + drop + drop + drop + push.8 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + movup.4 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.4 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + push.0 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.0 + swap.1 + swap.3 + swap.2 + swap.1 + end + else + swap.1 + drop + movup.3 + drop + movup.3 + drop + movup.3 + drop + push.3735929054 + end + push.0 + push.1 + dup.3 + cdrop + push.3735929054 + dup.3 + dup.5 + swap.1 + cdrop + push.3735929054 + dup.4 + dup.7 + swap.1 + cdrop + push.3735929054 + dup.5 + movup.2 + swap.7 + movdn.2 + cdrop + push.3735929054 + movup.2 + swap.7 + movdn.2 + swap.1 + swap.5 + cdrop + swap.1 + swap.5 + swap.4 + swap.2 + swap.3 + swap.1 + end + movup.5 + eq.0 + if.true + movup.2 + drop + movup.2 + drop + movup.2 + drop + push.4 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + push.0 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.1 + swap.1 + else + drop + drop + end + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.16 + u32wrapping_add + push.1114240 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop +end + +@callconv("C") +proc ::allocate( + i32, + i32, + i32 +) + push.1114240 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.16 + u32wrapping_sub + push.1114240 + dup.1 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.0 + push.8 + dup.2 + u32wrapping_add + movup.2 + swap.5 + movdn.2 + swap.1 + swap.3 + swap.4 + swap.1 + trace.240 + nop + exec.::miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1::rust_sdk_input_note_get_assets_binding::alloc::alloc::Global::alloc_impl + trace.252 + nop + push.12 + dup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.8 + dup.3 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + dup.2 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.4 + movup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.16 + u32wrapping_add + push.1114240 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop +end + +@callconv("C") +proc alloc::alloc::Global::alloc_impl( + i32, + i32, + i32, + i32 +) + push.0 + push.0 + dup.4 + eq + neq + if.true + movup.3 + drop + swap.1 + else + trace.240 + nop + exec.::miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1::rust_sdk_input_note_get_assets_binding::__rustc::__rust_no_alloc_shim_is_unstable_v2 + trace.252 + nop + push.0 + movup.4 + neq + if.true + swap.1 + dup.2 + trace.240 + nop + exec.::miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1::rust_sdk_input_note_get_assets_binding::__rustc::__rust_alloc_zeroed + trace.252 + nop + else + swap.1 + dup.2 + trace.240 + nop + exec.::miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1::rust_sdk_input_note_get_assets_binding::__rustc::__rust_alloc + trace.252 + nop + end + end + push.4 + dup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + movup.3 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + swap.1 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop +end + +@callconv("C") +proc alloc::raw_vec::RawVecInner::current_memory( + i32, + i32, + i32, + i32 +) + push.0 + push.0 + dup.5 + eq + neq + if.true + movdn.3 + drop + drop + drop + push.0 + push.4 + else + dup.1 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.0 + push.0 + dup.2 + eq + neq + dup.0 + if.true + swap.1 + drop + movup.2 + drop + movup.2 + drop + movup.2 + drop + push.0 + else + push.4 + dup.3 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + movup.5 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.4 + movup.4 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + dup.3 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + swap.3 + trace.240 + nop + exec.::intrinsics::i32::wrapping_mul + trace.252 + nop + movup.2 + swap.1 + end + push.8 + push.4 + movup.3 + cdrop + end + movup.2 + u32wrapping_add + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop +end + +@callconv("C") +proc ::deallocate( + i32, + i32, + i32 +) + push.0 + push.0 + dup.4 + eq + neq + if.true + drop + drop + drop + else + movup.2 + swap.1 + trace.240 + nop + exec.::miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1::rust_sdk_input_note_get_assets_binding::__rustc::__rust_dealloc + trace.252 + nop + end +end + +@callconv("C") +proc alloc::raw_vec::handle_error(i32, i32, i32) + drop + drop + drop + push.0 + assert +end + +@callconv("C") +proc core::ptr::alignment::Alignment::max(i32, i32) -> i32 + push.0 + dup.2 + dup.2 + swap.1 + u32gt + neq + cdrop +end + +@callconv("C") +proc miden::input_note::get_assets(i32, felt) -> i32 + trace.240 + nop + exec.::miden::input_note::get_assets + trace.252 + nop + swap.1 + drop +end + diff --git a/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_assets_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_assets_binding.wat new file mode 100644 index 000000000..7bb28a926 --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_assets_binding.wat @@ -0,0 +1,582 @@ +(component + (type (;0;) + (instance + (type (;0;) (record (field "inner" f32))) + (export (;1;) "felt" (type (eq 0))) + ) + ) + (import "miden:base/core-types@1.0.0" (instance (;0;) (type 0))) + (core module (;0;) + (type (;0;) (func)) + (type (;1;) (func (param i32 i32) (result i32))) + (type (;2;) (func (param i32 i32 i32))) + (type (;3;) (func (result f32))) + (type (;4;) (func (param i32 i32 i32) (result i32))) + (type (;5;) (func (result i32))) + (type (;6;) (func (param i32 i32))) + (type (;7;) (func (param i32 i32 i32 i32))) + (type (;8;) (func (param i32 f32))) + (type (;9;) (func (param i32) (result f32))) + (type (;10;) (func (param i32 i32 i32 i32 i32))) + (type (;11;) (func (param i32 f32) (result i32))) + (table (;0;) 2 2 funcref) + (memory (;0;) 17) + (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) + (global $GOT.data.internal.__memory_base (;1;) i32 i32.const 0) + (export "memory" (memory 0)) + (export "miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1#binding" (func $miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1#binding)) + (elem (;0;) (i32.const 1) func $rust_sdk_input_note_get_assets_binding::bindings::__link_custom_section_describing_imports) + (func $__wasm_call_ctors (;0;) (type 0)) + (func $__rustc::__rust_alloc (;1;) (type 1) (param i32 i32) (result i32) + global.get $GOT.data.internal.__memory_base + i32.const 1048676 + i32.add + local.get 1 + local.get 0 + call $::alloc + ) + (func $__rustc::__rust_dealloc (;2;) (type 2) (param i32 i32 i32)) + (func $__rustc::__rust_alloc_zeroed (;3;) (type 1) (param i32 i32) (result i32) + block ;; label = @1 + global.get $GOT.data.internal.__memory_base + i32.const 1048676 + i32.add + local.get 1 + local.get 0 + call $::alloc + local.tee 1 + i32.eqz + br_if 0 (;@1;) + local.get 0 + i32.eqz + br_if 0 (;@1;) + local.get 1 + i32.const 0 + local.get 0 + memory.fill + end + local.get 1 + ) + (func $rust_sdk_input_note_get_assets_binding::bindings::__link_custom_section_describing_imports (;4;) (type 0)) + (func $miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1#binding (;5;) (type 3) (result f32) + (local i32 f32) + global.get $__stack_pointer + i32.const 16 + i32.sub + local.tee 0 + global.set $__stack_pointer + call $wit_bindgen::rt::run_ctors_once + local.get 0 + i32.const 4 + i32.add + i32.const 0 + call $intrinsics::felt::from_u32 + call $miden_base_sys::bindings::input_note::get_assets + local.get 0 + i32.load offset=12 + call $intrinsics::felt::from_u32 + local.set 1 + local.get 0 + i32.const 4 + i32.add + i32.const 16 + i32.const 16 + call $alloc::raw_vec::RawVecInner::deallocate + local.get 0 + i32.const 16 + i32.add + global.set $__stack_pointer + local.get 1 + ) + (func $__rustc::__rust_no_alloc_shim_is_unstable_v2 (;6;) (type 0) + return + ) + (func $wit_bindgen::rt::run_ctors_once (;7;) (type 0) + (local i32) + block ;; label = @1 + global.get $GOT.data.internal.__memory_base + i32.const 1048680 + i32.add + i32.load8_u + br_if 0 (;@1;) + global.get $GOT.data.internal.__memory_base + local.set 0 + call $__wasm_call_ctors + local.get 0 + i32.const 1048680 + i32.add + i32.const 1 + i32.store8 + end + ) + (func $::alloc (;8;) (type 4) (param i32 i32 i32) (result i32) + (local i32 i32) + block ;; label = @1 + local.get 1 + i32.const 16 + local.get 1 + i32.const 16 + i32.gt_u + select + local.tee 3 + local.get 3 + i32.const -1 + i32.add + i32.and + br_if 0 (;@1;) + local.get 2 + i32.const -2147483648 + local.get 1 + local.get 3 + call $core::ptr::alignment::Alignment::max + local.tee 1 + i32.sub + i32.gt_u + br_if 0 (;@1;) + i32.const 0 + local.set 3 + local.get 2 + local.get 1 + i32.add + i32.const -1 + i32.add + i32.const 0 + local.get 1 + i32.sub + i32.and + local.set 2 + block ;; label = @2 + local.get 0 + i32.load + br_if 0 (;@2;) + local.get 0 + call $intrinsics::mem::heap_base + memory.size + i32.const 16 + i32.shl + i32.add + i32.store + end + block ;; label = @2 + local.get 2 + local.get 0 + i32.load + local.tee 4 + i32.const -1 + i32.xor + i32.gt_u + br_if 0 (;@2;) + local.get 0 + local.get 4 + local.get 2 + i32.add + i32.store + local.get 4 + local.get 1 + i32.add + local.set 3 + end + local.get 3 + return + end + unreachable + ) + (func $intrinsics::mem::heap_base (;9;) (type 5) (result i32) + unreachable + ) + (func $alloc::vec::Vec::with_capacity (;10;) (type 6) (param i32 i32) + (local i32 i64) + global.get $__stack_pointer + i32.const 16 + i32.sub + local.tee 2 + global.set $__stack_pointer + local.get 2 + i32.const 8 + i32.add + i32.const 16 + i32.const 16 + local.get 1 + call $alloc::raw_vec::RawVecInner::with_capacity_in + local.get 2 + i64.load offset=8 + local.set 3 + local.get 0 + i32.const 0 + i32.store offset=8 + local.get 0 + local.get 3 + i64.store align=4 + local.get 2 + i32.const 16 + i32.add + global.set $__stack_pointer + ) + (func $alloc::raw_vec::RawVecInner::with_capacity_in (;11;) (type 7) (param i32 i32 i32 i32) + (local i32) + global.get $__stack_pointer + i32.const 16 + i32.sub + local.tee 4 + global.set $__stack_pointer + local.get 4 + i32.const 4 + i32.add + i32.const 256 + i32.const 0 + local.get 1 + local.get 2 + call $alloc::raw_vec::RawVecInner::try_allocate_in + local.get 4 + i32.load offset=8 + local.set 2 + block ;; label = @1 + local.get 4 + i32.load offset=4 + i32.const 1 + i32.ne + br_if 0 (;@1;) + local.get 2 + local.get 4 + i32.load offset=12 + local.get 3 + call $alloc::raw_vec::handle_error + unreachable + end + local.get 0 + local.get 4 + i32.load offset=12 + i32.store offset=4 + local.get 0 + local.get 2 + i32.store + local.get 4 + i32.const 16 + i32.add + global.set $__stack_pointer + ) + (func $miden_base_sys::bindings::input_note::get_assets (;12;) (type 8) (param i32 f32) + (local i32) + global.get $__stack_pointer + i32.const 16 + i32.sub + local.tee 2 + global.set $__stack_pointer + local.get 2 + i32.const 4 + i32.add + global.get $GOT.data.internal.__memory_base + i32.const 1048660 + i32.add + call $alloc::vec::Vec::with_capacity + local.get 0 + i32.const 8 + i32.add + local.get 2 + i32.load offset=8 + i32.const 2 + i32.shr_u + local.get 1 + call $miden::input_note::get_assets + i32.store + local.get 0 + local.get 2 + i64.load offset=4 align=4 + i64.store align=4 + local.get 2 + i32.const 16 + i32.add + global.set $__stack_pointer + ) + (func $intrinsics::felt::from_u32 (;13;) (type 9) (param i32) (result f32) + unreachable + ) + (func $alloc::raw_vec::RawVecInner::deallocate (;14;) (type 2) (param i32 i32 i32) + (local i32) + global.get $__stack_pointer + i32.const 16 + i32.sub + local.tee 3 + global.set $__stack_pointer + local.get 3 + i32.const 4 + i32.add + local.get 0 + local.get 1 + local.get 2 + call $alloc::raw_vec::RawVecInner::current_memory + block ;; label = @1 + local.get 3 + i32.load offset=8 + local.tee 2 + i32.eqz + br_if 0 (;@1;) + local.get 3 + i32.load offset=4 + local.get 2 + local.get 3 + i32.load offset=12 + call $::deallocate + end + local.get 3 + i32.const 16 + i32.add + global.set $__stack_pointer + ) + (func $alloc::raw_vec::RawVecInner::try_allocate_in (;15;) (type 10) (param i32 i32 i32 i32 i32) + (local i32 i64) + global.get $__stack_pointer + i32.const 16 + i32.sub + local.tee 5 + global.set $__stack_pointer + block ;; label = @1 + block ;; label = @2 + block ;; label = @3 + local.get 3 + local.get 4 + i32.add + i32.const -1 + i32.add + i32.const 0 + local.get 3 + i32.sub + i32.and + i64.extend_i32_u + local.get 1 + i64.extend_i32_u + i64.mul + local.tee 6 + i64.const 32 + i64.shr_u + i32.wrap_i64 + br_if 0 (;@3;) + local.get 6 + i32.wrap_i64 + local.tee 4 + i32.const -2147483648 + local.get 3 + i32.sub + i32.le_u + br_if 1 (;@2;) + end + local.get 0 + i32.const 0 + i32.store offset=4 + i32.const 1 + local.set 3 + br 1 (;@1;) + end + block ;; label = @2 + local.get 4 + br_if 0 (;@2;) + local.get 0 + local.get 3 + i32.store offset=8 + i32.const 0 + local.set 3 + local.get 0 + i32.const 0 + i32.store offset=4 + br 1 (;@1;) + end + block ;; label = @2 + block ;; label = @3 + local.get 2 + br_if 0 (;@3;) + local.get 5 + i32.const 8 + i32.add + local.get 3 + local.get 4 + call $::allocate + local.get 5 + i32.load offset=8 + local.set 2 + br 1 (;@2;) + end + local.get 5 + local.get 3 + local.get 4 + i32.const 1 + call $alloc::alloc::Global::alloc_impl + local.get 5 + i32.load + local.set 2 + end + block ;; label = @2 + local.get 2 + i32.eqz + br_if 0 (;@2;) + local.get 0 + local.get 2 + i32.store offset=8 + local.get 0 + local.get 1 + i32.store offset=4 + i32.const 0 + local.set 3 + br 1 (;@1;) + end + local.get 0 + local.get 4 + i32.store offset=8 + local.get 0 + local.get 3 + i32.store offset=4 + i32.const 1 + local.set 3 + end + local.get 0 + local.get 3 + i32.store + local.get 5 + i32.const 16 + i32.add + global.set $__stack_pointer + ) + (func $::allocate (;16;) (type 2) (param i32 i32 i32) + (local i32) + global.get $__stack_pointer + i32.const 16 + i32.sub + local.tee 3 + global.set $__stack_pointer + local.get 3 + i32.const 8 + i32.add + local.get 1 + local.get 2 + i32.const 0 + call $alloc::alloc::Global::alloc_impl + local.get 3 + i32.load offset=12 + local.set 2 + local.get 0 + local.get 3 + i32.load offset=8 + i32.store + local.get 0 + local.get 2 + i32.store offset=4 + local.get 3 + i32.const 16 + i32.add + global.set $__stack_pointer + ) + (func $alloc::alloc::Global::alloc_impl (;17;) (type 7) (param i32 i32 i32 i32) + block ;; label = @1 + local.get 2 + i32.eqz + br_if 0 (;@1;) + call $__rustc::__rust_no_alloc_shim_is_unstable_v2 + block ;; label = @2 + local.get 3 + br_if 0 (;@2;) + local.get 2 + local.get 1 + call $__rustc::__rust_alloc + local.set 1 + br 1 (;@1;) + end + local.get 2 + local.get 1 + call $__rustc::__rust_alloc_zeroed + local.set 1 + end + local.get 0 + local.get 2 + i32.store offset=4 + local.get 0 + local.get 1 + i32.store + ) + (func $alloc::raw_vec::RawVecInner::current_memory (;18;) (type 7) (param i32 i32 i32 i32) + (local i32 i32 i32) + i32.const 0 + local.set 4 + i32.const 4 + local.set 5 + block ;; label = @1 + local.get 3 + i32.eqz + br_if 0 (;@1;) + local.get 1 + i32.load + local.tee 6 + i32.eqz + br_if 0 (;@1;) + local.get 0 + local.get 2 + i32.store offset=4 + local.get 0 + local.get 1 + i32.load offset=4 + i32.store + local.get 6 + local.get 3 + i32.mul + local.set 4 + i32.const 8 + local.set 5 + end + local.get 0 + local.get 5 + i32.add + local.get 4 + i32.store + ) + (func $::deallocate (;19;) (type 2) (param i32 i32 i32) + block ;; label = @1 + local.get 2 + i32.eqz + br_if 0 (;@1;) + local.get 0 + local.get 2 + local.get 1 + call $__rustc::__rust_dealloc + end + ) + (func $alloc::raw_vec::handle_error (;20;) (type 2) (param i32 i32 i32) + unreachable + ) + (func $core::ptr::alignment::Alignment::max (;21;) (type 1) (param i32 i32) (result i32) + local.get 0 + local.get 1 + local.get 0 + local.get 1 + i32.gt_u + select + ) + (func $miden::input_note::get_assets (;22;) (type 11) (param i32 f32) (result i32) + unreachable + ) + (data $.rodata (;0;) (i32.const 1048576) "/Users/green/src/miden/compiler2/sdk/base-sys/src/bindings/input_note.rs\00") + (data $.data (;1;) (i32.const 1048652) "\01\00\00\00\01\00\00\00\00\00\10\00H\00\00\00?\00\00\00\22\00\00\00") + (@custom "rodata,miden_account" (after data) "Mrust_sdk_input_note_get_assets_binding\01\0b0.0.1\03\01\01\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00") + ) + (alias export 0 "felt" (type (;1;))) + (core instance (;0;) (instantiate 0)) + (alias core export 0 "memory" (core memory (;0;))) + (type (;2;) (func (result 1))) + (alias core export 0 "miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1#binding" (core func (;0;))) + (func (;0;) (type 2) (canon lift (core func 0))) + (alias export 0 "felt" (type (;3;))) + (component (;0;) + (type (;0;) (record (field "inner" f32))) + (import "import-type-felt" (type (;1;) (eq 0))) + (import "import-type-felt0" (type (;2;) (eq 1))) + (type (;3;) (func (result 2))) + (import "import-func-binding" (func (;0;) (type 3))) + (export (;4;) "felt" (type 1)) + (type (;5;) (func (result 4))) + (export (;1;) "binding" (func 0) (func (type 5))) + ) + (instance (;1;) (instantiate 0 + (with "import-func-binding" (func 0)) + (with "import-type-felt" (type 3)) + (with "import-type-felt0" (type 1)) + ) + ) + (export (;2;) "miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1" (instance 1)) +) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_assets_info_binding.hir b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_assets_info_binding.hir new file mode 100644 index 000000000..e11456059 --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_assets_info_binding.hir @@ -0,0 +1,319 @@ +builtin.component miden:rust-sdk-input-note-get-assets-info-binding/rust-sdk-input-note-get-assets-info-binding@0.0.1 { + builtin.module public @rust_sdk_input_note_get_assets_info_binding { + private builtin.function @__wasm_call_ctors() { + ^block5: + builtin.ret ; + }; + + private builtin.function @rust_sdk_input_note_get_assets_info_binding::bindings::__link_custom_section_describing_imports() { + ^block7: + builtin.ret ; + }; + + private builtin.function @miden:rust-sdk-input-note-get-assets-info-binding/rust-sdk-input-note-get-assets-info-binding@0.0.1#binding() -> felt { + ^block9: + v3 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-info-binding/rust-sdk-input-note-get-assets-info-binding@0.0.1/rust_sdk_input_note_get_assets_info_binding/__stack_pointer : ptr + v4 = hir.bitcast v3 : ptr; + v5 = hir.load v4 : i32; + v6 = arith.constant 32 : i32; + v7 = arith.sub v5, v6 : i32 #[overflow = wrapping]; + v8 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-info-binding/rust-sdk-input-note-get-assets-info-binding@0.0.1/rust_sdk_input_note_get_assets_info_binding/__stack_pointer : ptr + v9 = hir.bitcast v8 : ptr; + hir.store v9, v7; + hir.exec @miden:rust-sdk-input-note-get-assets-info-binding/rust-sdk-input-note-get-assets-info-binding@0.0.1/rust_sdk_input_note_get_assets_info_binding/wit_bindgen::rt::run_ctors_once() + v1 = arith.constant 0 : i32; + v11 = hir.exec @miden:rust-sdk-input-note-get-assets-info-binding/rust-sdk-input-note-get-assets-info-binding@0.0.1/rust_sdk_input_note_get_assets_info_binding/intrinsics::felt::from_u32(v1) : felt + hir.exec @miden:rust-sdk-input-note-get-assets-info-binding/rust-sdk-input-note-get-assets-info-binding@0.0.1/rust_sdk_input_note_get_assets_info_binding/miden_base_sys::bindings::input_note::get_assets_info(v7, v11) + v13 = arith.constant 16 : u32; + v12 = hir.bitcast v7 : u32; + v14 = arith.add v12, v13 : u32 #[overflow = checked]; + v15 = arith.constant 4 : u32; + v16 = arith.mod v14, v15 : u32; + hir.assertz v16 #[code = 250]; + v17 = hir.int_to_ptr v14 : ptr; + v18 = hir.load v17 : felt; + v213 = arith.constant 32 : i32; + v20 = arith.add v7, v213 : i32 #[overflow = wrapping]; + v21 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-info-binding/rust-sdk-input-note-get-assets-info-binding@0.0.1/rust_sdk_input_note_get_assets_info_binding/__stack_pointer : ptr + v22 = hir.bitcast v21 : ptr; + hir.store v22, v20; + builtin.ret v18; + }; + + private builtin.function @wit_bindgen::rt::run_ctors_once() { + ^block11: + v24 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-info-binding/rust-sdk-input-note-get-assets-info-binding@0.0.1/rust_sdk_input_note_get_assets_info_binding/GOT.data.internal.__memory_base : ptr + v25 = hir.bitcast v24 : ptr; + v26 = hir.load v25 : i32; + v27 = arith.constant 1048584 : i32; + v28 = arith.add v26, v27 : i32 #[overflow = wrapping]; + v29 = hir.bitcast v28 : u32; + v30 = hir.int_to_ptr v29 : ptr; + v31 = hir.load v30 : u8; + v23 = arith.constant 0 : i32; + v32 = arith.zext v31 : u32; + v33 = hir.bitcast v32 : i32; + v35 = arith.neq v33, v23 : i1; + scf.if v35{ + ^block13: + scf.yield ; + } else { + ^block14: + v36 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-info-binding/rust-sdk-input-note-get-assets-info-binding@0.0.1/rust_sdk_input_note_get_assets_info_binding/GOT.data.internal.__memory_base : ptr + v37 = hir.bitcast v36 : ptr; + v38 = hir.load v37 : i32; + hir.exec @miden:rust-sdk-input-note-get-assets-info-binding/rust-sdk-input-note-get-assets-info-binding@0.0.1/rust_sdk_input_note_get_assets_info_binding/__wasm_call_ctors() + v215 = arith.constant 1 : u8; + v217 = arith.constant 1048584 : i32; + v40 = arith.add v38, v217 : i32 #[overflow = wrapping]; + v44 = hir.bitcast v40 : u32; + v45 = hir.int_to_ptr v44 : ptr; + hir.store v45, v215; + scf.yield ; + }; + builtin.ret ; + }; + + private builtin.function @miden_base_sys::bindings::input_note::get_assets_info(v46: i32, v47: felt) { + ^block15(v46: i32, v47: felt): + v49 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-info-binding/rust-sdk-input-note-get-assets-info-binding@0.0.1/rust_sdk_input_note_get_assets_info_binding/__stack_pointer : ptr + v50 = hir.bitcast v49 : ptr; + v51 = hir.load v50 : i32; + v52 = arith.constant 48 : i32; + v53 = arith.sub v51, v52 : i32 #[overflow = wrapping]; + v54 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-info-binding/rust-sdk-input-note-get-assets-info-binding@0.0.1/rust_sdk_input_note_get_assets_info_binding/__stack_pointer : ptr + v55 = hir.bitcast v54 : ptr; + hir.store v55, v53; + hir.exec @miden:rust-sdk-input-note-get-assets-info-binding/rust-sdk-input-note-get-assets-info-binding@0.0.1/rust_sdk_input_note_get_assets_info_binding/miden::input_note::get_assets_info(v47, v53) + v57 = arith.constant 8 : u32; + v56 = hir.bitcast v53 : u32; + v58 = arith.add v56, v57 : u32 #[overflow = checked]; + v224 = arith.constant 8 : u32; + v60 = arith.mod v58, v224 : u32; + hir.assertz v60 #[code = 250]; + v61 = hir.int_to_ptr v58 : ptr; + v62 = hir.load v61 : i64; + v64 = arith.constant 40 : u32; + v63 = hir.bitcast v53 : u32; + v65 = arith.add v63, v64 : u32 #[overflow = checked]; + v223 = arith.constant 8 : u32; + v67 = arith.mod v65, v223 : u32; + hir.assertz v67 #[code = 250]; + v68 = hir.int_to_ptr v65 : ptr; + hir.store v68, v62; + v69 = hir.bitcast v53 : u32; + v222 = arith.constant 8 : u32; + v71 = arith.mod v69, v222 : u32; + hir.assertz v71 #[code = 250]; + v72 = hir.int_to_ptr v69 : ptr; + v73 = hir.load v72 : i64; + v75 = arith.constant 32 : u32; + v74 = hir.bitcast v53 : u32; + v76 = arith.add v74, v75 : u32 #[overflow = checked]; + v221 = arith.constant 8 : u32; + v78 = arith.mod v76, v221 : u32; + hir.assertz v78 #[code = 250]; + v79 = hir.int_to_ptr v76 : ptr; + hir.store v79, v73; + v81 = arith.constant 16 : u32; + v80 = hir.bitcast v53 : u32; + v82 = arith.add v80, v81 : u32 #[overflow = checked]; + v83 = arith.constant 4 : u32; + v84 = arith.mod v82, v83 : u32; + hir.assertz v84 #[code = 250]; + v85 = hir.int_to_ptr v82 : ptr; + v86 = hir.load v85 : felt; + v87 = arith.constant 32 : i32; + v88 = arith.add v53, v87 : i32 #[overflow = wrapping]; + hir.exec @miden:rust-sdk-input-note-get-assets-info-binding/rust-sdk-input-note-get-assets-info-binding@0.0.1/rust_sdk_input_note_get_assets_info_binding/miden_stdlib_sys::intrinsics::word::Word::reverse(v46, v88) + v220 = arith.constant 16 : u32; + v89 = hir.bitcast v46 : u32; + v91 = arith.add v89, v220 : u32 #[overflow = checked]; + v219 = arith.constant 4 : u32; + v93 = arith.mod v91, v219 : u32; + hir.assertz v93 #[code = 250]; + v94 = hir.int_to_ptr v91 : ptr; + hir.store v94, v86; + v218 = arith.constant 48 : i32; + v96 = arith.add v53, v218 : i32 #[overflow = wrapping]; + v97 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-info-binding/rust-sdk-input-note-get-assets-info-binding@0.0.1/rust_sdk_input_note_get_assets_info_binding/__stack_pointer : ptr + v98 = hir.bitcast v97 : ptr; + hir.store v98, v96; + builtin.ret ; + }; + + private builtin.function @miden_stdlib_sys::intrinsics::word::Word::reverse(v99: i32, v100: i32) { + ^block17(v99: i32, v100: i32): + v103 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-info-binding/rust-sdk-input-note-get-assets-info-binding@0.0.1/rust_sdk_input_note_get_assets_info_binding/__stack_pointer : ptr + v104 = hir.bitcast v103 : ptr; + v105 = hir.load v104 : i32; + v106 = arith.constant 16 : i32; + v107 = arith.sub v105, v106 : i32 #[overflow = wrapping]; + v109 = arith.constant 8 : u32; + v108 = hir.bitcast v100 : u32; + v110 = arith.add v108, v109 : u32 #[overflow = checked]; + v311 = arith.constant 8 : u32; + v112 = arith.mod v110, v311 : u32; + hir.assertz v112 #[code = 250]; + v113 = hir.int_to_ptr v110 : ptr; + v114 = hir.load v113 : i64; + v310 = arith.constant 8 : u32; + v115 = hir.bitcast v107 : u32; + v117 = arith.add v115, v310 : u32 #[overflow = checked]; + v118 = arith.constant 4 : u32; + v119 = arith.mod v117, v118 : u32; + hir.assertz v119 #[code = 250]; + v120 = hir.int_to_ptr v117 : ptr; + hir.store v120, v114; + v121 = hir.bitcast v100 : u32; + v309 = arith.constant 8 : u32; + v123 = arith.mod v121, v309 : u32; + hir.assertz v123 #[code = 250]; + v124 = hir.int_to_ptr v121 : ptr; + v125 = hir.load v124 : i64; + v126 = hir.bitcast v107 : u32; + v308 = arith.constant 4 : u32; + v128 = arith.mod v126, v308 : u32; + hir.assertz v128 #[code = 250]; + v129 = hir.int_to_ptr v126 : ptr; + hir.store v129, v125; + v130 = arith.constant 12 : i32; + v131 = arith.add v107, v130 : i32 #[overflow = wrapping]; + v101 = arith.constant 0 : i32; + v279, v280, v281, v282, v283, v284 = scf.while v101, v107, v131, v99 : i32, i32, i32, i32, i32, i32 { + ^block39(v285: i32, v286: i32, v287: i32, v288: i32): + v307 = arith.constant 0 : i32; + v134 = arith.constant 8 : i32; + v135 = arith.eq v285, v134 : i1; + v136 = arith.zext v135 : u32; + v137 = hir.bitcast v136 : i32; + v139 = arith.neq v137, v307 : i1; + v273, v274 = scf.if v139 : i32, i32 { + ^block38: + v233 = ub.poison i32 : i32; + scf.yield v233, v233; + } else { + ^block22: + v141 = arith.add v286, v285 : i32 #[overflow = wrapping]; + v142 = hir.bitcast v141 : u32; + v306 = arith.constant 4 : u32; + v144 = arith.mod v142, v306 : u32; + hir.assertz v144 #[code = 250]; + v145 = hir.int_to_ptr v142 : ptr; + v146 = hir.load v145 : felt; + v148 = hir.bitcast v287 : u32; + v305 = arith.constant 4 : u32; + v150 = arith.mod v148, v305 : u32; + hir.assertz v150 #[code = 250]; + v151 = hir.int_to_ptr v148 : ptr; + v152 = hir.load v151 : i32; + v153 = hir.bitcast v141 : u32; + v304 = arith.constant 4 : u32; + v155 = arith.mod v153, v304 : u32; + hir.assertz v155 #[code = 250]; + v156 = hir.int_to_ptr v153 : ptr; + hir.store v156, v152; + v157 = hir.bitcast v287 : u32; + v303 = arith.constant 4 : u32; + v159 = arith.mod v157, v303 : u32; + hir.assertz v159 #[code = 250]; + v160 = hir.int_to_ptr v157 : ptr; + hir.store v160, v146; + v163 = arith.constant -4 : i32; + v164 = arith.add v287, v163 : i32 #[overflow = wrapping]; + v161 = arith.constant 4 : i32; + v162 = arith.add v285, v161 : i32 #[overflow = wrapping]; + scf.yield v162, v164; + }; + v301 = ub.poison i32 : i32; + v276 = cf.select v139, v301, v288 : i32; + v302 = ub.poison i32 : i32; + v275 = cf.select v139, v302, v286 : i32; + v232 = arith.constant 1 : u32; + v225 = arith.constant 0 : u32; + v278 = cf.select v139, v225, v232 : u32; + v266 = arith.trunc v278 : i1; + scf.condition v266, v273, v275, v274, v276, v286, v288; + } do { + ^block40(v289: i32, v290: i32, v291: i32, v292: i32, v293: i32, v294: i32): + scf.yield v289, v290, v291, v292; + }; + v300 = arith.constant 8 : u32; + v166 = hir.bitcast v283 : u32; + v168 = arith.add v166, v300 : u32 #[overflow = checked]; + v299 = arith.constant 4 : u32; + v170 = arith.mod v168, v299 : u32; + hir.assertz v170 #[code = 250]; + v171 = hir.int_to_ptr v168 : ptr; + v172 = hir.load v171 : i64; + v298 = arith.constant 8 : u32; + v173 = hir.bitcast v284 : u32; + v175 = arith.add v173, v298 : u32 #[overflow = checked]; + v297 = arith.constant 8 : u32; + v177 = arith.mod v175, v297 : u32; + hir.assertz v177 #[code = 250]; + v178 = hir.int_to_ptr v175 : ptr; + hir.store v178, v172; + v179 = hir.bitcast v283 : u32; + v296 = arith.constant 4 : u32; + v181 = arith.mod v179, v296 : u32; + hir.assertz v181 #[code = 250]; + v182 = hir.int_to_ptr v179 : ptr; + v183 = hir.load v182 : i64; + v184 = hir.bitcast v284 : u32; + v295 = arith.constant 8 : u32; + v186 = arith.mod v184, v295 : u32; + hir.assertz v186 #[code = 250]; + v187 = hir.int_to_ptr v184 : ptr; + hir.store v187, v183; + builtin.ret ; + }; + + private builtin.function @intrinsics::felt::from_u32(v188: i32) -> felt { + ^block23(v188: i32): + v189 = hir.bitcast v188 : felt; + builtin.ret v189; + }; + + private builtin.function @miden::input_note::get_assets_info(v191: felt, v192: i32) { + ^block25(v191: felt, v192: i32): + v193, v194, v195, v196, v197 = hir.exec @miden/input_note/get_assets_info(v191) : felt, felt, felt, felt, felt + v198 = hir.bitcast v192 : u32; + v199 = hir.int_to_ptr v198 : ptr; + hir.store v199, v193; + v200 = arith.constant 4 : u32; + v201 = arith.add v198, v200 : u32 #[overflow = checked]; + v202 = hir.int_to_ptr v201 : ptr; + hir.store v202, v194; + v203 = arith.constant 8 : u32; + v204 = arith.add v198, v203 : u32 #[overflow = checked]; + v205 = hir.int_to_ptr v204 : ptr; + hir.store v205, v195; + v206 = arith.constant 12 : u32; + v207 = arith.add v198, v206 : u32 #[overflow = checked]; + v208 = hir.int_to_ptr v207 : ptr; + hir.store v208, v196; + v209 = arith.constant 16 : u32; + v210 = arith.add v198, v209 : u32 #[overflow = checked]; + v211 = hir.int_to_ptr v210 : ptr; + hir.store v211, v197; + builtin.ret ; + }; + + builtin.global_variable private @#__stack_pointer : i32 { + builtin.ret_imm 1048576; + }; + + builtin.global_variable private @#GOT.data.internal.__memory_base : i32 { + builtin.ret_imm 0; + }; + + builtin.segment @1048576 = 0x0000000100000001; + }; + + public builtin.function @binding() -> felt { + ^block29: + v212 = hir.exec @miden:rust-sdk-input-note-get-assets-info-binding/rust-sdk-input-note-get-assets-info-binding@0.0.1/rust_sdk_input_note_get_assets_info_binding/miden:rust-sdk-input-note-get-assets-info-binding/rust-sdk-input-note-get-assets-info-binding@0.0.1#binding() : felt + builtin.ret v212; + }; +}; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_assets_info_binding.masm b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_assets_info_binding.masm new file mode 100644 index 000000000..6cd4b5bdf --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_assets_info_binding.masm @@ -0,0 +1,688 @@ +# mod miden:rust-sdk-input-note-get-assets-info-binding/rust-sdk-input-note-get-assets-info-binding@0.0.1 + +@callconv("canon-lift") +pub proc binding( + +) -> felt + exec.::miden:rust-sdk-input-note-get-assets-info-binding/rust-sdk-input-note-get-assets-info-binding@0.0.1::init + trace.240 + nop + exec.::miden:rust-sdk-input-note-get-assets-info-binding/rust-sdk-input-note-get-assets-info-binding@0.0.1::rust_sdk_input_note_get_assets_info_binding::miden:rust-sdk-input-note-get-assets-info-binding/rust-sdk-input-note-get-assets-info-binding@0.0.1#binding + trace.252 + nop + exec.::std::sys::truncate_stack +end + +proc init + push.1179648 + trace.240 + exec.::intrinsics::mem::heap_init + trace.252 + push.[7028007876379170725,18060021366771303825,13412364500725888848,14178532912296021363] + adv.push_mapval + push.262144 + push.1 + trace.240 + exec.::std::mem::pipe_preimage_to_memory + trace.252 + drop + push.1048576 + u32assert + mem_store.278536 + push.0 + u32assert + mem_store.278537 +end + +# mod miden:rust-sdk-input-note-get-assets-info-binding/rust-sdk-input-note-get-assets-info-binding@0.0.1::rust_sdk_input_note_get_assets_info_binding + +@callconv("C") +proc __wasm_call_ctors( + +) + nop +end + +@callconv("C") +proc rust_sdk_input_note_get_assets_info_binding::bindings::__link_custom_section_describing_imports( + +) + nop +end + +@callconv("C") +proc miden:rust-sdk-input-note-get-assets-info-binding/rust-sdk-input-note-get-assets-info-binding@0.0.1#binding( + +) -> felt + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.32 + u32wrapping_sub + push.1114144 + dup.1 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + trace.240 + nop + exec.::miden:rust-sdk-input-note-get-assets-info-binding/rust-sdk-input-note-get-assets-info-binding@0.0.1::rust_sdk_input_note_get_assets_info_binding::wit_bindgen::rt::run_ctors_once + trace.252 + nop + push.0 + trace.240 + nop + exec.::miden:rust-sdk-input-note-get-assets-info-binding/rust-sdk-input-note-get-assets-info-binding@0.0.1::rust_sdk_input_note_get_assets_info_binding::intrinsics::felt::from_u32 + trace.252 + nop + dup.1 + trace.240 + nop + exec.::miden:rust-sdk-input-note-get-assets-info-binding/rust-sdk-input-note-get-assets-info-binding@0.0.1::rust_sdk_input_note_get_assets_info_binding::miden_base_sys::bindings::input_note::get_assets_info + trace.252 + nop + push.16 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.32 + movup.2 + u32wrapping_add + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop +end + +@callconv("C") +proc wit_bindgen::rt::run_ctors_once( + +) + push.1114148 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.1048584 + u32wrapping_add + u32divmod.4 + swap.1 + swap.1 + dup.1 + mem_load + swap.1 + push.8 + u32wrapping_mul + u32shr + swap.1 + drop + push.255 + u32and + push.0 + swap.1 + neq + if.true + nop + else + push.1114148 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + trace.240 + nop + exec.::miden:rust-sdk-input-note-get-assets-info-binding/rust-sdk-input-note-get-assets-info-binding@0.0.1::rust_sdk_input_note_get_assets_info_binding::__wasm_call_ctors + trace.252 + nop + push.1 + push.1048584 + movup.2 + u32wrapping_add + u32divmod.4 + swap.1 + dup.0 + mem_load + dup.2 + push.8 + u32wrapping_mul + push.255 + swap.1 + u32shl + u32not + swap.1 + u32and + movup.3 + movup.3 + push.8 + u32wrapping_mul + u32shl + u32or + swap.1 + mem_store + end +end + +@callconv("C") +proc miden_base_sys::bindings::input_note::get_assets_info( + i32, + felt +) + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.48 + u32wrapping_sub + push.1114144 + dup.1 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + dup.0 + movup.3 + trace.240 + nop + exec.::miden:rust-sdk-input-note-get-assets-info-binding/rust-sdk-input-note-get-assets-info-binding@0.0.1::rust_sdk_input_note_get_assets_info_binding::miden::input_note::get_assets_info + trace.252 + nop + push.8 + dup.1 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.40 + dup.3 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + dup.0 + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.32 + dup.3 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.16 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.32 + dup.2 + u32wrapping_add + dup.3 + trace.240 + nop + exec.::miden:rust-sdk-input-note-get-assets-info-binding/rust-sdk-input-note-get-assets-info-binding@0.0.1::rust_sdk_input_note_get_assets_info_binding::miden_stdlib_sys::intrinsics::word::Word::reverse + trace.252 + nop + push.16 + movup.3 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.48 + u32wrapping_add + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop +end + +@callconv("C") +proc miden_stdlib_sys::intrinsics::word::Word::reverse( + i32, + i32 +) + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.16 + u32wrapping_sub + push.8 + dup.3 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.8 + dup.3 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + movup.2 + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + dup.2 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.12 + dup.1 + u32wrapping_add + push.0 + movup.2 + swap.1 + push.1 + while.true + push.0 + push.8 + dup.2 + eq + neq + dup.0 + if.true + movup.3 + movup.2 + drop + drop + push.3735929054 + dup.0 + else + dup.2 + dup.2 + u32wrapping_add + dup.0 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + dup.5 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + movup.2 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + dup.4 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.4294967292 + movup.4 + u32wrapping_add + push.4 + movup.3 + u32wrapping_add + end + push.3735929054 + dup.3 + dup.6 + swap.2 + swap.1 + cdrop + push.3735929054 + dup.4 + dup.6 + swap.2 + swap.1 + cdrop + push.1 + push.0 + movup.6 + cdrop + push.1 + u32and + swap.1 + swap.2 + swap.4 + swap.3 + swap.1 + if.true + movup.4 + drop + movup.4 + drop + push.1 + else + push.0 + end + end + drop + drop + drop + drop + push.8 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.8 + dup.4 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + movup.2 + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop +end + +@callconv("C") +proc intrinsics::felt::from_u32(i32) -> felt + nop +end + +@callconv("C") +proc miden::input_note::get_assets_info(felt, i32) + trace.240 + nop + exec.::miden::input_note::get_assets_info + trace.252 + nop + movup.5 + dup.0 + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.4 + dup.1 + add + u32assert + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.8 + dup.1 + add + u32assert + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.12 + dup.1 + add + u32assert + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.16 + add + u32assert + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop +end + diff --git a/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_assets_info_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_assets_info_binding.wat new file mode 100644 index 000000000..0d99037ff --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_assets_info_binding.wat @@ -0,0 +1,189 @@ +(component + (type (;0;) + (instance + (type (;0;) (record (field "inner" f32))) + (export (;1;) "felt" (type (eq 0))) + ) + ) + (import "miden:base/core-types@1.0.0" (instance (;0;) (type 0))) + (core module (;0;) + (type (;0;) (func)) + (type (;1;) (func (result f32))) + (type (;2;) (func (param i32 f32))) + (type (;3;) (func (param i32 i32))) + (type (;4;) (func (param i32) (result f32))) + (type (;5;) (func (param f32 i32))) + (table (;0;) 2 2 funcref) + (memory (;0;) 17) + (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) + (global $GOT.data.internal.__memory_base (;1;) i32 i32.const 0) + (export "memory" (memory 0)) + (export "miden:rust-sdk-input-note-get-assets-info-binding/rust-sdk-input-note-get-assets-info-binding@0.0.1#binding" (func $miden:rust-sdk-input-note-get-assets-info-binding/rust-sdk-input-note-get-assets-info-binding@0.0.1#binding)) + (elem (;0;) (i32.const 1) func $rust_sdk_input_note_get_assets_info_binding::bindings::__link_custom_section_describing_imports) + (func $__wasm_call_ctors (;0;) (type 0)) + (func $rust_sdk_input_note_get_assets_info_binding::bindings::__link_custom_section_describing_imports (;1;) (type 0)) + (func $miden:rust-sdk-input-note-get-assets-info-binding/rust-sdk-input-note-get-assets-info-binding@0.0.1#binding (;2;) (type 1) (result f32) + (local i32 f32) + global.get $__stack_pointer + i32.const 32 + i32.sub + local.tee 0 + global.set $__stack_pointer + call $wit_bindgen::rt::run_ctors_once + local.get 0 + i32.const 0 + call $intrinsics::felt::from_u32 + call $miden_base_sys::bindings::input_note::get_assets_info + local.get 0 + f32.load offset=16 + local.set 1 + local.get 0 + i32.const 32 + i32.add + global.set $__stack_pointer + local.get 1 + ) + (func $wit_bindgen::rt::run_ctors_once (;3;) (type 0) + (local i32) + block ;; label = @1 + global.get $GOT.data.internal.__memory_base + i32.const 1048584 + i32.add + i32.load8_u + br_if 0 (;@1;) + global.get $GOT.data.internal.__memory_base + local.set 0 + call $__wasm_call_ctors + local.get 0 + i32.const 1048584 + i32.add + i32.const 1 + i32.store8 + end + ) + (func $miden_base_sys::bindings::input_note::get_assets_info (;4;) (type 2) (param i32 f32) + (local i32) + global.get $__stack_pointer + i32.const 48 + i32.sub + local.tee 2 + global.set $__stack_pointer + local.get 1 + local.get 2 + call $miden::input_note::get_assets_info + local.get 2 + local.get 2 + i64.load offset=8 + i64.store offset=40 + local.get 2 + local.get 2 + i64.load + i64.store offset=32 + local.get 2 + f32.load offset=16 + local.set 1 + local.get 0 + local.get 2 + i32.const 32 + i32.add + call $miden_stdlib_sys::intrinsics::word::Word::reverse + local.get 0 + local.get 1 + f32.store offset=16 + local.get 2 + i32.const 48 + i32.add + global.set $__stack_pointer + ) + (func $miden_stdlib_sys::intrinsics::word::Word::reverse (;5;) (type 3) (param i32 i32) + (local i32 i32 i32 f32) + global.get $__stack_pointer + i32.const 16 + i32.sub + local.tee 2 + local.get 1 + i64.load offset=8 + i64.store offset=8 align=4 + local.get 2 + local.get 1 + i64.load + i64.store align=4 + local.get 2 + i32.const 12 + i32.add + local.set 3 + i32.const 0 + local.set 1 + block ;; label = @1 + loop ;; label = @2 + local.get 1 + i32.const 8 + i32.eq + br_if 1 (;@1;) + local.get 2 + local.get 1 + i32.add + local.tee 4 + f32.load + local.set 5 + local.get 4 + local.get 3 + i32.load + i32.store + local.get 3 + local.get 5 + f32.store + local.get 1 + i32.const 4 + i32.add + local.set 1 + local.get 3 + i32.const -4 + i32.add + local.set 3 + br 0 (;@2;) + end + end + local.get 0 + local.get 2 + i64.load offset=8 align=4 + i64.store offset=8 + local.get 0 + local.get 2 + i64.load align=4 + i64.store + ) + (func $intrinsics::felt::from_u32 (;6;) (type 4) (param i32) (result f32) + unreachable + ) + (func $miden::input_note::get_assets_info (;7;) (type 5) (param f32 i32) + unreachable + ) + (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") + (@custom "rodata,miden_account" (after data) "Wrust_sdk_input_note_get_assets_info_binding\01\0b0.0.1\03\01\01\00\00\00\00\00\00\00\00\00\00") + ) + (alias export 0 "felt" (type (;1;))) + (core instance (;0;) (instantiate 0)) + (alias core export 0 "memory" (core memory (;0;))) + (type (;2;) (func (result 1))) + (alias core export 0 "miden:rust-sdk-input-note-get-assets-info-binding/rust-sdk-input-note-get-assets-info-binding@0.0.1#binding" (core func (;0;))) + (func (;0;) (type 2) (canon lift (core func 0))) + (alias export 0 "felt" (type (;3;))) + (component (;0;) + (type (;0;) (record (field "inner" f32))) + (import "import-type-felt" (type (;1;) (eq 0))) + (import "import-type-felt0" (type (;2;) (eq 1))) + (type (;3;) (func (result 2))) + (import "import-func-binding" (func (;0;) (type 3))) + (export (;4;) "felt" (type 1)) + (type (;5;) (func (result 4))) + (export (;1;) "binding" (func 0) (func (type 5))) + ) + (instance (;1;) (instantiate 0 + (with "import-func-binding" (func 0)) + (with "import-type-felt" (type 3)) + (with "import-type-felt0" (type 1)) + ) + ) + (export (;2;) "miden:rust-sdk-input-note-get-assets-info-binding/rust-sdk-input-note-get-assets-info-binding@0.0.1" (instance 1)) +) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_inputs_info_binding.hir b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_inputs_info_binding.hir new file mode 100644 index 000000000..580049f39 --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_inputs_info_binding.hir @@ -0,0 +1,319 @@ +builtin.component miden:rust-sdk-input-note-get-inputs-info-binding/rust-sdk-input-note-get-inputs-info-binding@0.0.1 { + builtin.module public @rust_sdk_input_note_get_inputs_info_binding { + private builtin.function @__wasm_call_ctors() { + ^block5: + builtin.ret ; + }; + + private builtin.function @rust_sdk_input_note_get_inputs_info_binding::bindings::__link_custom_section_describing_imports() { + ^block7: + builtin.ret ; + }; + + private builtin.function @miden:rust-sdk-input-note-get-inputs-info-binding/rust-sdk-input-note-get-inputs-info-binding@0.0.1#binding() -> felt { + ^block9: + v3 = builtin.global_symbol @miden:rust-sdk-input-note-get-inputs-info-binding/rust-sdk-input-note-get-inputs-info-binding@0.0.1/rust_sdk_input_note_get_inputs_info_binding/__stack_pointer : ptr + v4 = hir.bitcast v3 : ptr; + v5 = hir.load v4 : i32; + v6 = arith.constant 32 : i32; + v7 = arith.sub v5, v6 : i32 #[overflow = wrapping]; + v8 = builtin.global_symbol @miden:rust-sdk-input-note-get-inputs-info-binding/rust-sdk-input-note-get-inputs-info-binding@0.0.1/rust_sdk_input_note_get_inputs_info_binding/__stack_pointer : ptr + v9 = hir.bitcast v8 : ptr; + hir.store v9, v7; + hir.exec @miden:rust-sdk-input-note-get-inputs-info-binding/rust-sdk-input-note-get-inputs-info-binding@0.0.1/rust_sdk_input_note_get_inputs_info_binding/wit_bindgen::rt::run_ctors_once() + v1 = arith.constant 0 : i32; + v11 = hir.exec @miden:rust-sdk-input-note-get-inputs-info-binding/rust-sdk-input-note-get-inputs-info-binding@0.0.1/rust_sdk_input_note_get_inputs_info_binding/intrinsics::felt::from_u32(v1) : felt + hir.exec @miden:rust-sdk-input-note-get-inputs-info-binding/rust-sdk-input-note-get-inputs-info-binding@0.0.1/rust_sdk_input_note_get_inputs_info_binding/miden_base_sys::bindings::input_note::get_inputs_info(v7, v11) + v13 = arith.constant 16 : u32; + v12 = hir.bitcast v7 : u32; + v14 = arith.add v12, v13 : u32 #[overflow = checked]; + v15 = arith.constant 4 : u32; + v16 = arith.mod v14, v15 : u32; + hir.assertz v16 #[code = 250]; + v17 = hir.int_to_ptr v14 : ptr; + v18 = hir.load v17 : felt; + v213 = arith.constant 32 : i32; + v20 = arith.add v7, v213 : i32 #[overflow = wrapping]; + v21 = builtin.global_symbol @miden:rust-sdk-input-note-get-inputs-info-binding/rust-sdk-input-note-get-inputs-info-binding@0.0.1/rust_sdk_input_note_get_inputs_info_binding/__stack_pointer : ptr + v22 = hir.bitcast v21 : ptr; + hir.store v22, v20; + builtin.ret v18; + }; + + private builtin.function @wit_bindgen::rt::run_ctors_once() { + ^block11: + v24 = builtin.global_symbol @miden:rust-sdk-input-note-get-inputs-info-binding/rust-sdk-input-note-get-inputs-info-binding@0.0.1/rust_sdk_input_note_get_inputs_info_binding/GOT.data.internal.__memory_base : ptr + v25 = hir.bitcast v24 : ptr; + v26 = hir.load v25 : i32; + v27 = arith.constant 1048584 : i32; + v28 = arith.add v26, v27 : i32 #[overflow = wrapping]; + v29 = hir.bitcast v28 : u32; + v30 = hir.int_to_ptr v29 : ptr; + v31 = hir.load v30 : u8; + v23 = arith.constant 0 : i32; + v32 = arith.zext v31 : u32; + v33 = hir.bitcast v32 : i32; + v35 = arith.neq v33, v23 : i1; + scf.if v35{ + ^block13: + scf.yield ; + } else { + ^block14: + v36 = builtin.global_symbol @miden:rust-sdk-input-note-get-inputs-info-binding/rust-sdk-input-note-get-inputs-info-binding@0.0.1/rust_sdk_input_note_get_inputs_info_binding/GOT.data.internal.__memory_base : ptr + v37 = hir.bitcast v36 : ptr; + v38 = hir.load v37 : i32; + hir.exec @miden:rust-sdk-input-note-get-inputs-info-binding/rust-sdk-input-note-get-inputs-info-binding@0.0.1/rust_sdk_input_note_get_inputs_info_binding/__wasm_call_ctors() + v215 = arith.constant 1 : u8; + v217 = arith.constant 1048584 : i32; + v40 = arith.add v38, v217 : i32 #[overflow = wrapping]; + v44 = hir.bitcast v40 : u32; + v45 = hir.int_to_ptr v44 : ptr; + hir.store v45, v215; + scf.yield ; + }; + builtin.ret ; + }; + + private builtin.function @miden_base_sys::bindings::input_note::get_inputs_info(v46: i32, v47: felt) { + ^block15(v46: i32, v47: felt): + v49 = builtin.global_symbol @miden:rust-sdk-input-note-get-inputs-info-binding/rust-sdk-input-note-get-inputs-info-binding@0.0.1/rust_sdk_input_note_get_inputs_info_binding/__stack_pointer : ptr + v50 = hir.bitcast v49 : ptr; + v51 = hir.load v50 : i32; + v52 = arith.constant 48 : i32; + v53 = arith.sub v51, v52 : i32 #[overflow = wrapping]; + v54 = builtin.global_symbol @miden:rust-sdk-input-note-get-inputs-info-binding/rust-sdk-input-note-get-inputs-info-binding@0.0.1/rust_sdk_input_note_get_inputs_info_binding/__stack_pointer : ptr + v55 = hir.bitcast v54 : ptr; + hir.store v55, v53; + hir.exec @miden:rust-sdk-input-note-get-inputs-info-binding/rust-sdk-input-note-get-inputs-info-binding@0.0.1/rust_sdk_input_note_get_inputs_info_binding/miden::input_note::get_inputs_info(v47, v53) + v57 = arith.constant 8 : u32; + v56 = hir.bitcast v53 : u32; + v58 = arith.add v56, v57 : u32 #[overflow = checked]; + v224 = arith.constant 8 : u32; + v60 = arith.mod v58, v224 : u32; + hir.assertz v60 #[code = 250]; + v61 = hir.int_to_ptr v58 : ptr; + v62 = hir.load v61 : i64; + v64 = arith.constant 40 : u32; + v63 = hir.bitcast v53 : u32; + v65 = arith.add v63, v64 : u32 #[overflow = checked]; + v223 = arith.constant 8 : u32; + v67 = arith.mod v65, v223 : u32; + hir.assertz v67 #[code = 250]; + v68 = hir.int_to_ptr v65 : ptr; + hir.store v68, v62; + v69 = hir.bitcast v53 : u32; + v222 = arith.constant 8 : u32; + v71 = arith.mod v69, v222 : u32; + hir.assertz v71 #[code = 250]; + v72 = hir.int_to_ptr v69 : ptr; + v73 = hir.load v72 : i64; + v75 = arith.constant 32 : u32; + v74 = hir.bitcast v53 : u32; + v76 = arith.add v74, v75 : u32 #[overflow = checked]; + v221 = arith.constant 8 : u32; + v78 = arith.mod v76, v221 : u32; + hir.assertz v78 #[code = 250]; + v79 = hir.int_to_ptr v76 : ptr; + hir.store v79, v73; + v81 = arith.constant 16 : u32; + v80 = hir.bitcast v53 : u32; + v82 = arith.add v80, v81 : u32 #[overflow = checked]; + v83 = arith.constant 4 : u32; + v84 = arith.mod v82, v83 : u32; + hir.assertz v84 #[code = 250]; + v85 = hir.int_to_ptr v82 : ptr; + v86 = hir.load v85 : felt; + v87 = arith.constant 32 : i32; + v88 = arith.add v53, v87 : i32 #[overflow = wrapping]; + hir.exec @miden:rust-sdk-input-note-get-inputs-info-binding/rust-sdk-input-note-get-inputs-info-binding@0.0.1/rust_sdk_input_note_get_inputs_info_binding/miden_stdlib_sys::intrinsics::word::Word::reverse(v46, v88) + v220 = arith.constant 16 : u32; + v89 = hir.bitcast v46 : u32; + v91 = arith.add v89, v220 : u32 #[overflow = checked]; + v219 = arith.constant 4 : u32; + v93 = arith.mod v91, v219 : u32; + hir.assertz v93 #[code = 250]; + v94 = hir.int_to_ptr v91 : ptr; + hir.store v94, v86; + v218 = arith.constant 48 : i32; + v96 = arith.add v53, v218 : i32 #[overflow = wrapping]; + v97 = builtin.global_symbol @miden:rust-sdk-input-note-get-inputs-info-binding/rust-sdk-input-note-get-inputs-info-binding@0.0.1/rust_sdk_input_note_get_inputs_info_binding/__stack_pointer : ptr + v98 = hir.bitcast v97 : ptr; + hir.store v98, v96; + builtin.ret ; + }; + + private builtin.function @miden_stdlib_sys::intrinsics::word::Word::reverse(v99: i32, v100: i32) { + ^block17(v99: i32, v100: i32): + v103 = builtin.global_symbol @miden:rust-sdk-input-note-get-inputs-info-binding/rust-sdk-input-note-get-inputs-info-binding@0.0.1/rust_sdk_input_note_get_inputs_info_binding/__stack_pointer : ptr + v104 = hir.bitcast v103 : ptr; + v105 = hir.load v104 : i32; + v106 = arith.constant 16 : i32; + v107 = arith.sub v105, v106 : i32 #[overflow = wrapping]; + v109 = arith.constant 8 : u32; + v108 = hir.bitcast v100 : u32; + v110 = arith.add v108, v109 : u32 #[overflow = checked]; + v311 = arith.constant 8 : u32; + v112 = arith.mod v110, v311 : u32; + hir.assertz v112 #[code = 250]; + v113 = hir.int_to_ptr v110 : ptr; + v114 = hir.load v113 : i64; + v310 = arith.constant 8 : u32; + v115 = hir.bitcast v107 : u32; + v117 = arith.add v115, v310 : u32 #[overflow = checked]; + v118 = arith.constant 4 : u32; + v119 = arith.mod v117, v118 : u32; + hir.assertz v119 #[code = 250]; + v120 = hir.int_to_ptr v117 : ptr; + hir.store v120, v114; + v121 = hir.bitcast v100 : u32; + v309 = arith.constant 8 : u32; + v123 = arith.mod v121, v309 : u32; + hir.assertz v123 #[code = 250]; + v124 = hir.int_to_ptr v121 : ptr; + v125 = hir.load v124 : i64; + v126 = hir.bitcast v107 : u32; + v308 = arith.constant 4 : u32; + v128 = arith.mod v126, v308 : u32; + hir.assertz v128 #[code = 250]; + v129 = hir.int_to_ptr v126 : ptr; + hir.store v129, v125; + v130 = arith.constant 12 : i32; + v131 = arith.add v107, v130 : i32 #[overflow = wrapping]; + v101 = arith.constant 0 : i32; + v279, v280, v281, v282, v283, v284 = scf.while v101, v107, v131, v99 : i32, i32, i32, i32, i32, i32 { + ^block39(v285: i32, v286: i32, v287: i32, v288: i32): + v307 = arith.constant 0 : i32; + v134 = arith.constant 8 : i32; + v135 = arith.eq v285, v134 : i1; + v136 = arith.zext v135 : u32; + v137 = hir.bitcast v136 : i32; + v139 = arith.neq v137, v307 : i1; + v273, v274 = scf.if v139 : i32, i32 { + ^block38: + v233 = ub.poison i32 : i32; + scf.yield v233, v233; + } else { + ^block22: + v141 = arith.add v286, v285 : i32 #[overflow = wrapping]; + v142 = hir.bitcast v141 : u32; + v306 = arith.constant 4 : u32; + v144 = arith.mod v142, v306 : u32; + hir.assertz v144 #[code = 250]; + v145 = hir.int_to_ptr v142 : ptr; + v146 = hir.load v145 : felt; + v148 = hir.bitcast v287 : u32; + v305 = arith.constant 4 : u32; + v150 = arith.mod v148, v305 : u32; + hir.assertz v150 #[code = 250]; + v151 = hir.int_to_ptr v148 : ptr; + v152 = hir.load v151 : i32; + v153 = hir.bitcast v141 : u32; + v304 = arith.constant 4 : u32; + v155 = arith.mod v153, v304 : u32; + hir.assertz v155 #[code = 250]; + v156 = hir.int_to_ptr v153 : ptr; + hir.store v156, v152; + v157 = hir.bitcast v287 : u32; + v303 = arith.constant 4 : u32; + v159 = arith.mod v157, v303 : u32; + hir.assertz v159 #[code = 250]; + v160 = hir.int_to_ptr v157 : ptr; + hir.store v160, v146; + v163 = arith.constant -4 : i32; + v164 = arith.add v287, v163 : i32 #[overflow = wrapping]; + v161 = arith.constant 4 : i32; + v162 = arith.add v285, v161 : i32 #[overflow = wrapping]; + scf.yield v162, v164; + }; + v301 = ub.poison i32 : i32; + v276 = cf.select v139, v301, v288 : i32; + v302 = ub.poison i32 : i32; + v275 = cf.select v139, v302, v286 : i32; + v232 = arith.constant 1 : u32; + v225 = arith.constant 0 : u32; + v278 = cf.select v139, v225, v232 : u32; + v266 = arith.trunc v278 : i1; + scf.condition v266, v273, v275, v274, v276, v286, v288; + } do { + ^block40(v289: i32, v290: i32, v291: i32, v292: i32, v293: i32, v294: i32): + scf.yield v289, v290, v291, v292; + }; + v300 = arith.constant 8 : u32; + v166 = hir.bitcast v283 : u32; + v168 = arith.add v166, v300 : u32 #[overflow = checked]; + v299 = arith.constant 4 : u32; + v170 = arith.mod v168, v299 : u32; + hir.assertz v170 #[code = 250]; + v171 = hir.int_to_ptr v168 : ptr; + v172 = hir.load v171 : i64; + v298 = arith.constant 8 : u32; + v173 = hir.bitcast v284 : u32; + v175 = arith.add v173, v298 : u32 #[overflow = checked]; + v297 = arith.constant 8 : u32; + v177 = arith.mod v175, v297 : u32; + hir.assertz v177 #[code = 250]; + v178 = hir.int_to_ptr v175 : ptr; + hir.store v178, v172; + v179 = hir.bitcast v283 : u32; + v296 = arith.constant 4 : u32; + v181 = arith.mod v179, v296 : u32; + hir.assertz v181 #[code = 250]; + v182 = hir.int_to_ptr v179 : ptr; + v183 = hir.load v182 : i64; + v184 = hir.bitcast v284 : u32; + v295 = arith.constant 8 : u32; + v186 = arith.mod v184, v295 : u32; + hir.assertz v186 #[code = 250]; + v187 = hir.int_to_ptr v184 : ptr; + hir.store v187, v183; + builtin.ret ; + }; + + private builtin.function @intrinsics::felt::from_u32(v188: i32) -> felt { + ^block23(v188: i32): + v189 = hir.bitcast v188 : felt; + builtin.ret v189; + }; + + private builtin.function @miden::input_note::get_inputs_info(v191: felt, v192: i32) { + ^block25(v191: felt, v192: i32): + v193, v194, v195, v196, v197 = hir.exec @miden/input_note/get_inputs_info(v191) : felt, felt, felt, felt, felt + v198 = hir.bitcast v192 : u32; + v199 = hir.int_to_ptr v198 : ptr; + hir.store v199, v193; + v200 = arith.constant 4 : u32; + v201 = arith.add v198, v200 : u32 #[overflow = checked]; + v202 = hir.int_to_ptr v201 : ptr; + hir.store v202, v194; + v203 = arith.constant 8 : u32; + v204 = arith.add v198, v203 : u32 #[overflow = checked]; + v205 = hir.int_to_ptr v204 : ptr; + hir.store v205, v195; + v206 = arith.constant 12 : u32; + v207 = arith.add v198, v206 : u32 #[overflow = checked]; + v208 = hir.int_to_ptr v207 : ptr; + hir.store v208, v196; + v209 = arith.constant 16 : u32; + v210 = arith.add v198, v209 : u32 #[overflow = checked]; + v211 = hir.int_to_ptr v210 : ptr; + hir.store v211, v197; + builtin.ret ; + }; + + builtin.global_variable private @#__stack_pointer : i32 { + builtin.ret_imm 1048576; + }; + + builtin.global_variable private @#GOT.data.internal.__memory_base : i32 { + builtin.ret_imm 0; + }; + + builtin.segment @1048576 = 0x0000000100000001; + }; + + public builtin.function @binding() -> felt { + ^block29: + v212 = hir.exec @miden:rust-sdk-input-note-get-inputs-info-binding/rust-sdk-input-note-get-inputs-info-binding@0.0.1/rust_sdk_input_note_get_inputs_info_binding/miden:rust-sdk-input-note-get-inputs-info-binding/rust-sdk-input-note-get-inputs-info-binding@0.0.1#binding() : felt + builtin.ret v212; + }; +}; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_inputs_info_binding.masm b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_inputs_info_binding.masm new file mode 100644 index 000000000..8369fe464 --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_inputs_info_binding.masm @@ -0,0 +1,688 @@ +# mod miden:rust-sdk-input-note-get-inputs-info-binding/rust-sdk-input-note-get-inputs-info-binding@0.0.1 + +@callconv("canon-lift") +pub proc binding( + +) -> felt + exec.::miden:rust-sdk-input-note-get-inputs-info-binding/rust-sdk-input-note-get-inputs-info-binding@0.0.1::init + trace.240 + nop + exec.::miden:rust-sdk-input-note-get-inputs-info-binding/rust-sdk-input-note-get-inputs-info-binding@0.0.1::rust_sdk_input_note_get_inputs_info_binding::miden:rust-sdk-input-note-get-inputs-info-binding/rust-sdk-input-note-get-inputs-info-binding@0.0.1#binding + trace.252 + nop + exec.::std::sys::truncate_stack +end + +proc init + push.1179648 + trace.240 + exec.::intrinsics::mem::heap_init + trace.252 + push.[7028007876379170725,18060021366771303825,13412364500725888848,14178532912296021363] + adv.push_mapval + push.262144 + push.1 + trace.240 + exec.::std::mem::pipe_preimage_to_memory + trace.252 + drop + push.1048576 + u32assert + mem_store.278536 + push.0 + u32assert + mem_store.278537 +end + +# mod miden:rust-sdk-input-note-get-inputs-info-binding/rust-sdk-input-note-get-inputs-info-binding@0.0.1::rust_sdk_input_note_get_inputs_info_binding + +@callconv("C") +proc __wasm_call_ctors( + +) + nop +end + +@callconv("C") +proc rust_sdk_input_note_get_inputs_info_binding::bindings::__link_custom_section_describing_imports( + +) + nop +end + +@callconv("C") +proc miden:rust-sdk-input-note-get-inputs-info-binding/rust-sdk-input-note-get-inputs-info-binding@0.0.1#binding( + +) -> felt + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.32 + u32wrapping_sub + push.1114144 + dup.1 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + trace.240 + nop + exec.::miden:rust-sdk-input-note-get-inputs-info-binding/rust-sdk-input-note-get-inputs-info-binding@0.0.1::rust_sdk_input_note_get_inputs_info_binding::wit_bindgen::rt::run_ctors_once + trace.252 + nop + push.0 + trace.240 + nop + exec.::miden:rust-sdk-input-note-get-inputs-info-binding/rust-sdk-input-note-get-inputs-info-binding@0.0.1::rust_sdk_input_note_get_inputs_info_binding::intrinsics::felt::from_u32 + trace.252 + nop + dup.1 + trace.240 + nop + exec.::miden:rust-sdk-input-note-get-inputs-info-binding/rust-sdk-input-note-get-inputs-info-binding@0.0.1::rust_sdk_input_note_get_inputs_info_binding::miden_base_sys::bindings::input_note::get_inputs_info + trace.252 + nop + push.16 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.32 + movup.2 + u32wrapping_add + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop +end + +@callconv("C") +proc wit_bindgen::rt::run_ctors_once( + +) + push.1114148 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.1048584 + u32wrapping_add + u32divmod.4 + swap.1 + swap.1 + dup.1 + mem_load + swap.1 + push.8 + u32wrapping_mul + u32shr + swap.1 + drop + push.255 + u32and + push.0 + swap.1 + neq + if.true + nop + else + push.1114148 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + trace.240 + nop + exec.::miden:rust-sdk-input-note-get-inputs-info-binding/rust-sdk-input-note-get-inputs-info-binding@0.0.1::rust_sdk_input_note_get_inputs_info_binding::__wasm_call_ctors + trace.252 + nop + push.1 + push.1048584 + movup.2 + u32wrapping_add + u32divmod.4 + swap.1 + dup.0 + mem_load + dup.2 + push.8 + u32wrapping_mul + push.255 + swap.1 + u32shl + u32not + swap.1 + u32and + movup.3 + movup.3 + push.8 + u32wrapping_mul + u32shl + u32or + swap.1 + mem_store + end +end + +@callconv("C") +proc miden_base_sys::bindings::input_note::get_inputs_info( + i32, + felt +) + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.48 + u32wrapping_sub + push.1114144 + dup.1 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + dup.0 + movup.3 + trace.240 + nop + exec.::miden:rust-sdk-input-note-get-inputs-info-binding/rust-sdk-input-note-get-inputs-info-binding@0.0.1::rust_sdk_input_note_get_inputs_info_binding::miden::input_note::get_inputs_info + trace.252 + nop + push.8 + dup.1 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.40 + dup.3 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + dup.0 + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.32 + dup.3 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.16 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.32 + dup.2 + u32wrapping_add + dup.3 + trace.240 + nop + exec.::miden:rust-sdk-input-note-get-inputs-info-binding/rust-sdk-input-note-get-inputs-info-binding@0.0.1::rust_sdk_input_note_get_inputs_info_binding::miden_stdlib_sys::intrinsics::word::Word::reverse + trace.252 + nop + push.16 + movup.3 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.48 + u32wrapping_add + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop +end + +@callconv("C") +proc miden_stdlib_sys::intrinsics::word::Word::reverse( + i32, + i32 +) + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.16 + u32wrapping_sub + push.8 + dup.3 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.8 + dup.3 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + movup.2 + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + dup.2 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.12 + dup.1 + u32wrapping_add + push.0 + movup.2 + swap.1 + push.1 + while.true + push.0 + push.8 + dup.2 + eq + neq + dup.0 + if.true + movup.3 + movup.2 + drop + drop + push.3735929054 + dup.0 + else + dup.2 + dup.2 + u32wrapping_add + dup.0 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + dup.5 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + movup.2 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + dup.4 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.4294967292 + movup.4 + u32wrapping_add + push.4 + movup.3 + u32wrapping_add + end + push.3735929054 + dup.3 + dup.6 + swap.2 + swap.1 + cdrop + push.3735929054 + dup.4 + dup.6 + swap.2 + swap.1 + cdrop + push.1 + push.0 + movup.6 + cdrop + push.1 + u32and + swap.1 + swap.2 + swap.4 + swap.3 + swap.1 + if.true + movup.4 + drop + movup.4 + drop + push.1 + else + push.0 + end + end + drop + drop + drop + drop + push.8 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.8 + dup.4 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + movup.2 + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop +end + +@callconv("C") +proc intrinsics::felt::from_u32(i32) -> felt + nop +end + +@callconv("C") +proc miden::input_note::get_inputs_info(felt, i32) + trace.240 + nop + exec.::miden::input_note::get_inputs_info + trace.252 + nop + movup.5 + dup.0 + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.4 + dup.1 + add + u32assert + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.8 + dup.1 + add + u32assert + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.12 + dup.1 + add + u32assert + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.16 + add + u32assert + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop +end + diff --git a/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_inputs_info_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_inputs_info_binding.wat new file mode 100644 index 000000000..b196d2c13 --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_inputs_info_binding.wat @@ -0,0 +1,189 @@ +(component + (type (;0;) + (instance + (type (;0;) (record (field "inner" f32))) + (export (;1;) "felt" (type (eq 0))) + ) + ) + (import "miden:base/core-types@1.0.0" (instance (;0;) (type 0))) + (core module (;0;) + (type (;0;) (func)) + (type (;1;) (func (result f32))) + (type (;2;) (func (param i32 f32))) + (type (;3;) (func (param i32 i32))) + (type (;4;) (func (param i32) (result f32))) + (type (;5;) (func (param f32 i32))) + (table (;0;) 2 2 funcref) + (memory (;0;) 17) + (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) + (global $GOT.data.internal.__memory_base (;1;) i32 i32.const 0) + (export "memory" (memory 0)) + (export "miden:rust-sdk-input-note-get-inputs-info-binding/rust-sdk-input-note-get-inputs-info-binding@0.0.1#binding" (func $miden:rust-sdk-input-note-get-inputs-info-binding/rust-sdk-input-note-get-inputs-info-binding@0.0.1#binding)) + (elem (;0;) (i32.const 1) func $rust_sdk_input_note_get_inputs_info_binding::bindings::__link_custom_section_describing_imports) + (func $__wasm_call_ctors (;0;) (type 0)) + (func $rust_sdk_input_note_get_inputs_info_binding::bindings::__link_custom_section_describing_imports (;1;) (type 0)) + (func $miden:rust-sdk-input-note-get-inputs-info-binding/rust-sdk-input-note-get-inputs-info-binding@0.0.1#binding (;2;) (type 1) (result f32) + (local i32 f32) + global.get $__stack_pointer + i32.const 32 + i32.sub + local.tee 0 + global.set $__stack_pointer + call $wit_bindgen::rt::run_ctors_once + local.get 0 + i32.const 0 + call $intrinsics::felt::from_u32 + call $miden_base_sys::bindings::input_note::get_inputs_info + local.get 0 + f32.load offset=16 + local.set 1 + local.get 0 + i32.const 32 + i32.add + global.set $__stack_pointer + local.get 1 + ) + (func $wit_bindgen::rt::run_ctors_once (;3;) (type 0) + (local i32) + block ;; label = @1 + global.get $GOT.data.internal.__memory_base + i32.const 1048584 + i32.add + i32.load8_u + br_if 0 (;@1;) + global.get $GOT.data.internal.__memory_base + local.set 0 + call $__wasm_call_ctors + local.get 0 + i32.const 1048584 + i32.add + i32.const 1 + i32.store8 + end + ) + (func $miden_base_sys::bindings::input_note::get_inputs_info (;4;) (type 2) (param i32 f32) + (local i32) + global.get $__stack_pointer + i32.const 48 + i32.sub + local.tee 2 + global.set $__stack_pointer + local.get 1 + local.get 2 + call $miden::input_note::get_inputs_info + local.get 2 + local.get 2 + i64.load offset=8 + i64.store offset=40 + local.get 2 + local.get 2 + i64.load + i64.store offset=32 + local.get 2 + f32.load offset=16 + local.set 1 + local.get 0 + local.get 2 + i32.const 32 + i32.add + call $miden_stdlib_sys::intrinsics::word::Word::reverse + local.get 0 + local.get 1 + f32.store offset=16 + local.get 2 + i32.const 48 + i32.add + global.set $__stack_pointer + ) + (func $miden_stdlib_sys::intrinsics::word::Word::reverse (;5;) (type 3) (param i32 i32) + (local i32 i32 i32 f32) + global.get $__stack_pointer + i32.const 16 + i32.sub + local.tee 2 + local.get 1 + i64.load offset=8 + i64.store offset=8 align=4 + local.get 2 + local.get 1 + i64.load + i64.store align=4 + local.get 2 + i32.const 12 + i32.add + local.set 3 + i32.const 0 + local.set 1 + block ;; label = @1 + loop ;; label = @2 + local.get 1 + i32.const 8 + i32.eq + br_if 1 (;@1;) + local.get 2 + local.get 1 + i32.add + local.tee 4 + f32.load + local.set 5 + local.get 4 + local.get 3 + i32.load + i32.store + local.get 3 + local.get 5 + f32.store + local.get 1 + i32.const 4 + i32.add + local.set 1 + local.get 3 + i32.const -4 + i32.add + local.set 3 + br 0 (;@2;) + end + end + local.get 0 + local.get 2 + i64.load offset=8 align=4 + i64.store offset=8 + local.get 0 + local.get 2 + i64.load align=4 + i64.store + ) + (func $intrinsics::felt::from_u32 (;6;) (type 4) (param i32) (result f32) + unreachable + ) + (func $miden::input_note::get_inputs_info (;7;) (type 5) (param f32 i32) + unreachable + ) + (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") + (@custom "rodata,miden_account" (after data) "Wrust_sdk_input_note_get_inputs_info_binding\01\0b0.0.1\03\01\01\00\00\00\00\00\00\00\00\00\00") + ) + (alias export 0 "felt" (type (;1;))) + (core instance (;0;) (instantiate 0)) + (alias core export 0 "memory" (core memory (;0;))) + (type (;2;) (func (result 1))) + (alias core export 0 "miden:rust-sdk-input-note-get-inputs-info-binding/rust-sdk-input-note-get-inputs-info-binding@0.0.1#binding" (core func (;0;))) + (func (;0;) (type 2) (canon lift (core func 0))) + (alias export 0 "felt" (type (;3;))) + (component (;0;) + (type (;0;) (record (field "inner" f32))) + (import "import-type-felt" (type (;1;) (eq 0))) + (import "import-type-felt0" (type (;2;) (eq 1))) + (type (;3;) (func (result 2))) + (import "import-func-binding" (func (;0;) (type 3))) + (export (;4;) "felt" (type 1)) + (type (;5;) (func (result 4))) + (export (;1;) "binding" (func 0) (func (type 5))) + ) + (instance (;1;) (instantiate 0 + (with "import-func-binding" (func 0)) + (with "import-type-felt" (type 3)) + (with "import-type-felt0" (type 1)) + ) + ) + (export (;2;) "miden:rust-sdk-input-note-get-inputs-info-binding/rust-sdk-input-note-get-inputs-info-binding@0.0.1" (instance 1)) +) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_metadata_binding.hir b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_metadata_binding.hir new file mode 100644 index 000000000..a0da29f51 --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_metadata_binding.hir @@ -0,0 +1,350 @@ +builtin.component miden:rust-sdk-input-note-get-metadata-binding/rust-sdk-input-note-get-metadata-binding@0.0.1 { + builtin.module public @rust_sdk_input_note_get_metadata_binding { + private builtin.function @__wasm_call_ctors() { + ^block5: + builtin.ret ; + }; + + private builtin.function @rust_sdk_input_note_get_metadata_binding::bindings::__link_custom_section_describing_imports() { + ^block7: + builtin.ret ; + }; + + private builtin.function @miden:rust-sdk-input-note-get-metadata-binding/rust-sdk-input-note-get-metadata-binding@0.0.1#binding() -> i32 { + ^block9: + v2 = builtin.global_symbol @miden:rust-sdk-input-note-get-metadata-binding/rust-sdk-input-note-get-metadata-binding@0.0.1/rust_sdk_input_note_get_metadata_binding/__stack_pointer : ptr + v3 = hir.bitcast v2 : ptr; + v4 = hir.load v3 : i32; + v5 = arith.constant 16 : i32; + v6 = arith.sub v4, v5 : i32 #[overflow = wrapping]; + v7 = builtin.global_symbol @miden:rust-sdk-input-note-get-metadata-binding/rust-sdk-input-note-get-metadata-binding@0.0.1/rust_sdk_input_note_get_metadata_binding/__stack_pointer : ptr + v8 = hir.bitcast v7 : ptr; + hir.store v8, v6; + hir.exec @miden:rust-sdk-input-note-get-metadata-binding/rust-sdk-input-note-get-metadata-binding@0.0.1/rust_sdk_input_note_get_metadata_binding/wit_bindgen::rt::run_ctors_once() + v1 = arith.constant 0 : i32; + v10 = hir.exec @miden:rust-sdk-input-note-get-metadata-binding/rust-sdk-input-note-get-metadata-binding@0.0.1/rust_sdk_input_note_get_metadata_binding/intrinsics::felt::from_u32(v1) : felt + hir.exec @miden:rust-sdk-input-note-get-metadata-binding/rust-sdk-input-note-get-metadata-binding@0.0.1/rust_sdk_input_note_get_metadata_binding/miden_base_sys::bindings::input_note::get_metadata(v6, v10) + v11 = builtin.global_symbol @miden:rust-sdk-input-note-get-metadata-binding/rust-sdk-input-note-get-metadata-binding@0.0.1/rust_sdk_input_note_get_metadata_binding/GOT.data.internal.__memory_base : ptr + v12 = hir.bitcast v11 : ptr; + v13 = hir.load v12 : i32; + v14 = arith.constant 1048584 : i32; + v15 = arith.add v13, v14 : i32 #[overflow = wrapping]; + v17 = arith.constant 8 : u32; + v16 = hir.bitcast v6 : u32; + v18 = arith.add v16, v17 : u32 #[overflow = checked]; + v249 = arith.constant 8 : u32; + v20 = arith.mod v18, v249 : u32; + hir.assertz v20 #[code = 250]; + v21 = hir.int_to_ptr v18 : ptr; + v22 = hir.load v21 : i64; + v248 = arith.constant 8 : u32; + v23 = hir.bitcast v15 : u32; + v25 = arith.add v23, v248 : u32 #[overflow = checked]; + v26 = arith.constant 4 : u32; + v27 = arith.mod v25, v26 : u32; + hir.assertz v27 #[code = 250]; + v28 = hir.int_to_ptr v25 : ptr; + hir.store v28, v22; + v29 = hir.bitcast v6 : u32; + v247 = arith.constant 8 : u32; + v31 = arith.mod v29, v247 : u32; + hir.assertz v31 #[code = 250]; + v32 = hir.int_to_ptr v29 : ptr; + v33 = hir.load v32 : i64; + v34 = hir.bitcast v15 : u32; + v246 = arith.constant 4 : u32; + v36 = arith.mod v34, v246 : u32; + hir.assertz v36 #[code = 250]; + v37 = hir.int_to_ptr v34 : ptr; + hir.store v37, v33; + v245 = arith.constant 16 : i32; + v39 = arith.add v6, v245 : i32 #[overflow = wrapping]; + v40 = builtin.global_symbol @miden:rust-sdk-input-note-get-metadata-binding/rust-sdk-input-note-get-metadata-binding@0.0.1/rust_sdk_input_note_get_metadata_binding/__stack_pointer : ptr + v41 = hir.bitcast v40 : ptr; + hir.store v41, v39; + builtin.ret v15; + }; + + private builtin.function @wit_bindgen::rt::run_ctors_once() { + ^block11: + v43 = builtin.global_symbol @miden:rust-sdk-input-note-get-metadata-binding/rust-sdk-input-note-get-metadata-binding@0.0.1/rust_sdk_input_note_get_metadata_binding/GOT.data.internal.__memory_base : ptr + v44 = hir.bitcast v43 : ptr; + v45 = hir.load v44 : i32; + v46 = arith.constant 1048600 : i32; + v47 = arith.add v45, v46 : i32 #[overflow = wrapping]; + v48 = hir.bitcast v47 : u32; + v49 = hir.int_to_ptr v48 : ptr; + v50 = hir.load v49 : u8; + v42 = arith.constant 0 : i32; + v51 = arith.zext v50 : u32; + v52 = hir.bitcast v51 : i32; + v54 = arith.neq v52, v42 : i1; + scf.if v54{ + ^block13: + scf.yield ; + } else { + ^block14: + v55 = builtin.global_symbol @miden:rust-sdk-input-note-get-metadata-binding/rust-sdk-input-note-get-metadata-binding@0.0.1/rust_sdk_input_note_get_metadata_binding/GOT.data.internal.__memory_base : ptr + v56 = hir.bitcast v55 : ptr; + v57 = hir.load v56 : i32; + hir.exec @miden:rust-sdk-input-note-get-metadata-binding/rust-sdk-input-note-get-metadata-binding@0.0.1/rust_sdk_input_note_get_metadata_binding/__wasm_call_ctors() + v251 = arith.constant 1 : u8; + v253 = arith.constant 1048600 : i32; + v59 = arith.add v57, v253 : i32 #[overflow = wrapping]; + v63 = hir.bitcast v59 : u32; + v64 = hir.int_to_ptr v63 : ptr; + hir.store v64, v251; + scf.yield ; + }; + builtin.ret ; + }; + + private builtin.function @miden_base_sys::bindings::input_note::get_metadata(v65: i32, v66: felt) { + ^block15(v65: i32, v66: felt): + v68 = builtin.global_symbol @miden:rust-sdk-input-note-get-metadata-binding/rust-sdk-input-note-get-metadata-binding@0.0.1/rust_sdk_input_note_get_metadata_binding/__stack_pointer : ptr + v69 = hir.bitcast v68 : ptr; + v70 = hir.load v69 : i32; + v71 = arith.constant 32 : i32; + v72 = arith.sub v70, v71 : i32 #[overflow = wrapping]; + v73 = builtin.global_symbol @miden:rust-sdk-input-note-get-metadata-binding/rust-sdk-input-note-get-metadata-binding@0.0.1/rust_sdk_input_note_get_metadata_binding/__stack_pointer : ptr + v74 = hir.bitcast v73 : ptr; + hir.store v74, v72; + hir.exec @miden:rust-sdk-input-note-get-metadata-binding/rust-sdk-input-note-get-metadata-binding@0.0.1/rust_sdk_input_note_get_metadata_binding/miden::input_note::get_metadata(v66, v72) + v76 = arith.constant 8 : u32; + v75 = hir.bitcast v72 : u32; + v77 = arith.add v75, v76 : u32 #[overflow = checked]; + v258 = arith.constant 8 : u32; + v79 = arith.mod v77, v258 : u32; + hir.assertz v79 #[code = 250]; + v80 = hir.int_to_ptr v77 : ptr; + v81 = hir.load v80 : i64; + v83 = arith.constant 24 : u32; + v82 = hir.bitcast v72 : u32; + v84 = arith.add v82, v83 : u32 #[overflow = checked]; + v257 = arith.constant 8 : u32; + v86 = arith.mod v84, v257 : u32; + hir.assertz v86 #[code = 250]; + v87 = hir.int_to_ptr v84 : ptr; + hir.store v87, v81; + v88 = hir.bitcast v72 : u32; + v256 = arith.constant 8 : u32; + v90 = arith.mod v88, v256 : u32; + hir.assertz v90 #[code = 250]; + v91 = hir.int_to_ptr v88 : ptr; + v92 = hir.load v91 : i64; + v94 = arith.constant 16 : u32; + v93 = hir.bitcast v72 : u32; + v95 = arith.add v93, v94 : u32 #[overflow = checked]; + v255 = arith.constant 8 : u32; + v97 = arith.mod v95, v255 : u32; + hir.assertz v97 #[code = 250]; + v98 = hir.int_to_ptr v95 : ptr; + hir.store v98, v92; + v99 = arith.constant 16 : i32; + v100 = arith.add v72, v99 : i32 #[overflow = wrapping]; + hir.exec @miden:rust-sdk-input-note-get-metadata-binding/rust-sdk-input-note-get-metadata-binding@0.0.1/rust_sdk_input_note_get_metadata_binding/miden_stdlib_sys::intrinsics::word::Word::reverse(v65, v100) + v254 = arith.constant 32 : i32; + v102 = arith.add v72, v254 : i32 #[overflow = wrapping]; + v103 = builtin.global_symbol @miden:rust-sdk-input-note-get-metadata-binding/rust-sdk-input-note-get-metadata-binding@0.0.1/rust_sdk_input_note_get_metadata_binding/__stack_pointer : ptr + v104 = hir.bitcast v103 : ptr; + hir.store v104, v102; + builtin.ret ; + }; + + private builtin.function @miden_stdlib_sys::intrinsics::word::Word::reverse(v105: i32, v106: i32) { + ^block17(v105: i32, v106: i32): + v109 = builtin.global_symbol @miden:rust-sdk-input-note-get-metadata-binding/rust-sdk-input-note-get-metadata-binding@0.0.1/rust_sdk_input_note_get_metadata_binding/__stack_pointer : ptr + v110 = hir.bitcast v109 : ptr; + v111 = hir.load v110 : i32; + v112 = arith.constant 16 : i32; + v113 = arith.sub v111, v112 : i32 #[overflow = wrapping]; + v115 = arith.constant 8 : u32; + v114 = hir.bitcast v106 : u32; + v116 = arith.add v114, v115 : u32 #[overflow = checked]; + v345 = arith.constant 8 : u32; + v118 = arith.mod v116, v345 : u32; + hir.assertz v118 #[code = 250]; + v119 = hir.int_to_ptr v116 : ptr; + v120 = hir.load v119 : i64; + v344 = arith.constant 8 : u32; + v121 = hir.bitcast v113 : u32; + v123 = arith.add v121, v344 : u32 #[overflow = checked]; + v124 = arith.constant 4 : u32; + v125 = arith.mod v123, v124 : u32; + hir.assertz v125 #[code = 250]; + v126 = hir.int_to_ptr v123 : ptr; + hir.store v126, v120; + v127 = hir.bitcast v106 : u32; + v343 = arith.constant 8 : u32; + v129 = arith.mod v127, v343 : u32; + hir.assertz v129 #[code = 250]; + v130 = hir.int_to_ptr v127 : ptr; + v131 = hir.load v130 : i64; + v132 = hir.bitcast v113 : u32; + v342 = arith.constant 4 : u32; + v134 = arith.mod v132, v342 : u32; + hir.assertz v134 #[code = 250]; + v135 = hir.int_to_ptr v132 : ptr; + hir.store v135, v131; + v136 = arith.constant 12 : i32; + v137 = arith.add v113, v136 : i32 #[overflow = wrapping]; + v107 = arith.constant 0 : i32; + v313, v314, v315, v316, v317, v318 = scf.while v107, v113, v137, v105 : i32, i32, i32, i32, i32, i32 { + ^block39(v319: i32, v320: i32, v321: i32, v322: i32): + v341 = arith.constant 0 : i32; + v140 = arith.constant 8 : i32; + v141 = arith.eq v319, v140 : i1; + v142 = arith.zext v141 : u32; + v143 = hir.bitcast v142 : i32; + v145 = arith.neq v143, v341 : i1; + v307, v308 = scf.if v145 : i32, i32 { + ^block38: + v267 = ub.poison i32 : i32; + scf.yield v267, v267; + } else { + ^block22: + v147 = arith.add v320, v319 : i32 #[overflow = wrapping]; + v148 = hir.bitcast v147 : u32; + v340 = arith.constant 4 : u32; + v150 = arith.mod v148, v340 : u32; + hir.assertz v150 #[code = 250]; + v151 = hir.int_to_ptr v148 : ptr; + v152 = hir.load v151 : felt; + v154 = hir.bitcast v321 : u32; + v339 = arith.constant 4 : u32; + v156 = arith.mod v154, v339 : u32; + hir.assertz v156 #[code = 250]; + v157 = hir.int_to_ptr v154 : ptr; + v158 = hir.load v157 : i32; + v159 = hir.bitcast v147 : u32; + v338 = arith.constant 4 : u32; + v161 = arith.mod v159, v338 : u32; + hir.assertz v161 #[code = 250]; + v162 = hir.int_to_ptr v159 : ptr; + hir.store v162, v158; + v163 = hir.bitcast v321 : u32; + v337 = arith.constant 4 : u32; + v165 = arith.mod v163, v337 : u32; + hir.assertz v165 #[code = 250]; + v166 = hir.int_to_ptr v163 : ptr; + hir.store v166, v152; + v169 = arith.constant -4 : i32; + v170 = arith.add v321, v169 : i32 #[overflow = wrapping]; + v167 = arith.constant 4 : i32; + v168 = arith.add v319, v167 : i32 #[overflow = wrapping]; + scf.yield v168, v170; + }; + v335 = ub.poison i32 : i32; + v310 = cf.select v145, v335, v322 : i32; + v336 = ub.poison i32 : i32; + v309 = cf.select v145, v336, v320 : i32; + v266 = arith.constant 1 : u32; + v259 = arith.constant 0 : u32; + v312 = cf.select v145, v259, v266 : u32; + v300 = arith.trunc v312 : i1; + scf.condition v300, v307, v309, v308, v310, v320, v322; + } do { + ^block40(v323: i32, v324: i32, v325: i32, v326: i32, v327: i32, v328: i32): + scf.yield v323, v324, v325, v326; + }; + v334 = arith.constant 8 : u32; + v172 = hir.bitcast v317 : u32; + v174 = arith.add v172, v334 : u32 #[overflow = checked]; + v333 = arith.constant 4 : u32; + v176 = arith.mod v174, v333 : u32; + hir.assertz v176 #[code = 250]; + v177 = hir.int_to_ptr v174 : ptr; + v178 = hir.load v177 : i64; + v332 = arith.constant 8 : u32; + v179 = hir.bitcast v318 : u32; + v181 = arith.add v179, v332 : u32 #[overflow = checked]; + v331 = arith.constant 8 : u32; + v183 = arith.mod v181, v331 : u32; + hir.assertz v183 #[code = 250]; + v184 = hir.int_to_ptr v181 : ptr; + hir.store v184, v178; + v185 = hir.bitcast v317 : u32; + v330 = arith.constant 4 : u32; + v187 = arith.mod v185, v330 : u32; + hir.assertz v187 #[code = 250]; + v188 = hir.int_to_ptr v185 : ptr; + v189 = hir.load v188 : i64; + v190 = hir.bitcast v318 : u32; + v329 = arith.constant 8 : u32; + v192 = arith.mod v190, v329 : u32; + hir.assertz v192 #[code = 250]; + v193 = hir.int_to_ptr v190 : ptr; + hir.store v193, v189; + builtin.ret ; + }; + + private builtin.function @intrinsics::felt::from_u32(v194: i32) -> felt { + ^block23(v194: i32): + v195 = hir.bitcast v194 : felt; + builtin.ret v195; + }; + + private builtin.function @miden::input_note::get_metadata(v197: felt, v198: i32) { + ^block25(v197: felt, v198: i32): + v199, v200, v201, v202 = hir.exec @miden/input_note/get_metadata(v197) : felt, felt, felt, felt + v203 = hir.bitcast v198 : u32; + v204 = hir.int_to_ptr v203 : ptr; + hir.store v204, v199; + v205 = arith.constant 4 : u32; + v206 = arith.add v203, v205 : u32 #[overflow = checked]; + v207 = hir.int_to_ptr v206 : ptr; + hir.store v207, v200; + v208 = arith.constant 8 : u32; + v209 = arith.add v203, v208 : u32 #[overflow = checked]; + v210 = hir.int_to_ptr v209 : ptr; + hir.store v210, v201; + v211 = arith.constant 12 : u32; + v212 = arith.add v203, v211 : u32 #[overflow = checked]; + v213 = hir.int_to_ptr v212 : ptr; + hir.store v213, v202; + builtin.ret ; + }; + + builtin.global_variable private @#__stack_pointer : i32 { + builtin.ret_imm 1048576; + }; + + builtin.global_variable private @#GOT.data.internal.__memory_base : i32 { + builtin.ret_imm 0; + }; + + builtin.segment @1048576 = 0x0000000100000001; + }; + + public builtin.function @binding() -> felt, felt, felt, felt { + ^block29: + v214 = hir.exec @miden:rust-sdk-input-note-get-metadata-binding/rust-sdk-input-note-get-metadata-binding@0.0.1/rust_sdk_input_note_get_metadata_binding/miden:rust-sdk-input-note-get-metadata-binding/rust-sdk-input-note-get-metadata-binding@0.0.1#binding() : i32 + v215 = arith.constant 0 : i32; + v216 = arith.add v214, v215 : i32 #[overflow = unchecked]; + v349 = arith.constant 0 : i32; + v350 = arith.constant 0 : i32; + v218 = arith.add v216, v350 : i32 #[overflow = unchecked]; + v220 = arith.add v218, v349 : i32 #[overflow = unchecked]; + v221 = hir.int_to_ptr v220 : ptr; + v222 = hir.load v221 : felt; + v348 = arith.constant 0 : i32; + v223 = arith.constant 4 : i32; + v224 = arith.add v216, v223 : i32 #[overflow = unchecked]; + v226 = arith.add v224, v348 : i32 #[overflow = unchecked]; + v227 = hir.int_to_ptr v226 : ptr; + v228 = hir.load v227 : felt; + v347 = arith.constant 0 : i32; + v229 = arith.constant 8 : i32; + v230 = arith.add v216, v229 : i32 #[overflow = unchecked]; + v232 = arith.add v230, v347 : i32 #[overflow = unchecked]; + v233 = hir.int_to_ptr v232 : ptr; + v234 = hir.load v233 : felt; + v346 = arith.constant 0 : i32; + v235 = arith.constant 12 : i32; + v236 = arith.add v216, v235 : i32 #[overflow = unchecked]; + v238 = arith.add v236, v346 : i32 #[overflow = unchecked]; + v239 = hir.int_to_ptr v238 : ptr; + v240 = hir.load v239 : felt; + builtin.ret v222, v228, v234, v240; + }; +}; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_metadata_binding.masm b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_metadata_binding.masm new file mode 100644 index 000000000..21e460f93 --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_metadata_binding.masm @@ -0,0 +1,748 @@ +# mod miden:rust-sdk-input-note-get-metadata-binding/rust-sdk-input-note-get-metadata-binding@0.0.1 + +@callconv("canon-lift") +pub proc binding( + +) -> (felt, felt, felt, felt) + exec.::miden:rust-sdk-input-note-get-metadata-binding/rust-sdk-input-note-get-metadata-binding@0.0.1::init + trace.240 + nop + exec.::miden:rust-sdk-input-note-get-metadata-binding/rust-sdk-input-note-get-metadata-binding@0.0.1::rust_sdk_input_note_get_metadata_binding::miden:rust-sdk-input-note-get-metadata-binding/rust-sdk-input-note-get-metadata-binding@0.0.1#binding + trace.252 + nop + push.0 + u32wrapping_add + push.0 + push.0 + dup.2 + u32wrapping_add + u32wrapping_add + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.0 + push.4 + dup.3 + u32wrapping_add + u32wrapping_add + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.0 + push.8 + dup.4 + u32wrapping_add + u32wrapping_add + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.0 + push.12 + movup.5 + u32wrapping_add + u32wrapping_add + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + movdn.3 + swap.2 + exec.::std::sys::truncate_stack +end + +proc init + push.1179648 + trace.240 + exec.::intrinsics::mem::heap_init + trace.252 + push.[7028007876379170725,18060021366771303825,13412364500725888848,14178532912296021363] + adv.push_mapval + push.262144 + push.1 + trace.240 + exec.::std::mem::pipe_preimage_to_memory + trace.252 + drop + push.1048576 + u32assert + mem_store.278536 + push.0 + u32assert + mem_store.278537 +end + +# mod miden:rust-sdk-input-note-get-metadata-binding/rust-sdk-input-note-get-metadata-binding@0.0.1::rust_sdk_input_note_get_metadata_binding + +@callconv("C") +proc __wasm_call_ctors( + +) + nop +end + +@callconv("C") +proc rust_sdk_input_note_get_metadata_binding::bindings::__link_custom_section_describing_imports( + +) + nop +end + +@callconv("C") +proc miden:rust-sdk-input-note-get-metadata-binding/rust-sdk-input-note-get-metadata-binding@0.0.1#binding( + +) -> i32 + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.16 + u32wrapping_sub + push.1114144 + dup.1 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + trace.240 + nop + exec.::miden:rust-sdk-input-note-get-metadata-binding/rust-sdk-input-note-get-metadata-binding@0.0.1::rust_sdk_input_note_get_metadata_binding::wit_bindgen::rt::run_ctors_once + trace.252 + nop + push.0 + trace.240 + nop + exec.::miden:rust-sdk-input-note-get-metadata-binding/rust-sdk-input-note-get-metadata-binding@0.0.1::rust_sdk_input_note_get_metadata_binding::intrinsics::felt::from_u32 + trace.252 + nop + dup.1 + trace.240 + nop + exec.::miden:rust-sdk-input-note-get-metadata-binding/rust-sdk-input-note-get-metadata-binding@0.0.1::rust_sdk_input_note_get_metadata_binding::miden_base_sys::bindings::input_note::get_metadata + trace.252 + nop + push.1114148 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.1048584 + u32wrapping_add + push.8 + dup.2 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.8 + dup.3 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + dup.1 + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + dup.2 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.16 + movup.2 + u32wrapping_add + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop +end + +@callconv("C") +proc wit_bindgen::rt::run_ctors_once( + +) + push.1114148 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.1048600 + u32wrapping_add + u32divmod.4 + swap.1 + swap.1 + dup.1 + mem_load + swap.1 + push.8 + u32wrapping_mul + u32shr + swap.1 + drop + push.255 + u32and + push.0 + swap.1 + neq + if.true + nop + else + push.1114148 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + trace.240 + nop + exec.::miden:rust-sdk-input-note-get-metadata-binding/rust-sdk-input-note-get-metadata-binding@0.0.1::rust_sdk_input_note_get_metadata_binding::__wasm_call_ctors + trace.252 + nop + push.1 + push.1048600 + movup.2 + u32wrapping_add + u32divmod.4 + swap.1 + dup.0 + mem_load + dup.2 + push.8 + u32wrapping_mul + push.255 + swap.1 + u32shl + u32not + swap.1 + u32and + movup.3 + movup.3 + push.8 + u32wrapping_mul + u32shl + u32or + swap.1 + mem_store + end +end + +@callconv("C") +proc miden_base_sys::bindings::input_note::get_metadata( + i32, + felt +) + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.32 + u32wrapping_sub + push.1114144 + dup.1 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + dup.0 + movup.3 + trace.240 + nop + exec.::miden:rust-sdk-input-note-get-metadata-binding/rust-sdk-input-note-get-metadata-binding@0.0.1::rust_sdk_input_note_get_metadata_binding::miden::input_note::get_metadata + trace.252 + nop + push.8 + dup.1 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.24 + dup.3 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + dup.0 + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.16 + dup.3 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.16 + dup.1 + u32wrapping_add + movup.2 + trace.240 + nop + exec.::miden:rust-sdk-input-note-get-metadata-binding/rust-sdk-input-note-get-metadata-binding@0.0.1::rust_sdk_input_note_get_metadata_binding::miden_stdlib_sys::intrinsics::word::Word::reverse + trace.252 + nop + push.32 + u32wrapping_add + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop +end + +@callconv("C") +proc miden_stdlib_sys::intrinsics::word::Word::reverse( + i32, + i32 +) + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.16 + u32wrapping_sub + push.8 + dup.3 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.8 + dup.3 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + movup.2 + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + dup.2 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.12 + dup.1 + u32wrapping_add + push.0 + movup.2 + swap.1 + push.1 + while.true + push.0 + push.8 + dup.2 + eq + neq + dup.0 + if.true + movup.3 + movup.2 + drop + drop + push.3735929054 + dup.0 + else + dup.2 + dup.2 + u32wrapping_add + dup.0 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + dup.5 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + movup.2 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + dup.4 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.4294967292 + movup.4 + u32wrapping_add + push.4 + movup.3 + u32wrapping_add + end + push.3735929054 + dup.3 + dup.6 + swap.2 + swap.1 + cdrop + push.3735929054 + dup.4 + dup.6 + swap.2 + swap.1 + cdrop + push.1 + push.0 + movup.6 + cdrop + push.1 + u32and + swap.1 + swap.2 + swap.4 + swap.3 + swap.1 + if.true + movup.4 + drop + movup.4 + drop + push.1 + else + push.0 + end + end + drop + drop + drop + drop + push.8 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.8 + dup.4 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + movup.2 + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop +end + +@callconv("C") +proc intrinsics::felt::from_u32(i32) -> felt + nop +end + +@callconv("C") +proc miden::input_note::get_metadata(felt, i32) + trace.240 + nop + exec.::miden::input_note::get_metadata + trace.252 + nop + movup.4 + dup.0 + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.4 + dup.1 + add + u32assert + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.8 + dup.1 + add + u32assert + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.12 + add + u32assert + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop +end + diff --git a/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_metadata_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_metadata_binding.wat new file mode 100644 index 000000000..141cba7d0 --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_metadata_binding.wat @@ -0,0 +1,199 @@ +(component + (type (;0;) + (instance + (type (;0;) (record (field "inner" f32))) + (export (;1;) "felt" (type (eq 0))) + (type (;2;) (tuple 1 1 1 1)) + (type (;3;) (record (field "inner" 2))) + (export (;4;) "word" (type (eq 3))) + ) + ) + (import "miden:base/core-types@1.0.0" (instance (;0;) (type 0))) + (core module (;0;) + (type (;0;) (func)) + (type (;1;) (func (result i32))) + (type (;2;) (func (param i32 f32))) + (type (;3;) (func (param i32 i32))) + (type (;4;) (func (param i32) (result f32))) + (type (;5;) (func (param f32 i32))) + (table (;0;) 2 2 funcref) + (memory (;0;) 17) + (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) + (global $GOT.data.internal.__memory_base (;1;) i32 i32.const 0) + (export "memory" (memory 0)) + (export "miden:rust-sdk-input-note-get-metadata-binding/rust-sdk-input-note-get-metadata-binding@0.0.1#binding" (func $miden:rust-sdk-input-note-get-metadata-binding/rust-sdk-input-note-get-metadata-binding@0.0.1#binding)) + (elem (;0;) (i32.const 1) func $rust_sdk_input_note_get_metadata_binding::bindings::__link_custom_section_describing_imports) + (func $__wasm_call_ctors (;0;) (type 0)) + (func $rust_sdk_input_note_get_metadata_binding::bindings::__link_custom_section_describing_imports (;1;) (type 0)) + (func $miden:rust-sdk-input-note-get-metadata-binding/rust-sdk-input-note-get-metadata-binding@0.0.1#binding (;2;) (type 1) (result i32) + (local i32 i32) + global.get $__stack_pointer + i32.const 16 + i32.sub + local.tee 0 + global.set $__stack_pointer + call $wit_bindgen::rt::run_ctors_once + local.get 0 + i32.const 0 + call $intrinsics::felt::from_u32 + call $miden_base_sys::bindings::input_note::get_metadata + global.get $GOT.data.internal.__memory_base + i32.const 1048584 + i32.add + local.tee 1 + local.get 0 + i64.load offset=8 + i64.store offset=8 align=4 + local.get 1 + local.get 0 + i64.load + i64.store align=4 + local.get 0 + i32.const 16 + i32.add + global.set $__stack_pointer + local.get 1 + ) + (func $wit_bindgen::rt::run_ctors_once (;3;) (type 0) + (local i32) + block ;; label = @1 + global.get $GOT.data.internal.__memory_base + i32.const 1048600 + i32.add + i32.load8_u + br_if 0 (;@1;) + global.get $GOT.data.internal.__memory_base + local.set 0 + call $__wasm_call_ctors + local.get 0 + i32.const 1048600 + i32.add + i32.const 1 + i32.store8 + end + ) + (func $miden_base_sys::bindings::input_note::get_metadata (;4;) (type 2) (param i32 f32) + (local i32) + global.get $__stack_pointer + i32.const 32 + i32.sub + local.tee 2 + global.set $__stack_pointer + local.get 1 + local.get 2 + call $miden::input_note::get_metadata + local.get 2 + local.get 2 + i64.load offset=8 + i64.store offset=24 + local.get 2 + local.get 2 + i64.load + i64.store offset=16 + local.get 0 + local.get 2 + i32.const 16 + i32.add + call $miden_stdlib_sys::intrinsics::word::Word::reverse + local.get 2 + i32.const 32 + i32.add + global.set $__stack_pointer + ) + (func $miden_stdlib_sys::intrinsics::word::Word::reverse (;5;) (type 3) (param i32 i32) + (local i32 i32 i32 f32) + global.get $__stack_pointer + i32.const 16 + i32.sub + local.tee 2 + local.get 1 + i64.load offset=8 + i64.store offset=8 align=4 + local.get 2 + local.get 1 + i64.load + i64.store align=4 + local.get 2 + i32.const 12 + i32.add + local.set 3 + i32.const 0 + local.set 1 + block ;; label = @1 + loop ;; label = @2 + local.get 1 + i32.const 8 + i32.eq + br_if 1 (;@1;) + local.get 2 + local.get 1 + i32.add + local.tee 4 + f32.load + local.set 5 + local.get 4 + local.get 3 + i32.load + i32.store + local.get 3 + local.get 5 + f32.store + local.get 1 + i32.const 4 + i32.add + local.set 1 + local.get 3 + i32.const -4 + i32.add + local.set 3 + br 0 (;@2;) + end + end + local.get 0 + local.get 2 + i64.load offset=8 align=4 + i64.store offset=8 + local.get 0 + local.get 2 + i64.load align=4 + i64.store + ) + (func $intrinsics::felt::from_u32 (;6;) (type 4) (param i32) (result f32) + unreachable + ) + (func $miden::input_note::get_metadata (;7;) (type 5) (param f32 i32) + unreachable + ) + (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") + (@custom "rodata,miden_account" (after data) "Qrust_sdk_input_note_get_metadata_binding\01\0b0.0.1\03\01\01\00\00\00\00\00\00\00\00\00\00\00\00\00") + ) + (alias export 0 "word" (type (;1;))) + (core instance (;0;) (instantiate 0)) + (alias core export 0 "memory" (core memory (;0;))) + (type (;2;) (func (result 1))) + (alias core export 0 "miden:rust-sdk-input-note-get-metadata-binding/rust-sdk-input-note-get-metadata-binding@0.0.1#binding" (core func (;0;))) + (func (;0;) (type 2) (canon lift (core func 0) (memory 0))) + (alias export 0 "felt" (type (;3;))) + (alias export 0 "word" (type (;4;))) + (component (;0;) + (type (;0;) (record (field "inner" f32))) + (import "import-type-felt" (type (;1;) (eq 0))) + (type (;2;) (tuple 1 1 1 1)) + (type (;3;) (record (field "inner" 2))) + (import "import-type-word" (type (;4;) (eq 3))) + (import "import-type-word0" (type (;5;) (eq 4))) + (type (;6;) (func (result 5))) + (import "import-func-binding" (func (;0;) (type 6))) + (export (;7;) "word" (type 4)) + (type (;8;) (func (result 7))) + (export (;1;) "binding" (func 0) (func (type 8))) + ) + (instance (;1;) (instantiate 0 + (with "import-func-binding" (func 0)) + (with "import-type-felt" (type 3)) + (with "import-type-word" (type 4)) + (with "import-type-word0" (type 1)) + ) + ) + (export (;2;) "miden:rust-sdk-input-note-get-metadata-binding/rust-sdk-input-note-get-metadata-binding@0.0.1" (instance 1)) +) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_recipient_binding.hir b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_recipient_binding.hir new file mode 100644 index 000000000..73dab4998 --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_recipient_binding.hir @@ -0,0 +1,400 @@ +builtin.component miden:rust-sdk-input-note-get-recipient-binding/rust-sdk-input-note-get-recipient-binding@0.0.1 { + builtin.module public @rust_sdk_input_note_get_recipient_binding { + private builtin.function @__wasm_call_ctors() { + ^block5: + builtin.ret ; + }; + + private builtin.function @rust_sdk_input_note_get_recipient_binding::bindings::__link_custom_section_describing_imports() { + ^block7: + builtin.ret ; + }; + + private builtin.function @miden:rust-sdk-input-note-get-recipient-binding/rust-sdk-input-note-get-recipient-binding@0.0.1#binding() -> i32 { + ^block9: + v2 = builtin.global_symbol @miden:rust-sdk-input-note-get-recipient-binding/rust-sdk-input-note-get-recipient-binding@0.0.1/rust_sdk_input_note_get_recipient_binding/__stack_pointer : ptr + v3 = hir.bitcast v2 : ptr; + v4 = hir.load v3 : i32; + v5 = arith.constant 16 : i32; + v6 = arith.sub v4, v5 : i32 #[overflow = wrapping]; + v7 = builtin.global_symbol @miden:rust-sdk-input-note-get-recipient-binding/rust-sdk-input-note-get-recipient-binding@0.0.1/rust_sdk_input_note_get_recipient_binding/__stack_pointer : ptr + v8 = hir.bitcast v7 : ptr; + hir.store v8, v6; + hir.exec @miden:rust-sdk-input-note-get-recipient-binding/rust-sdk-input-note-get-recipient-binding@0.0.1/rust_sdk_input_note_get_recipient_binding/wit_bindgen::rt::run_ctors_once() + v1 = arith.constant 0 : i32; + v10 = hir.exec @miden:rust-sdk-input-note-get-recipient-binding/rust-sdk-input-note-get-recipient-binding@0.0.1/rust_sdk_input_note_get_recipient_binding/intrinsics::felt::from_u32(v1) : felt + hir.exec @miden:rust-sdk-input-note-get-recipient-binding/rust-sdk-input-note-get-recipient-binding@0.0.1/rust_sdk_input_note_get_recipient_binding/miden_base_sys::bindings::input_note::get_recipient(v6, v10) + v11 = builtin.global_symbol @miden:rust-sdk-input-note-get-recipient-binding/rust-sdk-input-note-get-recipient-binding@0.0.1/rust_sdk_input_note_get_recipient_binding/GOT.data.internal.__memory_base : ptr + v12 = hir.bitcast v11 : ptr; + v13 = hir.load v12 : i32; + v14 = arith.constant 1048584 : i32; + v15 = arith.add v13, v14 : i32 #[overflow = wrapping]; + v17 = arith.constant 8 : u32; + v16 = hir.bitcast v6 : u32; + v18 = arith.add v16, v17 : u32 #[overflow = checked]; + v290 = arith.constant 8 : u32; + v20 = arith.mod v18, v290 : u32; + hir.assertz v20 #[code = 250]; + v21 = hir.int_to_ptr v18 : ptr; + v22 = hir.load v21 : i64; + v289 = arith.constant 8 : u32; + v23 = hir.bitcast v15 : u32; + v25 = arith.add v23, v289 : u32 #[overflow = checked]; + v26 = arith.constant 4 : u32; + v27 = arith.mod v25, v26 : u32; + hir.assertz v27 #[code = 250]; + v28 = hir.int_to_ptr v25 : ptr; + hir.store v28, v22; + v29 = hir.bitcast v6 : u32; + v288 = arith.constant 8 : u32; + v31 = arith.mod v29, v288 : u32; + hir.assertz v31 #[code = 250]; + v32 = hir.int_to_ptr v29 : ptr; + v33 = hir.load v32 : i64; + v34 = hir.bitcast v15 : u32; + v287 = arith.constant 4 : u32; + v36 = arith.mod v34, v287 : u32; + hir.assertz v36 #[code = 250]; + v37 = hir.int_to_ptr v34 : ptr; + hir.store v37, v33; + v286 = arith.constant 16 : i32; + v39 = arith.add v6, v286 : i32 #[overflow = wrapping]; + v40 = builtin.global_symbol @miden:rust-sdk-input-note-get-recipient-binding/rust-sdk-input-note-get-recipient-binding@0.0.1/rust_sdk_input_note_get_recipient_binding/__stack_pointer : ptr + v41 = hir.bitcast v40 : ptr; + hir.store v41, v39; + builtin.ret v15; + }; + + private builtin.function @wit_bindgen::rt::run_ctors_once() { + ^block11: + v43 = builtin.global_symbol @miden:rust-sdk-input-note-get-recipient-binding/rust-sdk-input-note-get-recipient-binding@0.0.1/rust_sdk_input_note_get_recipient_binding/GOT.data.internal.__memory_base : ptr + v44 = hir.bitcast v43 : ptr; + v45 = hir.load v44 : i32; + v46 = arith.constant 1048600 : i32; + v47 = arith.add v45, v46 : i32 #[overflow = wrapping]; + v48 = hir.bitcast v47 : u32; + v49 = hir.int_to_ptr v48 : ptr; + v50 = hir.load v49 : u8; + v42 = arith.constant 0 : i32; + v51 = arith.zext v50 : u32; + v52 = hir.bitcast v51 : i32; + v54 = arith.neq v52, v42 : i1; + scf.if v54{ + ^block13: + scf.yield ; + } else { + ^block14: + v55 = builtin.global_symbol @miden:rust-sdk-input-note-get-recipient-binding/rust-sdk-input-note-get-recipient-binding@0.0.1/rust_sdk_input_note_get_recipient_binding/GOT.data.internal.__memory_base : ptr + v56 = hir.bitcast v55 : ptr; + v57 = hir.load v56 : i32; + hir.exec @miden:rust-sdk-input-note-get-recipient-binding/rust-sdk-input-note-get-recipient-binding@0.0.1/rust_sdk_input_note_get_recipient_binding/__wasm_call_ctors() + v292 = arith.constant 1 : u8; + v294 = arith.constant 1048600 : i32; + v59 = arith.add v57, v294 : i32 #[overflow = wrapping]; + v63 = hir.bitcast v59 : u32; + v64 = hir.int_to_ptr v63 : ptr; + hir.store v64, v292; + scf.yield ; + }; + builtin.ret ; + }; + + private builtin.function @miden_base_sys::bindings::input_note::get_recipient(v65: i32, v66: felt) { + ^block15(v65: i32, v66: felt): + v69 = builtin.global_symbol @miden:rust-sdk-input-note-get-recipient-binding/rust-sdk-input-note-get-recipient-binding@0.0.1/rust_sdk_input_note_get_recipient_binding/__stack_pointer : ptr + v70 = hir.bitcast v69 : ptr; + v71 = hir.load v70 : i32; + v72 = arith.constant 48 : i32; + v73 = arith.sub v71, v72 : i32 #[overflow = wrapping]; + v74 = builtin.global_symbol @miden:rust-sdk-input-note-get-recipient-binding/rust-sdk-input-note-get-recipient-binding@0.0.1/rust_sdk_input_note_get_recipient_binding/__stack_pointer : ptr + v75 = hir.bitcast v74 : ptr; + hir.store v75, v73; + hir.exec @miden:rust-sdk-input-note-get-recipient-binding/rust-sdk-input-note-get-recipient-binding@0.0.1/rust_sdk_input_note_get_recipient_binding/miden::input_note::get_recipient(v66, v73) + v77 = arith.constant 8 : u32; + v76 = hir.bitcast v73 : u32; + v78 = arith.add v76, v77 : u32 #[overflow = checked]; + v307 = arith.constant 8 : u32; + v80 = arith.mod v78, v307 : u32; + hir.assertz v80 #[code = 250]; + v81 = hir.int_to_ptr v78 : ptr; + v82 = hir.load v81 : i64; + v84 = arith.constant 24 : u32; + v83 = hir.bitcast v73 : u32; + v85 = arith.add v83, v84 : u32 #[overflow = checked]; + v306 = arith.constant 8 : u32; + v87 = arith.mod v85, v306 : u32; + hir.assertz v87 #[code = 250]; + v88 = hir.int_to_ptr v85 : ptr; + hir.store v88, v82; + v89 = hir.bitcast v73 : u32; + v305 = arith.constant 8 : u32; + v91 = arith.mod v89, v305 : u32; + hir.assertz v91 #[code = 250]; + v92 = hir.int_to_ptr v89 : ptr; + v93 = hir.load v92 : i64; + v95 = arith.constant 16 : u32; + v94 = hir.bitcast v73 : u32; + v96 = arith.add v94, v95 : u32 #[overflow = checked]; + v304 = arith.constant 8 : u32; + v98 = arith.mod v96, v304 : u32; + hir.assertz v98 #[code = 250]; + v99 = hir.int_to_ptr v96 : ptr; + hir.store v99, v93; + v102 = arith.constant 16 : i32; + v103 = arith.add v73, v102 : i32 #[overflow = wrapping]; + v100 = arith.constant 32 : i32; + v101 = arith.add v73, v100 : i32 #[overflow = wrapping]; + hir.exec @miden:rust-sdk-input-note-get-recipient-binding/rust-sdk-input-note-get-recipient-binding@0.0.1/rust_sdk_input_note_get_recipient_binding/miden_stdlib_sys::intrinsics::word::Word::reverse(v101, v103) + v105 = arith.constant 40 : u32; + v104 = hir.bitcast v73 : u32; + v106 = arith.add v104, v105 : u32 #[overflow = checked]; + v303 = arith.constant 8 : u32; + v108 = arith.mod v106, v303 : u32; + hir.assertz v108 #[code = 250]; + v109 = hir.int_to_ptr v106 : ptr; + v110 = hir.load v109 : i64; + v302 = arith.constant 24 : u32; + v111 = hir.bitcast v73 : u32; + v113 = arith.add v111, v302 : u32 #[overflow = checked]; + v301 = arith.constant 8 : u32; + v115 = arith.mod v113, v301 : u32; + hir.assertz v115 #[code = 250]; + v116 = hir.int_to_ptr v113 : ptr; + hir.store v116, v110; + v118 = arith.constant 32 : u32; + v117 = hir.bitcast v73 : u32; + v119 = arith.add v117, v118 : u32 #[overflow = checked]; + v300 = arith.constant 8 : u32; + v121 = arith.mod v119, v300 : u32; + hir.assertz v121 #[code = 250]; + v122 = hir.int_to_ptr v119 : ptr; + v123 = hir.load v122 : i64; + v299 = arith.constant 16 : u32; + v124 = hir.bitcast v73 : u32; + v126 = arith.add v124, v299 : u32 #[overflow = checked]; + v298 = arith.constant 8 : u32; + v128 = arith.mod v126, v298 : u32; + hir.assertz v128 #[code = 250]; + v129 = hir.int_to_ptr v126 : ptr; + hir.store v129, v123; + v130 = arith.constant 8 : i32; + v131 = arith.add v65, v130 : i32 #[overflow = wrapping]; + v132 = hir.bitcast v131 : u32; + v297 = arith.constant 8 : u32; + v134 = arith.mod v132, v297 : u32; + hir.assertz v134 #[code = 250]; + v135 = hir.int_to_ptr v132 : ptr; + hir.store v135, v110; + v136 = hir.bitcast v65 : u32; + v296 = arith.constant 8 : u32; + v138 = arith.mod v136, v296 : u32; + hir.assertz v138 #[code = 250]; + v139 = hir.int_to_ptr v136 : ptr; + hir.store v139, v123; + v295 = arith.constant 48 : i32; + v141 = arith.add v73, v295 : i32 #[overflow = wrapping]; + v142 = builtin.global_symbol @miden:rust-sdk-input-note-get-recipient-binding/rust-sdk-input-note-get-recipient-binding@0.0.1/rust_sdk_input_note_get_recipient_binding/__stack_pointer : ptr + v143 = hir.bitcast v142 : ptr; + hir.store v143, v141; + builtin.ret ; + }; + + private builtin.function @miden_stdlib_sys::intrinsics::word::Word::reverse(v144: i32, v145: i32) { + ^block17(v144: i32, v145: i32): + v148 = builtin.global_symbol @miden:rust-sdk-input-note-get-recipient-binding/rust-sdk-input-note-get-recipient-binding@0.0.1/rust_sdk_input_note_get_recipient_binding/__stack_pointer : ptr + v149 = hir.bitcast v148 : ptr; + v150 = hir.load v149 : i32; + v151 = arith.constant 16 : i32; + v152 = arith.sub v150, v151 : i32 #[overflow = wrapping]; + v154 = arith.constant 8 : u32; + v153 = hir.bitcast v145 : u32; + v155 = arith.add v153, v154 : u32 #[overflow = checked]; + v394 = arith.constant 8 : u32; + v157 = arith.mod v155, v394 : u32; + hir.assertz v157 #[code = 250]; + v158 = hir.int_to_ptr v155 : ptr; + v159 = hir.load v158 : i64; + v393 = arith.constant 8 : u32; + v160 = hir.bitcast v152 : u32; + v162 = arith.add v160, v393 : u32 #[overflow = checked]; + v163 = arith.constant 4 : u32; + v164 = arith.mod v162, v163 : u32; + hir.assertz v164 #[code = 250]; + v165 = hir.int_to_ptr v162 : ptr; + hir.store v165, v159; + v166 = hir.bitcast v145 : u32; + v392 = arith.constant 8 : u32; + v168 = arith.mod v166, v392 : u32; + hir.assertz v168 #[code = 250]; + v169 = hir.int_to_ptr v166 : ptr; + v170 = hir.load v169 : i64; + v171 = hir.bitcast v152 : u32; + v391 = arith.constant 4 : u32; + v173 = arith.mod v171, v391 : u32; + hir.assertz v173 #[code = 250]; + v174 = hir.int_to_ptr v171 : ptr; + hir.store v174, v170; + v175 = arith.constant 12 : i32; + v176 = arith.add v152, v175 : i32 #[overflow = wrapping]; + v146 = arith.constant 0 : i32; + v362, v363, v364, v365, v366, v367 = scf.while v146, v152, v176, v144 : i32, i32, i32, i32, i32, i32 { + ^block39(v368: i32, v369: i32, v370: i32, v371: i32): + v390 = arith.constant 0 : i32; + v179 = arith.constant 8 : i32; + v180 = arith.eq v368, v179 : i1; + v181 = arith.zext v180 : u32; + v182 = hir.bitcast v181 : i32; + v184 = arith.neq v182, v390 : i1; + v356, v357 = scf.if v184 : i32, i32 { + ^block38: + v316 = ub.poison i32 : i32; + scf.yield v316, v316; + } else { + ^block22: + v186 = arith.add v369, v368 : i32 #[overflow = wrapping]; + v187 = hir.bitcast v186 : u32; + v389 = arith.constant 4 : u32; + v189 = arith.mod v187, v389 : u32; + hir.assertz v189 #[code = 250]; + v190 = hir.int_to_ptr v187 : ptr; + v191 = hir.load v190 : felt; + v193 = hir.bitcast v370 : u32; + v388 = arith.constant 4 : u32; + v195 = arith.mod v193, v388 : u32; + hir.assertz v195 #[code = 250]; + v196 = hir.int_to_ptr v193 : ptr; + v197 = hir.load v196 : i32; + v198 = hir.bitcast v186 : u32; + v387 = arith.constant 4 : u32; + v200 = arith.mod v198, v387 : u32; + hir.assertz v200 #[code = 250]; + v201 = hir.int_to_ptr v198 : ptr; + hir.store v201, v197; + v202 = hir.bitcast v370 : u32; + v386 = arith.constant 4 : u32; + v204 = arith.mod v202, v386 : u32; + hir.assertz v204 #[code = 250]; + v205 = hir.int_to_ptr v202 : ptr; + hir.store v205, v191; + v208 = arith.constant -4 : i32; + v209 = arith.add v370, v208 : i32 #[overflow = wrapping]; + v206 = arith.constant 4 : i32; + v207 = arith.add v368, v206 : i32 #[overflow = wrapping]; + scf.yield v207, v209; + }; + v384 = ub.poison i32 : i32; + v359 = cf.select v184, v384, v371 : i32; + v385 = ub.poison i32 : i32; + v358 = cf.select v184, v385, v369 : i32; + v315 = arith.constant 1 : u32; + v308 = arith.constant 0 : u32; + v361 = cf.select v184, v308, v315 : u32; + v349 = arith.trunc v361 : i1; + scf.condition v349, v356, v358, v357, v359, v369, v371; + } do { + ^block40(v372: i32, v373: i32, v374: i32, v375: i32, v376: i32, v377: i32): + scf.yield v372, v373, v374, v375; + }; + v383 = arith.constant 8 : u32; + v211 = hir.bitcast v366 : u32; + v213 = arith.add v211, v383 : u32 #[overflow = checked]; + v382 = arith.constant 4 : u32; + v215 = arith.mod v213, v382 : u32; + hir.assertz v215 #[code = 250]; + v216 = hir.int_to_ptr v213 : ptr; + v217 = hir.load v216 : i64; + v381 = arith.constant 8 : u32; + v218 = hir.bitcast v367 : u32; + v220 = arith.add v218, v381 : u32 #[overflow = checked]; + v380 = arith.constant 8 : u32; + v222 = arith.mod v220, v380 : u32; + hir.assertz v222 #[code = 250]; + v223 = hir.int_to_ptr v220 : ptr; + hir.store v223, v217; + v224 = hir.bitcast v366 : u32; + v379 = arith.constant 4 : u32; + v226 = arith.mod v224, v379 : u32; + hir.assertz v226 #[code = 250]; + v227 = hir.int_to_ptr v224 : ptr; + v228 = hir.load v227 : i64; + v229 = hir.bitcast v367 : u32; + v378 = arith.constant 8 : u32; + v231 = arith.mod v229, v378 : u32; + hir.assertz v231 #[code = 250]; + v232 = hir.int_to_ptr v229 : ptr; + hir.store v232, v228; + builtin.ret ; + }; + + private builtin.function @intrinsics::felt::from_u32(v233: i32) -> felt { + ^block23(v233: i32): + v234 = hir.bitcast v233 : felt; + builtin.ret v234; + }; + + private builtin.function @miden::input_note::get_recipient(v236: felt, v237: i32) { + ^block25(v236: felt, v237: i32): + v238, v239, v240, v241 = hir.exec @miden/input_note/get_recipient(v236) : felt, felt, felt, felt + v242 = hir.bitcast v237 : u32; + v243 = hir.int_to_ptr v242 : ptr; + hir.store v243, v238; + v244 = arith.constant 4 : u32; + v245 = arith.add v242, v244 : u32 #[overflow = checked]; + v246 = hir.int_to_ptr v245 : ptr; + hir.store v246, v239; + v247 = arith.constant 8 : u32; + v248 = arith.add v242, v247 : u32 #[overflow = checked]; + v249 = hir.int_to_ptr v248 : ptr; + hir.store v249, v240; + v250 = arith.constant 12 : u32; + v251 = arith.add v242, v250 : u32 #[overflow = checked]; + v252 = hir.int_to_ptr v251 : ptr; + hir.store v252, v241; + builtin.ret ; + }; + + builtin.global_variable private @#__stack_pointer : i32 { + builtin.ret_imm 1048576; + }; + + builtin.global_variable private @#GOT.data.internal.__memory_base : i32 { + builtin.ret_imm 0; + }; + + builtin.segment @1048576 = 0x0000000100000001; + }; + + public builtin.function @binding() -> felt, felt, felt, felt { + ^block29: + v253 = hir.exec @miden:rust-sdk-input-note-get-recipient-binding/rust-sdk-input-note-get-recipient-binding@0.0.1/rust_sdk_input_note_get_recipient_binding/miden:rust-sdk-input-note-get-recipient-binding/rust-sdk-input-note-get-recipient-binding@0.0.1#binding() : i32 + v400 = arith.constant 0 : i32; + v254 = arith.constant 0 : i32; + v255 = arith.add v253, v254 : i32 #[overflow = unchecked]; + v257 = arith.add v255, v400 : i32 #[overflow = unchecked]; + v398 = arith.constant 0 : i32; + v399 = arith.constant 0 : i32; + v259 = arith.add v257, v399 : i32 #[overflow = unchecked]; + v261 = arith.add v259, v398 : i32 #[overflow = unchecked]; + v262 = hir.int_to_ptr v261 : ptr; + v263 = hir.load v262 : felt; + v397 = arith.constant 0 : i32; + v264 = arith.constant 4 : i32; + v265 = arith.add v257, v264 : i32 #[overflow = unchecked]; + v267 = arith.add v265, v397 : i32 #[overflow = unchecked]; + v268 = hir.int_to_ptr v267 : ptr; + v269 = hir.load v268 : felt; + v396 = arith.constant 0 : i32; + v270 = arith.constant 8 : i32; + v271 = arith.add v257, v270 : i32 #[overflow = unchecked]; + v273 = arith.add v271, v396 : i32 #[overflow = unchecked]; + v274 = hir.int_to_ptr v273 : ptr; + v275 = hir.load v274 : felt; + v395 = arith.constant 0 : i32; + v276 = arith.constant 12 : i32; + v277 = arith.add v257, v276 : i32 #[overflow = unchecked]; + v279 = arith.add v277, v395 : i32 #[overflow = unchecked]; + v280 = hir.int_to_ptr v279 : ptr; + v281 = hir.load v280 : felt; + builtin.ret v263, v269, v275, v281; + }; +}; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_recipient_binding.masm b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_recipient_binding.masm new file mode 100644 index 000000000..9d5bed474 --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_recipient_binding.masm @@ -0,0 +1,860 @@ +# mod miden:rust-sdk-input-note-get-recipient-binding/rust-sdk-input-note-get-recipient-binding@0.0.1 + +@callconv("canon-lift") +pub proc binding( + +) -> (felt, felt, felt, felt) + exec.::miden:rust-sdk-input-note-get-recipient-binding/rust-sdk-input-note-get-recipient-binding@0.0.1::init + trace.240 + nop + exec.::miden:rust-sdk-input-note-get-recipient-binding/rust-sdk-input-note-get-recipient-binding@0.0.1::rust_sdk_input_note_get_recipient_binding::miden:rust-sdk-input-note-get-recipient-binding/rust-sdk-input-note-get-recipient-binding@0.0.1#binding + trace.252 + nop + push.0 + push.0 + movup.2 + u32wrapping_add + u32wrapping_add + push.0 + push.0 + dup.2 + u32wrapping_add + u32wrapping_add + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.0 + push.4 + dup.3 + u32wrapping_add + u32wrapping_add + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.0 + push.8 + dup.4 + u32wrapping_add + u32wrapping_add + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.0 + push.12 + movup.5 + u32wrapping_add + u32wrapping_add + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + movdn.3 + swap.2 + exec.::std::sys::truncate_stack +end + +proc init + push.1179648 + trace.240 + exec.::intrinsics::mem::heap_init + trace.252 + push.[7028007876379170725,18060021366771303825,13412364500725888848,14178532912296021363] + adv.push_mapval + push.262144 + push.1 + trace.240 + exec.::std::mem::pipe_preimage_to_memory + trace.252 + drop + push.1048576 + u32assert + mem_store.278536 + push.0 + u32assert + mem_store.278537 +end + +# mod miden:rust-sdk-input-note-get-recipient-binding/rust-sdk-input-note-get-recipient-binding@0.0.1::rust_sdk_input_note_get_recipient_binding + +@callconv("C") +proc __wasm_call_ctors( + +) + nop +end + +@callconv("C") +proc rust_sdk_input_note_get_recipient_binding::bindings::__link_custom_section_describing_imports( + +) + nop +end + +@callconv("C") +proc miden:rust-sdk-input-note-get-recipient-binding/rust-sdk-input-note-get-recipient-binding@0.0.1#binding( + +) -> i32 + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.16 + u32wrapping_sub + push.1114144 + dup.1 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + trace.240 + nop + exec.::miden:rust-sdk-input-note-get-recipient-binding/rust-sdk-input-note-get-recipient-binding@0.0.1::rust_sdk_input_note_get_recipient_binding::wit_bindgen::rt::run_ctors_once + trace.252 + nop + push.0 + trace.240 + nop + exec.::miden:rust-sdk-input-note-get-recipient-binding/rust-sdk-input-note-get-recipient-binding@0.0.1::rust_sdk_input_note_get_recipient_binding::intrinsics::felt::from_u32 + trace.252 + nop + dup.1 + trace.240 + nop + exec.::miden:rust-sdk-input-note-get-recipient-binding/rust-sdk-input-note-get-recipient-binding@0.0.1::rust_sdk_input_note_get_recipient_binding::miden_base_sys::bindings::input_note::get_recipient + trace.252 + nop + push.1114148 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.1048584 + u32wrapping_add + push.8 + dup.2 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.8 + dup.3 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + dup.1 + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + dup.2 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.16 + movup.2 + u32wrapping_add + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop +end + +@callconv("C") +proc wit_bindgen::rt::run_ctors_once( + +) + push.1114148 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.1048600 + u32wrapping_add + u32divmod.4 + swap.1 + swap.1 + dup.1 + mem_load + swap.1 + push.8 + u32wrapping_mul + u32shr + swap.1 + drop + push.255 + u32and + push.0 + swap.1 + neq + if.true + nop + else + push.1114148 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + trace.240 + nop + exec.::miden:rust-sdk-input-note-get-recipient-binding/rust-sdk-input-note-get-recipient-binding@0.0.1::rust_sdk_input_note_get_recipient_binding::__wasm_call_ctors + trace.252 + nop + push.1 + push.1048600 + movup.2 + u32wrapping_add + u32divmod.4 + swap.1 + dup.0 + mem_load + dup.2 + push.8 + u32wrapping_mul + push.255 + swap.1 + u32shl + u32not + swap.1 + u32and + movup.3 + movup.3 + push.8 + u32wrapping_mul + u32shl + u32or + swap.1 + mem_store + end +end + +@callconv("C") +proc miden_base_sys::bindings::input_note::get_recipient( + i32, + felt +) + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.48 + u32wrapping_sub + push.1114144 + dup.1 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + dup.0 + movup.3 + trace.240 + nop + exec.::miden:rust-sdk-input-note-get-recipient-binding/rust-sdk-input-note-get-recipient-binding@0.0.1::rust_sdk_input_note_get_recipient_binding::miden::input_note::get_recipient + trace.252 + nop + push.8 + dup.1 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.24 + dup.3 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + dup.0 + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.16 + dup.3 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.16 + dup.1 + u32wrapping_add + push.32 + dup.2 + u32wrapping_add + trace.240 + nop + exec.::miden:rust-sdk-input-note-get-recipient-binding/rust-sdk-input-note-get-recipient-binding@0.0.1::rust_sdk_input_note_get_recipient_binding::miden_stdlib_sys::intrinsics::word::Word::reverse + trace.252 + nop + push.40 + dup.1 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.24 + dup.3 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + dup.2 + dup.2 + movup.2 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.32 + dup.3 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.16 + dup.5 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + dup.2 + dup.2 + movup.2 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.8 + dup.6 + u32wrapping_add + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + movup.4 + movup.4 + movup.2 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + movup.3 + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.48 + u32wrapping_add + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop +end + +@callconv("C") +proc miden_stdlib_sys::intrinsics::word::Word::reverse( + i32, + i32 +) + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.16 + u32wrapping_sub + push.8 + dup.3 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.8 + dup.3 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + movup.2 + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + dup.2 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.12 + dup.1 + u32wrapping_add + push.0 + movup.2 + swap.1 + push.1 + while.true + push.0 + push.8 + dup.2 + eq + neq + dup.0 + if.true + movup.3 + movup.2 + drop + drop + push.3735929054 + dup.0 + else + dup.2 + dup.2 + u32wrapping_add + dup.0 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + dup.5 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + movup.2 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + dup.4 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.4294967292 + movup.4 + u32wrapping_add + push.4 + movup.3 + u32wrapping_add + end + push.3735929054 + dup.3 + dup.6 + swap.2 + swap.1 + cdrop + push.3735929054 + dup.4 + dup.6 + swap.2 + swap.1 + cdrop + push.1 + push.0 + movup.6 + cdrop + push.1 + u32and + swap.1 + swap.2 + swap.4 + swap.3 + swap.1 + if.true + movup.4 + drop + movup.4 + drop + push.1 + else + push.0 + end + end + drop + drop + drop + drop + push.8 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.8 + dup.4 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + movup.2 + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop +end + +@callconv("C") +proc intrinsics::felt::from_u32(i32) -> felt + nop +end + +@callconv("C") +proc miden::input_note::get_recipient(felt, i32) + trace.240 + nop + exec.::miden::input_note::get_recipient + trace.252 + nop + movup.4 + dup.0 + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.4 + dup.1 + add + u32assert + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.8 + dup.1 + add + u32assert + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.12 + add + u32assert + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop +end + diff --git a/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_recipient_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_recipient_binding.wat new file mode 100644 index 000000000..04a47d9d9 --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_recipient_binding.wat @@ -0,0 +1,225 @@ +(component + (type (;0;) + (instance + (type (;0;) (record (field "inner" f32))) + (export (;1;) "felt" (type (eq 0))) + (type (;2;) (tuple 1 1 1 1)) + (type (;3;) (record (field "inner" 2))) + (export (;4;) "word" (type (eq 3))) + (type (;5;) (record (field "inner" 4))) + (export (;6;) "recipient" (type (eq 5))) + ) + ) + (import "miden:base/core-types@1.0.0" (instance (;0;) (type 0))) + (core module (;0;) + (type (;0;) (func)) + (type (;1;) (func (result i32))) + (type (;2;) (func (param i32 f32))) + (type (;3;) (func (param i32 i32))) + (type (;4;) (func (param i32) (result f32))) + (type (;5;) (func (param f32 i32))) + (table (;0;) 2 2 funcref) + (memory (;0;) 17) + (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) + (global $GOT.data.internal.__memory_base (;1;) i32 i32.const 0) + (export "memory" (memory 0)) + (export "miden:rust-sdk-input-note-get-recipient-binding/rust-sdk-input-note-get-recipient-binding@0.0.1#binding" (func $miden:rust-sdk-input-note-get-recipient-binding/rust-sdk-input-note-get-recipient-binding@0.0.1#binding)) + (elem (;0;) (i32.const 1) func $rust_sdk_input_note_get_recipient_binding::bindings::__link_custom_section_describing_imports) + (func $__wasm_call_ctors (;0;) (type 0)) + (func $rust_sdk_input_note_get_recipient_binding::bindings::__link_custom_section_describing_imports (;1;) (type 0)) + (func $miden:rust-sdk-input-note-get-recipient-binding/rust-sdk-input-note-get-recipient-binding@0.0.1#binding (;2;) (type 1) (result i32) + (local i32 i32) + global.get $__stack_pointer + i32.const 16 + i32.sub + local.tee 0 + global.set $__stack_pointer + call $wit_bindgen::rt::run_ctors_once + local.get 0 + i32.const 0 + call $intrinsics::felt::from_u32 + call $miden_base_sys::bindings::input_note::get_recipient + global.get $GOT.data.internal.__memory_base + i32.const 1048584 + i32.add + local.tee 1 + local.get 0 + i64.load offset=8 + i64.store offset=8 align=4 + local.get 1 + local.get 0 + i64.load + i64.store align=4 + local.get 0 + i32.const 16 + i32.add + global.set $__stack_pointer + local.get 1 + ) + (func $wit_bindgen::rt::run_ctors_once (;3;) (type 0) + (local i32) + block ;; label = @1 + global.get $GOT.data.internal.__memory_base + i32.const 1048600 + i32.add + i32.load8_u + br_if 0 (;@1;) + global.get $GOT.data.internal.__memory_base + local.set 0 + call $__wasm_call_ctors + local.get 0 + i32.const 1048600 + i32.add + i32.const 1 + i32.store8 + end + ) + (func $miden_base_sys::bindings::input_note::get_recipient (;4;) (type 2) (param i32 f32) + (local i32 i64 i64) + global.get $__stack_pointer + i32.const 48 + i32.sub + local.tee 2 + global.set $__stack_pointer + local.get 1 + local.get 2 + call $miden::input_note::get_recipient + local.get 2 + local.get 2 + i64.load offset=8 + i64.store offset=24 + local.get 2 + local.get 2 + i64.load + i64.store offset=16 + local.get 2 + i32.const 32 + i32.add + local.get 2 + i32.const 16 + i32.add + call $miden_stdlib_sys::intrinsics::word::Word::reverse + local.get 2 + local.get 2 + i64.load offset=40 + local.tee 3 + i64.store offset=24 + local.get 2 + local.get 2 + i64.load offset=32 + local.tee 4 + i64.store offset=16 + local.get 0 + i32.const 8 + i32.add + local.get 3 + i64.store + local.get 0 + local.get 4 + i64.store + local.get 2 + i32.const 48 + i32.add + global.set $__stack_pointer + ) + (func $miden_stdlib_sys::intrinsics::word::Word::reverse (;5;) (type 3) (param i32 i32) + (local i32 i32 i32 f32) + global.get $__stack_pointer + i32.const 16 + i32.sub + local.tee 2 + local.get 1 + i64.load offset=8 + i64.store offset=8 align=4 + local.get 2 + local.get 1 + i64.load + i64.store align=4 + local.get 2 + i32.const 12 + i32.add + local.set 3 + i32.const 0 + local.set 1 + block ;; label = @1 + loop ;; label = @2 + local.get 1 + i32.const 8 + i32.eq + br_if 1 (;@1;) + local.get 2 + local.get 1 + i32.add + local.tee 4 + f32.load + local.set 5 + local.get 4 + local.get 3 + i32.load + i32.store + local.get 3 + local.get 5 + f32.store + local.get 1 + i32.const 4 + i32.add + local.set 1 + local.get 3 + i32.const -4 + i32.add + local.set 3 + br 0 (;@2;) + end + end + local.get 0 + local.get 2 + i64.load offset=8 align=4 + i64.store offset=8 + local.get 0 + local.get 2 + i64.load align=4 + i64.store + ) + (func $intrinsics::felt::from_u32 (;6;) (type 4) (param i32) (result f32) + unreachable + ) + (func $miden::input_note::get_recipient (;7;) (type 5) (param f32 i32) + unreachable + ) + (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") + (@custom "rodata,miden_account" (after data) "Srust_sdk_input_note_get_recipient_binding\01\0b0.0.1\03\01\01\00\00\00\00\00\00\00\00\00\00\00\00") + ) + (alias export 0 "recipient" (type (;1;))) + (core instance (;0;) (instantiate 0)) + (alias core export 0 "memory" (core memory (;0;))) + (type (;2;) (func (result 1))) + (alias core export 0 "miden:rust-sdk-input-note-get-recipient-binding/rust-sdk-input-note-get-recipient-binding@0.0.1#binding" (core func (;0;))) + (func (;0;) (type 2) (canon lift (core func 0) (memory 0))) + (alias export 0 "felt" (type (;3;))) + (alias export 0 "word" (type (;4;))) + (alias export 0 "recipient" (type (;5;))) + (component (;0;) + (type (;0;) (record (field "inner" f32))) + (import "import-type-felt" (type (;1;) (eq 0))) + (type (;2;) (tuple 1 1 1 1)) + (type (;3;) (record (field "inner" 2))) + (import "import-type-word" (type (;4;) (eq 3))) + (type (;5;) (record (field "inner" 4))) + (import "import-type-recipient" (type (;6;) (eq 5))) + (import "import-type-recipient0" (type (;7;) (eq 6))) + (type (;8;) (func (result 7))) + (import "import-func-binding" (func (;0;) (type 8))) + (export (;9;) "recipient" (type 6)) + (type (;10;) (func (result 9))) + (export (;1;) "binding" (func 0) (func (type 10))) + ) + (instance (;1;) (instantiate 0 + (with "import-func-binding" (func 0)) + (with "import-type-felt" (type 3)) + (with "import-type-word" (type 4)) + (with "import-type-recipient" (type 5)) + (with "import-type-recipient0" (type 1)) + ) + ) + (export (;2;) "miden:rust-sdk-input-note-get-recipient-binding/rust-sdk-input-note-get-recipient-binding@0.0.1" (instance 1)) +) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_script_root_binding.hir b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_script_root_binding.hir new file mode 100644 index 000000000..cbeabd23f --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_script_root_binding.hir @@ -0,0 +1,350 @@ +builtin.component miden:rust-sdk-input-note-get-script-root-binding/rust-sdk-input-note-get-script-root-binding@0.0.1 { + builtin.module public @rust_sdk_input_note_get_script_root_binding { + private builtin.function @__wasm_call_ctors() { + ^block5: + builtin.ret ; + }; + + private builtin.function @rust_sdk_input_note_get_script_root_binding::bindings::__link_custom_section_describing_imports() { + ^block7: + builtin.ret ; + }; + + private builtin.function @miden:rust-sdk-input-note-get-script-root-binding/rust-sdk-input-note-get-script-root-binding@0.0.1#binding() -> i32 { + ^block9: + v2 = builtin.global_symbol @miden:rust-sdk-input-note-get-script-root-binding/rust-sdk-input-note-get-script-root-binding@0.0.1/rust_sdk_input_note_get_script_root_binding/__stack_pointer : ptr + v3 = hir.bitcast v2 : ptr; + v4 = hir.load v3 : i32; + v5 = arith.constant 16 : i32; + v6 = arith.sub v4, v5 : i32 #[overflow = wrapping]; + v7 = builtin.global_symbol @miden:rust-sdk-input-note-get-script-root-binding/rust-sdk-input-note-get-script-root-binding@0.0.1/rust_sdk_input_note_get_script_root_binding/__stack_pointer : ptr + v8 = hir.bitcast v7 : ptr; + hir.store v8, v6; + hir.exec @miden:rust-sdk-input-note-get-script-root-binding/rust-sdk-input-note-get-script-root-binding@0.0.1/rust_sdk_input_note_get_script_root_binding/wit_bindgen::rt::run_ctors_once() + v1 = arith.constant 0 : i32; + v10 = hir.exec @miden:rust-sdk-input-note-get-script-root-binding/rust-sdk-input-note-get-script-root-binding@0.0.1/rust_sdk_input_note_get_script_root_binding/intrinsics::felt::from_u32(v1) : felt + hir.exec @miden:rust-sdk-input-note-get-script-root-binding/rust-sdk-input-note-get-script-root-binding@0.0.1/rust_sdk_input_note_get_script_root_binding/miden_base_sys::bindings::input_note::get_script_root(v6, v10) + v11 = builtin.global_symbol @miden:rust-sdk-input-note-get-script-root-binding/rust-sdk-input-note-get-script-root-binding@0.0.1/rust_sdk_input_note_get_script_root_binding/GOT.data.internal.__memory_base : ptr + v12 = hir.bitcast v11 : ptr; + v13 = hir.load v12 : i32; + v14 = arith.constant 1048584 : i32; + v15 = arith.add v13, v14 : i32 #[overflow = wrapping]; + v17 = arith.constant 8 : u32; + v16 = hir.bitcast v6 : u32; + v18 = arith.add v16, v17 : u32 #[overflow = checked]; + v249 = arith.constant 8 : u32; + v20 = arith.mod v18, v249 : u32; + hir.assertz v20 #[code = 250]; + v21 = hir.int_to_ptr v18 : ptr; + v22 = hir.load v21 : i64; + v248 = arith.constant 8 : u32; + v23 = hir.bitcast v15 : u32; + v25 = arith.add v23, v248 : u32 #[overflow = checked]; + v26 = arith.constant 4 : u32; + v27 = arith.mod v25, v26 : u32; + hir.assertz v27 #[code = 250]; + v28 = hir.int_to_ptr v25 : ptr; + hir.store v28, v22; + v29 = hir.bitcast v6 : u32; + v247 = arith.constant 8 : u32; + v31 = arith.mod v29, v247 : u32; + hir.assertz v31 #[code = 250]; + v32 = hir.int_to_ptr v29 : ptr; + v33 = hir.load v32 : i64; + v34 = hir.bitcast v15 : u32; + v246 = arith.constant 4 : u32; + v36 = arith.mod v34, v246 : u32; + hir.assertz v36 #[code = 250]; + v37 = hir.int_to_ptr v34 : ptr; + hir.store v37, v33; + v245 = arith.constant 16 : i32; + v39 = arith.add v6, v245 : i32 #[overflow = wrapping]; + v40 = builtin.global_symbol @miden:rust-sdk-input-note-get-script-root-binding/rust-sdk-input-note-get-script-root-binding@0.0.1/rust_sdk_input_note_get_script_root_binding/__stack_pointer : ptr + v41 = hir.bitcast v40 : ptr; + hir.store v41, v39; + builtin.ret v15; + }; + + private builtin.function @wit_bindgen::rt::run_ctors_once() { + ^block11: + v43 = builtin.global_symbol @miden:rust-sdk-input-note-get-script-root-binding/rust-sdk-input-note-get-script-root-binding@0.0.1/rust_sdk_input_note_get_script_root_binding/GOT.data.internal.__memory_base : ptr + v44 = hir.bitcast v43 : ptr; + v45 = hir.load v44 : i32; + v46 = arith.constant 1048600 : i32; + v47 = arith.add v45, v46 : i32 #[overflow = wrapping]; + v48 = hir.bitcast v47 : u32; + v49 = hir.int_to_ptr v48 : ptr; + v50 = hir.load v49 : u8; + v42 = arith.constant 0 : i32; + v51 = arith.zext v50 : u32; + v52 = hir.bitcast v51 : i32; + v54 = arith.neq v52, v42 : i1; + scf.if v54{ + ^block13: + scf.yield ; + } else { + ^block14: + v55 = builtin.global_symbol @miden:rust-sdk-input-note-get-script-root-binding/rust-sdk-input-note-get-script-root-binding@0.0.1/rust_sdk_input_note_get_script_root_binding/GOT.data.internal.__memory_base : ptr + v56 = hir.bitcast v55 : ptr; + v57 = hir.load v56 : i32; + hir.exec @miden:rust-sdk-input-note-get-script-root-binding/rust-sdk-input-note-get-script-root-binding@0.0.1/rust_sdk_input_note_get_script_root_binding/__wasm_call_ctors() + v251 = arith.constant 1 : u8; + v253 = arith.constant 1048600 : i32; + v59 = arith.add v57, v253 : i32 #[overflow = wrapping]; + v63 = hir.bitcast v59 : u32; + v64 = hir.int_to_ptr v63 : ptr; + hir.store v64, v251; + scf.yield ; + }; + builtin.ret ; + }; + + private builtin.function @miden_base_sys::bindings::input_note::get_script_root(v65: i32, v66: felt) { + ^block15(v65: i32, v66: felt): + v68 = builtin.global_symbol @miden:rust-sdk-input-note-get-script-root-binding/rust-sdk-input-note-get-script-root-binding@0.0.1/rust_sdk_input_note_get_script_root_binding/__stack_pointer : ptr + v69 = hir.bitcast v68 : ptr; + v70 = hir.load v69 : i32; + v71 = arith.constant 32 : i32; + v72 = arith.sub v70, v71 : i32 #[overflow = wrapping]; + v73 = builtin.global_symbol @miden:rust-sdk-input-note-get-script-root-binding/rust-sdk-input-note-get-script-root-binding@0.0.1/rust_sdk_input_note_get_script_root_binding/__stack_pointer : ptr + v74 = hir.bitcast v73 : ptr; + hir.store v74, v72; + hir.exec @miden:rust-sdk-input-note-get-script-root-binding/rust-sdk-input-note-get-script-root-binding@0.0.1/rust_sdk_input_note_get_script_root_binding/miden::input_note::get_script_root(v66, v72) + v76 = arith.constant 8 : u32; + v75 = hir.bitcast v72 : u32; + v77 = arith.add v75, v76 : u32 #[overflow = checked]; + v258 = arith.constant 8 : u32; + v79 = arith.mod v77, v258 : u32; + hir.assertz v79 #[code = 250]; + v80 = hir.int_to_ptr v77 : ptr; + v81 = hir.load v80 : i64; + v83 = arith.constant 24 : u32; + v82 = hir.bitcast v72 : u32; + v84 = arith.add v82, v83 : u32 #[overflow = checked]; + v257 = arith.constant 8 : u32; + v86 = arith.mod v84, v257 : u32; + hir.assertz v86 #[code = 250]; + v87 = hir.int_to_ptr v84 : ptr; + hir.store v87, v81; + v88 = hir.bitcast v72 : u32; + v256 = arith.constant 8 : u32; + v90 = arith.mod v88, v256 : u32; + hir.assertz v90 #[code = 250]; + v91 = hir.int_to_ptr v88 : ptr; + v92 = hir.load v91 : i64; + v94 = arith.constant 16 : u32; + v93 = hir.bitcast v72 : u32; + v95 = arith.add v93, v94 : u32 #[overflow = checked]; + v255 = arith.constant 8 : u32; + v97 = arith.mod v95, v255 : u32; + hir.assertz v97 #[code = 250]; + v98 = hir.int_to_ptr v95 : ptr; + hir.store v98, v92; + v99 = arith.constant 16 : i32; + v100 = arith.add v72, v99 : i32 #[overflow = wrapping]; + hir.exec @miden:rust-sdk-input-note-get-script-root-binding/rust-sdk-input-note-get-script-root-binding@0.0.1/rust_sdk_input_note_get_script_root_binding/miden_stdlib_sys::intrinsics::word::Word::reverse(v65, v100) + v254 = arith.constant 32 : i32; + v102 = arith.add v72, v254 : i32 #[overflow = wrapping]; + v103 = builtin.global_symbol @miden:rust-sdk-input-note-get-script-root-binding/rust-sdk-input-note-get-script-root-binding@0.0.1/rust_sdk_input_note_get_script_root_binding/__stack_pointer : ptr + v104 = hir.bitcast v103 : ptr; + hir.store v104, v102; + builtin.ret ; + }; + + private builtin.function @miden_stdlib_sys::intrinsics::word::Word::reverse(v105: i32, v106: i32) { + ^block17(v105: i32, v106: i32): + v109 = builtin.global_symbol @miden:rust-sdk-input-note-get-script-root-binding/rust-sdk-input-note-get-script-root-binding@0.0.1/rust_sdk_input_note_get_script_root_binding/__stack_pointer : ptr + v110 = hir.bitcast v109 : ptr; + v111 = hir.load v110 : i32; + v112 = arith.constant 16 : i32; + v113 = arith.sub v111, v112 : i32 #[overflow = wrapping]; + v115 = arith.constant 8 : u32; + v114 = hir.bitcast v106 : u32; + v116 = arith.add v114, v115 : u32 #[overflow = checked]; + v345 = arith.constant 8 : u32; + v118 = arith.mod v116, v345 : u32; + hir.assertz v118 #[code = 250]; + v119 = hir.int_to_ptr v116 : ptr; + v120 = hir.load v119 : i64; + v344 = arith.constant 8 : u32; + v121 = hir.bitcast v113 : u32; + v123 = arith.add v121, v344 : u32 #[overflow = checked]; + v124 = arith.constant 4 : u32; + v125 = arith.mod v123, v124 : u32; + hir.assertz v125 #[code = 250]; + v126 = hir.int_to_ptr v123 : ptr; + hir.store v126, v120; + v127 = hir.bitcast v106 : u32; + v343 = arith.constant 8 : u32; + v129 = arith.mod v127, v343 : u32; + hir.assertz v129 #[code = 250]; + v130 = hir.int_to_ptr v127 : ptr; + v131 = hir.load v130 : i64; + v132 = hir.bitcast v113 : u32; + v342 = arith.constant 4 : u32; + v134 = arith.mod v132, v342 : u32; + hir.assertz v134 #[code = 250]; + v135 = hir.int_to_ptr v132 : ptr; + hir.store v135, v131; + v136 = arith.constant 12 : i32; + v137 = arith.add v113, v136 : i32 #[overflow = wrapping]; + v107 = arith.constant 0 : i32; + v313, v314, v315, v316, v317, v318 = scf.while v107, v113, v137, v105 : i32, i32, i32, i32, i32, i32 { + ^block39(v319: i32, v320: i32, v321: i32, v322: i32): + v341 = arith.constant 0 : i32; + v140 = arith.constant 8 : i32; + v141 = arith.eq v319, v140 : i1; + v142 = arith.zext v141 : u32; + v143 = hir.bitcast v142 : i32; + v145 = arith.neq v143, v341 : i1; + v307, v308 = scf.if v145 : i32, i32 { + ^block38: + v267 = ub.poison i32 : i32; + scf.yield v267, v267; + } else { + ^block22: + v147 = arith.add v320, v319 : i32 #[overflow = wrapping]; + v148 = hir.bitcast v147 : u32; + v340 = arith.constant 4 : u32; + v150 = arith.mod v148, v340 : u32; + hir.assertz v150 #[code = 250]; + v151 = hir.int_to_ptr v148 : ptr; + v152 = hir.load v151 : felt; + v154 = hir.bitcast v321 : u32; + v339 = arith.constant 4 : u32; + v156 = arith.mod v154, v339 : u32; + hir.assertz v156 #[code = 250]; + v157 = hir.int_to_ptr v154 : ptr; + v158 = hir.load v157 : i32; + v159 = hir.bitcast v147 : u32; + v338 = arith.constant 4 : u32; + v161 = arith.mod v159, v338 : u32; + hir.assertz v161 #[code = 250]; + v162 = hir.int_to_ptr v159 : ptr; + hir.store v162, v158; + v163 = hir.bitcast v321 : u32; + v337 = arith.constant 4 : u32; + v165 = arith.mod v163, v337 : u32; + hir.assertz v165 #[code = 250]; + v166 = hir.int_to_ptr v163 : ptr; + hir.store v166, v152; + v169 = arith.constant -4 : i32; + v170 = arith.add v321, v169 : i32 #[overflow = wrapping]; + v167 = arith.constant 4 : i32; + v168 = arith.add v319, v167 : i32 #[overflow = wrapping]; + scf.yield v168, v170; + }; + v335 = ub.poison i32 : i32; + v310 = cf.select v145, v335, v322 : i32; + v336 = ub.poison i32 : i32; + v309 = cf.select v145, v336, v320 : i32; + v266 = arith.constant 1 : u32; + v259 = arith.constant 0 : u32; + v312 = cf.select v145, v259, v266 : u32; + v300 = arith.trunc v312 : i1; + scf.condition v300, v307, v309, v308, v310, v320, v322; + } do { + ^block40(v323: i32, v324: i32, v325: i32, v326: i32, v327: i32, v328: i32): + scf.yield v323, v324, v325, v326; + }; + v334 = arith.constant 8 : u32; + v172 = hir.bitcast v317 : u32; + v174 = arith.add v172, v334 : u32 #[overflow = checked]; + v333 = arith.constant 4 : u32; + v176 = arith.mod v174, v333 : u32; + hir.assertz v176 #[code = 250]; + v177 = hir.int_to_ptr v174 : ptr; + v178 = hir.load v177 : i64; + v332 = arith.constant 8 : u32; + v179 = hir.bitcast v318 : u32; + v181 = arith.add v179, v332 : u32 #[overflow = checked]; + v331 = arith.constant 8 : u32; + v183 = arith.mod v181, v331 : u32; + hir.assertz v183 #[code = 250]; + v184 = hir.int_to_ptr v181 : ptr; + hir.store v184, v178; + v185 = hir.bitcast v317 : u32; + v330 = arith.constant 4 : u32; + v187 = arith.mod v185, v330 : u32; + hir.assertz v187 #[code = 250]; + v188 = hir.int_to_ptr v185 : ptr; + v189 = hir.load v188 : i64; + v190 = hir.bitcast v318 : u32; + v329 = arith.constant 8 : u32; + v192 = arith.mod v190, v329 : u32; + hir.assertz v192 #[code = 250]; + v193 = hir.int_to_ptr v190 : ptr; + hir.store v193, v189; + builtin.ret ; + }; + + private builtin.function @intrinsics::felt::from_u32(v194: i32) -> felt { + ^block23(v194: i32): + v195 = hir.bitcast v194 : felt; + builtin.ret v195; + }; + + private builtin.function @miden::input_note::get_script_root(v197: felt, v198: i32) { + ^block25(v197: felt, v198: i32): + v199, v200, v201, v202 = hir.exec @miden/input_note/get_script_root(v197) : felt, felt, felt, felt + v203 = hir.bitcast v198 : u32; + v204 = hir.int_to_ptr v203 : ptr; + hir.store v204, v199; + v205 = arith.constant 4 : u32; + v206 = arith.add v203, v205 : u32 #[overflow = checked]; + v207 = hir.int_to_ptr v206 : ptr; + hir.store v207, v200; + v208 = arith.constant 8 : u32; + v209 = arith.add v203, v208 : u32 #[overflow = checked]; + v210 = hir.int_to_ptr v209 : ptr; + hir.store v210, v201; + v211 = arith.constant 12 : u32; + v212 = arith.add v203, v211 : u32 #[overflow = checked]; + v213 = hir.int_to_ptr v212 : ptr; + hir.store v213, v202; + builtin.ret ; + }; + + builtin.global_variable private @#__stack_pointer : i32 { + builtin.ret_imm 1048576; + }; + + builtin.global_variable private @#GOT.data.internal.__memory_base : i32 { + builtin.ret_imm 0; + }; + + builtin.segment @1048576 = 0x0000000100000001; + }; + + public builtin.function @binding() -> felt, felt, felt, felt { + ^block29: + v214 = hir.exec @miden:rust-sdk-input-note-get-script-root-binding/rust-sdk-input-note-get-script-root-binding@0.0.1/rust_sdk_input_note_get_script_root_binding/miden:rust-sdk-input-note-get-script-root-binding/rust-sdk-input-note-get-script-root-binding@0.0.1#binding() : i32 + v215 = arith.constant 0 : i32; + v216 = arith.add v214, v215 : i32 #[overflow = unchecked]; + v349 = arith.constant 0 : i32; + v350 = arith.constant 0 : i32; + v218 = arith.add v216, v350 : i32 #[overflow = unchecked]; + v220 = arith.add v218, v349 : i32 #[overflow = unchecked]; + v221 = hir.int_to_ptr v220 : ptr; + v222 = hir.load v221 : felt; + v348 = arith.constant 0 : i32; + v223 = arith.constant 4 : i32; + v224 = arith.add v216, v223 : i32 #[overflow = unchecked]; + v226 = arith.add v224, v348 : i32 #[overflow = unchecked]; + v227 = hir.int_to_ptr v226 : ptr; + v228 = hir.load v227 : felt; + v347 = arith.constant 0 : i32; + v229 = arith.constant 8 : i32; + v230 = arith.add v216, v229 : i32 #[overflow = unchecked]; + v232 = arith.add v230, v347 : i32 #[overflow = unchecked]; + v233 = hir.int_to_ptr v232 : ptr; + v234 = hir.load v233 : felt; + v346 = arith.constant 0 : i32; + v235 = arith.constant 12 : i32; + v236 = arith.add v216, v235 : i32 #[overflow = unchecked]; + v238 = arith.add v236, v346 : i32 #[overflow = unchecked]; + v239 = hir.int_to_ptr v238 : ptr; + v240 = hir.load v239 : felt; + builtin.ret v222, v228, v234, v240; + }; +}; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_script_root_binding.masm b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_script_root_binding.masm new file mode 100644 index 000000000..d74131f3a --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_script_root_binding.masm @@ -0,0 +1,748 @@ +# mod miden:rust-sdk-input-note-get-script-root-binding/rust-sdk-input-note-get-script-root-binding@0.0.1 + +@callconv("canon-lift") +pub proc binding( + +) -> (felt, felt, felt, felt) + exec.::miden:rust-sdk-input-note-get-script-root-binding/rust-sdk-input-note-get-script-root-binding@0.0.1::init + trace.240 + nop + exec.::miden:rust-sdk-input-note-get-script-root-binding/rust-sdk-input-note-get-script-root-binding@0.0.1::rust_sdk_input_note_get_script_root_binding::miden:rust-sdk-input-note-get-script-root-binding/rust-sdk-input-note-get-script-root-binding@0.0.1#binding + trace.252 + nop + push.0 + u32wrapping_add + push.0 + push.0 + dup.2 + u32wrapping_add + u32wrapping_add + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.0 + push.4 + dup.3 + u32wrapping_add + u32wrapping_add + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.0 + push.8 + dup.4 + u32wrapping_add + u32wrapping_add + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.0 + push.12 + movup.5 + u32wrapping_add + u32wrapping_add + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + movdn.3 + swap.2 + exec.::std::sys::truncate_stack +end + +proc init + push.1179648 + trace.240 + exec.::intrinsics::mem::heap_init + trace.252 + push.[7028007876379170725,18060021366771303825,13412364500725888848,14178532912296021363] + adv.push_mapval + push.262144 + push.1 + trace.240 + exec.::std::mem::pipe_preimage_to_memory + trace.252 + drop + push.1048576 + u32assert + mem_store.278536 + push.0 + u32assert + mem_store.278537 +end + +# mod miden:rust-sdk-input-note-get-script-root-binding/rust-sdk-input-note-get-script-root-binding@0.0.1::rust_sdk_input_note_get_script_root_binding + +@callconv("C") +proc __wasm_call_ctors( + +) + nop +end + +@callconv("C") +proc rust_sdk_input_note_get_script_root_binding::bindings::__link_custom_section_describing_imports( + +) + nop +end + +@callconv("C") +proc miden:rust-sdk-input-note-get-script-root-binding/rust-sdk-input-note-get-script-root-binding@0.0.1#binding( + +) -> i32 + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.16 + u32wrapping_sub + push.1114144 + dup.1 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + trace.240 + nop + exec.::miden:rust-sdk-input-note-get-script-root-binding/rust-sdk-input-note-get-script-root-binding@0.0.1::rust_sdk_input_note_get_script_root_binding::wit_bindgen::rt::run_ctors_once + trace.252 + nop + push.0 + trace.240 + nop + exec.::miden:rust-sdk-input-note-get-script-root-binding/rust-sdk-input-note-get-script-root-binding@0.0.1::rust_sdk_input_note_get_script_root_binding::intrinsics::felt::from_u32 + trace.252 + nop + dup.1 + trace.240 + nop + exec.::miden:rust-sdk-input-note-get-script-root-binding/rust-sdk-input-note-get-script-root-binding@0.0.1::rust_sdk_input_note_get_script_root_binding::miden_base_sys::bindings::input_note::get_script_root + trace.252 + nop + push.1114148 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.1048584 + u32wrapping_add + push.8 + dup.2 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.8 + dup.3 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + dup.1 + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + dup.2 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.16 + movup.2 + u32wrapping_add + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop +end + +@callconv("C") +proc wit_bindgen::rt::run_ctors_once( + +) + push.1114148 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.1048600 + u32wrapping_add + u32divmod.4 + swap.1 + swap.1 + dup.1 + mem_load + swap.1 + push.8 + u32wrapping_mul + u32shr + swap.1 + drop + push.255 + u32and + push.0 + swap.1 + neq + if.true + nop + else + push.1114148 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + trace.240 + nop + exec.::miden:rust-sdk-input-note-get-script-root-binding/rust-sdk-input-note-get-script-root-binding@0.0.1::rust_sdk_input_note_get_script_root_binding::__wasm_call_ctors + trace.252 + nop + push.1 + push.1048600 + movup.2 + u32wrapping_add + u32divmod.4 + swap.1 + dup.0 + mem_load + dup.2 + push.8 + u32wrapping_mul + push.255 + swap.1 + u32shl + u32not + swap.1 + u32and + movup.3 + movup.3 + push.8 + u32wrapping_mul + u32shl + u32or + swap.1 + mem_store + end +end + +@callconv("C") +proc miden_base_sys::bindings::input_note::get_script_root( + i32, + felt +) + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.32 + u32wrapping_sub + push.1114144 + dup.1 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + dup.0 + movup.3 + trace.240 + nop + exec.::miden:rust-sdk-input-note-get-script-root-binding/rust-sdk-input-note-get-script-root-binding@0.0.1::rust_sdk_input_note_get_script_root_binding::miden::input_note::get_script_root + trace.252 + nop + push.8 + dup.1 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.24 + dup.3 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + dup.0 + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.16 + dup.3 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.16 + dup.1 + u32wrapping_add + movup.2 + trace.240 + nop + exec.::miden:rust-sdk-input-note-get-script-root-binding/rust-sdk-input-note-get-script-root-binding@0.0.1::rust_sdk_input_note_get_script_root_binding::miden_stdlib_sys::intrinsics::word::Word::reverse + trace.252 + nop + push.32 + u32wrapping_add + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop +end + +@callconv("C") +proc miden_stdlib_sys::intrinsics::word::Word::reverse( + i32, + i32 +) + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.16 + u32wrapping_sub + push.8 + dup.3 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.8 + dup.3 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + movup.2 + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + dup.2 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.12 + dup.1 + u32wrapping_add + push.0 + movup.2 + swap.1 + push.1 + while.true + push.0 + push.8 + dup.2 + eq + neq + dup.0 + if.true + movup.3 + movup.2 + drop + drop + push.3735929054 + dup.0 + else + dup.2 + dup.2 + u32wrapping_add + dup.0 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + dup.5 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + movup.2 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + dup.4 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.4294967292 + movup.4 + u32wrapping_add + push.4 + movup.3 + u32wrapping_add + end + push.3735929054 + dup.3 + dup.6 + swap.2 + swap.1 + cdrop + push.3735929054 + dup.4 + dup.6 + swap.2 + swap.1 + cdrop + push.1 + push.0 + movup.6 + cdrop + push.1 + u32and + swap.1 + swap.2 + swap.4 + swap.3 + swap.1 + if.true + movup.4 + drop + movup.4 + drop + push.1 + else + push.0 + end + end + drop + drop + drop + drop + push.8 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.8 + dup.4 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + movup.2 + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop +end + +@callconv("C") +proc intrinsics::felt::from_u32(i32) -> felt + nop +end + +@callconv("C") +proc miden::input_note::get_script_root(felt, i32) + trace.240 + nop + exec.::miden::input_note::get_script_root + trace.252 + nop + movup.4 + dup.0 + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.4 + dup.1 + add + u32assert + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.8 + dup.1 + add + u32assert + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.12 + add + u32assert + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop +end + diff --git a/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_script_root_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_script_root_binding.wat new file mode 100644 index 000000000..4bb7ebd2e --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_script_root_binding.wat @@ -0,0 +1,199 @@ +(component + (type (;0;) + (instance + (type (;0;) (record (field "inner" f32))) + (export (;1;) "felt" (type (eq 0))) + (type (;2;) (tuple 1 1 1 1)) + (type (;3;) (record (field "inner" 2))) + (export (;4;) "word" (type (eq 3))) + ) + ) + (import "miden:base/core-types@1.0.0" (instance (;0;) (type 0))) + (core module (;0;) + (type (;0;) (func)) + (type (;1;) (func (result i32))) + (type (;2;) (func (param i32 f32))) + (type (;3;) (func (param i32 i32))) + (type (;4;) (func (param i32) (result f32))) + (type (;5;) (func (param f32 i32))) + (table (;0;) 2 2 funcref) + (memory (;0;) 17) + (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) + (global $GOT.data.internal.__memory_base (;1;) i32 i32.const 0) + (export "memory" (memory 0)) + (export "miden:rust-sdk-input-note-get-script-root-binding/rust-sdk-input-note-get-script-root-binding@0.0.1#binding" (func $miden:rust-sdk-input-note-get-script-root-binding/rust-sdk-input-note-get-script-root-binding@0.0.1#binding)) + (elem (;0;) (i32.const 1) func $rust_sdk_input_note_get_script_root_binding::bindings::__link_custom_section_describing_imports) + (func $__wasm_call_ctors (;0;) (type 0)) + (func $rust_sdk_input_note_get_script_root_binding::bindings::__link_custom_section_describing_imports (;1;) (type 0)) + (func $miden:rust-sdk-input-note-get-script-root-binding/rust-sdk-input-note-get-script-root-binding@0.0.1#binding (;2;) (type 1) (result i32) + (local i32 i32) + global.get $__stack_pointer + i32.const 16 + i32.sub + local.tee 0 + global.set $__stack_pointer + call $wit_bindgen::rt::run_ctors_once + local.get 0 + i32.const 0 + call $intrinsics::felt::from_u32 + call $miden_base_sys::bindings::input_note::get_script_root + global.get $GOT.data.internal.__memory_base + i32.const 1048584 + i32.add + local.tee 1 + local.get 0 + i64.load offset=8 + i64.store offset=8 align=4 + local.get 1 + local.get 0 + i64.load + i64.store align=4 + local.get 0 + i32.const 16 + i32.add + global.set $__stack_pointer + local.get 1 + ) + (func $wit_bindgen::rt::run_ctors_once (;3;) (type 0) + (local i32) + block ;; label = @1 + global.get $GOT.data.internal.__memory_base + i32.const 1048600 + i32.add + i32.load8_u + br_if 0 (;@1;) + global.get $GOT.data.internal.__memory_base + local.set 0 + call $__wasm_call_ctors + local.get 0 + i32.const 1048600 + i32.add + i32.const 1 + i32.store8 + end + ) + (func $miden_base_sys::bindings::input_note::get_script_root (;4;) (type 2) (param i32 f32) + (local i32) + global.get $__stack_pointer + i32.const 32 + i32.sub + local.tee 2 + global.set $__stack_pointer + local.get 1 + local.get 2 + call $miden::input_note::get_script_root + local.get 2 + local.get 2 + i64.load offset=8 + i64.store offset=24 + local.get 2 + local.get 2 + i64.load + i64.store offset=16 + local.get 0 + local.get 2 + i32.const 16 + i32.add + call $miden_stdlib_sys::intrinsics::word::Word::reverse + local.get 2 + i32.const 32 + i32.add + global.set $__stack_pointer + ) + (func $miden_stdlib_sys::intrinsics::word::Word::reverse (;5;) (type 3) (param i32 i32) + (local i32 i32 i32 f32) + global.get $__stack_pointer + i32.const 16 + i32.sub + local.tee 2 + local.get 1 + i64.load offset=8 + i64.store offset=8 align=4 + local.get 2 + local.get 1 + i64.load + i64.store align=4 + local.get 2 + i32.const 12 + i32.add + local.set 3 + i32.const 0 + local.set 1 + block ;; label = @1 + loop ;; label = @2 + local.get 1 + i32.const 8 + i32.eq + br_if 1 (;@1;) + local.get 2 + local.get 1 + i32.add + local.tee 4 + f32.load + local.set 5 + local.get 4 + local.get 3 + i32.load + i32.store + local.get 3 + local.get 5 + f32.store + local.get 1 + i32.const 4 + i32.add + local.set 1 + local.get 3 + i32.const -4 + i32.add + local.set 3 + br 0 (;@2;) + end + end + local.get 0 + local.get 2 + i64.load offset=8 align=4 + i64.store offset=8 + local.get 0 + local.get 2 + i64.load align=4 + i64.store + ) + (func $intrinsics::felt::from_u32 (;6;) (type 4) (param i32) (result f32) + unreachable + ) + (func $miden::input_note::get_script_root (;7;) (type 5) (param f32 i32) + unreachable + ) + (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") + (@custom "rodata,miden_account" (after data) "Wrust_sdk_input_note_get_script_root_binding\01\0b0.0.1\03\01\01\00\00\00\00\00\00\00\00\00\00") + ) + (alias export 0 "word" (type (;1;))) + (core instance (;0;) (instantiate 0)) + (alias core export 0 "memory" (core memory (;0;))) + (type (;2;) (func (result 1))) + (alias core export 0 "miden:rust-sdk-input-note-get-script-root-binding/rust-sdk-input-note-get-script-root-binding@0.0.1#binding" (core func (;0;))) + (func (;0;) (type 2) (canon lift (core func 0) (memory 0))) + (alias export 0 "felt" (type (;3;))) + (alias export 0 "word" (type (;4;))) + (component (;0;) + (type (;0;) (record (field "inner" f32))) + (import "import-type-felt" (type (;1;) (eq 0))) + (type (;2;) (tuple 1 1 1 1)) + (type (;3;) (record (field "inner" 2))) + (import "import-type-word" (type (;4;) (eq 3))) + (import "import-type-word0" (type (;5;) (eq 4))) + (type (;6;) (func (result 5))) + (import "import-func-binding" (func (;0;) (type 6))) + (export (;7;) "word" (type 4)) + (type (;8;) (func (result 7))) + (export (;1;) "binding" (func 0) (func (type 8))) + ) + (instance (;1;) (instantiate 0 + (with "import-func-binding" (func 0)) + (with "import-type-felt" (type 3)) + (with "import-type-word" (type 4)) + (with "import-type-word0" (type 1)) + ) + ) + (export (;2;) "miden:rust-sdk-input-note-get-script-root-binding/rust-sdk-input-note-get-script-root-binding@0.0.1" (instance 1)) +) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_sender_binding.hir b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_sender_binding.hir new file mode 100644 index 000000000..e24b01cef --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_sender_binding.hir @@ -0,0 +1,172 @@ +builtin.component miden:rust-sdk-input-note-get-sender-binding/rust-sdk-input-note-get-sender-binding@0.0.1 { + builtin.module public @rust_sdk_input_note_get_sender_binding { + private builtin.function @__wasm_call_ctors() { + ^block5: + builtin.ret ; + }; + + private builtin.function @rust_sdk_input_note_get_sender_binding::bindings::__link_custom_section_describing_imports() { + ^block7: + builtin.ret ; + }; + + private builtin.function @miden:rust-sdk-input-note-get-sender-binding/rust-sdk-input-note-get-sender-binding@0.0.1#binding() -> i32 { + ^block9: + v2 = builtin.global_symbol @miden:rust-sdk-input-note-get-sender-binding/rust-sdk-input-note-get-sender-binding@0.0.1/rust_sdk_input_note_get_sender_binding/__stack_pointer : ptr + v3 = hir.bitcast v2 : ptr; + v4 = hir.load v3 : i32; + v5 = arith.constant 16 : i32; + v6 = arith.sub v4, v5 : i32 #[overflow = wrapping]; + v7 = builtin.global_symbol @miden:rust-sdk-input-note-get-sender-binding/rust-sdk-input-note-get-sender-binding@0.0.1/rust_sdk_input_note_get_sender_binding/__stack_pointer : ptr + v8 = hir.bitcast v7 : ptr; + hir.store v8, v6; + hir.exec @miden:rust-sdk-input-note-get-sender-binding/rust-sdk-input-note-get-sender-binding@0.0.1/rust_sdk_input_note_get_sender_binding/wit_bindgen::rt::run_ctors_once() + v1 = arith.constant 0 : i32; + v12 = hir.exec @miden:rust-sdk-input-note-get-sender-binding/rust-sdk-input-note-get-sender-binding@0.0.1/rust_sdk_input_note_get_sender_binding/intrinsics::felt::from_u32(v1) : felt + v9 = arith.constant 8 : i32; + v10 = arith.add v6, v9 : i32 #[overflow = wrapping]; + hir.exec @miden:rust-sdk-input-note-get-sender-binding/rust-sdk-input-note-get-sender-binding@0.0.1/rust_sdk_input_note_get_sender_binding/miden_base_sys::bindings::input_note::get_sender(v10, v12) + v13 = builtin.global_symbol @miden:rust-sdk-input-note-get-sender-binding/rust-sdk-input-note-get-sender-binding@0.0.1/rust_sdk_input_note_get_sender_binding/GOT.data.internal.__memory_base : ptr + v14 = hir.bitcast v13 : ptr; + v15 = hir.load v14 : i32; + v16 = arith.constant 1048584 : i32; + v17 = arith.add v15, v16 : i32 #[overflow = wrapping]; + v19 = arith.constant 8 : u32; + v18 = hir.bitcast v6 : u32; + v20 = arith.add v18, v19 : u32 #[overflow = checked]; + v111 = arith.constant 8 : u32; + v22 = arith.mod v20, v111 : u32; + hir.assertz v22 #[code = 250]; + v23 = hir.int_to_ptr v20 : ptr; + v24 = hir.load v23 : i64; + v25 = hir.bitcast v17 : u32; + v26 = arith.constant 4 : u32; + v27 = arith.mod v25, v26 : u32; + hir.assertz v27 #[code = 250]; + v28 = hir.int_to_ptr v25 : ptr; + hir.store v28, v24; + v110 = arith.constant 16 : i32; + v30 = arith.add v6, v110 : i32 #[overflow = wrapping]; + v31 = builtin.global_symbol @miden:rust-sdk-input-note-get-sender-binding/rust-sdk-input-note-get-sender-binding@0.0.1/rust_sdk_input_note_get_sender_binding/__stack_pointer : ptr + v32 = hir.bitcast v31 : ptr; + hir.store v32, v30; + builtin.ret v17; + }; + + private builtin.function @wit_bindgen::rt::run_ctors_once() { + ^block11: + v34 = builtin.global_symbol @miden:rust-sdk-input-note-get-sender-binding/rust-sdk-input-note-get-sender-binding@0.0.1/rust_sdk_input_note_get_sender_binding/GOT.data.internal.__memory_base : ptr + v35 = hir.bitcast v34 : ptr; + v36 = hir.load v35 : i32; + v37 = arith.constant 1048592 : i32; + v38 = arith.add v36, v37 : i32 #[overflow = wrapping]; + v39 = hir.bitcast v38 : u32; + v40 = hir.int_to_ptr v39 : ptr; + v41 = hir.load v40 : u8; + v33 = arith.constant 0 : i32; + v42 = arith.zext v41 : u32; + v43 = hir.bitcast v42 : i32; + v45 = arith.neq v43, v33 : i1; + scf.if v45{ + ^block13: + scf.yield ; + } else { + ^block14: + v46 = builtin.global_symbol @miden:rust-sdk-input-note-get-sender-binding/rust-sdk-input-note-get-sender-binding@0.0.1/rust_sdk_input_note_get_sender_binding/GOT.data.internal.__memory_base : ptr + v47 = hir.bitcast v46 : ptr; + v48 = hir.load v47 : i32; + hir.exec @miden:rust-sdk-input-note-get-sender-binding/rust-sdk-input-note-get-sender-binding@0.0.1/rust_sdk_input_note_get_sender_binding/__wasm_call_ctors() + v113 = arith.constant 1 : u8; + v115 = arith.constant 1048592 : i32; + v50 = arith.add v48, v115 : i32 #[overflow = wrapping]; + v54 = hir.bitcast v50 : u32; + v55 = hir.int_to_ptr v54 : ptr; + hir.store v55, v113; + scf.yield ; + }; + builtin.ret ; + }; + + private builtin.function @miden_base_sys::bindings::input_note::get_sender(v56: i32, v57: felt) { + ^block15(v56: i32, v57: felt): + v59 = builtin.global_symbol @miden:rust-sdk-input-note-get-sender-binding/rust-sdk-input-note-get-sender-binding@0.0.1/rust_sdk_input_note_get_sender_binding/__stack_pointer : ptr + v60 = hir.bitcast v59 : ptr; + v61 = hir.load v60 : i32; + v62 = arith.constant 16 : i32; + v63 = arith.sub v61, v62 : i32 #[overflow = wrapping]; + v64 = builtin.global_symbol @miden:rust-sdk-input-note-get-sender-binding/rust-sdk-input-note-get-sender-binding@0.0.1/rust_sdk_input_note_get_sender_binding/__stack_pointer : ptr + v65 = hir.bitcast v64 : ptr; + hir.store v65, v63; + v66 = arith.constant 8 : i32; + v67 = arith.add v63, v66 : i32 #[overflow = wrapping]; + hir.exec @miden:rust-sdk-input-note-get-sender-binding/rust-sdk-input-note-get-sender-binding@0.0.1/rust_sdk_input_note_get_sender_binding/miden::input_note::get_sender(v57, v67) + v69 = arith.constant 8 : u32; + v68 = hir.bitcast v63 : u32; + v70 = arith.add v68, v69 : u32 #[overflow = checked]; + v71 = arith.constant 4 : u32; + v72 = arith.mod v70, v71 : u32; + hir.assertz v72 #[code = 250]; + v73 = hir.int_to_ptr v70 : ptr; + v74 = hir.load v73 : i64; + v75 = hir.bitcast v56 : u32; + v117 = arith.constant 8 : u32; + v77 = arith.mod v75, v117 : u32; + hir.assertz v77 #[code = 250]; + v78 = hir.int_to_ptr v75 : ptr; + hir.store v78, v74; + v116 = arith.constant 16 : i32; + v80 = arith.add v63, v116 : i32 #[overflow = wrapping]; + v81 = builtin.global_symbol @miden:rust-sdk-input-note-get-sender-binding/rust-sdk-input-note-get-sender-binding@0.0.1/rust_sdk_input_note_get_sender_binding/__stack_pointer : ptr + v82 = hir.bitcast v81 : ptr; + hir.store v82, v80; + builtin.ret ; + }; + + private builtin.function @intrinsics::felt::from_u32(v83: i32) -> felt { + ^block17(v83: i32): + v84 = hir.bitcast v83 : felt; + builtin.ret v84; + }; + + private builtin.function @miden::input_note::get_sender(v86: felt, v87: i32) { + ^block19(v86: felt, v87: i32): + v88, v89 = hir.exec @miden/input_note/get_sender(v86) : felt, felt + v90 = hir.bitcast v87 : u32; + v91 = hir.int_to_ptr v90 : ptr; + hir.store v91, v88; + v92 = arith.constant 4 : u32; + v93 = arith.add v90, v92 : u32 #[overflow = checked]; + v94 = hir.int_to_ptr v93 : ptr; + hir.store v94, v89; + builtin.ret ; + }; + + builtin.global_variable private @#__stack_pointer : i32 { + builtin.ret_imm 1048576; + }; + + builtin.global_variable private @#GOT.data.internal.__memory_base : i32 { + builtin.ret_imm 0; + }; + + builtin.segment @1048576 = 0x0000000100000001; + }; + + public builtin.function @binding() -> felt, felt { + ^block23: + v95 = hir.exec @miden:rust-sdk-input-note-get-sender-binding/rust-sdk-input-note-get-sender-binding@0.0.1/rust_sdk_input_note_get_sender_binding/miden:rust-sdk-input-note-get-sender-binding/rust-sdk-input-note-get-sender-binding@0.0.1#binding() : i32 + v119 = arith.constant 0 : i32; + v96 = arith.constant 0 : i32; + v97 = arith.add v95, v96 : i32 #[overflow = unchecked]; + v99 = arith.add v97, v119 : i32 #[overflow = unchecked]; + v100 = hir.int_to_ptr v99 : ptr; + v101 = hir.load v100 : felt; + v118 = arith.constant 0 : i32; + v102 = arith.constant 4 : i32; + v103 = arith.add v95, v102 : i32 #[overflow = unchecked]; + v105 = arith.add v103, v118 : i32 #[overflow = unchecked]; + v106 = hir.int_to_ptr v105 : ptr; + v107 = hir.load v106 : felt; + builtin.ret v101, v107; + }; +}; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_sender_binding.masm b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_sender_binding.masm new file mode 100644 index 000000000..34fbc940c --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_sender_binding.masm @@ -0,0 +1,360 @@ +# mod miden:rust-sdk-input-note-get-sender-binding/rust-sdk-input-note-get-sender-binding@0.0.1 + +@callconv("canon-lift") +pub proc binding( + +) -> (felt, felt) + exec.::miden:rust-sdk-input-note-get-sender-binding/rust-sdk-input-note-get-sender-binding@0.0.1::init + trace.240 + nop + exec.::miden:rust-sdk-input-note-get-sender-binding/rust-sdk-input-note-get-sender-binding@0.0.1::rust_sdk_input_note_get_sender_binding::miden:rust-sdk-input-note-get-sender-binding/rust-sdk-input-note-get-sender-binding@0.0.1#binding + trace.252 + nop + push.0 + push.0 + dup.2 + u32wrapping_add + u32wrapping_add + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.0 + push.4 + movup.3 + u32wrapping_add + u32wrapping_add + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + swap.1 + exec.::std::sys::truncate_stack +end + +proc init + push.1179648 + trace.240 + exec.::intrinsics::mem::heap_init + trace.252 + push.[7028007876379170725,18060021366771303825,13412364500725888848,14178532912296021363] + adv.push_mapval + push.262144 + push.1 + trace.240 + exec.::std::mem::pipe_preimage_to_memory + trace.252 + drop + push.1048576 + u32assert + mem_store.278536 + push.0 + u32assert + mem_store.278537 +end + +# mod miden:rust-sdk-input-note-get-sender-binding/rust-sdk-input-note-get-sender-binding@0.0.1::rust_sdk_input_note_get_sender_binding + +@callconv("C") +proc __wasm_call_ctors( + +) + nop +end + +@callconv("C") +proc rust_sdk_input_note_get_sender_binding::bindings::__link_custom_section_describing_imports( + +) + nop +end + +@callconv("C") +proc miden:rust-sdk-input-note-get-sender-binding/rust-sdk-input-note-get-sender-binding@0.0.1#binding( + +) -> i32 + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.16 + u32wrapping_sub + push.1114144 + dup.1 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + trace.240 + nop + exec.::miden:rust-sdk-input-note-get-sender-binding/rust-sdk-input-note-get-sender-binding@0.0.1::rust_sdk_input_note_get_sender_binding::wit_bindgen::rt::run_ctors_once + trace.252 + nop + push.0 + trace.240 + nop + exec.::miden:rust-sdk-input-note-get-sender-binding/rust-sdk-input-note-get-sender-binding@0.0.1::rust_sdk_input_note_get_sender_binding::intrinsics::felt::from_u32 + trace.252 + nop + push.8 + dup.2 + u32wrapping_add + trace.240 + nop + exec.::miden:rust-sdk-input-note-get-sender-binding/rust-sdk-input-note-get-sender-binding@0.0.1::rust_sdk_input_note_get_sender_binding::miden_base_sys::bindings::input_note::get_sender + trace.252 + nop + push.1114148 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.1048584 + u32wrapping_add + push.8 + dup.2 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + dup.2 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.16 + movup.2 + u32wrapping_add + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop +end + +@callconv("C") +proc wit_bindgen::rt::run_ctors_once( + +) + push.1114148 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.1048592 + u32wrapping_add + u32divmod.4 + swap.1 + swap.1 + dup.1 + mem_load + swap.1 + push.8 + u32wrapping_mul + u32shr + swap.1 + drop + push.255 + u32and + push.0 + swap.1 + neq + if.true + nop + else + push.1114148 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + trace.240 + nop + exec.::miden:rust-sdk-input-note-get-sender-binding/rust-sdk-input-note-get-sender-binding@0.0.1::rust_sdk_input_note_get_sender_binding::__wasm_call_ctors + trace.252 + nop + push.1 + push.1048592 + movup.2 + u32wrapping_add + u32divmod.4 + swap.1 + dup.0 + mem_load + dup.2 + push.8 + u32wrapping_mul + push.255 + swap.1 + u32shl + u32not + swap.1 + u32and + movup.3 + movup.3 + push.8 + u32wrapping_mul + u32shl + u32or + swap.1 + mem_store + end +end + +@callconv("C") +proc miden_base_sys::bindings::input_note::get_sender( + i32, + felt +) + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.16 + u32wrapping_sub + push.1114144 + dup.1 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.8 + dup.1 + u32wrapping_add + movup.3 + trace.240 + nop + exec.::miden:rust-sdk-input-note-get-sender-binding/rust-sdk-input-note-get-sender-binding@0.0.1::rust_sdk_input_note_get_sender_binding::miden::input_note::get_sender + trace.252 + nop + push.8 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + movup.3 + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.16 + u32wrapping_add + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop +end + +@callconv("C") +proc intrinsics::felt::from_u32(i32) -> felt + nop +end + +@callconv("C") +proc miden::input_note::get_sender(felt, i32) + trace.240 + nop + exec.::miden::input_note::get_sender + trace.252 + nop + movup.2 + dup.0 + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.4 + add + u32assert + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop +end + diff --git a/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_sender_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_sender_binding.wat new file mode 100644 index 000000000..67fb8667a --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_sender_binding.wat @@ -0,0 +1,129 @@ +(component + (type (;0;) + (instance + (type (;0;) (record (field "inner" f32))) + (export (;1;) "felt" (type (eq 0))) + (type (;2;) (record (field "prefix" 1) (field "suffix" 1))) + (export (;3;) "account-id" (type (eq 2))) + ) + ) + (import "miden:base/core-types@1.0.0" (instance (;0;) (type 0))) + (core module (;0;) + (type (;0;) (func)) + (type (;1;) (func (result i32))) + (type (;2;) (func (param i32 f32))) + (type (;3;) (func (param i32) (result f32))) + (type (;4;) (func (param f32 i32))) + (table (;0;) 2 2 funcref) + (memory (;0;) 17) + (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) + (global $GOT.data.internal.__memory_base (;1;) i32 i32.const 0) + (export "memory" (memory 0)) + (export "miden:rust-sdk-input-note-get-sender-binding/rust-sdk-input-note-get-sender-binding@0.0.1#binding" (func $miden:rust-sdk-input-note-get-sender-binding/rust-sdk-input-note-get-sender-binding@0.0.1#binding)) + (elem (;0;) (i32.const 1) func $rust_sdk_input_note_get_sender_binding::bindings::__link_custom_section_describing_imports) + (func $__wasm_call_ctors (;0;) (type 0)) + (func $rust_sdk_input_note_get_sender_binding::bindings::__link_custom_section_describing_imports (;1;) (type 0)) + (func $miden:rust-sdk-input-note-get-sender-binding/rust-sdk-input-note-get-sender-binding@0.0.1#binding (;2;) (type 1) (result i32) + (local i32 i32) + global.get $__stack_pointer + i32.const 16 + i32.sub + local.tee 0 + global.set $__stack_pointer + call $wit_bindgen::rt::run_ctors_once + local.get 0 + i32.const 8 + i32.add + i32.const 0 + call $intrinsics::felt::from_u32 + call $miden_base_sys::bindings::input_note::get_sender + global.get $GOT.data.internal.__memory_base + i32.const 1048584 + i32.add + local.tee 1 + local.get 0 + i64.load offset=8 + i64.store align=4 + local.get 0 + i32.const 16 + i32.add + global.set $__stack_pointer + local.get 1 + ) + (func $wit_bindgen::rt::run_ctors_once (;3;) (type 0) + (local i32) + block ;; label = @1 + global.get $GOT.data.internal.__memory_base + i32.const 1048592 + i32.add + i32.load8_u + br_if 0 (;@1;) + global.get $GOT.data.internal.__memory_base + local.set 0 + call $__wasm_call_ctors + local.get 0 + i32.const 1048592 + i32.add + i32.const 1 + i32.store8 + end + ) + (func $miden_base_sys::bindings::input_note::get_sender (;4;) (type 2) (param i32 f32) + (local i32) + global.get $__stack_pointer + i32.const 16 + i32.sub + local.tee 2 + global.set $__stack_pointer + local.get 1 + local.get 2 + i32.const 8 + i32.add + call $miden::input_note::get_sender + local.get 0 + local.get 2 + i64.load offset=8 align=4 + i64.store + local.get 2 + i32.const 16 + i32.add + global.set $__stack_pointer + ) + (func $intrinsics::felt::from_u32 (;5;) (type 3) (param i32) (result f32) + unreachable + ) + (func $miden::input_note::get_sender (;6;) (type 4) (param f32 i32) + unreachable + ) + (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") + (@custom "rodata,miden_account" (after data) "Mrust_sdk_input_note_get_sender_binding\01\0b0.0.1\03\01\01\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00") + ) + (alias export 0 "account-id" (type (;1;))) + (core instance (;0;) (instantiate 0)) + (alias core export 0 "memory" (core memory (;0;))) + (type (;2;) (func (result 1))) + (alias core export 0 "miden:rust-sdk-input-note-get-sender-binding/rust-sdk-input-note-get-sender-binding@0.0.1#binding" (core func (;0;))) + (func (;0;) (type 2) (canon lift (core func 0) (memory 0))) + (alias export 0 "felt" (type (;3;))) + (alias export 0 "account-id" (type (;4;))) + (component (;0;) + (type (;0;) (record (field "inner" f32))) + (import "import-type-felt" (type (;1;) (eq 0))) + (type (;2;) (record (field "prefix" 1) (field "suffix" 1))) + (import "import-type-account-id" (type (;3;) (eq 2))) + (import "import-type-account-id0" (type (;4;) (eq 3))) + (type (;5;) (func (result 4))) + (import "import-func-binding" (func (;0;) (type 5))) + (export (;6;) "account-id" (type 3)) + (type (;7;) (func (result 6))) + (export (;1;) "binding" (func 0) (func (type 7))) + ) + (instance (;1;) (instantiate 0 + (with "import-func-binding" (func 0)) + (with "import-type-felt" (type 3)) + (with "import-type-account-id" (type 4)) + (with "import-type-account-id0" (type 1)) + ) + ) + (export (;2;) "miden:rust-sdk-input-note-get-sender-binding/rust-sdk-input-note-get-sender-binding@0.0.1" (instance 1)) +) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_serial_number_binding.hir b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_serial_number_binding.hir new file mode 100644 index 000000000..674511820 --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_serial_number_binding.hir @@ -0,0 +1,350 @@ +builtin.component miden:rust-sdk-input-note-get-serial-number-binding/rust-sdk-input-note-get-serial-number-binding@0.0.1 { + builtin.module public @rust_sdk_input_note_get_serial_number_binding { + private builtin.function @__wasm_call_ctors() { + ^block5: + builtin.ret ; + }; + + private builtin.function @rust_sdk_input_note_get_serial_number_binding::bindings::__link_custom_section_describing_imports() { + ^block7: + builtin.ret ; + }; + + private builtin.function @miden:rust-sdk-input-note-get-serial-number-binding/rust-sdk-input-note-get-serial-number-binding@0.0.1#binding() -> i32 { + ^block9: + v2 = builtin.global_symbol @miden:rust-sdk-input-note-get-serial-number-binding/rust-sdk-input-note-get-serial-number-binding@0.0.1/rust_sdk_input_note_get_serial_number_binding/__stack_pointer : ptr + v3 = hir.bitcast v2 : ptr; + v4 = hir.load v3 : i32; + v5 = arith.constant 16 : i32; + v6 = arith.sub v4, v5 : i32 #[overflow = wrapping]; + v7 = builtin.global_symbol @miden:rust-sdk-input-note-get-serial-number-binding/rust-sdk-input-note-get-serial-number-binding@0.0.1/rust_sdk_input_note_get_serial_number_binding/__stack_pointer : ptr + v8 = hir.bitcast v7 : ptr; + hir.store v8, v6; + hir.exec @miden:rust-sdk-input-note-get-serial-number-binding/rust-sdk-input-note-get-serial-number-binding@0.0.1/rust_sdk_input_note_get_serial_number_binding/wit_bindgen::rt::run_ctors_once() + v1 = arith.constant 0 : i32; + v10 = hir.exec @miden:rust-sdk-input-note-get-serial-number-binding/rust-sdk-input-note-get-serial-number-binding@0.0.1/rust_sdk_input_note_get_serial_number_binding/intrinsics::felt::from_u32(v1) : felt + hir.exec @miden:rust-sdk-input-note-get-serial-number-binding/rust-sdk-input-note-get-serial-number-binding@0.0.1/rust_sdk_input_note_get_serial_number_binding/miden_base_sys::bindings::input_note::get_serial_number(v6, v10) + v11 = builtin.global_symbol @miden:rust-sdk-input-note-get-serial-number-binding/rust-sdk-input-note-get-serial-number-binding@0.0.1/rust_sdk_input_note_get_serial_number_binding/GOT.data.internal.__memory_base : ptr + v12 = hir.bitcast v11 : ptr; + v13 = hir.load v12 : i32; + v14 = arith.constant 1048584 : i32; + v15 = arith.add v13, v14 : i32 #[overflow = wrapping]; + v17 = arith.constant 8 : u32; + v16 = hir.bitcast v6 : u32; + v18 = arith.add v16, v17 : u32 #[overflow = checked]; + v249 = arith.constant 8 : u32; + v20 = arith.mod v18, v249 : u32; + hir.assertz v20 #[code = 250]; + v21 = hir.int_to_ptr v18 : ptr; + v22 = hir.load v21 : i64; + v248 = arith.constant 8 : u32; + v23 = hir.bitcast v15 : u32; + v25 = arith.add v23, v248 : u32 #[overflow = checked]; + v26 = arith.constant 4 : u32; + v27 = arith.mod v25, v26 : u32; + hir.assertz v27 #[code = 250]; + v28 = hir.int_to_ptr v25 : ptr; + hir.store v28, v22; + v29 = hir.bitcast v6 : u32; + v247 = arith.constant 8 : u32; + v31 = arith.mod v29, v247 : u32; + hir.assertz v31 #[code = 250]; + v32 = hir.int_to_ptr v29 : ptr; + v33 = hir.load v32 : i64; + v34 = hir.bitcast v15 : u32; + v246 = arith.constant 4 : u32; + v36 = arith.mod v34, v246 : u32; + hir.assertz v36 #[code = 250]; + v37 = hir.int_to_ptr v34 : ptr; + hir.store v37, v33; + v245 = arith.constant 16 : i32; + v39 = arith.add v6, v245 : i32 #[overflow = wrapping]; + v40 = builtin.global_symbol @miden:rust-sdk-input-note-get-serial-number-binding/rust-sdk-input-note-get-serial-number-binding@0.0.1/rust_sdk_input_note_get_serial_number_binding/__stack_pointer : ptr + v41 = hir.bitcast v40 : ptr; + hir.store v41, v39; + builtin.ret v15; + }; + + private builtin.function @wit_bindgen::rt::run_ctors_once() { + ^block11: + v43 = builtin.global_symbol @miden:rust-sdk-input-note-get-serial-number-binding/rust-sdk-input-note-get-serial-number-binding@0.0.1/rust_sdk_input_note_get_serial_number_binding/GOT.data.internal.__memory_base : ptr + v44 = hir.bitcast v43 : ptr; + v45 = hir.load v44 : i32; + v46 = arith.constant 1048600 : i32; + v47 = arith.add v45, v46 : i32 #[overflow = wrapping]; + v48 = hir.bitcast v47 : u32; + v49 = hir.int_to_ptr v48 : ptr; + v50 = hir.load v49 : u8; + v42 = arith.constant 0 : i32; + v51 = arith.zext v50 : u32; + v52 = hir.bitcast v51 : i32; + v54 = arith.neq v52, v42 : i1; + scf.if v54{ + ^block13: + scf.yield ; + } else { + ^block14: + v55 = builtin.global_symbol @miden:rust-sdk-input-note-get-serial-number-binding/rust-sdk-input-note-get-serial-number-binding@0.0.1/rust_sdk_input_note_get_serial_number_binding/GOT.data.internal.__memory_base : ptr + v56 = hir.bitcast v55 : ptr; + v57 = hir.load v56 : i32; + hir.exec @miden:rust-sdk-input-note-get-serial-number-binding/rust-sdk-input-note-get-serial-number-binding@0.0.1/rust_sdk_input_note_get_serial_number_binding/__wasm_call_ctors() + v251 = arith.constant 1 : u8; + v253 = arith.constant 1048600 : i32; + v59 = arith.add v57, v253 : i32 #[overflow = wrapping]; + v63 = hir.bitcast v59 : u32; + v64 = hir.int_to_ptr v63 : ptr; + hir.store v64, v251; + scf.yield ; + }; + builtin.ret ; + }; + + private builtin.function @miden_base_sys::bindings::input_note::get_serial_number(v65: i32, v66: felt) { + ^block15(v65: i32, v66: felt): + v68 = builtin.global_symbol @miden:rust-sdk-input-note-get-serial-number-binding/rust-sdk-input-note-get-serial-number-binding@0.0.1/rust_sdk_input_note_get_serial_number_binding/__stack_pointer : ptr + v69 = hir.bitcast v68 : ptr; + v70 = hir.load v69 : i32; + v71 = arith.constant 32 : i32; + v72 = arith.sub v70, v71 : i32 #[overflow = wrapping]; + v73 = builtin.global_symbol @miden:rust-sdk-input-note-get-serial-number-binding/rust-sdk-input-note-get-serial-number-binding@0.0.1/rust_sdk_input_note_get_serial_number_binding/__stack_pointer : ptr + v74 = hir.bitcast v73 : ptr; + hir.store v74, v72; + hir.exec @miden:rust-sdk-input-note-get-serial-number-binding/rust-sdk-input-note-get-serial-number-binding@0.0.1/rust_sdk_input_note_get_serial_number_binding/miden::input_note::get_serial_number(v66, v72) + v76 = arith.constant 8 : u32; + v75 = hir.bitcast v72 : u32; + v77 = arith.add v75, v76 : u32 #[overflow = checked]; + v258 = arith.constant 8 : u32; + v79 = arith.mod v77, v258 : u32; + hir.assertz v79 #[code = 250]; + v80 = hir.int_to_ptr v77 : ptr; + v81 = hir.load v80 : i64; + v83 = arith.constant 24 : u32; + v82 = hir.bitcast v72 : u32; + v84 = arith.add v82, v83 : u32 #[overflow = checked]; + v257 = arith.constant 8 : u32; + v86 = arith.mod v84, v257 : u32; + hir.assertz v86 #[code = 250]; + v87 = hir.int_to_ptr v84 : ptr; + hir.store v87, v81; + v88 = hir.bitcast v72 : u32; + v256 = arith.constant 8 : u32; + v90 = arith.mod v88, v256 : u32; + hir.assertz v90 #[code = 250]; + v91 = hir.int_to_ptr v88 : ptr; + v92 = hir.load v91 : i64; + v94 = arith.constant 16 : u32; + v93 = hir.bitcast v72 : u32; + v95 = arith.add v93, v94 : u32 #[overflow = checked]; + v255 = arith.constant 8 : u32; + v97 = arith.mod v95, v255 : u32; + hir.assertz v97 #[code = 250]; + v98 = hir.int_to_ptr v95 : ptr; + hir.store v98, v92; + v99 = arith.constant 16 : i32; + v100 = arith.add v72, v99 : i32 #[overflow = wrapping]; + hir.exec @miden:rust-sdk-input-note-get-serial-number-binding/rust-sdk-input-note-get-serial-number-binding@0.0.1/rust_sdk_input_note_get_serial_number_binding/miden_stdlib_sys::intrinsics::word::Word::reverse(v65, v100) + v254 = arith.constant 32 : i32; + v102 = arith.add v72, v254 : i32 #[overflow = wrapping]; + v103 = builtin.global_symbol @miden:rust-sdk-input-note-get-serial-number-binding/rust-sdk-input-note-get-serial-number-binding@0.0.1/rust_sdk_input_note_get_serial_number_binding/__stack_pointer : ptr + v104 = hir.bitcast v103 : ptr; + hir.store v104, v102; + builtin.ret ; + }; + + private builtin.function @miden_stdlib_sys::intrinsics::word::Word::reverse(v105: i32, v106: i32) { + ^block17(v105: i32, v106: i32): + v109 = builtin.global_symbol @miden:rust-sdk-input-note-get-serial-number-binding/rust-sdk-input-note-get-serial-number-binding@0.0.1/rust_sdk_input_note_get_serial_number_binding/__stack_pointer : ptr + v110 = hir.bitcast v109 : ptr; + v111 = hir.load v110 : i32; + v112 = arith.constant 16 : i32; + v113 = arith.sub v111, v112 : i32 #[overflow = wrapping]; + v115 = arith.constant 8 : u32; + v114 = hir.bitcast v106 : u32; + v116 = arith.add v114, v115 : u32 #[overflow = checked]; + v345 = arith.constant 8 : u32; + v118 = arith.mod v116, v345 : u32; + hir.assertz v118 #[code = 250]; + v119 = hir.int_to_ptr v116 : ptr; + v120 = hir.load v119 : i64; + v344 = arith.constant 8 : u32; + v121 = hir.bitcast v113 : u32; + v123 = arith.add v121, v344 : u32 #[overflow = checked]; + v124 = arith.constant 4 : u32; + v125 = arith.mod v123, v124 : u32; + hir.assertz v125 #[code = 250]; + v126 = hir.int_to_ptr v123 : ptr; + hir.store v126, v120; + v127 = hir.bitcast v106 : u32; + v343 = arith.constant 8 : u32; + v129 = arith.mod v127, v343 : u32; + hir.assertz v129 #[code = 250]; + v130 = hir.int_to_ptr v127 : ptr; + v131 = hir.load v130 : i64; + v132 = hir.bitcast v113 : u32; + v342 = arith.constant 4 : u32; + v134 = arith.mod v132, v342 : u32; + hir.assertz v134 #[code = 250]; + v135 = hir.int_to_ptr v132 : ptr; + hir.store v135, v131; + v136 = arith.constant 12 : i32; + v137 = arith.add v113, v136 : i32 #[overflow = wrapping]; + v107 = arith.constant 0 : i32; + v313, v314, v315, v316, v317, v318 = scf.while v107, v113, v137, v105 : i32, i32, i32, i32, i32, i32 { + ^block39(v319: i32, v320: i32, v321: i32, v322: i32): + v341 = arith.constant 0 : i32; + v140 = arith.constant 8 : i32; + v141 = arith.eq v319, v140 : i1; + v142 = arith.zext v141 : u32; + v143 = hir.bitcast v142 : i32; + v145 = arith.neq v143, v341 : i1; + v307, v308 = scf.if v145 : i32, i32 { + ^block38: + v267 = ub.poison i32 : i32; + scf.yield v267, v267; + } else { + ^block22: + v147 = arith.add v320, v319 : i32 #[overflow = wrapping]; + v148 = hir.bitcast v147 : u32; + v340 = arith.constant 4 : u32; + v150 = arith.mod v148, v340 : u32; + hir.assertz v150 #[code = 250]; + v151 = hir.int_to_ptr v148 : ptr; + v152 = hir.load v151 : felt; + v154 = hir.bitcast v321 : u32; + v339 = arith.constant 4 : u32; + v156 = arith.mod v154, v339 : u32; + hir.assertz v156 #[code = 250]; + v157 = hir.int_to_ptr v154 : ptr; + v158 = hir.load v157 : i32; + v159 = hir.bitcast v147 : u32; + v338 = arith.constant 4 : u32; + v161 = arith.mod v159, v338 : u32; + hir.assertz v161 #[code = 250]; + v162 = hir.int_to_ptr v159 : ptr; + hir.store v162, v158; + v163 = hir.bitcast v321 : u32; + v337 = arith.constant 4 : u32; + v165 = arith.mod v163, v337 : u32; + hir.assertz v165 #[code = 250]; + v166 = hir.int_to_ptr v163 : ptr; + hir.store v166, v152; + v169 = arith.constant -4 : i32; + v170 = arith.add v321, v169 : i32 #[overflow = wrapping]; + v167 = arith.constant 4 : i32; + v168 = arith.add v319, v167 : i32 #[overflow = wrapping]; + scf.yield v168, v170; + }; + v335 = ub.poison i32 : i32; + v310 = cf.select v145, v335, v322 : i32; + v336 = ub.poison i32 : i32; + v309 = cf.select v145, v336, v320 : i32; + v266 = arith.constant 1 : u32; + v259 = arith.constant 0 : u32; + v312 = cf.select v145, v259, v266 : u32; + v300 = arith.trunc v312 : i1; + scf.condition v300, v307, v309, v308, v310, v320, v322; + } do { + ^block40(v323: i32, v324: i32, v325: i32, v326: i32, v327: i32, v328: i32): + scf.yield v323, v324, v325, v326; + }; + v334 = arith.constant 8 : u32; + v172 = hir.bitcast v317 : u32; + v174 = arith.add v172, v334 : u32 #[overflow = checked]; + v333 = arith.constant 4 : u32; + v176 = arith.mod v174, v333 : u32; + hir.assertz v176 #[code = 250]; + v177 = hir.int_to_ptr v174 : ptr; + v178 = hir.load v177 : i64; + v332 = arith.constant 8 : u32; + v179 = hir.bitcast v318 : u32; + v181 = arith.add v179, v332 : u32 #[overflow = checked]; + v331 = arith.constant 8 : u32; + v183 = arith.mod v181, v331 : u32; + hir.assertz v183 #[code = 250]; + v184 = hir.int_to_ptr v181 : ptr; + hir.store v184, v178; + v185 = hir.bitcast v317 : u32; + v330 = arith.constant 4 : u32; + v187 = arith.mod v185, v330 : u32; + hir.assertz v187 #[code = 250]; + v188 = hir.int_to_ptr v185 : ptr; + v189 = hir.load v188 : i64; + v190 = hir.bitcast v318 : u32; + v329 = arith.constant 8 : u32; + v192 = arith.mod v190, v329 : u32; + hir.assertz v192 #[code = 250]; + v193 = hir.int_to_ptr v190 : ptr; + hir.store v193, v189; + builtin.ret ; + }; + + private builtin.function @intrinsics::felt::from_u32(v194: i32) -> felt { + ^block23(v194: i32): + v195 = hir.bitcast v194 : felt; + builtin.ret v195; + }; + + private builtin.function @miden::input_note::get_serial_number(v197: felt, v198: i32) { + ^block25(v197: felt, v198: i32): + v199, v200, v201, v202 = hir.exec @miden/input_note/get_serial_number(v197) : felt, felt, felt, felt + v203 = hir.bitcast v198 : u32; + v204 = hir.int_to_ptr v203 : ptr; + hir.store v204, v199; + v205 = arith.constant 4 : u32; + v206 = arith.add v203, v205 : u32 #[overflow = checked]; + v207 = hir.int_to_ptr v206 : ptr; + hir.store v207, v200; + v208 = arith.constant 8 : u32; + v209 = arith.add v203, v208 : u32 #[overflow = checked]; + v210 = hir.int_to_ptr v209 : ptr; + hir.store v210, v201; + v211 = arith.constant 12 : u32; + v212 = arith.add v203, v211 : u32 #[overflow = checked]; + v213 = hir.int_to_ptr v212 : ptr; + hir.store v213, v202; + builtin.ret ; + }; + + builtin.global_variable private @#__stack_pointer : i32 { + builtin.ret_imm 1048576; + }; + + builtin.global_variable private @#GOT.data.internal.__memory_base : i32 { + builtin.ret_imm 0; + }; + + builtin.segment @1048576 = 0x0000000100000001; + }; + + public builtin.function @binding() -> felt, felt, felt, felt { + ^block29: + v214 = hir.exec @miden:rust-sdk-input-note-get-serial-number-binding/rust-sdk-input-note-get-serial-number-binding@0.0.1/rust_sdk_input_note_get_serial_number_binding/miden:rust-sdk-input-note-get-serial-number-binding/rust-sdk-input-note-get-serial-number-binding@0.0.1#binding() : i32 + v215 = arith.constant 0 : i32; + v216 = arith.add v214, v215 : i32 #[overflow = unchecked]; + v349 = arith.constant 0 : i32; + v350 = arith.constant 0 : i32; + v218 = arith.add v216, v350 : i32 #[overflow = unchecked]; + v220 = arith.add v218, v349 : i32 #[overflow = unchecked]; + v221 = hir.int_to_ptr v220 : ptr; + v222 = hir.load v221 : felt; + v348 = arith.constant 0 : i32; + v223 = arith.constant 4 : i32; + v224 = arith.add v216, v223 : i32 #[overflow = unchecked]; + v226 = arith.add v224, v348 : i32 #[overflow = unchecked]; + v227 = hir.int_to_ptr v226 : ptr; + v228 = hir.load v227 : felt; + v347 = arith.constant 0 : i32; + v229 = arith.constant 8 : i32; + v230 = arith.add v216, v229 : i32 #[overflow = unchecked]; + v232 = arith.add v230, v347 : i32 #[overflow = unchecked]; + v233 = hir.int_to_ptr v232 : ptr; + v234 = hir.load v233 : felt; + v346 = arith.constant 0 : i32; + v235 = arith.constant 12 : i32; + v236 = arith.add v216, v235 : i32 #[overflow = unchecked]; + v238 = arith.add v236, v346 : i32 #[overflow = unchecked]; + v239 = hir.int_to_ptr v238 : ptr; + v240 = hir.load v239 : felt; + builtin.ret v222, v228, v234, v240; + }; +}; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_serial_number_binding.masm b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_serial_number_binding.masm new file mode 100644 index 000000000..d645c6580 --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_serial_number_binding.masm @@ -0,0 +1,748 @@ +# mod miden:rust-sdk-input-note-get-serial-number-binding/rust-sdk-input-note-get-serial-number-binding@0.0.1 + +@callconv("canon-lift") +pub proc binding( + +) -> (felt, felt, felt, felt) + exec.::miden:rust-sdk-input-note-get-serial-number-binding/rust-sdk-input-note-get-serial-number-binding@0.0.1::init + trace.240 + nop + exec.::miden:rust-sdk-input-note-get-serial-number-binding/rust-sdk-input-note-get-serial-number-binding@0.0.1::rust_sdk_input_note_get_serial_number_binding::miden:rust-sdk-input-note-get-serial-number-binding/rust-sdk-input-note-get-serial-number-binding@0.0.1#binding + trace.252 + nop + push.0 + u32wrapping_add + push.0 + push.0 + dup.2 + u32wrapping_add + u32wrapping_add + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.0 + push.4 + dup.3 + u32wrapping_add + u32wrapping_add + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.0 + push.8 + dup.4 + u32wrapping_add + u32wrapping_add + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.0 + push.12 + movup.5 + u32wrapping_add + u32wrapping_add + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + movdn.3 + swap.2 + exec.::std::sys::truncate_stack +end + +proc init + push.1179648 + trace.240 + exec.::intrinsics::mem::heap_init + trace.252 + push.[7028007876379170725,18060021366771303825,13412364500725888848,14178532912296021363] + adv.push_mapval + push.262144 + push.1 + trace.240 + exec.::std::mem::pipe_preimage_to_memory + trace.252 + drop + push.1048576 + u32assert + mem_store.278536 + push.0 + u32assert + mem_store.278537 +end + +# mod miden:rust-sdk-input-note-get-serial-number-binding/rust-sdk-input-note-get-serial-number-binding@0.0.1::rust_sdk_input_note_get_serial_number_binding + +@callconv("C") +proc __wasm_call_ctors( + +) + nop +end + +@callconv("C") +proc rust_sdk_input_note_get_serial_number_binding::bindings::__link_custom_section_describing_imports( + +) + nop +end + +@callconv("C") +proc miden:rust-sdk-input-note-get-serial-number-binding/rust-sdk-input-note-get-serial-number-binding@0.0.1#binding( + +) -> i32 + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.16 + u32wrapping_sub + push.1114144 + dup.1 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + trace.240 + nop + exec.::miden:rust-sdk-input-note-get-serial-number-binding/rust-sdk-input-note-get-serial-number-binding@0.0.1::rust_sdk_input_note_get_serial_number_binding::wit_bindgen::rt::run_ctors_once + trace.252 + nop + push.0 + trace.240 + nop + exec.::miden:rust-sdk-input-note-get-serial-number-binding/rust-sdk-input-note-get-serial-number-binding@0.0.1::rust_sdk_input_note_get_serial_number_binding::intrinsics::felt::from_u32 + trace.252 + nop + dup.1 + trace.240 + nop + exec.::miden:rust-sdk-input-note-get-serial-number-binding/rust-sdk-input-note-get-serial-number-binding@0.0.1::rust_sdk_input_note_get_serial_number_binding::miden_base_sys::bindings::input_note::get_serial_number + trace.252 + nop + push.1114148 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.1048584 + u32wrapping_add + push.8 + dup.2 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.8 + dup.3 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + dup.1 + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + dup.2 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.16 + movup.2 + u32wrapping_add + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop +end + +@callconv("C") +proc wit_bindgen::rt::run_ctors_once( + +) + push.1114148 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.1048600 + u32wrapping_add + u32divmod.4 + swap.1 + swap.1 + dup.1 + mem_load + swap.1 + push.8 + u32wrapping_mul + u32shr + swap.1 + drop + push.255 + u32and + push.0 + swap.1 + neq + if.true + nop + else + push.1114148 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + trace.240 + nop + exec.::miden:rust-sdk-input-note-get-serial-number-binding/rust-sdk-input-note-get-serial-number-binding@0.0.1::rust_sdk_input_note_get_serial_number_binding::__wasm_call_ctors + trace.252 + nop + push.1 + push.1048600 + movup.2 + u32wrapping_add + u32divmod.4 + swap.1 + dup.0 + mem_load + dup.2 + push.8 + u32wrapping_mul + push.255 + swap.1 + u32shl + u32not + swap.1 + u32and + movup.3 + movup.3 + push.8 + u32wrapping_mul + u32shl + u32or + swap.1 + mem_store + end +end + +@callconv("C") +proc miden_base_sys::bindings::input_note::get_serial_number( + i32, + felt +) + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.32 + u32wrapping_sub + push.1114144 + dup.1 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + dup.0 + movup.3 + trace.240 + nop + exec.::miden:rust-sdk-input-note-get-serial-number-binding/rust-sdk-input-note-get-serial-number-binding@0.0.1::rust_sdk_input_note_get_serial_number_binding::miden::input_note::get_serial_number + trace.252 + nop + push.8 + dup.1 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.24 + dup.3 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + dup.0 + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.16 + dup.3 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.16 + dup.1 + u32wrapping_add + movup.2 + trace.240 + nop + exec.::miden:rust-sdk-input-note-get-serial-number-binding/rust-sdk-input-note-get-serial-number-binding@0.0.1::rust_sdk_input_note_get_serial_number_binding::miden_stdlib_sys::intrinsics::word::Word::reverse + trace.252 + nop + push.32 + u32wrapping_add + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop +end + +@callconv("C") +proc miden_stdlib_sys::intrinsics::word::Word::reverse( + i32, + i32 +) + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.16 + u32wrapping_sub + push.8 + dup.3 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.8 + dup.3 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + movup.2 + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + dup.2 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.12 + dup.1 + u32wrapping_add + push.0 + movup.2 + swap.1 + push.1 + while.true + push.0 + push.8 + dup.2 + eq + neq + dup.0 + if.true + movup.3 + movup.2 + drop + drop + push.3735929054 + dup.0 + else + dup.2 + dup.2 + u32wrapping_add + dup.0 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + dup.5 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + movup.2 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + dup.4 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.4294967292 + movup.4 + u32wrapping_add + push.4 + movup.3 + u32wrapping_add + end + push.3735929054 + dup.3 + dup.6 + swap.2 + swap.1 + cdrop + push.3735929054 + dup.4 + dup.6 + swap.2 + swap.1 + cdrop + push.1 + push.0 + movup.6 + cdrop + push.1 + u32and + swap.1 + swap.2 + swap.4 + swap.3 + swap.1 + if.true + movup.4 + drop + movup.4 + drop + push.1 + else + push.0 + end + end + drop + drop + drop + drop + push.8 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.8 + dup.4 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + movup.2 + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop +end + +@callconv("C") +proc intrinsics::felt::from_u32(i32) -> felt + nop +end + +@callconv("C") +proc miden::input_note::get_serial_number(felt, i32) + trace.240 + nop + exec.::miden::input_note::get_serial_number + trace.252 + nop + movup.4 + dup.0 + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.4 + dup.1 + add + u32assert + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.8 + dup.1 + add + u32assert + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.12 + add + u32assert + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop +end + diff --git a/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_serial_number_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_serial_number_binding.wat new file mode 100644 index 000000000..150d7536e --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_serial_number_binding.wat @@ -0,0 +1,199 @@ +(component + (type (;0;) + (instance + (type (;0;) (record (field "inner" f32))) + (export (;1;) "felt" (type (eq 0))) + (type (;2;) (tuple 1 1 1 1)) + (type (;3;) (record (field "inner" 2))) + (export (;4;) "word" (type (eq 3))) + ) + ) + (import "miden:base/core-types@1.0.0" (instance (;0;) (type 0))) + (core module (;0;) + (type (;0;) (func)) + (type (;1;) (func (result i32))) + (type (;2;) (func (param i32 f32))) + (type (;3;) (func (param i32 i32))) + (type (;4;) (func (param i32) (result f32))) + (type (;5;) (func (param f32 i32))) + (table (;0;) 2 2 funcref) + (memory (;0;) 17) + (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) + (global $GOT.data.internal.__memory_base (;1;) i32 i32.const 0) + (export "memory" (memory 0)) + (export "miden:rust-sdk-input-note-get-serial-number-binding/rust-sdk-input-note-get-serial-number-binding@0.0.1#binding" (func $miden:rust-sdk-input-note-get-serial-number-binding/rust-sdk-input-note-get-serial-number-binding@0.0.1#binding)) + (elem (;0;) (i32.const 1) func $rust_sdk_input_note_get_serial_number_binding::bindings::__link_custom_section_describing_imports) + (func $__wasm_call_ctors (;0;) (type 0)) + (func $rust_sdk_input_note_get_serial_number_binding::bindings::__link_custom_section_describing_imports (;1;) (type 0)) + (func $miden:rust-sdk-input-note-get-serial-number-binding/rust-sdk-input-note-get-serial-number-binding@0.0.1#binding (;2;) (type 1) (result i32) + (local i32 i32) + global.get $__stack_pointer + i32.const 16 + i32.sub + local.tee 0 + global.set $__stack_pointer + call $wit_bindgen::rt::run_ctors_once + local.get 0 + i32.const 0 + call $intrinsics::felt::from_u32 + call $miden_base_sys::bindings::input_note::get_serial_number + global.get $GOT.data.internal.__memory_base + i32.const 1048584 + i32.add + local.tee 1 + local.get 0 + i64.load offset=8 + i64.store offset=8 align=4 + local.get 1 + local.get 0 + i64.load + i64.store align=4 + local.get 0 + i32.const 16 + i32.add + global.set $__stack_pointer + local.get 1 + ) + (func $wit_bindgen::rt::run_ctors_once (;3;) (type 0) + (local i32) + block ;; label = @1 + global.get $GOT.data.internal.__memory_base + i32.const 1048600 + i32.add + i32.load8_u + br_if 0 (;@1;) + global.get $GOT.data.internal.__memory_base + local.set 0 + call $__wasm_call_ctors + local.get 0 + i32.const 1048600 + i32.add + i32.const 1 + i32.store8 + end + ) + (func $miden_base_sys::bindings::input_note::get_serial_number (;4;) (type 2) (param i32 f32) + (local i32) + global.get $__stack_pointer + i32.const 32 + i32.sub + local.tee 2 + global.set $__stack_pointer + local.get 1 + local.get 2 + call $miden::input_note::get_serial_number + local.get 2 + local.get 2 + i64.load offset=8 + i64.store offset=24 + local.get 2 + local.get 2 + i64.load + i64.store offset=16 + local.get 0 + local.get 2 + i32.const 16 + i32.add + call $miden_stdlib_sys::intrinsics::word::Word::reverse + local.get 2 + i32.const 32 + i32.add + global.set $__stack_pointer + ) + (func $miden_stdlib_sys::intrinsics::word::Word::reverse (;5;) (type 3) (param i32 i32) + (local i32 i32 i32 f32) + global.get $__stack_pointer + i32.const 16 + i32.sub + local.tee 2 + local.get 1 + i64.load offset=8 + i64.store offset=8 align=4 + local.get 2 + local.get 1 + i64.load + i64.store align=4 + local.get 2 + i32.const 12 + i32.add + local.set 3 + i32.const 0 + local.set 1 + block ;; label = @1 + loop ;; label = @2 + local.get 1 + i32.const 8 + i32.eq + br_if 1 (;@1;) + local.get 2 + local.get 1 + i32.add + local.tee 4 + f32.load + local.set 5 + local.get 4 + local.get 3 + i32.load + i32.store + local.get 3 + local.get 5 + f32.store + local.get 1 + i32.const 4 + i32.add + local.set 1 + local.get 3 + i32.const -4 + i32.add + local.set 3 + br 0 (;@2;) + end + end + local.get 0 + local.get 2 + i64.load offset=8 align=4 + i64.store offset=8 + local.get 0 + local.get 2 + i64.load align=4 + i64.store + ) + (func $intrinsics::felt::from_u32 (;6;) (type 4) (param i32) (result f32) + unreachable + ) + (func $miden::input_note::get_serial_number (;7;) (type 5) (param f32 i32) + unreachable + ) + (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") + (@custom "rodata,miden_account" (after data) "[rust_sdk_input_note_get_serial_number_binding\01\0b0.0.1\03\01\01\00\00\00\00\00\00\00\00") + ) + (alias export 0 "word" (type (;1;))) + (core instance (;0;) (instantiate 0)) + (alias core export 0 "memory" (core memory (;0;))) + (type (;2;) (func (result 1))) + (alias core export 0 "miden:rust-sdk-input-note-get-serial-number-binding/rust-sdk-input-note-get-serial-number-binding@0.0.1#binding" (core func (;0;))) + (func (;0;) (type 2) (canon lift (core func 0) (memory 0))) + (alias export 0 "felt" (type (;3;))) + (alias export 0 "word" (type (;4;))) + (component (;0;) + (type (;0;) (record (field "inner" f32))) + (import "import-type-felt" (type (;1;) (eq 0))) + (type (;2;) (tuple 1 1 1 1)) + (type (;3;) (record (field "inner" 2))) + (import "import-type-word" (type (;4;) (eq 3))) + (import "import-type-word0" (type (;5;) (eq 4))) + (type (;6;) (func (result 5))) + (import "import-func-binding" (func (;0;) (type 6))) + (export (;7;) "word" (type 4)) + (type (;8;) (func (result 7))) + (export (;1;) "binding" (func 0) (func (type 8))) + ) + (instance (;1;) (instantiate 0 + (with "import-func-binding" (func 0)) + (with "import-type-felt" (type 3)) + (with "import-type-word" (type 4)) + (with "import-type-word0" (type 1)) + ) + ) + (export (;2;) "miden:rust-sdk-input-note-get-serial-number-binding/rust-sdk-input-note-get-serial-number-binding@0.0.1" (instance 1)) +) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_note_add_assets_to_account_binding.hir b/tests/integration/expected/rust_sdk/rust_sdk_note_add_assets_to_account_binding.hir new file mode 100644 index 000000000..605781bba --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_note_add_assets_to_account_binding.hir @@ -0,0 +1,76 @@ +builtin.component miden:base/note-script@1.0.0 { + builtin.module public @rust_sdk_note_add_assets_to_account_binding { + private builtin.function @__wasm_call_ctors() { + ^block5: + builtin.ret ; + }; + + private builtin.function @rust_sdk_note_add_assets_to_account_binding::bindings::__link_custom_section_describing_imports() { + ^block7: + builtin.ret ; + }; + + private builtin.function @miden:base/note-script@1.0.0#run(v0: felt, v1: felt, v2: felt, v3: felt) { + ^block9(v0: felt, v1: felt, v2: felt, v3: felt): + hir.exec @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/wit_bindgen::rt::run_ctors_once() + hir.exec @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/miden::active_note::add_assets_to_account() + builtin.ret ; + }; + + private builtin.function @wit_bindgen::rt::run_ctors_once() { + ^block11: + v5 = builtin.global_symbol @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/GOT.data.internal.__memory_base : ptr + v6 = hir.bitcast v5 : ptr; + v7 = hir.load v6 : i32; + v8 = arith.constant 1048584 : i32; + v9 = arith.add v7, v8 : i32 #[overflow = wrapping]; + v10 = hir.bitcast v9 : u32; + v11 = hir.int_to_ptr v10 : ptr; + v12 = hir.load v11 : u8; + v4 = arith.constant 0 : i32; + v13 = arith.zext v12 : u32; + v14 = hir.bitcast v13 : i32; + v16 = arith.neq v14, v4 : i1; + scf.if v16{ + ^block13: + scf.yield ; + } else { + ^block14: + v17 = builtin.global_symbol @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/GOT.data.internal.__memory_base : ptr + v18 = hir.bitcast v17 : ptr; + v19 = hir.load v18 : i32; + hir.exec @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/__wasm_call_ctors() + v32 = arith.constant 1 : u8; + v34 = arith.constant 1048584 : i32; + v21 = arith.add v19, v34 : i32 #[overflow = wrapping]; + v25 = hir.bitcast v21 : u32; + v26 = hir.int_to_ptr v25 : ptr; + hir.store v26, v32; + scf.yield ; + }; + builtin.ret ; + }; + + private builtin.function @miden::active_note::add_assets_to_account() { + ^block15: + hir.exec @miden/active_note/add_assets_to_account() + builtin.ret ; + }; + + builtin.global_variable private @#__stack_pointer : i32 { + builtin.ret_imm 1048576; + }; + + builtin.global_variable private @#GOT.data.internal.__memory_base : i32 { + builtin.ret_imm 0; + }; + + builtin.segment @1048576 = 0x0000000100000001; + }; + + public builtin.function @run(v27: felt, v28: felt, v29: felt, v30: felt) { + ^block19(v27: felt, v28: felt, v29: felt, v30: felt): + hir.exec @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/miden:base/note-script@1.0.0#run(v27, v28, v29, v30) + builtin.ret ; + }; +}; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/rust_sdk_note_add_assets_to_account_binding.masm b/tests/integration/expected/rust_sdk/rust_sdk_note_add_assets_to_account_binding.masm new file mode 100644 index 000000000..12e8dab54 --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_note_add_assets_to_account_binding.masm @@ -0,0 +1,153 @@ +# mod miden:base/note-script@1.0.0 + +@callconv("canon-lift") +pub proc run(felt, felt, felt, felt) + exec.::miden:base/note-script@1.0.0::init + trace.240 + nop + exec.::miden:base/note-script@1.0.0::rust_sdk_note_add_assets_to_account_binding::miden:base/note-script@1.0.0#run + trace.252 + nop + exec.::std::sys::truncate_stack +end + +proc init + push.1179648 + trace.240 + exec.::intrinsics::mem::heap_init + trace.252 + push.[7028007876379170725,18060021366771303825,13412364500725888848,14178532912296021363] + adv.push_mapval + push.262144 + push.1 + trace.240 + exec.::std::mem::pipe_preimage_to_memory + trace.252 + drop + push.1048576 + u32assert + mem_store.278536 + push.0 + u32assert + mem_store.278537 +end + +# mod miden:base/note-script@1.0.0::rust_sdk_note_add_assets_to_account_binding + +@callconv("C") +proc __wasm_call_ctors( + +) + nop +end + +@callconv("C") +proc rust_sdk_note_add_assets_to_account_binding::bindings::__link_custom_section_describing_imports( + +) + nop +end + +@callconv("C") +proc miden:base/note-script@1.0.0#run(felt, felt, felt, felt) + drop + drop + drop + drop + trace.240 + nop + exec.::miden:base/note-script@1.0.0::rust_sdk_note_add_assets_to_account_binding::wit_bindgen::rt::run_ctors_once + trace.252 + nop + trace.240 + nop + exec.::miden:base/note-script@1.0.0::rust_sdk_note_add_assets_to_account_binding::miden::active_note::add_assets_to_account + trace.252 + nop +end + +@callconv("C") +proc wit_bindgen::rt::run_ctors_once( + +) + push.1114148 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.1048584 + u32wrapping_add + u32divmod.4 + swap.1 + swap.1 + dup.1 + mem_load + swap.1 + push.8 + u32wrapping_mul + u32shr + swap.1 + drop + push.255 + u32and + push.0 + swap.1 + neq + if.true + nop + else + push.1114148 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + trace.240 + nop + exec.::miden:base/note-script@1.0.0::rust_sdk_note_add_assets_to_account_binding::__wasm_call_ctors + trace.252 + nop + push.1 + push.1048584 + movup.2 + u32wrapping_add + u32divmod.4 + swap.1 + dup.0 + mem_load + dup.2 + push.8 + u32wrapping_mul + push.255 + swap.1 + u32shl + u32not + swap.1 + u32and + movup.3 + movup.3 + push.8 + u32wrapping_mul + u32shl + u32or + swap.1 + mem_store + end +end + +@callconv("C") +proc miden::active_note::add_assets_to_account( + +) + trace.240 + nop + exec.::miden::active_note::add_assets_to_account + trace.252 + nop +end + diff --git a/tests/integration/expected/rust_sdk/rust_sdk_note_add_assets_to_account_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_note_add_assets_to_account_binding.wat new file mode 100644 index 000000000..fac0feec8 --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_note_add_assets_to_account_binding.wat @@ -0,0 +1,80 @@ +(component + (type (;0;) + (instance + (type (;0;) (record (field "inner" f32))) + (export (;1;) "felt" (type (eq 0))) + (type (;2;) (tuple 1 1 1 1)) + (type (;3;) (record (field "inner" 2))) + (export (;4;) "word" (type (eq 3))) + ) + ) + (import "miden:base/core-types@1.0.0" (instance (;0;) (type 0))) + (core module (;0;) + (type (;0;) (func)) + (type (;1;) (func (param f32 f32 f32 f32))) + (table (;0;) 2 2 funcref) + (memory (;0;) 17) + (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) + (global $GOT.data.internal.__memory_base (;1;) i32 i32.const 0) + (export "memory" (memory 0)) + (export "miden:base/note-script@1.0.0#run" (func $miden:base/note-script@1.0.0#run)) + (elem (;0;) (i32.const 1) func $rust_sdk_note_add_assets_to_account_binding::bindings::__link_custom_section_describing_imports) + (func $__wasm_call_ctors (;0;) (type 0)) + (func $rust_sdk_note_add_assets_to_account_binding::bindings::__link_custom_section_describing_imports (;1;) (type 0)) + (func $miden:base/note-script@1.0.0#run (;2;) (type 1) (param f32 f32 f32 f32) + call $wit_bindgen::rt::run_ctors_once + call $miden::active_note::add_assets_to_account + ) + (func $wit_bindgen::rt::run_ctors_once (;3;) (type 0) + (local i32) + block ;; label = @1 + global.get $GOT.data.internal.__memory_base + i32.const 1048584 + i32.add + i32.load8_u + br_if 0 (;@1;) + global.get $GOT.data.internal.__memory_base + local.set 0 + call $__wasm_call_ctors + local.get 0 + i32.const 1048584 + i32.add + i32.const 1 + i32.store8 + end + ) + (func $miden::active_note::add_assets_to_account (;4;) (type 0) + unreachable + ) + (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") + ) + (alias export 0 "word" (type (;1;))) + (core instance (;0;) (instantiate 0)) + (alias core export 0 "memory" (core memory (;0;))) + (type (;2;) (func (param "arg" 1))) + (alias core export 0 "miden:base/note-script@1.0.0#run" (core func (;0;))) + (func (;0;) (type 2) (canon lift (core func 0))) + (alias export 0 "felt" (type (;3;))) + (alias export 0 "word" (type (;4;))) + (component (;0;) + (type (;0;) (record (field "inner" f32))) + (import "import-type-felt" (type (;1;) (eq 0))) + (type (;2;) (tuple 1 1 1 1)) + (type (;3;) (record (field "inner" 2))) + (import "import-type-word" (type (;4;) (eq 3))) + (import "import-type-word0" (type (;5;) (eq 4))) + (type (;6;) (func (param "arg" 5))) + (import "import-func-run" (func (;0;) (type 6))) + (export (;7;) "word" (type 4)) + (type (;8;) (func (param "arg" 7))) + (export (;1;) "run" (func 0) (func (type 8))) + ) + (instance (;1;) (instantiate 0 + (with "import-func-run" (func 0)) + (with "import-type-felt" (type 3)) + (with "import-type-word" (type 4)) + (with "import-type-word0" (type 1)) + ) + ) + (export (;2;) "miden:base/note-script@1.0.0" (instance 1)) +) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_output_note_add_asset_binding.hir b/tests/integration/expected/rust_sdk/rust_sdk_output_note_add_asset_binding.hir new file mode 100644 index 000000000..d0f5bde76 --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_output_note_add_asset_binding.hir @@ -0,0 +1,214 @@ +builtin.component miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-note-add-asset-binding@0.0.1 { + builtin.module public @rust_sdk_output_note_add_asset_binding { + private builtin.function @__wasm_call_ctors() { + ^block5: + builtin.ret ; + }; + + private builtin.function @rust_sdk_output_note_add_asset_binding::bindings::__link_custom_section_describing_imports() { + ^block7: + builtin.ret ; + }; + + private builtin.function @miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-note-add-asset-binding@0.0.1#binding() -> felt { + ^block9: + v3 = builtin.global_symbol @miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-note-add-asset-binding@0.0.1/rust_sdk_output_note_add_asset_binding/__stack_pointer : ptr + v4 = hir.bitcast v3 : ptr; + v5 = hir.load v4 : i32; + v6 = arith.constant 32 : i32; + v7 = arith.sub v5, v6 : i32 #[overflow = wrapping]; + v8 = builtin.global_symbol @miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-note-add-asset-binding@0.0.1/rust_sdk_output_note_add_asset_binding/__stack_pointer : ptr + v9 = hir.bitcast v8 : ptr; + hir.store v9, v7; + hir.exec @miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-note-add-asset-binding@0.0.1/rust_sdk_output_note_add_asset_binding/wit_bindgen::rt::run_ctors_once() + v1 = arith.constant 0 : i32; + v12 = hir.exec @miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-note-add-asset-binding@0.0.1/rust_sdk_output_note_add_asset_binding/intrinsics::felt::from_u32(v1) : felt + v185 = arith.constant 0 : i32; + v167, v168, v169, v170 = scf.while v185, v7, v12 : i32, i32, felt, i32 { + ^block38(v171: i32, v172: i32, v173: felt): + v184 = arith.constant 0 : i32; + v31 = arith.constant 16 : i32; + v15 = arith.eq v171, v31 : i1; + v16 = arith.zext v15 : u32; + v17 = hir.bitcast v16 : i32; + v19 = arith.neq v17, v184 : i1; + v162 = scf.if v19 : i32 { + ^block37: + v133 = ub.poison i32 : i32; + scf.yield v133; + } else { + ^block14: + v183 = arith.constant 16 : i32; + v22 = arith.add v172, v183 : i32 #[overflow = wrapping]; + v23 = arith.add v22, v171 : i32 #[overflow = wrapping]; + v25 = hir.bitcast v23 : u32; + v26 = arith.constant 4 : u32; + v27 = arith.mod v25, v26 : u32; + hir.assertz v27 #[code = 250]; + v28 = hir.int_to_ptr v25 : ptr; + hir.store v28, v173; + v29 = arith.constant 4 : i32; + v30 = arith.add v171, v29 : i32 #[overflow = wrapping]; + scf.yield v30; + }; + v134 = ub.poison felt : felt; + v164 = cf.select v19, v134, v173 : felt; + v182 = ub.poison i32 : i32; + v163 = cf.select v19, v182, v172 : i32; + v132 = arith.constant 1 : u32; + v126 = arith.constant 0 : u32; + v166 = cf.select v19, v126, v132 : u32; + v156 = arith.trunc v166 : i1; + scf.condition v156, v162, v163, v164, v172; + } do { + ^block39(v174: i32, v175: i32, v176: felt, v177: i32): + scf.yield v174, v175, v176; + }; + v181 = arith.constant 16 : i32; + v32 = arith.add v170, v181 : i32 #[overflow = wrapping]; + hir.exec @miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-note-add-asset-binding@0.0.1/rust_sdk_output_note_add_asset_binding/>::from(v170, v32) + v180 = arith.constant 0 : i32; + v34 = hir.exec @miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-note-add-asset-binding@0.0.1/rust_sdk_output_note_add_asset_binding/intrinsics::felt::from_u32(v180) : felt + hir.exec @miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-note-add-asset-binding@0.0.1/rust_sdk_output_note_add_asset_binding/miden_base_sys::bindings::output_note::add_asset(v170, v34) + v179 = arith.constant 0 : i32; + v36 = hir.exec @miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-note-add-asset-binding@0.0.1/rust_sdk_output_note_add_asset_binding/intrinsics::felt::from_u32(v179) : felt + v178 = arith.constant 32 : i32; + v38 = arith.add v170, v178 : i32 #[overflow = wrapping]; + v39 = builtin.global_symbol @miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-note-add-asset-binding@0.0.1/rust_sdk_output_note_add_asset_binding/__stack_pointer : ptr + v40 = hir.bitcast v39 : ptr; + hir.store v40, v38; + builtin.ret v36; + }; + + private builtin.function @wit_bindgen::rt::run_ctors_once() { + ^block15: + v42 = builtin.global_symbol @miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-note-add-asset-binding@0.0.1/rust_sdk_output_note_add_asset_binding/GOT.data.internal.__memory_base : ptr + v43 = hir.bitcast v42 : ptr; + v44 = hir.load v43 : i32; + v45 = arith.constant 1048584 : i32; + v46 = arith.add v44, v45 : i32 #[overflow = wrapping]; + v47 = hir.bitcast v46 : u32; + v48 = hir.int_to_ptr v47 : ptr; + v49 = hir.load v48 : u8; + v41 = arith.constant 0 : i32; + v50 = arith.zext v49 : u32; + v51 = hir.bitcast v50 : i32; + v53 = arith.neq v51, v41 : i1; + scf.if v53{ + ^block17: + scf.yield ; + } else { + ^block18: + v54 = builtin.global_symbol @miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-note-add-asset-binding@0.0.1/rust_sdk_output_note_add_asset_binding/GOT.data.internal.__memory_base : ptr + v55 = hir.bitcast v54 : ptr; + v56 = hir.load v55 : i32; + hir.exec @miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-note-add-asset-binding@0.0.1/rust_sdk_output_note_add_asset_binding/__wasm_call_ctors() + v187 = arith.constant 1 : u8; + v189 = arith.constant 1048584 : i32; + v58 = arith.add v56, v189 : i32 #[overflow = wrapping]; + v62 = hir.bitcast v58 : u32; + v63 = hir.int_to_ptr v62 : ptr; + hir.store v63, v187; + scf.yield ; + }; + builtin.ret ; + }; + + private builtin.function @miden_base_sys::bindings::output_note::add_asset(v64: i32, v65: felt) { + ^block19(v64: i32, v65: felt): + v67 = arith.constant 12 : u32; + v66 = hir.bitcast v64 : u32; + v68 = arith.add v66, v67 : u32 #[overflow = checked]; + v69 = arith.constant 4 : u32; + v70 = arith.mod v68, v69 : u32; + hir.assertz v70 #[code = 250]; + v71 = hir.int_to_ptr v68 : ptr; + v72 = hir.load v71 : felt; + v74 = arith.constant 8 : u32; + v73 = hir.bitcast v64 : u32; + v75 = arith.add v73, v74 : u32 #[overflow = checked]; + v193 = arith.constant 4 : u32; + v77 = arith.mod v75, v193 : u32; + hir.assertz v77 #[code = 250]; + v78 = hir.int_to_ptr v75 : ptr; + v79 = hir.load v78 : felt; + v192 = arith.constant 4 : u32; + v80 = hir.bitcast v64 : u32; + v82 = arith.add v80, v192 : u32 #[overflow = checked]; + v191 = arith.constant 4 : u32; + v84 = arith.mod v82, v191 : u32; + hir.assertz v84 #[code = 250]; + v85 = hir.int_to_ptr v82 : ptr; + v86 = hir.load v85 : felt; + v87 = hir.bitcast v64 : u32; + v190 = arith.constant 4 : u32; + v89 = arith.mod v87, v190 : u32; + hir.assertz v89 #[code = 250]; + v90 = hir.int_to_ptr v87 : ptr; + v91 = hir.load v90 : felt; + hir.exec @miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-note-add-asset-binding@0.0.1/rust_sdk_output_note_add_asset_binding/miden::output_note::add_asset(v72, v79, v86, v91, v65) + builtin.ret ; + }; + + private builtin.function @>::from(v92: i32, v93: i32) { + ^block21(v92: i32, v93: i32): + v95 = arith.constant 8 : u32; + v94 = hir.bitcast v93 : u32; + v96 = arith.add v94, v95 : u32 #[overflow = checked]; + v97 = arith.constant 4 : u32; + v98 = arith.mod v96, v97 : u32; + hir.assertz v98 #[code = 250]; + v99 = hir.int_to_ptr v96 : ptr; + v100 = hir.load v99 : i64; + v197 = arith.constant 8 : u32; + v101 = hir.bitcast v92 : u32; + v103 = arith.add v101, v197 : u32 #[overflow = checked]; + v196 = arith.constant 8 : u32; + v105 = arith.mod v103, v196 : u32; + hir.assertz v105 #[code = 250]; + v106 = hir.int_to_ptr v103 : ptr; + hir.store v106, v100; + v107 = hir.bitcast v93 : u32; + v195 = arith.constant 4 : u32; + v109 = arith.mod v107, v195 : u32; + hir.assertz v109 #[code = 250]; + v110 = hir.int_to_ptr v107 : ptr; + v111 = hir.load v110 : i64; + v112 = hir.bitcast v92 : u32; + v194 = arith.constant 8 : u32; + v114 = arith.mod v112, v194 : u32; + hir.assertz v114 #[code = 250]; + v115 = hir.int_to_ptr v112 : ptr; + hir.store v115, v111; + builtin.ret ; + }; + + private builtin.function @intrinsics::felt::from_u32(v116: i32) -> felt { + ^block23(v116: i32): + v117 = hir.bitcast v116 : felt; + builtin.ret v117; + }; + + private builtin.function @miden::output_note::add_asset(v119: felt, v120: felt, v121: felt, v122: felt, v123: felt) { + ^block25(v119: felt, v120: felt, v121: felt, v122: felt, v123: felt): + hir.exec @miden/output_note/add_asset(v119, v120, v121, v122, v123) + builtin.ret ; + }; + + builtin.global_variable private @#__stack_pointer : i32 { + builtin.ret_imm 1048576; + }; + + builtin.global_variable private @#GOT.data.internal.__memory_base : i32 { + builtin.ret_imm 0; + }; + + builtin.segment @1048576 = 0x0000000100000001; + }; + + public builtin.function @binding() -> felt { + ^block29: + v124 = hir.exec @miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-note-add-asset-binding@0.0.1/rust_sdk_output_note_add_asset_binding/miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-note-add-asset-binding@0.0.1#binding() : felt + builtin.ret v124; + }; +}; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/rust_sdk_output_note_add_asset_binding.masm b/tests/integration/expected/rust_sdk/rust_sdk_output_note_add_asset_binding.masm new file mode 100644 index 000000000..6eaf80472 --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_output_note_add_asset_binding.masm @@ -0,0 +1,434 @@ +# mod miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-note-add-asset-binding@0.0.1 + +@callconv("canon-lift") +pub proc binding( + +) -> felt + exec.::miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-note-add-asset-binding@0.0.1::init + trace.240 + nop + exec.::miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-note-add-asset-binding@0.0.1::rust_sdk_output_note_add_asset_binding::miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-note-add-asset-binding@0.0.1#binding + trace.252 + nop + exec.::std::sys::truncate_stack +end + +proc init + push.1179648 + trace.240 + exec.::intrinsics::mem::heap_init + trace.252 + push.[7028007876379170725,18060021366771303825,13412364500725888848,14178532912296021363] + adv.push_mapval + push.262144 + push.1 + trace.240 + exec.::std::mem::pipe_preimage_to_memory + trace.252 + drop + push.1048576 + u32assert + mem_store.278536 + push.0 + u32assert + mem_store.278537 +end + +# mod miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-note-add-asset-binding@0.0.1::rust_sdk_output_note_add_asset_binding + +@callconv("C") +proc __wasm_call_ctors( + +) + nop +end + +@callconv("C") +proc rust_sdk_output_note_add_asset_binding::bindings::__link_custom_section_describing_imports( + +) + nop +end + +@callconv("C") +proc miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-note-add-asset-binding@0.0.1#binding( + +) -> felt + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.32 + u32wrapping_sub + push.1114144 + dup.1 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + trace.240 + nop + exec.::miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-note-add-asset-binding@0.0.1::rust_sdk_output_note_add_asset_binding::wit_bindgen::rt::run_ctors_once + trace.252 + nop + push.0 + trace.240 + nop + exec.::miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-note-add-asset-binding@0.0.1::rust_sdk_output_note_add_asset_binding::intrinsics::felt::from_u32 + trace.252 + nop + push.0 + movup.2 + swap.1 + push.1 + while.true + push.0 + push.16 + dup.2 + eq + neq + dup.0 + if.true + swap.1 + drop + push.3735929054 + else + push.16 + dup.3 + u32wrapping_add + dup.2 + u32wrapping_add + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + dup.4 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.4 + movup.2 + u32wrapping_add + end + push.3735929054 + dup.2 + movup.2 + swap.5 + movdn.2 + cdrop + push.3735929054 + dup.2 + dup.4 + swap.2 + swap.1 + cdrop + push.1 + push.0 + movup.4 + cdrop + push.1 + u32and + movup.4 + swap.1 + if.true + movup.3 + drop + push.1 + else + push.0 + end + end + drop + drop + drop + push.16 + dup.1 + u32wrapping_add + dup.1 + trace.240 + nop + exec.::miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-note-add-asset-binding@0.0.1::rust_sdk_output_note_add_asset_binding::>::from + trace.252 + nop + push.0 + trace.240 + nop + exec.::miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-note-add-asset-binding@0.0.1::rust_sdk_output_note_add_asset_binding::intrinsics::felt::from_u32 + trace.252 + nop + dup.1 + trace.240 + nop + exec.::miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-note-add-asset-binding@0.0.1::rust_sdk_output_note_add_asset_binding::miden_base_sys::bindings::output_note::add_asset + trace.252 + nop + push.0 + trace.240 + nop + exec.::miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-note-add-asset-binding@0.0.1::rust_sdk_output_note_add_asset_binding::intrinsics::felt::from_u32 + trace.252 + nop + push.32 + movup.2 + u32wrapping_add + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop +end + +@callconv("C") +proc wit_bindgen::rt::run_ctors_once( + +) + push.1114148 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.1048584 + u32wrapping_add + u32divmod.4 + swap.1 + swap.1 + dup.1 + mem_load + swap.1 + push.8 + u32wrapping_mul + u32shr + swap.1 + drop + push.255 + u32and + push.0 + swap.1 + neq + if.true + nop + else + push.1114148 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + trace.240 + nop + exec.::miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-note-add-asset-binding@0.0.1::rust_sdk_output_note_add_asset_binding::__wasm_call_ctors + trace.252 + nop + push.1 + push.1048584 + movup.2 + u32wrapping_add + u32divmod.4 + swap.1 + dup.0 + mem_load + dup.2 + push.8 + u32wrapping_mul + push.255 + swap.1 + u32shl + u32not + swap.1 + u32and + movup.3 + movup.3 + push.8 + u32wrapping_mul + u32shl + u32or + swap.1 + mem_store + end +end + +@callconv("C") +proc miden_base_sys::bindings::output_note::add_asset( + i32, + felt +) + push.12 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.8 + dup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.4 + dup.3 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + movup.3 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + movdn.3 + swap.2 + trace.240 + nop + exec.::miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-note-add-asset-binding@0.0.1::rust_sdk_output_note_add_asset_binding::miden::output_note::add_asset + trace.252 + nop +end + +@callconv("C") +proc >::from( + i32, + i32 +) + push.8 + dup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.8 + dup.3 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + swap.1 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + movup.2 + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop +end + +@callconv("C") +proc intrinsics::felt::from_u32(i32) -> felt + nop +end + +@callconv("C") +proc miden::output_note::add_asset(felt, felt, felt, felt, felt) + trace.240 + nop + exec.::miden::output_note::add_asset + trace.252 + nop +end + diff --git a/tests/integration/expected/rust_sdk/rust_sdk_output_note_add_asset_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_output_note_add_asset_binding.wat new file mode 100644 index 000000000..14970b441 --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_output_note_add_asset_binding.wat @@ -0,0 +1,149 @@ +(component + (type (;0;) + (instance + (type (;0;) (record (field "inner" f32))) + (export (;1;) "felt" (type (eq 0))) + ) + ) + (import "miden:base/core-types@1.0.0" (instance (;0;) (type 0))) + (core module (;0;) + (type (;0;) (func)) + (type (;1;) (func (result f32))) + (type (;2;) (func (param i32 f32))) + (type (;3;) (func (param i32 i32))) + (type (;4;) (func (param i32) (result f32))) + (type (;5;) (func (param f32 f32 f32 f32 f32))) + (table (;0;) 2 2 funcref) + (memory (;0;) 17) + (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) + (global $GOT.data.internal.__memory_base (;1;) i32 i32.const 0) + (export "memory" (memory 0)) + (export "miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-note-add-asset-binding@0.0.1#binding" (func $miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-note-add-asset-binding@0.0.1#binding)) + (elem (;0;) (i32.const 1) func $rust_sdk_output_note_add_asset_binding::bindings::__link_custom_section_describing_imports) + (func $__wasm_call_ctors (;0;) (type 0)) + (func $rust_sdk_output_note_add_asset_binding::bindings::__link_custom_section_describing_imports (;1;) (type 0)) + (func $miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-note-add-asset-binding@0.0.1#binding (;2;) (type 1) (result f32) + (local i32 i32 f32) + global.get $__stack_pointer + i32.const 32 + i32.sub + local.tee 0 + global.set $__stack_pointer + call $wit_bindgen::rt::run_ctors_once + i32.const 0 + local.set 1 + i32.const 0 + call $intrinsics::felt::from_u32 + local.set 2 + block ;; label = @1 + loop ;; label = @2 + local.get 1 + i32.const 16 + i32.eq + br_if 1 (;@1;) + local.get 0 + i32.const 16 + i32.add + local.get 1 + i32.add + local.get 2 + f32.store + local.get 1 + i32.const 4 + i32.add + local.set 1 + br 0 (;@2;) + end + end + local.get 0 + local.get 0 + i32.const 16 + i32.add + call $>::from + local.get 0 + i32.const 0 + call $intrinsics::felt::from_u32 + call $miden_base_sys::bindings::output_note::add_asset + i32.const 0 + call $intrinsics::felt::from_u32 + local.set 2 + local.get 0 + i32.const 32 + i32.add + global.set $__stack_pointer + local.get 2 + ) + (func $wit_bindgen::rt::run_ctors_once (;3;) (type 0) + (local i32) + block ;; label = @1 + global.get $GOT.data.internal.__memory_base + i32.const 1048584 + i32.add + i32.load8_u + br_if 0 (;@1;) + global.get $GOT.data.internal.__memory_base + local.set 0 + call $__wasm_call_ctors + local.get 0 + i32.const 1048584 + i32.add + i32.const 1 + i32.store8 + end + ) + (func $miden_base_sys::bindings::output_note::add_asset (;4;) (type 2) (param i32 f32) + local.get 0 + f32.load offset=12 + local.get 0 + f32.load offset=8 + local.get 0 + f32.load offset=4 + local.get 0 + f32.load + local.get 1 + call $miden::output_note::add_asset + ) + (func $>::from (;5;) (type 3) (param i32 i32) + local.get 0 + local.get 1 + i64.load offset=8 align=4 + i64.store offset=8 + local.get 0 + local.get 1 + i64.load align=4 + i64.store + ) + (func $intrinsics::felt::from_u32 (;6;) (type 4) (param i32) (result f32) + unreachable + ) + (func $miden::output_note::add_asset (;7;) (type 5) (param f32 f32 f32 f32 f32) + unreachable + ) + (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") + (@custom "rodata,miden_account" (after data) "Mrust_sdk_output_note_add_asset_binding\01\0b0.0.1\03\01\01\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00") + ) + (alias export 0 "felt" (type (;1;))) + (core instance (;0;) (instantiate 0)) + (alias core export 0 "memory" (core memory (;0;))) + (type (;2;) (func (result 1))) + (alias core export 0 "miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-note-add-asset-binding@0.0.1#binding" (core func (;0;))) + (func (;0;) (type 2) (canon lift (core func 0))) + (alias export 0 "felt" (type (;3;))) + (component (;0;) + (type (;0;) (record (field "inner" f32))) + (import "import-type-felt" (type (;1;) (eq 0))) + (import "import-type-felt0" (type (;2;) (eq 1))) + (type (;3;) (func (result 2))) + (import "import-func-binding" (func (;0;) (type 3))) + (export (;4;) "felt" (type 1)) + (type (;5;) (func (result 4))) + (export (;1;) "binding" (func 0) (func (type 5))) + ) + (instance (;1;) (instantiate 0 + (with "import-func-binding" (func 0)) + (with "import-type-felt" (type 3)) + (with "import-type-felt0" (type 1)) + ) + ) + (export (;2;) "miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-note-add-asset-binding@0.0.1" (instance 1)) +) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_output_note_create_binding.hir b/tests/integration/expected/rust_sdk/rust_sdk_output_note_create_binding.hir new file mode 100644 index 000000000..cc91673fd --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_output_note_create_binding.hir @@ -0,0 +1,218 @@ +builtin.component miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-binding@0.0.1 { + builtin.module public @rust_sdk_output_note_create_binding { + private builtin.function @__wasm_call_ctors() { + ^block5: + builtin.ret ; + }; + + private builtin.function @rust_sdk_output_note_create_binding::bindings::__link_custom_section_describing_imports() { + ^block7: + builtin.ret ; + }; + + private builtin.function @miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-binding@0.0.1#binding() -> felt { + ^block9: + v3 = builtin.global_symbol @miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-binding@0.0.1/rust_sdk_output_note_create_binding/__stack_pointer : ptr + v4 = hir.bitcast v3 : ptr; + v5 = hir.load v4 : i32; + v6 = arith.constant 32 : i32; + v7 = arith.sub v5, v6 : i32 #[overflow = wrapping]; + v8 = builtin.global_symbol @miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-binding@0.0.1/rust_sdk_output_note_create_binding/__stack_pointer : ptr + v9 = hir.bitcast v8 : ptr; + hir.store v9, v7; + hir.exec @miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-binding@0.0.1/rust_sdk_output_note_create_binding/wit_bindgen::rt::run_ctors_once() + v1 = arith.constant 0 : i32; + v12 = hir.exec @miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-binding@0.0.1/rust_sdk_output_note_create_binding/intrinsics::felt::from_u32(v1) : felt + v202 = arith.constant 0 : i32; + v182, v183, v184, v185 = scf.while v202, v7, v12 : i32, i32, felt, i32 { + ^block38(v186: i32, v187: i32, v188: felt): + v201 = arith.constant 0 : i32; + v31 = arith.constant 16 : i32; + v15 = arith.eq v186, v31 : i1; + v16 = arith.zext v15 : u32; + v17 = hir.bitcast v16 : i32; + v19 = arith.neq v17, v201 : i1; + v177 = scf.if v19 : i32 { + ^block37: + v148 = ub.poison i32 : i32; + scf.yield v148; + } else { + ^block14: + v200 = arith.constant 16 : i32; + v22 = arith.add v187, v200 : i32 #[overflow = wrapping]; + v23 = arith.add v22, v186 : i32 #[overflow = wrapping]; + v25 = hir.bitcast v23 : u32; + v26 = arith.constant 4 : u32; + v27 = arith.mod v25, v26 : u32; + hir.assertz v27 #[code = 250]; + v28 = hir.int_to_ptr v25 : ptr; + hir.store v28, v188; + v29 = arith.constant 4 : i32; + v30 = arith.add v186, v29 : i32 #[overflow = wrapping]; + scf.yield v30; + }; + v149 = ub.poison felt : felt; + v179 = cf.select v19, v149, v188 : felt; + v199 = ub.poison i32 : i32; + v178 = cf.select v19, v199, v187 : i32; + v147 = arith.constant 1 : u32; + v141 = arith.constant 0 : u32; + v181 = cf.select v19, v141, v147 : u32; + v171 = arith.trunc v181 : i1; + scf.condition v171, v177, v178, v179, v187; + } do { + ^block39(v189: i32, v190: i32, v191: felt, v192: i32): + scf.yield v189, v190, v191; + }; + v198 = arith.constant 16 : i32; + v32 = arith.add v185, v198 : i32 #[overflow = wrapping]; + hir.exec @miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-binding@0.0.1/rust_sdk_output_note_create_binding/>::from(v185, v32) + v197 = arith.constant 0 : i32; + v34 = hir.exec @miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-binding@0.0.1/rust_sdk_output_note_create_binding/intrinsics::felt::from_u32(v197) : felt + v196 = arith.constant 0 : i32; + v36 = hir.exec @miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-binding@0.0.1/rust_sdk_output_note_create_binding/intrinsics::felt::from_u32(v196) : felt + v195 = arith.constant 0 : i32; + v38 = hir.exec @miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-binding@0.0.1/rust_sdk_output_note_create_binding/intrinsics::felt::from_u32(v195) : felt + v194 = arith.constant 0 : i32; + v40 = hir.exec @miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-binding@0.0.1/rust_sdk_output_note_create_binding/intrinsics::felt::from_u32(v194) : felt + v41 = hir.exec @miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-binding@0.0.1/rust_sdk_output_note_create_binding/miden_base_sys::bindings::output_note::create(v34, v38, v36, v40, v185) : felt + v193 = arith.constant 32 : i32; + v43 = arith.add v185, v193 : i32 #[overflow = wrapping]; + v44 = builtin.global_symbol @miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-binding@0.0.1/rust_sdk_output_note_create_binding/__stack_pointer : ptr + v45 = hir.bitcast v44 : ptr; + hir.store v45, v43; + builtin.ret v41; + }; + + private builtin.function @wit_bindgen::rt::run_ctors_once() { + ^block15: + v47 = builtin.global_symbol @miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-binding@0.0.1/rust_sdk_output_note_create_binding/GOT.data.internal.__memory_base : ptr + v48 = hir.bitcast v47 : ptr; + v49 = hir.load v48 : i32; + v50 = arith.constant 1048584 : i32; + v51 = arith.add v49, v50 : i32 #[overflow = wrapping]; + v52 = hir.bitcast v51 : u32; + v53 = hir.int_to_ptr v52 : ptr; + v54 = hir.load v53 : u8; + v46 = arith.constant 0 : i32; + v55 = arith.zext v54 : u32; + v56 = hir.bitcast v55 : i32; + v58 = arith.neq v56, v46 : i1; + scf.if v58{ + ^block17: + scf.yield ; + } else { + ^block18: + v59 = builtin.global_symbol @miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-binding@0.0.1/rust_sdk_output_note_create_binding/GOT.data.internal.__memory_base : ptr + v60 = hir.bitcast v59 : ptr; + v61 = hir.load v60 : i32; + hir.exec @miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-binding@0.0.1/rust_sdk_output_note_create_binding/__wasm_call_ctors() + v204 = arith.constant 1 : u8; + v206 = arith.constant 1048584 : i32; + v63 = arith.add v61, v206 : i32 #[overflow = wrapping]; + v67 = hir.bitcast v63 : u32; + v68 = hir.int_to_ptr v67 : ptr; + hir.store v68, v204; + scf.yield ; + }; + builtin.ret ; + }; + + private builtin.function @miden_base_sys::bindings::output_note::create(v69: felt, v70: felt, v71: felt, v72: felt, v73: i32) -> felt { + ^block19(v69: felt, v70: felt, v71: felt, v72: felt, v73: i32): + v76 = arith.constant 12 : u32; + v75 = hir.bitcast v73 : u32; + v77 = arith.add v75, v76 : u32 #[overflow = checked]; + v78 = arith.constant 4 : u32; + v79 = arith.mod v77, v78 : u32; + hir.assertz v79 #[code = 250]; + v80 = hir.int_to_ptr v77 : ptr; + v81 = hir.load v80 : felt; + v83 = arith.constant 8 : u32; + v82 = hir.bitcast v73 : u32; + v84 = arith.add v82, v83 : u32 #[overflow = checked]; + v210 = arith.constant 4 : u32; + v86 = arith.mod v84, v210 : u32; + hir.assertz v86 #[code = 250]; + v87 = hir.int_to_ptr v84 : ptr; + v88 = hir.load v87 : felt; + v209 = arith.constant 4 : u32; + v89 = hir.bitcast v73 : u32; + v91 = arith.add v89, v209 : u32 #[overflow = checked]; + v208 = arith.constant 4 : u32; + v93 = arith.mod v91, v208 : u32; + hir.assertz v93 #[code = 250]; + v94 = hir.int_to_ptr v91 : ptr; + v95 = hir.load v94 : felt; + v96 = hir.bitcast v73 : u32; + v207 = arith.constant 4 : u32; + v98 = arith.mod v96, v207 : u32; + hir.assertz v98 #[code = 250]; + v99 = hir.int_to_ptr v96 : ptr; + v100 = hir.load v99 : felt; + v101 = hir.exec @miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-binding@0.0.1/rust_sdk_output_note_create_binding/miden::output_note::create(v69, v70, v71, v72, v81, v88, v95, v100) : felt + builtin.ret v101; + }; + + private builtin.function @>::from(v102: i32, v103: i32) { + ^block21(v102: i32, v103: i32): + v105 = arith.constant 8 : u32; + v104 = hir.bitcast v103 : u32; + v106 = arith.add v104, v105 : u32 #[overflow = checked]; + v107 = arith.constant 4 : u32; + v108 = arith.mod v106, v107 : u32; + hir.assertz v108 #[code = 250]; + v109 = hir.int_to_ptr v106 : ptr; + v110 = hir.load v109 : i64; + v214 = arith.constant 8 : u32; + v111 = hir.bitcast v102 : u32; + v113 = arith.add v111, v214 : u32 #[overflow = checked]; + v213 = arith.constant 8 : u32; + v115 = arith.mod v113, v213 : u32; + hir.assertz v115 #[code = 250]; + v116 = hir.int_to_ptr v113 : ptr; + hir.store v116, v110; + v117 = hir.bitcast v103 : u32; + v212 = arith.constant 4 : u32; + v119 = arith.mod v117, v212 : u32; + hir.assertz v119 #[code = 250]; + v120 = hir.int_to_ptr v117 : ptr; + v121 = hir.load v120 : i64; + v122 = hir.bitcast v102 : u32; + v211 = arith.constant 8 : u32; + v124 = arith.mod v122, v211 : u32; + hir.assertz v124 #[code = 250]; + v125 = hir.int_to_ptr v122 : ptr; + hir.store v125, v121; + builtin.ret ; + }; + + private builtin.function @intrinsics::felt::from_u32(v126: i32) -> felt { + ^block23(v126: i32): + v127 = hir.bitcast v126 : felt; + builtin.ret v127; + }; + + private builtin.function @miden::output_note::create(v129: felt, v130: felt, v131: felt, v132: felt, v133: felt, v134: felt, v135: felt, v136: felt) -> felt { + ^block25(v129: felt, v130: felt, v131: felt, v132: felt, v133: felt, v134: felt, v135: felt, v136: felt): + v137 = hir.exec @miden/output_note/create(v129, v130, v131, v132, v133, v134, v135, v136) : felt + builtin.ret v137; + }; + + builtin.global_variable private @#__stack_pointer : i32 { + builtin.ret_imm 1048576; + }; + + builtin.global_variable private @#GOT.data.internal.__memory_base : i32 { + builtin.ret_imm 0; + }; + + builtin.segment @1048576 = 0x0000000100000001; + }; + + public builtin.function @binding() -> felt { + ^block29: + v139 = hir.exec @miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-binding@0.0.1/rust_sdk_output_note_create_binding/miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-binding@0.0.1#binding() : felt + builtin.ret v139; + }; +}; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/rust_sdk_output_note_create_binding.masm b/tests/integration/expected/rust_sdk/rust_sdk_output_note_create_binding.masm new file mode 100644 index 000000000..22b33f049 --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_output_note_create_binding.masm @@ -0,0 +1,469 @@ +# mod miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-binding@0.0.1 + +@callconv("canon-lift") +pub proc binding( + +) -> felt + exec.::miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-binding@0.0.1::init + trace.240 + nop + exec.::miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-binding@0.0.1::rust_sdk_output_note_create_binding::miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-binding@0.0.1#binding + trace.252 + nop + exec.::std::sys::truncate_stack +end + +proc init + push.1179648 + trace.240 + exec.::intrinsics::mem::heap_init + trace.252 + push.[7028007876379170725,18060021366771303825,13412364500725888848,14178532912296021363] + adv.push_mapval + push.262144 + push.1 + trace.240 + exec.::std::mem::pipe_preimage_to_memory + trace.252 + drop + push.1048576 + u32assert + mem_store.278536 + push.0 + u32assert + mem_store.278537 +end + +# mod miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-binding@0.0.1::rust_sdk_output_note_create_binding + +@callconv("C") +proc __wasm_call_ctors( + +) + nop +end + +@callconv("C") +proc rust_sdk_output_note_create_binding::bindings::__link_custom_section_describing_imports( + +) + nop +end + +@callconv("C") +proc miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-binding@0.0.1#binding( + +) -> felt + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.32 + u32wrapping_sub + push.1114144 + dup.1 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + trace.240 + nop + exec.::miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-binding@0.0.1::rust_sdk_output_note_create_binding::wit_bindgen::rt::run_ctors_once + trace.252 + nop + push.0 + trace.240 + nop + exec.::miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-binding@0.0.1::rust_sdk_output_note_create_binding::intrinsics::felt::from_u32 + trace.252 + nop + push.0 + movup.2 + swap.1 + push.1 + while.true + push.0 + push.16 + dup.2 + eq + neq + dup.0 + if.true + swap.1 + drop + push.3735929054 + else + push.16 + dup.3 + u32wrapping_add + dup.2 + u32wrapping_add + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + dup.4 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.4 + movup.2 + u32wrapping_add + end + push.3735929054 + dup.2 + movup.2 + swap.5 + movdn.2 + cdrop + push.3735929054 + dup.2 + dup.4 + swap.2 + swap.1 + cdrop + push.1 + push.0 + movup.4 + cdrop + push.1 + u32and + movup.4 + swap.1 + if.true + movup.3 + drop + push.1 + else + push.0 + end + end + drop + drop + drop + push.16 + dup.1 + u32wrapping_add + dup.1 + trace.240 + nop + exec.::miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-binding@0.0.1::rust_sdk_output_note_create_binding::>::from + trace.252 + nop + push.0 + trace.240 + nop + exec.::miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-binding@0.0.1::rust_sdk_output_note_create_binding::intrinsics::felt::from_u32 + trace.252 + nop + push.0 + trace.240 + nop + exec.::miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-binding@0.0.1::rust_sdk_output_note_create_binding::intrinsics::felt::from_u32 + trace.252 + nop + push.0 + trace.240 + nop + exec.::miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-binding@0.0.1::rust_sdk_output_note_create_binding::intrinsics::felt::from_u32 + trace.252 + nop + push.0 + trace.240 + nop + exec.::miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-binding@0.0.1::rust_sdk_output_note_create_binding::intrinsics::felt::from_u32 + trace.252 + nop + dup.4 + swap.1 + swap.3 + swap.2 + swap.1 + swap.4 + trace.240 + nop + exec.::miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-binding@0.0.1::rust_sdk_output_note_create_binding::miden_base_sys::bindings::output_note::create + trace.252 + nop + push.32 + movup.2 + u32wrapping_add + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop +end + +@callconv("C") +proc wit_bindgen::rt::run_ctors_once( + +) + push.1114148 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.1048584 + u32wrapping_add + u32divmod.4 + swap.1 + swap.1 + dup.1 + mem_load + swap.1 + push.8 + u32wrapping_mul + u32shr + swap.1 + drop + push.255 + u32and + push.0 + swap.1 + neq + if.true + nop + else + push.1114148 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + trace.240 + nop + exec.::miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-binding@0.0.1::rust_sdk_output_note_create_binding::__wasm_call_ctors + trace.252 + nop + push.1 + push.1048584 + movup.2 + u32wrapping_add + u32divmod.4 + swap.1 + dup.0 + mem_load + dup.2 + push.8 + u32wrapping_mul + push.255 + swap.1 + u32shl + u32not + swap.1 + u32and + movup.3 + movup.3 + push.8 + u32wrapping_mul + u32shl + u32or + swap.1 + mem_store + end +end + +@callconv("C") +proc miden_base_sys::bindings::output_note::create( + felt, + felt, + felt, + felt, + i32 +) -> felt + push.12 + dup.5 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.8 + dup.6 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.4 + dup.7 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + movup.7 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + swap.1 + swap.6 + swap.2 + swap.5 + swap.1 + swap.7 + swap.3 + swap.4 + trace.240 + nop + exec.::miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-binding@0.0.1::rust_sdk_output_note_create_binding::miden::output_note::create + trace.252 + nop +end + +@callconv("C") +proc >::from( + i32, + i32 +) + push.8 + dup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.8 + dup.3 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + swap.1 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + movup.2 + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop +end + +@callconv("C") +proc intrinsics::felt::from_u32(i32) -> felt + nop +end + +@callconv("C") +proc miden::output_note::create( + felt, + felt, + felt, + felt, + felt, + felt, + felt, + felt +) -> felt + trace.240 + nop + exec.::miden::output_note::create + trace.252 + nop +end + diff --git a/tests/integration/expected/rust_sdk/rust_sdk_output_note_create_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_output_note_create_binding.wat new file mode 100644 index 000000000..9146ec403 --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_output_note_create_binding.wat @@ -0,0 +1,166 @@ +(component + (type (;0;) + (instance + (type (;0;) (record (field "inner" f32))) + (export (;1;) "felt" (type (eq 0))) + (type (;2;) (record (field "inner" 1))) + (export (;3;) "note-idx" (type (eq 2))) + ) + ) + (import "miden:base/core-types@1.0.0" (instance (;0;) (type 0))) + (core module (;0;) + (type (;0;) (func)) + (type (;1;) (func (result f32))) + (type (;2;) (func (param f32 f32 f32 f32 i32) (result f32))) + (type (;3;) (func (param i32 i32))) + (type (;4;) (func (param i32) (result f32))) + (type (;5;) (func (param f32 f32 f32 f32 f32 f32 f32 f32) (result f32))) + (table (;0;) 2 2 funcref) + (memory (;0;) 17) + (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) + (global $GOT.data.internal.__memory_base (;1;) i32 i32.const 0) + (export "memory" (memory 0)) + (export "miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-binding@0.0.1#binding" (func $miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-binding@0.0.1#binding)) + (elem (;0;) (i32.const 1) func $rust_sdk_output_note_create_binding::bindings::__link_custom_section_describing_imports) + (func $__wasm_call_ctors (;0;) (type 0)) + (func $rust_sdk_output_note_create_binding::bindings::__link_custom_section_describing_imports (;1;) (type 0)) + (func $miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-binding@0.0.1#binding (;2;) (type 1) (result f32) + (local i32 i32 f32 f32) + global.get $__stack_pointer + i32.const 32 + i32.sub + local.tee 0 + global.set $__stack_pointer + call $wit_bindgen::rt::run_ctors_once + i32.const 0 + local.set 1 + i32.const 0 + call $intrinsics::felt::from_u32 + local.set 2 + block ;; label = @1 + loop ;; label = @2 + local.get 1 + i32.const 16 + i32.eq + br_if 1 (;@1;) + local.get 0 + i32.const 16 + i32.add + local.get 1 + i32.add + local.get 2 + f32.store + local.get 1 + i32.const 4 + i32.add + local.set 1 + br 0 (;@2;) + end + end + local.get 0 + local.get 0 + i32.const 16 + i32.add + call $>::from + i32.const 0 + call $intrinsics::felt::from_u32 + local.set 2 + i32.const 0 + call $intrinsics::felt::from_u32 + local.set 3 + local.get 2 + i32.const 0 + call $intrinsics::felt::from_u32 + local.get 3 + i32.const 0 + call $intrinsics::felt::from_u32 + local.get 0 + call $miden_base_sys::bindings::output_note::create + local.set 2 + local.get 0 + i32.const 32 + i32.add + global.set $__stack_pointer + local.get 2 + ) + (func $wit_bindgen::rt::run_ctors_once (;3;) (type 0) + (local i32) + block ;; label = @1 + global.get $GOT.data.internal.__memory_base + i32.const 1048584 + i32.add + i32.load8_u + br_if 0 (;@1;) + global.get $GOT.data.internal.__memory_base + local.set 0 + call $__wasm_call_ctors + local.get 0 + i32.const 1048584 + i32.add + i32.const 1 + i32.store8 + end + ) + (func $miden_base_sys::bindings::output_note::create (;4;) (type 2) (param f32 f32 f32 f32 i32) (result f32) + local.get 0 + local.get 1 + local.get 2 + local.get 3 + local.get 4 + f32.load offset=12 + local.get 4 + f32.load offset=8 + local.get 4 + f32.load offset=4 + local.get 4 + f32.load + call $miden::output_note::create + ) + (func $>::from (;5;) (type 3) (param i32 i32) + local.get 0 + local.get 1 + i64.load offset=8 align=4 + i64.store offset=8 + local.get 0 + local.get 1 + i64.load align=4 + i64.store + ) + (func $intrinsics::felt::from_u32 (;6;) (type 4) (param i32) (result f32) + unreachable + ) + (func $miden::output_note::create (;7;) (type 5) (param f32 f32 f32 f32 f32 f32 f32 f32) (result f32) + unreachable + ) + (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") + (@custom "rodata,miden_account" (after data) "Grust_sdk_output_note_create_binding\01\0b0.0.1\03\01\01\00\00") + ) + (alias export 0 "note-idx" (type (;1;))) + (core instance (;0;) (instantiate 0)) + (alias core export 0 "memory" (core memory (;0;))) + (type (;2;) (func (result 1))) + (alias core export 0 "miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-binding@0.0.1#binding" (core func (;0;))) + (func (;0;) (type 2) (canon lift (core func 0))) + (alias export 0 "felt" (type (;3;))) + (alias export 0 "note-idx" (type (;4;))) + (component (;0;) + (type (;0;) (record (field "inner" f32))) + (import "import-type-felt" (type (;1;) (eq 0))) + (type (;2;) (record (field "inner" 1))) + (import "import-type-note-idx" (type (;3;) (eq 2))) + (import "import-type-note-idx0" (type (;4;) (eq 3))) + (type (;5;) (func (result 4))) + (import "import-func-binding" (func (;0;) (type 5))) + (export (;6;) "note-idx" (type 3)) + (type (;7;) (func (result 6))) + (export (;1;) "binding" (func 0) (func (type 7))) + ) + (instance (;1;) (instantiate 0 + (with "import-func-binding" (func 0)) + (with "import-type-felt" (type 3)) + (with "import-type-note-idx" (type 4)) + (with "import-type-note-idx0" (type 1)) + ) + ) + (export (;2;) "miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-binding@0.0.1" (instance 1)) +) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_assets_binding.hir b/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_assets_binding.hir new file mode 100644 index 000000000..8aed99c21 --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_assets_binding.hir @@ -0,0 +1,958 @@ +builtin.component miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1 { + builtin.module public @rust_sdk_output_note_get_assets_binding { + private builtin.function @__wasm_call_ctors() { + ^block5: + builtin.ret ; + }; + + private builtin.function @__rustc::__rust_alloc(v0: i32, v1: i32) -> i32 { + ^block7(v0: i32, v1: i32): + v3 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/GOT.data.internal.__memory_base : ptr + v4 = hir.bitcast v3 : ptr; + v5 = hir.load v4 : i32; + v6 = arith.constant 1048676 : i32; + v7 = arith.add v5, v6 : i32 #[overflow = wrapping]; + v8 = hir.exec @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/::alloc(v7, v1, v0) : i32 + builtin.ret v8; + }; + + private builtin.function @__rustc::__rust_dealloc(v9: i32, v10: i32, v11: i32) { + ^block9(v9: i32, v10: i32, v11: i32): + builtin.ret ; + }; + + private builtin.function @__rustc::__rust_alloc_zeroed(v12: i32, v13: i32) -> i32 { + ^block11(v12: i32, v13: i32): + v15 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/GOT.data.internal.__memory_base : ptr + v16 = hir.bitcast v15 : ptr; + v17 = hir.load v16 : i32; + v18 = arith.constant 1048676 : i32; + v19 = arith.add v17, v18 : i32 #[overflow = wrapping]; + v20 = hir.exec @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/::alloc(v19, v13, v12) : i32 + v668 = arith.constant 0 : i32; + v21 = arith.constant 0 : i32; + v22 = arith.eq v20, v21 : i1; + v23 = arith.zext v22 : u32; + v24 = hir.bitcast v23 : i32; + v26 = arith.neq v24, v668 : i1; + scf.if v26{ + ^block13: + scf.yield ; + } else { + ^block14: + v666 = arith.constant 0 : i32; + v667 = arith.constant 0 : i32; + v28 = arith.eq v12, v667 : i1; + v29 = arith.zext v28 : u32; + v30 = hir.bitcast v29 : i32; + v32 = arith.neq v30, v666 : i1; + scf.if v32{ + ^block94: + scf.yield ; + } else { + ^block15: + v660 = arith.constant 0 : u8; + v35 = hir.bitcast v12 : u32; + v36 = hir.bitcast v20 : u32; + v37 = hir.int_to_ptr v36 : ptr; + hir.mem_set v37, v35, v660; + scf.yield ; + }; + scf.yield ; + }; + builtin.ret v20; + }; + + private builtin.function @rust_sdk_output_note_get_assets_binding::bindings::__link_custom_section_describing_imports() { + ^block16: + builtin.ret ; + }; + + private builtin.function @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1#binding() -> felt { + ^block18: + v42 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/__stack_pointer : ptr + v43 = hir.bitcast v42 : ptr; + v44 = hir.load v43 : i32; + v45 = arith.constant 16 : i32; + v46 = arith.sub v44, v45 : i32 #[overflow = wrapping]; + v47 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/__stack_pointer : ptr + v48 = hir.bitcast v47 : ptr; + hir.store v48, v46; + hir.exec @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/wit_bindgen::rt::run_ctors_once() + v40 = arith.constant 0 : i32; + v52 = hir.exec @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/intrinsics::felt::from_u32(v40) : felt + v49 = arith.constant 4 : i32; + v50 = arith.add v46, v49 : i32 #[overflow = wrapping]; + hir.exec @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/miden_base_sys::bindings::output_note::get_assets(v50, v52) + v54 = arith.constant 12 : u32; + v53 = hir.bitcast v46 : u32; + v55 = arith.add v53, v54 : u32 #[overflow = checked]; + v56 = arith.constant 4 : u32; + v57 = arith.mod v55, v56 : u32; + hir.assertz v57 #[code = 250]; + v58 = hir.int_to_ptr v55 : ptr; + v59 = hir.load v58 : i32; + v60 = hir.exec @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/intrinsics::felt::from_u32(v59) : felt + v670 = arith.constant 16 : i32; + v671 = arith.constant 4 : i32; + v62 = arith.add v46, v671 : i32 #[overflow = wrapping]; + hir.exec @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/alloc::raw_vec::RawVecInner::deallocate(v62, v670, v670) + v669 = arith.constant 16 : i32; + v66 = arith.add v46, v669 : i32 #[overflow = wrapping]; + v67 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/__stack_pointer : ptr + v68 = hir.bitcast v67 : ptr; + hir.store v68, v66; + builtin.ret v60; + }; + + private builtin.function @__rustc::__rust_no_alloc_shim_is_unstable_v2() { + ^block20: + builtin.ret ; + }; + + private builtin.function @wit_bindgen::rt::run_ctors_once() { + ^block22: + v70 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/GOT.data.internal.__memory_base : ptr + v71 = hir.bitcast v70 : ptr; + v72 = hir.load v71 : i32; + v73 = arith.constant 1048680 : i32; + v74 = arith.add v72, v73 : i32 #[overflow = wrapping]; + v75 = hir.bitcast v74 : u32; + v76 = hir.int_to_ptr v75 : ptr; + v77 = hir.load v76 : u8; + v69 = arith.constant 0 : i32; + v78 = arith.zext v77 : u32; + v79 = hir.bitcast v78 : i32; + v81 = arith.neq v79, v69 : i1; + scf.if v81{ + ^block24: + scf.yield ; + } else { + ^block25: + v82 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/GOT.data.internal.__memory_base : ptr + v83 = hir.bitcast v82 : ptr; + v84 = hir.load v83 : i32; + hir.exec @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/__wasm_call_ctors() + v673 = arith.constant 1 : u8; + v675 = arith.constant 1048680 : i32; + v86 = arith.add v84, v675 : i32 #[overflow = wrapping]; + v90 = hir.bitcast v86 : u32; + v91 = hir.int_to_ptr v90 : ptr; + hir.store v91, v673; + scf.yield ; + }; + builtin.ret ; + }; + + private builtin.function @::alloc(v92: i32, v93: i32, v94: i32) -> i32 { + ^block26(v92: i32, v93: i32, v94: i32): + v97 = arith.constant 16 : i32; + v96 = arith.constant 0 : i32; + v677 = arith.constant 16 : u32; + v99 = hir.bitcast v93 : u32; + v101 = arith.gt v99, v677 : i1; + v102 = arith.zext v101 : u32; + v103 = hir.bitcast v102 : i32; + v105 = arith.neq v103, v96 : i1; + v106 = cf.select v105, v93, v97 : i32; + v717 = arith.constant 0 : i32; + v107 = arith.constant -1 : i32; + v108 = arith.add v106, v107 : i32 #[overflow = wrapping]; + v109 = arith.band v106, v108 : i32; + v111 = arith.neq v109, v717 : i1; + v686, v687 = scf.if v111 : i32, u32 { + ^block100: + v678 = arith.constant 0 : u32; + v682 = ub.poison i32 : i32; + scf.yield v682, v678; + } else { + ^block29: + v113 = hir.exec @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/core::ptr::alignment::Alignment::max(v93, v106) : i32 + v716 = arith.constant 0 : i32; + v112 = arith.constant -2147483648 : i32; + v114 = arith.sub v112, v113 : i32 #[overflow = wrapping]; + v116 = hir.bitcast v114 : u32; + v115 = hir.bitcast v94 : u32; + v117 = arith.gt v115, v116 : i1; + v118 = arith.zext v117 : u32; + v119 = hir.bitcast v118 : i32; + v121 = arith.neq v119, v716 : i1; + v701 = scf.if v121 : i32 { + ^block99: + v715 = ub.poison i32 : i32; + scf.yield v715; + } else { + ^block30: + v713 = arith.constant 0 : i32; + v127 = arith.sub v713, v113 : i32 #[overflow = wrapping]; + v714 = arith.constant -1 : i32; + v123 = arith.add v94, v113 : i32 #[overflow = wrapping]; + v125 = arith.add v123, v714 : i32 #[overflow = wrapping]; + v128 = arith.band v125, v127 : i32; + v129 = hir.bitcast v92 : u32; + v130 = arith.constant 4 : u32; + v131 = arith.mod v129, v130 : u32; + hir.assertz v131 #[code = 250]; + v132 = hir.int_to_ptr v129 : ptr; + v133 = hir.load v132 : i32; + v712 = arith.constant 0 : i32; + v135 = arith.neq v133, v712 : i1; + scf.if v135{ + ^block98: + scf.yield ; + } else { + ^block32: + v136 = hir.exec @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/intrinsics::mem::heap_base() : i32 + v137 = hir.mem_size : u32; + v143 = hir.bitcast v92 : u32; + v711 = arith.constant 4 : u32; + v145 = arith.mod v143, v711 : u32; + hir.assertz v145 #[code = 250]; + v710 = arith.constant 16 : u32; + v138 = hir.bitcast v137 : i32; + v141 = arith.shl v138, v710 : i32; + v142 = arith.add v136, v141 : i32 #[overflow = wrapping]; + v146 = hir.int_to_ptr v143 : ptr; + hir.store v146, v142; + scf.yield ; + }; + v149 = hir.bitcast v92 : u32; + v709 = arith.constant 4 : u32; + v151 = arith.mod v149, v709 : u32; + hir.assertz v151 #[code = 250]; + v152 = hir.int_to_ptr v149 : ptr; + v153 = hir.load v152 : i32; + v707 = arith.constant 0 : i32; + v708 = arith.constant -1 : i32; + v155 = arith.bxor v153, v708 : i32; + v157 = hir.bitcast v155 : u32; + v156 = hir.bitcast v128 : u32; + v158 = arith.gt v156, v157 : i1; + v159 = arith.zext v158 : u32; + v160 = hir.bitcast v159 : i32; + v162 = arith.neq v160, v707 : i1; + v700 = scf.if v162 : i32 { + ^block33: + v706 = arith.constant 0 : i32; + scf.yield v706; + } else { + ^block34: + v164 = hir.bitcast v92 : u32; + v705 = arith.constant 4 : u32; + v166 = arith.mod v164, v705 : u32; + hir.assertz v166 #[code = 250]; + v163 = arith.add v153, v128 : i32 #[overflow = wrapping]; + v167 = hir.int_to_ptr v164 : ptr; + hir.store v167, v163; + v169 = arith.add v153, v113 : i32 #[overflow = wrapping]; + scf.yield v169; + }; + scf.yield v700; + }; + v683 = arith.constant 1 : u32; + v704 = arith.constant 0 : u32; + v702 = cf.select v121, v704, v683 : u32; + scf.yield v701, v702; + }; + v703 = arith.constant 0 : u32; + v699 = arith.eq v687, v703 : i1; + cf.cond_br v699 ^block28, ^block102(v686); + ^block28: + ub.unreachable ; + ^block102(v679: i32): + builtin.ret v679; + }; + + private builtin.function @intrinsics::mem::heap_base() -> i32 { + ^block35: + v172 = hir.exec @intrinsics/mem/heap_base() : i32 + builtin.ret v172; + }; + + private builtin.function @alloc::vec::Vec::with_capacity(v174: i32, v175: i32) { + ^block39(v174: i32, v175: i32): + v178 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/__stack_pointer : ptr + v179 = hir.bitcast v178 : ptr; + v180 = hir.load v179 : i32; + v181 = arith.constant 16 : i32; + v182 = arith.sub v180, v181 : i32 #[overflow = wrapping]; + v183 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/__stack_pointer : ptr + v184 = hir.bitcast v183 : ptr; + hir.store v184, v182; + v722 = arith.constant 16 : i32; + v185 = arith.constant 8 : i32; + v186 = arith.add v182, v185 : i32 #[overflow = wrapping]; + hir.exec @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/alloc::raw_vec::RawVecInner::with_capacity_in(v186, v722, v722, v175) + v190 = arith.constant 8 : u32; + v189 = hir.bitcast v182 : u32; + v191 = arith.add v189, v190 : u32 #[overflow = checked]; + v721 = arith.constant 8 : u32; + v193 = arith.mod v191, v721 : u32; + hir.assertz v193 #[code = 250]; + v194 = hir.int_to_ptr v191 : ptr; + v195 = hir.load v194 : i64; + v720 = arith.constant 8 : u32; + v197 = hir.bitcast v174 : u32; + v199 = arith.add v197, v720 : u32 #[overflow = checked]; + v200 = arith.constant 4 : u32; + v201 = arith.mod v199, v200 : u32; + hir.assertz v201 #[code = 250]; + v176 = arith.constant 0 : i32; + v202 = hir.int_to_ptr v199 : ptr; + hir.store v202, v176; + v203 = hir.bitcast v174 : u32; + v719 = arith.constant 4 : u32; + v205 = arith.mod v203, v719 : u32; + hir.assertz v205 #[code = 250]; + v206 = hir.int_to_ptr v203 : ptr; + hir.store v206, v195; + v718 = arith.constant 16 : i32; + v208 = arith.add v182, v718 : i32 #[overflow = wrapping]; + v209 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/__stack_pointer : ptr + v210 = hir.bitcast v209 : ptr; + hir.store v210, v208; + builtin.ret ; + }; + + private builtin.function @alloc::raw_vec::RawVecInner::with_capacity_in(v211: i32, v212: i32, v213: i32, v214: i32) { + ^block41(v211: i32, v212: i32, v213: i32, v214: i32): + v216 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/__stack_pointer : ptr + v217 = hir.bitcast v216 : ptr; + v218 = hir.load v217 : i32; + v219 = arith.constant 16 : i32; + v220 = arith.sub v218, v219 : i32 #[overflow = wrapping]; + v221 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/__stack_pointer : ptr + v222 = hir.bitcast v221 : ptr; + hir.store v222, v220; + v215 = arith.constant 0 : i32; + v225 = arith.constant 256 : i32; + v223 = arith.constant 4 : i32; + v224 = arith.add v220, v223 : i32 #[overflow = wrapping]; + hir.exec @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/alloc::raw_vec::RawVecInner::try_allocate_in(v224, v225, v215, v212, v213) + v228 = arith.constant 8 : u32; + v227 = hir.bitcast v220 : u32; + v229 = arith.add v227, v228 : u32 #[overflow = checked]; + v230 = arith.constant 4 : u32; + v231 = arith.mod v229, v230 : u32; + hir.assertz v231 #[code = 250]; + v232 = hir.int_to_ptr v229 : ptr; + v233 = hir.load v232 : i32; + v733 = arith.constant 4 : u32; + v234 = hir.bitcast v220 : u32; + v236 = arith.add v234, v733 : u32 #[overflow = checked]; + v732 = arith.constant 4 : u32; + v238 = arith.mod v236, v732 : u32; + hir.assertz v238 #[code = 250]; + v239 = hir.int_to_ptr v236 : ptr; + v240 = hir.load v239 : i32; + v731 = arith.constant 0 : i32; + v241 = arith.constant 1 : i32; + v242 = arith.neq v240, v241 : i1; + v243 = arith.zext v242 : u32; + v244 = hir.bitcast v243 : i32; + v246 = arith.neq v244, v731 : i1; + cf.cond_br v246 ^block43, ^block44; + ^block43: + v255 = arith.constant 12 : u32; + v254 = hir.bitcast v220 : u32; + v256 = arith.add v254, v255 : u32 #[overflow = checked]; + v730 = arith.constant 4 : u32; + v258 = arith.mod v256, v730 : u32; + hir.assertz v258 #[code = 250]; + v259 = hir.int_to_ptr v256 : ptr; + v260 = hir.load v259 : i32; + v729 = arith.constant 4 : u32; + v261 = hir.bitcast v211 : u32; + v263 = arith.add v261, v729 : u32 #[overflow = checked]; + v728 = arith.constant 4 : u32; + v265 = arith.mod v263, v728 : u32; + hir.assertz v265 #[code = 250]; + v266 = hir.int_to_ptr v263 : ptr; + hir.store v266, v260; + v267 = hir.bitcast v211 : u32; + v727 = arith.constant 4 : u32; + v269 = arith.mod v267, v727 : u32; + hir.assertz v269 #[code = 250]; + v270 = hir.int_to_ptr v267 : ptr; + hir.store v270, v233; + v726 = arith.constant 16 : i32; + v272 = arith.add v220, v726 : i32 #[overflow = wrapping]; + v273 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/__stack_pointer : ptr + v274 = hir.bitcast v273 : ptr; + hir.store v274, v272; + builtin.ret ; + ^block44: + v725 = arith.constant 12 : u32; + v247 = hir.bitcast v220 : u32; + v249 = arith.add v247, v725 : u32 #[overflow = checked]; + v724 = arith.constant 4 : u32; + v251 = arith.mod v249, v724 : u32; + hir.assertz v251 #[code = 250]; + v252 = hir.int_to_ptr v249 : ptr; + v253 = hir.load v252 : i32; + hir.exec @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/alloc::raw_vec::handle_error(v233, v253, v214) + ub.unreachable ; + }; + + private builtin.function @miden_base_sys::bindings::output_note::get_assets(v275: i32, v276: felt) { + ^block45(v275: i32, v276: felt): + v278 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/__stack_pointer : ptr + v279 = hir.bitcast v278 : ptr; + v280 = hir.load v279 : i32; + v281 = arith.constant 16 : i32; + v282 = arith.sub v280, v281 : i32 #[overflow = wrapping]; + v283 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/__stack_pointer : ptr + v284 = hir.bitcast v283 : ptr; + hir.store v284, v282; + v287 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/GOT.data.internal.__memory_base : ptr + v288 = hir.bitcast v287 : ptr; + v289 = hir.load v288 : i32; + v290 = arith.constant 1048660 : i32; + v291 = arith.add v289, v290 : i32 #[overflow = wrapping]; + v285 = arith.constant 4 : i32; + v286 = arith.add v282, v285 : i32 #[overflow = wrapping]; + hir.exec @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/alloc::vec::Vec::with_capacity(v286, v291) + v295 = arith.constant 8 : u32; + v294 = hir.bitcast v282 : u32; + v296 = arith.add v294, v295 : u32 #[overflow = checked]; + v297 = arith.constant 4 : u32; + v298 = arith.mod v296, v297 : u32; + hir.assertz v298 #[code = 250]; + v299 = hir.int_to_ptr v296 : ptr; + v300 = hir.load v299 : i32; + v734 = arith.constant 2 : u32; + v302 = hir.bitcast v300 : u32; + v304 = arith.shr v302, v734 : u32; + v305 = hir.bitcast v304 : i32; + v306 = hir.exec @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/miden::output_note::get_assets(v305, v276) : i32 + v292 = arith.constant 8 : i32; + v293 = arith.add v275, v292 : i32 #[overflow = wrapping]; + v307 = hir.bitcast v293 : u32; + v739 = arith.constant 4 : u32; + v309 = arith.mod v307, v739 : u32; + hir.assertz v309 #[code = 250]; + v310 = hir.int_to_ptr v307 : ptr; + hir.store v310, v306; + v738 = arith.constant 4 : u32; + v311 = hir.bitcast v282 : u32; + v313 = arith.add v311, v738 : u32 #[overflow = checked]; + v737 = arith.constant 4 : u32; + v315 = arith.mod v313, v737 : u32; + hir.assertz v315 #[code = 250]; + v316 = hir.int_to_ptr v313 : ptr; + v317 = hir.load v316 : i64; + v318 = hir.bitcast v275 : u32; + v736 = arith.constant 4 : u32; + v320 = arith.mod v318, v736 : u32; + hir.assertz v320 #[code = 250]; + v321 = hir.int_to_ptr v318 : ptr; + hir.store v321, v317; + v735 = arith.constant 16 : i32; + v323 = arith.add v282, v735 : i32 #[overflow = wrapping]; + v324 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/__stack_pointer : ptr + v325 = hir.bitcast v324 : ptr; + hir.store v325, v323; + builtin.ret ; + }; + + private builtin.function @intrinsics::felt::from_u32(v326: i32) -> felt { + ^block47(v326: i32): + v327 = hir.bitcast v326 : felt; + builtin.ret v327; + }; + + private builtin.function @alloc::raw_vec::RawVecInner::deallocate(v329: i32, v330: i32, v331: i32) { + ^block49(v329: i32, v330: i32, v331: i32): + v333 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/__stack_pointer : ptr + v334 = hir.bitcast v333 : ptr; + v335 = hir.load v334 : i32; + v336 = arith.constant 16 : i32; + v337 = arith.sub v335, v336 : i32 #[overflow = wrapping]; + v338 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/__stack_pointer : ptr + v339 = hir.bitcast v338 : ptr; + hir.store v339, v337; + v340 = arith.constant 4 : i32; + v341 = arith.add v337, v340 : i32 #[overflow = wrapping]; + hir.exec @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/alloc::raw_vec::RawVecInner::current_memory(v341, v329, v330, v331) + v343 = arith.constant 8 : u32; + v342 = hir.bitcast v337 : u32; + v344 = arith.add v342, v343 : u32 #[overflow = checked]; + v345 = arith.constant 4 : u32; + v346 = arith.mod v344, v345 : u32; + hir.assertz v346 #[code = 250]; + v347 = hir.int_to_ptr v344 : ptr; + v348 = hir.load v347 : i32; + v746 = arith.constant 0 : i32; + v332 = arith.constant 0 : i32; + v350 = arith.eq v348, v332 : i1; + v351 = arith.zext v350 : u32; + v352 = hir.bitcast v351 : i32; + v354 = arith.neq v352, v746 : i1; + scf.if v354{ + ^block108: + scf.yield ; + } else { + ^block52: + v745 = arith.constant 4 : u32; + v355 = hir.bitcast v337 : u32; + v357 = arith.add v355, v745 : u32 #[overflow = checked]; + v744 = arith.constant 4 : u32; + v359 = arith.mod v357, v744 : u32; + hir.assertz v359 #[code = 250]; + v360 = hir.int_to_ptr v357 : ptr; + v361 = hir.load v360 : i32; + v363 = arith.constant 12 : u32; + v362 = hir.bitcast v337 : u32; + v364 = arith.add v362, v363 : u32 #[overflow = checked]; + v743 = arith.constant 4 : u32; + v366 = arith.mod v364, v743 : u32; + hir.assertz v366 #[code = 250]; + v367 = hir.int_to_ptr v364 : ptr; + v368 = hir.load v367 : i32; + hir.exec @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/::deallocate(v361, v348, v368) + scf.yield ; + }; + v742 = arith.constant 16 : i32; + v371 = arith.add v337, v742 : i32 #[overflow = wrapping]; + v372 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/__stack_pointer : ptr + v373 = hir.bitcast v372 : ptr; + hir.store v373, v371; + builtin.ret ; + }; + + private builtin.function @alloc::raw_vec::RawVecInner::try_allocate_in(v374: i32, v375: i32, v376: i32, v377: i32, v378: i32) { + ^block53(v374: i32, v375: i32, v376: i32, v377: i32, v378: i32): + v381 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/__stack_pointer : ptr + v382 = hir.bitcast v381 : ptr; + v383 = hir.load v382 : i32; + v384 = arith.constant 16 : i32; + v385 = arith.sub v383, v384 : i32 #[overflow = wrapping]; + v386 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/__stack_pointer : ptr + v387 = hir.bitcast v386 : ptr; + hir.store v387, v385; + v397 = hir.bitcast v375 : u32; + v398 = arith.zext v397 : u64; + v399 = hir.bitcast v398 : i64; + v379 = arith.constant 0 : i32; + v392 = arith.sub v379, v377 : i32 #[overflow = wrapping]; + v389 = arith.constant -1 : i32; + v388 = arith.add v377, v378 : i32 #[overflow = wrapping]; + v390 = arith.add v388, v389 : i32 #[overflow = wrapping]; + v393 = arith.band v390, v392 : i32; + v394 = hir.bitcast v393 : u32; + v395 = arith.zext v394 : u64; + v396 = hir.bitcast v395 : i64; + v400 = arith.mul v396, v399 : i64 #[overflow = wrapping]; + v850 = arith.constant 0 : i32; + v401 = arith.constant 32 : i64; + v403 = hir.cast v401 : u32; + v402 = hir.bitcast v400 : u64; + v404 = arith.shr v402, v403 : u64; + v405 = hir.bitcast v404 : i64; + v406 = arith.trunc v405 : i32; + v408 = arith.neq v406, v850 : i1; + v762, v763, v764, v765, v766, v767 = scf.if v408 : i32, i32, i32, i32, i32, u32 { + ^block110: + v747 = arith.constant 0 : u32; + v754 = ub.poison i32 : i32; + scf.yield v374, v385, v754, v754, v754, v747; + } else { + ^block58: + v409 = arith.trunc v400 : i32; + v849 = arith.constant 0 : i32; + v410 = arith.constant -2147483648 : i32; + v411 = arith.sub v410, v377 : i32 #[overflow = wrapping]; + v413 = hir.bitcast v411 : u32; + v412 = hir.bitcast v409 : u32; + v414 = arith.lte v412, v413 : i1; + v415 = arith.zext v414 : u32; + v416 = hir.bitcast v415 : i32; + v418 = arith.neq v416, v849 : i1; + v810 = scf.if v418 : i32 { + ^block56: + v848 = arith.constant 0 : i32; + v429 = arith.neq v409, v848 : i1; + v809 = scf.if v429 : i32 { + ^block60: + v847 = arith.constant 0 : i32; + v445 = arith.neq v376, v847 : i1; + v808 = scf.if v445 : i32 { + ^block63: + v427 = arith.constant 1 : i32; + hir.exec @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/alloc::alloc::Global::alloc_impl(v385, v377, v409, v427) + v456 = hir.bitcast v385 : u32; + v501 = arith.constant 4 : u32; + v458 = arith.mod v456, v501 : u32; + hir.assertz v458 #[code = 250]; + v459 = hir.int_to_ptr v456 : ptr; + v460 = hir.load v459 : i32; + scf.yield v460; + } else { + ^block64: + v446 = arith.constant 8 : i32; + v447 = arith.add v385, v446 : i32 #[overflow = wrapping]; + hir.exec @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/::allocate(v447, v377, v409) + v431 = arith.constant 8 : u32; + v448 = hir.bitcast v385 : u32; + v450 = arith.add v448, v431 : u32 #[overflow = checked]; + v846 = arith.constant 4 : u32; + v452 = arith.mod v450, v846 : u32; + hir.assertz v452 #[code = 250]; + v453 = hir.int_to_ptr v450 : ptr; + v454 = hir.load v453 : i32; + scf.yield v454; + }; + v844 = arith.constant 0 : i32; + v845 = arith.constant 0 : i32; + v463 = arith.eq v808, v845 : i1; + v464 = arith.zext v463 : u32; + v465 = hir.bitcast v464 : i32; + v467 = arith.neq v465, v844 : i1; + scf.if v467{ + ^block65: + v843 = arith.constant 8 : u32; + v484 = hir.bitcast v374 : u32; + v486 = arith.add v484, v843 : u32 #[overflow = checked]; + v842 = arith.constant 4 : u32; + v488 = arith.mod v486, v842 : u32; + hir.assertz v488 #[code = 250]; + v489 = hir.int_to_ptr v486 : ptr; + hir.store v489, v409; + v841 = arith.constant 4 : u32; + v491 = hir.bitcast v374 : u32; + v493 = arith.add v491, v841 : u32 #[overflow = checked]; + v840 = arith.constant 4 : u32; + v495 = arith.mod v493, v840 : u32; + hir.assertz v495 #[code = 250]; + v496 = hir.int_to_ptr v493 : ptr; + hir.store v496, v377; + scf.yield ; + } else { + ^block66: + v839 = arith.constant 8 : u32; + v469 = hir.bitcast v374 : u32; + v471 = arith.add v469, v839 : u32 #[overflow = checked]; + v838 = arith.constant 4 : u32; + v473 = arith.mod v471, v838 : u32; + hir.assertz v473 #[code = 250]; + v474 = hir.int_to_ptr v471 : ptr; + hir.store v474, v808; + v837 = arith.constant 4 : u32; + v476 = hir.bitcast v374 : u32; + v478 = arith.add v476, v837 : u32 #[overflow = checked]; + v836 = arith.constant 4 : u32; + v480 = arith.mod v478, v836 : u32; + hir.assertz v480 #[code = 250]; + v481 = hir.int_to_ptr v478 : ptr; + hir.store v481, v375; + scf.yield ; + }; + v834 = arith.constant 0 : i32; + v835 = arith.constant 1 : i32; + v807 = cf.select v467, v835, v834 : i32; + scf.yield v807; + } else { + ^block61: + v833 = arith.constant 8 : u32; + v430 = hir.bitcast v374 : u32; + v432 = arith.add v430, v833 : u32 #[overflow = checked]; + v832 = arith.constant 4 : u32; + v434 = arith.mod v432, v832 : u32; + hir.assertz v434 #[code = 250]; + v435 = hir.int_to_ptr v432 : ptr; + hir.store v435, v377; + v831 = arith.constant 4 : u32; + v438 = hir.bitcast v374 : u32; + v440 = arith.add v438, v831 : u32 #[overflow = checked]; + v830 = arith.constant 4 : u32; + v442 = arith.mod v440, v830 : u32; + hir.assertz v442 #[code = 250]; + v829 = arith.constant 0 : i32; + v443 = hir.int_to_ptr v440 : ptr; + hir.store v443, v829; + v828 = arith.constant 0 : i32; + scf.yield v828; + }; + scf.yield v809; + } else { + ^block59: + v827 = ub.poison i32 : i32; + scf.yield v827; + }; + v822 = arith.constant 0 : u32; + v755 = arith.constant 1 : u32; + v815 = cf.select v418, v755, v822 : u32; + v823 = ub.poison i32 : i32; + v814 = cf.select v418, v385, v823 : i32; + v824 = ub.poison i32 : i32; + v813 = cf.select v418, v374, v824 : i32; + v825 = ub.poison i32 : i32; + v812 = cf.select v418, v825, v385 : i32; + v826 = ub.poison i32 : i32; + v811 = cf.select v418, v826, v374 : i32; + scf.yield v811, v812, v813, v810, v814, v815; + }; + v768, v769, v770 = scf.index_switch v767 : i32, i32, i32 + case 0 { + ^block57: + v821 = arith.constant 4 : u32; + v421 = hir.bitcast v762 : u32; + v423 = arith.add v421, v821 : u32 #[overflow = checked]; + v820 = arith.constant 4 : u32; + v425 = arith.mod v423, v820 : u32; + hir.assertz v425 #[code = 250]; + v819 = arith.constant 0 : i32; + v426 = hir.int_to_ptr v423 : ptr; + hir.store v426, v819; + v818 = arith.constant 1 : i32; + scf.yield v762, v818, v763; + } + default { + ^block114: + scf.yield v764, v765, v766; + }; + v500 = hir.bitcast v768 : u32; + v817 = arith.constant 4 : u32; + v502 = arith.mod v500, v817 : u32; + hir.assertz v502 #[code = 250]; + v503 = hir.int_to_ptr v500 : ptr; + hir.store v503, v769; + v816 = arith.constant 16 : i32; + v508 = arith.add v770, v816 : i32 #[overflow = wrapping]; + v509 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/__stack_pointer : ptr + v510 = hir.bitcast v509 : ptr; + hir.store v510, v508; + builtin.ret ; + }; + + private builtin.function @::allocate(v511: i32, v512: i32, v513: i32) { + ^block67(v511: i32, v512: i32, v513: i32): + v515 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/__stack_pointer : ptr + v516 = hir.bitcast v515 : ptr; + v517 = hir.load v516 : i32; + v518 = arith.constant 16 : i32; + v519 = arith.sub v517, v518 : i32 #[overflow = wrapping]; + v520 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/__stack_pointer : ptr + v521 = hir.bitcast v520 : ptr; + hir.store v521, v519; + v514 = arith.constant 0 : i32; + v522 = arith.constant 8 : i32; + v523 = arith.add v519, v522 : i32 #[overflow = wrapping]; + hir.exec @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/alloc::alloc::Global::alloc_impl(v523, v512, v513, v514) + v526 = arith.constant 12 : u32; + v525 = hir.bitcast v519 : u32; + v527 = arith.add v525, v526 : u32 #[overflow = checked]; + v528 = arith.constant 4 : u32; + v529 = arith.mod v527, v528 : u32; + hir.assertz v529 #[code = 250]; + v530 = hir.int_to_ptr v527 : ptr; + v531 = hir.load v530 : i32; + v533 = arith.constant 8 : u32; + v532 = hir.bitcast v519 : u32; + v534 = arith.add v532, v533 : u32 #[overflow = checked]; + v855 = arith.constant 4 : u32; + v536 = arith.mod v534, v855 : u32; + hir.assertz v536 #[code = 250]; + v537 = hir.int_to_ptr v534 : ptr; + v538 = hir.load v537 : i32; + v539 = hir.bitcast v511 : u32; + v854 = arith.constant 4 : u32; + v541 = arith.mod v539, v854 : u32; + hir.assertz v541 #[code = 250]; + v542 = hir.int_to_ptr v539 : ptr; + hir.store v542, v538; + v853 = arith.constant 4 : u32; + v543 = hir.bitcast v511 : u32; + v545 = arith.add v543, v853 : u32 #[overflow = checked]; + v852 = arith.constant 4 : u32; + v547 = arith.mod v545, v852 : u32; + hir.assertz v547 #[code = 250]; + v548 = hir.int_to_ptr v545 : ptr; + hir.store v548, v531; + v851 = arith.constant 16 : i32; + v550 = arith.add v519, v851 : i32 #[overflow = wrapping]; + v551 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/__stack_pointer : ptr + v552 = hir.bitcast v551 : ptr; + hir.store v552, v550; + builtin.ret ; + }; + + private builtin.function @alloc::alloc::Global::alloc_impl(v553: i32, v554: i32, v555: i32, v556: i32) { + ^block69(v553: i32, v554: i32, v555: i32, v556: i32): + v871 = arith.constant 0 : i32; + v557 = arith.constant 0 : i32; + v558 = arith.eq v555, v557 : i1; + v559 = arith.zext v558 : u32; + v560 = hir.bitcast v559 : i32; + v562 = arith.neq v560, v871 : i1; + v867 = scf.if v562 : i32 { + ^block117: + scf.yield v554; + } else { + ^block72: + hir.exec @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/__rustc::__rust_no_alloc_shim_is_unstable_v2() + v870 = arith.constant 0 : i32; + v564 = arith.neq v556, v870 : i1; + v866 = scf.if v564 : i32 { + ^block73: + v566 = hir.exec @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/__rustc::__rust_alloc_zeroed(v555, v554) : i32 + scf.yield v566; + } else { + ^block74: + v565 = hir.exec @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/__rustc::__rust_alloc(v555, v554) : i32 + scf.yield v565; + }; + scf.yield v866; + }; + v570 = arith.constant 4 : u32; + v569 = hir.bitcast v553 : u32; + v571 = arith.add v569, v570 : u32 #[overflow = checked]; + v869 = arith.constant 4 : u32; + v573 = arith.mod v571, v869 : u32; + hir.assertz v573 #[code = 250]; + v574 = hir.int_to_ptr v571 : ptr; + hir.store v574, v555; + v576 = hir.bitcast v553 : u32; + v868 = arith.constant 4 : u32; + v578 = arith.mod v576, v868 : u32; + hir.assertz v578 #[code = 250]; + v579 = hir.int_to_ptr v576 : ptr; + hir.store v579, v867; + builtin.ret ; + }; + + private builtin.function @alloc::raw_vec::RawVecInner::current_memory(v580: i32, v581: i32, v582: i32, v583: i32) { + ^block75(v580: i32, v581: i32, v582: i32, v583: i32): + v897 = arith.constant 0 : i32; + v584 = arith.constant 0 : i32; + v588 = arith.eq v583, v584 : i1; + v589 = arith.zext v588 : u32; + v590 = hir.bitcast v589 : i32; + v592 = arith.neq v590, v897 : i1; + v884, v885 = scf.if v592 : i32, i32 { + ^block121: + v896 = arith.constant 0 : i32; + v586 = arith.constant 4 : i32; + scf.yield v586, v896; + } else { + ^block78: + v593 = hir.bitcast v581 : u32; + v628 = arith.constant 4 : u32; + v595 = arith.mod v593, v628 : u32; + hir.assertz v595 #[code = 250]; + v596 = hir.int_to_ptr v593 : ptr; + v597 = hir.load v596 : i32; + v894 = arith.constant 0 : i32; + v895 = arith.constant 0 : i32; + v599 = arith.eq v597, v895 : i1; + v600 = arith.zext v599 : u32; + v601 = hir.bitcast v600 : i32; + v603 = arith.neq v601, v894 : i1; + v882 = scf.if v603 : i32 { + ^block120: + v893 = arith.constant 0 : i32; + scf.yield v893; + } else { + ^block79: + v892 = arith.constant 4 : u32; + v604 = hir.bitcast v580 : u32; + v606 = arith.add v604, v892 : u32 #[overflow = checked]; + v891 = arith.constant 4 : u32; + v608 = arith.mod v606, v891 : u32; + hir.assertz v608 #[code = 250]; + v609 = hir.int_to_ptr v606 : ptr; + hir.store v609, v582; + v890 = arith.constant 4 : u32; + v610 = hir.bitcast v581 : u32; + v612 = arith.add v610, v890 : u32 #[overflow = checked]; + v889 = arith.constant 4 : u32; + v614 = arith.mod v612, v889 : u32; + hir.assertz v614 #[code = 250]; + v615 = hir.int_to_ptr v612 : ptr; + v616 = hir.load v615 : i32; + v617 = hir.bitcast v580 : u32; + v888 = arith.constant 4 : u32; + v619 = arith.mod v617, v888 : u32; + hir.assertz v619 #[code = 250]; + v620 = hir.int_to_ptr v617 : ptr; + hir.store v620, v616; + v621 = arith.mul v597, v583 : i32 #[overflow = wrapping]; + scf.yield v621; + }; + v622 = arith.constant 8 : i32; + v887 = arith.constant 4 : i32; + v883 = cf.select v603, v887, v622 : i32; + scf.yield v883, v882; + }; + v625 = arith.add v580, v884 : i32 #[overflow = wrapping]; + v627 = hir.bitcast v625 : u32; + v886 = arith.constant 4 : u32; + v629 = arith.mod v627, v886 : u32; + hir.assertz v629 #[code = 250]; + v630 = hir.int_to_ptr v627 : ptr; + hir.store v630, v885; + builtin.ret ; + }; + + private builtin.function @::deallocate(v631: i32, v632: i32, v633: i32) { + ^block80(v631: i32, v632: i32, v633: i32): + v899 = arith.constant 0 : i32; + v634 = arith.constant 0 : i32; + v635 = arith.eq v633, v634 : i1; + v636 = arith.zext v635 : u32; + v637 = hir.bitcast v636 : i32; + v639 = arith.neq v637, v899 : i1; + scf.if v639{ + ^block82: + scf.yield ; + } else { + ^block83: + hir.exec @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/__rustc::__rust_dealloc(v631, v633, v632) + scf.yield ; + }; + builtin.ret ; + }; + + private builtin.function @alloc::raw_vec::handle_error(v640: i32, v641: i32, v642: i32) { + ^block84(v640: i32, v641: i32, v642: i32): + ub.unreachable ; + }; + + private builtin.function @core::ptr::alignment::Alignment::max(v643: i32, v644: i32) -> i32 { + ^block86(v643: i32, v644: i32): + v651 = arith.constant 0 : i32; + v647 = hir.bitcast v644 : u32; + v646 = hir.bitcast v643 : u32; + v648 = arith.gt v646, v647 : i1; + v649 = arith.zext v648 : u32; + v650 = hir.bitcast v649 : i32; + v652 = arith.neq v650, v651 : i1; + v653 = cf.select v652, v643, v644 : i32; + builtin.ret v653; + }; + + private builtin.function @miden::output_note::get_assets(v654: i32, v655: felt) -> i32 { + ^block88(v654: i32, v655: felt): + v656, v657 = hir.exec @miden/output_note/get_assets(v654, v655) : i32, i32 + builtin.ret v656; + }; + + builtin.global_variable private @#__stack_pointer : i32 { + builtin.ret_imm 1048576; + }; + + builtin.global_variable private @#GOT.data.internal.__memory_base : i32 { + builtin.ret_imm 0; + }; + + builtin.segment readonly @1048576 = 0x0073722e65746f6e5f74757074756f2f73676e69646e69622f6372732f7379732d657361622f6b64732f3272656c69706d6f632f6e6564696d2f6372732f6e656572672f73726573552f; + + builtin.segment @1048652 = 0x000000220000006500000049001000000000000100000001; + }; + + public builtin.function @binding() -> felt { + ^block92: + v659 = hir.exec @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1#binding() : felt + builtin.ret v659; + }; +}; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_assets_binding.masm b/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_assets_binding.masm new file mode 100644 index 000000000..c01170f1b --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_assets_binding.masm @@ -0,0 +1,1851 @@ +# mod miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1 + +@callconv("canon-lift") +pub proc binding( + +) -> felt + exec.::miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1::init + trace.240 + nop + exec.::miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1::rust_sdk_output_note_get_assets_binding::miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1#binding + trace.252 + nop + exec.::std::sys::truncate_stack +end + +proc init + push.1179648 + trace.240 + exec.::intrinsics::mem::heap_init + trace.252 + push.[15981665288193965091,10393407978073516861,16327500535759164990,13006709555859712660] + adv.push_mapval + push.262144 + push.7 + trace.240 + exec.::std::mem::pipe_preimage_to_memory + trace.252 + drop + push.1048576 + u32assert + mem_store.278560 + push.0 + u32assert + mem_store.278561 +end + +# mod miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1::rust_sdk_output_note_get_assets_binding + +@callconv("C") +proc __wasm_call_ctors( + +) + nop +end + +@callconv("C") +proc __rustc::__rust_alloc(i32, i32) -> i32 + push.1114244 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.1048676 + u32wrapping_add + movup.2 + swap.1 + trace.240 + nop + exec.::miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1::rust_sdk_output_note_get_assets_binding::::alloc + trace.252 + nop +end + +@callconv("C") +proc __rustc::__rust_dealloc(i32, i32, i32) + drop + drop + drop +end + +@callconv("C") +proc __rustc::__rust_alloc_zeroed(i32, i32) -> i32 + push.1114244 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.1048676 + u32wrapping_add + dup.1 + swap.2 + swap.3 + swap.1 + trace.240 + nop + exec.::miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1::rust_sdk_output_note_get_assets_binding::::alloc + trace.252 + nop + push.0 + push.0 + dup.2 + eq + neq + if.true + swap.1 + drop + else + push.0 + push.0 + dup.3 + eq + neq + if.true + swap.1 + drop + else + push.0 + movup.2 + dup.2 + push.0 + dup.2 + push.0 + gte + while.true + dup.1 + dup.1 + push.1 + u32overflowing_madd + assertz + dup.4 + swap.1 + u32divmod.4 + swap.1 + dup.0 + mem_load + dup.2 + push.8 + u32wrapping_mul + push.255 + swap.1 + u32shl + u32not + swap.1 + u32and + movup.3 + movup.3 + push.8 + u32wrapping_mul + u32shl + u32or + swap.1 + mem_store + u32wrapping_add.1 + dup.0 + dup.3 + u32gte + end + dropw + end + end +end + +@callconv("C") +proc rust_sdk_output_note_get_assets_binding::bindings::__link_custom_section_describing_imports( + +) + nop +end + +@callconv("C") +proc miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1#binding( + +) -> felt + push.1114240 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.16 + u32wrapping_sub + push.1114240 + dup.1 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + trace.240 + nop + exec.::miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1::rust_sdk_output_note_get_assets_binding::wit_bindgen::rt::run_ctors_once + trace.252 + nop + push.0 + trace.240 + nop + exec.::miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1::rust_sdk_output_note_get_assets_binding::intrinsics::felt::from_u32 + trace.252 + nop + push.4 + dup.2 + u32wrapping_add + trace.240 + nop + exec.::miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1::rust_sdk_output_note_get_assets_binding::miden_base_sys::bindings::output_note::get_assets + trace.252 + nop + push.12 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + trace.240 + nop + exec.::miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1::rust_sdk_output_note_get_assets_binding::intrinsics::felt::from_u32 + trace.252 + nop + push.16 + push.4 + dup.3 + u32wrapping_add + dup.1 + swap.2 + swap.1 + trace.240 + nop + exec.::miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1::rust_sdk_output_note_get_assets_binding::alloc::raw_vec::RawVecInner::deallocate + trace.252 + nop + push.16 + movup.2 + u32wrapping_add + push.1114240 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop +end + +@callconv("C") +proc __rustc::__rust_no_alloc_shim_is_unstable_v2( + +) + nop +end + +@callconv("C") +proc wit_bindgen::rt::run_ctors_once( + +) + push.1114244 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.1048680 + u32wrapping_add + u32divmod.4 + swap.1 + swap.1 + dup.1 + mem_load + swap.1 + push.8 + u32wrapping_mul + u32shr + swap.1 + drop + push.255 + u32and + push.0 + swap.1 + neq + if.true + nop + else + push.1114244 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + trace.240 + nop + exec.::miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1::rust_sdk_output_note_get_assets_binding::__wasm_call_ctors + trace.252 + nop + push.1 + push.1048680 + movup.2 + u32wrapping_add + u32divmod.4 + swap.1 + dup.0 + mem_load + dup.2 + push.8 + u32wrapping_mul + push.255 + swap.1 + u32shl + u32not + swap.1 + u32and + movup.3 + movup.3 + push.8 + u32wrapping_mul + u32shl + u32or + swap.1 + mem_store + end +end + +@callconv("C") +proc ::alloc( + i32, + i32, + i32 +) -> i32 + push.16 + push.0 + push.16 + dup.4 + swap.1 + u32gt + neq + dup.3 + swap.1 + cdrop + push.0 + push.4294967295 + dup.2 + u32wrapping_add + dup.2 + u32and + neq + if.true + dropw + push.0 + push.3735929054 + else + movup.2 + trace.240 + nop + exec.::miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1::rust_sdk_output_note_get_assets_binding::core::ptr::alignment::Alignment::max + trace.252 + nop + push.0 + push.2147483648 + dup.2 + u32wrapping_sub + dup.4 + swap.1 + u32gt + neq + dup.0 + if.true + movdn.3 + drop + drop + drop + push.3735929054 + else + push.0 + dup.2 + u32wrapping_sub + push.4294967295 + movup.5 + dup.4 + u32wrapping_add + u32wrapping_add + u32and + dup.3 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.0 + neq + if.true + nop + else + trace.240 + nop + exec.::miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1::rust_sdk_output_note_get_assets_binding::intrinsics::mem::heap_base + trace.252 + nop + trace.240 + nop + exec.::intrinsics::mem::memory_size + trace.252 + nop + dup.5 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + push.16 + movup.2 + swap.1 + u32shl + movup.2 + u32wrapping_add + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + end + dup.3 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.0 + push.4294967295 + dup.2 + u32xor + dup.3 + swap.1 + u32gt + neq + if.true + drop + drop + movdn.2 + drop + drop + push.0 + else + movup.4 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + movup.2 + dup.2 + u32wrapping_add + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + movup.2 + u32wrapping_add + end + end + push.1 + push.0 + movup.3 + cdrop + swap.1 + end + push.0 + movup.2 + eq + if.true + drop + push.0 + assert + else + nop + end +end + +@callconv("C") +proc intrinsics::mem::heap_base( + +) -> i32 + trace.240 + nop + exec.::intrinsics::mem::heap_base + trace.252 + nop +end + +@callconv("C") +proc alloc::vec::Vec::with_capacity(i32, i32) + push.1114240 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.16 + u32wrapping_sub + push.1114240 + dup.1 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.16 + push.8 + dup.2 + u32wrapping_add + dup.1 + movup.3 + swap.5 + movdn.3 + swap.2 + swap.1 + trace.240 + nop + exec.::miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1::rust_sdk_output_note_get_assets_binding::alloc::raw_vec::RawVecInner::with_capacity_in + trace.252 + nop + push.8 + dup.2 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.8 + dup.3 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + push.0 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + movup.2 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.16 + u32wrapping_add + push.1114240 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop +end + +@callconv("C") +proc alloc::raw_vec::RawVecInner::with_capacity_in( + i32, + i32, + i32, + i32 +) + push.1114240 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.16 + u32wrapping_sub + push.1114240 + dup.1 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.0 + push.256 + push.4 + dup.3 + u32wrapping_add + movup.4 + swap.6 + movdn.4 + movup.3 + swap.5 + movdn.3 + trace.240 + nop + exec.::miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1::rust_sdk_output_note_get_assets_binding::alloc::raw_vec::RawVecInner::try_allocate_in + trace.252 + nop + push.8 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.4 + dup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.0 + push.1 + movup.2 + neq + neq + if.true + movup.3 + drop + push.12 + dup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.4 + dup.4 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + movup.2 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.16 + u32wrapping_add + push.1114240 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + else + movup.2 + drop + push.12 + movup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + swap.1 + trace.240 + nop + exec.::miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1::rust_sdk_output_note_get_assets_binding::alloc::raw_vec::handle_error + trace.252 + nop + push.0 + assert + end +end + +@callconv("C") +proc miden_base_sys::bindings::output_note::get_assets( + i32, + felt +) + push.1114240 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.16 + u32wrapping_sub + push.1114240 + dup.1 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.1114244 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.1048660 + u32wrapping_add + push.4 + dup.2 + u32wrapping_add + trace.240 + nop + exec.::miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1::rust_sdk_output_note_get_assets_binding::alloc::vec::Vec::with_capacity + trace.252 + nop + push.8 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.2 + swap.1 + swap.1 + u32shr + movup.3 + swap.1 + trace.240 + nop + exec.::miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1::rust_sdk_output_note_get_assets_binding::miden::output_note::get_assets + trace.252 + nop + push.8 + dup.3 + u32wrapping_add + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.4 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + movup.3 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.16 + u32wrapping_add + push.1114240 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop +end + +@callconv("C") +proc intrinsics::felt::from_u32(i32) -> felt + nop +end + +@callconv("C") +proc alloc::raw_vec::RawVecInner::deallocate( + i32, + i32, + i32 +) + push.1114240 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.16 + u32wrapping_sub + push.1114240 + dup.1 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.4 + dup.1 + u32wrapping_add + swap.1 + swap.4 + swap.3 + swap.2 + swap.1 + trace.240 + nop + exec.::miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1::rust_sdk_output_note_get_assets_binding::alloc::raw_vec::RawVecInner::current_memory + trace.252 + nop + push.8 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.0 + push.0 + dup.2 + eq + neq + if.true + drop + else + push.4 + dup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.12 + dup.3 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + movdn.2 + trace.240 + nop + exec.::miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1::rust_sdk_output_note_get_assets_binding::::deallocate + trace.252 + nop + end + push.16 + u32wrapping_add + push.1114240 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop +end + +@callconv("C") +proc alloc::raw_vec::RawVecInner::try_allocate_in( + i32, + i32, + i32, + i32, + i32 +) + push.1114240 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.16 + u32wrapping_sub + push.1114240 + dup.1 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + dup.2 + push.0 + push.0 + dup.7 + u32wrapping_sub + push.4294967295 + movup.9 + dup.9 + u32wrapping_add + u32wrapping_add + u32and + push.0 + trace.240 + nop + exec.::intrinsics::i64::wrapping_mul + trace.252 + nop + push.0 + push.32 + push.0 + dup.0 + push.2147483648 + u32and + eq.2147483648 + assertz + assertz + dup.0 + push.4294967295 + u32lte + assert + dup.3 + dup.3 + movup.2 + trace.240 + nop + exec.::std::math::u64::shr + trace.252 + nop + drop + neq + if.true + drop + drop + movup.2 + drop + movup.2 + drop + movup.2 + drop + push.0 + push.3735929054 + dup.0 + dup.1 + swap.4 + swap.1 + swap.3 + swap.5 + else + drop + push.0 + push.2147483648 + dup.7 + u32wrapping_sub + dup.2 + swap.1 + u32lte + neq + dup.0 + if.true + push.0 + dup.2 + neq + if.true + push.0 + movup.6 + neq + if.true + push.1 + dup.3 + dup.7 + dup.4 + swap.2 + trace.240 + nop + exec.::miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1::rust_sdk_output_note_get_assets_binding::alloc::alloc::Global::alloc_impl + trace.252 + nop + dup.2 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + else + push.8 + dup.3 + u32wrapping_add + dup.6 + dup.3 + swap.2 + trace.240 + nop + exec.::miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1::rust_sdk_output_note_get_assets_binding::::allocate + trace.252 + nop + push.8 + dup.3 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + end + push.0 + push.0 + dup.2 + eq + neq + dup.0 + if.true + movup.6 + movup.2 + drop + drop + push.8 + dup.5 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + movup.3 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.4 + dup.4 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + movup.5 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + else + movup.7 + movup.4 + drop + drop + push.8 + dup.5 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.4 + dup.4 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + movup.5 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + end + push.0 + push.1 + movup.2 + cdrop + else + movup.2 + swap.5 + movdn.2 + swap.4 + swap.1 + drop + drop + drop + push.8 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + movup.4 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.4 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + push.0 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.0 + swap.1 + swap.3 + swap.2 + swap.1 + end + else + swap.1 + drop + movup.3 + drop + movup.3 + drop + movup.3 + drop + push.3735929054 + end + push.0 + push.1 + dup.3 + cdrop + push.3735929054 + dup.3 + dup.5 + swap.1 + cdrop + push.3735929054 + dup.4 + dup.7 + swap.1 + cdrop + push.3735929054 + dup.5 + movup.2 + swap.7 + movdn.2 + cdrop + push.3735929054 + movup.2 + swap.7 + movdn.2 + swap.1 + swap.5 + cdrop + swap.1 + swap.5 + swap.4 + swap.2 + swap.3 + swap.1 + end + movup.5 + eq.0 + if.true + movup.2 + drop + movup.2 + drop + movup.2 + drop + push.4 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + push.0 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.1 + swap.1 + else + drop + drop + end + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.16 + u32wrapping_add + push.1114240 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop +end + +@callconv("C") +proc ::allocate( + i32, + i32, + i32 +) + push.1114240 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.16 + u32wrapping_sub + push.1114240 + dup.1 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.0 + push.8 + dup.2 + u32wrapping_add + movup.2 + swap.5 + movdn.2 + swap.1 + swap.3 + swap.4 + swap.1 + trace.240 + nop + exec.::miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1::rust_sdk_output_note_get_assets_binding::alloc::alloc::Global::alloc_impl + trace.252 + nop + push.12 + dup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.8 + dup.3 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + dup.2 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.4 + movup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.16 + u32wrapping_add + push.1114240 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop +end + +@callconv("C") +proc alloc::alloc::Global::alloc_impl( + i32, + i32, + i32, + i32 +) + push.0 + push.0 + dup.4 + eq + neq + if.true + movup.3 + drop + swap.1 + else + trace.240 + nop + exec.::miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1::rust_sdk_output_note_get_assets_binding::__rustc::__rust_no_alloc_shim_is_unstable_v2 + trace.252 + nop + push.0 + movup.4 + neq + if.true + swap.1 + dup.2 + trace.240 + nop + exec.::miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1::rust_sdk_output_note_get_assets_binding::__rustc::__rust_alloc_zeroed + trace.252 + nop + else + swap.1 + dup.2 + trace.240 + nop + exec.::miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1::rust_sdk_output_note_get_assets_binding::__rustc::__rust_alloc + trace.252 + nop + end + end + push.4 + dup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + movup.3 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + swap.1 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop +end + +@callconv("C") +proc alloc::raw_vec::RawVecInner::current_memory( + i32, + i32, + i32, + i32 +) + push.0 + push.0 + dup.5 + eq + neq + if.true + movdn.3 + drop + drop + drop + push.0 + push.4 + else + dup.1 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.0 + push.0 + dup.2 + eq + neq + dup.0 + if.true + swap.1 + drop + movup.2 + drop + movup.2 + drop + movup.2 + drop + push.0 + else + push.4 + dup.3 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + movup.5 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.4 + movup.4 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + dup.3 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + swap.3 + trace.240 + nop + exec.::intrinsics::i32::wrapping_mul + trace.252 + nop + movup.2 + swap.1 + end + push.8 + push.4 + movup.3 + cdrop + end + movup.2 + u32wrapping_add + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop +end + +@callconv("C") +proc ::deallocate( + i32, + i32, + i32 +) + push.0 + push.0 + dup.4 + eq + neq + if.true + drop + drop + drop + else + movup.2 + swap.1 + trace.240 + nop + exec.::miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1::rust_sdk_output_note_get_assets_binding::__rustc::__rust_dealloc + trace.252 + nop + end +end + +@callconv("C") +proc alloc::raw_vec::handle_error(i32, i32, i32) + drop + drop + drop + push.0 + assert +end + +@callconv("C") +proc core::ptr::alignment::Alignment::max(i32, i32) -> i32 + push.0 + dup.2 + dup.2 + swap.1 + u32gt + neq + cdrop +end + +@callconv("C") +proc miden::output_note::get_assets(i32, felt) -> i32 + trace.240 + nop + exec.::miden::output_note::get_assets + trace.252 + nop + swap.1 + drop +end + diff --git a/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_assets_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_assets_binding.wat new file mode 100644 index 000000000..dc8499f77 --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_assets_binding.wat @@ -0,0 +1,582 @@ +(component + (type (;0;) + (instance + (type (;0;) (record (field "inner" f32))) + (export (;1;) "felt" (type (eq 0))) + ) + ) + (import "miden:base/core-types@1.0.0" (instance (;0;) (type 0))) + (core module (;0;) + (type (;0;) (func)) + (type (;1;) (func (param i32 i32) (result i32))) + (type (;2;) (func (param i32 i32 i32))) + (type (;3;) (func (result f32))) + (type (;4;) (func (param i32 i32 i32) (result i32))) + (type (;5;) (func (result i32))) + (type (;6;) (func (param i32 i32))) + (type (;7;) (func (param i32 i32 i32 i32))) + (type (;8;) (func (param i32 f32))) + (type (;9;) (func (param i32) (result f32))) + (type (;10;) (func (param i32 i32 i32 i32 i32))) + (type (;11;) (func (param i32 f32) (result i32))) + (table (;0;) 2 2 funcref) + (memory (;0;) 17) + (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) + (global $GOT.data.internal.__memory_base (;1;) i32 i32.const 0) + (export "memory" (memory 0)) + (export "miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1#binding" (func $miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1#binding)) + (elem (;0;) (i32.const 1) func $rust_sdk_output_note_get_assets_binding::bindings::__link_custom_section_describing_imports) + (func $__wasm_call_ctors (;0;) (type 0)) + (func $__rustc::__rust_alloc (;1;) (type 1) (param i32 i32) (result i32) + global.get $GOT.data.internal.__memory_base + i32.const 1048676 + i32.add + local.get 1 + local.get 0 + call $::alloc + ) + (func $__rustc::__rust_dealloc (;2;) (type 2) (param i32 i32 i32)) + (func $__rustc::__rust_alloc_zeroed (;3;) (type 1) (param i32 i32) (result i32) + block ;; label = @1 + global.get $GOT.data.internal.__memory_base + i32.const 1048676 + i32.add + local.get 1 + local.get 0 + call $::alloc + local.tee 1 + i32.eqz + br_if 0 (;@1;) + local.get 0 + i32.eqz + br_if 0 (;@1;) + local.get 1 + i32.const 0 + local.get 0 + memory.fill + end + local.get 1 + ) + (func $rust_sdk_output_note_get_assets_binding::bindings::__link_custom_section_describing_imports (;4;) (type 0)) + (func $miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1#binding (;5;) (type 3) (result f32) + (local i32 f32) + global.get $__stack_pointer + i32.const 16 + i32.sub + local.tee 0 + global.set $__stack_pointer + call $wit_bindgen::rt::run_ctors_once + local.get 0 + i32.const 4 + i32.add + i32.const 0 + call $intrinsics::felt::from_u32 + call $miden_base_sys::bindings::output_note::get_assets + local.get 0 + i32.load offset=12 + call $intrinsics::felt::from_u32 + local.set 1 + local.get 0 + i32.const 4 + i32.add + i32.const 16 + i32.const 16 + call $alloc::raw_vec::RawVecInner::deallocate + local.get 0 + i32.const 16 + i32.add + global.set $__stack_pointer + local.get 1 + ) + (func $__rustc::__rust_no_alloc_shim_is_unstable_v2 (;6;) (type 0) + return + ) + (func $wit_bindgen::rt::run_ctors_once (;7;) (type 0) + (local i32) + block ;; label = @1 + global.get $GOT.data.internal.__memory_base + i32.const 1048680 + i32.add + i32.load8_u + br_if 0 (;@1;) + global.get $GOT.data.internal.__memory_base + local.set 0 + call $__wasm_call_ctors + local.get 0 + i32.const 1048680 + i32.add + i32.const 1 + i32.store8 + end + ) + (func $::alloc (;8;) (type 4) (param i32 i32 i32) (result i32) + (local i32 i32) + block ;; label = @1 + local.get 1 + i32.const 16 + local.get 1 + i32.const 16 + i32.gt_u + select + local.tee 3 + local.get 3 + i32.const -1 + i32.add + i32.and + br_if 0 (;@1;) + local.get 2 + i32.const -2147483648 + local.get 1 + local.get 3 + call $core::ptr::alignment::Alignment::max + local.tee 1 + i32.sub + i32.gt_u + br_if 0 (;@1;) + i32.const 0 + local.set 3 + local.get 2 + local.get 1 + i32.add + i32.const -1 + i32.add + i32.const 0 + local.get 1 + i32.sub + i32.and + local.set 2 + block ;; label = @2 + local.get 0 + i32.load + br_if 0 (;@2;) + local.get 0 + call $intrinsics::mem::heap_base + memory.size + i32.const 16 + i32.shl + i32.add + i32.store + end + block ;; label = @2 + local.get 2 + local.get 0 + i32.load + local.tee 4 + i32.const -1 + i32.xor + i32.gt_u + br_if 0 (;@2;) + local.get 0 + local.get 4 + local.get 2 + i32.add + i32.store + local.get 4 + local.get 1 + i32.add + local.set 3 + end + local.get 3 + return + end + unreachable + ) + (func $intrinsics::mem::heap_base (;9;) (type 5) (result i32) + unreachable + ) + (func $alloc::vec::Vec::with_capacity (;10;) (type 6) (param i32 i32) + (local i32 i64) + global.get $__stack_pointer + i32.const 16 + i32.sub + local.tee 2 + global.set $__stack_pointer + local.get 2 + i32.const 8 + i32.add + i32.const 16 + i32.const 16 + local.get 1 + call $alloc::raw_vec::RawVecInner::with_capacity_in + local.get 2 + i64.load offset=8 + local.set 3 + local.get 0 + i32.const 0 + i32.store offset=8 + local.get 0 + local.get 3 + i64.store align=4 + local.get 2 + i32.const 16 + i32.add + global.set $__stack_pointer + ) + (func $alloc::raw_vec::RawVecInner::with_capacity_in (;11;) (type 7) (param i32 i32 i32 i32) + (local i32) + global.get $__stack_pointer + i32.const 16 + i32.sub + local.tee 4 + global.set $__stack_pointer + local.get 4 + i32.const 4 + i32.add + i32.const 256 + i32.const 0 + local.get 1 + local.get 2 + call $alloc::raw_vec::RawVecInner::try_allocate_in + local.get 4 + i32.load offset=8 + local.set 2 + block ;; label = @1 + local.get 4 + i32.load offset=4 + i32.const 1 + i32.ne + br_if 0 (;@1;) + local.get 2 + local.get 4 + i32.load offset=12 + local.get 3 + call $alloc::raw_vec::handle_error + unreachable + end + local.get 0 + local.get 4 + i32.load offset=12 + i32.store offset=4 + local.get 0 + local.get 2 + i32.store + local.get 4 + i32.const 16 + i32.add + global.set $__stack_pointer + ) + (func $miden_base_sys::bindings::output_note::get_assets (;12;) (type 8) (param i32 f32) + (local i32) + global.get $__stack_pointer + i32.const 16 + i32.sub + local.tee 2 + global.set $__stack_pointer + local.get 2 + i32.const 4 + i32.add + global.get $GOT.data.internal.__memory_base + i32.const 1048660 + i32.add + call $alloc::vec::Vec::with_capacity + local.get 0 + i32.const 8 + i32.add + local.get 2 + i32.load offset=8 + i32.const 2 + i32.shr_u + local.get 1 + call $miden::output_note::get_assets + i32.store + local.get 0 + local.get 2 + i64.load offset=4 align=4 + i64.store align=4 + local.get 2 + i32.const 16 + i32.add + global.set $__stack_pointer + ) + (func $intrinsics::felt::from_u32 (;13;) (type 9) (param i32) (result f32) + unreachable + ) + (func $alloc::raw_vec::RawVecInner::deallocate (;14;) (type 2) (param i32 i32 i32) + (local i32) + global.get $__stack_pointer + i32.const 16 + i32.sub + local.tee 3 + global.set $__stack_pointer + local.get 3 + i32.const 4 + i32.add + local.get 0 + local.get 1 + local.get 2 + call $alloc::raw_vec::RawVecInner::current_memory + block ;; label = @1 + local.get 3 + i32.load offset=8 + local.tee 2 + i32.eqz + br_if 0 (;@1;) + local.get 3 + i32.load offset=4 + local.get 2 + local.get 3 + i32.load offset=12 + call $::deallocate + end + local.get 3 + i32.const 16 + i32.add + global.set $__stack_pointer + ) + (func $alloc::raw_vec::RawVecInner::try_allocate_in (;15;) (type 10) (param i32 i32 i32 i32 i32) + (local i32 i64) + global.get $__stack_pointer + i32.const 16 + i32.sub + local.tee 5 + global.set $__stack_pointer + block ;; label = @1 + block ;; label = @2 + block ;; label = @3 + local.get 3 + local.get 4 + i32.add + i32.const -1 + i32.add + i32.const 0 + local.get 3 + i32.sub + i32.and + i64.extend_i32_u + local.get 1 + i64.extend_i32_u + i64.mul + local.tee 6 + i64.const 32 + i64.shr_u + i32.wrap_i64 + br_if 0 (;@3;) + local.get 6 + i32.wrap_i64 + local.tee 4 + i32.const -2147483648 + local.get 3 + i32.sub + i32.le_u + br_if 1 (;@2;) + end + local.get 0 + i32.const 0 + i32.store offset=4 + i32.const 1 + local.set 3 + br 1 (;@1;) + end + block ;; label = @2 + local.get 4 + br_if 0 (;@2;) + local.get 0 + local.get 3 + i32.store offset=8 + i32.const 0 + local.set 3 + local.get 0 + i32.const 0 + i32.store offset=4 + br 1 (;@1;) + end + block ;; label = @2 + block ;; label = @3 + local.get 2 + br_if 0 (;@3;) + local.get 5 + i32.const 8 + i32.add + local.get 3 + local.get 4 + call $::allocate + local.get 5 + i32.load offset=8 + local.set 2 + br 1 (;@2;) + end + local.get 5 + local.get 3 + local.get 4 + i32.const 1 + call $alloc::alloc::Global::alloc_impl + local.get 5 + i32.load + local.set 2 + end + block ;; label = @2 + local.get 2 + i32.eqz + br_if 0 (;@2;) + local.get 0 + local.get 2 + i32.store offset=8 + local.get 0 + local.get 1 + i32.store offset=4 + i32.const 0 + local.set 3 + br 1 (;@1;) + end + local.get 0 + local.get 4 + i32.store offset=8 + local.get 0 + local.get 3 + i32.store offset=4 + i32.const 1 + local.set 3 + end + local.get 0 + local.get 3 + i32.store + local.get 5 + i32.const 16 + i32.add + global.set $__stack_pointer + ) + (func $::allocate (;16;) (type 2) (param i32 i32 i32) + (local i32) + global.get $__stack_pointer + i32.const 16 + i32.sub + local.tee 3 + global.set $__stack_pointer + local.get 3 + i32.const 8 + i32.add + local.get 1 + local.get 2 + i32.const 0 + call $alloc::alloc::Global::alloc_impl + local.get 3 + i32.load offset=12 + local.set 2 + local.get 0 + local.get 3 + i32.load offset=8 + i32.store + local.get 0 + local.get 2 + i32.store offset=4 + local.get 3 + i32.const 16 + i32.add + global.set $__stack_pointer + ) + (func $alloc::alloc::Global::alloc_impl (;17;) (type 7) (param i32 i32 i32 i32) + block ;; label = @1 + local.get 2 + i32.eqz + br_if 0 (;@1;) + call $__rustc::__rust_no_alloc_shim_is_unstable_v2 + block ;; label = @2 + local.get 3 + br_if 0 (;@2;) + local.get 2 + local.get 1 + call $__rustc::__rust_alloc + local.set 1 + br 1 (;@1;) + end + local.get 2 + local.get 1 + call $__rustc::__rust_alloc_zeroed + local.set 1 + end + local.get 0 + local.get 2 + i32.store offset=4 + local.get 0 + local.get 1 + i32.store + ) + (func $alloc::raw_vec::RawVecInner::current_memory (;18;) (type 7) (param i32 i32 i32 i32) + (local i32 i32 i32) + i32.const 0 + local.set 4 + i32.const 4 + local.set 5 + block ;; label = @1 + local.get 3 + i32.eqz + br_if 0 (;@1;) + local.get 1 + i32.load + local.tee 6 + i32.eqz + br_if 0 (;@1;) + local.get 0 + local.get 2 + i32.store offset=4 + local.get 0 + local.get 1 + i32.load offset=4 + i32.store + local.get 6 + local.get 3 + i32.mul + local.set 4 + i32.const 8 + local.set 5 + end + local.get 0 + local.get 5 + i32.add + local.get 4 + i32.store + ) + (func $::deallocate (;19;) (type 2) (param i32 i32 i32) + block ;; label = @1 + local.get 2 + i32.eqz + br_if 0 (;@1;) + local.get 0 + local.get 2 + local.get 1 + call $__rustc::__rust_dealloc + end + ) + (func $alloc::raw_vec::handle_error (;20;) (type 2) (param i32 i32 i32) + unreachable + ) + (func $core::ptr::alignment::Alignment::max (;21;) (type 1) (param i32 i32) (result i32) + local.get 0 + local.get 1 + local.get 0 + local.get 1 + i32.gt_u + select + ) + (func $miden::output_note::get_assets (;22;) (type 11) (param i32 f32) (result i32) + unreachable + ) + (data $.rodata (;0;) (i32.const 1048576) "/Users/green/src/miden/compiler2/sdk/base-sys/src/bindings/output_note.rs\00") + (data $.data (;1;) (i32.const 1048652) "\01\00\00\00\01\00\00\00\00\00\10\00I\00\00\00e\00\00\00\22\00\00\00") + (@custom "rodata,miden_account" (after data) "Orust_sdk_output_note_get_assets_binding\01\0b0.0.1\03\01\01\00\00\00\00\00\00\00\00\00\00\00\00\00\00") + ) + (alias export 0 "felt" (type (;1;))) + (core instance (;0;) (instantiate 0)) + (alias core export 0 "memory" (core memory (;0;))) + (type (;2;) (func (result 1))) + (alias core export 0 "miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1#binding" (core func (;0;))) + (func (;0;) (type 2) (canon lift (core func 0))) + (alias export 0 "felt" (type (;3;))) + (component (;0;) + (type (;0;) (record (field "inner" f32))) + (import "import-type-felt" (type (;1;) (eq 0))) + (import "import-type-felt0" (type (;2;) (eq 1))) + (type (;3;) (func (result 2))) + (import "import-func-binding" (func (;0;) (type 3))) + (export (;4;) "felt" (type 1)) + (type (;5;) (func (result 4))) + (export (;1;) "binding" (func 0) (func (type 5))) + ) + (instance (;1;) (instantiate 0 + (with "import-func-binding" (func 0)) + (with "import-type-felt" (type 3)) + (with "import-type-felt0" (type 1)) + ) + ) + (export (;2;) "miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1" (instance 1)) +) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_assets_info_binding.hir b/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_assets_info_binding.hir new file mode 100644 index 000000000..b8dc84853 --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_assets_info_binding.hir @@ -0,0 +1,319 @@ +builtin.component miden:rust-sdk-output-note-get-assets-info-binding/rust-sdk-output-note-get-assets-info-binding@0.0.1 { + builtin.module public @rust_sdk_output_note_get_assets_info_binding { + private builtin.function @__wasm_call_ctors() { + ^block5: + builtin.ret ; + }; + + private builtin.function @rust_sdk_output_note_get_assets_info_binding::bindings::__link_custom_section_describing_imports() { + ^block7: + builtin.ret ; + }; + + private builtin.function @miden:rust-sdk-output-note-get-assets-info-binding/rust-sdk-output-note-get-assets-info-binding@0.0.1#binding() -> felt { + ^block9: + v3 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-info-binding/rust-sdk-output-note-get-assets-info-binding@0.0.1/rust_sdk_output_note_get_assets_info_binding/__stack_pointer : ptr + v4 = hir.bitcast v3 : ptr; + v5 = hir.load v4 : i32; + v6 = arith.constant 32 : i32; + v7 = arith.sub v5, v6 : i32 #[overflow = wrapping]; + v8 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-info-binding/rust-sdk-output-note-get-assets-info-binding@0.0.1/rust_sdk_output_note_get_assets_info_binding/__stack_pointer : ptr + v9 = hir.bitcast v8 : ptr; + hir.store v9, v7; + hir.exec @miden:rust-sdk-output-note-get-assets-info-binding/rust-sdk-output-note-get-assets-info-binding@0.0.1/rust_sdk_output_note_get_assets_info_binding/wit_bindgen::rt::run_ctors_once() + v1 = arith.constant 0 : i32; + v11 = hir.exec @miden:rust-sdk-output-note-get-assets-info-binding/rust-sdk-output-note-get-assets-info-binding@0.0.1/rust_sdk_output_note_get_assets_info_binding/intrinsics::felt::from_u32(v1) : felt + hir.exec @miden:rust-sdk-output-note-get-assets-info-binding/rust-sdk-output-note-get-assets-info-binding@0.0.1/rust_sdk_output_note_get_assets_info_binding/miden_base_sys::bindings::output_note::get_assets_info(v7, v11) + v13 = arith.constant 16 : u32; + v12 = hir.bitcast v7 : u32; + v14 = arith.add v12, v13 : u32 #[overflow = checked]; + v15 = arith.constant 4 : u32; + v16 = arith.mod v14, v15 : u32; + hir.assertz v16 #[code = 250]; + v17 = hir.int_to_ptr v14 : ptr; + v18 = hir.load v17 : felt; + v213 = arith.constant 32 : i32; + v20 = arith.add v7, v213 : i32 #[overflow = wrapping]; + v21 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-info-binding/rust-sdk-output-note-get-assets-info-binding@0.0.1/rust_sdk_output_note_get_assets_info_binding/__stack_pointer : ptr + v22 = hir.bitcast v21 : ptr; + hir.store v22, v20; + builtin.ret v18; + }; + + private builtin.function @wit_bindgen::rt::run_ctors_once() { + ^block11: + v24 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-info-binding/rust-sdk-output-note-get-assets-info-binding@0.0.1/rust_sdk_output_note_get_assets_info_binding/GOT.data.internal.__memory_base : ptr + v25 = hir.bitcast v24 : ptr; + v26 = hir.load v25 : i32; + v27 = arith.constant 1048584 : i32; + v28 = arith.add v26, v27 : i32 #[overflow = wrapping]; + v29 = hir.bitcast v28 : u32; + v30 = hir.int_to_ptr v29 : ptr; + v31 = hir.load v30 : u8; + v23 = arith.constant 0 : i32; + v32 = arith.zext v31 : u32; + v33 = hir.bitcast v32 : i32; + v35 = arith.neq v33, v23 : i1; + scf.if v35{ + ^block13: + scf.yield ; + } else { + ^block14: + v36 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-info-binding/rust-sdk-output-note-get-assets-info-binding@0.0.1/rust_sdk_output_note_get_assets_info_binding/GOT.data.internal.__memory_base : ptr + v37 = hir.bitcast v36 : ptr; + v38 = hir.load v37 : i32; + hir.exec @miden:rust-sdk-output-note-get-assets-info-binding/rust-sdk-output-note-get-assets-info-binding@0.0.1/rust_sdk_output_note_get_assets_info_binding/__wasm_call_ctors() + v215 = arith.constant 1 : u8; + v217 = arith.constant 1048584 : i32; + v40 = arith.add v38, v217 : i32 #[overflow = wrapping]; + v44 = hir.bitcast v40 : u32; + v45 = hir.int_to_ptr v44 : ptr; + hir.store v45, v215; + scf.yield ; + }; + builtin.ret ; + }; + + private builtin.function @miden_base_sys::bindings::output_note::get_assets_info(v46: i32, v47: felt) { + ^block15(v46: i32, v47: felt): + v49 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-info-binding/rust-sdk-output-note-get-assets-info-binding@0.0.1/rust_sdk_output_note_get_assets_info_binding/__stack_pointer : ptr + v50 = hir.bitcast v49 : ptr; + v51 = hir.load v50 : i32; + v52 = arith.constant 48 : i32; + v53 = arith.sub v51, v52 : i32 #[overflow = wrapping]; + v54 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-info-binding/rust-sdk-output-note-get-assets-info-binding@0.0.1/rust_sdk_output_note_get_assets_info_binding/__stack_pointer : ptr + v55 = hir.bitcast v54 : ptr; + hir.store v55, v53; + hir.exec @miden:rust-sdk-output-note-get-assets-info-binding/rust-sdk-output-note-get-assets-info-binding@0.0.1/rust_sdk_output_note_get_assets_info_binding/miden::output_note::get_assets_info(v47, v53) + v57 = arith.constant 8 : u32; + v56 = hir.bitcast v53 : u32; + v58 = arith.add v56, v57 : u32 #[overflow = checked]; + v224 = arith.constant 8 : u32; + v60 = arith.mod v58, v224 : u32; + hir.assertz v60 #[code = 250]; + v61 = hir.int_to_ptr v58 : ptr; + v62 = hir.load v61 : i64; + v64 = arith.constant 40 : u32; + v63 = hir.bitcast v53 : u32; + v65 = arith.add v63, v64 : u32 #[overflow = checked]; + v223 = arith.constant 8 : u32; + v67 = arith.mod v65, v223 : u32; + hir.assertz v67 #[code = 250]; + v68 = hir.int_to_ptr v65 : ptr; + hir.store v68, v62; + v69 = hir.bitcast v53 : u32; + v222 = arith.constant 8 : u32; + v71 = arith.mod v69, v222 : u32; + hir.assertz v71 #[code = 250]; + v72 = hir.int_to_ptr v69 : ptr; + v73 = hir.load v72 : i64; + v75 = arith.constant 32 : u32; + v74 = hir.bitcast v53 : u32; + v76 = arith.add v74, v75 : u32 #[overflow = checked]; + v221 = arith.constant 8 : u32; + v78 = arith.mod v76, v221 : u32; + hir.assertz v78 #[code = 250]; + v79 = hir.int_to_ptr v76 : ptr; + hir.store v79, v73; + v81 = arith.constant 16 : u32; + v80 = hir.bitcast v53 : u32; + v82 = arith.add v80, v81 : u32 #[overflow = checked]; + v83 = arith.constant 4 : u32; + v84 = arith.mod v82, v83 : u32; + hir.assertz v84 #[code = 250]; + v85 = hir.int_to_ptr v82 : ptr; + v86 = hir.load v85 : felt; + v87 = arith.constant 32 : i32; + v88 = arith.add v53, v87 : i32 #[overflow = wrapping]; + hir.exec @miden:rust-sdk-output-note-get-assets-info-binding/rust-sdk-output-note-get-assets-info-binding@0.0.1/rust_sdk_output_note_get_assets_info_binding/miden_stdlib_sys::intrinsics::word::Word::reverse(v46, v88) + v220 = arith.constant 16 : u32; + v89 = hir.bitcast v46 : u32; + v91 = arith.add v89, v220 : u32 #[overflow = checked]; + v219 = arith.constant 4 : u32; + v93 = arith.mod v91, v219 : u32; + hir.assertz v93 #[code = 250]; + v94 = hir.int_to_ptr v91 : ptr; + hir.store v94, v86; + v218 = arith.constant 48 : i32; + v96 = arith.add v53, v218 : i32 #[overflow = wrapping]; + v97 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-info-binding/rust-sdk-output-note-get-assets-info-binding@0.0.1/rust_sdk_output_note_get_assets_info_binding/__stack_pointer : ptr + v98 = hir.bitcast v97 : ptr; + hir.store v98, v96; + builtin.ret ; + }; + + private builtin.function @miden_stdlib_sys::intrinsics::word::Word::reverse(v99: i32, v100: i32) { + ^block17(v99: i32, v100: i32): + v103 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-info-binding/rust-sdk-output-note-get-assets-info-binding@0.0.1/rust_sdk_output_note_get_assets_info_binding/__stack_pointer : ptr + v104 = hir.bitcast v103 : ptr; + v105 = hir.load v104 : i32; + v106 = arith.constant 16 : i32; + v107 = arith.sub v105, v106 : i32 #[overflow = wrapping]; + v109 = arith.constant 8 : u32; + v108 = hir.bitcast v100 : u32; + v110 = arith.add v108, v109 : u32 #[overflow = checked]; + v311 = arith.constant 8 : u32; + v112 = arith.mod v110, v311 : u32; + hir.assertz v112 #[code = 250]; + v113 = hir.int_to_ptr v110 : ptr; + v114 = hir.load v113 : i64; + v310 = arith.constant 8 : u32; + v115 = hir.bitcast v107 : u32; + v117 = arith.add v115, v310 : u32 #[overflow = checked]; + v118 = arith.constant 4 : u32; + v119 = arith.mod v117, v118 : u32; + hir.assertz v119 #[code = 250]; + v120 = hir.int_to_ptr v117 : ptr; + hir.store v120, v114; + v121 = hir.bitcast v100 : u32; + v309 = arith.constant 8 : u32; + v123 = arith.mod v121, v309 : u32; + hir.assertz v123 #[code = 250]; + v124 = hir.int_to_ptr v121 : ptr; + v125 = hir.load v124 : i64; + v126 = hir.bitcast v107 : u32; + v308 = arith.constant 4 : u32; + v128 = arith.mod v126, v308 : u32; + hir.assertz v128 #[code = 250]; + v129 = hir.int_to_ptr v126 : ptr; + hir.store v129, v125; + v130 = arith.constant 12 : i32; + v131 = arith.add v107, v130 : i32 #[overflow = wrapping]; + v101 = arith.constant 0 : i32; + v279, v280, v281, v282, v283, v284 = scf.while v101, v107, v131, v99 : i32, i32, i32, i32, i32, i32 { + ^block39(v285: i32, v286: i32, v287: i32, v288: i32): + v307 = arith.constant 0 : i32; + v134 = arith.constant 8 : i32; + v135 = arith.eq v285, v134 : i1; + v136 = arith.zext v135 : u32; + v137 = hir.bitcast v136 : i32; + v139 = arith.neq v137, v307 : i1; + v273, v274 = scf.if v139 : i32, i32 { + ^block38: + v233 = ub.poison i32 : i32; + scf.yield v233, v233; + } else { + ^block22: + v141 = arith.add v286, v285 : i32 #[overflow = wrapping]; + v142 = hir.bitcast v141 : u32; + v306 = arith.constant 4 : u32; + v144 = arith.mod v142, v306 : u32; + hir.assertz v144 #[code = 250]; + v145 = hir.int_to_ptr v142 : ptr; + v146 = hir.load v145 : felt; + v148 = hir.bitcast v287 : u32; + v305 = arith.constant 4 : u32; + v150 = arith.mod v148, v305 : u32; + hir.assertz v150 #[code = 250]; + v151 = hir.int_to_ptr v148 : ptr; + v152 = hir.load v151 : i32; + v153 = hir.bitcast v141 : u32; + v304 = arith.constant 4 : u32; + v155 = arith.mod v153, v304 : u32; + hir.assertz v155 #[code = 250]; + v156 = hir.int_to_ptr v153 : ptr; + hir.store v156, v152; + v157 = hir.bitcast v287 : u32; + v303 = arith.constant 4 : u32; + v159 = arith.mod v157, v303 : u32; + hir.assertz v159 #[code = 250]; + v160 = hir.int_to_ptr v157 : ptr; + hir.store v160, v146; + v163 = arith.constant -4 : i32; + v164 = arith.add v287, v163 : i32 #[overflow = wrapping]; + v161 = arith.constant 4 : i32; + v162 = arith.add v285, v161 : i32 #[overflow = wrapping]; + scf.yield v162, v164; + }; + v301 = ub.poison i32 : i32; + v276 = cf.select v139, v301, v288 : i32; + v302 = ub.poison i32 : i32; + v275 = cf.select v139, v302, v286 : i32; + v232 = arith.constant 1 : u32; + v225 = arith.constant 0 : u32; + v278 = cf.select v139, v225, v232 : u32; + v266 = arith.trunc v278 : i1; + scf.condition v266, v273, v275, v274, v276, v286, v288; + } do { + ^block40(v289: i32, v290: i32, v291: i32, v292: i32, v293: i32, v294: i32): + scf.yield v289, v290, v291, v292; + }; + v300 = arith.constant 8 : u32; + v166 = hir.bitcast v283 : u32; + v168 = arith.add v166, v300 : u32 #[overflow = checked]; + v299 = arith.constant 4 : u32; + v170 = arith.mod v168, v299 : u32; + hir.assertz v170 #[code = 250]; + v171 = hir.int_to_ptr v168 : ptr; + v172 = hir.load v171 : i64; + v298 = arith.constant 8 : u32; + v173 = hir.bitcast v284 : u32; + v175 = arith.add v173, v298 : u32 #[overflow = checked]; + v297 = arith.constant 8 : u32; + v177 = arith.mod v175, v297 : u32; + hir.assertz v177 #[code = 250]; + v178 = hir.int_to_ptr v175 : ptr; + hir.store v178, v172; + v179 = hir.bitcast v283 : u32; + v296 = arith.constant 4 : u32; + v181 = arith.mod v179, v296 : u32; + hir.assertz v181 #[code = 250]; + v182 = hir.int_to_ptr v179 : ptr; + v183 = hir.load v182 : i64; + v184 = hir.bitcast v284 : u32; + v295 = arith.constant 8 : u32; + v186 = arith.mod v184, v295 : u32; + hir.assertz v186 #[code = 250]; + v187 = hir.int_to_ptr v184 : ptr; + hir.store v187, v183; + builtin.ret ; + }; + + private builtin.function @intrinsics::felt::from_u32(v188: i32) -> felt { + ^block23(v188: i32): + v189 = hir.bitcast v188 : felt; + builtin.ret v189; + }; + + private builtin.function @miden::output_note::get_assets_info(v191: felt, v192: i32) { + ^block25(v191: felt, v192: i32): + v193, v194, v195, v196, v197 = hir.exec @miden/output_note/get_assets_info(v191) : felt, felt, felt, felt, felt + v198 = hir.bitcast v192 : u32; + v199 = hir.int_to_ptr v198 : ptr; + hir.store v199, v193; + v200 = arith.constant 4 : u32; + v201 = arith.add v198, v200 : u32 #[overflow = checked]; + v202 = hir.int_to_ptr v201 : ptr; + hir.store v202, v194; + v203 = arith.constant 8 : u32; + v204 = arith.add v198, v203 : u32 #[overflow = checked]; + v205 = hir.int_to_ptr v204 : ptr; + hir.store v205, v195; + v206 = arith.constant 12 : u32; + v207 = arith.add v198, v206 : u32 #[overflow = checked]; + v208 = hir.int_to_ptr v207 : ptr; + hir.store v208, v196; + v209 = arith.constant 16 : u32; + v210 = arith.add v198, v209 : u32 #[overflow = checked]; + v211 = hir.int_to_ptr v210 : ptr; + hir.store v211, v197; + builtin.ret ; + }; + + builtin.global_variable private @#__stack_pointer : i32 { + builtin.ret_imm 1048576; + }; + + builtin.global_variable private @#GOT.data.internal.__memory_base : i32 { + builtin.ret_imm 0; + }; + + builtin.segment @1048576 = 0x0000000100000001; + }; + + public builtin.function @binding() -> felt { + ^block29: + v212 = hir.exec @miden:rust-sdk-output-note-get-assets-info-binding/rust-sdk-output-note-get-assets-info-binding@0.0.1/rust_sdk_output_note_get_assets_info_binding/miden:rust-sdk-output-note-get-assets-info-binding/rust-sdk-output-note-get-assets-info-binding@0.0.1#binding() : felt + builtin.ret v212; + }; +}; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_assets_info_binding.masm b/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_assets_info_binding.masm new file mode 100644 index 000000000..00f9ed785 --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_assets_info_binding.masm @@ -0,0 +1,688 @@ +# mod miden:rust-sdk-output-note-get-assets-info-binding/rust-sdk-output-note-get-assets-info-binding@0.0.1 + +@callconv("canon-lift") +pub proc binding( + +) -> felt + exec.::miden:rust-sdk-output-note-get-assets-info-binding/rust-sdk-output-note-get-assets-info-binding@0.0.1::init + trace.240 + nop + exec.::miden:rust-sdk-output-note-get-assets-info-binding/rust-sdk-output-note-get-assets-info-binding@0.0.1::rust_sdk_output_note_get_assets_info_binding::miden:rust-sdk-output-note-get-assets-info-binding/rust-sdk-output-note-get-assets-info-binding@0.0.1#binding + trace.252 + nop + exec.::std::sys::truncate_stack +end + +proc init + push.1179648 + trace.240 + exec.::intrinsics::mem::heap_init + trace.252 + push.[7028007876379170725,18060021366771303825,13412364500725888848,14178532912296021363] + adv.push_mapval + push.262144 + push.1 + trace.240 + exec.::std::mem::pipe_preimage_to_memory + trace.252 + drop + push.1048576 + u32assert + mem_store.278536 + push.0 + u32assert + mem_store.278537 +end + +# mod miden:rust-sdk-output-note-get-assets-info-binding/rust-sdk-output-note-get-assets-info-binding@0.0.1::rust_sdk_output_note_get_assets_info_binding + +@callconv("C") +proc __wasm_call_ctors( + +) + nop +end + +@callconv("C") +proc rust_sdk_output_note_get_assets_info_binding::bindings::__link_custom_section_describing_imports( + +) + nop +end + +@callconv("C") +proc miden:rust-sdk-output-note-get-assets-info-binding/rust-sdk-output-note-get-assets-info-binding@0.0.1#binding( + +) -> felt + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.32 + u32wrapping_sub + push.1114144 + dup.1 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + trace.240 + nop + exec.::miden:rust-sdk-output-note-get-assets-info-binding/rust-sdk-output-note-get-assets-info-binding@0.0.1::rust_sdk_output_note_get_assets_info_binding::wit_bindgen::rt::run_ctors_once + trace.252 + nop + push.0 + trace.240 + nop + exec.::miden:rust-sdk-output-note-get-assets-info-binding/rust-sdk-output-note-get-assets-info-binding@0.0.1::rust_sdk_output_note_get_assets_info_binding::intrinsics::felt::from_u32 + trace.252 + nop + dup.1 + trace.240 + nop + exec.::miden:rust-sdk-output-note-get-assets-info-binding/rust-sdk-output-note-get-assets-info-binding@0.0.1::rust_sdk_output_note_get_assets_info_binding::miden_base_sys::bindings::output_note::get_assets_info + trace.252 + nop + push.16 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.32 + movup.2 + u32wrapping_add + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop +end + +@callconv("C") +proc wit_bindgen::rt::run_ctors_once( + +) + push.1114148 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.1048584 + u32wrapping_add + u32divmod.4 + swap.1 + swap.1 + dup.1 + mem_load + swap.1 + push.8 + u32wrapping_mul + u32shr + swap.1 + drop + push.255 + u32and + push.0 + swap.1 + neq + if.true + nop + else + push.1114148 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + trace.240 + nop + exec.::miden:rust-sdk-output-note-get-assets-info-binding/rust-sdk-output-note-get-assets-info-binding@0.0.1::rust_sdk_output_note_get_assets_info_binding::__wasm_call_ctors + trace.252 + nop + push.1 + push.1048584 + movup.2 + u32wrapping_add + u32divmod.4 + swap.1 + dup.0 + mem_load + dup.2 + push.8 + u32wrapping_mul + push.255 + swap.1 + u32shl + u32not + swap.1 + u32and + movup.3 + movup.3 + push.8 + u32wrapping_mul + u32shl + u32or + swap.1 + mem_store + end +end + +@callconv("C") +proc miden_base_sys::bindings::output_note::get_assets_info( + i32, + felt +) + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.48 + u32wrapping_sub + push.1114144 + dup.1 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + dup.0 + movup.3 + trace.240 + nop + exec.::miden:rust-sdk-output-note-get-assets-info-binding/rust-sdk-output-note-get-assets-info-binding@0.0.1::rust_sdk_output_note_get_assets_info_binding::miden::output_note::get_assets_info + trace.252 + nop + push.8 + dup.1 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.40 + dup.3 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + dup.0 + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.32 + dup.3 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.16 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.32 + dup.2 + u32wrapping_add + dup.3 + trace.240 + nop + exec.::miden:rust-sdk-output-note-get-assets-info-binding/rust-sdk-output-note-get-assets-info-binding@0.0.1::rust_sdk_output_note_get_assets_info_binding::miden_stdlib_sys::intrinsics::word::Word::reverse + trace.252 + nop + push.16 + movup.3 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.48 + u32wrapping_add + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop +end + +@callconv("C") +proc miden_stdlib_sys::intrinsics::word::Word::reverse( + i32, + i32 +) + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.16 + u32wrapping_sub + push.8 + dup.3 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.8 + dup.3 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + movup.2 + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + dup.2 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.12 + dup.1 + u32wrapping_add + push.0 + movup.2 + swap.1 + push.1 + while.true + push.0 + push.8 + dup.2 + eq + neq + dup.0 + if.true + movup.3 + movup.2 + drop + drop + push.3735929054 + dup.0 + else + dup.2 + dup.2 + u32wrapping_add + dup.0 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + dup.5 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + movup.2 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + dup.4 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.4294967292 + movup.4 + u32wrapping_add + push.4 + movup.3 + u32wrapping_add + end + push.3735929054 + dup.3 + dup.6 + swap.2 + swap.1 + cdrop + push.3735929054 + dup.4 + dup.6 + swap.2 + swap.1 + cdrop + push.1 + push.0 + movup.6 + cdrop + push.1 + u32and + swap.1 + swap.2 + swap.4 + swap.3 + swap.1 + if.true + movup.4 + drop + movup.4 + drop + push.1 + else + push.0 + end + end + drop + drop + drop + drop + push.8 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.8 + dup.4 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + movup.2 + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop +end + +@callconv("C") +proc intrinsics::felt::from_u32(i32) -> felt + nop +end + +@callconv("C") +proc miden::output_note::get_assets_info(felt, i32) + trace.240 + nop + exec.::miden::output_note::get_assets_info + trace.252 + nop + movup.5 + dup.0 + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.4 + dup.1 + add + u32assert + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.8 + dup.1 + add + u32assert + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.12 + dup.1 + add + u32assert + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.16 + add + u32assert + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop +end + diff --git a/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_assets_info_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_assets_info_binding.wat new file mode 100644 index 000000000..30967d2ec --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_assets_info_binding.wat @@ -0,0 +1,189 @@ +(component + (type (;0;) + (instance + (type (;0;) (record (field "inner" f32))) + (export (;1;) "felt" (type (eq 0))) + ) + ) + (import "miden:base/core-types@1.0.0" (instance (;0;) (type 0))) + (core module (;0;) + (type (;0;) (func)) + (type (;1;) (func (result f32))) + (type (;2;) (func (param i32 f32))) + (type (;3;) (func (param i32 i32))) + (type (;4;) (func (param i32) (result f32))) + (type (;5;) (func (param f32 i32))) + (table (;0;) 2 2 funcref) + (memory (;0;) 17) + (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) + (global $GOT.data.internal.__memory_base (;1;) i32 i32.const 0) + (export "memory" (memory 0)) + (export "miden:rust-sdk-output-note-get-assets-info-binding/rust-sdk-output-note-get-assets-info-binding@0.0.1#binding" (func $miden:rust-sdk-output-note-get-assets-info-binding/rust-sdk-output-note-get-assets-info-binding@0.0.1#binding)) + (elem (;0;) (i32.const 1) func $rust_sdk_output_note_get_assets_info_binding::bindings::__link_custom_section_describing_imports) + (func $__wasm_call_ctors (;0;) (type 0)) + (func $rust_sdk_output_note_get_assets_info_binding::bindings::__link_custom_section_describing_imports (;1;) (type 0)) + (func $miden:rust-sdk-output-note-get-assets-info-binding/rust-sdk-output-note-get-assets-info-binding@0.0.1#binding (;2;) (type 1) (result f32) + (local i32 f32) + global.get $__stack_pointer + i32.const 32 + i32.sub + local.tee 0 + global.set $__stack_pointer + call $wit_bindgen::rt::run_ctors_once + local.get 0 + i32.const 0 + call $intrinsics::felt::from_u32 + call $miden_base_sys::bindings::output_note::get_assets_info + local.get 0 + f32.load offset=16 + local.set 1 + local.get 0 + i32.const 32 + i32.add + global.set $__stack_pointer + local.get 1 + ) + (func $wit_bindgen::rt::run_ctors_once (;3;) (type 0) + (local i32) + block ;; label = @1 + global.get $GOT.data.internal.__memory_base + i32.const 1048584 + i32.add + i32.load8_u + br_if 0 (;@1;) + global.get $GOT.data.internal.__memory_base + local.set 0 + call $__wasm_call_ctors + local.get 0 + i32.const 1048584 + i32.add + i32.const 1 + i32.store8 + end + ) + (func $miden_base_sys::bindings::output_note::get_assets_info (;4;) (type 2) (param i32 f32) + (local i32) + global.get $__stack_pointer + i32.const 48 + i32.sub + local.tee 2 + global.set $__stack_pointer + local.get 1 + local.get 2 + call $miden::output_note::get_assets_info + local.get 2 + local.get 2 + i64.load offset=8 + i64.store offset=40 + local.get 2 + local.get 2 + i64.load + i64.store offset=32 + local.get 2 + f32.load offset=16 + local.set 1 + local.get 0 + local.get 2 + i32.const 32 + i32.add + call $miden_stdlib_sys::intrinsics::word::Word::reverse + local.get 0 + local.get 1 + f32.store offset=16 + local.get 2 + i32.const 48 + i32.add + global.set $__stack_pointer + ) + (func $miden_stdlib_sys::intrinsics::word::Word::reverse (;5;) (type 3) (param i32 i32) + (local i32 i32 i32 f32) + global.get $__stack_pointer + i32.const 16 + i32.sub + local.tee 2 + local.get 1 + i64.load offset=8 + i64.store offset=8 align=4 + local.get 2 + local.get 1 + i64.load + i64.store align=4 + local.get 2 + i32.const 12 + i32.add + local.set 3 + i32.const 0 + local.set 1 + block ;; label = @1 + loop ;; label = @2 + local.get 1 + i32.const 8 + i32.eq + br_if 1 (;@1;) + local.get 2 + local.get 1 + i32.add + local.tee 4 + f32.load + local.set 5 + local.get 4 + local.get 3 + i32.load + i32.store + local.get 3 + local.get 5 + f32.store + local.get 1 + i32.const 4 + i32.add + local.set 1 + local.get 3 + i32.const -4 + i32.add + local.set 3 + br 0 (;@2;) + end + end + local.get 0 + local.get 2 + i64.load offset=8 align=4 + i64.store offset=8 + local.get 0 + local.get 2 + i64.load align=4 + i64.store + ) + (func $intrinsics::felt::from_u32 (;6;) (type 4) (param i32) (result f32) + unreachable + ) + (func $miden::output_note::get_assets_info (;7;) (type 5) (param f32 i32) + unreachable + ) + (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") + (@custom "rodata,miden_account" (after data) "Yrust_sdk_output_note_get_assets_info_binding\01\0b0.0.1\03\01\01\00\00\00\00\00\00\00\00\00") + ) + (alias export 0 "felt" (type (;1;))) + (core instance (;0;) (instantiate 0)) + (alias core export 0 "memory" (core memory (;0;))) + (type (;2;) (func (result 1))) + (alias core export 0 "miden:rust-sdk-output-note-get-assets-info-binding/rust-sdk-output-note-get-assets-info-binding@0.0.1#binding" (core func (;0;))) + (func (;0;) (type 2) (canon lift (core func 0))) + (alias export 0 "felt" (type (;3;))) + (component (;0;) + (type (;0;) (record (field "inner" f32))) + (import "import-type-felt" (type (;1;) (eq 0))) + (import "import-type-felt0" (type (;2;) (eq 1))) + (type (;3;) (func (result 2))) + (import "import-func-binding" (func (;0;) (type 3))) + (export (;4;) "felt" (type 1)) + (type (;5;) (func (result 4))) + (export (;1;) "binding" (func 0) (func (type 5))) + ) + (instance (;1;) (instantiate 0 + (with "import-func-binding" (func 0)) + (with "import-type-felt" (type 3)) + (with "import-type-felt0" (type 1)) + ) + ) + (export (;2;) "miden:rust-sdk-output-note-get-assets-info-binding/rust-sdk-output-note-get-assets-info-binding@0.0.1" (instance 1)) +) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_metadata_binding.hir b/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_metadata_binding.hir new file mode 100644 index 000000000..07cd5b8ac --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_metadata_binding.hir @@ -0,0 +1,350 @@ +builtin.component miden:rust-sdk-output-note-get-metadata-binding/rust-sdk-output-note-get-metadata-binding@0.0.1 { + builtin.module public @rust_sdk_output_note_get_metadata_binding { + private builtin.function @__wasm_call_ctors() { + ^block5: + builtin.ret ; + }; + + private builtin.function @rust_sdk_output_note_get_metadata_binding::bindings::__link_custom_section_describing_imports() { + ^block7: + builtin.ret ; + }; + + private builtin.function @miden:rust-sdk-output-note-get-metadata-binding/rust-sdk-output-note-get-metadata-binding@0.0.1#binding() -> i32 { + ^block9: + v2 = builtin.global_symbol @miden:rust-sdk-output-note-get-metadata-binding/rust-sdk-output-note-get-metadata-binding@0.0.1/rust_sdk_output_note_get_metadata_binding/__stack_pointer : ptr + v3 = hir.bitcast v2 : ptr; + v4 = hir.load v3 : i32; + v5 = arith.constant 16 : i32; + v6 = arith.sub v4, v5 : i32 #[overflow = wrapping]; + v7 = builtin.global_symbol @miden:rust-sdk-output-note-get-metadata-binding/rust-sdk-output-note-get-metadata-binding@0.0.1/rust_sdk_output_note_get_metadata_binding/__stack_pointer : ptr + v8 = hir.bitcast v7 : ptr; + hir.store v8, v6; + hir.exec @miden:rust-sdk-output-note-get-metadata-binding/rust-sdk-output-note-get-metadata-binding@0.0.1/rust_sdk_output_note_get_metadata_binding/wit_bindgen::rt::run_ctors_once() + v1 = arith.constant 0 : i32; + v10 = hir.exec @miden:rust-sdk-output-note-get-metadata-binding/rust-sdk-output-note-get-metadata-binding@0.0.1/rust_sdk_output_note_get_metadata_binding/intrinsics::felt::from_u32(v1) : felt + hir.exec @miden:rust-sdk-output-note-get-metadata-binding/rust-sdk-output-note-get-metadata-binding@0.0.1/rust_sdk_output_note_get_metadata_binding/miden_base_sys::bindings::output_note::get_metadata(v6, v10) + v11 = builtin.global_symbol @miden:rust-sdk-output-note-get-metadata-binding/rust-sdk-output-note-get-metadata-binding@0.0.1/rust_sdk_output_note_get_metadata_binding/GOT.data.internal.__memory_base : ptr + v12 = hir.bitcast v11 : ptr; + v13 = hir.load v12 : i32; + v14 = arith.constant 1048584 : i32; + v15 = arith.add v13, v14 : i32 #[overflow = wrapping]; + v17 = arith.constant 8 : u32; + v16 = hir.bitcast v6 : u32; + v18 = arith.add v16, v17 : u32 #[overflow = checked]; + v249 = arith.constant 8 : u32; + v20 = arith.mod v18, v249 : u32; + hir.assertz v20 #[code = 250]; + v21 = hir.int_to_ptr v18 : ptr; + v22 = hir.load v21 : i64; + v248 = arith.constant 8 : u32; + v23 = hir.bitcast v15 : u32; + v25 = arith.add v23, v248 : u32 #[overflow = checked]; + v26 = arith.constant 4 : u32; + v27 = arith.mod v25, v26 : u32; + hir.assertz v27 #[code = 250]; + v28 = hir.int_to_ptr v25 : ptr; + hir.store v28, v22; + v29 = hir.bitcast v6 : u32; + v247 = arith.constant 8 : u32; + v31 = arith.mod v29, v247 : u32; + hir.assertz v31 #[code = 250]; + v32 = hir.int_to_ptr v29 : ptr; + v33 = hir.load v32 : i64; + v34 = hir.bitcast v15 : u32; + v246 = arith.constant 4 : u32; + v36 = arith.mod v34, v246 : u32; + hir.assertz v36 #[code = 250]; + v37 = hir.int_to_ptr v34 : ptr; + hir.store v37, v33; + v245 = arith.constant 16 : i32; + v39 = arith.add v6, v245 : i32 #[overflow = wrapping]; + v40 = builtin.global_symbol @miden:rust-sdk-output-note-get-metadata-binding/rust-sdk-output-note-get-metadata-binding@0.0.1/rust_sdk_output_note_get_metadata_binding/__stack_pointer : ptr + v41 = hir.bitcast v40 : ptr; + hir.store v41, v39; + builtin.ret v15; + }; + + private builtin.function @wit_bindgen::rt::run_ctors_once() { + ^block11: + v43 = builtin.global_symbol @miden:rust-sdk-output-note-get-metadata-binding/rust-sdk-output-note-get-metadata-binding@0.0.1/rust_sdk_output_note_get_metadata_binding/GOT.data.internal.__memory_base : ptr + v44 = hir.bitcast v43 : ptr; + v45 = hir.load v44 : i32; + v46 = arith.constant 1048600 : i32; + v47 = arith.add v45, v46 : i32 #[overflow = wrapping]; + v48 = hir.bitcast v47 : u32; + v49 = hir.int_to_ptr v48 : ptr; + v50 = hir.load v49 : u8; + v42 = arith.constant 0 : i32; + v51 = arith.zext v50 : u32; + v52 = hir.bitcast v51 : i32; + v54 = arith.neq v52, v42 : i1; + scf.if v54{ + ^block13: + scf.yield ; + } else { + ^block14: + v55 = builtin.global_symbol @miden:rust-sdk-output-note-get-metadata-binding/rust-sdk-output-note-get-metadata-binding@0.0.1/rust_sdk_output_note_get_metadata_binding/GOT.data.internal.__memory_base : ptr + v56 = hir.bitcast v55 : ptr; + v57 = hir.load v56 : i32; + hir.exec @miden:rust-sdk-output-note-get-metadata-binding/rust-sdk-output-note-get-metadata-binding@0.0.1/rust_sdk_output_note_get_metadata_binding/__wasm_call_ctors() + v251 = arith.constant 1 : u8; + v253 = arith.constant 1048600 : i32; + v59 = arith.add v57, v253 : i32 #[overflow = wrapping]; + v63 = hir.bitcast v59 : u32; + v64 = hir.int_to_ptr v63 : ptr; + hir.store v64, v251; + scf.yield ; + }; + builtin.ret ; + }; + + private builtin.function @miden_base_sys::bindings::output_note::get_metadata(v65: i32, v66: felt) { + ^block15(v65: i32, v66: felt): + v68 = builtin.global_symbol @miden:rust-sdk-output-note-get-metadata-binding/rust-sdk-output-note-get-metadata-binding@0.0.1/rust_sdk_output_note_get_metadata_binding/__stack_pointer : ptr + v69 = hir.bitcast v68 : ptr; + v70 = hir.load v69 : i32; + v71 = arith.constant 32 : i32; + v72 = arith.sub v70, v71 : i32 #[overflow = wrapping]; + v73 = builtin.global_symbol @miden:rust-sdk-output-note-get-metadata-binding/rust-sdk-output-note-get-metadata-binding@0.0.1/rust_sdk_output_note_get_metadata_binding/__stack_pointer : ptr + v74 = hir.bitcast v73 : ptr; + hir.store v74, v72; + hir.exec @miden:rust-sdk-output-note-get-metadata-binding/rust-sdk-output-note-get-metadata-binding@0.0.1/rust_sdk_output_note_get_metadata_binding/miden::output_note::get_metadata(v66, v72) + v76 = arith.constant 8 : u32; + v75 = hir.bitcast v72 : u32; + v77 = arith.add v75, v76 : u32 #[overflow = checked]; + v258 = arith.constant 8 : u32; + v79 = arith.mod v77, v258 : u32; + hir.assertz v79 #[code = 250]; + v80 = hir.int_to_ptr v77 : ptr; + v81 = hir.load v80 : i64; + v83 = arith.constant 24 : u32; + v82 = hir.bitcast v72 : u32; + v84 = arith.add v82, v83 : u32 #[overflow = checked]; + v257 = arith.constant 8 : u32; + v86 = arith.mod v84, v257 : u32; + hir.assertz v86 #[code = 250]; + v87 = hir.int_to_ptr v84 : ptr; + hir.store v87, v81; + v88 = hir.bitcast v72 : u32; + v256 = arith.constant 8 : u32; + v90 = arith.mod v88, v256 : u32; + hir.assertz v90 #[code = 250]; + v91 = hir.int_to_ptr v88 : ptr; + v92 = hir.load v91 : i64; + v94 = arith.constant 16 : u32; + v93 = hir.bitcast v72 : u32; + v95 = arith.add v93, v94 : u32 #[overflow = checked]; + v255 = arith.constant 8 : u32; + v97 = arith.mod v95, v255 : u32; + hir.assertz v97 #[code = 250]; + v98 = hir.int_to_ptr v95 : ptr; + hir.store v98, v92; + v99 = arith.constant 16 : i32; + v100 = arith.add v72, v99 : i32 #[overflow = wrapping]; + hir.exec @miden:rust-sdk-output-note-get-metadata-binding/rust-sdk-output-note-get-metadata-binding@0.0.1/rust_sdk_output_note_get_metadata_binding/miden_stdlib_sys::intrinsics::word::Word::reverse(v65, v100) + v254 = arith.constant 32 : i32; + v102 = arith.add v72, v254 : i32 #[overflow = wrapping]; + v103 = builtin.global_symbol @miden:rust-sdk-output-note-get-metadata-binding/rust-sdk-output-note-get-metadata-binding@0.0.1/rust_sdk_output_note_get_metadata_binding/__stack_pointer : ptr + v104 = hir.bitcast v103 : ptr; + hir.store v104, v102; + builtin.ret ; + }; + + private builtin.function @miden_stdlib_sys::intrinsics::word::Word::reverse(v105: i32, v106: i32) { + ^block17(v105: i32, v106: i32): + v109 = builtin.global_symbol @miden:rust-sdk-output-note-get-metadata-binding/rust-sdk-output-note-get-metadata-binding@0.0.1/rust_sdk_output_note_get_metadata_binding/__stack_pointer : ptr + v110 = hir.bitcast v109 : ptr; + v111 = hir.load v110 : i32; + v112 = arith.constant 16 : i32; + v113 = arith.sub v111, v112 : i32 #[overflow = wrapping]; + v115 = arith.constant 8 : u32; + v114 = hir.bitcast v106 : u32; + v116 = arith.add v114, v115 : u32 #[overflow = checked]; + v345 = arith.constant 8 : u32; + v118 = arith.mod v116, v345 : u32; + hir.assertz v118 #[code = 250]; + v119 = hir.int_to_ptr v116 : ptr; + v120 = hir.load v119 : i64; + v344 = arith.constant 8 : u32; + v121 = hir.bitcast v113 : u32; + v123 = arith.add v121, v344 : u32 #[overflow = checked]; + v124 = arith.constant 4 : u32; + v125 = arith.mod v123, v124 : u32; + hir.assertz v125 #[code = 250]; + v126 = hir.int_to_ptr v123 : ptr; + hir.store v126, v120; + v127 = hir.bitcast v106 : u32; + v343 = arith.constant 8 : u32; + v129 = arith.mod v127, v343 : u32; + hir.assertz v129 #[code = 250]; + v130 = hir.int_to_ptr v127 : ptr; + v131 = hir.load v130 : i64; + v132 = hir.bitcast v113 : u32; + v342 = arith.constant 4 : u32; + v134 = arith.mod v132, v342 : u32; + hir.assertz v134 #[code = 250]; + v135 = hir.int_to_ptr v132 : ptr; + hir.store v135, v131; + v136 = arith.constant 12 : i32; + v137 = arith.add v113, v136 : i32 #[overflow = wrapping]; + v107 = arith.constant 0 : i32; + v313, v314, v315, v316, v317, v318 = scf.while v107, v113, v137, v105 : i32, i32, i32, i32, i32, i32 { + ^block39(v319: i32, v320: i32, v321: i32, v322: i32): + v341 = arith.constant 0 : i32; + v140 = arith.constant 8 : i32; + v141 = arith.eq v319, v140 : i1; + v142 = arith.zext v141 : u32; + v143 = hir.bitcast v142 : i32; + v145 = arith.neq v143, v341 : i1; + v307, v308 = scf.if v145 : i32, i32 { + ^block38: + v267 = ub.poison i32 : i32; + scf.yield v267, v267; + } else { + ^block22: + v147 = arith.add v320, v319 : i32 #[overflow = wrapping]; + v148 = hir.bitcast v147 : u32; + v340 = arith.constant 4 : u32; + v150 = arith.mod v148, v340 : u32; + hir.assertz v150 #[code = 250]; + v151 = hir.int_to_ptr v148 : ptr; + v152 = hir.load v151 : felt; + v154 = hir.bitcast v321 : u32; + v339 = arith.constant 4 : u32; + v156 = arith.mod v154, v339 : u32; + hir.assertz v156 #[code = 250]; + v157 = hir.int_to_ptr v154 : ptr; + v158 = hir.load v157 : i32; + v159 = hir.bitcast v147 : u32; + v338 = arith.constant 4 : u32; + v161 = arith.mod v159, v338 : u32; + hir.assertz v161 #[code = 250]; + v162 = hir.int_to_ptr v159 : ptr; + hir.store v162, v158; + v163 = hir.bitcast v321 : u32; + v337 = arith.constant 4 : u32; + v165 = arith.mod v163, v337 : u32; + hir.assertz v165 #[code = 250]; + v166 = hir.int_to_ptr v163 : ptr; + hir.store v166, v152; + v169 = arith.constant -4 : i32; + v170 = arith.add v321, v169 : i32 #[overflow = wrapping]; + v167 = arith.constant 4 : i32; + v168 = arith.add v319, v167 : i32 #[overflow = wrapping]; + scf.yield v168, v170; + }; + v335 = ub.poison i32 : i32; + v310 = cf.select v145, v335, v322 : i32; + v336 = ub.poison i32 : i32; + v309 = cf.select v145, v336, v320 : i32; + v266 = arith.constant 1 : u32; + v259 = arith.constant 0 : u32; + v312 = cf.select v145, v259, v266 : u32; + v300 = arith.trunc v312 : i1; + scf.condition v300, v307, v309, v308, v310, v320, v322; + } do { + ^block40(v323: i32, v324: i32, v325: i32, v326: i32, v327: i32, v328: i32): + scf.yield v323, v324, v325, v326; + }; + v334 = arith.constant 8 : u32; + v172 = hir.bitcast v317 : u32; + v174 = arith.add v172, v334 : u32 #[overflow = checked]; + v333 = arith.constant 4 : u32; + v176 = arith.mod v174, v333 : u32; + hir.assertz v176 #[code = 250]; + v177 = hir.int_to_ptr v174 : ptr; + v178 = hir.load v177 : i64; + v332 = arith.constant 8 : u32; + v179 = hir.bitcast v318 : u32; + v181 = arith.add v179, v332 : u32 #[overflow = checked]; + v331 = arith.constant 8 : u32; + v183 = arith.mod v181, v331 : u32; + hir.assertz v183 #[code = 250]; + v184 = hir.int_to_ptr v181 : ptr; + hir.store v184, v178; + v185 = hir.bitcast v317 : u32; + v330 = arith.constant 4 : u32; + v187 = arith.mod v185, v330 : u32; + hir.assertz v187 #[code = 250]; + v188 = hir.int_to_ptr v185 : ptr; + v189 = hir.load v188 : i64; + v190 = hir.bitcast v318 : u32; + v329 = arith.constant 8 : u32; + v192 = arith.mod v190, v329 : u32; + hir.assertz v192 #[code = 250]; + v193 = hir.int_to_ptr v190 : ptr; + hir.store v193, v189; + builtin.ret ; + }; + + private builtin.function @intrinsics::felt::from_u32(v194: i32) -> felt { + ^block23(v194: i32): + v195 = hir.bitcast v194 : felt; + builtin.ret v195; + }; + + private builtin.function @miden::output_note::get_metadata(v197: felt, v198: i32) { + ^block25(v197: felt, v198: i32): + v199, v200, v201, v202 = hir.exec @miden/output_note/get_metadata(v197) : felt, felt, felt, felt + v203 = hir.bitcast v198 : u32; + v204 = hir.int_to_ptr v203 : ptr; + hir.store v204, v199; + v205 = arith.constant 4 : u32; + v206 = arith.add v203, v205 : u32 #[overflow = checked]; + v207 = hir.int_to_ptr v206 : ptr; + hir.store v207, v200; + v208 = arith.constant 8 : u32; + v209 = arith.add v203, v208 : u32 #[overflow = checked]; + v210 = hir.int_to_ptr v209 : ptr; + hir.store v210, v201; + v211 = arith.constant 12 : u32; + v212 = arith.add v203, v211 : u32 #[overflow = checked]; + v213 = hir.int_to_ptr v212 : ptr; + hir.store v213, v202; + builtin.ret ; + }; + + builtin.global_variable private @#__stack_pointer : i32 { + builtin.ret_imm 1048576; + }; + + builtin.global_variable private @#GOT.data.internal.__memory_base : i32 { + builtin.ret_imm 0; + }; + + builtin.segment @1048576 = 0x0000000100000001; + }; + + public builtin.function @binding() -> felt, felt, felt, felt { + ^block29: + v214 = hir.exec @miden:rust-sdk-output-note-get-metadata-binding/rust-sdk-output-note-get-metadata-binding@0.0.1/rust_sdk_output_note_get_metadata_binding/miden:rust-sdk-output-note-get-metadata-binding/rust-sdk-output-note-get-metadata-binding@0.0.1#binding() : i32 + v215 = arith.constant 0 : i32; + v216 = arith.add v214, v215 : i32 #[overflow = unchecked]; + v349 = arith.constant 0 : i32; + v350 = arith.constant 0 : i32; + v218 = arith.add v216, v350 : i32 #[overflow = unchecked]; + v220 = arith.add v218, v349 : i32 #[overflow = unchecked]; + v221 = hir.int_to_ptr v220 : ptr; + v222 = hir.load v221 : felt; + v348 = arith.constant 0 : i32; + v223 = arith.constant 4 : i32; + v224 = arith.add v216, v223 : i32 #[overflow = unchecked]; + v226 = arith.add v224, v348 : i32 #[overflow = unchecked]; + v227 = hir.int_to_ptr v226 : ptr; + v228 = hir.load v227 : felt; + v347 = arith.constant 0 : i32; + v229 = arith.constant 8 : i32; + v230 = arith.add v216, v229 : i32 #[overflow = unchecked]; + v232 = arith.add v230, v347 : i32 #[overflow = unchecked]; + v233 = hir.int_to_ptr v232 : ptr; + v234 = hir.load v233 : felt; + v346 = arith.constant 0 : i32; + v235 = arith.constant 12 : i32; + v236 = arith.add v216, v235 : i32 #[overflow = unchecked]; + v238 = arith.add v236, v346 : i32 #[overflow = unchecked]; + v239 = hir.int_to_ptr v238 : ptr; + v240 = hir.load v239 : felt; + builtin.ret v222, v228, v234, v240; + }; +}; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_metadata_binding.masm b/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_metadata_binding.masm new file mode 100644 index 000000000..b532918db --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_metadata_binding.masm @@ -0,0 +1,748 @@ +# mod miden:rust-sdk-output-note-get-metadata-binding/rust-sdk-output-note-get-metadata-binding@0.0.1 + +@callconv("canon-lift") +pub proc binding( + +) -> (felt, felt, felt, felt) + exec.::miden:rust-sdk-output-note-get-metadata-binding/rust-sdk-output-note-get-metadata-binding@0.0.1::init + trace.240 + nop + exec.::miden:rust-sdk-output-note-get-metadata-binding/rust-sdk-output-note-get-metadata-binding@0.0.1::rust_sdk_output_note_get_metadata_binding::miden:rust-sdk-output-note-get-metadata-binding/rust-sdk-output-note-get-metadata-binding@0.0.1#binding + trace.252 + nop + push.0 + u32wrapping_add + push.0 + push.0 + dup.2 + u32wrapping_add + u32wrapping_add + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.0 + push.4 + dup.3 + u32wrapping_add + u32wrapping_add + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.0 + push.8 + dup.4 + u32wrapping_add + u32wrapping_add + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.0 + push.12 + movup.5 + u32wrapping_add + u32wrapping_add + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + movdn.3 + swap.2 + exec.::std::sys::truncate_stack +end + +proc init + push.1179648 + trace.240 + exec.::intrinsics::mem::heap_init + trace.252 + push.[7028007876379170725,18060021366771303825,13412364500725888848,14178532912296021363] + adv.push_mapval + push.262144 + push.1 + trace.240 + exec.::std::mem::pipe_preimage_to_memory + trace.252 + drop + push.1048576 + u32assert + mem_store.278536 + push.0 + u32assert + mem_store.278537 +end + +# mod miden:rust-sdk-output-note-get-metadata-binding/rust-sdk-output-note-get-metadata-binding@0.0.1::rust_sdk_output_note_get_metadata_binding + +@callconv("C") +proc __wasm_call_ctors( + +) + nop +end + +@callconv("C") +proc rust_sdk_output_note_get_metadata_binding::bindings::__link_custom_section_describing_imports( + +) + nop +end + +@callconv("C") +proc miden:rust-sdk-output-note-get-metadata-binding/rust-sdk-output-note-get-metadata-binding@0.0.1#binding( + +) -> i32 + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.16 + u32wrapping_sub + push.1114144 + dup.1 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + trace.240 + nop + exec.::miden:rust-sdk-output-note-get-metadata-binding/rust-sdk-output-note-get-metadata-binding@0.0.1::rust_sdk_output_note_get_metadata_binding::wit_bindgen::rt::run_ctors_once + trace.252 + nop + push.0 + trace.240 + nop + exec.::miden:rust-sdk-output-note-get-metadata-binding/rust-sdk-output-note-get-metadata-binding@0.0.1::rust_sdk_output_note_get_metadata_binding::intrinsics::felt::from_u32 + trace.252 + nop + dup.1 + trace.240 + nop + exec.::miden:rust-sdk-output-note-get-metadata-binding/rust-sdk-output-note-get-metadata-binding@0.0.1::rust_sdk_output_note_get_metadata_binding::miden_base_sys::bindings::output_note::get_metadata + trace.252 + nop + push.1114148 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.1048584 + u32wrapping_add + push.8 + dup.2 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.8 + dup.3 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + dup.1 + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + dup.2 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.16 + movup.2 + u32wrapping_add + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop +end + +@callconv("C") +proc wit_bindgen::rt::run_ctors_once( + +) + push.1114148 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.1048600 + u32wrapping_add + u32divmod.4 + swap.1 + swap.1 + dup.1 + mem_load + swap.1 + push.8 + u32wrapping_mul + u32shr + swap.1 + drop + push.255 + u32and + push.0 + swap.1 + neq + if.true + nop + else + push.1114148 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + trace.240 + nop + exec.::miden:rust-sdk-output-note-get-metadata-binding/rust-sdk-output-note-get-metadata-binding@0.0.1::rust_sdk_output_note_get_metadata_binding::__wasm_call_ctors + trace.252 + nop + push.1 + push.1048600 + movup.2 + u32wrapping_add + u32divmod.4 + swap.1 + dup.0 + mem_load + dup.2 + push.8 + u32wrapping_mul + push.255 + swap.1 + u32shl + u32not + swap.1 + u32and + movup.3 + movup.3 + push.8 + u32wrapping_mul + u32shl + u32or + swap.1 + mem_store + end +end + +@callconv("C") +proc miden_base_sys::bindings::output_note::get_metadata( + i32, + felt +) + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.32 + u32wrapping_sub + push.1114144 + dup.1 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + dup.0 + movup.3 + trace.240 + nop + exec.::miden:rust-sdk-output-note-get-metadata-binding/rust-sdk-output-note-get-metadata-binding@0.0.1::rust_sdk_output_note_get_metadata_binding::miden::output_note::get_metadata + trace.252 + nop + push.8 + dup.1 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.24 + dup.3 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + dup.0 + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.16 + dup.3 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.16 + dup.1 + u32wrapping_add + movup.2 + trace.240 + nop + exec.::miden:rust-sdk-output-note-get-metadata-binding/rust-sdk-output-note-get-metadata-binding@0.0.1::rust_sdk_output_note_get_metadata_binding::miden_stdlib_sys::intrinsics::word::Word::reverse + trace.252 + nop + push.32 + u32wrapping_add + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop +end + +@callconv("C") +proc miden_stdlib_sys::intrinsics::word::Word::reverse( + i32, + i32 +) + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.16 + u32wrapping_sub + push.8 + dup.3 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.8 + dup.3 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + movup.2 + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + dup.2 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.12 + dup.1 + u32wrapping_add + push.0 + movup.2 + swap.1 + push.1 + while.true + push.0 + push.8 + dup.2 + eq + neq + dup.0 + if.true + movup.3 + movup.2 + drop + drop + push.3735929054 + dup.0 + else + dup.2 + dup.2 + u32wrapping_add + dup.0 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + dup.5 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + movup.2 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + dup.4 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.4294967292 + movup.4 + u32wrapping_add + push.4 + movup.3 + u32wrapping_add + end + push.3735929054 + dup.3 + dup.6 + swap.2 + swap.1 + cdrop + push.3735929054 + dup.4 + dup.6 + swap.2 + swap.1 + cdrop + push.1 + push.0 + movup.6 + cdrop + push.1 + u32and + swap.1 + swap.2 + swap.4 + swap.3 + swap.1 + if.true + movup.4 + drop + movup.4 + drop + push.1 + else + push.0 + end + end + drop + drop + drop + drop + push.8 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.8 + dup.4 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + movup.2 + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop +end + +@callconv("C") +proc intrinsics::felt::from_u32(i32) -> felt + nop +end + +@callconv("C") +proc miden::output_note::get_metadata(felt, i32) + trace.240 + nop + exec.::miden::output_note::get_metadata + trace.252 + nop + movup.4 + dup.0 + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.4 + dup.1 + add + u32assert + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.8 + dup.1 + add + u32assert + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.12 + add + u32assert + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop +end + diff --git a/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_metadata_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_metadata_binding.wat new file mode 100644 index 000000000..f030f66a3 --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_metadata_binding.wat @@ -0,0 +1,199 @@ +(component + (type (;0;) + (instance + (type (;0;) (record (field "inner" f32))) + (export (;1;) "felt" (type (eq 0))) + (type (;2;) (tuple 1 1 1 1)) + (type (;3;) (record (field "inner" 2))) + (export (;4;) "word" (type (eq 3))) + ) + ) + (import "miden:base/core-types@1.0.0" (instance (;0;) (type 0))) + (core module (;0;) + (type (;0;) (func)) + (type (;1;) (func (result i32))) + (type (;2;) (func (param i32 f32))) + (type (;3;) (func (param i32 i32))) + (type (;4;) (func (param i32) (result f32))) + (type (;5;) (func (param f32 i32))) + (table (;0;) 2 2 funcref) + (memory (;0;) 17) + (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) + (global $GOT.data.internal.__memory_base (;1;) i32 i32.const 0) + (export "memory" (memory 0)) + (export "miden:rust-sdk-output-note-get-metadata-binding/rust-sdk-output-note-get-metadata-binding@0.0.1#binding" (func $miden:rust-sdk-output-note-get-metadata-binding/rust-sdk-output-note-get-metadata-binding@0.0.1#binding)) + (elem (;0;) (i32.const 1) func $rust_sdk_output_note_get_metadata_binding::bindings::__link_custom_section_describing_imports) + (func $__wasm_call_ctors (;0;) (type 0)) + (func $rust_sdk_output_note_get_metadata_binding::bindings::__link_custom_section_describing_imports (;1;) (type 0)) + (func $miden:rust-sdk-output-note-get-metadata-binding/rust-sdk-output-note-get-metadata-binding@0.0.1#binding (;2;) (type 1) (result i32) + (local i32 i32) + global.get $__stack_pointer + i32.const 16 + i32.sub + local.tee 0 + global.set $__stack_pointer + call $wit_bindgen::rt::run_ctors_once + local.get 0 + i32.const 0 + call $intrinsics::felt::from_u32 + call $miden_base_sys::bindings::output_note::get_metadata + global.get $GOT.data.internal.__memory_base + i32.const 1048584 + i32.add + local.tee 1 + local.get 0 + i64.load offset=8 + i64.store offset=8 align=4 + local.get 1 + local.get 0 + i64.load + i64.store align=4 + local.get 0 + i32.const 16 + i32.add + global.set $__stack_pointer + local.get 1 + ) + (func $wit_bindgen::rt::run_ctors_once (;3;) (type 0) + (local i32) + block ;; label = @1 + global.get $GOT.data.internal.__memory_base + i32.const 1048600 + i32.add + i32.load8_u + br_if 0 (;@1;) + global.get $GOT.data.internal.__memory_base + local.set 0 + call $__wasm_call_ctors + local.get 0 + i32.const 1048600 + i32.add + i32.const 1 + i32.store8 + end + ) + (func $miden_base_sys::bindings::output_note::get_metadata (;4;) (type 2) (param i32 f32) + (local i32) + global.get $__stack_pointer + i32.const 32 + i32.sub + local.tee 2 + global.set $__stack_pointer + local.get 1 + local.get 2 + call $miden::output_note::get_metadata + local.get 2 + local.get 2 + i64.load offset=8 + i64.store offset=24 + local.get 2 + local.get 2 + i64.load + i64.store offset=16 + local.get 0 + local.get 2 + i32.const 16 + i32.add + call $miden_stdlib_sys::intrinsics::word::Word::reverse + local.get 2 + i32.const 32 + i32.add + global.set $__stack_pointer + ) + (func $miden_stdlib_sys::intrinsics::word::Word::reverse (;5;) (type 3) (param i32 i32) + (local i32 i32 i32 f32) + global.get $__stack_pointer + i32.const 16 + i32.sub + local.tee 2 + local.get 1 + i64.load offset=8 + i64.store offset=8 align=4 + local.get 2 + local.get 1 + i64.load + i64.store align=4 + local.get 2 + i32.const 12 + i32.add + local.set 3 + i32.const 0 + local.set 1 + block ;; label = @1 + loop ;; label = @2 + local.get 1 + i32.const 8 + i32.eq + br_if 1 (;@1;) + local.get 2 + local.get 1 + i32.add + local.tee 4 + f32.load + local.set 5 + local.get 4 + local.get 3 + i32.load + i32.store + local.get 3 + local.get 5 + f32.store + local.get 1 + i32.const 4 + i32.add + local.set 1 + local.get 3 + i32.const -4 + i32.add + local.set 3 + br 0 (;@2;) + end + end + local.get 0 + local.get 2 + i64.load offset=8 align=4 + i64.store offset=8 + local.get 0 + local.get 2 + i64.load align=4 + i64.store + ) + (func $intrinsics::felt::from_u32 (;6;) (type 4) (param i32) (result f32) + unreachable + ) + (func $miden::output_note::get_metadata (;7;) (type 5) (param f32 i32) + unreachable + ) + (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") + (@custom "rodata,miden_account" (after data) "Srust_sdk_output_note_get_metadata_binding\01\0b0.0.1\03\01\01\00\00\00\00\00\00\00\00\00\00\00\00") + ) + (alias export 0 "word" (type (;1;))) + (core instance (;0;) (instantiate 0)) + (alias core export 0 "memory" (core memory (;0;))) + (type (;2;) (func (result 1))) + (alias core export 0 "miden:rust-sdk-output-note-get-metadata-binding/rust-sdk-output-note-get-metadata-binding@0.0.1#binding" (core func (;0;))) + (func (;0;) (type 2) (canon lift (core func 0) (memory 0))) + (alias export 0 "felt" (type (;3;))) + (alias export 0 "word" (type (;4;))) + (component (;0;) + (type (;0;) (record (field "inner" f32))) + (import "import-type-felt" (type (;1;) (eq 0))) + (type (;2;) (tuple 1 1 1 1)) + (type (;3;) (record (field "inner" 2))) + (import "import-type-word" (type (;4;) (eq 3))) + (import "import-type-word0" (type (;5;) (eq 4))) + (type (;6;) (func (result 5))) + (import "import-func-binding" (func (;0;) (type 6))) + (export (;7;) "word" (type 4)) + (type (;8;) (func (result 7))) + (export (;1;) "binding" (func 0) (func (type 8))) + ) + (instance (;1;) (instantiate 0 + (with "import-func-binding" (func 0)) + (with "import-type-felt" (type 3)) + (with "import-type-word" (type 4)) + (with "import-type-word0" (type 1)) + ) + ) + (export (;2;) "miden:rust-sdk-output-note-get-metadata-binding/rust-sdk-output-note-get-metadata-binding@0.0.1" (instance 1)) +) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_recipient_binding.hir b/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_recipient_binding.hir new file mode 100644 index 000000000..3c81ccd98 --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_recipient_binding.hir @@ -0,0 +1,352 @@ +builtin.component miden:rust-sdk-output-note-get-recipient-binding/rust-sdk-output-note-get-recipient-binding@0.0.1 { + builtin.module public @rust_sdk_output_note_get_recipient_binding { + private builtin.function @__wasm_call_ctors() { + ^block5: + builtin.ret ; + }; + + private builtin.function @rust_sdk_output_note_get_recipient_binding::bindings::__link_custom_section_describing_imports() { + ^block7: + builtin.ret ; + }; + + private builtin.function @miden:rust-sdk-output-note-get-recipient-binding/rust-sdk-output-note-get-recipient-binding@0.0.1#binding() -> i32 { + ^block9: + v2 = builtin.global_symbol @miden:rust-sdk-output-note-get-recipient-binding/rust-sdk-output-note-get-recipient-binding@0.0.1/rust_sdk_output_note_get_recipient_binding/__stack_pointer : ptr + v3 = hir.bitcast v2 : ptr; + v4 = hir.load v3 : i32; + v5 = arith.constant 16 : i32; + v6 = arith.sub v4, v5 : i32 #[overflow = wrapping]; + v7 = builtin.global_symbol @miden:rust-sdk-output-note-get-recipient-binding/rust-sdk-output-note-get-recipient-binding@0.0.1/rust_sdk_output_note_get_recipient_binding/__stack_pointer : ptr + v8 = hir.bitcast v7 : ptr; + hir.store v8, v6; + hir.exec @miden:rust-sdk-output-note-get-recipient-binding/rust-sdk-output-note-get-recipient-binding@0.0.1/rust_sdk_output_note_get_recipient_binding/wit_bindgen::rt::run_ctors_once() + v1 = arith.constant 0 : i32; + v10 = hir.exec @miden:rust-sdk-output-note-get-recipient-binding/rust-sdk-output-note-get-recipient-binding@0.0.1/rust_sdk_output_note_get_recipient_binding/intrinsics::felt::from_u32(v1) : felt + hir.exec @miden:rust-sdk-output-note-get-recipient-binding/rust-sdk-output-note-get-recipient-binding@0.0.1/rust_sdk_output_note_get_recipient_binding/miden_base_sys::bindings::output_note::get_recipient(v6, v10) + v11 = builtin.global_symbol @miden:rust-sdk-output-note-get-recipient-binding/rust-sdk-output-note-get-recipient-binding@0.0.1/rust_sdk_output_note_get_recipient_binding/GOT.data.internal.__memory_base : ptr + v12 = hir.bitcast v11 : ptr; + v13 = hir.load v12 : i32; + v14 = arith.constant 1048584 : i32; + v15 = arith.add v13, v14 : i32 #[overflow = wrapping]; + v17 = arith.constant 8 : u32; + v16 = hir.bitcast v6 : u32; + v18 = arith.add v16, v17 : u32 #[overflow = checked]; + v251 = arith.constant 8 : u32; + v20 = arith.mod v18, v251 : u32; + hir.assertz v20 #[code = 250]; + v21 = hir.int_to_ptr v18 : ptr; + v22 = hir.load v21 : i64; + v250 = arith.constant 8 : u32; + v23 = hir.bitcast v15 : u32; + v25 = arith.add v23, v250 : u32 #[overflow = checked]; + v26 = arith.constant 4 : u32; + v27 = arith.mod v25, v26 : u32; + hir.assertz v27 #[code = 250]; + v28 = hir.int_to_ptr v25 : ptr; + hir.store v28, v22; + v29 = hir.bitcast v6 : u32; + v249 = arith.constant 8 : u32; + v31 = arith.mod v29, v249 : u32; + hir.assertz v31 #[code = 250]; + v32 = hir.int_to_ptr v29 : ptr; + v33 = hir.load v32 : i64; + v34 = hir.bitcast v15 : u32; + v248 = arith.constant 4 : u32; + v36 = arith.mod v34, v248 : u32; + hir.assertz v36 #[code = 250]; + v37 = hir.int_to_ptr v34 : ptr; + hir.store v37, v33; + v247 = arith.constant 16 : i32; + v39 = arith.add v6, v247 : i32 #[overflow = wrapping]; + v40 = builtin.global_symbol @miden:rust-sdk-output-note-get-recipient-binding/rust-sdk-output-note-get-recipient-binding@0.0.1/rust_sdk_output_note_get_recipient_binding/__stack_pointer : ptr + v41 = hir.bitcast v40 : ptr; + hir.store v41, v39; + builtin.ret v15; + }; + + private builtin.function @wit_bindgen::rt::run_ctors_once() { + ^block11: + v43 = builtin.global_symbol @miden:rust-sdk-output-note-get-recipient-binding/rust-sdk-output-note-get-recipient-binding@0.0.1/rust_sdk_output_note_get_recipient_binding/GOT.data.internal.__memory_base : ptr + v44 = hir.bitcast v43 : ptr; + v45 = hir.load v44 : i32; + v46 = arith.constant 1048600 : i32; + v47 = arith.add v45, v46 : i32 #[overflow = wrapping]; + v48 = hir.bitcast v47 : u32; + v49 = hir.int_to_ptr v48 : ptr; + v50 = hir.load v49 : u8; + v42 = arith.constant 0 : i32; + v51 = arith.zext v50 : u32; + v52 = hir.bitcast v51 : i32; + v54 = arith.neq v52, v42 : i1; + scf.if v54{ + ^block13: + scf.yield ; + } else { + ^block14: + v55 = builtin.global_symbol @miden:rust-sdk-output-note-get-recipient-binding/rust-sdk-output-note-get-recipient-binding@0.0.1/rust_sdk_output_note_get_recipient_binding/GOT.data.internal.__memory_base : ptr + v56 = hir.bitcast v55 : ptr; + v57 = hir.load v56 : i32; + hir.exec @miden:rust-sdk-output-note-get-recipient-binding/rust-sdk-output-note-get-recipient-binding@0.0.1/rust_sdk_output_note_get_recipient_binding/__wasm_call_ctors() + v253 = arith.constant 1 : u8; + v255 = arith.constant 1048600 : i32; + v59 = arith.add v57, v255 : i32 #[overflow = wrapping]; + v63 = hir.bitcast v59 : u32; + v64 = hir.int_to_ptr v63 : ptr; + hir.store v64, v253; + scf.yield ; + }; + builtin.ret ; + }; + + private builtin.function @miden_base_sys::bindings::output_note::get_recipient(v65: i32, v66: felt) { + ^block15(v65: i32, v66: felt): + v68 = builtin.global_symbol @miden:rust-sdk-output-note-get-recipient-binding/rust-sdk-output-note-get-recipient-binding@0.0.1/rust_sdk_output_note_get_recipient_binding/__stack_pointer : ptr + v69 = hir.bitcast v68 : ptr; + v70 = hir.load v69 : i32; + v71 = arith.constant 32 : i32; + v72 = arith.sub v70, v71 : i32 #[overflow = wrapping]; + v73 = builtin.global_symbol @miden:rust-sdk-output-note-get-recipient-binding/rust-sdk-output-note-get-recipient-binding@0.0.1/rust_sdk_output_note_get_recipient_binding/__stack_pointer : ptr + v74 = hir.bitcast v73 : ptr; + hir.store v74, v72; + hir.exec @miden:rust-sdk-output-note-get-recipient-binding/rust-sdk-output-note-get-recipient-binding@0.0.1/rust_sdk_output_note_get_recipient_binding/miden::output_note::get_recipient(v66, v72) + v76 = arith.constant 8 : u32; + v75 = hir.bitcast v72 : u32; + v77 = arith.add v75, v76 : u32 #[overflow = checked]; + v260 = arith.constant 8 : u32; + v79 = arith.mod v77, v260 : u32; + hir.assertz v79 #[code = 250]; + v80 = hir.int_to_ptr v77 : ptr; + v81 = hir.load v80 : i64; + v83 = arith.constant 24 : u32; + v82 = hir.bitcast v72 : u32; + v84 = arith.add v82, v83 : u32 #[overflow = checked]; + v259 = arith.constant 8 : u32; + v86 = arith.mod v84, v259 : u32; + hir.assertz v86 #[code = 250]; + v87 = hir.int_to_ptr v84 : ptr; + hir.store v87, v81; + v88 = hir.bitcast v72 : u32; + v258 = arith.constant 8 : u32; + v90 = arith.mod v88, v258 : u32; + hir.assertz v90 #[code = 250]; + v91 = hir.int_to_ptr v88 : ptr; + v92 = hir.load v91 : i64; + v94 = arith.constant 16 : u32; + v93 = hir.bitcast v72 : u32; + v95 = arith.add v93, v94 : u32 #[overflow = checked]; + v257 = arith.constant 8 : u32; + v97 = arith.mod v95, v257 : u32; + hir.assertz v97 #[code = 250]; + v98 = hir.int_to_ptr v95 : ptr; + hir.store v98, v92; + v99 = arith.constant 16 : i32; + v100 = arith.add v72, v99 : i32 #[overflow = wrapping]; + hir.exec @miden:rust-sdk-output-note-get-recipient-binding/rust-sdk-output-note-get-recipient-binding@0.0.1/rust_sdk_output_note_get_recipient_binding/miden_stdlib_sys::intrinsics::word::Word::reverse(v65, v100) + v256 = arith.constant 32 : i32; + v102 = arith.add v72, v256 : i32 #[overflow = wrapping]; + v103 = builtin.global_symbol @miden:rust-sdk-output-note-get-recipient-binding/rust-sdk-output-note-get-recipient-binding@0.0.1/rust_sdk_output_note_get_recipient_binding/__stack_pointer : ptr + v104 = hir.bitcast v103 : ptr; + hir.store v104, v102; + builtin.ret ; + }; + + private builtin.function @miden_stdlib_sys::intrinsics::word::Word::reverse(v105: i32, v106: i32) { + ^block17(v105: i32, v106: i32): + v109 = builtin.global_symbol @miden:rust-sdk-output-note-get-recipient-binding/rust-sdk-output-note-get-recipient-binding@0.0.1/rust_sdk_output_note_get_recipient_binding/__stack_pointer : ptr + v110 = hir.bitcast v109 : ptr; + v111 = hir.load v110 : i32; + v112 = arith.constant 16 : i32; + v113 = arith.sub v111, v112 : i32 #[overflow = wrapping]; + v115 = arith.constant 8 : u32; + v114 = hir.bitcast v106 : u32; + v116 = arith.add v114, v115 : u32 #[overflow = checked]; + v347 = arith.constant 8 : u32; + v118 = arith.mod v116, v347 : u32; + hir.assertz v118 #[code = 250]; + v119 = hir.int_to_ptr v116 : ptr; + v120 = hir.load v119 : i64; + v346 = arith.constant 8 : u32; + v121 = hir.bitcast v113 : u32; + v123 = arith.add v121, v346 : u32 #[overflow = checked]; + v124 = arith.constant 4 : u32; + v125 = arith.mod v123, v124 : u32; + hir.assertz v125 #[code = 250]; + v126 = hir.int_to_ptr v123 : ptr; + hir.store v126, v120; + v127 = hir.bitcast v106 : u32; + v345 = arith.constant 8 : u32; + v129 = arith.mod v127, v345 : u32; + hir.assertz v129 #[code = 250]; + v130 = hir.int_to_ptr v127 : ptr; + v131 = hir.load v130 : i64; + v132 = hir.bitcast v113 : u32; + v344 = arith.constant 4 : u32; + v134 = arith.mod v132, v344 : u32; + hir.assertz v134 #[code = 250]; + v135 = hir.int_to_ptr v132 : ptr; + hir.store v135, v131; + v136 = arith.constant 12 : i32; + v137 = arith.add v113, v136 : i32 #[overflow = wrapping]; + v107 = arith.constant 0 : i32; + v315, v316, v317, v318, v319, v320 = scf.while v107, v113, v137, v105 : i32, i32, i32, i32, i32, i32 { + ^block39(v321: i32, v322: i32, v323: i32, v324: i32): + v343 = arith.constant 0 : i32; + v140 = arith.constant 8 : i32; + v141 = arith.eq v321, v140 : i1; + v142 = arith.zext v141 : u32; + v143 = hir.bitcast v142 : i32; + v145 = arith.neq v143, v343 : i1; + v309, v310 = scf.if v145 : i32, i32 { + ^block38: + v269 = ub.poison i32 : i32; + scf.yield v269, v269; + } else { + ^block22: + v147 = arith.add v322, v321 : i32 #[overflow = wrapping]; + v148 = hir.bitcast v147 : u32; + v342 = arith.constant 4 : u32; + v150 = arith.mod v148, v342 : u32; + hir.assertz v150 #[code = 250]; + v151 = hir.int_to_ptr v148 : ptr; + v152 = hir.load v151 : felt; + v154 = hir.bitcast v323 : u32; + v341 = arith.constant 4 : u32; + v156 = arith.mod v154, v341 : u32; + hir.assertz v156 #[code = 250]; + v157 = hir.int_to_ptr v154 : ptr; + v158 = hir.load v157 : i32; + v159 = hir.bitcast v147 : u32; + v340 = arith.constant 4 : u32; + v161 = arith.mod v159, v340 : u32; + hir.assertz v161 #[code = 250]; + v162 = hir.int_to_ptr v159 : ptr; + hir.store v162, v158; + v163 = hir.bitcast v323 : u32; + v339 = arith.constant 4 : u32; + v165 = arith.mod v163, v339 : u32; + hir.assertz v165 #[code = 250]; + v166 = hir.int_to_ptr v163 : ptr; + hir.store v166, v152; + v169 = arith.constant -4 : i32; + v170 = arith.add v323, v169 : i32 #[overflow = wrapping]; + v167 = arith.constant 4 : i32; + v168 = arith.add v321, v167 : i32 #[overflow = wrapping]; + scf.yield v168, v170; + }; + v337 = ub.poison i32 : i32; + v312 = cf.select v145, v337, v324 : i32; + v338 = ub.poison i32 : i32; + v311 = cf.select v145, v338, v322 : i32; + v268 = arith.constant 1 : u32; + v261 = arith.constant 0 : u32; + v314 = cf.select v145, v261, v268 : u32; + v302 = arith.trunc v314 : i1; + scf.condition v302, v309, v311, v310, v312, v322, v324; + } do { + ^block40(v325: i32, v326: i32, v327: i32, v328: i32, v329: i32, v330: i32): + scf.yield v325, v326, v327, v328; + }; + v336 = arith.constant 8 : u32; + v172 = hir.bitcast v319 : u32; + v174 = arith.add v172, v336 : u32 #[overflow = checked]; + v335 = arith.constant 4 : u32; + v176 = arith.mod v174, v335 : u32; + hir.assertz v176 #[code = 250]; + v177 = hir.int_to_ptr v174 : ptr; + v178 = hir.load v177 : i64; + v334 = arith.constant 8 : u32; + v179 = hir.bitcast v320 : u32; + v181 = arith.add v179, v334 : u32 #[overflow = checked]; + v333 = arith.constant 8 : u32; + v183 = arith.mod v181, v333 : u32; + hir.assertz v183 #[code = 250]; + v184 = hir.int_to_ptr v181 : ptr; + hir.store v184, v178; + v185 = hir.bitcast v319 : u32; + v332 = arith.constant 4 : u32; + v187 = arith.mod v185, v332 : u32; + hir.assertz v187 #[code = 250]; + v188 = hir.int_to_ptr v185 : ptr; + v189 = hir.load v188 : i64; + v190 = hir.bitcast v320 : u32; + v331 = arith.constant 8 : u32; + v192 = arith.mod v190, v331 : u32; + hir.assertz v192 #[code = 250]; + v193 = hir.int_to_ptr v190 : ptr; + hir.store v193, v189; + builtin.ret ; + }; + + private builtin.function @intrinsics::felt::from_u32(v194: i32) -> felt { + ^block23(v194: i32): + v195 = hir.bitcast v194 : felt; + builtin.ret v195; + }; + + private builtin.function @miden::output_note::get_recipient(v197: felt, v198: i32) { + ^block25(v197: felt, v198: i32): + v199, v200, v201, v202 = hir.exec @miden/output_note/get_recipient(v197) : felt, felt, felt, felt + v203 = hir.bitcast v198 : u32; + v204 = hir.int_to_ptr v203 : ptr; + hir.store v204, v199; + v205 = arith.constant 4 : u32; + v206 = arith.add v203, v205 : u32 #[overflow = checked]; + v207 = hir.int_to_ptr v206 : ptr; + hir.store v207, v200; + v208 = arith.constant 8 : u32; + v209 = arith.add v203, v208 : u32 #[overflow = checked]; + v210 = hir.int_to_ptr v209 : ptr; + hir.store v210, v201; + v211 = arith.constant 12 : u32; + v212 = arith.add v203, v211 : u32 #[overflow = checked]; + v213 = hir.int_to_ptr v212 : ptr; + hir.store v213, v202; + builtin.ret ; + }; + + builtin.global_variable private @#__stack_pointer : i32 { + builtin.ret_imm 1048576; + }; + + builtin.global_variable private @#GOT.data.internal.__memory_base : i32 { + builtin.ret_imm 0; + }; + + builtin.segment @1048576 = 0x0000000100000001; + }; + + public builtin.function @binding() -> felt, felt, felt, felt { + ^block29: + v214 = hir.exec @miden:rust-sdk-output-note-get-recipient-binding/rust-sdk-output-note-get-recipient-binding@0.0.1/rust_sdk_output_note_get_recipient_binding/miden:rust-sdk-output-note-get-recipient-binding/rust-sdk-output-note-get-recipient-binding@0.0.1#binding() : i32 + v353 = arith.constant 0 : i32; + v215 = arith.constant 0 : i32; + v216 = arith.add v214, v215 : i32 #[overflow = unchecked]; + v218 = arith.add v216, v353 : i32 #[overflow = unchecked]; + v351 = arith.constant 0 : i32; + v352 = arith.constant 0 : i32; + v220 = arith.add v218, v352 : i32 #[overflow = unchecked]; + v222 = arith.add v220, v351 : i32 #[overflow = unchecked]; + v223 = hir.int_to_ptr v222 : ptr; + v224 = hir.load v223 : felt; + v350 = arith.constant 0 : i32; + v225 = arith.constant 4 : i32; + v226 = arith.add v218, v225 : i32 #[overflow = unchecked]; + v228 = arith.add v226, v350 : i32 #[overflow = unchecked]; + v229 = hir.int_to_ptr v228 : ptr; + v230 = hir.load v229 : felt; + v349 = arith.constant 0 : i32; + v231 = arith.constant 8 : i32; + v232 = arith.add v218, v231 : i32 #[overflow = unchecked]; + v234 = arith.add v232, v349 : i32 #[overflow = unchecked]; + v235 = hir.int_to_ptr v234 : ptr; + v236 = hir.load v235 : felt; + v348 = arith.constant 0 : i32; + v237 = arith.constant 12 : i32; + v238 = arith.add v218, v237 : i32 #[overflow = unchecked]; + v240 = arith.add v238, v348 : i32 #[overflow = unchecked]; + v241 = hir.int_to_ptr v240 : ptr; + v242 = hir.load v241 : felt; + builtin.ret v224, v230, v236, v242; + }; +}; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_recipient_binding.masm b/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_recipient_binding.masm new file mode 100644 index 000000000..af905fd0d --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_recipient_binding.masm @@ -0,0 +1,751 @@ +# mod miden:rust-sdk-output-note-get-recipient-binding/rust-sdk-output-note-get-recipient-binding@0.0.1 + +@callconv("canon-lift") +pub proc binding( + +) -> (felt, felt, felt, felt) + exec.::miden:rust-sdk-output-note-get-recipient-binding/rust-sdk-output-note-get-recipient-binding@0.0.1::init + trace.240 + nop + exec.::miden:rust-sdk-output-note-get-recipient-binding/rust-sdk-output-note-get-recipient-binding@0.0.1::rust_sdk_output_note_get_recipient_binding::miden:rust-sdk-output-note-get-recipient-binding/rust-sdk-output-note-get-recipient-binding@0.0.1#binding + trace.252 + nop + push.0 + push.0 + movup.2 + u32wrapping_add + u32wrapping_add + push.0 + push.0 + dup.2 + u32wrapping_add + u32wrapping_add + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.0 + push.4 + dup.3 + u32wrapping_add + u32wrapping_add + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.0 + push.8 + dup.4 + u32wrapping_add + u32wrapping_add + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.0 + push.12 + movup.5 + u32wrapping_add + u32wrapping_add + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + movdn.3 + swap.2 + exec.::std::sys::truncate_stack +end + +proc init + push.1179648 + trace.240 + exec.::intrinsics::mem::heap_init + trace.252 + push.[7028007876379170725,18060021366771303825,13412364500725888848,14178532912296021363] + adv.push_mapval + push.262144 + push.1 + trace.240 + exec.::std::mem::pipe_preimage_to_memory + trace.252 + drop + push.1048576 + u32assert + mem_store.278536 + push.0 + u32assert + mem_store.278537 +end + +# mod miden:rust-sdk-output-note-get-recipient-binding/rust-sdk-output-note-get-recipient-binding@0.0.1::rust_sdk_output_note_get_recipient_binding + +@callconv("C") +proc __wasm_call_ctors( + +) + nop +end + +@callconv("C") +proc rust_sdk_output_note_get_recipient_binding::bindings::__link_custom_section_describing_imports( + +) + nop +end + +@callconv("C") +proc miden:rust-sdk-output-note-get-recipient-binding/rust-sdk-output-note-get-recipient-binding@0.0.1#binding( + +) -> i32 + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.16 + u32wrapping_sub + push.1114144 + dup.1 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + trace.240 + nop + exec.::miden:rust-sdk-output-note-get-recipient-binding/rust-sdk-output-note-get-recipient-binding@0.0.1::rust_sdk_output_note_get_recipient_binding::wit_bindgen::rt::run_ctors_once + trace.252 + nop + push.0 + trace.240 + nop + exec.::miden:rust-sdk-output-note-get-recipient-binding/rust-sdk-output-note-get-recipient-binding@0.0.1::rust_sdk_output_note_get_recipient_binding::intrinsics::felt::from_u32 + trace.252 + nop + dup.1 + trace.240 + nop + exec.::miden:rust-sdk-output-note-get-recipient-binding/rust-sdk-output-note-get-recipient-binding@0.0.1::rust_sdk_output_note_get_recipient_binding::miden_base_sys::bindings::output_note::get_recipient + trace.252 + nop + push.1114148 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.1048584 + u32wrapping_add + push.8 + dup.2 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.8 + dup.3 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + dup.1 + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + dup.2 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.16 + movup.2 + u32wrapping_add + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop +end + +@callconv("C") +proc wit_bindgen::rt::run_ctors_once( + +) + push.1114148 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.1048600 + u32wrapping_add + u32divmod.4 + swap.1 + swap.1 + dup.1 + mem_load + swap.1 + push.8 + u32wrapping_mul + u32shr + swap.1 + drop + push.255 + u32and + push.0 + swap.1 + neq + if.true + nop + else + push.1114148 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + trace.240 + nop + exec.::miden:rust-sdk-output-note-get-recipient-binding/rust-sdk-output-note-get-recipient-binding@0.0.1::rust_sdk_output_note_get_recipient_binding::__wasm_call_ctors + trace.252 + nop + push.1 + push.1048600 + movup.2 + u32wrapping_add + u32divmod.4 + swap.1 + dup.0 + mem_load + dup.2 + push.8 + u32wrapping_mul + push.255 + swap.1 + u32shl + u32not + swap.1 + u32and + movup.3 + movup.3 + push.8 + u32wrapping_mul + u32shl + u32or + swap.1 + mem_store + end +end + +@callconv("C") +proc miden_base_sys::bindings::output_note::get_recipient( + i32, + felt +) + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.32 + u32wrapping_sub + push.1114144 + dup.1 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + dup.0 + movup.3 + trace.240 + nop + exec.::miden:rust-sdk-output-note-get-recipient-binding/rust-sdk-output-note-get-recipient-binding@0.0.1::rust_sdk_output_note_get_recipient_binding::miden::output_note::get_recipient + trace.252 + nop + push.8 + dup.1 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.24 + dup.3 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + dup.0 + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.16 + dup.3 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.16 + dup.1 + u32wrapping_add + movup.2 + trace.240 + nop + exec.::miden:rust-sdk-output-note-get-recipient-binding/rust-sdk-output-note-get-recipient-binding@0.0.1::rust_sdk_output_note_get_recipient_binding::miden_stdlib_sys::intrinsics::word::Word::reverse + trace.252 + nop + push.32 + u32wrapping_add + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop +end + +@callconv("C") +proc miden_stdlib_sys::intrinsics::word::Word::reverse( + i32, + i32 +) + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.16 + u32wrapping_sub + push.8 + dup.3 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.8 + dup.3 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + movup.2 + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + dup.2 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.12 + dup.1 + u32wrapping_add + push.0 + movup.2 + swap.1 + push.1 + while.true + push.0 + push.8 + dup.2 + eq + neq + dup.0 + if.true + movup.3 + movup.2 + drop + drop + push.3735929054 + dup.0 + else + dup.2 + dup.2 + u32wrapping_add + dup.0 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + dup.5 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + movup.2 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + dup.4 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.4294967292 + movup.4 + u32wrapping_add + push.4 + movup.3 + u32wrapping_add + end + push.3735929054 + dup.3 + dup.6 + swap.2 + swap.1 + cdrop + push.3735929054 + dup.4 + dup.6 + swap.2 + swap.1 + cdrop + push.1 + push.0 + movup.6 + cdrop + push.1 + u32and + swap.1 + swap.2 + swap.4 + swap.3 + swap.1 + if.true + movup.4 + drop + movup.4 + drop + push.1 + else + push.0 + end + end + drop + drop + drop + drop + push.8 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.8 + dup.4 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + movup.2 + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop +end + +@callconv("C") +proc intrinsics::felt::from_u32(i32) -> felt + nop +end + +@callconv("C") +proc miden::output_note::get_recipient(felt, i32) + trace.240 + nop + exec.::miden::output_note::get_recipient + trace.252 + nop + movup.4 + dup.0 + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.4 + dup.1 + add + u32assert + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.8 + dup.1 + add + u32assert + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.12 + add + u32assert + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop +end + diff --git a/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_recipient_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_recipient_binding.wat new file mode 100644 index 000000000..e6daa1396 --- /dev/null +++ b/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_recipient_binding.wat @@ -0,0 +1,205 @@ +(component + (type (;0;) + (instance + (type (;0;) (record (field "inner" f32))) + (export (;1;) "felt" (type (eq 0))) + (type (;2;) (tuple 1 1 1 1)) + (type (;3;) (record (field "inner" 2))) + (export (;4;) "word" (type (eq 3))) + (type (;5;) (record (field "inner" 4))) + (export (;6;) "recipient" (type (eq 5))) + ) + ) + (import "miden:base/core-types@1.0.0" (instance (;0;) (type 0))) + (core module (;0;) + (type (;0;) (func)) + (type (;1;) (func (result i32))) + (type (;2;) (func (param i32 f32))) + (type (;3;) (func (param i32 i32))) + (type (;4;) (func (param i32) (result f32))) + (type (;5;) (func (param f32 i32))) + (table (;0;) 2 2 funcref) + (memory (;0;) 17) + (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) + (global $GOT.data.internal.__memory_base (;1;) i32 i32.const 0) + (export "memory" (memory 0)) + (export "miden:rust-sdk-output-note-get-recipient-binding/rust-sdk-output-note-get-recipient-binding@0.0.1#binding" (func $miden:rust-sdk-output-note-get-recipient-binding/rust-sdk-output-note-get-recipient-binding@0.0.1#binding)) + (elem (;0;) (i32.const 1) func $rust_sdk_output_note_get_recipient_binding::bindings::__link_custom_section_describing_imports) + (func $__wasm_call_ctors (;0;) (type 0)) + (func $rust_sdk_output_note_get_recipient_binding::bindings::__link_custom_section_describing_imports (;1;) (type 0)) + (func $miden:rust-sdk-output-note-get-recipient-binding/rust-sdk-output-note-get-recipient-binding@0.0.1#binding (;2;) (type 1) (result i32) + (local i32 i32) + global.get $__stack_pointer + i32.const 16 + i32.sub + local.tee 0 + global.set $__stack_pointer + call $wit_bindgen::rt::run_ctors_once + local.get 0 + i32.const 0 + call $intrinsics::felt::from_u32 + call $miden_base_sys::bindings::output_note::get_recipient + global.get $GOT.data.internal.__memory_base + i32.const 1048584 + i32.add + local.tee 1 + local.get 0 + i64.load offset=8 + i64.store offset=8 align=4 + local.get 1 + local.get 0 + i64.load + i64.store align=4 + local.get 0 + i32.const 16 + i32.add + global.set $__stack_pointer + local.get 1 + ) + (func $wit_bindgen::rt::run_ctors_once (;3;) (type 0) + (local i32) + block ;; label = @1 + global.get $GOT.data.internal.__memory_base + i32.const 1048600 + i32.add + i32.load8_u + br_if 0 (;@1;) + global.get $GOT.data.internal.__memory_base + local.set 0 + call $__wasm_call_ctors + local.get 0 + i32.const 1048600 + i32.add + i32.const 1 + i32.store8 + end + ) + (func $miden_base_sys::bindings::output_note::get_recipient (;4;) (type 2) (param i32 f32) + (local i32) + global.get $__stack_pointer + i32.const 32 + i32.sub + local.tee 2 + global.set $__stack_pointer + local.get 1 + local.get 2 + call $miden::output_note::get_recipient + local.get 2 + local.get 2 + i64.load offset=8 + i64.store offset=24 + local.get 2 + local.get 2 + i64.load + i64.store offset=16 + local.get 0 + local.get 2 + i32.const 16 + i32.add + call $miden_stdlib_sys::intrinsics::word::Word::reverse + local.get 2 + i32.const 32 + i32.add + global.set $__stack_pointer + ) + (func $miden_stdlib_sys::intrinsics::word::Word::reverse (;5;) (type 3) (param i32 i32) + (local i32 i32 i32 f32) + global.get $__stack_pointer + i32.const 16 + i32.sub + local.tee 2 + local.get 1 + i64.load offset=8 + i64.store offset=8 align=4 + local.get 2 + local.get 1 + i64.load + i64.store align=4 + local.get 2 + i32.const 12 + i32.add + local.set 3 + i32.const 0 + local.set 1 + block ;; label = @1 + loop ;; label = @2 + local.get 1 + i32.const 8 + i32.eq + br_if 1 (;@1;) + local.get 2 + local.get 1 + i32.add + local.tee 4 + f32.load + local.set 5 + local.get 4 + local.get 3 + i32.load + i32.store + local.get 3 + local.get 5 + f32.store + local.get 1 + i32.const 4 + i32.add + local.set 1 + local.get 3 + i32.const -4 + i32.add + local.set 3 + br 0 (;@2;) + end + end + local.get 0 + local.get 2 + i64.load offset=8 align=4 + i64.store offset=8 + local.get 0 + local.get 2 + i64.load align=4 + i64.store + ) + (func $intrinsics::felt::from_u32 (;6;) (type 4) (param i32) (result f32) + unreachable + ) + (func $miden::output_note::get_recipient (;7;) (type 5) (param f32 i32) + unreachable + ) + (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") + (@custom "rodata,miden_account" (after data) "Urust_sdk_output_note_get_recipient_binding\01\0b0.0.1\03\01\01\00\00\00\00\00\00\00\00\00\00\00") + ) + (alias export 0 "recipient" (type (;1;))) + (core instance (;0;) (instantiate 0)) + (alias core export 0 "memory" (core memory (;0;))) + (type (;2;) (func (result 1))) + (alias core export 0 "miden:rust-sdk-output-note-get-recipient-binding/rust-sdk-output-note-get-recipient-binding@0.0.1#binding" (core func (;0;))) + (func (;0;) (type 2) (canon lift (core func 0) (memory 0))) + (alias export 0 "felt" (type (;3;))) + (alias export 0 "word" (type (;4;))) + (alias export 0 "recipient" (type (;5;))) + (component (;0;) + (type (;0;) (record (field "inner" f32))) + (import "import-type-felt" (type (;1;) (eq 0))) + (type (;2;) (tuple 1 1 1 1)) + (type (;3;) (record (field "inner" 2))) + (import "import-type-word" (type (;4;) (eq 3))) + (type (;5;) (record (field "inner" 4))) + (import "import-type-recipient" (type (;6;) (eq 5))) + (import "import-type-recipient0" (type (;7;) (eq 6))) + (type (;8;) (func (result 7))) + (import "import-func-binding" (func (;0;) (type 8))) + (export (;9;) "recipient" (type 6)) + (type (;10;) (func (result 9))) + (export (;1;) "binding" (func 0) (func (type 10))) + ) + (instance (;1;) (instantiate 0 + (with "import-func-binding" (func 0)) + (with "import-type-felt" (type 3)) + (with "import-type-word" (type 4)) + (with "import-type-recipient" (type 5)) + (with "import-type-recipient0" (type 1)) + ) + ) + (export (;2;) "miden:rust-sdk-output-note-get-recipient-binding/rust-sdk-output-note-get-recipient-binding@0.0.1" (instance 1)) +) diff --git a/tests/integration/src/rust_masm_tests/rust_sdk/base/account.rs b/tests/integration/src/rust_masm_tests/rust_sdk/base/account.rs new file mode 100644 index 000000000..2bc091731 --- /dev/null +++ b/tests/integration/src/rust_masm_tests/rust_sdk/base/account.rs @@ -0,0 +1,238 @@ +use super::*; + +#[allow(clippy::uninlined_format_args)] +fn run_account_binding_test(name: &str, method: &str) { + let lib_rs = format!( + r"#![no_std] + +use miden::*; + +#[component] +struct TestAccount; + +#[component] +impl TestAccount {{ + {method} +}} +", + method = method + ); + + let sdk_path = sdk_crate_path(); + let component_package = format!("miden:{}", name.replace('_', "-")); + let cargo_toml = format!( + r#" +[package] +name = "{name}" +version = "0.0.1" +edition = "2021" +authors = [] + +[lib] +crate-type = ["cdylib"] + +[dependencies] +miden = {{ path = "{sdk_path}" }} + +[package.metadata.component] +package = "{component_package}" + +[package.metadata.miden] +project-kind = "account" +supported-types = ["RegularAccountUpdatableCode"] + +[profile.release] +opt-level = "z" +panic = "abort" +debug = false +"#, + name = name, + sdk_path = sdk_path.display(), + component_package = component_package, + ); + + let cargo_proj = project(name) + .file("Cargo.toml", &cargo_toml) + .file("src/lib.rs", &lib_rs) + .build(); + + let mut test = CompilerTestBuilder::rust_source_cargo_miden( + cargo_proj.root(), + WasmTranslationConfig::default(), + [], + ) + .build(); + + test.expect_wasm(expect_file![format!("../../../../expected/rust_sdk/{name}.wat")]); + test.expect_ir(expect_file![format!("../../../../expected/rust_sdk/{name}.hir")]); + test.expect_masm(expect_file![format!("../../../../expected/rust_sdk/{name}.masm")]); + + test.compiled_package(); +} + +#[test] +fn rust_sdk_account_get_code_commitment_binding() { + run_account_binding_test( + "rust_sdk_account_get_code_commitment_binding", + "pub fn binding(&self) -> Word { + account::get_code_commitment() + }", + ); +} + +#[test] +fn rust_sdk_account_get_initial_storage_commitment_binding() { + run_account_binding_test( + "rust_sdk_account_get_initial_storage_commitment_binding", + "pub fn binding(&self) -> Word { + account::get_initial_storage_commitment() + }", + ); +} + +#[test] +fn rust_sdk_account_compute_storage_commitment_binding() { + run_account_binding_test( + "rust_sdk_account_compute_storage_commitment_binding", + "pub fn binding(&self) -> Word { + account::compute_storage_commitment() + }", + ); +} + +#[test] +fn rust_sdk_account_compute_commitment_binding() { + run_account_binding_test( + "rust_sdk_account_compute_commitment_binding", + "pub fn binding(&self) -> Word { + account::compute_commitment() + }", + ); +} + +#[test] +fn rust_sdk_account_compute_delta_commitment_binding() { + run_account_binding_test( + "rust_sdk_account_compute_delta_commitment_binding", + "pub fn binding(&self) -> Word { + account::compute_delta_commitment() + }", + ); +} + +#[test] +fn rust_sdk_account_get_initial_balance_binding() { + run_account_binding_test( + "rust_sdk_account_get_initial_balance_binding", + "pub fn binding(&self) -> Felt { + let faucet = AccountId { prefix: Felt::from_u32(1), suffix: Felt::from_u32(0) }; + account::get_initial_balance(faucet) + }", + ); +} + +#[test] +fn rust_sdk_account_has_non_fungible_asset_binding() { + run_account_binding_test( + "rust_sdk_account_has_non_fungible_asset_binding", + "pub fn binding(&self) -> Felt { + let asset = Asset::from([Felt::from_u32(0); 4]); + if account::has_non_fungible_asset(asset) { + Felt::from_u32(1) + } else { + Felt::from_u32(0) + } + }", + ); +} + +#[test] +fn rust_sdk_account_get_initial_vault_root_binding() { + run_account_binding_test( + "rust_sdk_account_get_initial_vault_root_binding", + "pub fn binding(&self) -> Word { + account::get_initial_vault_root() + }", + ); +} + +#[test] +fn rust_sdk_account_get_vault_root_binding() { + run_account_binding_test( + "rust_sdk_account_get_vault_root_binding", + "pub fn binding(&self) -> Word { + account::get_vault_root() + }", + ); +} + +#[test] +fn rust_sdk_account_get_num_procedures_binding() { + run_account_binding_test( + "rust_sdk_account_get_num_procedures_binding", + "pub fn binding(&self) -> Felt { + account::get_num_procedures() + }", + ); +} + +#[test] +fn rust_sdk_account_get_procedure_root_binding() { + run_account_binding_test( + "rust_sdk_account_get_procedure_root_binding", + "pub fn binding(&self) -> Word { + account::get_procedure_root(0) + }", + ); +} + +#[test] +fn rust_sdk_account_has_procedure_binding() { + run_account_binding_test( + "rust_sdk_account_has_procedure_binding", + "pub fn binding(&self) -> Felt { + let proc_root = Word::from([Felt::from_u32(0); 4]); + if account::has_procedure(proc_root) { + Felt::from_u32(1) + } else { + Felt::from_u32(0) + } + }", + ); +} + +#[test] +fn rust_sdk_account_was_procedure_called_binding() { + run_account_binding_test( + "rust_sdk_account_was_procedure_called_binding", + "pub fn binding(&self) -> Felt { + let proc_root = Word::from([Felt::from_u32(0); 4]); + if account::was_procedure_called(proc_root) { + Felt::from_u32(1) + } else { + Felt::from_u32(0) + } + }", + ); +} + +#[test] +fn rust_sdk_account_storage_get_initial_item_binding() { + run_account_binding_test( + "rust_sdk_account_storage_get_initial_item_binding", + "pub fn binding(&self) -> Word { + storage::get_initial_item(0) + }", + ); +} + +#[test] +fn rust_sdk_account_storage_get_initial_map_item_binding() { + run_account_binding_test( + "rust_sdk_account_storage_get_initial_map_item_binding", + "pub fn binding(&self) -> Word { + let key = Word::from([Felt::from_u32(0); 4]); + storage::get_initial_map_item(0, &key) + }", + ); +} diff --git a/tests/integration/src/rust_masm_tests/rust_sdk/base/asset.rs b/tests/integration/src/rust_masm_tests/rust_sdk/base/asset.rs new file mode 100644 index 000000000..447182040 --- /dev/null +++ b/tests/integration/src/rust_masm_tests/rust_sdk/base/asset.rs @@ -0,0 +1,94 @@ +use super::*; + +#[allow(clippy::uninlined_format_args)] +fn run_asset_binding_test(name: &str, method: &str) { + let lib_rs = format!( + r"#![no_std] + +use miden::*; + +#[component] +struct TestAsset; + +#[component] +impl TestAsset {{ + {method} +}} +", + method = method + ); + + let sdk_path = sdk_crate_path(); + let component_package = format!("miden:{}", name.replace('_', "-")); + let cargo_toml = format!( + r#" +[package] +name = "{name}" +version = "0.0.1" +edition = "2021" +authors = [] + +[lib] +crate-type = ["cdylib"] + +[dependencies] +miden = {{ path = "{sdk_path}" }} + +[package.metadata.component] +package = "{component_package}" + +[package.metadata.miden] +project-kind = "account" +supported-types = ["RegularAccountUpdatableCode"] + +[profile.release] +opt-level = "z" +panic = "abort" +debug = false +"#, + name = name, + sdk_path = sdk_path.display(), + component_package = component_package, + ); + + let cargo_proj = project(name) + .file("Cargo.toml", &cargo_toml) + .file("src/lib.rs", &lib_rs) + .build(); + + let mut test = CompilerTestBuilder::rust_source_cargo_miden( + cargo_proj.root(), + WasmTranslationConfig::default(), + [], + ) + .build(); + + test.expect_wasm(expect_file![format!("../../../../expected/rust_sdk/{name}.wat")]); + test.expect_ir(expect_file![format!("../../../../expected/rust_sdk/{name}.hir")]); + test.expect_masm(expect_file![format!("../../../../expected/rust_sdk/{name}.masm")]); + + test.compiled_package(); +} + +#[test] +fn rust_sdk_account_asset_build_fungible_asset_binding() { + run_asset_binding_test( + "rust_sdk_account_asset_build_fungible_asset_binding", + "pub fn binding(&self) -> Asset { + let faucet = AccountId { prefix: Felt::from_u32(1), suffix: Felt::from_u32(0) }; + asset::build_fungible_asset(faucet, Felt::from_u32(10)) + }", + ); +} + +#[test] +fn rust_sdk_account_asset_build_non_fungible_asset_binding() { + run_asset_binding_test( + "rust_sdk_account_asset_build_non_fungible_asset_binding", + "pub fn binding(&self) -> Asset { + let faucet = AccountId { prefix: Felt::from_u32(1), suffix: Felt::from_u32(0) }; + let hash = Word::from([Felt::from_u32(0); 4]); + asset::build_non_fungible_asset(faucet, hash) + }", + ); +} diff --git a/tests/integration/src/rust_masm_tests/rust_sdk/base/faucet.rs b/tests/integration/src/rust_masm_tests/rust_sdk/base/faucet.rs new file mode 100644 index 000000000..c38e2e7bd --- /dev/null +++ b/tests/integration/src/rust_masm_tests/rust_sdk/base/faucet.rs @@ -0,0 +1,139 @@ +use super::*; + +#[allow(clippy::uninlined_format_args)] +fn run_faucet_binding_test(name: &str, method: &str) { + let lib_rs = format!( + r"#![no_std] + +use miden::*; + +#[component] +struct TestFaucet; + +#[component] +impl TestFaucet {{ + {method} +}} +", + method = method + ); + + let sdk_path = sdk_crate_path(); + let component_package = format!("miden:{}", name.replace('_', "-")); + let cargo_toml = format!( + r#" +[package] +name = "{name}" +version = "0.0.1" +edition = "2021" +authors = [] + +[lib] +crate-type = ["cdylib"] + +[dependencies] +miden = {{ path = "{sdk_path}" }} + +[package.metadata.component] +package = "{component_package}" + +[package.metadata.miden] +project-kind = "account" +supported-types = ["FungibleFaucet", "NonFungibleFaucet"] + +[profile.release] +opt-level = "z" +panic = "abort" +debug = false +"#, + name = name, + sdk_path = sdk_path.display(), + component_package = component_package, + ); + + let cargo_proj = project(name) + .file("Cargo.toml", &cargo_toml) + .file("src/lib.rs", &lib_rs) + .build(); + + let mut test = CompilerTestBuilder::rust_source_cargo_miden( + cargo_proj.root(), + WasmTranslationConfig::default(), + [], + ) + .build(); + + test.expect_wasm(expect_file![format!("../../../../expected/rust_sdk/{name}.wat")]); + test.expect_ir(expect_file![format!("../../../../expected/rust_sdk/{name}.hir")]); + test.expect_masm(expect_file![format!("../../../../expected/rust_sdk/{name}.masm")]); + + test.compiled_package(); +} + +#[test] +fn rust_sdk_account_faucet_create_fungible_asset_binding() { + run_faucet_binding_test( + "rust_sdk_account_faucet_create_fungible_asset_binding", + "pub fn binding(&self) -> Asset { + faucet::create_fungible_asset(Felt::from_u32(10)) + }", + ); +} + +#[test] +fn rust_sdk_account_faucet_create_non_fungible_asset_binding() { + run_faucet_binding_test( + "rust_sdk_account_faucet_create_non_fungible_asset_binding", + "pub fn binding(&self) -> Asset { + let hash = Word::from([Felt::from_u32(0); 4]); + faucet::create_non_fungible_asset(hash) + }", + ); +} + +#[test] +fn rust_sdk_account_faucet_mint_binding() { + run_faucet_binding_test( + "rust_sdk_account_faucet_mint_binding", + "pub fn binding(&self) -> Asset { + let asset = Asset::from([Felt::from_u32(0); 4]); + faucet::mint(asset) + }", + ); +} + +#[test] +fn rust_sdk_account_faucet_burn_binding() { + run_faucet_binding_test( + "rust_sdk_account_faucet_burn_binding", + "pub fn binding(&self) -> Asset { + let asset = Asset::from([Felt::from_u32(0); 4]); + faucet::burn(asset) + }", + ); +} + +#[test] +fn rust_sdk_account_faucet_get_total_issuance_binding() { + run_faucet_binding_test( + "rust_sdk_account_faucet_get_total_issuance_binding", + "pub fn binding(&self) -> Felt { + faucet::get_total_issuance() + }", + ); +} + +#[test] +fn rust_sdk_account_faucet_is_non_fungible_asset_issued_binding() { + run_faucet_binding_test( + "rust_sdk_account_faucet_is_non_fungible_asset_issued_binding", + "pub fn binding(&self) -> Felt { + let asset = Asset::from([Felt::from_u32(0); 4]); + if faucet::is_non_fungible_asset_issued(asset) { + Felt::from_u32(1) + } else { + Felt::from_u32(0) + } + }", + ); +} diff --git a/tests/integration/src/rust_masm_tests/rust_sdk/base/input_note.rs b/tests/integration/src/rust_masm_tests/rust_sdk/base/input_note.rs new file mode 100644 index 000000000..f5a1f91fc --- /dev/null +++ b/tests/integration/src/rust_masm_tests/rust_sdk/base/input_note.rs @@ -0,0 +1,154 @@ +use super::*; + +#[allow(clippy::uninlined_format_args)] +fn run_input_note_binding_test(name: &str, method: &str) { + let lib_rs = format!( + r"#![no_std] + +use miden::*; + +#[component] +struct TestInputNote; + +#[component] +impl TestInputNote {{ + {method} +}} +", + method = method + ); + + let sdk_path = sdk_crate_path(); + let component_package = format!("miden:{}", name.replace('_', "-")); + let cargo_toml = format!( + r#" +[package] +name = "{name}" +version = "0.0.1" +edition = "2021" +authors = [] + +[lib] +crate-type = ["cdylib"] + +[dependencies] +miden = {{ path = "{sdk_path}" }} + +[package.metadata.component] +package = "{component_package}" + +[package.metadata.miden] +project-kind = "account" +supported-types = ["RegularAccountUpdatableCode"] + +[profile.release] +opt-level = "z" +panic = "abort" +debug = false +"#, + name = name, + sdk_path = sdk_path.display(), + component_package = component_package, + ); + + let cargo_proj = project(name) + .file("Cargo.toml", &cargo_toml) + .file("src/lib.rs", &lib_rs) + .build(); + + let mut test = CompilerTestBuilder::rust_source_cargo_miden( + cargo_proj.root(), + WasmTranslationConfig::default(), + [], + ) + .build(); + + test.expect_wasm(expect_file![format!("../../../../expected/rust_sdk/{name}.wat")]); + test.expect_ir(expect_file![format!("../../../../expected/rust_sdk/{name}.hir")]); + test.expect_masm(expect_file![format!("../../../../expected/rust_sdk/{name}.masm")]); + + test.compiled_package(); +} + +#[test] +fn rust_sdk_input_note_get_assets_info_binding() { + run_input_note_binding_test( + "rust_sdk_input_note_get_assets_info_binding", + "pub fn binding(&self) -> Felt { + let info = input_note::get_assets_info(NoteIdx { inner: Felt::from_u32(0) }); + info.num_assets + }", + ); +} + +#[test] +fn rust_sdk_input_note_get_assets_binding() { + run_input_note_binding_test( + "rust_sdk_input_note_get_assets_binding", + "pub fn binding(&self) -> Felt { + let assets = input_note::get_assets(NoteIdx { inner: Felt::from_u32(0) }); + Felt::from_u32(assets.len() as u32) + }", + ); +} + +#[test] +fn rust_sdk_input_note_get_recipient_binding() { + run_input_note_binding_test( + "rust_sdk_input_note_get_recipient_binding", + "pub fn binding(&self) -> Recipient { + input_note::get_recipient(NoteIdx { inner: Felt::from_u32(0) }) + }", + ); +} + +#[test] +fn rust_sdk_input_note_get_metadata_binding() { + run_input_note_binding_test( + "rust_sdk_input_note_get_metadata_binding", + "pub fn binding(&self) -> Word { + input_note::get_metadata(NoteIdx { inner: Felt::from_u32(0) }) + }", + ); +} + +#[test] +fn rust_sdk_input_note_get_sender_binding() { + run_input_note_binding_test( + "rust_sdk_input_note_get_sender_binding", + "pub fn binding(&self) -> AccountId { + input_note::get_sender(NoteIdx { inner: Felt::from_u32(0) }) + }", + ); +} + +#[test] +fn rust_sdk_input_note_get_inputs_info_binding() { + run_input_note_binding_test( + "rust_sdk_input_note_get_inputs_info_binding", + "pub fn binding(&self) -> Felt { + let info = input_note::get_inputs_info(NoteIdx { inner: Felt::from_u32(0) }); + info.num_inputs + }", + ); +} + +#[test] +fn rust_sdk_input_note_get_script_root_binding() { + run_input_note_binding_test( + "rust_sdk_input_note_get_script_root_binding", + "pub fn binding(&self) -> Word { + input_note::get_script_root(NoteIdx { inner: Felt::from_u32(0) }) + }", + ); +} + +#[test] +fn rust_sdk_input_note_get_serial_number_binding() { + run_input_note_binding_test( + "rust_sdk_input_note_get_serial_number_binding", + "pub fn binding(&self) -> Word { + input_note::get_serial_number(NoteIdx { inner: Felt::from_u32(0) }) + }", + ); +} diff --git a/tests/integration/src/rust_masm_tests/rust_sdk/base/mod.rs b/tests/integration/src/rust_masm_tests/rust_sdk/base/mod.rs new file mode 100644 index 000000000..cd1d1b3a6 --- /dev/null +++ b/tests/integration/src/rust_masm_tests/rust_sdk/base/mod.rs @@ -0,0 +1,9 @@ +use super::*; + +pub mod account; +pub mod asset; +pub mod faucet; +pub mod input_note; +pub mod note; +pub mod output_note; +pub mod tx; diff --git a/tests/integration/src/rust_masm_tests/rust_sdk/base/note.rs b/tests/integration/src/rust_masm_tests/rust_sdk/base/note.rs new file mode 100644 index 000000000..7a7a95e11 --- /dev/null +++ b/tests/integration/src/rust_masm_tests/rust_sdk/base/note.rs @@ -0,0 +1,78 @@ +use super::*; + +#[allow(clippy::uninlined_format_args)] +fn run_note_binding_test(name: &str, body: &str) { + let lib_rs = format!( + r"#![no_std] + +use miden::*; + +#[note_script] +fn run(_arg: Word) {{ + {body} +}} +", + body = body + ); + + let sdk_path = sdk_crate_path(); + let sdk_alloc_path = sdk_alloc_crate_path(); + let component_package = format!("miden:{}", name.replace('_', "-")); + let cargo_toml = format!( + r#" +[package] +name = "{name}" +version = "0.0.1" +edition = "2021" +authors = [] + +[lib] +crate-type = ["cdylib"] + +[dependencies] +miden-sdk-alloc = {{ path = "{sdk_alloc_path}" }} +miden = {{ path = "{sdk_path}" }} + +[package.metadata.component] +package = "{component_package}" + +[package.metadata.miden] +project-kind = "note-script" + +[profile.release] +opt-level = "z" +panic = "abort" +debug = false +"#, + name = name, + sdk_path = sdk_path.display(), + sdk_alloc_path = sdk_alloc_path.display(), + component_package = component_package, + ); + + let cargo_proj = project(name) + .file("Cargo.toml", &cargo_toml) + .file("src/lib.rs", &lib_rs) + .build(); + + let mut test = CompilerTestBuilder::rust_source_cargo_miden( + cargo_proj.root(), + WasmTranslationConfig::default(), + [], + ) + .build(); + + test.expect_wasm(expect_file![format!("../../../../expected/rust_sdk/{name}.wat")]); + test.expect_ir(expect_file![format!("../../../../expected/rust_sdk/{name}.hir")]); + test.expect_masm(expect_file![format!("../../../../expected/rust_sdk/{name}.masm")]); + + test.compiled_package(); +} + +#[test] +fn rust_sdk_note_add_assets_to_account_binding() { + run_note_binding_test( + "rust_sdk_note_add_assets_to_account_binding", + "active_note::add_assets_to_account();", + ); +} diff --git a/tests/integration/src/rust_masm_tests/rust_sdk/base/output_note.rs b/tests/integration/src/rust_masm_tests/rust_sdk/base/output_note.rs new file mode 100644 index 000000000..b0c77533b --- /dev/null +++ b/tests/integration/src/rust_masm_tests/rust_sdk/base/output_note.rs @@ -0,0 +1,139 @@ +use super::*; + +#[allow(clippy::uninlined_format_args)] +fn run_output_note_binding_test(name: &str, method: &str) { + let lib_rs = format!( + r"#![no_std] + +use miden::*; + +#[component] +struct TestOutputNote; + +#[component] +impl TestOutputNote {{ + {method} +}} +", + method = method + ); + + let sdk_path = sdk_crate_path(); + let component_package = format!("miden:{}", name.replace('_', "-")); + let cargo_toml = format!( + r#" +[package] +name = "{name}" +version = "0.0.1" +edition = "2021" +authors = [] + +[lib] +crate-type = ["cdylib"] + +[dependencies] +miden = {{ path = "{sdk_path}" }} + +[package.metadata.component] +package = "{component_package}" + +[package.metadata.miden] +project-kind = "account" +supported-types = ["RegularAccountUpdatableCode"] + +[profile.release] +opt-level = "z" +panic = "abort" +debug = false +"#, + name = name, + sdk_path = sdk_path.display(), + component_package = component_package, + ); + + let cargo_proj = project(name) + .file("Cargo.toml", &cargo_toml) + .file("src/lib.rs", &lib_rs) + .build(); + + let mut test = CompilerTestBuilder::rust_source_cargo_miden( + cargo_proj.root(), + WasmTranslationConfig::default(), + [], + ) + .build(); + + test.expect_wasm(expect_file![format!("../../../../expected/rust_sdk/{name}.wat")]); + test.expect_ir(expect_file![format!("../../../../expected/rust_sdk/{name}.hir")]); + test.expect_masm(expect_file![format!("../../../../expected/rust_sdk/{name}.masm")]); + + test.compiled_package(); +} + +#[test] +fn rust_sdk_output_note_get_assets_info_binding() { + run_output_note_binding_test( + "rust_sdk_output_note_get_assets_info_binding", + "pub fn binding(&self) -> Felt { + let info = output_note::get_assets_info(NoteIdx { inner: Felt::from_u32(0) }); + info.num_assets + }", + ); +} + +#[test] +fn rust_sdk_output_note_get_assets_binding() { + run_output_note_binding_test( + "rust_sdk_output_note_get_assets_binding", + "pub fn binding(&self) -> Felt { + let assets = output_note::get_assets(NoteIdx { inner: Felt::from_u32(0) }); + Felt::from_u32(assets.len() as u32) + }", + ); +} + +#[test] +fn rust_sdk_output_note_get_recipient_binding() { + run_output_note_binding_test( + "rust_sdk_output_note_get_recipient_binding", + "pub fn binding(&self) -> Recipient { + output_note::get_recipient(NoteIdx { inner: Felt::from_u32(0) }) + }", + ); +} + +#[test] +fn rust_sdk_output_note_get_metadata_binding() { + run_output_note_binding_test( + "rust_sdk_output_note_get_metadata_binding", + "pub fn binding(&self) -> Word { + output_note::get_metadata(NoteIdx { inner: Felt::from_u32(0) }) + }", + ); +} + +#[test] +fn rust_sdk_output_note_create_binding() { + run_output_note_binding_test( + "rust_sdk_output_note_create_binding", + "pub fn binding(&self) -> NoteIdx { + let recipient = Recipient::from([Felt::from_u32(0); 4]); + let tag = Tag { inner: Felt::from_u32(0) }; + let note_type = NoteType { inner: Felt::from_u32(0) }; + output_note::create(tag, Felt::from_u32(0), note_type, Felt::from_u32(0), recipient) + }", + ); +} + +#[test] +fn rust_sdk_output_note_add_asset_binding() { + run_output_note_binding_test( + "rust_sdk_output_note_add_asset_binding", + "pub fn binding(&self) -> Felt { + let asset = Asset::from([Felt::from_u32(0); 4]); + let idx = NoteIdx { inner: Felt::from_u32(0) }; + output_note::add_asset(asset, idx); + Felt::from_u32(0) + }", + ); +} diff --git a/tests/integration/src/rust_masm_tests/rust_sdk/base/tx.rs b/tests/integration/src/rust_masm_tests/rust_sdk/base/tx.rs new file mode 100644 index 000000000..326ad3726 --- /dev/null +++ b/tests/integration/src/rust_masm_tests/rust_sdk/base/tx.rs @@ -0,0 +1,142 @@ +use super::*; + +#[allow(clippy::uninlined_format_args)] +fn run_tx_binding_test(name: &str, body: &str) { + let lib_rs = format!( + r"#![no_std] + +use miden::*; + +#[tx_script] +fn run(_arg: Word) {{ + {body} +}} +", + body = body + ); + + let sdk_path = sdk_crate_path(); + let sdk_alloc_path = sdk_alloc_crate_path(); + let component_package = format!("miden:{}", name.replace('_', "-")); + let cargo_toml = format!( + r#" +[package] +name = "{name}" +version = "0.0.1" +edition = "2021" +authors = [] + +[lib] +crate-type = ["cdylib"] + +[dependencies] +miden-sdk-alloc = {{ path = "{sdk_alloc_path}" }} +miden = {{ path = "{sdk_path}" }} + +[package.metadata.component] +package = "{component_package}" + +[package.metadata.miden] +project-kind = "transaction-script" + +[profile.release] +opt-level = "z" +panic = "abort" +debug = false +"#, + name = name, + sdk_path = sdk_path.display(), + sdk_alloc_path = sdk_alloc_path.display(), + component_package = component_package, + ); + + let cargo_proj = project(name) + .file("Cargo.toml", &cargo_toml) + .file("src/lib.rs", &lib_rs) + .build(); + + let mut test = CompilerTestBuilder::rust_source_cargo_miden( + cargo_proj.root(), + WasmTranslationConfig::default(), + [], + ) + .build(); + + test.expect_wasm(expect_file![format!("../../../../expected/rust_sdk/{name}.wat")]); + test.expect_ir(expect_file![format!("../../../../expected/rust_sdk/{name}.hir")]); + test.expect_masm(expect_file![format!("../../../../expected/rust_sdk/{name}.masm")]); + + test.compiled_package(); +} + +#[test] +fn rust_sdk_account_tx_get_block_commitment_binding() { + run_tx_binding_test( + "rust_sdk_account_tx_get_block_commitment_binding", + "let commitment = tx::get_block_commitment();\n let _ = commitment;", + ); +} + +#[test] +fn rust_sdk_account_tx_get_block_number_binding() { + run_tx_binding_test( + "rust_sdk_account_tx_get_block_number_binding", + "let _ = tx::get_block_number();", + ); +} + +#[test] +fn rust_sdk_account_tx_get_block_timestamp_binding() { + run_tx_binding_test( + "rust_sdk_account_tx_get_block_timestamp_binding", + "let _ = tx::get_block_timestamp();", + ); +} + +#[test] +fn rust_sdk_account_tx_get_num_input_notes_binding() { + run_tx_binding_test( + "rust_sdk_account_tx_get_num_input_notes_binding", + "let _ = tx::get_num_input_notes();", + ); +} + +#[test] +fn rust_sdk_account_tx_get_num_output_notes_binding() { + run_tx_binding_test( + "rust_sdk_account_tx_get_num_output_notes_binding", + "let _ = tx::get_num_output_notes();", + ); +} + +#[test] +fn rust_sdk_account_tx_get_expiration_block_delta_binding() { + run_tx_binding_test( + "rust_sdk_account_tx_get_expiration_block_delta_binding", + "let _ = tx::get_expiration_block_delta();", + ); +} + +#[test] +fn rust_sdk_account_tx_update_expiration_block_delta_binding() { + run_tx_binding_test( + "rust_sdk_account_tx_update_expiration_block_delta_binding", + "tx::update_expiration_block_delta(Felt::from_u32(42));", + ); +} + +#[test] +fn rust_sdk_account_tx_get_input_notes_commitment_binding() { + run_tx_binding_test( + "rust_sdk_account_tx_get_input_notes_commitment_binding", + "let commitment = tx::get_input_notes_commitment();\n let _ = commitment;", + ); +} + +#[test] +fn rust_sdk_account_tx_get_output_notes_commitment_binding() { + run_tx_binding_test( + "rust_sdk_account_tx_get_output_notes_commitment_binding", + "let commitment = tx::get_output_notes_commitment();\n let _ = commitment;", + ); +} diff --git a/tests/integration/src/rust_masm_tests/rust_sdk/mod.rs b/tests/integration/src/rust_masm_tests/rust_sdk/mod.rs index 9bfccffb2..0d79a4acf 100644 --- a/tests/integration/src/rust_masm_tests/rust_sdk/mod.rs +++ b/tests/integration/src/rust_masm_tests/rust_sdk/mod.rs @@ -19,6 +19,7 @@ use crate::{ CompilerTest, CompilerTestBuilder, }; +mod base; mod macros; fn executor_with_std(args: Vec) -> Executor { From bf40530eacf98817ec7b1d79c7723656e0fe96c2 Mon Sep 17 00:00:00 2001 From: Denys Zadorozhnyi Date: Wed, 12 Nov 2025 09:35:18 +0200 Subject: [PATCH 14/19] refactor!: split `account` into `active_account` and `native_account` in the SDK --- examples/auth-component-no-auth/src/lib.rs | 8 +- .../auth-component-rpo-falcon512/src/lib.rs | 6 +- examples/basic-wallet/src/lib.rs | 6 +- examples/p2id-note/src/lib.rs | 2 +- frontend/wasm/src/miden_abi/transform.rs | 53 ++-- frontend/wasm/src/miden_abi/tx_kernel.rs | 11 +- .../{account.rs => active_account.rs} | 53 +--- .../src/miden_abi/tx_kernel/native_account.rs | 63 ++++ frontend/wasm/src/module/linker_stubs.rs | 2 +- sdk/base-sys/src/bindings/account.rs | 278 ------------------ sdk/base-sys/src/bindings/active_account.rs | 189 ++++++++++++ sdk/base-sys/src/bindings/mod.rs | 3 +- sdk/base-sys/src/bindings/native_account.rs | 108 +++++++ sdk/base-sys/stubs/account.rs | 182 ------------ sdk/base-sys/stubs/active_account.rs | 120 ++++++++ sdk/base-sys/stubs/lib.rs | 3 +- sdk/base-sys/stubs/native_account.rs | 71 +++++ .../abi_transform_tx_kernel_get_id.hir | 4 +- .../abi_transform_tx_kernel_get_id.wat | 4 +- .../examples/auth_component_rpo_falcon512.hir | 82 +++--- .../auth_component_rpo_falcon512.masm | 30 +- .../examples/auth_component_rpo_falcon512.wat | 6 +- .../expected/examples/basic_wallet.hir | 86 +++--- .../expected/examples/basic_wallet.masm | 26 +- .../expected/examples/basic_wallet.wat | 14 +- tests/integration/expected/examples/p2id.hir | 4 +- tests/integration/expected/examples/p2id.masm | 6 +- tests/integration/expected/examples/p2id.wat | 4 +- .../rust_sdk/rust_sdk_swapp_note_bindings.hir | 4 +- .../rust_sdk_swapp_note_bindings.masm | 4 +- .../rust_sdk/rust_sdk_swapp_note_bindings.wat | 4 +- .../abi_transform/tx_kernel.rs | 2 +- .../rust_masm_tests/rust_sdk/base/account.rs | 26 +- .../src/rust_masm_tests/rust_sdk/mod.rs | 2 +- .../rust-sdk/account-test/src/lib.rs | 6 +- 35 files changed, 764 insertions(+), 708 deletions(-) rename frontend/wasm/src/miden_abi/tx_kernel/{account.rs => active_account.rs} (67%) create mode 100644 frontend/wasm/src/miden_abi/tx_kernel/native_account.rs delete mode 100644 sdk/base-sys/src/bindings/account.rs create mode 100644 sdk/base-sys/src/bindings/active_account.rs create mode 100644 sdk/base-sys/src/bindings/native_account.rs delete mode 100644 sdk/base-sys/stubs/account.rs create mode 100644 sdk/base-sys/stubs/active_account.rs create mode 100644 sdk/base-sys/stubs/native_account.rs diff --git a/examples/auth-component-no-auth/src/lib.rs b/examples/auth-component-no-auth/src/lib.rs index 74b12b19d..ccfb6b3ad 100644 --- a/examples/auth-component-no-auth/src/lib.rs +++ b/examples/auth-component-no-auth/src/lib.rs @@ -22,7 +22,7 @@ fn my_panic(_info: &core::panic::PanicInfo) -> ! { miden::generate!(); bindings::export!(AuthComponent); -use miden::{account, *}; +use miden::{active_account, native_account, *}; use crate::bindings::exports::miden::base::authentication_component::Guest; @@ -32,12 +32,12 @@ impl Guest for AuthComponent { fn auth_procedure(_arg: Word) { // translated from MASM at // https://github.com/0xMiden/miden-base/blob/e4912663276ab8eebb24b84d318417cb4ea0bba3/crates/miden-lib/asm/account_components/no_auth.masm?plain=1 - let init_comm = account::get_initial_commitment(); - let curr_comm = account::compute_commitment(); + let init_comm = active_account::get_initial_commitment(); + let curr_comm = active_account::compute_commitment(); // check if the account state has changed by comparing initial and final commitments if curr_comm != init_comm { // if the account has been updated, increment the nonce - account::incr_nonce(); + native_account::incr_nonce(); } } } diff --git a/examples/auth-component-rpo-falcon512/src/lib.rs b/examples/auth-component-rpo-falcon512/src/lib.rs index fc97ee6df..0f46e69b0 100644 --- a/examples/auth-component-rpo-falcon512/src/lib.rs +++ b/examples/auth-component-rpo-falcon512/src/lib.rs @@ -3,7 +3,7 @@ extern crate alloc; use miden::{ - account, component, felt, hash_words, intrinsics::advice::adv_insert, tx, Felt, Value, + component, felt, hash_words, intrinsics::advice::adv_insert, native_account, tx, Felt, Value, ValueAccess, Word, }; @@ -30,10 +30,10 @@ struct AuthComponent { impl Guest for AuthComponent { fn auth_procedure(_arg: Word) { let ref_block_num = tx::get_block_number(); - let final_nonce = account::incr_nonce(); + let final_nonce = native_account::incr_nonce(); // Gather tx summary parts - let acct_delta_commit = account::compute_delta_commitment(); + let acct_delta_commit = native_account::compute_delta_commitment(); let input_notes_commit = tx::get_input_notes_commitment(); let output_notes_commit = tx::get_output_notes_commitment(); diff --git a/examples/basic-wallet/src/lib.rs b/examples/basic-wallet/src/lib.rs index df4410e17..02de8de33 100644 --- a/examples/basic-wallet/src/lib.rs +++ b/examples/basic-wallet/src/lib.rs @@ -6,7 +6,7 @@ // // extern crate alloc; -use miden::{account, component, output_note, Asset, NoteIdx}; +use miden::{component, native_account, output_note, Asset, NoteIdx}; #[component] struct MyAccount; @@ -20,7 +20,7 @@ impl MyAccount { /// # Arguments /// * `asset` - The asset to be added to the account pub fn receive_asset(&self, asset: Asset) { - account::add_asset(asset); + native_account::add_asset(asset); } /// Moves an asset from the account to a note. @@ -32,7 +32,7 @@ impl MyAccount { /// * `asset` - The asset to move from the account to the note /// * `note_idx` - The index of the note to receive the asset pub fn move_asset_to_note(&self, asset: Asset, note_idx: NoteIdx) { - let asset = account::remove_asset(asset); + let asset = native_account::remove_asset(asset); output_note::add_asset(asset, note_idx); } } diff --git a/examples/p2id-note/src/lib.rs b/examples/p2id-note/src/lib.rs index a05e577bb..dcf57ef77 100644 --- a/examples/p2id-note/src/lib.rs +++ b/examples/p2id-note/src/lib.rs @@ -18,7 +18,7 @@ fn run(_arg: Word) { let target_account_id_suffix = inputs[1]; let target_account = AccountId::from(target_account_id_prefix, target_account_id_suffix); - let current_account = account::get_id(); + let current_account = active_account::get_id(); assert_eq!(current_account, target_account); let assets = active_note::get_assets(); diff --git a/frontend/wasm/src/miden_abi/transform.rs b/frontend/wasm/src/miden_abi/transform.rs index ae21436ce..f308d12b8 100644 --- a/frontend/wasm/src/miden_abi/transform.rs +++ b/frontend/wasm/src/miden_abi/transform.rs @@ -73,14 +73,15 @@ fn get_transform_strategy(path: &SymbolPath) -> Option { symbols::Miden => match components.next()?.as_symbol_name() { symbols::NativeAccount => { match components.next_if(|c| c.is_leaf())?.as_symbol_name().as_str() { - tx_kernel::account::ADD_ASSET - | tx_kernel::account::REMOVE_ASSET - | tx_kernel::account::COMPUTE_DELTA_COMMITMENT - | tx_kernel::account::SET_STORAGE_ITEM - | tx_kernel::account::SET_STORAGE_MAP_ITEM => { + tx_kernel::native_account::ADD_ASSET + | tx_kernel::native_account::REMOVE_ASSET + | tx_kernel::native_account::COMPUTE_DELTA_COMMITMENT + | tx_kernel::native_account::SET_STORAGE_ITEM + | tx_kernel::native_account::SET_STORAGE_MAP_ITEM => { Some(TransformStrategy::ReturnViaPointer) } - tx_kernel::account::INCR_NONCE | tx_kernel::account::WAS_PROCEDURE_CALLED => { + tx_kernel::native_account::INCR_NONCE + | tx_kernel::native_account::WAS_PROCEDURE_CALLED => { Some(TransformStrategy::NoTransform) } _ => None, @@ -88,25 +89,27 @@ fn get_transform_strategy(path: &SymbolPath) -> Option { } symbols::ActiveAccount => { match components.next_if(|c| c.is_leaf())?.as_symbol_name().as_str() { - tx_kernel::account::GET_NONCE - | tx_kernel::account::GET_BALANCE - | tx_kernel::account::GET_INITIAL_BALANCE - | tx_kernel::account::GET_NUM_PROCEDURES - | tx_kernel::account::HAS_NON_FUNGIBLE_ASSET - | tx_kernel::account::HAS_PROCEDURE => Some(TransformStrategy::NoTransform), - tx_kernel::account::GET_ID - | tx_kernel::account::GET_INITIAL_COMMITMENT - | tx_kernel::account::GET_CODE_COMMITMENT - | tx_kernel::account::COMPUTE_COMMITMENT - | tx_kernel::account::GET_INITIAL_STORAGE_COMMITMENT - | tx_kernel::account::COMPUTE_STORAGE_COMMITMENT - | tx_kernel::account::GET_STORAGE_ITEM - | tx_kernel::account::GET_INITIAL_STORAGE_ITEM - | tx_kernel::account::GET_STORAGE_MAP_ITEM - | tx_kernel::account::GET_INITIAL_STORAGE_MAP_ITEM - | tx_kernel::account::GET_INITIAL_VAULT_ROOT - | tx_kernel::account::GET_VAULT_ROOT - | tx_kernel::account::GET_PROCEDURE_ROOT => { + tx_kernel::active_account::GET_NONCE + | tx_kernel::active_account::GET_BALANCE + | tx_kernel::active_account::GET_INITIAL_BALANCE + | tx_kernel::active_account::GET_NUM_PROCEDURES + | tx_kernel::active_account::HAS_NON_FUNGIBLE_ASSET + | tx_kernel::active_account::HAS_PROCEDURE => { + Some(TransformStrategy::NoTransform) + } + tx_kernel::active_account::GET_ID + | tx_kernel::active_account::GET_INITIAL_COMMITMENT + | tx_kernel::active_account::GET_CODE_COMMITMENT + | tx_kernel::active_account::COMPUTE_COMMITMENT + | tx_kernel::active_account::GET_INITIAL_STORAGE_COMMITMENT + | tx_kernel::active_account::COMPUTE_STORAGE_COMMITMENT + | tx_kernel::active_account::GET_STORAGE_ITEM + | tx_kernel::active_account::GET_INITIAL_STORAGE_ITEM + | tx_kernel::active_account::GET_STORAGE_MAP_ITEM + | tx_kernel::active_account::GET_INITIAL_STORAGE_MAP_ITEM + | tx_kernel::active_account::GET_INITIAL_VAULT_ROOT + | tx_kernel::active_account::GET_VAULT_ROOT + | tx_kernel::active_account::GET_PROCEDURE_ROOT => { Some(TransformStrategy::ReturnViaPointer) } _ => None, diff --git a/frontend/wasm/src/miden_abi/tx_kernel.rs b/frontend/wasm/src/miden_abi/tx_kernel.rs index 908b2a2db..d09325b57 100644 --- a/frontend/wasm/src/miden_abi/tx_kernel.rs +++ b/frontend/wasm/src/miden_abi/tx_kernel.rs @@ -1,10 +1,11 @@ //! Function types and lowering for tx kernel API functions -pub(crate) mod account; +pub(crate) mod active_account; pub(crate) mod active_note; pub(crate) mod asset; pub(crate) mod faucet; pub(crate) mod input_note; +pub(crate) mod native_account; pub(crate) mod output_note; pub(crate) mod tx; @@ -12,13 +13,19 @@ use midenc_hir_symbol::sync::LazyLock; use super::ModuleFunctionTypeMap; +#[allow(unused_imports)] +pub(crate) mod account { + pub use super::{active_account::*, native_account::*}; +} + pub(crate) fn signatures() -> &'static ModuleFunctionTypeMap { static TYPES: LazyLock = LazyLock::new(|| { let mut m: ModuleFunctionTypeMap = Default::default(); - m.extend(account::signatures()); + m.extend(active_account::signatures()); m.extend(active_note::signatures()); m.extend(asset::signatures()); m.extend(faucet::signatures()); + m.extend(native_account::signatures()); m.extend(input_note::signatures()); m.extend(output_note::signatures()); m.extend(tx::signatures()); diff --git a/frontend/wasm/src/miden_abi/tx_kernel/account.rs b/frontend/wasm/src/miden_abi/tx_kernel/active_account.rs similarity index 67% rename from frontend/wasm/src/miden_abi/tx_kernel/account.rs rename to frontend/wasm/src/miden_abi/tx_kernel/active_account.rs index 84dd2e365..debbc2f02 100644 --- a/frontend/wasm/src/miden_abi/tx_kernel/account.rs +++ b/frontend/wasm/src/miden_abi/tx_kernel/active_account.rs @@ -6,35 +6,23 @@ use midenc_hir::{ use crate::miden_abi::{FunctionTypeMap, ModuleFunctionTypeMap}; -pub(crate) const NATIVE_MODULE_PREFIX: &[SymbolNameComponent] = &[ - SymbolNameComponent::Root, - SymbolNameComponent::Component(symbols::Miden), - SymbolNameComponent::Component(symbols::NativeAccount), -]; - -pub(crate) const ACTIVE_MODULE_PREFIX: &[SymbolNameComponent] = &[ +pub(crate) const MODULE_PREFIX: &[SymbolNameComponent] = &[ SymbolNameComponent::Root, SymbolNameComponent::Component(symbols::Miden), SymbolNameComponent::Component(symbols::ActiveAccount), ]; -pub const ADD_ASSET: &str = "add_asset"; -pub const REMOVE_ASSET: &str = "remove_asset"; pub const GET_ID: &str = "get_id"; pub const GET_NONCE: &str = "get_nonce"; pub const GET_INITIAL_COMMITMENT: &str = "get_initial_commitment"; pub const GET_CODE_COMMITMENT: &str = "get_code_commitment"; pub const COMPUTE_COMMITMENT: &str = "compute_commitment"; -pub const COMPUTE_DELTA_COMMITMENT: &str = "compute_delta_commitment"; pub const GET_INITIAL_STORAGE_COMMITMENT: &str = "get_initial_storage_commitment"; pub const COMPUTE_STORAGE_COMMITMENT: &str = "compute_storage_commitment"; pub const GET_STORAGE_ITEM: &str = "get_item"; pub const GET_INITIAL_STORAGE_ITEM: &str = "get_initial_item"; -pub const SET_STORAGE_ITEM: &str = "set_item"; pub const GET_STORAGE_MAP_ITEM: &str = "get_map_item"; pub const GET_INITIAL_STORAGE_MAP_ITEM: &str = "get_initial_map_item"; -pub const SET_STORAGE_MAP_ITEM: &str = "set_map_item"; -pub const INCR_NONCE: &str = "incr_nonce"; pub const GET_BALANCE: &str = "get_balance"; pub const GET_INITIAL_BALANCE: &str = "get_initial_balance"; pub const HAS_NON_FUNGIBLE_ASSET: &str = "has_non_fungible_asset"; @@ -43,47 +31,10 @@ pub const GET_VAULT_ROOT: &str = "get_vault_root"; pub const GET_NUM_PROCEDURES: &str = "get_num_procedures"; pub const GET_PROCEDURE_ROOT: &str = "get_procedure_root"; pub const HAS_PROCEDURE: &str = "has_procedure"; -pub const WAS_PROCEDURE_CALLED: &str = "was_procedure_called"; pub(crate) fn signatures() -> ModuleFunctionTypeMap { let mut m: ModuleFunctionTypeMap = Default::default(); - let mut native_account: FunctionTypeMap = Default::default(); - native_account.insert( - Symbol::from(ADD_ASSET), - FunctionType::new(CallConv::Wasm, [Felt, Felt, Felt, Felt], [Felt, Felt, Felt, Felt]), - ); - native_account.insert( - Symbol::from(REMOVE_ASSET), - FunctionType::new(CallConv::Wasm, [Felt, Felt, Felt, Felt], [Felt, Felt, Felt, Felt]), - ); - native_account.insert( - Symbol::from(COMPUTE_DELTA_COMMITMENT), - FunctionType::new(CallConv::Wasm, [], [Felt, Felt, Felt, Felt]), - ); - native_account.insert( - Symbol::from(SET_STORAGE_ITEM), - FunctionType::new( - CallConv::Wasm, - [Felt, Felt, Felt, Felt, Felt], - [Felt, Felt, Felt, Felt, Felt, Felt, Felt, Felt], - ), - ); - native_account.insert( - Symbol::from(SET_STORAGE_MAP_ITEM), - FunctionType::new( - CallConv::Wasm, - [Felt, Felt, Felt, Felt, Felt, Felt, Felt, Felt, Felt], - [Felt, Felt, Felt, Felt, Felt, Felt, Felt, Felt], - ), - ); - native_account.insert(Symbol::from(INCR_NONCE), FunctionType::new(CallConv::Wasm, [], [Felt])); - native_account.insert( - Symbol::from(WAS_PROCEDURE_CALLED), - FunctionType::new(CallConv::Wasm, [Felt, Felt, Felt, Felt], [Felt]), - ); - m.insert(SymbolPath::from_iter(NATIVE_MODULE_PREFIX.iter().copied()), native_account); - let mut active_account: FunctionTypeMap = Default::default(); active_account .insert(Symbol::from(GET_ID), FunctionType::new(CallConv::Wasm, [], [Felt, Felt])); @@ -154,7 +105,7 @@ pub(crate) fn signatures() -> ModuleFunctionTypeMap { Symbol::from(HAS_PROCEDURE), FunctionType::new(CallConv::Wasm, [Felt, Felt, Felt, Felt], [Felt]), ); - m.insert(SymbolPath::from_iter(ACTIVE_MODULE_PREFIX.iter().copied()), active_account); + m.insert(SymbolPath::from_iter(MODULE_PREFIX.iter().copied()), active_account); m } diff --git a/frontend/wasm/src/miden_abi/tx_kernel/native_account.rs b/frontend/wasm/src/miden_abi/tx_kernel/native_account.rs new file mode 100644 index 000000000..b4ed8b985 --- /dev/null +++ b/frontend/wasm/src/miden_abi/tx_kernel/native_account.rs @@ -0,0 +1,63 @@ +use midenc_hir::{ + interner::{symbols, Symbol}, + CallConv, FunctionType, SymbolNameComponent, SymbolPath, + Type::*, +}; + +use crate::miden_abi::{FunctionTypeMap, ModuleFunctionTypeMap}; + +pub(crate) const MODULE_PREFIX: &[SymbolNameComponent] = &[ + SymbolNameComponent::Root, + SymbolNameComponent::Component(symbols::Miden), + SymbolNameComponent::Component(symbols::NativeAccount), +]; + +pub const ADD_ASSET: &str = "add_asset"; +pub const REMOVE_ASSET: &str = "remove_asset"; +pub const COMPUTE_DELTA_COMMITMENT: &str = "compute_delta_commitment"; +pub const SET_STORAGE_ITEM: &str = "set_item"; +pub const SET_STORAGE_MAP_ITEM: &str = "set_map_item"; +pub const INCR_NONCE: &str = "incr_nonce"; +pub const WAS_PROCEDURE_CALLED: &str = "was_procedure_called"; + +pub(crate) fn signatures() -> ModuleFunctionTypeMap { + let mut m: ModuleFunctionTypeMap = Default::default(); + + let mut native_account: FunctionTypeMap = Default::default(); + native_account.insert( + Symbol::from(ADD_ASSET), + FunctionType::new(CallConv::Wasm, [Felt, Felt, Felt, Felt], [Felt, Felt, Felt, Felt]), + ); + native_account.insert( + Symbol::from(REMOVE_ASSET), + FunctionType::new(CallConv::Wasm, [Felt, Felt, Felt, Felt], [Felt, Felt, Felt, Felt]), + ); + native_account.insert( + Symbol::from(COMPUTE_DELTA_COMMITMENT), + FunctionType::new(CallConv::Wasm, [], [Felt, Felt, Felt, Felt]), + ); + native_account.insert( + Symbol::from(SET_STORAGE_ITEM), + FunctionType::new( + CallConv::Wasm, + [Felt, Felt, Felt, Felt, Felt], + [Felt, Felt, Felt, Felt, Felt, Felt, Felt, Felt], + ), + ); + native_account.insert( + Symbol::from(SET_STORAGE_MAP_ITEM), + FunctionType::new( + CallConv::Wasm, + [Felt, Felt, Felt, Felt, Felt, Felt, Felt, Felt, Felt], + [Felt, Felt, Felt, Felt, Felt, Felt, Felt, Felt], + ), + ); + native_account.insert(Symbol::from(INCR_NONCE), FunctionType::new(CallConv::Wasm, [], [Felt])); + native_account.insert( + Symbol::from(WAS_PROCEDURE_CALLED), + FunctionType::new(CallConv::Wasm, [Felt, Felt, Felt, Felt], [Felt]), + ); + m.insert(SymbolPath::from_iter(MODULE_PREFIX.iter().copied()), native_account); + + m +} diff --git a/frontend/wasm/src/module/linker_stubs.rs b/frontend/wasm/src/module/linker_stubs.rs index b42cda743..483f13d48 100644 --- a/frontend/wasm/src/module/linker_stubs.rs +++ b/frontend/wasm/src/module/linker_stubs.rs @@ -2,7 +2,7 @@ //! A linker stub is detected as a function whose body consists solely of a //! single `unreachable` instruction (plus the implicit `end`). The stub //! function name is expected to be a fully-qualified MASM function path like -//! `miden::account::add_asset` and is used to locate the MASM callee. +//! `miden::native_account::add_asset` and is used to locate the MASM callee. use core::str::FromStr; use std::cell::RefCell; diff --git a/sdk/base-sys/src/bindings/account.rs b/sdk/base-sys/src/bindings/account.rs deleted file mode 100644 index a796e70d2..000000000 --- a/sdk/base-sys/src/bindings/account.rs +++ /dev/null @@ -1,278 +0,0 @@ -use miden_stdlib_sys::{Felt, Word}; - -use super::types::{AccountId, Asset}; - -#[allow(improper_ctypes)] -extern "C" { - #[link_name = "miden::active_account::get_id"] - pub fn extern_account_get_id(ptr: *mut AccountId); - #[link_name = "miden::native_account::remove_asset"] - pub fn extern_account_remove_asset(_: Felt, _: Felt, _: Felt, _: Felt, ptr: *mut Asset); - #[link_name = "miden::active_account::get_nonce"] - pub fn extern_account_get_nonce() -> Felt; - #[link_name = "miden::native_account::incr_nonce"] - pub fn extern_account_incr_nonce() -> Felt; - #[link_name = "miden::active_account::get_initial_commitment"] - pub fn extern_account_get_initial_commitment(ptr: *mut Word); - #[link_name = "miden::active_account::compute_commitment"] - pub fn extern_account_compute_commitment(ptr: *mut Word); - #[link_name = "miden::native_account::compute_delta_commitment"] - pub fn extern_account_compute_delta_commitment(ptr: *mut Word); - #[link_name = "miden::active_account::get_code_commitment"] - pub fn extern_account_get_code_commitment(ptr: *mut Word); - #[link_name = "miden::active_account::get_initial_storage_commitment"] - pub fn extern_account_get_initial_storage_commitment(ptr: *mut Word); - #[link_name = "miden::active_account::compute_storage_commitment"] - pub fn extern_account_compute_storage_commitment(ptr: *mut Word); - #[link_name = "miden::active_account::get_initial_balance"] - pub fn extern_account_get_initial_balance( - faucet_id_prefix: Felt, - faucet_id_suffix: Felt, - ) -> Felt; - #[link_name = "miden::active_account::has_non_fungible_asset"] - pub fn extern_account_has_non_fungible_asset( - asset_3: Felt, - asset_2: Felt, - asset_1: Felt, - asset_0: Felt, - ) -> Felt; - #[link_name = "miden::active_account::get_initial_vault_root"] - pub fn extern_account_get_initial_vault_root(ptr: *mut Word); - #[link_name = "miden::active_account::get_vault_root"] - pub fn extern_account_get_vault_root(ptr: *mut Word); - #[link_name = "miden::active_account::get_num_procedures"] - pub fn extern_account_get_num_procedures() -> Felt; - #[link_name = "miden::active_account::get_procedure_root"] - pub fn extern_account_get_procedure_root(index: Felt, ptr: *mut Word); - #[link_name = "miden::active_account::has_procedure"] - pub fn extern_account_has_procedure( - proc_root_3: Felt, - proc_root_2: Felt, - proc_root_1: Felt, - proc_root_0: Felt, - ) -> Felt; - // Resolved via stub rlib at core Wasm link time - #[link_name = "miden::native_account::add_asset"] - pub fn extern_account_add_asset(_: Felt, _: Felt, _: Felt, _: Felt, ptr: *mut Asset); - #[link_name = "miden::active_account::get_balance"] - pub fn extern_account_get_balance(faucet_id_prefix: Felt, faucet_id_suffix: Felt) -> Felt; - #[link_name = "miden::native_account::was_procedure_called"] - pub fn extern_account_was_procedure_called( - proc_root_3: Felt, - proc_root_2: Felt, - proc_root_1: Felt, - proc_root_0: Felt, - ) -> Felt; -} - -/// Get the account ID of the currently executing note account. -pub fn get_id() -> AccountId { - unsafe { - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); - - // The MASM procedure returns the account ID on the stack. - // Inputs: [] - // Outputs: [acct_id_prefix, acct_id_suffix] - extern_account_get_id(ret_area.as_mut_ptr()); - ret_area.assume_init() - } -} - -/// Add the specified asset to the vault. -/// Returns the final asset in the account vault defined as follows: If asset is -/// a non-fungible asset, then returns the same as asset. If asset is a -/// fungible asset, then returns the total fungible asset in the account -/// vault after asset was added to it. -/// -/// Panics: -/// - If the asset is not valid. -/// - If the total value of two fungible assets is greater than or equal to 2^63. -/// - If the vault already contains the same non-fungible asset. -pub fn add_asset(asset: Asset) -> Asset { - unsafe { - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); - extern_account_add_asset( - asset.inner[3], - asset.inner[2], - asset.inner[1], - asset.inner[0], - ret_area.as_mut_ptr(), - ); - ret_area.assume_init() - } -} - -/// Remove the specified asset from the vault. -/// -/// Panics: -/// - The fungible asset is not found in the vault. -/// - The amount of the fungible asset in the vault is less than the amount to be removed. -/// - The non-fungible asset is not found in the vault. -pub fn remove_asset(asset: Asset) -> Asset { - unsafe { - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); - extern_account_remove_asset( - asset.inner[3], - asset.inner[2], - asset.inner[1], - asset.inner[0], - ret_area.as_mut_ptr(), - ); - ret_area.assume_init().reverse() - } -} - -/// Returns the current account nonce. -#[inline] -pub fn get_nonce() -> Felt { - unsafe { extern_account_get_nonce() } -} - -/// Increments the account nonce by one and return the new nonce -#[inline] -pub fn incr_nonce() -> Felt { - unsafe { extern_account_incr_nonce() } -} - -/// Returns the native account commitment at the beginning of the transaction. -#[inline] -pub fn get_initial_commitment() -> Word { - unsafe { - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); - extern_account_get_initial_commitment(ret_area.as_mut_ptr()); - ret_area.assume_init().reverse() - } -} - -/// Computes and returns the commitment of the current account data. -#[inline] -pub fn compute_commitment() -> Word { - unsafe { - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); - extern_account_compute_commitment(ret_area.as_mut_ptr()); - ret_area.assume_init().reverse() - } -} - -/// Computes and returns the commitment to the native account's delta for this transaction. -#[inline] -pub fn compute_delta_commitment() -> Word { - unsafe { - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); - extern_account_compute_delta_commitment(ret_area.as_mut_ptr()); - ret_area.assume_init().reverse() - } -} - -/// Returns the code commitment of the active account. -#[inline] -pub fn get_code_commitment() -> Word { - unsafe { - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); - extern_account_get_code_commitment(ret_area.as_mut_ptr()); - ret_area.assume_init().reverse() - } -} - -/// Returns the initial storage commitment of the active account. -#[inline] -pub fn get_initial_storage_commitment() -> Word { - unsafe { - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); - extern_account_get_initial_storage_commitment(ret_area.as_mut_ptr()); - ret_area.assume_init().reverse() - } -} - -/// Computes the latest storage commitment of the active account. -#[inline] -pub fn compute_storage_commitment() -> Word { - unsafe { - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); - extern_account_compute_storage_commitment(ret_area.as_mut_ptr()); - ret_area.assume_init().reverse() - } -} - -/// Returns the balance of the fungible asset identified by `faucet_id`. -/// -/// # Panics -/// -/// Propagates kernel errors if the referenced asset is non-fungible or the -/// account vault invariants are violated. -pub fn get_balance(faucet_id: AccountId) -> Felt { - unsafe { extern_account_get_balance(faucet_id.prefix, faucet_id.suffix) } -} - -/// Returns the initial balance of the fungible asset identified by `faucet_id`. -#[inline] -pub fn get_initial_balance(faucet_id: AccountId) -> Felt { - unsafe { extern_account_get_initial_balance(faucet_id.prefix, faucet_id.suffix) } -} - -/// Returns `true` if the active account vault currently contains the specified non-fungible asset. -#[inline] -pub fn has_non_fungible_asset(asset: Asset) -> bool { - unsafe { - extern_account_has_non_fungible_asset( - asset.inner[3], - asset.inner[2], - asset.inner[1], - asset.inner[0], - ) != Felt::from_u32(0) - } -} - -/// Returns the storage commitment of the active account vault at the beginning of the transaction. -#[inline] -pub fn get_initial_vault_root() -> Word { - unsafe { - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); - extern_account_get_initial_vault_root(ret_area.as_mut_ptr()); - ret_area.assume_init().reverse() - } -} - -/// Returns the current storage commitment of the active account vault. -#[inline] -pub fn get_vault_root() -> Word { - unsafe { - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); - extern_account_get_vault_root(ret_area.as_mut_ptr()); - ret_area.assume_init().reverse() - } -} - -/// Returns the number of procedures exported by the active account. -#[inline] -pub fn get_num_procedures() -> Felt { - unsafe { extern_account_get_num_procedures() } -} - -/// Returns the procedure root for the procedure at `index`. -#[inline] -pub fn get_procedure_root(index: u8) -> Word { - unsafe { - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); - extern_account_get_procedure_root(index.into(), ret_area.as_mut_ptr()); - ret_area.assume_init().reverse() - } -} - -/// Returns `true` if the procedure identified by `proc_root` exists on the active account. -#[inline] -pub fn has_procedure(proc_root: Word) -> bool { - unsafe { - extern_account_has_procedure(proc_root[3], proc_root[2], proc_root[1], proc_root[0]) - != Felt::from_u32(0) - } -} - -/// Returns `true` if the procedure identified by `proc_root` was called during the transaction. -#[inline] -pub fn was_procedure_called(proc_root: Word) -> bool { - unsafe { - extern_account_was_procedure_called(proc_root[3], proc_root[2], proc_root[1], proc_root[0]) - != Felt::from_u32(0) - } -} diff --git a/sdk/base-sys/src/bindings/active_account.rs b/sdk/base-sys/src/bindings/active_account.rs new file mode 100644 index 000000000..5c56b04e2 --- /dev/null +++ b/sdk/base-sys/src/bindings/active_account.rs @@ -0,0 +1,189 @@ +use miden_stdlib_sys::{Felt, Word}; + +use super::types::{AccountId, Asset}; + +#[allow(improper_ctypes)] +extern "C" { + #[link_name = "miden::active_account::get_id"] + fn extern_active_account_get_id(ptr: *mut AccountId); + #[link_name = "miden::active_account::get_nonce"] + fn extern_active_account_get_nonce() -> Felt; + #[link_name = "miden::active_account::get_initial_commitment"] + fn extern_active_account_get_initial_commitment(ptr: *mut Word); + #[link_name = "miden::active_account::compute_commitment"] + fn extern_active_account_compute_commitment(ptr: *mut Word); + #[link_name = "miden::active_account::get_code_commitment"] + fn extern_active_account_get_code_commitment(ptr: *mut Word); + #[link_name = "miden::active_account::get_initial_storage_commitment"] + fn extern_active_account_get_initial_storage_commitment(ptr: *mut Word); + #[link_name = "miden::active_account::compute_storage_commitment"] + fn extern_active_account_compute_storage_commitment(ptr: *mut Word); + #[link_name = "miden::active_account::get_balance"] + fn extern_active_account_get_balance(faucet_id_prefix: Felt, faucet_id_suffix: Felt) -> Felt; + #[link_name = "miden::active_account::get_initial_balance"] + fn extern_active_account_get_initial_balance( + faucet_id_prefix: Felt, + faucet_id_suffix: Felt, + ) -> Felt; + #[link_name = "miden::active_account::has_non_fungible_asset"] + fn extern_active_account_has_non_fungible_asset( + asset_3: Felt, + asset_2: Felt, + asset_1: Felt, + asset_0: Felt, + ) -> Felt; + #[link_name = "miden::active_account::get_initial_vault_root"] + fn extern_active_account_get_initial_vault_root(ptr: *mut Word); + #[link_name = "miden::active_account::get_vault_root"] + fn extern_active_account_get_vault_root(ptr: *mut Word); + #[link_name = "miden::active_account::get_num_procedures"] + fn extern_active_account_get_num_procedures() -> Felt; + #[link_name = "miden::active_account::get_procedure_root"] + fn extern_active_account_get_procedure_root(index: Felt, ptr: *mut Word); + #[link_name = "miden::active_account::has_procedure"] + fn extern_active_account_has_procedure( + proc_root_3: Felt, + proc_root_2: Felt, + proc_root_1: Felt, + proc_root_0: Felt, + ) -> Felt; +} + +/// Returns the account ID of the active account. +pub fn get_id() -> AccountId { + unsafe { + let mut ret_area = ::core::mem::MaybeUninit::::uninit(); + extern_active_account_get_id(ret_area.as_mut_ptr()); + ret_area.assume_init() + } +} + +/// Returns the nonce of the active account. +#[inline] +pub fn get_nonce() -> Felt { + unsafe { extern_active_account_get_nonce() } +} + +/// Returns the active account commitment at the beginning of the transaction. +#[inline] +pub fn get_initial_commitment() -> Word { + unsafe { + let mut ret_area = ::core::mem::MaybeUninit::::uninit(); + extern_active_account_get_initial_commitment(ret_area.as_mut_ptr()); + ret_area.assume_init().reverse() + } +} + +/// Computes and returns the commitment of the current account data. +#[inline] +pub fn compute_commitment() -> Word { + unsafe { + let mut ret_area = ::core::mem::MaybeUninit::::uninit(); + extern_active_account_compute_commitment(ret_area.as_mut_ptr()); + ret_area.assume_init().reverse() + } +} + +/// Returns the code commitment of the active account. +#[inline] +pub fn get_code_commitment() -> Word { + unsafe { + let mut ret_area = ::core::mem::MaybeUninit::::uninit(); + extern_active_account_get_code_commitment(ret_area.as_mut_ptr()); + ret_area.assume_init().reverse() + } +} + +/// Returns the initial storage commitment of the active account. +#[inline] +pub fn get_initial_storage_commitment() -> Word { + unsafe { + let mut ret_area = ::core::mem::MaybeUninit::::uninit(); + extern_active_account_get_initial_storage_commitment(ret_area.as_mut_ptr()); + ret_area.assume_init().reverse() + } +} + +/// Computes the latest storage commitment of the active account. +#[inline] +pub fn compute_storage_commitment() -> Word { + unsafe { + let mut ret_area = ::core::mem::MaybeUninit::::uninit(); + extern_active_account_compute_storage_commitment(ret_area.as_mut_ptr()); + ret_area.assume_init().reverse() + } +} + +/// Returns the balance of the fungible asset identified by `faucet_id`. +/// +/// # Panics +/// +/// Propagates kernel errors if the referenced asset is non-fungible or the +/// account vault invariants are violated. +pub fn get_balance(faucet_id: AccountId) -> Felt { + unsafe { extern_active_account_get_balance(faucet_id.prefix, faucet_id.suffix) } +} + +/// Returns the initial balance of the fungible asset identified by `faucet_id`. +#[inline] +pub fn get_initial_balance(faucet_id: AccountId) -> Felt { + unsafe { extern_active_account_get_initial_balance(faucet_id.prefix, faucet_id.suffix) } +} + +/// Returns `true` if the active account vault currently contains the specified non-fungible asset. +#[inline] +pub fn has_non_fungible_asset(asset: Asset) -> bool { + unsafe { + extern_active_account_has_non_fungible_asset( + asset.inner[3], + asset.inner[2], + asset.inner[1], + asset.inner[0], + ) != Felt::from_u32(0) + } +} + +/// Returns the vault root of the active account at the beginning of the transaction. +#[inline] +pub fn get_initial_vault_root() -> Word { + unsafe { + let mut ret_area = ::core::mem::MaybeUninit::::uninit(); + extern_active_account_get_initial_vault_root(ret_area.as_mut_ptr()); + ret_area.assume_init().reverse() + } +} + +/// Returns the current vault root of the active account. +#[inline] +pub fn get_vault_root() -> Word { + unsafe { + let mut ret_area = ::core::mem::MaybeUninit::::uninit(); + extern_active_account_get_vault_root(ret_area.as_mut_ptr()); + ret_area.assume_init().reverse() + } +} + +/// Returns the number of procedures exported by the active account. +#[inline] +pub fn get_num_procedures() -> Felt { + unsafe { extern_active_account_get_num_procedures() } +} + +/// Returns the procedure root for the procedure at `index`. +#[inline] +pub fn get_procedure_root(index: u8) -> Word { + unsafe { + let mut ret_area = ::core::mem::MaybeUninit::::uninit(); + extern_active_account_get_procedure_root(index.into(), ret_area.as_mut_ptr()); + ret_area.assume_init().reverse() + } +} + +/// Returns `true` if the procedure identified by `proc_root` exists on the active account. +#[inline] +pub fn has_procedure(proc_root: Word) -> bool { + unsafe { + extern_active_account_has_procedure(proc_root[3], proc_root[2], proc_root[1], proc_root[0]) + != Felt::from_u32(0) + } +} diff --git a/sdk/base-sys/src/bindings/mod.rs b/sdk/base-sys/src/bindings/mod.rs index b80c872e9..45c257162 100644 --- a/sdk/base-sys/src/bindings/mod.rs +++ b/sdk/base-sys/src/bindings/mod.rs @@ -8,11 +8,12 @@ //! - In Rust: Word fields are stored as [e0, e1, e2, e3] //! - In MASM procedures: These are pushed/popped from the stack in reverse order [e3, e2, e1, e0] -pub mod account; +pub mod active_account; pub mod active_note; pub mod asset; pub mod faucet; pub mod input_note; +pub mod native_account; pub mod output_note; pub mod storage; pub mod tx; diff --git a/sdk/base-sys/src/bindings/native_account.rs b/sdk/base-sys/src/bindings/native_account.rs new file mode 100644 index 000000000..e113f6573 --- /dev/null +++ b/sdk/base-sys/src/bindings/native_account.rs @@ -0,0 +1,108 @@ +use miden_stdlib_sys::{Felt, Word}; + +use super::types::Asset; + +#[allow(improper_ctypes)] +extern "C" { + #[link_name = "miden::native_account::add_asset"] + fn extern_native_account_add_asset( + asset_3: Felt, + asset_2: Felt, + asset_1: Felt, + asset_0: Felt, + ptr: *mut Asset, + ); + #[link_name = "miden::native_account::remove_asset"] + fn extern_native_account_remove_asset( + asset_3: Felt, + asset_2: Felt, + asset_1: Felt, + asset_0: Felt, + ptr: *mut Asset, + ); + #[link_name = "miden::native_account::incr_nonce"] + fn extern_native_account_incr_nonce() -> Felt; + #[link_name = "miden::native_account::compute_delta_commitment"] + fn extern_native_account_compute_delta_commitment(ptr: *mut Word); + #[link_name = "miden::native_account::was_procedure_called"] + fn extern_native_account_was_procedure_called( + proc_root_3: Felt, + proc_root_2: Felt, + proc_root_1: Felt, + proc_root_0: Felt, + ) -> Felt; +} + +/// Add the specified asset to the vault. +/// +/// Returns the final asset in the account vault defined as follows: If `asset` is +/// a non-fungible asset, then returns the same as `asset`. If `asset` is a +/// fungible asset, then returns the total fungible asset in the account +/// vault after `asset` was added to it. +/// +/// Panics: +/// - If the asset is not valid. +/// - If the total value of two fungible assets is greater than or equal to 2^63. +/// - If the vault already contains the same non-fungible asset. +pub fn add_asset(asset: Asset) -> Asset { + unsafe { + let mut ret_area = ::core::mem::MaybeUninit::::uninit(); + extern_native_account_add_asset( + asset.inner[3], + asset.inner[2], + asset.inner[1], + asset.inner[0], + ret_area.as_mut_ptr(), + ); + ret_area.assume_init() + } +} + +/// Remove the specified asset from the vault. +/// +/// Panics: +/// - The fungible asset is not found in the vault. +/// - The amount of the fungible asset in the vault is less than the amount to be removed. +/// - The non-fungible asset is not found in the vault. +pub fn remove_asset(asset: Asset) -> Asset { + unsafe { + let mut ret_area = ::core::mem::MaybeUninit::::uninit(); + extern_native_account_remove_asset( + asset.inner[3], + asset.inner[2], + asset.inner[1], + asset.inner[0], + ret_area.as_mut_ptr(), + ); + ret_area.assume_init().reverse() + } +} + +/// Increments the account nonce by one and returns the new nonce. +#[inline] +pub fn incr_nonce() -> Felt { + unsafe { extern_native_account_incr_nonce() } +} + +/// Computes and returns the commitment to the native account's delta for this transaction. +#[inline] +pub fn compute_delta_commitment() -> Word { + unsafe { + let mut ret_area = ::core::mem::MaybeUninit::::uninit(); + extern_native_account_compute_delta_commitment(ret_area.as_mut_ptr()); + ret_area.assume_init().reverse() + } +} + +/// Returns `true` if the procedure identified by `proc_root` was called during the transaction. +#[inline] +pub fn was_procedure_called(proc_root: Word) -> bool { + unsafe { + extern_native_account_was_procedure_called( + proc_root[3], + proc_root[2], + proc_root[1], + proc_root[0], + ) != Felt::from_u32(0) + } +} diff --git a/sdk/base-sys/stubs/account.rs b/sdk/base-sys/stubs/account.rs deleted file mode 100644 index 3b766a831..000000000 --- a/sdk/base-sys/stubs/account.rs +++ /dev/null @@ -1,182 +0,0 @@ -use core::ffi::c_void; - -/// Account interface stubs -/// -/// Unreachable stub for `add-asset` import (extern_account_add_asset). -/// Signature matches the Wasm lowering used by the SDK: (f32, f32, f32, f32, i32) -#[export_name = "miden::native_account::add_asset"] -pub extern "C" fn add_asset_plain(_a0: f32, _a1: f32, _a2: f32, _a3: f32, _out: *mut c_void) { - unsafe { core::hint::unreachable_unchecked() } -} - -#[export_name = "miden::native_account::remove_asset"] -pub extern "C" fn remove_asset_plain(_a0: f32, _a1: f32, _a2: f32, _a3: f32, _out: *mut c_void) { - unsafe { core::hint::unreachable_unchecked() } -} - -#[export_name = "miden::active_account::get_id"] -pub extern "C" fn account_get_id_plain(_out: *mut c_void) { - unsafe { core::hint::unreachable_unchecked() } -} - -#[export_name = "miden::active_account::get_nonce"] -pub extern "C" fn account_get_nonce_plain() -> f32 { - unsafe { core::hint::unreachable_unchecked() } -} - -#[export_name = "miden::active_account::get_initial_commitment"] -pub extern "C" fn account_get_initial_commitment_plain(_out: *mut c_void) { - unsafe { core::hint::unreachable_unchecked() } -} - -#[export_name = "miden::active_account::compute_commitment"] -pub extern "C" fn account_compute_commitment_plain(_out: *mut c_void) { - unsafe { core::hint::unreachable_unchecked() } -} - -#[export_name = "miden::native_account::compute_delta_commitment"] -pub extern "C" fn account_compute_delta_commitment_plain(_out: *mut c_void) { - unsafe { core::hint::unreachable_unchecked() } -} - -#[export_name = "miden::active_account::get_code_commitment"] -pub extern "C" fn account_get_code_commitment_plain(_out: *mut c_void) { - unsafe { core::hint::unreachable_unchecked() } -} - -#[export_name = "miden::active_account::get_initial_storage_commitment"] -pub extern "C" fn account_get_initial_storage_commitment_plain(_out: *mut c_void) { - unsafe { core::hint::unreachable_unchecked() } -} - -#[export_name = "miden::active_account::compute_storage_commitment"] -pub extern "C" fn account_compute_storage_commitment_plain(_out: *mut c_void) { - unsafe { core::hint::unreachable_unchecked() } -} - -#[export_name = "miden::active_account::get_item"] -pub extern "C" fn account_get_item_plain(_index: f32, _out: *mut c_void) { - unsafe { core::hint::unreachable_unchecked() } -} - -#[export_name = "miden::active_account::get_initial_item"] -pub extern "C" fn account_get_initial_item_plain(_index: f32, _out: *mut c_void) { - unsafe { core::hint::unreachable_unchecked() } -} - -#[export_name = "miden::native_account::set_item"] -pub extern "C" fn account_set_item_plain( - _index: f32, - _v0: f32, - _v1: f32, - _v2: f32, - _v3: f32, - _out: *mut c_void, -) { - unsafe { core::hint::unreachable_unchecked() } -} - -#[export_name = "miden::active_account::get_map_item"] -pub extern "C" fn account_get_map_item_plain( - _index: f32, - _k0: f32, - _k1: f32, - _k2: f32, - _k3: f32, - _out: *mut c_void, -) { - unsafe { core::hint::unreachable_unchecked() } -} - -#[export_name = "miden::active_account::get_initial_map_item"] -pub extern "C" fn account_get_initial_map_item_plain( - _index: f32, - _k0: f32, - _k1: f32, - _k2: f32, - _k3: f32, - _out: *mut c_void, -) { - unsafe { core::hint::unreachable_unchecked() } -} - -#[export_name = "miden::native_account::set_map_item"] -pub extern "C" fn account_set_map_item_plain( - _index: f32, - _k0: f32, - _k1: f32, - _k2: f32, - _k3: f32, - _v0: f32, - _v1: f32, - _v2: f32, - _v3: f32, - _out: *mut c_void, -) { - unsafe { core::hint::unreachable_unchecked() } -} - -#[export_name = "miden::native_account::incr_nonce"] -pub extern "C" fn account_incr_nonce_plain() -> f32 { - unsafe { core::hint::unreachable_unchecked() } -} - -#[export_name = "miden::active_account::get_balance"] -pub extern "C" fn account_get_balance_plain(_prefix: f32, _suffix: f32) -> f32 { - unsafe { core::hint::unreachable_unchecked() } -} - -#[export_name = "miden::active_account::get_initial_balance"] -pub extern "C" fn account_get_initial_balance_plain(_prefix: f32, _suffix: f32) -> f32 { - unsafe { core::hint::unreachable_unchecked() } -} - -#[export_name = "miden::active_account::has_non_fungible_asset"] -pub extern "C" fn account_has_non_fungible_asset_plain( - _a0: f32, - _a1: f32, - _a2: f32, - _a3: f32, -) -> f32 { - unsafe { core::hint::unreachable_unchecked() } -} - -#[export_name = "miden::active_account::get_initial_vault_root"] -pub extern "C" fn account_get_initial_vault_root_plain(_out: *mut c_void) { - unsafe { core::hint::unreachable_unchecked() } -} - -#[export_name = "miden::active_account::get_vault_root"] -pub extern "C" fn account_get_vault_root_plain(_out: *mut c_void) { - unsafe { core::hint::unreachable_unchecked() } -} - -#[export_name = "miden::active_account::get_num_procedures"] -pub extern "C" fn account_get_num_procedures_plain() -> f32 { - unsafe { core::hint::unreachable_unchecked() } -} - -#[export_name = "miden::active_account::get_procedure_root"] -pub extern "C" fn account_get_procedure_root_plain(_index: f32, _out: *mut c_void) { - unsafe { core::hint::unreachable_unchecked() } -} - -#[export_name = "miden::active_account::has_procedure"] -pub extern "C" fn account_has_procedure_plain( - _r0: f32, - _r1: f32, - _r2: f32, - _r3: f32, -) -> f32 { - unsafe { core::hint::unreachable_unchecked() } -} - -#[export_name = "miden::native_account::was_procedure_called"] -pub extern "C" fn account_was_procedure_called_plain( - _r0: f32, - _r1: f32, - _r2: f32, - _r3: f32, -) -> f32 { - unsafe { core::hint::unreachable_unchecked() } -} diff --git a/sdk/base-sys/stubs/active_account.rs b/sdk/base-sys/stubs/active_account.rs new file mode 100644 index 000000000..ec911b37f --- /dev/null +++ b/sdk/base-sys/stubs/active_account.rs @@ -0,0 +1,120 @@ +use core::ffi::c_void; + +#[export_name = "miden::active_account::get_id"] +pub extern "C" fn active_account_get_id_plain(_out: *mut c_void) { + unsafe { core::hint::unreachable_unchecked() } +} + +#[export_name = "miden::active_account::get_nonce"] +pub extern "C" fn active_account_get_nonce_plain() -> f32 { + unsafe { core::hint::unreachable_unchecked() } +} + +#[export_name = "miden::active_account::get_initial_commitment"] +pub extern "C" fn active_account_get_initial_commitment_plain(_out: *mut c_void) { + unsafe { core::hint::unreachable_unchecked() } +} + +#[export_name = "miden::active_account::compute_commitment"] +pub extern "C" fn active_account_compute_commitment_plain(_out: *mut c_void) { + unsafe { core::hint::unreachable_unchecked() } +} + +#[export_name = "miden::active_account::get_code_commitment"] +pub extern "C" fn active_account_get_code_commitment_plain(_out: *mut c_void) { + unsafe { core::hint::unreachable_unchecked() } +} + +#[export_name = "miden::active_account::get_initial_storage_commitment"] +pub extern "C" fn active_account_get_initial_storage_commitment_plain(_out: *mut c_void) { + unsafe { core::hint::unreachable_unchecked() } +} + +#[export_name = "miden::active_account::compute_storage_commitment"] +pub extern "C" fn active_account_compute_storage_commitment_plain(_out: *mut c_void) { + unsafe { core::hint::unreachable_unchecked() } +} + +#[export_name = "miden::active_account::get_item"] +pub extern "C" fn active_account_get_item_plain(_index: f32, _out: *mut c_void) { + unsafe { core::hint::unreachable_unchecked() } +} + +#[export_name = "miden::active_account::get_initial_item"] +pub extern "C" fn active_account_get_initial_item_plain(_index: f32, _out: *mut c_void) { + unsafe { core::hint::unreachable_unchecked() } +} + +#[export_name = "miden::active_account::get_map_item"] +pub extern "C" fn active_account_get_map_item_plain( + _index: f32, + _k0: f32, + _k1: f32, + _k2: f32, + _k3: f32, + _out: *mut c_void, +) { + unsafe { core::hint::unreachable_unchecked() } +} + +#[export_name = "miden::active_account::get_initial_map_item"] +pub extern "C" fn active_account_get_initial_map_item_plain( + _index: f32, + _k0: f32, + _k1: f32, + _k2: f32, + _k3: f32, + _out: *mut c_void, +) { + unsafe { core::hint::unreachable_unchecked() } +} + +#[export_name = "miden::active_account::get_balance"] +pub extern "C" fn active_account_get_balance_plain(_prefix: f32, _suffix: f32) -> f32 { + unsafe { core::hint::unreachable_unchecked() } +} + +#[export_name = "miden::active_account::get_initial_balance"] +pub extern "C" fn active_account_get_initial_balance_plain(_prefix: f32, _suffix: f32) -> f32 { + unsafe { core::hint::unreachable_unchecked() } +} + +#[export_name = "miden::active_account::has_non_fungible_asset"] +pub extern "C" fn active_account_has_non_fungible_asset_plain( + _a0: f32, + _a1: f32, + _a2: f32, + _a3: f32, +) -> f32 { + unsafe { core::hint::unreachable_unchecked() } +} + +#[export_name = "miden::active_account::get_initial_vault_root"] +pub extern "C" fn active_account_get_initial_vault_root_plain(_out: *mut c_void) { + unsafe { core::hint::unreachable_unchecked() } +} + +#[export_name = "miden::active_account::get_vault_root"] +pub extern "C" fn active_account_get_vault_root_plain(_out: *mut c_void) { + unsafe { core::hint::unreachable_unchecked() } +} + +#[export_name = "miden::active_account::get_num_procedures"] +pub extern "C" fn active_account_get_num_procedures_plain() -> f32 { + unsafe { core::hint::unreachable_unchecked() } +} + +#[export_name = "miden::active_account::get_procedure_root"] +pub extern "C" fn active_account_get_procedure_root_plain(_index: f32, _out: *mut c_void) { + unsafe { core::hint::unreachable_unchecked() } +} + +#[export_name = "miden::active_account::has_procedure"] +pub extern "C" fn active_account_has_procedure_plain( + _r0: f32, + _r1: f32, + _r2: f32, + _r3: f32, +) -> f32 { + unsafe { core::hint::unreachable_unchecked() } +} diff --git a/sdk/base-sys/stubs/lib.rs b/sdk/base-sys/stubs/lib.rs index 3a74f9d96..f71723e28 100644 --- a/sdk/base-sys/stubs/lib.rs +++ b/sdk/base-sys/stubs/lib.rs @@ -6,12 +6,13 @@ //! linked to `miden-base-sys` so that the Wasm translator can lower //! the calls appropriately. They are not part of the crate sources. -mod account; +mod active_account; mod asset; mod active_note; mod faucet; mod input_note; mod output_note; +mod native_account; mod tx; // No panic handler here; the stubs are packaged as a single object into a diff --git a/sdk/base-sys/stubs/native_account.rs b/sdk/base-sys/stubs/native_account.rs new file mode 100644 index 000000000..7afd16574 --- /dev/null +++ b/sdk/base-sys/stubs/native_account.rs @@ -0,0 +1,71 @@ +use core::ffi::c_void; + +#[export_name = "miden::native_account::add_asset"] +pub extern "C" fn native_account_add_asset_plain( + _a0: f32, + _a1: f32, + _a2: f32, + _a3: f32, + _out: *mut c_void, +) { + unsafe { core::hint::unreachable_unchecked() } +} + +#[export_name = "miden::native_account::remove_asset"] +pub extern "C" fn native_account_remove_asset_plain( + _a0: f32, + _a1: f32, + _a2: f32, + _a3: f32, + _out: *mut c_void, +) { + unsafe { core::hint::unreachable_unchecked() } +} + +#[export_name = "miden::native_account::incr_nonce"] +pub extern "C" fn native_account_incr_nonce_plain() -> f32 { + unsafe { core::hint::unreachable_unchecked() } +} + +#[export_name = "miden::native_account::compute_delta_commitment"] +pub extern "C" fn native_account_compute_delta_commitment_plain(_out: *mut c_void) { + unsafe { core::hint::unreachable_unchecked() } +} + +#[export_name = "miden::native_account::set_item"] +pub extern "C" fn native_account_set_item_plain( + _index: f32, + _v0: f32, + _v1: f32, + _v2: f32, + _v3: f32, + _out: *mut c_void, +) { + unsafe { core::hint::unreachable_unchecked() } +} + +#[export_name = "miden::native_account::set_map_item"] +pub extern "C" fn native_account_set_map_item_plain( + _index: f32, + _k0: f32, + _k1: f32, + _k2: f32, + _k3: f32, + _v0: f32, + _v1: f32, + _v2: f32, + _v3: f32, + _out: *mut c_void, +) { + unsafe { core::hint::unreachable_unchecked() } +} + +#[export_name = "miden::native_account::was_procedure_called"] +pub extern "C" fn native_account_was_procedure_called_plain( + _r0: f32, + _r1: f32, + _r2: f32, + _r3: f32, +) -> f32 { + unsafe { core::hint::unreachable_unchecked() } +} diff --git a/tests/integration/expected/abi_transform_tx_kernel_get_id.hir b/tests/integration/expected/abi_transform_tx_kernel_get_id.hir index 9e8abc779..1e19edb20 100644 --- a/tests/integration/expected/abi_transform_tx_kernel_get_id.hir +++ b/tests/integration/expected/abi_transform_tx_kernel_get_id.hir @@ -12,7 +12,7 @@ builtin.component root_ns:root@1.0.0 { hir.store v8, v6; v9 = arith.constant 8 : i32; v10 = arith.add v6, v9 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_id/miden_base_sys::bindings::account::get_id(v10) + hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_id/miden_base_sys::bindings::active_account::get_id(v10) v12 = arith.constant 8 : u32; v11 = hir.bitcast v6 : u32; v13 = arith.add v11, v12 : u32 #[overflow = checked]; @@ -219,7 +219,7 @@ builtin.component root_ns:root@1.0.0 { builtin.ret v144; }; - private builtin.function @miden_base_sys::bindings::account::get_id(v146: i32) { + private builtin.function @miden_base_sys::bindings::active_account::get_id(v146: i32) { ^block28(v146: i32): v148 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_id/__stack_pointer : ptr v149 = hir.bitcast v148 : ptr; diff --git a/tests/integration/expected/abi_transform_tx_kernel_get_id.wat b/tests/integration/expected/abi_transform_tx_kernel_get_id.wat index a9879a280..5b447bf58 100644 --- a/tests/integration/expected/abi_transform_tx_kernel_get_id.wat +++ b/tests/integration/expected/abi_transform_tx_kernel_get_id.wat @@ -23,7 +23,7 @@ local.get 1 i32.const 8 i32.add - call $miden_base_sys::bindings::account::get_id + call $miden_base_sys::bindings::active_account::get_id local.get 0 local.get 1 i64.load offset=8 @@ -142,7 +142,7 @@ (func $intrinsics::mem::heap_base (;5;) (type 5) (result i32) unreachable ) - (func $miden_base_sys::bindings::account::get_id (;6;) (type 0) (param i32) + (func $miden_base_sys::bindings::active_account::get_id (;6;) (type 0) (param i32) (local i32) global.get $__stack_pointer i32.const 16 diff --git a/tests/integration/expected/examples/auth_component_rpo_falcon512.hir b/tests/integration/expected/examples/auth_component_rpo_falcon512.hir index 3ca45e658..7752b57de 100644 --- a/tests/integration/expected/examples/auth_component_rpo_falcon512.hir +++ b/tests/integration/expected/examples/auth_component_rpo_falcon512.hir @@ -772,52 +772,52 @@ builtin.component miden:base/authentication-component@1.0.0 { builtin.ret ; }; - private builtin.function @miden::native_account::compute_delta_commitment(v576: i32) { - ^block61(v576: i32): - v577, v578, v579, v580 = hir.exec @miden/native_account/compute_delta_commitment() : felt, felt, felt, felt - v581 = hir.bitcast v576 : u32; - v582 = hir.int_to_ptr v581 : ptr; - hir.store v582, v577; - v583 = arith.constant 4 : u32; - v584 = arith.add v581, v583 : u32 #[overflow = checked]; - v585 = hir.int_to_ptr v584 : ptr; - hir.store v585, v578; - v586 = arith.constant 8 : u32; - v587 = arith.add v581, v586 : u32 #[overflow = checked]; - v588 = hir.int_to_ptr v587 : ptr; - hir.store v588, v579; - v589 = arith.constant 12 : u32; - v590 = arith.add v581, v589 : u32 #[overflow = checked]; - v591 = hir.int_to_ptr v590 : ptr; - hir.store v591, v580; + private builtin.function @miden::active_account::get_item(v576: felt, v577: i32) { + ^block61(v576: felt, v577: i32): + v578, v579, v580, v581 = hir.exec @miden/active_account/get_item(v576) : felt, felt, felt, felt + v582 = hir.bitcast v577 : u32; + v583 = hir.int_to_ptr v582 : ptr; + hir.store v583, v578; + v584 = arith.constant 4 : u32; + v585 = arith.add v582, v584 : u32 #[overflow = checked]; + v586 = hir.int_to_ptr v585 : ptr; + hir.store v586, v579; + v587 = arith.constant 8 : u32; + v588 = arith.add v582, v587 : u32 #[overflow = checked]; + v589 = hir.int_to_ptr v588 : ptr; + hir.store v589, v580; + v590 = arith.constant 12 : u32; + v591 = arith.add v582, v590 : u32 #[overflow = checked]; + v592 = hir.int_to_ptr v591 : ptr; + hir.store v592, v581; builtin.ret ; }; - private builtin.function @miden::active_account::get_item(v592: felt, v593: i32) { - ^block65(v592: felt, v593: i32): - v594, v595, v596, v597 = hir.exec @miden/active_account/get_item(v592) : felt, felt, felt, felt - v598 = hir.bitcast v593 : u32; - v599 = hir.int_to_ptr v598 : ptr; - hir.store v599, v594; - v600 = arith.constant 4 : u32; - v601 = arith.add v598, v600 : u32 #[overflow = checked]; - v602 = hir.int_to_ptr v601 : ptr; - hir.store v602, v595; - v603 = arith.constant 8 : u32; - v604 = arith.add v598, v603 : u32 #[overflow = checked]; - v605 = hir.int_to_ptr v604 : ptr; - hir.store v605, v596; - v606 = arith.constant 12 : u32; - v607 = arith.add v598, v606 : u32 #[overflow = checked]; - v608 = hir.int_to_ptr v607 : ptr; - hir.store v608, v597; - builtin.ret ; + private builtin.function @miden::native_account::incr_nonce() -> felt { + ^block65: + v593 = hir.exec @miden/native_account/incr_nonce() : felt + builtin.ret v593; }; - private builtin.function @miden::native_account::incr_nonce() -> felt { - ^block68: - v609 = hir.exec @miden/native_account/incr_nonce() : felt - builtin.ret v609; + private builtin.function @miden::native_account::compute_delta_commitment(v595: i32) { + ^block68(v595: i32): + v596, v597, v598, v599 = hir.exec @miden/native_account/compute_delta_commitment() : felt, felt, felt, felt + v600 = hir.bitcast v595 : u32; + v601 = hir.int_to_ptr v600 : ptr; + hir.store v601, v596; + v602 = arith.constant 4 : u32; + v603 = arith.add v600, v602 : u32 #[overflow = checked]; + v604 = hir.int_to_ptr v603 : ptr; + hir.store v604, v597; + v605 = arith.constant 8 : u32; + v606 = arith.add v600, v605 : u32 #[overflow = checked]; + v607 = hir.int_to_ptr v606 : ptr; + hir.store v607, v598; + v608 = arith.constant 12 : u32; + v609 = arith.add v600, v608 : u32 #[overflow = checked]; + v610 = hir.int_to_ptr v609 : ptr; + hir.store v610, v599; + builtin.ret ; }; private builtin.function @miden::tx::get_block_number() -> felt { diff --git a/tests/integration/expected/examples/auth_component_rpo_falcon512.masm b/tests/integration/expected/examples/auth_component_rpo_falcon512.masm index 79e235966..a10c5c551 100644 --- a/tests/integration/expected/examples/auth_component_rpo_falcon512.masm +++ b/tests/integration/expected/examples/auth_component_rpo_falcon512.masm @@ -1738,10 +1738,10 @@ proc std::crypto::dsa::rpo_falcon512::verify( end @callconv("C") -proc miden::native_account::compute_delta_commitment(i32) +proc miden::active_account::get_item(felt, i32) trace.240 nop - exec.::miden::native_account::compute_delta_commitment + exec.::miden::active_account::get_item trace.252 nop movup.4 @@ -1794,10 +1794,21 @@ proc miden::native_account::compute_delta_commitment(i32) end @callconv("C") -proc miden::active_account::get_item(felt, i32) +proc miden::native_account::incr_nonce( + +) -> felt trace.240 nop - exec.::miden::active_account::get_item + exec.::miden::native_account::incr_nonce + trace.252 + nop +end + +@callconv("C") +proc miden::native_account::compute_delta_commitment(i32) + trace.240 + nop + exec.::miden::native_account::compute_delta_commitment trace.252 nop movup.4 @@ -1849,17 +1860,6 @@ proc miden::active_account::get_item(felt, i32) nop end -@callconv("C") -proc miden::native_account::incr_nonce( - -) -> felt - trace.240 - nop - exec.::miden::native_account::incr_nonce - trace.252 - nop -end - @callconv("C") proc miden::tx::get_block_number( diff --git a/tests/integration/expected/examples/auth_component_rpo_falcon512.wat b/tests/integration/expected/examples/auth_component_rpo_falcon512.wat index 971c63bc7..196fafad5 100644 --- a/tests/integration/expected/examples/auth_component_rpo_falcon512.wat +++ b/tests/integration/expected/examples/auth_component_rpo_falcon512.wat @@ -437,13 +437,13 @@ (func $std::crypto::dsa::rpo_falcon512::verify (;16;) (type 8) (param f32 f32 f32 f32 f32 f32 f32 f32) unreachable ) - (func $miden::native_account::compute_delta_commitment (;17;) (type 3) (param i32) + (func $miden::active_account::get_item (;17;) (type 10) (param f32 i32) unreachable ) - (func $miden::active_account::get_item (;18;) (type 10) (param f32 i32) + (func $miden::native_account::incr_nonce (;18;) (type 2) (result f32) unreachable ) - (func $miden::native_account::incr_nonce (;19;) (type 2) (result f32) + (func $miden::native_account::compute_delta_commitment (;19;) (type 3) (param i32) unreachable ) (func $miden::tx::get_block_number (;20;) (type 2) (result f32) diff --git a/tests/integration/expected/examples/basic_wallet.hir b/tests/integration/expected/examples/basic_wallet.hir index 2febd36fc..73cf07072 100644 --- a/tests/integration/expected/examples/basic_wallet.hir +++ b/tests/integration/expected/examples/basic_wallet.hir @@ -53,7 +53,7 @@ builtin.component miden:basic-wallet/basic-wallet@0.1.0 { hir.store v33, v0; v34 = arith.constant 16 : i32; v35 = arith.add v9, v34 : i32 #[overflow = wrapping]; - hir.exec @miden:basic-wallet/basic-wallet@0.1.0/basic_wallet/miden_base_sys::bindings::account::add_asset(v35, v9) + hir.exec @miden:basic-wallet/basic-wallet@0.1.0/basic_wallet/miden_base_sys::bindings::native_account::add_asset(v35, v9) v371 = arith.constant 32 : i32; v37 = arith.add v9, v371 : i32 #[overflow = wrapping]; v38 = builtin.global_symbol @miden:basic-wallet/basic-wallet@0.1.0/basic_wallet/__stack_pointer : ptr @@ -105,7 +105,7 @@ builtin.component miden:basic-wallet/basic-wallet@0.1.0 { hir.store v74, v40; v75 = arith.constant 16 : i32; v76 = arith.add v50, v75 : i32 #[overflow = wrapping]; - hir.exec @miden:basic-wallet/basic-wallet@0.1.0/basic_wallet/miden_base_sys::bindings::account::remove_asset(v76, v50) + hir.exec @miden:basic-wallet/basic-wallet@0.1.0/basic_wallet/miden_base_sys::bindings::native_account::remove_asset(v76, v50) v377 = arith.constant 16 : i32; v78 = arith.add v50, v377 : i32 #[overflow = wrapping]; hir.exec @miden:basic-wallet/basic-wallet@0.1.0/basic_wallet/miden_base_sys::bindings::output_note::add_asset(v78, v44) @@ -151,7 +151,7 @@ builtin.component miden:basic-wallet/basic-wallet@0.1.0 { builtin.ret ; }; - private builtin.function @miden_base_sys::bindings::account::add_asset(v106: i32, v107: i32) { + private builtin.function @miden_base_sys::bindings::native_account::add_asset(v106: i32, v107: i32) { ^block17(v106: i32, v107: i32): v109 = arith.constant 12 : u32; v108 = hir.bitcast v107 : u32; @@ -187,7 +187,7 @@ builtin.component miden:basic-wallet/basic-wallet@0.1.0 { builtin.ret ; }; - private builtin.function @miden_base_sys::bindings::account::remove_asset(v134: i32, v135: i32) { + private builtin.function @miden_base_sys::bindings::native_account::remove_asset(v134: i32, v135: i32) { ^block19(v134: i32, v135: i32): v137 = builtin.global_symbol @miden:basic-wallet/basic-wallet@0.1.0/basic_wallet/__stack_pointer : ptr v138 = hir.bitcast v137 : ptr; @@ -432,51 +432,51 @@ builtin.component miden:basic-wallet/basic-wallet@0.1.0 { builtin.ret ; }; - private builtin.function @miden::native_account::add_asset(v317: felt, v318: felt, v319: felt, v320: felt, v321: i32) { - ^block29(v317: felt, v318: felt, v319: felt, v320: felt, v321: i32): - v322, v323, v324, v325 = hir.exec @miden/native_account/add_asset(v317, v318, v319, v320) : felt, felt, felt, felt - v326 = hir.bitcast v321 : u32; - v327 = hir.int_to_ptr v326 : ptr; - hir.store v327, v322; - v328 = arith.constant 4 : u32; - v329 = arith.add v326, v328 : u32 #[overflow = checked]; - v330 = hir.int_to_ptr v329 : ptr; - hir.store v330, v323; - v331 = arith.constant 8 : u32; - v332 = arith.add v326, v331 : u32 #[overflow = checked]; - v333 = hir.int_to_ptr v332 : ptr; - hir.store v333, v324; - v334 = arith.constant 12 : u32; - v335 = arith.add v326, v334 : u32 #[overflow = checked]; - v336 = hir.int_to_ptr v335 : ptr; - hir.store v336, v325; + private builtin.function @miden::output_note::add_asset(v317: felt, v318: felt, v319: felt, v320: felt, v321: felt) { + ^block29(v317: felt, v318: felt, v319: felt, v320: felt, v321: felt): + hir.exec @miden/output_note/add_asset(v317, v318, v319, v320, v321) builtin.ret ; }; - private builtin.function @miden::native_account::remove_asset(v337: felt, v338: felt, v339: felt, v340: felt, v341: i32) { - ^block33(v337: felt, v338: felt, v339: felt, v340: felt, v341: i32): - v342, v343, v344, v345 = hir.exec @miden/native_account/remove_asset(v337, v338, v339, v340) : felt, felt, felt, felt - v346 = hir.bitcast v341 : u32; - v347 = hir.int_to_ptr v346 : ptr; - hir.store v347, v342; - v348 = arith.constant 4 : u32; - v349 = arith.add v346, v348 : u32 #[overflow = checked]; - v350 = hir.int_to_ptr v349 : ptr; - hir.store v350, v343; - v351 = arith.constant 8 : u32; - v352 = arith.add v346, v351 : u32 #[overflow = checked]; - v353 = hir.int_to_ptr v352 : ptr; - hir.store v353, v344; - v354 = arith.constant 12 : u32; - v355 = arith.add v346, v354 : u32 #[overflow = checked]; - v356 = hir.int_to_ptr v355 : ptr; - hir.store v356, v345; + private builtin.function @miden::native_account::add_asset(v322: felt, v323: felt, v324: felt, v325: felt, v326: i32) { + ^block33(v322: felt, v323: felt, v324: felt, v325: felt, v326: i32): + v327, v328, v329, v330 = hir.exec @miden/native_account/add_asset(v322, v323, v324, v325) : felt, felt, felt, felt + v331 = hir.bitcast v326 : u32; + v332 = hir.int_to_ptr v331 : ptr; + hir.store v332, v327; + v333 = arith.constant 4 : u32; + v334 = arith.add v331, v333 : u32 #[overflow = checked]; + v335 = hir.int_to_ptr v334 : ptr; + hir.store v335, v328; + v336 = arith.constant 8 : u32; + v337 = arith.add v331, v336 : u32 #[overflow = checked]; + v338 = hir.int_to_ptr v337 : ptr; + hir.store v338, v329; + v339 = arith.constant 12 : u32; + v340 = arith.add v331, v339 : u32 #[overflow = checked]; + v341 = hir.int_to_ptr v340 : ptr; + hir.store v341, v330; builtin.ret ; }; - private builtin.function @miden::output_note::add_asset(v357: felt, v358: felt, v359: felt, v360: felt, v361: felt) { - ^block35(v357: felt, v358: felt, v359: felt, v360: felt, v361: felt): - hir.exec @miden/output_note/add_asset(v357, v358, v359, v360, v361) + private builtin.function @miden::native_account::remove_asset(v342: felt, v343: felt, v344: felt, v345: felt, v346: i32) { + ^block36(v342: felt, v343: felt, v344: felt, v345: felt, v346: i32): + v347, v348, v349, v350 = hir.exec @miden/native_account/remove_asset(v342, v343, v344, v345) : felt, felt, felt, felt + v351 = hir.bitcast v346 : u32; + v352 = hir.int_to_ptr v351 : ptr; + hir.store v352, v347; + v353 = arith.constant 4 : u32; + v354 = arith.add v351, v353 : u32 #[overflow = checked]; + v355 = hir.int_to_ptr v354 : ptr; + hir.store v355, v348; + v356 = arith.constant 8 : u32; + v357 = arith.add v351, v356 : u32 #[overflow = checked]; + v358 = hir.int_to_ptr v357 : ptr; + hir.store v358, v349; + v359 = arith.constant 12 : u32; + v360 = arith.add v351, v359 : u32 #[overflow = checked]; + v361 = hir.int_to_ptr v360 : ptr; + hir.store v361, v350; builtin.ret ; }; diff --git a/tests/integration/expected/examples/basic_wallet.masm b/tests/integration/expected/examples/basic_wallet.masm index cb029cd9a..d7c0b9e5b 100644 --- a/tests/integration/expected/examples/basic_wallet.masm +++ b/tests/integration/expected/examples/basic_wallet.masm @@ -166,7 +166,7 @@ proc miden:basic-wallet/basic-wallet@0.1.0#receive-asset(felt, felt, felt, felt) swap.1 trace.240 nop - exec.::miden:basic-wallet/basic-wallet@0.1.0::basic_wallet::miden_base_sys::bindings::account::add_asset + exec.::miden:basic-wallet/basic-wallet@0.1.0::basic_wallet::miden_base_sys::bindings::native_account::add_asset trace.252 nop push.32 @@ -294,7 +294,7 @@ proc miden:basic-wallet/basic-wallet@0.1.0#move-asset-to-note( swap.1 trace.240 nop - exec.::miden:basic-wallet/basic-wallet@0.1.0::basic_wallet::miden_base_sys::bindings::account::remove_asset + exec.::miden:basic-wallet/basic-wallet@0.1.0::basic_wallet::miden_base_sys::bindings::native_account::remove_asset trace.252 nop push.16 @@ -394,7 +394,7 @@ proc wit_bindgen::rt::run_ctors_once( end @callconv("C") -proc miden_base_sys::bindings::account::add_asset( +proc miden_base_sys::bindings::native_account::add_asset( i32, i32 ) @@ -473,7 +473,7 @@ proc miden_base_sys::bindings::account::add_asset( end @callconv("C") -proc miden_base_sys::bindings::account::remove_asset( +proc miden_base_sys::bindings::native_account::remove_asset( i32, i32 ) @@ -1002,6 +1002,15 @@ proc miden_stdlib_sys::intrinsics::word::Word::reverse( nop end +@callconv("C") +proc miden::output_note::add_asset(felt, felt, felt, felt, felt) + trace.240 + nop + exec.::miden::output_note::add_asset + trace.252 + nop +end + @callconv("C") proc miden::native_account::add_asset(felt, felt, felt, felt, i32) trace.240 @@ -1114,12 +1123,3 @@ proc miden::native_account::remove_asset(felt, felt, felt, felt, i32) nop end -@callconv("C") -proc miden::output_note::add_asset(felt, felt, felt, felt, felt) - trace.240 - nop - exec.::miden::output_note::add_asset - trace.252 - nop -end - diff --git a/tests/integration/expected/examples/basic_wallet.wat b/tests/integration/expected/examples/basic_wallet.wat index 3e58886d8..4fa434af9 100644 --- a/tests/integration/expected/examples/basic_wallet.wat +++ b/tests/integration/expected/examples/basic_wallet.wat @@ -54,7 +54,7 @@ i32.const 16 i32.add local.get 4 - call $miden_base_sys::bindings::account::add_asset + call $miden_base_sys::bindings::native_account::add_asset local.get 4 i32.const 32 i32.add @@ -84,7 +84,7 @@ i32.const 16 i32.add local.get 5 - call $miden_base_sys::bindings::account::remove_asset + call $miden_base_sys::bindings::native_account::remove_asset local.get 5 i32.const 16 i32.add @@ -113,7 +113,7 @@ i32.store8 end ) - (func $miden_base_sys::bindings::account::add_asset (;5;) (type 3) (param i32 i32) + (func $miden_base_sys::bindings::native_account::add_asset (;5;) (type 3) (param i32 i32) local.get 1 f32.load offset=12 local.get 1 @@ -125,7 +125,7 @@ local.get 0 call $miden::native_account::add_asset ) - (func $miden_base_sys::bindings::account::remove_asset (;6;) (type 3) (param i32 i32) + (func $miden_base_sys::bindings::native_account::remove_asset (;6;) (type 3) (param i32 i32) (local i32) global.get $__stack_pointer i32.const 32 @@ -230,13 +230,13 @@ i64.load align=4 i64.store ) - (func $miden::native_account::add_asset (;9;) (type 5) (param f32 f32 f32 f32 i32) + (func $miden::output_note::add_asset (;9;) (type 2) (param f32 f32 f32 f32 f32) unreachable ) - (func $miden::native_account::remove_asset (;10;) (type 5) (param f32 f32 f32 f32 i32) + (func $miden::native_account::add_asset (;10;) (type 5) (param f32 f32 f32 f32 i32) unreachable ) - (func $miden::output_note::add_asset (;11;) (type 2) (param f32 f32 f32 f32 f32) + (func $miden::native_account::remove_asset (;11;) (type 5) (param f32 f32 f32 f32 i32) unreachable ) (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") diff --git a/tests/integration/expected/examples/p2id.hir b/tests/integration/expected/examples/p2id.hir index f3a51af24..bee3abe48 100644 --- a/tests/integration/expected/examples/p2id.hir +++ b/tests/integration/expected/examples/p2id.hir @@ -134,7 +134,7 @@ builtin.component miden:base/note-script@1.0.0 { v85 = hir.load v84 : felt; v86 = arith.constant 8 : i32; v87 = arith.add v54, v86 : i32 #[overflow = wrapping]; - hir.exec @miden:base/note-script@1.0.0/p2id/miden_base_sys::bindings::account::get_id(v87) + hir.exec @miden:base/note-script@1.0.0/p2id/miden_base_sys::bindings::active_account::get_id(v87) v89 = arith.constant 12 : u32; v88 = hir.bitcast v54 : u32; v90 = arith.add v88, v89 : u32 #[overflow = checked]; @@ -607,7 +607,7 @@ builtin.component miden:base/note-script@1.0.0 { ub.unreachable ; }; - private builtin.function @miden_base_sys::bindings::account::get_id(v413: i32) { + private builtin.function @miden_base_sys::bindings::active_account::get_id(v413: i32) { ^block56(v413: i32): v415 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr v416 = hir.bitcast v415 : ptr; diff --git a/tests/integration/expected/examples/p2id.masm b/tests/integration/expected/examples/p2id.masm index 6b155a525..aa9e4e85e 100644 --- a/tests/integration/expected/examples/p2id.masm +++ b/tests/integration/expected/examples/p2id.masm @@ -302,7 +302,7 @@ proc miden:base/note-script@1.0.0#run(felt, felt, felt, felt) u32wrapping_add trace.240 nop - exec.::miden:base/note-script@1.0.0::p2id::miden_base_sys::bindings::account::get_id + exec.::miden:base/note-script@1.0.0::p2id::miden_base_sys::bindings::active_account::get_id trace.252 nop push.12 @@ -1217,7 +1217,9 @@ proc alloc::raw_vec::RawVecInner::with_capacity_in( end @callconv("C") -proc miden_base_sys::bindings::account::get_id(i32) +proc miden_base_sys::bindings::active_account::get_id( + i32 +) push.1114208 u32divmod.4 swap.1 diff --git a/tests/integration/expected/examples/p2id.wat b/tests/integration/expected/examples/p2id.wat index 7c566cbe6..aa2c8bf0b 100644 --- a/tests/integration/expected/examples/p2id.wat +++ b/tests/integration/expected/examples/p2id.wat @@ -103,7 +103,7 @@ local.get 4 i32.const 8 i32.add - call $miden_base_sys::bindings::account::get_id + call $miden_base_sys::bindings::active_account::get_id local.get 4 f32.load offset=12 local.set 8 @@ -354,7 +354,7 @@ i32.add global.set $__stack_pointer ) - (func $miden_base_sys::bindings::account::get_id (;13;) (type 8) (param i32) + (func $miden_base_sys::bindings::active_account::get_id (;13;) (type 8) (param i32) (local i32) global.get $__stack_pointer i32.const 16 diff --git a/tests/integration/expected/rust_sdk/rust_sdk_swapp_note_bindings.hir b/tests/integration/expected/rust_sdk/rust_sdk_swapp_note_bindings.hir index ee1fa3442..90c4ac11d 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_swapp_note_bindings.hir +++ b/tests/integration/expected/rust_sdk/rust_sdk_swapp_note_bindings.hir @@ -161,7 +161,7 @@ builtin.component miden:base/note-script@1.0.0 { v115 = arith.constant 32 : i32; v116 = arith.add v94, v115 : i32 #[overflow = wrapping]; hir.exec @miden:base/note-script@1.0.0/rust_sdk_swapp_note_bindings/miden_base_sys::bindings::active_note::get_serial_number(v116) - v117 = hir.exec @miden:base/note-script@1.0.0/rust_sdk_swapp_note_bindings/miden_base_sys::bindings::account::get_balance(v112, v105) : felt + v117 = hir.exec @miden:base/note-script@1.0.0/rust_sdk_swapp_note_bindings/miden_base_sys::bindings::active_account::get_balance(v112, v105) : felt v118 = hir.exec @miden:base/note-script@1.0.0/rust_sdk_swapp_note_bindings/intrinsics::felt::eq(v112, v112) : i32 v88 = arith.constant 0 : i32; v119 = arith.constant 1 : i32; @@ -295,7 +295,7 @@ builtin.component miden:base/note-script@1.0.0 { builtin.ret ; }; - private builtin.function @miden_base_sys::bindings::account::get_balance(v188: felt, v189: felt) -> felt { + private builtin.function @miden_base_sys::bindings::active_account::get_balance(v188: felt, v189: felt) -> felt { ^block27(v188: felt, v189: felt): v191 = hir.exec @miden:base/note-script@1.0.0/rust_sdk_swapp_note_bindings/miden::active_account::get_balance(v188, v189) : felt builtin.ret v191; diff --git a/tests/integration/expected/rust_sdk/rust_sdk_swapp_note_bindings.masm b/tests/integration/expected/rust_sdk/rust_sdk_swapp_note_bindings.masm index 1ea381efd..be5ca8d81 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_swapp_note_bindings.masm +++ b/tests/integration/expected/rust_sdk/rust_sdk_swapp_note_bindings.masm @@ -337,7 +337,7 @@ proc miden:base/note-script@1.0.0#run(felt, felt, felt, felt) dup.1 trace.240 nop - exec.::miden:base/note-script@1.0.0::rust_sdk_swapp_note_bindings::miden_base_sys::bindings::account::get_balance + exec.::miden:base/note-script@1.0.0::rust_sdk_swapp_note_bindings::miden_base_sys::bindings::active_account::get_balance trace.252 nop swap.1 @@ -538,7 +538,7 @@ proc wit_bindgen::rt::run_ctors_once( end @callconv("C") -proc miden_base_sys::bindings::account::get_balance( +proc miden_base_sys::bindings::active_account::get_balance( felt, felt ) -> felt diff --git a/tests/integration/expected/rust_sdk/rust_sdk_swapp_note_bindings.wat b/tests/integration/expected/rust_sdk/rust_sdk_swapp_note_bindings.wat index a17617e1d..90012617a 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_swapp_note_bindings.wat +++ b/tests/integration/expected/rust_sdk/rust_sdk_swapp_note_bindings.wat @@ -94,7 +94,7 @@ call $miden_base_sys::bindings::active_note::get_serial_number local.get 6 local.get 5 - call $miden_base_sys::bindings::account::get_balance + call $miden_base_sys::bindings::active_account::get_balance local.set 7 block ;; label = @1 local.get 6 @@ -159,7 +159,7 @@ i32.store8 end ) - (func $miden_base_sys::bindings::account::get_balance (;5;) (type 3) (param f32 f32) (result f32) + (func $miden_base_sys::bindings::active_account::get_balance (;5;) (type 3) (param f32 f32) (result f32) local.get 0 local.get 1 call $miden::active_account::get_balance diff --git a/tests/integration/src/rust_masm_tests/abi_transform/tx_kernel.rs b/tests/integration/src/rust_masm_tests/abi_transform/tx_kernel.rs index dbaeb7fff..ab58a9b7a 100644 --- a/tests/integration/src/rust_masm_tests/abi_transform/tx_kernel.rs +++ b/tests/integration/src/rust_masm_tests/abi_transform/tx_kernel.rs @@ -84,7 +84,7 @@ end #[test] fn test_get_id() { - let main_fn = "() -> AccountId { miden::account::get_id() }"; + let main_fn = "() -> AccountId { miden::active_account::get_id() }"; let artifact_name = "abi_transform_tx_kernel_get_id"; let config = WasmTranslationConfig::default(); let test_builder = diff --git a/tests/integration/src/rust_masm_tests/rust_sdk/base/account.rs b/tests/integration/src/rust_masm_tests/rust_sdk/base/account.rs index 2bc091731..835b1b0f6 100644 --- a/tests/integration/src/rust_masm_tests/rust_sdk/base/account.rs +++ b/tests/integration/src/rust_masm_tests/rust_sdk/base/account.rs @@ -75,7 +75,7 @@ fn rust_sdk_account_get_code_commitment_binding() { run_account_binding_test( "rust_sdk_account_get_code_commitment_binding", "pub fn binding(&self) -> Word { - account::get_code_commitment() + active_account::get_code_commitment() }", ); } @@ -85,7 +85,7 @@ fn rust_sdk_account_get_initial_storage_commitment_binding() { run_account_binding_test( "rust_sdk_account_get_initial_storage_commitment_binding", "pub fn binding(&self) -> Word { - account::get_initial_storage_commitment() + active_account::get_initial_storage_commitment() }", ); } @@ -95,7 +95,7 @@ fn rust_sdk_account_compute_storage_commitment_binding() { run_account_binding_test( "rust_sdk_account_compute_storage_commitment_binding", "pub fn binding(&self) -> Word { - account::compute_storage_commitment() + active_account::compute_storage_commitment() }", ); } @@ -105,7 +105,7 @@ fn rust_sdk_account_compute_commitment_binding() { run_account_binding_test( "rust_sdk_account_compute_commitment_binding", "pub fn binding(&self) -> Word { - account::compute_commitment() + active_account::compute_commitment() }", ); } @@ -115,7 +115,7 @@ fn rust_sdk_account_compute_delta_commitment_binding() { run_account_binding_test( "rust_sdk_account_compute_delta_commitment_binding", "pub fn binding(&self) -> Word { - account::compute_delta_commitment() + native_account::compute_delta_commitment() }", ); } @@ -126,7 +126,7 @@ fn rust_sdk_account_get_initial_balance_binding() { "rust_sdk_account_get_initial_balance_binding", "pub fn binding(&self) -> Felt { let faucet = AccountId { prefix: Felt::from_u32(1), suffix: Felt::from_u32(0) }; - account::get_initial_balance(faucet) + active_account::get_initial_balance(faucet) }", ); } @@ -137,7 +137,7 @@ fn rust_sdk_account_has_non_fungible_asset_binding() { "rust_sdk_account_has_non_fungible_asset_binding", "pub fn binding(&self) -> Felt { let asset = Asset::from([Felt::from_u32(0); 4]); - if account::has_non_fungible_asset(asset) { + if active_account::has_non_fungible_asset(asset) { Felt::from_u32(1) } else { Felt::from_u32(0) @@ -151,7 +151,7 @@ fn rust_sdk_account_get_initial_vault_root_binding() { run_account_binding_test( "rust_sdk_account_get_initial_vault_root_binding", "pub fn binding(&self) -> Word { - account::get_initial_vault_root() + active_account::get_initial_vault_root() }", ); } @@ -161,7 +161,7 @@ fn rust_sdk_account_get_vault_root_binding() { run_account_binding_test( "rust_sdk_account_get_vault_root_binding", "pub fn binding(&self) -> Word { - account::get_vault_root() + active_account::get_vault_root() }", ); } @@ -171,7 +171,7 @@ fn rust_sdk_account_get_num_procedures_binding() { run_account_binding_test( "rust_sdk_account_get_num_procedures_binding", "pub fn binding(&self) -> Felt { - account::get_num_procedures() + active_account::get_num_procedures() }", ); } @@ -181,7 +181,7 @@ fn rust_sdk_account_get_procedure_root_binding() { run_account_binding_test( "rust_sdk_account_get_procedure_root_binding", "pub fn binding(&self) -> Word { - account::get_procedure_root(0) + active_account::get_procedure_root(0) }", ); } @@ -192,7 +192,7 @@ fn rust_sdk_account_has_procedure_binding() { "rust_sdk_account_has_procedure_binding", "pub fn binding(&self) -> Felt { let proc_root = Word::from([Felt::from_u32(0); 4]); - if account::has_procedure(proc_root) { + if active_account::has_procedure(proc_root) { Felt::from_u32(1) } else { Felt::from_u32(0) @@ -207,7 +207,7 @@ fn rust_sdk_account_was_procedure_called_binding() { "rust_sdk_account_was_procedure_called_binding", "pub fn binding(&self) -> Felt { let proc_root = Word::from([Felt::from_u32(0); 4]); - if account::was_procedure_called(proc_root) { + if native_account::was_procedure_called(proc_root) { Felt::from_u32(1) } else { Felt::from_u32(0) diff --git a/tests/integration/src/rust_masm_tests/rust_sdk/mod.rs b/tests/integration/src/rust_masm_tests/rust_sdk/mod.rs index 0d79a4acf..b72573195 100644 --- a/tests/integration/src/rust_masm_tests/rust_sdk/mod.rs +++ b/tests/integration/src/rust_masm_tests/rust_sdk/mod.rs @@ -101,7 +101,7 @@ fn run(_arg: Word) { let sender = active_note::get_sender(); let script_root = active_note::get_script_root(); let serial_number = active_note::get_serial_number(); - let balance = account::get_balance(sender); + let balance = active_account::get_balance(sender); assert_eq!(sender.prefix, sender.prefix); assert_eq!(sender.suffix, sender.suffix); diff --git a/tests/rust-apps-wasm/rust-sdk/account-test/src/lib.rs b/tests/rust-apps-wasm/rust-sdk/account-test/src/lib.rs index 9f31fc6aa..fa1d186b8 100644 --- a/tests/rust-apps-wasm/rust-sdk/account-test/src/lib.rs +++ b/tests/rust-apps-wasm/rust-sdk/account-test/src/lib.rs @@ -10,7 +10,7 @@ pub struct Account; impl Account { #[no_mangle] pub fn get_wallet_magic_number() -> Felt { - let acc_id = miden::account::get_id(); + let acc_id = miden::active_account::get_id(); let magic = felt!(42); magic + acc_id.into() } @@ -18,7 +18,7 @@ impl Account { #[no_mangle] pub fn test_add_asset() -> Felt { let asset_in = Asset::new([felt!(1), felt!(2), felt!(3), felt!(4)]); - let asset_out = miden::account::add_asset(asset_in); + let asset_out = miden::native_account::add_asset(asset_in); asset_out.as_word()[0] } @@ -88,7 +88,7 @@ pub fn test_pipe_double_words_to_memory(num_words: Felt) -> (Word, Vec) { #[no_mangle] pub fn test_remove_asset(asset: Asset) -> Felt { - let asset_out = miden::account::remove_asset(asset); + let asset_out = miden::native_account::remove_asset(asset); asset_out.as_word()[0] } From 61d9b20004923723d5705addb57040438449b579 Mon Sep 17 00:00:00 2001 From: Denys Zadorozhnyi Date: Thu, 6 Nov 2025 13:14:02 +0200 Subject: [PATCH 15/19] feature: fix `sha256::hash_1to1` bindings (big-endian), extract the hash tests into a separate module. --- frontend/wasm/src/miden_abi/stdlib.rs | 1 + .../src/miden_abi/stdlib/crypto/hashes/mod.rs | 1 + .../miden_abi/stdlib/crypto/hashes/sha256.rs | 43 + frontend/wasm/src/miden_abi/transform.rs | 16 +- hir-symbol/src/symbols.toml | 2 + sdk/stdlib-sys/src/stdlib/crypto/hashes.rs | 23 +- .../expected/rust_sdk_stdlib_sha256_hash.hir | 431 ++++++++ .../expected/rust_sdk_stdlib_sha256_hash.masm | 933 ++++++++++++++++++ .../expected/rust_sdk_stdlib_sha256_hash.wat | 199 ++++ .../rust_masm_tests/abi_transform/stdlib.rs | 65 -- .../src/rust_masm_tests/rust_sdk/mod.rs | 1 + .../rust_masm_tests/rust_sdk/stdlib/hashes.rs | 98 ++ .../rust_masm_tests/rust_sdk/stdlib/mod.rs | 1 + 13 files changed, 1744 insertions(+), 70 deletions(-) create mode 100644 frontend/wasm/src/miden_abi/stdlib/crypto/hashes/sha256.rs create mode 100644 tests/integration/expected/rust_sdk_stdlib_sha256_hash.hir create mode 100644 tests/integration/expected/rust_sdk_stdlib_sha256_hash.masm create mode 100644 tests/integration/expected/rust_sdk_stdlib_sha256_hash.wat create mode 100644 tests/integration/src/rust_masm_tests/rust_sdk/stdlib/hashes.rs create mode 100644 tests/integration/src/rust_masm_tests/rust_sdk/stdlib/mod.rs diff --git a/frontend/wasm/src/miden_abi/stdlib.rs b/frontend/wasm/src/miden_abi/stdlib.rs index 91ed49a1a..2af3a5c23 100644 --- a/frontend/wasm/src/miden_abi/stdlib.rs +++ b/frontend/wasm/src/miden_abi/stdlib.rs @@ -11,6 +11,7 @@ pub(crate) fn signatures() -> &'static ModuleFunctionTypeMap { static TYPES: LazyLock = LazyLock::new(|| { let mut m: ModuleFunctionTypeMap = Default::default(); m.extend(crypto::hashes::blake3::signatures()); + m.extend(crypto::hashes::sha256::signatures()); m.extend(crypto::hashes::rpo::signatures()); m.extend(crypto::dsa::rpo_falcon512::signatures()); m.extend(mem::signatures()); diff --git a/frontend/wasm/src/miden_abi/stdlib/crypto/hashes/mod.rs b/frontend/wasm/src/miden_abi/stdlib/crypto/hashes/mod.rs index 2e2b08344..d37382e82 100644 --- a/frontend/wasm/src/miden_abi/stdlib/crypto/hashes/mod.rs +++ b/frontend/wasm/src/miden_abi/stdlib/crypto/hashes/mod.rs @@ -1,2 +1,3 @@ pub mod blake3; pub mod rpo; +pub mod sha256; diff --git a/frontend/wasm/src/miden_abi/stdlib/crypto/hashes/sha256.rs b/frontend/wasm/src/miden_abi/stdlib/crypto/hashes/sha256.rs new file mode 100644 index 000000000..d84bc2bc7 --- /dev/null +++ b/frontend/wasm/src/miden_abi/stdlib/crypto/hashes/sha256.rs @@ -0,0 +1,43 @@ +use midenc_hir::{ + interner::{symbols, Symbol}, + CallConv, FunctionType, SymbolNameComponent, SymbolPath, + Type::*, +}; + +use crate::miden_abi::{FunctionTypeMap, ModuleFunctionTypeMap}; + +pub const MODULE_ID: &str = "std::crypto::hashes::sha256"; + +pub const HASH_1TO1: &str = "hash_1to1"; +pub const HASH_2TO1: &str = "hash_2to1"; + +pub(crate) fn signatures() -> ModuleFunctionTypeMap { + let mut m: ModuleFunctionTypeMap = Default::default(); + let mut sha256: FunctionTypeMap = Default::default(); + sha256.insert( + Symbol::from(HASH_1TO1), + FunctionType::new( + CallConv::Wasm, + [I32, I32, I32, I32, I32, I32, I32, I32], + [I32, I32, I32, I32, I32, I32, I32, I32], + ), + ); + sha256.insert( + Symbol::from(HASH_2TO1), + FunctionType::new( + CallConv::Wasm, + [I32, I32, I32, I32, I32, I32, I32, I32, I32, I32, I32, I32, I32, I32, I32, I32], + [I32, I32, I32, I32, I32, I32, I32, I32], + ), + ); + + let module_path = SymbolPath::from_iter([ + SymbolNameComponent::Root, + SymbolNameComponent::Component(symbols::Std), + SymbolNameComponent::Component(symbols::Crypto), + SymbolNameComponent::Component(symbols::Hashes), + SymbolNameComponent::Component(Symbol::intern("sha256")), + ]); + m.insert(module_path, sha256); + m +} diff --git a/frontend/wasm/src/miden_abi/transform.rs b/frontend/wasm/src/miden_abi/transform.rs index 273fa05ce..dd5055902 100644 --- a/frontend/wasm/src/miden_abi/transform.rs +++ b/frontend/wasm/src/miden_abi/transform.rs @@ -1,9 +1,8 @@ use midenc_dialect_arith::ArithOpBuilder; use midenc_dialect_hir::HirOpBuilder; use midenc_hir::{ - dialects::builtin::FunctionRef, - interner::{symbols, Symbol}, - Builder, Immediate, PointerType, SymbolNameComponent, SymbolPath, Type, ValueRef, + dialects::builtin::FunctionRef, interner::symbols, Builder, Immediate, PointerType, + SymbolNameComponent, SymbolPath, Type, ValueRef, }; use super::{stdlib, tx_kernel}; @@ -44,7 +43,16 @@ fn get_transform_strategy(path: &SymbolPath) -> Option { _ => None, } } - name if name == Symbol::intern("rpo") => { + symbols::Sha256 => { + match components.next_if(|c| c.is_leaf())?.as_symbol_name().as_str() { + stdlib::crypto::hashes::sha256::HASH_1TO1 + | stdlib::crypto::hashes::sha256::HASH_2TO1 => { + Some(TransformStrategy::ReturnViaPointer) + } + _ => None, + } + } + symbols::Rpo => { match components.next_if(|c| c.is_leaf())?.as_symbol_name().as_str() { stdlib::crypto::hashes::rpo::HASH_MEMORY | stdlib::crypto::hashes::rpo::HASH_MEMORY_WORDS => { diff --git a/hir-symbol/src/symbols.toml b/hir-symbol/src/symbols.toml index e19817031..4b6ec06f5 100644 --- a/hir-symbol/src/symbols.toml +++ b/hir-symbol/src/symbols.toml @@ -107,6 +107,7 @@ active_account = {} active_note = {} input_note = {} blake3 = {} +sha256 = {} crypto = {} debug = {} dsa = {} @@ -121,3 +122,4 @@ output_note = {} rpo_falcon512 = {} std = {} tx = {} +rpo = {} diff --git a/sdk/stdlib-sys/src/stdlib/crypto/hashes.rs b/sdk/stdlib-sys/src/stdlib/crypto/hashes.rs index 40c94578b..db28e8737 100644 --- a/sdk/stdlib-sys/src/stdlib/crypto/hashes.rs +++ b/sdk/stdlib-sys/src/stdlib/crypto/hashes.rs @@ -196,7 +196,28 @@ pub fn blake3_hash_2to1(input: [u8; 64]) -> [u8; 32] { /// Hashes a 32-byte input to a 32-byte output using the SHA256 hash function. #[inline] pub fn sha256_hash_1to1(input: [u8; 32]) -> [u8; 32] { - hash_1to1(input, extern_sha256_hash_1to1) + use crate::intrinsics::WordAligned; + + let swapped_words = { + let mut be_bytes = input; + for chunk in be_bytes.chunks_exact_mut(4) { + chunk.reverse(); + } + unsafe { core::mem::transmute::<[u8; 32], [u32; 8]>(be_bytes) } + }; + + let [w0, w1, w2, w3, w4, w5, w6, w7] = swapped_words; + + unsafe { + let mut ret_area = ::core::mem::MaybeUninit::>::uninit(); + let ptr = ret_area.as_mut_ptr() as *mut u8; + extern_sha256_hash_1to1(w0, w1, w2, w3, w4, w5, w6, w7, ptr); + let mut output = ret_area.assume_init().into_inner(); + for chunk in output.chunks_exact_mut(4) { + chunk.reverse(); + } + output + } } /// Hashes a 64-byte input to a 32-byte output using the SHA256 hash function. diff --git a/tests/integration/expected/rust_sdk_stdlib_sha256_hash.hir b/tests/integration/expected/rust_sdk_stdlib_sha256_hash.hir new file mode 100644 index 000000000..fb696203a --- /dev/null +++ b/tests/integration/expected/rust_sdk_stdlib_sha256_hash.hir @@ -0,0 +1,431 @@ +builtin.component root_ns:root@1.0.0 { + builtin.module public @rust_sdk_stdlib_sha256_hash { + private builtin.function @core::slice::::reverse(v0: i32) { + ^block4(v0: i32): + v2 = arith.constant 3 : i32; + v3 = arith.add v0, v2 : i32 #[overflow = wrapping]; + v1 = arith.constant 0 : i32; + v333, v334, v335 = scf.while v1, v0, v3 : i32, i32, i32 { + ^block7(v5: i32, v12: i32, v19: i32): + v354 = arith.constant 0 : i32; + v6 = arith.constant 2 : i32; + v7 = arith.eq v5, v6 : i1; + v8 = arith.zext v7 : u32; + v9 = hir.bitcast v8 : i32; + v11 = arith.neq v9, v354 : i1; + v348, v349 = scf.if v11 : i32, i32 { + ^block33: + v326 = ub.poison i32 : i32; + scf.yield v326, v326; + } else { + ^block9: + v13 = arith.add v12, v5 : i32 #[overflow = wrapping]; + v14 = hir.bitcast v13 : u32; + v15 = hir.int_to_ptr v14 : ptr; + v16 = hir.load v15 : u8; + v20 = hir.bitcast v19 : u32; + v21 = hir.int_to_ptr v20 : ptr; + v22 = hir.load v21 : u8; + v23 = arith.zext v22 : u32; + v24 = hir.bitcast v23 : i32; + v25 = hir.bitcast v24 : u32; + v26 = arith.trunc v25 : u8; + v27 = hir.bitcast v13 : u32; + v28 = hir.int_to_ptr v27 : ptr; + hir.store v28, v26; + v17 = arith.zext v16 : u32; + v18 = hir.bitcast v17 : i32; + v29 = hir.bitcast v18 : u32; + v30 = arith.trunc v29 : u8; + v31 = hir.bitcast v19 : u32; + v32 = hir.int_to_ptr v31 : ptr; + hir.store v32, v30; + v33 = arith.constant -1 : i32; + v34 = arith.add v19, v33 : i32 #[overflow = wrapping]; + v35 = arith.constant 1 : i32; + v36 = arith.add v5, v35 : i32 #[overflow = wrapping]; + scf.yield v36, v34; + }; + v353 = ub.poison i32 : i32; + v350 = cf.select v11, v353, v12 : i32; + v325 = arith.constant 1 : u32; + v319 = arith.constant 0 : u32; + v352 = cf.select v11, v319, v325 : u32; + v342 = arith.trunc v352 : i1; + scf.condition v342, v348, v350, v349; + } do { + ^block32(v339: i32, v340: i32, v341: i32): + scf.yield v339, v340, v341; + }; + builtin.ret ; + }; + + public builtin.function @entrypoint(v37: i32, v38: i32) { + ^block10(v37: i32, v38: i32): + v40 = builtin.global_symbol @root_ns:root@1.0.0/rust_sdk_stdlib_sha256_hash/__stack_pointer : ptr + v41 = hir.bitcast v40 : ptr; + v42 = hir.load v41 : i32; + v45 = arith.constant -32 : i32; + v43 = arith.constant 64 : i32; + v44 = arith.sub v42, v43 : i32 #[overflow = wrapping]; + v46 = arith.band v44, v45 : i32; + v47 = builtin.global_symbol @root_ns:root@1.0.0/rust_sdk_stdlib_sha256_hash/__stack_pointer : ptr + v48 = hir.bitcast v47 : ptr; + hir.store v48, v46; + v51 = arith.constant 24 : i32; + v54 = arith.add v38, v51 : i32 #[overflow = wrapping]; + v55 = hir.bitcast v54 : u32; + v56 = hir.int_to_ptr v55 : ptr; + v57 = hir.load v56 : i64; + v564 = arith.constant 24 : i32; + v49 = arith.constant 32 : i32; + v50 = arith.add v46, v49 : i32 #[overflow = wrapping]; + v52 = arith.add v50, v564 : i32 #[overflow = wrapping]; + v58 = hir.bitcast v52 : u32; + v59 = arith.constant 8 : u32; + v60 = arith.mod v58, v59 : u32; + hir.assertz v60 #[code = 250]; + v61 = hir.int_to_ptr v58 : ptr; + hir.store v61, v57; + v64 = arith.constant 16 : i32; + v67 = arith.add v38, v64 : i32 #[overflow = wrapping]; + v68 = hir.bitcast v67 : u32; + v69 = hir.int_to_ptr v68 : ptr; + v70 = hir.load v69 : i64; + v562 = arith.constant 16 : i32; + v563 = arith.constant 32 : i32; + v63 = arith.add v46, v563 : i32 #[overflow = wrapping]; + v65 = arith.add v63, v562 : i32 #[overflow = wrapping]; + v71 = hir.bitcast v65 : u32; + v561 = arith.constant 8 : u32; + v73 = arith.mod v71, v561 : u32; + hir.assertz v73 #[code = 250]; + v74 = hir.int_to_ptr v71 : ptr; + hir.store v74, v70; + v77 = arith.constant 8 : i32; + v80 = arith.add v38, v77 : i32 #[overflow = wrapping]; + v81 = hir.bitcast v80 : u32; + v82 = hir.int_to_ptr v81 : ptr; + v83 = hir.load v82 : i64; + v559 = arith.constant 8 : i32; + v560 = arith.constant 32 : i32; + v76 = arith.add v46, v560 : i32 #[overflow = wrapping]; + v78 = arith.add v76, v559 : i32 #[overflow = wrapping]; + v84 = hir.bitcast v78 : u32; + v558 = arith.constant 8 : u32; + v86 = arith.mod v84, v558 : u32; + hir.assertz v86 #[code = 250]; + v87 = hir.int_to_ptr v84 : ptr; + hir.store v87, v83; + v88 = hir.bitcast v38 : u32; + v89 = hir.int_to_ptr v88 : ptr; + v90 = hir.load v89 : i64; + v92 = arith.constant 32 : u32; + v91 = hir.bitcast v46 : u32; + v93 = arith.add v91, v92 : u32 #[overflow = checked]; + v557 = arith.constant 8 : u32; + v95 = arith.mod v93, v557 : u32; + hir.assertz v95 #[code = 250]; + v96 = hir.int_to_ptr v93 : ptr; + hir.store v96, v90; + v39 = arith.constant 0 : i32; + v490, v491, v492, v493, v494, v495, v496 = scf.while v39, v46, v37, v42 : i32, i32, i32, i32, i32, i32, i32 { + ^block49(v497: i32, v498: i32, v499: i32, v500: i32): + v555 = arith.constant 0 : i32; + v556 = arith.constant 32 : i32; + v100 = arith.eq v497, v556 : i1; + v101 = arith.zext v100 : u32; + v102 = hir.bitcast v101 : i32; + v104 = arith.neq v102, v555 : i1; + v484 = scf.if v104 : i32 { + ^block45: + v363 = ub.poison i32 : i32; + scf.yield v363; + } else { + ^block15: + v554 = arith.constant 32 : i32; + v107 = arith.add v498, v554 : i32 #[overflow = wrapping]; + v108 = arith.add v107, v497 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/rust_sdk_stdlib_sha256_hash/core::slice::::reverse(v108) + v109 = arith.constant 4 : i32; + v110 = arith.add v497, v109 : i32 #[overflow = wrapping]; + scf.yield v110; + }; + v551 = ub.poison i32 : i32; + v487 = cf.select v104, v551, v500 : i32; + v552 = ub.poison i32 : i32; + v486 = cf.select v104, v552, v499 : i32; + v553 = ub.poison i32 : i32; + v485 = cf.select v104, v553, v498 : i32; + v362 = arith.constant 1 : u32; + v355 = arith.constant 0 : u32; + v489 = cf.select v104, v355, v362 : u32; + v447 = arith.trunc v489 : i1; + scf.condition v447, v484, v485, v486, v487, v498, v499, v500; + } do { + ^block50(v501: i32, v502: i32, v503: i32, v504: i32, v505: i32, v506: i32, v507: i32): + scf.yield v501, v502, v503, v504; + }; + v550 = arith.constant 32 : u32; + v111 = hir.bitcast v494 : u32; + v113 = arith.add v111, v550 : u32 #[overflow = checked]; + v114 = arith.constant 4 : u32; + v115 = arith.mod v113, v114 : u32; + hir.assertz v115 #[code = 250]; + v116 = hir.int_to_ptr v113 : ptr; + v117 = hir.load v116 : i32; + v119 = arith.constant 36 : u32; + v118 = hir.bitcast v494 : u32; + v120 = arith.add v118, v119 : u32 #[overflow = checked]; + v549 = arith.constant 4 : u32; + v122 = arith.mod v120, v549 : u32; + hir.assertz v122 #[code = 250]; + v123 = hir.int_to_ptr v120 : ptr; + v124 = hir.load v123 : i32; + v126 = arith.constant 40 : u32; + v125 = hir.bitcast v494 : u32; + v127 = arith.add v125, v126 : u32 #[overflow = checked]; + v548 = arith.constant 4 : u32; + v129 = arith.mod v127, v548 : u32; + hir.assertz v129 #[code = 250]; + v130 = hir.int_to_ptr v127 : ptr; + v131 = hir.load v130 : i32; + v133 = arith.constant 44 : u32; + v132 = hir.bitcast v494 : u32; + v134 = arith.add v132, v133 : u32 #[overflow = checked]; + v547 = arith.constant 4 : u32; + v136 = arith.mod v134, v547 : u32; + hir.assertz v136 #[code = 250]; + v137 = hir.int_to_ptr v134 : ptr; + v138 = hir.load v137 : i32; + v140 = arith.constant 48 : u32; + v139 = hir.bitcast v494 : u32; + v141 = arith.add v139, v140 : u32 #[overflow = checked]; + v546 = arith.constant 4 : u32; + v143 = arith.mod v141, v546 : u32; + hir.assertz v143 #[code = 250]; + v144 = hir.int_to_ptr v141 : ptr; + v145 = hir.load v144 : i32; + v147 = arith.constant 52 : u32; + v146 = hir.bitcast v494 : u32; + v148 = arith.add v146, v147 : u32 #[overflow = checked]; + v545 = arith.constant 4 : u32; + v150 = arith.mod v148, v545 : u32; + hir.assertz v150 #[code = 250]; + v151 = hir.int_to_ptr v148 : ptr; + v152 = hir.load v151 : i32; + v154 = arith.constant 56 : u32; + v153 = hir.bitcast v494 : u32; + v155 = arith.add v153, v154 : u32 #[overflow = checked]; + v544 = arith.constant 4 : u32; + v157 = arith.mod v155, v544 : u32; + hir.assertz v157 #[code = 250]; + v158 = hir.int_to_ptr v155 : ptr; + v159 = hir.load v158 : i32; + v161 = arith.constant 60 : u32; + v160 = hir.bitcast v494 : u32; + v162 = arith.add v160, v161 : u32 #[overflow = checked]; + v543 = arith.constant 4 : u32; + v164 = arith.mod v162, v543 : u32; + hir.assertz v164 #[code = 250]; + v165 = hir.int_to_ptr v162 : ptr; + v166 = hir.load v165 : i32; + hir.exec @root_ns:root@1.0.0/rust_sdk_stdlib_sha256_hash/std::crypto::hashes::sha256::hash_1to1(v117, v124, v131, v138, v145, v152, v159, v166, v494) + v168 = arith.constant 24 : u32; + v167 = hir.bitcast v494 : u32; + v169 = arith.add v167, v168 : u32 #[overflow = checked]; + v542 = arith.constant 8 : u32; + v171 = arith.mod v169, v542 : u32; + hir.assertz v171 #[code = 250]; + v172 = hir.int_to_ptr v169 : ptr; + v173 = hir.load v172 : i64; + v541 = arith.constant 56 : u32; + v174 = hir.bitcast v494 : u32; + v176 = arith.add v174, v541 : u32 #[overflow = checked]; + v540 = arith.constant 8 : u32; + v178 = arith.mod v176, v540 : u32; + hir.assertz v178 #[code = 250]; + v179 = hir.int_to_ptr v176 : ptr; + hir.store v179, v173; + v181 = arith.constant 16 : u32; + v180 = hir.bitcast v494 : u32; + v182 = arith.add v180, v181 : u32 #[overflow = checked]; + v539 = arith.constant 8 : u32; + v184 = arith.mod v182, v539 : u32; + hir.assertz v184 #[code = 250]; + v185 = hir.int_to_ptr v182 : ptr; + v186 = hir.load v185 : i64; + v538 = arith.constant 48 : u32; + v187 = hir.bitcast v494 : u32; + v189 = arith.add v187, v538 : u32 #[overflow = checked]; + v537 = arith.constant 8 : u32; + v191 = arith.mod v189, v537 : u32; + hir.assertz v191 #[code = 250]; + v192 = hir.int_to_ptr v189 : ptr; + hir.store v192, v186; + v536 = arith.constant 8 : u32; + v193 = hir.bitcast v494 : u32; + v195 = arith.add v193, v536 : u32 #[overflow = checked]; + v535 = arith.constant 8 : u32; + v197 = arith.mod v195, v535 : u32; + hir.assertz v197 #[code = 250]; + v198 = hir.int_to_ptr v195 : ptr; + v199 = hir.load v198 : i64; + v534 = arith.constant 40 : u32; + v200 = hir.bitcast v494 : u32; + v202 = arith.add v200, v534 : u32 #[overflow = checked]; + v533 = arith.constant 8 : u32; + v204 = arith.mod v202, v533 : u32; + hir.assertz v204 #[code = 250]; + v205 = hir.int_to_ptr v202 : ptr; + hir.store v205, v199; + v206 = hir.bitcast v494 : u32; + v532 = arith.constant 8 : u32; + v208 = arith.mod v206, v532 : u32; + hir.assertz v208 #[code = 250]; + v209 = hir.int_to_ptr v206 : ptr; + v210 = hir.load v209 : i64; + v531 = arith.constant 32 : u32; + v211 = hir.bitcast v494 : u32; + v213 = arith.add v211, v531 : u32 #[overflow = checked]; + v530 = arith.constant 8 : u32; + v215 = arith.mod v213, v530 : u32; + hir.assertz v215 #[code = 250]; + v216 = hir.int_to_ptr v213 : ptr; + hir.store v216, v210; + v529 = arith.constant 0 : i32; + v466, v467, v468, v469, v470, v471, v472 = scf.while v529, v494, v495, v496 : i32, i32, i32, i32, i32, i32, i32 { + ^block47(v473: i32, v474: i32, v475: i32, v476: i32): + v527 = arith.constant 0 : i32; + v528 = arith.constant 32 : i32; + v220 = arith.eq v473, v528 : i1; + v221 = arith.zext v220 : u32; + v222 = hir.bitcast v221 : i32; + v224 = arith.neq v222, v527 : i1; + v460 = scf.if v224 : i32 { + ^block46: + v526 = ub.poison i32 : i32; + scf.yield v526; + } else { + ^block19: + v525 = arith.constant 32 : i32; + v227 = arith.add v474, v525 : i32 #[overflow = wrapping]; + v228 = arith.add v227, v473 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/rust_sdk_stdlib_sha256_hash/core::slice::::reverse(v228) + v524 = arith.constant 4 : i32; + v230 = arith.add v473, v524 : i32 #[overflow = wrapping]; + scf.yield v230; + }; + v519 = ub.poison i32 : i32; + v463 = cf.select v224, v519, v476 : i32; + v520 = ub.poison i32 : i32; + v462 = cf.select v224, v520, v475 : i32; + v521 = ub.poison i32 : i32; + v461 = cf.select v224, v521, v474 : i32; + v522 = arith.constant 1 : u32; + v523 = arith.constant 0 : u32; + v465 = cf.select v224, v523, v522 : u32; + v402 = arith.trunc v465 : i1; + scf.condition v402, v460, v461, v462, v463, v474, v475, v476; + } do { + ^block48(v477: i32, v478: i32, v479: i32, v480: i32, v481: i32, v482: i32, v483: i32): + scf.yield v477, v478, v479, v480; + }; + v518 = arith.constant 32 : u32; + v233 = hir.bitcast v470 : u32; + v235 = arith.add v233, v518 : u32 #[overflow = checked]; + v517 = arith.constant 8 : u32; + v237 = arith.mod v235, v517 : u32; + hir.assertz v237 #[code = 250]; + v238 = hir.int_to_ptr v235 : ptr; + v239 = hir.load v238 : i64; + v240 = hir.bitcast v471 : u32; + v241 = hir.int_to_ptr v240 : ptr; + hir.store v241, v239; + v516 = arith.constant 56 : u32; + v244 = hir.bitcast v470 : u32; + v246 = arith.add v244, v516 : u32 #[overflow = checked]; + v515 = arith.constant 8 : u32; + v248 = arith.mod v246, v515 : u32; + hir.assertz v248 #[code = 250]; + v249 = hir.int_to_ptr v246 : ptr; + v250 = hir.load v249 : i64; + v514 = arith.constant 24 : i32; + v243 = arith.add v471, v514 : i32 #[overflow = wrapping]; + v251 = hir.bitcast v243 : u32; + v252 = hir.int_to_ptr v251 : ptr; + hir.store v252, v250; + v513 = arith.constant 48 : u32; + v255 = hir.bitcast v470 : u32; + v257 = arith.add v255, v513 : u32 #[overflow = checked]; + v512 = arith.constant 8 : u32; + v259 = arith.mod v257, v512 : u32; + hir.assertz v259 #[code = 250]; + v260 = hir.int_to_ptr v257 : ptr; + v261 = hir.load v260 : i64; + v511 = arith.constant 16 : i32; + v254 = arith.add v471, v511 : i32 #[overflow = wrapping]; + v262 = hir.bitcast v254 : u32; + v263 = hir.int_to_ptr v262 : ptr; + hir.store v263, v261; + v510 = arith.constant 40 : u32; + v266 = hir.bitcast v470 : u32; + v268 = arith.add v266, v510 : u32 #[overflow = checked]; + v509 = arith.constant 8 : u32; + v270 = arith.mod v268, v509 : u32; + hir.assertz v270 #[code = 250]; + v271 = hir.int_to_ptr v268 : ptr; + v272 = hir.load v271 : i64; + v508 = arith.constant 8 : i32; + v265 = arith.add v471, v508 : i32 #[overflow = wrapping]; + v273 = hir.bitcast v265 : u32; + v274 = hir.int_to_ptr v273 : ptr; + hir.store v274, v272; + v277 = builtin.global_symbol @root_ns:root@1.0.0/rust_sdk_stdlib_sha256_hash/__stack_pointer : ptr + v278 = hir.bitcast v277 : ptr; + hir.store v278, v472; + builtin.ret ; + }; + + private builtin.function @std::crypto::hashes::sha256::hash_1to1(v279: i32, v280: i32, v281: i32, v282: i32, v283: i32, v284: i32, v285: i32, v286: i32, v287: i32) { + ^block20(v279: i32, v280: i32, v281: i32, v282: i32, v283: i32, v284: i32, v285: i32, v286: i32, v287: i32): + v288, v289, v290, v291, v292, v293, v294, v295 = hir.exec @std/crypto/hashes/sha256/hash_1to1(v279, v280, v281, v282, v283, v284, v285, v286) : i32, i32, i32, i32, i32, i32, i32, i32 + v296 = hir.bitcast v287 : u32; + v297 = hir.int_to_ptr v296 : ptr; + hir.store v297, v288; + v298 = arith.constant 4 : u32; + v299 = arith.add v296, v298 : u32 #[overflow = checked]; + v300 = hir.int_to_ptr v299 : ptr; + hir.store v300, v289; + v301 = arith.constant 8 : u32; + v302 = arith.add v296, v301 : u32 #[overflow = checked]; + v303 = hir.int_to_ptr v302 : ptr; + hir.store v303, v290; + v304 = arith.constant 12 : u32; + v305 = arith.add v296, v304 : u32 #[overflow = checked]; + v306 = hir.int_to_ptr v305 : ptr; + hir.store v306, v291; + v307 = arith.constant 16 : u32; + v308 = arith.add v296, v307 : u32 #[overflow = checked]; + v309 = hir.int_to_ptr v308 : ptr; + hir.store v309, v292; + v310 = arith.constant 20 : u32; + v311 = arith.add v296, v310 : u32 #[overflow = checked]; + v312 = hir.int_to_ptr v311 : ptr; + hir.store v312, v293; + v313 = arith.constant 24 : u32; + v314 = arith.add v296, v313 : u32 #[overflow = checked]; + v315 = hir.int_to_ptr v314 : ptr; + hir.store v315, v294; + v316 = arith.constant 28 : u32; + v317 = arith.add v296, v316 : u32 #[overflow = checked]; + v318 = hir.int_to_ptr v317 : ptr; + hir.store v318, v295; + builtin.ret ; + }; + + builtin.global_variable private @#__stack_pointer : i32 { + builtin.ret_imm 1048576; + }; + }; +}; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk_stdlib_sha256_hash.masm b/tests/integration/expected/rust_sdk_stdlib_sha256_hash.masm new file mode 100644 index 000000000..51637a1b6 --- /dev/null +++ b/tests/integration/expected/rust_sdk_stdlib_sha256_hash.masm @@ -0,0 +1,933 @@ +# mod root_ns:root@1.0.0 + +proc.init + push.1179648 + trace.240 + exec.::intrinsics::mem::heap_init + trace.252 + push.1048576 + u32assert + mem_store.278528 +end + +# mod root_ns:root@1.0.0::rust_sdk_stdlib_sha256_hash + +proc.core::slice::::reverse + push.3 + dup.1 + u32wrapping_add + push.0 + movup.2 + swap.1 + push.1 + while.true + push.0 + push.2 + dup.2 + eq + neq + dup.0 + if.true + movup.3 + movup.2 + drop + drop + push.3735929054 + dup.0 + else + dup.2 + dup.2 + u32wrapping_add + dup.0 + u32divmod.4 + swap.1 + swap.1 + dup.1 + mem_load + swap.1 + push.8 + u32wrapping_mul + u32shr + swap.1 + drop + push.255 + u32and + dup.5 + u32divmod.4 + swap.1 + swap.1 + dup.1 + mem_load + swap.1 + push.8 + u32wrapping_mul + u32shr + swap.1 + drop + push.255 + u32and + push.255 + u32and + movup.2 + u32divmod.4 + swap.1 + dup.0 + mem_load + dup.2 + push.8 + u32wrapping_mul + push.255 + swap.1 + u32shl + u32not + swap.1 + u32and + movup.3 + movup.3 + push.8 + u32wrapping_mul + u32shl + u32or + swap.1 + mem_store + push.255 + u32and + dup.4 + u32divmod.4 + swap.1 + dup.0 + mem_load + dup.2 + push.8 + u32wrapping_mul + push.255 + swap.1 + u32shl + u32not + swap.1 + u32and + movup.3 + movup.3 + push.8 + u32wrapping_mul + u32shl + u32or + swap.1 + mem_store + push.4294967295 + movup.4 + u32wrapping_add + push.1 + movup.3 + u32wrapping_add + end + push.3735929054 + dup.3 + movup.2 + swap.5 + movdn.2 + cdrop + push.1 + push.0 + movup.4 + cdrop + push.1 + u32and + movup.3 + swap.1 + if.true + push.1 + else + push.0 + end + end + drop + drop + drop +end + +export.entrypoint + push.1114112 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.4294967264 + push.64 + dup.2 + swap.1 + u32wrapping_sub + u32and + push.1114112 + dup.1 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.24 + dup.4 + u32wrapping_add + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.24 + push.32 + dup.4 + u32wrapping_add + u32wrapping_add + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.16 + dup.4 + u32wrapping_add + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.16 + push.32 + dup.4 + u32wrapping_add + u32wrapping_add + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.8 + dup.4 + u32wrapping_add + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.8 + push.32 + dup.4 + u32wrapping_add + u32wrapping_add + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + movup.3 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.32 + dup.3 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.0 + movup.2 + swap.3 + movdn.2 + push.1 + while.true + push.0 + push.32 + dup.2 + eq + neq + dup.0 + if.true + swap.1 + drop + push.3735929054 + else + push.32 + dup.3 + u32wrapping_add + dup.2 + u32wrapping_add + trace.240 + nop + exec.::root_ns:root@1.0.0::rust_sdk_stdlib_sha256_hash::core::slice::::reverse + trace.252 + nop + push.4 + movup.2 + u32wrapping_add + end + push.3735929054 + dup.2 + dup.6 + swap.2 + swap.1 + cdrop + push.3735929054 + dup.3 + dup.6 + swap.2 + swap.1 + cdrop + push.3735929054 + dup.4 + dup.6 + swap.2 + swap.1 + cdrop + push.1 + push.0 + movup.6 + cdrop + push.1 + u32and + movup.4 + swap.1 + if.true + movup.4 + drop + movup.4 + drop + movup.4 + drop + push.1 + else + push.0 + end + end + drop + drop + drop + drop + push.32 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.36 + dup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.40 + dup.3 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.44 + dup.4 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.48 + dup.5 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.52 + dup.6 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.56 + dup.7 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.60 + dup.8 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + dup.8 + movup.3 + swap.5 + movdn.3 + movup.2 + swap.6 + movdn.2 + swap.1 + swap.7 + swap.1 + swap.8 + trace.240 + nop + exec.::root_ns:root@1.0.0::rust_sdk_stdlib_sha256_hash::std::crypto::hashes::sha256::hash_1to1 + trace.252 + nop + push.24 + dup.1 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.56 + dup.3 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.16 + dup.1 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.48 + dup.3 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.8 + dup.1 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.40 + dup.3 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + dup.0 + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.32 + dup.3 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.0 + push.1 + while.true + push.0 + push.32 + dup.2 + eq + neq + dup.0 + if.true + swap.1 + drop + push.3735929054 + else + push.32 + dup.3 + u32wrapping_add + dup.2 + u32wrapping_add + trace.240 + nop + exec.::root_ns:root@1.0.0::rust_sdk_stdlib_sha256_hash::core::slice::::reverse + trace.252 + nop + push.4 + movup.2 + u32wrapping_add + end + push.3735929054 + dup.2 + dup.6 + swap.2 + swap.1 + cdrop + push.3735929054 + dup.3 + dup.6 + swap.2 + swap.1 + cdrop + push.3735929054 + dup.4 + dup.6 + swap.2 + swap.1 + cdrop + push.1 + push.0 + movup.6 + cdrop + push.1 + u32and + movup.4 + swap.1 + if.true + movup.4 + drop + movup.4 + drop + movup.4 + drop + push.1 + else + push.0 + end + end + drop + drop + drop + drop + push.32 + dup.1 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + dup.3 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.56 + dup.1 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.24 + dup.4 + u32wrapping_add + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.48 + dup.1 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.16 + dup.4 + u32wrapping_add + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.40 + swap.1 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.8 + movup.3 + u32wrapping_add + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.1114112 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop +end + +proc.std::crypto::hashes::sha256::hash_1to1 + trace.240 + nop + exec.::std::crypto::hashes::sha256::hash_1to1 + trace.252 + nop + movup.8 + dup.0 + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.4 + dup.1 + add + u32assert + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.8 + dup.1 + add + u32assert + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.12 + dup.1 + add + u32assert + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.16 + dup.1 + add + u32assert + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.20 + dup.1 + add + u32assert + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.24 + dup.1 + add + u32assert + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.28 + add + u32assert + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop +end + diff --git a/tests/integration/expected/rust_sdk_stdlib_sha256_hash.wat b/tests/integration/expected/rust_sdk_stdlib_sha256_hash.wat new file mode 100644 index 000000000..6b99cc657 --- /dev/null +++ b/tests/integration/expected/rust_sdk_stdlib_sha256_hash.wat @@ -0,0 +1,199 @@ +(module $rust_sdk_stdlib_sha256_hash.wasm + (type (;0;) (func (param i32))) + (type (;1;) (func (param i32 i32))) + (type (;2;) (func (param i32 i32 i32 i32 i32 i32 i32 i32 i32))) + (table (;0;) 1 1 funcref) + (memory (;0;) 16) + (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) + (export "memory" (memory 0)) + (export "entrypoint" (func $entrypoint)) + (func $core::slice::::reverse (;0;) (type 0) (param i32) + (local i32 i32 i32 i32) + local.get 0 + i32.const 3 + i32.add + local.set 1 + i32.const 0 + local.set 2 + block ;; label = @1 + loop ;; label = @2 + local.get 2 + i32.const 2 + i32.eq + br_if 1 (;@1;) + local.get 0 + local.get 2 + i32.add + local.tee 3 + i32.load8_u + local.set 4 + local.get 3 + local.get 1 + i32.load8_u + i32.store8 + local.get 1 + local.get 4 + i32.store8 + local.get 1 + i32.const -1 + i32.add + local.set 1 + local.get 2 + i32.const 1 + i32.add + local.set 2 + br 0 (;@2;) + end + end + ) + (func $entrypoint (;1;) (type 1) (param i32 i32) + (local i32 i32) + global.get $__stack_pointer + local.tee 2 + local.set 3 + local.get 2 + i32.const 64 + i32.sub + i32.const -32 + i32.and + local.tee 2 + global.set $__stack_pointer + local.get 2 + i32.const 32 + i32.add + i32.const 24 + i32.add + local.get 1 + i32.const 24 + i32.add + i64.load align=1 + i64.store + local.get 2 + i32.const 32 + i32.add + i32.const 16 + i32.add + local.get 1 + i32.const 16 + i32.add + i64.load align=1 + i64.store + local.get 2 + i32.const 32 + i32.add + i32.const 8 + i32.add + local.get 1 + i32.const 8 + i32.add + i64.load align=1 + i64.store + local.get 2 + local.get 1 + i64.load align=1 + i64.store offset=32 + i32.const 0 + local.set 1 + block ;; label = @1 + loop ;; label = @2 + local.get 1 + i32.const 32 + i32.eq + br_if 1 (;@1;) + local.get 2 + i32.const 32 + i32.add + local.get 1 + i32.add + call $core::slice::::reverse + local.get 1 + i32.const 4 + i32.add + local.set 1 + br 0 (;@2;) + end + end + local.get 2 + i32.load offset=32 + local.get 2 + i32.load offset=36 + local.get 2 + i32.load offset=40 + local.get 2 + i32.load offset=44 + local.get 2 + i32.load offset=48 + local.get 2 + i32.load offset=52 + local.get 2 + i32.load offset=56 + local.get 2 + i32.load offset=60 + local.get 2 + call $std::crypto::hashes::sha256::hash_1to1 + local.get 2 + local.get 2 + i64.load offset=24 + i64.store offset=56 + local.get 2 + local.get 2 + i64.load offset=16 + i64.store offset=48 + local.get 2 + local.get 2 + i64.load offset=8 + i64.store offset=40 + local.get 2 + local.get 2 + i64.load + i64.store offset=32 + i32.const 0 + local.set 1 + block ;; label = @1 + loop ;; label = @2 + local.get 1 + i32.const 32 + i32.eq + br_if 1 (;@1;) + local.get 2 + i32.const 32 + i32.add + local.get 1 + i32.add + call $core::slice::::reverse + local.get 1 + i32.const 4 + i32.add + local.set 1 + br 0 (;@2;) + end + end + local.get 0 + local.get 2 + i64.load offset=32 + i64.store align=1 + local.get 0 + i32.const 24 + i32.add + local.get 2 + i64.load offset=56 + i64.store align=1 + local.get 0 + i32.const 16 + i32.add + local.get 2 + i64.load offset=48 + i64.store align=1 + local.get 0 + i32.const 8 + i32.add + local.get 2 + i64.load offset=40 + i64.store align=1 + local.get 3 + global.set $__stack_pointer + ) + (func $std::crypto::hashes::sha256::hash_1to1 (;2;) (type 2) (param i32 i32 i32 i32 i32 i32 i32 i32 i32) + unreachable + ) +) diff --git a/tests/integration/src/rust_masm_tests/abi_transform/stdlib.rs b/tests/integration/src/rust_masm_tests/abi_transform/stdlib.rs index a41246697..ede3be339 100644 --- a/tests/integration/src/rust_masm_tests/abi_transform/stdlib.rs +++ b/tests/integration/src/rust_masm_tests/abi_transform/stdlib.rs @@ -20,71 +20,6 @@ use crate::{ CompilerTest, }; -#[test] -fn test_blake3_hash() { - let main_fn = - "(a: [u8; 32]) -> [u8; 32] { miden_stdlib_sys::blake3_hash_1to1(a) }".to_string(); - let artifact_name = "abi_transform_stdlib_blake3_hash"; - let config = WasmTranslationConfig::default(); - let mut test = CompilerTest::rust_fn_body_with_stdlib_sys( - artifact_name, - &main_fn, - config, - ["--test-harness".into()], - ); - // Test expected compilation artifacts - test.expect_wasm(expect_file![format!("../../../expected/{artifact_name}.wat")]); - test.expect_ir(expect_file![format!("../../../expected/{artifact_name}.hir")]); - test.expect_masm(expect_file![format!("../../../expected/{artifact_name}.masm")]); - - let package = test.compiled_package(); - - // Run the Rust and compiled MASM code against a bunch of random inputs and compare the results - let config = proptest::test_runner::Config::with_cases(10); - let res = TestRunner::new(config).run(&any::<[u8; 32]>(), move |ibytes| { - let hash_bytes = blake3::hash(&ibytes); - let rs_out = hash_bytes.as_bytes(); - - // Place the hash output at 20 * PAGE_SIZE, and the hash input at 21 * PAGE_SIZE - let in_addr = 21u32 * 65536; - let out_addr = 20u32 * 65536; - let initializers = [Initializer::MemoryBytes { - addr: in_addr, - bytes: &ibytes, - }]; - - let owords = rs_out.to_words(); - - dbg!(&ibytes, rs_out); - - // Arguments are: [hash_output_ptr, hash_input_ptr] - let args = [Felt::new(in_addr as u64), Felt::new(out_addr as u64)]; - eval_package::(&package, initializers, &args, &test.session, |trace| { - let vm_in: [u8; 32] = trace - .read_from_rust_memory(in_addr) - .expect("expected memory to have been written"); - dbg!(&vm_in); - prop_assert_eq!(&ibytes, &vm_in, "VM input mismatch"); - let vm_out: [u8; 32] = trace - .read_from_rust_memory(out_addr) - .expect("expected memory to have been written"); - dbg!(&vm_out); - prop_assert_eq!(rs_out, &vm_out, "VM output mismatch"); - Ok(()) - })?; - - Ok(()) - }); - - match res { - Err(TestError::Fail(_, value)) => { - panic!("Found minimal(shrinked) failing case: {:?}", value); - } - Ok(_) => (), - _ => panic!("Unexpected test result: {:?}", res), - } -} - #[test] fn test_hash_elements() { let main_fn = r#" diff --git a/tests/integration/src/rust_masm_tests/rust_sdk/mod.rs b/tests/integration/src/rust_masm_tests/rust_sdk/mod.rs index 9bfccffb2..183b613c6 100644 --- a/tests/integration/src/rust_masm_tests/rust_sdk/mod.rs +++ b/tests/integration/src/rust_masm_tests/rust_sdk/mod.rs @@ -20,6 +20,7 @@ use crate::{ }; mod macros; +mod stdlib; fn executor_with_std(args: Vec) -> Executor { let mut exec = Executor::new(args); diff --git a/tests/integration/src/rust_masm_tests/rust_sdk/stdlib/hashes.rs b/tests/integration/src/rust_masm_tests/rust_sdk/stdlib/hashes.rs new file mode 100644 index 000000000..8cba4e66d --- /dev/null +++ b/tests/integration/src/rust_masm_tests/rust_sdk/stdlib/hashes.rs @@ -0,0 +1,98 @@ +use midenc_expect_test::expect_file; +use midenc_frontend_wasm::WasmTranslationConfig; +use midenc_hir::Felt; +use proptest::{ + arbitrary::any, + prop_assert_eq, + test_runner::{TestError, TestRunner}, +}; +use sha2::{Digest, Sha256}; + +use crate::{ + testing::{eval_package, Initializer}, + CompilerTest, +}; + +/// Runs the provided stdlib hash function against random 32-byte inputs and compares the outputs +/// between Rust and the compiled MASM program. +fn run_stdlib_hash_1to1_test(artifact_name: &'static str, rust_call_expr: &str, expected_fn: F) +where + F: Fn(&[u8; 32]) -> [u8; 32] + Copy, +{ + let main_fn = format!("(a: [u8; 32]) -> [u8; 32] {{ {rust_call_expr} }}"); + let config = WasmTranslationConfig::default(); + let mut test = CompilerTest::rust_fn_body_with_stdlib_sys( + artifact_name, + &main_fn, + config, + ["--test-harness".into()], + ); + test.expect_wasm(expect_file![format!("../../../../expected/{artifact_name}.wat")]); + test.expect_ir(expect_file![format!("../../../../expected/{artifact_name}.hir")]); + test.expect_masm(expect_file![format!("../../../../expected/{artifact_name}.masm")]); + + let package = test.compiled_package(); + + let config = proptest::test_runner::Config::with_cases(10); + let res = TestRunner::new(config).run(&any::<[u8; 32]>(), move |ibytes| { + let rs_out = expected_fn(&ibytes); + + let in_addr = 21u32 * 65536; + let out_addr = 20u32 * 65536; + let initializers = [Initializer::MemoryBytes { + addr: in_addr, + bytes: &ibytes, + }]; + + let args = [Felt::new(in_addr as u64), Felt::new(out_addr as u64)]; + eval_package::(&package, initializers, &args, &test.session, |trace| { + let vm_in: [u8; 32] = trace + .read_from_rust_memory(in_addr) + .expect("expected memory to have been written"); + prop_assert_eq!(&ibytes, &vm_in, "VM input mismatch"); + let vm_out: [u8; 32] = trace + .read_from_rust_memory(out_addr) + .expect("expected memory to have been written"); + prop_assert_eq!(&rs_out, &vm_out, "VM output mismatch"); + Ok(()) + })?; + + Ok(()) + }); + + if let Err(TestError::Fail(_, value)) = res { + panic!("Found minimal(shrunk) failing case: {value:?}"); + } + + assert!(res.is_ok(), "Unexpected test result: {res:?}"); +} + +/// Tests the BLAKE3 hash helper exported by the Rust stdlib bindings. +#[test] +fn test_blake3_hash() { + run_stdlib_hash_1to1_test( + "abi_transform_stdlib_blake3_hash", + "miden_stdlib_sys::blake3_hash_1to1(a)", + |ibytes| { + let hash = blake3::hash(ibytes); + let mut output = [0u8; 32]; + output.copy_from_slice(hash.as_bytes()); + output + }, + ); +} + +/// Tests the SHA-256 hash helper exported by the Rust stdlib bindings. +#[test] +fn test_sha256_hash() { + run_stdlib_hash_1to1_test( + "rust_sdk_stdlib_sha256_hash", + "miden_stdlib_sys::sha256_hash_1to1(a)", + |ibytes| { + let hash = Sha256::digest(ibytes); + let mut output = [0u8; 32]; + output.copy_from_slice(&hash); + output + }, + ); +} diff --git a/tests/integration/src/rust_masm_tests/rust_sdk/stdlib/mod.rs b/tests/integration/src/rust_masm_tests/rust_sdk/stdlib/mod.rs new file mode 100644 index 000000000..0cbac7e21 --- /dev/null +++ b/tests/integration/src/rust_masm_tests/rust_sdk/stdlib/mod.rs @@ -0,0 +1 @@ +mod hashes; From 9ea54118ecbf677989cb56119b7d716e0e2fee03 Mon Sep 17 00:00:00 2001 From: Denys Zadorozhnyi Date: Fri, 7 Nov 2025 15:20:57 +0200 Subject: [PATCH 16/19] feature: add stdlib `hash_2to1` for SHA256 and Blake3 to SDK bindings --- sdk/stdlib-sys/src/stdlib/crypto/hashes.rs | 34 +++++++- .../rust_masm_tests/rust_sdk/stdlib/hashes.rs | 87 ++++++++++++++++++- 2 files changed, 118 insertions(+), 3 deletions(-) diff --git a/sdk/stdlib-sys/src/stdlib/crypto/hashes.rs b/sdk/stdlib-sys/src/stdlib/crypto/hashes.rs index db28e8737..367a8791c 100644 --- a/sdk/stdlib-sys/src/stdlib/crypto/hashes.rs +++ b/sdk/stdlib-sys/src/stdlib/crypto/hashes.rs @@ -200,6 +200,10 @@ pub fn sha256_hash_1to1(input: [u8; 32]) -> [u8; 32] { let swapped_words = { let mut be_bytes = input; + // The SHA-2 family is specified over big-endian 32-bit words. The Miden ABI mirrors that + // spec, so each lane we pass across the boundary must be encoded as a big-endian word. + // Our public Rust API uses `[u8; 32]` in native little-endian order, so we convert the bytes + // here before calling into the ABI. for chunk in be_bytes.chunks_exact_mut(4) { chunk.reverse(); } @@ -213,6 +217,8 @@ pub fn sha256_hash_1to1(input: [u8; 32]) -> [u8; 32] { let ptr = ret_area.as_mut_ptr() as *mut u8; extern_sha256_hash_1to1(w0, w1, w2, w3, w4, w5, w6, w7, ptr); let mut output = ret_area.assume_init().into_inner(); + // The extern returns the digest as big-endian words as well; flip each lane so callers see + // the conventional Rust `[u8; 32]` ordering. for chunk in output.chunks_exact_mut(4) { chunk.reverse(); } @@ -223,7 +229,33 @@ pub fn sha256_hash_1to1(input: [u8; 32]) -> [u8; 32] { /// Hashes a 64-byte input to a 32-byte output using the SHA256 hash function. #[inline] pub fn sha256_hash_2to1(input: [u8; 64]) -> [u8; 32] { - hash_2to1(input, extern_sha256_hash_2to1) + use crate::intrinsics::WordAligned; + + let swapped_words = { + let mut be_bytes = input; + // Same story as `sha256_hash_1to1`: adjust the byte layout so the ABI receives big-endian + // 32-bit words. + for chunk in be_bytes.chunks_exact_mut(4) { + chunk.reverse(); + } + unsafe { core::mem::transmute::<[u8; 64], [u32; 16]>(be_bytes) } + }; + + let [w0, w1, w2, w3, w4, w5, w6, w7, w8, w9, w10, w11, w12, w13, w14, w15] = swapped_words; + + unsafe { + let mut ret_area = ::core::mem::MaybeUninit::>::uninit(); + let ptr = ret_area.as_mut_ptr() as *mut u8; + extern_sha256_hash_2to1( + w0, w1, w2, w3, w4, w5, w6, w7, w8, w9, w10, w11, w12, w13, w14, w15, ptr, + ); + let mut output = ret_area.assume_init().into_inner(); + // Restore the little-endian byte layout expected by Rust callers. + for chunk in output.chunks_exact_mut(4) { + chunk.reverse(); + } + output + } } /// Computes the hash of a sequence of field elements using the Rescue Prime Optimized (RPO) diff --git a/tests/integration/src/rust_masm_tests/rust_sdk/stdlib/hashes.rs b/tests/integration/src/rust_masm_tests/rust_sdk/stdlib/hashes.rs index 8cba4e66d..099a3e6df 100644 --- a/tests/integration/src/rust_masm_tests/rust_sdk/stdlib/hashes.rs +++ b/tests/integration/src/rust_masm_tests/rust_sdk/stdlib/hashes.rs @@ -67,9 +67,60 @@ where assert!(res.is_ok(), "Unexpected test result: {res:?}"); } +/// Runs the provided stdlib hash function against random 64-byte inputs and compares the outputs +/// between Rust and the compiled MASM program. +fn run_stdlib_hash_2to1_test(artifact_name: &'static str, rust_call_expr: &str, expected_fn: F) +where + F: Fn(&[u8; 64]) -> [u8; 32] + Copy, +{ + let main_fn = format!("(a: [u8; 64]) -> [u8; 32] {{ {rust_call_expr} }}"); + let config = WasmTranslationConfig::default(); + let mut test = CompilerTest::rust_fn_body_with_stdlib_sys( + artifact_name, + &main_fn, + config, + ["--test-harness".into()], + ); + + let package = test.compiled_package(); + + let config = proptest::test_runner::Config::with_cases(4); + let res = TestRunner::new(config).run(&any::<[u8; 64]>(), move |ibytes| { + let rs_out = expected_fn(&ibytes); + + let in_addr = 21u32 * 65536; + let out_addr = 20u32 * 65536; + let initializers = [Initializer::MemoryBytes { + addr: in_addr, + bytes: &ibytes, + }]; + + let args = [Felt::new(in_addr as u64), Felt::new(out_addr as u64)]; + eval_package::(&package, initializers, &args, &test.session, |trace| { + let vm_in: [u8; 64] = trace + .read_from_rust_memory(in_addr) + .expect("expected memory to have been written"); + prop_assert_eq!(&ibytes, &vm_in, "VM input mismatch"); + let vm_out: [u8; 32] = trace + .read_from_rust_memory(out_addr) + .expect("expected memory to have been written"); + prop_assert_eq!(&rs_out, &vm_out, "VM output mismatch"); + Ok(()) + })?; + + Ok(()) + }); + + if let Err(TestError::Fail(_, value)) = res { + panic!("Found minimal(shrunk) failing case: {value:?}"); + } + + assert!(res.is_ok(), "Unexpected test result: {res:?}"); +} + /// Tests the BLAKE3 hash helper exported by the Rust stdlib bindings. #[test] -fn test_blake3_hash() { +fn test_blake3_1to1_hash() { run_stdlib_hash_1to1_test( "abi_transform_stdlib_blake3_hash", "miden_stdlib_sys::blake3_hash_1to1(a)", @@ -84,7 +135,7 @@ fn test_blake3_hash() { /// Tests the SHA-256 hash helper exported by the Rust stdlib bindings. #[test] -fn test_sha256_hash() { +fn test_sha256_1to1_hash() { run_stdlib_hash_1to1_test( "rust_sdk_stdlib_sha256_hash", "miden_stdlib_sys::sha256_hash_1to1(a)", @@ -96,3 +147,35 @@ fn test_sha256_hash() { }, ); } + +/// Tests the BLAKE3 hash helper (2-to-1) via the full compilation pipeline. +#[test] +#[ignore = "requires large stack frame; kept for reference"] +fn test_blake3_hash_2to1() { + run_stdlib_hash_2to1_test( + "abi_transform_stdlib_blake3_hash_2to1", + "miden_stdlib_sys::blake3_hash_2to1(a)", + |ibytes| { + let hash = blake3::hash(ibytes); + let mut output = [0u8; 32]; + output.copy_from_slice(hash.as_bytes()); + output + }, + ); +} + +/// Tests the SHA-256 hash helper (2-to-1) via the full compilation pipeline. +#[test] +#[ignore = "requires large stack frame; kept for reference"] +fn test_sha256_hash_2to1() { + run_stdlib_hash_2to1_test( + "rust_sdk_stdlib_sha256_hash_2to1", + "miden_stdlib_sys::sha256_hash_2to1(a)", + |ibytes| { + let hash = Sha256::digest(ibytes); + let mut output = [0u8; 32]; + output.copy_from_slice(&hash); + output + }, + ); +} From 234b0301c83e1c02e44726a8f606941cfc033cc1 Mon Sep 17 00:00:00 2001 From: Denys Zadorozhnyi Date: Mon, 10 Nov 2025 14:01:30 +0200 Subject: [PATCH 17/19] feature: add stdlib `std::collections::smt` bindings to the SDK --- frontend/wasm/src/miden_abi/stdlib.rs | 2 + .../src/miden_abi/stdlib/collections/mod.rs | 1 + .../src/miden_abi/stdlib/collections/smt.rs | 77 ++ frontend/wasm/src/miden_abi/transform.rs | 12 + hir-symbol/src/symbols.toml | 2 + sdk/stdlib-sys/src/stdlib/collections/mod.rs | 3 + sdk/stdlib-sys/src/stdlib/collections/smt.rs | 112 ++ sdk/stdlib-sys/src/stdlib/mod.rs | 2 + sdk/stdlib-sys/stubs/collections.rs | 41 + sdk/stdlib-sys/stubs/stdlib_root.rs | 2 +- .../expected/rust_sdk_stdlib_smt_get.hir | 510 ++++++++ .../expected/rust_sdk_stdlib_smt_get.masm | 1034 ++++++++++++++++ .../expected/rust_sdk_stdlib_smt_get.wat | 232 ++++ .../expected/rust_sdk_stdlib_smt_set.hir | 514 ++++++++ .../expected/rust_sdk_stdlib_smt_set.masm | 1052 +++++++++++++++++ .../expected/rust_sdk_stdlib_smt_set.wat | 242 ++++ .../rust_sdk/stdlib/collections.rs | 210 ++++ .../rust_masm_tests/rust_sdk/stdlib/mod.rs | 1 + 18 files changed, 4048 insertions(+), 1 deletion(-) create mode 100644 frontend/wasm/src/miden_abi/stdlib/collections/mod.rs create mode 100644 frontend/wasm/src/miden_abi/stdlib/collections/smt.rs create mode 100644 sdk/stdlib-sys/src/stdlib/collections/mod.rs create mode 100644 sdk/stdlib-sys/src/stdlib/collections/smt.rs create mode 100644 sdk/stdlib-sys/stubs/collections.rs create mode 100644 tests/integration/expected/rust_sdk_stdlib_smt_get.hir create mode 100644 tests/integration/expected/rust_sdk_stdlib_smt_get.masm create mode 100644 tests/integration/expected/rust_sdk_stdlib_smt_get.wat create mode 100644 tests/integration/expected/rust_sdk_stdlib_smt_set.hir create mode 100644 tests/integration/expected/rust_sdk_stdlib_smt_set.masm create mode 100644 tests/integration/expected/rust_sdk_stdlib_smt_set.wat create mode 100644 tests/integration/src/rust_masm_tests/rust_sdk/stdlib/collections.rs diff --git a/frontend/wasm/src/miden_abi/stdlib.rs b/frontend/wasm/src/miden_abi/stdlib.rs index 2af3a5c23..0ce68361e 100644 --- a/frontend/wasm/src/miden_abi/stdlib.rs +++ b/frontend/wasm/src/miden_abi/stdlib.rs @@ -4,12 +4,14 @@ use midenc_hir_symbol::sync::LazyLock; use super::ModuleFunctionTypeMap; +pub(crate) mod collections; pub(crate) mod crypto; pub(crate) mod mem; pub(crate) fn signatures() -> &'static ModuleFunctionTypeMap { static TYPES: LazyLock = LazyLock::new(|| { let mut m: ModuleFunctionTypeMap = Default::default(); + m.extend(collections::smt::signatures()); m.extend(crypto::hashes::blake3::signatures()); m.extend(crypto::hashes::sha256::signatures()); m.extend(crypto::hashes::rpo::signatures()); diff --git a/frontend/wasm/src/miden_abi/stdlib/collections/mod.rs b/frontend/wasm/src/miden_abi/stdlib/collections/mod.rs new file mode 100644 index 000000000..a099cebbe --- /dev/null +++ b/frontend/wasm/src/miden_abi/stdlib/collections/mod.rs @@ -0,0 +1 @@ +pub(crate) mod smt; diff --git a/frontend/wasm/src/miden_abi/stdlib/collections/smt.rs b/frontend/wasm/src/miden_abi/stdlib/collections/smt.rs new file mode 100644 index 000000000..b4eca5bd8 --- /dev/null +++ b/frontend/wasm/src/miden_abi/stdlib/collections/smt.rs @@ -0,0 +1,77 @@ +use midenc_hir::{ + interner::{symbols, Symbol}, + CallConv, FunctionType, SymbolNameComponent, SymbolPath, + Type::*, +}; + +use crate::miden_abi::{FunctionTypeMap, ModuleFunctionTypeMap}; + +pub(crate) const MODULE_ID: &str = "std::collections::smt"; + +pub(crate) const GET: &str = "get"; +pub(crate) const SET: &str = "set"; + +pub(crate) fn signatures() -> ModuleFunctionTypeMap { + let mut m: ModuleFunctionTypeMap = Default::default(); + let mut funcs: FunctionTypeMap = Default::default(); + funcs.insert( + Symbol::from(GET), + FunctionType::new( + CallConv::Wasm, + [Felt, Felt, Felt, Felt, Felt, Felt, Felt, Felt], + [Felt, Felt, Felt, Felt, Felt, Felt, Felt, Felt], + ), + ); + funcs.insert( + Symbol::from(SET), + FunctionType::new( + CallConv::Wasm, + [ + Felt, Felt, Felt, Felt, // value + Felt, Felt, Felt, Felt, // key + Felt, Felt, Felt, Felt, // root + ], + [ + Felt, Felt, Felt, Felt, // old value + Felt, Felt, Felt, Felt, // new root + ], + ), + ); + let module_path = SymbolPath::from_iter([ + SymbolNameComponent::Root, + SymbolNameComponent::Component(symbols::Std), + SymbolNameComponent::Component(Symbol::intern("collections")), + SymbolNameComponent::Component(Symbol::intern("smt")), + ]); + m.insert(module_path, funcs); + let mut env_funcs: FunctionTypeMap = Default::default(); + env_funcs.insert( + Symbol::intern("std::collections::smt::get"), + FunctionType::new( + CallConv::Wasm, + [Felt, Felt, Felt, Felt, Felt, Felt, Felt, Felt], + [Felt, Felt, Felt, Felt, Felt, Felt, Felt, Felt], + ), + ); + env_funcs.insert( + Symbol::intern("std::collections::smt::set"), + FunctionType::new( + CallConv::Wasm, + [ + Felt, Felt, Felt, Felt, // value + Felt, Felt, Felt, Felt, // key + Felt, Felt, Felt, Felt, // root + ], + [ + Felt, Felt, Felt, Felt, // old value + Felt, Felt, Felt, Felt, // new root + ], + ), + ); + let env_module_path = SymbolPath::from_iter([ + SymbolNameComponent::Root, + SymbolNameComponent::Component(Symbol::intern("env")), + ]); + m.insert(env_module_path, env_funcs); + m +} diff --git a/frontend/wasm/src/miden_abi/transform.rs b/frontend/wasm/src/miden_abi/transform.rs index dd5055902..ebbb3f342 100644 --- a/frontend/wasm/src/miden_abi/transform.rs +++ b/frontend/wasm/src/miden_abi/transform.rs @@ -76,6 +76,18 @@ fn get_transform_strategy(path: &SymbolPath) -> Option { }, _ => None, }, + symbols::Collections => { + let submodule = components.next()?.as_symbol_name(); + if submodule == symbols::Smt { + return match components.next_if(|c| c.is_leaf())?.as_symbol_name().as_str() { + stdlib::collections::smt::GET | stdlib::collections::smt::SET => { + Some(TransformStrategy::ReturnViaPointer) + } + _ => None, + }; + } + None + } _ => None, }, symbols::Miden => match components.next()?.as_symbol_name() { diff --git a/hir-symbol/src/symbols.toml b/hir-symbol/src/symbols.toml index 4b6ec06f5..c725215eb 100644 --- a/hir-symbol/src/symbols.toml +++ b/hir-symbol/src/symbols.toml @@ -123,3 +123,5 @@ rpo_falcon512 = {} std = {} tx = {} rpo = {} +collections = {} +smt = {} diff --git a/sdk/stdlib-sys/src/stdlib/collections/mod.rs b/sdk/stdlib-sys/src/stdlib/collections/mod.rs new file mode 100644 index 000000000..81a9d3433 --- /dev/null +++ b/sdk/stdlib-sys/src/stdlib/collections/mod.rs @@ -0,0 +1,3 @@ +mod smt; + +pub use smt::*; diff --git a/sdk/stdlib-sys/src/stdlib/collections/smt.rs b/sdk/stdlib-sys/src/stdlib/collections/smt.rs new file mode 100644 index 000000000..72982b0af --- /dev/null +++ b/sdk/stdlib-sys/src/stdlib/collections/smt.rs @@ -0,0 +1,112 @@ +//! Bindings for the `std::collections::smt` module, which exposes sparse Merkle tree +//! functionality from the Miden standard library. + +use crate::intrinsics::{Felt, Word, WordAligned}; + +/// Result of [`smt_get`], containing the retrieved `value` and the (unchanged) `root`. +#[derive(Debug, Clone, PartialEq, Eq)] +pub struct SmtGetResponse { + pub value: Word, + pub root: Word, +} + +/// Result of [`smt_set`], containing the `old_value` and the updated `new_root`. +#[derive(Debug, Clone, PartialEq, Eq)] +pub struct SmtSetResponse { + pub old_value: Word, + pub new_root: Word, +} + +#[allow(improper_ctypes)] +extern "C" { + /// Returns the value located under the specified `key` in the sparse Merkle tree defined by + /// the specified `root`. + /// + /// This maps to the `std::collections::smt::get` procedure. + /// + /// Inputs: `[key, root, ...]` + /// Outputs: `[value, root, ...]` + /// + /// Fails if the tree with the specified `root` does not exist in the VM's advice provider. When + /// no value has previously been inserted under `key`, the procedure returns the empty word. + #[link_name = "std::collections::smt::get"] + fn extern_smt_get( + k3: Felt, + k2: Felt, + k1: Felt, + k0: Felt, + r3: Felt, + r2: Felt, + r1: Felt, + r0: Felt, + ptr: *mut (Word, Word), + ); + + /// Inserts `value` under `key` in the sparse Merkle tree defined by `root`. + /// + /// This maps to the `std::collections::smt::set` procedure. + /// + /// Inputs: `[value, key, root, ...]` + /// Outputs: `[old_value, new_root, ...]` + /// + /// On success, the prior value stored under `key` is returned along with the updated root. If + /// `value` is the empty word, the new tree state is equivalent to omitting the update. + /// + /// Fails if the tree with the specified `root` does not exist in the VM's advice provider. + #[link_name = "std::collections::smt::set"] + fn extern_smt_set( + v3: Felt, + v2: Felt, + v1: Felt, + v0: Felt, + k3: Felt, + k2: Felt, + k1: Felt, + k0: Felt, + r3: Felt, + r2: Felt, + r1: Felt, + r0: Felt, + ptr: *mut (Word, Word), + ); +} + +/// Returns the value associated with `key` in the sparse Merkle tree rooted at `root` as tracked by +/// the VM's advice provider. The returned [`SmtGetResponse`] contains the retrieved value and the +/// (unchanged) root returned by the ABI. +/// Fails if the tree with the specified `root` does not exist in the VM's advice provider. When +/// no value has previously been inserted under `key`, the procedure returns the empty word. +#[inline] +pub fn smt_get(key: Word, root: Word) -> SmtGetResponse { + unsafe { + let mut ret_area = ::core::mem::MaybeUninit::>::uninit(); + let ptr = ret_area.as_mut_ptr() as *mut (Word, Word); + extern_smt_get(key[3], key[2], key[1], key[0], root[3], root[2], root[1], root[0], ptr); + let (value, returned_root) = ret_area.assume_init().into_inner(); + SmtGetResponse { + value: value.reverse(), + root: returned_root.reverse(), + } + } +} + +/// Inserts `value` at `key` in the sparse Merkle tree rooted at `root`, returning the prior value +/// stored at `key` along with the new root. The returned [`SmtSetResponse`] contains +/// the previous value stored under `key` and the updated root. +/// Fails if the tree with the specified `root` does not exist in the VM's advice provider. +#[inline] +pub fn smt_set(value: Word, key: Word, root: Word) -> SmtSetResponse { + unsafe { + let mut ret_area = ::core::mem::MaybeUninit::>::uninit(); + let ptr = ret_area.as_mut_ptr() as *mut (Word, Word); + extern_smt_set( + value[3], value[2], value[1], value[0], key[3], key[2], key[1], key[0], root[3], + root[2], root[1], root[0], ptr, + ); + let (old_value, new_root) = ret_area.assume_init().into_inner(); + SmtSetResponse { + old_value: old_value.reverse(), + new_root: new_root.reverse(), + } + } +} diff --git a/sdk/stdlib-sys/src/stdlib/mod.rs b/sdk/stdlib-sys/src/stdlib/mod.rs index 000b317d7..86e294b33 100644 --- a/sdk/stdlib-sys/src/stdlib/mod.rs +++ b/sdk/stdlib-sys/src/stdlib/mod.rs @@ -1,5 +1,7 @@ +mod collections; mod crypto; mod mem; +pub use collections::*; pub use crypto::*; pub use mem::*; diff --git a/sdk/stdlib-sys/stubs/collections.rs b/sdk/stdlib-sys/stubs/collections.rs new file mode 100644 index 000000000..a41ca0420 --- /dev/null +++ b/sdk/stdlib-sys/stubs/collections.rs @@ -0,0 +1,41 @@ +use core::ffi::c_void; + +/// Unreachable stubs for std::collections::smt procedures used via the SDK + +#[export_name = "std::collections::smt::get"] +pub extern "C" fn std_collections_smt_get_stub( + k0: f32, + k1: f32, + k2: f32, + k3: f32, + r0: f32, + r1: f32, + r2: f32, + r3: f32, + result_ptr: *mut c_void, +) { + let _ = (k0, k1, k2, k3, r0, r1, r2, r3, result_ptr); + unsafe { core::hint::unreachable_unchecked() } +} + +#[export_name = "std::collections::smt::set"] +pub extern "C" fn std_collections_smt_set_stub( + v0: f32, + v1: f32, + v2: f32, + v3: f32, + k0: f32, + k1: f32, + k2: f32, + k3: f32, + r0: f32, + r1: f32, + r2: f32, + r3: f32, + result_ptr: *mut c_void, +) { + let _ = ( + v0, v1, v2, v3, k0, k1, k2, k3, r0, r1, r2, r3, result_ptr, + ); + unsafe { core::hint::unreachable_unchecked() } +} diff --git a/sdk/stdlib-sys/stubs/stdlib_root.rs b/sdk/stdlib-sys/stubs/stdlib_root.rs index 8e3b7ee97..fcea1abd6 100644 --- a/sdk/stdlib-sys/stubs/stdlib_root.rs +++ b/sdk/stdlib-sys/stubs/stdlib_root.rs @@ -2,4 +2,4 @@ mod mem; mod crypto; - +mod collections; diff --git a/tests/integration/expected/rust_sdk_stdlib_smt_get.hir b/tests/integration/expected/rust_sdk_stdlib_smt_get.hir new file mode 100644 index 000000000..e89520719 --- /dev/null +++ b/tests/integration/expected/rust_sdk_stdlib_smt_get.hir @@ -0,0 +1,510 @@ +builtin.component root_ns:root@1.0.0 { + builtin.module public @rust_sdk_stdlib_smt_get { + private builtin.function @::eq(v0: i32, v1: i32) -> i32 { + ^block4(v0: i32, v1: i32): + v5 = hir.bitcast v0 : u32; + v6 = arith.constant 4 : u32; + v7 = arith.mod v5, v6 : u32; + hir.assertz v7 #[code = 250]; + v8 = hir.int_to_ptr v5 : ptr; + v9 = hir.load v8 : felt; + v10 = hir.bitcast v1 : u32; + v404 = arith.constant 4 : u32; + v12 = arith.mod v10, v404 : u32; + hir.assertz v12 #[code = 250]; + v13 = hir.int_to_ptr v10 : ptr; + v14 = hir.load v13 : felt; + v15 = hir.exec @root_ns:root@1.0.0/rust_sdk_stdlib_smt_get/intrinsics::felt::eq(v9, v14) : i32 + v3 = arith.constant 0 : i32; + v16 = arith.constant 1 : i32; + v17 = arith.neq v15, v16 : i1; + v18 = arith.zext v17 : u32; + v19 = hir.bitcast v18 : i32; + v21 = arith.neq v19, v3 : i1; + v382 = scf.if v21 : i32 { + ^block6: + v403 = arith.constant 0 : i32; + scf.yield v403; + } else { + ^block7: + v402 = arith.constant 4 : u32; + v22 = hir.bitcast v0 : u32; + v24 = arith.add v22, v402 : u32 #[overflow = checked]; + v401 = arith.constant 4 : u32; + v26 = arith.mod v24, v401 : u32; + hir.assertz v26 #[code = 250]; + v27 = hir.int_to_ptr v24 : ptr; + v28 = hir.load v27 : felt; + v400 = arith.constant 4 : u32; + v29 = hir.bitcast v1 : u32; + v31 = arith.add v29, v400 : u32 #[overflow = checked]; + v399 = arith.constant 4 : u32; + v33 = arith.mod v31, v399 : u32; + hir.assertz v33 #[code = 250]; + v34 = hir.int_to_ptr v31 : ptr; + v35 = hir.load v34 : felt; + v36 = hir.exec @root_ns:root@1.0.0/rust_sdk_stdlib_smt_get/intrinsics::felt::eq(v28, v35) : i32 + v397 = arith.constant 0 : i32; + v398 = arith.constant 1 : i32; + v38 = arith.neq v36, v398 : i1; + v39 = arith.zext v38 : u32; + v40 = hir.bitcast v39 : i32; + v42 = arith.neq v40, v397 : i1; + v384 = scf.if v42 : i32 { + ^block31: + v396 = arith.constant 0 : i32; + scf.yield v396; + } else { + ^block8: + v44 = arith.constant 8 : u32; + v43 = hir.bitcast v0 : u32; + v45 = arith.add v43, v44 : u32 #[overflow = checked]; + v395 = arith.constant 4 : u32; + v47 = arith.mod v45, v395 : u32; + hir.assertz v47 #[code = 250]; + v48 = hir.int_to_ptr v45 : ptr; + v49 = hir.load v48 : felt; + v394 = arith.constant 8 : u32; + v50 = hir.bitcast v1 : u32; + v52 = arith.add v50, v394 : u32 #[overflow = checked]; + v393 = arith.constant 4 : u32; + v54 = arith.mod v52, v393 : u32; + hir.assertz v54 #[code = 250]; + v55 = hir.int_to_ptr v52 : ptr; + v56 = hir.load v55 : felt; + v57 = hir.exec @root_ns:root@1.0.0/rust_sdk_stdlib_smt_get/intrinsics::felt::eq(v49, v56) : i32 + v391 = arith.constant 0 : i32; + v392 = arith.constant 1 : i32; + v59 = arith.neq v57, v392 : i1; + v60 = arith.zext v59 : u32; + v61 = hir.bitcast v60 : i32; + v63 = arith.neq v61, v391 : i1; + v385 = scf.if v63 : i32 { + ^block30: + v390 = arith.constant 0 : i32; + scf.yield v390; + } else { + ^block9: + v65 = arith.constant 12 : u32; + v64 = hir.bitcast v0 : u32; + v66 = arith.add v64, v65 : u32 #[overflow = checked]; + v389 = arith.constant 4 : u32; + v68 = arith.mod v66, v389 : u32; + hir.assertz v68 #[code = 250]; + v69 = hir.int_to_ptr v66 : ptr; + v70 = hir.load v69 : felt; + v388 = arith.constant 12 : u32; + v71 = hir.bitcast v1 : u32; + v73 = arith.add v71, v388 : u32 #[overflow = checked]; + v387 = arith.constant 4 : u32; + v75 = arith.mod v73, v387 : u32; + hir.assertz v75 #[code = 250]; + v76 = hir.int_to_ptr v73 : ptr; + v77 = hir.load v76 : felt; + v78 = hir.exec @root_ns:root@1.0.0/rust_sdk_stdlib_smt_get/intrinsics::felt::eq(v70, v77) : i32 + v386 = arith.constant 1 : i32; + v80 = arith.eq v78, v386 : i1; + v81 = arith.zext v80 : u32; + v82 = hir.bitcast v81 : i32; + scf.yield v82; + }; + scf.yield v385; + }; + scf.yield v384; + }; + builtin.ret v382; + }; + + public builtin.function @entrypoint(v84: felt, v85: felt, v86: felt, v87: felt, v88: felt, v89: felt, v90: felt, v91: felt) { + ^block10(v84: felt, v85: felt, v86: felt, v87: felt, v88: felt, v89: felt, v90: felt, v91: felt): + v93 = builtin.global_symbol @root_ns:root@1.0.0/rust_sdk_stdlib_smt_get/__stack_pointer : ptr + v94 = hir.bitcast v93 : ptr; + v95 = hir.load v94 : i32; + v98 = arith.constant -32 : i32; + v96 = arith.constant 128 : i32; + v97 = arith.sub v95, v96 : i32 #[overflow = wrapping]; + v99 = arith.band v97, v98 : i32; + v100 = builtin.global_symbol @root_ns:root@1.0.0/rust_sdk_stdlib_smt_get/__stack_pointer : ptr + v101 = hir.bitcast v100 : ptr; + hir.store v101, v99; + v103 = arith.constant 28 : u32; + v102 = hir.bitcast v99 : u32; + v104 = arith.add v102, v103 : u32 #[overflow = checked]; + v105 = arith.constant 4 : u32; + v106 = arith.mod v104, v105 : u32; + hir.assertz v106 #[code = 250]; + v107 = hir.int_to_ptr v104 : ptr; + hir.store v107, v91; + v109 = arith.constant 24 : u32; + v108 = hir.bitcast v99 : u32; + v110 = arith.add v108, v109 : u32 #[overflow = checked]; + v436 = arith.constant 4 : u32; + v112 = arith.mod v110, v436 : u32; + hir.assertz v112 #[code = 250]; + v113 = hir.int_to_ptr v110 : ptr; + hir.store v113, v90; + v115 = arith.constant 20 : u32; + v114 = hir.bitcast v99 : u32; + v116 = arith.add v114, v115 : u32 #[overflow = checked]; + v435 = arith.constant 4 : u32; + v118 = arith.mod v116, v435 : u32; + hir.assertz v118 #[code = 250]; + v119 = hir.int_to_ptr v116 : ptr; + hir.store v119, v89; + v121 = arith.constant 16 : u32; + v120 = hir.bitcast v99 : u32; + v122 = arith.add v120, v121 : u32 #[overflow = checked]; + v434 = arith.constant 4 : u32; + v124 = arith.mod v122, v434 : u32; + hir.assertz v124 #[code = 250]; + v125 = hir.int_to_ptr v122 : ptr; + hir.store v125, v88; + v126 = arith.constant 64 : i32; + v127 = arith.add v99, v126 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/rust_sdk_stdlib_smt_get/std::collections::smt::get(v87, v86, v85, v84, v91, v90, v89, v88, v127) + v129 = arith.constant 72 : u32; + v128 = hir.bitcast v99 : u32; + v130 = arith.add v128, v129 : u32 #[overflow = checked]; + v131 = arith.constant 8 : u32; + v132 = arith.mod v130, v131 : u32; + hir.assertz v132 #[code = 250]; + v133 = hir.int_to_ptr v130 : ptr; + v134 = hir.load v133 : i64; + v136 = arith.constant 104 : u32; + v135 = hir.bitcast v99 : u32; + v137 = arith.add v135, v136 : u32 #[overflow = checked]; + v433 = arith.constant 8 : u32; + v139 = arith.mod v137, v433 : u32; + hir.assertz v139 #[code = 250]; + v140 = hir.int_to_ptr v137 : ptr; + hir.store v140, v134; + v142 = arith.constant 64 : u32; + v141 = hir.bitcast v99 : u32; + v143 = arith.add v141, v142 : u32 #[overflow = checked]; + v432 = arith.constant 8 : u32; + v145 = arith.mod v143, v432 : u32; + hir.assertz v145 #[code = 250]; + v146 = hir.int_to_ptr v143 : ptr; + v147 = hir.load v146 : i64; + v149 = arith.constant 96 : u32; + v148 = hir.bitcast v99 : u32; + v150 = arith.add v148, v149 : u32 #[overflow = checked]; + v431 = arith.constant 8 : u32; + v152 = arith.mod v150, v431 : u32; + hir.assertz v152 #[code = 250]; + v153 = hir.int_to_ptr v150 : ptr; + hir.store v153, v147; + v155 = arith.constant 88 : u32; + v154 = hir.bitcast v99 : u32; + v156 = arith.add v154, v155 : u32 #[overflow = checked]; + v430 = arith.constant 8 : u32; + v158 = arith.mod v156, v430 : u32; + hir.assertz v158 #[code = 250]; + v159 = hir.int_to_ptr v156 : ptr; + v160 = hir.load v159 : i64; + v162 = arith.constant 120 : u32; + v161 = hir.bitcast v99 : u32; + v163 = arith.add v161, v162 : u32 #[overflow = checked]; + v429 = arith.constant 8 : u32; + v165 = arith.mod v163, v429 : u32; + hir.assertz v165 #[code = 250]; + v166 = hir.int_to_ptr v163 : ptr; + hir.store v166, v160; + v168 = arith.constant 80 : u32; + v167 = hir.bitcast v99 : u32; + v169 = arith.add v167, v168 : u32 #[overflow = checked]; + v428 = arith.constant 8 : u32; + v171 = arith.mod v169, v428 : u32; + hir.assertz v171 #[code = 250]; + v172 = hir.int_to_ptr v169 : ptr; + v173 = hir.load v172 : i64; + v175 = arith.constant 112 : u32; + v174 = hir.bitcast v99 : u32; + v176 = arith.add v174, v175 : u32 #[overflow = checked]; + v427 = arith.constant 8 : u32; + v178 = arith.mod v176, v427 : u32; + hir.assertz v178 #[code = 250]; + v179 = hir.int_to_ptr v176 : ptr; + hir.store v179, v173; + v182 = arith.constant 96 : i32; + v183 = arith.add v99, v182 : i32 #[overflow = wrapping]; + v180 = arith.constant 32 : i32; + v181 = arith.add v99, v180 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/rust_sdk_stdlib_smt_get/miden_stdlib_sys::intrinsics::word::Word::reverse(v181, v183) + v184 = arith.constant 48 : i32; + v185 = arith.add v99, v184 : i32 #[overflow = wrapping]; + v186 = arith.constant 112 : i32; + v187 = arith.add v99, v186 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/rust_sdk_stdlib_smt_get/miden_stdlib_sys::intrinsics::word::Word::reverse(v185, v187) + v188 = arith.constant 10 : i64; + v189 = hir.exec @root_ns:root@1.0.0/rust_sdk_stdlib_smt_get/intrinsics::felt::from_u64_unchecked(v188) : felt + v190 = arith.constant 11 : i64; + v191 = hir.exec @root_ns:root@1.0.0/rust_sdk_stdlib_smt_get/intrinsics::felt::from_u64_unchecked(v190) : felt + v192 = arith.constant 12 : i64; + v193 = hir.exec @root_ns:root@1.0.0/rust_sdk_stdlib_smt_get/intrinsics::felt::from_u64_unchecked(v192) : felt + v194 = arith.constant 13 : i64; + v195 = hir.exec @root_ns:root@1.0.0/rust_sdk_stdlib_smt_get/intrinsics::felt::from_u64_unchecked(v194) : felt + v197 = arith.constant 76 : u32; + v196 = hir.bitcast v99 : u32; + v198 = arith.add v196, v197 : u32 #[overflow = checked]; + v426 = arith.constant 4 : u32; + v200 = arith.mod v198, v426 : u32; + hir.assertz v200 #[code = 250]; + v201 = hir.int_to_ptr v198 : ptr; + hir.store v201, v195; + v425 = arith.constant 72 : u32; + v202 = hir.bitcast v99 : u32; + v204 = arith.add v202, v425 : u32 #[overflow = checked]; + v424 = arith.constant 4 : u32; + v206 = arith.mod v204, v424 : u32; + hir.assertz v206 #[code = 250]; + v207 = hir.int_to_ptr v204 : ptr; + hir.store v207, v193; + v209 = arith.constant 68 : u32; + v208 = hir.bitcast v99 : u32; + v210 = arith.add v208, v209 : u32 #[overflow = checked]; + v423 = arith.constant 4 : u32; + v212 = arith.mod v210, v423 : u32; + hir.assertz v212 #[code = 250]; + v213 = hir.int_to_ptr v210 : ptr; + hir.store v213, v191; + v422 = arith.constant 64 : u32; + v214 = hir.bitcast v99 : u32; + v216 = arith.add v214, v422 : u32 #[overflow = checked]; + v421 = arith.constant 4 : u32; + v218 = arith.mod v216, v421 : u32; + hir.assertz v218 #[code = 250]; + v219 = hir.int_to_ptr v216 : ptr; + hir.store v219, v189; + v419 = arith.constant 64 : i32; + v223 = arith.add v99, v419 : i32 #[overflow = wrapping]; + v420 = arith.constant 32 : i32; + v221 = arith.add v99, v420 : i32 #[overflow = wrapping]; + v224 = hir.exec @root_ns:root@1.0.0/rust_sdk_stdlib_smt_get/::eq(v221, v223) : i32 + v418 = arith.constant 0 : i32; + v92 = arith.constant 0 : i32; + v226 = arith.eq v224, v92 : i1; + v227 = arith.zext v226 : u32; + v228 = hir.bitcast v227 : i32; + v230 = arith.neq v228, v418 : i1; + v409 = scf.if v230 : u32 { + ^block36: + v405 = arith.constant 0 : u32; + scf.yield v405; + } else { + ^block13: + v231 = arith.constant 16 : i32; + v232 = arith.add v99, v231 : i32 #[overflow = wrapping]; + v233 = hir.exec @root_ns:root@1.0.0/rust_sdk_stdlib_smt_get/::eq(v185, v232) : i32 + v416 = arith.constant 0 : i32; + v417 = arith.constant 0 : i32; + v235 = arith.eq v233, v417 : i1; + v236 = arith.zext v235 : u32; + v237 = hir.bitcast v236 : i32; + v239 = arith.neq v237, v416 : i1; + scf.if v239{ + ^block35: + scf.yield ; + } else { + ^block14: + v240 = builtin.global_symbol @root_ns:root@1.0.0/rust_sdk_stdlib_smt_get/__stack_pointer : ptr + v241 = hir.bitcast v240 : ptr; + hir.store v241, v95; + scf.yield ; + }; + v407 = arith.constant 1 : u32; + v415 = arith.constant 0 : u32; + v413 = cf.select v239, v415, v407 : u32; + scf.yield v413; + }; + v414 = arith.constant 0 : u32; + v412 = arith.eq v409, v414 : i1; + cf.cond_br v412 ^block12, ^block38; + ^block12: + ub.unreachable ; + ^block38: + builtin.ret ; + }; + + private builtin.function @miden_stdlib_sys::intrinsics::word::Word::reverse(v242: i32, v243: i32) { + ^block15(v242: i32, v243: i32): + v246 = builtin.global_symbol @root_ns:root@1.0.0/rust_sdk_stdlib_smt_get/__stack_pointer : ptr + v247 = hir.bitcast v246 : ptr; + v248 = hir.load v247 : i32; + v249 = arith.constant 16 : i32; + v250 = arith.sub v248, v249 : i32 #[overflow = wrapping]; + v252 = arith.constant 8 : u32; + v251 = hir.bitcast v243 : u32; + v253 = arith.add v251, v252 : u32 #[overflow = checked]; + v523 = arith.constant 8 : u32; + v255 = arith.mod v253, v523 : u32; + hir.assertz v255 #[code = 250]; + v256 = hir.int_to_ptr v253 : ptr; + v257 = hir.load v256 : i64; + v522 = arith.constant 8 : u32; + v258 = hir.bitcast v250 : u32; + v260 = arith.add v258, v522 : u32 #[overflow = checked]; + v261 = arith.constant 4 : u32; + v262 = arith.mod v260, v261 : u32; + hir.assertz v262 #[code = 250]; + v263 = hir.int_to_ptr v260 : ptr; + hir.store v263, v257; + v264 = hir.bitcast v243 : u32; + v521 = arith.constant 8 : u32; + v266 = arith.mod v264, v521 : u32; + hir.assertz v266 #[code = 250]; + v267 = hir.int_to_ptr v264 : ptr; + v268 = hir.load v267 : i64; + v269 = hir.bitcast v250 : u32; + v520 = arith.constant 4 : u32; + v271 = arith.mod v269, v520 : u32; + hir.assertz v271 #[code = 250]; + v272 = hir.int_to_ptr v269 : ptr; + hir.store v272, v268; + v273 = arith.constant 12 : i32; + v274 = arith.add v250, v273 : i32 #[overflow = wrapping]; + v244 = arith.constant 0 : i32; + v491, v492, v493, v494, v495, v496 = scf.while v244, v250, v274, v242 : i32, i32, i32, i32, i32, i32 { + ^block48(v497: i32, v498: i32, v499: i32, v500: i32): + v519 = arith.constant 0 : i32; + v277 = arith.constant 8 : i32; + v278 = arith.eq v497, v277 : i1; + v279 = arith.zext v278 : u32; + v280 = hir.bitcast v279 : i32; + v282 = arith.neq v280, v519 : i1; + v485, v486 = scf.if v282 : i32, i32 { + ^block47: + v445 = ub.poison i32 : i32; + scf.yield v445, v445; + } else { + ^block20: + v284 = arith.add v498, v497 : i32 #[overflow = wrapping]; + v285 = hir.bitcast v284 : u32; + v518 = arith.constant 4 : u32; + v287 = arith.mod v285, v518 : u32; + hir.assertz v287 #[code = 250]; + v288 = hir.int_to_ptr v285 : ptr; + v289 = hir.load v288 : felt; + v291 = hir.bitcast v499 : u32; + v517 = arith.constant 4 : u32; + v293 = arith.mod v291, v517 : u32; + hir.assertz v293 #[code = 250]; + v294 = hir.int_to_ptr v291 : ptr; + v295 = hir.load v294 : i32; + v296 = hir.bitcast v284 : u32; + v516 = arith.constant 4 : u32; + v298 = arith.mod v296, v516 : u32; + hir.assertz v298 #[code = 250]; + v299 = hir.int_to_ptr v296 : ptr; + hir.store v299, v295; + v300 = hir.bitcast v499 : u32; + v515 = arith.constant 4 : u32; + v302 = arith.mod v300, v515 : u32; + hir.assertz v302 #[code = 250]; + v303 = hir.int_to_ptr v300 : ptr; + hir.store v303, v289; + v306 = arith.constant -4 : i32; + v307 = arith.add v499, v306 : i32 #[overflow = wrapping]; + v304 = arith.constant 4 : i32; + v305 = arith.add v497, v304 : i32 #[overflow = wrapping]; + scf.yield v305, v307; + }; + v513 = ub.poison i32 : i32; + v488 = cf.select v282, v513, v500 : i32; + v514 = ub.poison i32 : i32; + v487 = cf.select v282, v514, v498 : i32; + v444 = arith.constant 1 : u32; + v437 = arith.constant 0 : u32; + v490 = cf.select v282, v437, v444 : u32; + v478 = arith.trunc v490 : i1; + scf.condition v478, v485, v487, v486, v488, v498, v500; + } do { + ^block49(v501: i32, v502: i32, v503: i32, v504: i32, v505: i32, v506: i32): + scf.yield v501, v502, v503, v504; + }; + v512 = arith.constant 8 : u32; + v309 = hir.bitcast v495 : u32; + v311 = arith.add v309, v512 : u32 #[overflow = checked]; + v511 = arith.constant 4 : u32; + v313 = arith.mod v311, v511 : u32; + hir.assertz v313 #[code = 250]; + v314 = hir.int_to_ptr v311 : ptr; + v315 = hir.load v314 : i64; + v510 = arith.constant 8 : u32; + v316 = hir.bitcast v496 : u32; + v318 = arith.add v316, v510 : u32 #[overflow = checked]; + v509 = arith.constant 8 : u32; + v320 = arith.mod v318, v509 : u32; + hir.assertz v320 #[code = 250]; + v321 = hir.int_to_ptr v318 : ptr; + hir.store v321, v315; + v322 = hir.bitcast v495 : u32; + v508 = arith.constant 4 : u32; + v324 = arith.mod v322, v508 : u32; + hir.assertz v324 #[code = 250]; + v325 = hir.int_to_ptr v322 : ptr; + v326 = hir.load v325 : i64; + v327 = hir.bitcast v496 : u32; + v507 = arith.constant 8 : u32; + v329 = arith.mod v327, v507 : u32; + hir.assertz v329 #[code = 250]; + v330 = hir.int_to_ptr v327 : ptr; + hir.store v330, v326; + builtin.ret ; + }; + + private builtin.function @intrinsics::felt::from_u64_unchecked(v331: i64) -> felt { + ^block21(v331: i64): + v332 = hir.cast v331 : felt; + builtin.ret v332; + }; + + private builtin.function @intrinsics::felt::eq(v334: felt, v335: felt) -> i32 { + ^block23(v334: felt, v335: felt): + v336 = arith.eq v334, v335 : i1; + v337 = hir.cast v336 : i32; + builtin.ret v337; + }; + + private builtin.function @std::collections::smt::get(v339: felt, v340: felt, v341: felt, v342: felt, v343: felt, v344: felt, v345: felt, v346: felt, v347: i32) { + ^block25(v339: felt, v340: felt, v341: felt, v342: felt, v343: felt, v344: felt, v345: felt, v346: felt, v347: i32): + v348, v349, v350, v351, v352, v353, v354, v355 = hir.exec @std/collections/smt/get(v339, v340, v341, v342, v343, v344, v345, v346) : felt, felt, felt, felt, felt, felt, felt, felt + v356 = hir.bitcast v347 : u32; + v357 = hir.int_to_ptr v356 : ptr; + hir.store v357, v348; + v358 = arith.constant 4 : u32; + v359 = arith.add v356, v358 : u32 #[overflow = checked]; + v360 = hir.int_to_ptr v359 : ptr; + hir.store v360, v349; + v361 = arith.constant 8 : u32; + v362 = arith.add v356, v361 : u32 #[overflow = checked]; + v363 = hir.int_to_ptr v362 : ptr; + hir.store v363, v350; + v364 = arith.constant 12 : u32; + v365 = arith.add v356, v364 : u32 #[overflow = checked]; + v366 = hir.int_to_ptr v365 : ptr; + hir.store v366, v351; + v367 = arith.constant 16 : u32; + v368 = arith.add v356, v367 : u32 #[overflow = checked]; + v369 = hir.int_to_ptr v368 : ptr; + hir.store v369, v352; + v370 = arith.constant 20 : u32; + v371 = arith.add v356, v370 : u32 #[overflow = checked]; + v372 = hir.int_to_ptr v371 : ptr; + hir.store v372, v353; + v373 = arith.constant 24 : u32; + v374 = arith.add v356, v373 : u32 #[overflow = checked]; + v375 = hir.int_to_ptr v374 : ptr; + hir.store v375, v354; + v376 = arith.constant 28 : u32; + v377 = arith.add v356, v376 : u32 #[overflow = checked]; + v378 = hir.int_to_ptr v377 : ptr; + hir.store v378, v355; + builtin.ret ; + }; + + builtin.global_variable private @#__stack_pointer : i32 { + builtin.ret_imm 1048576; + }; + }; +}; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk_stdlib_smt_get.masm b/tests/integration/expected/rust_sdk_stdlib_smt_get.masm new file mode 100644 index 000000000..91d27b9ae --- /dev/null +++ b/tests/integration/expected/rust_sdk_stdlib_smt_get.masm @@ -0,0 +1,1034 @@ +# mod root_ns:root@1.0.0 + +proc.init + push.1179648 + trace.240 + exec.::intrinsics::mem::heap_init + trace.252 + push.1048576 + u32assert + mem_store.278528 +end + +# mod root_ns:root@1.0.0::rust_sdk_stdlib_smt_get + +proc.::eq + dup.0 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + dup.2 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + swap.1 + trace.240 + nop + exec.::root_ns:root@1.0.0::rust_sdk_stdlib_smt_get::intrinsics::felt::eq + trace.252 + nop + push.0 + push.1 + movup.2 + neq + neq + if.true + drop + drop + push.0 + else + push.4 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.4 + dup.3 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + swap.1 + trace.240 + nop + exec.::root_ns:root@1.0.0::rust_sdk_stdlib_smt_get::intrinsics::felt::eq + trace.252 + nop + push.0 + push.1 + movup.2 + neq + neq + if.true + drop + drop + push.0 + else + push.8 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.8 + dup.3 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + swap.1 + trace.240 + nop + exec.::root_ns:root@1.0.0::rust_sdk_stdlib_smt_get::intrinsics::felt::eq + trace.252 + nop + push.0 + push.1 + movup.2 + neq + neq + if.true + drop + drop + push.0 + else + push.12 + swap.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.12 + movup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + swap.1 + trace.240 + nop + exec.::root_ns:root@1.0.0::rust_sdk_stdlib_smt_get::intrinsics::felt::eq + trace.252 + nop + push.1 + eq + end + end + end +end + +export.entrypoint + push.1114112 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.4294967264 + push.128 + dup.2 + swap.1 + u32wrapping_sub + u32and + push.1114112 + dup.1 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.28 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + dup.10 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.24 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + dup.9 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.20 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + dup.8 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.16 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + dup.7 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.64 + dup.1 + u32wrapping_add + movup.2 + swap.10 + swap.4 + movdn.2 + swap.1 + swap.9 + swap.5 + swap.1 + swap.8 + swap.6 + trace.240 + nop + exec.::root_ns:root@1.0.0::rust_sdk_stdlib_smt_get::std::collections::smt::get + trace.252 + nop + push.72 + dup.1 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.104 + dup.3 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.64 + dup.1 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.96 + dup.3 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.88 + dup.1 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.120 + dup.3 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.80 + dup.1 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.112 + dup.3 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.96 + dup.1 + u32wrapping_add + push.32 + dup.2 + u32wrapping_add + trace.240 + nop + exec.::root_ns:root@1.0.0::rust_sdk_stdlib_smt_get::miden_stdlib_sys::intrinsics::word::Word::reverse + trace.252 + nop + push.48 + dup.1 + u32wrapping_add + push.112 + dup.2 + u32wrapping_add + dup.1 + trace.240 + nop + exec.::root_ns:root@1.0.0::rust_sdk_stdlib_smt_get::miden_stdlib_sys::intrinsics::word::Word::reverse + trace.252 + nop + push.10 + push.0 + trace.240 + nop + exec.::root_ns:root@1.0.0::rust_sdk_stdlib_smt_get::intrinsics::felt::from_u64_unchecked + trace.252 + nop + push.11 + push.0 + trace.240 + nop + exec.::root_ns:root@1.0.0::rust_sdk_stdlib_smt_get::intrinsics::felt::from_u64_unchecked + trace.252 + nop + push.12 + push.0 + trace.240 + nop + exec.::root_ns:root@1.0.0::rust_sdk_stdlib_smt_get::intrinsics::felt::from_u64_unchecked + trace.252 + nop + push.13 + push.0 + trace.240 + nop + exec.::root_ns:root@1.0.0::rust_sdk_stdlib_smt_get::intrinsics::felt::from_u64_unchecked + trace.252 + nop + push.76 + dup.6 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.72 + dup.5 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.68 + dup.4 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.64 + dup.3 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.64 + dup.2 + u32wrapping_add + push.32 + dup.3 + u32wrapping_add + trace.240 + nop + exec.::root_ns:root@1.0.0::rust_sdk_stdlib_smt_get::::eq + trace.252 + nop + push.0 + push.0 + movup.2 + eq + neq + if.true + drop + drop + drop + push.0 + else + push.16 + movup.2 + u32wrapping_add + swap.1 + trace.240 + nop + exec.::root_ns:root@1.0.0::rust_sdk_stdlib_smt_get::::eq + trace.252 + nop + push.0 + push.0 + movup.2 + eq + neq + dup.0 + if.true + swap.1 + drop + else + push.1114112 + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + end + push.1 + push.0 + movup.2 + cdrop + end + push.0 + eq + if.true + push.0 + assert + else + nop + end +end + +proc.miden_stdlib_sys::intrinsics::word::Word::reverse + push.1114112 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.16 + u32wrapping_sub + push.8 + dup.3 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.8 + dup.3 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + movup.2 + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + dup.2 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.12 + dup.1 + u32wrapping_add + push.0 + movup.2 + swap.1 + push.1 + while.true + push.0 + push.8 + dup.2 + eq + neq + dup.0 + if.true + movup.3 + movup.2 + drop + drop + push.3735929054 + dup.0 + else + dup.2 + dup.2 + u32wrapping_add + dup.0 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + dup.5 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + movup.2 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + dup.4 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.4294967292 + movup.4 + u32wrapping_add + push.4 + movup.3 + u32wrapping_add + end + push.3735929054 + dup.3 + dup.6 + swap.2 + swap.1 + cdrop + push.3735929054 + dup.4 + dup.6 + swap.2 + swap.1 + cdrop + push.1 + push.0 + movup.6 + cdrop + push.1 + u32and + swap.1 + swap.2 + swap.4 + swap.3 + swap.1 + if.true + movup.4 + drop + movup.4 + drop + push.1 + else + push.0 + end + end + drop + drop + drop + drop + push.8 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.8 + dup.4 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + movup.2 + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop +end + +proc.intrinsics::felt::from_u64_unchecked + dup.1 + dup.1 + push.1 + push.4294967295 + trace.240 + nop + exec.::std::math::u64::lt + trace.252 + nop + assert + mul.4294967296 + add +end + +proc.intrinsics::felt::eq + eq +end + +proc.std::collections::smt::get + trace.240 + nop + exec.::std::collections::smt::get + trace.252 + nop + movup.8 + dup.0 + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.4 + dup.1 + add + u32assert + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.8 + dup.1 + add + u32assert + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.12 + dup.1 + add + u32assert + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.16 + dup.1 + add + u32assert + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.20 + dup.1 + add + u32assert + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.24 + dup.1 + add + u32assert + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.28 + add + u32assert + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop +end + diff --git a/tests/integration/expected/rust_sdk_stdlib_smt_get.wat b/tests/integration/expected/rust_sdk_stdlib_smt_get.wat new file mode 100644 index 000000000..a91d62f9c --- /dev/null +++ b/tests/integration/expected/rust_sdk_stdlib_smt_get.wat @@ -0,0 +1,232 @@ +(module $rust_sdk_stdlib_smt_get.wasm + (type (;0;) (func (param i32 i32) (result i32))) + (type (;1;) (func (param f32 f32 f32 f32 f32 f32 f32 f32))) + (type (;2;) (func (param i32 i32))) + (type (;3;) (func (param i64) (result f32))) + (type (;4;) (func (param f32 f32) (result i32))) + (type (;5;) (func (param f32 f32 f32 f32 f32 f32 f32 f32 i32))) + (table (;0;) 1 1 funcref) + (memory (;0;) 16) + (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) + (export "memory" (memory 0)) + (export "entrypoint" (func $entrypoint)) + (func $::eq (;0;) (type 0) (param i32 i32) (result i32) + (local i32) + i32.const 0 + local.set 2 + block ;; label = @1 + local.get 0 + f32.load + local.get 1 + f32.load + call $intrinsics::felt::eq + i32.const 1 + i32.ne + br_if 0 (;@1;) + local.get 0 + f32.load offset=4 + local.get 1 + f32.load offset=4 + call $intrinsics::felt::eq + i32.const 1 + i32.ne + br_if 0 (;@1;) + local.get 0 + f32.load offset=8 + local.get 1 + f32.load offset=8 + call $intrinsics::felt::eq + i32.const 1 + i32.ne + br_if 0 (;@1;) + local.get 0 + f32.load offset=12 + local.get 1 + f32.load offset=12 + call $intrinsics::felt::eq + i32.const 1 + i32.eq + local.set 2 + end + local.get 2 + ) + (func $entrypoint (;1;) (type 1) (param f32 f32 f32 f32 f32 f32 f32 f32) + (local i32 i32 i32) + global.get $__stack_pointer + local.tee 8 + local.set 9 + local.get 8 + i32.const 128 + i32.sub + i32.const -32 + i32.and + local.tee 8 + global.set $__stack_pointer + local.get 8 + local.get 7 + f32.store offset=28 + local.get 8 + local.get 6 + f32.store offset=24 + local.get 8 + local.get 5 + f32.store offset=20 + local.get 8 + local.get 4 + f32.store offset=16 + local.get 3 + local.get 2 + local.get 1 + local.get 0 + local.get 7 + local.get 6 + local.get 5 + local.get 4 + local.get 8 + i32.const 64 + i32.add + call $std::collections::smt::get + local.get 8 + local.get 8 + i64.load offset=72 + i64.store offset=104 + local.get 8 + local.get 8 + i64.load offset=64 + i64.store offset=96 + local.get 8 + local.get 8 + i64.load offset=88 + i64.store offset=120 + local.get 8 + local.get 8 + i64.load offset=80 + i64.store offset=112 + local.get 8 + i32.const 32 + i32.add + local.get 8 + i32.const 96 + i32.add + call $miden_stdlib_sys::intrinsics::word::Word::reverse + local.get 8 + i32.const 48 + i32.add + local.tee 10 + local.get 8 + i32.const 112 + i32.add + call $miden_stdlib_sys::intrinsics::word::Word::reverse + i64.const 10 + call $intrinsics::felt::from_u64_unchecked + local.set 7 + i64.const 11 + call $intrinsics::felt::from_u64_unchecked + local.set 6 + i64.const 12 + call $intrinsics::felt::from_u64_unchecked + local.set 5 + local.get 8 + i64.const 13 + call $intrinsics::felt::from_u64_unchecked + f32.store offset=76 + local.get 8 + local.get 5 + f32.store offset=72 + local.get 8 + local.get 6 + f32.store offset=68 + local.get 8 + local.get 7 + f32.store offset=64 + block ;; label = @1 + local.get 8 + i32.const 32 + i32.add + local.get 8 + i32.const 64 + i32.add + call $::eq + i32.eqz + br_if 0 (;@1;) + local.get 10 + local.get 8 + i32.const 16 + i32.add + call $::eq + i32.eqz + br_if 0 (;@1;) + local.get 9 + global.set $__stack_pointer + return + end + unreachable + ) + (func $miden_stdlib_sys::intrinsics::word::Word::reverse (;2;) (type 2) (param i32 i32) + (local i32 i32 i32 f32) + global.get $__stack_pointer + i32.const 16 + i32.sub + local.tee 2 + local.get 1 + i64.load offset=8 + i64.store offset=8 align=4 + local.get 2 + local.get 1 + i64.load + i64.store align=4 + local.get 2 + i32.const 12 + i32.add + local.set 3 + i32.const 0 + local.set 1 + block ;; label = @1 + loop ;; label = @2 + local.get 1 + i32.const 8 + i32.eq + br_if 1 (;@1;) + local.get 2 + local.get 1 + i32.add + local.tee 4 + f32.load + local.set 5 + local.get 4 + local.get 3 + i32.load + i32.store + local.get 3 + local.get 5 + f32.store + local.get 1 + i32.const 4 + i32.add + local.set 1 + local.get 3 + i32.const -4 + i32.add + local.set 3 + br 0 (;@2;) + end + end + local.get 0 + local.get 2 + i64.load offset=8 align=4 + i64.store offset=8 + local.get 0 + local.get 2 + i64.load align=4 + i64.store + ) + (func $intrinsics::felt::from_u64_unchecked (;3;) (type 3) (param i64) (result f32) + unreachable + ) + (func $intrinsics::felt::eq (;4;) (type 4) (param f32 f32) (result i32) + unreachable + ) + (func $std::collections::smt::get (;5;) (type 5) (param f32 f32 f32 f32 f32 f32 f32 f32 i32) + unreachable + ) +) diff --git a/tests/integration/expected/rust_sdk_stdlib_smt_set.hir b/tests/integration/expected/rust_sdk_stdlib_smt_set.hir new file mode 100644 index 000000000..ba7a499f4 --- /dev/null +++ b/tests/integration/expected/rust_sdk_stdlib_smt_set.hir @@ -0,0 +1,514 @@ +builtin.component root_ns:root@1.0.0 { + builtin.module public @rust_sdk_stdlib_smt_set { + private builtin.function @::eq(v0: i32, v1: i32) -> i32 { + ^block4(v0: i32, v1: i32): + v5 = hir.bitcast v0 : u32; + v6 = arith.constant 4 : u32; + v7 = arith.mod v5, v6 : u32; + hir.assertz v7 #[code = 250]; + v8 = hir.int_to_ptr v5 : ptr; + v9 = hir.load v8 : felt; + v10 = hir.bitcast v1 : u32; + v416 = arith.constant 4 : u32; + v12 = arith.mod v10, v416 : u32; + hir.assertz v12 #[code = 250]; + v13 = hir.int_to_ptr v10 : ptr; + v14 = hir.load v13 : felt; + v15 = hir.exec @root_ns:root@1.0.0/rust_sdk_stdlib_smt_set/intrinsics::felt::eq(v9, v14) : i32 + v3 = arith.constant 0 : i32; + v16 = arith.constant 1 : i32; + v17 = arith.neq v15, v16 : i1; + v18 = arith.zext v17 : u32; + v19 = hir.bitcast v18 : i32; + v21 = arith.neq v19, v3 : i1; + v394 = scf.if v21 : i32 { + ^block6: + v415 = arith.constant 0 : i32; + scf.yield v415; + } else { + ^block7: + v414 = arith.constant 4 : u32; + v22 = hir.bitcast v0 : u32; + v24 = arith.add v22, v414 : u32 #[overflow = checked]; + v413 = arith.constant 4 : u32; + v26 = arith.mod v24, v413 : u32; + hir.assertz v26 #[code = 250]; + v27 = hir.int_to_ptr v24 : ptr; + v28 = hir.load v27 : felt; + v412 = arith.constant 4 : u32; + v29 = hir.bitcast v1 : u32; + v31 = arith.add v29, v412 : u32 #[overflow = checked]; + v411 = arith.constant 4 : u32; + v33 = arith.mod v31, v411 : u32; + hir.assertz v33 #[code = 250]; + v34 = hir.int_to_ptr v31 : ptr; + v35 = hir.load v34 : felt; + v36 = hir.exec @root_ns:root@1.0.0/rust_sdk_stdlib_smt_set/intrinsics::felt::eq(v28, v35) : i32 + v409 = arith.constant 0 : i32; + v410 = arith.constant 1 : i32; + v38 = arith.neq v36, v410 : i1; + v39 = arith.zext v38 : u32; + v40 = hir.bitcast v39 : i32; + v42 = arith.neq v40, v409 : i1; + v396 = scf.if v42 : i32 { + ^block31: + v408 = arith.constant 0 : i32; + scf.yield v408; + } else { + ^block8: + v44 = arith.constant 8 : u32; + v43 = hir.bitcast v0 : u32; + v45 = arith.add v43, v44 : u32 #[overflow = checked]; + v407 = arith.constant 4 : u32; + v47 = arith.mod v45, v407 : u32; + hir.assertz v47 #[code = 250]; + v48 = hir.int_to_ptr v45 : ptr; + v49 = hir.load v48 : felt; + v406 = arith.constant 8 : u32; + v50 = hir.bitcast v1 : u32; + v52 = arith.add v50, v406 : u32 #[overflow = checked]; + v405 = arith.constant 4 : u32; + v54 = arith.mod v52, v405 : u32; + hir.assertz v54 #[code = 250]; + v55 = hir.int_to_ptr v52 : ptr; + v56 = hir.load v55 : felt; + v57 = hir.exec @root_ns:root@1.0.0/rust_sdk_stdlib_smt_set/intrinsics::felt::eq(v49, v56) : i32 + v403 = arith.constant 0 : i32; + v404 = arith.constant 1 : i32; + v59 = arith.neq v57, v404 : i1; + v60 = arith.zext v59 : u32; + v61 = hir.bitcast v60 : i32; + v63 = arith.neq v61, v403 : i1; + v397 = scf.if v63 : i32 { + ^block30: + v402 = arith.constant 0 : i32; + scf.yield v402; + } else { + ^block9: + v65 = arith.constant 12 : u32; + v64 = hir.bitcast v0 : u32; + v66 = arith.add v64, v65 : u32 #[overflow = checked]; + v401 = arith.constant 4 : u32; + v68 = arith.mod v66, v401 : u32; + hir.assertz v68 #[code = 250]; + v69 = hir.int_to_ptr v66 : ptr; + v70 = hir.load v69 : felt; + v400 = arith.constant 12 : u32; + v71 = hir.bitcast v1 : u32; + v73 = arith.add v71, v400 : u32 #[overflow = checked]; + v399 = arith.constant 4 : u32; + v75 = arith.mod v73, v399 : u32; + hir.assertz v75 #[code = 250]; + v76 = hir.int_to_ptr v73 : ptr; + v77 = hir.load v76 : felt; + v78 = hir.exec @root_ns:root@1.0.0/rust_sdk_stdlib_smt_set/intrinsics::felt::eq(v70, v77) : i32 + v398 = arith.constant 1 : i32; + v80 = arith.eq v78, v398 : i1; + v81 = arith.zext v80 : u32; + v82 = hir.bitcast v81 : i32; + scf.yield v82; + }; + scf.yield v397; + }; + scf.yield v396; + }; + builtin.ret v394; + }; + + public builtin.function @entrypoint(v84: felt, v85: felt, v86: felt, v87: felt, v88: felt, v89: felt, v90: felt, v91: felt, v92: felt, v93: felt, v94: felt, v95: felt) { + ^block10(v84: felt, v85: felt, v86: felt, v87: felt, v88: felt, v89: felt, v90: felt, v91: felt, v92: felt, v93: felt, v94: felt, v95: felt): + v97 = builtin.global_symbol @root_ns:root@1.0.0/rust_sdk_stdlib_smt_set/__stack_pointer : ptr + v98 = hir.bitcast v97 : ptr; + v99 = hir.load v98 : i32; + v102 = arith.constant -32 : i32; + v100 = arith.constant 96 : i32; + v101 = arith.sub v99, v100 : i32 #[overflow = wrapping]; + v103 = arith.band v101, v102 : i32; + v104 = builtin.global_symbol @root_ns:root@1.0.0/rust_sdk_stdlib_smt_set/__stack_pointer : ptr + v105 = hir.bitcast v104 : ptr; + hir.store v105, v103; + v106 = arith.constant 32 : i32; + v107 = arith.add v103, v106 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/rust_sdk_stdlib_smt_set/std::collections::smt::set(v87, v86, v85, v84, v91, v90, v89, v88, v95, v94, v93, v92, v107) + v109 = arith.constant 40 : u32; + v108 = hir.bitcast v103 : u32; + v110 = arith.add v108, v109 : u32 #[overflow = checked]; + v111 = arith.constant 8 : u32; + v112 = arith.mod v110, v111 : u32; + hir.assertz v112 #[code = 250]; + v113 = hir.int_to_ptr v110 : ptr; + v114 = hir.load v113 : i64; + v116 = arith.constant 72 : u32; + v115 = hir.bitcast v103 : u32; + v117 = arith.add v115, v116 : u32 #[overflow = checked]; + v453 = arith.constant 8 : u32; + v119 = arith.mod v117, v453 : u32; + hir.assertz v119 #[code = 250]; + v120 = hir.int_to_ptr v117 : ptr; + hir.store v120, v114; + v122 = arith.constant 32 : u32; + v121 = hir.bitcast v103 : u32; + v123 = arith.add v121, v122 : u32 #[overflow = checked]; + v452 = arith.constant 8 : u32; + v125 = arith.mod v123, v452 : u32; + hir.assertz v125 #[code = 250]; + v126 = hir.int_to_ptr v123 : ptr; + v127 = hir.load v126 : i64; + v129 = arith.constant 64 : u32; + v128 = hir.bitcast v103 : u32; + v130 = arith.add v128, v129 : u32 #[overflow = checked]; + v451 = arith.constant 8 : u32; + v132 = arith.mod v130, v451 : u32; + hir.assertz v132 #[code = 250]; + v133 = hir.int_to_ptr v130 : ptr; + hir.store v133, v127; + v135 = arith.constant 56 : u32; + v134 = hir.bitcast v103 : u32; + v136 = arith.add v134, v135 : u32 #[overflow = checked]; + v450 = arith.constant 8 : u32; + v138 = arith.mod v136, v450 : u32; + hir.assertz v138 #[code = 250]; + v139 = hir.int_to_ptr v136 : ptr; + v140 = hir.load v139 : i64; + v142 = arith.constant 88 : u32; + v141 = hir.bitcast v103 : u32; + v143 = arith.add v141, v142 : u32 #[overflow = checked]; + v449 = arith.constant 8 : u32; + v145 = arith.mod v143, v449 : u32; + hir.assertz v145 #[code = 250]; + v146 = hir.int_to_ptr v143 : ptr; + hir.store v146, v140; + v148 = arith.constant 48 : u32; + v147 = hir.bitcast v103 : u32; + v149 = arith.add v147, v148 : u32 #[overflow = checked]; + v448 = arith.constant 8 : u32; + v151 = arith.mod v149, v448 : u32; + hir.assertz v151 #[code = 250]; + v152 = hir.int_to_ptr v149 : ptr; + v153 = hir.load v152 : i64; + v155 = arith.constant 80 : u32; + v154 = hir.bitcast v103 : u32; + v156 = arith.add v154, v155 : u32 #[overflow = checked]; + v447 = arith.constant 8 : u32; + v158 = arith.mod v156, v447 : u32; + hir.assertz v158 #[code = 250]; + v159 = hir.int_to_ptr v156 : ptr; + hir.store v159, v153; + v160 = arith.constant 64 : i32; + v161 = arith.add v103, v160 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/rust_sdk_stdlib_smt_set/miden_stdlib_sys::intrinsics::word::Word::reverse(v103, v161) + v162 = arith.constant 16 : i32; + v163 = arith.add v103, v162 : i32 #[overflow = wrapping]; + v164 = arith.constant 80 : i32; + v165 = arith.add v103, v164 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/rust_sdk_stdlib_smt_set/miden_stdlib_sys::intrinsics::word::Word::reverse(v163, v165) + v166 = arith.constant 0 : i64; + v167 = hir.exec @root_ns:root@1.0.0/rust_sdk_stdlib_smt_set/intrinsics::felt::from_u64_unchecked(v166) : felt + v446 = arith.constant 0 : i64; + v169 = hir.exec @root_ns:root@1.0.0/rust_sdk_stdlib_smt_set/intrinsics::felt::from_u64_unchecked(v446) : felt + v445 = arith.constant 0 : i64; + v171 = hir.exec @root_ns:root@1.0.0/rust_sdk_stdlib_smt_set/intrinsics::felt::from_u64_unchecked(v445) : felt + v444 = arith.constant 0 : i64; + v173 = hir.exec @root_ns:root@1.0.0/rust_sdk_stdlib_smt_set/intrinsics::felt::from_u64_unchecked(v444) : felt + v175 = arith.constant 92 : u32; + v174 = hir.bitcast v103 : u32; + v176 = arith.add v174, v175 : u32 #[overflow = checked]; + v177 = arith.constant 4 : u32; + v178 = arith.mod v176, v177 : u32; + hir.assertz v178 #[code = 250]; + v179 = hir.int_to_ptr v176 : ptr; + hir.store v179, v173; + v443 = arith.constant 88 : u32; + v180 = hir.bitcast v103 : u32; + v182 = arith.add v180, v443 : u32 #[overflow = checked]; + v442 = arith.constant 4 : u32; + v184 = arith.mod v182, v442 : u32; + hir.assertz v184 #[code = 250]; + v185 = hir.int_to_ptr v182 : ptr; + hir.store v185, v171; + v187 = arith.constant 84 : u32; + v186 = hir.bitcast v103 : u32; + v188 = arith.add v186, v187 : u32 #[overflow = checked]; + v441 = arith.constant 4 : u32; + v190 = arith.mod v188, v441 : u32; + hir.assertz v190 #[code = 250]; + v191 = hir.int_to_ptr v188 : ptr; + hir.store v191, v169; + v440 = arith.constant 80 : u32; + v192 = hir.bitcast v103 : u32; + v194 = arith.add v192, v440 : u32 #[overflow = checked]; + v439 = arith.constant 4 : u32; + v196 = arith.mod v194, v439 : u32; + hir.assertz v196 #[code = 250]; + v197 = hir.int_to_ptr v194 : ptr; + hir.store v197, v167; + v198 = arith.constant -8162549007765693629 : i64; + v199 = hir.exec @root_ns:root@1.0.0/rust_sdk_stdlib_smt_set/intrinsics::felt::from_u64_unchecked(v198) : felt + v200 = arith.constant 2968936853898945160 : i64; + v201 = hir.exec @root_ns:root@1.0.0/rust_sdk_stdlib_smt_set/intrinsics::felt::from_u64_unchecked(v200) : felt + v202 = arith.constant 4556576161526575002 : i64; + v203 = hir.exec @root_ns:root@1.0.0/rust_sdk_stdlib_smt_set/intrinsics::felt::from_u64_unchecked(v202) : felt + v204 = arith.constant 900237903234600995 : i64; + v205 = hir.exec @root_ns:root@1.0.0/rust_sdk_stdlib_smt_set/intrinsics::felt::from_u64_unchecked(v204) : felt + v207 = arith.constant 44 : u32; + v206 = hir.bitcast v103 : u32; + v208 = arith.add v206, v207 : u32 #[overflow = checked]; + v438 = arith.constant 4 : u32; + v210 = arith.mod v208, v438 : u32; + hir.assertz v210 #[code = 250]; + v211 = hir.int_to_ptr v208 : ptr; + hir.store v211, v205; + v437 = arith.constant 40 : u32; + v212 = hir.bitcast v103 : u32; + v214 = arith.add v212, v437 : u32 #[overflow = checked]; + v436 = arith.constant 4 : u32; + v216 = arith.mod v214, v436 : u32; + hir.assertz v216 #[code = 250]; + v217 = hir.int_to_ptr v214 : ptr; + hir.store v217, v203; + v219 = arith.constant 36 : u32; + v218 = hir.bitcast v103 : u32; + v220 = arith.add v218, v219 : u32 #[overflow = checked]; + v435 = arith.constant 4 : u32; + v222 = arith.mod v220, v435 : u32; + hir.assertz v222 #[code = 250]; + v223 = hir.int_to_ptr v220 : ptr; + hir.store v223, v201; + v434 = arith.constant 32 : u32; + v224 = hir.bitcast v103 : u32; + v226 = arith.add v224, v434 : u32 #[overflow = checked]; + v433 = arith.constant 4 : u32; + v228 = arith.mod v226, v433 : u32; + hir.assertz v228 #[code = 250]; + v229 = hir.int_to_ptr v226 : ptr; + hir.store v229, v199; + v432 = arith.constant 80 : i32; + v231 = arith.add v103, v432 : i32 #[overflow = wrapping]; + v232 = hir.exec @root_ns:root@1.0.0/rust_sdk_stdlib_smt_set/::eq(v103, v231) : i32 + v431 = arith.constant 0 : i32; + v96 = arith.constant 0 : i32; + v234 = arith.eq v232, v96 : i1; + v235 = arith.zext v234 : u32; + v236 = hir.bitcast v235 : i32; + v238 = arith.neq v236, v431 : i1; + v421 = scf.if v238 : u32 { + ^block36: + v417 = arith.constant 0 : u32; + scf.yield v417; + } else { + ^block13: + v430 = arith.constant 32 : i32; + v240 = arith.add v103, v430 : i32 #[overflow = wrapping]; + v241 = hir.exec @root_ns:root@1.0.0/rust_sdk_stdlib_smt_set/::eq(v163, v240) : i32 + v428 = arith.constant 0 : i32; + v429 = arith.constant 0 : i32; + v243 = arith.eq v241, v429 : i1; + v244 = arith.zext v243 : u32; + v245 = hir.bitcast v244 : i32; + v247 = arith.neq v245, v428 : i1; + scf.if v247{ + ^block35: + scf.yield ; + } else { + ^block14: + v248 = builtin.global_symbol @root_ns:root@1.0.0/rust_sdk_stdlib_smt_set/__stack_pointer : ptr + v249 = hir.bitcast v248 : ptr; + hir.store v249, v99; + scf.yield ; + }; + v419 = arith.constant 1 : u32; + v427 = arith.constant 0 : u32; + v425 = cf.select v247, v427, v419 : u32; + scf.yield v425; + }; + v426 = arith.constant 0 : u32; + v424 = arith.eq v421, v426 : i1; + cf.cond_br v424 ^block12, ^block38; + ^block12: + ub.unreachable ; + ^block38: + builtin.ret ; + }; + + private builtin.function @miden_stdlib_sys::intrinsics::word::Word::reverse(v250: i32, v251: i32) { + ^block15(v250: i32, v251: i32): + v254 = builtin.global_symbol @root_ns:root@1.0.0/rust_sdk_stdlib_smt_set/__stack_pointer : ptr + v255 = hir.bitcast v254 : ptr; + v256 = hir.load v255 : i32; + v257 = arith.constant 16 : i32; + v258 = arith.sub v256, v257 : i32 #[overflow = wrapping]; + v260 = arith.constant 8 : u32; + v259 = hir.bitcast v251 : u32; + v261 = arith.add v259, v260 : u32 #[overflow = checked]; + v540 = arith.constant 8 : u32; + v263 = arith.mod v261, v540 : u32; + hir.assertz v263 #[code = 250]; + v264 = hir.int_to_ptr v261 : ptr; + v265 = hir.load v264 : i64; + v539 = arith.constant 8 : u32; + v266 = hir.bitcast v258 : u32; + v268 = arith.add v266, v539 : u32 #[overflow = checked]; + v269 = arith.constant 4 : u32; + v270 = arith.mod v268, v269 : u32; + hir.assertz v270 #[code = 250]; + v271 = hir.int_to_ptr v268 : ptr; + hir.store v271, v265; + v272 = hir.bitcast v251 : u32; + v538 = arith.constant 8 : u32; + v274 = arith.mod v272, v538 : u32; + hir.assertz v274 #[code = 250]; + v275 = hir.int_to_ptr v272 : ptr; + v276 = hir.load v275 : i64; + v277 = hir.bitcast v258 : u32; + v537 = arith.constant 4 : u32; + v279 = arith.mod v277, v537 : u32; + hir.assertz v279 #[code = 250]; + v280 = hir.int_to_ptr v277 : ptr; + hir.store v280, v276; + v281 = arith.constant 12 : i32; + v282 = arith.add v258, v281 : i32 #[overflow = wrapping]; + v252 = arith.constant 0 : i32; + v508, v509, v510, v511, v512, v513 = scf.while v252, v258, v282, v250 : i32, i32, i32, i32, i32, i32 { + ^block48(v514: i32, v515: i32, v516: i32, v517: i32): + v536 = arith.constant 0 : i32; + v285 = arith.constant 8 : i32; + v286 = arith.eq v514, v285 : i1; + v287 = arith.zext v286 : u32; + v288 = hir.bitcast v287 : i32; + v290 = arith.neq v288, v536 : i1; + v502, v503 = scf.if v290 : i32, i32 { + ^block47: + v462 = ub.poison i32 : i32; + scf.yield v462, v462; + } else { + ^block20: + v292 = arith.add v515, v514 : i32 #[overflow = wrapping]; + v293 = hir.bitcast v292 : u32; + v535 = arith.constant 4 : u32; + v295 = arith.mod v293, v535 : u32; + hir.assertz v295 #[code = 250]; + v296 = hir.int_to_ptr v293 : ptr; + v297 = hir.load v296 : felt; + v299 = hir.bitcast v516 : u32; + v534 = arith.constant 4 : u32; + v301 = arith.mod v299, v534 : u32; + hir.assertz v301 #[code = 250]; + v302 = hir.int_to_ptr v299 : ptr; + v303 = hir.load v302 : i32; + v304 = hir.bitcast v292 : u32; + v533 = arith.constant 4 : u32; + v306 = arith.mod v304, v533 : u32; + hir.assertz v306 #[code = 250]; + v307 = hir.int_to_ptr v304 : ptr; + hir.store v307, v303; + v308 = hir.bitcast v516 : u32; + v532 = arith.constant 4 : u32; + v310 = arith.mod v308, v532 : u32; + hir.assertz v310 #[code = 250]; + v311 = hir.int_to_ptr v308 : ptr; + hir.store v311, v297; + v314 = arith.constant -4 : i32; + v315 = arith.add v516, v314 : i32 #[overflow = wrapping]; + v312 = arith.constant 4 : i32; + v313 = arith.add v514, v312 : i32 #[overflow = wrapping]; + scf.yield v313, v315; + }; + v530 = ub.poison i32 : i32; + v505 = cf.select v290, v530, v517 : i32; + v531 = ub.poison i32 : i32; + v504 = cf.select v290, v531, v515 : i32; + v461 = arith.constant 1 : u32; + v454 = arith.constant 0 : u32; + v507 = cf.select v290, v454, v461 : u32; + v495 = arith.trunc v507 : i1; + scf.condition v495, v502, v504, v503, v505, v515, v517; + } do { + ^block49(v518: i32, v519: i32, v520: i32, v521: i32, v522: i32, v523: i32): + scf.yield v518, v519, v520, v521; + }; + v529 = arith.constant 8 : u32; + v317 = hir.bitcast v512 : u32; + v319 = arith.add v317, v529 : u32 #[overflow = checked]; + v528 = arith.constant 4 : u32; + v321 = arith.mod v319, v528 : u32; + hir.assertz v321 #[code = 250]; + v322 = hir.int_to_ptr v319 : ptr; + v323 = hir.load v322 : i64; + v527 = arith.constant 8 : u32; + v324 = hir.bitcast v513 : u32; + v326 = arith.add v324, v527 : u32 #[overflow = checked]; + v526 = arith.constant 8 : u32; + v328 = arith.mod v326, v526 : u32; + hir.assertz v328 #[code = 250]; + v329 = hir.int_to_ptr v326 : ptr; + hir.store v329, v323; + v330 = hir.bitcast v512 : u32; + v525 = arith.constant 4 : u32; + v332 = arith.mod v330, v525 : u32; + hir.assertz v332 #[code = 250]; + v333 = hir.int_to_ptr v330 : ptr; + v334 = hir.load v333 : i64; + v335 = hir.bitcast v513 : u32; + v524 = arith.constant 8 : u32; + v337 = arith.mod v335, v524 : u32; + hir.assertz v337 #[code = 250]; + v338 = hir.int_to_ptr v335 : ptr; + hir.store v338, v334; + builtin.ret ; + }; + + private builtin.function @intrinsics::felt::from_u64_unchecked(v339: i64) -> felt { + ^block21(v339: i64): + v340 = hir.cast v339 : felt; + builtin.ret v340; + }; + + private builtin.function @intrinsics::felt::eq(v342: felt, v343: felt) -> i32 { + ^block23(v342: felt, v343: felt): + v344 = arith.eq v342, v343 : i1; + v345 = hir.cast v344 : i32; + builtin.ret v345; + }; + + private builtin.function @std::collections::smt::set(v347: felt, v348: felt, v349: felt, v350: felt, v351: felt, v352: felt, v353: felt, v354: felt, v355: felt, v356: felt, v357: felt, v358: felt, v359: i32) { + ^block25(v347: felt, v348: felt, v349: felt, v350: felt, v351: felt, v352: felt, v353: felt, v354: felt, v355: felt, v356: felt, v357: felt, v358: felt, v359: i32): + v360, v361, v362, v363, v364, v365, v366, v367 = hir.exec @std/collections/smt/set(v347, v348, v349, v350, v351, v352, v353, v354, v355, v356, v357, v358) : felt, felt, felt, felt, felt, felt, felt, felt + v368 = hir.bitcast v359 : u32; + v369 = hir.int_to_ptr v368 : ptr; + hir.store v369, v360; + v370 = arith.constant 4 : u32; + v371 = arith.add v368, v370 : u32 #[overflow = checked]; + v372 = hir.int_to_ptr v371 : ptr; + hir.store v372, v361; + v373 = arith.constant 8 : u32; + v374 = arith.add v368, v373 : u32 #[overflow = checked]; + v375 = hir.int_to_ptr v374 : ptr; + hir.store v375, v362; + v376 = arith.constant 12 : u32; + v377 = arith.add v368, v376 : u32 #[overflow = checked]; + v378 = hir.int_to_ptr v377 : ptr; + hir.store v378, v363; + v379 = arith.constant 16 : u32; + v380 = arith.add v368, v379 : u32 #[overflow = checked]; + v381 = hir.int_to_ptr v380 : ptr; + hir.store v381, v364; + v382 = arith.constant 20 : u32; + v383 = arith.add v368, v382 : u32 #[overflow = checked]; + v384 = hir.int_to_ptr v383 : ptr; + hir.store v384, v365; + v385 = arith.constant 24 : u32; + v386 = arith.add v368, v385 : u32 #[overflow = checked]; + v387 = hir.int_to_ptr v386 : ptr; + hir.store v387, v366; + v388 = arith.constant 28 : u32; + v389 = arith.add v368, v388 : u32 #[overflow = checked]; + v390 = hir.int_to_ptr v389 : ptr; + hir.store v390, v367; + builtin.ret ; + }; + + builtin.global_variable private @#__stack_pointer : i32 { + builtin.ret_imm 1048576; + }; + }; +}; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk_stdlib_smt_set.masm b/tests/integration/expected/rust_sdk_stdlib_smt_set.masm new file mode 100644 index 000000000..831e32c4c --- /dev/null +++ b/tests/integration/expected/rust_sdk_stdlib_smt_set.masm @@ -0,0 +1,1052 @@ +# mod root_ns:root@1.0.0 + +proc.init + push.1179648 + trace.240 + exec.::intrinsics::mem::heap_init + trace.252 + push.1048576 + u32assert + mem_store.278528 +end + +# mod root_ns:root@1.0.0::rust_sdk_stdlib_smt_set + +proc.::eq + dup.0 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + dup.2 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + swap.1 + trace.240 + nop + exec.::root_ns:root@1.0.0::rust_sdk_stdlib_smt_set::intrinsics::felt::eq + trace.252 + nop + push.0 + push.1 + movup.2 + neq + neq + if.true + drop + drop + push.0 + else + push.4 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.4 + dup.3 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + swap.1 + trace.240 + nop + exec.::root_ns:root@1.0.0::rust_sdk_stdlib_smt_set::intrinsics::felt::eq + trace.252 + nop + push.0 + push.1 + movup.2 + neq + neq + if.true + drop + drop + push.0 + else + push.8 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.8 + dup.3 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + swap.1 + trace.240 + nop + exec.::root_ns:root@1.0.0::rust_sdk_stdlib_smt_set::intrinsics::felt::eq + trace.252 + nop + push.0 + push.1 + movup.2 + neq + neq + if.true + drop + drop + push.0 + else + push.12 + swap.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.12 + movup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + swap.1 + trace.240 + nop + exec.::root_ns:root@1.0.0::rust_sdk_stdlib_smt_set::intrinsics::felt::eq + trace.252 + nop + push.1 + eq + end + end + end +end + +export.entrypoint + push.1114112 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.4294967264 + push.96 + dup.2 + swap.1 + u32wrapping_sub + u32and + push.1114112 + dup.1 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.32 + dup.1 + u32wrapping_add + swap.1 + swap.13 + swap.9 + swap.5 + swap.1 + swap.12 + swap.10 + swap.4 + swap.2 + swap.14 + swap.8 + swap.6 + trace.240 + nop + exec.::root_ns:root@1.0.0::rust_sdk_stdlib_smt_set::std::collections::smt::set + trace.252 + nop + push.40 + dup.1 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.72 + dup.3 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.32 + dup.1 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.64 + dup.3 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.56 + dup.1 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.88 + dup.3 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.48 + dup.1 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.80 + dup.3 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.64 + dup.1 + u32wrapping_add + dup.1 + trace.240 + nop + exec.::root_ns:root@1.0.0::rust_sdk_stdlib_smt_set::miden_stdlib_sys::intrinsics::word::Word::reverse + trace.252 + nop + push.16 + dup.1 + u32wrapping_add + push.80 + dup.2 + u32wrapping_add + dup.1 + trace.240 + nop + exec.::root_ns:root@1.0.0::rust_sdk_stdlib_smt_set::miden_stdlib_sys::intrinsics::word::Word::reverse + trace.252 + nop + push.0 + push.0 + trace.240 + nop + exec.::root_ns:root@1.0.0::rust_sdk_stdlib_smt_set::intrinsics::felt::from_u64_unchecked + trace.252 + nop + push.0 + push.0 + trace.240 + nop + exec.::root_ns:root@1.0.0::rust_sdk_stdlib_smt_set::intrinsics::felt::from_u64_unchecked + trace.252 + nop + push.0 + push.0 + trace.240 + nop + exec.::root_ns:root@1.0.0::rust_sdk_stdlib_smt_set::intrinsics::felt::from_u64_unchecked + trace.252 + nop + push.0 + push.0 + trace.240 + nop + exec.::root_ns:root@1.0.0::rust_sdk_stdlib_smt_set::intrinsics::felt::from_u64_unchecked + trace.252 + nop + push.92 + dup.6 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.88 + dup.5 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.84 + dup.4 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.80 + dup.3 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.2858982211 + push.2394475756 + trace.240 + nop + exec.::root_ns:root@1.0.0::rust_sdk_stdlib_smt_set::intrinsics::felt::from_u64_unchecked + trace.252 + nop + push.2838913672 + push.691259478 + trace.240 + nop + exec.::root_ns:root@1.0.0::rust_sdk_stdlib_smt_set::intrinsics::felt::from_u64_unchecked + trace.252 + nop + push.2345529242 + push.1060910560 + trace.240 + nop + exec.::root_ns:root@1.0.0::rust_sdk_stdlib_smt_set::intrinsics::felt::from_u64_unchecked + trace.252 + nop + push.1940131875 + push.209602970 + trace.240 + nop + exec.::root_ns:root@1.0.0::rust_sdk_stdlib_smt_set::intrinsics::felt::from_u64_unchecked + trace.252 + nop + push.44 + dup.6 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.40 + dup.5 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.36 + dup.4 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.32 + dup.3 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.80 + dup.2 + u32wrapping_add + dup.2 + trace.240 + nop + exec.::root_ns:root@1.0.0::rust_sdk_stdlib_smt_set::::eq + trace.252 + nop + push.0 + push.0 + movup.2 + eq + neq + if.true + drop + drop + drop + push.0 + else + push.32 + movup.2 + u32wrapping_add + swap.1 + trace.240 + nop + exec.::root_ns:root@1.0.0::rust_sdk_stdlib_smt_set::::eq + trace.252 + nop + push.0 + push.0 + movup.2 + eq + neq + dup.0 + if.true + swap.1 + drop + else + push.1114112 + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + end + push.1 + push.0 + movup.2 + cdrop + end + push.0 + eq + if.true + push.0 + assert + else + nop + end +end + +proc.miden_stdlib_sys::intrinsics::word::Word::reverse + push.1114112 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.16 + u32wrapping_sub + push.8 + dup.3 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.8 + dup.3 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + movup.2 + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + dup.2 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.12 + dup.1 + u32wrapping_add + push.0 + movup.2 + swap.1 + push.1 + while.true + push.0 + push.8 + dup.2 + eq + neq + dup.0 + if.true + movup.3 + movup.2 + drop + drop + push.3735929054 + dup.0 + else + dup.2 + dup.2 + u32wrapping_add + dup.0 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + dup.5 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + movup.2 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + dup.4 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.4294967292 + movup.4 + u32wrapping_add + push.4 + movup.3 + u32wrapping_add + end + push.3735929054 + dup.3 + dup.6 + swap.2 + swap.1 + cdrop + push.3735929054 + dup.4 + dup.6 + swap.2 + swap.1 + cdrop + push.1 + push.0 + movup.6 + cdrop + push.1 + u32and + swap.1 + swap.2 + swap.4 + swap.3 + swap.1 + if.true + movup.4 + drop + movup.4 + drop + push.1 + else + push.0 + end + end + drop + drop + drop + drop + push.8 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + push.8 + dup.4 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + movup.2 + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop +end + +proc.intrinsics::felt::from_u64_unchecked + dup.1 + dup.1 + push.1 + push.4294967295 + trace.240 + nop + exec.::std::math::u64::lt + trace.252 + nop + assert + mul.4294967296 + add +end + +proc.intrinsics::felt::eq + eq +end + +proc.std::collections::smt::set + trace.240 + nop + exec.::std::collections::smt::set + trace.252 + nop + movup.8 + dup.0 + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.4 + dup.1 + add + u32assert + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.8 + dup.1 + add + u32assert + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.12 + dup.1 + add + u32assert + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.16 + dup.1 + add + u32assert + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.20 + dup.1 + add + u32assert + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.24 + dup.1 + add + u32assert + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.28 + add + u32assert + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop +end + diff --git a/tests/integration/expected/rust_sdk_stdlib_smt_set.wat b/tests/integration/expected/rust_sdk_stdlib_smt_set.wat new file mode 100644 index 000000000..3eaa28769 --- /dev/null +++ b/tests/integration/expected/rust_sdk_stdlib_smt_set.wat @@ -0,0 +1,242 @@ +(module $rust_sdk_stdlib_smt_set.wasm + (type (;0;) (func (param i32 i32) (result i32))) + (type (;1;) (func (param f32 f32 f32 f32 f32 f32 f32 f32 f32 f32 f32 f32))) + (type (;2;) (func (param i32 i32))) + (type (;3;) (func (param i64) (result f32))) + (type (;4;) (func (param f32 f32) (result i32))) + (type (;5;) (func (param f32 f32 f32 f32 f32 f32 f32 f32 f32 f32 f32 f32 i32))) + (table (;0;) 1 1 funcref) + (memory (;0;) 16) + (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) + (export "memory" (memory 0)) + (export "entrypoint" (func $entrypoint)) + (func $::eq (;0;) (type 0) (param i32 i32) (result i32) + (local i32) + i32.const 0 + local.set 2 + block ;; label = @1 + local.get 0 + f32.load + local.get 1 + f32.load + call $intrinsics::felt::eq + i32.const 1 + i32.ne + br_if 0 (;@1;) + local.get 0 + f32.load offset=4 + local.get 1 + f32.load offset=4 + call $intrinsics::felt::eq + i32.const 1 + i32.ne + br_if 0 (;@1;) + local.get 0 + f32.load offset=8 + local.get 1 + f32.load offset=8 + call $intrinsics::felt::eq + i32.const 1 + i32.ne + br_if 0 (;@1;) + local.get 0 + f32.load offset=12 + local.get 1 + f32.load offset=12 + call $intrinsics::felt::eq + i32.const 1 + i32.eq + local.set 2 + end + local.get 2 + ) + (func $entrypoint (;1;) (type 1) (param f32 f32 f32 f32 f32 f32 f32 f32 f32 f32 f32 f32) + (local i32 i32 i32) + global.get $__stack_pointer + local.tee 12 + local.set 13 + local.get 12 + i32.const 96 + i32.sub + i32.const -32 + i32.and + local.tee 12 + global.set $__stack_pointer + local.get 3 + local.get 2 + local.get 1 + local.get 0 + local.get 7 + local.get 6 + local.get 5 + local.get 4 + local.get 11 + local.get 10 + local.get 9 + local.get 8 + local.get 12 + i32.const 32 + i32.add + call $std::collections::smt::set + local.get 12 + local.get 12 + i64.load offset=40 + i64.store offset=72 + local.get 12 + local.get 12 + i64.load offset=32 + i64.store offset=64 + local.get 12 + local.get 12 + i64.load offset=56 + i64.store offset=88 + local.get 12 + local.get 12 + i64.load offset=48 + i64.store offset=80 + local.get 12 + local.get 12 + i32.const 64 + i32.add + call $miden_stdlib_sys::intrinsics::word::Word::reverse + local.get 12 + i32.const 16 + i32.add + local.tee 14 + local.get 12 + i32.const 80 + i32.add + call $miden_stdlib_sys::intrinsics::word::Word::reverse + i64.const 0 + call $intrinsics::felt::from_u64_unchecked + local.set 8 + i64.const 0 + call $intrinsics::felt::from_u64_unchecked + local.set 9 + i64.const 0 + call $intrinsics::felt::from_u64_unchecked + local.set 10 + local.get 12 + i64.const 0 + call $intrinsics::felt::from_u64_unchecked + f32.store offset=92 + local.get 12 + local.get 10 + f32.store offset=88 + local.get 12 + local.get 9 + f32.store offset=84 + local.get 12 + local.get 8 + f32.store offset=80 + i64.const -8162549007765693629 + call $intrinsics::felt::from_u64_unchecked + local.set 8 + i64.const 2968936853898945160 + call $intrinsics::felt::from_u64_unchecked + local.set 9 + i64.const 4556576161526575002 + call $intrinsics::felt::from_u64_unchecked + local.set 10 + local.get 12 + i64.const 900237903234600995 + call $intrinsics::felt::from_u64_unchecked + f32.store offset=44 + local.get 12 + local.get 10 + f32.store offset=40 + local.get 12 + local.get 9 + f32.store offset=36 + local.get 12 + local.get 8 + f32.store offset=32 + block ;; label = @1 + local.get 12 + local.get 12 + i32.const 80 + i32.add + call $::eq + i32.eqz + br_if 0 (;@1;) + local.get 14 + local.get 12 + i32.const 32 + i32.add + call $::eq + i32.eqz + br_if 0 (;@1;) + local.get 13 + global.set $__stack_pointer + return + end + unreachable + ) + (func $miden_stdlib_sys::intrinsics::word::Word::reverse (;2;) (type 2) (param i32 i32) + (local i32 i32 i32 f32) + global.get $__stack_pointer + i32.const 16 + i32.sub + local.tee 2 + local.get 1 + i64.load offset=8 + i64.store offset=8 align=4 + local.get 2 + local.get 1 + i64.load + i64.store align=4 + local.get 2 + i32.const 12 + i32.add + local.set 3 + i32.const 0 + local.set 1 + block ;; label = @1 + loop ;; label = @2 + local.get 1 + i32.const 8 + i32.eq + br_if 1 (;@1;) + local.get 2 + local.get 1 + i32.add + local.tee 4 + f32.load + local.set 5 + local.get 4 + local.get 3 + i32.load + i32.store + local.get 3 + local.get 5 + f32.store + local.get 1 + i32.const 4 + i32.add + local.set 1 + local.get 3 + i32.const -4 + i32.add + local.set 3 + br 0 (;@2;) + end + end + local.get 0 + local.get 2 + i64.load offset=8 align=4 + i64.store offset=8 + local.get 0 + local.get 2 + i64.load align=4 + i64.store + ) + (func $intrinsics::felt::from_u64_unchecked (;3;) (type 3) (param i64) (result f32) + unreachable + ) + (func $intrinsics::felt::eq (;4;) (type 4) (param f32 f32) (result i32) + unreachable + ) + (func $std::collections::smt::set (;5;) (type 5) (param f32 f32 f32 f32 f32 f32 f32 f32 f32 f32 f32 f32 i32) + unreachable + ) +) diff --git a/tests/integration/src/rust_masm_tests/rust_sdk/stdlib/collections.rs b/tests/integration/src/rust_masm_tests/rust_sdk/stdlib/collections.rs new file mode 100644 index 000000000..559d345c9 --- /dev/null +++ b/tests/integration/src/rust_masm_tests/rust_sdk/stdlib/collections.rs @@ -0,0 +1,210 @@ +use miden_core::{ + crypto::merkle::{MerkleStore, Smt}, + Felt, FieldElement, Word, +}; +use miden_processor::AdviceInputs; +use midenc_debug::Executor; +use midenc_expect_test::expect_file; +use midenc_frontend_wasm::WasmTranslationConfig; + +use crate::CompilerTest; + +fn felt(value: u64) -> Felt { + Felt::new(value) +} + +fn word(e0: u64, e1: u64, e2: u64, e3: u64) -> Word { + [felt(e0), felt(e1), felt(e2), felt(e3)].into() +} + +fn build_advice_inputs_for_smt(smt: &Smt) -> AdviceInputs { + let store = MerkleStore::from(smt); + let map = smt + .leaves() + .map(|(_, leaf)| (leaf.hash(), leaf.to_elements())) + .collect::>(); + + AdviceInputs::default() + .with_stack([Felt::ZERO]) + .with_map(map) + .with_merkle_store(store) +} + +fn word_components(word: Word) -> [Felt; 4] { + word.into() +} + +fn word_to_u64s(word: Word) -> [u64; 4] { + let [a, b, c, d] = word_components(word); + [a.as_int(), b.as_int(), c.as_int(), d.as_int()] +} + +fn push_word_args(args: &mut Vec, word: Word) { + let [a, b, c, d] = word_components(word); + args.push(d); + args.push(c); + args.push(b); + args.push(a); +} + +#[test] +fn test_smt_get_binding() { + let entries = [ + (word(1, 2, 3, 100), word(10, 11, 12, 13)), + (word(5, 6, 7, 200), word(20, 21, 22, 23)), + (word(8, 9, 10, 200), word(30, 31, 32, 33)), + ]; + let smt = Smt::with_entries(entries).expect("smt initialization failed"); + let (key, expected_value) = entries[0]; + let root = smt.root(); + + let expected_value_u64 = word_to_u64s(expected_value); + + let main_fn = format!( + r#" + ( + k0: Felt, + k1: Felt, + k2: Felt, + k3: Felt, + r0: Felt, + r1: Felt, + r2: Felt, + r3: Felt + ) {{ + let key = Word::new([k0, k1, k2, k3]); + let root = Word::new([r0, r1, r2, r3]); + let result = smt_get(key, root); + let value = result.value; + let returned_root = result.root; + + let expected = Word::new([ + Felt::from_u64_unchecked({ev0}), + Felt::from_u64_unchecked({ev1}), + Felt::from_u64_unchecked({ev2}), + Felt::from_u64_unchecked({ev3}), + ]); + assert_eq!(value, expected, "smt_get returned unexpected value"); + assert_eq!(returned_root, root, "smt_get should not mutate the root"); + }}"#, + ev0 = expected_value_u64[0], + ev1 = expected_value_u64[1], + ev2 = expected_value_u64[2], + ev3 = expected_value_u64[3], + ); + + let config = WasmTranslationConfig::default(); + let mut test = CompilerTest::rust_fn_body_with_stdlib_sys( + "rust_sdk_stdlib_smt_get", + &main_fn, + config, + ["--test-harness".into()], + ); + test.expect_wasm(expect_file!["../../../../expected/rust_sdk_stdlib_smt_get.wat"]); + test.expect_ir(expect_file!["../../../../expected/rust_sdk_stdlib_smt_get.hir"]); + test.expect_masm(expect_file!["../../../../expected/rust_sdk_stdlib_smt_get.masm"]); + + let package = test.compiled_package(); + + let advice_inputs = build_advice_inputs_for_smt(&smt); + + let mut args = Vec::new(); + push_word_args(&mut args, root); + push_word_args(&mut args, key); + + let mut exec = Executor::for_package(&package, args.clone(), &test.session) + .expect("executor creation failed"); + exec.with_advice_inputs(advice_inputs); + + exec.execute(&package.unwrap_program(), &test.session); +} + +#[test] +fn test_smt_set_binding() { + let key = word(5, 6, 7, 200); + let new_value = word(40, 41, 42, 43); + + let smt = Smt::new(); + let root = smt.root(); + + let mut expected_smt = smt.clone(); + let expected_old_value = expected_smt.insert(key, new_value); + let expected_new_root = expected_smt.root(); + + let expected_old_u64 = word_to_u64s(expected_old_value); + let expected_new_u64 = word_to_u64s(expected_new_root); + + let main_fn = format!( + r#" + ( + v0: Felt, + v1: Felt, + v2: Felt, + v3: Felt, + k0: Felt, + k1: Felt, + k2: Felt, + k3: Felt, + r0: Felt, + r1: Felt, + r2: Felt, + r3: Felt + ) {{ + let value = Word::new([v0, v1, v2, v3]); + let key = Word::new([k0, k1, k2, k3]); + let root = Word::new([r0, r1, r2, r3]); + let result = smt_set(value, key, root); + let old_value = result.old_value; + let new_root = result.new_root; + + let expected_old = Word::new([ + Felt::from_u64_unchecked({eo0}), + Felt::from_u64_unchecked({eo1}), + Felt::from_u64_unchecked({eo2}), + Felt::from_u64_unchecked({eo3}), + ]); + let expected_new = Word::new([ + Felt::from_u64_unchecked({en0}), + Felt::from_u64_unchecked({en1}), + Felt::from_u64_unchecked({en2}), + Felt::from_u64_unchecked({en3}), + ]); + assert_eq!(old_value, expected_old, "smt_set returned unexpected old value"); + assert_eq!(new_root, expected_new, "smt_set returned unexpected new root"); + }}"#, + eo0 = expected_old_u64[0], + eo1 = expected_old_u64[1], + eo2 = expected_old_u64[2], + eo3 = expected_old_u64[3], + en0 = expected_new_u64[0], + en1 = expected_new_u64[1], + en2 = expected_new_u64[2], + en3 = expected_new_u64[3], + ); + + let config = WasmTranslationConfig::default(); + let mut test = CompilerTest::rust_fn_body_with_stdlib_sys( + "rust_sdk_stdlib_smt_set", + &main_fn, + config, + ["--test-harness".into()], + ); + test.expect_wasm(expect_file!["../../../../expected/rust_sdk_stdlib_smt_set.wat"]); + test.expect_ir(expect_file!["../../../../expected/rust_sdk_stdlib_smt_set.hir"]); + test.expect_masm(expect_file!["../../../../expected/rust_sdk_stdlib_smt_set.masm"]); + + let package = test.compiled_package(); + + let advice_inputs = build_advice_inputs_for_smt(&smt); + + let mut args = Vec::new(); + push_word_args(&mut args, root); + push_word_args(&mut args, key); + push_word_args(&mut args, new_value); + + let mut exec = Executor::for_package(&package, args.clone(), &test.session) + .expect("executor creation failed"); + exec.with_advice_inputs(advice_inputs); + + exec.execute(&package.unwrap_program(), &test.session); +} diff --git a/tests/integration/src/rust_masm_tests/rust_sdk/stdlib/mod.rs b/tests/integration/src/rust_masm_tests/rust_sdk/stdlib/mod.rs index 0cbac7e21..f91fdd96a 100644 --- a/tests/integration/src/rust_masm_tests/rust_sdk/stdlib/mod.rs +++ b/tests/integration/src/rust_masm_tests/rust_sdk/stdlib/mod.rs @@ -1 +1,2 @@ +mod collections; mod hashes; From 31c766498b2485b6cc7d80ee30ec21c6c12d5f9f Mon Sep 17 00:00:00 2001 From: Denys Zadorozhnyi Date: Wed, 12 Nov 2025 11:41:25 +0200 Subject: [PATCH 18/19] chore: fix after rebase (new VM version) --- .../expected/rust_sdk_stdlib_sha256_hash.masm | 23 ++++++-- .../expected/rust_sdk_stdlib_smt_get.masm | 36 ++++++++++--- .../expected/rust_sdk_stdlib_smt_set.masm | 53 ++++++++++++++++--- .../rust_sdk/stdlib/collections.rs | 34 +++++++++--- 4 files changed, 120 insertions(+), 26 deletions(-) diff --git a/tests/integration/expected/rust_sdk_stdlib_sha256_hash.masm b/tests/integration/expected/rust_sdk_stdlib_sha256_hash.masm index 51637a1b6..34c36852e 100644 --- a/tests/integration/expected/rust_sdk_stdlib_sha256_hash.masm +++ b/tests/integration/expected/rust_sdk_stdlib_sha256_hash.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -12,7 +12,10 @@ end # mod root_ns:root@1.0.0::rust_sdk_stdlib_sha256_hash -proc.core::slice::::reverse +@callconv("C") +proc core::slice::::reverse( + i32 +) push.3 dup.1 u32wrapping_add @@ -146,7 +149,8 @@ proc.core::slice::::reverse drop end -export.entrypoint +@callconv("C") +pub proc entrypoint(i32, i32) push.1114112 u32divmod.4 swap.1 @@ -824,7 +828,18 @@ export.entrypoint nop end -proc.std::crypto::hashes::sha256::hash_1to1 +@callconv("C") +proc std::crypto::hashes::sha256::hash_1to1( + i32, + i32, + i32, + i32, + i32, + i32, + i32, + i32, + i32 +) trace.240 nop exec.::std::crypto::hashes::sha256::hash_1to1 diff --git a/tests/integration/expected/rust_sdk_stdlib_smt_get.masm b/tests/integration/expected/rust_sdk_stdlib_smt_get.masm index 91d27b9ae..85534d6d6 100644 --- a/tests/integration/expected/rust_sdk_stdlib_smt_get.masm +++ b/tests/integration/expected/rust_sdk_stdlib_smt_get.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -12,7 +12,11 @@ end # mod root_ns:root@1.0.0::rust_sdk_stdlib_smt_get -proc.::eq +@callconv("C") +proc ::eq( + i32, + i32 +) -> i32 dup.0 push.4 dup.1 @@ -204,7 +208,8 @@ proc.::eq end end -export.entrypoint +@callconv("C") +pub proc entrypoint(felt, felt, felt, felt, felt, felt, felt, felt) push.1114112 u32divmod.4 swap.1 @@ -645,7 +650,11 @@ export.entrypoint end end -proc.miden_stdlib_sys::intrinsics::word::Word::reverse +@callconv("C") +proc miden_stdlib_sys::intrinsics::word::Word::reverse( + i32, + i32 +) push.1114112 u32divmod.4 swap.1 @@ -906,7 +915,8 @@ proc.miden_stdlib_sys::intrinsics::word::Word::reverse nop end -proc.intrinsics::felt::from_u64_unchecked +@callconv("C") +proc intrinsics::felt::from_u64_unchecked([u32; 2]) -> felt dup.1 dup.1 push.1 @@ -921,11 +931,23 @@ proc.intrinsics::felt::from_u64_unchecked add end -proc.intrinsics::felt::eq +@callconv("C") +proc intrinsics::felt::eq(felt, felt) -> i32 eq end -proc.std::collections::smt::get +@callconv("C") +proc std::collections::smt::get( + felt, + felt, + felt, + felt, + felt, + felt, + felt, + felt, + i32 +) trace.240 nop exec.::std::collections::smt::get diff --git a/tests/integration/expected/rust_sdk_stdlib_smt_set.masm b/tests/integration/expected/rust_sdk_stdlib_smt_set.masm index 831e32c4c..5da6cea82 100644 --- a/tests/integration/expected/rust_sdk_stdlib_smt_set.masm +++ b/tests/integration/expected/rust_sdk_stdlib_smt_set.masm @@ -1,6 +1,6 @@ # mod root_ns:root@1.0.0 -proc.init +proc init push.1179648 trace.240 exec.::intrinsics::mem::heap_init @@ -12,7 +12,11 @@ end # mod root_ns:root@1.0.0::rust_sdk_stdlib_smt_set -proc.::eq +@callconv("C") +proc ::eq( + i32, + i32 +) -> i32 dup.0 push.4 dup.1 @@ -204,7 +208,21 @@ proc.::eq end end -export.entrypoint +@callconv("C") +pub proc entrypoint( + felt, + felt, + felt, + felt, + felt, + felt, + felt, + felt, + felt, + felt, + felt, + felt +) push.1114112 u32divmod.4 swap.1 @@ -663,7 +681,11 @@ export.entrypoint end end -proc.miden_stdlib_sys::intrinsics::word::Word::reverse +@callconv("C") +proc miden_stdlib_sys::intrinsics::word::Word::reverse( + i32, + i32 +) push.1114112 u32divmod.4 swap.1 @@ -924,7 +946,8 @@ proc.miden_stdlib_sys::intrinsics::word::Word::reverse nop end -proc.intrinsics::felt::from_u64_unchecked +@callconv("C") +proc intrinsics::felt::from_u64_unchecked([u32; 2]) -> felt dup.1 dup.1 push.1 @@ -939,11 +962,27 @@ proc.intrinsics::felt::from_u64_unchecked add end -proc.intrinsics::felt::eq +@callconv("C") +proc intrinsics::felt::eq(felt, felt) -> i32 eq end -proc.std::collections::smt::set +@callconv("C") +proc std::collections::smt::set( + felt, + felt, + felt, + felt, + felt, + felt, + felt, + felt, + felt, + felt, + felt, + felt, + i32 +) trace.240 nop exec.::std::collections::smt::set diff --git a/tests/integration/src/rust_masm_tests/rust_sdk/stdlib/collections.rs b/tests/integration/src/rust_masm_tests/rust_sdk/stdlib/collections.rs index 559d345c9..d2beed746 100644 --- a/tests/integration/src/rust_masm_tests/rust_sdk/stdlib/collections.rs +++ b/tests/integration/src/rust_masm_tests/rust_sdk/stdlib/collections.rs @@ -1,11 +1,15 @@ +use std::sync::Arc; + use miden_core::{ crypto::merkle::{MerkleStore, Smt}, Felt, FieldElement, Word, }; +use miden_debug::Executor; +use miden_lib::MidenLib; use miden_processor::AdviceInputs; -use midenc_debug::Executor; use midenc_expect_test::expect_file; use midenc_frontend_wasm::WasmTranslationConfig; +use midenc_session::STDLIB; use crate::CompilerTest; @@ -47,6 +51,17 @@ fn push_word_args(args: &mut Vec, word: Word) { args.push(a); } +fn executor_with_std(args: Vec) -> Executor { + let mut exec = Executor::new(args); + let std_library = (*STDLIB).clone(); + exec.dependency_resolver_mut() + .add(*std_library.digest(), std_library.clone().into()); + let base_library = Arc::new(MidenLib::default().as_ref().clone()); + exec.dependency_resolver_mut() + .add(*base_library.digest(), base_library.clone().into()); + exec +} + #[test] fn test_smt_get_binding() { let entries = [ @@ -112,11 +127,12 @@ fn test_smt_get_binding() { push_word_args(&mut args, root); push_word_args(&mut args, key); - let mut exec = Executor::for_package(&package, args.clone(), &test.session) - .expect("executor creation failed"); + let mut exec = executor_with_std(args.clone()); + exec.with_dependencies(package.manifest.dependencies()) + .expect("failed to add package dependencies"); exec.with_advice_inputs(advice_inputs); - exec.execute(&package.unwrap_program(), &test.session); + exec.execute(&package.unwrap_program(), test.session.source_manager.clone()); } #[test] @@ -128,7 +144,8 @@ fn test_smt_set_binding() { let root = smt.root(); let mut expected_smt = smt.clone(); - let expected_old_value = expected_smt.insert(key, new_value); + let expected_old_value = + expected_smt.insert(key, new_value).expect("inserting into SMT should succeed"); let expected_new_root = expected_smt.root(); let expected_old_u64 = word_to_u64s(expected_old_value); @@ -202,9 +219,10 @@ fn test_smt_set_binding() { push_word_args(&mut args, key); push_word_args(&mut args, new_value); - let mut exec = Executor::for_package(&package, args.clone(), &test.session) - .expect("executor creation failed"); + let mut exec = executor_with_std(args.clone()); + exec.with_dependencies(package.manifest.dependencies()) + .expect("failed to add package dependencies"); exec.with_advice_inputs(advice_inputs); - exec.execute(&package.unwrap_program(), &test.session); + exec.execute(&package.unwrap_program(), test.session.source_manager.clone()); } From b2985a97b0e2fd9381059c2b09e05b06f9d07048 Mon Sep 17 00:00:00 2001 From: Denys Zadorozhnyi Date: Wed, 12 Nov 2025 13:27:50 +0200 Subject: [PATCH 19/19] chore: add `trim-paths` in bindings tests --- ...rust_sdk_input_note_get_assets_binding.hir | 14 ++-- ...ust_sdk_input_note_get_assets_binding.masm | 70 +++++++++---------- ...rust_sdk_input_note_get_assets_binding.wat | 14 ++-- ...ust_sdk_output_note_get_assets_binding.hir | 14 ++-- ...st_sdk_output_note_get_assets_binding.masm | 70 +++++++++---------- ...ust_sdk_output_note_get_assets_binding.wat | 14 ++-- .../rust_sdk/base/input_note.rs | 9 ++- .../rust_sdk/base/output_note.rs | 9 ++- 8 files changed, 110 insertions(+), 104 deletions(-) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_assets_binding.hir b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_assets_binding.hir index 5e07e1929..12c7989c9 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_assets_binding.hir +++ b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_assets_binding.hir @@ -10,7 +10,7 @@ builtin.component miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-no v3 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/GOT.data.internal.__memory_base : ptr v4 = hir.bitcast v3 : ptr; v5 = hir.load v4 : i32; - v6 = arith.constant 1048676 : i32; + v6 = arith.constant 1048648 : i32; v7 = arith.add v5, v6 : i32 #[overflow = wrapping]; v8 = hir.exec @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/::alloc(v7, v1, v0) : i32 builtin.ret v8; @@ -26,7 +26,7 @@ builtin.component miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-no v15 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/GOT.data.internal.__memory_base : ptr v16 = hir.bitcast v15 : ptr; v17 = hir.load v16 : i32; - v18 = arith.constant 1048676 : i32; + v18 = arith.constant 1048648 : i32; v19 = arith.add v17, v18 : i32 #[overflow = wrapping]; v20 = hir.exec @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/::alloc(v19, v13, v12) : i32 v668 = arith.constant 0 : i32; @@ -115,7 +115,7 @@ builtin.component miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-no v70 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/GOT.data.internal.__memory_base : ptr v71 = hir.bitcast v70 : ptr; v72 = hir.load v71 : i32; - v73 = arith.constant 1048680 : i32; + v73 = arith.constant 1048652 : i32; v74 = arith.add v72, v73 : i32 #[overflow = wrapping]; v75 = hir.bitcast v74 : u32; v76 = hir.int_to_ptr v75 : ptr; @@ -134,7 +134,7 @@ builtin.component miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-no v84 = hir.load v83 : i32; hir.exec @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/__wasm_call_ctors() v673 = arith.constant 1 : u8; - v675 = arith.constant 1048680 : i32; + v675 = arith.constant 1048652 : i32; v86 = arith.add v84, v675 : i32 #[overflow = wrapping]; v90 = hir.bitcast v86 : u32; v91 = hir.int_to_ptr v90 : ptr; @@ -407,7 +407,7 @@ builtin.component miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-no v287 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/GOT.data.internal.__memory_base : ptr v288 = hir.bitcast v287 : ptr; v289 = hir.load v288 : i32; - v290 = arith.constant 1048660 : i32; + v290 = arith.constant 1048632 : i32; v291 = arith.add v289, v290 : i32 #[overflow = wrapping]; v285 = arith.constant 4 : i32; v286 = arith.add v282, v285 : i32 #[overflow = wrapping]; @@ -945,9 +945,9 @@ builtin.component miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-no builtin.ret_imm 0; }; - builtin.segment readonly @1048576 = 0x0073722e65746f6e5f7475706e692f73676e69646e69622f6372732f7379732d657361622f6b64732f3272656c69706d6f632f6e6564696d2f6372732f6e656572672f73726573552f; + builtin.segment readonly @1048576 = 0x0073722e65746f6e5f7475706e692f73676e69646e69622f6372732f302e372e302d7379732d657361622d6e6564696d; - builtin.segment @1048652 = 0x000000220000003f00000048001000000000000100000001; + builtin.segment @1048624 = 0x000000220000003f0000002f001000000000000100000001; }; public builtin.function @binding() -> felt { diff --git a/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_assets_binding.masm b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_assets_binding.masm index 03075d3be..700ba890e 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_assets_binding.masm +++ b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_assets_binding.masm @@ -18,20 +18,20 @@ proc init trace.240 exec.::intrinsics::mem::heap_init trace.252 - push.[12758153388733875847,5578040097872636326,12841885126834632170,7361907792256268865] + push.[13233865733382452766,13008203156939924947,13638025381147799114,8047631572047953282] adv.push_mapval push.262144 - push.7 + push.5 trace.240 exec.::std::mem::pipe_preimage_to_memory trace.252 drop push.1048576 u32assert - mem_store.278560 + mem_store.278552 push.0 u32assert - mem_store.278561 + mem_store.278553 end # mod miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1::rust_sdk_input_note_get_assets_binding @@ -45,7 +45,7 @@ end @callconv("C") proc __rustc::__rust_alloc(i32, i32) -> i32 - push.1114244 + push.1114212 u32divmod.4 swap.1 trace.240 @@ -53,7 +53,7 @@ proc __rustc::__rust_alloc(i32, i32) -> i32 exec.::intrinsics::mem::load_sw trace.252 nop - push.1048676 + push.1048648 u32wrapping_add movup.2 swap.1 @@ -73,7 +73,7 @@ end @callconv("C") proc __rustc::__rust_alloc_zeroed(i32, i32) -> i32 - push.1114244 + push.1114212 u32divmod.4 swap.1 trace.240 @@ -81,7 +81,7 @@ proc __rustc::__rust_alloc_zeroed(i32, i32) -> i32 exec.::intrinsics::mem::load_sw trace.252 nop - push.1048676 + push.1048648 u32wrapping_add dup.1 swap.2 @@ -167,7 +167,7 @@ end proc miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1#binding( ) -> felt - push.1114240 + push.1114208 u32divmod.4 swap.1 trace.240 @@ -177,7 +177,7 @@ proc miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets nop push.16 u32wrapping_sub - push.1114240 + push.1114208 dup.1 swap.1 u32divmod.4 @@ -243,7 +243,7 @@ proc miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets push.16 movup.2 u32wrapping_add - push.1114240 + push.1114208 u32divmod.4 swap.1 trace.240 @@ -264,7 +264,7 @@ end proc wit_bindgen::rt::run_ctors_once( ) - push.1114244 + push.1114212 u32divmod.4 swap.1 trace.240 @@ -272,7 +272,7 @@ proc wit_bindgen::rt::run_ctors_once( exec.::intrinsics::mem::load_sw trace.252 nop - push.1048680 + push.1048652 u32wrapping_add u32divmod.4 swap.1 @@ -293,7 +293,7 @@ proc wit_bindgen::rt::run_ctors_once( if.true nop else - push.1114244 + push.1114212 u32divmod.4 swap.1 trace.240 @@ -307,7 +307,7 @@ proc wit_bindgen::rt::run_ctors_once( trace.252 nop push.1 - push.1048680 + push.1048652 movup.2 u32wrapping_add u32divmod.4 @@ -527,7 +527,7 @@ end @callconv("C") proc alloc::vec::Vec::with_capacity(i32, i32) - push.1114240 + push.1114208 u32divmod.4 swap.1 trace.240 @@ -537,7 +537,7 @@ proc alloc::vec::Vec::with_capacity(i32, i32) nop push.16 u32wrapping_sub - push.1114240 + push.1114208 dup.1 swap.1 u32divmod.4 @@ -614,7 +614,7 @@ proc alloc::vec::Vec::with_capacity(i32, i32) nop push.16 u32wrapping_add - push.1114240 + push.1114208 u32divmod.4 swap.1 trace.240 @@ -631,7 +631,7 @@ proc alloc::raw_vec::RawVecInner::with_capacity_in( i32, i32 ) - push.1114240 + push.1114208 u32divmod.4 swap.1 trace.240 @@ -641,7 +641,7 @@ proc alloc::raw_vec::RawVecInner::with_capacity_in( nop push.16 u32wrapping_sub - push.1114240 + push.1114208 dup.1 swap.1 u32divmod.4 @@ -759,7 +759,7 @@ proc alloc::raw_vec::RawVecInner::with_capacity_in( nop push.16 u32wrapping_add - push.1114240 + push.1114208 u32divmod.4 swap.1 trace.240 @@ -803,7 +803,7 @@ proc miden_base_sys::bindings::input_note::get_assets( i32, felt ) - push.1114240 + push.1114208 u32divmod.4 swap.1 trace.240 @@ -813,7 +813,7 @@ proc miden_base_sys::bindings::input_note::get_assets( nop push.16 u32wrapping_sub - push.1114240 + push.1114208 dup.1 swap.1 u32divmod.4 @@ -823,7 +823,7 @@ proc miden_base_sys::bindings::input_note::get_assets( exec.::intrinsics::mem::store_sw trace.252 nop - push.1114244 + push.1114212 u32divmod.4 swap.1 trace.240 @@ -831,7 +831,7 @@ proc miden_base_sys::bindings::input_note::get_assets( exec.::intrinsics::mem::load_sw trace.252 nop - push.1048660 + push.1048632 u32wrapping_add push.4 dup.2 @@ -918,7 +918,7 @@ proc miden_base_sys::bindings::input_note::get_assets( nop push.16 u32wrapping_add - push.1114240 + push.1114208 u32divmod.4 swap.1 trace.240 @@ -939,7 +939,7 @@ proc alloc::raw_vec::RawVecInner::deallocate( i32, i32 ) - push.1114240 + push.1114208 u32divmod.4 swap.1 trace.240 @@ -949,7 +949,7 @@ proc alloc::raw_vec::RawVecInner::deallocate( nop push.16 u32wrapping_sub - push.1114240 + push.1114208 dup.1 swap.1 u32divmod.4 @@ -1040,7 +1040,7 @@ proc alloc::raw_vec::RawVecInner::deallocate( end push.16 u32wrapping_add - push.1114240 + push.1114208 u32divmod.4 swap.1 trace.240 @@ -1058,7 +1058,7 @@ proc alloc::raw_vec::RawVecInner::try_allocate_in( i32, i32 ) - push.1114240 + push.1114208 u32divmod.4 swap.1 trace.240 @@ -1068,7 +1068,7 @@ proc alloc::raw_vec::RawVecInner::try_allocate_in( nop push.16 u32wrapping_sub - push.1114240 + push.1114208 dup.1 swap.1 u32divmod.4 @@ -1453,7 +1453,7 @@ proc alloc::raw_vec::RawVecInner::try_allocate_in( nop push.16 u32wrapping_add - push.1114240 + push.1114208 u32divmod.4 swap.1 trace.240 @@ -1469,7 +1469,7 @@ proc ::allocate( i32, i32 ) - push.1114240 + push.1114208 u32divmod.4 swap.1 trace.240 @@ -1479,7 +1479,7 @@ proc ::allocate( nop push.16 u32wrapping_sub - push.1114240 + push.1114208 dup.1 swap.1 u32divmod.4 @@ -1572,7 +1572,7 @@ proc ::allocate( nop push.16 u32wrapping_add - push.1114240 + push.1114208 u32divmod.4 swap.1 trace.240 diff --git a/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_assets_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_assets_binding.wat index 7bb28a926..80ef97976 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_assets_binding.wat +++ b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_assets_binding.wat @@ -29,7 +29,7 @@ (func $__wasm_call_ctors (;0;) (type 0)) (func $__rustc::__rust_alloc (;1;) (type 1) (param i32 i32) (result i32) global.get $GOT.data.internal.__memory_base - i32.const 1048676 + i32.const 1048648 i32.add local.get 1 local.get 0 @@ -39,7 +39,7 @@ (func $__rustc::__rust_alloc_zeroed (;3;) (type 1) (param i32 i32) (result i32) block ;; label = @1 global.get $GOT.data.internal.__memory_base - i32.const 1048676 + i32.const 1048648 i32.add local.get 1 local.get 0 @@ -95,7 +95,7 @@ (local i32) block ;; label = @1 global.get $GOT.data.internal.__memory_base - i32.const 1048680 + i32.const 1048652 i32.add i32.load8_u br_if 0 (;@1;) @@ -103,7 +103,7 @@ local.set 0 call $__wasm_call_ctors local.get 0 - i32.const 1048680 + i32.const 1048652 i32.add i32.const 1 i32.store8 @@ -266,7 +266,7 @@ i32.const 4 i32.add global.get $GOT.data.internal.__memory_base - i32.const 1048660 + i32.const 1048632 i32.add call $alloc::vec::Vec::with_capacity local.get 0 @@ -551,8 +551,8 @@ (func $miden::input_note::get_assets (;22;) (type 11) (param i32 f32) (result i32) unreachable ) - (data $.rodata (;0;) (i32.const 1048576) "/Users/green/src/miden/compiler2/sdk/base-sys/src/bindings/input_note.rs\00") - (data $.data (;1;) (i32.const 1048652) "\01\00\00\00\01\00\00\00\00\00\10\00H\00\00\00?\00\00\00\22\00\00\00") + (data $.rodata (;0;) (i32.const 1048576) "miden-base-sys-0.7.0/src/bindings/input_note.rs\00") + (data $.data (;1;) (i32.const 1048624) "\01\00\00\00\01\00\00\00\00\00\10\00/\00\00\00?\00\00\00\22\00\00\00") (@custom "rodata,miden_account" (after data) "Mrust_sdk_input_note_get_assets_binding\01\0b0.0.1\03\01\01\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00") ) (alias export 0 "felt" (type (;1;))) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_assets_binding.hir b/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_assets_binding.hir index 8aed99c21..467f6cfd5 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_assets_binding.hir +++ b/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_assets_binding.hir @@ -10,7 +10,7 @@ builtin.component miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output- v3 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/GOT.data.internal.__memory_base : ptr v4 = hir.bitcast v3 : ptr; v5 = hir.load v4 : i32; - v6 = arith.constant 1048676 : i32; + v6 = arith.constant 1048652 : i32; v7 = arith.add v5, v6 : i32 #[overflow = wrapping]; v8 = hir.exec @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/::alloc(v7, v1, v0) : i32 builtin.ret v8; @@ -26,7 +26,7 @@ builtin.component miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output- v15 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/GOT.data.internal.__memory_base : ptr v16 = hir.bitcast v15 : ptr; v17 = hir.load v16 : i32; - v18 = arith.constant 1048676 : i32; + v18 = arith.constant 1048652 : i32; v19 = arith.add v17, v18 : i32 #[overflow = wrapping]; v20 = hir.exec @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/::alloc(v19, v13, v12) : i32 v668 = arith.constant 0 : i32; @@ -115,7 +115,7 @@ builtin.component miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output- v70 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/GOT.data.internal.__memory_base : ptr v71 = hir.bitcast v70 : ptr; v72 = hir.load v71 : i32; - v73 = arith.constant 1048680 : i32; + v73 = arith.constant 1048656 : i32; v74 = arith.add v72, v73 : i32 #[overflow = wrapping]; v75 = hir.bitcast v74 : u32; v76 = hir.int_to_ptr v75 : ptr; @@ -134,7 +134,7 @@ builtin.component miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output- v84 = hir.load v83 : i32; hir.exec @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/__wasm_call_ctors() v673 = arith.constant 1 : u8; - v675 = arith.constant 1048680 : i32; + v675 = arith.constant 1048656 : i32; v86 = arith.add v84, v675 : i32 #[overflow = wrapping]; v90 = hir.bitcast v86 : u32; v91 = hir.int_to_ptr v90 : ptr; @@ -407,7 +407,7 @@ builtin.component miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output- v287 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/GOT.data.internal.__memory_base : ptr v288 = hir.bitcast v287 : ptr; v289 = hir.load v288 : i32; - v290 = arith.constant 1048660 : i32; + v290 = arith.constant 1048636 : i32; v291 = arith.add v289, v290 : i32 #[overflow = wrapping]; v285 = arith.constant 4 : i32; v286 = arith.add v282, v285 : i32 #[overflow = wrapping]; @@ -945,9 +945,9 @@ builtin.component miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output- builtin.ret_imm 0; }; - builtin.segment readonly @1048576 = 0x0073722e65746f6e5f74757074756f2f73676e69646e69622f6372732f7379732d657361622f6b64732f3272656c69706d6f632f6e6564696d2f6372732f6e656572672f73726573552f; + builtin.segment readonly @1048576 = 0x0073722e65746f6e5f74757074756f2f73676e69646e69622f6372732f302e372e302d7379732d657361622d6e6564696d; - builtin.segment @1048652 = 0x000000220000006500000049001000000000000100000001; + builtin.segment @1048628 = 0x000000220000006500000030001000000000000100000001; }; public builtin.function @binding() -> felt { diff --git a/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_assets_binding.masm b/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_assets_binding.masm index c01170f1b..1903a602f 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_assets_binding.masm +++ b/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_assets_binding.masm @@ -18,20 +18,20 @@ proc init trace.240 exec.::intrinsics::mem::heap_init trace.252 - push.[15981665288193965091,10393407978073516861,16327500535759164990,13006709555859712660] + push.[16328506470805530145,17778698289722371564,929519036494728460,12225220874644472837] adv.push_mapval push.262144 - push.7 + push.5 trace.240 exec.::std::mem::pipe_preimage_to_memory trace.252 drop push.1048576 u32assert - mem_store.278560 + mem_store.278552 push.0 u32assert - mem_store.278561 + mem_store.278553 end # mod miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1::rust_sdk_output_note_get_assets_binding @@ -45,7 +45,7 @@ end @callconv("C") proc __rustc::__rust_alloc(i32, i32) -> i32 - push.1114244 + push.1114212 u32divmod.4 swap.1 trace.240 @@ -53,7 +53,7 @@ proc __rustc::__rust_alloc(i32, i32) -> i32 exec.::intrinsics::mem::load_sw trace.252 nop - push.1048676 + push.1048652 u32wrapping_add movup.2 swap.1 @@ -73,7 +73,7 @@ end @callconv("C") proc __rustc::__rust_alloc_zeroed(i32, i32) -> i32 - push.1114244 + push.1114212 u32divmod.4 swap.1 trace.240 @@ -81,7 +81,7 @@ proc __rustc::__rust_alloc_zeroed(i32, i32) -> i32 exec.::intrinsics::mem::load_sw trace.252 nop - push.1048676 + push.1048652 u32wrapping_add dup.1 swap.2 @@ -167,7 +167,7 @@ end proc miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1#binding( ) -> felt - push.1114240 + push.1114208 u32divmod.4 swap.1 trace.240 @@ -177,7 +177,7 @@ proc miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-asse nop push.16 u32wrapping_sub - push.1114240 + push.1114208 dup.1 swap.1 u32divmod.4 @@ -243,7 +243,7 @@ proc miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-asse push.16 movup.2 u32wrapping_add - push.1114240 + push.1114208 u32divmod.4 swap.1 trace.240 @@ -264,7 +264,7 @@ end proc wit_bindgen::rt::run_ctors_once( ) - push.1114244 + push.1114212 u32divmod.4 swap.1 trace.240 @@ -272,7 +272,7 @@ proc wit_bindgen::rt::run_ctors_once( exec.::intrinsics::mem::load_sw trace.252 nop - push.1048680 + push.1048656 u32wrapping_add u32divmod.4 swap.1 @@ -293,7 +293,7 @@ proc wit_bindgen::rt::run_ctors_once( if.true nop else - push.1114244 + push.1114212 u32divmod.4 swap.1 trace.240 @@ -307,7 +307,7 @@ proc wit_bindgen::rt::run_ctors_once( trace.252 nop push.1 - push.1048680 + push.1048656 movup.2 u32wrapping_add u32divmod.4 @@ -527,7 +527,7 @@ end @callconv("C") proc alloc::vec::Vec::with_capacity(i32, i32) - push.1114240 + push.1114208 u32divmod.4 swap.1 trace.240 @@ -537,7 +537,7 @@ proc alloc::vec::Vec::with_capacity(i32, i32) nop push.16 u32wrapping_sub - push.1114240 + push.1114208 dup.1 swap.1 u32divmod.4 @@ -614,7 +614,7 @@ proc alloc::vec::Vec::with_capacity(i32, i32) nop push.16 u32wrapping_add - push.1114240 + push.1114208 u32divmod.4 swap.1 trace.240 @@ -631,7 +631,7 @@ proc alloc::raw_vec::RawVecInner::with_capacity_in( i32, i32 ) - push.1114240 + push.1114208 u32divmod.4 swap.1 trace.240 @@ -641,7 +641,7 @@ proc alloc::raw_vec::RawVecInner::with_capacity_in( nop push.16 u32wrapping_sub - push.1114240 + push.1114208 dup.1 swap.1 u32divmod.4 @@ -759,7 +759,7 @@ proc alloc::raw_vec::RawVecInner::with_capacity_in( nop push.16 u32wrapping_add - push.1114240 + push.1114208 u32divmod.4 swap.1 trace.240 @@ -803,7 +803,7 @@ proc miden_base_sys::bindings::output_note::get_assets( i32, felt ) - push.1114240 + push.1114208 u32divmod.4 swap.1 trace.240 @@ -813,7 +813,7 @@ proc miden_base_sys::bindings::output_note::get_assets( nop push.16 u32wrapping_sub - push.1114240 + push.1114208 dup.1 swap.1 u32divmod.4 @@ -823,7 +823,7 @@ proc miden_base_sys::bindings::output_note::get_assets( exec.::intrinsics::mem::store_sw trace.252 nop - push.1114244 + push.1114212 u32divmod.4 swap.1 trace.240 @@ -831,7 +831,7 @@ proc miden_base_sys::bindings::output_note::get_assets( exec.::intrinsics::mem::load_sw trace.252 nop - push.1048660 + push.1048636 u32wrapping_add push.4 dup.2 @@ -918,7 +918,7 @@ proc miden_base_sys::bindings::output_note::get_assets( nop push.16 u32wrapping_add - push.1114240 + push.1114208 u32divmod.4 swap.1 trace.240 @@ -939,7 +939,7 @@ proc alloc::raw_vec::RawVecInner::deallocate( i32, i32 ) - push.1114240 + push.1114208 u32divmod.4 swap.1 trace.240 @@ -949,7 +949,7 @@ proc alloc::raw_vec::RawVecInner::deallocate( nop push.16 u32wrapping_sub - push.1114240 + push.1114208 dup.1 swap.1 u32divmod.4 @@ -1040,7 +1040,7 @@ proc alloc::raw_vec::RawVecInner::deallocate( end push.16 u32wrapping_add - push.1114240 + push.1114208 u32divmod.4 swap.1 trace.240 @@ -1058,7 +1058,7 @@ proc alloc::raw_vec::RawVecInner::try_allocate_in( i32, i32 ) - push.1114240 + push.1114208 u32divmod.4 swap.1 trace.240 @@ -1068,7 +1068,7 @@ proc alloc::raw_vec::RawVecInner::try_allocate_in( nop push.16 u32wrapping_sub - push.1114240 + push.1114208 dup.1 swap.1 u32divmod.4 @@ -1453,7 +1453,7 @@ proc alloc::raw_vec::RawVecInner::try_allocate_in( nop push.16 u32wrapping_add - push.1114240 + push.1114208 u32divmod.4 swap.1 trace.240 @@ -1469,7 +1469,7 @@ proc ::allocate( i32, i32 ) - push.1114240 + push.1114208 u32divmod.4 swap.1 trace.240 @@ -1479,7 +1479,7 @@ proc ::allocate( nop push.16 u32wrapping_sub - push.1114240 + push.1114208 dup.1 swap.1 u32divmod.4 @@ -1572,7 +1572,7 @@ proc ::allocate( nop push.16 u32wrapping_add - push.1114240 + push.1114208 u32divmod.4 swap.1 trace.240 diff --git a/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_assets_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_assets_binding.wat index dc8499f77..294d24264 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_assets_binding.wat +++ b/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_assets_binding.wat @@ -29,7 +29,7 @@ (func $__wasm_call_ctors (;0;) (type 0)) (func $__rustc::__rust_alloc (;1;) (type 1) (param i32 i32) (result i32) global.get $GOT.data.internal.__memory_base - i32.const 1048676 + i32.const 1048652 i32.add local.get 1 local.get 0 @@ -39,7 +39,7 @@ (func $__rustc::__rust_alloc_zeroed (;3;) (type 1) (param i32 i32) (result i32) block ;; label = @1 global.get $GOT.data.internal.__memory_base - i32.const 1048676 + i32.const 1048652 i32.add local.get 1 local.get 0 @@ -95,7 +95,7 @@ (local i32) block ;; label = @1 global.get $GOT.data.internal.__memory_base - i32.const 1048680 + i32.const 1048656 i32.add i32.load8_u br_if 0 (;@1;) @@ -103,7 +103,7 @@ local.set 0 call $__wasm_call_ctors local.get 0 - i32.const 1048680 + i32.const 1048656 i32.add i32.const 1 i32.store8 @@ -266,7 +266,7 @@ i32.const 4 i32.add global.get $GOT.data.internal.__memory_base - i32.const 1048660 + i32.const 1048636 i32.add call $alloc::vec::Vec::with_capacity local.get 0 @@ -551,8 +551,8 @@ (func $miden::output_note::get_assets (;22;) (type 11) (param i32 f32) (result i32) unreachable ) - (data $.rodata (;0;) (i32.const 1048576) "/Users/green/src/miden/compiler2/sdk/base-sys/src/bindings/output_note.rs\00") - (data $.data (;1;) (i32.const 1048652) "\01\00\00\00\01\00\00\00\00\00\10\00I\00\00\00e\00\00\00\22\00\00\00") + (data $.rodata (;0;) (i32.const 1048576) "miden-base-sys-0.7.0/src/bindings/output_note.rs\00") + (data $.data (;1;) (i32.const 1048628) "\01\00\00\00\01\00\00\00\00\00\10\000\00\00\00e\00\00\00\22\00\00\00") (@custom "rodata,miden_account" (after data) "Orust_sdk_output_note_get_assets_binding\01\0b0.0.1\03\01\01\00\00\00\00\00\00\00\00\00\00\00\00\00\00") ) (alias export 0 "felt" (type (;1;))) diff --git a/tests/integration/src/rust_masm_tests/rust_sdk/base/input_note.rs b/tests/integration/src/rust_masm_tests/rust_sdk/base/input_note.rs index f5a1f91fc..1744cc916 100644 --- a/tests/integration/src/rust_masm_tests/rust_sdk/base/input_note.rs +++ b/tests/integration/src/rust_masm_tests/rust_sdk/base/input_note.rs @@ -22,6 +22,8 @@ impl TestInputNote {{ let component_package = format!("miden:{}", name.replace('_', "-")); let cargo_toml = format!( r#" +cargo-features = ["trim-paths"] + [package] name = "{name}" version = "0.0.1" @@ -42,9 +44,10 @@ project-kind = "account" supported-types = ["RegularAccountUpdatableCode"] [profile.release] -opt-level = "z" -panic = "abort" -debug = false +trim-paths = ["diagnostics", "object"] + +[profile.dev] +trim-paths = ["diagnostics", "object"] "#, name = name, sdk_path = sdk_path.display(), diff --git a/tests/integration/src/rust_masm_tests/rust_sdk/base/output_note.rs b/tests/integration/src/rust_masm_tests/rust_sdk/base/output_note.rs index b0c77533b..659e52550 100644 --- a/tests/integration/src/rust_masm_tests/rust_sdk/base/output_note.rs +++ b/tests/integration/src/rust_masm_tests/rust_sdk/base/output_note.rs @@ -22,6 +22,8 @@ impl TestOutputNote {{ let component_package = format!("miden:{}", name.replace('_', "-")); let cargo_toml = format!( r#" +cargo-features = ["trim-paths"] + [package] name = "{name}" version = "0.0.1" @@ -42,9 +44,10 @@ project-kind = "account" supported-types = ["RegularAccountUpdatableCode"] [profile.release] -opt-level = "z" -panic = "abort" -debug = false +trim-paths = ["diagnostics", "object"] + +[profile.dev] +trim-paths = ["diagnostics", "object"] "#, name = name, sdk_path = sdk_path.display(),