Abstract out some of the descriptor Span-parsing helpers #16887

pull sipa wants to merge 3 commits into bitcoin:master from sipa:201909_spanparsing changing 5 files +252 −57
  1. sipa commented at 5:27 PM on September 16, 2019: member

    As suggested here: #16800 (comment).

    This moves the Span parsing functions out of the descriptor module, making them more easily usable for other parsers (in particular, in preparation for miniscript parsing).

  2. MarcoFalke added the label Refactoring on Sep 16, 2019
  3. MarcoFalke added the label Utils/log/libs on Sep 16, 2019
  4. promag commented at 6:52 PM on September 16, 2019: member

    ACK c072446b5c7fbaabcd17494d1b593b1cb5ebc314, verified it's mostly moved code - new code is just forward declarations, license and include guards.

  5. DrahtBot commented at 8:11 PM on September 16, 2019: 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:

    • #13751 (Utils and libraries: Drops the boost/algorithm/string/split.hpp dependency by l2a5b1)

    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.

  6. in src/util/spanparsing.h:20 in c072446b5c outdated
       7 | +
       8 | +#include <string>
       9 | +#include <span.h>
      10 | +
      11 | +/** Parse a constant. If successful, sp is updated to skip the constant and return true. */
      12 | +bool Const(const std::string& str, Span<const char>& sp);
    


    laanwj commented at 2:05 PM on September 18, 2019:

    with C++ throwing everything into the global namespace by default, I think these functions names (Const, Func, Expr) are too general


    MarcoFalke commented at 7:16 PM on September 18, 2019:

    Make it a namespace span :) ?


    sipa commented at 7:26 PM on September 18, 2019:

    I've moved them into a namespace spanparsing, and added some documentation.

  7. laanwj commented at 2:06 PM on September 18, 2019: member

    Concept ACK.

    Now that these functions are public, would be nice to have unit tests.

  8. Abstract out some of the descriptor Span-parsing helpers 230d43fdbc
  9. Add documenting comments to spanparsing.h 5e69aeec3f
  10. sipa force-pushed on Sep 18, 2019
  11. theStack commented at 6:46 AM on September 20, 2019: member

    utACK 230d43f 5e69aee

    Now that these functions are public, would be nice to have unit tests.

    I would be interested to work on that.

  12. sipa commented at 7:18 PM on September 20, 2019: member

    @theStack Be my guest!

  13. theStack commented at 10:16 PM on September 24, 2019: member

    @theStack Be my guest!

    Unit tests for the Span-parsing helpers are ready, will open a PR for them as soon as this one is merged in (I guess it's not possible to open a PR which depends on another PR, right?)

  14. sipa commented at 10:52 PM on September 24, 2019: member

    @theStack You can post a commit, and I can include it in my PR. You can also open a PR against my branch.

  15. fanquake commented at 11:36 PM on September 24, 2019: member

    You can post a commit, and I can include it in my PR.

    👍 Then we can have the tests alongside the changes in the same PR. @theStack obviously your changes remain attributed to you.

  16. theStack commented at 7:44 AM on September 25, 2019: member
  17. laanwj commented at 8:59 AM on September 25, 2019: member

    ACK 5e69aeec3f2a0fafd5e591b7222716f00145761d ACK f4db52f932bb18346fda2d3e1bb95290acacc12e @theStack thanks !

  18. laanwj added the label Waiting for author on Sep 30, 2019
  19. laanwj commented at 5:10 AM on October 3, 2019: member

    @sipa if you agree with @theStack's tests, please pull the commit in here

  20. sipa commented at 3:36 PM on October 3, 2019: member

    Will do next week.

  21. test: add unit tests for Span-parsing helpers
    tests the following four functions:
        - Const() [parse constant]
        - Func()  [parse function]
        - Expr()  [parse expression]
        - Split() [split up a string]
    bb36372b8f
  22. sipa commented at 1:12 AM on October 10, 2019: member

    Thanks, @theStack; I've included your commit.

  23. fanquake removed the label Waiting for author on Oct 10, 2019
  24. practicalswift commented at 4:02 PM on October 10, 2019: contributor

    The parsing heavy functions Const, Func, Expr and Split all seem like good candidates for fuzz testing (in addition to the ordinary unit testing)?

  25. MarcoFalke commented at 4:30 PM on October 10, 2019: member

    ACK bb36372b8f2bd675313ae8553ceb61f28c2c1afd

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

    Signature:

    -----BEGIN PGP SIGNED MESSAGE-----
    Hash: SHA512
    
    ACK bb36372b8f2bd675313ae8553ceb61f28c2c1afd
    -----BEGIN PGP SIGNATURE-----
    
    iQGzBAEBCgAdFiEE+rVPoUahrI9sLGYTzit1aX5ppUgFAlwqrYAACgkQzit1aX5p
    pUjmOwwAi3Ad7AG9map87wVhJiT68gHzVlnpfujDXkepHRMoqt3E2T9zQuFk1QvW
    m11WLTcf7VpTrn+zgGJ90w9HW3ovvNivHCCqwds5R+Rh2MW3u2cQJ7DkRQH7VePJ
    B+VLLRXXuCq98kzF7XGqViyqmIA10tA+0rZ2DcIH8jguRsg9mLPybDlN1z+8j2c/
    CHvb99LxnKiCHd0z7NgWXr1JsPsh97W5pnDABMybEfG3Oblh0DD/JdVf/w6cdWQD
    vD/zuy54Re0CEA8Y4CUviw0OtlfHdiRsqepumXACMxJTvA/EzxOIHpaQZpj/pDOL
    YzxHjBmrV/I4fYekscpA+uaPVwKvzHnOEQtZIBFs2/jK1FoaXfBdzSYvorj9V4q5
    +DwFPa4aye0lVslBo9sED6ehUzLsP50tF80XrLudTAEKTWjUAaIUf0Mfe/6y4Op3
    +XeEvhjOr33N7f6w3a+jdX2DR0MsRMCLZ4FPlLatGVGCfqgPtIWcxi5Bxitmdrla
    Gagqrt9v
    =NYw8
    -----END PGP SIGNATURE-----
    

    Timestamp of file with hash fb19a80d964f70a8c4b0e02b5fb1088d6d3c529398648e56d30d9e2f6fb4ba33 -

    </details>

  26. MarcoFalke commented at 4:32 PM on October 10, 2019: member

    Pretty straightforward move-only commit and then a commit adding tests, going to merge now.

  27. MarcoFalke referenced this in commit befdef8aee on Oct 10, 2019
  28. MarcoFalke merged this on Oct 10, 2019
  29. MarcoFalke closed this on Oct 10, 2019

  30. promag commented at 5:16 PM on October 10, 2019: member

    reACK 230d43fdbc41b356700b0d8a6984d69e00279ade, utACK bb36372b8f2bd675313ae8553ceb61f28c2c1afd.

  31. sidhujag referenced this in commit a7e4761106 on Oct 11, 2019
  32. MarcoFalke referenced this in commit 1f6638630e on Oct 16, 2019
  33. deadalnix referenced this in commit f206c4defc on Jul 9, 2020
  34. jasonbcox referenced this in commit 21181ec40c on Jul 9, 2020
  35. jasonbcox referenced this in commit 7dab6aa392 on Jul 9, 2020
  36. jasonbcox referenced this in commit 70e026e888 on Jul 9, 2020
  37. kittywhiskers referenced this in commit 7f4a06c72e on Oct 25, 2021
  38. kittywhiskers referenced this in commit 7180e07170 on Oct 25, 2021
  39. kittywhiskers referenced this in commit 4651c6a28f on Oct 25, 2021
  40. kittywhiskers referenced this in commit 2c6511a649 on Oct 26, 2021
  41. kittywhiskers referenced this in commit 0d19f754a0 on Oct 26, 2021
  42. kittywhiskers referenced this in commit 076d87cd0e on Oct 26, 2021
  43. kittywhiskers referenced this in commit 218fdc9c84 on Oct 28, 2021
  44. kittywhiskers referenced this in commit 164d4e515f on Oct 28, 2021
  45. kittywhiskers referenced this in commit 05287681ed on Oct 28, 2021
  46. kittywhiskers referenced this in commit a191b096d8 on Oct 28, 2021
  47. kittywhiskers referenced this in commit e534b48820 on Oct 29, 2021
  48. pravblockc referenced this in commit 6d9cad5ac1 on Nov 18, 2021
  49. DrahtBot locked this on Dec 16, 2021

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-13 18:14 UTC

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