{
 "number": 36555,
 "input_hash": "677410b05c570999",
 "model": "ledger",
 "prompt_hash": null,
 "created": "2026-10-22T01:13:13+00:00",
 "result": {
  "summary": "Populates BlockValidationState with an error message when Chainstate::InvalidateBlock fails to disconnect a block or encounters an active-chain conflict during invalidation. Adds an explicit RPC parameter check to invalidateblock to reject invalidating the genesis block with RPC_INVALID_PARAMETER. Extends unit tests for disconnect failures due to missing undo data and functional tests for genesis block invalidation.",
  "problem": "When InvalidateBlock fails during block disconnection (for example, due to corrupted undo data), the chain is left partially rolled back while the invalidateblock RPC silently ignores the failure and returns success (null) to the caller. Additionally, attempting to invalidate the genesis block is not explicitly validated up front.",
  "card": "Ensures the invalidateblock RPC and validation layer properly report errors when block invalidation fails. Previously, if block disconnection failed midway (such as from missing or corrupt undo data), InvalidateBlock returned false without setting an error state, causing the RPC to report success despite leaving the active chain partially rolled back (issue #36546). The PR records specific error messages into BlockValidationState, adds an explicit RPC check preventing invalidation of the genesis block, and adds unit and functional test coverage.",
  "evidence": [
   "Issue #36546: 'rpc: invalidateblock reports success when a block can't be disconnected'",
   "PR description: 'If there is a problem disconnecting the block (for example, the undo data is corrupt), the chain remains partially rolled back when telling the user that the operation succeeded.'"
  ],
  "scope_notes": "CMakeLists.txt contains an apparent stray change adding src/pubkey.cpp to the core_interface target.",
  "changed_since_previous": "Added an accidental modification to CMakeLists.txt linking src/pubkey.cpp to core_interface; the core logic for validation error reporting and genesis check remains the same.",
  "thread": {
   "last_event_at": "2026-10-20T18:26:20Z",
   "events": 6,
   "head_sha": "4aeb6a8fad7ad1f0efccf11e684e935e0a7d0320",
   "schema_floor": 2,
   "schema": 2
  },
  "waiting_on": [
   {
    "at": "2026-10-20",
    "id": "c:6287826001",
    "on": "author",
    "url": "https://github.com/bitcoin/bitcoin/pull/36555#issuecomment-6287826001",
    "what": "response to l0rinc regarding documenting the limitation versus adding regression code"
   },
   {
    "at": "2026-10-20",
    "id": "c:6298118760",
    "on": "reviewer",
    "url": "https://github.com/bitcoin/bitcoin/pull/36555#issuecomment-6298118760",
    "what": "yusufyildiz34 to review author's pushed fixes"
   }
  ],
  "risk": {
   "level": "medium",
   "touches": [
    "rpc_api",
    "validation",
    "build"
   ],
   "why": "Touches block disconnection and invalidation error handling in validation, and includes a stray change to CMake build definitions."
  },
  "discussion": {
   "author_status": "last statement processed 2026-10-20",
   "open_concerns": [
    "pinheadmz: Add a thorough description to the pull request",
    "l0rinc: Document the partial rollback behavior as a known limitation instead of adding validation or regression code",
    "l0rinc: Simplify the tests and consider adding the AssumeUTXO reproducer in a collapsible section"
   ],
   "resolved_concerns": [
    "pinheadmz: Can the author guarantee having read the AI policy, that the contribution conforms to it, and that real human users have encountered the problem being solved? (accepted by pinheadmz 2026-10-17)",
    "yusufyildiz34: The error message names the wrong block (pindex instead of to_mark_failed) (fixed by ja7ad 2026-10-20)",
    "yusufyildiz34: Using state.Error() for the genesis block returns database error (-20) rather than an invalid parameter error (-8 / RPC_INVALID_PARAMETER) (fixed by ja7ad 2026-10-20)",
    "yusufyildiz34: Does this change need a release note? (answered by ja7ad 2026-10-20)"
   ]
  },
  "reviewability": {
   "state": "Ready",
   "label": "Ready",
   "reason": "Nothing known that would invalidate a review now."
  },
  "agreement": {
   "state": "Strong",
   "summary": "Strong: substantive support, no open objection (yusufyildiz34)",
   "reason": "Added review comments from l0rinc and yusufyildiz34. Yusufyildiz34's objections regarding the block name in the error message and the genesis block error code were addressed and fixed by ja7ad.",
   "evidence": [
    "pinheadmz (suggestion, maintenance, must be answered, open): Add a thorough description to the pull request",
    "l0rinc (suggestion, approach, must be answered, open): Document the partial rollback behavior as a known limitation instead of adding validation or regression code",
    "l0rinc (suggestion, maintenance, must be answered, open): Simplify the tests and consider adding the AssumeUTXO reproducer in a collapsible section",
    "yusufyildiz34: support \u2014 invalidateblock reporting success after a partial rollback is clearly wrong, and routing the failures through state is cleaner than patching the RPC helper"
   ],
   "objections": [
    {
     "reviewer": "pinheadmz",
     "association": "MEMBER",
     "type": "question",
     "kind": "usefulness",
     "harm": "",
     "request": "",
     "question": "Can the author guarantee having read the AI policy, that the contribution conforms to it, and that real human users have encountered the problem being solved?",
     "text": "Can the author guarantee having read the AI policy, that the contribution conforms to it, and that real human users have encountered the problem being solved?",
     "clears_with": "answer",
     "blocking": false,
     "status": "accepted",
     "status_note": "author confirmed writing the code and understanding the AI policy; reviewer accepted",
     "cleared": true,
     "author_replied": true,
     "others_replied": false,
     "fix_pushed": false,
     "replies": [
      "c:6230156148"
     ],
     "evidence": "2026-10-16: 'can you guarantee us that you have read our AI Policy and this particular contribution conforms to that policy?'",
     "url": "https://github.com/bitcoin/bitcoin/pull/36555#issuecomment-6225894873",
     "id": "c:6225894873",
     "at": "2026-10-16",
     "status_at": "2026-10-17",
     "status_by": "pinheadmz",
     "resolution_evidence": "2026-10-17: pinheadmz: 'Great!'",
     "pin": null,
     "from_schema": 2
    },
    {
     "reviewer": "pinheadmz",
     "association": "MEMBER",
     "type": "suggestion",
     "kind": "maintenance",
     "harm": "",
     "request": "Add a thorough description to the pull request",
     "question": "",
     "text": "Add a thorough description to the pull request",
     "clears_with": "answer",
     "blocking": false,
     "status": "open",
     "status_note": "",
     "cleared": false,
     "author_replied": false,
     "others_replied": false,
     "fix_pushed": false,
     "replies": [],
     "evidence": "2026-10-17: 'Please add a thorough description to the PR.'",
     "url": "https://github.com/bitcoin/bitcoin/pull/36555#issuecomment-6230204397",
     "id": "c:6230204397",
     "at": "2026-10-17",
     "status_at": null,
     "status_by": null,
     "resolution_evidence": "",
     "pin": null,
     "from_schema": 2
    },
    {
     "reviewer": "l0rinc",
     "association": "MEMBER",
     "type": "suggestion",
     "kind": "approach",
     "harm": "",
     "request": "Document the partial rollback behavior as a known limitation instead of adding validation or regression code",
     "question": "",
     "text": "Document the partial rollback behavior as a known limitation instead of adding validation or regression code",
     "clears_with": "answer",
     "blocking": false,
     "status": "open",
     "status_note": "",
     "cleared": false,
     "author_replied": false,
     "others_replied": false,
     "fix_pushed": false,
     "replies": [],
     "evidence": "2026-10-20: 'I think this remaining partial-state behavior should be documented as a known limitation instead of adding more AssumeUTXO-specific validation or regression code.'",
     "url": "https://github.com/bitcoin/bitcoin/pull/36555#issuecomment-6287826001",
     "id": "c:6287826001",
     "at": "2026-10-20",
     "status_at": null,
     "status_by": null,
     "resolution_evidence": "",
     "pin": null,
     "from_schema": 2
    },
    {
     "reviewer": "l0rinc",
     "association": "MEMBER",
     "type": "suggestion",
     "kind": "maintenance",
     "harm": "",
     "request": "Simplify the tests and consider adding the AssumeUTXO reproducer in a collapsible section",
     "question": "",
     "text": "Simplify the tests and consider adding the AssumeUTXO reproducer in a collapsible section",
     "clears_with": "answer",
     "blocking": false,
     "status": "open",
     "status_note": "",
     "cleared": false,
     "author_replied": false,
     "others_replied": false,
     "fix_pushed": false,
     "replies": [],
     "evidence": "2026-10-20: 'Please try to simplify the tests and maybe add the AssumeUTXO reproducer in a collapsible section in the PR'",
     "url": "https://github.com/bitcoin/bitcoin/pull/36555#issuecomment-6287826001",
     "id": "c:6287826001#2",
     "at": "2026-10-20",
     "status_at": null,
     "status_by": null,
     "resolution_evidence": "",
     "pin": null,
     "from_schema": 2
    },
    {
     "reviewer": "yusufyildiz34",
     "association": "NONE",
     "type": "objection",
     "kind": "correctness",
     "harm": "The error message names the wrong block (pindex instead of to_mark_failed)",
     "request": "",
     "question": "",
     "text": "The error message names the wrong block (pindex instead of to_mark_failed)",
     "clears_with": "change",
     "blocking": true,
     "status": "fixed",
     "status_note": "author updated the error message to name to_mark_failed",
     "cleared": true,
     "author_replied": true,
     "others_replied": false,
     "fix_pushed": true,
     "replies": [
      "c:6298118760"
     ],
     "evidence": "2026-10-20: 'The error message in the third hunk names the wrong block.'",
     "url": "https://github.com/bitcoin/bitcoin/pull/36555#issuecomment-6294852607",
     "id": "c:6294852607",
     "at": "2026-10-20",
     "status_at": "2026-10-20",
     "status_by": "ja7ad",
     "resolution_evidence": "2026-10-20: ja7ad: 'It's to_mark_failed now.'",
     "pin": null,
     "from_schema": 2
    },
    {
     "reviewer": "yusufyildiz34",
     "association": "NONE",
     "type": "objection",
     "kind": "interface",
     "harm": "Using state.Error() for the genesis block returns database error (-20) rather than an invalid parameter error (-8 / RPC_INVALID_PARAMETER)",
     "request": "",
     "question": "",
     "text": "Using state.Error() for the genesis block returns database error (-20) rather than an invalid parameter error (-8 / RPC_INVALID_PARAMETER)",
     "clears_with": "change",
     "blocking": true,
     "status": "fixed",
     "status_note": "author updated the RPC helper to reject the genesis block with -8",
     "cleared": true,
     "author_replied": true,
     "others_replied": false,
     "fix_pushed": true,
     "replies": [
      "c:6298118760"
     ],
     "evidence": "2026-10-20: 'Rejecting height 0 in the RPC helper next to the existing LookupBlockIndex() check, with RPC_INVALID_PARAMETER, would give a more accurate code'",
     "url": "https://github.com/bitcoin/bitcoin/pull/36555#issuecomment-6294852607",
     "id": "c:6294852607#2",
     "at": "2026-10-20",
     "status_at": "2026-10-20",
     "status_by": "ja7ad",
     "resolution_evidence": "2026-10-20: ja7ad: 'the RPC now rejects it with -8 next to \"Block not found\"'",
     "pin": null,
     "from_schema": 2
    },
    {
     "reviewer": "yusufyildiz34",
     "association": "NONE",
     "type": "question",
     "kind": "maintenance",
     "harm": "",
     "request": "",
     "question": "Does this change need a release note?",
     "text": "Does this change need a release note?",
     "clears_with": "answer",
     "blocking": false,
     "status": "answered",
     "status_note": "author confirmed adding a release note",
     "cleared": true,
     "author_replied": true,
     "others_replied": false,
     "fix_pushed": true,
     "replies": [
      "c:6298118760"
     ],
     "evidence": "2026-10-20: 'Does this want a release note? invalidateblock now throws where it previously returned null.'",
     "url": "https://github.com/bitcoin/bitcoin/pull/36555#issuecomment-6294852607",
     "id": "c:6294852607#3",
     "at": "2026-10-20",
     "status_at": "2026-10-20",
     "status_by": "ja7ad",
     "resolution_evidence": "2026-10-20: ja7ad: 'Squashed the commits and added a body and a release note.'",
     "pin": null,
     "from_schema": 2
    }
   ],
   "support": [
    {
     "reviewer": "yusufyildiz34",
     "reason": "invalidateblock reporting success after a partial rollback is clearly wrong, and routing the failures through state is cleaner than patching the RPC helper",
     "substantive": true,
     "verdict": "",
     "id": "c:6294852607",
     "url": "https://github.com/bitcoin/bitcoin/pull/36555#issuecomment-6294852607",
     "at": "2026-10-20",
     "association": "NONE",
     "evidence": "read",
     "areas": [
      "src/rpc/blockchain.cpp",
      "consensus/validation.h"
     ]
    }
   ],
   "participants": [
    {
     "login": "pinheadmz",
     "stance": "question",
     "note": "asked about AI policy compliance and requested a thorough PR description",
     "association": "MEMBER",
     "comments": 2,
     "first": "2026-10-16",
     "last": "2026-10-17"
    },
    {
     "login": "l0rinc",
     "stance": "neutral",
     "note": "suggested documenting partial-state behavior as a known limitation and simplifying tests",
     "association": "MEMBER",
     "comments": 1,
     "first": "2026-10-20",
     "last": "2026-10-20"
    },
    {
     "login": "yusufyildiz34",
     "stance": "objection",
     "note": "supported the concept but objected to the error message naming the wrong block and returning database error for genesis",
     "association": "NONE",
     "comments": 1,
     "first": "2026-10-20",
     "last": "2026-10-20"
    }
   ],
   "derivation": "substantive support, no open objection (yusufyildiz34)",
   "model_state": null,
   "corrections": [],
   "notes": "Added review comments from l0rinc and yusufyildiz34. Yusufyildiz34's objections regarding the block name in the error message and the genesis block error code were addressed and fixed by ja7ad."
  },
  "dependencies": {
   "depends_on": [],
   "enables": []
  },
  "categories": [
   {
    "name": "build",
    "member": false,
    "evidence": "CMakeLists.txt edit is an apparent stray change adding src/pubkey.cpp rather than a build system improvement.",
    "band": "Unranked",
    "reason_tag": "cleanup",
    "score": 0.0,
    "factors": {
     "bug_severity": 1,
     "leverage": 0,
     "performance": 0,
     "security_stability": 1,
     "user_value": 1
    },
    "rationale": "Does not address the build system or CI."
   },
   {
    "name": "docs",
    "member": false,
    "evidence": "Touches only doc/release-notes-36555.md, which merely accompanies the code changes.",
    "band": "Unranked",
    "reason_tag": "cleanup",
    "score": 0.0,
    "factors": {
     "bug_severity": 1,
     "leverage": 0,
     "performance": 0,
     "security_stability": 1,
     "user_value": 1
    },
    "rationale": "Documentation changes that follow from code changes belong to the code's area."
   },
   {
    "name": "mempool",
    "member": false,
    "evidence": "Touches src/validation.cpp solely for chainstate block invalidation, not mempool data structures or relay policy.",
    "band": "Unranked",
    "reason_tag": "cleanup",
    "score": 0.0,
    "factors": {
     "bug_severity": 1,
     "leverage": 0,
     "performance": 0,
     "security_stability": 1,
     "user_value": 1
    },
    "rationale": "Has no connection to mempool acceptance, eviction, or policy rules."
   },
   {
    "name": "rpc",
    "member": true,
    "evidence": "Carries the RPC/REST/ZMQ label and modifies src/rpc/blockchain.cpp to report errors on failed invalidations and validate parameters.",
    "band": "P3",
    "reason_tag": "bug fix",
    "score": 0.4,
    "factors": {
     "bug_severity": 1,
     "leverage": 0,
     "performance": 0,
     "security_stability": 1,
     "user_value": 1
    },
    "rationale": "Fixes a bug where invalidateblock silently returned success despite a failure disconnecting blocks that left the chain partially rolled back. Because invalidateblock is primarily an administrative and testing tool rather than a standard hot method, the impact on everyday RPC callers is limited."
   },
   {
    "name": "validation",
    "member": true,
    "evidence": "Changes Chainstate::InvalidateBlock error state propagation in src/validation.cpp and adds blockchain unit tests for disconnect failures.",
    "band": "P3",
    "reason_tag": "bug fix",
    "score": 0.35,
    "factors": {
     "bug_severity": 1,
     "leverage": 0,
     "performance": 0,
     "security_stability": 1,
     "user_value": 1
    },
    "rationale": "Surfaces block disconnection failures in Chainstate::InvalidateBlock by populating BlockValidationState instead of silently ignoring them. The change improves internal state accounting during rollbacks without modifying consensus rules or core validation algorithms."
   }
  ],
  "confidence": "high",
  "uncertainties": [],
  "needs": []
 },
 "cost_usd": 0.0,
 "source": {
  "record": "2026-10-22T01:13:13+00:00",
  "code": "2026-10-22T01:18:48+00:00",
  "judgments": 5
 }
}