Skip to content
Merged
Show file tree
Hide file tree
Changes from 24 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
7900e83
surface NTL fetch errors via SyncSummary instead of failing sync_state
JereSalo Apr 21, 2026
e240a90
surface the inner NoteTransportError message in SyncSummary.ntl_error
JereSalo Apr 21, 2026
ee50832
tighten changelog entry and ntlError docstring
JereSalo Apr 21, 2026
2128f79
split sync_state into on-chain, NTL, and combined methods
JereSalo Apr 22, 2026
81afbaf
simplify sync lock with callback-based API
JereSalo Apr 23, 2026
066bf9e
update transport tests to call sync_note_transport after split
JereSalo Apr 23, 2026
eb087b6
Merge branch 'next' into jere/syncstate-ntl-decouple-1930
JereSalo Apr 23, 2026
7838054
add Node proxy aliases for syncNoteTransport and syncAll
JereSalo Apr 23, 2026
4987e2e
run NTL before chain sync in sync_all
JereSalo Apr 23, 2026
20c4688
allow syncNoteTransportImpl and syncAllImpl in method classification
JereSalo Apr 23, 2026
2d235d2
silence unhandled rejection from sync lock cleanup chain
JereSalo Apr 23, 2026
6561ac3
rename sync timeout error to reflect scope
JereSalo Apr 23, 2026
ac017f1
rename sync_state/sync_all to sync_chain/sync_state with combined def…
JereSalo Apr 23, 2026
6ab4564
restore transport tests to use sync_state
JereSalo Apr 23, 2026
268c5c6
remove timeout parameter from sync methods
JereSalo Apr 23, 2026
a1ead57
drop stale timeout option from MidenClient api types
JereSalo Apr 23, 2026
37c65e1
compress sync split changelog entries into one
JereSalo Apr 23, 2026
8ad4274
regenerate typedoc after removing timeout option
JereSalo Apr 24, 2026
e212878
document sync lock helpers
JereSalo Apr 28, 2026
b22e62d
Merge remote-tracking branch 'origin/next' into jere/syncstate-ntl-de…
JereSalo Apr 29, 2026
e34cc46
reframe sync split changelog entry as enhancement
JereSalo Apr 29, 2026
f0d1b94
trim redundant sync_state line from changelog entry
JereSalo Apr 29, 2026
b33b7f0
Merge branch 'next' into jere/syncstate-ntl-decouple-1930
JereSalo Apr 30, 2026
ab17474
expand sync state documentation
JereSalo May 5, 2026
b9ad816
Merge remote-tracking branch 'origin/next' into jere/syncstate-ntl-de…
JereSalo May 6, 2026
57ea066
Merge remote-tracking branch 'origin/jere/syncstate-ntl-decouple-1930…
JereSalo May 7, 2026
ccb3f4f
link sync_note_transport and sync_chain in sync_state docs
JereSalo May 7, 2026
2e0d1d9
address review feedback on sync docs and surface NTL notes in SyncSum…
JereSalo May 8, 2026
5fe0968
print new_private_notes count in CLI sync command
JereSalo May 8, 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 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

### Enhancements

* [FEATURE][rust] Added `Client::sync_chain()` (on-chain sync only) and `Client::sync_note_transport()` (Note Transport Layer fetch only) for callers needing finer-grained control over sync. ([#2091](https://github.com/0xMiden/miden-client/pull/2091))
* [FEATURE][rust] Added `GrpcClient::with_bearer_auth(token)` to attach an `authorization: Bearer <token>` header to every outbound gRPC call, for use behind authenticating gateways. Tokens are validated at connection time and preserved across `set_genesis_commitment` updates ([#2101](https://github.com/0xMiden/miden-client/pull/2101)).
* Made new-account construction use merged storage schema commitment (`build_with_schema_commitment`), re-exported `AccountBuilderSchemaCommitmentExt`, added WASM `buildWithoutSchemaCommitment()`, and fixed contract `accounts.create()` to require explicit `components` ([#1996](https://github.com/0xMiden/miden-client/pull/1996)).
* Fixed the faucet token symbol display when showing account details ([#1985](https://github.com/0xMiden/miden-client/pull/1985)).
Expand Down
41 changes: 30 additions & 11 deletions crates/rust-client/src/sync/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,12 @@ where
self.store.get_sync_height().await.map_err(Into::into)
}

/// Syncs the client's state with the current state of the Miden network and returns a
/// [`SyncSummary`] corresponding to the local state update.
/// Syncs the client's on-chain state with the current state of the Miden network and returns
/// a [`SyncSummary`] corresponding to the local state update.
///
/// Does **not** fetch private notes from the Note Transport Layer. Use
/// [`Client::sync_state`] for the combined sync, or call [`Client::sync_note_transport`]
/// separately.
///
/// The sync process is done in multiple steps:
/// 1. A request is sent to the node to get the state updates. This request includes tracked
Expand All @@ -119,18 +123,10 @@ where
/// state.
/// 7. The MMR is updated with the new peaks and authentication nodes.
/// 8. All updates are applied to the store to be persisted.
pub async fn sync_state(&mut self) -> Result<SyncSummary, ClientError> {
pub async fn sync_chain(&mut self) -> Result<SyncSummary, ClientError> {
self.ensure_genesis_in_place().await?;
self.ensure_rpc_limits_in_place().await?;

// Note Transport update
// TODO We can run both sync_state, fetch_transport_notes futures in parallel
if self.is_note_transport_enabled() {
let cursor = self.store.get_note_transport_cursor().await?;
let note_tags = self.store.get_unique_note_tags().await?;
self.fetch_transport_notes(cursor, note_tags).await?;
}

// Build sync state components
let note_screener = self.note_screener();
let state_sync = StateSync::new(
Expand Down Expand Up @@ -164,6 +160,29 @@ where
Ok(sync_summary)
}

/// Fetches private notes from the Note Transport Layer for the tracked note tags.
///
/// No-op if note transport is disabled.
pub async fn sync_note_transport(&mut self) -> Result<(), ClientError> {
if !self.is_note_transport_enabled() {
return Ok(());
}

let cursor = self.store.get_note_transport_cursor().await?;
let note_tags = self.store.get_unique_note_tags().await?;
self.fetch_transport_notes(cursor, note_tags).await
}

/// Runs [`Client::sync_note_transport`] followed by [`Client::sync_chain`], failing fast on
/// the first error.
///
/// Note: private notes delivered via NTL are imported before
/// the chain sync reads its input set, so their nullifiers are checked in the same call.
pub async fn sync_state(&mut self) -> Result<SyncSummary, ClientError> {
self.sync_note_transport().await?;
self.sync_chain().await
}
Comment thread
JereSalo marked this conversation as resolved.

/// Builds a default [`StateSyncInput`] from the current client state.
///
/// This includes all tracked account headers, all unique note tags, all unspent input and
Expand Down
Loading