# Merge 04: imdUSD v2 day 1, bridge and stock-oracle items (10 of 10) - **Objective:** find every defect that loses, locks or mis-mints money in imdUSD v2 day 1. Code is https://github.com/imdusd/imdusd-v2-audit at commit `ff1c192b3798542997f600091f2dc73ff05e4c40`. - **Commit:** all 10 item results name `ff1c192b3798542997f600091f2dc73ff05e4c40`. - **Verdict:** **findings.** There are 8 findings, each with a failing Foundry test that its item reports it ran: 1 medium, 5 low and 2 info. There are also 4 refuted claims or notes with no failing test, marked *unverified*. None is ranked high. - **Items (all present, none empty):** bridge-limiter, bridge-instant-allowance, bridge-hold-drop, bridge-incident-acts, bridge-delay-timing, bridge-supply-isolation, bridge-lzpaths-config, stock-oracle-s-price, stock-oracle-s-session, stock-multiplier-freeze. - **Missing:** none. Each input file's SHA-256 matched the hash the task gave for it. ## How this merge was made - **Sources.** Every finding, claim, hold and not-run entry below comes from the item result files under `.imd/reads/artifacts/item-*`. Test sources and results are copied verbatim from those files. - **What the merge checked.** It did **not** re-run the tests. It cloned the repository at the commit and read the lines each finding cites. Every cited line exists and says what the finding relies on: - `ImdBridge.sol:1198-1201` (the DROP expression) and `:565` (the hold check in lzReceive). - `:986`, `:994`, `:1005` and `:1022`: the propose-time reverts. - `Governed.sol:44-50`, where `propose` runs `_validate`. - `README.md:773` and `:1107-1108`, plus `script/house/DeployMainnetBridge.s.sol:11`, and `CONF_FROM_4663 = 20` at `script/house/DeployConfig.sol:1066`. - `StockOracle.sol:49-51`, `:73-76`, `:85`, `:87`, `:214`, `:222`, `:253` and `:259-261`. - The CRCL/MSTR `sessionRounds=true` setting at `script/DeployConfig.sol:912-913`. - The claim that `_stageStocks` has no caller and `script/launch/Plan.s.sol` is absent. - **Deduplication.** No root cause was reported by more than one item. BIA-F1 and BIA-F2 (one item) share a class: propose-time checks read state that anyone can write. The item kept them as two findings and so does this merge. - **Forge versions differed between items.** This is a disagreement in how tests were run, not in what they found: - forge 1.9.0 with `--use solar`: hold-drop, lzpaths-config, multiplier-freeze, s-price, s-session. - forge 1.9.0 with the solar binary passed by path: delay-timing. The literal `--use solar` was refused. - forge 1.10.1 with `--use solar`: instant-allowance. - forge 1.8.3 with `--use solar`: incident-acts. - forge 1.8.3 with installed solc 0.8.38: limiter. - forge 1.8.3 with solc **0.8.34**, on a pragma-patched scratch copy: supply-isolation. ## Findings ranked by severity at the deploy configuration | # | Severity | Id (item) | Title | Reachable at deploy | |---|---|---|---|---| | 1 | medium | BIA-F1 (bridge-incident-acts) | A stranger's lzReceive, or a DVN verify, reverts the Safe's incident batch [pause, propose(ENDPOINT_NILIFY/BURN/SKIP)], and the pause is reverted with it | yes, on every open path with compromised DVNs; no key needed to execute | | 2 | low | BIA-F2 (bridge-incident-acts) | RESET_BREAKER / UNVOID re-proposals in an incident batch are reverted when a stranger applies the matured original first, taking the batch's pause or void with them | yes, once the Safe uses the re-proposal pattern | | 3 | low | F1 (bridge-hold-drop) | The FR2 fix covers only NIL: a DROP over a hold bound to any other hash with no payload (junk, or the sentinel 1) lets the replay run | yes | | 4 | low | SMF-1 (stock-multiplier-freeze) | The step base moves after STEP_SETTLE without a feed print, while MAX_AGE accepts a 49 h-old answer: under a stalled feed, chained small steps misprice by up to ~3x SMALL_STEP | yes, needs a 24-49 h feed stall | | 5 | low | SOS-1 (stock-oracle-s-session) | SESSION_ROUNDS markets (CRCL, MSTR) have no heartbeat bound after a gap past JUMP | yes, at the configured `sessionRounds=true` | | 6 | low | F1 (bridge-lzpaths-config) | A second path builder (house DeployConfig) ships off-spec 4663 path config (20 confirmations, 1-day window, 5,000/50,000), and the contract accepts it | script route only, through the Safe | | 7 | info | F2 (bridge-lzpaths-config) | `BridgeBatch._checkPath` does not check limits, libraries, DVNs, confirmations or executor | no (defense in depth) | | 8 | info | SMF-2 (stock-multiplier-freeze) | `sync()` overflows on a multiplier more than ~1e41x the base: the market stays frozen and the Safe has no exit | issuer-only | The rest of this section copies each finding from its item result. ### 1. BIA-F1 (medium): an endpoint act in the Safe's incident batch can be reverted by a stranger - **Item:** bridge-incident-acts. - **Property:** P1. - **Claim:** C1 ("No other") is refuted. - **Files:** - `src/bridge/ImdBridge.sol:981-1001`, `:986`, `:994`, `:996`, `:999`, `:693-697` - `src/Governed.sol:44-50` - **Sequence:** 1. Compromised DVNs verify forged packets A (nonce n) and B (n+1) on the 4663 path from Ethereum. 2. The Safe signs a MultiSend [pause(HOME), propose(ENDPOINT_NILIFY(HOME, peer, n, hash(A)))]. The propose is valid when signed. 3. Before the batch lands, anyone executes A through EndpointV2.lzReceive. This is permissionless, and the path is still open. Executing A clears the stored hash, so `cur != h` and `_check` reverts InfeasibleEndpointAct at :994. - The DVNs can get the same revert by verifying another payload over nonce n. - For ENDPOINT_SKIP(next), they verify at `next`: inboundNonce moves and :986 reverts. - BURN fails the same way at :994/:999. 4. The whole MultiSend reverts, so the path stays open. 5. The forger executes B and every other verified forged packet. These mint at once within the instant allowance (fuzz: 3,000 imdUSD each). The rest queue until the Safe re-signs a batch without the endpoint act. - **Expected:** the batch lands whatever a stranger ran first (P1). An infeasible endpoint act should be a no-op, as hold, cancelClaim, cancel, RELEASE(0), UNCANCEL and UNPAUSE already are. - **Actual:** `testFuzz_P1_endpointActBatchLands` fails for both routes (execute and DVN verify) and for SKIP. The batch returns false and `paused(HOME)` stays false. Control: with no stranger in front, both batches land (`test_control_noStranger` PASS). - **Fix:** - In `_check`, stop rejecting ENDPOINT_SKIP/NILIFY/BURN on endpoint state (`cur != h`, the lazy and inbound nonces) at propose. - In `_apply`, re-read that state and make an infeasible item a no-op: skip the endpoint call, but for NILIFY/BURN still set `voided[h] = true`, which can only tighten. - Keep the PathOpen checks: the batch's own pause satisfies them. - **Merge check:** `:994 if (cur != h) revert InfeasibleEndpointAct();` and `:986` (nonce vs `inboundNonce + 1`) are present at the commit. `Governed.propose` runs `_validate` (`Governed.sol:46`). - **Test:** ran with forge 1.8.3 `--use solar`, fuzz runs 1000. Result: `[FAIL: P1: incident batch reverted by a stranger; args=[75, true]] testFuzz_P1_endpointActBatchLands(uint8,bool) (runs: 0, μ: 0, ~: 0) | [FAIL: P1: incident batch reverted by a stranger; args=[9, false]] testFuzz_P1_endpointActBatchLands(uint8,bool) (runs: 0, μ: 0, ~: 0) | [FAIL: P1: incident batch reverted by a stranger] test_skipVariantFails() (gas: 674445) | [PASS] test_control_noStranger() (gas: 811524) | [PASS] testFuzz_F1_nilifyBatchRevertedByStranger(uint8) (runs: 1000, μ: 1051823, ~: 1070676) (the loss test asserts the defect: B mints at once after the reverted batch)` ```solidity // test/scratch/BIAProp.t.sol (imports: ../utils/W5Bridge.sol = repo harness: MockLzEndpoint with EndpointV2 channel rules, two ImdBridges, both paths open at launch values C 10,000/day, D 12 h, B 100,000) /// Safe MultiSend stand-in (etched at the governor address): all calls or none. contract Batcher { function exec(address t, bytes[] calldata calls) external { for (uint256 i; i < calls.length; ++i) { (bool ok, bytes memory r) = t.call(calls[i]); if (!ok) assembly { revert(add(r, 32), mload(r)) } } } } /// P1: no stranger's transaction makes the Safe's incident batch revert. contract BIAPropTest is W5Bridge { function setUp() public { _setUpW5(); vm.etch(safe, address(new Batcher()).code); // Safe MultiSend: all or nothing } function _run(bytes[] memory c) internal returns (bool ok) { (ok,) = safe.call(abi.encodeCall(Batcher.exec, (address(rh), c))); } function _p(bytes memory payload) internal pure returns (bytes memory) { return abi.encodeWithSignature("propose(bytes)", payload); } /// [pause, propose(ENDPOINT_NILIFY(n,h))] / [pause, propose(ENDPOINT_SKIP(next))]; stranger in front: /// who 0 executes the forged packet (lzReceive), 1 compromised DVNs verify over its nonce. function testFuzz_P1_endpointActBatchLands(uint8 who, bool skip) public { who = uint8(bound(who, 0, 1)); bytes32 snd = _b32(address(home)); uint64 next = rhEp.inboundNonce(address(rh), HOME, snd) + 1; uint256 a = _forge(3_000e18); bytes memory act = skip ? abi.encode(uint8(8), HOME, snd, next + 1) : abi.encode(uint8(9), HOME, snd, next, homeEp.payloadHashOf(a)); if (skip) homeEp.forgeAt(RH, _b32(address(rh)), snd, _msg(attacker, 50e18), next + 1); // DVNs verify the skipped nonce else if (who == 0) homeEp.deliver(a); else homeEp.forgeAt(RH, _b32(address(rh)), snd, _msg(attacker, 50e18), next); bytes[] memory c = new bytes[](2); (c[0], c[1]) = (abi.encodeCall(rh.pause, (HOME)), _p(act)); assertTrue(_run(c), "P1: incident batch reverted by a stranger"); assertTrue(rh.paused(HOME)); } function test_skipVariantFails() public { testFuzz_P1_endpointActBatchLands(0, true); } function test_control_noStranger() public { bytes32 snd = _b32(address(home)); uint64 next = rhEp.inboundNonce(address(rh), HOME, snd) + 1; uint256 a = _forge(3_000e18); bytes[] memory c = new bytes[](2); (c[0], c[1]) = (abi.encodeCall(rh.pause, (HOME)), _p(abi.encode(uint8(9), HOME, snd, next, homeEp.payloadHashOf(a)))); assertTrue(_run(c)); vm.prank(safe); rh.cancel(); (c[0], c[1]) = (abi.encodeCall(rh.pause, (HOME)), _p(abi.encode(uint8(8), HOME, snd, next + 1))); assertTrue(_run(c)); } } // loss (test/scratch/BIA.t.sol, same setUp + helpers _safeBatch/_c2): /// Incident batch [pause, propose(ENDPOINT_NILIFY(n, h))] for a verified forged packet A, while forged B waits. /// mode 0: nobody in front (control); 1: anyone executes A in front; 2: the DVNs verify another payload over A's nonce. function testFuzz_F1_nilifyBatchRevertedByStranger(uint8 mode) public { mode = uint8(bound(mode, 0, 2)); uint256 a = _forge(3_000e18); uint256 b = _forge(3_000e18); (uint64 na, bytes32 snd) = _origin(a); bytes memory nil = abi.encode(uint8(9), HOME, snd, na, homeEp.payloadHashOf(a)); if (mode == 1) assertTrue(homeEp.deliver(a)); if (mode == 2) homeEp.forgeAt(RH, _b32(address(rh)), snd, _msg(attacker, 50e18), na); bool ok = _safeBatch(_c2(abi.encodeCall(rh.pause, (HOME)), abi.encodeWithSignature("propose(bytes)", nil))); if (mode == 0) { assertTrue(ok); assertFalse(homeEp.deliver(b), "B refused on the paused path"); return; } // the stranger's transaction reverted the Safe's pause with the proposal assertFalse(ok, "batch landed"); assertFalse(rh.paused(HOME), "path still open"); uint256 before = rhTok.balanceOf(attacker); assertTrue(homeEp.deliver(b)); assertGt(rhTok.balanceOf(attacker), before, "forged B minted at once after the reverted incident batch"); } ``` ### 2. BIA-F2 (low): a stranger applying the matured original reverts the Safe's re-proposal batch - **Item:** bridge-incident-acts. - **Property:** P1. - **Claim:** C2 is confirmed. - **Files:** `src/bridge/ImdBridge.sol:1003-1005`, `:1018-1025`; `src/Governed.sol:69-80`; `README.md:773`. - **Sequence, RESET_BREAKER:** 1. A forged queue larger than B trips the path (trip 1). 2. The Safe pauses, cancels the claim and proposes BATCH[RESET_BREAKER(HOME,1), UNPAUSE(HOME)]. 3. At any second of [eta, eta+14 d], the Safe sends [pause(HOME), cancel(), propose(same)] to re-propose it. 4. A stranger runs applyPending first: `tripped` becomes false and the path is unpaused. 5. Inside the Safe's batch, pause succeeds and cancel is a no-op, but propose reverts BadPayload at :1022 (`!b.tripped`). 6. The MultiSend reverts, so the path stays open. 7. One day later, the forged stockpile verified while the path was closed mints at once (the instant allowance has refilled). - **Sequence, UNVOID:** 1. A stranger applies the matured UNVOID(h1). 2. The Safe's batch [voidPayload(h2), cancel(), propose(UNVOID(h1))] then reverts at :1005. 3. voidPayload(h2) is reverted with it, and the forged h2 mints 5,000 at once. - **Expected:** the Safe's batch lands (P1). README:773 says: "Re-proposals inside an incident batch (wave-7 judge L3, L4, fixed in this snapshot): UNCANCEL of any existing claim and UNPAUSE of an open path are accepted and apply as no-ops." It names only UNCANCEL and UNPAUSE. - **Actual:** - `testFuzz_P1_resetReproposalLands` fails at every fuzzed apply time in the 14-day window. - The loss tests, which assert the defect, pass: the forged stockpile and h2 mint at once. - **Fix:** - UNVOID: accept a hash that is not voided, and make the apply a no-op when `!voided[h]`. - RESET_BREAKER: at propose, require only `trip == b.trips` and a paused path, not `tripped`. At apply, keep the staleness check and make the item a no-op when `!tripped`. - ENDPOINT_*: as in BIA-F1. - **Merge check:** `:1005 if (!voided[h]) revert BadPayload();` and `:1022 if (!b.tripped || trip != b.trips) revert BadPayload();` are present. README:773's wording is as quoted. - **Test:** ran with forge 1.8.3 `--use solar`, fuzz runs 1000. Result: `[FAIL: P1: incident batch reverted by a stranger; args=[16715 [1.671e4]]] testFuzz_P1_resetReproposalLands(uint256) (runs: 0, μ: 0, ~: 0) | [FAIL: P1: incident batch reverted by a stranger; args=[1715537630745238222 [1.715e18]]] testFuzz_P1_resetReproposalLands(uint256) (runs: 0, μ: 0, ~: 0) | [PASS] testFuzz_F2_resetBreakerReproposal(uint256,bool) (runs: 1000, μ: 1510420, ~: 1371116) | [PASS] test_F2_unvoidReproposal() (gas: 1144463)` ```solidity // test/scratch/BIAProp.t.sol (imports: ../utils/W5Bridge.sol = repo harness: MockLzEndpoint with EndpointV2 channel rules, two ImdBridges, both paths open at launch values C 10,000/day, D 12 h, B 100,000) // same contract BIAPropTest as F1 /// [pause, cancel, propose(BATCH[RESET_BREAKER(1), UNPAUSE])] after anyone applies the matured original in front. function testFuzz_P1_resetReproposalLands(uint256 late) public { (uint256 i,) = _forgeRun(B + 1e18); vm.startPrank(safe); rh.pause(HOME); rh.cancelClaim(HOME, _claimKey(homeEp, i)); bytes memory reset = _b(abi.encode(uint8(14), HOME, uint256(1)), abi.encode(uint8(5), HOME)); rh.propose(reset); vm.stopPrank(); _warp(48 hours + bound(late, 0, 14 days)); rh.applyPending(); // stranger bytes[] memory c = new bytes[](3); (c[0], c[1], c[2]) = (abi.encodeCall(rh.pause, (HOME)), abi.encodeWithSignature("cancel()"), _p(reset)); assertTrue(_run(c), "P1: incident batch reverted by a stranger"); } // loss (test/scratch/BIA.t.sol): /// RESET_BREAKER: tripped + paused path, BATCH[RESET_BREAKER(1), UNPAUSE] matured. The Safe re-proposes it inside /// [pause, cancel, propose(same)]; a stranger applies the original in front at a chosen second of the 14-day window. function testFuzz_F2_resetBreakerReproposal(uint256 late, bool front) public { (uint256 i,) = _forgeRun(B + 1e18); // queues past B: trips (trip 1) assertTrue(_tripped()); vm.startPrank(safe); rh.pause(HOME); rh.cancelClaim(HOME, _claimKey(homeEp, i)); vm.stopPrank(); bytes memory reset = _b(abi.encode(uint8(14), HOME, uint256(1)), abi.encode(uint8(5), HOME)); vm.prank(safe); rh.propose(reset); _warp(48 hours + bound(late, 0, 14 days)); uint256 stock = _forge(9_000e18); // forged stockpile verified while closed if (front) rh.applyPending(); // stranger bytes[] memory c = _c3( abi.encodeCall(rh.pause, (HOME)), abi.encodeWithSignature("cancel()"), abi.encodeWithSignature("propose(bytes)", reset) ); bool ok = _safeBatch(c); if (!front) { assertTrue(ok); return; } assertFalse(ok, "batch landed"); assertFalse(rh.paused(HOME), "path open: the Safe's pause was reverted"); _warp(1 days); // until the Safe re-signs: the allowance (empty at the reopening) refills uint256 before = rhTok.balanceOf(attacker); assertTrue(homeEp.deliver(stock)); assertGt(rhTok.balanceOf(attacker), before, "forged stockpile minted at once"); } /// UNVOID: [voidPayload(h2), cancel, propose(UNVOID(h1))]; a stranger applies the matured UNVOID(h1) in front. function test_F2_unvoidReproposal() public { uint256 p1 = _forge(5_000e18); bytes32 h1 = homeEp.payloadHashOf(p1); vm.prank(safe); rh.voidPayload(h1); vm.prank(safe); rh.propose(abi.encode(uint8(11), h1)); _warp(48 hours); uint256 p2 = _forge(5_000e18); bytes32 h2 = homeEp.payloadHashOf(p2); rh.applyPending(); // stranger bool ok = _safeBatch( _c3( abi.encodeCall(rh.voidPayload, (h2)), abi.encodeWithSignature("cancel()"), abi.encodeWithSignature("propose(bytes)", abi.encode(uint8(11), h1)) ) ); assertFalse(ok, "batch landed"); assertFalse(rh.voided(h2), "the Safe's void was reverted"); assertTrue(homeEp.deliver(p2)); assertEq(rhTok.balanceOf(attacker), 5_000e18, "voided-to-be payload minted at once"); } ``` ### 3. hold-drop F1 (low): a DROP over a hold bound to a non-NIL junk hash lets the dropped replay run - **Item:** bridge-hold-drop. - **Property:** P1 / C4, the rule at `ImdBridge.sol:1194-1197`: "a DROP never loosens a nonce". - **Claim:** refutes C4. The item also says this refutes earlier submission 439d66ba (L5). - **Files:** `src/bridge/ImdBridge.sol:1198-1201`, `:702-716`, `:565`, `:583`. - **Sequence:** 1. Compromised DVNs verify a replay P of the honest twin's payload (nonce A) at nonce B. 2. In the same block, ahead of the Safe's batch, they re-verify B with a hash X that has no payload. X can be any value except 0 and NIL. 3. The Safe's [hold(B), pause, propose(RELEASE B,0)] lands. The hold binds X as (X, now+72h). 4. The DVNs re-verify P at B. 5. After 48 h, anyone applies the DROP. It writes (X, 2), which refuses only X. 6. After UNPAUSE, anyone executes P at B, and it queues as a claim. 7. With X = bytes32(1), the record becomes (1, 2). - **Expected:** B stays closed to P, as it does for a NIL front-run (record (1, 1)). - **Actual:** - The record is (X, 2) and the dropped replay P queues a claim. - The Safe must cancel it within D (12 h), or the honest amount mints twice. - Nothing mints at once, so P1's "never mints at once" holds. - **Fix:** on a DROP, close any held record: `r.until != 0 ? (bytes32(uint256(1)), uint64(1)) : (r.payloadHash, uint64(2))`. Alternatively, make the DROP name the hash it drops. - **Merge check:** the expression at `:1199-1201` closes the nonce only when `r.until < 3 || r.payloadHash == NIL_PAYLOAD_HASH`. A live hold on any other hash becomes `(r.payloadHash, 2)`, and `:565` then refuses only that hash. - **Test:** ran with forge 1.9.0: `forge test --use solar --match-path test/scratch/JunkDrop.t.sol -vv`, using the mock EndpointV2 from `test/unit/AuditW6JudgeBridgeDrop.t.sol`. Result: `[PASS] test_nilFront_dropCloses() (record 0x..01, until 1); [FAIL: junk-bound hold + DROP: the dropped replay ran at the nonce] test_junkFront_dropLetsTheReplayRun() (record hash 0x506004dae8099db678fa461e805e2c0489f8b2aad268d64587778b3c15b2c6f0, until 2); [FAIL: hash-1-bound hold + DROP: the dropped replay ran at the nonce] test_oneFront_dropLetsTheReplayRun() (record 0x..01, until 2). 1 passed, 2 failed.` - **Not run:** the real EndpointV2. The item checked by reading LayerZero's source that it allows re-verifying an unexecuted nonce. ```solidity // SPDX-License-Identifier: MIT pragma solidity 0.8.38; import "forge-std/Test.sol"; import {W6B1EpMock, W6B1TokMock, W6B1Lib, W6B1SafeMock, W6B1CfgParam, W6B1Org} from "../unit/AuditW6JudgeBridgeDrop.t.sol"; import {ImdBridge, IMintableBurnable, UlnConfig} from "../../src/bridge/ImdBridge.sol"; import {ILayerZeroEndpointV2} from "layerzero-v2/protocol/interfaces/ILayerZeroEndpointV2.sol"; /// DVNs store a hash with no payload (not NIL) over their waiting replay in front of the Safe's [hold, pause, propose(DROP)], /// and the replay back behind it: the DROP writes (junk, 2) and the replay runs at the dropped nonce. NIL (FR2) is closed. contract JunkDropTest is Test { uint32 constant BASE = 30184; uint64 constant B = 7; bytes32 peer = bytes32(uint256(0xBEEF)); W6B1EpMock ep; W6B1TokMock tok; ImdBridge br; W6B1SafeMock safe; bytes32 guid = keccak256("honest twin guid at nonce 5"); bytes message = abi.encodePacked(bytes32(uint256(uint160(address(0xA11CE)))), uint64(100e6)); function setUp() public { vm.warp(20_000 days); ep = new W6B1EpMock(); tok = new W6B1TokMock(); safe = new W6B1SafeMock(); br = new ImdBridge(ILayerZeroEndpointV2(address(ep)), IMintableBurnable(address(tok)), address(safe), address(0x7EA)); tok.setBridge(address(br)); (address sl, address rl) = (address(new W6B1Lib()), address(new W6B1Lib())); address[] memory d = new address[](3); (d[0], d[1], d[2]) = (address(1), address(2), address(3)); W6B1CfgParam[] memory sp = new W6B1CfgParam[](1); sp[0] = W6B1CfgParam(BASE, 2, abi.encode(UlnConfig(15, 3, 255, 0, d, new address[](0)))); W6B1CfgParam[] memory rp = new W6B1CfgParam[](1); rp[0] = W6B1CfgParam(BASE, 2, abi.encode(UlnConfig(9000, 3, 255, 0, d, new address[](0)))); bytes[] memory it = new bytes[](5); it[0] = abi.encode(uint8(1), BASE, peer, uint256(50_000e18), uint256(4 days), uint256(50_000e18), uint256(4 days), bytes("")); it[1] = abi.encode(uint8(3), BASE, sl); it[2] = abi.encode(uint8(4), BASE, rl, uint256(0)); it[3] = abi.encode(uint8(2), sl, sp); it[4] = abi.encode(uint8(2), rl, rp); vm.prank(address(safe)); br.propose(abi.encode(uint8(6), it)); vm.warp(vm.getBlockTimestamp() + 48 hours); br.applyPending(); } function _run(bytes32 front) internal returns (bool ran) { bytes32 replay = keccak256(abi.encodePacked(guid, message)); ep.verify(B, replay); // a replay of the honest twin's payload at nonce B ep.verify(B, front); // compromised DVNs, same block, in front of the Safe's batch bytes[] memory c = new bytes[](3); c[0] = abi.encodeWithSignature("hold(uint32,uint64)", BASE, B); c[1] = abi.encodeWithSignature("pause(uint32)", BASE); c[2] = abi.encodeWithSignature("propose(bytes)", abi.encode(uint8(12), BASE, peer, B, bytes32(0))); safe.multiSend(address(br), c); // the documented [hold, pause, propose(DROP)] ep.verify(B, replay); // the replay back behind the hold vm.warp(vm.getBlockTimestamp() + 48 hours); vm.prank(address(0x5157)); br.applyPending(); // anyone applies the DROP (bytes32 h, uint64 u) = br.holds(BASE, peer, B); emit log_named_bytes32("record hash", h); emit log_named_uint("record until", u); vm.prank(address(safe)); br.propose(abi.encode(uint8(5), BASE)); // UNPAUSE vm.warp(vm.getBlockTimestamp() + 48 hours); br.applyPending(); vm.prank(address(0xF00D)); try ep.lzReceive(address(br), W6B1Org(BASE, peer, B), guid, message) { ran = true; } catch {} } function test_nilFront_dropCloses() public { assertFalse(_run(bytes32(type(uint256).max)), "NIL"); } function test_junkFront_dropLetsTheReplayRun() public { assertFalse(_run(keccak256("no preimage")), "junk-bound hold + DROP: the dropped replay ran at the nonce"); } function test_oneFront_dropLetsTheReplayRun() public { assertFalse(_run(bytes32(uint256(1))), "hash-1-bound hold + DROP: the dropped replay ran at the nonce"); } } ``` ### 4. SMF-1 (low): under a stalled feed, chained small multiplier steps misprice by up to ~3x SMALL_STEP - **Item:** stock-multiplier-freeze. - **Property:** P2. - **Claim:** the NatSpec at `StockOracle.sol:73-76`: "by then it has printed under the change". - **Files:** `src/stocks/StockOracle.sol:253`, `:85`, `:87`, `:214`, `:262`. - **Sequence:** 1. Mon 09:32: the feed prints P, then stalls. 2. Mon 09:40: the multiplier steps +1% and `sync()` releases it. 3. Tue 09:41: another +1% step; the base moves (`openTime >= STEP_SETTLE`) and the step is released. 4. Wed 09:42: another +1% step, released the same way. 5. `price()` still returns P, because the answer is 48 h 10 min old, under MAX_AGE (49 h). The token is worth P x 1.0303. - **Expected:** the price is within SMALL_STEP (1%) of the value, or Frozen. - **Actual:** - Three steps: the price is 2.9% under the value. - Fuzz counterexample: 1.76% after two steps. - Bounded at 3 steps; never split-sized. - **Fix:** move the base only once the feed has printed both priced legs after `syncedAt` (t1 > syncedAt), or set STEP_SETTLE >= MAX_AGE + one heartbeat. - **Merge check:** `:253` moves `baseMultiplier` on `calendar.openTime(syncedAt, now) >= STEP_SETTLE` alone. MAX_AGE = 49 h (`:85`) and STEP_SETTLE = 24 h (`:87`). - **Test:** ran with `forge test --use solar --match-path test/scratch/MultFreeze.t.sol` (fuzz 2000), forge 1.9.0. Result: `[FAIL: P2: price within SMALL_STEP of the value: 17550270640344108 > 10000000000000000; counterexample: args=[8890937385923030 [8.89e15], 33445492662212280090674059326658851473 [3.344e37]]] testFuzz_F1_stalledFeed_stepChainMispricesPastSmallStep(uint256,uint256) (runs: 0) | [FAIL: P2: price within SMALL_STEP of the value: 29409852072355555 > 10000000000000000] test_F1_threeStepsInsideMaxAge() (gas: 438635)` ```solidity // test/scratch/MultFreeze.t.sol (contract MultFreezeTest is StockOracleBase; setUp: _deploy(); _print(monOpen + 1 minutes, P); _print(monOpen + 2 minutes, P);) // helpers: _schedule(m, lead) = token.scheduleMultiplier(m, now + lead); _stepOf(a, b) = ceil(|a - b| * 1e18 / b) // ---------------------------------------------------------------- FINDING 1 (P2): stale leg + STEP_SETTLE < MAX_AGE /// The feed stalls (prints nothing, still inside MAX_AGE = 49 h). Two small steps, each recorded after STEP_SETTLE (24 h /// open-market time) of the one before, move the base without the feed ever printing under them: the priced answer is /// still the one printed under the multiplier before both, so the price is off by s1 + s2 > SMALL_STEP. function testFuzz_F1_stalledFeed_stepChainMispricesPastSmallStep(uint256 s1, uint256 s2) public { s1 = bound(s1, 0.006e18, 0.01e18); s2 = bound(s2, 0.006e18, 0.01e18); _at(monOpen + 10 minutes); uint256 m1 = 1e18 + s1; _schedule(m1, 0); vm.prank(stranger); o.sync(); assertFalse(o.pendingRelease()); _at(tueOpen + 11 minutes); // 24 h 1 min of open-market time after the first sync; no round since monOpen + 2 min uint256 m2 = m1 * (1e18 + s2) / 1e18; _schedule(m2, 0); vm.prank(stranger); o.sync(); assertFalse(o.pendingRelease(), "second small step released"); assertEq(o.baseMultiplier(), m1); uint256 v = _priced(o); // the answer printed under 1e18, 24 h old (< MAX_AGE) uint256 truth = uint256(P) * m2 / 1e18; assertLe(_stepOf(v, truth), o.SMALL_STEP(), "P2: price within SMALL_STEP of the value"); } /// Three steps of 1% inside one MAX_AGE: about 3% off. function test_F1_threeStepsInsideMaxAge() public { uint256 m = 1e18; uint256[3] memory at = [monOpen + 10 minutes, tueOpen + 11 minutes, wedStart + 13 hours + 30 minutes + 12 minutes]; for (uint256 i; i < 3; ++i) { _at(at[i]); m = m * 1.01e18 / 1e18; _schedule(m, 0); o.sync(); assertFalse(o.pendingRelease()); } uint256 v = _priced(o); uint256 truth = uint256(P) * m / 1e18; emit log_named_uint("price (feed units)", v); emit log_named_uint("value (feed units)", truth); assertLe(_stepOf(v, truth), o.SMALL_STEP(), "P2: price within SMALL_STEP of the value"); } ``` ### 5. SOS-1 (low): SESSION_ROUNDS markets (CRCL, MSTR) have no heartbeat bound after a gap past JUMP - **Item:** stock-oracle-s-session. - **Property:** F4 / README:809-810: "on a flat tape after the move, liquidations wait up to the 24 h heartbeat of open-market time". - **Claim:** F4 is refuted for SESSION_ROUNDS on. - **Files:** `src/stocks/StockOracle.sol:222`, `:49-51`; `README.md:809`; `script/DeployConfig.sol:898-899`, `:912-913`. - **Sequence:** 1. Friday's close prints 100, 100. 2. Mon 09:31: an -11% round arrives, past JUMP. 3. After that, the feed prints only its heartbeat, one round per session, each -0.4%, under the deviation threshold. 4. Every `price()` reverts NotYet, because t1 is before today's open (`:222`). 5. The answer goes 100 -> 89 -> 62.05 over 90 sessions and never prices. 6. The SESSION_ROUNDS-off oracle on the same feed prices on Tuesday. - **Expected:** the market prices within one heartbeat after the gap. - **Actual:** - The market stays unpriced, with no borrowing and no liquidation and no time bound. It is not Stale. - Lender bad debt is possible, capped by the market cap and the hub row. - For CRCL/MSTR at LLTV 38.5%, the loss line is ~56%. - On those volatile names a quiet tape is unlikely. - **Fix:** fall back to the SESSION_ROUNDS-off rule once the latest round is an old session round (bound the wait), or correct F4 and README:809. - **Merge check:** `:222 if (SESSION_ROUNDS && t1 < open) revert NotYet();` is present. CRCL and MSTR are `true` at `DeployConfig.sol:912-913`, a PLACEHOLDER list. The property fails at the configured value. - **Test:** ran with forge 1.9.0: `test --use solar --match-path test/scratch/SessionAudit.t.sol --match-test test_F4_sessionRoundsGapNeverPrices -vv`. Result: `[FAIL: F4: oS (SESSION_ROUNDS on) unpriced for 90 sessions while the answer fell 30% past the gap] test_F4_sessionRoundsGapNeverPrices() (gas: 41086395). Logs: o (SESSION_ROUNDS off) first priced day offset: 4 (Tue); last answer (1e8), was 100e8 pre-gap: 6204838213` ```solidity // SPDX-License-Identifier: MIT pragma solidity 0.8.38; import {StockOracleBase} from "../utils/StockOracleBase.sol"; import {StockOracle} from "../../src/stocks/StockOracle.sol"; import {Pulse} from "../../src/Pulse.sol"; contract SessionAudit is StockOracleBase { Pulse internal pulse; StockOracle internal oP; // SESSION_ROUNDS off, with the 4663 Pulse (gap 15 min, grace 1 h: DeployConfig.sol:597) function setUp() public { _deploy(); pulse = new Pulse(15 minutes, 1 hours); StockOracle.Config memory c = _cfg(false); c.pulse = address(pulse); oP = new StockOracle(c); } function _open(uint256 day) internal view returns (uint256 op, uint256 cl) { (, uint64 a, uint64 b,) = cal.windowOf(day); return (a, b); } // ---- F4 worse than written: SESSION_ROUNDS on + a gap + a slow tape never prices (no 24 h bound) function test_F4_sessionRoundsGapNeverPrices() public { _print(friClose - 2 minutes, P); _print(friClose - 1 minutes, P); int256 a = 89e8; // a -11% gap at Monday's open: past JUMP uint256 day = FRI + 3; uint256 firstO; bool sPriced; uint256 rounds; for (; rounds < 90; ++day) { if (!cal.isTradingDay(day)) continue; (uint256 op, uint256 cl) = _open(day); _print(op + 1 minutes, a); // one round per session: the 24 h heartbeat (each step < 0.5%: no deviation round) for (uint256 k; k < 3; ++k) { _at(op + 2 hours + k * 1 hours); (bool okO,,) = _try(o); if (okO && firstO == 0) firstO = day; (bool okS,,) = _try(oS); if (okS) sPriced = true; } _at(cl - 1); a = a * 996 / 1000; ++rounds; } emit log_named_uint("o (SESSION_ROUNDS off) first priced day offset", firstO - FRI); emit log_named_uint("last answer (1e8), was 100e8 pre-gap", uint256(a)); assertTrue(firstO != 0, "o prices after one heartbeat"); assertTrue(sPriced, "F4: oS (SESSION_ROUNDS on) unpriced for 90 sessions while the answer fell 30% past the gap"); } } ``` ### 6. lzpaths F1 (low): the house path builder opens the 4663 path off-spec, and the contract accepts it - **Item:** bridge-lzpaths-config. - **Property:** P1 (4663 -> Ethereum needs 18,000 confirmations; there is one source of path numbers). - **Claim:** README:1107-1108 says "the real figures (9,000 / 18,000) are only in `script/LzPaths.sol`". This is false at the commit. - **Files:** - `script/house/DeployConfig.sol:1066`, `:865`, `:1131`, `:1137`, `:1153`, `:1232` - `script/house/DeployMainnetBridge.s.sol:11` - `src/bridge/ImdBridge.sol:324`, `:1058` - `script/LzPaths.sol:152` - **Sequence:** 1. The Safe proposes `RobinhoodConfig.launchBatchMainnet(robinhoodPathOnMainnet(peer))`, as `DeployMainnetBridge.s.sol:11` documents. 2. `_validate` passes, because 20 >= MIN_CONFIRMATIONS_FROM_OTHER. 3. After 48 h, anyone applies it. 4. Ethereum's receive ULN for eid 30416 is now 20 confirmations, with a 1-day window, an instant cap of 5,000 and a breaker of 50,000. At those values, in-limit traffic can trip the path: L x (1+4d/W) = 250,000 > 50,000. - **Expected:** 18,000 confirmations, LzPaths' 4-day window, 10,000 / 100,000. - **Actual:** 20 confirmations and an 86,400 s window, applied without a revert. - **Fix:** delete RobinhoodConfig's path builders and point `DeployMainnetBridge.s.sol:11` to LzPaths / BridgeBatch, or set per-source-eid confirmation floors in ImdBridge. - **Related, from other items:** - lzpaths C3 notes that `test/golden/GoldenRobinhoodPath.sol` is the same stale builder. - supply-isolation C2 notes that README:783 names `LZ_RECEIVE_GAS`, the house config's constant (`script/house/DeployConfig.sol:1217`), while the day-1 constant is `LzPaths RECEIVE_GAS` (same 250,000). - **Test:** ran with forge 1.9.0: `forge test --use solar --match-path test/scratch/LzCfg.t.sol -vv`. Result: `[FAIL: P1: 4663 -> Ethereum must be 18,000 confirmations: 20 != 18000] test_houseBuilderOpens4663PathOffSpec() (gas: 8577634)` ```solidity // SPDX-License-Identifier: MIT pragma solidity 0.8.38; import {Test} from "forge-std/Test.sol"; import {SetConfigParam} from "layerzero-v2/protocol/interfaces/IMessageLibManager.sol"; import {MessagingParams, MessagingReceipt, MessagingFee} from "layerzero-v2/protocol/interfaces/ILayerZeroEndpointV2.sol"; import {SendParam} from "layerzero-v2/oft/interfaces/IOFT.sol"; import {ImdBridge, IMintableBurnable} from "../../src/bridge/ImdBridge.sol"; import {ILayerZeroEndpointV2} from "layerzero-v2/protocol/interfaces/ILayerZeroEndpointV2.sol"; import {LzChains, LzPaths} from "../../script/LzPaths.sol"; import {RobinhoodConfig as HouseRH} from "../../script/house/DeployConfig.sol"; contract Lib { function messageLibType() external pure returns (uint8) { return 2; } } contract Tok { function mint(address, uint256) external pure returns (bool) { return true; } function burn(address, uint256) external pure returns (bool) { return true; } } /// Records every config the bridge writes and checks it against ULN302 semantics + the floors (a violation is sticky). contract RecEp { uint32 public eid; mapping(address => bool) public isSendLib; mapping(address => bool) public isLib; mapping(address => mapping(address => mapping(uint32 => mapping(uint32 => bytes)))) public cfg; mapping(address => mapping(uint32 => address)) public sendLib; mapping(address => mapping(uint32 => address)) public recvLib; bool public violated; bytes public lastOptions; constructor(uint32 e) { eid = e; } function addLib(address l, bool s) external { isLib[l] = true; isSendLib[l] = s; } function setConfig(address oapp, address lib, SetConfigParam[] calldata p) external { require(msg.sender == oapp && isLib[lib], "auth/lib"); for (uint256 i; i < p.length; ++i) { if (p[i].configType == 2) { LzPaths.UlnConfig memory u = abi.decode(p[i].config, (LzPaths.UlnConfig)); uint64 floor_ = (isSendLib[lib] ? eid : p[i].eid) == 30101 ? 15 : 20; if (u.requiredDVNCount < 3 || u.requiredDVNCount == 255 || u.requiredDVNs.length != u.requiredDVNCount || u.confirmations < floor_ || u.optionalDVNCount == 0) violated = true; } else { require(isSendLib[lib] && p[i].configType == 1, "type"); // ReceiveUln302 has no executor config } cfg[oapp][lib][p[i].eid][p[i].configType] = p[i].config; } } function setSendLibrary(address oapp, uint32 e, address lib) external { require(msg.sender == oapp && isSendLib[lib] && sendLib[oapp][e] != lib, "send lib"); sendLib[oapp][e] = lib; } function setReceiveLibrary(address oapp, uint32 e, address lib, uint256) external { require(msg.sender == oapp && isLib[lib] && !isSendLib[lib] && recvLib[oapp][e] != lib, "recv lib"); recvLib[oapp][e] = lib; } function send(MessagingParams calldata p, address) external payable returns (MessagingReceipt memory r) { lastOptions = p.options; r.nonce = 1; } } contract LzCfgTest is Test { uint32 constant ETH = 30101; uint32 constant RH = 30416; bytes32 constant PEER = bytes32(uint256(0xbeef)); function _bridge(uint32 local) internal returns (RecEp ep, ImdBridge b) { ep = new RecEp(local); b = new ImdBridge(ILayerZeroEndpointV2(address(ep)), IMintableBurnable(address(new Tok())), address(this), address(1)); } function _etchLib(RecEp ep, address a, bool s) internal { vm.etch(a, address(new Lib()).code); ep.addLib(a, s); } function _apply(ImdBridge b, bytes memory payload) internal { b.propose(payload); vm.warp(b.pendingEta()); vm.prank(address(0xdead)); b.applyPending(); } // ---- F1: the second writer (script/house/DeployConfig.sol RobinhoodConfig.launchBatchMainnet, named by // script/house/DeployMainnetBridge.s.sol:11) opens Ethereum's 4663 path at 20 confirmations and a 1-day window. function test_houseBuilderOpens4663PathOffSpec() public { (RecEp ep, ImdBridge b) = _bridge(ETH); LzChains.Chain memory e = LzChains.ethereum(); _etchLib(ep, e.sendUln, true); _etchLib(ep, e.receiveUln, false); _apply(b, HouseRH.launchBatchMainnet(HouseRH.robinhoodPathOnMainnet(PEER))); assertEq(b.peers(RH), PEER, "path set"); assertTrue(b.configured(b.receiveLibrary(RH), RH), "configured: send/lzReceive accept the path"); LzPaths.UlnConfig memory u = abi.decode(ep.cfg(address(b), e.receiveUln, RH, 2), (LzPaths.UlnConfig)); (, uint32 window,,) = b.inbound(RH); emit log_named_uint("confirmations from 4663 accepted by Ethereum", u.confirmations); emit log_named_uint("inbound window (s)", window); assertEq(u.confirmations, LzChains.ROBINHOOD_CONFIRMATIONS, "P1: 4663 -> Ethereum must be 18,000 confirmations"); assertEq(uint256(window), LzPaths.LIMIT_WINDOW, "P1/LzPaths: 4-day window"); } } ``` ### 7. lzpaths F2 (info): `BridgeBatch._checkPath` does not check what the batch writes - **Item:** bridge-lzpaths-config. - **Property:** P2. - **Claim:** C1. - **Files:** `script/launch/BridgeBatch.s.sol:443`, `:445`, `:446`, `:448`, `:413`. - **Sequence:** an Ethereum<-4663 BATCH with limits of 5 x LIMIT and 20 confirmations is evaluated with the copied `_checkPath` + `_delayIs`. - **Expected:** the check refuses it. - **Actual:** the check accepts it. - **Not reachable at deploy:** `path()` builds the batch from `LzPaths.batchItems` itself (`:413-414`). - **Fix:** compare the limits, libraries and `endpoint.getConfig` to LzPaths. - **Test:** ran with the same command as F1. Result: `[FAIL: _checkPath accepts limit 250,000 and 20 confirmations from 4663] test_checkPathPassesOffSpecPath() (gas: 8659471)` ```solidity // harness (imports, Lib, Tok, RecEp, _bridge, _etchLib, _apply) as in F1 /// C1 / P2: BridgeBatch._checkPath's predicates (script/launch/BridgeBatch.s.sol:443-451, _delayIs :471-476), copied /// verbatim, accept a path whose limits are 5x the launch values and whose receive ULN from 4663 has 20 confirmations. function _checkPathAccepts(ImdBridge b, uint32 eid, uint256 chainId, bytes32 peer32) internal view returns (bool) { if (b.peers(eid) != peer32) return false; if (b.sendLibrary(eid) == address(0) || b.receiveLibrary(eid) == address(0)) return false; if (!b.configured(b.sendLibrary(eid), eid) || !b.configured(b.receiveLibrary(eid), eid)) return false; if (keccak256(b.enforcedOptions(eid)) != keccak256(LzPaths.enforcedOptions(chainId))) return false; if (b.availableOut(eid) == 0 || b.availableIn(eid) == 0) return false; if (!b.paused(eid)) return false; LzPaths.Link memory l = LzPaths.link(LzChains.ETHEREUM, chainId); (,, uint64 capSD) = b.instantIn(eid); (,,, uint64 breakerSD, uint32 delay,,) = b.breakers(eid); return uint256(capSD) * 1e12 == l.instantCap && delay == l.claimDelay && uint256(breakerSD) * 1e12 == l.queueBreaker; } function test_checkPathPassesOffSpecPath() public { (RecEp ep, ImdBridge b) = _bridge(ETH); LzChains.Chain memory e = LzChains.ethereum(); _etchLib(ep, e.sendUln, true); _etchLib(ep, e.receiveUln, false); bytes[] memory items = LzPaths.batchItems(LzChains.ETHEREUM, LzChains.ROBINHOOD, LzPaths.setPath(LzChains.ETHEREUM, LzChains.ROBINHOOD, PEER)); items[0] = abi.encode(uint8(1), RH, PEER, 5 * LzPaths.LIMIT, 4 days, 5 * LzPaths.LIMIT, 4 days, LzPaths.enforcedOptions(LzChains.ROBINHOOD)); address[] memory d = LzPaths.sortedDvns(e); SetConfigParam[] memory rp = new SetConfigParam[](1); rp[0] = SetConfigParam(RH, 2, abi.encode(LzPaths.UlnConfig(20, 3, 255, 0, d, new address[](0)))); items[5] = abi.encode(uint8(2), e.receiveUln, rp); b.pause(RH); _apply(b, abi.encode(uint8(6), items)); assertFalse(_checkPathAccepts(b, RH, LzChains.ROBINHOOD, PEER), "_checkPath accepts limit 250,000 and 20 confirmations from 4663"); } ``` ### 8. SMF-2 (info): `sync()` reverts on overflow, so the market stays frozen with no Safe exit - **Item:** stock-multiplier-freeze. - **Property:** P3. - **Claim:** the comment at `StockOracle.sol:257-261`: "never a revert". - **Files:** `src/stocks/StockOracle.sol:259-261`, `:274`, `:233`. - **Sequence:** 1. The issuer sets `uiMultiplier = 2^256/1e17`. 2. `sync()` panics with 0x11. 3. `proposeForce` reverts NotPending, so no forced release is possible. - **Expected:** a pending freeze that the Safe can release. - **Actual:** there is no exit until the issuer changes the multiplier again. Only an issuer can cause this, and an issuer can freeze the market anyway, hence info. - **Fix:** compute the step saturating, or with `Math.mulDiv` rounding up. - **Merge check:** `(current - base) * WAD` is checked arithmetic at `:261`. - **Test:** ran with `forge test --use solar --match-path test/scratch/MultFreeze.t.sol`, forge 1.9.0. Result: `[FAIL: P3: sync never reverts] test_F2_syncRevertsOnHugeMultiplier_noExit() (gas: 186629)` ```solidity // test/scratch/MultFreeze.t.sol (contract MultFreezeTest is StockOracleBase; setUp: _deploy(); _print(monOpen + 1 minutes, P); _print(monOpen + 2 minutes, P);) // helpers: _schedule(m, lead) = token.scheduleMultiplier(m, now + lead); _stepOf(a, b) = ceil(|a - b| * 1e18 / b) // ---------------------------------------------------------------- FINDING 2 (P3): sync reverts on overflow function test_F2_syncRevertsOnHugeMultiplier_noExit() public { _at(monOpen + 10 minutes); _schedule(type(uint256).max / 1e17, 0); // issuer writes a garbage multiplier assertTrue(o.frozen()); (bool ok,) = address(o).call(abi.encodeCall(StockOracle.sync, ())); vm.prank(governor); (bool okP,) = address(o).call(abi.encodeCall(StockOracle.proposeForce, ())); assertFalse(okP, "no forced release: NotPending"); assertTrue(ok, "P3: sync never reverts"); } ``` ## Refuted claims and notes with no failing test (unverified, kept) | Item | Id | What | Status | |---|---|---|---| | bridge-limiter | P1-bound-text | The bound stated in the sheet's P1 and at `ImdBridge.sol:1276-1281` (L_old + max rate x 4 d <= B) is false for a lower that raises the rate. Example: 63,636/7 d -> 1,030/1 h gives 162,516 > 100,000 (`test_statedBoundForALowerExceedsB` PASS). No trip results, because a lower forces a >= 96 h pause (`test_P1_tightestLowerDoesNotTrip` PASS). | refuted; info; no failing test | | stock-oracle-s-session | FILES-StageChain | `script/deploy/StageChain.sol:63` passes the pulse, but `_stageStocks` (`:40`) has no caller in `script/`. The `script/launch/Plan.s.sol` named at `StageChain.sol:20` is not in the tree, so the pulse each 4663 oracle gets cannot be checked end to end. The merge confirmed both facts. MorphoLender APPROVE does not check pulse (README:834). | refuted (sheet route does not exist); unverified | | bridge-incident-acts | C1 sub-case | `propose(SET_DELAY shorter)` (`:1035`) and `propose(SET_PATH lowering inLimit)` (`:936`), in a batch that relies on a still-paused path without its own pause(), revert after a stranger applies a matured UNPAUSE. "Read from the code, not tested." | unverified | | bridge-instant-allowance | C3 note | README:1563 "UNPAUSE is refused on an open path (`PathOpen`)" is stale: the code accepts it as a no-op (`:1042-1044`, `:1226`). `BridgeBatch.s.sol:128` "full windows" wording contradicts README:752. Some NatSpec is misplaced (`:627`/`:635`, `:821-823`/`:833`). | documentation only | ## Claims, by item (refuted beats holds; no item disagrees with another on the same claim) | Item | Claim | Result | Evidence (short; full text in the item file) | |---|---|---|---| | bridge-limiter | C1 | holds | Limit written only by `_consume` (`:890-895`) and `_setLimit` (`:1282-1290`). Exact model assertion at every SET_PATH in `testFuzz_P1P2` (256 runs). DuplicateInBatch and PathOpen tests PASS. | | bridge-limiter | C2 | holds | Known README:749-751 as written: a raise restarts full (availableIn 0). | | bridge-limiter | C3 | holds | `testFuzz_P1P2_inLimitNeverTripsAcrossSetPath`, `testFuzz_countLowers`, `testFuzz_P1_sameLimitNewWindow` (256 runs each); no trip. | | bridge-limiter | C4 | holds | Breaker invariant; it depends on the 96 h pause coupling. The item proposes enforcing L x (1+4d/W) <= B in `_check`. | | bridge-limiter | P1-bound-text | refuted | See above (info). | | bridge-instant-allowance | C1 | holds | A raise empties the allowance and a lower keeps it; first settings start empty. 3 fuzz tests at 3,000 runs PASS. Mutants FAIL. | | bridge-instant-allowance | C2 | holds | <= 15,000 per path within D (`testFuzz_P2_ruleA`, 3,000 runs). 30,000 into Ethereum = README:784. | | bridge-instant-allowance | C3 | holds | EMPTY vs FULL readers are consistent; documentation notes above. | | bridge-hold-drop | C1 | holds | `test_C1_table`, 16 cells x 7 acts vs a reference model. | | bridge-hold-drop | C2 | holds | `testFuzz_C2_dropNeverHeld`, 10,000 runs; README:765 as written. | | bridge-hold-drop | C3 | holds | `testFuzz_C3_dropOverDrop`, 10,000 runs; batch routes PASS. | | bridge-hold-drop | C4 | **refuted** | F1 (junk/1-bound hold). | | bridge-hold-drop | C5 | holds | `testFuzz_C5_sequence`, 10,000 x 24 acts. The model shares the spec gap F1. | | bridge-incident-acts | C1 | **refuted** | BIA-F1, BIA-F2; the named-RELEASE case is tested (`test_C1_releaseNamedAfterStrangerRun` PASS). | | bridge-incident-acts | C2 | holds (confirmed defect) | BIA-F2. The ENDPOINT_* re-proposal variant was read from the code. | | bridge-incident-acts | C3 | holds | uint32 counters; `test_P2_countersBound` matches README:776. | | bridge-incident-acts | C4 | **refuted** | INV-SAFE fails (BIA-F1/F2). Proposed design: stateless propose; feasibility checked at apply as per-item no-ops. | | bridge-delay-timing | C1 | holds | `testFuzz_shortenRoute` (1000/5000 runs) with an exact oracle. | | bridge-delay-timing | C2 | holds | Known README:787 as written. New bound: `test_C2_liftedCutoffBound` minted 193,750 in one block (< 250,000). Operational note: cancel in a block before ETA. | | bridge-delay-timing | C3 | holds | One proposal slot; `test_C3_tightenFailsMultiPathSetDelay` and `test_C3_releaseLateRunsAsClaim` PASS. | | bridge-delay-timing | C4 | holds | Known README:782; `test_C4_unpauseLateStockpileQueues`: 0 minted. | | bridge-delay-timing | C5 | holds | I1/I2 invariant in `testFuzz_loosenings`; the only route outside it is the lifted cutoff (known). | | bridge-supply-isolation | C1 | holds | `testFuzz_noAction72h`: each path <= 140,000, 87,500 untouched. `test_greedyForger`: exactly 87,500. Compiled at 0.8.34. | | bridge-supply-isolation | C2 | not-checked | [fork] NOT RUN (public RPC refused archive state). Local gas: 162,421 / 113,233 < 250,000 on the mock. | | bridge-supply-isolation | C3 | holds | No wirer on ImdBridge; `wire` is one-shot; `testFuzz_minterSet` PASS. | | bridge-supply-isolation | C4 | holds | `checkBridge` requires the immutable endpoint. Endpoint addresses not matched to LayerZero docs. | | bridge-lzpaths-config | C1 | holds | Only the `availableOut/In != 0` check exists; batches come from LzPaths → F2 (info). | | bridge-lzpaths-config | C2 | holds | **RAN** at head: Ethereum block 26553746 (ethereum-rpc.publicnode.com), Base 65801024 (mainnet.base.org), 4663 129468858 (rpc.mainnet.chain.robinhood.com). Endpoint eids and the code of all pinned addresses checked; DVN operator identity not verified. | | bridge-lzpaths-config | C3 | holds | `testFuzz_goldenEthereum4663` PASS (256 runs). | | bridge-lzpaths-config | C4 | holds | Code read, no dedicated test; README:781. | | bridge-lzpaths-config | C5 | holds | CfgInvariant 1000 x 100, mutants FAIL. | | stock-oracle-s-price | F1 | holds | `testFuzz_F1F2_oneWrongRound`, 20,000 runs; no lender loss. Wall-clock duration [data] NOT RUN. | | stock-oracle-s-price | F2 | holds | min of the pair; same fuzz. | | stock-oracle-s-price | F6 | holds | `test_F6_fastOpen`. | | stock-oracle-s-price | F7 | holds | Known README:814-818 as written. | | stock-oracle-s-price | C1 | holds | `testFuzz_C1_edges`, 20,000 runs. | | stock-oracle-s-price | C2 | holds | `test_C2_constructor`. | | stock-oracle-s-price | C3 | holds | `testFuzz_C3_differential`, 20,000 runs, 0 mismatches. | | stock-oracle-s-session | F3 | holds | `testFuzz_F3_premarketBound`, 3,000 runs. | | stock-oracle-s-session | F4 | **refuted** | SOS-1 (holds with SESSION_ROUNDS off). | | stock-oracle-s-session | F5 | holds | `test_F5_phaseAndBounds`. | | stock-oracle-s-session | F8 | holds | `testFuzz_P4_grace`, 3,000 runs. | | stock-oracle-s-session | C1 | holds | `testFuzz_C1_deadOverHoliday`: <= 49 h open-market time. | | stock-oracle-s-session | C2 | not-checked | [data] NOT RUN. | | stock-oracle-s-session | FILES-StageChain | **refuted** | See above. | | stock-multiplier-freeze | C1 | holds | `testFuzz_C1C2_splitOrQuickChainNeverPricesBeforeRelease`, 2000 runs. | | stock-multiplier-freeze | C2 | holds | Same fuzz; the stalled-feed case is SMF-1. | | stock-multiplier-freeze | C3 | holds | `testFuzz_C3C5_randomOrderings`, 2000 x 40. | | stock-multiplier-freeze | C4 | holds | `test_C4_unreadableMultiplierIsFrozen`. | | stock-multiplier-freeze | C5 | **refuted** | Invariants (I)+(II) are not sufficient; the base moves on time alone (SMF-1). | Related verdicts across items, none contradictory: - delay-timing C1 (holds) and incident-acts C1 (refuted) are about different claims. - s-price F6 (holds) and s-session F4 (refuted) agree: F4 holds with SESSION_ROUNDS off. ## Properties that hold (with what was tried) **bridge-limiter** - **P1** (no in-limit trip across a SET_PATH): `testFuzz_P1P2` (256), `testFuzz_countLowers`, `testFuzz_P1_sameLimitNewWindow`, `test_P1_tightestLowerDoesNotTrip`, `test_lowerCannotReopenInItsOwnBatch`. Transfers in the same block as the apply, UTC-day edges and C = 0 were covered. A sanity driver trips at 90,000, so the passes are not vacuous. - **P2** (holds on two live paths at once): all state is keyed by eid, and `testFuzz_P1P2` runs both paths together. **bridge-instant-allowance** - **P1:** `testFuzz_P1_instantWithinRate`, 3,000 runs of 24 ops, with stranger applies placed around forged messages. Also `testFuzz_acceptProbeUnderGasGrief` at 30k-600k gas, and mutants. - **P2:** `testFuzz_P2_ruleA`, <= 15,000 per path. **bridge-hold-drop** - **P1:** the 16 x 7 table, 10,000 x 24-act sequences and C2/C3 fuzz. Every hold with `until != 0` queues (`:583`). - **P2:** grep of every writer: `hold :713` and RELEASE apply `:1198-1201` only. **bridge-incident-acts** - **P2:** counters reachable only by the governor; `test_P2_countersBound`. - **P3:** `testFuzz_P3_tightenAfterStrangerApply`, 1000 and 2000 runs. - **P1, instant acts alone:** read every revert path. Only the propose items fail (BIA-F1/F2). **bridge-delay-timing** - **P1:** every writer of the claim state was reviewed; `testFuzz_loosenings` and the oracle in `testFuzz_shortenRoute`. - **P2:** loss <= C x (1 + D/1 day); I1/I2; `test_C4`. - **P3:** stranger applies at random moments and in the same block as claims. **bridge-supply-isolation** - **P1** (supply == netMinted; paths isolated): `testFuzz_noAction72h`, `testFuzz_honestRoundTrip`, repo `ThreePaths.t.sol` 8/8. - **P2** (honest transfers delivered): `testFuzz_honestRoundTrip`. - **P3** (minter set is exactly ledger, bridge and hub): `testFuzz_minterSet`. **bridge-lzpaths-config** - **P1**, launch route only: `test_lzPathsBatchAppliesAsSpecified` and repo LzPaths tests. It fails for the house route (F1). - **P2:** dropped-item batches are refused; CfgInvariant. - **P3:** `testFuzz_enforcedOptionsAlwaysLead`, 5,000 runs. **stock-oracle-s-price** - **P1:** C3 differential, C1 edges, F1/F2 fuzz. - **P2:** `test_P2_configuredMarkets`, all 9 tickers; the worst is SGOV at 0.916 < 1. - **P3** (SCALE): `testFuzz_P3_scale`. - **Writers and readers:** no route found that bypasses the rule. **stock-oracle-s-session** - **P1:** `testFuzz_P1_pricedOnlyInSession`, `testFuzz_P1_earlyClose`. - **P2:** `testFuzz_P2_issuer`. Not covered: a registry swap needs an upgrade. - **P3:** code read of Morpho Blue. - **P4:** `testFuzz_P4_grace`. **stock-multiplier-freeze** - **P1:** random orderings, 2000 x 40. - **P3:** holds except for SMF-2. - **Writers and readers:** all inside StockOracle. - P2 fails (SMF-1). ## Not run - **bridge-limiter:** no [fork]/[data] claims; mock endpoint; `test/unit/LzPaths.t.sol` not rerun; earlier findings 74838ad4, dc9419af and 439d66ba not re-verified. - **bridge-instant-allowance:** no [fork]/[data] claims; value routes for forged imdUSD outside the bridge (Redeemer, StableModule, Morpho lender) not tested; gas-grief probe not instrumented. - **bridge-hold-drop:** real EndpointV2 not run (mock; LayerZero source read). - **bridge-incident-acts:** no [fork]/[data] claims; ENDPOINT_* re-proposal and the SET_DELAY-shorter/SET_PATH-after-UNPAUSE variants were reasoned from the code; MockLzEndpoint only. - **bridge-delay-timing:** no [fork]/[data] claims; earlier submissions dc9419af and 439d66ba only scanned. - **bridge-supply-isolation:** - C2 [fork] (AuditW4BridgeEndpoint at mainnet 26,418,627): NOT RUN, because the public RPC refused archive requests. - Real EndpointV2 gas overhead not measured. - Endpoint addresses not matched to LayerZero's published list. - Built at solc 0.8.34, not 0.8.38. - **bridge-lzpaths-config:** fork gas tests (`test_fork_lzReceiveGasRealImdUsd`, `BasePaths.fork.t.sol`) NOT RUN; C4 checked by code reading only. - **stock-oracle-s-price:** [fork] token/feed decimals and live rounds on 4663: NOT RUN. [data] F1 wall-clock duration: NOT RUN. - **stock-oracle-s-session:** C2 [data] NOT RUN; [fork] NOT RUN; Morpho integration for P3 by code reading only. - **stock-multiplier-freeze:** [fork]/[data] (whether 4663 feeds print within 24 h of a multiplier change; stall frequency) NOT RUN. - **This merge:** no test was re-run; the cited code lines were read at the commit. ## Machine-readable summary ```json {"objective":"imdUSD v2 day 1: every defect that loses, locks or mis-mints money","commit":"ff1c192b3798542997f600091f2dc73ff05e4c40","forge":"per item (see 'How this merge was made'); merge re-ran no tests","verdict":"findings","findings":[{"id":"bridge-incident-acts:BIA-F1","items":["bridge-incident-acts"],"severity":"medium","status":"test ran by item","test":"section 1"},{"id":"bridge-incident-acts:BIA-F2","items":["bridge-incident-acts"],"severity":"low","status":"test ran by item","test":"section 2"},{"id":"bridge-hold-drop:F1","items":["bridge-hold-drop"],"severity":"low","status":"test ran by item","test":"section 3"},{"id":"stock-multiplier-freeze:SMF-1","items":["stock-multiplier-freeze"],"severity":"low","status":"test ran by item","test":"section 4"},{"id":"stock-oracle-s-session:SOS-1","items":["stock-oracle-s-session"],"severity":"low","status":"test ran by item","test":"section 5"},{"id":"bridge-lzpaths-config:F1","items":["bridge-lzpaths-config"],"severity":"low","status":"test ran by item","test":"section 6"},{"id":"bridge-lzpaths-config:F2","items":["bridge-lzpaths-config"],"severity":"info","status":"test ran by item","test":"section 7"},{"id":"stock-multiplier-freeze:SMF-2","items":["stock-multiplier-freeze"],"severity":"info","status":"test ran by item","test":"section 8"}],"unverified":[{"id":"bridge-limiter:P1-bound-text","severity":"info","status":"unverified (no failing test)"},{"id":"stock-oracle-s-session:FILES-StageChain","severity":"info","status":"unverified (refuted claim; route absent at commit)"},{"id":"bridge-incident-acts:C1-subcase-SET_DELAY/SET_PATH-after-UNPAUSE","severity":"low","status":"unverified (read from code, not tested)"}],"claims":["bridge-delay-timing:C1=holds","bridge-delay-timing:C2=holds","bridge-delay-timing:C3=holds","bridge-delay-timing:C4=holds","bridge-delay-timing:C5=holds","bridge-hold-drop:C1=holds","bridge-hold-drop:C2=holds","bridge-hold-drop:C3=holds","bridge-hold-drop:C4=refuted","bridge-hold-drop:C5=holds","bridge-incident-acts:C1=refuted","bridge-incident-acts:C2=holds","bridge-incident-acts:C3=holds","bridge-incident-acts:C4=refuted","bridge-instant-allowance:C1=holds","bridge-instant-allowance:C2=holds","bridge-instant-allowance:C3=holds","bridge-limiter:C1=holds","bridge-limiter:C2=holds","bridge-limiter:C3=holds","bridge-limiter:C4=holds","bridge-limiter:P1-bound-text=refuted","bridge-lzpaths-config:C1=holds","bridge-lzpaths-config:C2=holds","bridge-lzpaths-config:C3=holds","bridge-lzpaths-config:C4=holds","bridge-lzpaths-config:C5=holds","bridge-supply-isolation:C1=holds","bridge-supply-isolation:C2=not-checked","bridge-supply-isolation:C3=holds","bridge-supply-isolation:C4=holds","stock-multiplier-freeze:C1=holds","stock-multiplier-freeze:C2=holds","stock-multiplier-freeze:C3=holds","stock-multiplier-freeze:C4=holds","stock-multiplier-freeze:C5=refuted","stock-oracle-s-price:F1=holds","stock-oracle-s-price:F2=holds","stock-oracle-s-price:F6=holds","stock-oracle-s-price:F7=holds","stock-oracle-s-price:C1=holds","stock-oracle-s-price:C2=holds","stock-oracle-s-price:C3=holds","stock-oracle-s-session:F3=holds","stock-oracle-s-session:F4=refuted","stock-oracle-s-session:F5=holds","stock-oracle-s-session:F8=holds","stock-oracle-s-session:C1=holds","stock-oracle-s-session:C2=not-checked","stock-oracle-s-session:FILES-StageChain=refuted"],"holds":["bridge-delay-timing:P1","bridge-delay-timing:P2","bridge-delay-timing:P3","bridge-hold-drop:P1","bridge-hold-drop:P2","bridge-incident-acts:P2","bridge-incident-acts:P3","bridge-incident-acts:P1","bridge-instant-allowance:P1","bridge-instant-allowance:P2","bridge-limiter:P1","bridge-limiter:P2","bridge-lzpaths-config:P1","bridge-lzpaths-config:P2","bridge-lzpaths-config:P3","bridge-supply-isolation:P1","bridge-supply-isolation:P2","bridge-supply-isolation:P3","stock-multiplier-freeze:P1","stock-multiplier-freeze:P2","stock-multiplier-freeze:P3","stock-multiplier-freeze:Writers/readers","stock-oracle-s-price:P1","stock-oracle-s-price:P2","stock-oracle-s-price:P3","stock-oracle-s-price:Writers/readers","stock-oracle-s-session:P1","stock-oracle-s-session:P2","stock-oracle-s-session:P3","stock-oracle-s-session:P4"],"notRun":"see section Not run","items":[{"item":"bridge-delay-timing","verdict":"holds","commit":"ff1c192b3798542997f600091f2dc73ff05e4c40"},{"item":"bridge-hold-drop","verdict":"findings","commit":"ff1c192b3798542997f600091f2dc73ff05e4c40"},{"item":"bridge-incident-acts","verdict":"findings","commit":"ff1c192b3798542997f600091f2dc73ff05e4c40"},{"item":"bridge-instant-allowance","verdict":"holds","commit":"ff1c192b3798542997f600091f2dc73ff05e4c40"},{"item":"bridge-limiter","verdict":"holds","commit":"ff1c192b3798542997f600091f2dc73ff05e4c40"},{"item":"bridge-lzpaths-config","verdict":"findings","commit":"ff1c192b3798542997f600091f2dc73ff05e4c40"},{"item":"bridge-supply-isolation","verdict":"holds","commit":"ff1c192b3798542997f600091f2dc73ff05e4c40"},{"item":"stock-multiplier-freeze","verdict":"findings","commit":"ff1c192b3798542997f600091f2dc73ff05e4c40"},{"item":"stock-oracle-s-price","verdict":"holds","commit":"ff1c192b3798542997f600091f2dc73ff05e4c40"},{"item":"stock-oracle-s-session","verdict":"findings","commit":"ff1c192b3798542997f600091f2dc73ff05e4c40"}],"missing":[]} ```