fix: correct setBudget selector in BaseACPHook, add FundTransferHook tests#29
Open
ziyincody wants to merge 1 commit intoerc-8183:mainfrom
Open
fix: correct setBudget selector in BaseACPHook, add FundTransferHook tests#29ziyincody wants to merge 1 commit intoerc-8183:mainfrom
ziyincody wants to merge 1 commit intoerc-8183:mainfrom
Conversation
…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>
2c621fd to
5127870
Compare
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
BaseACPHookhad the wrong selector forsetBudget—keccak256("setBudget(uint256,uint256,bytes)")instead of the correctkeccak256("setBudget(uint256,address,uint256,bytes)"). This caused_preSetBudgetand_postSetBudgetto silently never fire for any hook.abi.decodeforsetBudgetdata was missing theaddress tokenfield, updated to match whatAgenticCommerceactually encodes.BiddingHookandFundTransferHookupdated to match the new_preSetBudgetvirtual function signature (addsaddress tokenparam).test/FundTransferHook.t.solcovering the full job lifecycle.Test plan
test_happyPath— full flow with balance assertions at every steptest_rejectAfterSubmit— evaluator rejects, provider gets output tokens back, client gets fee refundedtest_submitWithoutApproval_reverts— provider can't submit without depositing output tokenstest_fundWithoutCommitment_reverts— can't fund if setBudget was called without buyer/amount commitmenttest_cannotSubmitTwice_reverts— job state machine enforcedtest_recoverTokensAfterExpiry— client claims refund via core, provider recovers tokens via hookAll 6 tests pass (
forge test).🤖 Generated with Claude Code