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

fix: only take non-mempool tx to calculate bundle price #42

Merged
merged 4 commits into from
Jul 23, 2024

Conversation

irrun
Copy link
Collaborator

@irrun irrun commented Jul 15, 2024

Description

fix: only take non-mempool tx to calculate bundle price

Rationale

In current implementation, when a builder receive a bundle, it will simulate all txs within the bundle. Bundle price = sum( gas price * gas used ) /sum(gas used ) , ensure bundle price > = 1 gwei. It seems not a good solution. Consider the following example:
There is a public mempool tx with 100 gwei, gas usage 21,000 and its a simple transfer tx. A malicious actor can submit a 0 gas price tx to bundle it up with the public mempool tx, this tx has 0 gwei gas price, it can involve very complex smart contract calls and it has a gas usage of 1,000,000.
In that case, it will be (10021000+01000000)/(21000+1000000)=2.05 gwei. This means this bundle can be included by builders and land on chain.
However, the malicious actor is essentially a "free rider" in this scenario, and this actor is able to "exploit" the bundle scoring algorithm and make high-gas-usage tx land on chain for free.

Example

add an example CLI or API response...

Changes

Notable changes:

  • add each change in a bullet point here
  • ...

miner/worker_builder.go Outdated Show resolved Hide resolved
@irrun irrun force-pushed the fix-bundleprice branch from a2126c8 to cec8c0c Compare July 17, 2024 06:44
@irrun irrun merged commit dc3c294 into develop Jul 23, 2024
5 of 6 checks passed
@irrun irrun deleted the fix-bundleprice branch July 23, 2024 09:39
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