Stratum v2 Transport #30315

pull Sjors wants to merge 5 commits into bitcoin:master from Sjors:2024/06/sv2_transport changing 13 files +2447 −1
  1. Sjors commented at 3:59 pm on June 20, 2024: member

    Based on #29346. Parent PR #29432.

    Introduces Sv2Transport::Transport which is very similar to V2Transport.

    This shoehorns Sv2NetMsg into a CSerializedNetMsg in SetMessageToSend, and into a CNetMessage in GetReceivedMessage.

    See discussion in #30209.

  2. DrahtBot commented at 3:59 pm on June 20, 2024: contributor

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

    Code Coverage

    For detailed information about the code coverage, see the test coverage report.

    Reviews

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

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #29415 (Broadcast own transactions only via short-lived Tor or I2P connections by vasild)
    • #26697 (logging: use bitset for categories by LarryRuane)

    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. Sjors commented at 4:03 pm on June 20, 2024: member
    Would it make sense to add a libbitcoin_net library? Either at the same level as libbitcoin_common or on top of it. I could see how other node implementations could benefit from that, but it’s also a way to limit libbitcoin_common in size. Afaik only libbitcoin_node needs networking (and zmq?), and a future libbitcoin_sv2, and maybe libbitcoin_rpc.
  4. Sjors force-pushed on Jun 20, 2024
  5. DrahtBot added the label CI failed on Jun 20, 2024
  6. DrahtBot commented at 4:05 pm on June 20, 2024: contributor

    🚧 At least one of the CI tasks failed. Make sure to run all tests locally, according to the documentation.

    Possibly this is 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.

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

    Debug: https://github.com/bitcoin/bitcoin/runs/26477378291

  7. Sjors force-pushed on Jun 20, 2024
  8. Sjors force-pushed on Jun 21, 2024
  9. Sjors commented at 11:18 am on June 21, 2024: member

    It compiles and the tests run, but it’s not pretty.

    The conversion between Sv2NetMsg and CSerializedNetMsg / CNetMessage is done in https://github.com/bitcoin/bitcoin/pull/30315/commits/7d937674de425d8e2525bac9e719ac93a775ea45, which is a bit of a hack at the moment.

    I also haven’t put much thought into Sv2NetMsg ever since I took over #27854, so perhaps this design can be improved as well.

  10. Sjors force-pushed on Jun 21, 2024
  11. Sjors force-pushed on Jun 21, 2024
  12. sipa commented at 1:34 pm on June 21, 2024: member
    I only had a very brief look, but my guess would be that it would be easier if Sv2NetMsg did not contain an Sv2NetHeader, and just stored type and message. The Sv2 Transport would then construct the header at submitting or sending time instead. This means Sv2NetMsg would be more of a dumb container for what higher-level code cares about, while the protocol details would be more abstracted away in the Transport.
  13. DrahtBot removed the label CI failed on Jun 21, 2024
  14. Sjors force-pushed on Jun 21, 2024
  15. Sjors commented at 3:44 pm on June 21, 2024: member
    @sipa done and managed to clean up sv2_messages.h a bit in the process.
  16. in src/common/sv2_messages.h:14 in e108385a6e outdated
     9+#include <span.h>
    10+#include <streams.h>
    11+#include <string>
    12+#include <util/check.h>
    13+
    14+namespace node {
    


    Sjors commented at 3:47 pm on June 21, 2024:
    639be6df22800d2e2a170c1af74d51951597834c: this namespace is outdated, since this isn’t part of the node anymore.
  17. Sjors force-pushed on Jun 21, 2024
  18. in src/test/sv2_transport_tests.cpp:247 in 2f673b5959 outdated
    242+
    243+        // Payload
    244+        Span<const std::byte> payload_plain = MakeByteSpan(msg.data());
    245+        // TODO: truncate very long messages, about 100 bytes at the start and end
    246+        //       is probably enough for most debugging.
    247+        LogPrintLevel(BCLog::SV2, BCLog::Level::Trace, "Payload: %s\n", HexStr(payload_plain));
    


    Sjors commented at 5:15 pm on June 21, 2024:

    sipa commented at 5:20 pm on June 21, 2024:
    Pretty sure you mean MakeByteSpan(msg), not MakeByteSpan(msg.data()).

    Sjors commented at 6:15 pm on June 21, 2024:
    I did! Did I? Should be fixed now.
  19. Sjors force-pushed on Jun 21, 2024
  20. DrahtBot commented at 6:14 pm on June 21, 2024: contributor

    🚧 At least one of the CI tasks failed. Make sure to run all tests locally, according to the documentation.

    Possibly this is 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.

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

    Debug: https://github.com/bitcoin/bitcoin/runs/26526802432

  21. DrahtBot added the label CI failed on Jun 21, 2024
  22. Sjors force-pushed on Jun 24, 2024
  23. DrahtBot removed the label CI failed on Jun 24, 2024
  24. Sjors force-pushed on Jun 25, 2024
  25. Sjors force-pushed on Jun 25, 2024
  26. Sjors force-pushed on Jun 28, 2024
  27. Sjors force-pushed on Jun 28, 2024
  28. Sjors commented at 3:14 pm on June 28, 2024: member
    I dropped the refactoring commits e18887d3c45d4c0b2d414392ec33dbc36c0d8df7, cf67a72aea67b8ecf2c24200f69c68d1e7f4de4b and 912b800581ba6c21b0ed43832c6307f98e7a3af1 which move Transport and its prerequisites to libbitcoin_common. See https://github.com/Sjors/bitcoin/pull/47 for a more ambitious attempt to introduce a whole new libbitcoin_net, but that became real big and distracting real fast :-)
  29. Sjors force-pushed on Jul 1, 2024
  30. Add sv2 log category for Stratum v2 475bc78144
  31. Add sv2 noise protocol
    Co-Authored-By: Christopher Coverdale <chris.coverdale24@gmail.com>
    a2436955f5
  32. Add sv2 message CoinbaseOutputDataSize
    This commit adds the simplest stratum v2 message. The remaining messages are introduced in later commits.
    
    Co-Authored-By: Christopher Coverdale <chris.coverdale24@gmail.com>
    7a699506b3
  33. Convert between Sv2NetMsg and CSerializedNetMsg
    This allows us to subclass Transport.
    caf61c881f
  34. Introduce Sv2Transport
    Implemented starting from a copy of V2Transport and the V2TransportTester, modifying it to fit Stratum v2 and Noise Protocol requirements.
    
    Co-Authored-By: Christopher Coverdale <chris.coverdale24@gmail.com>
    Co-Authored-By: Fi3
    f6146722d4
  35. Sjors force-pushed on Jul 2, 2024

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: 2024-07-03 10:13 UTC

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