-
Notifications
You must be signed in to change notification settings - Fork 156
Bumping up solidity to version 0.7.x #197
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
Conversation
Before: ·--------------------------------------------------|----------------------------|-------------|----------------------------· | Solc version: 0.6.12 · Optimizer enabled: false · Runs: 200 · Block limit: 9500000 gas │ ···················································|····························|·············|····························· | Methods │ ·····················|·····························|·············|··············|·············|··············|·············· | Contract · Method · Min · Max · Avg · # calls · usd (avg) │ ·····················|·····························|·············|··············|·············|··············|·············· | Orchestrator · addTransaction · 73183 · 133742 · 111811 · 6 · - │ ·····················|·····························|·············|··············|·············|··············|·············· | Orchestrator · rebase · 27392 · 127097 · 83259 · 80 · - │ ·····················|·····························|·············|··············|·············|··············|·············· | Orchestrator · removeTransaction · 29366 · 53067 · 38982 · 3 · - │ ·····················|·····························|·············|··············|·············|··············|·············· | Orchestrator · setTransactionEnabled · 25962 · 30150 · 28056 · 2 · - │ ·····················|·····························|·············|··············|·············|··············|·············· | Orchestrator · transferOwnership · - · - · 30996 · 1 · - │ ·····················|·····························|·············|··············|·············|··············|·············· | UFragments · approve · 16758 · 46830 · 36712 · 34 · - │ ·····················|·····························|·············|··············|·············|··············|·············· | UFragments · decreaseAllowance · 28621 · 32943 · 30782 · 8 · - │ ·····················|·····························|·············|··············|·············|··············|·············· | UFragments · increaseAllowance · 32940 · 47964 · 38952 · 10 · - │ ·····················|·····························|·············|··············|·············|··············|·············· | UFragments · permit · - · - · 77678 · 3 · - │ ·····················|·····························|·············|··············|·············|··············|·············· | UFragments · rebase · 27688 · 38611 · 35350 · 13 · - │ ·····················|·····························|·············|··············|·············|··············|·············· | UFragments · setMonetaryPolicy · - · - · 47352 · 8 · - │ ·····················|·····························|·············|··············|·············|··············|·············· | UFragments · transfer · 39976 · 54952 · 53586 · 11 · - │ ·····················|·····························|·············|··············|·············|··············|·············· | UFragments · transferAll · 31215 · 39615 · 37515 · 4 · - │ ·····················|·····························|·············|··············|·············|··············|·············· | UFragments · transferAllFrom · 31240 · 46240 · 34718 · 5 · - │ ·····················|·····························|·············|··············|·············|··············|·············· | UFragments · transferFrom · - · - · 46705 · 2 · - │ ·····················|·····························|·············|··············|·············|··············|·············· | UFragmentsPolicy · setCpiOracle · 31279 · 46279 · 38779 · 4 · - │ ·····················|·····························|·············|··············|·············|··············|·············· | UFragmentsPolicy · setDeviationThreshold · 15202 · 30262 · 18214 · 5 · - │ ·····················|·····························|·············|··············|·············|··············|·············· | UFragmentsPolicy · setMarketOracle · 31322 · 46322 · 38822 · 4 · - │ ·····················|·····························|·············|··············|·············|··············|·············· | UFragmentsPolicy · setOrchestrator · 31255 · 46243 · 38749 · 4 · - │ ·····················|·····························|·············|··············|·············|··············|·············· | UFragmentsPolicy · setRebaseLag · - · - · 30281 · 2 · - │ ·····················|·····························|·············|··············|·············|··············|·············· | UFragmentsPolicy · setRebaseTimingParameters · 25623 · 40659 · 29567 · 15 · - │ ·····················|·····························|·············|··············|·············|··············|·············· | Deployments · · % of limit · │ ···················································|·············|··············|·············|··············|·············· | Orchestrator · - · - · 1120224 · 11.8 % · - │ ···················································|·············|··············|·············|··············|·············· | UFragments · - · - · 2719685 · 28.6 % · - │ ···················································|·············|··············|·············|··············|·············· | UFragmentsPolicy · - · - · 1399131 · 14.7 % · - │ ·--------------------------------------------------|-------------|--------------|-------------|--------------|-------------· After: ·--------------------------------------------------|---------------------------|-------------|----------------------------· | Solc version: 0.7.6 · Optimizer enabled: true · Runs: 200 · Block limit: 9500000 gas │ ···················································|···························|·············|····························· | Methods │ ·····················|·····························|·············|·············|·············|··············|·············· | Contract · Method · Min · Max · Avg · # calls · usd (avg) │ ·····················|·····························|·············|·············|·············|··············|·············· | Orchestrator · addTransaction · 71349 · 131907 · 109976 · 6 · - │ ·····················|·····························|·············|·············|·············|··············|·············· | Orchestrator · rebase · 27372 · 123539 · 80703 · 80 · - │ ·····················|·····························|·············|·············|·············|··············|·············· | Orchestrator · removeTransaction · 28443 · 51261 · 37474 · 3 · - │ ·····················|·····························|·············|·············|·············|··············|·············· | Orchestrator · setTransactionEnabled · 25842 · 30030 · 27936 · 2 · - │ ·····················|·····························|·············|·············|·············|··············|·············· | Orchestrator · transferOwnership · - · - · 30900 · 1 · - │ ·····················|·····························|·············|·············|·············|··············|·············· | UFragments · approve · 16707 · 46779 · 36661 · 34 · - │ ·····················|·····························|·············|·············|·············|··············|·············· | UFragments · decreaseAllowance · 28540 · 32820 · 30680 · 8 · - │ ·····················|·····························|·············|·············|·············|··············|·············· | UFragments · increaseAllowance · 32828 · 47852 · 38840 · 10 · - │ ·····················|·····························|·············|·············|·············|··············|·············· | UFragments · permit · 76657 · 76681 · 76665 · 3 · - │ ·····················|·····························|·············|·············|·············|··············|·············· | UFragments · rebase · 27579 · 38319 · 35102 · 13 · - │ ·····················|·····························|·············|·············|·············|··············|·············· | UFragments · setMonetaryPolicy · - · - · 47269 · 8 · - │ ·····················|·····························|·············|·············|·············|··············|·············· | UFragments · transfer · 39802 · 54778 · 53412 · 11 · - │ ·····················|·····························|·············|·············|·············|··············|·············· | UFragments · transferAll · 31091 · 39491 · 37391 · 4 · - │ ·····················|·····························|·············|·············|·············|··············|·············· | UFragments · transferAllFrom · 31049 · 46049 · 34527 · 5 · - │ ·····················|·····························|·············|·············|·············|··············|·············· | UFragments · transferFrom · - · - · 46473 · 2 · - │ ·····················|·····························|·············|·············|·············|··············|·············· | UFragmentsPolicy · setCpiOracle · 31213 · 46213 · 38713 · 4 · - │ ·····················|·····························|·············|·············|·············|··············|·············· | UFragmentsPolicy · setDeviationThreshold · 15111 · 30171 · 18123 · 5 · - │ ·····················|·····························|·············|·············|·············|··············|·············· | UFragmentsPolicy · setMarketOracle · 31256 · 46256 · 38756 · 4 · - │ ·····················|·····························|·············|·············|·············|··············|·············· | UFragmentsPolicy · setOrchestrator · 31189 · 46177 · 38683 · 4 · - │ ·····················|·····························|·············|·············|·············|··············|·············· | UFragmentsPolicy · setRebaseLag · - · - · 30190 · 2 · - │ ·····················|·····························|·············|·············|·············|··············|·············· | UFragmentsPolicy · setRebaseTimingParameters · 25491 · 40527 · 29435 · 15 · - │ ·····················|·····························|·············|·············|·············|··············|·············· | Deployments · · % of limit · │ ···················································|·············|·············|·············|··············|·············· | Orchestrator · - · - · 836870 · 8.8 % · - │ ···················································|·············|·············|·············|··············|·············· | UFragments · - · - · 1454853 · 15.3 % · - │ ···················································|·············|·············|·············|··············|·············· | UFragmentsPolicy · - · - · 934791 · 9.8 % · - │ ·--------------------------------------------------|-------------|-------------|-------------|--------------|-------------· |
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.
Nice, looks like we got some savings.
Sometimes, code optimizers can lead to different behavior. For us, we'd still want to verify mem layout.
There was a recent change that cached storage variables to reduce gas cost. Are those still needed with the optimizer?
AFAIK the optimizer in 0.7 is able to take care of this. |
settings: { | ||
optimizer: { | ||
enabled: true, | ||
runs: 200, |
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.
Consider increasing the number of runs to 9000 and seeing if it improves gas efficiency.
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.
Increasing runs to 9000
, doesnt improve noticeably
·--------------------------------------------------|---------------------------|--------------|----------------------------· | Solc version: 0.7.6 · Optimizer enabled: true · Runs: 9000 · Block limit: 9500000 gas │ ···················································|···························|··············|····························· | Methods │ ·····················|·····························|·············|·············|··············|··············|·············· | Contract · Method · Min · Max · Avg · # calls · usd (avg) │ ·····················|·····························|·············|·············|··············|··············|·············· | Orchestrator · addTransaction · 71318 · 131876 · 109945 · 6 · - │ ·····················|·····························|·············|·············|··············|··············|·············· | Orchestrator · rebase · 27292 · 123293 · 80519 · 80 · - │ ·····················|·····························|·············|·············|··············|··············|·············· | Orchestrator · removeTransaction · 28441 · 51244 · 37462 · 3 · - │ ·····················|·····························|·············|·············|··············|··············|·············· | Orchestrator · setTransactionEnabled · 25783 · 29971 · 27877 · 2 · - │ ·····················|·····························|·············|·············|··············|··············|·············· | Orchestrator · transferOwnership · - · - · 30781 · 1 · - │ ·····················|·····························|·············|·············|··············|··············|·············· | UFragments · approve · 16674 · 46746 · 36628 · 34 · - │ ·····················|·····························|·············|·············|··············|··············|·············· | UFragments · decreaseAllowance · 28507 · 32787 · 30647 · 8 · - │ ·····················|·····························|·············|·············|··············|··············|·············· | UFragments · increaseAllowance · 32795 · 47819 · 38807 · 10 · - │ ·····················|·····························|·············|·············|··············|··············|·············· | UFragments · permit · 76621 · 76633 · 76629 · 3 · - │ ·····················|·····························|·············|·············|··············|··············|·············· | UFragments · rebase · 27579 · 38298 · 35084 · 13 · - │ ·····················|·····························|·············|·············|··············|··············|·············· | UFragments · setMonetaryPolicy · - · - · 47254 · 8 · - │ ·····················|·····························|·············|·············|··············|··············|·············· | UFragments · transfer · 39769 · 54745 · 53379 · 11 · - │ ·····················|·····························|·············|·············|··············|··············|·············· | UFragments · transferAll · 31058 · 39458 · 37358 · 4 · - │ ·····················|·····························|·············|·············|··············|··············|·············· | UFragments · transferAllFrom · 31016 · 46016 · 34494 · 5 · - │ ·····················|·····························|·············|·············|··············|··············|·············· | UFragments · transferFrom · - · - · 46440 · 2 · - │ ·····················|·····························|·············|·············|··············|··············|·············· | UFragmentsPolicy · setCpiOracle · 31162 · 46162 · 38662 · 4 · - │ ·····················|·····························|·············|·············|··············|··············|·············· | UFragmentsPolicy · setDeviationThreshold · 15099 · 30159 · 18111 · 5 · - │ ·····················|·····························|·············|·············|··············|··············|·············· | UFragmentsPolicy · setMarketOracle · 31161 · 46161 · 38661 · 4 · - │ ·····················|·····························|·············|·············|··············|··············|·············· | UFragmentsPolicy · setOrchestrator · 31138 · 46126 · 38632 · 4 · - │ ·····················|·····························|·············|·············|··············|··············|·············· | UFragmentsPolicy · setRebaseLag · - · - · 30134 · 2 · - │ ·····················|·····························|·············|·············|··············|··············|·············· | UFragmentsPolicy · setRebaseTimingParameters · 25435 · 40471 · 29379 · 15 · - │ ·····················|·····························|·············|·············|··············|··············|·············· | Deployments · · % of limit · │ ···················································|·············|·············|··············|··············|·············· | Orchestrator · - · - · 986760 · 10.4 % · - │ ···················································|·············|·············|··············|··············|·············· | UFragments · - · - · 1614953 · 17 % · - │ ···················································|·············|·············|··············|··············|·············· | UFragmentsPolicy · - · - · 1166050 · 12.3 % · - │ ·--------------------------------------------------|-------------|-------------|--------------|--------------|-------------·
Will in a separate PR roll back the gas optimization changes since the new compiler/optimizer will take care of all of that .. |
Using solidity 0.7.x with optimizer and runs: 200