{"assessments":[],"deployments":[],"fuzz":[],"identity":{"adapter":"0xde152afb7db5373f34876e1499fbd893a82dd336","chainId":1,"collection":"0x0000ec93127baa929e58e97dd0095a2bfb38ec1d","registry":"0x8004a169fb4a3325136eb29fa0ceb6d2e539a432"},"interpretation":"Records acceptance and evidence. Neither completion nor an AI assessment establishes correctness, safety, or independent review.","jobId":"3d73817d-9b86-45c4-b371-4e179fb3bb38","kind":"audit","nodes":[{"acceptedSubmissionHash":"4de21345b996a5550756a8bdffc3aeab2e7d1b69f10eb5a818f49f9abd391776","dependsOn":[],"execution":{"network":false,"profile":"foundry","requires":[],"skillHash":"bc5bfc8455464381f2db18badb2b55cf8bec1e535c019349a0378fa990741171","skillId":"audit-specialist","subagents":3,"tools":[]},"key":"audit_economics","kind":"code","role":"review","skillHash":"bc5bfc8455464381f2db18badb2b55cf8bec1e535c019349a0378fa990741171","skillId":"audit-specialist","state":"accepted"},{"acceptedSubmissionHash":"ff41f3ce38f7c69ec185a02cffeffcc35f8fc6fdfee3203ce4993263d6ce89a5","dependsOn":[],"execution":{"network":false,"profile":"foundry","requires":[],"skillHash":"bc5bfc8455464381f2db18badb2b55cf8bec1e535c019349a0378fa990741171","skillId":"audit-specialist","subagents":3,"tools":[]},"key":"audit_flow","kind":"code","role":"review","skillHash":"bc5bfc8455464381f2db18badb2b55cf8bec1e535c019349a0378fa990741171","skillId":"audit-specialist","state":"accepted"},{"acceptedSubmissionHash":"51e58170b83810861a0ec831f89c9816ed9e53e685b3143b6da2716c1a2eaf86","dependsOn":["audit_math","audit_permissions","audit_economics","audit_flow"],"execution":{"network":false,"profile":"foundry","requires":[],"skillHash":"b89279670f5a00f5d26286edee00c97dd158b997031350a01cafe6e0329ad227","skillId":"audit-judge","subagents":4,"tools":[]},"key":"audit_judge","kind":"code","role":"review","skillHash":"b89279670f5a00f5d26286edee00c97dd158b997031350a01cafe6e0329ad227","skillId":"audit-judge","state":"accepted"},{"acceptedSubmissionHash":"25a41423f0c34d838b8bbf0244419a12e05ef6478bbe24d0a2b09f897e0bdad1","dependsOn":[],"execution":{"network":false,"profile":"foundry","requires":[],"skillHash":"bc5bfc8455464381f2db18badb2b55cf8bec1e535c019349a0378fa990741171","skillId":"audit-specialist","subagents":3,"tools":[]},"key":"audit_math","kind":"code","role":"review","skillHash":"bc5bfc8455464381f2db18badb2b55cf8bec1e535c019349a0378fa990741171","skillId":"audit-specialist","state":"accepted"},{"acceptedSubmissionHash":"ef0b8f2b51b66e56ae01762ec030144335446b94c507487a900ca4d3c2225dac","dependsOn":[],"execution":{"network":false,"profile":"foundry","requires":[],"skillHash":"bc5bfc8455464381f2db18badb2b55cf8bec1e535c019349a0378fa990741171","skillId":"audit-specialist","subagents":3,"tools":[]},"key":"audit_permissions","kind":"code","role":"review","skillHash":"bc5bfc8455464381f2db18badb2b55cf8bec1e535c019349a0378fa990741171","skillId":"audit-specialist","state":"accepted"}],"objective":"Audit src/seats/SeatJoin.sol, src/seats/SeatAccount.sol, src/feeds/SeatFeed.sol, at the pinned commit, for a capped mainnet beta. Read whatever else in src/ these depend on, but report on this scope.\n\nimdUSD v2 is a multi-collateral CDP stablecoin; this is its capped mainnet beta on Ethereum. Positions are NFT ids; borrowers set their own interest rate and redemptions take from the lowest rates first; liquidation is mark then bite, with a standing bid from Backstop sleeves; the peg pool is a Uniswap v4 pool with our own hook; prices come from Chainlink and from swarm-attested feeds (EIP-712 attestations bound to pinned questions). README.md gives the scope, the key invariants, the trust model and the known issues: read it first.\n\nBUILD AND TEST (required; Foundry, solc 0.8.26 via_ir per foundry.toml). Never build or test the whole project: with every suite it needs about 49 GB and the compiler will be killed. Run only this panel's tests: `forge test --match-path 'test/unit/{Seats,ReviewSeats,SeatDigest,PanelSeatTransfer}.t.sol'` (measured: about 3.0 GB peak, 5 minutes). One build at a time on your machine. Write each proof as a new file test/unit/Proof<Name>.t.sol, add it to the glob and run it; paste it with its output into the finding, then delete it: your submission must leave the tree unchanged. With Foundry 1.9 or later, `forge test --use solar --no-match-path 'test/fork/*'` builds everything and runs all 1,179 tests in seconds under 1 GB (Solar accepts a little syntax solc refuses: confirm a proof with the solc command).\n\nAnswer each numbered question, including the ones where nothing is wrong:\n1. CUSTODY (deposit, withdraw, holderOf, units per holder, onPositionTransfer, rescue, the holder-bound rule). Take a seat you do not own, or count units twice.\n2. AUCTION (open, take, takeFloor, reopen, cancel; the priced clock _elapsed, AUCTION_LIFE, the decay). Sell below the intended price, block a sale, or settle the wrong debt.\n3. SEAT ACCOUNT (ERC-1271 pairing, custodyEpoch, send and SEND_GAS, registerAgent, release). A worker authorisation that survives a change of custody, or a signature that can be misused.\n4. REWARDS (onRewards, owed, collect, yieldFee, lastHolder). Credit rewards to the wrong holder, or create a credit with nothing behind it.\n5. SEAT FEED (the fall cap, poke, the ring, median30dAgo, trend and factor). Move the seat price faster than the caps allow.\n\nNot findings: anything listed under README.md 'Known issues and accepted risks' (say so if you find it worse than written); src/bridge, src/dex, src/earn/LoopVault.sol and src/stocks (after the beta) unless a question names them; test/ and its mocks; gas optimisations unless they change behaviour.\n\nFor every finding: severity by impact; file, line and the lines copied; the call sequence from an external caller; a concrete failing input or state with expected against actual; whether it is reachable with the values in script/DeployConfig.sol (BetaConfig); the smallest fix; and a Foundry test that fails on this commit, RUN as BUILD says and pasted in full in the finding with its output (the judge reruns it). The test/ tree has harnesses to reuse (test/utils/System.sol, the unit suites). Answer every numbered question, including those where nothing is wrong. Give a coverage row (holds, finding or unreached, with a reason) for every external function of the contracts in scope. Also report every comment or NatSpec that claims a property the code does not have.","parentJobId":null,"planHash":"c57e1c7687d8f93c5a1365b04702f6eb6b04f57051866acab6860b1ebde4ca85","previousHash":"0000000000000000000000000000000000000000000000000000000000000000","projectId":"3d73817d-9b86-45c4-b371-4e179fb3bb38","publication":{"commit":null,"deliveredAt":null,"repoUrl":null},"receiptIdentity":{"adapter":"0xde152afb7db5373f34876e1499fbd893a82dd336","chainId":1,"collection":"0x0000ec93127baa929e58e97dd0095a2bfb38ec1d","registry":"0x8004a169fb4a3325136eb29fa0ceb6d2e539a432"},"registry":"0xb6d0a187b050fa5bb0b87033a203f37becf4a775","research":[],"schema":"identitymd-work-v1","signals":[{"agentId":"51445","feedbackHash":"ce8475ed794a9938002ce3a4fa65c85bcab0b217dabcfce77bfcb970786a31f3","nodeKey":"audit_economics","submissionHash":"4de21345b996a5550756a8bdffc3aeab2e7d1b69f10eb5a818f49f9abd391776","tag1":"review:submission","tag2":"acceptance-v2","value":1},{"agentId":"51166","feedbackHash":"c355527864b263e6b67e8222b1d664579d0e4959af46c5fea4e122fdce44a265","nodeKey":"audit_flow","submissionHash":"ff41f3ce38f7c69ec185a02cffeffcc35f8fc6fdfee3203ce4993263d6ce89a5","tag1":"review:submission","tag2":"acceptance-v2","value":1},{"agentId":"51196","feedbackHash":"f6e40b7eb8ea41af8407664a09d1f2a70d93e1ba4dcff0788182b6621235d825","nodeKey":"audit_judge","submissionHash":"51e58170b83810861a0ec831f89c9816ed9e53e685b3143b6da2716c1a2eaf86","tag1":"review:submission","tag2":"acceptance-v2","value":1},{"agentId":"56223","feedbackHash":"090d98d3fbcfe4ffa7597e189d8f045c85b7228e9a3d19368d6ca247c26476be","nodeKey":"audit_math","submissionHash":"25a41423f0c34d838b8bbf0244419a12e05ef6478bbe24d0a2b09f897e0bdad1","tag1":"review:submission","tag2":"acceptance-v2","value":1},{"agentId":"52270","feedbackHash":"5f89c83670f4b6818e6fb617b5b91a0de4b71104957e623da28ead50170f3517","nodeKey":"audit_permissions","submissionHash":"ef0b8f2b51b66e56ae01762ec030144335446b94c507487a900ca4d3c2225dac","tag1":"review:submission","tag2":"acceptance-v2","value":1}],"site":null,"snapshotHash":"9e781d62492932cb8b9fe293a5a2702957567ddc27656450fbd5b9062ea4aeaa","state":"completed","submissions":[{"artifacts":[],"attempt":1,"bundleHash":null,"device":"827807b8669e0154","findings":[{"citation":"resolved","description":"SeatJoin._elapsed (src/seats/SeatJoin.sol:459-480) reconstructs the auction's PRICED time from the median attestation's `updatedAt`. For a swarm leaf that value is the attestation's `issuedAt` (SwarmFeed._accept sets `_updatedAt = a.issuedAt`), and SwarmFeed.submitAttestation accepts an attestation as long as `issuedAt` is within `maxAge` of now (26 h in BetaConfig, SEAT_MAX_AGE): a relayer may hold one for up to 26 h before relaying it. _elapsed treats the whole window [newAt, newAt + life] as priced (line 470 in the no-gap branch; lines 476-477 `from2 = max(from, newAt)` in the gap branch), although the chain was STALE between the old window's end and the relay. During that stale interval no sale can settle (Liquidator.settle -> _requireUnhealthy needs `priced`, Pricer.quote returns priced=false on a stale median), so the design says the clock pauses. Once the held attestation lands, the paused hours are added at once: the Dutch price jumps to the floor (AUCTION_TIME is 6 h) and the auction is still inside AUCTION_LIFE (24 h), so the relayer takes at 0.7 x start instead of the price the priced time justified. The surplus the borrower should have received (take sends `left - penalty` to the owner, line 594) is lost to the taker. With BetaConfig: a 3-seat position at a $4,000 median loses up to 0.25 x 3 x $4,000 = $3,000; the taker needs only the imdUSD for n x price and a bought attestation. The NatSpec at lines 456-457 ('the clock only ever runs slow, never fast') and the header at lines 53-54 ('a missed daily refresh pauses the sale instead of running it to the floor unseen') claim the opposite. Call sequence: Liquidator.bite(id) -> SeatJoin.open (attestation A0 issued 25 h ago, fresh 1 h more); chain unpriced from T0+1h; attacker buys an attestation at T0+1h and holds it; at T0+11h attacker calls median.submitAttestation(A1) then SeatJoin.take(id, floorPrice) in one transaction. Reachable in BetaConfig: yes (seat type on, SEAT_MAX_AGE 26 h > AUCTION_LIFE 24 h, daily refreshes leave a 2 h slack; any late refresh opens the window). Smallest fix: count the new attestation's window from the time it was RELAYED, not issued: expose SwarmFeed's `_acceptedAt` (an `acceptedAt()` view, surfaced through SeatFeed) and in _elapsed use `max(newAt, acceptedAt)` as the start of the new window (and in `_tick` record it), so stale hours before the relay are never counted; alternatively record in `open`/`tick` the feed's `isStale()` transitions. The test below encodes the fix's expectation through the mock's `acceptedAt`.","line":470,"path":"src/seats/SeatJoin.sol","proof":"// SPDX-License-Identifier: MIT\npragma solidity 0.8.26;\n\nimport {Test} from \"forge-std/Test.sol\";\nimport {IERC721} from \"@openzeppelin/contracts/token/ERC721/IERC721.sol\";\nimport {SeatJoin} from \"src/seats/SeatJoin.sol\";\nimport {IImdAgentAdapter} from \"src/seats/SeatAccount.sol\";\nimport {SeatFeed} from \"src/feeds/SeatFeed.sol\";\nimport {IFeed} from \"src/interfaces/IFeed.sol\";\nimport {ParametersBase} from \"src/ParametersBase.sol\";\n\n/// @dev A swarm leaf as SeatJoin sees it: `latestValue` returns the attestation's `issuedAt` (SwarmFeed sets\n/// `_updatedAt = a.issuedAt`, and accepts an attestation up to `maxAge` after it was issued). `acceptedAt` is the\n/// block time of the relay (SwarmFeed keeps it privately as `_acceptedAt`): what a fix needs to read.\ncontract MockLeaf is IFeed {\n    uint256 public value;\n    uint64 public updatedAt;\n    uint64 public acceptedAt;\n    uint256 public figure;\n    uint256 public immutable maxAge;\n\n    constructor(uint256 maxAge_) {\n        maxAge = maxAge_;\n    }\n\n    function set(uint256 v, uint64 issuedAt) external {\n        value = v;\n        updatedAt = issuedAt;\n        acceptedAt = uint64(block.timestamp);\n    }\n\n    function setFigure(uint256 f) external {\n        figure = f;\n    }\n\n    function latestValue() external view returns (uint256, uint64) {\n        return (value, updatedAt);\n    }\n\n    function isStale() external view returns (bool) {\n        return value == 0 || block.timestamp > uint256(updatedAt) + maxAge;\n    }\n\n    function latestFigure() external view returns (uint256) {\n        return figure;\n    }\n}\n\ncontract MockParams {\n    ParametersBase.Config internal _c;\n    address public governor = address(0xA11CE);\n\n    function setMedian(IFeed m) external {\n        _c.median = m;\n    }\n\n    function config(bytes32) external view returns (ParametersBase.Config memory) {\n        return _c;\n    }\n}\n\ncontract MockLedger {\n    address public params;\n    address public treasury;\n    address public token;\n    address public liquidator;\n\n    constructor(address p, address t, address tok, address l) {\n        params = p;\n        treasury = t;\n        token = tok;\n        liquidator = l;\n    }\n}\n\n/// @notice SeatJoin._elapsed counts the new attestation's window from its `issuedAt`, which SwarmFeed lets a relayer\n/// hold for up to `maxAge` (26 h in BetaConfig) before relaying. Hours in which the chain was STALE (no sale could\n/// settle: Liquidator.settle requires `priced`) are then counted as priced time once the held attestation lands,\n/// so the Dutch clock jumps and the sale is takeable at the floor, against the documented pause.\ncontract ProofSeatClockTest is Test {\n    uint256 constant T0 = 1_800_000_000;\n    address constant LIQUIDATOR = address(0x11);\n    address constant MARKER = address(0x22);\n\n    MockLeaf median;\n    MockLeaf spot;\n    MockLeaf eth;\n    SeatFeed feed;\n    SeatJoin join;\n\n    function setUp() public {\n        vm.warp(T0);\n        median = new MockLeaf(26 hours); // SEAT_MAX_AGE in BetaConfig\n        spot = new MockLeaf(26 hours);\n        eth = new MockLeaf(365 days);\n        // The median attestation live at the opening was issued 25 h ago: fresh for one more hour.\n        median.set(1e18, uint64(T0 - 25 hours));\n        median.setFigure(100);\n        spot.set(1e18, uint64(T0));\n        eth.set(3000e18, uint64(T0));\n        feed = new SeatFeed(median, spot, eth);\n        MockParams params = new MockParams();\n        params.setMedian(IFeed(address(feed)));\n        MockLedger ledger = new MockLedger(address(params), address(0x33), address(0x44), LIQUIDATOR);\n        join = new SeatJoin(\"SEAT\", IERC721(address(0x55)), IImdAgentAdapter(address(0x66)), address(this), 25, 3);\n        join.wire(address(ledger));\n    }\n\n    function test_heldAttestationRunsTheAuctionClockThroughStaleHours() public {\n        vm.prank(LIQUIDATOR);\n        join.open(1, MARKER);\n        uint256 start = join.price(1);\n        assertEq(start, 3000e18);\n\n        // One priced hour, then ten hours in which the median leg is stale on chain: no take can settle.\n        vm.warp(T0 + 11 hours);\n        assertTrue(feed.isStale());\n        assertEq(join.elapsed(1), 1 hours, \"while stale the clock is paused, as documented\");\n\n        // A relayer now relays an attestation ISSUED at T0 + 1 h (10 h old, inside SwarmFeed's maxAge) and takes in\n        // the same transaction. The chain was unpriced for those ten hours.\n        median.set(1e18, uint64(T0 + 1 hours));\n        assertFalse(feed.isStale());\n        assertFalse(join.expired(1), \"11 h < AUCTION_LIFE: the auction is takeable\");\n\n        // Expected: 1 h of priced time, price 0.95 x start. Actual on this commit: 11 h, the floor (0.7 x start).\n        assertEq(join.elapsed(1), 1 hours, \"priced time must not include the hours the chain was stale\");\n        assertEq(join.price(1), start * 95 / 100, \"the sale must not be at the floor\");\n    }\n}","reproduction":"State: auction opened at T0 with the median attestation issued at T0-25h (maxAge 26 h), ETH/USD 3000, median 1e18 wei: start price 3000e18. At T0+11h the median leg is stale (since T0+1h); SeatJoin.elapsed(1) = 3600 (correct, paused). Relay an attestation issued at T0+1h (10 h old, accepted by SwarmFeed). Expected: elapsed(1) = 3600, price(1) = 2850e18 (0.95 x start), expired(1) = false. Actual: elapsed(1) = 39600 (11 h), price(1) = 2100e18 (the 0.7 floor), expired(1) = false, so take(1, 2100e18) settles 3 seats at $2,100 each. forge test --match-path 'test/{unit/Seats,unit/ReviewSeats,unit/SeatDigest,unit/PanelSeatTransfer,scratch/ProofSeatClock,scratch/ProofSeatFigure}.t.sol' (solc 0.8.26 via_ir, Foundry 1.8.3; 5m04s). Output: 'Ran 6 test suites in 10.07s: 139 tests passed, 2 failed' (the 4 panel suites: 139 passed, 0 failed). Failing: test/scratch/ProofSeatClock.t.sol:ProofSeatClockTest [FAIL: priced time must not include the hours the chain was stale: 39600 != 3600] test_heldAttestationRunsTheAuctionClockThroughStaleHours() (gas: 391406).","severity":"medium","snippet":"            uint256 end = Math.min(t, Math.max(freshUntil, uint256(newAt) + life));","title":"Auction clock counts stale hours as priced time when a held attestation is relayed: a sale reaches the floor during a pause (Q2)"},{"citation":"resolved","description":"SeatFeed.latestValue (line 237) prices the type as `acceptedMedian x ethUsd x factor`, factor = liquidity x trend. The wei median is guarded twice against a one-step fall (SwarmFeed's per-epoch deviation cap, 30% in BetaConfig, and SeatFeed's MAX_FALL_PER_UPDATE_BPS 20% at lines 131-134), and trend is derived from the capped median so it also falls at most 20% per attestation. `liquidity()` (lines 167-170) is `min(1, figure / 100)` read straight from the median leaf's `latestFigure()`: SwarmSeatFeed._onFigure (src/feeds/SwarmFeeds.sol:111-113) stores the signed figure with no bound, SwarmFeed's deviation check covers only the answer. One attestation whose figure drops from 100 to 20 while its price answer is unchanged moves the type's price from 3000e18 to 600e18 (-80%) in one step; a figure of 1 gives -99%. Pricer.quote reads this value as `low` for liquidation health (both legs carry the same factor, so `agree` holds and the type stays priced), so every seat position above 20% of its LTV headroom is unhealthy at once: at mat 250% a borrower at 60% of the maximum debt (CR 417%) is liquidatable after one attestation. The README trust model states a compromised attester 'can move those feeds within the cap per epoch'; the figure is the exception. It is also reachable without a bad attester: the figure is a 7-day count of distinct seats sold, and a burst of sales ageing out of the window drops it in one daily attestation. Call sequence (external caller): median.submitAttestation(attestation with the same answer and figure 20) -> Liquidator.bark(id) -> bite after the lull -> SeatJoin.open at the (uncapped) median; no step needs any privilege beyond an attestation. Reachable in BetaConfig: yes (seat type on, SEAT_MEDIAN_CAP_BPS 3000 caps the answer only). Smallest fix: apply the same per-update cap to the figure that `_capped` applies to the median, i.e. record the accepted liquidity in `Cap` and let `liquidity()` fall at most MAX_FALL_PER_UPDATE_BPS per new attestation (rises pass through, as for the median), so the type's price obeys one bound; or bound the figure's step in SwarmSeatFeed._onFigure.","line":169,"path":"src/feeds/SeatFeed.sol","proof":"// SPDX-License-Identifier: MIT\npragma solidity 0.8.26;\n\nimport {Test} from \"forge-std/Test.sol\";\nimport {SeatFeed} from \"src/feeds/SeatFeed.sol\";\nimport {IFeed} from \"src/interfaces/IFeed.sol\";\n\n/// @dev A swarm seat leaf as SeatFeed reads it: a value with its `issuedAt`, and the signed `figure` (distinct seats\n/// sold), which SwarmFeed stores without any bound (SwarmSeatFeed._onFigure).\ncontract MockSeatLeaf is IFeed {\n    uint256 public value;\n    uint64 public updatedAt;\n    uint256 public figure;\n    uint256 public immutable maxAge;\n\n    constructor(uint256 maxAge_) {\n        maxAge = maxAge_;\n    }\n\n    function set(uint256 v, uint64 at, uint256 f) external {\n        value = v;\n        updatedAt = at;\n        figure = f;\n    }\n\n    function latestValue() external view returns (uint256, uint64) {\n        return (value, updatedAt);\n    }\n\n    function isStale() external view returns (bool) {\n        return value == 0 || block.timestamp > uint256(updatedAt) + maxAge;\n    }\n\n    function latestFigure() external view returns (uint256) {\n        return figure;\n    }\n}\n\n/// @notice SeatFeed caps the wei median at a 20% fall per attestation (MAX_FALL_PER_UPDATE_BPS) and SwarmFeed caps\n/// the attested value per epoch (30% in BetaConfig), but the `liquidity` term (figure / 100) multiplies the price\n/// with no cap at all: one attestation whose figure falls from 100 to 20 moves the type's price by -80%.\ncontract ProofSeatFigureTest is Test {\n    uint256 constant T0 = 1_800_000_000;\n\n    function test_oneAttestationMovesThePriceFurtherThanTheFallCap() public {\n        vm.warp(T0);\n        MockSeatLeaf median = new MockSeatLeaf(26 hours);\n        MockSeatLeaf spot = new MockSeatLeaf(26 hours);\n        MockSeatLeaf eth = new MockSeatLeaf(365 days);\n        median.set(1e18, uint64(T0 - 1 hours), 100); // 100 distinct seats sold: liquidity = 1\n        spot.set(1e18, uint64(T0 - 1 hours), 100);\n        eth.set(3000e18, uint64(T0), 0);\n        SeatFeed feed = new SeatFeed(median, spot, eth);\n        feed.poke();\n        (uint256 before,) = feed.latestValue();\n        assertEq(before, 3000e18);\n\n        // The next attestation carries the SAME median price (every price cap passes it untouched) and figure 20.\n        median.set(1e18, uint64(T0), 20);\n        feed.poke();\n        (uint256 after_,) = feed.latestValue();\n        // Expected: no leg of the seat price moves more than the 20% fall cap in one attestation.\n        // Actual on this commit: 600e18, a fall of 80% in one step.\n        assertGe(after_, before * 80 / 100, \"one attestation moved the seat price past the 20% fall cap\");\n    }\n}","reproduction":"State: SeatFeed over a median leaf at 1e18 wei with figure 100, spot 1e18, ETH/USD 3000e18, cap recorded by poke(): latestValue() = 3000e18. Next attestation: answer 1e18 (unchanged: every price cap passes it), figure 20. Expected: no single attestation moves the seat price more than 20% (the documented cap). Actual: latestValue() = 600e18, a fall of 80%. forge test --match-path 'test/{unit/Seats,unit/ReviewSeats,unit/SeatDigest,unit/PanelSeatTransfer,scratch/ProofSeatClock,scratch/ProofSeatFigure}.t.sol' (solc 0.8.26 via_ir, Foundry 1.8.3; 5m04s). Output: 'Ran 6 test suites in 10.07s: 139 tests passed, 2 failed' (the 4 panel suites: 139 passed, 0 failed). Failing: test/scratch/ProofSeatFigure.t.sol:ProofSeatFigureTest [FAIL: one attestation moved the seat price past the 20% fall cap: 600000000000000000000 < 2400000000000000000000] test_oneAttestationMovesThePriceFurtherThanTheFallCap() (gas: 2398215).","severity":"medium","snippet":"        return Math.min(1e18, Math.mulDiv(n, 1e18, FULL_LIQUIDITY));","title":"The liquidity term (attested figure) moves the seat price with no cap: one attestation can cut it 80% past the 20% fall cap and the 30% epoch cap (Q5)"},{"citation":"resolved","description":"The header (lines 47-53) says a missing poke only makes a fall 'capped harder (the leg falls slower), never looser', and the constructor comment (lines 96-98) says an empty median at deployment means 'the first attestation relayed is accepted raw'. With cap == (base 0, raw 0, at 0), acceptedMedian() is `_capped(m, _capped(0, 0))` = m for EVERY attestation until someone calls poke(): `_capped(raw, 0)` returns raw because the lowest bound is 0. The beta deploys the seat leaves EMPTY (script/DeployConfig.sol:657, 'Deployed with EMPTY legs') and nothing in script/deploy pokes SeatFeed, so from genesis until the first permissionless poke the 20% fall cap does not exist: an attestation sequence 1e18, 0.5e18 reads 0.5e18 (expected 0.8e18), and the auction's opening price (SeatJoin._open reads medianUsd) follows it. Once poked, the state is anchored and the cap works as described. Reachable in BetaConfig: yes, for the window before the first poke. Smallest fix: have the deploy's relay step call `seatFeed.poke()` (StageGenesis) and document that the cap starts at the first poke; or, in acceptedMedian, when `c.at == 0` treat the live reading as its own base so the first UNPOKED step is capped too, with SeatJoin._open/tick calling poke() so the state is written whenever an auction reads the feed.","line":120,"path":"src/feeds/SeatFeed.sol","reproduction":"State: SeatFeed deployed while the median leaf is empty (cap = 0,0,0), no poke. Relay attestation A1 = 1e18 at t1, then A2 = 0.5e18 at t2 > t1 with no poke between. Expected (per lines 35-38 and 50-53): acceptedMedian() = 0.8e18. Actual: acceptedMedian() = 0.5e18 (t2 > 0, _capped(0.5e18, _capped(0, 0)) = 0.5e18). After one poke() between A1 and A2 the result is 0.8e18. No proof attached (low).","severity":"low","snippet":"        return t > c.at ? _capped(m, _capped(c.raw, c.base)) : _capped(m, c.base);","title":"Fall cap is inert until the first poke: with an empty Cap every attestation is accepted raw, not only the first (Q5)"},{"citation":"resolved","description":"The ring stores medianUsd() (wei median x ETH/USD) and trend() divides today's USD median by the USD median 30 days ago. With a flat wei median and ETH/USD down 30%, latestValue() = wei x 0.7 ETH x trend 0.7 = 0.49 of the previous USD value: the ETH move is in the price once through ethUsd and again through trend. The header documents the ring as 'the raw USD median', so this is the stated design, but the README frames the trend as the seat market's trend. Not a defect by the code's own specification; reported so the requester can decide whether the ring should hold the wei median instead (one-line change in poke: store acceptedMedian(), and in trend compare acceptedMedian() to it).","line":205,"path":"src/feeds/SeatFeed.sol","reproduction":"Ring slot 30 days ago: 3000e18 (1e18 wei x 3000). Today: median 1e18 wei, ETH/USD 2100e18. Expected by a seat-market reading: trend 1 (the seat did not fall in ETH). Actual: trend = 2100/3000 = 0.7e18, latestValue = 2100e18 x 0.7 = 1470e18.","severity":"info","snippet":"        return Math.min(1e18, Math.mulDiv(now_, 1e18, past));","title":"Trend term is computed in USD, so an ETH/USD fall is applied twice to the seat price (documented, flagged for the design)"},{"citation":"resolved","description":"ANSWERS. Q1 CUSTODY: holds. deposit pulls the NFT with nft.transferFrom(msg.sender, account, id) so only the token's owner can deposit (an approved operator reverts at the collection), and checks ownerOf == account; withdraw needs holderOf == msg.sender and burns one UNIT from the wallet (seats are fungible within a holder by design, so withdrawing a pledged seat while an unpledged one stays is intended); onPositionTransfer is onlyLedger and admits within perBorrower; rescue is governor-only, refuses the account's own deposited seat (holderOf != 0) and SeatAccount.rescue refuses its own tokenId; the holder-bound rule in Ledger._adjust (in only from the owner, out only to the owner) keeps units with their holder. Units cannot be counted twice: _settle retires exactly n x UNIT (pool set to poolBefore - n x UNIT, treasury and marker balances restored, totalSupply -= n x UNIT) and takeFloor mints n x UNIT to the Treasury against the n seats it _assigns; seatCount moves only at deposit/withdraw/take and across the Treasury boundary. The IDMD collection (0x0000eC93127BAA929E58E97dd0095A2BFb38ec1D, checked by cast code) has no transfer(address,uint256) selector, so sync(address(nft)) + collect cannot move the NFT through SeatAccount.send. Q2 AUCTION: FINDING (medium, held attestation runs the clock through stale hours). Otherwise holds: _price is linear from startPrice to 0.7 x startPrice over 6 h of priced time (mulDiv, no overflow: startPrice uint176, run <= 6 h); take pays n x p, Liquidator.settle re-checks unhealthy and liquidatePosition's `paid = seized x price / 1e18` equals n x p exactly (collateral is whole units), so repaid/bad/penalty are settled on the right debt at the right chop (the position's bound version, params.liqRisk); takeFloor requires run >= AUCTION_TIME, raw spot fresh and >= p, and budget; open refuses a live auction and replaces an expired one; reopen at the floor needs a strictly newer attestation (at > startAt) and on an expired auction needs priced and unhealthy; cancel needs healthy or no debt. Boundary: AUCTION_LIFE 24 h < SEAT_MAX_AGE 26 h, so an auction opened on a fresh attestation always expires before that attestation goes stale (no silent pause then). Q3 SEAT ACCOUNT: holds. authorizeWorker is onlyHolder, binds wallet == this account, tokenId, expiry and ownership, stores epoch = custodyEpoch; isValidSignature is VALID only for a stored, unexpired digest of the current epoch while the account owns the seat; every custody change bumps the epoch (release: withdraw/take/rescue-own; bump: _assign on onPositionTransfer, takeFloor, Treasury transfer), so no authorisation survives a change of custody. send is onlyJoin with SEND_GAS 1,000,000 and strict return decoding; registerAgent is onlyHolder and once (an adapter returning 0 would allow a second call: info). Q4 REWARDS: holds. onRewards accepts only the seat's own account and credits holderOf, else lastHolder (set in _unlist), else the Treasury; sync reports only balance above `reported`; send lowers `reported` by what leaves, so a credit always has balance behind it for a well-behaved token (a hostile token can only credit itself); collect zeroes the credit before paying and takes yieldFee in kind to the Treasury (0 on the Treasury's own); custody never walks reward tokens. Q5 SEAT FEED: FINDING (medium, the figure/liquidity term is uncapped) and FINDING (low, the cap is inert before the first poke). Otherwise holds: _capped bounds a fall at 20% of the accepted base; equal-issuedAt replacements keep the base; the ring stores the first value of a day, slots reuse after 32 days, median30dAgo prefers the exact 30-day slot, then the newest point >= 30 days old, then the oldest point (conservative); trend never exceeds 1; factor = liquidity x trend. \n\nCOVERAGE (function: status, reason). SeatJoin: wire holds (wirer once); token holds; setLimits holds (onlyParams); setClaimRule holds (onlyParams); recallBudget holds (governor, moves only idle imdUSD to th","line":64,"path":"src/seats/SeatJoin.sol","reproduction":"Not a defect; the coverage rows and answers above are the deliverable for the questions where nothing is wrong.","severity":"info","snippet":"contract SeatJoin is TransientReentrancyGuard, IHolderJoin, IAuctionJoin {","title":"Numbered answers, coverage rows for every external function in scope, and NatSpec claims the code does not have"}],"hash":"25a41423f0c34d838b8bbf0244419a12e05ef6478bbe24d0a2b09f897e0bdad1","nodeId":"fbe6188f-59e9-4d06-8f69-cf7173a92e7e","outcome":"completed","summary":"The review is complete. The findings file is written at `.imd-findings.json`, the scratch tests are deleted, and `src`, `test` and `script` are unchanged.\n\n**What I found** (two substantiated defects with proofs, one low, two info entries):\n\n- **Medium, auction clock runs fast on a held attestation** at `src/seats/SeatJoin.sol:470`. A relayer may hold a swarm attestation up to 26 hours before relaying it, and `_elapsed` counts priced time from the attestation's `issuedAt`. Hours in which the chain was stale, when no sale could settle, are added to the Dutch clock at the relay, so the sale is takeable at the 0.7 floor instead of the price the priced time justified. The borrower loses the surplus, up to about $3,000 on a 3-seat beta position. The NatSpec \"the clock only ever runs slow, never fast\" is false. Proof attached: expected 1 hour elapsed, actual 11 hours.\n- **Medium, uncapped liquidity term** at `src/feeds/SeatFeed.sol:169`. The signed figure (distinct seats sold) multiplies the price with no bound, so one attestation with an unchanged price answer and a figure falling from 100 to 20 cuts the seat price 80%, past both the 20% fall cap and the 30% epoch cap. Proof attached: expected at least 2400e18, actual 600e18.\n- **Low, fall cap inert before the first poke** at `src/feeds/SeatFeed.sol:120`. With an empty cap state every attestation is accepted raw, not only the first. The beta deploys with empty legs and no deploy stage pokes the feed.\n- **Info** on the USD-denominated trend double counting ETH moves, and one entry holding the answers to the five numbered questions, a coverage row for every external function of the three contracts, and six NatSpec or README claims the code does not meet.\n\n**Checks run.** One solc build of the four panel suites plus the two proofs, about five minutes. The panel's 139 tests passed and both proofs failed as predicted. I also confirmed against mainnet that the IDMD collection has no ERC-20 style `transfer(address,uint256)`, which closes the lead that syncing the NFT itself as a reward token could move it. No fork suite, Slither or extra fuzzing ran.\n\nCustody, the ERC-1271 pairing and epoch logic, the settle accounting, and the rewards credit path all hold on this commit. The clock fix needs the swarm feed to expose its relay time, which is a small cross-contract change the requester should decide on.","treeHash":null,"usage":{"cachedInputTokens":1661448,"cost":{"source":"runtime","usdMicros":6407383},"inputTokens":450,"model":"claude-fable-5-1","outputTokens":58875,"runtime":"claude","turns":30,"wallClockMs":1082009}},{"artifacts":[],"attempt":1,"bundleHash":null,"device":"fa8fc4653a9e883d","findings":[{"citation":"resolved","description":"AUCTION (question 2). `_elapsed` (SeatJoin.sol:459-480) reconstructs priced seconds from the median leaf's `updatedAt`, which SwarmFeed sets to the attestation's SIGNED `issuedAt` (SwarmFeed.sol:324 `_accept(value, a.issuedAt)`), not to the block in which it was relayed. When the on-chain median has aged out (`isStale`), `take`, `takeFloor` and `reopen` all revert `NotPriced` through `Liquidator.settle -> _requireUnhealthy`, so nobody can buy. If an attestation signed during that stale window (anyone may buy one from the plane; relaying is permissionless) is relayed k hours later, the gap branch at line 476-478 counts [issuedAt, now) as priced: the clock jumps by the whole hold in the relay's block. With the beta values (SEAT_MAX_AGE 26 h, AUCTION_TIME 6 h) an auction opened against a 25-hour-old attestation runs 1 priced hour, pauses, and a relay of an attestation issued 10 minutes into the gap, 6 hours later, puts the clock at 6h50m: the price falls from 95% to the 70% floor (3,040 -> 2,240 USD per seat in the proof) in one block, and the relayer can `take` at the floor in the same transaction. The borrower loses up to 30% of the capped median per seat that a visible Dutch decay would have recovered; `takeFloor` (the Treasury's purchase) can be triggered the same way. This contradicts the NatSpec at SeatJoin.sol:53-54 ('a missed daily refresh pauses the sale instead of running it to the floor unseen') and SeatJoin.sol:456-457 ('the clock only ever runs slow, never fast'). The ETH/USD leg is not reconstructed at all (documented at 457-458), so a Chainlink ETH/USD outage decays the price unseen in the same way. Reachable with script/DeployConfig.sol BetaConfig (SEAT_MAX_AGE = 26 hours; attestations are daily so the live attestation at a bite is routinely 20+ hours old). Precondition: the daily refresh is late (the chain is stale for some hours) and a relayer holds an attestation issued during the gap. Smallest fix: count a newly landed attestation's window from the moment the chain first saw it, not from its issuedAt: have `SeatFeed._record` store `seenAt = block.timestamp` beside `cap.at`, make `_open`, `tick`, `take`, `takeFloor` and `reopen` call `poke()` first, and in `_elapsed` use `from2 = max(from, seenAt)` (and in the no-gap branch cap `end` at the old window's end when `seenAt` is after it). Alternatively, if the median is stale at a reading, record the pause and resume only at the next fresh reading's block.","line":476,"path":"src/seats/SeatJoin.sol","proof":"// SPDX-License-Identifier: MIT\npragma solidity 0.8.26;\n\nimport {Test} from \"forge-std/Test.sol\";\nimport {IERC721} from \"@openzeppelin/contracts/token/ERC721/IERC721.sol\";\nimport {SeatJoin} from \"src/seats/SeatJoin.sol\";\nimport {IImdAgentAdapter} from \"src/seats/SeatAccount.sol\";\nimport {SeatFeed} from \"src/feeds/SeatFeed.sol\";\nimport {IFeed} from \"src/interfaces/IFeed.sol\";\nimport {ParametersBase} from \"src/ParametersBase.sol\";\n\n/// A swarm-shaped leaf: `latestValue` returns the attestation's signed issue time (SwarmFeed returns `_updatedAt =\n/// a.issuedAt`), and `isStale` is measured from it. `relay(v, issuedAt)` is `submitAttestation` landing at block.timestamp\n/// for an attestation signed at `issuedAt` (SwarmFeed accepts any issuedAt in [updatedAt, now] within maxAge).\ncontract LeafMock is IFeed {\n    uint256 public value;\n    uint64 public at;\n    uint256 public maxAge;\n    uint256 public latestFigure = 150;\n\n    constructor(uint256 v, uint256 maxAge_) {\n        value = v;\n        at = uint64(block.timestamp);\n        maxAge = maxAge_;\n    }\n\n    function relay(uint256 v, uint64 issuedAt) external {\n        require(issuedAt >= at && issuedAt <= block.timestamp, \"swarm: issuedAt\");\n        value = v;\n        at = issuedAt;\n    }\n\n    function latestValue() external view returns (uint256, uint64) {\n        return (value, at);\n    }\n\n    function isStale() external view returns (bool) {\n        return value == 0 || block.timestamp - at > maxAge;\n    }\n}\n\ncontract ParamsMock {\n    ParametersBase.Config internal _cfg;\n\n    constructor(IFeed median_) {\n        _cfg.median = median_;\n        _cfg.auction = true;\n    }\n\n    function config(bytes32) external view returns (ParametersBase.Config memory) {\n        return _cfg;\n    }\n\n    function governor() external pure returns (address) {\n        return address(0xbeef);\n    }\n}\n\ncontract LedgerMock {\n    address public params;\n    address public treasury = address(0xcafe);\n    address public token = address(0xdead);\n    address public liquidator;\n\n    constructor(address params_, address liquidator_) {\n        params = params_;\n        liquidator = liquidator_;\n    }\n}\n\n/// SeatJoin._elapsed credits priced time from an attestation's ISSUE time, not from the moment the chain first saw it.\n/// An attestation signed during a stale gap and relayed hours later makes the Dutch clock jump by the hold, so the\n/// price lands at the floor in the relay's own block although nobody could `take` (NotPriced) while the median was stale.\ncontract ProofAuctionClockLateRelay is Test {\n    uint256 constant ID = 1;\n    uint256 constant T0 = 1_800_000_000;\n\n    LeafMock median;\n    LeafMock spot;\n    LeafMock eth;\n    SeatFeed feed;\n    SeatJoin join;\n\n    function setUp() public {\n        vm.warp(T0 - 25 hours);\n        // The beta's leaf life (SEAT_MAX_AGE = 26 hours). The attestation live at the opening was signed 25 h before it.\n        median = new LeafMock(1.6e18, 26 hours);\n        spot = new LeafMock(1.6e18, 26 hours);\n        eth = new LeafMock(2000e18, 365 days); // ETH/USD staleness is not reconstructed by the clock (documented)\n        feed = new SeatFeed(median, spot, eth);\n        ParamsMock params = new ParamsMock(IFeed(address(feed)));\n        LedgerMock ledger = new LedgerMock(address(params), address(this)); // this test is the Liquidator\n        join = new SeatJoin(\"SEAT\", IERC721(address(0x1D)), IImdAgentAdapter(address(0xAD)), address(this), 25, 3);\n        join.wire(address(ledger));\n        vm.warp(T0);\n    }\n\n    function test_lateRelayDoesNotAdvanceTheClockThroughAStaleGap() public {\n        join.open(ID, address(this)); // Liquidator.bite -> open, at T0: median $3,200, fresh for 1 more hour\n        assertEq(join.price(ID), 3_200e18);\n\n        vm.warp(T0 + 1 hours); // the median ages out here: on chain, nobody can take from now on (NotPriced)\n        assertEq(join.elapsed(ID), 1 hours);\n        vm.warp(T0 + 7 hours);\n        assertTrue(median.isStale(), \"stale for 6 hours\");\n        assertEq(join.elapsed(ID), 1 hours, \"paused while stale, as documented\");\n        assertEq(join.price(ID), 3_040e18, \"one priced hour of decay\");\n\n        // A daily attestation signed 10 minutes into the gap, bought by anyone, held, and relayed only now. SwarmFeed\n        // dates it by its signed issuedAt (T0 + 1h10m). The chain had no seat price between T0+1h and T0+7h.\n        median.relay(1.6e18, uint64(T0 + 1 hours + 10 minutes));\n        join.tick(ID); // the first reading after the relay (take/reopen/tick all read the same clock)\n\n        // Expected (SeatJoin.sol:53-54, 456-457: \"a missed daily refresh pauses the sale instead of running it to the\n        // floor unseen\", \"the clock only ever runs slow, never fast\"): still 1 priced hour, price $3,040.\n        // Actual: the 5h50m the median was stale on chain are counted, the clock reads 6h50m and the price is at the\n        // 70% floor in the relay's own block, so the relayer takes at $2,240 before anyone else sees a price.\n        assertEq(join.elapsed(ID), 1 hours, \"clock counted hours the chain had no median\");\n        assertEq(join.price(ID), 3_040e18, \"price fell unseen\");\n    }\n}","reproduction":"State: SeatFeed over a median leaf with maxAge 26 h; the attestation live at the bite was issued 25 h earlier (value 1.6e18 wei, ETH/USD 2000 -> 3,200 USD/seat). Sequence: (1) Liquidator.bite -> SeatJoin.open(id, marker) at T0; price 3,200. (2) At T0+1h the median ages out; elapsed() == 1h, price 3,040; take() reverts NotPriced from here. (3) At T0+7h elapsed() still 1h (paused). (4) Anyone relays an attestation with issuedAt = T0+1h10m (SwarmFeed.submitAttestation accepts it: issuedAt >= updatedAt, within maxAge); call tick(id) or simply take(id, maxPrice). Expected: elapsed() == 1h, price 3,040 USD (the hours the chain had no price are not counted). Actual: elapsed() == 24,600 s (6h50m) >= AUCTION_TIME, price 2,240 USD (the floor); take settles at 2,240 in the relay's block. Proof output: [FAIL: clock counted hours the chain had no median: 24600 != 3600].","severity":"medium","snippet":"            uint256 from2 = Math.max(from, uint256(newAt));\n            uint256 end2 = Math.min(t, uint256(newAt) + life);\n            if (end2 > from2) ran += end2 - from2;","title":"Auction clock credits priced time from an attestation's signed issuedAt, so a late-relayed attestation runs the Dutch auction to the floor unseen"},{"citation":"resolved","description":"SEAT FEED (question 5). `acceptedMedian` (SeatFeed.sol:116-121) caps the live reading against the recorded `cap` state. The constructor records nothing when the median leaf is empty (SeatFeed.sol:99-100), which is the beta's case: script/DeployConfig.sol:657 'Deployed with EMPTY legs', and nothing in script/deploy/Stage*.sol calls `poke()` after the seed relay. While `cap` is zero, `_capped(c.raw, c.base)` is `_capped(0, 0) == 0`, so `lowest == 0` and the live reading passes raw. That is intended for the FIRST attestation, but it stays true for the second, third, ... attestation until the first `poke()` runs `_record`: a crashed or washed median in any attestation before that poke is accepted in full. The only bound left is the leaf's own per-epoch deviation cap (SwarmFeed `_fitsEpoch`, SEAT_MEDIAN_CAP_BPS = 30%, widened up to 2x after an hour of staleness), i.e. a 30-60% fall instead of the 20% the fall cap promises. This contradicts the NatSpec at SeatFeed.sol:47-48 ('recorded lazily by permissionless poke (no keeper needed for correctness)') and 50-53 ('The only thing a missing poke changes: two attestations landing with no poke between them count as ONE step ... capped harder, never looser'), and weakens the wash-trade mitigation the README relies on ('When the median's fall cap binds ...'). Impact with BetaConfig (mat 250%, line 40k, 25 seats): a 30% crash in the second attestation (uncapped) against a 20% capped one lowers every seat position's health by a further 12.5% at once and opens auctions at the crashed median (SeatJoin `_open` reads `medianUsd`), so seats are sold 10 points cheaper than the cap allows; a relayer who holds two bought attestations can land both in one block before anyone can poke. Reachable: yes, from genesis until the first poke (the keeper has no reason to poke before a fall it wants recognised, and the ring needs no poke until positions exist). Smallest fix: deploy the SeatFeed after the seed relay (the constructor then anchors on the live attestation), or have `acceptedMedian` treat an empty `cap` with a non-empty leaf as unanchored only for the reading whose `updatedAt` the constructor saw: concretely, in `_record` and the constructor record `(raw = m, base = m, at = t)` whenever `cap.at == 0` and `m != 0`, and have `SeatJoin._open`, `take`, `takeFloor`, `reopen` and the relayer call `poke()`; and add `seatFeed.poke()` to the deploy stage right after the seed relay.","line":120,"path":"src/feeds/SeatFeed.sol","proof":"// SPDX-License-Identifier: MIT\npragma solidity 0.8.26;\n\nimport {Test} from \"forge-std/Test.sol\";\nimport {SeatFeed} from \"src/feeds/SeatFeed.sol\";\nimport {IFeed} from \"src/interfaces/IFeed.sol\";\n\n/// A swarm-shaped leaf: empty until the first relay (the beta deploys the seat leaves EMPTY, script/DeployConfig.sol\n/// \"Deployed with EMPTY legs\"), then `latestValue` returns the attestation's signed issuedAt, as SwarmFeed does.\ncontract LeafMock is IFeed {\n    uint256 public value;\n    uint64 public at;\n    uint256 public maxAge = 26 hours;\n    uint256 public latestFigure = 150;\n\n    function relay(uint256 v) external {\n        value = v;\n        at = uint64(block.timestamp);\n    }\n\n    function latestValue() external view returns (uint256, uint64) {\n        return (value, at);\n    }\n\n    function isStale() external view returns (bool) {\n        return value == 0 || block.timestamp - at > maxAge;\n    }\n}\n\n/// SeatFeed's fall cap is computed from the recorded `cap` state. The constructor records nothing when the median leaf is\n/// empty (the beta deploy), and nothing else records until someone calls `poke()`. With `cap` empty, `acceptedMedian`\n/// caps the live reading against `_capped(0, 0) == 0`, so EVERY attestation before the first poke is accepted raw, not\n/// only the first: a second attestation that crashes the median passes uncapped, although SeatFeed.sol:50-53 promises\n/// that a missing poke can only make the cap bind harder, never looser.\ncontract ProofFallCapUnanchored is Test {\n    LeafMock median;\n    LeafMock spot;\n    LeafMock eth;\n    SeatFeed feed;\n\n    function setUp() public {\n        vm.warp(1_800_000_000);\n        median = new LeafMock();\n        spot = new LeafMock();\n        eth = new LeafMock();\n        eth.relay(2000e18);\n        feed = new SeatFeed(median, spot, eth); // deployed over an EMPTY median: `cap` stays zero\n    }\n\n    function test_secondAttestationBeforeAnyPokeIsFallCapped() public {\n        // The seed attestation the deployment relays: 2 ETH per seat, accepted raw (nothing to cap against; intended).\n        vm.warp(block.timestamp + 1);\n        median.relay(2e18);\n        spot.relay(2e18);\n        assertEq(feed.acceptedMedian(), 2e18);\n\n        // The next daily attestation lands before anyone has poked: a washed or crashed median of 1 ETH.\n        vm.warp(block.timestamp + 1 days);\n        median.relay(1e18);\n        spot.relay(1e18);\n\n        // Expected (SeatFeed.sol:35-38, 50-53): at most 20% below the previously accepted 2 ETH -> 1.6 ETH; two\n        // attestations with no poke between them \"count as ONE step\", \"capped harder, never looser\".\n        // Actual: 1 ETH, the raw reading. The fall cap is inert until the first poke.\n        assertEq(feed.acceptedMedian(), 1.6e18, \"fall cap did not bind before the first poke\");\n    }\n\n    /// Control: the same two attestations with one poke between them are capped as documented.\n    function test_control_pokeBetweenAnchorsTheCap() public {\n        vm.warp(block.timestamp + 1);\n        median.relay(2e18);\n        spot.relay(2e18);\n        feed.poke();\n        vm.warp(block.timestamp + 1 days);\n        median.relay(1e18);\n        spot.relay(1e18);\n        assertEq(feed.acceptedMedian(), 1.6e18);\n    }\n}","reproduction":"State: SeatFeed constructed over an empty median leaf (value 0), ETH/USD 2000e18. Sequence: (1) relay the seed attestation 2e18 wei/seat; acceptedMedian() == 2e18 (raw, intended). (2) No poke. (3) One day later relay the next attestation 1e18 wei/seat. Expected (20% fall cap, 'never looser' without a poke): acceptedMedian() == 1.6e18 and the seat type prices at 3,200 USD/seat. Actual: acceptedMedian() == 1e18 (2,000 USD/seat). Control: with `poke()` between (1) and (3) the result is 1.6e18. Proof output: [FAIL: fall cap did not bind before the first poke: 1000000000000000000 != 1600000000000000000].","severity":"medium","snippet":"        return t > c.at ? _capped(m, _capped(c.raw, c.base)) : _capped(m, c.base);","title":"Fall cap is inert until the first poke: with an empty cap state every attestation before the first poke is accepted raw, not only the first (the beta deploys the seat leaves empty and never pokes)"}],"hash":"4de21345b996a5550756a8bdffc3aeab2e7d1b69f10eb5a818f49f9abd391776","nodeId":"5b25b9a5-2f7e-4bb0-85ea-1ca50663ff80","outcome":"completed","summary":"The review is complete. Two substantiated findings are in `.imd-findings.json`, each with a self-contained Foundry proof that fails on this commit; the scratch tests are deleted and the tree is unchanged.\n\n## Findings\n\n**1. Medium. Auction clock counts time from an attestation's signed `issuedAt`, so a late relay runs the Dutch auction to the floor unseen** (`src/seats/SeatJoin.sol:476`).\nSwarmFeed dates a value by its signed issue time, not the relay block. While the median is stale on chain, `take`, `takeFloor` and `reopen` all revert `NotPriced`, but when an attestation signed inside that gap is relayed hours later, the gap branch of `_elapsed` credits the whole hold as priced time. With the beta values (26 h leaf life, 6 h decay) the proof opens against a 25-hour-old attestation, pauses at 1 priced hour, and a relay of an attestation issued 10 minutes into the gap, 6 hours later, puts the clock at 6h50m: price 3,040 to 2,240 USD per seat in one block, takeable by the relayer in the same transaction. This contradicts the NatSpec at lines 53-54 and 456-457. The ETH/USD leg (70-minute max age in the beta) is not reconstructed at all, so a late Chainlink heartbeat decays the price unseen the same way. Proof output: `24600 != 3600`.\n\n**2. Medium. Fall cap is inert until the first `poke`** (`src/feeds/SeatFeed.sol:120`).\nWith an empty cap state, `acceptedMedian` caps against `_capped(0,0) == 0`, so every attestation before the first poke is accepted raw, not only the first. The beta deploys the seat leaves empty and no deploy stage pokes. A crashed or washed second attestation passes in full, bounded only by the leaf's own 30% per-epoch cap (60% after a silence), against the 20% promised. Contradicts the NatSpec at lines 47-48 and 50-53. Proof output: `1e18 != 1.6e18`; the control with a poke in between passes.\n\n## Numbered questions\n\n1. **Custody: holds.** Every unit path (`deposit`, `withdraw`, `transferFrom`, `exit`, `transfer`, `onPositionTransfer`, `_settle`'s reset-and-retire, `takeFloor`'s re-mint) keeps units = 1e18 × seats listed per holder. `rescue` cannot touch a held seat. The IDMD bytecode on mainnet exposes no ERC-20 `transfer(address,uint256)`, so reporting the NFT as a reward token cannot move a seat.\n2. **Auction: finding 1.** Settlement burns at most n×p from the join, so the Treasury budget cannot be consumed by a `take`; the penalty split matches the Ledger's bound-version chop; `settle` is bound to the seat join and ilk. Design notes, not defects: the borrower may `reopen` at the floor once per new attestation (a 6-hour reset per day); a price-healed auction stays open (README known issue).\n3. **Seat account: holds.** Every custody change (release, position transfer, Treasury keep or transfer) bumps `custodyEpoch`; `isValidSignature` is valid only for digests the account computed itself, unexpired, same epoch, seat still held. `registerAgent` is once per account.\n4. **Rewards: holds.** Credits go to the holder at report time, else last holder, else Treasury; `collect` pays only the credited party less the in-kind fee. Hardening note only: `sync` has no reentrancy guard and `send` decrements `reported` before the transfer, which a token with a pre-balance-update recipient hook could exploit against a co-creditor on the same seat; no standard token does this.\n5. **Seat feed: finding 2.** Otherwise rises pass uncapped by design, `trend` never exceeds 1, the 32-slot ring resolves the 30-day point correctly, and an equal-`issuedAt` replacement steps from the same base.\n\n## Coverage, external functions\n\n| Contract | Function | Result |\n|---|---|---|\n| SeatJoin | wire, setLimits, setClaimRule, recallBudget | holds (wirer / Parameters / governor guards) |\n| SeatJoin | transferFrom, transfer, exit, approve, allowance, token | holds (Ledger-only or Treasury-only, whole units) |\n| SeatJoin | deposit, withdraw, onPositionTransfer, rescue, accountOf, seatsOf | holds |\n| SeatJoin | open, price, elapsed, expired, tick, tak","treeHash":null,"usage":{"cachedInputTokens":1446027,"chain":[{"calls":1,"chainId":1,"failed":0,"own":1,"public":0,"refused":0}],"cost":{"source":"runtime","usdMicros":6684706},"inputTokens":386,"model":"claude-fable-5-1","outputTokens":65477,"runtime":"claude","turns":24,"wallClockMs":1244237}},{"artifacts":[],"attempt":1,"bundleHash":null,"device":"6f30d6341cbff249","findings":[{"citation":"resolved","description":"Merged from four specialist reports (audit_math a76defcc, audit_flow f1275fcb, audit_economics de24a03a): the same root cause in both branches of _elapsed. SeatJoin._elapsed (lines 459-480) rebuilds PRICED time from the median leaf's updatedAt. For a swarm leaf that is the attestation's signed issuedAt (SwarmFeed.submitAttestation -> _accept(value, a.issuedAt), SwarmFeed.sol:324). submitAttestation accepts any issuedAt that is still within maxAge (26 h in BetaConfig, SEAT_MAX_AGE, DeployConfig.sol:711) and not older than the current one. The relay time is kept only in the private _acceptedAt. Branch 1 (line 470, newAt <= freshUntil) counts from..min(t, newAt+life) as fresh. Take an attestation issued before the old one aged out but relayed after it did: the whole stale gap is counted. During that gap take/takeFloor/reopen revert NotPriced (Liquidator.settle -> _requireUnhealthy). The gap branch (lines 476-478, from2 = max(from, newAt)) does the same thing for an attestation issued during the gap and relayed later. A tick during the gap does not help: it sets lastTick but the later relay still counts from it. Impact: in the relay's block the Dutch price jumps from where priced time left it to the 0.7 x start floor. The relayer (relaying is permissionless; attestations can be bought) can take() in the same transaction, or trigger takeFloor. The borrower loses up to 30% of the fall-capped median per seat out of the surplus that take pays them (_settle line 592: toBorrower = left - penalty). At the beta's $4,000 seat that is up to $1,200 per seat, $3,600 for a 3-seat position. A counted gap of 24 h or more voids the auction instead of pausing it. The defect contradicts SeatJoin.sol:53-54 ('a missed daily refresh pauses the sale instead of running it to the floor unseen') and SeatJoin.sol:456 ('the clock only ever runs slow, never fast'). Reachable with BetaConfig: the seat type is on, maxAge is 26 h and refreshes are daily, so any late refresh opens the window. Smallest fix: start the new window at the moment the chain first saw the attestation, not at its issuedAt. Expose SwarmFeed._acceptedAt through an acceptedAt() view (passed through by the leaf). In _elapsed use start = max(newAt, acceptedAt) for the new window, in both branches; in branch 1, when acceptedAt > freshUntil, count the old window only to freshUntil. Without a new view, count the new window from block.timestamp of the first read that sees it: the clock then runs slow, as documented.","line":470,"path":"src/seats/SeatJoin.sol","proof":"// SPDX-License-Identifier: MIT\npragma solidity 0.8.26;\n\nimport {Test} from \"forge-std/Test.sol\";\nimport {IERC721} from \"@openzeppelin/contracts/token/ERC721/IERC721.sol\";\nimport {SeatJoin} from \"src/seats/SeatJoin.sol\";\nimport {IImdAgentAdapter} from \"src/seats/SeatAccount.sol\";\nimport {SeatFeed} from \"src/feeds/SeatFeed.sol\";\nimport {IFeed} from \"src/interfaces/IFeed.sol\";\nimport {ParametersBase} from \"src/ParametersBase.sol\";\n\n/// @dev A swarm leaf as SeatJoin sees it: `latestValue` returns the attestation's `issuedAt` (SwarmFeed sets\n/// `_updatedAt = a.issuedAt`, and accepts an attestation up to `maxAge` after it was issued). `acceptedAt` is the\n/// block time of the relay (SwarmFeed keeps it privately as `_acceptedAt`): what a fix needs to read.\ncontract MockLeaf is IFeed {\n    uint256 public value;\n    uint64 public updatedAt;\n    uint64 public acceptedAt;\n    uint256 public figure;\n    uint256 public immutable maxAge;\n\n    constructor(uint256 maxAge_) {\n        maxAge = maxAge_;\n    }\n\n    function set(uint256 v, uint64 issuedAt) external {\n        value = v;\n        updatedAt = issuedAt;\n        acceptedAt = uint64(block.timestamp);\n    }\n\n    function setFigure(uint256 f) external {\n        figure = f;\n    }\n\n    function latestValue() external view returns (uint256, uint64) {\n        return (value, updatedAt);\n    }\n\n    function isStale() external view returns (bool) {\n        return value == 0 || block.timestamp > uint256(updatedAt) + maxAge;\n    }\n\n    function latestFigure() external view returns (uint256) {\n        return figure;\n    }\n}\n\ncontract MockParams {\n    ParametersBase.Config internal _c;\n    address public governor = address(0xA11CE);\n\n    function setMedian(IFeed m) external {\n        _c.median = m;\n    }\n\n    function config(bytes32) external view returns (ParametersBase.Config memory) {\n        return _c;\n    }\n}\n\ncontract MockLedger {\n    address public params;\n    address public treasury;\n    address public token;\n    address public liquidator;\n\n    constructor(address p, address t, address tok, address l) {\n        params = p;\n        treasury = t;\n        token = tok;\n        liquidator = l;\n    }\n}\n\n/// @notice SeatJoin._elapsed counts the new attestation's window from its `issuedAt`, which SwarmFeed lets a relayer\n/// hold for up to `maxAge` (26 h in BetaConfig) before relaying. Hours in which the chain was STALE (no sale could\n/// settle: Liquidator.settle requires `priced`) are then counted as priced time once the held attestation lands,\n/// so the Dutch clock jumps and the sale is takeable at the floor, against the documented pause.\ncontract ProofSeatClockTest is Test {\n    uint256 constant T0 = 1_800_000_000;\n    address constant LIQUIDATOR = address(0x11);\n    address constant MARKER = address(0x22);\n\n    MockLeaf median;\n    MockLeaf spot;\n    MockLeaf eth;\n    SeatFeed feed;\n    SeatJoin join;\n\n    function setUp() public {\n        vm.warp(T0);\n        median = new MockLeaf(26 hours); // SEAT_MAX_AGE in BetaConfig\n        spot = new MockLeaf(26 hours);\n        eth = new MockLeaf(365 days);\n        // The median attestation live at the opening was issued 25 h ago: fresh for one more hour.\n        median.set(1e18, uint64(T0 - 25 hours));\n        median.setFigure(100);\n        spot.set(1e18, uint64(T0));\n        eth.set(3000e18, uint64(T0));\n        feed = new SeatFeed(median, spot, eth);\n        MockParams params = new MockParams();\n        params.setMedian(IFeed(address(feed)));\n        MockLedger ledger = new MockLedger(address(params), address(0x33), address(0x44), LIQUIDATOR);\n        join = new SeatJoin(\"SEAT\", IERC721(address(0x55)), IImdAgentAdapter(address(0x66)), address(this), 25, 3);\n        join.wire(address(ledger));\n    }\n\n    function test_heldAttestationRunsTheAuctionClockThroughStaleHours() public {\n        vm.prank(LIQUIDATOR);\n        join.open(1, MARKER);\n        uint256 start = join.price(1);\n        assertEq(start, 3000e18);\n\n        // One priced hour, then ten hours in which the median leg is stale on chain: no take can settle.\n        vm.warp(T0 + 11 hours);\n        assertTrue(feed.isStale());\n        assertEq(join.elapsed(1), 1 hours, \"while stale the clock is paused, as documented\");\n\n        // A relayer now relays an attestation ISSUED at T0 + 1 h (10 h old, inside SwarmFeed's maxAge) and takes in\n        // the same transaction. The chain was unpriced for those ten hours.\n        median.set(1e18, uint64(T0 + 1 hours));\n        assertFalse(feed.isStale());\n        assertFalse(join.expired(1), \"11 h < AUCTION_LIFE: the auction is takeable\");\n\n        // Expected: 1 h of priced time, price 0.95 x start. Actual on this commit: 11 h, the floor (0.7 x start).\n        assertEq(join.elapsed(1), 1 hours, \"priced time must not include the hours the chain was stale\");\n        assertEq(join.price(1), start * 95 / 100, \"the sale must not be at the floor\");\n    }\n}","reproduction":"State (attached proof, mocks: a leaf whose updatedAt = issuedAt with maxAge 26 h; ETH/USD 3000e18; median 1e18 wei): the Liquidator opens auction 1 at T0, while the live median attestation was issued at T0-25h. Start price is 3000e18. At T0+11h the median has been stale for 10 h and elapsed(1) == 3600: correct, the clock is paused. Input: relay an attestation issued at T0+1h (10 h old, accepted by SwarmFeed). Expected: elapsed(1) == 3600 and price(1) == 2850e18. Actual: elapsed(1) == 39600 and price(1) == 2100e18 (the floor), with expired(1) == false, so take(1, 2100e18) settles at the floor. Run (Foundry 1.8.3, solc 0.8.26 via_ir per foundry.toml): the four specialist proofs copied to test/scratch/ and run with `forge test --match-path 'test/scratch/*.t.sol'` (3m22s): 0 passed, 4 failed. Output for this proof: '[FAIL: priced time must not include the hours the chain was stale: 39600 != 3600] test_heldAttestationRunsTheAuctionClockThroughStaleHours() (gas: 391406)'. The branch-1 variant (audit_flow proof Proof_f1275fcbd380) also fails: auction opened with 1 h of life left, 12 h stale gap, then an attestation issued at T0+20h is relayed: '[FAIL: the clock ran during the stale gap: 46800 > 3600] test_lateRelayCountsStaleGapAsPricedTime() (gas: 449614)'. After the fix (window counted from the relay), elapsed stays 3600 and both pass.","severity":"medium","snippet":"            uint256 end = Math.min(t, Math.max(freshUntil, uint256(newAt) + life));\n            if (end > from) ran += end - from;","title":"Auction clock counts the hours the median was stale as priced time when a late-relayed attestation lands: the sale jumps to the floor (Q2)"},{"citation":"resolved","description":"Merged from audit_math c3eb2b0a and audit_flow 46ef0bf1. Both legs the Pricer reads for SEAT are price x factor: SeatFeed.latestValue (line 237) and SeatSpotLeg.latestValue (line 263). factor = liquidity x trend, and liquidity = min(1, figure/100) is read straight from the median leaf's latestFigure(). SwarmSeatFeed._onFigure (src/feeds/SwarmFeeds.sol:111-113) stores the signed figure with no bound. SwarmFeed's deviation/epoch cap bounds only the answer, and SeatFeed's 20% MAX_FALL_PER_UPDATE_BPS bounds only acceptedMedian. An attestation that keeps the price and drops the figure (150 -> 10) therefore cuts both legs by 90% in one step. Because both legs carry the same factor, the Pricer's skew check (agree) still passes. Because acceptedMedian is unchanged, the fall cap sees no fall. Every seat position becomes liquidatable at once: at mat 250%, any position under about 90% of max borrow. A figure of 0 makes the value 0 (unpriced), which freezes the type. A figure rise likewise loosens LTV past the caps (50 -> 100 doubles the value). Liquidator.bark/bite then open auctions at medianUsd() (no factor), so borrowers lose the chop penalty plus up to 30% Dutch discount. This contradicts the SeatFeed header (lines 35-40: falls bounded at 20% per update) and the README trust model (an attester 'can move those feeds within the cap per epoch'). An honest figure is a 7-day distinct-seat count and can also drop sharply when a burst of sales ages out of the window. Reachable with BetaConfig: the seat type is on, and SEAT_MEDIAN_CAP_BPS 3000 caps the answer only. Smallest fix: cap the liquidity term per new attestation the way the median is capped. Record the accepted figure in Cap (base/raw like the median) and have liquidity() read _capped(figure, acceptedFigureBase), so it falls at most MAX_FALL_PER_UPDATE_BPS per attestation. Alternatively, bound the figure's step against the previous figure in SwarmSeatFeed._onFigure.","line":168,"path":"src/feeds/SeatFeed.sol","proof":"// SPDX-License-Identifier: MIT\npragma solidity 0.8.26;\n\nimport {Test} from \"forge-std/Test.sol\";\nimport {SeatFeed, SeatSpotLeg} from \"src/feeds/SeatFeed.sol\";\nimport {IFeed} from \"src/interfaces/IFeed.sol\";\n\n/// @dev A seat leaf as SwarmSeatFeed exposes it: a value (bounded by the swarm's per-epoch cap, 30% in BetaConfig)\n/// and a signed `figure` (the distinct seats sold) that `_onFigure` stores with no bound at all.\ncontract Leaf is IFeed {\n    uint256 public value;\n    uint64 public at;\n    uint256 public maxAge = 26 hours;\n    uint256 public latestFigure;\n\n    function set(uint256 v, uint256 figure) external {\n        value = v;\n        latestFigure = figure;\n        at = uint64(block.timestamp);\n    }\n\n    function latestValue() external view returns (uint256, uint64) {\n        return (value, at);\n    }\n\n    function isStale() external view returns (bool) {\n        return value == 0 || block.timestamp - at > maxAge;\n    }\n}\n\ncontract ProofSeatFigureUncapped is Test {\n    Leaf median;\n    Leaf spot;\n    Leaf ethUsd;\n    SeatFeed feed;\n    SeatSpotLeg spotLeg;\n\n    function setUp() public {\n        vm.warp(1_800_000_000);\n        median = new Leaf();\n        spot = new Leaf();\n        ethUsd = new Leaf();\n        median.set(2e18, 150); // $4,000 per seat, 150 distinct seats sold: liquidity = 1\n        spot.set(2e18, 150);\n        ethUsd.set(2000e18, 0);\n        feed = new SeatFeed(median, spot, ethUsd);\n        spotLeg = new SeatSpotLeg(feed);\n    }\n\n    /// The trust model bounds a compromised or wrong attestation to the per-epoch cap (30% on the seat leaves, 20%\n    /// per update on the accepted median). The seat type's priced value also carries `liquidity = min(1, figure/100)`,\n    /// and the figure is not capped anywhere: one attestation with the same price and a figure of 10 moves BOTH\n    /// legs the Pricer reads down 90%, so every seat position is unhealthy at once.\n    function test_oneAttestationMovesThePricedValueNinetyPercent() public {\n        (uint256 before,) = feed.latestValue();\n        (uint256 spotBefore,) = spotLeg.latestValue();\n        assertEq(before, 4000e18);\n        assertEq(spotBefore, 4000e18);\n\n        vm.warp(block.timestamp + 1 hours);\n        median.set(2e18, 10); // the price is unchanged, the figure falls from 150 to 10\n        feed.poke();\n\n        (uint256 after_,) = feed.latestValue();\n        (uint256 spotAfter,) = spotLeg.latestValue();\n        emit log_named_uint(\"median leg before\", before);\n        emit log_named_uint(\"median leg after one attestation\", after_);\n        emit log_named_uint(\"spot leg after one attestation\", spotAfter);\n        assertEq(feed.acceptedMedian(), 2e18, \"the fall cap sees no fall at all\");\n        // Expected: no leg falls past the widest cap any swarm leaf allows per epoch (2 x 30% = 60%).\n        assertGe(after_, before * 40 / 100, \"median leg fell past every cap in one attestation\");\n        assertGe(spotAfter, spotBefore * 40 / 100, \"spot leg fell past every cap in one attestation\");\n    }\n}","reproduction":"State (attached proof, mock leaves): median 2e18 wei with figure 150, spot 2e18, ETH/USD 2000e18. Both SeatFeed.latestValue() and SeatSpotLeg.latestValue() are 4000e18. Input: one new median attestation with the same value 2e18 and figure 10, then poke(). Expected: no leg falls more than the widest cap any leaf grants (2 x 30% = 60%), so both legs >= 1600e18. Actual: both legs read 400e18 (-90%), and acceptedMedian() is still 2e18. Run (Foundry 1.8.3, solc 0.8.26 via_ir per foundry.toml): the four specialist proofs copied to test/scratch/ and run with `forge test --match-path 'test/scratch/*.t.sol'` (3m22s): 0 passed, 4 failed. Output: '[FAIL: median leg fell past every cap in one attestation: 400000000000000000000 < 1600000000000000000000] test_oneAttestationMovesThePricedValueNinetyPercent() (gas: 471399)'; logs: median leg before 4000e18, median leg after one attestation 400e18, spot leg after one attestation 400e18. audit_math's variant (figure 100 -> 20, latestValue 3000e18 -> 600e18) also fails: '[FAIL: one attestation moved the seat price past the 20% fall cap: 600000000000000000000 < 2400000000000000000000]'.","severity":"medium","snippet":"        uint256 n = ISeatFigure(address(median)).latestFigure();\n        return Math.min(1e18, Math.mulDiv(n, 1e18, FULL_LIQUIDITY));","title":"SeatFeed's liquidity term reads the attested figure with no bound: one attestation moves both priced legs past every fall cap (Q5)"},{"citation":"resolved","description":"Merged from audit_math 8c93eb9b and audit_economics d8d15887. The constructor records nothing when the median leaf is empty (lines 99-100). The beta deploys the seat legs empty (script/DeployConfig.sol:657), and no script under script/ calls poke(): `grep -rn 'poke()' script/` returns nothing. While cap == (0,0,0), acceptedMedian computes _capped(m, _capped(0, 0)). The lowest bound is 0, so the live reading passes raw. That is intended for the seed attestation, but it stays true for every later attestation until someone pokes. Until then, the only bound on a fall is SwarmFeed's epoch cap (30%, widened up to 2x after staleness), not the 20% per update. SeatJoin._open starts auctions at that uncapped median. This contradicts SeatFeed.sol:50-53 ('an unpoked fall is capped harder ..., never looser') and lines 96-98 (only 'the first attestation relayed is accepted raw'). It is limited to the window before the first permissionless poke, hence low. Smallest fix: in _record and acceptedMedian, treat an empty cap with a nonzero live reading as anchored on that reading: record (raw=m, base=m, at=t) at the first poke, and call seatFeed.poke() in the deploy stage right after the seed relay. Or deploy SeatFeed after the seed relay so the constructor anchors it.","line":120,"path":"src/feeds/SeatFeed.sol","proof":"// SPDX-License-Identifier: MIT\npragma solidity 0.8.26;\n\nimport {Test} from \"forge-std/Test.sol\";\nimport {SeatFeed} from \"src/feeds/SeatFeed.sol\";\nimport {IFeed} from \"src/interfaces/IFeed.sol\";\n\ncontract CapLeaf is IFeed {\n    uint256 public value;\n    uint64 public at;\n    uint256 public constant maxAge = 26 hours;\n\n    function set(uint256 v) external {\n        value = v;\n        at = uint64(block.timestamp);\n    }\n\n    function latestValue() external view returns (uint256, uint64) {\n        return (value, at);\n    }\n\n    function isStale() external view returns (bool) {\n        return value == 0 || block.timestamp - at > maxAge;\n    }\n\n    function latestFigure() external pure returns (uint256) {\n        return 100;\n    }\n}\n\n/// SeatFeed deployed over an EMPTY median leaf (the beta deploy, script/DeployConfig.sol:657); no deploy stage pokes.\ncontract ProofCapBeforePoke is Test {\n    CapLeaf median;\n    CapLeaf spot;\n    CapLeaf eth;\n    SeatFeed feed;\n\n    function setUp() public {\n        vm.warp(1_800_000_000);\n        median = new CapLeaf();\n        spot = new CapLeaf();\n        eth = new CapLeaf();\n        eth.set(2000e18);\n        feed = new SeatFeed(median, spot, eth);\n    }\n\n    function test_secondAttestationBeforeFirstPokeIsNotCapped() public {\n        median.set(2e18); // the seed relay: accepted raw, as documented\n        assertEq(feed.acceptedMedian(), 2e18);\n        vm.warp(block.timestamp + 1 days);\n        median.set(1e18); // the next daily attestation, a 50% fall, nobody has poked yet\n        emit log_named_uint(\"acceptedMedian\", feed.acceptedMedian());\n        assertEq(feed.acceptedMedian(), 1.6e18, \"fall cap did not bind before the first poke\");\n    }\n\n    function test_control_withPokeTheCapBinds() public {\n        median.set(2e18);\n        feed.poke();\n        vm.warp(block.timestamp + 1 days);\n        median.set(1e18);\n        assertEq(feed.acceptedMedian(), 1.6e18);\n    }\n}","reproduction":"SeatFeed constructed over an empty median leaf, ETH/USD 2000e18. Relay a seed of 2e18 (acceptedMedian 2e18, raw as intended). One day later, with no poke, relay 1e18. Expected: acceptedMedian() == 1.6e18. Actual: 1e18. Control: with poke() between the two relays the result is 1.6e18 (PASS). Run: `forge test --match-path 'test/scratch/*.t.sol' --match-test 'proof|Poke' -vv` -> 'Ran 2 tests for test/scratch/ProofCapBeforePoke.t.sol:ProofCapBeforePoke [PASS] test_control_withPokeTheCapBinds() (gas: 259077) [FAIL: fall cap did not bind before the first poke: 1000000000000000000 != 1600000000000000000] test_secondAttestationBeforeFirstPokeIsNotCapped() (gas: 163895) Logs: acceptedMedian: 1000000000000000000'.","severity":"low","snippet":"        return t > c.at ? _capped(m, _capped(c.raw, c.base)) : _capped(m, c.base);","title":"Fall cap is inert until the first poke: over an empty cap state every attestation is accepted raw, not only the first, and the beta deploy never pokes (Q5)"},{"citation":"resolved","description":"From audit_permissions 3e4ba1f1, reproduced. take and takeFloor deliver the last n entries of _seats[owner] at execution time. withdraw (line 296) only needs a wallet unit and holderOf; it does not check whether the holder's position is under auction. A borrower whose position is on sale and who owns a spare seat (perBorrower 3 in BetaConfig) can call deposit(spare), which mints a unit, then withdraw(pledged, self), which burns it and unlists the pledged seat. The position still holds 1e18 units and the auction stays live. take then releases the spare to the taker, who priced the sale on seatsOf(owner) and cannot bind tokenIds in take(id, maxPrice). Solvency is not affected, because the oracle prices all seats alike and the header (lines 29-31, 60-62) declares units fungible among a holder's seats. The taker gets a seat that was never pledged, possibly a less valuable one, and the borrower keeps the one they wanted to keep. The same swap can front-run takeFloor and change which seat the Treasury keeps. Smallest fix: refuse withdraw while any of the holder's positions has a live auction (the join knows auctions by position id; the Ledger's cancel hook already exists). Or let take/takeFloor take the expected tokenIds (or a hash of the list) and revert on mismatch.","line":505,"path":"src/seats/SeatJoin.sol","reproduction":"Harness test (inherits test/unit/Seats.t.sol, so it cannot go in the self-contained proof field): alice pledges seat 1 (debt 1,500 imdUSD), the median and spot crash to 1.6 ETH, and liquidator.liquidate(id) opens the auction. seatsOf(alice)[0] == 1. Alice calls seatJoin.deposit(2) then seatJoin.withdraw(1, alice). Bob calls seatJoin.take(id, max). Expected: nft.ownerOf(1) == bob. Actual: ownerOf(1) == alice and ownerOf(2) == bob. Source:\n// SPDX-License-Identifier: MIT\npragma solidity 0.8.26;\n\nimport {SeatsTest} from \"../unit/Seats.t.sol\";\nimport {SeatAccount} from \"../../src/seats/SeatAccount.sol\";\nimport {_pid} from \"../utils/Pid.sol\";\n\ncontract ProofHarness is SeatsTest {\n    function test_proof_borrowerSwapsPledgedSeatBeforeTake() public {\n        _pledge(alice, 1, 1_500e18);\n        _crash();\n        uint256 id = _pid(SEAT, alice);\n        liquidator.liquidate(id);\n        assertEq(seatJoin.seatsOf(alice)[0], 1, \"taker prices seat 1\");\n        vm.startPrank(alice);\n        seatJoin.deposit(2);\n        seatJoin.withdraw(1, alice);\n        vm.stopPrank();\n        _cash(bob, 5_000e18);\n        vm.startPrank(bob);\n        usd.approve(address(seatJoin), type(uint256).max);\n        seatJoin.take(id, type(uint256).max);\n        vm.stopPrank();\n        emit log_named_address(\"owner of seat 1 (pledged)\", nft.ownerOf(1));\n        emit log_named_address(\"owner of seat 2 (never pledged)\", nft.ownerOf(2));\n        assertEq(nft.ownerOf(1), bob, \"taker should receive the seat that was pledged\");\n    }\n\n    function test_proof_syncOfSeatCollectionBooksUnpayableCredit() public {\n        vm.prank(alice);\n        SeatAccount acct = SeatAccount(seatJoin.deposit(1));\n        acct.sync(address(nft));\n        emit log_named_uint(\"reported[nft]\", acct.reported(address(nft)));\n        emit log_named_uint(\"owed[1][nft][alice]\", seatJoin.owed(1, address(nft), alice));\n        vm.expectRevert(SeatAccount.SendFailed.selector);\n        seatJoin.collect(1, address(nft), alice);\n        assertEq(nft.ownerOf(1), address(acct));\n        assertEq(seatJoin.owed(1, address(nft), alice), 0, \"the seat is custody, not a reward: no credit\");\n    }\n}\n\nOutput: '[FAIL: taker should receive the seat that was pledged: 0x328809Bc894f92807417D2dAD6b7C998c1aFdac6 != 0x1D96F2f6BeF1202E4Ce1Ff6Dad0c2CB002861d3e] test_proof_borrowerSwapsPledgedSeatBeforeTake() (gas: 3509268) Logs: owner of seat 1 (pledged): 0x3288...(alice); owner of seat 2 (never pledged): 0x1D96...(bob)'.","severity":"low","snippet":"        uint256[] storage list = _seats[owner];\n        for (uint256 i; i < n; ++i) {\n            uint256 tokenId = list[list.length - 1];\n            _unlist(tokenId, owner);\n            SeatAccount(_accountFor(tokenId, false)).release(msg.sender);","title":"A borrower under auction can swap the pledged seat for another one in the same block: take delivers whatever seats end the owner's list (Q1/Q2)"},{"citation":"resolved","description":"From audit_permissions d56d2783, reproduced. claim refuses target == nft, but sync has no such guard, and ERC-721 balanceOf(address) shares the ERC-20 selector. sync(address(nft)) on an account that holds its seat (plus any strays) reads 1, sets reported[nft] = 1 and credits owed[tokenId][nft][holder] = 1. collect then calls nft.transfer(address,uint256). The IDMD collection (BetaConfig IDMD 0x0000eC93127BAA929E58E97dd0095A2BFb38ec1D) has no such function: eth_getCode on chain 1 returns 10,464 hex chars with PUSH4 0x23b872dd and 0x6352211e but no 0xa9059cbb. So collect reverts SendFailed. The result is a credit with nothing payable behind it and a misleading Rewarded event, not a custody bypass. On a collection that did implement transfer(address,uint256), collect would move the seat out of custody. Fix: in sync, revert when token == address(nft) or token == join.","line":201,"path":"src/seats/SeatAccount.sol","reproduction":"Same harness file as the previous finding: alice deposits seat 1, and anyone calls acct.sync(address(nft)). Logs: reported[nft] = 1, owed[1][nft][alice] = 1. collect(1, nft, alice) reverts SendFailed, and the seat stays in the account. Output: '[FAIL: the seat is custody, not a reward: no credit: 1 != 0] test_proof_syncOfSeatCollectionBooksUnpayableCredit() (gas: 528492)'.","severity":"info","snippet":"    function sync(address token) public {\n        uint256 bal = IERC20(token).balanceOf(address(this));\n        uint256 seen = reported[token];\n        if (bal <= seen) return;\n        reported[token] = bal;\n        ISeatJoinForAccount(join).onRewards(tokenId, token, bal - seen);","title":"SeatAccount.sync accepts the seat collection itself and books a credit that can never be paid (Q4)"},{"citation":"resolved","description":"(1) SeatJoin.sol:33 says the auction starts at 'the raw 7-day median'. _open (line 402) uses SeatFeed.medianUsd(), the fall-capped median, as lines 68 and 389-391 say (merged: audit_flow 5b450431, audit_permissions 05f2fecf). (2) SeatJoin.sol:53-54 and 456 ('pauses the sale instead of running it to the floor unseen'; 'the clock only ever runs slow, never fast'): false for a late-relayed attestation (medium finding above). (3) SeatFeed.sol:50-53 ('an unpoked fall is capped harder ..., never looser'): false before the first poke (low finding above). (4) SeatFeed.sol:30-31 says the ring slot holds 'the raw USD median first poked that day'. poke (line 219) stores medianUsd(), the fall-capped median. (5) SeatFeed.sol:18 and 39 ('a rise never loosens'; 'the trend term already keeps a rise from loosening the LTV'): trend only keeps factor <= 1. A median rise raises latestValue 1:1, bounded only by the leaf's epoch cap (30%, up to 2x after staleness), and the later fall back is throttled at 20% per attestation (audit_permissions f999d444). (6) SeatFeed.sol:35-38 and README trust model: the per-update cap is stated as the bound on the seat price, but the factor is not under it. The figure is unbounded (medium finding above). The trend term, computed in USD, compounds a capped 20% median step into a 36% value step (0.8 x 0.8), and an ETH/USD move enters both through ethUsd and through trend (audit_math 8c5e3dc2; design question, not a separate defect). (7) SeatJoin.sol:616 calls lastHolder 'the operator who earned it'. Credit goes to whoever holds the seat when the arrival is REPORTED (header lines 42-44): a taker who re-deposits and syncs in the same transaction is credited unreported arrivals from the previous tenure (audit_flow 397f53ef; documented behaviour, so the comment overclaims). (8) SeatAccount.sol:170-171 'once': agentId is never cleared on release/bump, so a later holder can never re-register (AlreadyRegistered) while the previous holder's URI stays bound (audit_permissions 5442909f; whether that matters depends on the off-chain registry).","line":33,"path":"src/seats/SeatJoin.sol","reproduction":"(1) Median attested 2 ETH, then 1.2 ETH, at ETH $2,000: rawMedianUsd() == 2400e18 but medianUsd() == 3200e18, and an auction opened then has price(id) == 3200e18 (the test suite's test_auctionWithBadDebt also shows the stepped acceptedMedian). (4) poke() writes ring[today].value = medianUsd(), line 219-224. (5) median 2 -> 2.6 ETH: latestValue 4000e18 -> 5200e18, trend() == 1e18. (2) and (3) are reproduced by the tests in the findings above.","severity":"info","snippet":"/// SALE. `Liquidator.bite` opens a Dutch auction: the raw 7-day median, decaying to","title":"NatSpec and comments that claim properties the code does not have"},{"citation":"resolved","description":"ANSWERS.\nQ1 CUSTODY: holds, except the low finding (the pledged seat can be swapped out before a take).\n- deposit: SeatJoin calls nft.transferFrom(msg.sender, account, id), so only the token's owner (with SeatJoin approved) can deposit, and ownerOf == account is checked afterwards. holderOf is set to msg.sender and one unit is minted.\n- withdraw: needs holderOf == msg.sender and burns one wallet unit, so a seat you do not hold cannot be taken.\n- onPositionTransfer: onlyLedger. It moves n seats with the position, within perBorrower, and bumps each seat's epoch.\n- rescue: governor only. It refuses an account's own seat while holderOf != 0, and SeatAccount.rescue refuses its own tokenId.\n- Units are not counted twice. _settle retires exactly n x UNIT: the pool is set to poolBefore - n x UNIT, the treasury and marker cut units are restored, and totalSupply -= n x UNIT. takeFloor mints n x UNIT to the Treasury for the n seats it _assigns. seatCount moves only on deposit/withdraw/take and across the Treasury boundary.\n- The invariant 'wallet + Ledger units == 1e18 x seats' holds through the swap scenario, which is why the swap is a taker-facing low and not a custody break.\nQ2 AUCTION: FINDING (medium): a late-relayed attestation runs the clock through stale hours. Otherwise holds:\n- _price decays linearly from startPrice to 0.7 x startPrice over 6 h of priced time (mulDiv, no overflow).\n- take pays n x p. Liquidator.settle re-checks unhealthy and the sequencer grace. liquidatePosition settles the bound version's debt and chop: chop is read from position(id).version before settling, so penalty = repaid x chop matches.\n- takeFloor needs run >= AUCTION_TIME, a fresh raw spot >= p, and the budget.\n- open: Liquidator only. It replaces only an expired auction.\n- reopen: on a live auction it needs the floor plus a newer attestation; on an expired one, priced and unhealthy.\n- cancel: needs healthy-and-priced, or no debt.\n- AUCTION_LIFE 24 h < maxAge 26 h.\n- Dropped lead (audit_permissions 8fec9b3b, a borrower's reopen front-runs a take at the floor): the restart is at the protocol's own current fall-capped median. Every taker valuing the seats between median and floor can take during the 6 h decay. Restarting a stuck sale from a fresh median is the stated purpose of reopen and of the life limit, and the README known issue covers decay not reaching the raw spot when the cap binds. No value is lost, so this is not a defect.\nQ3 SEAT ACCOUNT: holds.\n- authorizeWorker: onlyHolder. The struct is checked (wallet == this, tokenId, unexpired, account owns the seat), the digest is computed on-chain, and the pairing is stored with epoch = custodyEpoch.\n- isValidSignature: VALID only for a stored, unexpired digest of the current epoch while the account owns the seat, so no Permit or order can validate.\n- Every custody change bumps the epoch: release on withdraw/take/rescue-own, and bump in _assign (onPositionTransfer, takeFloor, Treasury transfer). No pairing survives a custody change.\n- send: onlyJoin, with SEND_GAS 1,000,000 and a strict return check. A shortfall in caller gas makes the call fail and revert, and the credit stays.\n- registerAgent: once per account. See NatSpec item (8).\n- release/bump/rescue/initialize: onlyJoin.\nQ4 REWARDS: holds, apart from the info finding (sync(nft) dangling credit).\n- onRewards accepts only accountOf(tokenId). It credits holderOf, else lastHolder (set in _unlist), else the Treasury.\n- sync reports only the balance above `reported`, and send lowers `reported` by what leaves, so for a standard token every credit has balance behind it.\n- collect zeroes the credit before paying and takes the yieldFee in kind (none on the Treasury's own credit).\n- Custody never moves reward tokens.\n- Credit-at-report-time is documented (header lines 42-44). See NatSpec item (7).\nQ5 SEAT FEED: FINDING (medium): the figure is uncapped. FINDING (low): the cap is inert before the first poke. Otherwise holds:\n- _capped bounds a fall at 20%","line":64,"path":"src/seats/SeatJoin.sol","reproduction":"Not a defect: the numbered answers and coverage rows are the deliverable for the questions where nothing else is wrong. Each 'holds' row was checked by reading the code path named; the reproduced findings above carry their own tests.","severity":"info","snippet":"contract SeatJoin is TransientReentrancyGuard, IHolderJoin, IAuctionJoin {","title":"Answers to Q1-Q5, coverage of every external function in scope, and specialist leads dropped"}],"hash":"51e58170b83810861a0ec831f89c9816ed9e53e685b3143b6da2716c1a2eaf86","nodeId":"34ac85d2-51f7-488e-8ea8-adc29ae4ac98","outcome":"completed","summary":"I've finished the review and written it to `.imd-findings.json` (7 entries). Every finding I kept was reproduced against the code with a Foundry test. I merged the specialists' duplicates and dropped two of their findings that didn't hold up.\n\n**Findings**\n\n| Sev | Where | What |\n|---|---|---|\n| medium | `src/seats/SeatJoin.sol:470` (and 476-478) | **Auction clock runs during stale hours.** `_elapsed` measures the auction's priced time from the attestation's signed `issuedAt`, but `SwarmFeed` accepts an attestation up to 26 h after it was issued. When a held attestation is relayed after the median went stale, the stale hours count as priced time and the price drops to the 0.7× floor in that block. In the proof, elapsed reads 39,600 s instead of 3,600 s and the price is 2,100 instead of 2,850. The borrower can lose up to 30% of the seat value. This contradicts the comments at lines 53-54 and 456. Three specialists reported this; their proofs fail as described. |\n| medium | `src/feeds/SeatFeed.sol:168` | **The `liquidity` term has no cap.** It is read straight from the attestation's signed figure (the 7-day count of seats sold), which nothing bounds. One attestation with an unchanged price and the figure going from 150 to 10 cuts both price legs from 4000e18 to 400e18, a 90% drop. Neither the 20% fall cap nor the 30% per-epoch cap sees it. Two specialists reported this; both proofs fail. |\n| low | `src/feeds/SeatFeed.sol:120` | **Fall cap does nothing until someone calls `poke()`.** The beta deploys the seat feeds empty and nothing in `script/` calls `poke()`. Until the first poke, every attestation is accepted unchanged, not just the first: a fall to 1e18 reads 1e18 where the cap should give 1.6e18. With a poke in between, the cap works. |\n| low | `src/seats/SeatJoin.sol:505` | **Borrower can swap the pledged seat before a sale.** With a position on sale, the borrower can deposit a spare seat and withdraw the pledged one in the same block. `take` then hands the buyer a seat that was never pledged. |\n| info | `src/seats/SeatAccount.sol:201` | **`sync(nft)` creates a reward credit that can't be paid.** Calling it with the seat collection's own address books a credit of 1. I checked the IDMD collection's bytecode on mainnet: it has no `transfer(address,uint256)`, so `collect` reverts and the credit just sits there. |\n| info | several files | **8 comments that claim properties the code doesn't have.** For example, `SeatJoin.sol:33` says the auction starts at the \"raw\" median, but it starts at the fall-capped one. |\n| info | — | Answers to Q1-Q5 and a coverage row for every external function of `SeatJoin`, `SeatAccount`, `SeatFeed` and `SeatSpotLeg`. |\n\n**Answers in brief:** custody (Q1) holds apart from the seat swap, and units are never counted twice. The seat account (Q3) holds: every change of custody kills existing worker authorisations. Rewards (Q4) hold apart from the `sync(nft)` credit. The auction (Q2) and seat feed (Q5) problems are the findings above.\n\n**Dropped specialist findings:**\n- *`Liquidator.settle` skipping the bad-debt cover holds the brake:* the brake already subtracts the Treasury's imdUSD balance (`LedgerBase.sol:223-227`), so it doesn't engage while the Treasury could pay. That file is also out of scope.\n- *Borrower can reopen an auction to block a take:* the restart is at the protocol's own current median and nothing is lost.\n\n**Proofs and runs:**\n- The three self-contained proofs (the two medium findings and the poke finding) are embedded in the JSON.\n- The seat-swap and `sync(nft)` tests reuse the existing `Seats.t.sol` test setup, so I pasted their source and output into the reproduction text instead of the proof field.\n- The four panel suites pass on the unchanged tree: 139 passed, 0 failed.\n- Slither and fuzzing were not run; each \"holds\" row in the coverage is from reading the code.\n\n**State of the tree:** I removed `test/scratch` and the `out`/`cache` folders my builds created, and `git diff` is empt","treeHash":null,"usage":{"cachedInputTokens":2206733,"chain":[{"calls":2,"chainId":1,"failed":0,"own":2,"public":0,"refused":0}],"cost":{"source":"runtime","usdMicros":1737679},"inputTokens":46,"model":"claude-opus-5-5","outputTokens":36150,"runtime":"claude","turns":25,"wallClockMs":804449}},{"artifacts":[],"attempt":1,"bundleHash":null,"device":"f9a12c57a094ca8d","findings":[{"citation":"resolved","description":"CUSTODY/AUCTION (questions 1 and 2). `take` and `takeFloor` deliver the last n entries of `_seats[owner]` at execution time, and `withdraw` only requires wallet units and `holderOf`, with no check that the holder's position is under auction. A borrower whose position is on sale and who owns one spare seat (perBorrower is 3 in BetaConfig, so room exists) can, in the block of the taker's `take`: `deposit(spare)` (mints 1e18 units to the wallet, pushes `spare` to the end of the list) then `withdraw(pledged, self)` (burns that unit, unlists the pledged seat). The position still holds 1e18 units, the auction stays open, and `take` releases `spare` to the taker. The taker inspected `seatsOf(owner)` and priced seat 1; they pay n x price and receive seat 2. `take(id, maxPrice)` offers no way to bind tokenIds. Protocol solvency is unaffected (the oracle prices every seat at the collection median, and the NatSpec at lines 29-31 and 60-62 states units are fungible among a holder's seats), so this is taker-facing: a sandwich that hands the taker a different, possibly less valuable, seat than the one the auction was opened on, which depresses what takers are willing to bid on seat auctions. Reachable with BetaConfig (25 seats, 3 per borrower). Smallest fix: let `take`/`takeFloor` accept the expected tokenIds (or a hash of the owner's current list) and revert on mismatch; or refuse `withdraw` by a holder while any of their positions has a live auction.","line":505,"path":"src/seats/SeatJoin.sol","reproduction":"State: alice holds seats 1 and 2; seat 1 deposited and pledged (position collateral 1e18, debt 1,500 imdUSD at median 2 ETH x $2,000); seat 2 in her wallet. Median and spot fall to 1.6 ETH; keeper calls liquidator.liquidate(id): auction opens. bob reads seatsOf(alice) == [1]. In the same block, before bob's take: alice calls seatJoin.deposit(2) then seatJoin.withdraw(1, alice). Then bob calls seatJoin.take(id, type(uint256).max). Expected: bob receives seat 1 (the pledged seat, the one on the list when he priced the sale). Actual: nft.ownerOf(1) == alice, nft.ownerOf(2) == bob; n == 1, the position is closed, alice keeps seat 1. Proof below fails on this commit with: taker should receive the seat that was pledged: 0x3288... (bob) != 0x1D96... (alice).\n\n$ forge test --match-path 'test/scratch/ProofSeatSubstitution.t.sol' -vv\nRan 1 test for test/scratch/ProofSeatSubstitution.t.sol:ProofSeatSubstitutionTest\n[FAIL: taker should receive the seat that was pledged: 0x328809Bc894f92807417D2dAD6b7C998c1aFdac6 != 0x1D96F2f6BeF1202E4Ce1Ff6Dad0c2CB002861d3e] test_takerReceivesASeatThatWasNeverPledged() (gas: 3519604)\nSuite result: FAILED. 0 passed; 1 failed; 0 skipped","severity":"low","snippet":"        uint256[] storage list = _seats[owner];\n        for (uint256 i; i < n; ++i) {\n            uint256 tokenId = list[list.length - 1];\n            _unlist(tokenId, owner);\n            SeatAccount(_accountFor(tokenId, false)).release(msg.sender);\n        }","title":"Auction delivers whichever seats end the owner's list at take: the borrower can swap the pledged seat out of the sale in the same block"},{"citation":"resolved","description":"AUCTION (question 2: block a sale). The non-expired branch of `reopen` needs only (a) the auction at the floor (6h of priced time) and (b) any median attestation newer than `startAt`; the median is refreshed daily (SEAT_MAX_AGE 26h in BetaConfig), so (b) holds for most of an auction's life. It is callable by anyone, including the borrower, and `_open` rewrites `startPrice` to today's fall-capped median, `startAt`, `lastTick` and `ran = 0`. Consequences: (1) a taker's `take(id, floor)` can be front-run by the borrower's `reopen`, which lifts `price(id)` from 0.7 x start back to the (new) median and makes the take revert `PriceAboveMax`; the sale is pushed back by up to AUCTION_TIME (6h) per attestation, repeatable every day the market sits between floor and median. (2) because `ran` resets, an auction reopened each day never reaches AUCTION_LIFE, so the 'void after 24h priced time' guarantee in the header (lines 54-56) does not hold for a borrower who keeps reopening. No price is lost by the protocol (the restart is at the median), so impact is delay and taker griefing. Reachable with BetaConfig. Smallest fix: restrict the floor-reopen path to `marker`/liquidator or to callers other than the position owner, or require the new median to be strictly higher than `a.startPrice` so a reopen can only raise a stuck sale, and keep `ran` across a reopen for the life check.","line":559,"path":"src/seats/SeatJoin.sol","reproduction":"State: position id on auction, start 3,200 USD, 6h of priced time elapsed (price 2,240). A newer median attestation lands (updatedAt > startAt). Taker bob submits take(id, 2_240e18). Borrower alice front-runs with reopen(id). Expected (header lines 49-56): the sale proceeds at the decayed price, and after 24h priced time the auction is void. Actual: price(id) returns the current median (3,200 if unchanged), bob's take reverts PriceAboveMax(); elapsed(id) == 0; after another 6h at the floor and the next day's attestation alice can repeat; expired(id) never becomes true while she does.\n\nConfirmed by a scratch test (test_borrowerReopenFrontRunsTakeAtTheFloor, PASS on this commit): after 6h price(id) == 2,240e18 and elapsed(id) == 6 hours; the daily median refresh lands; alice calls reopen(id); price(id) == 3,200e18, elapsed(id) == 0; bob's take(id, 2_240e18) reverts PriceAboveMax().","severity":"low","snippet":"        } else {\n            if (_elapsed(a) < AUCTION_TIME) revert NotAtFloor();\n            (, uint64 at) = _feed().median().latestValue();\n            if (at <= a.startAt) revert NothingNew();\n        }\n        _open(id, a.marker);","title":"Permissionless reopen at the floor lets the borrower reset a sale to the full median ahead of a take and keeps AUCTION_LIFE from ever voiding it"},{"citation":"resolved","description":"REWARDS (question 4: a credit with nothing behind it). `claim` refuses `target == address(nft)` but `sync` has no such guard, and ERC-721 `balanceOf(address)` shares the selector of ERC-20 `balanceOf`. `sync(address(nft))` on an account holding its seat reads bal == 1, sets reported[nft] = 1 and credits owed[tokenId][nft][holder] = 1 (`Rewarded` emitted). `collect(tokenId, nft, holder)` then calls `send(nft, holder, 1)` which issues `nft.transfer(address,uint256)`. The IDMD collection at 0x0000eC93127BAA929E58E97dd0095A2BFb38ec1D (BetaConfig IDMD) has no such function (its runtime bytecode contains no 0xa9059cbb selector; checked with cast code), so the call reverts and `collect` reverts SendFailed: on mainnet the result is only a dangling credit and a misleading event. On a collection that did implement `transfer(address,uint256)` (several pre-final ERC-721 drafts do), `collect` would move token id 1 out of the account for the account whose seat is id 1, bypassing custody. Smallest fix: in `sync`, `if (token == address(nft)) revert ClaimNotAllowed();` (and optionally refuse `token == join`).","line":202,"path":"src/seats/SeatAccount.sol","reproduction":"State: alice deposited seat 1 (account A = accountOf(1), nft.ownerOf(1) == A). Anyone calls A.sync(address(nft)). Expected: no credit (the seat is custody, not a reward). Actual: A.reported(address(nft)) == 1 and seatJoin.owed(1, address(nft), alice) == 1, event Rewarded(1, nft, alice, 1). seatJoin.collect(1, address(nft), alice) reverts SendFailed (no transfer(address,uint256) on the IDMD collection); the credit stays forever.\n\nConfirmed by a scratch test (test_syncOfTheSeatCollectionCreatesAnUnpayableCredit, PASS on this commit): acct.reported(nft) == 1, seatJoin.owed(1, nft, alice) == 1, collect(1, nft, alice) reverts SendFailed(), the seat stays in the account.","severity":"info","snippet":"        uint256 bal = IERC20(token).balanceOf(address(this));\n        uint256 seen = reported[token];\n        if (bal <= seen) return;\n        reported[token] = bal;\n        ISeatJoinForAccount(join).onRewards(tokenId, token, bal - seen);","title":"SeatAccount.sync accepts the seat collection itself as a reward token and books a 1-unit credit that nothing can pay"},{"citation":"resolved","description":"Documentation claim that the code does not have. `_open` (line 402) reads `SeatFeed.medianUsd()`, which is `acceptedMedian()` (fall-capped at 20% per attestation) times ETH/USD, not the raw median (`rawMedianUsd()`). Lines 68 and 389-391 describe it correctly. After a crash the opening price is above the raw median by design (README known issue), so a reader of the header would mis-estimate where a sale starts. Fix: change 'the raw 7-day median' to 'the fall-capped 7-day median (`SeatFeed.medianUsd`)'.","line":33,"path":"src/seats/SeatJoin.sol","reproduction":"Median attested 2 ETH then 1.2 ETH (a 40% fall) with ETH at $2,000: rawMedianUsd() == 2,400 but medianUsd() == 3,200 (capped at 0.8 x 4,000). liquidate(id) then price(id) == 3,200, not 2,400 as the header states.","severity":"info","snippet":"/// SALE. `Liquidator.bite` opens a Dutch auction: the raw 7-day median, decaying to\n/// AUCTION_FLOOR x median over AUCTION_TIME.","title":"NatSpec says the auction opens at the raw 7-day median; _open uses the fall-capped median"},{"citation":"resolved","description":"SEAT FEED (question 5), an asymmetry to document rather than a bug. `trend()` is min(1, now/past), so it only stops `factor` exceeding 1; it does not stop `latestValue` from rising with the median. Falls are capped at 20% per attestation here, rises are not capped here at all; the only bound on a rise is SwarmFeed's per-epoch deviation (SEAT_MEDIAN_CAP_BPS 3,000 = 30% per 26h epoch, widened up to 2x after an hour of staleness). So one attestation can lift borrowing power on every seat position by 30% (60% after staleness), and the following fall back to the true level is then throttled to 20% per attestation, leaving liquidations priced above market for several days. This is inside the README trust model for a compromised attester, but the comment 'a rise never loosens' (also line 18) is not what the code enforces. Fix: reword to 'the trend term keeps `factor` at or below 1; a rise in the median itself is bounded only by the leaf's per-epoch cap', or apply a symmetric rise cap if that is wanted.","line":39,"path":"src/feeds/SeatFeed.sol","reproduction":"Median 2 ETH, ETH $2,000, factor 1: latestValue() == 4,000. One attestation at 2.6 ETH (+30%, allowed by the 30% epoch cap): latestValue() == 5,200 immediately, trend() == 1, so a position may borrow 30% more. Next attestation back at 2 ETH: acceptedMedian() == 2.08 ETH (5,200 x 0.8 = 4,160), not 4,000.","severity":"info","snippet":"/// attestation steps from: a real 40% crash lands at 0.8, then 0.64, then 0.6. No time-based wait. Rises\n/// pass through uncapped (the trend term already keeps a rise from loosening the LTV). Only the median leg:","title":"SeatFeed header claims a rise never loosens; a rising median raises the priced value 1:1 and only the SwarmFeed epoch cap bounds it"},{"citation":"resolved","description":"SEAT ACCOUNT (question 3), a trust-gap note. Pairings are retired by `custodyEpoch` on every custody change, but the ERC-8004 registration is not: `agentId` is set once and never cleared, and the account has no function to update or move the agent. After a liquidation (`take`) and a re-deposit by the new owner, or after a position transfer (`onPositionTransfer`), the new holder calls `registerAgent` and gets `AlreadyRegistered`; the agent registered by the previous holder, with the previous holder's `agentURI`, stays bound to this account (the account, not the holder, is `msg.sender` to the adapter). Whether that lets the old holder keep serving as the seat's agent depends on the registry's semantics, which are off-chain to this review and not verified here; on-chain the asymmetry with the pairing design (header lines 24-29) is clear. Smallest fix: clear `agentId` in `release`/`bump` (if the registry allows re-registration) or expose a holder-only `setAgentURI` passthrough.","line":172,"path":"src/seats/SeatAccount.sol","reproduction":"alice deposits seat 1, calls registerAgent('ipfs://alice'); agentId == 100. Her position is liquidated and bob takes the seat, then deposits it again (holderOf(1) == bob). bob calls registerAgent('ipfs://bob'). Expected: the new holder can (re)register the seat's agent. Actual: revert AlreadyRegistered(); agentId stays 100 with alice's URI.\n\nConfirmed by a scratch test (test_registerAgentSurvivesLiquidationAndRedeposit, PASS on this commit): alice registers (agentId 100); bob takes the auction and re-deposits seat 1 (holderOf(1) == bob); bob's registerAgent reverts AlreadyRegistered(); agentId stays 100.","severity":"info","snippet":"    function registerAgent(string calldata agentURI) external onlyHolder returns (uint256 id) {\n        if (agentId != 0) revert AlreadyRegistered();","title":"registerAgent is once per account for the seat's whole life; a later holder cannot register or change the agent"}],"hash":"ef0b8f2b51b66e56ae01762ec030144335446b94c507487a900ca4d3c2225dac","nodeId":"04235c6d-6164-4fca-87c4-c0cdef80fc6f","outcome":"completed","summary":"Review complete. The findings file holds 6 entries (2 low, 4 info); scratch tests are deleted and the tree is unchanged apart from `.imd-findings.json`. The required panel suite passed: 139 tests, 0 failures.\n\n## Answers to the numbered questions\n\n**1. Custody.** No way found to take a seat you do not own or to count units twice. Deposit, withdraw, `transferFrom`, `exit`, `onPositionTransfer`, the Treasury's `transfer` and `_settle`'s unit retirement all keep \"wallet + Ledger units = 1e18 x seats held\" per holder, and `rescue` can only move a token that is not any account's deposited seat. The one defect is asymmetry rather than theft: the sale delivers the last n seats on the owner's list at execution time, and `withdraw` does not care that the holder's position is under auction, so a borrower with one spare seat swaps the pledged seat out of a sale in the taker's block (finding 1, low, with a failing proof). Protocol solvency is unaffected because the oracle prices every seat identically.\n\n**2. Auction.** Nothing sells below the intended price and nothing settles the wrong debt. `_elapsed` never counts more than wall-clock time since the last tick, so the decay cannot run fast; `_settle` burns exactly what the Ledger repaid and distributes the remainder in full. One griefing path: the non-expired branch of `reopen` is permissionless and only needs a newer daily attestation, so the borrower can lift a floor-price sale back to the median ahead of a take and reset the life clock every day (finding 2, low, confirmed).\n\n**3. Seat account.** No worker authorisation survives a custody change: every exit path (`release` from withdraw, take and own-token rescue; `bump` from position transfer, Treasury keep and Treasury transfer) advances `custodyEpoch`, and pairings can only be created while the seat is deposited. The stored digest is domain-bound to the collection with name \"IdentityMD Worker\", so it cannot be replayed as a Permit or Seaport order. The agent registration is the asymmetry: it is never retired, so a later holder is refused (finding 6, info).\n\n**4. Rewards.** Credits go to the holder at report time, then `lastHolder`, then the Treasury, as documented, and `send` keeps `reported` consistent. The only credit with nothing behind it is `sync(address(nft))`, which books the ERC-721 balance as a reward; on the mainnet IDMD collection it is unpayable (no `transfer(address,uint256)` selector in its bytecode) so the impact is a dangling credit (finding 3, info).\n\n**5. Seat feed.** The fall cap holds: an equal-time replacement is capped against the same base, unpoked attestations collapse into one step, and the ring picks the newest point at least 30 days old. The price cannot be moved down faster than 20% per attestation. Rises are uncapped in `SeatFeed` and bounded only by the SwarmFeed 30% epoch cap, which the header misdescribes (finding 5, info).\n\n## Coverage\n\n| Function | Result |\n|---|---|\n| SeatJoin `wire`, `setLimits`, `setClaimRule`, `recallBudget` | holds: wirer/params/governor gated; governor powers are instant but only move the join's own budget to the Treasury |\n| `transferFrom`, `transfer`, `exit`, `approve`, `allowance` | holds: Ledger-only pull into the pool, Treasury-only whole-seat payout with `_admit`, fractional exit only inside `_settle` |\n| `deposit`, `withdraw` | finding 1 (withdraw during an auction swaps the delivered seat) |\n| `onPositionTransfer` | holds: perBorrower checked, Treasury refused, epochs bumped |\n| `rescue` | holds: cannot touch a deposited seat |\n| `open`, `tick`, `price`, `elapsed`, `expired` | holds: clock never runs fast, Liquidator-only open |\n| `take`, `takeFloor`, `_settle` | holds for price and debt; finding 1 for which seats are delivered |\n| `cancel` | holds |\n| `reopen` | finding 2 |\n| `claimAllowed`, `onRewards`, `collect` | holds |\n| SeatAccount `initialize`, `authorizeWorker`, `revokeWorker`, `isValidSignature`, `workerAuthorizationDigest` | holds |\n| `registerAgent` | findi","treeHash":null,"usage":{"cachedInputTokens":1998470,"cost":{"source":"runtime","usdMicros":7361570},"inputTokens":482,"model":"claude-fable-5-1","outputTokens":70170,"runtime":"claude","turns":30,"wallClockMs":1727183}},{"artifacts":[],"attempt":1,"bundleHash":null,"device":"45aa937328087de3","findings":[{"citation":"resolved","description":"`_elapsed` (SeatJoin.sol:459-480) reconstructs the Dutch auction's PRICED time from the median leaf's `updatedAt`, which in SwarmFeed is the attestation's signed `issuedAt`, not the block it was relayed in (SwarmFeed.submitAttestation accepts any `issuedAt` within `maxAge`, 26 h in BetaConfig, and keeps the relay block only in a private `_acceptedAt`). In the first branch (`newAt <= freshUntil`) the clock counts `from .. min(t, newAt + life)` as fresh. If the attestation live at the last tick aged out at `freshUntil` and the NEXT attestation has `issuedAt < freshUntil` but was relayed after `freshUntil`, the whole stale gap `[freshUntil, relay]`, during which nobody could read a median and `take` reverted `NotPriced`, is counted as priced time at the moment of the relay. The NatSpec at SeatJoin.sol:456 claims 'the clock only ever runs slow, never fast', and the header (lines 50-54) promises that 'a missed daily refresh pauses the sale instead of running it to the floor unseen'. Both are false on this path. Call sequence from an external caller: (1) Liquidator.bite opens the auction while the live median attestation A0 has about an hour of life left; (2) the daily refresh is missed and the leaf goes stale for N hours (the plane's 10-hour outage of 2026-10-23 is the README's own example); (3) anyone holding an attestation A1 issued before A0 aged out (attestations are bought on demand and relaying is permissionless) relays it after the gap and calls `take` in the same transaction: `price(id)` has jumped from the price at about 1 h of decay to the 70% floor, and the taker settles the position at the floor. The borrower's surplus shrinks by up to 30% of the seats' median value (at the beta's 25 seats x $4,000 that is up to $1,200 per seat). A long enough counted gap (>= 24 h) also voids the auction (`AUCTION_LIFE`) rather than pausing it. Reachable with BetaConfig values (SEAT_MAX_AGE 26 h): any relay delay up to 26 h is accepted by the leaf. Smallest fix: never count time before the current observation for an attestation not yet observed. In the first branch, when `newAt > a.attestedAt` (a refresh landed since the last tick), count only `min(t, freshUntil) - from` for the old window and, as the gap branch already does for the newest attestation, count the new window only from the point it is known to have been readable; since the relay block is not exposed by IFeed, count it from `t` (the clock then runs slow until the next `tick`, which is the documented behaviour) or have SwarmFeed expose `acceptedAt` and use `max(newAt, acceptedAt)` as the window's start. The gap branch (lines 472-479) has the same flaw for the new window: `from2 = max(from, newAt)` counts from the attestation's signed `issuedAt`, so an attestation issued during the gap and relayed hours later also credits the time between its issue and its relay as priced; the fix above covers both branches.","line":470,"path":"src/seats/SeatJoin.sol","proof":"// SPDX-License-Identifier: MIT\npragma solidity 0.8.26;\n\nimport {Test} from \"forge-std/Test.sol\";\nimport {IERC721} from \"@openzeppelin/contracts/token/ERC721/IERC721.sol\";\nimport {SeatJoin} from \"src/seats/SeatJoin.sol\";\nimport {IImdAgentAdapter} from \"src/seats/SeatAccount.sol\";\nimport {SeatFeed} from \"src/feeds/SeatFeed.sol\";\nimport {IFeed} from \"src/interfaces/IFeed.sol\";\nimport {ParametersBase} from \"src/ParametersBase.sol\";\n\n/// @dev A swarm leaf whose `updatedAt` is the attestation's signed `issuedAt`, settable in the past (as SwarmFeed's\n/// `_updatedAt` is: an attestation may be relayed up to `maxAge` after it was issued).\ncontract Leaf is IFeed {\n    uint256 public value;\n    uint64 public at;\n    uint256 public maxAge = 26 hours;\n    uint256 public latestFigure = 150;\n\n    function set(uint256 v, uint64 issuedAt) external {\n        value = v;\n        at = issuedAt;\n    }\n\n    function latestValue() external view returns (uint256, uint64) {\n        return (value, at);\n    }\n\n    function isStale() external view returns (bool) {\n        return value == 0 || block.timestamp - at > maxAge;\n    }\n}\n\ncontract Params {\n    SeatFeed public feed;\n\n    constructor(SeatFeed f) {\n        feed = f;\n    }\n\n    function config(bytes32) external view returns (ParametersBase.Config memory c) {\n        c.median = IFeed(address(feed));\n        c.spot = IFeed(address(feed));\n        c.auction = true;\n    }\n\n    function governor() external pure returns (address) {\n        return address(0xBEEF);\n    }\n}\n\ncontract LedgerStub {\n    address public params;\n    address public liquidator;\n    address public treasury = address(0xCAFE);\n    address public token = address(0xD0D0);\n\n    constructor(address p, address l) {\n        params = p;\n        liquidator = l;\n    }\n}\n\ncontract ProofSeatClockRunsFast is Test {\n    Leaf median;\n    Leaf spot;\n    Leaf ethUsd;\n    SeatFeed feed;\n    SeatJoin join;\n    uint256 constant T0 = 1_800_000_000;\n\n    function setUp() public {\n        vm.warp(T0);\n        median = new Leaf();\n        spot = new Leaf();\n        ethUsd = new Leaf();\n        median.set(2e18, uint64(T0)); // attestation A0 issued and relayed at T0\n        spot.set(2e18, uint64(T0));\n        ethUsd.set(2000e18, uint64(T0));\n        feed = new SeatFeed(median, spot, ethUsd);\n        Params p = new Params(feed);\n        LedgerStub l = new LedgerStub(address(p), address(this)); // this test is the \"liquidator\"\n        join = new SeatJoin(\"SEAT\", IERC721(address(0xAAAA)), IImdAgentAdapter(address(0xBBBB)), address(this), 25, 3);\n        join.wire(address(l));\n    }\n\n    /// The header of `_elapsed` says: \"the clock only ever runs slow, never fast\". A median attestation issued before\n    /// the live one aged out but relayed after it did (SwarmFeed accepts any `issuedAt` within `maxAge`) makes the\n    /// priced clock count the whole stale gap as priced time: the auction jumps from 1 hour of decay to the floor.\n    function test_lateRelayCountsStaleGapAsPricedTime() public {\n        vm.warp(T0 + 25 hours); // A0 has one hour of life left\n        join.open(1, address(0x1111));\n        uint256 start = join.price(1);\n        assertEq(start, 4000e18);\n\n        vm.warp(T0 + 26 hours); // A0 ages out: 1 hour of priced time ran\n        assertEq(join.elapsed(1), 1 hours);\n        ethUsd.set(2000e18, uint64(T0 + 26 hours));\n\n        vm.warp(T0 + 38 hours); // 12 hours with no readable median: the clock is paused\n        assertTrue(median.isStale());\n        assertEq(join.elapsed(1), 1 hours, \"paused while stale\");\n        uint256 pausedPrice = join.price(1);\n\n        // An attestation issued at T0+20h (inside A0's window) is relayed now, 18 hours after it was signed.\n        median.set(2e18, uint64(T0 + 20 hours));\n        ethUsd.set(2000e18, uint64(T0 + 38 hours));\n        assertFalse(median.isStale());\n\n        // Expected: at most the hour that ran before the gap (plus nothing: the relay just landed).\n        // Actual on this commit: 13 hours, the 12-hour stale gap is counted and the price is at the floor.\n        uint256 ran = join.elapsed(1);\n        emit log_named_uint(\"priced seconds counted\", ran);\n        emit log_named_uint(\"price before the relay\", pausedPrice);\n        emit log_named_uint(\"price after the relay\", join.price(1));\n        assertLe(ran, 1 hours, \"the clock ran during the stale gap\");\n        assertEq(join.price(1), pausedPrice, \"the sale price fell while nobody could read a median\");\n    }\n}","reproduction":"State: median leaf A0 issued/relayed at T0 (value 2e18 wei, maxAge 26 h), ETH/USD 2000e18. At T0+25h the Liquidator opens the auction (startPrice $4,000). At T0+26h A0 ages out: elapsed = 3,600 s, price $3,800. At T0+38h the leaf is stale, elapsed still 3,600 s, price still $3,800 (paused). Input: relay an attestation with the same value and issuedAt = T0+20h. Expected: elapsed <= 3,600 s and price $3,800 (the gap is not priced time). Actual: elapsed = 46,800 s (13 h), price = $2,800 (the floor), i.e. the 12-hour stale gap was counted. Run: forge test --match-path test/scratch/ProofSeatClockRunsFast.t.sol -vv -> [FAIL: the clock ran during the stale gap: 46800 > 3600] test_lateRelayCountsStaleGapAsPricedTime(); Logs: priced seconds counted: 46800; price before the relay: 3800e18; price after the relay: 2800e18.","severity":"medium","snippet":"            uint256 end = Math.min(t, Math.max(freshUntil, uint256(newAt) + life));","title":"Seat auction's priced clock counts a stale gap as priced time when a late-relayed median attestation lands: the sale decays to the floor unseen"},{"citation":"resolved","description":"Both legs the Pricer reads for SEAT (`SeatFeed.latestValue`, line 237, and `SeatSpotLeg.latestValue`, line 263) are `price x factor`, with `factor = liquidity x trend` and `liquidity = min(1, figure / 100)`. The figure is the attestation's second signed number; `SwarmSeatFeed._onFigure` (src/feeds/SwarmFeeds.sol:111) stores it with no bound, while SwarmFeed's deviation guard and SeatFeed's 20% fall cap apply to the VALUE only. The README trust model (line 155) states that a compromised attester 'can move those feeds within the cap per epoch', and the SeatFeed header (lines 35-40) describes the 20%-per-update fall cap as the wash-trade fix. For the seat type neither bound holds: a single attestation with an unchanged price and a figure of 10 (or 1, or 0) multiplies both priced legs by 0.1 (0.01, 0), so every seat position becomes unhealthy at once (0 reads as unpriced, which freezes the type instead). Because both legs carry the same factor, the Pricer's skew check (`agree`) does not catch it, and the fall cap sees no fall (`acceptedMedian` is unchanged). The harm to borrowers: `Liquidator.bark`/`bite` open auctions whose start price is `medianUsd()` WITHOUT the factor, so the seats sell near their real value and the borrower loses the 10% penalty (`chop`) on the whole debt plus the Dutch discount up to 30%; at the beta's limits (25 seats, $4,000, 40k line) that is up to about $4,000 of penalty and $30,000 of discount across the type from one attestation, where the trust model promises at most a 30% move per epoch. The same reading also makes the value jump UP by the figure's rise, loosening LTV past the caps (a figure of 50 to 100 doubles the value in one attestation). An honest figure moves slowly (a 7-day distinct-seat count), so an honest market never needs the jump. Reachable with BetaConfig (SEAT_MEDIAN_CAP_BPS 3,000 bounds the price only; the figure is unbounded). Smallest fix: bound the per-attestation move of the liquidity term as the median is bounded, e.g. keep an accepted figure in SeatFeed stepped at most MAX_FALL_PER_UPDATE_BPS per new attestation (`_capped(figure, acceptedFigure)` in `_record` and `liquidity()`), or cap the figure's move in `SwarmSeatFeed._onFigure` against the previous figure.","line":168,"path":"src/feeds/SeatFeed.sol","proof":"// SPDX-License-Identifier: MIT\npragma solidity 0.8.26;\n\nimport {Test} from \"forge-std/Test.sol\";\nimport {SeatFeed, SeatSpotLeg} from \"src/feeds/SeatFeed.sol\";\nimport {IFeed} from \"src/interfaces/IFeed.sol\";\n\n/// @dev A seat leaf as SwarmSeatFeed exposes it: a value (bounded by the swarm's per-epoch cap, 30% in BetaConfig)\n/// and a signed `figure` (the distinct seats sold) that `_onFigure` stores with no bound at all.\ncontract Leaf is IFeed {\n    uint256 public value;\n    uint64 public at;\n    uint256 public maxAge = 26 hours;\n    uint256 public latestFigure;\n\n    function set(uint256 v, uint256 figure) external {\n        value = v;\n        latestFigure = figure;\n        at = uint64(block.timestamp);\n    }\n\n    function latestValue() external view returns (uint256, uint64) {\n        return (value, at);\n    }\n\n    function isStale() external view returns (bool) {\n        return value == 0 || block.timestamp - at > maxAge;\n    }\n}\n\ncontract ProofSeatFigureUncapped is Test {\n    Leaf median;\n    Leaf spot;\n    Leaf ethUsd;\n    SeatFeed feed;\n    SeatSpotLeg spotLeg;\n\n    function setUp() public {\n        vm.warp(1_800_000_000);\n        median = new Leaf();\n        spot = new Leaf();\n        ethUsd = new Leaf();\n        median.set(2e18, 150); // $4,000 per seat, 150 distinct seats sold: liquidity = 1\n        spot.set(2e18, 150);\n        ethUsd.set(2000e18, 0);\n        feed = new SeatFeed(median, spot, ethUsd);\n        spotLeg = new SeatSpotLeg(feed);\n    }\n\n    /// The trust model bounds a compromised or wrong attestation to the per-epoch cap (30% on the seat leaves, 20%\n    /// per update on the accepted median). The seat type's priced value also carries `liquidity = min(1, figure/100)`,\n    /// and the figure is not capped anywhere: one attestation with the same price and a figure of 10 moves BOTH\n    /// legs the Pricer reads down 90%, so every seat position is unhealthy at once.\n    function test_oneAttestationMovesThePricedValueNinetyPercent() public {\n        (uint256 before,) = feed.latestValue();\n        (uint256 spotBefore,) = spotLeg.latestValue();\n        assertEq(before, 4000e18);\n        assertEq(spotBefore, 4000e18);\n\n        vm.warp(block.timestamp + 1 hours);\n        median.set(2e18, 10); // the price is unchanged, the figure falls from 150 to 10\n        feed.poke();\n\n        (uint256 after_,) = feed.latestValue();\n        (uint256 spotAfter,) = spotLeg.latestValue();\n        emit log_named_uint(\"median leg before\", before);\n        emit log_named_uint(\"median leg after one attestation\", after_);\n        emit log_named_uint(\"spot leg after one attestation\", spotAfter);\n        assertEq(feed.acceptedMedian(), 2e18, \"the fall cap sees no fall at all\");\n        // Expected: no leg falls past the widest cap any swarm leaf allows per epoch (2 x 30% = 60%).\n        assertGe(after_, before * 40 / 100, \"median leg fell past every cap in one attestation\");\n        assertGe(spotAfter, spotBefore * 40 / 100, \"spot leg fell past every cap in one attestation\");\n    }\n}","reproduction":"State: median leaf value 2e18 wei with figure 150, spot leaf 2e18, ETH/USD 2000e18: SeatFeed.latestValue() = 4000e18 and SeatSpotLeg.latestValue() = 4000e18. Input: one new attestation with the same value 2e18 and figure 10, then `poke()`. Expected (per the README trust model and the SeatFeed header): neither leg falls more than the widest allowance any leaf grants per epoch (2 x 30% = 60%), so both legs >= 1600e18. Actual: both legs read 400e18 (a 90% fall in one attestation) while `acceptedMedian()` still reads 2e18 (the fall cap sees no fall). Run: forge test --match-path test/scratch/ProofSeatFigureUncapped.t.sol -vv -> [FAIL: median leg fell past every cap in one attestation: 400000000000000000000 < 1600000000000000000000] test_oneAttestationMovesThePricedValueNinetyPercent(); Logs: median leg before: 4000e18; median leg after one attestation: 400e18; spot leg after one attestation: 400e18.","severity":"medium","snippet":"        uint256 n = ISeatFigure(address(median)).latestFigure();\n        return Math.min(1e18, Math.mulDiv(n, 1e18, FULL_LIQUIDITY));","title":"SeatFeed's liquidity term reads the attestation figure with no cap: one attestation moves the seat type's priced value far past the per-epoch and per-update caps"},{"citation":"resolved","description":"`Liquidator.bite` (line 175 and 184) calls `_cover(ilk, bad)` after every liquidation, and the comment at lines 187-191 explains why: the cover runs in the liquidation's own transaction so the unbacked-supply brake 'sees only what both could not pay'. The auction path `settle` (lines 202-213), which SeatJoin.take and SeatJoin.takeFloor reach through `_settle` (SeatJoin.sol:578), returns `ledger.liquidatePosition(...)` directly and never calls `_cover`, so the bad debt a seat sale books stays in `totalBadDebt` and counts in the global brake (`Ledger._checkBrake`) until a third party calls `Treasury.coverBadDebt(SEAT)`. SEAT is not an edge type, so no sleeve depositor can exit in between; the consequence is the global one the README's 'Global brake beyond sleeve plus Treasury' item describes: new debt on every type stops until the cover runs. Reachable with BetaConfig: a seat position at mat 250% whose seats sell at the 70% floor after a 20%-capped median fall and a liquidity-term fall (see the SeatFeed finding) books bad debt whenever n x price < debt. Smallest fix: in `settle`, after `liquidatePosition` returns, call `_cover(ilk, bad)` as `bite` does (and keep `CoverGasShort`, so a taker cannot starve it).","line":211,"path":"src/Liquidator.sol","reproduction":"State: a seat position with debt D and n seats; the auction is at a price p with n x p < D (bad = D - n x p > 0); the Treasury holds enough imdUSD to cover it. Input: a taker calls SeatJoin.take(id, p). Expected (as for `bite`): `ledger.totalBadDebt()` for SEAT is covered in the same transaction when the Treasury can pay, so `Ledger._checkBrake` sees only what the Treasury could not pay. Actual: `settle` returns without `_cover`; `totalBadDebt` keeps `bad` and borrowing on every type reverts with the brake until anyone calls `Treasury.coverBadDebt(\"SEAT\")`.","severity":"low","snippet":"        _requireUnhealthy(ilk, id);\n        return ledger.liquidatePosition(id, price, msg.sender, marker, reserve);","title":"A seat auction that books bad debt does not cover it in its own transaction: Liquidator.settle skips _cover, so the unbacked brake holds new debt on every type until someone calls coverBadDebt"},{"citation":"resolved","description":"`onRewards` credits an arrival to the holder at the moment the account REPORTS it (`sync`), not at the moment it arrived; the header (lines 42-44) says so, and line 616 calls the between-holders fallback 'the operator who earned it'. The guarantee is weaker than the wording: a seat taken by auction (`take`, line 509 releases it to the taker) or kept by the Treasury can be re-deposited by its new owner before anyone reports the tokens that reached the account during the previous holder's tenure, and `sync` then credits them to the new holder. The taker needs no race: `take`, `deposit` and `sync` fit in one transaction, so the borrower never has the chance to report after the sale, and arrivals that `claim` did not list (a direct distributor payout, an airdrop) move with the seat. The amount is bounded by what sat unreported in the account; the plane pays the account's address, so a borrower whose worker claims through `claim(.., tokens)` is credited at once and loses only arrivals outside that list. Smallest fix: in `take` and `takeFloor` (and `_assign`), have the account report the listed reward tokens before the holder changes (a `sync` loop over a per-seat token list, or let `onRewards` take the holder from a snapshot the join records at every custody change).","line":619,"path":"src/seats/SeatJoin.sol","reproduction":"State: Alice holds seat #1 (holderOf = Alice) with a position under auction; 100 REWARD arrived at accountOf(1) by a direct transfer and nobody called sync. Input: Bob calls SeatJoin.take(id, p), then nft.setApprovalForAll(seatJoin), SeatJoin.deposit(1), SeatAccount(accountOf(1)).sync(REWARD) in one transaction. Expected (per 'the operator who earned it'): owed[1][REWARD][Alice] == 100. Actual: owed[1][REWARD][Alice] == 0 and owed[1][REWARD][Bob] == 100, and `collect(1, REWARD, Bob)` pays Bob 90 and the Treasury 10.","severity":"low","snippet":"        address who = holderOf[tokenId];\n        if (who == address(0)) who = lastHolder[tokenId];\n        if (who == address(0)) who = treasury;","title":"Rewards that arrived while the borrower held the seat are credited to whoever holds it when they are reported: a taker can deposit and sync in the same transaction as the sale"},{"citation":"resolved","description":"`_open` (line 402) reads `SeatFeed.medianUsd()`, which is `acceptedMedian()` x ETH/USD: the FALL-CAPPED median, as the Auction struct's comment (line 68), the `open` NatSpec (lines 389-391) and the README's known issue ('When the median's fall cap binds, a seat auction's decay does not continue down to the raw spot') all say. The header sentence at line 33 says 'the raw 7-day median'. The code is the intended behaviour; the sentence is the error.","line":33,"path":"src/seats/SeatJoin.sol","reproduction":"State: accepted median 2e18 after a fall cap bound (raw attested median 1e18, previous accepted 2.5e18, so acceptedMedian() = 2e18 and rawMedianUsd() = 2000e18 at ETH/USD 2000e18). Input: Liquidator opens the auction. Expected per line 33: startPrice = 2000e18 (raw). Actual: startPrice = 4000e18 (fall-capped), as lines 68 and 389-391 describe.","severity":"info","snippet":"/// SALE. `Liquidator.bite` opens a Dutch auction: the raw 7-day median, decaying to","title":"NatSpec: the auction is said to start at 'the raw 7-day median' but opens at the fall-capped median"}],"hash":"ff41f3ce38f7c69ec185a02cffeffcc35f8fc6fdfee3203ce4993263d6ce89a5","nodeId":"98cb5cd8-3d90-4fe0-85ba-bb0a2e349e02","outcome":"completed","summary":"Review complete. The findings file holds 5 entries (2 medium with Foundry proofs, 2 low, 1 info); the scratch tests are deleted and the tree is otherwise unchanged. The panel's four suites were run with solc as required (139 passed, 5m39s).\n\n## Findings\n\n- **Medium. Seat auction clock counts a stale gap as priced time** (`src/seats/SeatJoin.sol:470`, and the gap branch at lines 472-479). SwarmFeed's `updatedAt` is the attestation's signed `issuedAt`, and a relay is accepted up to 26 hours after issue in BetaConfig. When the live attestation ages out and the next one was issued before that but relayed after, the whole unreadable gap is counted at the relay. Proof: auction opened with 1 hour of life left, 12 stale hours, late relay. Expected 3,600 priced seconds and $3,800; actual 46,800 seconds and the $2,800 floor. The NatSpec at line 456 (\"only ever runs slow, never fast\") is false. Fix: count a newly observed attestation's window only from the observation, or expose SwarmFeed's relay time and use max(issuedAt, relayedAt).\n- **Medium. The liquidity figure is uncapped** (`src/feeds/SeatFeed.sol:168`). The swarm deviation cap and the 20% fall cap bound the value only. One attestation with the same price and figure 10 moves both Pricer legs from 4000e18 to 400e18, the skew check passes because both legs carry the factor, and every seat position is liquidatable at once. The README trust-model line that a compromised attester moves feeds \"within the cap per epoch\" does not hold for SEAT. Fix: step an accepted figure at most 20% per new attestation.\n- **Low. `Liquidator.settle` skips `_cover`** (`src/Liquidator.sol:211`), so bad debt from a seat sale holds the global brake until someone calls the Treasury cover. Reached from `take` and `takeFloor`.\n- **Low. Rewards credited at report time** (`src/seats/SeatJoin.sol:619`). A taker can take, deposit and sync in one transaction and receive arrivals from the borrower's tenure; line 616's \"the operator who earned it\" overstates the guarantee.\n- **Info.** Line 33 says the auction starts at the raw median; it starts at the fall-capped one.\n\n## Numbered questions\n\n1. **Custody: holds.** Units move only through the Ledger (`transferFrom` into the pool, `exit` to the owner), the holder-bound check in `Ledger._adjust` blocks pledges by non-owners including `addFor`, and every unlist/assign path keeps wallet plus Ledger units equal to seats listed. `onPositionTransfer` moves the last n seats within the receiver's limit, `_settle` retires exactly n units and resets the cut recipients, and `takeFloor` re-mints n units to the Treasury. `rescue` can only move a token that is not a held deposit. I could not take a seat I did not own or count units twice.\n2. **Auction: finding 1.** `take` and `takeFloor` otherwise settle only through `Liquidator.settle`, which re-checks health at a fresh price, and the per-seat price times the position's whole collateral matches the Ledger's `paid`. Blocking a sale requires healing the position, which is the design.\n3. **Seat account: holds.** Every custody change (withdraw, take, keep, Treasury transfer, position transfer, own-token rescue) bumps `custodyEpoch`; pairings are also voided when the NFT leaves. `isValidSignature` accepts only stored digests computed on chain. The mainnet collection at the configured address has no `transfer(address,uint256)` selector, so the `send` path cannot move the NFT.\n4. **Rewards: finding 4 (low).** Otherwise `reported` tracks balances per token, `send` only runs from `collect`, and a hostile token blocks only its own credit.\n5. **Seat feed: finding 2.** The fall cap itself is sound, including the unpoked double-step and the equal-time replacement. The ring's first-value-of-day rule is timeable by anyone within the day's price range, which bounds the trend term's error to intraday variance.\n\n## Coverage\n\n| Function | Result |\n|---|---|\n| SeatJoin wire, setLimits, setClaimRule, recallBudget, transferFrom, transfer, exit, deposit,","treeHash":null,"usage":{"cachedInputTokens":1699007,"chain":[{"calls":1,"chainId":1,"failed":0,"own":1,"public":0,"refused":0}],"cost":{"source":"runtime","usdMicros":6604453},"inputTokens":450,"model":"claude-fable-5-1","outputTokens":62091,"runtime":"claude","turns":25,"wallClockMs":1255238}}],"verification":[]}