fix(vault): prevent collect timing race in pending cosigns#241
Merged
calebjclark merged 1 commit intomainfrom Mar 9, 2026
Merged
fix(vault): prevent collect timing race in pending cosigns#241calebjclark merged 1 commit intomainfrom
calebjclark merged 1 commit intomainfrom
Conversation
Make pending cosign updates atomic and discard stale async callback results so older subscription emissions cannot overwrite newer collect state. This keeps collect deadline and pending cosign state consistent during rapid chain updates.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR addresses a race where out-of-order async pending-cosign subscription updates could overwrite newer state and leave collect timing calculations stale.
Changes:
- Switch
pendingCosignUtxosByIdto store a full snapshot per UTXO (market value + optional due frame) and apply updates atomically with a sequence guard. - Update collect due-date calculation to consider both uncollected revenue frames and the earliest pending cosign due frame.
- Update UI penalty/sum calculations to use the new
marketValuefield.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src-vue/screens-operations/vaulting-screen/Dashboard.vue | Adjust pending-cosign penalty aggregation to sum marketValue from the new map value type. |
| src-vue/overlays-operations/VaultCollectOverlay.vue | Adjust pending-cosign securitization/penalty sum to use marketValue. |
| src-vue/lib/MyVault.ts | Implement pending-cosign snapshot + out-of-order protection, add due-frame awareness to collect timing, and cache/sort revenue frames for due-date calculation. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Why
Out-of-order async subscription callbacks could finish late and overwrite newer pending-cosign data, which can leave collect timing stale.
Testing