-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Gas should be charged for Next, rather than Key() and Value() #2017
Comments
(assigning to Chris to reassign) |
Also TODO: consider creating a new issue for CosmosSDK "develop mode" to enable this and auto-enabling tracing etc. |
The reason that the gas KV store charges gas costs this way is that calling
Does the IAVL tree (which is what we're iterating over) do that or something else? We can definitely charge for |
Would like to look into this more myself...subscribing |
Per discussion with @jaekwon:
|
cosmos-sdk/store/gaskvstore.go
Line 139 in 63713c9
We should prob not be charging for each call of Key()/Value(), since they'd be cached once fetched anyways. I also don't think we need two separate key/value charges either.
I'd change our store gas system to charge a FlatRead upon iterator initialization, and a new FlatIterNext for calling Next, and no charge for Key or Value.
Maybe also a "UnsafeGetParent()" function that returns the parent so we can debug applications, and a TODO to add a conditional on Unsafe to only allow it when e.g. a "mode=develop" flag is set somewhere. I had to expose gasIterator to debug the 7003 crash... (see #1938)
The text was updated successfully, but these errors were encountered: