Revert "Remove unused raw-pointer read helper from univalue" #28242

pull vincenzopalazzo wants to merge 1 commits into bitcoin:master from vincenzopalazzo:macros/revert-refactoring changing 13 files +26 −27
  1. vincenzopalazzo commented at 9:55 AM on August 9, 2023: none

    This reverts commit fa940f41eaffa4b2a28c465a10a4c12d4b8976b8.

    With this commit produce the following compilation error.

    Making all in src
    make[1]: Entering directory '/home/vincent/Github/bitcoin/src'
    make[2]: Entering directory '/home/vincent/Github/bitcoin/src'
    make[3]: Entering directory '/home/vincent/Github/bitcoin'
    make[3]: Leaving directory '/home/vincent/Github/bitcoin'
      GEN      obj/build.h
      CXX      libbitcoin_util_a-clientversion.o
      AR       libbitcoin_util.a
      CXXLD    bitcoind
      CXXLD    bitcoin-cli
      CXXLD    bitcoin-tx
      CXXLD    bitcoin-wallet
      CXXLD    bitcoin-util
      CXX      test/test_bitcoin-base58_tests.o
    test/base58_tests.cpp: In member function ‘void base58_tests::base58_EncodeBase58::test_method()’:
    test/base58_tests.cpp:26:44: error: invalid initialization of reference of type ‘const std::string&’ {aka ‘const std::__cxx11::basic_string<char>&’} from expression of type ‘const unsigned char [1462]’
       26 |     UniValue tests = read_json(json_tests::base58_encode_decode);
          |                                ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
    In file included from test/base58_tests.cpp:8:
    ./test/util/json.h:12:39: note: in passing argument 1 of ‘UniValue read_json(const std::string&)’
       12 | UniValue read_json(const std::string& jsondata);
          |                    ~~~~~~~~~~~~~~~~~~~^~~~~~~~
    test/base58_tests.cpp: In member function ‘void base58_tests::base58_DecodeBase58::test_method()’:
    test/base58_tests.cpp:46:44: error: invalid initialization of reference of type ‘const std::string&’ {aka ‘const std::__cxx11::basic_string<char>&’} from expression of type ‘const unsigned char [1462]’
       46 |     UniValue tests = read_json(json_tests::base58_encode_decode);
          |                                ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
    ./test/util/json.h:12:39: note: in passing argument 1 of ‘UniValue read_json(const std::string&)’
       12 | UniValue read_json(const std::string& jsondata);
          |                    ~~~~~~~~~~~~~~~~~~~^~~~~~~~
    make[2]: *** [Makefile:18253: test/test_bitcoin-base58_tests.o] Error 1
    make[2]: Leaving directory '/home/vincent/Github/bitcoin/src'
    make[1]: *** [Makefile:20006: all-recursive] Error 1
    make[1]: Leaving directory '/home/vincent/Github/bitcoin/src'
    make: *** [Makefile:815: all-recursive] Error 1
    

    The main problem is that we can not auto-convert an unsigned char string to a std::string.

    But why the CI did not catch this?

    cc: @MarcoFalke, @stickies-v @TheCharlatan

    <!-- *** Please remove the following help text before submitting: *** Pull requests without a rationale and clear improvement may be closed immediately. GUI-related pull requests should be opened against https://github.com/bitcoin-core/gui first. See CONTRIBUTING.md -->

    <!-- Please provide clear motivation for your patch and explain how it improves Bitcoin Core user experience or Bitcoin Core developer experience significantly: * Any test improvements or new tests that improve coverage are always welcome. * All other changes should have accompanying unit tests (see `src/test/`) or functional tests (see `test/`). Contributors should note which tests cover modified code. If no tests exist for a region of modified code, new tests should accompany the change. * Bug fixes are most welcome when they come with steps to reproduce or an explanation of the potential issue as well as reasoning for the way the bug was fixed. * Features are welcome, but might be rejected due to design or scope issues. If a feature is based on a lot of dependencies, contributors should first consider building the system outside of Bitcoin Core, if possible. * Refactoring changes are only accepted if they are required for a feature or bug fix or otherwise improve developer experience significantly. For example, most "code style" refactoring changes require a thorough explanation why they are useful, what downsides they have and why they *significantly* improve developer experience or avoid serious programming bugs. Note that code style is often a subjective matter. Unless they are explicitly mentioned to be preferred in the [developer notes](/doc/developer-notes.md), stylistic code changes are usually rejected. -->

    <!-- Bitcoin Core has a thorough review process and even the most trivial change needs to pass a lot of eyes and requires non-zero or even substantial time effort to review. There is a huge lack of active reviewers on the project, so patches often sit for a long time. -->

  2. DrahtBot commented at 9:55 AM on August 9, 2023: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

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

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

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

  3. Revert "Remove unused raw-pointer read helper from univalue"
    This reverts commit fa940f41eaffa4b2a28c465a10a4c12d4b8976b8.
    
    With this commit produce the following compilation error.
    
    ```
    Making all in src
    make[1]: Entering directory '/home/vincent/Github/bitcoin/src'
    make[2]: Entering directory '/home/vincent/Github/bitcoin/src'
    make[3]: Entering directory '/home/vincent/Github/bitcoin'
    make[3]: Leaving directory '/home/vincent/Github/bitcoin'
      GEN      obj/build.h
      CXX      libbitcoin_util_a-clientversion.o
      AR       libbitcoin_util.a
      CXXLD    bitcoind
      CXXLD    bitcoin-cli
      CXXLD    bitcoin-tx
      CXXLD    bitcoin-wallet
      CXXLD    bitcoin-util
      CXX      test/test_bitcoin-base58_tests.o
    test/base58_tests.cpp: In member function ‘void base58_tests::base58_EncodeBase58::test_method()’:
    test/base58_tests.cpp:26:44: error: invalid initialization of reference of type ‘const std::string&’ {aka ‘const std::__cxx11::basic_string<char>&’} from expression of type ‘const unsigned char [1462]’
       26 |     UniValue tests = read_json(json_tests::base58_encode_decode);
          |                                ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
    In file included from test/base58_tests.cpp:8:
    ./test/util/json.h:12:39: note: in passing argument 1 of ‘UniValue read_json(const std::string&)’
       12 | UniValue read_json(const std::string& jsondata);
          |                    ~~~~~~~~~~~~~~~~~~~^~~~~~~~
    test/base58_tests.cpp: In member function ‘void base58_tests::base58_DecodeBase58::test_method()’:
    test/base58_tests.cpp:46:44: error: invalid initialization of reference of type ‘const std::string&’ {aka ‘const std::__cxx11::basic_string<char>&’} from expression of type ‘const unsigned char [1462]’
       46 |     UniValue tests = read_json(json_tests::base58_encode_decode);
          |                                ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
    ./test/util/json.h:12:39: note: in passing argument 1 of ‘UniValue read_json(const std::string&)’
       12 | UniValue read_json(const std::string& jsondata);
          |                    ~~~~~~~~~~~~~~~~~~~^~~~~~~~
    make[2]: *** [Makefile:18253: test/test_bitcoin-base58_tests.o] Error 1
    make[2]: Leaving directory '/home/vincent/Github/bitcoin/src'
    make[1]: *** [Makefile:20006: all-recursive] Error 1
    make[1]: Leaving directory '/home/vincent/Github/bitcoin/src'
    make: *** [Makefile:815: all-recursive] Error 1
    ```
    
    The main problem is that we can not auto-convert an unsigned char string to a std::string.
    fe04b538d5
  4. vincenzopalazzo force-pushed on Aug 9, 2023
  5. dergoegge commented at 9:57 AM on August 9, 2023: member

    I had this too and iirc make clean && make worked for me.

  6. vincenzopalazzo commented at 9:59 AM on August 9, 2023: none

    I had this too and iirc make clean && make worked for me.

    Mh, let me try

  7. vincenzopalazzo commented at 10:13 AM on August 9, 2023: none

    It worked, thanks! sorry for the confusion here

  8. vincenzopalazzo closed this on Aug 9, 2023

  9. vincenzopalazzo deleted the branch on Aug 9, 2023
  10. bitcoin locked this on Aug 9, 2023

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-04-28 03:13 UTC

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