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(op-node): add l1 cache size config #225

Merged
merged 5 commits into from
Aug 15, 2024

Conversation

welkin22
Copy link
Contributor

Description

This PR includes two changes:

  1. Added a configuration item: l1.rpc-max-cache-size, with a default value of 1000. Its value must be greater than or equal to 1. It is recommended that the configured value be greater than or equal to the maximum height difference between the L1 blocks corresponding to the unsafe block height and the safe block height.
  2. When the l1 receipts cache is full, log a message to remind the user.

Rationale

In #104, I made modifications to the receipt cache of the L1 client, significantly improving the cache hit rate. However, there are some issues when the safe block height lags far behind the unsafe block height. Firstly, the L1 receipt cache data corresponding to the safe block height is only deleted from the cache after the safe block height is processed. If the safe block height lags too far behind the unsafe block height, the L1 receipt cache becomes full. This prevents the new unsafe block height from accessing the cache, triggering the optimization logic in #87, where the unsafe block height continues to produce blocks based on the same L1 block height instead of moving to the next L1 block height. Additionally, the maximum value of our cache is hardcoded in the code. If the transaction volume of the chain is too low and the batcher submission frequency is very low, it is easy for the safe block height to lag behind the unsafe block height. We need to allow users to configure the maximum value of the cache to ensure it is greater than or equal to the maximum height difference between the L1 blocks corresponding to the unsafe block height and the safe block height.

Example

none

Changes

Notable changes:

  • see description part

@github-actions github-actions bot requested review from bnoieh and krish-nr July 31, 2024 12:58
Copy link
Contributor

@krish-nr krish-nr left a comment

Choose a reason for hiding this comment

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

LGTM

@owen-reorg owen-reorg merged commit 13e63b4 into bnb-chain:develop Aug 15, 2024
13 checks passed
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.

4 participants