5

I'm getting the following error when verifying on the RINKEBY etherscan site:

Error! Unable to verify source code
Exception #1 Occured: ERROR|The Contract solidity compilation has 
  exceeded the maximum timeout/memory limit that we can safely process. 
  Automated source code verification is unavailable for this source code.

My contract is small enough to deploy successfully, but apparently the compile takes too long for Etherscan to verify. What are my options? Is the Rinkeby Etherscan verifier more limited, or will I have this problem on mainnet too? (that would be much more problematic)

EDIT: I have tried the new etherscan beta 2.0 compiler, and it has the exact same problem.

2
  • 3
    Have you successfully verified on other networks and can you post the contract code (either here or as a gist)?
    – comodoro
    Feb 2, 2018 at 6:01
  • Did you try setting the optimization option to no in the verification form?
    – Julien
    Feb 8, 2018 at 22:21

4 Answers 4

2
+50

It's hard to say anything without seeing the code you tried to compile. Since you have already tried the compiler 2. beta version, as a suggestion; compilers spend sometime removing comments etc. from the during the compilation time as explained here.

Are comments included with deployed contracts and do they increase deployment gas?

No, everything that is not needed for execution is removed during compilation. This includes, among others, comments, variable names and type names.

Although the code is small, having a lot comments may take sometime for the compilation. Having removed before compilation might save some time.

EDIT : Setting optimization flag to no, might work as well.

3

The compiler was timing out, and documentation online suggested that truffle optimizes the compilation -- nevertheless, I selected "no" for the optimized option, and didn't enter in the library addresses, to find it successfully compiling in under 30 seconds!

2

Looking at the etherscan verification page,

NOTES
1. To verify Contracts that accept Constructor arguments, please enter the ABI-encoded Arguments in the last box below.
2. For debugging purposes if it compiles correctly at Browser Solidity, it should also compile correctly here.
3. Contracts that use "imports" will need to have the code concatenated into one file as we do not support "imports" in separate files. You can try using the Blockcat solidity-flattener
4. There is a timeout of up to 30 seconds for each contract compiled. If you contract takes longer than this we will not be able to verify it.

As per the point 4, there's a 30 second limit for compilation.

And based on the following, you might have better luck with the compiler 2.0 beta release.

Tip: Check out the new Beta Source Code Contract Verifier which supports the 'run' option for verifying Truffle deployed contracts. If your contract uses libraries and fails to verify, you can also try using the beta source code verifier.

Failing that, the answer to this question may be of interest.

2
  • I have tried the 2.0 compiler :/
    – nickjm
    Feb 2, 2018 at 22:41
  • Are you willing to share your code for us to look into it?
    – TC8
    Feb 4, 2018 at 17:28
1

It seems etherscan has different hardware for verifying contracts for kovan and ropsten. I manage to verify in ropsten but failed in kovan with same contract.

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.