Feat: reentrancy protection with optional parameter
The current solution is a minimal reentrant modifier with some get/set helpers. With the state of the code today, a project which imports this repo would be required to add a few LoC to properly protect against reentrancy.
I propose implementing something similar to https://soliditylang.org/blog/2024/01/26/transient-storage/ to give inheritance flexibility in locking functions with particular keys. This should work similarly to how vyper provides reentrancy protection.
May I work on this issue?
great idea, @pegahcarter. perhaps we could add a new modifier (e., nonreentrant()) to the library that allows for transient reentrancy protection as you described. @ShubhSensei you can definitely make a PR!
@0xfuturistic There are 2 ways to do it
-
Modify the current modifier in the
TransientReentrancyAwareby using a transient lock with a specific key- Then
incrementanddecrementfunctions have to be deleted - Also, have to make changes in the Test file
- Then
-
Make a new modifier in the
TransientContextcontract itself
what should I do?
@ShubhSensei let's keep everything as-is and add this feature as a new modifier (2).
agreed with you @pegahcarter, and thanks for the PR @ShubhSensei! just left a comment re:tests