-
Notifications
You must be signed in to change notification settings - Fork 624
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
[protocol_change] Decrease function call base cost #10943
Conversation
3f0d829
to
bc979d2
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.
I think we need to change more gas costs than just this one in order to avoid a situation later where we’ll want to raise the per-byte cost significantly and not be able to.
To do that, I think we should:
- Reduce execution costs as decided in the meeting, because while it’s the riskiest change (with the undercharging risk) it’s also the one we expect to get most benefit from on congested shards
- Reduce send costs to like 100-500Ggas, because while we’re unsure about execution costs, send costs should definitely be much lower than that — and reducing them might help us decongest the shards by the transactions sent by other accounts on the same shard
- Increase per-byte costs, so that the maximal size of a 4MB contract stays at the same cost. This is because we likely already undercharge for large contracts, and if we don’t increase the per-byte costs at the same time as we decrease the base costs, we won’t be able to increase it later
With these changes, we’ll lower the affine function by keeping the same end and lowering the "0 size" case. The contracts we’re interested in optimizing for are on the lower end of the size spectrum, so we should reap most of the benefits, while avoiding the risk of significant undercharging for large contracts
cc @bowenwang1996 if you have an opinion on this plan?
I likely won’t have the time to do a second round of review today, so I’ll let you land based on Akhi’s approval if the discussion stabilizes, and come back tomorrow otherwise :)
871ee4e
to
923078e
Compare
This would result in the following numbers:
This (rounds-down) the total cost for a 4_194_304 bytes contract (our |
Erratum: I used the wrong costs, as pointed out by Bowen on Zulip: The corrected estimations are:
|
3e63d7a
to
e721559
Compare
bc979d2
to
c79d18b
Compare
e721559
to
0116edd
Compare
a9b19c6
to
d25dc8c
Compare
I've updated the costs to suggested values - this PR should be ready for testing on mocknet. |
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.
LGTM! :) just assuming tests pass fine
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.
Copy paste what I wrote on zulip: I thought the discussion here refers to a later change down the line. The issue is that if we do this change as is, then we don't gain much in terms of improving receipt throughput because when a function call receipt is executed, we charge both exec cost and wasm_contract_loading_bytes. I suggest we go with changing only exec cost now and do other changes after we have a more comprehensive understanding of the performance characteristics of runtime
Copying here the results of the discussion from zulip: it’s probably best to go with option 3 described there, aka:
This gets 300kB contracts down to 1.1Tgas exec cost (the same value as just lowering function call base exec cost to 1Tgas without any other costs changes), while still keeping 4MB contracts at the same cost as before |
7aab595
to
1265c57
Compare
aa2d8b5
to
146d760
Compare
f86f49c
to
66dffdf
Compare
ddab7c2
to
3debb22
Compare
3debb22
to
2d92347
Compare
2d92347
to
6b6d8eb
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #10943 +/- ##
==========================================
+ Coverage 66.97% 71.37% +4.39%
==========================================
Files 748 760 +12
Lines 151539 152771 +1232
Branches 151539 152771 +1232
==========================================
+ Hits 101498 109041 +7543
+ Misses 45726 39206 -6520
- Partials 4315 4524 +209
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
This PR decreases the function call base execution cost to 1TGas.
It is stacked on #10941.