This PR changes the computation of rewards to use winning and reference scores. Before, the winning score was recomputed using surplus and protocol fees. Under normal operation, this change should only affect rewards do to different rounding in the driver and the SQL query. With the current bug in surplus, the PR will produce correct rewards.
This simplifies the reward computation. One drawback is that misreported scores are now used for computing rewards. Fortunately, the circuit breaker will trigger in such cases and a manual transaction can be issued to reverse the wrong reward.
Tests have been adepted to only use scores for rewards.
There is a bug with surplus computations for JIT orders, https://github.com/cowprotocol/services/issues/2808.
This PR changes the computation of rewards to use winning and reference scores. Before, the winning score was recomputed using surplus and protocol fees. Under normal operation, this change should only affect rewards do to different rounding in the driver and the SQL query. With the current bug in surplus, the PR will produce correct rewards.
This simplifies the reward computation. One drawback is that misreported scores are now used for computing rewards. Fortunately, the circuit breaker will trigger in such cases and a manual transaction can be issued to reverse the wrong reward.
Tests have been adepted to only use scores for rewards.