Skip to content

Commit fc5e86a

Browse files
committed
Merge branch 'master' into feature/zk-email-7913
2 parents 4159ac2 + 53f590e commit fc5e86a

29 files changed

+1735
-65
lines changed

.github/workflows/checks.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ jobs:
4545
run: npm run test:inheritance
4646
- name: Check pragma consistency between files
4747
run: npm run test:pragma
48+
- name: Check procedurally generated contracts are up-to-date
49+
run: npm run test:generation
4850

4951
coverage:
5052
runs-on: ubuntu-latest

CHANGELOG.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
1-
## XX-XX-XXXX
1+
## 12-04-2025
22

3-
- `ERC7913Utils`: Utilities library for verifying signatures by ERC-7913 formatted signers.
43
- `SignerERC7913`: Abstract signer that verifies signatures using the ERC-7913 workflow.
54
- `ERC7913SignatureVerifierP256` and `ERC7913SignatureVerifierRSA`: Ready to use ERC-7913 verifiers that implement key verification for P256 (secp256r1) and RSA keys.
5+
- `ERC7913Utils`: Utilities library for verifying signatures by ERC-7913 formatted signers.
6+
7+
## 11-04-2025
8+
9+
- `EnumerableSetExtended` and `EnumerableMapExtended`: Extensions of the `EnumerableSet` and `EnumerableMap` libraries with more types, including non-value types.
610

711
## 03-04-2025
812

9-
- `PaymasterNFT`: Extension of `PaymasterCore` that approves sponsoring of user operation based on ownership of an ERC-721 NFT.
1013
- `PaymasterERC20`: Extension of `PaymasterCore` that sponsors user operations against payment in ERC-20 tokens.
14+
- `PaymasterERC721Owner`: Extension of `PaymasterCore` that approves sponsoring of user operation based on ownership of an ERC-721 NFT.
1115

1216
## 28-03-2025
1317

audits/2025-04-18db32c.pdf

202 KB
Binary file not shown.

audits/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Audits
2+
3+
| Date | Commit | Auditor | Scope | Links |
4+
| ------------- | ------------------------------------------------------------------------------------------ | ------------ | -------------------- | ----------------------------------------------------------- |
5+
| April 2025 | [`18db32c`](https://github.com/openzeppelin/openzeppelin-community-contracts/tree/18db32c) | OpenZeppelin | (see report) | [🔗](./2025-04-18db32c.pdf) |

contracts/account/paymaster/PaymasterNFT.sol renamed to contracts/account/paymaster/PaymasterERC721Owner.sol

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ import {PaymasterCore} from "./PaymasterCore.sol";
1212
* This paymaster will sponsor user operations if the user has at least 1 token of the token specified
1313
* during construction (or via {_setToken}).
1414
*/
15-
abstract contract PaymasterNFT is PaymasterCore {
15+
abstract contract PaymasterERC721Owner is PaymasterCore {
1616
IERC721 private _token;
1717

1818
/// @dev Emitted when the paymaster token is set.
19-
event PaymasterNFTTokenSet(IERC721 token);
19+
event PaymasterERC721OwnerTokenSet(IERC721 token);
2020

2121
constructor(IERC721 token_) {
2222
_setToken(token_);
@@ -30,7 +30,7 @@ abstract contract PaymasterNFT is PaymasterCore {
3030
/// @dev Sets the ERC-721 token used to validate the user operation.
3131
function _setToken(IERC721 token_) internal virtual {
3232
_token = token_;
33-
emit PaymasterNFTTokenSet(token_);
33+
emit PaymasterERC721OwnerTokenSet(token_);
3434
}
3535

3636
/**
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// SPDX-License-Identifier: MIT
2+
3+
pragma solidity ^0.8.20;
4+
5+
import {IERC7913SignatureVerifier} from "../../contracts/interfaces/IERC7913.sol";
6+
7+
contract ERC7913VerifierMock is IERC7913SignatureVerifier {
8+
// Store valid keys and their corresponding signatures
9+
mapping(bytes32 => bool) private _validKeys;
10+
mapping(bytes32 => mapping(bytes32 => bool)) private _validSignatures;
11+
12+
constructor() {
13+
// For testing purposes, we'll consider a specific key as valid
14+
bytes32 validKeyHash = keccak256(abi.encodePacked("valid_key"));
15+
_validKeys[validKeyHash] = true;
16+
}
17+
18+
function verify(bytes calldata key, bytes32 /* hash */, bytes calldata signature) external pure returns (bytes4) {
19+
// For testing purposes, we'll only accept a specific key and signature combination
20+
if (
21+
keccak256(key) == keccak256(abi.encodePacked("valid_key")) &&
22+
keccak256(signature) == keccak256(abi.encodePacked("valid_signature"))
23+
) {
24+
return IERC7913SignatureVerifier.verify.selector;
25+
}
26+
return 0xffffffff;
27+
}
28+
}

contracts/mocks/account/paymaster/PaymasterNFTMock.sol renamed to contracts/mocks/account/paymaster/PaymasterERC721OwnerMock.sol

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ pragma solidity ^0.8.20;
44

55
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
66
import {ERC4337Utils, PackedUserOperation} from "@openzeppelin/contracts/account/utils/draft-ERC4337Utils.sol";
7-
import {PaymasterNFT} from "../../../account/paymaster/PaymasterNFT.sol";
7+
import {PaymasterERC721Owner} from "../../../account/paymaster/PaymasterERC721Owner.sol";
88

9-
abstract contract PaymasterNFTContextNoPostOpMock is PaymasterNFT, Ownable {
9+
abstract contract PaymasterERC721OwnerContextNoPostOpMock is PaymasterERC721Owner, Ownable {
1010
using ERC4337Utils for *;
1111

1212
function _validatePaymasterUserOp(
@@ -16,14 +16,14 @@ abstract contract PaymasterNFTContextNoPostOpMock is PaymasterNFT, Ownable {
1616
) internal override returns (bytes memory context, uint256 validationData) {
1717
// use the userOp's callData as context;
1818
context = userOp.callData;
19-
// super call (PaymasterNFT) for the validation data
19+
// super call (PaymasterERC721Owner) for the validation data
2020
(, validationData) = super._validatePaymasterUserOp(userOp, userOpHash, requiredPreFund);
2121
}
2222

2323
function _authorizeWithdraw() internal override onlyOwner {}
2424
}
2525

26-
abstract contract PaymasterNFTMock is PaymasterNFTContextNoPostOpMock {
26+
abstract contract PaymasterERC721OwnerMock is PaymasterERC721OwnerContextNoPostOpMock {
2727
event PaymasterDataPostOp(bytes paymasterData);
2828

2929
function _postOp(
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// contracts/MyAccountERC7702.sol
2+
// SPDX-License-Identifier: MIT
3+
pragma solidity ^0.8.20;
4+
5+
import {Account} from "../../../account/Account.sol";
6+
import {ERC721Holder} from "@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol";
7+
import {ERC1155Holder} from "@openzeppelin/contracts/token/ERC1155/utils/ERC1155Holder.sol";
8+
import {ERC7821} from "../../../account/extensions/ERC7821.sol";
9+
import {SignerERC7702} from "../../../utils/cryptography/SignerERC7702.sol";
10+
11+
contract MyAccountERC7702 is Account, SignerERC7702, ERC7821, ERC721Holder, ERC1155Holder {
12+
/// @dev Allows the entry point as an authorized executor.
13+
function _erc7821AuthorizedExecutor(
14+
address caller,
15+
bytes32 mode,
16+
bytes calldata executionData
17+
) internal view virtual override returns (bool) {
18+
return caller == address(entryPoint()) || super._erc7821AuthorizedExecutor(caller, mode, executionData);
19+
}
20+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// contracts/MyAccount.sol
2+
// SPDX-License-Identifier: MIT
3+
4+
pragma solidity ^0.8.24;
5+
6+
import {Account} from "../../../account/Account.sol";
7+
import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";
8+
import {ERC721Holder} from "@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol";
9+
import {ERC1155Holder} from "@openzeppelin/contracts/token/ERC1155/utils/ERC1155Holder.sol";
10+
import {ERC7739} from "../../../utils/cryptography/ERC7739.sol";
11+
import {ERC7821} from "../../../account/extensions/ERC7821.sol";
12+
import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";
13+
import {SignerERC7913} from "../../../utils/cryptography/SignerERC7913.sol";
14+
15+
contract MyAccount7913 is Account, SignerERC7913, ERC7739, ERC7821, ERC721Holder, ERC1155Holder, Initializable {
16+
constructor() EIP712("MyAccount7913", "1") {}
17+
18+
function initialize(bytes memory signer) public initializer {
19+
_setSigner(signer);
20+
}
21+
22+
/// @dev Allows the entry point as an authorized executor.
23+
function _erc7821AuthorizedExecutor(
24+
address caller,
25+
bytes32 mode,
26+
bytes calldata executionData
27+
) internal view virtual override returns (bool) {
28+
return caller == address(entryPoint()) || super._erc7821AuthorizedExecutor(caller, mode, executionData);
29+
}
30+
}

contracts/mocks/import.sol

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@
33
pragma solidity ^0.8.20;
44

55
import {UpgradeableBeacon} from "@openzeppelin/contracts/proxy/beacon/UpgradeableBeacon.sol";
6+
import {ERC1271WalletMock} from "@openzeppelin/contracts/mocks/ERC1271WalletMock.sol";

0 commit comments

Comments
 (0)