0

Trying to figure out why I get an out of gas error in my truffle tests when I have the following function:

function updateField(address someAddress, uint256 someId, bool someBool) public {
  SomeStruct storage item = myMap[someAddress];
  require(msg.sender == someAddress || msg.sender == owner);
  require(item.owner != address(0));
  item.mapInItem[someId].someVal = someBool; // when I comment out this line the error goes away
}

The thing is when I comment out the last line the error goes away! Anyone know why this might be happning and how to fix it.

1
  • 1
    Maybe you didn't provide enough gas? – Elisha Drion May 2 '18 at 16:13
0

I needed to add the following to my truffle.js configuration:

solc: { optimizer: { enabled: true, runs: 200 } },

The optimizer is disabled by default now.

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.