Closed sherlock-admin3 closed 7 months ago
This is valid and we will fix it. It should be noted that this would not impact the system as currently specified as the configured step depth is less than 64 but we are intending to fix this to avoid a future footgun. Given the lack of immediate impact we would argue to classify as low/footgun.
Agree with sponsors comment, as supported with additional details as below
The configured split depth on Sepolia is 30, and the max depth is 73. https://github.com/ethereum-optimism/optimism/blob/34ce96a09e88543c95c8dd6ec09d7e3531568b90/packages/contracts-bedrock/deploy-config/sepolia.json#L47-L51. It is possible for this to affect the dispute game with the current configuration theoretically, but the honest challenger would not travel that far right due to trace extension rules.
The protocol team fixed this issue in the following PRs/commits: https://github.com/ethereum-optimism/optimism/pull/10150
MiloTruck
medium
uint64
is too small to holdindexAtDepth
for nodes below a depth of 64Summary
As
uint64
is used to represent the index of nodes, callingstep()
with nodes below a depth of 64 may return an incorrect result.Vulnerability Detail
LibPosition.indexAtDepth()
returnsindexAtDepth_
as auint64
:However,
uint64
is too small to contain the index of nodes at a depth of 64 and below.Impact
indexAtDepth()
is used instep()
to find the depth of nodes. As such, callingstep()
on nodes at a depth of 64 and below may result in an incorrect result.Code Snippet
https://github.com/sherlock-audit/2024-02-optimism-2024/blob/f216b0d3ad08c1a0ead557ea74691aaefd5fd489/optimism/packages/contracts-bedrock/src/dispute/FaultDisputeGame.sol#L177
https://github.com/sherlock-audit/2024-02-optimism-2024/blob/f216b0d3ad08c1a0ead557ea74691aaefd5fd489/optimism/packages/contracts-bedrock/src/dispute/FaultDisputeGame.sol#L825
Tool used
Manual Review
Recommendation
In
indexAtDepth()
, returnindexAtDepth_
as auint128
instead.