What does this implement/fix? Explain your changes.
Enables Yul ir pipeline and tries to tweak the optimizer config for best outcome (see #1405 )
Does this close any currently open issues?
Possibly #1405 and #1394 (gets State.sol deployment size away from danger zone from 23.758KiB to 19.920KiB)
What commands can I run to test the change?
all unit and e2e tests locally or in ci
Any other comments?
Enables reduction in contract sizes and deployment costs with penalty of longer compilation times (and for some tx slightly increased execution costs).
Tested several configurations (there are countless possible config sets). It can also be overidden per contract.
Marking an inline assembly block as "memory-safe" should be done carefully. This is OpenZeppelin reference
It does increase compilation time when yul ir pipeline is enabled (can be disabled when running locally)
Execution cost of 'proposeBlock' according to unit tests gas profiling slightly increases from 164572 to 165182
Execution cost of 'submitTransaction' according to unit tests gas profiling remains similar from 130649 to 130873
Execution cost of 'challengeNewRootCorrect' according to unit tests gas profiling greatly decreases from 1721933 to 1051513
Current Config
Solc: 0.8.17
Optimizer : enabled
Runs: 1 for truffle, 200 for hardhat
Yul ir pipeline: disabled
compilation time - 10.5 seconds (on my macbook pro M1 pro)
Gas test
Deposits
Creating a block with 45 deposits
Block proposal gas used was 504374, gas used per transaction was 10964.652173913044
Deposit L1 average gas used was 127884.69565217392
✓ should be a reasonable gas cost
Transactions still in the mempool: 1
Block proposal gas used was 134673, gas used per transaction was 2927.6739130434785
There are no transactions in the mempool
Transfers
Creating a block with 32 transfers
Block proposal gas used was 421155, gas used per transaction was 12762.272727272728
Transfer L1 average gas used, if on-chain, was 80906.90909090909
✓ should be a reasonable gas cost
Transactions still in the mempool: 1
Block proposal gas used was 135889, gas used per transaction was 4117.848484848485
There are no transactions in the mempool
Withdraws
Creating a block with 33 withdraws
Block proposal gas used was 361223, gas used per transaction was 10624.20588235294
Withdraw L1 average gas used, if on-chain, was 78595.76470588235
✓ should be a reasonable gas cost
Transactions still in the mempool: 1
Block proposal gas used was 133595, gas used per transaction was 3929.264705882353
There are no transactions in the mempool
Finalise withdraws
The gas used for finalise withdraw, back to L1, was 145272
✓ should withdraw from L2, checking for L1 balance (only with time-jump client)
Experimental Config
Solc: 0.8.17
Optimizer : enabled
Runs: 10000
Yul ir pipeline: enabled
custom optimizer config
all inline assembly blocks marked as "memory-safe"
compilation time - 43 seconds (on my macbook pro M1 pro)
Gas test
Deposits
Creating a block with 45 deposits
Block proposal gas used was 503393, gas used per transaction was 10943.326086956522
Deposit L1 average gas used was 126952.13043478261
✓ should be a reasonable gas cost
Transactions still in the mempool: 1
Block proposal gas used was 134084, gas used per transaction was 2914.8695652173915
There are no transactions in the mempool
Transfers
Creating a block with 32 transfers
Block proposal gas used was 420152, gas used per transaction was 12731.878787878788
Transfer L1 average gas used, if on-chain, was 80364.36363636363
✓ should be a reasonable gas cost
Transactions still in the mempool: 1
Block proposal gas used was 135324, gas used per transaction was 4100.727272727273
There are no transactions in the mempool
Withdraws
Creating a block with 33 withdraws
Block proposal gas used was 360547, gas used per transaction was 10604.323529411764
Withdraw L1 average gas used, if on-chain, was 78057.88235294117
✓ should be a reasonable gas cost
Transactions still in the mempool: 1
Block proposal gas used was 132970, gas used per transaction was 3910.8823529411766
There are no transactions in the mempool
Finalise withdraws
The gas used for finalise withdraw, back to L1, was 143445
✓ should withdraw from L2, checking for L1 balance (only with time-jump client)
What does this implement/fix? Explain your changes.
Enables Yul ir pipeline and tries to tweak the optimizer config for best outcome (see #1405 )
Does this close any currently open issues?
Possibly #1405 and #1394 (gets
State.sol
deployment size away from danger zone from 23.758KiB to 19.920KiB)What commands can I run to test the change?
all unit and e2e tests locally or in ci
Any other comments?
Current Config Solc: 0.8.17 Optimizer : enabled Runs: 1 for truffle, 200 for hardhat Yul ir pipeline: disabled
compilation time - 10.5 seconds (on my macbook pro M1 pro)
contract sizes:
gas profile:
'proposeBlock' - benchmarks:
Experimental Config Solc: 0.8.17 Optimizer : enabled Runs: 10000 Yul ir pipeline: enabled custom optimizer config all inline assembly blocks marked as "memory-safe"
compilation time - 43 seconds (on my macbook pro M1 pro)
contract sizes:
gas profile:
'proposeBlock' - benchmarks: