diff --git a/.github/workflows/gosec.yml b/.github/workflows/gosec.yml index 3e485e7443..a7afbcf6ec 100644 --- a/.github/workflows/gosec.yml +++ b/.github/workflows/gosec.yml @@ -25,7 +25,7 @@ jobs: uses: actions/checkout@v3 - name: Run Gosec Security Scanner - uses: securego/gosec@master + uses: securego/gosec@v2.17.0 with: # we let the report trigger content trigger a failure using the GitHub Security features. args: "-no-fail -fmt sarif -out results.sarif ./..." diff --git a/CHANGELOG.md b/CHANGELOG.md index 58bf9b3e3d..b1dd47c923 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,18 @@ # Changelog +## v1.1.0 +This release introduces the Pampas upgrade and contains 8 new features. + +Features: +* [#316](https://github.com/bnb-chain/greenfield-cosmos-sdk/pull/316) feat: add validation with context information +* [#321](https://github.com/bnb-chain/greenfield-cosmos-sdk/pull/321) feat: add tool to migrate stores for fastnode +* [#336](https://github.com/bnb-chain/greenfield-cosmos-sdk/pull/336) feat: introduce the pampas upgrade +* [#341](https://github.com/bnb-chain/greenfield-cosmos-sdk/pull/341) feat: add support for some json rpc queries +* [#353](https://github.com/bnb-chain/greenfield-cosmos-sdk/pull/353) feat: distinguish inturn relayer +* [#320](https://github.com/bnb-chain/greenfield-cosmos-sdk/pull/320) feat: add MsgRejectMigrateBucket +* [#357](https://github.com/bnb-chain/greenfield-cosmos-sdk/pull/357) feat: support Secp256k1 format private keys import +* [#358](https://github.com/bnb-chain/greenfield-cosmos-sdk/pull/358) feat: enable Pampas hardfork to testnet + ## v1.0.1 This release includes 1 bug fix. diff --git a/api/cosmos/oracle/v1/query.pulsar.go b/api/cosmos/oracle/v1/query.pulsar.go index 99b00ba5f4..be7db37a19 100644 --- a/api/cosmos/oracle/v1/query.pulsar.go +++ b/api/cosmos/oracle/v1/query.pulsar.go @@ -806,12 +806,14 @@ func (x *fastReflection_QueryParamsResponse) ProtoMethods() *protoiface.Methods } var ( - md_QueryInturnRelayerRequest protoreflect.MessageDescriptor + md_QueryInturnRelayerRequest protoreflect.MessageDescriptor + fd_QueryInturnRelayerRequest_claim_src_chain protoreflect.FieldDescriptor ) func init() { file_cosmos_oracle_v1_query_proto_init() md_QueryInturnRelayerRequest = File_cosmos_oracle_v1_query_proto.Messages().ByName("QueryInturnRelayerRequest") + fd_QueryInturnRelayerRequest_claim_src_chain = md_QueryInturnRelayerRequest.Fields().ByName("claim_src_chain") } var _ protoreflect.Message = (*fastReflection_QueryInturnRelayerRequest)(nil) @@ -879,6 +881,12 @@ func (x *fastReflection_QueryInturnRelayerRequest) Interface() protoreflect.Prot // While iterating, mutating operations may only be performed // on the current field descriptor. func (x *fastReflection_QueryInturnRelayerRequest) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.ClaimSrcChain != 0 { + value := protoreflect.ValueOfEnum((protoreflect.EnumNumber)(x.ClaimSrcChain)) + if !f(fd_QueryInturnRelayerRequest_claim_src_chain, value) { + return + } + } } // Has reports whether a field is populated. @@ -894,6 +902,8 @@ func (x *fastReflection_QueryInturnRelayerRequest) Range(f func(protoreflect.Fie // a repeated field is populated if it is non-empty. func (x *fastReflection_QueryInturnRelayerRequest) Has(fd protoreflect.FieldDescriptor) bool { switch fd.FullName() { + case "cosmos.oracle.v1.QueryInturnRelayerRequest.claim_src_chain": + return x.ClaimSrcChain != 0 default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.oracle.v1.QueryInturnRelayerRequest")) @@ -910,6 +920,8 @@ func (x *fastReflection_QueryInturnRelayerRequest) Has(fd protoreflect.FieldDesc // Clear is a mutating operation and unsafe for concurrent use. func (x *fastReflection_QueryInturnRelayerRequest) Clear(fd protoreflect.FieldDescriptor) { switch fd.FullName() { + case "cosmos.oracle.v1.QueryInturnRelayerRequest.claim_src_chain": + x.ClaimSrcChain = 0 default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.oracle.v1.QueryInturnRelayerRequest")) @@ -926,6 +938,9 @@ func (x *fastReflection_QueryInturnRelayerRequest) Clear(fd protoreflect.FieldDe // of the value; to obtain a mutable reference, use Mutable. func (x *fastReflection_QueryInturnRelayerRequest) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { switch descriptor.FullName() { + case "cosmos.oracle.v1.QueryInturnRelayerRequest.claim_src_chain": + value := x.ClaimSrcChain + return protoreflect.ValueOfEnum((protoreflect.EnumNumber)(value)) default: if descriptor.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.oracle.v1.QueryInturnRelayerRequest")) @@ -946,6 +961,8 @@ func (x *fastReflection_QueryInturnRelayerRequest) Get(descriptor protoreflect.F // Set is a mutating operation and unsafe for concurrent use. func (x *fastReflection_QueryInturnRelayerRequest) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { switch fd.FullName() { + case "cosmos.oracle.v1.QueryInturnRelayerRequest.claim_src_chain": + x.ClaimSrcChain = (ClaimSrcChain)(value.Enum()) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.oracle.v1.QueryInturnRelayerRequest")) @@ -966,6 +983,8 @@ func (x *fastReflection_QueryInturnRelayerRequest) Set(fd protoreflect.FieldDesc // Mutable is a mutating operation and unsafe for concurrent use. func (x *fastReflection_QueryInturnRelayerRequest) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { + case "cosmos.oracle.v1.QueryInturnRelayerRequest.claim_src_chain": + panic(fmt.Errorf("field claim_src_chain of message cosmos.oracle.v1.QueryInturnRelayerRequest is not mutable")) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.oracle.v1.QueryInturnRelayerRequest")) @@ -979,6 +998,8 @@ func (x *fastReflection_QueryInturnRelayerRequest) Mutable(fd protoreflect.Field // For lists, maps, and messages, this returns a new, empty, mutable value. func (x *fastReflection_QueryInturnRelayerRequest) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { + case "cosmos.oracle.v1.QueryInturnRelayerRequest.claim_src_chain": + return protoreflect.ValueOfEnum(0) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.oracle.v1.QueryInturnRelayerRequest")) @@ -1048,6 +1069,9 @@ func (x *fastReflection_QueryInturnRelayerRequest) ProtoMethods() *protoiface.Me var n int var l int _ = l + if x.ClaimSrcChain != 0 { + n += 1 + runtime.Sov(uint64(x.ClaimSrcChain)) + } if x.unknownFields != nil { n += len(x.unknownFields) } @@ -1077,6 +1101,11 @@ func (x *fastReflection_QueryInturnRelayerRequest) ProtoMethods() *protoiface.Me i -= len(x.unknownFields) copy(dAtA[i:], x.unknownFields) } + if x.ClaimSrcChain != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.ClaimSrcChain)) + i-- + dAtA[i] = 0x8 + } if input.Buf != nil { input.Buf = append(input.Buf, dAtA...) } else { @@ -1126,6 +1155,25 @@ func (x *fastReflection_QueryInturnRelayerRequest) ProtoMethods() *protoiface.Me return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryInturnRelayerRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { + case 1: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field ClaimSrcChain", wireType) + } + x.ClaimSrcChain = 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.ClaimSrcChain |= ClaimSrcChain(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := runtime.Skip(dAtA[iNdEx:]) @@ -1673,6 +1721,59 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) +// ClaimSrcChain defines the src chain of a claim +type ClaimSrcChain int32 + +const ( + // CLAIM_SRC_CHAIN_UNSPECIFIED + ClaimSrcChain_CLAIM_SRC_CHAIN_UNSPECIFIED ClaimSrcChain = 0 + // CLAIM_SRC_CHAIN_BSC defines BSC source chain + ClaimSrcChain_CLAIM_SRC_CHAIN_BSC ClaimSrcChain = 1 + // CLAIM_SRC_CHAIN_OP_BNB defines OPBNB source chain + ClaimSrcChain_CLAIM_SRC_CHAIN_OP_BNB ClaimSrcChain = 2 +) + +// Enum value maps for ClaimSrcChain. +var ( + ClaimSrcChain_name = map[int32]string{ + 0: "CLAIM_SRC_CHAIN_UNSPECIFIED", + 1: "CLAIM_SRC_CHAIN_BSC", + 2: "CLAIM_SRC_CHAIN_OP_BNB", + } + ClaimSrcChain_value = map[string]int32{ + "CLAIM_SRC_CHAIN_UNSPECIFIED": 0, + "CLAIM_SRC_CHAIN_BSC": 1, + "CLAIM_SRC_CHAIN_OP_BNB": 2, + } +) + +func (x ClaimSrcChain) Enum() *ClaimSrcChain { + p := new(ClaimSrcChain) + *p = x + return p +} + +func (x ClaimSrcChain) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (ClaimSrcChain) Descriptor() protoreflect.EnumDescriptor { + return file_cosmos_oracle_v1_query_proto_enumTypes[0].Descriptor() +} + +func (ClaimSrcChain) Type() protoreflect.EnumType { + return &file_cosmos_oracle_v1_query_proto_enumTypes[0] +} + +func (x ClaimSrcChain) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use ClaimSrcChain.Descriptor instead. +func (ClaimSrcChain) EnumDescriptor() ([]byte, []int) { + return file_cosmos_oracle_v1_query_proto_rawDescGZIP(), []int{0} +} + // QueryParamsRequest is the request type for the Query/Params RPC method. type QueryParamsRequest struct { state protoimpl.MessageState @@ -1742,6 +1843,9 @@ type QueryInturnRelayerRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields + + // ClaimSrcChain defines the src chain of a claim + ClaimSrcChain ClaimSrcChain `protobuf:"varint,1,opt,name=claim_src_chain,json=claimSrcChain,proto3,enum=cosmos.oracle.v1.ClaimSrcChain" json:"claim_src_chain,omitempty"` } func (x *QueryInturnRelayerRequest) Reset() { @@ -1764,6 +1868,13 @@ func (*QueryInturnRelayerRequest) Descriptor() ([]byte, []int) { return file_cosmos_oracle_v1_query_proto_rawDescGZIP(), []int{2} } +func (x *QueryInturnRelayerRequest) GetClaimSrcChain() ClaimSrcChain { + if x != nil { + return x.ClaimSrcChain + } + return ClaimSrcChain_CLAIM_SRC_CHAIN_UNSPECIFIED +} + // QueryInturnRelayerResponse is the response type for the Query In-turn relayer RPC method. type QueryInturnRelayerResponse struct { state protoimpl.MessageState @@ -1825,47 +1936,58 @@ var file_cosmos_oracle_v1_query_proto_rawDesc = []byte{ 0x12, 0x36, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 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, 0x1b, 0x0a, 0x19, 0x51, 0x75, 0x65, 0x72, + 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x22, 0x64, 0x0a, 0x19, 0x51, 0x75, 0x65, 0x72, 0x79, 0x49, 0x6e, 0x74, 0x75, 0x72, 0x6e, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x84, 0x01, 0x0a, 0x1a, 0x51, 0x75, 0x65, 0x72, 0x79, 0x49, - 0x6e, 0x74, 0x75, 0x72, 0x6e, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1e, 0x0a, 0x0b, 0x62, 0x6c, 0x73, 0x5f, 0x70, 0x75, 0x62, 0x5f, - 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x62, 0x6c, 0x73, 0x50, 0x75, - 0x62, 0x4b, 0x65, 0x79, 0x12, 0x46, 0x0a, 0x0e, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x5f, 0x69, 0x6e, - 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x63, - 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x2e, - 0x52, 0x65, 0x6c, 0x61, 0x79, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c, 0x52, 0x0d, 0x72, - 0x65, 0x6c, 0x61, 0x79, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c, 0x32, 0x97, 0x02, 0x0a, - 0x05, 0x51, 0x75, 0x65, 0x72, 0x79, 0x12, 0x77, 0x0a, 0x06, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, - 0x12, 0x24, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, - 0x2e, 0x76, 0x31, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x25, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, - 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, - 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x20, 0x82, - 0xd3, 0xe4, 0x93, 0x02, 0x1a, 0x12, 0x18, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x6f, - 0x72, 0x61, 0x63, 0x6c, 0x65, 0x2f, 0x76, 0x31, 0x2f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, - 0x94, 0x01, 0x0a, 0x0d, 0x49, 0x6e, 0x74, 0x75, 0x72, 0x6e, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x65, - 0x72, 0x12, 0x2b, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x6f, 0x72, 0x61, 0x63, 0x6c, - 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x49, 0x6e, 0x74, 0x75, 0x72, 0x6e, - 0x52, 0x65, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2c, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x47, 0x0a, 0x0f, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x5f, 0x73, + 0x72, 0x63, 0x5f, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1f, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x2e, 0x76, - 0x31, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x49, 0x6e, 0x74, 0x75, 0x72, 0x6e, 0x52, 0x65, 0x6c, - 0x61, 0x79, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x28, 0x82, 0xd3, - 0xe4, 0x93, 0x02, 0x22, 0x12, 0x20, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x6f, 0x72, - 0x61, 0x63, 0x6c, 0x65, 0x2f, 0x76, 0x31, 0x2f, 0x69, 0x6e, 0x74, 0x75, 0x72, 0x6e, 0x5f, 0x72, - 0x65, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x42, 0xb0, 0x01, 0x0a, 0x14, 0x63, 0x6f, 0x6d, 0x2e, 0x63, - 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x42, - 0x0a, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2a, 0x63, - 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, - 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x2f, 0x76, 0x31, - 0x3b, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x43, 0x4f, 0x58, 0xaa, - 0x02, 0x10, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x2e, - 0x56, 0x31, 0xca, 0x02, 0x10, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x4f, 0x72, 0x61, 0x63, - 0x6c, 0x65, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x1c, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x4f, - 0x72, 0x61, 0x63, 0x6c, 0x65, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, - 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x12, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x4f, - 0x72, 0x61, 0x63, 0x6c, 0x65, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x33, + 0x31, 0x2e, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x53, 0x72, 0x63, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x52, + 0x0d, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x53, 0x72, 0x63, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x22, 0x84, + 0x01, 0x0a, 0x1a, 0x51, 0x75, 0x65, 0x72, 0x79, 0x49, 0x6e, 0x74, 0x75, 0x72, 0x6e, 0x52, 0x65, + 0x6c, 0x61, 0x79, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1e, 0x0a, + 0x0b, 0x62, 0x6c, 0x73, 0x5f, 0x70, 0x75, 0x62, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x09, 0x62, 0x6c, 0x73, 0x50, 0x75, 0x62, 0x4b, 0x65, 0x79, 0x12, 0x46, 0x0a, + 0x0e, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x5f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x6f, + 0x72, 0x61, 0x63, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x49, 0x6e, + 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c, 0x52, 0x0d, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x49, 0x6e, 0x74, + 0x65, 0x72, 0x76, 0x61, 0x6c, 0x2a, 0x6b, 0x0a, 0x0d, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x53, 0x72, + 0x63, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x12, 0x1f, 0x0a, 0x1b, 0x43, 0x4c, 0x41, 0x49, 0x4d, 0x5f, + 0x53, 0x52, 0x43, 0x5f, 0x43, 0x48, 0x41, 0x49, 0x4e, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, + 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x17, 0x0a, 0x13, 0x43, 0x4c, 0x41, 0x49, 0x4d, + 0x5f, 0x53, 0x52, 0x43, 0x5f, 0x43, 0x48, 0x41, 0x49, 0x4e, 0x5f, 0x42, 0x53, 0x43, 0x10, 0x01, + 0x12, 0x1a, 0x0a, 0x16, 0x43, 0x4c, 0x41, 0x49, 0x4d, 0x5f, 0x53, 0x52, 0x43, 0x5f, 0x43, 0x48, + 0x41, 0x49, 0x4e, 0x5f, 0x4f, 0x50, 0x5f, 0x42, 0x4e, 0x42, 0x10, 0x02, 0x1a, 0x04, 0x88, 0xa3, + 0x1e, 0x00, 0x32, 0x97, 0x02, 0x0a, 0x05, 0x51, 0x75, 0x65, 0x72, 0x79, 0x12, 0x77, 0x0a, 0x06, + 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x24, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, + 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, + 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x25, 0x2e, 0x63, + 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x2e, + 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x22, 0x20, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1a, 0x12, 0x18, 0x2f, 0x63, 0x6f, + 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x2f, 0x76, 0x31, 0x2f, 0x70, + 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x94, 0x01, 0x0a, 0x0d, 0x49, 0x6e, 0x74, 0x75, 0x72, 0x6e, + 0x52, 0x65, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x12, 0x2b, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, + 0x2e, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, + 0x49, 0x6e, 0x74, 0x75, 0x72, 0x6e, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2c, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x6f, 0x72, + 0x61, 0x63, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x49, 0x6e, 0x74, + 0x75, 0x72, 0x6e, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x22, 0x28, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x22, 0x12, 0x20, 0x2f, 0x63, 0x6f, 0x73, + 0x6d, 0x6f, 0x73, 0x2f, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x2f, 0x76, 0x31, 0x2f, 0x69, 0x6e, + 0x74, 0x75, 0x72, 0x6e, 0x5f, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x42, 0xb0, 0x01, 0x0a, + 0x14, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x6f, 0x72, 0x61, 0x63, + 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x42, 0x0a, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x72, 0x6f, 0x74, + 0x6f, 0x50, 0x01, 0x5a, 0x2a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, + 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x6f, 0x72, 0x61, + 0x63, 0x6c, 0x65, 0x2f, 0x76, 0x31, 0x3b, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x76, 0x31, 0xa2, + 0x02, 0x03, 0x43, 0x4f, 0x58, 0xaa, 0x02, 0x10, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x4f, + 0x72, 0x61, 0x63, 0x6c, 0x65, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x10, 0x43, 0x6f, 0x73, 0x6d, 0x6f, + 0x73, 0x5c, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x1c, 0x43, 0x6f, + 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x5c, 0x56, 0x31, 0x5c, 0x47, + 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x12, 0x43, 0x6f, 0x73, + 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x3a, 0x3a, 0x56, 0x31, 0x62, + 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -1880,27 +2002,30 @@ func file_cosmos_oracle_v1_query_proto_rawDescGZIP() []byte { return file_cosmos_oracle_v1_query_proto_rawDescData } +var file_cosmos_oracle_v1_query_proto_enumTypes = make([]protoimpl.EnumInfo, 1) var file_cosmos_oracle_v1_query_proto_msgTypes = make([]protoimpl.MessageInfo, 4) var file_cosmos_oracle_v1_query_proto_goTypes = []interface{}{ - (*QueryParamsRequest)(nil), // 0: cosmos.oracle.v1.QueryParamsRequest - (*QueryParamsResponse)(nil), // 1: cosmos.oracle.v1.QueryParamsResponse - (*QueryInturnRelayerRequest)(nil), // 2: cosmos.oracle.v1.QueryInturnRelayerRequest - (*QueryInturnRelayerResponse)(nil), // 3: cosmos.oracle.v1.QueryInturnRelayerResponse - (*Params)(nil), // 4: cosmos.oracle.v1.Params - (*RelayInterval)(nil), // 5: cosmos.oracle.v1.RelayInterval + (ClaimSrcChain)(0), // 0: cosmos.oracle.v1.ClaimSrcChain + (*QueryParamsRequest)(nil), // 1: cosmos.oracle.v1.QueryParamsRequest + (*QueryParamsResponse)(nil), // 2: cosmos.oracle.v1.QueryParamsResponse + (*QueryInturnRelayerRequest)(nil), // 3: cosmos.oracle.v1.QueryInturnRelayerRequest + (*QueryInturnRelayerResponse)(nil), // 4: cosmos.oracle.v1.QueryInturnRelayerResponse + (*Params)(nil), // 5: cosmos.oracle.v1.Params + (*RelayInterval)(nil), // 6: cosmos.oracle.v1.RelayInterval } var file_cosmos_oracle_v1_query_proto_depIdxs = []int32{ - 4, // 0: cosmos.oracle.v1.QueryParamsResponse.params:type_name -> cosmos.oracle.v1.Params - 5, // 1: cosmos.oracle.v1.QueryInturnRelayerResponse.relay_interval:type_name -> cosmos.oracle.v1.RelayInterval - 0, // 2: cosmos.oracle.v1.Query.Params:input_type -> cosmos.oracle.v1.QueryParamsRequest - 2, // 3: cosmos.oracle.v1.Query.InturnRelayer:input_type -> cosmos.oracle.v1.QueryInturnRelayerRequest - 1, // 4: cosmos.oracle.v1.Query.Params:output_type -> cosmos.oracle.v1.QueryParamsResponse - 3, // 5: cosmos.oracle.v1.Query.InturnRelayer:output_type -> cosmos.oracle.v1.QueryInturnRelayerResponse - 4, // [4:6] is the sub-list for method output_type - 2, // [2:4] 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 + 5, // 0: cosmos.oracle.v1.QueryParamsResponse.params:type_name -> cosmos.oracle.v1.Params + 0, // 1: cosmos.oracle.v1.QueryInturnRelayerRequest.claim_src_chain:type_name -> cosmos.oracle.v1.ClaimSrcChain + 6, // 2: cosmos.oracle.v1.QueryInturnRelayerResponse.relay_interval:type_name -> cosmos.oracle.v1.RelayInterval + 1, // 3: cosmos.oracle.v1.Query.Params:input_type -> cosmos.oracle.v1.QueryParamsRequest + 3, // 4: cosmos.oracle.v1.Query.InturnRelayer:input_type -> cosmos.oracle.v1.QueryInturnRelayerRequest + 2, // 5: cosmos.oracle.v1.Query.Params:output_type -> cosmos.oracle.v1.QueryParamsResponse + 4, // 6: cosmos.oracle.v1.Query.InturnRelayer:output_type -> cosmos.oracle.v1.QueryInturnRelayerResponse + 5, // [5:7] is the sub-list for method output_type + 3, // [3:5] is the sub-list for method input_type + 3, // [3:3] is the sub-list for extension type_name + 3, // [3:3] is the sub-list for extension extendee + 0, // [0:3] is the sub-list for field type_name } func init() { file_cosmos_oracle_v1_query_proto_init() } @@ -1964,13 +2089,14 @@ func file_cosmos_oracle_v1_query_proto_init() { File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_cosmos_oracle_v1_query_proto_rawDesc, - NumEnums: 0, + NumEnums: 1, NumMessages: 4, NumExtensions: 0, NumServices: 1, }, GoTypes: file_cosmos_oracle_v1_query_proto_goTypes, DependencyIndexes: file_cosmos_oracle_v1_query_proto_depIdxs, + EnumInfos: file_cosmos_oracle_v1_query_proto_enumTypes, MessageInfos: file_cosmos_oracle_v1_query_proto_msgTypes, }.Build() File_cosmos_oracle_v1_query_proto = out.File diff --git a/baseapp/abci.go b/baseapp/abci.go index b8c48adc66..4124d6a38a 100644 --- a/baseapp/abci.go +++ b/baseapp/abci.go @@ -38,12 +38,18 @@ const ( // Supported EVM json-rpc requests const ( - EthBlockNumber = "eth_blockNumber" - EthGetBlockByNumber = "eth_getBlockByNumber" - EthGetBalance = "eth_getBalance" - EthChainID = "eth_chainId" - NetVersion = "net_version" - EthNetworkID = "eth_networkId" + EthBlockNumber = "eth_blockNumber" + EthGetBlockByNumber = "eth_getBlockByNumber" + EthGetBalance = "eth_getBalance" + EthChainID = "eth_chainId" + NetVersion = "net_version" + EthNetworkID = "eth_networkId" + EthGasPrice = "eth_gasPrice" + EthGetCode = "eth_getCode" + EthEstimateGas = "eth_estimateGas" + EthCall = "eth_call" + EthGetTransactionCount = "eth_getTransactionCount" + EthSendRawTransaction = "eth_sendRawTransaction" ) // InitChain implements the ABCI interface. It runs the initialization logic diff --git a/baseapp/baseapp.go b/baseapp/baseapp.go index 5d13ac151f..79f666aa28 100644 --- a/baseapp/baseapp.go +++ b/baseapp/baseapp.go @@ -637,6 +637,23 @@ func validateBasicTxMsgs(msgs []sdk.Msg) error { return nil } +// validateRuntimeTxMsgs executes basic runtime validator calls for messages. +func validateRuntimeTxMsgs(ctx sdk.Context, msgs []sdk.Msg) error { + if len(msgs) == 0 { + return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "must contain at least one message") + } + + for _, msg := range msgs { + if runtimeMsg, ok := msg.(sdk.MsgWithRuntimeValidation); ok { + if err := runtimeMsg.ValidateRuntime(ctx); err != nil { + return err + } + } + } + + return nil +} + // Returns the application's deliverState if app is in runTxModeDeliver, // prepareProposalState if app is in runTxPrepareProposal, processProposalState // if app is in runTxProcessProposal, and checkState otherwise. @@ -790,6 +807,9 @@ func (app *BaseApp) runTxOnContext(ctx sdk.Context, mode runTxMode, txBytes []by if err := validateBasicTxMsgs(msgs); err != nil { return sdk.GasInfo{}, nil, nil, 0, err } + if err := validateRuntimeTxMsgs(ctx, msgs); err != nil { + return sdk.GasInfo{}, nil, nil, 0, err + } if app.anteHandler != nil { var ( diff --git a/baseapp/ethrouter.go b/baseapp/ethrouter.go index 37abbf7cbb..35c3228cf4 100644 --- a/baseapp/ethrouter.go +++ b/baseapp/ethrouter.go @@ -64,6 +64,12 @@ func (e *EthQueryRouter) RegisterConstHandler() { e.AddRoute(EthNetworkID, chainIdHandler) e.AddRoute(EthChainID, chainIdHandler) e.AddRoute(NetVersion, chainIdHandler) + e.AddRoute(EthGasPrice, gasPriceHandler) + e.AddRoute(EthGetCode, chainIdHandler) // return dummy result + e.AddRoute(EthEstimateGas, estimateGasHandler) // return dummy result + e.AddRoute(EthCall, chainIdHandler) // return dummy result + e.AddRoute(EthGetTransactionCount, getTransactionCountHandler) // return dummy result + e.AddRoute(EthSendRawTransaction, chainIdHandler) // return dummy result } func blockNumberHandler(ctx sdk.Context, req cmtrpctypes.RPCRequest) (abci.ResponseEthQuery, error) { @@ -72,6 +78,24 @@ func blockNumberHandler(ctx sdk.Context, req cmtrpctypes.RPCRequest) (abci.Respo return res, nil } +func gasPriceHandler(ctx sdk.Context, req cmtrpctypes.RPCRequest) (abci.ResponseEthQuery, error) { + var res abci.ResponseEthQuery + res.Response = big.NewInt(5e9).Bytes() + return res, nil +} + +func estimateGasHandler(ctx sdk.Context, req cmtrpctypes.RPCRequest) (abci.ResponseEthQuery, error) { + var res abci.ResponseEthQuery + res.Response = big.NewInt(21000).Bytes() + return res, nil +} + +func getTransactionCountHandler(ctx sdk.Context, req cmtrpctypes.RPCRequest) (abci.ResponseEthQuery, error) { + var res abci.ResponseEthQuery + res.Response = big.NewInt(1).Bytes() + return res, nil +} + func chainIdHandler(ctx sdk.Context, req cmtrpctypes.RPCRequest) (abci.ResponseEthQuery, error) { var res abci.ResponseEthQuery eip155ChainID, err := sdk.ParseChainID(ctx.ChainID()) diff --git a/baseapp/msg_service_router.go b/baseapp/msg_service_router.go index ec68ffd4c4..a1837349fc 100644 --- a/baseapp/msg_service_router.go +++ b/baseapp/msg_service_router.go @@ -122,6 +122,12 @@ func (msr *MsgServiceRouter) RegisterService(sd *grpc.ServiceDesc, handler inter return nil, err } + if runtimeReq, ok := req.(sdk.MsgWithRuntimeValidation); ok { + if err := runtimeReq.ValidateRuntime(ctx); err != nil { + return nil, err + } + } + if msr.circuitBreaker != nil { msgURL := sdk.MsgTypeURL(req) diff --git a/client/keys/import.go b/client/keys/import.go index a9d5c185ac..ab4e3c4058 100644 --- a/client/keys/import.go +++ b/client/keys/import.go @@ -2,39 +2,82 @@ package keys import ( "bufio" + "encoding/hex" + "fmt" "os" "github.com/spf13/cobra" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/input" + "github.com/cosmos/cosmos-sdk/crypto/hd" + "github.com/cosmos/cosmos-sdk/crypto/keys/eth/ethsecp256k1" +) + +const ( + flagSecp256k1PrivateKey = "secp256k1-private-key" ) // ImportKeyCommand imports private keys from a keyfile. func ImportKeyCommand() *cobra.Command { - return &cobra.Command{ - Use: "import ", + cmd := &cobra.Command{ + Use: "import /", Short: "Import private keys into the local keybase", - Long: "Import a ASCII armored private key into the local keybase.", + Long: "Import a ASCII armored/Secp256k1 private key into the local keybase.", Args: cobra.ExactArgs(2), RunE: func(cmd *cobra.Command, args []string) error { clientCtx, err := client.GetClientQueryContext(cmd) if err != nil { return err } - buf := bufio.NewReader(clientCtx.Input) - bz, err := os.ReadFile(args[1]) - if err != nil { - return err - } + isSecp256k1, _ := cmd.Flags().GetBool(flagSecp256k1PrivateKey) - passphrase, err := input.GetPassword("Enter passphrase to decrypt your key:", buf) - if err != nil { - return err + if !isSecp256k1 { + return importASCIIArmored(clientCtx, args) } - return clientCtx.Keyring.ImportPrivKey(args[0], string(bz), passphrase) + return importSecp256k1(clientCtx, args) }, } + + cmd.Flags().Bool(flagSecp256k1PrivateKey, false, "import Secp256k1 format private key") + + return cmd +} + +func importASCIIArmored(clientCtx client.Context, args []string) error { + buf := bufio.NewReader(clientCtx.Input) + + bz, err := os.ReadFile(args[1]) + if err != nil { + return err + } + + passphrase, err := input.GetPassword("Enter passphrase to decrypt your key:", buf) + if err != nil { + return err + } + + return clientCtx.Keyring.ImportPrivKey(args[0], string(bz), passphrase) +} + +func importSecp256k1(clientCtx client.Context, args []string) error { + keyName := args[0] + keyBytes, err := hex.DecodeString(args[1]) + if err != nil { + return err + } + if len(keyBytes) != 32 { + return fmt.Errorf("len of keybytes is not equal to 32") + } + var keyBytesArray [32]byte + copy(keyBytesArray[:], keyBytes[:32]) + privKey := hd.EthSecp256k1.Generate()(keyBytesArray[:]).(*ethsecp256k1.PrivKey) + + _, err = clientCtx.Keyring.WriteLocalKey(keyName, privKey) + if err != nil { + return err + } + return nil } diff --git a/crypto/keyring/keyring.go b/crypto/keyring/keyring.go index 7e02b7f8d6..7b22b64d1b 100644 --- a/crypto/keyring/keyring.go +++ b/crypto/keyring/keyring.go @@ -116,6 +116,9 @@ type Importer interface { // ImportPubKey imports ASCII armored public keys. ImportPubKey(uid string, armor string) error + + // WriteLocalKey persists a private key object into storage. + WriteLocalKey(name string, privKey types.PrivKey) (*Record, error) } // Migrator is implemented by key stores and enables migration of keys from amino to proto @@ -757,6 +760,11 @@ func newRealPrompt(dir string, buf io.Reader) func(string) (string, error) { } } +// WriteLocalKey persists a local key to the keyring. +func (ks keystore) WriteLocalKey(name string, privKey types.PrivKey) (*Record, error) { + return ks.writeLocalKey(name, privKey) +} + func (ks keystore) writeLocalKey(name string, privKey types.PrivKey) (*Record, error) { k, err := NewLocalRecord(name, privKey, privKey.PubKey()) if err != nil { diff --git a/go.mod b/go.mod index 6b5f11201c..12fde9d663 100644 --- a/go.mod +++ b/go.mod @@ -62,12 +62,12 @@ require ( github.com/tidwall/btree v1.6.0 github.com/wealdtech/go-eth2-util v1.6.3 github.com/willf/bitset v1.1.3 - golang.org/x/crypto v0.9.0 + golang.org/x/crypto v0.14.0 golang.org/x/exp v0.0.0-20230515195305-f3d0a9c9a5cc - golang.org/x/text v0.9.0 - google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 - google.golang.org/grpc v1.56.1 - google.golang.org/protobuf v1.30.0 + golang.org/x/text v0.13.0 + google.golang.org/genproto/googleapis/api v0.0.0-20230711160842-782d3b101e98 + google.golang.org/grpc v1.58.3 + google.golang.org/protobuf v1.31.0 gotest.tools/v3 v3.4.0 pgregory.net/rapid v0.5.5 sigs.k8s.io/yaml v1.3.0 @@ -154,9 +154,11 @@ require ( github.com/zondax/hid v0.9.1 // indirect github.com/zondax/ledger-go v0.14.1 // indirect go.etcd.io/bbolt v1.3.7 // indirect - golang.org/x/net v0.10.0 // indirect - golang.org/x/sys v0.8.0 // indirect - golang.org/x/term v0.8.0 // indirect + golang.org/x/net v0.17.0 // indirect + golang.org/x/sys v0.13.0 // indirect + golang.org/x/term v0.13.0 // indirect + google.golang.org/genproto v0.0.0-20230711160842-782d3b101e98 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect @@ -170,7 +172,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.3 + github.com/cometbft/cometbft => github.com/bnb-chain/greenfield-cometbft v1.1.0 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 @@ -183,6 +185,7 @@ replace ( github.com/gin-gonic/gin => github.com/gin-gonic/gin v1.9.1 // replace broken goleveldb github.com/syndtr/goleveldb => github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 + github.com/wercker/journalhook => github.com/wercker/journalhook v0.0.0-20230927020745-64542ffa4117 ) retract ( diff --git a/go.sum b/go.sum index 2dad1b1acc..0baae1e6b9 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.3 h1:tv8NMy3bzX/1urqXGQIIAZSLy83loiI+dG0VKeyh1CY= -github.com/bnb-chain/greenfield-cometbft v0.0.3/go.mod h1:f35mk/r5ab6yvzlqEWZt68LfUje68sYgMpVlt2CUYMk= +github.com/bnb-chain/greenfield-cometbft v1.1.0 h1:jqnkDWIZW6f/rUn5/pE26YZMT9xzpp0qTswNy7FPRBk= +github.com/bnb-chain/greenfield-cometbft v1.1.0/go.mod h1:NZ2/ZJK2HYe3++0CsPiw4LTG6UrC6pH7fQ3VOz6pqJw= 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= @@ -1852,7 +1852,7 @@ github.com/wealdtech/go-eth2-util v1.6.3 h1:2INPeOR35x5LdFFpSzyw954WzTD+DFyHe3yK github.com/wealdtech/go-eth2-util v1.6.3/go.mod h1:0hFMj/qtio288oZFHmAbCnPQ9OB3c4WFzs5NVPKTY4k= github.com/wealdtech/go-eth2-wallet-encryptor-keystorev4 v1.1.3/go.mod h1:qiIimacW5NhVRy8o+YxWo9YrecXqDAKKbL0+sOa0SJ4= github.com/wealdtech/go-eth2-wallet-types/v2 v2.8.2/go.mod h1:k6kmiKWSWBTd4OxFifTEkPaBLhZspnO2KFD5XJY9nqg= -github.com/wercker/journalhook v0.0.0-20180428041537-5d0a5ae867b3/go.mod h1:XCsSkdKK4gwBMNrOCZWww0pX6AOt+2gYc5Z6jBRrNVg= +github.com/wercker/journalhook v0.0.0-20230927020745-64542ffa4117/go.mod h1:XCsSkdKK4gwBMNrOCZWww0pX6AOt+2gYc5Z6jBRrNVg= github.com/whyrusleeping/go-keyspace v0.0.0-20160322163242-5b898ac5add1/go.mod h1:8UvriyWtv5Q5EOgjHaSseUEdkQfvwFv1I/In/O2M9gc= github.com/whyrusleeping/go-logging v0.0.0-20170515211332-0457bb6b88fc/go.mod h1:bopw91TMyo8J3tvftk8xmU2kPmlrt4nScJQZU2hE5EM= github.com/whyrusleeping/mdns v0.0.0-20190826153040-b9b60ed33aa9/go.mod h1:j4l84WPFclQPj320J9gp0XwNKBb3U0zt5CBqjPp22G4= @@ -2007,8 +2007,9 @@ golang.org/x/crypto v0.0.0-20211117183948-ae814b36b871/go.mod h1:IxCIyHEi3zRg3s0 golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU= -golang.org/x/crypto v0.9.0 h1:LF6fAI+IutBocDJ2OT0Q1g8plpYljMZ4+lty+dsqw3g= golang.org/x/crypto v0.9.0/go.mod h1:yrmDGqONDYtNj3tH8X9dzUun2m2lzPa9ngI6/RUPGR0= +golang.org/x/crypto v0.14.0 h1:wBqGXzWJW6m1XrIKlAH0Hs1JJ7+9KBwnIO8v66Q9cHc= +golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -2141,8 +2142,9 @@ golang.org/x/net v0.0.0-20220617184016-355a448f1bc9/go.mod h1:XRhObCWvk6IyKnWLug golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= -golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= +golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= +golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= golang.org/x/oauth2 v0.0.0-20170912212905-13449ad91cb2/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20181017192945-9dcd33a902f4/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= @@ -2184,7 +2186,7 @@ golang.org/x/sync v0.0.0-20220513210516-0976fa681c29/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20220601150217-0de741cfad7f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.2.0 h1:PUR+T4wwASmuSTYdKjYHI5TD22Wy5ogLU5qZCOLxBrI= +golang.org/x/sync v0.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E= golang.org/x/sys v0.0.0-20170830134202-bb24a47a89ea/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -2337,16 +2339,18 @@ golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20221010170243-090e33056c14/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= +golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.0.0-20220526004731-065cf7ba2467/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U= -golang.org/x/term v0.8.0 h1:n5xxQn2i3PC0yLAbjTpNT85q/Kgzcr2gIoX9OrJUols= golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= +golang.org/x/term v0.13.0 h1:bb+I9cTfFazGW51MZqBVmZy7+JEJMouUHTUSKVQLBek= +golang.org/x/term v0.13.0/go.mod h1:LTmsnFJwVN6bCy1rVCoS+qHT1HhALEFxKncY3WNNh4U= golang.org/x/text v0.0.0-20160726164857-2910a502d2bf/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -2360,8 +2364,9 @@ golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= -golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= +golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/time v0.0.0-20170424234030-8be79e1e0910/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -2656,8 +2661,12 @@ google.golang.org/genproto v0.0.0-20220421151946-72621c1f0bd3/go.mod h1:8w6bsBMX google.golang.org/genproto v0.0.0-20220429170224-98d788798c3e/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo= google.golang.org/genproto v0.0.0-20220505152158-f39f71e6c8f3/go.mod h1:RAyBrSAP7Fh3Nc84ghnVLDPuV51xc9agzmm4Ph6i0Q4= google.golang.org/genproto v0.0.0-20220519153652-3a47de7e79bd/go.mod h1:RAyBrSAP7Fh3Nc84ghnVLDPuV51xc9agzmm4Ph6i0Q4= -google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 h1:KpwkzHKEF7B9Zxg18WzOa7djJ+Ha5DzthMyZYQfEn2A= -google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1/go.mod h1:nKE/iIaLqn2bQwXBg8f1g2Ylh6r5MN5CmZvuzZCgsCU= +google.golang.org/genproto v0.0.0-20230711160842-782d3b101e98 h1:Z0hjGZePRE0ZBWotvtrwxFNrNE9CUAGtplaDK5NNI/g= +google.golang.org/genproto v0.0.0-20230711160842-782d3b101e98/go.mod h1:S7mY02OqCJTD0E1OiQy1F72PWFB4bZJ87cAtLPYgDR0= +google.golang.org/genproto/googleapis/api v0.0.0-20230711160842-782d3b101e98 h1:FmF5cCW94Ij59cfpoLiwTgodWmm60eEV0CjlsVg2fuw= +google.golang.org/genproto/googleapis/api v0.0.0-20230711160842-782d3b101e98/go.mod h1:rsr7RhLuwsDKL7RmgDDCUc6yaGr1iqceVb5Wv6f6YvQ= +google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 h1:bVf09lpb+OJbByTj913DRJioFFAjf/ZGxEz7MajTp2U= +google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98/go.mod h1:TUfxEVdsvPg18p6AslUXFoLdpED4oBnGwyqk3dV1XzM= google.golang.org/grpc v1.2.1-0.20170921194603-d4b75ebd4f9f/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= google.golang.org/grpc v1.8.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= google.golang.org/grpc v1.14.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= @@ -2704,8 +2713,8 @@ google.golang.org/grpc v1.46.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACu google.golang.org/grpc v1.46.2/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= google.golang.org/grpc v1.47.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= google.golang.org/grpc v1.49.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= -google.golang.org/grpc v1.56.1 h1:z0dNfjIl0VpaZ9iSVjA6daGatAYwPGstTjt5vkRMFkQ= -google.golang.org/grpc v1.56.1/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpXqQ9s= +google.golang.org/grpc v1.58.3 h1:BjnpXut1btbtgN/6sp+brB2Kbm2LjNXnidYujAVbSoQ= +google.golang.org/grpc v1.58.3/go.mod h1:tgX3ZQDlNJGU96V6yHh1T/JeoBQ2TXdr43YbYSsCJk0= google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.0.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw= google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= @@ -2724,8 +2733,9 @@ google.golang.org/protobuf v1.27.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQ google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng= google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= +google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/bsm/ratelimit.v1 v1.0.0-20160220154919-db14e161995a/go.mod h1:KF9sEfUPAXdG8Oev9e99iLGnl2uJMjc5B+4y3O7x610= gopkg.in/cenkalti/backoff.v1 v1.1.0/go.mod h1:J6Vskwqd+OMVJl8C33mmtxTBs2gyzfv7UDAkHu8BrjI= diff --git a/proto/cosmos/oracle/v1/query.proto b/proto/cosmos/oracle/v1/query.proto index 65d4b6a5ac..0a0b202262 100644 --- a/proto/cosmos/oracle/v1/query.proto +++ b/proto/cosmos/oracle/v1/query.proto @@ -29,8 +29,22 @@ message QueryParamsResponse { Params params = 1 [(gogoproto.nullable) = false]; } +// ClaimSrcChain defines the src chain of a claim +enum ClaimSrcChain { + option (gogoproto.goproto_enum_prefix) = false; + // CLAIM_SRC_CHAIN_UNSPECIFIED + CLAIM_SRC_CHAIN_UNSPECIFIED = 0; + // CLAIM_SRC_CHAIN_BSC defines BSC source chain + CLAIM_SRC_CHAIN_BSC = 1; + // CLAIM_SRC_CHAIN_OP_BNB defines OPBNB source chain + CLAIM_SRC_CHAIN_OP_BNB = 2; +} + // QueryInturnRelayerRequest is the request type for the Query In-turn relayer RPC method. -message QueryInturnRelayerRequest {} +message QueryInturnRelayerRequest { + // ClaimSrcChain defines the src chain of a claim + ClaimSrcChain claim_src_chain = 1; +} // QueryInturnRelayerResponse is the response type for the Query In-turn relayer RPC method. message QueryInturnRelayerResponse { diff --git a/server/migrate_store.go b/server/migrate_store.go new file mode 100644 index 0000000000..32be232493 --- /dev/null +++ b/server/migrate_store.go @@ -0,0 +1,94 @@ +package server + +import ( + "errors" + "fmt" + "os" + + "github.com/cometbft/cometbft/node" + "github.com/spf13/cobra" + + "github.com/cosmos/cosmos-sdk/client/flags" + serverconfig "github.com/cosmos/cosmos-sdk/server/config" + "github.com/cosmos/cosmos-sdk/server/types" + "github.com/cosmos/cosmos-sdk/store/rootmulti" + storetypes "github.com/cosmos/cosmos-sdk/store/types" +) + +// tmpMigratingDir is a temporary directory to facilitate the migration. +const tmpMigratingDir = "data-migrating" + +// NewMigrateStoreCmd creates a command to migrate multistore from IAVL stores to plain DB stores to enable fast node. +func NewMigrateStoreCmd(appCreator types.AppCreator, defaultNodeHome string) *cobra.Command { + cmd := &cobra.Command{ + Use: "migrate-store", + Short: "migrate application db to use plain db stores instead of IAVL stores", + Long: ` +To run a fast node, plain DB store type is needed. To convert a normal full node to a fast full node, +we need to migrate the underlying stores. With this command, the old application db will be backed up, +the new application db will use plain DB store types. +`, + RunE: func(cmd *cobra.Command, args []string) error { + ctx := GetServerContextFromCmd(cmd) + cfg := ctx.Config + home := cfg.RootDir + db, err := openDB(home, GetAppDBBackend(ctx.Viper)) + if err != nil { + return err + } + newDb, err := openDBWithDataDir(home, tmpMigratingDir, GetAppDBBackend(ctx.Viper)) + if err != nil { + return err + } + config, err := serverconfig.GetConfig(ctx.Viper) + if err != nil { + return err + } + genDocProvider := node.DefaultGenesisDocProviderFunc(ctx.Config) + genDoc, err := genDocProvider() + if err != nil { + return err + } + app := appCreator(ctx.Logger, db, nil, genDoc.ChainID, &config, ctx.Viper) + + if err = app.CommitMultiStore().LoadLatestVersion(); err != nil { + return err + } + rs, ok := app.CommitMultiStore().(*rootmulti.Store) + if !ok { + return errors.New("cannot convert store to root multi store") + } + + if err = rs.MigrateStores(storetypes.StoreTypeDB, newDb); err != nil { + return err + } + version, err := rootmulti.MigrateCommitInfos(db, newDb) + if err != nil { + return err + } + fmt.Printf("Multi root store is captured at version %d \n", version) + + _ = db.Close() + _ = newDb.Close() + + applicationPath := fmt.Sprintf("%s%c%s%c%s", home, os.PathSeparator, "data", os.PathSeparator, "application.db") + applicationBackupPath := fmt.Sprintf("%s%c%s%c%s", home, os.PathSeparator, "data", os.PathSeparator, "application.db-backup") + applicationMigratePath := fmt.Sprintf("%s%c%s%c%s", home, os.PathSeparator, tmpMigratingDir, os.PathSeparator, "application.db") + if err = os.Rename(applicationPath, applicationBackupPath); err != nil { + return err + } + if err = os.Rename(applicationMigratePath, applicationPath); err != nil { + return err + } + fmt.Printf("Application db is replaced and the old one is backup %s\n", applicationBackupPath) + + _ = os.Remove(applicationMigratePath) + fmt.Printf("Migrate application db done, please update app.toml and config.toml to use fastnode feature") + + return nil + }, + } + + cmd.Flags().String(flags.FlagHome, defaultNodeHome, "The application home directory") + return cmd +} diff --git a/server/util.go b/server/util.go index 7a7f89ef8f..28845a094a 100644 --- a/server/util.go +++ b/server/util.go @@ -323,6 +323,7 @@ func AddCommands(rootCmd *cobra.Command, defaultNodeHome string, appCreator type ExportCmd(appExport, defaultNodeHome), version.NewVersionCommand(), NewRollbackCmd(appCreator, defaultNodeHome), + NewMigrateStoreCmd(appCreator, defaultNodeHome), ) } @@ -432,6 +433,11 @@ func openDB(rootDir string, backendType dbm.BackendType, opts ...*dbm.NewDatabas return dbm.NewDB("application", backendType, dataDir, opts...) } +func openDBWithDataDir(rootDir, subDir string, backendType dbm.BackendType, opts ...*dbm.NewDatabaseOption) (dbm.DB, error) { + dataDir := filepath.Join(rootDir, subDir) + return dbm.NewDB("application", backendType, dataDir, opts...) +} + func openTraceWriter(traceWriterFile string) (w io.WriteCloser, err error) { if traceWriterFile == "" { return diff --git a/simapp/go.mod b/simapp/go.mod index 7949c26967..c5414d7258 100644 --- a/simapp/go.mod +++ b/simapp/go.mod @@ -17,7 +17,7 @@ require ( github.com/spf13/pflag v1.0.5 github.com/spf13/viper v1.14.0 github.com/stretchr/testify v1.8.4 - google.golang.org/protobuf v1.30.0 + google.golang.org/protobuf v1.31.0 ) require ( @@ -142,14 +142,16 @@ require ( github.com/zondax/hid v0.9.1 // indirect github.com/zondax/ledger-go v0.14.1 // indirect go.etcd.io/bbolt v1.3.7 // indirect - golang.org/x/crypto v0.9.0 // indirect + golang.org/x/crypto v0.14.0 // indirect golang.org/x/exp v0.0.0-20230515195305-f3d0a9c9a5cc // indirect - golang.org/x/net v0.10.0 // indirect - golang.org/x/sys v0.8.0 // indirect - golang.org/x/term v0.8.0 // indirect - golang.org/x/text v0.9.0 // indirect - google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 // indirect - google.golang.org/grpc v1.56.1 // indirect + golang.org/x/net v0.17.0 // indirect + golang.org/x/sys v0.13.0 // indirect + golang.org/x/term v0.13.0 // indirect + golang.org/x/text v0.13.0 // indirect + google.golang.org/genproto v0.0.0-20230711160842-782d3b101e98 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20230711160842-782d3b101e98 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 // indirect + google.golang.org/grpc v1.58.3 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/simapp/go.sum b/simapp/go.sum index 254b808dab..02bdfa8db3 100644 --- a/simapp/go.sum +++ b/simapp/go.sum @@ -1494,8 +1494,9 @@ golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5y golang.org/x/crypto v0.0.0-20211108221036-ceb1ce70b4fa/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20211117183948-ae814b36b871/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU= -golang.org/x/crypto v0.9.0 h1:LF6fAI+IutBocDJ2OT0Q1g8plpYljMZ4+lty+dsqw3g= golang.org/x/crypto v0.9.0/go.mod h1:yrmDGqONDYtNj3tH8X9dzUun2m2lzPa9ngI6/RUPGR0= +golang.org/x/crypto v0.14.0 h1:wBqGXzWJW6m1XrIKlAH0Hs1JJ7+9KBwnIO8v66Q9cHc= +golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -1610,8 +1611,9 @@ golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= -golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= +golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= +golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= golang.org/x/oauth2 v0.0.0-20170912212905-13449ad91cb2/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20181017192945-9dcd33a902f4/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= @@ -1750,15 +1752,17 @@ golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20221010170243-090e33056c14/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= +golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U= -golang.org/x/term v0.8.0 h1:n5xxQn2i3PC0yLAbjTpNT85q/Kgzcr2gIoX9OrJUols= golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= +golang.org/x/term v0.13.0 h1:bb+I9cTfFazGW51MZqBVmZy7+JEJMouUHTUSKVQLBek= +golang.org/x/term v0.13.0/go.mod h1:LTmsnFJwVN6bCy1rVCoS+qHT1HhALEFxKncY3WNNh4U= golang.org/x/text v0.0.0-20160726164857-2910a502d2bf/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -1772,8 +1776,9 @@ golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= -golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= +golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/time v0.0.0-20170424234030-8be79e1e0910/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -1946,8 +1951,12 @@ google.golang.org/genproto v0.0.0-20210126160654-44e461bb6506/go.mod h1:FWY/as6D google.golang.org/genproto v0.0.0-20210226172003-ab064af71705/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210426193834-eac7f76ac494/go.mod h1:P3QM42oQyzQSnHPnZ/vqoCdDmzH28fzWByN9asMeM8A= google.golang.org/genproto v0.0.0-20220314164441-57ef72a4c106/go.mod h1:hAL49I2IFola2sVEjAn7MEwsja0xp51I0tlGAf9hz4E= -google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 h1:KpwkzHKEF7B9Zxg18WzOa7djJ+Ha5DzthMyZYQfEn2A= -google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1/go.mod h1:nKE/iIaLqn2bQwXBg8f1g2Ylh6r5MN5CmZvuzZCgsCU= +google.golang.org/genproto v0.0.0-20230711160842-782d3b101e98 h1:Z0hjGZePRE0ZBWotvtrwxFNrNE9CUAGtplaDK5NNI/g= +google.golang.org/genproto v0.0.0-20230711160842-782d3b101e98/go.mod h1:S7mY02OqCJTD0E1OiQy1F72PWFB4bZJ87cAtLPYgDR0= +google.golang.org/genproto/googleapis/api v0.0.0-20230711160842-782d3b101e98 h1:FmF5cCW94Ij59cfpoLiwTgodWmm60eEV0CjlsVg2fuw= +google.golang.org/genproto/googleapis/api v0.0.0-20230711160842-782d3b101e98/go.mod h1:rsr7RhLuwsDKL7RmgDDCUc6yaGr1iqceVb5Wv6f6YvQ= +google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 h1:bVf09lpb+OJbByTj913DRJioFFAjf/ZGxEz7MajTp2U= +google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98/go.mod h1:TUfxEVdsvPg18p6AslUXFoLdpED4oBnGwyqk3dV1XzM= google.golang.org/grpc v1.2.1-0.20170921194603-d4b75ebd4f9f/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= google.golang.org/grpc v1.14.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= google.golang.org/grpc v1.16.0/go.mod h1:0JHn/cJsOMiMfNA9+DeHDlAU7KAAB5GDlYFpa9MZMio= @@ -1980,8 +1989,8 @@ google.golang.org/grpc v1.36.1/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAG google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ= google.golang.org/grpc v1.49.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= -google.golang.org/grpc v1.56.1 h1:z0dNfjIl0VpaZ9iSVjA6daGatAYwPGstTjt5vkRMFkQ= -google.golang.org/grpc v1.56.1/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpXqQ9s= +google.golang.org/grpc v1.58.3 h1:BjnpXut1btbtgN/6sp+brB2Kbm2LjNXnidYujAVbSoQ= +google.golang.org/grpc v1.58.3/go.mod h1:tgX3ZQDlNJGU96V6yHh1T/JeoBQ2TXdr43YbYSsCJk0= google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.0.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= @@ -1997,8 +2006,9 @@ google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp0 google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng= google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= +google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/bsm/ratelimit.v1 v1.0.0-20160220154919-db14e161995a/go.mod h1:KF9sEfUPAXdG8Oev9e99iLGnl2uJMjc5B+4y3O7x610= gopkg.in/cenkalti/backoff.v1 v1.1.0/go.mod h1:J6Vskwqd+OMVJl8C33mmtxTBs2gyzfv7UDAkHu8BrjI= diff --git a/snapshots/types/snapshot.pb.go b/snapshots/types/snapshot.pb.go index 811e2b78c4..5821c91614 100644 --- a/snapshots/types/snapshot.pb.go +++ b/snapshots/types/snapshot.pb.go @@ -152,6 +152,7 @@ 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/rootmulti/store.go b/store/rootmulti/store.go index ef7a5dbc16..9c523fe0e8 100644 --- a/store/rootmulti/store.go +++ b/store/rootmulti/store.go @@ -136,6 +136,31 @@ func (rs *Store) GetStoreType() types.StoreType { return types.StoreTypeMulti } +// MigrateStores will migrate stores to another type in another db. +func (rs *Store) MigrateStores(targetType types.StoreType, newDb dbm.DB) error { + if targetType != types.StoreTypeDB { + return errors.New("only StoreTypeDB is supported") + } + + for key, store := range rs.stores { + switch store.GetStoreType() { + case types.StoreTypeIAVL: + rs.logger.Info("Migrating IAVL store", "store name", key.Name()) + iterator := store.Iterator(nil, nil) + for ; iterator.Valid(); iterator.Next() { + prefixKey := append([]byte("s/k:"+key.Name()+"/"), iterator.Key()...) + if err := newDb.SetSync(prefixKey, iterator.Value()); err != nil { + return err + } + } + _ = iterator.Close() + default: + + } + } + return nil +} + // MountStoreWithDB implements CommitMultiStore. func (rs *Store) MountStoreWithDB(key types.StoreKey, typ types.StoreType, db dbm.DB) { if key == nil { @@ -1249,3 +1274,34 @@ func flushLatestVersion(batch dbm.Batch, version int64) { batch.Set([]byte(latestVersionKey), bz) } + +// MigrateCommitInfos will migrate commit infos to another db. +func MigrateCommitInfos(oldDb, newDb dbm.DB) (int64, error) { + bz, err := oldDb.Get([]byte(latestVersionKey)) + if err != nil { + return 0, errors.New("fail to read the latest version") + } + if err = newDb.SetSync([]byte(latestVersionKey), bz); err != nil { + return 0, err + } + + version := GetLatestVersion(oldDb) + bz, err = oldDb.Get([]byte(fmt.Sprintf(commitInfoKeyFmt, version))) + if bz == nil { + return 0, errors.New("fail to read the latest commit info") + } + if err != nil { + return 0, err + } + if err = newDb.SetSync([]byte(fmt.Sprintf(commitInfoKeyFmt, version)), bz); err != nil { + return 0, err + } + + // ignore the errors for saving old commit info + bz, _ = oldDb.Get([]byte(fmt.Sprintf(commitInfoKeyFmt, version-1))) + if bz != nil { + _ = newDb.SetSync([]byte(fmt.Sprintf(commitInfoKeyFmt, version-1)), bz) + } + + return version, nil +} diff --git a/tests/e2e/bank/grpc.go b/tests/e2e/bank/grpc.go index 8bc393d306..7101b3987c 100644 --- a/tests/e2e/bank/grpc.go +++ b/tests/e2e/bank/grpc.go @@ -37,9 +37,7 @@ func (s *E2ETestSuite) TestTotalSupplyGRPCHandler() { sdk.NewCoin(fmt.Sprintf("%stoken", val.Moniker), s.cfg.AccountTokens), sdk.NewCoin(s.cfg.BondDenom, s.cfg.StakingTokens.Add(sdk.NewInt(10))), ), - Pagination: &query.PageResponse{ - Total: 2, - }, + Pagination: &query.PageResponse{}, }, }, { @@ -160,7 +158,7 @@ func (s *E2ETestSuite) TestDenomMetadataGRPCHandler() { Display: "eth", }, }, - Pagination: &query.PageResponse{Total: 2}, + Pagination: &query.PageResponse{}, }, }, { @@ -244,9 +242,7 @@ func (s *E2ETestSuite) TestBalancesGRPCHandler() { sdk.NewCoin(fmt.Sprintf("%stoken", val.Moniker), s.cfg.AccountTokens), sdk.NewCoin(s.cfg.BondDenom, s.cfg.StakingTokens.Sub(s.cfg.BondedTokens)), ), - Pagination: &query.PageResponse{ - Total: 2, - }, + Pagination: &query.PageResponse{}, }, }, { diff --git a/tests/e2e/bank/suite.go b/tests/e2e/bank/suite.go index 399c82d85e..79b21ee88f 100644 --- a/tests/e2e/bank/suite.go +++ b/tests/e2e/bank/suite.go @@ -296,7 +296,7 @@ func (s *E2ETestSuite) TestGetCmdQueryDenomsMetadata() { Display: "eth", }, }, - Pagination: &query.PageResponse{Total: 2}, + Pagination: &query.PageResponse{}, }, }, { diff --git a/tests/e2e/slashing/grpc.go b/tests/e2e/slashing/grpc.go index efea63187d..58d41b77f7 100644 --- a/tests/e2e/slashing/grpc.go +++ b/tests/e2e/slashing/grpc.go @@ -42,9 +42,7 @@ func (s *E2ETestSuite) TestGRPCQueries() { JailedUntil: time.Unix(0, 0), }, }, - Pagination: &query.PageResponse{ - Total: uint64(1), - }, + Pagination: &query.PageResponse{}, }, }, { diff --git a/tests/e2e/staking/grpc.go b/tests/e2e/staking/grpc.go index ef625af91d..45b52257bb 100644 --- a/tests/e2e/staking/grpc.go +++ b/tests/e2e/staking/grpc.go @@ -400,7 +400,7 @@ func (s *E2ETestSuite) TestGRPCQueryDelegatorDelegations() { DelegationResponses: types.DelegationResponses{ types.NewDelegationResp(val.Address, val.ValAddress, sdk.NewDecFromInt(cli.DefaultTokens), sdk.NewCoin(sdk.DefaultBondDenom, cli.DefaultTokens)), }, - Pagination: &query.PageResponse{Total: 1}, + Pagination: &query.PageResponse{}, }, }, { @@ -413,7 +413,7 @@ func (s *E2ETestSuite) TestGRPCQueryDelegatorDelegations() { &types.QueryDelegatorDelegationsResponse{}, &types.QueryDelegatorDelegationsResponse{ DelegationResponses: types.DelegationResponses{}, - Pagination: &query.PageResponse{Total: 0}, + Pagination: &query.PageResponse{}, }, }, } @@ -592,7 +592,6 @@ func (s *E2ETestSuite) TestGRPCQueryDelegatorValidators() { } else { s.Require().NoError(err) s.Require().Len(validators.Validators, len(s.network.Validators)) - s.Require().Equal(int(validators.Pagination.Total), len(s.network.Validators)) } }) } diff --git a/tests/go.mod b/tests/go.mod index b6034093d7..e6818aed14 100644 --- a/tests/go.mod +++ b/tests/go.mod @@ -17,7 +17,7 @@ require ( github.com/spf13/cobra v1.7.0 github.com/stretchr/testify v1.8.4 github.com/willf/bitset v1.1.3 // indirect - google.golang.org/protobuf v1.30.0 + google.golang.org/protobuf v1.31.0 gotest.tools/v3 v3.4.0 pgregory.net/rapid v0.5.5 ) @@ -145,14 +145,16 @@ require ( github.com/zondax/hid v0.9.1 // indirect github.com/zondax/ledger-go v0.14.1 // indirect go.etcd.io/bbolt v1.3.7 // indirect - golang.org/x/crypto v0.9.0 // indirect + golang.org/x/crypto v0.14.0 // indirect golang.org/x/exp v0.0.0-20230515195305-f3d0a9c9a5cc // indirect - golang.org/x/net v0.10.0 // indirect - golang.org/x/sys v0.8.0 // indirect - golang.org/x/term v0.8.0 // indirect - golang.org/x/text v0.9.0 // indirect - google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 // indirect - google.golang.org/grpc v1.56.1 // indirect + golang.org/x/net v0.17.0 // indirect + golang.org/x/sys v0.13.0 // indirect + golang.org/x/term v0.13.0 // indirect + golang.org/x/text v0.13.0 // indirect + google.golang.org/genproto v0.0.0-20230711160842-782d3b101e98 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20230711160842-782d3b101e98 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 // indirect + google.golang.org/grpc v1.58.3 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/tests/go.sum b/tests/go.sum index 0090de55dc..d4bddc63cc 100644 --- a/tests/go.sum +++ b/tests/go.sum @@ -1503,8 +1503,9 @@ golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5y golang.org/x/crypto v0.0.0-20211108221036-ceb1ce70b4fa/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20211117183948-ae814b36b871/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU= -golang.org/x/crypto v0.9.0 h1:LF6fAI+IutBocDJ2OT0Q1g8plpYljMZ4+lty+dsqw3g= golang.org/x/crypto v0.9.0/go.mod h1:yrmDGqONDYtNj3tH8X9dzUun2m2lzPa9ngI6/RUPGR0= +golang.org/x/crypto v0.14.0 h1:wBqGXzWJW6m1XrIKlAH0Hs1JJ7+9KBwnIO8v66Q9cHc= +golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -1620,8 +1621,9 @@ golang.org/x/net v0.0.0-20220607020251-c690dde0001d/go.mod h1:XRhObCWvk6IyKnWLug golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= -golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= +golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= +golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= golang.org/x/oauth2 v0.0.0-20170912212905-13449ad91cb2/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20181017192945-9dcd33a902f4/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= @@ -1761,15 +1763,17 @@ golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20221010170243-090e33056c14/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= +golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U= -golang.org/x/term v0.8.0 h1:n5xxQn2i3PC0yLAbjTpNT85q/Kgzcr2gIoX9OrJUols= golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= +golang.org/x/term v0.13.0 h1:bb+I9cTfFazGW51MZqBVmZy7+JEJMouUHTUSKVQLBek= +golang.org/x/term v0.13.0/go.mod h1:LTmsnFJwVN6bCy1rVCoS+qHT1HhALEFxKncY3WNNh4U= golang.org/x/text v0.0.0-20160726164857-2910a502d2bf/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -1783,8 +1787,9 @@ golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= -golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= +golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/time v0.0.0-20170424234030-8be79e1e0910/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -1958,8 +1963,12 @@ google.golang.org/genproto v0.0.0-20210126160654-44e461bb6506/go.mod h1:FWY/as6D google.golang.org/genproto v0.0.0-20210226172003-ab064af71705/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210426193834-eac7f76ac494/go.mod h1:P3QM42oQyzQSnHPnZ/vqoCdDmzH28fzWByN9asMeM8A= google.golang.org/genproto v0.0.0-20220314164441-57ef72a4c106/go.mod h1:hAL49I2IFola2sVEjAn7MEwsja0xp51I0tlGAf9hz4E= -google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 h1:KpwkzHKEF7B9Zxg18WzOa7djJ+Ha5DzthMyZYQfEn2A= -google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1/go.mod h1:nKE/iIaLqn2bQwXBg8f1g2Ylh6r5MN5CmZvuzZCgsCU= +google.golang.org/genproto v0.0.0-20230711160842-782d3b101e98 h1:Z0hjGZePRE0ZBWotvtrwxFNrNE9CUAGtplaDK5NNI/g= +google.golang.org/genproto v0.0.0-20230711160842-782d3b101e98/go.mod h1:S7mY02OqCJTD0E1OiQy1F72PWFB4bZJ87cAtLPYgDR0= +google.golang.org/genproto/googleapis/api v0.0.0-20230711160842-782d3b101e98 h1:FmF5cCW94Ij59cfpoLiwTgodWmm60eEV0CjlsVg2fuw= +google.golang.org/genproto/googleapis/api v0.0.0-20230711160842-782d3b101e98/go.mod h1:rsr7RhLuwsDKL7RmgDDCUc6yaGr1iqceVb5Wv6f6YvQ= +google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 h1:bVf09lpb+OJbByTj913DRJioFFAjf/ZGxEz7MajTp2U= +google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98/go.mod h1:TUfxEVdsvPg18p6AslUXFoLdpED4oBnGwyqk3dV1XzM= google.golang.org/grpc v1.2.1-0.20170921194603-d4b75ebd4f9f/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= google.golang.org/grpc v1.14.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= google.golang.org/grpc v1.16.0/go.mod h1:0JHn/cJsOMiMfNA9+DeHDlAU7KAAB5GDlYFpa9MZMio= @@ -1992,8 +2001,8 @@ google.golang.org/grpc v1.36.1/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAG google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ= google.golang.org/grpc v1.49.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= -google.golang.org/grpc v1.56.1 h1:z0dNfjIl0VpaZ9iSVjA6daGatAYwPGstTjt5vkRMFkQ= -google.golang.org/grpc v1.56.1/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpXqQ9s= +google.golang.org/grpc v1.58.3 h1:BjnpXut1btbtgN/6sp+brB2Kbm2LjNXnidYujAVbSoQ= +google.golang.org/grpc v1.58.3/go.mod h1:tgX3ZQDlNJGU96V6yHh1T/JeoBQ2TXdr43YbYSsCJk0= google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.0.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= @@ -2009,8 +2018,9 @@ google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp0 google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng= google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= +google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/bsm/ratelimit.v1 v1.0.0-20160220154919-db14e161995a/go.mod h1:KF9sEfUPAXdG8Oev9e99iLGnl2uJMjc5B+4y3O7x610= gopkg.in/cenkalti/backoff.v1 v1.1.0/go.mod h1:J6Vskwqd+OMVJl8C33mmtxTBs2gyzfv7UDAkHu8BrjI= diff --git a/testutil/testdata/unknonwnproto.pb.go b/testutil/testdata/unknonwnproto.pb.go index fcffd26d8e..3522a72535 100644 --- a/testutil/testdata/unknonwnproto.pb.go +++ b/testutil/testdata/unknonwnproto.pb.go @@ -715,6 +715,7 @@ 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"` @@ -848,6 +849,7 @@ 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"` @@ -992,6 +994,7 @@ 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"` @@ -1144,6 +1147,7 @@ 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"` @@ -1296,6 +1300,7 @@ 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"` @@ -1435,6 +1440,7 @@ 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"` @@ -1822,6 +1828,7 @@ 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"` @@ -2206,6 +2213,7 @@ 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"` @@ -2323,6 +2331,7 @@ 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/query/pagination.pb.go b/types/query/pagination.pb.go index 9680f298f4..cc37a25172 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 0be41d2029..885983f286 100644 --- a/types/tx/signing/signing.pb.go +++ b/types/tx/signing/signing.pb.go @@ -218,6 +218,7 @@ 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 cf1f47d451..4bc546be93 100644 --- a/types/tx/tx.pb.go +++ b/types/tx/tx.pb.go @@ -715,6 +715,7 @@ 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/types/tx_msg.go b/types/tx_msg.go index 41c647e57d..920d620faf 100644 --- a/types/tx_msg.go +++ b/types/tx_msg.go @@ -25,6 +25,17 @@ type ( GetSigners() []AccAddress } + // MsgWithRuntimeValidation defines the interface a transaction message which wants to enable runtime validation. + // Contract: enable runtime validation after Pampas upgrade. + MsgWithRuntimeValidation interface { + Msg + + // ValidateRuntime does a simple validation, different from ValidateBasic the context information + // will be used to facilitate validation for hardfork. + // Contract: only used for simple validation which needs hardfork logic. + ValidateRuntime(ctx Context) error + } + // Fee defines an interface for an application application-defined concrete // transaction type to be able to set and return the transaction fee. Fee interface { diff --git a/types/upgrade.go b/types/upgrade.go index b444a101df..e73a24d579 100644 --- a/types/upgrade.go +++ b/types/upgrade.go @@ -4,6 +4,9 @@ const ( // EnablePublicDelegationUpgrade is the upgrade name for enabling public delegation EnablePublicDelegationUpgrade = "EnablePublicDelegationUpgrade" - // Nagqu is the upgrade name for following features: + // Nagqu is the upgrade name for Nagqu upgrade Nagqu = "Nagqu" + + // Pampas is the upgrade name for Pampas upgrade + Pampas = "Pampas" ) diff --git a/x/distribution/types/distribution.pb.go b/x/distribution/types/distribution.pb.go index 5a8295d590..03ce9ef5f4 100644 --- a/x/distribution/types/distribution.pb.go +++ b/x/distribution/types/distribution.pb.go @@ -85,11 +85,12 @@ 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 ae6b6d354c..ac8079f797 100644 --- a/x/gashub/types/gashub.pb.go +++ b/x/gashub/types/gashub.pb.go @@ -85,6 +85,7 @@ 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/gashub/types/genesis.go b/x/gashub/types/genesis.go index b666c18a7b..e005c50516 100644 --- a/x/gashub/types/genesis.go +++ b/x/gashub/types/genesis.go @@ -110,6 +110,7 @@ func DefaultGenesisState() *GenesisState { *NewMsgGasParamsWithFixedGas("/greenfield.storage.MsgMigrateBucket", 1.2e3), *NewMsgGasParamsWithFixedGas("/greenfield.storage.MsgCancelMigrateBucket", 1.2e3), *NewMsgGasParamsWithFixedGas("/greenfield.storage.MsgCompleteMigrateBucket", 1.2e3), + *NewMsgGasParamsWithFixedGas("/greenfield.storage.MsgRejectMigrateBucket", 1.2e3), *NewMsgGasParamsWithFixedGas("/greenfield.payment.MsgCreatePaymentAccount", 2e5), *NewMsgGasParamsWithFixedGas("/greenfield.payment.MsgDeposit", 1.2e3), *NewMsgGasParamsWithFixedGas("/greenfield.payment.MsgWithdraw", 1.2e3), diff --git a/x/gov/keeper/proposal.go b/x/gov/keeper/proposal.go index 175cfff7a0..db8d4506c8 100644 --- a/x/gov/keeper/proposal.go +++ b/x/gov/keeper/proposal.go @@ -43,6 +43,12 @@ func (k Keeper) SubmitProposal(ctx sdk.Context, messages []sdk.Msg, metadata, ti return v1.Proposal{}, sdkerrors.Wrap(types.ErrInvalidProposalMsg, err.Error()) } + if runtimeMsg, ok := msg.(sdk.MsgWithRuntimeValidation); ok { + if err := runtimeMsg.ValidateRuntime(ctx); err != nil { + return v1.Proposal{}, sdkerrors.Wrap(types.ErrInvalidProposalMsg, err.Error()) + } + } + signers := msg.GetSigners() if len(signers) != 1 { return v1.Proposal{}, types.ErrInvalidSigner diff --git a/x/gov/testutil/expected_keepers.go b/x/gov/testutil/expected_keepers.go index 9adda8969b..d51c3bdb77 100644 --- a/x/gov/testutil/expected_keepers.go +++ b/x/gov/testutil/expected_keepers.go @@ -50,4 +50,6 @@ type CrossChainKeeper interface { GetReceiveSequence(ctx sdk.Context, destChainId sdk.ChainID, channelID sdk.ChannelID) uint64 IsDestChainSupported(chainID sdk.ChainID) bool + + GetDestOpChainID() sdk.ChainID } diff --git a/x/gov/testutil/expected_keepers_mocks.go b/x/gov/testutil/expected_keepers_mocks.go index 9bb5fbfb85..f769be7df3 100644 --- a/x/gov/testutil/expected_keepers_mocks.go +++ b/x/gov/testutil/expected_keepers_mocks.go @@ -1089,6 +1089,20 @@ func (mr *MockCrossChainKeeperMockRecorder) GetDestBscChainID() *gomock.Call { return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetDestBscChainID", reflect.TypeOf((*MockCrossChainKeeper)(nil).GetDestBscChainID)) } +// GetDestOpChainID mocks base method. +func (m *MockCrossChainKeeper) GetDestOpChainID() types.ChainID { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetDestOpChainID") + ret0, _ := ret[0].(types.ChainID) + return ret0 +} + +// GetDestOpChainID indicates an expected call of GetDestOpChainID. +func (mr *MockCrossChainKeeperMockRecorder) GetDestOpChainID() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetDestOpChainID", reflect.TypeOf((*MockCrossChainKeeper)(nil).GetDestOpChainID)) +} + // GetReceiveSequence mocks base method. func (m *MockCrossChainKeeper) GetReceiveSequence(ctx types.Context, destChainId types.ChainID, channelID types.ChannelID) uint64 { m.ctrl.T.Helper() diff --git a/x/gov/types/v1/gov.pb.go b/x/gov/types/v1/gov.pb.go index 3dec8ec332..4a2b5d6e26 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/types.pb.go b/x/group/types.pb.go index 16cb87020e..f375179d8d 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. diff --git a/x/oracle/keeper/grpc_query.go b/x/oracle/keeper/grpc_query.go index 357b7c4658..b7e010fe89 100644 --- a/x/oracle/keeper/grpc_query.go +++ b/x/oracle/keeper/grpc_query.go @@ -18,5 +18,5 @@ func (k Keeper) InturnRelayer(c context.Context, req *types.QueryInturnRelayerRe } ctx := sdk.UnwrapSDKContext(c) _, relayerInterval := k.GetRelayerParams(ctx) - return k.GetInturnRelayer(ctx, relayerInterval) + return k.GetInturnRelayer(ctx, relayerInterval, req.ClaimSrcChain) } diff --git a/x/oracle/keeper/keeper.go b/x/oracle/keeper/keeper.go index 8fad41b000..e6938093eb 100644 --- a/x/oracle/keeper/keeper.go +++ b/x/oracle/keeper/keeper.go @@ -4,6 +4,8 @@ import ( "bytes" "encoding/hex" + upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" + sdkerrors "cosmossdk.io/errors" "github.com/cometbft/cometbft/libs/log" storetypes "github.com/cosmos/cosmos-sdk/store/types" @@ -80,7 +82,7 @@ func (k Keeper) GetRelayerRewardShare(ctx sdk.Context) uint32 { } // IsRelayerValid returns true if the relayer is valid and allowed to send the claim message -func (k Keeper) IsRelayerValid(ctx sdk.Context, relayer sdk.AccAddress, validators []stakingtypes.Validator, claimTimestamp uint64) (bool, error) { +func (k Keeper) IsRelayerValid(ctx sdk.Context, relayer sdk.AccAddress, validators []stakingtypes.Validator, claimTimestamp uint64, claimSrcChain types.ClaimSrcChain) (bool, error) { var validatorIndex int64 = -1 var vldr stakingtypes.Validator for index, validator := range validators { @@ -98,7 +100,7 @@ func (k Keeper) IsRelayerValid(ctx sdk.Context, relayer sdk.AccAddress, validato inturnRelayerTimeout, relayerInterval := k.GetRelayerParams(ctx) // check whether submitter of msgClaim is an in-turn relayer - inturnRelayerBlsKey, _, err := k.getInturnRelayer(ctx, relayerInterval) + inturnRelayerBlsKey, _, err := k.getInturnRelayer(ctx, relayerInterval, claimSrcChain) if err != nil { return false, err } @@ -130,7 +132,12 @@ func (k Keeper) CheckClaim(ctx sdk.Context, claim *types.MsgClaim) (sdk.AccAddre } validators := historicalInfo.Valset - isValid, err := k.IsRelayerValid(ctx, relayer, validators, claim.Timestamp) + claimSrcChain := types.CLAIM_SRC_CHAIN_BSC + if ctx.IsUpgraded(upgradetypes.Pampas) && sdk.ChainID(claim.SrcChainId) == k.CrossChainKeeper.GetDestOpChainID() { + claimSrcChain = types.CLAIM_SRC_CHAIN_OP_BNB + } + + isValid, err := k.IsRelayerValid(ctx, relayer, validators, claim.Timestamp, claimSrcChain) if err != nil { return sdk.AccAddress{}, nil, err } @@ -190,7 +197,7 @@ func (k Keeper) GetParams(ctx sdk.Context) (params types.Params) { return params } -func (k Keeper) getInturnRelayer(ctx sdk.Context, relayerInterval uint64) ([]byte, *types.RelayInterval, error) { +func (k Keeper) getInturnRelayer(ctx sdk.Context, relayerInterval uint64, claimSrcChain types.ClaimSrcChain) ([]byte, *types.RelayInterval, error) { historicalInfo, ok := k.StakingKeeper.GetHistoricalInfo(ctx, ctx.BlockHeight()) if !ok { return nil, nil, sdkerrors.Wrapf(types.ErrValidatorSet, "get historical validators failed") @@ -211,6 +218,9 @@ func (k Keeper) getInturnRelayer(ctx sdk.Context, relayerInterval uint64) ([]byt start := curTimeStamp - (remainder - inTurnRelayerIndex*relayerInterval) end := start + relayerInterval + if claimSrcChain == types.CLAIM_SRC_CHAIN_OP_BNB { + inTurnRelayerIndex = (inTurnRelayerIndex + uint64(validatorsSize/2)) % uint64(validatorsSize) + } inturnRelayer := validators[inTurnRelayerIndex] return inturnRelayer.BlsKey, &types.RelayInterval{ @@ -219,8 +229,8 @@ func (k Keeper) getInturnRelayer(ctx sdk.Context, relayerInterval uint64) ([]byt }, nil } -func (k Keeper) GetInturnRelayer(ctx sdk.Context, relayerInterval uint64) (*types.QueryInturnRelayerResponse, error) { - blsKey, interval, err := k.getInturnRelayer(ctx, relayerInterval) +func (k Keeper) GetInturnRelayer(ctx sdk.Context, relayerInterval uint64, claimSrcChain types.ClaimSrcChain) (*types.QueryInturnRelayerResponse, error) { + blsKey, interval, err := k.getInturnRelayer(ctx, relayerInterval, claimSrcChain) if err != nil { return nil, err } diff --git a/x/oracle/keeper/keeper_test.go b/x/oracle/keeper/keeper_test.go index 98d948dff5..1918739abe 100644 --- a/x/oracle/keeper/keeper_test.go +++ b/x/oracle/keeper/keeper_test.go @@ -256,7 +256,7 @@ func (s *TestSuite) TestKeeper_IsRelayerValid() { for idx, test := range tests { s.ctx = s.ctx.WithBlockTime(time.Unix(test.blockTime, 0)) relayer := sdk.MustAccAddressFromHex(test.claimMsg.FromAddress) - isValid, err := s.oracleKeeper.IsRelayerValid(s.ctx, relayer, vals, test.claimMsg.Timestamp) + isValid, err := s.oracleKeeper.IsRelayerValid(s.ctx, relayer, vals, test.claimMsg.Timestamp, types.CLAIM_SRC_CHAIN_BSC) if test.expectedPass { s.Require().Nil(err) diff --git a/x/oracle/types/expected_keeper_mocks.go b/x/oracle/types/expected_keeper_mocks.go index d63d1ffe3d..008f103001 100644 --- a/x/oracle/types/expected_keeper_mocks.go +++ b/x/oracle/types/expected_keeper_mocks.go @@ -131,6 +131,34 @@ func (mr *MockCrossChainKeeperMockRecorder) GetCrossChainApp(channelID interface return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetCrossChainApp", reflect.TypeOf((*MockCrossChainKeeper)(nil).GetCrossChainApp), channelID) } +// GetDestBscChainID mocks base method. +func (m *MockCrossChainKeeper) GetDestBscChainID() types.ChainID { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetDestBscChainID") + ret0, _ := ret[0].(types.ChainID) + return ret0 +} + +// GetDestBscChainID indicates an expected call of GetDestBscChainID. +func (mr *MockCrossChainKeeperMockRecorder) GetDestBscChainID() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetDestBscChainID", reflect.TypeOf((*MockCrossChainKeeper)(nil).GetDestBscChainID)) +} + +// GetDestOpChainID mocks base method. +func (m *MockCrossChainKeeper) GetDestOpChainID() types.ChainID { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetDestOpChainID") + ret0, _ := ret[0].(types.ChainID) + return ret0 +} + +// GetDestOpChainID indicates an expected call of GetDestOpChainID. +func (mr *MockCrossChainKeeperMockRecorder) GetDestOpChainID() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetDestOpChainID", reflect.TypeOf((*MockCrossChainKeeper)(nil).GetDestOpChainID)) +} + // GetReceiveSequence mocks base method. func (m *MockCrossChainKeeper) GetReceiveSequence(ctx types.Context, chainId types.ChainID, channelID types.ChannelID) uint64 { m.ctrl.T.Helper() diff --git a/x/oracle/types/expected_keepers.go b/x/oracle/types/expected_keepers.go index 6d751db32e..00142ef448 100644 --- a/x/oracle/types/expected_keepers.go +++ b/x/oracle/types/expected_keepers.go @@ -22,6 +22,8 @@ type CrossChainKeeper interface { IsDestChainSupported(chainID sdk.ChainID) bool GetReceiveSequence(ctx sdk.Context, chainId sdk.ChainID, channelID sdk.ChannelID) uint64 IncrReceiveSequence(ctx sdk.Context, chainId sdk.ChainID, channelID sdk.ChannelID) + GetDestBscChainID() sdk.ChainID + GetDestOpChainID() sdk.ChainID } type BankKeeper interface { diff --git a/x/oracle/types/query.pb.go b/x/oracle/types/query.pb.go index f68671491b..7f8d31658e 100644 --- a/x/oracle/types/query.pb.go +++ b/x/oracle/types/query.pb.go @@ -29,6 +29,38 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package +// ClaimSrcChain defines the src chain of a claim +type ClaimSrcChain int32 + +const ( + // CLAIM_SRC_CHAIN_UNSPECIFIED + CLAIM_SRC_CHAIN_UNSPECIFIED ClaimSrcChain = 0 + // CLAIM_SRC_CHAIN_BSC defines BSC source chain + CLAIM_SRC_CHAIN_BSC ClaimSrcChain = 1 + // CLAIM_SRC_CHAIN_OP_BNB defines OPBNB source chain + CLAIM_SRC_CHAIN_OP_BNB ClaimSrcChain = 2 +) + +var ClaimSrcChain_name = map[int32]string{ + 0: "CLAIM_SRC_CHAIN_UNSPECIFIED", + 1: "CLAIM_SRC_CHAIN_BSC", + 2: "CLAIM_SRC_CHAIN_OP_BNB", +} + +var ClaimSrcChain_value = map[string]int32{ + "CLAIM_SRC_CHAIN_UNSPECIFIED": 0, + "CLAIM_SRC_CHAIN_BSC": 1, + "CLAIM_SRC_CHAIN_OP_BNB": 2, +} + +func (x ClaimSrcChain) String() string { + return proto.EnumName(ClaimSrcChain_name, int32(x)) +} + +func (ClaimSrcChain) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_9f804c4644f3aaef, []int{0} +} + // QueryParamsRequest is the request type for the Query/Params RPC method. type QueryParamsRequest struct { } @@ -114,6 +146,8 @@ func (m *QueryParamsResponse) GetParams() Params { // QueryInturnRelayerRequest is the request type for the Query In-turn relayer RPC method. type QueryInturnRelayerRequest struct { + // ClaimSrcChain defines the src chain of a claim + ClaimSrcChain ClaimSrcChain `protobuf:"varint,1,opt,name=claim_src_chain,json=claimSrcChain,proto3,enum=cosmos.oracle.v1.ClaimSrcChain" json:"claim_src_chain,omitempty"` } func (m *QueryInturnRelayerRequest) Reset() { *m = QueryInturnRelayerRequest{} } @@ -149,6 +183,13 @@ func (m *QueryInturnRelayerRequest) XXX_DiscardUnknown() { var xxx_messageInfo_QueryInturnRelayerRequest proto.InternalMessageInfo +func (m *QueryInturnRelayerRequest) GetClaimSrcChain() ClaimSrcChain { + if m != nil { + return m.ClaimSrcChain + } + return CLAIM_SRC_CHAIN_UNSPECIFIED +} + // QueryInturnRelayerResponse is the response type for the Query In-turn relayer RPC method. type QueryInturnRelayerResponse struct { BlsPubKey string `protobuf:"bytes,1,opt,name=bls_pub_key,json=blsPubKey,proto3" json:"bls_pub_key,omitempty"` @@ -203,6 +244,7 @@ func (m *QueryInturnRelayerResponse) GetRelayInterval() *RelayInterval { } func init() { + proto.RegisterEnum("cosmos.oracle.v1.ClaimSrcChain", ClaimSrcChain_name, ClaimSrcChain_value) proto.RegisterType((*QueryParamsRequest)(nil), "cosmos.oracle.v1.QueryParamsRequest") proto.RegisterType((*QueryParamsResponse)(nil), "cosmos.oracle.v1.QueryParamsResponse") proto.RegisterType((*QueryInturnRelayerRequest)(nil), "cosmos.oracle.v1.QueryInturnRelayerRequest") @@ -212,32 +254,39 @@ func init() { func init() { proto.RegisterFile("cosmos/oracle/v1/query.proto", fileDescriptor_9f804c4644f3aaef) } var fileDescriptor_9f804c4644f3aaef = []byte{ - // 400 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x52, 0x41, 0x6b, 0xe2, 0x40, - 0x18, 0x4d, 0x64, 0x57, 0x70, 0xc4, 0x65, 0x99, 0xf5, 0x90, 0xcd, 0xba, 0x51, 0xc2, 0x2e, 0x08, - 0xee, 0x66, 0xd0, 0x85, 0xfd, 0x01, 0x42, 0x0b, 0x52, 0x0a, 0x36, 0xc7, 0x5e, 0xc2, 0xc4, 0x0e, - 0x69, 0x30, 0x66, 0xe2, 0xcc, 0xc4, 0x36, 0xd7, 0xd2, 0x1f, 0x50, 0x68, 0xa1, 0x7f, 0xc9, 0xa3, - 0xd0, 0x4b, 0x4f, 0xa5, 0x68, 0x7f, 0x48, 0x71, 0x26, 0x42, 0x6d, 0x2c, 0xed, 0x29, 0xc9, 0xbc, - 0xf7, 0xbd, 0xf7, 0xbe, 0x97, 0x01, 0x8d, 0x11, 0xe5, 0x13, 0xca, 0x11, 0x65, 0x78, 0x14, 0x11, - 0x34, 0xeb, 0xa2, 0x69, 0x4a, 0x58, 0xe6, 0x24, 0x8c, 0x0a, 0x0a, 0xbf, 0x2a, 0xd4, 0x51, 0xa8, - 0x33, 0xeb, 0x9a, 0xf5, 0x80, 0x06, 0x54, 0x82, 0x68, 0xfd, 0xa6, 0x78, 0x66, 0x23, 0xa0, 0x34, - 0x88, 0x08, 0xc2, 0x49, 0x88, 0x70, 0x1c, 0x53, 0x81, 0x45, 0x48, 0x63, 0x9e, 0xa3, 0x3f, 0x0b, - 0x1e, 0xb9, 0x9e, 0x84, 0xed, 0x3a, 0x80, 0x47, 0x6b, 0xcf, 0x21, 0x66, 0x78, 0xc2, 0x5d, 0x32, - 0x4d, 0x09, 0x17, 0xf6, 0x21, 0xf8, 0xb6, 0x75, 0xca, 0x13, 0x1a, 0x73, 0x02, 0xff, 0x83, 0x72, - 0x22, 0x4f, 0x0c, 0xbd, 0xa5, 0xb7, 0xab, 0x3d, 0xc3, 0x79, 0x1d, 0xd1, 0x51, 0x13, 0xfd, 0x4f, - 0xf3, 0x87, 0xa6, 0xe6, 0xe6, 0x6c, 0xfb, 0x07, 0xf8, 0x2e, 0xe5, 0x06, 0xb1, 0x48, 0x59, 0xec, - 0x92, 0x08, 0x67, 0x84, 0x6d, 0xbc, 0x2e, 0x75, 0x60, 0xee, 0x42, 0x73, 0x4f, 0x0b, 0x54, 0xfd, - 0x88, 0x7b, 0x49, 0xea, 0x7b, 0x63, 0x92, 0x49, 0xe3, 0x8a, 0x5b, 0xf1, 0x23, 0x3e, 0x4c, 0xfd, - 0x03, 0x92, 0xc1, 0x7d, 0xf0, 0x85, 0xad, 0x47, 0xbc, 0x30, 0x16, 0x84, 0xcd, 0x70, 0x64, 0x94, - 0x64, 0xb6, 0x66, 0x31, 0x9b, 0x94, 0x1e, 0xe4, 0x34, 0xb7, 0xc6, 0x5e, 0x7e, 0xf6, 0x6e, 0x4b, - 0xe0, 0xb3, 0x8c, 0x01, 0xcf, 0x40, 0x59, 0x6d, 0x01, 0x7f, 0x15, 0x35, 0x8a, 0x65, 0x99, 0xbf, - 0xdf, 0x61, 0xa9, 0x45, 0xec, 0xd6, 0xc5, 0xdd, 0xd3, 0x75, 0xc9, 0x84, 0x06, 0x2a, 0xfc, 0x11, - 0x55, 0x13, 0xbc, 0xd1, 0x41, 0x6d, 0xab, 0x04, 0xd8, 0x79, 0x43, 0x7a, 0x57, 0x91, 0xe6, 0x9f, - 0x8f, 0x91, 0xf3, 0x38, 0x6d, 0x19, 0xc7, 0x86, 0xad, 0x62, 0x9c, 0x50, 0x0e, 0x78, 0x4c, 0x4d, - 0xf4, 0xf7, 0xe6, 0x4b, 0x4b, 0x5f, 0x2c, 0x2d, 0xfd, 0x71, 0x69, 0xe9, 0x57, 0x2b, 0x4b, 0x5b, - 0xac, 0x2c, 0xed, 0x7e, 0x65, 0x69, 0xc7, 0x9d, 0x20, 0x14, 0xa7, 0xa9, 0xef, 0x8c, 0xe8, 0x64, - 0xa3, 0xa2, 0x1e, 0x7f, 0xf9, 0xc9, 0x18, 0x9d, 0x6f, 0x24, 0x45, 0x96, 0x10, 0xee, 0x97, 0xe5, - 0x85, 0xfb, 0xf7, 0x1c, 0x00, 0x00, 0xff, 0xff, 0xc1, 0x7d, 0x7d, 0x85, 0xf5, 0x02, 0x00, 0x00, + // 504 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x53, 0x41, 0x6b, 0xd4, 0x40, + 0x18, 0x4d, 0x96, 0x5a, 0xe8, 0x94, 0xad, 0xcb, 0xb4, 0xe8, 0x1a, 0x6b, 0x76, 0x09, 0x0a, 0xc5, + 0x6a, 0x42, 0x57, 0xf0, 0xde, 0xc4, 0xad, 0x06, 0xed, 0xba, 0x66, 0xf1, 0xe2, 0x65, 0x98, 0xa4, + 0x43, 0x1a, 0x36, 0x9b, 0x49, 0x67, 0x92, 0xd5, 0x5c, 0xc5, 0x83, 0x47, 0x41, 0xc1, 0x1f, 0xe0, + 0x9f, 0xe9, 0xb1, 0xe0, 0xc5, 0x93, 0xc8, 0xae, 0x3f, 0x44, 0x32, 0x93, 0x42, 0x77, 0xb3, 0xa2, + 0xa7, 0x64, 0xe6, 0xbd, 0xef, 0xbd, 0xf7, 0x7d, 0x5f, 0x02, 0x76, 0x03, 0xca, 0x27, 0x94, 0x5b, + 0x94, 0xe1, 0x20, 0x26, 0xd6, 0xf4, 0xc0, 0x3a, 0xcb, 0x09, 0x2b, 0xcc, 0x94, 0xd1, 0x8c, 0xc2, + 0x96, 0x44, 0x4d, 0x89, 0x9a, 0xd3, 0x03, 0x6d, 0x27, 0xa4, 0x21, 0x15, 0xa0, 0x55, 0xbe, 0x49, + 0x9e, 0xb6, 0x1b, 0x52, 0x1a, 0xc6, 0xc4, 0xc2, 0x69, 0x64, 0xe1, 0x24, 0xa1, 0x19, 0xce, 0x22, + 0x9a, 0xf0, 0x0a, 0xbd, 0x53, 0xf3, 0xa8, 0xf4, 0x04, 0x6c, 0xec, 0x00, 0xf8, 0xaa, 0xf4, 0x1c, + 0x62, 0x86, 0x27, 0xdc, 0x23, 0x67, 0x39, 0xe1, 0x99, 0x71, 0x0c, 0xb6, 0x17, 0x6e, 0x79, 0x4a, + 0x13, 0x4e, 0xe0, 0x63, 0xb0, 0x9e, 0x8a, 0x9b, 0xb6, 0xda, 0x55, 0xf7, 0x36, 0x7b, 0x6d, 0x73, + 0x39, 0xa2, 0x29, 0x2b, 0xec, 0xb5, 0xf3, 0x9f, 0x1d, 0xc5, 0xab, 0xd8, 0xc6, 0x09, 0xb8, 0x25, + 0xe4, 0xdc, 0x24, 0xcb, 0x59, 0xe2, 0x91, 0x18, 0x17, 0x84, 0x55, 0x5e, 0xf0, 0x29, 0xb8, 0x1e, + 0xc4, 0x38, 0x9a, 0x20, 0xce, 0x02, 0x14, 0x9c, 0xe2, 0x28, 0x11, 0xea, 0x5b, 0xbd, 0x4e, 0x5d, + 0xdd, 0x29, 0x89, 0x23, 0x16, 0x38, 0x25, 0xcd, 0x6b, 0x06, 0x57, 0x8f, 0xc6, 0x07, 0x15, 0x68, + 0xab, 0x6c, 0xaa, 0xf0, 0x3a, 0xd8, 0xf4, 0x63, 0x8e, 0xd2, 0xdc, 0x47, 0x63, 0x52, 0x08, 0x8f, + 0x0d, 0x6f, 0xc3, 0x8f, 0xf9, 0x30, 0xf7, 0x9f, 0x93, 0x02, 0x1e, 0x81, 0x2d, 0x56, 0x96, 0xa0, + 0x28, 0xc9, 0x08, 0x9b, 0xe2, 0xb8, 0xdd, 0x10, 0x4d, 0xae, 0x88, 0x21, 0xa4, 0xdd, 0x8a, 0xe6, + 0x35, 0xd9, 0xd5, 0xe3, 0xfd, 0x31, 0x68, 0x2e, 0xc4, 0x84, 0x1d, 0x70, 0xdb, 0x79, 0x71, 0xe8, + 0x1e, 0xa3, 0x91, 0xe7, 0x20, 0xe7, 0xd9, 0xa1, 0x3b, 0x40, 0xaf, 0x07, 0xa3, 0x61, 0xdf, 0x71, + 0x8f, 0xdc, 0xfe, 0x93, 0x96, 0x02, 0x6f, 0x82, 0xed, 0x65, 0x82, 0x3d, 0x72, 0x5a, 0x2a, 0xd4, + 0xc0, 0x8d, 0x65, 0xe0, 0xe5, 0x10, 0xd9, 0x03, 0xbb, 0xd5, 0xd0, 0xd6, 0x3e, 0x7e, 0xd3, 0x95, + 0xde, 0xd7, 0x06, 0xb8, 0x26, 0x7a, 0x86, 0x6f, 0xc1, 0xba, 0x9c, 0x3d, 0xbc, 0x5b, 0x0f, 0x5c, + 0x5f, 0xb1, 0x76, 0xef, 0x1f, 0x2c, 0x39, 0x35, 0xa3, 0xfb, 0xfe, 0xfb, 0xef, 0xcf, 0x0d, 0x0d, + 0xb6, 0xad, 0xda, 0x77, 0x24, 0x97, 0x0b, 0xbf, 0xa8, 0xa0, 0xb9, 0x30, 0x71, 0xb8, 0xff, 0x17, + 0xe9, 0x55, 0xeb, 0xd7, 0x1e, 0xfc, 0x1f, 0xb9, 0x8a, 0xb3, 0x27, 0xe2, 0x18, 0xb0, 0x5b, 0x8f, + 0x13, 0x89, 0x02, 0xc4, 0x64, 0x85, 0xdd, 0x3f, 0x9f, 0xe9, 0xea, 0xc5, 0x4c, 0x57, 0x7f, 0xcd, + 0x74, 0xf5, 0xd3, 0x5c, 0x57, 0x2e, 0xe6, 0xba, 0xf2, 0x63, 0xae, 0x2b, 0x6f, 0xf6, 0xc3, 0x28, + 0x3b, 0xcd, 0x7d, 0x33, 0xa0, 0x93, 0x4b, 0x15, 0xf9, 0x78, 0xc8, 0x4f, 0xc6, 0xd6, 0xbb, 0x4b, + 0xc9, 0xac, 0x48, 0x09, 0xf7, 0xd7, 0xc5, 0x6f, 0xf2, 0xe8, 0x4f, 0x00, 0x00, 0x00, 0xff, 0xff, + 0x3f, 0x98, 0x40, 0xe8, 0xab, 0x03, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -436,6 +485,11 @@ func (m *QueryInturnRelayerRequest) MarshalToSizedBuffer(dAtA []byte) (int, erro _ = i var l int _ = l + if m.ClaimSrcChain != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.ClaimSrcChain)) + i-- + dAtA[i] = 0x8 + } return len(dAtA) - i, nil } @@ -518,6 +572,9 @@ func (m *QueryInturnRelayerRequest) Size() (n int) { } var l int _ = l + if m.ClaimSrcChain != 0 { + n += 1 + sovQuery(uint64(m.ClaimSrcChain)) + } return n } @@ -706,6 +763,25 @@ func (m *QueryInturnRelayerRequest) Unmarshal(dAtA []byte) error { return fmt.Errorf("proto: QueryInturnRelayerRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ClaimSrcChain", wireType) + } + m.ClaimSrcChain = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ClaimSrcChain |= ClaimSrcChain(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) diff --git a/x/oracle/types/query.pb.gw.go b/x/oracle/types/query.pb.gw.go index a882e7a39f..18ce835a69 100644 --- a/x/oracle/types/query.pb.gw.go +++ b/x/oracle/types/query.pb.gw.go @@ -51,10 +51,21 @@ func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshal } +var ( + filter_Query_InturnRelayer_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + func request_Query_InturnRelayer_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryInturnRelayerRequest var metadata runtime.ServerMetadata + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_InturnRelayer_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + msg, err := client.InturnRelayer(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err @@ -64,6 +75,13 @@ func local_request_Query_InturnRelayer_0(ctx context.Context, marshaler runtime. var protoReq QueryInturnRelayerRequest var metadata runtime.ServerMetadata + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_InturnRelayer_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + msg, err := server.InturnRelayer(ctx, &protoReq) return msg, metadata, err diff --git a/x/upgrade/types/upgrade_config.go b/x/upgrade/types/upgrade_config.go index eba8205025..a6a38064cb 100644 --- a/x/upgrade/types/upgrade_config.go +++ b/x/upgrade/types/upgrade_config.go @@ -10,8 +10,11 @@ const ( // EnablePublicDelegationUpgrade is the upgrade name for enabling public delegation EnablePublicDelegationUpgrade = types.EnablePublicDelegationUpgrade - // Nagqu is the upgrade name for following features: + // Nagqu is the upgrade name for Nagqu upgrade Nagqu = types.Nagqu + + // Pampas is the upgrade name for Pampas upgrade + Pampas = types.Pampas ) // The default upgrade config for networks @@ -28,6 +31,10 @@ var ( Name: Nagqu, Height: 471350, Info: "Nagqu hardfork", + }).SetPlan(&Plan{ + Name: Pampas, + Height: 2427233, + Info: "Pampas hardfork", }) )