{
 "lead": "ratifier-forgery: forged ratification in MidnightAdapterPriceRatifierV1 / MidnightAdapterRateRatifierV1",
 "commit": "bbeda7b27ae80abcf070e0158cb8a31e87bb2286",
 "hasCandidates": false,
 "candidates": [],
 "lowInfo": [
  {
   "title": "ratifierData trailing bytes are ignored by abi.decode (non-canonical ratifierData accepted)",
   "class": "Informational",
   "verified": true,
   "refs": [
    "src/adapters/midnight/ratifiers/MidnightAdapterPriceRatifierV1.sol:100-101",
    "src/adapters/midnight/ratifiers/MidnightAdapterRateRatifierV1.sol:100-101",
    "src/adapters/midnight/MidnightAdapter.sol:503"
   ],
   "detail": "isRatified decodes ratifierData with abi.decode, which accepts extra trailing bytes. test_dirtyRatifierDataAccepted shows a 200-byte ratifierData (valid encoding plus 8 junk bytes) returns CALLBACK_SUCCESS. ratifierData is not part of the leaf hash or signature, so there is no security impact found; it only means several byte strings ratify the same take (relevant only to off-chain indexers that key on ratifierData). Fix if desired: require(ratifierData.length == expected) for the fixed-size head plus proof length."
  },
  {
   "title": "Rate ratifier reverts with a Panic (overflow) instead of WorsePrice for huge rate values",
   "class": "Informational",
   "verified": true,
   "refs": [
    "src/adapters/midnight/ratifiers/MidnightAdapterRateRatifierV1.sol:105-106"
   ],
   "detail": "rate * timeToMaturity overflows for rate = type(uint256).max and reverts with an arithmetic panic (test_rateHugeRateReverts). It is a revert, not a bypass; a taker-supplied rate is also bound by the leaf hash. Only the error type is affected."
  },
  {
   "title": "HashLib.isLeaf accepts the root itself with an empty proof; safe only because ratifiers recompute the leaf from the offer",
   "class": "Informational",
   "verified": true,
   "refs": [
    "lib/midnight/src/ratifiers/libraries/HashLib.sol:131-142",
    "src/adapters/midnight/ratifiers/MidnightAdapterPriceRatifierV1.sol:103-106"
   ],
   "detail": "There is no leaf/node domain separation in the tree (hashNode = keccak256(left||right)). test_merkleEdgeCases asserts isLeaf(root, root, 0, []) is true. But leaves are EIP-712 struct hashes computed by the ratifier from the full offer (and rate/allowedTaker), so an attacker would need an offer whose struct hash equals an inner node, which means finding a keccak preimage. Not exploitable; noted for future code that might accept a caller-supplied leaf."
  }
 ],
 "covered": {
  "tests": "test/poc/RatifierForgeryTest.sol (unit level: real ratifier contracts, mock adapter/vault/Midnight exposing parentVault, isAllocator, isSentinel, isAuthorized)",
  "result": "9 tests passed, 0 failed, 0 skipped; fuzz test 2048 runs",
  "command": "XDG_DATA_HOME=$TMPDIR/xdg FOUNDRY_TEST=test/poc forge test --match-path test/poc/RatifierForgeryTest.sol -vv",
  "checked": [
   "setIsRootRatified by an account with no role, by a stranger naming an allocator as onBehalf, and a sentinel trying to ratify: all revert Unauthorized",
   "attacker-deployed fake maker with its own vault: writes only ratification[fakeMaker], real adapter root stays false",
   "setIsRootRatifiedWithSig: a signature from a non-role signer is rejected; an allocator signature submitted by a stranger is rejected; a zero/garbage signature is rejected; nonce stays 0",
   "Merkle: empty proof, leafIndex out of range, over-long zero-padded proof, wrong sibling side, zero root, inner node as leaf: all rejected",
   "offer-hash collisions through dynamic fields (callbackData, collateralParams array): different leaf, rejected",
   "allowedTaker: a wrong taker reverts UnauthorizedTaker; claiming allowedTaker=0 changes the leaf, so InvalidProof",
   "the same root under both ratifiers: ratification storage is per contract, and price and rate leaves use different typehashes",
   "fuzz: a random root/index/2-element proof never verifies",
   "maker/callback/receiver/ratifier constraints read in code: MidnightAdapter.sol:497-500 (maker==adapter, callback==adapter, sell receiver==adapter) and Midnight.sol:343 (offer.ratifier must be authorized by the maker)"
  ]
 },
 "notCovered": [
  "Maker/callback/receiver checks were reviewed in code (MidnightAdapter.sol:492-505, Midnight.sol:338-344) but not exercised in an integration test with real Midnight and VaultV2; the PoC uses mocks for adapter/vault/Midnight, not test/integration/MidnightAdapterIntegrationTest.sol",
  "Prior audit drafts (audits/2026-10-12-*.pdf) were not read, since there were no candidates to check against them",
  "Full repo test suite not run (a full compile was SIGKILLed by memory limits on this machine; only test/poc was compiled via FOUNDRY_TEST)",
  "Signed-ratification replay across chains/forks beyond the DOMAIN_SEPARATOR, which includes chainid and the contract address, was not tested"
 ]
}