Skip to content

Fix SEL_FUND selector mismatch and getJob abi.decode in BaseACPHook#3

Open
PRXVT wants to merge 1 commit intoerc-8183:mainfrom
PRXVT:fix/base-acp-hook-selector-and-decode
Open

Fix SEL_FUND selector mismatch and getJob abi.decode in BaseACPHook#3
PRXVT wants to merge 1 commit intoerc-8183:mainfrom
PRXVT:fix/base-acp-hook-selector-and-decode

Conversation

@PRXVT
Copy link
Copy Markdown

@PRXVT PRXVT commented Mar 13, 2026

Summary

Two bugs in the hook helper layer that prevent _preFund/_postFund from ever firing and cause getJob()
staticcalls from hooks to revert.

Bug 1 — SEL_FUND selector mismatch (BaseACPHook.sol)

SEL_FUND uses fund(uint256,bytes) (2 params) but AgenticCommerceHooked.fund() has signature
fund(uint256,uint256,bytes) (3 params). The selectors don't match (0xe25ba707 vs 0xd2e13f50), so the router
never routes to _preFund/_postFund. This breaks FundTransferHook's capital transfer and BiddingHook's budget
validation during fund.

Bug 2 — Flat-tuple abi.decode of getJob() return (BaseACPHook.sol, BiddingHook.sol, FundTransferHook.sol)

getJob() returns Job memory which contains a string field, making it a dynamic tuple. The ABI encoding wraps it
with a 32-byte offset prefix. The existing flat-tuple decode reads that offset as the id field, shifts all
subsequent fields, and reverts when the hook address is misinterpreted as a string data pointer.

Fixed by defining a matching ACPJob struct and using abi.decode(data, (ACPJob)) which correctly handles the
offset.

Changes

  • BaseACPHook.sol: Fix SEL_FUND to fund(uint256,uint256,bytes), add ACPJob struct, fix _getJobClient decode
  • BiddingHook.sol: Fix _getJobBudget decode
  • FundTransferHook.sol: Fix _getJobProviderAndStatus decode

What's NOT changed

  • AgenticCommerceHooked.sol — untouched
  • IACPHook.sol — untouched

Testing

36 integration tests passing including full BiddingHook lifecycle, FundTransferHook two-phase transfer with rejection,
and multi-hook coexistence on the same AgenticCommerceHooked instance.

@pmmochi
Copy link
Copy Markdown

pmmochi commented Mar 30, 2026

we have removed baseACPHook, closing this issue ya

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.

2 participants