Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AA-474 Migrate to native tracer #233

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/validation-manager/src/BundlerCollectorTracer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ export interface TopLevelCallInfo {
contractSize: { [addr: string]: ContractSizeInfo }
extCodeAccessInfo: { [addr: string]: string }
oog?: boolean
calls?: []
}

/**
Expand Down
19 changes: 13 additions & 6 deletions packages/validation-manager/src/GethTracer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const debug = Debug('aa.tracer')
// the name of the native tracer.
// equivalent to the javascript "bundlerCollectorTracer".
export const bundlerNativeTracerName = 'bundlerCollectorTracer'
export const GethNativeTracerName = 'erc7562Tracer'

/**
* a function returning a LogTracer.
Expand All @@ -26,16 +27,17 @@ type LogTracerFunc = () => LogTracer
* @param provider the network node to trace on
* @param tx the transaction to trace
* @param options the trace options
* @param nativeTracerProvider if set, submit only preStateTracer to the network provider, and use this (second) provider with native tracer.
* @param prestateTracerProvider if set, submit only preStateTracer to the network provider, and use this (second) provider with native tracer.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment is not very clear or correct.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is going to be removed completely

* if null, then use javascript tracer on the first provider.
*/

// eslint-disable-next-line @typescript-eslint/naming-convention
export async function debug_traceCall (provider: JsonRpcProvider, tx: Deferrable<TransactionRequest>, options: TraceOptions, nativeTracerProvider?: JsonRpcProvider): Promise<TraceResult | any> {
export async function debug_traceCall (provider: JsonRpcProvider, tx: Deferrable<TransactionRequest>, options: TraceOptions, prestateTracerProvider?: JsonRpcProvider): Promise<TraceResult | any> {
const tx1 = await resolveProperties(tx)
const traceOptions = tracer2string(options)
if (nativeTracerProvider != null) {
// there is a nativeTracerProvider: use it for the native tracer, but first we need preStateTracer from the main provider:
let traceOptions: TraceOptions
if (prestateTracerProvider != null) {
traceOptions = tracer2string(options)
// there is a prestateTracerProvider: use it for the native tracer, but first we need preStateTracer from the main provider:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is getting weird.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dror added the prestate tracer usage. It's an interim solution until the native tracer is out. What is getting weird?

const preState: { [addr: string]: any } = await provider.send('debug_traceCall', [tx1, 'latest', { ...traceOptions, tracer: 'prestateTracer' }])

// fix prestate to be valid "state overrides"
Expand All @@ -52,12 +54,17 @@ export async function debug_traceCall (provider: JsonRpcProvider, tx: Deferrable
}
}

const ret = await nativeTracerProvider.send('debug_traceCall', [tx1, 'latest', {
const ret = await prestateTracerProvider.send('debug_traceCall', [tx1, 'latest', {
tracer: bundlerNativeTracerName,
stateOverrides: preState
}])

return ret
} else if (options.tracer != null) {
traceOptions = tracer2string(options)
} else {
traceOptions = options
traceOptions.tracer = GethNativeTracerName
}

const ret = await provider.send('debug_traceCall', [tx1, 'latest', traceOptions]).catch(e => {
Expand Down
Loading
Loading