Skip to content

Commit

Permalink
Adding usingErc7562NativeTracer
Browse files Browse the repository at this point in the history
  • Loading branch information
shahafn committed Dec 22, 2024
1 parent e901b5d commit 6beec6b
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions packages/validation-manager/src/ValidationManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import {
} from '@account-abstraction/utils'

import { tracerResultParser } from './TracerResultParser'
import { BundlerTracerResult, ExitInfo } from './BundlerCollectorTracer'
import { bundlerCollectorTracer, BundlerTracerResult, ExitInfo } from './BundlerCollectorTracer'
import { debug_traceCall } from './GethTracer'

import EntryPointSimulationsJson from '@account-abstraction/contracts/artifacts/EntryPointSimulations.json'
Expand Down Expand Up @@ -153,20 +153,24 @@ export class ValidationManager implements IValidationManager {
},
...stateOverride
}
let tracer
if (!this.usingErc7562NativeTracer()) {
tracer = bundlerCollectorTracer
}
const tracerResult = await debug_traceCall(provider, {
from: AddressZero,
to: this.entryPoint.address,
data: simulateCall,
gasLimit: simulationGas
}, {
// tracer: bundlerCollectorTracer,
tracer,
stateOverrides
},
this.providerForTracer
)

let data: any
if (this.providerForTracer != null) {
if (!this.usingErc7562NativeTracer()) {
// Using preState tracer + JS tracer
const lastResult = tracerResult.calls.slice(-1)[0]
data = (lastResult as ExitInfo).data
Expand Down Expand Up @@ -242,7 +246,9 @@ export class ValidationManager implements IValidationManager {
})
// console.log('validation res', res)
// todo fix
this.convertTracerResult(tracerResult, userOp)
if (this.usingErc7562NativeTracer()) {
this.convertTracerResult(tracerResult, userOp)
}
// console.log('tracer res')
// console.dir(tracerResult, { depth: null })
let contractAddresses: string[]
Expand Down Expand Up @@ -528,4 +534,8 @@ export class ValidationManager implements IValidationManager {
}
return opcodeNames[opcodeNumber] ?? opcodeNumber
}

usingErc7562NativeTracer (): boolean {
return this.providerForTracer == null
}
}

0 comments on commit 6beec6b

Please sign in to comment.