Content pfp
Content
@
0 reply
0 recast
2 reactions

horsefacts pfp
horsefacts
@horsefacts.eth
Optimizing my first serious L2 contracts has been a journey: 1) Dev: your intuitions are all wrong now. 2) Testnet: cheap L2 gas, cheap L1 calldata. Many tools overestimate L2 gas and it can outweigh calldata unlike IRL. 3) Mainnet: cheap L2 gas, L1 calldata is 20-100x testnet cost. Calldata costs dominate everything.
5 replies
6 recasts
22 reactions

horsefacts pfp
horsefacts
@horsefacts.eth
My advice to others would be to 1) profile calldata during development as a proxy for total cost, the same way you're used to watching gas and 2) trust only mainnet forks to profile real cost—easy to fool yourself otherwise.
2 replies
0 recast
4 reactions

Matt Solomon pfp
Matt Solomon
@msolomon.eth
Yea, the L1 vs. L2 cost difference is so large that IMO it doesn't make sense to worry about L2 execution cost at all Right now on L1 gas is 34 gwei, so calldata is 34,000x more expensive than optimism L2 execution gas (0.001 gwei). Arbitrum is less extreme but still a difference of 340x
1 reply
0 recast
3 reactions

Matt Solomon pfp
Matt Solomon
@msolomon.eth
We have some spreadsheets from past L2 optimizations where you can play around with the numbers - https://docs.google.com/spreadsheets/d/1Ix97LDMRnT-ENO5i_nCNk2lVcp6kzua9Mrh7Dk8038E/edit#gid=0 - https://docs.google.com/spreadsheets/d/1dkM-UzWYZ5Dct0Ht3rs8WNCDLztgf5OGw3skDmNtDss/edit#gid=381586464
0 reply
0 recast
3 reactions