Platform: Code4rena
Start Date: 25/10/2022
Pot Size: $50,000 USDC
Total HM: 18
Participants: 127
Period: 5 days
Judge: 0xean
Total Solo HM: 9
Id: 175
League: ETH
Rank: 67/127
Findings: 2
Award: $55.74
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: 0x1f8b
Also found by: 0xNazgul, 0xSmartContract, Aymen0909, B2, Bnke0x0, Deivitto, Diana, Dinesh11G, ElKu, JC, Josiah, Rahoz, RaymondFam, ReyAdmirado, Rolezn, Waze, __141345__, adriro, aphak5010, brgltd, c3phas, c7e7eff, carlitox477, cducrest, ch0bu, chrisdior4, cryptonue, cryptostellar5, cylzxje, d3e4, delfin454000, enckrish, evmwanderer, fatherOfBlocks, gogo, hansfriese, horsefacts, immeas, leosathya, lukris02, neumo, oyc_109, pedr02b2, rbserver, robee, rotcivegaf, rvierdiiev, sakshamguruji, shark, simon135, tnevler, trustindistrust, wagmi
36.7345 USDC - $36.73
Sub- Total: 84 instances in 8 issues
Sub-total: 21 instances in 4 issues
Total: 105 instances in 12 issues
Contracts are allowed to override their parents’ functions and change the visibility from external to public. https://docs.soliditylang.org/en/latest/contracts.html#function-overriding
52 instances in 8 files:
BorrowController.sol https://github.com/code-423n4/2022-10-inverse/blob/main/src/BorrowController.sol#L26 https://github.com/code-423n4/2022-10-inverse/blob/main/src/BorrowController.sol#L32 https://github.com/code-423n4/2022-10-inverse/blob/main/src/BorrowController.sol#L38 https://github.com/code-423n4/2022-10-inverse/blob/main/src/BorrowController.sol#L46
DBR.sol https://github.com/code-423n4/2022-10-inverse/blob/main/src/DBR.sol#L53 https://github.com/code-423n4/2022-10-inverse/blob/main/src/DBR.sol#L62 https://github.com/code-423n4/2022-10-inverse/blob/main/src/DBR.sol#L70 https://github.com/code-423n4/2022-10-inverse/blob/main/src/DBR.sol#L81 https://github.com/code-423n4/2022-10-inverse/blob/main/src/DBR.sol#L90 https://github.com/code-423n4/2022-10-inverse/blob/main/src/DBR.sol#L99 https://github.com/code-423n4/2022-10-inverse/blob/main/src/DBR.sol#L109 https://github.com/code-423n4/2022-10-inverse/blob/main/src/DBR.sol#L120 https://github.com/code-423n4/2022-10-inverse/blob/main/src/DBR.sol#L133 https://github.com/code-423n4/2022-10-inverse/blob/main/src/DBR.sol#L146 https://github.com/code-423n4/2022-10-inverse/blob/main/src/DBR.sol#L223 https://github.com/code-423n4/2022-10-inverse/blob/main/src/DBR.sol#L258 https://github.com/code-423n4/2022-10-inverse/blob/main/src/DBR.sol#L300 https://github.com/code-423n4/2022-10-inverse/blob/main/src/DBR.sol#L313 https://github.com/code-423n4/2022-10-inverse/blob/main/src/DBR.sol#L325
Market.sol https://github.com/code-423n4/2022-10-inverse/blob/main/src/Market.sol#L118 https://github.com/code-423n4/2022-10-inverse/blob/main/src/Market.sol#L124 https://github.com/code-423n4/2022-10-inverse/blob/main/src/Market.sol#L130 https://github.com/code-423n4/2022-10-inverse/blob/main/src/Market.sol#L136 https://github.com/code-423n4/2022-10-inverse/blob/main/src/Market.sol#L142 https://github.com/code-423n4/2022-10-inverse/blob/main/src/Market.sol#L149 https://github.com/code-423n4/2022-10-inverse/blob/main/src/Market.sol#L161 https://github.com/code-423n4/2022-10-inverse/blob/main/src/Market.sol#L172 https://github.com/code-423n4/2022-10-inverse/blob/main/src/Market.sol#L183 https://github.com/code-423n4/2022-10-inverse/blob/main/src/Market.sol#L194
Fed.sol https://github.com/code-423n4/2022-10-inverse/blob/main/src/Fed.sol#L48 https://github.com/code-423n4/2022-10-inverse/blob/main/src/Fed.sol#L57 https://github.com/code-423n4/2022-10-inverse/blob/main/src/Fed.sol#L66 https://github.com/code-423n4/2022-10-inverse/blob/main/src/Fed.sol#L75 https://github.com/code-423n4/2022-10-inverse/blob/main/src/Fed.sol#L86 https://github.com/code-423n4/2022-10-inverse/blob/main/src/Fed.sol#L103 https://github.com/code-423n4/2022-10-inverse/blob/main/src/Fed.sol#L120 https://github.com/code-423n4/2022-10-inverse/blob/main/src/Fed.sol#L131
Oracle.sol https://github.com/code-423n4/2022-10-inverse/blob/main/src/Oracle.sol#L44 https://github.com/code-423n4/2022-10-inverse/blob/main/src/Oracle.sol#L53 https://github.com/code-423n4/2022-10-inverse/blob/main/src/Oracle.sol#L66
GovTokenEscrow.sol https://github.com/code-423n4/2022-10-inverse/blob/main/src/escrows/GovTokenEscrow.sol#L30 https://github.com/code-423n4/2022-10-inverse/blob/main/src/escrows/GovTokenEscrow.sol#L43 https://github.com/code-423n4/2022-10-inverse/blob/main/src/escrows/GovTokenEscrow.sol#L52 https://github.com/code-423n4/2022-10-inverse/blob/main/src/escrows/GovTokenEscrow.sol#L66
INVEscrow.sol https://github.com/code-423n4/2022-10-inverse/blob/main/src/escrows/INVEscrow.sol#L44 https://github.com/code-423n4/2022-10-inverse/blob/main/src/escrows/INVEscrow.sol#L59 https://github.com/code-423n4/2022-10-inverse/blob/main/src/escrows/INVEscrow.sol#L70 https://github.com/code-423n4/2022-10-inverse/blob/main/src/escrows/INVEscrow.sol#L79 https://github.com/code-423n4/2022-10-inverse/blob/main/src/escrows/INVEscrow.sol#L90
SimpleERC20Escrow.sol https://github.com/code-423n4/2022-10-inverse/blob/main/src/escrows/SimpleERC20Escrow.sol#L25 https://github.com/code-423n4/2022-10-inverse/blob/main/src/escrows/SimpleERC20Escrow.sol#L36 https://github.com/code-423n4/2022-10-inverse/blob/main/src/escrows/SimpleERC20Escrow.sol#L45
12 instances in 4 files:
Market.sol https://github.com/code-423n4/2022-10-inverse/blob/main/src/Market.sol#L6 https://github.com/code-423n4/2022-10-inverse/blob/main/src/Market.sol#L17 https://github.com/code-423n4/2022-10-inverse/blob/main/src/Market.sol#L19
Fed.sol https://github.com/code-423n4/2022-10-inverse/blob/main/src/Fed.sol#L11 https://github.com/code-423n4/2022-10-inverse/blob/main/src/Fed.sol#L12 https://github.com/code-423n4/2022-10-inverse/blob/main/src/Fed.sol#L14
GovTokenEscrow.sol https://github.com/code-423n4/2022-10-inverse/blob/main/src/escrows/GovTokenEscrow.sol#L6 https://github.com/code-423n4/2022-10-inverse/blob/main/src/escrows/GovTokenEscrow.sol#L7 https://github.com/code-423n4/2022-10-inverse/blob/main/src/escrows/GovTokenEscrow.sol#L9 https://github.com/code-423n4/2022-10-inverse/blob/main/src/escrows/GovTokenEscrow.sol#L10
SimpleERC20Escrow.sol https://github.com/code-423n4/2022-10-inverse/blob/main/src/escrows/SimpleERC20Escrow.sol#L6 https://github.com/code-423n4/2022-10-inverse/blob/main/src/escrows/SimpleERC20Escrow.sol#L7
Use a solidity version of at least 0.8.14 to get bytes.concat() instead of abi.encodePacked(<bytes>,<bytes>)
2 instances:
https://github.com/code-423n4/2022-10-inverse/blob/main/src/DBR.sol#L2 https://github.com/code-423n4/2022-10-inverse/blob/main/src/Market.sol#L2
2 instances in 1 file:
Market.sol https://github.com/code-423n4/2022-10-inverse/blob/main/src/Market.sol#L96 https://github.com/code-423n4/2022-10-inverse/blob/main/src/Market.sol#L100
Each event should use three indexed fields if there are three or more fields
6 instances in 2 files:
DBR.sol https://github.com/code-423n4/2022-10-inverse/blob/main/src/DBR.sol#L381 https://github.com/code-423n4/2022-10-inverse/blob/main/src/DBR.sol#L382
Market.sol https://github.com/code-423n4/2022-10-inverse/blob/main/src/Market.sol#L616 https://github.com/code-423n4/2022-10-inverse/blob/main/src/Market.sol#L617 https://github.com/code-423n4/2022-10-inverse/blob/main/src/Market.sol#L618 https://github.com/code-423n4/2022-10-inverse/blob/main/src/Market.sol#L619
https://github.com/code-423n4/2022-10-inverse/blob/main/src/escrows/INVEscrow.sol#L35
6 instances in 6 files:
DBR.sol https://github.com/code-423n4/2022-10-inverse/blob/main/src/DBR.sol#L30-L42
Market.sol https://github.com/code-423n4/2022-10-inverse/blob/main/src/Market.sol#L61-L90
Fed.sol https://github.com/code-423n4/2022-10-inverse/blob/main/src/Fed.sol#L36-L42
Oracle.sol https://github.com/code-423n4/2022-10-inverse/blob/main/src/Oracle.sol#L29-L33
BorrowController.sol https://github.com/code-423n4/2022-10-inverse/blob/main/src/BorrowController.sol#L13-L15
INVEscrow.sol https://github.com/code-423n4/2022-10-inverse/blob/main/src/escrows/INVEscrow.sol#L34-L36
The built-in EVM precompile ecrecover is susceptible to signature malleability, which could lead to replay attacks
References:
Recommend considering using OpenZeppelin’s ECDSA library (which prevents this malleability) instead of the built-in function.
1 instance in 1 file:
DBR.sol https://github.com/code-423n4/2022-10-inverse/blob/main/src/DBR.sol#L226
3 instances in 1 file:
Market.sol https://github.com/code-423n4/2022-10-inverse/blob/main/src/Market.sol#L74 https://github.com/code-423n4/2022-10-inverse/blob/main/src/Market.sol#L75 https://github.com/code-423n4/2022-10-inverse/blob/main/src/Market.sol#L76
8 instances in 4 files:
Market.sol https://github.com/code-423n4/2022-10-inverse/blob/main/src/Market.sol#L77 https://github.com/code-423n4/2022-10-inverse/blob/main/src/Market.sol#L78 https://github.com/code-423n4/2022-10-inverse/blob/main/src/Market.sol#L79 https://github.com/code-423n4/2022-10-inverse/blob/main/src/Market.sol#L80
Fed.sol https://github.com/code-423n4/2022-10-inverse/blob/main/src/Fed.sol#L39 https://github.com/code-423n4/2022-10-inverse/blob/main/src/Fed.sol#L40
Oracle.sol https://github.com/code-423n4/2022-10-inverse/blob/main/src/Oracle.sol#L32
BorrowController.sol https://github.com/code-423n4/2022-10-inverse/blob/main/src/BorrowController.sol#L14
Use abi.encode() instead which will pad items to 32 bytes, which will prevent hash collisions (e.g. abi.encodePacked(0x123,0x456) => 0x123456 => abi.encodePacked(0x1,0x23456), but abi.encode(0x123,0x456) => 0x0...1230...456). “Unless there is a compelling reason, abi.encode should be preferred”. If there is only one argument to abi.encodePacked() it can often be cast to bytes() or bytes32() instead.
3 instances in 2 files:
DBR.sol https://github.com/code-423n4/2022-10-inverse/blob/main/src/DBR.sol#L228
Market.sol https://github.com/code-423n4/2022-10-inverse/blob/main/src/Market.sol#L427 https://github.com/code-423n4/2022-10-inverse/blob/main/src/Market.sol#L491
There exist ERC20 tokens that charge a fee for every transfer() or transferFrom(). If this tokens are unsupported, ensure there is proper documentation about it...
2 instances in 2 file:
INVEscrow.sol https://github.com/code-423n4/2022-10-inverse/blob/main/src/escrows/INVEscrow.sol#L63
SimpleERC20Escrow.sol https://github.com/code-423n4/2022-10-inverse/blob/main/src/escrows/SimpleERC20Escrow.sol#L38
Avoid floating pragmas for non-library contracts. While floating pragmas make sense for libraries to allow them to be included with multiple different versions of applications, it may be a security risk for application implementations. A known vulnerable compiler version may accidentally be selected or security tools might fall-back to an older compiler version ending up checking a different EVM compilation that is ultimately deployed on the blockchain. It is recommended to pin to a concrete compiler version, e.g. 'pragma solidity ^0.8.0;' -> 'pragma solidity 0.8.4;"
https://github.com/code-423n4/2022-10-inverse/blob/main/src/DBR.sol#L2
https://github.com/code-423n4/2022-10-inverse/blob/main/src/Market.sol#L2
https://github.com/code-423n4/2022-10-inverse/blob/main/src/Fed.sol#L2
https://github.com/code-423n4/2022-10-inverse/blob/main/src/Oracle.sol#L2
https://github.com/code-423n4/2022-10-inverse/blob/main/src/BorrowController.sol#L2
https://github.com/code-423n4/2022-10-inverse/blob/main/src/escrows/GovTokenEscrow.sol#L2
https://github.com/code-423n4/2022-10-inverse/blob/main/src/escrows/INVEscrow.sol#L2
https://github.com/code-423n4/2022-10-inverse/blob/main/src/escrows/SimpleERC20Escrow.sol#L2
#0 - c4-judge
2022-11-08T00:45:17Z
0xean marked the issue as grade-b
🌟 Selected for report: pfapostol
Also found by: 0x1f8b, 0xRoxas, 0xSmartContract, Amithuddar, Aymen0909, B2, Bnke0x0, Chandr, CloudX, Deivitto, Diana, Dinesh11G, ElKu, HardlyCodeMan, JC, JrNet, KoKo, Mathieu, Ozy42, Rahoz, RaymondFam, ReyAdmirado, Rolezn, Shinchan, __141345__, adriro, ajtra, aphak5010, ballx, c3phas, carlitox477, ch0bu, chaduke, cryptostellar5, djxploit, durianSausage, enckrish, exolorkistis, fatherOfBlocks, gogo, horsefacts, kaden, karanctf, leosathya, martin, mcwildy, oyc_109, ret2basic, robee, sakman, sakshamguruji, shark, skyle, tnevler
19.0072 USDC - $19.01
Total: 112 instances in 8 issues
Saves a storage slot for the mapping. Depending on the circumstances and sizes of types, can avoid a Gsset (20000 gas) per mapping combined. Reads and subsequent writes can also be cheaper when a function requires both values and they both fit in the same storage slot.
14 instances in 3 files:
DBR.sol https://github.com/code-423n4/2022-10-inverse/blob/main/src/DBR.sol#L19 https://github.com/code-423n4/2022-10-inverse/blob/main/src/DBR.sol#L20 https://github.com/code-423n4/2022-10-inverse/blob/main/src/DBR.sol#L23 https://github.com/code-423n4/2022-10-inverse/blob/main/src/DBR.sol#L24 https://github.com/code-423n4/2022-10-inverse/blob/main/src/DBR.sol#L25 https://github.com/code-423n4/2022-10-inverse/blob/main/src/DBR.sol#L26 https://github.com/code-423n4/2022-10-inverse/blob/main/src/DBR.sol#L27 https://github.com/code-423n4/2022-10-inverse/blob/main/src/DBR.sol#L28
Market.sol https://github.com/code-423n4/2022-10-inverse/blob/main/src/Market.sol#L57 https://github.com/code-423n4/2022-10-inverse/blob/main/src/Market.sol#L58 https://github.com/code-423n4/2022-10-inverse/blob/main/src/Market.sol#L59
Oracle.sol https://github.com/code-423n4/2022-10-inverse/blob/main/src/Oracle.sol#L25 https://github.com/code-423n4/2022-10-inverse/blob/main/src/Oracle.sol#L26 https://github.com/code-423n4/2022-10-inverse/blob/main/src/Oracle.sol#L27
Avoids a Gsset (20000 gas) in the constructor, and replaces each Gwarmacces (100 gas) with a PUSH32 (3 gas)
2 instances in 1 file:
DBR.sol https://github.com/code-423n4/2022-10-inverse/blob/main/src/DBR.sol#L11 https://github.com/code-423n4/2022-10-inverse/blob/main/src/DBR.sol#L12
Solidity contracts have contiguous 32 bytes (256 bits) slots used in storage. By arranging the variables, it is possible to minimize the number of slots used within a contract’s storage and therefore reduce deployment costs. address type variables are each of 20 bytes size (way less than 32 bytes). However, they here take up a whole 32 bytes slot (they are contiguous). As bool type variables are of size 1 byte, there’s a slot here that can get saved by moving them closer to an address
2 instances in 2 files:
DBR.sol https://github.com/code-423n4/2022-10-inverse/blob/main/src/DBR.sol#L24-L25
Market.sol https://github.com/code-423n4/2022-10-inverse/blob/main/src/Market.sol#L52-L53
15 instances in 3 files:
DBR.sol https://github.com/code-423n4/2022-10-inverse/blob/main/src/DBR.sol#L174 https://github.com/code-423n4/2022-10-inverse/blob/main/src/DBR.sol#L198 https://github.com/code-423n4/2022-10-inverse/blob/main/src/DBR.sol#L288 https://github.com/code-423n4/2022-10-inverse/blob/main/src/DBR.sol#L289 https://github.com/code-423n4/2022-10-inverse/blob/main/src/DBR.sol#L304 https://github.com/code-423n4/2022-10-inverse/blob/main/src/DBR.sol#L332 https://github.com/code-423n4/2022-10-inverse/blob/main/src/DBR.sol#L360 https://github.com/code-423n4/2022-10-inverse/blob/main/src/DBR.sol#L362
Fed.sol https://github.com/code-423n4/2022-10-inverse/blob/main/src/Fed.sol#L91 https://github.com/code-423n4/2022-10-inverse/blob/main/src/Fed.sol#L92
Market.sol https://github.com/code-423n4/2022-10-inverse/blob/main/src/Market.sol#L395 https://github.com/code-423n4/2022-10-inverse/blob/main/src/Market.sol#L397 https://github.com/code-423n4/2022-10-inverse/blob/main/src/Market.sol#L565 https://github.com/code-423n4/2022-10-inverse/blob/main/src/Market.sol#L568 https://github.com/code-423n4/2022-10-inverse/blob/main/src/Market.sol#L598
Instead of using the && operator in a single require statement to check multiple conditions, I suggest using multiple require statements with 1 condition per require statement (saving 3 gas per &).
7 instances in 1 file:
Market.sol https://github.com/code-423n4/2022-10-inverse/blob/main/src/Market.sol#L75 https://github.com/code-423n4/2022-10-inverse/blob/main/src/Market.sol#L162 https://github.com/code-423n4/2022-10-inverse/blob/main/src/Market.sol#L173 https://github.com/code-423n4/2022-10-inverse/blob/main/src/Market.sol#L184 https://github.com/code-423n4/2022-10-inverse/blob/main/src/Market.sol#L195 https://github.com/code-423n4/2022-10-inverse/blob/main/src/Market.sol#L448 https://github.com/code-423n4/2022-10-inverse/blob/main/src/Market.sol#L512
Public functions not called by the contract should be declared external instead. Contracts are allowed to override their parents’ functions and change the visibility from external to public and can save gas by doing so. https://docs.soliditylang.org/en/latest/contracts.html#function-overriding
52 instances in 8 files:
BorrowController.sol https://github.com/code-423n4/2022-10-inverse/blob/main/src/BorrowController.sol#L26 https://github.com/code-423n4/2022-10-inverse/blob/main/src/BorrowController.sol#L32 https://github.com/code-423n4/2022-10-inverse/blob/main/src/BorrowController.sol#L38 https://github.com/code-423n4/2022-10-inverse/blob/main/src/BorrowController.sol#L46
DBR.sol https://github.com/code-423n4/2022-10-inverse/blob/main/src/DBR.sol#L53 https://github.com/code-423n4/2022-10-inverse/blob/main/src/DBR.sol#L62 https://github.com/code-423n4/2022-10-inverse/blob/main/src/DBR.sol#L70 https://github.com/code-423n4/2022-10-inverse/blob/main/src/DBR.sol#L81 https://github.com/code-423n4/2022-10-inverse/blob/main/src/DBR.sol#L90 https://github.com/code-423n4/2022-10-inverse/blob/main/src/DBR.sol#L99 https://github.com/code-423n4/2022-10-inverse/blob/main/src/DBR.sol#L109 https://github.com/code-423n4/2022-10-inverse/blob/main/src/DBR.sol#L120 https://github.com/code-423n4/2022-10-inverse/blob/main/src/DBR.sol#L133 https://github.com/code-423n4/2022-10-inverse/blob/main/src/DBR.sol#L146 https://github.com/code-423n4/2022-10-inverse/blob/main/src/DBR.sol#L223 https://github.com/code-423n4/2022-10-inverse/blob/main/src/DBR.sol#L258 https://github.com/code-423n4/2022-10-inverse/blob/main/src/DBR.sol#L300 https://github.com/code-423n4/2022-10-inverse/blob/main/src/DBR.sol#L313 https://github.com/code-423n4/2022-10-inverse/blob/main/src/DBR.sol#L325
Market.sol https://github.com/code-423n4/2022-10-inverse/blob/main/src/Market.sol#L118 https://github.com/code-423n4/2022-10-inverse/blob/main/src/Market.sol#L124 https://github.com/code-423n4/2022-10-inverse/blob/main/src/Market.sol#L130 https://github.com/code-423n4/2022-10-inverse/blob/main/src/Market.sol#L136 https://github.com/code-423n4/2022-10-inverse/blob/main/src/Market.sol#L142 https://github.com/code-423n4/2022-10-inverse/blob/main/src/Market.sol#L149 https://github.com/code-423n4/2022-10-inverse/blob/main/src/Market.sol#L161 https://github.com/code-423n4/2022-10-inverse/blob/main/src/Market.sol#L172 https://github.com/code-423n4/2022-10-inverse/blob/main/src/Market.sol#L183 https://github.com/code-423n4/2022-10-inverse/blob/main/src/Market.sol#L194
Fed.sol https://github.com/code-423n4/2022-10-inverse/blob/main/src/Fed.sol#L48 https://github.com/code-423n4/2022-10-inverse/blob/main/src/Fed.sol#L57 https://github.com/code-423n4/2022-10-inverse/blob/main/src/Fed.sol#L66 https://github.com/code-423n4/2022-10-inverse/blob/main/src/Fed.sol#L75 https://github.com/code-423n4/2022-10-inverse/blob/main/src/Fed.sol#L86 https://github.com/code-423n4/2022-10-inverse/blob/main/src/Fed.sol#L103 https://github.com/code-423n4/2022-10-inverse/blob/main/src/Fed.sol#L120 https://github.com/code-423n4/2022-10-inverse/blob/main/src/Fed.sol#L131
Oracle.sol https://github.com/code-423n4/2022-10-inverse/blob/main/src/Oracle.sol#L44 https://github.com/code-423n4/2022-10-inverse/blob/main/src/Oracle.sol#L53 https://github.com/code-423n4/2022-10-inverse/blob/main/src/Oracle.sol#L66
GovTokenEscrow.sol https://github.com/code-423n4/2022-10-inverse/blob/main/src/escrows/GovTokenEscrow.sol#L30 https://github.com/code-423n4/2022-10-inverse/blob/main/src/escrows/GovTokenEscrow.sol#L43 https://github.com/code-423n4/2022-10-inverse/blob/main/src/escrows/GovTokenEscrow.sol#L52 https://github.com/code-423n4/2022-10-inverse/blob/main/src/escrows/GovTokenEscrow.sol#L66
INVEscrow.sol https://github.com/code-423n4/2022-10-inverse/blob/main/src/escrows/INVEscrow.sol#L44 https://github.com/code-423n4/2022-10-inverse/blob/main/src/escrows/INVEscrow.sol#L59 https://github.com/code-423n4/2022-10-inverse/blob/main/src/escrows/INVEscrow.sol#L70 https://github.com/code-423n4/2022-10-inverse/blob/main/src/escrows/INVEscrow.sol#L79 https://github.com/code-423n4/2022-10-inverse/blob/main/src/escrows/INVEscrow.sol#L90
SimpleERC20Escrow.sol https://github.com/code-423n4/2022-10-inverse/blob/main/src/escrows/SimpleERC20Escrow.sol#L25 https://github.com/code-423n4/2022-10-inverse/blob/main/src/escrows/SimpleERC20Escrow.sol#L36 https://github.com/code-423n4/2022-10-inverse/blob/main/src/escrows/SimpleERC20Escrow.sol#L45
The comparison operators >= and <= use more gas than >, <, or ==. Replacing the >= and ≤ operators with a comparison operator that has an opcode in the EVM saves gas.
Recommended Mitigation Steps: Replace the comparison operator and reverse the logic to save gas using the suggestions above.
15 instances in 3 files:
DBR.sol https://github.com/code-423n4/2022-10-inverse/blob/main/src/DBR.sol#L171 https://github.com/code-423n4/2022-10-inverse/blob/main/src/DBR.sol#L195 https://github.com/code-423n4/2022-10-inverse/blob/main/src/DBR.sol#L224 https://github.com/code-423n4/2022-10-inverse/blob/main/src/DBR.sol#L329 https://github.com/code-423n4/2022-10-inverse/blob/main/src/DBR.sol#L373
Market.sol https://github.com/code-423n4/2022-10-inverse/blob/main/src/Market.sol#L396 https://github.com/code-423n4/2022-10-inverse/blob/main/src/Market.sol#L423 https://github.com/code-423n4/2022-10-inverse/blob/main/src/Market.sol#L462 https://github.com/code-423n4/2022-10-inverse/blob/main/src/Market.sol#L487 https://github.com/code-423n4/2022-10-inverse/blob/main/src/Market.sol#L533 https://github.com/code-423n4/2022-10-inverse/blob/main/src/Market.sol#L562 https://github.com/code-423n4/2022-10-inverse/blob/main/src/Market.sol#L567 https://github.com/code-423n4/2022-10-inverse/blob/main/src/Market.sol#L582 https://github.com/code-423n4/2022-10-inverse/blob/main/src/Market.sol#L607
Fed.sol https://github.com/code-423n4/2022-10-inverse/blob/main/src/Fed.sol#L123
Checking non-zero transfer values can avoid an expensive external call and save gas. While this is done at some places, it’s not consistently done in the solution.
Recommended Mitigation Steps: I suggest adding a non-zero-value before calling a transfer.
6 instances in 2 files:
Market.sol https://github.com/code-423n4/2022-10-inverse/blob/main/src/Market.sol#L205 https://github.com/code-423n4/2022-10-inverse/blob/main/src/Market.sol#L399 https://github.com/code-423n4/2022-10-inverse/blob/main/src/Market.sol#L570
Fed.sol https://github.com/code-423n4/2022-10-inverse/blob/main/src/Fed.sol#L135
INVEscrow.sol https://github.com/code-423n4/2022-10-inverse/blob/main/src/escrows/INVEscrow.sol#L63
SimpleERC20Escrow.sol https://github.com/code-423n4/2022-10-inverse/blob/main/src/escrows/SimpleERC20Escrow.sol#L38
#0 - c4-judge
2022-11-05T23:54:43Z
0xean marked the issue as grade-b