Skip to content

fix(platform-wallet): poll platform-address transfer FFI on the big-stack worker#3989

Merged
QuantumExplorer merged 1 commit into
v4.0-devfrom
fix/transfer-ffi-worker-stack
Jul 3, 2026
Merged

fix(platform-wallet): poll platform-address transfer FFI on the big-stack worker#3989
QuantumExplorer merged 1 commit into
v4.0-devfrom
fix/transfer-ffi-worker-stack

Conversation

@QuantumExplorer

Copy link
Copy Markdown
Member

Issue being fixed or feature implemented

platform_address_wallet_transfer polls its proof-verifying future with runtime().block_on on the caller's thread. The transfer future verifies the execution proof, and GroveDB proof verification recurses past the ~512 KB stacks of iOS dispatch / Swift-concurrency threads — the exact EXC_BAD_ACCESS class runtime.rs documents — crashing after the funds moved on-chain but before the changeset reached the caller. The sibling withdraw entry points get the same fix in #3923; this covers the last platform-address spend path.

What was done?

Mirror the established pattern (fund_from_asset_lock, identity_top_up, the #3923 withdraw fix): clone the wallet out of handle storage (releasing the storage read lock before network work), round-trip the signer pointer through usize so the future is Send + 'static, and poll via block_on_worker on the 8 MB-stack worker.

How Has This Been Tested?

cargo check -p platform-wallet-ffi and cargo fmt --all -- --check clean. No signature changes — no header regen or Swift-side changes needed. The identical pattern is exercised by the sibling flows' existing coverage.

Breaking Changes

None.

Checklist:

  • I have performed a self-review of my own code
  • 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

🤖 Generated with Claude Code

…tack worker

platform_address_wallet_transfer polled its proof-verifying future
with runtime().block_on on the caller's thread — the same GroveDB
proof-verification recursion class runtime.rs warns about, which
overflows the ~512KB stacks of iOS dispatch / Swift-concurrency
threads with EXC_BAD_ACCESS after the funds moved but before the
changeset reached the caller. The sibling withdraw entry points were
fixed the same way in #3923; this brings the last platform-address
spend path onto block_on_worker, cloning the wallet out of handle
storage first so the storage read lock also releases before network
work.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 3, 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

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: b7572d2b-ad8f-4151-abd4-a7af732cc6b7

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
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/transfer-ffi-worker-stack

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

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added this to the v4.0.0 milestone Jul 3, 2026
@thepastaclaw

thepastaclaw commented Jul 3, 2026

Copy link
Copy Markdown
Collaborator

✅ Review complete (commit 091b53f)

@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.

Code Review

PR #3989 is a focused, single-file FFI fix moving platform_address_wallet_transfer off runtime().block_on on the caller's small-stack thread onto block_on_worker (8 MB worker stack), matching the established pattern used by other spend paths. The wallet is cloned out of handle storage before the long network+proof-verification round-trip so the storage read lock releases early, and the signer pointer is round-tripped through usize to satisfy Send + 'static — a pattern proven safe elsewhere in the crate since block_on_worker synchronously blocks the caller. No in-scope defects were found by any reviewer.

Source: reviewers: opus (general), claude-sonnet-5 (general), gpt-5.5[high] (general, failed_or_unparseable), opus (ffi-engineer), claude-sonnet-5 (ffi-engineer), gpt-5.5[high] (ffi-engineer, failed_or_unparseable); verifier: opus; specialists: ffi-engineer

@QuantumExplorer QuantumExplorer changed the title fix(platform-wallet-ffi): poll platform-address transfer on the big-stack worker fix(platform-wallet): poll platform-address transfer FFI on the big-stack worker Jul 3, 2026
@QuantumExplorer QuantumExplorer merged commit 9cb1f45 into v4.0-dev Jul 3, 2026
20 of 22 checks passed
@QuantumExplorer QuantumExplorer deleted the fix/transfer-ffi-worker-stack branch July 3, 2026 05:56
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.

2 participants