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: bug in profit calculation #35

Merged
merged 3 commits into from
Jul 4, 2024

Conversation

ohmyfinger
Copy link

  1. Currently, the worker uses GasPrice to calculate profit when committing a transaction. This method has issues when calculating EIP1559-type transactions. Refer to

    fee.Mul(fee, effectiveTipU256)
    and use EffectiveGasTip to calculate the transaction fee.

  2. When calculating blob-type transactions, the blob fee needs to be included.

@irrun
Copy link
Collaborator

irrun commented Jun 28, 2024

I strongly agree with you, but I suggest using work.state.GetBalance(consensus.SystemAddress) as profit instead of Iterative calculation

@ohmyfinger
Copy link
Author

I agree that using SystemAddress's balance to calculate bid profit is more appropriate. However, when simulating a bundle, it is still necessary to correctly calculate the tx gas fee in order to get ethSentToSystem. Additionally, bundleGasFee is the sum of txGasFees, which also affects the sorting of bundles.

@irrun irrun changed the title fix the bug in profit calculation fix: bug in profit calculation Jul 4, 2024
@irrun
Copy link
Collaborator

irrun commented Jul 4, 2024

will merge, many thanks @ohmyfinger

@irrun irrun merged commit 5d89879 into bnb-chain:develop Jul 4, 2024
4 of 6 checks passed
irrun added a commit that referenced this pull request Jul 4, 2024
fix: bug in profit calculation (#35)
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