Skip to content

ReentrancyGuard doesn't work as intended with Clones #219

Open

Description

@PraneshASP

Hi,

I was trying to deploy contracts (Factory pattern) via OpenZeppelin's Clones library. My implementation contract uses Solmate's ReentrancyGuard. When I was trying to execute some methods on the cloned contract that has the nonReentrant modifier, it always reverts with the following error:

Error: VM Exception while processing transaction: reverted with reason string 'REENTRANCY'

Possible workaround:
Change the condition from require(locked == 1, "REENTRANCY"); to require(locked < 2, "REENTRANCY"); so that it doesn't affect the gas cost and it also becomes compatible with Clones by default by eliminating the necessity of manually setting the storage slot to 1. Not sure if its the correct solution for the issue^^

Is it worth creating a PR for this?
Please let me know your thoughts.

Thanks!

Activity

  1. changed the title [-]ReentracyGuard doesn't work as intended with Clones[/-] [+]ReentrancyGuard doesn't work as intended with Clones[/+] on May 1, 2022
  2. transmissions11 commented on Jun 9, 2022

    @transmissions11
    Owner

    note to self: check with sam if this is safe (90% sure it is)

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

Metadata

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