LibGuard
These functions are intended to prevent reentrancy attacks by ensuring that reentrant calls are not executed when the guarded
flag is set. The guarded
flag is controlled by these functions to enable or disable the reentrancy guard as needed.
enforcePreGuard():
This function is used to enforce a pre-reentrancy guard. It retrieves the AppStorage
instance using LibMagpieAggregator.getStorage()
and checks if the guarded
flag is set. If the flag is already set, indicating an ongoing reentrant call, it reverts the transaction with a ReentrantCall
error. Otherwise, it sets the guarded
flag to true
.
enforcePostGuard():
This function is used to enforce a post-reentrancy guard. It retrieves the AppStorage
instance using LibMagpieAggregator.getStorage()
and sets the guarded
flag to false
.
enforceDelegatedCallPreGuard():
Accesses the contract storage to determine if a specific type of delegated call is already in progress. If a call of that type is already in progress, it reverts the transaction to prevent reentrancy. If no such call is in progress, it sets the delegated call state to true
for that call type.
Input:
Field | Type | Description |
---|---|---|
enforceDelegatedCall():
Accesses the contract storage to confirm whether a particular type of delegated call is currently in progress. If the expected call is not in progress, it reverts the transaction, indicating an invalid delegated call.
enforceDelegatedCallPostGaurd():
Accesses the contract storage and sets the delegated call state back to false
for the specified type of delegated call.
Input:
Field | Type | |
---|---|---|
enforceDelegatedCallGuard():
Accesses the contract storage to confirm whether a particular type of delegated call is currently in progress. If the expected call is not in progress, it reverts the transaction, indicating an invalid delegated call.
Input:
Field | Type | Description |
---|---|---|
Last updated