Submitted by 0xsanson, also found by shw
In the Pricing contract, an agent can manipulate the trading prices by spamming a high amount of trades.
Indeed an agent can create a high amount of orders at an arbitrary price and with a near-zero amount (so the agent doesnt even need large funds); next he/she pairs the orders with another account and calls Trader.executeTrade; now every order calls a Pricing.recordTrade using the arbitrary price set by the agent.
Since the trades are all made in the same hour, by the way hourlyTracerPrices[currentHour] is calculated, it skews the average price towards the price set by the agent. This arbitrary value is used to calculate the fundingRates and the fairPrice, allowing a malicious agent the ability to manipulate the market.
Recommend passing the fillAmount parameter to recordTrade(...), and calculate hourlyTracerPrices[currentHour].trades summing fillAmount instead of 1 every trade.
raymogg (Tracer) confirmed:
