diff --git a/README.md b/README.md index 48b6d9b..5ef2526 100644 --- a/README.md +++ b/README.md @@ -10,13 +10,13 @@ EIP-8130 defines a new transaction type and onchain system contract that togethe ## Contracts -Three account implementations are deployed: `DefaultAccount` (the bare building block, deployed standalone as the direct EIP-7702 delegation target for EOAs), `DefaultHighRateAccount` (immutable smart account), and `UpgradeableAccount` (general, upgradeable smart account). `DefaultHighRateAccount` and `UpgradeableAccount` both inherit from `DefaultAccount`, but each is deployed as its own singleton, since a smart-account proxy is a permanent address that cannot re-delegate the way a 7702 EOA can. `BackwardsCompatible4337Account` is a separate, opt-in ERC-4337 example (see below); nothing deployed by default depends on it. +Four account implementations are deployed: `DefaultAccount` (the bare building block, deployed standalone as the direct EIP-7702 delegation target for EOAs), `DefaultHighRateAccount` (immutable smart account), `UpgradeableAccount` (general, upgradeable smart account), and `BackwardsCompatible4337Account` (opt-in ERC-4337 example). `DefaultHighRateAccount`, `UpgradeableAccount`, and `BackwardsCompatible4337Account` all inherit from `DefaultAccount`, but each is deployed as its own singleton, since a smart-account proxy is a permanent address that cannot re-delegate the way a 7702 EOA can. `BackwardsCompatible4337Account` is deployed for callers that need it, but nothing deployed by default depends on it. | Contract | Role | Description | |----------|------|-------------| | `AccountConfiguration` | System | Actor authorization, account creation, and change sequencing | | `DefaultAccount` | Deployed account (EOAs) | Bare minimum account: batched execution (`executeBatch`) + ERC-1271 (`isValidSignature`), all authorization deferred to `AccountConfiguration`. No ERC-4337. Works natively on 8130 chains via direct dispatch. Deployed standalone as the EIP-7702 delegation target for EOAs — they can re-delegate to a new implementation anytime, so no upgrade wrapper is needed | -| `BackwardsCompatible4337Account` | Example (opt-in) | `DefaultAccount` + ERC-4337 (`validateUserOp`), so an account works on non-8130 chains via a bundler + EntryPoint. The EntryPoint is not hardcoded — it is a revocable `TRUSTED_EXECUTOR` actor in `AccountConfiguration`, so a compromised EntryPoint is disabled with one signed change and any version (v0.7/v0.8/…) is supported. Not used by either deployed account by default; extend it (with or without UUPS) when 4337 is actually needed | +| `BackwardsCompatible4337Account` | Deployed account (opt-in) | `DefaultAccount` + ERC-4337 (`validateUserOp`), so an account works on non-8130 chains via a bundler + EntryPoint. The EntryPoint is not hardcoded — it is a revocable `TRUSTED_EXECUTOR` actor in `AccountConfiguration`, so a compromised EntryPoint is disabled with one signed change and any version (v0.7/v0.8/…) is supported. Deployed by default but not used by either other deployed account; extend it (with or without UUPS) when 4337 is actually needed | | `DefaultHighRateAccount` | Deployed account | The immutable account (behind a 45-byte ERC-1167 proxy). A `DefaultAccount` variant that blocks ETH transfers when locked for higher mempool rate limits | | `UpgradeableAccount` | Deployed account | The general upgradeable account: UUPS-upgradeable `DefaultAccount` (behind `UpgradeableProxy`), with upgrades authorized by a CONFIG-scoped key. Carries no ERC-4337 surface by default — upgrade to a `BackwardsCompatible4337Account`-derived implementation if a given deployment needs it | diff --git a/script/Deploy.s.sol b/script/Deploy.s.sol index ac47f5e..be82772 100644 --- a/script/Deploy.s.sol +++ b/script/Deploy.s.sol @@ -7,6 +7,7 @@ import {AccountConfiguration} from "../src/AccountConfiguration.sol"; import {DefaultAccount} from "../src/accounts/DefaultAccount.sol"; import {DefaultHighRateAccount} from "../src/accounts/DefaultHighRateAccount.sol"; import {UpgradeableAccount} from "../src/accounts/UpgradeableAccount.sol"; +import {BackwardsCompatible4337Account} from "../src/accounts/example/BackwardsCompatible4337Account.sol"; import {P256Authenticator} from "../src/authenticators/P256Authenticator.sol"; import {WebAuthnAuthenticator} from "../src/authenticators/WebAuthnAuthenticator.sol"; import {DelegateAuthenticator} from "../src/authenticators/DelegateAuthenticator.sol"; @@ -22,15 +23,19 @@ bytes32 constant SALT = bytes32(0); /// @notice Deploys the full EIP-8130 system: the AccountConfiguration system contract, the account /// implementations, and every canonical authenticator. /// -/// Three account implementations are deployed: -/// - DefaultAccount — the bare building block, deployed standalone as the direct EIP-7702 -/// delegation target for EOAs (no proxy needed; a 7702 EOA can just -/// re-delegate to a new address later, so it needs no UUPS wrapper); -/// - DefaultHighRateAccount — the immutable smart-account variant (deployed behind a 45-byte ERC-1167 -/// proxy); -/// - UpgradeableAccount — the general upgradeable smart-account variant (behind UpgradeableProxy). -/// BackwardsCompatible4337Account is a separate, opt-in ERC-4337 example that none of the above depend on -/// by default. +/// Four account implementations are deployed: +/// - DefaultAccount — the bare building block, deployed standalone as the direct +/// EIP-7702 delegation target for EOAs (no proxy needed; a 7702 EOA +/// can just re-delegate to a new address later, so it needs no UUPS +/// wrapper); +/// - DefaultHighRateAccount — the immutable smart-account variant (deployed behind a 45-byte +/// ERC-1167 proxy); +/// - UpgradeableAccount — the general upgradeable smart-account variant (behind +/// UpgradeableProxy); +/// - BackwardsCompatible4337Account — an opt-in ERC-4337 example (DefaultAccount + validateUserOp) for +/// accounts that need bundler/EntryPoint support on non-8130 chains. +/// Deployed as a singleton so it's available for callers to use, but +/// neither deployed account depends on it by default. /// /// All addresses are canonical: determined solely by salt + bytecode, independent of the /// deployer's address or nonce, and identical on every chain. @@ -81,6 +86,10 @@ contract Deploy is Script { return abi.encodePacked(type(UpgradeableAccount).creationCode, abi.encode(accountConfig)); } + function _backwardsCompatible4337Init(address accountConfig) internal pure returns (bytes memory) { + return abi.encodePacked(type(BackwardsCompatible4337Account).creationCode, abi.encode(accountConfig)); + } + function _delegateAuthInit(address accountConfig) internal pure returns (bytes memory) { return abi.encodePacked(type(DelegateAuthenticator).creationCode, abi.encode(accountConfig)); } @@ -101,6 +110,7 @@ contract Deploy is Script { console.log("DefaultAccount: ", _addr(_defaultAccountInit(accountConfig))); console.log("DefaultHighRateAccount: ", _addr(_defaultHighRateInit(accountConfig))); console.log("UpgradeableAccount: ", _addr(_upgradeableAccountInit(accountConfig))); + console.log("BackwardsCompatible4337: ", _addr(_backwardsCompatible4337Init(accountConfig))); console.log(""); console.log("=== Authenticators ==="); console.log("(secp256k1 is built in: AccountConfiguration.K1_AUTHENTICATOR() == address(1))"); @@ -125,11 +135,13 @@ contract Deploy is Script { // DefaultAccount is deployed standalone as the direct EIP-7702 delegation target for EOAs. // DefaultHighRateAccount is the immutable (ERC-1167) smart-account variant; UpgradeableAccount is the // general upgradeable smart-account variant. BackwardsCompatible4337Account is a separate, opt-in - // example that none of the above depend on by default. + // example (deployed as a singleton for callers that need it) that neither deployed account depends on + // by default. address defaultAccount = _create2(_defaultAccountInit(accountConfig)); address defaultHighRate = _create2(_defaultHighRateInit(accountConfig)); address upgradeableAccount = _create2(_upgradeableAccountInit(accountConfig)); + address backwardsCompatible4337 = _create2(_backwardsCompatible4337Init(accountConfig)); // ── Authenticators (secp256k1 is built into AccountConfiguration; no contract to deploy) ── @@ -144,6 +156,7 @@ contract Deploy is Script { console.log("DefaultAccount: ", defaultAccount); console.log("DefaultHighRateAccount: ", defaultHighRate); console.log("UpgradeableAccount: ", upgradeableAccount); + console.log("BackwardsCompatible4337: ", backwardsCompatible4337); console.log(""); console.log("=== Authenticators ==="); console.log("(secp256k1 is built in: AccountConfiguration.K1_AUTHENTICATOR() == address(1))");