{
 "item": "core-liquidation",
 "commit": "ff1c192b3798542997f600091f2dc73ff05e4c40",
 "forge": "forge Version: 1.8.3 (older than 1.9: --use solar unavailable; compiled with the installed solc 0.8.38, via_ir, --match-path test/scratch/CoreLiq.t.sol; every test below RAN and PASSED, FOUNDRY_FUZZ_RUNS=1000, --gas-limit 1e11 for the sweeps)",
 "verdict": "holds",
 "findings": [],
 "claims": [
  {
   "id": "C1",
   "result": "holds",
   "evidence": "Not refuted for any realistic token/feed/sleeve; bound derived and tested. src/Liquidator.sol:137-146 checks gasleft()<g/32 only in the catch. The dangerous route is the SILENT one, where a starved callee is caught INSIDE the bid and standingBid returns zeros without reverting (no g/32 check): src/backstop/PricerOracle.sol:47-52 catches a starved pricer.quote -> nav() fails closed (Backstop.sol:~296-305) -> _convert returns before the matured bucket (Backstop.sol:570-585) -> bidRoom<need -> Liquidator.sol:168 closeBid(ilk,0) -> caller path (Liquidator.sol:149). It cannot be reached because after any starved callee every frame above keeps only 1/64 of what it had when it called (EIP-150), and openBid still has to finish (bidRoom, two balanceOf, four tstore: ~10-15k) and the Liquidator the whole caller path (~400-700k). So a silent fallback needs ONE bid-only read costing more than ~63x the work after it (>~1M gas for the last nav read); a revert-type failure (closeBid's BadPrice on a starved oracle read) is caught by g/32 unless the failing read happens with >1/2 of the self-call's gas left, which it never does because the same Pricer.quote already ran warm in liquidatePosition (both paths pay it). A 10-token sleeve does not help: a starved read in the lastHigh loop or nav leaves 1/64 for the remaining iterations, which then run out of gas -> revert -> BidGasShort. A proxied feed adds depth (the 4.6-9% of the README) but only to reads that the caller path also makes. Test (RAN, PASS): CoreLiqGasTest.test_gasSweep_sleeveOrRevert: sleeve already holds cbBTC (nav reads its price), room needs a matured bucket only openBid converts (asserted bidRoom<need<=bidRoomNow); every gas limit 300k..1.5M in 211-gas steps: 3963 successes, all sleeve, 0 caller-path. Source: /// C1 / C3 / P1: the silent route. A starved read inside the bid that is CAUGHT (PricerOracle.priceOf's try) makes\n/// nav() fail closed, so openBid skips the matured bucket, bidRoom < need, standingBid returns zeros WITHOUT reverting and\n/// bite never reaches the BidGasShort check. Sweep every gas limit: a success must be the sleeve's.\ncontract CoreLiqGasTest is CoreLiqBase {\n    function _scenario() internal returns (uint256 id) {\n        _open(bob, 10e18, 100_000e18);\n        vm.prank(bob);\n        blue.deposit(100_000e18, bob);\n        vm.warp(vm.getBlockTimestamp() + 2 days);\n        btcFeed.set(btcFeed.value());\n        blue.realize(bob);\n        _open(alice, 1e18, 60_000e18);\n        _open(dave, 1e18, 55_000e18);\n        _open(carol, 100e18, 200_000e18);\n        btcFeed.set(85_000e18);\n        vm.prank(carol);\n        liquidator.liquidate(_pid(BTC, alice)); // first bid: the sleeve now HOLDS cbBTC (nav reads its price)\n        assertGt(cbbtc.balanceOf(address(blue)), 0);\n        vm.prank(carol);\n        blue.deposit(100_000e18, carol); // a bucket that only openBid will convert\n        vm.warp(vm.getBlockTimestamp() + 2 days);\n        btcFeed.set(80_000e18); // dave under 150%\n        id = _pid(BTC, dave);\n        uint256 need = ledger.liquidationNeed(id, 80_000e18);\n        assertLt(blue.bidRoom(BTC), need, \"room needs the matured bucket\");\n        assertGe(blue.bidRoomNow(BTC), need, \"with it the sleeve can pay\");\n    }\n\n    function test_gasSweep_sleeveOrRevert() public {\n        uint256 id = _scenario();\n        uint256 wins;\n        uint256 callerPath;\n        uint256 firstCaller;\n        for (uint256 gl = 300_000; gl < 1_500_000; gl += 211) {\n            uint256 snap = vm.snapshotState();\n            uint256 b0 = cbbtc.balanceOf(address(blue));\n            vm.prank(carol);\n            (bool ok,) = address(liquidator).call{gas: gl}(abi.encodeWithSignature(\"liquidate(uint256)\", id));\n            if (ok) {\n                if (cbbtc.balanceOf(address(blue)) > b0) ++wins;\n                else if (callerPath++ == 0) firstCaller = gl;\n            }\n            vm.revertToState(snap);\n        }\n        emit log_named_uint(\"sleeve wins\", wins);\n        emit log_named_uint(\"caller-path successes\", callerPath);\n        emit log_named_uint(\"first caller-path gas limit\", firstCaller);\n        assertGt(wins, 0);\n        assertEq(callerPath, 0, \"a gas limit pushed a sleeve-payable liquidation to the caller\");\n    }\n\n    /// C2: gas per waiting bucket in openBid (buckets accumulate only while conversion waits; one per day).\n    function test_bucketGas() public {\n        uint256 id = _scenario();\n        uint256 g = gasleft();\n        vm.prank(carol);\n        liquidator.liquidate(id);\n        emit log_named_uint(\"liquidate gas with 1 matured bucket\", g - gasleft());\n    }\n}"
  },
  {
   "id": "C2",
   "result": "holds",
   "evidence": "Bounded. Backstop.deposit (Backstop.sol:331-343) and realize (383-385) run _convert before pushing today's bucket, so at most 2 unconverted buckets (yesterday, today) exist while conversion can run; openBid (Backstop.sol:449-455) adds only what is matured beyond that. Buckets beyond 2 accumulate only while _convert WAITS (Backstop.sol:580-581 nav not ok: a held collateral unpriced; or :592 share price too low): then one per day with any deposit, so buckets per openBid <= 2 + days the conversion waited. A 30-day Chainlink stall of a held token -> ~30 buckets (~1.2M extra gas at ~40k each), under a block's limit; while that token is unpriced its own type cannot be bitten (Liquidator.sol:230 NotPriced). Measured (RAN): CoreLiqGasTest.test_bucketGas: liquidate with 1 matured bucket on the sleeve path = 689,682 gas. Not run: a 30-bucket gas measurement."
  },
  {
   "id": "C3",
   "result": "holds",
   "evidence": "Same sweep as C1 (RAN, PASS, 3963/3963 sleeve). A self-call that fails reverts whole (try in Liquidator.sol:138, openBid's tstores are rolled back with it, so the bid is never left open: closeBid clears T_OPEN Backstop.sol:479-482 or the frame reverts); a starved caller is reverted by BidGasShort (Liquidator.sol:145). The caller path prices at the SAME q.low read once in bite (Liquidator.sol:114, 149), so a fallback can never seize at a worse price; the guard minSeized applies on that path (Liquidator.sol:150)."
  },
  {
   "id": "C4",
   "result": "refuted",
   "evidence": "A builder/sequencer cannot seize earlier by delaying the grace-ending poke: while no poke has ended a silence > gap, inGrace() already reads true (src/Pulse.sol:312 `block.timestamp - lastPulse > gap`), and bite pokes before deciding (Liquidator.sol:116, 221-225), so the first seizing transaction itself opens the grace and is held (returns zeros, does not revert, Liquidator.sol:116-119). A delay d moves the grace end to resume+d+grace (later, never earlier). Tests (RAN, PASS, 1000 runs each): CoreLiqPulseTest.testFuzz_builderDelay (silence in (gap,2d], delay 0..6h, then any t: !inGrace => t >= resume+d+grace) and CoreLiqPulseIntTest.testFuzz_grace (real Ledger+Liquidator with Pulse(1h,1h): after any silence > gap every liquidate in the grace returns zeros and keeps the mark; seizure only at >= resume+grace). Not covered (design limit, not this claim): a sequencer that censors borrowers but keeps poking itself never opens a grace; Pulse.sol:259-262 claims only to detect silences."
  },
  {
   "id": "C5",
   "result": "holds",
   "evidence": "cbBTC modelled by the repo's FreezableStable. Treasury blocklisted, marker blocklisted, sleeve blocklisted in all 8 combinations x sleeve funded or not x gas limit 150k..8M (1000 runs, RAN, PASS): every call with >=3M gas settles; after every call (success or revert) Join balance == ilkState collateral + owedToTreasury(join); collateral leaving the Join equals what carol+sleeve+marker+Treasury received (owed stays in the Join). Routes: Treasury cut LedgerSettlement.sol:178 -> LedgerBase.sol:410-416 (catch -> owed); marker chip LedgerSettlement.sol:179,187-192 (refused -> _toTreasury -> owed); a sleeve the token refuses rolls the bid back and the caller pays (Liquidator.sol:138-146). Redemption fee path (LedgerSettlement.sol:98) not re-fuzzed here; it uses the same _toTreasury and is pinned by the repo's test/unit/AuditS12TreasuryOwed.t.sol test_redemption_goesThroughAndHoldsTheFee (not re-run). Source: /// P4 / C5 / C6: any blocklist combination (Treasury, marker, sleeve) and any gas limit: the liquidation settles or\n/// reverts whole; collateral is conserved and the Join holds positions + owed; the Treasury's cut never lands elsewhere.\ncontract CoreLiqOwedTest is CoreLiqBase {\n    function _setUpPos(bool funded) internal returns (uint256 id) {\n        _open(bob, 10e18, 100_000e18);\n        if (funded) {\n            vm.prank(bob);\n            blue.deposit(100_000e18, bob);\n        }\n        vm.warp(vm.getBlockTimestamp() + 2 days);\n        btcFeed.set(btcFeed.value());\n        if (funded) blue.realize(bob);\n        _open(alice, 1e18, 60_000e18);\n        _open(carol, 100e18, 200_000e18);\n        btcFeed.set(85_000e18);\n        id = _pid(BTC, alice);\n    }\n\n    function testFuzz_owedHolds(bool funded, bool fT, bool fM, bool fS, uint256 gl) public {\n        uint256 id = _setUpPos(funded);\n        vm.prank(marker);\n        liquidator.bark(id);\n        if (fT) cbbtc.setFrozen(address(treasury), true);\n        if (fM) cbbtc.setFrozen(marker, true);\n        if (fS) cbbtc.setFrozen(address(blue), true);\n        gl = bound(gl, 150_000, 8_000_000);\n        uint256[5] memory b0 = [cbbtc.balanceOf(join), cbbtc.balanceOf(carol), cbbtc.balanceOf(address(blue)),\n            cbbtc.balanceOf(marker), cbbtc.balanceOf(address(treasury))];\n        uint256 owed0 = ledger.owedToTreasury(join);\n        vm.prank(carol);\n        (bool ok,) = address(liquidator).call{gas: gl}(abi.encodeWithSignature(\"bite(uint256,uint256)\", id, 0));\n        if (gl >= 3_000_000) assertTrue(ok, \"no blocklist makes a liquidation revert\");\n        _custody();\n        if (!ok) return;\n        uint256 out = (cbbtc.balanceOf(carol) - b0[1]) + (cbbtc.balanceOf(address(blue)) - b0[2])\n            + (cbbtc.balanceOf(marker) - b0[3]) + (cbbtc.balanceOf(address(treasury)) - b0[4]);\n        uint256 owedD = ledger.owedToTreasury(join) - owed0;\n        assertEq(b0[0] - cbbtc.balanceOf(join), out, \"conserved: what left the Join reached a party\");\n        if (fT) assertEq(cbbtc.balanceOf(address(treasury)), b0[4], \"a frozen Treasury got nothing\");\n        if (fM) assertEq(cbbtc.balanceOf(marker), b0[3]);\n        if (!fT && !fM) assertEq(owedD, 0, \"nothing held without a refusal (gas starvation of the exits included)\");\n    }\n}"
  },
  {
   "id": "C6",
   "result": "holds",
   "evidence": "CoreLiqStarveTest (RAN, PASS): reference run at full gas gives the Treasury's cut and the marker's chip; then every gas limit 250k..1.4M in 157-gas steps on the caller path and on the sleeve path: every success leaves the Treasury balance and the marker balance exactly at the reference and owedToTreasury == 0, i.e. no gas limit even moves the cut into owed, let alone elsewhere. Reason: after a starved _toTreasury/_exitMarker exit the Ledger frame keeps 1/64, which cannot pay the following join.exit(payer) and the Liquidator's remaining work, so the whole call reverts. The only non-owed fallback is _exitMarker's (chip -> Treasury), which would move value from the marker to the Treasury, never to the caller; the sweep shows it is not reachable by gas choice with cbBTC-like tokens. Source: /// C6: sweep every gas limit on the caller path and the sleeve path: the cut and the chip land exactly where a full-gas run puts them.\ncontract CoreLiqStarveTest is CoreLiqOwedTest {\n    function _sweep(bool funded) internal {\n        uint256 id = _setUpPos(funded);\n        vm.prank(marker);\n        liquidator.bark(id);\n        uint256 snap = vm.snapshotState();\n        vm.prank(carol);\n        liquidator.bite(id, 0);\n        uint256 refT = cbbtc.balanceOf(address(treasury));\n        uint256 refM = cbbtc.balanceOf(marker);\n        assertGt(refT, 0);\n        assertGt(refM, 0);\n        vm.revertToState(snap);\n        uint256 wins;\n        for (uint256 gl = 250_000; gl < 1_400_000; gl += 157) {\n            uint256 s = vm.snapshotState();\n            vm.prank(carol);\n            (bool ok,) = address(liquidator).call{gas: gl}(abi.encodeWithSignature(\"bite(uint256,uint256)\", id, 0));\n            if (ok) {\n                ++wins;\n                assertEq(cbbtc.balanceOf(address(treasury)), refT, \"cut moved\");\n                assertEq(cbbtc.balanceOf(marker), refM, \"chip moved\");\n                assertEq(ledger.owedToTreasury(join), 0, \"starved into owed\");\n            }\n            vm.revertToState(s);\n        }\n        assertGt(wins, 0);\n    }\n\n    function test_starve_callerPath() public { _sweep(false); }\n    function test_starve_sleevePath() public { _sweep(true); }\n}"
  },
  {
   "id": "C7",
   "result": "holds",
   "evidence": "ONE invariant, checked site by site: for every catch-and-continue site S on a liquidation route, EITHER (a) its fallback is outcome-equivalent for every party (value lands in an escrow owed to the same beneficiary), OR (b) after the catch the code reverts when gasleft() <= gasSentToCallee/63 (the callee may have been starved), OR (c) cost(callee) < 63 x gas(rest of the outermost call after S). Sites: Liquidator.sol:138-146 standingBid (b, approximated by g/32); Liquidator.sol:178-179 _cover (pre-check 2M, then best effort, README:1198); LedgerBase.sol:410-416 _toTreasury (a); LedgerSettlement.sol:187-192 _exitMarker (NOT a: chip moves marker->Treasury; holds by c); PricerOracle.sol:47-52 priceOf inside openBid/closeBid (holds by c; closeBid's leads to a revert covered by b); Liquidator.sol:196-201 tick (unpriced -> pauses mark clock; holds by c: _tick's SSTORE after it needs ~22k > 1/64); Pricer.sol:84-88 _depegged staticcall (only borrowable, not on liquidation); Ledger.sol:476 _liqView uses an uncaught pricer.quote (healthy() reverts, never reads a starved quote as unhealthy). Smallest replacement: make (b) exact at every site, i.e. `uint256 g = gasleft(); try X{gas: g - RESERVE}() {} catch { if (gasleft() <= g/63 + RESERVE_USED) revert Starved(); ...}` in standingBid's catch, _exitMarker, _toTreasury and PricerOracle.priceOf, removing the dependence on (c)."
  }
 ],
 "holds": [
  {
   "property": "P1 Anyone liquidates an unhealthy core position in one call while priced; no token, call depth or gas choice forces the caller path while the sleeve can pay",
   "tried": "C1/C3 sweep (3963 gas limits, 211-gas steps, sleeve holding collateral, room needing a matured bucket: 0 caller-path successes); D1-style blocklisted sleeve falls back in the same call (fuzz C5); liquidate() = bark+bite in one call under Pulse after the grace (testFuzz_grace). Read: liquidate (Liquidator.sol:188-192) barks only if unmarked/expired; standing bid gated by q.agree (:128), need from Ledger.liquidationNeed (Ledger.sol:446) identical to liquidatePosition's (LedgerSettlement.sol:135-140, same _liquidationNeed LedgerBase.sol:483). Caveat (not a finding, by design and README:1180 'The standing bid path ignores it'): a token refusing the sleeve sends the liquidation to the caller."
  },
  {
   "property": "P2 The standing bid settles whole or leaves no trace; a healthy position is never seized",
   "tried": "Settles whole: any revert inside standingBid (Liquidator.sol:158-170) undoes openBid/liquidatePosition/closeBid; closeBid checks usd/coll deltas, spent<=room and received*low>=spent (Backstop.sol:484-494). The zero-return branch (room<need) leaves only openBid's sync()/_convert() (stream fold, bucket conversion), which any deposit/realize would do anyway. Healthy never seized: bark and bite both require !healthy at the current quote (Liquidator.sol:95,114,227-233) after the pending harvest (Ledger.sol:455-480, uncaught quote); liquidatePosition only callable by the Liquidator (LedgerSettlement.sol:111). Fuzz C5 (1000 runs) and sweeps exercised both paths; no seizure without a prior unhealthy check."
  },
  {
   "property": "P3 Pulse: only a poke ending a gap > gap opens a grace; nothing ends a grace early; a quiet chain errs toward borrowers",
   "tried": "CoreLiqPulseTest.testFuzz_pulseModel (1000 runs): random gap 1min..1h, grace 1s..6h, 10 steps with dt in [0,3*gap+2] (same block, gap, gap+1 edges), random pokes; asserted graceUntil never decreases, equals a model where only a poke with silence>gap raises it, and inGrace == (t<graceUntil || t-lastPulse>gap). Integration testFuzz_grace on Ledger+Liquidator (held bite returns zeros, keeps the mark, does not revert). Writers of lastPulse/graceUntil: only Pulse.poke (Pulse.sol:297-308), called by the Ledger's accrual, the Liquidator (Liquidator.sol:223) and anyone."
  },
  {
   "property": "P4 No liquidation waits on the Treasury's standing with the collateral's issuer: a refused cut or marker fallback is held as owedToTreasury, never a revert",
   "tried": "testFuzz_owedHolds (1000 runs, all freeze combinations, gas 150k..8M, both paths) and CoreLiqStarveTest sweeps. Writers of owedToTreasury: LedgerBase._toTreasury (LedgerBase.sol:410-416; called from liquidation :178, marker fallback :190, redemption fee :98, harvest LedgerBase.sol:401) and payOwed (LedgerSettlement.sol:199-207: anyone -> all to Treasury; Treasury -> Safe's choice via 48h timelock Treasury.sol:182-191). Readers: Treasury._apply (Treasury.sol:190). README:844 as written ('A call that starves the Treasury transfer of gas also lands the share there (nothing lost)') holds; in practice the sweep shows starvation reverts the whole call instead."
  }
 ],
 "notRun": [
  "No [fork]/[data] claims in this sheet; no fork test run (no RPC used).",
  "Pulse integration on a Base/4663 deploy script config not run; Pulse tested directly and through System with a Pulse override (Liquidator._poke is chain-independent).",
  "10-token sleeve and heavy proxied-feed gas sweeps not built; C1's bound for them is from the EIP-150 reasoning above.",
  "Redemption with Treasury blocklisted not re-run (repo test AuditS12TreasuryOwed covers it).",
  "Integration helper shared by the tests: // SPDX-License-Identifier: MIT\npragma solidity 0.8.38;\n\nimport {IERC20} from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport {System} from \"../utils/System.sol\";\nimport {MockERC20, MockFeed} from \"../utils/Mocks.sol\";\nimport {FreezableStable} from \"../utils/StableKit.sol\";\nimport {Backstop} from \"../../src/backstop/Backstop.sol\";\nimport {ILedgerCover, IBackstopOracle} from \"../../src/backstop/IBackstop.sol\";\nimport {PricerOracle} from \"../../src/backstop/PricerOracle.sol\";\nimport {Adjust} from \"../../src/interfaces/IPositions.sol\";\nimport {_pid} from \"../utils/Pid.sol\";\nimport {Pulse} from \"../../src/Pulse.sol\";\nimport {IPulse as Pulse_} from \"../../src/Ledger.sol\";\n\ncontract CoreLiqBase is System {\n    bytes32 constant BTC = \"CBBTC\";\n    FreezableStable cbbtc;\n    MockFeed btcFeed;\n    PricerOracle oracle;\n    Backstop blue;\n    address alice = makeAddr(\"alice\");\n    address bob = makeAddr(\"bob\");\n    address carol = makeAddr(\"carol\");\n    address dave = makeAddr(\"dave\");\n    address marker = makeAddr(\"marker\");\n    address join;\n\n    function setUp() public virtual {\n        vm.warp(1_800_000_000);\n        cbbtc = new FreezableStable(\"cbBTC\", 18);\n        btcFeed = new MockFeed(100_000e18);\n        _deploySystem(IERC20(address(new MockERC20(\"imdUSDv1\", 18))));\n        _addIlk(BTC, address(cbbtc), btcFeed, btcFeed, address(0), address(0), true, _risk(1.5e18, 10_000_000e18));\n        oracle = new PricerOracle(pricer, address(params));\n        oracle.setIlk(address(cbbtc), BTC);\n        oracle.seal();\n        blue = new Backstop(IERC20(address(usd)), ILedgerCover(address(ledger)), IBackstopOracle(address(oracle)), \"blue\", \"bB\");\n        blue.wire(address(liquidator), address(params));\n        blue.addIlk(BTC, address(cbbtc));\n        blue.seal();\n        params.setGenesisBackstops(address(blue));\n        params.seal();\n        join = params.config(BTC).join;\n        address[4] memory us = [alice, bob, carol, dave];\n        for (uint256 i; i < 4; ++i) {\n            cbbtc.mint(us[i], 1_000e18);\n            vm.startPrank(us[i]);\n            cbbtc.approve(address(ledger), type(uint256).max);\n            usd.approve(address(blue), type(uint256).max);\n            vm.stopPrank();\n        }\n    }\n\n    function _open(address u, uint256 coll, uint256 debt) internal {\n        (uint256 p, uint256 n) = sorted.findInsertPosition(BTC, 0.05e18);\n        vm.prank(u);\n        ledger.open(BTC, 0, Adjust(int256(coll), int256(debt), 0.05e18, p, n, false, type(uint256).max, address(0)));\n    }\n\n    function _custody() internal view {\n        (, uint128 coll,,,) = ledger.ilkState(BTC);\n        assertEq(cbbtc.balanceOf(join), uint256(coll) + ledger.owedToTreasury(join), \"Join = positions + owed\");\n    }\n}\nPulse sources: /// P3 / C4: Pulse model check over random poke schedules (several in a block, consecutive blocks, gap edges).\ncontract CoreLiqPulseTest is CoreLiqBase {\n    function testFuzz_pulseModel(uint256 gap_, uint256 grace_, uint32[10] memory dts, bool[10] memory pokes) public {\n        gap_ = bound(gap_, 1 minutes, 1 hours);\n        grace_ = bound(grace_, 1, 6 hours);\n        Pulse p = new Pulse(gap_, grace_);\n        uint256 last = vm.getBlockTimestamp();\n        uint256 until;\n        for (uint256 i; i < 10; ++i) {\n            uint256 dt = uint256(dts[i]) % (3 * gap_ + 3); // includes 0 (same block), gap, gap + 1\n            vm.warp(vm.getBlockTimestamp() + dt);\n            uint256 gu0 = p.graceUntil();\n            if (pokes[i]) {\n                p.poke();\n                if (vm.getBlockTimestamp() != last) {\n                    if (vm.getBlockTimestamp() - last > gap_ && vm.getBlockTimestamp() + grace_ > until) until = vm.getBlockTimestamp() + grace_;\n                    last = vm.getBlockTimestamp();\n                }\n            }\n            assertGe(p.graceUntil(), gu0, \"nothing ends a grace early\");\n            assertEq(p.graceUntil(), until, \"only a poke ending a gap > gap opens a grace\");\n            bool g = p.inGrace();\n            assertEq(g, vm.getBlockTimestamp() < until || vm.getBlockTimestamp() - last > gap_);\n            // seizing allowed now => no silence > gap ended within the last `grace`, and none is pending\n            if (!g) assertTrue(vm.getBlockTimestamp() - last <= gap_ && vm.getBlockTimestamp() >= until);\n        }\n    }\n\n    /// C4: a builder delaying the grace-ending poke by d cannot seize before silenceEnd + grace (seize >= firstPoke + grace).\n    function testFuzz_builderDelay(uint256 silence, uint256 d, uint256 t) public {\n        Pulse p = new Pulse(10 minutes, 1 hours);\n        silence = bound(silence, 10 minutes + 1, 2 days);\n        d = bound(d, 0, 6 hours);\n        vm.warp(vm.getBlockTimestamp() + silence); // the chain resumes here; the builder keeps every poke out for d\n        uint256 resume = vm.getBlockTimestamp();\n        assertTrue(p.inGrace(), \"a pending gap already holds seizure\");\n        vm.warp(resume + d);\n        p.poke(); // the first poke that lands\n        t = bound(t, 0, 3 hours);\n        vm.warp(resume + d + t);\n        p.poke();\n        if (!p.inGrace()) assertGe(vm.getBlockTimestamp(), resume + d + 1 hours);\n    }\n}\n/// P1 / P3 on a Pulse chain (4663; Base suites use the same Liquidator._poke): the first liquidation after a silence is\n/// held (zeros, mark kept, no revert), every liquidation inside the grace is held, and it seizes once the grace has run.\ncontract CoreLiqPulseIntTest is CoreLiqBase {\n    Pulse pz;\n\n    function _pulse() internal override returns (Pulse_ p) {\n        pz = new Pulse(1 hours, 1 hours);\n        p = Pulse_(address(pz));\n    }\n\n    function _keep(uint256 dt) internal {\n        uint256 end = vm.getBlockTimestamp() + dt;\n        while (vm.getBlockTimestamp() < end) {\n            vm.warp(vm.getBlockTimestamp() + 30 minutes);\n            pz.poke();\n        }\n        btcFeed.set(btcFeed.value());\n    }\n\n    function testFuzz_grace(uint256 silence, uint256 tries) public {\n        _open(bob, 10e18, 100_000e18);\n        _keep(2 hours);\n        _open(alice, 1e18, 60_000e18);\n        _open(carol, 100e18, 200_000e18);\n        uint256 id = _pid(BTC, alice);\n        _keep(2 hours); // any grace the set-up's warps opened has run, the keeper pokes every 5 min\n        silence = bound(silence, 1, 3 hours);\n        // the keeper's last poke was at most 0 s ago; the silence starts now\n        vm.warp(vm.getBlockTimestamp() + silence);\n        btcFeed.set(85_000e18);\n        uint256 resume = vm.getBlockTimestamp();\n        tries = bound(tries, 1, 8);\n        bool seized;\n        for (uint256 i; i < tries && !seized; ++i) {\n            vm.prank(carol);\n            (uint256 r,,) = liquidator.liquidate(id);\n            if (r != 0) {\n                seized = true;\n                if (silence > 1 hours) assertGe(vm.getBlockTimestamp(), resume + 1 hours, \"seized inside the grace\");\n            } else {\n                (uint64 at,) = liquidator.marks(id);\n                assertGt(at, 0, \"held: the mark is kept\");\n                assertTrue(silence > 1 hours, \"held without a silence\");\n            }\n            _keep(30 minutes);\n        }\n        if (silence <= 1 hours) assertTrue(seized, \"no silence: seized at once\");\n    }\n}"
 ]
}