Repository navigation
feat: upgrade Platform SDK to 5.0.1 and expose network protocol version - #41
Conversation
Add get_protocol_version_with_sdk and refresh_protocol_version_with_sdk exports (fermented bindings regenerated) and DapiClient.getProtocolVersion() / refreshProtocolVersion() wrappers. refresh issues a proven getEpochsInfo query and ratchets dash-sdk up to the version the network runs, so wallets can pick fees that depend on the activated protocol version (e.g. the contested username prefunded voting balance, 0.2 -> 0.1 DASH in v14). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
| Layer / File(s) | Summary |
|---|---|
Mobile SDK setup and cache platform-mobile/src/config.rs, platform-mobile/src/provider.rs, platform-mobile/src/sdk.rs, platform-mobile/src/core.rs, platform-mobile/src/fetch_document.rs, platform-mobile/src/put.rs, platform-mobile/src/put_test.rs, platform-mobile/src/data_contracts.rs |
SDK setup selects Mainnet or Testnet from the configuration and no longer accepts an explicit platform version. The generic cache is replaced by DataContractCache, and SDK setup and document operations use the revised cache and setup APIs. |
Protocol-version access and refresh dpp/src/main/java/org/dashj/platform/dapiclient/DapiClient.kt, platform-mobile/src/sdk.rs |
DapiClient and the mobile SDK expose methods to return the learned protocol version and to refresh it through the SDK. |
IdentityUpdate deserialization platform-mobile/src/state_transition.rs |
Both exported deserialization functions use the exact untagged, untrusted decoder with IdentityUpdate as the expected type. |
Rust and Java FFI bindings dash-sdk-bindings/cbindgen.toml, dash-sdk-bindings/src/lib.rs, platform-mobile/src/clone.rs, dash-sdk-java/src/main/cpp/clone.h, dash-sdk-java/src/main/swig/*, dash-sdk-java/build.gradle, build.gradle, dash-sdk-bindings/rust-toolchain.toml, platform-mobile/rust-toolchain.toml |
Rust bindings add identity-type declarations and clone helpers. SWIG adds IdentityPublicKeyV1 wrappers and updates clone and ignore directives. The Java build adds SWIG metadata generation and makes CMake builds depend on SWIG generation. The project versions and Rust toolchains are updated. |
Estimated code review effort: 4 (Complex) | ~45 minutes
Change: Feature
Sequence Diagram(s)
sequenceDiagram
participant DapiClient
participant SDK
participant PlatformNetwork
DapiClient->>SDK: refresh protocol version
SDK->>PlatformNetwork: query protocol version
PlatformNetwork-->>SDK: return query result
SDK-->>DapiClient: return version or refresh error
Merge Risk: 
Minimal · previous review 94907
-
No confirmed issue currently blocks merging. The documented refresh fallback and support for other state-transition types remain unverified.
Pre-merge checks: 
3 · 
1
-
Failed checks: 1 warning Passed checks: 3 passedFull details: Title check
-
Explanation
The title correctly identifies exposing the network protocol version, but it incorrectly states an upgrade to Platform SDK 5.0.1. The changes and objectives target Platform 4.2-dev and SDK 4.2.0-SNAPSHOT.
Resolution
Update the title to reference Platform 4.2-dev or SDK 4.2.0-SNAPSHOT, for example: "feat: upgrade Platform SDK to 4.2-dev and expose network protocol version".
-
Finishing Touches
-
Generate docstrings
-
- Commit to this branch
- Create a new PR
Fix failing CI checks
-
- Commit to this branch
- Create a new PR
🧪 Generate unit tests (beta)
-
- Commit to this branch
- Create a new PR
-
- Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
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.
ℹ️ Recent review info
-
⚙️ Run configuration
-
- Configuration used: defaults
- Review profile: CHILL
- Plan: Advanced
- Run ID:
b0331e6b-51ee-4b9f-a045-8539aefe4ac8
⛔ Files ignored due to path filters (3)
-
dash-sdk-android/src/main/rust/Cargo.lock is excluded by !**/*.lock
dash-sdk-bindings/Cargo.lock is excluded by !**/*.lock
platform-mobile/Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (24)
-
build.gradle
dash-sdk-android/src/main/rust/src/fermented.rs
dash-sdk-bindings/cbindgen.toml
dash-sdk-bindings/rust-toolchain.toml
dash-sdk-bindings/src/fermented.rs
dash-sdk-bindings/src/lib.rs
dash-sdk-java/build.gradle
dash-sdk-java/src/main/cpp/clone.h
dash-sdk-java/src/main/swig/document.i
dash-sdk-java/src/main/swig/identity_public_key.i
dash-sdk-java/src/main/swig/ignore.i
dash-sdk-java/src/main/swig/root.i
dpp/src/main/java/org/dashj/platform/dapiclient/DapiClient.kt
platform-mobile/rust-toolchain.toml
platform-mobile/src/clone.rs
platform-mobile/src/config.rs
platform-mobile/src/core.rs
platform-mobile/src/data_contracts.rs
platform-mobile/src/fetch_document.rs
platform-mobile/src/provider.rs
platform-mobile/src/put.rs
platform-mobile/src/put_test.rs
platform-mobile/src/sdk.rs
platform-mobile/src/state_transition.rs
Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.
ℹ️ Recent review info
-
⚙️ Run configuration
-
- Configuration used: defaults
- Review profile: CHILL
- Plan: Advanced
- Run ID:
b0331e6b-51ee-4b9f-a045-8539aefe4ac8
⛔ Files ignored due to path filters (3)
-
dash-sdk-android/src/main/rust/Cargo.lockis excluded by!**/*.lockdash-sdk-bindings/Cargo.lockis excluded by!**/*.lockplatform-mobile/Cargo.lockis excluded by!**/*.lock
📒 Files selected for processing (24)
-
build.gradledash-sdk-android/src/main/rust/src/fermented.rsdash-sdk-bindings/cbindgen.tomldash-sdk-bindings/rust-toolchain.tomldash-sdk-bindings/src/fermented.rsdash-sdk-bindings/src/lib.rsdash-sdk-java/build.gradledash-sdk-java/src/main/cpp/clone.hdash-sdk-java/src/main/swig/document.idash-sdk-java/src/main/swig/identity_public_key.idash-sdk-java/src/main/swig/ignore.idash-sdk-java/src/main/swig/root.idpp/src/main/java/org/dashj/platform/dapiclient/DapiClient.ktplatform-mobile/rust-toolchain.tomlplatform-mobile/src/clone.rsplatform-mobile/src/config.rsplatform-mobile/src/core.rsplatform-mobile/src/data_contracts.rsplatform-mobile/src/fetch_document.rsplatform-mobile/src/provider.rsplatform-mobile/src/put.rsplatform-mobile/src/put_test.rsplatform-mobile/src/sdk.rsplatform-mobile/src/state_transition.rs
Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.
-
Expose bounded V1 identity keys, DIP-13 application key derivation, remaining budgets, and explicit devnet configuration across Rust, JNI, and Kotlin. Fix V1 native enum widths and index-only response confirmation using the submitted PV14 nonce-derived document ID. Add regression coverage and build against HashEngineering/platform ferment-5.0.
Decode one exact unsigned direct-purchase batch, verify token identity and denomination, and rebuild approved values with a fresh nonce and an unbound CRITICAL wallet key. Reject unsupported operations and hidden fee or group changes. Add native decoder and JNI boundary regression tests. Treat purchase proof results as affected-state snapshots rather than execution confirmation.
Replace the owner-only bridge limitation that forced the wallet to block Yappr's group-bound CRITICAL grants. Verify all member pages at one block, expose admins and each member kind, and retain explicit errors instead of partial scope. Order Android native builds after SWIG generation to prevent stale JNI wrappers. Document the rationale and verified test coverage.
Verified Contract Group ScopeWhy This ChangedThe Android bridge previously returned only a contract group's owner. Owner The wallet consequently rejected all group grants as a temporary safety measure. Platform already supplies proof-verifying group information and member queries. Guarantees
The Android CMake tasks now depend on SWIG generation. Verification caught an VerificationThree offline Rust tests cover block consistency, pagination/caps and all member On 2026-10-25 the Pixel 9 API 36 AOSP emulator completed the Yappr testnet login |
Use 24.0.0-20261024.220449-1 instead of the moving SNAPSHOT alias. Record the publicly resolved JAR checksum and snapshot retention caveat; native SDK code is unchanged.
|
Pushed d475d12: pin dashj-core to the existing timestamped publication 24.0.0-20261024.220449-1 rather than the moving 24.0.0-SNAPSHOT alias. Public Gradle resolution succeeded without Maven Local; JAR SHA-256 1f2afb88ca62ab910554e3aa9bf40c240111fc3d3379da152bf59bc19e7828bd is recorded in docs/dashj-build-pin.md, along with the snapshot-retention caveat. All 17 targeted SDK regression tests passed, and the Kotlin publication metadata was regenerated locally. No native SDK source/binary change is required. Wallet PR 1604 pins this revision and forces the same timestamped DashJ build across transitives; its 568 focused wallet tests, both APK builds, lint, and full-PR Sol review passed. This commit was pushed before the dependent wallet pin. |
|
Purchase replay security fix pushed in e9d3709 for dashpay/dash-wallet#1604. The bridge now returns a versioned canonical request ID from the decoded purchase fields and original identity-contract nonce, excluding ignored envelope signing-key IDs. Submission uses the existing DPP constructor to preserve that nonce, rather than allocating a fresh nonce and turning a replay into another debit. Identical terms with a new valid operation nonce remain supported. The SDK nonce cache is invalidated after successful or failed broadcast results. Affected-state proofs are still not treated as execution evidence. Validation: six native purchase tests and 19 focused JNI/Kotlin SDK tests passed. Both Android ABIs were rebuilt; their libraries were verified byte-for-byte in the wallet devnet and testnet APKs. The full wallet pre-review also inspected this exact SDK diff and found no blockers. Its sole CI-coverage suggestion has been addressed in the wallet shared SDK build script. Rationale and integration requirements are in docs/token-purchase-replay.md. This is a focused fix on the existing Platform revision, not the planned Platform 5.0.1 upgrade. No live or funded purchase testing is claimed. |
The application encryption path ends with a hardened 31-bit rotation level (dashpay/dips#191, used by the App Connect DIP, dashpay/dips#181): m/9'/coin'/5'/7'/0'/identityId'/contractId'/purpose'/rotation' with rotation 0' first. Without it the path becomes permanent with the first mainnet key and a compromised or retired key could never be replaced. platform-mobile: application_encryption_private_key_from_seed takes a rotation (below 2^31, an error otherwise) and appends it as a hardened level. The 8-level path without rotation stays available as application_encryption_legacy_private_key_from_seed, only to recognise keys that wallets registered on testnet/devnet before the rotation level existed. Tests pin the DIP vectors for both paths (abandon x11 about, mainnet). Bindings: Ferment output for dash-sdk-bindings and dash-sdk-android now has the new signature and the legacy function (regenerated with cargo build of dash-sdk-bindings; the Android copy carries the same two functions), plus a SWIG rename for applicationEncryptionLegacyPrivateKeyFromSeed. Kotlin: ApplicationKeyDerivation.encryption gains a required rotation parameter, so callers must choose it; new keys use 0. The pre-rotation path is the explicitly named legacyEncryptionWithoutRotation. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: HashEngineering <hashengineeringsolutions@gmail.com>
Declare platform_value_value_map_ValueMap before including Ferment's generated header. This fixes the CI compile failure when Value is emitted before ValueMap without changing ABI or Platform versions. Add a native header-order regression. Verified the original and reordered generated headers, a clean C++ rebuild, and seven JNI ValueTest tests.
Summary
ferment-5.0.1Platform fork, which contains the finalized upstreamv5.0.1release and the Ferment/JNI patches.5.0.1-SNAPSHOT, refresh the Rust lockfiles and generated Ferment bindings, and keep the proven network protocol version API introduced earlier in this PR.Why
Platform
v5.0.1is the stable patch release. The SDK must track its verified network protocol version, and the wallet must consume native libraries built from the pinned Platform revision. The existing token purchase replay protection remains in place.Validation
cargo check --locked --offline -p dash-sdkandcargo check --locked --offline --manifest-path platform-mobile/Cargo.tomlpass against the 5.0.1 fork.cargo build --locked --offline --manifest-path dash-sdk-bindings/Cargo.toml,generateSWIG, and desktopcmakeBuildpass.token_purchase::testsand the focused Java/Kotlin tests pass.5.0.1-SNAPSHOT. The packaged arm64-v8a and x86_64 libraries contain the required JNI exports and have 16 KB aligned load segments.