I wrote a simple auction contract file and its size is 9.49KB(12KB on disk), and when I run this contract using npx hardhat test
, I get this error:
Error: cannot estimate gas; transaction may fail or may require manual gas limit [ See: https://links.ethers.org/v5-errors-UNPREDICTABLE_GAS_LIMIT ] (reason="Transaction reverted: trying to deploy a contract whose code is too large", method="estimateGas", transaction={"from":"0xf39Fd6e...
I think this error occurs when the contract files exceeds more than 24,576 bytes, which means 24KB. But my file exceeds only 10Kbs and I can't downsize my code anymore. What should I do?
CodePudding user response:
It might be summing with the size of your imports. Try using allowUnlimitedContractSize