1

it's my first post here. I would like to ask, what's the possible errors that a developer can face while trying to deploying their smart contract into the Ethereum network.

For example, can it be "Out of gas"? and why does this happen? Could you please let me know or summarize any errors that will prevent them of properly deploying their contracts to the network?

Thank you in advance.

1

Some of errors for deploying smart contract or just send a tx

  • Out of gas > The "out of gas" error occurs when all the gas you allotted for the transaction is consumed before the transaction could complete1. This could happen when the developer underestimated the gas amount used in the contract, or just forgot to change it, or forgot to enable optimization before compiling the code.

  • Stack to Deep > this error seems to be generated when the code needs to access a slot in the stack that is deeper than its 16th element (counting from the top downwards) 2. We usually get this error when they have a big constructor with many parameters.

  • Insufficient funds > when you don't have enough ether to pay the fees. probably used the wrong account or network to deploy the contract from, or the account has less amount from the required fee

  • other errors I remember to have are -> Nonce too low: when I set the nonce manually and do a mistake or use the same account with the wrong network. Wrong chainId (invalid sender or only-replay-protected-eip-155-transac) > using the wrong chain id when signing the transaction

  • Some contract-related errors like if your contract has a condition "require" in the constructor that is not fulfilled, or you tried to divide to 0.

2
  • 1)recently I faced something like "reverted" . Is this another error while deploying a smart contract? 2) in case of "out of gas" error, in case I don't have enough ether to increase the gas, then I need to buy ether and retry? (or is it sth really strange that a developer will not have enough ether for gas ??) – NIKOLAOS NOUSIAS Apr 1 at 11:46
  • 1) reverted happen for many reasons, it could happen if you have a condition in the constructor of the contract that is not fulfilled. just an example you have in the constructor something like require (msg.value >= 1 ether); so you must send at least 1 ether with the deployment tx or it will revert. 2) Yes you need to buy more, but take care there is a difference between gas limit and gas price, the error happens when the gas limit is low, (the gas price is only relevant for miners to include your transaction) – Majd TL Apr 1 at 11:55
0

Here's a couple more to add to Majd TL's answer:

  • "max code size exceeded" - (ErrMaxCodeSizeExceeded) - Contracts are limited to 24kB (24576 B) in size, so if you try to deploy something larger, it'll fail.
  • "contract address collision" - (ErrContractAddressCollision) - If there's already a contract at the deployment address. This will only be hit if you manually set your account nonce to one previously used to deploy an identical contract.

These (and other) errors are defined in errors.go.

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.