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

A comment at function _nonReentrantBefore() in ReentrancyGuardTransientUpgradeable is misleading #5399

Open
gpersoon opened this issue Dec 23, 2024 · 0 comments

Comments

@gpersoon
Copy link

A comment at function _nonReentrantBefore() in ReentrancyGuardTransientUpgradeable is misleading.

💻 Environment
ReentrancyGuardTransientUpgradeable.sol

Latest version of the code, also present in release-v5.2

📝 Details
The following comment is present in ReentrancyGuardTransientUpgradeable.sol#L47:

     // On the first call to nonReentrant, _status will be NOT_ENTERED

As everyone knows, NOT_ENTERED has the value of 1, see ReentrancyGuardUpgradeable.sol#L38:

uint256 private constant NOT_ENTERED = 1;

However in ReentrancyGuardTransientUpgradeable the initial value will be 0 or false.
Also _status isn't present in the code.

Suggested solution
Consider changing the code to something like:

-// On the first call to nonReentrant, _status will be NOT_ENTERED
+// On the first call to nonReentrant, REENTRANCY_GUARD_STORAGE.asBoolean().tload() will be false

🔢 Code to reproduce bug
NA

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant