Skip to content

Commit

Permalink
rollback ICQ messages renaming
Browse files Browse the repository at this point in the history
  • Loading branch information
sotnikov-s committed Nov 18, 2024
1 parent 0464849 commit 05acc43
Show file tree
Hide file tree
Showing 15 changed files with 563 additions and 309 deletions.
18 changes: 13 additions & 5 deletions proto/neutron/interchainqueries/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ service Query {
option (google.api.http).get = "/neutron/interchainqueries/registered_query";
}
// Queries the last successfully submitted result of an Interchain Query.
rpc QueryResult(QueryQueryResultRequest) returns (QueryQueryResultResponse) {
rpc QueryResult(QueryRegisteredQueryResultRequest) returns (QueryRegisteredQueryResultResponse) {
option (google.api.http).get = "/neutron/interchainqueries/query_result";
}
// Queries the last height of a remote chain known to the IBC client behind a given connection ID.
rpc LastRemoteHeight(QueryLastRemoteHeightRequest) returns (QueryLastRemoteHeightResponse) {
rpc LastRemoteHeight(QueryLastRemoteHeight) returns (QueryLastRemoteHeightResponse) {
option (google.api.http).get = "/neutron/interchainqueries/remote_height";
}
}
Expand Down Expand Up @@ -81,19 +81,27 @@ message QueryRegisteredQueryResponse {
}

// Request type for the Query/QueryResult RPC method.
message QueryQueryResultRequest {
message QueryRegisteredQueryResultRequest {
// ID of an Interchain Query.
uint64 query_id = 1;
}

// Response type for the Query/QueryResult RPC method.
message QueryQueryResultResponse {
message QueryRegisteredQueryResultResponse {
// The last successfully submitted result of an Interchain Query.
QueryResult result = 1;
}

message Transaction {
option deprecated = true;

uint64 id = 1;
uint64 height = 2;
bytes data = 3;
}

// Request type for the Query/LastRemoteHeight RPC method.
message QueryLastRemoteHeightRequest {
message QueryLastRemoteHeight {
// Connection ID of an IBC connection to a remote chain. Determines the IBC client used in query
// handling.
string connection_id = 1;
Expand Down
8 changes: 4 additions & 4 deletions proto/neutron/interchainqueries/tx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ service Msg {
// Removes a given Interchain Query and its results from the module. Can be removed only by the
// owner of the query during the query's submit timeout, and by anyone after the query has been
// timed out. The query deposit is returned to the caller on a success call.
rpc RemoveInterchainQuery(MsgRemoveInterchainQuery) returns (MsgRemoveInterchainQueryResponse);
rpc RemoveInterchainQuery(MsgRemoveInterchainQueryRequest) returns (MsgRemoveInterchainQueryResponse);
// Updates parameters of a registered Interchain Query. Only callable by the owner of the query.
rpc UpdateInterchainQuery(MsgUpdateInterchainQuery) returns (MsgUpdateInterchainQueryResponse);
rpc UpdateInterchainQuery(MsgUpdateInterchainQueryRequest) returns (MsgUpdateInterchainQueryResponse);
// Updates params of the interchainqueries module. Only callable by the module's authority.
rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse);
}
Expand Down Expand Up @@ -152,7 +152,7 @@ message TxValue {
message MsgSubmitQueryResultResponse {}

// Request type for the Msg/RemoveInterchainQuery RPC method.
message MsgRemoveInterchainQuery {
message MsgRemoveInterchainQueryRequest {
option (cosmos.msg.v1.signer) = "sender";
// The ID of the query to remove.
uint64 query_id = 1;
Expand All @@ -164,7 +164,7 @@ message MsgRemoveInterchainQuery {
message MsgRemoveInterchainQueryResponse {}

// Request type for the Msg/UpdateInterchainQuery RPC method.
message MsgUpdateInterchainQuery {
message MsgUpdateInterchainQueryRequest {
option (cosmos.msg.v1.signer) = "sender";
// The ID of the query to update.
uint64 query_id = 1;
Expand Down
4 changes: 2 additions & 2 deletions wasmbinding/message_plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ func (m *CustomMessenger) updateInterchainQuery(ctx sdk.Context, contractAddr sd
}

func (m *CustomMessenger) performUpdateInterchainQuery(ctx sdk.Context, contractAddr sdk.AccAddress, updateQuery *bindings.UpdateInterchainQuery) (*icqtypes.MsgUpdateInterchainQueryResponse, error) {
msg := icqtypes.MsgUpdateInterchainQuery{
msg := icqtypes.MsgUpdateInterchainQueryRequest{
QueryId: updateQuery.QueryId,
NewKeys: updateQuery.NewKeys,
NewUpdatePeriod: updateQuery.NewUpdatePeriod,
Expand Down Expand Up @@ -402,7 +402,7 @@ func (m *CustomMessenger) removeInterchainQuery(ctx sdk.Context, contractAddr sd
}

func (m *CustomMessenger) performRemoveInterchainQuery(ctx sdk.Context, contractAddr sdk.AccAddress, updateQuery *bindings.RemoveInterchainQuery) (*icqtypes.MsgRemoveInterchainQueryResponse, error) {
msg := icqtypes.MsgRemoveInterchainQuery{
msg := icqtypes.MsgRemoveInterchainQueryRequest{
QueryId: updateQuery.QueryId,
Sender: contractAddr.String(),
}
Expand Down
2 changes: 1 addition & 1 deletion wasmbinding/stargate_allowlist.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func AcceptedStargateQueries() wasmkeeper.AcceptedQueries {
"/neutron.interchainqueries.Query/Params": &interchainqueriestypes.QueryParamsResponse{},
"/neutron.interchainqueries.Query/RegisteredQueries": &interchainqueriestypes.QueryRegisteredQueriesResponse{},
"/neutron.interchainqueries.Query/RegisteredQuery": &interchainqueriestypes.QueryRegisteredQueryResponse{},
"/neutron.interchainqueries.Query/QueryResult": &interchainqueriestypes.QueryQueryResultResponse{},
"/neutron.interchainqueries.Query/QueryResult": &interchainqueriestypes.QueryRegisteredQueryResultRequest{},
"/neutron.interchainqueries.Query/LastRemoteHeight": &interchainqueriestypes.QueryLastRemoteHeightResponse{},

// feeburner
Expand Down
4 changes: 2 additions & 2 deletions x/interchainqueries/client/cli/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ func CmdQueryRegisteredQueryResult() *cobra.Command {
return fmt.Errorf("failed to parse query id: %w", err)
}

res, err := queryClient.QueryResult(context.Background(), &types.QueryQueryResultRequest{QueryId: queryID})
res, err := queryClient.QueryResult(context.Background(), &types.QueryRegisteredQueryResultRequest{QueryId: queryID})
if err != nil {
return err
}
Expand All @@ -142,7 +142,7 @@ func CmdQueryLastRemoteHeight() *cobra.Command {
clientCtx := client.GetClientContextFromCmd(cmd)
connectionID := args[0]
queryClient := types.NewQueryClient(clientCtx)
res, err := queryClient.LastRemoteHeight(context.Background(), &types.QueryLastRemoteHeightRequest{ConnectionId: connectionID})
res, err := queryClient.LastRemoteHeight(context.Background(), &types.QueryLastRemoteHeight{ConnectionId: connectionID})
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion x/interchainqueries/client/cli/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func RemoveInterchainQueryCmd() *cobra.Command {
return fmt.Errorf("failed to parse query id: %w", err)
}

msg := types.NewMsgRemoveInterchainQuery(sender, queryID)
msg := types.NewMsgRemoveInterchainQueryRequest(sender, queryID)

return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), &msg)
},
Expand Down
6 changes: 3 additions & 3 deletions x/interchainqueries/keeper/grpc_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ func (k Keeper) GetRegisteredQueries(ctx sdk.Context, req *types.QueryRegistered
return &types.QueryRegisteredQueriesResponse{RegisteredQueries: queries, Pagination: pageRes}, nil
}

func (k Keeper) QueryResult(goCtx context.Context, request *types.QueryQueryResultRequest) (*types.QueryQueryResultResponse, error) {
func (k Keeper) QueryResult(goCtx context.Context, request *types.QueryRegisteredQueryResultRequest) (*types.QueryRegisteredQueryResultResponse, error) {
ctx := sdk.UnwrapSDKContext(goCtx)

if !k.checkRegisteredQueryExists(ctx, request.QueryId) {
Expand All @@ -86,10 +86,10 @@ func (k Keeper) QueryResult(goCtx context.Context, request *types.QueryQueryResu
if err != nil {
return nil, errors.Wrapf(err, "failed to get query result by query id: %v", err)
}
return &types.QueryQueryResultResponse{Result: result}, nil
return &types.QueryRegisteredQueryResultResponse{Result: result}, nil
}

func (k Keeper) LastRemoteHeight(goCtx context.Context, request *types.QueryLastRemoteHeightRequest) (*types.QueryLastRemoteHeightResponse, error) {
func (k Keeper) LastRemoteHeight(goCtx context.Context, request *types.QueryLastRemoteHeight) (*types.QueryLastRemoteHeightResponse, error) {
req := contypes.QueryConnectionClientStateRequest{ConnectionId: request.ConnectionId}
r, err := k.ibcKeeper.ConnectionClientState(goCtx, &req)
if err != nil {
Expand Down
6 changes: 3 additions & 3 deletions x/interchainqueries/keeper/msg_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ func (m msgServer) RegisterInterchainQuery(goCtx context.Context, msg *types.Msg
return &types.MsgRegisterInterchainQueryResponse{Id: lastID}, nil
}

func (m msgServer) RemoveInterchainQuery(goCtx context.Context, msg *types.MsgRemoveInterchainQuery) (*types.MsgRemoveInterchainQueryResponse, error) {
func (m msgServer) RemoveInterchainQuery(goCtx context.Context, msg *types.MsgRemoveInterchainQueryRequest) (*types.MsgRemoveInterchainQueryResponse, error) {
if err := msg.Validate(); err != nil {
return nil, errors.Wrap(err, "failed to validate MsgRemoveInterchainQueryRequest")
}
Expand All @@ -119,7 +119,7 @@ func (m msgServer) RemoveInterchainQuery(goCtx context.Context, msg *types.MsgRe
return &types.MsgRemoveInterchainQueryResponse{}, nil
}

func (m msgServer) UpdateInterchainQuery(goCtx context.Context, msg *types.MsgUpdateInterchainQuery) (*types.MsgUpdateInterchainQueryResponse, error) {
func (m msgServer) UpdateInterchainQuery(goCtx context.Context, msg *types.MsgUpdateInterchainQueryRequest) (*types.MsgUpdateInterchainQueryResponse, error) {
ctx := sdk.UnwrapSDKContext(goCtx)
ctx.Logger().Debug("UpdateInterchainQuery", "msg", msg)
params := m.GetParams(ctx)
Expand Down Expand Up @@ -316,7 +316,7 @@ func (m msgServer) SubmitQueryResult(goCtx context.Context, msg *types.MsgSubmit
// with the query type.
func (m msgServer) validateUpdateInterchainQueryParams(
query *types.RegisteredQuery,
msg *types.MsgUpdateInterchainQuery,
msg *types.MsgUpdateInterchainQueryRequest,
) error {
queryType := types.InterchainQueryType(query.GetQueryType())
newKvKeysSet := len(msg.GetNewKeys()) != 0
Expand Down
4 changes: 2 additions & 2 deletions x/interchainqueries/types/codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ func RegisterInterfaces(registry cdctypes.InterfaceRegistry) {
(*sdk.Msg)(nil),
&MsgRegisterInterchainQuery{},
&MsgSubmitQueryResult{},
&MsgUpdateInterchainQuery{},
&MsgRemoveInterchainQuery{},
&MsgUpdateInterchainQueryRequest{},
&MsgRemoveInterchainQueryRequest{},
&MsgUpdateParams{},
)
msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc)
Expand Down
16 changes: 8 additions & 8 deletions x/interchainqueries/types/message_remove_interchain_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,24 @@ import (
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
)

var _ sdk.Msg = &MsgRemoveInterchainQuery{}
var _ sdk.Msg = &MsgRemoveInterchainQueryRequest{}

func NewMsgRemoveInterchainQuery(sender string, queryID uint64) MsgRemoveInterchainQuery {
return MsgRemoveInterchainQuery{
func NewMsgRemoveInterchainQueryRequest(sender string, queryID uint64) MsgRemoveInterchainQueryRequest {
return MsgRemoveInterchainQueryRequest{
QueryId: queryID,
Sender: sender,
}
}

func (msg MsgRemoveInterchainQuery) Route() string {
func (msg MsgRemoveInterchainQueryRequest) Route() string {
return RouterKey
}

func (msg MsgRemoveInterchainQuery) Type() string {
func (msg MsgRemoveInterchainQueryRequest) Type() string {
return "remove-interchain-query"
}

func (msg MsgRemoveInterchainQuery) Validate() error {
func (msg MsgRemoveInterchainQueryRequest) Validate() error {
if msg.GetQueryId() == 0 {
return errors.Wrap(ErrInvalidQueryID, "query_id cannot be empty or equal to 0")
}
Expand All @@ -42,11 +42,11 @@ func (msg MsgRemoveInterchainQuery) Validate() error {
return nil
}

func (msg MsgRemoveInterchainQuery) GetSignBytes() []byte {
func (msg MsgRemoveInterchainQueryRequest) GetSignBytes() []byte {
return ModuleCdc.MustMarshalJSON(&msg)
}

func (msg MsgRemoveInterchainQuery) GetSigners() []sdk.AccAddress {
func (msg MsgRemoveInterchainQueryRequest) GetSigners() []sdk.AccAddress {
senderAddr, err := sdk.AccAddressFromBech32(msg.Sender)
if err != nil { // should never happen as valid basic rejects invalid addresses
panic(err.Error())
Expand Down
Loading

0 comments on commit 05acc43

Please sign in to comment.