fix: only take non-mempool tx to calculate bid price#2579
Merged
unclezoro merged 1 commit intobnb-chain:developfrom Jul 26, 2024
irrun:i/mevfix
Merged
fix: only take non-mempool tx to calculate bid price#2579unclezoro merged 1 commit intobnb-chain:developfrom irrun:i/mevfix
unclezoro merged 1 commit intobnb-chain:developfrom
irrun:i/mevfix
Conversation
unclezoro
suggested changes
Jul 17, 2024
Contributor
unclezoro
left a comment
There was a problem hiding this comment.
please hold this PR for a while
unclezoro
previously approved these changes
Jul 25, 2024
buddh0
reviewed
Jul 25, 2024
buddh0
approved these changes
Jul 26, 2024
unclezoro
approved these changes
Jul 26, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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: