This is my first week at OpenLaw, a Consensys spoke, where I get to not only do a little legal work as a legal engineer but also get to do some blockchain engineering, especially Solidity development. I’m currently working on version 0.4.24.
But as you probably know if you dabble in Solidity, it’s still early days and a challenging platform compared to more mature languages!
For example, for a few hours this afternoon I was absolutely flummoxed with the following error when running my Truffle tests:
Error: The contract code couldn't be stored, please check your gas amount.
So I diligently checked my Ganache settings and tried to change the gas settings on my Truffle transactions. No dice.
It turns out that this error is probably a red herring. The more likely cause is that there’s an error in your deployment somewhere.
It’s probably not a problem with your code (lightly speaking), or it Solidity wouldn’t compile. However, it could be something that’s sorta, kinda related to your code.
In my case, everything was working until I tried to pull some contract names up into interfaces and had naming collisions even though I thought I had organized my code properly to avoid them. Others have reported similar issues such as not implementing constructors from parent classes properly.
So, long story short, if you see the check-your-gas-amount “error” it’s probably not a gas issue — you probably have an issue lurking somewhere in your codebase.
Hope this saves you an hour or two….. good luck out there 🙂