Skip to content

Commit c924e97

Browse files
committed
Merge branch 'master' into feature/zk-email
2 parents e1d6297 + 53f590e commit c924e97

30 files changed

+2010
-4
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: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
## 12-04-2025
2+
3+
- `SignerERC7913`: Abstract signer that verifies signatures using the ERC-7913 workflow.
4+
- `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.
10+
111
## 03-04-2025
212

313
- `PaymasterERC20`: Extension of `PaymasterCore` that sponsors user operations against payment in ERC-20 tokens.

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/interfaces/IERC7913.sol

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// SPDX-License-Identifier: MIT
2+
3+
pragma solidity ^0.8.0;
4+
5+
/**
6+
* @dev Signature verifier interface.
7+
*/
8+
interface IERC7913SignatureVerifier {
9+
/**
10+
* @dev Verifies `signature` as a valid signature of `hash` by `key`.
11+
*
12+
* MUST return the bytes4 magic value IERC7913SignatureVerifier.verify.selector if the signature is valid.
13+
* SHOULD return 0xffffffff or revert if the signature is not valid.
14+
* SHOULD return 0xffffffff or revert if the key is empty
15+
*/
16+
function verify(bytes calldata key, bytes32 hash, bytes calldata signature) external view returns (bytes4);
17+
}
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+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// SPDX-License-Identifier: MIT
2+
3+
pragma solidity ^0.8.24;
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 {ERC7739} from "../../utils/cryptography/ERC7739.sol";
9+
import {ERC7821} from "../../account/extensions/ERC7821.sol";
10+
import {SignerERC7913} from "../../utils/cryptography/SignerERC7913.sol";
11+
12+
abstract contract AccountERC7913Mock is Account, SignerERC7913, ERC7739, ERC7821, ERC721Holder, ERC1155Holder {
13+
constructor(bytes memory _signer) {
14+
_setSigner(_signer);
15+
}
16+
17+
/// @inheritdoc ERC7821
18+
function _erc7821AuthorizedExecutor(
19+
address caller,
20+
bytes32 mode,
21+
bytes calldata executionData
22+
) internal view virtual override returns (bool) {
23+
return caller == address(entryPoint()) || super._erc7821AuthorizedExecutor(caller, mode, executionData);
24+
}
25+
}
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
@@ -4,3 +4,4 @@ pragma solidity ^0.8.20;
44

55
import {UpgradeableBeacon} from "@openzeppelin/contracts/proxy/beacon/UpgradeableBeacon.sol";
66
import {ECDSAOwnedDKIMRegistry} from "@zk-email/email-tx-builder/utils/ECDSAOwnedDKIMRegistry.sol";
7+
import {ERC1271WalletMock} from "@openzeppelin/contracts/mocks/ERC1271WalletMock.sol";

0 commit comments

Comments
 (0)