Skip to content

fix(tasks): fund a new task, bounty or pool through vAPI's ERC-3009 intent - #121

Merged
vapi-development merged 3 commits into
mainfrom
fix/fund-new-escrow-by-authorization
Dec 2, 2026
Merged

vapi-development merged 3 commits into
mainfrom
fix/fund-new-escrow-by-authorization

Conversation

@vapi-development

@vapi-development vapi-development commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

On Base mainnet vAPI prepares the first funding of a new order as one EIP-3009 ReceiveWithAuthorization to the clone's predicted address, and creates the clone after the signature is confirmed. The plan guard refused every such intent with v2_plan_mismatch: The V2 target is not registered by the locally pinned factory., so vapi task post --fund and vapi task fund could not fund any new task, bounty or pool there. Nothing was signed; the refusal came first.

Fix (packages/core/src/tasks/v2-plan-guard.ts)

  • For a signature intent toward an unregistered clone, the guard derives the creation arguments from the accepted terms and the pinned factory's live fee, as it already did for the approval of a fresh clone, and signs only when the pinned factory's prediction equals the intent's address. Only that address can redeem the authorization, and it exists only as the clone of exactly those arguments. The create step that follows is checked against the same arguments.
  • The signing-block deadline check of a task read MIN_WORK_TIME from the clone, which does not exist yet, and checked an empty milestone list. It now reads the factory implementation and checks the accepted milestones.

Tests (written first, red on main): a new task escrow funded by one authorization and createAndFundWithAuthorization; a new open vAPI ID pool funded by one authorization, then createPool and fundWithAuthorization; a refusal when the pinned factory predicts another address. Core: 2598 passed, typecheck, lint and format clean.

🤖 Generated with Claude Code

follow-up: bind a first funding to the order this client posted (persist the posted order in the journal and compare the creation arguments and terms hash computed from it) for the approval and ERC-3009 paths. A field-level check was tried in this PR and reverted: it missed fields that feed the terms hash and could be skipped on resume.
follow-up: add a bounty-specific first-funding-by-authorization test.

vapi-development and others added 3 commits December 2, 2026 14:56
…ntent

Where vAPI serves ERC-3009 funding (Base mainnet), the first funding of a new
order is one ReceiveWithAuthorization to the clone's predicted address; the
clone is created after the signature is confirmed. The plan guard refused
every such intent ("The V2 target is not registered by the locally pinned
factory"), so the CLI and local MCP could not fund any new task, bounty or
pool there.

The guard now treats the intent like the approval of a fresh clone: it
derives the creation arguments from the accepted terms and the pinned
factory's live fee, and signs only when the pinned factory predicts the
intent's address for them. The authorization can only be redeemed by that
address, which exists only as the clone of exactly those arguments.

The signing-block deadline check of a task now reads MIN_WORK_TIME from the
factory implementation while the clone does not exist, and covers the
accepted milestones instead of an empty list.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: vAPI Development <336934719+vapi-development@users.noreply.github.com>
A first funding creates the clone from vAPI's copy of the order. `post --fund`
in the CLI and MCP now passes the order it posted (title, brief, deadline,
shape, milestones, bounty or pool terms, worker bond) into the executor, which
refuses to sign when vAPI's order differs on any of them. A changed reward,
verifier, split or deadline can no longer reach a signature through the
approval or the ERC-3009 path.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: vAPI Development <336934719+vapi-development@users.noreply.github.com>
The check compared a subset of fields and missed others that feed the terms
hash, so it gave a false sense of binding. Binding a first funding to the
order this client posted moves to its own change, for the approval and the
ERC-3009 path together.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: vAPI Development <336934719+vapi-development@users.noreply.github.com>
@vapi-development
vapi-development merged commit 2cdc511 into main Dec 2, 2026
9 checks passed
@vapi-development
vapi-development deleted the fix/fund-new-escrow-by-authorization branch December 2, 2026 15:03
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