Repository navigation
feat(kotlin-sdk): shield from identity to a third-party Orchard address - #5896
HashEngineering wants to merge 2 commits into
Conversation
|
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
|
|
✅ Final review complete — no blockers (commit e8b644b) · triage: critical |
thepastaclaw
left a comment
There was a problem hiding this comment.
Final validation — Phase 1 + Phase 2
The added identity-to-third-party shield path is correctly layered across Kotlin, JNI, Rust FFI, and the existing wallet implementation. Static verification found no in-scope correctness, security, lifecycle, ownership, or API issues, and the changed-code CI check passed; only the review check remains in progress.
Review provenance
Source: reviewer 1: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 2: gpt-6.1-sol (agent: phase2-reviewer, role: architecture-layering); reviewer 3: gpt-6.1-sol (agent: phase2-reviewer, role: ffi-engineer); reviewer 4: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 5: muse-spark-1.3-contributor (agent: phase1-reviewer, role: rust-quality); reviewer 6: gpt-6.1-sol (agent: phase2-reviewer, role: rust-quality); reviewer 7: gpt-6.1-sol (agent: phase2-reviewer, role: security-auditor); final verifier: gpt-6.1-sol (agent: sol-verifier, role: final-verifier)
- Triage:
criticalbygpt-6.1-sol(effort low) — The diff is a substantial cross-language change to a funds-movement path that debits an identity and performs shielded sending, including signing and FFI/JNI boundary handling. - Phase 1 reviewers:
muse-spark-1.3-contributor— general (completed, effort xhigh); agentphase1-reviewer,muse-spark-1.3-contributor— rust-quality (completed, effort xhigh); agentphase1-reviewer - Phase 1 model:
muse-spark-1.3-contributor— not quota-gated; passed overgemini-3.8-flash-high(antigravity quota lookup failed),glm-5.3-flash(not used above high effort; tier asks max) - Single stage: Phase 1 and Phase 2 reviewed this head side by side, with no blocker gate between them (triage tier)
- Fresh verifier:
gpt-6.1-sol— final-verifier; agentsol-verifier - Phase 2 reviewers:
gpt-6.1-sol— general (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— architecture-layering (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— ffi-engineer (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— rust-quality (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— security-auditor (completed, effort xhigh); agentphase2-reviewer
Out-of-scope follow-up suggestions (1)
These are valid observations, but they are outside this PR's scope and should be handled in separate issues or author/maintainer-requested PRs rather than blocking this review.
- Guard the older identity shield exports against proving-task panics — The pre-existing
platform_wallet_manager_shielded_shieldandplatform_wallet_manager_shielded_shield_from_identityexports callblock_on_workerwithoutcatch_spend_panic. Sinceblock_on_workerre-panics when its proving task panics, an unwind can abort the host at theextern "C"boundary instead of returning the ambiguous-spend error. The new export correctly uses the guarded pattern, so this is an adjacent pre-existing issue rather than a defect introduced by this PR.- Follow-up: Open a focused follow-up PR that wraps both older shield exports in
catch_spend_panicand adds panic-to-ErrorShieldedSpendUnconfirmedcoverage matching the existing guard tests.
- Follow-up: Open a focused follow-up PR that wraps both older shield exports in
fbeb778 to
bc2a892
Compare
…s to a recipient platform_wallet_manager_shielded_shield_from_identity_to_recipient now takes an optional memo_text between amount and signer_identity_handle (9 parameters), matching the shape PR #5896 exports for the Kotlin/JNI binding. NULL or empty means no memo; otherwise the text is encoded with encode_memo_text (over 32 UTF-8 bytes is ErrorInvalidParameter, invalid UTF-8 is ErrorUtf8Conversion), before the wallet handle is resolved and after the pointer checks. Swift: shieldedShieldFromIdentityToRecipient gains memo: String? = nil, passed with withCString or nil like shieldedShieldToRecipient. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
8b08328 to
0bc049d
Compare
thepastaclaw
left a comment
There was a problem hiding this comment.
Re-review — Final validation — Phase 1 + Phase 2
The new identity-to-recipient binding is correctly layered and preserves the native error, signer, balance, and cancellation contracts. Three non-blocking issues remain: the existing self-shield Kotlin method still uses the cancellation-vulnerable gate, the new FFI export duplicates unsafe memo decoding, and ambiguous identity shields do not trigger the immediate recovery sync used by other shielded spends. CI shows the Kotlin build/tests passing with no failed code checks.
🟡 3 suggestion(s)
Approved: nothing here blocks the merge. The non-blocking findings are optional: fix them forward, in this PR or a follow-up, without waiting for another review round.
1 finding(s) not shown inline (the lines are not part of this PR's diff)
🟡 Suggestion: Use opReturningCompletedResult for self-shield identity operations
packages/kotlin-sdk/sdk/src/main/kotlin/org/dashfoundation/dashsdk/wallet/PlatformWalletManager.kt:1924
shieldedShieldFromIdentity returns the identity's post-debit balance but still uses teardownGate.op. If cancellation occurs after the blocking native call completes, withContext can throw during the handoff and discard that balance, leaving the caller unable to distinguish a completed debit from an unstarted operation. The pending-debit guard prevents an immediate double debit, but this sibling should use the same completed-result cancellation contract as the new third-party method and shieldedShieldToRecipient.
): Long = teardownGate.opReturningCompletedResult {
source: muse-spark-1.3-contributor (phase1-reviewer: general, rust-quality)
Review provenance
Source: reviewer 1: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 2: muse-spark-1.3-contributor (agent: phase1-reviewer, role: rust-quality); reviewer 3: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 4: gpt-6.1-sol (agent: phase2-reviewer, role: architecture-layering); reviewer 5: gpt-6.1-sol (agent: phase2-reviewer, role: ffi-engineer); reviewer 6: gpt-6.1-sol (agent: phase2-reviewer, role: rust-quality); reviewer 7: gpt-6.1-sol (agent: phase2-reviewer, role: security-auditor); final verifier: gpt-6.1-sol (agent: sol-verifier, role: final-verifier)
- Triage:
criticalbygpt-6.1-sol(effort low) — This is a substantial cross-language change to a funds-movement path that debits an identity and shields value to an external recipient, including Rust FFI, JNI marshalling, cancellation semantics, and error handling. - Phase 1 reviewers:
muse-spark-1.3-contributor— general (completed, effort xhigh); agentphase1-reviewer,muse-spark-1.3-contributor— rust-quality (completed, effort xhigh); agentphase1-reviewer - Phase 1 model:
muse-spark-1.3-contributor— not quota-gated; passed overgemini-3.8-flash-high(antigravity quota lookup failed),glm-5.3-flash(not used above high effort; tier asks max) - Single stage: Phase 1 and Phase 2 reviewed this head side by side, with no blocker gate between them (triage tier)
- Fresh verifier:
gpt-6.1-sol— final-verifier; agentsol-verifier - Phase 2 reviewers:
gpt-6.1-sol— general (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— architecture-layering (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— ffi-engineer (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— rust-quality (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— security-auditor (completed, effort xhigh); agentphase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review (PastaClaw). How to work through them:
- Verify each finding against the code; fix only what is real, as narrowly as the finding.
- If a finding is wrong, decline it on its thread in one or two sentences; the bot answers once and stops.
- To defer one, link a tracking issue on its thread (or reply asking the bot to file one).
- Suggestions don't block the merge, but most are worth fixing in this PR; judge each on its merits.
- Keep the PR's scope; don't grow it to satisfy hardening suggestions.
- Carried items were raised in an earlier round: read the thread first, and don't re-fix what you already fixed, declined or deferred there. Disputed and deferred items are already handled and are not listed.
In `packages/kotlin-sdk/sdk/src/main/kotlin/org/dashfoundation/dashsdk/wallet/PlatformWalletManager.kt`:
- [SUGGESTION] packages/kotlin-sdk/sdk/src/main/kotlin/org/dashfoundation/dashsdk/wallet/PlatformWalletManager.kt:1924: Use opReturningCompletedResult for self-shield identity operations
`shieldedShieldFromIdentity` returns the identity's post-debit balance but still uses `teardownGate.op`. If cancellation occurs after the blocking native call completes, `withContext` can throw during the handoff and discard that balance, leaving the caller unable to distinguish a completed debit from an unstarted operation. The pending-debit guard prevents an immediate double debit, but this sibling should use the same completed-result cancellation contract as the new third-party method and `shieldedShieldToRecipient`.
In `packages/rs-platform-wallet-ffi/src/shielded_send.rs`:
- [SUGGESTION] packages/rs-platform-wallet-ffi/src/shielded_send.rs:1406-1418: Factor optional memo C-string decoding into a shared helper
The new export adds another copy of the unsafe `null` check, `CStr::from_ptr`, UTF-8 conversion, and `ErrorUtf8Conversion` mapping. Equivalent blocks already exist in the transfer path and the address-funded shield-to-recipient path. Keeping this boundary conversion in a shared helper would prevent future changes to host-visible error handling or pointer assumptions from diverging across shielded exports; the existing `encode_memo_text` helper already establishes that the subsequent memo rules should be shared.
- [SUGGESTION] packages/rs-platform-wallet-ffi/src/shielded_send.rs:1432-1449: Trigger recovery sync for ambiguous identity shields
The identity-funded operation persists its pending debit/redrive before broadcast and can return `ShieldedSpendUnconfirmed` when the outcome is ambiguous. This new worker maps that result directly without calling `poke_sync_on_unconfirmed`, so reconciliation waits for the periodic sync cycle while subsequent identity shields remain blocked by the pending-debit guard. Add the same immediate sync trigger used by the other shielded spend exports before mapping the result.
Out-of-scope follow-up suggestions (1)
These are valid observations, but they are outside this PR's scope and should be handled in separate issues or author/maintainer-requested PRs rather than blocking this review.
- Guard the existing self-shield FFI export against proving-task panics —
platform_wallet_manager_shielded_shield_from_identitydirectly awaitsblock_on_worker, whose worker join usesexpectand can panic if the proving task panics. Unlike the new export and the address-funded recipient shield, this existingextern "C"function has nocatch_spend_panicboundary, so a proving panic can abort the host. The function predates this PR and is not changed here, but the adjacent identity-shield API should receive the same protection.- Follow-up: Open a follow-up PR that moves the self-shield body into an inner function and wraps the export with
catch_spend_panic, preserving the existing ambiguous-spend error contract.
- Follow-up: Open a follow-up PR that moves the self-shield body into an inner function and wraps the export with
| let memo_str = if memo_text.is_null() { | ||
| None | ||
| } else { | ||
| match CStr::from_ptr(memo_text).to_str() { | ||
| Ok(s) => Some(s), | ||
| Err(e) => { | ||
| return PlatformWalletFFIResult::err( | ||
| PlatformWalletFFIResultCode::ErrorUtf8Conversion, | ||
| format!("memo_text is not valid UTF-8: {e}"), | ||
| ); | ||
| } | ||
| } | ||
| }; |
There was a problem hiding this comment.
🟡 Suggestion: Factor optional memo C-string decoding into a shared helper
The new export adds another copy of the unsafe null check, CStr::from_ptr, UTF-8 conversion, and ErrorUtf8Conversion mapping. Equivalent blocks already exist in the transfer path and the address-funded shield-to-recipient path. Keeping this boundary conversion in a shared helper would prevent future changes to host-visible error handling or pointer assumptions from diverging across shielded exports; the existing encode_memo_text helper already establishes that the subsequent memo rules should be shared.
source: muse-spark-1.3-contributor (phase1-reviewer: general, rust-quality)
| let result = block_on_worker(async move { | ||
| // SAFETY: valid for the duration of this synchronously-awaited task per | ||
| // the caller's documented lifetime contract. | ||
| let identity_signer: &VTableSigner = &*(signer_addr as *const VTableSigner); | ||
| let prover = CachedOrchardProver::new(); | ||
| wallet | ||
| .shielded_shield_from_identity_to_recipient( | ||
| &coordinator, | ||
| shielded_account, | ||
| &identity_id, | ||
| &recipient, | ||
| amount, | ||
| memo, | ||
| identity_signer, | ||
| &prover, | ||
| ) | ||
| .await | ||
| }); |
There was a problem hiding this comment.
🟡 Suggestion: Trigger recovery sync for ambiguous identity shields
The identity-funded operation persists its pending debit/redrive before broadcast and can return ShieldedSpendUnconfirmed when the outcome is ambiguous. This new worker maps that result directly without calling poke_sync_on_unconfirmed, so reconciliation waits for the periodic sync cycle while subsequent identity shields remain blocked by the pending-debit guard. Add the same immediate sync trigger used by the other shielded spend exports before mapping the result.
| let result = block_on_worker(async move { | |
| // SAFETY: valid for the duration of this synchronously-awaited task per | |
| // the caller's documented lifetime contract. | |
| let identity_signer: &VTableSigner = &*(signer_addr as *const VTableSigner); | |
| let prover = CachedOrchardProver::new(); | |
| wallet | |
| .shielded_shield_from_identity_to_recipient( | |
| &coordinator, | |
| shielded_account, | |
| &identity_id, | |
| &recipient, | |
| amount, | |
| memo, | |
| identity_signer, | |
| &prover, | |
| ) | |
| .await | |
| }); | |
| let result = block_on_worker(async move { | |
| // SAFETY: valid for the duration of this synchronously-awaited task per | |
| // the caller's documented lifetime contract. | |
| let identity_signer: &VTableSigner = &*(signer_addr as *const VTableSigner); | |
| let prover = CachedOrchardProver::new(); | |
| wallet | |
| .shielded_shield_from_identity_to_recipient( | |
| &coordinator, | |
| shielded_account, | |
| &identity_id, | |
| &recipient, | |
| amount, | |
| memo, | |
| identity_signer, | |
| &prover, | |
| ) | |
| .await | |
| }); | |
| poke_sync_on_unconfirmed(&result, handle); | |
| result |
source: gpt-6.1-sol (phase2-reviewer: rust-quality)
bc2a892 to
22006a2
Compare
|
Bots are done — your move: post |
|
Bots are done — your move: post |
Adds the identity-funded third-party shield (Type 21 ShieldFromIdentity with a recipient) end to end for Android: a new FFI export platform_wallet_manager_shielded_shield_from_identity_to_recipient over the existing PlatformWallet::shielded_shield_from_identity_to_recipient, its JNI bridge, and PlatformWalletManager.shieldedShieldFromIdentityToRecipient. The Android wallet's External Send (MO-1121) needs it to pay someone else's Orchard address from an identity balance; shieldedShieldFromIdentity only targets the wallet's own address. The FFI body runs under catch_spend_panic, so a panic surfaces as ErrorShieldedSpendUnconfirmed (18) instead of aborting the host. It decodes the memo before resolving the wallet, writes out_new_balance only on success, and maps errors through map_spend_result, which keeps ErrorShieldedIdentityDebitPending (55) distinct. The identity-debit guard in rs-platform-wallet is untouched. The docs on every layer say not to retry on 18 or 55, since a retry could debit the identity twice. The Kotlin KDoc also says a cancelled call may still debit the identity, so it is treated like ShieldedSpendUnconfirmed. PARITY.md notes the binding as SDK only, with no Swift counterpart yet. The JNI and Kotlin layers only marshal: fixed-size ids and recipient, and sign checks on amount and shieldedAccount before the unsigned casts. A zero amount, the 32-byte memo limit and the own-IVK recipient rejection stay with their owners in Rust (book: "validation lives once"). Tests: FFI unit tests for each null required pointer, a bad memo (over-limit and invalid UTF-8) failing before the wallet is resolved, and an unknown manager handle leaving out_new_balance untouched; an instrumented ShieldFromIdentityToRecipientBindingTest that pins the JNI descriptor and each rejection's layer. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ient to a cancelled caller shieldedShieldFromIdentityToRecipient now runs in opReturningCompletedResult instead of op, as shieldedShieldToRecipient does. When the caller is cancelled after the blocking native shield has completed, the call returns the identity's post-debit balance instead of throwing CancellationException, so a completed identity debit is never hidden and prompted to retry. The KDoc's cancellation note is updated to match. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
0bc049d to
e8b644b
Compare
|
Waiting for bot review — thepastaclaw not yet. Wait for the missing reviews, or a writer can post |
thepastaclaw
left a comment
There was a problem hiding this comment.
Re-review — Final validation — Phase 1 + Phase 2
The new identity-funded third-party shield is consistently marshalled through the Rust FFI, JNI, and Kotlin layers, and the current Kotlin cancellation fix correctly protects the new API's completed result. Rust and Kotlin checks passed; the Swift SDK failure is an unrelated simulator launch failure, so no blocking defect was found.
🟡 3 suggestion(s)
Approved: nothing here blocks the merge. The non-blocking findings are optional: fix them forward, in this PR or a follow-up, without waiting for another review round.
1 finding(s) not shown inline (the lines are not part of this PR's diff)
🟡 Suggestion: Use opReturningCompletedResult for self-shield identity operations
packages/kotlin-sdk/sdk/src/main/kotlin/org/dashfoundation/dashsdk/wallet/PlatformWalletManager.kt:1924
The existing self-shield identity method still wraps its blocking native call in teardownGate.op, while the new third-party identity method uses opReturningCompletedResult. If cancellation occurs while the dispatcher hands control back after the native call has already debited the identity, op can discard the returned post-debit balance and expose only CancellationException. The caller then cannot distinguish a completed debit from a failed request and may retry after the durable guard is later reconciled; use the same completed-result handoff as the sibling method.
): Long = teardownGate.opReturningCompletedResult {
source: muse-spark-1.3-contributor (phase1-reviewer: general, rust-quality); gpt-6.1-sol (phase2-reviewer: general, architecture-layering, ffi-engineer, rust-quality)
Still open from earlier rounds (2)
- 🟡 Suggestion: Trigger recovery sync for ambiguous identity shields —
packages/rs-platform-wallet-ffi/src/shielded_send.rs:1432-1449(thread) - 🟡 Suggestion: Factor optional memo C-string decoding into a shared helper —
packages/rs-platform-wallet-ffi/src/shielded_send.rs:1406-1418(thread)
Review provenance
Source: reviewer 1: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 2: muse-spark-1.3-contributor (agent: phase1-reviewer, role: rust-quality); reviewer 3: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 4: gpt-6.1-sol (agent: phase2-reviewer, role: architecture-layering); reviewer 5: gpt-6.1-sol (agent: phase2-reviewer, role: ffi-engineer); reviewer 6: gpt-6.1-sol (agent: phase2-reviewer, role: rust-quality); reviewer 7: gpt-6.1-sol (agent: phase2-reviewer, role: security-auditor); final verifier: gpt-6.1-sol (agent: sol-verifier, role: final-verifier)
- Triage:
criticalbygpt-6.1-sol(effort low) — This is a large cross-language change that exposes an identity-debit shielded transfer, directly affecting funds movement and signer/FFI handling in shielded_send.rs and the JNI/Kotlin bindings. - Phase 1 reviewers:
muse-spark-1.3-contributor— general (completed, effort xhigh); agentphase1-reviewer,muse-spark-1.3-contributor— rust-quality (completed, effort xhigh); agentphase1-reviewer - Phase 1 model:
muse-spark-1.3-contributor— not quota-gated; passed overgemini-3.8-flash-high(antigravity quota lookup failed),glm-5.3-flash(not used above high effort; tier asks max) - Single stage: Phase 1 and Phase 2 reviewed this head side by side, with no blocker gate between them (triage tier)
- Fresh verifier:
gpt-6.1-sol— final-verifier; agentsol-verifier - Phase 2 reviewers:
gpt-6.1-sol— general (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— architecture-layering (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— ffi-engineer (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— rust-quality (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— security-auditor (completed, effort xhigh); agentphase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review (PastaClaw). How to work through them:
- Verify each finding against the code; fix only what is real, as narrowly as the finding.
- If a finding is wrong, decline it on its thread in one or two sentences; the bot answers once and stops.
- To defer one, link a tracking issue on its thread (or reply asking the bot to file one).
- Suggestions don't block the merge, but most are worth fixing in this PR; judge each on its merits.
- Keep the PR's scope; don't grow it to satisfy hardening suggestions.
- Carried items were raised in an earlier round: read the thread first, and don't re-fix what you already fixed, declined or deferred there. Disputed and deferred items are already handled and are not listed.
In `packages/kotlin-sdk/sdk/src/main/kotlin/org/dashfoundation/dashsdk/wallet/PlatformWalletManager.kt`:
- [SUGGESTION] packages/kotlin-sdk/sdk/src/main/kotlin/org/dashfoundation/dashsdk/wallet/PlatformWalletManager.kt:1924: Use opReturningCompletedResult for self-shield identity operations
The existing self-shield identity method still wraps its blocking native call in `teardownGate.op`, while the new third-party identity method uses `opReturningCompletedResult`. If cancellation occurs while the dispatcher hands control back after the native call has already debited the identity, `op` can discard the returned post-debit balance and expose only `CancellationException`. The caller then cannot distinguish a completed debit from a failed request and may retry after the durable guard is later reconciled; use the same completed-result handoff as the sibling method.
In `packages/rs-platform-wallet-ffi/src/shielded_send.rs`:
- [SUGGESTION] packages/rs-platform-wallet-ffi/src/shielded_send.rs:1432-1449: Trigger recovery sync for ambiguous identity shields
(carried; thread: https://github.com/dashpay/platform/pull/5896#discussion_r4561681227)
- [SUGGESTION] packages/rs-platform-wallet-ffi/src/shielded_send.rs:1406-1418: Factor optional memo C-string decoding into a shared helper
(carried; thread: https://github.com/dashpay/platform/pull/5896#discussion_r4561681219)
|
Bots are done — your move: post |
Issue being fixed or feature implemented
The Android Dash wallet's External Send (MO-1121) needs to shield credits from an identity's balance to someone else's Orchard address.
shieldedShieldFromIdentityalways targets the wallet's own address.The Rust wallet method
PlatformWallet::shielded_shield_from_identity_to_recipientalready exists. This PR adds its FFI export, JNI bridge and Kotlin binding.Builds on #5873 (Kotlin
shieldedShieldToRecipient, merged intov5.2-dev); this PR is rebased ontov5.2-devafter that merge.Overlap with #5863 (Swift
shieldedShieldFromIdentityToRecipient): both PRs add the FFI exportplatform_wallet_manager_shielded_shield_from_identity_to_recipientwith the same nine-parameter signature (agreed on #5863). Whichever merges second must drop its copy of the export and keep the other. #5863's copy also checks the identity's proved balance before arming the debit guard, so if #5863 lands first, this PR drops its FFI export and keeps only the JNI and Kotlin layers.What was done?
FFI: new export
platform_wallet_manager_shielded_shield_from_identity_to_recipientinrs-platform-wallet-ffi/src/shielded_send.rs. It follows theshield_to_recipientexport:catch_spend_panic, so a panic comes back asErrorShieldedSpendUnconfirmed(18) instead of aborting the host;encode_memo_textbefore the wallet is resolved;out_new_balance(nullable) is written only on success;map_spend_result, which keepsErrorShieldedIdentityDebitPending(55) distinct from 18.The identity-debit guard in
rs-platform-walletis unchanged.JNI: new export
FundingNative.shieldedShieldFromIdentityToRecipientinrs-unified-sdk-jni/src/funding.rs, which returns the identity's balance after the debit. It reusesread_id32,read_recipient43andread_cstring_opt, and rejects only what marshalling requires: negative values (before the unsigned cast), a null signer handle, and mis-sized ids.Kotlin: new
PlatformWalletManager.shieldedShieldFromIdentityToRecipient(walletId, identityId, recipientRaw43, amount, shieldedAccount = 0, memo = null): Long. It maps errors throughmapNativeErrorsand signs with the identity signer, asshieldedShieldFromIdentitydoes. It runs inteardownGate.opReturningCompletedResult(feat(kotlin-sdk): partial-amount platform-address withdrawal #5830), asshieldedShieldToRecipient(feat(kotlin-sdk): bind Platform → third-party Orchard shield (shieldedShieldToRecipient) #5873) does. Its KDoc states that:shieldedShieldFromIdentity;ShieldedSpendUnconfirmedorShieldedIdentityDebitPending, because a retry could debit the identity twice;CancellationException.Validation lives once: following the book, the zero-amount check, the memo rules and the own-address rejection stay in Rust. Kotlin and JNI only marshal.
PARITY.mdnotes the binding as SDK only on theSendTransactionViewrow. Swift has no identity-to-recipient API; the SDK parity manifest doesn't list the shield FFIs, so it andPARITY_SUMMARY.mdare unchanged.How Has This Been Tested?
cargo fmton the touched files, andcargo clippy --all-targets -D warningsonplatform-wallet-ffi(withshielded) andrs-unified-sdk-jni.cargo test -p platform-wallet-ffi --features shielded shielded_send(33 passed), including three new tests:ErrorNullPointer;ErrorInvalidHandle, without_new_balanceleft untouched.cargo test -p rs-unified-sdk-jni(72 passed) and./gradlew :sdk:testDebugUnitTest.ShieldFromIdentityToRecipientBindingTest, which needs no wallet, network or funds. It passed 6/6 on an x86_64 API 36 emulator against alibdash_sdk_jni.sofreshly built from0bc049d620, this PR's head before the rebase ontov5.2-dev(run together with feat(kotlin-sdk): bind Platform → third-party Orchard shield (shieldedShieldToRecipient) #5873'sShieldToRecipientBindingTest: 13/13 in all). The rebase left this PR's diff unchanged; the emulator run was not repeated on the new base. It pins:encode_memo_text.Breaking Changes
None. The change only adds code.
Checklist:
structure.rs, regeneratedgrovedb-structure.json, and checked the structure viewer link posted on this pull requestFor repository code-owners and collaborators only
🤖 Generated with Claude Code
PR Hygiene ·
e8b644b/self-reviewedkotlin-sdk— you own itrs-platform-wallet-ffi(packages/rs-platform-wallet-ffi/src/shielded_send.rs) — ZocoLini or llbartekll or romchornyipackages/rs-unified-sdk-jni/src/funding.rs) — QuantumExplorer or shumkovWhen every merge requirement is met, the
PR Hygienecheck passes. Reviewer limits do not block merging; other required GitHub checks and protections still apply.