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

feat: use debug namespace for inner transactions #1201

Open
4 tasks
kyscott18 opened this issue Oct 29, 2024 · 0 comments · Fixed by #1210
Open
4 tasks

feat: use debug namespace for inner transactions #1201

kyscott18 opened this issue Oct 29, 2024 · 0 comments · Fixed by #1210
Labels
A: Sync engine Area: Sync engine T: Feature Type: Feature

Comments

@kyscott18
Copy link
Collaborator

We should move to the debug namespace because it is more performant and better supported by rpc providers. This will require some algorithmic changes. Mainly, sync-historical will have to iterate block by block, but can skip using eth_getTransactionReceipt.

Tasks

Helper functions

This is probably not a complete list, but I can envision us needing some of these:

  • shouldIncludeTrace() A trace can succeed, error, or succeed and be the child of a trace that errored. This function should return true in the first case, and false otherwise.
  • getTraceCheckpoint() Return the checkpoint for a trace. The difficult part of this is going to be the executionIndex. This is going to require ordering all traces in a transaction, using depth first search. It's gonna be a huge improvement over the previous design.
    const traces = await tx
    .deleteFrom("callTraces")
    .returningAll()
    .where("transactionHash", "=", transactionHash as Hex)
    .where("chainId", "=", chainId)
    .execute();
    traces.push(
    // @ts-ignore
    ...traceByTransactionHash[transactionHash as Hex]!.traces.map(
    (trace) => encodeCallTrace({ trace, chainId, dialect }),
    ),
    );
    // Use lexographical sort of stringified `traceAddress`.
    traces.sort((a, b) => {
    return a.traceAddress < b.traceAddress ? -1 : 1;
    });

Other notes

Is it possible to order traces and logs interweaved?

@kyscott18 kyscott18 added T: Feature Type: Feature A: Sync engine Area: Sync engine labels Oct 29, 2024
@kyscott18 kyscott18 linked a pull request Nov 5, 2024 that will close this issue
28 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A: Sync engine Area: Sync engine T: Feature Type: Feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant