From ba36fc52ffff02c86374b2052a85b842051600e8 Mon Sep 17 00:00:00 2001 From: Oren Date: Wed, 14 Aug 2024 18:18:58 +0300 Subject: [PATCH 1/3] migrator hot fix --- x/epochstorage/keeper/migrations.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/x/epochstorage/keeper/migrations.go b/x/epochstorage/keeper/migrations.go index 4ae08b400e..ce9c7de76a 100644 --- a/x/epochstorage/keeper/migrations.go +++ b/x/epochstorage/keeper/migrations.go @@ -39,7 +39,7 @@ func (m Migrator) Migrate7to8(ctx sdk.Context) error { key := string(iterator.Key()) // identify stake storage type: regular, current or unstake - if key == v3.StakeStorageKeyUnstakeConst { + if m.isUnstakeStakeStorageKey(key) { store.Delete(iterator.Key()) continue } @@ -99,6 +99,15 @@ func extractEpochFromStakeStorageKey(key string) (uint64, error) { return parsedUint, nil } +func (m Migrator) isUnstakeStakeStorageKey(key string) bool { + key, found := strings.CutSuffix(key, "/") + if !found { + return false + } + + return key == v3.StakeStorageKeyUnstakeConst +} + func (m Migrator) isCurrentStakeStorageKey(ctx sdk.Context, key string) bool { // the legacy StakeStorage key (both regular and current) had a "/" which should be cut off key, found := strings.CutSuffix(key, "/") From b87b92f0ce4e35d21657990b3e8afa15dc44fb25 Mon Sep 17 00:00:00 2001 From: Oren Date: Wed, 14 Aug 2024 18:41:49 +0300 Subject: [PATCH 2/3] rewrite old migrators --- x/epochstorage/keeper/migrations.go | 48 + .../types/migrations/v6/endpoint.pb.go | 522 ++++++++ .../types/migrations/v6/stake_entry.pb.go | 1106 +++++++++++++++++ .../types/migrations/v6/stake_storage.pb.go | 438 +++++++ 4 files changed, 2114 insertions(+) create mode 100644 x/epochstorage/types/migrations/v6/endpoint.pb.go create mode 100644 x/epochstorage/types/migrations/v6/stake_entry.pb.go create mode 100644 x/epochstorage/types/migrations/v6/stake_storage.pb.go diff --git a/x/epochstorage/keeper/migrations.go b/x/epochstorage/keeper/migrations.go index ce9c7de76a..da1e964239 100644 --- a/x/epochstorage/keeper/migrations.go +++ b/x/epochstorage/keeper/migrations.go @@ -12,6 +12,7 @@ import ( "github.com/lavanet/lava/v2/utils" "github.com/lavanet/lava/v2/x/epochstorage/types" v3 "github.com/lavanet/lava/v2/x/epochstorage/types/migrations/v3" + v6 "github.com/lavanet/lava/v2/x/epochstorage/types/migrations/v6" ) type Migrator struct { @@ -22,6 +23,53 @@ func NewMigrator(keeper Keeper) Migrator { return Migrator{keeper: keeper} } +// Migrate5to6 goes over all existing stake entries and populates the new vault address field with the stake entry address +func (m Migrator) Migrate5to6(ctx sdk.Context) error { + utils.LavaFormatDebug("migrate: epochstorage to include provider and vault addresses") + + store := prefix.NewStore(ctx.KVStore(m.keeper.storeKey), types.KeyPrefix(v3.StakeStorageKeyPrefix)) + iterator := sdk.KVStorePrefixIterator(store, []byte{}) + + defer iterator.Close() + + for ; iterator.Valid(); iterator.Next() { + var stakeStorageV6 v6.StakeStorage + m.keeper.cdc.MustUnmarshal(iterator.Value(), &stakeStorageV6) + + for i := range stakeStorageV6.StakeEntries { + stakeStorageV6.StakeEntries[i].Vault = stakeStorageV6.StakeEntries[i].Address + } + + store.Set(iterator.Key(), m.keeper.cdc.MustMarshal(&stakeStorageV6)) + } + + return nil +} + +// Migrate6to7 goes over all existing stake entries and populates the new description field with current moniker +func (m Migrator) Migrate6to7(ctx sdk.Context) error { + utils.LavaFormatDebug("migrate: epochstorage to include detailed description") + + store := prefix.NewStore(ctx.KVStore(m.keeper.storeKey), types.KeyPrefix(v3.StakeStorageKeyPrefix)) + iterator := sdk.KVStorePrefixIterator(store, []byte{}) + + defer iterator.Close() + + for ; iterator.Valid(); iterator.Next() { + var stakeStorageV7 types.StakeStorage + m.keeper.cdc.MustUnmarshal(iterator.Value(), &stakeStorageV7) + + for i := range stakeStorageV7.StakeEntries { + stakeStorageV7.StakeEntries[i].Description.Moniker = stakeStorageV7.StakeEntries[i].Moniker + stakeStorageV7.StakeEntries[i].Moniker = "" + } + + store.Set(iterator.Key(), m.keeper.cdc.MustMarshal(&stakeStorageV7)) + } + + return nil +} + // Migrate7to8 transfers all the stake entries from the old stake storage to the new stake entries store // StakeStorage is set to the stake entries store // StakeStorageCurrent is set to the stake entries current store diff --git a/x/epochstorage/types/migrations/v6/endpoint.pb.go b/x/epochstorage/types/migrations/v6/endpoint.pb.go new file mode 100644 index 0000000000..ed0ac20326 --- /dev/null +++ b/x/epochstorage/types/migrations/v6/endpoint.pb.go @@ -0,0 +1,522 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: lavanet/lava/epochstorage/endpoint.proto + +package types + +import ( + fmt "fmt" + proto "github.com/cosmos/gogoproto/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +type Endpoint struct { + IPPORT string `protobuf:"bytes,1,opt,name=iPPORT,proto3" json:"iPPORT,omitempty"` + Geolocation int32 `protobuf:"varint,3,opt,name=geolocation,proto3" json:"geolocation,omitempty"` + Addons []string `protobuf:"bytes,4,rep,name=addons,proto3" json:"addons,omitempty"` + ApiInterfaces []string `protobuf:"bytes,5,rep,name=api_interfaces,json=apiInterfaces,proto3" json:"api_interfaces,omitempty"` + Extensions []string `protobuf:"bytes,6,rep,name=extensions,proto3" json:"extensions,omitempty"` +} + +func (m *Endpoint) Reset() { *m = Endpoint{} } +func (m *Endpoint) String() string { return proto.CompactTextString(m) } +func (*Endpoint) ProtoMessage() {} +func (*Endpoint) Descriptor() ([]byte, []int) { + return fileDescriptor_acb18a6b0d300ae9, []int{0} +} +func (m *Endpoint) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Endpoint) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Endpoint.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Endpoint) XXX_Merge(src proto.Message) { + xxx_messageInfo_Endpoint.Merge(m, src) +} +func (m *Endpoint) XXX_Size() int { + return m.Size() +} +func (m *Endpoint) XXX_DiscardUnknown() { + xxx_messageInfo_Endpoint.DiscardUnknown(m) +} + +var xxx_messageInfo_Endpoint proto.InternalMessageInfo + +func (m *Endpoint) GetIPPORT() string { + if m != nil { + return m.IPPORT + } + return "" +} + +func (m *Endpoint) GetGeolocation() int32 { + if m != nil { + return m.Geolocation + } + return 0 +} + +func (m *Endpoint) GetAddons() []string { + if m != nil { + return m.Addons + } + return nil +} + +func (m *Endpoint) GetApiInterfaces() []string { + if m != nil { + return m.ApiInterfaces + } + return nil +} + +func (m *Endpoint) GetExtensions() []string { + if m != nil { + return m.Extensions + } + return nil +} + +func init() { + proto.RegisterType((*Endpoint)(nil), "lavanet.lava.epochstorage.EndpointV6") +} + +func init() { + proto.RegisterFile("lavanet/lava/epochstorage/endpoint.proto", fileDescriptor_acb18a6b0d300ae9) +} + +var fileDescriptor_acb18a6b0d300ae9 = []byte{ + // 250 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xd2, 0xc8, 0x49, 0x2c, 0x4b, + 0xcc, 0x4b, 0x2d, 0xd1, 0x07, 0xd1, 0xfa, 0xa9, 0x05, 0xf9, 0xc9, 0x19, 0xc5, 0x25, 0xf9, 0x45, + 0x89, 0xe9, 0xa9, 0xfa, 0xa9, 0x79, 0x29, 0x05, 0xf9, 0x99, 0x79, 0x25, 0x7a, 0x05, 0x45, 0xf9, + 0x25, 0xf9, 0x42, 0x92, 0x50, 0x95, 0x7a, 0x20, 0x5a, 0x0f, 0x59, 0xa5, 0xd2, 0x4a, 0x46, 0x2e, + 0x0e, 0x57, 0xa8, 0x6a, 0x21, 0x31, 0x2e, 0xb6, 0xcc, 0x80, 0x00, 0xff, 0xa0, 0x10, 0x09, 0x46, + 0x05, 0x46, 0x0d, 0xce, 0x20, 0x28, 0x4f, 0x48, 0x81, 0x8b, 0x3b, 0x3d, 0x35, 0x3f, 0x27, 0x3f, + 0x39, 0xb1, 0x24, 0x33, 0x3f, 0x4f, 0x82, 0x59, 0x81, 0x51, 0x83, 0x35, 0x08, 0x59, 0x08, 0xa4, + 0x33, 0x31, 0x25, 0x25, 0x3f, 0xaf, 0x58, 0x82, 0x45, 0x81, 0x19, 0xa4, 0x13, 0xc2, 0x13, 0x52, + 0xe5, 0xe2, 0x4b, 0x2c, 0xc8, 0x8c, 0xcf, 0xcc, 0x2b, 0x49, 0x2d, 0x4a, 0x4b, 0x4c, 0x4e, 0x2d, + 0x96, 0x60, 0x05, 0xcb, 0xf3, 0x26, 0x16, 0x64, 0x7a, 0xc2, 0x05, 0x85, 0xe4, 0xb8, 0xb8, 0x52, + 0x2b, 0x4a, 0x52, 0xf3, 0x8a, 0x33, 0x41, 0x46, 0xb0, 0x81, 0x95, 0x20, 0x89, 0x78, 0xb1, 0x70, + 0x30, 0x09, 0x30, 0x3b, 0xb9, 0x9d, 0x78, 0x24, 0xc7, 0x78, 0xe1, 0x91, 0x1c, 0xe3, 0x83, 0x47, + 0x72, 0x8c, 0x13, 0x1e, 0xcb, 0x31, 0x5c, 0x78, 0x2c, 0xc7, 0x70, 0xe3, 0xb1, 0x1c, 0x43, 0x94, + 0x4e, 0x7a, 0x66, 0x49, 0x46, 0x69, 0x92, 0x5e, 0x72, 0x7e, 0xae, 0x3e, 0x4a, 0xa8, 0x54, 0xa0, + 0x86, 0x4b, 0x49, 0x65, 0x41, 0x6a, 0x71, 0x12, 0x1b, 0x38, 0x54, 0x8c, 0x01, 0x01, 0x00, 0x00, + 0xff, 0xff, 0xf3, 0xac, 0x09, 0xa5, 0x41, 0x01, 0x00, 0x00, +} + +func (m *Endpoint) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Endpoint) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Endpoint) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Extensions) > 0 { + for iNdEx := len(m.Extensions) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Extensions[iNdEx]) + copy(dAtA[i:], m.Extensions[iNdEx]) + i = encodeVarintEndpoint(dAtA, i, uint64(len(m.Extensions[iNdEx]))) + i-- + dAtA[i] = 0x32 + } + } + if len(m.ApiInterfaces) > 0 { + for iNdEx := len(m.ApiInterfaces) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.ApiInterfaces[iNdEx]) + copy(dAtA[i:], m.ApiInterfaces[iNdEx]) + i = encodeVarintEndpoint(dAtA, i, uint64(len(m.ApiInterfaces[iNdEx]))) + i-- + dAtA[i] = 0x2a + } + } + if len(m.Addons) > 0 { + for iNdEx := len(m.Addons) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Addons[iNdEx]) + copy(dAtA[i:], m.Addons[iNdEx]) + i = encodeVarintEndpoint(dAtA, i, uint64(len(m.Addons[iNdEx]))) + i-- + dAtA[i] = 0x22 + } + } + if m.Geolocation != 0 { + i = encodeVarintEndpoint(dAtA, i, uint64(m.Geolocation)) + i-- + dAtA[i] = 0x18 + } + if len(m.IPPORT) > 0 { + i -= len(m.IPPORT) + copy(dAtA[i:], m.IPPORT) + i = encodeVarintEndpoint(dAtA, i, uint64(len(m.IPPORT))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintEndpoint(dAtA []byte, offset int, v uint64) int { + offset -= sovEndpoint(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *Endpoint) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.IPPORT) + if l > 0 { + n += 1 + l + sovEndpoint(uint64(l)) + } + if m.Geolocation != 0 { + n += 1 + sovEndpoint(uint64(m.Geolocation)) + } + if len(m.Addons) > 0 { + for _, s := range m.Addons { + l = len(s) + n += 1 + l + sovEndpoint(uint64(l)) + } + } + if len(m.ApiInterfaces) > 0 { + for _, s := range m.ApiInterfaces { + l = len(s) + n += 1 + l + sovEndpoint(uint64(l)) + } + } + if len(m.Extensions) > 0 { + for _, s := range m.Extensions { + l = len(s) + n += 1 + l + sovEndpoint(uint64(l)) + } + } + return n +} + +func sovEndpoint(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozEndpoint(x uint64) (n int) { + return sovEndpoint(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Endpoint) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEndpoint + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Endpoint: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Endpoint: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field IPPORT", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEndpoint + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEndpoint + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEndpoint + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.IPPORT = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Geolocation", wireType) + } + m.Geolocation = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEndpoint + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Geolocation |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Addons", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEndpoint + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEndpoint + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEndpoint + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Addons = append(m.Addons, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ApiInterfaces", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEndpoint + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEndpoint + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEndpoint + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ApiInterfaces = append(m.ApiInterfaces, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Extensions", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEndpoint + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEndpoint + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEndpoint + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Extensions = append(m.Extensions, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipEndpoint(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthEndpoint + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipEndpoint(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowEndpoint + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowEndpoint + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowEndpoint + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthEndpoint + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupEndpoint + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthEndpoint + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthEndpoint = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowEndpoint = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupEndpoint = fmt.Errorf("proto: unexpected end of group") +) \ No newline at end of file diff --git a/x/epochstorage/types/migrations/v6/stake_entry.pb.go b/x/epochstorage/types/migrations/v6/stake_entry.pb.go new file mode 100644 index 0000000000..ae92f42631 --- /dev/null +++ b/x/epochstorage/types/migrations/v6/stake_entry.pb.go @@ -0,0 +1,1106 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: lavanet/lava/epochstorage/stake_entry.proto + +package types + +import ( + fmt "fmt" + types "github.com/cosmos/cosmos-sdk/types" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +type StakeEntry struct { + Stake types.Coin `protobuf:"bytes,1,opt,name=stake,proto3" json:"stake"` + Address string `protobuf:"bytes,2,opt,name=address,proto3" json:"address,omitempty"` + StakeAppliedBlock uint64 `protobuf:"varint,3,opt,name=stake_applied_block,json=stakeAppliedBlock,proto3" json:"stake_applied_block,omitempty"` + Endpoints []Endpoint `protobuf:"bytes,4,rep,name=endpoints,proto3" json:"endpoints"` + Geolocation int32 `protobuf:"varint,5,opt,name=geolocation,proto3" json:"geolocation,omitempty"` + Chain string `protobuf:"bytes,6,opt,name=chain,proto3" json:"chain,omitempty"` + Moniker string `protobuf:"bytes,8,opt,name=moniker,proto3" json:"moniker,omitempty"` + DelegateTotal types.Coin `protobuf:"bytes,9,opt,name=delegate_total,json=delegateTotal,proto3" json:"delegate_total"` + DelegateLimit types.Coin `protobuf:"bytes,10,opt,name=delegate_limit,json=delegateLimit,proto3" json:"delegate_limit"` + DelegateCommission uint64 `protobuf:"varint,11,opt,name=delegate_commission,json=delegateCommission,proto3" json:"delegate_commission,omitempty"` + LastChange uint64 `protobuf:"varint,12,opt,name=last_change,json=lastChange,proto3" json:"last_change,omitempty"` + BlockReport *BlockReport `protobuf:"bytes,13,opt,name=block_report,json=blockReport,proto3" json:"block_report,omitempty"` + Vault string `protobuf:"bytes,14,opt,name=vault,proto3" json:"vault,omitempty"` +} + +func (m *StakeEntry) Reset() { *m = StakeEntry{} } +func (m *StakeEntry) String() string { return proto.CompactTextString(m) } +func (*StakeEntry) ProtoMessage() {} +func (*StakeEntry) Descriptor() ([]byte, []int) { + return fileDescriptor_df6302d6b53c056e, []int{0} +} +func (m *StakeEntry) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *StakeEntry) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_StakeEntry.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *StakeEntry) XXX_Merge(src proto.Message) { + xxx_messageInfo_StakeEntry.Merge(m, src) +} +func (m *StakeEntry) XXX_Size() int { + return m.Size() +} +func (m *StakeEntry) XXX_DiscardUnknown() { + xxx_messageInfo_StakeEntry.DiscardUnknown(m) +} + +var xxx_messageInfo_StakeEntry proto.InternalMessageInfo + +func (m *StakeEntry) GetStake() types.Coin { + if m != nil { + return m.Stake + } + return types.Coin{} +} + +func (m *StakeEntry) GetAddress() string { + if m != nil { + return m.Address + } + return "" +} + +func (m *StakeEntry) GetStakeAppliedBlock() uint64 { + if m != nil { + return m.StakeAppliedBlock + } + return 0 +} + +func (m *StakeEntry) GetEndpoints() []Endpoint { + if m != nil { + return m.Endpoints + } + return nil +} + +func (m *StakeEntry) GetGeolocation() int32 { + if m != nil { + return m.Geolocation + } + return 0 +} + +func (m *StakeEntry) GetChain() string { + if m != nil { + return m.Chain + } + return "" +} + +func (m *StakeEntry) GetMoniker() string { + if m != nil { + return m.Moniker + } + return "" +} + +func (m *StakeEntry) GetDelegateTotal() types.Coin { + if m != nil { + return m.DelegateTotal + } + return types.Coin{} +} + +func (m *StakeEntry) GetDelegateLimit() types.Coin { + if m != nil { + return m.DelegateLimit + } + return types.Coin{} +} + +func (m *StakeEntry) GetDelegateCommission() uint64 { + if m != nil { + return m.DelegateCommission + } + return 0 +} + +func (m *StakeEntry) GetLastChange() uint64 { + if m != nil { + return m.LastChange + } + return 0 +} + +func (m *StakeEntry) GetBlockReport() *BlockReport { + if m != nil { + return m.BlockReport + } + return nil +} + +func (m *StakeEntry) GetVault() string { + if m != nil { + return m.Vault + } + return "" +} + +// BlockReport holds the most up-to-date info regarding blocks of the provider +// It is set in the relay payment TX logic +// used by the consumer to calculate the provider's sync score +type BlockReport struct { + Epoch uint64 `protobuf:"varint,1,opt,name=epoch,proto3" json:"epoch,omitempty"` + LatestBlock uint64 `protobuf:"varint,2,opt,name=latest_block,json=latestBlock,proto3" json:"latest_block,omitempty"` +} + +func (m *BlockReport) Reset() { *m = BlockReport{} } +func (m *BlockReport) String() string { return proto.CompactTextString(m) } +func (*BlockReport) ProtoMessage() {} +func (*BlockReport) Descriptor() ([]byte, []int) { + return fileDescriptor_df6302d6b53c056e, []int{1} +} +func (m *BlockReport) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *BlockReport) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_BlockReport.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *BlockReport) XXX_Merge(src proto.Message) { + xxx_messageInfo_BlockReport.Merge(m, src) +} +func (m *BlockReport) XXX_Size() int { + return m.Size() +} +func (m *BlockReport) XXX_DiscardUnknown() { + xxx_messageInfo_BlockReport.DiscardUnknown(m) +} + +var xxx_messageInfo_BlockReport proto.InternalMessageInfo + +func (m *BlockReport) GetEpoch() uint64 { + if m != nil { + return m.Epoch + } + return 0 +} + +func (m *BlockReport) GetLatestBlock() uint64 { + if m != nil { + return m.LatestBlock + } + return 0 +} + +func init() { + proto.RegisterType((*StakeEntry)(nil), "lavanet.lava.epochstorage.StakeEntryV6") + proto.RegisterType((*BlockReport)(nil), "lavanet.lava.epochstorage.BlockReportV6") +} + +func init() { + proto.RegisterFile("lavanet/lava/epochstorage/stake_entry.proto", fileDescriptor_df6302d6b53c056e) +} + +var fileDescriptor_df6302d6b53c056e = []byte{ + // 510 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x53, 0x41, 0x6e, 0xdb, 0x3a, + 0x10, 0xb5, 0x12, 0x39, 0xb1, 0x29, 0x27, 0xf8, 0x9f, 0xc9, 0x82, 0xc9, 0x42, 0x51, 0x53, 0xa0, + 0x10, 0xd0, 0x82, 0x42, 0x52, 0xf4, 0x00, 0xb5, 0x11, 0x17, 0x2d, 0xba, 0x52, 0xbb, 0xea, 0xc6, + 0xa0, 0x24, 0x42, 0x26, 0x2c, 0x71, 0x04, 0x91, 0x31, 0x9a, 0x5b, 0xf4, 0x58, 0x59, 0x66, 0xd9, + 0x55, 0x51, 0xd8, 0x27, 0xe8, 0x0d, 0x0a, 0x92, 0x72, 0x12, 0x2f, 0x52, 0xb4, 0x2b, 0x72, 0xe6, + 0xbd, 0x37, 0x98, 0x79, 0xe4, 0xa0, 0x97, 0x15, 0x5b, 0x32, 0xc9, 0x75, 0x62, 0xce, 0x84, 0x37, + 0x90, 0xcf, 0x95, 0x86, 0x96, 0x95, 0x3c, 0x51, 0x9a, 0x2d, 0xf8, 0x8c, 0x4b, 0xdd, 0xde, 0xd0, + 0xa6, 0x05, 0x0d, 0xf8, 0xa4, 0x23, 0x53, 0x73, 0xd2, 0xc7, 0xe4, 0xd3, 0xf8, 0xe9, 0x3a, 0x5c, + 0x16, 0x0d, 0x08, 0xa9, 0x5d, 0x91, 0xd3, 0xe3, 0x12, 0x4a, 0xb0, 0xd7, 0xc4, 0xdc, 0xba, 0x6c, + 0x98, 0x83, 0xaa, 0x41, 0x25, 0x19, 0x53, 0x3c, 0x59, 0x5e, 0x64, 0x5c, 0xb3, 0x8b, 0x24, 0x07, + 0x21, 0x1d, 0x7e, 0xfe, 0xcb, 0x47, 0xe8, 0x93, 0x69, 0xe8, 0xca, 0xf4, 0x83, 0xdf, 0xa0, 0xbe, + 0x6d, 0x8f, 0x78, 0x91, 0x17, 0x07, 0x97, 0x27, 0xd4, 0xc9, 0xa9, 0x91, 0xd3, 0x4e, 0x4e, 0x27, + 0x20, 0xe4, 0xd8, 0xbf, 0xfd, 0x71, 0xd6, 0x4b, 0x1d, 0x1b, 0x13, 0xb4, 0xcf, 0x8a, 0xa2, 0xe5, + 0x4a, 0x91, 0x9d, 0xc8, 0x8b, 0x87, 0xe9, 0x26, 0xc4, 0x14, 0x1d, 0xb9, 0x79, 0x59, 0xd3, 0x54, + 0x82, 0x17, 0xb3, 0xac, 0x82, 0x7c, 0x41, 0x76, 0x23, 0x2f, 0xf6, 0xd3, 0xff, 0x2d, 0xf4, 0xd6, + 0x21, 0x63, 0x03, 0xe0, 0x77, 0x68, 0xb8, 0x99, 0x4b, 0x11, 0x3f, 0xda, 0x8d, 0x83, 0xcb, 0xe7, + 0xf4, 0x49, 0x7b, 0xe8, 0x55, 0xc7, 0xed, 0xda, 0x79, 0xd0, 0xe2, 0x08, 0x05, 0x25, 0x87, 0x0a, + 0x72, 0xa6, 0x05, 0x48, 0xd2, 0x8f, 0xbc, 0xb8, 0x9f, 0x3e, 0x4e, 0xe1, 0x63, 0xd4, 0xcf, 0xe7, + 0x4c, 0x48, 0xb2, 0x67, 0x5b, 0x76, 0x81, 0x19, 0xa5, 0x06, 0x29, 0x16, 0xbc, 0x25, 0x03, 0x37, + 0x4a, 0x17, 0xe2, 0x29, 0x3a, 0x2c, 0x78, 0xc5, 0x4b, 0xa6, 0xf9, 0x4c, 0x83, 0x66, 0x15, 0x19, + 0xfe, 0x9d, 0x49, 0x07, 0x1b, 0xd9, 0x67, 0xa3, 0xda, 0xaa, 0x53, 0x89, 0x5a, 0x68, 0x82, 0xfe, + 0xb1, 0xce, 0x47, 0xa3, 0xc2, 0x09, 0x3a, 0xba, 0xaf, 0x93, 0x43, 0x5d, 0x0b, 0xa5, 0xcc, 0xa4, + 0x81, 0xb5, 0x16, 0x6f, 0xa0, 0xc9, 0x3d, 0x82, 0xcf, 0x50, 0x50, 0x31, 0xa5, 0x67, 0xf9, 0x9c, + 0xc9, 0x92, 0x93, 0x91, 0x25, 0x22, 0x93, 0x9a, 0xd8, 0x0c, 0x7e, 0x8f, 0x46, 0xf6, 0x79, 0x66, + 0x2d, 0x6f, 0xa0, 0xd5, 0xe4, 0xc0, 0xf6, 0xf5, 0xe2, 0x0f, 0xfe, 0xdb, 0x47, 0x4b, 0x2d, 0x3b, + 0x0d, 0xb2, 0x87, 0xc0, 0x98, 0xbb, 0x64, 0xd7, 0x95, 0x26, 0x87, 0xce, 0x5c, 0x1b, 0x7c, 0xf0, + 0x07, 0xfb, 0xff, 0x0d, 0xce, 0xa7, 0x28, 0x18, 0x6f, 0x53, 0x6d, 0x4d, 0xfb, 0xe7, 0xfc, 0xd4, + 0x05, 0xf8, 0x19, 0x1a, 0x55, 0x4c, 0x73, 0xa5, 0xbb, 0x1f, 0xb3, 0x63, 0xc1, 0xc0, 0xe5, 0xac, + 0x7c, 0x3c, 0xbd, 0x5d, 0x85, 0xde, 0xdd, 0x2a, 0xf4, 0x7e, 0xae, 0x42, 0xef, 0xdb, 0x3a, 0xec, + 0xdd, 0xad, 0xc3, 0xde, 0xf7, 0x75, 0xd8, 0xfb, 0xf2, 0xaa, 0x14, 0x7a, 0x7e, 0x9d, 0xd1, 0x1c, + 0xea, 0x64, 0x6b, 0x81, 0xbe, 0x6e, 0xaf, 0x90, 0xbe, 0x69, 0xb8, 0xca, 0xf6, 0xec, 0x2a, 0xbc, + 0xfe, 0x1d, 0x00, 0x00, 0xff, 0xff, 0xc7, 0x25, 0xca, 0x07, 0xb4, 0x03, 0x00, 0x00, +} + +func (m *StakeEntry) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *StakeEntry) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *StakeEntry) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Vault) > 0 { + i -= len(m.Vault) + copy(dAtA[i:], m.Vault) + i = encodeVarintStakeEntry(dAtA, i, uint64(len(m.Vault))) + i-- + dAtA[i] = 0x72 + } + if m.BlockReport != nil { + { + size, err := m.BlockReport.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintStakeEntry(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x6a + } + if m.LastChange != 0 { + i = encodeVarintStakeEntry(dAtA, i, uint64(m.LastChange)) + i-- + dAtA[i] = 0x60 + } + if m.DelegateCommission != 0 { + i = encodeVarintStakeEntry(dAtA, i, uint64(m.DelegateCommission)) + i-- + dAtA[i] = 0x58 + } + { + size, err := m.DelegateLimit.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintStakeEntry(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x52 + { + size, err := m.DelegateTotal.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintStakeEntry(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x4a + if len(m.Moniker) > 0 { + i -= len(m.Moniker) + copy(dAtA[i:], m.Moniker) + i = encodeVarintStakeEntry(dAtA, i, uint64(len(m.Moniker))) + i-- + dAtA[i] = 0x42 + } + if len(m.Chain) > 0 { + i -= len(m.Chain) + copy(dAtA[i:], m.Chain) + i = encodeVarintStakeEntry(dAtA, i, uint64(len(m.Chain))) + i-- + dAtA[i] = 0x32 + } + if m.Geolocation != 0 { + i = encodeVarintStakeEntry(dAtA, i, uint64(m.Geolocation)) + i-- + dAtA[i] = 0x28 + } + if len(m.Endpoints) > 0 { + for iNdEx := len(m.Endpoints) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Endpoints[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintStakeEntry(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } + } + if m.StakeAppliedBlock != 0 { + i = encodeVarintStakeEntry(dAtA, i, uint64(m.StakeAppliedBlock)) + i-- + dAtA[i] = 0x18 + } + if len(m.Address) > 0 { + i -= len(m.Address) + copy(dAtA[i:], m.Address) + i = encodeVarintStakeEntry(dAtA, i, uint64(len(m.Address))) + i-- + dAtA[i] = 0x12 + } + { + size, err := m.Stake.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintStakeEntry(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *BlockReport) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *BlockReport) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *BlockReport) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.LatestBlock != 0 { + i = encodeVarintStakeEntry(dAtA, i, uint64(m.LatestBlock)) + i-- + dAtA[i] = 0x10 + } + if m.Epoch != 0 { + i = encodeVarintStakeEntry(dAtA, i, uint64(m.Epoch)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func encodeVarintStakeEntry(dAtA []byte, offset int, v uint64) int { + offset -= sovStakeEntry(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *StakeEntry) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Stake.Size() + n += 1 + l + sovStakeEntry(uint64(l)) + l = len(m.Address) + if l > 0 { + n += 1 + l + sovStakeEntry(uint64(l)) + } + if m.StakeAppliedBlock != 0 { + n += 1 + sovStakeEntry(uint64(m.StakeAppliedBlock)) + } + if len(m.Endpoints) > 0 { + for _, e := range m.Endpoints { + l = e.Size() + n += 1 + l + sovStakeEntry(uint64(l)) + } + } + if m.Geolocation != 0 { + n += 1 + sovStakeEntry(uint64(m.Geolocation)) + } + l = len(m.Chain) + if l > 0 { + n += 1 + l + sovStakeEntry(uint64(l)) + } + l = len(m.Moniker) + if l > 0 { + n += 1 + l + sovStakeEntry(uint64(l)) + } + l = m.DelegateTotal.Size() + n += 1 + l + sovStakeEntry(uint64(l)) + l = m.DelegateLimit.Size() + n += 1 + l + sovStakeEntry(uint64(l)) + if m.DelegateCommission != 0 { + n += 1 + sovStakeEntry(uint64(m.DelegateCommission)) + } + if m.LastChange != 0 { + n += 1 + sovStakeEntry(uint64(m.LastChange)) + } + if m.BlockReport != nil { + l = m.BlockReport.Size() + n += 1 + l + sovStakeEntry(uint64(l)) + } + l = len(m.Vault) + if l > 0 { + n += 1 + l + sovStakeEntry(uint64(l)) + } + return n +} + +func (m *BlockReport) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Epoch != 0 { + n += 1 + sovStakeEntry(uint64(m.Epoch)) + } + if m.LatestBlock != 0 { + n += 1 + sovStakeEntry(uint64(m.LatestBlock)) + } + return n +} + +func sovStakeEntry(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozStakeEntry(x uint64) (n int) { + return sovStakeEntry(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *StakeEntry) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStakeEntry + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: StakeEntry: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: StakeEntry: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Stake", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStakeEntry + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthStakeEntry + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthStakeEntry + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Stake.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStakeEntry + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthStakeEntry + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthStakeEntry + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Address = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field StakeAppliedBlock", wireType) + } + m.StakeAppliedBlock = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStakeEntry + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.StakeAppliedBlock |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Endpoints", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStakeEntry + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthStakeEntry + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthStakeEntry + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Endpoints = append(m.Endpoints, Endpoint{}) + if err := m.Endpoints[len(m.Endpoints)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Geolocation", wireType) + } + m.Geolocation = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStakeEntry + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Geolocation |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Chain", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStakeEntry + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthStakeEntry + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthStakeEntry + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Chain = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Moniker", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStakeEntry + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthStakeEntry + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthStakeEntry + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Moniker = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 9: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DelegateTotal", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStakeEntry + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthStakeEntry + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthStakeEntry + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.DelegateTotal.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 10: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DelegateLimit", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStakeEntry + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthStakeEntry + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthStakeEntry + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.DelegateLimit.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 11: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field DelegateCommission", wireType) + } + m.DelegateCommission = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStakeEntry + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.DelegateCommission |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 12: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field LastChange", wireType) + } + m.LastChange = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStakeEntry + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.LastChange |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 13: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BlockReport", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStakeEntry + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthStakeEntry + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthStakeEntry + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.BlockReport == nil { + m.BlockReport = &BlockReport{} + } + if err := m.BlockReport.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 14: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Vault", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStakeEntry + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthStakeEntry + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthStakeEntry + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Vault = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipStakeEntry(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthStakeEntry + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *BlockReport) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStakeEntry + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: BlockReport: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: BlockReport: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Epoch", wireType) + } + m.Epoch = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStakeEntry + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Epoch |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field LatestBlock", wireType) + } + m.LatestBlock = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStakeEntry + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.LatestBlock |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipStakeEntry(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthStakeEntry + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipStakeEntry(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowStakeEntry + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowStakeEntry + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowStakeEntry + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthStakeEntry + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupStakeEntry + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthStakeEntry + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthStakeEntry = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowStakeEntry = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupStakeEntry = fmt.Errorf("proto: unexpected end of group") +) \ No newline at end of file diff --git a/x/epochstorage/types/migrations/v6/stake_storage.pb.go b/x/epochstorage/types/migrations/v6/stake_storage.pb.go new file mode 100644 index 0000000000..bf34c57f4b --- /dev/null +++ b/x/epochstorage/types/migrations/v6/stake_storage.pb.go @@ -0,0 +1,438 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: lavanet/lava/epochstorage/stake_storage.proto + +package types + +import ( + fmt "fmt" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +type StakeStorage struct { + Index string `protobuf:"bytes,1,opt,name=index,proto3" json:"index,omitempty"` + StakeEntries []StakeEntry `protobuf:"bytes,2,rep,name=stakeEntries,proto3" json:"stakeEntries"` + EpochBlockHash []byte `protobuf:"bytes,3,opt,name=epochBlockHash,proto3" json:"epochBlockHash,omitempty"` +} + +func (m *StakeStorage) Reset() { *m = StakeStorage{} } +func (m *StakeStorage) String() string { return proto.CompactTextString(m) } +func (*StakeStorage) ProtoMessage() {} +func (*StakeStorage) Descriptor() ([]byte, []int) { + return fileDescriptor_be7b78aecc265fd4, []int{0} +} +func (m *StakeStorage) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *StakeStorage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_StakeStorage.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *StakeStorage) XXX_Merge(src proto.Message) { + xxx_messageInfo_StakeStorage.Merge(m, src) +} +func (m *StakeStorage) XXX_Size() int { + return m.Size() +} +func (m *StakeStorage) XXX_DiscardUnknown() { + xxx_messageInfo_StakeStorage.DiscardUnknown(m) +} + +var xxx_messageInfo_StakeStorage proto.InternalMessageInfo + +func (m *StakeStorage) GetIndex() string { + if m != nil { + return m.Index + } + return "" +} + +func (m *StakeStorage) GetStakeEntries() []StakeEntry { + if m != nil { + return m.StakeEntries + } + return nil +} + +func (m *StakeStorage) GetEpochBlockHash() []byte { + if m != nil { + return m.EpochBlockHash + } + return nil +} + +func init() { + proto.RegisterType((*StakeStorage)(nil), "lavanet.lava.epochstorage.StakeStorageV6") +} + +func init() { + proto.RegisterFile("lavanet/lava/epochstorage/stake_storage.proto", fileDescriptor_be7b78aecc265fd4) +} + +var fileDescriptor_be7b78aecc265fd4 = []byte{ + // 246 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xd2, 0xcd, 0x49, 0x2c, 0x4b, + 0xcc, 0x4b, 0x2d, 0xd1, 0x07, 0xd1, 0xfa, 0xa9, 0x05, 0xf9, 0xc9, 0x19, 0xc5, 0x25, 0xf9, 0x45, + 0x89, 0xe9, 0xa9, 0xfa, 0xc5, 0x25, 0x89, 0xd9, 0xa9, 0xf1, 0x50, 0x9e, 0x5e, 0x41, 0x51, 0x7e, + 0x49, 0xbe, 0x90, 0x24, 0x54, 0xb9, 0x1e, 0x88, 0xd6, 0x43, 0x56, 0x2e, 0xa5, 0x4d, 0xc8, 0xa4, + 0xd4, 0xbc, 0x92, 0xa2, 0x4a, 0x88, 0x39, 0x52, 0x22, 0xe9, 0xf9, 0xe9, 0xf9, 0x60, 0xa6, 0x3e, + 0x88, 0x05, 0x11, 0x55, 0x9a, 0xcb, 0xc8, 0xc5, 0x13, 0x0c, 0x52, 0x1b, 0x0c, 0xd1, 0x28, 0x24, + 0xc2, 0xc5, 0x9a, 0x99, 0x97, 0x92, 0x5a, 0x21, 0xc1, 0xa8, 0xc0, 0xa8, 0xc1, 0x19, 0x04, 0xe1, + 0x08, 0xf9, 0x73, 0xf1, 0x80, 0x4d, 0x74, 0xcd, 0x2b, 0x29, 0xca, 0x4c, 0x2d, 0x96, 0x60, 0x52, + 0x60, 0xd6, 0xe0, 0x36, 0x52, 0xd5, 0xc3, 0xe9, 0x36, 0xbd, 0x60, 0x98, 0xf2, 0x4a, 0x27, 0x96, + 0x13, 0xf7, 0xe4, 0x19, 0x82, 0x50, 0x0c, 0x10, 0x52, 0xe3, 0xe2, 0x03, 0x2b, 0x77, 0xca, 0xc9, + 0x4f, 0xce, 0xf6, 0x48, 0x2c, 0xce, 0x90, 0x60, 0x56, 0x60, 0xd4, 0xe0, 0x09, 0x42, 0x13, 0x75, + 0x72, 0x3b, 0xf1, 0x48, 0x8e, 0xf1, 0xc2, 0x23, 0x39, 0xc6, 0x07, 0x8f, 0xe4, 0x18, 0x27, 0x3c, + 0x96, 0x63, 0xb8, 0xf0, 0x58, 0x8e, 0xe1, 0xc6, 0x63, 0x39, 0x86, 0x28, 0x9d, 0xf4, 0xcc, 0x92, + 0x8c, 0xd2, 0x24, 0xbd, 0xe4, 0xfc, 0x5c, 0x7d, 0x94, 0x70, 0xa8, 0x40, 0x0d, 0x89, 0x92, 0xca, + 0x82, 0xd4, 0xe2, 0x24, 0x36, 0xb0, 0x77, 0x8d, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0x64, 0x2d, + 0xbc, 0x7a, 0x7d, 0x01, 0x00, 0x00, +} + +func (m *StakeStorage) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *StakeStorage) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *StakeStorage) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.EpochBlockHash) > 0 { + i -= len(m.EpochBlockHash) + copy(dAtA[i:], m.EpochBlockHash) + i = encodeVarintStakeStorage(dAtA, i, uint64(len(m.EpochBlockHash))) + i-- + dAtA[i] = 0x1a + } + if len(m.StakeEntries) > 0 { + for iNdEx := len(m.StakeEntries) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.StakeEntries[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintStakeStorage(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + if len(m.Index) > 0 { + i -= len(m.Index) + copy(dAtA[i:], m.Index) + i = encodeVarintStakeStorage(dAtA, i, uint64(len(m.Index))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintStakeStorage(dAtA []byte, offset int, v uint64) int { + offset -= sovStakeStorage(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *StakeStorage) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Index) + if l > 0 { + n += 1 + l + sovStakeStorage(uint64(l)) + } + if len(m.StakeEntries) > 0 { + for _, e := range m.StakeEntries { + l = e.Size() + n += 1 + l + sovStakeStorage(uint64(l)) + } + } + l = len(m.EpochBlockHash) + if l > 0 { + n += 1 + l + sovStakeStorage(uint64(l)) + } + return n +} + +func sovStakeStorage(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozStakeStorage(x uint64) (n int) { + return sovStakeStorage(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *StakeStorage) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStakeStorage + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: StakeStorage: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: StakeStorage: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Index", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStakeStorage + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthStakeStorage + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthStakeStorage + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Index = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field StakeEntries", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStakeStorage + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthStakeStorage + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthStakeStorage + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.StakeEntries = append(m.StakeEntries, StakeEntry{}) + if err := m.StakeEntries[len(m.StakeEntries)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field EpochBlockHash", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStakeStorage + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthStakeStorage + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthStakeStorage + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.EpochBlockHash = append(m.EpochBlockHash[:0], dAtA[iNdEx:postIndex]...) + if m.EpochBlockHash == nil { + m.EpochBlockHash = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipStakeStorage(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthStakeStorage + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipStakeStorage(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowStakeStorage + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowStakeStorage + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowStakeStorage + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthStakeStorage + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupStakeStorage + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthStakeStorage + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthStakeStorage = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowStakeStorage = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupStakeStorage = fmt.Errorf("proto: unexpected end of group") +) \ No newline at end of file From 535dc1831b86a65657e658450d2b8622fad44978 Mon Sep 17 00:00:00 2001 From: Oren Date: Wed, 14 Aug 2024 18:45:43 +0300 Subject: [PATCH 3/3] register old epochstorage migrations --- x/epochstorage/module.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/x/epochstorage/module.go b/x/epochstorage/module.go index 3df27a6b84..75a6aac06a 100644 --- a/x/epochstorage/module.go +++ b/x/epochstorage/module.go @@ -130,6 +130,18 @@ func (am AppModule) RegisterServices(cfg module.Configurator) { migrator := keeper.NewMigrator(am.keeper) + // register v5 -> v6 migration + if err := cfg.RegisterMigration(types.ModuleName, 5, migrator.Migrate5to6); err != nil { + // panic:ok: at start up, migration cannot proceed anyhow + panic(fmt.Errorf("%s: failed to register migration to v6: %w", types.ModuleName, err)) + } + + // register v6 -> v7 migration + if err := cfg.RegisterMigration(types.ModuleName, 6, migrator.Migrate6to7); err != nil { + // panic:ok: at start up, migration cannot proceed anyhow + panic(fmt.Errorf("%s: failed to register migration to v7: %w", types.ModuleName, err)) + } + // register v7 -> v8 migration if err := cfg.RegisterMigration(types.ModuleName, 7, migrator.Migrate7to8); err != nil { // panic:ok: at start up, migration cannot proceed anyhow