Skip to content

Add nonReentrantView modifier #5800

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

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

Amxx
Copy link
Collaborator

@Amxx Amxx commented Jul 16, 2025

Fixes #4422

PR Checklist

  • Tests
  • Documentation
  • Changeset entry (run npx changeset add)

@Amxx Amxx added this to the 5.5 milestone Jul 16, 2025
@Amxx Amxx requested a review from a team as a code owner July 16, 2025 14:27
Copy link

changeset-bot bot commented Jul 16, 2025

🦋 Changeset detected

Latest commit: 9312ffa

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
openzeppelin-solidity Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

arr00
arr00 previously approved these changes Jul 29, 2025
@Amxx Amxx requested a review from ernestognw July 30, 2025 12:01
Comment on lines +77 to +81
function _nonReentrantBeforeView() private view {
if (_status == ENTERED) {
revert ReentrancyGuardReentrantCall();
}
}
Copy link
Member

Choose a reason for hiding this comment

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

Would it make sense to reuse _nonReentrantBeforeView in _nonReentrantBefore?

function _nonReentrantBefore() private {
-  if (_status == ENTERED) {
-     revert ReentrancyGuardReentrantCall();
-  }
+  _nonReentrantBeforeView();
}

Same for ReentrancyGuardTransient

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

Successfully merging this pull request may close these issues.

read only version of nonReentrant modifier
3 participants