Skip to content

Conversation

@pauldelucia
Copy link
Member

@pauldelucia pauldelucia commented Jan 8, 2026

Issue being fixed or feature implemented

We need the checkpoint height at which the addresses are synced up to so we can do the subsequent queries from there.

What was done?

Add checkpoint height to AddressSyncResult and return it from sync_address_balances after taking it from execute_trunk_query.

How Has This Been Tested?

DET

Breaking Changes

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

Summary by CodeRabbit

Release Notes

  • New Features
    • Address synchronization now captures and stores checkpoint height information from query operations, enhancing synchronization state tracking capabilities.

✏️ Tip: You can customize this high-level summary in your review settings.

@github-actions github-actions bot added this to the v3.0.0 milestone Jan 8, 2026
@github-actions
Copy link

github-actions bot commented Jan 8, 2026

✅ gRPC Query Coverage Report

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

Total queries in proto: 53
Previously known queries: 47
New queries found: 6

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

New Query Implementation Status:
--------------------------------------------------------------------------------
✓ getAddressInfo                                /home/runner/work/platform/platform/packages/rs-sdk/src/platform/query.rs
✓ getAddressesBranchState                       /home/runner/work/platform/platform/packages/rs-sdk/src/platform/address_sync/mod.rs
✓ getAddressesInfos                             /home/runner/work/platform/platform/packages/rs-sdk/src/platform/fetch_many.rs
✓ getAddressesTrunkState                        /home/runner/work/platform/platform/packages/rs-sdk/src/platform/address_sync/mod.rs
✓ getRecentAddressBalanceChanges                /home/runner/work/platform/platform/packages/rs-sdk/src/platform/query.rs
✓ getRecentCompactedAddressBalanceChanges       /home/runner/work/platform/platform/packages/rs-sdk/src/platform/query.rs

================================================================================
Summary:
--------------------------------------------------------------------------------
New queries implemented: 6 (100.0%)
New queries missing: 0 (0.0%)

Total known queries: 53
  - Implemented: 50
  - Not implemented: 2
  - Excluded: 1

Not implemented queries:
  - getConsensusParams
  - getTokenPreProgrammedDistributions

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 8, 2026

📝 Walkthrough

Walkthrough

Adds a new checkpoint_height field to the AddressSyncResult struct to capture checkpoint data from trunk queries. The field is initialized to zero and populated from query results without altering existing control flow.

Changes

Cohort / File(s) Summary
AddressSyncResult enhancement
packages/rs-sdk/src/platform/address_sync/types.rs, packages/rs-sdk/src/platform/address_sync/mod.rs
Added public field checkpoint_height: u64 to struct definition with documentation; initialized to 0 in constructor; populated from trunk query result in sync operation

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~5 minutes

Poem

🐰 A checkpoint stored, so neat and clean,
Heights captured in our sync machine,
One field added, just zero to start,
Trunk queries now play their vital part!
Hop hop, the data flows true! 🌾

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically summarizes the main change: adding a checkpoint height field to AddressSyncResult and returning it.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

📜 Recent review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a0f66ab and 39bca54.

📒 Files selected for processing (2)
  • packages/rs-sdk/src/platform/address_sync/mod.rs
  • packages/rs-sdk/src/platform/address_sync/types.rs
🧰 Additional context used
📓 Path-based instructions (1)
**/*.rs

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.rs: Rust code must pass cargo clippy --workspace linter checks
Rust code must be formatted using cargo fmt --all

**/*.rs: Use 4-space indent for Rust files
Follow rustfmt defaults and keep code clippy-clean for Rust modules
Use snake_case for Rust module names
Use PascalCase for Rust type names
Use SCREAMING_SNAKE_CASE for Rust constants

Files:

  • packages/rs-sdk/src/platform/address_sync/types.rs
  • packages/rs-sdk/src/platform/address_sync/mod.rs
🧠 Learnings (2)
📚 Learning: 2024-10-18T15:43:32.447Z
Learnt from: lklimek
Repo: dashpay/platform PR: 2254
File: packages/rs-sdk/src/sdk.rs:654-658
Timestamp: 2024-10-18T15:43:32.447Z
Learning: In `packages/rs-sdk/src/sdk.rs`, within the `verify_metadata_height` function, when using `compare_exchange` on `last_seen_height`, it's acceptable to use `Ordering::Relaxed` for the failure ordering, as any inconsistency would only trigger an extra loop iteration without affecting correctness.

Applied to files:

  • packages/rs-sdk/src/platform/address_sync/types.rs
  • packages/rs-sdk/src/platform/address_sync/mod.rs
📚 Learning: 2024-10-08T13:28:03.529Z
Learnt from: QuantumExplorer
Repo: dashpay/platform PR: 2227
File: packages/rs-drive-abci/src/platform_types/platform_state/mod.rs:141-141
Timestamp: 2024-10-08T13:28:03.529Z
Learning: When converting `PlatformStateV0` to `PlatformStateForSavingV1` in `packages/rs-drive-abci/src/platform_types/platform_state/mod.rs`, only version `0` needs to be handled in the match on `platform_state_for_saving_structure_default` because the changes are retroactive.

Applied to files:

  • packages/rs-sdk/src/platform/address_sync/mod.rs
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
  • GitHub Check: Rust packages (dash-sdk) / Check each feature
  • GitHub Check: Build rs-sdk-ffi for iOS targets (aarch64-apple-ios)
  • GitHub Check: Build rs-sdk-ffi for iOS targets (aarch64-apple-ios-sim)
  • GitHub Check: Build Docker images (RS-DAPI, rs-dapi, rs-dapi) / Build RS-DAPI image
  • GitHub Check: Build Docker images (Drive, drive, drive-abci, SDK_TEST_DATA=true
    ) / Build Drive image
  • GitHub Check: Build JS packages / Build JS
🔇 Additional comments (4)
packages/rs-sdk/src/platform/address_sync/types.rs (2)

78-82: LGTM! Well-documented field addition.

The checkpoint_height field is clearly documented and appropriately typed. The documentation explains its purpose for subsequent queries, which aligns with the PR objectives.


93-93: LGTM! Proper field initialization.

Initializing checkpoint_height to 0 is appropriate here. The value is always populated from the trunk query metadata before being returned (line 118 in mod.rs), and if the trunk query fails, an error is returned rather than a result with a zero checkpoint.

packages/rs-sdk/src/platform/address_sync/mod.rs (2)

117-118: LGTM! Clean checkpoint height capture.

The checkpoint height is properly extracted from the trunk query and immediately stored in the result. This ensures the value is available for both internal use (branch queries at line 171) and external callers who need to continue syncing from this checkpoint.


250-250: LGTM! Checkpoint height properly sourced from metadata.

The checkpoint height is correctly extracted from the proof metadata, ensuring it reflects the actual blockchain height at which the trunk state was captured. This follows the standard SDK pattern for proof verification.


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.

@QuantumExplorer QuantumExplorer merged commit 0fdac51 into v3.0-dev Jan 8, 2026
42 of 44 checks passed
@QuantumExplorer QuantumExplorer deleted the feat/returnCheckpointHeight branch January 8, 2026 08:08
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.

4 participants