feat(m8): AgentRegistry + fix setAgentWallet#34
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).
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a9c11ff803
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| (bool ok,) = agentRegistry.call( | ||
| abi.encodeWithSignature("registerAgent(address)", agentWallet) | ||
| ); |
There was a problem hiding this comment.
Preserve one-wallet-per-agent binding on updates
setAgentWallet now ignores agentId when writing to the registry and only calls registerAgent(agentWallet). If an owner rotates an existing agent to a new wallet (same agentId, different agentWallet), the old wallet is never deregistered and remains valid in AgentRegistry.isRegisteredAgent, so downstream eligibility checks can continue accepting the stale wallet. This is a behavior regression from the prior setAgentWallet(agentId, wallet) style update semantics and breaks revocation-by-rebinding.
Useful? React with 👍 / 👎.
Summary
Add
src/registries/AgentRegistry.sol: New reverse-lookup registry contract mapping agent execution wallets to their human AirAccount owners. ImplementsregisterAgent(address),deregisterAgent(address),isRegisteredAgent(address),balanceOf(address), and enumeration helpers (getAgentByIndex,getAgentCount). SuperPaymaster usesisRegisteredAgentandbalanceOffor sponsorship eligibility checks.Fix
setAgentWallet()inAAStarAirAccountBase.sol(M7.16 → M8.1 upgrade): Replaces the silent best-effort ERC-8004 call with a hard-failAgentRegistry.registerAgent()call. Addsextcodesizeguard to reject EOA registries. AddsAgentRegistrationFailedcustom error.Add
test/AgentRegistry.t.sol: 15 comprehensive Foundry tests covering registration, deregistration, access control, zero-address revert, duplicate registration revert, swap-and-pop correctness,isRegisteredAgent,balanceOf, and full account→registry integration viasetAgentWallet.Update
test/AAStarAirAccountV7_M7.t.sol: UpdatesMockRegistryto implement the newregisterAgent(address)interface; updates thesetAgentWallettests to reflect hard-failure semantics.Add
scripts/deploy-agent-registry.ts: viem-based TypeScript deploy script for Sepolia with RPC fallback.Test plan
forge buildpasses with no errors (warnings only, pre-existing)forge test --summary— 709 tests pass, 0 fail (up from 680)forge test --match-path test/AgentRegistry.t.sol -v— all 15 new tests passforge test --match-path test/AAStarAirAccountV7_M7.t.sol --summary— all 67 M7 tests pass