# Audit report

> AUDIT the wave-4 and wave-5 price fixes: src/Pricer.sol (twin rule on the attested median, NHI mat), src/feeds/SwarmFeed.sol + SwarmFeeds.sol (NHI bounded per window of time: carried anchor), src/feeds/FeedTraits.sol and the composites (proven, converged, attested), src/feeds/ProvenPoolPrice.sol (PROVE_WINDOW), at the pinned commit.
>
> imdUSD v2 is a multi-collateral CDP stablecoin. On 12-07 its capped beta launches on Ethereum AND Robinhood Chain (4663, incl. stock tokens), joined by a LayerZero V2 burn-and-mint bridge. README.md gives scope, invariants, trust model and known issues: read it first. Wave 4 findings: GET https://api.imd.fun/jobs/<id>/submissions (0cb1541e prices, ae48df88 keeper, 34e546c2 bridge, 549dae1c stocks).
>
> BUILD AND TEST (required; Foundry, solc 0.8.26 via_ir; never build the whole project with solc: ~49 GB). Run `forge test --match-path 'test/unit/{SwarmFeedProperties,PricerTwin,ProvenPoolPrice,AuditW4TwinLag,AuditW4NhiMat,AuditW4SlidingBound,AuditW4TraitNested,AuditW4ProvenProduct,AuditW4ProveWindow,AuditW5NhiWindow}.t.sol'`; Foundry 1.9+ `forge test --use solar --no-match-path 'test/fork/*'` runs all in seconds (confirm a proof with solc). Write each proof as test/unit/Proof<Name>.t.sol in the glob, run it, paste it with its output, then delete it.
>
> PROPERTIES:
> P1 A wrong or compromised median alone cannot set sIMD's low more than skew (5%) below a fresh proven spot.
> P2 After a genuine fall confirmed by a fresh proof, low reaches the attested median at its first delivery (not k epochs later), and the market once the median's window (~1,200 blocks) is past the fall.
> P3 Over ANY window of one maxAge (NHI: 1 day), whatever the silence and however attestations straddle an epoch boundary, every NHI value is within one cap of a value held in the maxAge before the window, so mat moves at most one cap's worth per day.
> P4 A composite reports proven only when one input is proven and the other has no attester in its path.
> P5 A failing trait read anywhere in a composite surfaces (reverts); it never reads as converged or proven. An empty-data revert with gas left, or a success with <32 bytes, reads ABSENT by design (FeedTraits.sol): show a deployed or Safe-addable feed where that reads converged or attester-free wrongly.
> P6 A prover's choice of block (any of the last 32; same or older = no-op) cannot move low further than the pool's real end-of-block range over ~6.4 min, and never more than skew below min(median, attested median).
> P7 Price legs: within an epoch the stored value stays in its anchor's allowance; over a closed maxAge the move is at most (1+c)^2-1, after a silence (1+2c)(1+c)^2-1.
> P8 A pushed or selected proven spot alone never sets low below min(median, attested median) by more than skew, and a pushed-UP proof alone (low = s when m < s) shelters a loan only until a newer block is proved.
>
> THREAT MODEL: a compromised attester key (or a wrong majority) controls signed values and their timing (seconds apart, across epoch boundaries, after silences); a pool pusher controls pool 0xb07d at chosen block ends; a builder controls ordering within and across blocks; a prover chooses which of the last 32 blocks to prove; a liquidator proves and bites in one transaction; a borrower pushes up and proves to shelter a loan; a relayer chooses which valid attestations land and when. ACCEPTED (user): an attester compromise together with a block-end push lowers low at once; bound it.
>
> PATH: SwarmFeed leaves -> ProductFeed / RateFeed (FeedTraits) -> Pricer.quote (low = min(m, s) when the legs agree: within skew AND both converged; else, with the spot proven and fresh, m > s ? max(s, min(m, attestedMedian)) : s; else m) -> Ledger and Liquidator; NHI leaf -> Pricer q.mat = _mat(nhi) (1.7 at NHI >= 0.85, 2.0 at <= 0.6, linear) -> Ledger health. The keeper (off-repo, 60 s tick) re-proves head-1 only when the live pool is >1.5% from the proof, the proof is within 1 h of its 6 h life, or stale; a failed prove is rebuilt and sent once. Deploy: cap 2,000 bps, price legs 1 h, NHI 1 day, sIMD skew 5%, PROVEN_MAX_AGE 6 h. 4663 (DeployConfig RobinhoodConfig): the IMD type (line 0, then 3,000 by the Safe) prices from TWO swarm legs (median + spot of mainnet IMD/ETH) x Chainlink ETH/USD, skew 10%, the same NHI leaf: no proven leg, so no twin.
>
> CLAIMS TO CHECK: confirm or refute each with a test.
> C1 the combined attester-plus-push loss is bounded by one pushed block's price at the block end: state the bound; a pushed proof within 1.5% of the live pool can stand ~5 h.
> C2 NHI's carried anchor (an epoch opening less than maxAge after the last move also stays in the previous anchor's band) gives P3 for any timing, and honest hourly relays still reach the level (worst case one cap per two epochs).
> C3 PROVE_WINDOW 32 never strands the keeper's head-1 proofs under normal block times (answer with window arithmetic and a Foundry test of a prove landing 31/32/33 blocks after its head).
> C4 every wave-4 price proof and the wave-5 boundary proof (NHI 0.85 -> 0.544 in one second) fail on the old rule and pass on this one.
>
> SOUNDNESS: SwarmFeed's epoch and clamp drew 5+ findings over waves 2-4; the twin and proven path drew 3 in wave 4. Do P1, P2 and P8 hold together, or does following the attested median give back what the twin bounded? Is a carried anchor the right NHI rule, and should the price legs carry it too? Give the smallest change.
>
> PROOF STANDARD: fuzz and invariant tests over interleavings of honest and attacker attestations (seconds apart, straddling epoch boundaries, after silences), block-end pushes across consecutive blocks, proofs of chosen blocks and NHI steps; extend SwarmFeedProperties, AuditW4TwinLag and AuditW5NhiWindow.
>
> KNOWN (a case worse than stated IS a finding): the price legs keep wave 4's accepted sliding bound (P7; only NHI carries its anchor), accepted because sIMD has the proven twin; 4663's IMD type has none: bound what one key moves there (both legs, P7) against its line; within one epoch a compromised key can swing NHI up a cap and back down.
>
> Answer each numbered question:
> 1. (P1, P2, P8) Attack the twin rule: a median clamped high, a stale attested value, a pushed proof up or down, legs from different moments.
> 2. (P3, P7) Find a sequence that moves NHI, mat or any leg further than stated, across epoch boundaries and silences.
> 3. (P4, P5) Find a composite or deploy graph that reports proven or converged wrongly, or swallows a failing read.
> 4. (P6) Can a prover still pick a favourable block, or can a late keeper bundle lose its hour?
>
> Not findings: README 'Known issues' as written (a known issue worse than written IS a finding); test/ and mocks; src/dex, src/earn/LoopVault.sol, and launch files README marks compile-only.
>
> Every finding: severity by impact; file, line, the lines copied; the call sequence; the failing state, expected vs actual; reachable with the deploy config or not; the smallest fix; a test that fails on this commit, RUN as BUILD says and pasted with its output (the judge reruns it). Answer every numbered question, including where nothing is wrong.

| | |
|---|---|
| Repository | https://github.com/imdusd/imdusd-v2-audit.git |
| Commit | `422a3373a78ed6b55d32a943a5481ffcbb8af1bf` |
| Job | `a25568fd-be59-4392-9008-91c77729bd94` |
| Judged | 2026-11-18 22:04 UTC |
| Findings | 1 high · 2 medium · 1 low · 2 info |

Four agents audited the code as it is at `422a337`, each in one area (math, permissions, economics, control flow),
and a judge reproduced, merged and ranked what they found, then read the code once more itself. Nothing in the repository was changed or deployed.

## Findings

### 1. High: Twin rule follows the ATTESTED median at once: honestly attested pushed pool reads plus one pushed proof set sIMD low to the pushed price in one epoch, with no attester key

`src/Pricer.sol:99`

```
            q.low = q.high = m > s ? Math.max(s, Math.min(m, FeedTraits.attested(c.median))) : s;
```

Q1 / SOUNDNESS. P1 and P8 hold as worded, but P2 (low reaches the attested median at its first delivery) removes the per-epoch bound on a pool pusher who has NO key. The median leaf's question (SwarmQuestions.PRICE, src/feeds/SwarmFeeds.sol:13-15) asks for the median of 13 evenly spaced end-of-block reads of pool 0xb07d over a requester-chosen window of 300..1,200 blocks; the proven spot is one end-of-block read of the SAME pool. A pusher who holds the pool at P at the ends of 7 of the 13 sampled blocks (for a 300-block window: T-150, T-125, ..., T, i.e. 7 block ends over ~30 min) gets an HONEST attestation whose answer is P. Relayed, the leaf still clamps the stored median to anchor x 0.8 (latestValue 0.8A), but attested() = P and converged() = false. The same actor proves block T (pushed; within PROVE_WINDOW). The legs disagree, the spot is proven and fresh, m > s, so line 99 gives low = max(P, min(0.8A, P)) = P. Liquidator passes q.low to the Ledger, lull is 0 in the beta, so every sIMD position with collateral ratio below mat x A / P is seizable at P in the proving transaction. README (wave-3 residual, design-C section) still says 'pushed pool reads attested honestly move a leg one allowance per epoch while they last': the leg does, LOW does not. Before wave 4 the rule (max(median, spot)) gave low = 0.8A here. The user-ACCEPTED case is 'attester compromise + block-end push'; this needs no compromise, only the threat model's pusher/builder at 8 chosen block ends (7 sampled + the proved one, which can be the 7th) and permissionless request, relay and prove: a known issue worse than written. Cost: the fees and arbitrage loss of 7-8 one-block pushes (a builder that also backruns its own push recovers most of the principal), against the whole sIMD book at P. Reachable with the deploy config: yes (mainnet sIMD: median = rate x (SwarmPriceFeed 1 h / 2,000 bps x ETH/USD), spot = rate x (ProvenPoolPrice x ETH/USD), skew 5%). Not on 4663 (no proven leg). SMALLEST FIX (keeps the twin; scope decision on P2): let the attested value count at most one further allowance under the stored median: `uint256 floor_ = m - Math.mulDiv(m, TWIN_STEP, 1e18); q.low = q.high = m > s ? Math.max(s, Math.min(m, Math.max(FeedTraits.attested(c.median), floor_))) : s;` with TWIN_STEP = the leaf cap (0.2e18). A genuine fall is then followed at -36% at the first delivery and one cap per epoch after, and a pusher again needs 7 pushes per epoch. If P2 is kept as is, the README residual must state that pushed reads move LOW at once and the attack costs 7-8 block-end pushes. Pool sampling and window choice are from the question text and the specialist's trace; the Pricer arithmetic is reproduced by the test.

**Reproduction**

State: sIMD-shaped graph (RateFeed(1.1) x ProductFeed(production SwarmPricePolicy leaf 1 h / 2,000 bps, ETH/USD 2,000)) as median; RateFeed x ProductFeed(proven stub, ETH/USD) as spot; skew 5%; leaf stored = attested = A = 4e15, proven A: low = $8.80. Calls: leaf.deliver(A/2) (the honest median of 6 x A and 7 x A/2) -> latestValue 0.8A, attested 0.5A; proven.prove(A/2); Pricer.quote(SIMD). Expected (README residual / one further allowance): low >= 0.64A = $5.632. Actual: low = $4.40 = the pushed price, priced = true, same epoch. Run: forge test --match-path test/scratch/Proof_97c18eaab5d6.t.sol -vv (solc 0.8.26 via_ir, forge 1.9.0). Output on this commit: [FAIL: low = the pushed price: 4602400000000000000 < 5632000000000000000; counterexample: args=[100000000000000000 [1e17]]] testFuzz_pusherAlone_lowStaysWithinTheEpochAllowance(uint256); [FAIL: low left the epoch's allowance at once: pushed reads + a pushed proof, no key: 4400000000000000000 < 5632000000000000000] test_pusherAlone_lowStaysWithinTheEpochAllowance() (gas: 374739). Suite result: FAILED. 0 passed; 2 failed. With the fix low = max(s, 0.64A) = $5.632 and both pass.

**Proof**: a Foundry test that fails on this code and passes once it is fixed.

```solidity
// SPDX-License-Identifier: MIT
pragma solidity 0.8.26;

import {Test} from "forge-std/Test.sol";
import {Pricer} from "src/Pricer.sol";
import {Parameters} from "src/Parameters.sol";
import {ParametersBase} from "src/ParametersBase.sol";
import {IFeed} from "src/interfaces/IFeed.sol";
import {ProductFeed} from "src/feeds/ProductFeed.sol";
import {RateFeed} from "src/feeds/RateFeed.sol";
import {SwarmFeed} from "src/feeds/SwarmFeed.sol";
import {SwarmPricePolicy, SwarmNhiPolicy, SwarmQuestions} from "src/feeds/SwarmFeeds.sol";

/// The four Parameters reads Pricer.quote makes, nothing else.
contract ParamsStub {
    mapping(bytes32 => ParametersBase.Config) internal c;
    mapping(bytes32 => ParametersBase.Risk) internal r;

    function set(bytes32 ilk, ParametersBase.Config memory c_, ParametersBase.Risk memory r_) external {
        c[ilk] = c_;
        r[ilk] = r_;
    }

    function config(bytes32 ilk) external view returns (ParametersBase.Config memory) {
        return c[ilk];
    }

    function storedRisk(bytes32 ilk) external view returns (ParametersBase.Risk memory) {
        return r[ilk];
    }

    function maxLull() external pure returns (uint256) {
        return 0;
    }

    function cap(bytes32) external pure returns (uint256) {
        return 0;
    }
}

/// The shipped median leaf (SwarmPriceFeed's policy, 1 h, 2,000 bps) with a door to `_accept`: what submitAttestation
/// calls once the signature, question and window checks have passed. `deliver(x)` = a valid attestation of x relayed now.
contract MedianLeaf is SwarmPricePolicy {
    constructor() SwarmFeed(SwarmQuestions.ATTESTER, address(0), 1, 3, 1 hours, 2_000) {}

    function deliver(uint256 target) external {
        _accept(target, uint64(block.timestamp));
    }
}

/// The shipped NHI leaf (SwarmNhiFeed's policy, 1 day, 2,000 bps) with the same door.
contract NhiLeaf is SwarmNhiPolicy {
    constructor() SwarmFeed(SwarmQuestions.ATTESTER, address(0), 1, 3, 1 days, 2_000) {}

    function deliver(uint256 target) external {
        _accept(target, uint64(block.timestamp));
    }
}

/// ProvenPoolPrice's IFeed surface: the pool's price at the end of the proved block, fresh 6 h, `proven()` true.
contract ProvenStub {
    uint256 internal v;
    uint64 internal at;

    function prove(uint256 endOfBlockPrice) external {
        v = endOfBlockPrice;
        at = uint64(block.timestamp);
    }

    function latestValue() external view returns (uint256, uint64) {
        return (v, at);
    }

    function isStale() external view returns (bool) {
        return at == 0 || block.timestamp > uint256(at) + 6 hours;
    }

    function proven() external pure returns (bool) {
        return true;
    }

    function maxAge() external pure returns (uint256) {
        return 6 hours;
    }
}

/// Chainlink ETH/USD stand-in: answers none of the traits.
contract EthUsd {
    function latestValue() external view returns (uint256, uint64) {
        return (2000e18, uint64(block.timestamp));
    }

    function isStale() external pure returns (bool) {
        return false;
    }

    function maxAge() external pure returns (uint256) {
        return type(uint64).max;
    }
}

contract ShareVault {
    function convertToAssets(uint256 s) external pure returns (uint256) {
        return s * 1.1e18 / 1e18;
    }
}

/// sIMD as deployed: median = rate x (swarm median leaf x ETH/USD), spot = rate x (proven pool x ETH/USD), skew 5%, NHI leaf.
abstract contract TwinRig {
    bytes32 internal constant SIMD = "SIMD";
    uint256 internal constant A = 4e15; // wei per IMD
    MedianLeaf internal leaf;
    NhiLeaf internal nhi;
    ProvenStub internal proven;
    IFeed internal median;
    IFeed internal spot;
    Pricer internal pricer;

    function _rig() internal {
        leaf = new MedianLeaf();
        nhi = new NhiLeaf();
        proven = new ProvenStub();
        IFeed eth = IFeed(address(new EthUsd()));
        address vault = address(new ShareVault());
        median = IFeed(address(new RateFeed(vault, ShareVault.convertToAssets.selector, true, new ProductFeed(IFeed(address(leaf)), eth), 0)));
        spot = IFeed(address(new RateFeed(vault, ShareVault.convertToAssets.selector, true, new ProductFeed(IFeed(address(proven)), eth), 0)));
        ParamsStub p = new ParamsStub();
        ParametersBase.Config memory c;
        c.token = address(0xC011);
        c.median = median;
        c.spot = spot;
        c.nhi = IFeed(address(nhi));
        ParametersBase.Risk memory r;
        r.mat = 1.7e18;
        r.skew = 0.05e18;
        p.set(SIMD, c, r);
        pricer = new Pricer(Parameters(address(p)));
        leaf.deliver(A);
        nhi.deliver(0.9e18);
        proven.prove(A);
    }

    function _usd(uint256 weiPerImd) internal pure returns (uint256) {
        return (weiPerImd * 2000e18 / 1e18) * 1.1e18 / 1e18;
    }
}



/// No key is compromised here. A pool pusher holds pool 0xb07d at P at the END of 7 of the 13 blocks one PRICE window
/// samples (span 300: one sample per 25 blocks, the last is the window's toBlock). The honest panel signs the median of
/// the 13 reads, which is P. Anyone relays it and proves the window's last block (pushed, within PROVE_WINDOW). README
/// (wave-3 residual, design C): "pushed pool reads attested honestly move a leg one allowance per epoch".
contract ProofTwinPushedWindowTest is Test, TwinRig {
    function setUp() public {
        vm.warp(1_800_000_000);
        vm.roll(26_000_000);
        _rig();
    }

    function _honestMedianOf13(uint256 market, uint256 pushed, uint256 pushedSamples) internal pure returns (uint256) {
        uint256[13] memory s;
        for (uint256 i; i < 13; ++i) s[i] = i < 13 - pushedSamples ? market : pushed;
        for (uint256 i; i < 13; ++i) {
            for (uint256 j = i + 1; j < 13; ++j) {
                if (s[j] < s[i]) (s[i], s[j]) = (s[j], s[i]);
            }
        }
        return s[6];
    }

    function _attack(uint256 pushed) internal returns (Pricer.Quote memory q, uint256 m) {
        Pricer.Quote memory q0 = pricer.quote(SIMD);
        assertTrue(q0.borrowable, "start: legs agree at the market");
        assertEq(q0.low, _usd(A));
        // 150 blocks: the 7 pushed samples (blocks T-150, T-125, ..., T) inside one 300-block window
        vm.roll(vm.getBlockNumber() + 150);
        vm.warp(vm.getBlockTimestamp() + 30 minutes);
        uint256 honest = _honestMedianOf13(A, pushed, 7);
        assertEq(honest, pushed, "the honest median of 13 reads, 7 of them pushed");
        leaf.deliver(honest); // the attester's honest signature, relayed by anyone
        proven.prove(pushed); // block T's end-of-block price, proved by anyone
        q = pricer.quote(SIMD);
        (m,) = median.latestValue();
    }

    /// FAILS on this commit: low = the pushed price (50% under the market) in the same epoch.
    function test_pusherAlone_lowStaysWithinTheEpochAllowance() public {
        (Pricer.Quote memory q, uint256 m) = _attack(A / 2);
        assertEq(m, _usd(A * 8 / 10), "the median leaf itself is clamped one allowance down (design C holds)");
        assertTrue(q.priced, "liquidation runs at low");
        // one further allowance under the clamped median is the loosest reading of "one allowance per epoch"
        assertGe(q.low, m * 8 / 10, "low left the epoch's allowance at once: pushed reads + a pushed proof, no key");
    }

    function testFuzz_pusherAlone_lowStaysWithinTheEpochAllowance(uint256 pBps) public {
        uint256 pushed = A * bound(pBps, 100, 6_300) / 10_000;
        (Pricer.Quote memory q, uint256 m) = _attack(pushed);
        assertGe(q.low, m * 8 / 10, "low = the pushed price");
    }
}
```

### 2. Medium: Epoch band is anchored at the epoch's opening value, not the value held: after an honest move one attestation moves NHI two caps' worth (mat 1.70 -> 2.00 in one second) and a leg +50%/-33% (+80%/-46.7

`src/feeds/SwarmFeed.sol:688`

```
            (anchor, bound) = (_anchorValue, _anchorBound);
```

Q2 (P3, P7). Merged from two specialists (same root cause, same fix). Inside a live epoch _follow clamps every target into [anchor(1-c), anchor(1+c)] around the value stored when the epoch OPENED (SwarmFeed.sol:688 and :692 `uint256 v = _clamp(target, anchor, bound);`); nothing bounds a step against the value the feed holds now. Once the stored value has moved inside the epoch (an honest hourly relay of a real move, or the key's own first step), the opposite edge is one attestation away: (1+c)/(1-c)-1 = +50% or 1-(1-c)/(1+c) = -33.3% from the held value, and with a second attestation one second later across the boundary (1+c)^2/(1-c)-1 = +80% / -46.7% on a price leg (NHI's carried anchor stops only that second step). P3 as literally worded (within one cap of SOME value held in the maxAge before) holds; its stated consequence 'mat moves at most one cap's worth per day' does not, and P7's closed-maxAge figure (1+c)^2-1 = +44%/-36% is exceeded. The README's 'swing NHI up a cap and back down' needs the key twice; here an honest intra-day rise plus ONE compromised attestation does it, and the step from the level held is two caps' ratio. IMPACT: (a) NHI/mat, mainnet sIMD and the 4663 IMD type (no twin for mat): anchor 0.71, honest relays to 0.85 (mat 1.70, converged, borrowable); one attestation one second later stores 0.568 -> mat 2.00: every sIMD loan between 170% and 200% liquidatable at once, the exact jump the wave-5 boundary fix (0.85 -> 0.544 in one second) was meant to remove. (b) 4663 IMD type (two swarm legs, one key, no twin, skew 10%): after an honest intra-hour fall of >= 15.3% one key takes both legs, converged and agreeing, to 1.2 x 1.2 / 0.847 = 1.70x market in one boundary second (stated +44% never crosses mat 1.70 in one boundary): debt up to the line (3,000 imdUSD) against collateral worth less than it; mirror: 0.533x after an honest 20% rally (loans under ~319% liquidatable). Mainnet's price side stays bounded by the proven twin. Reachable with the deploy config (cap 2,000 bps, legs 1 h, NHI 1 day) by the threat model's compromised key. SMALLEST FIX (clamp-not-reject, memory only within the live epoch): keep the epoch's lowest and highest STORED value (two uint128, one slot; reset to the anchor when an epoch opens, to `first` on the wide step; carried with the anchor for a carrying leaf) and also clamp into [high x (1-c), low x (1+c)] before storing. The interval always contains [low, high], so it is never empty; every value of an epoch is then within one cap of every other, so one attestation moves one cap from the held value, a boundary pair (1+c)^2-1, NHI/mat one cap's worth. Liveness cost: an honest reversal larger than one cap from the epoch's extreme finishes next epoch. With it the price legs do not need the carried anchor.

**Reproduction**

NHI leaf (SwarmNhiPolicy, 1 day, 2,000 bps): t0 set 0.71; t0+1d honest 0.71 (anchor 0.71); +6h 0.78; +6h 0.85 -> Pricer mat 1.70. +1 s attestation target 1 wei. Expected (one cap from held): NHI >= 0.68, mat <= 1.904. Actual 0.568, mat 2.000. Price leg (SwarmPricePolicy 1 h, 2,000 bps): t0 100; t0+1h 100; +20 min 80; t0+2h-1s target 2^128-1 -> 120 (expected <= 96); t0+2h -> 144 (expected <= 115.2); mirror 120 -> 80 -> 64. Run: forge test --match-path test/scratch/Proof_53330bf4fdf3.t.sol -vv. Output on this commit: [FAIL: one attestation moved the leg more than one cap from the value it held: 800000000000000000000000 < 960000000000000000000000] test_leg_closedWindow_minus47pct_inOneSecond() (gas: 2470151) logs 80.0 / 64.0; [FAIL: one attestation moved the leg more than one cap from the value it held: 1200000000000000000000000 > 960000000000000000000000] test_leg_closedWindow_plus80pct_inOneSecond() (gas: 2481667) logs 120.0 / 144.0; [FAIL: NHI moved more than one cap from the value it held a second before: 568000000000000000 < 680000000000000000] test_nhi_oneAttestation_mat_170_to_200() (gas: 4459508) logs NHI 0.568, mat 2.000. Suite result: FAILED. 0 passed; 3 failed. Also reproduced (second specialist, key twice inside one epoch): accept 0.72 -> 1.0 (stored 0.864, mat 1.70) -> t0+86,399 s 0.1 (stored 0.576, mat 2.00), expected >= 0.6912.

**Proof**: a Foundry test that fails on this code and passes once it is fixed.

```solidity
// SPDX-License-Identifier: MIT
pragma solidity 0.8.26;

import "forge-std/Test.sol";
import {SwarmFeed} from "src/feeds/SwarmFeed.sol";
import {SwarmNhiPolicy, SwarmPricePolicy} from "src/feeds/SwarmFeeds.sol";
import {Pricer} from "src/Pricer.sol";
import {Parameters} from "src/Parameters.sol";
import {ParametersBase} from "src/ParametersBase.sol";
import {IFeed} from "src/interfaces/IFeed.sol";

/// The shipped NHI rule (SwarmNhiPolicy: no widening, carried anchor), 1 day, cap 2,000 bps; `set` is `_accept`.
contract NhiDoor is SwarmNhiPolicy {
    constructor() SwarmFeed(address(1), address(0), 1, 3, 1 days, 2000) {}
    function set(uint256 t) external { _accept(t, uint64(block.timestamp)); }
}

/// The shipped price-leg rule (SwarmPricePolicy), 1 hour, cap 2,000 bps.
contract LegDoor is SwarmPricePolicy {
    constructor() SwarmFeed(address(1), address(0), 1, 3, 1 hours, 2000) {}
    function set(uint256 t) external { _accept(t, uint64(block.timestamp)); }
}

contract FlatFeed {
    function latestValue() external view returns (uint256, uint64) { return (100e18, uint64(block.timestamp)); }
    function isStale() external pure returns (bool) { return false; }
    function maxAge() external pure returns (uint256) { return 1 hours; }
}

contract ParamsStub {
    ParametersBase.Config internal c; ParametersBase.Risk internal r;
    constructor(IFeed price, IFeed nhi) { c.token = address(1); c.median = price; c.spot = price; c.nhi = nhi; r.skew = 0.05e18; r.mat = 1.7e18; }
    function config(bytes32) external view returns (ParametersBase.Config memory) { return c; }
    function storedRisk(bytes32) external view returns (ParametersBase.Risk memory) { return r; }
    function cap(bytes32) external pure returns (uint256) { return 0; }
    function maxLull() external pure returns (uint256) { return 0; }
}

/// The epoch band is anchored at the value the epoch OPENED on, not at the value the feed holds now. After an honest move
/// inside an epoch, ONE signed value moves the stored value (1+c)/(1-c) - 1 = +50% or 1 - (1-c)/(1+c) = -33.3% from the
/// honest level, and a second one a second later across the boundary takes a price leg to +80% / -46.7%.
/// Stated: one cap (20%) per epoch; (1+c)^2 - 1 = +44% / -36% over a closed maxAge; NHI and mat one cap's worth per day.
contract ProofSwingReachTest is Test {
    uint256 clock = 1_800_000_000;

    function setUp() public { vm.chainId(1); vm.warp(clock); vm.roll(26_000_000); }
    function _warp(uint256 dt) internal { clock += dt; vm.warp(clock); }
    function _val(SwarmFeed f) internal view returns (uint256 v) { (v,) = f.latestValue(); }

    /// P3's consequence: mat moves at most one cap's worth of NHI per day. One attestation takes mat 1.70 -> 2.00.
    function test_nhi_oneAttestation_mat_170_to_200() public {
        NhiDoor nhi = new NhiDoor();
        Pricer pricer = new Pricer(Parameters(address(new ParamsStub(IFeed(address(new FlatFeed())), IFeed(address(nhi))))));
        nhi.set(0.71e18); // yesterday's level
        _warp(1 days); nhi.set(0.71e18); // honest hourly relay opens today's epoch: anchor 0.71
        _warp(6 hours); nhi.set(0.78e18); // the index recovers through the day, honestly attested
        _warp(6 hours); nhi.set(0.85e18);
        assertTrue(nhi.converged());
        Pricer.Quote memory q = pricer.quote("SIMD");
        assertEq(q.mat, 1.7e18, "honest NHI 0.85: mat 1.70");
        assertTrue(q.borrowable);

        _warp(1); nhi.set(1); // ONE compromised attestation, one second later, same epoch, no boundary
        uint256 v = _val(nhi);
        q = pricer.quote("SIMD");
        emit log_named_decimal_uint("NHI one second after 0.85", v, 18);
        emit log_named_decimal_uint("mat one second after 1.70", q.mat, 18);
        // one cap from the value NHI held: 0.85 x 0.8 = 0.68, mat 1.904
        assertGe(v, 0.68e18, "NHI moved more than one cap from the value it held a second before");
        assertLe(q.mat, 1.904e18, "mat moved more than one cap's worth of NHI in one second");
    }

    /// P7: over a closed maxAge a leg moves at most (1+c)^2 - 1 = +44%. Here +50% in one attestation and +80% in one second.
    function test_leg_closedWindow_plus80pct_inOneSecond() public {
        LegDoor leg = new LegDoor();
        leg.set(100e18);
        _warp(1 hours); leg.set(100e18); // honest relay opens the epoch: anchor 100
        _warp(20 minutes); leg.set(80e18); // the market falls 20% inside the hour, honestly attested
        assertTrue(leg.converged());
        uint256 honest = _val(leg);
        assertEq(honest, 80e18);

        _warp(40 minutes - 1); leg.set(type(uint128).max); // compromised key, last second of the epoch
        uint256 one = _val(leg);
        _warp(1); leg.set(type(uint128).max); // first second of the next epoch
        uint256 two = _val(leg);
        emit log_named_decimal_uint("leg after ONE attestation (honest level 80)", one, 18);
        emit log_named_decimal_uint("leg ONE SECOND later", two, 18);
        assertLe(one * 10_000, honest * 12_000, "one attestation moved the leg more than one cap from the value it held");
        assertLe(two * 10_000, honest * 14_400, "closed maxAge (here: one second) moved more than (1+c)^2 - 1");
    }

    /// The mirror: -33.3% in one attestation, -46.7% in one second (stated -20% / -36%).
    function test_leg_closedWindow_minus47pct_inOneSecond() public {
        LegDoor leg = new LegDoor();
        leg.set(100e18);
        _warp(1 hours); leg.set(100e18);
        _warp(20 minutes); leg.set(120e18); // honest rally of 20% inside the hour
        uint256 honest = _val(leg);
        _warp(40 minutes - 1); leg.set(1);
        uint256 one = _val(leg);
        _warp(1); leg.set(1);
        uint256 two = _val(leg);
        emit log_named_decimal_uint("leg after ONE attestation (honest level 120)", one, 18);
        emit log_named_decimal_uint("leg ONE SECOND later", two, 18);
        assertGe(one * 10_000, honest * 8_000, "one attestation moved the leg more than one cap from the value it held");
        assertGe(two * 10_000, honest * 6_400, "closed maxAge (here: one second) moved more than 1 - (1-c)^2");
    }
}
```

### 3. Medium: Twin rule's `: s` arm: one pushed-UP proven block end alone sets low = high = payout with no upper bound, and PricerOracle hands it to Backstop.nav() as a good value (deposit buckets converted at an i

`src/Pricer.sol:99`

```
            q.low = q.high = m > s ? Math.max(s, Math.min(m, FeedTraits.attested(c.median))) : s;
```

Q1 (P8). When the proven spot s is above the median m and the legs disagree, line 99 returns s for low, high and (line 103) payout with no reference to the median or its attested value. P8 accepts one consequence: a pushed-up proof 'shelters a loan only until a newer block is proved'. But the same number is read as a VALUE by readers that need only `priced`: src/backstop/PricerOracle.sol:46 `return (q.low, q.high, q.priced && q.low != 0);`, and Backstop.nav() (src/backstop/Backstop.sol:362-368) adds coll x high for every held token; Backstop._convert (:728-746) mints a matured deposit bucket `Math.mulDiv(amount, supply, value + 1)` shares at that nav. sIMD is a sleeve token (script/DeployConfig.sol:536 `SleeveIlk("SIMD", true, ...)`). So a pusher (no key) who pushes pool 0xb07d at one block end, proves it (permissionless, any of the last 32 blocks) and triggers a conversion (anyone's deposit/bid) while that proof is newest dilutes the converting buckets in favour of existing holders by coll_sIMD x (s_pushed - s_true). Under the plain median rule a disagreeing pair collapses to the median; inside agreement high <= m x (1 + skew). Capping the arm itself would break P1, so the fix belongs in the value reader. Reachable with the deploy config: the Pricer/PricerOracle state yes (reproduced); the Backstop dilution additionally needs the sleeve to hold sIMD and a bucket to mature (traced by reading, not run end to end). SMALLEST FIX: PricerOracle.priceOf reports ok = q.priced && q.low != 0 && q.agree for a type whose spot is proven (or simply && q.agree): nav() then fails closed and _convert waits, exactly as for an unpriced token; liquidation health keeps reading Pricer.low unchanged. Tradeoff: conversions wait while the sIMD legs disagree.

**Reproduction**

sIMD-shaped rig (median = RateFeed(1.1) x ProductFeed(SwarmPricePolicy leaf, ETH/USD 2,000), converged at A = 4e15; spot = RateFeed x ProductFeed(proven stub)); proven.prove(10A); Pricer.quote(SIMD) and PricerOracle(pricer, this).priceOf(token). Expected: ok false, or high <= median x 1.05 = $9.24. Actual: priced true, agree false, low = high = payout = $88.00 (10x), PricerOracle high $88.00 ok true. Run: forge test --match-path test/scratch/ProofTwinUpValue.t.sol -vv. Output on this commit: [FAIL: a lone pushed-up proof is valued by the Backstop at 10x the median] test_pushedUpProofAloneIsReadAsAValue() (gas: 914085) Logs: honest median (= attested), USD: 8.8 / low: 88.0 / high: 88.0 / payout: 88.0 / PricerOracle.priceOf high (Backstop nav price): 88.0. Suite result: FAILED. 0 passed; 1 failed.

**Proof**: a Foundry test that fails on this code and passes once it is fixed.

```solidity
// SPDX-License-Identifier: MIT
pragma solidity 0.8.26;

import {Test} from "forge-std/Test.sol";
import {Pricer} from "src/Pricer.sol";
import {Parameters} from "src/Parameters.sol";
import {ParametersBase} from "src/ParametersBase.sol";
import {IFeed} from "src/interfaces/IFeed.sol";
import {ProductFeed} from "src/feeds/ProductFeed.sol";
import {RateFeed} from "src/feeds/RateFeed.sol";
import {SwarmFeed} from "src/feeds/SwarmFeed.sol";
import {SwarmPricePolicy, SwarmNhiPolicy, SwarmQuestions} from "src/feeds/SwarmFeeds.sol";
import {PricerOracle} from "src/backstop/PricerOracle.sol";

/// The four Parameters reads Pricer.quote makes, nothing else.
contract ParamsStub {
    mapping(bytes32 => ParametersBase.Config) internal c;
    mapping(bytes32 => ParametersBase.Risk) internal r;

    function set(bytes32 ilk, ParametersBase.Config memory c_, ParametersBase.Risk memory r_) external {
        c[ilk] = c_;
        r[ilk] = r_;
    }

    function config(bytes32 ilk) external view returns (ParametersBase.Config memory) {
        return c[ilk];
    }

    function storedRisk(bytes32 ilk) external view returns (ParametersBase.Risk memory) {
        return r[ilk];
    }

    function maxLull() external pure returns (uint256) {
        return 0;
    }

    function cap(bytes32) external pure returns (uint256) {
        return 0;
    }
}

/// The shipped median leaf (SwarmPriceFeed's policy, 1 h, 2,000 bps) with a door to `_accept`: what submitAttestation
/// calls once the signature, question and window checks have passed. `deliver(x)` = a valid attestation of x relayed now.
contract MedianLeaf is SwarmPricePolicy {
    constructor() SwarmFeed(SwarmQuestions.ATTESTER, address(0), 1, 3, 1 hours, 2_000) {}

    function deliver(uint256 target) external {
        _accept(target, uint64(block.timestamp));
    }
}

/// The shipped NHI leaf (SwarmNhiFeed's policy, 1 day, 2,000 bps) with the same door.
contract NhiLeaf is SwarmNhiPolicy {
    constructor() SwarmFeed(SwarmQuestions.ATTESTER, address(0), 1, 3, 1 days, 2_000) {}

    function deliver(uint256 target) external {
        _accept(target, uint64(block.timestamp));
    }
}

/// ProvenPoolPrice's IFeed surface: the pool's price at the end of the proved block, fresh 6 h, `proven()` true.
contract ProvenStub {
    uint256 internal v;
    uint64 internal at;

    function prove(uint256 endOfBlockPrice) external {
        v = endOfBlockPrice;
        at = uint64(block.timestamp);
    }

    function latestValue() external view returns (uint256, uint64) {
        return (v, at);
    }

    function isStale() external view returns (bool) {
        return at == 0 || block.timestamp > uint256(at) + 6 hours;
    }

    function proven() external pure returns (bool) {
        return true;
    }

    function maxAge() external pure returns (uint256) {
        return 6 hours;
    }
}

/// Chainlink ETH/USD stand-in: answers none of the traits.
contract EthUsd {
    function latestValue() external view returns (uint256, uint64) {
        return (2000e18, uint64(block.timestamp));
    }

    function isStale() external pure returns (bool) {
        return false;
    }

    function maxAge() external pure returns (uint256) {
        return type(uint64).max;
    }
}

contract ShareVault {
    function convertToAssets(uint256 s) external pure returns (uint256) {
        return s * 1.1e18 / 1e18;
    }
}

/// sIMD as deployed: median = rate x (swarm median leaf x ETH/USD), spot = rate x (proven pool x ETH/USD), skew 5%, NHI leaf.
abstract contract TwinRig {
    bytes32 internal constant SIMD = "SIMD";
    uint256 internal constant A = 4e15; // wei per IMD
    MedianLeaf internal leaf;
    NhiLeaf internal nhi;
    ProvenStub internal proven;
    IFeed internal median;
    IFeed internal spot;
    Pricer internal pricer;

    function _rig() internal {
        leaf = new MedianLeaf();
        nhi = new NhiLeaf();
        proven = new ProvenStub();
        IFeed eth = IFeed(address(new EthUsd()));
        address vault = address(new ShareVault());
        median = IFeed(address(new RateFeed(vault, ShareVault.convertToAssets.selector, true, new ProductFeed(IFeed(address(leaf)), eth), 0)));
        spot = IFeed(address(new RateFeed(vault, ShareVault.convertToAssets.selector, true, new ProductFeed(IFeed(address(proven)), eth), 0)));
        ParamsStub p = new ParamsStub();
        ParametersBase.Config memory c;
        c.token = address(0xC011);
        c.median = median;
        c.spot = spot;
        c.nhi = IFeed(address(nhi));
        ParametersBase.Risk memory r;
        r.mat = 1.7e18;
        r.skew = 0.05e18;
        p.set(SIMD, c, r);
        pricer = new Pricer(Parameters(address(p)));
        leaf.deliver(A);
        nhi.deliver(0.9e18);
        proven.prove(A);
    }

    function _usd(uint256 weiPerImd) internal pure returns (uint256) {
        return (weiPerImd * 2000e18 / 1e18) * 1.1e18 / 1e18;
    }
}


/// No key. One block end of pool 0xb07d pushed UP and proved: the twin's `: s` arm sets low = high = payout = s with no
/// upper bound, and PricerOracle (the Backstop's nav() and _convert() price) reports it as a good value.
contract ProofTwinUpValueTest is Test, TwinRig {
    function setUp() public {
        vm.warp(1_800_000_000);
        vm.roll(26_000_000);
        _rig();
    }

    function test_pushedUpProofAloneIsReadAsAValue() public {
        vm.warp(block.timestamp + 60);
        proven.prove(A * 10); // one block end pushed 10x, proved (permissionless, any of the last 32 blocks)
        Pricer.Quote memory q = pricer.quote(SIMD);
        emit log_named_decimal_uint("honest median (= attested), USD", _usd(A), 18);
        emit log_named_decimal_uint("low", q.low, 18);
        emit log_named_decimal_uint("high", q.high, 18);
        emit log_named_decimal_uint("payout", q.payout, 18);
        assertTrue(q.priced);
        assertFalse(q.agree);
        PricerOracle oracle = new PricerOracle(pricer, address(this));
        oracle.setIlk(address(0xC011), SIMD);
        (, uint256 high, bool ok) = oracle.priceOf(address(0xC011));
        emit log_named_decimal_uint("PricerOracle.priceOf high (Backstop nav price)", high, 18);
        // Expected: a value reader (Backstop.nav -> _convert share price) never takes a lone pushed proof as a value:
        // either it is flagged unusable, or it stays within skew of the converged median.
        assertTrue(!ok || high <= _usd(A) * 105 / 100, "a lone pushed-up proof is valued by the Backstop at 10x the median");
    }
}
```

### 4. Low: RateFeed.proven()/converged() look only at `underlying`: an attested swarm leaf as the rate source is invisible, so the composite (and a ProductFeed over it) reads proven and converged while the leaf

`src/feeds/RateFeed.sol:104`

```
    function proven() external view returns (bool) {
        return FeedTraits.proven(underlying);
    }
```

Q3 (P4, P5). P4: a composite reports proven only when one input is proven and the other has no attester in its path. ProductFeed checks both inputs (FeedTraits.attesterFree); RateFeed does not: its second input `rateSource` is read through any zero-argument getter, and proven() (:104-106), converged() (:99-101) and isStale() (:94-96) consult `underlying` only. RateFeed(rateSource = a SwarmFeed leaf, selector latestValue) builds, prices at clampedLeaf x provenPrice, and reports proven() = true and converged() = true while the leaf is clamped; ProductFeed(that, Chainlink).proven() is true too, so such a spot gets the twin rule and the 'converged legs only agree' rule from a value one attester key moves. NOT reachable in the shipped graphs (mainnet sIMD rate = SIMD.convertToAssets; 4663 has no proven leg); needs the Safe to add such a feed (48 h), and DeployBase._provenAtDeploy mirrors the same rule so the deploy check would not catch it. SMALLEST FIX: proven() = FeedTraits.proven(underlying) && FeedTraits.attesterFree(IFeed(rateSource)); converged() = FeedTraits.converged(underlying) && FeedTraits.converged(IFeed(rateSource)) (an ERC-4626/wstETH answers neither trait, so shipped feeds read as today), or refuse a rateSource answering converged() in the constructor.

**Reproduction**

leaf = SwarmPricePolicy (1 h, 2,000 bps): set 1e18, set 2e18 -> stored 1.2e18, attested 2e18, converged false. rf = new RateFeed(leaf, IFeed.latestValue.selector, false, provenStub, 1e18). Expected rf.converged() false, rf.proven() false, ProductFeed(rf, plain).proven() false; actual all true. Run: forge test --match-path test/scratch/Proof_2ca441c6e471.t.sol -vv. Output on this commit: [FAIL: an attested input is clamped: must not read converged] test_rateFeed_attestedRateSource_readsProvenAndConverged() (gas: 3964568). Suite result: FAILED. 0 passed; 1 failed.

**Proof**: a Foundry test that fails on this code and passes once it is fixed.

```solidity
// SPDX-License-Identifier: MIT
pragma solidity 0.8.26;

import "forge-std/Test.sol";
import {SwarmFeed} from "src/feeds/SwarmFeed.sol";
import {SwarmPricePolicy} from "src/feeds/SwarmFeeds.sol";
import {RateFeed} from "src/feeds/RateFeed.sol";
import {ProductFeed} from "src/feeds/ProductFeed.sol";
import {IFeed} from "src/interfaces/IFeed.sol";

contract LegDoor is SwarmPricePolicy {
    constructor() SwarmFeed(address(1), address(0), 1, 3, 1 hours, 2000) {}
    function set(uint256 t) external { _accept(t, uint64(block.timestamp)); }
}

/// Stands in for ProvenPoolPrice: answers proven() and no converged().
contract ProvenStub {
    function latestValue() external view returns (uint256, uint64) { return (1e18, uint64(block.timestamp)); }
    function isStale() external pure returns (bool) { return false; }
    function maxAge() external pure returns (uint256) { return 6 hours; }
    function proven() external pure returns (bool) { return true; }
}

/// Stands in for ChainlinkFeed: no trait at all.
contract PlainStub {
    function latestValue() external view returns (uint256, uint64) { return (2000e18, uint64(block.timestamp)); }
    function isStale() external pure returns (bool) { return false; }
    function maxAge() external pure returns (uint256) { return 1 hours; }
}

contract ProofRateFeedTraitsTest is Test {
    function test_rateFeed_attestedRateSource_readsProvenAndConverged() public {
        vm.warp(1_800_000_000);
        LegDoor ratio = new LegDoor();
        ratio.set(1e18);
        ratio.set(2e18); // clamped: stored 1.2, attested 2.0
        assertFalse(ratio.converged());
        RateFeed rf = new RateFeed(address(ratio), IFeed.latestValue.selector, false, IFeed(address(new ProvenStub())), 1e18);
        (uint256 v,) = rf.latestValue();
        assertEq(v, 1.2e18, "the value is the attester's clamped leaf x the proven price");
        ProductFeed pf = new ProductFeed(IFeed(address(rf)), IFeed(address(new PlainStub())));
        assertFalse(rf.converged(), "an attested input is clamped: must not read converged");
        assertFalse(rf.proven(), "P4: an attester is in the path: must not read proven");
        assertFalse(pf.proven(), "P4: the product over it must not read proven");
    }
}
```

### 5. Info: NHI carry lapses at exactly maxAge after the last move: two caps over the CLOSED day [t1, t1+86,400] (P3 holds for half-open windows only); the `>` fix buys one second

`src/feeds/SwarmFeed.sol:555`

```
        if (!_carriesAnchor() || block.timestamp - uint256(_movedAt) >= maxAge) return 0;
```

Q2 (P3, C2). _carryNow drops the carried anchor once block.timestamp - _movedAt >= maxAge. An epoch opened by a move at t1 ends at t1 + maxAge, the same second the carry lapses, so the next epoch opens uncarried and takes a second cap: 0.85 -> 0.68 at t1, -> 0.544 (mat 1.70 -> 2.00) at t1 + 86,400. P3 is stated (and tested in AuditW5NhiWindow) for half-open windows [t, t+maxAge), where it holds; the price legs' P7 is stated for closed windows. Changing to `>` only makes the attacker deliver one second later (t1 + 86,401 opens an uncarried epoch), so the material bound is 'two caps take one maxAge (+1 s)', i.e. mat 1.70 -> 2.00 in one day with the key, not two days as README line 564 once said. Not a defect of the stated half-open property; listed so the closed-window reading is not relied on.

**Reproduction**

SwarmNhiPolicy (1 day, 2,000 bps): 0.85 held > 1 day; at t1 deliver 0.1 -> 0.68; at t1 + 86,400 deliver 0.1 -> 0.544 (expected >= 0.68 for a closed day). forge test --match-path test/scratch/Proof_21198f419d0e.t.sol -vv on this commit: [FAIL: two caps inside one closed day: 544000000000000000 < 680000000000000000] test_twoCapsInsideOneClosedDay() (gas: 2589731), logs t2 - t1: 86400, v2: 544000000000000000.

### 6. Info: Answers to questions 1-4 and claims C1-C4, with the required build/test output

`src/feeds/ProvenPoolPrice.sol:109`

```
        if (block.number - number > PROVE_WINDOW) revert TooOld(number, block.number);
```

BUILD: forge 1.9.0, solc 0.8.26 via_ir (no solar). Required glob on this commit: 11 suites, 48 tests passed, 0 failed (ProvenPoolPrice 13, AuditW4TwinLag 4, AuditW4NhiMat 3, AuditW5NhiWindow 3, AuditW4ProveWindow 4, AuditW4ProvenProduct 4, AuditW4SlidingBound 2, PricerTwin 6, SwarmFeedProperties fuzz 5 + invariant 1, AuditW4TraitNested 3). Proofs were run under test/scratch/ (deleted after) rather than test/unit/, per the output rules. Q1 (P1, P2, P8): P1 and P8 hold on the lower side: a compromised median alone gives low >= s/(1+skew) (m < s reads s; agreement reads min(m,s)); a pushed proof alone never goes below min(m, attested) by more than skew. P2 holds (low = min(m, attested) at the first delivery). They do NOT hold together against a pusher: following the attested median gives back the per-epoch bound to honestly attested pushed reads (HIGH finding), and the `: s` arm has no upper bound (MEDIUM finding, value readers). A stale attested value cannot arise while the median is fresh (every acceptance rewrites _attested). Legs from different moments: the median and spot may lag each other (window median vs one block), which is exactly what lets a pushed window and a pushed block coincide. C1: confirmed with the bound: with the key (attested <= pushed price P) and one pushed block end, low = P exactly; the Pricer adds no floor, so the loss is every sIMD position liquidatable at P (capped by the sIMD line), in the proving transaction (the keeper's 60 s tick is too late for a prove-and-bite). A proof within 1.5% of the live pool can stand ~5 h (keeper rule, off-repo) but is worth at most 1.5% (+ skew inside agreement). Without the key the same bound is reached with 7-8 pushed block ends (HIGH finding). Q2 (P3, P7): P3 as literally worded holds for half-open windows (fuzz in SwarmFeedProperties/AuditW5NhiWindow passes; argument: epoch openings are >= maxAge apart, so a window holds at most one opening and either starts at the new anchor or sees both epochs inside the carried band). Worse than stated: the in-epoch band anchored at the opening value (MEDIUM finding: mat 1.70 -> 2.00 on one attestation after an honest rise; legs +80%/-46.7% in a closed window vs stated +44%/-36%). The after-silence bound (1+2c)(1+c)^2-1 was not exceeded. 4663: one key moves both legs together, converged and agreeing, so the leg bound is the type bound and the loss is bounded by the line (0, then 3,000). C2: confirmed: carried anchor gives P3 for any timing; honest hourly relays reach the level at worst one cap per two epochs (a move later than an epoch's opening costs one held epoch). Carried anchor is the right NHI rule for the window property but not for the step from the held value: the smallest change is the epoch low/high range clamp (MEDIUM finding), which the price legs should take too; the legs should not carry the anchor (it halves honest speed and, for sIMD, adds lag against P2). Q3 (P4, P5): shipped graphs read correctly (mainnet sIMD spot Rate(Product(Proven, Chainlink)) proven and attester-free; median converged iff its leaf is; 4663 IMD legs not proven). RateFeed ignores its rate source's traits (LOW finding, Safe-addable only). P5: no deployed feed found whose empty revert or short success reads converged/attester-free wrongly. Unverified lead (not reproduced by me): SeatSpotLeg.converged() (src/feeds/SeatFeed.sol:326) calls `feed.converged()` directly, so an out-of-gas in SeatFeed bubbles as empty revert data with ~3% of the caller's gas left (> g/63) and FeedTraits._read would read ABSENT = converged; the caller is then left a few hundred gas, so Pricer.quote cannot complete on it. Fix if wanted: read it through FeedTraits. Q4 (P6) and C3: line 109 refuses block.number - number > 32. The keeper proves head-1 built at head H; landing in H+k the distance is k+1, so it is accepted for k <= 31 (31 landing blocks, ~6.2 min of produced blocks; missed slots do not count) and TooOld at k = 32, 33 (AuditW4ProveWindow passes on this commit

**Reproduction**

forge test --match-path 'test/unit/{SwarmFeedProperties,PricerTwin,ProvenPoolPrice,AuditW4TwinLag,AuditW4NhiMat,AuditW4SlidingBound,AuditW4TraitNested,AuditW4ProvenProduct,AuditW4ProveWindow,AuditW5NhiWindow}.t.sol' -> 'Ran 11 test suites in 5.30s (14.97s CPU time): 48 tests passed, 0 failed, 0 skipped (48 total tests)'.

---

Judge's submission `bb6289f6b94ffd38bb52e7af4b97f2c180b28daedda5bb6a4be64093daeb8ce0`, accepted on the IdentityMD network. Acceptance means the report met the job's checks;
it is not a guarantee that the code has no other defects.
