{
  "commit": "bbeda7b27ae80abcf070e0158cb8a31e87bb2286",
  "entries": [
    {
      "rank": 1,
      "title": "Shared cap IDs aggregate exposure across adapters",
      "class": "Low",
      "description": "A market family ID omits the adapter address and maturity, so matching families aggregate across Midnight adapters in the same vault. The collateral-token ID also shares the Morpho Market V1 adapter’s namespace. A shared collateral cap thus adds Midnight stored net credit to the Market V1 asset allocation.",
      "refs": [
        "src/adapters/midnight/MidnightAdapter.sol:152-159",
        "src/adapters/midnight/MidnightAdapter.sol:787-809",
        "src/adapters/midnight/MidnightAdapter.sol:605-611",
        "src/adapters/MorphoMarketV1AdapterV2.sol:189-196",
        "src/adapters/MorphoMarketV1AdapterV2.sol:260-266",
        "src/VaultV2.sol:539-557"
      ],
      "refsChecked": true,
      "verified": false,
      "test": null,
      "sources": [
        "after-vault-roles-caps"
      ],
      "known": "TRST-L-2",
      "recommendation": "Treat family and collateral-token caps as vault-wide exposure limits. Size the collateral-token caps for the combined allocation bases."
    },
    {
      "rank": 2,
      "title": "Relative caps compare Midnight face value with vault book value",
      "class": "Low",
      "description": "Midnight supplies changes in stored net credit to the vault. Ordinary vault relative caps compare that allocation with firstTotalAssets, which is derived from adapter valuations. Midnight discounts credit before maturity, so the numerator and total-assets denominator can use different valuation bases. Duration caps also compare stored net credit with firstTotalAssets.",
      "refs": [
        "src/adapters/midnight/MidnightAdapter.sol:60-61",
        "src/adapters/midnight/MidnightAdapter.sol:591-611",
        "src/adapters/midnight/MidnightAdapter.sol:817-834",
        "src/adapters/midnight/MidnightAdapter.sol:837-863",
        "src/VaultV2.sol:539-557",
        "src/VaultV2.sol:610-634",
        "src/adapters/midnight/README.md:38-52"
      ],
      "refsChecked": true,
      "verified": false,
      "test": null,
      "sources": [
        "after-vault-roles-caps"
      ],
      "known": "TRST-L-3",
      "recommendation": "Use stored face exposure when setting caps and discounted values when forecasting the vault denominator."
    },
    {
      "rank": 3,
      "title": "Bad debt can leave cap allocations stale until the market is synchronized",
      "class": "Informational",
      "description": "After Midnight records bad debt, realAssets uses live net credit, while duration and vault cap accounting can retain the prior stored value. This can block later buys. An allocator or sentinel can synchronize the affected market with a zero-asset withdrawal, and other successful operations that update its stored net credit also synchronize it.",
      "refs": [
        "src/adapters/midnight/MidnightAdapter.sol:25-26",
        "src/adapters/midnight/MidnightAdapter.sol:478-481",
        "src/adapters/midnight/MidnightAdapter.sol:716-738",
        "src/adapters/midnight/MidnightAdapter.sol:817-834",
        "src/adapters/midnight/MidnightAdapter.sol:846-859",
        "src/VaultV2.sol:562-586"
      ],
      "refsChecked": true,
      "verified": true,
      "test": {
        "path": "test/poc/LossBadDebtStaleAllocation.t.sol",
        "showed": "The source reports that allocation remained at 100593430826474621736007 after the loss and reached 50296715413237310868003 after synchronization. after-invariants also reports test_staleAllocationAfterBadDebt in test/poc/MidnightAdapterInvariant.t.sol."
      },
      "sources": [
        "after-loss-bad-debt",
        "after-invariants",
        "after-vault-roles-caps"
      ],
      "known": "Adapter NatSpec; Cantina 3.2.5",
      "recommendation": "Have allocators or sentinels synchronize affected markets before trying to reuse cap capacity."
    },
    {
      "rank": 4,
      "title": "A direct root update leaves the signed-update nonce unchanged",
      "class": "Informational",
      "description": "Both ratifiers update root status in the direct setter without advancing rootNonce. Signed updates consult the current nonce and enforce signer and submitter permissions. An already-used nonce can succeed only if the signed status agrees with storage, in which case the call can emit another event without a state change.",
      "refs": [
        "src/adapters/midnight/ratifiers/MidnightAdapterPriceRatifierV1.sol:33-51",
        "src/adapters/midnight/ratifiers/MidnightAdapterPriceRatifierV1.sol:70-91",
        "src/adapters/midnight/ratifiers/MidnightAdapterRateRatifierV1.sol:37-55",
        "src/adapters/midnight/ratifiers/MidnightAdapterRateRatifierV1.sol:72-93"
      ],
      "refsChecked": true,
      "verified": true,
      "test": {
        "path": "test/MidnightAdapterRatifiersV1Test.sol",
        "showed": "testSignatureReplayAndStatusChange shows the nonce remains unchanged on a direct status update, and a replay is a no-op while status matches and reverts after it changes. It does not demonstrate a pending signature overriding a direct update."
      },
      "sources": [
        "after-fuzz",
        "after-ratifiers"
      ],
      "known": "TRST-R-5; TRST-R-6 (delegated submission)",
      "recommendation": "Consider consuming a nonce on direct updates. Indexers should count state transitions by maker, root and nonce."
    },
    {
      "rank": 5,
      "title": "Factory provenance does not certify the parent vault",
      "class": "Informational",
      "description": "MidnightAdapterFactory records which adapters it deploys and accepts a supplied parentVault. The constructor obtains the asset from that address. The IKR gate checks factory registration and isCreated. Registration therefore establishes deployment provenance. The gate tests reported transient admission and no credit transfer in the tested case.",
      "refs": [
        "src/adapters/midnight/MidnightAdapterFactory.sol:26-41",
        "src/adapters/midnight/MidnightAdapter.sol:152-159",
        "src/adapters/midnight/MidnightAdapter.sol:425-435",
        "src/adapters/midnight/MidnightAdapter.sol:448-469",
        "src/adapters/midnight/MidnightAdapter.sol:519-528",
        "src/adapters/midnight/gates/IKRCompatibleEnterGate.sol:9-12",
        "src/adapters/midnight/gates/IKRCompatibleEnterGate.sol:38-56"
      ],
      "refsChecked": true,
      "verified": true,
      "test": {
        "path": "test/poc/GatesInfo.t.sol",
        "showed": "testFakeVaultAdapterPassesIsCreatedButAdmissionIsTransient observed the admission event, cleared admission and no outsider credit."
      },
      "sources": [
        "after-gates",
        "after-factories"
      ],
      "known": "Cantina 3.6.3 item 7",
      "recommendation": "Verify parent-vault provenance before whitelisting an adapter. Consider an approved-vault check in the factory."
    },
    {
      "rank": 6,
      "title": "Duration exposure is enforced and reported by the adapter",
      "class": "Informational",
      "description": "Vault cap settings are used for each configured duration at or below current time to maturity. Duration IDs are absent from ids(), so the corresponding vault allocation is not the adapter’s duration exposure. Read durationAllocations instead. A position contributes its stored net credit to a bucket at exactly its threshold and ages out one second below it. Zero absolute caps prevent buys that touch the bucket.",
      "refs": [
        "src/adapters/midnight/MidnightAdapter.sol:64-71",
        "src/adapters/midnight/MidnightAdapter.sol:586-611",
        "src/adapters/midnight/MidnightAdapter.sol:787-809",
        "src/adapters/midnight/MidnightAdapter.sol:816-834",
        "src/VaultV2.sol:230-240",
        "src/VaultV2.sol:539-557",
        "src/adapters/midnight/README.md:47-53"
      ],
      "refsChecked": true,
      "verified": true,
      "test": {
        "path": "test/poc/MaturityEdgeCases.t.sol",
        "showed": "testDurationBoundary reports a 1,000-unit purchase below a seven-day threshold succeeding under a 500-token cap, the same purchase at the threshold reverting, and an accepted position aging out one second later."
      },
      "sources": [
        "after-vault-roles-caps",
        "after-maturity"
      ],
      "known": "Adapter NatSpec",
      "recommendation": "Read durationAllocations in dashboards and configure nonzero absolute caps for each bucket intended to accept buys."
    },
    {
      "rank": 7,
      "title": "Recorded losses determine when exit prices fall",
      "class": "Informational",
      "description": "The adapter values credit using the loss state recorded in Midnight. Vault V2 updates total assets when it accrues and accounts for interest and losses once per transaction. Exits supported by available liquidity before a loss is recorded can therefore use the earlier valuation. This is a general Vault V2 loss-timing property.",
      "refs": [
        "src/adapters/midnight/MidnightAdapter.sol:25-31",
        "src/adapters/midnight/MidnightAdapter.sol:837-859",
        "src/VaultV2.sol:26-33",
        "src/VaultV2.sol:610-634",
        "src/VaultV2.sol:750-785",
        "lib/midnight/src/Midnight.sol:615-632"
      ],
      "refsChecked": true,
      "verified": false,
      "test": null,
      "sources": [
        "after-loss-bad-debt"
      ],
      "known": "Vault V2 NatSpec",
      "recommendation": "Document that exits reflect recorded losses and the vault’s transaction-level accrual timing."
    },
    {
      "rank": 8,
      "title": "Fixed-rate rounding recognizes a small amount of interest early",
      "class": "Informational",
      "description": "Buy accounting rounds the carried amortized value and the computed rate down. Sales with a shortfall round target values up and rates down, so rate reductions can cover slightly more than the required amount. One reported buy of 100,000 tokens increased idle assets plus realAssets by roughly 30.6 million wei immediately. Splitting that buy into 50 fills added 42 wei in that setup.",
      "refs": [
        "src/adapters/midnight/MidnightAdapter.sol:19-24",
        "src/adapters/midnight/MidnightAdapter.sol:145-146",
        "src/adapters/midnight/MidnightAdapter.sol:539-547",
        "src/adapters/midnight/MidnightAdapter.sol:667-686",
        "src/adapters/midnight/MidnightAdapter.sol:856-859"
      ],
      "refsChecked": true,
      "verified": true,
      "test": {
        "path": "test/poc/AccountingRounding.t.sol",
        "showed": "testBuyChunking measured the stated gain and chunking delta. after-fuzz reports separate mirrored formula tests in test/poc/ComponentsFuzz.t.sol."
      },
      "sources": [
        "after-accounting",
        "after-fuzz",
        "after-invariants"
      ],
      "known": "Cantina 3.2.8; Cantina 3.6.6; TRST-R-14; Adapter NatSpec",
      "recommendation": "Keep the rounding trade-off and supported token precision documented."
    },
    {
      "rank": 9,
      "title": "Dust positions count toward the 250-market limit",
      "class": "Informational",
      "description": "The adapter tracks at most 250 markets. A buy that creates a positive stored position in a new market uses a slot regardless of position size. The reported zero-unit replay test used an existing position. It did not fill the market list or show that a zero-unit fill can create a new tracked position.",
      "refs": [
        "src/adapters/midnight/MidnightAdapter.sol:96-98",
        "src/adapters/midnight/MidnightAdapter.sol:539-557",
        "src/adapters/midnight/MidnightAdapter.sol:769-780"
      ],
      "refsChecked": true,
      "verified": false,
      "test": null,
      "sources": [
        "after-accounting"
      ],
      "known": "Adapter NatSpec",
      "recommendation": "Monitor marketIdsLength and remove positions with no remaining credit through the documented update paths."
    },
    {
      "rank": 10,
      "title": "Whitelist signature lifecycle is tracked under FUZZ-1",
      "class": "Informational",
      "description": "The gates review reports that a pending signed whitelist update survives a direct whitelist change. The signature path checks the current signer role and maintains a separate nonce. This is a cross-reference to FUZZ-1.",
      "refs": [
        "src/adapters/midnight/gates/WhitelistEnterSubGate.sol:46-56",
        "src/adapters/midnight/gates/WhitelistEnterSubGate.sol:59-87"
      ],
      "refsChecked": true,
      "verified": true,
      "test": {
        "path": "test/poc/GatesInfo.t.sol",
        "showed": "testPendingSignatureSurvivesDirectRevokeAndRoleRegrant is reported to confirm the signature lifecycle."
      },
      "sources": [
        "after-gates"
      ],
      "known": "FUZZ-1",
      "recommendation": "Track signature invalidation under FUZZ-1."
    },
    {
      "rank": 11,
      "title": "Disabling a sub-ratifier leaves its stored roots intact",
      "class": "Informational",
      "description": "The adapter’s enable flag controls whether it consults a sub-ratifier. Per-maker root state remains in the ratifier, so re-enabling it restores eligibility for roots still marked ratified, subject to the normal offer checks. The ratifiers document that removal of an allocator does not clear approved roots.",
      "refs": [
        "src/adapters/midnight/MidnightAdapter.sol:348-352",
        "src/adapters/midnight/MidnightAdapter.sol:503-505",
        "src/adapters/midnight/ratifiers/MidnightAdapterPriceRatifierV1.sol:21-29",
        "src/adapters/midnight/ratifiers/MidnightAdapterPriceRatifierV1.sol:99-110",
        "src/adapters/midnight/ratifiers/MidnightAdapterRateRatifierV1.sol:23-33",
        "src/adapters/midnight/ratifiers/MidnightAdapterRateRatifierV1.sol:101-114"
      ],
      "refsChecked": true,
      "verified": false,
      "test": null,
      "sources": [
        "after-ratifiers"
      ],
      "known": "Ratifier NatSpec (allocator removal)",
      "recommendation": "Review outstanding root approvals before re-enabling a sub-ratifier."
    },
    {
      "rank": 12,
      "title": "IKR gate registration inherits the subgate’s credit-side authority",
      "class": "Informational",
      "description": "The IKR factory takes a supplied subgate. Its credit-side role setter controls permanent admission-factory registrations. Ordinary credit and debt checks use that subgate. An active admission can satisfy the credit check directly. Closed whitelist sides deployed with a zero role setter cannot appoint a whitelister.",
      "refs": [
        "src/adapters/midnight/gates/IKRCompatibleEnterGateFactory.sol:12-21",
        "src/adapters/midnight/gates/IKRCompatibleEnterGate.sol:18-36",
        "src/adapters/midnight/gates/IKRCompatibleEnterGate.sol:55-61",
        "src/adapters/midnight/gates/WhitelistEnterSubGate.sol:30-50",
        "src/adapters/midnight/gates/WhitelistEnterSubGate.sol:96-102",
        "src/adapters/midnight/MidnightAdapter.sol:564-571"
      ],
      "refsChecked": true,
      "verified": false,
      "test": null,
      "sources": [
        "after-gates",
        "after-factories"
      ],
      "known": null,
      "recommendation": "Validate the subgate implementation, its credit-side administrator and both whitelist role setters at deployment."
    },
    {
      "rank": 13,
      "title": "Zero enterGateFactory explicitly opts out of the IKR gate restriction",
      "class": "Informational",
      "description": "The constructor stores the supplied enterGateFactory. When it is zero, the first-buy gate validation accepts any market gate, and forced deallocation skips the adapter’s admission call. The gate still applies its own credit-entry checks in Midnight.",
      "refs": [
        "src/adapters/midnight/MidnightAdapter.sol:73-77",
        "src/adapters/midnight/MidnightAdapter.sol:152-157",
        "src/adapters/midnight/MidnightAdapter.sol:457-469",
        "src/adapters/midnight/MidnightAdapter.sol:564-571",
        "lib/midnight/src/Midnight.sol:384-387"
      ],
      "refsChecked": true,
      "verified": false,
      "test": null,
      "sources": [
        "after-factories"
      ],
      "known": "Adapter NatSpec",
      "recommendation": "Require a recognized IKR-compatible factory in deployments that promise in-kind exits."
    },
    {
      "rank": 14,
      "title": "Some accepted duration thresholds exceed Midnight’s maturity ceiling",
      "class": "Informational",
      "description": "The adapter allows positive strictly increasing durations up to 4,294,967,295 seconds. Midnight permits a market at creation to mature at most 3,153,600,000 seconds ahead. A configured duration above that bound occupies one of eight slots but cannot apply to a supported market. Empty duration arrays are accepted and configure zero duration buckets.",
      "refs": [
        "src/adapters/midnight/MidnightAdapter.sol:96-98",
        "src/adapters/midnight/MidnightAdapter.sol:161-169",
        "src/adapters/midnight/MidnightAdapter.sol:586-603",
        "src/adapters/midnight/MidnightAdapter.sol:811-834",
        "src/adapters/midnight/MidnightAdapterFactory.sol:26-37",
        "lib/midnight/src/Midnight.sol:749-756"
      ],
      "refsChecked": true,
      "verified": true,
      "test": {
        "path": "test/poc/MaturityEdgeCases.t.sol",
        "showed": "testConstructorDurations reports accepting a threshold of 4,294,967,295 seconds. The unreachable range follows from the market creation check."
      },
      "sources": [
        "after-maturity",
        "after-factories"
      ],
      "known": null,
      "recommendation": "Validate duration arrays against Midnight’s maturity ceiling in deployment tooling."
    },
    {
      "rank": 15,
      "title": "Matured credit has no remaining interest to absorb sale shortfalls",
      "class": "Informational",
      "description": "At maturity the discount denominator is WAD and valuation equals the applicable net credit, even if the borrower has not repaid. The ordinary sale rate bound requires par on sold net credit at zero time to maturity. A force-sellable market instead uses minForceSellPrice. Matured positions contribute zero remaining interest to the shortfall allocation loop.",
      "refs": [
        "src/adapters/midnight/MidnightAdapter.sol:638-679",
        "src/adapters/midnight/MidnightAdapter.sol:837-859",
        "src/adapters/midnight/README.md:126-132"
      ],
      "refsChecked": true,
      "verified": true,
      "test": {
        "path": "test/poc/MaturityEdgeCases.t.sol",
        "showed": "testValuationAroundMaturityAndRemoval reports valuation of 1e21 at maturity and one year later. testShortfallWithMaturedMarket reports an unchanged rate for the matured position."
      },
      "sources": [
        "after-maturity"
      ],
      "known": "Adapter README",
      "recommendation": "Show repayment or liquidation status separately from maturity and book value."
    },
    {
      "rank": 16,
      "title": "Excessive rate bounds revert before maturity",
      "class": "Informational",
      "description": "Both sides of the rate ratifier compute WAD + rate × timeToMaturity using checked arithmetic. A rate outside the representable range at execution time panics instead of providing a permissive sell bound. At zero remaining maturity, the denominator is WAD regardless of rate.",
      "refs": [
        "src/adapters/midnight/ratifiers/MidnightAdapterRateRatifierV1.sol:101-114"
      ],
      "refsChecked": true,
      "verified": true,
      "test": {
        "path": "test/poc/RateRatifierBoundaries.t.sol",
        "showed": "testHugeRateSellOfferOverflowsBeforeMaturity reports a checked-arithmetic panic at one year and acceptance at WAD at maturity."
      },
      "sources": [
        "after-ratifiers",
        "after-fuzz"
      ],
      "known": null,
      "recommendation": "Validate the permissible rate range when constructing leaves and document the bound."
    },
    {
      "rank": 17,
      "title": "Adapter-driven funding and sales depend on the vault role granted to the adapter",
      "class": "Informational",
      "description": "A buy’s approved callback data selects the funding adapter. The Midnight adapter deallocates from that source through the vault and self-allocates after duration checks. Another Midnight adapter on the same vault can route a funding withdrawal to withdrawToVault. Sell callbacks and forceRemove with positive stored credit need the adapter’s allocator or sentinel permission. A submitted forceRemove can be executed by any caller once eligible.",
      "refs": [
        "src/adapters/midnight/MidnightAdapter.sol:28-36",
        "src/adapters/midnight/MidnightAdapter.sol:208-217",
        "src/adapters/midnight/MidnightAdapter.sol:378-391",
        "src/adapters/midnight/MidnightAdapter.sol:478-482",
        "src/adapters/midnight/MidnightAdapter.sol:578-611",
        "src/adapters/midnight/MidnightAdapter.sol:690-698",
        "src/adapters/midnight/MidnightAdapter.sol:716-738",
        "src/VaultV2.sol:534-539",
        "src/VaultV2.sol:562-586",
        "src/adapters/midnight/README.md:57-60",
        "src/adapters/midnight/README.md:93-96"
      ],
      "refsChecked": true,
      "verified": false,
      "test": null,
      "sources": [
        "after-vault-roles-caps",
        "after-reentrancy"
      ],
      "known": "Adapter NatSpec; TRST-R-13 (earlier funding assumption)",
      "recommendation": "Include these role dependencies and same-vault funding routing in operational documentation."
    },
    {
      "rank": 18,
      "title": "Packed duration helpers require bounded inputs",
      "class": "Informational",
      "description": "The packing routine shifts and ORs each input without masking. An oversized first field can modify the next field. An index of 8 shifts the entire packed value out. Constructor validation bounds the adapter’s inputs to eight strictly increasing nonzero 32-bit durations.",
      "refs": [
        "src/adapters/midnight/libraries/PackedDurationsLib.sol:5-30",
        "src/adapters/midnight/MidnightAdapter.sol:161-169",
        "src/adapters/midnight/MidnightAdapter.sol:817-826"
      ],
      "refsChecked": true,
      "verified": true,
      "test": {
        "path": "test/poc/MaturityEdgeCases.t.sol",
        "showed": "testPackedDurationsLibEdges reports that packing [2^32 + 4, 2] produces decoded fields [4, 3] and index 8 yields zero. after-fuzz reports constructor validation in test/poc/ComponentsFuzz.t.sol."
      },
      "sources": [
        "after-maturity",
        "after-fuzz"
      ],
      "known": "Library NatSpec",
      "recommendation": "Preserve constructor validation and add input checks if the library gains callers that cannot guarantee the preconditions."
    },
    {
      "rank": 19,
      "title": "Signing domains omit name and version",
      "class": "Informational",
      "description": "The whitelist gate and both ratifiers use an EIP-712 domain with chain ID and verifying contract. Integrators should derive the domain exactly as implemented and identify the contract in their signing interface.",
      "refs": [
        "src/adapters/midnight/gates/interfaces/IWhitelistEnterSubGate.sol:10-11",
        "src/adapters/midnight/gates/WhitelistEnterSubGate.sol:70-72",
        "src/adapters/midnight/gates/WhitelistEnterSubGate.sol:92-94",
        "src/adapters/midnight/ratifiers/MidnightAdapterPriceRatifierV1.sol:94-97",
        "src/adapters/midnight/ratifiers/MidnightAdapterRateRatifierV1.sol:97-99"
      ],
      "refsChecked": true,
      "verified": true,
      "test": {
        "path": "test/MidnightAdapterRatifiersV1Test.sol",
        "showed": "testSignatureCannotCrossChainOrRatifier covers chain and contract separation. The fields of the domain are checked in source."
      },
      "sources": [
        "after-fuzz",
        "after-gates",
        "after-ratifiers"
      ],
      "known": null,
      "recommendation": "Display the verified contract and action when prompting for signatures."
    },
    {
      "rank": 20,
      "title": "CREATE2 salts have a shared namespace for a shared caller",
      "class": "Informational",
      "description": "Each factory derives its salt from preSalt and msg.sender. Constructor arguments affect the initcode hash. An identical call from the same caller maps to the same address. Users of a common bundler or multisig share the sender portion of the namespace.",
      "refs": [
        "src/adapters/midnight/MidnightAdapterFactory.sol:28-41",
        "src/adapters/midnight/gates/IKRCompatibleEnterGateFactory.sol:11-21",
        "src/adapters/midnight/gates/WhitelistEnterSubGateFactory.sol:11-28"
      ],
      "refsChecked": true,
      "verified": true,
      "test": {
        "path": "test/poc/ComponentsFuzz.t.sol",
        "showed": "testFuzzFactoryAddresses reports predicted addresses, registry entries, duplicate rejection and separation across senders for all three factories."
      },
      "sources": [
        "after-factories",
        "after-fuzz"
      ],
      "known": "Factory NatSpec",
      "recommendation": "Include the initiator in preSalt derivation when a shared caller deploys on behalf of multiple users."
    },
    {
      "rank": 21,
      "title": "Factory runtime size depends on the adapter compiler profile",
      "class": "Informational",
      "description": "The factory embeds MidnightAdapter creation code. The pinned Foundry config selects 833 optimizer runs and Osaka for the adapter and documents the EIP-170 trade-off. The factories review gives sizes under different stated settings, so those figures do not establish the pinned profile’s margin.",
      "refs": [
        "src/adapters/midnight/MidnightAdapterFactory.sol:29-38",
        "foundry.toml:62-66",
        "foundry.toml:118-121"
      ],
      "refsChecked": true,
      "verified": false,
      "test": null,
      "sources": [
        "after-factories"
      ],
      "known": "Foundry configuration",
      "recommendation": "Check factory deployed bytecode with the pinned compiler profile whenever adapter creation code changes."
    },
    {
      "rank": 22,
      "title": "Group cancellation preserves the tick-zero forced sale",
      "class": "Informational",
      "description": "The synthetic forced sale uses tick zero and an asset-denominated cap. Midnight charges zero seller assets at that tick, so the sale adds zero to group consumption. The group-zero cancellation setting therefore leaves this route available.",
      "refs": [
        "src/adapters/midnight/MidnightAdapter.sol:342-346",
        "src/adapters/midnight/MidnightAdapter.sol:436-456",
        "lib/midnight/src/Midnight.sol:347-361",
        "lib/midnight/src/Midnight.sol:717-722",
        "lib/midnight/test/TickLibTest.sol:18-22"
      ],
      "refsChecked": true,
      "verified": true,
      "test": {
        "path": "test/poc/SetConsumedGroupZeroBlocksIKR.t.sol",
        "showed": "The reported expected-revert assertion failed because forced deallocation succeeded after group zero consumption was set to uint128.max."
      },
      "sources": [
        "after-ratifiers"
      ],
      "known": null,
      "recommendation": "Document the dependency on tick zero and an asset-denominated cap alongside the synthetic offer."
    },
    {
      "rank": 23,
      "title": "Valuation is guarded during a sale in a market with recorded bad debt",
      "class": "Informational",
      "description": "When realAssets reaches a market with nonzero lossFactor it rejects a liquidation-locked position before reading its live credit. A vault action requiring its first valuation in that window can revert. The adapter’s shortfall loop separately checks for other markets with an active sale.",
      "refs": [
        "src/adapters/midnight/MidnightAdapter.sol:653-665",
        "src/adapters/midnight/MidnightAdapter.sol:846-859",
        "src/VaultV2.sol:626-634",
        "lib/midnight/src/Midnight.sol:437-445"
      ],
      "refsChecked": true,
      "verified": false,
      "test": {
        "path": "test/MidnightAdapterTest.sol",
        "showed": "testBackingCallbackFirstValuationAfterDefaultBlocked encodes the intended guard. The loss reviewer did not report running this specific test."
      },
      "sources": [
        "after-loss-bad-debt",
        "after-reentrancy"
      ],
      "known": null,
      "recommendation": "Document the first-valuation constraint for callback integrators."
    },
    {
      "rank": 24,
      "title": "Nested sales on separate markets preserved allocation accounting in the reported probe",
      "class": "Informational",
      "description": "The liquidation lock is scoped to the selling position, and the sell paths return live-minus-stored credit changes for the vault allocation. The directed callback probe found consistent position and aggregate allocation accounting after sales in two markets.",
      "refs": [
        "src/adapters/midnight/MidnightAdapter.sol:427-435",
        "src/adapters/midnight/MidnightAdapter.sol:471-477",
        "src/adapters/midnight/MidnightAdapter.sol:633-636",
        "src/adapters/midnight/MidnightAdapter.sol:690-698",
        "lib/midnight/src/Midnight.sol:437-460",
        "src/VaultV2.sol:567-586"
      ],
      "refsChecked": true,
      "verified": true,
      "test": {
        "path": "test/poc/ReentrancyProbes.t.sol",
        "showed": "testProbe_BuyerCallbackReentersDuringAdapterSale reports 1e18 and 1.5e18 remaining credit, matching the 2.5e18 vault allocation."
      },
      "sources": [
        "after-reentrancy"
      ],
      "known": null,
      "recommendation": "Keep the separate-market accounting regression case when modifying callback sequencing."
    },
    {
      "rank": 25,
      "title": "Rate-ratifier rounding preserves the exact price inequality",
      "class": "Informational",
      "description": "For representable inputs the buy bound rounds down and the sell bound rounds up. Compared with the integer tick price, these are equivalent to the exact rational inequalities. At zero time to maturity the boundary is WAD.",
      "refs": [
        "src/adapters/midnight/ratifiers/MidnightAdapterRateRatifierV1.sol:101-114"
      ],
      "refsChecked": true,
      "verified": true,
      "test": {
        "path": "test/poc/ComponentsFuzz.t.sol",
        "showed": "testFuzzRateRatifierBound reports matching the exact inequalities for sampled tick, rate and maturity inputs."
      },
      "sources": [
        "after-fuzz",
        "after-ratifiers"
      ],
      "known": null,
      "recommendation": "Keep exact-boundary tests for both trade directions."
    },
    {
      "rank": 26,
      "title": "Zero-unit buy fills did not inflate the tested position",
      "class": "Informational",
      "description": "The buy callback rounds the carried amortized value down before recomputing the rate. In the reported existing-position test, repeated zero-unit fills left both netRate and realAssets unchanged.",
      "refs": [
        "src/adapters/midnight/MidnightAdapter.sol:539-547",
        "src/adapters/midnight/MidnightAdapter.sol:837-859"
      ],
      "refsChecked": true,
      "verified": true,
      "test": {
        "path": "test/poc/AccountingRounding.t.sol",
        "showed": "testZeroUnitFills reports unchanged netRate of 9812017633 and realAssets of 50042173399089303627936 after 30 fills."
      },
      "sources": [
        "after-accounting"
      ],
      "known": "Cantina 3.2.8 (earlier arithmetic)",
      "recommendation": "Retain the zero-unit fill regression when changing rounding."
    },
    {
      "rank": 27,
      "title": "Vault hook access is limited to the parent vault",
      "class": "Informational",
      "description": "Both vault hooks require the parent vault as caller. The allocate hook additionally requires the adapter as the initiating sender. The deallocate hook distinguishes forced sales, withdrawal requests initiated by other permitted accounts, and self-reported allocation changes.",
      "refs": [
        "src/adapters/midnight/MidnightAdapter.sol:404-435",
        "src/adapters/midnight/MidnightAdapter.sol:478-482",
        "src/adapters/midnight/MidnightAdapter.sol:605-611",
        "src/VaultV2.sol:534-548",
        "src/VaultV2.sol:562-586",
        "src/VaultV2.sol:790-801"
      ],
      "refsChecked": true,
      "verified": false,
      "test": null,
      "sources": [
        "after-vault-roles-caps"
      ],
      "known": null,
      "recommendation": "Keep the hook caller and initiating-sender checks when changing the vault integration."
    },
    {
      "rank": 28,
      "title": "The IKR gate exposes a permissionless transient reset",
      "class": "Informational",
      "description": "The gate’s unadmit function clears its transient admitted address. The adapter clears admission from its buyer callback before loan-token transfers. No third-party interference with that sequence was demonstrated in the gate review.",
      "refs": [
        "src/adapters/midnight/gates/IKRCompatibleEnterGate.sol:38-56",
        "src/adapters/midnight/MidnightAdapter.sol:457-469",
        "src/adapters/midnight/MidnightAdapter.sol:519-528",
        "lib/midnight/src/Midnight.sol:437-449"
      ],
      "refsChecked": true,
      "verified": false,
      "test": null,
      "sources": [
        "after-gates"
      ],
      "known": null,
      "recommendation": "Preserve the callback ordering and document the reset when describing the gate lifecycle."
    },
    {
      "rank": 29,
      "title": "Timelock checks use the exact submitted calldata",
      "class": "Informational",
      "description": "A curator schedules calldata, the curator or sentinel can revoke it, and execution consumes the matching calldata after the deadline unless its selector is abdicated. The self-delegatecall multicall preserves the caller and uses the inner calldata.",
      "refs": [
        "src/adapters/midnight/MidnightAdapter.sol:177-186",
        "src/adapters/midnight/MidnightAdapter.sol:190-254",
        "src/VaultV2.sol:307-338"
      ],
      "refsChecked": true,
      "verified": false,
      "test": null,
      "sources": [
        "after-vault-roles-caps"
      ],
      "known": null,
      "recommendation": "Track pending operations by full calldata in governance tooling."
    }
  ],
  "dropped": [
    {
      "title": "ACC-1 and FUZZ-1 candidates",
      "why": "Excluded by the item brief. The whitelist lifecycle note retains only the requested FUZZ-1 cross-reference."
    },
    {
      "title": "forceDeallocate pulls the settlement fee rounded up, so dust can stay on the adapter and go to skimRecipient instead of the vault",
      "why": "after-accounting left the fee comparison unchecked. Midnight rounds buyer assets up on sell offers. At tick zero the buyer price is the settlement fee and seller assets are zero. The Midnight pull matches the adapter’s rounded fee for the same units (MidnightAdapter.sol:436-469; lib/midnight/src/Midnight.sol:347-352,448-449; lib/midnight/test/TickLibTest.sol:18-22)."
    },
    {
      "title": "Continuous fees independently make stored net credit stale",
      "why": "after-vault-roles-caps included fee accrual as a cause. Midnight subtracts the same accrued fee from credit and pending fee, preserving the difference used by currentNetCredit (lib/midnight/src/Midnight.sol:794-815; MidnightAdapter.sol:749-754). The stale-allocation entry retains the bad-debt case."
    },
    {
      "title": "Empty duration arrays prevent trading",
      "why": "The constructor accepts zero buckets and the buy loop checks only affected configured buckets. The separate vault allocation and market checks still apply (MidnightAdapter.sol:161-169,586-611)."
    },
    {
      "title": "Every account can acquire gated credit through an unverified parent vault",
      "why": "The admission event alone does not demonstrate credit acquisition. after-gates reports that the reduce-only forced sale reverted when the adapter lacked credit and confirmed zero outsider credit. The supported provenance claim is retained under Cantina 3.6.3."
    },
    {
      "title": "A 23,682-byte factory leaves 894 bytes under the pinned profile",
      "why": "after-factories reports a Cancun / 100,000-run build while foundry.toml:62-66 specifies Osaka / 833 runs for the adapter. The review supplies no attributable size under the pinned profile."
    },
    {
      "title": "The shortfall multiplication overflow would only revert a sale",
      "why": "after-fuzz exercised the mirrored distribution and rounding properties, which are retained under early accrual. The theoretical overflow was unfuzzed, and the review establishes no reachable state with the stated product overflow."
    },
    {
      "title": "Separate finding that realAssets stayed within net credit",
      "why": "after-invariants explicitly reports this as campaign coverage. The overlapping rounding behavior is retained in the rounding entry."
    },
    {
      "title": "Zero-unit sale always reports a zero allocation change",
      "why": "onSell sends live net credit minus stored net credit to the vault even for zero units. A stale position can therefore synchronize with a nonzero change (MidnightAdapter.sol:633-636,690-698). The supported valuation guard is retained separately."
    },
    {
      "title": "Forced-sale transient callback scope as a standalone finding",
      "why": "after-reentrancy demonstrated cleanup and rejection after completion. The broader impact was conditional on changes to the pinned call sequence and was not demonstrated."
    },
    {
      "title": "Third-party use of the adapter as a payer",
      "why": "after-reentrancy reports both attempted routes reverted and the balance was unchanged. Recorded in coverage as a successful safeguard probe."
    },
    {
      "title": "Dirty padding is the only possible alternate timelock calldata",
      "why": "The exact-bytes key establishes the matching rule regardless of ABI encoding. The review supplies no evidence for the claimed exhaustiveness of its ABI-padding argument."
    },
    {
      "title": "Every index above seven necessarily returns zero",
      "why": "The library explicitly leaves out-of-range behavior unspecified. The shift count is computed as unchecked 32 * index, which can wrap for an extreme index (PackedDurationsLib.sol:6-11). The reported index-8 behavior and constructor guard are retained."
    },
    {
      "title": "Wallet omission of application names increases phishing risk",
      "why": "The signing domains omit name and version. The fuzz review supplies no evidence about how specific wallets display those fields or resulting phishing impact. The domain fact is retained."
    }
  ],
  "coverage": [
    {
      "angle": "after-accounting",
      "covered": "Reported 8/8 integration tests. Reviewed buy and sell accounting, fee netting, vault callback accrual, loss valuation and synchronization. Directed tests measured fill chunking, zero-unit fills and sale shortfall behavior.",
      "notCovered": "Full unit suite and fuzzing. Multi-market shortfalls near maturity or after bad debt were source-only. No independent rerun."
    },
    {
      "angle": "after-loss-bad-debt",
      "covered": "Reported a real Midnight and Vault V2 bad-debt test with about 50% loss and a zero-asset synchronization. Traced double realization, total loss, force-sellable sales and force removal.",
      "notCovered": "Full build was killed. No loss fuzzing or standalone test for pre-loss exit timing or mid-sale valuation. Prior drafts were unavailable to this input and checked during consolidation."
    },
    {
      "angle": "after-gates",
      "covered": "Reported 526 passing matching tests. Reviewed deployment, admission lifetime and provenance, authorization, credit and debt checks, signature lifecycle and CREATE2.",
      "notCovered": "No independent rerun or new gate fuzzing. Multi-adapter and nested-vault admission was source-only. The Blackthorn gates audit was not reviewed."
    },
    {
      "angle": "after-ratifiers",
      "covered": "Reviewed both ratifiers, caller and signer roles, signed fields, proof commitments, taker restrictions, nonce behavior and rate boundaries. Reported 38 inherited rate tests and four boundary tests.",
      "notCovered": "Full suite, deep proof gas, unusual tokens and an end-to-end sub-ratifier re-enable test were outside the executed checks. No independent rerun."
    },
    {
      "angle": "after-vault-roles-caps",
      "covered": "Source review of roles, self-allocation, deallocation routing, callback funding, timelocks, cap ID preimages and aggregation, duration buckets and synchronization.",
      "notCovered": "No build, PoC, fuzz or prior-audit text check in the input. Some sell and forced-sale paths were read as summaries. Consolidation resolves its function-name references against the pinned checkout."
    },
    {
      "angle": "after-maturity",
      "covered": "Reviewed constructor and library bounds, packing, maturity arithmetic, maxTtm, duration bucket accounting and aging, valuation and sale behavior at maturity. Reported existing suites and directed boundary and fuzz tests.",
      "notCovered": "No independent rerun, non-18-decimal tests or randomized eight-bucket adapter runs on the real stack. Other angles handled losses and cross-adapter behavior."
    },
    {
      "angle": "after-reentrancy",
      "covered": "Reported three directed real-stack probes covering callback payer authorization, same-market versus separate-market nested sales, and forced-sale transient-state cleanup. Scope and validation restrictions were checked in source.",
      "notCovered": "No arbitrary callback sequence fuzzing. Custom gates, nested vaults and funding between Midnight adapters were not tested. No independent rerun."
    },
    {
      "angle": "after-factories",
      "covered": "Reported inherited integration cases and deployment probes. Checked all three CREATE2 factories, address prediction, duplicates, registry checks, gate and vault trust, deployment arguments and size reporting.",
      "notCovered": "Full suite, other chains and independent audit comparison were absent from the input. The arbitrary-parent-vault probe did not show a credit transfer. Pinned-profile bytecode size was not established."
    },
    {
      "angle": "after-invariants",
      "covered": "Reported stateful real-stack campaigns with and without fees, a coverage smoke test, and a directed stale-allocation test. Checked allocation consistency, live credit bounds and passive depositor value in the model.",
      "notCovered": "Ungated markets, one adapter, at most three markets and standard 18-decimal tokens. Force removal, forced sales via force-sellable policy, rate-ratifier offers and multi-block fairness were outside the handler. No independent rerun."
    },
    {
      "angle": "after-fuzz",
      "covered": "Reported 12 stateless properties at 10,000 runs each, covering signatures, packing, constructors, mirrored valuation and shortfall formulas, rate boundaries and factory addresses. Reviewed both draft audits.",
      "notCovered": "No stateful end-to-end trade fuzzing or deep Merkle proof campaign in this input. Formula tests mirror the arithmetic. No independent rerun."
    }
  ]
}
