-
Notifications
You must be signed in to change notification settings - Fork 428
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
Add gas cost for UnpackAny
#2115
Conversation
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.
Great work! LGTM 👍
Ok, I added the constant, but also fixed a bug that I forgot to push the fix for: The gas cost (at least according to my benchmark) seems pretty constant and not related to the message size (see numbers above), so it should not be multiplied with the length |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2115 +/- ##
=======================================
Coverage 46.20% 46.21%
=======================================
Files 78 78
Lines 10810 10811 +1
=======================================
+ Hits 4995 4996 +1
Misses 5368 5368
Partials 447 447
|
breaking for people using a custom Any encoder
Benchmark results:
So, it looks like it takes roughly 700ns
Our gas target in CosmWasm uses a target of 1e12 Gas/s = 1e3 Gas/ns. That means:
1e3 Gas/ns * 700ns = 700000 Gas (in CW Gas units)
With the default gas multiplier, it's 5 SDK gas