Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

assumeutxo, rpc: Add 'start' parameter to loadtxoutset #28659

Conversation

hernanmarino
Copy link
Contributor

@hernanmarino hernanmarino commented Oct 16, 2023

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.

@DrahtBot
Copy link
Contributor

DrahtBot commented Oct 16, 2023

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.

@hernanmarino hernanmarino force-pushed the assumeutxo-loadutxoset-add-start-parameter branch from 8b12a6a to 7e344fc Compare October 16, 2023 20:55
@hernanmarino hernanmarino changed the title assumeutxo: Add 'start' parameter to loadutxoset assumeutxo: Add 'start' parameter to loadtxoutset Oct 16, 2023
@hernanmarino hernanmarino changed the title assumeutxo: Add 'start' parameter to loadtxoutset assumeutxo, rpc: Add 'start' parameter to loadtxoutset Oct 16, 2023
@hernanmarino hernanmarino force-pushed the assumeutxo-loadutxoset-add-start-parameter branch from 6166e58 to 9e2bf30 Compare October 17, 2023 02:10
@hernanmarino hernanmarino marked this pull request as ready for review October 17, 2023 03:55
src/rpc/blockchain.cpp Outdated Show resolved Hide resolved
@hernanmarino hernanmarino force-pushed the assumeutxo-loadutxoset-add-start-parameter branch from 9e2bf30 to e27380e Compare October 17, 2023 13:39
@hernanmarino
Copy link
Contributor Author

Rebased. Also followed @maflcko nit advise.

Copy link
Member

@pablomartin4btc pablomartin4btc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Concept ACK

@ryanofsky
Copy link
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.

@hernanmarino
Copy link
Contributor Author

hernanmarino commented Oct 17, 2023

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.

@ryanofsky
Copy link
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.

@hernanmarino
Copy link
Contributor Author

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.

@Sjors
Copy link
Member

Sjors commented Oct 23, 2023

I think @ryanofsky's suggestion makes sense. We could even keep loadtxoutset the same (it implies start), and then have loadtxoutsetstatus and loadtxoutsetabort.

@maflcko
Copy link
Member

maflcko commented Jan 30, 2024

Are you still working on this?

@hernanmarino
Copy link
Contributor Author

Are you still working on this?

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

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.
@hernanmarino hernanmarino force-pushed the assumeutxo-loadutxoset-add-start-parameter branch from c688b9e to 2f7145e Compare January 30, 2024 20:07
@maflcko
Copy link
Member

maflcko commented Jan 31, 2024

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

@hernanmarino hernanmarino marked this pull request as draft January 31, 2024 14:34
@hernanmarino
Copy link
Contributor Author

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.

Copy link
Member

@pablomartin4btc pablomartin4btc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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? 🤔) so the other 2 new RPC commands (to be created) work/ interact well.

@maflcko
Copy link
Member

maflcko commented Feb 2, 2024

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.

@maflcko
Copy link
Member

maflcko commented Feb 22, 2024

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

@maflcko maflcko closed this Feb 22, 2024
@hernanmarino
Copy link
Contributor Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

rpc: make loadtxoutset async
6 participants