-
Notifications
You must be signed in to change notification settings - Fork 223
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
Closed
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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. | ||
|
@@ -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. | ||
* 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: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is getting weird. There was a problem hiding this comment. Choose a reason for hiding this commentThe 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" | ||
|
@@ -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 => { | ||
|
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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