Skip to content

Commit

Permalink
cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
drortirosh committed Feb 11, 2024
1 parent b095b6d commit 92f25fe
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 22 deletions.
16 changes: 2 additions & 14 deletions test/entrypoint.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 () => {
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion test/entrypointsimulations.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
9 changes: 2 additions & 7 deletions test/testutils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 92f25fe

Please sign in to comment.