From 36c087208857e3db672c10ab5aaeb3f70e45799e Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Thu, 16 Nov 2023 12:25:26 +0100 Subject: [PATCH] fix: add bundles query version map to genesis import/export (backport #149) (#151) Co-authored-by: Maximilian Breithecker <72022235+mbreithecker@users.noreply.github.com> --- CHANGELOG.md | 7 +- proto/kyve/bundles/v1beta1/genesis.proto | 2 + x/bundles/genesis.go | 4 + x/bundles/types/genesis.pb.go | 102 ++++++++++++++++++----- 4 files changed, 91 insertions(+), 24 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index df220eda..7328dd40 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,7 +23,12 @@ An '!' indicates a state machine breaking change. ### Improvements - ! (`x/bundles`) [#142](https://github.com/KYVENetwork/chain/pull/142) Halt the pool if a single validator has more than 50% voting power. -- (deps) [#33](https://github.com/KYVENetwork/chain/pull/33) Upgrade Cosmos SDK to [v0.47.5](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.47.5) ([`v0.47.5-kyve`](https://github.com/KYVENetwork/cosmos-sdk/releases/tag/v0.47.5-kyve-rc0)). +- ! (deps) [#33](https://github.com/KYVENetwork/chain/pull/33) Upgrade Cosmos SDK to [v0.47.5](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.47.5) ([`v0.47.5-kyve`](https://github.com/KYVENetwork/cosmos-sdk/releases/tag/v0.47.5-kyve-rc0)). + +### Bug Fixes + +- [#149](https://github.com/KYVENetwork/chain/pull/63) add bundles query version map to genesis import/export. + ## [v1.3.1](https://github.com/KYVENetwork/chain/releases/tag/v1.3.1) - 2023-08-02 diff --git a/proto/kyve/bundles/v1beta1/genesis.proto b/proto/kyve/bundles/v1beta1/genesis.proto index 1c31792a..8d4d51b3 100644 --- a/proto/kyve/bundles/v1beta1/genesis.proto +++ b/proto/kyve/bundles/v1beta1/genesis.proto @@ -18,4 +18,6 @@ message GenesisState { repeated FinalizedBundle finalized_bundle_list = 3 [(gogoproto.nullable) = false]; // round_robin_progress_list ... repeated RoundRobinProgress round_robin_progress_list = 4 [(gogoproto.nullable) = false]; + // bundle_version_map ... + BundleVersionMap bundle_version_map = 5 [(gogoproto.nullable) = false]; } diff --git a/x/bundles/genesis.go b/x/bundles/genesis.go index bbc38d06..a90d9867 100644 --- a/x/bundles/genesis.go +++ b/x/bundles/genesis.go @@ -23,6 +23,8 @@ func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState) for _, entry := range genState.RoundRobinProgressList { k.SetRoundRobinProgress(ctx, entry) } + + k.SetBundleVersionMap(ctx, genState.BundleVersionMap) } // ExportGenesis returns the capability module's exported genesis. @@ -36,5 +38,7 @@ func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState { genesis.RoundRobinProgressList = k.GetAllRoundRobinProgress(ctx) + genesis.BundleVersionMap = k.GetBundleVersionMap(ctx) + return genesis } diff --git a/x/bundles/types/genesis.pb.go b/x/bundles/types/genesis.pb.go index 6695dcb2..8ef7b9ee 100644 --- a/x/bundles/types/genesis.pb.go +++ b/x/bundles/types/genesis.pb.go @@ -33,6 +33,8 @@ type GenesisState struct { FinalizedBundleList []FinalizedBundle `protobuf:"bytes,3,rep,name=finalized_bundle_list,json=finalizedBundleList,proto3" json:"finalized_bundle_list"` // round_robin_progress_list ... RoundRobinProgressList []RoundRobinProgress `protobuf:"bytes,4,rep,name=round_robin_progress_list,json=roundRobinProgressList,proto3" json:"round_robin_progress_list"` + // bundle_version_map ... + BundleVersionMap BundleVersionMap `protobuf:"bytes,5,opt,name=bundle_version_map,json=bundleVersionMap,proto3" json:"bundle_version_map"` } func (m *GenesisState) Reset() { *m = GenesisState{} } @@ -96,6 +98,13 @@ func (m *GenesisState) GetRoundRobinProgressList() []RoundRobinProgress { return nil } +func (m *GenesisState) GetBundleVersionMap() BundleVersionMap { + if m != nil { + return m.BundleVersionMap + } + return BundleVersionMap{} +} + func init() { proto.RegisterType((*GenesisState)(nil), "kyve.bundles.v1beta1.GenesisState") } @@ -105,29 +114,31 @@ func init() { } var fileDescriptor_21c07b409d3bb015 = []byte{ - // 342 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x91, 0x4f, 0x4b, 0x02, 0x41, - 0x18, 0xc6, 0x77, 0x55, 0x3c, 0xac, 0x9d, 0x36, 0x0b, 0x93, 0xd8, 0x4c, 0x0a, 0x3c, 0xc4, 0x0e, - 0xda, 0xad, 0xa3, 0x90, 0x1d, 0x8a, 0x10, 0x83, 0xa0, 0x08, 0x96, 0x59, 0x1d, 0xd7, 0xc1, 0x75, - 0x66, 0x99, 0x19, 0x2d, 0xfb, 0x14, 0x7d, 0x2c, 0x8f, 0x1e, 0x3b, 0x45, 0xb8, 0x5f, 0xa1, 0x0f, - 0x10, 0xf3, 0xc7, 0x40, 0x9a, 0xdb, 0xee, 0xbb, 0xbf, 0xe7, 0xf9, 0xbd, 0xcb, 0xeb, 0x35, 0xa7, - 0xcb, 0x05, 0x02, 0xf1, 0x9c, 0x8c, 0x52, 0xc4, 0xc1, 0xa2, 0x1d, 0x23, 0x01, 0xdb, 0x20, 0x41, - 0x04, 0x71, 0xcc, 0xc3, 0x8c, 0x51, 0x41, 0xfd, 0xaa, 0x64, 0x42, 0xc3, 0x84, 0x86, 0xa9, 0x57, - 0x13, 0x9a, 0x50, 0x05, 0x00, 0xf9, 0xa4, 0xd9, 0xba, 0xbd, 0x6f, 0x9b, 0xd5, 0xcc, 0xa9, 0x95, - 0xc9, 0x20, 0x83, 0x33, 0x83, 0x34, 0x7f, 0x0a, 0xde, 0xde, 0x8d, 0x5e, 0xe2, 0x41, 0x40, 0x81, - 0xfc, 0x2b, 0xaf, 0xac, 0x81, 0x9a, 0xdb, 0x70, 0x5b, 0x95, 0xce, 0x71, 0x68, 0x5b, 0x2a, 0xec, - 0x2b, 0xa6, 0x5b, 0x5a, 0x7d, 0x9d, 0x38, 0x03, 0x93, 0xf0, 0x5f, 0xbc, 0xaa, 0xe6, 0xa2, 0x8c, - 0xd1, 0x8c, 0x72, 0x98, 0x46, 0x29, 0xe6, 0xa2, 0x56, 0x68, 0x14, 0x5b, 0x95, 0xce, 0x99, 0xbd, - 0xa9, 0xab, 0xde, 0xfb, 0x26, 0x60, 0x1a, 0xfd, 0x78, 0x67, 0x7a, 0x87, 0xb9, 0xf0, 0x23, 0xef, - 0x60, 0x8c, 0x09, 0x4c, 0xf1, 0x3b, 0x1a, 0x45, 0xc6, 0xa3, 0xea, 0x8b, 0xaa, 0xfe, 0xdc, 0x5e, - 0xdf, 0xdb, 0x46, 0xb4, 0xc7, 0xf4, 0xef, 0x8f, 0x77, 0xc7, 0x4a, 0x80, 0xbd, 0x23, 0x46, 0xe7, - 0x64, 0x14, 0x31, 0x1a, 0x63, 0x22, 0xff, 0x21, 0x61, 0x88, 0x73, 0x2d, 0x29, 0x29, 0x49, 0xcb, - 0x2e, 0x19, 0xc8, 0xd8, 0x40, 0xa6, 0xfa, 0x26, 0x64, 0x3c, 0x87, 0xec, 0xdf, 0x17, 0xa9, 0xea, - 0xf6, 0x56, 0x9b, 0xc0, 0x5d, 0x6f, 0x02, 0xf7, 0x7b, 0x13, 0xb8, 0x1f, 0x79, 0xe0, 0xac, 0xf3, - 0xc0, 0xf9, 0xcc, 0x03, 0xe7, 0xf9, 0x22, 0xc1, 0x62, 0x32, 0x8f, 0xc3, 0x21, 0x9d, 0x81, 0xdb, - 0xa7, 0xc7, 0xeb, 0x7b, 0x24, 0x5e, 0x29, 0x9b, 0x82, 0xe1, 0x04, 0x62, 0x02, 0xde, 0xfe, 0xae, - 0x29, 0x96, 0x19, 0xe2, 0x71, 0x59, 0x5d, 0xf1, 0xf2, 0x37, 0x00, 0x00, 0xff, 0xff, 0xa1, 0xc8, - 0xa7, 0xad, 0x5e, 0x02, 0x00, 0x00, + // 371 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x92, 0x4f, 0x4f, 0xc2, 0x30, + 0x1c, 0x86, 0x37, 0x41, 0x0e, 0xc3, 0x83, 0x99, 0x68, 0x90, 0x98, 0x89, 0x44, 0x0d, 0x07, 0xb3, + 0x05, 0xbc, 0x79, 0x24, 0x11, 0x0f, 0xfe, 0x09, 0xc1, 0x84, 0x44, 0x62, 0xb2, 0xb4, 0x50, 0x46, + 0xc3, 0x68, 0x9b, 0xb6, 0xa0, 0xf8, 0x29, 0xfc, 0x58, 0x1c, 0x39, 0x7a, 0x32, 0x06, 0xbe, 0x88, + 0x59, 0x5b, 0x4c, 0xd0, 0xc5, 0xdb, 0xf6, 0xeb, 0xf3, 0xbe, 0x4f, 0xdb, 0xd4, 0xa9, 0x8c, 0x66, + 0x53, 0x14, 0xc0, 0x09, 0xe9, 0xc7, 0x48, 0x04, 0xd3, 0x1a, 0x44, 0x12, 0xd4, 0x82, 0x08, 0x11, + 0x24, 0xb0, 0xf0, 0x19, 0xa7, 0x92, 0xba, 0x85, 0x84, 0xf1, 0x0d, 0xe3, 0x1b, 0xa6, 0x54, 0x88, + 0x68, 0x44, 0x15, 0x10, 0x24, 0x5f, 0x9a, 0x2d, 0xa5, 0xf7, 0xad, 0xb3, 0x9a, 0x39, 0x49, 0x65, + 0x18, 0xe0, 0x60, 0x6c, 0x90, 0xca, 0x22, 0xe3, 0xec, 0xdc, 0xe8, 0x4d, 0x3c, 0x4a, 0x20, 0x91, + 0x7b, 0xe5, 0xe4, 0x34, 0x50, 0xb4, 0xcb, 0x76, 0x35, 0x5f, 0x3f, 0xf2, 0xd3, 0x36, 0xe5, 0xb7, + 0x14, 0xd3, 0xc8, 0xce, 0x3f, 0x8f, 0xad, 0xb6, 0x49, 0xb8, 0xcf, 0x4e, 0x41, 0x73, 0x21, 0xe3, + 0x94, 0x51, 0x01, 0xe2, 0x30, 0xc6, 0x42, 0x16, 0xb7, 0xca, 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02, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { @@ -150,6 +161,16 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + { + size, err := m.BundleVersionMap.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a if len(m.RoundRobinProgressList) > 0 { for iNdEx := len(m.RoundRobinProgressList) - 1; iNdEx >= 0; iNdEx-- { { @@ -242,6 +263,8 @@ func (m *GenesisState) Size() (n int) { n += 1 + l + sovGenesis(uint64(l)) } } + l = m.BundleVersionMap.Size() + n += 1 + l + sovGenesis(uint64(l)) return n } @@ -415,6 +438,39 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BundleVersionMap", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.BundleVersionMap.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenesis(dAtA[iNdEx:])