refactor: rpc: doc: Mark longpoll counter u32 #36777

pull maflcko wants to merge 1 commits into bitcoin:master from maflcko:2611-rpc-mining-doc-u32 changing 1 files +3 −3
  1. maflcko commented at 2:06 PM on November 5, 2026: member

    The counter will only ever be a valid u32 value in normal operation, so document that without changing any behavior.

    In theory, the behavior could be changed to use LocaleIndependentAtoi<uint32_t>(), but this is left for the future.

    The change is needed to be able to fuzz the rpc target.

    To test after compiling with -DSANITIZERS=undefined,integer,float-divide-by-zero:

    $ base64 /tmp/a.crash 
    Z2V0YmxvY2t0ZW1wbGF0ZVyzXC1sb25ncG9sbGlkXNHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR
    AAAAAAAAAAAAAAAgAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAABCQkJCQkJCQkJCQkJCQkJCQkJC
    QkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJC
    QkJCQkJCQkJCQkJCQkLR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR
    0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHRZ2VsA6NjA2+pYysAmfcAuMXhQwjp7WJsXA==
    
    $ FUZZ=rpc ./bld-cmake/test/with_sanitizer_env.py ./bld-cmake/bin/fuzz  /tmp/a.crash 
    src/rpc/mining.cpp:842:42: runtime error: implicit conversion from type 'long' of value 9223372036854775807 (64-bit, signed) to type 'unsigned int' changed the value to 4294967295 (32-bit, unsigned)
        [#0](/bitcoin-bitcoin/0/) 0x5603ba69a874 in getblocktemplate()::$_0::operator()(RPCMethod const&, JSONRPCRequest const&) const
    ...
    

    Or:

    $ UBSAN_OPTIONS="suppressions=$(pwd)/test/sanitizer_suppressions/ubsan:print_stacktrace=1:halt_on_error=0:report_error_type=1" ./bld-cmake/bin/bitcoind -datadir=/tmp -regtest &
    
    $ ./bld-cmake/bin/bitcoin-cli -datadir=/tmp -regtest getblocktemplate '{"rules":["segwit"],"longpollid":"00000000000000000000000000000000000000000000000000000000000000009223372036854775807"}'
    
  2. refactor: rpc: doc: Mark longpoll counter u32
    The counter will only ever be a valid u32 value in normal operation, so
    document that without changing any behavior.
    
    In theory, the behavior could be changed to use
    LocaleIndependentAtoi<uint32_t>(), but this is left for the future.
    fa8817e608
  3. DrahtBot added the label Refactoring on Nov 5, 2026
  4. DrahtBot commented at 2:06 PM on November 5, 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.

    Type Reviewers
    ACK sedited, darosior

    If your review is incorrectly listed, please copy-paste <code>&lt;!--meta-tag:bot-skip--&gt;</code> into the comment that the bot should ignore.

    <!--5faf32d7da4f0f540f40219e4f7537a3-->

  5. DrahtBot added the label CI failed on Nov 5, 2026
  6. DrahtBot removed the label CI failed on Nov 5, 2026
  7. sedited approved
  8. sedited commented at 4:57 PM on November 5, 2026: contributor

    ACK fa8817e6087e0d112f6421de47cb2bc7504b3ca1

  9. darosior approved
  10. darosior commented at 5:03 PM on November 5, 2026: member

    utACK fa8817e6087e0d112f6421de47cb2bc7504b3ca1

  11. sedited merged this on Nov 5, 2026
  12. sedited closed this on Nov 5, 2026

  13. maflcko deleted the branch on Nov 5, 2026
  14. maflcko commented at 9:26 PM on November 5, 2026: member

    Just for reference, if someone wants to reproduce this with the libstdcxx (not libc++), it requires at least clang-23, due to fix https://github.com/llvm/llvm-project/pull/210258


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-11-09 21:51 UTC

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