Skip to content

fix: only take non-mempool tx to calculate bid price#2579

Merged
unclezoro merged 1 commit intobnb-chain:developfrom
irrun:i/mevfix
Jul 26, 2024
Merged

fix: only take non-mempool tx to calculate bid price#2579
unclezoro merged 1 commit intobnb-chain:developfrom
irrun:i/mevfix

Conversation

@irrun
Copy link
Copy Markdown
Contributor

@irrun irrun commented Jul 15, 2024

Description

define bidGasPrice as sum of (gas used * gas price ) for every non-mempool tx / by the sum of gas used for non-mempool tx.

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 (100*21000+0*1000000)/(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
  • ...

Copy link
Copy Markdown
Contributor

@unclezoro unclezoro left a comment

Choose a reason for hiding this comment

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

please hold this PR for a while

unclezoro
unclezoro previously approved these changes Jul 25, 2024
@irrun irrun requested a review from unclezoro July 25, 2024 09:29
@unclezoro unclezoro merged commit 46b88d1 into bnb-chain:develop Jul 26, 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.

3 participants