Skip to content

feat/db: paged loading of nullifiers and account commitments#1536

Merged
drahnr merged 19 commits intonextfrom
bernhard-startup-build-rocksdb-paged-queries
Feb 2, 2026
Merged

feat/db: paged loading of nullifiers and account commitments#1536
drahnr merged 19 commits intonextfrom
bernhard-startup-build-rocksdb-paged-queries

Conversation

@drahnr
Copy link
Contributor

@drahnr drahnr commented Jan 19, 2026

Addresses performance and memory constraints in #1534 when loading AccountTree and NullifierTree.

Changes

  • Introduces fn select_account_commitments_paged
  • Introduce fn select_all_nullifiers_paged

Open Questions

  • Shall we remove the non-paged versions? My intuition is yes
  • Shall we rename the _paged ones to suffix less? Also yes

@drahnr drahnr force-pushed the bernhard-startup-build-and-rebuild-rocksdb branch 2 times, most recently from a4f0119 to 24b0977 Compare January 20, 2026 13:05
Base automatically changed from bernhard-startup-build-and-rebuild-rocksdb to next January 20, 2026 14:09
@drahnr drahnr force-pushed the bernhard-startup-build-rocksdb-paged-queries branch from 9f4e15c to 847e701 Compare January 21, 2026 09:49
@drahnr drahnr marked this pull request as ready for review January 21, 2026 14:24
@drahnr drahnr requested review from Mirko-von-Leipzig and bobbinth and removed request for Mirko-von-Leipzig January 21, 2026 14:29
Comment on lines +141 to +143
if page.commitments.is_empty() {
break;
}
Copy link
Collaborator

@Mirko-von-Leipzig Mirko-von-Leipzig Jan 22, 2026

Choose a reason for hiding this comment

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

Nit: is this strictly necessary? Applying an empty set if probably close to a no-op I imagine, and we'll exit because cursor.is_none().

Mostly just a style thing but I'd prefer one exit if possible. Similar below.

Comment on lines +185 to +187
if let Some(cursor) = after_nullifier {
query = query.filter(schema::nullifiers::nullifier.gt(cursor.to_bytes()));
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nit: probably quicker to just after_nullifier.unwrap_or_default() since it will cache the statement on the next call 😁

Copy link
Collaborator

@Mirko-von-Leipzig Mirko-von-Leipzig Jan 22, 2026

Choose a reason for hiding this comment

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

Ah nvm I see you're using after and not next as the token.

Copy link
Contributor Author

@drahnr drahnr Jan 23, 2026

Choose a reason for hiding this comment

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

Ah nvm I see you're using after and not next as the token.

I don't think there is a difference?

after_nullifier.unwrap_or_default()

This only works for an asc sorting and the implicit all-zeros nullifier. I don't like the implicitness.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Revisiting, there is a small delta in what the cursor means, and I think we should unify eventually.

@bobbinth
Copy link
Contributor

There seem to be some small merge conflicts. @drahnr - could you resolve them when you get a chance?

@drahnr drahnr merged commit f035ce4 into next Feb 2, 2026
7 checks passed
@drahnr drahnr deleted the bernhard-startup-build-rocksdb-paged-queries branch February 2, 2026 15:16
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.

3 participants