← ClaudeAtlas

cross-contract-statelisted

Detect cross-contract state inconsistency — two or more contracts sharing a token, oracle, or price feed where one mutates and another reads stale, cached state that drifts from source of truth, non-atomic multi-contract updates, accounting that assumes synchronized state, and reads during callbacks. Activate whenever a system spans multiple contracts that must agree on a value but update at different times.
iktok90-design/ai-smart-contract-auditor · ★ 36 · AI & Automation · score 80
Install: claude install-skill iktok90-design/ai-smart-contract-auditor
# Cross-contract state consistency detection ## When this applies Trigger on any of: - A value (price, total supply, share rate, debt) lives in contract A but is read by B - Cached/mirrored state (`cachedRate`, `lastTotalAssets`) that must be refreshed - Multi-contract operations that mutate several contracts non-atomically - Modules/plugins/hooks that read core state mid-update (read-during-callback) - Proxy + implementation, or vault + strategy, or controller + market splits - Accounting assuming "A and B are always in sync" ## Detection patterns ### Stale read of another contract's mid-update state (HIGH) ```solidity // Vault.deposit() transfers to Strategy, then: uint256 tvl = strategy.totalAssets(); // ← strategy hasn't accounted the deposit yet shares = amount * totalSupply / tvl; // wrong denominator ``` **Signal:** B reads A while A's update is incomplete (or vice versa). Share/price math uses a denominator that's about to change, letting an attacker mint mispriced shares. This is the read-only-reentrancy family generalized to ordinary call ordering. ### Cached value drift (HIGH) ```solidity uint256 public cachedPrice; // updated by poke() function valueOf(uint256 amt) external view returns (uint256) { return amt * cachedPrice / 1e18; // ← may be hours stale } ``` **Signal:** a mirrored value with no freshness guarantee or no atomic refresh-before-use. Trades/loans price off a cache that diverged from the source contract. ### Non-atomic mu