From 718b1f26fd546c5e8ada5c75eb2cf17cf4bde77c Mon Sep 17 00:00:00 2001 From: yutianwu Date: Thu, 10 Aug 2023 08:04:15 +0800 Subject: [PATCH 1/4] feat: implement cross-chain mechanism between op and greenfield --- api/cosmos/gov/v1/tx.pulsar.go | 181 +++++++++++++++-------- proto/cosmos/gov/v1/gov.proto | 1 - proto/cosmos/gov/v1/tx.proto | 2 + x/crosschain/keeper/config.go | 7 +- x/crosschain/keeper/keeper.go | 22 ++- x/crosschain/keeper/keeper_test.go | 2 +- x/gov/keeper/common_test.go | 1 + x/gov/keeper/crosschain.go | 48 +++--- x/gov/keeper/deposit.go | 70 ++++----- x/gov/keeper/grpc_query.go | 44 +++--- x/gov/keeper/keeper.go | 72 ++++----- x/gov/keeper/msg_server.go | 2 +- x/gov/keeper/proposal.go | 90 +++++------ x/gov/keeper/tally.go | 16 +- x/gov/keeper/vote.go | 46 +++--- x/gov/testutil/expected_keepers.go | 6 + x/gov/testutil/expected_keepers_mocks.go | 45 +++++- x/gov/types/crosschain.go | 10 +- x/gov/types/errors.go | 2 + x/gov/types/expected_keepers.go | 6 + x/gov/types/v1/tx.pb.go | 161 ++++++++++++-------- 21 files changed, 512 insertions(+), 322 deletions(-) diff --git a/api/cosmos/gov/v1/tx.pulsar.go b/api/cosmos/gov/v1/tx.pulsar.go index 4744915579..ebad1f8af3 100644 --- a/api/cosmos/gov/v1/tx.pulsar.go +++ b/api/cosmos/gov/v1/tx.pulsar.go @@ -5945,9 +5945,10 @@ func (x *fastReflection_MsgUpdateParamsResponse) ProtoMethods() *protoiface.Meth } var ( - md_MsgUpdateCrossChainParams protoreflect.MessageDescriptor - fd_MsgUpdateCrossChainParams_authority protoreflect.FieldDescriptor - fd_MsgUpdateCrossChainParams_params protoreflect.FieldDescriptor + md_MsgUpdateCrossChainParams protoreflect.MessageDescriptor + fd_MsgUpdateCrossChainParams_authority protoreflect.FieldDescriptor + fd_MsgUpdateCrossChainParams_params protoreflect.FieldDescriptor + fd_MsgUpdateCrossChainParams_dest_chain_id protoreflect.FieldDescriptor ) func init() { @@ -5955,6 +5956,7 @@ func init() { md_MsgUpdateCrossChainParams = File_cosmos_gov_v1_tx_proto.Messages().ByName("MsgUpdateCrossChainParams") fd_MsgUpdateCrossChainParams_authority = md_MsgUpdateCrossChainParams.Fields().ByName("authority") fd_MsgUpdateCrossChainParams_params = md_MsgUpdateCrossChainParams.Fields().ByName("params") + fd_MsgUpdateCrossChainParams_dest_chain_id = md_MsgUpdateCrossChainParams.Fields().ByName("dest_chain_id") } var _ protoreflect.Message = (*fastReflection_MsgUpdateCrossChainParams)(nil) @@ -6034,6 +6036,12 @@ func (x *fastReflection_MsgUpdateCrossChainParams) Range(f func(protoreflect.Fie return } } + if x.DestChainId != uint32(0) { + value := protoreflect.ValueOfUint32(x.DestChainId) + if !f(fd_MsgUpdateCrossChainParams_dest_chain_id, value) { + return + } + } } // Has reports whether a field is populated. @@ -6053,6 +6061,8 @@ func (x *fastReflection_MsgUpdateCrossChainParams) Has(fd protoreflect.FieldDesc return x.Authority != "" case "cosmos.gov.v1.MsgUpdateCrossChainParams.params": return x.Params != nil + case "cosmos.gov.v1.MsgUpdateCrossChainParams.dest_chain_id": + return x.DestChainId != uint32(0) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.gov.v1.MsgUpdateCrossChainParams")) @@ -6073,6 +6083,8 @@ func (x *fastReflection_MsgUpdateCrossChainParams) Clear(fd protoreflect.FieldDe x.Authority = "" case "cosmos.gov.v1.MsgUpdateCrossChainParams.params": x.Params = nil + case "cosmos.gov.v1.MsgUpdateCrossChainParams.dest_chain_id": + x.DestChainId = uint32(0) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.gov.v1.MsgUpdateCrossChainParams")) @@ -6095,6 +6107,9 @@ func (x *fastReflection_MsgUpdateCrossChainParams) Get(descriptor protoreflect.F case "cosmos.gov.v1.MsgUpdateCrossChainParams.params": value := x.Params return protoreflect.ValueOfMessage(value.ProtoReflect()) + case "cosmos.gov.v1.MsgUpdateCrossChainParams.dest_chain_id": + value := x.DestChainId + return protoreflect.ValueOfUint32(value) default: if descriptor.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.gov.v1.MsgUpdateCrossChainParams")) @@ -6119,6 +6134,8 @@ func (x *fastReflection_MsgUpdateCrossChainParams) Set(fd protoreflect.FieldDesc x.Authority = value.Interface().(string) case "cosmos.gov.v1.MsgUpdateCrossChainParams.params": x.Params = value.Message().Interface().(*CrossChainParamsChange) + case "cosmos.gov.v1.MsgUpdateCrossChainParams.dest_chain_id": + x.DestChainId = uint32(value.Uint()) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.gov.v1.MsgUpdateCrossChainParams")) @@ -6146,6 +6163,8 @@ func (x *fastReflection_MsgUpdateCrossChainParams) Mutable(fd protoreflect.Field return protoreflect.ValueOfMessage(x.Params.ProtoReflect()) case "cosmos.gov.v1.MsgUpdateCrossChainParams.authority": panic(fmt.Errorf("field authority of message cosmos.gov.v1.MsgUpdateCrossChainParams is not mutable")) + case "cosmos.gov.v1.MsgUpdateCrossChainParams.dest_chain_id": + panic(fmt.Errorf("field dest_chain_id of message cosmos.gov.v1.MsgUpdateCrossChainParams is not mutable")) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.gov.v1.MsgUpdateCrossChainParams")) @@ -6164,6 +6183,8 @@ func (x *fastReflection_MsgUpdateCrossChainParams) NewField(fd protoreflect.Fiel case "cosmos.gov.v1.MsgUpdateCrossChainParams.params": m := new(CrossChainParamsChange) return protoreflect.ValueOfMessage(m.ProtoReflect()) + case "cosmos.gov.v1.MsgUpdateCrossChainParams.dest_chain_id": + return protoreflect.ValueOfUint32(uint32(0)) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.gov.v1.MsgUpdateCrossChainParams")) @@ -6241,6 +6262,9 @@ func (x *fastReflection_MsgUpdateCrossChainParams) ProtoMethods() *protoiface.Me l = options.Size(x.Params) n += 1 + l + runtime.Sov(uint64(l)) } + if x.DestChainId != 0 { + n += 1 + runtime.Sov(uint64(x.DestChainId)) + } if x.unknownFields != nil { n += len(x.unknownFields) } @@ -6270,6 +6294,11 @@ func (x *fastReflection_MsgUpdateCrossChainParams) ProtoMethods() *protoiface.Me i -= len(x.unknownFields) copy(dAtA[i:], x.unknownFields) } + if x.DestChainId != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.DestChainId)) + i-- + dAtA[i] = 0x18 + } if x.Params != nil { encoded, err := options.Marshal(x.Params) if err != nil { @@ -6408,6 +6437,25 @@ func (x *fastReflection_MsgUpdateCrossChainParams) ProtoMethods() *protoiface.Me return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err } iNdEx = postIndex + case 3: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field DestChainId", wireType) + } + x.DestChainId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + x.DestChainId |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := runtime.Skip(dAtA[iNdEx:]) @@ -7365,7 +7413,8 @@ type MsgUpdateCrossChainParams struct { // authority is the address that controls the module (defaults to x/gov unless overwritten). Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` // for cross chain param change or contract upgrade - Params *CrossChainParamsChange `protobuf:"bytes,2,opt,name=params,proto3" json:"params,omitempty"` + Params *CrossChainParamsChange `protobuf:"bytes,2,opt,name=params,proto3" json:"params,omitempty"` + DestChainId uint32 `protobuf:"varint,3,opt,name=dest_chain_id,json=destChainId,proto3" json:"dest_chain_id,omitempty"` } func (x *MsgUpdateCrossChainParams) Reset() { @@ -7402,6 +7451,13 @@ func (x *MsgUpdateCrossChainParams) GetParams() *CrossChainParamsChange { return nil } +func (x *MsgUpdateCrossChainParams) GetDestChainId() uint32 { + if x != nil { + return x.DestChainId + } + return 0 +} + // MsgUpdateCrossChainParamsResponse defines the response structure for executing a MsgUpdateCrossChainParams message. type MsgUpdateCrossChainParamsResponse struct { state protoimpl.MessageState @@ -7547,7 +7603,7 @@ var file_cosmos_gov_v1_tx_proto_rawDesc = []byte{ 0x6f, 0x76, 0x2f, 0x76, 0x31, 0x2f, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x22, 0x19, 0x0a, 0x17, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x22, 0xdf, 0x01, 0x0a, 0x19, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, 0x72, + 0x22, 0x83, 0x02, 0x0a, 0x19, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, 0x72, 0x6f, 0x73, 0x73, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x36, 0x0a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, @@ -7557,63 +7613,66 @@ var file_cosmos_gov_v1_tx_proto_rawDesc = []byte{ 0x67, 0x6f, 0x76, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x6f, 0x73, 0x73, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x42, 0x09, 0xc8, 0xde, 0x1f, 0x00, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, - 0x3a, 0x40, 0x82, 0xe7, 0xb0, 0x2a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, - 0x8a, 0xe7, 0xb0, 0x2a, 0x2d, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2f, - 0x78, 0x2f, 0x67, 0x6f, 0x76, 0x2f, 0x76, 0x31, 0x2f, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, - 0x74, 0x65, 0x43, 0x72, 0x6f, 0x73, 0x73, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x50, 0x61, 0x72, 0x61, - 0x6d, 0x73, 0x22, 0x23, 0x0a, 0x21, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, + 0x12, 0x22, 0x0a, 0x0d, 0x64, 0x65, 0x73, 0x74, 0x5f, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x5f, 0x69, + 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x74, 0x43, 0x68, 0x61, + 0x69, 0x6e, 0x49, 0x64, 0x3a, 0x40, 0x82, 0xe7, 0xb0, 0x2a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, + 0x72, 0x69, 0x74, 0x79, 0x8a, 0xe7, 0xb0, 0x2a, 0x2d, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, + 0x73, 0x64, 0x6b, 0x2f, 0x78, 0x2f, 0x67, 0x6f, 0x76, 0x2f, 0x76, 0x31, 0x2f, 0x4d, 0x73, 0x67, + 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, 0x72, 0x6f, 0x73, 0x73, 0x43, 0x68, 0x61, 0x69, 0x6e, + 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x22, 0x23, 0x0a, 0x21, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, + 0x61, 0x74, 0x65, 0x43, 0x72, 0x6f, 0x73, 0x73, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x50, 0x61, 0x72, + 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0x80, 0x05, 0x0a, 0x03, + 0x4d, 0x73, 0x67, 0x12, 0x5c, 0x0a, 0x0e, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x50, 0x72, 0x6f, + 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x12, 0x20, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x67, + 0x6f, 0x76, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x50, + 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x1a, 0x28, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, + 0x2e, 0x67, 0x6f, 0x76, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x53, 0x75, 0x62, 0x6d, 0x69, + 0x74, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x65, 0x0a, 0x11, 0x45, 0x78, 0x65, 0x63, 0x4c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x43, + 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x12, 0x23, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, + 0x67, 0x6f, 0x76, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x45, 0x78, 0x65, 0x63, 0x4c, 0x65, + 0x67, 0x61, 0x63, 0x79, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x1a, 0x2b, 0x2e, 0x63, 0x6f, + 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x67, 0x6f, 0x76, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x45, + 0x78, 0x65, 0x63, 0x4c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3e, 0x0a, 0x04, 0x56, 0x6f, 0x74, 0x65, + 0x12, 0x16, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x67, 0x6f, 0x76, 0x2e, 0x76, 0x31, + 0x2e, 0x4d, 0x73, 0x67, 0x56, 0x6f, 0x74, 0x65, 0x1a, 0x1e, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, + 0x73, 0x2e, 0x67, 0x6f, 0x76, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x56, 0x6f, 0x74, 0x65, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x56, 0x0a, 0x0c, 0x56, 0x6f, 0x74, 0x65, + 0x57, 0x65, 0x69, 0x67, 0x68, 0x74, 0x65, 0x64, 0x12, 0x1e, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, + 0x73, 0x2e, 0x67, 0x6f, 0x76, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x56, 0x6f, 0x74, 0x65, + 0x57, 0x65, 0x69, 0x67, 0x68, 0x74, 0x65, 0x64, 0x1a, 0x26, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, + 0x73, 0x2e, 0x67, 0x6f, 0x76, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x56, 0x6f, 0x74, 0x65, + 0x57, 0x65, 0x69, 0x67, 0x68, 0x74, 0x65, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x47, 0x0a, 0x07, 0x44, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x12, 0x19, 0x2e, 0x63, 0x6f, + 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x67, 0x6f, 0x76, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x44, + 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x1a, 0x21, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, + 0x67, 0x6f, 0x76, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x44, 0x65, 0x70, 0x6f, 0x73, 0x69, + 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x56, 0x0a, 0x0c, 0x55, 0x70, 0x64, + 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x1e, 0x2e, 0x63, 0x6f, 0x73, 0x6d, + 0x6f, 0x73, 0x2e, 0x67, 0x6f, 0x76, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, + 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x1a, 0x26, 0x2e, 0x63, 0x6f, 0x73, 0x6d, + 0x6f, 0x73, 0x2e, 0x67, 0x6f, 0x76, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, + 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x74, 0x0a, 0x16, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, 0x72, 0x6f, 0x73, 0x73, + 0x43, 0x68, 0x61, 0x69, 0x6e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x28, 0x2e, 0x63, 0x6f, + 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x67, 0x6f, 0x76, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x55, + 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, 0x72, 0x6f, 0x73, 0x73, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x50, + 0x61, 0x72, 0x61, 0x6d, 0x73, 0x1a, 0x30, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x67, + 0x6f, 0x76, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, 0x72, 0x6f, 0x73, 0x73, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0x80, 0x05, 0x0a, 0x03, 0x4d, 0x73, 0x67, 0x12, - 0x5c, 0x0a, 0x0e, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, - 0x6c, 0x12, 0x20, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x67, 0x6f, 0x76, 0x2e, 0x76, - 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x50, 0x72, 0x6f, 0x70, 0x6f, - 0x73, 0x61, 0x6c, 0x1a, 0x28, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x67, 0x6f, 0x76, - 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x50, 0x72, 0x6f, - 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x65, 0x0a, - 0x11, 0x45, 0x78, 0x65, 0x63, 0x4c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x43, 0x6f, 0x6e, 0x74, 0x65, - 0x6e, 0x74, 0x12, 0x23, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x67, 0x6f, 0x76, 0x2e, - 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x45, 0x78, 0x65, 0x63, 0x4c, 0x65, 0x67, 0x61, 0x63, 0x79, - 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x1a, 0x2b, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, - 0x2e, 0x67, 0x6f, 0x76, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x45, 0x78, 0x65, 0x63, 0x4c, - 0x65, 0x67, 0x61, 0x63, 0x79, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3e, 0x0a, 0x04, 0x56, 0x6f, 0x74, 0x65, 0x12, 0x16, 0x2e, 0x63, - 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x67, 0x6f, 0x76, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, - 0x56, 0x6f, 0x74, 0x65, 0x1a, 0x1e, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x67, 0x6f, - 0x76, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x56, 0x6f, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x56, 0x0a, 0x0c, 0x56, 0x6f, 0x74, 0x65, 0x57, 0x65, 0x69, 0x67, - 0x68, 0x74, 0x65, 0x64, 0x12, 0x1e, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x67, 0x6f, - 0x76, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x56, 0x6f, 0x74, 0x65, 0x57, 0x65, 0x69, 0x67, - 0x68, 0x74, 0x65, 0x64, 0x1a, 0x26, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x67, 0x6f, - 0x76, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x56, 0x6f, 0x74, 0x65, 0x57, 0x65, 0x69, 0x67, - 0x68, 0x74, 0x65, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x47, 0x0a, 0x07, - 0x44, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x12, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, - 0x2e, 0x67, 0x6f, 0x76, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x44, 0x65, 0x70, 0x6f, 0x73, - 0x69, 0x74, 0x1a, 0x21, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x67, 0x6f, 0x76, 0x2e, - 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x44, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x56, 0x0a, 0x0c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, - 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x1e, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x67, - 0x6f, 0x76, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, - 0x61, 0x72, 0x61, 0x6d, 0x73, 0x1a, 0x26, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x67, - 0x6f, 0x76, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, - 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x74, 0x0a, - 0x16, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, 0x72, 0x6f, 0x73, 0x73, 0x43, 0x68, 0x61, 0x69, - 0x6e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x28, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, - 0x2e, 0x67, 0x6f, 0x76, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, - 0x65, 0x43, 0x72, 0x6f, 0x73, 0x73, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x50, 0x61, 0x72, 0x61, 0x6d, - 0x73, 0x1a, 0x30, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x67, 0x6f, 0x76, 0x2e, 0x76, - 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, 0x72, 0x6f, 0x73, 0x73, - 0x43, 0x68, 0x61, 0x69, 0x6e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x1a, 0x05, 0x80, 0xe7, 0xb0, 0x2a, 0x01, 0x42, 0x98, 0x01, 0x0a, 0x11, 0x63, - 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x67, 0x6f, 0x76, 0x2e, 0x76, 0x31, - 0x42, 0x07, 0x54, 0x78, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x24, 0x63, 0x6f, 0x73, - 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6f, - 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x67, 0x6f, 0x76, 0x2f, 0x76, 0x31, 0x3b, 0x67, 0x6f, 0x76, 0x76, - 0x31, 0xa2, 0x02, 0x03, 0x43, 0x47, 0x58, 0xaa, 0x02, 0x0d, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, - 0x2e, 0x47, 0x6f, 0x76, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x0d, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, - 0x5c, 0x47, 0x6f, 0x76, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x19, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, - 0x5c, 0x47, 0x6f, 0x76, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, - 0x61, 0x74, 0x61, 0xea, 0x02, 0x0f, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x47, 0x6f, - 0x76, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x1a, 0x05, 0x80, 0xe7, 0xb0, 0x2a, 0x01, 0x42, 0x98, + 0x01, 0x0a, 0x11, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x67, 0x6f, + 0x76, 0x2e, 0x76, 0x31, 0x42, 0x07, 0x54, 0x78, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, + 0x24, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, + 0x69, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x67, 0x6f, 0x76, 0x2f, 0x76, 0x31, 0x3b, + 0x67, 0x6f, 0x76, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x43, 0x47, 0x58, 0xaa, 0x02, 0x0d, 0x43, 0x6f, + 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x47, 0x6f, 0x76, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x0d, 0x43, 0x6f, + 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x47, 0x6f, 0x76, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x19, 0x43, 0x6f, + 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x47, 0x6f, 0x76, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, + 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0f, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, + 0x3a, 0x3a, 0x47, 0x6f, 0x76, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x33, } var ( diff --git a/proto/cosmos/gov/v1/gov.proto b/proto/cosmos/gov/v1/gov.proto index 31009b3881..5b8199d395 100644 --- a/proto/cosmos/gov/v1/gov.proto +++ b/proto/cosmos/gov/v1/gov.proto @@ -231,4 +231,3 @@ message CrossChainParamsChange { // targets defines a slice of addresses string in hex format repeated string targets = 3; } - diff --git a/proto/cosmos/gov/v1/tx.proto b/proto/cosmos/gov/v1/tx.proto index 89b7003051..f9d4285407 100644 --- a/proto/cosmos/gov/v1/tx.proto +++ b/proto/cosmos/gov/v1/tx.proto @@ -184,6 +184,8 @@ message MsgUpdateCrossChainParams { // for cross chain param change or contract upgrade CrossChainParamsChange params = 2 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; + + uint32 dest_chain_id = 3; } // MsgUpdateCrossChainParamsResponse defines the response structure for executing a MsgUpdateCrossChainParams message. diff --git a/x/crosschain/keeper/config.go b/x/crosschain/keeper/config.go index ec51a1327f..dd179aa78a 100644 --- a/x/crosschain/keeper/config.go +++ b/x/crosschain/keeper/config.go @@ -3,8 +3,10 @@ package keeper import sdk "github.com/cosmos/cosmos-sdk/types" type crossChainConfig struct { - srcChainID sdk.ChainID - destBscChainId sdk.ChainID + srcChainID sdk.ChainID + destBscChainId sdk.ChainID + destOpChainId sdk.ChainID + nameToChannelID map[string]sdk.ChannelID channelIDToName map[sdk.ChannelID]string channelIDToApp map[sdk.ChannelID]sdk.CrossChainApplication @@ -14,6 +16,7 @@ func newCrossChainCfg() *crossChainConfig { config := &crossChainConfig{ srcChainID: 0, destBscChainId: 0, + destOpChainId: 0, nameToChannelID: make(map[string]sdk.ChannelID), channelIDToName: make(map[sdk.ChannelID]string), channelIDToApp: make(map[sdk.ChannelID]sdk.CrossChainApplication), diff --git a/x/crosschain/keeper/keeper.go b/x/crosschain/keeper/keeper.go index 49689cba68..a7944568e6 100644 --- a/x/crosschain/keeper/keeper.go +++ b/x/crosschain/keeper/keeper.go @@ -175,7 +175,13 @@ func (k Keeper) RegisterChannel(name string, id sdk.ChannelID, app sdk.CrossChai // IsDestChainSupported returns the support status of a dest chain func (k Keeper) IsDestChainSupported(chainID sdk.ChainID) bool { - return chainID == k.cfg.destBscChainId + if chainID == k.cfg.destBscChainId { + return true + } + if k.cfg.destOpChainId != 0 && chainID == k.cfg.destOpChainId { + return true + } + return false } // IsChannelSupported returns the support status of a channel @@ -210,8 +216,8 @@ func (k Keeper) GetSrcChainID() sdk.ChainID { return k.cfg.srcChainID } -// SetDestChainID sets the destination chain id -func (k Keeper) SetDestChainID(destChainId sdk.ChainID) { +// SetDestBscChainID sets the destination chain id +func (k Keeper) SetDestBscChainID(destChainId sdk.ChainID) { k.cfg.destBscChainId = destChainId } @@ -220,6 +226,16 @@ func (k Keeper) GetDestBscChainID() sdk.ChainID { return k.cfg.destBscChainId } +// SetDestOpChainID sets the destination chain id of op chain +func (k Keeper) SetDestOpChainID(destChainId sdk.ChainID) { + k.cfg.destOpChainId = destChainId +} + +// GetDestOpChainID gets the destination chain id of op chain +func (k Keeper) GetDestOpChainID() sdk.ChainID { + return k.cfg.destOpChainId +} + // GetCrossChainPackage returns the ibc package by sequence func (k Keeper) GetCrossChainPackage(ctx sdk.Context, destChainId sdk.ChainID, channelId sdk.ChannelID, sequence uint64) ([]byte, error) { kvStore := ctx.KVStore(k.storeKey) diff --git a/x/crosschain/keeper/keeper_test.go b/x/crosschain/keeper/keeper_test.go index 7f77ad1887..f77243a02a 100644 --- a/x/crosschain/keeper/keeper_test.go +++ b/x/crosschain/keeper/keeper_test.go @@ -105,7 +105,7 @@ func (s *TestSuite) TestSetChannelSendPermission() { func (s *TestSuite) TestUpdateChannelPermission() { s.crossChainKeeper.RegisterChannel("test", 1, &testutil2.MockCrossChainApplication{}) - s.crossChainKeeper.SetDestChainID(1) + s.crossChainKeeper.SetDestBscChainID(1) s.crossChainKeeper.SetChannelSendPermission(s.ctx, sdk.ChainID(1), sdk.ChannelID(1), sdk.ChannelAllow) diff --git a/x/gov/keeper/common_test.go b/x/gov/keeper/common_test.go index 5831dac745..fb8ea82a9d 100644 --- a/x/gov/keeper/common_test.go +++ b/x/gov/keeper/common_test.go @@ -93,6 +93,7 @@ func setupGovKeeper(t *testing.T) ( crossChainKeeper.EXPECT().GetDestBscChainID().Return(sdk.ChainID(714)).AnyTimes() crossChainKeeper.EXPECT().CreateRawIBCPackageWithFee(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return(uint64(0), nil).AnyTimes() + crossChainKeeper.EXPECT().IsDestChainSupported(gomock.Any()).Return(true).AnyTimes() // Register all handlers for the MegServiceRouter. msr.SetInterfaceRegistry(encCfg.InterfaceRegistry) diff --git a/x/gov/keeper/crosschain.go b/x/gov/keeper/crosschain.go index 349c330b68..f82f8e45ea 100644 --- a/x/gov/keeper/crosschain.go +++ b/x/gov/keeper/crosschain.go @@ -11,10 +11,33 @@ import ( ) func (k Keeper) RegisterCrossChainSyncParamsApp() error { - return k.crossChainKeeper.RegisterChannel(types.SyncParamsChannel, types.SyncParamsChannelID, k) + if err := k.crossChainKeeper.RegisterChannel(types.SyncParamsChannel, types.SyncParamsChannelID, SyncParamsApp{keeper: k}); err != nil { + return err + } + + return nil } -func (k Keeper) SyncParams(ctx sdk.Context, cpc govv1.CrossChainParamsChange) error { +type SyncParamsApp struct { + keeper Keeper +} + +func (app SyncParamsApp) ExecuteSynPackage(ctx sdk.Context, _ *sdk.CrossChainAppContext, payload []byte) sdk.ExecuteResult { + app.keeper.Logger(ctx).Error("received sync params sync package", "payload", hex.EncodeToString(payload)) + return sdk.ExecuteResult{} +} + +func (app SyncParamsApp) ExecuteAckPackage(ctx sdk.Context, _ *sdk.CrossChainAppContext, payload []byte) sdk.ExecuteResult { + app.keeper.Logger(ctx).Error("received sync params in ack package", "payload", hex.EncodeToString(payload)) + return sdk.ExecuteResult{} +} + +func (app SyncParamsApp) ExecuteFailAckPackage(ctx sdk.Context, _ *sdk.CrossChainAppContext, payload []byte) sdk.ExecuteResult { + app.keeper.Logger(ctx).Error("received sync params fail ack package", "payload", hex.EncodeToString(payload)) + return sdk.ExecuteResult{} +} + +func (k Keeper) SyncParams(ctx sdk.Context, destChainId sdk.ChainID, cpc govv1.CrossChainParamsChange) error { if err := cpc.ValidateBasic(); err != nil { return err } @@ -45,9 +68,13 @@ func (k Keeper) SyncParams(ctx sdk.Context, cpc govv1.CrossChainParamsChange) er encodedPackage := pack.MustSerialize() + if !k.crossChainKeeper.IsDestChainSupported(destChainId) { + return sdkerrors.Wrapf(types.ErrChainNotSupported, "destination chain (%d) is not supported", destChainId) + } + _, err := k.crossChainKeeper.CreateRawIBCPackageWithFee( ctx, - k.crossChainKeeper.GetDestBscChainID(), + destChainId, types.SyncParamsChannelID, sdk.SynCrossChainPackageType, encodedPackage, @@ -56,18 +83,3 @@ func (k Keeper) SyncParams(ctx sdk.Context, cpc govv1.CrossChainParamsChange) er ) return err } - -func (k Keeper) ExecuteSynPackage(ctx sdk.Context, _ *sdk.CrossChainAppContext, payload []byte) sdk.ExecuteResult { - k.Logger(ctx).Error("received sync params sync package", "payload", hex.EncodeToString(payload)) - return sdk.ExecuteResult{} -} - -func (k Keeper) ExecuteAckPackage(ctx sdk.Context, _ *sdk.CrossChainAppContext, payload []byte) sdk.ExecuteResult { - k.Logger(ctx).Error("received sync params in ack package", "payload", hex.EncodeToString(payload)) - return sdk.ExecuteResult{} -} - -func (k Keeper) ExecuteFailAckPackage(ctx sdk.Context, _ *sdk.CrossChainAppContext, payload []byte) sdk.ExecuteResult { - k.Logger(ctx).Error("received sync params fail ack package", "payload", hex.EncodeToString(payload)) - return sdk.ExecuteResult{} -} diff --git a/x/gov/keeper/deposit.go b/x/gov/keeper/deposit.go index de6e564909..6e21fc5af9 100644 --- a/x/gov/keeper/deposit.go +++ b/x/gov/keeper/deposit.go @@ -10,30 +10,30 @@ import ( ) // GetDeposit gets the deposit of a specific depositor on a specific proposal -func (keeper Keeper) GetDeposit(ctx sdk.Context, proposalID uint64, depositorAddr sdk.AccAddress) (deposit v1.Deposit, found bool) { - store := ctx.KVStore(keeper.storeKey) +func (k Keeper) GetDeposit(ctx sdk.Context, proposalID uint64, depositorAddr sdk.AccAddress) (deposit v1.Deposit, found bool) { + store := ctx.KVStore(k.storeKey) bz := store.Get(types.DepositKey(proposalID, depositorAddr)) if bz == nil { return deposit, false } - keeper.cdc.MustUnmarshal(bz, &deposit) + k.cdc.MustUnmarshal(bz, &deposit) return deposit, true } // SetDeposit sets a Deposit to the gov store -func (keeper Keeper) SetDeposit(ctx sdk.Context, deposit v1.Deposit) { - store := ctx.KVStore(keeper.storeKey) - bz := keeper.cdc.MustMarshal(&deposit) +func (k Keeper) SetDeposit(ctx sdk.Context, deposit v1.Deposit) { + store := ctx.KVStore(k.storeKey) + bz := k.cdc.MustMarshal(&deposit) depositor := sdk.MustAccAddressFromHex(deposit.Depositor) store.Set(types.DepositKey(deposit.ProposalId, depositor), bz) } // GetAllDeposits returns all the deposits from the store -func (keeper Keeper) GetAllDeposits(ctx sdk.Context) (deposits v1.Deposits) { - keeper.IterateAllDeposits(ctx, func(deposit v1.Deposit) bool { +func (k Keeper) GetAllDeposits(ctx sdk.Context) (deposits v1.Deposits) { + k.IterateAllDeposits(ctx, func(deposit v1.Deposit) bool { deposits = append(deposits, &deposit) return false }) @@ -42,8 +42,8 @@ func (keeper Keeper) GetAllDeposits(ctx sdk.Context) (deposits v1.Deposits) { } // GetDeposits returns all the deposits of a proposal -func (keeper Keeper) GetDeposits(ctx sdk.Context, proposalID uint64) (deposits v1.Deposits) { - keeper.IterateDeposits(ctx, proposalID, func(deposit v1.Deposit) bool { +func (k Keeper) GetDeposits(ctx sdk.Context, proposalID uint64) (deposits v1.Deposits) { + k.IterateDeposits(ctx, proposalID, func(deposit v1.Deposit) bool { deposits = append(deposits, &deposit) return false }) @@ -52,11 +52,11 @@ func (keeper Keeper) GetDeposits(ctx sdk.Context, proposalID uint64) (deposits v } // DeleteAndBurnDeposits deletes and burns all the deposits on a specific proposal. -func (keeper Keeper) DeleteAndBurnDeposits(ctx sdk.Context, proposalID uint64) { - store := ctx.KVStore(keeper.storeKey) +func (k Keeper) DeleteAndBurnDeposits(ctx sdk.Context, proposalID uint64) { + store := ctx.KVStore(k.storeKey) - keeper.IterateDeposits(ctx, proposalID, func(deposit v1.Deposit) bool { - err := keeper.bankKeeper.BurnCoins(ctx, types.ModuleName, deposit.Amount) + k.IterateDeposits(ctx, proposalID, func(deposit v1.Deposit) bool { + err := k.bankKeeper.BurnCoins(ctx, types.ModuleName, deposit.Amount) if err != nil { panic(err) } @@ -69,8 +69,8 @@ func (keeper Keeper) DeleteAndBurnDeposits(ctx sdk.Context, proposalID uint64) { } // IterateAllDeposits iterates over all the stored deposits and performs a callback function. -func (keeper Keeper) IterateAllDeposits(ctx sdk.Context, cb func(deposit v1.Deposit) (stop bool)) { - store := ctx.KVStore(keeper.storeKey) +func (k Keeper) IterateAllDeposits(ctx sdk.Context, cb func(deposit v1.Deposit) (stop bool)) { + store := ctx.KVStore(k.storeKey) iterator := sdk.KVStorePrefixIterator(store, types.DepositsKeyPrefix) defer iterator.Close() @@ -78,7 +78,7 @@ func (keeper Keeper) IterateAllDeposits(ctx sdk.Context, cb func(deposit v1.Depo for ; iterator.Valid(); iterator.Next() { var deposit v1.Deposit - keeper.cdc.MustUnmarshal(iterator.Value(), &deposit) + k.cdc.MustUnmarshal(iterator.Value(), &deposit) if cb(deposit) { break @@ -87,8 +87,8 @@ func (keeper Keeper) IterateAllDeposits(ctx sdk.Context, cb func(deposit v1.Depo } // IterateDeposits iterates over all the proposals deposits and performs a callback function -func (keeper Keeper) IterateDeposits(ctx sdk.Context, proposalID uint64, cb func(deposit v1.Deposit) (stop bool)) { - store := ctx.KVStore(keeper.storeKey) +func (k Keeper) IterateDeposits(ctx sdk.Context, proposalID uint64, cb func(deposit v1.Deposit) (stop bool)) { + store := ctx.KVStore(k.storeKey) iterator := sdk.KVStorePrefixIterator(store, types.DepositsKey(proposalID)) defer iterator.Close() @@ -96,7 +96,7 @@ func (keeper Keeper) IterateDeposits(ctx sdk.Context, proposalID uint64, cb func for ; iterator.Valid(); iterator.Next() { var deposit v1.Deposit - keeper.cdc.MustUnmarshal(iterator.Value(), &deposit) + k.cdc.MustUnmarshal(iterator.Value(), &deposit) if cb(deposit) { break @@ -106,9 +106,9 @@ func (keeper Keeper) IterateDeposits(ctx sdk.Context, proposalID uint64, cb func // AddDeposit adds or updates a deposit of a specific depositor on a specific proposal. // Activates voting period when appropriate and returns true in that case, else returns false. -func (keeper Keeper) AddDeposit(ctx sdk.Context, proposalID uint64, depositorAddr sdk.AccAddress, depositAmount sdk.Coins) (bool, error) { +func (k Keeper) AddDeposit(ctx sdk.Context, proposalID uint64, depositorAddr sdk.AccAddress, depositAmount sdk.Coins) (bool, error) { // Checks to see if proposal exists - proposal, ok := keeper.GetProposal(ctx, proposalID) + proposal, ok := k.GetProposal(ctx, proposalID) if !ok { return false, sdkerrors.Wrapf(types.ErrUnknownProposal, "%d", proposalID) } @@ -119,26 +119,26 @@ func (keeper Keeper) AddDeposit(ctx sdk.Context, proposalID uint64, depositorAdd } // update the governance module's account coins pool - err := keeper.bankKeeper.SendCoinsFromAccountToModule(ctx, depositorAddr, types.ModuleName, depositAmount) + err := k.bankKeeper.SendCoinsFromAccountToModule(ctx, depositorAddr, types.ModuleName, depositAmount) if err != nil { return false, err } // Update proposal proposal.TotalDeposit = sdk.NewCoins(proposal.TotalDeposit...).Add(depositAmount...) - keeper.SetProposal(ctx, proposal) + k.SetProposal(ctx, proposal) // Check if deposit has provided sufficient total funds to transition the proposal into the voting period activatedVotingPeriod := false - if proposal.Status == v1.StatusDepositPeriod && sdk.NewCoins(proposal.TotalDeposit...).IsAllGTE(keeper.GetParams(ctx).MinDeposit) { - keeper.ActivateVotingPeriod(ctx, proposal) + if proposal.Status == v1.StatusDepositPeriod && sdk.NewCoins(proposal.TotalDeposit...).IsAllGTE(k.GetParams(ctx).MinDeposit) { + k.ActivateVotingPeriod(ctx, proposal) activatedVotingPeriod = true } // Add or update deposit object - deposit, found := keeper.GetDeposit(ctx, proposalID, depositorAddr) + deposit, found := k.GetDeposit(ctx, proposalID, depositorAddr) if found { deposit.Amount = sdk.NewCoins(deposit.Amount...).Add(depositAmount...) @@ -147,7 +147,7 @@ func (keeper Keeper) AddDeposit(ctx sdk.Context, proposalID uint64, depositorAdd } // called when deposit has been added to a proposal, however the proposal may not be active - keeper.Hooks().AfterProposalDeposit(ctx, proposalID, depositorAddr) + k.Hooks().AfterProposalDeposit(ctx, proposalID, depositorAddr) ctx.EventManager().EmitEvent( sdk.NewEvent( @@ -157,19 +157,19 @@ func (keeper Keeper) AddDeposit(ctx sdk.Context, proposalID uint64, depositorAdd ), ) - keeper.SetDeposit(ctx, deposit) + k.SetDeposit(ctx, deposit) return activatedVotingPeriod, nil } // RefundAndDeleteDeposits refunds and deletes all the deposits on a specific proposal. -func (keeper Keeper) RefundAndDeleteDeposits(ctx sdk.Context, proposalID uint64) { - store := ctx.KVStore(keeper.storeKey) +func (k Keeper) RefundAndDeleteDeposits(ctx sdk.Context, proposalID uint64) { + store := ctx.KVStore(k.storeKey) - keeper.IterateDeposits(ctx, proposalID, func(deposit v1.Deposit) bool { + k.IterateDeposits(ctx, proposalID, func(deposit v1.Deposit) bool { depositor := sdk.MustAccAddressFromHex(deposit.Depositor) - err := keeper.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, depositor, deposit.Amount) + err := k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, depositor, deposit.Amount) if err != nil { panic(err) } @@ -182,8 +182,8 @@ func (keeper Keeper) RefundAndDeleteDeposits(ctx sdk.Context, proposalID uint64) // validateInitialDeposit validates if initial deposit is greater than or equal to the minimum // required at the time of proposal submission. This threshold amount is determined by // the deposit parameters. Returns nil on success, error otherwise. -func (keeper Keeper) validateInitialDeposit(ctx sdk.Context, initialDeposit sdk.Coins) error { - params := keeper.GetParams(ctx) +func (k Keeper) validateInitialDeposit(ctx sdk.Context, initialDeposit sdk.Coins) error { + params := k.GetParams(ctx) minInitialDepositRatio, err := sdk.NewDecFromStr(params.MinInitialDepositRatio) if err != nil { return err diff --git a/x/gov/keeper/grpc_query.go b/x/gov/keeper/grpc_query.go index cbaa7fd4da..e0ec61ebda 100644 --- a/x/gov/keeper/grpc_query.go +++ b/x/gov/keeper/grpc_query.go @@ -18,7 +18,7 @@ import ( var _ v1.QueryServer = Keeper{} // Proposal returns proposal details based on ProposalID -func (q Keeper) Proposal(c context.Context, req *v1.QueryProposalRequest) (*v1.QueryProposalResponse, error) { +func (k Keeper) Proposal(c context.Context, req *v1.QueryProposalRequest) (*v1.QueryProposalResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "invalid request") } @@ -29,7 +29,7 @@ func (q Keeper) Proposal(c context.Context, req *v1.QueryProposalRequest) (*v1.Q ctx := sdk.UnwrapSDKContext(c) - proposal, found := q.GetProposal(ctx, req.ProposalId) + proposal, found := k.GetProposal(ctx, req.ProposalId) if !found { return nil, status.Errorf(codes.NotFound, "proposal %d doesn't exist", req.ProposalId) } @@ -38,14 +38,14 @@ func (q Keeper) Proposal(c context.Context, req *v1.QueryProposalRequest) (*v1.Q } // Proposals implements the Query/Proposals gRPC method -func (q Keeper) Proposals(c context.Context, req *v1.QueryProposalsRequest) (*v1.QueryProposalsResponse, error) { +func (k Keeper) Proposals(c context.Context, req *v1.QueryProposalsRequest) (*v1.QueryProposalsResponse, error) { ctx := sdk.UnwrapSDKContext(c) - store := ctx.KVStore(q.storeKey) + store := ctx.KVStore(k.storeKey) proposalStore := prefix.NewStore(store, types.ProposalsKeyPrefix) filteredProposals, pageRes, err := query.GenericFilteredPaginate( - q.cdc, + k.cdc, proposalStore, req.Pagination, func(key []byte, p *v1.Proposal) (*v1.Proposal, error) { @@ -63,7 +63,7 @@ func (q Keeper) Proposals(c context.Context, req *v1.QueryProposalsRequest) (*v1 return nil, err } - _, matchVoter = q.GetVote(ctx, p.Id, voter) + _, matchVoter = k.GetVote(ctx, p.Id, voter) } // match depositor (if supplied) @@ -72,7 +72,7 @@ func (q Keeper) Proposals(c context.Context, req *v1.QueryProposalsRequest) (*v1 if err != nil { return nil, err } - _, matchDepositor = q.GetDeposit(ctx, p.Id, depositor) + _, matchDepositor = k.GetDeposit(ctx, p.Id, depositor) } if matchVoter && matchDepositor && matchStatus { @@ -91,7 +91,7 @@ func (q Keeper) Proposals(c context.Context, req *v1.QueryProposalsRequest) (*v1 } // Vote returns Voted information based on proposalID, voterAddr -func (q Keeper) Vote(c context.Context, req *v1.QueryVoteRequest) (*v1.QueryVoteResponse, error) { +func (k Keeper) Vote(c context.Context, req *v1.QueryVoteRequest) (*v1.QueryVoteResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "invalid request") } @@ -110,7 +110,7 @@ func (q Keeper) Vote(c context.Context, req *v1.QueryVoteRequest) (*v1.QueryVote if err != nil { return nil, err } - vote, found := q.GetVote(ctx, req.ProposalId, voter) + vote, found := k.GetVote(ctx, req.ProposalId, voter) if !found { return nil, status.Errorf(codes.InvalidArgument, "voter: %v not found for proposal: %v", req.Voter, req.ProposalId) @@ -120,7 +120,7 @@ func (q Keeper) Vote(c context.Context, req *v1.QueryVoteRequest) (*v1.QueryVote } // Votes returns single proposal's votes -func (q Keeper) Votes(c context.Context, req *v1.QueryVotesRequest) (*v1.QueryVotesResponse, error) { +func (k Keeper) Votes(c context.Context, req *v1.QueryVotesRequest) (*v1.QueryVotesResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "invalid request") } @@ -132,12 +132,12 @@ func (q Keeper) Votes(c context.Context, req *v1.QueryVotesRequest) (*v1.QueryVo var votes v1.Votes ctx := sdk.UnwrapSDKContext(c) - store := ctx.KVStore(q.storeKey) + store := ctx.KVStore(k.storeKey) votesStore := prefix.NewStore(store, types.VotesKey(req.ProposalId)) pageRes, err := query.Paginate(votesStore, req.Pagination, func(key []byte, value []byte) error { var vote v1.Vote - if err := q.cdc.Unmarshal(value, &vote); err != nil { + if err := k.cdc.Unmarshal(value, &vote); err != nil { return err } @@ -152,13 +152,13 @@ func (q Keeper) Votes(c context.Context, req *v1.QueryVotesRequest) (*v1.QueryVo } // Params queries all params -func (q Keeper) Params(c context.Context, req *v1.QueryParamsRequest) (*v1.QueryParamsResponse, error) { +func (k Keeper) Params(c context.Context, req *v1.QueryParamsRequest) (*v1.QueryParamsResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "invalid request") } ctx := sdk.UnwrapSDKContext(c) - params := q.GetParams(ctx) + params := k.GetParams(ctx) response := &v1.QueryParamsResponse{} @@ -187,7 +187,7 @@ func (q Keeper) Params(c context.Context, req *v1.QueryParamsRequest) (*v1.Query } // Deposit queries single deposit information based on proposalID, depositAddr. -func (q Keeper) Deposit(c context.Context, req *v1.QueryDepositRequest) (*v1.QueryDepositResponse, error) { +func (k Keeper) Deposit(c context.Context, req *v1.QueryDepositRequest) (*v1.QueryDepositResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "invalid request") } @@ -206,7 +206,7 @@ func (q Keeper) Deposit(c context.Context, req *v1.QueryDepositRequest) (*v1.Que if err != nil { return nil, err } - deposit, found := q.GetDeposit(ctx, req.ProposalId, depositor) + deposit, found := k.GetDeposit(ctx, req.ProposalId, depositor) if !found { return nil, status.Errorf(codes.InvalidArgument, "depositer: %v not found for proposal: %v", req.Depositor, req.ProposalId) @@ -216,7 +216,7 @@ func (q Keeper) Deposit(c context.Context, req *v1.QueryDepositRequest) (*v1.Que } // Deposits returns single proposal's all deposits -func (q Keeper) Deposits(c context.Context, req *v1.QueryDepositsRequest) (*v1.QueryDepositsResponse, error) { +func (k Keeper) Deposits(c context.Context, req *v1.QueryDepositsRequest) (*v1.QueryDepositsResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "invalid request") } @@ -228,12 +228,12 @@ func (q Keeper) Deposits(c context.Context, req *v1.QueryDepositsRequest) (*v1.Q var deposits []*v1.Deposit ctx := sdk.UnwrapSDKContext(c) - store := ctx.KVStore(q.storeKey) + store := ctx.KVStore(k.storeKey) depositStore := prefix.NewStore(store, types.DepositsKey(req.ProposalId)) pageRes, err := query.Paginate(depositStore, req.Pagination, func(key []byte, value []byte) error { var deposit v1.Deposit - if err := q.cdc.Unmarshal(value, &deposit); err != nil { + if err := k.cdc.Unmarshal(value, &deposit); err != nil { return err } @@ -248,7 +248,7 @@ func (q Keeper) Deposits(c context.Context, req *v1.QueryDepositsRequest) (*v1.Q } // TallyResult queries the tally of a proposal vote -func (q Keeper) TallyResult(c context.Context, req *v1.QueryTallyResultRequest) (*v1.QueryTallyResultResponse, error) { +func (k Keeper) TallyResult(c context.Context, req *v1.QueryTallyResultRequest) (*v1.QueryTallyResultResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "invalid request") } @@ -259,7 +259,7 @@ func (q Keeper) TallyResult(c context.Context, req *v1.QueryTallyResultRequest) ctx := sdk.UnwrapSDKContext(c) - proposal, ok := q.GetProposal(ctx, req.ProposalId) + proposal, ok := k.GetProposal(ctx, req.ProposalId) if !ok { return nil, status.Errorf(codes.NotFound, "proposal %d doesn't exist", req.ProposalId) } @@ -275,7 +275,7 @@ func (q Keeper) TallyResult(c context.Context, req *v1.QueryTallyResultRequest) default: // proposal is in voting period - _, _, tallyResult = q.Tally(ctx, proposal) + _, _, tallyResult = k.Tally(ctx, proposal) } return &v1.QueryTallyResultResponse{Tally: &tallyResult}, nil diff --git a/x/gov/keeper/keeper.go b/x/gov/keeper/keeper.go index 333566cf5e..8bb8fb9b20 100644 --- a/x/gov/keeper/keeper.go +++ b/x/gov/keeper/keeper.go @@ -92,80 +92,80 @@ func NewKeeper( } // Hooks gets the hooks for governance *Keeper { -func (keeper *Keeper) Hooks() types.GovHooks { - if keeper.hooks == nil { +func (k *Keeper) Hooks() types.GovHooks { + if k.hooks == nil { // return a no-op implementation if no hooks are set return types.MultiGovHooks{} } - return keeper.hooks + return k.hooks } // SetHooks sets the hooks for governance -func (keeper *Keeper) SetHooks(gh types.GovHooks) *Keeper { - if keeper.hooks != nil { +func (k *Keeper) SetHooks(gh types.GovHooks) *Keeper { + if k.hooks != nil { panic("cannot set governance hooks twice") } - keeper.hooks = gh + k.hooks = gh - return keeper + return k } // SetLegacyRouter sets the legacy router for governance -func (keeper *Keeper) SetLegacyRouter(router v1beta1.Router) { +func (k *Keeper) SetLegacyRouter(router v1beta1.Router) { // It is vital to seal the governance proposal router here as to not allow // further handlers to be registered after the keeper is created since this // could create invalid or non-deterministic behavior. router.Seal() - keeper.legacyRouter = router + k.legacyRouter = router } // Logger returns a module-specific logger. -func (keeper Keeper) Logger(ctx sdk.Context) log.Logger { +func (k Keeper) Logger(ctx sdk.Context) log.Logger { return ctx.Logger().With("module", "x/"+types.ModuleName) } // Router returns the gov keeper's router -func (keeper Keeper) Router() *baseapp.MsgServiceRouter { - return keeper.router +func (k Keeper) Router() *baseapp.MsgServiceRouter { + return k.router } // LegacyRouter returns the gov keeper's legacy router -func (keeper Keeper) LegacyRouter() v1beta1.Router { - return keeper.legacyRouter +func (k Keeper) LegacyRouter() v1beta1.Router { + return k.legacyRouter } // GetGovernanceAccount returns the governance ModuleAccount -func (keeper Keeper) GetGovernanceAccount(ctx sdk.Context) authtypes.ModuleAccountI { - return keeper.authKeeper.GetModuleAccount(ctx, types.ModuleName) +func (k Keeper) GetGovernanceAccount(ctx sdk.Context) authtypes.ModuleAccountI { + return k.authKeeper.GetModuleAccount(ctx, types.ModuleName) } // ProposalQueues // InsertActiveProposalQueue inserts a proposalID into the active proposal queue at endTime -func (keeper Keeper) InsertActiveProposalQueue(ctx sdk.Context, proposalID uint64, endTime time.Time) { - store := ctx.KVStore(keeper.storeKey) +func (k Keeper) InsertActiveProposalQueue(ctx sdk.Context, proposalID uint64, endTime time.Time) { + store := ctx.KVStore(k.storeKey) bz := types.GetProposalIDBytes(proposalID) store.Set(types.ActiveProposalQueueKey(proposalID, endTime), bz) } // RemoveFromActiveProposalQueue removes a proposalID from the Active Proposal Queue -func (keeper Keeper) RemoveFromActiveProposalQueue(ctx sdk.Context, proposalID uint64, endTime time.Time) { - store := ctx.KVStore(keeper.storeKey) +func (k Keeper) RemoveFromActiveProposalQueue(ctx sdk.Context, proposalID uint64, endTime time.Time) { + store := ctx.KVStore(k.storeKey) store.Delete(types.ActiveProposalQueueKey(proposalID, endTime)) } // InsertInactiveProposalQueue inserts a proposalID into the inactive proposal queue at endTime -func (keeper Keeper) InsertInactiveProposalQueue(ctx sdk.Context, proposalID uint64, endTime time.Time) { - store := ctx.KVStore(keeper.storeKey) +func (k Keeper) InsertInactiveProposalQueue(ctx sdk.Context, proposalID uint64, endTime time.Time) { + store := ctx.KVStore(k.storeKey) bz := types.GetProposalIDBytes(proposalID) store.Set(types.InactiveProposalQueueKey(proposalID, endTime), bz) } // RemoveFromInactiveProposalQueue removes a proposalID from the Inactive Proposal Queue -func (keeper Keeper) RemoveFromInactiveProposalQueue(ctx sdk.Context, proposalID uint64, endTime time.Time) { - store := ctx.KVStore(keeper.storeKey) +func (k Keeper) RemoveFromInactiveProposalQueue(ctx sdk.Context, proposalID uint64, endTime time.Time) { + store := ctx.KVStore(k.storeKey) store.Delete(types.InactiveProposalQueueKey(proposalID, endTime)) } @@ -173,13 +173,13 @@ func (keeper Keeper) RemoveFromInactiveProposalQueue(ctx sdk.Context, proposalID // IterateActiveProposalsQueue iterates over the proposals in the active proposal queue // and performs a callback function -func (keeper Keeper) IterateActiveProposalsQueue(ctx sdk.Context, endTime time.Time, cb func(proposal v1.Proposal) (stop bool)) { - iterator := keeper.ActiveProposalQueueIterator(ctx, endTime) +func (k Keeper) IterateActiveProposalsQueue(ctx sdk.Context, endTime time.Time, cb func(proposal v1.Proposal) (stop bool)) { + iterator := k.ActiveProposalQueueIterator(ctx, endTime) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { proposalID, _ := types.SplitActiveProposalQueueKey(iterator.Key()) - proposal, found := keeper.GetProposal(ctx, proposalID) + proposal, found := k.GetProposal(ctx, proposalID) if !found { panic(fmt.Sprintf("proposal %d does not exist", proposalID)) } @@ -192,13 +192,13 @@ func (keeper Keeper) IterateActiveProposalsQueue(ctx sdk.Context, endTime time.T // IterateInactiveProposalsQueue iterates over the proposals in the inactive proposal queue // and performs a callback function -func (keeper Keeper) IterateInactiveProposalsQueue(ctx sdk.Context, endTime time.Time, cb func(proposal v1.Proposal) (stop bool)) { - iterator := keeper.InactiveProposalQueueIterator(ctx, endTime) +func (k Keeper) IterateInactiveProposalsQueue(ctx sdk.Context, endTime time.Time, cb func(proposal v1.Proposal) (stop bool)) { + iterator := k.InactiveProposalQueueIterator(ctx, endTime) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { proposalID, _ := types.SplitInactiveProposalQueueKey(iterator.Key()) - proposal, found := keeper.GetProposal(ctx, proposalID) + proposal, found := k.GetProposal(ctx, proposalID) if !found { panic(fmt.Sprintf("proposal %d does not exist", proposalID)) } @@ -210,21 +210,21 @@ func (keeper Keeper) IterateInactiveProposalsQueue(ctx sdk.Context, endTime time } // ActiveProposalQueueIterator returns an sdk.Iterator for all the proposals in the Active Queue that expire by endTime -func (keeper Keeper) ActiveProposalQueueIterator(ctx sdk.Context, endTime time.Time) sdk.Iterator { - store := ctx.KVStore(keeper.storeKey) +func (k Keeper) ActiveProposalQueueIterator(ctx sdk.Context, endTime time.Time) sdk.Iterator { + store := ctx.KVStore(k.storeKey) return store.Iterator(types.ActiveProposalQueuePrefix, sdk.PrefixEndBytes(types.ActiveProposalByTimeKey(endTime))) } // InactiveProposalQueueIterator returns an sdk.Iterator for all the proposals in the Inactive Queue that expire by endTime -func (keeper Keeper) InactiveProposalQueueIterator(ctx sdk.Context, endTime time.Time) sdk.Iterator { - store := ctx.KVStore(keeper.storeKey) +func (k Keeper) InactiveProposalQueueIterator(ctx sdk.Context, endTime time.Time) sdk.Iterator { + store := ctx.KVStore(k.storeKey) return store.Iterator(types.InactiveProposalQueuePrefix, sdk.PrefixEndBytes(types.InactiveProposalByTimeKey(endTime))) } // assertMetadataLength returns an error if given metadata length // is greater than a pre-defined MaxMetadataLen. -func (keeper Keeper) assertMetadataLength(metadata string) error { - if metadata != "" && uint64(len(metadata)) > keeper.config.MaxMetadataLen { +func (k Keeper) assertMetadataLength(metadata string) error { + if metadata != "" && uint64(len(metadata)) > k.config.MaxMetadataLen { return types.ErrMetadataTooLong.Wrapf("got metadata with length %d", len(metadata)) } return nil diff --git a/x/gov/keeper/msg_server.go b/x/gov/keeper/msg_server.go index 0d50d9c6a0..de2eac8e8f 100644 --- a/x/gov/keeper/msg_server.go +++ b/x/gov/keeper/msg_server.go @@ -197,7 +197,7 @@ func (k msgServer) UpdateCrossChainParams(goCtx context.Context, msg *v1.MsgUpda return nil, errors.Wrapf(govtypes.ErrInvalidSigner, "invalid authority; expected %s, got %s", k.authority, msg.Authority) } ctx := sdk.UnwrapSDKContext(goCtx) - if err := k.SyncParams(ctx, msg.Params); err != nil { + if err := k.SyncParams(ctx, sdk.ChainID(msg.DestChainId), msg.Params); err != nil { return nil, err } return &v1.MsgUpdateCrossChainParamsResponse{}, nil diff --git a/x/gov/keeper/proposal.go b/x/gov/keeper/proposal.go index b050b51fcf..175cfff7a0 100644 --- a/x/gov/keeper/proposal.go +++ b/x/gov/keeper/proposal.go @@ -12,20 +12,20 @@ import ( ) // SubmitProposal creates a new proposal given an array of messages -func (keeper Keeper) SubmitProposal(ctx sdk.Context, messages []sdk.Msg, metadata, title, summary string, proposer sdk.AccAddress) (v1.Proposal, error) { - err := keeper.assertMetadataLength(metadata) +func (k Keeper) SubmitProposal(ctx sdk.Context, messages []sdk.Msg, metadata, title, summary string, proposer sdk.AccAddress) (v1.Proposal, error) { + err := k.assertMetadataLength(metadata) if err != nil { return v1.Proposal{}, err } // assert summary is no longer than predefined max length of metadata - err = keeper.assertMetadataLength(summary) + err = k.assertMetadataLength(summary) if err != nil { return v1.Proposal{}, err } // assert title is no longer than predefined max length of metadata - err = keeper.assertMetadataLength(title) + err = k.assertMetadataLength(title) if err != nil { return v1.Proposal{}, err } @@ -49,12 +49,12 @@ func (keeper Keeper) SubmitProposal(ctx sdk.Context, messages []sdk.Msg, metadat } // assert that the governance module account is the only signer of the messages - if !signers[0].Equals(keeper.GetGovernanceAccount(ctx).GetAddress()) { + if !signers[0].Equals(k.GetGovernanceAccount(ctx).GetAddress()) { return v1.Proposal{}, sdkerrors.Wrapf(types.ErrInvalidSigner, signers[0].String()) } // use the msg service router to see that there is a valid route for that message. - handler := keeper.router.Handler(msg) + handler := k.router.Handler(msg) if handler == nil { return v1.Proposal{}, sdkerrors.Wrap(types.ErrUnroutableProposalMsg, sdk.MsgTypeURL(msg)) } @@ -76,25 +76,25 @@ func (keeper Keeper) SubmitProposal(ctx sdk.Context, messages []sdk.Msg, metadat } - proposalID, err := keeper.GetProposalID(ctx) + proposalID, err := k.GetProposalID(ctx) if err != nil { return v1.Proposal{}, err } submitTime := ctx.BlockHeader().Time - depositPeriod := keeper.GetParams(ctx).MaxDepositPeriod + depositPeriod := k.GetParams(ctx).MaxDepositPeriod proposal, err := v1.NewProposal(messages, proposalID, submitTime, submitTime.Add(*depositPeriod), metadata, title, summary, proposer) if err != nil { return v1.Proposal{}, err } - keeper.SetProposal(ctx, proposal) - keeper.InsertInactiveProposalQueue(ctx, proposalID, *proposal.DepositEndTime) - keeper.SetProposalID(ctx, proposalID+1) + k.SetProposal(ctx, proposal) + k.InsertInactiveProposalQueue(ctx, proposalID, *proposal.DepositEndTime) + k.SetProposalID(ctx, proposalID+1) // called right after a proposal is submitted - keeper.Hooks().AfterProposalSubmission(ctx, proposalID) + k.Hooks().AfterProposalSubmission(ctx, proposalID) ctx.EventManager().EmitEvent( sdk.NewEvent( @@ -109,8 +109,8 @@ func (keeper Keeper) SubmitProposal(ctx sdk.Context, messages []sdk.Msg, metadat // GetProposal gets a proposal from store by ProposalID. // Panics if can't unmarshal the proposal. -func (keeper Keeper) GetProposal(ctx sdk.Context, proposalID uint64) (v1.Proposal, bool) { - store := ctx.KVStore(keeper.storeKey) +func (k Keeper) GetProposal(ctx sdk.Context, proposalID uint64) (v1.Proposal, bool) { + store := ctx.KVStore(k.storeKey) bz := store.Get(types.ProposalKey(proposalID)) if bz == nil { @@ -118,7 +118,7 @@ func (keeper Keeper) GetProposal(ctx sdk.Context, proposalID uint64) (v1.Proposa } var proposal v1.Proposal - if err := keeper.UnmarshalProposal(bz, &proposal); err != nil { + if err := k.UnmarshalProposal(bz, &proposal); err != nil { panic(err) } @@ -127,13 +127,13 @@ func (keeper Keeper) GetProposal(ctx sdk.Context, proposalID uint64) (v1.Proposa // SetProposal sets a proposal to store. // Panics if can't marshal the proposal. -func (keeper Keeper) SetProposal(ctx sdk.Context, proposal v1.Proposal) { - bz, err := keeper.MarshalProposal(proposal) +func (k Keeper) SetProposal(ctx sdk.Context, proposal v1.Proposal) { + bz, err := k.MarshalProposal(proposal) if err != nil { panic(err) } - store := ctx.KVStore(keeper.storeKey) + store := ctx.KVStore(k.storeKey) if proposal.Status == v1.StatusVotingPeriod { store.Set(types.VotingPeriodProposalKey(proposal.Id), []byte{1}) @@ -146,18 +146,18 @@ func (keeper Keeper) SetProposal(ctx sdk.Context, proposal v1.Proposal) { // DeleteProposal deletes a proposal from store. // Panics if the proposal doesn't exist. -func (keeper Keeper) DeleteProposal(ctx sdk.Context, proposalID uint64) { - store := ctx.KVStore(keeper.storeKey) - proposal, ok := keeper.GetProposal(ctx, proposalID) +func (k Keeper) DeleteProposal(ctx sdk.Context, proposalID uint64) { + store := ctx.KVStore(k.storeKey) + proposal, ok := k.GetProposal(ctx, proposalID) if !ok { panic(fmt.Sprintf("couldn't find proposal with id#%d", proposalID)) } if proposal.DepositEndTime != nil { - keeper.RemoveFromInactiveProposalQueue(ctx, proposalID, *proposal.DepositEndTime) + k.RemoveFromInactiveProposalQueue(ctx, proposalID, *proposal.DepositEndTime) } if proposal.VotingEndTime != nil { - keeper.RemoveFromActiveProposalQueue(ctx, proposalID, *proposal.VotingEndTime) + k.RemoveFromActiveProposalQueue(ctx, proposalID, *proposal.VotingEndTime) store.Delete(types.VotingPeriodProposalKey(proposalID)) } @@ -166,15 +166,15 @@ func (keeper Keeper) DeleteProposal(ctx sdk.Context, proposalID uint64) { // IterateProposals iterates over all the proposals and performs a callback function. // Panics when the iterator encounters a proposal which can't be unmarshaled. -func (keeper Keeper) IterateProposals(ctx sdk.Context, cb func(proposal v1.Proposal) (stop bool)) { - store := ctx.KVStore(keeper.storeKey) +func (k Keeper) IterateProposals(ctx sdk.Context, cb func(proposal v1.Proposal) (stop bool)) { + store := ctx.KVStore(k.storeKey) iterator := sdk.KVStorePrefixIterator(store, types.ProposalsKeyPrefix) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { var proposal v1.Proposal - err := keeper.UnmarshalProposal(iterator.Value(), &proposal) + err := k.UnmarshalProposal(iterator.Value(), &proposal) if err != nil { panic(err) } @@ -186,8 +186,8 @@ func (keeper Keeper) IterateProposals(ctx sdk.Context, cb func(proposal v1.Propo } // GetProposals returns all the proposals from store -func (keeper Keeper) GetProposals(ctx sdk.Context) (proposals v1.Proposals) { - keeper.IterateProposals(ctx, func(proposal v1.Proposal) bool { +func (k Keeper) GetProposals(ctx sdk.Context) (proposals v1.Proposals) { + k.IterateProposals(ctx, func(proposal v1.Proposal) bool { proposals = append(proposals, &proposal) return false }) @@ -203,8 +203,8 @@ func (keeper Keeper) GetProposals(ctx sdk.Context) (proposals v1.Proposals) { // // NOTE: If no filters are provided, all proposals will be returned in paginated // form. -func (keeper Keeper) GetProposalsFiltered(ctx sdk.Context, params v1.QueryProposalsParams) v1.Proposals { - proposals := keeper.GetProposals(ctx) +func (k Keeper) GetProposalsFiltered(ctx sdk.Context, params v1.QueryProposalsParams) v1.Proposals { + proposals := k.GetProposals(ctx) filteredProposals := make([]*v1.Proposal, 0, len(proposals)) for _, p := range proposals { @@ -217,12 +217,12 @@ func (keeper Keeper) GetProposalsFiltered(ctx sdk.Context, params v1.QueryPropos // match voter address (if supplied) if len(params.Voter) > 0 { - _, matchVoter = keeper.GetVote(ctx, p.Id, params.Voter) + _, matchVoter = k.GetVote(ctx, p.Id, params.Voter) } // match depositor (if supplied) if len(params.Depositor) > 0 { - _, matchDepositor = keeper.GetDeposit(ctx, p.Id, params.Depositor) + _, matchDepositor = k.GetDeposit(ctx, p.Id, params.Depositor) } if matchVoter && matchDepositor && matchStatus { @@ -241,8 +241,8 @@ func (keeper Keeper) GetProposalsFiltered(ctx sdk.Context, params v1.QueryPropos } // GetProposalID gets the highest proposal ID -func (keeper Keeper) GetProposalID(ctx sdk.Context) (proposalID uint64, err error) { - store := ctx.KVStore(keeper.storeKey) +func (k Keeper) GetProposalID(ctx sdk.Context) (proposalID uint64, err error) { + store := ctx.KVStore(k.storeKey) bz := store.Get(types.ProposalIDKey) if bz == nil { return 0, sdkerrors.Wrap(types.ErrInvalidGenesis, "initial proposal ID hasn't been set") @@ -253,28 +253,28 @@ func (keeper Keeper) GetProposalID(ctx sdk.Context) (proposalID uint64, err erro } // SetProposalID sets the new proposal ID to the store -func (keeper Keeper) SetProposalID(ctx sdk.Context, proposalID uint64) { - store := ctx.KVStore(keeper.storeKey) +func (k Keeper) SetProposalID(ctx sdk.Context, proposalID uint64) { + store := ctx.KVStore(k.storeKey) store.Set(types.ProposalIDKey, types.GetProposalIDBytes(proposalID)) } // ActivateVotingPeriod activates the voting period of a proposal -func (keeper Keeper) ActivateVotingPeriod(ctx sdk.Context, proposal v1.Proposal) { +func (k Keeper) ActivateVotingPeriod(ctx sdk.Context, proposal v1.Proposal) { startTime := ctx.BlockHeader().Time proposal.VotingStartTime = &startTime - votingPeriod := keeper.GetParams(ctx).VotingPeriod + votingPeriod := k.GetParams(ctx).VotingPeriod endTime := proposal.VotingStartTime.Add(*votingPeriod) proposal.VotingEndTime = &endTime proposal.Status = v1.StatusVotingPeriod - keeper.SetProposal(ctx, proposal) + k.SetProposal(ctx, proposal) - keeper.RemoveFromInactiveProposalQueue(ctx, proposal.Id, *proposal.DepositEndTime) - keeper.InsertActiveProposalQueue(ctx, proposal.Id, *proposal.VotingEndTime) + k.RemoveFromInactiveProposalQueue(ctx, proposal.Id, *proposal.DepositEndTime) + k.InsertActiveProposalQueue(ctx, proposal.Id, *proposal.VotingEndTime) } // MarshalProposal marshals the proposal and returns binary encoded bytes. -func (keeper Keeper) MarshalProposal(proposal v1.Proposal) ([]byte, error) { - bz, err := keeper.cdc.Marshal(&proposal) +func (k Keeper) MarshalProposal(proposal v1.Proposal) ([]byte, error) { + bz, err := k.cdc.Marshal(&proposal) if err != nil { return nil, err } @@ -282,8 +282,8 @@ func (keeper Keeper) MarshalProposal(proposal v1.Proposal) ([]byte, error) { } // UnmarshalProposal unmarshals the proposal. -func (keeper Keeper) UnmarshalProposal(bz []byte, proposal *v1.Proposal) error { - err := keeper.cdc.Unmarshal(bz, proposal) +func (k Keeper) UnmarshalProposal(bz []byte, proposal *v1.Proposal) error { + err := k.cdc.Unmarshal(bz, proposal) if err != nil { return err } diff --git a/x/gov/keeper/tally.go b/x/gov/keeper/tally.go index 0e1cef2d69..aeac50ffd4 100644 --- a/x/gov/keeper/tally.go +++ b/x/gov/keeper/tally.go @@ -11,7 +11,7 @@ import ( // Tally iterates over the votes and updates the tally of a proposal based on the voting power of the // voters -func (keeper Keeper) Tally(ctx sdk.Context, proposal v1.Proposal) (passes bool, burnDeposits bool, tallyResults v1.TallyResult) { +func (k Keeper) Tally(ctx sdk.Context, proposal v1.Proposal) (passes bool, burnDeposits bool, tallyResults v1.TallyResult) { results := make(map[v1.VoteOption]sdk.Dec) results[v1.OptionYes] = math.LegacyZeroDec() results[v1.OptionAbstain] = math.LegacyZeroDec() @@ -22,7 +22,7 @@ func (keeper Keeper) Tally(ctx sdk.Context, proposal v1.Proposal) (passes bool, currValidators := make(map[string]v1.ValidatorGovInfo) // fetch all the bonded validators, insert them into currValidators - keeper.sk.IterateBondedValidatorsByPower(ctx, func(index int64, validator stakingtypes.ValidatorI) (stop bool) { + k.sk.IterateBondedValidatorsByPower(ctx, func(index int64, validator stakingtypes.ValidatorI) (stop bool) { currValidators[validator.GetOperator().String()] = v1.NewValidatorGovInfo( validator.GetOperator(), validator.GetBondedTokens(), @@ -34,7 +34,7 @@ func (keeper Keeper) Tally(ctx sdk.Context, proposal v1.Proposal) (passes bool, return false }) - keeper.IterateVotes(ctx, proposal.Id, func(vote v1.Vote) bool { + k.IterateVotes(ctx, proposal.Id, func(vote v1.Vote) bool { // if validator, just record it in the map voter := sdk.MustAccAddressFromHex(vote.Voter) @@ -45,7 +45,7 @@ func (keeper Keeper) Tally(ctx sdk.Context, proposal v1.Proposal) (passes bool, } // iterate over all delegations from voter, deduct from any delegated-to validators - keeper.sk.IterateDelegations(ctx, voter, func(index int64, delegation stakingtypes.DelegationI) (stop bool) { + k.sk.IterateDelegations(ctx, voter, func(index int64, delegation stakingtypes.DelegationI) (stop bool) { valAddrStr := delegation.GetValidatorAddr().String() if val, ok := currValidators[valAddrStr]; ok { @@ -68,7 +68,7 @@ func (keeper Keeper) Tally(ctx sdk.Context, proposal v1.Proposal) (passes bool, return false }) - keeper.deleteVote(ctx, vote.ProposalId, voter) + k.deleteVote(ctx, vote.ProposalId, voter) return false }) @@ -89,17 +89,17 @@ func (keeper Keeper) Tally(ctx sdk.Context, proposal v1.Proposal) (passes bool, totalVotingPower = totalVotingPower.Add(votingPower) } - params := keeper.GetParams(ctx) + params := k.GetParams(ctx) tallyResults = v1.NewTallyResultFromMap(results) // TODO: Upgrade the spec to cover all of these cases & remove pseudocode. // If there is no staked coins, the proposal fails - if keeper.sk.TotalBondedTokens(ctx).IsZero() { + if k.sk.TotalBondedTokens(ctx).IsZero() { return false, false, tallyResults } // If there is not enough quorum of votes, the proposal fails - percentVoting := totalVotingPower.Quo(sdk.NewDecFromInt(keeper.sk.TotalBondedTokens(ctx))) + percentVoting := totalVotingPower.Quo(sdk.NewDecFromInt(k.sk.TotalBondedTokens(ctx))) quorum, _ := sdk.NewDecFromStr(params.Quorum) if percentVoting.LT(quorum) { return false, params.BurnVoteQuorum, tallyResults diff --git a/x/gov/keeper/vote.go b/x/gov/keeper/vote.go index 63548e0b30..523ecdfeb8 100644 --- a/x/gov/keeper/vote.go +++ b/x/gov/keeper/vote.go @@ -10,14 +10,14 @@ import ( ) // AddVote adds a vote on a specific proposal -func (keeper Keeper) AddVote(ctx sdk.Context, proposalID uint64, voterAddr sdk.AccAddress, options v1.WeightedVoteOptions, metadata string) error { +func (k Keeper) AddVote(ctx sdk.Context, proposalID uint64, voterAddr sdk.AccAddress, options v1.WeightedVoteOptions, metadata string) error { // Check if proposal is in voting period. - store := ctx.KVStore(keeper.storeKey) + store := ctx.KVStore(k.storeKey) if !store.Has(types.VotingPeriodProposalKey(proposalID)) { return sdkerrors.Wrapf(types.ErrInactiveProposal, "%d", proposalID) } - err := keeper.assertMetadataLength(metadata) + err := k.assertMetadataLength(metadata) if err != nil { return err } @@ -29,10 +29,10 @@ func (keeper Keeper) AddVote(ctx sdk.Context, proposalID uint64, voterAddr sdk.A } vote := v1.NewVote(proposalID, voterAddr, options, metadata) - keeper.SetVote(ctx, vote) + k.SetVote(ctx, vote) // called after a vote on a proposal is cast - keeper.Hooks().AfterProposalVote(ctx, proposalID, voterAddr) + k.Hooks().AfterProposalVote(ctx, proposalID, voterAddr) ctx.EventManager().EmitEvent( sdk.NewEvent( @@ -46,8 +46,8 @@ func (keeper Keeper) AddVote(ctx sdk.Context, proposalID uint64, voterAddr sdk.A } // GetAllVotes returns all the votes from the store -func (keeper Keeper) GetAllVotes(ctx sdk.Context) (votes v1.Votes) { - keeper.IterateAllVotes(ctx, func(vote v1.Vote) bool { +func (k Keeper) GetAllVotes(ctx sdk.Context) (votes v1.Votes) { + k.IterateAllVotes(ctx, func(vote v1.Vote) bool { votes = append(votes, &vote) return false }) @@ -55,8 +55,8 @@ func (keeper Keeper) GetAllVotes(ctx sdk.Context) (votes v1.Votes) { } // GetVotes returns all the votes from a proposal -func (keeper Keeper) GetVotes(ctx sdk.Context, proposalID uint64) (votes v1.Votes) { - keeper.IterateVotes(ctx, proposalID, func(vote v1.Vote) bool { +func (k Keeper) GetVotes(ctx sdk.Context, proposalID uint64) (votes v1.Votes) { + k.IterateVotes(ctx, proposalID, func(vote v1.Vote) bool { votes = append(votes, &vote) return false }) @@ -64,36 +64,36 @@ func (keeper Keeper) GetVotes(ctx sdk.Context, proposalID uint64) (votes v1.Vote } // GetVote gets the vote from an address on a specific proposal -func (keeper Keeper) GetVote(ctx sdk.Context, proposalID uint64, voterAddr sdk.AccAddress) (vote v1.Vote, found bool) { - store := ctx.KVStore(keeper.storeKey) +func (k Keeper) GetVote(ctx sdk.Context, proposalID uint64, voterAddr sdk.AccAddress) (vote v1.Vote, found bool) { + store := ctx.KVStore(k.storeKey) bz := store.Get(types.VoteKey(proposalID, voterAddr)) if bz == nil { return vote, false } - keeper.cdc.MustUnmarshal(bz, &vote) + k.cdc.MustUnmarshal(bz, &vote) return vote, true } // SetVote sets a Vote to the gov store -func (keeper Keeper) SetVote(ctx sdk.Context, vote v1.Vote) { - store := ctx.KVStore(keeper.storeKey) - bz := keeper.cdc.MustMarshal(&vote) +func (k Keeper) SetVote(ctx sdk.Context, vote v1.Vote) { + store := ctx.KVStore(k.storeKey) + bz := k.cdc.MustMarshal(&vote) addr := sdk.MustAccAddressFromHex(vote.Voter) store.Set(types.VoteKey(vote.ProposalId, addr), bz) } // IterateAllVotes iterates over all the stored votes and performs a callback function -func (keeper Keeper) IterateAllVotes(ctx sdk.Context, cb func(vote v1.Vote) (stop bool)) { - store := ctx.KVStore(keeper.storeKey) +func (k Keeper) IterateAllVotes(ctx sdk.Context, cb func(vote v1.Vote) (stop bool)) { + store := ctx.KVStore(k.storeKey) iterator := sdk.KVStorePrefixIterator(store, types.VotesKeyPrefix) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { var vote v1.Vote - keeper.cdc.MustUnmarshal(iterator.Value(), &vote) + k.cdc.MustUnmarshal(iterator.Value(), &vote) if cb(vote) { break @@ -102,14 +102,14 @@ func (keeper Keeper) IterateAllVotes(ctx sdk.Context, cb func(vote v1.Vote) (sto } // IterateVotes iterates over all the proposals votes and performs a callback function -func (keeper Keeper) IterateVotes(ctx sdk.Context, proposalID uint64, cb func(vote v1.Vote) (stop bool)) { - store := ctx.KVStore(keeper.storeKey) +func (k Keeper) IterateVotes(ctx sdk.Context, proposalID uint64, cb func(vote v1.Vote) (stop bool)) { + store := ctx.KVStore(k.storeKey) iterator := sdk.KVStorePrefixIterator(store, types.VotesKey(proposalID)) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { var vote v1.Vote - keeper.cdc.MustUnmarshal(iterator.Value(), &vote) + k.cdc.MustUnmarshal(iterator.Value(), &vote) if cb(vote) { break @@ -118,7 +118,7 @@ func (keeper Keeper) IterateVotes(ctx sdk.Context, proposalID uint64, cb func(vo } // deleteVote deletes a vote from a given proposalID and voter from the store -func (keeper Keeper) deleteVote(ctx sdk.Context, proposalID uint64, voterAddr sdk.AccAddress) { - store := ctx.KVStore(keeper.storeKey) +func (k Keeper) deleteVote(ctx sdk.Context, proposalID uint64, voterAddr sdk.AccAddress) { + store := ctx.KVStore(k.storeKey) store.Delete(types.VoteKey(proposalID, voterAddr)) } diff --git a/x/gov/testutil/expected_keepers.go b/x/gov/testutil/expected_keepers.go index a018300264..9adda8969b 100644 --- a/x/gov/testutil/expected_keepers.go +++ b/x/gov/testutil/expected_keepers.go @@ -44,4 +44,10 @@ type CrossChainKeeper interface { ) (uint64, error) RegisterChannel(name string, id sdk.ChannelID, app sdk.CrossChainApplication) error + + GetSendSequence(ctx sdk.Context, destChainId sdk.ChainID, channelID sdk.ChannelID) uint64 + + GetReceiveSequence(ctx sdk.Context, destChainId sdk.ChainID, channelID sdk.ChannelID) uint64 + + IsDestChainSupported(chainID sdk.ChainID) bool } diff --git a/x/gov/testutil/expected_keepers_mocks.go b/x/gov/testutil/expected_keepers_mocks.go index be6731dd57..9bb5fbfb85 100644 --- a/x/gov/testutil/expected_keepers_mocks.go +++ b/x/gov/testutil/expected_keepers_mocks.go @@ -1,5 +1,6 @@ // Code generated by MockGen. DO NOT EDIT. -// Source: x/gov/testutil/expected_keepers.go +// Source: expected_keepers.go + // Package testutil is a generated GoMock package. package testutil @@ -1088,6 +1089,48 @@ func (mr *MockCrossChainKeeperMockRecorder) GetDestBscChainID() *gomock.Call { return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetDestBscChainID", reflect.TypeOf((*MockCrossChainKeeper)(nil).GetDestBscChainID)) } +// GetReceiveSequence mocks base method. +func (m *MockCrossChainKeeper) GetReceiveSequence(ctx types.Context, destChainId types.ChainID, channelID types.ChannelID) uint64 { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetReceiveSequence", ctx, destChainId, channelID) + ret0, _ := ret[0].(uint64) + return ret0 +} + +// GetReceiveSequence indicates an expected call of GetReceiveSequence. +func (mr *MockCrossChainKeeperMockRecorder) GetReceiveSequence(ctx, destChainId, channelID interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetReceiveSequence", reflect.TypeOf((*MockCrossChainKeeper)(nil).GetReceiveSequence), ctx, destChainId, channelID) +} + +// GetSendSequence mocks base method. +func (m *MockCrossChainKeeper) GetSendSequence(ctx types.Context, destChainId types.ChainID, channelID types.ChannelID) uint64 { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetSendSequence", ctx, destChainId, channelID) + ret0, _ := ret[0].(uint64) + return ret0 +} + +// GetSendSequence indicates an expected call of GetSendSequence. +func (mr *MockCrossChainKeeperMockRecorder) GetSendSequence(ctx, destChainId, channelID interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetSendSequence", reflect.TypeOf((*MockCrossChainKeeper)(nil).GetSendSequence), ctx, destChainId, channelID) +} + +// IsDestChainSupported mocks base method. +func (m *MockCrossChainKeeper) IsDestChainSupported(chainID types.ChainID) bool { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "IsDestChainSupported", chainID) + ret0, _ := ret[0].(bool) + return ret0 +} + +// IsDestChainSupported indicates an expected call of IsDestChainSupported. +func (mr *MockCrossChainKeeperMockRecorder) IsDestChainSupported(chainID interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IsDestChainSupported", reflect.TypeOf((*MockCrossChainKeeper)(nil).IsDestChainSupported), chainID) +} + // RegisterChannel mocks base method. func (m *MockCrossChainKeeper) RegisterChannel(name string, id types.ChannelID, app types.CrossChainApplication) error { m.ctrl.T.Helper() diff --git a/x/gov/types/crosschain.go b/x/gov/types/crosschain.go index b2a7c29261..a238124433 100644 --- a/x/gov/types/crosschain.go +++ b/x/gov/types/crosschain.go @@ -6,9 +6,13 @@ import ( ) const ( - SyncParamsChannel = "syncParametersChange" - SyncParamsChannelID sdk.ChannelID = 3 - KeyUpgrade = "upgrade" + SyncParamsChannel = "syncParametersChange" + SyncSequenceChannel = "syncSequence" + + SyncParamsChannelID sdk.ChannelID = 3 + SyncSequenceChannelID sdk.ChannelID = 7 + + KeyUpgrade = "upgrade" ) // SyncParamsPackage is the payload to be encoded for cross-chain IBC package diff --git a/x/gov/types/errors.go b/x/gov/types/errors.go index bc230b24dd..71c4ac98b9 100644 --- a/x/gov/types/errors.go +++ b/x/gov/types/errors.go @@ -35,4 +35,6 @@ var ( ErrExceedParamsChangeLimit = errors.Register(ModuleName, 27, "exceed params change limit") ErrInvalidUpgradeProposal = errors.Register(ModuleName, 28, "invalid sync params package") ErrInvalidValue = errors.Register(ModuleName, 29, "decode hex value failed") + + ErrChainNotSupported = errors.Register(ModuleName, 30, "crosschain: chain is not supported") ) diff --git a/x/gov/types/expected_keepers.go b/x/gov/types/expected_keepers.go index 70de43317c..35eb78dbf8 100644 --- a/x/gov/types/expected_keepers.go +++ b/x/gov/types/expected_keepers.go @@ -59,6 +59,12 @@ type CrossChainKeeper interface { ) (uint64, error) RegisterChannel(name string, id sdk.ChannelID, app sdk.CrossChainApplication) error + + GetSendSequence(ctx sdk.Context, destChainId sdk.ChainID, channelID sdk.ChannelID) uint64 + + GetReceiveSequence(ctx sdk.Context, destChainId sdk.ChainID, channelID sdk.ChannelID) uint64 + + IsDestChainSupported(chainID sdk.ChainID) bool } // Event Hooks diff --git a/x/gov/types/v1/tx.pb.go b/x/gov/types/v1/tx.pb.go index 7971eef0ef..6f69ce781c 100644 --- a/x/gov/types/v1/tx.pb.go +++ b/x/gov/types/v1/tx.pb.go @@ -693,7 +693,8 @@ type MsgUpdateCrossChainParams struct { // authority is the address that controls the module (defaults to x/gov unless overwritten). Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` // for cross chain param change or contract upgrade - Params CrossChainParamsChange `protobuf:"bytes,2,opt,name=params,proto3" json:"params"` + Params CrossChainParamsChange `protobuf:"bytes,2,opt,name=params,proto3" json:"params"` + DestChainId uint32 `protobuf:"varint,3,opt,name=dest_chain_id,json=destChainId,proto3" json:"dest_chain_id,omitempty"` } func (m *MsgUpdateCrossChainParams) Reset() { *m = MsgUpdateCrossChainParams{} } @@ -743,6 +744,13 @@ func (m *MsgUpdateCrossChainParams) GetParams() CrossChainParamsChange { return CrossChainParamsChange{} } +func (m *MsgUpdateCrossChainParams) GetDestChainId() uint32 { + if m != nil { + return m.DestChainId + } + return 0 +} + // MsgUpdateCrossChainParamsResponse defines the response structure for executing a MsgUpdateCrossChainParams message. type MsgUpdateCrossChainParamsResponse struct { } @@ -800,68 +808,70 @@ func init() { func init() { proto.RegisterFile("cosmos/gov/v1/tx.proto", fileDescriptor_9ff8f4a63b6fc9a9) } var fileDescriptor_9ff8f4a63b6fc9a9 = []byte{ - // 972 bytes of a gzipped FileDescriptorProto + // 996 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x56, 0x4d, 0x6f, 0x1b, 0x45, - 0x18,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x51, 0x6e, 0xe4, 0x44, 0x11, 0xf9, 0x9c, 0x0d, 0x70, 0x5d, 0x2f, - 0x53, 0xea, 0x7f, 0x1b, 0xa9, 0xed, 0x4b, 0xec, 0x93, 0x1e, 0xc7, 0xdd, 0xff, 0x4b, 0x82, 0xf7, - 0x40, 0x51, 0x31, 0x63, 0xe6, 0x92, 0x9c, 0xc6, 0x9d, 0x8c, 0x06, 0x49, 0x43, 0x63, 0x5a, 0x24, - 0x11, 0x73, 0xc5, 0x78, 0x6b, 0x52, 0x8c, 0xd7, 0xa6, 0x8a, 0x91, 0x24, 0x77, 0xca, 0xe0, 0x66, - 0xc6, 0x94, 0x8a, 0xf3, 0xa7, 0x01, 0x40, 0x93, 0x91, 0x64, 0xee, 0xff, 0xa5, 0x2e, 0x77, 0xc1, - 0xaa, 0xbe, 0x75, 0xe8, 0xe5, 0xda, 0x8c, 0xa0, 0xf0, 0x1e, 0x28, 0xa0, 0x80, 0xf6, 0x43, 0xae, - 0xe5, 0xb9, 0xda, 0x65, 0xa5, 0x63, 0x6a, 0xfb, 0x72, 0x54, 0xd2, 0x6c, 0x42, 0x08, 0x33, 0x27, - 0x84, 0x66, 0xe6, 0x94, 0x00, 0x1c, 0xed, 0x52, 0xfa, 0xcf, 0xd4, 0xd9, 0xf8, 0x22, 0xea, 0x22, - 0x8e, 0x1f, 0xa2, 0x18, 0x05, 0x4c, 0x90, 0x19, 0xcd, 0xa7, 0x71, 0x19, 0x99, 0x14, 0x0a, 0xdf, - 0x05, 0x85, 0x48, 0x66, 0x90, 0x0a, 0xac, 0x1d, 0xde, 0xc8, 0xfc, 0xd7, 0x2a, 0xfd, 0x04, 0x11, - 0x85, 0xaf, 0xdd, 0xcd, 0xcf, 0xfc, 0xee, 0x18, 0x91, 0x93, 0xe4, 0xb9, 0xca, 0x74, 0xaa, 0xff, - 0xd7, 0x71, 0x53, 0x4a, 0xec, 0x37, 0x43, 0x5e, 0x86, 0xca, 0xd7, 0x88, 0x29, 0x63, 0x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 0x8e, 0xa9, 0xe4, 0x43, 0x94, 0xcb, 0xdc, 0x99, 0xe9, 0x1a, + 0x6f, 0x70, 0x62, 0x5a, 0xa7, 0x34, 0x38, 0xee, 0x9f, 0xd6, 0xe0, 0xb4, 0x81, 0xd1, 0x19, 0xd8, + 0x9c, 0x31, 0x2c, 0xd5, 0x59, 0x19, 0xb2, 0x48, 0xf3, 0xf6, 0x55, 0x91, 0x49, 0x55, 0xb3, 0xf0, + 0x94, 0x4f, 0x45, 0xe3, 0xc1, 0x8b, 0x33, 0x4b, 0x7b, 0x79, 0x66, 0x69, 0xbf, 0x9f, 0x59, 0xda, + 0x8f, 0xe7, 0xd6, 0xc2, 0xcb, 0x73, 0x6b, 0xe1, 0xb7, 0x73, 0x6b, 0xe1, 0xab, 0x7d, 0xec, 0xb3, + 0x5e, 0xbf, 0xe3, 0x74, 0x49, 0xa0, 0xbe, 0x3f, 0xdd, 0xdc, 0x08, 0xb0, 0x61, 0x84, 0x28, 0xff, + 0xda, 0x2d, 0x8a, 0x0f, 0x92, 0x77, 0xfe, 0x09, 0x00, 0x00, 0xff, 0xff, 0x75, 0x7f, 0xe1, 0x20, + 0x2d, 0x0b, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1658,6 +1668,11 @@ func (m *MsgUpdateCrossChainParams) MarshalToSizedBuffer(dAtA []byte) (int, erro _ = i var l int _ = l + if m.DestChainId != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.DestChainId)) + i-- + dAtA[i] = 0x18 + } { size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) if err != nil { @@ -1921,6 +1936,9 @@ func (m *MsgUpdateCrossChainParams) Size() (n int) { } l = m.Params.Size() n += 1 + l + sovTx(uint64(l)) + if m.DestChainId != 0 { + n += 1 + sovTx(uint64(m.DestChainId)) + } return n } @@ -3285,6 +3303,25 @@ func (m *MsgUpdateCrossChainParams) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field DestChainId", wireType) + } + m.DestChainId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.DestChainId |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:]) From d1b0f398073e31fab2e448efb3bb407a69ac798d Mon Sep 17 00:00:00 2001 From: yutianwu Date: Thu, 10 Aug 2023 16:55:35 +0800 Subject: [PATCH 2/4] remove unused code --- x/gov/types/crosschain.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/x/gov/types/crosschain.go b/x/gov/types/crosschain.go index a238124433..259c0a2e0e 100644 --- a/x/gov/types/crosschain.go +++ b/x/gov/types/crosschain.go @@ -6,11 +6,9 @@ import ( ) const ( - SyncParamsChannel = "syncParametersChange" - SyncSequenceChannel = "syncSequence" + SyncParamsChannel = "syncParametersChange" - SyncParamsChannelID sdk.ChannelID = 3 - SyncSequenceChannelID sdk.ChannelID = 7 + SyncParamsChannelID sdk.ChannelID = 3 KeyUpgrade = "upgrade" ) From d5db4b6184d5aba3f854f5b495396d5e600c49a6 Mon Sep 17 00:00:00 2001 From: yutianwu Date: Thu, 10 Aug 2023 20:11:17 +0800 Subject: [PATCH 3/4] update go.mod --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 6f33cc7a84..0801ba1aca 100644 --- a/go.mod +++ b/go.mod @@ -169,7 +169,7 @@ replace ( github.com/99designs/keyring => github.com/cosmos/keyring v1.2.0 github.com/btcsuite/btcd => github.com/btcsuite/btcd v0.23.0 - github.com/cometbft/cometbft => github.com/bnb-chain/greenfield-cometbft v0.0.2 + github.com/cometbft/cometbft => github.com/bnb-chain/greenfield-cometbft v0.0.0-20230810120916-f5f3421ab490 github.com/cometbft/cometbft-db => github.com/bnb-chain/greenfield-cometbft-db v0.8.1-alpha.1 github.com/cosmos/iavl => github.com/bnb-chain/greenfield-iavl v0.20.1-alpha.1 diff --git a/go.sum b/go.sum index f4c6ffd08f..981184908b 100644 --- a/go.sum +++ b/go.sum @@ -228,8 +228,8 @@ github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816/go.mod h1:+zsy github.com/bkielbasa/cyclop v1.2.0/go.mod h1:qOI0yy6A7dYC4Zgsa72Ppm9kONl0RoIlPbzot9mhmeI= github.com/blizzy78/varnamelen v0.8.0/go.mod h1:V9TzQZ4fLJ1DSrjVDfl89H7aMnTvKkApdHeyESmyR7k= github.com/bmizerany/pat v0.0.0-20170815010413-6226ea591a40/go.mod h1:8rLXio+WjiTceGBHIoTvn60HIbs7Hm7bcHjyrSqYB9c= -github.com/bnb-chain/greenfield-cometbft v0.0.2 h1:bRamS8Lq1lA3ttRLZBha22uiNG5tqN+diD3hapdUCYI= -github.com/bnb-chain/greenfield-cometbft v0.0.2/go.mod h1:EBmwmUdaNbGPyGjf1cMuoN3pAeM2tQu7Lfg95813EAw= +github.com/bnb-chain/greenfield-cometbft v0.0.0-20230810120916-f5f3421ab490 h1:sztr3uiKE/iI8O6ccIb6Bc9b9K0GVJryPXMhWx6Xk/U= +github.com/bnb-chain/greenfield-cometbft v0.0.0-20230810120916-f5f3421ab490/go.mod h1:3nGT4Z9fHwgRlBY/rofn0rSarnIcNbuhz/eq0XlLlkg= github.com/bnb-chain/greenfield-cometbft-db v0.8.1-alpha.1 h1:XcWulGacHVRiSCx90Q8Y//ajOrLNBQWR/KDB89dy3cU= github.com/bnb-chain/greenfield-cometbft-db v0.8.1-alpha.1/go.mod h1:ey1CiK4bYo1RBNJLRiVbYr5CMdSxci9S/AZRINLtppI= github.com/bnb-chain/greenfield-iavl v0.20.1-alpha.1 h1:ZnIcvkkQVurg0OaAwmUGn2cK5bZbffjVChFyhh86HMk= From 932ca28cfe9658a36de9fa7b4e0297e744a4ebea Mon Sep 17 00:00:00 2001 From: yutianwu Date: Mon, 14 Aug 2023 09:00:18 +0800 Subject: [PATCH 4/4] add dest_chain_id in grpc query --- api/cosmos/crosschain/v1/query.pulsar.go | 356 +++++++++++++++++------ proto/cosmos/crosschain/v1/query.proto | 14 +- x/crosschain/keeper/grpc_query.go | 6 +- x/crosschain/types/query.pb.go | 189 +++++++++--- 4 files changed, 429 insertions(+), 136 deletions(-) diff --git a/api/cosmos/crosschain/v1/query.pulsar.go b/api/cosmos/crosschain/v1/query.pulsar.go index 60d1cfe242..6efbc23c18 100644 --- a/api/cosmos/crosschain/v1/query.pulsar.go +++ b/api/cosmos/crosschain/v1/query.pulsar.go @@ -806,14 +806,16 @@ func (x *fastReflection_QueryParamsResponse) ProtoMethods() *protoiface.Methods } var ( - md_QueryCrossChainPackageRequest protoreflect.MessageDescriptor - fd_QueryCrossChainPackageRequest_channel_id protoreflect.FieldDescriptor - fd_QueryCrossChainPackageRequest_sequence protoreflect.FieldDescriptor + md_QueryCrossChainPackageRequest protoreflect.MessageDescriptor + fd_QueryCrossChainPackageRequest_dest_chain_id protoreflect.FieldDescriptor + fd_QueryCrossChainPackageRequest_channel_id protoreflect.FieldDescriptor + fd_QueryCrossChainPackageRequest_sequence protoreflect.FieldDescriptor ) func init() { file_cosmos_crosschain_v1_query_proto_init() md_QueryCrossChainPackageRequest = File_cosmos_crosschain_v1_query_proto.Messages().ByName("QueryCrossChainPackageRequest") + fd_QueryCrossChainPackageRequest_dest_chain_id = md_QueryCrossChainPackageRequest.Fields().ByName("dest_chain_id") fd_QueryCrossChainPackageRequest_channel_id = md_QueryCrossChainPackageRequest.Fields().ByName("channel_id") fd_QueryCrossChainPackageRequest_sequence = md_QueryCrossChainPackageRequest.Fields().ByName("sequence") } @@ -883,6 +885,12 @@ func (x *fastReflection_QueryCrossChainPackageRequest) Interface() protoreflect. // While iterating, mutating operations may only be performed // on the current field descriptor. func (x *fastReflection_QueryCrossChainPackageRequest) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.DestChainId != uint32(0) { + value := protoreflect.ValueOfUint32(x.DestChainId) + if !f(fd_QueryCrossChainPackageRequest_dest_chain_id, value) { + return + } + } if x.ChannelId != uint32(0) { value := protoreflect.ValueOfUint32(x.ChannelId) if !f(fd_QueryCrossChainPackageRequest_channel_id, value) { @@ -910,6 +918,8 @@ func (x *fastReflection_QueryCrossChainPackageRequest) Range(f func(protoreflect // a repeated field is populated if it is non-empty. func (x *fastReflection_QueryCrossChainPackageRequest) Has(fd protoreflect.FieldDescriptor) bool { switch fd.FullName() { + case "cosmos.crosschain.v1.QueryCrossChainPackageRequest.dest_chain_id": + return x.DestChainId != uint32(0) case "cosmos.crosschain.v1.QueryCrossChainPackageRequest.channel_id": return x.ChannelId != uint32(0) case "cosmos.crosschain.v1.QueryCrossChainPackageRequest.sequence": @@ -930,6 +940,8 @@ func (x *fastReflection_QueryCrossChainPackageRequest) Has(fd protoreflect.Field // Clear is a mutating operation and unsafe for concurrent use. func (x *fastReflection_QueryCrossChainPackageRequest) Clear(fd protoreflect.FieldDescriptor) { switch fd.FullName() { + case "cosmos.crosschain.v1.QueryCrossChainPackageRequest.dest_chain_id": + x.DestChainId = uint32(0) case "cosmos.crosschain.v1.QueryCrossChainPackageRequest.channel_id": x.ChannelId = uint32(0) case "cosmos.crosschain.v1.QueryCrossChainPackageRequest.sequence": @@ -950,6 +962,9 @@ func (x *fastReflection_QueryCrossChainPackageRequest) Clear(fd protoreflect.Fie // of the value; to obtain a mutable reference, use Mutable. func (x *fastReflection_QueryCrossChainPackageRequest) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { switch descriptor.FullName() { + case "cosmos.crosschain.v1.QueryCrossChainPackageRequest.dest_chain_id": + value := x.DestChainId + return protoreflect.ValueOfUint32(value) case "cosmos.crosschain.v1.QueryCrossChainPackageRequest.channel_id": value := x.ChannelId return protoreflect.ValueOfUint32(value) @@ -976,6 +991,8 @@ func (x *fastReflection_QueryCrossChainPackageRequest) Get(descriptor protorefle // Set is a mutating operation and unsafe for concurrent use. func (x *fastReflection_QueryCrossChainPackageRequest) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { switch fd.FullName() { + case "cosmos.crosschain.v1.QueryCrossChainPackageRequest.dest_chain_id": + x.DestChainId = uint32(value.Uint()) case "cosmos.crosschain.v1.QueryCrossChainPackageRequest.channel_id": x.ChannelId = uint32(value.Uint()) case "cosmos.crosschain.v1.QueryCrossChainPackageRequest.sequence": @@ -1000,6 +1017,8 @@ func (x *fastReflection_QueryCrossChainPackageRequest) Set(fd protoreflect.Field // Mutable is a mutating operation and unsafe for concurrent use. func (x *fastReflection_QueryCrossChainPackageRequest) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { + case "cosmos.crosschain.v1.QueryCrossChainPackageRequest.dest_chain_id": + panic(fmt.Errorf("field dest_chain_id of message cosmos.crosschain.v1.QueryCrossChainPackageRequest is not mutable")) case "cosmos.crosschain.v1.QueryCrossChainPackageRequest.channel_id": panic(fmt.Errorf("field channel_id of message cosmos.crosschain.v1.QueryCrossChainPackageRequest is not mutable")) case "cosmos.crosschain.v1.QueryCrossChainPackageRequest.sequence": @@ -1017,6 +1036,8 @@ func (x *fastReflection_QueryCrossChainPackageRequest) Mutable(fd protoreflect.F // For lists, maps, and messages, this returns a new, empty, mutable value. func (x *fastReflection_QueryCrossChainPackageRequest) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { + case "cosmos.crosschain.v1.QueryCrossChainPackageRequest.dest_chain_id": + return protoreflect.ValueOfUint32(uint32(0)) case "cosmos.crosschain.v1.QueryCrossChainPackageRequest.channel_id": return protoreflect.ValueOfUint32(uint32(0)) case "cosmos.crosschain.v1.QueryCrossChainPackageRequest.sequence": @@ -1090,6 +1111,9 @@ func (x *fastReflection_QueryCrossChainPackageRequest) ProtoMethods() *protoifac var n int var l int _ = l + if x.DestChainId != 0 { + n += 1 + runtime.Sov(uint64(x.DestChainId)) + } if x.ChannelId != 0 { n += 1 + runtime.Sov(uint64(x.ChannelId)) } @@ -1128,11 +1152,16 @@ func (x *fastReflection_QueryCrossChainPackageRequest) ProtoMethods() *protoifac if x.Sequence != 0 { i = runtime.EncodeVarint(dAtA, i, uint64(x.Sequence)) i-- - dAtA[i] = 0x10 + dAtA[i] = 0x18 } if x.ChannelId != 0 { i = runtime.EncodeVarint(dAtA, i, uint64(x.ChannelId)) i-- + dAtA[i] = 0x10 + } + if x.DestChainId != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.DestChainId)) + i-- dAtA[i] = 0x8 } if input.Buf != nil { @@ -1185,6 +1214,25 @@ func (x *fastReflection_QueryCrossChainPackageRequest) ProtoMethods() *protoifac } switch fieldNum { case 1: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field DestChainId", wireType) + } + x.DestChainId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + x.DestChainId |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: if wireType != 0 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field ChannelId", wireType) } @@ -1203,7 +1251,7 @@ func (x *fastReflection_QueryCrossChainPackageRequest) ProtoMethods() *protoifac break } } - case 2: + case 3: if wireType != 0 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Sequence", wireType) } @@ -1680,13 +1728,15 @@ func (x *fastReflection_QueryCrossChainPackageResponse) ProtoMethods() *protoifa } var ( - md_QuerySendSequenceRequest protoreflect.MessageDescriptor - fd_QuerySendSequenceRequest_channel_id protoreflect.FieldDescriptor + md_QuerySendSequenceRequest protoreflect.MessageDescriptor + fd_QuerySendSequenceRequest_dest_chain_id protoreflect.FieldDescriptor + fd_QuerySendSequenceRequest_channel_id protoreflect.FieldDescriptor ) func init() { file_cosmos_crosschain_v1_query_proto_init() md_QuerySendSequenceRequest = File_cosmos_crosschain_v1_query_proto.Messages().ByName("QuerySendSequenceRequest") + fd_QuerySendSequenceRequest_dest_chain_id = md_QuerySendSequenceRequest.Fields().ByName("dest_chain_id") fd_QuerySendSequenceRequest_channel_id = md_QuerySendSequenceRequest.Fields().ByName("channel_id") } @@ -1755,6 +1805,12 @@ func (x *fastReflection_QuerySendSequenceRequest) Interface() protoreflect.Proto // While iterating, mutating operations may only be performed // on the current field descriptor. func (x *fastReflection_QuerySendSequenceRequest) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.DestChainId != uint32(0) { + value := protoreflect.ValueOfUint32(x.DestChainId) + if !f(fd_QuerySendSequenceRequest_dest_chain_id, value) { + return + } + } if x.ChannelId != uint32(0) { value := protoreflect.ValueOfUint32(x.ChannelId) if !f(fd_QuerySendSequenceRequest_channel_id, value) { @@ -1776,6 +1832,8 @@ func (x *fastReflection_QuerySendSequenceRequest) Range(f func(protoreflect.Fiel // a repeated field is populated if it is non-empty. func (x *fastReflection_QuerySendSequenceRequest) Has(fd protoreflect.FieldDescriptor) bool { switch fd.FullName() { + case "cosmos.crosschain.v1.QuerySendSequenceRequest.dest_chain_id": + return x.DestChainId != uint32(0) case "cosmos.crosschain.v1.QuerySendSequenceRequest.channel_id": return x.ChannelId != uint32(0) default: @@ -1794,6 +1852,8 @@ func (x *fastReflection_QuerySendSequenceRequest) Has(fd protoreflect.FieldDescr // Clear is a mutating operation and unsafe for concurrent use. func (x *fastReflection_QuerySendSequenceRequest) Clear(fd protoreflect.FieldDescriptor) { switch fd.FullName() { + case "cosmos.crosschain.v1.QuerySendSequenceRequest.dest_chain_id": + x.DestChainId = uint32(0) case "cosmos.crosschain.v1.QuerySendSequenceRequest.channel_id": x.ChannelId = uint32(0) default: @@ -1812,6 +1872,9 @@ func (x *fastReflection_QuerySendSequenceRequest) Clear(fd protoreflect.FieldDes // of the value; to obtain a mutable reference, use Mutable. func (x *fastReflection_QuerySendSequenceRequest) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { switch descriptor.FullName() { + case "cosmos.crosschain.v1.QuerySendSequenceRequest.dest_chain_id": + value := x.DestChainId + return protoreflect.ValueOfUint32(value) case "cosmos.crosschain.v1.QuerySendSequenceRequest.channel_id": value := x.ChannelId return protoreflect.ValueOfUint32(value) @@ -1835,6 +1898,8 @@ func (x *fastReflection_QuerySendSequenceRequest) Get(descriptor protoreflect.Fi // Set is a mutating operation and unsafe for concurrent use. func (x *fastReflection_QuerySendSequenceRequest) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { switch fd.FullName() { + case "cosmos.crosschain.v1.QuerySendSequenceRequest.dest_chain_id": + x.DestChainId = uint32(value.Uint()) case "cosmos.crosschain.v1.QuerySendSequenceRequest.channel_id": x.ChannelId = uint32(value.Uint()) default: @@ -1857,6 +1922,8 @@ func (x *fastReflection_QuerySendSequenceRequest) Set(fd protoreflect.FieldDescr // Mutable is a mutating operation and unsafe for concurrent use. func (x *fastReflection_QuerySendSequenceRequest) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { + case "cosmos.crosschain.v1.QuerySendSequenceRequest.dest_chain_id": + panic(fmt.Errorf("field dest_chain_id of message cosmos.crosschain.v1.QuerySendSequenceRequest is not mutable")) case "cosmos.crosschain.v1.QuerySendSequenceRequest.channel_id": panic(fmt.Errorf("field channel_id of message cosmos.crosschain.v1.QuerySendSequenceRequest is not mutable")) default: @@ -1872,6 +1939,8 @@ func (x *fastReflection_QuerySendSequenceRequest) Mutable(fd protoreflect.FieldD // For lists, maps, and messages, this returns a new, empty, mutable value. func (x *fastReflection_QuerySendSequenceRequest) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { + case "cosmos.crosschain.v1.QuerySendSequenceRequest.dest_chain_id": + return protoreflect.ValueOfUint32(uint32(0)) case "cosmos.crosschain.v1.QuerySendSequenceRequest.channel_id": return protoreflect.ValueOfUint32(uint32(0)) default: @@ -1943,6 +2012,9 @@ func (x *fastReflection_QuerySendSequenceRequest) ProtoMethods() *protoiface.Met var n int var l int _ = l + if x.DestChainId != 0 { + n += 1 + runtime.Sov(uint64(x.DestChainId)) + } if x.ChannelId != 0 { n += 1 + runtime.Sov(uint64(x.ChannelId)) } @@ -1978,6 +2050,11 @@ func (x *fastReflection_QuerySendSequenceRequest) ProtoMethods() *protoiface.Met if x.ChannelId != 0 { i = runtime.EncodeVarint(dAtA, i, uint64(x.ChannelId)) i-- + dAtA[i] = 0x10 + } + if x.DestChainId != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.DestChainId)) + i-- dAtA[i] = 0x8 } if input.Buf != nil { @@ -2030,6 +2107,25 @@ func (x *fastReflection_QuerySendSequenceRequest) ProtoMethods() *protoiface.Met } switch fieldNum { case 1: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field DestChainId", wireType) + } + x.DestChainId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + x.DestChainId |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: if wireType != 0 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field ChannelId", wireType) } @@ -2488,13 +2584,15 @@ func (x *fastReflection_QuerySendSequenceResponse) ProtoMethods() *protoiface.Me } var ( - md_QueryReceiveSequenceRequest protoreflect.MessageDescriptor - fd_QueryReceiveSequenceRequest_channel_id protoreflect.FieldDescriptor + md_QueryReceiveSequenceRequest protoreflect.MessageDescriptor + fd_QueryReceiveSequenceRequest_dest_chain_id protoreflect.FieldDescriptor + fd_QueryReceiveSequenceRequest_channel_id protoreflect.FieldDescriptor ) func init() { file_cosmos_crosschain_v1_query_proto_init() md_QueryReceiveSequenceRequest = File_cosmos_crosschain_v1_query_proto.Messages().ByName("QueryReceiveSequenceRequest") + fd_QueryReceiveSequenceRequest_dest_chain_id = md_QueryReceiveSequenceRequest.Fields().ByName("dest_chain_id") fd_QueryReceiveSequenceRequest_channel_id = md_QueryReceiveSequenceRequest.Fields().ByName("channel_id") } @@ -2563,6 +2661,12 @@ func (x *fastReflection_QueryReceiveSequenceRequest) Interface() protoreflect.Pr // While iterating, mutating operations may only be performed // on the current field descriptor. func (x *fastReflection_QueryReceiveSequenceRequest) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.DestChainId != uint32(0) { + value := protoreflect.ValueOfUint32(x.DestChainId) + if !f(fd_QueryReceiveSequenceRequest_dest_chain_id, value) { + return + } + } if x.ChannelId != uint32(0) { value := protoreflect.ValueOfUint32(x.ChannelId) if !f(fd_QueryReceiveSequenceRequest_channel_id, value) { @@ -2584,6 +2688,8 @@ func (x *fastReflection_QueryReceiveSequenceRequest) Range(f func(protoreflect.F // a repeated field is populated if it is non-empty. func (x *fastReflection_QueryReceiveSequenceRequest) Has(fd protoreflect.FieldDescriptor) bool { switch fd.FullName() { + case "cosmos.crosschain.v1.QueryReceiveSequenceRequest.dest_chain_id": + return x.DestChainId != uint32(0) case "cosmos.crosschain.v1.QueryReceiveSequenceRequest.channel_id": return x.ChannelId != uint32(0) default: @@ -2602,6 +2708,8 @@ func (x *fastReflection_QueryReceiveSequenceRequest) Has(fd protoreflect.FieldDe // Clear is a mutating operation and unsafe for concurrent use. func (x *fastReflection_QueryReceiveSequenceRequest) Clear(fd protoreflect.FieldDescriptor) { switch fd.FullName() { + case "cosmos.crosschain.v1.QueryReceiveSequenceRequest.dest_chain_id": + x.DestChainId = uint32(0) case "cosmos.crosschain.v1.QueryReceiveSequenceRequest.channel_id": x.ChannelId = uint32(0) default: @@ -2620,6 +2728,9 @@ func (x *fastReflection_QueryReceiveSequenceRequest) Clear(fd protoreflect.Field // of the value; to obtain a mutable reference, use Mutable. func (x *fastReflection_QueryReceiveSequenceRequest) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { switch descriptor.FullName() { + case "cosmos.crosschain.v1.QueryReceiveSequenceRequest.dest_chain_id": + value := x.DestChainId + return protoreflect.ValueOfUint32(value) case "cosmos.crosschain.v1.QueryReceiveSequenceRequest.channel_id": value := x.ChannelId return protoreflect.ValueOfUint32(value) @@ -2643,6 +2754,8 @@ func (x *fastReflection_QueryReceiveSequenceRequest) Get(descriptor protoreflect // Set is a mutating operation and unsafe for concurrent use. func (x *fastReflection_QueryReceiveSequenceRequest) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { switch fd.FullName() { + case "cosmos.crosschain.v1.QueryReceiveSequenceRequest.dest_chain_id": + x.DestChainId = uint32(value.Uint()) case "cosmos.crosschain.v1.QueryReceiveSequenceRequest.channel_id": x.ChannelId = uint32(value.Uint()) default: @@ -2665,6 +2778,8 @@ func (x *fastReflection_QueryReceiveSequenceRequest) Set(fd protoreflect.FieldDe // Mutable is a mutating operation and unsafe for concurrent use. func (x *fastReflection_QueryReceiveSequenceRequest) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { + case "cosmos.crosschain.v1.QueryReceiveSequenceRequest.dest_chain_id": + panic(fmt.Errorf("field dest_chain_id of message cosmos.crosschain.v1.QueryReceiveSequenceRequest is not mutable")) case "cosmos.crosschain.v1.QueryReceiveSequenceRequest.channel_id": panic(fmt.Errorf("field channel_id of message cosmos.crosschain.v1.QueryReceiveSequenceRequest is not mutable")) default: @@ -2680,6 +2795,8 @@ func (x *fastReflection_QueryReceiveSequenceRequest) Mutable(fd protoreflect.Fie // For lists, maps, and messages, this returns a new, empty, mutable value. func (x *fastReflection_QueryReceiveSequenceRequest) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { + case "cosmos.crosschain.v1.QueryReceiveSequenceRequest.dest_chain_id": + return protoreflect.ValueOfUint32(uint32(0)) case "cosmos.crosschain.v1.QueryReceiveSequenceRequest.channel_id": return protoreflect.ValueOfUint32(uint32(0)) default: @@ -2751,6 +2868,9 @@ func (x *fastReflection_QueryReceiveSequenceRequest) ProtoMethods() *protoiface. var n int var l int _ = l + if x.DestChainId != 0 { + n += 1 + runtime.Sov(uint64(x.DestChainId)) + } if x.ChannelId != 0 { n += 1 + runtime.Sov(uint64(x.ChannelId)) } @@ -2786,6 +2906,11 @@ func (x *fastReflection_QueryReceiveSequenceRequest) ProtoMethods() *protoiface. if x.ChannelId != 0 { i = runtime.EncodeVarint(dAtA, i, uint64(x.ChannelId)) i-- + dAtA[i] = 0x10 + } + if x.DestChainId != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.DestChainId)) + i-- dAtA[i] = 0x8 } if input.Buf != nil { @@ -2838,6 +2963,25 @@ func (x *fastReflection_QueryReceiveSequenceRequest) ProtoMethods() *protoiface. } switch fieldNum { case 1: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field DestChainId", wireType) + } + x.DestChainId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + x.DestChainId |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: if wireType != 0 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field ChannelId", wireType) } @@ -3378,10 +3522,12 @@ type QueryCrossChainPackageRequest struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields + // destination chain id + DestChainId uint32 `protobuf:"varint,1,opt,name=dest_chain_id,json=destChainId,proto3" json:"dest_chain_id,omitempty"` // channel id of the cross chain package - ChannelId uint32 `protobuf:"varint,1,opt,name=channel_id,json=channelId,proto3" json:"channel_id,omitempty"` + ChannelId uint32 `protobuf:"varint,2,opt,name=channel_id,json=channelId,proto3" json:"channel_id,omitempty"` // sequence of the cross chain package - Sequence uint64 `protobuf:"varint,2,opt,name=sequence,proto3" json:"sequence,omitempty"` + Sequence uint64 `protobuf:"varint,3,opt,name=sequence,proto3" json:"sequence,omitempty"` } func (x *QueryCrossChainPackageRequest) Reset() { @@ -3404,6 +3550,13 @@ func (*QueryCrossChainPackageRequest) Descriptor() ([]byte, []int) { return file_cosmos_crosschain_v1_query_proto_rawDescGZIP(), []int{2} } +func (x *QueryCrossChainPackageRequest) GetDestChainId() uint32 { + if x != nil { + return x.DestChainId + } + return 0 +} + func (x *QueryCrossChainPackageRequest) GetChannelId() uint32 { if x != nil { return x.ChannelId @@ -3461,8 +3614,10 @@ type QuerySendSequenceRequest struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields + // destination chain id + DestChainId uint32 `protobuf:"varint,1,opt,name=dest_chain_id,json=destChainId,proto3" json:"dest_chain_id,omitempty"` // channel id of the cross chain package - ChannelId uint32 `protobuf:"varint,1,opt,name=channel_id,json=channelId,proto3" json:"channel_id,omitempty"` + ChannelId uint32 `protobuf:"varint,2,opt,name=channel_id,json=channelId,proto3" json:"channel_id,omitempty"` } func (x *QuerySendSequenceRequest) Reset() { @@ -3485,6 +3640,13 @@ func (*QuerySendSequenceRequest) Descriptor() ([]byte, []int) { return file_cosmos_crosschain_v1_query_proto_rawDescGZIP(), []int{4} } +func (x *QuerySendSequenceRequest) GetDestChainId() uint32 { + if x != nil { + return x.DestChainId + } + return 0 +} + func (x *QuerySendSequenceRequest) GetChannelId() uint32 { if x != nil { return x.ChannelId @@ -3535,8 +3697,10 @@ type QueryReceiveSequenceRequest struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields + // destination chain id + DestChainId uint32 `protobuf:"varint,1,opt,name=dest_chain_id,json=destChainId,proto3" json:"dest_chain_id,omitempty"` // channel id of the cross chain package - ChannelId uint32 `protobuf:"varint,1,opt,name=channel_id,json=channelId,proto3" json:"channel_id,omitempty"` + ChannelId uint32 `protobuf:"varint,2,opt,name=channel_id,json=channelId,proto3" json:"channel_id,omitempty"` } func (x *QueryReceiveSequenceRequest) Reset() { @@ -3559,6 +3723,13 @@ func (*QueryReceiveSequenceRequest) Descriptor() ([]byte, []int) { return file_cosmos_crosschain_v1_query_proto_rawDescGZIP(), []int{6} } +func (x *QueryReceiveSequenceRequest) GetDestChainId() uint32 { + if x != nil { + return x.DestChainId + } + return 0 +} + func (x *QueryReceiveSequenceRequest) GetChannelId() uint32 { if x != nil { return x.ChannelId @@ -3621,86 +3792,93 @@ var file_cosmos_crosschain_v1_query_proto_rawDesc = []byte{ 0x12, 0x3a, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x63, 0x72, 0x6f, 0x73, 0x73, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x42, 0x04, - 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x22, 0x5a, 0x0a, 0x1d, + 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x22, 0x7e, 0x0a, 0x1d, 0x51, 0x75, 0x65, 0x72, 0x79, 0x43, 0x72, 0x6f, 0x73, 0x73, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x50, - 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1d, 0x0a, - 0x0a, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0d, 0x52, 0x09, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, - 0x73, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x08, - 0x73, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x22, 0x3a, 0x0a, 0x1e, 0x51, 0x75, 0x65, 0x72, - 0x79, 0x43, 0x72, 0x6f, 0x73, 0x73, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x50, 0x61, 0x63, 0x6b, 0x61, - 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x61, - 0x63, 0x6b, 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x70, 0x61, 0x63, - 0x6b, 0x61, 0x67, 0x65, 0x22, 0x39, 0x0a, 0x18, 0x51, 0x75, 0x65, 0x72, 0x79, 0x53, 0x65, 0x6e, - 0x64, 0x53, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x12, 0x1d, 0x0a, 0x0a, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x5f, 0x69, 0x64, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x49, 0x64, 0x22, - 0x37, 0x0a, 0x19, 0x51, 0x75, 0x65, 0x72, 0x79, 0x53, 0x65, 0x6e, 0x64, 0x53, 0x65, 0x71, 0x75, - 0x65, 0x6e, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1a, 0x0a, 0x08, - 0x73, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x08, - 0x73, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x22, 0x3c, 0x0a, 0x1b, 0x51, 0x75, 0x65, 0x72, - 0x79, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x53, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x63, 0x68, 0x61, 0x6e, 0x6e, - 0x65, 0x6c, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, 0x63, 0x68, 0x61, - 0x6e, 0x6e, 0x65, 0x6c, 0x49, 0x64, 0x22, 0x3a, 0x0a, 0x1c, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, - 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x53, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x65, 0x71, 0x75, 0x65, 0x6e, - 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x08, 0x73, 0x65, 0x71, 0x75, 0x65, 0x6e, - 0x63, 0x65, 0x32, 0x8b, 0x05, 0x0a, 0x05, 0x51, 0x75, 0x65, 0x72, 0x79, 0x12, 0x83, 0x01, 0x0a, - 0x06, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x28, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, - 0x2e, 0x63, 0x72, 0x6f, 0x73, 0x73, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x51, - 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x1a, 0x29, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x63, 0x72, 0x6f, 0x73, 0x73, - 0x63, 0x68, 0x61, 0x69, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, - 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x24, 0x82, 0xd3, - 0xe4, 0x93, 0x02, 0x1e, 0x12, 0x1c, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x63, 0x72, - 0x6f, 0x73, 0x73, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x2f, 0x76, 0x31, 0x2f, 0x70, 0x61, 0x72, 0x61, - 0x6d, 0x73, 0x12, 0xb1, 0x01, 0x0a, 0x11, 0x43, 0x72, 0x6f, 0x73, 0x73, 0x43, 0x68, 0x61, 0x69, - 0x6e, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x12, 0x33, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, - 0x73, 0x2e, 0x63, 0x72, 0x6f, 0x73, 0x73, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x2e, 0x76, 0x31, 0x2e, + 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x22, 0x0a, + 0x0d, 0x64, 0x65, 0x73, 0x74, 0x5f, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x74, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x49, + 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x5f, 0x69, 0x64, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x49, 0x64, + 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x04, 0x52, 0x08, 0x73, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x22, 0x3a, 0x0a, 0x1e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x43, 0x72, 0x6f, 0x73, 0x73, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x50, - 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x34, 0x2e, + 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x18, + 0x0a, 0x07, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, + 0x07, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x22, 0x5d, 0x0a, 0x18, 0x51, 0x75, 0x65, 0x72, + 0x79, 0x53, 0x65, 0x6e, 0x64, 0x53, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x12, 0x22, 0x0a, 0x0d, 0x64, 0x65, 0x73, 0x74, 0x5f, 0x63, 0x68, 0x61, + 0x69, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0b, 0x64, 0x65, 0x73, + 0x74, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x63, 0x68, 0x61, 0x6e, + 0x6e, 0x65, 0x6c, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, 0x63, 0x68, + 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x49, 0x64, 0x22, 0x37, 0x0a, 0x19, 0x51, 0x75, 0x65, 0x72, 0x79, + 0x53, 0x65, 0x6e, 0x64, 0x53, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x08, 0x73, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, + 0x22, 0x60, 0x0a, 0x1b, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, + 0x53, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, + 0x22, 0x0a, 0x0d, 0x64, 0x65, 0x73, 0x74, 0x5f, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x5f, 0x69, 0x64, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x74, 0x43, 0x68, 0x61, 0x69, + 0x6e, 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x5f, 0x69, + 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, + 0x49, 0x64, 0x22, 0x3a, 0x0a, 0x1c, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x63, 0x65, 0x69, + 0x76, 0x65, 0x53, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x04, 0x52, 0x08, 0x73, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x32, 0x8b, + 0x05, 0x0a, 0x05, 0x51, 0x75, 0x65, 0x72, 0x79, 0x12, 0x83, 0x01, 0x0a, 0x06, 0x50, 0x61, 0x72, + 0x61, 0x6d, 0x73, 0x12, 0x28, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x63, 0x72, 0x6f, + 0x73, 0x73, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, + 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x29, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x63, 0x72, 0x6f, 0x73, 0x73, 0x63, 0x68, 0x61, 0x69, - 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x43, 0x72, 0x6f, 0x73, 0x73, 0x43, - 0x68, 0x61, 0x69, 0x6e, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x22, 0x31, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x2b, 0x12, 0x29, 0x2f, 0x63, 0x6f, - 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x63, 0x72, 0x6f, 0x73, 0x73, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x2f, - 0x76, 0x31, 0x2f, 0x63, 0x72, 0x6f, 0x73, 0x73, 0x5f, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x5f, 0x70, - 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x12, 0x9c, 0x01, 0x0a, 0x0c, 0x53, 0x65, 0x6e, 0x64, 0x53, - 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x2e, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, - 0x2e, 0x63, 0x72, 0x6f, 0x73, 0x73, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x51, - 0x75, 0x65, 0x72, 0x79, 0x53, 0x65, 0x6e, 0x64, 0x53, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2f, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, - 0x2e, 0x63, 0x72, 0x6f, 0x73, 0x73, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x51, - 0x75, 0x65, 0x72, 0x79, 0x53, 0x65, 0x6e, 0x64, 0x53, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2b, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x25, - 0x12, 0x23, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x63, 0x72, 0x6f, 0x73, 0x73, 0x63, - 0x68, 0x61, 0x69, 0x6e, 0x2f, 0x76, 0x31, 0x2f, 0x73, 0x65, 0x6e, 0x64, 0x5f, 0x73, 0x65, 0x71, - 0x75, 0x65, 0x6e, 0x63, 0x65, 0x12, 0xa8, 0x01, 0x0a, 0x0f, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, - 0x65, 0x53, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x31, 0x2e, 0x63, 0x6f, 0x73, 0x6d, + 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x24, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1e, + 0x12, 0x1c, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x63, 0x72, 0x6f, 0x73, 0x73, 0x63, + 0x68, 0x61, 0x69, 0x6e, 0x2f, 0x76, 0x31, 0x2f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0xb1, + 0x01, 0x0a, 0x11, 0x43, 0x72, 0x6f, 0x73, 0x73, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x50, 0x61, 0x63, + 0x6b, 0x61, 0x67, 0x65, 0x12, 0x33, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x63, 0x72, + 0x6f, 0x73, 0x73, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x51, 0x75, 0x65, 0x72, + 0x79, 0x43, 0x72, 0x6f, 0x73, 0x73, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x50, 0x61, 0x63, 0x6b, 0x61, + 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x34, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x63, 0x72, 0x6f, 0x73, 0x73, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x2e, 0x76, 0x31, - 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x53, 0x65, 0x71, - 0x75, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x32, 0x2e, 0x63, - 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x63, 0x72, 0x6f, 0x73, 0x73, 0x63, 0x68, 0x61, 0x69, 0x6e, - 0x2e, 0x76, 0x31, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, - 0x53, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x22, 0x2e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x28, 0x12, 0x26, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, - 0x73, 0x2f, 0x63, 0x72, 0x6f, 0x73, 0x73, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x2f, 0x76, 0x31, 0x2f, - 0x72, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x5f, 0x73, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, - 0x42, 0xcc, 0x01, 0x0a, 0x18, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, - 0x63, 0x72, 0x6f, 0x73, 0x73, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x2e, 0x76, 0x31, 0x42, 0x0a, 0x51, - 0x75, 0x65, 0x72, 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x32, 0x63, 0x6f, 0x73, - 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6f, - 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x63, 0x72, 0x6f, 0x73, 0x73, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x2f, - 0x76, 0x31, 0x3b, 0x63, 0x72, 0x6f, 0x73, 0x73, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x76, 0x31, 0xa2, - 0x02, 0x03, 0x43, 0x43, 0x58, 0xaa, 0x02, 0x14, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x43, - 0x72, 0x6f, 0x73, 0x73, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x14, 0x43, - 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x43, 0x72, 0x6f, 0x73, 0x73, 0x63, 0x68, 0x61, 0x69, 0x6e, - 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x20, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x43, 0x72, 0x6f, - 0x73, 0x73, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, - 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x16, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x3a, - 0x3a, 0x43, 0x72, 0x6f, 0x73, 0x73, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x3a, 0x3a, 0x56, 0x31, 0x62, - 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x43, 0x72, 0x6f, 0x73, 0x73, 0x43, 0x68, 0x61, 0x69, 0x6e, + 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, + 0x31, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x2b, 0x12, 0x29, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, + 0x2f, 0x63, 0x72, 0x6f, 0x73, 0x73, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x2f, 0x76, 0x31, 0x2f, 0x63, + 0x72, 0x6f, 0x73, 0x73, 0x5f, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x5f, 0x70, 0x61, 0x63, 0x6b, 0x61, + 0x67, 0x65, 0x12, 0x9c, 0x01, 0x0a, 0x0c, 0x53, 0x65, 0x6e, 0x64, 0x53, 0x65, 0x71, 0x75, 0x65, + 0x6e, 0x63, 0x65, 0x12, 0x2e, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x63, 0x72, 0x6f, + 0x73, 0x73, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, + 0x53, 0x65, 0x6e, 0x64, 0x53, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x2f, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x63, 0x72, 0x6f, + 0x73, 0x73, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, + 0x53, 0x65, 0x6e, 0x64, 0x53, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2b, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x25, 0x12, 0x23, 0x2f, 0x63, + 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x63, 0x72, 0x6f, 0x73, 0x73, 0x63, 0x68, 0x61, 0x69, 0x6e, + 0x2f, 0x76, 0x31, 0x2f, 0x73, 0x65, 0x6e, 0x64, 0x5f, 0x73, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, + 0x65, 0x12, 0xa8, 0x01, 0x0a, 0x0f, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x53, 0x65, 0x71, + 0x75, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x31, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x63, + 0x72, 0x6f, 0x73, 0x73, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x51, 0x75, 0x65, + 0x72, 0x79, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x53, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, + 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x32, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, + 0x73, 0x2e, 0x63, 0x72, 0x6f, 0x73, 0x73, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x2e, 0x76, 0x31, 0x2e, + 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x53, 0x65, 0x71, 0x75, + 0x65, 0x6e, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2e, 0x82, 0xd3, + 0xe4, 0x93, 0x02, 0x28, 0x12, 0x26, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x63, 0x72, + 0x6f, 0x73, 0x73, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x2f, 0x76, 0x31, 0x2f, 0x72, 0x65, 0x63, 0x65, + 0x69, 0x76, 0x65, 0x5f, 0x73, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x42, 0xcc, 0x01, 0x0a, + 0x18, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x63, 0x72, 0x6f, 0x73, + 0x73, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x2e, 0x76, 0x31, 0x42, 0x0a, 0x51, 0x75, 0x65, 0x72, 0x79, + 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x32, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, + 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, + 0x2f, 0x63, 0x72, 0x6f, 0x73, 0x73, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x2f, 0x76, 0x31, 0x3b, 0x63, + 0x72, 0x6f, 0x73, 0x73, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x43, 0x43, + 0x58, 0xaa, 0x02, 0x14, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x43, 0x72, 0x6f, 0x73, 0x73, + 0x63, 0x68, 0x61, 0x69, 0x6e, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x14, 0x43, 0x6f, 0x73, 0x6d, 0x6f, + 0x73, 0x5c, 0x43, 0x72, 0x6f, 0x73, 0x73, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x5c, 0x56, 0x31, 0xe2, + 0x02, 0x20, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x43, 0x72, 0x6f, 0x73, 0x73, 0x63, 0x68, + 0x61, 0x69, 0x6e, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, + 0x74, 0x61, 0xea, 0x02, 0x16, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x43, 0x72, 0x6f, + 0x73, 0x73, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x33, } var ( diff --git a/proto/cosmos/crosschain/v1/query.proto b/proto/cosmos/crosschain/v1/query.proto index 45555a83bc..c54115a0be 100644 --- a/proto/cosmos/crosschain/v1/query.proto +++ b/proto/cosmos/crosschain/v1/query.proto @@ -41,10 +41,12 @@ message QueryParamsResponse { // QueryCrossChainPackageRequest is the request type for the Query/CrossChainPackage RPC method. message QueryCrossChainPackageRequest { + // destination chain id + uint32 dest_chain_id = 1; // channel id of the cross chain package - uint32 channel_id = 1; + uint32 channel_id = 2; // sequence of the cross chain package - uint64 sequence = 2; + uint64 sequence = 3; } // QueryCrossChainPackageResponse is the response type for the Query/CrossChainPackage RPC method. @@ -55,8 +57,10 @@ message QueryCrossChainPackageResponse { // QuerySendSequenceRequest is the request type for the Query/SendSequence RPC method. message QuerySendSequenceRequest { + // destination chain id + uint32 dest_chain_id = 1; // channel id of the cross chain package - uint32 channel_id = 1; + uint32 channel_id = 2; } // QuerySendSequenceResponse is the response type for the Query/SendSequence RPC method. @@ -67,8 +71,10 @@ message QuerySendSequenceResponse { // QuerySendSequenceRequest is the request type for the Query/ReceiveSequence RPC method. message QueryReceiveSequenceRequest { + // destination chain id + uint32 dest_chain_id = 1; // channel id of the cross chain package - uint32 channel_id = 1; + uint32 channel_id = 2; } // QuerySendSequenceResponse is the response type for the Query/ReceiveSequence RPC method. diff --git a/x/crosschain/keeper/grpc_query.go b/x/crosschain/keeper/grpc_query.go index c4533f7647..8580c0b70f 100644 --- a/x/crosschain/keeper/grpc_query.go +++ b/x/crosschain/keeper/grpc_query.go @@ -26,7 +26,7 @@ func (k Keeper) CrossChainPackage(c context.Context, req *types.QueryCrossChainP } ctx := sdk.UnwrapSDKContext(c) - pack, err := k.GetCrossChainPackage(ctx, k.GetDestBscChainID(), sdk.ChannelID(req.ChannelId), req.Sequence) + pack, err := k.GetCrossChainPackage(ctx, sdk.ChainID(req.DestChainId), sdk.ChannelID(req.ChannelId), req.Sequence) if err != nil { return nil, err } @@ -42,7 +42,7 @@ func (k Keeper) SendSequence(c context.Context, req *types.QuerySendSequenceRequ } ctx := sdk.UnwrapSDKContext(c) - sequence := k.GetSendSequence(ctx, k.GetDestBscChainID(), sdk.ChannelID(req.ChannelId)) + sequence := k.GetSendSequence(ctx, sdk.ChainID(req.DestChainId), sdk.ChannelID(req.ChannelId)) return &types.QuerySendSequenceResponse{ Sequence: sequence, @@ -56,7 +56,7 @@ func (k Keeper) ReceiveSequence(c context.Context, req *types.QueryReceiveSequen } ctx := sdk.UnwrapSDKContext(c) - sequence := k.GetReceiveSequence(ctx, k.GetDestBscChainID(), sdk.ChannelID(req.ChannelId)) + sequence := k.GetReceiveSequence(ctx, sdk.ChainID(req.DestChainId), sdk.ChannelID(req.ChannelId)) return &types.QueryReceiveSequenceResponse{ Sequence: sequence, diff --git a/x/crosschain/types/query.pb.go b/x/crosschain/types/query.pb.go index 8e7f88bf5f..9f8e0e2dc5 100644 --- a/x/crosschain/types/query.pb.go +++ b/x/crosschain/types/query.pb.go @@ -114,10 +114,12 @@ func (m *QueryParamsResponse) GetParams() Params { // QueryCrossChainPackageRequest is the request type for the Query/CrossChainPackage RPC method. type QueryCrossChainPackageRequest struct { + // destination chain id + DestChainId uint32 `protobuf:"varint,1,opt,name=dest_chain_id,json=destChainId,proto3" json:"dest_chain_id,omitempty"` // channel id of the cross chain package - ChannelId uint32 `protobuf:"varint,1,opt,name=channel_id,json=channelId,proto3" json:"channel_id,omitempty"` + ChannelId uint32 `protobuf:"varint,2,opt,name=channel_id,json=channelId,proto3" json:"channel_id,omitempty"` // sequence of the cross chain package - Sequence uint64 `protobuf:"varint,2,opt,name=sequence,proto3" json:"sequence,omitempty"` + Sequence uint64 `protobuf:"varint,3,opt,name=sequence,proto3" json:"sequence,omitempty"` } func (m *QueryCrossChainPackageRequest) Reset() { *m = QueryCrossChainPackageRequest{} } @@ -153,6 +155,13 @@ func (m *QueryCrossChainPackageRequest) XXX_DiscardUnknown() { var xxx_messageInfo_QueryCrossChainPackageRequest proto.InternalMessageInfo +func (m *QueryCrossChainPackageRequest) GetDestChainId() uint32 { + if m != nil { + return m.DestChainId + } + return 0 +} + func (m *QueryCrossChainPackageRequest) GetChannelId() uint32 { if m != nil { return m.ChannelId @@ -215,8 +224,10 @@ func (m *QueryCrossChainPackageResponse) GetPackage() []byte { // QuerySendSequenceRequest is the request type for the Query/SendSequence RPC method. type QuerySendSequenceRequest struct { + // destination chain id + DestChainId uint32 `protobuf:"varint,1,opt,name=dest_chain_id,json=destChainId,proto3" json:"dest_chain_id,omitempty"` // channel id of the cross chain package - ChannelId uint32 `protobuf:"varint,1,opt,name=channel_id,json=channelId,proto3" json:"channel_id,omitempty"` + ChannelId uint32 `protobuf:"varint,2,opt,name=channel_id,json=channelId,proto3" json:"channel_id,omitempty"` } func (m *QuerySendSequenceRequest) Reset() { *m = QuerySendSequenceRequest{} } @@ -252,6 +263,13 @@ func (m *QuerySendSequenceRequest) XXX_DiscardUnknown() { var xxx_messageInfo_QuerySendSequenceRequest proto.InternalMessageInfo +func (m *QuerySendSequenceRequest) GetDestChainId() uint32 { + if m != nil { + return m.DestChainId + } + return 0 +} + func (m *QuerySendSequenceRequest) GetChannelId() uint32 { if m != nil { return m.ChannelId @@ -307,8 +325,10 @@ func (m *QuerySendSequenceResponse) GetSequence() uint64 { // QuerySendSequenceRequest is the request type for the Query/ReceiveSequence RPC method. type QueryReceiveSequenceRequest struct { + // destination chain id + DestChainId uint32 `protobuf:"varint,1,opt,name=dest_chain_id,json=destChainId,proto3" json:"dest_chain_id,omitempty"` // channel id of the cross chain package - ChannelId uint32 `protobuf:"varint,1,opt,name=channel_id,json=channelId,proto3" json:"channel_id,omitempty"` + ChannelId uint32 `protobuf:"varint,2,opt,name=channel_id,json=channelId,proto3" json:"channel_id,omitempty"` } func (m *QueryReceiveSequenceRequest) Reset() { *m = QueryReceiveSequenceRequest{} } @@ -344,6 +364,13 @@ func (m *QueryReceiveSequenceRequest) XXX_DiscardUnknown() { var xxx_messageInfo_QueryReceiveSequenceRequest proto.InternalMessageInfo +func (m *QueryReceiveSequenceRequest) GetDestChainId() uint32 { + if m != nil { + return m.DestChainId + } + return 0 +} + func (m *QueryReceiveSequenceRequest) GetChannelId() uint32 { if m != nil { return m.ChannelId @@ -411,40 +438,41 @@ func init() { func init() { proto.RegisterFile("cosmos/crosschain/v1/query.proto", fileDescriptor_3c0bc65cbea0cca3) } var fileDescriptor_3c0bc65cbea0cca3 = []byte{ - // 514 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x94, 0xb1, 0x6f, 0xd3, 0x40, - 0x14, 0xc6, 0x73, 0x55, 0x1b, 0xe0, 0x51, 0x84, 0x78, 0x64, 0x08, 0x26, 0x35, 0x91, 0xa1, 0x28, - 0x55, 0x85, 0x4f, 0x49, 0x91, 0x10, 0x11, 0x53, 0x3b, 0x75, 0x6b, 0xdd, 0xad, 0x4b, 0xe4, 0xda, - 0x27, 0xc7, 0x6a,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8, - 0xb9, 0x5e, 0x31, 0x7e, 0x23, 0xf0, 0xf0, 0x46, 0x35, 0xb0, 0x39, 0x27, 0xd1, 0x5c, 0x42, 0xab, - 0xb5, 0x8c, 0x45, 0x73, 0xba, 0x8a, 0xb3, 0x81, 0x2f, 0xcd, 0x9c, 0x69, 0x61, 0x1b, 0xa3, 0xee, - 0xee, 0x5f, 0x0e, 0x6d, 0x72, 0x35, 0xb4, 0xc9, 0xef, 0xa1, 0x4d, 0x3e, 0x8f, 0xec, 0xd2, 0xd5, - 0xc8, 0x2e, 0xfd, 0x1c, 0xd9, 0xa5, 0x63, 0x1a, 0xc5, 0x59, 0xb7, 0x7f, 0xe2, 0x06, 0xa2, 0x37, - 0x9e, 0xa5, 0x7e, 0x5e, 0xc9, 0xf0, 0x94, 0xbe, 0x9f, 0x1c, 0x9c, 0x5d, 0x24, 0x4c, 0x9e, 0x94, - 0xd5, 0xe7, 0x6c, 0xe7, 0x6f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x45, 0x6c, 0xf9, 0x89, 0x63, 0x05, - 0x00, 0x00, + // 536 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x94, 0xb1, 0x6f, 0xd3, 0x40, + 0x14, 0xc6, 0x73, 0xa5, 0x0d, 0xf0, 0xda, 0x0a, 0xf1, 0xc8, 0x10, 0x4c, 0x6a, 0x22, 0x43, 0x51, + 0xaa, 0x0a, 0x9f, 0x92, 0x22, 0x21, 0x65, 0x6c, 0xa7, 0x6c, 0xad, 0xbb, 0x21, 0xa1, 0xe0, 0xda, + 0x27, 0xc7, 0x6a, 0x73, 0xe7, 0xfa, 0x9c, 0x88, 0x2e, 0x0c, 0x30, 0xb2, 0x20, 0xb1, 0xf2, 0x07, + 0xb0, 0xf2, 0x5f, 0x74, 0xac, 0xc4, 0xc2, 0x84, 0x50, 0xc2, 0x1f, 0x82, 0x7c, 0xbe, 0x86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4c, 0xe0, 0xce, 0x85, 0x6a, 0x60, + 0x73, 0x4e, 0xa2, 0xb9, 0xa8, 0x56, 0xeb, 0x3a, 0x2b, 0x9a, 0xd3, 0x55, 0x9c, 0x0d, 0x7c, 0x62, + 0xe6, 0x4c, 0x8b, 0xb5, 0x09, 0xea, 0x76, 0xe7, 0x74, 0x64, 0x93, 0xb3, 0x91, 0x4d, 0x7e, 0x8c, + 0x6c, 0xf2, 0x61, 0x6c, 0x97, 0xce, 0xc6, 0x76, 0xe9, 0xdb, 0xd8, 0x2e, 0xbd, 0xa0, 0x51, 0x9c, + 0xf5, 0x06, 0x07, 0x6e, 0x20, 0xfa, 0x13, 0x2f, 0xf5, 0xf1, 0x54, 0x86, 0x87, 0xf4, 0xf5, 0xb4, + 0x71, 0x76, 0x92, 0x30, 0x79, 0x50, 0x56, 0xaf, 0xce, 0xad, 0x5f, 0x01, 0x00, 0x00, 0xff, 0xff, + 0xcd, 0x14, 0x46, 0x66, 0xcf, 0x05, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -722,11 +750,16 @@ func (m *QueryCrossChainPackageRequest) MarshalToSizedBuffer(dAtA []byte) (int, if m.Sequence != 0 { i = encodeVarintQuery(dAtA, i, uint64(m.Sequence)) i-- - dAtA[i] = 0x10 + dAtA[i] = 0x18 } if m.ChannelId != 0 { i = encodeVarintQuery(dAtA, i, uint64(m.ChannelId)) i-- + dAtA[i] = 0x10 + } + if m.DestChainId != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.DestChainId)) + i-- dAtA[i] = 0x8 } return len(dAtA) - i, nil @@ -785,6 +818,11 @@ func (m *QuerySendSequenceRequest) MarshalToSizedBuffer(dAtA []byte) (int, error if m.ChannelId != 0 { i = encodeVarintQuery(dAtA, i, uint64(m.ChannelId)) i-- + dAtA[i] = 0x10 + } + if m.DestChainId != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.DestChainId)) + i-- dAtA[i] = 0x8 } return len(dAtA) - i, nil @@ -841,6 +879,11 @@ func (m *QueryReceiveSequenceRequest) MarshalToSizedBuffer(dAtA []byte) (int, er if m.ChannelId != 0 { i = encodeVarintQuery(dAtA, i, uint64(m.ChannelId)) i-- + dAtA[i] = 0x10 + } + if m.DestChainId != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.DestChainId)) + i-- dAtA[i] = 0x8 } return len(dAtA) - i, nil @@ -911,6 +954,9 @@ func (m *QueryCrossChainPackageRequest) Size() (n int) { } var l int _ = l + if m.DestChainId != 0 { + n += 1 + sovQuery(uint64(m.DestChainId)) + } if m.ChannelId != 0 { n += 1 + sovQuery(uint64(m.ChannelId)) } @@ -939,6 +985,9 @@ func (m *QuerySendSequenceRequest) Size() (n int) { } var l int _ = l + if m.DestChainId != 0 { + n += 1 + sovQuery(uint64(m.DestChainId)) + } if m.ChannelId != 0 { n += 1 + sovQuery(uint64(m.ChannelId)) } @@ -963,6 +1012,9 @@ func (m *QueryReceiveSequenceRequest) Size() (n int) { } var l int _ = l + if m.DestChainId != 0 { + n += 1 + sovQuery(uint64(m.DestChainId)) + } if m.ChannelId != 0 { n += 1 + sovQuery(uint64(m.ChannelId)) } @@ -1150,6 +1202,25 @@ func (m *QueryCrossChainPackageRequest) Unmarshal(dAtA []byte) error { } switch fieldNum { case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field DestChainId", wireType) + } + m.DestChainId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.DestChainId |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field ChannelId", wireType) } @@ -1168,7 +1239,7 @@ func (m *QueryCrossChainPackageRequest) Unmarshal(dAtA []byte) error { break } } - case 2: + case 3: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Sequence", wireType) } @@ -1322,6 +1393,25 @@ func (m *QuerySendSequenceRequest) Unmarshal(dAtA []byte) error { } switch fieldNum { case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field DestChainId", wireType) + } + m.DestChainId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.DestChainId |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field ChannelId", wireType) } @@ -1460,6 +1550,25 @@ func (m *QueryReceiveSequenceRequest) Unmarshal(dAtA []byte) error { } switch fieldNum { case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field DestChainId", wireType) + } + m.DestChainId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.DestChainId |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field ChannelId", wireType) }