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

revert: cli command addition to v2 patch release line #827

Merged
merged 1 commit into from
Feb 3, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Revert "add cli to get denom hash from trace path and base denom (bac…
…kport #679) (#710)"

This reverts commit 6f6af9b.
colin-axner committed Feb 2, 2022
commit acf1cee26d8c563a324f490dac8e0b9f997c3d03
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -52,6 +52,3 @@ dependency-graph.png
*.aux
*.out
*.synctex.gz

*.history

4 changes: 0 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -40,10 +40,6 @@ Ref: https://keepachangelog.com/en/1.0.0/

* (channel) [\#692](https://github.com/cosmos/ibc-go/pull/692) Minimize channel logging by only emitting the packet sequence, source port/channel, destination port/channel upon packet receives, acknowledgements and timeouts.

### Features

* [\#679](https://github.com/cosmos/ibc-go/pull/679) New CLI command `query ibc-transfer denom-hash <denom trace>` to get the denom hash for a denom trace; this might be useful for debug

## [v2.0.2](https://github.com/cosmos/ibc-go/releases/tag/v2.0.2) - 2021-12-15

### Dependencies
66 changes: 0 additions & 66 deletions docs/client/swagger-ui/swagger.yaml
Original file line number Diff line number Diff line change
@@ -4,54 +4,6 @@ info:
description: A REST interface for state queries
version: 1.0.0
paths:
'/ibc/apps/transfer/v1/denom_hashes/{trace}':
get:
summary: DenomHash queries a denomination hash information.
operationId: DenomHash
responses:
'200':
description: A successful response.
schema:
type: object
properties:
hash:
type: string
description: hash (in hex format) of the denomination trace information.
description: >-
QueryDenomHashResponse is the response type for the
Query/DenomHash RPC

method.
default:
description: An unexpected error response
schema:
type: object
properties:
error:
type: string
code:
type: integer
format: int32
message:
type: string
details:
type: array
items:
type: object
properties:
type_url:
type: string
value:
type: string
format: byte
parameters:
- name: trace
description: 'The denomination trace ([port_id]/[channel_id])+/[denom]'
in: path
required: true
type: string
tags:
- Query
/ibc/apps/transfer/v1/denom_traces:
get:
summary: DenomTraces queries all denomination traces.
@@ -7374,15 +7326,6 @@ paths:
required: false
type: boolean
format: boolean
- name: packet_commitment_sequences
description: list of packet sequences.
in: query
required: false
type: array
items:
type: string
format: uint64
collectionFormat: multi
tags:
- Query
'/ibc/core/channel/v1/channels/{channel_id}/ports/{port_id}/packet_acks/{sequence}':
@@ -9896,15 +9839,6 @@ definitions:
SendEnabled

parameter for the denomination to false.
ibc.applications.transfer.v1.QueryDenomHashResponse:
type: object
properties:
hash:
type: string
description: hash (in hex format) of the denomination trace information.
description: |-
QueryDenomHashResponse is the response type for the Query/DenomHash RPC
method.
ibc.applications.transfer.v1.QueryDenomTraceResponse:
type: object
properties:
35 changes: 0 additions & 35 deletions docs/ibc/proto-docs.md
Original file line number Diff line number Diff line change
@@ -12,8 +12,6 @@
- [GenesisState](#ibc.applications.transfer.v1.GenesisState)

- [ibc/applications/transfer/v1/query.proto](#ibc/applications/transfer/v1/query.proto)
- [QueryDenomHashRequest](#ibc.applications.transfer.v1.QueryDenomHashRequest)
- [QueryDenomHashResponse](#ibc.applications.transfer.v1.QueryDenomHashResponse)
- [QueryDenomTraceRequest](#ibc.applications.transfer.v1.QueryDenomTraceRequest)
- [QueryDenomTraceResponse](#ibc.applications.transfer.v1.QueryDenomTraceResponse)
- [QueryDenomTracesRequest](#ibc.applications.transfer.v1.QueryDenomTracesRequest)
@@ -348,38 +346,6 @@ GenesisState defines the ibc-transfer genesis state



<a name="ibc.applications.transfer.v1.QueryDenomHashRequest"></a>

### QueryDenomHashRequest
QueryDenomHashRequest is the request type for the Query/DenomHash RPC
method


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `trace` | [string](#string) | | The denomination trace ([port_id]/[channel_id])+/[denom] |






<a name="ibc.applications.transfer.v1.QueryDenomHashResponse"></a>

### QueryDenomHashResponse
QueryDenomHashResponse is the response type for the Query/DenomHash RPC
method.


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `hash` | [string](#string) | | hash (in hex format) of the denomination trace information. |






<a name="ibc.applications.transfer.v1.QueryDenomTraceRequest"></a>

### QueryDenomTraceRequest
@@ -486,7 +452,6 @@ Query provides defines the gRPC querier service.
| `DenomTrace` | [QueryDenomTraceRequest](#ibc.applications.transfer.v1.QueryDenomTraceRequest) | [QueryDenomTraceResponse](#ibc.applications.transfer.v1.QueryDenomTraceResponse) | DenomTrace queries a denomination trace information. | GET|/ibc/apps/transfer/v1/denom_traces/{hash}|
| `DenomTraces` | [QueryDenomTracesRequest](#ibc.applications.transfer.v1.QueryDenomTracesRequest) | [QueryDenomTracesResponse](#ibc.applications.transfer.v1.QueryDenomTracesResponse) | DenomTraces queries all denomination traces. | GET|/ibc/apps/transfer/v1/denom_traces|
| `Params` | [QueryParamsRequest](#ibc.applications.transfer.v1.QueryParamsRequest) | [QueryParamsResponse](#ibc.applications.transfer.v1.QueryParamsResponse) | Params queries all parameters of the ibc-transfer module. | GET|/ibc/apps/transfer/v1/params|
| `DenomHash` | [QueryDenomHashRequest](#ibc.applications.transfer.v1.QueryDenomHashRequest) | [QueryDenomHashResponse](#ibc.applications.transfer.v1.QueryDenomHashResponse) | DenomHash queries a denomination hash information. | GET|/ibc/apps/transfer/v1/denom_hashes/{trace}|

<!-- end services -->

1 change: 0 additions & 1 deletion modules/apps/transfer/client/cli/cli.go
Original file line number Diff line number Diff line change
@@ -20,7 +20,6 @@ func GetQueryCmd() *cobra.Command {
GetCmdQueryDenomTraces(),
GetCmdParams(),
GetCmdQueryEscrowAddress(),
GetCmdQueryDenomHash(),
)

return queryCmd
32 changes: 0 additions & 32 deletions modules/apps/transfer/client/cli/query.go
Original file line number Diff line number Diff line change
@@ -131,35 +131,3 @@ func GetCmdQueryEscrowAddress() *cobra.Command {

return cmd
}

// GetCmdQueryDenomHash defines the command to query a denomination hash from a given trace.
func GetCmdQueryDenomHash() *cobra.Command {
cmd := &cobra.Command{
Use: "denom-hash [trace]",
Short: "Query the denom hash info from a given denom trace",
Long: "Query the denom hash info from a given denom trace",
Example: fmt.Sprintf("%s query ibc-transfer denom-hash [denom_trace]", version.AppName),
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
clientCtx, err := client.GetClientQueryContext(cmd)
if err != nil {
return err
}
queryClient := types.NewQueryClient(clientCtx)

req := &types.QueryDenomHashRequest{
Trace: args[0],
}

res, err := queryClient.DenomHash(cmd.Context(), req)
if err != nil {
return err
}

return clientCtx.PrintProto(res)
},
}

flags.AddQueryFlagsToCmd(cmd)
return cmd
}
27 changes: 0 additions & 27 deletions modules/apps/transfer/keeper/grpc_query.go
Original file line number Diff line number Diff line change
@@ -81,30 +81,3 @@ func (q Keeper) Params(c context.Context, _ *types.QueryParamsRequest) (*types.Q
Params: &params,
}, nil
}

// DenomHash implements the Query/DenomHash gRPC method
func (q Keeper) DenomHash(c context.Context, req *types.QueryDenomHashRequest) (*types.QueryDenomHashResponse, error) {
if req == nil {
return nil, status.Error(codes.InvalidArgument, "empty request")
}

// Convert given request trace path to DenomTrace struct to confirm the path in a valid denom trace format
denomTrace := types.ParseDenomTrace(req.Trace)
if err := denomTrace.Validate(); err != nil {
return nil, status.Error(codes.InvalidArgument, err.Error())
}

ctx := sdk.UnwrapSDKContext(c)
denomHash := denomTrace.Hash()
found := q.HasDenomTrace(ctx, denomHash)
if !found {
return nil, status.Error(
codes.NotFound,
sdkerrors.Wrap(types.ErrTraceNotFound, req.Trace).Error(),
)
}

return &types.QueryDenomHashResponse{
Hash: denomHash.String(),
}, nil
}
67 changes: 0 additions & 67 deletions modules/apps/transfer/keeper/grpc_query_test.go
Original file line number Diff line number Diff line change
@@ -140,70 +140,3 @@ func (suite *KeeperTestSuite) TestQueryParams() {
res, _ := suite.queryClient.Params(ctx, &types.QueryParamsRequest{})
suite.Require().Equal(&expParams, res.Params)
}

func (suite *KeeperTestSuite) TestQueryDenomHash() {

reqTrace := types.DenomTrace{
Path: "transfer/channelToA/transfer/channelToB",
BaseDenom: "uatom",
}

var (
req *types.QueryDenomHashRequest
expHash = reqTrace.Hash().String()
)

testCases := []struct {
msg string
malleate func()
expPass bool
}{
{
"invalid trace",
func() {
req = &types.QueryDenomHashRequest{
Trace: "transfer/channelToA/transfer/",
}
},
false,
},
{
"not found denom trace",
func() {
req = &types.QueryDenomHashRequest{
Trace: "transfer/channelToC/uatom",
}
},
false,
},
{
"success",
func() {},
true,
},
}

for _, tc := range testCases {
suite.Run(fmt.Sprintf("Case %s", tc.msg), func() {
suite.SetupTest() // reset

req = &types.QueryDenomHashRequest{
Trace: reqTrace.GetFullDenomPath(),
}
suite.chainA.GetSimApp().TransferKeeper.SetDenomTrace(suite.chainA.GetContext(), reqTrace)

tc.malleate()
ctx := sdk.WrapSDKContext(suite.chainA.GetContext())

res, err := suite.queryClient.DenomHash(ctx, req)

if tc.expPass {
suite.Require().NoError(err)
suite.Require().NotNil(res)
suite.Require().Equal(expHash, res.Hash)
} else {
suite.Require().Error(err)
}
})
}
}
458 changes: 35 additions & 423 deletions modules/apps/transfer/types/query.pb.go

Large diffs are not rendered by default.

98 changes: 0 additions & 98 deletions modules/apps/transfer/types/query.pb.gw.go
19 changes: 0 additions & 19 deletions proto/ibc/applications/transfer/v1/query.proto
Original file line number Diff line number Diff line change
@@ -25,11 +25,6 @@ service Query {
rpc Params(QueryParamsRequest) returns (QueryParamsResponse) {
option (google.api.http).get = "/ibc/apps/transfer/v1/params";
}

// DenomHash queries a denomination hash information.
rpc DenomHash(QueryDenomHashRequest) returns (QueryDenomHashResponse) {
option (google.api.http).get = "/ibc/apps/transfer/v1/denom_hashes/{trace}";
}
}

// QueryDenomTraceRequest is the request type for the Query/DenomTrace RPC
@@ -70,17 +65,3 @@ message QueryParamsResponse {
// params defines the parameters of the module.
Params params = 1;
}

// QueryDenomHashRequest is the request type for the Query/DenomHash RPC
// method
message QueryDenomHashRequest {
// The denomination trace ([port_id]/[channel_id])+/[denom]
string trace = 1;
}

// QueryDenomHashResponse is the response type for the Query/DenomHash RPC
// method.
message QueryDenomHashResponse {
// hash (in hex format) of the denomination trace information.
string hash = 1;
}