From 86a460b4238b13608bb11633d1fcae592691a2be Mon Sep 17 00:00:00 2001 From: dylanhuang Date: Fri, 11 Aug 2023 13:22:43 +0800 Subject: [PATCH 1/9] chore: modify default gas (#268) --- x/gashub/types/genesis.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/x/gashub/types/genesis.go b/x/gashub/types/genesis.go index 5a2a83cbd0..b666c18a7b 100644 --- a/x/gashub/types/genesis.go +++ b/x/gashub/types/genesis.go @@ -67,22 +67,22 @@ func DefaultGenesisState() *GenesisState { *NewMsgGasParamsWithFixedGas("/cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission", 1.2e3), *NewMsgGasParamsWithFixedGas("/cosmos.feegrant.v1beta1.MsgRevokeAllowance", 1.2e3), *NewMsgGasParamsWithFixedGas("/cosmos.gov.v1.MsgDeposit", 1.2e3), - *NewMsgGasParamsWithFixedGas("/cosmos.gov.v1.MsgSubmitProposal", 2e8), - *NewMsgGasParamsWithFixedGas("/cosmos.gov.v1.MsgVote", 2e7), - *NewMsgGasParamsWithFixedGas("/cosmos.gov.v1.MsgVoteWeighted", 2e7), + *NewMsgGasParamsWithFixedGas("/cosmos.gov.v1.MsgSubmitProposal", 2e6), + *NewMsgGasParamsWithFixedGas("/cosmos.gov.v1.MsgVote", 2e6), + *NewMsgGasParamsWithFixedGas("/cosmos.gov.v1.MsgVoteWeighted", 2e6), *NewMsgGasParamsWithFixedGas("/cosmos.oracle.v1.MsgClaim", 1e3), *NewMsgGasParamsWithFixedGas("/cosmos.slashing.v1beta1.MsgUnjail", 1.2e3), *NewMsgGasParamsWithFixedGas("/cosmos.staking.v1beta1.MsgBeginRedelegate", 1.2e3), *NewMsgGasParamsWithFixedGas("/cosmos.staking.v1beta1.MsgCancelUnbondingDelegation", 1.2e3), - *NewMsgGasParamsWithFixedGas("/cosmos.staking.v1beta1.MsgCreateValidator", 2e8), + *NewMsgGasParamsWithFixedGas("/cosmos.staking.v1beta1.MsgCreateValidator", 2e6), *NewMsgGasParamsWithFixedGas("/cosmos.staking.v1beta1.MsgDelegate", 1.2e3), - *NewMsgGasParamsWithFixedGas("/cosmos.staking.v1beta1.MsgEditValidator", 2e7), + *NewMsgGasParamsWithFixedGas("/cosmos.staking.v1beta1.MsgEditValidator", 2e6), *NewMsgGasParamsWithFixedGas("/cosmos.staking.v1beta1.MsgUndelegate", 1.2e3), *NewMsgGasParamsWithFixedGas("/greenfield.bridge.MsgTransferOut", 1.2e3), - *NewMsgGasParamsWithFixedGas("/greenfield.sp.MsgCreateStorageProvider", 2e8), + *NewMsgGasParamsWithFixedGas("/greenfield.sp.MsgCreateStorageProvider", 2e6), *NewMsgGasParamsWithFixedGas("/greenfield.sp.MsgDeposit", 1.2e3), - *NewMsgGasParamsWithFixedGas("/greenfield.sp.MsgEditStorageProvider", 2e7), - *NewMsgGasParamsWithFixedGas("/greenfield.sp.MsgUpdateSpStoragePrice", 2e7), + *NewMsgGasParamsWithFixedGas("/greenfield.sp.MsgEditStorageProvider", 2e6), + *NewMsgGasParamsWithFixedGas("/greenfield.sp.MsgUpdateSpStoragePrice", 2e6), *NewMsgGasParamsWithFixedGas("/greenfield.sp.MsgUpdateStorageProviderStatus", 1.2e3), *NewMsgGasParamsWithFixedGas("/greenfield.storage.MsgCreateBucket", 2.4e3), *NewMsgGasParamsWithFixedGas("/greenfield.storage.MsgDeleteBucket", 1.2e3), From db9421ad0fa2df9f123271db833c9b7f73b9d64e Mon Sep 17 00:00:00 2001 From: yutianwu Date: Mon, 14 Aug 2023 10:13:46 +0800 Subject: [PATCH 2/9] feat: implement cross-chain mechanism between op and greenfield (#266) * feat: implement cross-chain mechanism between op and greenfield * remove unused code * update go.mod * add dest_chain_id in grpc query --- api/cosmos/crosschain/v1/query.pulsar.go | 356 +++++++++++++++++------ api/cosmos/gov/v1/tx.pulsar.go | 181 ++++++++---- go.mod | 2 +- go.sum | 4 +- proto/cosmos/crosschain/v1/query.proto | 14 +- proto/cosmos/gov/v1/gov.proto | 1 - proto/cosmos/gov/v1/tx.proto | 2 + x/crosschain/keeper/config.go | 7 +- x/crosschain/keeper/grpc_query.go | 6 +- x/crosschain/keeper/keeper.go | 22 +- x/crosschain/keeper/keeper_test.go | 2 +- x/crosschain/types/query.pb.go | 189 +++++++++--- 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 | 6 +- x/gov/types/errors.go | 2 + x/gov/types/expected_keepers.go | 6 + x/gov/types/v1/tx.pb.go | 161 ++++++---- 27 files changed, 941 insertions(+), 460 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/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/go.mod b/go.mod index 39dfa665f8..508dbd89a1 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 diff --git a/go.sum b/go.sum index ea4d8e3b36..ecbf2ce072 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 h1:y3L64GU99otNp27/xLVBTDbv4eroR6CzoYz0rbaVotM= 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/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/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/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/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, 0x73, 0xe7, 0xfa, 0x9c, 0x88, 0xae, 0x30, 0xb2, 0x20, 0xb1, 0xf2, 0x07, 0xb0, - 0xf2, 0x5f, 0x74, 0xac, 0xc4, 0xc2, 0x84, 0x50, 0xc2, 0x1f, 0x82, 0x7c, 0xbe, 0x86, 0xd0, 0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 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, 0xd0, + 0x5e, 0x42, 0x2b, 0xc1, 0x94, 0xf8, 0xe5, 0x7b, 0xdf, 0xf7, 0x3b, 0xdd, 0x17, 0x43, 0x3d, 0x10, + 0xb2, 0x2f, 0x24, 0x0d, 0x52, 0x21, 0x65, 0xd0, 0xf3, 0x63, 0x4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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) } 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..259c0a2e0e 100644 --- a/x/gov/types/crosschain.go +++ b/x/gov/types/crosschain.go @@ -6,9 +6,11 @@ import ( ) const ( - SyncParamsChannel = "syncParametersChange" + SyncParamsChannel = "syncParametersChange" + SyncParamsChannelID sdk.ChannelID = 3 - KeyUpgrade = "upgrade" + + 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, 0xce, 0xe6, 0xc3, 0x6e, 0x26, 0x90, 0x2a, 0x23, 0x37, 0x5d, 0xaf, 0xca, 0x26, 0xd9, 0x00, - 0xb2, 0x12, 0xb2, 0x5b, 0x07, 0x5a, 0x21, 0x53, 0x21, 0x6a, 0x53, 0x01, 0x12, 0x86, 0xca, 0x15, - 0x45, 0x42, 0x48, 0xd1, 0xd8, 0x1e, 0xc6, 0x2b, 0xb2, 0x3b, 0xab, 0x9d, 0xb1, 0x15, 0xdf, 0x2a, - 0x8e, 0x9c, 0xf8, 0x19, 0x1c, 0x73, 0xe8, 0xad, 0x7f, 0xa0, 0x70, 0xaa, 0x38, 0x71, 0x2a, 0x28, - 0x11, 0x44, 0xe2, 0x4f, 0x80, 0xe6, 0x63, 0xd7, 0xf6, 0xae, 0xed, 0x44, 0x20, 0x71, 0xb1, 0x66, - 0xde, 0xf7, 0x79, 0x3f, 0x9e, 0xc7, 0xf3, 0xce, 0x2c, 0xd8, 0xec, 0x50, 0x16, 0x50, 0xe6, 0x11, - 0x3a, 0xf0, 0x06, 0x55, 0x8f, 0x9f, 0xb8, 0x51, 0x4c, 0x39, 0x85, 0xaf, 0x2a, 0xbb, 0x4b, 0xe8, - 0xc0, 0x1d, 0x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, 0xdf, - 0xf9, 0xc3, 0x00, 0xc5, 0x26, 0x23, 0x8f, 0x29, 0xc7, 0xf0, 0xce, 0x14, 0x29, 0xea, 0xa5, 0xbf, - 0x5e, 0x6e, 0x8d, 0x9b, 0xd5, 0xb9, 0x18, 0x13, 0x08, 0xba, 0x60, 0x65, 0x40, 0x39, 0x8e, 0x55, - 0xcf, 0x73, 0x0e, 0x84, 0x82, 0xc1, 0x2a, 0x28, 0xd0, 0x88, 0xfb, 0x34, 0x94, 0x27, 0x68, 0x7d, - 0x74, 0x12, 0x95, 0x3a, 0xae, 0xe8, 0xe5, 0x73, 0x09, 0x68, 0x69, 0xe0, 0xbc, 0x03, 0x54, 0x7b, - 0x5d, 0x08, 0xa3, 0x52, 0x0b, 0x51, 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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x51, 0xac, 0x7f, 0x0d, 0xd6, 0x33, 0xcf, 0xf0, 0x76, 0x86, 0x5e, 0xee, 0x75, 0x31, 0xab, + 0x97, 0x21, 0xd2, 0xf7, 0x07, 0x81, 0x8d, 0xfc, 0xd3, 0xb2, 0x9b, 0x0f, 0xcf, 0x81, 0xcc, 0xfd, + 0x2b, 0x80, 0xd2, 0x32, 0x1f, 0x80, 0x65, 0x71, 0xc7, 0x6f, 0xe6, 0x83, 0xb8, 0xdd, 0xb4, 0xa6, + 0xdb, 0xd3, 0xf8, 0x27, 0xe0, 0xb5, 0x89, 0x8b, 0x72, 0x06, 0x3e, 0xf1, 0x9b, 0x6f, 0xcd, 0xf7, + 0xa7, 0x79, 0x3f, 0x06, 0xa5, 0xe4, 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 591476ad95c9175b349e4114b6ff91d79848f514 Mon Sep 17 00:00:00 2001 From: forcodedancing Date: Mon, 14 Aug 2023 11:11:15 +0800 Subject: [PATCH 3/9] feat: add method to access check state in app (#267) --- baseapp/baseapp.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/baseapp/baseapp.go b/baseapp/baseapp.go index cc73a85000..b9b3643dd2 100644 --- a/baseapp/baseapp.go +++ b/baseapp/baseapp.go @@ -651,6 +651,12 @@ func (app *BaseApp) getState(mode runTxMode) *state { } } +func (app *BaseApp) GetCheckState() *state { + app.checkStateMtx.RLock() + defer app.checkStateMtx.RUnlock() + return app.checkState +} + func (app *BaseApp) getBlockGasMeter(ctx sdk.Context) storetypes.GasMeter { if maxGas := app.GetMaximumBlockGas(ctx); maxGas > 0 { return storetypes.NewGasMeter(maxGas) From 39bab6660f5704f27ce5212a485f2ba24806b5a0 Mon Sep 17 00:00:00 2001 From: dylanhuang Date: Tue, 15 Aug 2023 09:33:01 +0800 Subject: [PATCH 4/9] feat: make cross-chain token mintable (#270) --- api/cosmos/crosschain/v1/tx.pulsar.go | 1042 +++++++++++++++++++++++- api/cosmos/crosschain/v1/tx_grpc.pb.go | 41 + proto/cosmos/crosschain/v1/tx.proto | 27 +- x/crosschain/keeper/keeper.go | 28 +- x/crosschain/keeper/keeper_test.go | 12 +- x/crosschain/keeper/msg_server.go | 13 + x/crosschain/module.go | 2 + x/crosschain/types/msgs.go | 30 +- x/crosschain/types/tx.pb.go | 410 +++++++++- 9 files changed, 1548 insertions(+), 57 deletions(-) diff --git a/api/cosmos/crosschain/v1/tx.pulsar.go b/api/cosmos/crosschain/v1/tx.pulsar.go index 1c6f24e4a3..fd83fe137f 100644 --- a/api/cosmos/crosschain/v1/tx.pulsar.go +++ b/api/cosmos/crosschain/v1/tx.pulsar.go @@ -1785,6 +1785,846 @@ func (x *fastReflection_MsgUpdateChannelPermissionsResponse) ProtoMethods() *pro } } +var ( + md_MsgMintModuleTokens protoreflect.MessageDescriptor + fd_MsgMintModuleTokens_authority protoreflect.FieldDescriptor + fd_MsgMintModuleTokens_amount protoreflect.FieldDescriptor +) + +func init() { + file_cosmos_crosschain_v1_tx_proto_init() + md_MsgMintModuleTokens = File_cosmos_crosschain_v1_tx_proto.Messages().ByName("MsgMintModuleTokens") + fd_MsgMintModuleTokens_authority = md_MsgMintModuleTokens.Fields().ByName("authority") + fd_MsgMintModuleTokens_amount = md_MsgMintModuleTokens.Fields().ByName("amount") +} + +var _ protoreflect.Message = (*fastReflection_MsgMintModuleTokens)(nil) + +type fastReflection_MsgMintModuleTokens MsgMintModuleTokens + +func (x *MsgMintModuleTokens) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgMintModuleTokens)(x) +} + +func (x *MsgMintModuleTokens) slowProtoReflect() protoreflect.Message { + mi := &file_cosmos_crosschain_v1_tx_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_MsgMintModuleTokens_messageType fastReflection_MsgMintModuleTokens_messageType +var _ protoreflect.MessageType = fastReflection_MsgMintModuleTokens_messageType{} + +type fastReflection_MsgMintModuleTokens_messageType struct{} + +func (x fastReflection_MsgMintModuleTokens_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgMintModuleTokens)(nil) +} +func (x fastReflection_MsgMintModuleTokens_messageType) New() protoreflect.Message { + return new(fastReflection_MsgMintModuleTokens) +} +func (x fastReflection_MsgMintModuleTokens_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgMintModuleTokens +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgMintModuleTokens) Descriptor() protoreflect.MessageDescriptor { + return md_MsgMintModuleTokens +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_MsgMintModuleTokens) Type() protoreflect.MessageType { + return _fastReflection_MsgMintModuleTokens_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgMintModuleTokens) New() protoreflect.Message { + return new(fastReflection_MsgMintModuleTokens) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgMintModuleTokens) Interface() protoreflect.ProtoMessage { + return (*MsgMintModuleTokens)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_MsgMintModuleTokens) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Authority != "" { + value := protoreflect.ValueOfString(x.Authority) + if !f(fd_MsgMintModuleTokens_authority, value) { + return + } + } + if x.Amount != "" { + value := protoreflect.ValueOfString(x.Amount) + if !f(fd_MsgMintModuleTokens_amount, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_MsgMintModuleTokens) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "cosmos.crosschain.v1.MsgMintModuleTokens.authority": + return x.Authority != "" + case "cosmos.crosschain.v1.MsgMintModuleTokens.amount": + return x.Amount != "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.crosschain.v1.MsgMintModuleTokens")) + } + panic(fmt.Errorf("message cosmos.crosschain.v1.MsgMintModuleTokens does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgMintModuleTokens) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "cosmos.crosschain.v1.MsgMintModuleTokens.authority": + x.Authority = "" + case "cosmos.crosschain.v1.MsgMintModuleTokens.amount": + x.Amount = "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.crosschain.v1.MsgMintModuleTokens")) + } + panic(fmt.Errorf("message cosmos.crosschain.v1.MsgMintModuleTokens does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_MsgMintModuleTokens) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "cosmos.crosschain.v1.MsgMintModuleTokens.authority": + value := x.Authority + return protoreflect.ValueOfString(value) + case "cosmos.crosschain.v1.MsgMintModuleTokens.amount": + value := x.Amount + return protoreflect.ValueOfString(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.crosschain.v1.MsgMintModuleTokens")) + } + panic(fmt.Errorf("message cosmos.crosschain.v1.MsgMintModuleTokens does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgMintModuleTokens) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "cosmos.crosschain.v1.MsgMintModuleTokens.authority": + x.Authority = value.Interface().(string) + case "cosmos.crosschain.v1.MsgMintModuleTokens.amount": + x.Amount = value.Interface().(string) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.crosschain.v1.MsgMintModuleTokens")) + } + panic(fmt.Errorf("message cosmos.crosschain.v1.MsgMintModuleTokens does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgMintModuleTokens) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "cosmos.crosschain.v1.MsgMintModuleTokens.authority": + panic(fmt.Errorf("field authority of message cosmos.crosschain.v1.MsgMintModuleTokens is not mutable")) + case "cosmos.crosschain.v1.MsgMintModuleTokens.amount": + panic(fmt.Errorf("field amount of message cosmos.crosschain.v1.MsgMintModuleTokens is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.crosschain.v1.MsgMintModuleTokens")) + } + panic(fmt.Errorf("message cosmos.crosschain.v1.MsgMintModuleTokens does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_MsgMintModuleTokens) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "cosmos.crosschain.v1.MsgMintModuleTokens.authority": + return protoreflect.ValueOfString("") + case "cosmos.crosschain.v1.MsgMintModuleTokens.amount": + return protoreflect.ValueOfString("") + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.crosschain.v1.MsgMintModuleTokens")) + } + panic(fmt.Errorf("message cosmos.crosschain.v1.MsgMintModuleTokens does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_MsgMintModuleTokens) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in cosmos.crosschain.v1.MsgMintModuleTokens", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_MsgMintModuleTokens) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgMintModuleTokens) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_MsgMintModuleTokens) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_MsgMintModuleTokens) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgMintModuleTokens) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + l = len(x.Authority) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.Amount) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*MsgMintModuleTokens) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if len(x.Amount) > 0 { + i -= len(x.Amount) + copy(dAtA[i:], x.Amount) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Amount))) + i-- + dAtA[i] = 0x12 + } + if len(x.Authority) > 0 { + i -= len(x.Authority) + copy(dAtA[i:], x.Authority) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Authority))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*MsgMintModuleTokens) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + 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++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgMintModuleTokens: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgMintModuleTokens: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) + } + var stringLen uint64 + 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++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Authority = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + } + var stringLen uint64 + 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++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Amount = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_MsgMintModuleTokensResponse protoreflect.MessageDescriptor +) + +func init() { + file_cosmos_crosschain_v1_tx_proto_init() + md_MsgMintModuleTokensResponse = File_cosmos_crosschain_v1_tx_proto.Messages().ByName("MsgMintModuleTokensResponse") +} + +var _ protoreflect.Message = (*fastReflection_MsgMintModuleTokensResponse)(nil) + +type fastReflection_MsgMintModuleTokensResponse MsgMintModuleTokensResponse + +func (x *MsgMintModuleTokensResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgMintModuleTokensResponse)(x) +} + +func (x *MsgMintModuleTokensResponse) slowProtoReflect() protoreflect.Message { + mi := &file_cosmos_crosschain_v1_tx_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_MsgMintModuleTokensResponse_messageType fastReflection_MsgMintModuleTokensResponse_messageType +var _ protoreflect.MessageType = fastReflection_MsgMintModuleTokensResponse_messageType{} + +type fastReflection_MsgMintModuleTokensResponse_messageType struct{} + +func (x fastReflection_MsgMintModuleTokensResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgMintModuleTokensResponse)(nil) +} +func (x fastReflection_MsgMintModuleTokensResponse_messageType) New() protoreflect.Message { + return new(fastReflection_MsgMintModuleTokensResponse) +} +func (x fastReflection_MsgMintModuleTokensResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgMintModuleTokensResponse +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgMintModuleTokensResponse) Descriptor() protoreflect.MessageDescriptor { + return md_MsgMintModuleTokensResponse +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_MsgMintModuleTokensResponse) Type() protoreflect.MessageType { + return _fastReflection_MsgMintModuleTokensResponse_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgMintModuleTokensResponse) New() protoreflect.Message { + return new(fastReflection_MsgMintModuleTokensResponse) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgMintModuleTokensResponse) Interface() protoreflect.ProtoMessage { + return (*MsgMintModuleTokensResponse)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_MsgMintModuleTokensResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_MsgMintModuleTokensResponse) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.crosschain.v1.MsgMintModuleTokensResponse")) + } + panic(fmt.Errorf("message cosmos.crosschain.v1.MsgMintModuleTokensResponse does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgMintModuleTokensResponse) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.crosschain.v1.MsgMintModuleTokensResponse")) + } + panic(fmt.Errorf("message cosmos.crosschain.v1.MsgMintModuleTokensResponse does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_MsgMintModuleTokensResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.crosschain.v1.MsgMintModuleTokensResponse")) + } + panic(fmt.Errorf("message cosmos.crosschain.v1.MsgMintModuleTokensResponse does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgMintModuleTokensResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.crosschain.v1.MsgMintModuleTokensResponse")) + } + panic(fmt.Errorf("message cosmos.crosschain.v1.MsgMintModuleTokensResponse does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgMintModuleTokensResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.crosschain.v1.MsgMintModuleTokensResponse")) + } + panic(fmt.Errorf("message cosmos.crosschain.v1.MsgMintModuleTokensResponse does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_MsgMintModuleTokensResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.crosschain.v1.MsgMintModuleTokensResponse")) + } + panic(fmt.Errorf("message cosmos.crosschain.v1.MsgMintModuleTokensResponse does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_MsgMintModuleTokensResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in cosmos.crosschain.v1.MsgMintModuleTokensResponse", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_MsgMintModuleTokensResponse) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgMintModuleTokensResponse) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_MsgMintModuleTokensResponse) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_MsgMintModuleTokensResponse) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgMintModuleTokensResponse) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*MsgMintModuleTokensResponse) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*MsgMintModuleTokensResponse) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + 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++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgMintModuleTokensResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgMintModuleTokensResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + // Since: cosmos-sdk 0.47 // Code generated by protoc-gen-go. DO NOT EDIT. @@ -1950,6 +2790,82 @@ func (*MsgUpdateChannelPermissionsResponse) Descriptor() ([]byte, []int) { return file_cosmos_crosschain_v1_tx_proto_rawDescGZIP(), []int{3} } +// MsgMintModuleTokens is the Msg/MintModuleTokens request type. +// The Msg is used to mint tokens for the crosschain module. +// This Only permitted to be called by the authority(gov). +type MsgMintModuleTokens struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // 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"` + // initial balance to mint for crosschain module when the chain starts + Amount string `protobuf:"bytes,2,opt,name=amount,proto3" json:"amount,omitempty"` +} + +func (x *MsgMintModuleTokens) Reset() { + *x = MsgMintModuleTokens{} + if protoimpl.UnsafeEnabled { + mi := &file_cosmos_crosschain_v1_tx_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgMintModuleTokens) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgMintModuleTokens) ProtoMessage() {} + +// Deprecated: Use MsgMintModuleTokens.ProtoReflect.Descriptor instead. +func (*MsgMintModuleTokens) Descriptor() ([]byte, []int) { + return file_cosmos_crosschain_v1_tx_proto_rawDescGZIP(), []int{4} +} + +func (x *MsgMintModuleTokens) GetAuthority() string { + if x != nil { + return x.Authority + } + return "" +} + +func (x *MsgMintModuleTokens) GetAmount() string { + if x != nil { + return x.Amount + } + return "" +} + +// MsgMintModuleTokensResponse defines the response structure for executing a +// MsgMintModuleTokens message. +type MsgMintModuleTokensResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *MsgMintModuleTokensResponse) Reset() { + *x = MsgMintModuleTokensResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_cosmos_crosschain_v1_tx_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgMintModuleTokensResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgMintModuleTokensResponse) ProtoMessage() {} + +// Deprecated: Use MsgMintModuleTokensResponse.ProtoReflect.Descriptor instead. +func (*MsgMintModuleTokensResponse) Descriptor() ([]byte, []int) { + return file_cosmos_crosschain_v1_tx_proto_rawDescGZIP(), []int{5} +} + var File_cosmos_crosschain_v1_tx_proto protoreflect.FileDescriptor var file_cosmos_crosschain_v1_tx_proto_rawDesc = []byte{ @@ -1990,36 +2906,56 @@ var file_cosmos_crosschain_v1_tx_proto_rawDesc = []byte{ 0x6f, 0x6e, 0x73, 0x3a, 0x0e, 0x82, 0xe7, 0xb0, 0x2a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x22, 0x25, 0x0a, 0x23, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x50, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, - 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0xfd, 0x01, 0x0a, 0x03, 0x4d, - 0x73, 0x67, 0x12, 0x64, 0x0a, 0x0c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, - 0x6d, 0x73, 0x12, 0x25, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x63, 0x72, 0x6f, 0x73, - 0x73, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, - 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x1a, 0x2d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, + 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0xa0, 0x01, 0x0a, 0x13, 0x4d, + 0x73, 0x67, 0x4d, 0x69, 0x6e, 0x74, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x54, 0x6f, 0x6b, 0x65, + 0x6e, 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, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, + 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x12, 0x41, 0x0a, 0x06, 0x61, 0x6d, + 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x29, 0xc8, 0xde, 0x1f, 0x00, + 0xda, 0xde, 0x1f, 0x15, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, + 0x2f, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x49, 0x6e, 0x74, 0xd2, 0xb4, 0x2d, 0x08, 0x6d, 0x61, 0x74, + 0x68, 0x2e, 0x49, 0x6e, 0x74, 0x52, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x3a, 0x0e, 0x82, + 0xe7, 0xb0, 0x2a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x22, 0x1d, 0x0a, + 0x1b, 0x4d, 0x73, 0x67, 0x4d, 0x69, 0x6e, 0x74, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x54, 0x6f, + 0x6b, 0x65, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0xef, 0x02, 0x0a, + 0x03, 0x4d, 0x73, 0x67, 0x12, 0x64, 0x0a, 0x0c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, + 0x72, 0x61, 0x6d, 0x73, 0x12, 0x25, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x63, 0x72, + 0x6f, 0x73, 0x73, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x55, + 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x1a, 0x2d, 0x2e, 0x63, 0x6f, + 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x63, 0x72, 0x6f, 0x73, 0x73, 0x63, 0x68, 0x61, 0x69, 0x6e, 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, 0x88, 0x01, 0x0a, 0x18, 0x55, + 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x50, 0x65, 0x72, 0x6d, + 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x31, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, + 0x2e, 0x63, 0x72, 0x6f, 0x73, 0x73, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x4d, + 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x50, + 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x1a, 0x39, 0x2e, 0x63, 0x6f, 0x73, + 0x6d, 0x6f, 0x73, 0x2e, 0x63, 0x72, 0x6f, 0x73, 0x73, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x2e, 0x76, + 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, 0x68, 0x61, 0x6e, 0x6e, + 0x65, 0x6c, 0x50, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x70, 0x0a, 0x10, 0x4d, 0x69, 0x6e, 0x74, 0x4d, 0x6f, 0x64, + 0x75, 0x6c, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x12, 0x29, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x63, 0x72, 0x6f, 0x73, 0x73, 0x63, 0x68, 0x61, 0x69, 0x6e, 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, 0x88, 0x01, 0x0a, 0x18, 0x55, 0x70, 0x64, - 0x61, 0x74, 0x65, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x50, 0x65, 0x72, 0x6d, 0x69, 0x73, - 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x31, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x63, - 0x72, 0x6f, 0x73, 0x73, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, - 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x50, 0x65, 0x72, - 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x1a, 0x39, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, - 0x73, 0x2e, 0x63, 0x72, 0x6f, 0x73, 0x73, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x2e, 0x76, 0x31, 0x2e, - 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, - 0x50, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x1a, 0x05, 0x80, 0xe7, 0xb0, 0x2a, 0x01, 0x42, 0xc9, 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, 0x07, 0x54, 0x78, 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, 0x4d, 0x73, 0x67, 0x4d, 0x69, 0x6e, 0x74, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x54, 0x6f, + 0x6b, 0x65, 0x6e, 0x73, 0x1a, 0x31, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x63, 0x72, + 0x6f, 0x73, 0x73, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x4d, + 0x69, 0x6e, 0x74, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x1a, 0x05, 0x80, 0xe7, 0xb0, 0x2a, 0x01, 0x42, 0xc9, + 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, 0x07, 0x54, 0x78, 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 ( @@ -2034,24 +2970,28 @@ func file_cosmos_crosschain_v1_tx_proto_rawDescGZIP() []byte { return file_cosmos_crosschain_v1_tx_proto_rawDescData } -var file_cosmos_crosschain_v1_tx_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_cosmos_crosschain_v1_tx_proto_msgTypes = make([]protoimpl.MessageInfo, 6) var file_cosmos_crosschain_v1_tx_proto_goTypes = []interface{}{ (*MsgUpdateParams)(nil), // 0: cosmos.crosschain.v1.MsgUpdateParams (*MsgUpdateParamsResponse)(nil), // 1: cosmos.crosschain.v1.MsgUpdateParamsResponse (*MsgUpdateChannelPermissions)(nil), // 2: cosmos.crosschain.v1.MsgUpdateChannelPermissions (*MsgUpdateChannelPermissionsResponse)(nil), // 3: cosmos.crosschain.v1.MsgUpdateChannelPermissionsResponse - (*Params)(nil), // 4: cosmos.crosschain.v1.Params - (*ChannelPermission)(nil), // 5: cosmos.crosschain.v1.ChannelPermission + (*MsgMintModuleTokens)(nil), // 4: cosmos.crosschain.v1.MsgMintModuleTokens + (*MsgMintModuleTokensResponse)(nil), // 5: cosmos.crosschain.v1.MsgMintModuleTokensResponse + (*Params)(nil), // 6: cosmos.crosschain.v1.Params + (*ChannelPermission)(nil), // 7: cosmos.crosschain.v1.ChannelPermission } var file_cosmos_crosschain_v1_tx_proto_depIdxs = []int32{ - 4, // 0: cosmos.crosschain.v1.MsgUpdateParams.params:type_name -> cosmos.crosschain.v1.Params - 5, // 1: cosmos.crosschain.v1.MsgUpdateChannelPermissions.channel_permissions:type_name -> cosmos.crosschain.v1.ChannelPermission + 6, // 0: cosmos.crosschain.v1.MsgUpdateParams.params:type_name -> cosmos.crosschain.v1.Params + 7, // 1: cosmos.crosschain.v1.MsgUpdateChannelPermissions.channel_permissions:type_name -> cosmos.crosschain.v1.ChannelPermission 0, // 2: cosmos.crosschain.v1.Msg.UpdateParams:input_type -> cosmos.crosschain.v1.MsgUpdateParams 2, // 3: cosmos.crosschain.v1.Msg.UpdateChannelPermissions:input_type -> cosmos.crosschain.v1.MsgUpdateChannelPermissions - 1, // 4: cosmos.crosschain.v1.Msg.UpdateParams:output_type -> cosmos.crosschain.v1.MsgUpdateParamsResponse - 3, // 5: cosmos.crosschain.v1.Msg.UpdateChannelPermissions:output_type -> cosmos.crosschain.v1.MsgUpdateChannelPermissionsResponse - 4, // [4:6] is the sub-list for method output_type - 2, // [2:4] is the sub-list for method input_type + 4, // 4: cosmos.crosschain.v1.Msg.MintModuleTokens:input_type -> cosmos.crosschain.v1.MsgMintModuleTokens + 1, // 5: cosmos.crosschain.v1.Msg.UpdateParams:output_type -> cosmos.crosschain.v1.MsgUpdateParamsResponse + 3, // 6: cosmos.crosschain.v1.Msg.UpdateChannelPermissions:output_type -> cosmos.crosschain.v1.MsgUpdateChannelPermissionsResponse + 5, // 7: cosmos.crosschain.v1.Msg.MintModuleTokens:output_type -> cosmos.crosschain.v1.MsgMintModuleTokensResponse + 5, // [5:8] is the sub-list for method output_type + 2, // [2:5] is the sub-list for method input_type 2, // [2:2] is the sub-list for extension type_name 2, // [2:2] is the sub-list for extension extendee 0, // [0:2] is the sub-list for field type_name @@ -2112,6 +3052,30 @@ func file_cosmos_crosschain_v1_tx_proto_init() { return nil } } + file_cosmos_crosschain_v1_tx_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgMintModuleTokens); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_cosmos_crosschain_v1_tx_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgMintModuleTokensResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } } type x struct{} out := protoimpl.TypeBuilder{ @@ -2119,7 +3083,7 @@ func file_cosmos_crosschain_v1_tx_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_cosmos_crosschain_v1_tx_proto_rawDesc, NumEnums: 0, - NumMessages: 4, + NumMessages: 6, NumExtensions: 0, NumServices: 1, }, diff --git a/api/cosmos/crosschain/v1/tx_grpc.pb.go b/api/cosmos/crosschain/v1/tx_grpc.pb.go index b057fc59a1..0e979e5dd5 100644 --- a/api/cosmos/crosschain/v1/tx_grpc.pb.go +++ b/api/cosmos/crosschain/v1/tx_grpc.pb.go @@ -23,6 +23,7 @@ const _ = grpc.SupportPackageIsVersion7 const ( Msg_UpdateParams_FullMethodName = "/cosmos.crosschain.v1.Msg/UpdateParams" Msg_UpdateChannelPermissions_FullMethodName = "/cosmos.crosschain.v1.Msg/UpdateChannelPermissions" + Msg_MintModuleTokens_FullMethodName = "/cosmos.crosschain.v1.Msg/MintModuleTokens" ) // MsgClient is the client API for Msg service. @@ -37,6 +38,9 @@ type MsgClient interface { // UpdateChannelPermissions defines a governance operation for updating the channel permissions. // The authority is defined in the keeper. UpdateChannelPermissions(ctx context.Context, in *MsgUpdateChannelPermissions, opts ...grpc.CallOption) (*MsgUpdateChannelPermissionsResponse, error) + // MintModuleTokens defines a governance operation for minting tokens for the crosschain module. + // The authority is defined in the keeper. + MintModuleTokens(ctx context.Context, in *MsgMintModuleTokens, opts ...grpc.CallOption) (*MsgMintModuleTokensResponse, error) } type msgClient struct { @@ -65,6 +69,15 @@ func (c *msgClient) UpdateChannelPermissions(ctx context.Context, in *MsgUpdateC return out, nil } +func (c *msgClient) MintModuleTokens(ctx context.Context, in *MsgMintModuleTokens, opts ...grpc.CallOption) (*MsgMintModuleTokensResponse, error) { + out := new(MsgMintModuleTokensResponse) + err := c.cc.Invoke(ctx, Msg_MintModuleTokens_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // MsgServer is the server API for Msg service. // All implementations must embed UnimplementedMsgServer // for forward compatibility @@ -77,6 +90,9 @@ type MsgServer interface { // UpdateChannelPermissions defines a governance operation for updating the channel permissions. // The authority is defined in the keeper. UpdateChannelPermissions(context.Context, *MsgUpdateChannelPermissions) (*MsgUpdateChannelPermissionsResponse, error) + // MintModuleTokens defines a governance operation for minting tokens for the crosschain module. + // The authority is defined in the keeper. + MintModuleTokens(context.Context, *MsgMintModuleTokens) (*MsgMintModuleTokensResponse, error) mustEmbedUnimplementedMsgServer() } @@ -90,6 +106,9 @@ func (UnimplementedMsgServer) UpdateParams(context.Context, *MsgUpdateParams) (* func (UnimplementedMsgServer) UpdateChannelPermissions(context.Context, *MsgUpdateChannelPermissions) (*MsgUpdateChannelPermissionsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method UpdateChannelPermissions not implemented") } +func (UnimplementedMsgServer) MintModuleTokens(context.Context, *MsgMintModuleTokens) (*MsgMintModuleTokensResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method MintModuleTokens not implemented") +} func (UnimplementedMsgServer) mustEmbedUnimplementedMsgServer() {} // UnsafeMsgServer may be embedded to opt out of forward compatibility for this service. @@ -139,6 +158,24 @@ func _Msg_UpdateChannelPermissions_Handler(srv interface{}, ctx context.Context, return interceptor(ctx, in, info, handler) } +func _Msg_MintModuleTokens_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgMintModuleTokens) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).MintModuleTokens(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Msg_MintModuleTokens_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).MintModuleTokens(ctx, req.(*MsgMintModuleTokens)) + } + return interceptor(ctx, in, info, handler) +} + // Msg_ServiceDesc is the grpc.ServiceDesc for Msg service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) @@ -154,6 +191,10 @@ var Msg_ServiceDesc = grpc.ServiceDesc{ MethodName: "UpdateChannelPermissions", Handler: _Msg_UpdateChannelPermissions_Handler, }, + { + MethodName: "MintModuleTokens", + Handler: _Msg_MintModuleTokens_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "cosmos/crosschain/v1/tx.proto", diff --git a/proto/cosmos/crosschain/v1/tx.proto b/proto/cosmos/crosschain/v1/tx.proto index 5b352858d2..923dbd533b 100644 --- a/proto/cosmos/crosschain/v1/tx.proto +++ b/proto/cosmos/crosschain/v1/tx.proto @@ -23,6 +23,10 @@ service Msg { // UpdateChannelPermissions defines a governance operation for updating the channel permissions. // The authority is defined in the keeper. rpc UpdateChannelPermissions(MsgUpdateChannelPermissions) returns (MsgUpdateChannelPermissionsResponse); + + // MintModuleTokens defines a governance operation for minting tokens for the crosschain module. + // The authority is defined in the keeper. + rpc MintModuleTokens(MsgMintModuleTokens) returns (MsgMintModuleTokensResponse); } // MsgUpdateParams is the Msg/UpdateParams request type. @@ -55,4 +59,25 @@ message MsgUpdateChannelPermissions { // MsgUpdateChannelPermissionsResponse defines the response structure for executing a // MsgUpdateChannelPermissions message. -message MsgUpdateChannelPermissionsResponse {} \ No newline at end of file +message MsgUpdateChannelPermissionsResponse {} + +// MsgMintModuleTokens is the Msg/MintModuleTokens request type. +// The Msg is used to mint tokens for the crosschain module. +// This Only permitted to be called by the authority(gov). +message MsgMintModuleTokens { + option (cosmos.msg.v1.signer) = "authority"; + + // authority is the address that controls the module (defaults to x/gov unless overwritten). + string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + + // initial balance to mint for crosschain module when the chain starts + string amount = 2 [ + (cosmos_proto.scalar) = "math.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", + (gogoproto.nullable) = false + ]; +} + +// MsgMintModuleTokensResponse defines the response structure for executing a +// MsgMintModuleTokens message. +message MsgMintModuleTokensResponse {} \ No newline at end of file diff --git a/x/crosschain/keeper/keeper.go b/x/crosschain/keeper/keeper.go index a7944568e6..d0966e80b5 100644 --- a/x/crosschain/keeper/keeper.go +++ b/x/crosschain/keeper/keeper.go @@ -6,6 +6,7 @@ import ( "fmt" "math/big" + "cosmossdk.io/math" "github.com/cometbft/cometbft/libs/log" "github.com/cosmos/cosmos-sdk/codec" @@ -22,17 +23,24 @@ type Keeper struct { storeKey storetypes.StoreKey authority string + + stakingKeeper types.StakingKeeper + bankKeeper types.BankKeeper } // NewKeeper creates a new mint Keeper instance func NewKeeper( cdc codec.BinaryCodec, key storetypes.StoreKey, authority string, + stakingKeeper types.StakingKeeper, + bankKeeper types.BankKeeper, ) Keeper { return Keeper{ - cdc: cdc, - storeKey: key, - cfg: newCrossChainCfg(), - authority: authority, + cdc: cdc, + storeKey: key, + cfg: newCrossChainCfg(), + authority: authority, + stakingKeeper: stakingKeeper, + bankKeeper: bankKeeper, } } @@ -293,3 +301,15 @@ func (k Keeper) incrSequence(ctx sdk.Context, destChainID sdk.ChainID, channelID func (k Keeper) GetCrossChainApp(channelID sdk.ChannelID) sdk.CrossChainApplication { return k.cfg.channelIDToApp[channelID] } + +func (k Keeper) MintModuleAccountTokens(ctx sdk.Context, amount math.Int) error { + bondDenom := k.stakingKeeper.BondDenom(ctx) + err := k.bankKeeper.MintCoins(ctx, types.ModuleName, sdk.Coins{sdk.Coin{ + Denom: bondDenom, + Amount: amount, + }}) + if err != nil { + return fmt.Errorf("mint cross chain module amount error, err=%s", err.Error()) + } + return nil +} diff --git a/x/crosschain/keeper/keeper_test.go b/x/crosschain/keeper/keeper_test.go index f77243a02a..ed30d11a38 100644 --- a/x/crosschain/keeper/keeper_test.go +++ b/x/crosschain/keeper/keeper_test.go @@ -3,6 +3,9 @@ package keeper_test import ( "testing" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/suite" + "github.com/cosmos/cosmos-sdk/baseapp" storetypes "github.com/cosmos/cosmos-sdk/store/types" "github.com/cosmos/cosmos-sdk/testutil" @@ -12,8 +15,8 @@ import ( "github.com/cosmos/cosmos-sdk/x/crosschain/keeper" testutil2 "github.com/cosmos/cosmos-sdk/x/crosschain/testutil" "github.com/cosmos/cosmos-sdk/x/crosschain/types" + govtestutil "github.com/cosmos/cosmos-sdk/x/gov/testutil" "github.com/cosmos/cosmos-sdk/x/mint" - "github.com/stretchr/testify/suite" ) type TestSuite struct { @@ -31,11 +34,16 @@ func (s *TestSuite) SetupTest() { key := storetypes.NewKVStoreKey(types.StoreKey) testCtx := testutil.DefaultContextWithDB(s.T(), key, storetypes.NewTransientStoreKey("transient_test")) s.ctx = testCtx.Ctx - + // gomock initializations + ctrl := gomock.NewController(s.T()) + bankKeeper := govtestutil.NewMockBankKeeper(ctrl) + stakingKeeper := govtestutil.NewMockStakingKeeper(ctrl) s.crossChainKeeper = keeper.NewKeeper( encCfg.Codec, key, authtypes.NewModuleAddress(types.ModuleName).String(), + stakingKeeper, + bankKeeper, ) err := s.crossChainKeeper.SetParams(s.ctx, types.DefaultParams()) diff --git a/x/crosschain/keeper/msg_server.go b/x/crosschain/keeper/msg_server.go index 695a9ff36a..952a6db404 100644 --- a/x/crosschain/keeper/msg_server.go +++ b/x/crosschain/keeper/msg_server.go @@ -46,3 +46,16 @@ func (k msgServer) UpdateChannelPermissions(goCtx context.Context, req *types.Ms return &types.MsgUpdateChannelPermissionsResponse{}, nil } + +func (k msgServer) MintModuleTokens(goCtx context.Context, req *types.MsgMintModuleTokens) (*types.MsgMintModuleTokensResponse, error) { + if k.GetAuthority() != req.Authority { + return nil, errorsmod.Wrapf(govtypes.ErrInvalidSigner, "invalid authority; expected %s, got %s", k.GetAuthority(), req.Authority) + } + + ctx := sdk.UnwrapSDKContext(goCtx) + if err := k.MintModuleAccountTokens(ctx, req.Amount); err != nil { + return nil, err + } + + return &types.MsgMintModuleTokensResponse{}, nil +} diff --git a/x/crosschain/module.go b/x/crosschain/module.go index c6d152c2a2..cf9ed8687e 100644 --- a/x/crosschain/module.go +++ b/x/crosschain/module.go @@ -178,6 +178,8 @@ func ProvideModule(in CrossChainInputs) CrossChainOutputs { in.Cdc, in.Key, authority.String(), + in.StakingKeeper, + in.BankKeeper, ) m := NewAppModule(k, in.BankKeeper, in.StakingKeeper) diff --git a/x/crosschain/types/msgs.go b/x/crosschain/types/msgs.go index ac9685fffd..b00778521e 100644 --- a/x/crosschain/types/msgs.go +++ b/x/crosschain/types/msgs.go @@ -7,7 +7,11 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" ) -var _ sdk.Msg = &MsgUpdateParams{} +var ( + _ sdk.Msg = &MsgUpdateParams{} + _ sdk.Msg = &MsgUpdateChannelPermissions{} + _ sdk.Msg = &MsgMintModuleTokens{} +) // GetSignBytes implements the LegacyMsg interface. func (m MsgUpdateParams) GetSignBytes() []byte { @@ -58,3 +62,27 @@ func (m *MsgUpdateChannelPermissions) ValidateBasic() error { return nil } + +// GetSignBytes implements the LegacyMsg interface. +func (m MsgMintModuleTokens) GetSignBytes() []byte { + return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&m)) +} + +// GetSigners returns the expected signers for a MsgMintModuleTokens message. +func (m *MsgMintModuleTokens) GetSigners() []sdk.AccAddress { + addr, _ := sdk.AccAddressFromHexUnsafe(m.Authority) + return []sdk.AccAddress{addr} +} + +// ValidateBasic does a sanity check on the provided data. +func (m *MsgMintModuleTokens) ValidateBasic() error { + if _, err := sdk.AccAddressFromHexUnsafe(m.Authority); err != nil { + return errorsmod.Wrap(err, "invalid authority address") + } + + if m.Amount.LTE(sdk.ZeroInt()) { + return fmt.Errorf("amount must be positive, is %s", m.Amount) + } + + return nil +} diff --git a/x/crosschain/types/tx.pb.go b/x/crosschain/types/tx.pb.go index 58cb953942..c410439662 100644 --- a/x/crosschain/types/tx.pb.go +++ b/x/crosschain/types/tx.pb.go @@ -5,6 +5,7 @@ package types import ( context "context" + cosmossdk_io_math "cosmossdk.io/math" fmt "fmt" _ "github.com/cosmos/cosmos-proto" _ "github.com/cosmos/cosmos-sdk/types/msgservice" @@ -219,17 +220,107 @@ func (m *MsgUpdateChannelPermissionsResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgUpdateChannelPermissionsResponse proto.InternalMessageInfo +// MsgMintModuleTokens is the Msg/MintModuleTokens request type. +// The Msg is used to mint tokens for the crosschain module. +// This Only permitted to be called by the authority(gov). +type MsgMintModuleTokens 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"` + // initial balance to mint for crosschain module when the chain starts + Amount cosmossdk_io_math.Int `protobuf:"bytes,2,opt,name=amount,proto3,customtype=cosmossdk.io/math.Int" json:"amount"` +} + +func (m *MsgMintModuleTokens) Reset() { *m = MsgMintModuleTokens{} } +func (m *MsgMintModuleTokens) String() string { return proto.CompactTextString(m) } +func (*MsgMintModuleTokens) ProtoMessage() {} +func (*MsgMintModuleTokens) Descriptor() ([]byte, []int) { + return fileDescriptor_bdb806a4c5354501, []int{4} +} +func (m *MsgMintModuleTokens) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgMintModuleTokens) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgMintModuleTokens.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgMintModuleTokens) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgMintModuleTokens.Merge(m, src) +} +func (m *MsgMintModuleTokens) XXX_Size() int { + return m.Size() +} +func (m *MsgMintModuleTokens) XXX_DiscardUnknown() { + xxx_messageInfo_MsgMintModuleTokens.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgMintModuleTokens proto.InternalMessageInfo + +func (m *MsgMintModuleTokens) GetAuthority() string { + if m != nil { + return m.Authority + } + return "" +} + +// MsgMintModuleTokensResponse defines the response structure for executing a +// MsgMintModuleTokens message. +type MsgMintModuleTokensResponse struct { +} + +func (m *MsgMintModuleTokensResponse) Reset() { *m = MsgMintModuleTokensResponse{} } +func (m *MsgMintModuleTokensResponse) String() string { return proto.CompactTextString(m) } +func (*MsgMintModuleTokensResponse) ProtoMessage() {} +func (*MsgMintModuleTokensResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_bdb806a4c5354501, []int{5} +} +func (m *MsgMintModuleTokensResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgMintModuleTokensResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgMintModuleTokensResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgMintModuleTokensResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgMintModuleTokensResponse.Merge(m, src) +} +func (m *MsgMintModuleTokensResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgMintModuleTokensResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgMintModuleTokensResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgMintModuleTokensResponse proto.InternalMessageInfo + func init() { proto.RegisterType((*MsgUpdateParams)(nil), "cosmos.crosschain.v1.MsgUpdateParams") proto.RegisterType((*MsgUpdateParamsResponse)(nil), "cosmos.crosschain.v1.MsgUpdateParamsResponse") proto.RegisterType((*MsgUpdateChannelPermissions)(nil), "cosmos.crosschain.v1.MsgUpdateChannelPermissions") proto.RegisterType((*MsgUpdateChannelPermissionsResponse)(nil), "cosmos.crosschain.v1.MsgUpdateChannelPermissionsResponse") + proto.RegisterType((*MsgMintModuleTokens)(nil), "cosmos.crosschain.v1.MsgMintModuleTokens") + proto.RegisterType((*MsgMintModuleTokensResponse)(nil), "cosmos.crosschain.v1.MsgMintModuleTokensResponse") } func init() { proto.RegisterFile("cosmos/crosschain/v1/tx.proto", fileDescriptor_bdb806a4c5354501) } var fileDescriptor_bdb806a4c5354501 = []byte{ - // 422 bytes of a gzipped FileDescriptorProto + // 522 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4d, 0xce, 0x2f, 0xce, 0xcd, 0x2f, 0xd6, 0x4f, 0x2e, 0xca, 0x2f, 0x2e, 0x4e, 0xce, 0x48, 0xcc, 0xcc, 0xd3, 0x2f, 0x33, 0xd4, 0x2f, 0xa9, 0xd0, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x81, 0x48, 0xeb, 0x21, 0xa4, @@ -248,15 +339,21 @@ var fileDescriptor_bdb806a4c5354501 = []byte{ 0x9a, 0x13, 0x90, 0x5a, 0x94, 0x9b, 0x59, 0x5c, 0x9c, 0x99, 0x9f, 0x47, 0xbe, 0x1f, 0x22, 0xb8, 0x84, 0x93, 0x21, 0xa6, 0xc5, 0x17, 0x20, 0x8c, 0x93, 0x60, 0x52, 0x60, 0xd6, 0xe0, 0x36, 0x52, 0xc7, 0xee, 0x21, 0x0c, 0xeb, 0x83, 0x84, 0x92, 0x31, 0x5c, 0x84, 0xe1, 0x39, 0x55, 0x2e, 0x65, - 0x3c, 0x1e, 0x80, 0x79, 0xd4, 0xe8, 0x2f, 0x23, 0x17, 0xb3, 0x6f, 0x71, 0xba, 0x50, 0x0a, 0x17, - 0x0f, 0x4a, 0x24, 0xa9, 0x62, 0x77, 0x0b, 0x5a, 0x78, 0x49, 0xe9, 0x12, 0xa5, 0x0c, 0x66, 0x9b, - 0x50, 0x07, 0x23, 0x97, 0x04, 0xce, 0x30, 0x35, 0x24, 0x60, 0x16, 0xa6, 0x16, 0x29, 0x4b, 0x92, - 0xb5, 0xc0, 0x9c, 0x22, 0xc5, 0xda, 0x00, 0x4a, 0x1b, 0x4e, 0x9e, 0x27, 0x1e, 0xc9, 0x31, 0x5e, - 0x78, 0x24, 0xc7, 0xf8, 0xe0, 0x91, 0x1c, 0xe3, 0x84, 0xc7, 0x72, 0x0c, 0x17, 0x1e, 0xcb, 0x31, - 0xdc, 0x78, 0x2c, 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29, 0x05, 0x5c, 0x02, 0x18, 0xd1, 0xa6, 0x89, 0xd3, 0x38, 0x74, 0xa5, + 0x52, 0x86, 0x44, 0x2b, 0x85, 0xd9, 0x28, 0xc5, 0xda, 0x00, 0xca, 0x4f, 0x4e, 0x9e, 0x27, 0x1e, + 0xc9, 0x31, 0x5e, 0x78, 0x24, 0xc7, 0xf8, 0xe0, 0x91, 0x1c, 0xe3, 0x84, 0xc7, 0x72, 0x0c, 0x17, + 0x1e, 0xcb, 0x31, 0xdc, 0x78, 0x2c, 0xc7, 0x10, 0xa5, 0x9f, 0x9e, 0x59, 0x92, 0x51, 0x9a, 0xa4, + 0x97, 0x9c, 0x9f, 0xab, 0x0f, 0x2b, 0x49, 0xc0, 0x94, 0x6e, 0x71, 0x4a, 0xb6, 0x7e, 0x05, 0x72, + 0xb1, 0x52, 0x52, 0x59, 0x90, 0x5a, 0x9c, 0xc4, 0x06, 0x2e, 0x26, 0x8c, 0x01, 0x01, 0x00, 0x00, + 0xff, 0xff, 0x30, 0xf1, 0xad, 0x12, 0xe1, 0x04, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -279,6 +376,9 @@ type MsgClient interface { // UpdateChannelPermissions defines a governance operation for updating the channel permissions. // The authority is defined in the keeper. UpdateChannelPermissions(ctx context.Context, in *MsgUpdateChannelPermissions, opts ...grpc.CallOption) (*MsgUpdateChannelPermissionsResponse, error) + // MintModuleTokens defines a governance operation for minting tokens for the crosschain module. + // The authority is defined in the keeper. + MintModuleTokens(ctx context.Context, in *MsgMintModuleTokens, opts ...grpc.CallOption) (*MsgMintModuleTokensResponse, error) } type msgClient struct { @@ -307,6 +407,15 @@ func (c *msgClient) UpdateChannelPermissions(ctx context.Context, in *MsgUpdateC return out, nil } +func (c *msgClient) MintModuleTokens(ctx context.Context, in *MsgMintModuleTokens, opts ...grpc.CallOption) (*MsgMintModuleTokensResponse, error) { + out := new(MsgMintModuleTokensResponse) + err := c.cc.Invoke(ctx, "/cosmos.crosschain.v1.Msg/MintModuleTokens", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // MsgServer is the server API for Msg service. type MsgServer interface { // UpdateParams defines a governance operation for updating the x/crosschain module parameters. @@ -317,6 +426,9 @@ type MsgServer interface { // UpdateChannelPermissions defines a governance operation for updating the channel permissions. // The authority is defined in the keeper. UpdateChannelPermissions(context.Context, *MsgUpdateChannelPermissions) (*MsgUpdateChannelPermissionsResponse, error) + // MintModuleTokens defines a governance operation for minting tokens for the crosschain module. + // The authority is defined in the keeper. + MintModuleTokens(context.Context, *MsgMintModuleTokens) (*MsgMintModuleTokensResponse, error) } // UnimplementedMsgServer can be embedded to have forward compatible implementations. @@ -329,6 +441,9 @@ func (*UnimplementedMsgServer) UpdateParams(ctx context.Context, req *MsgUpdateP func (*UnimplementedMsgServer) UpdateChannelPermissions(ctx context.Context, req *MsgUpdateChannelPermissions) (*MsgUpdateChannelPermissionsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method UpdateChannelPermissions not implemented") } +func (*UnimplementedMsgServer) MintModuleTokens(ctx context.Context, req *MsgMintModuleTokens) (*MsgMintModuleTokensResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method MintModuleTokens not implemented") +} func RegisterMsgServer(s grpc1.Server, srv MsgServer) { s.RegisterService(&_Msg_serviceDesc, srv) @@ -370,6 +485,24 @@ func _Msg_UpdateChannelPermissions_Handler(srv interface{}, ctx context.Context, return interceptor(ctx, in, info, handler) } +func _Msg_MintModuleTokens_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgMintModuleTokens) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).MintModuleTokens(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmos.crosschain.v1.Msg/MintModuleTokens", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).MintModuleTokens(ctx, req.(*MsgMintModuleTokens)) + } + return interceptor(ctx, in, info, handler) +} + var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "cosmos.crosschain.v1.Msg", HandlerType: (*MsgServer)(nil), @@ -382,6 +515,10 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "UpdateChannelPermissions", Handler: _Msg_UpdateChannelPermissions_Handler, }, + { + MethodName: "MintModuleTokens", + Handler: _Msg_MintModuleTokens_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "cosmos/crosschain/v1/tx.proto", @@ -517,6 +654,69 @@ func (m *MsgUpdateChannelPermissionsResponse) MarshalToSizedBuffer(dAtA []byte) return len(dAtA) - i, nil } +func (m *MsgMintModuleTokens) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgMintModuleTokens) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgMintModuleTokens) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size := m.Amount.Size() + i -= size + if _, err := m.Amount.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if len(m.Authority) > 0 { + i -= len(m.Authority) + copy(dAtA[i:], m.Authority) + i = encodeVarintTx(dAtA, i, uint64(len(m.Authority))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgMintModuleTokensResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgMintModuleTokensResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgMintModuleTokensResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + func encodeVarintTx(dAtA []byte, offset int, v uint64) int { offset -= sovTx(v) base := offset @@ -580,6 +780,30 @@ func (m *MsgUpdateChannelPermissionsResponse) Size() (n int) { return n } +func (m *MsgMintModuleTokens) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Authority) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = m.Amount.Size() + n += 1 + l + sovTx(uint64(l)) + return n +} + +func (m *MsgMintModuleTokensResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + func sovTx(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -917,6 +1141,172 @@ func (m *MsgUpdateChannelPermissionsResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *MsgMintModuleTokens) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgMintModuleTokens: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgMintModuleTokens: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Authority = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Amount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgMintModuleTokensResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgMintModuleTokensResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgMintModuleTokensResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipTx(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 From 100db4bb73c4e38547585616e439e5aa33a3dd10 Mon Sep 17 00:00:00 2001 From: dylanhuang Date: Tue, 15 Aug 2023 14:26:19 +0800 Subject: [PATCH 5/9] fix: allow validator delegator from Genesis to be other addresses (#271) --- x/genutil/client/cli/gentx.go | 16 ++++++++-------- x/staking/keeper/msg_server.go | 7 ++++--- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/x/genutil/client/cli/gentx.go b/x/genutil/client/cli/gentx.go index 82b4d04879..cf2ab2e452 100644 --- a/x/genutil/client/cli/gentx.go +++ b/x/genutil/client/cli/gentx.go @@ -33,7 +33,7 @@ func GenTxCmd(mbm module.BasicManager, txEncCfg client.TxEncodingConfig, genBalI fsCreateValidator, defaultsDesc := cli.CreateValidatorMsgFlagSet(ipDefault) cmd := &cobra.Command{ - Use: "gentx [key_name] [amount] [validator] [relayer] [challenger] [blskey] [blsProof]", + Use: "gentx [key_name] [amount] [delegator] [relayer] [challenger] [blskey] [blsProof]", Short: "Generate a genesis tx carrying a self delegation", Args: cobra.ExactArgs(7), Long: fmt.Sprintf(`Generate a genesis transaction that creates a validator with a self-delegation, @@ -128,7 +128,11 @@ $ %s gentx my-key-name 1000000stake \ if err != nil { return err } - err = genutil.ValidateAccountInGenesis(genesisState, genBalIterator, addr, coins, cdc) + delegator, err := sdk.AccAddressFromHexUnsafe(args[2]) + if err != nil { + return err + } + err = genutil.ValidateAccountInGenesis(genesisState, genBalIterator, delegator, coins, cdc) if err != nil { return errors.Wrap(err, "failed to validate account in genesis") } @@ -157,10 +161,6 @@ $ %s gentx my-key-name 1000000stake \ // ref: https://github.com/cosmos/cosmos-sdk/issues/8177 createValCfg.Amount = amount - validator, err := sdk.AccAddressFromHexUnsafe(args[2]) - if err != nil { - return err - } relayer, err := sdk.AccAddressFromHexUnsafe(args[3]) if err != nil { return err @@ -178,8 +178,8 @@ $ %s gentx my-key-name 1000000stake \ return fmt.Errorf("invalid bls proof, len: %d", len(blsProof)) } - createValCfg.Validator = validator - createValCfg.Delegator = addr + createValCfg.Validator = addr + createValCfg.Delegator = delegator createValCfg.Relayer = relayer createValCfg.Challenger = challenger createValCfg.BlsKey = blsPk diff --git a/x/staking/keeper/msg_server.go b/x/staking/keeper/msg_server.go index 4e7d90550e..d3ffe2eb2b 100644 --- a/x/staking/keeper/msg_server.go +++ b/x/staking/keeper/msg_server.go @@ -48,12 +48,13 @@ func (k msgServer) CreateValidator(goCtx context.Context, msg *types.MsgCreateVa return nil, err } - // For genesis block, the signer should be the self delegator itself, - // for other blocks, the signer should be the gov module account. + // For genesis block, the signer can be the validator address itself, + // because the delegator address is more privately key that may not be held by the deployer. + // For other blocks, the signer should be the gov module account. govModuleAddr := k.authKeeper.GetModuleAddress(govtypes.ModuleName) if ctx.BlockHeight() == 0 { signers := msg.GetSigners() - if len(signers) != 1 || !signers[0].Equals(delAddr) { + if len(signers) != 1 || !signers[0].Equals(valAddr) { return nil, types.ErrInvalidSigner } } else { From 5650a026c61980eb89c6703619744efb11ba1780 Mon Sep 17 00:00:00 2001 From: dylanhuang Date: Tue, 15 Aug 2023 18:23:53 +0800 Subject: [PATCH 6/9] Revert "fix: allow validator delegator from Genesis to be other addresses (#271)" (#272) This reverts commit 100db4bb73c4e38547585616e439e5aa33a3dd10. --- x/genutil/client/cli/gentx.go | 16 ++++++++-------- x/staking/keeper/msg_server.go | 7 +++---- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/x/genutil/client/cli/gentx.go b/x/genutil/client/cli/gentx.go index cf2ab2e452..82b4d04879 100644 --- a/x/genutil/client/cli/gentx.go +++ b/x/genutil/client/cli/gentx.go @@ -33,7 +33,7 @@ func GenTxCmd(mbm module.BasicManager, txEncCfg client.TxEncodingConfig, genBalI fsCreateValidator, defaultsDesc := cli.CreateValidatorMsgFlagSet(ipDefault) cmd := &cobra.Command{ - Use: "gentx [key_name] [amount] [delegator] [relayer] [challenger] [blskey] [blsProof]", + Use: "gentx [key_name] [amount] [validator] [relayer] [challenger] [blskey] [blsProof]", Short: "Generate a genesis tx carrying a self delegation", Args: cobra.ExactArgs(7), Long: fmt.Sprintf(`Generate a genesis transaction that creates a validator with a self-delegation, @@ -128,11 +128,7 @@ $ %s gentx my-key-name 1000000stake \ if err != nil { return err } - delegator, err := sdk.AccAddressFromHexUnsafe(args[2]) - if err != nil { - return err - } - err = genutil.ValidateAccountInGenesis(genesisState, genBalIterator, delegator, coins, cdc) + err = genutil.ValidateAccountInGenesis(genesisState, genBalIterator, addr, coins, cdc) if err != nil { return errors.Wrap(err, "failed to validate account in genesis") } @@ -161,6 +157,10 @@ $ %s gentx my-key-name 1000000stake \ // ref: https://github.com/cosmos/cosmos-sdk/issues/8177 createValCfg.Amount = amount + validator, err := sdk.AccAddressFromHexUnsafe(args[2]) + if err != nil { + return err + } relayer, err := sdk.AccAddressFromHexUnsafe(args[3]) if err != nil { return err @@ -178,8 +178,8 @@ $ %s gentx my-key-name 1000000stake \ return fmt.Errorf("invalid bls proof, len: %d", len(blsProof)) } - createValCfg.Validator = addr - createValCfg.Delegator = delegator + createValCfg.Validator = validator + createValCfg.Delegator = addr createValCfg.Relayer = relayer createValCfg.Challenger = challenger createValCfg.BlsKey = blsPk diff --git a/x/staking/keeper/msg_server.go b/x/staking/keeper/msg_server.go index d3ffe2eb2b..4e7d90550e 100644 --- a/x/staking/keeper/msg_server.go +++ b/x/staking/keeper/msg_server.go @@ -48,13 +48,12 @@ func (k msgServer) CreateValidator(goCtx context.Context, msg *types.MsgCreateVa return nil, err } - // For genesis block, the signer can be the validator address itself, - // because the delegator address is more privately key that may not be held by the deployer. - // For other blocks, the signer should be the gov module account. + // For genesis block, the signer should be the self delegator itself, + // for other blocks, the signer should be the gov module account. govModuleAddr := k.authKeeper.GetModuleAddress(govtypes.ModuleName) if ctx.BlockHeight() == 0 { signers := msg.GetSigners() - if len(signers) != 1 || !signers[0].Equals(valAddr) { + if len(signers) != 1 || !signers[0].Equals(delAddr) { return nil, types.ErrInvalidSigner } } else { From db131451854d769c15c35be984ec7a8866dedd15 Mon Sep 17 00:00:00 2001 From: forcodedancing Date: Wed, 16 Aug 2023 09:38:49 +0800 Subject: [PATCH 7/9] feat: track store r/w consume for enabling plain store (#269) * feat: track store r/w consume for enabling plain store * fix test issue * fix some review comments * track begin/end block r/w used * update dependency * fix simapp consensus issue * fix issues * fix test issues --- api/cosmos/base/abci/v1beta1/abci.pulsar.go | 272 +++++++++++++++----- baseapp/abci.go | 4 + baseapp/baseapp.go | 20 +- baseapp/options.go | 5 + go.mod | 2 +- go.sum | 4 +- proto/cosmos/base/abci/v1beta1/abci.proto | 20 +- server/config/config.go | 4 + server/config/toml.go | 6 + server/start.go | 1 + server/util.go | 1 + simapp/app.go | 6 +- simapp/go.mod | 4 +- simapp/go.sum | 10 +- snapshots/types/snapshot.pb.go | 1 - store/gaskv/store.go | 22 +- store/gaskv/store_test.go | 44 ++-- store/rootmulti/store.go | 4 + store/types/gas.go | 45 +++- tests/go.mod | 5 +- tests/go.sum | 10 +- testutil/testdata/unknonwnproto.pb.go | 9 - types/abci.pb.go | 212 ++++++++++----- types/context.go | 7 +- types/query/pagination.pb.go | 16 +- types/tx/signing/signing.pb.go | 1 - types/tx/tx.pb.go | 1 - x/capability/keeper/keeper.go | 2 +- x/distribution/types/distribution.pb.go | 11 +- x/gashub/types/gashub.pb.go | 1 - x/gov/types/v1/gov.pb.go | 12 +- x/group/internal/orm/testsupport.go | 8 + x/group/types.pb.go | 16 +- 33 files changed, 532 insertions(+), 254 deletions(-) diff --git a/api/cosmos/base/abci/v1beta1/abci.pulsar.go b/api/cosmos/base/abci/v1beta1/abci.pulsar.go index d8dd2f368e..d3f6216863 100644 --- a/api/cosmos/base/abci/v1beta1/abci.pulsar.go +++ b/api/cosmos/base/abci/v1beta1/abci.pulsar.go @@ -2955,6 +2955,7 @@ var ( fd_GasInfo_gas_wanted protoreflect.FieldDescriptor fd_GasInfo_gas_used protoreflect.FieldDescriptor fd_GasInfo_min_gas_price protoreflect.FieldDescriptor + fd_GasInfo_rw_used protoreflect.FieldDescriptor ) func init() { @@ -2963,6 +2964,7 @@ func init() { fd_GasInfo_gas_wanted = md_GasInfo.Fields().ByName("gas_wanted") fd_GasInfo_gas_used = md_GasInfo.Fields().ByName("gas_used") fd_GasInfo_min_gas_price = md_GasInfo.Fields().ByName("min_gas_price") + fd_GasInfo_rw_used = md_GasInfo.Fields().ByName("rw_used") } var _ protoreflect.Message = (*fastReflection_GasInfo)(nil) @@ -3048,6 +3050,12 @@ func (x *fastReflection_GasInfo) Range(f func(protoreflect.FieldDescriptor, prot return } } + if x.RwUsed != uint64(0) { + value := protoreflect.ValueOfUint64(x.RwUsed) + if !f(fd_GasInfo_rw_used, value) { + return + } + } } // Has reports whether a field is populated. @@ -3069,6 +3077,8 @@ func (x *fastReflection_GasInfo) Has(fd protoreflect.FieldDescriptor) bool { return x.GasUsed != uint64(0) case "cosmos.base.abci.v1beta1.GasInfo.min_gas_price": return x.MinGasPrice != "" + case "cosmos.base.abci.v1beta1.GasInfo.rw_used": + return x.RwUsed != uint64(0) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.base.abci.v1beta1.GasInfo")) @@ -3091,6 +3101,8 @@ func (x *fastReflection_GasInfo) Clear(fd protoreflect.FieldDescriptor) { x.GasUsed = uint64(0) case "cosmos.base.abci.v1beta1.GasInfo.min_gas_price": x.MinGasPrice = "" + case "cosmos.base.abci.v1beta1.GasInfo.rw_used": + x.RwUsed = uint64(0) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.base.abci.v1beta1.GasInfo")) @@ -3116,6 +3128,9 @@ func (x *fastReflection_GasInfo) Get(descriptor protoreflect.FieldDescriptor) pr case "cosmos.base.abci.v1beta1.GasInfo.min_gas_price": value := x.MinGasPrice return protoreflect.ValueOfString(value) + case "cosmos.base.abci.v1beta1.GasInfo.rw_used": + value := x.RwUsed + return protoreflect.ValueOfUint64(value) default: if descriptor.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.base.abci.v1beta1.GasInfo")) @@ -3142,6 +3157,8 @@ func (x *fastReflection_GasInfo) Set(fd protoreflect.FieldDescriptor, value prot x.GasUsed = value.Uint() case "cosmos.base.abci.v1beta1.GasInfo.min_gas_price": x.MinGasPrice = value.Interface().(string) + case "cosmos.base.abci.v1beta1.GasInfo.rw_used": + x.RwUsed = value.Uint() default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.base.abci.v1beta1.GasInfo")) @@ -3168,6 +3185,8 @@ func (x *fastReflection_GasInfo) Mutable(fd protoreflect.FieldDescriptor) protor panic(fmt.Errorf("field gas_used of message cosmos.base.abci.v1beta1.GasInfo is not mutable")) case "cosmos.base.abci.v1beta1.GasInfo.min_gas_price": panic(fmt.Errorf("field min_gas_price of message cosmos.base.abci.v1beta1.GasInfo is not mutable")) + case "cosmos.base.abci.v1beta1.GasInfo.rw_used": + panic(fmt.Errorf("field rw_used of message cosmos.base.abci.v1beta1.GasInfo is not mutable")) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.base.abci.v1beta1.GasInfo")) @@ -3187,6 +3206,8 @@ func (x *fastReflection_GasInfo) NewField(fd protoreflect.FieldDescriptor) proto return protoreflect.ValueOfUint64(uint64(0)) case "cosmos.base.abci.v1beta1.GasInfo.min_gas_price": return protoreflect.ValueOfString("") + case "cosmos.base.abci.v1beta1.GasInfo.rw_used": + return protoreflect.ValueOfUint64(uint64(0)) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.base.abci.v1beta1.GasInfo")) @@ -3266,6 +3287,9 @@ func (x *fastReflection_GasInfo) ProtoMethods() *protoiface.Methods { if l > 0 { n += 1 + l + runtime.Sov(uint64(l)) } + if x.RwUsed != 0 { + n += 1 + runtime.Sov(uint64(x.RwUsed)) + } if x.unknownFields != nil { n += len(x.unknownFields) } @@ -3295,6 +3319,11 @@ func (x *fastReflection_GasInfo) ProtoMethods() *protoiface.Methods { i -= len(x.unknownFields) copy(dAtA[i:], x.unknownFields) } + if x.RwUsed != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.RwUsed)) + i-- + dAtA[i] = 0x20 + } if len(x.MinGasPrice) > 0 { i -= len(x.MinGasPrice) copy(dAtA[i:], x.MinGasPrice) @@ -3431,6 +3460,25 @@ func (x *fastReflection_GasInfo) ProtoMethods() *protoiface.Methods { } x.MinGasPrice = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 4: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field RwUsed", wireType) + } + x.RwUsed = 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.RwUsed |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := runtime.Skip(dAtA[iNdEx:]) @@ -5334,6 +5382,7 @@ var ( md_TxMsgData protoreflect.MessageDescriptor fd_TxMsgData_data protoreflect.FieldDescriptor fd_TxMsgData_msg_responses protoreflect.FieldDescriptor + fd_TxMsgData_extra_data protoreflect.FieldDescriptor ) func init() { @@ -5341,6 +5390,7 @@ func init() { md_TxMsgData = File_cosmos_base_abci_v1beta1_abci_proto.Messages().ByName("TxMsgData") fd_TxMsgData_data = md_TxMsgData.Fields().ByName("data") fd_TxMsgData_msg_responses = md_TxMsgData.Fields().ByName("msg_responses") + fd_TxMsgData_extra_data = md_TxMsgData.Fields().ByName("extra_data") } var _ protoreflect.Message = (*fastReflection_TxMsgData)(nil) @@ -5420,6 +5470,12 @@ func (x *fastReflection_TxMsgData) Range(f func(protoreflect.FieldDescriptor, pr return } } + if len(x.ExtraData) != 0 { + value := protoreflect.ValueOfBytes(x.ExtraData) + if !f(fd_TxMsgData_extra_data, value) { + return + } + } } // Has reports whether a field is populated. @@ -5439,6 +5495,8 @@ func (x *fastReflection_TxMsgData) Has(fd protoreflect.FieldDescriptor) bool { return len(x.Data) != 0 case "cosmos.base.abci.v1beta1.TxMsgData.msg_responses": return len(x.MsgResponses) != 0 + case "cosmos.base.abci.v1beta1.TxMsgData.extra_data": + return len(x.ExtraData) != 0 default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.base.abci.v1beta1.TxMsgData")) @@ -5459,6 +5517,8 @@ func (x *fastReflection_TxMsgData) Clear(fd protoreflect.FieldDescriptor) { x.Data = nil case "cosmos.base.abci.v1beta1.TxMsgData.msg_responses": x.MsgResponses = nil + case "cosmos.base.abci.v1beta1.TxMsgData.extra_data": + x.ExtraData = nil default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.base.abci.v1beta1.TxMsgData")) @@ -5487,6 +5547,9 @@ func (x *fastReflection_TxMsgData) Get(descriptor protoreflect.FieldDescriptor) } listValue := &_TxMsgData_2_list{list: &x.MsgResponses} return protoreflect.ValueOfList(listValue) + case "cosmos.base.abci.v1beta1.TxMsgData.extra_data": + value := x.ExtraData + return protoreflect.ValueOfBytes(value) default: if descriptor.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.base.abci.v1beta1.TxMsgData")) @@ -5515,6 +5578,8 @@ func (x *fastReflection_TxMsgData) Set(fd protoreflect.FieldDescriptor, value pr lv := value.List() clv := lv.(*_TxMsgData_2_list) x.MsgResponses = *clv.list + case "cosmos.base.abci.v1beta1.TxMsgData.extra_data": + x.ExtraData = value.Bytes() default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.base.abci.v1beta1.TxMsgData")) @@ -5547,6 +5612,8 @@ func (x *fastReflection_TxMsgData) Mutable(fd protoreflect.FieldDescriptor) prot } value := &_TxMsgData_2_list{list: &x.MsgResponses} return protoreflect.ValueOfList(value) + case "cosmos.base.abci.v1beta1.TxMsgData.extra_data": + panic(fmt.Errorf("field extra_data of message cosmos.base.abci.v1beta1.TxMsgData is not mutable")) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.base.abci.v1beta1.TxMsgData")) @@ -5566,6 +5633,8 @@ func (x *fastReflection_TxMsgData) NewField(fd protoreflect.FieldDescriptor) pro case "cosmos.base.abci.v1beta1.TxMsgData.msg_responses": list := []*anypb.Any{} return protoreflect.ValueOfList(&_TxMsgData_2_list{list: &list}) + case "cosmos.base.abci.v1beta1.TxMsgData.extra_data": + return protoreflect.ValueOfBytes(nil) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.base.abci.v1beta1.TxMsgData")) @@ -5647,6 +5716,10 @@ func (x *fastReflection_TxMsgData) ProtoMethods() *protoiface.Methods { n += 1 + l + runtime.Sov(uint64(l)) } } + l = len(x.ExtraData) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } if x.unknownFields != nil { n += len(x.unknownFields) } @@ -5676,6 +5749,13 @@ func (x *fastReflection_TxMsgData) ProtoMethods() *protoiface.Methods { i -= len(x.unknownFields) copy(dAtA[i:], x.unknownFields) } + if len(x.ExtraData) > 0 { + i -= len(x.ExtraData) + copy(dAtA[i:], x.ExtraData) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.ExtraData))) + i-- + dAtA[i] = 0x1a + } if len(x.MsgResponses) > 0 { for iNdEx := len(x.MsgResponses) - 1; iNdEx >= 0; iNdEx-- { encoded, err := options.Marshal(x.MsgResponses[iNdEx]) @@ -5825,6 +5905,40 @@ func (x *fastReflection_TxMsgData) ProtoMethods() *protoiface.Methods { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err } iNdEx = postIndex + case 3: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field ExtraData", wireType) + } + var byteLen int + 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++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.ExtraData = append(x.ExtraData[:0], dAtA[iNdEx:postIndex]...) + if x.ExtraData == nil { + x.ExtraData = []byte{} + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := runtime.Skip(dAtA[iNdEx:]) @@ -6917,6 +7031,8 @@ type GasInfo struct { GasUsed uint64 `protobuf:"varint,2,opt,name=gas_used,json=gasUsed,proto3" json:"gas_used,omitempty"` // MinGasPrice are the min gas price. MinGasPrice string `protobuf:"bytes,3,opt,name=min_gas_price,json=minGasPrice,proto3" json:"min_gas_price,omitempty"` + // RWUsed is the amount of r/w actually consumed. + RwUsed uint64 `protobuf:"varint,4,opt,name=rw_used,json=rwUsed,proto3" json:"rw_used,omitempty"` } func (x *GasInfo) Reset() { @@ -6960,6 +7076,13 @@ func (x *GasInfo) GetMinGasPrice() string { return "" } +func (x *GasInfo) GetRwUsed() uint64 { + if x != nil { + return x.RwUsed + } + return 0 +} + // Result is the union of ResponseFormat and ResponseCheckTx. type Result struct { state protoimpl.MessageState @@ -7140,6 +7263,8 @@ type TxMsgData struct { // // Since: cosmos-sdk 0.46 MsgResponses []*anypb.Any `protobuf:"bytes,2,rep,name=msg_responses,json=msgResponses,proto3" json:"msg_responses,omitempty"` + // extra data - the r/w info + ExtraData []byte `protobuf:"bytes,3,opt,name=extra_data,json=extraData,proto3" json:"extra_data,omitempty"` } func (x *TxMsgData) Reset() { @@ -7177,6 +7302,13 @@ func (x *TxMsgData) GetMsgResponses() []*anypb.Any { return nil } +func (x *TxMsgData) GetExtraData() []byte { + if x != nil { + return x.ExtraData + } + return nil +} + // SearchTxsResult defines a structure for querying txs pageable type SearchTxsResult struct { state protoimpl.MessageState @@ -7321,75 +7453,79 @@ var file_cosmos_base_abci_v1beta1_abci_proto_rawDesc = []byte{ 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x22, 0x67, 0x0a, 0x07, 0x47, 0x61, 0x73, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x1d, 0x0a, 0x0a, - 0x67, 0x61, 0x73, 0x5f, 0x77, 0x61, 0x6e, 0x74, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, - 0x52, 0x09, 0x67, 0x61, 0x73, 0x57, 0x61, 0x6e, 0x74, 0x65, 0x64, 0x12, 0x19, 0x0a, 0x08, 0x67, - 0x61, 0x73, 0x5f, 0x75, 0x73, 0x65, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x07, 0x67, - 0x61, 0x73, 0x55, 0x73, 0x65, 0x64, 0x12, 0x22, 0x0a, 0x0d, 0x6d, 0x69, 0x6e, 0x5f, 0x67, 0x61, - 0x73, 0x5f, 0x70, 0x72, 0x69, 0x63, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x6d, - 0x69, 0x6e, 0x47, 0x61, 0x73, 0x50, 0x72, 0x69, 0x63, 0x65, 0x22, 0xa9, 0x01, 0x0a, 0x06, 0x52, - 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x16, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0c, 0x42, 0x02, 0x18, 0x01, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x12, 0x10, 0x0a, - 0x03, 0x6c, 0x6f, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6c, 0x6f, 0x67, 0x12, - 0x34, 0x0a, 0x06, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x16, 0x2e, 0x74, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x6d, 0x69, 0x6e, 0x74, 0x2e, 0x61, 0x62, 0x63, - 0x69, 0x2e, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x06, 0x65, - 0x76, 0x65, 0x6e, 0x74, 0x73, 0x12, 0x39, 0x0a, 0x0d, 0x6d, 0x73, 0x67, 0x5f, 0x72, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, - 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, - 0x6e, 0x79, 0x52, 0x0c, 0x6d, 0x73, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x73, - 0x3a, 0x04, 0x88, 0xa0, 0x1f, 0x00, 0x22, 0x96, 0x01, 0x0a, 0x12, 0x53, 0x69, 0x6d, 0x75, 0x6c, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x46, 0x0a, - 0x08, 0x67, 0x61, 0x73, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x21, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x61, 0x62, - 0x63, 0x69, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x47, 0x61, 0x73, 0x49, 0x6e, - 0x66, 0x6f, 0x42, 0x08, 0xc8, 0xde, 0x1f, 0x00, 0xd0, 0xde, 0x1f, 0x01, 0x52, 0x07, 0x67, 0x61, - 0x73, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x38, 0x0a, 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, - 0x61, 0x73, 0x65, 0x2e, 0x61, 0x62, 0x63, 0x69, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, - 0x2e, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x52, 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, - 0x40, 0x0a, 0x07, 0x4d, 0x73, 0x67, 0x44, 0x61, 0x74, 0x61, 0x12, 0x19, 0x0a, 0x08, 0x6d, 0x73, - 0x67, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x73, - 0x67, 0x54, 0x79, 0x70, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x0c, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x3a, 0x06, 0x18, 0x01, 0x80, 0xdc, 0x20, - 0x01, 0x22, 0x87, 0x01, 0x0a, 0x09, 0x54, 0x78, 0x4d, 0x73, 0x67, 0x44, 0x61, 0x74, 0x61, 0x12, - 0x39, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x21, 0x2e, - 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x61, 0x62, 0x63, 0x69, - 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x44, 0x61, 0x74, 0x61, - 0x42, 0x02, 0x18, 0x01, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x12, 0x39, 0x0a, 0x0d, 0x6d, 0x73, - 0x67, 0x5f, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, - 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x0c, 0x6d, 0x73, 0x67, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x73, 0x3a, 0x04, 0x80, 0xdc, 0x20, 0x01, 0x22, 0xdc, 0x01, 0x0a, 0x0f, - 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x54, 0x78, 0x73, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, - 0x1f, 0x0a, 0x0b, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x04, 0x52, 0x0a, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x43, 0x6f, 0x75, 0x6e, 0x74, - 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, - 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1f, 0x0a, 0x0b, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x6e, - 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0a, 0x70, 0x61, 0x67, - 0x65, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x61, 0x67, 0x65, 0x5f, - 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, 0x52, 0x09, 0x70, 0x61, 0x67, - 0x65, 0x54, 0x6f, 0x74, 0x61, 0x6c, 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x18, - 0x05, 0x20, 0x01, 0x28, 0x04, 0x52, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x12, 0x36, 0x0a, 0x03, - 0x74, 0x78, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x63, 0x6f, 0x73, 0x6d, + 0x65, 0x22, 0x80, 0x01, 0x0a, 0x07, 0x47, 0x61, 0x73, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x1d, 0x0a, + 0x0a, 0x67, 0x61, 0x73, 0x5f, 0x77, 0x61, 0x6e, 0x74, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x04, 0x52, 0x09, 0x67, 0x61, 0x73, 0x57, 0x61, 0x6e, 0x74, 0x65, 0x64, 0x12, 0x19, 0x0a, 0x08, + 0x67, 0x61, 0x73, 0x5f, 0x75, 0x73, 0x65, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x07, + 0x67, 0x61, 0x73, 0x55, 0x73, 0x65, 0x64, 0x12, 0x22, 0x0a, 0x0d, 0x6d, 0x69, 0x6e, 0x5f, 0x67, + 0x61, 0x73, 0x5f, 0x70, 0x72, 0x69, 0x63, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, + 0x6d, 0x69, 0x6e, 0x47, 0x61, 0x73, 0x50, 0x72, 0x69, 0x63, 0x65, 0x12, 0x17, 0x0a, 0x07, 0x72, + 0x77, 0x5f, 0x75, 0x73, 0x65, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, 0x52, 0x06, 0x72, 0x77, + 0x55, 0x73, 0x65, 0x64, 0x22, 0xa9, 0x01, 0x0a, 0x06, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, + 0x16, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x02, 0x18, + 0x01, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x12, 0x10, 0x0a, 0x03, 0x6c, 0x6f, 0x67, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6c, 0x6f, 0x67, 0x12, 0x34, 0x0a, 0x06, 0x65, 0x76, 0x65, + 0x6e, 0x74, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x74, 0x65, 0x6e, 0x64, + 0x65, 0x72, 0x6d, 0x69, 0x6e, 0x74, 0x2e, 0x61, 0x62, 0x63, 0x69, 0x2e, 0x45, 0x76, 0x65, 0x6e, + 0x74, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x06, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x12, + 0x39, 0x0a, 0x0d, 0x6d, 0x73, 0x67, 0x5f, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x73, + 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x0c, 0x6d, 0x73, + 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x73, 0x3a, 0x04, 0x88, 0xa0, 0x1f, 0x00, + 0x22, 0x96, 0x01, 0x0a, 0x12, 0x53, 0x69, 0x6d, 0x75, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x46, 0x0a, 0x08, 0x67, 0x61, 0x73, 0x5f, 0x69, + 0x6e, 0x66, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x63, 0x6f, 0x73, 0x6d, + 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x61, 0x62, 0x63, 0x69, 0x2e, 0x76, 0x31, 0x62, + 0x65, 0x74, 0x61, 0x31, 0x2e, 0x47, 0x61, 0x73, 0x49, 0x6e, 0x66, 0x6f, 0x42, 0x08, 0xc8, 0xde, + 0x1f, 0x00, 0xd0, 0xde, 0x1f, 0x01, 0x52, 0x07, 0x67, 0x61, 0x73, 0x49, 0x6e, 0x66, 0x6f, 0x12, + 0x38, 0x0a, 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x20, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x61, 0x62, + 0x63, 0x69, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x52, 0x65, 0x73, 0x75, 0x6c, + 0x74, 0x52, 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x40, 0x0a, 0x07, 0x4d, 0x73, 0x67, + 0x44, 0x61, 0x74, 0x61, 0x12, 0x19, 0x0a, 0x08, 0x6d, 0x73, 0x67, 0x5f, 0x74, 0x79, 0x70, 0x65, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x73, 0x67, 0x54, 0x79, 0x70, 0x65, 0x12, + 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x64, + 0x61, 0x74, 0x61, 0x3a, 0x06, 0x18, 0x01, 0x80, 0xdc, 0x20, 0x01, 0x22, 0xa6, 0x01, 0x0a, 0x09, + 0x54, 0x78, 0x4d, 0x73, 0x67, 0x44, 0x61, 0x74, 0x61, 0x12, 0x39, 0x0a, 0x04, 0x64, 0x61, 0x74, + 0x61, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, + 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x61, 0x62, 0x63, 0x69, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, + 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x44, 0x61, 0x74, 0x61, 0x42, 0x02, 0x18, 0x01, 0x52, 0x04, + 0x64, 0x61, 0x74, 0x61, 0x12, 0x39, 0x0a, 0x0d, 0x6d, 0x73, 0x67, 0x5f, 0x72, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, + 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, + 0x79, 0x52, 0x0c, 0x6d, 0x73, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x73, 0x12, + 0x1d, 0x0a, 0x0a, 0x65, 0x78, 0x74, 0x72, 0x61, 0x5f, 0x64, 0x61, 0x74, 0x61, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x0c, 0x52, 0x09, 0x65, 0x78, 0x74, 0x72, 0x61, 0x44, 0x61, 0x74, 0x61, 0x3a, 0x04, + 0x80, 0xdc, 0x20, 0x01, 0x22, 0xdc, 0x01, 0x0a, 0x0f, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x54, + 0x78, 0x73, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x1f, 0x0a, 0x0b, 0x74, 0x6f, 0x74, 0x61, + 0x6c, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0a, 0x74, + 0x6f, 0x74, 0x61, 0x6c, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x75, + 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, + 0x1f, 0x0a, 0x0b, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x04, 0x52, 0x0a, 0x70, 0x61, 0x67, 0x65, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, + 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x18, 0x04, + 0x20, 0x01, 0x28, 0x04, 0x52, 0x09, 0x70, 0x61, 0x67, 0x65, 0x54, 0x6f, 0x74, 0x61, 0x6c, 0x12, + 0x14, 0x0a, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x04, 0x52, 0x05, + 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x12, 0x36, 0x0a, 0x03, 0x74, 0x78, 0x73, 0x18, 0x06, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, + 0x2e, 0x61, 0x62, 0x63, 0x69, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x54, 0x78, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x52, 0x03, 0x74, 0x78, 0x73, 0x3a, 0x04, 0x80, + 0xdc, 0x20, 0x01, 0x42, 0xe7, 0x01, 0x0a, 0x1c, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x61, 0x62, 0x63, 0x69, 0x2e, 0x76, 0x31, 0x62, - 0x65, 0x74, 0x61, 0x31, 0x2e, 0x54, 0x78, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x52, - 0x03, 0x74, 0x78, 0x73, 0x3a, 0x04, 0x80, 0xdc, 0x20, 0x01, 0x42, 0xe7, 0x01, 0x0a, 0x1c, 0x63, - 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x61, - 0x62, 0x63, 0x69, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x42, 0x09, 0x41, 0x62, 0x63, - 0x69, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x35, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, - 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, - 0x73, 0x2f, 0x62, 0x61, 0x73, 0x65, 0x2f, 0x61, 0x62, 0x63, 0x69, 0x2f, 0x76, 0x31, 0x62, 0x65, - 0x74, 0x61, 0x31, 0x3b, 0x61, 0x62, 0x63, 0x69, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xa2, - 0x02, 0x03, 0x43, 0x42, 0x41, 0xaa, 0x02, 0x18, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x42, - 0x61, 0x73, 0x65, 0x2e, 0x41, 0x62, 0x63, 0x69, 0x2e, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, - 0xca, 0x02, 0x18, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x42, 0x61, 0x73, 0x65, 0x5c, 0x41, - 0x62, 0x63, 0x69, 0x5c, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xe2, 0x02, 0x24, 0x43, 0x6f, - 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x42, 0x61, 0x73, 0x65, 0x5c, 0x41, 0x62, 0x63, 0x69, 0x5c, 0x56, - 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, - 0x74, 0x61, 0xea, 0x02, 0x1b, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x42, 0x61, 0x73, - 0x65, 0x3a, 0x3a, 0x41, 0x62, 0x63, 0x69, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, - 0xd8, 0xe1, 0x1e, 0x00, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x65, 0x74, 0x61, 0x31, 0x42, 0x09, 0x41, 0x62, 0x63, 0x69, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, + 0x01, 0x5a, 0x35, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, + 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x62, 0x61, 0x73, 0x65, 0x2f, + 0x61, 0x62, 0x63, 0x69, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x3b, 0x61, 0x62, 0x63, + 0x69, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xa2, 0x02, 0x03, 0x43, 0x42, 0x41, 0xaa, 0x02, + 0x18, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x42, 0x61, 0x73, 0x65, 0x2e, 0x41, 0x62, 0x63, + 0x69, 0x2e, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xca, 0x02, 0x18, 0x43, 0x6f, 0x73, 0x6d, + 0x6f, 0x73, 0x5c, 0x42, 0x61, 0x73, 0x65, 0x5c, 0x41, 0x62, 0x63, 0x69, 0x5c, 0x56, 0x31, 0x62, + 0x65, 0x74, 0x61, 0x31, 0xe2, 0x02, 0x24, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x42, 0x61, + 0x73, 0x65, 0x5c, 0x41, 0x62, 0x63, 0x69, 0x5c, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x5c, + 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x1b, 0x43, 0x6f, + 0x73, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x42, 0x61, 0x73, 0x65, 0x3a, 0x3a, 0x41, 0x62, 0x63, 0x69, + 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xd8, 0xe1, 0x1e, 0x00, 0x62, 0x06, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/baseapp/abci.go b/baseapp/abci.go index f99fc47fd7..ebabb34864 100644 --- a/baseapp/abci.go +++ b/baseapp/abci.go @@ -224,6 +224,7 @@ func (app *BaseApp) BeginBlock(req abci.RequestBeginBlock) (res abci.ResponseBeg if app.beginBlocker != nil { res = app.beginBlocker(app.deliverState.ctx, req) res.Events = sdk.MarkEventsToIndex(res.Events, app.indexEvents) + res.ExtraData = sdk.Uint64ToBigEndian(app.deliverState.ctx.GasMeter().RwConsumed()) } // set the signed validators for addition to context in deliverTx app.voteInfos = req.LastCommitInfo.GetVotes() @@ -247,6 +248,7 @@ func (app *BaseApp) EndBlock(req abci.RequestEndBlock) (res abci.ResponseEndBloc if app.endBlocker != nil { res = app.endBlocker(app.deliverState.ctx, req) res.Events = sdk.MarkEventsToIndex(res.Events, app.indexEvents) + res.ExtraData = sdk.Uint64ToBigEndian(app.deliverState.ctx.GasMeter().RwConsumed()) } if cp := app.GetConsensusParams(app.deliverState.ctx); cp != nil { @@ -436,6 +438,7 @@ func (app *BaseApp) DeliverTx(req abci.RequestDeliverTx) (res abci.ResponseDeliv telemetry.IncrCounter(1, "tx", resultStr) telemetry.SetGauge(float32(gInfo.GasUsed), "tx", "gas", "used") telemetry.SetGauge(float32(gInfo.GasWanted), "tx", "gas", "wanted") + telemetry.SetGauge(float32(gInfo.GasWanted), "tx", "gas", "rwused") }() gInfo, result, anteEvents, _, err := app.runTx(runTxModeDeliver, req.Tx) @@ -1166,6 +1169,7 @@ func SplitABCIQueryPath(requestPath string) (path []string) { func (app *BaseApp) getContextForProposal(ctx sdk.Context, height int64) sdk.Context { if height == app.initialHeight { ctx, _ = app.deliverState.ctx.CacheContext() + ctx = ctx.WithGasMeter(sdk.NewInfiniteGasMeter()) // clear all context data set during InitChain to avoid inconsistent behavior ctx = ctx.WithBlockHeader(tmproto.Header{}) diff --git a/baseapp/baseapp.go b/baseapp/baseapp.go index b9b3643dd2..5d13ac151f 100644 --- a/baseapp/baseapp.go +++ b/baseapp/baseapp.go @@ -85,7 +85,6 @@ type BaseApp struct { //nolint: maligned // // checkState is set on InitChain and reset on Commit // deliverState is set on InitChain and BeginBlock and set to nil on Commit - // queryState is set on InitChain and BeginBlock checkState *state // for CheckTx deliverState *state // for DeliverTx processProposalState *state // for ProcessProposal @@ -168,6 +167,9 @@ type BaseApp struct { //nolint: maligned // enableUnsafeQuery defines whether the unsafe queries will be enabled or not enableUnsafeQuery bool + + // enablePlainStore defines whether uses plain db store type or not + enablePlainStore bool } // NewBaseApp returns a reference to an initialized BaseApp. It accepts a @@ -290,7 +292,7 @@ func (app *BaseApp) MountStores(keys ...storetypes.StoreKey) { for _, key := range keys { switch key.(type) { case *storetypes.KVStoreKey: - if !app.fauxMerkleMode { + if app.IsIavlStore() { app.MountStore(key, storetypes.StoreTypeIAVL) } else { // StoreTypeDB doesn't do anything upon commit, and it doesn't @@ -314,7 +316,7 @@ func (app *BaseApp) MountStores(keys ...storetypes.StoreKey) { // BaseApp multistore. func (app *BaseApp) MountKVStores(keys map[string]*storetypes.KVStoreKey) { for _, key := range keys { - if !app.fauxMerkleMode { + if app.IsIavlStore() { app.MountStore(key, storetypes.StoreTypeIAVL) } else { // StoreTypeDB doesn't do anything upon commit, and it doesn't @@ -461,6 +463,9 @@ func (app *BaseApp) Seal() { app.sealed = true } // IsSealed returns true if the BaseApp is sealed and false otherwise. func (app *BaseApp) IsSealed() bool { return app.sealed } +// IsIavlStore returns whether IAVL store is used. +func (app *BaseApp) IsIavlStore() bool { return !app.enablePlainStore && !app.fauxMerkleMode } + // setState sets the BaseApp's state for the corresponding mode with a branched // multi-store (i.e., a CacheMultiStore) and a new Context with the same // multi-store branch, and provided header. @@ -740,7 +745,7 @@ func (app *BaseApp) runTxOnContext(ctx sdk.Context, mode runTxMode, txBytes []by err, result = processRecovery(r, recoveryMW), nil } - gInfo = sdk.GasInfo{GasWanted: gasWanted, GasUsed: ctx.GasMeter().GasConsumed(), MinGasPrice: gInfo.MinGasPrice} + gInfo = sdk.GasInfo{GasWanted: gasWanted, GasUsed: ctx.GasMeter().GasConsumed(), MinGasPrice: gInfo.MinGasPrice, RwUsed: ctx.GasMeter().RwConsumed()} }() blockGasConsumed := false @@ -939,7 +944,8 @@ func (app *BaseApp) runMsgs(ctx sdk.Context, msgs []sdk.Msg, mode runTxMode) (*s msgLogs = append(msgLogs, sdk.NewABCIMessageLog(uint32(i), msgResult.Log, msgEvents)) } - data, err := makeABCIData(msgResponses) + rwUsedBz := sdk.Uint64ToBigEndian(ctx.GasMeter().RwConsumed()) + data, err := makeABCIData(msgResponses, rwUsedBz) if err != nil { return nil, sdkerrors.Wrap(err, "failed to marshal tx data") } @@ -953,8 +959,8 @@ func (app *BaseApp) runMsgs(ctx sdk.Context, msgs []sdk.Msg, mode runTxMode) (*s } // makeABCIData generates the Data field to be sent to ABCI Check/DeliverTx. -func makeABCIData(msgResponses []*codectypes.Any) ([]byte, error) { - return proto.Marshal(&sdk.TxMsgData{MsgResponses: msgResponses}) +func makeABCIData(msgResponses []*codectypes.Any, extraDate []byte) ([]byte, error) { + return proto.Marshal(&sdk.TxMsgData{MsgResponses: msgResponses, ExtraData: extraDate}) } func createEvents(events sdk.Events, msg sdk.Msg) sdk.Events { diff --git a/baseapp/options.go b/baseapp/options.go index 4fee55e7c6..943d7090c9 100644 --- a/baseapp/options.go +++ b/baseapp/options.go @@ -107,6 +107,11 @@ func SetEnableUnsafeQuery(enabled bool) func(*BaseApp) { return func(app *BaseApp) { app.enableUnsafeQuery = enabled } } +// SetEnablePlainStore sets the flag to enable plain store in BaseApp. +func SetEnablePlainStore(enabled bool) func(*BaseApp) { + return func(app *BaseApp) { app.enablePlainStore = enabled } +} + func (app *BaseApp) SetName(name string) { if app.sealed { panic("SetName() on sealed BaseApp") diff --git a/go.mod b/go.mod index 508dbd89a1..da4ec18c59 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.0-20230810120916-f5f3421ab490 + github.com/cometbft/cometbft => github.com/bnb-chain/greenfield-cometbft v0.0.0-20230815065708-123390673ba9 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 diff --git a/go.sum b/go.sum index ecbf2ce072..8454566f1f 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.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 v0.0.0-20230815065708-123390673ba9 h1:cNBk5OONdlqg9tt1H/XTNIhz97v0DVBINFNi+wk/sfY= +github.com/bnb-chain/greenfield-cometbft v0.0.0-20230815065708-123390673ba9/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 h1:y3L64GU99otNp27/xLVBTDbv4eroR6CzoYz0rbaVotM= diff --git a/proto/cosmos/base/abci/v1beta1/abci.proto b/proto/cosmos/base/abci/v1beta1/abci.proto index a19decf3f3..da4c3aa94c 100644 --- a/proto/cosmos/base/abci/v1beta1/abci.proto +++ b/proto/cosmos/base/abci/v1beta1/abci.proto @@ -5,7 +5,7 @@ import "gogoproto/gogo.proto"; import "tendermint/abci/types.proto"; import "google/protobuf/any.proto"; -option go_package = "github.com/cosmos/cosmos-sdk/types"; +option go_package = "github.com/cosmos/cosmos-sdk/types"; option (gogoproto.goproto_stringer_all) = false; // TxResponse defines a structure containing relevant tx data and metadata. The @@ -53,7 +53,7 @@ message ABCIMessageLog { option (gogoproto.stringer) = true; uint32 msg_index = 1 [(gogoproto.jsontag) = "msg_index"]; - string log = 2; + string log = 2; // Events contains a slice of Event objects that were emitted during some // execution. @@ -65,14 +65,14 @@ message ABCIMessageLog { message StringEvent { option (gogoproto.stringer) = true; - string type = 1; + string type = 1; repeated Attribute attributes = 2 [(gogoproto.nullable) = false]; } // Attribute defines an attribute wrapper where the key and value are // strings instead of raw bytes. message Attribute { - string key = 1; + string key = 1; string value = 2; } @@ -86,6 +86,9 @@ message GasInfo { // MinGasPrice are the min gas price. string min_gas_price = 3; + + // RWUsed is the amount of r/w actually consumed. + uint64 rw_used = 4; } // Result is the union of ResponseFormat and ResponseCheckTx. @@ -115,17 +118,17 @@ message Result { // successfully simulated. message SimulationResponse { GasInfo gas_info = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; - Result result = 2; + Result result = 2; } // MsgData defines the data returned in a Result object during message // execution. message MsgData { - option deprecated = true; + option deprecated = true; option (gogoproto.stringer) = true; string msg_type = 1; - bytes data = 2; + bytes data = 2; } // TxMsgData defines a list of MsgData. A transaction will have a MsgData object @@ -140,6 +143,9 @@ message TxMsgData { // // Since: cosmos-sdk 0.46 repeated google.protobuf.Any msg_responses = 2; + + // extra data - the r/w info + bytes extra_data = 3; } // SearchTxsResult defines a structure for querying txs pageable diff --git a/server/config/config.go b/server/config/config.go index 27939deb7a..9fb677bcb8 100644 --- a/server/config/config.go +++ b/server/config/config.go @@ -101,6 +101,9 @@ type BaseConfig struct { // EnableUnsafeQuery enable/disable unsafe query apis. EnableUnsafeQuery bool `mapstructure:"enable-unsafe-query"` + + // EnablePlainStore enable/disable plain db store without iavl. + EnablePlainStore bool `mapstructure:"enable-plain-store"` } // APIConfig defines the API listener configuration. @@ -283,6 +286,7 @@ func DefaultConfig() *Config { IAVLLazyLoading: false, AppDBBackend: "", EnableUnsafeQuery: false, + EnablePlainStore: false, }, Telemetry: telemetry.Config{ Enabled: false, diff --git a/server/config/toml.go b/server/config/toml.go index 6c66a5a1d8..8c5e29e46c 100644 --- a/server/config/toml.go +++ b/server/config/toml.go @@ -95,6 +95,12 @@ app-db-backend = "{{ .BaseConfig.AppDBBackend }}" # Default is false. enable-unsafe-query = "{{ .BaseConfig.EnableUnsafeQuery }}" +# EnablePlainStore enables or disables the plain store. If it is true, then plain store will be used, not IAVL store. +# Do not enable it on validator nodes or other nodes which require high security level. +# If you enable it, please also enable skip_app_hash config in config.toml file. +# Default is false. +enable-plain-store = "{{ .BaseConfig.EnablePlainStore }}" + ############################################################################### ### Upgrade Configuration ### ############################################################################### diff --git a/server/start.go b/server/start.go index dee5d2527f..72ba065df3 100644 --- a/server/start.go +++ b/server/start.go @@ -61,6 +61,7 @@ const ( FlagIAVLLazyLoading = "iavl-lazy-loading" FlagEnableUnsafeQuery = "enable-unsafe-query" + FlagEnablePlainStore = "enable-plain-store" // state sync-related flags FlagStateSyncSnapshotInterval = "state-sync.snapshot-interval" diff --git a/server/util.go b/server/util.go index d4798cbc78..7a7f89ef8f 100644 --- a/server/util.go +++ b/server/util.go @@ -499,6 +499,7 @@ func DefaultBaseappOptions(appOpts types.AppOptions) []func(*baseapp.BaseApp) { baseapp.SetIAVLLazyLoading(cast.ToBool(appOpts.Get(FlagIAVLLazyLoading))), baseapp.SetChainID(chainID), baseapp.SetEnableUnsafeQuery(cast.ToBool(appOpts.Get(FlagEnableUnsafeQuery))), + baseapp.SetEnablePlainStore(cast.ToBool(appOpts.Get(FlagEnablePlainStore))), } } diff --git a/simapp/app.go b/simapp/app.go index e8cf68801b..d6a7d3805f 100644 --- a/simapp/app.go +++ b/simapp/app.go @@ -358,7 +358,8 @@ func NewSimApp( homePath := cast.ToString(appOpts.Get(flags.FlagHome)) app.UpgradeKeeper = upgradekeeper.NewKeeper(keys[upgradetypes.StoreKey], appCodec, homePath, app.BaseApp) - app.CrossChainKeeper = crosschainkeeper.NewKeeper(appCodec, keys[crosschaintypes.StoreKey], authtypes.NewModuleAddress(govtypes.ModuleName).String()) + app.CrossChainKeeper = crosschainkeeper.NewKeeper(appCodec, keys[crosschaintypes.StoreKey], authtypes.NewModuleAddress(govtypes.ModuleName).String(), + app.StakingKeeper, app.BankKeeper) app.GashubKeeper = gashubkeeper.NewKeeper(appCodec, keys[gashubtypes.StoreKey], authtypes.NewModuleAddress(govtypes.ModuleName).String()) @@ -389,7 +390,8 @@ func NewSimApp( ) app.NFTKeeper = nftkeeper.NewKeeper(keys[nftkeeper.StoreKey], appCodec, app.AccountKeeper, app.BankKeeper) - app.CrossChainKeeper = crosschainkeeper.NewKeeper(appCodec, keys[crosschaintypes.StoreKey], authtypes.NewModuleAddress(govtypes.ModuleName).String()) + app.CrossChainKeeper = crosschainkeeper.NewKeeper(appCodec, keys[crosschaintypes.StoreKey], authtypes.NewModuleAddress(govtypes.ModuleName).String(), + app.StakingKeeper, app.BankKeeper) // create evidence keeper with router evidenceKeeper := evidencekeeper.NewKeeper( diff --git a/simapp/go.mod b/simapp/go.mod index b66cf08730..0e8bdd1c71 100644 --- a/simapp/go.mod +++ b/simapp/go.mod @@ -39,7 +39,6 @@ require ( github.com/cespare/xxhash/v2 v2.2.0 // indirect github.com/chzyer/readline v1.5.1 // indirect github.com/cockroachdb/apd/v2 v2.0.2 // indirect - github.com/coinbase/rosetta-sdk-go/types v1.0.0 // indirect github.com/confio/ics23/go v0.9.0 // indirect github.com/cosmos/btcutil v1.0.5 // indirect github.com/cosmos/cosmos-proto v1.0.0-beta.3 // indirect @@ -48,7 +47,6 @@ require ( github.com/cosmos/gogoproto v1.4.10 // indirect github.com/cosmos/iavl v0.20.0 // indirect github.com/cosmos/ledger-cosmos-go v0.12.2 // indirect - github.com/cosmos/rosetta-sdk-go v0.10.0 // indirect github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect github.com/creachadair/taskgroup v0.4.2 // indirect github.com/danieljoos/wincred v1.1.2 // indirect @@ -165,7 +163,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-alpha.1 + github.com/cometbft/cometbft => github.com/bnb-chain/greenfield-cometbft v0.0.0-20230815065708-123390673ba9 github.com/cometbft/cometbft-db => github.com/bnb-chain/greenfield-cometbft-db v0.8.1-alpha.1 // Simapp always use the latest version of the cosmos-sdk diff --git a/simapp/go.sum b/simapp/go.sum index 09eb3977e4..cc9523d5d6 100644 --- a/simapp/go.sum +++ b/simapp/go.sum @@ -53,8 +53,6 @@ cosmossdk.io/log v1.1.0 h1:v0ogPHYeTzPcBTcPR1A3j1hkei4pZama8kz8LKlCMv0= cosmossdk.io/log v1.1.0/go.mod h1:6zjroETlcDs+mm62gd8Ig7mZ+N+fVOZS91V17H+M4N4= cosmossdk.io/math v1.0.1 h1:Qx3ifyOPaMLNH/89WeZFH268yCvU4xEcnPLu3sJqPPg= cosmossdk.io/math v1.0.1/go.mod h1:Ygz4wBHrgc7g0N+8+MrnTfS9LLn9aaTGa9hKopuym5k= -cosmossdk.io/tools/rosetta v0.2.1 h1:ddOMatOH+pbxWbrGJKRAawdBkPYLfKXutK9IETnjYxw= -cosmossdk.io/tools/rosetta v0.2.1/go.mod h1:Pqdc1FdvkNV3LcNIkYWt2RQY6IP1ge6YWZk8MhhO9Hw= dmitri.shuralyov.com/app/changes v0.0.0-20180602232624-0a106ad413e3/go.mod h1:Yl+fi1br7+Rr3LqpNJf1/uxUdtRUV+Tnj0o93V2B9MU= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= dmitri.shuralyov.com/html/belt v0.0.0-20180602232347-f7d459c86be0/go.mod h1:JLBrvjyP0v+ecvNYvCpyZgu5/xkfAUhi6wJj28eUfSU= @@ -159,8 +157,8 @@ github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kB github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816 h1:41iFGWnSlI2gVpmOtVTJZNodLdLQLn/KsJqFvXwnd/s= github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= github.com/bmizerany/pat v0.0.0-20170815010413-6226ea591a40/go.mod h1:8rLXio+WjiTceGBHIoTvn60HIbs7Hm7bcHjyrSqYB9c= -github.com/bnb-chain/greenfield-cometbft v0.0.2-alpha.1 h1:DU/lvMpzyS5PzLaAcBu1xaQ2/ezuxcJFdi0ej3ZeAsc= -github.com/bnb-chain/greenfield-cometbft v0.0.2-alpha.1/go.mod h1:EBmwmUdaNbGPyGjf1cMuoN3pAeM2tQu7Lfg95813EAw= +github.com/bnb-chain/greenfield-cometbft v0.0.0-20230815065708-123390673ba9 h1:cNBk5OONdlqg9tt1H/XTNIhz97v0DVBINFNi+wk/sfY= +github.com/bnb-chain/greenfield-cometbft v0.0.0-20230815065708-123390673ba9/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= @@ -236,8 +234,6 @@ github.com/cockroachdb/apd/v2 v2.0.2/go.mod h1:DDxRlzC2lo3/vSlmSoS7JkqbbrARPuFOG github.com/cockroachdb/apd/v3 v3.1.0 h1:MK3Ow7LH0W8zkd5GMKA1PvS9qG3bWFI95WaVNfyZJ/w= github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:zn76sxSg3SzpJ0PPJaLDCu+Bu0Lg3sKTORVIj19EIF8= github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI= -github.com/coinbase/rosetta-sdk-go/types v1.0.0 h1:jpVIwLcPoOeCR6o1tU+Xv7r5bMONNbHU7MuEHboiFuA= -github.com/coinbase/rosetta-sdk-go/types v1.0.0/go.mod h1:eq7W2TMRH22GTW0N0beDnN931DW0/WOI1R2sdHNHG4c= github.com/confio/ics23/go v0.9.0 h1:cWs+wdbS2KRPZezoaaj+qBleXgUk5WOQFMP3CQFGTr4= github.com/confio/ics23/go v0.9.0/go.mod h1:4LPZ2NYqnYIVRklaozjNR1FScgDJ2s5Xrp+e/mYVRak= github.com/consensys/bavard v0.1.8-0.20210406032232-f3452dc9b572/go.mod h1:Bpd0/3mZuaj6Sj+PqrmIquiOKy397AKGThQPaGzNXAQ= @@ -268,8 +264,6 @@ github.com/cosmos/keyring v1.2.0 h1:8C1lBP9xhImmIabyXW4c3vFjjLiBdGCmfLUfeZlV1Yo= github.com/cosmos/keyring v1.2.0/go.mod h1:fc+wB5KTk9wQ9sDx0kFXB3A0MaeGHM9AwRStKOQ5vOA= github.com/cosmos/ledger-cosmos-go v0.12.2 h1:/XYaBlE2BJxtvpkHiBm97gFGSGmYGKunKyF3nNqAXZA= github.com/cosmos/ledger-cosmos-go v0.12.2/go.mod h1:ZcqYgnfNJ6lAXe4HPtWgarNEY+B74i+2/8MhZw4ziiI= -github.com/cosmos/rosetta-sdk-go v0.10.0 h1:E5RhTruuoA7KTIXUcMicL76cffyeoyvNybzUGSKFTcM= -github.com/cosmos/rosetta-sdk-go v0.10.0/go.mod h1:SImAZkb96YbwvoRkzSMQB6noNJXFgWl/ENIznEoYQI4= github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w= diff --git a/snapshots/types/snapshot.pb.go b/snapshots/types/snapshot.pb.go index 5821c91614..811e2b78c4 100644 --- a/snapshots/types/snapshot.pb.go +++ b/snapshots/types/snapshot.pb.go @@ -152,7 +152,6 @@ type SnapshotItem struct { // item is the specific type of snapshot item. // // Types that are valid to be assigned to Item: - // // *SnapshotItem_Store // *SnapshotItem_IAVL // *SnapshotItem_Extension diff --git a/store/gaskv/store.go b/store/gaskv/store.go index 85bf598d06..87ad74a051 100644 --- a/store/gaskv/store.go +++ b/store/gaskv/store.go @@ -33,12 +33,12 @@ func (gs *Store) GetStoreType() types.StoreType { // Implements KVStore. func (gs *Store) Get(key []byte) (value []byte) { - gs.gasMeter.ConsumeGas(gs.gasConfig.ReadCostFlat, types.GasReadCostFlatDesc) + gs.gasMeter.ConsumeRw(gs.gasConfig.ReadCostFlat, types.GasReadCostFlatDesc) value = gs.parent.Get(key) // TODO overflow-safe math? - gs.gasMeter.ConsumeGas(gs.gasConfig.ReadCostPerByte*types.Gas(len(key)), types.GasReadPerByteDesc) - gs.gasMeter.ConsumeGas(gs.gasConfig.ReadCostPerByte*types.Gas(len(value)), types.GasReadPerByteDesc) + gs.gasMeter.ConsumeRw(gs.gasConfig.ReadCostPerByte*types.Gas(len(key)), types.GasReadPerByteDesc) + gs.gasMeter.ConsumeRw(gs.gasConfig.ReadCostPerByte*types.Gas(len(value)), types.GasReadPerByteDesc) return value } @@ -47,23 +47,23 @@ func (gs *Store) Get(key []byte) (value []byte) { func (gs *Store) Set(key []byte, value []byte) { types.AssertValidKey(key) types.AssertValidValue(value) - gs.gasMeter.ConsumeGas(gs.gasConfig.WriteCostFlat, types.GasWriteCostFlatDesc) + gs.gasMeter.ConsumeRw(gs.gasConfig.WriteCostFlat, types.GasWriteCostFlatDesc) // TODO overflow-safe math? - gs.gasMeter.ConsumeGas(gs.gasConfig.WriteCostPerByte*types.Gas(len(key)), types.GasWritePerByteDesc) - gs.gasMeter.ConsumeGas(gs.gasConfig.WriteCostPerByte*types.Gas(len(value)), types.GasWritePerByteDesc) + gs.gasMeter.ConsumeRw(gs.gasConfig.WriteCostPerByte*types.Gas(len(key)), types.GasWritePerByteDesc) + gs.gasMeter.ConsumeRw(gs.gasConfig.WriteCostPerByte*types.Gas(len(value)), types.GasWritePerByteDesc) gs.parent.Set(key, value) } // Implements KVStore. func (gs *Store) Has(key []byte) bool { - gs.gasMeter.ConsumeGas(gs.gasConfig.HasCost, types.GasHasDesc) + gs.gasMeter.ConsumeRw(gs.gasConfig.HasCost, types.GasHasDesc) return gs.parent.Has(key) } // Implements KVStore. func (gs *Store) Delete(key []byte) { // charge gas to prevent certain attack vectors even though space is being freed - gs.gasMeter.ConsumeGas(gs.gasConfig.DeleteCost, types.GasDeleteDesc) + gs.gasMeter.ConsumeRw(gs.gasConfig.DeleteCost, types.GasDeleteDesc) gs.parent.Delete(key) } @@ -169,8 +169,8 @@ func (gi *gasIterator) consumeSeekGas() { key := gi.Key() value := gi.Value() - gi.gasMeter.ConsumeGas(gi.gasConfig.ReadCostPerByte*types.Gas(len(key)), types.GasValuePerByteDesc) - gi.gasMeter.ConsumeGas(gi.gasConfig.ReadCostPerByte*types.Gas(len(value)), types.GasValuePerByteDesc) + gi.gasMeter.ConsumeRw(gi.gasConfig.ReadCostPerByte*types.Gas(len(key)), types.GasValuePerByteDesc) + gi.gasMeter.ConsumeRw(gi.gasConfig.ReadCostPerByte*types.Gas(len(value)), types.GasValuePerByteDesc) } - gi.gasMeter.ConsumeGas(gi.gasConfig.IterNextCostFlat, types.GasIterNextCostFlatDesc) + gi.gasMeter.ConsumeRw(gi.gasConfig.IterNextCostFlat, types.GasIterNextCostFlatDesc) } diff --git a/store/gaskv/store_test.go b/store/gaskv/store_test.go index 2aabc9de7c..544ead483f 100644 --- a/store/gaskv/store_test.go +++ b/store/gaskv/store_test.go @@ -34,7 +34,7 @@ func TestGasKVStoreBasic(t *testing.T) { require.Equal(t, valFmt(1), st.Get(keyFmt(1))) st.Delete(keyFmt(1)) require.Empty(t, st.Get(keyFmt(1)), "Expected `key1` to be empty") - require.Equal(t, meter.GasConsumed(), types.Gas(6858)) + require.Equal(t, meter.RwConsumed(), types.Gas(6858)) } func TestGasKVStoreIterator(t *testing.T) { @@ -73,16 +73,16 @@ func TestGasKVStoreIterator(t *testing.T) { vb := iterator.Value() require.Equal(t, vb, valFmt(2)) iterator.Next() - require.Equal(t, types.Gas(14565), meter.GasConsumed()) + require.Equal(t, types.Gas(14565), meter.RwConsumed()) kc := iterator.Key() require.Equal(t, kc, keyFmt(3)) vc := iterator.Value() require.Equal(t, vc, valFmt(0)) iterator.Next() - require.Equal(t, types.Gas(14667), meter.GasConsumed()) + require.Equal(t, types.Gas(14667), meter.RwConsumed()) require.False(t, iterator.Valid()) require.Panics(t, iterator.Next) - require.Equal(t, types.Gas(14697), meter.GasConsumed()) + require.Equal(t, types.Gas(14697), meter.RwConsumed()) require.NoError(t, iterator.Error()) reverseIterator := st.ReverseIterator(nil, nil) @@ -99,22 +99,24 @@ func TestGasKVStoreIterator(t *testing.T) { reverseIterator.Next() require.False(t, reverseIterator.Valid()) require.Panics(t, reverseIterator.Next) - require.Equal(t, types.Gas(15135), meter.GasConsumed()) + require.Equal(t, types.Gas(15135), meter.RwConsumed()) } -func TestGasKVStoreOutOfGasSet(t *testing.T) { - mem := dbadapter.Store{DB: dbm.NewMemDB()} - meter := types.NewGasMeter(0) - st := gaskv.NewStore(mem, meter, types.KVGasConfig()) - require.Panics(t, func() { st.Set(keyFmt(1), valFmt(1)) }, "Expected out-of-gas") -} - -func TestGasKVStoreOutOfGasIterator(t *testing.T) { - mem := dbadapter.Store{DB: dbm.NewMemDB()} - meter := types.NewGasMeter(20000) - st := gaskv.NewStore(mem, meter, types.KVGasConfig()) - st.Set(keyFmt(1), valFmt(1)) - iterator := st.Iterator(nil, nil) - iterator.Next() - require.Panics(t, func() { iterator.Value() }, "Expected out-of-gas") -} +// no limit on r/w consumed +//func TestGasKVStoreOutOfGasSet(t *testing.T) { +// mem := dbadapter.Store{DB: dbm.NewMemDB()} +// meter := types.NewGasMeter(0) +// st := gaskv.NewStore(mem, meter, types.KVGasConfig()) +// require.Panics(t, func() { st.Set(keyFmt(1), valFmt(1)) }, "Expected out-of-gas") +//} + +// no limit on r/w consumed +//func TestGasKVStoreOutOfGasIterator(t *testing.T) { +// mem := dbadapter.Store{DB: dbm.NewMemDB()} +// meter := types.NewGasMeter(20000) +// st := gaskv.NewStore(mem, meter, types.KVGasConfig()) +// st.Set(keyFmt(1), valFmt(1)) +// iterator := st.Iterator(nil, nil) +// iterator.Next() +// require.Panics(t, func() { iterator.Value() }, "Expected out-of-gas") +//} diff --git a/store/rootmulti/store.go b/store/rootmulti/store.go index 9fe9b73c8c..892df8bf32 100644 --- a/store/rootmulti/store.go +++ b/store/rootmulti/store.go @@ -573,6 +573,8 @@ func (rs *Store) DeepCopyAndCache() types.CacheMultiStore { } } else if _, ok := v.(*transient.Store); ok { stores[k] = transient.NewStore() + } else if dbStore, ok := v.(commitDBStoreAdapter); ok { + stores[k] = commitDBStoreAdapter{Store: dbadapter.Store{DB: dbStore.Store.DB}} } } return cachemulti.NewStore(rs.db, stores, rs.keysByName, rs.traceWriter, rs.getTracingContext()) @@ -595,6 +597,8 @@ func (rs *Store) DeepCopy() *Store { } } else if _, ok := v.(*transient.Store); ok { stores[k] = transient.NewStore() + } else if dbStore, ok := v.(commitDBStoreAdapter); ok { + stores[k] = commitDBStoreAdapter{Store: dbadapter.Store{DB: dbStore.Store.DB}} } } diff --git a/store/types/gas.go b/store/types/gas.go index baceb7ce25..b13f99a98e 100644 --- a/store/types/gas.go +++ b/store/types/gas.go @@ -48,18 +48,23 @@ type GasMeter interface { IsPastLimit() bool IsOutOfGas() bool String() string + + RwConsumed() Gas // get metrics of store r/w + ConsumeRw(amount Gas, descriptor string) // consume metrics of store r/w } type basicGasMeter struct { - limit Gas - consumed Gas + limit Gas + consumed Gas + rwConsumed Gas } // NewGasMeter returns a reference to a new basicGasMeter. func NewGasMeter(limit Gas) GasMeter { return &basicGasMeter{ - limit: limit, - consumed: 0, + limit: limit, + consumed: 0, + rwConsumed: 0, } } @@ -146,14 +151,29 @@ func (g *basicGasMeter) String() string { return fmt.Sprintf("BasicGasMeter:\n limit: %d\n consumed: %d", g.limit, g.consumed) } +func (g *basicGasMeter) RwConsumed() Gas { + return g.rwConsumed +} + +func (g *basicGasMeter) ConsumeRw(amount Gas, descriptor string) { + var overflow bool + g.rwConsumed, overflow = addUint64Overflow(g.rwConsumed, amount) + if overflow { + g.rwConsumed = math.MaxUint64 + panic(ErrorGasOverflow{descriptor}) + } +} + type infiniteGasMeter struct { - consumed Gas + consumed Gas + rwConsumed Gas } // NewInfiniteGasMeter returns a new gas meter without a limit. func NewInfiniteGasMeter() GasMeter { return &infiniteGasMeter{ - consumed: 0, + consumed: 0, + rwConsumed: 0, } } @@ -217,6 +237,19 @@ func (g *infiniteGasMeter) String() string { return fmt.Sprintf("InfiniteGasMeter:\n consumed: %d", g.consumed) } +func (g *infiniteGasMeter) RwConsumed() Gas { + return g.rwConsumed +} + +func (g *infiniteGasMeter) ConsumeRw(amount Gas, descriptor string) { + var overflow bool + g.rwConsumed, overflow = addUint64Overflow(g.rwConsumed, amount) + if overflow { + g.rwConsumed = math.MaxUint64 + panic(ErrorGasOverflow{descriptor}) + } +} + // GasConfig defines gas cost for each operation on KVStores type GasConfig struct { HasCost Gas diff --git a/tests/go.mod b/tests/go.mod index 3613c530df..58e8be5fb5 100644 --- a/tests/go.mod +++ b/tests/go.mod @@ -26,7 +26,6 @@ require ( cosmossdk.io/core v0.6.1 // indirect cosmossdk.io/errors v1.0.0-beta.7 // indirect cosmossdk.io/log v1.1.0 // indirect - cosmossdk.io/tools/rosetta v0.2.1 // indirect filippo.io/edwards25519 v1.0.0 // indirect github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect github.com/99designs/keyring v1.2.1 // indirect @@ -43,7 +42,6 @@ require ( github.com/cespare/xxhash/v2 v2.2.0 // indirect github.com/chzyer/readline v1.5.1 // indirect github.com/cockroachdb/apd/v2 v2.0.2 // indirect - github.com/coinbase/rosetta-sdk-go/types v1.0.0 // indirect github.com/confio/ics23/go v0.9.0 // indirect github.com/cosmos/btcutil v1.0.5 // indirect github.com/cosmos/cosmos-proto v1.0.0-beta.3 // indirect @@ -51,7 +49,6 @@ require ( github.com/cosmos/gogogateway v1.2.0 // indirect github.com/cosmos/iavl v0.20.0 // indirect github.com/cosmos/ledger-cosmos-go v0.12.2 // indirect - github.com/cosmos/rosetta-sdk-go v0.10.0 // indirect github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect github.com/creachadair/taskgroup v0.4.2 // indirect github.com/danieljoos/wincred v1.1.2 // indirect @@ -169,7 +166,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-alpha.1 + github.com/cometbft/cometbft => github.com/bnb-chain/greenfield-cometbft v0.0.0-20230815065708-123390673ba9 github.com/cometbft/cometbft-db => github.com/bnb-chain/greenfield-cometbft-db v0.8.1-alpha.1 // We always want to test against the latest version of the SDK. github.com/cosmos/cosmos-sdk => ../. diff --git a/tests/go.sum b/tests/go.sum index e0a2c4a22e..c6749e3bf5 100644 --- a/tests/go.sum +++ b/tests/go.sum @@ -53,8 +53,6 @@ cosmossdk.io/log v1.1.0 h1:v0ogPHYeTzPcBTcPR1A3j1hkei4pZama8kz8LKlCMv0= cosmossdk.io/log v1.1.0/go.mod h1:6zjroETlcDs+mm62gd8Ig7mZ+N+fVOZS91V17H+M4N4= cosmossdk.io/math v1.0.1 h1:Qx3ifyOPaMLNH/89WeZFH268yCvU4xEcnPLu3sJqPPg= cosmossdk.io/math v1.0.1/go.mod h1:Ygz4wBHrgc7g0N+8+MrnTfS9LLn9aaTGa9hKopuym5k= -cosmossdk.io/tools/rosetta v0.2.1 h1:ddOMatOH+pbxWbrGJKRAawdBkPYLfKXutK9IETnjYxw= -cosmossdk.io/tools/rosetta v0.2.1/go.mod h1:Pqdc1FdvkNV3LcNIkYWt2RQY6IP1ge6YWZk8MhhO9Hw= dmitri.shuralyov.com/app/changes v0.0.0-20180602232624-0a106ad413e3/go.mod h1:Yl+fi1br7+Rr3LqpNJf1/uxUdtRUV+Tnj0o93V2B9MU= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= dmitri.shuralyov.com/html/belt v0.0.0-20180602232347-f7d459c86be0/go.mod h1:JLBrvjyP0v+ecvNYvCpyZgu5/xkfAUhi6wJj28eUfSU= @@ -159,8 +157,8 @@ github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kB github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816 h1:41iFGWnSlI2gVpmOtVTJZNodLdLQLn/KsJqFvXwnd/s= github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= github.com/bmizerany/pat v0.0.0-20170815010413-6226ea591a40/go.mod h1:8rLXio+WjiTceGBHIoTvn60HIbs7Hm7bcHjyrSqYB9c= -github.com/bnb-chain/greenfield-cometbft v0.0.2-alpha.1 h1:DU/lvMpzyS5PzLaAcBu1xaQ2/ezuxcJFdi0ej3ZeAsc= -github.com/bnb-chain/greenfield-cometbft v0.0.2-alpha.1/go.mod h1:EBmwmUdaNbGPyGjf1cMuoN3pAeM2tQu7Lfg95813EAw= +github.com/bnb-chain/greenfield-cometbft v0.0.0-20230815065708-123390673ba9 h1:cNBk5OONdlqg9tt1H/XTNIhz97v0DVBINFNi+wk/sfY= +github.com/bnb-chain/greenfield-cometbft v0.0.0-20230815065708-123390673ba9/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.0.0-20230709010548-149ad7453fba h1:e2vklUSGlVZnE6Vj0YVBV7odB2xaYc+D0B9hQgF/3tM= @@ -236,8 +234,6 @@ github.com/cockroachdb/apd/v2 v2.0.2/go.mod h1:DDxRlzC2lo3/vSlmSoS7JkqbbrARPuFOG github.com/cockroachdb/apd/v3 v3.1.0 h1:MK3Ow7LH0W8zkd5GMKA1PvS9qG3bWFI95WaVNfyZJ/w= github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:zn76sxSg3SzpJ0PPJaLDCu+Bu0Lg3sKTORVIj19EIF8= github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI= -github.com/coinbase/rosetta-sdk-go/types v1.0.0 h1:jpVIwLcPoOeCR6o1tU+Xv7r5bMONNbHU7MuEHboiFuA= -github.com/coinbase/rosetta-sdk-go/types v1.0.0/go.mod h1:eq7W2TMRH22GTW0N0beDnN931DW0/WOI1R2sdHNHG4c= github.com/confio/ics23/go v0.9.0 h1:cWs+wdbS2KRPZezoaaj+qBleXgUk5WOQFMP3CQFGTr4= github.com/confio/ics23/go v0.9.0/go.mod h1:4LPZ2NYqnYIVRklaozjNR1FScgDJ2s5Xrp+e/mYVRak= github.com/consensys/bavard v0.1.8-0.20210406032232-f3452dc9b572/go.mod h1:Bpd0/3mZuaj6Sj+PqrmIquiOKy397AKGThQPaGzNXAQ= @@ -268,8 +264,6 @@ github.com/cosmos/keyring v1.2.0 h1:8C1lBP9xhImmIabyXW4c3vFjjLiBdGCmfLUfeZlV1Yo= github.com/cosmos/keyring v1.2.0/go.mod h1:fc+wB5KTk9wQ9sDx0kFXB3A0MaeGHM9AwRStKOQ5vOA= github.com/cosmos/ledger-cosmos-go v0.12.2 h1:/XYaBlE2BJxtvpkHiBm97gFGSGmYGKunKyF3nNqAXZA= github.com/cosmos/ledger-cosmos-go v0.12.2/go.mod h1:ZcqYgnfNJ6lAXe4HPtWgarNEY+B74i+2/8MhZw4ziiI= -github.com/cosmos/rosetta-sdk-go v0.10.0 h1:E5RhTruuoA7KTIXUcMicL76cffyeoyvNybzUGSKFTcM= -github.com/cosmos/rosetta-sdk-go v0.10.0/go.mod h1:SImAZkb96YbwvoRkzSMQB6noNJXFgWl/ENIznEoYQI4= github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w= diff --git a/testutil/testdata/unknonwnproto.pb.go b/testutil/testdata/unknonwnproto.pb.go index 3522a72535..fcffd26d8e 100644 --- a/testutil/testdata/unknonwnproto.pb.go +++ b/testutil/testdata/unknonwnproto.pb.go @@ -715,7 +715,6 @@ type Customer3 struct { Surcharge float32 `protobuf:"fixed32,4,opt,name=surcharge,proto3" json:"surcharge,omitempty"` Destination string `protobuf:"bytes,5,opt,name=destination,proto3" json:"destination,omitempty"` // Types that are valid to be assigned to Payment: - // // *Customer3_CreditCardNo // *Customer3_ChequeNo Payment isCustomer3_Payment `protobuf_oneof:"payment"` @@ -849,7 +848,6 @@ type TestVersion1 struct { C []*TestVersion1 `protobuf:"bytes,4,rep,name=c,proto3" json:"c,omitempty"` D []TestVersion1 `protobuf:"bytes,5,rep,name=d,proto3" json:"d"` // Types that are valid to be assigned to Sum: - // // *TestVersion1_E // *TestVersion1_F Sum isTestVersion1_Sum `protobuf_oneof:"sum"` @@ -994,7 +992,6 @@ type TestVersion2 struct { C []*TestVersion2 `protobuf:"bytes,4,rep,name=c,proto3" json:"c,omitempty"` D []*TestVersion2 `protobuf:"bytes,5,rep,name=d,proto3" json:"d,omitempty"` // Types that are valid to be assigned to Sum: - // // *TestVersion2_E // *TestVersion2_F Sum isTestVersion2_Sum `protobuf_oneof:"sum"` @@ -1147,7 +1144,6 @@ type TestVersion3 struct { C []*TestVersion3 `protobuf:"bytes,4,rep,name=c,proto3" json:"c,omitempty"` D []*TestVersion3 `protobuf:"bytes,5,rep,name=d,proto3" json:"d,omitempty"` // Types that are valid to be assigned to Sum: - // // *TestVersion3_E // *TestVersion3_F Sum isTestVersion3_Sum `protobuf_oneof:"sum"` @@ -1300,7 +1296,6 @@ type TestVersion3LoneOneOfValue struct { C []*TestVersion3 `protobuf:"bytes,4,rep,name=c,proto3" json:"c,omitempty"` D []*TestVersion3 `protobuf:"bytes,5,rep,name=d,proto3" json:"d,omitempty"` // Types that are valid to be assigned to Sum: - // // *TestVersion3LoneOneOfValue_E Sum isTestVersion3LoneOneOfValue_Sum `protobuf_oneof:"sum"` G *types.Any `protobuf:"bytes,8,opt,name=g,proto3" json:"g,omitempty"` @@ -1440,7 +1435,6 @@ type TestVersion3LoneNesting struct { C []*TestVersion3 `protobuf:"bytes,4,rep,name=c,proto3" json:"c,omitempty"` D []*TestVersion3 `protobuf:"bytes,5,rep,name=d,proto3" json:"d,omitempty"` // Types that are valid to be assigned to Sum: - // // *TestVersion3LoneNesting_F Sum isTestVersion3LoneNesting_Sum `protobuf_oneof:"sum"` G *types.Any `protobuf:"bytes,8,opt,name=g,proto3" json:"g,omitempty"` @@ -1828,7 +1822,6 @@ type TestVersion4LoneNesting struct { C []*TestVersion3 `protobuf:"bytes,4,rep,name=c,proto3" json:"c,omitempty"` D []*TestVersion3 `protobuf:"bytes,5,rep,name=d,proto3" json:"d,omitempty"` // Types that are valid to be assigned to Sum: - // // *TestVersion4LoneNesting_F Sum isTestVersion4LoneNesting_Sum `protobuf_oneof:"sum"` G *types.Any `protobuf:"bytes,8,opt,name=g,proto3" json:"g,omitempty"` @@ -2213,7 +2206,6 @@ type TestVersionFD1 struct { X int64 `protobuf:"varint,1,opt,name=x,proto3" json:"x,omitempty"` A *TestVersion1 `protobuf:"bytes,2,opt,name=a,proto3" json:"a,omitempty"` // Types that are valid to be assigned to Sum: - // // *TestVersionFD1_E // *TestVersionFD1_F Sum isTestVersionFD1_Sum `protobuf_oneof:"sum"` @@ -2331,7 +2323,6 @@ type TestVersionFD1WithExtraAny struct { X int64 `protobuf:"varint,1,opt,name=x,proto3" json:"x,omitempty"` A *TestVersion1 `protobuf:"bytes,2,opt,name=a,proto3" json:"a,omitempty"` // Types that are valid to be assigned to Sum: - // // *TestVersionFD1WithExtraAny_E // *TestVersionFD1WithExtraAny_F Sum isTestVersionFD1WithExtraAny_Sum `protobuf_oneof:"sum"` diff --git a/types/abci.pb.go b/types/abci.pb.go index 4309e0ea54..db2a6e2be0 100644 --- a/types/abci.pb.go +++ b/types/abci.pb.go @@ -274,6 +274,8 @@ type GasInfo struct { GasUsed uint64 `protobuf:"varint,2,opt,name=gas_used,json=gasUsed,proto3" json:"gas_used,omitempty"` // MinGasPrice are the min gas price. MinGasPrice string `protobuf:"bytes,3,opt,name=min_gas_price,json=minGasPrice,proto3" json:"min_gas_price,omitempty"` + // RWUsed is the amount of r/w actually consumed. + RwUsed uint64 `protobuf:"varint,4,opt,name=rw_used,json=rwUsed,proto3" json:"rw_used,omitempty"` } func (m *GasInfo) Reset() { *m = GasInfo{} } @@ -329,6 +331,13 @@ func (m *GasInfo) GetMinGasPrice() string { return "" } +func (m *GasInfo) GetRwUsed() uint64 { + if m != nil { + return m.RwUsed + } + return 0 +} + // Result is the union of ResponseFormat and ResponseCheckTx. type Result struct { // Data is any data returned from message or handler execution. It MUST be @@ -489,6 +498,8 @@ type TxMsgData struct { // // Since: cosmos-sdk 0.46 MsgResponses []*types.Any `protobuf:"bytes,2,rep,name=msg_responses,json=msgResponses,proto3" json:"msg_responses,omitempty"` + // extra data - the r/w info + ExtraData []byte `protobuf:"bytes,3,opt,name=extra_data,json=extraData,proto3" json:"extra_data,omitempty"` } func (m *TxMsgData) Reset() { *m = TxMsgData{} } @@ -538,6 +549,13 @@ func (m *TxMsgData) GetMsgResponses() []*types.Any { return nil } +func (m *TxMsgData) GetExtraData() []byte { + if m != nil { + return m.ExtraData + } + return nil +} + // SearchTxsResult defines a structure for querying txs pageable type SearchTxsResult struct { // Count of all txs @@ -646,66 +664,67 @@ func init() { } var fileDescriptor_4e37629bc7eb0df8 = []byte{ - // 931 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x55, 0x4d, 0x8f, 0x1b, 0x45, - 0x10, 0xf5, 0xd8, 0x93, 0xf1, 0xba, 0xbc, 0x26, 0xa8, 0xb5, 0xda, 0xcc, 0x06, 0xb0, 0x8d, 0x13, - 0x24, 0x0b, 0x89, 0xb1, 0xb2, 0x89, 0x10, 0xc9, 0x29, 0x71, 0x80, 0xb0, 0x52, 0x82, 0xd0, 0xac, - 0x23, 0x24, 0x2e, 0x56, 0xdb, 0xee, 0xb4, 0x47, 0xf1, 0x4c, 0x5b, 0xd3, 0xed, 0x5d, 0xef, 0x8d, - 0x1b, 0x1c, 0x39, 0x71, 0xe6, 0x0a,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, 0x64, 0x15, - 0x68, 0x1d, 0x3c, 0x36, 0xe5, 0x52, 0xf4, 0xb3, 0x59, 0x3a, 0x10, 0x39, 0xa9, 0xcf, 0x8f, 0x01, - 0xa1, 0x6f, 0x09, 0x41, 0x69, 0x53, 0x02, 0x55, 0xa2, 0x67, 0xda, 0x8f, 0x2b, 0x88, 0xf4, 0x10, - 0xc0, 0xaa, 0x93, 0x24, 0x4d, 0x0c, 0x3d, 0xd6, 0x7e, 0x6c, 0x1d, 0xf6, 0x39, 0x94, 0xcc, 0x5c, - 0x87, 0x01, 0xcd, 0x75, 0x73, 0x33, 0x37, 0xab, 0x4f, 0x4c, 0x8c, 0x07, 0xec, 0x78, 0xdd, 0xfb, - 0x2f, 0xff, 0xa9, 0x17, 0x5e, 0x9c, 0xd7, 0xbd, 0xd3, 0xf3, 0xba, 0xf7, 0xf7, 0x79, 0xdd, 0xfb, - 0xe5, 0xa2, 0x5e, 0x38, 0xbd, 0xa8, 0x17, 0x5e, 0x5e, 0xd4, 0x0b, 0x3f, 0xb4, 0x64, 0x62, 0xc6, - 0xb3, 0x41, 0x34, 0x54, 0x69, 0xc7, 0x7d, 0x32, 0xed, 0xcf, 0x67, 0x7a, 0xf4, 0xdc, 0x7e, 0xdf, - 0x06, 0x01, 0x51, 0x78, 0xfb, 0xbf, 0x00, 0x00, 0x00, 0xff, 0xff, 0xe3, 0xca, 0xbe, 0xf4, 0x54, - 0x07, 0x00, 0x00, + // 957 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x55, 0xcf, 0x6f, 0x1b, 0x45, + 0x14, 0xf6, 0xda, 0xdb, 0x75, 0x76, 0x1c, 0x53, 0x34, 0x8a, 0xd2, 0x49, 0x01, 0xdb, 0xb8, 0x45, + 0xb2, 0x90, 0x58, 0xab, 0x69, 0x85, 0x68, 0x4f, 0xad, 0x0b, 0x94, 0x48, 0x2d, 0x42, 0x1b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m *TxResponse) Marshal() (dAtA []byte, err error) { @@ -983,6 +1002,11 @@ func (m *GasInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.RwUsed != 0 { + i = encodeVarintAbci(dAtA, i, uint64(m.RwUsed)) + i-- + dAtA[i] = 0x20 + } if len(m.MinGasPrice) > 0 { i -= len(m.MinGasPrice) copy(dAtA[i:], m.MinGasPrice) @@ -1170,6 +1194,13 @@ func (m *TxMsgData) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.ExtraData) > 0 { + i -= len(m.ExtraData) + copy(dAtA[i:], m.ExtraData) + i = encodeVarintAbci(dAtA, i, uint64(len(m.ExtraData))) + i-- + dAtA[i] = 0x1a + } if len(m.MsgResponses) > 0 { for iNdEx := len(m.MsgResponses) - 1; iNdEx >= 0; iNdEx-- { { @@ -1409,6 +1440,9 @@ func (m *GasInfo) Size() (n int) { if l > 0 { n += 1 + l + sovAbci(uint64(l)) } + if m.RwUsed != 0 { + n += 1 + sovAbci(uint64(m.RwUsed)) + } return n } @@ -1491,6 +1525,10 @@ func (m *TxMsgData) Size() (n int) { n += 1 + l + sovAbci(uint64(l)) } } + l = len(m.ExtraData) + if l > 0 { + n += 1 + l + sovAbci(uint64(l)) + } return n } @@ -1591,6 +1629,7 @@ func (this *TxMsgData) String() string { s := strings.Join([]string{`&TxMsgData{`, `Data:` + repeatedStringForData + `,`, `MsgResponses:` + repeatedStringForMsgResponses + `,`, + `ExtraData:` + fmt.Sprintf("%v", this.ExtraData) + `,`, `}`, }, "") return s @@ -2509,6 +2548,25 @@ func (m *GasInfo) Unmarshal(dAtA []byte) error { } m.MinGasPrice = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field RwUsed", wireType) + } + m.RwUsed = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAbci + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.RwUsed |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := skipAbci(dAtA[iNdEx:]) @@ -3046,6 +3104,40 @@ func (m *TxMsgData) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ExtraData", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAbci + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthAbci + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthAbci + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ExtraData = append(m.ExtraData[:0], dAtA[iNdEx:postIndex]...) + if m.ExtraData == nil { + m.ExtraData = []byte{} + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipAbci(dAtA[iNdEx:]) diff --git a/types/context.go b/types/context.go index 956765fc8d..65bd578092 100644 --- a/types/context.go +++ b/types/context.go @@ -11,6 +11,7 @@ import ( "github.com/cosmos/gogoproto/proto" lru "github.com/hashicorp/golang-lru" + "github.com/cosmos/cosmos-sdk/store/gaskv" storetypes "github.com/cosmos/cosmos-sdk/store/types" ) @@ -313,15 +314,13 @@ func (c Context) Value(key interface{}) interface{} { // ---------------------------------------------------------------------------- // KVStore fetches a KVStore from the MultiStore. -// Remove gas metering func (c Context) KVStore(key storetypes.StoreKey) storetypes.KVStore { - return c.MultiStore().GetKVStore(key) + return gaskv.NewStore(c.MultiStore().GetKVStore(key), c.gasMeter, c.kvGasConfig) } // TransientStore fetches a TransientStore from the MultiStore. -// Remove gas metering func (c Context) TransientStore(key storetypes.StoreKey) storetypes.KVStore { - return c.MultiStore().GetKVStore(key) + return gaskv.NewStore(c.MultiStore().GetKVStore(key), c.gasMeter, c.kvGasConfig) } // CacheContext returns a new Context with the multi-store cached and a new diff --git a/types/query/pagination.pb.go b/types/query/pagination.pb.go index cc37a25172..9680f298f4 100644 --- a/types/query/pagination.pb.go +++ b/types/query/pagination.pb.go @@ -25,10 +25,10 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // PageRequest is to be embedded in gRPC request messages for efficient // pagination. Ex: // -// message SomeRequest { -// Foo some_parameter = 1; -// PageRequest pagination = 2; -// } +// message SomeRequest { +// Foo some_parameter = 1; +// PageRequest pagination = 2; +// } type PageRequest struct { // key is a value returned in PageResponse.next_key to begin // querying the next page most efficiently. Only one of offset or key @@ -123,10 +123,10 @@ func (m *PageRequest) GetReverse() bool { // PageResponse is to be embedded in gRPC response messages where the // corresponding request message has used PageRequest. // -// message SomeResponse { -// repeated Bar results = 1; -// PageResponse page = 2; -// } +// message SomeResponse { +// repeated Bar results = 1; +// PageResponse page = 2; +// } type PageResponse struct { // next_key is the key to be passed to PageRequest.key to // query the next page most efficiently. It will be empty if diff --git a/types/tx/signing/signing.pb.go b/types/tx/signing/signing.pb.go index 885983f286..0be41d2029 100644 --- a/types/tx/signing/signing.pb.go +++ b/types/tx/signing/signing.pb.go @@ -218,7 +218,6 @@ type SignatureDescriptor_Data struct { // sum is the one of that specifies whether this represents single or multi-signature data // // Types that are valid to be assigned to Sum: - // // *SignatureDescriptor_Data_Single_ // *SignatureDescriptor_Data_Multi_ Sum isSignatureDescriptor_Data_Sum `protobuf_oneof:"sum"` diff --git a/types/tx/tx.pb.go b/types/tx/tx.pb.go index 4bc546be93..cf1f47d451 100644 --- a/types/tx/tx.pb.go +++ b/types/tx/tx.pb.go @@ -715,7 +715,6 @@ type ModeInfo struct { // multisig signer // // Types that are valid to be assigned to Sum: - // // *ModeInfo_Single_ // *ModeInfo_Multi_ Sum isModeInfo_Sum `protobuf_oneof:"sum"` diff --git a/x/capability/keeper/keeper.go b/x/capability/keeper/keeper.go index 1fa6d03051..f0ca54818a 100644 --- a/x/capability/keeper/keeper.go +++ b/x/capability/keeper/keeper.go @@ -119,7 +119,7 @@ func (k *Keeper) InitMemStore(ctx sdk.Context) { } // create context with no block gas meter to ensure we do not consume gas during local initialization logic. - noGasCtx := ctx.WithBlockGasMeter(sdk.NewInfiniteGasMeter()) + noGasCtx := ctx.WithBlockGasMeter(sdk.NewInfiniteGasMeter()).WithGasMeter(sdk.NewInfiniteGasMeter()) // check if memory store has not been initialized yet by checking if initialized flag is nil. if !k.IsInitialized(noGasCtx) { diff --git a/x/distribution/types/distribution.pb.go b/x/distribution/types/distribution.pb.go index 03ce9ef5f4..5a8295d590 100644 --- a/x/distribution/types/distribution.pb.go +++ b/x/distribution/types/distribution.pb.go @@ -85,12 +85,11 @@ func (m *Params) GetWithdrawAddrEnabled() bool { // The reference count indicates the number of objects // which might need to reference this historical entry at any point. // ReferenceCount = -// -// number of outstanding delegations which ended the associated period (and -// might need to read that record) -// + number of slashes which ended the associated period (and might need to -// read that record) -// + one per validator for the zeroeth period, set on initialization +// number of outstanding delegations which ended the associated period (and +// might need to read that record) +// + number of slashes which ended the associated period (and might need to +// read that record) +// + one per validator for the zeroeth period, set on initialization type ValidatorHistoricalRewards struct { CumulativeRewardRatio github_com_cosmos_cosmos_sdk_types.DecCoins `protobuf:"bytes,1,rep,name=cumulative_reward_ratio,json=cumulativeRewardRatio,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.DecCoins" json:"cumulative_reward_ratio"` ReferenceCount uint32 `protobuf:"varint,2,opt,name=reference_count,json=referenceCount,proto3" json:"reference_count,omitempty"` diff --git a/x/gashub/types/gashub.pb.go b/x/gashub/types/gashub.pb.go index ac8079f797..ae6b6d354c 100644 --- a/x/gashub/types/gashub.pb.go +++ b/x/gashub/types/gashub.pb.go @@ -85,7 +85,6 @@ type MsgGasParams struct { // gas_params is the oneof that represents either fixed_gas_params or dynamic_gas_params // // Types that are valid to be assigned to GasParams: - // // *MsgGasParams_FixedType // *MsgGasParams_GrantType // *MsgGasParams_MultiSendType diff --git a/x/gov/types/v1/gov.pb.go b/x/gov/types/v1/gov.pb.go index 4a2b5d6e26..3dec8ec332 100644 --- a/x/gov/types/v1/gov.pb.go +++ b/x/gov/types/v1/gov.pb.go @@ -738,15 +738,15 @@ type Params struct { MaxDepositPeriod *time.Duration `protobuf:"bytes,2,opt,name=max_deposit_period,json=maxDepositPeriod,proto3,stdduration" json:"max_deposit_period,omitempty"` // Duration of the voting period. VotingPeriod *time.Duration `protobuf:"bytes,3,opt,name=voting_period,json=votingPeriod,proto3,stdduration" json:"voting_period,omitempty"` - // Minimum percentage of total stake needed to vote for a result to be - // considered valid. + // Minimum percentage of total stake needed to vote for a result to be + // considered valid. Quorum string `protobuf:"bytes,4,opt,name=quorum,proto3" json:"quorum,omitempty"` - // Minimum proportion of Yes votes for proposal to pass. Default value: 0.5. + // Minimum proportion of Yes votes for proposal to pass. Default value: 0.5. Threshold string `protobuf:"bytes,5,opt,name=threshold,proto3" json:"threshold,omitempty"` - // Minimum value of Veto votes to Total votes ratio for proposal to be - // vetoed. Default value: 1/3. + // Minimum value of Veto votes to Total votes ratio for proposal to be + // vetoed. Default value: 1/3. VetoThreshold string `protobuf:"bytes,6,opt,name=veto_threshold,json=vetoThreshold,proto3" json:"veto_threshold,omitempty"` - // The ratio representing the proportion of the deposit value that must be paid at proposal submission. + // The ratio representing the proportion of the deposit value that must be paid at proposal submission. MinInitialDepositRatio string `protobuf:"bytes,7,opt,name=min_initial_deposit_ratio,json=minInitialDepositRatio,proto3" json:"min_initial_deposit_ratio,omitempty"` // burn deposits if a proposal does not meet quorum BurnVoteQuorum bool `protobuf:"varint,13,opt,name=burn_vote_quorum,json=burnVoteQuorum,proto3" json:"burn_vote_quorum,omitempty"` diff --git a/x/group/internal/orm/testsupport.go b/x/group/internal/orm/testsupport.go index 417eac3ba5..2a910ce292 100644 --- a/x/group/internal/orm/testsupport.go +++ b/x/group/internal/orm/testsupport.go @@ -74,6 +74,14 @@ func (d debuggingGasMeter) String() string { return d.g.String() } +func (d debuggingGasMeter) RwConsumed() storetypes.Gas { + return d.g.RwConsumed() +} + +func (d debuggingGasMeter) ConsumeRw(amount storetypes.Gas, descriptor string) { + d.g.ConsumeRw(amount, descriptor) +} + type GasCountingMockContext struct { GasMeter sdk.GasMeter } diff --git a/x/group/types.pb.go b/x/group/types.pb.go index f375179d8d..16cb87020e 100644 --- a/x/group/types.pb.go +++ b/x/group/types.pb.go @@ -298,10 +298,10 @@ func (m *MemberRequest) GetMetadata() string { // ThresholdDecisionPolicy is a decision policy where a proposal passes when it // satisfies the two following conditions: -// 1. The sum of all `YES` voter's weights is greater or equal than the defined -// `threshold`. -// 2. The voting and execution periods of the proposal respect the parameters -// given by `windows`. +// 1. The sum of all `YES` voter's weights is greater or equal than the defined +// `threshold`. +// 2. The voting and execution periods of the proposal respect the parameters +// given by `windows`. type ThresholdDecisionPolicy struct { // threshold is the minimum weighted sum of `YES` votes that must be met or // exceeded for a proposal to succeed. @@ -359,10 +359,10 @@ func (m *ThresholdDecisionPolicy) GetWindows() *DecisionPolicyWindows { // PercentageDecisionPolicy is a decision policy where a proposal passes when // it satisfies the two following conditions: -// 1. The percentage of all `YES` voters' weights out of the total group weight -// is greater or equal than the given `percentage`. -// 2. The voting and execution periods of the proposal respect the parameters -// given by `windows`. +// 1. The percentage of all `YES` voters' weights out of the total group weight +// is greater or equal than the given `percentage`. +// 2. The voting and execution periods of the proposal respect the parameters +// given by `windows`. type PercentageDecisionPolicy struct { // percentage is the minimum percentage of the weighted sum of `YES` votes must // meet for a proposal to succeed. From 2e24113336e2f028ab90068f2ae04888614d4964 Mon Sep 17 00:00:00 2001 From: dylanhuang Date: Wed, 16 Aug 2023 11:30:50 +0800 Subject: [PATCH 8/9] feat: skip sig verification on genesis block (#273) * feat: skip sig verification on genesis block * fix: skip SigGasConsume on genesis block * chore: fix test case --- Makefile | 2 +- tests/e2e/genutil/suite.go | 8 +-- x/auth/ante/ante_test.go | 9 ++-- x/auth/ante/sigverify.go | 13 +++++ x/auth/tx/decoder.go | 5 ++ x/genutil/client/cli/gentx.go | 91 ++++++++++++++--------------------- 6 files changed, 63 insertions(+), 65 deletions(-) diff --git a/Makefile b/Makefile index d9e2e24c81..87c24652b2 100644 --- a/Makefile +++ b/Makefile @@ -110,7 +110,7 @@ include contrib/devtools/Makefile ############################################################################### BUILD_TARGETS := build install - +.PHONY: build build-linux-amd64 build-linux-arm64 build: BUILD_ARGS=-o $(BUILDDIR)/ build-linux-amd64: diff --git a/tests/e2e/genutil/suite.go b/tests/e2e/genutil/suite.go index 5a4d2458bd..220666a753 100644 --- a/tests/e2e/genutil/suite.go +++ b/tests/e2e/genutil/suite.go @@ -67,11 +67,11 @@ func (s *E2ETestSuite) TestGenTxCmd() { args: []string{ fmt.Sprintf("--%s=%s", flags.FlagChainID, s.network.Config.ChainID), fmt.Sprintf("--%s=1", stakingcli.FlagCommissionRate), - val.Moniker, amount.String(), val.Address.String(), val.Address.String(), val.Address.String(), + val.Address.String(), blsPk, }, expError: true, @@ -80,11 +80,11 @@ func (s *E2ETestSuite) TestGenTxCmd() { name: "valid gentx", args: []string{ fmt.Sprintf("--%s=%s", flags.FlagChainID, s.network.Config.ChainID), - val.Moniker, amount.String(), val.Address.String(), val.Address.String(), val.Address.String(), + val.Address.String(), blsPk, blsProof, }, @@ -95,11 +95,11 @@ func (s *E2ETestSuite) TestGenTxCmd() { args: []string{ fmt.Sprintf("--%s=%s", flags.FlagChainID, s.network.Config.ChainID), fmt.Sprintf("--%s={\"key\":\"BOIkjkFruMpfOFC9oNPhiJGfmY2pHF/gwHdLDLnrnS0=\"}", stakingcli.FlagPubKey), - val.Moniker, amount.String(), val.Address.String(), val.Address.String(), val.Address.String(), + val.Address.String(), blsPk, blsProof, }, @@ -110,11 +110,11 @@ func (s *E2ETestSuite) TestGenTxCmd() { args: []string{ fmt.Sprintf("--%s=%s", flags.FlagChainID, s.network.Config.ChainID), fmt.Sprintf("--%s={\"@type\":\"/cosmos.crypto.ed25519.PubKey\",\"key\":\"BOIkjkFruMpfOFC9oNPhiJGfmY2pHF/gwHdLDLnrnS0=\"}", stakingcli.FlagPubKey), - val.Moniker, amount.String(), val.Address.String(), val.Address.String(), val.Address.String(), + val.Address.String(), blsPk, blsProof, }, diff --git a/x/auth/ante/ante_test.go b/x/auth/ante/ante_test.go index ccaaaf1271..88f49c7f13 100644 --- a/x/auth/ante/ante_test.go +++ b/x/auth/ante/ante_test.go @@ -351,8 +351,8 @@ func TestAnteHandlerAccountNumbersAtBlockHeightZero(t *testing.T) { } }, false, - false, - sdkerrors.ErrUnauthorized, + true, + nil, }, { "new tx with another signer and incorrect account numbers", @@ -371,8 +371,8 @@ func TestAnteHandlerAccountNumbersAtBlockHeightZero(t *testing.T) { } }, false, - false, - sdkerrors.ErrUnauthorized, + true, + nil, }, { "new tx with another signer and correct account numbers", @@ -398,6 +398,7 @@ func TestAnteHandlerAccountNumbersAtBlockHeightZero(t *testing.T) { for _, tc := range testCases { t.Run(fmt.Sprintf("Case %s", tc.desc), func(t *testing.T) { + t.Log(tc.desc) suite := SetupTestSuite(t, false) suite.ctx = suite.ctx.WithBlockHeight(0) suite.txBuilder = suite.clientCtx.TxConfig.NewTxBuilder() diff --git a/x/auth/ante/sigverify.go b/x/auth/ante/sigverify.go index af571b9d3d..ceb9f82604 100644 --- a/x/auth/ante/sigverify.go +++ b/x/auth/ante/sigverify.go @@ -56,6 +56,11 @@ func NewSetPubKeyDecorator(ak AccountKeeper) SetPubKeyDecorator { } func (spkd SetPubKeyDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (sdk.Context, error) { + if ctx.BlockHeight() == 0 { + // skip the signature verification on the genesis block + return next(ctx, tx, simulate) + } + sigTx, ok := tx.(authsigning.SigVerifiableTx) if !ok { return ctx, sdkerrors.Wrap(sdkerrors.ErrTxDecode, "invalid tx type") @@ -148,6 +153,10 @@ func NewSigGasConsumeDecorator(ak AccountKeeper, sigGasConsumer SignatureVerific } func (sgcd SigGasConsumeDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (newCtx sdk.Context, err error) { + if ctx.BlockHeight() == 0 { + // skip the signature verification on the genesis block + return next(ctx, tx, simulate) + } sigTx, ok := tx.(authsigning.SigVerifiableTx) if !ok { return ctx, sdkerrors.Wrap(sdkerrors.ErrTxDecode, "invalid transaction type") @@ -234,6 +243,10 @@ func OnlyLegacyAminoSigners(sigData signing.SignatureData) bool { } func (svd SigVerificationDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (newCtx sdk.Context, err error) { + if ctx.BlockHeight() == 0 { + // skip the signature verification on the genesis block + return next(ctx, tx, simulate) + } sigTx, ok := tx.(authsigning.SigVerifiableTx) if !ok { return ctx, sdkerrors.Wrap(sdkerrors.ErrTxDecode, "invalid transaction type") diff --git a/x/auth/tx/decoder.go b/x/auth/tx/decoder.go index 2fef6312b9..7ef538fbb4 100644 --- a/x/auth/tx/decoder.go +++ b/x/auth/tx/decoder.go @@ -168,3 +168,8 @@ func varintMinLength(n uint64) int { return 10 } } + +// UnWrapTx returns the underlying Tx. +func UnWrapTx(tx sdk.Tx) *tx.Tx { + return tx.(*wrapper).tx +} diff --git a/x/genutil/client/cli/gentx.go b/x/genutil/client/cli/gentx.go index 82b4d04879..ab9e9ebb3f 100644 --- a/x/genutil/client/cli/gentx.go +++ b/x/genutil/client/cli/gentx.go @@ -16,12 +16,11 @@ import ( "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/client/tx" - "github.com/cosmos/cosmos-sdk/crypto/keyring" "github.com/cosmos/cosmos-sdk/server" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" "github.com/cosmos/cosmos-sdk/version" - authclient "github.com/cosmos/cosmos-sdk/x/auth/client" + authTx "github.com/cosmos/cosmos-sdk/x/auth/tx" "github.com/cosmos/cosmos-sdk/x/genutil" "github.com/cosmos/cosmos-sdk/x/genutil/types" "github.com/cosmos/cosmos-sdk/x/staking/client/cli" @@ -33,7 +32,7 @@ func GenTxCmd(mbm module.BasicManager, txEncCfg client.TxEncodingConfig, genBalI fsCreateValidator, defaultsDesc := cli.CreateValidatorMsgFlagSet(ipDefault) cmd := &cobra.Command{ - Use: "gentx [key_name] [amount] [validator] [relayer] [challenger] [blskey] [blsProof]", + Use: "gentx [amount] [validator] [delegator] [relayer] [challenger] [blskey] [blsProof]", Short: "Generate a genesis tx carrying a self delegation", Args: cobra.ExactArgs(7), Long: fmt.Sprintf(`Generate a genesis transaction that creates a validator with a self-delegation, @@ -43,7 +42,8 @@ file. The following default parameters are included: %s Example: -$ %s gentx my-key-name 1000000stake \ +$ %s gentx 1000000stake \ + 0x6D967dc83b625603c963713eABd5B43A281E595e \ 0x6D967dc83b625603c963713eABd5B43A281E595e \ 0xcdd393723f1Af81faa3F3c87B51dAB72B6c68154 \ ac1e598ae0ccbeeaafa31bc6faefa85c2ae3138699cac79169cd718f1a38445201454ec092a86f200e08a15266bdc6e9 \ @@ -102,12 +102,6 @@ $ %s gentx my-key-name 1000000stake \ inBuf := bufio.NewReader(cmd.InOrStdin()) - name := args[0] - key, err := clientCtx.Keyring.Key(name) - if err != nil { - return errors.Wrapf(err, "failed to fetch '%s' from the keyring", name) - } - moniker := config.Moniker if m, _ := cmd.Flags().GetString(cli.FlagMoniker); m != "" { moniker = m @@ -119,30 +113,47 @@ $ %s gentx my-key-name 1000000stake \ return errors.Wrap(err, "error creating configuration to create validator msg") } - amount := args[1] + amount := args[0] coins, err := sdk.ParseCoinsNormalized(amount) if err != nil { return errors.Wrap(err, "failed to parse coins") } - addr, err := key.GetAddress() + validator, err := sdk.AccAddressFromHexUnsafe(args[1]) if err != nil { return err } - err = genutil.ValidateAccountInGenesis(genesisState, genBalIterator, addr, coins, cdc) + delegator, err := sdk.AccAddressFromHexUnsafe(args[2]) if err != nil { - return errors.Wrap(err, "failed to validate account in genesis") + return err } - - txFactory, err := tx.NewFactoryCLI(clientCtx, cmd.Flags()) + relayer, err := sdk.AccAddressFromHexUnsafe(args[3]) if err != nil { return err } + challenger, err := sdk.AccAddressFromHexUnsafe(args[4]) + if err != nil { + return err + } + blsPk := args[5] + if len(blsPk) != 2*sdk.BLSPubKeyLength { + return fmt.Errorf("invalid bls pubkey") + } + blsProof := args[6] + if len(blsProof) != 2*sdk.BLSSignatureLength { + return fmt.Errorf("invalid bls proof, len: %d", len(blsProof)) + } - pub, err := key.GetAddress() + err = genutil.ValidateAccountInGenesis(genesisState, genBalIterator, delegator, coins, cdc) + if err != nil { + return errors.Wrap(err, "failed to validate account in genesis") + } + + txFactory, err := tx.NewFactoryCLI(clientCtx, cmd.Flags()) if err != nil { return err } - clientCtx = clientCtx.WithInput(inBuf).WithFromAddress(pub) + + clientCtx = clientCtx.WithInput(inBuf).WithFromAddress(delegator) // The following line comes from a discrepancy between the `gentx` // and `create-validator` commands: @@ -156,30 +167,8 @@ $ %s gentx my-key-name 1000000stake \ // config file instead of so many flags. // ref: https://github.com/cosmos/cosmos-sdk/issues/8177 createValCfg.Amount = amount - - validator, err := sdk.AccAddressFromHexUnsafe(args[2]) - if err != nil { - return err - } - relayer, err := sdk.AccAddressFromHexUnsafe(args[3]) - if err != nil { - return err - } - challenger, err := sdk.AccAddressFromHexUnsafe(args[4]) - if err != nil { - return err - } - blsPk := args[5] - if len(blsPk) != 2*sdk.BLSPubKeyLength { - return fmt.Errorf("invalid bls pubkey") - } - blsProof := args[6] - if len(blsProof) != 2*sdk.BLSSignatureLength { - return fmt.Errorf("invalid bls proof, len: %d", len(blsProof)) - } - createValCfg.Validator = validator - createValCfg.Delegator = addr + createValCfg.Delegator = delegator createValCfg.Relayer = relayer createValCfg.Challenger = challenger createValCfg.BlsKey = blsPk @@ -191,11 +180,6 @@ $ %s gentx my-key-name 1000000stake \ return errors.Wrap(err, "failed to build create-validator message") } - if key.GetType() == keyring.TypeOffline || key.GetType() == keyring.TypeMulti { - cmd.PrintErrln("Offline key passed in. Use `tx sign` command to sign.") - return txBldr.PrintUnsignedTx(clientCtx, msg) - } - // write the unsigned transaction to the buffer w := bytes.NewBuffer([]byte{}) clientCtx = clientCtx.WithOutput(w) @@ -214,16 +198,11 @@ $ %s gentx my-key-name 1000000stake \ return errors.Wrap(err, "failed to read unsigned gen tx file") } - // sign the transaction and write it to the output file - txBuilder, err := clientCtx.TxConfig.WrapTxBuilder(stdTx) - if err != nil { - return fmt.Errorf("error creating tx builder: %w", err) - } - - err = authclient.SignTx(txFactory, clientCtx, name, txBuilder, true, true) - if err != nil { - return errors.Wrap(err, "failed to sign std tx") - } + // sig verification will skip in the genesis block, + // but still need a data to be set in Tx to skip the basic validation. + underlyingTx := authTx.UnWrapTx(stdTx) + underlyingTx.Signatures = [][]byte{[]byte(fmt.Sprintf("genesis create validator [%s]", createValCfg.Moniker))} + stdTx = underlyingTx outputDocument, _ := cmd.Flags().GetString(flags.FlagOutputDocument) if outputDocument == "" { From 259b456644335c267c71b09da1f7ece959382b72 Mon Sep 17 00:00:00 2001 From: randyahx <62416962+randyahx@users.noreply.github.com> Date: Wed, 16 Aug 2023 15:29:05 +0800 Subject: [PATCH 9/9] release: draft release for v0.2.4-alpha.2 (#274) * Update CHANGELOG.md * update dependencies * update dependencies --- CHANGELOG.md | 13 +++++++++++++ go.mod | 4 ++-- go.sum | 4 ++-- simapp/go.mod | 6 +++--- simapp/go.sum | 8 ++++---- tests/go.mod | 6 +++--- tests/go.sum | 8 ++++---- 7 files changed, 31 insertions(+), 18 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e33ecc2827..2257948352 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,18 @@ # Changelog +## v0.2.4-alpha.2 +This release includes 5 new features. + +Features: +* [#266](https://github.com/bnb-chain/greenfield-cosmos-sdk/pull/266) feat: implement cross-chain mechanism between op and greenfield +* [#267](https://github.com/bnb-chain/greenfield-cosmos-sdk/pull/267) feat: add method to access check state in app +* [#269](https://github.com/bnb-chain/greenfield-cosmos-sdk/pull/269) feat: track store r/w consume for enabling plain store +* [#270](https://github.com/bnb-chain/greenfield-cosmos-sdk/pull/270) feat: make cross-chain token mintable +* [#273](https://github.com/bnb-chain/greenfield-cosmos-sdk/pull/273) feat: skip sig verification on genesis block + +Chores: +* [#268](https://github.com/bnb-chain/greenfield-cosmos-sdk/pull/268) chore: modify default gas + ## v0.2.4-alpha.1 This release includes 4 features and 1 bugfix. diff --git a/go.mod b/go.mod index da4ec18c59..91403f8cf4 100644 --- a/go.mod +++ b/go.mod @@ -17,7 +17,7 @@ require ( github.com/btcsuite/btcd/btcutil v1.1.2 github.com/chzyer/readline v1.5.1 github.com/cockroachdb/apd/v2 v2.0.2 - github.com/cometbft/cometbft v0.37.1 + github.com/cometbft/cometbft v0.37.2 github.com/cometbft/cometbft-db v0.7.0 github.com/confio/ics23/go v0.9.0 github.com/cosmos/btcutil v1.0.5 @@ -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.0-20230815065708-123390673ba9 + github.com/cometbft/cometbft => github.com/bnb-chain/greenfield-cometbft v0.0.3-alpha.1 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 diff --git a/go.sum b/go.sum index 8454566f1f..137bf1712c 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.0-20230815065708-123390673ba9 h1:cNBk5OONdlqg9tt1H/XTNIhz97v0DVBINFNi+wk/sfY= -github.com/bnb-chain/greenfield-cometbft v0.0.0-20230815065708-123390673ba9/go.mod h1:3nGT4Z9fHwgRlBY/rofn0rSarnIcNbuhz/eq0XlLlkg= +github.com/bnb-chain/greenfield-cometbft v0.0.3-alpha.1 h1:nCLXxYdkDIh5bQMxtb14TBwiut/xq2e0DqPVTLy9vtI= +github.com/bnb-chain/greenfield-cometbft v0.0.3-alpha.1/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 h1:y3L64GU99otNp27/xLVBTDbv4eroR6CzoYz0rbaVotM= diff --git a/simapp/go.mod b/simapp/go.mod index 0e8bdd1c71..e9da3dbf6c 100644 --- a/simapp/go.mod +++ b/simapp/go.mod @@ -7,7 +7,7 @@ require ( cosmossdk.io/core v0.6.1 cosmossdk.io/depinject v1.0.0-alpha.3 cosmossdk.io/math v1.0.1 - github.com/cometbft/cometbft v0.37.1 + github.com/cometbft/cometbft v0.37.2 github.com/cometbft/cometbft-db v0.7.0 github.com/cosmos/cosmos-sdk v0.47.2 github.com/golang/mock v1.6.0 @@ -163,12 +163,12 @@ 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.0-20230815065708-123390673ba9 + github.com/cometbft/cometbft => github.com/bnb-chain/greenfield-cometbft v0.0.3-alpha.1 github.com/cometbft/cometbft-db => github.com/bnb-chain/greenfield-cometbft-db v0.8.1-alpha.1 // Simapp always use the latest version of the cosmos-sdk github.com/cosmos/cosmos-sdk => ../. - github.com/cosmos/iavl => github.com/bnb-chain/greenfield-iavl v0.20.1-alpha.1 + github.com/cosmos/iavl => github.com/bnb-chain/greenfield-iavl v0.20.1 // Downgraded to avoid bugs in following commits which caused simulations to fail. github.com/gin-gonic/gin => github.com/gin-gonic/gin v1.9.0 // Fix upstream GHSA-h395-qcrw-5vmq and GHSA-3vp4-m3rf-835h vulnerabilities. diff --git a/simapp/go.sum b/simapp/go.sum index cc9523d5d6..9231bc0cdc 100644 --- a/simapp/go.sum +++ b/simapp/go.sum @@ -157,12 +157,12 @@ github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kB github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816 h1:41iFGWnSlI2gVpmOtVTJZNodLdLQLn/KsJqFvXwnd/s= github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= github.com/bmizerany/pat v0.0.0-20170815010413-6226ea591a40/go.mod h1:8rLXio+WjiTceGBHIoTvn60HIbs7Hm7bcHjyrSqYB9c= -github.com/bnb-chain/greenfield-cometbft v0.0.0-20230815065708-123390673ba9 h1:cNBk5OONdlqg9tt1H/XTNIhz97v0DVBINFNi+wk/sfY= -github.com/bnb-chain/greenfield-cometbft v0.0.0-20230815065708-123390673ba9/go.mod h1:3nGT4Z9fHwgRlBY/rofn0rSarnIcNbuhz/eq0XlLlkg= +github.com/bnb-chain/greenfield-cometbft v0.0.3-alpha.1 h1:nCLXxYdkDIh5bQMxtb14TBwiut/xq2e0DqPVTLy9vtI= +github.com/bnb-chain/greenfield-cometbft v0.0.3-alpha.1/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= -github.com/bnb-chain/greenfield-iavl v0.20.1-alpha.1/go.mod h1:oLksTs8dfh7DYIKBro7hbRQ+ewls7ghJ27pIXlbEXyI= +github.com/bnb-chain/greenfield-iavl v0.20.1 h1:y3L64GU99otNp27/xLVBTDbv4eroR6CzoYz0rbaVotM= +github.com/bnb-chain/greenfield-iavl v0.20.1/go.mod h1:oLksTs8dfh7DYIKBro7hbRQ+ewls7ghJ27pIXlbEXyI= github.com/boltdb/bolt v1.3.1/go.mod h1:clJnj/oiGkjum5o1McbSZDSLxVThjynRyGBgiAx27Ps= github.com/bradfitz/go-smtpd v0.0.0-20170404230938-deb6d6237625/go.mod h1:HYsPBTaaSFSlLx/70C2HPIMNZpVV8+vt/A+FMnYP11g= github.com/bradfitz/gomemcache v0.0.0-20170208213004-1952afaa557d/go.mod h1:PmM6Mmwb0LSuEubjR8N7PtNe1KxZLtOUHtbeikc5h60= diff --git a/tests/go.mod b/tests/go.mod index 58e8be5fb5..6337658156 100644 --- a/tests/go.mod +++ b/tests/go.mod @@ -7,7 +7,7 @@ require ( cosmossdk.io/depinject v1.0.0-alpha.3 cosmossdk.io/math v1.0.1 cosmossdk.io/simapp v0.0.0-00010101000000-000000000000 - github.com/cometbft/cometbft v0.37.1 + github.com/cometbft/cometbft v0.37.2 github.com/cometbft/cometbft-db v0.7.0 github.com/cosmos/cosmos-sdk v0.47.2 github.com/cosmos/gogoproto v1.4.10 @@ -166,12 +166,12 @@ 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.0-20230815065708-123390673ba9 + github.com/cometbft/cometbft => github.com/bnb-chain/greenfield-cometbft v0.0.3-alpha.1 github.com/cometbft/cometbft-db => github.com/bnb-chain/greenfield-cometbft-db v0.8.1-alpha.1 // We always want to test against the latest version of the SDK. github.com/cosmos/cosmos-sdk => ../. - github.com/cosmos/iavl => github.com/bnb-chain/greenfield-iavl v0.0.0-20230709010548-149ad7453fba + github.com/cosmos/iavl => github.com/bnb-chain/greenfield-iavl v0.20.1 github.com/gin-gonic/gin => github.com/gin-gonic/gin v1.9.0 // Fix upstream GHSA-h395-qcrw-5vmq and GHSA-3vp4-m3rf-835h vulnerabilities. // TODO Remove it: https://github.com/cosmos/cosmos-sdk/issues/10409 diff --git a/tests/go.sum b/tests/go.sum index c6749e3bf5..2059cc3a0b 100644 --- a/tests/go.sum +++ b/tests/go.sum @@ -157,12 +157,12 @@ github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kB github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816 h1:41iFGWnSlI2gVpmOtVTJZNodLdLQLn/KsJqFvXwnd/s= github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= github.com/bmizerany/pat v0.0.0-20170815010413-6226ea591a40/go.mod h1:8rLXio+WjiTceGBHIoTvn60HIbs7Hm7bcHjyrSqYB9c= -github.com/bnb-chain/greenfield-cometbft v0.0.0-20230815065708-123390673ba9 h1:cNBk5OONdlqg9tt1H/XTNIhz97v0DVBINFNi+wk/sfY= -github.com/bnb-chain/greenfield-cometbft v0.0.0-20230815065708-123390673ba9/go.mod h1:3nGT4Z9fHwgRlBY/rofn0rSarnIcNbuhz/eq0XlLlkg= +github.com/bnb-chain/greenfield-cometbft v0.0.3-alpha.1 h1:nCLXxYdkDIh5bQMxtb14TBwiut/xq2e0DqPVTLy9vtI= +github.com/bnb-chain/greenfield-cometbft v0.0.3-alpha.1/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.0.0-20230709010548-149ad7453fba h1:e2vklUSGlVZnE6Vj0YVBV7odB2xaYc+D0B9hQgF/3tM= -github.com/bnb-chain/greenfield-iavl v0.0.0-20230709010548-149ad7453fba/go.mod h1:oLksTs8dfh7DYIKBro7hbRQ+ewls7ghJ27pIXlbEXyI= +github.com/bnb-chain/greenfield-iavl v0.20.1 h1:y3L64GU99otNp27/xLVBTDbv4eroR6CzoYz0rbaVotM= +github.com/bnb-chain/greenfield-iavl v0.20.1/go.mod h1:oLksTs8dfh7DYIKBro7hbRQ+ewls7ghJ27pIXlbEXyI= github.com/boltdb/bolt v1.3.1/go.mod h1:clJnj/oiGkjum5o1McbSZDSLxVThjynRyGBgiAx27Ps= github.com/bradfitz/go-smtpd v0.0.0-20170404230938-deb6d6237625/go.mod h1:HYsPBTaaSFSlLx/70C2HPIMNZpVV8+vt/A+FMnYP11g= github.com/bradfitz/gomemcache v0.0.0-20170208213004-1952afaa557d/go.mod h1:PmM6Mmwb0LSuEubjR8N7PtNe1KxZLtOUHtbeikc5h60=