-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore(protocol): with transient storage, the default should be 0, not 1 #15745
Conversation
@@ -44,7 +44,7 @@ abstract contract OwnerUUPSUpgradable is UUPSUpgradeable, OwnableUpgradeable { | |||
if (_loadReentryLock() == _TRUE) revert REENTRANT_CALL(); | |||
_storeReentryLock(_TRUE); | |||
_; | |||
_storeReentryLock(_FALSE); |
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.
I wonder if this _storeReentryLock(_FALSE)
call is even necessary. A transient storage is cleared automatically at the end of the transition, no?
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.
@@ -44,7 +44,7 @@ abstract contract OwnerUUPSUpgradable is UUPSUpgradeable, OwnableUpgradeable { | |||
if (_loadReentryLock() == _TRUE) revert REENTRANT_CALL(); | |||
_storeReentryLock(_TRUE); | |||
_; | |||
_storeReentryLock(_FALSE); | |||
_storeReentryLock(0); |
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.
using 0 is the same as clearing the storage
.
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.
Agreed that this is less confusing, only a single false value now instead of both 0
and _FALSE
.
Cannot we make: |
That makes pausing slightly more expensive, but yeah that doesn't matter, so simply changing the false value does seem like a good approach as well. |
A second thought is that we should not merge this PR.... |
|
With this change, the transient slot is actually cleared earlier in the call frames rather than at the end of the tx. But realisticly, it makes no difference.