Skip to content

feat(kotlin-sdk): shield from identity to a third-party Orchard address - #5896

Merged
HashEngineering merged 10 commits into
v5.2-devfrom
feat/kotlin-sdk-identity-to-shielded
Nov 23, 2026
Merged

HashEngineering merged 10 commits into
v5.2-devfrom
feat/kotlin-sdk-identity-to-shielded

Conversation

@HashEngineering

@HashEngineering HashEngineering commented Nov 12, 2026 •

Copy link
Copy Markdown
Collaborator

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. shieldedShieldFromIdentity always targets the wallet's own address.

#5863 added the FFI export platform_wallet_manager_shielded_shield_from_identity_to_recipient (with Swift's binding) and a proved-balance check before an identity-funded shield is armed. This PR adds the JNI bridge and Kotlin binding over that export, and the Kotlin side of the check's new refusal.

Builds on #5873 (Kotlin shieldedShieldToRecipient), #5863 and #5860, all merged into v5.2-dev. An earlier version of this PR carried its own copy of the FFI export with the same signature; after #5863 merged, that copy was dropped, so this PR changes no Rust FFI code.

What was done?

  • JNI: new export FundingNative.shieldedShieldFromIdentityToRecipient in rs-unified-sdk-jni/src/funding.rs, which returns the funding identity's credit balance from the verified snapshot (not a receipt for this debit; binding the proof to execution is Bind affected-state proofs to transition execution #4270). It reuses read_id32, read_recipient43 and read_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 through mapNativeErrors and signs with the identity signer, as shieldedShieldFromIdentity does. It runs in teardownGate.opReturningCompletedResult (feat(kotlin-sdk): partial-amount platform-address withdrawal #5830), as shieldedShieldToRecipient (feat(kotlin-sdk): bind Platform → third-party Orchard shield (shieldedShieldToRecipient) #5873) does. Its KDoc states that:
    • Rust rejects a recipient the account's own IVK recognizes, so self-shields use shieldedShieldFromIdentity;
    • the memo may be at most 32 UTF-8 bytes;
    • InsufficientIdentityCredits (39) and IdentityBalanceUnavailable (58) are refusals before anything is signed or broadcast;
    • the caller must not retry on ShieldedSpendUnconfirmed or ShieldedIdentityDebitPending, because a retry could debit the identity twice;
    • if the native call returns a balance, cancellation during the handoff does not discard it, so a completed call is never hidden behind a CancellationException;
    • a successful return does not confirm that the debit executed or that the recipient received the note; the wallet confirms the outgoing activity when shielded sync observes it, so the balance is not a receipt.
  • Refusal KDocs (39, 58): for a shield, code 39's required is the amount plus DPP's admission fee floor, which the metered fee can undercut, so the KDocs say required - amount is not the fee charged. Both identity shields now describe their return as a balance snapshot, not a receipt.
  • More on the refusal KDocs: feat(swift-sdk): shieldedShieldFromIdentityToRecipient #5863's balance check refuses either identity shield with InsufficientIdentityCredits (39) or IdentityBalanceUnavailable (58, typed in Kotlin by feat(platform-wallet)!: top up an identity the wallet does not manage from Platform addresses #5860), so the KDocs of shieldedShieldFromIdentity and shieldedShieldFromIdentityToRecipient list both. InsufficientIdentityCredits' KDoc no longer describes only DPNS purchases, and says that only the identity shields refuse before signing (a DPNS purchase can get code 39 after Platform rejects a submitted transition). The new method's KDoc says sync only attempts to reconcile an ambiguous debit and points at shieldedIdentityDebitRecoveryRecords; a completed sync is not permission to resubmit.
  • Exact u64 amounts in typed errors: the JSON detail of codes 38-40 is now parsed with kotlinx.serialization instead of org.json. Android's org.json read a code-39 required above Long.MAX_VALUE (reachable here, since the amount may be up to Long.MAX_VALUE and Rust adds the fee in u64) as a Double, and the mapping fell back to PlatformWallet.Generic. String fields must now be JSON strings, so a null one fails closed to Generic.
  • Validation lives once: following the book, the zero-amount check, the memo rules, the balance check and the own-address rejection stay in Rust. Kotlin and JNI only marshal.
  • Parity: the manifest's shielded.shield_from_identity_to_recipient capability (added by feat(swift-sdk): shieldedShieldFromIdentityToRecipient #5863) now marks the Kotlin SDK supported, verified on device by ShieldFromIdentityToRecipientBindingTest; PARITY_SUMMARY.md is regenerated. PARITY.md notes the binding as SDK only, no UI, on the SendTransactionView row.

How Has This Been Tested?

  • cargo fmt and cargo clippy --all-targets -D warnings on rs-unified-sdk-jni; cargo test -p rs-unified-sdk-jni.

  • ./gradlew :sdk:testDebugUnitTest, including new DpnsMarketplaceErrorTest cases for a code-39 u64::MAX amount, a non-string identityId and code 40 (the first two fail against the old org.json parser).

  • python3 scripts/check_sdk_parity_manifest.py.

  • New instrumented ShieldFromIdentityToRecipientBindingTest, which needs no wallet, network or funds, run on an x86_64 API 36 emulator against a libdash_sdk_jni.so freshly built from this PR's head (that is, against feat(swift-sdk): shieldedShieldFromIdentityToRecipient #5863's export). It uses a real native signer over a bridge that holds no keys, so no call dereferences a bogus pointer. It pins:

    • the JNI symbol and descriptor;
    • each JNI boundary rejection (raw code 1, with a message naming the argument, which also pins the order of the two 32-byte ids);
    • a zero amount and well-formed calls reaching the FFI's invalid-handle path;
    • an over-limit memo being rejected by Rust's encode_memo_text;
    • through the public PlatformWalletManager method on a live, empty, offline manager, the FFI's wallet lookup naming the wallet id it received, so the two 32-byte ids cannot be swapped between Kotlin and the FFI unnoticed (checked by swapping them in the wrapper, which fails the test).

    Result: 14/14 together with ShieldToRecipientBindingTest on emulator (Pixel 9 Pro, API 36).

Known gap (Rust, not addressed here)

removeWallet and clearShieldedStorage do not wait for an in-flight identity debit, and Rust's NetworkShieldedCoordinator::clear → FileBackedShieldedStore::purge_all_subwallets deletes every shielded_pending_spends row, including an unresolved identity-debit guard (also after a ShieldedSpendUnconfirmed return). A later call could then sign again. This is pre-existing and applies equally to shieldedShieldFromIdentity, the other Kotlin shielded spends and Swift's clearShielded. Whether destructive operations may run while an identity debit is unresolved is a decision about Rust-owned wallet state, so it belongs in rs-platform-wallet; the live spend/clear exclusion is tracked in #5868. An earlier revision of this PR added a Kotlin-side admission counter; it was reverted because it covered only this wrapper and only the live call.

Breaking Changes

None. Code 39 and 40 details that are malformed (for example a null string field) now map to PlatformWallet.Generic instead of a typed error carrying the text "null".

Checklist:

  • I have performed a self-review of my own code
  • My Rust, FFI, WASM, Swift or Kotlin changes follow the coding conventions
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated relevant unit/integration/functional/e2e tests
  • I have added "!" to the title and described breaking changes in the corresponding section if my code contains any
  • I have made corresponding changes to the documentation if needed
  • If I added or changed GroveDB structure, I described it in the area's structure.rs, regenerated grovedb-structure.json, and checked the structure viewer link posted on this pull request
  • If I added or changed a system contract's document schemas, I checked the contract viewer link posted on this pull request

For repository code-owners and collaborators only

  • I have assigned this pull request to a milestone

🤖 Generated with Claude Code

PR Hygiene · defca9c

  • Bots — thepastaclaw ✓
  • Self-review — posted; again after any push
  • Build green
  • Approvals — you own every area touched; none needed

When every merge requirement is met, the PR Hygiene check passes. Reviewer limits do not block merging; other required GitHub checks and protections still apply.

@coderabbitai

coderabbitai Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · 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.

Share

@thepastaclaw

thepastaclaw commented Nov 12, 2026 •

Copy link
Copy Markdown
Collaborator

⚡ Priority review — starts as soon as a slot frees (commit defca9c) · queue and estimated start

@thepastaclaw thepastaclaw left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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: critical by gpt-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); agent phase1-reviewer, muse-spark-1.3-contributor — rust-quality (completed, effort xhigh); agent phase1-reviewer
  • Phase 1 model: muse-spark-1.3-contributor — not quota-gated; passed over gemini-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; agent sol-verifier
  • Phase 2 reviewers: gpt-6.1-sol — general (completed, effort xhigh); agent phase2-reviewer, gpt-6.1-sol — architecture-layering (completed, effort xhigh); agent phase2-reviewer, gpt-6.1-sol — ffi-engineer (completed, effort xhigh); agent phase2-reviewer, gpt-6.1-sol — rust-quality (completed, effort xhigh); agent phase2-reviewer, gpt-6.1-sol — security-auditor (completed, effort xhigh); agent phase2-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_shield and platform_wallet_manager_shielded_shield_from_identity exports call block_on_worker without catch_spend_panic. Since block_on_worker re-panics when its proving task panics, an unwind can abort the host at the extern "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_panic and adds panic-to-ErrorShieldedSpendUnconfirmed coverage matching the existing guard tests.

@HashEngineering
HashEngineering force-pushed the feat/kotlin-sdk-shield-to-recipient branch from fbeb778 to bc2a892 Compare November 13, 2026 06:36
romchornyi added a commit that referenced this pull request Nov 13, 2026
…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 <[email protected]>
@HashEngineering
HashEngineering force-pushed the feat/kotlin-sdk-identity-to-shielded branch from 8b08328 to 0bc049d Compare November 13, 2026 07:16

@thepastaclaw thepastaclaw left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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: critical by gpt-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); agent phase1-reviewer, muse-spark-1.3-contributor — rust-quality (completed, effort xhigh); agent phase1-reviewer
  • Phase 1 model: muse-spark-1.3-contributor — not quota-gated; passed over gemini-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; agent sol-verifier
  • Phase 2 reviewers: gpt-6.1-sol — general (completed, effort xhigh); agent phase2-reviewer, gpt-6.1-sol — architecture-layering (completed, effort xhigh); agent phase2-reviewer, gpt-6.1-sol — ffi-engineer (completed, effort xhigh); agent phase2-reviewer, gpt-6.1-sol — rust-quality (completed, effort xhigh); agent phase2-reviewer, gpt-6.1-sol — security-auditor (completed, effort xhigh); agent phase2-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_identity directly awaits block_on_worker, whose worker join uses expect and can panic if the proving task panics. Unlike the new export and the address-funded recipient shield, this existing extern "C" function has no catch_spend_panic boundary, 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.

@HashEngineering
HashEngineering force-pushed the feat/kotlin-sdk-shield-to-recipient branch from bc2a892 to 22006a2 Compare November 13, 2026 23:03
Base automatically changed from feat/kotlin-sdk-shield-to-recipient to v5.2-dev November 16, 2026 07:10
@github-actions github-actions Bot added this to the v5.2.0 milestone Nov 16, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Bots are done — your move: post /self-reviewed.
Full checklist in the description.

@github-actions github-actions Bot added the waiting-self-review Waiting for the author to post /self-reviewed label Nov 16, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Bots are done — your move: post /self-reviewed.
Full checklist in the description.

@HashEngineering
HashEngineering force-pushed the feat/kotlin-sdk-identity-to-shielded branch from 0bc049d to e8b644b Compare November 16, 2026 07:25
@github-actions

github-actions Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Waiting for bot review — thepastaclaw not yet. Wait for the missing reviews, or a writer can post /skip-bots to proceed without them; blocking findings still need addressing.
Full checklist in the description.

@github-actions github-actions Bot added waiting-bots Waiting for the review bots to report on this head and removed waiting-self-review Waiting for the author to post /self-reviewed labels Nov 16, 2026

@thepastaclaw thepastaclaw left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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: critical by gpt-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); agent phase1-reviewer, muse-spark-1.3-contributor — rust-quality (completed, effort xhigh); agent phase1-reviewer
  • Phase 1 model: muse-spark-1.3-contributor — not quota-gated; passed over gemini-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; agent sol-verifier
  • Phase 2 reviewers: gpt-6.1-sol — general (completed, effort xhigh); agent phase2-reviewer, gpt-6.1-sol — architecture-layering (completed, effort xhigh); agent phase2-reviewer, gpt-6.1-sol — ffi-engineer (completed, effort xhigh); agent phase2-reviewer, gpt-6.1-sol — rust-quality (completed, effort xhigh); agent phase2-reviewer, gpt-6.1-sol — security-auditor (completed, effort xhigh); agent phase2-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)

@github-actions

Copy link
Copy Markdown
Contributor

Bots are done — your move: post /self-reviewed.
Full checklist in the description.

@github-actions github-actions Bot added waiting-self-review Waiting for the author to post /self-reviewed and removed waiting-bots Waiting for the review bots to report on this head labels Nov 16, 2026
@HashEngineering
HashEngineering force-pushed the feat/kotlin-sdk-identity-to-shielded branch from e8b644b to 5b65609 Compare November 19, 2026 19:13
@github-actions

github-actions Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Waiting for bot review — thepastaclaw not yet. Wait for the missing reviews, or a writer can post /skip-bots to proceed without them; blocking findings still need addressing.
Full checklist in the description.

@github-actions github-actions Bot added waiting-bots Waiting for the review bots to report on this head and removed waiting-self-review Waiting for the author to post /self-reviewed labels Nov 19, 2026

@thepastaclaw thepastaclaw left a comment •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-review — Final validation — Phase 1 + Phase 2

Updated after discussion: 1 finding(s) of this review were settled in the inline threads; 1 blocking finding(s) still stand.

  • ✅ Withdrawn: 🟡 Use one public error type for malformed shield arguments

The Kotlin/JNI bridge matches the Rust export, but the new admission gate protects only one Kotlin manager and only while the call is running. The Rust reset path can still erase the recovery record for an unresolved identity debit, so the funds-safety check belongs in the Rust wallet. The Kotlin emulator and Rust workspace checks passed on this head; PR Hygiene and PastaClaw review were pending.

🔴 1 blocking | 🟡 3 2 suggestion(s)

Follow-up candidates (optional) (1)

New non-blocking observations on code unchanged since the last full review. No inline threads are opened for them and later reviews do not repeat them: fix forward or track separately if they are worth it.

🟡 Suggestion: Pass a live signer to tests that reach the Rust export
packages/kotlin-sdk/sdk/src/androidTest/kotlin/org/dashfoundation/dashsdk/wallet/ShieldFromIdentityToRecipientBindingTest.kt:43-44

The dead manager is a registry ID that Rust can safely reject, but DUMMY_SIGNER = 1L becomes a raw pointer. The FFI contract requires a live callback signer even when the manager ID is invalid. The test passes today only because Rust resolves the manager before borrowing the signer; a valid refactor could reverse those steps and crash instrumentation. Create a signer with SignerNative.createSigner and a no-key bridge, then destroy it in cleanup. Keep 0L for the explicit JNI null-signer test.

source: gpt-6.2-astra (phase2-reviewer: general, architecture-layering, ffi-engineer, rust-quality, security-auditor)

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.2-astra (agent: phase2-reviewer, role: general); reviewer 4: gpt-6.2-astra (agent: phase2-reviewer, role: architecture-layering); reviewer 5: gpt-6.2-astra (agent: phase2-reviewer, role: ffi-engineer); reviewer 6: gpt-6.2-astra (agent: phase2-reviewer, role: rust-quality); reviewer 7: gpt-6.2-astra (agent: phase2-reviewer, role: security-auditor); final verifier: gpt-6.2-sol (agent: sol-verifier, role: final-verifier)

  • Triage: critical by gpt-6.2-sol (effort low) — PlatformWalletManager.shieldedShieldFromIdentityToRecipient opens a new funds-movement path in Kotlin whose cancellation and teardown coordination must preserve the completed debit result and prevent deletion of the durable retry record while payment is in flight.
  • Phase 1 reviewers: muse-spark-1.3-contributor — general (completed, effort xhigh); agent phase1-reviewer, muse-spark-1.3-contributor — rust-quality (completed, effort xhigh); agent phase1-reviewer
  • Phase 1 model: muse-spark-1.3-contributor — not quota-gated; passed over gemini-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)
  • Code unchanged since the last final review (e8b644b7): 1 new suggestion(s) listed as follow-up candidates, not posted inline
  • Fresh verifier: gpt-6.2-sol — final-verifier; agent sol-verifier
  • Phase 2 reviewers: gpt-6.2-astra — general (completed, effort high); agent phase2-reviewer, gpt-6.2-astra — architecture-layering (completed, effort high); agent phase2-reviewer, gpt-6.2-astra — ffi-engineer (completed, effort high); agent phase2-reviewer, gpt-6.2-astra — rust-quality (completed, effort high); agent phase2-reviewer, gpt-6.2-astra — security-auditor (completed, effort high); agent phase2-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/NativeOpAdmission.kt`:
- [BLOCKING] packages/kotlin-sdk/sdk/src/main/kotlin/org/dashfoundation/dashsdk/wallet/NativeOpAdmission.kt:24-47: Protect unresolved identity debits in the Rust wallet
  This counter decides whether destructive operations may touch Rust-owned wallet state. The book’s “FFI and mobile SDKs hold no business logic” rule puts that decision in `rs-platform-wallet`, not in a binding. Only the recipient wrapper enters this gate: the self-shield reaches the same Rust implementation without it, while a recipient send from wallet A blocks removal of unrelated wallet B. Separate managers can also open the same SQLite path because `configure_shielded` checks only its own coordinator slot. A reset through the second manager can therefore delete the first manager’s pending row while the send is still running. Even with one manager, the counter drops on `ShieldedSpendUnconfirmed`; following the new “retry once it returns” guidance can then reach `purge_all_subwallets`, which deletes the row needed to recover the original debit and refuse a fresh one after rebind or reopen. Enforce live exclusion in Rust at the shared store boundary (or enforce exclusive store ownership), scope removal to the affected wallet, and refuse destructive operations before mutation or preserve and rehydrate unresolved guards. Keep `TeardownGate` for the separate signer-lifetime concern. Cover both overlapping access to one store and reset after an ambiguous return, and update the clear and removal KDocs to distinguish call completion from reconciliation.

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:2004-2006: Decode code 39 credit amounts without losing unsigned precision
  The new method accepts `Long.MAX_VALUE`, and Rust adds the positive shield fee floor in `u64` before checking the balance. The FFI can therefore return code 39 with an unquoted `required` above `Long.MAX_VALUE`. Android’s `JSONObject` reads that token as a `Double`, and `requiredULong` then fails to parse its scientific notation, so `DashSdkError` returns `PlatformWallet.Generic` instead of the documented typed refusal. Decode the original numeric token as `ULong`, as `DocumentHistory.kt` does, and cover an unquoted value above the signed range in a mapping test.
- [SUGGESTION → WITHDRAWN in discussion; do not fix] packages/kotlin-sdk/sdk/src/main/kotlin/org/dashfoundation/dashsdk/wallet/PlatformWalletManager.kt:2051-2061: Use one public error type for malformed shield arguments
  A malformed `walletId` reaches JNI and is mapped to `DashSdkError.InvalidParameter`, while a malformed `identityId` throws `IllegalArgumentException` from `require`. JNI already checks both ID widths, the recipient width, and signed inputs before passing pointers or casting values. Let those checks report through `mapNativeErrors` so a caller can handle malformed arguments consistently.

In `packages/kotlin-sdk/sdk/src/main/kotlin/org/dashfoundation/dashsdk/errors/DashSdkError.kt`:
- [SUGGESTION] packages/kotlin-sdk/sdk/src/main/kotlin/org/dashfoundation/dashsdk/errors/DashSdkError.kt:515-518: Scope the no-broadcast guarantee to identity shield preflight
  Code 39 does not tell callers whether a transition was submitted. A DPNS purchase can pass its local preflight and receive `IdentityInsufficientBalanceError` from Platform; `promote_document_trade_error` maps that rejection to the same `InsufficientIdentityCredits` type. Keep the stronger guarantee on the shield methods, where the proved-balance check really does precede signing.
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.

  • Preserve completed results for the existing Kotlin self-shield — The base self-shield uses teardownGate.op, so cancellation on the return dispatch can hide a successful debit. This PR changes that method’s refusal KDoc, not its dispatch or execution path.
    • Follow-up: Use opReturningCompletedResult in a separate Kotlin SDK PR and test cancellation after native success.

@github-actions

Copy link
Copy Markdown
Contributor

Your move: thepastaclaw requested changes on this head; dismiss the review or push a fix; thepastaclaw left review threads unresolved; resolve them.
Full checklist in the description.

@github-actions github-actions Bot added waiting-self-review Waiting for the author to post /self-reviewed and removed waiting-bots Waiting for the review bots to report on this head labels Nov 19, 2026
@github-actions

github-actions Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Your move: thepastaclaw left review threads unresolved; resolve them.
Full checklist in the description.

@thepastaclaw thepastaclaw left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-review — Final validation — Phase 1 + Phase 2

No blocking issue found at 0ff4392. The recipient API now correctly describes its return as a balance snapshot, not a payment receipt; the remaining findings concern memo marshalling, documentation, and binding-test coverage. The Kotlin emulator build and tests and the Rust workspace tests passed; PR Hygiene and the automated review were pending.

🟡 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: Describe the self-shield return as a balance snapshot too
packages/kotlin-sdk/sdk/src/main/kotlin/org/dashfoundation/dashsdk/wallet/PlatformWalletManager.kt:1932-1934

The new recipient KDoc links to shieldedShieldFromIdentity, but the self-shield KDoc still calls its result a proven post-debit balance and says the balance proof confirms the operation. Both methods use the same Rust implementation: it accepts a verified balance snapshot, can return a newer cached balance, and leaves the activity pending until the shielded scan observes the note commitments. Align the self-shield return documentation so callers do not infer a stronger guarantee from the linked method.

     * @return the funding identity's credit balance from the verified snapshot,
     *   or a newer balance already known to the wallet. This balance does not
     *   confirm the debit; the shielded scan confirms the activity separately.

source: muse-spark-1.3-contributor (phase1-reviewer: general)

Follow-up candidates (optional) (1)

New non-blocking observations on code unchanged since the last full review. No inline threads are opened for them and later reviews do not repeat them: fix forward or track separately if they are worth it.

🟡 Suggestion: Test wallet-ID forwarding through the public Kotlin method
packages/kotlin-sdk/sdk/src/androidTest/kotlin/org/dashfoundation/dashsdk/wallet/ShieldFromIdentityToRecipientBindingTest.kt:155-162

The width tests distinguish the IDs at JNI entry, but every call goes directly through FundingNative with a dead manager. Swapping the two valid 32-byte IDs in the public wrapper or in the JNI-to-FFI call would still pass. Add an offline case that calls PlatformWalletManager.shieldedShieldFromIdentityToRecipient on a live, empty manager with distinct IDs and checks that the mapped WalletOperation names the supplied wallet ID. The FFI returns wallet not found with that ID before it requires a configured shielded coordinator or does network work.

source: gpt-6.2-astra (phase2-reviewer: general, architecture-layering, ffi-engineer, security-auditor)

Review provenance

Source: reviewer 1: gpt-6.2-astra (agent: phase2-reviewer, role: general); reviewer 2: gpt-6.2-astra (agent: phase2-reviewer, role: architecture-layering); reviewer 3: gpt-6.2-astra (agent: phase2-reviewer, role: ffi-engineer); reviewer 4: gpt-6.2-astra (agent: phase2-reviewer, role: security-auditor); reviewer 5: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 6: gpt-6.2-astra (agent: phase2-reviewer, role: general); reviewer 7: gpt-6.2-astra (agent: phase2-reviewer, role: architecture-layering); reviewer 8: gpt-6.2-astra (agent: phase2-reviewer, role: ffi-engineer); reviewer 9: gpt-6.2-astra (agent: phase2-reviewer, role: security-auditor); final verifier: gpt-6.2-sol (agent: sol-verifier, role: final-verifier)

  • Triage: critical by gpt-6.2-sol (effort low) — This is a sizable cross-language change that exposes identity-funded shielding to a third-party recipient, directly affecting funds movement, signing, and JNI marshalling in FundingNative and PlatformWalletManager.
  • Phase 1 reviewers: muse-spark-1.3-contributor — general (completed, effort xhigh); agent phase1-reviewer
  • Phase 1 model: muse-spark-1.3-contributor — not quota-gated; passed over gemini-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 final gate: an independent Phase-2 review ran after iterative findings were reconciled
  • Code unchanged since the last final review (edf8c891): 1 new nitpick(s) dropped; 1 new suggestion(s) listed as follow-up candidates, not posted inline
  • Fresh verifier: gpt-6.2-sol — final-verifier; agent sol-verifier
  • Phase 2 reviewers: gpt-6.2-astra — general (completed, effort high); agent phase2-reviewer, gpt-6.2-astra — architecture-layering (completed, effort high); agent phase2-reviewer, gpt-6.2-astra — ffi-engineer (completed, effort high); agent phase2-reviewer, gpt-6.2-astra — security-auditor (completed, effort high); agent phase2-reviewer, gpt-6.2-astra — general (completed, effort high); agent phase2-reviewer, gpt-6.2-astra — architecture-layering (completed, effort high); agent phase2-reviewer, gpt-6.2-astra — ffi-engineer (completed, effort high); agent phase2-reviewer, gpt-6.2-astra — security-auditor (completed, effort high); agent phase2-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/rs-unified-sdk-jni/src/funding.rs`:
- [SUGGESTION] packages/rs-unified-sdk-jni/src/funding.rs:920-925: Reject malformed UTF-16 before sending a recipient memo
  This new payment path uses `read_cstring_opt`, whose `env.get_string(...).into()` conversion falls back to lossy decoding in the pinned `jni` 0.21.1. A Java string containing an unpaired surrogate can therefore become replacement characters before it reaches `encode_memo_text`. If the substituted text fits the 32-byte limit, Rust accepts it and the recipient can receive a different memo from the one the caller supplied. Decode strictly in the shared JNI reader, before the FFI call, and test both an unpaired surrogate and a valid supplementary character. Leave the memo length rule in Rust.

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:1984-1985: Distinguish the admission fee floor from the fee charged
  `shield_from_identity_to` calculates code 39's `required` by adding `compute_shielded_identity_balance_write_fee(2, ...)` to the amount. DPP defines that value as the admission floor and explicitly says the metered execution fee can be lower. An External Send caller should not display `requiredCredits - amount` as the fee that would be charged. Make the same distinction in the self-shield refusal paragraph and the `InsufficientIdentityCredits` KDoc.
- [SUGGESTION] packages/kotlin-sdk/sdk/src/main/kotlin/org/dashfoundation/dashsdk/wallet/PlatformWalletManager.kt:1932-1934: Describe the self-shield return as a balance snapshot too
  The new recipient KDoc links to `shieldedShieldFromIdentity`, but the self-shield KDoc still calls its result a proven post-debit balance and says the balance proof confirms the operation. Both methods use the same Rust implementation: it accepts a verified balance snapshot, can return a newer cached balance, and leaves the activity pending until the shielded scan observes the note commitments. Align the self-shield return documentation so callers do not infer a stronger guarantee from the linked method.
Out-of-scope follow-up suggestions (2)

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.

  • Protect unresolved identity debits across wallet reset and removal — The existing Rust reset and removal paths can delete the durable records that prevent a second identity debit. The Kotlin binding calls the same native implementation already used by Swift and direct C callers; it does not change when the guard is written or deleted.
    • Follow-up: Complete #6011 in the Rust wallet, with #5868 covering live-operation exclusion and wallet-level tests covering reset and removal both during the send and after an ambiguous return.
  • Correct the balance and recovery guarantees in the C export documentation — The unchanged C export documentation from #5863 still calls the result a proven post-debit balance and promises reconciliation on the next sync. Direct callers need the same distinction now made in Kotlin: a balance snapshot is not a payment receipt, and a sync can leave a debit unresolved.
    • Follow-up: Update the Rust FFI documentation in a separate PR. Keep execution-proof binding under #4270.

@github-actions

Copy link
Copy Markdown
Contributor

Your move: thepastaclaw left review threads unresolved; resolve them.
Full checklist in the description.

HashEngineering and others added 2 commits November 20, 2026 09:12
… floor accurately

- shieldedShieldFromIdentity (and its FundingNative/JNI docs) called its
  result a proven post-debit balance, as the recipient variant did before
  0ff4392. Both use the same Rust path: a verified balance snapshot or
  a newer known balance, with the activity confirmed by the shielded scan.
- For a shield, code 39's `required` is the amount plus DPP's admission
  fee floor (compute_shielded_identity_balance_write_fee), which the
  metered fee can undercut. Say so in both shields' refusal paragraphs and
  in InsufficientIdentityCredits, so a caller does not show
  required - amount as the fee charged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…y-to-recipient shield

walletId and identityId are both 32 bytes, so the JNI width checks cannot
tell them apart and every existing case calls FundingNative directly with
a dead handle. Call PlatformWalletManager.shieldedShieldFromIdentityToRecipient
on a live, empty, offline manager with distinct ids: the FFI resolves the
wallet first and fails with "wallet not found: <hex wallet id>" before it
needs a coordinator, signer or network. Swapping the ids in the wrapper
makes this test fail with the identity id in that message.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions

github-actions Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Your move: thepastaclaw left review threads unresolved; resolve them.
Full checklist in the description.

@HashEngineering HashEngineering self-assigned this Nov 20, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Waiting for bot review — thepastaclaw not yet. Wait for the missing reviews, or a writer can post /skip-bots to proceed without them; blocking findings still need addressing.
Full checklist in the description.

@github-actions github-actions Bot added waiting-bots Waiting for the review bots to report on this head and removed waiting-self-review Waiting for the author to post /self-reviewed labels Nov 20, 2026

@thepastaclaw thepastaclaw left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-review — Final validation — Phase 1 + Phase 2

The Kotlin and JNI additions correctly forward the identity, recipient, amount, memo, and signer to the existing Rust export, and the documented balance/error semantics are now aligned. One in-scope suggestion remains: the new paid-memo path reuses a JNI conversion that can lossily replace an unpaired UTF-16 surrogate before Rust validates the memo; no tracking issue is linked for the proposed shared-decoder follow-up. Kotlin emulator and Rust workspace checks passed, with review and PR Hygiene checks still pending.

🔴 0 blocking | 🟡 0 suggestion(s) | 💬 0 nitpick(s)

Review provenance

Source: reviewer 1: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 2: gpt-6.2-astra (agent: phase2-reviewer, role: general); reviewer 3: gpt-6.2-astra (agent: phase2-reviewer, role: architecture-layering); reviewer 4: gpt-6.2-astra (agent: phase2-reviewer, role: ffi-engineer); reviewer 5: gpt-6.2-astra (agent: phase2-reviewer, role: security-auditor); final verifier: gpt-6.2-sol (agent: sol-verifier, role: final-verifier)

  • Triage: critical by gpt-6.2-sol (effort low) — The sizable cross-language change directly exposes identity-funded shielding and amount/error handling for funds movement in the JNI and Kotlin wallet APIs.
  • Phase 1 reviewers: muse-spark-1.3-contributor — general (completed, effort xhigh); agent phase1-reviewer
  • Phase 1 model: muse-spark-1.3-contributor — not quota-gated; passed over gemini-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.2-sol — final-verifier; agent sol-verifier
  • Phase 2 reviewers: gpt-6.2-astra — general (completed, effort high); agent phase2-reviewer, gpt-6.2-astra — architecture-layering (completed, effort high); agent phase2-reviewer, gpt-6.2-astra — ffi-engineer (completed, effort high); agent phase2-reviewer, gpt-6.2-astra — security-auditor (completed, effort high); agent phase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review. Verify the current code and confirm that no unresolved issues remain.

No unresolved findings remain from the prior review on this head.
Out-of-scope follow-up suggestions (2)

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.

  • Align Swift and C export documentation with the balance contract — The unchanged Swift wrapper and Rust C export still describe the returned identity balance as a proven post-debit balance, while the Kotlin documentation now correctly explains that it is a balance snapshot and does not confirm execution of this particular debit.
    • Follow-up: Open a follow-up documentation PR updating the Swift wrapper and Rust C export comments to distinguish the returned balance from confirmation of the outgoing activity.
  • Use one public error type for malformed shield arguments — Withdrawn because this wrapper follows the existing sibling convention of using Kotlin preconditions for fixed-width and signed arguments; changing only this method would create an inconsistent public contract, while a uniform migration is outside this binding-only change.
    • Follow-up: Consider creating a separate issue or author/maintainer-requested PR for this.

@github-actions

Copy link
Copy Markdown
Contributor

Bots are done — your move: post /self-reviewed.
Full checklist in the description.

@github-actions github-actions Bot added waiting-self-review Waiting for the author to post /self-reviewed and removed waiting-bots Waiting for the review bots to report on this head labels Nov 20, 2026
@HashEngineering

Copy link
Copy Markdown
Collaborator Author

/self-reviewed

@github-actions

Copy link
Copy Markdown
Contributor

Policy satisfied — this can merge.
Full checklist in the description.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants