eth-infinitism/account-abstraction

use solidity >= 0.8.19 for simpleaccount/simpleaccountfactory

leekt opened this issue · 3 comments

leekt commented

found the issue with @FudgyDRS while debugging the gas cost difference between on-chain bytecode and bytecode generated off-chain with 0.8.19 using https://github.com/zerodevapp/aa-benchmark

contract(https://etherscan.io/address/0x9406Cc6185a346906296840746125a0E44976454#code) of simple account factory deployed on mainnet using 0.8.15

which has issue with bloating the smart contract code when constructor uses library.

as a result, simple account has bytecode length of 845, which should have been 231
costing 6 *(27 - 8) + 200*(845-231) = 122,914 gas more than it should have been

reference :
ethereum/solidity#13680
https://github.com/ethereum/solidity/releases/tag/v0.8.19

If I understood correctly, this only affects proxies that (exclusively) call library functions in it's constructor?
And, in SimpleAccount's case the ERC1967Proxy calls Address.delegateCall, which should not be included in the contract's deployed bytecode?

leekt commented

yup exactly, it's mostly the issue with compiling ERC1967(which is compiled within simple account factory) with 0.8.17, which directly influences the deployment cost

SimpleAccount was never meant to be used as-is in production...
It serves as a reference for what an account should do, and as such, is stripped down from features like modularity, etc.

If you still think it is worth using as-is, you can re-deploy it using a newer compiler.