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

perf: support new api engine_opSealPayload and optimize overheads of block mining #193

Open
wants to merge 10 commits into
base: develop
Choose a base branch
from

Conversation

bnoieh
Copy link
Contributor

@bnoieh bnoieh commented Oct 8, 2024

Description

This PR adds two changes to op-geth:

  1. support new api engine_opSealPayload, this is the associated PR to feat: add new engine_opSealPayload API  opbnb#248
  2. optimize several overheads in block mining to achieve higher TPS

Rationale

Through load test, we found that it took about 200ms(10k tps case) to call/serve of engine apis and some overheads in block minting steps can be optimized. So we try to optimize it to achieve higher TPS.

Example

n/a

Changes

Notable changes:

  • support new api engine_opSealPayload
# original block produce flow
1. op-node call engine_forkchoiceUpdated
2. wait scheduled time
3. op-node call sequentially: engine_getPayload -> engine_newPayload -> engine_forkchoiceUpdated

# new block produce flow using new engine_opSealPayload API
1. op-node call engine_forkchoiceUpdated
2. wait scheduled time
3. op-node call concurrently: engine_opSealPayloadResponse & engine_getPayload
  • optimized points in block mining steps
1. Build / FinalizeAndAssemble step: concurrent IntermediateRoot   and NewBlockWithWithdrawals
2. NewPayload / ExecutableDataToBlock step: cache Block in GetPayload API then get from cache instead of ExecutableDataToBlock
3. NewPayload / it.next(validateHead inside) step:  skip it.next if in minerMode
4. NewPayload / ValidateState step: async running ValidateState
5. ForkchoiceUpdate Head / getBlockByHash step: cache block in NewPayload then get from cache
6. ForkchoiceUpdate Head / setCanoncial step: concurrent writeHeadBlock and collectLogs

@bnoieh bnoieh marked this pull request as ready for review October 18, 2024 11:07
@bnoieh bnoieh changed the title [PoC] perf: support combined engine api and optimize overheads perf: support new api engine_opSealPayload and optimize overheads of block mining Oct 21, 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.

1 participant