Skip to content

feat(platform): use provable count sum tree and queries - #2917

Merged
QuantumExplorer merged 8 commits into
feat/platformAddressesfrom
feat/useProvableCountSumTree
Dec 20, 2025
Merged

QuantumExplorer merged 8 commits into
feat/platformAddressesfrom
feat/useProvableCountSumTree

Conversation

@QuantumExplorer

@QuantumExplorer QuantumExplorer commented Dec 20, 2025 •

Copy link
Copy Markdown
Member

Issue being fixed or feature implemented

Adds checkpoint management and provable trunk/branch chunk queries for efficient state synchronization of the address funds tree. This enables clients to sync the platform state in chunks without requiring the full tree, supporting light client and SPV-style verification.

What was done?

Checkpoint Management:

  • Added Checkpoint struct wrapping GroveDB instances with auto-cleanup on drop
  • Implemented update_checkpoints block-end event that creates periodic checkpoints based on configurable intervals
  • Checkpoints stored at db_path/checkpoints/<block_height> with atomic swapping via ArcSwap
  • Added checkpoint loading on Drive initialization

GroveDB Query Enhancements:

  • Added GroveDBToUse enum to select between current DB, latest checkpoint, or specific checkpoint by block height
  • Implemented grove_get_proved_trunk_chunk_query and grove_get_proved_branch_chunk_query operations
  • Added NoCheckpointsAvailable and CheckpointNotFound(u64) error types

Address Funds Chunk Queries:

  • Added prove_address_funds_trunk_query and prove_address_funds_branch_query methods
  • Added corresponding verification methods verify_address_funds_trunk_query and verify_address_funds_branch_query

gRPC Endpoints:

  • Added getAddressesTrunkState endpoint (returns Proof)
  • Added getAddressesBranchState endpoint (takes key + depth, returns raw merk_proof bytes)
  • Added MerkProofVersionedGrpcResponse derive macro for responses with direct merk proof bytes

Platform Version Updates:

  • Added checkpoint parameters (frequency_seconds, num_checkpoints)
  • Added query versions for trunk/branch state endpoints
  • Added grove method versions for chunk query operations

Breaking Changes

None - all changes are additive. New gRPC endpoints and platform version fields are backwards compatible.

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated relevant unit/integration/functional/e2e tests
  • I have added "!" to the title and described breaking changes in the corresponding section if my code contains any
  • I have made corresponding changes to the documentation if needed

For repository code-owners and collaborators only

  • I have assigned this pull request to a milestone

@coderabbitai

coderabbitai Bot commented Dec 20, 2025

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/useProvableCountSumTree

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions

github-actions Bot commented Dec 20, 2025 •

Copy link
Copy Markdown
Contributor

❌ gRPC Query Coverage Report

================================================================================
gRPC Query Coverage Report - NEW QUERIES ONLY
================================================================================

Total queries in proto: 51
Previously known queries: 47
New queries found: 4

================================================================================

New Query Implementation Status:
--------------------------------------------------------------------------------
✓ getAddressInfo                                /home/runner/work/platform/platform/packages/rs-sdk/src/platform/query.rs
✗ getAddressesBranchState                       NOT FOUND
✓ getAddressesInfos                             /home/runner/work/platform/platform/packages/rs-sdk/src/platform/fetch_many.rs
✗ getAddressesTrunkState                        NOT FOUND

================================================================================
Summary:
--------------------------------------------------------------------------------
New queries implemented: 2 (50.0%)
New queries missing: 2 (50.0%)

Total known queries: 51
  - Implemented: 46
  - Not implemented: 4
  - Excluded: 1

Not implemented queries:
  - getAddressesBranchState
  - getAddressesTrunkState
  - getConsensusParams
  - getTokenPreProgrammedDistributions

Missing NEW queries:
  - getAddressesBranchState
  - getAddressesTrunkState

@QuantumExplorer

Copy link
Copy Markdown
Member Author

We will be adding the RS-SDK part of - getAddressesBranchState

  • getAddressesTrunkState in a future PR.

@QuantumExplorer

Copy link
Copy Markdown
Member Author

Self Reviewed

@QuantumExplorer
QuantumExplorer merged commit 69032c9 into feat/platformAddresses Dec 20, 2025
@QuantumExplorer
QuantumExplorer deleted the feat/useProvableCountSumTree branch December 20, 2025 15:27
@thephez thephez added the dapi-endpoint DAPI endpoint addition or modification label Dec 22, 2025
@thephez thephez added this to the v3.0 milestone Dec 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dapi-endpoint DAPI endpoint addition or modification

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants