{
 "number": 36478,
 "repo": "bitcoin/bitcoin",
 "url": "https://github.com/bitcoin/bitcoin/pull/36478",
 "title": "rpc: Check named args names and result field names at compile time",
 "author": "maflcko",
 "author_association": "MEMBER",
 "created_at": "2026-10-08T16:00:54Z",
 "updated_at": "2026-10-26T08:54:43Z",
 "description_hash": "f8190c5c36e6dd1e",
 "age_days": 24,
 "draft": false,
 "labels": [
  "RPC/REST/ZMQ"
 ],
 "milestone": null,
 "base": "master",
 "head_sha": "fabdf113d377d507658557cfb5933dcd13324f10",
 "head_ref": "2610-rpc-compile-time-names-and-fiel-names",
 "head_repo": "maflcko/bitcoin-core",
 "head_history": [
  {
   "t": "2026-10-08T17:17:44Z",
   "sha": "fa620f0793dc9ee850e55b3f05f9072675e2e6d1"
  },
  {
   "t": "2026-10-08T18:37:17Z",
   "sha": "fabdf113d377d507658557cfb5933dcd13324f10"
  }
 ],
 "additions": 92,
 "deletions": 43,
 "changed_files": 9,
 "commit_count": 2,
 "size_bucket": "M",
 "mergeable_state": "clean",
 "bot": {
  "drahtbot": {
   "present": true,
   "reviews": {
    "ack": [
     {
      "login": "fametrano",
      "url": "https://github.com/bitcoin/bitcoin/pull/36478#issuecomment-6394577239"
     }
    ]
   },
   "conflicts": []
  }
 },
 "acks_parsed": {},
 "acks_tally": {
  "ack": 0,
  "stale_ack": 0,
  "concept_ack": 0,
  "approach_ack": 0,
  "nack": 0,
  "concept_nack": 0,
  "approach_nack": 0
 },
 "reviews": {
  "approved": 0,
  "changes_requested": 0,
  "distinct_reviewers": [
   "fametrano"
  ]
 },
 "signals": {
  "needs_rebase": false,
  "ci_failed": false,
  "mergeable_state": "clean",
  "last_author_activity": "2026-10-26T08:54:43Z",
  "last_reviewer_activity": "2026-10-25T06:52:02Z",
  "last_reviewer": "fametrano",
  "author_silent_days": 6,
  "waiting_on_author_days": 0,
  "days_since_update": 6
 },
 "refs": {
  "mentioned": [],
  "depends_on": [],
  "fixes": [],
  "linked_issues": [],
  "references": [],
  "conflicts": []
 },
 "stack": {
  "shares_commits_with": [],
  "based_on": [],
  "base_for": []
 },
 "review_paths": [],
 "body": "This is a small linter to reject confusingly named RPC arg names or RPC result fields. Generally, such names should be `snake_case`. Otherwise, there are [bugs and confusion](https://github.com/bitcoin/bitcoin/pull/35317#issue-4473659957).\n\nFor now, write a C++20 `consteval` linter that still accepts `MiXed_cAse`. In the future, it can be made stricter.",
 "commits": [
  {
   "sha": "fa0794bb623fde8abfae530a53d665331d2b88f0",
   "date": "2026-10-08T18:36:04Z",
   "message": "rpc: Check named args names at compile time"
  },
  {
   "sha": "fabdf113d377d507658557cfb5933dcd13324f10",
   "date": "2026-10-08T18:36:50Z",
   "message": "rpc: Check result field names at compile time\n\nThis also requires disabling modernize-use-emplace for now, because\nclang-tidy will incorrectly suggest to use emplace, which will not work\nwith the consteval name.\n\nDisabling should be fine, because moves are typically cheap and in-place\nconstruction is not really needed."
  }
 ],
 "timeline": [
  {
   "t": "2026-10-08T16:01:43Z",
   "kind": "comment",
   "who": "maflcko",
   "assoc": "MEMBER",
   "text": "This is a refactor, only the RPC docs change minimally:\n\n```diff\ndiff --git a/generateblock b/generateblock\nindex c552f4a..e1d1cbd 100644\n--- a/generateblock\n+++ b/generateblock\n@@ -1,2 +1,2 @@\n-generateblock \"output\" [\"rawtx/txid\",...] ( submit )\n+generateblock \"output\" [\"rawtx_or_txid\",...] ( submit )\n\n@@ -11,3 +11,3 @@ Arguments:\n      [\n-       \"rawtx/txid\",    (string)\n+       \"rawtx_or_txid\",    (string)\n        ...\ndiff --git a/getnetworkinfo b/getnetworkinfo\nindex 33b9c69..7d075f9 100644\n--- a/getnetworkinfo\n+++ b/getnetworkinfo\n@@ -18,3 +18,3 @@ Result:\n   \"inv_buckets\" : {                                  (json object)\n-    \"inbound/outbound\" : {                           (json object) connection direction\n+    \"direction\" : {                                  (json object) connection direction (inbound or outbound)\n       \"backlog\" : n,                                 (numeric) number of queued txs to announce\ndiff --git a/getprioritisedtransactions b/getprioritisedtransactions\nindex a87170f..d3dc64c 100644\n--- a/getprioritisedtransactions\n+++ b/getprioritisedtransactions\n@@ -6,3 +6,3 @@ Result:\n {                                 (json object) prioritisation keyed by txid\n-  \"<transactionid>\" : {           (json object)\n+  \"transactionid\" : {             (json object)\n     \"fee_delta\" : n,              (numeric) transaction fee delta in satoshis\ndiff --git a/getrawaddrman b/getrawaddrman\nindex 43e3219..d44bd58 100644\n--- a/getrawaddrman\n+++ b/getrawaddrman\n@@ -9,3 +9,3 @@ Result:\n   \"table\" : {                      (json object) buckets with addresses in the address manager table ( new, tried )\n-    \"bucket/position\" : {          (json object) the location in the address manager table (<bucket>/<position>)\n+    \"bucket_and_position\" : {      (json object) address manager table location, formatted as <bucket>/<position>\n       \"address\" : \"str\",           (string) The address of the node",
   "id": "c:6063918642",
   "url": "https://github.com/bitcoin/bitcoin/pull/36478#issuecomment-6063918642",
   "hash": "971aa558c1117fee",
   "edited": null
  },
  {
   "t": "2026-10-08T17:17:44Z",
   "kind": "force_push",
   "who": "maflcko",
   "commit": "fa620f0793dc9ee850e55b3f05f9072675e2e6d1",
   "id": "push:fa620f0793dc9ee850e55b3f05f9072675e2e6d1"
  },
  {
   "t": "2026-10-08T18:37:17Z",
   "kind": "force_push",
   "who": "maflcko",
   "commit": "fabdf113d377d507658557cfb5933dcd13324f10",
   "id": "push:fabdf113d377d507658557cfb5933dcd13324f10"
  },
  {
   "t": "2026-10-25T06:52:02Z",
   "kind": "comment",
   "who": "fametrano",
   "assoc": "NONE",
   "text": "tACK fabdf113d377d507658557cfb5933dcd13324f10\n\nI built the base and the head (macOS, Apple clang 21) and compared them on regtest with a script that dumps and diffs both builds. `help` for all 174 commands, hidden ones included, differs only in the four renames you listed, plus the column realignment in `generateblock` that the longer name causes. `getopenrpcinfo` is byte-identical, with and without `show_hidden`. Calls to the touched RPCs gave the same result structure under `-rpcdoccheck=1`. `rpc_tests` and ten related functional tests pass. Compile time of `rpc/blockchain.cpp`, `rpc/rawtransaction.cpp` and `wallet/rpc/spend.cpp` did not grow.\n\nI also compiled a file of deliberately bad names, one case at a time. The check rejected all of them: a space or `-` in argument names, a space, `/`, `<>` or non-ASCII in result keys, and such names nested inside `OBJ` arguments and `OBJ_DYN` results. A name built at runtime is rejected too. The errors point at the offending literal.\n\nAlias lists with empty parts still compile, such as `\"a||b\"`, `\"|\"` and `\"a|\"`. At runtime the empty part becomes a named argument called `\"\"`. Rejecting it may be worth it while you are here. I can share the script and the file as a gist.",
   "id": "c:6394577239",
   "url": "https://github.com/bitcoin/bitcoin/pull/36478#issuecomment-6394577239",
   "hash": "39697644b5a44588",
   "edited": null
  },
  {
   "t": "2026-10-26T08:54:43Z",
   "kind": "comment",
   "who": "maflcko",
   "assoc": "MEMBER",
   "text": "[quoted text omitted]\n\nI'd say that is fine, because there is no risk. The goal here is to just lint the name and slowly converge toward snake_case. Results with an empty string are valid (e.g. in arrays). And Args with an empty string shouldn't pass normal review or tests anyway. No need to lint those.",
   "id": "c:6412043412",
   "url": "https://github.com/bitcoin/bitcoin/pull/36478#issuecomment-6412043412",
   "hash": "6a83fbe0f7212b6a",
   "edited": null
  }
 ],
 "labels_log": [
  {
   "t": "2026-10-08T16:01:02Z",
   "action": "labeled",
   "label": "RPC/REST/ZMQ",
   "who": "DrahtBot"
  },
  {
   "t": "2026-10-08T17:18:43Z",
   "action": "labeled",
   "label": "CI failed",
   "who": "DrahtBot"
  },
  {
   "t": "2026-10-08T20:06:28Z",
   "action": "unlabeled",
   "label": "CI failed",
   "who": "DrahtBot"
  }
 ],
 "state_log": [
  {
   "t": "2026-10-08T16:01:00Z",
   "kind": "renamed",
   "who": "DrahtBot",
   "from": " rpc: Check named args names and result field names at compile time ",
   "to": "rpc: Check named args names and result field names at compile time"
  }
 ],
 "text_chars": 4255,
 "text_tokens_estimate": 1063,
 "changed_paths": [
  "src/.clang-tidy",
  "src/rpc/blockchain.cpp",
  "src/rpc/mempool.cpp",
  "src/rpc/mining.cpp",
  "src/rpc/net.cpp",
  "src/rpc/rawtransaction_util.cpp",
  "src/rpc/util.h",
  "src/test/rpc_tests.cpp",
  "src/wallet/rpc/addresses.cpp"
 ],
 "files": [
  {
   "path": "src/.clang-tidy",
   "add": 0,
   "del": 1
  },
  {
   "path": "src/rpc/blockchain.cpp",
   "add": 10,
   "del": 10
  },
  {
   "path": "src/rpc/mempool.cpp",
   "add": 2,
   "del": 2
  },
  {
   "path": "src/rpc/mining.cpp",
   "add": 2,
   "del": 2
  },
  {
   "path": "src/rpc/net.cpp",
   "add": 2,
   "del": 2
  },
  {
   "path": "src/rpc/rawtransaction_util.cpp",
   "add": 5,
   "del": 5
  },
  {
   "path": "src/rpc/util.h",
   "add": 57,
   "del": 12
  },
  {
   "path": "src/test/rpc_tests.cpp",
   "add": 11,
   "del": 6
  },
  {
   "path": "src/wallet/rpc/addresses.cpp",
   "add": 3,
   "del": 3
  }
 ],
 "test_lines": 17,
 "git": {
  "head": "fabdf113d377d507658557cfb5933dcd13324f10",
  "head_matches_backup": true,
  "base": "f739c7876b81304bdc72e7eaa307702da269ac31",
  "patch_id": "b65eeddf8b387d79",
  "commits": [
   {
    "sha": "fa0794bb62",
    "subject": "rpc: Check named args names at compile time",
    "files": 3,
    "add": 39,
    "del": 11
   },
   {
    "sha": "fabdf113d3",
    "subject": "rpc: Check result field names at compile time",
    "files": 8,
    "add": 53,
    "del": 32
   }
  ],
  "patch_truncated": false
 },
 "patch_id": "b65eeddf8b387d79",
 "input_hash": "c76390aabdc27b77",
 "extracted_at": "2026-11-02T01:09:49+00:00"
}