feat(vault): split pegin fix#1823
Conversation
🔐 Commit Signature Verification✅ All 7 commit(s) passed verification
Summary
Required key type: Last verified: 2026-06-03 07:02 UTC |
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
Greptile SummaryThis PR updates the vault peg-in flow for split deposits and new provider failure states. The main changes are:
Confidence Score: 4/5This is close, but the split warning display should be fixed before merging.
Important Files Changed
Reviews (1): Last reviewed commit: "chore(pr): false payout" | Re-trigger Greptile |
jrwbabylonlab
left a comment
There was a problem hiding this comment.
Approved with some comments & questions
Summary
This PR fixes split peg-in progress and resume behavior in the vault app. The main problem was that the initial deposit modal could show a split vault as completed even when that vault had not actually submitted WOTS keys or signed payouts, and after fixing WOTS we uncovered another false failure where the modal tried payout signing before the vault provider was ready.
What changed
IngestionRejectedas a terminal vault-provider status in the SDK and dashboard polling path, so permanent ingestion failures stop polling immediately and show a terminal error.Why this was needed
Split peg-ins have shared work at the start, then each vault can diverge after the shared Pre-PegIn is broadcast. The old UI treated “vault index before the active vault” as “done,” which is not true when a vault failed WOTS, timed out, or was still waiting for the vault provider. That is why a vault could show WOTS, payout signing, and recovery signing as completed even though those actions did not happen.
The original WOTS issue was also caused by timing. The initial modal started WOTS submission immediately after broadcast, but the vault provider only accepts WOTS once it has ingested the Pre-PegIn. In a split flow, vault 1 could spend its whole wait budget before the provider was ready, while vault 2 worked later because enough time had passed.
After fixing WOTS readiness, the flow reached payout signing more reliably. That exposed a second timing issue: payout signing was attempted before the provider had prepared payout transactions, and the SDK’s 20 minute wait could time out. That timeout is not a real signing failure, so this PR treats it as “not ready yet” and hands off to the continuation view instead.
Approaches considered
IngestionRejectedterminal status handling because our per-vault progress and readiness gates solve the reported split-modal issue more completely.Why this approach
The chosen approach keeps the modal honest and avoids serial timeouts. WOTS readiness and payout readiness are checked once for the whole split batch, because sibling vaults share the same Pre-PegIn timing. If a vault is ready, the modal proceeds. If it is not ready, the modal shows the correct waiting step and the in-modal continuation view keeps polling until the next user action is available.
This also keeps dashboard resume and initial-modal behavior aligned. The same continuation path handles “I kept the modal open” and “I closed and resumed later,” so users are not forced into a different recovery flow unless they explicitly close the modal.
Testing
services/vaultTypeScript withpnpm --dir services/vault exec tsc --noEmit -p tsconfig.lib.json.no-explicit-anywarnings inuseDepositFlow.test.tsx.git diff --check.Manual verification recommended
Run a live split peg-in and keep the initial modal open through a slow confirmation path. Expected behavior: both vaults should sit honestly at “Prepare claim and payout transactions,” BTC confirmation detail should show the block countdown until depth is reached, then provider preparation status, and the modal should transition into the in-modal continuation flow without showing “Payout signing failed.” When the vault provider reaches payout readiness, the same modal should let the user sign payouts and proceed to activation.