The function fillOffchainOrders can be DoS because in the loop it reverts instead of continue
The function to execute an order market offchain by the keepers is coded to be a batch of multiple signatures for the same market.
However, for each signature there are some checks to ensure a correct execution. These checks make the function to revert, so the problem is that if just a single signature does not comply with just 1 check it will revert the whole transaction and other signatures will not get executed either. The correct way to implement the checks is to just ignore the signature that does not comply the checks and execute the signatures that do.
As we can see in this implementation, there is a check that ignores the signature and execute the other ones. This check is for the valid price.
This is the only check that si implemented good to not affect other signatures. However, there are a bunch of other checks that make the function to revert and a user can use it on purpose to make the transaction to revert and not execute other offchain signatures from the same market ID.
These checks are:
If sizeDelta is 0, it reverts
If marketId is different from the market passed by the user signature, it reverts. This check is not triggerable by the user because it is the responsability of the protocol to batch signatures from the same marketId.
If the nonce passed by the signature does not match with the current position nonce, it reverts.
If the signature has been executed previously and hasOffchainOrderBeenFilled is set to true, it reverts
If the extracted signer of the signature is different from the position owner, it reverts.
If the new position size is smaller than the minTradeSizeX18, it reverts
All of these checks will make the whole transaction to revert and almost all of them can be triggered by a malicious user. So the result will be that all other legit signatures for the same marketId will not be executed.
Medium
Manual review
For every check, instead of reverting, just continue with the next iteration of the loop to ignore the signature that fails the check. This way, the legit signatures will get executed properly.
If you send 1 cancel and 1 create it should still run the cancel, not revert everything.
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.