op-challenger: Implement expanded honest challenger behaviour
Description
Implements the expanded honest actor behaviour to counter freeloaders as per https://github.com/ethereum-optimism/specs/pull/21/ The code has deliberately been adjusted to be much closer to the python in the spec implementation.
This identifies two problems with the spec:
- The honest challenger is incorrectly countering correct attacks (correct hash and in correct position)
- The honest challenger counters its own claims against freeloaders because in the sub-game created to invalidate the freeloader claim, the honest challenger is on the opposite team to when considering the root claim. ie if they were defending, they're now challenging.
TODO: This same logic needs to be applied for checking if we should step and add unit and e2e test for that case. Specifically we should not try to step against our own claims that are countering a freeloader and should step against a freeloader at max depth.
Tests
Added game solver unit tests to cover the key cases and demonstrate the self-countering issue. Updated the e2e test to operate in the top half of the game - previously the freeloader claims were at the game max depth and had to be counted by calling step rather than performing moves.
Metadata
- https://github.com/ethereum-optimism/client-pod/issues/103
Note: I haven't updated the tests for stepping (and possibly broke step calls - not entirely sure).
Replaced by https://github.com/ethereum-optimism/optimism/pull/9640