# Audit report

> AUDIT src/bridge/ImdBridge.sol (gates the one-time SET_BRIDGE), ImdUSD.checkBridge, script/LzPaths.sol, script/launch/BridgeBatch.s.sol.
>
> imdUSD v2 day 1, a CDP stablecoin (README: 'Day 1', known issues). RE-CHECK after wave 5, two internal and one framing review; several routes now. Wave-5 findings: GET https://api.imd.fun/jobs/74838ad4-d315-4e51-a299-0a67060f493e/submissions.
>
> BUILD (required; solc 0.8.38 via_ir; not the whole project): `forge test --match-path 'test/{unit/{AuditW5Bridge*,AuditW5SetBridge,AuditD1Bridge*,AuditW6Bridge*,LzPaths,LzAggregate,ThreePaths},invariant/BridgeInvariants}.t.sol'` (--use solar, then solc). Fork: 'test/fork/{AuditW4BridgeEndpoint,BridgeInboundDelayEndpoint,BasePaths.fork}.t.sol' (mainnet + Base RPC). Say RAN (block, RPC) or NOT RUN per [fork] / [data] claim.
>
> PROPERTIES: per path: instant cap C 10,000/day, delay D 12 h, queue breaker B 100,000 per 4 UTC days, limit L 50,000 per 4-day window each way (<= 100,000 in any 4 days).
> P1 Each chain's supply equation holds and `queued` equals the sum of pending claims after any BATCH; across chains minted <= burned except what compromised DVNs or a deep source reorg force.
> P2 Per path: instant mints in any t <= C + C x t / 1 day, and <= C x t / 1 day in the t after any change that lets a reverted packet run; a held or voided payload queues for D when it runs; nothing queued mints before queuedAt + D; the path trips whenever its window holds more than the CURRENT B; with no human action at most B becomes claimable per window; L x (1 + 4 days / window) <= B, so no traffic inside the limit trips a path.
> P3 A Safe that pauses within D of the first forged Received or Queued, sweeps the endpoint's forged payloads and cancels every forged claim before any reopening loses at most C x (1 + D / 1 day) = 15,000 per path (30,000 into Ethereum); no stranger's transaction makes an incident act or batch revert or land looser than what it names and what stood.
> P4 No honest transfer is lost: a matured claim on an open, untripped path below any cutoff stays claimable by anyone; holds, pauses, trips and delays only wait.
> P5 Instant acts only delay or kill, and nothing proposed before one reopens after it: pause, voidPayload, cancelClaim drop UNPAUSE, UNVOID, UNCANCEL (alone or in a BATCH however encoded); tighten outdates SET_DELAY; tripBreaker trips anew, so a pending RESET_BREAKER names a stale trip; hold is once per nonce. Every opening or loosening waits 48 h.
> P6 A path carries value only while both libraries are pinned with a floor-checked config set by this OApp (3+ required DVNs; confirmations >= 15 from Ethereum, >= 20 others); the launch files set optional NIL and 15 / 9,000 / 18,000; nothing under 10 moves.
> P7 Isolation: every limit, meter, breaker, delay, cutoff, claim, hold, pause, fee and pin is per path; only the supply sums, by-hash voids / unvoids and the ONE pending slot are shared (C7). The launch files link every chain to Ethereum only (the bridge accepts any eid).
> P8 SET_BRIDGE (once) names only a contract using the token's immutable lzEndpoint, this chain's imdUSD, Safe and Treasury; the launch files write exactly this config, each path paused until SET_BRIDGE applied and the sweep is done; adding a remote changes no live path.
>
> THREAT MODEL: compromised DVNs control which packets verify on any path (any split or time, also while closed) and can overwrite a waiting payload; the same three operators sign every path, so losses ADD; anyone runs lzReceive, claims, or applies a matured proposal, in any order against the Safe's acts, within and across blocks; a holder of imdUSD controls in-limit traffic and its timing (UTC-day edges); a compromised Safe (2 of 3) controls the instant acts (ACCEPTED) and, after 48 h, the rest; a source chain can reorg (Base 0.2 s blocks, 4663 ~0.1 s). No guardian. Cheapest coalition: compromised DVNs + a stranger applying a matured proposal + a builder; a holder of ~100,000 imdUSD timing transfers.
>
> PATH: send (burn) -> EndpointV2 / DVNs -> lzReceive (checks, limiter, meter) -> mint or Queued (breaker) -> claim at queuedAt + D -> ImdUSD.mint. READERS: the keeper, per peer: the bridge's events and views (claims, breakers, breakerBuckets, queued, inboundPayloadHash, pending); its `lz` loop compares live pins with its copy of LzChains and its LIMITS mirror, flags a SET_PATH breaking the rule, mirrors 1e12, payloadHashOf, the claim-time delay and cutoff.
>
> CLAIMS TO CHECK:
> C1 lzReceive's reverts (OnlyPeer, PathPaused, PayloadVoided, OnHold, RateLimited) lift ONLY by UNPAUSE, SET_PATH on a set path or SET_DELAY raising C (both empty the allowance), RELEASE, hold expiry or UNVOID (queues for D), or refill. Before SET_BRIDGE claims revert, so an OPEN path's matured claims all pay at SET_BRIDGE (files keep it paused); Unconfigured is unreachable on a set path.
> C2 These are ALL the pending acts that reopen or loosen: UNPAUSE, UNVOID, UNCANCEL, RELEASE, RESET_BREAKER, SET_DELAY, SET_PATH, library and config kinds, BATCHes of them; per P5 each dies at its instant act (a non-word-offset BATCH is dropped whole); SET_PATH, library, config undo none; no nesting, order or encoding hides one.
> C3 No action for 72 h: <= 4C + B = 140,000 per path, 280,000 into Ethereum; over a spoke chain's 50,000 line (accepted).
> C4 Replay: across paths a void is by hash, so a forged path-A replay of an honest path-B packet is held and dropped, never voided: find a state where no Safe act stops it without killing the honest twin.
> C5 [fork] 250,000 gas covers lzReceive (solc worst 198,721 cold, Base pair 195,374, real EndpointV2); raising it is a SET_PATH, which empties the allowance (known).
> C6 [data] Confirmations are block counts: Base 9,000 = 30 min; 4663 18,000 >= 1,786 s at the fastest rate seen vs a 1,476 s worst batch + finality; a faster sequencer or stalled batcher breaks it; floor 20.
> C7 Carried (wave 5): one pending slot per bridge (a tighten fails a multi-path SET_DELAY BATCH); RELEASE needs the slot free within 24 h of its hold; the pre-reopening void sweep is complete per path; _checkPath checks limits only != 0.
> C8 (framing review r1; fixed) In-limit traffic cannot trip a path: at most L + L x t / window passes in any t, so at most 100,000 queues per breaker window. The rule lives in the launch files and keeper, not the contract (SET_PATH, SET_DELAY or tighten can break it). Find an in-limit sequence that trips: UTC-day edges, a mid-window reset, late held / unvoided payloads, a SET_PATH rescaling in-flight.
>
> SOUNDNESS: allowance / breaker 10 (+1 internal, +1 framing), stopping a forgery 9, propose vs apply / BATCH 9 (+1 framing), instant acts 7 (+1 internal, +1 framing), pin / ULN 4 findings: one invariant each for the first four; smallest change (100 B of room). Hub reserve / row room: 4 defects + 1 wrong assumption in 4 of 5 framing reviews (fixed: covered_s). If a path reaches it: one invariant with P1.
>
> PROOF STANDARD: invariant tests over every act and time on TWO live paths, UTC-day edges, several transactions per block; real-EndpointV2 forks.
>
> Answer each (break it or show it holds):
> 1. (P2, P3) Rates, breaker, incident bound.
> 2. (P5) Undoing incident acts.
> 3. (P4) Honest transfers.
> 4. (P7) Isolation.
> 5. (P1, P6, P8) Supply, pins, SET_BRIDGE.
>
> Not findings: README 'Known issues' as written (worse than written IS one); test/, mocks; a PLACEHOLDER's size, unless a property fails at a value governance may set.
>
> Each finding: severity, file:line, call sequence, expected vs actual, reachable at deploy config?, smallest fix, a failing test RUN per BUILD, with output.

| | |
|---|---|
| Repository | https://github.com/imdusd/imdusd-v2-audit.git |
| Commit | `5719b27b9907113575dda2defe82e7ef9d52a877` |
| Job | `dc9419af-5dd4-4980-9a18-bfda2f6dd093` |
| Judged | 2026-12-01 16:45 UTC |
| Findings | 1 medium · 4 low · 2 info |

Four agents audited the code as it is at `5719b27`, each in one area (math, permissions, economics, control flow),
and a judge reproduced, merged and ranked what they found, then read the code once more itself. Nothing in the repository was changed or deployed.

## Findings

### 1. Medium: C8 / P2: in-limit traffic trips a path's queue breaker across a SET_PATH that itself keeps L x (1 + 4 days / window) <= B (a raised limit keeps the old in-flight amount unscaled and admits its headroo

`src/bridge/ImdBridge.sol:1254`

```
        if (limit < l.limit && limit != 0) inFlight = inFlight * limit / l.limit;
```

Answer to question 1 / claim C8 (the one break found; reported by the flow specialist, reproduced by me). _setLimit (lines 1251-1259) rescales what is in flight only when a limit is LOWERED. When a SET_PATH RAISES the inbound limit, the decayed in-flight amount is kept as an absolute figure and the new limit applies at once, so (newLimit - oldLimit) is admitted in the block the proposal applies, on top of everything the OLD limit admitted earlier in the same 4-UTC-day breaker window at the OLD refill rate. The launch rule (README "Known issues", LzPaths.LIMIT note, test/unit/LzPaths.t.sol, the keeper's `lz` check) looks only at the NEW (limit, window) pair. Across the change the real bound on what the limiter admits in one breaker window is L2 + (L1/W1) x s + (L2/W2) x (4 days - s), s = when the change lands inside the window; it exceeds B whenever the old refill rate L1/W1 is above the new one L2/W2, which is exactly a raise of L that stays inside the rule under an unchanged B by lengthening the window. Concrete: path at the launch values (50,000 per 4 days, B 100,000); the Safe proposes SET_PATH 60,000 per 6 days (60,000 x (1 + 4/6) = 100,000 <= B: rule kept, keeper flags nothing, C / D / B untouched). In-limit messages then queue 109,895.72 inside one breaker window and _queue trips the path. Every pending claim on the path, honest ones included, then waits for RESET_BREAKER, accepted only on a PAUSED path and 48 h away, so sends and receipts on that path stop too. No forgery, DVN or Safe key is needed: a holder timing transfers (the brief's holder coalition) or honest users filling the limit do it, and the apply moment is public 48 h ahead. EXPECTED (P2 / C8, README): no traffic inside the limit trips a path; the known issue only excepts a SET_PATH / SET_DELAY / tighten that BREAKS the rule. ACTUAL: a SET_PATH that KEEPS the rule trips it, so this is worse than the known issue as written. REACHABLE AT DEPLOY CONFIG: not without one governance act; it needs a SET_PATH raising a path's limit with a longer window, values governance may set and that the rule test and the keeper both approve. No funds are lost (claims never expire): the harm is a 48 h+ halt of the path and of every honest claim on it, hence medium. SMALLEST FIX (a few bytes, inside the 100 B of room): keep the FRACTION of the window used in both directions, i.e. scale on a raise too: `if (limit != 0 && l.limit != 0 && limit != l.limit) inFlight = inFlight * limit / l.limit;` (a raise then frees room only at the new refill rate; the header's "raising keeps the absolute amount" changes, a design choice to confirm). I checked the lowering direction against the same sum: a lowered inbound limit needs the path paused at propose and at apply and then a separate 48 h UNPAUSE, 96 h in all, which is longer than any breaker window, so it cannot be used the same way. ALTERNATIVE with no bytecode change: state the rule for a transition in LzPaths, its test and the keeper: newL + max(oldL/oldW, newL/newW) x 4 days <= B, or apply such a SET_PATH only on a path that has been paused for 4 UTC days. INVARIANT for the allowance / breaker class: over in-limit messages and every SET_PATH that keeps the rule, on both live paths and at UTC-day edges, breakers(eid).tripped stays false (the four day buckets sum to <= breakerSD).

**Reproduction**

RUN by me (solc 0.8.38, via_ir): `forge test --offline --match-path test/scratch/Proof_a5fe8fde01fa.t.sol` -> `[FAIL: in-limit traffic tripped the path's queue breaker] test_inLimitTrafficTripsAcrossARuleAbidingSetPath() (gas: 910186)`, 0 passed, 1 failed. Sequence: launch-style BATCH (SET_PATH eid 30184, 50,000e18 per 4 days each way, both pins, floor-checked ULN configs) applied; day d 00:00:00 UTC lzReceive 50,000 (queued); day d+1 23:00 the Safe proposes SET_PATH(30184, same peer, 60,000e18, 6 days, 60,000e18, 6 days); day d+3 23:00 lzReceive of availableIn() = 49,479.166666 (queued, not tripped); applyPending() by anyone in that block; lzReceive of availableIn() = 10,000 (queued); day d+3 23:59:59 lzReceive of availableIn() = 416.55. Every message is <= availableIn at its block. Expected breakers(30184).tripped == false (the test asserts the rule before and after the change); actual tripped == true, trips == 1, 109,895.717592 queued in one window against B = 100,000.

**Proof**: a Foundry test that fails on this code and passes once it is fixed.

```solidity
// SPDX-License-Identifier: MIT
pragma solidity 0.8.38;

import "forge-std/Test.sol";
import {ImdBridge, IMintableBurnable, UlnConfig} from "src/bridge/ImdBridge.sol";
import {ILayerZeroEndpointV2} from "layerzero-v2/protocol/interfaces/ILayerZeroEndpointV2.sol";

struct CfgParam {
    uint32 eid;
    uint32 configType;
    bytes config;
}

struct Org {
    uint32 srcEid;
    bytes32 sender;
    uint64 nonce;
}

contract EpMock {
    function eid() external pure returns (uint32) {
        return 30101;
    }

    function setConfig(address, address, CfgParam[] calldata) external {}
    function setSendLibrary(address, uint32, address) external {}
    function setReceiveLibrary(address, uint32, address, uint256) external {}

    function inboundPayloadHash(address, uint32, bytes32, uint64) external pure returns (bytes32) {
        return bytes32(0);
    }
}

contract TokMock {
    mapping(address => uint256) public balanceOf;
    address public bridge;

    function setBridge(address b) external {
        bridge = b;
    }

    function mint(address to, uint256 a) external returns (bool) {
        require(msg.sender == bridge);
        balanceOf[to] += a;
        return true;
    }

    function burn(address from, uint256 a) external returns (bool) {
        require(msg.sender == bridge);
        balanceOf[from] -= a;
        return true;
    }
}

contract Lib {
    function x() external {}
}

/// In-limit traffic trips the queue breaker across a SET_PATH that itself obeys L x (1 + 4 days / window) <= B.
contract RaiseTripsTest is Test {
    uint32 constant BASE = 30184;
    uint256 constant B = 100_000e18;
    address safe = address(0x5AFE);
    bytes32 peer = bytes32(uint256(0xBEEF));
    EpMock ep;
    TokMock tok;
    ImdBridge br;
    address sendLib;
    address recvLib;
    uint64 nonce;

    function setUp() public {
        vm.warp(20_000 days);
        ep = new EpMock();
        tok = new TokMock();
        br = new ImdBridge(ILayerZeroEndpointV2(address(ep)), IMintableBurnable(address(tok)), safe, address(0x7EA));
        tok.setBridge(address(br));
        sendLib = address(new Lib());
        recvLib = address(new Lib());
        address[] memory dvns = new address[](3);
        (dvns[0], dvns[1], dvns[2]) = (address(1), address(2), address(3));
        CfgParam[] memory sp = new CfgParam[](1);
        sp[0] = CfgParam(BASE, 2, abi.encode(UlnConfig(15, 3, 255, 0, dvns, new address[](0))));
        CfgParam[] memory rp = new CfgParam[](1);
        rp[0] = CfgParam(BASE, 2, abi.encode(UlnConfig(9000, 3, 255, 0, dvns, new address[](0))));
        bytes[] memory items = new bytes[](5);
        items[0] = _path(50_000e18, 4 days); // the launch limit: 50,000 per 4 days
        items[1] = abi.encode(uint8(3), BASE, sendLib);
        items[2] = abi.encode(uint8(4), BASE, recvLib, uint256(0));
        items[3] = abi.encode(uint8(2), sendLib, sp);
        items[4] = abi.encode(uint8(2), recvLib, rp);
        _govern(abi.encode(uint8(6), items));
    }

    function _path(uint256 limit, uint256 window) internal view returns (bytes memory) {
        return abi.encode(uint8(1), BASE, peer, limit, window, limit, window, bytes(""));
    }

    function _govern(bytes memory p) internal {
        vm.prank(safe);
        br.propose(p);
        vm.warp(vm.getBlockTimestamp() + 48 hours);
        br.applyPending();
    }

    function _tripped() internal view returns (bool t) {
        (,, t,,,,) = br.breakers(BASE);
    }

    /// @dev Everything the inbound limit admits right now, as one message (refused by the limiter otherwise).
    function _inboundAll() internal returns (uint256 a) {
        a = br.availableIn(BASE) / 1e12 * 1e12;
        if (a < 10e18) return 0;
        bytes memory message = abi.encodePacked(bytes32(uint256(uint160(address(0xB0B)))), uint64(a / 1e12));
        vm.prank(address(ep));
        (bool ok,) = address(br).call(
            abi.encodeWithSignature(
                "lzReceive((uint32,bytes32,uint64),bytes32,bytes,address,bytes)",
                Org(BASE, peer, ++nonce),
                bytes32(uint256(nonce)),
                message,
                address(0),
                bytes("")
            )
        );
        assertTrue(ok, "inside the limit");
    }

    function test_inLimitTrafficTripsAcrossARuleAbidingSetPath() public {
        (uint256 l2, uint256 w2) = (60_000e18, 6 days);
        // both configurations obey the launch rule L x (1 + 4 days / window) <= B
        assertLe(uint256(50_000e18) * (4 days + 4 days) / 4 days, B);
        assertLe(l2 * (w2 + 4 days) / w2, B);

        uint256 day0 = (vm.getBlockTimestamp() / 1 days + 1) * 1 days; // 00:00:00 UTC
        vm.warp(day0);
        uint256 total = _inboundAll(); // 50,000: the whole limit, queued
        // the Safe proposes the raise (public, 48 h); it applies at 23:00 of the window's fourth UTC day
        vm.warp(day0 + 3 days + 23 hours - 48 hours);
        vm.prank(safe);
        br.propose(_path(l2, w2));
        vm.warp(day0 + 3 days + 23 hours);
        total += _inboundAll(); // what refilled at 12,500 a day
        assertFalse(_tripped(), "not tripped before the SET_PATH");
        br.applyPending();
        total += _inboundAll(); // the raise's headroom, at once
        vm.warp(day0 + 4 days - 1);
        total += _inboundAll();
        emit log_named_decimal_uint("queued inside one breaker window, all inside the limit", total, 18);
        assertFalse(_tripped(), "in-limit traffic tripped the path's queue breaker");
    }
}
```

### 2. Low: P3: a stranger's lzReceive reverts the Safe's replay-response batch [hold, pause, propose(RELEASE 0)] whole, pause included: hold is a silent no-op on an executed nonce but RELEASE is refused for a no

`src/bridge/ImdBridge.sol:1001`

```
            if (holds[eid][sender][nonce].until == 0 || h == NIL_PAYLOAD_HASH) revert BadPayload();
```

Merged from two specialists (flow and economics reported the same defect); reproduced by me. The response the header (lines 717-723) and README prescribe for a forged REPLAY of an honest packet (C4: never a void) is a pair that belongs together: hold(srcEid, n), then the timelock's RELEASE of n with hash 0, which must be PROPOSED within 24 h of the hold. The wave-5 review made every instant act land whatever a stranger did first "so the Safe may batch them in one MultiSend" (lines 151-153): hold returns without a revert when the nonce was executed (lines 707-709). But _check for RELEASE reverts BadPayload when holds[eid][sender][nonce].until == 0. Anyone runs EndpointV2.lzReceive, so the forger's coalition (DVNs + a stranger + a builder) executes nonce n one transaction ahead of the Safe: hold then places nothing, propose reverts, and an all-or-nothing Safe MultiSend reverts with it, taking pause and every voidPayload / cancelClaim / tighten / cancel() in the same transaction down. The path stays open until a second 2-of-3 signature round, while the allowance refills at C per day and queued forgeries keep maturing toward D. EXPECTED (P3): no stranger's transaction makes an incident act or batch revert. ACTUAL: the documented hold + RELEASE(0) pair, batched with the other incident acts, reverts whole. No bound of P2 is exceeded by this alone (C, D and B still hold); P3's 15,000 assumes the pause lands within D, and this costs one signature round of it, hence low. REACHABLE AT DEPLOY CONFIG: yes (open path, compromised DVNs verify a replay that fits the allowance or queues). SMALLEST FIX keeping P5 ("no RELEASE can be pending for a hold placed later"): in _check accept RELEASE with hash 0 for a nonce with no hold record when the endpoint stores nothing executable there (it applies as a no-op), or let hold record a spent hold (until = 1, empty hash) on such a nonce; otherwise say in the header, README and the Safe runbook that propose() is not revert-proof and must never share a Safe transaction with pause or any other incident act. INVARIANT for the instant-acts class: for every interleaving of {lzReceive, claim, applyPending} by a stranger before it, the Safe's batch of the documented acts for one incident (hold, pause, voidPayload, cancelClaim, tighten, tripBreaker, cancel and the RELEASE(0) proposal a DROP needs) does not revert.

**Reproduction**

RUN by me: `forge test --offline --match-path test/scratch/Proof_b5aafa5fd40d.t.sol` -> `[FAIL: a stranger's lzReceive reverted the Safe's incident batch: the path is still open] test_strangerExecutingTheReplayRevertsTheSafesDropBatch() (gas: 271958)`, 0 passed, 1 failed. State: path from eid 30184 open at the launch values, instant allowance full; compromised DVNs verify a replay (9,000 imdUSD) at nonce 7. The Safe signs MultiSend [hold(30184, 7), pause(30184), propose(abi.encode(uint8(12), 30184, peer, uint64(7), bytes32(0)))]. A stranger calls lzReceive for nonce 7 first (9,000 minted at once). Then the MultiSend: hold returns (nothing stored), pause runs, propose reverts BadPayload at ImdBridge.sol:1001, the batch reverts. Expected paused(30184) == true; actual false.

**Proof**: a Foundry test that fails on this code and passes once it is fixed.

```solidity
// SPDX-License-Identifier: MIT
pragma solidity 0.8.38;

import "forge-std/Test.sol";
import {ImdBridge, IMintableBurnable, UlnConfig} from "src/bridge/ImdBridge.sol";
import {ILayerZeroEndpointV2} from "layerzero-v2/protocol/interfaces/ILayerZeroEndpointV2.sol";

struct CfgParam {
    uint32 eid;
    uint32 configType;
    bytes config;
}

struct Org {
    uint32 srcEid;
    bytes32 sender;
    uint64 nonce;
}

/// EndpointV2's surface the bridge uses; `stored` is inboundPayloadHash (cleared when a nonce executes).
contract EpMock {
    mapping(uint64 => bytes32) public stored;

    function eid() external pure returns (uint32) {
        return 30101;
    }

    function setConfig(address, address, CfgParam[] calldata) external {}
    function setSendLibrary(address, uint32, address) external {}
    function setReceiveLibrary(address, uint32, address, uint256) external {}

    function verify(uint64 n, bytes32 h) external {
        stored[n] = h;
    }

    function inboundPayloadHash(address, uint32, bytes32, uint64 n) external view returns (bytes32) {
        return stored[n];
    }

    /// EndpointV2.lzReceive: clears the payload, then calls the receiver (permissionless).
    function lzReceive(address receiver, Org calldata o, bytes32 guid, bytes calldata message) external {
        require(stored[o.nonce] == keccak256(abi.encodePacked(guid, message)), "payload");
        stored[o.nonce] = bytes32(0);
        (bool ok,) = receiver.call(
            abi.encodeWithSignature(
                "lzReceive((uint32,bytes32,uint64),bytes32,bytes,address,bytes)", o, guid, message, address(0), bytes("")
            )
        );
        require(ok, "receiver");
    }
}

contract TokMock {
    mapping(address => uint256) public balanceOf;
    address public bridge;

    function setBridge(address b) external {
        bridge = b;
    }

    function mint(address to, uint256 a) external returns (bool) {
        require(msg.sender == bridge);
        balanceOf[to] += a;
        return true;
    }

    function burn(address from, uint256 a) external returns (bool) {
        require(msg.sender == bridge);
        balanceOf[from] -= a;
        return true;
    }
}

contract Lib {
    function x() external {}
}

/// The governor: a Safe executing a MultiSend (all or nothing).
contract SafeMock {
    function multiSend(address to, bytes[] calldata calls) external {
        for (uint256 i; i < calls.length; ++i) {
            (bool ok,) = to.call(calls[i]);
            require(ok, "MultiSend: a call reverted");
        }
    }
}

/// The documented DROP response to a forged replay is hold(nonce) + propose(RELEASE(nonce, 0)). hold is a silent no-op once
/// a stranger has executed the nonce, and RELEASE is refused for a nonce never held, so the stranger's lzReceive reverts
/// the Safe's whole incident MultiSend [hold, pause, propose(RELEASE 0)]: the pause does not land.
contract DropBatchTest is Test {
    uint32 constant BASE = 30184;
    bytes32 peer = bytes32(uint256(0xBEEF));
    EpMock ep;
    TokMock tok;
    ImdBridge br;
    SafeMock safe;

    function setUp() public {
        vm.warp(20_000 days);
        ep = new EpMock();
        tok = new TokMock();
        safe = new SafeMock();
        br = new ImdBridge(ILayerZeroEndpointV2(address(ep)), IMintableBurnable(address(tok)), address(safe), address(0x7EA));
        tok.setBridge(address(br));
        address sendLib = address(new Lib());
        address recvLib = address(new Lib());
        address[] memory dvns = new address[](3);
        (dvns[0], dvns[1], dvns[2]) = (address(1), address(2), address(3));
        CfgParam[] memory sp = new CfgParam[](1);
        sp[0] = CfgParam(BASE, 2, abi.encode(UlnConfig(15, 3, 255, 0, dvns, new address[](0))));
        CfgParam[] memory rp = new CfgParam[](1);
        rp[0] = CfgParam(BASE, 2, abi.encode(UlnConfig(9000, 3, 255, 0, dvns, new address[](0))));
        bytes[] memory items = new bytes[](5);
        items[0] = abi.encode(uint8(1), BASE, peer, uint256(50_000e18), uint256(4 days), uint256(50_000e18), uint256(4 days), bytes(""));
        items[1] = abi.encode(uint8(3), BASE, sendLib);
        items[2] = abi.encode(uint8(4), BASE, recvLib, uint256(0));
        items[3] = abi.encode(uint8(2), sendLib, sp);
        items[4] = abi.encode(uint8(2), recvLib, rp);
        vm.prank(address(safe));
        br.propose(abi.encode(uint8(6), items));
        vm.warp(vm.getBlockTimestamp() + 48 hours);
        br.applyPending();
        vm.warp(vm.getBlockTimestamp() + 2 days); // the instant allowance is full
    }

    function test_strangerExecutingTheReplayRevertsTheSafesDropBatch() public {
        // a forged replay of an honest packet, verified by the compromised DVNs at nonce 7 and waiting at the endpoint
        bytes32 guid = keccak256("an honest packet's guid");
        bytes memory message = abi.encodePacked(bytes32(uint256(uint160(address(0xBAD)))), uint64(9_000e6));
        ep.verify(7, keccak256(abi.encodePacked(guid, message)));

        // the Safe signs the documented response in one MultiSend: hold the nonce, close the path, propose the DROP
        bytes[] memory calls = new bytes[](3);
        calls[0] = abi.encodeWithSignature("hold(uint32,uint64)", BASE, uint64(7));
        calls[1] = abi.encodeWithSignature("pause(uint32)", BASE);
        calls[2] = abi.encodeWithSignature("propose(bytes)", abi.encode(uint8(12), BASE, peer, uint64(7), bytes32(0)));

        // a stranger (the forger) runs the packet first: EndpointV2.lzReceive is permissionless
        vm.prank(address(0xF00D));
        ep.lzReceive(address(br), Org(BASE, peer, 7), guid, message);
        assertEq(tok.balanceOf(address(0xBAD)), 9_000e18, "the forged replay minted at once");

        try safe.multiSend(address(br), calls) {} catch {}
        assertTrue(br.paused(BASE), "a stranger's lzReceive reverted the Safe's incident batch: the path is still open");
    }
}
```

### 3. Low: C4 / P3: the DROP keeps only the FIRST held hash, so a second replay verified over a held or dropped nonce is unblocked by the pending RELEASE 0 and cannot be dropped again: hold is a silent no-op and

`src/bridge/ImdBridge.sol:1175`

```
            (r.payloadHash, r.until) = h == bytes32(0) ? (r.payloadHash, uint64(2)) : (h, uint64(1));
```

Answer to claim C4 (reported by the economics specialist; reproduced, and I found it reachable inside ONE incident). RELEASE with hash 0 writes (r.payloadHash, 2): it keeps the hash bound by the ORIGINAL hold, not the payload the endpoint stores when it applies. hold returns silently on any nonce held before (line 707), and _check accepts a RELEASE on any nonce whose record is non-zero (line 1001). Compromised DVNs can overwrite a stored, unexecuted nonce (threat model). So: the Safe holds nonce n (replay X1 of an honest packet) and proposes RELEASE(n, 0); during the 48 h the DVNs verify a second replay X2 (of ANOTHER honest packet still waiting at its own path) over nonce n. While the hold stands X2 is refused (hash mismatch, line 564); when the DROP of X1 applies (anyone), the record becomes (X1, 2) and X2 becomes executable: the Safe's own pending act unblocks it. The documented response for X2 then does nothing: hold(n) places nothing and emits nothing; RELEASE(n, 0) passes validation at propose and at apply, takes the single pending slot for 48 h, emits HoldReleased(.., 0) and changes nothing; voidPayload(X2) refuses the honest twin (what the DROP exists to avoid). The header's void sweep and BridgeBatch's B3 gate (LAUNCH_SWEEP_DONE) therefore report a completed sweep while X2 is still executable; it runs in the block the path reopens. Because the record is non-zero it queues (never mints at once), consumes the inbound limit, the breaker window and the honest peer's nonce n, and becomes spendable after D unless the Safe notices the Queued and cancels it. EXPECTED (C4 / the header): a forged path-A replay of an honest path-B packet is held and dropped by the documented nonce-scoped act. ACTUAL: at a nonce held once, that act is a silent no-op. The Safe is not left without ANY act, which is why this is low: RELEASE(n, <another non-zero hash>) binds the nonce away from X2 (undocumented, and the next honest message there then needs another 48 h RELEASE), and cancelClaim stops X2 after it has queued (by path-and-nonce GUID, the honest twin untouched). REACHABLE AT DEPLOY CONFIG: yes, on any set path, with compromised DVNs. SMALLEST FIX: make _check refuse RELEASE 0 on a record that is already a DROP (until == 2) so the no-op cannot be proposed and mistaken for a sweep, and document RELEASE(n, non-zero) as the response at a nonce held before; the full fix is a per-nonce set of dropped hashes (hold re-binds a nonce whose record is a DROP after recording the old hash; lzReceive refuses any dropped hash at that nonce), which needs more than the 100 B of room. INVARIANT for the stopping-a-forgery class: for every payload hash the endpoint stores at an unexecuted nonce of a path, some sequence of the DOCUMENTED Safe acts keeps it from ever minting without voiding a hash that equals an honest Sent.

**Reproduction**

RUN by me, two ways. (1) The specialist's proof: `forge test --offline --match-path test/scratch/Proof_977889a38691.t.sol` -> `[FAIL: the replay stored at the dropped nonce ran after hold + RELEASE 0] test_lead1_secondReplayAtADroppedNonceIsNotDropped() (gas: 5949318)`. Two live paths A (30184) and B (30416) at the launch limits; pause(A); DVNs verify at (A, 7) honest B packet #2 (20,000); hold(A, 7); RELEASE(A, peer, 7, 0) applied; DVNs verify over (A, 7) honest B packet #3 (30,000); the Safe repeats hold(A, 7) (no HoldPlaced) and RELEASE(A, peer, 7, 0) (accepted, applied, HoldReleased emitted); UNPAUSE(A) applied; anyone runs lzReceive(A, 7). Expected OnHold; actual: a 30,000 claim queues. (2) My own single-incident sequence (test/scratch, a mock endpoint whose stored hash I set): open path at the launch values; stored hash at nonce 7 = X1; hold(30184, 7); propose RELEASE(30184, peer, 7, 0); stored hash set to X2 during the 48 h; lzReceive(X2) reverts (asserted: refused while the hold stands); applyPending; the Safe's second hold(30184, 7) emits 0 events; second RELEASE 0 proposed and applied; lzReceive(X2) succeeds -> `[FAIL: replay X2 ran at the nonce that was held and dropped twice]`, log `queued after the second DROP: 30000000000000000000000`.

**Proof**: a Foundry test that fails on this code and passes once it is fixed.

```solidity
// SPDX-License-Identifier: MIT
pragma solidity 0.8.38;

import "forge-std/Test.sol";
import {ImdBridge, UlnConfig, Origin, SetConfigParam, ILayerZeroEndpointV2, IMintableBurnable} from "src/bridge/ImdBridge.sol";

/// @dev The part of EndpointV2 the bridge uses: a stored payload hash per (receiver, srcEid, sender, nonce) that the DVNs
/// (anyone here) may write and overwrite until it executes; lzReceive clears it and calls the receiver, atomically.
contract EpMock {
    uint32 public eid = 30101;
    mapping(address => mapping(uint32 => mapping(bytes32 => mapping(uint64 => bytes32)))) public inboundPayloadHash;
    mapping(address => mapping(uint32 => mapping(bytes32 => uint64))) public lazyInboundNonce;
    mapping(address => mapping(uint32 => mapping(bytes32 => mapping(uint64 => bool)))) public executed;

    function inboundNonce(address, uint32, bytes32) external pure returns (uint64) { return 0; }
    function setConfig(address, address, SetConfigParam[] calldata) external {}
    function setSendLibrary(address, uint32, address) external {}
    function setReceiveLibrary(address, uint32, address, uint256) external {}

    function verify(address r, uint32 src, bytes32 sender, uint64 n, bytes32 guid, bytes calldata m) external {
        require(!executed[r][src][sender][n], "executed");
        inboundPayloadHash[r][src][sender][n] = keccak256(abi.encodePacked(guid, m));
    }

    function run(address r, uint32 src, bytes32 sender, uint64 n, bytes32 guid, bytes calldata m) external {
        require(inboundPayloadHash[r][src][sender][n] == keccak256(abi.encodePacked(guid, m)), "not verified");
        delete inboundPayloadHash[r][src][sender][n];
        executed[r][src][sender][n] = true;
        ImdBridge(r).lzReceive(Origin(src, sender, n), guid, m, address(0), "");
    }
}

contract TokMock {
    address public bridge;
    mapping(address => uint256) public balanceOf;
    function setBridge(address b) external { bridge = b; }
    function mint(address to, uint256 a) external returns (bool) { require(msg.sender == bridge, "minter"); balanceOf[to] += a; return true; }
    function burn(address from, uint256 a) external returns (bool) { require(msg.sender == bridge, "minter"); balanceOf[from] -= a; return true; }
}

contract LibMock {}

/// @dev The Safe: one transaction of several calls, all or nothing (MultiSend).
contract SafeMock {
    function batch(address target, bytes[] calldata calls) external {
        for (uint256 i; i < calls.length; ++i) {
            (bool ok, bytes memory ret) = target.call(calls[i]);
            if (!ok) assembly { revert(add(ret, 32), mload(ret)) }
        }
    }
}

contract W6BridgeReDropTest is Test {
    uint32 constant A = 30184; // Base
    uint32 constant B = 30416; // Robinhood
    bytes32 constant PEER_A = bytes32(uint256(0xA11CE));
    bytes32 constant PEER_B = bytes32(uint256(0xB0B));
    EpMock ep;
    TokMock tok;
    SafeMock safe;
    ImdBridge bridge;
    address sendLib;
    address recvLib;

    function setUp() public {
        vm.warp(1_800_000_000);
        ep = new EpMock();
        tok = new TokMock();
        safe = new SafeMock();
        sendLib = address(new LibMock());
        recvLib = address(new LibMock());
        bridge = new ImdBridge(ILayerZeroEndpointV2(address(ep)), IMintableBurnable(address(tok)), address(safe), address(0x7EA));
        tok.setBridge(address(bridge)); // SET_BRIDGE applied
    }

    function _safe(bytes memory call_) internal {
        bytes[] memory c = new bytes[](1);
        c[0] = call_;
        safe.batch(address(bridge), c);
    }

    function _govern(bytes memory payload) internal {
        _safe(abi.encodeWithSignature("propose(bytes)", payload));
        vm.warp(block.timestamp + 48 hours);
        bridge.applyPending(); // anyone
    }

    function _uln(uint64 conf) internal pure returns (bytes memory) {
        address[] memory d = new address[](3);
        (d[0], d[1], d[2]) = (address(1), address(2), address(3));
        return abi.encode(UlnConfig(conf, 3, 255, 0, d, new address[](0)));
    }

    /// @dev The launch BATCH of a path at the launch numbers (50,000 per 4 days each way), NOT paused first.
    function _launch(uint32 eid_, bytes32 peer) internal view returns (bytes memory) {
        bytes[] memory items = new bytes[](5);
        items[0] = abi.encode(uint8(1), eid_, peer, 50_000e18, 4 days, 50_000e18, 4 days, bytes(""));
        items[1] = abi.encode(uint8(3), eid_, sendLib);
        items[2] = abi.encode(uint8(4), eid_, recvLib, uint256(0));
        SetConfigParam[] memory sp = new SetConfigParam[](1);
        sp[0] = SetConfigParam(eid_, 2, _uln(15));
        items[3] = abi.encode(uint8(2), sendLib, sp);
        SetConfigParam[] memory rp = new SetConfigParam[](1);
        rp[0] = SetConfigParam(eid_, 2, _uln(9_000));
        items[4] = abi.encode(uint8(2), recvLib, rp);
        return abi.encode(uint8(6), items);
    }

    function _msg(address to, uint256 amount) internal pure returns (bytes memory) {
        return abi.encodePacked(bytes32(uint256(uint160(to))), uint64(amount / 1e12));
    }

    function _try(uint32 src, bytes32 peer, uint64 n, bytes32 guid, bytes memory m) internal returns (bool ok) {
        (ok,) = address(ep).call(abi.encodeCall(ep.run, (address(bridge), src, peer, n, guid, m)));
    }

    /// LEAD 1 (C4): a nonce that was dropped once cannot be dropped again: `hold` is a no-op and RELEASE with hash 0 keeps
    /// the OLD hash, so the documented replay response lands as nothing and the second replay runs.
    function test_lead1_secondReplayAtADroppedNonceIsNotDropped() public {
        _govern(_launch(A, PEER_A));
        _govern(_launch(B, PEER_B));
        _safe(abi.encodeWithSignature("pause(uint32)", A));
        // two honest path-B packets in flight (their guid and message), the second still waiting at B's nonce 3
        (bytes32 g1, bytes memory m1) = (keccak256("honest B #2"), _msg(address(0xCAFE), 20_000e18));
        (bytes32 g2, bytes memory m2) = (keccak256("honest B #3"), _msg(address(0xCAFE), 30_000e18));
        // the compromised DVNs replay the first on path A at nonce 7: the Safe holds it and drops it (RELEASE, hash 0)
        ep.verify(address(bridge), A, PEER_A, 7, g1, m1);
        _safe(abi.encodeWithSignature("hold(uint32,uint64)", A, uint64(7)));
        _govern(abi.encode(uint8(12), A, PEER_A, uint64(7), bytes32(0)));
        // they replay the second honest packet over the same nonce; its honest twin waits on path B
        ep.verify(address(bridge), A, PEER_A, 7, g2, m2);
        ep.verify(address(bridge), B, PEER_B, 3, g2, m2);
        // the documented response again: hold the nonce, RELEASE it with hash 0 (accepted, applied, HoldReleased emitted)
        _safe(abi.encodeWithSignature("hold(uint32,uint64)", A, uint64(7)));
        _govern(abi.encode(uint8(12), A, PEER_A, uint64(7), bytes32(0)));
        // the sweep is "done": reopen
        _govern(abi.encode(uint8(5), A));
        assertFalse(_try(A, PEER_A, 7, g2, m2), "the replay stored at the dropped nonce ran after hold + RELEASE 0");
        assertEq(bridge.queued(), 0, "a forged claim was queued");
    }
}
```

### 4. Low: P3 / P5 boundary: Breaker.version and Breaker.trips are uint16 with checked increments, so after 65,535 tighten (or trip) acts on a path every later tighten / tripBreaker reverts Panic(0x11) for good,

`src/bridge/ImdBridge.sol:668`

```
        ++b.version;
```

Reported by the math specialist; reproduced by me. tighten bumps b.version (uint16, struct Breaker line 217) with a checked ++b.version, and tripBreaker -> _trip computes `uint16 trip = b.trips + 1` (line 869), also checked. Both counters are per path, never reset, and only grow. At 65,535 the next bump reverts, so on that path: (a) tighten reverts for good: no instant lowering of C, lengthening of D, lowering of B, and no bulk-cancel cutoff ever again; (b) tripBreaker reverts for good, and so does every automatic trip: _queue (line 852) reverts inside lzReceive when a message would take the window over B (the message stays at the endpoint instead of queueing and tripping), and _setDelay (line 1223) reverts when a SET_DELAY lowers B below the window. The header says the opposite (lines 147-153: tighten never reverts on a set path; incident acts never revert) and P5 says instant acts only delay or kill. WHO: only the governor calls tighten / tripBreaker, so no stranger reaches it; an automatic trip needs a 48 h RESET_BREAKER each time, so traffic cannot run the counter up. The threat model ACCEPTS a compromised 2-of-3 Safe controlling the instant acts on the ground that they can only close or delay; this is an instant, unannounced act that is neither: 65,535 no-op tighten(eid, max, 0, max, 0) calls (each changes nothing but the version; about 516M gas in all in the test) permanently remove the fastest incident tools on that path for the honest Safe after the signers are rotated. SET_BRIDGE is one-time, so the bridge cannot be replaced to get them back; what remains is pause and one cancelClaim per forged claim, the per-claim cost the O(1) cutoff was added to avoid, and an incident MultiSend [cancel(), tighten(..), pause(..)] reverts whole. The checked arithmetic is right (a wrap would let a stale SET_DELAY / RESET_BREAKER match again); the fix must keep the counters from repeating. REACHABLE AT DEPLOY CONFIG: yes (no config value is involved), but only by the governor's own 65,535 acts on one path, hence low. SMALLEST FIX (no bytecode growth): widen both counters in struct Breaker, which uses 216 of 256 bits: uint32 trips and uint32 version (248 bits, still one slot; `uint16 trip` in _trip becomes uint32). The breakers(uint32) getter's ABI types change, so the keeper mirror follows. INVARIANT for the instant-acts class: for every set path and reachable state, each of pause, hold, voidPayload, cancelClaim, tripBreaker, tighten(any args) and cancel() from the governor never reverts (fuzz version and trips up to their type max with vm.store).

**Reproduction**

RUN by me: `forge test --offline --match-path test/scratch/Proof_7039488bec4e.t.sol` -> `[FAIL: panic: arithmetic underflow or overflow (0x11)] test_tightenStillLandsAfterManyTightens() (gas: 516216935)` and `[FAIL: panic: arithmetic underflow or overflow (0x11)] test_tripBreakerStillLandsAfterManyTrips() (gas: 227851875)`; 0 passed, 2 failed. State: any path whose delay settings exist. All from the governor: 65,535 x tighten(eid, 10_000e18, 12 hours, 100_000e18, 0) (every argument equal to what stands), then the incident act tighten(eid, 0, 12 hours, 100_000e18, uint40(block.timestamp)). Expected: C = 0 and the cutoff land. Actual: Panic(0x11) at ++b.version. Same with 65,535 x tripBreaker(eid) then tripBreaker(eid): Panic(0x11) in _trip.

**Proof**: a Foundry test that fails on this code and passes once it is fixed.

```solidity
// SPDX-License-Identifier: MIT
pragma solidity 0.8.38;

import {Test} from "forge-std/Test.sol";
import {ImdBridge, IMintableBurnable} from "src/bridge/ImdBridge.sol";
import {ILayerZeroEndpointV2} from "layerzero-v2/protocol/interfaces/ILayerZeroEndpointV2.sol";

contract ScratchEndpoint {
    function eid() external pure returns (uint32) {
        return 30101;
    }
}

contract ScratchToken {
    address public bridge;

    function mint(address, uint256) external pure returns (bool) {
        return true;
    }

    function burn(address, uint256) external pure returns (bool) {
        return true;
    }
}

/// @dev The chain's Safe: the bridge's governor. `repeat` is a MultiSend of the same instant act.
contract ScratchSafe {
    function exec(address target, bytes calldata data) external {
        (bool ok, bytes memory ret) = target.call(data);
        if (!ok) {
            assembly ("memory-safe") {
                revert(add(ret, 32), mload(ret))
            }
        }
    }

    function repeat(address target, bytes calldata data, uint256 n) external {
        for (uint256 i; i < n; ++i) {
            (bool ok,) = target.call(data);
            require(ok, "repeat");
        }
    }
}

/// The header of ImdBridge: "`tighten` never reverts on a set path", "INCIDENT ACTS NEVER REVERT" (`tighten`,
/// `tripBreaker`), and P5 "instant acts only delay or kill". The per-path counters `Breaker.version` and `Breaker.trips`
/// are uint16 and bumped with checked arithmetic by every `tighten` / `tripBreaker`: after 65,535 of either on one path
/// the next one reverts Panic(0x11) for good.
contract CounterOverflowTest is Test {
    uint32 internal constant EID = 30184;
    ImdBridge internal bridge;
    ScratchSafe internal safe;

    function setUp() public {
        vm.warp(1_800_000_000);
        safe = new ScratchSafe();
        bridge = new ImdBridge(
            ILayerZeroEndpointV2(address(new ScratchEndpoint())), IMintableBurnable(address(new ScratchToken())), address(safe), address(0xBEEF)
        );
        // the path's delay settings at the launch values (SET_DELAY, version 0), through the 48 h timelock
        safe.exec(
            address(bridge),
            abi.encodeWithSignature(
                "propose(bytes)", abi.encode(uint8(15), EID, uint256(10_000e18), uint256(12 hours), uint256(100_000e18), uint40(0), uint256(0))
            )
        );
        vm.warp(block.timestamp + 48 hours);
        bridge.applyPending();
    }

    /// 65,535 tightens that change nothing (a compromised 2-of-3 Safe's instant acts are ACCEPTED as "only delay or kill"),
    /// then the Safe's real incident act: C to 0 with a bulk-cancel cutoff. Expected: it lands. Actual: Panic(0x11).
    function test_tightenStillLandsAfterManyTightens() public {
        bytes memory noop = abi.encodeWithSignature(
            "tighten(uint32,uint256,uint256,uint256,uint40)", EID, uint256(10_000e18), uint256(12 hours), uint256(100_000e18), uint40(0)
        );
        for (uint256 i; i < 15; ++i) safe.repeat(address(bridge), noop, 4369); // 15 x 4,369 = 65,535
        (,,,,,, uint16 version) = bridge.breakers(EID);
        assertEq(version, 65_535, "the settings version after 65,535 tightens");
        safe.exec(
            address(bridge),
            abi.encodeWithSignature(
                "tighten(uint32,uint256,uint256,uint256,uint40)", EID, uint256(0), uint256(12 hours), uint256(100_000e18), uint40(block.timestamp)
            )
        );
        (,, uint64 capSD) = bridge.instantIn(EID);
        (,,,,, uint40 cut,) = bridge.breakers(EID);
        assertEq(capSD, 0, "the instant cap landed at 0");
        assertEq(cut, block.timestamp, "the bulk-cancel cutoff landed");
    }

    /// The same for `tripBreaker` (each call is a new trip number): the 65,536th reverts, and so does every later trip on
    /// the path.
    function test_tripBreakerStillLandsAfterManyTrips() public {
        bytes memory trip = abi.encodeWithSignature("tripBreaker(uint32)", EID);
        for (uint256 i; i < 15; ++i) safe.repeat(address(bridge), trip, 4369);
        (, uint16 trips,,,,,) = bridge.breakers(EID);
        assertEq(trips, 65_535, "the trip number after 65,535 trips");
        safe.exec(address(bridge), trip);
    }
}
```

### 5. Low: P2 / C1: UNPAUSE is accepted on a path that was never set and starts its instant meter at cap 0, so the path's first SET_PATH opens it with the FULL instant allowance (C at once) instead of empty

`src/bridge/ImdBridge.sol:1218`

```
        _meter(eid, capSD, capSD > instantIn[eid].capSD && b.delay != 0);
```

Reported by the economics specialist without a proof file; I wrote the test and reproduced it. The rule the header, _meter's comment and BridgeBatch state is that an allowance never starts full ("a meter not started is EMPTY, and it starts empty at the first act or message after acceptance"), and C1 lists the first settings among the openings that start empty. _setDelay leaves a path's first settings to _meter's `lastUpdated == 0` branch and passes empty = false there (`&& b.delay != 0`). But the meter can be STARTED before the first settings: pause(eid) works on an unset path (file B2 itself pauses before the path exists), UNPAUSE's validation only asks paused[eid] (line 1025), and applying UNPAUSE runs _meter(eid, 0, true) (line 1204), which, once the token has accepted the bridge, writes (used 0, lastUpdated now, cap 0). The path's first SET_PATH then takes the b.delay == 0 branch: _setDelay(DEFAULT_INSTANT_CAP) -> _meter(eid, 10,000, false) with lastUpdated != 0, so used stays 0 and availableInstant == C in the block the path is created, on an open (unpaused) path. The first forged packet verified after that block mints 10,000 at once with no Queued, where every other opening gives C x t / 1 day. EXPECTED: availableInstant == 0 at a path's first settings (the control without the UNPAUSE gives 0). ACTUAL: 10,000e18. The bound C + C x t / 1 day still holds and no packet can be verified before the peer exists (allowInitializePath), so what fails is the "starts empty" clause of P2 / C1 and the check BridgeBatch.open() simulates, hence low. NOT reachable through the launch files as written (B2 pauses first, B3's UNPAUSE empties the allowance, open() refuses an unset path): it needs two Safe proposals by hand, e.g. a Safe that undoes B2's pause after cancelling a B2 with a wrong peer and then proposes the path BATCH directly. SMALLEST FIX (shrinks the bytecode): drop `&& b.delay != 0` at line 1218, so a first setting that raises the cap from 0 restarts the allowance empty (a meter not started is unchanged: _meter handles it); and / or refuse UNPAUSE of an eid with no peer in _check.

**Reproduction**

RUN by me (my own test, test/scratch/Mine.t.sol, mock endpoint and token, token already accepting the bridge; `forge test --offline --match-path test/scratch/Mine.t.sol -vv`): Safe pause(30184) on the unset path; propose abi.encode(uint8(5), 30184) (UNPAUSE); anyone applies after 48 h; Safe proposes the launch BATCH [SET_PATH 50,000 / 4 days, SET_DELAY at the launch values, both pins, both ULN configs] with no pause; anyone applies after 48 h; one lzReceive of 10,000 imdUSD at nonce 1 in that block. Expected: it queues (0 minted). Actual: `[FAIL: a path's first settings must start the instant allowance empty: 10000000000000000000000 != 0] test_A_unpauseOfUnsetPathThenFirstSetPathOpensFull()`, log `minted at once in the block the path is created: 10000000000000000000000`. Control without the pause / UNPAUSE: `[PASS] test_A_control_firstSettingsStartEmpty()`.

### 6. Info: After `tighten` the DelaySet event carries the raw arguments, not the cap and breaker that landed (stored values are floored to 1e12), while the header tells the Safe and the keeper to read what lande

`src/bridge/ImdBridge.sol:1224`

```
        emit DelaySet(eid, cap, delay, breaker, cancelFrom);
```

Reported by the math specialist; reproduced by me. _setDelay stores cap / CONVERSION and breaker / CONVERSION (lines 1216, 1219) and then emits DelaySet with the unfloored cap and breaker. SET_DELAY refuses amounts that are not whole multiples of 1e12 (line 1019), but tighten (lines 653-670) has no such check and its clamp is silent, so for tighten the header's instruction (lines 650-652: "read the values that landed back from the DelaySet event") returns a number that did not land. The stored value is the tighter one and the gap is under 1e12 wei (1e-6 imdUSD), so no bound moves; the effect is on the readers: the keeper's LIMITS mirror compares event values with instantIn / breakers x 1e12 and sees a mismatch, and a Safe that reads the event does not read the state. Reachable at deploy config: yes, on any tighten whose cap or breaker argument is not a multiple of 1e12. Smallest fix: emit capSD * CONVERSION and uint256(b.breakerSD) * CONVERSION, or say in the header and the keeper that the reader floors DelaySet amounts to 1e12.

**Reproduction**

RUN by me (test/scratch/Mine.t.sol): path at C 10,000, D 12 h, B 100,000; governor calls tighten(30184, 5_000e18 + 999_999_999_999, 12 hours, 60_000e18 + 999_999_999_999, 0). Expected DelaySet.instantCap == instantIn(30184).capSD * 1e12. Actual: `[FAIL: DelaySet.instantCap is not the cap that landed: 5000000000999999999999 != 5000000000000000000000] test_B_delaySetCarriesWhatLanded()`; logs: event breaker 60000000000999999999999, landed breaker 60000000000000000000000.

### 7. Info: Coverage and answers: questions 1-5 and claims C1-C8, what RAN and what did NOT, and one stale evidence reference (LzPaths cites test/fork/BaseBridge.fork.t.sol, which is not in the tree)

`script/LzPaths.sol:25`

```
    /// real EndpointV2: test/fork/BaseBridge.fork.t.sol (the same EVM execution gas). 250,000 covers all today.
```

SCOPE. Read in full: src/bridge/ImdBridge.sol, src/Governed.sol, ImdUSD.checkBridge / setBridge / mint / burn, script/LzPaths.sol, script/launch/BridgeBatch.s.sol, and the README's bridge known issues. The specialists handed over 9 entries: all 4 attached proofs were run and each fails for the reason its finding gives; the 2 findings that came without a proof file (UNPAUSE of an unset path, the DelaySet event) were reproduced with my own tests; the two reports of the reverting DROP batch are merged into one finding and the two coverage entries into this one. No helpers ran; the twelve specialty guides were used as my own checklist, not as twelve separate passes. NOT covered: the keeper, LaunchBase / SafeBatch, Parameters' SET_BRIDGE plumbing beyond checkBridge, the soundness of the test handlers; the wave-5 submissions URL was not fetched by me (time), so "not a repeat of wave 5" rests on the specialists' statement and the README.
WHAT RAN. BUILD with solc 0.8.38 via_ir: the BUILD command -> 29 suites, 113 tests passed, 0 failed. `--use solar`: NOT RUN (forge 1.8.3 here answers "No compiler version installed that matches the version requirement: =0.8.38"). [fork] C5: RAN, 39 passed, 0 failed, real EndpointV2. test/fork/AuditW4BridgeEndpoint.t.sol (24 passed) and BridgeInboundDelayEndpoint.t.sol (6 passed) at their pinned mainnet block 26,418,627 (MAINNET_RPC_URL, an Ethereum archive RPC): worst lzReceive today 196,524 (5 slots created, 3 updated) against 250,000 enforced; first message after SET_BRIDGE (starts the meter, queues) 157,444; after an expired hold 151,250; cold instant 168,552; queued and tripping 124,943. The brief's "solc worst 198,721" was not reproduced to the unit: I measured 196,524, 53,476 under the limit. The suite's own Glamsterdam estimate is 657,424 > 250,000 (LzPaths says so; raising it is a SET_PATH, known). test/fork/BasePaths.fork.t.sol (9 passed) at the chain heads (it pins no block): Ethereum about 26,536,516, Base about 64,764,081 (BASE_RPC_URL https://mainnet.base.org): worst 195,330 on Base and 195,332 on Ethereum from Base (brief: 195,374). [data] C6: RAN, one sample on 2026-12-01 (head timestamp 1796143187), eth_getBlockByNumber only. Base: 12 consecutive 9,000-block spans back from head 64,764,081 each took exactly 1,800 s; `finalized` trailed the head by 5,232 blocks (1,046 s) < 9,000. 4663: 24 consecutive 18,000-block spans back from head 127,485,343 (about 12.8 h) took 1,799 to 2,032 s, so the fastest seen (1,799 s) is not under the file's 1,786 s and is above its 1,476 s worst batch + finality; `finalized` trailed by 10,230 blocks (1,044 s) < 18,000. Ethereum: 15 blocks = 180 s. C6 holds on this sample; it is a count, so a faster sequencer or a stalled batcher breaks it as the file says, and the contract floor (20) is about 2 s on 4663 and 4 s on Base (known issue).
ANSWERS. 1 (P2, P3): HOLDS at the launch values with two exceptions filed: a rule-abiding SET_PATH raise trips a path with in-limit traffic (medium, C8), and a path's first settings open with a full allowance after an UNPAUSE of the unset path (low, C1). Otherwise: _available floors the decay, so at most L + L x t / window passes in any t; a breaker window spans at most 4 days less 1 s, so in-limit queueing stays under B and a trip needs MORE than B; a mid-window RESET_BREAKER only zeroes buckets; held and unvoided payloads are metered when they run and always queue; UNPAUSE, SET_PATH on a set path and SET_DELAY raising C restart the allowance empty; the trip is checked in _queue and _setDelay against the current B. C3 holds as an upper bound (4C + B = 140,000 per path, 280,000 into Ethereum; at L 50,000 / 4 days the limiter binds first, 87,500 in 72 h). Fencepost, wording only: a claim passes AT queuedAt + D (line 602), so P3's "pauses within D" must read "before". 2 (P5, C2): HOLDS. _names follows the offsets abi.decode follows, a non-word offset is dropped whole, items cannot nest; UNPAUSE, UNVOID, UNCANCEL die at pause, vo

**Reproduction**

`ls test/fork | grep -i base` prints Base.t.sol and BasePaths.fork.t.sol only; test/fork/BaseBridge.fork.t.sol, which this line cites for the Base lzReceive gas (C5), does not exist. Expected: the cited evidence file exists (the Base gas test is test/fork/BasePaths.fork.t.sol). Actual: the path names no file. The rest of this entry records coverage and has no failing input.

---

Judge's submission `73ff9cdc1f6e33f5c05bf3a64d78b10b6972565265e722cd0bb5fe44d28e0295`, accepted on the IdentityMD network. Acceptance means the report met the job's checks;
it is not a guarantee that the code has no other defects.
