Redaction: Undo the extra gas check
mediumImpact
This check:
solidityif (uint256(gasleft()) + uint256(2000) <= gasBefore / 64) revert InsufficientGasForExternalCall();
Is meant to ensure that sufficient gas was provided before the revert
Its original version
solidityif (uint256(gasleft()) <= gasBefore / 64) revert InsufficientGasForExternalCall();
Is incorrect as it is ignoring the gas that is necessary
In the case of an oracle reverting due to consuming too much gas this will cause a revert
The check:
solidityif (uint256(gasleft()) + uint256(2000) <= gasBefore / 64) revert InsufficientGasForExternalCall();
Will not, but this seems to open up to being able to actually triggering a shutdown
This requires very specific gas requirements I did not fully test
But given the fact that the other code is being reviewed by hundreds of auditors, and the POC below, I believe the change should be undone
Mitigation
Revert back to
solidityif (uint256(gasleft()) <= gasBefore / 64) revert InsufficientGasForExternalCall();
I believe the only safe way to check that sufficient gas was provided is to check before the calls, with an hardcoded value
