I'm deploying via Remix and Metamask.

I have an intializer function MyToken() { ... } that initializes a few state variables, and calls test(); test(); at the end.

The contract deploys, but none of the state variables get initialized. When I remove test(); test();, it works.

Why could this be? If those two calls to test() produced an error, then wouldn't the contract simply not deploy?


When I deploy to "Javascript VM" rather than "Injected Web3", it works fine.

Just putting one call to test(); works fine; so is it a gas problem? Why is the contract still deploying then?

Also, calling test(); test(); manually (when it is not included in the intializer) works.

  • Can you post the contract? Aug 11 '17 at 21:17
  • Turns out it was a gas problem and the contract probably wasn't even deploying. Why Remix made it look like it deployed, I don't know. Aug 11 '17 at 21:43
  • You can post your own answer, and if you can edit your question and answer, it would probably be more helpful to readers since it's currently unclear :)
    – eth
    Aug 13 '17 at 6:15

It seems that the second call to test() was pushing the transaction above the gas limit. I guess the compiler couldn't compute that function's cost beforehand, so it let me deploy it. However, the result it presented me had every value zeroed out, so I don't think it was successfully deployed.

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.