[v0.1.x-branch] Backport #1006: waved: Reject unknown refresh outpoints with InvalidArgument - #1010
Merged
Merged
Conversation
In this commit, we make a real (non-dry-run) RefreshVTXOs validate its explicit selection against the VTXO store, exactly as the dry-run preview already does, so an unknown or non-live outpoint fails with a clean InvalidArgument instead of an opaque downstream error. Before this, the real path handed explicit outpoints straight to the wallet actor. An unknown or non-live outpoint became a logged per-outpoint error, RefreshVTXOs returned an empty queued set with status "queued", and the CLI's follow-on `ark rounds join` then failed with an `INTERNAL: no pending round for event *round.IntentRequested` -- an error that neither names the bad outpoint nor tells the caller what to fix. The dry-run path already rejected the same outpoint with InvalidArgument, so --yes (and the MCP tool's yes:true), which skip the dry-run probe, were the only way to reach the broken path. We now resolve the selection through resolveRefreshPreviewTargets -- the same store lookup the preview uses -- before the wallet-ready gate, matching the LeaveVTXOs H-5 ordering rule that selection validation must not depend on wallet state. The resolver already applies the LiveState filter the --all path needs, so the ad-hoc ListLiveVTXOs expansion is removed in favor of the shared helper, and both paths now accept exactly the same request shape. An empty --all selection stays a clean no-op. Found while manually testing #987. (cherry picked from commit e528c31)
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.
Backport of #1006
In this PR, we fix a second bug found while manually testing #987 on the
arktest regtest harness: a real
ark vtxos refreshof an unknown ornon-live outpoint fails with an opaque
INTERNALerror instead of theclean
InvalidArgumentthe dry-run preview already returns.The bug
#987 made the dry-run preview an honest validity probe: an explicit
outpoint the store does not know (or that is not live) fails
InvalidArgument, "because the real refresh can never execute it." Butthe real path never got the same validation. It handed explicit
outpoints straight to the wallet actor, where an unknown or non-live
outpoint became a logged per-outpoint error;
RefreshVTXOsthen returnedan empty queued set with status
"queued", and the CLI's follow-onark rounds joinfailed with:That error names neither the bad outpoint nor the fix. On a TTY the
consent prompt fetches the dry-run first, so the mistake is caught; but
--yesand the MCP tool'syes:trueskip that probe, so they were theonly way to reach the broken path.
Observed on the live daemon:
refresh --outpoint <bogus>:0 --yesreturnsthe
INTERNALabove; with this change it returnsInvalidArgument: unknown VTXO outpoint <bogus>:0.The fix
We resolve the selection through
resolveRefreshPreviewTargets— thesame store lookup the dry-run preview uses — before the wallet-ready
gate, matching the LeaveVTXOs H-5 ordering rule that selection validation
must not depend on wallet state. Both paths now accept exactly the same
request shape. The resolver already applies the
LiveStatefilter the--allpath needs, so the ad-hocListLiveVTXOsexpansion is foldedinto the shared helper; an empty
--allselection stays a clean no-op.Validation
wavedtests: real-path unknown outpoint →InvalidArgument(proven to fail without the fix — the old order hit the wallet gate
first), and empty
--all→ clean"queued"no-op before the gate.wavedpackage under-race.make fmt-changed-check,make lint-changed-local(0 issues),make commitmsg-lint,make build.Found while manually testing #987.