You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The humble reentrancy guard built into HSG is the inefficient and older way to implement re-entrancy guard.
Each time the guard is set to a value of 1 from zero it requires a full 20_000 SSTORE call; and refunds 19_900 gas when decremented.
Changing a previously initialized value from 1 to 2 and back to 1 can be significantly more efficient; depending on how much of a transaction's refund can be utilized. In the case of calling a function that relies on applying it's own refund mechanism - the cap can be hit and the refund from "deleting" the _guardEntries variable will not be applied.
Changing the value from 1 to 2 only costs 2900 gas - and refunds 2800 when decremented.
The text was updated successfully, but these errors were encountered:
The humble reentrancy guard built into HSG is the inefficient and older way to implement re-entrancy guard.
Each time the guard is set to a value of 1 from zero it requires a full 20_000 SSTORE call; and refunds 19_900 gas when decremented.
Changing a previously initialized value from 1 to 2 and back to 1 can be significantly more efficient; depending on how much of a transaction's refund can be utilized. In the case of calling a function that relies on applying it's own refund mechanism - the cap can be hit and the refund from "deleting" the _guardEntries variable will not be applied.
Changing the value from 1 to 2 only costs 2900 gas - and refunds 2800 when decremented.
The text was updated successfully, but these errors were encountered: