Replace MakeSpan helper with Span deduction guide #23413

pull sipa wants to merge 2 commits into bitcoin:master from sipa:202111_span_deduct changing 25 files +125 −124
  1. sipa commented at 8:36 PM on November 1, 2021: member

    C++17 supports user-defined deduction guides, allowing class constructors to be invoked without specifying class template arguments. Instead, the code can contain rules to infer the template arguments from the constructor argument types.

    This alleviates the need for the MakeSpan helper. Convert the existing MakeSpan rules into deduction rules for Span itself, and replace all invocations of MakeSpan with just Span ones.

  2. DrahtBot commented at 9:04 PM on November 1, 2021: member

    <!--e57a25ab6845829454e8d69fc972939a-->

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

    <!--174a7506f384e20aa4161008e828411d-->

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #23595 (util: Add ParseHexstd::byte() helper by MarcoFalke)
    • #23226 (c++20: Opt-in to modeling view and borrowed_range for Span by theuni)
    • #17034 ([BIP 174] PSBT version, proprietary, and xpub fields by achow101)

    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.

  3. DrahtBot added the label Descriptors on Nov 1, 2021
  4. DrahtBot added the label P2P on Nov 1, 2021
  5. DrahtBot added the label RPC/REST/ZMQ on Nov 1, 2021
  6. DrahtBot added the label TX fees and policy on Nov 1, 2021
  7. DrahtBot added the label Wallet on Nov 1, 2021
  8. MarcoFalke removed the label Wallet on Nov 2, 2021
  9. MarcoFalke removed the label TX fees and policy on Nov 2, 2021
  10. MarcoFalke removed the label RPC/REST/ZMQ on Nov 2, 2021
  11. MarcoFalke removed the label P2P on Nov 2, 2021
  12. MarcoFalke removed the label Descriptors on Nov 2, 2021
  13. MarcoFalke added the label Refactoring on Nov 2, 2021
  14. in src/span.h:222 in 94176a0c70 outdated
     224 | -template <typename V> constexpr auto MakeSpan(V&& v SPAN_ATTR_LIFETIMEBOUND) -> typename std::enable_if<!std::is_lvalue_reference<V>::value, Span<const typename std::remove_pointer<decltype(v.data())>::type>>::type { return std::forward<V>(v); }
     225 | -/** MakeSpan for (lvalue) references, supporting mutable output. */
     226 | -template <typename V> constexpr auto MakeSpan(V& v SPAN_ATTR_LIFETIMEBOUND) -> Span<typename std::remove_pointer<decltype(v.data())>::type> { return v; }
     227 | +// Deduction guides for Span
     228 | +// For the pointer/size based constructor:
     229 | +template <typename T> Span(T*, size_t) -> Span<T>;
    


    MarcoFalke commented at 10:51 AM on November 2, 2021:

    This is missing the (T*, T*) or (It, It) deduction. See (1) in https://en.cppreference.com/w/cpp/container/span/deduction_guides


    sipa commented at 2:20 PM on November 2, 2021:

    Indeed, fixed.

  15. in src/span.h:230 in 94176a0c70 outdated
     232 | +// For the temporaries/rvalue references constructor, only supporting const output.
     233 | +template <typename T> Span(T&&) -> Span<std::enable_if_t<!std::is_lvalue_reference_v<T>, const std::remove_pointer_t<decltype(std::declval<T&&>().data())>>>;
     234 | +// For (lvalue) references, supporting mutable output.
     235 | +template <typename T> Span(T&) -> Span<std::remove_pointer_t<decltype(std::declval<T&>().data())>>;
     236 | +// For the copy constructor
     237 | +template <typename T> Span(const Span<T>&) -> Span<T>;
    


    MarcoFalke commented at 11:13 AM on November 2, 2021:

    why is this needed?


    sipa commented at 1:58 PM on November 2, 2021:

    It is not, after reading more about deductions.

  16. MarcoFalke commented at 11:20 AM on November 2, 2021: member

    Concept ACK on moving Span closer to std::span. Though I am wondering some deductions are omitted.

    See patch:

    diff --git a/src/net.cpp b/src/net.cpp
    index ad558dd598..b323d17134 100644
    --- a/src/net.cpp
    +++ b/src/net.cpp
    @@ -738,7 +738,7 @@ std::optional<CNetMessage> V1TransportDeserializer::GetMessage(const std::chrono
         if (memcmp(hash.begin(), hdr.pchChecksum, CMessageHeader::CHECKSUM_SIZE) != 0) {
             LogPrint(BCLog::NET, "Header error: Wrong checksum (%s, %u bytes), expected %s was %s, peer=%d\n",
                      SanitizeString(msg->m_command), msg->m_message_size,
    -                 HexStr(Span<uint8_t>(hash.begin(), hash.begin() + CMessageHeader::CHECKSUM_SIZE)),
    +                 HexStr(Span{hash.begin(), hash.begin() + CMessageHeader::CHECKSUM_SIZE}),
                      HexStr(hdr.pchChecksum),
                      m_node_id);
             out_err_raw_size = msg->m_raw_message_size;
    @@ -1556,7 +1556,7 @@ void CConnman::SocketHandler()
                 if (nBytes > 0)
                 {
                     bool notify = false;
    -                if (!pnode->ReceiveMsgBytes(Span<const uint8_t>(pchBuf, nBytes), notify))
    +                if (!pnode->ReceiveMsgBytes(Span(pchBuf, nBytes), notify))
                         pnode->CloseSocketDisconnect();
                     RecordBytesRecv(nBytes);
                     if (notify) {
    diff --git a/src/netaddress.cpp b/src/netaddress.cpp
    index 97ad40aa6e..201b797a0d 100644
    --- a/src/netaddress.cpp
    +++ b/src/netaddress.cpp
    @@ -303,7 +303,7 @@ CNetAddr::CNetAddr(const struct in_addr& ipv4Addr)
     
     CNetAddr::CNetAddr(const struct in6_addr& ipv6Addr, const uint32_t scope)
     {
    -    SetLegacyIPv6(Span<const uint8_t>(reinterpret_cast<const uint8_t*>(&ipv6Addr), sizeof(ipv6Addr)));
    +    SetLegacyIPv6(Span{reinterpret_cast<const uint8_t*>(&ipv6Addr), sizeof(ipv6Addr)});
         m_scope_id = scope;
     }
     
    diff --git a/src/pubkey.h b/src/pubkey.h
    index e4e3a9560b..dcbdca8ebd 100644
    --- a/src/pubkey.h
    +++ b/src/pubkey.h
    @@ -242,7 +242,7 @@ public:
         explicit XOnlyPubKey(Span<const unsigned char> bytes);
     
         /** Construct an x-only pubkey from a normal pubkey. */
    -    explicit XOnlyPubKey(const CPubKey& pubkey) : XOnlyPubKey(Span<const unsigned char>(pubkey.begin() + 1, pubkey.begin() + 33)) {}
    +    explicit XOnlyPubKey(const CPubKey& pubkey) : XOnlyPubKey(Span{pubkey.begin() + 1, pubkey.begin() + 33}) {}
     
         /** Verify a Schnorr signature against this public key.
          *
    diff --git a/src/rpc/util.cpp b/src/rpc/util.cpp
    index 2d7f5f2894..c72f08a5ff 100644
    --- a/src/rpc/util.cpp
    +++ b/src/rpc/util.cpp
    @@ -317,7 +317,7 @@ public:
             UniValue obj(UniValue::VOBJ);
             obj.pushKV("iswitness", true);
             obj.pushKV("witness_version", (int)id.version);
    -        obj.pushKV("witness_program", HexStr(Span<const unsigned char>(id.program, id.length)));
    +        obj.pushKV("witness_program", HexStr(Span{id.program, id.length}));
             return obj;
         }
     };
    diff --git a/src/script/descriptor.cpp b/src/script/descriptor.cpp
    index 95611fc909..b023d199d5 100644
    --- a/src/script/descriptor.cpp
    +++ b/src/script/descriptor.cpp
    @@ -1251,7 +1251,7 @@ std::unique_ptr<PubkeyProvider> InferXOnlyPubkey(const XOnlyPubKey& xkey, ParseS
     std::unique_ptr<DescriptorImpl> InferScript(const CScript& script, ParseScriptContext ctx, const SigningProvider& provider)
     {
         if (ctx == ParseScriptContext::P2TR && script.size() == 34 && script[0] == 32 && script[33] == OP_CHECKSIG) {
    -        XOnlyPubKey key{Span<const unsigned char>{script.data() + 1, script.data() + 33}};
    +        XOnlyPubKey key{Span{script.data() + 1, script.data() + 33}};
             return std::make_unique<PKDescriptor>(InferXOnlyPubkey(key, ctx, provider));
         }
     
    diff --git a/src/script/interpreter.cpp b/src/script/interpreter.cpp
    index eafa9840d7..2d84a28981 100644
    --- a/src/script/interpreter.cpp
    +++ b/src/script/interpreter.cpp
    @@ -1858,7 +1858,7 @@ uint256 ComputeTaprootMerkleRoot(Span<const unsigned char> control, const uint25
         uint256 k = tapleaf_hash;
         for (int i = 0; i < path_len; ++i) {
             CHashWriter ss_branch{HASHER_TAPBRANCH};
    -        Span<const unsigned char> node(control.data() + TAPROOT_CONTROL_BASE_SIZE + TAPROOT_CONTROL_NODE_SIZE * i, TAPROOT_CONTROL_NODE_SIZE);
    +        Span node{control.data() + TAPROOT_CONTROL_BASE_SIZE + TAPROOT_CONTROL_NODE_SIZE * i, TAPROOT_CONTROL_NODE_SIZE};
             if (std::lexicographical_compare(k.begin(), k.end(), node.begin(), node.end())) {
                 ss_branch << k << node;
             } else {
    @@ -1874,7 +1874,7 @@ static bool VerifyTaprootCommitment(const std::vector<unsigned char>& control, c
         assert(control.size() >= TAPROOT_CONTROL_BASE_SIZE);
         assert(program.size() >= uint256::size());
         //! The internal pubkey (x-only, so no Y coordinate parity).
    -    const XOnlyPubKey p{Span<const unsigned char>{control.data() + 1, control.data() + TAPROOT_CONTROL_BASE_SIZE}};
    +    const XOnlyPubKey p{Span{control.data() + 1, control.data() + TAPROOT_CONTROL_BASE_SIZE}};
         //! The output pubkey (taken from the scriptPubKey).
         const XOnlyPubKey q{program};
         // Compute the Merkle root from the leaf and the provided path.
    diff --git a/src/signet.cpp b/src/signet.cpp
    index aafd1999ee..68fbbc9388 100644
    --- a/src/signet.cpp
    +++ b/src/signet.cpp
    @@ -38,7 +38,7 @@ static bool FetchAndClearCommitmentSection(const Span<const uint8_t> header, CSc
         std::vector<uint8_t> pushdata;
         while (witness_commitment.GetOp(pc, opcode, pushdata)) {
             if (pushdata.size() > 0) {
    -            if (!found_header && pushdata.size() > (size_t) header.size() && Span<const uint8_t>(pushdata.data(), header.size()) == header) {
    +            if (!found_header && pushdata.size() > (size_t)header.size() && Span{pushdata.data(), header.size()} == header) {
                     // pushdata only counts if it has the header _and_ some data
                     result.insert(result.end(), pushdata.begin() + header.size(), pushdata.end());
                     pushdata.erase(pushdata.begin() + header.size(), pushdata.end());
    diff --git a/src/span.h b/src/span.h
    index 71de70b64f..b04fdd45d1 100644
    --- a/src/span.h
    +++ b/src/span.h
    @@ -218,16 +218,14 @@ public:
     };
     
     // Deduction guides for Span
    -// For the pointer/size based constructor:
    -template <typename T> Span(T*, size_t) -> Span<T>;
    +// For the pointer/size based and iterator based constructor:
    +template <typename T, typename EndOrSize> Span(T*, EndOrSize) -> Span<T>;
     // For the array constructor:
     template <typename T, std::size_t N> Span(T (&)[N]) -> Span<T>;
     // For the temporaries/rvalue references constructor, only supporting const output.
     template <typename T> Span(T&&) -> Span<std::enable_if_t<!std::is_lvalue_reference_v<T>, const std::remove_pointer_t<decltype(std::declval<T&&>().data())>>>;
     // For (lvalue) references, supporting mutable output.
     template <typename T> Span(T&) -> Span<std::remove_pointer_t<decltype(std::declval<T&>().data())>>;
    -// For the copy constructor
    -template <typename T> Span(const Span<T>&) -> Span<T>;
     
     /** Pop the last element off a span, and return a reference to that element. */
     template <typename T>
    diff --git a/src/test/fuzz/asmap.cpp b/src/test/fuzz/asmap.cpp
    index d402f8632c..dc37d068d9 100644
    --- a/src/test/fuzz/asmap.cpp
    +++ b/src/test/fuzz/asmap.cpp
    @@ -49,7 +49,7 @@ FUZZ_TARGET(asmap)
         CNetAddr net_addr;
         if (ipv6) {
             assert(addr_size == ADDR_IPV6_SIZE);
    -        net_addr.SetLegacyIPv6(Span<const uint8_t>(addr_data, addr_size));
    +        net_addr.SetLegacyIPv6(Span{addr_data, addr_size});
         } else {
             assert(addr_size == ADDR_IPV4_SIZE);
             in_addr ipv4;
    diff --git a/src/test/fuzz/utxo_snapshot.cpp b/src/test/fuzz/utxo_snapshot.cpp
    index 8d2a06f11a..d625403fa0 100644
    --- a/src/test/fuzz/utxo_snapshot.cpp
    +++ b/src/test/fuzz/utxo_snapshot.cpp
    @@ -38,7 +38,7 @@ FUZZ_TARGET_INIT(utxo_snapshot, initialize_chain)
         {
             CAutoFile outfile{fsbridge::fopen(snapshot_path, "wb"), SER_DISK, CLIENT_VERSION};
             const auto file_data{ConsumeRandomLengthByteVector(fuzzed_data_provider)};
    -        outfile << Span<const uint8_t>{file_data};
    +        outfile << Span{file_data};
         }
     
         const auto ActivateFuzzedSnapshot{[&] {
    diff --git a/src/test/util_tests.cpp b/src/test/util_tests.cpp
    index b1300d06ba..a97dc83a3e 100644
    --- a/src/test/util_tests.cpp
    +++ b/src/test/util_tests.cpp
    @@ -142,13 +142,13 @@ BOOST_AUTO_TEST_CASE(util_HexStr)
             "04678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5f");
     
         BOOST_CHECK_EQUAL(
    -        HexStr(Span<const unsigned char>(
    -               ParseHex_expected + sizeof(ParseHex_expected),
    -               ParseHex_expected + sizeof(ParseHex_expected))),
    +        HexStr(Span{
    +            ParseHex_expected + sizeof(ParseHex_expected),
    +            ParseHex_expected + sizeof(ParseHex_expected)}),
             "");
     
         BOOST_CHECK_EQUAL(
    -        HexStr(Span<const unsigned char>(ParseHex_expected, ParseHex_expected)),
    +        HexStr(Span{ParseHex_expected, ParseHex_expected}),
             "");
     
         std::vector<unsigned char> ParseHex_vec(ParseHex_expected, ParseHex_expected + 5);
    diff --git a/src/wallet/rpcdump.cpp b/src/wallet/rpcdump.cpp
    index 1f13b80f3e..48ed50b9a8 100644
    --- a/src/wallet/rpcdump.cpp
    +++ b/src/wallet/rpcdump.cpp
    @@ -35,7 +35,7 @@ std::string static EncodeDumpString(const std::string &str) {
         std::stringstream ret;
         for (const unsigned char c : str) {
             if (c <= 32 || c >= 128 || c == '%') {
    -            ret << '%' << HexStr(Span<const unsigned char>(&c, 1));
    +            ret << '%' << HexStr(Span{&c, 1});
             } else {
                 ret << c;
             }
    
  17. sipa force-pushed on Nov 2, 2021
  18. sipa commented at 2:21 PM on November 2, 2021: member

    Thanks, @MarcoFalke! I've incorporated your suggested changes, plus a few additional simplifications in a second commit.

  19. sipa force-pushed on Nov 2, 2021
  20. sipa force-pushed on Nov 2, 2021
  21. in src/net.cpp:1560 in 3576b9393c outdated
    1556 | @@ -1557,7 +1557,7 @@ void CConnman::SocketHandler()
    1557 |              if (nBytes > 0)
    1558 |              {
    1559 |                  bool notify = false;
    1560 | -                if (!pnode->ReceiveMsgBytes(Span<const uint8_t>(pchBuf, nBytes), notify))
    1561 | +                if (!pnode->ReceiveMsgBytes({pchBuf, (size_t)nBytes}, notify))
    


    MarcoFalke commented at 10:34 AM on November 3, 2021:

    nit in the second commit, if you retouch:

    Add {} to the if body?


    sipa commented at 9:27 PM on November 17, 2021:

    Done.

  22. in src/script/descriptor.cpp:977 in abd1f61f6e outdated
     972 | @@ -973,10 +973,10 @@ std::unique_ptr<PubkeyProvider> ParsePubkeyInner(uint32_t key_exp_index, const S
     973 |      }
     974 |      KeyPath path;
     975 |      DeriveType type = DeriveType::NO;
     976 | -    if (split.back() == MakeSpan("*").first(1)) {
     977 | +    if (split.back() == Span{"*"}.first(1)) {
    


    MarcoFalke commented at 6:11 PM on November 10, 2021:

    unrelated fun fact:

    You could write Span{std::string_view{"*"}} and get rid of the .first() call.

    (Same below)


    sipa commented at 9:27 PM on November 17, 2021:

    I don't think that's all that better.

  23. in src/test/util_tests.cpp:152 in 3576b9393c outdated
     151 |      BOOST_CHECK_EQUAL(
     152 | -        HexStr(Span<const unsigned char>(ParseHex_expected, ParseHex_expected)),
     153 | +        HexStr(Span{ParseHex_expected}.first(0)),
     154 |          "");
     155 |  
     156 |      std::vector<unsigned char> ParseHex_vec(ParseHex_expected, ParseHex_expected + 5);
    


    MarcoFalke commented at 6:25 PM on November 10, 2021:

    3576b9393c678352b2ed8a446a62d9639b0a451c: now unused?


    sipa commented at 9:27 PM on November 17, 2021:

    Gone.

  24. MarcoFalke commented at 6:29 PM on November 10, 2021: member

    review ACK 3576b9393c678352b2ed8a446a62d9639b0a451c 🚛

    <details><summary>Show signature and timestamp</summary>

    Signature:

    -----BEGIN PGP SIGNED MESSAGE-----
    Hash: SHA512
    
    review ACK 3576b9393c678352b2ed8a446a62d9639b0a451c 🚛
    -----BEGIN PGP SIGNATURE-----
    
    iQGzBAEBCgAdFiEE+rVPoUahrI9sLGYTzit1aX5ppUgFAlwqrYAACgkQzit1aX5p
    pUhMqAv/ZMtShuhel+aDB8nQ6xqbVI2SXNOyeXScpWHbu46r1c5dWTlVYgXtHrWM
    EXuNFkzMJioCbuWkWbauvox8ccZopPkRBdKseU9jUi/jz+5zp4pK5g0X8WhU1v12
    tYL5sQSGCTbl8yKY/L+mSNnoAe0rVAD7nuEAmCLeGU6c8Uv8nz0aj/w6AtDusAD0
    K7mJIJpks61r0svCodkCIwWSP+0EmUWOhoEdWdkPywV6F0QeJ2vgVL2Dj507xgMG
    BEcCbNX2IdPrYYkybTHKJBlgOaG7+QSMm2rq2MKukSq7Q+ctss0mlA/KT446tTp8
    L+5MkXZZDm6m4Kj63ceWU9VF8pVwWNF5F/yvzZobF8lB4wAJo8UORFEAzt8zr9n1
    FesE9xru65XvEFyFi0YFYz46D5zX33nbPfe+JRJ1RKRkRXCEJ6XDud7PLhJjjFtc
    Y+d8+mCe0A/Fs15kVbv5bZCy4pA1OO6hjYMHsjAzAqWVc4073GCmVIJpYgelcQfU
    932Fjcwc
    =KdJ0
    -----END PGP SIGNATURE-----
    

    </details>

  25. MarcoFalke commented at 6:31 PM on November 10, 2021: member

    I haven't tried, but to the second commit you might be able to add (after a rebase):

    diff --git a/src/test/key_io_tests.cpp b/src/test/key_io_tests.cpp
    index 0361618c82..02268dbcf5 100644
    --- a/src/test/key_io_tests.cpp
    +++ b/src/test/key_io_tests.cpp
    @@ -46,7 +46,7 @@ BOOST_AUTO_TEST_CASE(key_io_valid_parse)
                 privkey = DecodeSecret(exp_base58string);
                 BOOST_CHECK_MESSAGE(privkey.IsValid(), "!IsValid:" + strTest);
                 BOOST_CHECK_MESSAGE(privkey.IsCompressed() == isCompressed, "compressed mismatch:" + strTest);
    -            BOOST_CHECK_MESSAGE(Span<const uint8_t>{privkey} == Span<const uint8_t>{exp_payload}, "key mismatch:" + strTest);
    +            BOOST_CHECK_MESSAGE(Span{privkey} == Span{exp_payload}, "key mismatch:" + strTest);
     
                 // Private key must be invalid public key
                 destination = DecodeDestination(exp_base58string);
    
  26. sipa force-pushed on Nov 17, 2021
  27. sipa commented at 9:28 PM on November 17, 2021: member

    @MarcoFalke Done (it necessitated adding CKey::data, but that's generally useful in any case).

    EDIT: nvm, the CKey::data was just added, I noticed in rebase.

  28. sipa force-pushed on Nov 17, 2021
  29. sipa commented at 9:39 PM on November 17, 2021: member

    Rebased and addressed some comments.

  30. MarcoFalke commented at 10:44 AM on November 24, 2021: member

    re-ACK f90d5ae1cf5b002fe7ec1fa54e022513589721de 👤

    Changes:

    • Additional change MakeSpan -> Span in the first commit after rebase on 5ccab7187b35142e03c15dd55390e45b3d233c52
    • In the second commit:
      • Add {} for style
      • Remove now-unused template arguments from a Span constructor call
      • Remove now-unused ParseHex_vec symbol from tests

    <details><summary>Show signature and timestamp</summary>

    Signature:

    -----BEGIN PGP SIGNED MESSAGE-----
    Hash: SHA512
    
    re-ACK f90d5ae1cf5b002fe7ec1fa54e022513589721de 👤
    
    Changes:
    * Additional change MakeSpan -> Span in the first commit after rebase on 5ccab7187b35142e03c15dd55390e45b3d233c52
    * In the second commit:
      - Add {} for style
      - Remove now-unused template arguments from a Span constructor call
      - Remove now-unused ParseHex_vec symbol from tests 
    -----BEGIN PGP SIGNATURE-----
    
    iQGzBAEBCgAdFiEE+rVPoUahrI9sLGYTzit1aX5ppUgFAlwqrYAACgkQzit1aX5p
    pUhvOQv9Gk6tz4eLv4pt3y9sh4sUGDkgmTog83oA3Fom5bk7dQvvZjTL7aK655Vc
    DB9X4NNWQHlxB49cbKlBM5jsaoZU/cryuq2Mk1g0nkSgWeNN6MARCT79cW6t4R0S
    imBkqiDbyxzx8aErRbnM7MP5GZdf9Ax6XoRNfYmAIEkuo7rsn8kO8kMnsxL1DmX5
    PkKEZF5qm575xEOydZeAtvUJijnTS9J8gIRwSu6KfVeP/hBy6HGkfDxEmUJQBQ6T
    sswHcbNJ4BuGU2IdX/C3kIz2SzWGRpmHBm7KEhA5BoLcUm+KF1G6V8CEVMtp5ls1
    LAWv7M7WqgdsbkArKltsj4MiXapl1+x+skZP4Coisiq/McAzTg9XYditcS1zj6Xb
    1GpnPu//ffdVr64VEwPYigHsogJejFBCHek/VL54aGuWgSRcYQ4D3oSKcDwpP2eq
    Zc06Xl+Gg/rtxGACnzditb/KpDGZbasy2S/3V2EW6hpf/kit/xHAJzUzQ0I+ARMn
    VFtCbN6b
    =oaY7
    -----END PGP SIGNATURE-----
    

    </details>

  31. DrahtBot added the label Needs rebase on Nov 24, 2021
  32. MarcoFalke commented at 11:24 AM on November 24, 2021: member

    message.txt:

    re-ACK f90d5ae1cf5b002fe7ec1fa54e022513589721de
    
    Changes:
    * Additional change MakeSpan -> Span in the first commit after rebase on 5ccab7187b35142e03c15dd55390e45b3d233c52
    * In the second commit:
      - Add {} for style
      - Remove now-unused template arguments from a Span constructor call
      - Remove now-unused ParseHex_vec symbol from tests 
    

    allowed_sig.txt:

    MarcoFalke_sign_github_comments_test ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDYEowis4rvh+A4j2/2CeE7Sx/go9mzv8D7HiFRICGGl
    

    message.txt.sig:

    -----BEGIN SSH SIGNATURE-----
    U1NIU0lHAAAAAQAAADMAAAALc3NoLWVkMjU1MTkAAAAgNgSjCKziu+H4DiPb/YJ4TtLH+C
    j2bO/wPseIVEgIYaUAAAAEZmlsZQAAAAAAAAAGc2hhNTEyAAAAUwAAAAtzc2gtZWQyNTUx
    OQAAAEBrIf/Uab6AwMKfzBPP67zQZGpePmSDs5qtrO6w7ympI3EuiCXl655I7TIhN+Y4jN
    DL5tCD8EJ5Kew8AR65PBAD
    -----END SSH SIGNATURE-----
    

    To check:

    $ ssh-keygen -Y verify -f allowed_sig.txt -I MarcoFalke_sign_github_comments_test -n file -s message.txt.sig < message.txt
    
  33. sipa commented at 10:16 PM on November 24, 2021: member

    Rebased.

  34. sipa force-pushed on Nov 24, 2021
  35. DrahtBot removed the label Needs rebase on Nov 24, 2021
  36. in src/test/util_tests.cpp:174 in e4aec1e0cb outdated
     167 | @@ -170,6 +168,10 @@ BOOST_AUTO_TEST_CASE(span_write_bytes)
     168 |      mut_bytes[1] = std::byte{0x11};
     169 |      BOOST_CHECK_EQUAL(mut_arr.at(0), 0xaa);
     170 |      BOOST_CHECK_EQUAL(mut_arr.at(1), 0x11);
     171 | +    BOOST_CHECK_EQUAL(
     172 | +        HexStr(Span{ParseHex_expected}.first(5)),
     173 | +        "04678afdb0"
     174 | +    );
    


    MarcoFalke commented at 7:24 AM on November 25, 2021:

    wrong place for this test?


    MarcoFalke commented at 8:23 AM on November 29, 2021:

    Do you plan to address this or leave it?


    sipa commented at 11:07 PM on November 29, 2021:

    Done.

  37. MarcoFalke approved
  38. MarcoFalke commented at 7:24 AM on November 25, 2021: member

    re-ACK e4aec1e0cbdc237a26713a34f465e2b485f892f6 🕙

    <details><summary>Show signature</summary>

    Signature:

    -----BEGIN PGP SIGNED MESSAGE-----
    Hash: SHA512
    
    re-ACK e4aec1e0cbdc237a26713a34f465e2b485f892f6 🕙
    -----BEGIN PGP SIGNATURE-----
    
    iQGzBAEBCgAdFiEE+rVPoUahrI9sLGYTzit1aX5ppUgFAlwqrYAACgkQzit1aX5p
    pUgCHAwAic9QG7p6GHs7HQoWstGWqMYJcHHK9R3unb65d8NqlQIGUF+5X4N/V0o/
    LTAbZf+Ug+kiUwREEyldTOeJo9WGr1lRQFs5EyHTuB1QGZ0E2p8+0RNc31KUj3Ev
    x5sCgGGsDVJrtEt4wbHclqsRebdmIl+AZVLqt3J/dP7sktKwoUU260TCjXrwQnpz
    q1S3d6ySfmMdhTU3pWCilGLO6EYZUwJdM2WQD8Ss75CnvkTRadOu1FJTKXbnPySL
    krttLbYmCFVqpm9R/MUZRrUKNZ5uPzBfpCRHv/b7XeL6CNJTXYAHZWI93Zlcr4dl
    4CAPi5Xbd0tFF0CdLACxXwHQCF6DUEWFFWGhzX+oxKO5/yVOTbWQJBJLuwaLIR9C
    rT1GALRBw7LxPCPAZGYI8h6tC76k3BcSpurLjpOHqEFVZ8eXjfxCjsUXnVsV3PP9
    I09rN4lMHBRujs45GNG0QlHzpMYauVhKvjnxh4Z0uu1F/C9U90rqpwdsf3fPet5z
    r6nD5eYi
    =NXdG
    -----END PGP SIGNATURE-----
    

    </details>

  39. fanquake requested review from theuni on Nov 25, 2021
  40. Replace MakeSpan helper with Span deduction guide 568dd2f839
  41. More Span simplifications
    Based on suggestions by MarcoFalke <falke.marco@gmail.com>
    11daf6ceb1
  42. sipa force-pushed on Nov 29, 2021
  43. MarcoFalke commented at 12:45 PM on November 30, 2021: member

    re-ACK 11daf6ceb1d9ea1f8d638b123eecfe39d162a7c3 Only change is removing a hunk in the tests 🌕

    <details><summary>Show signature</summary>

    Signature:

    -----BEGIN PGP SIGNED MESSAGE-----
    Hash: SHA512
    
    re-ACK 11daf6ceb1d9ea1f8d638b123eecfe39d162a7c3 Only change is removing a hunk in the tests 🌕
    -----BEGIN PGP SIGNATURE-----
    
    iQGzBAEBCgAdFiEE+rVPoUahrI9sLGYTzit1aX5ppUgFAlwqrYAACgkQzit1aX5p
    pUjhgwv9H9NYRuLgLxngpX1oUqgWdlwre+eOwKtTSrdbWwe16zq9g0+CKKo+UZS9
    YOuhAicaZ8qdq2Oy65KTaZopQUSOFBV2A3B+BjwoKe4wOrUo7Wb6xcxR39/xbWzI
    KyS8uutOqStRmeQUsyLUh/Hq1LmQFR5AJ4RVURA3sLr79BlMo94J52TacjjDUoFN
    jLr2UP4b86E4x42AIf9kVl8HRSsWdIK62OXujnY32DTlw5uoa12L6PuhE5wACb9l
    cD3kw6/a+v2S6Zxxke9tCG5vZ5C/ZwhHA5W4FSUHbDU5NTvcbigG9h92nEyINmGD
    i7ZhZmPo1UQcpohAZdF8DvXWAa2etLyvSOLN/PE37OyuSGaD21A5rTBLorp+EHeC
    Y5WlY/MKmSlFTU+AWKBQi3Q9eiNMAD8XK+36JSY3dlwWla9ClSiFXVVWH3vT+71B
    Nj8I69a0IMN+WpRjWAOinYk0gRf4UsxeqayaRTFjSVvSWCq+99XBO3e0oKj2iYSC
    utKtL3DU
    =fUa/
    -----END PGP SIGNATURE-----
    

    </details>

  44. DrahtBot commented at 8:37 AM on December 3, 2021: member

    <!--cf906140f33d8803c4a75a2196329ecb-->

    🐙 This pull request conflicts with the target branch and needs rebase.

    <sub>Want to unsubscribe from rebase notifications on this pull request? Just convert this pull request to a "draft".</sub>

  45. DrahtBot added the label Needs rebase on Dec 3, 2021
  46. MarcoFalke merged this on Dec 3, 2021
  47. MarcoFalke closed this on Dec 3, 2021

  48. in src/wallet/rpcdump.cpp:38 in 11daf6ceb1
      34 | @@ -35,7 +35,7 @@ std::string static EncodeDumpString(const std::string &str) {
      35 |      std::stringstream ret;
      36 |      for (const unsigned char c : str) {
      37 |          if (c <= 32 || c >= 128 || c == '%') {
      38 | -            ret << '%' << HexStr(Span<const unsigned char>(&c, 1));
    


    fanquake commented at 10:32 AM on December 3, 2021:

    If anyone is confused about the bot marking this as needing a rebase, and then the merge. The conflict was in src/wallet/rpcdump.cpp. The conflicting code was moved from there, to src/wallet/rpc/backup.cpp in #23647. You can see src/wallet/rpc/backup.cpp being updated in the merge commit: https://github.com/bitcoin/bitcoin/commit/8b1de78577a02300340cec37e26cd6418ef6e645#diff-c4eeb9bd8e84ac276465d100d6ac4c1c9b9ddc145827a03dfe11932598b028b9R38.


    MarcoFalke commented at 10:45 AM on December 3, 2021:

    yeah, daily reminder to stop trusting GitHub metadata

  49. sidhujag referenced this in commit 9f654d880a on Dec 3, 2021
  50. RandyMcMillan referenced this in commit 52e9b7c14c on Dec 23, 2021
  51. ftrader referenced this in commit 25d99c1b34 on Nov 30, 2022
  52. DrahtBot locked this on Dec 3, 2022

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-19 09:14 UTC

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