{"commit":"bbeda7b27ae80abcf070e0158cb8a31e87bb2286","referenceNotes":{"pages":"One-based PDF page numbers; printed page = PDF page minus one in both drafts.","paths":"Paths are relative to vault-v2; lib/midnight is pinned at 4e2570e51171d09228645b2d5bdf84ef24b1720b; comma-separated ranges share the preceding path.","auditedCommit":"6476e9d91245b0934377ef09edd201f6bf0e46ec","reports":{"cantina":"audits/2026-10-12-midnight-adapter-cantina-draft.pdf","trustsec":"audits/2026-10-12-midnight-adapter-trustsec-draft.pdf"},"comparison":"Present means the reported mechanism remains, not byte identity; changed includes partial changes and never certifies a fix.","coverage":"Read all 20 Cantina and 27 TrustSec pages, the requested READMEs and adapter NatSpec, Midnight core/ratifier documentation, periphery and verification READMEs, and the linked 11-page May 2026 whitepaper (external, not commit-pinned).","counts":"Count numbered entries once, including grouped notes; Cantina 3.3 and 3.4 continue 3.2.11; TrustSec recommendations and PR/CR/SR entries have no assigned severity.","risks":"Team-documented statements, not a blanket exclusion of every related bug; auditor opinions are kept in priorFindings, not promoted to team acceptance."},"priorFindings":[{"source":"cantina","id":"3.1.1","title":"Blended-rate updates hide allocator-controlled round-trip losses from redeeming shareholders","severity":"Medium","page":"5-7","contract":"MidnightAdapter","function":"onBuy; onSell; take","summary":"Allocator-controlled buy/sell prices can capitalize a round-trip cash loss into remaining credit by lowering its accounting rate. A coordinated shareholder can redeem before reduced future earnings appear in share value, shifting the loss to continuing holders and potentially paying the spread to a controlled counterparty.","codeNow":"changed","codeRef":"src/adapters/midnight/MidnightAdapter.sol:535-547,638-685","codeNote":"Individual buy/sell rate checks and an allowance replace old controls; blending remains and shortfalls now span markets."},{"source":"cantina","id":"3.2.1","title":"Batch revokes might fail due to race conditions","severity":"Low","page":"7","contract":"MidnightAdapter","function":"revoke","summary":"revoke rejects an action that is no longer pending, including after another sentinel revokes it first. A competing revocation therefore makes an entire batch revert and delays cancellation of the other actions.","codeNow":"present","codeRef":"src/adapters/midnight/MidnightAdapter.sol:219-225"},{"source":"cantina","id":"3.2.2","title":"isRatified does not bind ratification to the configured Midnight","severity":"Low","page":"7-8","contract":"MidnightAdapter","function":"isRatified","summary":"Ratification did not bind either the caller or offer.market.midnight to the immutable Midnight, despite checking that instance for liquidation state. External consumers could obtain approval for an offer in a different execution domain.","codeNow":"changed","codeRef":"src/adapters/midnight/MidnightAdapter.sol:488-505","codeNote":"Normal calls now check offer.market.midnight, not msg.sender; the force-deallocation bypass precedes this check."},{"source":"cantina","id":"3.2.3","title":"Midnight adapter duration caps omit the positive absolute cap check","severity":"Low","page":"8","contract":"MidnightAdapter","function":"onBuy; durationAllocations","summary":"Duration cap validation checked allocation <= cap without requiring a positive absolute cap. A zero-exposure buy could pass with an unset or disabled cap, although positive exposure could not.","codeNow":"changed","codeRef":"src/adapters/midnight/MidnightAdapter.sol:591-602","codeNote":"An explicit absoluteCap > 0 check now precedes the duration absolute and relative checks."},{"source":"cantina","id":"3.2.4","title":"Pending force-sale authorization allows an allocator to enlarge the position before selling it at zero price","severity":"Low","page":"8-9","contract":"MidnightAdapter","function":"submit; setForceSellable; onBuy; onSell","summary":"Submitting force-sale authorization recorded only an execution time and did not freeze the position size or prevent subsequent purchases. An allocator could add exposure during the delay and then sell the enlarged position at zero under the relaxed loss checks.","codeNow":"changed","codeRef":"src/adapters/midnight/MidnightAdapter.sol:272-276,529-537,638-642","codeNote":"Pending buys remain possible; NatSpec recommends zero caps and force sales now enforce minForceSellPrice."},{"source":"cantina","id":"3.2.5","title":"onBuy might revert due to stale allocation checks","severity":"Low","page":"9","contract":"MidnightAdapter","function":"onBuy; durationAllocations","summary":"Duration allocations use stored net credit, which can exceed live credit after bad debt. Purchases near a cap can revert even when refreshed exposure would fit.","codeNow":"present","codeRef":"src/adapters/midnight/MidnightAdapter.sol:64-70,591-602,816-833"},{"source":"cantina","id":"3.2.6","title":"Mid-flight MidnightAdapter break allocation cap invariants","severity":"Low","page":"9-10","contract":"MidnightAdapter","function":"onBuy","summary":"Midnight enters the new credit position before the adapter deallocates its funding and checks caps. Gross exposure can transiently exceed a cap even when the final funded allocation passes.","codeNow":"present","codeRef":"src/adapters/midnight/MidnightAdapter.sol:539-562,578-611"},{"source":"cantina","id":"3.2.7","title":"Exiting a distressed market relaxes face-value protection for healthy markets","severity":"Low","page":"10","contract":"MidnightAdapter","function":"onSell; setNoSalesBelowFaceValue (former)","summary":"The global noSalesBelowFaceValue flag had to be disabled to sell a distressed market below face value, even with its forceSellable flag. That also let allocators sacrifice future proceeds in otherwise healthy markets.","codeNow":"changed","codeRef":"src/adapters/midnight/MidnightAdapter.sol:334-337,638-648","codeNote":"Global flags were replaced by ordinary rate/allowance checks and a per-market force-sale floor."},{"source":"cantina","id":"3.2.8","title":"Repeated buy callbacks lower the rate through rounding and accelerate yield recognition","severity":"Low","page":"10-11","contract":"MidnightAdapter","function":"onBuy; realAssets","summary":"Zero-unit or negligible buys recomputed the entire position using a carried-value ceiling and rate floor. Repetition could lower the stored rate and advance future yield to current holders, subject to vault snapshots, maxRate, fees and exit liquidity.","codeNow":"changed","codeRef":"src/adapters/midnight/MidnightAdapter.sol:19-24,539-547,836-859","codeNote":"Carried value now rounds down; rate flooring and documented early-accrual/token limits remain."},{"source":"cantina","id":"3.2.9","title":"Root ratifiers can approve offers naming another ratifier","severity":"Low","page":"11-12","contract":"MidnightAdapter","function":"isRatified","summary":"The adapter root ratifier did not require offer.ratifier to equal itself. Direct external consumers could mistake its approval for approval from the named root, although Midnight dispatches to the designated ratifier.","codeNow":"present","codeRef":"src/adapters/midnight/MidnightAdapter.sol:488-505","details":["The draft also names Midnight SetterRatifier, EcrecoverRatifier, PriceRatifierV1 and RateRatifierV1 when used as roots; codeNow here locates the in-scope adapter."]},{"source":"cantina","id":"3.2.10","title":"Midnight risk controls lack directional timelocks","severity":"Low","page":"12","contract":"MidnightAdapter","function":"setMinRate; setNoSalesWithShortfall; setMaxTtm (former)","summary":"The curator could immediately relax minRate and shortfall restrictions while maxTtm decreases were delayed. Depositors lacked a notice period for those relaxations and risk-reducing maturity changes were unnecessarily slow.","codeNow":"changed","codeRef":"src/adapters/midnight/MidnightAdapter.sol:258-269,291-331","codeNote":"Directional rate/allowance setters replace old controls, with immediate maxTtm decrease and timelocked increase."},{"source":"cantina","id":"3.2.11","title":"Rounding carried value up breaks the blended buy-rate lower bound","severity":"Low","page":"12-15","contract":"MidnightAdapter","function":"onBuy","summary":"Ceiling the existing amortized credit before flooring the blended rate could place the result below both input rates. A buy could consequently fail BuyRateTooLow even when both rates met minRate, and otherwise store an understated rate.","codeNow":"changed","codeRef":"src/adapters/midnight/MidnightAdapter.sol:535-547","codeNote":"Carried value now floors; the buy-rate test is per trade and the uint64 cast remains.","details":["Sections 3.3 Example and 3.4 Recommendation continue this finding, not additional findings.","The recommendation also discusses a stronger integer lower bound, 512-bit multiplication and uint64 rate overflow examples; current code still uses uint64 netRate and documents extreme-rate reverts."]},{"source":"cantina","id":"3.5.1","title":"durations in the factory contract could be packed","severity":"Gas Optimization","page":"15","contract":"MidnightAdapterFactory","function":"constructor; createMidnightAdapter","summary":"The factory stored an unpacked duration array and each adapter packed it again. Packing once in the factory was proposed to reduce storage reads, memory work and deployment gas.","codeNow":"changed","codeRef":"src/adapters/midnight/MidnightAdapterFactory.sol:11-37; src/adapters/midnight/MidnightAdapter.sol:161-169","codeNote":"Shared factory durations are gone; each deployment supplies durations which the adapter packs."},{"source":"cantina","id":"3.6.1","title":"Duplicate inherited functions","severity":"Informational","page":"16","contract":"IMidnightAdapterBase","function":"IMidnightAdapterBase declarations","summary":"The adapter interface redeclared realAssets, isRatified, allocate, deallocate, onBuy and onSell from inherited interfaces. These duplicate declarations added unnecessary maintenance and interface noise.","codeNow":"changed","codeRef":"src/adapters/midnight/interfaces/IMidnightAdapter.sol:25-27,120-175","codeNote":"The six redundant declarations are absent and the parent interfaces remain inherited."},{"source":"cantina","id":"3.6.2","title":"Divergence in adapter cap id derivation","severity":"Informational","page":"16-17","contract":"MidnightAdapter","function":"onBuy (duration id derivation)","summary":"Duration ids used the prefix duration despite also including the adapter address, unlike the this/ convention in other adapters. The inconsistent namespace made cap identification less uniform for integrations.","codeNow":"changed","codeRef":"src/adapters/midnight/MidnightAdapter.sol:64-66,594","codeNote":"Both the documented and computed prefix are now this/duration."},{"source":"cantina","id":"3.6.3","title":"Minor issues","severity":"Informational","page":"17","contract":"MidnightAdapter; MidnightAdapterFactory","function":"constructor; allocate; setConsumed; createMidnightAdapter; transient declarations","summary":"Eight comments, visibility, consistency and defensive-validation issues were grouped into one report entry. They concerned maintainability, potential deployment misuse and setter calls that can unexpectedly revert.","codeNow":"changed","codeRef":"src/adapters/midnight/MidnightAdapter.sol:102-121,152-170,342-345,404-414; src/adapters/midnight/MidnightAdapterFactory.sol:29-40","codeNote":"Mixed state across the eight numbered notes; retained as one finding to match the report count.","details":["1: The old overriden comment is gone; current transient declarations are at MidnightAdapter.sol:114-121.","2: Current adapter transient variables have explicit public visibility at MidnightAdapter.sol:115-121.","3: Self-authorization remains at MidnightAdapter.sol:158 without the proposed local explanatory comment; isRatified documents its force-deallocation exception at lines 487-505.","4: The factory immutable is now declared and assigned at MidnightAdapter.sol:102,153.","5: allocate now documents self-reported callback changes at MidnightAdapter.sol:404-405, but has no explicit msg.sig redundancy explanation.","6: allocate still ignores its bytes4 selector at MidnightAdapter.sol:406 and checks parentVault and sender at lines 411-412.","7: createMidnightAdapter still does not verify parentVault provenance through VaultV2Factory at MidnightAdapterFactory.sol:29-40.","8: setConsumed still forwards the requested amount unchanged at MidnightAdapter.sol:342-345; no conditional monotonic-update wrapper was added."]},{"source":"cantina","id":"3.6.4","title":"Represent Midnight credit sale policies with a per-market enum","severity":"Informational","page":"17-18","contract":"MidnightAdapter","function":"onSell; sale-policy settings","summary":"Two global sale-policy booleans and a per-market forceSellable flag had overlapping precedence, with the face-value check still applying in force-sale mode. Operators could misread the effective permission and had to change global settings for market-specific exits.","codeNow":"changed","codeRef":"src/adapters/midnight/interfaces/IMidnightAdapter.sol:10-22; src/adapters/midnight/MidnightAdapter.sol:638-648","codeNote":"No enum was added; global flags became rate/allowance checks plus a per-market force-sale floor."},{"source":"cantina","id":"3.6.5","title":"Depositors can time entry ahead of early Midnight withdrawals","severity":"Informational","page":"18-19","contract":"MidnightAdapter","function":"withdrawToVault; realAssets","summary":"Repaid credit remained discounted until withdrawal, when face-value proceeds realized its remaining discount. Depositors could enter before the withdrawal and share that yield over later accruals, with maxRate and snapshots limiting immediate extraction.","codeNow":"changed","codeRef":"src/adapters/midnight/MidnightAdapter.sol:416-418,478-479,716-737,836-859","codeNote":"Withdrawal is now internal via vault deallocation/self-funding; discounted valuation remains and the report covers permissioned front-running too."},{"source":"cantina","id":"3.6.6","title":"Rate-rounding bias shifts yield recognition between shareholder cohorts","severity":"Informational","page":"19-20","contract":"MidnightAdapter","function":"onBuy; realAssets","summary":"Underestimating the blended rate and ceiling carried value inflated present value, while reversing the rounding would suppress it. Repeated fills could shift yield between entering and exiting holders without creating credit or liquidity.","codeNow":"changed","codeRef":"src/adapters/midnight/MidnightAdapter.sol:19-24,544-547,836-859","codeNote":"Carried value now floors; final rate flooring and documented early-accrual caveats remain."},{"source":"trustsec","id":"TRST-L-1","title":"A user’s force-deallocate offer can be used by anyone to exit at the user’s expense","severity":"Low","page":"9-10","contract":"MidnightAdapter","function":"deallocate (forceDeallocate path)","summary":"A caller-supplied buy offer was not bound to the force-deallocating shareholder because Midnight saw the adapter as taker. Another depositor could use the victim’s par-priced offer to fund a cash exit, leaving the victim with consumed liquidity, an unwanted credit position and its original shares.","codeNow":"changed","codeRef":"src/adapters/midnight/MidnightAdapter.sol:427-477","codeNote":"Uses a self-created sell offer for an authorized shareholder taker, prepaid at face value plus settlement fees.","teamResponse":"TBD"},{"source":"trustsec","id":"TRST-L-2","title":"Shared cap ids add up Midnight face value and other adapters’ current assets","severity":"Low","page":"10-11","contract":"MidnightAdapter","function":"onBuy; ids","summary":"Shared collateralToken ids aggregate Midnight stored face-value net credit with other adapters’ current asset exposure. Midnight can consume disproportionate shared cap headroom and crowd out allocations or liquidity-adapter deposits, although this is conservative in value terms.","codeNow":"present","codeRef":"src/adapters/midnight/MidnightAdapter.sol:605-610,804-805; src/adapters/MorphoMarketV1AdapterV2.sol:189-197,260-264","teamResponse":"TBD"},{"source":"trustsec","id":"TRST-L-3","title":"Relative caps compare Midnight face value with total assets in book value","severity":"Low","page":"11-12","contract":"MidnightAdapter","function":"onBuy; durationAllocations; VaultV2.allocateInternal","summary":"Midnight relative-cap numerators use face-value credit while firstTotalAssets includes discounted Midnight book value. Effective value allocations can be tighter than the configured percentage and vary as maturity approaches, without permitting a value-cap excess.","codeNow":"present","codeRef":"src/adapters/midnight/MidnightAdapter.sol:59-61,591-610; src/VaultV2.sol:547-556","teamResponse":"TBD"},{"source":"trustsec","id":"TRST-L-4","title":"take() does not bound the settlement and continuous fees","severity":"Low","page":"12-13","contract":"MidnightAdapter","function":"take; onBuy; onSell","summary":"take forwarded units without allocator-specified maximum settlement or continuous fees, leaving execution subject to the current fee and the counterparty maker’s fee cap. A prior fee increase could worsen the allocator’s execution relative to expectations within Midnight’s fee maxima.","codeNow":"present","codeRef":"src/adapters/midnight/MidnightAdapter.sol:356-372,535-537,638-648","teamResponse":"TBD"},{"source":"trustsec","id":"TRST-L-5","title":"setMinRate() is not timelocked, allowing zero-rate positions with an expected nominal loss","severity":"Low","page":"13-14","contract":"MidnightAdapter","function":"setMinRate (former); onBuy","summary":"minRate defaulted to zero and the curator could lower it immediately, allowing par credit purchases without interest headroom against bad debt. The report argues that nonzero expected bad debt then implies expected nominal losses without a depositor notice window.","codeNow":"changed","codeRef":"src/adapters/midnight/MidnightAdapter.sol:139-140,291-302,535-537","codeNote":"minRate became minNetBuyRate, whose decrease is timelocked and whose check applies to the buy itself; its unconfigured default remains zero.","teamResponse":"TBD"},{"source":"trustsec","id":"TRST-PR-1","title":"Tokens that cap and decrease the maximum allowance can block the adapter","severity":"Not rated (previously known)","page":"15","contract":"MidnightAdapter","function":"constructor; onBuy; deallocate","summary":"Constructor-only maximum approvals could eventually be exhausted by tokens that cap allowances and decrement the capped value. Midnight buys or vault deallocations would then stop because their token pulls lack allowance.","codeNow":"changed","codeRef":"src/adapters/midnight/MidnightAdapter.sol:152-170,425-426,613","codeNote":"Constructor approvals are absent; deallocate and onBuy now call forceApproveMax for the vault and Midnight respectively."},{"source":"trustsec","id":"TRST-R-1","title":"MidnightAdapterFactory uses the same durations for all adapters","severity":"Not rated (recommendation)","page":"16","contract":"MidnightAdapterFactory","function":"constructor; createMidnightAdapter","summary":"The factory fixed one duration ladder at construction and reused it for all its adapters. Separate adapters of the same vault could not express distinct duration configurations through that factory.","codeNow":"changed","codeRef":"src/adapters/midnight/MidnightAdapterFactory.sol:19-37","codeNote":"Durations are now supplied per createMidnightAdapter call."},{"source":"trustsec","id":"TRST-R-2","title":"Unused maturity bits should be reallocated to the rate","severity":"Not rated (recommendation)","page":"16-17","contract":"MarketData; MidnightAdapter","function":"MarketData; onBuy","summary":"MarketData used a uint48 maturity alongside a uint64 per-second rate, leaving maturity headroom unused while very cheap near-maturity buys could exceed the rate cast. Such buys would revert, so the report proposed uint40 maturity and uint72 rate without extra storage.","codeNow":"changed","codeRef":"src/adapters/midnight/interfaces/IMidnightAdapter.sol:10-22; src/adapters/midnight/MidnightAdapter.sol:508-509,544-550","codeNote":"Maturity is uint40 but netRate remains uint64; extreme-rate reverts are documented."},{"source":"trustsec","id":"TRST-R-3","title":"Interest accrual in forceDeallocate() path is unnecessary","severity":"Not rated (recommendation)","page":"17","contract":"MidnightAdapter","function":"deallocate (forceDeallocate path)","summary":"The adapter accrued vault interest before the force-deallocation sale even though that path did not require the snapshot. This deferred the face-value sale gain beyond the exiting user’s transaction and cost an extra accrual call.","codeNow":"changed","codeRef":"src/adapters/midnight/MidnightAdapter.sol:427-477","codeNote":"The force-deallocation branch no longer calls accrueInterest."},{"source":"trustsec","id":"TRST-R-4","title":"createMidnightAdapter() can be front-run to make the transaction revert","severity":"Not rated (recommendation)","page":"17-18","contract":"MidnightAdapterFactory","function":"createMidnightAdapter","summary":"CREATE2 used the caller-supplied salt without binding it to the caller or returning an existing deployment. A front-runner could deploy the same adapter first and revert the original deployment/configuration batch without changing the resulting adapter.","codeNow":"changed","codeRef":"src/adapters/midnight/MidnightAdapterFactory.sol:26-39","codeNote":"Salt now binds msg.sender; shared-sender bundles must also bind the initiator in preSalt."},{"source":"trustsec","id":"TRST-R-5","title":"setIsRootRatified() should use nonce protection since roots are managed by multiple parties","severity":"Not rated (recommendation)","page":"18","contract":"MidnightAdapterPriceRatifierV1; MidnightAdapterRateRatifierV1","function":"setIsRootRatified; setIsRootRatifiedWithSig","summary":"The direct root setter neither accepted an expected nonce nor incremented rootNonce despite roots being managed by multiple allocators and sentinels. A pending direct approval or an older still-valid signature could re-enable a root after a direct revocation.","codeNow":"present","codeRef":"src/adapters/midnight/ratifiers/MidnightAdapterPriceRatifierV1.sol:33-47,81-86; src/adapters/midnight/ratifiers/MidnightAdapterRateRatifierV1.sol:37-51,83-88"},{"source":"trustsec","id":"TRST-R-6","title":"setIsRootRatifiedWithSig() signatures can be submitted by other authorized parties","severity":"Not rated (recommendation)","page":"18-19","contract":"MidnightAdapterPriceRatifierV1; MidnightAdapterRateRatifierV1","function":"setIsRootRatifiedWithSig","summary":"The caller and signer separately needed vault roles but did not need to be the same account or have a delegation relationship. Another privileged party could extract and execute a signature outside the intended batch, including after that batch reverted.","codeNow":"changed","codeRef":"src/adapters/midnight/ratifiers/MidnightAdapterPriceRatifierV1.sol:50-79; src/adapters/midnight/ratifiers/MidnightAdapterRateRatifierV1.sol:54-81","codeNote":"Callers must now be the signer or authorized by that signer on the adapter’s Midnight instance."},{"source":"trustsec","id":"TRST-R-7","title":"Global minRate should be replaced with a minimum rate curve keyed on time to maturity","severity":"Not rated (recommendation)","page":"19-20","contract":"MidnightAdapter","function":"onBuy; onSell; rate settings","summary":"A single blended-rate floor neither expressed a maturity-dependent yield curve nor checked the rate of each trade. A low-rate purchase could pass using existing yield headroom and the same floor could be too permissive or restrictive for different terms.","codeNow":"changed","codeRef":"src/adapters/midnight/MidnightAdapter.sol:139-148,535-547,638-648","codeNote":"Individual minNetBuyRate and maxNetSellRate checks were introduced, but these remain adapter-wide rather than duration-bucket curves."},{"source":"trustsec","id":"TRST-R-8","title":"Coding style improvements","severity":"Not rated (recommendation)","page":"20","contract":"IMidnightAdapter; MidnightAdapter","function":"interface declarations; onBuy; ids","summary":"Interface and implementation parameter names differed and duration ids lacked the this/ namespace used for other adapter-specific ids. These inconsistencies increased integration and maintenance ambiguity.","codeNow":"changed","codeRef":"src/adapters/midnight/interfaces/IMidnightAdapter.sol:25-27,120-175; src/adapters/midnight/MidnightAdapter.sol:510-518,594,617-625","codeNote":"Redundant callback declarations were removed, callback names now follow inherited interfaces, and duration ids use this/duration."},{"source":"trustsec","id":"TRST-R-9","title":"revoke() prevents no-ops","severity":"Not rated (recommendation)","page":"20-21","contract":"MidnightAdapter","function":"revoke","summary":"revoke required its payload to remain pending rather than allowing an already-executed or already-revoked no-op. Repeated revocation reverted with DataNotTimelocked contrary to the cited audit guidelines.","codeNow":"present","codeRef":"src/adapters/midnight/MidnightAdapter.sol:219-225"},{"source":"trustsec","id":"TRST-R-10","title":"Cap ids could be made configurable by the curator","severity":"Not rated (recommendation)","page":"21","contract":"MidnightAdapter","function":"ids; durationAllocations","summary":"Hard-coded ids covered separate gate, RCF and collateral dimensions but not arbitrary market-specific combinations, and duration caps were adapter-local. Curators could not express certain desired joint exposures or a fresh duration limit across multiple adapters.","codeNow":"changed","codeRef":"src/adapters/midnight/MidnightAdapter.sol:787-808,594,816-833","codeNote":"A joint family hash replaced separate dimensions; ids remain non-configurable and duration caps adapter-local."},{"source":"trustsec","id":"TRST-R-11","title":"Documentation improvements","severity":"Not rated (recommendation)","page":"22","contract":"MidnightAdapter","function":"contract NatSpec; onBuy; setConsumed","summary":"Documentation omitted pending-action and nested-vault constraints, misencoded self-funding callback data and overstated what consuming offers cancels. Operators could configure unsafe activation schedules, attempt blocked trades or misunderstand callback and zero-unit behavior.","codeNow":"changed","codeRef":"src/adapters/midnight/MidnightAdapter.sol:35-38,79-88,342-345; lib/midnight/src/Midnight.sol:76-82","codeNote":"All four requested topics were located in updated or removed comments.","details":["Activation now explicitly requires no unsafe pending actions, at MidnightAdapter.sol:80.","Same-vault and nested-vault trading restrictions are documented at MidnightAdapter.sol:88.","Self-funding now documents abi.encode(address(this), abi.encode(market)) at MidnightAdapter.sol:36-37.","The adapter’s setConsumed cancellation comment is removed; Midnight.sol:80-81 explicitly documents no-op callbacks and zero-asset nonzero-unit takes of fully consumed offers."]},{"source":"trustsec","id":"TRST-R-12","title":"isRatified() does not validate the offer’s Midnight address","severity":"Not rated (recommendation)","page":"22","contract":"MidnightAdapter","function":"isRatified","summary":"Ratification did not validate the offer’s Midnight or chain id, relying on Midnight’s market-creation checks. Other consumers querying the adapter could receive an incorrect picture of ratified offers outside that execution path.","codeNow":"changed","codeRef":"src/adapters/midnight/MidnightAdapter.sol:488-505","codeNote":"Normal ratification now checks offer.market.midnight; no direct chain-id check or the proposed chain-id explanatory comment was added."},{"source":"trustsec","id":"TRST-R-13","title":"Buy-side re-entrancy safety of onBuy() relies on undocumented assumptions","severity":"Not rated (recommendation)","page":"22-23","contract":"MidnightAdapter","function":"onBuy; realAssets; withdrawToVault; deallocate","summary":"Buy state was written before funding and vault reporting without a sell-style liquidation lock, relying on cached total assets, additive local deltas and trusted funding adapters. The report judged the described flow safe but warned that undocumented dependencies made future changes prone to accounting or reentrancy mistakes.","codeNow":"changed","codeRef":"src/adapters/midnight/MidnightAdapter.sol:118-121,508-509,539-611,846-854","codeNote":"New transient pre-buy state feeds realAssets during accrual; local-delta reporting and post-update funding remain."},{"source":"trustsec","id":"TRST-R-14","title":"The rate rounding in onBuy() and onSell() should be documented","severity":"Not rated (recommendation)","page":"24","contract":"MidnightAdapter","function":"onBuy; onSell","summary":"Both reported calculations rounded carried value upward and rates downward, advancing a bounded amount of future interest each time. Repeated zero-unit buys or shortfall sales could repeat this accrual drift, which the draft assessed as having no practical impact and recommended documenting.","codeNow":"changed","codeRef":"src/adapters/midnight/MidnightAdapter.sol:19-24,544-547,660-685","codeNote":"Rounding is documented; buys now floor carried value and sales ceil targets across multiple markets."},{"source":"trustsec","id":"TRST-R-15","title":"Decreasing maxTtm should not be timelocked","severity":"Not rated (recommendation)","page":"24","contract":"MidnightAdapter","function":"setMaxTtm (former); decreaseMaxTtm","summary":"setMaxTtm delayed both increases and decreases and did not let sentinels decrease the limit. A maturity-risk reduction affecting only future buys therefore could not take effect immediately.","codeNow":"changed","codeRef":"src/adapters/midnight/MidnightAdapter.sol:258-269","codeNote":"decreaseMaxTtm is immediate for curator or sentinel; increaseMaxTtm remains timelocked."},{"source":"trustsec","id":"TRST-CR-1","title":"Curator","severity":"Not rated (centralization risk)","page":"25","contract":"MidnightAdapter","function":"curator configuration; timelocks; gate selection","summary":"The curator controls adapter risk settings and timelocked configuration, and the reviewed gated markets could rely on changing external whitelists. Depositors needed timely monitoring and an exit window to avoid malicious settings, blocked in-kind exits or excessive-adapter gas denial of service.","codeNow":"changed","codeRef":"src/adapters/midnight/MidnightAdapter.sol:73-82,190-337,564-570; src/VaultV2.sol:22-24","codeNote":"Directional controls and forceRemove were added; an optional compatible factory restricts gates, with custom/absent-factory risks documented."},{"source":"trustsec","id":"TRST-CR-2","title":"Allocator","severity":"Not rated (centralization risk)","page":"25-26","contract":"MidnightAdapter","function":"take; setConsumed; setIsSubRatifier; root setters","summary":"Allocators choose execution and offer approvals within caps and curator constraints, while capital-backed short-term deposits can manipulate relative limits. They can incur losses or concentrate assets in relatively illiquid Midnight credit, so depositors rely on their execution and liquidity management.","codeNow":"changed","codeRef":"src/adapters/midnight/MidnightAdapter.sol:340-372,535-537,638-648; src/VaultV2.sol:49-54","codeNote":"Authority remains under new per-trade rate checks, shortfallAllowance and force-sale price floors."},{"source":"trustsec","id":"TRST-CR-3","title":"Sentinel","severity":"Not rated (centralization risk)","page":"26","contract":"MidnightAdapter","function":"revoke; unsetForceSellable; setConsumed; setIsSubRatifier; root setters","summary":"The sentinel is a vault-assigned role with revocation, consumption and other risk-off powers. It can disable adapter offer routes and pending changes without possessing ordinary authority to approve new roots.","codeNow":"changed","codeRef":"src/adapters/midnight/MidnightAdapter.sol:219-225,265-282,342-350,416-418; src/adapters/midnight/ratifiers/MidnightAdapterRateRatifierV1.sol:37-51","codeNote":"Sentinels now also decrease maxTtm and withdraw through vault deallocation; root approval remains forbidden."},{"source":"trustsec","id":"TRST-CR-4","title":"Skim recipient","severity":"Not rated (centralization risk)","page":"26","contract":"MidnightAdapter","function":"setSkimRecipient; skim","summary":"The configured skim recipient can withdraw token balances owned by the adapter, including creditor rewards. The report treats these as separate from user funds owned by the vault and identifies reward control as the recipient’s trust surface.","codeNow":"present","codeRef":"src/adapters/midnight/MidnightAdapter.sol:285-288,393-399"},{"source":"trustsec","id":"TRST-SR-1","title":"Token risks and assumptions","severity":"Not rated (systemic risk)","page":"27","contract":"MidnightAdapter","function":"token transfers across adapter and Midnight","summary":"Token behavior is assumed to satisfy Midnight’s ERC-20, exact-transfer, balance-change and non-reentrancy requirements. Tokens violating those assumptions can expose users to loss of funds.","codeNow":"present","codeRef":"src/adapters/midnight/MidnightAdapter.sol:84-85; src/VaultV2.sol:83-88; lib/midnight/src/Midnight.sol:111-116"},{"source":"trustsec","id":"TRST-SR-2","title":"MidnightAdapter depends on Morpho Midnight and VaultV2","severity":"Not rated (systemic risk)","page":"27","contract":"MidnightAdapter","function":"onBuy; onSell; realAssets; deallocate","summary":"The adapter relies on Midnight and VaultV2 for settlement, accounting and availability. An exploit or failure of either dependency can cause losses or interruption that the adapter does not isolate.","codeNow":"present","codeRef":"src/adapters/midnight/MidnightAdapter.sol:425-477,574-614,693-698,836-859"},{"source":"trustsec","id":"TRST-SR-3","title":"MidnightAdapterRateRatifierV1 and MidnightAdapter use simple instead of compounded interest","severity":"Not rated (systemic risk)","page":"27","contract":"MidnightAdapterRateRatifierV1; MidnightAdapter","function":"isRatified; onBuy; realAssets","summary":"Rate conversion intentionally uses simple per-second interest rather than compounding. A user treating the input as a compounded rate would obtain different prices and yields, with the discrepancy growing with rate and duration.","codeNow":"present","codeRef":"src/adapters/midnight/ratifiers/MidnightAdapterRateRatifierV1.sol:105-108; src/adapters/midnight/MidnightAdapter.sol:544-547,859"}],"acceptedRisks":[{"statement":"The contracts are immutable, and the adapter uses the parent vault’s curator, allocator and sentinel roles.","ref":"src/adapters/midnight/README.md:3-7","kind":"documented-limit"},{"statement":"In-kind exits buy credit before pending fees at face value plus Midnight settlement fees and the vault’s force-deallocation penalty, irrespective of remaining maturity.","ref":"src/adapters/midnight/README.md:14-20","kind":"accepted-risk"},{"statement":"A force-deallocation caller must be the taker or its Midnight-authorized delegate, the taker must authorize the adapter and hold at least one vault share, and the amount is then limited by the penalty rather than that one-share threshold.","ref":"src/adapters/midnight/MidnightAdapter.sol:48-51","kind":"documented-limit"},{"statement":"Guaranteed gate-compatible in-kind exits require the configured compatible factory, an admission-enabled gate and registration of the adapter’s factory.","ref":"src/adapters/midnight/README.md:24-29","kind":"trusted-role"},{"statement":"A custom enterGateFactory can admit markets that block in-kind exits without a timelocked gate-selection action, while a zero factory imposes no market enter-gate restriction.","ref":"src/adapters/midnight/MidnightAdapter.sol:73-77","kind":"accepted-risk"},{"statement":"Enter gates created by the configured factory must not directly or indirectly reenter the adapter during admit or unadmit.","ref":"src/adapters/midnight/MidnightAdapter.sol:76","kind":"trusted-role"},{"statement":"The gate role setter permanently trusts registered factories to recognize debt-free adapters that check vault share ownership and clear temporary credit admission before token transfers, since admission spans every market using that gate and misbehavior can block in-kind exits.","ref":"src/adapters/midnight/gates/IKRCompatibleEnterGate.sol:9-12,38-50","kind":"trusted-role"},{"statement":"Admission enablement is immutable, and registering factories has no admission effect when it is disabled.","ref":"src/adapters/midnight/gates/IKRCompatibleEnterGate.sol:15-16,31","kind":"documented-limit"},{"statement":"Each whitelist side is shared across every market using the subgate, and a side made open at deployment stays open forever.","ref":"src/adapters/midnight/gates/WhitelistEnterSubGate.sol:11-16","kind":"documented-limit"},{"statement":"Credit-side and debt-side role setters control their whitelisters, who directly or by signature change the corresponding account lists.","ref":"src/adapters/midnight/README.md:172-176","kind":"trusted-role"},{"statement":"The whitelist subgate is intended for use through an enter gate, cannot directly serve as a Midnight or Vault V2 gate, and does not prevent market exits.","ref":"src/adapters/midnight/README.md:168-170; src/adapters/midnight/gates/WhitelistEnterSubGate.sol:15-16","kind":"documented-limit"},{"statement":"Whitelist signatures accept stale nonces only when the account already has the signed status and the unexpired signer is still a whitelister, while a chain-id change invalidates old signatures by changing the domain.","ref":"src/adapters/midnight/README.md:175; src/adapters/midnight/gates/WhitelistEnterSubGate.sol:17","kind":"documented-limit"},{"statement":"The adapter needs allocator authority to buy and allocator or sentinel authority to sell, force-remove funded markets and self-fund buys, while in-kind exits do not need those adapter roles.","ref":"src/adapters/midnight/MidnightAdapter.sol:28-31; src/adapters/midnight/README.md:59-61","kind":"trusted-role"},{"statement":"The adapter cannot be the vault’s liquidity adapter because allocate only accepts self-reported changes and deposits through it would revert.","ref":"src/adapters/midnight/MidnightAdapter.sol:31","kind":"documented-limit"},{"statement":"Allocators control buy funding through callback data and may use vault idle assets, another adapter or withdrawable Midnight positions.","ref":"src/adapters/midnight/README.md:92-96","kind":"trusted-role"},{"statement":"Self-funding callback data must use nested ABI encoding of the funding market, and sub-ratifiers may constrain the funding source of maker offers.","ref":"src/adapters/midnight/MidnightAdapter.sol:35-38","kind":"documented-limit"},{"statement":"Curators configure limits, guardrails, force-sale mode, recipient, timelocks and removals; allocators trade, withdraw and manage offer authorization; sentinels withdraw, revoke changes or approvals, decrease maxTtm and disable force-sale mode or sub-ratifiers.","ref":"src/adapters/midnight/README.md:146-148,149-150","kind":"trusted-role"},{"statement":"The curator’s trading constraints are operational guardrails rather than depositor guarantees of future interest, and their timelocks are not necessary for non-custodiality.","ref":"src/adapters/midnight/README.md:110-124","kind":"accepted-risk"},{"statement":"Relaxing minNetBuyRate, maxNetSellRate or shortfallAllowance is timelocked, tightening them is immediate, and the per-market minForceSellPrice is immediately adjustable in either direction.","ref":"src/adapters/midnight/README.md:115-124","kind":"trusted-role"},{"statement":"Force-sale mode disables buys, immediately realizes sale losses instead of reducing rates, bypasses maxNetSellRate and shortfallAllowance, and can sell below face value after maturity subject to minForceSellPrice.","ref":"src/adapters/midnight/README.md:126-131","kind":"accepted-risk"},{"statement":"A market id cap should be zeroed when force-sale or force-removal is submitted to prevent allocators buying more credit just before the pending action executes.","ref":"src/adapters/midnight/MidnightAdapter.sol:272,375-377","kind":"trusted-role"},{"statement":"Force-removal permanently deletes a market’s accounting and cap exposure without moving its Midnight credit, after which buys, sales, withdrawals and in-kind redemptions there revert.","ref":"src/adapters/midnight/README.md:133-138","kind":"accepted-risk"},{"statement":"The skim recipient can collect any token held by the adapter, including rewards.","ref":"src/adapters/midnight/README.md:140-142","kind":"trusted-role"},{"statement":"Caps use stored face-value net credit rather than discounted value against book-value total assets, with each position counted in every duration at or below its remaining maturity, zero-duration exposure covered adapter-wide, and adapter-managed conservative duration allocations exempt from the vault’s nonzero-deallocation rule.","ref":"src/adapters/midnight/MidnightAdapter.sol:59-61,64-71,68-70","kind":"documented-limit"},{"statement":"Market-family caps combine collateral parameters, RCF threshold and both gates, and markets differing only by maturity share the same family and collateral-token caps.","ref":"src/adapters/midnight/MidnightAdapter.sol:787-808","kind":"documented-limit"},{"statement":"Deployment durations are fixed, strictly increasing, positive uint32 values with at most eight entries and a separate maxTtm buy limit, while PackedDurationsLib assumes those size/width bounds and get indices below eight, otherwise returning unspecified values.","ref":"src/adapters/midnight/MidnightAdapterFactory.sol:26; src/adapters/midnight/README.md:47-51; src/adapters/midnight/libraries/PackedDurationsLib.sol:6-24","kind":"documented-limit"},{"statement":"The 250-active-market limit can be filled with dust takes.","ref":"src/adapters/midnight/MidnightAdapter.sol:96-98","kind":"accepted-risk"},{"statement":"Valuation discounts net credit at a constant simple net rate until maturity and rounds held amortized assets down.","ref":"src/adapters/midnight/MidnightAdapter.sol:19-21","kind":"documented-limit"},{"statement":"Rates round down on buys and sales and sale target values round up, so some interest may accrue earlier than the exact calculation.","ref":"src/adapters/midnight/MidnightAdapter.sol:22-23","kind":"accepted-risk"},{"statement":"Tokens with an expensive smallest unit, explicitly including WBTC, cbBTC and two-decimal stablecoins, are unsupported because rounding and zero-asset buys can accrue significant interest too early.","ref":"src/adapters/midnight/MidnightAdapter.sol:24","kind":"token-assumption"},{"statement":"Bad debt immediately affects realAssets with a proportional discount on remaining unearned interest; zero-loss-factor markets use stored credit and other markets read current Midnight credit.","ref":"src/adapters/midnight/MidnightAdapter.sol:25-26","kind":"documented-limit"},{"statement":"An ordinary sale shortfall consumes allowance and proportionally reduces unearned interest across active markets instead of immediately realizing the full shortfall as a loss, and reverts above available interest or allowance.","ref":"src/adapters/midnight/README.md:80-88","kind":"accepted-risk"},{"statement":"Shortfall ceilings and rate floors can consume more future interest than the allowance charged, and although redistribution stops after sufficient absorption, its final market takes a full proportional share that can exceed the remaining shortfall.","ref":"src/adapters/midnight/MidnightAdapter.sol:145-148,682-685","kind":"accepted-risk"},{"statement":"A shortfall sale reverts while another market sale is in progress, and bad debt observed during the buyer callback may leave the sold market overvalued by up to the shortfall immediately afterward, declining to zero at maturity.","ref":"src/adapters/midnight/MidnightAdapter.sol:40-46","kind":"accepted-risk"},{"statement":"Taker sales at price one can fail the net-rate check because proceeds exclude settlement fees, while buys can revert on extreme computed rates or zero pre-buy amortized value plus zero payment.","ref":"src/adapters/midnight/MidnightAdapter.sol:141-143,508-509,544-547","kind":"documented-limit"},{"statement":"Trades between adapters of the same vault can transiently exceed caps and revert, and direct or nested same-vault Midnight adapters may be unable to trade because buyer accrual occurs during the seller’s trade.","ref":"src/adapters/midnight/MidnightAdapter.sol:62,87-88","kind":"documented-limit"},{"statement":"Before enabling an adapter, its timelocks must be configured with no unsafe pending actions, and increaseMaxTtm, setForceSellable and forceRemove need sufficient notice for depositor exits.","ref":"src/adapters/midnight/MidnightAdapter.sol:79-82","kind":"trusted-role"},{"statement":"Excessive timelocks can overflow and irreversibly disable submission without delaying already-pending actions, while abdication irreversibly disables execution including pending operations.","ref":"src/adapters/midnight/MidnightAdapter.sol:190,228-229,248-253","kind":"documented-limit"},{"statement":"Shortfall-allowance decreases floor at zero so an intervening sale cannot invalidate a pending decrease.","ref":"src/adapters/midnight/MidnightAdapter.sol:312-317","kind":"documented-limit"},{"statement":"A zero-asset withdrawal can synchronize stored market accounting after a loss, and current net credit is time-independent so its view helper can use a zero-maturity market structure.","ref":"src/adapters/midnight/MidnightAdapter.sol:716-717,747-753","kind":"documented-limit"},{"statement":"marketIdAt deliberately omits a bounds check and assumes its index is smaller than marketIds.length.","ref":"src/adapters/midnight/MidnightAdapter.sol:761-766","kind":"documented-limit"},{"statement":"CREATE2 salts bind the immediate factory caller, so shared-sender bundles must additionally derive preSalt from the initiating user.","ref":"src/adapters/midnight/MidnightAdapterFactory.sol:28","kind":"trusted-role"},{"statement":"Sub-ratifiers authorize adapter offers, with allocators able to approve or revoke roots and sentinels able only to revoke them.","ref":"src/adapters/midnight/README.md:98-108","kind":"trusted-role"},{"statement":"Approved roots remain ratified after an allocator loses its role until they are explicitly unratified.","ref":"src/adapters/midnight/ratifiers/MidnightAdapterPriceRatifierV1.sol:18-21; src/adapters/midnight/ratifiers/MidnightAdapterRateRatifierV1.sol:20-23","kind":"accepted-risk"},{"statement":"Allocators and sentinels may delegate through Midnight, and signature root setters require a currently authorized signer plus submission by the signer or its delegate to preserve the batch context.","ref":"src/adapters/midnight/ratifiers/MidnightAdapterPriceRatifierV1.sol:20,50-51; src/adapters/midnight/ratifiers/MidnightAdapterRateRatifierV1.sol:22,54-55","kind":"trusted-role"},{"statement":"The ratifiers’ inherited design shares one nonce per maker and root across signers, expects all tree offers to share maker and ratifier, and invalidates old signed ratifications when chain id changes.","ref":"lib/midnight/src/ratifiers/RateRatifierV1.sol:19-23","kind":"documented-limit"},{"statement":"The rate ratifier converts a simple WAD-scaled per-second rate into a price using remaining maturity and does not account for compounding or continuous fees.","ref":"lib/midnight/src/ratifiers/RateRatifierV1.sol:16-17","kind":"documented-limit"},{"statement":"Owners appoint curator and sentinels; curators configure adapters, registry, caps, gates, allocators and fees; allocators control allocation, liquidity routing and maxRate and are responsible for withdrawal liquidity; sentinels revoke actions, deallocate and reduce caps.","ref":"README.md:95-111,33-45,106-108","kind":"trusted-role"},{"statement":"Vault non-custodial exit guarantees depend on appropriately nonzero timelocks and in-kind redemptions, which can carry a force-deallocation penalty of up to two percent.","ref":"README.md:55-69","kind":"documented-limit"},{"statement":"Vault ERC-4626 maxDeposit, maxMint, maxWithdraw and maxRedeem always return zero.","ref":"README.md:113-118","kind":"documented-limit"},{"statement":"Curator-set recipients collect performance fees up to half of maxRate-limited distributed interest and management fees up to five percent annually even during losses, with both fees rounding down and management fees able to lower share price.","ref":"README.md:90-93; src/VaultV2.sol:621-625","kind":"documented-limit"},{"statement":"Vault maxRate bounds share-price growth rather than preventing share-price losses, and users wanting additional bounds on interactions must impose their own checks.","ref":"src/VaultV2.sol:30-34; README.md:85-88","kind":"documented-limit"},{"statement":"Vault asset reporting depends on adapters and iterating too many or expensive realAssets implementations can make interactions costly or cause denial of service.","ref":"src/VaultV2.sol:21-24","kind":"trusted-role"},{"statement":"Interest and losses are recognized only once per transaction, and vault shares should not be loanable because borrowing shares permits shorting ahead of loss realization.","ref":"src/VaultV2.sol:26-33","kind":"accepted-risk"},{"statement":"Virtual shares and one virtual asset may still require an initial seed deposit to mitigate inflation attacks and cumulative rounding deflation when the vault is small.","ref":"src/VaultV2.sol:35-36","kind":"accepted-risk"},{"statement":"Donations and force-deallocation penalties can attract opportunistic depositors and dilute existing holders’ interest, with lower maxRate mitigating this behavior.","ref":"src/VaultV2.sol:37","kind":"accepted-risk"},{"statement":"Caps use interaction-updated allocations that can be exceeded by interest or donations, relative caps are soft on exit, and firstTotalAssets makes deposits conservatively rejectable while capital-backed short-term deposits can still manipulate relative limits.","ref":"src/VaultV2.sol:39-45,49-54","kind":"accepted-risk"},{"statement":"Adapters must enforce vault-only allocation calls, report exact cumulative changes and unique ids, approve withdrawals and enable in-kind deallocation, and must avoid direct or indirect vault reentry during realAssets or allocate except allocation queries, which curators must ensure even without static enforcement.","ref":"src/VaultV2.sol:56-65,64","kind":"trusted-role"},{"statement":"Unknown ids reject zero-cap allocations and zero-allocation deallocations, while markets sharing every id cannot be disabled independently.","ref":"src/VaultV2.sol:67","kind":"documented-limit"},{"statement":"Allocation or deallocation dust losses are tolerated only when negligible relative to gas, and curators should avoid markets with substantial entry or exit losses.","ref":"src/VaultV2.sol:68","kind":"trusted-role"},{"statement":"Adapters should generally be removed only when empty, after zeroing an exclusive cap so allocators cannot refill them during removal.","ref":"src/VaultV2.sol:69","kind":"trusted-role"},{"statement":"Registry changes check existing adapters only when configured, and later registry removal does not disable an already-added adapter, so enduring registry membership requires an add-only registry.","ref":"src/VaultV2.sol:71-76","kind":"documented-limit"},{"statement":"The liquidity adapter uses the same data for entry and exit, and reaching any relevant cap can block deposits, particularly in an empty or nearly empty vault.","ref":"src/VaultV2.sol:78-81","kind":"documented-limit"},{"statement":"The loan asset must satisfy vault and Midnight ERC-20 requirements except optional returns, move exact amounts without fee-on-transfer behavior, reduce protocol balances only through transfers, allow no-op transfers and avoid transfer reentry into the vault, adapter or Midnight.","ref":"src/VaultV2.sol:83-88; src/adapters/midnight/MidnightAdapter.sol:84-85; lib/midnight/src/Midnight.sol:111-116","kind":"token-assumption"},{"statement":"Vault liveness assumes transfer calls succeed with adequate balance and approval, including transfers to self, and adapters do not revert on realAssets or liquid-market deallocation.","ref":"src/VaultV2.sol:90-97","kind":"token-assumption"},{"statement":"Vault totalAssets and totalSupply must remain below roughly 10^35 and the vault must be interacted with at least once every ten years.","ref":"src/VaultV2.sol:95-96","kind":"documented-limit"},{"statement":"Timelock submissions need not be executable, correctly encoded or mutually consistent, large padded revocations may require a dedicated sentinel revoker, and abdicating a function keeps it unusable despite later submissions or timelock changes.","ref":"src/VaultV2.sol:99-109,111-113","kind":"documented-limit"},{"statement":"Share and receive-asset gates can block exits or share recovery, and a reverting or gas-heavy receive-shares gate can block all vault interactions.","ref":"src/VaultV2.sol:115-130","kind":"trusted-role"},{"statement":"Allocators can configure liquidity routing that blocks deposits or withdrawals, removal of an allocator can itself be timelocked, and role assignments do not require two-step acceptance.","ref":"src/VaultV2.sol:136-141","kind":"trusted-role"},{"statement":"New vaults start with zero timelocks and no gates, so restricting initial interactions requires batching gate configuration with creation.","ref":"src/VaultV2.sol:149","kind":"trusted-role"},{"statement":"Midnight markets are isolated, immutable and permissionlessly created, with capital supplied only when offers settle rather than reserved at publication.","ref":"lib/midnight/README.md:3-7","kind":"documented-limit"},{"statement":"Midnight limits maturity to one hundred years, markets to 128 sorted distinct collateral tokens and each borrower to sixteen simultaneously activated collaterals.","ref":"lib/midnight/src/Midnight.sol:17-21","kind":"documented-limit"},{"statement":"LLTV equal to one has no overcollateralization or liquidation incentive, generally realizes bad debt on unhealthy liquidations and leaves the recovery close factor inactive.","ref":"lib/midnight/src/Midnight.sol:22-24","kind":"accepted-risk"},{"statement":"Early repayments or liquidations incentivize buying discounted resting sell offers for immediate withdrawal and can produce races among lenders and the fee claimer to withdraw first.","ref":"lib/midnight/src/Midnight.sol:26","kind":"accepted-risk"},{"statement":"Borrowers can change their entire multi-collateral composition subject to health checks, and different incentives can make liquidators prefer particular collateral tokens.","ref":"lib/midnight/src/Midnight.sol:28-31","kind":"accepted-risk"},{"statement":"The configurator assigns roles and enables LLTVs and liquidation cursors, the fee claimer collects fees, the tick setter refines spacing, and the fee setter overrides default/per-market fees within caps, including settlement fees interpolated by maturity and constant after maturity or beyond 360 days.","ref":"lib/midnight/src/Midnight.sol:33-41,132-137","kind":"trusted-role"},{"statement":"Changing the continuous fee does not alter existing lenders’ pending fees, and a decrease may incentivize self-trading to reset fees while paying settlement costs.","ref":"lib/midnight/src/Midnight.sol:43-47","kind":"accepted-risk"},{"statement":"Liquidations require an unhealthy or overdue position and are locked for the seller during take callbacks; recovery limits are disabled at LIF times LLTV equal to one or sufficiently small collateral.","ref":"lib/midnight/src/Midnight.sol:49-60","kind":"documented-limit"},{"statement":"The dust threshold does not prevent users from creating or leaving positions too small to liquidate profitably relative to gas.","ref":"lib/midnight/src/Midnight.sol:64","kind":"accepted-risk"},{"statement":"Post-maturity liquidation incentives increase over time while bad-debt computation always uses the maximum incentive, and realized bad debt is socialized proportionally among the market’s lenders.","ref":"lib/midnight/src/Midnight.sol:65-70","kind":"accepted-risk"},{"statement":"Offers sharing a consumption group are expected to have the same maker, buy direction, maximums and loan token.","ref":"lib/midnight/src/Midnight.sol:72-74","kind":"trusted-role"},{"statement":"Exactly one offer cap must be nonzero, and fully consumed offers can still invoke zero-unit callbacks or transfer nonzero units when an assets-based consumption increment rounds to zero.","ref":"lib/midnight/src/Midnight.sol:76-82","kind":"documented-limit"},{"statement":"Tick spacing can only be refined to divisors of the existing spacing, unlocking ticks while keeping previously valid prices available.","ref":"lib/midnight/src/Midnight.sol:84-87","kind":"documented-limit"},{"statement":"Midnight authorizations give broad control over positions, consumption and further authorizations, so action-scoped delegation requires a restricted intermediate contract.","ref":"lib/midnight/src/Midnight.sol:89-94","kind":"trusted-role"},{"statement":"Take rounding favors the maker over the taker and pending-fee rounding favors users, permitting fee manipulation when gas is sufficiently cheap.","ref":"lib/midnight/src/Midnight.sol:96-98","kind":"accepted-risk"},{"statement":"Loss-factor rounding makes collective lender losses slightly exceed bad debt, credit updates round down, and near-total lifetime market losses can make accounting extremely imprecise up to total loss.","ref":"lib/midnight/src/Midnight.sol:99-103","kind":"accepted-risk"},{"statement":"Midnight enter gates restrict increases but do not block existing holders’ direct exits, whereas liquidator gates can block liquidations and bad-debt realization.","ref":"lib/midnight/src/Midnight.sol:105-109","kind":"trusted-role"},{"statement":"Oracle reverts or extreme prices can block liquidation and debt-bearing health, withdrawal or take paths, a zero liquidation price blocks repaid-input liquidation, and rejecting gates, failed token transfers or incorrect/reverting callbacks block dependent operations.","ref":"lib/midnight/src/Midnight.sol:119-124,125-130","kind":"documented-limit"},{"statement":"Replacing the fee claimer removes the former claimer’s access to unclaimed fees, while enabled LLTV tiers and liquidation cursors cannot later be disabled.","ref":"lib/midnight/src/Midnight.sol:136,216-225","kind":"trusted-role"},{"statement":"Midnight permits no-ops and omits systematic zero checks; stored credit, pending fees and loss factors can be stale and callers should use updatePositionView for current values.","ref":"lib/midnight/src/Midnight.sol:139-144","kind":"documented-limit"},{"statement":"Midnight quantities such as total units, collateral, credit, fee credit and debt are limited to uint128, and markets retain creation chain id so forks can produce identical market ids on different chains.","ref":"lib/midnight/src/Midnight.sol:145-146","kind":"documented-limit"},{"statement":"Midnight requires Osaka clz, Cancun mcopy and transient-storage opcodes, and Shanghai push0 support.","ref":"lib/midnight/src/Midnight.sol:148","kind":"documented-limit"},{"statement":"A settlement-fee change can worsen a taker’s expected price or invalidate low-price buy offers, so integrations needing an exact bound should perform an atomic price check.","ref":"lib/midnight/src/Midnight.sol:313-315","kind":"accepted-risk"},{"statement":"Every seller-asset amount is reachable via units but all buyer-asset amounts are reachable only when buyer price is at most one, and a buyer callback may change Midnight state before onSell runs.","ref":"lib/midnight/src/Midnight.sol:316-319","kind":"documented-limit"},{"statement":"A zero-repaid, zero-seized liquidation can realize bad debt without transferring tokens and can specify collateral that is not activated.","ref":"lib/midnight/src/Midnight.sol:570-574","kind":"documented-limit"},{"statement":"Midnight position and health helpers expect matching market ids, some expect already-touched markets, and fee views have zero values before market creation.","ref":"lib/midnight/src/Midnight.sol:792-793,825-827,852-854,952-965","kind":"documented-limit"},{"statement":"BlueBuyCallback owns its Blue position and anyone authorized by its owner on Midnight can trigger it through an offer, so those authorizations must be trusted.","ref":"lib/midnight/src/periphery/README.md:9-15","kind":"trusted-role"},{"statement":"BlueFallbackRolling requires authorizations on both protocols and exactly one matching activated collateral, permits caller incentives up to the full debt, and bypasses minimum roll size for a complete exit.","ref":"lib/midnight/src/periphery/README.md:26-34","kind":"documented-limit"},{"statement":"The optional Midnight Log limits published calldata to one million bytes.","ref":"lib/midnight/src/periphery/README.md:43-47","kind":"documented-limit"},{"statement":"Midnight proofs use bounded optimistic loops/hashes, remove multicall, assume well-behaved tokens and generally non-reentrant external calls except callback properties, while the no-multiplication-overflow proof also assumes bounded oracle prices.","ref":"lib/midnight/certora/README.md:137-149,134-135","kind":"documented-limit"},{"statement":"The whitepaper does not guarantee stated returns or rates and describes the source code as provided without warranties.","ref":"https://morpho.org/whitepapers/midnight-whitepaper.pdf:PDF page 2","kind":"accepted-risk"},{"statement":"Offer publication need not guarantee executability, and Midnight provides no canonical order queue, price-time priority or reservation of capital.","ref":"https://morpho.org/whitepapers/midnight-whitepaper.pdf:PDF page 6, section 3.4","kind":"documented-limit"},{"statement":"After maturity trading can unwind existing credit or debt but cannot increase debt, and overdue-position liquidation incentives reach their maximum over a sixty-minute window.","ref":"https://morpho.org/whitepapers/midnight-whitepaper.pdf:PDF pages 4 and 9, sections 2.3 and 4.4","kind":"documented-limit"},{"statement":"The whitepaper describes continuous fees as capped at one percent annualized and fixed for existing credit despite later fee-setting changes.","ref":"https://morpho.org/whitepapers/midnight-whitepaper.pdf:PDF page 10, section 7.2","kind":"documented-limit"},{"statement":"Midnight enter gates control credit or debt increases, not vault share or asset transfers.","ref":"src/adapters/midnight/README.md:152-159","kind":"documented-limit"},{"statement":"The referenced Midnight base ratifier documentation requires use only with its configured MIDNIGHT instance.","ref":"lib/midnight/src/ratifiers/RateRatifierV1.sol:22","kind":"documented-limit"}],"counts":{"cantina":{"total":19,"bySeverity":{"Medium":1,"Low":11,"Gas Optimization":1,"Informational":6}},"trustsec":{"total":28,"bySeverity":{"Low":5,"Not rated (previously known)":1,"Not rated (recommendation)":15,"Not rated (centralization risk)":4,"Not rated (systemic risk)":3}},"total":47},"unreadable":[]}
