Skip to content

Commit 9e85794

Browse files
Transpile ab96c4871
1 parent 8cb7caa commit 9e85794

11 files changed

+487
-17
lines changed

.changeset/seven-insects-taste.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'openzeppelin-solidity': patch
3+
---
4+
5+
`ERC7579Utils`: Add ABI decoding checks on calldata bounds within `decodeBatch`

foundry.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ out = 'out'
88
libs = ['node_modules', 'lib']
99
test = 'test'
1010
cache_path = 'cache_forge'
11+
fs_permissions = [{ access = "read", path = "./test/bin" }]
1112

1213
[fuzz]
1314
runs = 5000

test/account/utils/draft-ERC4337Utils.test.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@ const { expect } = require('chai');
33
const { loadFixture } = require('@nomicfoundation/hardhat-network-helpers');
44

55
const { packValidationData, UserOperation } = require('../../helpers/erc4337');
6+
const { deployEntrypoint } = require('../../helpers/erc4337-entrypoint');
67
const { MAX_UINT48 } = require('../../helpers/constants');
78
const ADDRESS_ONE = '0x0000000000000000000000000000000000000001';
89

910
const fixture = async () => {
10-
const [authorizer, sender, entrypoint, factory, paymaster] = await ethers.getSigners();
11+
const { entrypoint } = await deployEntrypoint();
12+
const [authorizer, sender, factory, paymaster] = await ethers.getSigners();
1113
const utils = await ethers.deployContract('$ERC4337Utils');
1214
const SIG_VALIDATION_SUCCESS = await utils.$SIG_VALIDATION_SUCCESS();
1315
const SIG_VALIDATION_FAILED = await utils.$SIG_VALIDATION_FAILED();
@@ -167,11 +169,19 @@ describe('ERC4337Utils', function () {
167169
describe('hash', function () {
168170
it('returns the operation hash with specified entrypoint and chainId', async function () {
169171
const userOp = new UserOperation({ sender: this.sender, nonce: 1 });
170-
const chainId = 0xdeadbeef;
172+
const chainId = await ethers.provider.getNetwork().then(({ chainId }) => chainId);
173+
const otherChainId = 0xdeadbeef;
171174

175+
// check that helper matches entrypoint logic
176+
expect(this.entrypoint.getUserOpHash(userOp.packed)).to.eventually.equal(userOp.hash(this.entrypoint, chainId));
177+
178+
// check library against helper
172179
expect(this.utils.$hash(userOp.packed, this.entrypoint, chainId)).to.eventually.equal(
173180
userOp.hash(this.entrypoint, chainId),
174181
);
182+
expect(this.utils.$hash(userOp.packed, this.entrypoint, otherChainId)).to.eventually.equal(
183+
userOp.hash(this.entrypoint, otherChainId),
184+
);
175185
});
176186
});
177187

0 commit comments

Comments
 (0)