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 max fee per gas less than block base fee #289

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
Open

Conversation

syntrust
Copy link
Contributor

@syntrust syntrust commented May 28, 2024

Addressing #284

Solution

Compute the gas price from the minimum profit and use it as the gas fee cap.

Tests been done

integration_tests/node_mine_test.go#TestMining() and node tests on L1 and L2 networks shows mining can be successfully done:

  • using the minimum profitable gas price as gasFeeCap

t=2024-09-29T15:31:37+0800 lvl=info msg="Query baseFee done"                  baseFee=252
t=2024-09-29T15:31:41+0800 lvl=dbug msg="Got latest block number by Randao querier" number=6,780,060
t=2024-09-29T15:31:41+0800 lvl=dbug msg="Fetching header by number by Randao querier" number=6,780,060
t=2024-09-29T15:31:41+0800 lvl=info msg="Query gas tip cap done"              gasTipGap=1,000,000
t=2024-09-29T15:31:41+0800 lvl=info msg="Suggested gas fee cap"               gasFeeCap=1,000,252
t=2024-09-29T15:31:45+0800 lvl=info msg="Estimated gas done"                  gas=394,411
t=2024-09-29T15:31:47+0800 lvl=info msg="Minimum profitable gas fee cap"      gasFeeCap=1,270,049
t=2024-09-29T15:31:47+0800 lvl=info msg="Using profitable gas fee cap"        gasFeeCap=1,270,049
t=2024-09-29T15:31:50+0800 lvl=dbug msg="Query nonce done"                    nonce=3215
t=2024-09-29T15:32:14+0800 lvl=info msg="Submit mined result done"            shard=59 block=6,780,053 nonce=146,956 txSigner=0x2F43878FAb122D9A7596949e4985cc284feCD4B8 hash=0xf340469b69b20682a505621c03669a039d659b1ffe9aee8556cf32cfb766ab30
t=2024-09-29T15:32:22+0800 lvl=info msg="Mining transaction confirmed"        txHash=0xf340469b69b20682a505621c03669a039d659b1ffe9aee8556cf32cfb766ab30
t=2024-09-29T15:32:24+0800 lvl=info msg="Mining transaction success!      √"  miner=0x534632D6d7aD1fe5f832951c97FDe73E4eFD9a77
t=2024-09-29T15:32:24+0800 lvl=info msg="Mining transaction details"          txHash=0xf340469b69b20682a505621c03669a039d659b1ffe9aee8556cf32cfb766ab30 gasUsed=385,949 effectiveGasPrice=1,000,252
t=2024-09-29T15:32:24+0800 lvl=info msg="Mining transaction accounting (in ether)" reward=0.000000001 cost=0.000000386 profit=-0.000000385
  • drop the tx as baseFee + tip will not meet the minimum profit
t=2024-09-29T15:26:48+0800 lvl=info msg="Query gas tip cap done"              gasTipGap=1,000,000
t=2024-09-29T15:26:48+0800 lvl=info msg="Suggested gas fee cap"               gasFeeCap=1,000,252
t=2024-09-29T15:26:52+0800 lvl=info msg="Estimated gas done"                  gas=533,292
t=2024-09-29T15:28:32+0800 lvl=info msg="Minimum profitable gas fee cap"      gasFeeCap=991,580
t=2024-09-29T15:28:32+0800 lvl=warn msg="Mining tx dropped: the profit will not meet expectation" estimatedProfit=-0.000000505 minimumProfit=-0.000000500

@syntrust syntrust changed the base branch from miner_opt to main September 9, 2024 02:35
@syntrust syntrust marked this pull request as ready for review September 9, 2024 03:49
ethstorage/miner/l1_mining_api.go Outdated Show resolved Hide resolved
ethstorage/miner/l1_mining_api.go Outdated Show resolved Hide resolved
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