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

Add CLI commands to invoke CometMock specific functionality without manual RPC requests #53

Open
p-offtermatt opened this issue Sep 12, 2023 · 2 comments
Labels
good first issue Good for newcomers prio:mighthave For low priority issues that might be nice to have, but are not particularly important.

Comments

@p-offtermatt
Copy link
Member

p-offtermatt commented Sep 12, 2023

Is your feature request related to a problem? Please describe.
To interact with CometMock, we call its RPC endpoints.
From the command line, this can be done e.g. via curl and looks like this:

curl -H 'Content-Type: application/json' -H 'Accept:application/json' --data '{"jsonrpc":"2.0","method":"advance_time","params":{"duration_in_seconds": "36000000"},"id":1}' 127.0.0.1:22331

This looks a bit overbearing and puts a lot of burden and confusion on the end user.

Describe the solution you'd like
The cometmock binary should have subcommands that allow interacting with a running CometMock instance to
invoke all custom functionality.
This should look, for example, like

cometmock advance_time 3600000 --node tcp://127.0.0.1:22331

Describe alternatives you've considered
We could offer an alternative binary - it wouldn't even have to be written in Golang, since the functionality it would perform is miniscule (just putting together curl requests). However, I think the solution where there is just a single binary is preferable - it's how the CosmosSDK does it (running nodes but also doing one-shot interactions with the same binary).

Additional context
Add any other context or screenshots about the feature request here.

@p-offtermatt p-offtermatt added the prio:mighthave For low priority issues that might be nice to have, but are not particularly important. label Sep 12, 2023
@p-offtermatt p-offtermatt added the good first issue Good for newcomers label Sep 27, 2023
@Anmol1696
Copy link

I think we could keep the signature of the binary more similar to the cometbft binary, or even the cosmos-sdk binary.
That would mean having something like:

cometmock advance-time 3600000 --node http://127.0.0.1:22331

## --node used by sdk, but we can also do what cometbft uses, but should be one of those i think

Not sure if it makes sense to have query and txn commands, but all the commands should define similar params, this will also keep the design consistent.

@p-offtermatt
Copy link
Member Author

Very good point - I will adjust the initial issue as suggested, I think this point is just obviously valid. I think separate query/tx commands don't make sense, since currently I don't see a strong reason to have query commands in CometMock - atm the only truly queriable thing is the signing_status, everything else you just read from the app, i.e. through the sdk

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers prio:mighthave For low priority issues that might be nice to have, but are not particularly important.
Projects
None yet
Development

No branches or pull requests

2 participants