Gas optimization: Placement of require statements in MochiVault.sol #27
Labels
bug
Something isn't working
G (Gas Optimization)
sponsor confirmed
Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity")
Handle
gzeon
Vulnerability details
Impact
Some of the require statements in MochiVault.sol can be placed earlier to reduce gas usage on revert
Proof of Concept
https://github.com/code-423n4/2021-10-mochi/blob/main/projects/mochi-core/contracts/vault/MochiVault.sol
L226-227: can be placed at the very top of the function to avoid the expensive cssr call
L237: can be placed before initialization of increasingDebt
Tools Used
None
Recommended Mitigation Steps
Relocate the said require statements
The text was updated successfully, but these errors were encountered: