-
Notifications
You must be signed in to change notification settings - Fork 9
multi: unify all unroll triggers behind the VTXO manager #909
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
5929498
actormsg+vtxo: thread unroll trigger and policy through ForceUnroll
Roasbeef 4d027a5
vtxo: let the manager force-unroll a VTXO with no live actor
Roasbeef fff7763
fraud: route the recipient fraud exit through the VTXO manager
Roasbeef 4fcf1a5
darepod+vhtlcrecovery: hand vHTLC recovery exit to the VTXO manager
Roasbeef c42a037
multi: hold recovery-only targets in exit on recoverable failure
Roasbeef bf7df8a
darepod: re-admit orphaned recovery targets under their exit policy
Roasbeef 75f7d0a
unroll: carry exit policy on the terminal message, not the cache
Roasbeef d949c75
docs: reconcile package docs with the unified unroll flow
Roasbeef 314cc51
vtxo+db: return a typed ErrVTXONotFound from the VTXO store
Roasbeef 07b39cb
vhtlcrecovery: guard the unroll status against a nil response
Roasbeef afc7b33
multi: pin reconcile nil guard and document the fraud-trigger gap
Roasbeef File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When a fraud spend is forced through the VTXO manager, there is now a crash/drop window after the VTXO status is committed to
UnilateralExitbut before the best-effort chain-resolverTellcreates the registry row. On restart this orphan scan re-admits every such target asTriggerRestart, so a fraud-triggered target losesTriggerFraudSpend; the unroll FSM only applies the fraud checkpoint deferral/backstop logic forTriggerFraudSpend(seeshouldSubmitReadyFrontier), so recipient fraud recovery can resume with the wrong behavior. Persist/recover the original fraud trigger or avoid routing fraud orphans through this generic restart admission.Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Confirmed the window is real: routing fraud through the manager commits
UnilateralExitbefore the best-effort chain-resolverTell, so a crash in that gap leaves an orphan the restart scan re-admits asTriggerRestart, droppingTriggerFraudSpend.Two things worth pinning down on impact before deciding the fix:
It's a lost timing optimization, not a fund/liveness bug. Under a non-fraud trigger
shouldSubmitReadyFrontierreturns true, so the FSM submits the ready checkpoint immediately instead of deferring it to the fraud backstop deadline. That's a premature but safe broadcast: the exit still completes and the recipient still recovers the output; what's lost is the deferral (hold the checkpoint until near the CSV deadline). There's no path where the earlier broadcast helps an attacker.This is a byproduct of fixing the larger bug. Before this PR a fraud target never left the live set at all (it stayed
Live), so it was never aUnilateralExitorphan-scan candidate. The window only exists because fraud now correctly goes out of the live set through the manager.On the fix: a faithful "recover the trigger" needs new durable fraud state. Unlike the vHTLC recovery policy (which the orphan scan already recovers from the recovery store via
recoveryExitPolicies), the fraud watcher keeps its watch set in memory and has no store the scan can consult, so preserving the trigger means persisting fraud-forced exits durably and joining them in the scan.Given the impact is a lost deferral optimization in a narrow crash window with no fund risk, my inclination is to document this as a known limitation consistent with the async-admission trade-off rather than add a durable fraud-trigger store in this PR. I'm getting a second opinion on that call and will follow up here either way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Second opinion is in and concurs: keep it documented, don't fix in this PR. The key confirmations from tracing the FSM: losing
TriggerFraudSpenddegrades to the same immediate-checkpoint-submission that manual and critical-expiry (the deadline-sensitive path) already use; the CSV delay is relative to checkpoint confirmation so earlier confirmation only starts the sweep clock earlier (never misses a deadline); checkpoints are the recipient's own pre-signed exit lineage, so publishing them reveals nothing and enables no attacker spend. And the fraud watcher can't paper over it on restart — it rebuilds watches from live descriptors, and an orphaned target isUnilateralExit, so it's never re-watched.Documented the degraded behavior and the faithful follow-up at the re-admission site in e22f731 (
recoverOrphanedUnrollJobs): the minimal correct fix is to stamp the trigger onto the VTXO row in the same tx that flips it toUnilateralExitand read it back off the descriptors the scan already lists — atomic, no new store, but a schema change and cleanly separable.