Repository navigation
Conversation
✅ gRPC Query Coverage Report |
WalkthroughReworked nonce retrieval to always derive inserted nonces from platform-fetched values (optionally +1), added Changes
Sequence Diagram(s)sequenceDiagram
participant Caller as SDK caller
participant SDK as Sdk
participant Platform as Platform
participant Cache as LocalCache
Note over Caller,SDK: get_identity_nonce (query path)
Caller->>SDK: get_identity_nonce(identity_id, bump_first)
SDK->>Platform: fetch platform_nonce
Platform-->>SDK: platform_nonce
SDK->>SDK: compute insert_nonce = platform_nonce + (bump_first ? 1 : 0)
SDK->>Cache: upsert identity nonce = insert_nonce
Cache-->>SDK: ack
SDK-->>Caller: insert_nonce
sequenceDiagram
participant Test as Caller
participant MockSdk as MockDashPlatformSdk
participant ProofMap as from_proof_expectations
participant DapiMock as MockDapiClient
Note over MockSdk: remove_fetch_expectation(query)
Test->>MockSdk: remove_fetch_expectation(query)
MockSdk->>MockSdk: grpc_request = query.prove()
MockSdk->>ProofMap: remove(key(grpc_request))
MockSdk->>DapiMock: DapiMock.remove(grpc_request)
alt removed from either
DapiMock-->>MockSdk: true
ProofMap-->>MockSdk: true
end
MockSdk-->>Test: bool (removed?)
sequenceDiagram
participant Broadcaster as TransitionBroadcaster
participant SDK as Sdk
participant Platform as Platform
Note over Broadcaster,SDK: on broadcast failure after retries
Broadcaster->>SDK: refresh_identity_nonce(owner_id)
SDK->>Platform: fetch platform_nonce (async)
Platform-->>SDK: platform_nonce
SDK->>SDK: update cache with platform-derived nonce
SDK-->>Broadcaster: done
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes
Poem
Pre-merge checks and finishing touches✅ Passed checks (5 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (4)
🚧 Files skipped from review as they are similar to previous changes (3)
🧰 Additional context used📓 Path-based instructions (1)**/*.rs📄 CodeRabbit inference engine (CLAUDE.md)
Files:
🧠 Learnings (6)📓 Common learnings📚 Learning: 2024-10-10T10:30:19.883ZApplied to files:
📚 Learning: 2024-10-30T11:04:33.634ZApplied to files:
📚 Learning: 2024-10-29T14:16:40.972ZApplied to files:
📚 Learning: 2024-10-30T11:13:22.398ZApplied to files:
📚 Learning: 2025-10-15T14:45:30.856ZApplied to files:
🧬 Code graph analysis (1)packages/rs-sdk/src/mock/sdk.rs (3)
⏰ 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). (1)
🔇 Additional comments (2)
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 |
|
✅ 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: "eae04c4a33632b5d3d2562789818bc454d7c73a48ffce61ae64285fad8a5e6a6"
)Xcode manual integration:
|
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
packages/rs-sdk/src/sdk.rs(4 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.rs
📄 CodeRabbit inference engine (CLAUDE.md)
**/*.rs: Format Rust code with cargo fmt
Run Clippy linter for Rust code
Files:
packages/rs-sdk/src/sdk.rs
packages/rs-*/**/*.rs
📄 CodeRabbit inference engine (AGENTS.md)
packages/rs-*/**/*.rs: Use rustfmt defaults for Rust code (format via cargo fmt --all)
Keep Rust code clippy-clean (cargo clippy)
Name Rust modules in snake_case
Use PascalCase for Rust types
Use SCREAMING_SNAKE_CASE for Rust constants
Files:
packages/rs-sdk/src/sdk.rs
🧠 Learnings (11)
📓 Common learnings
Learnt from: QuantumExplorer
Repo: dashpay/platform PR: 2673
File: packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_update/mod.rs:1164-1197
Timestamp: 2025-06-18T03:44:14.385Z
Learning: QuantumExplorer determined that a CodeRabbit suggestion about fixing signable_bytes calculation in identity update tests with contract-bound keys was incorrect - the code flow is working as intended without the suggested changes.
Learnt from: shumkov
Repo: dashpay/platform PR: 2449
File: packages/rs-sdk/src/platform/transition/fungible_tokens/unfreeze.rs:148-148
Timestamp: 2025-02-14T04:31:57.245Z
Learning: The third boolean parameter in `get_identity_contract_nonce` method controls whether to bump (increment) the nonce when set to `true`.
Learnt from: shumkov
Repo: dashpay/platform PR: 2343
File: packages/rs-platform-version/src/version/drive_abci_versions/drive_abci_validation_versions/v1.rs:134-134
Timestamp: 2024-11-21T12:43:26.103Z
Learning: In the codebase, the versioning of `has_nonce_validation` from version 0 to 1 and back to 0 is intentional. Do not flag this as an inconsistency in future reviews.
📚 Learning: 2024-10-30T11:19:59.163Z
Learnt from: lklimek
Repo: dashpay/platform PR: 2277
File: packages/rs-sdk/tests/fetch/config.rs:233-233
Timestamp: 2024-10-30T11:19:59.163Z
Learning: In the Rust SDK's `rs-sdk/tests` integration tests (e.g., in `packages/rs-sdk/tests/fetch/config.rs`), we cannot create objects during tests because there is no support for object creation in this context. Therefore, hardcoded values for test identities must be used.
Applied to files:
packages/rs-sdk/src/sdk.rs
📚 Learning: 2024-10-09T00:22:57.778Z
Learnt from: shumkov
Repo: dashpay/platform PR: 2201
File: packages/rs-platform-version/src/version/v2.rs:1186-1188
Timestamp: 2024-10-09T00:22:57.778Z
Learning: In the `IdentityTransitionVersions` structure within `packages/rs-platform-version/src/version/v2.rs`, the field `credit_withdrawal` does not need the `identity_` prefix since it is already encompassed within identity state transitions.
Applied to files:
packages/rs-sdk/src/sdk.rs
📚 Learning: 2025-06-18T03:44:14.385Z
Learnt from: QuantumExplorer
Repo: dashpay/platform PR: 2673
File: packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_update/mod.rs:1164-1197
Timestamp: 2025-06-18T03:44:14.385Z
Learning: QuantumExplorer determined that a CodeRabbit suggestion about fixing signable_bytes calculation in identity update tests with contract-bound keys was incorrect - the code flow is working as intended without the suggested changes.
Applied to files:
packages/rs-sdk/src/sdk.rs
📚 Learning: 2025-02-14T04:31:57.245Z
Learnt from: shumkov
Repo: dashpay/platform PR: 2449
File: packages/rs-sdk/src/platform/transition/fungible_tokens/unfreeze.rs:148-148
Timestamp: 2025-02-14T04:31:57.245Z
Learning: The third boolean parameter in `get_identity_contract_nonce` method controls whether to bump (increment) the nonce when set to `true`.
Applied to files:
packages/rs-sdk/src/sdk.rs
📚 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/sdk.rs
📚 Learning: 2024-10-22T10:53:12.111Z
Learnt from: shumkov
Repo: dashpay/platform PR: 2259
File: packages/rs-dapi-client/src/dapi_client.rs:137-139
Timestamp: 2024-10-22T10:53:12.111Z
Learning: In `packages/rs-dapi-client/src/dapi_client.rs`, when passing data into asynchronous code, ensure that data structures are `Send + Sync`. Using `Arc<AtomicUsize>` is necessary for the retry counter.
Applied to files:
packages/rs-sdk/src/sdk.rs
📚 Learning: 2024-10-10T10:30:19.883Z
Learnt from: lklimek
Repo: dashpay/platform PR: 2232
File: packages/rs-sdk/src/mock/sdk.rs:90-95
Timestamp: 2024-10-10T10:30:19.883Z
Learning: In `packages/rs-sdk/src/mock/sdk.rs`, the `load_expectations` method in `MockDashPlatformSdk` remains asynchronous (`async`) for backward compatibility, even though it now delegates to the synchronous `load_expectations_sync` method.
Applied to files:
packages/rs-sdk/src/sdk.rs
📚 Learning: 2024-10-21T01:03:42.458Z
Learnt from: QuantumExplorer
Repo: dashpay/platform PR: 2227
File: packages/rs-dpp/src/core_types/validator_set/v0/mod.rs:299-299
Timestamp: 2024-10-21T01:03:42.458Z
Learning: In the `test_serialize_deserialize_validator_set_v0` test within `packages/rs-dpp/src/core_types/validator_set/v0/mod.rs`, deterministic BLS keys cannot be easily used; therefore, using `BlsPublicKey::generate()` is acceptable.
Applied to files:
packages/rs-sdk/src/sdk.rs
📚 Learning: 2024-10-29T14:13:35.584Z
Learnt from: lklimek
Repo: dashpay/platform PR: 2277
File: packages/dapi-grpc/src/mock.rs:95-109
Timestamp: 2024-10-29T14:13:35.584Z
Learning: In test code (e.g., `packages/dapi-grpc/src/mock.rs`), panicking on deserialization errors is acceptable behavior.
Applied to files:
packages/rs-sdk/src/sdk.rs
📚 Learning: 2024-10-29T14:16:40.972Z
Learnt from: lklimek
Repo: dashpay/platform PR: 2277
File: packages/rs-dapi-client/src/address_list.rs:63-73
Timestamp: 2024-10-29T14:16:40.972Z
Learning: In the Rust SDK, it's acceptable to use `expect()` that panics on errors in the `Mockable` trait implementations during testing, and the `Mockable` trait will be refactored in a future PR.
Applied to files:
packages/rs-sdk/src/sdk.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). (10)
- GitHub Check: Rust packages (dash-sdk) / Unused dependencies
- GitHub Check: Rust packages (dash-sdk) / Linting
- GitHub Check: Build Docker images (Drive, drive, drive-abci) / Build Drive image
- GitHub Check: Build Docker images (Dashmate helper, dashmate-helper, dashmate-helper) / Build Dashmate helper image
- GitHub Check: Build Docker images (RS-DAPI, rs-dapi, rs-dapi) / Build RS-DAPI image
- GitHub Check: Build JS packages / Build JS
- GitHub Check: Rust crates security audit
- GitHub Check: Build rs-sdk-ffi for iOS targets (aarch64-apple-ios-sim)
- GitHub Check: Build rs-sdk-ffi for iOS targets (aarch64-apple-ios)
- GitHub Check: Swift SDK and Example build (warnings as errors)
6f79830 to
381bc75
Compare
|
@coderabbitai review all |
|
@lklimek: I'll review all the changes in this PR. 🧠 Learnings used✅ Actions performedReview triggered.
|
…orrectly-retains-stale-va
|
I would have preferred to only reset SDK nonce cache on internal and non paid errors. However this is fine for now. |
Issue being fixed or feature implemented
Fixes #2737
What was done?
If an error is received from state transition, we remove cached identity nonce to force refreshing it.
How Has This Been Tested?
Added some more logging and used dash-evo-tool to send invalid transactions.
Breaking Changes
None
Checklist:
For repository code-owners and collaborators only
Summary by CodeRabbit
New Features
Improvements