Skip to content

fix: correct setBudget selector in BaseACPHook, add FundTransferHook tests#29

Open
ziyincody wants to merge 1 commit intoerc-8183:mainfrom
ziyincody:feat/fund-transfer-hook-tests
Open

fix: correct setBudget selector in BaseACPHook, add FundTransferHook tests#29
ziyincody wants to merge 1 commit intoerc-8183:mainfrom
ziyincody:feat/fund-transfer-hook-tests

Conversation

@ziyincody
Copy link
Copy Markdown

Summary

  • Bug fix: BaseACPHook had the wrong selector for setBudgetkeccak256("setBudget(uint256,uint256,bytes)") instead of the correct keccak256("setBudget(uint256,address,uint256,bytes)"). This caused _preSetBudget and _postSetBudget to silently never fire for any hook.
  • Fix data decoding: the abi.decode for setBudget data was missing the address token field, updated to match what AgenticCommerce actually encodes.
  • Updated hook signatures: BiddingHook and FundTransferHook updated to match the new _preSetBudget virtual function signature (adds address token param).
  • First tests: adds test/FundTransferHook.t.sol covering the full job lifecycle.

Test plan

  • test_happyPath — full flow with balance assertions at every step
  • test_rejectAfterSubmit — evaluator rejects, provider gets output tokens back, client gets fee refunded
  • test_submitWithoutApproval_reverts — provider can't submit without depositing output tokens
  • test_fundWithoutCommitment_reverts — can't fund if setBudget was called without buyer/amount commitment
  • test_cannotSubmitTwice_reverts — job state machine enforced
  • test_recoverTokensAfterExpiry — client claims refund via core, provider recovers tokens via hook

All 6 tests pass (forge test).

🤖 Generated with Claude Code

…tests

BaseACPHook had the wrong function selector for setBudget —
keccak256("setBudget(uint256,uint256,bytes)") instead of the actual
keccak256("setBudget(uint256,address,uint256,bytes)") — causing
_preSetBudget and _postSetBudget to silently never fire. Also fixes
the data decoding to include the missing address token field.

Updates BiddingHook and FundTransferHook to match the new virtual
function signature. Adds a full test suite for FundTransferHook
covering happy path, reject, expiry recovery, and error cases.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@ziyincody ziyincody force-pushed the feat/fund-transfer-hook-tests branch from 2c621fd to 5127870 Compare April 15, 2026 19:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant