Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: remove steps from StateSync interface #709

Merged
merged 14 commits into from
Feb 7, 2025
119 changes: 75 additions & 44 deletions Cargo.lock

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

3 changes: 1 addition & 2 deletions bin/miden-cli/src/commands/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ impl SyncCmd {
let new_details = client.sync_state().await?;

println!("State synced to block {}", new_details.block_num);
println!("New public notes: {}", new_details.received_notes.len());
println!("Tracked notes updated: {}", new_details.committed_notes.len());
println!("Committed notes: {}", new_details.committed_notes.len());
println!("Tracked notes consumed: {}", new_details.consumed_notes.len());
println!("Tracked accounts updated: {}", new_details.updated_accounts.len());
println!("Locked accounts: {}", new_details.locked_accounts.len());
Expand Down
7 changes: 6 additions & 1 deletion crates/rust-client/src/account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ impl<R: FeltRng> Client<R> {
// ACCOUNT UPDATES
// ================================================================================================

#[derive(Debug, Clone)]
#[derive(Debug, Clone, Default)]
/// Contains account changes to apply to the store.
pub struct AccountUpdates {
/// Updated public accounts.
Expand Down Expand Up @@ -286,6 +286,11 @@ impl AccountUpdates {
pub fn mismatched_private_accounts(&self) -> &[(AccountId, Digest)] {
&self.mismatched_private_accounts
}

pub fn extend(&mut self, other: AccountUpdates) {
self.updated_public_accounts.extend(other.updated_public_accounts);
self.mismatched_private_accounts.extend(other.mismatched_private_accounts);
}
}

// TESTS
Expand Down
4 changes: 2 additions & 2 deletions crates/rust-client/src/note/import.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ impl<R: FeltRng> Client<R> {
note_record.inclusion_proof_received(inclusion_proof, metadata)?;

if block_height < current_block_num {
let mut current_partial_mmr = self.build_current_partial_mmr(true).await?;
let mut current_partial_mmr = self.build_current_partial_mmr().await?;

let block_header = self
.get_and_store_authenticated_block(block_height, &mut current_partial_mmr)
Expand Down Expand Up @@ -219,7 +219,7 @@ impl<R: FeltRng> Client<R> {

match committed_note_data {
Some((metadata, inclusion_proof)) => {
let mut current_partial_mmr = self.build_current_partial_mmr(true).await?;
let mut current_partial_mmr = self.build_current_partial_mmr().await?;
let block_header = self
.get_and_store_authenticated_block(
inclusion_proof.location().block_num(),
Expand Down
Loading
Loading