# In some cases, proper CLOCK_EXTENTSION time cannot be ensured to generate the initial instruction trace

FaultDisputeGame::move's clock-extension guard uses single CLOCK_EXTENSION threshold, so at SPLIT_DEPTH-1 a team can get only 3h instead of the intended 6h to post the execution-trace root claim.

- Payout: Audit contest
- Severity: medium
- Program: Optimism
- Found by: oakcobalt
- Disclosed: 2024-08-16
- Write-up quality: 6/10
- Original: https://github.com/code-423n4/2024-07-optimism-findings/issues/44
- Library page: https://bugbountylibrary.com/r/c4%3A2024-07-optimism%3AM-06
- Tags: area:web3 domain:web3 impact:dos kind:contest platform:code4rena sev:medium tech:evm tech:solidity vuln:business-logic

**Target:** FaultDisputeGame.sol move() clock extension logic
**Root cause:** The guard `nextDuration.raw() > MAX_CLOCK_DURATION.raw() - CLOCK_EXTENSION.raw()` uses a single-extension threshold even when the grandchild is an execution-trace bisection root requiring 2*CLOCK_EXTENSION; when nextDuration equals exactly MAX-CLOCK_EXTENSION the branch is bypassed and no double extension is applied.
**Steps:**
1. Set CLOCK_EXTENSION=3h, MAX_CLOCK_DURATION=84h.
2. At move() time nextDuration.raw()==81h (== MAX - CLOCK_EXTENSION) and nextPosition at SPLIT_DEPTH-1.
3. Guard `nextDuration > MAX - CLOCK_EXTENSION` is false, so extensionPeriod=0 and nextDuration stays 81h.
4. Opposing team attacks; grandchild (execution trace root) now has only 3h instead of 6h to generate trace root claim and counter.
5. Team's clock can expire prematurely, losing the dispute.
**How found:** Code-reading of the move() clock-extension branch; noticed the threshold uses one CLOCK_EXTENSION while the extensionPeriod for SPLIT_DEPTH-1 is 2*CLOCK_EXTENSION, then constructed boundary cases (82h vs 81h) to show the off-by-one-extension gap.
**Insight:** When a branch computes a doubled extension but gates on a single-extension threshold, test the exact boundary nextDuration == MAX - CLOCK_EXTENSION at the special depth; the guard bypasses and the doubled extension is silently skipped.

## Proof of concept (copied exactly from the original report)

**Vulnerable clock extension condition in move()**

```
if (nextDuration.raw() > MAX_CLOCK_DURATION.raw() - CLOCK_EXTENSION.raw()) {
            // If the potential grandchild is an execution trace bisection root, double the clock extension.
            uint64 extensionPeriod =
                nextPositionDepth == SPLIT_DEPTH - 1 ? CLOCK_EXTENSION.raw() * 2 : CLOCK_EXTENSION.raw();
            nextDuration = Duration.wrap(MAX_CLOCK_DURATION.raw() - extensionPeriod);
```

