Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

"Transaction reverted: trying to deploy a contract whose code is too large", Is 10KB too large?

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?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

It might be summing with the size of your imports. Try using allowUnlimitedContractSize

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading