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

Retry mining transactions #291

Draft
wants to merge 24 commits into
base: miner_opt1
Choose a base branch
from
Draft

Retry mining transactions #291

wants to merge 24 commits into from

Conversation

syntrust
Copy link
Collaborator

@syntrust syntrust commented Jun 6, 2024

Apply Optimism's txmgr to retry mining transactions.
The basic idea is to retry a tx with an updated gas fee cap and tip (at least 10% up) if it is pending until successfully confirmed or timed out.

The txmgr.go file has been modified to add profit check logic. The other 2 files remain untouched.
The original source can be found at https://github.com/ethereum-optimism/optimism/tree/v1.4.2/op-service/txmgr

The following log demonstrates the process of a transaction that has been dropped after bumping the gas price:

t=2024-06-21T13:33:56+0800 lvl=info msg="Creating tx"                           service=miner to=0x90381C3Bc1c44083088dBa915E444f92F880D280 from=0x471977571aD818379E2b6CC37792a5EaC85FdE22
t=2024-06-21T13:33:57+0800 lvl=info msg="Querying mining reward"                shard=0 block=6,152,658
t=2024-06-21T13:33:57+0800 lvl=info msg="Estimated reward and cost (in ether)"  reward=3.4605957e-10   cost=1.706535397e-06 profit=-1.706189337e-06
t=2024-06-21T13:33:57+0800 lvl=info msg="Publishing transaction"                service=miner hash=0xf5b387b213ebc3e81818cc60e929f702aec7f2806cc85f0907e12ab4026bfd68 nonce=643       gasTipCap=3,529,359 gasFeeCap=4,789,543
t=2024-06-21T13:33:57+0800 lvl=info msg="Transaction published"                 service=miner hash=0xf5b387b213ebc3e81818cc60e929f702aec7f2806cc85f0907e12ab4026bfd68 nonce=643       gasTipCap=3,529,359 gasFeeCap=4,789,543
t=2024-06-21T13:34:21+0800 lvl=info msg="Publishing transaction"                service=miner hash=0xf5b387b213ebc3e81818cc60e929f702aec7f2806cc85f0907e12ab4026bfd68 nonce=643       gasTipCap=3,529,359 gasFeeCap=4,789,543
t=2024-06-21T13:34:21+0800 lvl=info msg="bumping gas price for tx"              service=miner hash=0xf5b387b213ebc3e81818cc60e929f702aec7f2806cc85f0907e12ab4026bfd68 gasTipCap=3,529,359 gasFeeCap=4,789,543 gaslimit=410,279
t=2024-06-21T13:34:23+0800 lvl=info msg="re-estimated gas differs"              service=miner oldgas=410,279 newgas=374,454 gasFeeCap=5,268,498 gasTipCap=3,882,295
t=2024-06-21T13:34:23+0800 lvl=info msg="Querying mining reward"                shard=0 block=6,152,658
t=2024-06-21T13:34:23+0800 lvl=info msg="Estimated reward and cost (in ether)"  reward=3.4605957e-10   cost=3.426551042e-06 profit=-3.426204982e-06
t=2024-06-21T13:34:23+0800 lvl=warn msg="The tx is dropped: the profit will not meet expectation" profitEstimated=-3,426,204,982,452 minimumProfit=-3,000,000,000,000
t=2024-06-21T13:34:23+0800 lvl=warn msg="bumping gas price will not work"              service=miner bumpedTip=3,882,295 bumpedFee=5,268,498 err="meet drop criteria"
t=2024-06-21T13:34:23+0800 lvl=warn msg="Transaction dropped"                   service=miner hash=0xf5b387b213ebc3e81818cc60e929f702aec7f2806cc85f0907e12ab4026bfd68 nonce=643       gasTipCap=3,529,359 gasFeeCap=4,789,543 err="meet drop criteria"

@syntrust
Copy link
Collaborator Author

Lower priority since #289 may reduce the chances of dropping a tx.

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.

1 participant