rpc: doc: Added longpollid and data params to template_request #28056

pull ItIsOHM wants to merge 1 commits into bitcoin:master from ItIsOHM:update-getblocktemplate-rhythm changing 1 files +2 −0
  1. ItIsOHM commented at 6:57 am on July 9, 2023: contributor

    This PR will add the optional parameters longpollid and data to template_request as they were missing when calling help getblocktemplate in RPCHelpMan.

    I request the maintainers to review this and let me know about any mistakes in the descriptions of the parameters.

    This PR refers to the issue #27998

  2. DrahtBot commented at 6:57 am on July 9, 2023: contributor

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

    Reviews

    See the guideline for information on the review process.

    Type Reviewers
    ACK stickies-v, russeree
    Concept ACK luke-jr

    If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.

  3. DrahtBot added the label CI failed on Jul 9, 2023
  4. MarcoFalke commented at 9:51 am on July 9, 2023: member
    This doesn’t compile. Ideally, you compile and test any changes locally before opening a pull request.
  5. ItIsOHM commented at 5:34 pm on July 9, 2023: contributor

    This doesn’t compile. Ideally, you compile and test any changes locally before opening a pull request.

    I see, I’ll try to compile it on my end and will let you know if there’s any issue. Also, can you please check the description for the new parameters added if they need any changes?

  6. in src/rpc/mining.cpp:569 in 95e68778eb outdated
    565@@ -566,6 +566,8 @@ static RPCHelpMan getblocktemplate()
    566                     {"segwit", RPCArg::Type::STR, RPCArg::Optional::NO, "(literal) indicates client side segwit support"},
    567                     {"str", RPCArg::Type::STR, RPCArg::Optional::OMITTED, "other client side supported softfork deployment"},
    568                 }},
    569+                {"longpollid", RPCArg::Type::STR, RPCArg::Optional::OMITTED, " "longpollid" of job to monitor for expiration; required and valid only for long poll requests"},
    


    luke-jr commented at 6:06 pm on July 9, 2023:
    0                {"longpollid", RPCArg::Type::STR, RPCArg::Optional::OMITTED, "Delay processing request until the result would vary significantly from the \"longpollid\" of a prior template."},
    

    It doesn’t necessarily imply the previous template is expired.

  7. in src/rpc/mining.cpp:570 in 95e68778eb outdated
    565@@ -566,6 +566,8 @@ static RPCHelpMan getblocktemplate()
    566                     {"segwit", RPCArg::Type::STR, RPCArg::Optional::NO, "(literal) indicates client side segwit support"},
    567                     {"str", RPCArg::Type::STR, RPCArg::Optional::OMITTED, "other client side supported softfork deployment"},
    568                 }},
    569+                {"longpollid", RPCArg::Type::STR, RPCArg::Optional::OMITTED, " "longpollid" of job to monitor for expiration; required and valid only for long poll requests"},
    570+                {"data", RPCResult::Type::STR_HEX, RPCArg::Optional::OMITTED, "Block data encoded in hexadecimal"},
    


    luke-jr commented at 6:09 pm on July 9, 2023:
    0                {"data", RPCResult::Type::STR_HEX, RPCArg::Optional::OMITTED, "Proposed block data to check, encoded in hexadecimal; valid only for mode=\"proposal\""},
    
  8. luke-jr changes_requested
  9. ItIsOHM commented at 7:20 pm on July 9, 2023: contributor

    This doesn’t compile. Ideally, you compile and test any changes locally before opening a pull request.

    Hey so I was trying to build it after adding the changes you suggested, but i’m getting this error in VS, as I’m building on Windows 11. Can you please help what this means? image

    I followed this guide and opened bitcoin.sln in VS.

  10. sipa commented at 7:38 pm on July 9, 2023: member
    I strongly recommend not building in Windows/MSVC, as it’s a venture on its own to get that to work. In a Linux VM, or WSL2, it should be fairly straightforward.
  11. ItIsOHM commented at 7:47 pm on July 9, 2023: contributor

    I strongly recommend not building in Windows/MSVC, as it’s a venture on its own to get that to work. In a Linux VM, or WSL2, it should be fairly straightforward.

    Ohh I see! Then I’ll install WSL2 and try building it from there. I suppose this guide should be enough to get it working?

  12. ItIsOHM commented at 12:57 pm on July 10, 2023: contributor
    Hey there, I fixed the descriptions as suggested, and ran the tests and was able to build Bitcoin Core locally successfully.
  13. in vcpkg:1 in 70d888d130


    MarcoFalke commented at 1:09 pm on July 10, 2023:
    Stray file?

    ItIsOHM commented at 1:17 pm on July 10, 2023:
    Oh I’m sorry I must have forgotten to discard everything other than mining.cpp. Should I revert this commit, or something else?
  14. ItIsOHM commented at 3:36 pm on July 10, 2023: contributor
    Hey @MarcoFalke should I revert the last commit? All checks except the lint test are passing.
  15. sipa commented at 3:46 pm on July 10, 2023: member
    Don’t revert the commit; just remove the stray file and squash.
  16. ItIsOHM force-pushed on Jul 10, 2023
  17. ItIsOHM commented at 4:01 pm on July 10, 2023: contributor

    Don’t revert the commit; just remove the stray file and squash.

    I think it should be fine now, can you please check once again?

  18. sipa commented at 4:02 pm on July 10, 2023: member
  19. ItIsOHM commented at 4:04 pm on July 10, 2023: contributor

    You need to squash the commits. See https://github.com/bitcoin/bitcoin/blob/master/CONTRIBUTING.md#squashing-commits

    I think I did squash them, atleast that’s what it shows in the commits tab.

  20. sipa commented at 4:05 pm on July 10, 2023: member
    Apologies, you did indeed! The commit title is “Deleted stray file vcpkg” now, though.
  21. ItIsOHM commented at 4:06 pm on July 10, 2023: contributor

    Apologies, you did indeed!

    No worries, thanks for the guidance throughout this PR!

  22. ItIsOHM commented at 4:26 pm on July 10, 2023: contributor

    Apologies, you did indeed! The commit title is “Deleted stray file vcpkg” now, though.

    Should I amend this commit or leave it as it is? I’m not sure if I can change the commit name now.

  23. sipa commented at 4:53 pm on July 10, 2023: member
    Yes, amend the commit title to be accurate. You can rewrite the entire PR at any point (until it’s merged, obviously).
  24. ItIsOHM force-pushed on Jul 10, 2023
  25. DrahtBot removed the label CI failed on Jul 10, 2023
  26. ItIsOHM commented at 7:48 pm on July 10, 2023: contributor
    Hey there, is this PR ready to merge if there aren’t any errors?
  27. sipa commented at 8:32 pm on July 10, 2023: member
    People will need to review it.
  28. in src/rpc/mining.cpp:570 in d8cd80c592 outdated
    565@@ -566,6 +566,8 @@ static RPCHelpMan getblocktemplate()
    566                     {"segwit", RPCArg::Type::STR, RPCArg::Optional::NO, "(literal) indicates client side segwit support"},
    567                     {"str", RPCArg::Type::STR, RPCArg::Optional::OMITTED, "other client side supported softfork deployment"},
    568                 }},
    569+                {"longpollid", RPCArg::Type::STR, RPCArg::Optional::OMITTED, "Delay processing request until the result would vary significantly from the \"longpollid\" of a prior template."},
    570+                {"data", RPCArg::Type::STR_HEX, RPCArg::Optional::OMITTED, "Proposed block data to check, encoded in hexadecimal; valid only for mode=\"proposal\""},
    


    russeree commented at 8:35 am on July 11, 2023:
    Should start with a lowercase letter since only grammatical articles have capitalized first letters for this documentation. (A, The, This). Similar to review item number one.
  29. in src/rpc/mining.cpp:569 in d8cd80c592 outdated
    565@@ -566,6 +566,8 @@ static RPCHelpMan getblocktemplate()
    566                     {"segwit", RPCArg::Type::STR, RPCArg::Optional::NO, "(literal) indicates client side segwit support"},
    567                     {"str", RPCArg::Type::STR, RPCArg::Optional::OMITTED, "other client side supported softfork deployment"},
    568                 }},
    569+                {"longpollid", RPCArg::Type::STR, RPCArg::Optional::OMITTED, "Delay processing request until the result would vary significantly from the \"longpollid\" of a prior template."},
    


    russeree commented at 8:36 am on July 11, 2023:
    1. This should not have a period ‘.’ at the end. Since it is inconsistent with the rest of the documentation.
    2. Should start with a lowercase letter since only grammatical articles have capitalized first letters for this documentation. (A, The, This)

    ItIsOHM commented at 8:41 am on July 11, 2023:
    Oh yes, I agree the descriptions should have the same grammatical style as the rest. I can make these changes for sure. Thanks @russeree for the help :D

    russeree commented at 8:44 am on July 11, 2023:

    No problem, this is what I got running your code.

    image


    stickies-v commented at 10:33 am on July 14, 2023:
    Are you still going to make these changes?

    ItIsOHM commented at 2:16 pm on July 14, 2023:
    Actually I wasn’t sure if I should since I had removed the WIP tag and asked for a review, but I can change them right now if that’s okay.

    sipa commented at 2:29 pm on July 14, 2023:

    WIP just means “this is not ready for review yet”.

    You’re always expected to address review comments, whether that means making changes, or giving a justification why it’s better not to.


    ItIsOHM commented at 3:11 pm on July 14, 2023:
    Ahh okay, I’m sorry about that. Will make these changes asap and push another commit.
  30. russeree changes_requested
  31. russeree commented at 8:38 am on July 11, 2023: contributor
    Some of my thoughts about this PR. Mostly regarding the grammatical consistency of these messages.
  32. glozow added the label RPC/REST/ZMQ on Jul 13, 2023
  33. ItIsOHM commented at 7:12 pm on July 13, 2023: contributor
    Hello, just wondering if there is something left from my side, or is this ready for review and merging?
  34. russeree commented at 7:17 pm on July 13, 2023: contributor

    Bitcoin development is always bottlenecked and all changes no matter how small must thoroughly reviewed for and allowed time for social consensus since every change could potentially cost people real world value. You can work on other issues and/or await more feedback.

  35. ItIsOHM commented at 7:19 pm on July 13, 2023: contributor

    Ahh I see! Thanks for clearing it up :D I was just worried if I needed to change something from my side hehe

    Thanks for all the help in this PR everyone, really learnt a great deal from each one of you!

  36. achow101 commented at 7:41 pm on July 13, 2023: member
    If this is ready for review, please remove “[WIP]” from the title.
  37. ItIsOHM renamed this:
    [WIP] rpc: doc: Added `longpollid` and `data` params to `template_request` #27998
    rpc: doc: Added `longpollid` and `data` params to `template_request` #27998
    on Jul 13, 2023
  38. Added `longpollid` and `data` params to `template_request` #27998
    Added `longpollid` and `data` params to `template_request` in `getblocktemplate` #27998
    f6a26196cf
  39. ItIsOHM force-pushed on Jul 14, 2023
  40. stickies-v approved
  41. stickies-v commented at 4:07 pm on July 14, 2023: contributor

    tACK f6a26196cfb7e2c90e25f82b0e2f569a05013cae

    Thanks for picking this up and swiftly addressing feedback!

  42. ItIsOHM commented at 4:13 pm on July 14, 2023: contributor

    tACK f6a2619

    Thanks for picking this up and swiftly addressing feedback!

    Thanks so much to each and every reviewer here for tolerating a beginner contributor like me 😅

  43. MarcoFalke requested review from luke-jr on Jul 15, 2023
  44. russeree commented at 5:48 am on July 17, 2023: contributor

    Concept ACK

    I do have a few questions about the implementation of the RPCHelpMan parameter text for ’longpollid’ when used for a template instead of a propsal. My primary issue is the block proposal definition for longpollid at https://github.com/bitcoin/bitcoin/blob/57b8336dfed6312003cf34cd5ae7099f77115e73/src/rpc/mining.cpp#L613 varies from the current PRs when used as an optional parameter for a block template. https://github.com/bitcoin/bitcoin/blob/f6a26196cfb7e2c90e25f82b0e2f569a05013cae/src/rpc/mining.cpp#L569 But the use of the passed parameter for longpollid at https://github.com/bitcoin/bitcoin/blob/57b8336dfed6312003cf34cd5ae7099f77115e73/src/rpc/mining.cpp#L715-L721 is the same for both a template and a proposal.

    The questions I have are

    • Should the RPCHelpMan text for longpollid match for proposals and templates or does the behavior vary based on if the user is passing longpollid for a proposal vs template? My answer is going to be I assume that the behavior is different but I can’t seem to find the logic where it differs.

    • Should there be a mention of the 60 second timeout if we are going to describe not just the id component of the longpollid but the behavior of the optional parameter?

    I apologize if I missed something completely.

  45. stickies-v commented at 10:46 am on July 17, 2023: contributor

    But the use of the passed parameter for longpollid at https://github.com/bitcoin/bitcoin/blob/57b8336dfed6312003cf34cd5ae7099f77115e73/src/rpc/mining.cpp#L715-L721

    is the same for both a template and a proposal.

    longpollid is neither used as a parameter nor returned as a result for mode==proposal. The line you reference is never reached in that case, as we return or throw within this code block. See also the corresponding results.

    • Should the RPCHelpMan text for longpollid match for proposals and templates or does the behavior vary based on if the user is passing longpollid for a proposal vs template?

    As before, it’s not used for proposal mode. Could mention that in the description but I don’t think it’s that relevant, conceptually longpolling on a proposal doesn’t make sense I think.

    • Should there be a mention of the 60 second timeout if we are going to describe not just the id component of the longpollid but the behavior of the optional parameter?

    It only “times out” if there are new transactions to be considered as per this break, so I think the current description works well. Moreover, we may want to change this implementation detail (it’s not part of the BIP22 spec), so keeping it out of the documentation makes that an easier process.

  46. russeree commented at 10:51 am on July 17, 2023: contributor

    is the same for both a template and a proposal.

    longpollid is neither used as a parameter nor returned as a result for mode==proposal. The line you reference is never reached in that case, as we return or throw within this code block. See also the corresponding results.

    • Should the RPCHelpMan text for longpollid match for proposals and templates or does the behavior vary based on if the user is passing longpollid for a proposal vs template?

    As before, it’s not used for proposal mode. Could mention that in the description but I don’t think it’s that relevant, conceptually longpolling on a proposal doesn’t make sense I think.

    Thank you for this excellent overview, Thank you for taking the time so really dive into how this works. Sorry for being incorrect.

    • Should there be a mention of the 60 second timeout if we are going to describe not just the id component of the longpollid but the behavior of the optional parameter?

    It only “times out” if there are new transactions to be considered as per this break, so I think the current description works well. Moreover, we may want to change this implementation detail (it’s not part of the BIP22 spec), so keeping it out of the documentation makes that an easier process.

    Makes sense.

    tACK https://github.com/bitcoin/bitcoin/commit/f6a26196cfb7e2c90e25f82b0e2f569a05013cae

  47. russeree approved
  48. luke-jr approved
  49. luke-jr commented at 8:28 pm on July 18, 2023: member
    utACK
  50. luke-jr commented at 8:29 pm on July 18, 2023: member
    (Maybe remove # from PR title)
  51. DrahtBot renamed this:
    rpc: doc: Added `longpollid` and `data` params to `template_request` #27998
    rpc: doc: Added `longpollid` and `data` params to `template_request`
    on Jul 18, 2023
  52. MarcoFalke added this to the milestone 26.0 on Jul 18, 2023
  53. fanquake merged this on Jul 19, 2023
  54. fanquake closed this on Jul 19, 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: 2024-06-29 07:13 UTC

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