Skip to content

Commit 6d74f30

Browse files
authored
Remove entrypoint address for EIP-712 signature of UserOperations (#45)
1 parent bf3593e commit 6d74f30

File tree

7 files changed

+23
-29
lines changed

7 files changed

+23
-29
lines changed

contracts/account/AccountCore.sol

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ abstract contract AccountCore is AbstractSigner, EIP712, IAccount, IAccountExecu
2424

2525
bytes32 internal constant _PACKED_USER_OPERATION =
2626
keccak256(
27-
"PackedUserOperation(address sender,uint256 nonce,bytes initCode,bytes callData,bytes32 accountGasLimits,uint256 preVerificationGas,bytes32 gasFees,bytes paymasterAndData,address entrypoint)"
27+
"PackedUserOperation(address sender,uint256 nonce,bytes initCode,bytes callData,bytes32 accountGasLimits,uint256 preVerificationGas,bytes32 gasFees,bytes paymasterAndData)"
2828
);
2929

3030
/**
@@ -119,8 +119,7 @@ abstract contract AccountCore is AbstractSigner, EIP712, IAccount, IAccountExecu
119119
userOp.accountGasLimits,
120120
userOp.preVerificationGas,
121121
userOp.gasFees,
122-
keccak256(userOp.paymasterAndData),
123-
entryPoint()
122+
keccak256(userOp.paymasterAndData)
124123
)
125124
)
126125
);

hardhat.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ require('hardhat-exposed');
1717
require('solidity-coverage');
1818
require('solidity-docgen');
1919
require('./hardhat/remappings');
20-
require('@openzeppelin/contracts/hardhat/common-contracts.js');
20+
require('@openzeppelin/contracts/hardhat/common-contracts');
2121

2222
module.exports = {
2323
solidity: {

test/account/AccountECDSA.test.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const { ethers, entrypoint } = require('hardhat');
1+
const { ethers } = require('hardhat');
22
const { loadFixture } = require('@nomicfoundation/hardhat-network-helpers');
33
const { ERC4337Helper } = require('../helpers/erc4337');
44
const { PackedUserOperation } = require('../helpers/eip712-types');
@@ -31,11 +31,10 @@ async function fixture() {
3131
verifyingContract: mock.address,
3232
};
3333

34-
const signUserOp = async userOp => {
35-
const typedOp = Object.assign(userOp.packed, { entrypoint: entrypoint.target });
36-
userOp.signature = await signer.signTypedData(domain, { PackedUserOperation }, typedOp);
37-
return userOp;
38-
};
34+
const signUserOp = userOp =>
35+
signer
36+
.signTypedData(domain, { PackedUserOperation }, userOp.packed)
37+
.then(signature => Object.assign(userOp, { signature }));
3938

4039
return { ...env, mock, domain, signer, target, beneficiary, other, signUserOp };
4140
}

test/account/AccountERC7702.test.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const { ethers, entrypoint } = require('hardhat');
1+
const { ethers } = require('hardhat');
22
const { loadFixture } = require('@nomicfoundation/hardhat-network-helpers');
33
const { ERC4337Helper } = require('../helpers/erc4337');
44
const { PackedUserOperation } = require('../helpers/eip712-types');
@@ -31,11 +31,10 @@ async function fixture() {
3131
verifyingContract: mock.address,
3232
};
3333

34-
const signUserOp = async userOp => {
35-
const typedOp = Object.assign(userOp.packed, { entrypoint: entrypoint.target });
36-
userOp.signature = await signer.signTypedData(domain, { PackedUserOperation }, typedOp);
37-
return userOp;
38-
};
34+
const signUserOp = userOp =>
35+
signer
36+
.signTypedData(domain, { PackedUserOperation }, userOp.packed)
37+
.then(signature => Object.assign(userOp, { signature }));
3938

4039
return { ...env, mock, domain, signer, target, beneficiary, other, signUserOp };
4140
}

test/account/AccountP256.test.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const { ethers, entrypoint } = require('hardhat');
1+
const { ethers } = require('hardhat');
22
const { loadFixture } = require('@nomicfoundation/hardhat-network-helpers');
33
const { ERC4337Helper } = require('../helpers/erc4337');
44
const { NonNativeSigner, P256SigningKey } = require('../helpers/signers');
@@ -37,11 +37,10 @@ async function fixture() {
3737
verifyingContract: mock.address,
3838
};
3939

40-
const signUserOp = async userOp => {
41-
const typedOp = Object.assign(userOp.packed, { entrypoint: entrypoint.target });
42-
userOp.signature = await signer.signTypedData(domain, { PackedUserOperation }, typedOp);
43-
return userOp;
44-
};
40+
const signUserOp = userOp =>
41+
signer
42+
.signTypedData(domain, { PackedUserOperation }, userOp.packed)
43+
.then(signature => Object.assign(userOp, { signature }));
4544

4645
return { ...env, mock, domain, signer, target, beneficiary, other, signUserOp };
4746
}

test/account/AccountRSA.test.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const { ethers, entrypoint } = require('hardhat');
1+
const { ethers } = require('hardhat');
22
const { loadFixture } = require('@nomicfoundation/hardhat-network-helpers');
33
const { ERC4337Helper } = require('../helpers/erc4337');
44
const { NonNativeSigner, RSASHA256SigningKey } = require('../helpers/signers');
@@ -37,11 +37,10 @@ async function fixture() {
3737
verifyingContract: mock.address,
3838
};
3939

40-
const signUserOp = async userOp => {
41-
const typedOp = Object.assign(userOp.packed, { entrypoint: entrypoint.target });
42-
userOp.signature = await signer.signTypedData(domain, { PackedUserOperation }, typedOp);
43-
return userOp;
44-
};
40+
const signUserOp = userOp =>
41+
signer
42+
.signTypedData(domain, { PackedUserOperation }, userOp.packed)
43+
.then(signature => Object.assign(userOp, { signature }));
4544

4645
return { ...env, domain, mock, signer, target, beneficiary, other, signUserOp };
4746
}

test/helpers/eip712-types.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ module.exports = mapValues(
1212
preVerificationGas: 'uint256',
1313
gasFees: 'bytes32',
1414
paymasterAndData: 'bytes',
15-
entrypoint: 'address',
1615
},
1716
},
1817
formatType,

0 commit comments

Comments
 (0)