From 92f25feb79ef0788ced41acc1b8c99f422153849 Mon Sep 17 00:00:00 2001 From: Dror Tirosh Date: Sun, 11 Feb 2024 20:22:46 +0200 Subject: [PATCH] cleanups --- test/entrypoint.test.ts | 16 ++-------------- test/entrypointsimulations.test.ts | 2 +- test/testutils.ts | 9 ++------- 3 files changed, 5 insertions(+), 22 deletions(-) diff --git a/test/entrypoint.test.ts b/test/entrypoint.test.ts index dd291e20..ad656ce2 100644 --- a/test/entrypoint.test.ts +++ b/test/entrypoint.test.ts @@ -447,17 +447,11 @@ describe('EntryPoint', function () { describe('#handleOps', () => { let counter: TestCounter let accountExecFromEntryPoint: PopulatedTransaction - let snapshot: any before(async () => { counter = await new TestCounter__factory(ethersSigner).deploy() const count = await counter.populateTransaction.count() accountExecFromEntryPoint = await account.populateTransaction.execute(counter.address, 0, count.data!) - snapshot = await ethers.provider.send('evm_snapshot', []) - }) - - after(async () => { - await ethers.provider.send('evm_revert', [snapshot]) }) it('should revert on signature failure', async () => { @@ -657,14 +651,8 @@ describe('EntryPoint', function () { const beneficiaryAddress = createAddress() // "warmup" userop, for better gas calculation, below - await entryPoint.handleOps([await fillSignAndPack({ - sender: account.address, - callData: accountExec.data - }, accountOwner, entryPoint)], beneficiaryAddress) - await entryPoint.handleOps([await fillSignAndPack({ - sender: account.address, - callData: accountExec.data - }, accountOwner, entryPoint)], beneficiaryAddress) + await entryPoint.handleOps([await fillSignAndPack({ sender: account.address, callData: accountExec.data }, accountOwner, entryPoint)], beneficiaryAddress) + await entryPoint.handleOps([await fillSignAndPack({ sender: account.address, callData: accountExec.data }, accountOwner, entryPoint)], beneficiaryAddress) const op1 = await fillSignAndPack({ sender: account.address, diff --git a/test/entrypointsimulations.test.ts b/test/entrypointsimulations.test.ts index fe320525..eb9dc2ca 100644 --- a/test/entrypointsimulations.test.ts +++ b/test/entrypointsimulations.test.ts @@ -275,7 +275,7 @@ describe('EntryPointSimulations', function () { const { proxy: account } = await createAccount(ethersSigner, owner.address, entryPoint.address) sender = account.address await fund(account) - pmVgl = await findSimulationUserOpWithMin(async n => userOpWithGas(1e6, n), entryPoint, 1, 500000) + pmVgl = await findSimulationUserOpWithMin(async n => userOpWithGas(1e5, n), entryPoint, 1, 500000) vgl = await findSimulationUserOpWithMin(async n => userOpWithGas(n, pmVgl), entryPoint, 3000, 500000) const userOp = await userOpWithGas(vgl, pmVgl) diff --git a/test/testutils.ts b/test/testutils.ts index 72ab785b..14370a7f 100644 --- a/test/testutils.ts +++ b/test/testutils.ts @@ -24,10 +24,7 @@ import { expect } from 'chai' import { Create2Factory } from '../src/Create2Factory' import { debugTransaction } from './debugTx' import { UserOperation } from './UserOperation' -import { packUserOp } from './UserOp' -import Debug from 'debug' - -const debug = Debug('aa.testutils') +import { packUserOp, simulateValidation } from './UserOp' export const AddressZero = ethers.constants.AddressZero export const HashZero = ethers.constants.HashZero @@ -174,9 +171,7 @@ export function decodeRevertReason (data: string | Error, nullIfNoMatch = true): if (typeof data !== 'string') { const err = data as any data = (err.data ?? err.error?.data) as string - if (typeof data !== 'string') { - return err.message - } + if (typeof data !== 'string') throw err } const methodSig = data.slice(0, 10)