{
 "number": 36332,
 "input_hash": "c69bf336b065bf6c",
 "model": "ledger",
 "prompt_hash": null,
 "created": "2026-10-23T01:16:54+00:00",
 "result": {
  "summary": "Defers populating MuSig2 aggregate pubkeys and participant BIP 32 derivation paths until after verifying that the aggregate is actually relevant to the script being signed. In `SignTaproot`, MuSig2 aggregate pubkeys are no longer inserted unconditionally into `SignatureData`. Instead, `SignMuSig2` queries the provider, checks aggregate key involvement, and only then records the MuSig2 pubkeys and participant key origins.",
  "problem": "When RPC methods like `descriptorprocesspsbt` or `utxoupdatepsbt` are invoked with multiple descriptors, all descriptor data is combined into a single `SigningProvider`. The signer assumed all MuSig2 entries in the provider applied to the input being signed, leaking unrelated MuSig2 participant pubkeys, derivation paths, and leaf hashes into inputs and outputs where they do not belong.",
  "card": "Prevents unrelated MuSig2 metadata from being injected into PSBT inputs and outputs. When processing PSBTs with multiple descriptors via descriptorprocesspsbt or utxoupdatepsbt, MuSig2 aggregate and participant BIP 32 derivation data were populated before verifying whether the input script actually involved that aggregate key. MuSig2 data insertion is now deferred in SignMuSig2 until after relevance is validated. This resolves issue #36323 without external dependencies.",
  "evidence": [
   "Fixes issue #36323: 'wallet/psbt/musig2: overpopulating participant leaf_hashes in utxoupdatepsbt and descriptorprocesspsbt'",
   "PR description explains that 'if one of the given descriptors involved a MuSig2, the MuSig2 information would be accidentally added to the SignatureData which results in those fields appearing in the resulting PSBT'"
  ],
  "scope_notes": "Small patch to `src/script/sign.cpp` with functional regression tests in `test/functional/rpc_psbt.py`.",
  "changed_since_previous": "Diff provided; confirms the mechanism in `SignMuSig2` and `SignTaproot` alongside regression coverage in `rpc_psbt.py`.",
  "thread": {
   "last_event_at": "2026-10-01T21:28:30Z",
   "events": 11,
   "head_sha": "bca240a0e0a5b229ffab71760511cb746046212f",
   "schema_floor": 2,
   "schema": 2
  },
  "waiting_on": [
   {
    "at": "2026-09-28",
    "id": "rc:4125261587",
    "on": "author",
    "url": "https://github.com/bitcoin/bitcoin/pull/36332#discussion_r4125261587",
    "what": "fix the test assertion in rpc_psbt.py and address reviewer suggestions"
   }
  ],
  "risk": {
   "level": "medium",
   "touches": [
    "wallet",
    "rpc_api"
   ],
   "why": "A flaw in MuSig2 signing or PSBT metadata population could omit required participant details or create malformed PSBTs, blocking transaction signing or finalization."
  },
  "discussion": {
   "author_status": "last statement processed 2026-10-01",
   "open_concerns": [
    "vicjuma: avoid repeated lookups of GetAllMuSig2ParticipantPubkeys on every signing attempt if possible",
    "Bicaru20: avoid repeated calls to GetAllMuSig2ParticipantPubkeys by creating agg_keys in SignTaproot or using insert_or_assign",
    "Bicaru20: check the descriptor directly in the test loop instead of enumerating by index",
    "polespinasa: an assertion in test/functional/rpc_psbt.py is inverted/wrong",
    "polespinasa: assert that musig2_participant_pubkeys are present in decoded psbt scope"
   ],
   "resolved_concerns": []
  },
  "reviewability": {
   "state": "Paused",
   "label": "Waiting on author",
   "reason": "Open objections from Bicaru20, polespinasa, vicjuma with no author reply for 31 days; review would repeat what has been asked."
  },
  "agreement": {
   "state": "Blocked",
   "summary": "Blocked: objection that needs a change, nobody has replied (polespinasa)",
   "reason": "Re-evaluated fametrano's edited comment c:5940991797; the edit adds clarification explaining to Zeegaths why participant keys lose their leaf hashes on key-path-only descriptors.",
   "evidence": [
    "vicjuma (suggestion, approach, must be answered, open): avoid repeated lookups of GetAllMuSig2ParticipantPubkeys on every signing attempt if possible",
    "Bicaru20 (suggestion, approach, must be answered, open): avoid repeated calls to GetAllMuSig2ParticipantPubkeys by creating agg_keys in SignTaproot or using insert_or_assign",
    "Bicaru20 (suggestion, style, must be answered, open): check the descriptor directly in the test loop instead of enumerating by index",
    "polespinasa (objection, correctness, must be changed, open): an assertion in test/functional/rpc_psbt.py is inverted/wrong",
    "polespinasa (suggestion, correctness, must be answered, open): assert that musig2_participant_pubkeys are present in decoded psbt scope",
    "vicjuma: ACK",
    "Bicaru20: Concept ACK \u2014 agrees with concept and notes the code in sign.cpp could be optimized to avoid repeated GetAllMuSig2ParticipantPubkeys calls",
    "fametrano: support \u2014 tested that the fix works across the issue's descriptor and four variants; will review again once the assert polespinasa flagged is fixed"
   ],
   "objections": [
    {
     "reviewer": "vicjuma",
     "association": "CONTRIBUTOR",
     "type": "suggestion",
     "kind": "approach",
     "harm": "",
     "request": "avoid repeated lookups of GetAllMuSig2ParticipantPubkeys on every signing attempt if possible",
     "question": "",
     "text": "avoid repeated lookups of GetAllMuSig2ParticipantPubkeys on every signing attempt if possible",
     "clears_with": "answer",
     "blocking": false,
     "status": "open",
     "status_note": "",
     "cleared": false,
     "author_replied": false,
     "others_replied": false,
     "fix_pushed": false,
     "replies": [],
     "evidence": "2026-09-25: 'Called on every signing attempt, is it optimal to avoid repeated lookups'",
     "url": "https://github.com/bitcoin/bitcoin/pull/36332#discussion_r4109136155",
     "id": "rc:4109136155",
     "at": "2026-09-25",
     "status_at": null,
     "status_by": null,
     "resolution_evidence": "",
     "pin": null,
     "from_schema": 2
    },
    {
     "reviewer": "Bicaru20",
     "association": "CONTRIBUTOR",
     "type": "suggestion",
     "kind": "approach",
     "harm": "",
     "request": "avoid repeated calls to GetAllMuSig2ParticipantPubkeys by creating agg_keys in SignTaproot or using insert_or_assign",
     "question": "",
     "text": "avoid repeated calls to GetAllMuSig2ParticipantPubkeys by creating agg_keys in SignTaproot or using insert_or_assign",
     "clears_with": "answer",
     "blocking": false,
     "status": "open",
     "status_note": "",
     "cleared": false,
     "author_replied": false,
     "others_replied": false,
     "fix_pushed": false,
     "replies": [],
     "evidence": "2026-09-27: 'Create the agg_keys in SignTaproot so we only call GetAllMuSig2ParticipantPubkeys once'",
     "url": "https://github.com/bitcoin/bitcoin/pull/36332#discussion_r4116528878",
     "id": "rc:4116528878",
     "at": "2026-09-27",
     "status_at": null,
     "status_by": null,
     "resolution_evidence": "",
     "pin": null,
     "from_schema": 2
    },
    {
     "reviewer": "Bicaru20",
     "association": "CONTRIBUTOR",
     "type": "suggestion",
     "kind": "style",
     "harm": "",
     "request": "check the descriptor directly in the test loop instead of enumerating by index",
     "question": "",
     "text": "check the descriptor directly in the test loop instead of enumerating by index",
     "clears_with": "answer",
     "blocking": false,
     "status": "open",
     "status_note": "",
     "cleared": false,
     "author_replied": false,
     "others_replied": false,
     "fix_pushed": false,
     "replies": [],
     "evidence": "2026-09-27: 'nit: I think it would make the test easy to follow if the condition check directly the descriptor'",
     "url": "https://github.com/bitcoin/bitcoin/pull/36332#discussion_r4116560626",
     "id": "rc:4116560626",
     "at": "2026-09-27",
     "status_at": null,
     "status_by": null,
     "resolution_evidence": "",
     "pin": null,
     "from_schema": 2
    },
    {
     "reviewer": "polespinasa",
     "association": "MEMBER",
     "type": "objection",
     "kind": "correctness",
     "harm": "an assertion in test/functional/rpc_psbt.py is inverted/wrong",
     "request": "",
     "question": "",
     "text": "an assertion in test/functional/rpc_psbt.py is inverted/wrong",
     "clears_with": "change",
     "blocking": true,
     "status": "open",
     "status_note": "",
     "cleared": false,
     "author_replied": false,
     "others_replied": false,
     "fix_pushed": false,
     "replies": [],
     "evidence": "2026-09-28: 'This assert is wrong'",
     "url": "https://github.com/bitcoin/bitcoin/pull/36332#discussion_r4125261587",
     "id": "rc:4125261587",
     "at": "2026-09-28",
     "status_at": null,
     "status_by": null,
     "resolution_evidence": "",
     "pin": null,
     "from_schema": 2
    },
    {
     "reviewer": "polespinasa",
     "association": "MEMBER",
     "type": "suggestion",
     "kind": "correctness",
     "harm": "",
     "request": "assert that musig2_participant_pubkeys are present in decoded psbt scope",
     "question": "",
     "text": "assert that musig2_participant_pubkeys are present in decoded psbt scope",
     "clears_with": "answer",
     "blocking": false,
     "status": "open",
     "status_note": "",
     "cleared": false,
     "author_replied": false,
     "others_replied": false,
     "fix_pushed": false,
     "replies": [],
     "evidence": "2026-09-28: 'Maybe assert here than the fields are present?'",
     "url": "https://github.com/bitcoin/bitcoin/pull/36332#discussion_r4125278894",
     "id": "rc:4125278894",
     "at": "2026-09-28",
     "status_at": null,
     "status_by": null,
     "resolution_evidence": "",
     "pin": null,
     "from_schema": 2
    }
   ],
   "support": [
    {
     "reviewer": "vicjuma",
     "reason": "",
     "substantive": false,
     "verdict": "ACK",
     "id": "r:5323241566",
     "url": "https://github.com/bitcoin/bitcoin/pull/36332#pullrequestreview-5323241566",
     "at": "2026-09-25",
     "association": "CONTRIBUTOR",
     "evidence": "none",
     "areas": []
    },
    {
     "reviewer": "Bicaru20",
     "reason": "agrees with concept and notes the code in sign.cpp could be optimized to avoid repeated GetAllMuSig2ParticipantPubkeys calls",
     "substantive": true,
     "verdict": "Concept ACK",
     "id": "r:5331628059",
     "url": "https://github.com/bitcoin/bitcoin/pull/36332#pullrequestreview-5331628059",
     "at": "2026-09-27",
     "association": "CONTRIBUTOR",
     "evidence": "read",
     "areas": [
      "sign.cpp"
     ]
    },
    {
     "reviewer": "fametrano",
     "reason": "tested that the fix works across the issue's descriptor and four variants; will review again once the assert polespinasa flagged is fixed",
     "substantive": true,
     "verdict": "",
     "id": "c:5940991797",
     "url": "https://github.com/bitcoin/bitcoin/pull/36332#issuecomment-5940991797",
     "at": "2026-10-01",
     "association": "CONTRIBUTOR",
     "evidence": "tested",
     "areas": []
    }
   ],
   "participants": [
    {
     "login": "vicjuma",
     "stance": "support",
     "note": "ACKed; suggested avoiding repeated lookups of GetAllMuSig2ParticipantPubkeys",
     "association": "CONTRIBUTOR",
     "comments": 3,
     "first": "2026-09-25",
     "last": "2026-09-25"
    },
    {
     "login": "Bicaru20",
     "stance": "support",
     "note": "Concept ACK; suggested optimizations in sign.cpp and a test simplification nit",
     "association": "CONTRIBUTOR",
     "comments": 3,
     "first": "2026-09-27",
     "last": "2026-09-27"
    },
    {
     "login": "Zeegaths",
     "stance": "neutral",
     "note": "reported RPC comparison test results between master and PR",
     "association": "NONE",
     "comments": 1,
     "first": "2026-09-27",
     "last": "2026-09-27"
    },
    {
     "login": "polespinasa",
     "stance": "objection",
     "note": "pointed out an incorrect assert in rpc_psbt.py and suggested checking for participant pubkeys",
     "association": "MEMBER",
     "comments": 2,
     "first": "2026-09-28",
     "last": "2026-09-28"
    },
    {
     "login": "fametrano",
     "stance": "support",
     "note": "tested that the fix works across five descriptor variants; waiting on test assert fix to re-review",
     "association": "CONTRIBUTOR",
     "comments": 2,
     "first": "2026-10-01",
     "last": "2026-10-01"
    }
   ],
   "derivation": "objection that needs a change, nobody has replied (polespinasa)",
   "model_state": null,
   "corrections": [],
   "notes": "Re-evaluated fametrano's edited comment c:5940991797; the edit adds clarification explaining to Zeegaths why participant keys lose their leaf hashes on key-path-only descriptors."
  },
  "dependencies": {
   "depends_on": [],
   "enables": []
  },
  "categories": [
   {
    "name": "p2p",
    "member": false,
    "evidence": "Matches were spurious substring keyword hits; the change modifies signing and PSBT processing, not peer-to-peer networking.",
    "band": "Unranked",
    "reason_tag": "cleanup",
    "score": 0.0,
    "factors": {
     "bug_severity": 2,
     "leverage": 0,
     "performance": 0,
     "security_stability": 1,
     "user_value": 1
    },
    "rationale": "The PR has no connection to P2P transport, peer management, or relay."
   },
   {
    "name": "rpc",
    "member": true,
    "evidence": "Fixes PSBT output data correctness for RPC methods `descriptorprocesspsbt` and `utxoupdatepsbt` without modifying wallet code, matching the PSBT RPC borderline rule.",
    "band": "P3",
    "reason_tag": "bug fix",
    "score": 0.4,
    "factors": {
     "bug_severity": 2,
     "leverage": 0,
     "performance": 0,
     "security_stability": 1,
     "user_value": 1
    },
    "rationale": "Prevents `descriptorprocesspsbt` and `utxoupdatepsbt` from leaking unrelated MuSig2 participant pubkeys, derivation paths, and leaf hashes into PSBT inputs where they do not belong (#36323). This fixes a clear data correctness issue in PSBT RPC outputs when multiple descriptors are supplied, but addresses an edge case in advanced MuSig2 signing workflows that can be deferred behind category-critical RPC work."
   },
   {
    "name": "wallet",
    "member": false,
    "evidence": "The PR changes `src/script/sign.cpp` and `test/functional/rpc_psbt.py` without touching wallet code; the wallet category explicitly notes that a descriptor or PSBT change affecting only RPC without wallet code is rpc, not wallet.",
    "band": "Unranked",
    "reason_tag": "bug fix",
    "score": 0.0,
    "factors": {
     "bug_severity": 2,
     "leverage": 0,
     "performance": 0,
     "security_stability": 1,
     "user_value": 1
    },
    "rationale": "Does not touch wallet code or wallet-specific PSBT workflows, falling under the RPC boundary exclusion for standalone descriptor and PSBT changes."
   }
  ],
  "confidence": "high",
  "uncertainties": [],
  "needs": []
 },
 "cost_usd": 0.0,
 "source": {
  "record": "2026-10-23T01:16:54+00:00",
  "code": "2026-09-26T01:25:37+00:00",
  "judgments": 3
 }
}