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.
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:Possible workaround: Change the condition from
require(locked == 1, "REENTRANCY");
torequire(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!