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

Optimize sequencing procedure #2

Merged
merged 1 commit into from
Sep 19, 2024

Conversation

Troublor
Copy link
Collaborator

@Troublor Troublor commented Sep 8, 2024

Currently sequencer needs to preparePayloadAttributes before start building the next L2 block.

attrs, err := d.attrBuilder.PreparePayloadAttributes(fetchCtx, l2Head, l1Origin.ID())

However, preparePayloadAttributes functions rely on eth_getBlockByHash JSON-RPC to fetch the L2 system config by obtaining the sequenced L2 block:

envelope, err := s.PayloadByHash(ctx, hash)

However, L2 block may be too large so that eth_getBlockByHash JSON-RPC takes a long time, blocking the process of the sequencer.
In fact, only the first transaction in the previous L2 block is needed to fetch the L2 system config.
Therefore, this PR avoids eth_getBlockByHash JSON-RPC and use eth_getTransactionByBlockHashAndIndex to fetch only the first transaction in the previous L2 block.
Thus reducing latency in sequencing process.

This PR relies on https://github.com/megaeth-labs/mega-reth/pull/115

Copy link
Collaborator

@claymega claymega left a comment

Choose a reason for hiding this comment

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

LGTM

@claymega claymega merged commit 0220aed into develop Sep 19, 2024
3 checks passed
claymega pushed a commit that referenced this pull request Sep 25, 2024
claymega pushed a commit that referenced this pull request Nov 1, 2024
claymega pushed a commit that referenced this pull request Nov 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants