{"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":"cd9184ac-e25e-4415-8605-194bf21e3501","kind":"audit","nodes":[{"acceptedSubmissionHash":"695506092ba56887514b7ce6aa9df80b75877031ca802debfa5bf621a5fde027","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":"a807cacc5c1a55b0fa5a81856419a10d5c6a959fa084c0779926f1a35a45a6c0","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":"8bde1837d45c051443a4733bd3c47d63f2ae76da5ca72f329403c1de775624dc","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":"f5f99ba9313b80480e64557cd909b034c84e7350c0de3f75db55e4a5d9d31ea9","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":"0b6ea2ac87fb1b43f3f0c672ec2710fdc9a502de1e17c08a112a74390256a81e","dependsOn":[],"execution":{"network":false,"profile":"foundry","requires":[],"skillHash":"bc5bfc8455464381f2db18badb2b55cf8bec1e535c019349a0378fa990741171","skillId":"audit-specialist","subagents":3,"tools":[]},"key":"audit_permissions","kind":"code","role":"review","skillHash":"bc5bfc8455464381f2db18badb2b55cf8bec1e535c019349a0378fa990741171","skillId":"audit-specialist","state":"accepted"}],"objective":"Audit src/Parameters.sol, src/ParametersBase.sol, src/ParametersRules.sol, src/Governed.sol, src/GovernedByKind.sol, src/managers/RateManager.sol, at the pinned commit, for a capped mainnet beta. Read whatever else in src/ these depend on, but report on this scope.\n\nimdUSD v2 is a multi-collateral CDP stablecoin; this is its capped mainnet beta on Ethereum. Positions are NFT ids; borrowers set their own interest rate and redemptions take from the lowest rates first; liquidation is mark then bite, with a standing bid from Backstop sleeves; the peg pool is a Uniswap v4 pool with our own hook; prices come from Chainlink and from swarm-attested feeds (EIP-712 attestations bound to pinned questions). README.md gives the scope, the key invariants, the trust model and the known issues: read it first.\n\nBUILD AND TEST (required; Foundry, solc 0.8.26 via_ir per foundry.toml). Never build or test the whole project: with every suite it needs about 49 GB and the compiler will be killed. Run only this panel's tests: `forge test --match-path 'test/unit/{PanelParams,CapAndSlots,RiskVersions,RateManager,PanelRecheck}.t.sol'` (measured: about 3.6 GB peak, 5 minutes). One build at a time on your machine. Write each proof as a new file test/unit/Proof<Name>.t.sol, add it to the glob and run it; paste it with its output into the finding, then delete it: your submission must leave the tree unchanged. With Foundry 1.9 or later, `forge test --use solar --no-match-path 'test/fork/*'` builds everything and runs all 1,179 tests in seconds under 1 GB (Solar accepts a little syntax solc refuses: confirm a proof with the solc command).\n\nAnswer each numbered question, including the ones where nothing is wrong:\n1. TIMELOCKS PER KIND (propose, applyPending, cancel, locks, pendingKinds, BATCH, expiry). Any change that takes effect without its 48 hours, a raise smuggled inside a batch, an instant lower undone by an older proposal, or a slot that can be stuck for good.\n2. BOUNDS (ParametersRules._validate, _checkRisk, _checkIlk, the MAX_* constants). Any value that passes validation and then breaks the Ledger, the Liquidator or the Redeemer (a zero or extreme mat, chop, dust above line, divisor 0, a cap that blocks de-risking).\n3. INSTANT LOWERS (lowerLine, lowerCap, lowerKeeperCap, lowerEdgePremium, lowerUnbackedBrake, postLowerDepth, disableSleeveIlk; _cancelPending). Prove each only reduces risk; find one that harms a borrower or blocks liquidation or redemption.\n4. GENESIS AND SEAL (wire, the setGenesis* setters, seal, sealed_). Any wirer power left after the seal, or anything set before it that later governance cannot correct.\n5. DEPTH RULE (depthLine, depthK, depthCap, SET_DEPTH, the D1 check at apply, measured depth through ImdDepth). Can the sIMD line ever stand above what the rule allows, or be lowered by anyone but the rule and the Safe?\n6. RATE MANAGER (join, leave, setLimits, setRates, minInterval, maxStep, the operator right). Move a member's rate outside the limits they set, or charge them a premium they did not choose.\n\nNot findings: anything listed under README.md 'Known issues and accepted risks' (say so if you find it worse than written); src/bridge, src/dex, src/earn/LoopVault.sol and src/stocks (after the beta) unless a question names them; test/ and its mocks; gas optimisations unless they change behaviour.\n\nFor every finding: severity by impact; file, line and the lines copied; the call sequence from an external caller; a concrete failing input or state with expected against actual; whether it is reachable with the values in script/DeployConfig.sol (BetaConfig); the smallest fix; and a Foundry test that fails on this commit, RUN as BUILD says and pasted in full in the finding with its output (the judge reruns it). The test/ tree has harnesses to reuse (test/utils/System.sol, the unit suites). Answer every numbered question, including those where nothing is wrong. Give a coverage row (holds, finding or unreached, with a reason) for every external function of the contracts in scope. Also report every comment or NatSpec that claims a property the code does not have.","parentJobId":null,"planHash":"415347d5f23d4318c6358c0d87c9b9c8477d89369e90da95f7e201eb4aa8ee98","previousHash":"0000000000000000000000000000000000000000000000000000000000000000","projectId":"cd9184ac-e25e-4415-8605-194bf21e3501","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":"51200","feedbackHash":"7073d642e3c5bbb976377c972098d0a9cd21bc4adffaf16cbcf80f174009af79","nodeKey":"audit_economics","submissionHash":"695506092ba56887514b7ce6aa9df80b75877031ca802debfa5bf621a5fde027","tag1":"review:submission","tag2":"acceptance-v2","value":1},{"agentId":"53937","feedbackHash":"2e2bf41f4cd2d23fad0a114f2d166e9445acd782d644fd867e157c210077ec5f","nodeKey":"audit_flow","submissionHash":"a807cacc5c1a55b0fa5a81856419a10d5c6a959fa084c0779926f1a35a45a6c0","tag1":"review:submission","tag2":"acceptance-v2","value":1},{"agentId":"50966","feedbackHash":"256f1cf1defedd831a2a14176d019a8bde7c720d8b0a84b16697a9473e0146aa","nodeKey":"audit_judge","submissionHash":"8bde1837d45c051443a4733bd3c47d63f2ae76da5ca72f329403c1de775624dc","tag1":"review:submission","tag2":"acceptance-v2","value":1},{"agentId":"52605","feedbackHash":"4079f0672d32615d5237ccbfc32481e54d016c3a2a73dbf4dd278b6683eb77fe","nodeKey":"audit_math","submissionHash":"f5f99ba9313b80480e64557cd909b034c84e7350c0de3f75db55e4a5d9d31ea9","tag1":"review:submission","tag2":"acceptance-v2","value":1},{"agentId":"51163","feedbackHash":"3692861e8a647dcff658cd2265a7429dcda6d94a6b75fa0290cd0497256ae524","nodeKey":"audit_permissions","submissionHash":"0b6ea2ac87fb1b43f3f0c672ec2710fdc9a502de1e17c08a112a74390256a81e","tag1":"review:submission","tag2":"acceptance-v2","value":1}],"site":null,"snapshotHash":"0033d1bf38399e36a52bfaab62127a866877fd5f9a304992e9dc5b139d1059d0","state":"completed","submissions":[{"artifacts":[],"attempt":1,"bundleHash":null,"device":"8af9903f4ad1eed0","findings":[{"citation":"resolved","description":"`_validate` does not decode SET_MIGRATOR_LINE (ParametersRules.sol:39-40) or SET_DEPTH (ParametersRules.sol:66-67) payloads, so a 32-byte item `abi.encode(uint8(3))` or `abi.encode(uint8(16))` passes `propose` inside a BATCH (README lists the lone-slot form as a known issue). The BATCH also locks every item kind. When the governor then calls any instant lower that is keyed by ilk (`lowerLine`, `lowerDepthLine`, `lowerCap`, `disableSleeveIlk`), `_cancelPending` (Parameters.sol:279-284) sees the kind locked, picks the BATCH slot and scans it with `_touches`, which does `abi.decode(item, (uint8, bytes32))` on each item in order; on the 32-byte item the decode panics and the whole instant lower reverts, for EVERY type, including types the batch never names. The emergency brakes the README's trust model relies on ('a type that has just booked bad debt must be stoppable without a 48h wait', Parameters.sol:221-222) are therefore unavailable until the Safe first spends a transaction on `cancel(BATCH)`, which also drops every other item in the batch. This is worse than the written known issue ('a malformed proposal blocks only its own kind'): it blocks the instant lowers of unrelated kinds and types. Reachable with BetaConfig: the Safe's day-7 batch is exactly a BATCH that carries a SET_RISK (sIMD line) next to SET_DEPTH; a SET_DEPTH item encoded without its uint256 word reproduces it. Verified by the attached test on this commit: `propose` succeeds, `pendingOf(17)` is set, and `lowerLine(WBTC, 0)` reverts (trace: `Parameters::lowerLine(WBTC, 0) -> [Revert] EvmError: Revert`). Smallest fix: decode the two kinds at validation (`abi.decode(payload, (uint8, uint256))` in the SET_MIGRATOR_LINE and SET_DEPTH branches of `ParametersRules._validate`), and/or make `_touches` tolerant (`if (p.length < 64) return false;`) so an undecodable item never blocks an unrelated instant lower.","line":287,"path":"src/Parameters.sol","proof":"// SPDX-License-Identifier: MIT\npragma solidity 0.8.26;\n\nimport {Test} from \"forge-std/Test.sol\";\nimport {Parameters} from \"src/Parameters.sol\";\nimport {ParametersBase} from \"src/ParametersBase.sol\";\nimport {IFeed} from \"src/interfaces/IFeed.sol\";\n\n/// @dev Minimal stand-ins so Parameters' genesis checks pass without the rest of the system.\ncontract StubJoin {\n    address public token;\n    address public ledger;\n    constructor(address t, address l) { token = t; ledger = l; }\n}\ncontract Code {}\n\n/// @notice A BATCH carrying a SET_RISK item and a 32-byte SET_MIGRATOR_LINE item (which `_validate` accepts, since that\n/// kind is not decoded at propose) makes `Parameters._touches` revert on `abi.decode(item, (uint8, bytes32))`. While the\n/// batch is pending, every instant lower that goes through `_cancelPending` with an ilk (lowerLine, lowerDepthLine,\n/// lowerCap, disableSleeveIlk) reverts for EVERY type, including types the batch never names.\ncontract ProofTouchesRevertTest is Test {\n    address governor = makeAddr(\"governor\");\n    Parameters params;\n    bytes32 constant ETH = \"ETH\";\n    bytes32 constant WBTC = \"WBTC\";\n\n    function setUp() public {\n        params = new Parameters(governor, address(this));\n        Code ledger = new Code();\n        Code usd = new Code();\n        params.wire(address(ledger), address(usd));\n        _add(ETH, address(ledger));\n        _add(WBTC, address(ledger));\n        params.seal();\n    }\n\n    function _add(bytes32 ilk, address ledger) internal {\n        Code tok = new Code();\n        Code feed = new Code();\n        StubJoin join = new StubJoin(address(tok), ledger);\n        ParametersBase.Config memory c = ParametersBase.Config({\n            token: address(tok),\n            join: address(join),\n            median: IFeed(address(feed)),\n            spot: IFeed(address(feed)),\n            nhi: IFeed(address(0)),\n            yieldRate: address(0),\n            pegAggregator: address(0),\n            liveSpot: IFeed(address(0)),\n            redeemable: true,\n            auction: false\n        });\n        ParametersBase.Risk memory r = ParametersBase.Risk({\n            mat: 1.4e18, chop: 0.1e18, cut: 0.5e18, chip: 0.1e18, rateFloor: 0.01e18, yieldFee: 0, skew: 0.05e18,\n            pegFloor: 0, line: 1_000_000e18, dust: 100e18, redeemFloor: 0.005e18, redeemDivisor: 2, redeemCap: 0\n        });\n        params.addGenesisIlk(ilk, c, r);\n    }\n\n    function test_malformedBatchItemBlocksInstantLowerOfAnUnrelatedType() public {\n        ParametersBase.Risk memory r = params.storedRisk(ETH);\n        r.line = 2_000_000e18; // a plain line raise on ETH\n        bytes[] memory items = new bytes[](2);\n        items[0] = abi.encode(uint8(1), ETH, r); // SET_RISK\n        items[1] = abi.encode(uint8(3)); // SET_MIGRATOR_LINE, 32 bytes: not decoded at propose, so it passes\n        bytes memory batch = abi.encode(uint8(17), items); // BATCH\n        vm.prank(governor);\n        (bool proposed,) = address(params).call(abi.encodeCall(params.propose, (batch)));\n        if (!proposed) return; // a fix that refuses the malformed item at propose also passes\n        (, uint256 eta) = params.pendingOf(17);\n        assertGt(eta, 0, \"batch is pending\");\n\n        // WBTC is not in the batch: the governor must be able to stop it at once (a type that just booked bad debt).\n        vm.prank(governor);\n        params.lowerLine(WBTC, 0);\n        assertEq(params.storedRisk(WBTC).line, 0, \"WBTC line lowered at once\");\n        // and a cap on it too\n        vm.prank(governor);\n        params.lowerCap(WBTC, 1e18);\n        assertEq(params.cap(WBTC), 1e18, \"WBTC cap set at once\");\n    }\n}","reproduction":"State: Parameters wired and sealed with two types ETH and WBTC (any config). Governor calls `propose(abi.encode(uint8(17), [abi.encode(uint8(1), 'ETH', riskWithLine2M), abi.encode(uint8(3))]))` -> succeeds, BATCH slot pending, `locked` has bits 1, 3 and 17. Governor then calls `lowerLine('WBTC', 0)`. Expected: WBTC's stored line becomes 0 at once (WBTC is in no proposal). Actual: revert (abi.decode panic inside `_touches` on the 32-byte item), and the same for `lowerCap('WBTC', 1e18)`, `lowerDepthLine`, and `disableSleeveIlk`. Recovery needs `cancel(17)` first, which discards the SET_RISK item too. Test run: `forge test --match-path test/scratch/ProofTouchesRevert.t.sol` -> `[FAIL: EvmError: Revert] test_malformedBatchItemBlocksInstantLowerOfAnUnrelatedType() (gas: 819517)`.","severity":"low","snippet":"        (uint8 k, bytes32 i) = abi.decode(p, (uint8, bytes32));","title":"A malformed 32-byte SET_MIGRATOR_LINE/SET_DEPTH item inside a pending BATCH makes every ilk-keyed instant lower (lowerLine, lowerDepthLine, lowerCap, disableSleeveIlk) revert for every type until the "},{"citation":"resolved","description":"`Pricer.Quote.borrow = min(low, cap)` is the price at which `Ledger._adjustPrice` (Ledger.sol:344-352) measures any adjust that lowers the ratio, including a plain collateral withdrawal with no new debt (ParametersBase.sol:196-198 and Pricer.sol:28-29 say so; the suite's `test_cap_borrowAndWithdrawRefusedAboveCapPrice` asserts the withdrawal revert). `lowerCap` (Parameters.sol:195-201) is instant, onlyGovernor, refuses only `cap_ < _liveLow(ilk)/100`, and `_liveLow` reads 0 while the median is stale, so the floor is then 0 (ParametersBase.sol:438-441 says this is intended). A cap at low/100 makes every position with debt fail `_healthy` at the borrow price, so no owner can withdraw any collateral until they repay in full; a cap is never removed (ParametersBase.sol:202) and SET_CAP lifts it to the live low only after 48h. The README trust model lists 'lowering a cap' among the governor's 'instant risk-reducing actions'; for borrowers' access to their excess collateral it is not risk-reducing. This is a documentation and trust-model defect, not a permission bypass: the function's own NatSpec claims a property the code does not have. Reachable with BetaConfig (the Safe is the governor; ETH/wstETH/cbBTC types carry caps). Smallest fix: correct the NatSpec at Parameters.sol:193 and the README trust-model line to say the cap also measures withdrawals and that a cap set below the market locks withdrawals of indebted positions until SET_CAP lifts it; if that power is not wanted, bound `lowerCap` below by a larger fraction of the live low and refuse it while the low reads 0.","line":193,"path":"src/Parameters.sol","reproduction":"State (PanelParams/CapAndSlots setup): ETH at $2,000, mat 1.4; alice holds 10 ETH and 10,000 imdUSD of debt (200% at market). Governor calls `lowerCap('ETH', 20e18)` (= low/100, accepted). Alice calls `adjust(id, Adjust(-1 wei, 0, ...))`. Expected per the NatSpec at line 193: positions untouched, the withdrawal of 1 wei from a 200%-collateralised position succeeds. Actual: `Unhealthy` (9.999 ETH x $20 = $200 < 1.4 x $10,000); only a full repayment frees the collateral, for at least 48h (SET_CAP x2 steps or a lift to the live low). The existing passing test `test/unit/CapAndSlots.t.sol:test_cap_borrowAndWithdrawRefusedAboveCapPrice` shows the same revert at a milder cap of 1500e18.","severity":"low","snippet":"    /// @notice Set a ceiling on a type with none, or lower one, at once (it only stops new borrowing; positions untouched).","title":"lowerCap NatSpec claims 'it only stops new borrowing; positions untouched', but the cap also blocks every risk-increasing withdrawal from an indebted position, and the governor can set it instantly do"},{"citation":"resolved","description":"ParametersBase.sol:118-119 defines `MAX_SAVINGS_SHARE = 0.5e18` ('50% since 2026-10-29') and `setGenesisSavings` / SET_SAVINGS_SHARE validation (Parameters.sol:55, ParametersRules.sol:46) enforce it. The contract header still states 0-80%. A reader of the header (the stated 'point of this contract') is told governance has a power it does not have. Fix: change '0-80%' to '0-50% (MAX_SAVINGS_SHARE), at most 10 points per change'.","line":11,"path":"src/Parameters.sol","reproduction":"Governor proposes `abi.encode(uint8(5), uint64(0.6e18))` with savings set and savingsShare 0.5e18. Expected per the header: accepted (0.6 is within 0-80%). Actual: `OutOfBounds` from ParametersRules.sol:46.","severity":"info","snippet":"///    within 0-80%; open a fee-note series (tenor 30/90/180 days, discount <= 10%, a size cap); move a capped chain's","title":"Parameters header NatSpec says the savers' share may be set 'within 0-80%'; the bound in code is MAX_SAVINGS_SHARE = 50%"},{"citation":"resolved","description":"`LedgerBase.Position` (LedgerBase.sol:92-101) ends with `uint32 version`, which `ManagedPosition` omits. `ledger.position(id)` returns 8 words; the manager's decoder reads the first 7 and ignores the trailing word, so the cooldown check at RateManager.sol:193 still reads the right field today. The claim of an exact mirror is false, and the silent dependency on trailing-data tolerance is fragile: any field inserted before `lastRateChange` in a future Ledger would make the manager read the wrong slot and re-rate a member inside their cooldown (the Ledger would then revert `NotOwner`, so no premium can be charged, but every such member would be skipped as reason 6). Fix: add `uint32 version;` to ManagedPosition (or reword the comment to 'a prefix of').","line":4,"path":"src/managers/RateManager.sol","reproduction":"Compare the two structs: Position = (uint128 collateral, uint128 debt, uint64 rate, uint64 lastUpdate, uint64 lastRateChange, uint64 premiumRate, uint192 yieldMark, uint32 version); ManagedPosition = the first seven. Expected per the NatSpec: identical. Actual: one field short.","severity":"info","snippet":"/// @dev The slice of the Ledger a manager reads and calls. Mirrors LedgerBase.Position's ABI exactly.\nstruct ManagedPosition {","title":"RateManager's ManagedPosition claims to mirror LedgerBase.Position's ABI exactly, but Position has an eighth field (version) that ManagedPosition lacks"},{"citation":"resolved","description":"`lastRate[ilk] == 0` is used as 'no prior call' (line 176-177), but 0 is also a legal target whenever the constructor listed the type with `minRate == 0` (line 124 allows it, line 173 then accepts `rate == 0`). A call `setRates(ilk, 0, [], [], [])` stores `lastRate = 0`; the next call after `minInterval` passes the step check with any rate up to `maxRate`. The README's known issue ('calls with no ids can walk the target across the whole range') describes a walk of range/maxStep intervals; with a zero-floor listing it is two intervals. No member is moved outside their own floor/ceiling or the type bounds, so impact is limited to defeating the 'bounded step per interval' guarantee at RateManager.sol:42-44. Not reachable in the beta (no RateManager is deployed; the test listing uses minRate 2%). Fix: keep a separate `bool rated[ilk]` flag, or require `minRate > 0` in the constructor.","line":177,"path":"src/managers/RateManager.sol","reproduction":"Deploy RateManager with ilks=[ETH], minRates=[0], maxRates=[0.2e18], minInterval=1h, maxStep=0.05e18; alice joins with floor 0 and ceiling 0 (type bounds). t0: manager calls setRates(ETH, 0, [], [], []) -> accepted (first call), lastRate[ETH] = 0. t0+1h: manager calls setRates(ETH, 0.2e18, [aliceId], [0], [0]). Expected per RateManager.sol:42-44: StepTooLarge (|0.2 - 0| > 0.05). Actual: accepted because `prior == 0` disables the step check; alice is re-rated from her rate to 20% in one call.","severity":"info","snippet":"        if (prior != 0 && (rate > prior ? rate - prior : prior - rate) > maxStep) revert StepTooLarge();","title":"RateManager.setRates: a target of 0 (allowed when a type's minRate is 0) resets the maxStep reference, so the next call may jump the target across the whole range in one step"},{"citation":"resolved","description":"Every other debt ceiling has an instant lower (`lowerLine`, `lowerDepthLine`, `lowerKeeperCap`, `lowerUnbackedBrake`). The chain line (the beta's 300k cap, BetaConfig `chain.chainLine = TOTAL_LINES`) and group lines can only move through the timelock. To stop chain-wide borrowing at once the Safe must call `lowerLine` once per type (eleven calls in the beta), and a group cannot be tightened at once at all. This is a design gap in the instant-lower set, not a bypass; recorded because question 3 asks for it. Fix: add `lowerChainLine(uint128)` and `lowerGroupLine(uint8, uint128)` mirroring `_lowerLine` (strictly lowering, cancelling the pending SET_CHAIN_LINE / SET_GROUP_LINE slot).","line":134,"path":"src/ParametersRules.sol","reproduction":"Beta state: chainCapped, chainLine 300,000e18. Governor wants the chain cap at 100,000e18 now. Expected (by analogy with lowerLine): one instant call. Actual: only `propose(abi.encode(uint8(11), 100_000e18))`, applicable after 48h; `Parameters` exposes no instant path.","severity":"info","snippet":"        } else if (kind == SET_CHAIN_LINE) {\n            (, uint256 line) = abi.decode(payload, (uint8, uint256));\n            if (!chainCapped || line > MAX_CHAIN_LINE) revert OutOfBounds();","title":"No instant lowering exists for the chain-wide line or a group line: SET_CHAIN_LINE and SET_GROUP_LINE wait 48h in either direction"},{"citation":"resolved","description":"`edgeIlk[ilk]` is set by `setGenesisEdgeIlk` / ADD_SLEEVE_ILK and never cleared (no kind or setter clears it; `disableSleeveIlk` only calls `Backstop.disableIlk`). `Backstop.edgeCapacity` returns 0 for a listing that is off (Backstop.sol:375), and `LedgerBase._checkEdge` (LedgerBase.sol:421-432) reverts `EdgeCapacityExceeded(sum, 0)` on every borrow and on a charged rate change (Ledger.sol:164) of any edge type while the summed edge debt is above 0. So `disableSleeveIlk(sIMD, true)` in the beta is an instant freeze of all sIMD borrowing (equivalent to line 0) plus the loss of first-loss cover (README known issue), reversible only by ADD_SLEEVE_ILK after 48h. ParametersRules.sol:188-189 documents the capacity-0 effect, but the function's own NatSpec and the README trust model ('disabling a sleeve listing') do not. Risk-reducing, but a stronger power than written. Fix: state it in the NatSpec, or have `_checkEdge` skip types whose listing is off (a design decision).","line":179,"path":"src/Parameters.sol","reproduction":"Beta state: sIMD is an edge type with 10,000 imdUSD of debt. Governor calls `disableSleeveIlk('SIMD', true)`. Borrower with a healthy sIMD position calls `adjust(id, +1 imdUSD of debt)`. Expected per the NatSpec: only the standing bid stops; borrowing unaffected. Actual: `EdgeCapacityExceeded(10000e18, 0)`.","severity":"info","snippet":"    /// @notice Stop a sleeve's standing bid on a type at once (the safe direction; liquidations fall back to the\n    /// caller/auction path). ADD_SLEEVE_ILK lists it again.","title":"disableSleeveIlk NatSpec says only that liquidations fall back to the caller path; for an edge type it also stops every new borrow and charged rate change on that type until a 48h relisting, and the e"}],"hash":"0b6ea2ac87fb1b43f3f0c672ec2710fdc9a502de1e17c08a112a74390256a81e","nodeId":"e269b874-4f05-43c0-9f1f-7b4f9230873e","outcome":"completed","summary":"The review is complete. The findings file holds seven entries, every snippet matches the tree, the scratch proof is deleted and the working tree is unchanged.\n\n## Outcome\n\nNo critical, high or medium defect in the six contracts. The timelock-per-kind machinery, the bounds, the instant lowers, genesis/seal, the depth rule and the RateManager all hold against the six questions. I found one behavioural defect (Low, with a failing Foundry proof), one trust-model/NatSpec defect (Low), and five Info items, four of which are NatSpec claims the code does not have.\n\nPanel suite run as instructed: 66 tests passed. My proof `test_malformedBatchItemBlocksInstantLowerOfAnUnrelatedType` fails on this commit (`lowerLine(WBTC, 0)` reverts inside `_touches`).\n\n## Answers to the six questions\n\n**1. Timelocks per kind: holds, one Low.** Every kind is re-validated at apply against the state then in force; batch items are validated at propose against the propose-time state and again in order at apply, so a step-bounded field (dust, savings share, cap) cannot be moved more than one step by stacking items. A batch locks BATCH plus each item kind, so no field can be pending twice. Each instant lower cancels exactly the slot carrying its field (own kind or the BATCH), filtered by ilk for SET_RISK, SET_CAP and ADD_SLEEVE_ILK; I checked every field and no second kind can re-raise one. Expiry is per slot and an expired slot is cancellable by the governor, so nothing is stuck for good. The defect: a 32-byte SET_MIGRATOR_LINE or SET_DEPTH item passes `_validate`, and inside a batch it makes `_touches` panic, so `lowerLine`, `lowerDepthLine`, `lowerCap` and `disableSleeveIlk` revert for every type until the whole batch is cancelled. Worse than the written known issue, which says a malformed proposal blocks only its own kind.\n\n**2. Bounds: holds.** `_checkRisk` refuses chop outside [2%, 25%], mat outside [1.01, 3] and below `1 + chop` for non-NHI types, divisor 0 or above 16, dust above 5,000 or above a non-zero line, cut + chip above 100%, and a zero redeemCap on a live-spot type. NHI types skip the mat check safely because the Pricer's NHI mat is 170% to 200%, above `1 + MAX_CHOP`. Nothing that passes breaks the Ledger, Liquidator or Redeemer. Two non-defect notes: dust has no lower bound (0 is accepted via timelock) and `lowerLine` may leave line below dust, which only freezes opens.\n\n**3. Instant lowers: holds, with two documentation gaps.** `lowerLine` and `lowerDepthLine` only tighten `risk().line`, which the Ledger reads solely on debt creation (borrow and the cooldown premium); repay, redemption and liquidation never read it. `lowerKeeperCap`, `lowerUnbackedBrake`, `lowerEdgePremium`, `postLowerDepth`, `lowerDepthK` and `lowerOtherImdLines` only reduce room. `lowerCap` also blocks every non-de-risking withdrawal from an indebted position, which its own NatSpec denies (Low). `disableSleeveIlk` on an edge type also freezes all borrowing on that type via `edgeCapacity` 0 (Info). No instant action can make a position liquidatable or block liquidation or redemption.\n\n**4. Genesis and seal: holds.** After `seal`, every wirer function reverts `Sealed`, and `wire` cannot run because seal requires `ledger` set. Set-once-and-never-correctable after the seal: the savings vault address, notes, both Backstops, the ImdDepth contract, `depthIlk`, `chainCapped`, each type's token/join/feeds, and the `edgeIlk` flags. All are the documented design, except the edge flag irreversibility noted above.\n\n**5. Depth rule: holds.** The Ledger reads `params.risk(ilk).line` on both debt-creating paths, and `risk()` clamps the depth type's line to `depthLine()` live. The stored line can only rise through SET_RISK with `_requireDepth`, and SET_DEPTH_K and SET_OTHER_IMD raises check it too. Rounding in `depthLine` is downward, so the clamped line always satisfies `need <= room`. Lowering comes only from the Safe (instant lowers, `removeDepthSampler`) and from measured depth (the k","treeHash":null,"usage":{"cachedInputTokens":2205703,"cost":{"source":"runtime","usdMicros":7683143},"inputTokens":514,"model":"claude-fable-5-1","outputTokens":71917,"runtime":"claude","turns":27,"wallClockMs":1293564}},{"artifacts":[],"attempt":1,"bundleHash":null,"device":"2468e053049c5c80","findings":[{"citation":"resolved","description":"_cancelPending(kind, ilk) with ilk != 0 calls _touches on the pending BATCH whenever the batch locks `kind`. _touches abi.decodes EVERY item as (uint8, bytes32), but propose never decodes SET_MIGRATOR_LINE (ParametersRules.sol:39-40) or SET_DEPTH (:66-67) items, so a 32-byte item passes propose. Then each instant lower on a kind the batch locks reverts in abi.decode, for every type, including types the batch does not touch. In practice the governor cannot freeze a type that has just booked bad debt (lowerLine), set or lower a borrow cap (lowerCap), or stop a standing bid (disableSleeveIlk) until the governor first cancels the BATCH. The README known issue says a malformed payload 'blocks only its own kind'; here it also blocks the instant brakes on every type. Call sequence: Safe.propose(abi.encode(uint8(17), [abi.encode(uint8(1), ETH, risk), abi.encode(uint8(3))])) -> Safe.lowerLine(WBTC, 0) -> _lowerLine -> _cancelPending(SET_RISK, WBTC) -> locked has SET_RISK, slot = BATCH -> _touches(batch) -> abi.decode(32-byte item, (uint8, bytes32)) reverts. Reachable with BetaConfig: any capped-beta type, e.g. a day-7-style batch that carries a SET_RISK and a mis-encoded SET_DEPTH. It needs a governor mistake that the README already lists as possible. Smallest fix: in _touches, `if (p.length < 64) return false;`. Better, decode SET_MIGRATOR_LINE and SET_DEPTH in _validate so propose rejects the payload (this also closes the known issue).","line":286,"path":"src/Parameters.sol","proof":"// SPDX-License-Identifier: MIT\npragma solidity 0.8.26;\n\nimport \"forge-std/Test.sol\";\nimport {Parameters} from \"src/Parameters.sol\";\nimport {ParametersBase} from \"src/ParametersBase.sol\";\nimport {IFeed} from \"src/interfaces/IFeed.sol\";\n\ncontract Stub {}\n\ncontract StubJoin {\n    address public token;\n    address public ledger;\n\n    constructor(address t, address l) {\n        (token, ledger) = (t, l);\n    }\n}\n\n/// @notice A pending BATCH with one item shorter than two words (a SET_MIGRATOR_LINE / SET_DEPTH payload, which\n/// `propose` does not decode) makes `Parameters._touches` revert, so every instant per-type lower whose kind the batch\n/// locks (lowerLine, lowerCap, disableSleeveIlk) reverts for EVERY type, not only the batch's own.\ncontract ProofBatchTouches is Test {\n    Parameters params;\n    address gov = makeAddr(\"gov\");\n    bytes32 constant ETH = \"ETH\";\n    bytes32 constant WBTC = \"WBTC\";\n\n    function setUp() public {\n        params = new Parameters(gov, address(this));\n        address ledger = address(new Stub());\n        params.wire(ledger, address(new Stub()));\n        _add(ETH, ledger);\n        _add(WBTC, ledger);\n        params.seal();\n    }\n\n    function _risk(uint128 line) internal pure returns (ParametersBase.Risk memory) {\n        return ParametersBase.Risk({\n            mat: 1.5e18,\n            chop: 0.1e18,\n            cut: 0.1e18,\n            chip: 0.01e18,\n            rateFloor: 0.005e18,\n            yieldFee: 0,\n            skew: 0.02e18,\n            pegFloor: 0,\n            line: line,\n            dust: 100e18,\n            redeemFloor: 0.005e18,\n            redeemDivisor: 4,\n            redeemCap: 0\n        });\n    }\n\n    function _add(bytes32 ilk, address ledger) internal {\n        address t = address(new Stub());\n        ParametersBase.Config memory c;\n        c.token = t;\n        c.join = address(new StubJoin(t, ledger));\n        c.median = IFeed(address(new Stub()));\n        c.spot = c.median;\n        c.redeemable = true;\n        params.addGenesisIlk(ilk, c, _risk(1_000_000e18));\n    }\n\n    function _proposeBatch(bytes memory second) internal {\n        bytes[] memory items = new bytes[](2);\n        items[0] = abi.encode(uint8(1), ETH, _risk(2_000_000e18)); // an ETH line raise\n        items[1] = second;\n        vm.prank(gov);\n        params.propose(abi.encode(uint8(17), items)); // BATCH\n    }\n\n    /// Control: with well-formed items, the Safe can freeze WBTC at once and the ETH batch stays queued.\n    function test_control_wellFormedBatchKeepsInstantLowers() public {\n        _proposeBatch(abi.encode(uint8(3), uint256(0)));\n        vm.prank(gov);\n        params.lowerLine(WBTC, 0);\n        assertEq(params.storedRisk(WBTC).line, 0);\n    }\n\n    /// FAILS on this commit: the one-word item (accepted by `propose`) makes lowerLine(WBTC) revert inside `_touches`.\n    function test_malformedBatchItemBlocksInstantLowerOfAnotherType() public {\n        _proposeBatch(abi.encode(uint8(3))); // one word: passes propose (not decoded)\n        (bytes memory p, uint256 eta) = params.pendingOf(17);\n        assertGt(eta, 0, \"batch queued\");\n        assertGt(p.length, 0);\n        // WBTC just booked bad debt: the Safe freezes it at once, as the trust model promises.\n        vm.prank(gov);\n        params.lowerLine(WBTC, 0); // expected: line 0. actual: reverts decoding the 32-byte item in _touches\n        assertEq(params.storedRisk(WBTC).line, 0, \"WBTC frozen\");\n    }\n}","reproduction":"State: Parameters sealed with types ETH and WBTC (line 1,000,000e18). The governor proposes BATCH [SET_RISK(ETH, line 2,000,000e18), abi.encode(uint8(3))]; it is accepted. The governor then calls lowerLine(WBTC, 0). Expected: WBTC line = 0 and the batch is kept (it does not touch WBTC), as in the control test with a well-formed item. Actual: the call reverts (EvmError: Revert in Parameters.lowerLine). Test output:\nRan 2 tests for test/scratch/ProofBatchTouches.t.sol:ProofBatchTouches\n[PASS] test_control_wellFormedBatchKeepsInstantLowers() (gas: 772910)\n[FAIL: EvmError: Revert] test_malformedBatchItemBlocksInstantLowerOfAnotherType() (gas: 801940)\nBacktrace:\n  at Parameters.lowerLine\nSuite result: FAILED. 1 passed; 1 failed; 0 skipped\nWith the fix (`if (p.length < 64) return false;` first in _touches): Suite result: ok. 2 passed; 0 failed.","severity":"low","snippet":"    function _touches(bytes memory p, uint8 kind, bytes32 ilk) private pure returns (bool) {\n        (uint8 k, bytes32 i) = abi.decode(p, (uint8, bytes32));","title":"A pending BATCH with a one-word item (accepted by propose) makes every instant per-type lower revert: lowerLine / lowerCap / disableSleeveIlk on ANY type"},{"citation":"resolved","description":"ParametersBase says 'borrowing, withdrawing and a charged rate change are measured at min(low, cap)'. Ledger.setRate (src/Ledger.sol:166-167) checks the premium with _healthy(p.collateral, debt, q.low, q.mat), and its own comment reads 'A rate change is not a borrow, so the cap does not measure its premium'. The existing test test_cap_chargedRateChangeMeasuredAtLowNotCap asserts the Ledger's behaviour. Fix: correct the comment.","line":196,"path":"src/ParametersBase.sol","reproduction":"Type with cap = low/2 and a position healthy at low but not at low/2: the owner's charged setRate inside the cooldown succeeds (measured at low), not at min(low, cap) as the comment says. See test/unit/CapAndSlots.t.sol test_cap_chargedRateChangeMeasuredAtLowNotCap.","severity":"info","snippet":"    /// @notice A type's BORROW price ceiling (Sky's capped OSM): borrowing, withdrawing and a charged rate change\n    /// are measured at min(low, cap) (`Pricer.Quote.borrow`); liquidation health, liquidation prices and redemption payouts\n    /// never see the cap, so it can only make borrowing harder and never shelters or condemns an open position. 0 = none.","title":"NatSpec says a charged rate change is measured at the capped borrow price; the Ledger measures it at `low`"},{"citation":"resolved","description":"MAX_SAVINGS_SHARE = 0.5e18 (ParametersBase.sol:119), enforced in setGenesisSavings and SET_SAVINGS_SHARE.","line":11,"path":"src/Parameters.sol","reproduction":"propose(abi.encode(uint8(5), uint64(0.6e18))) reverts OutOfBounds, although the header says 60% is inside the range (it would revert anyway because of the 10-point step).","severity":"info","snippet":"///    within 0-80%; open a fee-note series (tenor 30/90/180 days, discount <= 10%, a size cap); move a capped chain's","title":"Contract header gives the savers' share range as 0-80%; the bound is 50%"},{"citation":"resolved","description":"_validate checks MAX_TOKENS only. Backstop.addIlk also reverts when ilkList.length == MAX_ILKS (src/backstop/Backstop.sol:245). The comment above (lines 101-104) says propose refuses 'what the apply would fail on'. When the token is already held (isToken) and the ilk list is full, propose passes, applyPending reverts TooManyTokens, and the ADD_SLEEVE_ILK slot stays held until the governor cancels it.","line":105,"path":"src/ParametersRules.sol","reproduction":"A sleeve with ilkList.length == MAX_ILKS and a new type whose token the sleeve already holds: propose(ADD_SLEEVE_ILK) succeeds, and applyPending after 48h reverts TooManyTokens. Fix: add `|| ilkCount >= MAX_ILKS` to the check (this needs a view on Backstop).","severity":"info","snippet":"            if (!ISleeve(sleeve).isToken(c.token) && ISleeve(sleeve).tokenCount() >= ISleeve(sleeve).MAX_TOKENS()) {\n                revert OutOfBounds();\n            }","title":"ADD_SLEEVE_ILK validation does not check the sleeve's MAX_ILKS, so a proposal passes propose and reverts at apply"},{"citation":"resolved","description":"The NatSpec says a claim rule may never name a selector that moves or approves the account's tokens. The list omits increaseApproval(address,uint256) 0xd73dd623 (older OpenZeppelin and Zeppelin tokens) and Permit2 approve(address,address,uint160,uint48) 0x87517c45 (selectors computed with `cast sig`). A deny-list cannot be complete. Reaching this needs a governor SET_SEAT_CLAIM naming such a target and selector.","line":215,"path":"src/ParametersRules.sol","reproduction":"propose(abi.encode(uint8(10), seatJoin, tokenWithIncreaseApproval, bytes4(0xd73dd623), uint8(1))) passes validation. Fix: an allow-list of reward-claim selectors, or add these selectors.","severity":"info","snippet":"    /// @dev A SeatAccount forwards any calldata after an allowlisted (target, selector), so a claim rule may never\n    /// name a selector that moves or approves the account's tokens (ERC-20 / 721 / 1155 / 777 / 1363 transfers, approvals,\n    /// permits, and multicall, which reaches any of them): allowlisting one would let anyone move every account's unpaid rewards. Removing a rule (rule 0) is always allowed.","title":"_movesTokens deny-list misses token-approving selectors that its NatSpec says can never be allowlisted"},{"citation":"resolved","description":"With imdDepth == 0, depthIMD() returns depthCap, so depthCap == 0 means depth 0 (line 0). postLowerDepth accepts any depth > 0 when depthCap == 0, which instantly raises depth and the depth-gated line's live value, up to the stored line, with no 48h wait. This is not reachable in BetaConfig: mainnet wires an ImdDepth, and there depthCap 0 means 'no ceiling', so posting one is a real lowering. It applies to a chain with a depth rule and no ImdDepth, after SET_DEPTH(0) or a genesis depth of 0. Fix: `if (address(imdDepth) == address(0) && depthCap == 0) revert OutOfBounds();`.","line":263,"path":"src/Parameters.sol","reproduction":"Chain with no ImdDepth, depthIlk set, depthCap 0: depthLine() = 0. The governor calls postLowerDepth(1e30), and depthLine() then equals the stored line in the same block.","severity":"info","snippet":"        if (depthIlk == bytes32(0) || depth == 0 || (depthCap != 0 && depth >= depthCap)) revert OutOfBounds();","title":"postLowerDepth raises depth from 0 at once on a chain with no ImdDepth and no posted depth"}],"hash":"695506092ba56887514b7ce6aa9df80b75877031ca802debfa5bf621a5fde027","nodeId":"f038e1a7-1e9c-4ea9-a6ef-fd61e696eeb1","outcome":"completed","summary":"I found no critical, high or medium issues in the six contracts. There is one low finding, which has a proof that fails on this commit and passes with the fix, plus five info notes, all in `.imd-findings.json`. The proof file has been deleted and `src/` is unchanged.\n\nTwo things about how the checks ran:\n- Forge here is 1.8.3, so `--use solar` wasn't available. I ran the proof with solc (about 3 minutes cold).\n- I did not run the full panel glob (`PanelParams`, `CapAndSlots`, `RiskVersions`, `RateManager`, `PanelRecheck`). I read their test names to see what is already covered.\n\nThe untracked dotfiles that `git status` shows (`.bashrc`, `.claude/`, `.idea`, …) are `/dev/null` devices the sandbox mounts into the folder. I didn't create them and left them alone.\n\n## Finding (low): a malformed item in a pending BATCH blocks the instant lowers on every type\n- **Where:** `src/Parameters.sol:286-287`, `_touches`. It decodes every batch item as `(uint8, bytes32)`.\n- **Cause:** `propose` never decodes `SET_MIGRATOR_LINE` or `SET_DEPTH` items, so a one-word item is accepted.\n- **Effect:** while that batch is pending, `lowerLine`, `lowerCap` and `disableSleeveIlk` revert for any type, as long as the batch carries the matching kind. That includes types the batch doesn't touch.\n- **Example:** with BATCH `[SET_RISK(ETH), abi.encode(uint8(3))]` pending, `lowerLine(WBTC, 0)` reverts (`EvmError: Revert`) instead of freezing WBTC. The control test with a well-formed item passes.\n- **Known issue?** The README says a malformed payload \"blocks only its own kind\". This is worse: it blocks the emergency lowers on every type.\n- **Fix:** add `if (p.length < 64) return false;` at the top of `_touches`. With it, both tests pass. Better still, decode those two kinds at `propose`.\n- **Reach:** any BetaConfig type. It needs the Safe to submit a malformed item, which the README already lists as possible.\n\n## Answers to the six questions\n1. **Timelocks: hold.**\n   - Every slot and lock is cleared only through `_take`, and overlapping locks are refused at propose.\n   - A batch is checked at propose, every item against the starting state, so step bounds can't stack (dust ×2, savings ±10 points, cap ×2). Items are checked again in order at apply. Two items of the same kind are allowed, but neither can go past the bound measured from the starting state.\n   - Each instant lower cancels the slot or the BATCH that sets the same field. No other kind writes those fields.\n   - An expired slot stays held, but the governor can always cancel it.\n   - Side note: `lowerDepthK` doesn't cancel a pending `SET_DEPTH` raise, and `postLowerDepth` doesn't cancel a `SET_DEPTH_K` raise. These are different fields, and the `SET_DEPTH_K` raise is still checked against the depth rule when it applies.\n2. **Bounds: hold.**\n   - For non-NHI types, mat must be at least 1 + chop. NHI types use a live mat of 1.7 to 2.0, which is above 1 + 25%.\n   - Liquidation guards its own division (`t <= 1 + chop` closes in full). `redeemDivisor` is between 1 and 16.\n   - Dust above the line can only come from `lowerLine`, and the effect is a freeze.\n   - A cap never applies to liquidation, redemption, a withdrawal that de-risks, or a rate change.\n   - `MIN_MAT` (1.01) can never bind, because `MIN_CHOP` already forces mat to at least 1.02.\n3. **Instant lowers: each one only reduces risk.**\n   - Lowering line, cap or keeper cap, tightening the unbacked brake, lowering k, posting a lower depth, removing a sampler and disabling a sleeve listing all stop new debt and leave repay, redeem and liquidate alone.\n   - Side effects, not findings:\n     - A lowered line, or an edge listing disabled (its capacity drops to 0), also refuses an owner's charged rate change inside the 7-day cooldown. That owner can't raise their rate to get out of the redemption queue.\n     - `lowerEdgePremium` moves income from edge-sleeve depositors to the Treasury at once. The README's list of instant actions doesn't mention it.\n     -","treeHash":null,"usage":{"cachedInputTokens":3043406,"cost":{"source":"runtime","usdMicros":2809058},"inputTokens":52,"model":"claude-opus-5-5","outputTokens":66459,"runtime":"claude","turns":30,"wallClockMs":1017619}},{"artifacts":[],"attempt":1,"bundleHash":null,"device":"759c614fdc84ff66","findings":[{"citation":"resolved","description":"Merged from all four specialists (economics, flow, math, permissions). ParametersRules._validate does not decode SET_MIGRATOR_LINE (ParametersRules.sol:39-40) or SET_DEPTH (:66-67), so a 32-byte item such as abi.encode(uint8(3)) passes propose inside a BATCH. The BATCH locks every item kind (ParametersBase._kindsOf). An instant per-type lower calls _cancelPending(kind, ilk) (Parameters.sol:279-284); when `kind` is locked by the BATCH it runs _touches over the batch, which abi.decodes EVERY item as (uint8, bytes32) until one matches. The 32-byte item makes that decode revert, so the whole lower reverts, including for types the batch never names. Call sequence: Safe.propose(abi.encode(uint8(17), [abi.encode(uint8(1), ETH, risk), abi.encode(uint8(3))])) -> Safe.lowerLine(WBTC, 0) -> _lowerLine -> _cancelPending(SET_RISK, WBTC) -> _touches -> abi.decode reverts. The same holds for lowerCap (a batch carrying SET_CAP), lowerDepthLine, and disableSleeveIlk (a batch carrying ADD_SLEEVE_ILK). The batch's expiry does not release it; only cancel(17) does, which also drops every other item. README's known issue says a malformed SET_DEPTH/SET_MIGRATOR_LINE payload 'blocks only its own kind'; the consequence is worse than written: it disables the instant brakes (README: 'a type that has just booked bad debt must be stoppable without a 48h wait') on every type for the batch's kinds, costing the Safe an extra 2-of-3 transaction, after diagnosing an empty-data revert, during an incident. Needs a governor encoding mistake. Reachable with BetaConfig: the day-7 Safe batch is a BATCH carrying SET_DEPTH next to SET_RISK (sIMD line); a SET_DEPTH item missing its uint256 word reproduces it. Smallest fix: decode the two kinds in _validate (`abi.decode(payload, (uint8, uint256));` in the SET_MIGRATOR_LINE and SET_DEPTH branches), which also closes the known issue; defensively, `if (p.length < 64) return false;` first in _touches.","line":287,"path":"src/Parameters.sol","proof":"// SPDX-License-Identifier: MIT\npragma solidity 0.8.26;\n\nimport \"forge-std/Test.sol\";\nimport {Parameters} from \"src/Parameters.sol\";\nimport {ParametersBase} from \"src/ParametersBase.sol\";\nimport {IFeed} from \"src/interfaces/IFeed.sol\";\n\ncontract Stub {}\n\ncontract StubJoin {\n    address public token;\n    address public ledger;\n\n    constructor(address t, address l) {\n        (token, ledger) = (t, l);\n    }\n}\n\n/// @notice A pending BATCH with one item shorter than two words (a SET_MIGRATOR_LINE / SET_DEPTH payload, which\n/// `propose` does not decode) makes `Parameters._touches` revert, so every instant per-type lower whose kind the batch\n/// locks (lowerLine, lowerCap, disableSleeveIlk) reverts for EVERY type, not only the batch's own.\ncontract ProofBatchTouches is Test {\n    Parameters params;\n    address gov = makeAddr(\"gov\");\n    bytes32 constant ETH = \"ETH\";\n    bytes32 constant WBTC = \"WBTC\";\n\n    function setUp() public {\n        params = new Parameters(gov, address(this));\n        address ledger = address(new Stub());\n        params.wire(ledger, address(new Stub()));\n        _add(ETH, ledger);\n        _add(WBTC, ledger);\n        params.seal();\n    }\n\n    function _risk(uint128 line) internal pure returns (ParametersBase.Risk memory) {\n        return ParametersBase.Risk({\n            mat: 1.5e18,\n            chop: 0.1e18,\n            cut: 0.1e18,\n            chip: 0.01e18,\n            rateFloor: 0.005e18,\n            yieldFee: 0,\n            skew: 0.02e18,\n            pegFloor: 0,\n            line: line,\n            dust: 100e18,\n            redeemFloor: 0.005e18,\n            redeemDivisor: 4,\n            redeemCap: 0\n        });\n    }\n\n    function _add(bytes32 ilk, address ledger) internal {\n        address t = address(new Stub());\n        ParametersBase.Config memory c;\n        c.token = t;\n        c.join = address(new StubJoin(t, ledger));\n        c.median = IFeed(address(new Stub()));\n        c.spot = c.median;\n        c.redeemable = true;\n        params.addGenesisIlk(ilk, c, _risk(1_000_000e18));\n    }\n\n    function _proposeBatch(bytes memory second) internal {\n        bytes[] memory items = new bytes[](2);\n        items[0] = abi.encode(uint8(1), ETH, _risk(2_000_000e18)); // an ETH line raise\n        items[1] = second;\n        vm.prank(gov);\n        params.propose(abi.encode(uint8(17), items)); // BATCH\n    }\n\n    /// Control: with well-formed items, the Safe can freeze WBTC at once and the ETH batch stays queued.\n    function test_control_wellFormedBatchKeepsInstantLowers() public {\n        _proposeBatch(abi.encode(uint8(3), uint256(0)));\n        vm.prank(gov);\n        params.lowerLine(WBTC, 0);\n        assertEq(params.storedRisk(WBTC).line, 0);\n    }\n\n    /// FAILS on this commit: the one-word item (accepted by `propose`) makes lowerLine(WBTC) revert inside `_touches`.\n    function test_malformedBatchItemBlocksInstantLowerOfAnotherType() public {\n        _proposeBatch(abi.encode(uint8(3))); // one word: passes propose (not decoded)\n        (bytes memory p, uint256 eta) = params.pendingOf(17);\n        assertGt(eta, 0, \"batch queued\");\n        assertGt(p.length, 0);\n        // WBTC just booked bad debt: the Safe freezes it at once, as the trust model promises.\n        vm.prank(gov);\n        params.lowerLine(WBTC, 0); // expected: line 0. actual: reverts decoding the 32-byte item in _touches\n        assertEq(params.storedRisk(WBTC).line, 0, \"WBTC frozen\");\n    }\n}","reproduction":"Reproduced: test/scratch/ProofBatchTouches.t.sol (proof below; self-contained, stub ledger/token/join). State: Parameters sealed with ETH and WBTC, line 1,000,000e18. Governor proposes BATCH [SET_RISK(ETH, line 2,000,000e18), abi.encode(uint8(3))]: accepted, pendingOf(17) set. Governor calls lowerLine(WBTC, 0). Expected: WBTC line 0 at once (the batch does not touch WBTC; the control with a well-formed abi.encode(uint8(3), uint256(0)) item does exactly that). Actual: revert in Parameters.lowerLine. Output on this commit: `[PASS] test_control_wellFormedBatchKeepsInstantLowers() (gas: 772910)` / `[FAIL: EvmError: Revert] test_malformedBatchItemBlocksInstantLowerOfAnotherType() (gas: 801940)`. Also confirmed with lowerLine(ETH, 0) (the batch's own type: [FAIL: EvmError: Revert] test_instantLowerLineSurvivesMalformedBatchItem) and with lowerCap via a batch carrying SET_CAP (flow specialist). Passes once _validate decodes the two kinds (propose then rejects the batch, so the test must be adjusted to expect that) or _touches skips short items.","severity":"low","snippet":"        (uint8 k, bytes32 i) = abi.decode(p, (uint8, bytes32));","title":"A one-word SET_MIGRATOR_LINE / SET_DEPTH item in a pending BATCH makes every instant per-type lower (lowerLine, lowerDepthLine, lowerCap, disableSleeveIlk) revert, for every type, until the batch is c"},{"citation":"resolved","description":"The line the Ledger enforces for the depth-gated type is risk(depthIlk).line = min(stored line, depthLine()) (Parameters.sol:332-338), and depthLine() (ParametersBase.sol:480-487) subtracts otherImdLines x (1 + otherImdChop) from k x depth. lowerOtherImdLines lowers otherImdLines at once and checks nothing else, so whenever depthLine() binds (the beta's normal state: the day-7 sIMD line is set to what D1 admits) it raises the enforced sIMD line in the same transaction. Nothing checks that the other chain actually lowered its IMD line, so after the call the sIMD line can stand above what D1 allows for the real combined IMD exposure (question 5). README invariant 7 says every governed raise of lines waits 48h and only risk-reducing lowerings are instant; the trust model's list of instant acts does not include this one; ParametersBase.sol:180-183 calls it 'lowered instantly' as if it were a brake. It is a governor power (2-of-3 Safe), so severity is low. Reachable with BetaConfig: MainnetConfig sets otherImdLines = RobinhoodConfig.IMD_LINE = 3,000e18 at chop 0.2 and BetaConfig inherits it, so lowerOtherImdLines(0) raises the beta sIMD line by 3,600/1.2 = 3,000 imdUSD at once (bounded by the stored line). Smallest fix: drop the instant function (SET_OTHER_IMD is timelocked and already accepts decreases), or refuse it while depthLine() < the stored line of depthIlk.","line":205,"path":"src/Parameters.sol","proof":"// SPDX-License-Identifier: MIT\npragma solidity 0.8.26;\n\nimport \"forge-std/Test.sol\";\nimport {Parameters} from \"src/Parameters.sol\";\nimport {ParametersBase} from \"src/ParametersBase.sol\";\nimport {IFeed} from \"src/interfaces/IFeed.sol\";\n\ncontract PoCode {}\n\ncontract PoJoin {\n    address public token;\n    address public ledger;\n    constructor(address t, address l) { token = t; ledger = l; }\n}\n\ncontract PoFeed {\n    function latestValue() external view returns (uint256, uint64) { return (1e18, uint64(block.timestamp)); }\n    function isStale() external pure returns (bool) { return false; }\n    function maxAge() external pure returns (uint256) { return 1 hours; }\n}\n\n/// `lowerOtherImdLines` is an instant governor act that RAISES the depth-gated type's effective line\n/// (`risk(depthIlk).line` = min(stored, depthLine())), with no 48h timelock. Beta values: k 0.8, otherImdLines\n/// 3,000 at chop 0.2, sIMD chop 0.2.\ncontract ProofOtherImd is Test {\n    Parameters params;\n    address gov = address(0xA11CE);\n    bytes32 constant SIMD = \"SIMD\";\n\n    function setUp() public {\n        params = new Parameters(gov, address(this));\n        address ledger = address(new PoCode());\n        address token = address(new PoCode());\n        params.wire(ledger, token);\n        address coll = address(new PoCode());\n        address join = address(new PoJoin(coll, ledger));\n        IFeed f = IFeed(address(new PoFeed()));\n        ParametersBase.Config memory c = ParametersBase.Config(\n            coll, join, f, f, IFeed(address(0)), address(0), address(0), IFeed(address(0)), true, false\n        );\n        ParametersBase.Risk memory r = ParametersBase.Risk({\n            mat: 1.5e18, chop: 0.2e18, cut: 0, chip: 0, rateFloor: 0.01e18, yieldFee: 0, skew: 0.02e18,\n            pegFloor: 0, line: 50_000e18, dust: 0, redeemFloor: 0.005e18, redeemDivisor: 1, redeemCap: 0\n        });\n        params.addGenesisIlk(SIMD, c, r);\n        // no ImdDepth here, so the posted 60k is the depth: room 48k, other chains 3,600, line (48k-3.6k)/1.2 = 37k\n        params.setGenesisDepthRule(SIMD, 0.8e18, 60_000e18, 3_000e18, 0.2e18);\n        params.seal();\n    }\n\n    function test_instantLowerDoesNotRaiseDepthGatedLine() public {\n        uint256 before = params.risk(SIMD).line;\n        assertEq(before, 37_000e18);\n        vm.prank(gov);\n        params.lowerOtherImdLines(0); // the other chain still runs its 3,000 line; nothing checks that\n        // Expected (README invariant 7 / trust model: instant acts only reduce risk): the sIMD line does not rise.\n        assertLe(params.risk(SIMD).line, before, \"instant act raised the sIMD line\"); // actual: 40,000\n    }\n}","reproduction":"Reproduced: test/scratch/ProofOtherImd.t.sol (proof below). SIMD with chop 0.2, stored line 50,000; setGenesisDepthRule(SIMD, k 0.8, posted depth 60,000, otherLines 3,000, otherChop 0.2), no ImdDepth: risk(SIMD).line = (48,000 - 3,600)/1.2 = 37,000. Governor lowerOtherImdLines(0). Expected: an instant act never raises a line (stays 37,000 until a 48h proposal). Actual: 40,000 in the same transaction. Output on this commit: `[FAIL: instant act raised the sIMD line: 40000000000000000000000 > 37000000000000000000000] test_instantLowerDoesNotRaiseDepthGatedLine() (gas: 126971)`.","severity":"low","snippet":"    function lowerOtherImdLines(uint256 lines) external onlyGovernor {\n        if (depthIlk == bytes32(0) || lines >= otherImdLines) revert OutOfBounds();\n        _cancelPending(SET_OTHER_IMD, 0);\n        otherImdLines = lines;\n        emit OtherImdSet(lines, otherImdChop);\n        _flagDepth();","title":"lowerOtherImdLines is an instant governor act that RAISES the enforced sIMD (depth-gated) line with no 48h timelock"},{"citation":"resolved","description":"lowerLine / lowerDepthLine set a type's line below its debt, and for sIMD a fall in measured depth does the same live through depthLine(). Ledger.setRate's charged branch (Ledger.sol:155-162) mints the 7-day cooldown premium as debt and then checks `uint256(s.debt) + s.badDebt > params.risk(ilk).line` -> CeilingExceeded, so an owner who opened or changed their rate in the last 7 days cannot change their rate at all, in either direction, until the cooldown lapses. A borrower at the front of the redemption queue cannot raise their rate to leave it (question 3: an instant lower that harms a borrower). Repay, deposit, redemption and liquidation are unaffected, so the lower still reduces protocol risk; the defect is the false NatSpec (Parameters.sol:215 and 222; ParametersBase.sol:170-171 lists only repay/redemption/liquidation as carrying on) and the borrower harm. Reachable with BetaConfig on every type, and on sIMD without any governor action whenever depth falls. Smallest fix: exempt the cooldown premium (it is interest, not new borrowing) from the per-type line check, or document the effect.","line":221,"path":"src/Parameters.sol","reproduction":"Reproduced with test/scratch/ProofLedgerSide.t.sol (System harness): ETH mat 1.4, line 1,000,000, price 2000; alice opens 10 ETH / 5,000 imdUSD at 5%. Governor lowerLine(ETH, 1000e18). Alice (owner, inside cooldown) setRate(id, 0.06e18, 0, 0). Expected per NatSpec: position untouched, premium paid, new rate set. Actual: `[FAIL: CeilingExceeded()] test_lowerLineBlocksChargedRateChange() (gas: 818398)`, trace `Parameters::risk(ETH) -> line 1e21 ... Ledger.setRate <- [Revert] CeilingExceeded()`. After 7 days the free change succeeds (flow specialist's test).","severity":"low","snippet":"    /// @notice Lower ANY type's line at once (a type that has just booked bad debt must be stoppable without a\n    /// 48h wait). Strictly lowering; raising stays a SET_RISK proposal. Positions are untouched.","title":"lowerLine (and any fall of the live depth line) blocks a borrower's in-cooldown rate change; 'Positions are untouched' does not hold"},{"citation":"resolved","description":"Pricer quote.borrow = min(low, cap), and Ledger._adjustPrice (Ledger.sol:344-352) measures any adjust that is not a proportional repay-and-withdraw at q.borrow. lowerCap is instant, onlyGovernor, and floors the cap only at _liveLow(ilk)/100 (0 while the median is stale, so then any non-zero cap). A cap at that floor makes every indebted position fail health at the borrow price, so no owner can withdraw excess collateral (only repay first) until SET_CAP lifts it after 48h; a cap is never removed. ParametersBase.sol:196-197 states the withdrawal effect correctly; the lowerCap NatSpec and the README trust model ('instant risk-reducing actions ... lowering a cap') do not. Governor power, reachable with BetaConfig on every type. Fix: correct the NatSpec/README; if the power is unwanted, bound lowerCap below by a larger fraction of the live low and refuse it while low reads 0.","line":193,"path":"src/Parameters.sol","reproduction":"Reproduced with test/scratch/ProofLedgerSide.t.sol: ETH at 2000, mat 1.4; alice 10 ETH / 5,000 debt (CR 400%). Governor lowerCap(ETH, 20e18) (= low/100, accepted). Alice adjust(id, dCollateral -1e18, dDebt 0). Expected per NatSpec: allowed (CR 360% at market). Actual: `[FAIL: Unhealthy()] test_lowerCapBlocksWithdrawal() (gas: 857649)` (9 ETH x $20 = $180 < 1.4 x 5,000).","severity":"low","snippet":"    /// @notice Set a ceiling on a type with none, or lower one, at once (it only stops new borrowing; positions untouched).\n    /// Refused below 1/100 of the live low (a unit error, e.g. a per-token figure for an 8-decimal token).","title":"lowerCap NatSpec says it 'only stops new borrowing; positions untouched', but an instant cap also refuses every plain collateral withdrawal from an indebted position"},{"citation":"resolved","description":"postLowerDepth treats depthCap == 0 as 'no ceiling', so any value counts as a lowering. That is true only with an ImdDepth: depthIMD() (ParametersBase.sol:469-470) returns depthCap itself when imdDepth is unset, where 0 means zero depth and depthLine() = 0. On such a chain (ParametersBase D1 NatSpec supports it: 'Chains without an ImdDepth fall back to the posted figure alone') the governor's instant postLowerDepth(X) raises depth from 0 to X and opens the depth-gated type up to its stored line with no 48h wait. depthCap 0 is reached by setGenesisDepthRule(.., depth 0, ..) or an applied SET_DEPTH(0). Not reachable with BetaConfig on mainnet (an ImdDepth is wired, and there 0 does mean 'no ceiling'); relevant to any deployment with a depth rule and no ImdDepth. Smallest fix: `if (depthIlk == bytes32(0) || depth == 0 || ((depthCap != 0 || address(imdDepth) == address(0)) && depth >= depthCap)) revert OutOfBounds();`.","line":263,"path":"src/Parameters.sol","proof":"// SPDX-License-Identifier: MIT\npragma solidity 0.8.26;\n\nimport \"forge-std/Test.sol\";\nimport {Parameters} from \"src/Parameters.sol\";\nimport {ParametersBase} from \"src/ParametersBase.sol\";\nimport {IFeed} from \"src/interfaces/IFeed.sol\";\n\ncontract PlCode {}\n\ncontract PlJoin {\n    address public token;\n    address public ledger;\n    constructor(address t, address l) { token = t; ledger = l; }\n}\n\n/// postLowerDepth, the instant \"lower\" of the posted depth, raises depth from 0 on a chain with no ImdDepth.\ncontract ProofPostLower is Test {\n    Parameters params;\n    address gov = address(0xA11CE);\n    bytes32 constant SIMD = \"SIMD\";\n\n    function setUp() public {\n        params = new Parameters(gov, address(this));\n        address ledger = address(new PlCode());\n        params.wire(ledger, address(new PlCode()));\n        address coll = address(new PlCode());\n        IFeed f = IFeed(address(new PlCode()));\n        ParametersBase.Config memory c = ParametersBase.Config(\n            coll, address(new PlJoin(coll, ledger)), f, f, IFeed(address(0)), address(0), address(0), IFeed(address(0)), true, false\n        );\n        ParametersBase.Risk memory r = ParametersBase.Risk({\n            mat: 1.5e18, chop: 0.2e18, cut: 0, chip: 0, rateFloor: 0.01e18, yieldFee: 0, skew: 0.02e18,\n            pegFloor: 0, line: 50_000e18, dust: 0, redeemFloor: 0.005e18, redeemDivisor: 1, redeemCap: 0\n        });\n        params.addGenesisIlk(SIMD, c, r);\n        params.setGenesisDepthRule(SIMD, 0.8e18, 0, 0, 0); // no ImdDepth: posted depth 0 = zero depth\n        params.seal();\n    }\n\n    function test_postLowerDepthNeverRaisesLine() public {\n        assertEq(params.risk(SIMD).line, 0);\n        vm.prank(gov);\n        params.postLowerDepth(1e30); // an instant \"lower\"\n        assertEq(params.risk(SIMD).line, 0, \"instant post raised the line\");\n    }\n}","reproduction":"Reproduced: test/scratch/ProofPostLower.t.sol (proof below). SIMD stored line 50,000, chop 0.2; setGenesisDepthRule(SIMD, 0.8e18, 0, 0, 0), no ImdDepth: risk(SIMD).line = 0. Governor postLowerDepth(1e30). Expected: an instant depth lower never raises the line (stays 0). Actual: 50,000. Output on this commit: `[FAIL: instant post raised the line: 50000000000000000000000 != 0] test_postLowerDepthNeverRaisesLine() (gas: 141973)`. Passes with the fix above.","severity":"low","snippet":"        if (depthIlk == bytes32(0) || depth == 0 || (depthCap != 0 && depth >= depthCap)) revert OutOfBounds();","title":"postLowerDepth (an instant 'lower') raises the depth from 0 on a chain with no ImdDepth, opening the depth-gated line without the timelock"},{"citation":"resolved","description":"setRates uses lastRate[ilk] == 0 as 'no previous call', but 0 is a legal target whenever the constructor listed the type with minRate == 0 (line 124 only requires min <= max; line 173 then accepts rate 0). After setRates(ilk, 0, ...) the next call one minInterval later skips the step check and may set maxRate, moving every listed member straight to min(maxRate, their ceiling). This defeats the NatSpec guarantee at RateManager.sol:42-44 ('Move rates by more than maxStep per call'); the README known issue describes a walk of range/maxStep intervals, this is two intervals (e.g. 2h instead of 20h for 0-20% at a 1% step). Members' own floor/ceiling still bound the result (question 6: no member moved outside their limits, no premium charged). Not reachable in the beta: BetaConfig deploys no RateManager. Fix: test `lastCall[ilk] != 0` instead of `prior != 0` for the step check, or require minRate > 0.","line":176,"path":"src/managers/RateManager.sol","proof":"// SPDX-License-Identifier: MIT\npragma solidity 0.8.26;\n\nimport \"forge-std/Test.sol\";\nimport {RateManager, IManagedLedger} from \"src/managers/RateManager.sol\";\n\ncontract PrLedger {\n    address public nft = address(0xBEEF);\n    function RATE_COOLDOWN() external pure returns (uint256) { return 7 days; }\n}\n\n/// With a type minRate of 0 (accepted by the constructor), a target of 0 stores lastRate = 0, which\n/// `setRates` reads as \"no prior call\": the next call skips the maxStep check entirely.\ncontract ProofRateStep is Test {\n    RateManager rm;\n    bytes32 constant ETH = \"ETH\";\n\n    function setUp() public {\n        bytes32[] memory ilks = new bytes32[](1);\n        uint64[] memory mins = new uint64[](1);\n        uint64[] memory maxs = new uint64[](1);\n        (ilks[0], mins[0], maxs[0]) = (ETH, 0, 0.2e18);\n        rm = new RateManager(IManagedLedger(address(new PrLedger())), address(this), ilks, mins, maxs, 1 hours, 0.01e18);\n    }\n\n    function test_maxStepHoldsAfterZeroTarget() public {\n        uint256[] memory none = new uint256[](0);\n        vm.warp(1_000_000);\n        rm.setRates(ETH, 0.01e18, none, none, none); // first call: 1%\n        vm.warp(1_000_000 + 1 hours);\n        rm.setRates(ETH, 0, none, none, none); // one 1-point step down to 0: allowed\n        vm.warp(1_000_000 + 2 hours);\n        vm.expectRevert(RateManager.StepTooLarge.selector); // expected: 0 -> 20% is a 20-point step\n        rm.setRates(ETH, 0.2e18, none, none, none); // actual: accepted (prior == 0 skips the check)\n    }\n}","reproduction":"Reproduced: test/scratch/ProofRateStep.t.sol (proof below). RateManager(ETH: minRate 0, maxRate 0.2e18, minInterval 1h, maxStep 0.01e18). t: setRates(ETH, 0.01e18); t+1h: setRates(ETH, 0); t+2h: setRates(ETH, 0.2e18). Expected: StepTooLarge. Actual: accepted. Output on this commit: `[FAIL: next call did not revert as expected] test_maxStepHoldsAfterZeroTarget() (gas: 173567)`.","severity":"low","snippet":"        uint64 prior = lastRate[ilk];\n        if (prior != 0 && (rate > prior ? rate - prior : prior - rate) > maxStep) revert StepTooLarge();","title":"RateManager: a target of 0 (allowed when a type's minRate is 0) resets the maxStep reference, so the next call can jump the whole range"},{"citation":"resolved","description":"ImdUSD.setKeeper / setBridge revert AlreadySet once set (ImdUSD.sol:89, 98). The beta names the keeper at genesis (setGenesisKeeper), so every SET_KEEPER proposal is accepted at propose and can never apply; slot 6 stays held until cancel. Same class as the README's malformed-payload issue but trivially checkable. Fix: in _validate revert BadConfig when IImdUSD(token).keeper() (or bridge()) is already non-zero.","line":41,"path":"src/ParametersRules.sol","reproduction":"Reproduced with test/scratch/ProofLedgerSide.t.sol: setGenesisKeeper(x); seal; governor propose(abi.encode(uint8(6), address(weth))) succeeds (validateKind -> Stop); +48h applyPending(6) -> `[FAIL: AlreadySet()] test_secondKeeperPassesProposeFailsApply()` (trace: ImdUSD::setKeeper <- [Revert] AlreadySet()). Expected: refused at propose.","severity":"info","snippet":"        } else if (kind == SET_BRIDGE || kind == SET_KEEPER) {\n            (, address minter) = abi.decode(payload, (uint8, address));\n            if (minter.code.length == 0) revert BadConfig();","title":"SET_KEEPER / SET_BRIDGE are validated only for code; a second one passes propose, waits 48h, then always fails (AlreadySet) and holds its slot"},{"citation":"resolved","description":"Backstop.addIlk reverts TooManyTokens when a NEW type is listed and ilkList.length == MAX_ILKS (12) (Backstop.sol:245). _validate checks only MAX_TOKENS for a new token. A new type whose token the sleeve already holds passes propose, waits 48h and reverts at apply; the ADD_SLEEVE_ILK slot is held until cancel. Comment at ParametersRules.sol:101-104 claims otherwise. Fix: expose ilkList length (or a full flag) on Backstop and check it in _validate.","line":105,"path":"src/ParametersRules.sol","reproduction":"Code trace: sleeve with ilkList.length == 12 and the new type's token already held (isToken true): _validate passes (lines 105-110), applyPending -> Backstop.addIlk new-ilk path -> line 245 `if (ilkList.length == MAX_ILKS) revert TooManyTokens();`. Not reached in the beta (fewer than 12 types per sleeve).","severity":"info","snippet":"            if (!ISleeve(sleeve).isToken(c.token) && ISleeve(sleeve).tokenCount() >= ISleeve(sleeve).MAX_TOKENS()) {\n                revert OutOfBounds();\n            }","title":"ADD_SLEEVE_ILK validation does not check the sleeve's MAX_ILKS, although its comment says propose refuses what apply would fail on"},{"citation":"resolved","description":"The NatSpec says a claim rule may never name a selector that moves or approves the account's tokens. The list omits increaseApproval(address,uint256) 0xd73dd623 (older Zeppelin/OZ 1.x tokens) and Permit2 approve(address,address,uint160,uint48) 0x87517c45 (selectors computed with `cast sig`). Needs a governor SET_SEAT_CLAIM naming such a target; a deny-list cannot be complete. Fix: add these, or move to an allow-list of reward-claim selectors.","line":215,"path":"src/ParametersRules.sol","reproduction":"propose(abi.encode(uint8(10), seatJoin, tokenWithIncreaseApproval, bytes4(0xd73dd623), uint8(1))) passes _validate line 149 (_movesTokens returns false for 0xd73dd623 / 0x87517c45 by inspection of lines 219-240).","severity":"info","snippet":"    /// @dev A SeatAccount forwards any calldata after an allowlisted (target, selector), so a claim rule may never\n    /// name a selector that moves or approves the account's tokens (ERC-20 / 721 / 1155 / 777 / 1363 transfers, approvals,\n    /// permits, and multicall, which reaches any of them): allowlisting one would let anyone move every account's unpaid rewards. Removing a rule (rule 0) is always allowed.","title":"_movesTokens deny-list misses approving selectors its NatSpec says can never be allowlisted (increaseApproval, Permit2 approve)"},{"citation":"resolved","description":"edgeIlk[ilk] is never cleared. After disableSleeveIlk(ilk, true), Backstop.edgeCapacity returns 0 for that type (Backstop.sol:375), and LedgerBase._checkEdge (LedgerBase.sol:421-431) reverts EdgeCapacityExceeded(sum, 0) on every borrow and charged rate change of that type while the summed edge debt is above 0. Risk-reducing, but stronger than documented (ParametersRules.sol:188-189 documents it; the function NatSpec and README trust model do not). Fix: document it.","line":179,"path":"src/Parameters.sol","reproduction":"Code trace: beta sIMD edge type with debt > 0; governor disableSleeveIlk(SIMD, true); a healthy sIMD borrower adjust(+1 imdUSD) -> _checkEdge -> edgeCapacity(SIMD) = 0 -> EdgeCapacityExceeded(sum, 0). Expected per NatSpec: borrowing unaffected.","severity":"info","snippet":"    /// @notice Stop a sleeve's standing bid on a type at once (the safe direction; liquidations fall back to the\n    /// caller/auction path). ADD_SLEEVE_ILK lists it again.","title":"disableSleeveIlk on an edge type also stops all borrowing and charged rate changes on it until a 48h relisting; its NatSpec says only the bid stops"},{"citation":"resolved","description":"Merged (economics, flow, math, permissions). ParametersBase.MAX_SAVINGS_SHARE = 0.5e18 (ParametersBase.sol:119), enforced in setGenesisSavings (Parameters.sol:55) and SET_SAVINGS_SHARE (ParametersRules.sol:46). Fix the text to 0-50% with a 10-point step.","line":11,"path":"src/Parameters.sol","reproduction":"With savingsShare 0.5e18, propose(abi.encode(uint8(5), uint64(0.55e18))) reverts OutOfBounds at ParametersRules.sol:46 although the header says it is in range.","severity":"info","snippet":"///    within 0-80%; open a fee-note series (tenor 30/90/180 days, discount <= 10%, a size cap); move a capped chain's","title":"Parameters header says the savers' share may be set within 0-80%; MAX_SAVINGS_SHARE is 50%"},{"citation":"resolved","description":"Merged (economics, math). Ledger.setRate's charged branch checks `_healthy(p.collateral, debt, q.low, q.mat)` (Ledger.sol:167-168, 'A rate change is not a borrow, so the cap does not measure its premium'); test/unit/CapAndSlots.t.sol test_cap_chargedRateChangeMeasuredAtLowNotCap asserts that. Fix: drop 'and a charged rate change'.","line":196,"path":"src/ParametersBase.sol","reproduction":"Type with cap = low/2, position healthy at low but not at low/2, owner's charged setRate inside cooldown succeeds (existing passing test above).","severity":"info","snippet":"    /// @notice A type's BORROW price ceiling (Sky's capped OSM): borrowing, withdrawing and a charged rate change\n    /// are measured at min(low, cap) (`Pricer.Quote.borrow`); liquidation health, liquidation prices and redemption payouts","title":"SET_CAP NatSpec says a charged rate change is measured at min(low, cap); the Ledger measures it at low"},{"citation":"resolved","description":"BetaConfig sets (c.chain.capped, c.chain.chainLine) = (true, TOTAL_LINES) (script/DeployConfig.sol:678) and setGenesisChainLine sets chainCapped = true permanently. Fix the comment.","line":145,"path":"src/ParametersBase.sol","reproduction":"On a BetaConfig deployment params.chainCap() returns (true, 300000e18).","severity":"info","snippet":"    /// @notice The chain's global debt cap, on chains whose genesis capped it (Robinhood); mainnet is uncapped.","title":"SET_CHAIN_LINE NatSpec says 'mainnet is uncapped'; the beta caps mainnet at 300k for good"},{"citation":"resolved","description":"Merged (flow, math, permissions). LedgerBase.Position ends with `uint32 version` (LedgerBase.sol:92-101). Decoding works today only because the trailing word is ignored; a field inserted before lastRateChange would shift the cooldown read at RateManager.sol:193. Fix: add `uint32 version;` or reword to 'a prefix of'.","line":4,"path":"src/managers/RateManager.sol","reproduction":"abi.encode(ledger.position(id)).length == 256 vs 224 for ManagedPosition (flow specialist's test).","severity":"info","snippet":"/// @dev The slice of the Ledger a manager reads and calls. Mirrors LedgerBase.Position's ABI exactly.","title":"ManagedPosition is said to mirror LedgerBase.Position's ABI exactly; Position has an eighth field (uint32 version)"},{"citation":"resolved","description":"After seal the governor still acts at once with lowerLine, lowerDepthLine, lowerCap, lowerKeeperCap, lowerUnbackedBrake, lowerEdgePremium, lowerDepthK, lowerOtherImdLines, postLowerDepth, removeDepthSampler and disableSleeveIlk. Fix the text.","line":307,"path":"src/Parameters.sol","reproduction":"After seal(), governor lowerLine(ETH, 0) applies in the same block without a proposal.","severity":"info","snippet":"    /// @notice End genesis. From here on only the timelock changes anything.","title":"seal() NatSpec: 'From here on only the timelock changes anything', yet eleven instant governor acts remain (two of which raise a line)"},{"citation":"resolved","description":"ParametersRules._apply SET_DEPTH (lines 293-298) only calls _flagDepth, never _requireDepth. A depth raise cannot worsen the rule, so this is harmless, but the sentence is false. Fix the text.","line":165,"path":"src/ParametersBase.sol","reproduction":"Rule broken (need 50k, room 40k); a SET_DEPTH raising room to 45k applies without revert.","severity":"info","snippet":"    /// (SET_RISK), raising k (SET_DEPTH_K) or posting a depth (SET_DEPTH) goes through the 48h timelock, and a raise\n    /// applies only if the rule then holds. Lowering the line, k or the depth is instant by the governor; if that breaks","title":"D1 NatSpec says a SET_DEPTH post applies only if the rule then holds; SET_DEPTH never checks the rule"}],"hash":"8bde1837d45c051443a4733bd3c47d63f2ae76da5ca72f329403c1de775624dc","nodeId":"c5d137be-5d79-4a8c-ab89-1798d5dfbefb","outcome":"completed","summary":"I reviewed the six files in scope at the pinned commit and wrote 16 findings to `.imd-findings.json`: 6 low and 10 info. There are no critical, high or medium findings. Every finding kept was reproduced, either by a Foundry run or by tracing the code where the finding says so. The four lows with the most impact carry a self-contained proof that fails on this commit.\n\n**How I tested.** This machine has Forge 1.8.3, so the faster `--use solar` build was not available and I used solc. I ran only files under `test/scratch/` with `forge test --match-path`. The first build took about 10 minutes, the next one about 1 minute. I ran:\n- all four specialist proofs (each fails for the reason its finding gives);\n- my own `postLowerDepth` proof;\n- one test built on the project's `System` harness that confirms the `CeilingExceeded`, `Unhealthy` and `AlreadySet` results described below.\n\nI deleted `test/scratch/` afterwards; the only new file left is `.imd-findings.json` (the `out/` and `cache/` build folders are git-ignored). I did not run the panel suites named in BUILD.\n\n## Answers\n\n**1. Timelocks per kind.** No change skips its 48 hours through `propose`, `applyPending` or a BATCH. Each BATCH item is checked when proposed and again just before it applies, and a batch locks every kind it carries. Every instant lower cancels any older proposal for the same field, so an older proposal cannot undo it.\n- No slot can be stuck for good: an expired or malformed proposal holds its slot only until the governor calls `cancel`.\n- **Finding (low):** one wrong-length `SET_MIGRATOR_LINE` or `SET_DEPTH` item inside a pending BATCH makes `_touches` revert. That blocks `lowerLine`, `lowerDepthLine`, `lowerCap` and `disableSleeveIlk` for *every* type until the batch is cancelled. All four specialists found this. It is worse than the README's known issue, which says such a payload blocks only its own kind.\n- Locks are per kind, not per type (one pending `SET_RISK` blocks the others). That is by design and documented, so I dropped it as a finding.\n\n**2. Bounds.** I found no value that passes validation and then breaks the Ledger, the Liquidator or the Redeemer:\n- `mat` must be at least `1 + chop`, and `chop` is between 2% and 25%.\n- `dust` must not exceed `line` (unless the line is 0) and is at most 5,000.\n- `redeemDivisor` is between 1 and 16, and `cut + chip` is at most 100%.\n- A cap never blocks a proportional repay-and-withdraw, which is measured at `low`.\n\nTwo smaller gaps:\n- **Info:** a second `SET_KEEPER` or `SET_BRIDGE` passes `propose` and then always fails at apply.\n- **Info:** `ADD_SLEEVE_ILK` does not check the sleeve's 12-type limit (`MAX_ILKS`), so it can pass `propose` and fail at apply.\n\n**3. Instant lowers.** `lowerKeeperCap`, `lowerUnbackedBrake`, `lowerEdgePremium`, `lowerDepthK` and `removeDepthSampler` only reduce risk. Exceptions:\n- **Low:** `lowerLine`, or any fall in the live depth line, stops an owner inside the 7-day cooldown from changing their rate (`CeilingExceeded`). The NatSpec says positions are untouched.\n- **Low:** an instant `lowerCap` also refuses plain collateral withdrawals (`Unhealthy`). The NatSpec says it only stops new borrowing.\n- **Info:** `disableSleeveIlk` on an edge type also freezes all borrowing on that type until it is relisted.\n- **Low:** `lowerOtherImdLines` and, on a chain with no measured depth contract (`ImdDepth`), `postLowerDepth` *raise* the sIMD line instantly.\n- Repayment, redemption and liquidation are never blocked.\n- There is no instant way to lower the chain line or a group line. That is a design gap, not a defect.\n\n**4. Genesis and seal.** The wirer has no power left after `seal`: every genesis setter checks `sealed_`, and `wire` is one-shot. These are fixed for good by design: the savings vault, the fee-notes contract, the two Backstops, the depth contract and depth type, the keeper, the edge flag on a type, and the chain cap once set. Everything else can be corrected by a timelocked kind. Noth","treeHash":null,"usage":{"cachedInputTokens":1578881,"cost":{"source":"runtime","usdMicros":1945448},"inputTokens":30,"model":"claude-opus-5-5","outputTokens":31097,"runtime":"claude","turns":21,"wallClockMs":981798}},{"artifacts":[],"attempt":1,"bundleHash":null,"device":"33bef35e96ccb653","findings":[{"citation":"resolved","description":"Parameters.lowerLine / lowerDepthLine (and, for the depth-gated type, any fall of risk(depthIlk).line through depthLine()) sets the type's line below its debt. The Ledger then refuses every charged rate change: Ledger.setRate mints the 7-day premium as debt and checks `s.debt + s.badDebt > params.risk(ilk).line` (Ledger.sol:162) before the health check, so an owner who changed their rate (or opened) inside the last 7 days cannot move their rate at all until the cooldown lapses, in either direction. A borrower at the front of the redemption queue cannot raise their rate to step out of it; the only way out is to wait up to 7 days or repay. Repay, deposit, redemption and liquidation are unaffected (so the instant lower still reduces risk), but the NatSpec claim that positions are untouched is not accurate, and the same clamp bites sIMD borrowers whenever measured depth falls (no governor action). Reachable with BetaConfig: every type; the sIMD line is clamped live by depth. Smallest fix: treat the cooldown premium like accrued interest (it is minted as interest and is not new borrowing): skip the per-type line check for it, or at least document the effect in lowerLine/_lowerLine and in the D1 comment (ParametersBase.sol:170-171 says only 'repay, redemption and liquidation ... carry on').","line":222,"path":"src/Parameters.sol","reproduction":"State: ETH type mat 1.4, line 1,000,000; alice opens 10 ETH @ $2000 with 5,000 imdUSD at 5%. Governor calls lowerLine(ETH, 1000e18) (below the 5,000 of debt). Alice calls ledger.setRate(id, 0.06e18, 0, 0) inside the 7-day cooldown. Expected (per NatSpec): the position is untouched, the owner pays the premium and gets the new rate. Actual: revert CeilingExceeded(). After warp +7 days the same call succeeds (free change). Test test_lowerLineBlocksChargedRateChange in the file below passes on this commit, i.e. the revert is observed. Run: forge test --match-path 'test/scratch/ProofParamsLow.t.sol' -vv\n[PASS] test_lowerLineBlocksChargedRateChange() (gas: 1096464)\n[PASS] test_malformedBatchItemBlocksInstantLowerCap() (gas: 636472)\n[PASS] test_managedPositionIsNotAnExactMirror() (gas: 698611)\nSuite result: ok. 3 passed; 0 failed; 0 skipped\n\n// SPDX-License-Identifier: MIT\npragma solidity 0.8.26;\n\nimport {IERC20} from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport {System} from \"../utils/System.sol\";\nimport {MockERC20, MockFeed} from \"../utils/Mocks.sol\";\nimport {ParametersBase} from \"../../src/ParametersBase.sol\";\nimport {IFeed} from \"../../src/interfaces/IFeed.sol\";\nimport {Adjust} from \"../../src/interfaces/IPositions.sol\";\nimport {IManagedLedger, ManagedPosition} from \"../../src/managers/RateManager.sol\";\n\ncontract ProofParamsLow is System {\n    bytes32 constant ETH = \"ETH\";\n    MockERC20 weth;\n    MockFeed feed;\n    address alice = makeAddr(\"alice\");\n\n    function setUp() public {\n        vm.warp(1_800_000_000);\n        weth = new MockERC20(\"WETH\", 18);\n        feed = new MockFeed(2000e18);\n        _deploySystem(IERC20(address(new MockERC20(\"imdUSDv1\", 18))));\n        _addIlk(ETH, address(weth), feed, feed, IFeed(address(0)), address(0), address(0), true, _risk(1.4e18, 1_000_000e18));\n        params.setGenesisCap(ETH, 3000e18);\n        params.seal();\n        weth.mint(alice, 1000e18);\n        vm.startPrank(alice);\n        weth.approve(address(ledger), type(uint256).max);\n        usd.approve(address(ledger), type(uint256).max);\n        vm.stopPrank();\n    }\n\n    function _open(uint256 c, uint256 d, uint64 rate) internal returns (uint256 id) {\n        vm.prank(alice);\n        id = ledger.open(ETH, 0, Adjust(int256(c), int256(d), rate, 0, 0, false, type(uint256).max, address(0)));\n    }\n\n    /// lowerLine says \"Positions are untouched\": a borrower inside the 7-day cooldown can no longer change their rate.\n    function test_lowerLineBlocksChargedRateChange() public {\n        uint256 id = _open(10e18, 5000e18, 0.05e18);\n        vm.prank(governor);\n        params.lowerLine(ETH, 1000e18); // below the 5000 of debt\n        vm.prank(alice);\n        vm.expectRevert(bytes4(keccak256(\"CeilingExceeded()\")));\n        ledger.setRate(id, 0.06e18, 0, 0);\n        // after the cooldown the change is free and allowed\n        vm.warp(block.timestamp + 7 days);\n        feed.set(2000e18);\n        vm.prank(alice);\n        ledger.setRate(id, 0.06e18, 0, 0);\n    }\n\n    /// A 1-word SET_MIGRATOR_LINE item (accepted at propose: the kind is not decoded) inside a batch that also carries\n    /// SET_CAP makes every instant lowerCap on that type revert in _touches until the governor cancels the batch.\n    function test_malformedBatchItemBlocksInstantLowerCap() public {\n        bytes[] memory items = new bytes[](2);\n        items[0] = abi.encode(uint8(3)); // SET_MIGRATOR_LINE, one word only\n        items[1] = abi.encode(uint8(21), ETH, uint256(5000e18)); // SET_CAP\n        vm.startPrank(governor);\n        params.propose(abi.encode(uint8(17), items)); // BATCH\n        vm.expectRevert();\n        params.lowerCap(ETH, 2500e18);\n        params.cancel(uint8(17));\n        params.lowerCap(ETH, 2500e18);\n        vm.stopPrank();\n        assertEq(params.cap(ETH), 2500e18);\n    }\n\n    /// ManagedPosition (7 words) is not the Ledger's Position (8 words: `uint32 version` at the end).\n    function test_managedPositionIsNotAnExactMirror() public {\n        uint256 id","severity":"low","snippet":"    /// 48h wait). Strictly lowering; raising stays a SET_RISK proposal. Positions are untouched.","title":"lowerLine (and a depth fall) refuses a borrower's in-cooldown rate change: 'Positions are untouched' does not hold"},{"citation":"resolved","description":"_kindsOf and _validate accept a SET_MIGRATOR_LINE (kind 3) or SET_DEPTH (kind 16) item that is a single 32-byte word (the known issue says such a payload only 'blocks the slot until cancelled'). But when that item sits in a BATCH together with a per-type kind (SET_CAP or SET_RISK or ADD_SLEEVE_ILK), every instant lower of that kind for a type (lowerCap, lowerLine, lowerDepthLine, disableSleeveIlk) goes through _cancelPending -> _touches on the batch payload, which abi.decodes EVERY item as (uint8, bytes32) and reverts on the 32-byte item. The instant risk-reducing action is therefore blocked for that kind on every type until the Safe first calls cancel(BATCH), i.e. two Safe transactions instead of one in an emergency. Worse than the known issue as written: it blocks an instant lower, not only the slot. Reachable with BetaConfig (governor-made payload; the day-7 batch is exactly a BATCH carrying SET_RISK). Smallest fix: decode (uint8, uint256) for SET_MIGRATOR_LINE and SET_DEPTH in _validate (so a malformed item is refused at propose), and/or make _touches return false for `p.length < 64`.","line":287,"path":"src/Parameters.sol","reproduction":"Governor proposes BATCH [abi.encode(uint8(3)) (one word), abi.encode(uint8(21), 'ETH', 5000e18)] with cap(ETH)=3000e18: propose succeeds. Governor then calls lowerCap('ETH', 2500e18). Expected: the cap is set at once (the pending SET_CAP touching ETH is cancelled). Actual: revert (abi.decode of a 32-byte item as (uint8, bytes32)). After cancel(17) the same lowerCap succeeds. Test test_malformedBatchItemBlocksInstantLowerCap below passes on this commit (observes the revert). Run: forge test --match-path 'test/scratch/ProofParamsLow.t.sol' -vv\n[PASS] test_lowerLineBlocksChargedRateChange() (gas: 1096464)\n[PASS] test_malformedBatchItemBlocksInstantLowerCap() (gas: 636472)\n[PASS] test_managedPositionIsNotAnExactMirror() (gas: 698611)\nSuite result: ok. 3 passed; 0 failed; 0 skipped","severity":"low","snippet":"        (uint8 k, bytes32 i) = abi.decode(p, (uint8, bytes32));","title":"A one-word SET_MIGRATOR_LINE/SET_DEPTH item inside a pending BATCH makes the instant lowers of that batch's kinds revert in _touches until the batch is cancelled"},{"citation":"resolved","description":"Pricer.quote measures q.borrow = min(low, cap). Ledger._adjustPrice (Ledger.sol:349-351) returns q.borrow for any withdrawal that is not a proportional repay, so an instant lowerCap to the allowed floor (live low / 100, or any value while the median is stale since _liveLow then reads 0 and the floor does not apply) makes every withdrawal of excess collateral by a position with debt revert Unhealthy until the owner repays. ParametersBase.sol:196-197 states this correctly ('borrowing, withdrawing and a charged rate change are measured at min(low, cap)'); the lowerCap NatSpec and the Parameters header do not. This is a governor power (trust assumption), reachable with BetaConfig on every type; the existing test CapAndSlots.test_cap_borrowAndWithdrawRefusedAboveCapPrice shows the withdrawal refusal. Smallest fix: correct the NatSpec; optionally bound lowerCap below by a larger fraction of the live low (1/100 lets a cap freeze all withdrawals on a type).","line":193,"path":"src/Parameters.sol","reproduction":"ETH low $2000, position 10 ETH / 5,000 debt (CR 400%). Governor: lowerCap('ETH', 20e18) (= low/100, accepted). Owner: adjust(id, dCollateral=-1e18, dDebt=0). Expected per NatSpec: positions untouched, withdrawal of excess collateral allowed (CR stays 360%). Actual: Unhealthy (9 ETH x $20 = $180 < 5,000 x 1.4). A proportional repay-and-withdraw is still allowed (measured at low).","severity":"low","snippet":"    /// @notice Set a ceiling on a type with none, or lower one, at once (it only stops new borrowing; positions untouched).","title":"lowerCap NatSpec says it 'only stops new borrowing; positions untouched' but it also refuses collateral withdrawals"},{"citation":"resolved","description":"ParametersBase.MAX_SAVINGS_SHARE = 0.5e18 ('50% since 2026-10-29', ParametersBase.sol:118-119) and both setGenesisSavings and SET_SAVINGS_SHARE revert OutOfBounds above it; the contract header still says 0-80%. Stale NatSpec only.","line":11,"path":"src/Parameters.sol","reproduction":"Governor proposes abi.encode(uint8(5), uint64(0.6e18)) after genesis share 0.35e18 (also within the 10-point step rule: it is not, 0.6 > 0.45; use 0.55e18 against a 0.5 share): revert OutOfBounds because 0.55e18 > MAX_SAVINGS_SHARE. Expected per header: accepted up to 80%.","severity":"info","snippet":"///    within 0-80%; open a fee-note series (tenor 30/90/180 days, discount <= 10%, a size cap); move a capped chain's","title":"Header claims the savers' share can be set 'within 0-80%'; MAX_SAVINGS_SHARE is 50%"},{"citation":"resolved","description":"script/DeployConfig.sol BetaConfig.get sets (c.chain.capped, c.chain.chainLine) = (true, 300_000e18) and StageTypes calls setGenesisChainLine, which sets chainCapped = true for good ('never uncapped'). The comment describes the full config, not the deployment under audit; an operator reading the contract would not expect the 300k chain-wide ChainLineExceeded on mainnet, nor that lifting it needs SET_CHAIN_LINE (48h) and that it can never be removed.","line":145,"path":"src/ParametersBase.sol","reproduction":"On a BetaConfig deployment params.chainCap() returns (true, 300000e18); a borrow that pushes the sum of every type's debt + bad debt above 300k reverts ChainLineExceeded. Expected per comment: no chain cap on mainnet.","severity":"info","snippet":"    /// @notice The chain's global debt cap, on chains whose genesis capped it (Robinhood); mainnet is uncapped.","title":"SET_CHAIN_LINE NatSpec says 'mainnet is uncapped'; the beta deployment caps mainnet at 300k"},{"citation":"resolved","description":"LedgerBase.Position (LedgerBase.sol:92-101) ends with `uint32 version`, which ManagedPosition lacks. Ledger.position(id) returns 8 words; RateManager decodes 7. It works only because the Solidity ABI decoder tolerates longer return data for a static tuple, and because the missing field is the last one. The claim is false; a future field inserted before the end (or a reorder) would silently shift lastRateChange and make the cooldown skip (reason 4) read the wrong word, the one check that keeps the manager from attempting a premium-charging change (the Ledger would then revert NotOwner, so no premium is charged, but every such member would be skipped). Smallest fix: import and use LedgerBase.Position in the interface, or add the version field and a static assertion in tests.","line":4,"path":"src/managers/RateManager.sol","reproduction":"abi.encode(ledger.position(id)).length == 256 while abi.encode(IManagedLedger(address(ledger)).position(id)).length == 224 for the same id (test test_managedPositionIsNotAnExactMirror, passes on this commit: both lengths observed, debt and lastRateChange still equal). Run: forge test --match-path 'test/scratch/ProofParamsLow.t.sol' -vv\n[PASS] test_lowerLineBlocksChargedRateChange() (gas: 1096464)\n[PASS] test_malformedBatchItemBlocksInstantLowerCap() (gas: 636472)\n[PASS] test_managedPositionIsNotAnExactMirror() (gas: 698611)\nSuite result: ok. 3 passed; 0 failed; 0 skipped","severity":"info","snippet":"/// @dev The slice of the Ledger a manager reads and calls. Mirrors LedgerBase.Position's ABI exactly.","title":"ManagedPosition does not mirror LedgerBase.Position 'exactly': the Ledger struct has an 8th field (uint32 version)"},{"citation":"resolved","description":"A SET_RISK for ETH locks kind 1; a SET_RISK for WBTC proposed while it is pending reverts ProposalPending, as does a BATCH carrying any SET_RISK. With the beta's 10 types, a risk re-tune of one type delays re-tunes of the others by at least 48h unless they were batched together in advance; the only instant per-type action is lowerLine. Design limitation rather than a defect (the NatSpec at lines 7-10 is accurate), reported because the README's 'one pending slot per kind' may read as per field. Fix if wanted: key the lock for per-type kinds on (kind, ilk), or allow one more SET_RISK per type via the batch slot.","line":63,"path":"src/GovernedByKind.sol","reproduction":"Governor: propose(abi.encode(uint8(1), 'ETH', riskA)) then propose(abi.encode(uint8(1), 'WBTC', riskB)) in the same hour. Expected (per field slots): both pending. Actual: the second reverts ProposalPending; it can only be proposed after applyPending(1) or cancel(1).","severity":"info","snippet":"        if (locks & locked != 0) revert ProposalPending();","title":"Locks are per kind, not per type: one pending SET_RISK blocks a SET_RISK for every other type for 48h (plus until applied or cancelled)"},{"citation":"resolved","description":"ImdUSD.setKeeper / setBridge revert AlreadySet once set (ImdUSD.sol:87-102). The beta sets the keeper at genesis (setGenesisKeeper), so any SET_KEEPER proposal is accepted by propose, waits 48h, then can never apply; its slot (kind 6) holds until cancel. Same for a second SET_BRIDGE. Same class as the README's 'malformed proposal blocks the slot', but trivially checkable at propose. Fix: in _validate read ImdUSD.keeper()/bridge() and revert BadConfig when already set.","line":43,"path":"src/ParametersRules.sol","reproduction":"After genesis (usd.keeper() != 0): governor propose(abi.encode(uint8(6), somePegHook)) succeeds; 48h later applyPending(6) reverts AlreadySet; pendingOf(6) stays non-empty until cancel(6). Expected: refused at propose.","severity":"info","snippet":"            if (minter.code.length == 0) revert BadConfig();","title":"SET_KEEPER / SET_BRIDGE validate only 'has code'; a second one passes propose and fails at apply (ImdUSD AlreadySet), holding the slot"}],"hash":"a807cacc5c1a55b0fa5a81856419a10d5c6a959fa084c0779926f1a35a45a6c0","nodeId":"6043405e-6249-47f9-bf05-1a04fed7f93f","outcome":"completed","summary":"The review is complete. The findings file holds 8 entries (3 low, 5 info), every path, line and snippet verified against the tree, the scratch test deleted, and the tree unchanged. No critical or high defect was found in the governance panel at commit 2875ffb.\n\n## Build and test\n\nThe required panel run passed on this commit: 65 tests across the five suites, solc 0.8.26 via_ir, 3m21s.\n\n```\nforge test --match-path 'test/unit/{PanelParams,CapAndSlots,RiskVersions,RateManager,PanelRecheck}.t.sol'\nRan 8 test suites: 65 tests passed, 0 failed, 0 skipped\n```\n\nMy scratch file test/scratch/ProofParamsLow.t.sol (3 tests, all pass, source pasted inside the findings) demonstrated the three behaviours below and was removed.\n\n## Answers to the six questions\n\n**1. Timelocks per kind.** Holds. Every raise goes through propose, waits 48h, re-validates at apply, expires at ETA+14d. A batch locks BATCH plus every item kind, so no field can be pending twice; items are validated against the current state at propose, so a batch cannot chain two 10-point savings steps, two dust doublings or two cap doublings. Each instant lower cancels the slot carrying its kind, and for per-type fields only when the payload touches that type. No slot can be stuck for good: cancel(kind) never makes external calls. One low: a one-word SET_MIGRATOR_LINE or SET_DEPTH item in a batch makes `_touches` revert, so instant lowers of that batch's kinds need a prior cancel(BATCH).\n\n**2. Bounds.** Holds. mat in [1.01, 3] and at least 1+chop, chop in [2%, 25%], cut+chip at most 100%, divisor in [1, 16], redeem floor at most the Redeemer's 5% cap, dust at most 5,000 and at most the line when the line is non-zero, dust raises at most double. NHI types skip the mat bound but the Ledger uses the live NHI mat. The cap floor of low/100 still lets a cap freeze withdrawals (low, NatSpec).\n\n**3. Instant lowers.** All reduce protocol risk; repay, deposit, redemption and liquidation never read line, cap, k, depth or the brake. Two borrower harms found: a line below debt refuses an in-cooldown rate change with CeilingExceeded (low, reproduced), and a low cap refuses excess-collateral withdrawals (low, NatSpec).\n\n**4. Genesis and seal.** Holds. Every wirer setter checks sealed_, wire is blocked once ledger is set and seal requires it. Fixed for good after the seal: savings vault, notes, both sleeve addresses, imdDepth, depthIlk, chainCapped, edgeIlk flags. Documented as trust assumptions, not defects.\n\n**5. Depth rule.** Holds. The stored line can exceed the rule after a depth fall, but `risk()` clamps it live and the Ledger reads `risk(ilk).line`; raises of need or k call `_requireDepth` at apply. ImdDepth's sampler and leg setters are onlyParams. Only depth griefing lowers it (known issue).\n\n**6. RateManager.** Holds. The applied rate is clamped into the member's own floor and ceiling, which are validated inside the type bounds; the manager skips in-cooldown members and the Ledger independently refuses an operator's charged change with NotOwner, so no premium can be charged. The struct mirror claim is false but harmless today (info).\n\n## Coverage\n\n| Contract | Functions | Result |\n|---|---|---|\n| Governed | propose, cancel, applyPending | holds (Treasury uses it) |\n| GovernedByKind | propose, cancel(kind), applyPending(kind), cancel(), applyPending(), pendingOf, pending, pendingEta | holds; per-kind lock noted (info) |\n| Parameters | wire, addGenesisIlk, 12 setGenesis*, seal, listedAt, removeDepthSampler, lowerEdgePremium, disableSleeveIlk, lowerCap, lowerOtherImdLines, lowerDepthLine, lowerLine, lowerUnbackedBrake, lowerKeeperCap, lowerDepthK, postLowerDepth, views | holds; lowerLine and lowerCap carry low findings |\n| ParametersBase | depthRule, depthIMD, depthLine, exists, public getters | holds |\n| ParametersRules | validateKind, applyKind (delegate-only) and all 27 kinds | holds; SET_KEEPER/SET_BRIDGE validation noted (info) |\n| RateManager | constructor, join, setLimits, leave, setR","treeHash":null,"usage":{"cachedInputTokens":1940161,"cost":{"source":"runtime","usdMicros":6785476},"inputTokens":450,"model":"claude-fable-5-1","outputTokens":58382,"runtime":"claude","turns":37,"wallClockMs":1233363}},{"artifacts":[],"attempt":1,"bundleHash":null,"device":"c79042525fc4a50d","findings":[{"citation":"resolved","description":"_cancelPending(SET_RISK, ilk) (Parameters.sol:279-284) runs _touches over the pending slot holding SET_RISK. When SET_RISK is locked by a BATCH, _touches decodes EVERY item as (uint8, bytes32) (line 287) until one matches. SET_MIGRATOR_LINE (and SET_DEPTH) items are not decoded at propose (ParametersRules.sol:39-40, 66-67), so a one-word item such as abi.encode(uint8(3)) passes propose. The 32-byte item then makes abi.decode revert inside _touches, so lowerLine(anyIlk, x) and lowerDepthLine(x) revert, whichever type they target, for as long as the batch is pending. Its expiry does not release it: it stays until cancel(BATCH). README lists malformed SET_DEPTH / SET_MIGRATOR_LINE payloads as known, saying they block only their own kind. Here the consequence is worse than written: the payload also disables the instant line lower for every type, the brake README describes for 'a type that has just booked bad debt'. The Safe must first diagnose the revert, then cancel(BATCH), then lower: at least one extra 2-of-3 transaction during an incident. Call sequence: governor propose(abi.encode(17, [abi.encode(uint8(3)), abi.encode(1, ETH, risk)])) -> governor lowerLine(ETH, 0) reverts with empty data. Reachable with BetaConfig: the beta has SET_MIGRATOR_LINE and the day-7 Safe batch (depth post + sIMD line + keeper cap) is exactly a BATCH carrying SET_RISK. Smallest fix: decode every kind's payload in _validate (for example `abi.decode(payload, (uint8, uint256))` for SET_MIGRATOR_LINE and SET_DEPTH), or have _touches skip items shorter than 64 bytes (`if (p.length < 64) return false;`).","line":287,"path":"src/Parameters.sol","proof":"// SPDX-License-Identifier: MIT\npragma solidity 0.8.26;\n\nimport \"forge-std/Test.sol\";\nimport {Parameters} from \"src/Parameters.sol\";\nimport {ParametersBase} from \"src/ParametersBase.sol\";\nimport {IFeed} from \"src/interfaces/IFeed.sol\";\n\ncontract PbCode {}\n\ncontract PbJoin {\n    address public token;\n    address public ledger;\n    constructor(address t, address l) { token = t; ledger = l; }\n}\n\ncontract PbFeed {\n    function latestValue() external view returns (uint256, uint64) { return (2000e18, uint64(block.timestamp)); }\n    function isStale() external pure returns (bool) { return false; }\n    function maxAge() external pure returns (uint256) { return 1 hours; }\n}\n\n/// An instant lowerLine must win over (cancel) a pending batch that carries SET_RISK for the type.\n/// A batch item that `_validate` does not decode (SET_MIGRATOR_LINE of one word) passes propose, and then\n/// `_touches` (abi.decode(item, (uint8, bytes32))) reverts inside every SET_RISK instant lower.\ncontract ProofBatchLower is Test {\n    Parameters params;\n    address gov = address(0xA11CE);\n    bytes32 constant ETH = \"ETH\";\n\n    function setUp() public {\n        params = new Parameters(gov, address(this));\n        address ledger = address(new PbCode());\n        address token = address(new PbCode());\n        params.wire(ledger, token);\n        address coll = address(new PbCode());\n        address join = address(new PbJoin(coll, ledger));\n        IFeed f = IFeed(address(new PbFeed()));\n        ParametersBase.Config memory c = ParametersBase.Config(\n            coll, join, f, f, IFeed(address(0)), address(0), address(0), IFeed(address(0)), true, false\n        );\n        params.addGenesisIlk(ETH, c, _risk(50_000e18));\n        params.seal();\n    }\n\n    function _risk(uint128 line) internal pure returns (ParametersBase.Risk memory r) {\n        r = ParametersBase.Risk({\n            mat: 1.5e18, chop: 0.1e18, cut: 0, chip: 0, rateFloor: 0.01e18, yieldFee: 0, skew: 0.02e18,\n            pegFloor: 0, line: line, dust: 0, redeemFloor: 0.005e18, redeemDivisor: 1, redeemCap: 0\n        });\n    }\n\n    function test_instantLowerLineSurvivesMalformedBatchItem() public {\n        bytes[] memory items = new bytes[](2);\n        items[0] = abi.encode(uint8(3)); // SET_MIGRATOR_LINE with no value: _validate accepts it (no decode)\n        items[1] = abi.encode(uint8(1), ETH, _risk(60_000e18)); // a SET_RISK raise of ETH's line\n        vm.prank(gov);\n        params.propose(abi.encode(uint8(17), items)); // BATCH: accepted\n        assertEq(params.pendingKinds(), uint256(1) << 17);\n\n        // ETH has just booked bad debt: the Safe stops it at once.\n        vm.prank(gov);\n        params.lowerLine(ETH, 0); // expected: cancels the batch and sets the line to 0; actual: reverts in _touches\n        assertEq(params.storedRisk(ETH).line, 0, \"line lowered\");\n        assertEq(params.pendingKinds(), 0, \"batch carrying SET_RISK(ETH) cancelled\");\n    }\n\n    /// Control: the same batch with a well-formed first item is cancelled by the instant lower, as documented.\n    function test_controlWellFormedBatchIsCancelled() public {\n        bytes[] memory items = new bytes[](2);\n        items[0] = abi.encode(uint8(3), uint256(0));\n        items[1] = abi.encode(uint8(1), ETH, _risk(60_000e18));\n        vm.prank(gov);\n        params.propose(abi.encode(uint8(17), items));\n        vm.prank(gov);\n        params.lowerLine(ETH, 0);\n        assertEq(params.storedRisk(ETH).line, 0);\n        assertEq(params.pendingKinds(), 0);\n    }\n}","reproduction":"State: ETH listed with line 50,000; governor proposes BATCH [abi.encode(uint8(3)) (32 bytes), abi.encode(uint8(1), ETH, risk with line 60,000)]; propose succeeds. Then governor lowerLine(ETH, 0). Expected: the batch is cancelled and ETH's line becomes 0 (what the control test shows with a well-formed abi.encode(uint8(3), uint256(0)) item). Actual: lowerLine reverts (EvmError: Revert, abi.decode in _touches); line stays 50,000 and the batch stays pending. Run: forge test --match-path 'test/scratch/ProofBatchLower.t.sol' -vv -> [PASS] test_controlWellFormedBatchIsCancelled() (gas: 769314); [FAIL: EvmError: Revert] test_instantLowerLineSurvivesMalformedBatchItem() (gas: 688325).","severity":"low","snippet":"        (uint8 k, bytes32 i) = abi.decode(p, (uint8, bytes32));","title":"A batch item that _validate does not decode makes every instant SET_RISK lower (lowerLine / lowerDepthLine) revert until the Safe cancels the batch"},{"citation":"resolved","description":"The sIMD line the Ledger enforces is risk(depthIlk).line = min(stored line, depthLine()) (Parameters.sol:332-338). depthLine() (ParametersBase.sol:480-487) subtracts otherImdLines x (1 + otherImdChop) from k x depth. lowerOtherImdLines (Parameters.sol:205-211) lowers otherImdLines at once, so whenever depthLine() binds (the beta's normal state: the sIMD line is set to what D1 admits), it RAISES the enforced sIMD line in the same transaction. Nothing checks that the other chain actually lowered its line. README invariant 7 says every governed raise of lines waits 48 hours. The trust model lists the instant acts (lowering a line, a cap, a keeper cap, a depth ceiling, a bucket; disabling a listing; unfreezing), and this act is not among them, yet it increases risk on this chain. sIMD is also the type the README says has no market check, with 'Re-measure before any raise of the sIMD line'. Reachable with BetaConfig: MainnetConfig sets otherImdLines = RobinhoodConfig.IMD_LINE = 3,000e18 at chop 0.2 and BetaConfig inherits it, so lowerOtherImdLines(0) raises the beta sIMD line by 3,000 x 1.2 / 1.2 = 3,000 imdUSD at once. The bound is the stored line. Smallest fix: drop the instant function and let SET_OTHER_IMD (already timelocked, accepts decreases) carry decreases, or make the instant form refuse while depthLine() < the stored line.","line":205,"path":"src/Parameters.sol","proof":"// SPDX-License-Identifier: MIT\npragma solidity 0.8.26;\n\nimport \"forge-std/Test.sol\";\nimport {Parameters} from \"src/Parameters.sol\";\nimport {ParametersBase} from \"src/ParametersBase.sol\";\nimport {IFeed} from \"src/interfaces/IFeed.sol\";\n\ncontract PoCode {}\n\ncontract PoJoin {\n    address public token;\n    address public ledger;\n    constructor(address t, address l) { token = t; ledger = l; }\n}\n\ncontract PoFeed {\n    function latestValue() external view returns (uint256, uint64) { return (1e18, uint64(block.timestamp)); }\n    function isStale() external pure returns (bool) { return false; }\n    function maxAge() external pure returns (uint256) { return 1 hours; }\n}\n\n/// `lowerOtherImdLines` is an instant governor act that RAISES the depth-gated type's effective line\n/// (`risk(depthIlk).line` = min(stored, depthLine())), with no 48h timelock. Beta values: k 0.8, otherImdLines\n/// 3,000 at chop 0.2, sIMD chop 0.2.\ncontract ProofOtherImd is Test {\n    Parameters params;\n    address gov = address(0xA11CE);\n    bytes32 constant SIMD = \"SIMD\";\n\n    function setUp() public {\n        params = new Parameters(gov, address(this));\n        address ledger = address(new PoCode());\n        address token = address(new PoCode());\n        params.wire(ledger, token);\n        address coll = address(new PoCode());\n        address join = address(new PoJoin(coll, ledger));\n        IFeed f = IFeed(address(new PoFeed()));\n        ParametersBase.Config memory c = ParametersBase.Config(\n            coll, join, f, f, IFeed(address(0)), address(0), address(0), IFeed(address(0)), true, false\n        );\n        ParametersBase.Risk memory r = ParametersBase.Risk({\n            mat: 1.5e18, chop: 0.2e18, cut: 0, chip: 0, rateFloor: 0.01e18, yieldFee: 0, skew: 0.02e18,\n            pegFloor: 0, line: 50_000e18, dust: 0, redeemFloor: 0.005e18, redeemDivisor: 1, redeemCap: 0\n        });\n        params.addGenesisIlk(SIMD, c, r);\n        // no ImdDepth here, so the posted 60k is the depth: room 48k, other chains 3,600, line (48k-3.6k)/1.2 = 37k\n        params.setGenesisDepthRule(SIMD, 0.8e18, 60_000e18, 3_000e18, 0.2e18);\n        params.seal();\n    }\n\n    function test_instantLowerDoesNotRaiseDepthGatedLine() public {\n        uint256 before = params.risk(SIMD).line;\n        assertEq(before, 37_000e18);\n        vm.prank(gov);\n        params.lowerOtherImdLines(0); // the other chain still runs its 3,000 line; nothing checks that\n        // Expected (README invariant 7 / trust model: instant acts only reduce risk): the sIMD line does not rise.\n        assertLe(params.risk(SIMD).line, before, \"instant act raised the sIMD line\"); // actual: 40,000\n    }\n}","reproduction":"Parameters with SIMD (chop 0.2, stored line 50,000, redeemCap 0), setGenesisDepthRule(SIMD, k 0.8, posted depth 60,000, otherLines 3,000, otherChop 0.2), no ImdDepth: risk(SIMD).line = (48,000 - 3,600) / 1.2 = 37,000. Governor calls lowerOtherImdLines(0) in one transaction. Expected: no instant act raises a line (it stays 37,000 until a 48h proposal applies). Actual: risk(SIMD).line = 40,000 at once. Run: forge test --match-path 'test/scratch/ProofOtherImd.t.sol' -vv -> [FAIL: instant act raised the sIMD line: 40000000000000000000000 > 37000000000000000000000] test_instantLowerDoesNotRaiseDepthGatedLine() (gas: 126971).","severity":"low","snippet":"    function lowerOtherImdLines(uint256 lines) external onlyGovernor {","title":"lowerOtherImdLines is an instant governor act that raises the depth-gated (sIMD) line without the 48h timelock"},{"citation":"resolved","description":"setRates treats lastRate == 0 as 'no previous call'. The constructor accepts minRates[i] == 0 (line 124 only requires min <= max), so the manager can set the target to 0 in one step and then, one minInterval later, jump to maxRate in a single call. The NatSpec at line 42 ('Move rates by more than maxStep per call') and the step bound never apply to that jump. README already accepts that calls with no ids can walk the target across the range. This variant is faster: two calls (two intervals) instead of range/maxStep intervals, for example 2 hours instead of 20 for a 0-20% range at maxStep 1%. RateManager is round 2 and not deployed in the beta (BetaConfig does not deploy it), so this is unreachable at beta values. Smallest fix: track 'first call' with lastCall[ilk] != 0 instead of prior != 0 (`if (lastCall[ilk] != 0 && diff > maxStep) revert StepTooLarge();`), or refuse minRate == 0 in the constructor.","line":177,"path":"src/managers/RateManager.sol","proof":"// SPDX-License-Identifier: MIT\npragma solidity 0.8.26;\n\nimport \"forge-std/Test.sol\";\nimport {RateManager, IManagedLedger} from \"src/managers/RateManager.sol\";\n\ncontract PrLedger {\n    address public nft = address(0xBEEF);\n    function RATE_COOLDOWN() external pure returns (uint256) { return 7 days; }\n}\n\n/// With a type minRate of 0 (accepted by the constructor), a target of 0 stores lastRate = 0, which\n/// `setRates` reads as \"no prior call\": the next call skips the maxStep check entirely.\ncontract ProofRateStep is Test {\n    RateManager rm;\n    bytes32 constant ETH = \"ETH\";\n\n    function setUp() public {\n        bytes32[] memory ilks = new bytes32[](1);\n        uint64[] memory mins = new uint64[](1);\n        uint64[] memory maxs = new uint64[](1);\n        (ilks[0], mins[0], maxs[0]) = (ETH, 0, 0.2e18);\n        rm = new RateManager(IManagedLedger(address(new PrLedger())), address(this), ilks, mins, maxs, 1 hours, 0.01e18);\n    }\n\n    function test_maxStepHoldsAfterZeroTarget() public {\n        uint256[] memory none = new uint256[](0);\n        vm.warp(1_000_000);\n        rm.setRates(ETH, 0.01e18, none, none, none); // first call: 1%\n        vm.warp(1_000_000 + 1 hours);\n        rm.setRates(ETH, 0, none, none, none); // one 1-point step down to 0: allowed\n        vm.warp(1_000_000 + 2 hours);\n        vm.expectRevert(RateManager.StepTooLarge.selector); // expected: 0 -> 20% is a 20-point step\n        rm.setRates(ETH, 0.2e18, none, none, none); // actual: accepted (prior == 0 skips the check)\n    }\n}","reproduction":"RateManager(ETH: minRate 0, maxRate 0.2e18, minInterval 1h, maxStep 0.01e18). t=1,000,000: setRates(ETH, 0.01e18, [], [], []); t+1h: setRates(ETH, 0, ...) (a 1-point step); t+2h: setRates(ETH, 0.2e18, ...). Expected: StepTooLarge (a 20-point step). Actual: accepted, lastRate = 0.2e18, and with ids every member moves straight to min(0.2e18, ceiling). Run: forge test --match-path 'test/scratch/ProofRateStep.t.sol' -vv -> [FAIL: next call did not revert as expected] test_maxStepHoldsAfterZeroTarget() (gas: 173567).","severity":"low","snippet":"        if (prior != 0 && (rate > prior ? rate - prior : prior - rate) > maxStep) revert StepTooLarge();","title":"RateManager: a target of 0 (allowed when a type's minRate is 0) resets lastRate and disables the maxStep check on the next call"},{"citation":"resolved","description":"postLowerDepth treats depthCap == 0 as 'no ceiling', so any value is a lowering. That holds only where an ImdDepth measures depth. depthIMD() (ParametersBase.sol:469-470) returns depthCap itself when imdDepth is unset, and there 0 means zero depth (depthLine() = 0). On such a chain, which ParametersBase's D1 NatSpec supports explicitly ('Chains without an ImdDepth fall back to the posted figure alone'), the governor's instant postLowerDepth(X) raises the depth from 0 to X and opens the depth-gated type up to its stored line with no timelock. A posted 0 is reached through setGenesisDepthRule(.., depth 0, ..) or SET_DEPTH(0). Call sequence: governor postLowerDepth(1e30) -> risk(depthIlk).line goes from 0 to the stored line. Reachability with BetaConfig: not reachable. The beta mainnet sets an ImdDepth, and there depthCap 0 does mean 'none'. It matters for any deployment with a depth rule and no ImdDepth. Smallest fix: `if (depthIlk == bytes32(0) || depth == 0 || ((depthCap != 0 || address(imdDepth) == address(0)) && depth >= depthCap)) revert OutOfBounds();`, or simply require depth < depthIMD().","line":263,"path":"src/Parameters.sol","proof":"// SPDX-License-Identifier: MIT\npragma solidity 0.8.26;\n\nimport \"forge-std/Test.sol\";\nimport {Parameters} from \"src/Parameters.sol\";\nimport {ParametersBase} from \"src/ParametersBase.sol\";\nimport {IFeed} from \"src/interfaces/IFeed.sol\";\n\ncontract PlCode {}\n\ncontract PlJoin {\n    address public token;\n    address public ledger;\n    constructor(address t, address l) { token = t; ledger = l; }\n}\n\ncontract PlFeed {\n    function latestValue() external view returns (uint256, uint64) { return (1e18, uint64(block.timestamp)); }\n    function isStale() external pure returns (bool) { return false; }\n    function maxAge() external pure returns (uint256) { return 1 hours; }\n}\n\n/// On a chain without an ImdDepth the posted `depthCap` IS the depth (0 = zero depth, line 0), yet\n/// `postLowerDepth` accepts any value while depthCap == 0: the instant \"lower\" raises the depth from 0.\ncontract ProofPostLower is Test {\n    Parameters params;\n    address gov = address(0xA11CE);\n    bytes32 constant SIMD = \"SIMD\";\n\n    function setUp() public {\n        params = new Parameters(gov, address(this));\n        address ledger = address(new PlCode());\n        address token = address(new PlCode());\n        params.wire(ledger, token);\n        address coll = address(new PlCode());\n        address join = address(new PlJoin(coll, ledger));\n        IFeed f = IFeed(address(new PlFeed()));\n        ParametersBase.Config memory c = ParametersBase.Config(\n            coll, join, f, f, IFeed(address(0)), address(0), address(0), IFeed(address(0)), true, false\n        );\n        ParametersBase.Risk memory r = ParametersBase.Risk({\n            mat: 1.5e18, chop: 0.2e18, cut: 0, chip: 0, rateFloor: 0.01e18, yieldFee: 0, skew: 0.02e18,\n            pegFloor: 0, line: 50_000e18, dust: 0, redeemFloor: 0.005e18, redeemDivisor: 1, redeemCap: 0\n        });\n        params.addGenesisIlk(SIMD, c, r);\n                params.setGenesisDepthRule(SIMD, 0.8e18, 0, 0, 0); // posted depth 0: the rule admits line 0\n        params.seal();\n    }\n\n    function test_postLowerDepthNeverRaisesLine() public {\n        assertEq(params.risk(SIMD).line, 0);\n        vm.prank(gov);\n        params.postLowerDepth(1e30); // accepted: depthCap was 0\n        // Expected: a \"lower\" depth post never raises the line. Actual: the full stored 50,000 line opens at once.\n        assertEq(params.risk(SIMD).line, 0, \"instant post raised the line\");\n    }\n}","reproduction":"Parameters with SIMD (stored line 50,000, chop 0.2, redeemCap 0), setGenesisDepthRule(SIMD, k 0.8, depth 0, 0, 0), no ImdDepth: risk(SIMD).line = 0. Governor postLowerDepth(1e30). Expected: an instant depth 'lower' never raises the line (stays 0). Actual: risk(SIMD).line = 50,000 at once. Run: forge test --match-path 'test/scratch/ProofPostLower.t.sol' -vv -> [FAIL: instant post raised the line: 50000000000000000000000 != 0] test_postLowerDepthNeverRaisesLine() (gas: 141973).","severity":"low","snippet":"        if (depthIlk == bytes32(0) || depth == 0 || (depthCap != 0 && depth >= depthCap)) revert OutOfBounds();","title":"postLowerDepth raises the depth from 0 when depthCap is 0 on a chain without an ImdDepth (an instant 'lower' that opens the depth-gated line)"},{"citation":"resolved","description":"The contract header says governance can set the savers' share 'within 0-80%'. ParametersBase.MAX_SAVINGS_SHARE is 0.5e18 (ParametersBase.sol:119) and both setGenesisSavings and SET_SAVINGS_SHARE refuse above it.","line":11,"path":"src/Parameters.sol","reproduction":"propose(abi.encode(uint8(5), uint64(0.6e18))) with savingsShare 0.5e18: the comment says it is in range, but _validate reverts OutOfBounds (share > MAX_SAVINGS_SHARE). The comment is wrong; fix the text to 0-50%.","severity":"info","snippet":"///    within 0-80%; open a fee-note series (tenor 30/90/180 days, discount <= 10%, a size cap); move a capped chain's","title":"Parameters NatSpec gives the savings share bound as 0-80%; the code bounds it at 50%"},{"citation":"resolved","description":"ParametersBase.sol:196-197 claims the cap measures borrowing, withdrawing and a charged rate change. Ledger.setRate's charged branch checks `_healthy(p.collateral, debt, q.low, q.mat)` (Ledger.sol:168, comment: 'A rate change is not a borrow, so the cap does not measure its premium'). The cap therefore never stops a charged rate change.","line":196,"path":"src/ParametersBase.sol","reproduction":"Type with cap = 0.5 x low; owner's position at 1.6 x mat on low (0.8 x mat on the cap), inside its cooldown, calls setRate(newRate): the NatSpec implies Unhealthy at the cap; actual: accepted (measured at low). Fix the comment (drop 'and a charged rate change').","severity":"info","snippet":"    /// @notice A type's BORROW price ceiling (Sky's capped OSM): borrowing, withdrawing and a charged rate change","title":"SET_CAP NatSpec says a charged rate change is measured at min(low, cap); the Ledger measures it at low"},{"citation":"resolved","description":"After seal the governor can still change state at once with lowerLine, lowerDepthLine, lowerCap, lowerKeeperCap, lowerUnbackedBrake, lowerEdgePremium, lowerDepthK, lowerOtherImdLines, postLowerDepth, removeDepthSampler and disableSleeveIlk. Two of these raise a line (see the lowerOtherImdLines and postLowerDepth findings). GovernedByKind.sol:72 ('cancel ... the only action with no delay') makes the same overstatement.","line":307,"path":"src/Parameters.sol","reproduction":"After seal(), governor lowerLine(ETH, 0) applies in the same block, with no proposal: contradicts the comment. Fix the text to name the instant risk-reducing acts.","severity":"info","snippet":"    /// @notice End genesis. From here on only the timelock changes anything.","title":"Parameters.seal NatSpec: 'From here on only the timelock changes anything', but the instant governor lowers remain"},{"citation":"resolved","description":"ParametersRules._apply SET_DEPTH (ParametersRules.sol:293-298) sets depthCap to any value and only calls _flagDepth. It never calls _requireDepth, and neither do ADD_DEPTH_SAMPLER and SET_DEPTH_LEG. A depth raise cannot itself break the rule, so this is harmless. But a SET_DEPTH that leaves the rule still broken applies, contrary to the sentence.","line":165,"path":"src/ParametersBase.sol","reproduction":"Rule broken (need 50k, room 40k); SET_DEPTH raising the cap so room becomes 45k applies without revert (the comment says only if the rule then holds). Fix the text.","severity":"info","snippet":"/// (SET_RISK), raising k (SET_DEPTH_K) or posting a depth (SET_DEPTH) goes through the 48h timelock, and a raise","title":"ParametersBase D1 NatSpec: 'posting a depth (SET_DEPTH) ... a raise applies only if the rule then holds'; SET_DEPTH never checks the rule"},{"citation":"resolved","description":"LedgerBase.Position (LedgerBase.sol:92-101) ends with `uint32 version`, which ManagedPosition lacks. Decoding still works today: all fields are static and one word each, and the trailing word is ignored. The 'exactly' claim is false, though, and a future field inserted before lastRateChange would silently shift the cooldown field the manager relies on.","line":4,"path":"src/managers/RateManager.sol","reproduction":"Ledger.position(id) returns 8 words; RateManager decodes 7. Fix: add `uint32 version` to ManagedPosition, or reword the comment.","severity":"info","snippet":"/// @dev The slice of the Ledger a manager reads and calls. Mirrors LedgerBase.Position's ABI exactly.","title":"RateManager: ManagedPosition is said to mirror LedgerBase.Position's ABI exactly; Position has an extra uint32 version"}],"hash":"f5f99ba9313b80480e64557cd909b034c84e7350c0de3f75db55e4a5d9d31ea9","nodeId":"bfb18c98-4e07-4696-b67e-b27283db8696","outcome":"completed","summary":"I found no critical, high or medium issues in scope. There are 4 low-severity findings and 5 wrong comments (info), all in `.imd-findings.json`. Each low finding has a Foundry test that fails on this commit; I wrote them under `test/scratch/`, ran them, then deleted them, so the source tree is unchanged. The required panel suite (`PanelParams`, `CapAndSlots`, `RiskVersions`, `RateManager`, `PanelRecheck`) passes: 65 of 65 tests, built with solc 0.8.26 via_ir. I had Foundry 1.8.3, so Solar was not used, and I did not run the whole project.\n\n## Findings\n\n| # | Severity | Where | What goes wrong | Reachable with BetaConfig? |\n|---|---|---|---|---|\n| 1 | low | `Parameters.sol:287` `_touches` | A one-word `SET_MIGRATOR_LINE` item passes `propose` inside a BATCH. While that batch is pending, every `lowerLine` (any type) and `lowerDepthLine` reverts until the Safe cancels the batch. This is worse than the README's known issue, which says such a payload blocks only its own kind. Test: `[FAIL: EvmError: Revert]`; a control with a well-formed item passes. | yes (the day-7 batch carries `SET_RISK`) |\n| 2 | low | `Parameters.sol:205` `lowerOtherImdLines` | This instant governor call raises the sIMD line the Ledger enforces, with no 48h wait. Test: the line goes 37,000 → 40,000 in one call. | yes: `otherImdLines` is 3,000, so +3,000 imdUSD |\n| 3 | low | `RateManager.sol:177` | When a type's `minRate` is 0, setting the target to 0 resets `lastRate`, and the next call skips the `maxStep` check (0 → 20% in one call). This is a faster form of the README's known `maxStep` issue. | no (RateManager is not in the beta) |\n| 4 | low | `Parameters.sol:263` `postLowerDepth` | On a chain without an ImdDepth, a posted depth of 0 means zero depth, yet `postLowerDepth` accepts any value. Test: the line goes 0 → 50,000 at once. | no (the beta has an ImdDepth) |\n\nWrong comments (info):\n- `Parameters.sol:11` says the savings share is \"0-80%\"; the code caps it at 50%.\n- `ParametersBase.sol:196` says a charged rate change is measured at the price cap; `Ledger.sol:168` measures it at `low`.\n- `Parameters.sol:307` (and `GovernedByKind.sol:72`) say only the timelock changes anything after the seal; eleven instant governor calls remain.\n- `ParametersBase.sol:165` says a `SET_DEPTH` raise applies only if the depth rule then holds; nothing checks that (harmless).\n- `RateManager.sol:4` says `ManagedPosition` matches the Ledger's `Position` exactly; `Position` has an extra trailing `uint32 version`. Decoding still works today.\n\n## Answers to the numbered questions\n\n1. **Timelocks per kind: they hold, apart from findings 1 and 2.**\n   - A proposal locks its own kind (and a batch every item's kind), so no field can be pending twice.\n   - `applyPending` re-validates against current state; a revert restores the slot; expiry works and an expired slot still holds its lock.\n   - Nothing can be smuggled through a batch: doubling the cap, stepping the savings share or raising dust twice all fail, because every item is checked at propose against the state then.\n   - Every instant lower cancels the pending proposal (or the batch) for its own field.\n   - No slot is stuck for good: `cancel(kind)` always works.\n   - Note, not a finding: an older `SET_DEPTH_K` raise can partly undo `postLowerDepth`, and an older `SET_DEPTH` raise can partly undo `lowerDepthK`, because they are different fields.\n2. **Bounds: they hold.**\n   - Non-NHI `mat` must lie in [1.01, 3] and be at least `1 + chop`. On NHI types the live `mat` from the Pricer is at least 1.7, above the 1.25 maximum.\n   - `chop` is 2–25%, `cut + chip` at most 1, `redeemDivisor` 1–16, `redeemFloor` at most the Redeemer's 5% fee cap, `rateFloor` at most 50% (the Ledger's maximum rate is 100%).\n   - `dust` can't exceed `line` unless the line is 0. In partial liquidation, a target at or below `1 + chop` falls back to closing in full.\n   - The price cap only touches borrowing and withdrawing, and a withdrawal that repays enough is ex","treeHash":null,"usage":{"cachedInputTokens":3108518,"cost":{"source":"runtime","usdMicros":3030154},"inputTokens":53,"model":"claude-opus-5-5","outputTokens":61511,"runtime":"claude","turns":32,"wallClockMs":912629}}],"verification":[]}