Use only scores computed by the autopilot #3978
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Currently drivers are required to compute a score for their solution and commit to it. If the scores computed by the driver are different from what the autopilot computes it can result in situations where not enough rewards are paid out from the solver accounting scripts.
Since the autopilot has to compute scores anyway we might as well only use and store those instead of the possibly buggy driver computed scores.
Addresses parts of #3462.
Changes
Given how pressing this situation has become this PR only applies a bandage and foregoes a "proper" refactor of the involved code.
scorefrom the autopilot/solveresponse DTOautopilotdomain typesscorehandling and assertions fromdrivertestsThe ugly part is that we first build a
Solutionand only later have the winner selection logic populate thescore. This technically exposes us to the problem where the score gets read before it has been set. However, this does not happen in practice because ranking happens immediately after receiving the solutions and only solutions where a score could be computed get preserved. (see here)I also opted to still have the reference driver report the computed score as there are quite a few driver integration tests that test subtle scoring related logic. Losing those would be a shame and refactoring those to work without reporting the score in the response is also a ton of work.
This will be followed up with a PR refactoring the code such that the score gets initialized during construction to avoid this 2 phase initialization process.
How to test
existing e2e tests