The perpetual market contract lacks a grace period mechanism for funding rate calculations when new markets are created. This design flaw exposes the protocol to potential manipulation and unfair funding distributions during the critical market establishment phase.
In PerpMarket.sol
, the market creation sets lastFundingTime
to the current block timestamp:
Funding calculations immediately use this timestamp:
getCurrentFundingRate()
getCurrentFundingVelocity()
getNextFundingFeePerUnit()
getPendingFundingFeePerUnit()
Create a new perpetual market
Immediately execute trades
Observe funding rate calculations occurring without proper market establishment
The absence of a grace period creates a cascading effect of risks:
The immediate activation of funding calculations after market creation leads to unstable and potentially manipulatable funding rates. During the initial period when liquidity is low and price discovery is still establishing, these premature funding calculations can create adverse incentives for market participants.
Early traders may face distorted funding payments due to these inaccurate rates, as the market hasn't achieved sufficient depth for meaningful funding rate calculations. This can particularly impact large position holders who might incur substantial funding costs or gains based on these non-representative rates.
Furthermore, sophisticated actors could exploit this initialization period to manipulate funding rates through strategic positioning, taking advantage of the low liquidity and immature market dynamics to extract value from other participants.
This vulnerability ultimately undermines the market's price discovery process and could deter legitimate market participants from engaging during the crucial early stages of market formation.
Implement a grace period:
Alternative: Initialize with future timestamp:
Or add initialization period handling:
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.