1

I'm using Remix to deploy onto Rinkeby.

I can deploy the contract fine, although I have to increase the 3000000 gas limit to 13000000.

When I trigger an event that updates a uint256 field, the transaction goes through fine.

However, when I change that to update a single array value myArray[0] = someint, it gives me callback contain no result Gas required exceeds block gas limit: 13000000, and doesn't matter what I set gas limit to.

Specifically:

address[] public addressList;
uint public someint;

function testit() payable {
  addressList[0] = msg.sender;   // This line always exceeds gas limit

  someint = msg.value;  // Only this line works

  sendFunds(); // does this: ownerwallet.transfer(msg.value);
}

Why would such a trivial call exceed the gas limit?

  • The production chain has a gas limit of about 6.7 Megagas. If deploying your contract really takes 13 Megagas, you won't be able to deploy it to production. Beyond that, @benjaminion's answer looks appropriate. – carver Aug 10 '17 at 22:14
1

I think this Q&A answers your question as well.

It's not about gas - using up all the gas is just a side-effect of a failure in your code (this is what currently happens on an exception in Ethereum).

Essentially, you are trying to make an assignment to a zero-length array.

You need to do either addressList.push(msg.sender), or you need to declare the array statically, address[10] public addressList. There is more info at the answer I linked.

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.