Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
157 changes: 80 additions & 77 deletions Cargo.lock

Large diffs are not rendered by default.

50 changes: 29 additions & 21 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ license = "MIT"
readme = "README.md"
repository = "https://github.com/0xMiden/node"
rust-version = "1.93"
version = "0.15.0-rc.3"
version = "0.15.0"

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

[workspace.dependencies]
# Workspace crates.
miden-large-smt-backend-rocksdb = { path = "crates/large-smt-backend-rocksdb", version = "0.15.0-rc.3" }
miden-node-block-producer = { path = "crates/block-producer", version = "0.15.0-rc.3" }
miden-node-db = { path = "crates/db", version = "0.15.0-rc.3" }
miden-node-grpc-error-macro = { path = "crates/grpc-error-macro", version = "0.15.0-rc.3" }
miden-node-proto = { path = "crates/proto", version = "0.15.0-rc.3" }
miden-node-proto-build = { path = "proto", version = "0.15.0-rc.3" }
miden-node-rpc = { path = "crates/rpc", version = "0.15.0-rc.3" }
miden-node-store = { path = "crates/store", version = "0.15.0-rc.3" }
miden-large-smt-backend-rocksdb = { path = "crates/large-smt-backend-rocksdb", version = "0.15" }
miden-node-block-producer = { path = "crates/block-producer", version = "0.15" }
miden-node-db = { path = "crates/db", version = "0.15" }
miden-node-grpc-error-macro = { path = "crates/grpc-error-macro", version = "0.15" }
miden-node-proto = { path = "crates/proto", version = "0.15" }
miden-node-proto-build = { path = "proto", version = "0.15" }
miden-node-rpc = { path = "crates/rpc", version = "0.15" }
miden-node-store = { path = "crates/store", version = "0.15" }
miden-node-test-macro = { path = "crates/test-macro" }
miden-node-utils = { path = "crates/utils", version = "0.15.0-rc.3" }
miden-remote-prover-client = { path = "crates/remote-prover-client", version = "0.15.0-rc.3" }
miden-node-utils = { path = "crates/utils", version = "0.15" }
miden-remote-prover-client = { path = "crates/remote-prover-client", version = "0.15" }
# 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.15.0-rc.3" }
miden-node-rocksdb-cxx-linkage-fix = { path = "crates/rocksdb-cxx-linkage-fix", version = "0.15" }

# miden-protocol dependencies. These should be updated in sync.
# Requires the v0.15.2 patch release, which carries the network-account tx-script
# allowlist (0xMiden/protocol#3028) and the `with_allowed_notes` rename (#3049).
miden-agglayer = { version = "0.15.2" }
miden-block-prover = { version = "0.15.2" }
miden-protocol = { default-features = false, version = "0.15.2" }
miden-standards = { version = "0.15.2" }
miden-testing = { version = "0.15.2" }
miden-tx = { default-features = false, version = "0.15.2" }
miden-tx-batch-prover = { version = "0.15.2" }
miden-agglayer = { version = "0.16" }
miden-block-prover = { version = "0.16" }
miden-protocol = { default-features = false, version = "0.16" }
miden-standards = { version = "0.16" }
miden-testing = { version = "0.16" }
miden-tx = { default-features = false, version = "0.16" }
miden-tx-batch-prover = { version = "0.16" }

# Other miden dependencies. These should align with those expected by miden-protocol.
miden-crypto = { version = "0.25" }
Expand Down Expand Up @@ -134,6 +132,7 @@ url = { features = ["serde"], version = "2.5" }
[workspace.metadata.cargo-shear]
# libsqlite3-sys is kept to control the bundled SQLite linkage.
# tonic-prost is used by generated gRPC code rather than handwritten Rust.
#
ignored = ["libsqlite3-sys", "tonic-prost"]

# Lints are set to warn for development, which are promoted to errors in CI.
Expand Down Expand Up @@ -161,3 +160,12 @@ files.extend-exclude = [
"*.min.js", # Minified JS bundles (vendored htmx etc.).
"*.svg", # SVG files.
]

[patch.crates-io]
miden-agglayer = { branch = "sergerad-clone", git = "https://github.com/0xmiden/protocol" }
miden-block-prover = { branch = "sergerad-clone", git = "https://github.com/0xmiden/protocol" }
miden-protocol = { branch = "sergerad-clone", git = "https://github.com/0xmiden/protocol" }
miden-standards = { branch = "sergerad-clone", git = "https://github.com/0xmiden/protocol" }
miden-testing = { branch = "sergerad-clone", git = "https://github.com/0xmiden/protocol" }
miden-tx = { branch = "sergerad-clone", git = "https://github.com/0xmiden/protocol" }
miden-tx-batch-prover = { branch = "sergerad-clone", git = "https://github.com/0xmiden/protocol" }
4 changes: 2 additions & 2 deletions bin/genesis/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use anyhow::Context;
use clap::Parser;
use miden_agglayer::create_bridge_account;
use miden_protocol::account::auth::{AuthScheme, AuthSecretKey};
use miden_protocol::account::delta::{AccountStorageDelta, AccountVaultDelta};
use miden_protocol::account::delta::{AccountStoragePatch, AccountVaultDelta};
use miden_protocol::account::{Account, AccountDelta, AccountFile, AccountType};
use miden_protocol::crypto::dsa::falcon512_poseidon2::{self, SecretKey as FalconSecretKey};
use miden_protocol::crypto::rand::RandomCoin;
Expand Down Expand Up @@ -178,7 +178,7 @@ fn resolve_pubkey(
fn bump_nonce_to_one(mut account: Account) -> anyhow::Result<Account> {
let delta = AccountDelta::new(
account.id(),
AccountStorageDelta::default(),
AccountStoragePatch::new(),
AccountVaultDelta::default(),
ONE,
)?;
Expand Down
2 changes: 1 addition & 1 deletion bin/network-monitor/src/deploy/counter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ pub fn create_counter_account(owner_account_id: AccountId) -> Result<Account> {
// tx-script allowlist. This waits on the canonical, frozen expiration script (#3050) so the
// root can be pinned here without duplicating the ntx-builder's script/delta.
let network_account_auth: AccountComponent =
AuthNetworkAccount::with_allowed_notes(allowed_scripts)
AuthNetworkAccount::with_allowlist(allowed_scripts)
.expect("list is not empty")
.into();

Expand Down
1 change: 0 additions & 1 deletion bin/node/src/commands/modes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ impl SequencerCommand {
mempool_tx_capacity: self.block_producer.mempool.tx_capacity,
}
.spawn()
.await
.context("failed to spawn sequencer")?;
let block_producer = sequencer.api();

Expand Down
6 changes: 3 additions & 3 deletions bin/ntx-builder/src/actor/allowlist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ end";
let note = mock_single_target_note(account_id, 10);
let root = note.as_note().script().root();
let account = mock_account_with_auth_component(
AuthNetworkAccount::with_allowed_notes(BTreeSet::from_iter([root]))
AuthNetworkAccount::with_allowlist(BTreeSet::from_iter([root]))
.expect("non-empty allowlist should construct"),
);

Expand All @@ -113,7 +113,7 @@ end";
assert_ne!(allowed_root, rejected_root);

let account = mock_account_with_auth_component(
AuthNetworkAccount::with_allowed_notes(BTreeSet::from_iter([allowed_root]))
AuthNetworkAccount::with_allowlist(BTreeSet::from_iter([allowed_root]))
.expect("non-empty allowlist should construct"),
);

Expand All @@ -138,7 +138,7 @@ end";
assert_ne!(allowed_root, rejected_root);

let account = mock_account_with_auth_component(
AuthNetworkAccount::with_allowed_notes(BTreeSet::from_iter([allowed_root]))
AuthNetworkAccount::with_allowlist(BTreeSet::from_iter([allowed_root]))
.expect("non-empty allowlist should construct"),
);

Expand Down
2 changes: 1 addition & 1 deletion bin/ntx-builder/src/test_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ pub fn mock_network_account_update()
// The allowlist content is irrelevant here; any non-empty set yields a valid network account.
let root = mock_single_target_note(mock_network_account_id(), 1).as_note().script().root();
let account = mock_account_with_auth_component(
AuthNetworkAccount::with_allowed_notes(BTreeSet::from_iter([root]))
AuthNetworkAccount::with_allowlist(BTreeSet::from_iter([root]))
.expect("non-empty allowlist should construct"),
);
let details = AccountUpdateDetails::Delta(
Expand Down
4 changes: 2 additions & 2 deletions bin/stress-test/src/seeding/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use miden_protocol::account::{
AccountComponentMetadata,
AccountDelta,
AccountId,
AccountStorageDelta,
AccountStoragePatch,
AccountType,
AccountVaultDelta,
StorageMap,
Expand Down Expand Up @@ -708,7 +708,7 @@ fn create_existing_account_delta(
vault_delta.add_asset(*asset).unwrap();
}

let mut storage_delta = AccountStorageDelta::new();
let mut storage_delta = AccountStoragePatch::new();
if let Some((storage_update, tx_index)) = storage_update {
if storage_update.storage_map_entries > 0
&& account.storage().get(&benchmark_storage_map_slot()).is_some()
Expand Down
12 changes: 6 additions & 6 deletions bin/stress-test/src/store/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ pub async fn bench_sync_notes(data_directory: PathBuf, iterations: usize, concur
let store_state = start_store(data_directory).await;

// Get the latest block number to determine the range
let chain_tip = store_state.chain_tip(Finality::Committed).await.as_u32();
let chain_tip = store_state.chain_tip(Finality::Committed).as_u32();

// each request will have `ACCOUNTS_PER_SYNC_NOTES` note tags and will be sent with block number
// 0.
Expand Down Expand Up @@ -305,7 +305,7 @@ pub async fn bench_sync_nullifiers(
.collect();

// Get the latest block number to determine the range
let chain_tip = store_state.chain_tip(Finality::Committed).await.as_u32();
let chain_tip = store_state.chain_tip(Finality::Committed).as_u32();

// Get all nullifier prefixes from the store using sync_notes
let mut nullifier_prefixes: Vec<u32> = vec![];
Expand Down Expand Up @@ -439,7 +439,7 @@ pub async fn bench_sync_transactions(
let store_state = start_store(data_directory).await;

// Get the latest block number to determine the range
let chain_tip = store_state.chain_tip(Finality::Committed).await.as_u32();
let chain_tip = store_state.chain_tip(Finality::Committed).as_u32();

// each request will have `accounts_per_request` account ids and will query a range of blocks
let request = |_| {
Expand Down Expand Up @@ -517,7 +517,7 @@ pub async fn sync_transactions(
.sync_transactions(account_ids, BlockNumber::from(block_from)..=BlockNumber::from(block_to))
.await
.unwrap();
let chain_tip = state.chain_tip(Finality::Committed).await;
let chain_tip = state.chain_tip(Finality::Committed);
let response = proto::rpc::SyncTransactionsResponse {
pagination_info: Some(proto::rpc::PaginationInfo {
chain_tip: chain_tip.as_u32(),
Expand Down Expand Up @@ -600,7 +600,7 @@ async fn sync_transactions_paginated(
pub async fn bench_sync_chain_mmr(data_directory: PathBuf, iterations: usize, concurrency: usize) {
let store_state = start_store(data_directory).await;

let chain_tip = store_state.chain_tip(Finality::Committed).await.as_u32();
let chain_tip = store_state.chain_tip(Finality::Committed).as_u32();

let request = |_| {
let state = Arc::clone(&store_state);
Expand Down Expand Up @@ -629,7 +629,7 @@ pub async fn bench_sync_chain_mmr(data_directory: PathBuf, iterations: usize, co
/// - the response.
async fn sync_chain_mmr(state: &Arc<State>, current_client_block_height: u32) -> SyncChainMmrRun {
let start = Instant::now();
let chain_tip = state.chain_tip(Finality::Committed).await;
let chain_tip = state.chain_tip(Finality::Committed);
state
.sync_chain_mmr(BlockNumber::from(current_client_block_height)..=chain_tip)
.await
Expand Down
4 changes: 2 additions & 2 deletions crates/block-producer/src/proof_scheduler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ pub(crate) async fn run(

// Next block number to schedule. Initialized from the proven tip's child so we skip
// already-proven blocks on restart.
let mut next_to_prove = state.chain_tip(Finality::Proven).await.child();
let mut next_to_prove = state.chain_tip(Finality::Proven).child();

// Completed proofs waiting to be committed in order.
let mut pending: BTreeMap<BlockNumber, Vec<u8>> = BTreeMap::new();
Expand All @@ -135,7 +135,7 @@ pub(crate) async fn run(

// Drain completed proofs in ascending order so the proven tip advances without
// gaps.
let mut next = state.chain_tip(Finality::Proven).await.child();
let mut next = state.chain_tip(Finality::Proven).child();
while let Some(proof_bytes) = pending.remove(&next) {
state.apply_proof(next, proof_bytes).await?;
next = next.child();
Expand Down
4 changes: 2 additions & 2 deletions crates/block-producer/src/rpc_sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ impl BlockSync {
}

async fn sync(&self) -> anyhow::Result<()> {
let block_from = self.state.chain_tip(Finality::Committed).await.child().as_u32();
let block_from = self.state.chain_tip(Finality::Committed).child().as_u32();
info!(block_from, "Connecting to upstream RPC for blocks");

let mut client = self.source_rpc.clone();
Expand Down Expand Up @@ -121,7 +121,7 @@ impl ProofSync {

async fn sync(&self) -> anyhow::Result<()> {
// Subscribe from next proven tip.
let starting_block = self.state.chain_tip(Finality::Proven).await.child().as_u32();
let starting_block = self.state.chain_tip(Finality::Proven).child().as_u32();
info!(starting_block, "Connecting to upstream RPC for proofs");
let mut client = self.source_rpc.clone();
let mut stream = client
Expand Down
6 changes: 3 additions & 3 deletions crates/block-producer/src/server/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,11 @@ pub struct Sequencer {

impl Sequencer {
/// Spawns the sequencer tasks and returns its in-process API.
pub async fn spawn(self) -> Result<SequencerHandle> {
pub fn spawn(self) -> Result<SequencerHandle> {
info!(target: COMPONENT, "Initializing sequencer");
let store = self.store;
let validator = BlockProducerValidatorClient::new(self.validator_url.clone());
let chain_tip = store.chain_tip(Finality::Committed).await;
let chain_tip = store.chain_tip(Finality::Committed);

info!(target: COMPONENT, "Sequencer initialized");

Expand Down Expand Up @@ -159,7 +159,7 @@ impl Sequencer {
/// Executes in place (i.e. not spawned) and will run indefinitely until a fatal error is
/// encountered.
pub async fn serve(self) -> anyhow::Result<()> {
self.spawn().await?.wait().await
self.spawn()?.wait().await
}
}

Expand Down
1 change: 0 additions & 1 deletion crates/block-producer/src/server/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ async fn block_producer_starts_with_store_state() {
mempool_tx_capacity: NonZeroUsize::new(100).unwrap(),
}
.spawn()
.await
.unwrap();

let status = block_producer.api().status().await;
Expand Down
2 changes: 1 addition & 1 deletion crates/block-producer/src/store/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ pub async fn get_tx_inputs(
return Err(StoreError::DuplicateAccountIdPrefix(proven_tx.account_id()));
}

let current_block_height = state.chain_tip(Finality::Committed).await;
let current_block_height = state.chain_tip(Finality::Committed);
let tx_inputs = TransactionInputs::from_store_inputs(
proven_tx.account_id(),
store_inputs,
Expand Down
16 changes: 8 additions & 8 deletions crates/rpc/src/server/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ impl api_server::Api for RpcService {
block_num: nullifier_info.block_num.as_u32(),
})
.collect();
let chain_tip = self.store.chain_tip(Finality::Committed).await;
let chain_tip = self.store.chain_tip(Finality::Committed);

Ok(Response::new(proto::rpc::SyncNullifiersResponse {
pagination_info: Some(proto::rpc::PaginationInfo {
Expand Down Expand Up @@ -397,9 +397,9 @@ impl api_server::Api for RpcService {
let current_client_block_height = BlockNumber::from(request.current_client_block_height);
let sync_target = match request.finality_level() {
proto::rpc::FinalityLevel::Committed | proto::rpc::FinalityLevel::Unspecified => {
self.store.chain_tip(Finality::Committed).await
self.store.chain_tip(Finality::Committed)
},
proto::rpc::FinalityLevel::Proven => self.store.chain_tip(Finality::Proven).await,
proto::rpc::FinalityLevel::Proven => self.store.chain_tip(Finality::Proven),
};

if current_client_block_height > sync_target {
Expand Down Expand Up @@ -500,7 +500,7 @@ impl api_server::Api for RpcService {
let block_range = range
.into_inclusive_range::<RpcInvalidBlockRange>()
.map_err(invalid_block_range_to_status)?;
let chain_tip = self.store.chain_tip(Finality::Committed).await;
let chain_tip = self.store.chain_tip(Finality::Committed);
if *block_range.end() > chain_tip {
return Err(Status::invalid_argument(format!(
"block_to ({}) is greater than chain tip ({chain_tip})",
Expand Down Expand Up @@ -612,7 +612,7 @@ impl api_server::Api for RpcService {
block_num: map_value.block_num.as_u32(),
})
.collect();
let chain_tip = self.store.chain_tip(Finality::Committed).await;
let chain_tip = self.store.chain_tip(Finality::Committed);

Ok(Response::new(proto::rpc::SyncAccountStorageMapsResponse {
pagination_info: Some(proto::rpc::PaginationInfo {
Expand Down Expand Up @@ -663,7 +663,7 @@ impl api_server::Api for RpcService {
}
})
.collect();
let chain_tip = self.store.chain_tip(Finality::Committed).await;
let chain_tip = self.store.chain_tip(Finality::Committed);

Ok(Response::new(proto::rpc::SyncAccountVaultResponse {
pagination_info: Some(proto::rpc::PaginationInfo {
Expand Down Expand Up @@ -973,7 +973,7 @@ impl api_server::Api for RpcService {
.map_err(|err| database_error_to_status(&err))?;
let transactions =
transaction_records_db.into_iter().map(transaction_record_to_proto).collect();
let chain_tip = self.store.chain_tip(Finality::Committed).await;
let chain_tip = self.store.chain_tip(Finality::Committed);

Ok(Response::new(proto::rpc::SyncTransactionsResponse {
pagination_info: Some(proto::rpc::PaginationInfo {
Expand Down Expand Up @@ -1005,7 +1005,7 @@ impl api_server::Api for RpcService {

Ok(Response::new(proto::rpc::RpcStatus {
version: env!("CARGO_PKG_VERSION").to_string(),
chain_tip: self.store.chain_tip(Finality::Committed).await.as_u32(),
chain_tip: self.store.chain_tip(Finality::Committed).as_u32(),
block_producer: block_producer_status.or(Some(proto::rpc::BlockProducerStatus {
status: "unreachable".to_string(),
version: "-".to_string(),
Expand Down
Loading