Closed sherlock-admin4 closed 6 months ago
This issue is invalid due to a misunderstanding of the "defense" move's mechanics.
In the dispute game, a "defense" move is still a counter to the claim that is being moved against. i.e., a subgame with an uncontered "defense" move as a child should indeed resolve to countered. A defense move in the game implies that the party who is countering agrees with the counterparty's current claim (at the implied position), but knows that they disagree with their opinion of the root claim (based off of the depth of their claim's position). In this case, the defense move is meant to allow for a participant to search further right in the tree, given that there is very likely to be a divergence in state to the right. If there is not, the step
function will catch that the counterparty challenged valid state at some point during bisection.
@clabby Does the same apply to issue #200?
KupiaSec
high
Incorrect logic around resolving claims and distributing bonds.
Summary
When a claim is resolved, defense move is considered as counter, which results in incorrect distribution of bonds.
Vulnerability Detail
FaultDisputeGame.sol L456-459
When resolving a claim happens, it iterates through sub-games and chooses the leftmost child which is not countered by, and set it as countered, distribute the bond of parent to the child claimer. This is because when the child claimer is not counted by anyone, it means it is assumed as correct. However, the problem with the code above is, it iterates through sub-games with defense move and possibly can set it as countered one.
Here's an example scenario of how it becomes an issue:
Here's a diagram to visually show the scenario above:
As shown in the diagram, after time passes and claims are resolved, the bond is distributed in incorrect way.
Here's a test case written in Foundry:
The test succeeds:
Impact
The bonds are distributed incorrectly.
Code Snippet
https://github.com/sherlock-audit/2024-02-optimism-2024/blob/f216b0d3ad08c1a0ead557ea74691aaefd5fd489/optimism/packages/contracts-bedrock/src/dispute/FaultDisputeGame.sol#L456-L459
Tool used
Manual Review, Foundry
Recommendation
When it iterates through its sub-games, it should check if the child is an attack.