rpc: Check named args names and result field names at compile time #36478

pull maflcko wants to merge 2 commits into bitcoin:master from maflcko:2610-rpc-compile-time-names-and-fiel-names changing 9 files +92 −43
  1. maflcko commented at 4:00 PM on October 8, 2026: member

    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.

    For now, write a C++20 consteval linter that still accepts MiXed_cAse. In the future, it can be made stricter.

  2. DrahtBot renamed this:
    rpc: Check named args names and result field names at compile time
    rpc: Check named args names and result field names at compile time
    on Oct 8, 2026
  3. DrahtBot added the label RPC/REST/ZMQ on Oct 8, 2026
  4. DrahtBot commented at 4:01 PM on October 8, 2026: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    <!--006a51241073e994b41acfe9ec718e94-->

    External sites

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

    See the guideline and AI policy for information on the review process. A summary of reviews will appear here.

    <!--174a7506f384e20aa4161008e828411d-->

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #35713 <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/35713.svg"></sub> (Remove boost as a unit test runner by rustaceanrob)

    If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

    <!--5faf32d7da4f0f540f40219e4f7537a3-->

  5. maflcko commented at 4:01 PM on October 8, 2026: member

    This is a refactor, only the RPC docs change minimally:

    diff --git a/generateblock b/generateblock
    index c552f4a..e1d1cbd 100644
    --- a/generateblock
    +++ b/generateblock
    @@ -1,2 +1,2 @@
    -generateblock "output" ["rawtx/txid",...] ( submit )
    +generateblock "output" ["rawtx_or_txid",...] ( submit )
     
    @@ -11,3 +11,3 @@ Arguments:
          [
    -       "rawtx/txid",    (string)
    +       "rawtx_or_txid",    (string)
            ...
    diff --git a/getnetworkinfo b/getnetworkinfo
    index 33b9c69..7d075f9 100644
    --- a/getnetworkinfo
    +++ b/getnetworkinfo
    @@ -18,3 +18,3 @@ Result:
       "inv_buckets" : {                                  (json object)
    -    "inbound/outbound" : {                           (json object) connection direction
    +    "direction" : {                                  (json object) connection direction (inbound or outbound)
           "backlog" : n,                                 (numeric) number of queued txs to announce
    diff --git a/getprioritisedtransactions b/getprioritisedtransactions
    index a87170f..d3dc64c 100644
    --- a/getprioritisedtransactions
    +++ b/getprioritisedtransactions
    @@ -6,3 +6,3 @@ Result:
     {                                 (json object) prioritisation keyed by txid
    -  "<transactionid>" : {           (json object)
    +  "transactionid" : {             (json object)
         "fee_delta" : n,              (numeric) transaction fee delta in satoshis
    diff --git a/getrawaddrman b/getrawaddrman
    index 43e3219..d44bd58 100644
    --- a/getrawaddrman
    +++ b/getrawaddrman
    @@ -9,3 +9,3 @@ Result:
       "table" : {                      (json object) buckets with addresses in the address manager table ( new, tried )
    -    "bucket/position" : {          (json object) the location in the address manager table (<bucket>/<position>)
    +    "bucket_and_position" : {      (json object) address manager table location, formatted as <bucket>/<position>
           "address" : "str",           (string) The address of the node
    
  6. maflcko force-pushed on Oct 8, 2026
  7. DrahtBot added the label CI failed on Oct 8, 2026
  8. DrahtBot commented at 5:18 PM on October 8, 2026: contributor

    <!--85328a0da195eb286784d51f73fa0af9-->

    🚧 At least one of the CI tasks failed. <sub>Task previous releases: https://github.com/bitcoin/bitcoin/actions/runs/37805451315/job/113408400251</sub> <sub>LLM reason (✨ experimental): The build failed compiling rpc_tests.cpp: GCC 12 rejected constant evaluation of ConstevalRpcArgName construction in std::tuple.</sub>

    <details><summary>Hints</summary>

    Try to run the tests locally, according to the documentation. However, a CI failure may still happen due to a number of reasons, for example:

    • Possibly due to a silent merge conflict (the changes in this pull request being incompatible with the current code in the target branch). If so, make sure to rebase on the latest commit of the target branch.

    • A sanitizer issue, which can only be found by compiling with the sanitizer and running the affected test.

    • An intermittent issue.

    Leave a comment here, if you need help tracking down a confusing failure.

    </details>

  9. rpc: Check named args names at compile time fa0794bb62
  10. rpc: Check result field names at compile time
    This also requires disabling modernize-use-emplace for now, because
    clang-tidy will incorrectly suggest to use emplace, which will not work
    with the consteval name.
    
    Disabling should be fine, because moves are typically cheap and in-place
    construction is not really needed.
    fabdf113d3
  11. maflcko force-pushed on Oct 8, 2026
  12. DrahtBot removed the label CI failed on Oct 8, 2026

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-10-12 04:51 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me