Skip to content
Merged
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
- Data directory is no longer created but is instead expected to exist.
- The genesis block can no longer be configured which also removes the `store dump-genesis` command.
- [BREAKING] Use `AccountTree` and update account witness proto definitions (#783).
- [BREAKING] Update name of `ChainMmr` to `PartialBlockChain` (#807).

## v0.8.0 (2025-03-26)

Expand Down
12 changes: 6 additions & 6 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,17 @@ assert_matches = { version = "1.5" }
http = { version = "1.3" }
itertools = { version = "0.14" }
miden-air = { version = "0.13" }
miden-lib = { git = "https://github.com/0xPolygonMiden/miden-base.git", branch = "next" }
miden-lib = { git = "https://github.com/0xPolygonMiden/miden-base.git", branch = "pgackst-partial-blockchain" }
miden-node-block-producer = { path = "crates/block-producer", version = "0.9" }
miden-node-proto = { path = "crates/proto", version = "0.9" }
miden-node-proto-build = { path = "proto", version = "0.9" }
miden-node-rpc = { path = "crates/rpc", version = "0.9" }
miden-node-store = { path = "crates/store", version = "0.9" }
miden-node-test-macro = { path = "crates/test-macro" }
miden-node-utils = { path = "crates/utils", version = "0.9" }
miden-objects = { git = "https://github.com/0xPolygonMiden/miden-base.git", branch = "next" }
miden-objects = { git = "https://github.com/0xPolygonMiden/miden-base.git", branch = "pgackst-partial-blockchain" }
miden-processor = { version = "0.13" }
miden-tx = { git = "https://github.com/0xPolygonMiden/miden-base.git", branch = "next" }
miden-tx = { git = "https://github.com/0xPolygonMiden/miden-base.git", branch = "pgackst-partial-blockchain" }
prost = { version = "0.13" }
rand = { version = "0.9" }
thiserror = { version = "2.0", default-features = false }
Expand Down
14 changes: 7 additions & 7 deletions bin/faucet/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use miden_objects::{
},
note::{Note, NoteType},
transaction::{
ChainMmr, ExecutedTransaction, ForeignAccountInputs, InputNote, InputNotes,
ExecutedTransaction, ForeignAccountInputs, InputNote, InputNotes, PartialBlockChain,
TransactionArgs, TransactionScript,
},
utils::Deserializable,
Expand Down Expand Up @@ -61,7 +61,7 @@ impl FaucetClient {
/// If the faucet account is not found on chain, it will be created on submission of the first
/// minting transaction.
pub async fn new(config: &FaucetConfig) -> Result<Self, ClientError> {
let (mut rpc_api, root_block_header, root_chain_mmr) =
let (mut rpc_api, root_block_header, root_partial_block_chain) =
initialize_faucet_client(config).await?;

let faucet_account_data = AccountFile::read(&config.faucet_account_path)
Expand Down Expand Up @@ -98,7 +98,7 @@ impl FaucetClient {
faucet_account,
faucet_account_data.account_seed,
root_block_header,
root_chain_mmr,
root_partial_block_chain,
));

let public_key = match &faucet_account_data.auth_secret_key {
Expand Down Expand Up @@ -209,7 +209,7 @@ impl FaucetClient {
/// Initializes the faucet client by connecting to the node and fetching the root block header.
pub async fn initialize_faucet_client(
config: &FaucetConfig,
) -> Result<(ApiClient<Channel>, BlockHeader, ChainMmr), ClientError> {
) -> Result<(ApiClient<Channel>, BlockHeader, PartialBlockChain), ClientError> {
let endpoint = tonic::transport::Endpoint::try_from(config.node_url.to_string())
.context("Failed to parse node URL from configuration file")?
.timeout(Duration::from_millis(config.timeout_ms));
Expand All @@ -232,15 +232,15 @@ pub async fn initialize_faucet_client(

let root_block_header = root_block_header.try_into().context("Failed to parse block header")?;

let root_chain_mmr = ChainMmr::new(
let root_partial_block_chain = PartialBlockChain::new(
PartialMmr::from_peaks(
MmrPeaks::new(0, Vec::new()).expect("Empty MmrPeak should be valid"),
),
Vec::new(),
)
.expect("Empty ChainMmr should be valid");
.expect("Empty PartialBlockChain should be valid");

Ok((rpc_api, root_block_header, root_chain_mmr))
Ok((rpc_api, root_block_header, root_partial_block_chain))
}

/// Requests account state from the node.
Expand Down
12 changes: 6 additions & 6 deletions bin/faucet/src/store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use miden_objects::{
MastForest, Word,
account::{Account, AccountId},
block::{BlockHeader, BlockNumber},
transaction::{ChainMmr, TransactionScript},
transaction::{PartialBlockChain, TransactionScript},
};
use miden_tx::{DataStore, DataStoreError, MastForestStore, TransactionMastStore};

Expand All @@ -13,7 +13,7 @@ pub struct FaucetDataStore {
/// Optional initial seed used for faucet account creation.
init_seed: Option<Word>,
block_header: BlockHeader,
chain_mmr: ChainMmr,
partial_block_chain: PartialBlockChain,
mast_store: TransactionMastStore,
}

Expand All @@ -25,7 +25,7 @@ impl FaucetDataStore {
faucet_account: Account,
init_seed: Option<Word>,
block_header: BlockHeader,
chain_mmr: ChainMmr,
partial_block_chain: PartialBlockChain,
) -> Self {
let mast_store = TransactionMastStore::new();
mast_store.insert(faucet_account.code().mast());
Expand All @@ -34,7 +34,7 @@ impl FaucetDataStore {
faucet_account: Mutex::new(faucet_account),
init_seed,
block_header,
chain_mmr,
partial_block_chain,
mast_store,
}
}
Expand Down Expand Up @@ -63,7 +63,7 @@ impl DataStore for FaucetDataStore {
&self,
account_id: AccountId,
_ref_blocks: BTreeSet<BlockNumber>,
) -> Result<(Account, Option<Word>, BlockHeader, ChainMmr), DataStoreError> {
) -> Result<(Account, Option<Word>, BlockHeader, PartialBlockChain), DataStoreError> {
let account = self.faucet_account.lock().expect("Poisoned lock");
if account_id != account.id() {
return Err(DataStoreError::AccountNotFound(account_id));
Expand All @@ -73,7 +73,7 @@ impl DataStore for FaucetDataStore {
account.clone(),
account.is_new().then_some(self.init_seed).flatten(),
self.block_header.clone(),
self.chain_mmr.clone(),
self.partial_block_chain.clone(),
))
}
}
Expand Down
2 changes: 1 addition & 1 deletion bin/stress-test/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ workspace = true
clap = { version = "4.5", features = ["derive"] }
futures = { version = "0.3" }
miden-air = { workspace = true }
miden-block-prover = { git = "https://github.com/0xPolygonMiden/miden-base.git", branch = "next", features = [
miden-block-prover = { git = "https://github.com/0xPolygonMiden/miden-base.git", branch = "pgackst-partial-blockchain", features = [
"testing",
] }
miden-lib = { workspace = true }
Expand Down
6 changes: 3 additions & 3 deletions crates/block-producer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,18 @@ anyhow = { workspace = true }
async-trait = { version = "0.1" }
futures = { version = "0.3" }
itertools = { workspace = true }
miden-block-prover = { git = "https://github.com/0xPolygonMiden/miden-base.git", branch = "next" }
miden-block-prover = { git = "https://github.com/0xPolygonMiden/miden-base.git", branch = "pgackst-partial-blockchain" }
miden-lib = { workspace = true }
miden-node-proto = { workspace = true }
miden-node-utils = { workspace = true }
miden-objects = { workspace = true }
miden-processor = { workspace = true }
miden-proving-service-client = { git = "https://github.com/0xPolygonMiden/miden-base.git", branch = "next", features = [
miden-proving-service-client = { git = "https://github.com/0xPolygonMiden/miden-base.git", branch = "pgackst-partial-blockchain", features = [
"batch-prover",
"block-prover",
] }
miden-tx = { workspace = true }
miden-tx-batch-prover = { git = "https://github.com/0xPolygonMiden/miden-base.git", branch = "next" }
miden-tx-batch-prover = { git = "https://github.com/0xPolygonMiden/miden-base.git", branch = "pgackst-partial-blockchain" }
rand = { version = "0.9" }
thiserror = { workspace = true }
tokio = { workspace = true, features = ["macros", "net", "rt-multi-thread", "sync", "time"] }
Expand Down
2 changes: 1 addition & 1 deletion crates/block-producer/src/batch_builder/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ impl BatchJob {
ProposedBatch::new(
transactions,
inputs.batch_reference_block_header,
inputs.chain_mmr,
inputs.partial_block_chain,
inputs.note_proofs,
)
.map_err(BuildBatchError::ProposeBatchError)
Expand Down
19 changes: 12 additions & 7 deletions crates/block-producer/src/test_utils/store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,17 @@ pub struct MockStoreSuccessBuilder {
impl MockStoreSuccessBuilder {
pub fn from_batches<'a>(batches_iter: impl Iterator<Item = &'a ProvenBatch> + Clone) -> Self {
let accounts_smt = {
let accounts = batches_iter.clone().flat_map(|batch| {
batch
.account_updates()
.iter()
.map(|(account_id, update)| (*account_id, update.initial_state_commitment()))
});
// We have to allocate the vector so we can call AccountTree::with_entries with an
// ExactSizeIterator.
let accounts = batches_iter
.clone()
.flat_map(|batch| {
batch.account_updates().iter().map(|(account_id, update)| {
(*account_id, update.initial_state_commitment())
})
})
.collect::<Vec<_>>();

AccountTree::with_entries(accounts).unwrap()
};

Expand All @@ -54,7 +59,7 @@ impl MockStoreSuccessBuilder {
}
}

pub fn from_accounts(accounts: impl Iterator<Item = (AccountId, Digest)>) -> Self {
pub fn from_accounts(accounts: impl ExactSizeIterator<Item = (AccountId, Digest)>) -> Self {
let accounts_smt = AccountTree::with_entries(accounts).unwrap();

Self {
Expand Down
12 changes: 7 additions & 5 deletions crates/proto/src/domain/batch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::collections::BTreeMap;
use miden_objects::{
block::BlockHeader,
note::{NoteId, NoteInclusionProof},
transaction::ChainMmr,
transaction::PartialBlockChain,
utils::{Deserializable, Serializable},
};

Expand All @@ -17,15 +17,15 @@ use crate::{
pub struct BatchInputs {
pub batch_reference_block_header: BlockHeader,
pub note_proofs: BTreeMap<NoteId, NoteInclusionProof>,
pub chain_mmr: ChainMmr,
pub partial_block_chain: PartialBlockChain,
}

impl From<BatchInputs> for proto::GetBatchInputsResponse {
fn from(inputs: BatchInputs) -> Self {
Self {
batch_reference_block_header: Some(inputs.batch_reference_block_header.into()),
note_proofs: inputs.note_proofs.iter().map(Into::into).collect(),
chain_mmr: inputs.chain_mmr.to_bytes(),
partial_block_chain: inputs.partial_block_chain.to_bytes(),
}
}
}
Expand All @@ -44,8 +44,10 @@ impl TryFrom<proto::GetBatchInputsResponse> for BatchInputs {
.iter()
.map(<(NoteId, NoteInclusionProof)>::try_from)
.collect::<Result<_, ConversionError>>()?,
chain_mmr: ChainMmr::read_from_bytes(&response.chain_mmr)
.map_err(|source| ConversionError::deserialization_error("ChainMmr", source))?,
partial_block_chain: PartialBlockChain::read_from_bytes(&response.partial_block_chain)
.map_err(|source| {
ConversionError::deserialization_error("PartialBlockChain", source)
})?,
};

Ok(result)
Expand Down
14 changes: 8 additions & 6 deletions crates/proto/src/domain/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::collections::BTreeMap;
use miden_objects::{
block::{BlockHeader, BlockInputs, NullifierWitness},
note::{NoteId, NoteInclusionProof},
transaction::ChainMmr,
transaction::PartialBlockChain,
utils::{Deserializable, Serializable},
};

Expand Down Expand Up @@ -101,7 +101,7 @@ impl From<BlockInputs> for GetBlockInputsResponse {
fn from(inputs: BlockInputs) -> Self {
let (
prev_block_header,
chain_mmr,
partial_block_chain,
account_witnesses,
nullifier_witnesses,
unauthenticated_note_proofs,
Expand All @@ -120,7 +120,7 @@ impl From<BlockInputs> for GetBlockInputsResponse {
NullifierWitnessRecord { nullifier, proof }.into()
})
.collect(),
chain_mmr: chain_mmr.to_bytes(),
partial_block_chain: partial_block_chain.to_bytes(),
unauthenticated_note_proofs: unauthenticated_note_proofs
.iter()
.map(NoteInclusionInBlockProof::from)
Expand Down Expand Up @@ -162,12 +162,14 @@ impl TryFrom<GetBlockInputsResponse> for BlockInputs {
.map(<(NoteId, NoteInclusionProof)>::try_from)
.collect::<Result<_, ConversionError>>()?;

let chain_mmr = ChainMmr::read_from_bytes(&response.chain_mmr)
.map_err(|source| ConversionError::deserialization_error("ChainMmr", source))?;
let partial_block_chain = PartialBlockChain::read_from_bytes(&response.partial_block_chain)
.map_err(|source| {
ConversionError::deserialization_error("PartialBlockChain", source)
})?;

Ok(BlockInputs::new(
latest_block_header,
chain_mmr,
partial_block_chain,
account_witnesses,
nullifier_witnesses,
unauthenticated_note_proofs,
Expand Down
4 changes: 2 additions & 2 deletions crates/proto/src/generated/responses.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ pub struct GetBlockInputsResponse {
/// above note inclusion proofs as well as proofs for inclusion of the requested blocks
/// referenced by the batches in the block.
#[prost(bytes = "vec", tag = "3")]
pub chain_mmr: ::prost::alloc::vec::Vec<u8>,
pub partial_block_chain: ::prost::alloc::vec::Vec<u8>,
/// The state commitments of the requested accounts and their authentication paths.
#[prost(message, repeated, tag = "4")]
pub account_witnesses: ::prost::alloc::vec::Vec<AccountWitness>,
Expand All @@ -146,7 +146,7 @@ pub struct GetBatchInputsResponse {
/// above note inclusion proofs as well as proofs for inclusion of the blocks referenced
/// by the transactions in the batch.
#[prost(bytes = "vec", tag = "3")]
pub chain_mmr: ::prost::alloc::vec::Vec<u8>,
pub partial_block_chain: ::prost::alloc::vec::Vec<u8>,
}
/// An account returned as a response to the `GetTransactionInputs`.
#[derive(Clone, PartialEq, ::prost::Message)]
Expand Down
Loading
Loading