feat(m8): createAgentAccount factory function for autonomous agents#35
Open
jhfnetboy wants to merge 8 commits into
Open
feat(m8): createAgentAccount factory function for autonomous agents#35jhfnetboy wants to merge 8 commits into
jhfnetboy wants to merge 8 commits into
Conversation
Add/update LICENSE, NOTICE, TRADEMARK.md, LICENSE-zh.md, TRADEMARK-zh.md per MushroomDAO ecosystem standard.
- Add src/registries/AgentRegistry.sol: reverse-lookup contract mapping agent execution wallets to their human AirAccount owners, with registerAgent/deregisterAgent, isRegisteredAgent, balanceOf, and enumeration helpers required by SuperPaymaster. - Fix setAgentWallet() in AAStarAirAccountBase.sol: replace silent best-effort ERC-8004 call with hard-fail AgentRegistry.registerAgent() call; add extcodesize guard to reject EOA registries; add AgentRegistrationFailed custom error. - Add test/AgentRegistry.t.sol: 15 comprehensive tests covering registration, deregistration, access control, enumeration, balanceOf, and full account→registry integration. - Update test/AAStarAirAccountV7_M7.t.sol: update MockRegistry to match new registerAgent(address) interface; fix setAgentWallet tests to expect hard-failure behavior. - Add scripts/deploy-agent-registry.ts: viem-based deploy script for Sepolia. 709 tests passing (was 680).
Add createAgentAccount() and getAgentAddress() to AAStarAirAccountFactoryV7, enabling human owners to create full AirAccount instances for AI agents where the human auto-accepts as guardian1 and only guardian2 must sign acceptance. - Factory: AgentAccountCreated event, createAgentAccount(), getAgentAddress() - salt = uint256(keccak256(humanOwner ++ agentId)) for deterministic per-agent addresses - guardian1 = msg.sender (auto-accepted), guardian2 requires acceptance sig - validates agentKey != 0, guardian2 != 0, caller != guardian2, agentKey != guardian2 - TierGuardHook: add M8.P2 session scope enforcement features - accountAgentValidator mapping, extended 4-param onInstall (128-byte format) - _getSessionKeyFromAccount() callback to account transient storage - preCheck enforces callTargets/selectorAllowlist via enforceSessionScope() for ALG_SESSION_KEY - Tests: 14 new tests in AAStarAirAccountFactoryV7AgentAccount.t.sol covering happy path, idempotency, sig validation, require checks, event emission, address prediction, determinism, and owner!=guardian invariant documentation - Tests: 4 new M8.P2 session scope tests in TierGuardHook.t.sol - Scripts: agent-account-manager.ts TypeScript SDK usage example (viem-based) All 713 tests pass.
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
createAgentAccount()toAAStarAirAccountFactoryV7: human caller auto-accepts as guardian1, only guardian2 needs to sign; owner is the agent's EOA keygetAgentAddress()for counterfactual address prediction:uint256(keccak256(humanOwner ++ agentId))ensures each human+agentId pair gets a unique deterministic addressAgentAccountCreatedevent with indexedaccount,agentKey,humanOwner, andagentId_getSessionKeyFromAccount(),accountAgentValidatormapping, and extended 4-paramonInstallformat that was previously incomplete (compile error)scripts/agent-account-manager.ts(viem-based)Test plan
forge buildsucceeds (compiler run successful with warnings only)forge test— 32 test suites, 0 failurestest/AAStarAirAccountFactoryV7AgentAccount.t.sol:getAgentAddress()matches deployed addressAgentAccountCreatedemitted with correct indexed fieldstest/TierGuardHook.t.sol: