CometMock
                                
                                
                                
                                    CometMock copied to clipboard
                            
                            
                            
                        Add CLI commands to invoke CometMock specific functionality without manual RPC requests
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.
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.
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