Skip to content

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

Closed
@gpersoon

Description

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions