diff --git a/Cargo.lock b/Cargo.lock index b6f19b2ae..2d6ee80b8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -346,9 +346,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.7.0" +version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1be3f42a67d6d345ecd59f675f3f012d6974981560836e938c22b424b85ce1be" +checksum = "8f68f53c83ab957f72c32642f3868eec03eb974d1fb82e453128456482613d36" [[package]] name = "blake2" @@ -434,9 +434,9 @@ checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5" [[package]] name = "cc" -version = "1.2.9" +version = "1.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8293772165d9345bdaaa39b45b2109591e63fe5e6fbc23c6ff930a048aa310b" +checksum = "13208fcbb66eaeffe09b99fffbe1af420f00a7b35aa99ad683dfc1aa76145229" dependencies = [ "jobserver", "libc", @@ -725,9 +725,9 @@ dependencies = [ [[package]] name = "data-encoding" -version = "2.6.0" +version = "2.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8566979429cf69b49a5c740c60791108e86440e8be149bbea4fe54d2c32d6e2" +checksum = "0e60eed09d8c01d3cee5b7d30acb059b76614c918fa0f992e0dd6eeb10daad6f" [[package]] name = "debugid" @@ -1098,7 +1098,7 @@ dependencies = [ "futures-core", "futures-sink", "http", - "indexmap 2.7.0", + "indexmap 2.7.1", "slab", "tokio", "tokio-util", @@ -1465,9 +1465,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.7.0" +version = "2.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62f822373a4fe84d4bb149bf54e584a7f4abec90e072ed49cda0edea5b95471f" +checksum = "8c9c992b02b5b4c94ea26e32fe5bccb7aa7d9f390ab5c1221ff895bc7ea8b652" dependencies = [ "equivalent", "hashbrown 0.15.2", @@ -1480,7 +1480,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "232929e1d75fe899576a3d5c7416ad0d88dbfbb3c3d6aa00873a7408a50ddb88" dependencies = [ "ahash", - "indexmap 2.7.0", + "indexmap 2.7.1", "is-terminal", "itoa", "log", @@ -1499,9 +1499,9 @@ checksum = "c8fae54786f62fb2918dcfae3d568594e50eb9b5c25bf04371af6fe7516452fb" [[package]] name = "ipnet" -version = "2.10.1" +version = "2.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddc24109865250148c2e0f3d25d4f0f479571723792d3802153c60922a4fb708" +checksum = "469fb0b9cefa57e3ef31275ee7cacb78f2fdca44e4765491884a2b119d4eb130" [[package]] name = "is-terminal" @@ -1638,7 +1638,7 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d" dependencies = [ - "bitflags 2.7.0", + "bitflags 2.8.0", "libc", ] @@ -1682,9 +1682,9 @@ dependencies = [ [[package]] name = "log" -version = "0.4.22" +version = "0.4.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" +checksum = "04cbf5b083de1c7e0222a7a51dbfdba1cbe1c6ab0b15e29fff3f6c077fd9cd9f" [[package]] name = "logos" @@ -1789,7 +1789,7 @@ dependencies = [ [[package]] name = "miden-air" version = "0.11.0" -source = "git+https://github.com/0xPolygonMiden/miden-vm.git?branch=next#8420dcd37078c605f90c87d233eb964ae3468fc9" +source = "git+https://github.com/0xPolygonMiden/miden-vm.git?rev=8420dcd#8420dcd37078c605f90c87d233eb964ae3468fc9" dependencies = [ "miden-core", "thiserror 2.0.11", @@ -1800,7 +1800,7 @@ dependencies = [ [[package]] name = "miden-assembly" version = "0.11.0" -source = "git+https://github.com/0xPolygonMiden/miden-vm.git?branch=next#8420dcd37078c605f90c87d233eb964ae3468fc9" +source = "git+https://github.com/0xPolygonMiden/miden-vm.git?rev=8420dcd#8420dcd37078c605f90c87d233eb964ae3468fc9" dependencies = [ "aho-corasick", "lalrpop", @@ -1831,7 +1831,7 @@ dependencies = [ [[package]] name = "miden-core" version = "0.11.0" -source = "git+https://github.com/0xPolygonMiden/miden-vm.git?branch=next#8420dcd37078c605f90c87d233eb964ae3468fc9" +source = "git+https://github.com/0xPolygonMiden/miden-vm.git?rev=8420dcd#8420dcd37078c605f90c87d233eb964ae3468fc9" dependencies = [ "lock_api", "loom", @@ -1950,7 +1950,7 @@ dependencies = [ "rand", "rand_xoshiro", "rstest", - "semver 1.0.24", + "semver 1.0.25", "serde", "tempfile", "thiserror 2.0.11", @@ -1961,7 +1961,7 @@ dependencies = [ [[package]] name = "miden-processor" version = "0.11.0" -source = "git+https://github.com/0xPolygonMiden/miden-vm.git?branch=next#8420dcd37078c605f90c87d233eb964ae3468fc9" +source = "git+https://github.com/0xPolygonMiden/miden-vm.git?rev=8420dcd#8420dcd37078c605f90c87d233eb964ae3468fc9" dependencies = [ "miden-air", "miden-core", @@ -1973,7 +1973,7 @@ dependencies = [ [[package]] name = "miden-prover" version = "0.11.0" -source = "git+https://github.com/0xPolygonMiden/miden-vm.git?branch=next#8420dcd37078c605f90c87d233eb964ae3468fc9" +source = "git+https://github.com/0xPolygonMiden/miden-vm.git?rev=8420dcd#8420dcd37078c605f90c87d233eb964ae3468fc9" dependencies = [ "miden-air", "miden-processor", @@ -2048,7 +2048,7 @@ dependencies = [ [[package]] name = "miden-stdlib" version = "0.11.0" -source = "git+https://github.com/0xPolygonMiden/miden-vm.git?branch=next#8420dcd37078c605f90c87d233eb964ae3468fc9" +source = "git+https://github.com/0xPolygonMiden/miden-vm.git?rev=8420dcd#8420dcd37078c605f90c87d233eb964ae3468fc9" dependencies = [ "miden-assembly", ] @@ -2076,7 +2076,7 @@ dependencies = [ [[package]] name = "miden-verifier" version = "0.11.0" -source = "git+https://github.com/0xPolygonMiden/miden-vm.git?branch=next#8420dcd37078c605f90c87d233eb964ae3468fc9" +source = "git+https://github.com/0xPolygonMiden/miden-vm.git?rev=8420dcd#8420dcd37078c605f90c87d233eb964ae3468fc9" dependencies = [ "miden-air", "miden-core", @@ -2326,7 +2326,7 @@ version = "0.10.68" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6174bc48f102d208783c2c84bf931bb75927a617866870de8a4ea85597f871f5" dependencies = [ - "bitflags 2.7.0", + "bitflags 2.8.0", "cfg-if", "foreign-types", "libc", @@ -2519,7 +2519,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b4c5cc86750666a3ed20bdaf5ca2a0344f9c67674cae0515bec2da16fbaa47db" dependencies = [ "fixedbitset", - "indexmap 2.7.0", + "indexmap 2.7.1", ] [[package]] @@ -3141,7 +3141,7 @@ version = "0.5.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "03a862b389f93e68874fbf580b9de08dd02facb9a788ebadaf4a3fd33cf58834" dependencies = [ - "bitflags 2.7.0", + "bitflags 2.8.0", ] [[package]] @@ -3356,7 +3356,7 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" dependencies = [ - "semver 1.0.24", + "semver 1.0.25", ] [[package]] @@ -3365,7 +3365,7 @@ version = "0.38.43" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a78891ee6bf2340288408954ac787aa063d8e8817e9f53abb37c695c6d834ef6" dependencies = [ - "bitflags 2.7.0", + "bitflags 2.8.0", "errno", "libc", "linux-raw-sys", @@ -3486,7 +3486,7 @@ version = "2.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "897b2245f0b511c87893af39b033e5ca9cce68824c4d7e7630b5a1d339658d02" dependencies = [ - "bitflags 2.7.0", + "bitflags 2.8.0", "core-foundation", "core-foundation-sys", "libc", @@ -3514,9 +3514,9 @@ dependencies = [ [[package]] name = "semver" -version = "1.0.24" +version = "1.0.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3cb6eb87a131f756572d7fb904f6e7b68633f09cca868c5df1c4b8d1a694bbba" +checksum = "f79dfe2d285b0488816f30e700a7438c5a73d816b5b7d3ac72fbc48b0d185e03" dependencies = [ "serde", ] @@ -3549,11 +3549,11 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.135" +version = "1.0.137" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b0d7ba2887406110130a978386c4e1befb98c674b4fba677954e4db976630d9" +checksum = "930cfb6e6abf99298aaad7d29abbef7a9999a9a8806a40088f55f0dcec03146b" dependencies = [ - "indexmap 2.7.0", + "indexmap 2.7.1", "itoa", "memchr", "ryu", @@ -3621,7 +3621,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f27daf6ed3fc7ffd5ea3ce9f684fe351c47e50f2fdbb6236e2bad0b440dbe408" dependencies = [ "data-encoding", - "indexmap 2.7.0", + "indexmap 2.7.1", "rust_decimal", ] @@ -3729,9 +3729,9 @@ dependencies = [ [[package]] name = "strip-ansi-escapes" -version = "0.2.0" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55ff8ef943b384c414f54aefa961dd2bd853add74ec75e7ac74cf91dba62bcfa" +checksum = "2a8f8038e7e7969abb3f1b7c2a811225e9296da208539e0f79c5251d6cac0025" dependencies = [ "vte", ] @@ -3799,9 +3799,9 @@ checksum = "b7401a30af6cb5818bb64852270bb722533397edcfc7344954a38f420819ece2" [[package]] name = "symbolic-common" -version = "12.13.2" +version = "12.13.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8150eae9699e3c73a3e6431dc1f80d87748797c0457336af23e94c1de619ed24" +checksum = "13a4dfe4bbeef59c1f32fc7524ae7c95b9e1de5e79a43ce1604e181081d71b0c" dependencies = [ "debugid", "memmap2", @@ -3811,9 +3811,9 @@ dependencies = [ [[package]] name = "symbolic-demangle" -version = "12.13.2" +version = "12.13.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95f4a9846f7a8933b6d198c022faa2c9bd89e1a970bed9d9a98d25708bf8de17" +checksum = "98cf6a95abff97de4d7ff3473f33cacd38f1ddccad5c1feab435d6760300e3b6" dependencies = [ "rustc-demangle", "symbolic-common", @@ -3867,7 +3867,7 @@ version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3c879d448e9d986b661742763247d3693ed13609438cf3d006f51f5368a5ba6b" dependencies = [ - "bitflags 2.7.0", + "bitflags 2.8.0", "core-foundation", "system-configuration-sys", ] @@ -4155,7 +4155,7 @@ version = "0.22.22" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4ae48d6208a266e853d946088ed816055e556cc6028c5e8e2b84d9fa5dd7c7f5" dependencies = [ - "indexmap 2.7.0", + "indexmap 2.7.1", "serde", "serde_spanned", "toml_datetime", @@ -4306,7 +4306,7 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1e9cd434a998747dd2c4276bc96ee2e0c7a2eadf3cae88e52be55a05fa9053f5" dependencies = [ - "bitflags 2.7.0", + "bitflags 2.8.0", "bytes", "http", "http-body", @@ -4458,9 +4458,9 @@ checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" [[package]] name = "trybuild" -version = "1.0.101" +version = "1.0.102" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8dcd332a5496c026f1e14b7f3d2b7bd98e509660c04239c58b0ba38a12daded4" +checksum = "9f14b5c02a137632f68194ec657ecb92304138948e8957c932127eb1b58c23be" dependencies = [ "dissimilar", "glob", @@ -4560,18 +4560,18 @@ checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" [[package]] name = "uuid" -version = "1.11.1" +version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b913a3b5fe84142e269d63cc62b64319ccaf89b748fc31fe025177f767a756c4" +checksum = "744018581f9a3454a9e15beb8a33b017183f1e7c0cd170232a2d1453b23a51c4" dependencies = [ "getrandom", ] [[package]] name = "valuable" -version = "0.1.0" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" +checksum = "ba73ea9cf16a25df0c8caa16c51acb937d5712a8429db78a3ee29d5dcacd3a65" [[package]] name = "vcpkg" @@ -4587,22 +4587,11 @@ checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" [[package]] name = "vte" -version = "0.11.1" +version = "0.14.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f5022b5fbf9407086c180e9557be968742d839e68346af7792b8592489732197" +checksum = "231fdcd7ef3037e8330d8e17e61011a2c244126acc0a982f4040ac3f9f0bc077" dependencies = [ - "utf8parse", - "vte_generate_state_changes", -] - -[[package]] -name = "vte_generate_state_changes" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e369bee1b05d510a7b4ed645f5faa90619e05437111783ea5848f28d97d3c2e" -dependencies = [ - "proc-macro2", - "quote", + "memchr", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index acdec43cf..4b3aa4a68 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -33,16 +33,16 @@ codegen-units = 1 lto = true [workspace.dependencies] -assembly = { package = "miden-assembly", git = "https://github.com/0xPolygonMiden/miden-vm.git", branch = "next", default-features = false } +assembly = { package = "miden-assembly", git = "https://github.com/0xPolygonMiden/miden-vm.git", rev = "8420dcd", default-features = false } assert_matches = { version = "1.5", default-features = false } miden-crypto = { version = "0.13", default-features = false } miden-lib = { path = "miden-lib", version = "0.7", default-features = false } miden-objects = { path = "objects", version = "0.7", default-features = false } -miden-prover = { package = "miden-prover", git = "https://github.com/0xPolygonMiden/miden-vm.git", branch = "next", default-features = false } -miden-stdlib = { package = "miden-stdlib", git = "https://github.com/0xPolygonMiden/miden-vm.git", branch = "next", default-features = false } +miden-prover = { package = "miden-prover", git = "https://github.com/0xPolygonMiden/miden-vm.git", rev = "8420dcd", default-features = false } +miden-stdlib = { package = "miden-stdlib", git = "https://github.com/0xPolygonMiden/miden-vm.git", rev = "8420dcd", default-features = false } miden-tx = { path = "miden-tx", version = "0.7", default-features = false } -miden-verifier = { package = "miden-verifier", git = "https://github.com/0xPolygonMiden/miden-vm.git", branch = "next", default-features = false } +miden-verifier = { package = "miden-verifier", git = "https://github.com/0xPolygonMiden/miden-vm.git", rev = "8420dcd", default-features = false } rand = { version = "0.8", default-features = false } thiserror = { version = "2.0", default-features = false } -vm-core = { package = "miden-core", git = "https://github.com/0xPolygonMiden/miden-vm.git", branch = "next", default-features = false } -vm-processor = { package = "miden-processor", git = "https://github.com/0xPolygonMiden/miden-vm.git", branch = "next", default-features = false } +vm-core = { package = "miden-core", git = "https://github.com/0xPolygonMiden/miden-vm.git", rev = "8420dcd", default-features = false } +vm-processor = { package = "miden-processor", git = "https://github.com/0xPolygonMiden/miden-vm.git", rev = "8420dcd", default-features = false } diff --git a/miden-lib/src/transaction/errors.rs b/miden-lib/src/transaction/errors.rs index 236f9681e..d8d38e495 100644 --- a/miden-lib/src/transaction/errors.rs +++ b/miden-lib/src/transaction/errors.rs @@ -64,7 +64,7 @@ pub enum TransactionEventError { InvalidTransactionEvent(u32), #[error("event id {0} is not a transaction kernel event")] NotTransactionEvent(u32), - #[error("{0} event can only be emitted from the root context")] + #[error("event id {0} can only be emitted from the root context")] NotRootContext(u32), } diff --git a/miden-lib/src/transaction/mod.rs b/miden-lib/src/transaction/mod.rs index 59bb00ab2..6b3a83507 100644 --- a/miden-lib/src/transaction/mod.rs +++ b/miden-lib/src/transaction/mod.rs @@ -30,9 +30,7 @@ pub use outputs::{ }; mod errors; -pub use errors::{ - TransactionEventError, TransactionKernelError, TransactionTraceParsingError, -}; +pub use errors::{TransactionEventError, TransactionKernelError, TransactionTraceParsingError}; mod procedures; diff --git a/miden-tx/src/host/account_procs.rs b/miden-tx/src/host/account_procs.rs index 04ee50b2b..20da844e6 100644 --- a/miden-tx/src/host/account_procs.rs +++ b/miden-tx/src/host/account_procs.rs @@ -42,10 +42,7 @@ impl AccountProcedureIndexMap { /// # Errors /// Returns an error if the procedure at the top of the operand stack is not present in this /// map. - pub fn get_proc_index( - &self, - process: &ProcessState, - ) -> Result { + pub fn get_proc_index(&self, process: &ProcessState) -> Result { // get current account code commitment let code_commitment = { let curr_data_ptr = process diff --git a/miden-tx/src/host/mod.rs b/miden-tx/src/host/mod.rs index bebc10189..cca64efd5 100644 --- a/miden-tx/src/host/mod.rs +++ b/miden-tx/src/host/mod.rs @@ -1,16 +1,16 @@ use alloc::{ + boxed::Box, collections::{BTreeMap, BTreeSet}, string::ToString, sync::Arc, vec::Vec, - boxed::Box, }; use miden_lib::{ errors::tx_kernel_errors::TX_KERNEL_ERRORS, transaction::{ memory::{CURRENT_INPUT_NOTE_PTR, NATIVE_NUM_ACCT_STORAGE_SLOTS_PTR}, - TransactionEvent, TransactionKernelError, TransactionTrace, TransactionEventError + TransactionEvent, TransactionEventError, TransactionKernelError, TransactionTrace, }, }; use miden_objects::{ @@ -22,8 +22,8 @@ use miden_objects::{ Digest, Hasher, }; use vm_processor::{ - AdviceProvider, AdviceSource, ContextId, ExecutionError, Felt, - Host, MastForest, MastForestStore, ProcessState, + AdviceProvider, AdviceSource, ContextId, ExecutionError, Felt, Host, MastForest, + MastForestStore, ProcessState, }; mod account_delta_tracker; @@ -383,10 +383,7 @@ impl TransactionHost { /// This signature is created during transaction execution and stored for use as advice map /// inputs in the proving host. If not already present in the advice map, it is requested from /// the host's authenticator. - pub fn on_signature_requested( - &mut self, - process: ProcessState, - ) -> Result<(), ExecutionError> { + pub fn on_signature_requested(&mut self, process: ProcessState) -> Result<(), ExecutionError> { let pub_key = process.get_stack_word(0); let msg = process.get_stack_word(1); let signature_key = Hasher::merge(&[pub_key.into(), msg.into()]); @@ -485,17 +482,15 @@ impl Host for TransactionHost { self.mast_store.get(node_digest) } - fn on_event( - &mut self, - process: ProcessState, - event_id: u32, - ) -> Result<(), ExecutionError> { + fn on_event(&mut self, process: ProcessState, event_id: u32) -> Result<(), ExecutionError> { let event = TransactionEvent::try_from(event_id) .map_err(|err| ExecutionError::EventError(Box::new(err)))?; - if process.ctx() != ContextId::root() { - return Err(ExecutionError::EventError(Box::new(TransactionEventError::NotRootContext(event_id)))); - } + if process.ctx() != ContextId::root() { + return Err(ExecutionError::EventError(Box::new( + TransactionEventError::NotRootContext(event_id), + ))); + } match event { TransactionEvent::AccountVaultBeforeAddAsset => Ok(()), @@ -538,11 +533,7 @@ impl Host for TransactionHost { Ok(()) } - fn on_trace( - &mut self, - process: ProcessState, - trace_id: u32, - ) -> Result<(), ExecutionError> { + fn on_trace(&mut self, process: ProcessState, trace_id: u32) -> Result<(), ExecutionError> { let event = TransactionTrace::try_from(trace_id) .map_err(|err| ExecutionError::EventError(Box::new(err)))?; diff --git a/miden-tx/src/testing/executor.rs b/miden-tx/src/testing/executor.rs index e10185a55..5bfff1951 100644 --- a/miden-tx/src/testing/executor.rs +++ b/miden-tx/src/testing/executor.rs @@ -41,10 +41,8 @@ impl CodeExecutor { } pub fn execute_program(mut self, program: Program) -> Result { - let mut process = Process::new_debug( - program.kernel().clone(), - self.stack_inputs.unwrap_or_default(), - ); + let mut process = + Process::new_debug(program.kernel().clone(), self.stack_inputs.unwrap_or_default()); process.execute(&program, &mut self.host)?; Ok(process) diff --git a/miden-tx/src/testing/mock_host.rs b/miden-tx/src/testing/mock_host.rs index 3bea1c3ae..383d7186d 100644 --- a/miden-tx/src/testing/mock_host.rs +++ b/miden-tx/src/testing/mock_host.rs @@ -1,14 +1,16 @@ -use alloc::{collections::BTreeMap, rc::Rc, string::ToString, sync::Arc, vec::Vec, boxed::Box}; +use alloc::{boxed::Box, collections::BTreeMap, rc::Rc, string::ToString, sync::Arc, vec::Vec}; -use miden_lib::{errors::tx_kernel_errors::TX_KERNEL_ERRORS, transaction::{TransactionEvent, TransactionEventError}}; +use miden_lib::{ + errors::tx_kernel_errors::TX_KERNEL_ERRORS, + transaction::{TransactionEvent, TransactionEventError}, +}; use miden_objects::{ accounts::{AccountHeader, AccountVaultDelta}, Digest, }; use vm_processor::{ - AdviceInputs, AdviceProvider, AdviceSource, ContextId, - ExecutionError, Host, MastForest, MastForestStore, MemAdviceProvider, - ProcessState, + AdviceInputs, AdviceProvider, AdviceSource, ContextId, ExecutionError, Host, MastForest, + MastForestStore, MemAdviceProvider, ProcessState, }; use crate::{host::AccountProcedureIndexMap, TransactionMastStore}; @@ -88,17 +90,15 @@ impl Host for MockHost { self.mast_store.get(node_digest) } - fn on_event( - &mut self, - process: ProcessState, - event_id: u32, - ) -> Result<(), ExecutionError> { + fn on_event(&mut self, process: ProcessState, event_id: u32) -> Result<(), ExecutionError> { let event = TransactionEvent::try_from(event_id) .map_err(|err| ExecutionError::EventError(Box::new(err)))?; - if process.ctx() != ContextId::root() { - return Err(ExecutionError::EventError(Box::new(TransactionEventError::NotRootContext(event_id)))); - } + if process.ctx() != ContextId::root() { + return Err(ExecutionError::EventError(Box::new( + TransactionEventError::NotRootContext(event_id), + ))); + } match event { TransactionEvent::AccountPushProcedureIndex => { diff --git a/miden-tx/src/testing/tx_context/builder.rs b/miden-tx/src/testing/tx_context/builder.rs index 6fd216ba4..b9c6240f2 100644 --- a/miden-tx/src/testing/tx_context/builder.rs +++ b/miden-tx/src/testing/tx_context/builder.rs @@ -24,8 +24,8 @@ use miden_objects::{ storage::prepare_assets, }, transaction::{OutputNote, TransactionArgs, TransactionInputs, TransactionScript}, - FieldElement, vm::AdviceMap, + FieldElement, }; use rand::{Rng, SeedableRng}; use rand_chacha::ChaCha20Rng; diff --git a/miden-tx/src/tests/kernel_tests/test_account.rs b/miden-tx/src/tests/kernel_tests/test_account.rs index 305e8d782..d844c67f1 100644 --- a/miden-tx/src/tests/kernel_tests/test_account.rs +++ b/miden-tx/src/tests/kernel_tests/test_account.rs @@ -367,9 +367,21 @@ fn test_get_storage_slot_type() { assert_eq!(process_state.get_stack_item(1), ZERO, "the rest of the stack is empty"); assert_eq!(process_state.get_stack_item(2), ZERO, "the rest of the stack is empty"); assert_eq!(process_state.get_stack_item(3), ZERO, "the rest of the stack is empty"); - assert_eq!(Word::default(), process_state.get_stack_word(1), "the rest of the stack is empty"); - assert_eq!(Word::default(), process_state.get_stack_word(2), "the rest of the stack is empty"); - assert_eq!(Word::default(), process_state.get_stack_word(3), "the rest of the stack is empty"); + assert_eq!( + Word::default(), + process_state.get_stack_word(1), + "the rest of the stack is empty" + ); + assert_eq!( + Word::default(), + process_state.get_stack_word(2), + "the rest of the stack is empty" + ); + assert_eq!( + Word::default(), + process_state.get_stack_word(3), + "the rest of the stack is empty" + ); } } diff --git a/miden-tx/src/tests/kernel_tests/test_epilogue.rs b/miden-tx/src/tests/kernel_tests/test_epilogue.rs index b34ac071c..f4c40c00d 100644 --- a/miden-tx/src/tests/kernel_tests/test_epilogue.rs +++ b/miden-tx/src/tests/kernel_tests/test_epilogue.rs @@ -240,7 +240,7 @@ fn test_block_expiration_height_monotonically_decreases() { .replace("{value_2}", &v2.to_string()) .replace("{min_value}", &v2.min(v1).to_string()); - let process = &tx_context.execute_code(&code).unwrap(); + let process = &tx_context.execute_code(code).unwrap(); let process_state: ProcessState = process.into(); // Expiry block should be set to transaction's block + the stored expiration delta @@ -294,7 +294,7 @@ fn test_no_expiration_delta_set() { end "; - let process = &tx_context.execute_code(&code_template).unwrap(); + let process = &tx_context.execute_code(code_template).unwrap(); let process_state: ProcessState = process.into(); // Default value should be equal to u32::max, set in the prologue diff --git a/miden-tx/src/tests/kernel_tests/test_note.rs b/miden-tx/src/tests/kernel_tests/test_note.rs index 24ba6a258..527ceb295 100644 --- a/miden-tx/src/tests/kernel_tests/test_note.rs +++ b/miden-tx/src/tests/kernel_tests/test_note.rs @@ -16,9 +16,7 @@ use vm_processor::{ProcessState, Word, EMPTY_WORD, ONE}; use super::{Felt, Process, ZERO}; use crate::{ assert_execution_error, - testing::{ - utils::input_note_data_ptr, TransactionContext, TransactionContextBuilder, - }, + testing::{utils::input_note_data_ptr, TransactionContext, TransactionContextBuilder}, tests::kernel_tests::read_root_mem_value, }; diff --git a/miden-tx/src/tests/kernel_tests/test_prologue.rs b/miden-tx/src/tests/kernel_tests/test_prologue.rs index 6629004ab..ffc5078fc 100644 --- a/miden-tx/src/tests/kernel_tests/test_prologue.rs +++ b/miden-tx/src/tests/kernel_tests/test_prologue.rs @@ -50,8 +50,7 @@ use super::{Felt, Process, Word, ZERO}; use crate::{ assert_execution_error, testing::{ - utils::input_note_data_ptr, MockChain, TransactionContext, - TransactionContextBuilder, + utils::input_note_data_ptr, MockChain, TransactionContext, TransactionContextBuilder, }, tests::kernel_tests::read_root_mem_value, }; diff --git a/miden-tx/src/tests/kernel_tests/test_tx.rs b/miden-tx/src/tests/kernel_tests/test_tx.rs index 40e5192fa..591bbdcfe 100644 --- a/miden-tx/src/tests/kernel_tests/test_tx.rs +++ b/miden-tx/src/tests/kernel_tests/test_tx.rs @@ -95,7 +95,10 @@ fn test_create_note() { ); assert_eq!( - read_root_mem_value(&process.into(), OUTPUT_NOTE_SECTION_OFFSET + OUTPUT_NOTE_RECIPIENT_OFFSET), + read_root_mem_value( + &process.into(), + OUTPUT_NOTE_SECTION_OFFSET + OUTPUT_NOTE_RECIPIENT_OFFSET + ), recipient, "recipient must be stored at the correct memory location", ); @@ -111,7 +114,10 @@ fn test_create_note() { .into(); assert_eq!( - read_root_mem_value(&process.into(), OUTPUT_NOTE_SECTION_OFFSET + OUTPUT_NOTE_METADATA_OFFSET), + read_root_mem_value( + &process.into(), + OUTPUT_NOTE_SECTION_OFFSET + OUTPUT_NOTE_METADATA_OFFSET + ), [ expected_note_metadata[0], expected_note_metadata[1], @@ -500,13 +506,19 @@ fn test_create_note_and_add_multiple_assets() { ); assert_eq!( - read_root_mem_value(&process_state, OUTPUT_NOTE_SECTION_OFFSET + OUTPUT_NOTE_ASSETS_OFFSET + 1), + read_root_mem_value( + &process_state, + OUTPUT_NOTE_SECTION_OFFSET + OUTPUT_NOTE_ASSETS_OFFSET + 1 + ), asset_2_and_3, "asset_2 and asset_3 must be stored at the same correct memory location", ); assert_eq!( - read_root_mem_value(&process_state, OUTPUT_NOTE_SECTION_OFFSET + OUTPUT_NOTE_ASSETS_OFFSET + 2), + read_root_mem_value( + &process_state, + OUTPUT_NOTE_SECTION_OFFSET + OUTPUT_NOTE_ASSETS_OFFSET + 2 + ), Word::from(non_fungible_asset_encoded), "non_fungible_asset must be stored at the correct memory location", ); @@ -649,7 +661,10 @@ fn test_build_recipient_hash() { let recipient_digest: Vec = recipient.clone().digest().to_vec(); assert_eq!( - read_root_mem_value(&process.into(), OUTPUT_NOTE_SECTION_OFFSET + OUTPUT_NOTE_RECIPIENT_OFFSET), + read_root_mem_value( + &process.into(), + OUTPUT_NOTE_SECTION_OFFSET + OUTPUT_NOTE_RECIPIENT_OFFSET + ), recipient_digest.as_slice(), "recipient hash not correct", ); @@ -893,7 +908,10 @@ fn test_fpi_memory() { // Foreign account: [4096; 6143] <- initialized during first FPI // Next account slot: [6144; 8191] <- should not be initialized assert_eq!( - try_read_root_mem_value(&process.into(), NATIVE_ACCOUNT_DATA_PTR + ACCOUNT_DATA_LENGTH as u32 * 2), + try_read_root_mem_value( + &process.into(), + NATIVE_ACCOUNT_DATA_PTR + ACCOUNT_DATA_LENGTH as u32 * 2 + ), None, "Memory starting from 6144 should stay uninitialized" ); @@ -1113,17 +1131,26 @@ fn foreign_account_data_memory_assertions(foreign_account: &Account, process: &P ); assert_eq!( - read_root_mem_value(&process.into(), foreign_account_data_ptr + ACCT_STORAGE_COMMITMENT_OFFSET), + read_root_mem_value( + &process.into(), + foreign_account_data_ptr + ACCT_STORAGE_COMMITMENT_OFFSET + ), Word::from(foreign_account.storage().commitment()), ); assert_eq!( - read_root_mem_value(&process.into(), foreign_account_data_ptr + ACCT_CODE_COMMITMENT_OFFSET), + read_root_mem_value( + &process.into(), + foreign_account_data_ptr + ACCT_CODE_COMMITMENT_OFFSET + ), foreign_account.code().commitment().as_elements(), ); assert_eq!( - read_root_mem_value(&process.into(), foreign_account_data_ptr + NUM_ACCT_STORAGE_SLOTS_OFFSET), + read_root_mem_value( + &process.into(), + foreign_account_data_ptr + NUM_ACCT_STORAGE_SLOTS_OFFSET + ), [ u16::try_from(foreign_account.storage().slots().len()).unwrap().into(), ZERO, diff --git a/objects/src/lib.rs b/objects/src/lib.rs index 1960badea..56e9b2152 100644 --- a/objects/src/lib.rs +++ b/objects/src/lib.rs @@ -190,6 +190,6 @@ pub mod utils { pub mod vm { pub use miden_verifier::ExecutionProof; - pub use vm_core::{Program, ProgramInfo, AdviceMap}; + pub use vm_core::{AdviceMap, Program, ProgramInfo}; pub use vm_processor::{AdviceInputs, RowIndex, StackInputs, StackOutputs}; } diff --git a/objects/src/transaction/tx_args.rs b/objects/src/transaction/tx_args.rs index 698a44e8a..8b0d3baed 100644 --- a/objects/src/transaction/tx_args.rs +++ b/objects/src/transaction/tx_args.rs @@ -6,7 +6,7 @@ use miden_crypto::merkle::InnerNodeInfo; use vm_core::{ mast::{MastForest, MastNodeId}, utils::{ByteReader, ByteWriter, Deserializable, Serializable}, - Program, AdviceMap + AdviceMap, Program, }; use vm_processor::{AdviceInputs, DeserializationError}; @@ -273,7 +273,10 @@ impl Deserializable for TransactionScript { #[cfg(test)] mod tests { - use vm_core::{utils::{Deserializable, Serializable}, AdviceMap}; + use vm_core::{ + utils::{Deserializable, Serializable}, + AdviceMap, + }; use crate::transaction::TransactionArgs;