The createPerpMarket function in the GlobalConfigurationBranch contract is responsible for creating and configuring a new perpetual futures market. It is a critical function that allows the owner of the contract to define the parameters of a new market, which includes various financial and operational settings. The creation flow is such. GlobalConfigurationBranch:createPerpMarket calls PerpMarket.create function which then calls MarketConfiguration.update with all the data sent as params.
Now the issue is MarketConfiguration.update is adding all other values to the self but missing one field and value which is priceFeedHeartbeatSeconds. This field is never added anywhere in the whole creation flow. The priceFeedHeartbeatSeconds is very crucial for getting updated and correct prices.
Add the following event to the MarketConfiguration contracts:
Then log this event in the MarketConfiguration:update function i.e:
Now run the following command to test it:
It will emit a zero value for priceFeedHeartbeatSeconds variable and no matter what value is set in test_WhenPriceFeedHearbeatSecondsIsNotZero function, it will still be 0 . Which proves that the actual value is never added to the self variable during any step of the whole creation flow.
The priceFeedHeartbeatSeconds parameter defines how often the price feed updates occur. With this parameter being 0, it will always cause DOS wherever this price is required in the code. Accurate pricing is critical for the proper valuation of assets and for calculating margins, liquidations, and other financial metrics. If the price feed isn't updated responsive enough, it could lead to permanent DOS and potentially cause issues in margin calculations and trade executions.
To resolve this issue, add the following line to the MarketConfiguration:update function:
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.