5

After looking around, I didn't find another question exactly like this, though 4001 could be related but it was lacking in detail.

I'm trying to deploy a contract on a private chain. Everything seems fine from the client-side(geth console in this case) and the transaction and receipt show no sign of an issue(that I'm seeing).

{
  blockHash: "0x6efd7c9912987a1928548529b6037f36930cbb797c66d60b0bdad4cf0b5f8674",
  blockNumber: 3140,
  contractAddress: "0x87ab8526e28a3e8358ba34aef0c03ef0e2b26ea6",
  cumulativeGasUsed: 191997,
  from: "0x75c4....5638",
  gasUsed: 191997,
  logs: [],
  logsBloom: "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
  root: "0xbc4ac0a19a818b64e37ec4b47e74c8c21125879dd485d3c75a5fa1bc800fb8df",
  to: null,
  transactionHash: "0xe3e69ce4f3de843c748d0e024a8b3359d2168bb225a66e5b09343a17d8c20aaa",
  transactionIndex: 0
}

Gas for the deploy transaction was set to 450000, and according to that receipt, that gas limit was not hit. solc's estimate for construction was 415295 gas and I've tried 500000 gas as well. That said, I have geth on verbisoity 5 and one of the messages that showed during contract deploy was contract creation code storage out of gas.

I dug into geth's code to try and figure out exactly what its problem was. It appears to be triggered in Create in the EVM code. The maximum size here was set to 24576(bytes?). Perhaps EIP170 is related but I'm still not sure how my code could be considered 23KB in any case, so perhaps it isn't related.

The size of the bytecode hex string was 3770. My constructor sets 2 addresses and a boolean and does nothing else. So I guess I'm really confused as to what's actually causing this issue.

Could someone explain a bit better about what this error is? I wasn't able to find much documentation on MaxCodeSize. Maybe it's just late and I'm missing something obvious?

2 Answers 2

5

It appears this really is an out of gas error. Eventually I made an attempt with 1.5m gas and it completed with 545997 gasUsed. This is a bit problematic in that the transaction receipt shows no sign of error and no exception is thrown. I only noticed this due to watching geth's stdout with a high verbosity.

0

For anyone who is using hardhat or ethers.js, try to upgrade your libraries to the latest version and try to deploy it again.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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