Skip to content

feat(m8): AgentRegistry + fix setAgentWallet#34

Open
jhfnetboy wants to merge 7 commits into
mainfrom
feat/m8-p1-agent-registry
Open

feat(m8): AgentRegistry + fix setAgentWallet#34
jhfnetboy wants to merge 7 commits into
mainfrom
feat/m8-p1-agent-registry

Conversation

@jhfnetboy
Copy link
Copy Markdown
Member

Summary

  • Add src/registries/AgentRegistry.sol: New reverse-lookup registry contract mapping agent execution wallets to their human AirAccount owners. Implements registerAgent(address), deregisterAgent(address), isRegisteredAgent(address), balanceOf(address), and enumeration helpers (getAgentByIndex, getAgentCount). SuperPaymaster uses isRegisteredAgent and balanceOf for sponsorship eligibility checks.

  • Fix setAgentWallet() in AAStarAirAccountBase.sol (M7.16 → M8.1 upgrade): Replaces the silent best-effort ERC-8004 call with a hard-fail AgentRegistry.registerAgent() call. Adds extcodesize guard to reject EOA registries. Adds AgentRegistrationFailed custom 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 via setAgentWallet.

  • Update test/AAStarAirAccountV7_M7.t.sol: Updates MockRegistry to implement the new registerAgent(address) interface; updates the setAgentWallet tests to reflect hard-failure semantics.

  • Add scripts/deploy-agent-registry.ts: viem-based TypeScript deploy script for Sepolia with RPC fallback.

Test plan

  • forge build passes 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 pass
  • forge test --match-path test/AAStarAirAccountV7_M7.t.sol --summary — all 67 M7 tests pass

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).
@jhfnetboy jhfnetboy requested a review from fanhousanbu as a code owner May 21, 2026 06:14
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment on lines +1575 to 1577
(bool ok,) = agentRegistry.call(
abi.encodeWithSignature("registerAgent(address)", agentWallet)
);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant