Reverts entire transaction when incomingAsk.ercAmount > highestBid.ercAmount && startingId == Constants.TAIL && orderHint.lenght == 0
when it should rather end the transaction.
There a couple of instances when a user might not supply a hintId, since it is not required all the time when calling createAsks
as one can supply an empty array.
POC:
Bob Creates a market ask order with a price of $1500 and amount 200.
While he creates the request he sees that on the order book there are two orders that matches his market order, in the sense that they are both either greater than or equal to Bob's order amount.
Bob proceeds to make the request, supplying orderHintId as []
(empty array),
Bob request remains in the mempool for about 10 minutes due to low gas and by the time it is finally executed the two intended matches have been matched/closed.
Now the current state of Bob's request against the protocol is incomingAsk.ercAmount > highestBid.ercAmount && startingId == Constants.TAIL && orderHint.lenght == 0
.
Since Bob wants 200 units of the requested asset and the available is only 150, and the bid table is empty after matching the 150 asset amount.
The Contract then attempts to add Bobs left over 50 asset amount at Price to the ask order book , but Bob did not supply an orderhintArray at request, because of this the entire transaction reverts.
Revert transaction when it is meant to end transaction.
Manual
It should rather just end the execution when it sees that orderHintArray.lenght == 0
as opposed to reverting the entire transaction. that way the already fulfilled order stands.
if (incomingAsk.ercAmount.mul(incomingAsk.price) >= minAskEth) {
if(orderHintArray.lenght != 0){
addSellOrder(incomingAsk, asset, orderHintArray);
}
}
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.