ethereum-optimism / ethereum-optimism/actions

Wallet Refactor: Implement ZeroDevSmartWallet (ERC-7579 modular, enables agent session keys)

Open
#403 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
32
Forks
25
Avg merge
10h 20m
Merged PRs (30d)
16

Description

## Summary

Add `ZeroDevSmartWallet` + `ZeroDevSmartWalletProvider` as a sibling to `CoinbaseSmartWallet`. ZeroDev Kernel v3 is ERC-7579 modular, which enables session keys, Call Policy, and Cumulative Spending Cap Policy — all required by the agent wallet system tracked in #354. Coinbase Smart Wallet is non-modular and cannot support these features.

**Parent:** #396
**Brainstorm:** #395
**Blocks agent wallet work (#354):** **Yes** — directly required by agent session-key work; supersedes agent brainstorm Issue 3

## Context

From the agent wallet research (#354):

> **Why ZeroDev Kernel, not Coinbase Smart Account:** Coinbase Smart Wallet is non-modular (no ERC-7579 support). It cannot install custom validators or policy plugins. Its Spend Permissions only control token transfer amounts — they cannot restrict which contracts or functions are called. CDP Policies are off-chain only. Coinbase explicitly abandoned session keys in favor of Sub Accounts. ZeroDev Kernel's ERC-7579 modular architecture supports exactly the on-chain permission enforcement we need.

This sub-issue ships the Kernel substrate; the agent work (in #354) builds session-key policies on top.

## Scope

- Implement `ZeroDevSmartWallet extends SmartWallet` in `wallet/core/wallets/smart/zerodev/ZeroDevSmartWallet.ts`
- Implement `ZeroDevSmartWalletProvider extends SmartWalletProvider` in `wallet/core/providers/smart/zerodev/ZeroDevSmartWalletProvider.ts`
- Wire `type: 'zerodev'` into `smartWalletConfig.provider` union in `types/actions.ts`
- Match `CoinbaseSmartWallet`'s public API contract: `send`, `sendBatch`, `addSigner`, `removeSigner`, `deploy`, `sendTokens`, `findSignerIndexOnChain`
- Add ERC-7579 module surface (install/uninstall) on `ZeroDevSmartWallet` — additive; session-key policy contracts install here
- Multi-chain deployment support (Kernel is deterministic via CREATE2, but per-chain deploy tx required)
- Bundler + paymaster config on the provider (`ZeroDevSmartWalletProvider` config includes bundler URL, paymaster URL)
- Attribution suffix: verify Kernel supports appending a 16-byte suffix to callData in the same way as Coinbase's impl (parity with current `DefaultSmartWallet.appendAttributionSuffix`)

## Out of scope

- Session-key policy contracts (Call Policy, Cumulative Spending Cap) — those live in the agent wallet work (#354 Issue 5)
- Dashboard UI
- CLI integration

## Implementation notes

- ZeroDev Kernel v3 via `@zerodev/sdk` (add dependency)
- Use viem's `createKernelAccount` pattern
- Keep the provider thin — module install/management lives on the wallet class, matching Coinbase's `addSigner`/`removeSigner` shape
- The `SmartWallet` abstract base should not require changes; if it does, finish the audit in the previous sub-issue (DefaultSmartWallet rename) first

## Files affected

- `packages/sdk/src/wallet/core/wallets/smart/zerodev/ZeroDevSmartWallet.ts` (new)
- `packages/sdk/src/wallet/core/providers/smart/zerodev/ZeroDevSmartWalletProvider.ts` (new)
- `packages/sdk/src/types/actions.ts` — `SmartWalletProvider` union expands
- `packages/sdk/src/wallet/node/index.ts` / `wallet/react/index.ts` — new exports
- `packages/sdk/package.json` — add `@zerodev/sdk` (+ related deps)
- Tests: parity with `CoinbaseSmartWallet` test suite, plus ERC-7579 module install/uninstall coverage

## Dependencies

- **Requires** "Rename DefaultSmartWallet to CoinbaseSmartWallet" (sibling sub-issue of #396) — base audit must be complete so no conflicting changes ride in this PR
- Benefits from engineering principles in #380 — if a second ERC-7579 Kernel-like impl ever lands, extract a shared intermediate base; defer until that second impl exists

## Acceptance criteria

- [ ] `ZeroDevSmartWallet` passes the same public-API contract tests as `CoinbaseSmartWallet`
- [ ] ERC-7579 module install/uninstall surface works end-to-end (verify with a trivial test module)
- [ ] Multi-chain deploy works; deterministic addresses confirmed via `getWalletAddress`
- [ ] Bundler + paymaster config documented with example
- [ ] `type: 'zerodev'` usable in `ActionsConfig`; config types validated
- [ ] Attribution suffix parity with `CoinbaseSmartWallet`
- [ ] `pnpm typecheck && pnpm lint && pnpm test` pass

Contributor guide

Open the contributing guide

Research direction

Start by reading CoinbaseSmartWallet and its parity tests, then inspect the SmartWallet provider union in packages/sdk/src/types/actions.ts and the node/react export files. Review the @zerodev/sdk createKernelAccount pattern and the listed package configuration before defining the provider and wallet boundaries. Done means the acceptance criteria pass, including module install/uninstall, multi-chain deployment, configuration typing, attribution parity, and the full pnpm typecheck, lint, and test commands.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
backend-api-design, blockchain
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.