-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Tx Gas Estimation Improvement #4938
Comments
If we're not sure if this is what we want to do (braindump as you mentioned), is this still set to be in 0.38? |
@tnachen yes, at the very least we should explore if this is actually a feasible approach for 0.38. Being that this is pretty trivial to implement and becoming more of a huge burden for clients, I think we should get this in for 0.38. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
I tried, but this approach doesn't seem to fix the issue. There also seems to be quite some caching in the sdk, and a different order of operations can yield different gas costs (both for simulate as well as deliver) |
Any updates? |
Isn't the |
No it does, but we don't write on simulation. Also, @ethanfrey claimed this provided no benefit, so perhaps my intuition was wrong all along. |
Bumping this issue. I'm seeing gas estimates that are ~17% off trying to estimate gas for Gravity bridge. |
17% is good. Most people use 1.2 gas multiplier and raise it if the estimates are off. |
Summary
If you provide
"gas": "auto"
when submitting a tx, the application will automatically estimate gas for you viarunTxModeSimulate
before submitting it with that gas estimate.However, this estimate is not always entirely accurate for the following reasons:
As a result, the
gas-adjustment
option exists to multiply this estimate by some factor to account for the delta.However, the
gas-adjustment
can become cumbersome for clients and may have to constantly change because of (1) requiring them to constantly adjust with new values (or use very large gas and pay the fees to avoid headache).Proposal
There is not much we can do about (2) hence I propose we keep the
gas-adjustment
option. However, I propose we can remove (1) and make estimation nearly exact. I believe this can easily be done by introducing a third volatile yet ephemeral state inBaseApp
--simulateState
.During
runTxModeSimulate
, we create thissimulateState
based off of thecheckState
and cache-wrap it. This will allow us to callWrite()
and get a nearly true estimation. In addition, this is pretty trivial to implement.This is mainly a brain dump and I'm not 100% sure this works but I don't immediately see a reason why it should not work.
/cc @faboweb
For Admin Use
The text was updated successfully, but these errors were encountered: