Closed code423n4 closed 1 year ago
mubaris marked the issue as sponsor disputed
getFundingRate()
returns the 24 hrs funding rate and you want to change this?????
mubaris requested judge review
Vague arguments were given (could not be optimunm
) for a heavy change. No numbers, no side by side comparison, no coded POC.
Couldn't find validity in this and the sponsor is obviously displeased. Closing as invalid.
JustDravee marked the issue as unsatisfactory: Invalid
Lines of code
https://github.com/code-423n4/2023-03-polynomial/blob/aeecafc8aaceab1ebeb94117459946032ccdff1e/src/Exchange.sol#L409-L424
Vulnerability details
Impact
This may update funding rate which would unfair to traders at certain sitation.
Proof of Concept
Whenevenr trade is opened, closed, collateral added or removed, liquidated,
_updateFundingRate
is called.This will update the fundingLastUpdated, normalizationFactor based on the
fundingRate = fundingRate / 1 days;
Refer the code,
This
normalizationFactor
is used in getIndexPrice() to get theindexPrice
which is used ingetFundingRate()
This getFundingRate() is called
getMarkPrice()
to get the max price at the given trading scenario either open or close etc..If there are less number of tades the price woudl exaggerated or more number of trades, the updated prices could not be optimunm.
Tools Used
Manual review
Recommended Mitigation Steps
We suggest to update the number of trades to update the funding rate.
function _updateFundingRate() internal { (int256 fundingRate,) = getFundingRate(); fundingRate = fundingRate / 1 days; ------------> change the hardocdes days .. based on number of trades