Skip to content

[v0.1.x-branch] Backport #1006: waved: Reject unknown refresh outpoints with InvalidArgument - #1010

Merged
Roasbeef merged 1 commit into
v0.1.x-branchfrom
backport-1006-to-v0.1.x-branch
Jul 20, 2026
Merged

[v0.1.x-branch] Backport #1006: waved: Reject unknown refresh outpoints with InvalidArgument#1010
Roasbeef merged 1 commit into
v0.1.x-branchfrom
backport-1006-to-v0.1.x-branch

Conversation

@github-actions

Copy link
Copy Markdown

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 refresh of an unknown or
non-live outpoint fails with an opaque INTERNAL error instead of the
clean InvalidArgument the 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." But
the 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; RefreshVTXOs then returned
an empty queued set with status "queued", and the CLI's follow-on ark rounds join failed with:

INTERNAL: join next round: failed to trigger round registration:
no pending round for event *round.IntentRequested

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
--yes and the MCP tool's yes:true skip that probe, so they were the
only way to reach the broken path.

Observed on the live daemon: refresh --outpoint <bogus>:0 --yes returns
the INTERNAL above; with this change it returns InvalidArgument: unknown VTXO outpoint <bogus>:0.

The fix

We resolve the selection through resolveRefreshPreviewTargets — the
same 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 LiveState filter the
--all path needs, so the ad-hoc ListLiveVTXOs expansion is folded
into the shared helper; an empty --all selection stays a clean no-op.

Validation

  • New waved tests: 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.
  • Full waved package under -race.
  • make fmt-changed-check, make lint-changed-local (0 issues),
    make commitmsg-lint, make build.

Found while manually testing #987.

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

1 participant