# Stored parameter diverges from used value

Periphery caches a parameter the core silently overrides or recomputes; stored value drifts from what is actually used

_Area: Smart contract access control and control flow. Seen in 2 disclosed reports; one confirmed bounty: $75,000; latest 2024-02-01. Updated 2026-11-17._

## How it works
A contract stores a parameter (strike, position, config) that the component actually executing the logic does not use as stored. The core silently substitutes its own value, or an accounting path mutates a global aggregate on a transition that already happened. The stored value and the used value drift apart, and every later read of the stored value is wrong. The broken assumption is "what I saved is what will be used."

## Where it shows up
- Periphery contracts that persist user-supplied arguments before calling a core contract [E2](https://bugbountylibrary.com/r/sherlock%3A2024-02-smilee-finance%3AM-2.md)
- Core functions that accept a parameter but ignore it in favour of internal state [E2](https://bugbountylibrary.com/r/sherlock%3A2024-02-smilee-finance%3AM-2.md)
- Accounting paths that subtract from a global aggregate (total stake, total shares) on a state transition without checking the entity is still in that state [E1](https://bugbountylibrary.com/r/blog%3Aimmunefi-com-blog-bug-fix-reviews-polygon-consensus-bypass-bugfix-review.md)
- Migration/unstake/withdraw paths that can both touch the same aggregate for one entity [E1](https://bugbountylibrary.com/r/blog%3Aimmunefi-com-blog-bug-fix-reviews-polygon-consensus-bypass-bugfix-review.md)
- try/catch fallbacks where the success branch returns early on a low-but-valid result, masking a second source [E3](https://bugbountylibrary.com/r/c4%3A2021-10-mochi%3AM-09.md)

## How to review
For each stored field, find the exact value the executing contract reads at use time and confirm it equals what was stored. Invariant: stored parameter == value the core actually consumes, for every path. For aggregates, invariant: each entity's contribution is subtracted exactly once across all transitions; trace migrate then unstake and confirm no double subtraction. For fallbacks, invariant: a low/successful result from source A must not short-circuit a valid source B.

## How finders spotted it
- Traced updateTimeline/updateValidatorState across migrateOut and unstake, noticed the delegated amount subtracted on migration and again on unstake with no check that the source validator still stakes [E1](https://bugbountylibrary.com/r/blog%3Aimmunefi-com-blog-bug-fix-reviews-polygon-consensus-bypass-bugfix-review.md)
- Read PositionManager.mint against IG.mint, saw IG discards the strike argument and uses currentStrike while PositionManager persists the user's strike; a strike+1 test confirmed the burn revert [E2](https://bugbountylibrary.com/r/sherlock%3A2024-02-smilee-finance%3AM-2.md)
- Read the try/catch in aboveLiquidity, noticed the early return on the Uniswap success path means the Sushiswap fallback only fires on revert, not on low liquidity [E3](https://bugbountylibrary.com/r/c4%3A2021-10-mochi%3AM-09.md)

## Variants seen
- Periphery stores user-supplied strike; core uses currentStrike, leaving positions unburnable [E2](https://bugbountylibrary.com/r/sherlock%3A2024-02-smilee-finance%3AM-2.md)
- Delegation migration double-subtracts staking power from the global total [E1](https://bugbountylibrary.com/r/blog%3Aimmunefi-com-blog-bug-fix-reviews-polygon-consensus-bypass-bugfix-review.md)
- Liquidity adapter's success-branch early return skips the fallback source [E3](https://bugbountylibrary.com/r/c4%3A2021-10-mochi%3AM-09.md)

## Impact and severity
E2 left positions unburnable and funds stuck (medium). E3 let an attacker grief Sushiswap-only assets by creating an empty Uniswap pair. E1 was critical: iterating migrate/unstake shrank total stake below the 2/3 threshold, enabling forged checkpoints, deposit manager drain, unlimited withdrawals and DoS; impact scaled with repetition [E1](https://bugbountylibrary.com/r/blog%3Aimmunefi-com-blog-bug-fix-reviews-polygon-consensus-bypass-bugfix-review.md).

## Seen in real software
Open-source packages and projects, and products, where this pattern was found. If the target runs one, compare the version it runs with the fix.
- **Polygon** (StakeManager / ValidatorShare staking contracts) (version not stated): Polygon Consensus Bypass Bugfix Review. Report: https://bugbountylibrary.com/r/blog%3Aimmunefi-com-blog-bug-fix-reviews-polygon-consensus-bypass-bugfix-review.md

## Evidence
- E1: https://bugbountylibrary.com/r/blog%3Aimmunefi-com-blog-bug-fix-reviews-polygon-consensus-bypass-bugfix-review.md
- E2: https://bugbountylibrary.com/r/sherlock%3A2024-02-smilee-finance%3AM-2.md
- E3: https://bugbountylibrary.com/r/c4%3A2021-10-mochi%3AM-09.md
