{
 "item": "bridge-delay-timing",
 "commit": "ff1c192b3798542997f600091f2dc73ff05e4c40",
 "forge": "forge 1.9.0 (6056c58); compiled with --use <path>/solar (solar 0.3.0-dev, solc-compatible 0.8.38); the literal `--use solar` is refused by this forge ('solc \"solar\" does not exist'), so the solar binary was passed by path. Only test/scratch/BridgeDelayTiming.t.sol (+ its import test/unit/AuditW7JudgeBridge.t.sol harness) compiled.",
 "verdict": "holds",
 "findings": [],
 "claims": [
  {
   "id": "C1",
   "result": "holds",
   "evidence": "A shorter D is refused on an open path at propose and at apply (src/bridge/ImdBridge.sol:1035 `if (delay < b.delay && !paused[eid]) revert PathOpen(eid);`, re-run by Governed.applyPending src/Governed.sol:78 `_validate(payload)` before `_apply`); the only route that clears `paused` is the UNPAUSE apply (src/bridge/ImdBridge.sol:1226-1231) and the one pending slot (src/Governed.sol:45) means no UNPAUSE can land between a paused propose and its apply. Every other loosening I listed was checked for 'frees a queued claim at the applier's moment': RESET_BREAKER needs the path paused (src/bridge/ImdBridge.sol:1025); raised C (SET_DELAY) and UNPAUSE / any SET_PATH on a set path restart the instant meter empty (src/bridge/ImdBridge.sol:1149,1231,1254); raised B never untrips (_setDelay only trips, src/bridge/ImdBridge.sol:1251); a raised inbound limit restarts full (src/bridge/ImdBridge.sol:1287); RELEASE / hold expiry / UNVOID always queue for D (src/bridge/ImdBridge.sol:589). UNCANCEL frees one claim the Safe named (its own intent), at once if matured: not a forger's route. The only loosening a stranger can time against queued forged claims is the lifted / later cutoff, README:787 (known, quoted under C2). testFuzz_shortenRoute (1000 and 5000 runs: D lengthened by tighten to 12h..7d, claims at random moments, pause at a random moment, BATCH[SET_DELAY,UNPAUSE] or SET_DELAY then UNPAUSE, every apply by a stranger at eta..eta+14d, claims in the apply block) PASS with an exact oracle: a claim mints iff t >= queuedAt + D_new, and always t >= pausedAt + 48h."
  },
  {
   "id": "C2",
   "result": "holds",
   "evidence": "Known as written, README:787: 'A lifted cutoff is a loosening too (5-C14): a SET_DELAY that lifts the bulk-cancel cutoff (or moves it later), once matured, can be applied by anyone at a moment they choose for 14 days, and every claim queued under the cutoff and already matured under D can be claimed in that block (no window at all).' The validator has no pause or direction check on cancelFrom (src/bridge/ImdBridge.sol:1026-1039), claim checks it only at claim time (src/bridge/ImdBridge.sol:606). Bound: the cutoff does not stop queueing and the breaker counts only BREAKER_DAYS=4 UTC days, so with L x (1 + 4d/W) <= B nothing trips and the lift frees every pending claim queued in [cut, apply - D]: at most L x (1 + (t_apply - cut)/W), and t_apply - (Safe's last queue check) can be 48h + 14d. test_C2_liftedCutoffBound PASS: launch values (L 50,000 / 4 d, D 12h, C tightened to 0), cutoff set when the Safe proposes the lift with an empty queue, forger streams at the inbound limit, stranger applies at eta + 14 d and claims in the same transaction: 193,750 imdUSD minted in one block, under the bound 250,000, no trip. Not worse than written (the README says 'no window at all'); the bound is new information: about L x (1 + 16 d / W) - L x D/W per path (into Ethereum: two paths). Operational note: the Safe's 'apply at ETA after re-checking' must cancel in a block BEFORE the ETA block, because a builder / the 4663 sequencer can put a stranger's [applyPending, claim] in front of a Safe MultiSend [cancelClaim..., applyPending] at ETA."
  },
  {
   "id": "C3",
   "result": "holds",
   "evidence": "One slot: src/Governed.sol:45 `if (pendingEta != 0) revert ProposalPending();`. tighten bumps the path version ({B}:669) and SET_DELAY requires `version != b.version` false ({B}:1031) for EVERY item, so test_C3_tightenFailsMultiPathSetDelay PASS: BATCH[SET_DELAY A, SET_DELAY B], tighten(A), applyPending reverts BadPayload (B's change is lost too), as README:1104 says. RELEASE: HOLD_TIME 72h ({B}:272) - TIMELOCK 48h = must be proposed within 24h with the slot free (the Safe can always cancel() first). test_C3_releaseLateRunsAsClaim PASS: a DROP proposed at hold + 24h + 1 matures after the hold ends; the replay runs at the hold's end but QUEUES (until != 0 -> _queue, {B}:589), minting nothing at once."
  },
  {
   "id": "C4",
   "result": "holds",
   "evidence": "Known as written, README:782 ('UNPAUSE (and BATCH[RESET_BREAKER, UNPAUSE]) applies at anyone's moment, eta to eta + 14 days, so a packet verified after the sweep runs at that moment (queued: the Safe has D from the reopening)'). The sweep is checked only off-chain (script/launch/BridgeBatch.s.sol:223 requires the path set and paused when the file is written). Bound: at the UNPAUSE block the instant meter restarts empty ({B}:1231), so every stockpiled packet queues; the inbound limiter allows at most L at once plus L/W per second after; claims wait D from the reopening; with no Safe action the breaker caps a 4-day window at B. test_C4_unpauseLateStockpileQueues PASS: 30 forged packets of 5,000 verified while paused, UNPAUSE applied by a stranger at eta + 14 d, all run in that block: 10 run (50,000 = L), all queued, 0 minted, claim at reopening + 12h - 1 refused. Instant mint after reopening <= C x t / 1 day, so P2's C x (1 + D/1 day) holds with margin."
  },
  {
   "id": "C5",
   "result": "holds",
   "evidence": "Invariant (tested by testFuzz_loosenings, 1000-3000 runs x 80 steps, and test_coverage, 100 seeds: 111 claims minted, 10 after a lifted cutoff): for every claim c minted at time t, (I1) t >= c.queuedAt + min D in force over [queuedAt, t]; (I2) if t < c.queuedAt + max D in force over [queuedAt, t] then the path was paused at some p with queuedAt <= p <= t - 48h. Steps: forged packets, pause, tighten (longer D, earlier cutoff), tripBreaker, cancelClaim, proposals SET_DELAY (any D, cutoff 0 / same / any earlier time), UNPAUSE, BATCH[SET_DELAY,UNPAUSE], BATCH[RESET_BREAKER,UNPAUSE], stranger applyPending at any moment (same block dt 0, +1 s, 0-3 d, 48 h-18 d), stranger claims. Both hold. The one route outside I2 is the lifted cutoff (known, README:787). Smallest replacement design that makes ONE invariant ('a queued claim mints only at queuedAt + the D it queued under, or after a pause that began >= 48 h before') cover every route: apply the shortening's PathOpen rule to the cutoff too, at propose and apply, e.g. `uint40 cut = b.cancelledFrom; if (cut != 0 && (cancelFrom == 0 || cancelFrom > cut) && !paused[eid]) revert PathOpen(eid);` next to src/bridge/ImdBridge.sol:1035; then shorter D, later/lifted cutoff and RESET_BREAKER all reopen only through UNPAUSE (meter empty), and UNCANCEL stays the only per-claim exception (Safe-named)."
  }
 ],
 "holds": [
  {
   "property": "P1 A matured claim on an open, untripped path stays claimable unless D is lengthened, cut or cancelled.",
   "tried": "Read every writer of the state claim reads ({B}:598-612): breakers[eid].delay/cancelledFrom/tripped (_setDelay via first SET_PATH {B}:1142, SET_DELAY apply {B}:1218, tighten {B}:654; _trip via _queue, tripBreaker, _setDelay; RESET_BREAKER {B}:1219), paused (pause {B}:693, UNPAUSE {B}:1226), claims[].state (_queue, claim, cancelClaim, UNCANCEL). No writer in src/ outside ImdBridge; script/ only reads (BridgeBatch.s.sol:124,149,223). Other than lengthen / cutoff / cancel, a matured claim is stopped only by a pause or a trip (excluded by the property) or the token refusing the mint (not this mechanism). testFuzz_loosenings asserts nothing reverts claims beyond these (oracle in testFuzz_shortenRoute: a claim on an open path mints iff t >= queuedAt + D)."
  },
  {
   "property": "P2 A Safe that pauses BEFORE queuedAt + D (D: shortest in force or matured since it queued) loses at most C x (1 + D / 1 day) per path.",
   "tried": "claim needs `block.timestamp >= queuedAt + b.delay` ({B}:601-602) and the path unpaused ({B}:603); b.delay can only fall on a paused path ({B}:1035), so a pause before queuedAt + D (strictly: a claim ordered before the pause in the block at exactly queuedAt + D mints, the property says BEFORE) leaves every queued forgery claimable only after the reopening's 48 h, in which the Safe cancels it. Instant mints are metered at C per day from a meter that starts or restarts empty (first message {B}:583, UNPAUSE, raised C, SET_PATH), so <= C + C x D/1 day. I1/I2 in testFuzz_loosenings and the oracle in testFuzz_shortenRoute; test_C4 shows 0 minted at a late reopening. The lifted cutoff is outside P2 only when the Safe neither applies it at ETA nor cancels (README:787)."
  },
  {
   "property": "P3 P1-P2 across every rule-abiding SET_PATH, SET_DELAY, UNPAUSE, RESET_BREAKER anyone applies in front, traffic live.",
   "tried": "testFuzz_loosenings applies every pending proposal by a stranger at random moments, in front of the Safe's acts and in the same block as claims, with forged traffic live; testFuzz_shortenRoute applies the reopen at every point of eta..eta+14d. SET_PATH on a set path restarts the meter empty ({B}:1149) and a raised limit restarts full; launch BATCH[SET_PATH, SET_DELAY v0] (script/house/DeployConfig.sol:1141) validates against the unset path (b.delay 0) and is a fresh path. pause drops a pending UNPAUSE or BATCH holding UNPAUSE(eid) ({B}:694); tighten / tripBreaker make stale SET_DELAY / RESET_BREAKER fail by version / trip number. No ordering broke P1 or P2. The deployer has no power here (governor immutable, {B}:451)."
  }
 ],
 "notRun": [
  "No [fork] or [data] claims on this sheet: NOT RUN (none needed).",
  "Earlier submissions of jobs dc9419af-... and 439d66ba-... fetched (api.imd.fun) but only scanned for keywords; not re-judged."
 ],
 "harness": {
  "path": "test/scratch/BridgeDelayTiming.t.sol (imports test/unit/AuditW7JudgeBridge.t.sol for the endpoint / token / Safe mocks)",
  "command": "forge test --use <solar path> --match-path test/scratch/BridgeDelayTiming.t.sol --match-contract BridgeDelayTimingTest --no-match-test 'test_(M1|L3|L4|L5|FR|C14|cap)|testFuzz_FR' --fuzz-runs 1000 --gas-limit 100000000000 -vv",
  "result": "[PASS] testFuzz_loosenings(uint256) (runs: 1000, \u03bc: 22890384, ~: 22220380)\n[PASS] testFuzz_shortenRoute(uint256,uint32,uint32,uint32,uint32,bool) (runs: 1000, \u03bc: 5198849, ~: 5189485)\n[PASS] test_C2_liftedCutoffBound() (gas: 25781979)\n  freed in the apply block: 193750.000000000000000000\n[PASS] test_C3_releaseLateRunsAsClaim() (gas: 2677414)\n[PASS] test_C3_tightenFailsMultiPathSetDelay() (gas: 5066627)\n[PASS] test_C4_unpauseLateStockpileQueues() (gas: 6701037)\n[PASS] test_coverage() (gas: 2465715720)\n  claims minted: 111\n  minted early by a shortening (all paused >= 48h before): 0\n  minted after a lifted cutoff: 10\nSuite result: ok. 7 passed; 0 failed; 0 skipped; finished in 5.58s (8.68s CPU time)\n",
  "source": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.38;\n\nimport \"../unit/AuditW7JudgeBridge.t.sol\";\n\n/// Goal item bridge-delay-timing: every loosening of a path's delay settings applied at anyone's moment.\ncontract BridgeDelayTimingTest is AuditW7JudgeBridgeTest {\n    uint8 constant RESET_BREAKER = 14;\n    uint64 nonce;\n    bytes32[] gs;\n    uint256[] qAt;\n    uint256[] minD;\n    uint256[] maxD;\n    uint256[] firstPause;\n    bool[] everCut;\n    uint256 cutFreed; // claims minted that were under a cutoff at some sampled moment (README:787, known)\n    uint256 shortened; // claims minted before queuedAt + the longest D since queue\n    uint256 claimedN;\n\n    function _bk() internal view returns (bool tripped, uint256 trips, uint256 delay, uint256 cut, uint256 version) {\n        (, uint32 t, bool tr,, uint32 d, uint40 c, uint32 v) = bridge.breakers(A);\n        return (tr, t, d, c, v);\n    }\n\n    function _sample() internal {\n        (,, uint256 d, uint256 cut,) = _bk();\n        bool p = bridge.paused(A);\n        for (uint256 i; i < gs.length; ++i) {\n            (,,, uint8 st) = bridge.claims(A, gs[i]);\n            if (st != 1) continue;\n            if (d < minD[i]) minD[i] = d;\n            if (d > maxD[i]) maxD[i] = d;\n            if (p && firstPause[i] == 0) firstPause[i] = vm.getBlockTimestamp();\n            if (cut != 0 && qAt[i] >= cut) everCut[i] = true;\n        }\n    }\n\n    function _forge(uint256 amt) internal {\n        nonce++;\n        bytes32 g = keccak256(abi.encode(\"forged\", nonce));\n        bytes memory m = _msg(forger, amt);\n        ep.verify(address(bridge), A, PEER_A, nonce, g, m);\n        if (!_try(A, PEER_A, nonce, g, m)) return;\n        bytes32 k = _key(A, PEER_A, nonce);\n        (,,, uint8 st) = bridge.claims(A, k);\n        if (st != 1) return; // minted at once\n        (,, uint256 d,,) = _bk();\n        gs.push(k);\n        qAt.push(vm.getBlockTimestamp());\n        minD.push(d);\n        maxD.push(d);\n        firstPause.push(0);\n        everCut.push(false);\n    }\n\n    function _setDelay(uint256 delay, uint256 cut) internal view returns (bytes memory) {\n        (,,,, uint256 v) = _bk();\n        (,, uint64 capSD) = bridge.instantIn(A);\n        (,,, uint64 bSD,,,) = bridge.breakers(A);\n        return abi.encode(SET_DELAY, A, uint256(capSD) * 1e12, delay, uint256(bSD) * 1e12, uint40(cut), v);\n    }\n\n    function _tryPropose(bytes memory p) internal {\n        bytes[] memory c = new bytes[](2);\n        c[0] = abi.encodeWithSignature(\"cancel()\");\n        c[1] = abi.encodeWithSignature(\"propose(bytes)\", p);\n        try safe.batch(address(bridge), c) {} catch {}\n    }\n\n    function _claimAll() internal {\n        for (uint256 i; i < gs.length; ++i) {\n            vm.prank(stranger);\n            try bridge.claim(A, gs[i]) {\n                uint256 t = vm.getBlockTimestamp();\n                claimedN++;\n                // I1: never before queuedAt + the shortest D in force since it queued\n                assertGe(t, qAt[i] + minD[i], \"I1: claimed before queuedAt + min D\");\n                // I2: claimed before queuedAt + the longest D since queue only if the path was paused after it queued,\n                // 48 h or more before the claim (every shortening needs the pause at propose and at apply)\n                if (t < qAt[i] + maxD[i]) {\n                    shortened++;\n                    assertTrue(firstPause[i] != 0 && firstPause[i] + 48 hours <= t, \"I2: a shortening reached an unpaused claim\");\n                }\n                if (everCut[i]) cutFreed++;\n            } catch {}\n        }\n    }\n\n    /// Stateful fuzz over orderings: forged packets, Safe pause / tighten / cancelClaim / tripBreaker / proposals\n    /// (SET_DELAY any D and cutoff, UNPAUSE, BATCH[SET_DELAY, UNPAUSE], BATCH[RESET_BREAKER, UNPAUSE]), stranger applies\n    /// and claims, same-block steps (dt 0) and day / window edges.\n    function testFuzz_loosenings(uint256 seed) public {\n        _govern(_launch(A, PEER_A));\n        for (uint256 s; s < 80; ++s) {\n            uint256 r = uint256(keccak256(abi.encode(seed, s)));\n            uint256 op = r % 32;\n            r >>= 8;\n            if (op < 6) {\n                uint256 k = r % 4;\n                _pass(k == 0 ? 0 : k == 1 ? 1 : k == 2 ? (r >> 8) % 3 days : 48 hours + (r >> 8) % 16 days);\n            } else if (op < 12) {\n                _forge(10e18 + (r % 20_000) * 1e18);\n            } else if (op == 12) {\n                _safe(abi.encodeWithSignature(\"pause(uint32)\", A));\n            } else if (op == 13) {\n                (,, uint256 d,,) = _bk();\n                uint256 cut = r % 2 == 0 ? 0 : vm.getBlockTimestamp() - ((r >> 8) % 2 days);\n                _safe(abi.encodeWithSignature(\"tighten(uint32,uint256,uint256,uint256,uint40)\", A, type(uint256).max,\n                    d + (r >> 16) % 2 days, type(uint256).max, uint40(cut)));\n            } else if (op < 18) {\n                uint256 k = r % 4;\n                (bool tr, uint256 trips, uint256 d0, uint256 c0,) = _bk();\n                uint256 delay = (r >> 4) % 2 == 0 ? 1 hours + (r >> 8) % (7 days - 1 hours) : d0;\n                uint256 cut = (r >> 40) % 3 == 0 ? 0 : (r >> 40) % 3 == 1 ? c0 : vm.getBlockTimestamp() - ((r >> 48) % 3 days);\n                if (k == 0) {\n                    _tryPropose(_setDelay(delay, cut));\n                } else if (k == 1) {\n                    _tryPropose(abi.encode(UNPAUSE, A));\n                } else {\n                    bytes[] memory items = new bytes[](2);\n                    items[0] = k == 2 ? _setDelay(delay, cut) : abi.encode(RESET_BREAKER, A, tr ? trips : 0);\n                    items[1] = abi.encode(UNPAUSE, A);\n                    _tryPropose(abi.encode(BATCH, items));\n                }\n            } else if (op < 23) {\n                if (op == 18) _pass(48 hours + (r % 2 hours));\n                vm.prank(stranger);\n                try bridge.applyPending() {} catch {}\n            } else if (op < 29) {\n                _sample();\n                _claimAll();\n            } else if (op == 29) {\n                _safe(abi.encodeWithSignature(\"tripBreaker(uint32)\", A));\n            } else if (op == 30 && gs.length != 0) {\n                _safe(abi.encodeWithSignature(\"cancelClaim(uint32,bytes32)\", A, gs[r % gs.length]));\n            } else if (op == 31) {\n                // macro: the Safe pauses and reopens with a shorter D (one BATCH, or SET_DELAY alone then UNPAUSE);\n                // claims tried in the block before and the block of each stranger apply\n                if ((r >> 20) % 2 == 0) {\n                    _safe(abi.encodeWithSignature(\"tighten(uint32,uint256,uint256,uint256,uint40)\", A, type(uint256).max,\n                        3 days + (r >> 22) % 4 days, type(uint256).max, uint40(0)));\n                    _sample();\n                    _pass((r >> 24) % 1 days);\n                }\n                _safe(abi.encodeWithSignature(\"pause(uint32)\", A));\n                _sample();\n                (,, uint256 d0,,) = _bk();\n                uint256 nd = 1 hours + (r >> 8) % (d0 > 1 hours ? d0 - 1 hours : 1);\n                (,,, uint256 c0,) = _bk();\n                if ((r >> 30) % 2 == 0) {\n                    bytes[] memory items = new bytes[](2);\n                    items[0] = _setDelay(nd, c0);\n                    items[1] = abi.encode(UNPAUSE, A);\n                    _tryPropose(abi.encode(BATCH, items));\n                } else {\n                    _tryPropose(_setDelay(nd, c0));\n                }\n                _pass(48 hours + (r >> 40) % 14 days);\n                _claimAll();\n                vm.prank(stranger);\n                try bridge.applyPending() {} catch {}\n                _sample();\n                _claimAll();\n                if ((r >> 30) % 2 == 1) {\n                    _tryPropose(abi.encode(UNPAUSE, A));\n                    _pass(48 hours + (r >> 50) % 14 days);\n                    vm.prank(stranger);\n                    try bridge.applyPending() {} catch {}\n                    _sample();\n                    _claimAll();\n                }\n            }\n            _sample();\n        }\n        _claimAll();\n    }\n\n    function test_coverage() public {\n        (uint256 cl, uint256 sh, uint256 cf) = (0, 0, 0);\n        for (uint256 i; i < 100; ++i) {\n            uint256 snap = vm.snapshotState();\n            testFuzz_loosenings(uint256(keccak256(abi.encode(\"cov\", i))));\n            (cl, sh, cf) = (cl + claimedN, sh + shortened, cf + cutFreed);\n            vm.revertToState(snap);\n        }\n        emit log_named_uint(\"claims minted\", cl);\n        emit log_named_uint(\"minted early by a shortening (all paused >= 48h before)\", sh);\n        emit log_named_uint(\"minted after a lifted cutoff\", cf);\n    }\n\n    /// P1-P3 / C1 on the one route that shortens D: lengthen (tighten, D up to 7 d), queue at random moments, pause, reopen\n    /// with a shorter D (BATCH[SET_DELAY, UNPAUSE] or SET_DELAY then UNPAUSE), every apply by a stranger at a random moment\n    /// in eta..eta+14 d, claims tried in that block. Exact oracle: a claim mints iff open and t >= queuedAt + new D, and\n    /// every claim minted before queuedAt + the D it was queued (or tightened) under has had the path paused >= 48 h.\n    function testFuzz_shortenRoute(uint256 seed, uint32 dLong, uint32 dNew, uint32 dtPause, uint32 dtApply, bool batch) public {\n        _govern(_launch(A, PEER_A));\n        dLong = uint32(bound(dLong, 12 hours, 7 days));\n        _safe(abi.encodeWithSignature(\"tighten(uint32,uint256,uint256,uint256,uint40)\", A, 0, uint256(dLong),\n            type(uint256).max, uint40(0)));\n        for (uint256 i; i < 6; ++i) {\n            _pass(uint256(keccak256(abi.encode(seed, i))) % 1 days);\n            _forge(1_000e18);\n        }\n        _pass(bound(dtPause, 0, dLong));\n        uint256 pausedAt = vm.getBlockTimestamp();\n        _safe(abi.encodeWithSignature(\"pause(uint32)\", A));\n        dNew = uint32(bound(dNew, 1 hours, dLong));\n        if (batch) {\n            bytes[] memory items = new bytes[](2);\n            items[0] = _setDelay(dNew, 0);\n            items[1] = abi.encode(UNPAUSE, A);\n            _propose(abi.encode(BATCH, items));\n        } else {\n            _propose(_setDelay(dNew, 0));\n        }\n        _pass(48 hours + bound(dtApply, 0, 14 days));\n        vm.prank(stranger);\n        bridge.applyPending();\n        if (!batch) {\n            _propose(abi.encode(UNPAUSE, A));\n            _pass(48 hours + bound(dtApply, 0, 14 days) / 2);\n            vm.prank(stranger);\n            bridge.applyPending();\n        }\n        uint256 t = vm.getBlockTimestamp();\n        assertGe(t, pausedAt + 48 hours);\n        for (uint256 i; i < gs.length; ++i) {\n            vm.prank(stranger);\n            (bool ok,) = address(bridge).call(abi.encodeCall(bridge.claim, (A, gs[i])));\n            assertEq(ok, t >= qAt[i] + dNew, \"oracle\");\n            if (ok && t < qAt[i] + dLong) assertLe(pausedAt + 48 hours, t, \"early mint without a 48h pause\");\n        }\n    }\n\n    /// C2 bound: a lifted cutoff, applied by a stranger at eta + 14 d, frees in ONE block every claim queued under it\n    /// that matured, up to L x (1 + T / W) with T = apply - cutoff (the breaker counts only 4 UTC days).\n    function test_C2_liftedCutoffBound() public {\n        _govern(_launch(A, PEER_A));\n        uint256 cut = vm.getBlockTimestamp();\n        _safe(abi.encodeWithSignature(\"tighten(uint32,uint256,uint256,uint256,uint40)\", A, 0, 0,\n            type(uint256).max, uint40(cut))); // C 0: every message queues\n        _propose(_setDelay(12 hours, 0)); // the Safe checked the queue: empty\n        uint256 eta = vm.getBlockTimestamp() + 48 hours;\n        // a forger streams at the inbound limit (50,000 / 4 days) until the last block a stranger may apply\n        while (vm.getBlockTimestamp() + 6 hours <= eta + 14 days) {\n            _pass(6 hours);\n            _forge(3_125e18); // 50,000 x 6h / 4d\n        }\n        _pass(eta + 14 days - vm.getBlockTimestamp());\n        uint256 before = tok.balanceOf(forger);\n        vm.startPrank(stranger);\n        bridge.applyPending();\n        for (uint256 i; i < gs.length; ++i) try bridge.claim(A, gs[i]) {} catch {}\n        vm.stopPrank();\n        uint256 freed = tok.balanceOf(forger) - before;\n        (bool tr,,,,) = _bk();\n        emit log_named_decimal_uint(\"freed in the apply block\", freed, 18);\n        assertFalse(tr, \"in-limit stream never trips\");\n        assertLe(freed, 50_000e18 + 50_000e18 * (vm.getBlockTimestamp() - cut) / 4 days, \"bound L x (1 + T/W)\");\n        assertGt(freed, 150_000e18, \"the 14-day applier window adds up to 175,000 at launch values\");\n    }\n\n    /// C3: a tighten on one path fails a multi-path SET_DELAY BATCH (shared slot, version per path), carried.\n    function test_C3_tightenFailsMultiPathSetDelay() public {\n        _govern(_launch(A, PEER_A));\n        _govern(_launch(B, PEER_B));\n        bytes[] memory items = new bytes[](2);\n        items[0] = abi.encode(SET_DELAY, A, 20_000e18, 12 hours, 100_000e18, uint40(0), uint256(0));\n        items[1] = abi.encode(SET_DELAY, B, 20_000e18, 12 hours, 100_000e18, uint40(0), uint256(0));\n        _propose(abi.encode(BATCH, items));\n        _safe(abi.encodeWithSignature(\"tighten(uint32,uint256,uint256,uint256,uint40)\", A, 5_000e18, 0, type(uint256).max, uint40(0)));\n        _pass(48 hours);\n        vm.expectRevert(ImdBridge.BadPayload.selector);\n        bridge.applyPending();\n    }\n\n    /// C3: RELEASE must be proposed within 24 h of the hold; proposed later, the replay runs first, AS A CLAIM (waits D).\n    function test_C3_releaseLateRunsAsClaim() public {\n        _govern(_launch(A, PEER_A));\n        bytes32 g = keccak256(\"replay\");\n        bytes memory m = _msg(forger, 9_000e18);\n        ep.verify(address(bridge), A, PEER_A, 5, g, m);\n        _hold(A, 5);\n        _pass(24 hours + 1);\n        _propose(abi.encode(RELEASE, A, PEER_A, uint64(5), bytes32(0)));\n        _pass(48 hours - 1); // the hold has ended, the DROP is not yet applicable\n        assertTrue(_try(A, PEER_A, 5, g, m), \"replay runs at the hold's end\");\n        (,,, uint8 st) = bridge.claims(A, _key(A, PEER_A, 5));\n        assertEq(st, 1, \"queued, not minted\");\n        assertEq(tok.balanceOf(forger), 0);\n    }\n\n    /// C4: UNPAUSE applied by anyone at eta + 14 d: every packet stockpiled while paused runs in that block and QUEUES\n    /// (allowance restarts empty), at most the inbound room L; claimable only after D from the reopening.\n    function test_C4_unpauseLateStockpileQueues() public {\n        _govern(_launch(A, PEER_A));\n        _safe(abi.encodeWithSignature(\"pause(uint32)\", A));\n        _pass(3 days);\n        _propose(abi.encode(UNPAUSE, A));\n        for (uint64 n = 1; n <= 30; ++n) ep.verify(address(bridge), A, PEER_A, n, keccak256(abi.encode(n)), _msg(forger, 5_000e18));\n        _pass(48 hours + 14 days);\n        vm.startPrank(stranger);\n        bridge.applyPending();\n        uint256 ran;\n        for (uint64 n = 1; n <= 30; ++n) if (_try(A, PEER_A, n, keccak256(abi.encode(n)), _msg(forger, 5_000e18))) ran++;\n        vm.stopPrank();\n        assertEq(tok.balanceOf(forger), 0, \"nothing mints at once\");\n        assertEq(bridge.queued(), ran * 5_000e18);\n        assertLe(bridge.queued(), 50_000e18, \"bounded by the inbound room L\");\n        (, , uint40 q, uint8 st) = bridge.claims(A, _key(A, PEER_A, 1));\n        emit log_named_uint(\"ran\", ran);\n        emit log_named_uint(\"state\", st);\n        emit log_named_uint(\"queuedAt - now\", vm.getBlockTimestamp() - q);\n        (,, uint256 dd,,) = _bk();\n        emit log_named_uint(\"delay\", dd);\n        _pass(12 hours - 1);\n        emit log_named_uint(\"now - q\", vm.getBlockTimestamp() - q);\n        vm.prank(stranger);\n        (bool ok, bytes memory ret) = address(bridge).call(abi.encodeCall(bridge.claim, (A, _key(A, PEER_A, 1))));\n        emit log_named_bytes(\"ret\", ret);\n        assertFalse(ok, \"claimable before D\");\n    }\n}\n"
 }
}