Skip to content

Commit

Permalink
0x37 data for issue #63
Browse files Browse the repository at this point in the history
  • Loading branch information
howlbot-integration[bot] authored Oct 27, 2024
1 parent 8c12da4 commit 2b5d16a
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions data/0x37-Q.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
[L1] Long array loop may cause out of gas revert.
In Timelock contract, when we pause the timelock, we will remove all proposals from the _liveProposals.
The problem is that if there are lots of pending, ready proposals, the pause function might be reverted because of out of gas.

```solidity
function pause() public override {
/// check that msg.sender is the pause guardian, pause the contract
super.pause();
bytes32[] memory proposals = _liveProposals.values();
for (uint256 i = 0; i < proposals.length; i++) {
bytes32 id = proposals[i];
delete timestamps[id]; // Here we delete this timestamp, so we can create another same proposal again.
assert(_liveProposals.remove(id)); // remove from live proposals.
emit Cancelled(id);
}
}
```

0 comments on commit 2b5d16a

Please sign in to comment.