# In the `revertBatch` function, `inChallenge` is set to `false` incorrectly, causing challenges to continue after the protocol is paused.

revertBatch resets inChallenge to false for unchallenged batches, so pausing the protocol skips challenge cleanup and slashes a valid prover.

- Payout: Audit contest
- Severity: medium
- Program: Morphl2
- Found by: 0xRajkumar
- Disclosed: 2024-08-28
- Write-up quality: 6/10
- Original: https://github.com/sherlock-audit/2024-08-morphl2-judging/issues/220
- Library page: https://bugbountylibrary.com/r/sherlock%3A2024-08-morphl2%3AM-11
- Tags: area:web3 domain:web3 impact:funds-loss impact:integrity kind:contest platform:sherlock sev:medium tech:solidity technique:source-review vuln:accounting-error vuln:business-logic

**Target:** L1 Rollup contract revertBatch/setPause challenge state
**Root cause:** revertBatch checks `!challenges[_batchIndex].finished`, which is true for nonexistent challenges, so it sets inChallenge=false even when the reverted batch was never challenged.
**Steps:**
1. Commit batches 123-126 to L1 Rollup.
2. Challenger calls `challengeState` on batch 123, setting inChallenge=true.
3. Owner calls `revertBatch` on batch 125 (reverting 125-126); loop hits batch 125 with no challenge, `!challenges[125].finished` is true, so `inChallenge=false`.
4. Owner calls `setPause(true)`; the `if (inChallenge)` block is skipped, so challenge on batch 123 is not deleted.
5. Pause exceeds challenge window; prover cannot submit proof and gets slashed.
**How found:** Code reading of revertBatch: noticed `!challenges[_batchIndex].finished` is true for default/empty challenge structs, so the guard fires for batches that were never challenged, then traced interaction with setPause's inChallenge check.
**Exploitation:** Owner-triggered sequence: revert an unchallenged batch while another batch is under challenge, then pause the protocol past the challenge window so the valid prover is slashed and the challenger collects reward+deposit.
**Insight:** When a mapping of structs is checked via a boolean field, remember default zero-values make `!field` true for nonexistent entries; audit state flags that gate cleanup logic against default-struct semantics.

