Skip to content

Commit

Permalink
feat(evidence): autocli query support (backport #16625) (#16629)
Browse files Browse the repository at this point in the history
Co-authored-by: Julien Robert <[email protected]>
  • Loading branch information
mergify[bot] and julienrbrt authored Jun 21, 2023
1 parent b6102fb commit 179c6c7
Show file tree
Hide file tree
Showing 9 changed files with 46 additions and 181 deletions.
2 changes: 1 addition & 1 deletion simapp/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ require (
cosmossdk.io/tools/confix v0.0.0-20230614114324-f368ed5c62bc
cosmossdk.io/tools/rosetta v0.2.1-0.20230614114324-f368ed5c62bc
cosmossdk.io/x/circuit v0.0.0-20230614114324-f368ed5c62bc
cosmossdk.io/x/evidence v0.0.0-20230616204757-46e5f3fb0376
cosmossdk.io/x/evidence v0.0.0-20230621081736-53941657a96b
cosmossdk.io/x/feegrant v0.0.0-20230614114324-f368ed5c62bc
cosmossdk.io/x/nft v0.0.0-20230614114324-f368ed5c62bc
cosmossdk.io/x/tx v0.8.0
Expand Down
4 changes: 2 additions & 2 deletions simapp/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,8 @@ cosmossdk.io/tools/rosetta v0.2.1-0.20230614114324-f368ed5c62bc h1:7gFe3tRGqaA3s
cosmossdk.io/tools/rosetta v0.2.1-0.20230614114324-f368ed5c62bc/go.mod h1:l5qTTiHcPXf1m3iz7WuACKFmHW2ewAuIW/+ZcWcUm4Q=
cosmossdk.io/x/circuit v0.0.0-20230614114324-f368ed5c62bc h1:JwM4NDnE5nBZeLllLKPoftFtq0eztBWE0vlc3GDxmlk=
cosmossdk.io/x/circuit v0.0.0-20230614114324-f368ed5c62bc/go.mod h1:VcyU4WzhBXJr+XAAFyGMuR4/CjZLVYtj5EYIH4UwFv4=
cosmossdk.io/x/evidence v0.0.0-20230616204757-46e5f3fb0376 h1:6dgsdUP4yHokKLE99qZUT6i4BtYEuMSW2Of0ufYKyNE=
cosmossdk.io/x/evidence v0.0.0-20230616204757-46e5f3fb0376/go.mod h1:p6buH/50prKzlsCO4Wixv9rizvg4WRCatv/MqqcxoWI=
cosmossdk.io/x/evidence v0.0.0-20230621081736-53941657a96b h1:BkYpZA0W6h/t54HSZK3nOkmForYgPQMwKssRpHCQSPA=
cosmossdk.io/x/evidence v0.0.0-20230621081736-53941657a96b/go.mod h1:igv8Xw4Q1M8R1HIUSxVCk1MeAb5l/gZhz2Rbk2iS/oE=
cosmossdk.io/x/feegrant v0.0.0-20230614114324-f368ed5c62bc h1:Ycesi/NLYXvHrxrWee9PF46Rmek38B7M4UP9MMzCptk=
cosmossdk.io/x/feegrant v0.0.0-20230614114324-f368ed5c62bc/go.mod h1:OUQndoNT6o5MAtRBF9eCQx22nBVO+gHdyKYOcK6dAVo=
cosmossdk.io/x/nft v0.0.0-20230614114324-f368ed5c62bc h1:jSfbIQybYPjsHEoqxefBsS9kW+R9t2nmu4bsjeE2wGI=
Expand Down
2 changes: 1 addition & 1 deletion tests/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ require (
cosmossdk.io/math v1.0.1
cosmossdk.io/simapp v0.0.0-20230620040119-e078f1a49e8b
cosmossdk.io/store v0.1.0-alpha.1.0.20230606190835-3e18f4088b2c
cosmossdk.io/x/evidence v0.0.0-20230616204757-46e5f3fb0376
cosmossdk.io/x/evidence v0.0.0-20230621081736-53941657a96b
cosmossdk.io/x/feegrant v0.0.0-20230614114324-f368ed5c62bc
cosmossdk.io/x/nft v0.0.0-20230614114324-f368ed5c62bc // indirect
cosmossdk.io/x/tx v0.8.0
Expand Down
4 changes: 2 additions & 2 deletions tests/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,8 @@ cosmossdk.io/store v0.1.0-alpha.1.0.20230606190835-3e18f4088b2c h1:A+FMPW9GtfcPB
cosmossdk.io/store v0.1.0-alpha.1.0.20230606190835-3e18f4088b2c/go.mod h1:RbYGvXCbz8uNBCXrwS9Z8SyydeWi+W5x5MZ33muyzMw=
cosmossdk.io/x/circuit v0.0.0-20230614114324-f368ed5c62bc h1:JwM4NDnE5nBZeLllLKPoftFtq0eztBWE0vlc3GDxmlk=
cosmossdk.io/x/circuit v0.0.0-20230614114324-f368ed5c62bc/go.mod h1:VcyU4WzhBXJr+XAAFyGMuR4/CjZLVYtj5EYIH4UwFv4=
cosmossdk.io/x/evidence v0.0.0-20230616204757-46e5f3fb0376 h1:6dgsdUP4yHokKLE99qZUT6i4BtYEuMSW2Of0ufYKyNE=
cosmossdk.io/x/evidence v0.0.0-20230616204757-46e5f3fb0376/go.mod h1:p6buH/50prKzlsCO4Wixv9rizvg4WRCatv/MqqcxoWI=
cosmossdk.io/x/evidence v0.0.0-20230621081736-53941657a96b h1:BkYpZA0W6h/t54HSZK3nOkmForYgPQMwKssRpHCQSPA=
cosmossdk.io/x/evidence v0.0.0-20230621081736-53941657a96b/go.mod h1:igv8Xw4Q1M8R1HIUSxVCk1MeAb5l/gZhz2Rbk2iS/oE=
cosmossdk.io/x/feegrant v0.0.0-20230614114324-f368ed5c62bc h1:Ycesi/NLYXvHrxrWee9PF46Rmek38B7M4UP9MMzCptk=
cosmossdk.io/x/feegrant v0.0.0-20230614114324-f368ed5c62bc/go.mod h1:OUQndoNT6o5MAtRBF9eCQx22nBVO+gHdyKYOcK6dAVo=
cosmossdk.io/x/nft v0.0.0-20230614114324-f368ed5c62bc h1:jSfbIQybYPjsHEoqxefBsS9kW+R9t2nmu4bsjeE2wGI=
Expand Down
6 changes: 5 additions & 1 deletion x/evidence/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Ref: https://keepachangelog.com/en/1.0.0/

### Features

* (x/evidence) [14724](https://github.com/cosmos/cosmos-sdk/pull/14724) The `x/evidence` module is extracted to have a separate go.mod file which allows it be a standalone module.
* (x/evidence) [14724](https://github.com/cosmos/cosmos-sdk/pull/14724) The `x/evidence` module is extracted to have a separate go.mod file which allows it be a standalone module.
* (keeper) [#15420](https://github.com/cosmos/cosmos-sdk/pull/15420) Move `BeginBlocker` to the keeper folder & make HandleEquivocation private

### API Breaking Changes
Expand All @@ -36,3 +36,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
* (keeper) [#15825](https://github.com/cosmos/cosmos-sdk/pull/15825) Evidence constructor now requires an `address.Codec` (`import "cosmossdk.io/core/address"`)
* [#16336](https://github.com/cosmos/cosmos-sdk/pull/16336) Use collections for state management:
* Removed: keeper `SetEvidence`, `GetEvidence`, `IterateEvidences`, `GetAllEvidences`, `MustMarshalEvidence`, `MustUnmarshalEvidence`, `MarshalEvidence`, `UnmarshalEvidence`

### Client Breaking Changes

* [#16625](https://github.com/cosmos/cosmos-sdk/pull/16625) The `simd q evidence evidence` command supports only querying an evidence by hash. For querying all evidences, use `simd q evidence list` instad.
34 changes: 34 additions & 0 deletions x/evidence/autocli.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package evidence

import (
"fmt"

autocliv1 "cosmossdk.io/api/cosmos/autocli/v1"
evidencev1beta1 "cosmossdk.io/api/cosmos/evidence/v1beta1"

"github.com/cosmos/cosmos-sdk/version"
)

// AutoCLIOptions implements the autocli.HasAutoCLIConfig interface.
func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions {
return &autocliv1.ModuleOptions{
Query: &autocliv1.ServiceCommandDescriptor{
Service: evidencev1beta1.Query_ServiceDesc.ServiceName,
RpcCommandOptions: []*autocliv1.RpcCommandOptions{
{
RpcMethod: "Evidence",
Use: "evidence [hash]",
Short: "Query for evidence by hash",
Example: fmt.Sprintf("%s query evidence DF0C23E8634E480F84B9D5674A7CDC9816466DEC28A3358F73260F68D28D7660", version.AppName),
PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "hash"}},
},
{
RpcMethod: "AllEvidence",
Use: "list",
Short: "Query all (paginated) submitted evidence",
Example: fmt.Sprintf("%s query evidence --page=2 --page-limit=50", version.AppName),
},
},
},
}
}
92 changes: 0 additions & 92 deletions x/evidence/client/cli/query.go

This file was deleted.

81 changes: 0 additions & 81 deletions x/evidence/client/cli/query_test.go

This file was deleted.

2 changes: 1 addition & 1 deletion x/evidence/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ func (a AppModuleBasic) GetTxCmd() *cobra.Command {

// GetQueryCmd returns the evidence module's root query command.
func (AppModuleBasic) GetQueryCmd() *cobra.Command {
return cli.GetQueryCmd()
return nil
}

// RegisterInterfaces registers the evidence module's interface types
Expand Down

0 comments on commit 179c6c7

Please sign in to comment.