diff --git a/CHANGELOG.md b/CHANGELOG.md index beaeed885ee..4891ed39a91 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ ### Breaking changes +- `SignerERC7702` is renamed as `SignerEIP7702`. Imports and inheritance must be updated to that new name and path. Behavior is unmodified. - Update minimum pragma to 0.8.24 in `Votes`, `VotesExtended`, `ERC20Votes`, `Strings`, `ERC1155URIStorage`, `MessageHashUtils`, `ERC721URIStorage`, `ERC721Votes`, `ERC721Wrapper`, `ERC721Burnable`, `ERC721Consecutive`, `ERC721Enumerable`, `ERC721Pausable`, `ERC721Royalty`, `ERC721Wrapper`, `EIP712`, and `ERC7739`. ([#5726](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/5726)) ### Deprecation diff --git a/contracts/mocks/account/AccountMock.sol b/contracts/mocks/account/AccountMock.sol index 803f3e53cf6..b9617ca7454 100644 --- a/contracts/mocks/account/AccountMock.sol +++ b/contracts/mocks/account/AccountMock.sol @@ -16,7 +16,7 @@ import {SignerECDSA} from "../../utils/cryptography/signers/SignerECDSA.sol"; import {SignerP256} from "../../utils/cryptography/signers/SignerP256.sol"; import {SignerRSA} from "../../utils/cryptography/signers/SignerRSA.sol"; import {SignerWebAuthn} from "../../utils/cryptography/signers/SignerWebAuthn.sol"; -import {SignerERC7702} from "../../utils/cryptography/signers/SignerERC7702.sol"; +import {SignerEIP7702} from "../../utils/cryptography/signers/SignerEIP7702.sol"; import {SignerERC7913} from "../../utils/cryptography/signers/SignerERC7913.sol"; import {MultiSignerERC7913} from "../../utils/cryptography/signers/MultiSignerERC7913.sol"; import {MultiSignerERC7913Weighted} from "../../utils/cryptography/signers/MultiSignerERC7913Weighted.sol"; @@ -81,7 +81,7 @@ abstract contract AccountWebAuthnMock is Account, SignerWebAuthn, ERC7739, ERC78 } } -abstract contract AccountERC7702Mock is Account, SignerERC7702, ERC7739, ERC7821, ERC721Holder, ERC1155Holder { +abstract contract AccountERC7702Mock is Account, SignerEIP7702, ERC7739, ERC7821, ERC721Holder, ERC1155Holder { /// @inheritdoc ERC7821 function _erc7821AuthorizedExecutor( address caller, @@ -95,7 +95,7 @@ abstract contract AccountERC7702Mock is Account, SignerERC7702, ERC7739, ERC7821 abstract contract AccountERC7702WithModulesMock is Account, AccountERC7579, - SignerERC7702, + SignerEIP7702, ERC7739, ERC721Holder, ERC1155Holder @@ -122,8 +122,8 @@ abstract contract AccountERC7702WithModulesMock is function _rawSignatureValidation( bytes32 hash, bytes calldata signature - ) internal view virtual override(AbstractSigner, AccountERC7579, SignerERC7702) returns (bool) { - return SignerERC7702._rawSignatureValidation(hash, signature); + ) internal view virtual override(AbstractSigner, AccountERC7579, SignerEIP7702) returns (bool) { + return SignerEIP7702._rawSignatureValidation(hash, signature); } } diff --git a/contracts/mocks/docs/account/MyAccountERC7702.sol b/contracts/mocks/docs/account/MyAccountERC7702.sol index a2f2ca45058..e28b578a0da 100644 --- a/contracts/mocks/docs/account/MyAccountERC7702.sol +++ b/contracts/mocks/docs/account/MyAccountERC7702.sol @@ -6,9 +6,9 @@ import {Account} from "../../../account/Account.sol"; import {ERC721Holder} from "../../../token/ERC721/utils/ERC721Holder.sol"; import {ERC1155Holder} from "../../../token/ERC1155/utils/ERC1155Holder.sol"; import {ERC7821} from "../../../account/extensions/draft-ERC7821.sol"; -import {SignerERC7702} from "../../../utils/cryptography/signers/SignerERC7702.sol"; +import {SignerEIP7702} from "../../../utils/cryptography/signers/SignerEIP7702.sol"; -contract MyAccountERC7702 is Account, SignerERC7702, ERC7821, ERC721Holder, ERC1155Holder { +contract MyAccountERC7702 is Account, SignerEIP7702, ERC7821, ERC721Holder, ERC1155Holder { /// @dev Allows the entry point as an authorized executor. function _erc7821AuthorizedExecutor( address caller, diff --git a/contracts/utils/cryptography/README.adoc b/contracts/utils/cryptography/README.adoc index 6c222d7c6ba..87c88dd54af 100644 --- a/contracts/utils/cryptography/README.adoc +++ b/contracts/utils/cryptography/README.adoc @@ -17,7 +17,7 @@ A collection of contracts and libraries that implement various signature validat * {AbstractSigner}: Abstract contract for internal signature validation in smart contracts. * {ERC7739}: An abstract contract to validate signatures following the rehashing scheme from {ERC7739Utils}. * {SignerECDSA}, {SignerP256}, {SignerRSA}: Implementations of an {AbstractSigner} with specific signature validation algorithms. - * {SignerERC7702}: Implementation of {AbstractSigner} that validates signatures using the contract's own address as the signer, useful for delegated accounts following EIP-7702. + * {SignerEIP7702}: Implementation of {AbstractSigner} that validates signatures using the contract's own address as the signer, useful for delegated accounts following EIP-7702. * {SignerWebAuthn}: Implementation of {SignerP256} that supports WebAuthn * {SignerERC7913}, {MultiSignerERC7913}, {MultiSignerERC7913Weighted}: Implementations of {AbstractSigner} that validate signatures based on ERC-7913. Including a simple and weighted multisignature scheme. * {ERC7913P256Verifier}, {ERC7913RSAVerifier}, {ERC7913WebAuthnVerifier}: Ready to use ERC-7913 signature verifiers for P256, RSA keys and WebAuthn. @@ -56,7 +56,7 @@ A collection of contracts and libraries that implement various signature validat {{SignerRSA}} -{{SignerERC7702}} +{{SignerEIP7702}} {{SignerERC7913}} diff --git a/contracts/utils/cryptography/signers/SignerERC7702.sol b/contracts/utils/cryptography/signers/SignerEIP7702.sol similarity index 90% rename from contracts/utils/cryptography/signers/SignerERC7702.sol rename to contracts/utils/cryptography/signers/SignerEIP7702.sol index b02190e1ebe..652ab37df24 100644 --- a/contracts/utils/cryptography/signers/SignerERC7702.sol +++ b/contracts/utils/cryptography/signers/SignerEIP7702.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -// OpenZeppelin Contracts (last updated v5.4.0) (utils/cryptography/signers/SignerERC7702.sol) +// OpenZeppelin Contracts (last updated v5.4.0) (utils/cryptography/signers/SignerEIP7702.sol) pragma solidity ^0.8.20; @@ -11,7 +11,7 @@ import {ECDSA} from "../ECDSA.sol"; * * @custom:stateless */ -abstract contract SignerERC7702 is AbstractSigner { +abstract contract SignerEIP7702 is AbstractSigner { /** * @dev Validates the signature using the EOA's address (i.e. `address(this)`). */ diff --git a/docs/modules/ROOT/pages/accounts.adoc b/docs/modules/ROOT/pages/accounts.adoc index c2f89963629..8c1c9557f51 100644 --- a/docs/modules/ROOT/pages/accounts.adoc +++ b/docs/modules/ROOT/pages/accounts.adoc @@ -23,7 +23,7 @@ Since the minimum requirement of xref:api:account.adoc#Account[`Account`] is to * xref:api:utils/cryptography.adoc#SignerECDSA[`SignerECDSA`]: Verifies signatures produced by regular EVM Externally Owned Accounts (EOAs). * xref:api:utils/cryptography.adoc#SignerP256[`SignerP256`]: Validates signatures using the secp256r1 curve, common for World Wide Web Consortium (W3C) standards such as FIDO keys, passkeys or secure enclaves. * xref:api:utils/cryptography.adoc#SignerRSA[`SignerRSA`]: Verifies signatures of traditional PKI systems and X.509 certificates. -* xref:api:utils/cryptography.adoc#SignerERC7702[`SignerERC7702`]: Checks EOA signatures delegated to this signer using https://eips.ethereum.org/EIPS/eip-7702#set-code-transaction[EIP-7702 authorizations] +* xref:api:utils/cryptography.adoc#SignerEIP7702[`SignerEIP7702`]: Checks EOA signatures delegated to this signer using https://eips.ethereum.org/EIPS/eip-7702#set-code-transaction[EIP-7702 authorizations] * xref:api:utils/cryptography.adoc#SignerERC7913[`SignerERC7913`]: Verifies generalized signatures following https://eips.ethereum.org/EIPS/eip-7913[ERC-7913]. * https://docs.openzeppelin.com/community-contracts/0.0.1/api/utils#SignerZKEmail[`SignerZKEmail`]: Enables email-based authentication for smart contracts using zero knowledge proofs of email authority signatures. * xref:api:utils/cryptography.adoc#MultiSignerERC7913[`MultiSignerERC7913`]: Allows using multiple ERC-7913 signers with a threshold-based signature verification system. @@ -96,9 +96,9 @@ Here's an example of how to use batched execution using EIP-7702: ---- import {Account} from "@openzeppelin/community-contracts/account/Account.sol"; import {ERC7821} from "@openzeppelin/community-contracts/account/extensions/draft-ERC7821.sol"; -import {SignerERC7702} from "@openzeppelin/community-contracts/utils/cryptography/SignerERC7702.sol"; +import {SignerEIP7702} from "@openzeppelin/community-contracts/utils/cryptography/SignerEIP7702.sol"; -contract MyAccount is Account, SignerERC7702, ERC7821 { +contract MyAccount is Account, SignerEIP7702, ERC7821 { // Override to allow the entrypoint to execute batches function _erc7821AuthorizedExecutor( address caller, diff --git a/docs/modules/ROOT/pages/eoa-delegation.adoc b/docs/modules/ROOT/pages/eoa-delegation.adoc index 935852f215d..06701f3fafa 100644 --- a/docs/modules/ROOT/pages/eoa-delegation.adoc +++ b/docs/modules/ROOT/pages/eoa-delegation.adoc @@ -10,7 +10,7 @@ This section walks you through the process of delegating an EOA to a contract fo == Delegating execution -EIP-7702 enables EOAs to delegate their execution capabilities to smart contracts, effectively bridging the gap between traditional and xref:accounts.adoc[Smart Accounts]. The xref:api:utils/cryptography.adoc#[`SignerERC7702`] utility facilitates this delegation by verifying signatures against the EOA's address (`address(this)`), making it easier to implement EIP-7702 in smart contract accounts. +EIP-7702 enables EOAs to delegate their execution capabilities to smart contracts, effectively bridging the gap between traditional and xref:accounts.adoc[Smart Accounts]. The xref:api:utils/cryptography.adoc#[`SignerEIP7702`] utility facilitates this delegation by verifying signatures against the EOA's address (`address(this)`), making it easier to implement EIP-7702 in smart contract accounts. [source,solidity] ---- @@ -86,7 +86,7 @@ WARNING: Updating the delegation designator may render your EOA unusable due to == Using with ERC-4337 -The ability to set code to execute logic on an EOA allows users to leverage ERC-4337 infrastructure to process user operations. Developers only need to combine an xref:api:account.adoc#Account[`Account`] contract with an xref:api:utils/cryptography.adoc#SignerERC7702[`SignerERC7702`] to accomplish ERC-4337 compliance out of the box. +The ability to set code to execute logic on an EOA allows users to leverage ERC-4337 infrastructure to process user operations. Developers only need to combine an xref:api:account.adoc#Account[`Account`] contract with an xref:api:utils/cryptography.adoc#SignerEIP7702[`SignerEIP7702`] to accomplish ERC-4337 compliance out of the box. === Sending a UserOp