From 84c86b7f97593220ea11140a82edb2c65b247711 Mon Sep 17 00:00:00 2001 From: tomasarrachea Date: Mon, 22 Dec 2025 18:50:19 -0300 Subject: [PATCH 01/19] feat: add mint-script crate --- Cargo.lock | 198 +++++++++++++++++++++++++ Cargo.toml | 2 +- crates/faucet/asm/tx_scripts/mint.masm | 76 ---------- crates/faucet/src/lib.rs | 22 +-- crates/mint-script/.gitignore | 1 + crates/mint-script/Cargo.toml | 20 +++ crates/mint-script/README.md | 9 ++ crates/mint-script/rust-toolchain.toml | 5 + crates/mint-script/src/lib.rs | 31 ++++ crates/mint-script/wit/.gitkeep | 0 10 files changed, 271 insertions(+), 93 deletions(-) delete mode 100644 crates/faucet/asm/tx_scripts/mint.masm create mode 100644 crates/mint-script/.gitignore create mode 100644 crates/mint-script/Cargo.toml create mode 100644 crates/mint-script/README.md create mode 100644 crates/mint-script/rust-toolchain.toml create mode 100644 crates/mint-script/src/lib.rs create mode 100644 crates/mint-script/wit/.gitkeep diff --git a/Cargo.lock b/Cargo.lock index 0a34a032..5dc75f3b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1570,6 +1570,12 @@ version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a1e52775179941363cc594e49ce99284d13d6948928d8e72c755f55e98caa1eb" +[[package]] +name = "id-arena" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25a2bc672d1148e28034f176e01fffebb08b35768468cc954630da77a1449005" + [[package]] name = "idna" version = "1.1.0" @@ -1605,6 +1611,8 @@ checksum = "0ad4bb2b565bca0645f4d68c5c9af97fba094e9791da685bf83cb5f3ce74acf2" dependencies = [ "equivalent", "hashbrown 0.16.1", + "serde", + "serde_core", ] [[package]] @@ -1768,6 +1776,12 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" +[[package]] +name = "leb128fmt" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09edd9e8b54e49e587e4f6295a7d29c3ea94d469cb40ab8ca70b288248a81db2" + [[package]] name = "libc" version = "0.2.178" @@ -1931,6 +1945,19 @@ version = "2.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f52b00d39961fc5b2736ea853c9cc86238e165017a493d1d5c8eac6bdc4cc273" +[[package]] +name = "miden" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a06aa85af0fa2be870520767ebecb3264b86e2048dd07d29cffb181a5e33af0" +dependencies = [ + "miden-base", + "miden-base-sys", + "miden-sdk-alloc", + "miden-stdlib-sys", + "wit-bindgen", +] + [[package]] name = "miden-air" version = "0.19.1" @@ -1980,6 +2007,41 @@ dependencies = [ "thiserror 2.0.17", ] +[[package]] +name = "miden-base" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf7fddd7fc5dc709e41da7d82fac8647e515ff84466451ce939a242c3e5c8052" +dependencies = [ + "miden-base-macros", + "miden-base-sys", + "miden-stdlib-sys", +] + +[[package]] +name = "miden-base-macros" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "039da08835f1f6662fda82ee50a7681cf618a3a6ef054b6fa439dec35a47be9b" +dependencies = [ + "heck", + "miden-objects", + "proc-macro2", + "quote", + "semver 1.0.27", + "syn", + "toml 0.8.23", +] + +[[package]] +name = "miden-base-sys" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b44fb31dad5fc047dea13c31e1e9c041c246e75e28151a08559bfdb7230c9c54" +dependencies = [ + "miden-stdlib-sys", +] + [[package]] name = "miden-block-prover" version = "0.12.4" @@ -2438,6 +2500,12 @@ dependencies = [ "tonic-web-wasm-client", ] +[[package]] +name = "miden-sdk-alloc" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0a364146445b0684cd2df7833324504c9b0f5256ecc39329762c3b17fcf64b65" + [[package]] name = "miden-stdlib" version = "0.19.1" @@ -2454,6 +2522,12 @@ dependencies = [ "thiserror 2.0.17", ] +[[package]] +name = "miden-stdlib-sys" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4df7e413d1c837b8a9f85ecb33a5dc1655fbf56c4da384ceb9983751eba786ac" + [[package]] name = "miden-testing" version = "0.12.4" @@ -2602,6 +2676,13 @@ dependencies = [ "adler2", ] +[[package]] +name = "mint-script" +version = "0.13.0" +dependencies = [ + "miden", +] + [[package]] name = "mio" version = "1.1.1" @@ -4271,6 +4352,7 @@ version = "0.8.23" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dc1beb996b9d83529a9e75c17a1686767d148d70663143c7854d8b4a09ced362" dependencies = [ + "indexmap", "serde", "serde_spanned 0.6.9", "toml_datetime 0.6.11", @@ -4866,6 +4948,28 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "wasm-encoder" +version = "0.239.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5be00faa2b4950c76fe618c409d2c3ea5a3c9422013e079482d78544bb2d184c" +dependencies = [ + "leb128fmt", + "wasmparser", +] + +[[package]] +name = "wasm-metadata" +version = "0.239.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20b3ec880a9ac69ccd92fbdbcf46ee833071cf09f82bb005b2327c7ae6025ae2" +dependencies = [ + "anyhow", + "indexmap", + "wasm-encoder", + "wasmparser", +] + [[package]] name = "wasm-streams" version = "0.4.2" @@ -4879,6 +4983,18 @@ dependencies = [ "web-sys", ] +[[package]] +name = "wasmparser" +version = "0.239.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c9d90bb93e764f6beabf1d02028c70a2156a6583e63ac4218dd07ef733368b0" +dependencies = [ + "bitflags", + "hashbrown 0.15.5", + "indexmap", + "semver 1.0.27", +] + [[package]] name = "web-sys" version = "0.3.83" @@ -5434,6 +5550,88 @@ name = "wit-bindgen" version = "0.46.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f17a85883d4e6d00e8a97c586de764dabcc06133f7f1d55dce5cdc070ad7fe59" +dependencies = [ + "wit-bindgen-rust-macro", +] + +[[package]] +name = "wit-bindgen-core" +version = "0.46.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cabd629f94da277abc739c71353397046401518efb2c707669f805205f0b9890" +dependencies = [ + "anyhow", + "heck", + "wit-parser", +] + +[[package]] +name = "wit-bindgen-rust" +version = "0.46.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a4232e841089fa5f3c4fc732a92e1c74e1a3958db3b12f1de5934da2027f1f4" +dependencies = [ + "anyhow", + "heck", + "indexmap", + "prettyplease", + "syn", + "wasm-metadata", + "wit-bindgen-core", + "wit-component", +] + +[[package]] +name = "wit-bindgen-rust-macro" +version = "0.46.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e0d4698c2913d8d9c2b220d116409c3f51a7aa8d7765151b886918367179ee9" +dependencies = [ + "anyhow", + "prettyplease", + "proc-macro2", + "quote", + "syn", + "wit-bindgen-core", + "wit-bindgen-rust", +] + +[[package]] +name = "wit-component" +version = "0.239.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88a866b19dba2c94d706ec58c92a4c62ab63e482b4c935d2a085ac94caecb136" +dependencies = [ + "anyhow", + "bitflags", + "indexmap", + "log", + "serde", + "serde_derive", + "serde_json", + "wasm-encoder", + "wasm-metadata", + "wasmparser", + "wit-parser", +] + +[[package]] +name = "wit-parser" +version = "0.239.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55c92c939d667b7bf0c6bf2d1f67196529758f99a2a45a3355cc56964fd5315d" +dependencies = [ + "anyhow", + "id-arena", + "indexmap", + "log", + "semver 1.0.27", + "serde", + "serde_derive", + "serde_json", + "unicode-xid", + "wasmparser", +] [[package]] name = "writeable" diff --git a/Cargo.toml b/Cargo.toml index b742f573..f4663b47 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,5 @@ [workspace] -members = ["bin/faucet", "crates/faucet"] +members = ["bin/faucet", "crates/faucet", "crates/mint-script"] resolver = "2" diff --git a/crates/faucet/asm/tx_scripts/mint.masm b/crates/faucet/asm/tx_scripts/mint.masm deleted file mode 100644 index 4460f45c..00000000 --- a/crates/faucet/asm/tx_scripts/mint.masm +++ /dev/null @@ -1,76 +0,0 @@ -const.AUX=0 -const.EXECUTION_HINT=1 -const.EXPIRATION_DELTA=10 - -#! Returns a boolean indicating if the notes counter `i` has reached `n` -#! -#! Inputs: [i, n] -#! Outputs: [i != n, i, n] -proc.check_continue_neq - # [i, n] - dup.1 - dup.1 - neq - # [i != n , i, n] -end - -#! Distributes freshly minted fungible assets to the `n` provided recipients. -#! -#! Inputs: -#! Operand stack: [COMMITMENT] -#! Advice map: { -#! COMMITMENT: [n, RECIPIENT_1, note_type_1, tag_1, amount_1, RECIPIENT_2, note_type_2, tag_2, amount_2, ...] -#! } -#! Outputs: -#! Operant stack: [] -#! -#! Where: -#! - n is the amount of recipients to receive assets -#! - amount is the amount to be minted and sent. -#! - tag is the tag to be included in the note. -#! - note_type is the type of the note that holds the asset. -#! - RECIPIENT is the recipient of the asset, i.e., -#! hash(hash(hash(serial_num, [0; 4]), script_root), input_commitment). -begin - # Set the transaction expiration delta (10 blocks) - push.EXPIRATION_DELTA - exec.::miden::tx::update_expiration_block_delta - # OS => [] - - adv.push_mapval dropw - # OS => [] - # AS => [n, RECIPIENT_1, note_type_1, tag_1, amount_1, ...] - - adv_push.1 push.0 - # OS => [0, n] - # AS => [RECIPIENT_1, note_type_1, tag_1, amount_1, ...] - - exec.check_continue_neq - # OS => [0, 0, n] - - while.true - # OS => [i, n] - # AS => [RECIPIENT_i, note_type_i, tag_i, amount_i, ...] - - # set the params for the distribute call by getting values from the advice stack - push.0.0.0.0.0.0.0 adv_push.4 push.EXECUTION_HINT adv_push.1 push.AUX adv_push.2 - # OS => [amount_i, tag_i, 0, note_type_i, 1, RECIPIENT_i, pad(7), i, n] - # AS => [...] - - call.::miden::contracts::faucets::basic_fungible::distribute - # OS => [note_idx, pad(15), i, n] - - dropw dropw dropw dropw - # OS => [i, n] - - add.1 - # OS => [i + 1, n] - - exec.check_continue_neq - # OS => [i + 1 != n, i + 1, n] - end - # OS => [n, n] - - drop drop - # OS => [] -end diff --git a/crates/faucet/src/lib.rs b/crates/faucet/src/lib.rs index 40867f71..b5ddb8c2 100644 --- a/crates/faucet/src/lib.rs +++ b/crates/faucet/src/lib.rs @@ -16,13 +16,8 @@ use miden_client::rpc::{Endpoint, GrpcClient}; use miden_client::store::{NoteFilter, TransactionFilter}; use miden_client::sync::{StateSync, SyncSummary}; use miden_client::transaction::{ - LocalTransactionProver, - TransactionId, - TransactionProver, - TransactionRequest, - TransactionRequestBuilder, - TransactionRequestError, - TransactionScript, + LocalTransactionProver, TransactionId, TransactionProver, TransactionRequest, + TransactionRequestBuilder, TransactionRequestError, TransactionScript, }; use miden_client::utils::{Deserializable, RwLock}; use miden_client::{Client, ClientError, Felt, RemoteTransactionProver, Word}; @@ -43,7 +38,6 @@ use crate::types::AssetAmount; const COMPONENT: &str = "miden-faucet-client"; -const TX_SCRIPT: &[u8] = include_bytes!(concat!(env!("OUT_DIR"), "/assets/tx_scripts/mint.txs")); const KEYSTORE_PATH: &str = "keystore"; const DEFAULT_ACCOUNT_ID_SETTING: &str = "faucet_default_account_id"; @@ -390,16 +384,12 @@ impl Faucet { ) -> Result { // Build the transaction let expected_output_recipients = notes.iter().map(Note::recipient).cloned().collect(); - let n = notes.len() as u64; - let mut note_data = vec![Felt::new(n)]; + let mut note_data = vec![]; for note in notes { // SAFETY: these are p2id notes with only one fungible asset - let amount = note.assets().iter().next().unwrap().unwrap_fungible().amount(); - - note_data.extend(note.recipient().digest().iter()); - note_data.push(Felt::from(note.metadata().note_type())); - note_data.push(Felt::from(note.metadata().tag())); - note_data.push(Felt::new(amount)); + let asset = note.assets().iter().next().unwrap(); + let word: Word = asset.into(); + note_data.extend(word.as_slice()); } let note_data_commitment = Rpo256::hash_elements(¬e_data); let advice_map = [(note_data_commitment, note_data)]; diff --git a/crates/mint-script/.gitignore b/crates/mint-script/.gitignore new file mode 100644 index 00000000..2f7896d1 --- /dev/null +++ b/crates/mint-script/.gitignore @@ -0,0 +1 @@ +target/ diff --git a/crates/mint-script/Cargo.toml b/crates/mint-script/Cargo.toml new file mode 100644 index 00000000..67e13f99 --- /dev/null +++ b/crates/mint-script/Cargo.toml @@ -0,0 +1,20 @@ +[package] +name = "mint-script" +version.workspace = true +edition.workspace = true + +[lib] +# Build this crate as a self-contained, C-style dynamic library +# This is required to emit the proper Wasm module type +crate-type = ["cdylib"] + +[dependencies] +# Miden SDK consists of a stdlib (intrinsic functions for VM ops, stdlib functions and types) +# and transaction kernel API for the Miden rollup +miden = { version = "0.7" } + +[package.metadata.component] +package = "miden:mint-script" + +[package.metadata.miden] +project-kind = "transaction-script" diff --git a/crates/mint-script/README.md b/crates/mint-script/README.md new file mode 100644 index 00000000..2a3ed810 --- /dev/null +++ b/crates/mint-script/README.md @@ -0,0 +1,9 @@ +# project + +A Miden transaction script project. + +## Build + +```bash +cargo miden build --release +``` diff --git a/crates/mint-script/rust-toolchain.toml b/crates/mint-script/rust-toolchain.toml new file mode 100644 index 00000000..c003bcdc --- /dev/null +++ b/crates/mint-script/rust-toolchain.toml @@ -0,0 +1,5 @@ +[toolchain] +channel = "nightly-2025-07-20" +components = ["rustfmt", "rust-src", "llvm-tools"] +targets = [ "wasm32-wasip2" ] +profile = "minimal" diff --git a/crates/mint-script/src/lib.rs b/crates/mint-script/src/lib.rs new file mode 100644 index 00000000..464a36e9 --- /dev/null +++ b/crates/mint-script/src/lib.rs @@ -0,0 +1,31 @@ +#![no_std] + +extern crate alloc; + +use miden::faucet::mint; +use miden::intrinsics::advice::adv_push_mapvaln; +use miden::tx::update_expiration_block_delta; +use miden::*; + +const ASSET_WORD_SIZE: usize = 4; + +#[tx_script] +fn run(arg: Word) { + update_expiration_block_delta(Felt::from_u32(10)); + + let num_felts = adv_push_mapvaln(arg.clone()); + let num_felts_u64 = num_felts.as_u64(); + assert_eq(Felt::from_u32((num_felts_u64 % 4) as u32), felt!(0)); + + let num_words = Felt::from_u64_unchecked(num_felts_u64 / 4); + let commitment = arg; + let input = adv_load_preimage(num_words, commitment); + + let num_words_usize = num_words.as_u64() as usize; + for idx in 0..num_words_usize { + let start = idx * ASSET_WORD_SIZE; + let end = start + ASSET_WORD_SIZE; + let asset: [Felt; ASSET_WORD_SIZE] = input[start..end].try_into().unwrap(); + mint(Asset::new(asset)); + } +} diff --git a/crates/mint-script/wit/.gitkeep b/crates/mint-script/wit/.gitkeep new file mode 100644 index 00000000..e69de29b From a57f6a3cacec23b0d1885f38d3cce5fce2682837 Mon Sep 17 00:00:00 2001 From: tomasarrachea Date: Mon, 22 Dec 2025 19:42:28 -0300 Subject: [PATCH 02/19] feat: read compiled package --- Cargo.lock | 14 ++--- Cargo.toml | 3 +- crates/faucet/build.rs | 109 ++++++++-------------------------- crates/faucet/src/lib.rs | 8 ++- crates/mint-script/Cargo.toml | 8 ++- 5 files changed, 47 insertions(+), 95 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 5dc75f3b..d9b38838 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2244,6 +2244,13 @@ dependencies = [ "uuid", ] +[[package]] +name = "miden-faucet-mint-script" +version = "0.13.0" +dependencies = [ + "miden", +] + [[package]] name = "miden-formatting" version = "0.1.1" @@ -2676,13 +2683,6 @@ dependencies = [ "adler2", ] -[[package]] -name = "mint-script" -version = "0.13.0" -dependencies = [ - "miden", -] - [[package]] name = "mio" version = "1.1.1" diff --git a/Cargo.toml b/Cargo.toml index f4663b47..a8f3aae4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,5 @@ [workspace] -members = ["bin/faucet", "crates/faucet", "crates/mint-script"] +members = ["bin/faucet", "crates/faucet", "crates/pow", "crates/mint-script"] resolver = "2" @@ -21,6 +21,7 @@ opt-level = 2 [workspace.dependencies] miden-faucet-lib = { path = "crates/faucet", version = "0.13" } miden-pow-rate-limiter = { path = "crates/pow", version = "0.13" } +miden-faucet-mint-script = { path = "crates/mint-script", version = "0.13" } # Miden dependencies. miden-client = { version = "0.12" } diff --git a/crates/faucet/build.rs b/crates/faucet/build.rs index c95b7bcd..f19e17b5 100644 --- a/crates/faucet/build.rs +++ b/crates/faucet/build.rs @@ -1,92 +1,33 @@ -use std::env; -use std::fs::{self}; -use std::io::{self}; -use std::path::{Path, PathBuf}; +use std::{env, fs, path::Path}; -use miden_client::transaction::{TransactionKernel, TransactionScript}; +use miden_client::Deserializable; use miden_client::utils::Serializable; +use miden_client::vm::Package; -const ASSETS_DIR: &str = "assets"; -const ASM_DIR: &str = "asm"; -const ASM_TX_SCRIPTS_DIR: &str = "tx_scripts"; - -/// Compile contents of asm directory into .txs files. fn main() { - // re-build when the MASM code changes - println!("cargo::rerun-if-changed={ASM_DIR}/"); - - let crate_dir = env::var("CARGO_MANIFEST_DIR").unwrap(); - let source_dir = Path::new(&crate_dir).join(ASM_DIR); - - let build_dir = env::var("OUT_DIR").unwrap(); - let target_dir = Path::new(&build_dir).join(ASSETS_DIR); - - compile_transaction_scripts( - &source_dir.join(ASM_TX_SCRIPTS_DIR), - &target_dir.join(ASM_TX_SCRIPTS_DIR), - ); -} - -/// Reads all MASM files from the `source_dir`, compiles each file individually into a TXS -/// file, and stores the compiled files into the `target_dir`. -/// -/// The source files are expected to contain executable programs. -fn compile_transaction_scripts(source_dir: &Path, target_dir: &Path) { - fs::create_dir_all(target_dir).expect("should create target directory"); - let assembler = TransactionKernel::assembler(); - - let masm_files = get_masm_files(source_dir).expect("should find MASM files"); - for masm_file_path in masm_files { - // read the MASM file, parse it, and serialize the parsed AST to bytes - let code = assembler - .clone() - .assemble_program(masm_file_path.clone()) - .expect("program should assemble correctly"); - let script = TransactionScript::new(code); + // TODO: run cargo miden build --release and specify target directory as OUT_DIR + let workspace_root = env::var("CARGO_MANIFEST_DIR") + .map(|d| Path::new(&d).parent().unwrap().parent().unwrap().to_path_buf()) + .unwrap(); - let bytes = script.to_bytes(); + // Rebuild when mint-script source changes + println!("cargo:rerun-if-changed=../mint-script/src/lib.rs"); - let masm_file_name = masm_file_path.file_name().expect("file name should exist"); - let mut txs_file_path = target_dir.join(masm_file_name); + // Look for compiled .masp file from mint-script + let masp_path = workspace_root + .join("target") + .join("miden") + .join("release") + .join("mint_script.masp"); - // write the binary TXS to the output dir - txs_file_path.set_extension("txs"); - fs::write(txs_file_path, bytes).expect("should write .txs file"); - } -} - -// HELPER FUNCTIONS -// ================================================================================================ - -/// Returns a vector with paths to all MASM files in the specified directory. -/// -/// All non-MASM files are skipped. -fn get_masm_files(dir_path: &Path) -> io::Result> { - let mut files = Vec::new(); - - let entries = fs::read_dir(dir_path)?; - for entry in entries { - let file_path = entry?.path(); - if is_masm_file(&file_path)? { - files.push(file_path); - } - } - - Ok(files) -} - -/// Returns true if the provided path resolves to a file with `.masm` extension. -/// -/// # Errors -/// Returns an error if the path could not be converted to a UTF-8 string. -fn is_masm_file(path: &Path) -> io::Result { - if let Some(extension) = path.extension() { - let extension = extension - .to_str() - .ok_or_else(|| io::Error::other("invalid UTF-8 filename"))? - .to_lowercase(); - Ok(extension == "masm") - } else { - Ok(false) - } + let build_dir = env::var("OUT_DIR").unwrap(); + let target_dir = Path::new(&build_dir); + fs::create_dir_all(&target_dir).expect("should create target directory"); + + // Compile .masp to .txs + let masp = fs::read(masp_path).expect("failed to read mint_script.masp"); + let package = + Package::read_from_bytes(&masp).expect("failed to read mint_script.masp as package"); + let txs_path = target_dir.join("mint.txs"); + fs::write(txs_path, package.to_bytes()).expect("failed to write mint.txs"); } diff --git a/crates/faucet/src/lib.rs b/crates/faucet/src/lib.rs index b5ddb8c2..b23d80b3 100644 --- a/crates/faucet/src/lib.rs +++ b/crates/faucet/src/lib.rs @@ -20,6 +20,7 @@ use miden_client::transaction::{ TransactionRequestBuilder, TransactionRequestError, TransactionScript, }; use miden_client::utils::{Deserializable, RwLock}; +use miden_client::vm::Package; use miden_client::{Client, ClientError, Felt, RemoteTransactionProver, Word}; use miden_client_sqlite_store::SqliteStore; use rand::rngs::StdRng; @@ -40,6 +41,7 @@ const COMPONENT: &str = "miden-faucet-client"; const KEYSTORE_PATH: &str = "keystore"; const DEFAULT_ACCOUNT_ID_SETTING: &str = "faucet_default_account_id"; +const TX_PACKAGE: &[u8] = include_bytes!(concat!(env!("OUT_DIR"), "/mint.txs")); // FAUCET CLIENT // ================================================================================================ @@ -181,7 +183,9 @@ impl Faucet { let issuance = Arc::new(RwLock::new(AssetAmount::new(account.get_token_issuance()?.as_int())?)); - let script = TransactionScript::read_from_bytes(TX_SCRIPT)?; + let package = Package::read_from_bytes(TX_PACKAGE)?.unwrap_program(); + let script = + TransactionScript::from_parts(package.mast_forest().clone(), package.entrypoint()); let note_screener = NoteScreener::new(Arc::new(SqliteStore::new(config.store_path.clone()).await?)); @@ -627,7 +631,7 @@ mod tests { tx_prover: Arc::new(LocalTransactionProver::default()), issuance: Arc::new(RwLock::new(AssetAmount::new(0).unwrap())), max_supply: AssetAmount::new(1_000_000_000_000).unwrap(), - script: TransactionScript::read_from_bytes(TX_SCRIPT).unwrap(), + script: TransactionScript::read_from_bytes(TX_PACKAGE).unwrap(), }; faucet.run(rx_mint_requests, batch_size).await.unwrap(); }); diff --git a/crates/mint-script/Cargo.toml b/crates/mint-script/Cargo.toml index 67e13f99..3baf2a01 100644 --- a/crates/mint-script/Cargo.toml +++ b/crates/mint-script/Cargo.toml @@ -1,8 +1,14 @@ [package] -name = "mint-script" +name = "miden-faucet-mint-script" version.workspace = true edition.workspace = true +[profile.dev] +panic = "abort" + +[profile.release] +panic = "abort" + [lib] # Build this crate as a self-contained, C-style dynamic library # This is required to emit the proper Wasm module type From 6fa0b6fe4cf0344bda3154fa335a79387dc1c2ee Mon Sep 17 00:00:00 2001 From: tomasarrachea Date: Mon, 22 Dec 2025 19:52:54 -0300 Subject: [PATCH 03/19] feat: parse transaction script at build time --- crates/faucet/build.rs | 11 +++++++---- crates/faucet/src/lib.rs | 5 +---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/crates/faucet/build.rs b/crates/faucet/build.rs index f19e17b5..9d4df384 100644 --- a/crates/faucet/build.rs +++ b/crates/faucet/build.rs @@ -1,11 +1,13 @@ use std::{env, fs, path::Path}; use miden_client::Deserializable; +use miden_client::transaction::TransactionScript; use miden_client::utils::Serializable; use miden_client::vm::Package; fn main() { // TODO: run cargo miden build --release and specify target directory as OUT_DIR + // TODO: check workspace settings for the mint-script crate let workspace_root = env::var("CARGO_MANIFEST_DIR") .map(|d| Path::new(&d).parent().unwrap().parent().unwrap().to_path_buf()) .unwrap(); @@ -23,11 +25,12 @@ fn main() { let build_dir = env::var("OUT_DIR").unwrap(); let target_dir = Path::new(&build_dir); fs::create_dir_all(&target_dir).expect("should create target directory"); + let txs_path = target_dir.join("mint.txs"); - // Compile .masp to .txs let masp = fs::read(masp_path).expect("failed to read mint_script.masp"); let package = - Package::read_from_bytes(&masp).expect("failed to read mint_script.masp as package"); - let txs_path = target_dir.join("mint.txs"); - fs::write(txs_path, package.to_bytes()).expect("failed to write mint.txs"); + Package::read_from_bytes(&masp).expect("failed to parse mint_script.masp as package"); + let program = package.unwrap_program(); + let script = TransactionScript::from_parts(program.mast_forest().clone(), program.entrypoint()); + fs::write(txs_path, script.to_bytes()).expect("failed to write mint.txs"); } diff --git a/crates/faucet/src/lib.rs b/crates/faucet/src/lib.rs index b23d80b3..9176322b 100644 --- a/crates/faucet/src/lib.rs +++ b/crates/faucet/src/lib.rs @@ -20,7 +20,6 @@ use miden_client::transaction::{ TransactionRequestBuilder, TransactionRequestError, TransactionScript, }; use miden_client::utils::{Deserializable, RwLock}; -use miden_client::vm::Package; use miden_client::{Client, ClientError, Felt, RemoteTransactionProver, Word}; use miden_client_sqlite_store::SqliteStore; use rand::rngs::StdRng; @@ -183,9 +182,7 @@ impl Faucet { let issuance = Arc::new(RwLock::new(AssetAmount::new(account.get_token_issuance()?.as_int())?)); - let package = Package::read_from_bytes(TX_PACKAGE)?.unwrap_program(); - let script = - TransactionScript::from_parts(package.mast_forest().clone(), package.entrypoint()); + let script = TransactionScript::read_from_bytes(TX_PACKAGE)?; let note_screener = NoteScreener::new(Arc::new(SqliteStore::new(config.store_path.clone()).await?)); From e7389f82fe89330cf5d57404c1eb852d07a9c2c6 Mon Sep 17 00:00:00 2001 From: tomasarrachea Date: Tue, 23 Dec 2025 12:31:15 -0300 Subject: [PATCH 04/19] feat: use cargo miden --- Cargo.lock | 949 +++++++++++++++++- Cargo.toml | 4 +- Makefile | 3 +- bin/faucet/src/main.rs | 6 +- crates/faucet/Cargo.toml | 3 - crates/faucet/build.rs | 36 - crates/faucet/src/lib.rs | 14 +- crates/{mint-script => mint-tx}/.gitignore | 0 crates/{mint-script => mint-tx}/Cargo.toml | 13 +- crates/{mint-script => mint-tx}/README.md | 2 +- .../rust-toolchain.toml | 0 crates/{mint-script => mint-tx}/src/lib.rs | 12 +- crates/{mint-script => mint-tx}/wit/.gitkeep | 0 13 files changed, 936 insertions(+), 106 deletions(-) delete mode 100644 crates/faucet/build.rs rename crates/{mint-script => mint-tx}/.gitignore (100%) rename crates/{mint-script => mint-tx}/Cargo.toml (79%) rename crates/{mint-script => mint-tx}/README.md (89%) rename crates/{mint-script => mint-tx}/rust-toolchain.toml (100%) rename crates/{mint-script => mint-tx}/src/lib.rs (66%) rename crates/{mint-script => mint-tx}/wit/.gitkeep (100%) diff --git a/Cargo.lock b/Cargo.lock index d9b38838..12878ee0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -12,13 +12,29 @@ dependencies = [ "regex", ] +[[package]] +name = "addr2line" +version = "0.24.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfbe277e56a376000877090da837660b4427aad530e3028d44e0bffe4f89a1c1" +dependencies = [ + "cpp_demangle", + "fallible-iterator", + "gimli 0.31.1", + "memmap2", + "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", + "gimli 0.32.3", ] [[package]] @@ -37,6 +53,18 @@ dependencies = [ "generic-array", ] +[[package]] +name = "ahash" +version = "0.8.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a15f179cd60c4584b8a8c596927aadc462e27f2ca70c04e0071964a73ba7a75" +dependencies = [ + "cfg-if", + "once_cell", + "version_check", + "zerocopy", +] + [[package]] name = "aho-corasick" version = "1.1.4" @@ -120,6 +148,12 @@ dependencies = [ "backtrace", ] +[[package]] +name = "anymap2" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d301b3b94cb4b2f23d7917810addbbaff90738e0ca2be692bd027e70d7e0330c" + [[package]] name = "arrayref" version = "0.3.9" @@ -253,11 +287,11 @@ version = "0.3.76" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bb531853791a215d7c62a30daf0dde835f381ab5de4589cfe7c649d2cbe92bd6" dependencies = [ - "addr2line", + "addr2line 0.25.1", "cfg-if", "libc", "miniz_oxide", - "object", + "object 0.37.3", "rustc-demangle", "windows-link 0.2.1", ] @@ -322,6 +356,18 @@ version = "2.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "812e12b5285cc515a9c72a5c1d3b6d46a19dac5acfef5265968c166106e31dd3" +[[package]] +name = "bitvec" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bc2832c24239b0141d5674bb9174f9d68a8b5b3f2753311927c172ca46f7e9c" +dependencies = [ + "funty", + "radium", + "tap", + "wyz", +] + [[package]] name = "blake3" version = "1.8.2" @@ -335,6 +381,15 @@ dependencies = [ "constant_time_eq", ] +[[package]] +name = "blink-alloc" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e669f146bb8b2327006ed94c69cf78c8ec81c100192564654230a40b4f091d82" +dependencies = [ + "allocator-api2", +] + [[package]] name = "block-buffer" version = "0.10.4" @@ -368,6 +423,71 @@ version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b35204fbdc0b3f4446b89fc1ac2cf84a8a68971995d0bf2e925ec7cd960f9cb3" +[[package]] +name = "camino" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e629a66d692cb9ff1a1c664e41771b3dcaf961985a9774c0eb0bd1b51cf60a48" +dependencies = [ + "serde_core", +] + +[[package]] +name = "cargo-miden" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d219f8b56b439da0a398db64a25c3a1e62aefed23dd750d8fa9d34f5b4684035" +dependencies = [ + "anyhow", + "cargo_metadata", + "clap", + "env_logger", + "liquid", + "log", + "midenc-compile", + "midenc-session", + "parse_arg 0.1.6", + "path-absolutize", + "semver 1.0.27", + "serde", + "serde_json", + "tempfile", + "toml_edit 0.23.9", + "walkdir", +] + +[[package]] +name = "cargo-platform" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e35af189006b9c0f00a064685c727031e3ed2d8020f7ba284d78cc2671bd36ea" +dependencies = [ + "serde", +] + +[[package]] +name = "cargo_metadata" +version = "0.19.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd5eb614ed4c27c5d706420e4320fbe3216ab31fa1c33cd8246ac36dae4479ba" +dependencies = [ + "camino", + "cargo-platform", + "semver 1.0.27", + "serde", + "serde_json", + "thiserror 2.0.17", +] + +[[package]] +name = "castaway" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dec551ab6e7578819132c713a93c022a05d60159dc86e7a7050223577484c55a" +dependencies = [ + "rustversion", +] + [[package]] name = "cc" version = "1.2.48" @@ -480,6 +600,20 @@ version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75" +[[package]] +name = "compact_str" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3fdb1325a1cece981e8a296ab8f0f9b63ae357bd0784a9faaf548cc7b480707a" +dependencies = [ + "castaway", + "cfg-if", + "itoa", + "rustversion", + "ryu", + "static_assertions", +] + [[package]] name = "const-oid" version = "0.9.6" @@ -548,6 +682,15 @@ dependencies = [ "libm", ] +[[package]] +name = "cpp_demangle" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2bb79cb74d735044c972aae58ed0aaa9a837e85b01106a54c39e42e97f62253" +dependencies = [ + "cfg-if", +] + [[package]] name = "cpufeatures" version = "0.2.17" @@ -557,6 +700,30 @@ dependencies = [ "libc", ] +[[package]] +name = "cranelift-bitset" +version = "0.120.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db7b2ee9eec6ca8a716d900d5264d678fb2c290c58c46c8da7f94ee268175d17" + +[[package]] +name = "cranelift-entity" +version = "0.120.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d75418674520cb400c8772bfd6e11a62736c78fc1b6e418195696841d1bf91f1" +dependencies = [ + "cranelift-bitset", +] + +[[package]] +name = "crc32fast" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9481c1c90cbf2ac953f07c8d4a58aa3945c425b7185c9154d67a65e4230da511" +dependencies = [ + "cfg-if", +] + [[package]] name = "crossbeam-deque" version = "0.8.6" @@ -632,6 +799,41 @@ dependencies = [ "syn", ] +[[package]] +name = "darling" +version = "0.20.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc7f46116c46ff9ab3eb1597a45688b6715c6e628b5c133e288e709a29bcb4ee" +dependencies = [ + "darling_core", + "darling_macro", +] + +[[package]] +name = "darling_core" +version = "0.20.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d00b9596d185e565c2207a0b01f8bd1a135483d02d9b7b0a54b11da8d53412e" +dependencies = [ + "fnv", + "ident_case", + "proc-macro2", + "quote", + "strsim", + "syn", +] + +[[package]] +name = "darling_macro" +version = "0.20.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc34b93ccb385b40dc71c6fceac4b2ad23662c7eeb248cf10d529b7e055b6ead" +dependencies = [ + "darling_core", + "quote", + "syn", +] + [[package]] name = "deadpool" version = "0.12.3" @@ -939,6 +1141,16 @@ version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1d674e81391d1e1ab681a28d99df07927c6d4aa5b027d7da16ba32d1d21ecd99" +[[package]] +name = "flate2" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfe33edd8e85a12a67454e37f8c75e730830d83e313556ab9ebf9ee7fbeb3bfb" +dependencies = [ + "crc32fast", + "miniz_oxide", +] + [[package]] name = "flume" version = "0.11.1" @@ -1002,6 +1214,12 @@ dependencies = [ "autocfg", ] +[[package]] +name = "funty" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" + [[package]] name = "futures" version = "0.3.31" @@ -1143,6 +1361,16 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "gimli" +version = "0.31.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f" +dependencies = [ + "fallible-iterator", + "stable_deref_trait", +] + [[package]] name = "gimli" version = "0.32.3" @@ -1185,12 +1413,24 @@ dependencies = [ "tracing", ] +[[package]] +name = "hashbrown" +version = "0.14.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" +dependencies = [ + "ahash", + "allocator-api2", +] + [[package]] name = "hashbrown" version = "0.15.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1" dependencies = [ + "allocator-api2", + "equivalent", "foldhash 0.1.5", ] @@ -1576,6 +1816,12 @@ version = "2.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "25a2bc672d1148e28034f176e01fffebb08b35768468cc954630da77a1449005" +[[package]] +name = "ident_case" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" + [[package]] name = "idna" version = "1.1.0" @@ -1630,6 +1876,24 @@ dependencies = [ "generic-array", ] +[[package]] +name = "intrusive-collections" +version = "0.9.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "189d0897e4cbe8c75efedf3502c18c887b05046e59d28404d4d8e46cbc4d1e86" +dependencies = [ + "memoffset", +] + +[[package]] +name = "inventory" +version = "0.3.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc61209c082fbeb19919bee74b176221b27223e27b65d781eb91af24eb1fb46e" +dependencies = [ + "rustversion", +] + [[package]] name = "ipnet" version = "2.11.0" @@ -1740,6 +2004,16 @@ dependencies = [ "cpufeatures", ] +[[package]] +name = "kstring" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "558bf9508a558512042d3095138b1f7b8fe90c5467d94f9f1da28b3731c5dbd1" +dependencies = [ + "serde", + "static_assertions", +] + [[package]] name = "lalrpop" version = "0.22.2" @@ -1751,7 +2025,7 @@ dependencies = [ "ena", "itertools", "lalrpop-util", - "petgraph", + "petgraph 0.7.1", "regex", "regex-syntax", "sha3", @@ -1817,6 +2091,60 @@ version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "df1d3c3b53da64cf5760482273a98e575c651a67eec7f77df96b5b642de8f039" +[[package]] +name = "liquid" +version = "0.26.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a494c3f9dad3cb7ed16f1c51812cbe4b29493d6c2e5cd1e2b87477263d9534d" +dependencies = [ + "liquid-core", + "liquid-derive", + "liquid-lib", + "serde", +] + +[[package]] +name = "liquid-core" +version = "0.26.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc623edee8a618b4543e8e8505584f4847a4e51b805db1af6d9af0a3395d0d57" +dependencies = [ + "anymap2", + "itertools", + "kstring", + "liquid-derive", + "pest", + "pest_derive", + "regex", + "serde", + "time", +] + +[[package]] +name = "liquid-derive" +version = "0.26.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de66c928222984aea59fcaed8ba627f388aaac3c1f57dcb05cc25495ef8faefe" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "liquid-lib" +version = "0.26.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9befeedd61f5995bc128c571db65300aeb50d62e4f0542c88282dbcb5f72372a" +dependencies = [ + "itertools", + "liquid-core", + "percent-encoding", + "regex", + "time", + "unicode-segmentation", +] + [[package]] name = "litemap" version = "0.7.5" @@ -1945,6 +2273,24 @@ version = "2.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f52b00d39961fc5b2736ea853c9cc86238e165017a493d1d5c8eac6bdc4cc273" +[[package]] +name = "memmap2" +version = "0.9.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "744133e4a0e0a658e1374cf3bf8e415c4052a15a111acd372764c55b4177d490" +dependencies = [ + "libc", +] + +[[package]] +name = "memoffset" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a" +dependencies = [ + "autocfg", +] + [[package]] name = "miden" version = "0.7.1" @@ -2245,9 +2591,10 @@ dependencies = [ ] [[package]] -name = "miden-faucet-mint-script" +name = "miden-faucet-mint-tx" version = "0.13.0" dependencies = [ + "cargo-miden", "miden", ] @@ -2555,6 +2902,26 @@ dependencies = [ "winterfell", ] +[[package]] +name = "miden-thiserror" +version = "1.0.59" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "183ff8de338956ecfde3a38573241eb7a6f3d44d73866c210e5629c07fa00253" +dependencies = [ + "miden-thiserror-impl", +] + +[[package]] +name = "miden-thiserror-impl" +version = "1.0.59" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ee4176a0f2e7d29d2a8ee7e60b6deb14ce67a20e94c3e2c7275cdb8804e1862" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "miden-tx" version = "0.12.4" @@ -2572,59 +2939,273 @@ dependencies = [ ] [[package]] -name = "miden-tx-batch-prover" -version = "0.12.4" +name = "miden-tx-batch-prover" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f5029810b106654a1ec5d7d7123945db91b96bc4f4187715d0c2cfe0b0a53af4" +dependencies = [ + "miden-objects", + "miden-tx", +] + +[[package]] +name = "miden-utils-diagnostics" +version = "0.19.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a3ff4c019d96539a7066626efb4dce5c9fb7b0e44e961b0c2571e78f34236d5" +dependencies = [ + "miden-crypto", + "miden-debug-types", + "miden-miette", + "paste", + "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.17", +] + +[[package]] +name = "miden-utils-sync" +version = "0.19.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "feebe7d896c013ea74dbc98de978836606356a044d4ed3b61ded54d3b319d89f" +dependencies = [ + "lock_api", + "loom", + "parking_lot", +] + +[[package]] +name = "miden-verifier" +version = "0.19.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8f8e47b78bba1fe1b31faee8f12aafd95385f6d6a8b108b03e92f5d743bb29f" +dependencies = [ + "miden-air", + "miden-core", + "thiserror 2.0.17", + "tracing", + "winter-verifier", +] + +[[package]] +name = "midenc-codegen-masm" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e30924ffce882f7f8b46cf9972fc4c81d571e0d6e0178c12836018231bfc047b" +dependencies = [ + "inventory", + "log", + "miden-assembly", + "miden-assembly-syntax", + "miden-core", + "miden-lib", + "miden-mast-package", + "miden-processor", + "miden-thiserror", + "midenc-dialect-arith", + "midenc-dialect-cf", + "midenc-dialect-hir", + "midenc-dialect-scf", + "midenc-dialect-ub", + "midenc-hir", + "midenc-hir-analysis", + "midenc-session", + "petgraph 0.8.3", + "serde", + "smallvec", +] + +[[package]] +name = "midenc-compile" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ab8ffba56dbf4f82642dfbac28a1ba03f6c1b5c49749c7e5f1738841456fb58" +dependencies = [ + "clap", + "inventory", + "log", + "miden-assembly", + "miden-mast-package", + "miden-thiserror", + "midenc-codegen-masm", + "midenc-dialect-hir", + "midenc-dialect-scf", + "midenc-frontend-wasm", + "midenc-hir", + "midenc-hir-transform", + "midenc-session", + "wat", +] + +[[package]] +name = "midenc-dialect-arith" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7389f2826e2f3091443c6af3a8392e8ca0e7ec01c9d0508404cfea26aef742ab" +dependencies = [ + "midenc-hir", + "paste", +] + +[[package]] +name = "midenc-dialect-cf" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b28ec5069aaa987cab007f2b4d9a7bdeff611afae7497b567d008937561452b" +dependencies = [ + "log", + "midenc-dialect-arith", + "midenc-hir", +] + +[[package]] +name = "midenc-dialect-hir" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "186bc4070f17e0f2e6f9eefc4b64fd6a2dcbbead051bd26b1aed4cf855678053" +dependencies = [ + "log", + "midenc-dialect-arith", + "midenc-dialect-cf", + "midenc-hir", + "midenc-hir-analysis", + "midenc-hir-transform", +] + +[[package]] +name = "midenc-dialect-scf" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a052a5f91aed8e26588c5ed205d95ddda5610160e241df0a834713def93fb8d" +dependencies = [ + "bitvec", + "log", + "midenc-dialect-arith", + "midenc-dialect-cf", + "midenc-dialect-ub", + "midenc-hir", + "midenc-hir-transform", +] + +[[package]] +name = "midenc-dialect-ub" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b72ed5e1d03c8ba9adb5db4262efc53a3eb57b334a5f5cb4f99c9a1a09ffc9a" +dependencies = [ + "midenc-hir", +] + +[[package]] +name = "midenc-frontend-wasm" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f5029810b106654a1ec5d7d7123945db91b96bc4f4187715d0c2cfe0b0a53af4" +checksum = "8527078e1a900cd5e1aaddce3bacd7ca2dfe50382d662cca228d23ca73f03196" dependencies = [ - "miden-objects", - "miden-tx", + "addr2line 0.24.2", + "anyhow", + "cranelift-entity", + "gimli 0.31.1", + "indexmap", + "log", + "miden-core", + "miden-thiserror", + "midenc-dialect-arith", + "midenc-dialect-cf", + "midenc-dialect-hir", + "midenc-dialect-ub", + "midenc-hir", + "midenc-hir-symbol", + "midenc-session", + "wasmparser 0.227.1", ] [[package]] -name = "miden-utils-diagnostics" -version = "0.19.1" +name = "midenc-hir" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a3ff4c019d96539a7066626efb4dce5c9fb7b0e44e961b0c2571e78f34236d5" +checksum = "4b3320b03cfde11f06f4e3fdbe4d16d2fe9d84639811816131f59e5ad148af7c" dependencies = [ - "miden-crypto", - "miden-debug-types", - "miden-miette", - "paste", - "tracing", + "anyhow", + "bitflags", + "bitvec", + "blink-alloc", + "compact_str", + "hashbrown 0.14.5", + "hashbrown 0.15.5", + "intrusive-collections", + "inventory", + "log", + "miden-core", + "miden-thiserror", + "midenc-hir-macros", + "midenc-hir-symbol", + "midenc-hir-type", + "midenc-session", + "rustc-demangle", + "rustc-hash", + "semver 1.0.27", + "smallvec", ] [[package]] -name = "miden-utils-indexing" -version = "0.19.1" +name = "midenc-hir-analysis" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c798250bee4e856d4f18c161e91cdcbef1906f6614d00cf0063b47031c0f8cc6" +checksum = "5c45bede7ec2522c46f1c78979f6c9cf2fb16247a2c1f24e74d9234ffc0c3898" dependencies = [ - "thiserror 2.0.17", + "bitvec", + "blink-alloc", + "log", + "midenc-hir", ] [[package]] -name = "miden-utils-sync" -version = "0.19.1" +name = "midenc-hir-macros" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "feebe7d896c013ea74dbc98de978836606356a044d4ed3b61ded54d3b319d89f" +checksum = "16819e7f5169c2b569163bc5efd39d911fb9be3e2aa8531bb7492bac00853a73" +dependencies = [ + "Inflector", + "darling", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "midenc-hir-symbol" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3eac691227a151d0ac562ff61141b88cfe8cd3abab7ec82ccfbdcb760fec9af" dependencies = [ + "Inflector", + "hashbrown 0.14.5", + "hashbrown 0.15.5", "lock_api", - "loom", + "miden-formatting", "parking_lot", + "rustc-hash", + "toml 0.8.23", ] [[package]] -name = "miden-verifier" -version = "0.19.1" +name = "midenc-hir-transform" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8f8e47b78bba1fe1b31faee8f12aafd95385f6d6a8b108b03e92f5d743bb29f" +checksum = "5634910132e55b307857991dc4a5a4e2005f90e24d838d22dae575b25fd28f46" dependencies = [ - "miden-air", - "miden-core", - "thiserror 2.0.17", - "tracing", - "winter-verifier", + "log", + "midenc-hir", + "midenc-hir-analysis", + "midenc-session", ] [[package]] @@ -2634,10 +3215,36 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9d4cfab04baffdda3fb9eafa5f873604059b89a1699aa95e4f1057397a69f0b5" dependencies = [ "miden-formatting", + "serde", + "serde_repr", "smallvec", "thiserror 2.0.17", ] +[[package]] +name = "midenc-session" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "253c73edadd269212100c0bb677b56d2e143fc0c1894d785e2e713b85474d3af" +dependencies = [ + "anyhow", + "clap", + "inventory", + "log", + "miden-assembly", + "miden-assembly-syntax", + "miden-core", + "miden-debug-types", + "miden-lib", + "miden-mast-package", + "miden-stdlib", + "miden-thiserror", + "midenc-hir-macros", + "midenc-hir-symbol", + "parking_lot", + "termcolor", +] + [[package]] name = "miette" version = "7.6.0" @@ -2681,6 +3288,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316" dependencies = [ "adler2", + "simd-adler32", ] [[package]] @@ -2842,6 +3450,17 @@ dependencies = [ "libc", ] +[[package]] +name = "object" +version = "0.36.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62948e14d923ea95ea2c7c86c71013138b66525b86bdc08d2dcc262bdb497b87" +dependencies = [ + "flate2", + "memchr", + "ruzstd", +] + [[package]] name = "object" version = "0.37.3" @@ -3002,12 +3621,45 @@ dependencies = [ "windows-link 0.2.1", ] +[[package]] +name = "parse_arg" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32f05bccc8b6036fec4e0c511954e3997987a82acb6a0b50642ecf7c744fe225" +dependencies = [ + "parse_arg 1.0.1", +] + +[[package]] +name = "parse_arg" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5bddc33f680b79eaf1e2e56da792c3c2236f86985bbc3a886e8ddee17ae4d3a4" + [[package]] name = "paste" version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" +[[package]] +name = "path-absolutize" +version = "3.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e4af381fe79fa195b4909485d99f73a80792331df0625188e707854f0b3383f5" +dependencies = [ + "path-dedot", +] + +[[package]] +name = "path-dedot" +version = "3.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07ba0ad7e047712414213ff67533e6dd477af0a4e1d14fb52343e53d30ea9397" +dependencies = [ + "once_cell", +] + [[package]] name = "pear" version = "0.2.9" @@ -3037,6 +3689,49 @@ version = "2.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" +[[package]] +name = "pest" +version = "2.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cbcfd20a6d4eeba40179f05735784ad32bdaef05ce8e8af05f180d45bb3e7e22" +dependencies = [ + "memchr", + "ucd-trie", +] + +[[package]] +name = "pest_derive" +version = "2.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51f72981ade67b1ca6adc26ec221be9f463f2b5839c7508998daa17c23d94d7f" +dependencies = [ + "pest", + "pest_generator", +] + +[[package]] +name = "pest_generator" +version = "2.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dee9efd8cdb50d719a80088b76f81aec7c41ed6d522ee750178f83883d271625" +dependencies = [ + "pest", + "pest_meta", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "pest_meta" +version = "2.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf1d70880e76bdc13ba52eafa6239ce793d85c8e43896507e43dd8984ff05b82" +dependencies = [ + "pest", + "sha2", +] + [[package]] name = "petgraph" version = "0.7.1" @@ -3047,6 +3742,17 @@ dependencies = [ "indexmap", ] +[[package]] +name = "petgraph" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8701b58ea97060d5e5b155d383a69952a60943f0e6dfe30b04c287beb0b27455" +dependencies = [ + "fixedbitset", + "hashbrown 0.15.5", + "indexmap", +] + [[package]] name = "phf_shared" version = "0.11.3" @@ -3238,7 +3944,7 @@ dependencies = [ "log", "multimap", "once_cell", - "petgraph", + "petgraph 0.7.1", "prettyplease", "prost 0.14.1", "prost-types 0.14.1", @@ -3407,6 +4113,12 @@ version = "5.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" +[[package]] +name = "radium" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09" + [[package]] name = "rand" version = "0.9.2" @@ -3616,6 +4328,12 @@ version = "0.1.26" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "56f7d92ca342cea22a06f2121d944b4fd82af56988c270852495420f961d4ace" +[[package]] +name = "rustc-hash" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "357703d41365b4b27c590e3ed91eabb1b663f07c4c084095e60cbed4362dff0d" + [[package]] name = "rustc_version" version = "0.2.3" @@ -3713,6 +4431,15 @@ version = "1.0.22" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d" +[[package]] +name = "ruzstd" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fad02996bfc73da3e301efe90b1837be9ed8f4a462b6ed410aa35d00381de89f" +dependencies = [ + "twox-hash", +] + [[package]] name = "ryu" version = "1.0.20" @@ -3878,6 +4605,17 @@ dependencies = [ "serde_core", ] +[[package]] +name = "serde_repr" +version = "0.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "175ee3e80ae9982737ca543e96133087cbd9a485eecc3bc4de9c1a37b47ea59c" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "serde_spanned" version = "0.6.9" @@ -3963,6 +4701,12 @@ dependencies = [ "rand_core 0.6.4", ] +[[package]] +name = "simd-adler32" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e320a6c5ad31d271ad523dcf3ad13e2767ad8b1cb8f047f75a8aeaf8da139da2" + [[package]] name = "siphasher" version = "1.0.1" @@ -3980,6 +4724,9 @@ name = "smallvec" version = "1.15.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03" +dependencies = [ + "serde", +] [[package]] name = "smawk" @@ -4022,6 +4769,12 @@ version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" +[[package]] +name = "static_assertions" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" + [[package]] name = "string_cache" version = "0.8.9" @@ -4107,6 +4860,12 @@ dependencies = [ "syn", ] +[[package]] +name = "tap" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" + [[package]] name = "target-triple" version = "1.0.0" @@ -4356,7 +5115,7 @@ dependencies = [ "serde", "serde_spanned 0.6.9", "toml_datetime 0.6.11", - "toml_edit", + "toml_edit 0.22.27", ] [[package]] @@ -4406,6 +5165,21 @@ dependencies = [ "winnow", ] +[[package]] +name = "toml_edit" +version = "0.23.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d7cbc3b4b49633d57a0509303158ca50de80ae32c265093b24c414705807832" +dependencies = [ + "indexmap", + "serde_core", + "serde_spanned 1.0.3", + "toml_datetime 0.7.3", + "toml_parser", + "toml_writer", + "winnow", +] + [[package]] name = "toml_parser" version = "1.0.4" @@ -4720,12 +5494,34 @@ dependencies = [ "toml 0.9.8", ] +[[package]] +name = "twox-hash" +version = "1.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97fee6b57c6a41524a810daee9286c02d7752c4253064d0b05472833a438f675" +dependencies = [ + "cfg-if", + "static_assertions", +] + +[[package]] +name = "typed-arena" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6af6ae20167a9ece4bcb41af5b80f8a1f1df981f6391189ce00fd257af04126a" + [[package]] name = "typenum" version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "562d481066bde0658276a35467c4af00bdc6ee726305698a55b86e61d7ad82bb" +[[package]] +name = "ucd-trie" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2896d95c02a80c6d6a5d6e953d479f5ddf2dfdb6a244441010e373ac0fb88971" + [[package]] name = "unarray" version = "0.1.4" @@ -4759,6 +5555,12 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3b09c83c3c29d37506a3e260c08c03743a6bb66a9cd432c6934ab501a190571f" +[[package]] +name = "unicode-segmentation" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6ccf251212114b54433ec949fd6a7841275f9ada20dddd2f29e9ceea4501493" + [[package]] name = "unicode-width" version = "0.1.14" @@ -4955,7 +5757,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5be00faa2b4950c76fe618c409d2c3ea5a3c9422013e079482d78544bb2d184c" dependencies = [ "leb128fmt", - "wasmparser", + "wasmparser 0.239.0", +] + +[[package]] +name = "wasm-encoder" +version = "0.243.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c55db9c896d70bd9fa535ce83cd4e1f2ec3726b0edd2142079f594fc3be1cb35" +dependencies = [ + "leb128fmt", + "wasmparser 0.243.0", ] [[package]] @@ -4966,8 +5778,8 @@ checksum = "20b3ec880a9ac69ccd92fbdbcf46ee833071cf09f82bb005b2327c7ae6025ae2" dependencies = [ "anyhow", "indexmap", - "wasm-encoder", - "wasmparser", + "wasm-encoder 0.239.0", + "wasmparser 0.239.0", ] [[package]] @@ -4983,6 +5795,17 @@ dependencies = [ "web-sys", ] +[[package]] +name = "wasmparser" +version = "0.227.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f51cad774fb3c9461ab9bccc9c62dfb7388397b5deda31bf40e8108ccd678b2" +dependencies = [ + "bitflags", + "indexmap", + "semver 1.0.27", +] + [[package]] name = "wasmparser" version = "0.239.0" @@ -4995,6 +5818,39 @@ dependencies = [ "semver 1.0.27", ] +[[package]] +name = "wasmparser" +version = "0.243.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6d8db401b0528ec316dfbe579e6ab4152d61739cfe076706d2009127970159d" +dependencies = [ + "bitflags", + "indexmap", + "semver 1.0.27", +] + +[[package]] +name = "wast" +version = "243.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df21d01c2d91e46cb7a221d79e58a2d210ea02020d57c092e79255cc2999ca7f" +dependencies = [ + "bumpalo", + "leb128fmt", + "memchr", + "unicode-width 0.2.2", + "wasm-encoder 0.243.0", +] + +[[package]] +name = "wat" +version = "1.243.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "226a9a91cd80a50449312fef0c75c23478fcecfcc4092bdebe1dc8e760ef521b" +dependencies = [ + "wast", +] + [[package]] name = "web-sys" version = "0.3.83" @@ -5609,9 +6465,9 @@ dependencies = [ "serde", "serde_derive", "serde_json", - "wasm-encoder", + "wasm-encoder 0.239.0", "wasm-metadata", - "wasmparser", + "wasmparser 0.239.0", "wit-parser", ] @@ -5630,7 +6486,7 @@ dependencies = [ "serde_derive", "serde_json", "unicode-xid", - "wasmparser", + "wasmparser 0.239.0", ] [[package]] @@ -5645,6 +6501,15 @@ version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9edde0db4769d2dc68579893f2306b26c6ecfbe0ef499b013d731b7b9247e0b9" +[[package]] +name = "wyz" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05f360fc0b24296329c78fda852a1e9ae82de9cf7b27dae4b7f62f118f77b9ed" +dependencies = [ + "tap", +] + [[package]] name = "x25519-dalek" version = "2.0.1" diff --git a/Cargo.toml b/Cargo.toml index a8f3aae4..4ddf49aa 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,5 @@ [workspace] -members = ["bin/faucet", "crates/faucet", "crates/pow", "crates/mint-script"] +members = ["bin/faucet", "crates/faucet", "crates/pow", "crates/mint-tx"] resolver = "2" @@ -21,7 +21,7 @@ opt-level = 2 [workspace.dependencies] miden-faucet-lib = { path = "crates/faucet", version = "0.13" } miden-pow-rate-limiter = { path = "crates/pow", version = "0.13" } -miden-faucet-mint-script = { path = "crates/mint-script", version = "0.13" } +miden-faucet-mint-tx = { path = "crates/mint-script", version = "0.13" } # Miden dependencies. miden-client = { version = "0.12" } diff --git a/Makefile b/Makefile index c27c2c6a..523c8086 100644 --- a/Makefile +++ b/Makefile @@ -21,7 +21,8 @@ fix: ## Runs Fix with configs .PHONY: build build: ## By default we should build in release mode - cargo build --release + cd crates/mint-tx && cargo miden build --release && cd - + cargo build --workspace --exclude miden-faucet-mint-tx --release .PHONY: format format: ## Runs Format using nightly toolchain diff --git a/bin/faucet/src/main.rs b/bin/faucet/src/main.rs index bec82f88..316d82c0 100644 --- a/bin/faucet/src/main.rs +++ b/bin/faucet/src/main.rs @@ -15,11 +15,7 @@ use anyhow::Context; use clap::{Parser, Subcommand}; use miden_client::account::component::{AuthRpoFalcon512, BasicFungibleFaucet}; use miden_client::account::{ - Account, - AccountBuilder, - AccountFile, - AccountStorageMode, - AccountType, + Account, AccountBuilder, AccountFile, AccountStorageMode, AccountType, }; use miden_client::asset::TokenSymbol; use miden_client::auth::AuthSecretKey; diff --git a/crates/faucet/Cargo.toml b/crates/faucet/Cargo.toml index 5192481a..5d080ff2 100644 --- a/crates/faucet/Cargo.toml +++ b/crates/faucet/Cargo.toml @@ -27,9 +27,6 @@ tokio = { features = ["fs"], workspace = true } tracing = { workspace = true } url = { workspace = true } -[build-dependencies] -miden-client = { workspace = true } - [dev-dependencies] miden-client = { features = ["testing", "tonic"], workspace = true } uuid = { workspace = true } diff --git a/crates/faucet/build.rs b/crates/faucet/build.rs deleted file mode 100644 index 9d4df384..00000000 --- a/crates/faucet/build.rs +++ /dev/null @@ -1,36 +0,0 @@ -use std::{env, fs, path::Path}; - -use miden_client::Deserializable; -use miden_client::transaction::TransactionScript; -use miden_client::utils::Serializable; -use miden_client::vm::Package; - -fn main() { - // TODO: run cargo miden build --release and specify target directory as OUT_DIR - // TODO: check workspace settings for the mint-script crate - let workspace_root = env::var("CARGO_MANIFEST_DIR") - .map(|d| Path::new(&d).parent().unwrap().parent().unwrap().to_path_buf()) - .unwrap(); - - // Rebuild when mint-script source changes - println!("cargo:rerun-if-changed=../mint-script/src/lib.rs"); - - // Look for compiled .masp file from mint-script - let masp_path = workspace_root - .join("target") - .join("miden") - .join("release") - .join("mint_script.masp"); - - let build_dir = env::var("OUT_DIR").unwrap(); - let target_dir = Path::new(&build_dir); - fs::create_dir_all(&target_dir).expect("should create target directory"); - let txs_path = target_dir.join("mint.txs"); - - let masp = fs::read(masp_path).expect("failed to read mint_script.masp"); - let package = - Package::read_from_bytes(&masp).expect("failed to parse mint_script.masp as package"); - let program = package.unwrap_program(); - let script = TransactionScript::from_parts(program.mast_forest().clone(), program.entrypoint()); - fs::write(txs_path, script.to_bytes()).expect("failed to write mint.txs"); -} diff --git a/crates/faucet/src/lib.rs b/crates/faucet/src/lib.rs index 9176322b..a8b4dd03 100644 --- a/crates/faucet/src/lib.rs +++ b/crates/faucet/src/lib.rs @@ -20,6 +20,7 @@ use miden_client::transaction::{ TransactionRequestBuilder, TransactionRequestError, TransactionScript, }; use miden_client::utils::{Deserializable, RwLock}; +use miden_client::vm::Package; use miden_client::{Client, ClientError, Felt, RemoteTransactionProver, Word}; use miden_client_sqlite_store::SqliteStore; use rand::rngs::StdRng; @@ -40,7 +41,12 @@ const COMPONENT: &str = "miden-faucet-client"; const KEYSTORE_PATH: &str = "keystore"; const DEFAULT_ACCOUNT_ID_SETTING: &str = "faucet_default_account_id"; -const TX_PACKAGE: &[u8] = include_bytes!(concat!(env!("OUT_DIR"), "/mint.txs")); + +// TODO: improve this +const TX_PACKAGE: &[u8] = include_bytes!(concat!( + env!("CARGO_MANIFEST_DIR"), + "/../../target/miden/release/miden_faucet_mint_tx.masp" +)); // FAUCET CLIENT // ================================================================================================ @@ -182,7 +188,11 @@ impl Faucet { let issuance = Arc::new(RwLock::new(AssetAmount::new(account.get_token_issuance()?.as_int())?)); - let script = TransactionScript::read_from_bytes(TX_PACKAGE)?; + let package = Package::read_from_bytes(TX_PACKAGE)?; + let script = TransactionScript::from_parts( + package.unwrap_program().mast_forest().clone(), + package.unwrap_program().entrypoint(), + ); let note_screener = NoteScreener::new(Arc::new(SqliteStore::new(config.store_path.clone()).await?)); diff --git a/crates/mint-script/.gitignore b/crates/mint-tx/.gitignore similarity index 100% rename from crates/mint-script/.gitignore rename to crates/mint-tx/.gitignore diff --git a/crates/mint-script/Cargo.toml b/crates/mint-tx/Cargo.toml similarity index 79% rename from crates/mint-script/Cargo.toml rename to crates/mint-tx/Cargo.toml index 3baf2a01..728b87b6 100644 --- a/crates/mint-script/Cargo.toml +++ b/crates/mint-tx/Cargo.toml @@ -1,14 +1,8 @@ [package] -name = "miden-faucet-mint-script" +name = "miden-faucet-mint-tx" version.workspace = true edition.workspace = true -[profile.dev] -panic = "abort" - -[profile.release] -panic = "abort" - [lib] # Build this crate as a self-contained, C-style dynamic library # This is required to emit the proper Wasm module type @@ -19,8 +13,11 @@ crate-type = ["cdylib"] # and transaction kernel API for the Miden rollup miden = { version = "0.7" } +[build-dependencies] +cargo-miden = { version = "0.5" } + [package.metadata.component] -package = "miden:mint-script" +package = "miden:mint-tx" [package.metadata.miden] project-kind = "transaction-script" diff --git a/crates/mint-script/README.md b/crates/mint-tx/README.md similarity index 89% rename from crates/mint-script/README.md rename to crates/mint-tx/README.md index 2a3ed810..a58aec48 100644 --- a/crates/mint-script/README.md +++ b/crates/mint-tx/README.md @@ -1,4 +1,4 @@ -# project +# mint_tx A Miden transaction script project. diff --git a/crates/mint-script/rust-toolchain.toml b/crates/mint-tx/rust-toolchain.toml similarity index 100% rename from crates/mint-script/rust-toolchain.toml rename to crates/mint-tx/rust-toolchain.toml diff --git a/crates/mint-script/src/lib.rs b/crates/mint-tx/src/lib.rs similarity index 66% rename from crates/mint-script/src/lib.rs rename to crates/mint-tx/src/lib.rs index 464a36e9..b7665789 100644 --- a/crates/mint-script/src/lib.rs +++ b/crates/mint-tx/src/lib.rs @@ -1,11 +1,10 @@ #![no_std] - -extern crate alloc; +#![feature(alloc_error_handler)] use miden::faucet::mint; use miden::intrinsics::advice::adv_push_mapvaln; use miden::tx::update_expiration_block_delta; -use miden::*; +use miden::{Asset, Felt, Word, adv_load_preimage, felt, tx_script}; const ASSET_WORD_SIZE: usize = 4; @@ -13,9 +12,9 @@ const ASSET_WORD_SIZE: usize = 4; fn run(arg: Word) { update_expiration_block_delta(Felt::from_u32(10)); - let num_felts = adv_push_mapvaln(arg.clone()); + let num_felts = adv_push_mapvaln(arg); let num_felts_u64 = num_felts.as_u64(); - assert_eq(Felt::from_u32((num_felts_u64 % 4) as u32), felt!(0)); + assert_eq!(Felt::from_u32((num_felts_u64 % 4) as u32), felt!(0)); let num_words = Felt::from_u64_unchecked(num_felts_u64 / 4); let commitment = arg; @@ -25,7 +24,8 @@ fn run(arg: Word) { for idx in 0..num_words_usize { let start = idx * ASSET_WORD_SIZE; let end = start + ASSET_WORD_SIZE; - let asset: [Felt; ASSET_WORD_SIZE] = input[start..end].try_into().unwrap(); + let asset: [Felt; ASSET_WORD_SIZE] = + input[start..end].try_into().expect("invalid input length"); mint(Asset::new(asset)); } } diff --git a/crates/mint-script/wit/.gitkeep b/crates/mint-tx/wit/.gitkeep similarity index 100% rename from crates/mint-script/wit/.gitkeep rename to crates/mint-tx/wit/.gitkeep From 8c5316ed0e6b181eeea3881157f4113b19bea2cf Mon Sep 17 00:00:00 2001 From: tomasarrachea Date: Mon, 5 Jan 2026 14:32:35 -0300 Subject: [PATCH 05/19] feat: use miden v0.8 --- Cargo.lock | 995 ++--------------------------- Makefile | 2 + crates/faucet/src/lib.rs | 1 + crates/mint-tx/Cargo.toml | 5 +- crates/mint-tx/rust-toolchain.toml | 2 +- 5 files changed, 71 insertions(+), 934 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 12878ee0..2d6aaa18 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -12,29 +12,13 @@ dependencies = [ "regex", ] -[[package]] -name = "addr2line" -version = "0.24.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfbe277e56a376000877090da837660b4427aad530e3028d44e0bffe4f89a1c1" -dependencies = [ - "cpp_demangle", - "fallible-iterator", - "gimli 0.31.1", - "memmap2", - "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", + "gimli", ] [[package]] @@ -53,18 +37,6 @@ dependencies = [ "generic-array", ] -[[package]] -name = "ahash" -version = "0.8.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a15f179cd60c4584b8a8c596927aadc462e27f2ca70c04e0071964a73ba7a75" -dependencies = [ - "cfg-if", - "once_cell", - "version_check", - "zerocopy", -] - [[package]] name = "aho-corasick" version = "1.1.4" @@ -148,12 +120,6 @@ dependencies = [ "backtrace", ] -[[package]] -name = "anymap2" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d301b3b94cb4b2f23d7917810addbbaff90738e0ca2be692bd027e70d7e0330c" - [[package]] name = "arrayref" version = "0.3.9" @@ -287,11 +253,11 @@ version = "0.3.76" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bb531853791a215d7c62a30daf0dde835f381ab5de4589cfe7c649d2cbe92bd6" dependencies = [ - "addr2line 0.25.1", + "addr2line", "cfg-if", "libc", "miniz_oxide", - "object 0.37.3", + "object", "rustc-demangle", "windows-link 0.2.1", ] @@ -356,18 +322,6 @@ version = "2.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "812e12b5285cc515a9c72a5c1d3b6d46a19dac5acfef5265968c166106e31dd3" -[[package]] -name = "bitvec" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bc2832c24239b0141d5674bb9174f9d68a8b5b3f2753311927c172ca46f7e9c" -dependencies = [ - "funty", - "radium", - "tap", - "wyz", -] - [[package]] name = "blake3" version = "1.8.2" @@ -381,15 +335,6 @@ dependencies = [ "constant_time_eq", ] -[[package]] -name = "blink-alloc" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e669f146bb8b2327006ed94c69cf78c8ec81c100192564654230a40b4f091d82" -dependencies = [ - "allocator-api2", -] - [[package]] name = "block-buffer" version = "0.10.4" @@ -423,71 +368,6 @@ version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b35204fbdc0b3f4446b89fc1ac2cf84a8a68971995d0bf2e925ec7cd960f9cb3" -[[package]] -name = "camino" -version = "1.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e629a66d692cb9ff1a1c664e41771b3dcaf961985a9774c0eb0bd1b51cf60a48" -dependencies = [ - "serde_core", -] - -[[package]] -name = "cargo-miden" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d219f8b56b439da0a398db64a25c3a1e62aefed23dd750d8fa9d34f5b4684035" -dependencies = [ - "anyhow", - "cargo_metadata", - "clap", - "env_logger", - "liquid", - "log", - "midenc-compile", - "midenc-session", - "parse_arg 0.1.6", - "path-absolutize", - "semver 1.0.27", - "serde", - "serde_json", - "tempfile", - "toml_edit 0.23.9", - "walkdir", -] - -[[package]] -name = "cargo-platform" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e35af189006b9c0f00a064685c727031e3ed2d8020f7ba284d78cc2671bd36ea" -dependencies = [ - "serde", -] - -[[package]] -name = "cargo_metadata" -version = "0.19.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd5eb614ed4c27c5d706420e4320fbe3216ab31fa1c33cd8246ac36dae4479ba" -dependencies = [ - "camino", - "cargo-platform", - "semver 1.0.27", - "serde", - "serde_json", - "thiserror 2.0.17", -] - -[[package]] -name = "castaway" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dec551ab6e7578819132c713a93c022a05d60159dc86e7a7050223577484c55a" -dependencies = [ - "rustversion", -] - [[package]] name = "cc" version = "1.2.48" @@ -600,20 +480,6 @@ version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75" -[[package]] -name = "compact_str" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fdb1325a1cece981e8a296ab8f0f9b63ae357bd0784a9faaf548cc7b480707a" -dependencies = [ - "castaway", - "cfg-if", - "itoa", - "rustversion", - "ryu", - "static_assertions", -] - [[package]] name = "const-oid" version = "0.9.6" @@ -682,15 +548,6 @@ dependencies = [ "libm", ] -[[package]] -name = "cpp_demangle" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2bb79cb74d735044c972aae58ed0aaa9a837e85b01106a54c39e42e97f62253" -dependencies = [ - "cfg-if", -] - [[package]] name = "cpufeatures" version = "0.2.17" @@ -700,30 +557,6 @@ dependencies = [ "libc", ] -[[package]] -name = "cranelift-bitset" -version = "0.120.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db7b2ee9eec6ca8a716d900d5264d678fb2c290c58c46c8da7f94ee268175d17" - -[[package]] -name = "cranelift-entity" -version = "0.120.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d75418674520cb400c8772bfd6e11a62736c78fc1b6e418195696841d1bf91f1" -dependencies = [ - "cranelift-bitset", -] - -[[package]] -name = "crc32fast" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9481c1c90cbf2ac953f07c8d4a58aa3945c425b7185c9154d67a65e4230da511" -dependencies = [ - "cfg-if", -] - [[package]] name = "crossbeam-deque" version = "0.8.6" @@ -799,41 +632,6 @@ dependencies = [ "syn", ] -[[package]] -name = "darling" -version = "0.20.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc7f46116c46ff9ab3eb1597a45688b6715c6e628b5c133e288e709a29bcb4ee" -dependencies = [ - "darling_core", - "darling_macro", -] - -[[package]] -name = "darling_core" -version = "0.20.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d00b9596d185e565c2207a0b01f8bd1a135483d02d9b7b0a54b11da8d53412e" -dependencies = [ - "fnv", - "ident_case", - "proc-macro2", - "quote", - "strsim", - "syn", -] - -[[package]] -name = "darling_macro" -version = "0.20.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc34b93ccb385b40dc71c6fceac4b2ad23662c7eeb248cf10d529b7e055b6ead" -dependencies = [ - "darling_core", - "quote", - "syn", -] - [[package]] name = "deadpool" version = "0.12.3" @@ -1141,16 +939,6 @@ version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1d674e81391d1e1ab681a28d99df07927c6d4aa5b027d7da16ba32d1d21ecd99" -[[package]] -name = "flate2" -version = "1.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfe33edd8e85a12a67454e37f8c75e730830d83e313556ab9ebf9ee7fbeb3bfb" -dependencies = [ - "crc32fast", - "miniz_oxide", -] - [[package]] name = "flume" version = "0.11.1" @@ -1214,12 +1002,6 @@ dependencies = [ "autocfg", ] -[[package]] -name = "funty" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" - [[package]] name = "futures" version = "0.3.31" @@ -1361,16 +1143,6 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "gimli" -version = "0.31.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f" -dependencies = [ - "fallible-iterator", - "stable_deref_trait", -] - [[package]] name = "gimli" version = "0.32.3" @@ -1413,24 +1185,12 @@ dependencies = [ "tracing", ] -[[package]] -name = "hashbrown" -version = "0.14.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" -dependencies = [ - "ahash", - "allocator-api2", -] - [[package]] name = "hashbrown" version = "0.15.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1" dependencies = [ - "allocator-api2", - "equivalent", "foldhash 0.1.5", ] @@ -1816,12 +1576,6 @@ version = "2.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "25a2bc672d1148e28034f176e01fffebb08b35768468cc954630da77a1449005" -[[package]] -name = "ident_case" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" - [[package]] name = "idna" version = "1.1.0" @@ -1876,24 +1630,6 @@ dependencies = [ "generic-array", ] -[[package]] -name = "intrusive-collections" -version = "0.9.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "189d0897e4cbe8c75efedf3502c18c887b05046e59d28404d4d8e46cbc4d1e86" -dependencies = [ - "memoffset", -] - -[[package]] -name = "inventory" -version = "0.3.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc61209c082fbeb19919bee74b176221b27223e27b65d781eb91af24eb1fb46e" -dependencies = [ - "rustversion", -] - [[package]] name = "ipnet" version = "2.11.0" @@ -2004,16 +1740,6 @@ dependencies = [ "cpufeatures", ] -[[package]] -name = "kstring" -version = "2.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "558bf9508a558512042d3095138b1f7b8fe90c5467d94f9f1da28b3731c5dbd1" -dependencies = [ - "serde", - "static_assertions", -] - [[package]] name = "lalrpop" version = "0.22.2" @@ -2025,7 +1751,7 @@ dependencies = [ "ena", "itertools", "lalrpop-util", - "petgraph 0.7.1", + "petgraph", "regex", "regex-syntax", "sha3", @@ -2091,60 +1817,6 @@ version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "df1d3c3b53da64cf5760482273a98e575c651a67eec7f77df96b5b642de8f039" -[[package]] -name = "liquid" -version = "0.26.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a494c3f9dad3cb7ed16f1c51812cbe4b29493d6c2e5cd1e2b87477263d9534d" -dependencies = [ - "liquid-core", - "liquid-derive", - "liquid-lib", - "serde", -] - -[[package]] -name = "liquid-core" -version = "0.26.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc623edee8a618b4543e8e8505584f4847a4e51b805db1af6d9af0a3395d0d57" -dependencies = [ - "anymap2", - "itertools", - "kstring", - "liquid-derive", - "pest", - "pest_derive", - "regex", - "serde", - "time", -] - -[[package]] -name = "liquid-derive" -version = "0.26.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de66c928222984aea59fcaed8ba627f388aaac3c1f57dcb05cc25495ef8faefe" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "liquid-lib" -version = "0.26.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9befeedd61f5995bc128c571db65300aeb50d62e4f0542c88282dbcb5f72372a" -dependencies = [ - "itertools", - "liquid-core", - "percent-encoding", - "regex", - "time", - "unicode-segmentation", -] - [[package]] name = "litemap" version = "0.7.5" @@ -2273,29 +1945,11 @@ version = "2.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f52b00d39961fc5b2736ea853c9cc86238e165017a493d1d5c8eac6bdc4cc273" -[[package]] -name = "memmap2" -version = "0.9.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "744133e4a0e0a658e1374cf3bf8e415c4052a15a111acd372764c55b4177d490" -dependencies = [ - "libc", -] - -[[package]] -name = "memoffset" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a" -dependencies = [ - "autocfg", -] - [[package]] name = "miden" -version = "0.7.1" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a06aa85af0fa2be870520767ebecb3264b86e2048dd07d29cffb181a5e33af0" +checksum = "db443dc2be686e14bd2fd4213476146d2d4b4b14d52ac7191f51a789ae5b7678" dependencies = [ "miden-base", "miden-base-sys", @@ -2355,9 +2009,9 @@ dependencies = [ [[package]] name = "miden-base" -version = "0.7.1" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf7fddd7fc5dc709e41da7d82fac8647e515ff84466451ce939a242c3e5c8052" +checksum = "6fc4d8ec7077dc50d03d7afecd5308e933b87abe7ffc0ac1e62abda53dd9dc62" dependencies = [ "miden-base-macros", "miden-base-sys", @@ -2366,9 +2020,9 @@ dependencies = [ [[package]] name = "miden-base-macros" -version = "0.7.1" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "039da08835f1f6662fda82ee50a7681cf618a3a6ef054b6fa439dec35a47be9b" +checksum = "07f1ef27517f1d2baf20c66f0795630e74370680798060ed94dc05d3565cd2a9" dependencies = [ "heck", "miden-objects", @@ -2377,13 +2031,15 @@ dependencies = [ "semver 1.0.27", "syn", "toml 0.8.23", + "wit-bindgen-core", + "wit-bindgen-rust", ] [[package]] name = "miden-base-sys" -version = "0.8.0" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b44fb31dad5fc047dea13c31e1e9c041c246e75e28151a08559bfdb7230c9c54" +checksum = "862632407d9f60286e82ad6e56f16a0356b1f266d3fb41d13866cfdc326c2090" dependencies = [ "miden-stdlib-sys", ] @@ -2594,7 +2250,6 @@ dependencies = [ name = "miden-faucet-mint-tx" version = "0.13.0" dependencies = [ - "cargo-miden", "miden", ] @@ -2856,9 +2511,9 @@ dependencies = [ [[package]] name = "miden-sdk-alloc" -version = "0.7.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a364146445b0684cd2df7833324504c9b0f5256ecc39329762c3b17fcf64b65" +checksum = "f7eef3b8651b93468a2b132c885b21aa6d488bf6cd78ba1f736ff90fa8c1fb43" [[package]] name = "miden-stdlib" @@ -2878,9 +2533,9 @@ dependencies = [ [[package]] name = "miden-stdlib-sys" -version = "0.7.1" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4df7e413d1c837b8a9f85ecb33a5dc1655fbf56c4da384ceb9983751eba786ac" +checksum = "5978a2982cbeb64441e90c3e6ee7995ee513dbd1cd399f468fb7d3a608ecaf13" [[package]] name = "miden-testing" @@ -2902,310 +2557,76 @@ dependencies = [ "winterfell", ] -[[package]] -name = "miden-thiserror" -version = "1.0.59" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "183ff8de338956ecfde3a38573241eb7a6f3d44d73866c210e5629c07fa00253" -dependencies = [ - "miden-thiserror-impl", -] - -[[package]] -name = "miden-thiserror-impl" -version = "1.0.59" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ee4176a0f2e7d29d2a8ee7e60b6deb14ce67a20e94c3e2c7275cdb8804e1862" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "miden-tx" version = "0.12.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d959064f99ce09fc38e9b6b4dc24c3fa80a63072bf5840a1074ca4ed5e9c911" -dependencies = [ - "miden-lib", - "miden-objects", - "miden-processor", - "miden-prover", - "miden-verifier", - "rand", - "thiserror 2.0.17", - "tokio", -] - -[[package]] -name = "miden-tx-batch-prover" -version = "0.12.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f5029810b106654a1ec5d7d7123945db91b96bc4f4187715d0c2cfe0b0a53af4" -dependencies = [ - "miden-objects", - "miden-tx", -] - -[[package]] -name = "miden-utils-diagnostics" -version = "0.19.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a3ff4c019d96539a7066626efb4dce5c9fb7b0e44e961b0c2571e78f34236d5" -dependencies = [ - "miden-crypto", - "miden-debug-types", - "miden-miette", - "paste", - "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.17", -] - -[[package]] -name = "miden-utils-sync" -version = "0.19.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "feebe7d896c013ea74dbc98de978836606356a044d4ed3b61ded54d3b319d89f" -dependencies = [ - "lock_api", - "loom", - "parking_lot", -] - -[[package]] -name = "miden-verifier" -version = "0.19.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8f8e47b78bba1fe1b31faee8f12aafd95385f6d6a8b108b03e92f5d743bb29f" -dependencies = [ - "miden-air", - "miden-core", - "thiserror 2.0.17", - "tracing", - "winter-verifier", -] - -[[package]] -name = "midenc-codegen-masm" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e30924ffce882f7f8b46cf9972fc4c81d571e0d6e0178c12836018231bfc047b" -dependencies = [ - "inventory", - "log", - "miden-assembly", - "miden-assembly-syntax", - "miden-core", - "miden-lib", - "miden-mast-package", - "miden-processor", - "miden-thiserror", - "midenc-dialect-arith", - "midenc-dialect-cf", - "midenc-dialect-hir", - "midenc-dialect-scf", - "midenc-dialect-ub", - "midenc-hir", - "midenc-hir-analysis", - "midenc-session", - "petgraph 0.8.3", - "serde", - "smallvec", -] - -[[package]] -name = "midenc-compile" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ab8ffba56dbf4f82642dfbac28a1ba03f6c1b5c49749c7e5f1738841456fb58" -dependencies = [ - "clap", - "inventory", - "log", - "miden-assembly", - "miden-mast-package", - "miden-thiserror", - "midenc-codegen-masm", - "midenc-dialect-hir", - "midenc-dialect-scf", - "midenc-frontend-wasm", - "midenc-hir", - "midenc-hir-transform", - "midenc-session", - "wat", -] - -[[package]] -name = "midenc-dialect-arith" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7389f2826e2f3091443c6af3a8392e8ca0e7ec01c9d0508404cfea26aef742ab" -dependencies = [ - "midenc-hir", - "paste", -] - -[[package]] -name = "midenc-dialect-cf" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b28ec5069aaa987cab007f2b4d9a7bdeff611afae7497b567d008937561452b" -dependencies = [ - "log", - "midenc-dialect-arith", - "midenc-hir", -] - -[[package]] -name = "midenc-dialect-hir" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "186bc4070f17e0f2e6f9eefc4b64fd6a2dcbbead051bd26b1aed4cf855678053" -dependencies = [ - "log", - "midenc-dialect-arith", - "midenc-dialect-cf", - "midenc-hir", - "midenc-hir-analysis", - "midenc-hir-transform", -] - -[[package]] -name = "midenc-dialect-scf" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a052a5f91aed8e26588c5ed205d95ddda5610160e241df0a834713def93fb8d" -dependencies = [ - "bitvec", - "log", - "midenc-dialect-arith", - "midenc-dialect-cf", - "midenc-dialect-ub", - "midenc-hir", - "midenc-hir-transform", -] - -[[package]] -name = "midenc-dialect-ub" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b72ed5e1d03c8ba9adb5db4262efc53a3eb57b334a5f5cb4f99c9a1a09ffc9a" -dependencies = [ - "midenc-hir", -] - -[[package]] -name = "midenc-frontend-wasm" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8527078e1a900cd5e1aaddce3bacd7ca2dfe50382d662cca228d23ca73f03196" -dependencies = [ - "addr2line 0.24.2", - "anyhow", - "cranelift-entity", - "gimli 0.31.1", - "indexmap", - "log", - "miden-core", - "miden-thiserror", - "midenc-dialect-arith", - "midenc-dialect-cf", - "midenc-dialect-hir", - "midenc-dialect-ub", - "midenc-hir", - "midenc-hir-symbol", - "midenc-session", - "wasmparser 0.227.1", +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d959064f99ce09fc38e9b6b4dc24c3fa80a63072bf5840a1074ca4ed5e9c911" +dependencies = [ + "miden-lib", + "miden-objects", + "miden-processor", + "miden-prover", + "miden-verifier", + "rand", + "thiserror 2.0.17", + "tokio", ] [[package]] -name = "midenc-hir" -version = "0.5.1" +name = "miden-tx-batch-prover" +version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b3320b03cfde11f06f4e3fdbe4d16d2fe9d84639811816131f59e5ad148af7c" +checksum = "f5029810b106654a1ec5d7d7123945db91b96bc4f4187715d0c2cfe0b0a53af4" dependencies = [ - "anyhow", - "bitflags", - "bitvec", - "blink-alloc", - "compact_str", - "hashbrown 0.14.5", - "hashbrown 0.15.5", - "intrusive-collections", - "inventory", - "log", - "miden-core", - "miden-thiserror", - "midenc-hir-macros", - "midenc-hir-symbol", - "midenc-hir-type", - "midenc-session", - "rustc-demangle", - "rustc-hash", - "semver 1.0.27", - "smallvec", + "miden-objects", + "miden-tx", ] [[package]] -name = "midenc-hir-analysis" -version = "0.5.1" +name = "miden-utils-diagnostics" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c45bede7ec2522c46f1c78979f6c9cf2fb16247a2c1f24e74d9234ffc0c3898" +checksum = "1a3ff4c019d96539a7066626efb4dce5c9fb7b0e44e961b0c2571e78f34236d5" dependencies = [ - "bitvec", - "blink-alloc", - "log", - "midenc-hir", + "miden-crypto", + "miden-debug-types", + "miden-miette", + "paste", + "tracing", ] [[package]] -name = "midenc-hir-macros" -version = "0.5.1" +name = "miden-utils-indexing" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16819e7f5169c2b569163bc5efd39d911fb9be3e2aa8531bb7492bac00853a73" +checksum = "c798250bee4e856d4f18c161e91cdcbef1906f6614d00cf0063b47031c0f8cc6" dependencies = [ - "Inflector", - "darling", - "proc-macro2", - "quote", - "syn", + "thiserror 2.0.17", ] [[package]] -name = "midenc-hir-symbol" -version = "0.5.1" +name = "miden-utils-sync" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3eac691227a151d0ac562ff61141b88cfe8cd3abab7ec82ccfbdcb760fec9af" +checksum = "feebe7d896c013ea74dbc98de978836606356a044d4ed3b61ded54d3b319d89f" dependencies = [ - "Inflector", - "hashbrown 0.14.5", - "hashbrown 0.15.5", "lock_api", - "miden-formatting", + "loom", "parking_lot", - "rustc-hash", - "toml 0.8.23", ] [[package]] -name = "midenc-hir-transform" -version = "0.5.1" +name = "miden-verifier" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5634910132e55b307857991dc4a5a4e2005f90e24d838d22dae575b25fd28f46" +checksum = "b8f8e47b78bba1fe1b31faee8f12aafd95385f6d6a8b108b03e92f5d743bb29f" dependencies = [ - "log", - "midenc-hir", - "midenc-hir-analysis", - "midenc-session", + "miden-air", + "miden-core", + "thiserror 2.0.17", + "tracing", + "winter-verifier", ] [[package]] @@ -3215,36 +2636,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9d4cfab04baffdda3fb9eafa5f873604059b89a1699aa95e4f1057397a69f0b5" dependencies = [ "miden-formatting", - "serde", - "serde_repr", "smallvec", "thiserror 2.0.17", ] -[[package]] -name = "midenc-session" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "253c73edadd269212100c0bb677b56d2e143fc0c1894d785e2e713b85474d3af" -dependencies = [ - "anyhow", - "clap", - "inventory", - "log", - "miden-assembly", - "miden-assembly-syntax", - "miden-core", - "miden-debug-types", - "miden-lib", - "miden-mast-package", - "miden-stdlib", - "miden-thiserror", - "midenc-hir-macros", - "midenc-hir-symbol", - "parking_lot", - "termcolor", -] - [[package]] name = "miette" version = "7.6.0" @@ -3288,7 +2683,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316" dependencies = [ "adler2", - "simd-adler32", ] [[package]] @@ -3450,17 +2844,6 @@ dependencies = [ "libc", ] -[[package]] -name = "object" -version = "0.36.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62948e14d923ea95ea2c7c86c71013138b66525b86bdc08d2dcc262bdb497b87" -dependencies = [ - "flate2", - "memchr", - "ruzstd", -] - [[package]] name = "object" version = "0.37.3" @@ -3621,45 +3004,12 @@ dependencies = [ "windows-link 0.2.1", ] -[[package]] -name = "parse_arg" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32f05bccc8b6036fec4e0c511954e3997987a82acb6a0b50642ecf7c744fe225" -dependencies = [ - "parse_arg 1.0.1", -] - -[[package]] -name = "parse_arg" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5bddc33f680b79eaf1e2e56da792c3c2236f86985bbc3a886e8ddee17ae4d3a4" - [[package]] name = "paste" version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" -[[package]] -name = "path-absolutize" -version = "3.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4af381fe79fa195b4909485d99f73a80792331df0625188e707854f0b3383f5" -dependencies = [ - "path-dedot", -] - -[[package]] -name = "path-dedot" -version = "3.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07ba0ad7e047712414213ff67533e6dd477af0a4e1d14fb52343e53d30ea9397" -dependencies = [ - "once_cell", -] - [[package]] name = "pear" version = "0.2.9" @@ -3689,49 +3039,6 @@ version = "2.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" -[[package]] -name = "pest" -version = "2.8.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cbcfd20a6d4eeba40179f05735784ad32bdaef05ce8e8af05f180d45bb3e7e22" -dependencies = [ - "memchr", - "ucd-trie", -] - -[[package]] -name = "pest_derive" -version = "2.8.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51f72981ade67b1ca6adc26ec221be9f463f2b5839c7508998daa17c23d94d7f" -dependencies = [ - "pest", - "pest_generator", -] - -[[package]] -name = "pest_generator" -version = "2.8.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dee9efd8cdb50d719a80088b76f81aec7c41ed6d522ee750178f83883d271625" -dependencies = [ - "pest", - "pest_meta", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "pest_meta" -version = "2.8.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf1d70880e76bdc13ba52eafa6239ce793d85c8e43896507e43dd8984ff05b82" -dependencies = [ - "pest", - "sha2", -] - [[package]] name = "petgraph" version = "0.7.1" @@ -3742,17 +3049,6 @@ dependencies = [ "indexmap", ] -[[package]] -name = "petgraph" -version = "0.8.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8701b58ea97060d5e5b155d383a69952a60943f0e6dfe30b04c287beb0b27455" -dependencies = [ - "fixedbitset", - "hashbrown 0.15.5", - "indexmap", -] - [[package]] name = "phf_shared" version = "0.11.3" @@ -3944,7 +3240,7 @@ dependencies = [ "log", "multimap", "once_cell", - "petgraph 0.7.1", + "petgraph", "prettyplease", "prost 0.14.1", "prost-types 0.14.1", @@ -4113,12 +3409,6 @@ version = "5.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" -[[package]] -name = "radium" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09" - [[package]] name = "rand" version = "0.9.2" @@ -4328,12 +3618,6 @@ version = "0.1.26" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "56f7d92ca342cea22a06f2121d944b4fd82af56988c270852495420f961d4ace" -[[package]] -name = "rustc-hash" -version = "2.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "357703d41365b4b27c590e3ed91eabb1b663f07c4c084095e60cbed4362dff0d" - [[package]] name = "rustc_version" version = "0.2.3" @@ -4431,15 +3715,6 @@ version = "1.0.22" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d" -[[package]] -name = "ruzstd" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fad02996bfc73da3e301efe90b1837be9ed8f4a462b6ed410aa35d00381de89f" -dependencies = [ - "twox-hash", -] - [[package]] name = "ryu" version = "1.0.20" @@ -4605,17 +3880,6 @@ dependencies = [ "serde_core", ] -[[package]] -name = "serde_repr" -version = "0.1.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "175ee3e80ae9982737ca543e96133087cbd9a485eecc3bc4de9c1a37b47ea59c" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "serde_spanned" version = "0.6.9" @@ -4701,12 +3965,6 @@ dependencies = [ "rand_core 0.6.4", ] -[[package]] -name = "simd-adler32" -version = "0.3.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e320a6c5ad31d271ad523dcf3ad13e2767ad8b1cb8f047f75a8aeaf8da139da2" - [[package]] name = "siphasher" version = "1.0.1" @@ -4724,9 +3982,6 @@ name = "smallvec" version = "1.15.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03" -dependencies = [ - "serde", -] [[package]] name = "smawk" @@ -4769,12 +4024,6 @@ version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" -[[package]] -name = "static_assertions" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" - [[package]] name = "string_cache" version = "0.8.9" @@ -4860,12 +4109,6 @@ dependencies = [ "syn", ] -[[package]] -name = "tap" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" - [[package]] name = "target-triple" version = "1.0.0" @@ -5115,7 +4358,7 @@ dependencies = [ "serde", "serde_spanned 0.6.9", "toml_datetime 0.6.11", - "toml_edit 0.22.27", + "toml_edit", ] [[package]] @@ -5165,21 +4408,6 @@ dependencies = [ "winnow", ] -[[package]] -name = "toml_edit" -version = "0.23.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d7cbc3b4b49633d57a0509303158ca50de80ae32c265093b24c414705807832" -dependencies = [ - "indexmap", - "serde_core", - "serde_spanned 1.0.3", - "toml_datetime 0.7.3", - "toml_parser", - "toml_writer", - "winnow", -] - [[package]] name = "toml_parser" version = "1.0.4" @@ -5494,34 +4722,12 @@ dependencies = [ "toml 0.9.8", ] -[[package]] -name = "twox-hash" -version = "1.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97fee6b57c6a41524a810daee9286c02d7752c4253064d0b05472833a438f675" -dependencies = [ - "cfg-if", - "static_assertions", -] - -[[package]] -name = "typed-arena" -version = "2.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6af6ae20167a9ece4bcb41af5b80f8a1f1df981f6391189ce00fd257af04126a" - [[package]] name = "typenum" version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "562d481066bde0658276a35467c4af00bdc6ee726305698a55b86e61d7ad82bb" -[[package]] -name = "ucd-trie" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2896d95c02a80c6d6a5d6e953d479f5ddf2dfdb6a244441010e373ac0fb88971" - [[package]] name = "unarray" version = "0.1.4" @@ -5555,12 +4761,6 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3b09c83c3c29d37506a3e260c08c03743a6bb66a9cd432c6934ab501a190571f" -[[package]] -name = "unicode-segmentation" -version = "1.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6ccf251212114b54433ec949fd6a7841275f9ada20dddd2f29e9ceea4501493" - [[package]] name = "unicode-width" version = "0.1.14" @@ -5757,17 +4957,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5be00faa2b4950c76fe618c409d2c3ea5a3c9422013e079482d78544bb2d184c" dependencies = [ "leb128fmt", - "wasmparser 0.239.0", -] - -[[package]] -name = "wasm-encoder" -version = "0.243.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c55db9c896d70bd9fa535ce83cd4e1f2ec3726b0edd2142079f594fc3be1cb35" -dependencies = [ - "leb128fmt", - "wasmparser 0.243.0", + "wasmparser", ] [[package]] @@ -5778,8 +4968,8 @@ checksum = "20b3ec880a9ac69ccd92fbdbcf46ee833071cf09f82bb005b2327c7ae6025ae2" dependencies = [ "anyhow", "indexmap", - "wasm-encoder 0.239.0", - "wasmparser 0.239.0", + "wasm-encoder", + "wasmparser", ] [[package]] @@ -5795,17 +4985,6 @@ dependencies = [ "web-sys", ] -[[package]] -name = "wasmparser" -version = "0.227.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f51cad774fb3c9461ab9bccc9c62dfb7388397b5deda31bf40e8108ccd678b2" -dependencies = [ - "bitflags", - "indexmap", - "semver 1.0.27", -] - [[package]] name = "wasmparser" version = "0.239.0" @@ -5818,39 +4997,6 @@ dependencies = [ "semver 1.0.27", ] -[[package]] -name = "wasmparser" -version = "0.243.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6d8db401b0528ec316dfbe579e6ab4152d61739cfe076706d2009127970159d" -dependencies = [ - "bitflags", - "indexmap", - "semver 1.0.27", -] - -[[package]] -name = "wast" -version = "243.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df21d01c2d91e46cb7a221d79e58a2d210ea02020d57c092e79255cc2999ca7f" -dependencies = [ - "bumpalo", - "leb128fmt", - "memchr", - "unicode-width 0.2.2", - "wasm-encoder 0.243.0", -] - -[[package]] -name = "wat" -version = "1.243.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "226a9a91cd80a50449312fef0c75c23478fcecfcc4092bdebe1dc8e760ef521b" -dependencies = [ - "wast", -] - [[package]] name = "web-sys" version = "0.3.83" @@ -6465,9 +5611,9 @@ dependencies = [ "serde", "serde_derive", "serde_json", - "wasm-encoder 0.239.0", + "wasm-encoder", "wasm-metadata", - "wasmparser 0.239.0", + "wasmparser", "wit-parser", ] @@ -6486,7 +5632,7 @@ dependencies = [ "serde_derive", "serde_json", "unicode-xid", - "wasmparser 0.239.0", + "wasmparser", ] [[package]] @@ -6501,15 +5647,6 @@ version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9edde0db4769d2dc68579893f2306b26c6ecfbe0ef499b013d731b7b9247e0b9" -[[package]] -name = "wyz" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05f360fc0b24296329c78fda852a1e9ae82de9cf7b27dae4b7f62f118f77b9ed" -dependencies = [ - "tap", -] - [[package]] name = "x25519-dalek" version = "2.0.1" diff --git a/Makefile b/Makefile index 523c8086..62c96e89 100644 --- a/Makefile +++ b/Makefile @@ -21,6 +21,8 @@ fix: ## Runs Fix with configs .PHONY: build build: ## By default we should build in release mode +## TODO: this requires cargo-miden v0.6 installed locally +# do it from a build.rs with a build dependency cd crates/mint-tx && cargo miden build --release && cd - cargo build --workspace --exclude miden-faucet-mint-tx --release diff --git a/crates/faucet/src/lib.rs b/crates/faucet/src/lib.rs index a8b4dd03..6babbce3 100644 --- a/crates/faucet/src/lib.rs +++ b/crates/faucet/src/lib.rs @@ -43,6 +43,7 @@ const KEYSTORE_PATH: &str = "keystore"; const DEFAULT_ACCOUNT_ID_SETTING: &str = "faucet_default_account_id"; // TODO: improve this +// use `MIDEN_PACKAGE_EXTENSION` from client const TX_PACKAGE: &[u8] = include_bytes!(concat!( env!("CARGO_MANIFEST_DIR"), "/../../target/miden/release/miden_faucet_mint_tx.masp" diff --git a/crates/mint-tx/Cargo.toml b/crates/mint-tx/Cargo.toml index 728b87b6..e7435835 100644 --- a/crates/mint-tx/Cargo.toml +++ b/crates/mint-tx/Cargo.toml @@ -11,10 +11,7 @@ crate-type = ["cdylib"] [dependencies] # Miden SDK consists of a stdlib (intrinsic functions for VM ops, stdlib functions and types) # and transaction kernel API for the Miden rollup -miden = { version = "0.7" } - -[build-dependencies] -cargo-miden = { version = "0.5" } +miden = { version = "0.8" } [package.metadata.component] package = "miden:mint-tx" diff --git a/crates/mint-tx/rust-toolchain.toml b/crates/mint-tx/rust-toolchain.toml index c003bcdc..2ec0b5bb 100644 --- a/crates/mint-tx/rust-toolchain.toml +++ b/crates/mint-tx/rust-toolchain.toml @@ -1,5 +1,5 @@ [toolchain] -channel = "nightly-2025-07-20" +channel = "nightly-2025-12-10" components = ["rustfmt", "rust-src", "llvm-tools"] targets = [ "wasm32-wasip2" ] profile = "minimal" From 3f46464502fc2076785fe42798bfcc85774fcae1 Mon Sep 17 00:00:00 2001 From: tomasarrachea Date: Mon, 5 Jan 2026 17:35:39 -0300 Subject: [PATCH 06/19] feat: compile on faucet load --- Cargo.lock | 937 +++++++++++++++++- Cargo.toml | 6 +- Makefile | 7 +- bin/faucet/src/main.rs | 6 +- crates/{ => contracts}/mint-tx/.gitignore | 0 crates/contracts/mint-tx/Cargo.toml | 16 + crates/{ => contracts}/mint-tx/README.md | 0 crates/{ => contracts}/mint-tx/src/lib.rs | 0 crates/{ => contracts}/mint-tx/wit/.gitkeep | 0 crates/faucet/Cargo.toml | 1 + crates/faucet/src/lib.rs | 41 +- crates/faucet/src/package.rs | 42 + crates/mint-tx/Cargo.toml | 20 - ...rust-toolchain.toml => rust-toolchain.toml | 0 14 files changed, 978 insertions(+), 98 deletions(-) rename crates/{ => contracts}/mint-tx/.gitignore (100%) create mode 100644 crates/contracts/mint-tx/Cargo.toml rename crates/{ => contracts}/mint-tx/README.md (100%) rename crates/{ => contracts}/mint-tx/src/lib.rs (100%) rename crates/{ => contracts}/mint-tx/wit/.gitkeep (100%) create mode 100644 crates/faucet/src/package.rs delete mode 100644 crates/mint-tx/Cargo.toml rename crates/mint-tx/rust-toolchain.toml => rust-toolchain.toml (100%) diff --git a/Cargo.lock b/Cargo.lock index 2d6aaa18..36a1fce7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -12,13 +12,29 @@ dependencies = [ "regex", ] +[[package]] +name = "addr2line" +version = "0.24.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfbe277e56a376000877090da837660b4427aad530e3028d44e0bffe4f89a1c1" +dependencies = [ + "cpp_demangle", + "fallible-iterator", + "gimli 0.31.1", + "memmap2", + "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", + "gimli 0.32.3", ] [[package]] @@ -52,6 +68,12 @@ version = "0.2.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" +[[package]] +name = "allocator-api2" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c880a97d28a3681c0267bd29cff89621202715b065127cd445fa0f0fe0aa2880" + [[package]] name = "android_system_properties" version = "0.1.5" @@ -120,6 +142,12 @@ dependencies = [ "backtrace", ] +[[package]] +name = "anymap2" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d301b3b94cb4b2f23d7917810addbbaff90738e0ca2be692bd027e70d7e0330c" + [[package]] name = "arrayref" version = "0.3.9" @@ -253,11 +281,11 @@ version = "0.3.76" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bb531853791a215d7c62a30daf0dde835f381ab5de4589cfe7c649d2cbe92bd6" dependencies = [ - "addr2line", + "addr2line 0.25.1", "cfg-if", "libc", "miniz_oxide", - "object", + "object 0.37.3", "rustc-demangle", "windows-link 0.2.1", ] @@ -322,6 +350,18 @@ version = "2.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "812e12b5285cc515a9c72a5c1d3b6d46a19dac5acfef5265968c166106e31dd3" +[[package]] +name = "bitvec" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bc2832c24239b0141d5674bb9174f9d68a8b5b3f2753311927c172ca46f7e9c" +dependencies = [ + "funty", + "radium", + "tap", + "wyz", +] + [[package]] name = "blake3" version = "1.8.2" @@ -335,6 +375,15 @@ dependencies = [ "constant_time_eq", ] +[[package]] +name = "blink-alloc" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce4c15bad517bc0fb4a44523adf470e2c3eb3a365769327acdba849948ea3705" +dependencies = [ + "allocator-api2 0.4.0", +] + [[package]] name = "block-buffer" version = "0.10.4" @@ -368,6 +417,70 @@ version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b35204fbdc0b3f4446b89fc1ac2cf84a8a68971995d0bf2e925ec7cd960f9cb3" +[[package]] +name = "camino" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e629a66d692cb9ff1a1c664e41771b3dcaf961985a9774c0eb0bd1b51cf60a48" +dependencies = [ + "serde_core", +] + +[[package]] +name = "cargo-miden" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05033ddc634e118a624d5753bcab80b0b8a7155f7a867a6095f11fc4e9cdcc59" +dependencies = [ + "anyhow", + "cargo_metadata", + "clap", + "env_logger", + "liquid", + "log", + "midenc-compile", + "midenc-session", + "path-absolutize", + "semver 1.0.27", + "serde", + "serde_json", + "tempfile", + "toml_edit 0.23.9", + "walkdir", +] + +[[package]] +name = "cargo-platform" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e35af189006b9c0f00a064685c727031e3ed2d8020f7ba284d78cc2671bd36ea" +dependencies = [ + "serde", +] + +[[package]] +name = "cargo_metadata" +version = "0.19.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd5eb614ed4c27c5d706420e4320fbe3216ab31fa1c33cd8246ac36dae4479ba" +dependencies = [ + "camino", + "cargo-platform", + "semver 1.0.27", + "serde", + "serde_json", + "thiserror 2.0.17", +] + +[[package]] +name = "castaway" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dec551ab6e7578819132c713a93c022a05d60159dc86e7a7050223577484c55a" +dependencies = [ + "rustversion", +] + [[package]] name = "cc" version = "1.2.48" @@ -480,6 +593,20 @@ version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75" +[[package]] +name = "compact_str" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3fdb1325a1cece981e8a296ab8f0f9b63ae357bd0784a9faaf548cc7b480707a" +dependencies = [ + "castaway", + "cfg-if", + "itoa", + "rustversion", + "ryu", + "static_assertions", +] + [[package]] name = "const-oid" version = "0.9.6" @@ -548,6 +675,15 @@ dependencies = [ "libm", ] +[[package]] +name = "cpp_demangle" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2bb79cb74d735044c972aae58ed0aaa9a837e85b01106a54c39e42e97f62253" +dependencies = [ + "cfg-if", +] + [[package]] name = "cpufeatures" version = "0.2.17" @@ -557,6 +693,30 @@ dependencies = [ "libc", ] +[[package]] +name = "cranelift-bitset" +version = "0.120.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db7b2ee9eec6ca8a716d900d5264d678fb2c290c58c46c8da7f94ee268175d17" + +[[package]] +name = "cranelift-entity" +version = "0.120.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d75418674520cb400c8772bfd6e11a62736c78fc1b6e418195696841d1bf91f1" +dependencies = [ + "cranelift-bitset", +] + +[[package]] +name = "crc32fast" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9481c1c90cbf2ac953f07c8d4a58aa3945c425b7185c9154d67a65e4230da511" +dependencies = [ + "cfg-if", +] + [[package]] name = "crossbeam-deque" version = "0.8.6" @@ -632,6 +792,41 @@ dependencies = [ "syn", ] +[[package]] +name = "darling" +version = "0.20.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc7f46116c46ff9ab3eb1597a45688b6715c6e628b5c133e288e709a29bcb4ee" +dependencies = [ + "darling_core", + "darling_macro", +] + +[[package]] +name = "darling_core" +version = "0.20.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d00b9596d185e565c2207a0b01f8bd1a135483d02d9b7b0a54b11da8d53412e" +dependencies = [ + "fnv", + "ident_case", + "proc-macro2", + "quote", + "strsim", + "syn", +] + +[[package]] +name = "darling_macro" +version = "0.20.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc34b93ccb385b40dc71c6fceac4b2ad23662c7eeb248cf10d529b7e055b6ead" +dependencies = [ + "darling_core", + "quote", + "syn", +] + [[package]] name = "deadpool" version = "0.12.3" @@ -939,6 +1134,16 @@ version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1d674e81391d1e1ab681a28d99df07927c6d4aa5b027d7da16ba32d1d21ecd99" +[[package]] +name = "flate2" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfe33edd8e85a12a67454e37f8c75e730830d83e313556ab9ebf9ee7fbeb3bfb" +dependencies = [ + "crc32fast", + "miniz_oxide", +] + [[package]] name = "flume" version = "0.11.1" @@ -1002,6 +1207,12 @@ dependencies = [ "autocfg", ] +[[package]] +name = "funty" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" + [[package]] name = "futures" version = "0.3.31" @@ -1143,6 +1354,16 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "gimli" +version = "0.31.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f" +dependencies = [ + "fallible-iterator", + "stable_deref_trait", +] + [[package]] name = "gimli" version = "0.32.3" @@ -1191,6 +1412,8 @@ version = "0.15.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1" dependencies = [ + "allocator-api2 0.2.21", + "equivalent", "foldhash 0.1.5", ] @@ -1200,7 +1423,7 @@ version = "0.16.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100" dependencies = [ - "allocator-api2", + "allocator-api2 0.2.21", "equivalent", "foldhash 0.2.0", "rayon", @@ -1576,6 +1799,12 @@ version = "2.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "25a2bc672d1148e28034f176e01fffebb08b35768468cc954630da77a1449005" +[[package]] +name = "ident_case" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" + [[package]] name = "idna" version = "1.1.0" @@ -1630,6 +1859,24 @@ dependencies = [ "generic-array", ] +[[package]] +name = "intrusive-collections" +version = "0.9.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "189d0897e4cbe8c75efedf3502c18c887b05046e59d28404d4d8e46cbc4d1e86" +dependencies = [ + "memoffset", +] + +[[package]] +name = "inventory" +version = "0.3.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc61209c082fbeb19919bee74b176221b27223e27b65d781eb91af24eb1fb46e" +dependencies = [ + "rustversion", +] + [[package]] name = "ipnet" version = "2.11.0" @@ -1740,6 +1987,16 @@ dependencies = [ "cpufeatures", ] +[[package]] +name = "kstring" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "558bf9508a558512042d3095138b1f7b8fe90c5467d94f9f1da28b3731c5dbd1" +dependencies = [ + "serde", + "static_assertions", +] + [[package]] name = "lalrpop" version = "0.22.2" @@ -1751,7 +2008,7 @@ dependencies = [ "ena", "itertools", "lalrpop-util", - "petgraph", + "petgraph 0.7.1", "regex", "regex-syntax", "sha3", @@ -1817,6 +2074,60 @@ version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "df1d3c3b53da64cf5760482273a98e575c651a67eec7f77df96b5b642de8f039" +[[package]] +name = "liquid" +version = "0.26.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a494c3f9dad3cb7ed16f1c51812cbe4b29493d6c2e5cd1e2b87477263d9534d" +dependencies = [ + "liquid-core", + "liquid-derive", + "liquid-lib", + "serde", +] + +[[package]] +name = "liquid-core" +version = "0.26.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc623edee8a618b4543e8e8505584f4847a4e51b805db1af6d9af0a3395d0d57" +dependencies = [ + "anymap2", + "itertools", + "kstring", + "liquid-derive", + "pest", + "pest_derive", + "regex", + "serde", + "time", +] + +[[package]] +name = "liquid-derive" +version = "0.26.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de66c928222984aea59fcaed8ba627f388aaac3c1f57dcb05cc25495ef8faefe" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "liquid-lib" +version = "0.26.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9befeedd61f5995bc128c571db65300aeb50d62e4f0542c88282dbcb5f72372a" +dependencies = [ + "itertools", + "liquid-core", + "percent-encoding", + "regex", + "time", + "unicode-segmentation", +] + [[package]] name = "litemap" version = "0.7.5" @@ -1945,6 +2256,24 @@ version = "2.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f52b00d39961fc5b2736ea853c9cc86238e165017a493d1d5c8eac6bdc4cc273" +[[package]] +name = "memmap2" +version = "0.9.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "744133e4a0e0a658e1374cf3bf8e415c4052a15a111acd372764c55b4177d490" +dependencies = [ + "libc", +] + +[[package]] +name = "memoffset" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a" +dependencies = [ + "autocfg", +] + [[package]] name = "miden" version = "0.8.0" @@ -2236,6 +2565,7 @@ name = "miden-faucet-lib" version = "0.13.0" dependencies = [ "anyhow", + "cargo-miden", "miden-client", "miden-client-sqlite-store", "rand", @@ -2558,75 +2888,307 @@ dependencies = [ ] [[package]] -name = "miden-tx" -version = "0.12.4" +name = "miden-thiserror" +version = "1.0.59" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "183ff8de338956ecfde3a38573241eb7a6f3d44d73866c210e5629c07fa00253" +dependencies = [ + "miden-thiserror-impl", +] + +[[package]] +name = "miden-thiserror-impl" +version = "1.0.59" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ee4176a0f2e7d29d2a8ee7e60b6deb14ce67a20e94c3e2c7275cdb8804e1862" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "miden-tx" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d959064f99ce09fc38e9b6b4dc24c3fa80a63072bf5840a1074ca4ed5e9c911" +dependencies = [ + "miden-lib", + "miden-objects", + "miden-processor", + "miden-prover", + "miden-verifier", + "rand", + "thiserror 2.0.17", + "tokio", +] + +[[package]] +name = "miden-tx-batch-prover" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f5029810b106654a1ec5d7d7123945db91b96bc4f4187715d0c2cfe0b0a53af4" +dependencies = [ + "miden-objects", + "miden-tx", +] + +[[package]] +name = "miden-utils-diagnostics" +version = "0.19.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a3ff4c019d96539a7066626efb4dce5c9fb7b0e44e961b0c2571e78f34236d5" +dependencies = [ + "miden-crypto", + "miden-debug-types", + "miden-miette", + "paste", + "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.17", +] + +[[package]] +name = "miden-utils-sync" +version = "0.19.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "feebe7d896c013ea74dbc98de978836606356a044d4ed3b61ded54d3b319d89f" +dependencies = [ + "lock_api", + "loom", + "parking_lot", +] + +[[package]] +name = "miden-verifier" +version = "0.19.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8f8e47b78bba1fe1b31faee8f12aafd95385f6d6a8b108b03e92f5d743bb29f" +dependencies = [ + "miden-air", + "miden-core", + "thiserror 2.0.17", + "tracing", + "winter-verifier", +] + +[[package]] +name = "midenc-codegen-masm" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c593fbe5a29c22fa8908ccbef3f03dc8263ced451fa738c1a6ff91142c1089ed" +dependencies = [ + "inventory", + "log", + "miden-assembly", + "miden-assembly-syntax", + "miden-core", + "miden-lib", + "miden-mast-package", + "miden-processor", + "miden-thiserror", + "midenc-dialect-arith", + "midenc-dialect-cf", + "midenc-dialect-hir", + "midenc-dialect-scf", + "midenc-dialect-ub", + "midenc-hir", + "midenc-hir-analysis", + "midenc-session", + "petgraph 0.8.3", + "serde", + "smallvec", +] + +[[package]] +name = "midenc-compile" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aebe203b423774601baae4a660a04f342a55879b1a3d0fd2356f40a0f081565c" +dependencies = [ + "clap", + "inventory", + "log", + "miden-assembly", + "miden-mast-package", + "miden-thiserror", + "midenc-codegen-masm", + "midenc-dialect-hir", + "midenc-dialect-scf", + "midenc-frontend-wasm", + "midenc-hir", + "midenc-hir-transform", + "midenc-session", + "wat", +] + +[[package]] +name = "midenc-dialect-arith" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24aa5f49e5cb14eaa60633ea078d4c65493a8aecf75e09956861475a586baee3" +dependencies = [ + "midenc-hir", + "paste", +] + +[[package]] +name = "midenc-dialect-cf" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57fa897b76fa999cafabf287c993d09b9a4c7f204d3e92ec371d3f45c60560aa" +dependencies = [ + "log", + "midenc-dialect-arith", + "midenc-hir", +] + +[[package]] +name = "midenc-dialect-hir" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9d3957efe6f3acfb5e471cdeb17269140ffeaabed9c01ef15ed02ee489b6b07" +dependencies = [ + "log", + "midenc-dialect-arith", + "midenc-dialect-cf", + "midenc-hir", + "midenc-hir-analysis", + "midenc-hir-transform", +] + +[[package]] +name = "midenc-dialect-scf" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8937b92ab53960c703ce87254dc3b816ab698f3b69d80a845ff21737bda6c851" +dependencies = [ + "bitvec", + "log", + "midenc-dialect-arith", + "midenc-dialect-cf", + "midenc-dialect-ub", + "midenc-hir", + "midenc-hir-transform", +] + +[[package]] +name = "midenc-dialect-ub" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "daec6ae79c9aef0fe960a7d0b8b4fe02f773a5fc5a23d70cdaebd83ed49579cf" +dependencies = [ + "midenc-hir", +] + +[[package]] +name = "midenc-frontend-wasm" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d959064f99ce09fc38e9b6b4dc24c3fa80a63072bf5840a1074ca4ed5e9c911" +checksum = "778cb061e4506859923fef201a4758d8075e64d0df0c5fac87c4e28de7236ca4" dependencies = [ - "miden-lib", - "miden-objects", - "miden-processor", - "miden-prover", - "miden-verifier", - "rand", - "thiserror 2.0.17", - "tokio", + "addr2line 0.24.2", + "anyhow", + "cranelift-entity", + "gimli 0.31.1", + "indexmap", + "log", + "miden-core", + "miden-thiserror", + "midenc-dialect-arith", + "midenc-dialect-cf", + "midenc-dialect-hir", + "midenc-dialect-ub", + "midenc-hir", + "midenc-hir-symbol", + "midenc-session", + "wasmparser 0.227.1", ] [[package]] -name = "miden-tx-batch-prover" -version = "0.12.4" +name = "midenc-hir" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f5029810b106654a1ec5d7d7123945db91b96bc4f4187715d0c2cfe0b0a53af4" +checksum = "14e5dbaea7cd40dec41532b95510d250520f873bf253120d9f09e1be03542b95" dependencies = [ - "miden-objects", - "miden-tx", + "anyhow", + "bitflags", + "bitvec", + "blink-alloc", + "compact_str", + "hashbrown 0.15.5", + "intrusive-collections", + "inventory", + "log", + "miden-core", + "miden-thiserror", + "midenc-hir-macros", + "midenc-hir-symbol", + "midenc-hir-type", + "midenc-session", + "rustc-demangle", + "rustc-hash", + "semver 1.0.27", + "smallvec", ] [[package]] -name = "miden-utils-diagnostics" -version = "0.19.1" +name = "midenc-hir-analysis" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a3ff4c019d96539a7066626efb4dce5c9fb7b0e44e961b0c2571e78f34236d5" +checksum = "42332ac887ee10791c1f6665caa5b9f801cd69114f653493671ff562db224d34" dependencies = [ - "miden-crypto", - "miden-debug-types", - "miden-miette", - "paste", - "tracing", + "bitvec", + "blink-alloc", + "log", + "midenc-hir", ] [[package]] -name = "miden-utils-indexing" -version = "0.19.1" +name = "midenc-hir-macros" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c798250bee4e856d4f18c161e91cdcbef1906f6614d00cf0063b47031c0f8cc6" +checksum = "914e05b299b7a04bf780f3cb58d58cda6dff164b25c1f51e8d76ffe59a07ba3d" dependencies = [ - "thiserror 2.0.17", + "Inflector", + "darling", + "proc-macro2", + "quote", + "syn", ] [[package]] -name = "miden-utils-sync" -version = "0.19.1" +name = "midenc-hir-symbol" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "feebe7d896c013ea74dbc98de978836606356a044d4ed3b61ded54d3b319d89f" +checksum = "dbf53056c60f2e2369f25f3be2360d6bf94497c61daa2e24c198e23a9b562a98" dependencies = [ + "Inflector", + "hashbrown 0.15.5", "lock_api", - "loom", + "miden-formatting", "parking_lot", + "rustc-hash", + "toml 0.8.23", ] [[package]] -name = "miden-verifier" -version = "0.19.1" +name = "midenc-hir-transform" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8f8e47b78bba1fe1b31faee8f12aafd95385f6d6a8b108b03e92f5d743bb29f" +checksum = "2c844fda35dfcfe75eac74d029c55e477a4567c700ec0fb08e43d91a26bf3664" dependencies = [ - "miden-air", - "miden-core", - "thiserror 2.0.17", - "tracing", - "winter-verifier", + "log", + "midenc-hir", + "midenc-hir-analysis", + "midenc-session", ] [[package]] @@ -2636,10 +3198,36 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9d4cfab04baffdda3fb9eafa5f873604059b89a1699aa95e4f1057397a69f0b5" dependencies = [ "miden-formatting", + "serde", + "serde_repr", "smallvec", "thiserror 2.0.17", ] +[[package]] +name = "midenc-session" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c936d173f02ecb487e176d8a9cc9f390355d053f0d37412eed0ff8a10088244" +dependencies = [ + "anyhow", + "clap", + "inventory", + "log", + "miden-assembly", + "miden-assembly-syntax", + "miden-core", + "miden-debug-types", + "miden-lib", + "miden-mast-package", + "miden-stdlib", + "miden-thiserror", + "midenc-hir-macros", + "midenc-hir-symbol", + "parking_lot", + "termcolor", +] + [[package]] name = "miette" version = "7.6.0" @@ -2683,6 +3271,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316" dependencies = [ "adler2", + "simd-adler32", ] [[package]] @@ -2844,6 +3433,17 @@ dependencies = [ "libc", ] +[[package]] +name = "object" +version = "0.36.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62948e14d923ea95ea2c7c86c71013138b66525b86bdc08d2dcc262bdb497b87" +dependencies = [ + "flate2", + "memchr", + "ruzstd", +] + [[package]] name = "object" version = "0.37.3" @@ -3010,6 +3610,24 @@ version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" +[[package]] +name = "path-absolutize" +version = "3.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e4af381fe79fa195b4909485d99f73a80792331df0625188e707854f0b3383f5" +dependencies = [ + "path-dedot", +] + +[[package]] +name = "path-dedot" +version = "3.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07ba0ad7e047712414213ff67533e6dd477af0a4e1d14fb52343e53d30ea9397" +dependencies = [ + "once_cell", +] + [[package]] name = "pear" version = "0.2.9" @@ -3039,6 +3657,49 @@ version = "2.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" +[[package]] +name = "pest" +version = "2.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c9eb05c21a464ea704b53158d358a31e6425db2f63a1a7312268b05fe2b75f7" +dependencies = [ + "memchr", + "ucd-trie", +] + +[[package]] +name = "pest_derive" +version = "2.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68f9dbced329c441fa79d80472764b1a2c7e57123553b8519b36663a2fb234ed" +dependencies = [ + "pest", + "pest_generator", +] + +[[package]] +name = "pest_generator" +version = "2.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3bb96d5051a78f44f43c8f712d8e810adb0ebf923fc9ed2655a7f66f63ba8ee5" +dependencies = [ + "pest", + "pest_meta", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "pest_meta" +version = "2.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "602113b5b5e8621770cfd490cfd90b9f84ab29bd2b0e49ad83eb6d186cef2365" +dependencies = [ + "pest", + "sha2", +] + [[package]] name = "petgraph" version = "0.7.1" @@ -3049,6 +3710,17 @@ dependencies = [ "indexmap", ] +[[package]] +name = "petgraph" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8701b58ea97060d5e5b155d383a69952a60943f0e6dfe30b04c287beb0b27455" +dependencies = [ + "fixedbitset", + "hashbrown 0.15.5", + "indexmap", +] + [[package]] name = "phf_shared" version = "0.11.3" @@ -3240,7 +3912,7 @@ dependencies = [ "log", "multimap", "once_cell", - "petgraph", + "petgraph 0.7.1", "prettyplease", "prost 0.14.1", "prost-types 0.14.1", @@ -3409,6 +4081,12 @@ version = "5.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" +[[package]] +name = "radium" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09" + [[package]] name = "rand" version = "0.9.2" @@ -3618,6 +4296,12 @@ version = "0.1.26" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "56f7d92ca342cea22a06f2121d944b4fd82af56988c270852495420f961d4ace" +[[package]] +name = "rustc-hash" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "357703d41365b4b27c590e3ed91eabb1b663f07c4c084095e60cbed4362dff0d" + [[package]] name = "rustc_version" version = "0.2.3" @@ -3715,6 +4399,15 @@ version = "1.0.22" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d" +[[package]] +name = "ruzstd" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fad02996bfc73da3e301efe90b1837be9ed8f4a462b6ed410aa35d00381de89f" +dependencies = [ + "twox-hash", +] + [[package]] name = "ryu" version = "1.0.20" @@ -3880,6 +4573,17 @@ dependencies = [ "serde_core", ] +[[package]] +name = "serde_repr" +version = "0.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "175ee3e80ae9982737ca543e96133087cbd9a485eecc3bc4de9c1a37b47ea59c" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "serde_spanned" version = "0.6.9" @@ -3965,6 +4669,12 @@ dependencies = [ "rand_core 0.6.4", ] +[[package]] +name = "simd-adler32" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e320a6c5ad31d271ad523dcf3ad13e2767ad8b1cb8f047f75a8aeaf8da139da2" + [[package]] name = "siphasher" version = "1.0.1" @@ -3982,6 +4692,9 @@ name = "smallvec" version = "1.15.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03" +dependencies = [ + "serde", +] [[package]] name = "smawk" @@ -4024,6 +4737,12 @@ version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" +[[package]] +name = "static_assertions" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" + [[package]] name = "string_cache" version = "0.8.9" @@ -4109,6 +4828,12 @@ dependencies = [ "syn", ] +[[package]] +name = "tap" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" + [[package]] name = "target-triple" version = "1.0.0" @@ -4358,7 +5083,7 @@ dependencies = [ "serde", "serde_spanned 0.6.9", "toml_datetime 0.6.11", - "toml_edit", + "toml_edit 0.22.27", ] [[package]] @@ -4408,6 +5133,21 @@ dependencies = [ "winnow", ] +[[package]] +name = "toml_edit" +version = "0.23.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d7cbc3b4b49633d57a0509303158ca50de80ae32c265093b24c414705807832" +dependencies = [ + "indexmap", + "serde_core", + "serde_spanned 1.0.3", + "toml_datetime 0.7.3", + "toml_parser", + "toml_writer", + "winnow", +] + [[package]] name = "toml_parser" version = "1.0.4" @@ -4722,12 +5462,34 @@ dependencies = [ "toml 0.9.8", ] +[[package]] +name = "twox-hash" +version = "1.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97fee6b57c6a41524a810daee9286c02d7752c4253064d0b05472833a438f675" +dependencies = [ + "cfg-if", + "static_assertions", +] + +[[package]] +name = "typed-arena" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6af6ae20167a9ece4bcb41af5b80f8a1f1df981f6391189ce00fd257af04126a" + [[package]] name = "typenum" version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "562d481066bde0658276a35467c4af00bdc6ee726305698a55b86e61d7ad82bb" +[[package]] +name = "ucd-trie" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2896d95c02a80c6d6a5d6e953d479f5ddf2dfdb6a244441010e373ac0fb88971" + [[package]] name = "unarray" version = "0.1.4" @@ -4761,6 +5523,12 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3b09c83c3c29d37506a3e260c08c03743a6bb66a9cd432c6934ab501a190571f" +[[package]] +name = "unicode-segmentation" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6ccf251212114b54433ec949fd6a7841275f9ada20dddd2f29e9ceea4501493" + [[package]] name = "unicode-width" version = "0.1.14" @@ -4957,7 +5725,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5be00faa2b4950c76fe618c409d2c3ea5a3c9422013e079482d78544bb2d184c" dependencies = [ "leb128fmt", - "wasmparser", + "wasmparser 0.239.0", +] + +[[package]] +name = "wasm-encoder" +version = "0.243.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c55db9c896d70bd9fa535ce83cd4e1f2ec3726b0edd2142079f594fc3be1cb35" +dependencies = [ + "leb128fmt", + "wasmparser 0.243.0", ] [[package]] @@ -4968,8 +5746,8 @@ checksum = "20b3ec880a9ac69ccd92fbdbcf46ee833071cf09f82bb005b2327c7ae6025ae2" dependencies = [ "anyhow", "indexmap", - "wasm-encoder", - "wasmparser", + "wasm-encoder 0.239.0", + "wasmparser 0.239.0", ] [[package]] @@ -4985,6 +5763,17 @@ dependencies = [ "web-sys", ] +[[package]] +name = "wasmparser" +version = "0.227.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f51cad774fb3c9461ab9bccc9c62dfb7388397b5deda31bf40e8108ccd678b2" +dependencies = [ + "bitflags", + "indexmap", + "semver 1.0.27", +] + [[package]] name = "wasmparser" version = "0.239.0" @@ -4997,6 +5786,39 @@ dependencies = [ "semver 1.0.27", ] +[[package]] +name = "wasmparser" +version = "0.243.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6d8db401b0528ec316dfbe579e6ab4152d61739cfe076706d2009127970159d" +dependencies = [ + "bitflags", + "indexmap", + "semver 1.0.27", +] + +[[package]] +name = "wast" +version = "243.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df21d01c2d91e46cb7a221d79e58a2d210ea02020d57c092e79255cc2999ca7f" +dependencies = [ + "bumpalo", + "leb128fmt", + "memchr", + "unicode-width 0.2.2", + "wasm-encoder 0.243.0", +] + +[[package]] +name = "wat" +version = "1.243.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "226a9a91cd80a50449312fef0c75c23478fcecfcc4092bdebe1dc8e760ef521b" +dependencies = [ + "wast", +] + [[package]] name = "web-sys" version = "0.3.83" @@ -5611,9 +6433,9 @@ dependencies = [ "serde", "serde_derive", "serde_json", - "wasm-encoder", + "wasm-encoder 0.239.0", "wasm-metadata", - "wasmparser", + "wasmparser 0.239.0", "wit-parser", ] @@ -5632,7 +6454,7 @@ dependencies = [ "serde_derive", "serde_json", "unicode-xid", - "wasmparser", + "wasmparser 0.239.0", ] [[package]] @@ -5647,6 +6469,15 @@ version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9edde0db4769d2dc68579893f2306b26c6ecfbe0ef499b013d731b7b9247e0b9" +[[package]] +name = "wyz" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05f360fc0b24296329c78fda852a1e9ae82de9cf7b27dae4b7f62f118f77b9ed" +dependencies = [ + "tap", +] + [[package]] name = "x25519-dalek" version = "2.0.1" diff --git a/Cargo.toml b/Cargo.toml index 4ddf49aa..0831128f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,6 @@ [workspace] -members = ["bin/faucet", "crates/faucet", "crates/pow", "crates/mint-tx"] +members = ["bin/faucet", "crates/faucet", "crates/pow", "crates/contracts/mint-tx"] +exclude = ["crates/contracts/mint-tx"] resolver = "2" @@ -21,11 +22,12 @@ opt-level = 2 [workspace.dependencies] miden-faucet-lib = { path = "crates/faucet", version = "0.13" } miden-pow-rate-limiter = { path = "crates/pow", version = "0.13" } -miden-faucet-mint-tx = { path = "crates/mint-script", version = "0.13" } # Miden dependencies. miden-client = { version = "0.12" } miden-client-sqlite-store = { version = "0.12" } +miden = { version = "0.8" } +cargo-miden = { version = "0.6" } # External dependencies anyhow = { version = "1.0" } diff --git a/Makefile b/Makefile index 62c96e89..b915e4ea 100644 --- a/Makefile +++ b/Makefile @@ -21,10 +21,7 @@ fix: ## Runs Fix with configs .PHONY: build build: ## By default we should build in release mode -## TODO: this requires cargo-miden v0.6 installed locally -# do it from a build.rs with a build dependency - cd crates/mint-tx && cargo miden build --release && cd - - cargo build --workspace --exclude miden-faucet-mint-tx --release + cargo build --workspace --release .PHONY: format format: ## Runs Format using nightly toolchain @@ -70,7 +67,7 @@ book: ## Builds the book & serves documentation site # --- testing ------------------------------------------------------------------------------------- .PHONY: test -test: ## Runs all tests +test: ## Runs all tests cargo nextest run --release --all-features --workspace # --- checking ------------------------------------------------------------------------------------ diff --git a/bin/faucet/src/main.rs b/bin/faucet/src/main.rs index 316d82c0..bec82f88 100644 --- a/bin/faucet/src/main.rs +++ b/bin/faucet/src/main.rs @@ -15,7 +15,11 @@ use anyhow::Context; use clap::{Parser, Subcommand}; use miden_client::account::component::{AuthRpoFalcon512, BasicFungibleFaucet}; use miden_client::account::{ - Account, AccountBuilder, AccountFile, AccountStorageMode, AccountType, + Account, + AccountBuilder, + AccountFile, + AccountStorageMode, + AccountType, }; use miden_client::asset::TokenSymbol; use miden_client::auth::AuthSecretKey; diff --git a/crates/mint-tx/.gitignore b/crates/contracts/mint-tx/.gitignore similarity index 100% rename from crates/mint-tx/.gitignore rename to crates/contracts/mint-tx/.gitignore diff --git a/crates/contracts/mint-tx/Cargo.toml b/crates/contracts/mint-tx/Cargo.toml new file mode 100644 index 00000000..4012dc4e --- /dev/null +++ b/crates/contracts/mint-tx/Cargo.toml @@ -0,0 +1,16 @@ +[package] +name = "miden-faucet-mint-tx" +version.workspace = true +edition.workspace = true + +[lib] +crate-type = ["cdylib"] + +[dependencies] +miden = { workspace = true } + +[package.metadata.component] +package = "miden:mint-tx" + +[package.metadata.miden] +project-kind = "transaction-script" diff --git a/crates/mint-tx/README.md b/crates/contracts/mint-tx/README.md similarity index 100% rename from crates/mint-tx/README.md rename to crates/contracts/mint-tx/README.md diff --git a/crates/mint-tx/src/lib.rs b/crates/contracts/mint-tx/src/lib.rs similarity index 100% rename from crates/mint-tx/src/lib.rs rename to crates/contracts/mint-tx/src/lib.rs diff --git a/crates/mint-tx/wit/.gitkeep b/crates/contracts/mint-tx/wit/.gitkeep similarity index 100% rename from crates/mint-tx/wit/.gitkeep rename to crates/contracts/mint-tx/wit/.gitkeep diff --git a/crates/faucet/Cargo.toml b/crates/faucet/Cargo.toml index 5d080ff2..d29e1ea7 100644 --- a/crates/faucet/Cargo.toml +++ b/crates/faucet/Cargo.toml @@ -18,6 +18,7 @@ workspace = true # Miden dependencies. miden-client = { features = ["tonic"], workspace = true } miden-client-sqlite-store = { workspace = true } +cargo-miden = { workspace = true } # External dependencies. anyhow = { workspace = true } diff --git a/crates/faucet/src/lib.rs b/crates/faucet/src/lib.rs index 6babbce3..2fb6528f 100644 --- a/crates/faucet/src/lib.rs +++ b/crates/faucet/src/lib.rs @@ -1,5 +1,5 @@ use std::collections::BTreeSet; -use std::path::PathBuf; +use std::path::{Path, PathBuf}; use std::sync::Arc; use std::time::Duration; @@ -16,11 +16,15 @@ use miden_client::rpc::{Endpoint, GrpcClient}; use miden_client::store::{NoteFilter, TransactionFilter}; use miden_client::sync::{StateSync, SyncSummary}; use miden_client::transaction::{ - LocalTransactionProver, TransactionId, TransactionProver, TransactionRequest, - TransactionRequestBuilder, TransactionRequestError, TransactionScript, + LocalTransactionProver, + TransactionId, + TransactionProver, + TransactionRequest, + TransactionRequestBuilder, + TransactionRequestError, + TransactionScript, }; -use miden_client::utils::{Deserializable, RwLock}; -use miden_client::vm::Package; +use miden_client::utils::RwLock; use miden_client::{Client, ClientError, Felt, RemoteTransactionProver, Word}; use miden_client_sqlite_store::SqliteStore; use rand::rngs::StdRng; @@ -30,10 +34,12 @@ use tracing::{Instrument, error, info, info_span, instrument, warn}; use url::Url; mod note_screener; +mod package; pub mod requests; pub mod types; use crate::note_screener::NoteScreener; +use crate::package::build_project_in_dir; use crate::requests::{MintError, MintRequest, MintResponse, MintResponseSender}; use crate::types::AssetAmount; @@ -41,13 +47,7 @@ const COMPONENT: &str = "miden-faucet-client"; const KEYSTORE_PATH: &str = "keystore"; const DEFAULT_ACCOUNT_ID_SETTING: &str = "faucet_default_account_id"; - -// TODO: improve this -// use `MIDEN_PACKAGE_EXTENSION` from client -const TX_PACKAGE: &[u8] = include_bytes!(concat!( - env!("CARGO_MANIFEST_DIR"), - "/../../target/miden/release/miden_faucet_mint_tx.masp" -)); +const MINT_TX_SCRIPT_SETTING: &str = "mint_tx_script"; // FAUCET CLIENT // ================================================================================================ @@ -141,6 +141,14 @@ impl Faucet { } client.set_setting(DEFAULT_ACCOUNT_ID_SETTING.to_owned(), account.id()).await?; + // Compile the mint tx script + let workspace_root = Path::new(env!("CARGO_MANIFEST_DIR")); + let package = build_project_in_dir(&workspace_root.join("../contracts/mint-tx"), true)?; + let program = package.unwrap_program(); + let script = + TransactionScript::from_parts(program.mast_forest().clone(), program.entrypoint()); + client.set_setting(MINT_TX_SCRIPT_SETTING.to_string(), script).await?; + if deploy { let mut faucet = Self::load(config).await?; @@ -189,11 +197,10 @@ impl Faucet { let issuance = Arc::new(RwLock::new(AssetAmount::new(account.get_token_issuance()?.as_int())?)); - let package = Package::read_from_bytes(TX_PACKAGE)?; - let script = TransactionScript::from_parts( - package.unwrap_program().mast_forest().clone(), - package.unwrap_program().entrypoint(), - ); + let script = client + .get_setting(MINT_TX_SCRIPT_SETTING.to_string()) + .await? + .context("client db should contain the mint tx script")?; let note_screener = NoteScreener::new(Arc::new(SqliteStore::new(config.store_path.clone()).await?)); diff --git a/crates/faucet/src/package.rs b/crates/faucet/src/package.rs new file mode 100644 index 00000000..ae67792a --- /dev/null +++ b/crates/faucet/src/package.rs @@ -0,0 +1,42 @@ +use std::path::Path; + +use anyhow::{Context, bail}; +use cargo_miden::{OutputType, run}; +use miden_client::Deserializable; +use miden_client::vm::Package; + +/// Builds a Miden project in the specified directory +/// +/// # Arguments +/// * `dir` - Path to the directory containing the Cargo.toml +/// * `release` - Whether to build in release mode +/// +/// # Returns +/// The compiled `Package` +/// +/// # Errors +/// Returns an error if compilation fails or if the output is not in the expected format +pub fn build_project_in_dir(dir: &Path, release: bool) -> anyhow::Result { + let profile = if release { "--release" } else { "--debug" }; + let manifest_path = dir.join("Cargo.toml"); + let manifest_arg = manifest_path.to_string_lossy(); + + let args = vec!["cargo", "miden", "build", profile, "--manifest-path", &manifest_arg]; + + let output = run(args.into_iter().map(String::from), OutputType::Masm) + .context("Failed to compile project")? + .context("Cargo miden build returned None")?; + + let artifact_path = match output { + cargo_miden::CommandOutput::BuildCommandOutput { output } => match output { + cargo_miden::BuildOutput::Masm { artifact_path } => artifact_path, + other => bail!("Expected Masm output, got {:?}", other), + }, + other => bail!("Expected BuildCommandOutput, got {:?}", other), + }; + + let package_bytes = std::fs::read(&artifact_path) + .context(format!("Failed to read compiled package from {}", artifact_path.display()))?; + + Package::read_from_bytes(&package_bytes).context("Failed to deserialize package from bytes") +} diff --git a/crates/mint-tx/Cargo.toml b/crates/mint-tx/Cargo.toml deleted file mode 100644 index e7435835..00000000 --- a/crates/mint-tx/Cargo.toml +++ /dev/null @@ -1,20 +0,0 @@ -[package] -name = "miden-faucet-mint-tx" -version.workspace = true -edition.workspace = true - -[lib] -# Build this crate as a self-contained, C-style dynamic library -# This is required to emit the proper Wasm module type -crate-type = ["cdylib"] - -[dependencies] -# Miden SDK consists of a stdlib (intrinsic functions for VM ops, stdlib functions and types) -# and transaction kernel API for the Miden rollup -miden = { version = "0.8" } - -[package.metadata.component] -package = "miden:mint-tx" - -[package.metadata.miden] -project-kind = "transaction-script" diff --git a/crates/mint-tx/rust-toolchain.toml b/rust-toolchain.toml similarity index 100% rename from crates/mint-tx/rust-toolchain.toml rename to rust-toolchain.toml From cf0e49f7fc13e64d7a9eefd14343cda0d234f9e7 Mon Sep 17 00:00:00 2001 From: tomasarrachea Date: Mon, 5 Jan 2026 17:43:09 -0300 Subject: [PATCH 07/19] fix: build --- Cargo.toml | 2 +- Makefile | 2 +- crates/contracts/mint-tx/Cargo.toml | 12 ++++++++++-- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 0831128f..373167ab 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [workspace] members = ["bin/faucet", "crates/faucet", "crates/pow", "crates/contracts/mint-tx"] -exclude = ["crates/contracts/mint-tx"] +default-members = ["bin/faucet", "crates/faucet", "crates/pow"] resolver = "2" diff --git a/Makefile b/Makefile index b915e4ea..5e9ca5f8 100644 --- a/Makefile +++ b/Makefile @@ -21,7 +21,7 @@ fix: ## Runs Fix with configs .PHONY: build build: ## By default we should build in release mode - cargo build --workspace --release + cargo build --release .PHONY: format format: ## Runs Format using nightly toolchain diff --git a/crates/contracts/mint-tx/Cargo.toml b/crates/contracts/mint-tx/Cargo.toml index 4012dc4e..c6672435 100644 --- a/crates/contracts/mint-tx/Cargo.toml +++ b/crates/contracts/mint-tx/Cargo.toml @@ -1,7 +1,15 @@ [package] name = "miden-faucet-mint-tx" -version.workspace = true -edition.workspace = true +authors.workspace = true +description = "Miden faucet's mint transaction script" +edition.workspace = true +homepage.workspace = true +keywords = ["mint", "miden", "faucet"] +license.workspace = true +readme = "README.md" +repository.workspace = true +rust-version.workspace = true +version.workspace = true [lib] crate-type = ["cdylib"] From 55d2787dd9e51c096133b7e983bb1bafdafcf4ce Mon Sep 17 00:00:00 2001 From: tomasarrachea Date: Mon, 5 Jan 2026 18:19:59 -0300 Subject: [PATCH 08/19] feat: makefile and lints --- Makefile | 13 ++++--------- crates/faucet/src/lib.rs | 9 ++++++++- crates/faucet/src/package.rs | 8 ++++++-- crates/pow/src/tests.rs | 5 ++++- rust-toolchain.toml | 2 +- 5 files changed, 23 insertions(+), 14 deletions(-) diff --git a/Makefile b/Makefile index 5e9ca5f8..d176968d 100644 --- a/Makefile +++ b/Makefile @@ -12,12 +12,11 @@ WARNINGS=RUSTDOCFLAGS="-D warnings" .PHONY: clippy clippy: ## Runs Clippy with configs - cargo clippy --locked --all-targets --all-features --workspace - + cargo clippy --locked --all-targets --all-features .PHONY: fix fix: ## Runs Fix with configs - cargo fix --allow-staged --allow-dirty --all-targets --all-features --workspace + cargo fix --allow-staged --allow-dirty --all-targets --all-features .PHONY: build build: ## By default we should build in release mode @@ -27,22 +26,18 @@ build: ## By default we should build in release mode format: ## Runs Format using nightly toolchain cargo +nightly fmt --all - .PHONY: format-check format-check: ## Runs Format using nightly toolchain but only in check mode cargo +nightly fmt --all --check - .PHONY: machete machete: ## Runs machete to find unused dependencies cargo machete - .PHONY: toml toml: ## Runs Format for all TOML files taplo fmt - .PHONY: toml-check toml-check: ## Runs Format for all TOML files but only in check mode taplo fmt --check --verbose @@ -68,13 +63,13 @@ book: ## Builds the book & serves documentation site .PHONY: test test: ## Runs all tests - cargo nextest run --release --all-features --workspace + cargo nextest run --release --all-features # --- checking ------------------------------------------------------------------------------------ .PHONY: check check: ## Check all targets and features for errors without code generation - ${BUILD_PROTO} cargo check --all-features --all-targets --locked --workspace + ${BUILD_PROTO} cargo check --all-features --all-targets --locked # --- installing ---------------------------------------------------------------------------------- diff --git a/crates/faucet/src/lib.rs b/crates/faucet/src/lib.rs index 2fb6528f..46b05fa2 100644 --- a/crates/faucet/src/lib.rs +++ b/crates/faucet/src/lib.rs @@ -635,6 +635,13 @@ mod tests { .unwrap(); client.ensure_genesis_in_place().await.unwrap(); client.add_account(&account, false).await.unwrap(); + let package = + build_project_in_dir(Path::new("../contracts/mint-tx"), true).unwrap(); + let program = package.unwrap_program(); + let script = TransactionScript::from_parts( + program.mast_forest().clone(), + program.entrypoint(), + ); let faucet = Faucet { id: FaucetId::new(account.id(), NetworkId::Testnet), client, @@ -646,7 +653,7 @@ mod tests { tx_prover: Arc::new(LocalTransactionProver::default()), issuance: Arc::new(RwLock::new(AssetAmount::new(0).unwrap())), max_supply: AssetAmount::new(1_000_000_000_000).unwrap(), - script: TransactionScript::read_from_bytes(TX_PACKAGE).unwrap(), + script, }; faucet.run(rx_mint_requests, batch_size).await.unwrap(); }); diff --git a/crates/faucet/src/package.rs b/crates/faucet/src/package.rs index ae67792a..d96f2425 100644 --- a/crates/faucet/src/package.rs +++ b/crates/faucet/src/package.rs @@ -30,9 +30,13 @@ pub fn build_project_in_dir(dir: &Path, release: bool) -> anyhow::Result match output { cargo_miden::BuildOutput::Masm { artifact_path } => artifact_path, - other => bail!("Expected Masm output, got {:?}", other), + other @ cargo_miden::BuildOutput::Wasm { .. } => { + bail!("Expected Masm output, got {other:?}") + }, + }, + other @ cargo_miden::CommandOutput::NewCommandOutput { .. } => { + bail!("Expected BuildCommandOutput, got {other:?}") }, - other => bail!("Expected BuildCommandOutput, got {:?}", other), }; let package_bytes = std::fs::read(&artifact_path) diff --git a/crates/pow/src/tests.rs b/crates/pow/src/tests.rs index 3f11ed8d..2ff94509 100644 --- a/crates/pow/src/tests.rs +++ b/crates/pow/src/tests.rs @@ -145,7 +145,10 @@ async fn requestor_is_rate_limited_after_challenge_expires() { let nonce_2 = find_pow_solution(&challenge_2, 10000).expect("Should find solution"); // Wait until challenge 1 is almost expired and submit it - tokio::time::sleep(pow.config.challenge_lifetime - Duration::from_millis(1100)).await; + tokio::time::sleep( + pow.config.challenge_lifetime.checked_sub(Duration::from_millis(1100)).unwrap(), + ) + .await; let time_1 = SystemTime::now().duration_since(UNIX_EPOCH).unwrap().as_secs(); let result = pow.submit_challenge(requestor, domain, &challenge_1, nonce_1, time_1, request_complexity); diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 2ec0b5bb..361ac762 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,5 +1,5 @@ [toolchain] channel = "nightly-2025-12-10" -components = ["rustfmt", "rust-src", "llvm-tools"] +components = ["rustfmt", "rust-src", "llvm-tools", "clippy"] targets = [ "wasm32-wasip2" ] profile = "minimal" From fd368066c51c3a4c6a0fe34282cacc38b0583752 Mon Sep 17 00:00:00 2001 From: tomasarrachea Date: Tue, 6 Jan 2026 14:48:23 -0300 Subject: [PATCH 09/19] wip --- crates/contracts/mint-tx/src/lib.rs | 29 +++++++++++++++++------------ crates/faucet/src/lib.rs | 9 ++++++--- 2 files changed, 23 insertions(+), 15 deletions(-) diff --git a/crates/contracts/mint-tx/src/lib.rs b/crates/contracts/mint-tx/src/lib.rs index b7665789..e0e95447 100644 --- a/crates/contracts/mint-tx/src/lib.rs +++ b/crates/contracts/mint-tx/src/lib.rs @@ -1,31 +1,36 @@ #![no_std] #![feature(alloc_error_handler)] -use miden::faucet::mint; use miden::intrinsics::advice::adv_push_mapvaln; use miden::tx::update_expiration_block_delta; -use miden::{Asset, Felt, Word, adv_load_preimage, felt, tx_script}; +use miden::{Felt, Word, active_account, adv_load_preimage, felt, tx_script}; -const ASSET_WORD_SIZE: usize = 4; +const NOTE_ARGS_SIZE: usize = 4; #[tx_script] fn run(arg: Word) { update_expiration_block_delta(Felt::from_u32(10)); - let num_felts = adv_push_mapvaln(arg); + let commitment = arg.reverse(); + let num_felts = adv_push_mapvaln(commitment); let num_felts_u64 = num_felts.as_u64(); - assert_eq!(Felt::from_u32((num_felts_u64 % 4) as u32), felt!(0)); + assert_eq!(Felt::from_u32((num_felts_u64 % 7) as u32), felt!(0)); let num_words = Felt::from_u64_unchecked(num_felts_u64 / 4); - let commitment = arg; - let input = adv_load_preimage(num_words, commitment); + let mut input = adv_load_preimage(num_words, commitment); + input.reverse(); // TODO: check if reverse is needed due to pop let num_words_usize = num_words.as_u64() as usize; for idx in 0..num_words_usize { - let start = idx * ASSET_WORD_SIZE; - let end = start + ASSET_WORD_SIZE; - let asset: [Felt; ASSET_WORD_SIZE] = - input[start..end].try_into().expect("invalid input length"); - mint(Asset::new(asset)); + let start = idx * NOTE_ARGS_SIZE; + let recipient: [Felt; 4] = + input[start..start + 4].try_into().expect("invalid input length"); + let note_type = input[start + 4]; + let tag = input[start + 5]; + let amount = input[start + 6]; + + // TODO: call distribute account procedure + let num_procedures = active_account::get_num_procedures(); + assert_ne!(num_procedures, Felt::from_u32(0)); } } diff --git a/crates/faucet/src/lib.rs b/crates/faucet/src/lib.rs index 46b05fa2..4411cd68 100644 --- a/crates/faucet/src/lib.rs +++ b/crates/faucet/src/lib.rs @@ -406,9 +406,12 @@ impl Faucet { let mut note_data = vec![]; for note in notes { // SAFETY: these are p2id notes with only one fungible asset - let asset = note.assets().iter().next().unwrap(); - let word: Word = asset.into(); - note_data.extend(word.as_slice()); + let amount = note.assets().iter().next().unwrap().unwrap_fungible().amount(); + + note_data.extend(note.recipient().digest().iter()); + note_data.push(Felt::from(note.metadata().note_type())); + note_data.push(Felt::from(note.metadata().tag())); + note_data.push(Felt::new(amount)); } let note_data_commitment = Rpo256::hash_elements(¬e_data); let advice_map = [(note_data_commitment, note_data)]; From 0b6501d3c644357df711c7b87250bb78b66675bf Mon Sep 17 00:00:00 2001 From: tomasarrachea Date: Fri, 10 Apr 2026 00:14:50 -0300 Subject: [PATCH 10/19] chore: bump miden compiler deps --- Cargo.lock | 1387 ++++++++++++++++++++++++---------------------------- Cargo.toml | 4 +- 2 files changed, 651 insertions(+), 740 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c0491d28..984e2e8d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -158,6 +158,21 @@ dependencies = [ "libc", ] +[[package]] +name = "anstream" +version = "0.6.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43d5b281e737544384e969a5ccad3f1cdd24b48086a0fc1b2a5262a26b8f4f4a" +dependencies = [ + "anstyle", + "anstyle-parse 0.2.7", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "is_terminal_polyfill", + "utf8parse", +] + [[package]] name = "anstream" version = "1.0.0" @@ -165,7 +180,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "824a212faf96e9acacdbd09febd34438f8f711fb84e09a8916013cd7815ca28d" dependencies = [ "anstyle", - "anstyle-parse", + "anstyle-parse 1.0.0", "anstyle-query", "anstyle-wincon", "colorchoice", @@ -179,6 +194,15 @@ version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "940b3a0ca603d1eade50a4846a2afffd5ef57a9feac2c0e2ec2e14f9ead76000" +[[package]] +name = "anstyle-parse" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e7644824f0aa2c7b9384579234ef10eb7efb6a0deb83f9630a49594dd9c15c2" +dependencies = [ + "utf8parse", +] + [[package]] name = "anstyle-parse" version = "1.0.0" @@ -464,6 +488,15 @@ version = "2.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "843867be96c8daad0d758b57df9392b6d8d271134fce549de6ce169ff98a92af" +[[package]] +name = "bitmaps" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "031043d04099746d8db04daf1fa424b2bc8bd69d92b25962dcde24da39ab64a2" +dependencies = [ + "typenum", +] + [[package]] name = "bitvec" version = "1.0.1" @@ -508,6 +541,15 @@ dependencies = [ "generic-array", ] +[[package]] +name = "bstr" +version = "1.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63044e1ae8e69f3b5a92c736ca6269b8d12fa7efe39bf34ddb06d102cf0e2cab" +dependencies = [ + "memchr", +] + [[package]] name = "build-rs" version = "0.3.3" @@ -552,17 +594,16 @@ dependencies = [ [[package]] name = "cargo-miden" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05033ddc634e118a624d5753bcab80b0b8a7155f7a867a6095f11fc4e9cdcc59" +version = "0.8.0" +source = "git+https://github.com/0xMiden/compiler?branch=next#2dc362e49c0aed00969bd1a890b3be0e9039f0d4" dependencies = [ "anyhow", "cargo_metadata", "clap", - "env_logger", "liquid", "log", "midenc-compile", + "midenc-log", "midenc-session", "path-absolutize", "semver 1.0.28", @@ -699,10 +740,11 @@ version = "4.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "714a53001bf66416adb0e2ef5ac857140e7dc3a0c48fb28b2f10762fc4b5069f" dependencies = [ - "anstream", + "anstream 1.0.0", "anstyle", "clap_lex", "strsim", + "terminal_size", ] [[package]] @@ -955,7 +997,7 @@ dependencies = [ "crossterm_winapi", "document-features", "parking_lot", - "rustix 1.1.4", + "rustix", "winapi", ] @@ -1026,9 +1068,9 @@ dependencies = [ [[package]] name = "darling" -version = "0.20.11" +version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc7f46116c46ff9ab3eb1597a45688b6715c6e628b5c133e288e709a29bcb4ee" +checksum = "25ae13da2f202d56bd7f91c25fba009e7717a1e4a1cc98a76d844b65ae912e9d" dependencies = [ "darling_core", "darling_macro", @@ -1036,11 +1078,10 @@ dependencies = [ [[package]] name = "darling_core" -version = "0.20.11" +version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d00b9596d185e565c2207a0b01f8bd1a135483d02d9b7b0a54b11da8d53412e" +checksum = "9865a50f7c335f53564bb694ef660825eb8610e0a53d3e11bf1b0d3df31e03b0" dependencies = [ - "fnv", "ident_case", "proc-macro2", "quote", @@ -1050,9 +1091,9 @@ dependencies = [ [[package]] name = "darling_macro" -version = "0.20.11" +version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc34b93ccb385b40dc71c6fceac4b2ad23662c7eeb248cf10d529b7e055b6ead" +checksum = "ac3984ec7bd6cfa798e62b4a642426a5be0e68f9401cfc2a01e3fa9ea2fcdb8d" dependencies = [ "darling_core", "quote", @@ -1283,18 +1324,6 @@ 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 2.0.117", -] - [[package]] name = "env_filter" version = "1.0.1" @@ -1311,7 +1340,7 @@ version = "0.11.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0621c04f2196ac3f488dd583365b9c09be011a4ab8b9f37248ffcc8f6198b56a" dependencies = [ - "anstream", + "anstream 1.0.0", "anstyle", "env_filter", "jiff", @@ -1807,9 +1836,6 @@ dependencies = [ "allocator-api2 0.2.21", "equivalent", "foldhash 0.2.0", - "rayon", - "serde", - "serde_core", ] [[package]] @@ -2228,6 +2254,20 @@ dependencies = [ "icu_properties", ] +[[package]] +name = "im-rc" +version = "15.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af1955a75fa080c677d3972822ec4bad316169ab1cfc6c257a942c2265dbe5fe" +dependencies = [ + "bitmaps", + "rand_core 0.6.4", + "rand_xoshiro 0.6.0", + "sized-chunks", + "typenum", + "version_check", +] + [[package]] name = "indenter" version = "0.3.4" @@ -2472,6 +2512,7 @@ version = "0.22.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b5baa5e9ff84f1aefd264e6869907646538a52147a755d494517a8007fb48733" dependencies = [ + "regex-automata", "rustversion", ] @@ -2519,12 +2560,6 @@ dependencies = [ "vcpkg", ] -[[package]] -name = "linux-raw-sys" -version = "0.4.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d26c52dbd32dccf2d10cac7725f8eae5296885fb5703b261f7d0a0739ec807ab" - [[package]] name = "linux-raw-sys" version = "0.12.1" @@ -2585,6 +2620,58 @@ dependencies = [ "unicode-segmentation", ] +[[package]] +name = "litcheck-core" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00d04c87eac46e722dea009607dbf01109872ccabdaa9088399f2a21c6b2a71d" +dependencies = [ + "Inflector", + "clap", + "compact_str", + "either", + "glob", + "hashbrown 0.15.5", + "log", + "memchr", + "miette", + "parking_lot", + "paste", + "rustc-hash", + "serde", + "serde_spanned 1.1.1", + "smallvec", + "thiserror 2.0.18", + "toml 0.9.12+spec-1.1.0", + "walkdir", +] + +[[package]] +name = "litcheck-filecheck" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b3068bd232903a957c3dd219019857542dcc8e57eee9db2cebd08c916d8d989c" +dependencies = [ + "aho-corasick", + "bitflags", + "bstr", + "clap", + "either", + "im-rc", + "itertools", + "lalrpop", + "lalrpop-util", + "litcheck-core", + "log", + "logos 0.16.1", + "memchr", + "regex", + "regex-automata", + "regex-syntax", + "smallvec", + "thiserror 2.0.18", +] + [[package]] name = "litemap" version = "0.7.5" @@ -2624,7 +2711,16 @@ version = "0.15.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ff472f899b4ec2d99161c51f60ff7075eeb3097069a36050d8037a6325eb8154" dependencies = [ - "logos-derive", + "logos-derive 0.15.1", +] + +[[package]] +name = "logos" +version = "0.16.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eb2c55a318a87600ea870ff8c2012148b44bf18b74fad48d0f835c38c7d07c5f" +dependencies = [ + "logos-derive 0.16.1", ] [[package]] @@ -2643,13 +2739,36 @@ dependencies = [ "syn 2.0.117", ] +[[package]] +name = "logos-codegen" +version = "0.16.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "58b3ffaa284e1350d017a57d04ada118c4583cf260c8fb01e0fe28a2e9cf8970" +dependencies = [ + "fnv", + "proc-macro2", + "quote", + "regex-automata", + "regex-syntax", + "syn 2.0.117", +] + [[package]] name = "logos-derive" version = "0.15.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "605d9697bcd5ef3a42d38efc51541aa3d6a4a25f7ab6d1ed0da5ac632a26b470" dependencies = [ - "logos-codegen", + "logos-codegen 0.15.1", +] + +[[package]] +name = "logos-derive" +version = "0.16.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52d3a9855747c17eaf4383823f135220716ab49bea5fbea7dd42cc9a92f8aa31" +dependencies = [ + "logos-codegen 0.16.1", ] [[package]] @@ -2729,12 +2848,15 @@ dependencies = [ [[package]] name = "miden" -version = "0.8.0" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db443dc2be686e14bd2fd4213476146d2d4b4b14d52ac7191f51a789ae5b7678" +checksum = "010a8120478c5bbffa3ff1f139a01bac789331fbfef5a30f5ee6fd467225d3a2" dependencies = [ "miden-base", + "miden-base-macros", "miden-base-sys", + "miden-field 0.22.6", + "miden-field-repr", "miden-sdk-alloc", "miden-stdlib-sys", "wit-bindgen 0.46.0", @@ -2748,59 +2870,32 @@ checksum = "4302fc29d77db3d2c6323d1b211e503aafb91db2d572ef30c68829347fe79352" dependencies = [ "alloy-sol-types", "fs-err", - "miden-assembly 0.22.1", - "miden-core 0.22.1", + "miden-assembly", + "miden-core", "miden-core-lib", - "miden-crypto 0.23.0", + "miden-crypto", "miden-protocol", "miden-standards", - "miden-utils-sync 0.22.1", + "miden-utils-sync", "primitive-types", "regex", "thiserror 2.0.18", "walkdir", ] -[[package]] -name = "miden-air" -version = "0.19.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06acfd2ddc25b68f9d23d2add3f15c0ec3f9890ce6418409d71bea9dc6590bd0" -dependencies = [ - "miden-core 0.19.1", - "miden-utils-indexing 0.19.1", - "thiserror 2.0.18", - "winter-air", - "winter-prover", -] - [[package]] name = "miden-air" version = "0.22.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d15646ebc95906b2a7cb66711d1e184f53fd6edc2605730bbcf0c2a129f792cf" dependencies = [ - "miden-core 0.22.1", - "miden-crypto 0.23.0", - "miden-utils-indexing 0.22.1", + "miden-core", + "miden-crypto", + "miden-utils-indexing", "thiserror 2.0.18", "tracing", ] -[[package]] -name = "miden-assembly" -version = "0.19.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1219b9e48bb286b58a23bb65cf74baa1b24ddbcb462ca625b38186674571047" -dependencies = [ - "log", - "miden-assembly-syntax 0.19.1", - "miden-core 0.19.1", - "miden-mast-package 0.19.1", - "smallvec", - "thiserror 2.0.18", -] - [[package]] name = "miden-assembly" version = "0.22.1" @@ -2809,37 +2904,15 @@ checksum = "ae6013b3a390e0dcb29242f4480a7727965887bbf0903466c88f362b4cb20c0e" dependencies = [ "env_logger", "log", - "miden-assembly-syntax 0.22.1", - "miden-core 0.22.1", - "miden-mast-package 0.22.1", + "miden-assembly-syntax", + "miden-core", + "miden-mast-package", "miden-package-registry", "miden-project", "smallvec", "thiserror 2.0.18", ] -[[package]] -name = "miden-assembly-syntax" -version = "0.19.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1eeaef2853061c54527bb2664c0c832ce3d1f80847c79512455fec3b93057f2a" -dependencies = [ - "aho-corasick", - "lalrpop", - "lalrpop-util", - "log", - "miden-core 0.19.1", - "miden-debug-types 0.19.1", - "miden-utils-diagnostics 0.19.1", - "midenc-hir-type 0.4.3", - "proptest", - "regex", - "rustc_version 0.4.1", - "semver 1.0.28", - "smallvec", - "thiserror 2.0.18", -] - [[package]] name = "miden-assembly-syntax" version = "0.22.1" @@ -2851,10 +2924,10 @@ dependencies = [ "lalrpop", "lalrpop-util", "log", - "miden-core 0.22.1", - "miden-debug-types 0.22.1", - "miden-utils-diagnostics 0.22.1", - "midenc-hir-type 0.5.3", + "miden-core", + "miden-debug-types", + "miden-utils-diagnostics", + "midenc-hir-type", "proptest", "proptest-derive", "regex", @@ -2867,23 +2940,22 @@ dependencies = [ [[package]] name = "miden-base" -version = "0.8.0" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6fc4d8ec7077dc50d03d7afecd5308e933b87abe7ffc0ac1e62abda53dd9dc62" +checksum = "c0cab3453f9574645a7e0ace17aa87998ebe9efde5ae2291ad9a310d6051aa0e" dependencies = [ - "miden-base-macros", "miden-base-sys", "miden-stdlib-sys", ] [[package]] name = "miden-base-macros" -version = "0.8.0" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07f1ef27517f1d2baf20c66f0795630e74370680798060ed94dc05d3565cd2a9" +checksum = "e6389b82f5b125fd5c02fbf057e2d801aed3e4b3a22b73ca27601f5546343abe" dependencies = [ "heck", - "miden-objects", + "miden-protocol", "proc-macro2", "quote", "semver 1.0.28", @@ -2895,10 +2967,11 @@ dependencies = [ [[package]] name = "miden-base-sys" -version = "0.8.1" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "862632407d9f60286e82ad6e56f16a0356b1f266d3fb41d13866cfdc326c2090" +checksum = "842a10d5a6f4b4710356c5cd026400eb901f380e4e445e6bfb084985963b0f88" dependencies = [ + "miden-field-repr", "miden-stdlib-sys", ] @@ -2991,24 +3064,6 @@ dependencies = [ "tokio", ] -[[package]] -name = "miden-core" -version = "0.19.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "452a00429d05c416001ec0578291eb88e115cf94fc22b3308267abfdcd813440" -dependencies = [ - "enum_dispatch", - "miden-crypto 0.18.5", - "miden-debug-types 0.19.1", - "miden-formatting", - "miden-utils-indexing 0.19.1", - "num-derive", - "num-traits", - "thiserror 2.0.18", - "winter-math", - "winter-utils", -] - [[package]] name = "miden-core" version = "0.22.1" @@ -3017,12 +3072,12 @@ checksum = "fdec54a321cdf3d23e9ef615e91cb858038c6b4d4202507bdec048fc6d7763e4" dependencies = [ "derive_more", "itertools", - "miden-crypto 0.23.0", - "miden-debug-types 0.22.1", + "miden-crypto", + "miden-debug-types", "miden-formatting", "miden-utils-core-derive", - "miden-utils-indexing 0.22.1", - "miden-utils-sync 0.22.1", + "miden-utils-indexing", + "miden-utils-sync", "num-derive", "num-traits", "proptest", @@ -3039,45 +3094,13 @@ checksum = "621e8fa911a790bcf3cd3aedce80bc10922a19d6181f08ff3ca078f955cff70b" dependencies = [ "env_logger", "fs-err", - "miden-assembly 0.22.1", - "miden-core 0.22.1", - "miden-crypto 0.23.0", + "miden-assembly", + "miden-core", + "miden-crypto", "miden-package-registry", - "miden-processor 0.22.1", - "miden-utils-sync 0.22.1", - "thiserror 2.0.18", -] - -[[package]] -name = "miden-crypto" -version = "0.18.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "395e5cc76b64e24533ee55c8d1ff90305b8cad372bdbea4f4f324239e36a895f" -dependencies = [ - "blake3", - "cc", - "chacha20poly1305", - "ed25519-dalek", - "flume", - "glob", - "hashbrown 0.16.1", - "hkdf", - "k256", - "miden-crypto-derive 0.18.5", - "num", - "num-complex", - "rand 0.9.2", - "rand_chacha", - "rand_core 0.9.5", - "rand_hc", - "rayon", - "sha3", - "subtle", + "miden-processor", + "miden-utils-sync", "thiserror 2.0.18", - "winter-crypto", - "winter-math", - "winter-utils", - "x25519-dalek", ] [[package]] @@ -3095,21 +3118,21 @@ dependencies = [ "glob", "hkdf", "k256", - "miden-crypto-derive 0.23.0", - "miden-field", - "miden-serde-utils", + "miden-crypto-derive", + "miden-field 0.23.0", + "miden-serde-utils 0.23.0", "num", "num-complex", "p3-blake3", - "p3-challenger", - "p3-dft", - "p3-goldilocks", + "p3-challenger 0.5.2", + "p3-dft 0.5.2", + "p3-goldilocks 0.5.2", "p3-keccak", - "p3-matrix", - "p3-maybe-rayon", + "p3-matrix 0.5.2", + "p3-maybe-rayon 0.5.2", "p3-miden-lifted-stark", - "p3-symmetric", - "p3-util", + "p3-symmetric 0.5.2", + "p3-util 0.5.2", "rand 0.9.2", "rand_chacha", "rand_core 0.9.5", @@ -3123,16 +3146,6 @@ dependencies = [ "x25519-dalek", ] -[[package]] -name = "miden-crypto-derive" -version = "0.18.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c89641b257eb395cf03105ac1c6cbdf3fd9a5450749696af9835c3c47fc6806e" -dependencies = [ - "quote", - "syn 2.0.117", -] - [[package]] name = "miden-crypto-derive" version = "0.23.0" @@ -3143,24 +3156,6 @@ dependencies = [ "syn 2.0.117", ] -[[package]] -name = "miden-debug-types" -version = "0.19.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97eed62ac0ca7420e49148fd306c74786b23a8d31df6da6277c671ba3e5c619a" -dependencies = [ - "memchr", - "miden-crypto 0.18.5", - "miden-formatting", - "miden-miette", - "miden-utils-indexing 0.19.1", - "miden-utils-sync 0.19.1", - "paste", - "serde", - "serde_spanned 1.1.1", - "thiserror 2.0.18", -] - [[package]] name = "miden-debug-types" version = "0.22.1" @@ -3168,11 +3163,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d6e50274d11c80b901cf6c90362de8c98c8c8ad6030c80624d683b63d899a0fb" dependencies = [ "memchr", - "miden-crypto 0.23.0", + "miden-crypto", "miden-formatting", "miden-miette", - "miden-utils-indexing 0.22.1", - "miden-utils-sync 0.22.1", + "miden-utils-indexing", + "miden-utils-sync", "paste", "serde", "serde_spanned 1.1.1", @@ -3266,17 +3261,34 @@ dependencies = [ "miden", ] +[[package]] +name = "miden-field" +version = "0.22.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "546ac41444d6f1ab015daa0bf420759405d3cf0a5cb2b552140ad60443ddf39c" +dependencies = [ + "miden-serde-utils 0.22.6", + "num-bigint", + "p3-challenger 0.4.2", + "p3-field 0.4.2", + "p3-goldilocks 0.4.2", + "paste", + "rand 0.9.2", + "serde", + "thiserror 2.0.18", +] + [[package]] name = "miden-field" version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "38011348f4fb4c9e5ce1f471203d024721c00e3b60a91aa91aaefe6738d8b5ea" dependencies = [ - "miden-serde-utils", + "miden-serde-utils 0.23.0", "num-bigint", - "p3-challenger", - "p3-field", - "p3-goldilocks", + "p3-challenger 0.5.2", + "p3-field 0.5.2", + "p3-goldilocks 0.5.2", "paste", "rand 0.10.0", "serde", @@ -3285,42 +3297,34 @@ dependencies = [ ] [[package]] -name = "miden-formatting" -version = "0.1.1" +name = "miden-field-repr" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e392e0a8c34b32671012b439de35fa8987bf14f0f8aac279b97f8b8cc6e263b" +checksum = "5c87de3a3d7535308e525fb8407defd4e7a169c6af575e148538b83800ffc6d2" dependencies = [ - "unicode-width 0.1.14", + "miden-core", + "miden-field 0.22.6", + "miden-field-repr-derive", ] [[package]] -name = "miden-lib" -version = "0.12.4" +name = "miden-field-repr-derive" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "598582071e5b0ec835d06288857d4ddc0090a98bd4c17e408fa56b2c43f45d73" +checksum = "e3f1c00fe41ffa413b0ad36236e1016a64125162703f7be985d79f8dff3f7dba" dependencies = [ - "Inflector", - "fs-err", - "miden-assembly 0.19.1", - "miden-core 0.19.1", - "miden-objects", - "miden-processor 0.19.1", - "miden-stdlib", - "regex", - "thiserror 2.0.18", - "walkdir", + "proc-macro2", + "quote", + "syn 2.0.117", ] [[package]] -name = "miden-mast-package" -version = "0.19.1" +name = "miden-formatting" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d13e6ba2b357551598f13396ed52f8f21aa99979aa3b338bb5521feeda19c8a" +checksum = "7e392e0a8c34b32671012b439de35fa8987bf14f0f8aac279b97f8b8cc6e263b" dependencies = [ - "derive_more", - "miden-assembly-syntax 0.19.1", - "miden-core 0.19.1", - "thiserror 2.0.18", + "unicode-width 0.1.14", ] [[package]] @@ -3330,9 +3334,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bc8b2e3447fcde1f0e6b76e5219f129517639772cb02ca543177f0584e315288" dependencies = [ "derive_more", - "miden-assembly-syntax 0.22.1", - "miden-core 0.22.1", - "miden-debug-types 0.22.1", + "miden-assembly-syntax", + "miden-core", + "miden-debug-types", "serde", "thiserror 2.0.18", ] @@ -3343,8 +3347,6 @@ version = "8.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eef536978f24a179d94fa2a41e4f92b28e7d8aab14b8d23df28ad2a3d7098b20" dependencies = [ - "backtrace", - "backtrace-ext", "cfg-if", "futures", "indenter", @@ -3357,11 +3359,7 @@ dependencies = [ "serde_json", "spin 0.9.8", "strip-ansi-escapes", - "supports-color", - "supports-hyperlinks", - "supports-unicode", "syn 2.0.117", - "terminal_size 0.3.0", "textwrap", "thiserror 2.0.18", "trybuild", @@ -3472,39 +3470,15 @@ dependencies = [ "tonic-prost-build", ] -[[package]] -name = "miden-objects" -version = "0.12.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ace4018bb2d6cdbcff4d86d8af5ade8efca9f0479f7e5775c7f09cfab5f91ebe" -dependencies = [ - "bech32", - "getrandom 0.3.4", - "miden-assembly 0.19.1", - "miden-assembly-syntax 0.19.1", - "miden-core 0.19.1", - "miden-crypto 0.18.5", - "miden-mast-package 0.19.1", - "miden-processor 0.19.1", - "miden-stdlib", - "miden-utils-sync 0.19.1", - "miden-verifier 0.19.1", - "rand 0.9.2", - "semver 1.0.28", - "serde", - "thiserror 2.0.18", - "toml 0.9.12+spec-1.1.0", -] - [[package]] name = "miden-package-registry" version = "0.22.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "969ba3942052e52b3968e34dbd1c52c707e75777ee42ebdae2c8f57af56cf6cf" dependencies = [ - "miden-assembly-syntax 0.22.1", - "miden-core 0.22.1", - "miden-mast-package 0.22.1", + "miden-assembly-syntax", + "miden-core", + "miden-mast-package", "pubgrub", "serde", "smallvec", @@ -3521,26 +3495,6 @@ dependencies = [ "tokio", ] -[[package]] -name = "miden-processor" -version = "0.19.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2ef77929651b8755965cde8f589bd38e2345a619d54cab6427f91aa23c47f6a" -dependencies = [ - "itertools", - "miden-air 0.19.1", - "miden-core 0.19.1", - "miden-debug-types 0.19.1", - "miden-utils-diagnostics 0.19.1", - "miden-utils-indexing 0.19.1", - "paste", - "rayon", - "thiserror 2.0.18", - "tokio", - "tracing", - "winter-prover", -] - [[package]] name = "miden-processor" version = "0.22.1" @@ -3548,11 +3502,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6ec6cecbf22bd92b73a931ee80b424e46b8b7cdf4f2f3c364c25c5c15d2840da" dependencies = [ "itertools", - "miden-air 0.22.1", - "miden-core 0.22.1", - "miden-debug-types 0.22.1", - "miden-utils-diagnostics 0.22.1", - "miden-utils-indexing 0.22.1", + "miden-air", + "miden-core", + "miden-debug-types", + "miden-utils-diagnostics", + "miden-utils-indexing", "paste", "rayon", "thiserror 2.0.18", @@ -3566,9 +3520,9 @@ version = "0.22.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3840520c01881534fbbceb6b3687ec1c407fbaf310a35ce415fd3510abc52fdb" dependencies = [ - "miden-assembly-syntax 0.22.1", - "miden-core 0.22.1", - "miden-mast-package 0.22.1", + "miden-assembly-syntax", + "miden-core", + "miden-mast-package", "miden-package-registry", "serde", "serde-untagged", @@ -3585,19 +3539,19 @@ dependencies = [ "bech32", "fs-err", "getrandom 0.3.4", - "miden-assembly 0.22.1", - "miden-assembly-syntax 0.22.1", - "miden-core 0.22.1", + "miden-assembly", + "miden-assembly-syntax", + "miden-core", "miden-core-lib", - "miden-crypto 0.23.0", - "miden-mast-package 0.22.1", - "miden-processor 0.22.1", + "miden-crypto", + "miden-mast-package", + "miden-processor", "miden-protocol-macros", - "miden-utils-sync 0.22.1", - "miden-verifier 0.22.1", + "miden-utils-sync", + "miden-verifier", "rand 0.9.2", "rand_chacha", - "rand_xoshiro", + "rand_xoshiro 0.7.0", "regex", "semver 1.0.28", "serde", @@ -3624,11 +3578,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6bb2c94e36f57684d7fa0cd382adeedc1728d502dbbe69ad1c12f4a931f45511" dependencies = [ "bincode", - "miden-air 0.22.1", - "miden-core 0.22.1", - "miden-crypto 0.23.0", - "miden-debug-types 0.22.1", - "miden-processor 0.22.1", + "miden-air", + "miden-core", + "miden-crypto", + "miden-debug-types", + "miden-processor", "serde", "thiserror 2.0.18", "tokio", @@ -3659,9 +3613,19 @@ dependencies = [ [[package]] name = "miden-sdk-alloc" -version = "0.8.0" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7eef3b8651b93468a2b132c885b21aa6d488bf6cd78ba1f736ff90fa8c1fb43" +checksum = "e43d6123657c5ddd606ef3d36bb1bacd345abcfdbc2ca9b0cab8e839e63558f2" + +[[package]] +name = "miden-serde-utils" +version = "0.22.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bedaf94fb4bb6806e4af99fadce74e4cdd0e8664c571107b255f86b00b3149b" +dependencies = [ + "p3-field 0.4.2", + "p3-goldilocks 0.4.2", +] [[package]] name = "miden-serde-utils" @@ -3669,8 +3633,8 @@ version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ff78082e9b4ca89863e68da01b35f8a4029ee6fd912e39fa41fde4273a7debab" dependencies = [ - "p3-field", - "p3-goldilocks", + "p3-field 0.5.2", + "p3-goldilocks 0.5.2", ] [[package]] @@ -3680,10 +3644,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f455a087f41c30636b45ead961d1e66114d2d20661887b307cede05307eeb942" dependencies = [ "fs-err", - "miden-assembly 0.22.1", - "miden-core 0.22.1", + "miden-assembly", + "miden-core", "miden-core-lib", - "miden-processor 0.22.1", + "miden-processor", "miden-protocol", "rand 0.9.2", "regex", @@ -3692,27 +3656,14 @@ dependencies = [ ] [[package]] -name = "miden-stdlib" -version = "0.19.1" +name = "miden-stdlib-sys" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e90a5de45a1e6213ff17b66fff8accde0bbc64264e2c22bbcb9a895f8f3b767" +checksum = "0c0fad7b45aa92ca52a7fb15b20cb2be0eec1472bd36a1f20cc10d649507919d" dependencies = [ - "env_logger", - "fs-err", - "miden-assembly 0.19.1", - "miden-core 0.19.1", - "miden-crypto 0.18.5", - "miden-processor 0.19.1", - "miden-utils-sync 0.19.1", - "thiserror 2.0.18", + "miden-field 0.22.6", ] -[[package]] -name = "miden-stdlib-sys" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5978a2982cbeb64441e90c3e6ee7995ee513dbd1cd399f468fb7d3a608ecaf13" - [[package]] name = "miden-testing" version = "0.14.4" @@ -3722,11 +3673,11 @@ dependencies = [ "anyhow", "itertools", "miden-agglayer", - "miden-assembly 0.22.1", + "miden-assembly", "miden-block-prover", "miden-core-lib", - "miden-crypto 0.23.0", - "miden-processor 0.22.1", + "miden-crypto", + "miden-processor", "miden-protocol", "miden-standards", "miden-tx", @@ -3762,11 +3713,11 @@ version = "0.14.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6d788795041ce5e6f947a3256314373171e4877c11b86fafeabcec4d8b8628d9" dependencies = [ - "miden-processor 0.22.1", + "miden-processor", "miden-protocol", "miden-prover", "miden-standards", - "miden-verifier 0.22.1", + "miden-verifier", "thiserror 2.0.18", ] @@ -3791,63 +3742,30 @@ dependencies = [ "syn 1.0.109", ] -[[package]] -name = "miden-utils-diagnostics" -version = "0.19.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a3ff4c019d96539a7066626efb4dce5c9fb7b0e44e961b0c2571e78f34236d5" -dependencies = [ - "miden-crypto 0.18.5", - "miden-debug-types 0.19.1", - "miden-miette", - "paste", - "tracing", -] - [[package]] name = "miden-utils-diagnostics" version = "0.22.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "397f5d1e8679cf17cf7713ffd9654840791a6ed5818b025bbc2fbfdce846579a" dependencies = [ - "miden-crypto 0.23.0", - "miden-debug-types 0.22.1", + "miden-crypto", + "miden-debug-types", "miden-miette", "paste", "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.18", -] - [[package]] name = "miden-utils-indexing" version = "0.22.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c8834e76299686bcce3de1685158aa4cff49b7fa5e0e00a6cc811e8f2cf5775f" dependencies = [ - "miden-crypto 0.23.0", + "miden-crypto", "serde", "thiserror 2.0.18", ] -[[package]] -name = "miden-utils-sync" -version = "0.19.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "feebe7d896c013ea74dbc98de978836606356a044d4ed3b61ded54d3b319d89f" -dependencies = [ - "lock_api", - "loom", - "parking_lot", -] - [[package]] name = "miden-utils-sync" version = "0.22.1" @@ -3860,19 +3778,6 @@ dependencies = [ "parking_lot", ] -[[package]] -name = "miden-verifier" -version = "0.19.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8f8e47b78bba1fe1b31faee8f12aafd95385f6d6a8b108b03e92f5d743bb29f" -dependencies = [ - "miden-air 0.19.1", - "miden-core 0.19.1", - "thiserror 2.0.18", - "tracing", - "winter-verifier", -] - [[package]] name = "miden-verifier" version = "0.22.1" @@ -3880,9 +3785,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c4580df640d889c9f3c349cd2268968e44a99a8cf0df6c36ae5b1fb273712b00" dependencies = [ "bincode", - "miden-air 0.22.1", - "miden-core 0.22.1", - "miden-crypto 0.23.0", + "miden-air", + "miden-core", + "miden-crypto", "serde", "thiserror 2.0.18", "tracing", @@ -3890,24 +3795,25 @@ dependencies = [ [[package]] name = "midenc-codegen-masm" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c593fbe5a29c22fa8908ccbef3f03dc8263ced451fa738c1a6ff91142c1089ed" +version = "0.8.0" +source = "git+https://github.com/0xMiden/compiler?branch=next#2dc362e49c0aed00969bd1a890b3be0e9039f0d4" dependencies = [ + "anyhow", "inventory", "log", - "miden-assembly 0.19.1", - "miden-assembly-syntax 0.19.1", - "miden-core 0.19.1", - "miden-lib", - "miden-mast-package 0.19.1", - "miden-processor 0.19.1", + "miden-assembly", + "miden-assembly-syntax", + "miden-core", + "miden-mast-package", + "miden-processor", + "miden-protocol", "miden-thiserror", "midenc-dialect-arith", "midenc-dialect-cf", "midenc-dialect-hir", "midenc-dialect-scf", "midenc-dialect-ub", + "midenc-dialect-wasm", "midenc-hir", "midenc-hir-analysis", "midenc-session", @@ -3918,15 +3824,15 @@ dependencies = [ [[package]] name = "midenc-compile" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aebe203b423774601baae4a660a04f342a55879b1a3d0fd2356f40a0f081565c" +version = "0.8.0" +source = "git+https://github.com/0xMiden/compiler?branch=next#2dc362e49c0aed00969bd1a890b3be0e9039f0d4" dependencies = [ + "anyhow", "clap", "inventory", "log", - "miden-assembly 0.19.1", - "miden-mast-package 0.19.1", + "miden-assembly", + "miden-mast-package", "miden-thiserror", "midenc-codegen-masm", "midenc-dialect-hir", @@ -3940,9 +3846,8 @@ dependencies = [ [[package]] name = "midenc-dialect-arith" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24aa5f49e5cb14eaa60633ea078d4c65493a8aecf75e09956861475a586baee3" +version = "0.8.0" +source = "git+https://github.com/0xMiden/compiler?branch=next#2dc362e49c0aed00969bd1a890b3be0e9039f0d4" dependencies = [ "midenc-hir", "paste", @@ -3950,9 +3855,8 @@ dependencies = [ [[package]] name = "midenc-dialect-cf" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57fa897b76fa999cafabf287c993d09b9a4c7f204d3e92ec371d3f45c60560aa" +version = "0.8.0" +source = "git+https://github.com/0xMiden/compiler?branch=next#2dc362e49c0aed00969bd1a890b3be0e9039f0d4" dependencies = [ "log", "midenc-dialect-arith", @@ -3961,9 +3865,8 @@ dependencies = [ [[package]] name = "midenc-dialect-hir" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9d3957efe6f3acfb5e471cdeb17269140ffeaabed9c01ef15ed02ee489b6b07" +version = "0.8.0" +source = "git+https://github.com/0xMiden/compiler?branch=next#2dc362e49c0aed00969bd1a890b3be0e9039f0d4" dependencies = [ "log", "midenc-dialect-arith", @@ -3975,9 +3878,8 @@ dependencies = [ [[package]] name = "midenc-dialect-scf" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8937b92ab53960c703ce87254dc3b816ab698f3b69d80a845ff21737bda6c851" +version = "0.8.0" +source = "git+https://github.com/0xMiden/compiler?branch=next#2dc362e49c0aed00969bd1a890b3be0e9039f0d4" dependencies = [ "bitvec", "log", @@ -3990,18 +3892,26 @@ dependencies = [ [[package]] name = "midenc-dialect-ub" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "daec6ae79c9aef0fe960a7d0b8b4fe02f773a5fc5a23d70cdaebd83ed49579cf" +version = "0.8.0" +source = "git+https://github.com/0xMiden/compiler?branch=next#2dc362e49c0aed00969bd1a890b3be0e9039f0d4" +dependencies = [ + "midenc-hir", +] + +[[package]] +name = "midenc-dialect-wasm" +version = "0.8.0" +source = "git+https://github.com/0xMiden/compiler?branch=next#2dc362e49c0aed00969bd1a890b3be0e9039f0d4" dependencies = [ + "midenc-dialect-arith", + "midenc-dialect-hir", "midenc-hir", ] [[package]] name = "midenc-frontend-wasm" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "778cb061e4506859923fef201a4758d8075e64d0df0c5fac87c4e28de7236ca4" +version = "0.8.0" +source = "git+https://github.com/0xMiden/compiler?branch=next#2dc362e49c0aed00969bd1a890b3be0e9039f0d4" dependencies = [ "addr2line 0.24.2", "anyhow", @@ -4009,25 +3919,27 @@ dependencies = [ "gimli 0.31.1", "indexmap", "log", - "miden-core 0.19.1", + "miden-core", "miden-thiserror", "midenc-dialect-arith", "midenc-dialect-cf", "midenc-dialect-hir", "midenc-dialect-ub", + "midenc-dialect-wasm", "midenc-hir", "midenc-hir-symbol", "midenc-session", "wasmparser 0.227.1", + "wasmprinter", ] [[package]] name = "midenc-hir" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14e5dbaea7cd40dec41532b95510d250520f873bf253120d9f09e1be03542b95" +version = "0.8.0" +source = "git+https://github.com/0xMiden/compiler?branch=next#2dc362e49c0aed00969bd1a890b3be0e9039f0d4" dependencies = [ "anyhow", + "base64", "bitflags", "bitvec", "blink-alloc", @@ -4035,13 +3947,17 @@ dependencies = [ "hashbrown 0.15.5", "intrusive-collections", "inventory", + "litcheck-core", + "litcheck-filecheck", "log", - "miden-core 0.19.1", + "memchr", + "miden-core", "miden-thiserror", "midenc-hir-macros", "midenc-hir-symbol", - "midenc-hir-type 0.4.3", + "midenc-hir-type", "midenc-session", + "paste", "rustc-demangle", "rustc-hash", "semver 1.0.28", @@ -4050,9 +3966,8 @@ dependencies = [ [[package]] name = "midenc-hir-analysis" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42332ac887ee10791c1f6665caa5b9f801cd69114f653493671ff562db224d34" +version = "0.8.0" +source = "git+https://github.com/0xMiden/compiler?branch=next#2dc362e49c0aed00969bd1a890b3be0e9039f0d4" dependencies = [ "bitvec", "blink-alloc", @@ -4062,9 +3977,8 @@ dependencies = [ [[package]] name = "midenc-hir-macros" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "914e05b299b7a04bf780f3cb58d58cda6dff164b25c1f51e8d76ffe59a07ba3d" +version = "0.8.0" +source = "git+https://github.com/0xMiden/compiler?branch=next#2dc362e49c0aed00969bd1a890b3be0e9039f0d4" dependencies = [ "Inflector", "darling", @@ -4075,11 +3989,11 @@ dependencies = [ [[package]] name = "midenc-hir-symbol" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbf53056c60f2e2369f25f3be2360d6bf94497c61daa2e24c198e23a9b562a98" +version = "0.8.0" +source = "git+https://github.com/0xMiden/compiler?branch=next#2dc362e49c0aed00969bd1a890b3be0e9039f0d4" dependencies = [ "Inflector", + "compact_str", "hashbrown 0.15.5", "lock_api", "miden-formatting", @@ -4090,9 +4004,8 @@ dependencies = [ [[package]] name = "midenc-hir-transform" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c844fda35dfcfe75eac74d029c55e477a4567c700ec0fb08e43d91a26bf3664" +version = "0.8.0" +source = "git+https://github.com/0xMiden/compiler?branch=next#2dc362e49c0aed00969bd1a890b3be0e9039f0d4" dependencies = [ "log", "midenc-hir", @@ -4102,11 +4015,12 @@ dependencies = [ [[package]] name = "midenc-hir-type" -version = "0.4.3" +version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d4cfab04baffdda3fb9eafa5f873604059b89a1699aa95e4f1057397a69f0b5" +checksum = "2eb29d7c049fb69373c7e775e3d4411e63e4ee608bc43826282ba62c6ec9f891" dependencies = [ "miden-formatting", + "miden-serde-utils 0.23.0", "serde", "serde_repr", "smallvec", @@ -4114,40 +4028,38 @@ dependencies = [ ] [[package]] -name = "midenc-hir-type" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2eb29d7c049fb69373c7e775e3d4411e63e4ee608bc43826282ba62c6ec9f891" -dependencies = [ - "miden-formatting", - "miden-serde-utils", - "serde", - "serde_repr", - "smallvec", - "thiserror 2.0.18", +name = "midenc-log" +version = "0.8.0" +source = "git+https://github.com/0xMiden/compiler?branch=next#2dc362e49c0aed00969bd1a890b3be0e9039f0d4" +dependencies = [ + "anstream 0.6.21", + "anstyle", + "jiff", + "log", + "regex", ] [[package]] name = "midenc-session" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c936d173f02ecb487e176d8a9cc9f390355d053f0d37412eed0ff8a10088244" +version = "0.8.0" +source = "git+https://github.com/0xMiden/compiler?branch=next#2dc362e49c0aed00969bd1a890b3be0e9039f0d4" dependencies = [ "anyhow", "clap", "inventory", "log", - "miden-assembly 0.19.1", - "miden-assembly-syntax 0.19.1", - "miden-core 0.19.1", - "miden-debug-types 0.19.1", - "miden-lib", - "miden-mast-package 0.19.1", - "miden-stdlib", + "miden-assembly", + "miden-assembly-syntax", + "miden-core", + "miden-core-lib", + "miden-debug-types", + "miden-mast-package", + "miden-protocol", "miden-thiserror", "midenc-hir-macros", "midenc-hir-symbol", "parking_lot", + "smallvec", "termcolor", ] @@ -4165,7 +4077,7 @@ dependencies = [ "supports-color", "supports-hyperlinks", "supports-unicode", - "terminal_size 0.4.4", + "terminal_size", "textwrap", "unicode-width 0.1.14", ] @@ -4528,8 +4440,8 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9f2ec9cbfc642fc5173817287c3f8b789d07743b5f7e812d058b7a03e344f9ab" dependencies = [ - "p3-field", - "p3-matrix", + "p3-field 0.5.2", + "p3-matrix 0.5.2", "tracing", ] @@ -4540,8 +4452,22 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b667f43b19499dd939c9e2553aa95688936a88360d50117dae3c8848d07dbc70" dependencies = [ "blake3", - "p3-symmetric", - "p3-util", + "p3-symmetric 0.5.2", + "p3-util 0.5.2", +] + +[[package]] +name = "p3-challenger" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20e42ba74a49c08c6e99f74cd9b343bfa31aa5721fea55079b18e3fd65f1dcbc" +dependencies = [ + "p3-field 0.4.2", + "p3-maybe-rayon 0.4.2", + "p3-monty-31 0.4.2", + "p3-symmetric 0.4.2", + "p3-util 0.4.2", + "tracing", ] [[package]] @@ -4550,11 +4476,11 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4a0b490c745a7d2adeeafff06411814c8078c432740162332b3cd71be0158a76" dependencies = [ - "p3-field", - "p3-maybe-rayon", - "p3-monty-31", - "p3-symmetric", - "p3-util", + "p3-field 0.5.2", + "p3-maybe-rayon 0.5.2", + "p3-monty-31 0.5.2", + "p3-symmetric 0.5.2", + "p3-util 0.5.2", "tracing", ] @@ -4565,12 +4491,27 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "916ae7989d5c3b49f887f5c55b2f9826bdbb81aaebf834503c4145d8b267c829" dependencies = [ "itertools", - "p3-field", - "p3-matrix", - "p3-util", + "p3-field 0.5.2", + "p3-matrix 0.5.2", + "p3-util 0.5.2", "serde", ] +[[package]] +name = "p3-dft" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e63fa5eb1bd12a240089e72ae3fe10350944d9c166d00a3bfd2a1794db65cf5c" +dependencies = [ + "itertools", + "p3-field 0.4.2", + "p3-matrix 0.4.2", + "p3-maybe-rayon 0.4.2", + "p3-util 0.4.2", + "spin 0.10.0", + "tracing", +] + [[package]] name = "p3-dft" version = "0.5.2" @@ -4578,14 +4519,30 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "55301e91544440254977108b85c32c09d7ea05f2f0dd61092a2825339906a4a7" dependencies = [ "itertools", - "p3-field", - "p3-matrix", - "p3-maybe-rayon", - "p3-util", + "p3-field 0.5.2", + "p3-matrix 0.5.2", + "p3-maybe-rayon 0.5.2", + "p3-util 0.5.2", "spin 0.10.0", "tracing", ] +[[package]] +name = "p3-field" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ebfdb6ef992ae64e9e8f449ac46516ffa584f11afbdf9ee244288c2a633cdf4" +dependencies = [ + "itertools", + "num-bigint", + "p3-maybe-rayon 0.4.2", + "p3-util 0.4.2", + "paste", + "rand 0.9.2", + "serde", + "tracing", +] + [[package]] name = "p3-field" version = "0.5.2" @@ -4594,14 +4551,33 @@ checksum = "85affca7fc983889f260655c4cf74163eebb94605f702e4b6809ead707cba54f" dependencies = [ "itertools", "num-bigint", - "p3-maybe-rayon", - "p3-util", + "p3-maybe-rayon 0.5.2", + "p3-util 0.5.2", "paste", "rand 0.10.0", "serde", "tracing", ] +[[package]] +name = "p3-goldilocks" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64716244b5612622d4e78a4f48b74f6d3bb7b4085b7b6b25364b1dfca7198c66" +dependencies = [ + "num-bigint", + "p3-challenger 0.4.2", + "p3-dft 0.4.2", + "p3-field 0.4.2", + "p3-mds 0.4.2", + "p3-poseidon2 0.4.2", + "p3-symmetric 0.4.2", + "p3-util 0.4.2", + "paste", + "rand 0.9.2", + "serde", +] + [[package]] name = "p3-goldilocks" version = "0.5.2" @@ -4609,14 +4585,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0ca1081f5c47b940f2d75a11c04f62ea1cc58a5d480dd465fef3861c045c63cd" dependencies = [ "num-bigint", - "p3-challenger", - "p3-dft", - "p3-field", - "p3-mds", + "p3-challenger 0.5.2", + "p3-dft 0.5.2", + "p3-field 0.5.2", + "p3-mds 0.5.2", "p3-poseidon1", - "p3-poseidon2", - "p3-symmetric", - "p3-util", + "p3-poseidon2 0.5.2", + "p3-symmetric 0.5.2", + "p3-util 0.5.2", "paste", "rand 0.10.0", "serde", @@ -4628,11 +4604,27 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ebcf27615ece1995e4fcf4c69740f1cf515d1481367a20b4b3ce7f4f1b8d70f7" dependencies = [ - "p3-symmetric", - "p3-util", + "p3-symmetric 0.5.2", + "p3-util 0.5.2", "tiny-keccak", ] +[[package]] +name = "p3-matrix" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5542f96504dae8100c91398fb1e3f5ec669eb9c73d9e0b018a93b5fe32bad230" +dependencies = [ + "itertools", + "p3-field 0.4.2", + "p3-maybe-rayon 0.4.2", + "p3-util 0.4.2", + "rand 0.9.2", + "serde", + "tracing", + "transpose", +] + [[package]] name = "p3-matrix" version = "0.5.2" @@ -4640,14 +4632,20 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "53428126b009071563d1d07305a9de8be0d21de00b57d2475289ee32ffca6577" dependencies = [ "itertools", - "p3-field", - "p3-maybe-rayon", - "p3-util", + "p3-field 0.5.2", + "p3-maybe-rayon 0.5.2", + "p3-util 0.5.2", "rand 0.10.0", "serde", "tracing", ] +[[package]] +name = "p3-maybe-rayon" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e5669ca75645f99cd001e9d0289a4eeff2bc2cd9dc3c6c3aaf22643966e83df" + [[package]] name = "p3-maybe-rayon" version = "0.5.2" @@ -4657,16 +4655,29 @@ dependencies = [ "rayon", ] +[[package]] +name = "p3-mds" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "038763af23df9da653065867fd85b38626079031576c86fd537097e5be6a0da0" +dependencies = [ + "p3-dft 0.4.2", + "p3-field 0.4.2", + "p3-symmetric 0.4.2", + "p3-util 0.4.2", + "rand 0.9.2", +] + [[package]] name = "p3-mds" version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "35209e6214102ea6ec6b8cb1b9c15a9b8e597a39f9173597c957f123bced81b3" dependencies = [ - "p3-dft", - "p3-field", - "p3-symmetric", - "p3-util", + "p3-dft 0.5.2", + "p3-field 0.5.2", + "p3-symmetric 0.5.2", + "p3-util 0.5.2", "rand 0.10.0", ] @@ -4677,9 +4688,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c5c31c65fdc88952d7b301546add9670676e5b878aa0066dd929f107c203b006" dependencies = [ "p3-air", - "p3-field", - "p3-matrix", - "p3-util", + "p3-field 0.5.2", + "p3-matrix 0.5.2", + "p3-util 0.5.2", "thiserror 2.0.18", ] @@ -4689,15 +4700,15 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ab9932f1b0a16609a45cd4ee10a4d35412728bc4b38837c7979d7c85d8dcc9fc" dependencies = [ - "p3-challenger", + "p3-challenger 0.5.2", "p3-commit", - "p3-dft", - "p3-field", - "p3-matrix", - "p3-maybe-rayon", + "p3-dft 0.5.2", + "p3-field 0.5.2", + "p3-matrix 0.5.2", + "p3-maybe-rayon 0.5.2", "p3-miden-lmcs", "p3-miden-transcript", - "p3-util", + "p3-util 0.5.2", "rand 0.10.0", "thiserror 2.0.18", "tracing", @@ -4709,17 +4720,17 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8c3956ab7270c3cdd53ca9796d39ae1821984eb977415b0672110f9666bff5d8" dependencies = [ - "p3-challenger", - "p3-dft", - "p3-field", - "p3-matrix", - "p3-maybe-rayon", + "p3-challenger 0.5.2", + "p3-dft 0.5.2", + "p3-field 0.5.2", + "p3-matrix 0.5.2", + "p3-maybe-rayon 0.5.2", "p3-miden-lifted-air", "p3-miden-lifted-fri", "p3-miden-lmcs", "p3-miden-stateful-hasher", "p3-miden-transcript", - "p3-util", + "p3-util 0.5.2", "thiserror 2.0.18", "tracing", ] @@ -4731,13 +4742,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "48c46791c983e772136db3d48f102431457451447abb9087deb6c8ce3c1efc86" dependencies = [ "p3-commit", - "p3-field", - "p3-matrix", - "p3-maybe-rayon", + "p3-field 0.5.2", + "p3-matrix 0.5.2", + "p3-maybe-rayon 0.5.2", "p3-miden-stateful-hasher", "p3-miden-transcript", - "p3-symmetric", - "p3-util", + "p3-symmetric 0.5.2", + "p3-util 0.5.2", "rand 0.10.0", "serde", "thiserror 2.0.18", @@ -4750,8 +4761,8 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec47a9d9615eb3d9d2a59b00d19751d9ad85384b55886827913d680d912eac6a" dependencies = [ - "p3-field", - "p3-symmetric", + "p3-field 0.5.2", + "p3-symmetric 0.5.2", ] [[package]] @@ -4760,12 +4771,36 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "40c565647487e4a949f67e6f115b0391d6cb82ac8e561165789939bab23d0ae7" dependencies = [ - "p3-challenger", - "p3-field", + "p3-challenger 0.5.2", + "p3-field 0.5.2", "serde", "thiserror 2.0.18", ] +[[package]] +name = "p3-monty-31" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57a981d60da3d8cbf8561014e2c186068578405fd69098fa75b43d4afb364a47" +dependencies = [ + "itertools", + "num-bigint", + "p3-dft 0.4.2", + "p3-field 0.4.2", + "p3-matrix 0.4.2", + "p3-maybe-rayon 0.4.2", + "p3-mds 0.4.2", + "p3-poseidon2 0.4.2", + "p3-symmetric 0.4.2", + "p3-util 0.4.2", + "paste", + "rand 0.9.2", + "serde", + "spin 0.10.0", + "tracing", + "transpose", +] + [[package]] name = "p3-monty-31" version = "0.5.2" @@ -4774,15 +4809,15 @@ checksum = "ffa8c99ec50c035020bbf5457c6a729ba6a975719c1a8dd3f16421081e4f650c" dependencies = [ "itertools", "num-bigint", - "p3-dft", - "p3-field", - "p3-matrix", - "p3-maybe-rayon", - "p3-mds", + "p3-dft 0.5.2", + "p3-field 0.5.2", + "p3-matrix 0.5.2", + "p3-maybe-rayon 0.5.2", + "p3-mds 0.5.2", "p3-poseidon1", - "p3-poseidon2", - "p3-symmetric", - "p3-util", + "p3-poseidon2 0.5.2", + "p3-symmetric 0.5.2", + "p3-util 0.5.2", "paste", "rand 0.10.0", "serde", @@ -4796,24 +4831,48 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6a018b618e3fa0aec8be933b1d8e404edd23f46991f6bf3f5c2f3f95e9413fe9" dependencies = [ - "p3-field", - "p3-symmetric", + "p3-field 0.5.2", + "p3-symmetric 0.5.2", "rand 0.10.0", ] +[[package]] +name = "p3-poseidon2" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "903b73e4f9a7781a18561c74dc169cf03333497b57a8dd02aaeb130c0f386599" +dependencies = [ + "p3-field 0.4.2", + "p3-mds 0.4.2", + "p3-symmetric 0.4.2", + "p3-util 0.4.2", + "rand 0.9.2", +] + [[package]] name = "p3-poseidon2" version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "256a668a9ba916f8767552f13d0ba50d18968bc74a623bfdafa41e2970c944d0" dependencies = [ - "p3-field", - "p3-mds", - "p3-symmetric", - "p3-util", + "p3-field 0.5.2", + "p3-mds 0.5.2", + "p3-symmetric 0.5.2", + "p3-util 0.5.2", "rand 0.10.0", ] +[[package]] +name = "p3-symmetric" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3cd788f04e86dd5c35dd87cad29eefdb6371d2fd5f7664451382eeacae3c3ed0" +dependencies = [ + "itertools", + "p3-field 0.4.2", + "serde", +] + [[package]] name = "p3-symmetric" version = "0.5.2" @@ -4821,8 +4880,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6c60a71a1507c13611b0f2b0b6e83669fd5b76f8e3115bcbced5ccfdf3ca7807" dependencies = [ "itertools", - "p3-field", - "p3-util", + "p3-field 0.5.2", + "p3-util 0.5.2", + "serde", +] + +[[package]] +name = "p3-util" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "663b16021930bc600ecada915c6c3965730a3b9d6a6c23434ccf70bfc29d6881" +dependencies = [ "serde", ] @@ -5235,7 +5303,7 @@ version = "0.16.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b89455ef41ed200cafc47c76c552ee7792370ac420497e551f16123a9135f76e" dependencies = [ - "logos", + "logos 0.15.1", "miette", "prost", "prost-types", @@ -5271,7 +5339,7 @@ version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "072eee358134396a4643dff81cfff1c255c9fbd3fb296be14bdb6a26f9156366" dependencies = [ - "logos", + "logos 0.15.1", "miette", "prost-types", "thiserror 2.0.18", @@ -5489,6 +5557,15 @@ dependencies = [ "rand_core 0.9.5", ] +[[package]] +name = "rand_xoshiro" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f97cdb2a36ed4183de61b2f824cc45c9f1037f28afe0a322e9fff4c108b5aaa" +dependencies = [ + "rand_core 0.6.4", +] + [[package]] name = "rand_xoshiro" version = "0.7.0" @@ -5713,19 +5790,6 @@ dependencies = [ "semver 1.0.28", ] -[[package]] -name = "rustix" -version = "0.38.44" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fdb5bc1ae2baa591800df16c9ca78619bf65c0488b41b96ccec5d11220d8c154" -dependencies = [ - "bitflags", - "errno", - "libc", - "linux-raw-sys 0.4.15", - "windows-sys 0.59.0", -] - [[package]] name = "rustix" version = "1.1.4" @@ -5735,7 +5799,7 @@ dependencies = [ "bitflags", "errno", "libc", - "linux-raw-sys 0.12.1", + "linux-raw-sys", "windows-sys 0.61.2", ] @@ -6104,6 +6168,16 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b2aa850e253778c88a04c3d7323b043aeda9d3e30d5971937c1855769763678e" +[[package]] +name = "sized-chunks" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16d69225bde7a69b235da73377861095455d298f2b970996eec25ddbb42b3d1e" +dependencies = [ + "bitmaps", + "typenum", +] + [[package]] name = "slab" version = "0.4.12" @@ -6319,7 +6393,7 @@ dependencies = [ "fastrand", "getrandom 0.4.2", "once_cell", - "rustix 1.1.4", + "rustix", "windows-sys 0.61.2", ] @@ -6341,23 +6415,13 @@ dependencies = [ "winapi-util", ] -[[package]] -name = "terminal_size" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21bebf2b7c9e0a515f6e0f8c51dc0f8e4696391e6f1ff30379559f8365fb0df7" -dependencies = [ - "rustix 0.38.44", - "windows-sys 0.48.0", -] - [[package]] name = "terminal_size" version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "230a1b821ccbd75b185820a1f1ff7b14d21da1e442e22c0863ea5f08771a8874" dependencies = [ - "rustix 1.1.4", + "rustix", "windows-sys 0.61.2", ] @@ -7411,6 +7475,17 @@ dependencies = [ "semver 1.0.28", ] +[[package]] +name = "wasmprinter" +version = "0.227.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32475a0459db5639e989206dd8833fb07110ec092a7cb3468c82341989cac4d3" +dependencies = [ + "anyhow", + "termcolor", + "wasmparser 0.227.1", +] + [[package]] name = "wast" version = "246.0.2" @@ -7581,15 +7656,6 @@ dependencies = [ "windows-targets 0.42.2", ] -[[package]] -name = "windows-sys" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" -dependencies = [ - "windows-targets 0.48.5", -] - [[package]] name = "windows-sys" version = "0.52.0" @@ -7599,15 +7665,6 @@ dependencies = [ "windows-targets 0.52.6", ] -[[package]] -name = "windows-sys" -version = "0.59.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" -dependencies = [ - "windows-targets 0.52.6", -] - [[package]] name = "windows-sys" version = "0.60.2" @@ -7641,21 +7698,6 @@ dependencies = [ "windows_x86_64_msvc 0.42.2", ] -[[package]] -name = "windows-targets" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" -dependencies = [ - "windows_aarch64_gnullvm 0.48.5", - "windows_aarch64_msvc 0.48.5", - "windows_i686_gnu 0.48.5", - "windows_i686_msvc 0.48.5", - "windows_x86_64_gnu 0.48.5", - "windows_x86_64_gnullvm 0.48.5", - "windows_x86_64_msvc 0.48.5", -] - [[package]] name = "windows-targets" version = "0.52.6" @@ -7695,12 +7737,6 @@ version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" - [[package]] name = "windows_aarch64_gnullvm" version = "0.52.6" @@ -7719,12 +7755,6 @@ version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" -[[package]] -name = "windows_aarch64_msvc" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" - [[package]] name = "windows_aarch64_msvc" version = "0.52.6" @@ -7743,12 +7773,6 @@ version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" -[[package]] -name = "windows_i686_gnu" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" - [[package]] name = "windows_i686_gnu" version = "0.52.6" @@ -7779,12 +7803,6 @@ version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" -[[package]] -name = "windows_i686_msvc" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" - [[package]] name = "windows_i686_msvc" version = "0.52.6" @@ -7803,12 +7821,6 @@ version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" -[[package]] -name = "windows_x86_64_gnu" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" - [[package]] name = "windows_x86_64_gnu" version = "0.52.6" @@ -7827,12 +7839,6 @@ version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" - [[package]] name = "windows_x86_64_gnullvm" version = "0.52.6" @@ -7851,12 +7857,6 @@ version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" -[[package]] -name = "windows_x86_64_msvc" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" - [[package]] name = "windows_x86_64_msvc" version = "0.52.6" @@ -7884,95 +7884,6 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09dac053f1cd375980747450bfc7250c264eaae0583872e845c0c7cd578872b5" -[[package]] -name = "winter-air" -version = "0.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef01227f23c7c331710f43b877a8333f5f8d539631eea763600f1a74bf018c7c" -dependencies = [ - "libm", - "winter-crypto", - "winter-fri", - "winter-math", - "winter-utils", -] - -[[package]] -name = "winter-crypto" -version = "0.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1cdb247bc142438798edb04067ab72a22cf815f57abbd7b78a6fa986fc101db8" -dependencies = [ - "blake3", - "sha3", - "winter-math", - "winter-utils", -] - -[[package]] -name = "winter-fri" -version = "0.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd592b943f9d65545683868aaf1b601eb66e52bfd67175347362efff09101d3a" -dependencies = [ - "winter-crypto", - "winter-math", - "winter-utils", -] - -[[package]] -name = "winter-math" -version = "0.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7aecfb48ee6a8b4746392c8ff31e33e62df8528a3b5628c5af27b92b14aef1ea" -dependencies = [ - "winter-utils", -] - -[[package]] -name = "winter-maybe-async" -version = "0.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d31a19dae58475d019850e25b0170e94b16d382fbf6afee9c0e80fdc935e73e" -dependencies = [ - "quote", - "syn 2.0.117", -] - -[[package]] -name = "winter-prover" -version = "0.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84cc631ed56cd39b78ef932c1ec4060cc6a44d114474291216c32f56655b3048" -dependencies = [ - "tracing", - "winter-air", - "winter-crypto", - "winter-fri", - "winter-math", - "winter-maybe-async", - "winter-utils", -] - -[[package]] -name = "winter-utils" -version = "0.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9951263ef5317740cd0f49e618db00c72fabb70b75756ea26c4d5efe462c04dd" - -[[package]] -name = "winter-verifier" -version = "0.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0425ea81f8f703a1021810216da12003175c7974a584660856224df04b2e2fdb" -dependencies = [ - "winter-air", - "winter-crypto", - "winter-fri", - "winter-math", - "winter-utils", -] - [[package]] name = "wit-bindgen" version = "0.46.0" diff --git a/Cargo.toml b/Cargo.toml index 4a5dd53d..12a55cf5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -27,8 +27,8 @@ miden-pow-rate-limiter = { path = "crates/pow", version = "0.14.0" } miden-client = { version = "0.14" } miden-client-cli = { version = "0.14" } miden-client-sqlite-store = { version = "0.14" } -miden = { version = "0.8" } -cargo-miden = { version = "0.6" } +miden = { version = "0.11" } +cargo-miden = { git = "https://github.com/0xMiden/compiler", branch = "next" } # External dependencies anyhow = { version = "1.0" } From 257490d2347c6c627c7c80411b0c8bac66fbf842 Mon Sep 17 00:00:00 2001 From: tomasarrachea Date: Fri, 10 Apr 2026 00:48:58 -0300 Subject: [PATCH 11/19] feat: use faucet::mint binding --- Cargo.lock | 1 + crates/contracts/mint-tx/Cargo.toml | 3 + crates/contracts/mint-tx/build.rs | 18 ++++++ crates/contracts/mint-tx/src/lib.rs | 93 +++++++++++++++++++++++------ crates/faucet/src/lib.rs | 9 +-- 5 files changed, 100 insertions(+), 24 deletions(-) create mode 100644 crates/contracts/mint-tx/build.rs diff --git a/Cargo.lock b/Cargo.lock index 984e2e8d..ea230046 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3258,6 +3258,7 @@ dependencies = [ name = "miden-faucet-mint-tx" version = "0.14.0" dependencies = [ + "blake3", "miden", ] diff --git a/crates/contracts/mint-tx/Cargo.toml b/crates/contracts/mint-tx/Cargo.toml index c6672435..bcb7d0f2 100644 --- a/crates/contracts/mint-tx/Cargo.toml +++ b/crates/contracts/mint-tx/Cargo.toml @@ -17,6 +17,9 @@ crate-type = ["cdylib"] [dependencies] miden = { workspace = true } +[build-dependencies] +blake3 = "1" + [package.metadata.component] package = "miden:mint-tx" diff --git a/crates/contracts/mint-tx/build.rs b/crates/contracts/mint-tx/build.rs new file mode 100644 index 00000000..1d81396f --- /dev/null +++ b/crates/contracts/mint-tx/build.rs @@ -0,0 +1,18 @@ +/// Computes `StorageSlotId` felts from a slot name string using the same algorithm as +/// `miden_core::utils::hash_string_to_word` (blake3 → 4 little-endian u64s mod Goldilocks prime). +fn main() { + let name = "miden::standards::fungible_faucets::metadata"; + let digest = blake3::hash(name.as_bytes()); + let bytes = digest.as_bytes(); + + let felt = |i: usize| -> u64 { + let raw = u64::from_le_bytes(bytes[i * 8..(i + 1) * 8].try_into().unwrap()); + // Goldilocks prime: 2^64 - 2^32 + 1 + const PRIME: u128 = (1 << 64) - (1 << 32) + 1; + (raw as u128 % PRIME) as u64 + }; + + // StorageSlotId: suffix = word[0], prefix = word[1] + println!("cargo::rustc-env=METADATA_SLOT_SUFFIX={}", felt(0)); + println!("cargo::rustc-env=METADATA_SLOT_PREFIX={}", felt(1)); +} diff --git a/crates/contracts/mint-tx/src/lib.rs b/crates/contracts/mint-tx/src/lib.rs index e0e95447..295d732d 100644 --- a/crates/contracts/mint-tx/src/lib.rs +++ b/crates/contracts/mint-tx/src/lib.rs @@ -3,34 +3,91 @@ use miden::intrinsics::advice::adv_push_mapvaln; use miden::tx::update_expiration_block_delta; -use miden::{Felt, Word, active_account, adv_load_preimage, felt, tx_script}; +use miden::{ + Felt, + Recipient, + StorageSlotId, + Word, + faucet, + output_note, + pipe_words_to_memory, + storage, + tx_script, +}; -const NOTE_ARGS_SIZE: usize = 4; +/// Number of felts per note: 4 (recipient) + 1 (note_type) + 1 (tag) + 1 (amount) = 7. +const NOTE_ARGS_SIZE: usize = 7; + +/// Returns the metadata storage slot ID for `"miden::standards::fungible_faucets::metadata"`. +/// Layout: [token_symbol, decimals, max_supply, token_supply]. +/// +/// The slot ID is computed at build time from the slot name via blake3 (see build.rs). +fn metadata_slot() -> StorageSlotId { + const PREFIX: u64 = { + let bytes = env!("METADATA_SLOT_PREFIX").as_bytes(); + parse_u64(bytes) + }; + const SUFFIX: u64 = { + let bytes = env!("METADATA_SLOT_SUFFIX").as_bytes(); + parse_u64(bytes) + }; + StorageSlotId::from_prefix_suffix(Felt::new(PREFIX), Felt::new(SUFFIX)) +} + +/// Parses a u64 from a byte slice of ASCII digits at compile time. +const fn parse_u64(bytes: &[u8]) -> u64 { + let mut result: u64 = 0; + let mut i = 0; + while i < bytes.len() { + result = result * 10 + (bytes[i] - b'0') as u64; + i += 1; + } + result +} #[tx_script] fn run(arg: Word) { update_expiration_block_delta(Felt::from_u32(10)); - let commitment = arg.reverse(); - let num_felts = adv_push_mapvaln(commitment); - let num_felts_u64 = num_felts.as_u64(); - assert_eq!(Felt::from_u32((num_felts_u64 % 7) as u32), felt!(0)); + // Push note data from advice map onto the advice stack. + let num_felts = adv_push_mapvaln(arg); + let num_felts_u64 = num_felts.as_canonical_u64(); - let num_words = Felt::from_u64_unchecked(num_felts_u64 / 4); - let mut input = adv_load_preimage(num_words, commitment); - input.reverse(); // TODO: check if reverse is needed due to pop + // Pop the data from the advice stack into memory. + let num_words = Felt::new((num_felts_u64 + 3) / 4); + let (_hash, input) = pipe_words_to_memory(num_words); - let num_words_usize = num_words.as_u64() as usize; - for idx in 0..num_words_usize { + let num_notes = num_felts_u64 as usize / NOTE_ARGS_SIZE; + + for idx in 0..num_notes { let start = idx * NOTE_ARGS_SIZE; - let recipient: [Felt; 4] = - input[start..start + 4].try_into().expect("invalid input length"); - let note_type = input[start + 4]; - let tag = input[start + 5]; + let recipient = Recipient::from(Word::from([ + input[start], + input[start + 1], + input[start + 2], + input[start + 3], + ])); + let note_type = input[start + 4].into(); + let tag = input[start + 5].into(); let amount = input[start + 6]; - // TODO: call distribute account procedure - let num_procedures = active_account::get_num_procedures(); - assert_ne!(num_procedures, Felt::from_u32(0)); + // Read the metadata slot and update token supply. + let metadata = storage::get_item(metadata_slot()); + let token_supply = metadata[3]; + let max_supply = metadata[2]; + + let new_supply = token_supply.as_canonical_u64() + amount.as_canonical_u64(); + assert!(new_supply <= max_supply.as_canonical_u64()); + + let new_metadata = + Word::from([metadata[0], metadata[1], metadata[2], Felt::new(new_supply)]); + storage::set_item(metadata_slot(), new_metadata); + + // Mint the asset and create an output note. + let asset = faucet::create_fungible_asset(amount); + faucet::mint(asset); + + let note_idx = output_note::create(tag, note_type, recipient); + output_note::add_asset(asset, note_idx); } } diff --git a/crates/faucet/src/lib.rs b/crates/faucet/src/lib.rs index 0d27ea61..b129f89e 100644 --- a/crates/faucet/src/lib.rs +++ b/crates/faucet/src/lib.rs @@ -645,13 +645,10 @@ mod tests { client.ensure_genesis_in_place().await.unwrap(); client.add_account(&account, false).await.unwrap(); - let package = - build_project_in_dir(Path::new("../contracts/mint-tx"), true).unwrap(); + let package = build_project_in_dir(Path::new("../contracts/mint-tx"), true).unwrap(); let program = package.unwrap_program(); - let script = TransactionScript::from_parts( - program.mast_forest().clone(), - program.entrypoint(), - ); + let script = + TransactionScript::from_parts(program.mast_forest().clone(), program.entrypoint()); let (issuance, _) = watch::channel(AssetAmount::new(0).unwrap()); Faucet { From c4194b02dd42761494a7f6cde0a25aa07e1a7c3d Mon Sep 17 00:00:00 2001 From: tomasarrachea Date: Mon, 13 Apr 2026 15:07:11 -0300 Subject: [PATCH 12/19] feat: workaround to link kernel --- Cargo.lock | 2 ++ crates/faucet/Cargo.toml | 6 +++-- crates/faucet/src/lib.rs | 13 +++++++---- crates/faucet/src/package.rs | 44 ++++++++++++++++++++++++++++++++++++ 4 files changed, 58 insertions(+), 7 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ea230046..1dc6a71e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3245,6 +3245,8 @@ dependencies = [ "cargo-miden", "miden-client", "miden-client-sqlite-store", + "midenc-compile", + "midenc-session", "rand 0.9.2", "serde", "thiserror 2.0.18", diff --git a/crates/faucet/Cargo.toml b/crates/faucet/Cargo.toml index e25e2401..c96863a6 100644 --- a/crates/faucet/Cargo.toml +++ b/crates/faucet/Cargo.toml @@ -30,5 +30,7 @@ tracing = { workspace = true } url = { workspace = true } [dev-dependencies] -miden-client = { features = ["testing", "tonic"], workspace = true } -uuid = { workspace = true } +miden-client = { features = ["testing", "tonic"], workspace = true } +midenc-compile = { git = "https://github.com/0xMiden/compiler", branch = "next" } +midenc-session = { git = "https://github.com/0xMiden/compiler", branch = "next" } +uuid = { workspace = true } diff --git a/crates/faucet/src/lib.rs b/crates/faucet/src/lib.rs index b129f89e..4b9e2786 100644 --- a/crates/faucet/src/lib.rs +++ b/crates/faucet/src/lib.rs @@ -405,7 +405,8 @@ impl Faucet { // Build the transaction let expected_output_recipients: Vec<_> = notes.iter().map(Note::recipient).cloned().collect(); - let mut note_data = vec![]; + let n = notes.len() as u64; + let mut note_data = vec![Felt::new(n)]; for note in notes { // SAFETY: these are p2id notes with only one fungible asset let amount = note.assets().iter().next().unwrap().unwrap_fungible().amount(); @@ -570,6 +571,7 @@ mod tests { use super::*; use crate::types::NoteType; + #[tokio::test] async fn batch_requests() { let batch_size = 32; @@ -645,10 +647,11 @@ mod tests { client.ensure_genesis_in_place().await.unwrap(); client.add_account(&account, false).await.unwrap(); - let package = build_project_in_dir(Path::new("../contracts/mint-tx"), true).unwrap(); - let program = package.unwrap_program(); - let script = - TransactionScript::from_parts(program.mast_forest().clone(), program.entrypoint()); + let script = { + use miden_client::assembly::CodeBuilder; + let masm_code = include_str!("../../../target/masm/mint.masm"); + CodeBuilder::new().compile_tx_script(masm_code).unwrap() + }; let (issuance, _) = watch::channel(AssetAmount::new(0).unwrap()); Faucet { diff --git a/crates/faucet/src/package.rs b/crates/faucet/src/package.rs index d96f2425..9763a8c9 100644 --- a/crates/faucet/src/package.rs +++ b/crates/faucet/src/package.rs @@ -44,3 +44,47 @@ pub fn build_project_in_dir(dir: &Path, release: bool) -> anyhow::Result anyhow::Result { + let profile = if release { "--release" } else { "--debug" }; + let manifest_path = dir.join("Cargo.toml"); + let manifest_arg = manifest_path.to_string_lossy(); + + // First build normally to produce the Wasm + let args = vec!["cargo", "miden", "build", profile, "--manifest-path", &manifest_arg]; + let _ = run(args.into_iter().map(String::from), OutputType::Wasm) + .context("Failed to compile project to Wasm")? + .context("Cargo miden build returned None")?; + + // Now invoke midenc directly on the Wasm to get MASM text + let workspace_root = Path::new(env!("CARGO_MANIFEST_DIR")).join("../.."); + let wasm_path = workspace_root.join("target/wasm32-wasip2") + .join(if release { "release" } else { "debug" }) + .join("miden_faucet_mint_tx.wasm"); + + let out_dir = std::env::temp_dir().join("miden_masm_text"); + std::fs::create_dir_all(&out_dir)?; + let output_file = out_dir.join("miden_faucet_mint_tx.masm"); + + use std::rc::Rc; + let input = midenc_session::InputFile::from_path(&wasm_path) + .map_err(|e| anyhow::anyhow!("{e}"))?; + let output_file = out_dir.join("miden_faucet_mint_tx.wat"); + let args: Vec = vec![ + "--output-dir".into(), + out_dir.to_str().unwrap().into(), + "-o".into(), + output_file.to_str().unwrap().into(), + "--emit".into(), + "wat".into(), + ]; + let session = Rc::new(midenc_compile::Compiler::new_session([input], None, args)); + let context = Rc::new(midenc_compile::Context::new(session)); + midenc_compile::compile(context).map_err(|e| anyhow::anyhow!("{e}"))?; + + std::fs::read_to_string(&output_file).context("Failed to read HIR output") +} From edf3100b90fb46a7209c6e2f4fdd30ce7c6c5e3c Mon Sep 17 00:00:00 2001 From: tomasarrachea Date: Wed, 15 Apr 2026 10:53:08 -0300 Subject: [PATCH 13/19] feat: add faucet account component --- Cargo.lock | 44 ++++++----- Cargo.toml | 2 +- .../faucet-account/.cargo/config.toml | 5 ++ crates/contracts/faucet-account/Cargo.toml | 17 +++++ crates/contracts/faucet-account/src/lib.rs | 27 +++++++ crates/contracts/faucet-account/wit/.gitkeep | 0 crates/contracts/mint-tx/.cargo/config.toml | 5 ++ crates/contracts/mint-tx/Cargo.toml | 10 ++- crates/contracts/mint-tx/build.rs | 18 ----- crates/contracts/mint-tx/src/lib.rs | 62 ++------------- crates/faucet/Cargo.toml | 8 +- crates/faucet/src/lib.rs | 75 +++++++++++++------ crates/faucet/src/package.rs | 45 +---------- 13 files changed, 149 insertions(+), 169 deletions(-) create mode 100644 crates/contracts/faucet-account/.cargo/config.toml create mode 100644 crates/contracts/faucet-account/Cargo.toml create mode 100644 crates/contracts/faucet-account/src/lib.rs create mode 100644 crates/contracts/faucet-account/wit/.gitkeep create mode 100644 crates/contracts/mint-tx/.cargo/config.toml delete mode 100644 crates/contracts/mint-tx/build.rs diff --git a/Cargo.lock b/Cargo.lock index 1dc6a71e..5e338a7c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -595,7 +595,7 @@ dependencies = [ [[package]] name = "cargo-miden" version = "0.8.0" -source = "git+https://github.com/0xMiden/compiler?branch=next#2dc362e49c0aed00969bd1a890b3be0e9039f0d4" +source = "git+https://github.com/0xMiden/compiler?branch=next#35f138ea9f1d23e126345125d7e1f6e98918d2f7" dependencies = [ "anyhow", "cargo_metadata", @@ -3216,6 +3216,13 @@ dependencies = [ "uuid", ] +[[package]] +name = "miden-faucet-account" +version = "0.1.0" +dependencies = [ + "miden", +] + [[package]] name = "miden-faucet-client" version = "0.14.0" @@ -3245,8 +3252,6 @@ dependencies = [ "cargo-miden", "miden-client", "miden-client-sqlite-store", - "midenc-compile", - "midenc-session", "rand 0.9.2", "serde", "thiserror 2.0.18", @@ -3260,7 +3265,6 @@ dependencies = [ name = "miden-faucet-mint-tx" version = "0.14.0" dependencies = [ - "blake3", "miden", ] @@ -3799,7 +3803,7 @@ dependencies = [ [[package]] name = "midenc-codegen-masm" version = "0.8.0" -source = "git+https://github.com/0xMiden/compiler?branch=next#2dc362e49c0aed00969bd1a890b3be0e9039f0d4" +source = "git+https://github.com/0xMiden/compiler?branch=next#35f138ea9f1d23e126345125d7e1f6e98918d2f7" dependencies = [ "anyhow", "inventory", @@ -3828,7 +3832,7 @@ dependencies = [ [[package]] name = "midenc-compile" version = "0.8.0" -source = "git+https://github.com/0xMiden/compiler?branch=next#2dc362e49c0aed00969bd1a890b3be0e9039f0d4" +source = "git+https://github.com/0xMiden/compiler?branch=next#35f138ea9f1d23e126345125d7e1f6e98918d2f7" dependencies = [ "anyhow", "clap", @@ -3850,7 +3854,7 @@ dependencies = [ [[package]] name = "midenc-dialect-arith" version = "0.8.0" -source = "git+https://github.com/0xMiden/compiler?branch=next#2dc362e49c0aed00969bd1a890b3be0e9039f0d4" +source = "git+https://github.com/0xMiden/compiler?branch=next#35f138ea9f1d23e126345125d7e1f6e98918d2f7" dependencies = [ "midenc-hir", "paste", @@ -3859,7 +3863,7 @@ dependencies = [ [[package]] name = "midenc-dialect-cf" version = "0.8.0" -source = "git+https://github.com/0xMiden/compiler?branch=next#2dc362e49c0aed00969bd1a890b3be0e9039f0d4" +source = "git+https://github.com/0xMiden/compiler?branch=next#35f138ea9f1d23e126345125d7e1f6e98918d2f7" dependencies = [ "log", "midenc-dialect-arith", @@ -3869,7 +3873,7 @@ dependencies = [ [[package]] name = "midenc-dialect-hir" version = "0.8.0" -source = "git+https://github.com/0xMiden/compiler?branch=next#2dc362e49c0aed00969bd1a890b3be0e9039f0d4" +source = "git+https://github.com/0xMiden/compiler?branch=next#35f138ea9f1d23e126345125d7e1f6e98918d2f7" dependencies = [ "log", "midenc-dialect-arith", @@ -3882,7 +3886,7 @@ dependencies = [ [[package]] name = "midenc-dialect-scf" version = "0.8.0" -source = "git+https://github.com/0xMiden/compiler?branch=next#2dc362e49c0aed00969bd1a890b3be0e9039f0d4" +source = "git+https://github.com/0xMiden/compiler?branch=next#35f138ea9f1d23e126345125d7e1f6e98918d2f7" dependencies = [ "bitvec", "log", @@ -3896,7 +3900,7 @@ dependencies = [ [[package]] name = "midenc-dialect-ub" version = "0.8.0" -source = "git+https://github.com/0xMiden/compiler?branch=next#2dc362e49c0aed00969bd1a890b3be0e9039f0d4" +source = "git+https://github.com/0xMiden/compiler?branch=next#35f138ea9f1d23e126345125d7e1f6e98918d2f7" dependencies = [ "midenc-hir", ] @@ -3904,7 +3908,7 @@ dependencies = [ [[package]] name = "midenc-dialect-wasm" version = "0.8.0" -source = "git+https://github.com/0xMiden/compiler?branch=next#2dc362e49c0aed00969bd1a890b3be0e9039f0d4" +source = "git+https://github.com/0xMiden/compiler?branch=next#35f138ea9f1d23e126345125d7e1f6e98918d2f7" dependencies = [ "midenc-dialect-arith", "midenc-dialect-hir", @@ -3914,7 +3918,7 @@ dependencies = [ [[package]] name = "midenc-frontend-wasm" version = "0.8.0" -source = "git+https://github.com/0xMiden/compiler?branch=next#2dc362e49c0aed00969bd1a890b3be0e9039f0d4" +source = "git+https://github.com/0xMiden/compiler?branch=next#35f138ea9f1d23e126345125d7e1f6e98918d2f7" dependencies = [ "addr2line 0.24.2", "anyhow", @@ -3939,7 +3943,7 @@ dependencies = [ [[package]] name = "midenc-hir" version = "0.8.0" -source = "git+https://github.com/0xMiden/compiler?branch=next#2dc362e49c0aed00969bd1a890b3be0e9039f0d4" +source = "git+https://github.com/0xMiden/compiler?branch=next#35f138ea9f1d23e126345125d7e1f6e98918d2f7" dependencies = [ "anyhow", "base64", @@ -3970,7 +3974,7 @@ dependencies = [ [[package]] name = "midenc-hir-analysis" version = "0.8.0" -source = "git+https://github.com/0xMiden/compiler?branch=next#2dc362e49c0aed00969bd1a890b3be0e9039f0d4" +source = "git+https://github.com/0xMiden/compiler?branch=next#35f138ea9f1d23e126345125d7e1f6e98918d2f7" dependencies = [ "bitvec", "blink-alloc", @@ -3981,7 +3985,7 @@ dependencies = [ [[package]] name = "midenc-hir-macros" version = "0.8.0" -source = "git+https://github.com/0xMiden/compiler?branch=next#2dc362e49c0aed00969bd1a890b3be0e9039f0d4" +source = "git+https://github.com/0xMiden/compiler?branch=next#35f138ea9f1d23e126345125d7e1f6e98918d2f7" dependencies = [ "Inflector", "darling", @@ -3993,7 +3997,7 @@ dependencies = [ [[package]] name = "midenc-hir-symbol" version = "0.8.0" -source = "git+https://github.com/0xMiden/compiler?branch=next#2dc362e49c0aed00969bd1a890b3be0e9039f0d4" +source = "git+https://github.com/0xMiden/compiler?branch=next#35f138ea9f1d23e126345125d7e1f6e98918d2f7" dependencies = [ "Inflector", "compact_str", @@ -4008,7 +4012,7 @@ dependencies = [ [[package]] name = "midenc-hir-transform" version = "0.8.0" -source = "git+https://github.com/0xMiden/compiler?branch=next#2dc362e49c0aed00969bd1a890b3be0e9039f0d4" +source = "git+https://github.com/0xMiden/compiler?branch=next#35f138ea9f1d23e126345125d7e1f6e98918d2f7" dependencies = [ "log", "midenc-hir", @@ -4033,7 +4037,7 @@ dependencies = [ [[package]] name = "midenc-log" version = "0.8.0" -source = "git+https://github.com/0xMiden/compiler?branch=next#2dc362e49c0aed00969bd1a890b3be0e9039f0d4" +source = "git+https://github.com/0xMiden/compiler?branch=next#35f138ea9f1d23e126345125d7e1f6e98918d2f7" dependencies = [ "anstream 0.6.21", "anstyle", @@ -4045,7 +4049,7 @@ dependencies = [ [[package]] name = "midenc-session" version = "0.8.0" -source = "git+https://github.com/0xMiden/compiler?branch=next#2dc362e49c0aed00969bd1a890b3be0e9039f0d4" +source = "git+https://github.com/0xMiden/compiler?branch=next#35f138ea9f1d23e126345125d7e1f6e98918d2f7" dependencies = [ "anyhow", "clap", diff --git a/Cargo.toml b/Cargo.toml index 12a55cf5..600c7580 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,5 @@ [workspace] -members = ["bin/faucet", "bin/faucet-client", "crates/faucet", "crates/pow", "crates/contracts/mint-tx"] +members = ["bin/faucet", "bin/faucet-client", "crates/faucet", "crates/pow", "crates/contracts/mint-tx", "crates/contracts/faucet-account"] default-members = ["bin/faucet", "crates/faucet", "crates/pow"] resolver = "2" diff --git a/crates/contracts/faucet-account/.cargo/config.toml b/crates/contracts/faucet-account/.cargo/config.toml new file mode 100644 index 00000000..72bc2bef --- /dev/null +++ b/crates/contracts/faucet-account/.cargo/config.toml @@ -0,0 +1,5 @@ +[build] +target = "wasm32-wasip2" + +[target.wasm32-wasip2] +rustflags = ["--cfg", "miden"] diff --git a/crates/contracts/faucet-account/Cargo.toml b/crates/contracts/faucet-account/Cargo.toml new file mode 100644 index 00000000..cf7356b2 --- /dev/null +++ b/crates/contracts/faucet-account/Cargo.toml @@ -0,0 +1,17 @@ +[package] +name = "miden-faucet-account" +version = "0.1.0" +edition = "2024" + +[lib] +crate-type = ["cdylib"] + +[dependencies] +miden = { workspace = true } + +[package.metadata.component] +package = "miden:faucet-account" + +[package.metadata.miden] +project-kind = "account" +supported-types = ["FungibleFaucet"] diff --git a/crates/contracts/faucet-account/src/lib.rs b/crates/contracts/faucet-account/src/lib.rs new file mode 100644 index 00000000..ef6c6b37 --- /dev/null +++ b/crates/contracts/faucet-account/src/lib.rs @@ -0,0 +1,27 @@ +#![no_std] +#![feature(alloc_error_handler)] + +use miden::{Felt, NoteIdx, NoteType, Recipient, Tag, component, faucet, output_note}; + +#[component] +struct FaucetAccount; + +#[component] +impl FaucetAccount { + /// Mints fungible assets and sends them to the provided recipient by creating a note. + /// + /// This mirrors the `mint_and_send` procedure from the `BasicFungibleFaucet` MASM component. + pub fn mint_and_send( + &mut self, + amount: Felt, + tag: Tag, + note_type: NoteType, + recipient: Recipient, + ) -> NoteIdx { + let asset = faucet::create_fungible_asset(amount); + faucet::mint(asset); + let note_idx = output_note::create(tag, note_type, recipient); + output_note::add_asset(asset, note_idx); + note_idx + } +} diff --git a/crates/contracts/faucet-account/wit/.gitkeep b/crates/contracts/faucet-account/wit/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/crates/contracts/mint-tx/.cargo/config.toml b/crates/contracts/mint-tx/.cargo/config.toml new file mode 100644 index 00000000..72bc2bef --- /dev/null +++ b/crates/contracts/mint-tx/.cargo/config.toml @@ -0,0 +1,5 @@ +[build] +target = "wasm32-wasip2" + +[target.wasm32-wasip2] +rustflags = ["--cfg", "miden"] diff --git a/crates/contracts/mint-tx/Cargo.toml b/crates/contracts/mint-tx/Cargo.toml index bcb7d0f2..ad98077f 100644 --- a/crates/contracts/mint-tx/Cargo.toml +++ b/crates/contracts/mint-tx/Cargo.toml @@ -17,11 +17,15 @@ crate-type = ["cdylib"] [dependencies] miden = { workspace = true } -[build-dependencies] -blake3 = "1" - [package.metadata.component] package = "miden:mint-tx" [package.metadata.miden] project-kind = "transaction-script" + +# Miden dependencies for cargo-miden build/linking +[package.metadata.miden.dependencies] +"miden:faucet-account" = { path = "../faucet-account" } + +[package.metadata.component.target.dependencies] +"miden:faucet-account" = { path = "../faucet-account/target/generated-wit/" } diff --git a/crates/contracts/mint-tx/build.rs b/crates/contracts/mint-tx/build.rs deleted file mode 100644 index 1d81396f..00000000 --- a/crates/contracts/mint-tx/build.rs +++ /dev/null @@ -1,18 +0,0 @@ -/// Computes `StorageSlotId` felts from a slot name string using the same algorithm as -/// `miden_core::utils::hash_string_to_word` (blake3 → 4 little-endian u64s mod Goldilocks prime). -fn main() { - let name = "miden::standards::fungible_faucets::metadata"; - let digest = blake3::hash(name.as_bytes()); - let bytes = digest.as_bytes(); - - let felt = |i: usize| -> u64 { - let raw = u64::from_le_bytes(bytes[i * 8..(i + 1) * 8].try_into().unwrap()); - // Goldilocks prime: 2^64 - 2^32 + 1 - const PRIME: u128 = (1 << 64) - (1 << 32) + 1; - (raw as u128 % PRIME) as u64 - }; - - // StorageSlotId: suffix = word[0], prefix = word[1] - println!("cargo::rustc-env=METADATA_SLOT_SUFFIX={}", felt(0)); - println!("cargo::rustc-env=METADATA_SLOT_PREFIX={}", felt(1)); -} diff --git a/crates/contracts/mint-tx/src/lib.rs b/crates/contracts/mint-tx/src/lib.rs index 295d732d..bf29b7ee 100644 --- a/crates/contracts/mint-tx/src/lib.rs +++ b/crates/contracts/mint-tx/src/lib.rs @@ -3,50 +3,15 @@ use miden::intrinsics::advice::adv_push_mapvaln; use miden::tx::update_expiration_block_delta; -use miden::{ - Felt, - Recipient, - StorageSlotId, - Word, - faucet, - output_note, - pipe_words_to_memory, - storage, - tx_script, -}; +use miden::{Felt, Recipient, Word, pipe_words_to_memory, tx_script}; + +use crate::bindings::Account; /// Number of felts per note: 4 (recipient) + 1 (note_type) + 1 (tag) + 1 (amount) = 7. const NOTE_ARGS_SIZE: usize = 7; -/// Returns the metadata storage slot ID for `"miden::standards::fungible_faucets::metadata"`. -/// Layout: [token_symbol, decimals, max_supply, token_supply]. -/// -/// The slot ID is computed at build time from the slot name via blake3 (see build.rs). -fn metadata_slot() -> StorageSlotId { - const PREFIX: u64 = { - let bytes = env!("METADATA_SLOT_PREFIX").as_bytes(); - parse_u64(bytes) - }; - const SUFFIX: u64 = { - let bytes = env!("METADATA_SLOT_SUFFIX").as_bytes(); - parse_u64(bytes) - }; - StorageSlotId::from_prefix_suffix(Felt::new(PREFIX), Felt::new(SUFFIX)) -} - -/// Parses a u64 from a byte slice of ASCII digits at compile time. -const fn parse_u64(bytes: &[u8]) -> u64 { - let mut result: u64 = 0; - let mut i = 0; - while i < bytes.len() { - result = result * 10 + (bytes[i] - b'0') as u64; - i += 1; - } - result -} - #[tx_script] -fn run(arg: Word) { +fn run(arg: Word, account: &mut Account) { update_expiration_block_delta(Felt::from_u32(10)); // Push note data from advice map onto the advice stack. @@ -71,23 +36,6 @@ fn run(arg: Word) { let tag = input[start + 5].into(); let amount = input[start + 6]; - // Read the metadata slot and update token supply. - let metadata = storage::get_item(metadata_slot()); - let token_supply = metadata[3]; - let max_supply = metadata[2]; - - let new_supply = token_supply.as_canonical_u64() + amount.as_canonical_u64(); - assert!(new_supply <= max_supply.as_canonical_u64()); - - let new_metadata = - Word::from([metadata[0], metadata[1], metadata[2], Felt::new(new_supply)]); - storage::set_item(metadata_slot(), new_metadata); - - // Mint the asset and create an output note. - let asset = faucet::create_fungible_asset(amount); - faucet::mint(asset); - - let note_idx = output_note::create(tag, note_type, recipient); - output_note::add_asset(asset, note_idx); + account.mint_and_send(amount, tag, note_type, recipient); } } diff --git a/crates/faucet/Cargo.toml b/crates/faucet/Cargo.toml index c96863a6..1835bbde 100644 --- a/crates/faucet/Cargo.toml +++ b/crates/faucet/Cargo.toml @@ -18,7 +18,7 @@ workspace = true # Miden dependencies. miden-client = { features = ["tonic"], workspace = true } miden-client-sqlite-store = { workspace = true } -cargo-miden = { workspace = true } +cargo-miden = { workspace = true } # External dependencies. anyhow = { workspace = true } @@ -30,7 +30,5 @@ tracing = { workspace = true } url = { workspace = true } [dev-dependencies] -miden-client = { features = ["testing", "tonic"], workspace = true } -midenc-compile = { git = "https://github.com/0xMiden/compiler", branch = "next" } -midenc-session = { git = "https://github.com/0xMiden/compiler", branch = "next" } -uuid = { workspace = true } +miden-client = { features = ["testing", "tonic"], workspace = true } +uuid = { workspace = true } diff --git a/crates/faucet/src/lib.rs b/crates/faucet/src/lib.rs index 4b9e2786..ba29e080 100644 --- a/crates/faucet/src/lib.rs +++ b/crates/faucet/src/lib.rs @@ -140,10 +140,11 @@ impl Faucet { } client.set_setting(DEFAULT_ACCOUNT_ID_SETTING.to_owned(), account.id()).await?; - // Compile the mint tx script + // Compile the mint tx script from Rust via cargo-miden. let workspace_root = Path::new(env!("CARGO_MANIFEST_DIR")); let package = build_project_in_dir(&workspace_root.join("../contracts/mint-tx"), true)?; let program = package.unwrap_program(); + // TODO: use client.code_builder()? let script = TransactionScript::from_parts(program.mast_forest().clone(), program.entrypoint()); client.set_setting(MINT_TX_SCRIPT_SETTING.to_string(), script).await?; @@ -402,26 +403,32 @@ impl Faucet { &mut self, notes: &[Note], ) -> Result { - // Build the transaction - let expected_output_recipients: Vec<_> = - notes.iter().map(Note::recipient).cloned().collect(); - let n = notes.len() as u64; - let mut note_data = vec![Felt::new(n)]; + let mut note_data = vec![]; for note in notes { // SAFETY: these are p2id notes with only one fungible asset let amount = note.assets().iter().next().unwrap().unwrap_fungible().amount(); - note_data.extend(note.recipient().digest().iter().rev()); + note_data.extend(note.recipient().digest().iter()); note_data.push(Felt::from(note.metadata().note_type())); note_data.push(Felt::from(note.metadata().tag())); note_data.push(Felt::new(amount)); } + // Pad to word alignment for pipe_words_to_memory + // TODO: avoid while to do this + while note_data.len() % 4 != 0 { + note_data.push(Felt::ZERO); + } let note_data_commitment = Rpo256::hash_elements(¬e_data); let advice_map = [(note_data_commitment, note_data)]; + let script_with_advice = + self.script.clone().with_advice_map(advice_map.into_iter().collect()); + + let expected_output_recipients: Vec<_> = + notes.iter().map(Note::recipient).cloned().collect(); + TransactionRequestBuilder::new() - .custom_script(self.script.clone()) - .extend_advice_map(advice_map) + .custom_script(script_with_advice) .expected_output_recipients(expected_output_recipients) .script_arg(note_data_commitment) .build() @@ -557,9 +564,13 @@ fn build_p2id_notes( mod tests { use std::env::temp_dir; - use miden_client::account::component::AuthControlled; - use miden_client::account::{AccountBuilder, AccountStorageMode, AccountType}; - use miden_client::asset::TokenSymbol; + use miden_client::account::component::{AuthControlled, InitStorageData}; + use miden_client::account::{ + AccountBuilder, + AccountComponent, + AccountStorageMode, + AccountType, + }; use miden_client::auth::{AuthSchemeId, AuthSecretKey, AuthSingleSig}; use miden_client::crypto::rpo_falcon512::SecretKey; use miden_client::store::{NoteFilter, Store}; @@ -571,10 +582,27 @@ mod tests { use super::*; use crate::types::NoteType; + #[tokio::test] + async fn tx_script_compiles_and_executes() { + let store = SqliteStore::new(temp_dir().join(format!("{}.sqlite3", Uuid::new_v4()))) + .await + .unwrap(); + let mut faucet = build_faucet(Arc::new(store)).await; + + // Execute an empty transaction just to verify the script runs + let empty_tx_request = TransactionRequestBuilder::new() + .custom_script(faucet.script.clone()) + .build() + .unwrap(); + let result = + faucet.client.execute_transaction(faucet.id.account_id, empty_tx_request).await; + + assert!(result.is_ok(), "tx script should execute: {:?}", result.err()); + } #[tokio::test] async fn batch_requests() { - let batch_size = 32; + let batch_size = 4; let (tx_mint_requests, rx_mint_requests) = mpsc::channel(1000); let mut receivers = vec![]; @@ -616,12 +644,18 @@ mod tests { /// Builds a faucet using a mock client. async fn build_faucet(store: Arc) -> Faucet { let secret = SecretKey::new(); - let symbol = TokenSymbol::new("TEST").unwrap(); - let max_supply = Felt::try_from(1_000_000_000_000_u64).unwrap(); + + // Compile the faucet account component from Rust + let faucet_component_package = + build_project_in_dir(Path::new("../contracts/faucet-account"), true).unwrap(); + let faucet_component = + AccountComponent::from_package(&faucet_component_package, &InitStorageData::default()) + .unwrap(); + let account = AccountBuilder::new(rand::random()) .account_type(AccountType::FungibleFaucet) .storage_mode(AccountStorageMode::Public) - .with_component(BasicFungibleFaucet::new(symbol, 6, max_supply).unwrap()) + .with_component(faucet_component) .with_component(AuthControlled::allow_all()) .with_auth_component(AuthSingleSig::new( secret.public_key().to_commitment().into(), @@ -647,11 +681,10 @@ mod tests { client.ensure_genesis_in_place().await.unwrap(); client.add_account(&account, false).await.unwrap(); - let script = { - use miden_client::assembly::CodeBuilder; - let masm_code = include_str!("../../../target/masm/mint.masm"); - CodeBuilder::new().compile_tx_script(masm_code).unwrap() - }; + let package = build_project_in_dir(Path::new("../contracts/mint-tx"), true).unwrap(); + let program = package.unwrap_program(); + let script = + TransactionScript::from_parts(program.mast_forest().clone(), program.entrypoint()); let (issuance, _) = watch::channel(AssetAmount::new(0).unwrap()); Faucet { diff --git a/crates/faucet/src/package.rs b/crates/faucet/src/package.rs index 9763a8c9..6c036952 100644 --- a/crates/faucet/src/package.rs +++ b/crates/faucet/src/package.rs @@ -17,6 +17,7 @@ use miden_client::vm::Package; /// # Errors /// Returns an error if compilation fails or if the output is not in the expected format pub fn build_project_in_dir(dir: &Path, release: bool) -> anyhow::Result { + // TODO: use enum for profile flag let profile = if release { "--release" } else { "--debug" }; let manifest_path = dir.join("Cargo.toml"); let manifest_arg = manifest_path.to_string_lossy(); @@ -44,47 +45,3 @@ pub fn build_project_in_dir(dir: &Path, release: bool) -> anyhow::Result anyhow::Result { - let profile = if release { "--release" } else { "--debug" }; - let manifest_path = dir.join("Cargo.toml"); - let manifest_arg = manifest_path.to_string_lossy(); - - // First build normally to produce the Wasm - let args = vec!["cargo", "miden", "build", profile, "--manifest-path", &manifest_arg]; - let _ = run(args.into_iter().map(String::from), OutputType::Wasm) - .context("Failed to compile project to Wasm")? - .context("Cargo miden build returned None")?; - - // Now invoke midenc directly on the Wasm to get MASM text - let workspace_root = Path::new(env!("CARGO_MANIFEST_DIR")).join("../.."); - let wasm_path = workspace_root.join("target/wasm32-wasip2") - .join(if release { "release" } else { "debug" }) - .join("miden_faucet_mint_tx.wasm"); - - let out_dir = std::env::temp_dir().join("miden_masm_text"); - std::fs::create_dir_all(&out_dir)?; - let output_file = out_dir.join("miden_faucet_mint_tx.masm"); - - use std::rc::Rc; - let input = midenc_session::InputFile::from_path(&wasm_path) - .map_err(|e| anyhow::anyhow!("{e}"))?; - let output_file = out_dir.join("miden_faucet_mint_tx.wat"); - let args: Vec = vec![ - "--output-dir".into(), - out_dir.to_str().unwrap().into(), - "-o".into(), - output_file.to_str().unwrap().into(), - "--emit".into(), - "wat".into(), - ]; - let session = Rc::new(midenc_compile::Compiler::new_session([input], None, args)); - let context = Rc::new(midenc_compile::Context::new(session)); - midenc_compile::compile(context).map_err(|e| anyhow::anyhow!("{e}"))?; - - std::fs::read_to_string(&output_file).context("Failed to read HIR output") -} From d70bae8fb2115c2d7d282936a03f5041bc42096e Mon Sep 17 00:00:00 2001 From: tomasarrachea Date: Wed, 15 Apr 2026 12:44:34 -0300 Subject: [PATCH 14/19] feat: renames and comments --- CHANGELOG.md | 4 ++ Cargo.toml | 13 +++++-- crates/contracts/faucet-account/Cargo.toml | 6 +-- crates/contracts/faucet-account/src/lib.rs | 20 +++++++--- crates/contracts/mint-tx/Cargo.toml | 4 +- crates/contracts/mint-tx/src/lib.rs | 44 ++++++++++++++++++++-- crates/faucet/Cargo.toml | 2 +- crates/faucet/src/lib.rs | 21 ++++------- crates/faucet/src/package.rs | 5 +-- rust-toolchain.toml | 8 ++-- 10 files changed, 89 insertions(+), 38 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d808e153..aa817293 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## 0.15.0 (TBD) + +- Reimplemented the transaction script in Rust using the miden-compiler ([#204](https://github.com/0xMiden/faucet/pull/204)). + ## 0.14.0 (2026-04-08) - [BREAKING] Removed `--api-key` param from the `start` command, API keys are now persisted in the store and automatically loaded on startup. ([#225](https://github.com/0xMiden/miden-faucet/pull/225)). diff --git a/Cargo.toml b/Cargo.toml index 600c7580..8a45bf75 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,13 @@ [workspace] -members = ["bin/faucet", "bin/faucet-client", "crates/faucet", "crates/pow", "crates/contracts/mint-tx", "crates/contracts/faucet-account"] default-members = ["bin/faucet", "crates/faucet", "crates/pow"] +members = [ + "bin/faucet", + "bin/faucet-client", + "crates/contracts/faucet-account", + "crates/contracts/mint-tx", + "crates/faucet", + "crates/pow", +] resolver = "2" @@ -24,11 +31,11 @@ miden-faucet-lib = { path = "crates/faucet", version = "0.14.0" } miden-pow-rate-limiter = { path = "crates/pow", version = "0.14.0" } # Miden dependencies. +cargo-miden = { branch = "next", git = "https://github.com/0xMiden/compiler" } +miden = { version = "0.11" } miden-client = { version = "0.14" } miden-client-cli = { version = "0.14" } miden-client-sqlite-store = { version = "0.14" } -miden = { version = "0.11" } -cargo-miden = { git = "https://github.com/0xMiden/compiler", branch = "next" } # External dependencies anyhow = { version = "1.0" } diff --git a/crates/contracts/faucet-account/Cargo.toml b/crates/contracts/faucet-account/Cargo.toml index cf7356b2..3e8d5bfa 100644 --- a/crates/contracts/faucet-account/Cargo.toml +++ b/crates/contracts/faucet-account/Cargo.toml @@ -1,7 +1,7 @@ [package] -name = "miden-faucet-account" -version = "0.1.0" edition = "2024" +name = "miden-faucet-account" +version = "0.1.0" [lib] crate-type = ["cdylib"] @@ -13,5 +13,5 @@ miden = { workspace = true } package = "miden:faucet-account" [package.metadata.miden] -project-kind = "account" +project-kind = "account" supported-types = ["FungibleFaucet"] diff --git a/crates/contracts/faucet-account/src/lib.rs b/crates/contracts/faucet-account/src/lib.rs index ef6c6b37..3310248f 100644 --- a/crates/contracts/faucet-account/src/lib.rs +++ b/crates/contracts/faucet-account/src/lib.rs @@ -1,27 +1,37 @@ +//! Faucet account component. +//! +//! This component exposes the `mint_and_send` procedure for the faucet account. It uses kernel +//! procedures (`faucet::create_fungible_asset`, `faucet::mint`, `output_note::create`, +//! `output_note::add_asset`) which can only be called from within an account component context — +//! not directly from a transaction script. + #![no_std] #![feature(alloc_error_handler)] -use miden::{Felt, NoteIdx, NoteType, Recipient, Tag, component, faucet, output_note}; +use miden::{Felt, NoteType, Recipient, Tag, component, faucet, output_note}; #[component] struct FaucetAccount; #[component] impl FaucetAccount { - /// Mints fungible assets and sends them to the provided recipient by creating a note. + /// Mints a fungible asset and sends it to `recipient` by creating an output note. /// - /// This mirrors the `mint_and_send` procedure from the `BasicFungibleFaucet` MASM component. + /// # Arguments + /// - `amount`: the number of tokens to mint (in base units) + /// - `tag`: the note tag included in the output note metadata + /// - `note_type`: the visibility of the note (public or private) + /// - `recipient`: the note recipient digest pub fn mint_and_send( &mut self, amount: Felt, tag: Tag, note_type: NoteType, recipient: Recipient, - ) -> NoteIdx { + ) { let asset = faucet::create_fungible_asset(amount); faucet::mint(asset); let note_idx = output_note::create(tag, note_type, recipient); output_note::add_asset(asset, note_idx); - note_idx } } diff --git a/crates/contracts/mint-tx/Cargo.toml b/crates/contracts/mint-tx/Cargo.toml index ad98077f..29f2d395 100644 --- a/crates/contracts/mint-tx/Cargo.toml +++ b/crates/contracts/mint-tx/Cargo.toml @@ -1,11 +1,11 @@ [package] -name = "miden-faucet-mint-tx" authors.workspace = true description = "Miden faucet's mint transaction script" edition.workspace = true homepage.workspace = true -keywords = ["mint", "miden", "faucet"] +keywords = ["faucet", "miden", "mint"] license.workspace = true +name = "miden-faucet-mint-tx" readme = "README.md" repository.workspace = true rust-version.workspace = true diff --git a/crates/contracts/mint-tx/src/lib.rs b/crates/contracts/mint-tx/src/lib.rs index bf29b7ee..6d58095e 100644 --- a/crates/contracts/mint-tx/src/lib.rs +++ b/crates/contracts/mint-tx/src/lib.rs @@ -1,3 +1,34 @@ +//! Faucet mint transaction script. +//! +//! This script mints fungible assets and distributes them to recipients by creating output +//! notes. +//! +//! # Script argument +//! +//! The script receives a single `Word` argument (`arg`) which is the RPO hash commitment +//! of the note data stored in the advice map. +//! +//! # Advice map +//! +//! The advice map must contain an entry keyed by `arg` with the following layout: +//! +//! ```text +//! [RECIPIENT_1, note_type_1, tag_1, amount_1, RECIPIENT_2, note_type_2, tag_2, amount_2, ..., padding] +//! ``` +//! +//! Where for each note: +//! - `RECIPIENT` (4 felts): the note recipient digest +//! - `note_type` (1 felt): the note type (1 = public, 2 = private) +//! - `tag` (1 felt): the note tag +//! - `amount` (1 felt): the amount of tokens to mint +//! +//! The data must be padded with zeros to the next multiple of 4 felts (word-aligned). +//! +//! # Account component +//! +//! The script calls `account.mint_and_send()` from the faucet account component, which internally +//! creates a fungible asset, mints it via the kernel, and creates an output note with the asset. + #![no_std] #![feature(alloc_error_handler)] @@ -7,18 +38,23 @@ use miden::{Felt, Recipient, Word, pipe_words_to_memory, tx_script}; use crate::bindings::Account; -/// Number of felts per note: 4 (recipient) + 1 (note_type) + 1 (tag) + 1 (amount) = 7. +/// Number of felts per note in the advice map data. +/// +/// Layout: `[RECIPIENT(4), note_type(1), tag(1), amount(1)]` const NOTE_ARGS_SIZE: usize = 7; +/// Transaction expiration delta in blocks. +const EXPIRATION_DELTA: u32 = 10; + #[tx_script] fn run(arg: Word, account: &mut Account) { - update_expiration_block_delta(Felt::from_u32(10)); + update_expiration_block_delta(Felt::from_u32(EXPIRATION_DELTA)); - // Push note data from advice map onto the advice stack. + // Push note data from the advice map onto the advice stack using the commitment as key. let num_felts = adv_push_mapvaln(arg); let num_felts_u64 = num_felts.as_canonical_u64(); - // Pop the data from the advice stack into memory. + // Pop the data from the advice stack into memory (requires word-aligned length). let num_words = Felt::new((num_felts_u64 + 3) / 4); let (_hash, input) = pipe_words_to_memory(num_words); diff --git a/crates/faucet/Cargo.toml b/crates/faucet/Cargo.toml index 1835bbde..12029255 100644 --- a/crates/faucet/Cargo.toml +++ b/crates/faucet/Cargo.toml @@ -16,9 +16,9 @@ workspace = true [dependencies] # Miden dependencies. +cargo-miden = { workspace = true } miden-client = { features = ["tonic"], workspace = true } miden-client-sqlite-store = { workspace = true } -cargo-miden = { workspace = true } # External dependencies. anyhow = { workspace = true } diff --git a/crates/faucet/src/lib.rs b/crates/faucet/src/lib.rs index ba29e080..e53871cb 100644 --- a/crates/faucet/src/lib.rs +++ b/crates/faucet/src/lib.rs @@ -1,4 +1,5 @@ use std::collections::BTreeSet; +use std::iter::repeat; use std::path::{Path, PathBuf}; use std::sync::Arc; use std::time::Duration; @@ -38,7 +39,7 @@ pub mod requests; pub mod types; use crate::note_screener::NoteScreener; -use crate::package::build_project_in_dir; +use crate::package::compile_dir; use crate::requests::{MintError, MintRequest, MintResponse, MintResponseSender}; use crate::types::AssetAmount; @@ -142,9 +143,8 @@ impl Faucet { // Compile the mint tx script from Rust via cargo-miden. let workspace_root = Path::new(env!("CARGO_MANIFEST_DIR")); - let package = build_project_in_dir(&workspace_root.join("../contracts/mint-tx"), true)?; + let package = compile_dir(&workspace_root.join("../contracts/mint-tx"), true)?; let program = package.unwrap_program(); - // TODO: use client.code_builder()? let script = TransactionScript::from_parts(program.mast_forest().clone(), program.entrypoint()); client.set_setting(MINT_TX_SCRIPT_SETTING.to_string(), script).await?; @@ -414,21 +414,16 @@ impl Faucet { note_data.push(Felt::new(amount)); } // Pad to word alignment for pipe_words_to_memory - // TODO: avoid while to do this - while note_data.len() % 4 != 0 { - note_data.push(Felt::ZERO); - } + note_data.extend(repeat(Felt::ZERO).take(4 - note_data.len() % 4)); let note_data_commitment = Rpo256::hash_elements(¬e_data); let advice_map = [(note_data_commitment, note_data)]; - let script_with_advice = - self.script.clone().with_advice_map(advice_map.into_iter().collect()); - let expected_output_recipients: Vec<_> = notes.iter().map(Note::recipient).cloned().collect(); TransactionRequestBuilder::new() - .custom_script(script_with_advice) + .custom_script(self.script.clone()) + .extend_advice_map(advice_map) .expected_output_recipients(expected_output_recipients) .script_arg(note_data_commitment) .build() @@ -647,7 +642,7 @@ mod tests { // Compile the faucet account component from Rust let faucet_component_package = - build_project_in_dir(Path::new("../contracts/faucet-account"), true).unwrap(); + compile_dir(Path::new("../contracts/faucet-account"), true).unwrap(); let faucet_component = AccountComponent::from_package(&faucet_component_package, &InitStorageData::default()) .unwrap(); @@ -681,7 +676,7 @@ mod tests { client.ensure_genesis_in_place().await.unwrap(); client.add_account(&account, false).await.unwrap(); - let package = build_project_in_dir(Path::new("../contracts/mint-tx"), true).unwrap(); + let package = compile_dir(Path::new("../contracts/mint-tx"), true).unwrap(); let program = package.unwrap_program(); let script = TransactionScript::from_parts(program.mast_forest().clone(), program.entrypoint()); diff --git a/crates/faucet/src/package.rs b/crates/faucet/src/package.rs index 6c036952..b6355193 100644 --- a/crates/faucet/src/package.rs +++ b/crates/faucet/src/package.rs @@ -5,7 +5,7 @@ use cargo_miden::{OutputType, run}; use miden_client::Deserializable; use miden_client::vm::Package; -/// Builds a Miden project in the specified directory +/// Compiles a Miden project in the specified directory /// /// # Arguments /// * `dir` - Path to the directory containing the Cargo.toml @@ -16,8 +16,7 @@ use miden_client::vm::Package; /// /// # Errors /// Returns an error if compilation fails or if the output is not in the expected format -pub fn build_project_in_dir(dir: &Path, release: bool) -> anyhow::Result { - // TODO: use enum for profile flag +pub fn compile_dir(dir: &Path, release: bool) -> anyhow::Result { let profile = if release { "--release" } else { "--debug" }; let manifest_path = dir.join("Cargo.toml"); let manifest_arg = manifest_path.to_string_lossy(); diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 361ac762..9522ff23 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,5 +1,5 @@ [toolchain] -channel = "nightly-2025-12-10" -components = ["rustfmt", "rust-src", "llvm-tools", "clippy"] -targets = [ "wasm32-wasip2" ] -profile = "minimal" +channel = "nightly-2025-12-10" +components = ["clippy", "llvm-tools", "rust-src", "rustfmt"] +profile = "minimal" +targets = ["wasm32-wasip2"] From b4c1e6fba69e76514e6c3edcb5394c89be6af1fa Mon Sep 17 00:00:00 2001 From: tomasarrachea Date: Thu, 16 Apr 2026 12:08:49 -0300 Subject: [PATCH 15/19] wip: link std package --- .claude/settings.local.json | 63 +++++++++++++++++++ Cargo.lock | 1 + crates/contracts/faucet-account/src/lib.rs | 16 ++--- crates/contracts/faucet-account/wit/.gitkeep | 0 crates/contracts/mint-tx/Cargo.toml | 4 -- crates/contracts/mint-tx/build.rs | 39 ++++++++++++ crates/contracts/mint-tx/stubs.rs | 16 +++++ crates/contracts/mint-tx/wit/.gitkeep | 0 .../mint-tx/wit/miden-faucet-account.wit | 16 +++++ crates/faucet/Cargo.toml | 1 + crates/faucet/src/lib.rs | 50 ++++++++------- crates/faucet/src/package.rs | 50 ++++++++++----- 12 files changed, 206 insertions(+), 50 deletions(-) create mode 100644 .claude/settings.local.json delete mode 100644 crates/contracts/faucet-account/wit/.gitkeep create mode 100644 crates/contracts/mint-tx/build.rs create mode 100644 crates/contracts/mint-tx/stubs.rs delete mode 100644 crates/contracts/mint-tx/wit/.gitkeep create mode 100644 crates/contracts/mint-tx/wit/miden-faucet-account.wit diff --git a/.claude/settings.local.json b/.claude/settings.local.json new file mode 100644 index 00000000..a24d9bde --- /dev/null +++ b/.claude/settings.local.json @@ -0,0 +1,63 @@ +{ + "permissions": { + "allow": [ + "Skill(code-review:code-review)", + "WebFetch(domain:github.com)", + "WebFetch(domain:patch-diff.githubusercontent.com)", + "Bash(curl:*)", + "Bash(git show-branch:*)", + "Bash(git log:*)", + "WebFetch(domain:raw.githubusercontent.com)", + "WebFetch(domain:api.github.com)", + "Bash(cargo build:*)", + "Bash(cargo clippy:*)", + "Bash(~/Personal/get-project-identity.sh)", + "Bash(cargo doc:*)", + "Bash(find:*)", + "Bash(make lint:*)", + "Bash(cargo check:*)", + "Bash(make test:*)", + "Bash(cargo test:*)", + "Bash(gh pr list:*)", + "Bash(gh pr view:*)", + "Bash(gh api:*)", + "Bash(/Users/tomas/Lambda/miden-faucet/target/release/miden-faucet:*)", + "Bash(git fetch:*)", + "Bash(git checkout:*)", + "Bash(xargs curl -s)", + "Bash(gh pr checks:*)", + "Bash(cargo tree:*)", + "Bash(/tmp/entrypoint_analysis.txt << 'EOF'\nENTRYPOINT SCRIPT ANALYSIS:\n\nThe script does:\n1. Line 20: WORK_DIR=\"${STORE_DIR}\" - sets work dir based on store path\n2. Line 43: cd \"${WORK_DIR}\" || exit 1 - changes to that directory for init\n3. Line 49: cd \"${WORK_DIR}\" || exit 1 - changes to that directory for the command\n\nKEY ISSUE:\nWhen a user passes relative paths in command arguments \\(like \"$@\" on line 50\\),\nthose relative paths will be interpreted relative to WORK_DIR, NOT the original\nworking directory.\n\nEXAMPLE SCENARIO:\n- Container started from /data directory\n- User runs: docker run ... miden-faucet init --import ./account.mac\n- STORE_DIR becomes /data \\(from MIDEN_FAUCET_STORE env var\\)\n- Script does cd \"${STORE_DIR}\" = cd /data\n- Then runs: miden-faucet init --import ./account.mac\n- Now ./account.mac is interpreted as /data/./account.mac \\(OK if account is there\\)\n- But if account is in /data/../somewhere/account.mac, it will fail\n\nBROADER ISSUE:\nThe script changes working directory before executing user commands.\nThis means user-provided relative paths will be interpreted relative to STORE_DIR,\nnot relative to the original working directory or container entrypoint directory.\n\nThis affects:\n- Line 38: MIDEN_FAUCET_IMPORT_ACCOUNT_PATH \\(passed to init command\\)\n- Line 50: Any argument passed to miden-faucet command \\(the \"$@\"\\)\n\nFor INIT specifically:\n- Line 43: The cd is fine here because --import path needs to be relative\n to where keystore will be created anyway\n\nFor the final command execution:\n- Line 49-50: Any relative paths in \"$@\" will be relative to WORK_DIR\nEOF)", + "Bash(git ls-tree:*)", + "WebFetch(domain:docs.rs)", + "Bash(/tmp/detailed_analysis.txt << 'EOF'\nDETAILED ISSUE ASSESSMENT:\n\nFrom the entrypoint.sh code \\(lines 33-50\\):\n\nLine 33-38: For MIDEN_FAUCET_IMPORT_ACCOUNT_PATH:\n - This env var is only used during auto-init \\(if store file doesn't exist\\)\n - It's passed to \"miden-faucet init --import ${MIDEN_FAUCET_IMPORT_ACCOUNT_PATH}\"\n - The cd happens BEFORE this init command \\(line 43\\)\n - So the relative path interpretation IS affected by the cd\n\nLine 49-50: For the main command execution:\n - exec miden-faucet \"$@\"\n - This happens after cd \"${WORK_DIR}\"\n - So any relative paths in the user's command arguments will be relative to WORK_DIR\n\nREAL-WORLD IMPACT:\n\nCase 1: User passes relative path via env var during init\n- Export: MIDEN_FAUCET_IMPORT_ACCOUNT_PATH=account.mac\n- Script does cd to STORE_DIR\n- Then tries to read account.mac from STORE_DIR directory\n- This would fail if account.mac is not in the STORE_DIR\n\nCase 2: User manually calls init with --import\n- docker run ... miden-faucet init --import ./account.mac\n- Script changes to WORK_DIR\n- Command looks for ./account.mac relative to WORK_DIR, not /\n\nCase 3: Other commands \\(not init\\)\n- The entrypoint defaults to \"start\" \\(line 11\\)\n- The start command doesn't typically take file paths as arguments\n- So this is less likely to cause issues in practice\n\nSEVERITY ASSESSMENT:\n- The issue is REAL but context-dependent\n- It affects --import path handling during init\n- It could affect other subcommands if they take relative file paths\n- The script doesn't document this behavior\n- Users might reasonably expect relative paths to be relative to their working dir\n\nHOWEVER:\n- For the \"start\" command \\(default\\), relative paths aren't typically used\n- For the \"init\" command, the current behavior might be intentional\n \\(to keep keystore and account in same directory\\)\n- The issue would manifest when mounting volumes with relative paths\n or when account files are in different locations than STORE_DIR\nEOF)", + "Bash(/tmp/final_assessment.txt << 'EOF'\nFINAL ASSESSMENT OF THE ISSUE:\n\nThe code comment says: \"Run init from store directory \\(where keystore will be created\\)\"\n\nThis indicates the cd is INTENTIONAL - the design is to:\n1. Change to the store directory\n2. Run init from there \\(so keystore gets created in the right place\\)\n3. Keep the same working directory for the final command execution\n\nPROBLEM IDENTIFICATION:\n\nThe issue raised is valid from one perspective:\n- When users pass relative paths in arguments \\(like --import ./account.mac\\),\n those paths are now interpreted relative to STORE_DIR instead of the \n original container working directory\n\nHowever, this might be intentional design because:\n1. The keystore is created relative to the current working directory\n2. Keeping files in the same directory \\(store + keystore\\) is sensible\n3. The comment explicitly documents this behavior\n\nPRACTICAL IMPACT:\n\nThe real issue surfaces when:\n- A user mounts a volume with account files\n- They pass relative paths expecting them to be relative to the mounted volume root\n- But the script changes to STORE_DIR first\n- So relative paths get interpreted relative to STORE_DIR instead\n\nExample:\n- Volume mounted at /mnt/config\n- MIDEN_FAUCET_STORE=/mnt/config/store.db\n- MIDEN_FAUCET_IMPORT_ACCOUNT_PATH=./account.mac \\(intended to be /mnt/config/account.mac\\)\n- Script does cd /mnt/config \\(STORE_DIR is parent directory of store.db\\)\n- Then runs miden-faucet init --import ./account.mac\n- This looks for /mnt/config/./account.mac \\(which works!\\)\n\nActually, re-reading the code:\n- Line 20: WORK_DIR=\"${STORE_DIR}\" where STORE_DIR=\"$\\(dirname \"${MIDEN_FAUCET_STORE}\"\\)\"\n- So WORK_DIR is the PARENT directory of the store file\n- This means relative paths are relative to the store's parent directory\n\nVERDICT:\n- The issue is VALID but narrow in scope\n- It affects cases where users expect relative paths to be relative to container root\n- But the design \\(running from store directory\\) is documented\n- This is more of a design question than a bug\n- Impact is limited because the default \"start\" command rarely uses file paths\n- For \"init\", the behavior might actually be desired \\(keeping files together\\)\n\nREALISTIC SCENARIOS WHERE THIS BREAKS:\n1. User runs: docker run -v /my/account:/mnt/account miden-faucet init --import /mnt/account/account.mac\n - This works fine \\(absolute path\\)\n2. User runs: docker run -v /my/account:/mnt/account miden-faucet init --import ./account.mac\n - This fails because ./ is relative to STORE_DIR, not /mnt/account\n - User would need to know the relationship between STORE_DIR and mounted volume\n\nThe issue is real but requires specific circumstances to manifest.\nEOF)", + "Bash(ls:*)", + "Bash(test:*)", + "Bash(gh issue view:*)", + "WebSearch", + "Bash(git ls-remote:*)", + "Bash(rm:*)", + "Bash(grep:*)", + "Bash(cargo search:*)", + "Bash(cargo info:*)", + "Bash(for d in /Users/tomas/Lambda/miden-faucet/target/debug/build/miden-client-*/out/)", + "Bash(do echo \"=== $d ===\")", + "Read(//Users/tomas/Lambda/miden-faucet/**)", + "Bash(done)", + "Bash(make check:*)", + "Bash(git:*)", + "Bash(gh pr:*)", + "Bash(2)", + "Read(//Users/tomas/.cargo/git/checkouts/**)", + "Bash(cargo nextest:*)", + "Bash(cargo clean:*)", + "Bash(cargo update:*)", + "Bash(sort -t/ -k3 -V)", + "Bash(gh run:*)", + "Bash(make tests:*)", + "Bash(cargo metadata:*)", + "Bash(python3 -c \" import json, sys meta = json.load\\(sys.stdin\\) for pkg in meta['packages']: if 'miden-node-proto' in pkg['name']: print\\(pkg['name'], pkg['version'], pkg['manifest_path']\\) \")" + ] + } +} diff --git a/Cargo.lock b/Cargo.lock index 5e338a7c..1994471c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3252,6 +3252,7 @@ dependencies = [ "cargo-miden", "miden-client", "miden-client-sqlite-store", + "miden-standards", "rand 0.9.2", "serde", "thiserror 2.0.18", diff --git a/crates/contracts/faucet-account/src/lib.rs b/crates/contracts/faucet-account/src/lib.rs index 3310248f..ecefc992 100644 --- a/crates/contracts/faucet-account/src/lib.rs +++ b/crates/contracts/faucet-account/src/lib.rs @@ -1,9 +1,9 @@ -//! Faucet account component. +//! Faucet account component stub. //! -//! This component exposes the `mint_and_send` procedure for the faucet account. It uses kernel -//! procedures (`faucet::create_fungible_asset`, `faucet::mint`, `output_note::create`, -//! `output_note::add_asset`) which can only be called from within an account component context — -//! not directly from a transaction script. +//! This crate exists only to generate the WIT interface for the `mint_and_send` procedure. +//! The actual account component used at runtime is the official `BasicFungibleFaucet` from +//! `miden-standards`. The `.masp` produced by compiling this crate is NOT used for linking — +//! instead, the faucet library links the official component library via `--link-library`. #![no_std] #![feature(alloc_error_handler)] @@ -16,12 +16,6 @@ struct FaucetAccount; #[component] impl FaucetAccount { /// Mints a fungible asset and sends it to `recipient` by creating an output note. - /// - /// # Arguments - /// - `amount`: the number of tokens to mint (in base units) - /// - `tag`: the note tag included in the output note metadata - /// - `note_type`: the visibility of the note (public or private) - /// - `recipient`: the note recipient digest pub fn mint_and_send( &mut self, amount: Felt, diff --git a/crates/contracts/faucet-account/wit/.gitkeep b/crates/contracts/faucet-account/wit/.gitkeep deleted file mode 100644 index e69de29b..00000000 diff --git a/crates/contracts/mint-tx/Cargo.toml b/crates/contracts/mint-tx/Cargo.toml index 29f2d395..27fd3ee4 100644 --- a/crates/contracts/mint-tx/Cargo.toml +++ b/crates/contracts/mint-tx/Cargo.toml @@ -23,9 +23,5 @@ package = "miden:mint-tx" [package.metadata.miden] project-kind = "transaction-script" -# Miden dependencies for cargo-miden build/linking -[package.metadata.miden.dependencies] -"miden:faucet-account" = { path = "../faucet-account" } - [package.metadata.component.target.dependencies] "miden:faucet-account" = { path = "../faucet-account/target/generated-wit/" } diff --git a/crates/contracts/mint-tx/build.rs b/crates/contracts/mint-tx/build.rs new file mode 100644 index 00000000..08a8962a --- /dev/null +++ b/crates/contracts/mint-tx/build.rs @@ -0,0 +1,39 @@ +use std::env; +use std::process::Command; + +/// Compiles the `mint_and_send` linker stub into a static library that the Wasm linker +/// can use to satisfy the import. The actual procedure is resolved by the Miden compiler +/// at the MAST level. +fn main() { + println!("cargo::rerun-if-changed=stubs.rs"); + + let out_dir = env::var("OUT_DIR").unwrap(); + let target = env::var("TARGET").unwrap(); + + // Only build stubs for Wasm targets + if !target.starts_with("wasm") { + return; + } + + let status = Command::new("rustc") + .arg("--crate-name") + .arg("mint_tx_stubs") + .arg("--edition=2024") + .arg("--crate-type=rlib") + .arg("--target") + .arg(&target) + .arg("-C") + .arg("opt-level=1") + .arg("-C") + .arg("debuginfo=0") + .arg("stubs.rs") + .arg("-o") + .arg(format!("{out_dir}/libmint_tx_stubs.a")) + .status() + .expect("failed to compile stubs"); + + assert!(status.success(), "stub compilation failed"); + + println!("cargo:rustc-link-search=native={out_dir}"); + println!("cargo:rustc-link-lib=mint_tx_stubs"); +} diff --git a/crates/contracts/mint-tx/stubs.rs b/crates/contracts/mint-tx/stubs.rs new file mode 100644 index 00000000..eabdd282 --- /dev/null +++ b/crates/contracts/mint-tx/stubs.rs @@ -0,0 +1,16 @@ +/// Linker stub for the `mint_and_send` procedure from `BasicFungibleFaucet`. +/// +/// This is an unreachable stub that satisfies the Wasm linker. The actual procedure +/// is resolved by the Miden compiler against the official component library. +#[unsafe(export_name = "miden::standards::faucets::basic_fungible::mint_and_send")] +pub extern "C" fn mint_and_send_stub( + _amount: f32, + _tag: f32, + _note_type: f32, + _recipient_0: f32, + _recipient_1: f32, + _recipient_2: f32, + _recipient_3: f32, +) { + unsafe { core::hint::unreachable_unchecked() } +} diff --git a/crates/contracts/mint-tx/wit/.gitkeep b/crates/contracts/mint-tx/wit/.gitkeep deleted file mode 100644 index e69de29b..00000000 diff --git a/crates/contracts/mint-tx/wit/miden-faucet-account.wit b/crates/contracts/mint-tx/wit/miden-faucet-account.wit new file mode 100644 index 00000000..c59ba7b2 --- /dev/null +++ b/crates/contracts/mint-tx/wit/miden-faucet-account.wit @@ -0,0 +1,16 @@ +// This file is auto-generated by the `#[component]` macro. +// Do not edit this file manually. + +package miden:faucet-account@0.1.0; + +use miden:base/core-types@1.0.0; + +interface miden-faucet-account { + use core-types.{felt, note-type, recipient, tag}; + + mint-and-send: func(amount: felt, tag: tag, note-type: note-type, recipient: recipient); +} + +world miden-faucet-account-world { + import miden-faucet-account; +} diff --git a/crates/faucet/Cargo.toml b/crates/faucet/Cargo.toml index 12029255..d61fcfdf 100644 --- a/crates/faucet/Cargo.toml +++ b/crates/faucet/Cargo.toml @@ -19,6 +19,7 @@ workspace = true cargo-miden = { workspace = true } miden-client = { features = ["tonic"], workspace = true } miden-client-sqlite-store = { workspace = true } +miden-standards = { version = "0.14" } # External dependencies. anyhow = { workspace = true } diff --git a/crates/faucet/src/lib.rs b/crates/faucet/src/lib.rs index e53871cb..5032c153 100644 --- a/crates/faucet/src/lib.rs +++ b/crates/faucet/src/lib.rs @@ -39,7 +39,7 @@ pub mod requests; pub mod types; use crate::note_screener::NoteScreener; -use crate::package::compile_dir; +use crate::package::{compile_dir_with_libs, write_faucet_component_masl}; use crate::requests::{MintError, MintRequest, MintResponse, MintResponseSender}; use crate::types::AssetAmount; @@ -141,12 +141,18 @@ impl Faucet { } client.set_setting(DEFAULT_ACCOUNT_ID_SETTING.to_owned(), account.id()).await?; - // Compile the mint tx script from Rust via cargo-miden. + // Compile the mint tx script from Rust via cargo-miden, linking the official + // BasicFungibleFaucet account component so that `account.mint_and_send()` resolves + // to the correct procedure digest. let workspace_root = Path::new(env!("CARGO_MANIFEST_DIR")); - let package = compile_dir(&workspace_root.join("../contracts/mint-tx"), true)?; - let program = package.unwrap_program(); - let script = - TransactionScript::from_parts(program.mast_forest().clone(), program.entrypoint()); + let tmp_dir = std::env::temp_dir().join("miden-faucet-build"); + let faucet_masl = write_faucet_component_masl(&tmp_dir)?; + let package = compile_dir_with_libs( + &workspace_root.join("../contracts/mint-tx"), + true, + &[&faucet_masl], + )?; + let script = TransactionScript::new(package.unwrap_program()); client.set_setting(MINT_TX_SCRIPT_SETTING.to_string(), script).await?; if deploy { @@ -559,13 +565,9 @@ fn build_p2id_notes( mod tests { use std::env::temp_dir; - use miden_client::account::component::{AuthControlled, InitStorageData}; - use miden_client::account::{ - AccountBuilder, - AccountComponent, - AccountStorageMode, - AccountType, - }; + use miden_client::account::component::AuthControlled; + use miden_client::account::{AccountBuilder, AccountStorageMode, AccountType}; + use miden_client::asset::TokenSymbol; use miden_client::auth::{AuthSchemeId, AuthSecretKey, AuthSingleSig}; use miden_client::crypto::rpo_falcon512::SecretKey; use miden_client::store::{NoteFilter, Store}; @@ -577,6 +579,12 @@ mod tests { use super::*; use crate::types::NoteType; + #[test] + fn generate_faucet_component_masl() { + let mint_tx_dir = Path::new(env!("CARGO_MANIFEST_DIR")).join("../contracts/mint-tx"); + write_faucet_component_masl(&mint_tx_dir).unwrap(); + } + #[tokio::test] async fn tx_script_compiles_and_executes() { let store = SqliteStore::new(temp_dir().join(format!("{}.sqlite3", Uuid::new_v4()))) @@ -640,17 +648,13 @@ mod tests { async fn build_faucet(store: Arc) -> Faucet { let secret = SecretKey::new(); - // Compile the faucet account component from Rust - let faucet_component_package = - compile_dir(Path::new("../contracts/faucet-account"), true).unwrap(); - let faucet_component = - AccountComponent::from_package(&faucet_component_package, &InitStorageData::default()) - .unwrap(); + let symbol = TokenSymbol::new("TEST").unwrap(); + let max_supply = Felt::try_from(1_000_000_000_000_u64).unwrap(); let account = AccountBuilder::new(rand::random()) .account_type(AccountType::FungibleFaucet) .storage_mode(AccountStorageMode::Public) - .with_component(faucet_component) + .with_component(BasicFungibleFaucet::new(symbol, 6, max_supply).unwrap()) .with_component(AuthControlled::allow_all()) .with_auth_component(AuthSingleSig::new( secret.public_key().to_commitment().into(), @@ -676,7 +680,11 @@ mod tests { client.ensure_genesis_in_place().await.unwrap(); client.add_account(&account, false).await.unwrap(); - let package = compile_dir(Path::new("../contracts/mint-tx"), true).unwrap(); + let tmp_dir = temp_dir().join(format!("miden-faucet-build-{}", Uuid::new_v4())); + let faucet_masl = write_faucet_component_masl(&tmp_dir).unwrap(); + let package = + compile_dir_with_libs(Path::new("../contracts/mint-tx"), true, &[&faucet_masl]) + .unwrap(); let program = package.unwrap_program(); let script = TransactionScript::from_parts(program.mast_forest().clone(), program.entrypoint()); diff --git a/crates/faucet/src/package.rs b/crates/faucet/src/package.rs index b6355193..2fbdffa0 100644 --- a/crates/faucet/src/package.rs +++ b/crates/faucet/src/package.rs @@ -3,27 +3,34 @@ use std::path::Path; use anyhow::{Context, bail}; use cargo_miden::{OutputType, run}; use miden_client::Deserializable; +use miden_client::utils::Serializable; use miden_client::vm::Package; +use miden_standards::account::components::basic_fungible_faucet_library; -/// Compiles a Miden project in the specified directory -/// -/// # Arguments -/// * `dir` - Path to the directory containing the Cargo.toml -/// * `release` - Whether to build in release mode -/// -/// # Returns -/// The compiled `Package` -/// -/// # Errors -/// Returns an error if compilation fails or if the output is not in the expected format -pub fn compile_dir(dir: &Path, release: bool) -> anyhow::Result { +/// Compiles a Miden project, optionally linking additional libraries. +pub fn compile_dir_with_libs( + dir: &Path, + release: bool, + link_libraries: &[&Path], +) -> anyhow::Result { let profile = if release { "--release" } else { "--debug" }; let manifest_path = dir.join("Cargo.toml"); let manifest_arg = manifest_path.to_string_lossy(); - let args = vec!["cargo", "miden", "build", profile, "--manifest-path", &manifest_arg]; + let mut args = vec![ + "cargo".to_string(), + "miden".to_string(), + "build".to_string(), + profile.to_string(), + "--manifest-path".to_string(), + manifest_arg.to_string(), + ]; + for lib_path in link_libraries { + args.push("--link-library".to_string()); + args.push(lib_path.to_string_lossy().to_string()); + } - let output = run(args.into_iter().map(String::from), OutputType::Masm) + let output = run(args.into_iter(), OutputType::Masm) .context("Failed to compile project")? .context("Cargo miden build returned None")?; @@ -44,3 +51,18 @@ pub fn compile_dir(dir: &Path, release: bool) -> anyhow::Result { Package::read_from_bytes(&package_bytes).context("Failed to deserialize package from bytes") } + +/// Writes the official `BasicFungibleFaucet` account component as a `.masl` library +/// to the given directory, returning the path to the written file. +/// +/// The Miden compiler (`cargo miden`) accepts `.masl` libraries as link libraries +/// via `--link-library`. +pub fn write_faucet_component_masl(dir: &Path) -> anyhow::Result { + let lib = basic_fungible_faucet_library(); + + std::fs::create_dir_all(dir)?; + let masl_path = dir.join("basic_fungible_faucet.masl"); + std::fs::write(&masl_path, lib.to_bytes()).context("Failed to write faucet .masl")?; + + Ok(masl_path) +} From bd14e370012e5dfa3aaf2a9c679ca319eb3daf0b Mon Sep 17 00:00:00 2001 From: tomasarrachea Date: Mon, 18 May 2026 19:31:20 -0300 Subject: [PATCH 16/19] feat: remove custom account component --- Cargo.lock | 7 ---- Cargo.toml | 1 - bin/faucet/src/frontend.rs | 2 +- .../faucet-account/.cargo/config.toml | 5 --- crates/contracts/faucet-account/Cargo.toml | 17 -------- crates/contracts/faucet-account/src/lib.rs | 31 --------------- crates/contracts/mint-tx/build.rs | 39 ------------------- crates/contracts/mint-tx/src/lib.rs | 9 +++-- crates/contracts/mint-tx/stubs.rs | 16 -------- 9 files changed, 7 insertions(+), 120 deletions(-) delete mode 100644 crates/contracts/faucet-account/.cargo/config.toml delete mode 100644 crates/contracts/faucet-account/Cargo.toml delete mode 100644 crates/contracts/faucet-account/src/lib.rs delete mode 100644 crates/contracts/mint-tx/build.rs delete mode 100644 crates/contracts/mint-tx/stubs.rs diff --git a/Cargo.lock b/Cargo.lock index 1994471c..a69d0e47 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3216,13 +3216,6 @@ dependencies = [ "uuid", ] -[[package]] -name = "miden-faucet-account" -version = "0.1.0" -dependencies = [ - "miden", -] - [[package]] name = "miden-faucet-client" version = "0.14.0" diff --git a/Cargo.toml b/Cargo.toml index 8a45bf75..39456ce7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,7 +3,6 @@ default-members = ["bin/faucet", "crates/faucet", "crates/pow"] members = [ "bin/faucet", "bin/faucet-client", - "crates/contracts/faucet-account", "crates/contracts/mint-tx", "crates/faucet", "crates/pow", diff --git a/bin/faucet/src/frontend.rs b/bin/faucet/src/frontend.rs index 6c0fb6f9..0e8a2425 100644 --- a/bin/faucet/src/frontend.rs +++ b/bin/faucet/src/frontend.rs @@ -58,7 +58,7 @@ pub async fn get_index_html() -> Html<&'static str> { pub async fn get_miden_client_web_wasm(request: Request) -> Response { const WASM_BYTES: &[u8] = include_bytes!(concat!( env!("OUT_DIR"), - "/frontend/node_modules/@miden-sdk/miden-sdk/dist/assets/miden_client_web.wasm" + "/frontend/node_modules/@miden-sdk/miden-sdk/dist/st/assets/miden_client_web.wasm" )); let etag = compute_etag(WASM_BYTES); diff --git a/crates/contracts/faucet-account/.cargo/config.toml b/crates/contracts/faucet-account/.cargo/config.toml deleted file mode 100644 index 72bc2bef..00000000 --- a/crates/contracts/faucet-account/.cargo/config.toml +++ /dev/null @@ -1,5 +0,0 @@ -[build] -target = "wasm32-wasip2" - -[target.wasm32-wasip2] -rustflags = ["--cfg", "miden"] diff --git a/crates/contracts/faucet-account/Cargo.toml b/crates/contracts/faucet-account/Cargo.toml deleted file mode 100644 index 3e8d5bfa..00000000 --- a/crates/contracts/faucet-account/Cargo.toml +++ /dev/null @@ -1,17 +0,0 @@ -[package] -edition = "2024" -name = "miden-faucet-account" -version = "0.1.0" - -[lib] -crate-type = ["cdylib"] - -[dependencies] -miden = { workspace = true } - -[package.metadata.component] -package = "miden:faucet-account" - -[package.metadata.miden] -project-kind = "account" -supported-types = ["FungibleFaucet"] diff --git a/crates/contracts/faucet-account/src/lib.rs b/crates/contracts/faucet-account/src/lib.rs deleted file mode 100644 index ecefc992..00000000 --- a/crates/contracts/faucet-account/src/lib.rs +++ /dev/null @@ -1,31 +0,0 @@ -//! Faucet account component stub. -//! -//! This crate exists only to generate the WIT interface for the `mint_and_send` procedure. -//! The actual account component used at runtime is the official `BasicFungibleFaucet` from -//! `miden-standards`. The `.masp` produced by compiling this crate is NOT used for linking — -//! instead, the faucet library links the official component library via `--link-library`. - -#![no_std] -#![feature(alloc_error_handler)] - -use miden::{Felt, NoteType, Recipient, Tag, component, faucet, output_note}; - -#[component] -struct FaucetAccount; - -#[component] -impl FaucetAccount { - /// Mints a fungible asset and sends it to `recipient` by creating an output note. - pub fn mint_and_send( - &mut self, - amount: Felt, - tag: Tag, - note_type: NoteType, - recipient: Recipient, - ) { - let asset = faucet::create_fungible_asset(amount); - faucet::mint(asset); - let note_idx = output_note::create(tag, note_type, recipient); - output_note::add_asset(asset, note_idx); - } -} diff --git a/crates/contracts/mint-tx/build.rs b/crates/contracts/mint-tx/build.rs deleted file mode 100644 index 08a8962a..00000000 --- a/crates/contracts/mint-tx/build.rs +++ /dev/null @@ -1,39 +0,0 @@ -use std::env; -use std::process::Command; - -/// Compiles the `mint_and_send` linker stub into a static library that the Wasm linker -/// can use to satisfy the import. The actual procedure is resolved by the Miden compiler -/// at the MAST level. -fn main() { - println!("cargo::rerun-if-changed=stubs.rs"); - - let out_dir = env::var("OUT_DIR").unwrap(); - let target = env::var("TARGET").unwrap(); - - // Only build stubs for Wasm targets - if !target.starts_with("wasm") { - return; - } - - let status = Command::new("rustc") - .arg("--crate-name") - .arg("mint_tx_stubs") - .arg("--edition=2024") - .arg("--crate-type=rlib") - .arg("--target") - .arg(&target) - .arg("-C") - .arg("opt-level=1") - .arg("-C") - .arg("debuginfo=0") - .arg("stubs.rs") - .arg("-o") - .arg(format!("{out_dir}/libmint_tx_stubs.a")) - .status() - .expect("failed to compile stubs"); - - assert!(status.success(), "stub compilation failed"); - - println!("cargo:rustc-link-search=native={out_dir}"); - println!("cargo:rustc-link-lib=mint_tx_stubs"); -} diff --git a/crates/contracts/mint-tx/src/lib.rs b/crates/contracts/mint-tx/src/lib.rs index 6d58095e..03796789 100644 --- a/crates/contracts/mint-tx/src/lib.rs +++ b/crates/contracts/mint-tx/src/lib.rs @@ -26,7 +26,7 @@ //! //! # Account component //! -//! The script calls `account.mint_and_send()` from the faucet account component, which internally +//! The script calls `account.mint()` from the faucet account component, which internally //! creates a fungible asset, mints it via the kernel, and creates an output note with the asset. #![no_std] @@ -34,7 +34,7 @@ use miden::intrinsics::advice::adv_push_mapvaln; use miden::tx::update_expiration_block_delta; -use miden::{Felt, Recipient, Word, pipe_words_to_memory, tx_script}; +use miden::{Felt, Recipient, Word, output_note, pipe_words_to_memory, tx_script}; use crate::bindings::Account; @@ -72,6 +72,9 @@ fn run(arg: Word, account: &mut Account) { let tag = input[start + 5].into(); let amount = input[start + 6]; - account.mint_and_send(amount, tag, note_type, recipient); + let asset = account.create_fungible_asset(amount); + faucet::mint(asset); + let note_idx = output_note::create(tag, note_type, recipient); + output_note::add_asset(asset, note_idx); } } diff --git a/crates/contracts/mint-tx/stubs.rs b/crates/contracts/mint-tx/stubs.rs deleted file mode 100644 index eabdd282..00000000 --- a/crates/contracts/mint-tx/stubs.rs +++ /dev/null @@ -1,16 +0,0 @@ -/// Linker stub for the `mint_and_send` procedure from `BasicFungibleFaucet`. -/// -/// This is an unreachable stub that satisfies the Wasm linker. The actual procedure -/// is resolved by the Miden compiler against the official component library. -#[unsafe(export_name = "miden::standards::faucets::basic_fungible::mint_and_send")] -pub extern "C" fn mint_and_send_stub( - _amount: f32, - _tag: f32, - _note_type: f32, - _recipient_0: f32, - _recipient_1: f32, - _recipient_2: f32, - _recipient_3: f32, -) { - unsafe { core::hint::unreachable_unchecked() } -} From daf46cd4625e9540eaedb3051c75aa1a12a15ac9 Mon Sep 17 00:00:00 2001 From: tomasarrachea Date: Mon, 18 May 2026 19:36:53 -0300 Subject: [PATCH 17/19] merge next --- CHANGELOG.md | 14 + Cargo.lock | 465 +++++++++++++++++------------ Cargo.toml | 6 +- Makefile | 6 +- bin/faucet/frontend/app.js | 4 +- bin/faucet/frontend/package.json | 4 +- bin/faucet/src/api/get_metadata.rs | 3 + bin/faucet/src/main.rs | 15 +- crates/faucet/src/lib.rs | 149 +++++++-- docs/src/rest-api.md | 3 +- rust-toolchain.toml | 2 +- 11 files changed, 443 insertions(+), 228 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index aa817293..567297c9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,20 @@ ## 0.15.0 (TBD) - Reimplemented the transaction script in Rust using the miden-compiler ([#204](https://github.com/0xMiden/faucet/pull/204)). +- Added `note_transport_url` field to the `/get_metadata` endpoint response ([#243](https://github.com/0xMiden/faucet/pull/243)). + +## 0.14.3 (2026-04-29) + +- Updated miden-client dependency to v0.14.5 ([#244](https://github.com/0xMiden/faucet/pull/244)). +- Improved mint failure observability: each step inside `submit_new_transaction` now records its own error, `apply_transaction` is instrumented as a sibling span, and `RpcError` propagations record structured `grpc.endpoint`/`grpc.code`/`grpc.endpoint_error` fields on the parent span ([#245](https://github.com/0xMiden/faucet/pull/245)). + +## 0.14.2 (2026-04-21) + +- Fixed faucet state sync to request storage map details for tracked public accounts ([#241](https://github.com/0xMiden/faucet/pull/241)). + +## 0.14.1 (2026-04-16) + +- Updated miden-client dependency to v0.14.3 ([#239](https://github.com/0xMiden/faucet/pull/239)). ## 0.14.0 (2026-04-08) diff --git a/Cargo.lock b/Cargo.lock index a69d0e47..a626bcd4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -14,27 +14,27 @@ dependencies = [ [[package]] name = "addr2line" -version = "0.24.2" +version = "0.25.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfbe277e56a376000877090da837660b4427aad530e3028d44e0bffe4f89a1c1" +checksum = "1b5d307320b3181d6d7954e663bd7c774a838b8220fe0593c86d9fb09f498b4b" dependencies = [ - "cpp_demangle", - "fallible-iterator", - "gimli 0.31.1", - "memmap2", - "object 0.36.7", - "rustc-demangle", - "smallvec", - "typed-arena", + "gimli 0.32.3", ] [[package]] name = "addr2line" -version = "0.25.1" +version = "0.26.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b5d307320b3181d6d7954e663bd7c774a838b8220fe0593c86d9fb09f498b4b" +checksum = "59317f77929f0e679d39364702289274de2f0f0b22cbf50b2b8cff2169a0b27a" dependencies = [ - "gimli 0.32.3", + "cpp_demangle", + "fallible-iterator", + "gimli 0.33.0", + "memmap2", + "object 0.39.1", + "rustc-demangle", + "smallvec", + "typed-arena", ] [[package]] @@ -158,21 +158,6 @@ dependencies = [ "libc", ] -[[package]] -name = "anstream" -version = "0.6.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43d5b281e737544384e969a5ccad3f1cdd24b48086a0fc1b2a5262a26b8f4f4a" -dependencies = [ - "anstyle", - "anstyle-parse 0.2.7", - "anstyle-query", - "anstyle-wincon", - "colorchoice", - "is_terminal_polyfill", - "utf8parse", -] - [[package]] name = "anstream" version = "1.0.0" @@ -180,7 +165,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "824a212faf96e9acacdbd09febd34438f8f711fb84e09a8916013cd7815ca28d" dependencies = [ "anstyle", - "anstyle-parse 1.0.0", + "anstyle-parse", "anstyle-query", "anstyle-wincon", "colorchoice", @@ -194,15 +179,6 @@ version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "940b3a0ca603d1eade50a4846a2afffd5ef57a9feac2c0e2ec2e14f9ead76000" -[[package]] -name = "anstyle-parse" -version = "0.2.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e7644824f0aa2c7b9384579234ef10eb7efb6a0deb83f9630a49594dd9c15c2" -dependencies = [ - "utf8parse", -] - [[package]] name = "anstyle-parse" version = "1.0.0" @@ -594,8 +570,8 @@ dependencies = [ [[package]] name = "cargo-miden" -version = "0.8.0" -source = "git+https://github.com/0xMiden/compiler?branch=next#35f138ea9f1d23e126345125d7e1f6e98918d2f7" +version = "0.8.1" +source = "git+https://github.com/0xMiden/compiler?branch=next#71598f7fa0a763a2e2cc37db3c9e46068cdb7565" dependencies = [ "anyhow", "cargo_metadata", @@ -610,24 +586,24 @@ dependencies = [ "serde", "serde_json", "tempfile", - "toml_edit 0.23.10+spec-1.0.0", + "toml_edit 0.25.11+spec-1.1.0", "walkdir", ] [[package]] name = "cargo-platform" -version = "0.1.9" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e35af189006b9c0f00a064685c727031e3ed2d8020f7ba284d78cc2671bd36ea" +checksum = "8abf5d501fd757c2d2ee78d0cc40f606e92e3a63544420316565556ed28485e2" dependencies = [ "serde", ] [[package]] name = "cargo_metadata" -version = "0.19.2" +version = "0.23.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd5eb614ed4c27c5d706420e4320fbe3216ab31fa1c33cd8246ac36dae4479ba" +checksum = "ef987d17b0a113becdd19d3d0022d04d7ef41f9efe4f3fb63ac44ba61df3ade9" dependencies = [ "camino", "cargo-platform", @@ -740,7 +716,7 @@ version = "4.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "714a53001bf66416adb0e2ef5ac857140e7dc3a0c48fb28b2f10762fc4b5069f" dependencies = [ - "anstream 1.0.0", + "anstream", "anstyle", "clap_lex", "strsim", @@ -913,9 +889,9 @@ dependencies = [ [[package]] name = "cpp_demangle" -version = "0.4.5" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2bb79cb74d735044c972aae58ed0aaa9a837e85b01106a54c39e42e97f62253" +checksum = "0667304c32ea56cb4cd6d2d7c0cfe9a2f8041229db8c033af7f8d69492429def" dependencies = [ "cfg-if", ] @@ -940,17 +916,21 @@ dependencies = [ [[package]] name = "cranelift-bitset" -version = "0.120.2" +version = "0.131.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db7b2ee9eec6ca8a716d900d5264d678fb2c290c58c46c8da7f94ee268175d17" +checksum = "f25c06993a681be9cf3140798a3d4ac5bec955e7444416a2fdc87fda8567285d" +dependencies = [ + "wasmtime-internal-core", +] [[package]] name = "cranelift-entity" -version = "0.120.2" +version = "0.131.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d75418674520cb400c8772bfd6e11a62736c78fc1b6e418195696841d1bf91f1" +checksum = "5e62ef34c6e720f347a79ece043e8584e242d168911da640bac654a33a6aaaf5" dependencies = [ "cranelift-bitset", + "wasmtime-internal-core", ] [[package]] @@ -1340,7 +1320,7 @@ version = "0.11.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0621c04f2196ac3f488dd583365b9c09be011a4ab8b9f37248ffcc8f6198b56a" dependencies = [ - "anstream 1.0.0", + "anstream", "anstyle", "env_filter", "jiff", @@ -1725,19 +1705,18 @@ dependencies = [ [[package]] name = "gimli" -version = "0.31.1" +version = "0.32.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f" -dependencies = [ - "fallible-iterator", - "stable_deref_trait", -] +checksum = "e629b9b98ef3dd8afe6ca2bd0f89306cec16d43d907889945bc5d6687f2f13c7" [[package]] name = "gimli" -version = "0.32.3" +version = "0.33.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e629b9b98ef3dd8afe6ca2bd0f89306cec16d43d907889945bc5d6687f2f13c7" +checksum = "0bf7f043f89559805f8c7cacc432749b2fa0d0a0a9ee46ce47164ed5ba7f126c" +dependencies = [ + "stable_deref_trait", +] [[package]] name = "glob" @@ -1843,6 +1822,11 @@ name = "hashbrown" version = "0.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4f467dd6dccf739c208452f8014c75c18bb8301b050ad1cfb27153803edb0f51" +dependencies = [ + "allocator-api2 0.2.21", + "equivalent", + "foldhash 0.2.0", +] [[package]] name = "hashlink" @@ -2035,7 +2019,7 @@ dependencies = [ "libc", "percent-encoding", "pin-project-lite", - "socket2", + "socket2 0.6.3", "tokio", "tower-service", "tracing", @@ -2303,9 +2287,9 @@ dependencies = [ [[package]] name = "intrusive-collections" -version = "0.9.7" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "189d0897e4cbe8c75efedf3502c18c887b05046e59d28404d4d8e46cbc4d1e86" +checksum = "80e165935eba36cb526af8389effd2005a741adcbb6ed32106cc68e3f7b92960" dependencies = [ "memoffset", ] @@ -2542,9 +2526,9 @@ checksum = "b6d2cec3eae94f9f509c767b45932f1ada8350c4bdb85af2fcab4a3c14807981" [[package]] name = "libredox" -version = "0.1.16" +version = "0.1.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e02f3bb43d335493c96bf3fd3a321600bf6bd07ed34bc64118e9293bdffea46c" +checksum = "7ddbf48fd451246b1f8c2610bd3b4ac0cc6e149d89832867093ab69a17194f08" dependencies = [ "libc", ] @@ -2864,9 +2848,9 @@ dependencies = [ [[package]] name = "miden-agglayer" -version = "0.14.4" +version = "0.14.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4302fc29d77db3d2c6323d1b211e503aafb91db2d572ef30c68829347fe79352" +checksum = "73a12734b3bf5e8c88580c4c173368865d1efd6f51f48365df76b59f12d8dc53" dependencies = [ "alloy-sol-types", "fs-err", @@ -2977,9 +2961,9 @@ dependencies = [ [[package]] name = "miden-block-prover" -version = "0.14.4" +version = "0.14.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cde56bcea3cebe307786a856e204d84e7987c318e5a2909bcbb655d16286ce31" +checksum = "334340b0b2e6993f6b71af359a77cf8730c4a19ac366f77aee734a5faa993897" dependencies = [ "miden-protocol", "thiserror 2.0.18", @@ -2987,9 +2971,9 @@ dependencies = [ [[package]] name = "miden-client" -version = "0.14.0" +version = "0.14.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49957f76717961769c911237113bb9c1841c3b13970c15ca09a0ae639c33fc45" +checksum = "15007f2cf4e80316a8141665b43f454e77ce0dfd2ac0307ce6cdf7a5d552d58b" dependencies = [ "anyhow", "async-trait", @@ -2998,6 +2982,7 @@ dependencies = [ "getrandom 0.3.4", "gloo-timers", "hex", + "miden-debug", "miden-node-proto-build", "miden-note-transport-proto-build", "miden-protocol", @@ -3011,6 +2996,7 @@ dependencies = [ "rand 0.9.2", "serde", "serde_json", + "tempfile", "thiserror 2.0.18", "tokio", "tonic", @@ -3025,9 +3011,9 @@ dependencies = [ [[package]] name = "miden-client-cli" -version = "0.14.0" +version = "0.14.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72eaa5fdd768164a2725e3050e78515d39b13ee82118333f72a8e29612b71331" +checksum = "a576f6921b75d49223b9e759d1115402f0fc8106f1be19b9c17c5b307811ee17" dependencies = [ "clap", "comfy-table", @@ -3035,6 +3021,7 @@ dependencies = [ "figment", "miden-client", "miden-client-sqlite-store", + "miden-debug", "miette", "rand 0.9.2", "serde", @@ -3047,9 +3034,9 @@ dependencies = [ [[package]] name = "miden-client-sqlite-store" -version = "0.14.0" +version = "0.14.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ab146099a4bf8319f5cac47e110eca7d3e3caa9d2fc354693458f905f4750a7" +checksum = "53a6d9c9bf443b9df440c010eeab6916ab6bc529faed5eb19f84ab7bc21aad59" dependencies = [ "anyhow", "async-trait", @@ -3156,6 +3143,77 @@ dependencies = [ "syn 2.0.117", ] +[[package]] +name = "miden-debug" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df04a684eeb96efabc63e2800a01945f7f6e19ffd00d3b49064e85f7e1fac444" +dependencies = [ + "clap", + "futures", + "glob", + "log", + "miden-assembly", + "miden-assembly-syntax", + "miden-core", + "miden-crypto", + "miden-debug-dap", + "miden-debug-engine", + "miden-debug-types", + "miden-mast-package", + "miden-processor", + "miden-protocol", + "miden-thiserror", + "miden-tx", + "num-traits", + "rustc-demangle", + "serde", + "serde_json", + "smallvec", + "socket2 0.5.10", + "tokio", + "tokio-util", + "toml 0.8.23", +] + +[[package]] +name = "miden-debug-dap" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38cd41176322df12836bb4deecd4b619f7cf8239ed7b2c4ac1da7b2830e5199c" +dependencies = [ + "serde", + "serde_json", + "thiserror 1.0.69", +] + +[[package]] +name = "miden-debug-engine" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e03dd00bd4dab99dbfdec9fd07009811a7e3b3a988e74a28c6ccb735ac34e138" +dependencies = [ + "clap", + "glob", + "log", + "miden-assembly", + "miden-assembly-syntax", + "miden-core", + "miden-debug-dap", + "miden-debug-types", + "miden-mast-package", + "miden-processor", + "miden-thiserror", + "miden-tx", + "num-traits", + "rustc-demangle", + "serde", + "serde_json", + "smallvec", + "socket2 0.5.10", + "toml 0.8.23", +] + [[package]] name = "miden-debug-types" version = "0.22.1" @@ -3176,7 +3234,7 @@ dependencies = [ [[package]] name = "miden-faucet" -version = "0.14.0" +version = "0.15.0" dependencies = [ "anyhow", "async-trait", @@ -3218,7 +3276,7 @@ dependencies = [ [[package]] name = "miden-faucet-client" -version = "0.14.0" +version = "0.15.0" dependencies = [ "anyhow", "axum", @@ -3239,7 +3297,7 @@ dependencies = [ [[package]] name = "miden-faucet-lib" -version = "0.14.0" +version = "0.15.0" dependencies = [ "anyhow", "cargo-miden", @@ -3257,7 +3315,7 @@ dependencies = [ [[package]] name = "miden-faucet-mint-tx" -version = "0.14.0" +version = "0.15.0" dependencies = [ "miden", ] @@ -3380,9 +3438,9 @@ dependencies = [ [[package]] name = "miden-node-grpc-error-macro" -version = "0.14.4" +version = "0.14.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cde11d39bd29169912eebefcc4a489e670ba9e4eba463f0696cb79bb3add17f7" +checksum = "15923381dd3ee06db6524ffe8e020b62a732c639e913da464b02c1ce123b500e" dependencies = [ "quote", "syn 2.0.117", @@ -3390,9 +3448,9 @@ dependencies = [ [[package]] name = "miden-node-proto" -version = "0.14.4" +version = "0.14.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af4d35904df134b44fc51d65318a3ba3341e66608bcbef0d21add1661093a8eb" +checksum = "033c53b7b25b9594c933582ecaadfd54c7ff748454b74c1a445949bdda969404" dependencies = [ "anyhow", "build-rs", @@ -3415,9 +3473,9 @@ dependencies = [ [[package]] name = "miden-node-proto-build" -version = "0.14.4" +version = "0.14.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9beefe1d90ebeb044b15a8c764eb7031d892f9ae357ac9c8847c1cab3b07045a" +checksum = "62689db1e47abeb3118b7c253fa3e6a01b74ba51b5cdcb552f9f3750b9919ecb" dependencies = [ "build-rs", "fs-err", @@ -3428,9 +3486,9 @@ dependencies = [ [[package]] name = "miden-node-utils" -version = "0.14.4" +version = "0.14.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddc29a77952a42c491229adf26238b510cdf82d5edcc232b782b19f9828b300b" +checksum = "6722832579490ed0b88f8182488ad378f7e9679bd2aa0f3f35f1ca2940545cb2" dependencies = [ "anyhow", "bytes", @@ -3488,7 +3546,7 @@ dependencies = [ [[package]] name = "miden-pow-rate-limiter" -version = "0.14.0" +version = "0.15.0" dependencies = [ "serde_json", "sha2", @@ -3533,9 +3591,9 @@ dependencies = [ [[package]] name = "miden-protocol" -version = "0.14.4" +version = "0.14.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e860cc978d3467297de076e9bd22f0573b82ef73a3d223d6bb957731a45b8164" +checksum = "595b3d43ceb562d05e248a6c52bdc2992dc270b60d6d0e8c0a6480aa30672b8e" dependencies = [ "bech32", "fs-err", @@ -3563,9 +3621,9 @@ dependencies = [ [[package]] name = "miden-protocol-macros" -version = "0.14.4" +version = "0.14.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4daec4a5a6f050a670a8639e78e017ab11ef0bf2e253b012505f25e6247c13e7" +checksum = "a7c287782953c94452c2f7431feff137e4fe8b8d1eb5aa9112eab83a6f11c8f2" dependencies = [ "proc-macro2", "quote", @@ -3592,9 +3650,9 @@ dependencies = [ [[package]] name = "miden-remote-prover-client" -version = "0.14.4" +version = "0.14.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf7590551de605a7dc6217d81e76c8f00196dbaeb905cef4239c7bc7725fbeb6" +checksum = "b640de68276a5680f8c6b1a5e0b920df905a8d6b25759adbe3dd3bf4cd56a1bc" dependencies = [ "build-rs", "fs-err", @@ -3640,9 +3698,9 @@ dependencies = [ [[package]] name = "miden-standards" -version = "0.14.4" +version = "0.14.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f455a087f41c30636b45ead961d1e66114d2d20661887b307cede05307eeb942" +checksum = "27f63cd9264dc1f9f124fe644ee631828cc9bfd71022a75cd5bc1678f3ba7b56" dependencies = [ "fs-err", "miden-assembly", @@ -3667,9 +3725,9 @@ dependencies = [ [[package]] name = "miden-testing" -version = "0.14.4" +version = "0.14.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a84430e84c6dee90d9bd92568be1c3082113f0b4b36f9db7933380f0295207f9" +checksum = "2761dd1f8baa744c91d1ff143d954c623d5fb1d2dfec8c8ab1dac2254343d7cd" dependencies = [ "anyhow", "itertools", @@ -3710,9 +3768,9 @@ dependencies = [ [[package]] name = "miden-tx" -version = "0.14.4" +version = "0.14.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d788795041ce5e6f947a3256314373171e4877c11b86fafeabcec4d8b8628d9" +checksum = "e894e952e2819545e9351f7427779f82538e51553dfaca3294301ff308086497" dependencies = [ "miden-processor", "miden-protocol", @@ -3724,9 +3782,9 @@ dependencies = [ [[package]] name = "miden-tx-batch-prover" -version = "0.14.4" +version = "0.14.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce059e2d599266b00708f6f1bff6af5cf82683e76df3ec812c2d1c72e880f943" +checksum = "b1e7aac0d511aa412138ea7dfa4a6d8c76340c6028fa91313727b7ad3614711b" dependencies = [ "miden-protocol", "miden-tx", @@ -3796,8 +3854,8 @@ dependencies = [ [[package]] name = "midenc-codegen-masm" -version = "0.8.0" -source = "git+https://github.com/0xMiden/compiler?branch=next#35f138ea9f1d23e126345125d7e1f6e98918d2f7" +version = "0.8.1" +source = "git+https://github.com/0xMiden/compiler?branch=next#71598f7fa0a763a2e2cc37db3c9e46068cdb7565" dependencies = [ "anyhow", "inventory", @@ -3806,7 +3864,9 @@ dependencies = [ "miden-assembly-syntax", "miden-core", "miden-mast-package", + "miden-package-registry", "miden-processor", + "miden-project", "miden-protocol", "miden-thiserror", "midenc-dialect-arith", @@ -3825,12 +3885,10 @@ dependencies = [ [[package]] name = "midenc-compile" -version = "0.8.0" -source = "git+https://github.com/0xMiden/compiler?branch=next#35f138ea9f1d23e126345125d7e1f6e98918d2f7" +version = "0.8.1" +source = "git+https://github.com/0xMiden/compiler?branch=next#71598f7fa0a763a2e2cc37db3c9e46068cdb7565" dependencies = [ - "anyhow", "clap", - "inventory", "log", "miden-assembly", "miden-mast-package", @@ -3847,8 +3905,8 @@ dependencies = [ [[package]] name = "midenc-dialect-arith" -version = "0.8.0" -source = "git+https://github.com/0xMiden/compiler?branch=next#35f138ea9f1d23e126345125d7e1f6e98918d2f7" +version = "0.8.1" +source = "git+https://github.com/0xMiden/compiler?branch=next#71598f7fa0a763a2e2cc37db3c9e46068cdb7565" dependencies = [ "midenc-hir", "paste", @@ -3856,8 +3914,8 @@ dependencies = [ [[package]] name = "midenc-dialect-cf" -version = "0.8.0" -source = "git+https://github.com/0xMiden/compiler?branch=next#35f138ea9f1d23e126345125d7e1f6e98918d2f7" +version = "0.8.1" +source = "git+https://github.com/0xMiden/compiler?branch=next#71598f7fa0a763a2e2cc37db3c9e46068cdb7565" dependencies = [ "log", "midenc-dialect-arith", @@ -3866,8 +3924,8 @@ dependencies = [ [[package]] name = "midenc-dialect-hir" -version = "0.8.0" -source = "git+https://github.com/0xMiden/compiler?branch=next#35f138ea9f1d23e126345125d7e1f6e98918d2f7" +version = "0.8.1" +source = "git+https://github.com/0xMiden/compiler?branch=next#71598f7fa0a763a2e2cc37db3c9e46068cdb7565" dependencies = [ "log", "midenc-dialect-arith", @@ -3879,8 +3937,8 @@ dependencies = [ [[package]] name = "midenc-dialect-scf" -version = "0.8.0" -source = "git+https://github.com/0xMiden/compiler?branch=next#35f138ea9f1d23e126345125d7e1f6e98918d2f7" +version = "0.8.1" +source = "git+https://github.com/0xMiden/compiler?branch=next#71598f7fa0a763a2e2cc37db3c9e46068cdb7565" dependencies = [ "bitvec", "log", @@ -3893,16 +3951,16 @@ dependencies = [ [[package]] name = "midenc-dialect-ub" -version = "0.8.0" -source = "git+https://github.com/0xMiden/compiler?branch=next#35f138ea9f1d23e126345125d7e1f6e98918d2f7" +version = "0.8.1" +source = "git+https://github.com/0xMiden/compiler?branch=next#71598f7fa0a763a2e2cc37db3c9e46068cdb7565" dependencies = [ "midenc-hir", ] [[package]] name = "midenc-dialect-wasm" -version = "0.8.0" -source = "git+https://github.com/0xMiden/compiler?branch=next#35f138ea9f1d23e126345125d7e1f6e98918d2f7" +version = "0.8.1" +source = "git+https://github.com/0xMiden/compiler?branch=next#71598f7fa0a763a2e2cc37db3c9e46068cdb7565" dependencies = [ "midenc-dialect-arith", "midenc-dialect-hir", @@ -3911,13 +3969,13 @@ dependencies = [ [[package]] name = "midenc-frontend-wasm" -version = "0.8.0" -source = "git+https://github.com/0xMiden/compiler?branch=next#35f138ea9f1d23e126345125d7e1f6e98918d2f7" +version = "0.8.1" +source = "git+https://github.com/0xMiden/compiler?branch=next#71598f7fa0a763a2e2cc37db3c9e46068cdb7565" dependencies = [ - "addr2line 0.24.2", + "addr2line 0.26.1", "anyhow", "cranelift-entity", - "gimli 0.31.1", + "gimli 0.33.0", "indexmap", "log", "miden-core", @@ -3927,17 +3985,27 @@ dependencies = [ "midenc-dialect-hir", "midenc-dialect-ub", "midenc-dialect-wasm", + "midenc-frontend-wasm-metadata", "midenc-hir", "midenc-hir-symbol", "midenc-session", - "wasmparser 0.227.1", + "wasmparser 0.248.0", "wasmprinter", ] +[[package]] +name = "midenc-frontend-wasm-metadata" +version = "0.12.0" +source = "git+https://github.com/0xMiden/compiler?branch=next#71598f7fa0a763a2e2cc37db3c9e46068cdb7565" +dependencies = [ + "serde", + "serde_json", +] + [[package]] name = "midenc-hir" -version = "0.8.0" -source = "git+https://github.com/0xMiden/compiler?branch=next#35f138ea9f1d23e126345125d7e1f6e98918d2f7" +version = "0.8.1" +source = "git+https://github.com/0xMiden/compiler?branch=next#71598f7fa0a763a2e2cc37db3c9e46068cdb7565" dependencies = [ "anyhow", "base64", @@ -3945,13 +4013,11 @@ dependencies = [ "bitvec", "blink-alloc", "compact_str", - "hashbrown 0.15.5", + "hashbrown 0.17.0", "intrusive-collections", "inventory", - "litcheck-core", "litcheck-filecheck", "log", - "memchr", "miden-core", "miden-thiserror", "midenc-hir-macros", @@ -3967,8 +4033,8 @@ dependencies = [ [[package]] name = "midenc-hir-analysis" -version = "0.8.0" -source = "git+https://github.com/0xMiden/compiler?branch=next#35f138ea9f1d23e126345125d7e1f6e98918d2f7" +version = "0.8.1" +source = "git+https://github.com/0xMiden/compiler?branch=next#71598f7fa0a763a2e2cc37db3c9e46068cdb7565" dependencies = [ "bitvec", "blink-alloc", @@ -3978,8 +4044,8 @@ dependencies = [ [[package]] name = "midenc-hir-macros" -version = "0.8.0" -source = "git+https://github.com/0xMiden/compiler?branch=next#35f138ea9f1d23e126345125d7e1f6e98918d2f7" +version = "0.8.1" +source = "git+https://github.com/0xMiden/compiler?branch=next#71598f7fa0a763a2e2cc37db3c9e46068cdb7565" dependencies = [ "Inflector", "darling", @@ -3990,23 +4056,23 @@ dependencies = [ [[package]] name = "midenc-hir-symbol" -version = "0.8.0" -source = "git+https://github.com/0xMiden/compiler?branch=next#35f138ea9f1d23e126345125d7e1f6e98918d2f7" +version = "0.8.1" +source = "git+https://github.com/0xMiden/compiler?branch=next#71598f7fa0a763a2e2cc37db3c9e46068cdb7565" dependencies = [ "Inflector", "compact_str", - "hashbrown 0.15.5", + "hashbrown 0.17.0", "lock_api", "miden-formatting", "parking_lot", "rustc-hash", - "toml 0.8.23", + "toml 1.1.2+spec-1.1.0", ] [[package]] name = "midenc-hir-transform" -version = "0.8.0" -source = "git+https://github.com/0xMiden/compiler?branch=next#35f138ea9f1d23e126345125d7e1f6e98918d2f7" +version = "0.8.1" +source = "git+https://github.com/0xMiden/compiler?branch=next#71598f7fa0a763a2e2cc37db3c9e46068cdb7565" dependencies = [ "log", "midenc-hir", @@ -4030,10 +4096,10 @@ dependencies = [ [[package]] name = "midenc-log" -version = "0.8.0" -source = "git+https://github.com/0xMiden/compiler?branch=next#35f138ea9f1d23e126345125d7e1f6e98918d2f7" +version = "0.8.1" +source = "git+https://github.com/0xMiden/compiler?branch=next#71598f7fa0a763a2e2cc37db3c9e46068cdb7565" dependencies = [ - "anstream 0.6.21", + "anstream", "anstyle", "jiff", "log", @@ -4042,8 +4108,8 @@ dependencies = [ [[package]] name = "midenc-session" -version = "0.8.0" -source = "git+https://github.com/0xMiden/compiler?branch=next#35f138ea9f1d23e126345125d7e1f6e98918d2f7" +version = "0.8.1" +source = "git+https://github.com/0xMiden/compiler?branch=next#71598f7fa0a763a2e2cc37db3c9e46068cdb7565" dependencies = [ "anyhow", "clap", @@ -4283,22 +4349,22 @@ dependencies = [ [[package]] name = "object" -version = "0.36.7" +version = "0.37.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62948e14d923ea95ea2c7c86c71013138b66525b86bdc08d2dcc262bdb497b87" +checksum = "ff76201f031d8863c38aa7f905eca4f53abbfa15f609db4277d44cd8938f33fe" dependencies = [ - "flate2", "memchr", - "ruzstd", ] [[package]] name = "object" -version = "0.37.3" +version = "0.39.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff76201f031d8863c38aa7f905eca4f53abbfa15f609db4277d44cd8938f33fe" +checksum = "2e5a6c098c7a3b6547378093f5cc30bc54fd361ce711e05293a5cc589562739b" dependencies = [ + "flate2", "memchr", + "ruzstd", ] [[package]] @@ -5408,7 +5474,7 @@ dependencies = [ "quinn-udp", "rustc-hash", "rustls", - "socket2", + "socket2 0.6.3", "thiserror 2.0.18", "tokio", "tracing", @@ -5446,7 +5512,7 @@ dependencies = [ "cfg_aliases", "libc", "once_cell", - "socket2", + "socket2 0.6.3", "tracing", "windows-sys 0.60.2", ] @@ -5889,9 +5955,9 @@ checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d" [[package]] name = "ruzstd" -version = "0.7.3" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fad02996bfc73da3e301efe90b1837be9ed8f4a462b6ed410aa35d00381de89f" +checksum = "a7c1c839d570d835527c9a5e4db7cb2198683a988cb9d7293fc8674e6bd58fc8" dependencies = [ "twox-hash", ] @@ -6200,6 +6266,16 @@ 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.3" @@ -6562,16 +6638,16 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.51.1" +version = "1.51.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f66bf9585cda4b724d3e78ab34b73fb2bbaba9011b9bfdf69dc836382ea13b8c" +checksum = "2bd1c4c0fc4a7ab90fc15ef6daaa3ec3b893f004f915f2392557ed23237820cd" dependencies = [ "bytes", "libc", "mio", "pin-project-lite", "signal-hook-registry", - "socket2", + "socket2 0.6.3", "tokio-macros", "windows-sys 0.61.2", ] @@ -6718,17 +6794,17 @@ dependencies = [ [[package]] name = "toml_edit" -version = "0.23.10+spec-1.0.0" +version = "0.25.11+spec-1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84c8b9f757e028cee9fa244aea147aab2a9ec09d5325a9b01e0a49730c2b5269" +checksum = "0b59c4d22ed448339746c59b905d24568fcbb3ab65a500494f7b8c3e97739f2b" dependencies = [ "indexmap", "serde_core", "serde_spanned 1.1.1", - "toml_datetime 0.7.5+spec-1.1.0", + "toml_datetime 1.1.1+spec-1.1.0", "toml_parser", "toml_writer", - "winnow 0.7.15", + "winnow 1.0.1", ] [[package]] @@ -6772,7 +6848,7 @@ dependencies = [ "percent-encoding", "pin-project", "rustls-native-certs", - "socket2", + "socket2 0.6.3", "sync_wrapper", "tokio", "tokio-rustls", @@ -7075,13 +7151,9 @@ dependencies = [ [[package]] name = "twox-hash" -version = "1.6.3" +version = "2.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97fee6b57c6a41524a810daee9286c02d7752c4253064d0b05472833a438f675" -dependencies = [ - "cfg-if", - "static_assertions", -] +checksum = "9ea3136b675547379c4bd395ca6b938e5ad3c3d20fad76e7fe85f9e0d011419c" [[package]] name = "typed-arena" @@ -7385,12 +7457,12 @@ dependencies = [ [[package]] name = "wasm-encoder" -version = "0.246.2" +version = "0.249.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61fb705ce81adde29d2a8e99d87995e39a6e927358c91398f374474746070ef7" +checksum = "69830ccbbf41c55eb585991659fb70867ef628193af3a495f09a6956f7615e59" dependencies = [ "leb128fmt", - "wasmparser 0.246.2", + "wasmparser 0.249.0", ] [[package]] @@ -7432,20 +7504,21 @@ dependencies = [ [[package]] name = "wasmparser" -version = "0.227.1" +version = "0.239.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f51cad774fb3c9461ab9bccc9c62dfb7388397b5deda31bf40e8108ccd678b2" +checksum = "8c9d90bb93e764f6beabf1d02028c70a2156a6583e63ac4218dd07ef733368b0" dependencies = [ "bitflags", + "hashbrown 0.15.5", "indexmap", "semver 1.0.28", ] [[package]] name = "wasmparser" -version = "0.239.0" +version = "0.244.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c9d90bb93e764f6beabf1d02028c70a2156a6583e63ac4218dd07ef733368b0" +checksum = "47b807c72e1bac69382b3a6fb3dbe8ea4c0ed87ff5629b8685ae6b9a611028fe" dependencies = [ "bitflags", "hashbrown 0.15.5", @@ -7455,21 +7528,20 @@ dependencies = [ [[package]] name = "wasmparser" -version = "0.244.0" +version = "0.248.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47b807c72e1bac69382b3a6fb3dbe8ea4c0ed87ff5629b8685ae6b9a611028fe" +checksum = "aa4439c5eee9df71ee0c6efb37f63b1fcb1fec38f85f5142c54e7ed05d33091a" dependencies = [ "bitflags", - "hashbrown 0.15.5", "indexmap", "semver 1.0.28", ] [[package]] name = "wasmparser" -version = "0.246.2" +version = "0.249.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71cde4757396defafd25417cfb36aa3161027d06d865b0c24baaae229aac005d" +checksum = "30538cae9a794215f490b532df01c557e2e2bfac92569482554acd0992a102ea" dependencies = [ "bitflags", "indexmap", @@ -7478,33 +7550,43 @@ dependencies = [ [[package]] name = "wasmprinter" -version = "0.227.1" +version = "0.248.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32475a0459db5639e989206dd8833fb07110ec092a7cb3468c82341989cac4d3" +checksum = "30b264a5410b008d4d199a92bf536eae703cbd614482fc1ec53831cf19e1c183" dependencies = [ "anyhow", "termcolor", - "wasmparser 0.227.1", + "wasmparser 0.248.0", +] + +[[package]] +name = "wasmtime-internal-core" +version = "44.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f2c7fa6523647262bfb4095dbdf4087accefe525813e783f81a0c682f418ce4" +dependencies = [ + "hashbrown 0.16.1", + "libm", ] [[package]] name = "wast" -version = "246.0.2" +version = "249.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe3fe8e3bf88ad96d031b4181ddbd64634b17cb0d06dfc3de589ef43591a9a62" +checksum = "2474a321bf9ae2808e9fa23ac4ec2b27300e70985e30bcb5a38d43b76bfc901a" dependencies = [ "bumpalo", "leb128fmt", "memchr", "unicode-width 0.2.2", - "wasm-encoder 0.246.2", + "wasm-encoder 0.249.0", ] [[package]] name = "wat" -version = "1.246.2" +version = "1.249.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bd7fda1199b94fff395c2d19a153f05dbe7807630316fa9673367666fd2ad8c" +checksum = "28af699d0a9c7e4e250b7b8e36167ae5215fbb4b7ae526bb4ce7b234ba0afc90" dependencies = [ "wast", ] @@ -7884,6 +7966,9 @@ name = "winnow" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09dac053f1cd375980747450bfc7250c264eaae0583872e845c0c7cd578872b5" +dependencies = [ + "memchr", +] [[package]] name = "wit-bindgen" diff --git a/Cargo.toml b/Cargo.toml index 39456ce7..be53f689 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,15 +19,15 @@ license = "MIT" readme = "README.md" repository = "https://github.com/0xMiden/miden-faucet" rust-version = "1.93" -version = "0.14.0" +version = "0.15.0" # Optimize the cryptography for faster tests involving account creation. [profile.test.package.miden-crypto] opt-level = 2 [workspace.dependencies] -miden-faucet-lib = { path = "crates/faucet", version = "0.14.0" } -miden-pow-rate-limiter = { path = "crates/pow", version = "0.14.0" } +miden-faucet-lib = { path = "crates/faucet", version = "0.15.0" } +miden-pow-rate-limiter = { path = "crates/pow", version = "0.15.0" } # Miden dependencies. cargo-miden = { branch = "next", git = "https://github.com/0xMiden/compiler" } diff --git a/Makefile b/Makefile index ff47ca15..40ab46f0 100644 --- a/Makefile +++ b/Makefile @@ -69,14 +69,14 @@ test: ## Runs all tests .PHONY: check check: ## Check all targets and features for errors without code generation - ${BUILD_PROTO} cargo check --all-features --all-targets --locked + cargo check --all-features --all-targets --locked # --- installing ---------------------------------------------------------------------------------- .PHONY: install-faucet install-faucet: ## Installs faucet - ${BUILD_PROTO} cargo install --path bin/faucet --locked - ${BUILD_PROTO} cargo install --path bin/faucet-client --locked + cargo install --path bin/faucet --locked + cargo install --path bin/faucet-client --locked .PHONY: check-tools check-tools: ## Checks if development tools are installed diff --git a/bin/faucet/frontend/app.js b/bin/faucet/frontend/app.js index be2d683d..4567af02 100644 --- a/bin/faucet/frontend/app.js +++ b/bin/faucet/frontend/app.js @@ -1,6 +1,6 @@ import { MidenWalletAdapter } from "@demox-labs/miden-wallet-adapter-miden"; import { PrivateDataPermission, WalletAdapterNetwork, WalletReadyState } from "@demox-labs/miden-wallet-adapter-base"; -import { Endpoint, NoteId, RpcClient } from "@miden-sdk/miden-sdk"; +import { Endpoint, NoteId, RpcClient, getWasmOrThrow } from "@miden-sdk/miden-sdk"; import { Utils } from './utils.js'; import { UIController } from './ui.js'; import { getConfig, getMetadata, getPowChallenge, getTokens, get_note, send_note } from "./api.js"; @@ -32,7 +32,7 @@ export class MidenFaucetApp { async init() { try { - let config = await getConfig(); + const [config] = await Promise.all([getConfig(), getWasmOrThrow()]); this.apiUrl = config.api_url; this.rpcClient = new RpcClient(new Endpoint(config.node_url)); this.setupEventListeners(); diff --git a/bin/faucet/frontend/package.json b/bin/faucet/frontend/package.json index d98e9916..21400115 100644 --- a/bin/faucet/frontend/package.json +++ b/bin/faucet/frontend/package.json @@ -1,6 +1,6 @@ { "name": "miden-faucet-frontend", - "version": "v.0.12.0", + "version": "v.0.14.1", "description": "Miden Faucet Frontend", "main": "index.js", "scripts": { @@ -15,7 +15,7 @@ "dependencies": { "@demox-labs/miden-wallet-adapter-base": "^0.10.0", "@demox-labs/miden-wallet-adapter-miden": "^0.10.0", - "@miden-sdk/miden-sdk": "^0.14.0" + "@miden-sdk/miden-sdk": "^0.14.3" }, "devDependencies": { "esbuild": "^0.27.0" diff --git a/bin/faucet/src/api/get_metadata.rs b/bin/faucet/src/api/get_metadata.rs index af25fb68..566af7e7 100644 --- a/bin/faucet/src/api/get_metadata.rs +++ b/bin/faucet/src/api/get_metadata.rs @@ -18,6 +18,7 @@ pub struct Metadata { pub decimals: u8, pub explorer_url: Option, pub base_amount: u64, + pub note_transport_url: Option, } // ENDPOINT @@ -34,6 +35,7 @@ pub async fn get_metadata(State(server): State) -> Json, pub pow_load_difficulty: u64, pub base_amount: u64, + pub note_transport_url: Option, } diff --git a/bin/faucet/src/main.rs b/bin/faucet/src/main.rs index c1311311..14f14971 100644 --- a/bin/faucet/src/main.rs +++ b/bin/faucet/src/main.rs @@ -440,21 +440,22 @@ async fn run_faucet_command(cli: Cli) -> anyhow::Result<()> { let max_supply = AssetAmount::new(faucet_component.max_supply().as_canonical_u64())?; let decimals = faucet_component.decimals(); + let note_transport_client = note_transport_url.as_ref().map(|url| { + Arc::new(GrpcNoteTransportClient::new( + url.to_string(), + timeout.as_millis().try_into().expect("timeout should fit into u64"), + )) + }); + let metadata = Metadata { id: faucet.faucet_id(), max_supply, decimals, explorer_url, base_amount, + note_transport_url, }; - let note_transport_client = note_transport_url.map(|url| { - Arc::new(GrpcNoteTransportClient::new( - url.to_string(), - timeout.as_millis().try_into().expect("timeout should fit into u64"), - )) - }); - // We keep a channel sender open in the main thread to avoid the faucet closing before // servers can propagate any errors. let tx_mint_requests_clone = tx_mint_requests.clone(); diff --git a/crates/faucet/src/lib.rs b/crates/faucet/src/lib.rs index 5032c153..ac8ba8ee 100644 --- a/crates/faucet/src/lib.rs +++ b/crates/faucet/src/lib.rs @@ -13,7 +13,7 @@ use miden_client::builder::ClientBuilder; use miden_client::crypto::{RandomCoin, Rpo256}; use miden_client::keystore::{FilesystemKeyStore, Keystore}; use miden_client::note::{Note, NoteAttachment, NoteError, NoteId, P2idNote}; -use miden_client::rpc::{Endpoint, GrpcClient}; +use miden_client::rpc::{Endpoint, GrpcClient, GrpcError, RpcError}; use miden_client::store::{NoteFilter, TransactionFilter}; use miden_client::sync::{StateSync, StateSyncInput, SyncSummary}; use miden_client::transaction::{ @@ -127,8 +127,12 @@ impl Faucet { let note_screener = NoteScreener::new(sqlite_store.clone()); let grpc_client = Arc::new(GrpcClient::new(&config.node_endpoint, config.timeout.as_millis() as u64)); - let state_sync_component = - StateSync::new(grpc_client.clone(), Arc::new(note_screener), None); + let state_sync_component = StateSync::new( + grpc_client.clone(), + Some(sqlite_store.clone()), + Arc::new(note_screener), + None, + ); Self::sync_state(account.id(), &mut client, &state_sync_component).await?; let add_result = client.add_account(&account, false).await; @@ -171,10 +175,11 @@ impl Faucet { #[instrument(target = COMPONENT, name = "faucet.load", fields(account_id), skip_all, err)] pub async fn load(config: &FaucetConfig) -> anyhow::Result { let span = tracing::Span::current(); + let sqlite_store = Arc::new(SqliteStore::new(config.store_path.clone()).await?); let mut client = ClientBuilder::new() .grpc_client(&config.node_endpoint, Some(config.timeout.as_millis() as u64)) .filesystem_keystore(KEYSTORE_PATH)? - .store(Arc::new(SqliteStore::new(config.store_path.clone()).await?)) + .store(sqlite_store.clone()) .build() .await .context("failed to build client")?; @@ -207,11 +212,11 @@ impl Faucet { .await? .context("client db should contain the mint tx script")?; - let note_screener = - NoteScreener::new(Arc::new(SqliteStore::new(config.store_path.clone()).await?)); + let note_screener = NoteScreener::new(sqlite_store.clone()); let grpc_client = Arc::new(GrpcClient::new(&config.node_endpoint, config.timeout.as_millis() as u64)); - let state_sync_component = StateSync::new(grpc_client, Arc::new(note_screener), None); + let state_sync_component = + StateSync::new(grpc_client, Some(sqlite_store.clone()), Arc::new(note_screener), None); Ok(Self { id, @@ -293,7 +298,8 @@ impl Faucet { Ok(()) => (), Err(error) => { if let Some(ClientError::RpcError(_)) = error.downcast_ref::() { - error!(?error, "RPC error, discarding batch"); + let error_chain = format!("{error:#}"); + error!(error = %error_chain, "RPC error, discarding batch"); } else { anyhow::bail!(error.context("failed to mint batch")); } @@ -438,44 +444,99 @@ impl Faucet { /// Executes, proves, and then submits a transaction using the local miden-client. /// This results in submitting the transaction to the node and updating the local db to track /// the created notes. - #[instrument(target = COMPONENT, name = "faucet.mint.submit_new_transaction", skip_all, err)] + #[instrument( + target = COMPONENT, + name = "faucet.mint.submit_new_transaction", + skip_all, + err, + fields( + rpc.system = tracing::field::Empty, + rpc.method = tracing::field::Empty, + rpc.grpc.status_code = tracing::field::Empty, + exception.type = tracing::field::Empty, + exception.message = tracing::field::Empty, + ) + )] async fn submit_new_transaction( &mut self, tx_request: TransactionRequest, ) -> Result { // Execute the transaction + let execute_span = info_span!(target: COMPONENT, "faucet.mint.execute", exception.message = tracing::field::Empty); let tx_result = self .client .execute_transaction(self.id.account_id, tx_request) - .instrument(info_span!(target: COMPONENT, "faucet.mint.execute")) - .await?; + .instrument(execute_span.clone()) + .await + .inspect_err(|e| { + execute_span.record("exception.message", tracing::field::display(e)); + record_grpc_error_fields(e); + })?; let tx_id = tx_result.executed_transaction().id(); let proven_transaction = { + let remote_span = info_span!( + target: COMPONENT, + "faucet.mint.prove_remote", + exception.message = tracing::field::Empty, + ); let remote_proven_transaction = self .client .prove_transaction_with(&tx_result, self.tx_prover.clone()) - .instrument(info_span!(target: COMPONENT, "faucet.mint.prove_remote")) - .await; + .instrument(remote_span.clone()) + .await + .inspect_err(|e| { + remote_span.record("exception.message", tracing::field::display(e)); + }); match remote_proven_transaction { Ok(proven_transaction) => proven_transaction, Err(error) => { error!(?error, "Failed to prove transaction with remote prover"); + let local_span = info_span!( + target: COMPONENT, + "faucet.mint.prove_local", + exception.message = tracing::field::Empty, + ); self.client .prove_transaction(&tx_result) - .instrument(info_span!(target: COMPONENT, "faucet.mint.prove_local")) - .await? + .instrument(local_span.clone()) + .await + .inspect_err(|e| { + local_span.record("exception.message", tracing::field::display(e)); + record_grpc_error_fields(e); + })? }, } }; + let submit_span = info_span!( + target: COMPONENT, + "faucet.mint.submit_transaction", + exception.message = tracing::field::Empty, + ); let submission_height = self .client .submit_proven_transaction(proven_transaction, &tx_result) - .instrument(info_span!(target: COMPONENT, "faucet.mint.submit_transaction")) - .await?; - - self.client.apply_transaction(&tx_result, submission_height).await?; + .instrument(submit_span.clone()) + .await + .inspect_err(|e| { + submit_span.record("exception.message", tracing::field::display(e)); + record_grpc_error_fields(e); + })?; + + let apply_span = info_span!( + target: COMPONENT, + "faucet.mint.apply_transaction", + exception.message = tracing::field::Empty, + ); + self.client + .apply_transaction(&tx_result, submission_height) + .instrument(apply_span.clone()) + .await + .inspect_err(|e| { + apply_span.record("exception.message", tracing::field::display(e)); + record_grpc_error_fields(e); + })?; Ok(tx_id) } @@ -527,6 +588,55 @@ impl Faucet { // HELPER FUNCTIONS // ================================================================================================ +/// Records gRPC error details from a [`ClientError`] onto the current tracing span using the +/// OpenTelemetry RPC and exception semantic conventions +/// (). +/// +/// Sub-step errors propagate up to the parent `submit_new_transaction` span via `?`, but the +/// `#[instrument(..., err)]` macro only captures the error's `Display` output. This pulls the +/// structured fields out of [`RpcError::RequestError`] and records them as `rpc.system`, +/// `rpc.method`, `rpc.grpc.status_code`, `exception.type`, and `exception.message`. +fn record_grpc_error_fields(err: &ClientError) { + let span = tracing::Span::current(); + if let ClientError::RpcError(rpc_err) = err { + span.record("exception.message", tracing::field::display(rpc_err)); + if let RpcError::RequestError { endpoint, error_kind, endpoint_error, .. } = rpc_err { + span.record("rpc.system", "grpc"); + span.record("rpc.method", tracing::field::display(endpoint)); + span.record("rpc.grpc.status_code", grpc_status_code(error_kind)); + span.record("exception.type", tracing::field::debug(error_kind)); + if let Some(ee) = endpoint_error { + // Override with the more specific node-side message when available. + span.record("exception.message", tracing::field::display(ee)); + } + } + } +} + +/// Maps a [`GrpcError`] variant to its canonical gRPC numeric status code, as defined by +/// . Used for the +/// `rpc.grpc.status_code` OpenTelemetry attribute. +fn grpc_status_code(kind: &GrpcError) -> i64 { + match kind { + GrpcError::Cancelled => 1, + GrpcError::Unknown(_) => 2, + GrpcError::InvalidArgument => 3, + GrpcError::DeadlineExceeded => 4, + GrpcError::NotFound => 5, + GrpcError::AlreadyExists => 6, + GrpcError::PermissionDenied => 7, + GrpcError::ResourceExhausted => 8, + GrpcError::FailedPrecondition => 9, + GrpcError::Aborted => 10, + GrpcError::OutOfRange => 11, + GrpcError::Unimplemented => 12, + GrpcError::Internal => 13, + GrpcError::Unavailable => 14, + GrpcError::DataLoss => 15, + GrpcError::Unauthenticated => 16, + } +} + /// Builds a collection of `P2ID` notes from a set of mint requests. /// /// # Errors @@ -695,6 +805,7 @@ mod tests { client, state_sync_component: StateSync::new( mock_rpc, + Some(store.clone()), Arc::new(NoteScreener::new(store.clone())), None, ), diff --git a/docs/src/rest-api.md b/docs/src/rest-api.md index 8912b775..ab0747ed 100644 --- a/docs/src/rest-api.md +++ b/docs/src/rest-api.md @@ -57,7 +57,7 @@ For detailed information about the token request flow, see the [Architecture](./ ### Get Metadata -**Endpoint**: `GET /metadata` +**Endpoint**: `GET /get_metadata` - **Purpose**: Request the faucet metadata to show on the frontend @@ -67,6 +67,7 @@ For detailed information about the token request flow, see the [Architecture](./ - `max_supply` (number): maximum available supply of the faucet (in base units) - `decimals` (number): number of decimals of the token minted by the faucet. It is needed to convert base units into token amounts. - `explorer_url` (string): URL to view the transaction in the explorer. Only present if available for the current network. + - `note_transport_url` (string): URL of the note transport layer (NTL) endpoint used by the faucet. Only present if the faucet was configured with `--note-transport-url`. ### Get Note diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 9522ff23..ec46c13c 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,5 +1,5 @@ [toolchain] -channel = "nightly-2025-12-10" +channel = "nightly-2026-04-30" components = ["clippy", "llvm-tools", "rust-src", "rustfmt"] profile = "minimal" targets = ["wasm32-wasip2"] From 6fe9821b9697bb154fef4d16005378670790b2c9 Mon Sep 17 00:00:00 2001 From: tomasarrachea Date: Tue, 19 May 2026 12:25:08 -0300 Subject: [PATCH 18/19] wip: compiler version --- Cargo.lock | 249 ++++++++++++++++++++++++-------------------- Cargo.toml | 2 +- rust-toolchain.toml | 2 +- 3 files changed, 140 insertions(+), 113 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a626bcd4..c64ecf3e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -14,29 +14,29 @@ dependencies = [ [[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 = "addr2line" -version = "0.26.1" +version = "0.24.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59317f77929f0e679d39364702289274de2f0f0b22cbf50b2b8cff2169a0b27a" +checksum = "dfbe277e56a376000877090da837660b4427aad530e3028d44e0bffe4f89a1c1" dependencies = [ "cpp_demangle", "fallible-iterator", - "gimli 0.33.0", + "gimli 0.31.1", "memmap2", - "object 0.39.1", + "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" @@ -158,6 +158,21 @@ dependencies = [ "libc", ] +[[package]] +name = "anstream" +version = "0.6.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43d5b281e737544384e969a5ccad3f1cdd24b48086a0fc1b2a5262a26b8f4f4a" +dependencies = [ + "anstyle", + "anstyle-parse 0.2.7", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "is_terminal_polyfill", + "utf8parse", +] + [[package]] name = "anstream" version = "1.0.0" @@ -165,7 +180,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "824a212faf96e9acacdbd09febd34438f8f711fb84e09a8916013cd7815ca28d" dependencies = [ "anstyle", - "anstyle-parse", + "anstyle-parse 1.0.0", "anstyle-query", "anstyle-wincon", "colorchoice", @@ -179,6 +194,15 @@ version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "940b3a0ca603d1eade50a4846a2afffd5ef57a9feac2c0e2ec2e14f9ead76000" +[[package]] +name = "anstyle-parse" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e7644824f0aa2c7b9384579234ef10eb7efb6a0deb83f9630a49594dd9c15c2" +dependencies = [ + "utf8parse", +] + [[package]] name = "anstyle-parse" version = "1.0.0" @@ -571,7 +595,8 @@ dependencies = [ [[package]] name = "cargo-miden" version = "0.8.1" -source = "git+https://github.com/0xMiden/compiler?branch=next#71598f7fa0a763a2e2cc37db3c9e46068cdb7565" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30f09004aa4b92f7a56924a76aae792f4adcae3adcac46ac384e73cea3827694" dependencies = [ "anyhow", "cargo_metadata", @@ -586,24 +611,24 @@ dependencies = [ "serde", "serde_json", "tempfile", - "toml_edit 0.25.11+spec-1.1.0", + "toml_edit 0.23.10+spec-1.0.0", "walkdir", ] [[package]] name = "cargo-platform" -version = "0.3.0" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8abf5d501fd757c2d2ee78d0cc40f606e92e3a63544420316565556ed28485e2" +checksum = "e35af189006b9c0f00a064685c727031e3ed2d8020f7ba284d78cc2671bd36ea" dependencies = [ "serde", ] [[package]] name = "cargo_metadata" -version = "0.23.1" +version = "0.19.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef987d17b0a113becdd19d3d0022d04d7ef41f9efe4f3fb63ac44ba61df3ade9" +checksum = "dd5eb614ed4c27c5d706420e4320fbe3216ab31fa1c33cd8246ac36dae4479ba" dependencies = [ "camino", "cargo-platform", @@ -716,7 +741,7 @@ version = "4.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "714a53001bf66416adb0e2ef5ac857140e7dc3a0c48fb28b2f10762fc4b5069f" dependencies = [ - "anstream", + "anstream 1.0.0", "anstyle", "clap_lex", "strsim", @@ -889,9 +914,9 @@ dependencies = [ [[package]] name = "cpp_demangle" -version = "0.5.1" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0667304c32ea56cb4cd6d2d7c0cfe9a2f8041229db8c033af7f8d69492429def" +checksum = "f2bb79cb74d735044c972aae58ed0aaa9a837e85b01106a54c39e42e97f62253" dependencies = [ "cfg-if", ] @@ -916,21 +941,17 @@ dependencies = [ [[package]] name = "cranelift-bitset" -version = "0.131.1" +version = "0.120.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f25c06993a681be9cf3140798a3d4ac5bec955e7444416a2fdc87fda8567285d" -dependencies = [ - "wasmtime-internal-core", -] +checksum = "db7b2ee9eec6ca8a716d900d5264d678fb2c290c58c46c8da7f94ee268175d17" [[package]] name = "cranelift-entity" -version = "0.131.1" +version = "0.120.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e62ef34c6e720f347a79ece043e8584e242d168911da640bac654a33a6aaaf5" +checksum = "d75418674520cb400c8772bfd6e11a62736c78fc1b6e418195696841d1bf91f1" dependencies = [ "cranelift-bitset", - "wasmtime-internal-core", ] [[package]] @@ -1320,7 +1341,7 @@ version = "0.11.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0621c04f2196ac3f488dd583365b9c09be011a4ab8b9f37248ffcc8f6198b56a" dependencies = [ - "anstream", + "anstream 1.0.0", "anstyle", "env_filter", "jiff", @@ -1705,18 +1726,19 @@ dependencies = [ [[package]] name = "gimli" -version = "0.32.3" +version = "0.31.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e629b9b98ef3dd8afe6ca2bd0f89306cec16d43d907889945bc5d6687f2f13c7" +checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f" +dependencies = [ + "fallible-iterator", + "stable_deref_trait", +] [[package]] name = "gimli" -version = "0.33.0" +version = "0.32.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0bf7f043f89559805f8c7cacc432749b2fa0d0a0a9ee46ce47164ed5ba7f126c" -dependencies = [ - "stable_deref_trait", -] +checksum = "e629b9b98ef3dd8afe6ca2bd0f89306cec16d43d907889945bc5d6687f2f13c7" [[package]] name = "glob" @@ -1822,11 +1844,6 @@ name = "hashbrown" version = "0.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4f467dd6dccf739c208452f8014c75c18bb8301b050ad1cfb27153803edb0f51" -dependencies = [ - "allocator-api2 0.2.21", - "equivalent", - "foldhash 0.2.0", -] [[package]] name = "hashlink" @@ -2287,9 +2304,9 @@ dependencies = [ [[package]] name = "intrusive-collections" -version = "0.10.1" +version = "0.9.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80e165935eba36cb526af8389effd2005a741adcbb6ed32106cc68e3f7b92960" +checksum = "189d0897e4cbe8c75efedf3502c18c887b05046e59d28404d4d8e46cbc4d1e86" dependencies = [ "memoffset", ] @@ -3053,9 +3070,9 @@ dependencies = [ [[package]] name = "miden-core" -version = "0.22.1" +version = "0.22.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fdec54a321cdf3d23e9ef615e91cb858038c6b4d4202507bdec048fc6d7763e4" +checksum = "b66f391ef088343611ad813f6a564a14088d03a17336d350d7f8c60937490f4d" dependencies = [ "derive_more", "itertools", @@ -3855,7 +3872,8 @@ dependencies = [ [[package]] name = "midenc-codegen-masm" version = "0.8.1" -source = "git+https://github.com/0xMiden/compiler?branch=next#71598f7fa0a763a2e2cc37db3c9e46068cdb7565" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ddea2c6050fea142e4f8c526c55bf3656c69c80e66bd099dd79728bdccda12f" dependencies = [ "anyhow", "inventory", @@ -3864,9 +3882,7 @@ dependencies = [ "miden-assembly-syntax", "miden-core", "miden-mast-package", - "miden-package-registry", "miden-processor", - "miden-project", "miden-protocol", "miden-thiserror", "midenc-dialect-arith", @@ -3886,9 +3902,12 @@ dependencies = [ [[package]] name = "midenc-compile" version = "0.8.1" -source = "git+https://github.com/0xMiden/compiler?branch=next#71598f7fa0a763a2e2cc37db3c9e46068cdb7565" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "927ad8e3f4f47949ae63cad358bcf510634765726e57f677c4d1cddadd8233ee" dependencies = [ + "anyhow", "clap", + "inventory", "log", "miden-assembly", "miden-mast-package", @@ -3906,7 +3925,8 @@ dependencies = [ [[package]] name = "midenc-dialect-arith" version = "0.8.1" -source = "git+https://github.com/0xMiden/compiler?branch=next#71598f7fa0a763a2e2cc37db3c9e46068cdb7565" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "015e5132f919666624203c2a7d355a757a1265c419d385acc7ff8478b2a3edfe" dependencies = [ "midenc-hir", "paste", @@ -3915,7 +3935,8 @@ dependencies = [ [[package]] name = "midenc-dialect-cf" version = "0.8.1" -source = "git+https://github.com/0xMiden/compiler?branch=next#71598f7fa0a763a2e2cc37db3c9e46068cdb7565" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddd32b0180d00707f0d2d6050c4cd24f0fa2ef3093a643dbdbf31792ded9cdef" dependencies = [ "log", "midenc-dialect-arith", @@ -3925,7 +3946,8 @@ dependencies = [ [[package]] name = "midenc-dialect-hir" version = "0.8.1" -source = "git+https://github.com/0xMiden/compiler?branch=next#71598f7fa0a763a2e2cc37db3c9e46068cdb7565" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb7333ca7996df3809cdbabc66b840e80bff44924570823adf218a1af4364ad0" dependencies = [ "log", "midenc-dialect-arith", @@ -3938,7 +3960,8 @@ dependencies = [ [[package]] name = "midenc-dialect-scf" version = "0.8.1" -source = "git+https://github.com/0xMiden/compiler?branch=next#71598f7fa0a763a2e2cc37db3c9e46068cdb7565" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32798b83efc34a7301f6fdf77c622ef5217d4dbed1fe68c62e2c7d07686964d0" dependencies = [ "bitvec", "log", @@ -3952,7 +3975,8 @@ dependencies = [ [[package]] name = "midenc-dialect-ub" version = "0.8.1" -source = "git+https://github.com/0xMiden/compiler?branch=next#71598f7fa0a763a2e2cc37db3c9e46068cdb7565" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47b3327a327fc4a13a08a2d9791b0cba5ef21e0c4ce2a4e18433d363c8c8dc47" dependencies = [ "midenc-hir", ] @@ -3960,7 +3984,8 @@ dependencies = [ [[package]] name = "midenc-dialect-wasm" version = "0.8.1" -source = "git+https://github.com/0xMiden/compiler?branch=next#71598f7fa0a763a2e2cc37db3c9e46068cdb7565" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c3284470339b901630d30c87c7d5fff962f41dc863c8979867664040ea07552" dependencies = [ "midenc-dialect-arith", "midenc-dialect-hir", @@ -3970,12 +3995,13 @@ dependencies = [ [[package]] name = "midenc-frontend-wasm" version = "0.8.1" -source = "git+https://github.com/0xMiden/compiler?branch=next#71598f7fa0a763a2e2cc37db3c9e46068cdb7565" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cee10db6ca611ca6e829a8625e179135dc729118974ec65006f8d17120a713a1" dependencies = [ - "addr2line 0.26.1", + "addr2line 0.24.2", "anyhow", "cranelift-entity", - "gimli 0.33.0", + "gimli 0.31.1", "indexmap", "log", "miden-core", @@ -3989,14 +4015,15 @@ dependencies = [ "midenc-hir", "midenc-hir-symbol", "midenc-session", - "wasmparser 0.248.0", + "wasmparser 0.227.1", "wasmprinter", ] [[package]] name = "midenc-frontend-wasm-metadata" version = "0.12.0" -source = "git+https://github.com/0xMiden/compiler?branch=next#71598f7fa0a763a2e2cc37db3c9e46068cdb7565" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6938fd4efb4a2c8937c77055a3779ddda33572728328cf4391d2f240f78be3a" dependencies = [ "serde", "serde_json", @@ -4005,7 +4032,8 @@ dependencies = [ [[package]] name = "midenc-hir" version = "0.8.1" -source = "git+https://github.com/0xMiden/compiler?branch=next#71598f7fa0a763a2e2cc37db3c9e46068cdb7565" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51141b60afe741ff47d8d95d8b7f9a8eeb32154257181aa73ef59b7f8cbaf759" dependencies = [ "anyhow", "base64", @@ -4013,11 +4041,13 @@ dependencies = [ "bitvec", "blink-alloc", "compact_str", - "hashbrown 0.17.0", + "hashbrown 0.15.5", "intrusive-collections", "inventory", + "litcheck-core", "litcheck-filecheck", "log", + "memchr", "miden-core", "miden-thiserror", "midenc-hir-macros", @@ -4034,7 +4064,8 @@ dependencies = [ [[package]] name = "midenc-hir-analysis" version = "0.8.1" -source = "git+https://github.com/0xMiden/compiler?branch=next#71598f7fa0a763a2e2cc37db3c9e46068cdb7565" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fbc8c3b28addc2560dc4b7cf4b4297ce5119bfaf645542f96e0d9f93bcee20f0" dependencies = [ "bitvec", "blink-alloc", @@ -4045,7 +4076,8 @@ dependencies = [ [[package]] name = "midenc-hir-macros" version = "0.8.1" -source = "git+https://github.com/0xMiden/compiler?branch=next#71598f7fa0a763a2e2cc37db3c9e46068cdb7565" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea4df411507d77af2b7ea70fd8e8a7e67272bbcb4a248386a647673cb9e19d97" dependencies = [ "Inflector", "darling", @@ -4057,22 +4089,24 @@ dependencies = [ [[package]] name = "midenc-hir-symbol" version = "0.8.1" -source = "git+https://github.com/0xMiden/compiler?branch=next#71598f7fa0a763a2e2cc37db3c9e46068cdb7565" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e212c781c59429229ba6a33d75151257175d88f722a60c333a855a790ca61b" dependencies = [ "Inflector", "compact_str", - "hashbrown 0.17.0", + "hashbrown 0.15.5", "lock_api", "miden-formatting", "parking_lot", "rustc-hash", - "toml 1.1.2+spec-1.1.0", + "toml 0.8.23", ] [[package]] name = "midenc-hir-transform" version = "0.8.1" -source = "git+https://github.com/0xMiden/compiler?branch=next#71598f7fa0a763a2e2cc37db3c9e46068cdb7565" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e1483fa0bb318eaf9b112b99280afecf917bf277a026774bf5db7db9c8964d3" dependencies = [ "log", "midenc-hir", @@ -4097,9 +4131,10 @@ dependencies = [ [[package]] name = "midenc-log" version = "0.8.1" -source = "git+https://github.com/0xMiden/compiler?branch=next#71598f7fa0a763a2e2cc37db3c9e46068cdb7565" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7463ae49be6e3612436bbe6af937112a23fb27d9c4e4cfb5b49c281b3b9f1b63" dependencies = [ - "anstream", + "anstream 0.6.21", "anstyle", "jiff", "log", @@ -4109,7 +4144,8 @@ dependencies = [ [[package]] name = "midenc-session" version = "0.8.1" -source = "git+https://github.com/0xMiden/compiler?branch=next#71598f7fa0a763a2e2cc37db3c9e46068cdb7565" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6895a782776dbba38034f6db4869da700e6b685a147869135c0b0ba86d38bdf" dependencies = [ "anyhow", "clap", @@ -4349,22 +4385,22 @@ dependencies = [ [[package]] name = "object" -version = "0.37.3" +version = "0.36.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff76201f031d8863c38aa7f905eca4f53abbfa15f609db4277d44cd8938f33fe" +checksum = "62948e14d923ea95ea2c7c86c71013138b66525b86bdc08d2dcc262bdb497b87" dependencies = [ + "flate2", "memchr", + "ruzstd", ] [[package]] name = "object" -version = "0.39.1" +version = "0.37.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e5a6c098c7a3b6547378093f5cc30bc54fd361ce711e05293a5cc589562739b" +checksum = "ff76201f031d8863c38aa7f905eca4f53abbfa15f609db4277d44cd8938f33fe" dependencies = [ - "flate2", "memchr", - "ruzstd", ] [[package]] @@ -5955,9 +5991,9 @@ checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d" [[package]] name = "ruzstd" -version = "0.8.3" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7c1c839d570d835527c9a5e4db7cb2198683a988cb9d7293fc8674e6bd58fc8" +checksum = "fad02996bfc73da3e301efe90b1837be9ed8f4a462b6ed410aa35d00381de89f" dependencies = [ "twox-hash", ] @@ -6794,17 +6830,17 @@ dependencies = [ [[package]] name = "toml_edit" -version = "0.25.11+spec-1.1.0" +version = "0.23.10+spec-1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b59c4d22ed448339746c59b905d24568fcbb3ab65a500494f7b8c3e97739f2b" +checksum = "84c8b9f757e028cee9fa244aea147aab2a9ec09d5325a9b01e0a49730c2b5269" dependencies = [ "indexmap", "serde_core", "serde_spanned 1.1.1", - "toml_datetime 1.1.1+spec-1.1.0", + "toml_datetime 0.7.5+spec-1.1.0", "toml_parser", "toml_writer", - "winnow 1.0.1", + "winnow 0.7.15", ] [[package]] @@ -7151,9 +7187,13 @@ dependencies = [ [[package]] name = "twox-hash" -version = "2.1.2" +version = "1.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ea3136b675547379c4bd395ca6b938e5ad3c3d20fad76e7fe85f9e0d011419c" +checksum = "97fee6b57c6a41524a810daee9286c02d7752c4253064d0b05472833a438f675" +dependencies = [ + "cfg-if", + "static_assertions", +] [[package]] name = "typed-arena" @@ -7504,21 +7544,20 @@ dependencies = [ [[package]] name = "wasmparser" -version = "0.239.0" +version = "0.227.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c9d90bb93e764f6beabf1d02028c70a2156a6583e63ac4218dd07ef733368b0" +checksum = "0f51cad774fb3c9461ab9bccc9c62dfb7388397b5deda31bf40e8108ccd678b2" dependencies = [ "bitflags", - "hashbrown 0.15.5", "indexmap", "semver 1.0.28", ] [[package]] name = "wasmparser" -version = "0.244.0" +version = "0.239.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47b807c72e1bac69382b3a6fb3dbe8ea4c0ed87ff5629b8685ae6b9a611028fe" +checksum = "8c9d90bb93e764f6beabf1d02028c70a2156a6583e63ac4218dd07ef733368b0" dependencies = [ "bitflags", "hashbrown 0.15.5", @@ -7528,11 +7567,12 @@ dependencies = [ [[package]] name = "wasmparser" -version = "0.248.0" +version = "0.244.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa4439c5eee9df71ee0c6efb37f63b1fcb1fec38f85f5142c54e7ed05d33091a" +checksum = "47b807c72e1bac69382b3a6fb3dbe8ea4c0ed87ff5629b8685ae6b9a611028fe" dependencies = [ "bitflags", + "hashbrown 0.15.5", "indexmap", "semver 1.0.28", ] @@ -7550,23 +7590,13 @@ dependencies = [ [[package]] name = "wasmprinter" -version = "0.248.0" +version = "0.227.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30b264a5410b008d4d199a92bf536eae703cbd614482fc1ec53831cf19e1c183" +checksum = "32475a0459db5639e989206dd8833fb07110ec092a7cb3468c82341989cac4d3" dependencies = [ "anyhow", "termcolor", - "wasmparser 0.248.0", -] - -[[package]] -name = "wasmtime-internal-core" -version = "44.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f2c7fa6523647262bfb4095dbdf4087accefe525813e783f81a0c682f418ce4" -dependencies = [ - "hashbrown 0.16.1", - "libm", + "wasmparser 0.227.1", ] [[package]] @@ -7966,9 +7996,6 @@ name = "winnow" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09dac053f1cd375980747450bfc7250c264eaae0583872e845c0c7cd578872b5" -dependencies = [ - "memchr", -] [[package]] name = "wit-bindgen" diff --git a/Cargo.toml b/Cargo.toml index be53f689..141ec885 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -30,7 +30,7 @@ miden-faucet-lib = { path = "crates/faucet", version = "0.15.0" } miden-pow-rate-limiter = { path = "crates/pow", version = "0.15.0" } # Miden dependencies. -cargo-miden = { branch = "next", git = "https://github.com/0xMiden/compiler" } +cargo-miden = { version = "0.8.1" } miden = { version = "0.11" } miden-client = { version = "0.14" } miden-client-cli = { version = "0.14" } diff --git a/rust-toolchain.toml b/rust-toolchain.toml index ec46c13c..9522ff23 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,5 +1,5 @@ [toolchain] -channel = "nightly-2026-04-30" +channel = "nightly-2025-12-10" components = ["clippy", "llvm-tools", "rust-src", "rustfmt"] profile = "minimal" targets = ["wasm32-wasip2"] From be99efccfd257f81bf7eae60a2c78ff1e9238285 Mon Sep 17 00:00:00 2001 From: tomasarrachea Date: Tue, 19 May 2026 12:46:55 -0300 Subject: [PATCH 19/19] fix: rust tx script --- crates/contracts/mint-tx/Cargo.toml | 3 --- crates/contracts/mint-tx/src/lib.rs | 8 +++----- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/crates/contracts/mint-tx/Cargo.toml b/crates/contracts/mint-tx/Cargo.toml index 27fd3ee4..89e20a62 100644 --- a/crates/contracts/mint-tx/Cargo.toml +++ b/crates/contracts/mint-tx/Cargo.toml @@ -22,6 +22,3 @@ package = "miden:mint-tx" [package.metadata.miden] project-kind = "transaction-script" - -[package.metadata.component.target.dependencies] -"miden:faucet-account" = { path = "../faucet-account/target/generated-wit/" } diff --git a/crates/contracts/mint-tx/src/lib.rs b/crates/contracts/mint-tx/src/lib.rs index 03796789..6b35e22b 100644 --- a/crates/contracts/mint-tx/src/lib.rs +++ b/crates/contracts/mint-tx/src/lib.rs @@ -34,9 +34,7 @@ use miden::intrinsics::advice::adv_push_mapvaln; use miden::tx::update_expiration_block_delta; -use miden::{Felt, Recipient, Word, output_note, pipe_words_to_memory, tx_script}; - -use crate::bindings::Account; +use miden::{Felt, Recipient, Word, faucet, output_note, pipe_words_to_memory, tx_script}; /// Number of felts per note in the advice map data. /// @@ -47,7 +45,7 @@ const NOTE_ARGS_SIZE: usize = 7; const EXPIRATION_DELTA: u32 = 10; #[tx_script] -fn run(arg: Word, account: &mut Account) { +fn run(arg: Word) { update_expiration_block_delta(Felt::from_u32(EXPIRATION_DELTA)); // Push note data from the advice map onto the advice stack using the commitment as key. @@ -72,7 +70,7 @@ fn run(arg: Word, account: &mut Account) { let tag = input[start + 5].into(); let amount = input[start + 6]; - let asset = account.create_fungible_asset(amount); + let asset = faucet::create_fungible_asset(amount); faucet::mint(asset); let note_idx = output_note::create(tag, note_type, recipient); output_note::add_asset(asset, note_idx);