op-deployer: Custom gas price estimator#12239
Merged
Conversation
Sepolia's fees are super high and extremely volatile right now. As a result, it became difficult for users to deploy new chains using op-deployer. The OPCM's deploy transaction buys most of the gas in the block, and the default gas price estimation logic in the transaction manager wasn't aggressive enough for the transactions to land on chain in a timely manner. This PR adds the ability to customize the transaction manager with a custom `GasPriceEstimator` function that returns the tip, base fee, and blob fee. I extracted the original logic in the transaction manager into a default estimator that will be used if one isn't specified. For op-deployer, I built a custom estimator that pads the head block's base fee by 20%, and multiplies the suggested tip by 10. After testing this, I was able to get transactions onto Sepolia reliably. The algorithm is pretty simple and overpays for transactions by a lot, but for op-deployer's use case it's more important that transactions land quickly than it is they be cheap. Deployments are a one-time thing.
axelKingsley
reviewed
Oct 2, 2024
Contributor
axelKingsley
left a comment
There was a problem hiding this comment.
I like the abstraction, just some comments on naming.
And we could benefit from a test that confirms that the txmgr supports an overloaded estimation function. not sure if there's anything easy to extend for that.
axelKingsley
approved these changes
Oct 2, 2024
protolambda
pushed a commit
that referenced
this pull request
Oct 7, 2024
* op-deployer: Custom gas price estimator Sepolia's fees are super high and extremely volatile right now. As a result, it became difficult for users to deploy new chains using op-deployer. The OPCM's deploy transaction buys most of the gas in the block, and the default gas price estimation logic in the transaction manager wasn't aggressive enough for the transactions to land on chain in a timely manner. This PR adds the ability to customize the transaction manager with a custom `GasPriceEstimator` function that returns the tip, base fee, and blob fee. I extracted the original logic in the transaction manager into a default estimator that will be used if one isn't specified. For op-deployer, I built a custom estimator that pads the head block's base fee by 20%, and multiplies the suggested tip by 10. After testing this, I was able to get transactions onto Sepolia reliably. The algorithm is pretty simple and overpays for transactions by a lot, but for op-deployer's use case it's more important that transactions land quickly than it is they be cheap. Deployments are a one-time thing. * code review updates * better default support * specific test for extension
geoknee
reviewed
Oct 8, 2024
Comment on lines
-897
to
-898
| m.metr.RecordBaseFee(baseFee) | ||
| m.metr.RecordTipCap(tip) |
Contributor
There was a problem hiding this comment.
Did you mean to remove these metric updates? RecordTipCap is now unreferenced / dead code.
Member
There was a problem hiding this comment.
Pretty sure this needs to be added back, both metrics.
sebastianst
reviewed
Oct 8, 2024
Member
sebastianst
left a comment
There was a problem hiding this comment.
deleted metrics should be readded
Comment on lines
-897
to
-898
| m.metr.RecordBaseFee(baseFee) | ||
| m.metr.RecordTipCap(tip) |
Member
There was a problem hiding this comment.
Pretty sure this needs to be added back, both metrics.
| var blobFee *big.Int | ||
| if head.ExcessBlobGas != nil { | ||
| blobFee = eip4844.CalcBlobFee(*head.ExcessBlobGas) | ||
| m.metr.RecordBlobBaseFee(blobFee) |
Member
There was a problem hiding this comment.
this metric also needs to be added back.
samlaf
pushed a commit
to samlaf/optimism
that referenced
this pull request
Nov 10, 2024
* op-deployer: Custom gas price estimator Sepolia's fees are super high and extremely volatile right now. As a result, it became difficult for users to deploy new chains using op-deployer. The OPCM's deploy transaction buys most of the gas in the block, and the default gas price estimation logic in the transaction manager wasn't aggressive enough for the transactions to land on chain in a timely manner. This PR adds the ability to customize the transaction manager with a custom `GasPriceEstimator` function that returns the tip, base fee, and blob fee. I extracted the original logic in the transaction manager into a default estimator that will be used if one isn't specified. For op-deployer, I built a custom estimator that pads the head block's base fee by 20%, and multiplies the suggested tip by 10. After testing this, I was able to get transactions onto Sepolia reliably. The algorithm is pretty simple and overpays for transactions by a lot, but for op-deployer's use case it's more important that transactions land quickly than it is they be cheap. Deployments are a one-time thing. * code review updates * better default support * specific test for extension
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.
Sepolia's fees are super high and extremely volatile right now. As a result, it became difficult for users to deploy new chains using op-deployer. The OPCM's deploy transaction buys most of the gas in the block, and the default gas price estimation logic in the transaction manager wasn't aggressive enough for the transactions to land on chain in a timely manner.
This PR adds the ability to customize the transaction manager with a custom
GasPriceEstimatorfunction that returns the tip, base fee, and blob fee. I extracted the original logic in the transaction manager into a default estimator that will be used if one isn't specified. For op-deployer, I built a custom estimator that pads the head block's base fee by 20%, and multiplies the suggested tip by 10. After testing this, I was able to get transactions onto Sepolia reliably. The algorithm is pretty simple and overpays for transactions by a lot, but for op-deployer's use case it's more important that transactions land quickly than it is they be cheap. Deployments are a one-time thing.