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

fix failures request in contract manager #663

Merged
merged 8 commits into from
Sep 4, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
9 changes: 8 additions & 1 deletion proto/neutron/contractmanager/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ service Query {
}

// Queries a Failure by contract address and failure ID.
rpc AddressFailure(QueryFailuresRequest) returns (QueryFailuresResponse) {
rpc AddressFailure(QueryFailureRequest) returns (QueryFailuresResponse) {
Copy link
Contributor

Choose a reason for hiding this comment

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

How about making QueryFailureResponse struct without pagination? It seems strange that we return it in array even tho it's always one failure. And pagination always null

option (google.api.http).get = "/neutron/contractmanager/failures/{address}/{failure_id}";
}

Expand Down Expand Up @@ -46,6 +46,13 @@ message QueryParamsResponse {

// QueryFailuresRequest is request type for the Query/Failures RPC method.
message QueryFailuresRequest {
// address of the contract which Sudo call failed.
string address = 1;
cosmos.base.query.v1beta1.PageRequest pagination = 3;
}

// QueryFailureRequest is request type for the Query/Failures RPC method.
message QueryFailureRequest {
Copy link
Contributor

Choose a reason for hiding this comment

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

pagination field seems to be not needed logically (and not used) for QueryFailureRequest.
Please remove it

// address of the contract which Sudo call failed.
string address = 1;
// ID of the failure for the given contract.
Expand Down
2 changes: 1 addition & 1 deletion x/contractmanager/client/cli/query_failure.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func CmdFailureDetails() *cobra.Command {
queryClient := contractmanagertypes.NewQueryClient(clientCtx)
if _, err = queryClient.AddressFailure(
cmd.Context(),
&contractmanagertypes.QueryFailuresRequest{Address: address, FailureId: failureID},
&contractmanagertypes.QueryFailureRequest{Address: address, FailureId: failureID},
); err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion x/contractmanager/keeper/grpc_query_failure.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func (k Keeper) AddressFailures(c context.Context, req *types.QueryFailuresReque
return &types.QueryFailuresResponse{Failures: failures, Pagination: pageRes}, nil
}

func (k Keeper) AddressFailure(c context.Context, req *types.QueryFailuresRequest) (*types.QueryFailuresResponse, error) {
func (k Keeper) AddressFailure(c context.Context, req *types.QueryFailureRequest) (*types.QueryFailuresResponse, error) {
if req == nil {
return nil, status.Error(codes.InvalidArgument, "request field must not be empty")
}
Expand Down
Loading
Loading