Skip to content

refactor: optimize historical note retrieval#2285

Open
juan518munoz wants to merge 11 commits into
nextfrom
jmunoz-optimize-historical-note-retrieval
Open

refactor: optimize historical note retrieval#2285
juan518munoz wants to merge 11 commits into
nextfrom
jmunoz-optimize-historical-note-retrieval

Conversation

@juan518munoz

Copy link
Copy Markdown
Collaborator

Notable changes:

  • Removes the manual Client::fetch_all_private_notes and replaces it with an automatic per tag backfill, so consumers no longer have to fetch history themselves after they start tracking a new tag.
  • The automatic backfill runs on every sync. Notes related to a newly tracked tag are fetched the first time it becomes tracked (after add_note_tag, an account import, or an address creation).
  • The client keeps track of already covered tags, by storing them in the settings table under note_transport_covered_tags.

Note:

This branch cherry-picks the NTL 0.4.1 upgrade from #2264, as PR landed on main and next does not have it yet, so its three commits are replayed here because the backfill depends on 0.4.1 (the block_hint delivery path).

Closes #2258

Comment thread crates/rust-client/src/sync/mod.rs Outdated
Comment thread CHANGELOG.md

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some of the entries here seem to be duplicated, like the one of send_private_note_with_block_hint and also the bump of miden-note-transport-proto-build to 0.4.1.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in the latest merge to next.

Ok(ids)
imported_ids.extend(ids);

Ok(imported_ids)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thinking out loud: should we dedup this before returning it? As there might be overlap between imported_ids of the backfill and the fetched ones in ids? Probably harmless to keep it as-is though.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the suggestion, applied in cea92e0

@juan518munoz
juan518munoz requested a review from gabrielbosio July 8, 2026 13:06

@SantiagoPittella SantiagoPittella left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, would be nice a test with exceeding MAX_BACKFILL_TAGS_PER_SYNC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove fetch_all_private_notes

4 participants