fillOffchainOrders()
will always fail when multiple orders are submitted for a trading account.
fillOffchainOrders()
checks if the nonce
signed by the trader is still the same in his trading account.
He can also specify if he wants to increase this nonce with shouldIncreaseNonce
and if so, the nonce in his trading account will be increased, but all other off-chain orders for that account will fail because the nonce will no longer be the same and the above the check will revert.
This is a valid scenario because if the user has positions in 2 markets and wants to create an order for one of them, he will sign with the last nonce
from his trading account. Then, while those orders are still not filled, he decides to create another order for the second market, he will again sign the same nonce
because he cannot be sure which will be settled first. And as described, no matter which one is settled first, the second will fail. This will be even more frustrating in a real example, as fillOffchainOrders
will wait and fill a batch of orders, not 1-2.
Users will have to sign new orders off-chain and miss the market state as it was when they signed the original order.
Manual Review
It is difficult to give a proper recommendation here, but a possible one is to compare the original nonce with the signed one, regardless of whether it increments an order, since the orders were valid before the nonce was incremented by another order and should still be able to be executed**.**
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.