assumeutxo, rpc: Add ‘start’ parameter to loadtxoutset #28659

pull hernanmarino wants to merge 1 commits into bitcoin:master from hernanmarino:assumeutxo-loadutxoset-add-start-parameter changing 3 files +12 −7
  1. hernanmarino commented at 8:41 pm on October 16, 2023: contributor

    Might fix #28620

    This PR only modifies the behavior of loadtxoutset to require a mandatory “start” string as a first parameter.

    This change will allow to implement “status”, “abort” or similar future parameters in follow-ups, without breaking the current RPC protocol with incompatible changes (if this were to be merged in the current release cycle)

    Also, it is implemented in a minimalist way, to make it easy to review.

  2. DrahtBot commented at 8:41 pm on October 16, 2023: 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.

    Type Reviewers
    Concept ACK pablomartin4btc

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

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #29345 (rpc: Do not wait for headers inside loadtxoutset by maflcko)

    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. hernanmarino force-pushed on Oct 16, 2023
  4. hernanmarino renamed this:
    assumeutxo: Add 'start' parameter to loadutxoset
    assumeutxo: Add 'start' parameter to loadtxoutset
    on Oct 16, 2023
  5. hernanmarino renamed this:
    assumeutxo: Add 'start' parameter to loadtxoutset
    assumeutxo, rpc: Add 'start' parameter to loadtxoutset
    on Oct 16, 2023
  6. DrahtBot added the label CI failed on Oct 16, 2023
  7. DrahtBot removed the label CI failed on Oct 17, 2023
  8. hernanmarino force-pushed on Oct 17, 2023
  9. hernanmarino marked this as ready for review on Oct 17, 2023
  10. in src/rpc/blockchain.cpp:2741 in 9e2bf30e40 outdated
    2733@@ -2732,12 +2734,15 @@ static RPCHelpMan loadtxoutset()
    2734                 }
    2735         },
    2736         RPCExamples{
    2737-            HelpExampleCli("loadtxoutset", "utxo.dat")
    2738+            HelpExampleCli("loadtxoutset", "start utxo.dat")
    2739         },
    2740         [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue
    2741 {
    2742+    if (request.params[0].get_str() != "start") {
    


    maflcko commented at 7:58 am on October 17, 2023:
    nit: self.Arg<std::string>(0) for new code?
  11. DrahtBot added the label Needs rebase on Oct 17, 2023
  12. hernanmarino force-pushed on Oct 17, 2023
  13. hernanmarino commented at 1:45 pm on October 17, 2023: contributor
    Rebased. Also followed @maflcko nit advise.
  14. pablomartin4btc commented at 3:11 pm on October 17, 2023: member
    Concept ACK
  15. DrahtBot removed the label Needs rebase on Oct 17, 2023
  16. ryanofsky commented at 10:04 pm on October 17, 2023: contributor

    Is there another RPC method that supports subcommands (“start” “status” “abort”) like this? It seems our RPC dispatching and documentation framework might have to be changed a lot to support a RPC methods with multiple subcommands if the subcommands don’t all take the same parameters. Also the JSON-RPC protocol doesn’t provide a way to represent subcommands, so it might be awkward for example in python to write the command as a string argument instead of a method name.

    Maybe a simpler alternative would be to add loadtxoutsetstatus and loadtxoutsetabort RPC methods.

  17. hernanmarino commented at 11:28 pm on October 17, 2023: contributor

    Is there another RPC method that supports subcommands (“start” “status” “abort”) like this?

    Yes, the issue mentions scanblocks which folllows the exact same protocol.

    I also found scantxoutset , same protocol.

  18. ryanofsky commented at 0:14 am on October 18, 2023: contributor

    Thanks for the examples. This confirms my doubts about the approach, since documentation produced by “bitcoin-cli help scanblocks” is pretty messy, and it seems like this approach can only work if none of the other subcommands take any positional RPC arguments, since they would conflict with arguments for the “start” subcommand.

    So having separate RPC methods still seems a little cleaner to me, but maybe it’s worth accepting some limitations if it makes the 3 RPCs more consistent with each other. Either way seems reasonable.

  19. DrahtBot added the label CI failed on Oct 18, 2023
  20. DrahtBot added the label Needs rebase on Oct 18, 2023
  21. hernanmarino force-pushed on Oct 18, 2023
  22. DrahtBot removed the label Needs rebase on Oct 18, 2023
  23. DrahtBot removed the label CI failed on Oct 18, 2023
  24. hernanmarino commented at 7:56 pm on October 18, 2023: contributor

    Thanks for the examples. This confirms my doubts about the approach, since documentation produced by “bitcoin-cli help scanblocks” is pretty messy, and it seems like this approach can only work if none of the other subcommands take any positional RPC arguments, since they would conflict with arguments for the “start” subcommand.

    So having separate RPC methods still seems a little cleaner to me, but maybe it’s worth accepting some limitations if it makes the 3 RPCs more consistent with each other. Either way seems reasonable.

    Yes , although I like a little bit more this approach I understand your point of view. I also agree that something can be done in the future to improve this situation. It might be a refactoring of RPCHelpMan logic, or some local handling in each RPC function implementation.

    If there is consensus to go ahead with this approach, I volunteer myself to also implement the abort and status subcommands in follow-ups, and perhaps try a solution for what you described as well.

  25. DrahtBot added the label Needs rebase on Oct 20, 2023
  26. hernanmarino force-pushed on Oct 21, 2023
  27. DrahtBot removed the label Needs rebase on Oct 21, 2023
  28. DrahtBot added the label CI failed on Oct 21, 2023
  29. Sjors commented at 8:17 am on October 23, 2023: member
    I think @ryanofsky’s suggestion makes sense. We could even keep loadtxoutset the same (it implies start), and then have loadtxoutsetstatus and loadtxoutsetabort.
  30. DrahtBot removed the label CI failed on Oct 25, 2023
  31. DrahtBot added the label CI failed on Jan 12, 2024
  32. maflcko commented at 4:31 pm on January 30, 2024: member
    Are you still working on this?
  33. hernanmarino commented at 5:07 pm on January 30, 2024: contributor

    Are you still working on this?

    Yes ! I was witing for more reviews, but I’ll go ahead with @Sjors suggestion asap.

  34. assumeutxo: Add 'start' parameter to loadtxoutset
    This commit modifies the behavior of loadtxoutset to require a
    mandatory "start" parameter before specifying the filename.
    This change allows to implement "status", "abort" or similar future
    parameters in follow-ups, without breaking the current RPC
    protocol with incompatible changes.
    2f7145e99b
  35. hernanmarino force-pushed on Jan 30, 2024
  36. maflcko commented at 10:24 am on January 31, 2024: member
    Ok, maybe turn it into draft, until you are done and the CI is passing?
  37. hernanmarino marked this as a draft on Jan 31, 2024
  38. hernanmarino commented at 9:40 pm on January 31, 2024: contributor

    Ok, maybe turn it into draft, until you are done and the CI is passing?

    Actually, I ’d like to ask you and @pablomartin4btc (who also reviewed) a question . I am convinced now to follow @ryanofsky ( and @Sjors ) suggestion of implementing this with 3 commands instead of the current approach of subcommands.

    If you agree with this new approach , I think I’ll close this PR and implement the functionality in one (or two) followup PRs implementing the new commands, since there is no point in keeping this PR if loadtxoutset remains unchanged.

  39. pablomartin4btc commented at 6:17 pm on February 1, 2024: member
    I think it’s up to you really, you could either use this PR, updating title & description (mentioning previous approach) or create a new one referring this one, but you would need to make loadtxoutset async now (no? :thinking:) so the other 2 new RPC commands (to be created) work/ interact well.
  40. maflcko commented at 8:02 am on February 2, 2024: member
    I think it is fine to not have an abort command for now, because currently it is also not possible to abort, unless the complete process is shut down. But up to you.
  41. maflcko commented at 5:53 pm on February 22, 2024: member
    Closing for now. This has been a placeholder for months now, with no code to review or merge, and the CI failing anyway. Feel free to open a new pull request once and if there is something to review. If you have questions, you can leave them in the existing thread: https://github.com/bitcoin/bitcoin/issues/28620
  42. maflcko closed this on Feb 22, 2024

  43. hernanmarino commented at 7:59 pm on February 26, 2024: contributor

    Closing for now. This has been a placeholder for months now, with no code to review or merge, and the CI failing anyway. Feel free to open a new pull request once and if there is something to review. If you have questions, you can leave them in the existing thread: #28620

    I agree with closing, consensus was leaning towards to a different approach, in wich I am already working. I ’ll open a new PR when ready, thanks.


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-12-23 00:13 UTC

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