I didn't have any problem using solc 0.5.0 (geth 1.9.3), but facing this problem after upgraded to 0.5.12 (geth 1.9.9).

After doing some research, I believe it is because of the changes to the transfer() function in solidity. But unfortunately I didn't get any error message when compiling.

So, I a very confused now, and didn't know if there is any where else I had made error.

Anyone know why solc is not complaining about error / obsolete functions()

  • 1
    Are you deploying to a private blockchain? Are constantinople/petersburg opcodes eanbled? Since solc 0.5.x by default it will use the new opcodes causing a revert operation if they are not enabled. – Ismael Jan 6 '20 at 18:25
  • Bingo, this exactly solved the problem – s k Jan 7 '20 at 12:09

Your problem is possibly due to the fact that Ethereum has a contract code-size limit of 24KB.

If you contract's code-size exceeds this limit, then no matter what you do - whether it's in your contract code or in your deployment code - the contract deployment will fail.

How to check your contract's code-size:

  1. If you're compiling via solc executable, then make sure that the size of the output bin file does not exceed 48KB
  2. If you're compiling via solc.js (for example, via Truffle), then make sure that the size of the bytecode field in the output json file does not exceed 48KB

Why 48KB?

2 hexdecimal characters = 2 bytes in the text file = 1 byte in the actual bytecode.

  • I have multiple contracts within truffle, the largest is only 13KB, but if adding all other contracts together (all the bytecode in all json files) is certainly > 24KB. Will that be an issue? – s k Jan 7 '20 at 9:07
  • @sk: No, that shouldn't be an issue. But you appear to be doing some transaction (executing contract deployment or contract function), which requires more gas than the current block-limit. You might be able to fix it in your truffle-config.js file. Alternatively, share your code if you want others to be able to analyze the problem. – goodvibration Jan 7 '20 at 9:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.