feat: integrate ERC-8001 multi-party coordination via hook pattern#5
feat: integrate ERC-8001 multi-party coordination via hook pattern#5KBryan wants to merge 5 commits intoerc-8183:mainfrom
Conversation
Add ERC-8001 standard-compliant multi-party coordination framework integrated with ERC-8183 hooks. This implementation follows the authors' preferred hook pattern over the evaluator pattern. Changes: - Add ERC8001.sol base contract with full EIP-712, ERC-1271, and ERC-5267 support for multi-party coordination - Add ERC8001CoordinationHook.sol (Profile B) for optional per-job coordination of complete/reject actions - Remove MultiPartyEvaluator.sol in favor of hook pattern - Add comprehensive Foundry test suite (ERC8001.t.sol, ERC8001CoordinationHook.t.sol) - Update documentation (README.md, hook-profiles.md) with new hook example and testing instructions Features: - Standard-compliant ERC-8001 implementation - EIP-712 signature verification (ECDSA 65/64-byte, ERC-1271) - Strict participant canonicalization (sorted unique) - Monotonic nonce enforcement per agent - Optional per-job coordination (backward compatible) - Gas-efficient: minimal hook state, complex logic in base contract Breaking Changes: - Remove contracts/examples/MultiPartyEvaluator.sol (replaced by hook pattern)
|
Thanks for the PR! Multi-party coordination is valuable for complex jobs that need multiple providers (e.g., 5 reviewers, 3 validators working together). Architecture question: Would you be open to this refactor? Happy to collaborate on interface design. |
…tion This commit implements a dual-approach solution combining ERC-8001 (multi-party coordination) with ERC-8004 (multi-provider management): ERC-8001 Coordination: - Multi-party consensus via EIP-712 attestations - Cryptographic proof before job completion/rejection - Prevents unilateral decisions ERC-8004 Multi-Provider: - Support for multiple providers on same job - Automatic equal payment distribution - Provider set validation before funding Bug Fixes: - Fixed SEL_FUND selector in BaseACPHook (was missing expectedBudget param) - Added empty data checks in fund callbacks - Updated all hook callbacks to use new _preFund/_postFund signatures New Contracts: - CombinedMultiProviderCoordinationHook: Combines both features - MultiProviderHook: Standalone multi-provider management - ERC8004ProviderRegistry: Reference implementation - IMultiPartyCoordination: Generic interface (no ERC-8001 dependency) Tests: - 49 tests passing across 5 test suites - Comprehensive integration tests demonstrating both patterns - Full coverage for multi-provider, coordination, and combined flows Documentation: - Updated README.md with multi-provider examples - Added hook-profiles.md documentation
|
@psmiratisu noted, I made some edits to my PR. Please review at your earliest convenience. Also looking into collaborating on interface design. |
- .gitmodules: merge both submodule entries (acp + existing oz/forge-std) - contracts/AgenticCommerceHooked.sol: keep file (deleted upstream), update hook data encoding to include msg.sender (caller) as first arg in setBudget, fund, submit, complete, reject, setProvider - contracts/BaseACPHook.sol: adopt upstream's address caller param for _preFund/_postFund; keep HEAD's SEL_SET_PROVIDER; remove duplicate uint256 overloads and raw staticcall helper - contracts/hooks/BiddingHook.sol: adopt address caller signature for _preFund; replace raw staticcall helper with _core() accessor - contracts/hooks/FundTransferHook.sol: adopt address caller signature for _preFund/_postFund; remove raw staticcall helper - foundry.lock: merge both sets of locked dependency revisions - foundry.toml: keep HEAD config (test dir, verbosity, fuzz, CI profile) and add upstream's evm_version=cancun and remappings
- Initialize contracts/acp submodule (erc-8183/base-contracts) - Add lib/forge-std submodule (foundry-rs/forge-std) - Fix AgenticCommerceHooked.sol: update import from ./IACPHook.sol to @acp/IACPHook.sol - Update CombinedMultiProviderCoordinationHook, MultiProviderHook, ERC8001CoordinationHook to use address caller param in all overridden virtual functions (_preFund, _postFund, _preComplete, _postComplete, _preReject) to match updated BaseACPHook signatures - Add @acp/AgenticCommerce.sol import to multi-provider hooks - Replace expectedBudget param in _preFund with getJob() call to read budget directly from ACP contract
The upstream @acp/AgenticCommerce.sol has a different Job struct layout than AgenticCommerceHooked — missing the 'hook' address field, with 'description' (a dynamic string) at slot 4 instead. Decoding the Hooked contract's ABI-encoded return with the upstream struct caused the string offset to be read as a huge pointer, reverting on all getJob() calls. Switch all four hooks to import and cast against AgenticCommerceHooked so struct field offsets match at runtime: - BiddingHook: _core() returns AgenticCommerceHooked - FundTransferHook: _core() returns AgenticCommerceHooked; update all Job and JobStatus type references - MultiProviderHook: getJob() call in _preFund uses AgenticCommerceHooked - CombinedMultiProviderCoordinationHook: getJob() calls in _preFund and proposeCoordination use AgenticCommerceHooked; replace raw abi.decode tuple with typed struct access
|
@psmiratisu, just checking in to see if you have had a chance to go over my latest revisions. also wondering if you are planning to have erc-8183 breakout sessions |
|
@KBryan yes, we will have breakout in maybe 2 weeks from now!! for this PR tho, there is valuable work in here, but I do not think this can merge in the current bundled form. It is carrying too much at once for hook-contracts. The path I would suggest is to split out the smallest standalone coordination hook first, split any multi-provider payment hook separately, keep the full ERC-8001 implementation and broader coordination infrastructure out of this repo path, and keep the repo examples depending on interfaces rather than bundling the entire system into one PR. If you want to keep going on this, I am happy to review the smaller split PRs. I do not think the full bundled version should land as-is. What do you think? |
Add ERC-8001 standard-compliant multi-party coordination framework integrated with ERC-8183 hooks. This implementation follows the authors' preferred hook pattern over the evaluator pattern. Changes: