Repository navigation
feat(drive): add paginated fetch_contract_ids and fetch_contracts - #3480
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✅ Files skipped from review due to trivial changes (1)
📝 WalkthroughWalkthroughAdds two new Drive APIs— Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant Drive
participant PlatformVersion
participant GroveDB
Client->>Drive: fetch_contracts(start_at, limit, tx, platform_version)
Drive->>PlatformVersion: read drive.methods.contract.get.fetch_contracts
PlatformVersion-->>Drive: version (e.g., 0)
Drive->>GroveDB: build Query (RangeFrom/RangeAfter/RangeFull) + SizedQuery(limit)
GroveDB-->>Drive: Query results (path,key,element) / historical tree pointers
Drive->>GroveDB: (if historical) get latest history item
GroveDB-->>Drive: Element bytes
Drive-->>Client: Vec<DataContract> (or error)
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
Review GateCommit:
|
|
✅ DashSDKFFI.xcframework built for this PR.
SwiftPM (host the zip at a stable URL, then use): .binaryTarget(
name: "DashSDKFFI",
url: "https://your.cdn.example/DashSDKFFI.xcframework.zip",
checksum: "ed555f8ff5eb7d40c0827450d2c6bf0d9cbd7b0359fdcda280f0babbc0765b00"
)Xcode manual integration:
|
Add two new versioned Drive methods for querying data contracts from the DataContractDocuments root tree with pagination support: - `fetch_contract_ids(start_at, limit)` — returns contract IDs by querying the root tree for subtree keys - `fetch_contracts(start_at, limit)` — returns deserialized DataContract objects using set_subquery_key([0]) for a single-query fetch, with fallback reads for historical contracts Both follow the established `Option<([u8; 32], bool)>` pagination pattern used by identity balance and vote queries. Includes 11 tests covering: full fetch, limit, pagination across multiple pages, start_at included/excluded, empty state, and contract data validity. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
9bcb994 to
496b304
Compare
|
📖 Book Preview built successfully. Download the preview from the workflow artifacts. Updated at 2026-04-11T22:26:54.916Z |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## v3.1-dev #3480 +/- ##
============================================
+ Coverage 84.76% 84.77% +0.01%
============================================
Files 2469 2473 +4
Lines 266394 266762 +368
============================================
+ Hits 225798 226139 +341
- Misses 40596 40623 +27
🚀 New features to boost your workflow:
|
Verify that fetch_contracts correctly handles contracts with keeps_history=true, where key [0] under the contract subtree is a Tree element (history subtree) rather than an Item. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Summary
Drive::fetch_contract_ids(start_at, limit)— paginated query of contract IDs from the DataContractDocuments root treeDrive::fetch_contracts(start_at, limit)— paginated fetch of deserializedDataContractobjects usingset_subquery_key([0])for efficient single-query retrieval, with fallback reads for historical contractsOption<([u8; 32], bool)>pagination pattern (same as identity balance and vote queries)DriveContractGetMethodVersionsTest plan
fetch_all_contract_ids— fetches all IDs from statefetch_contract_ids_with_limit— respects limit parameterfetch_contract_ids_with_pagination— multi-page traversal reconstructs full setfetch_contract_ids_start_at_included— inclusive start boundaryfetch_contract_ids_start_at_excluded— exclusive start boundaryfetch_contract_ids_empty_state— empty state returns empty vecfetch_all_contracts— fetches and deserializes all contractsfetch_contracts_with_limit— respects limitfetch_contracts_with_pagination— multi-page works correctlyfetch_contracts_returns_valid_data— deserialized contracts have document typesfetch_contracts_empty_state— empty state returns empty vec🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Tests
Platform Versions