Skip to content

Commit

Permalink
Override config for EntryPointSimulations
Browse files Browse the repository at this point in the history
  • Loading branch information
forshtat committed Dec 26, 2024
1 parent 36b7902 commit 6c9b7ef
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 12 deletions.
15 changes: 14 additions & 1 deletion hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,23 @@ const config: HardhatUserConfig = {
evmVersion: 'cancun',
viaIR: true,
optimizer: { enabled: true, runs: 1000000 }
},
}],
overrides: {
'contracts/core/EntryPointSimulations.sol': {
version: '0.8.28',
settings: {
evmVersion: 'cancun',
viaIR: false,
optimizer: { enabled: true, runs: 100 }
}
}
}]
}
},
networks: {
hardhat: {
allowUnlimitedContractSize: true,
},
dev: { url: 'http://localhost:8545' },
// github action starts localgeth service, for gas calculations
localgeth: { url: 'http://localgeth:8545' },
Expand Down
20 changes: 9 additions & 11 deletions test/entrypointsimulations.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ describe('EntryPointSimulations', function () {

function costInRange (simCost: BigNumber, epCost: BigNumber, message: string): void {
const diff = simCost.sub(epCost).toNumber()
const max = 350
const max = 360
expect(diff).to.be.within(0, max,
`${message} cost ${simCost.toNumber()} should be (up to ${max}) above ep cost ${epCost.toNumber()}`)
}
Expand Down Expand Up @@ -299,17 +299,15 @@ describe('EntryPointSimulations', function () {
execPmVgl = withPaymaster === 'without' ? 0 : await findUserOpWithMin(async n => userOpWithGas(1e6, n), false, entryPoint, 1, 500000)
execVgl = await findUserOpWithMin(async n => userOpWithGas(n, execPmVgl), false, entryPoint, 1, 500000)
})
it.skip(
`account verification simulation cost should be higher than execution ${withPaymaster} paymaster`, function () {
console.log('simulation account validation', vgl, 'above exec:', vgl - execVgl)
expect(vgl).to.be.within(execVgl + 1, execVgl + diff, `expected simulation verificationGas to be 1..${diff} above actual, but was ${vgl - execVgl}`)
})
it(`account verification simulation cost should be higher than execution ${withPaymaster} paymaster`, function () {
console.log('simulation account validation', vgl, 'above exec:', vgl - execVgl)
expect(vgl).to.be.within(execVgl + 1, execVgl + diff, `expected simulation verificationGas to be 1..${diff} above actual, but was ${vgl - execVgl}`)
})
if (withPaymaster === 'with') {
it.skip(
'paymaster verification simulation cost should be higher than execution', function () {
console.log('simulation paymaster validation', pmVgl, 'above exec:', pmVgl - execPmVgl)
expect(pmVgl).to.be.within(execPmVgl + 1, execPmVgl + diff, `expected simulation verificationGas to be 1..${diff} above actual, but was ${pmVgl - execPmVgl}`)
})
it('paymaster verification simulation cost should be higher than execution', function () {
console.log('simulation paymaster validation', pmVgl, 'above exec:', pmVgl - execPmVgl)
expect(pmVgl).to.be.within(execPmVgl + 1, execPmVgl + diff, `expected simulation verificationGas to be 1..${diff} above actual, but was ${pmVgl - execPmVgl}`)
})
}
})

Expand Down

0 comments on commit 6c9b7ef

Please sign in to comment.