Skip to content

v1.21.0 ERC-4337 Session Keys — caps enforced BY THE CHAIN#78

Merged
ceoguy merged 2 commits into
mainfrom
feat/erc4337-session-keys
Jun 11, 2026
Merged

v1.21.0 ERC-4337 Session Keys — caps enforced BY THE CHAIN#78
ceoguy merged 2 commits into
mainfrom
feat/erc4337-session-keys

Conversation

@ceoguy

@ceoguy ceoguy commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

What this is

Roadmap item 7, complete implementation (was: PR A libs only — now the full feature per .plans/erc4337-session-keys.md). The trust story graduates from "our code enforces the caps" to "the chain enforces the caps even if the machine is compromised."

The user's ERC-7579 smart account grants the agent's existing EOA a scoped on-chain session via the audited, vendor-neutral Smart Sessions module: cumulative per-token spend caps, mandatory expiry, optional usage caps — validated by the EntryPoint on every operation. Zero new dependencies (deterministic module addresses + viem encoders; no AGPL code vendored).

Surface (135 → 140 tools)

  • chaingpt_aa_session_build_grant / _build_revoke — UNSIGNED payloads; the account OWNER signs externally; unbounded grants refused by construction; revoke = chain-level kill.
  • chaingpt_aa_session_status — chain-authoritative state (account kind, module installed, permission enabled, caps).
  • chaingpt_aa_submit_userop — custody-free eth_sendUserOperation (refuses empty signatures).
  • chaingpt_agent_wallet_4337_sign_and_send — local gates first (fail-closed erc4337 who/where sub-policy, OFF by default everywhere + standard per-tx/velocity checks on the inner call), then the agent signs in the Smart Sessions USE envelope and the chain enforces the granted caps. Bundler cap-rejections render as the chain-side refusal they are — never retried around.

v1 account support: Biconomy Nexus 1.x (Kernel v3 / Safe7579 follow — the module layer is shared). PreToolUse guard asks on both new signing/submitting tools.

Verification

  • 8/8 local layers; 428 vitest (+29: encoder round-trips, permissionId determinism, USE-signature layout, full gate matrix incl. type-strict migration guarantee, tool-surface custody invariant, offline refusal paths with zero-network assertions, hook coverage).
  • Tag gate: v1.21.0 is tagged only after the live Base Sepolia loop in TESTING.md passes — including the headline proof: local policy set to unrestricted and the chain still refuses the over-cap transfer. The CHANGELOG carries this gate explicitly.
  • Merge-risk note: the entire surface is opt-in fail-closed (erc4337.enabled absent/false in every default and template), so merging ahead of the live loop changes nothing for any existing user.

🤖 Generated with Claude Code

Klow and others added 2 commits June 10, 2026 15:49
…ilder, permissionId, USE signature, deterministic module addresses, sessions cache

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…rd-party-account opt-in, account + bundler-host allowlists, validation

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jun 11, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@ceoguy, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 52 minutes and 5 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: db712987-f966-4450-bcd7-197e269a3388

📥 Commits

Reviewing files that changed from the base of the PR and between 3b913af and fb5dddc.

📒 Files selected for processing (5)
  • mcp-server/src/__tests__/erc4337_gate.test.ts
  • mcp-server/src/__tests__/smart_sessions.test.ts
  • mcp-server/src/lib/agent-policy.ts
  • mcp-server/src/lib/erc7579.ts
  • mcp-server/src/lib/smart-sessions.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/erc4337-session-keys

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@ceoguy ceoguy merged commit 082b1c2 into main Jun 11, 2026
13 checks passed
@ceoguy ceoguy changed the title ERC-4337 session keys, PR A — libs + policy gate (no user-facing surface yet) v1.21.0 ERC-4337 Session Keys — caps enforced BY THE CHAIN Jun 11, 2026
ceoguy added a commit that referenced this pull request Jun 11, 2026
)

* feat(tools): session grant/revoke/status + aa_submit_userop + agent_wallet_4337_sign_and_send — both fences (local gates + chain caps), hook coverage, docs, v1.21.0

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* docs: SECURITY.md — disclosure policy + what counts as critical in a money-handling plugin

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* docs: agent-wallet refusal demo GIF (vhs, reproducible via docs/demo/*.tape) + README hero

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* docs(smart-sessions): record Base Sepolia eth_getCode verification of pinned module addresses

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: Klow <deploy@klow.ai>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
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