Contract code size is 29755 bytes and exceeds 24576 bytes
kushagra2jindal opened this issue · 7 comments
When I try to deploy the 'EntryPoint' Contract in my local Ganache and Truffle setup, I face the following issue because of the contract size.
Warning: Contract code size is 29803 bytes and exceeds 24576 bytes (a limit introduced in Spurious Dragon). This contract may not be deployable on Mainnet. Consider enabling the optimizer (with a low "runs" value!), turning off revert strings, or using libraries.
--> project:/contracts/core/EntryPoint.sol:22:1:
|
22 | contract EntryPoint is IEntryPoint, StakeManager, NonceManager, ReentrancyGuard {
| ^ (Relevant source part starts here and spans across multiple lines).
1_initial_migration.js
======================
Deploying 'EntryPoint'
----------------------
> transaction hash: 0x887d845433d32d7be63f5eef83c05bd59c51cad16ce4f44b5a441490c222ffdc
✖ Blocks: 0 Seconds: 0
*** Deployment Failed ***
"EntryPoint" -- The contract code couldn't be stored, please check your gas limit..
Error: *** Deployment Failed ***
"EntryPoint" -- The contract code couldn't be stored, please check your gas limit..
I even tried changing the optimizer to 200, but faced a similar issue.
Interesting 😅 since EntryPoint contract is already deployed on multiple chains
Yes, totally agree. But I wonder why I am facing this issue continuously.
Can you help with some solutions?
I have faced this error before and I just deployed it to a chain that allowed oversized contracts
I know not very helpful 😅
EntryPoint must be compiled with optimization in order to fix the maximum code size limit.
The project is shipped with hardhat configuration, so you need to add the optimization flags to your truffle configuration.
Thanks, @drortirosh still facing issues with ganache, but I am able to deploy the contract now using GETH local deployment.. Although when I call the handleOps functions, I am still facing issues when passing a tuple value from node js, it is giving me reverted error
const params = web3.eth.abi.encodeParameters( ['(address, uint256, bytes, bytes, uint256, uint256, uint256, uint256, uint256, bytes, bytes)[]', 'address'], [[userOps], myAddress] );
I put an event emit line in 1st line of the function, and it is never getting triggered. Am I passing the tuple wrongly? Please guide. Thanks in advance
I suggest comparing it with the ethers encoding, which is known to work.
Thanks, @drortirosh will try using ethers.js and let you know in case of any issues.