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
}
    }
smenir443
  • 125
  • 1
  • 10

1 Answers1

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.

Lauri Peltonen
  • 29,391
  • 3
  • 20
  • 57