Skip to content
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

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/protocol/contracts/common/OwnerUUPSUpgradable.sol
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ abstract contract OwnerUUPSUpgradable is UUPSUpgradeable, OwnableUpgradeable {
if (_loadReentryLock() == _TRUE) revert REENTRANT_CALL();
_storeReentryLock(_TRUE);
_;
_storeReentryLock(_FALSE);
Copy link
Contributor Author

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?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Transient stroage cleared when transaction ends (for all the contracts). But contract A might call B's function (which is nonReentrant) multiple times. So if we don't clear, the second call would fail.

kép

_storeReentryLock(0);
Copy link
Contributor Author

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.

Copy link
Contributor

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.

}

modifier whenPaused() {
Expand Down
Loading