Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
922cd86
chore: migrate to protocol release/v0.14.0-beta
claude Mar 11, 2026
bc85d59
chore: block_on
igamigo Mar 11, 2026
765169b
chore: patch crypto until a 0.22.x release is done
igamigo Mar 11, 2026
44d5214
chore: update to crypto v0.22.5
mmagician Mar 12, 2026
5320e57
chore: fmt
mmagician Mar 12, 2026
4d53991
Merge branch 'next' into mmagician-claude/update-base-to-beta
mmagician Mar 12, 2026
8bb975e
fix: account state forest pruning and LargeSmt loading
claude Mar 12, 2026
fe275f3
refactor: simplify KMS signer DER parsing with spki and k256 crates
claude Mar 12, 2026
a5f88db
Merge branch 'next' into mmagician-claude/update-base-to-beta
claude Mar 12, 2026
5767361
chore: import smt types from miden-protocol instead of miden-crypto
claude Mar 12, 2026
3528ad5
fix(stress-test): avoid account ID prefix collisions in seeding
claude Mar 12, 2026
b57d716
fix(stress-test): use high-entropy seeds for account creation
claude Mar 12, 2026
71c29d4
Merge branch 'next' into mmagician-claude/update-base-to-beta
claude Mar 12, 2026
916d06a
chore: address self review comments
claude Mar 12, 2026
0490027
chore: cleanup imports
mmagician Mar 12, 2026
99c7134
test: single source of randomness
igamigo Mar 12, 2026
9d5ff52
temp: use mmagician-0.22.6 branch
mmagician Mar 13, 2026
f9d4412
chore: revert kms changes
mmagician Mar 13, 2026
c5c87b5
fix: remove middle step serialization for InputNoteCommitment
SantiagoPittella Mar 13, 2026
98497ba
chore: cargo lock
igamigo Mar 13, 2026
8079f10
Revert "test: single source of randomness"
igamigo Mar 13, 2026
b6b3af0
chore: remove crypto patch
igamigo Mar 13, 2026
683c3d0
chore: merge
igamigo Mar 16, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,368 changes: 857 additions & 511 deletions Cargo.lock

Large diffs are not rendered by default.

46 changes: 23 additions & 23 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ license = "MIT"
readme = "README.md"
repository = "https://github.com/0xMiden/node"
rust-version = "1.91"
version = "0.14.0-alpha.5"
version = "0.14.0-beta.1"

# Optimize the cryptography for faster tests involving account creation.
[profile.test.package.miden-crypto]
Expand All @@ -46,35 +46,33 @@ debug = true

[workspace.dependencies]
# Workspace crates.
miden-large-smt-backend-rocksdb = { path = "crates/large-smt-backend-rocksdb", version = "=0.14.0-alpha.5" }
miden-node-block-producer = { path = "crates/block-producer", version = "=0.14.0-alpha.5" }
miden-node-db = { path = "crates/db", version = "=0.14.0-alpha.5" }
miden-node-grpc-error-macro = { path = "crates/grpc-error-macro", version = "=0.14.0-alpha.5" }
miden-node-ntx-builder = { path = "crates/ntx-builder", version = "=0.14.0-alpha.5" }
miden-node-proto = { path = "crates/proto", version = "=0.14.0-alpha.5" }
miden-node-proto-build = { path = "proto", version = "=0.14.0-alpha.5" }
miden-node-rpc = { path = "crates/rpc", version = "=0.14.0-alpha.5" }
miden-node-store = { path = "crates/store", version = "=0.14.0-alpha.5" }
miden-large-smt-backend-rocksdb = { path = "crates/large-smt-backend-rocksdb", version = "=0.14.0-beta.1" }
miden-node-block-producer = { path = "crates/block-producer", version = "=0.14.0-beta.1" }
miden-node-db = { path = "crates/db", version = "=0.14.0-beta.1" }
miden-node-grpc-error-macro = { path = "crates/grpc-error-macro", version = "=0.14.0-beta.1" }
miden-node-ntx-builder = { path = "crates/ntx-builder", version = "=0.14.0-beta.1" }
miden-node-proto = { path = "crates/proto", version = "=0.14.0-beta.1" }
miden-node-proto-build = { path = "proto", version = "=0.14.0-beta.1" }
miden-node-rpc = { path = "crates/rpc", version = "=0.14.0-beta.1" }
miden-node-store = { path = "crates/store", version = "=0.14.0-beta.1" }
miden-node-test-macro = { path = "crates/test-macro" }
miden-node-utils = { path = "crates/utils", version = "=0.14.0-alpha.5" }
miden-node-validator = { path = "crates/validator", version = "=0.14.0-alpha.5" }
miden-remote-prover-client = { path = "crates/remote-prover-client", version = "=0.14.0-alpha.5" }
miden-node-utils = { path = "crates/utils", version = "=0.14.0-beta.1" }
miden-node-validator = { path = "crates/validator", version = "=0.14.0-beta.1" }
miden-remote-prover-client = { path = "crates/remote-prover-client", version = "=0.14.0-beta.1" }
# Temporary workaround until <https://github.com/rust-rocksdb/rust-rocksdb/pull/1029>
# is part of `rocksdb-rust` release
miden-node-rocksdb-cxx-linkage-fix = { path = "crates/rocksdb-cxx-linkage-fix", version = "=0.14.0-alpha.5" }
miden-node-rocksdb-cxx-linkage-fix = { path = "crates/rocksdb-cxx-linkage-fix", version = "=0.14.0-beta.1" }

# miden-base aka protocol dependencies. These should be updated in sync.
miden-block-prover = { version = "=0.14.0-alpha.1" }
miden-protocol = { default-features = false, version = "=0.14.0-alpha.1" }
miden-standards = { version = "=0.14.0-alpha.1" }
miden-testing = { version = "=0.14.0-alpha.1" }
miden-tx = { default-features = false, version = "=0.14.0-alpha.1" }
miden-tx-batch-prover = { version = "=0.14.0-alpha.1" }
miden-block-prover = { version = "=0.14.0-beta.2" }
miden-protocol = { default-features = false, version = "=0.14.0-beta.2" }
miden-standards = { version = "=0.14.0-beta.2" }
miden-testing = { version = "=0.14.0-beta.2" }
miden-tx = { default-features = false, version = "=0.14.0-beta.2" }
miden-tx-batch-prover = { version = "=0.14.0-beta.2" }

# Other miden dependencies. These should align with those expected by miden-base.
miden-air = { features = ["std", "testing"], version = "0.20" }

miden-crypto = { version = "0.19.7" }
miden-crypto = { version = "0.22" }

# External dependencies
anyhow = { version = "1.0" }
Expand Down Expand Up @@ -146,3 +144,5 @@ should_panic_without_expect = "allow" # We don't care about the specific panic
# Configure `cargo-typos`
[workspace.metadata.typos]
files.extend-exclude = ["*.svg"] # Ignore SVG files.

[patch.crates-io]
15 changes: 8 additions & 7 deletions bin/network-monitor/src/counter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use miden_protocol::account::auth::AuthSecretKey;
use miden_protocol::account::{Account, AccountFile, AccountHeader, AccountId};
use miden_protocol::assembly::Library;
use miden_protocol::block::{BlockHeader, BlockNumber};
use miden_protocol::crypto::dsa::falcon512_rpo::SecretKey;
use miden_protocol::crypto::dsa::falcon512_poseidon2::SecretKey;
use miden_protocol::note::{
Note,
NoteAssets,
Expand All @@ -28,13 +28,13 @@ use miden_protocol::note::{
NoteType,
};
use miden_protocol::transaction::{InputNotes, PartialBlockchain, TransactionArgs};
use miden_protocol::utils::Deserializable;
use miden_protocol::utils::serde::Deserializable;
use miden_protocol::{Felt, Word};
use miden_standards::account::interface::{AccountInterface, AccountInterfaceExt};
use miden_standards::code_builder::CodeBuilder;
use miden_standards::note::{NetworkAccountTarget, NoteExecutionHint};
use miden_tx::auth::BasicAuthenticator;
use miden_tx::utils::Serializable;
use miden_tx::utils::serde::Serializable;
use miden_tx::{LocalTransactionProver, TransactionExecutor};
use rand::{Rng, SeedableRng};
use rand_chacha::ChaCha20Rng;
Expand Down Expand Up @@ -130,7 +130,7 @@ async fn fetch_counter_value(
.try_into()
.context("failed to convert slot value to word")?;

let value = slot_value.as_elements().last().expect("Word has 4 elements").as_int();
let value = slot_value.as_elements().last().expect("Word has 4 elements").as_canonical_u64();

Ok(Some(value))
}
Expand Down Expand Up @@ -321,7 +321,7 @@ async fn setup_increment_task(
.await?
.unwrap_or(wallet_account_file.account.clone());

let AuthSecretKey::Falcon512Rpo(secret_key) = wallet_account_file
let AuthSecretKey::Falcon512Poseidon2(secret_key) = wallet_account_file
.auth_secret_keys
.first()
.expect("wallet account file should have one auth secret key")
Expand Down Expand Up @@ -821,7 +821,8 @@ async fn create_and_submit_network_note(
rng: &mut ChaCha20Rng,
) -> Result<(String, AccountHeader, BlockNumber)> {
// Create authenticator for transaction signing
let authenticator = BasicAuthenticator::new(&[AuthSecretKey::Falcon512Rpo(secret_key.clone())]);
let authenticator =
BasicAuthenticator::new(&[AuthSecretKey::Falcon512Poseidon2(secret_key.clone())]);

let account_interface = AccountInterface::from_account(wallet_account);

Expand Down Expand Up @@ -851,7 +852,7 @@ async fn create_and_submit_network_note(

// Prove the transaction
let prover = LocalTransactionProver::default();
let proven_tx = prover.prove(executed_tx).context("Failed to prove transaction")?;
let proven_tx = prover.prove(executed_tx).await.context("Failed to prove transaction")?;

// Submit the proven transaction
let request = ProvenTransaction {
Expand Down
4 changes: 2 additions & 2 deletions bin/network-monitor/src/deploy/counter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use miden_protocol::account::{
StorageSlotName,
};
use miden_protocol::utils::sync::LazyLock;
use miden_protocol::{Felt, FieldElement, Word};
use miden_protocol::{Felt, Word};
use miden_standards::code_builder::CodeBuilder;
use miden_standards::testing::account_component::IncrNonceAuthComponent;
use tracing::instrument;
Expand Down Expand Up @@ -54,7 +54,7 @@ pub fn create_counter_account(owner_account_id: AccountId) -> Result<Account> {
let component_code =
CodeBuilder::default().compile_component_code("counter::program", script)?;

let metadata = AccountComponentMetadata::new("counter::program").with_supports_all_types();
let metadata = AccountComponentMetadata::new("counter::program", AccountType::all());
let account_code =
AccountComponent::new(component_code, vec![counter_slot, owner_id_slot], metadata)?;

Expand Down
4 changes: 2 additions & 2 deletions bin/network-monitor/src/deploy/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ use miden_protocol::transaction::{
};
use miden_protocol::{MastForest, Word};
use miden_tx::auth::BasicAuthenticator;
use miden_tx::utils::Serializable;
use miden_tx::utils::serde::Serializable;
use miden_tx::{
DataStore,
DataStoreError,
Expand Down Expand Up @@ -203,7 +203,7 @@ pub async fn deploy_counter_account(counter_account: &Account, rpc_url: &Url) ->

let prover = LocalTransactionProver::default();

let proven_tx = prover.prove(executed_tx).context("Failed to prove transaction")?;
let proven_tx = prover.prove(executed_tx).await.context("Failed to prove transaction")?;

let request = ProvenTransaction {
transaction: proven_tx.to_bytes(),
Expand Down
6 changes: 3 additions & 3 deletions bin/network-monitor/src/deploy/wallet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use anyhow::Result;
use miden_node_utils::crypto::get_rpo_random_coin;
use miden_protocol::account::auth::{AuthScheme, AuthSecretKey};
use miden_protocol::account::{Account, AccountFile, AccountStorageMode, AccountType};
use miden_protocol::crypto::dsa::falcon512_rpo::SecretKey;
use miden_protocol::crypto::dsa::falcon512_poseidon2::SecretKey;
use miden_standards::AuthMethod;
use miden_standards::account::wallets::create_basic_wallet;
use rand::{Rng, SeedableRng};
Expand All @@ -23,7 +23,7 @@ pub fn create_wallet_account() -> Result<(Account, SecretKey)> {
let mut rng = ChaCha20Rng::from_seed(rand::random());
let secret_key = SecretKey::with_rng(&mut get_rpo_random_coin(&mut rng));
let auth = AuthMethod::SingleSig {
approver: (secret_key.public_key().into(), AuthScheme::Falcon512Rpo),
approver: (secret_key.public_key().into(), AuthScheme::Falcon512Poseidon2),
};
let init_seed: [u8; 32] = rng.random();

Expand All @@ -43,7 +43,7 @@ pub fn save_wallet_account(
secret_key: &SecretKey,
file_path: &Path,
) -> Result<()> {
let auth_secret_key = AuthSecretKey::Falcon512Rpo(secret_key.clone());
let auth_secret_key = AuthSecretKey::Falcon512Poseidon2(secret_key.clone());
let account_file = AccountFile::new(account.clone(), vec![auth_secret_key]);
account_file.write(file_path)?;
Ok(())
Expand Down
6 changes: 4 additions & 2 deletions bin/network-monitor/src/remote_prover.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use miden_protocol::note::NoteType;
use miden_protocol::testing::account_id::{ACCOUNT_ID_PUBLIC_FUNGIBLE_FAUCET, ACCOUNT_ID_SENDER};
use miden_protocol::transaction::TransactionInputs;
use miden_testing::{Auth, MockChainBuilder};
use miden_tx::utils::Serializable;
use miden_tx::utils::serde::Serializable;
use serde::{Deserialize, Serialize};
use tokio::sync::watch;
use tokio::time::MissedTickBehavior;
Expand Down Expand Up @@ -278,7 +278,9 @@ pub async fn generate_mock_transaction() -> anyhow::Result<TransactionInputs> {

// Create an account with basic authentication
let account = mock_chain_builder
.add_existing_wallet(Auth::BasicAuth { auth_scheme: AuthScheme::Falcon512Rpo })
.add_existing_wallet(Auth::BasicAuth {
auth_scheme: AuthScheme::Falcon512Poseidon2,
})
.context("Failed to add wallet to mock chain")?;

// Create a fungible asset
Expand Down
2 changes: 1 addition & 1 deletion bin/node/src/commands/bundled.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use miden_node_utils::clap::{GrpcOptionsExternal, StorageOptions};
use miden_node_utils::grpc::UrlExt;
use miden_node_validator::{Validator, ValidatorSigner};
use miden_protocol::crypto::dsa::ecdsa_k256_keccak::SecretKey;
use miden_protocol::utils::Deserializable;
use miden_protocol::utils::serde::Deserializable;
use tokio::net::TcpListener;
use tokio::task::JoinSet;
use url::Url;
Expand Down
2 changes: 1 addition & 1 deletion bin/node/src/commands/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use miden_node_block_producer::{
use miden_node_utils::clap::duration_to_human_readable_string;
use miden_node_validator::ValidatorSigner;
use miden_protocol::crypto::dsa::ecdsa_k256_keccak::SecretKey;
use miden_protocol::utils::Deserializable;
use miden_protocol::utils::serde::Deserializable;
use tokio::net::TcpListener;
use url::Url;

Expand Down
2 changes: 1 addition & 1 deletion bin/node/src/commands/store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use miden_node_utils::clap::{GrpcOptionsInternal, StorageOptions};
use miden_node_utils::fs::ensure_empty_directory;
use miden_node_utils::grpc::UrlExt;
use miden_protocol::block::ProvenBlock;
use miden_protocol::utils::Deserializable;
use miden_protocol::utils::serde::Deserializable;
use url::Url;

use super::{
Expand Down
2 changes: 1 addition & 1 deletion bin/node/src/commands/validator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use miden_node_utils::grpc::UrlExt;
use miden_node_utils::signer::BlockSigner;
use miden_node_validator::{Validator, ValidatorSigner};
use miden_protocol::crypto::dsa::ecdsa_k256_keccak::SecretKey;
use miden_protocol::utils::{Deserializable, Serializable};
use miden_protocol::utils::serde::{Deserializable, Serializable};
use url::Url;

use crate::commands::{
Expand Down
58 changes: 33 additions & 25 deletions bin/remote-prover/src/server/prover.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use miden_protocol::block::BlockProof;
use miden_protocol::transaction::{ProvenTransaction, TransactionInputs};
use miden_tx::LocalTransactionProver;
use miden_tx_batch_prover::LocalBatchProver;
use tracing::instrument;
use tracing::{Instrument, instrument};

use crate::COMPONENT;
use crate::generated::{self as proto};
Expand All @@ -33,11 +33,11 @@ impl Prover {

/// Proves a [`proto::ProofRequest`] using the appropriate prover implementation as specified
/// during construction.
pub fn prove(&self, request: proto::ProofRequest) -> Result<proto::Proof, tonic::Status> {
pub async fn prove(&self, request: proto::ProofRequest) -> Result<proto::Proof, tonic::Status> {
match self {
Prover::Transaction(prover) => prover.prove_request(request),
Prover::Batch(prover) => prover.prove_request(request),
Prover::Block(prover) => prover.prove_request(request),
Prover::Transaction(prover) => prover.prove_request(request).await,
Prover::Batch(prover) => prover.prove_request(request).await,
Prover::Block(prover) => prover.prove_request(request).await,
}
}
}
Expand All @@ -51,30 +51,35 @@ impl Prover {
///
/// Implementations of this trait only need to provide the input and outputs types, as well as the
/// proof implementation.
trait ProveRequest {
type Input: miden_protocol::utils::Deserializable;
type Output: miden_protocol::utils::Serializable;
#[async_trait::async_trait]
trait ProveRequest: Send + Sync {
type Input: miden_protocol::utils::serde::Deserializable + Send;
type Output: miden_protocol::utils::serde::Serializable + Send;

fn prove(&self, input: Self::Input) -> Result<Self::Output, tonic::Status>;
async fn prove(&self, input: Self::Input) -> Result<Self::Output, tonic::Status>;

/// Entry-point to the proof request handling.
///
/// Decodes the request, proves it, and encodes the response.
fn prove_request(&self, request: proto::ProofRequest) -> Result<proto::Proof, tonic::Status> {
Self::decode_request(request)
.and_then(|input| {
// We cannot #[instrument] the trait's prove method because it lacks an
// implementation, so we do it manually.
tracing::info_span!("prove", target = COMPONENT).in_scope(|| {
self.prove(input).inspect_err(|e| tracing::Span::current().set_error(e))
})
})
.map(|output| Self::encode_response(output))
async fn prove_request(
&self,
request: proto::ProofRequest,
) -> Result<proto::Proof, tonic::Status> {
let input = Self::decode_request(request)?;

let prove_span = tracing::info_span!("prove", target = COMPONENT);
let result = self.prove(input).instrument(prove_span).await;

if let Err(e) = &result {
tracing::Span::current().set_error(e);
}

result.map(|output| Self::encode_response(output))
}

#[instrument(target=COMPONENT, skip_all, err)]
fn decode_request(request: proto::ProofRequest) -> Result<Self::Input, tonic::Status> {
use miden_protocol::utils::Deserializable;
use miden_protocol::utils::serde::Deserializable;

Self::Input::read_from_bytes(&request.payload).map_err(|e| {
tonic::Status::invalid_argument(e.as_report_context("failed to decode request"))
Expand All @@ -83,38 +88,41 @@ trait ProveRequest {

#[instrument(target=COMPONENT, skip_all)]
fn encode_response(output: Self::Output) -> proto::Proof {
use miden_protocol::utils::Serializable;
use miden_protocol::utils::serde::Serializable;

proto::Proof { payload: output.to_bytes() }
}
}

#[async_trait::async_trait]
impl ProveRequest for LocalTransactionProver {
type Input = TransactionInputs;
type Output = ProvenTransaction;

fn prove(&self, input: Self::Input) -> Result<Self::Output, tonic::Status> {
self.prove(input).map_err(|e| {
async fn prove(&self, input: Self::Input) -> Result<Self::Output, tonic::Status> {
LocalTransactionProver::prove(self, input).await.map_err(|e| {
tonic::Status::internal(e.as_report_context("failed to prove transaction"))
})
}
}

#[async_trait::async_trait]
impl ProveRequest for LocalBatchProver {
type Input = ProposedBatch;
type Output = ProvenBatch;

fn prove(&self, input: Self::Input) -> Result<Self::Output, tonic::Status> {
async fn prove(&self, input: Self::Input) -> Result<Self::Output, tonic::Status> {
self.prove(input)
.map_err(|e| tonic::Status::internal(e.as_report_context("failed to prove batch")))
}
}

#[async_trait::async_trait]
impl ProveRequest for LocalBlockProver {
type Input = BlockProofRequest;
type Output = BlockProof;

fn prove(&self, input: Self::Input) -> Result<Self::Output, tonic::Status> {
async fn prove(&self, input: Self::Input) -> Result<Self::Output, tonic::Status> {
let BlockProofRequest { tx_batches, block_header, block_inputs } = input;
self.prove(tx_batches, &block_header, block_inputs)
.map_err(|e| tonic::Status::internal(e.as_report_context("failed to prove block")))
Expand Down
9 changes: 1 addition & 8 deletions bin/remote-prover/src/server/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,6 @@ impl proto::api_server::Api for ProverService {
// This mutex is fair and uses FIFO ordering.
let prover = self.acquire_prover().await;

// Blocking in place is fairly safe since we guarantee that only a single request is
// processed at a time.
//
// This has the downside that requests being proven cannot be cancelled since we are now
// outside the async runtime. This could occur if the server timeout is exceeded, or
// the client cancels the request. A different approach is technically possible, but
// would require more complex logic to handle cancellation in tandem with sync.
tokio::task::block_in_place(|| prover.prove(request)).map(tonic::Response::new)
prover.prove(request).await.map(tonic::Response::new)
}
}
Loading
Loading