diff --git a/CHANGELOG.md b/CHANGELOG.md index 5f681ba78916..e89f696f1bd7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -63,6 +63,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ ### Improvements +* [#15448](https://github.com/cosmos/cosmos-sdk/pull/15448) Automatically populate the block timestamp for historical queries. In contexts where the block timestamp is needed for previous states, the timestamp will now be set. Note, when querying against a node it must be re-synced in order to be able to automatically populate the block timestamp. Otherwise, the block timestamp will be populated for heights going forward once upgraded. * (x/gov) [#15554](https://github.com/cosmos/cosmos-sdk/pull/15554) Add proposal result log in `active_proposal` event. When a proposal passes but fails to execute, the proposal result is logged in the `active_proposal` event. * (mempool) [#15328](https://github.com/cosmos/cosmos-sdk/pull/15328) Improve the `PriorityNonceMempool` * Support generic transaction prioritization, instead of `ctx.Priority()` diff --git a/api/cosmos/store/v1beta1/commit_info.pulsar.go b/api/cosmos/store/v1beta1/commit_info.pulsar.go index 1f15079352d5..c3fb16e6a275 100644 --- a/api/cosmos/store/v1beta1/commit_info.pulsar.go +++ b/api/cosmos/store/v1beta1/commit_info.pulsar.go @@ -8,6 +8,7 @@ import ( protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoiface "google.golang.org/protobuf/runtime/protoiface" protoimpl "google.golang.org/protobuf/runtime/protoimpl" + timestamppb "google.golang.org/protobuf/types/known/timestamppb" io "io" reflect "reflect" sync "sync" @@ -68,6 +69,7 @@ var ( md_CommitInfo protoreflect.MessageDescriptor fd_CommitInfo_version protoreflect.FieldDescriptor fd_CommitInfo_store_infos protoreflect.FieldDescriptor + fd_CommitInfo_timestamp protoreflect.FieldDescriptor ) func init() { @@ -75,6 +77,7 @@ func init() { md_CommitInfo = File_cosmos_store_v1beta1_commit_info_proto.Messages().ByName("CommitInfo") fd_CommitInfo_version = md_CommitInfo.Fields().ByName("version") fd_CommitInfo_store_infos = md_CommitInfo.Fields().ByName("store_infos") + fd_CommitInfo_timestamp = md_CommitInfo.Fields().ByName("timestamp") } var _ protoreflect.Message = (*fastReflection_CommitInfo)(nil) @@ -154,6 +157,12 @@ func (x *fastReflection_CommitInfo) Range(f func(protoreflect.FieldDescriptor, p return } } + if x.Timestamp != nil { + value := protoreflect.ValueOfMessage(x.Timestamp.ProtoReflect()) + if !f(fd_CommitInfo_timestamp, value) { + return + } + } } // Has reports whether a field is populated. @@ -173,6 +182,8 @@ func (x *fastReflection_CommitInfo) Has(fd protoreflect.FieldDescriptor) bool { return x.Version != int64(0) case "cosmos.store.v1beta1.CommitInfo.store_infos": return len(x.StoreInfos) != 0 + case "cosmos.store.v1beta1.CommitInfo.timestamp": + return x.Timestamp != nil default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.store.v1beta1.CommitInfo")) @@ -193,6 +204,8 @@ func (x *fastReflection_CommitInfo) Clear(fd protoreflect.FieldDescriptor) { x.Version = int64(0) case "cosmos.store.v1beta1.CommitInfo.store_infos": x.StoreInfos = nil + case "cosmos.store.v1beta1.CommitInfo.timestamp": + x.Timestamp = nil default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.store.v1beta1.CommitInfo")) @@ -218,6 +231,9 @@ func (x *fastReflection_CommitInfo) Get(descriptor protoreflect.FieldDescriptor) } listValue := &_CommitInfo_2_list{list: &x.StoreInfos} return protoreflect.ValueOfList(listValue) + case "cosmos.store.v1beta1.CommitInfo.timestamp": + value := x.Timestamp + return protoreflect.ValueOfMessage(value.ProtoReflect()) default: if descriptor.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.store.v1beta1.CommitInfo")) @@ -244,6 +260,8 @@ func (x *fastReflection_CommitInfo) Set(fd protoreflect.FieldDescriptor, value p lv := value.List() clv := lv.(*_CommitInfo_2_list) x.StoreInfos = *clv.list + case "cosmos.store.v1beta1.CommitInfo.timestamp": + x.Timestamp = value.Message().Interface().(*timestamppb.Timestamp) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.store.v1beta1.CommitInfo")) @@ -270,6 +288,11 @@ func (x *fastReflection_CommitInfo) Mutable(fd protoreflect.FieldDescriptor) pro } value := &_CommitInfo_2_list{list: &x.StoreInfos} return protoreflect.ValueOfList(value) + case "cosmos.store.v1beta1.CommitInfo.timestamp": + if x.Timestamp == nil { + x.Timestamp = new(timestamppb.Timestamp) + } + return protoreflect.ValueOfMessage(x.Timestamp.ProtoReflect()) case "cosmos.store.v1beta1.CommitInfo.version": panic(fmt.Errorf("field version of message cosmos.store.v1beta1.CommitInfo is not mutable")) default: @@ -290,6 +313,9 @@ func (x *fastReflection_CommitInfo) NewField(fd protoreflect.FieldDescriptor) pr case "cosmos.store.v1beta1.CommitInfo.store_infos": list := []*StoreInfo{} return protoreflect.ValueOfList(&_CommitInfo_2_list{list: &list}) + case "cosmos.store.v1beta1.CommitInfo.timestamp": + m := new(timestamppb.Timestamp) + return protoreflect.ValueOfMessage(m.ProtoReflect()) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.store.v1beta1.CommitInfo")) @@ -368,6 +394,10 @@ func (x *fastReflection_CommitInfo) ProtoMethods() *protoiface.Methods { n += 1 + l + runtime.Sov(uint64(l)) } } + if x.Timestamp != nil { + l = options.Size(x.Timestamp) + n += 1 + l + runtime.Sov(uint64(l)) + } if x.unknownFields != nil { n += len(x.unknownFields) } @@ -397,6 +427,20 @@ func (x *fastReflection_CommitInfo) ProtoMethods() *protoiface.Methods { i -= len(x.unknownFields) copy(dAtA[i:], x.unknownFields) } + if x.Timestamp != nil { + encoded, err := options.Marshal(x.Timestamp) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0x1a + } if len(x.StoreInfos) > 0 { for iNdEx := len(x.StoreInfos) - 1; iNdEx >= 0; iNdEx-- { encoded, err := options.Marshal(x.StoreInfos[iNdEx]) @@ -520,6 +564,42 @@ func (x *fastReflection_CommitInfo) ProtoMethods() *protoiface.Methods { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err } iNdEx = postIndex + case 3: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Timestamp", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.Timestamp == nil { + x.Timestamp = ×tamppb.Timestamp{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Timestamp); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := runtime.Skip(dAtA[iNdEx:]) @@ -1544,8 +1624,9 @@ type CommitInfo struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Version int64 `protobuf:"varint,1,opt,name=version,proto3" json:"version,omitempty"` - StoreInfos []*StoreInfo `protobuf:"bytes,2,rep,name=store_infos,json=storeInfos,proto3" json:"store_infos,omitempty"` + Version int64 `protobuf:"varint,1,opt,name=version,proto3" json:"version,omitempty"` + StoreInfos []*StoreInfo `protobuf:"bytes,2,rep,name=store_infos,json=storeInfos,proto3" json:"store_infos,omitempty"` + Timestamp *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=timestamp,proto3" json:"timestamp,omitempty"` } func (x *CommitInfo) Reset() { @@ -1582,6 +1663,13 @@ func (x *CommitInfo) GetStoreInfos() []*StoreInfo { return nil } +func (x *CommitInfo) GetTimestamp() *timestamppb.Timestamp { + if x != nil { + return x.Timestamp + } + return nil +} + // StoreInfo defines store-specific commit information. It contains a reference // between a store name and the commit ID. type StoreInfo struct { @@ -1680,38 +1768,44 @@ var file_cosmos_store_v1beta1_commit_info_proto_rawDesc = []byte{ 0x66, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x1a, 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x67, 0x6f, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x6e, 0x0a, 0x0a, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x49, 0x6e, - 0x66, 0x6f, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x03, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x46, 0x0a, 0x0b, - 0x73, 0x74, 0x6f, 0x72, 0x65, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, - 0x0b, 0x32, 0x1f, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, - 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x49, 0x6e, - 0x66, 0x6f, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x0a, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x49, - 0x6e, 0x66, 0x6f, 0x73, 0x22, 0x62, 0x0a, 0x09, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x49, 0x6e, 0x66, - 0x6f, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x41, 0x0a, 0x09, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x5f, - 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, - 0x73, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, - 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x49, 0x44, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x08, - 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x49, 0x64, 0x22, 0x3e, 0x0a, 0x08, 0x43, 0x6f, 0x6d, 0x6d, - 0x69, 0x74, 0x49, 0x44, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x12, - 0x0a, 0x04, 0x68, 0x61, 0x73, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x68, 0x61, - 0x73, 0x68, 0x3a, 0x04, 0x98, 0xa0, 0x1f, 0x00, 0x42, 0xd1, 0x01, 0x0a, 0x18, 0x63, 0x6f, 0x6d, + 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xb2, 0x01, 0x0a, 0x0a, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, + 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x46, + 0x0a, 0x0b, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x73, 0x18, 0x02, 0x20, + 0x03, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x6f, + 0x72, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x53, 0x74, 0x6f, 0x72, 0x65, + 0x49, 0x6e, 0x66, 0x6f, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x0a, 0x73, 0x74, 0x6f, 0x72, + 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x73, 0x12, 0x42, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, + 0x61, 0x6d, 0x70, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, + 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, + 0x73, 0x74, 0x61, 0x6d, 0x70, 0x42, 0x08, 0xc8, 0xde, 0x1f, 0x00, 0x90, 0xdf, 0x1f, 0x01, 0x52, + 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x22, 0x62, 0x0a, 0x09, 0x53, 0x74, + 0x6f, 0x72, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x41, 0x0a, 0x09, 0x63, + 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x31, - 0x62, 0x65, 0x74, 0x61, 0x31, 0x42, 0x0f, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x49, 0x6e, 0x66, - 0x6f, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x32, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, - 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, - 0x73, 0x2f, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x3b, - 0x73, 0x74, 0x6f, 0x72, 0x65, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xa2, 0x02, 0x03, 0x43, - 0x53, 0x58, 0xaa, 0x02, 0x14, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x53, 0x74, 0x6f, 0x72, - 0x65, 0x2e, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xca, 0x02, 0x14, 0x43, 0x6f, 0x73, 0x6d, - 0x6f, 0x73, 0x5c, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x5c, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, - 0xe2, 0x02, 0x20, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x5c, - 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, - 0x61, 0x74, 0x61, 0xea, 0x02, 0x16, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x53, 0x74, - 0x6f, 0x72, 0x65, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x62, 0x06, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x33, + 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x49, 0x44, 0x42, 0x04, + 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x08, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x49, 0x64, 0x22, 0x3e, + 0x0a, 0x08, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x49, 0x44, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, + 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x76, 0x65, 0x72, + 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x68, 0x61, 0x73, 0x68, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0c, 0x52, 0x04, 0x68, 0x61, 0x73, 0x68, 0x3a, 0x04, 0x98, 0xa0, 0x1f, 0x00, 0x42, 0xd1, + 0x01, 0x0a, 0x18, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x74, + 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x42, 0x0f, 0x43, 0x6f, 0x6d, + 0x6d, 0x69, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x32, + 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, + 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2f, 0x76, 0x31, + 0x62, 0x65, 0x74, 0x61, 0x31, 0x3b, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x76, 0x31, 0x62, 0x65, 0x74, + 0x61, 0x31, 0xa2, 0x02, 0x03, 0x43, 0x53, 0x58, 0xaa, 0x02, 0x14, 0x43, 0x6f, 0x73, 0x6d, 0x6f, + 0x73, 0x2e, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xca, + 0x02, 0x14, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x5c, 0x56, + 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xe2, 0x02, 0x20, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, + 0x53, 0x74, 0x6f, 0x72, 0x65, 0x5c, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x5c, 0x47, 0x50, + 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x16, 0x43, 0x6f, 0x73, 0x6d, + 0x6f, 0x73, 0x3a, 0x3a, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x65, 0x74, + 0x61, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -1728,18 +1822,20 @@ func file_cosmos_store_v1beta1_commit_info_proto_rawDescGZIP() []byte { var file_cosmos_store_v1beta1_commit_info_proto_msgTypes = make([]protoimpl.MessageInfo, 3) var file_cosmos_store_v1beta1_commit_info_proto_goTypes = []interface{}{ - (*CommitInfo)(nil), // 0: cosmos.store.v1beta1.CommitInfo - (*StoreInfo)(nil), // 1: cosmos.store.v1beta1.StoreInfo - (*CommitID)(nil), // 2: cosmos.store.v1beta1.CommitID + (*CommitInfo)(nil), // 0: cosmos.store.v1beta1.CommitInfo + (*StoreInfo)(nil), // 1: cosmos.store.v1beta1.StoreInfo + (*CommitID)(nil), // 2: cosmos.store.v1beta1.CommitID + (*timestamppb.Timestamp)(nil), // 3: google.protobuf.Timestamp } var file_cosmos_store_v1beta1_commit_info_proto_depIdxs = []int32{ 1, // 0: cosmos.store.v1beta1.CommitInfo.store_infos:type_name -> cosmos.store.v1beta1.StoreInfo - 2, // 1: cosmos.store.v1beta1.StoreInfo.commit_id:type_name -> cosmos.store.v1beta1.CommitID - 2, // [2:2] is the sub-list for method output_type - 2, // [2:2] 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 + 3, // 1: cosmos.store.v1beta1.CommitInfo.timestamp:type_name -> google.protobuf.Timestamp + 2, // 2: cosmos.store.v1beta1.StoreInfo.commit_id:type_name -> cosmos.store.v1beta1.CommitID + 3, // [3:3] is the sub-list for method output_type + 3, // [3:3] 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_store_v1beta1_commit_info_proto_init() } diff --git a/baseapp/abci.go b/baseapp/abci.go index 09c22b6e3a3e..e50ad1ba458d 100644 --- a/baseapp/abci.go +++ b/baseapp/abci.go @@ -17,6 +17,7 @@ import ( grpcstatus "google.golang.org/grpc/status" errorsmod "cosmossdk.io/errors" + "cosmossdk.io/store/rootmulti" snapshottypes "cosmossdk.io/store/snapshots/types" storetypes "cosmossdk.io/store/types" @@ -456,6 +457,11 @@ func (app *BaseApp) Commit() abci.ResponseCommit { header := app.deliverState.ctx.BlockHeader() retainHeight := app.GetBlockRetentionHeight(header.Height) + rms, ok := app.cms.(*rootmulti.Store) + if ok { + rms.SetCommitHeader(header) + } + // Write the DeliverTx state into branched storage and commit the MultiStore. // The write to the DeliverTx state writes all state transitions to the root // MultiStore (app.cms) so when Commit() is called is persists those values. @@ -810,6 +816,16 @@ func (app *BaseApp) CreateQueryContext(height int64, prove bool) (sdk.Context, e WithMinGasPrices(app.minGasPrices). WithBlockHeight(height) + if height != lastBlockHeight { + rms, ok := app.cms.(*rootmulti.Store) + if ok { + cInfo, err := rms.GetCommitInfo(height) + if cInfo != nil && err == nil { + ctx = ctx.WithBlockTime(cInfo.Timestamp) + } + } + } + return ctx, nil } diff --git a/go.mod b/go.mod index 7e43003f42e2..fd1569288350 100644 --- a/go.mod +++ b/go.mod @@ -160,6 +160,8 @@ require ( // Below are the long-lived replace of the Cosmos SDK replace ( + cosmossdk.io/store => ./store + cosmossdk.io/x/tx => ./x/tx // use cosmos fork of keyring github.com/99designs/keyring => github.com/cosmos/keyring v1.2.0 // dgrijalva/jwt-go is deprecated and doesn't receive security updates. diff --git a/go.sum b/go.sum index b618d036247f..992684dfa70f 100644 --- a/go.sum +++ b/go.sum @@ -49,10 +49,6 @@ cosmossdk.io/log v0.1.0 h1:Vnexi+KzUCjmqq/m93teAxjt5biWFfZ5PI1imx2IJw8= cosmossdk.io/log v0.1.0/go.mod h1:p95Wq6mDY3SREMc4y7+QU9Uwy3nyvfpWGD1iSaFkVFs= cosmossdk.io/math v1.0.0 h1:ro9w7eKx23om2tZz/VM2Pf+z2WAbGX1yDQQOJ6iGeJw= cosmossdk.io/math v1.0.0/go.mod h1:Ygz4wBHrgc7g0N+8+MrnTfS9LLn9aaTGa9hKopuym5k= -cosmossdk.io/store v0.1.0-alpha.1 h1:NGomhLUXzAxvK4OF8+yP6eNUG5i4LwzOzx+S494pTCg= -cosmossdk.io/store v0.1.0-alpha.1/go.mod h1:kmCMbhrleCZ6rDZPY/EGNldNvPebFNyVPFYp+pv05/k= -cosmossdk.io/x/tx v0.3.1-0.20230321155358-6522dd1731b5 h1:AlvyRc7f7Py1mv254vrqjIIuykCnitHIz2T+nup3bU0= -cosmossdk.io/x/tx v0.3.1-0.20230321155358-6522dd1731b5/go.mod h1:FNkSEMbLP9NFdTfrbslNUtNS7OXf3wgZeJyXzfRPa4c= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= filippo.io/edwards25519 v1.0.0 h1:0wAIcmJUqRdI8IJ/3eGi5/HwXZWPujYXXlkrQogz0Ek= filippo.io/edwards25519 v1.0.0/go.mod h1:N1IkdkCkiLB6tki+MYJoSx2JTY9NUlxZE7eHn5EwJns= diff --git a/proto/cosmos/store/v1beta1/commit_info.proto b/proto/cosmos/store/v1beta1/commit_info.proto index b9abea9a80bd..a931e3e7d762 100644 --- a/proto/cosmos/store/v1beta1/commit_info.proto +++ b/proto/cosmos/store/v1beta1/commit_info.proto @@ -2,14 +2,17 @@ syntax = "proto3"; package cosmos.store.v1beta1; import "gogoproto/gogo.proto"; +import "google/protobuf/timestamp.proto"; option go_package = "cosmossdk.io/store/types"; // CommitInfo defines commit information used by the multi-store when committing // a version/height. message CommitInfo { - int64 version = 1; - repeated StoreInfo store_infos = 2 [(gogoproto.nullable) = false]; + int64 version = 1; + repeated StoreInfo store_infos = 2 [(gogoproto.nullable) = false]; + google.protobuf.Timestamp timestamp = 3 + [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; } // StoreInfo defines store-specific commit information. It contains a reference diff --git a/simapp/go.mod b/simapp/go.mod index 4236763ed2a9..bf109dbdc8d2 100644 --- a/simapp/go.mod +++ b/simapp/go.mod @@ -195,6 +195,7 @@ require ( replace ( // TODO tag all extracted modules after SDK refactor cosmossdk.io/api => ../api + cosmossdk.io/store => ../store cosmossdk.io/tools/confix => ../tools/confix cosmossdk.io/tools/rosetta => ../tools/rosetta cosmossdk.io/x/evidence => ../x/evidence diff --git a/simapp/go.sum b/simapp/go.sum index 8fb99f71129e..2b051bd0fb4a 100644 --- a/simapp/go.sum +++ b/simapp/go.sum @@ -202,8 +202,6 @@ cosmossdk.io/log v0.1.0 h1:Vnexi+KzUCjmqq/m93teAxjt5biWFfZ5PI1imx2IJw8= cosmossdk.io/log v0.1.0/go.mod h1:p95Wq6mDY3SREMc4y7+QU9Uwy3nyvfpWGD1iSaFkVFs= cosmossdk.io/math v1.0.0 h1:ro9w7eKx23om2tZz/VM2Pf+z2WAbGX1yDQQOJ6iGeJw= cosmossdk.io/math v1.0.0/go.mod h1:Ygz4wBHrgc7g0N+8+MrnTfS9LLn9aaTGa9hKopuym5k= -cosmossdk.io/store v0.1.0-alpha.1 h1:NGomhLUXzAxvK4OF8+yP6eNUG5i4LwzOzx+S494pTCg= -cosmossdk.io/store v0.1.0-alpha.1/go.mod h1:kmCMbhrleCZ6rDZPY/EGNldNvPebFNyVPFYp+pv05/k= cosmossdk.io/x/tx v0.3.1-0.20230321155358-6522dd1731b5 h1:AlvyRc7f7Py1mv254vrqjIIuykCnitHIz2T+nup3bU0= cosmossdk.io/x/tx v0.3.1-0.20230321155358-6522dd1731b5/go.mod h1:FNkSEMbLP9NFdTfrbslNUtNS7OXf3wgZeJyXzfRPa4c= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= diff --git a/store/go.mod b/store/go.mod index d41cae8356b9..106faa98c89a 100644 --- a/store/go.mod +++ b/store/go.mod @@ -23,7 +23,7 @@ require ( golang.org/x/exp v0.0.0-20230321023759-10a507213a29 google.golang.org/genproto v0.0.0-20230320184635-7606e756e683 // indirect google.golang.org/grpc v1.54.0 - google.golang.org/protobuf v1.30.0 // indirect + google.golang.org/protobuf v1.30.0 gotest.tools/v3 v3.4.0 ) diff --git a/store/rootmulti/store.go b/store/rootmulti/store.go index f54a30dbb543..f8411c8aaf67 100644 --- a/store/rootmulti/store.go +++ b/store/rootmulti/store.go @@ -11,6 +11,7 @@ import ( "cosmossdk.io/log" abci "github.com/cometbft/cometbft/abci/types" + cmtproto "github.com/cometbft/cometbft/proto/tendermint/types" dbm "github.com/cosmos/cosmos-db" protoio "github.com/cosmos/gogoproto/io" gogotypes "github.com/cosmos/gogoproto/types" @@ -67,16 +68,13 @@ type Store struct { lazyLoading bool initialVersion int64 removalMap map[types.StoreKey]bool - - traceWriter io.Writer - traceContext types.TraceContext - traceContextMutex sync.Mutex - - interBlockCache types.MultiStorePersistentCache - - listeners map[types.StoreKey]*types.MemoryListener - - metrics metrics.StoreMetrics + traceWriter io.Writer + traceContext types.TraceContext + traceContextMutex sync.Mutex + interBlockCache types.MultiStorePersistentCache + listeners map[types.StoreKey]*types.MemoryListener + metrics metrics.StoreMetrics + commitHeader cmtproto.Header } var ( @@ -217,7 +215,7 @@ func (rs *Store) loadVersion(ver int64, upgrades *types.StoreUpgrades) error { // load old data if we are not version 0 if ver != 0 { var err error - cInfo, err = getCommitInfo(rs.db, ver) + cInfo, err = rs.GetCommitInfo(ver) if err != nil { return err } @@ -469,7 +467,12 @@ func (rs *Store) Commit() types.CommitID { version = previousHeight + 1 } + if rs.commitHeader.Height != version { + rs.logger.Debug("commit header and version mismatch", "header_height", rs.commitHeader.Height, "version", version) + } + rs.lastCommitInfo = commitStores(version, rs.stores, rs.removalMap) + rs.lastCommitInfo.Timestamp = rs.commitHeader.Time defer rs.flushMetadata(rs.db, version, rs.lastCommitInfo) // remove remnants of removed stores @@ -480,6 +483,7 @@ func (rs *Store) Commit() types.CommitID { delete(rs.keysByName, sk.Name()) } } + // reset the removalMap rs.removalMap = make(map[types.StoreKey]bool) @@ -705,7 +709,7 @@ func (rs *Store) Query(req abci.RequestQuery) abci.ResponseQuery { if res.Height == rs.lastCommitInfo.Version { commitInfo = rs.lastCommitInfo } else { - commitInfo, err = getCommitInfo(rs.db, res.Height) + commitInfo, err = rs.GetCommitInfo(res.Height) if err != nil { return types.QueryResult(err, false) } @@ -1048,6 +1052,32 @@ func (rs *Store) RollbackToVersion(target int64) error { return rs.LoadLatestVersion() } +// SetCommitHeader sets the commit block header of the store. +func (rs *Store) SetCommitHeader(h cmtproto.Header) { + rs.commitHeader = h +} + +// GetCommitInfo attempts to retrieve CommitInfo for a given version/height. It +// will return an error if no CommitInfo exists, we fail to unmarshal the record +// or if we cannot retrieve the object from the DB. +func (rs *Store) GetCommitInfo(ver int64) (*types.CommitInfo, error) { + cInfoKey := fmt.Sprintf(commitInfoKeyFmt, ver) + + bz, err := rs.db.Get([]byte(cInfoKey)) + if err != nil { + return nil, errorsmod.Wrap(err, "failed to get commit info") + } else if bz == nil { + return nil, errors.New("no commit info found") + } + + cInfo := &types.CommitInfo{} + if err = cInfo.Unmarshal(bz); err != nil { + return nil, errorsmod.Wrap(err, "failed unmarshal commit info") + } + + return cInfo, nil +} + func (rs *Store) flushMetadata(db dbm.DB, version int64, cInfo *types.CommitInfo) { rs.logger.Debug("flushing metadata", "height", version) batch := db.NewBatch() @@ -1143,25 +1173,6 @@ func commitStores(version int64, storeMap map[types.StoreKey]types.CommitKVStore } } -// Gets commitInfo from disk. -func getCommitInfo(db dbm.DB, ver int64) (*types.CommitInfo, error) { - cInfoKey := fmt.Sprintf(commitInfoKeyFmt, ver) - - bz, err := db.Get([]byte(cInfoKey)) - if err != nil { - return nil, errorsmod.Wrap(err, "failed to get commit info") - } else if bz == nil { - return nil, errors.New("no commit info found") - } - - cInfo := &types.CommitInfo{} - if err = cInfo.Unmarshal(bz); err != nil { - return nil, errorsmod.Wrap(err, "failed unmarshal commit info") - } - - return cInfo, nil -} - func flushCommitInfo(batch dbm.Batch, version int64, cInfo *types.CommitInfo) { bz, err := cInfo.Marshal() if err != nil { diff --git a/store/rootmulti/store_test.go b/store/rootmulti/store_test.go index 4beaa73af630..b5cea147854d 100644 --- a/store/rootmulti/store_test.go +++ b/store/rootmulti/store_test.go @@ -204,7 +204,7 @@ func TestMultistoreLoadWithUpgrade(t *testing.T) { expectedCommitID := getExpectedCommitID(store, 1) checkStore(t, store, expectedCommitID, commitID) - ci, err := getCommitInfo(db, 1) + ci, err := store.GetCommitInfo(1) require.NoError(t, err) require.Equal(t, int64(1), ci.Version) require.Equal(t, 3, len(ci.StoreInfos)) @@ -294,7 +294,7 @@ func TestMultistoreLoadWithUpgrade(t *testing.T) { require.Equal(t, v4, rl4.Get(k4)) // check commitInfo in storage - ci, err = getCommitInfo(db, 2) + ci, err = reload.GetCommitInfo(2) require.NoError(t, err) require.Equal(t, int64(2), ci.Version) require.Equal(t, 3, len(ci.StoreInfos), ci.StoreInfos) @@ -349,7 +349,7 @@ func TestMultiStoreRestart(t *testing.T) { multi.Commit() - cinfo, err := getCommitInfo(multi.db, int64(i)) + cinfo, err := multi.GetCommitInfo(int64(i)) require.NoError(t, err) require.Equal(t, int64(i), cinfo.Version) } @@ -364,7 +364,7 @@ func TestMultiStoreRestart(t *testing.T) { multi.Commit() - flushedCinfo, err := getCommitInfo(multi.db, 3) + flushedCinfo, err := multi.GetCommitInfo(3) require.Nil(t, err) require.NotEqual(t, initCid, flushedCinfo, "CID is different after flush to disk") @@ -374,7 +374,7 @@ func TestMultiStoreRestart(t *testing.T) { multi.Commit() - postFlushCinfo, err := getCommitInfo(multi.db, 4) + postFlushCinfo, err := multi.GetCommitInfo(4) require.NoError(t, err) require.Equal(t, int64(4), postFlushCinfo.Version, "Commit changed after in-memory commit") @@ -757,7 +757,7 @@ func TestCommitOrdered(t *testing.T) { typeID := multi.Commit() require.Equal(t, int64(1), typeID.Version) - ci, err := getCommitInfo(db, 1) + ci, err := multi.GetCommitInfo(1) require.NoError(t, err) require.Equal(t, int64(1), ci.Version) require.Equal(t, 3, len(ci.StoreInfos)) diff --git a/store/types/commit_info.pb.go b/store/types/commit_info.pb.go index 813a7c4fcf06..81220a79c236 100644 --- a/store/types/commit_info.pb.go +++ b/store/types/commit_info.pb.go @@ -7,15 +7,19 @@ import ( fmt "fmt" _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/cosmos/gogoproto/proto" + github_com_cosmos_gogoproto_types "github.com/cosmos/gogoproto/types" + _ "google.golang.org/protobuf/types/known/timestamppb" io "io" math "math" math_bits "math/bits" + time "time" ) // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal var _ = fmt.Errorf var _ = math.Inf +var _ = time.Kitchen // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. @@ -28,6 +32,7 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type CommitInfo struct { Version int64 `protobuf:"varint,1,opt,name=version,proto3" json:"version,omitempty"` StoreInfos []StoreInfo `protobuf:"bytes,2,rep,name=store_infos,json=storeInfos,proto3" json:"store_infos"` + Timestamp time.Time `protobuf:"bytes,3,opt,name=timestamp,proto3,stdtime" json:"timestamp"` } func (m *CommitInfo) Reset() { *m = CommitInfo{} } @@ -77,6 +82,13 @@ func (m *CommitInfo) GetStoreInfos() []StoreInfo { return nil } +func (m *CommitInfo) GetTimestamp() time.Time { + if m != nil { + return m.Timestamp + } + return time.Time{} +} + // StoreInfo defines store-specific commit information. It contains a reference // between a store name and the commit ID. type StoreInfo struct { @@ -195,25 +207,28 @@ func init() { } var fileDescriptor_5f8c656cdef8c524 = []byte{ - // 282 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x4b, 0xce, 0x2f, 0xce, - 0xcd, 0x2f, 0xd6, 0x2f, 0x2e, 0xc9, 0x2f, 0x4a, 0xd5, 0x2f, 0x33, 0x4c, 0x4a, 0x2d, 0x49, 0x34, - 0xd4, 0x4f, 0xce, 0xcf, 0xcd, 0xcd, 0x2c, 0x89, 0xcf, 0xcc, 0x4b, 0xcb, 0xd7, 0x2b, 0x28, 0xca, - 0x2f, 0xc9, 0x17, 0x12, 0x81, 0xa8, 0xd3, 0x03, 0xab, 0xd3, 0x83, 0xaa, 0x93, 0x12, 0x49, 0xcf, - 0x4f, 0xcf, 0x07, 0x2b, 0xd0, 0x07, 0xb1, 0x20, 0x6a, 0x95, 0xf2, 0xb8, 0xb8, 0x9c, 0xc1, 0x06, - 0x78, 0xe6, 0xa5, 0xe5, 0x0b, 0x49, 0x70, 0xb1, 0x97, 0xa5, 0x16, 0x15, 0x67, 0xe6, 0xe7, 0x49, - 0x30, 0x2a, 0x30, 0x6a, 0x30, 0x07, 0xc1, 0xb8, 0x42, 0x6e, 0x5c, 0xdc, 0x60, 0xe3, 0xc0, 0xf6, - 0x14, 0x4b, 0x30, 0x29, 0x30, 0x6b, 0x70, 0x1b, 0xc9, 0xeb, 0x61, 0xb3, 0x49, 0x2f, 0x18, 0xc4, - 0x03, 0x99, 0xe7, 0xc4, 0x72, 0xe2, 0x9e, 0x3c, 0x43, 0x10, 0x57, 0x31, 0x4c, 0xa0, 0x58, 0x29, - 0x89, 0x8b, 0x13, 0x2e, 0x2d, 0x24, 0xc4, 0xc5, 0x92, 0x97, 0x98, 0x9b, 0x0a, 0xb6, 0x8b, 0x33, - 0x08, 0xcc, 0x16, 0x72, 0xe4, 0xe2, 0x84, 0xf9, 0x28, 0x45, 0x82, 0x49, 0x81, 0x51, 0x83, 0xdb, - 0x48, 0x0e, 0xbb, 0x35, 0x50, 0x77, 0xbb, 0x40, 0x6d, 0xe1, 0x80, 0x68, 0xf3, 0x4c, 0x51, 0xb2, - 0xe3, 0xe2, 0x80, 0xc9, 0xe1, 0xf1, 0x91, 0x10, 0x17, 0x4b, 0x46, 0x62, 0x71, 0x06, 0xd8, 0x0e, - 0x9e, 0x20, 0x30, 0xdb, 0x8a, 0x65, 0xc6, 0x02, 0x79, 0x06, 0x27, 0xa3, 0x13, 0x8f, 0xe4, 0x18, - 0x2f, 0x3c, 0x92, 0x63, 0x7c, 0xf0, 0x48, 0x8e, 0x71, 0xc2, 0x63, 0x39, 0x86, 0x0b, 0x8f, 0xe5, - 0x18, 0x6e, 0x3c, 0x96, 0x63, 0x88, 0x92, 0x80, 0x38, 0xa4, 0x38, 0x25, 0x5b, 0x2f, 0x33, 0x1f, - 0x1a, 0x0f, 0x25, 0x95, 0x05, 0xa9, 0xc5, 0x49, 0x6c, 0xe0, 0xe0, 0x34, 0x06, 0x04, 0x00, 0x00, - 0xff, 0xff, 0x83, 0x38, 0x41, 0x6d, 0xa4, 0x01, 0x00, 0x00, + // 336 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x91, 0xb1, 0x4e, 0xf2, 0x50, + 0x14, 0xc7, 0x7b, 0xa1, 0xf9, 0x3e, 0x7a, 0x70, 0xba, 0x61, 0x68, 0x18, 0x6e, 0x09, 0x83, 0x61, + 0xba, 0x0d, 0xb8, 0x39, 0x98, 0x58, 0x8d, 0x09, 0x6b, 0x75, 0x72, 0x31, 0x2d, 0x5c, 0x4a, 0xa3, + 0xed, 0x21, 0xdc, 0x2b, 0x89, 0x6f, 0xc1, 0xe8, 0xe8, 0x33, 0xf8, 0x14, 0x8c, 0x8c, 0x4e, 0x6a, + 0xe0, 0x45, 0x4c, 0x4f, 0x5b, 0x5c, 0x88, 0xdb, 0x39, 0xed, 0xef, 0x9c, 0xff, 0xaf, 0xa7, 0x70, + 0x3a, 0x41, 0x9d, 0xa1, 0xf6, 0xb5, 0xc1, 0xa5, 0xf2, 0x57, 0xc3, 0x58, 0x99, 0x68, 0xe8, 0x4f, + 0x30, 0xcb, 0x52, 0xf3, 0x90, 0xe6, 0x33, 0x94, 0x8b, 0x25, 0x1a, 0xe4, 0x9d, 0x92, 0x93, 0xc4, + 0xc9, 0x8a, 0xeb, 0x76, 0x12, 0x4c, 0x90, 0x00, 0xbf, 0xa8, 0x4a, 0xb6, 0xeb, 0x25, 0x88, 0xc9, + 0x93, 0xf2, 0xa9, 0x8b, 0x9f, 0x67, 0xbe, 0x49, 0x33, 0xa5, 0x4d, 0x94, 0x2d, 0x4a, 0xa0, 0xff, + 0xce, 0x00, 0xae, 0x28, 0x62, 0x9c, 0xcf, 0x90, 0xbb, 0xf0, 0x7f, 0xa5, 0x96, 0x3a, 0xc5, 0xdc, + 0x65, 0x3d, 0x36, 0x68, 0x86, 0x75, 0xcb, 0x6f, 0xa0, 0x4d, 0x81, 0x64, 0xa2, 0xdd, 0x46, 0xaf, + 0x39, 0x68, 0x8f, 0x3c, 0x79, 0xcc, 0x45, 0xde, 0x16, 0x5d, 0xb1, 0x2f, 0xb0, 0x37, 0x9f, 0x9e, + 0x15, 0x82, 0xae, 0x1f, 0x68, 0x1e, 0x80, 0x73, 0x70, 0x70, 0x9b, 0x3d, 0x36, 0x68, 0x8f, 0xba, + 0xb2, 0xb4, 0x94, 0xb5, 0xa5, 0xbc, 0xab, 0x89, 0xa0, 0x55, 0x2c, 0x58, 0x7f, 0x79, 0x2c, 0xfc, + 0x1d, 0xeb, 0xc7, 0xe0, 0x1c, 0x22, 0x38, 0x07, 0x3b, 0x8f, 0x32, 0x45, 0xbe, 0x4e, 0x48, 0x35, + 0xbf, 0x04, 0xa7, 0xbe, 0xdb, 0xd4, 0x6d, 0x50, 0x88, 0x38, 0xae, 0x5a, 0x7d, 0xfb, 0x75, 0x65, + 0xda, 0x2a, 0xc7, 0xc6, 0xd3, 0xfe, 0x05, 0xb4, 0xea, 0x77, 0x7f, 0x5c, 0x85, 0x83, 0x3d, 0x8f, + 0xf4, 0x9c, 0x32, 0x4e, 0x42, 0xaa, 0xcf, 0xed, 0xd7, 0x37, 0xcf, 0x0a, 0x46, 0x9b, 0x9d, 0x60, + 0xdb, 0x9d, 0x60, 0xdf, 0x3b, 0xc1, 0xd6, 0x7b, 0x61, 0x6d, 0xf7, 0xc2, 0xfa, 0xd8, 0x0b, 0xeb, + 0xde, 0x2d, 0x45, 0xf4, 0xf4, 0x51, 0xa6, 0x58, 0xfd, 0x6d, 0xf3, 0xb2, 0x50, 0x3a, 0xfe, 0x47, + 0x07, 0x38, 0xfb, 0x09, 0x00, 0x00, 0xff, 0xff, 0x67, 0xb7, 0x0d, 0x59, 0x0a, 0x02, 0x00, 0x00, } func (m *CommitInfo) Marshal() (dAtA []byte, err error) { @@ -236,6 +251,14 @@ func (m *CommitInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + n1, err1 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(m.Timestamp, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(m.Timestamp):]) + if err1 != nil { + return 0, err1 + } + i -= n1 + i = encodeVarintCommitInfo(dAtA, i, uint64(n1)) + i-- + dAtA[i] = 0x1a if len(m.StoreInfos) > 0 { for iNdEx := len(m.StoreInfos) - 1; iNdEx >= 0; iNdEx-- { { @@ -359,6 +382,8 @@ func (m *CommitInfo) Size() (n int) { n += 1 + l + sovCommitInfo(uint64(l)) } } + l = github_com_cosmos_gogoproto_types.SizeOfStdTime(m.Timestamp) + n += 1 + l + sovCommitInfo(uint64(l)) return n } @@ -481,6 +506,39 @@ func (m *CommitInfo) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Timestamp", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCommitInfo + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCommitInfo + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthCommitInfo + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_cosmos_gogoproto_types.StdTimeUnmarshal(&m.Timestamp, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipCommitInfo(dAtA[iNdEx:]) diff --git a/tests/go.mod b/tests/go.mod index f1e354256a81..24898d3dc262 100644 --- a/tests/go.mod +++ b/tests/go.mod @@ -191,6 +191,7 @@ require ( // It must be in sync with SimApp temporary replaces replace ( // TODO tag all extracted modules after SDK refactor + cosmossdk.io/store => ../store cosmossdk.io/x/evidence => ../x/evidence cosmossdk.io/x/feegrant => ../x/feegrant cosmossdk.io/x/nft => ../x/nft diff --git a/tests/go.sum b/tests/go.sum index 67434456b8b9..b03bf9d6617e 100644 --- a/tests/go.sum +++ b/tests/go.sum @@ -204,8 +204,6 @@ cosmossdk.io/log v0.1.0 h1:Vnexi+KzUCjmqq/m93teAxjt5biWFfZ5PI1imx2IJw8= cosmossdk.io/log v0.1.0/go.mod h1:p95Wq6mDY3SREMc4y7+QU9Uwy3nyvfpWGD1iSaFkVFs= cosmossdk.io/math v1.0.0 h1:ro9w7eKx23om2tZz/VM2Pf+z2WAbGX1yDQQOJ6iGeJw= cosmossdk.io/math v1.0.0/go.mod h1:Ygz4wBHrgc7g0N+8+MrnTfS9LLn9aaTGa9hKopuym5k= -cosmossdk.io/store v0.1.0-alpha.1 h1:NGomhLUXzAxvK4OF8+yP6eNUG5i4LwzOzx+S494pTCg= -cosmossdk.io/store v0.1.0-alpha.1/go.mod h1:kmCMbhrleCZ6rDZPY/EGNldNvPebFNyVPFYp+pv05/k= cosmossdk.io/x/tx v0.3.1-0.20230321155358-6522dd1731b5 h1:AlvyRc7f7Py1mv254vrqjIIuykCnitHIz2T+nup3bU0= cosmossdk.io/x/tx v0.3.1-0.20230321155358-6522dd1731b5/go.mod h1:FNkSEMbLP9NFdTfrbslNUtNS7OXf3wgZeJyXzfRPa4c= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= diff --git a/types/errors/errors.go b/types/errors/errors.go index 15732c91f87b..7e4c42bb76b4 100644 --- a/types/errors/errors.go +++ b/types/errors/errors.go @@ -132,7 +132,8 @@ var ( // Examples: not DB domain error, file writing etc... ErrIO = errorsmod.Register(RootCodespace, 39, "Internal IO error") - // ErrAppConfig defines an error occurred if min-gas-prices field in BaseConfig is empty. + // ErrAppConfig defines an error occurred if application configuration is + // misconfigured. ErrAppConfig = errorsmod.Register(RootCodespace, 40, "error in app.toml") // ErrInvalidGasLimit defines an error when an invalid GasWanted value is