1

What happens in a function where user can supply an uint256 which reads the data from a dynamic array... What happens if index is out of range? Does transaction revert automatically? Or do i have to implement additional check: require(myDynamicArray.length > proposalID) ?

  function doSomething(uint256 proposalID) {
      if(myDynamicArray[proposalID].isActivated) {
//blah blah do something
}
    }

1 Answer 1

1

The transaction will revert. If I remember right, the execution emits a panic code which reverts everything. But, regardless of how the revertion is triggered, the execution will revert.

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.