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
_withdraw(), redeem(), and report() should change the order of transferring assets and updating vaultAssets to follow checks-effects-interactions and get one step closer to not needing the nonReentrant modifiers.
Consider changing the order of operations so the subtraction from vaultAssets happens before assets are transferred outside of the GVault. This may allow the nonReentrant modifier to be removed in the future.
The text was updated successfully, but these errors were encountered:
_withdraw()
,redeem()
, andreport()
should change the order of transferring assets and updatingvaultAssets
to follow checks-effects-interactions and get one step closer to not needing thenonReentrant
modifiers.Technical Details
In
_withdraw()
, funds are transferred out of the GVault before thevaultAssets
state variable is updated. According to checks-effects-interactions, the external interactions should happen last, meaning thevaultAssets
variable should be updated before funds are transferred. This is what the solmate ERC4626 implementation does by calling the internal_burn()
first to update thetotalSupply
value before transferring funds, which is the opposite of when the transfer happens relative to_mint()
inmint()
. The same change can be applied toredeem()
andreport()
(1, 2).Impact
Informational.
Recommendation
Consider changing the order of operations so the subtraction from
vaultAssets
happens before assets are transferred outside of the GVault. This may allow thenonReentrant
modifier to be removed in the future.The text was updated successfully, but these errors were encountered: