Platform: Code4rena
Start Date: 30/11/2021
Pot Size: $30,000 USDC
Total HM: 0
Participants: 21
Period: 3 days
Judge: pauliax
Id: 63
League: ETH
Rank: 8/21
Findings: 2
Award: $957.10
π Selected for report: 2
π Solo Findings: 0
π Selected for report: gzeon
Also found by: Meta0xNull, defsec
883.4673 USDC - $883.47
gzeon
In TRIBERagequit.sol, token1OutBase is used to calculate to amount of FEI minted to user. token1OutBase is updated only in requery
-> recalculate
When user call ngmi
, there are no call to the requery
function. It is possible that user exchange with a stale token1OutBase value that result in an incorrect amount of FEI minted.
Call requery
within ngmi
if it is X minute since last call (to optimize for gas usage).
#0 - elee1766
2021-12-06T04:21:28Z
it's fine if the number is stale. (the oracle itself is stale)
ack'd, non issue
#1 - pauliax
2021-12-11T13:22:33Z
As per the sponsor's comment, it is intended to use the cached value. However, based on my understanding, having an up to date values sounds fair, and would also eliminate the front-running issue: #131. I am assigning this issue a severity of low.
19.8662 USDC - $19.87
gzeon
Addition in TRIBERagequit.sol L76 is safe because L73 have the same expression. By putting it in an unchecked block we can save ~100 gas per ngmi
.
`` unchecked{ claimed[thisSender] = claimed[thisSender] + multiplier; }
#0 - pauliax
2021-12-10T19:22:46Z
Valid suggestion.
33.1103 USDC - $33.11
gzeon
Inline checking in PegExchanger.sol L37-38 save ~80 gas per exchnage
. Might lose a bit code clarity.
L37-38
require((expirationBlock == 0) || (block.number <= expirationBlock) , "Redemption period is over"); require(party0Accepted && party1Accepted, "Proposals are not both passed");
#0 - elee1766
2021-12-06T04:22:35Z
#120
#1 - pauliax
2021-12-11T12:13:19Z
Similar to #88
π Selected for report: ye0lde
Also found by: GeekyLumberjack, gzeon, loop, robee
gzeon
_pcvValue, _userFei and validity returned from L111-116 are not used
( uint256 _pcvValue, // pcv value uint256 _userFei, // user fei int256 newProtocolEquity, bool validity ) = oracle.pcvStats();
#0 - elee1766
2021-12-06T03:46:34Z
#159
#1 - pauliax
2021-12-10T18:15:11Z
A duplicate of #159
13.4097 USDC - $13.41
gzeon
Inline transfer in PegExchanger.sol L42-43 can save ~120 gas per exchange
. This change does not sacrifice code clarity Since takeFrom
and giveTo
are so simpe and only used within exchange
function. Unlike isEnabled
and isExpired
which may have external use, takeFrom
and giveTo
can be removed to also save 20k gas on deployment.
L42-43
require(token0.transferFrom(msg.sender, address(this), token0TakenTotal), "erc20 transfer failed"); require(token1.transferFrom(address(this), msg.sender, token1GivenTotal), "erc20 transfer failed");
#0 - pauliax
2021-12-10T17:29:23Z
Valid optimization.
#1 - pauliax
2021-12-11T09:18:08Z
Similar to #143