Skip to content

Commit 870119f

Browse files
authored
feat: update Miden VM in client (#913)
* feat: update `miden-base` with new 0.14 VM * use stable version for `miden-base`
1 parent 2855997 commit 870119f

8 files changed

Lines changed: 201 additions & 145 deletions

File tree

Cargo.lock

Lines changed: 175 additions & 127 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ repository = "https://github.com/0xMiden/miden-client"
2020

2121
[workspace.dependencies]
2222
async-trait = "0.1"
23-
miden-lib = { git = "https://github.com/0xMiden/miden-base", branch = "next", default-features = false }
24-
miden-objects = { git = "https://github.com/0xMiden/miden-base", branch = "next", default-features = false }
25-
miden-tx = { git = "https://github.com/0xMiden/miden-base", branch = "next", default-features = false, features = ["async"] }
26-
miden-proving-service-client = { git = "https://github.com/0xMiden/miden-base", branch = "next", default-features = false, features = ["tx-prover"] }
23+
miden-lib = { version = "0.9" , default-features = false }
24+
miden-objects = { version = "0.9" , default-features = false }
25+
miden-tx = { version = "0.9" , default-features = false, features = ["async"] }
26+
miden-proving-service-client = { version = "0.9" , default-features = false, features = ["tx-prover"] }
2727
miette = { version = "7.2", features = ["fancy"] }
2828
rand = { version = "0.9" }
2929
serde = { version = "1.0", features = ["derive"] }

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ WARNINGS=RUSTDOCFLAGS="-D warnings"
1818

1919
PROVER_DIR="miden-base"
2020
PROVER_REPO="https://github.com/0xMiden/miden-base.git"
21-
PROVER_BRANCH="3d8c3b28048fffbb63592a971d0fcae5dc58bce9"
21+
PROVER_BRANCH="next"
2222
PROVER_FEATURES_TESTING=--features "testing"
2323
PROVER_PORT=50051
2424

crates/rust-client/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ web-sys = { version = "0.3", features = ["console", "Window", "Storage"] }
6363
miden-client = { path = ".", features = ["testing", "concurrent", "sqlite", "tonic"] }
6464
miden-lib = { workspace = true, features = ["testing"] }
6565
miden-objects = { workspace = true, default-features = false, features = ["testing"] }
66-
miden-testing = { git = "https://github.com/0xMiden/miden-base", branch = "next", default-features = false, features = ["async"] }
66+
miden-testing = { version = "0.9" , default-features = false, features = ["async"] }
6767
tokio = { workspace = true }
6868
uuid = { version = "1.10", features = ["serde", "v4"] }
6969
web-sys = { version = "0.3", features = ["console"]}

crates/rust-client/src/transaction/mod.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ use core::fmt::{self};
7373
use miden_objects::{
7474
AssetError, Digest, Felt, Word,
7575
account::{Account, AccountCode, AccountDelta, AccountId},
76+
assembly::DefaultSourceManager,
7677
asset::{Asset, NonFungibleAsset},
7778
block::BlockNumber,
7879
note::{Note, NoteDetails, NoteId, NoteTag},
@@ -549,7 +550,13 @@ impl Client {
549550
// Execute the transaction and get the witness
550551
let executed_transaction = self
551552
.tx_executor
552-
.execute_transaction(account_id, block_num, notes, tx_args)
553+
.execute_transaction(
554+
account_id,
555+
block_num,
556+
notes,
557+
tx_args,
558+
Arc::new(DefaultSourceManager::default()), // TODO: Use the correct source manager
559+
)
553560
.await?;
554561

555562
// Check that the expected output notes matches the transaction outcome.
@@ -1023,6 +1030,7 @@ impl Client {
10231030
tx_script,
10241031
advice_inputs,
10251032
foreign_account_inputs,
1033+
Arc::new(DefaultSourceManager::default()), // TODO: Use the correct source manager
10261034
)
10271035
.await?)
10281036
}

crates/web-client/test/new_transactions.test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ export const customTransaction = async (
296296
mem_loadw
297297
# => [NOTE_ARG_1]
298298
299-
push.${expectedNoteArg1} assert_eqw.err=101
299+
push.${expectedNoteArg1} assert_eqw.err="First note argument didn't match expected"
300300
# => []
301301
302302
# read second word
@@ -305,15 +305,15 @@ export const customTransaction = async (
305305
mem_loadw
306306
# => [NOTE_ARG_2]
307307
308-
push.${expectedNoteArg2} assert_eqw.err=102
308+
push.${expectedNoteArg2} assert_eqw.err="Second note argument didn't match expected"
309309
# => []
310310
311311
# store the note inputs to memory starting at address 0
312312
push.0 exec.note::get_inputs
313313
# => [num_inputs, inputs_ptr]
314314
315-
# make sure the number of inputs is 1
316-
eq.2 assert.err=103
315+
# make sure the number of inputs is 2
316+
eq.2 assert.err="P2ID script expects exactly 2 note inputs"
317317
# => [inputs_ptr]
318318
319319
# read the target account id from the note inputs
@@ -324,7 +324,7 @@ export const customTransaction = async (
324324
# => [account_id_prefix, target_account_id_prefix, ...]
325325
326326
# ensure account_id = target_account_id, fails otherwise
327-
assert_eq.err=104
327+
assert_eq.err="P2ID's target account address and transaction address do not match"
328328
# => [...]
329329
330330
exec.add_note_assets_to_account

tests/integration/asm/custom_p2id.masm

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ begin
8383
mem_loadw
8484
# => [NOTE_ARG_1]
8585

86-
push.{expected_note_arg_1} assert_eqw.err=101
86+
push.{expected_note_arg_1} assert_eqw.err="First note argument didn't match expected"
8787
# => []
8888

8989
# read second word
@@ -92,15 +92,15 @@ begin
9292
mem_loadw
9393
# => [NOTE_ARG_2]
9494

95-
push.{expected_note_arg_2} assert_eqw.err=102
95+
push.{expected_note_arg_2} assert_eqw.err="Second note argument didn't match expected"
9696
# => []
9797

9898
# store the note inputs to memory starting at address 0
9999
push.0 exec.note::get_inputs
100100
# => [num_inputs, inputs_ptr]
101101

102-
# make sure the number of inputs is 1
103-
eq.2 assert.err=103
102+
# make sure the number of inputs is 2
103+
eq.2 assert.err="P2ID script expects exactly 2 note inputs"
104104
# => [inputs_ptr]
105105

106106
# read the target account id from the note inputs
@@ -111,7 +111,7 @@ begin
111111
# => [account_id_prefix, target_account_id_prefix, ...]
112112

113113
# ensure account_id = target_account_id, fails otherwise
114-
assert_eq.err=104
114+
assert_eq.err="P2ID's target account address and transaction address do not match"
115115
# => [...]
116116

117117
exec.add_note_assets_to_account

tests/integration/custom_transactions_tests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ async fn test_merkle_store() {
200200
push.4000 push.{pos} exec.mmr::get
201201
202202
# check the element matches what was inserted at `pos`
203-
push.{expected_element} assert_eqw.err=999
203+
push.{expected_element} assert_eqw.err=\"element in merkle store didn't match expected\"
204204
"
205205
)
206206
.as_str();

0 commit comments

Comments
 (0)