diff --git a/tests/integration/expected/rust_sdk/basic_wallet.hir b/tests/integration/expected/rust_sdk/basic_wallet.hir index e52dd385..6b97fc8c 100644 --- a/tests/integration/expected/rust_sdk/basic_wallet.hir +++ b/tests/integration/expected/rust_sdk/basic_wallet.hir @@ -9,7 +9,7 @@ ;; Modules (module #basic_wallet ;; Data Segments - (data (mut) (offset 1048576) 0x010000000100000001000000010000000100000001000000010000000100000002000000) + (data (mut) (offset 1048576) 0x0100000001000000010000000100000001000000010000000100000002000000) ;; Constants (const (id 0) 0x00100000) @@ -37,7 +37,7 @@ (func (export #__rust_alloc) (param i32) (param i32) (result i32) (block 0 (param v0 i32) (param v1 i32) - (let (v3 i32) (const.i32 1048620)) + (let (v3 i32) (const.i32 1048616)) (let (v4 i32) (call #::alloc v3 v1 v0)) (br (block 1 v4))) @@ -56,7 +56,7 @@ (func (export #__rust_realloc) (param i32) (param i32) (param i32) (param i32) (result i32) (block 0 (param v0 i32) (param v1 i32) (param v2 i32) (param v3 i32) - (let (v5 i32) (const.i32 1048620)) + (let (v5 i32) (const.i32 1048616)) (let (v6 i32) (call #::alloc v5 v2 v3)) (let (v7 i1) (eq v6 0)) (let (v8 i32) (zext v7)) @@ -86,7 +86,7 @@ (func (export #__rust_alloc_zeroed) (param i32) (param i32) (result i32) (block 0 (param v0 i32) (param v1 i32) - (let (v3 i32) (const.i32 1048620)) + (let (v3 i32) (const.i32 1048616)) (let (v4 i32) (call #::alloc v3 v1 v0)) (let (v5 i1) (eq v4 0)) (let (v6 i32) (zext v5)) @@ -476,14 +476,14 @@ (let (v166 (ptr i64)) (inttoptr v164)) (let (v167 i64) (load v166)) (let (v168 u32) (bitcast v162)) - (let (v169 u32) (add.checked v168 1048612)) + (let (v169 u32) (add.checked v168 1048608)) (let (v170 u32) (mod.unchecked v169 4)) (assertz 250 v170) (let (v171 (ptr i64)) (inttoptr v169)) (store v171 v167) (let (v172 (ptr i32)) (global.symbol #__stack_pointer)) (store v172 v4) - (let (v173 i32) (const.i32 1048612)) + (let (v173 i32) (const.i32 1048608)) (ret v173)) ) @@ -535,7 +535,7 @@ (block 6 (let (v9 i32) (const.i32 0)) (let (v10 u32) (bitcast v9)) - (let (v11 u32) (add.checked v10 1048624)) + (let (v11 u32) (add.checked v10 1048620)) (let (v12 (ptr u8)) (inttoptr v11)) (let (v13 u8) (load v12)) (let (v14 i32) (zext v13)) @@ -550,7 +550,7 @@ (block 0 (let (v0 i32) (const.i32 0)) (let (v1 u32) (bitcast v0)) - (let (v2 u32) (add.checked v1 1048625)) + (let (v2 u32) (add.checked v1 1048621)) (let (v3 (ptr u8)) (inttoptr v2)) (let (v4 u8) (load v3)) (let (v5 i32) (zext v4)) @@ -570,7 +570,7 @@ (let (v9 u32) (bitcast v8)) (let (v10 u8) (trunc v9)) (let (v11 u32) (bitcast v7)) - (let (v12 u32) (add.checked v11 1048625)) + (let (v12 u32) (add.checked v11 1048621)) (let (v13 (ptr u8)) (inttoptr v12)) (store v13 v10) (br (block 2))) @@ -1162,7 +1162,7 @@ (block 5 (let (v8 i32) (const.i32 0)) (let (v9 u32) (bitcast v8)) - (let (v10 u32) (add.checked v9 1048624)) + (let (v10 u32) (add.checked v9 1048620)) (let (v11 (ptr u8)) (inttoptr v10)) (let (v12 u8) (load v11)) (let (v13 i32) (zext v12)) diff --git a/tests/integration/expected/rust_sdk/basic_wallet.wat b/tests/integration/expected/rust_sdk/basic_wallet.wat index ed67316b..91425a66 100644 --- a/tests/integration/expected/rust_sdk/basic_wallet.wat +++ b/tests/integration/expected/rust_sdk/basic_wallet.wat @@ -19,67 +19,40 @@ (import "miden:base/core-types@1.0.0" (instance (;0;) (type 0))) (type (;1;) (instance - (type (;0;) s32) - (export (;1;) "ptr" (type (eq 0))) - (type (;2;) float32) - (export (;3;) "felt" (type (eq 2))) + (type (;0;) (func (result s32))) + (export (;0;) "heap-base" (func (type 0))) ) ) - (import "miden:core-import/types@1.0.0" (instance (;1;) (type 1))) - (alias export 1 "ptr" (type (;2;))) - (type (;3;) - (instance - (alias outer 1 2 (type (;0;))) - (export (;1;) "ptr" (type (eq 0))) - (type (;2;) (func (result 1))) - (export (;0;) "heap-base" (func (type 2))) - ) - ) - (import "miden:core-import/intrinsics-mem@1.0.0" (instance (;2;) (type 3))) - (alias export 1 "felt" (type (;4;))) - (type (;5;) + (import "miden:core-import/intrinsics-mem@1.0.0" (instance (;1;) (type 1))) + (type (;2;) (instance - (alias outer 1 4 (type (;0;))) - (export (;1;) "felt" (type (eq 0))) - (type (;2;) (func (param "a" 1) (param "b" 1) (result 1))) - (export (;0;) "add" (func (type 2))) + (type (;0;) (func (param "a" float32) (param "b" float32) (result float32))) + (export (;0;) "add" (func (type 0))) ) ) - (import "miden:core-import/intrinsics-felt@1.0.0" (instance (;3;) (type 5))) - (alias export 1 "ptr" (type (;6;))) - (type (;7;) + (import "miden:core-import/intrinsics-felt@1.0.0" (instance (;2;) (type 2))) + (type (;3;) (instance - (alias outer 1 6 (type (;0;))) - (export (;1;) "ptr" (type (eq 0))) - (type (;2;) (func (param "a0" s32) (param "a1" s32) (param "a2" s32) (param "a3" s32) (param "a4" s32) (param "a5" s32) (param "a6" s32) (param "a7" s32) (param "result-ptr" 1))) - (export (;0;) "hash-one-to-one" (func (type 2))) + (type (;0;) (func (param "a0" s32) (param "a1" s32) (param "a2" s32) (param "a3" s32) (param "a4" s32) (param "a5" s32) (param "a6" s32) (param "a7" s32) (param "result-ptr" s32))) + (export (;0;) "hash-one-to-one" (func (type 0))) ) ) - (import "miden:core-import/stdlib-crypto-hashes-blake3@1.0.0" (instance (;4;) (type 7))) - (alias export 1 "felt" (type (;8;))) - (alias export 1 "ptr" (type (;9;))) - (type (;10;) + (import "miden:core-import/stdlib-crypto-hashes-blake3@1.0.0" (instance (;3;) (type 3))) + (type (;4;) (instance - (alias outer 1 8 (type (;0;))) - (export (;1;) "felt" (type (eq 0))) - (alias outer 1 9 (type (;2;))) - (export (;3;) "ptr" (type (eq 2))) - (type (;4;) (func (param "asset0" 1) (param "asset1" 1) (param "asset2" 1) (param "asset3" 1) (param "result-ptr" 3))) - (export (;0;) "add-asset" (func (type 4))) - (export (;1;) "remove-asset" (func (type 4))) + (type (;0;) (func (param "asset0" float32) (param "asset1" float32) (param "asset2" float32) (param "asset3" float32) (param "result-ptr" s32))) + (export (;0;) "add-asset" (func (type 0))) + (export (;1;) "remove-asset" (func (type 0))) ) ) - (import "miden:core-import/account@1.0.0" (instance (;5;) (type 10))) - (alias export 1 "felt" (type (;11;))) - (type (;12;) + (import "miden:core-import/account@1.0.0" (instance (;4;) (type 4))) + (type (;5;) (instance - (alias outer 1 11 (type (;0;))) - (export (;1;) "felt" (type (eq 0))) - (type (;2;) (func (param "asset0" 1) (param "asset1" 1) (param "asset2" 1) (param "asset3" 1) (param "tag" 1) (param "note-type" 1) (param "recipient0" 1) (param "recipient1" 1) (param "recipient2" 1) (param "recipient3" 1) (result 1))) - (export (;0;) "create-note" (func (type 2))) + (type (;0;) (func (param "asset0" float32) (param "asset1" float32) (param "asset2" float32) (param "asset3" float32) (param "tag" float32) (param "note-type" float32) (param "recipient0" float32) (param "recipient1" float32) (param "recipient2" float32) (param "recipient3" float32) (result float32))) + (export (;0;) "create-note" (func (type 0))) ) ) - (import "miden:core-import/tx@1.0.0" (instance (;6;) (type 12))) + (import "miden:core-import/tx@1.0.0" (instance (;5;) (type 5))) (core module (;0;) (type (;0;) (func (param f32 f32) (result f32))) (type (;1;) (func (param i32 i32 i32 i32 i32 i32 i32 i32 i32))) @@ -106,7 +79,7 @@ (func $__wasm_call_ctors (;6;) (type 5)) (func $basic_wallet::bindings::__link_custom_section_describing_imports (;7;) (type 5)) (func $__rust_alloc (;8;) (type 6) (param i32 i32) (result i32) - i32.const 1048620 + i32.const 1048616 local.get 1 local.get 0 call $::alloc @@ -114,7 +87,7 @@ (func $__rust_dealloc (;9;) (type 7) (param i32 i32 i32)) (func $__rust_realloc (;10;) (type 8) (param i32 i32 i32 i32) (result i32) block ;; label = @1 - i32.const 1048620 + i32.const 1048616 local.get 2 local.get 3 call $::alloc @@ -135,7 +108,7 @@ ) (func $__rust_alloc_zeroed (;11;) (type 6) (param i32 i32) (result i32) block ;; label = @1 - i32.const 1048620 + i32.const 1048616 local.get 1 local.get 0 call $::alloc @@ -368,10 +341,10 @@ i32.const 0 local.get 2 i64.load offset=8 - i64.store offset=1048612 align=4 + i64.store offset=1048608 align=4 local.get 3 global.set $__stack_pointer - i32.const 1048612 + i32.const 1048608 return end unreachable @@ -400,7 +373,7 @@ i32.eqz br_if 2 (;@1;) i32.const 0 - i32.load8_u offset=1048624 + i32.load8_u offset=1048620 drop local.get 3 local.get 2 @@ -424,12 +397,12 @@ (func $wit_bindgen_rt::run_ctors_once (;19;) (type 5) block ;; label = @1 i32.const 0 - i32.load8_u offset=1048625 + i32.load8_u offset=1048621 br_if 0 (;@1;) call $__wasm_call_ctors i32.const 0 i32.const 1 - i32.store8 offset=1048625 + i32.store8 offset=1048621 end ) (func $::alloc (;20;) (type 12) (param i32 i32 i32) (result i32) @@ -731,7 +704,7 @@ local.get 3 br_if 0 (;@2;) i32.const 0 - i32.load8_u offset=1048624 + i32.load8_u offset=1048620 drop local.get 2 local.get 1 @@ -836,32 +809,32 @@ (export "cabi_realloc_wit_bindgen_0_28_0" (func $cabi_realloc_wit_bindgen_0_28_0)) (export "cabi_realloc" (func $cabi_realloc)) (elem (;0;) (i32.const 1) func $basic_wallet::bindings::__link_custom_section_describing_imports $cabi_realloc) - (data $.rodata (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00\01\00\00\00\01\00\00\00\01\00\00\00\01\00\00\00\01\00\00\00\01\00\00\00\02\00\00\00") + (data $.rodata (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00\01\00\00\00\01\00\00\00\01\00\00\00\01\00\00\00\01\00\00\00\02\00\00\00") ) - (alias export 3 "add" (func (;0;))) + (alias export 2 "add" (func (;0;))) (core func (;0;) (canon lower (func 0))) (core instance (;0;) (export "add" (func 0)) ) - (alias export 4 "hash-one-to-one" (func (;1;))) + (alias export 3 "hash-one-to-one" (func (;1;))) (core func (;1;) (canon lower (func 1))) (core instance (;1;) (export "hash-one-to-one" (func 1)) ) - (alias export 2 "heap-base" (func (;2;))) + (alias export 1 "heap-base" (func (;2;))) (core func (;2;) (canon lower (func 2))) (core instance (;2;) (export "heap-base" (func 2)) ) - (alias export 5 "add-asset" (func (;3;))) + (alias export 4 "add-asset" (func (;3;))) (core func (;3;) (canon lower (func 3))) - (alias export 5 "remove-asset" (func (;4;))) + (alias export 4 "remove-asset" (func (;4;))) (core func (;4;) (canon lower (func 4))) (core instance (;3;) (export "add-asset" (func 3)) (export "remove-asset" (func 4)) ) - (alias export 6 "create-note" (func (;5;))) + (alias export 5 "create-note" (func (;5;))) (core func (;5;) (canon lower (func 5))) (core instance (;4;) (export "create-note" (func 5)) @@ -876,31 +849,31 @@ ) (alias core export 5 "memory" (core memory (;0;))) (alias core export 5 "cabi_realloc" (core func (;6;))) - (alias export 0 "core-asset" (type (;13;))) - (type (;14;) (func (param "core-asset" 13))) + (alias export 0 "core-asset" (type (;6;))) + (type (;7;) (func (param "core-asset" 6))) (alias core export 5 "miden:basic-wallet/basic-wallet@1.0.0#receive-asset" (core func (;7;))) - (func (;6;) (type 14) (canon lift (core func 7))) - (alias export 0 "tag" (type (;15;))) - (alias export 0 "note-type" (type (;16;))) - (alias export 0 "recipient" (type (;17;))) - (type (;18;) (func (param "core-asset" 13) (param "tag" 15) (param "note-type" 16) (param "recipient" 17))) + (func (;6;) (type 7) (canon lift (core func 7))) + (alias export 0 "tag" (type (;8;))) + (alias export 0 "note-type" (type (;9;))) + (alias export 0 "recipient" (type (;10;))) + (type (;11;) (func (param "core-asset" 6) (param "tag" 8) (param "note-type" 9) (param "recipient" 10))) (alias core export 5 "miden:basic-wallet/basic-wallet@1.0.0#send-asset" (core func (;8;))) - (func (;7;) (type 18) (canon lift (core func 8))) - (alias export 0 "felt" (type (;19;))) - (type (;20;) (func (param "a" 19) (param "b" 19) (result 19))) + (func (;7;) (type 11) (canon lift (core func 8))) + (alias export 0 "felt" (type (;12;))) + (type (;13;) (func (param "a" 12) (param "b" 12) (result 12))) (alias core export 5 "miden:basic-wallet/basic-wallet@1.0.0#test-felt-intrinsics" (core func (;9;))) - (func (;8;) (type 20) (canon lift (core func 9))) - (type (;21;) (list u8)) - (type (;22;) (func (param "input" 21) (result 21))) + (func (;8;) (type 13) (canon lift (core func 9))) + (type (;14;) (list u8)) + (type (;15;) (func (param "input" 14) (result 14))) (alias core export 5 "miden:basic-wallet/basic-wallet@1.0.0#test-stdlib" (core func (;10;))) (alias core export 5 "cabi_post_miden:basic-wallet/basic-wallet@1.0.0#test-stdlib" (core func (;11;))) - (func (;9;) (type 22) (canon lift (core func 10) (memory 0) (realloc 6) (post-return 11))) - (alias export 0 "felt" (type (;23;))) - (alias export 0 "word" (type (;24;))) - (alias export 0 "core-asset" (type (;25;))) - (alias export 0 "tag" (type (;26;))) - (alias export 0 "recipient" (type (;27;))) - (alias export 0 "note-type" (type (;28;))) + (func (;9;) (type 15) (canon lift (core func 10) (memory 0) (realloc 6) (post-return 11))) + (alias export 0 "felt" (type (;16;))) + (alias export 0 "word" (type (;17;))) + (alias export 0 "core-asset" (type (;18;))) + (alias export 0 "tag" (type (;19;))) + (alias export 0 "recipient" (type (;20;))) + (alias export 0 "note-type" (type (;21;))) (component (;0;) (type (;0;) (record (field "inner" float32))) (import "import-type-felt" (type (;1;) (eq 0))) @@ -944,23 +917,23 @@ (type (;32;) (func (param "input" 31) (result 31))) (export (;7;) "test-stdlib" (func 3) (func (type 32))) ) - (instance (;7;) (instantiate 0 + (instance (;6;) (instantiate 0 (with "import-func-receive-asset" (func 6)) (with "import-func-send-asset" (func 7)) (with "import-func-test-felt-intrinsics" (func 8)) (with "import-func-test-stdlib" (func 9)) - (with "import-type-felt" (type 23)) - (with "import-type-word" (type 24)) - (with "import-type-core-asset" (type 25)) - (with "import-type-tag" (type 26)) - (with "import-type-recipient" (type 27)) - (with "import-type-note-type" (type 28)) - (with "import-type-core-asset0" (type 13)) - (with "import-type-tag0" (type 15)) - (with "import-type-note-type0" (type 16)) - (with "import-type-recipient0" (type 17)) - (with "import-type-felt0" (type 19)) + (with "import-type-felt" (type 16)) + (with "import-type-word" (type 17)) + (with "import-type-core-asset" (type 18)) + (with "import-type-tag" (type 19)) + (with "import-type-recipient" (type 20)) + (with "import-type-note-type" (type 21)) + (with "import-type-core-asset0" (type 6)) + (with "import-type-tag0" (type 8)) + (with "import-type-note-type0" (type 9)) + (with "import-type-recipient0" (type 10)) + (with "import-type-felt0" (type 12)) ) ) - (export (;8;) "miden:basic-wallet/basic-wallet@1.0.0" (instance 7)) + (export (;7;) "miden:basic-wallet/basic-wallet@1.0.0" (instance 6)) ) \ No newline at end of file diff --git a/tests/rust-apps-wasm/rust-sdk/basic-wallet/src/bindings.rs b/tests/rust-apps-wasm/rust-sdk/basic-wallet/src/bindings.rs index 101ac432..55c9c577 100644 --- a/tests/rust-apps-wasm/rust-sdk/basic-wallet/src/bindings.rs +++ b/tests/rust-apps-wasm/rust-sdk/basic-wallet/src/bindings.rs @@ -11,12 +11,6 @@ pub mod miden { } #[allow(dead_code)] pub mod core_import { - #[allow(dead_code, clippy::all)] - pub mod types { - #[used] - #[doc(hidden)] - static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports; - } #[allow(dead_code, clippy::all)] pub mod intrinsics_mem { #[used] @@ -290,9 +284,9 @@ pub(crate) use __export_basic_wallet_world_impl as export; #[cfg(target_arch = "wasm32")] #[link_section = "component-type:wit-bindgen:0.31.0:miden:basic-wallet@1.0.0:basic-wallet-world:encoded world"] #[doc(hidden)] -pub static __WIT_BINDGEN_COMPONENT_TYPE: [u8; 1707] = *b"\ -\0asm\x0d\0\x01\0\0\x19\x16wit-component-encoding\x04\0\x07\xa2\x0c\x01A\x02\x01\ -A\x17\x01B\x1f\x01r\x01\x05innerv\x04\0\x04felt\x03\0\0\x01o\x04\x01\x01\x01\x01\ +pub static __WIT_BINDGEN_COMPONENT_TYPE: [u8; 1499] = *b"\ +\0asm\x0d\0\x01\0\0\x19\x16wit-component-encoding\x04\0\x07\xd2\x0a\x01A\x02\x01\ +A\x13\x01B\x1f\x01r\x01\x05innerv\x04\0\x04felt\x03\0\0\x01o\x04\x01\x01\x01\x01\ \x01r\x01\x05inner\x02\x04\0\x04word\x03\0\x03\x01r\x01\x05inner\x01\x04\0\x0aac\ count-id\x03\0\x05\x01r\x01\x05inner\x04\x04\0\x09recipient\x03\0\x07\x01r\x01\x05\ inner\x01\x04\0\x03tag\x03\0\x09\x01r\x01\x05inner\x04\x04\0\x0acore-asset\x03\0\ @@ -302,36 +296,28 @@ account-hash\x03\0\x0f\x01r\x01\x05inner\x04\x04\0\x0ablock-hash\x03\0\x11\x01r\ orage-root\x03\0\x15\x01r\x01\x05inner\x04\x04\0\x11account-code-root\x03\0\x17\x01\ r\x01\x05inner\x04\x04\0\x10vault-commitment\x03\0\x19\x01r\x01\x05inner\x01\x04\ \0\x07note-id\x03\0\x1b\x01r\x01\x05inner\x01\x04\0\x09note-type\x03\0\x1d\x03\x01\ -\x1bmiden:base/core-types@1.0.0\x05\0\x01B\x04\x01v\x04\0\x04felt\x03\0\0\x01z\x04\ -\0\x03ptr\x03\0\x02\x03\x01\x1dmiden:core-import/types@1.0.0\x05\x01\x02\x03\0\x01\ -\x04felt\x02\x03\0\x01\x03ptr\x01B\x06\x02\x03\x02\x01\x02\x04\0\x04felt\x03\0\0\ -\x02\x03\x02\x01\x03\x04\0\x03ptr\x03\0\x02\x01@\0\0\x03\x04\0\x09heap-base\x01\x04\ -\x03\x01&miden:core-import/intrinsics-mem@1.0.0\x05\x04\x01B\x06\x02\x03\x02\x01\ -\x02\x04\0\x04felt\x03\0\0\x02\x03\x02\x01\x03\x04\0\x03ptr\x03\0\x02\x01@\x02\x01\ -a\x01\x01b\x01\0\x01\x04\0\x03add\x01\x04\x03\x01'miden:core-import/intrinsics-f\ -elt@1.0.0\x05\x05\x01B\x06\x02\x03\x02\x01\x02\x04\0\x04felt\x03\0\0\x02\x03\x02\ -\x01\x03\x04\0\x03ptr\x03\0\x02\x01@\x09\x02a0z\x02a1z\x02a2z\x02a3z\x02a4z\x02a\ -5z\x02a6z\x02a7z\x0aresult-ptr\x03\x01\0\x04\0\x0fhash-one-to-one\x01\x04\x03\x01\ -3miden:core-import/stdlib-crypto-hashes-blake3@1.0.0\x05\x06\x01B\x07\x02\x03\x02\ -\x01\x02\x04\0\x04felt\x03\0\0\x02\x03\x02\x01\x03\x04\0\x03ptr\x03\0\x02\x01@\x05\ -\x06asset0\x01\x06asset1\x01\x06asset2\x01\x06asset3\x01\x0aresult-ptr\x03\x01\0\ -\x04\0\x09add-asset\x01\x04\x04\0\x0cremove-asset\x01\x04\x03\x01\x1fmiden:core-\ -import/account@1.0.0\x05\x07\x01B\x04\x02\x03\x02\x01\x02\x04\0\x04felt\x03\0\0\x01\ -@\x0a\x06asset0\x01\x06asset1\x01\x06asset2\x01\x06asset3\x01\x03tag\x01\x09note\ --type\x01\x0arecipient0\x01\x0arecipient1\x01\x0arecipient2\x01\x0arecipient3\x01\ -\0\x01\x04\0\x0bcreate-note\x01\x02\x03\x01\x1amiden:core-import/tx@1.0.0\x05\x08\ -\x02\x03\0\0\x0acore-asset\x02\x03\0\0\x03tag\x02\x03\0\0\x09recipient\x02\x03\0\ -\0\x09note-type\x02\x03\0\0\x04felt\x01B\x13\x02\x03\x02\x01\x09\x04\0\x0acore-a\ -sset\x03\0\0\x02\x03\x02\x01\x0a\x04\0\x03tag\x03\0\x02\x02\x03\x02\x01\x0b\x04\0\ -\x09recipient\x03\0\x04\x02\x03\x02\x01\x0c\x04\0\x09note-type\x03\0\x06\x02\x03\ -\x02\x01\x0d\x04\0\x04felt\x03\0\x08\x01@\x01\x0acore-asset\x01\x01\0\x04\0\x0dr\ -eceive-asset\x01\x0a\x01@\x04\x0acore-asset\x01\x03tag\x03\x09note-type\x07\x09r\ -ecipient\x05\x01\0\x04\0\x0asend-asset\x01\x0b\x01@\x02\x01a\x09\x01b\x09\0\x09\x04\ -\0\x14test-felt-intrinsics\x01\x0c\x01p}\x01@\x01\x05input\x0d\0\x0d\x04\0\x0bte\ -st-stdlib\x01\x0e\x04\x01%miden:basic-wallet/basic-wallet@1.0.0\x05\x0e\x04\x01+\ -miden:basic-wallet/basic-wallet-world@1.0.0\x04\0\x0b\x18\x01\0\x12basic-wallet-\ -world\x03\0\0\0G\x09producers\x01\x0cprocessed-by\x02\x0dwit-component\x070.216.\ -0\x10wit-bindgen-rust\x060.31.0"; +\x1bmiden:base/core-types@1.0.0\x05\0\x01B\x02\x01@\0\0z\x04\0\x09heap-base\x01\0\ +\x03\x01&miden:core-import/intrinsics-mem@1.0.0\x05\x01\x01B\x02\x01@\x02\x01av\x01\ +bv\0v\x04\0\x03add\x01\0\x03\x01'miden:core-import/intrinsics-felt@1.0.0\x05\x02\ +\x01B\x02\x01@\x09\x02a0z\x02a1z\x02a2z\x02a3z\x02a4z\x02a5z\x02a6z\x02a7z\x0are\ +sult-ptrz\x01\0\x04\0\x0fhash-one-to-one\x01\0\x03\x013miden:core-import/stdlib-\ +crypto-hashes-blake3@1.0.0\x05\x03\x01B\x03\x01@\x05\x06asset0v\x06asset1v\x06as\ +set2v\x06asset3v\x0aresult-ptrz\x01\0\x04\0\x09add-asset\x01\0\x04\0\x0cremove-a\ +sset\x01\0\x03\x01\x1fmiden:core-import/account@1.0.0\x05\x04\x01B\x02\x01@\x0a\x06\ +asset0v\x06asset1v\x06asset2v\x06asset3v\x03tagv\x09note-typev\x0arecipient0v\x0a\ +recipient1v\x0arecipient2v\x0arecipient3v\0v\x04\0\x0bcreate-note\x01\0\x03\x01\x1a\ +miden:core-import/tx@1.0.0\x05\x05\x02\x03\0\0\x0acore-asset\x02\x03\0\0\x03tag\x02\ +\x03\0\0\x09recipient\x02\x03\0\0\x09note-type\x02\x03\0\0\x04felt\x01B\x13\x02\x03\ +\x02\x01\x06\x04\0\x0acore-asset\x03\0\0\x02\x03\x02\x01\x07\x04\0\x03tag\x03\0\x02\ +\x02\x03\x02\x01\x08\x04\0\x09recipient\x03\0\x04\x02\x03\x02\x01\x09\x04\0\x09n\ +ote-type\x03\0\x06\x02\x03\x02\x01\x0a\x04\0\x04felt\x03\0\x08\x01@\x01\x0acore-\ +asset\x01\x01\0\x04\0\x0dreceive-asset\x01\x0a\x01@\x04\x0acore-asset\x01\x03tag\ +\x03\x09note-type\x07\x09recipient\x05\x01\0\x04\0\x0asend-asset\x01\x0b\x01@\x02\ +\x01a\x09\x01b\x09\0\x09\x04\0\x14test-felt-intrinsics\x01\x0c\x01p}\x01@\x01\x05\ +input\x0d\0\x0d\x04\0\x0btest-stdlib\x01\x0e\x04\x01%miden:basic-wallet/basic-wa\ +llet@1.0.0\x05\x0b\x04\x01+miden:basic-wallet/basic-wallet-world@1.0.0\x04\0\x0b\ +\x18\x01\0\x12basic-wallet-world\x03\0\0\0G\x09producers\x01\x0cprocessed-by\x02\ +\x0dwit-component\x070.216.0\x10wit-bindgen-rust\x060.31.0"; #[inline(never)] #[doc(hidden)] pub fn __link_custom_section_describing_imports() { diff --git a/tests/rust-apps-wasm/rust-sdk/basic-wallet/wit-sdk/miden-core-import.wit b/tests/rust-apps-wasm/rust-sdk/basic-wallet/wit-sdk/miden-core-import.wit index 0f816e05..c64dac04 100644 --- a/tests/rust-apps-wasm/rust-sdk/basic-wallet/wit-sdk/miden-core-import.wit +++ b/tests/rust-apps-wasm/rust-sdk/basic-wallet/wit-sdk/miden-core-import.wit @@ -1,49 +1,33 @@ package miden:core-import@1.0.0; -interface types { - - /// Represents base field element in the field using Montgomery representation. - /// Internal values represent x * R mod M where R = 2^64 mod M and x in [0, M). - /// The backing type is `f64` but the internal values are always integer in the range [0, M). - /// Field modulus M = 2^64 - 2^32 + 1 - type felt = f32; - type ptr = s32; - -} - interface intrinsics-mem { - use types.{felt, ptr}; - heap-base: func() -> ptr; + heap-base: func() -> s32; } interface intrinsics-felt { - use types.{felt, ptr}; - add: func(a: felt, b: felt) -> felt; + add: func(a: f32, b: f32) -> f32; } interface stdlib-crypto-hashes-blake3 { - use types.{felt, ptr}; - hash-one-to-one: func(a0: s32, a1: s32, a2: s32, a3: s32, a4: s32, a5: s32, a6: s32, a7: s32, result-ptr: ptr); + hash-one-to-one: func(a0: s32, a1: s32, a2: s32, a3: s32, a4: s32, a5: s32, a6: s32, a7: s32, result-ptr: s32); } interface account { - use types.{felt, ptr}; /// Add the specified asset to the vault. Panics under various conditions. /// 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. - add-asset: func(asset0: felt, asset1: felt, asset2: felt, asset3: felt, result-ptr: ptr); + add-asset: func(asset0: f32, asset1: f32, asset2: f32, asset3: f32, result-ptr: s32); /// Remove the specified asset from the vault - remove-asset: func(asset0: felt, asset1: felt, asset2: felt, asset3: felt, result-ptr: ptr); + remove-asset: func(asset0: f32, asset1: f32, asset2: f32, asset3: f32, result-ptr: s32); } interface tx { - use types.{felt}; /// Creates a new note. /// asset is the asset to be included in the note. @@ -51,17 +35,17 @@ interface tx { /// recipient is the recipient of the note. /// Returns the id of the created note. create-note: func( - asset0: felt, - asset1: felt, - asset2: felt, - asset3: felt, - tag: felt, - note-type: felt, - recipient0: felt, - recipient1: felt, - recipient2: felt, - recipient3: felt, - ) -> felt; + asset0: f32, + asset1: f32, + asset2: f32, + asset3: f32, + tag: f32, + note-type: f32, + recipient0: f32, + recipient1: f32, + recipient2: f32, + recipient3: f32, + ) -> f32; } diff --git a/tools/cargo-miden/src/lib.rs b/tools/cargo-miden/src/lib.rs index 137e764c..ca1d3b8d 100644 --- a/tools/cargo-miden/src/lib.rs +++ b/tools/cargo-miden/src/lib.rs @@ -180,9 +180,6 @@ where ("miden:base/core-types@1.0.0/tag", "miden_sdk::Tag"), ("miden:base/core-types@1.0.0/note-type", "miden_sdk::NoteType"), ("miden:base/core-types@1.0.0/recipient", "miden_sdk::Recipient"), - // We also need to swap the `core-import` custom types to not pollute the user's input - ("miden:core-import/types@1.0.0/felt", "f32"), - ("miden:core-import/types@1.0.0/ptr", "i32"), ] .into_iter() .map(|(k, v)| (k.to_string(), v.to_string()))