-
Notifications
You must be signed in to change notification settings - Fork 465
Revert to old ReentrancyGuard implementation + random cleanup #2101
Conversation
83a3eb1
to
793e338
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A single nit, but otherwise looks good to me
/// @dev Calls a public function to check if it is reentrant. | ||
/// Because this function uses the `nonReentrant` modifier, if | ||
/// the function being called is also guarded by the `nonReentrant` modifier, | ||
/// it will revert when it returns. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's move this comment up to isReentrant
now that it has the nonReentrant
modifier
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me!
external | ||
nonReentrant | ||
/// @dev Overridden to revert on unsuccessful fillOrder call. | ||
function fillOrderNoThrow( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This almost feels not worth testing since it's bascially rewriting fillOrderNoThrow
. I guess it's fine for now until we can come up with some clever way of getting around it.
Description
We originally switched to a new
ReentrancyGuard
implementation in 3.0 that currently is ~5000 gas cheaper because EIP-1283 was nixed (which would have saved close to 10K gas in the current implementation). It looks like EIP-2200, which is based off of 1283, is actually going to end up in Istanbul, which gives us the same 10K optimization if we revert to the old implementation.Note that this new implementation makes testing the
noThrow
functions for reentrancy much harder. I had to overwritefillOrderNoThrow
with something that is almost identical tofillOrder
in terms of functionality in order to get all tests to pass.This PR also cleans up some variable names and revert reasons that I encountered while working on the 3.0 spec.
Testing instructions
Types of changes
Checklist:
[WIP]
if necessary.