-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
txmgr: call EstimateGas
correctly for blob tx
#12086
Conversation
1bf8fad
to
43ef62e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @zhiqiangxu. Are you able to add or modify unit tests for this?
Is there an example for such test? It needs to be like:
Without this PR it should revert. |
I don't think we need to go to those lengths. I was thinking we could trigger the code path in question inside this test or variant of it where the optimism/op-service/txmgr/txmgr_test.go Lines 590 to 612 in 2526dc0
Then we would need to assert that the gas limit is estimated high enough. If you run the test with and without your changes, I think you would expect different gas in each case -- this helps to understand the nature of the bug here. |
Sorry I don't quite understand how's your plan to test it. The original implementation doesn't carry the blob hash over when estimating, but it doesn't necessarily lead to higher or lower gas IMO. |
Ah yes I think you are right, the transaction will be charged for blobGas but this is independent of the regular gas estimated in |
Yeah it will not work for a contract that's requiring tx blob(e.g., revert if no blob) or any contract that's making use of blobs. It's quite hard to simulate it in unit test, but I'm quite confident it's a correct change. |
EstimateGas
correctly for blob txEstimateGas
correctly for blob tx
I see, the gas estimation could completely in that corner case. On reflection it doesn't seem worth the effort to add any more tests for this. |
c65c1f8
SimpleTxManager
is a generic tool for sending tx used by various components, and the candidate tx may be a blob tx.This PR makes
EstimateGas
work correctly for blob tx.