# Persistent state flag lifecycle bug

Flags written once and never reset: init guards, claim markers, vote/status flags that outlive their phase

_Area: Smart contract access control and control flow. Seen in 2 disclosed reports; latest 2026-09-16. Updated 2026-11-17._

## How it works
A flag is written to record that a one-time event happened (initialized, claimed, voted, executed), but the code never clears or scopes it to the phase it was meant to guard. The assumption that breaks is that the flag's lifetime equals the phase's lifetime. When the phase can restart, be re-entered, or be replayed, the stale flag either blocks a legitimate later transition or wrongly authorizes one. The same failure appears when a guard is stored in a scope wider than intended: EIP-1153 transient storage is transaction-scoped, not frame-scoped, so a flag set in a constructor survives into later calls in the same transaction [E2](https://bugbountylibrary.com/r/dhl%3A20260916-startale.md).

## Where it shows up
- `initialize`/`reinitialize` gated only on a transient or constructor-set flag, with no persistent `initialized` boolean [E2](https://bugbountylibrary.com/r/dhl%3A20260916-startale.md)
- Claim functions using a mapping as a boolean (`claimed[x] != 0` reverts) rather than tracking claimed amounts [E3](https://bugbountylibrary.com/r/c4%3A2023-07-arcade%3AM-05.md)
- Vote/execute state machines where `vote()` has no check against post-execution voting, letting `canExecute` be re-flagged [E1](https://bugbountylibrary.com/r/sherlock%3A2024-08-flayer%3AH-25.md)
- Cancel/cleanup paths that delete claim state, combined with a re-registration path that reopens the lifecycle [E1](https://bugbountylibrary.com/r/sherlock%3A2024-08-flayer%3AH-25.md)
- Denomination/supply checks that re-fetch from a mutable registry instead of the stored params reference [E1](https://bugbountylibrary.com/r/sherlock%3A2024-08-flayer%3AH-25.md)

## How to review
For every flag, ask: what is its intended lifetime, and what is its actual storage scope? The invariant: a guard must be at least as durable as the state it protects, and no wider than the phase it guards. Check that init guards use persistent storage (or are cleared), that claim tracking stores amounts not booleans when roots can update [E3](https://bugbountylibrary.com/r/c4%3A2023-07-arcade%3AM-05.md), that terminal states (executed, cancelled) cannot be re-entered by any public call [E1](https://bugbountylibrary.com/r/sherlock%3A2024-08-flayer%3AH-25.md), and that stored params are used for later checks rather than re-read from a registry that can be re-initialized [E1](https://bugbountylibrary.com/r/sherlock%3A2024-08-flayer%3AH-25.md).

## How finders spotted it
- Read verified source of the proxy and account, saw `initializeAccount` gated only on a transient flag set in the constructor, hypothesized tstore persists for the whole transaction, confirmed with a second-init PoC [E2](https://bugbountylibrary.com/r/dhl%3A20260916-startale.md)
- Code review of inherited `_validateWithdraw`, noticed `claimed` used as a boolean gate, combined with the expectation the merkle root may be updated [E3](https://bugbountylibrary.com/r/c4%3A2023-07-arcade%3AM-05.md)
- Noticed `vote()` lacks a post-execution check and `cancel()` reads the live locker denomination instead of stored params, enabling a re-registration bypass [E1](https://bugbountylibrary.com/r/sherlock%3A2024-08-flayer%3AH-25.md)

## Variants seen
- Transient-storage init flag surviving the constructor frame, allowing reinit and drain of pre-funded balance [E2](https://bugbountylibrary.com/r/dhl%3A20260916-startale.md)
- Boolean claimed mapping blocking prior claimers after a merkle root update, stranding tokens [E3](https://bugbountylibrary.com/r/c4%3A2023-07-arcade%3AM-05.md)
- Vote flag re-settable after execution plus cancel deleting claim state, blocking ETH claims [E1](https://bugbountylibrary.com/r/sherlock%3A2024-08-flayer%3AH-25.md)

## Impact and severity
High: reinit drain of pre-funded USDC, batched across many accounts per tx and repeated over ~41 batches to scale [E2](https://bugbountylibrary.com/r/dhl%3A20260916-startale.md); permanent lockout of eligible claimers with tokens stuck in the contract [E3](https://bugbountylibrary.com/r/c4%3A2023-07-arcade%3AM-05.md); denial of eligible users' liquidated-balance claims [E1](https://bugbountylibrary.com/r/sherlock%3A2024-08-flayer%3AH-25.md). Impact rises with how many accounts or users the stale flag touches and whether the path is repeatable in one transaction.

## Evidence
- E1: https://bugbountylibrary.com/r/sherlock%3A2024-08-flayer%3AH-25.md
- E2: https://bugbountylibrary.com/r/dhl%3A20260916-startale.md
- E3: https://bugbountylibrary.com/r/c4%3A2023-07-arcade%3AM-05.md
