refactor(platform-wallet)!: remove dead C ABI exports (9 audit entries) - #4641
refactor(platform-wallet)!: remove dead C ABI exports (9 audit entries)#4641llbartekll wants to merge 1 commit into
Conversation
Nine audit entries in one commit, because they all change the same ABI surface
and the cbindgen header has to be regenerated once.
rs-platform-wallet-ffi:
- rust-ffi-011: `established_contact_{get_incoming_request,get_outgoing_request,
is_payment_channel_broken}` and the original `_get_contact_id` (its body moved
into the `_get_contact_identity_id` alias Swift actually calls);
`contact_request_create`; `managed_identity_{send,accept}_contact_request` and
`_ignore_contact_sender` (they operate on a cloned snapshot handle, so even if
called they could not change wallet state); the counts-only
`platform_wallet_dpns_marketplace_sync` (Swift and the JNI call `_detailed`);
the `ContactRequest`/`EstablishedContact` structs in types.rs, absent from the
generated header.
- rust-ffi-039: `platform_wallet_info.rs`, `identity_manager.rs`,
`WALLET_INFO_STORAGE`, `IDENTITY_MANAGER_STORAGE` — a second, unmanaged way to
build a wallet and identity manager.
- rust-ffi-041: `asset_lock_manager_recover` — 58 lines of unsafe deserializing
host-supplied tx and proof bytes, with no consumer.
- rust-ffi-042: `platform_address_wallet_{add_provider,restore_sync_state,
sync_balances,free_sync_result}`, the `platform_addresses/sync.rs` module, and
the `AddressSyncResultFFI`/`FoundAddressEntryFFI`/`AbsentAddressEntryFFI`/
`AddressSyncMetricsFFI` types with their `From` conversion.
`AddressSyncConfigFFI` stays.
- rust-ffi-043: `platform_address_wallet_withdraw` (the raw-script variant that
bypasses the network check); `_withdraw_to_address` stays.
- rust-ffi-044: `platform_wallet_ffi_init`, `_ffi_version`,
`_identifier_to_hex`, `_identifier_from_hex`, `_serialize_to_json_bytes`,
`_deserialize_from_json_bytes`, `platform_wallet_get_id`,
`_pubkey_hash_from_private_key`, the non-birth-height
`platform_wallet_manager_create_wallet_from_{seed,mnemonic}` pair, and
`_list_masternodes`/`_free_masternodes` v1. `MasternodeEntryFFI` stays — V2
embeds it, and the layout tests got a local release helper.
- rust-ffi-081: two `PLATFORM_WALLET_PERSISTENCE_CAPABILITY_*` alias constants
("source-compatible alias") with no consumers. This is the same symbol as the
FFI half of rust-core-146 — a duplicate in the audit, counted once.
- rust-ffi-086: `impl Default for WalletRestoreEntryFFI` — 39 lines to keep in
sync with a 26-field struct, with no callers.
rs-sdk-ffi (rust-sdk-ffi-005):
- `token/emergency_action.rs`, `token/purchase.rs`, `token/config_update.rs`
(the last returned "not yet implemented" for 4 of 9 variants and never read
`params.action_takers`), and `dash_sdk_document_make_handle` together with
`DashSDKDocumentHandleParams`.
swift-sdk: the wrappers over the removed exports — `ContactRequest.create` and
`ManagedIdentity.{sendContactRequest,acceptContactRequest,ignoreContactSender}`.
None had a call site in SwiftDashSDK or SwiftExampleApp.
The `test_get_dashpay_profile_unmanaged_identity_reports_not_found` test was
passing for the wrong reason: it built its handle in `WALLET_INFO_STORAGE` while
`platform_wallet_get_dashpay_profile` reads `PLATFORM_WALLET_STORAGE` — it never
had a real wallet and only ever pinned "unknown handle -> NotFound". It stays,
but now says what it actually checks.
Verified end to end: `cargo check --workspace --all-targets`,
`cargo test -p platform-wallet-ffi` (343 tests), clippy, cbindgen header
regeneration via `swift-sdk/build_ios.sh --target sim`, the SwiftDashSDK and
SwiftExampleApp builds against the regenerated header, the Android
`libdash_sdk_jni.so` link, and `./gradlew :sdk:assembleDebug`. The regenerated
header was checked both ways: every removed symbol is gone from it, and the
surviving siblings (`_list_masternodes_v2`, `_get_contact_identity_id`,
`_withdraw_to_address`, `_sync_detailed`, `_create_wallet_from_seed_with_birth_height`)
are still present.
BREAKING CHANGE: the listed symbols disappear from the generated C header;
kotlin-sdk and rs-unified-sdk-jni need a rebuild (neither referenced any of the
removed names — grep-verified).
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
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 |
4537473 to
3b10eef
Compare
2c70977 to
c1ca65f
Compare
|
🕓 Queued for automated review — 22nd in line, estimated start in ~7 h (commit 2d95728)
|
c1ca65f to
2d95728
Compare
Issue being fixed or feature implemented
Final part of the cleanup following the 2026-09-08 audit (
dead-codecategory). Scope: C ABI removals — 9 entries, in a single commit, because they all change the same surface and the cbindgen header has to be regenerated once.What was done?
rs-platform-wallet-ffi:established_contact_{get_incoming_request,get_outgoing_request,is_payment_channel_broken}and the original_get_contact_id(its body moved into the_get_contact_identity_idalias that Swift actually calls);contact_request_create;managed_identity_{send,accept}_contact_requestand_ignore_contact_sender— these operate on a cloned snapshot handle, so even if called they could not change wallet state; the counts-onlyplatform_wallet_dpns_marketplace_sync(Swift and the JNI both call_detailed); theContactRequest/EstablishedContactstructs intypes.rs, absent from the generated headerplatform_wallet_info.rs,identity_manager.rs,WALLET_INFO_STORAGE,IDENTITY_MANAGER_STORAGE— a second, unmanaged way to build a wallet and identity managerasset_lock_manager_recover— 58 lines ofunsafedeserializing host-supplied tx and proof bytes, with no consumerplatform_address_wallet_{add_provider,restore_sync_state,sync_balances,free_sync_result}, theplatform_addresses/sync.rsmodule, and theAddressSyncResultFFI/FoundAddressEntryFFI/AbsentAddressEntryFFI/AddressSyncMetricsFFItypes plus theirFromimpl.AddressSyncConfigFFIstaysplatform_address_wallet_withdraw— the raw-script variant that bypasses the network check;_withdraw_to_addressstaysplatform_wallet_ffi_init,_ffi_version,_identifier_{to,from}_hex,_{serialize,deserialize}_*_json_bytes,platform_wallet_get_id,_pubkey_hash_from_private_key, the non-birth-height_create_wallet_from_{seed,mnemonic}pair, and_list_masternodes/_free_masternodesv1PLATFORM_WALLET_PERSISTENCE_CAPABILITY_*alias constantsimpl Default for WalletRestoreEntryFFI— 39 lines to keep in sync with a 26-field structrs-sdk-ffi(rust-sdk-ffi-005):token/emergency_action.rs,token/purchase.rs,token/config_update.rs(the last returned "not yet implemented" for 4 of 9 variants and never readparams.action_takers), anddash_sdk_document_make_handle+DashSDKDocumentHandleParams.swift-sdk: the wrappers over the removed exports —ContactRequest.createandManagedIdentity.{sendContactRequest,acceptContactRequest,ignoreContactSender}. None had a call site in SwiftDashSDK or SwiftExampleApp.Total: 31 files, 4,353 deletions, 55 insertions.
Incidental findings
MasternodeEntryFFI(v1) stays — V2 embeds it. The layout tests that built v1 arrays got a local release helper in place of the removed public free function.rust-ffi-081duplicates half ofrust-core-146— the same symbol reported twice in the audit. Counted once.test_get_dashpay_profile_unmanaged_identity_reports_not_foundbuilt its handle inWALLET_INFO_STORAGEwhileplatform_wallet_get_dashpay_profilereadsPLATFORM_WALLET_STORAGE— so it never had a real wallet and only ever pinned "unknown handle → NotFound". The test stays, but now says what it actually checks. If the intent was to pin "known wallet, unmanaged identity", it needs to be written afresh.How Has This Been Tested?
Full chain, all green:
cargo check --workspace --all-targets✅cargo test -p platform-wallet-ffi— 343 passed, 0 failed ✅cargo clippy -p platform-wallet -p platform-wallet-ffi --all-features --all-targets✅packages/swift-sdk/build_ios.sh --target sim✅ — regenerates the cbindgen header and rebuildsDashSDKFFI.xcframeworkxcodebuild -scheme SwiftDashSDK -sdk iphonesimulator✅ — against the regenerated headerxcodebuild -scheme SwiftExampleApp -sdk iphonesimulator✅packages/kotlin-sdk/build_android.sh --abi x86_64 --profile dev✅ —rs-unified-sdk-jnilinks intolibdash_sdk_jni.so./gradlew :sdk:assembleDebug✅ — BUILD SUCCESSFULThe regenerated header was checked in both directions. Every removed symbol is
gone from
DashSDKFFI.xcframework(platform_wallet_ffi_init,platform_wallet_identifier_to_hex,contact_request_create,asset_lock_manager_recover,platform_address_wallet_add_provider,dash_sdk_token_purchase,dash_sdk_document_make_handle,PLATFORM_WALLET_PERSISTENCE_CAPABILITY_ACCOUNT_ADDRESS_POOLS— 0 hits each),and the surviving siblings are still there
(
platform_wallet_manager_list_masternodes_v2,established_contact_get_contact_identity_id,platform_address_wallet_withdraw_to_address,platform_wallet_dpns_marketplace_sync_detailed,platform_wallet_manager_create_wallet_from_seed_with_birth_height).Environment notes for whoever reproduces this:
iPhone 16destination inCLAUDE.mddoes not exist on the test machine;builds ran on
iPhone 17. Worth updating the doc.packages/kotlin-sdk/BUILD_GUIDE_FOR_AI.mdrequires NDK r28+; only 27.1 wasavailable, and the native build succeeded on it. The 16 KB-alignment
--verifypath was not exercised, so that guide's requirement standsunconfirmed here — it is orthogonal to this change.
Breaking Changes
Yes — C ABI change. The listed symbols disappear from the generated header. All consumers are in-repo and were verified not to use them, but
kotlin-sdk/rs-unified-sdk-jnineed a rebuild, andrs-sdk-ffimay have out-of-repo header consumers we cannot see.Public Swift symbols go too, as a side effect (
ContactRequest.createand threeManagedIdentitymethods).Checklist:
For repository code-owners and collaborators only
🤖 Generated with Claude Code