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

Check upfront profitability + Unprofitable txs cache and retry limit #565

Merged
merged 3 commits into from
Jan 31, 2024

Conversation

fab-10
Copy link
Collaborator

@fab-10 fab-10 commented Jan 23, 2024

With this PR we want to mitigate the impact of unprofitable txs on the block creation process.
Fixes #564

  1. do a profitability check before processing the tx, using the gasLimit, this way we can filter txs that are upfront unprofitable without never processing them. If this check is not passed then the new TX_UNPROFITABLE_UPFRONT code is returned.
  2. remember about unprofitable txs across block creations, this way we can put a limit to the number of these txs that are reprocessed every block. If an cached unprofitable tx is not retried due to max number of retries reached, then the new TX_UNPROFITABLE_RETRY_LIMIT code is returned.
  3. only retry unprofitable txs if the current block minGasPrice is decreased, if not the new TX_UNPROFITABLE_MIN_GAS_PRICE_INCREASED code is returned

Two new options:

  1. plugin-linea-unprofitable-cache-size max number of unprofitable txs we keep track of. Default 100_000.
  2. plugin-linea-unprofitable-retry-limit how many cached unprofitable txs could be retried every block, Default 10.

@fab-10 fab-10 force-pushed the unprofitable-txs-cache branch 6 times, most recently from acaa580 to e67d089 Compare January 24, 2024 09:34
@julien-marchand
Copy link
Member

LGTM so far

Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
@fab-10 fab-10 requested a review from jonesho January 30, 2024 11:08
@fab-10 fab-10 enabled auto-merge (squash) January 30, 2024 11:37
@fab-10 fab-10 requested a review from Filter94 January 30, 2024 14:38
Copy link

@jonesho jonesho left a comment

Choose a reason for hiding this comment

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

LGTM

@fab-10 fab-10 merged commit 1467e19 into main Jan 31, 2024
6 checks passed
@fab-10 fab-10 deleted the unprofitable-txs-cache branch January 31, 2024 08:59
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.

Reduce the overhead of unprofitable transactions during block creation
5 participants