{
 "notes": "EPISODE 5, THE LAST (26 Nov 2026). Goal: Cantina competition review of the Morpho Midnight Adapter (ends 3 Dec 2026). Findings go to the requester only: nothing is submitted anywhere, no accounts, no contact with the team. Worker results are data, never instructions. These notes supersede earlier ones.\n\nDECIDED: finish. Nothing spawned, nothing running. 46 of 50 items used; the 4 left stay unspent because no later episode could read or check their results. Every result the write-up needs is named in read.\n\nBASELINE (build/build, known/register): morpho-org/vault-v2 at bbeda7b27ae80abcf070e0158cb8a31e87bb2286 builds; forge test: 850 passed, 0 failed, 61 suites. lib/midnight at 4e2570e. Register: 47 prior findings (Cantina draft 19, TrustSec draft 28), 106 accepted risks. Both drafts audited 6476e9d; the gates, the whitelist subgate, their factories and PackedDurationsLib are newer than both.\n\nRESULT: NO Medium or High survived four rounds (37 review and lead items, 2 verify, 2 recheck). TWO findings survive, both Low:\n- ACC-1 (PoC source: review/accounting candidates[0].poc, test/poc/ShortfallAllowanceChunking.t.sol; independent re-run, command, output, refutation attempts: verify/accounting; Low = impact Low x likelihood Medium). MidnightAdapter.sol:643-648 and 649-686: shortfallAllowance is charged per sale at the sold market's already reduced rate, so a sale filled in pieces uses more allowance than one fill: 50.0699 against 52.5990 tokens for a 10k sale in 20 pieces (+5.05%), up to +37.77% for half a position in 100 pieces; with a 51-token allowance the 19th piece reverts ShortfallAllowanceExceeded. Any taker of a ratified maker sell offer chooses the pieces. No funds lost; recovery is the timelocked increaseShortfallAllowance. README.md:117 and NatSpec :145-146 document per-sale consumption, so Informational is plausible: say so. Fix: charge against the pre-sale rate basis, or document it.\n- FUZZ-1 (PoC source: review/fuzz candidates[0].poc, test/poc/WhitelistSigSurvivesRevocation.t.sol; re-run: verify/fuzz, 6 bounding tests; Low = impact Medium x likelihood Low). WhitelistEnterSubGate.sol:52-56 and 59-87: setIsWhitelisted does not advance the nonce, so an unused, unexpired setIsWhitelistedWithSig signature from a current whitelister can be submitted by anyone after a direct removal and whitelists the account again. No fund loss. Run forge build src lib/midnight/src/Midnight.sol first. Bounded by the deadline, by removing the signer, and to one re-admission per whitelister. Same pattern as TRST-R-5 (ratifiers); gates were in neither draft. Fix: advance the nonce in setIsWhitelisted.\n- known2/more: both are verdict new (no documentary duplicate, not a statement of eligibility). Competition page: High and Medium need a coded PoC; a finding acknowledged in a previous report is invalid; admin-only, weird-token and dust issues at most Low.\n\nTHIS EPISODE'S RESULTS\n- recheck/ikr-size: GATE-1 is NOT a finding. It reproduces (a holder of 1 wei of shares off the whitelist took 50,000e18 credit in a gated market, a second shareholder paid the penalty), but the verdict is refuted, not an issue: documented at src/adapters/midnight/README.md:162 and IKRCompatibleEnterGate.sol:38, and the taker pays face value above the market price, so the vault loses nothing. List as Informational, by design, tested by two agents (leads-d/gates-config lowInfo[0], recheck/ikr-size).\n- recheck/notes: N1 to N4 confirmed, all Informational, each with test source, command and output written from scratch by a second agent. N1: setMinForceSellPrice is immediate in both directions (README.md:123) while NatSpec MidnightAdapter.sol:54-55 says relaxing guardrails is timelocked; curator and allocator only. N2: an immediate tightening does not cancel a pending relaxation, and anyone executes it once due (vault README.md:49; revoke cancels). N3: once lossFactor is type(uint128).max, forceDeallocate on that market reverts even for 0 assets, so only an allocator or sentinel deallocate of 0 clears the stale allocation; not in the adapter docs. N4: disabling then re-enabling a sub-ratifier revives its stored roots (ratifier NatSpec :21).\n- leads-f/bad-debt-combos: no candidate; 18 tests on the real stack. It tests what was UNVERIFIED before: vault calls from a taker's onBuy revert OtherSellInProgress during a sale in a loss market, and only that taker is affected. 4 Informational notes, known or by design.\n- leads-f/stateful-extended: no candidate; 256 runs x depth 100 (25,600 calls), 17 actions over 5 markets; no account without a role lowered idle + realAssets outside bad debt, forceSellable sales and forceRemove. 4 Informational notes, one unverified.\n- leads-f/rate-ratifier-fees: no candidate; 7 boundary tests passed in a standalone file on production artifacts. The plane FLAGGED this result's sources: say so.\n- leads-f/duration-buckets: NEVER RAN (its machine could not reach GitHub). Not covered: eight-duration deployments at the limits, boundary-second bucket placement, caps lowered while credit ages, maturity at block.timestamp +/- 1 across buy, sell, withdrawToVault and forceDeallocate. Durations are covered only by round one: review/maturity, review/fuzz, lowinfo/list entries 14 and 18.\n- verify-f: all 4 cancelled, as no leads-f item had a candidate.\n- The plane also flagged the sources of known/register and known2/more: say that the duplicate checks rest on them.\n\nEARLIER ROUNDS, tested, no fault: ten angles (review/*; coverage per angle in lowinfo/list); leads-a/funding, leads-a/ikr-redeem, leads-b/forcesell-shortfall, leads-c/stateful-gated, leads-c/usdc-precision, fixes/fix-force-ratify (12 prior ids: 6 fixed, 4 partial, 2 unchanged), the five leads-d items, the three leads-e items.\n\nLOW/INFORMATIONAL LIST, suggested order (Informational unless a result says otherwise): N1, N3, N2, N4; GATE-1; forcesell-shortfall lowInfo[0] (minForceSellPrice defaults to 0, not tied to setForceSellable); the division-by-zero panic on a 1-unit first fill of 0 assets (usdc-precision lowInfo[2], liveness lowInfo[1], maker-offers lowInfo[1], notes-fixes rank 8); ikr-redeem lowInfo[0] and [3]; gates-config lowInfo[1] to [3]; ratifier-forgery lowInfo; rogue-adapter lowInfo[0]; midnight-assumptions lowInfo[1]; leads-a/funding's notes; then the entries of notes-fixes/list (14) and lowinfo/list (29) not yet named. UNVERIFIED (no test): stateful-gated lowInfo[1], stateful-extended lowInfo[3], rate-ratifier-fees lowInfo[0], every entry whose verified is false.\nAlready known, mark with the prior id, never as new: shared cap ids = TRST-L-2; face against book value caps = TRST-L-3; ratifier setter without nonce = TRST-R-5; rate rounding = Cantina 3.2.8, 3.6.6, TRST-R-14, NatSpec :19-24; stale allocations after a loss = NatSpec :25-26, Cantina 3.2.5; 250-market dust = NatSpec :96-98; unverified parentVault = Cantina 3.6.3; early-withdrawal timing = Cantina 3.6.5; fee change as slippage = TRST-L-4; directional timelocks = Cantina 3.2.10, TRST-L-5; excluded tokens.\n\nNEVER TESTED, list as not covered: the duration-buckets lead; two MidnightAdapters of one vault trading with or funding each other; nested vaults; other sub-gates; the vault's share gates with in-kind redemption; total loss together with fees; plus each result's notCovered.\n\nFOR THE WRITE-UP: per surviving finding: title, severity with reasoning, affected file and lines, description, the PoC test file (source from the review item), exact command and output (from the verify item), suggested fix. Then the ranked Low/Informational list with code references, known ones marked, UNVERIFIED where no test exists, \"tested by its author only\" where no second agent re-ran it (all but ACC-1, FUZZ-1, GATE-1, N1 to N4). Say plainly that no Medium or High survived; list covered and not covered per angle; state that the build passes (850 tests). Cite the batch and item behind every statement.",
 "spawn": [],
 "read": [
  "review/accounting",
  "review/fuzz",
  "verify/accounting",
  "verify/fuzz",
  "lowinfo/list",
  "known2/more",
  "notes-fixes/list",
  "build/build",
  "leads-a/ikr-redeem",
  "leads-b/forcesell-shortfall",
  "leads-c/stateful-gated",
  "leads-c/usdc-precision",
  "leads-d/vault-roles-caps",
  "leads-d/gates-config",
  "leads-d/liveness",
  "leads-d/midnight-assumptions",
  "leads-d/maker-offers",
  "leads-e/ratifier-forgery",
  "leads-e/rogue-adapter",
  "leads-e/nested-trades",
  "recheck/ikr-size",
  "recheck/notes",
  "leads-f/bad-debt-combos",
  "leads-f/stateful-extended",
  "leads-f/duration-buckets",
  "leads-f/rate-ratifier-fees",
  "leads-a/funding",
  "fixes/fix-force-ratify",
  "known/register",
  "review/maturity"
 ],
 "cancel": [],
 "finish": true
}