code-423n4 / 2021-11-fei-findings

0 stars 0 forks source link

Unused local variables in requery (TRIBERagequit.sol) #159

Open code423n4 opened 2 years ago

code423n4 commented 2 years ago

Handle

ye0lde

Vulnerability details

Impact

Gas savings and code clarity

Proof of Concept

The local variables on the lines below are declared to store the return values from requery yet some of these local variables are never used within the code.

https://github.com/code-423n4/2021-11-fei/blob/add34324513b863f58e4ef7b3cd0c12d776dbb7f/contracts/TRIBERagequit.sol#L112-L113 https://github.com/code-423n4/2021-11-fei/blob/add34324513b863f58e4ef7b3cd0c12d776dbb7f/contracts/TRIBERagequit.sol#L115

Tools Used

Visual Studio Code, Remix

Recommended Mitigation Steps

Change this: https://github.com/code-423n4/2021-11-fei/blob/add34324513b863f58e4ef7b3cd0c12d776dbb7f/contracts/TRIBERagequit.sol#L112-L115 to

        , //  pcv value 
        , // user fei
        int256 newProtocolEquity,
          // validity
    ) = oracle.pcvStats();
pauliax commented 2 years ago

Valid optimization.