diff --git a/.github/mergify.yml b/.github/mergify.yml index 91146c56..5270adf4 100644 --- a/.github/mergify.yml +++ b/.github/mergify.yml @@ -22,3 +22,11 @@ pull_request_rules: backport: branches: - release/v1.1.x + - name: backport patches to v1.2.x branch + conditions: + - base=main + - label=backport/v1.2.x + actions: + backport: + branches: + - release/v1.2.x diff --git a/app/app.go b/app/app.go index 13a00220..b1d79a09 100644 --- a/app/app.go +++ b/app/app.go @@ -7,7 +7,7 @@ import ( "os" "path/filepath" - v11 "github.com/KYVENetwork/chain/app/upgrades/v1_1" + v12 "github.com/KYVENetwork/chain/app/upgrades/v1_2" "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/client" @@ -775,18 +775,10 @@ func NewKYVEApp( app.SetEndBlocker(app.EndBlocker) app.UpgradeKeeper.SetUpgradeHandler( - v11.UpgradeName, - v11.CreateUpgradeHandler( + v12.UpgradeName, + v12.CreateUpgradeHandler( app.mm, app.configurator, - appCodec, - keys[bundlesTypes.StoreKey], - keys[delegationTypes.StoreKey], - keys[stakersTypes.StoreKey], - app.AccountKeeper, - app.ICAControllerKeeper, - app.ICAHostKeeper, - app.IBCTransferKeeper, ), ) @@ -795,8 +787,8 @@ func NewKYVEApp( panic(err) } - if upgradeInfo.Name == v11.UpgradeName && !app.UpgradeKeeper.IsSkipHeight(upgradeInfo.Height) { - app.SetStoreLoader(v11.CreateStoreLoader(upgradeInfo.Height)) + if upgradeInfo.Name == v12.UpgradeName && !app.UpgradeKeeper.IsSkipHeight(upgradeInfo.Height) { + app.SetStoreLoader(v12.CreateStoreLoader(upgradeInfo.Height)) } if loadLatest { diff --git a/app/upgrades/v1_1/constants.go b/app/upgrades/v1_1/constants.go deleted file mode 100644 index a85c01ff..00000000 --- a/app/upgrades/v1_1/constants.go +++ /dev/null @@ -1,58 +0,0 @@ -package v1_1 - -// UpgradeName is the name of this specific software upgrade used on-chain. -const UpgradeName = "v1.1.0" - -// TestnetChainID is the Chain ID of the KYVE testnet (Kaon). -const TestnetChainID = "kaon-1" - -// MainnetChainID is the Chain ID of the KYVE mainnet. -const MainnetChainID = "kyve-1" - -// InvestorAccounts is a list of accounts from our second funding round. -var InvestorAccounts = []string{ - "kyve1lmmvd34rn05uuxyzyajyht5eykksvas9gpz9ln", - "kyve10ucfmct7epngs7k3y77qrfpvjlsgfv2qqjytm4", - "kyve10we97qv6nujhx4eyzskw9p23s0qfnr5rq6uadp", - "kyve1z2d4fvcv8gf72zvdp23x6ryswywh0ptrjrkdhp", - "kyve1hae0u8jqfedpm7u5ng6k464xsxx32tvluqus8t", - "kyve1gcz2tjuel4w6q3v4ec92eu4nvey6fkgnyfcavm", - "kyve1matxpxlw4cna4xr77jaqqmst74j35puy0nf87f", - "kyve1946pdjdg6dqxfd5et4g3k6glkkvt8l9r5zqmp9", - "kyve1ag2mctnvgwqea7au0lh92xd4ncfysw8gs94r6v", - "kyve1e7rmpdrrnjeuypn733c9lt2vg2cvkj788pvtvr", - "kyve1ewy2yfxr8aw3v9jv2kjgt4z6tj9ved3a9qyjh2", - "kyve1u26sz6kydnmpr5zq6nureav4xhasak8nu5q8d8", - "kyve194rvm2rjxhe0gfnv2095z6k5tnyszxh9sdyzhy", - "kyve1j7p7jg4cuw9ww6zyjf2gvpjxgseffjuhaj4qcq", - "kyve1kcmdhddxnwvmnekrsejnr4n87xqyxq9tlqlyqn", - "kyve13agpsm0r2sr3wl0yqqfxdncl7mxla0nh6jteum", - "kyve1jp7tv4g2ks855spj4cppmdnx4jtx26h5u5y3x2", - "kyve1hlsaz3fegeze2mk6a9f7mh93y72edfmxuq2as7", - "kyve1a9zlytywun0sq8gxjkqhsc4knzm8zw3tprq4x8", - "kyve1uqm9n8a769nvwagz7gmpx5x52nmqn3z05gdrqe", - "kyve1tmjvtgv6a447dewwhd4j2ehqsm8x4d2ttm053n", - "kyve1xlg7pgptqujg72csewpx7rytr4f0sgngqrj3gu", - "kyve1th6v7yygmxsfm2x2uwsp582eagnrcrjywwaf7f", - "kyve159ufwz58rzkcvjk94wkxv5uyz877pwpf6h7xy2", - "kyve1z73v6kqhutr5fq5eem2256l5a45empuk0xkxxm", - "kyve17rdl2fadf82qx4r0wd2ehtqyy3qsazeqyun9dd", - "kyve1tp5uz49gvvl5kys795re80e3mf9w9up0yzhzq7", - "kyve18d8t7nj9jqyyrzr76wea38u7er3ljzzqqys5nl", - "kyve14l2zxt75ylgnumjevxxans20uapctnke698vq2", - "kyve17zfy84an63jqdmm632th7sp2tj2tmh82hrysn9", - "kyve1m297tfaystezangz7wrm9j5s55a3j8xz7g5nkp", - "kyve1yxt5u93an2as4csf2xqv8sw96rgm2y3rrzmj2g", - "kyve1eddmugm8k5eyaa96v7e3rwrw97040q8awmkwdy", - "kyve1uxarsjawzcu3xjvydnmlgmceq3eldx2yas2djf", - "kyve1rtx3akgca36lrevmzal050ehxpxnwtn9xv7taz", -} - -const ( - // StartTime - Sep 14th, 2023. - // This is 6-months after KYVE mainnet launch. - StartTime = 1694649600 - // EndTime - Sep 14th, 2025. - // This is 2-years after StartTime. - EndTime = 1757808000 -) diff --git a/app/upgrades/v1_1/types/old_params.pb.go b/app/upgrades/v1_1/types/old_params.pb.go deleted file mode 100644 index 2e358b67..00000000 --- a/app/upgrades/v1_1/types/old_params.pb.go +++ /dev/null @@ -1,843 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: kyve/upgrades/v1beta1/old_params.proto - -package types - -import ( - fmt "fmt" - github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" - _ "github.com/cosmos/gogoproto/gogoproto" - proto "github.com/gogo/protobuf/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 - -// OldBundlesParams defines the bundles module parameters. -type OldBundlesParams struct { - // upload_timeout ... - UploadTimeout uint64 `protobuf:"varint,1,opt,name=upload_timeout,json=uploadTimeout,proto3" json:"upload_timeout,omitempty"` - // storage_cost ... - StorageCost github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,2,opt,name=storage_cost,json=storageCost,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"storage_cost"` - // network_fee ... - NetworkFee string `protobuf:"bytes,3,opt,name=network_fee,json=networkFee,proto3" json:"network_fee,omitempty"` - // max_points ... - MaxPoints uint64 `protobuf:"varint,4,opt,name=max_points,json=maxPoints,proto3" json:"max_points,omitempty"` -} - -func (m *OldBundlesParams) Reset() { *m = OldBundlesParams{} } -func (m *OldBundlesParams) String() string { return proto.CompactTextString(m) } -func (*OldBundlesParams) ProtoMessage() {} -func (*OldBundlesParams) Descriptor() ([]byte, []int) { - return fileDescriptor_c56c36e717e178bb, []int{0} -} -func (m *OldBundlesParams) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *OldBundlesParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_OldBundlesParams.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 *OldBundlesParams) XXX_Merge(src proto.Message) { - xxx_messageInfo_OldBundlesParams.Merge(m, src) -} -func (m *OldBundlesParams) XXX_Size() int { - return m.Size() -} -func (m *OldBundlesParams) XXX_DiscardUnknown() { - xxx_messageInfo_OldBundlesParams.DiscardUnknown(m) -} - -var xxx_messageInfo_OldBundlesParams proto.InternalMessageInfo - -func (m *OldBundlesParams) GetUploadTimeout() uint64 { - if m != nil { - return m.UploadTimeout - } - return 0 -} - -func (m *OldBundlesParams) GetNetworkFee() string { - if m != nil { - return m.NetworkFee - } - return "" -} - -func (m *OldBundlesParams) GetMaxPoints() uint64 { - if m != nil { - return m.MaxPoints - } - return 0 -} - -// OldDelegationParams defines the delegation module parameters. -type OldDelegationParams struct { - // unbonding_delegation_time ... - UnbondingDelegationTime uint64 `protobuf:"varint,1,opt,name=unbonding_delegation_time,json=unbondingDelegationTime,proto3" json:"unbonding_delegation_time,omitempty"` - // unbonding_delegation_time ... - RedelegationCooldown uint64 `protobuf:"varint,2,opt,name=redelegation_cooldown,json=redelegationCooldown,proto3" json:"redelegation_cooldown,omitempty"` - // unbonding_delegation_time ... - RedelegationMaxAmount uint64 `protobuf:"varint,3,opt,name=redelegation_max_amount,json=redelegationMaxAmount,proto3" json:"redelegation_max_amount,omitempty"` - // vote_slash ... - VoteSlash string `protobuf:"bytes,4,opt,name=vote_slash,json=voteSlash,proto3" json:"vote_slash,omitempty"` - // upload_slash ... - UploadSlash string `protobuf:"bytes,5,opt,name=upload_slash,json=uploadSlash,proto3" json:"upload_slash,omitempty"` - // timeout_slash ... - TimeoutSlash string `protobuf:"bytes,6,opt,name=timeout_slash,json=timeoutSlash,proto3" json:"timeout_slash,omitempty"` -} - -func (m *OldDelegationParams) Reset() { *m = OldDelegationParams{} } -func (m *OldDelegationParams) String() string { return proto.CompactTextString(m) } -func (*OldDelegationParams) ProtoMessage() {} -func (*OldDelegationParams) Descriptor() ([]byte, []int) { - return fileDescriptor_c56c36e717e178bb, []int{1} -} -func (m *OldDelegationParams) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *OldDelegationParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_OldDelegationParams.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 *OldDelegationParams) XXX_Merge(src proto.Message) { - xxx_messageInfo_OldDelegationParams.Merge(m, src) -} -func (m *OldDelegationParams) XXX_Size() int { - return m.Size() -} -func (m *OldDelegationParams) XXX_DiscardUnknown() { - xxx_messageInfo_OldDelegationParams.DiscardUnknown(m) -} - -var xxx_messageInfo_OldDelegationParams proto.InternalMessageInfo - -func (m *OldDelegationParams) GetUnbondingDelegationTime() uint64 { - if m != nil { - return m.UnbondingDelegationTime - } - return 0 -} - -func (m *OldDelegationParams) GetRedelegationCooldown() uint64 { - if m != nil { - return m.RedelegationCooldown - } - return 0 -} - -func (m *OldDelegationParams) GetRedelegationMaxAmount() uint64 { - if m != nil { - return m.RedelegationMaxAmount - } - return 0 -} - -func (m *OldDelegationParams) GetVoteSlash() string { - if m != nil { - return m.VoteSlash - } - return "" -} - -func (m *OldDelegationParams) GetUploadSlash() string { - if m != nil { - return m.UploadSlash - } - return "" -} - -func (m *OldDelegationParams) GetTimeoutSlash() string { - if m != nil { - return m.TimeoutSlash - } - return "" -} - -func init() { - proto.RegisterType((*OldBundlesParams)(nil), "kyve.upgrades.v1beta1.OldBundlesParams") - proto.RegisterType((*OldDelegationParams)(nil), "kyve.upgrades.v1beta1.OldDelegationParams") -} - -func init() { - proto.RegisterFile("kyve/upgrades/v1beta1/old_params.proto", fileDescriptor_c56c36e717e178bb) -} - -var fileDescriptor_c56c36e717e178bb = []byte{ - // 450 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x54, 0x92, 0xcf, 0x6e, 0xd3, 0x40, - 0x10, 0x87, 0xe3, 0x12, 0x2a, 0x65, 0x93, 0x22, 0x64, 0x5a, 0x35, 0x20, 0xe1, 0x94, 0x22, 0xaa, - 0x5e, 0xb0, 0x15, 0x15, 0x71, 0xe0, 0x46, 0x5a, 0xb8, 0x20, 0xda, 0x62, 0x10, 0x12, 0x5c, 0xac, - 0x8d, 0x77, 0x70, 0xac, 0xac, 0x77, 0x56, 0xde, 0x75, 0x9a, 0xbe, 0x05, 0x2f, 0xc1, 0xbb, 0xf4, - 0xc0, 0xa1, 0x47, 0xc4, 0xa1, 0x42, 0xc9, 0x8b, 0xa0, 0xfd, 0x43, 0x49, 0x4e, 0xb6, 0x7e, 0xf3, - 0xcd, 0x68, 0xbf, 0x9d, 0x25, 0x07, 0xd3, 0xcb, 0x19, 0x24, 0x8d, 0x2c, 0x6a, 0xca, 0x40, 0x25, - 0xb3, 0xe1, 0x18, 0x34, 0x1d, 0x26, 0xc8, 0x59, 0x26, 0x69, 0x4d, 0x2b, 0x15, 0xcb, 0x1a, 0x35, - 0x86, 0x3b, 0x86, 0x8b, 0xff, 0x71, 0xb1, 0xe7, 0x1e, 0x6d, 0x17, 0x58, 0xa0, 0x25, 0x12, 0xf3, - 0xe7, 0xe0, 0xfd, 0x9f, 0x01, 0xb9, 0x7f, 0xc6, 0xd9, 0xa8, 0x11, 0x8c, 0x83, 0x3a, 0xb7, 0x73, - 0xc2, 0x67, 0xe4, 0x5e, 0x23, 0x39, 0x52, 0x96, 0xe9, 0xb2, 0x02, 0x6c, 0x74, 0x3f, 0xd8, 0x0b, - 0x0e, 0xdb, 0xe9, 0x96, 0x4b, 0x3f, 0xb9, 0x30, 0xfc, 0x40, 0x7a, 0x4a, 0x63, 0x4d, 0x0b, 0xc8, - 0x72, 0x54, 0xba, 0xbf, 0xb1, 0x17, 0x1c, 0x76, 0x46, 0xf1, 0xd5, 0xcd, 0xa0, 0xf5, 0xfb, 0x66, - 0x70, 0x50, 0x94, 0x7a, 0xd2, 0x8c, 0xe3, 0x1c, 0xab, 0x24, 0x47, 0x55, 0xa1, 0xf2, 0x9f, 0xe7, - 0x8a, 0x4d, 0x13, 0x7d, 0x29, 0x41, 0xc5, 0x27, 0x90, 0xa7, 0x5d, 0x3f, 0xe3, 0x18, 0x95, 0x0e, - 0x07, 0xa4, 0x2b, 0x40, 0x5f, 0x60, 0x3d, 0xcd, 0xbe, 0x01, 0xf4, 0xef, 0x98, 0x89, 0x29, 0xf1, - 0xd1, 0x5b, 0x80, 0xf0, 0x31, 0x21, 0x15, 0x9d, 0x67, 0x12, 0x4b, 0xa1, 0x55, 0xbf, 0x6d, 0x8f, - 0xd5, 0xa9, 0xe8, 0xfc, 0xdc, 0x06, 0xfb, 0x3f, 0x36, 0xc8, 0x83, 0x33, 0xce, 0x4e, 0x80, 0x43, - 0x41, 0x75, 0x89, 0xc2, 0x1b, 0xbd, 0x22, 0x0f, 0x1b, 0x31, 0x46, 0xc1, 0x4a, 0x51, 0x64, 0xec, - 0xb6, 0x6a, 0xfd, 0xbc, 0xdc, 0xee, 0x2d, 0xf0, 0xbf, 0xdb, 0x98, 0x86, 0x47, 0x64, 0xa7, 0x86, - 0x95, 0x9e, 0x1c, 0x91, 0x33, 0xbc, 0x10, 0xd6, 0xb7, 0x9d, 0x6e, 0xaf, 0x16, 0x8f, 0x7d, 0x2d, - 0x7c, 0x49, 0x76, 0xd7, 0x9a, 0xcc, 0xa1, 0x69, 0x85, 0x8d, 0xd0, 0x56, 0xaa, 0x9d, 0xae, 0xcd, - 0x7c, 0x4f, 0xe7, 0xaf, 0x6d, 0xd1, 0xf8, 0xcd, 0x50, 0x43, 0xa6, 0x38, 0x55, 0x13, 0xeb, 0xd7, - 0x49, 0x3b, 0x26, 0xf9, 0x68, 0x82, 0xf0, 0x09, 0xe9, 0xf9, 0xcd, 0x38, 0xe0, 0xae, 0x05, 0xba, - 0x2e, 0x73, 0xc8, 0x53, 0xb2, 0xe5, 0xb7, 0xe6, 0x99, 0x4d, 0xcb, 0xf4, 0x7c, 0x68, 0xa1, 0xd1, - 0xe9, 0xd5, 0x22, 0x0a, 0xae, 0x17, 0x51, 0xf0, 0x67, 0x11, 0x05, 0xdf, 0x97, 0x51, 0xeb, 0x7a, - 0x19, 0xb5, 0x7e, 0x2d, 0xa3, 0xd6, 0xd7, 0x17, 0x2b, 0x6b, 0x7b, 0xf7, 0xe5, 0xf3, 0x9b, 0x53, - 0x77, 0xf7, 0x49, 0x3e, 0xa1, 0xa5, 0x48, 0xa8, 0x94, 0xab, 0x2f, 0x30, 0x1b, 0xba, 0x45, 0x8e, - 0x37, 0xed, 0x6b, 0x3a, 0xfa, 0x1b, 0x00, 0x00, 0xff, 0xff, 0xea, 0x97, 0x22, 0x23, 0xa4, 0x02, - 0x00, 0x00, -} - -func (m *OldBundlesParams) 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 *OldBundlesParams) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *OldBundlesParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.MaxPoints != 0 { - i = encodeVarintOldParams(dAtA, i, uint64(m.MaxPoints)) - i-- - dAtA[i] = 0x20 - } - if len(m.NetworkFee) > 0 { - i -= len(m.NetworkFee) - copy(dAtA[i:], m.NetworkFee) - i = encodeVarintOldParams(dAtA, i, uint64(len(m.NetworkFee))) - i-- - dAtA[i] = 0x1a - } - { - size := m.StorageCost.Size() - i -= size - if _, err := m.StorageCost.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintOldParams(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - if m.UploadTimeout != 0 { - i = encodeVarintOldParams(dAtA, i, uint64(m.UploadTimeout)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *OldDelegationParams) 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 *OldDelegationParams) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *OldDelegationParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.TimeoutSlash) > 0 { - i -= len(m.TimeoutSlash) - copy(dAtA[i:], m.TimeoutSlash) - i = encodeVarintOldParams(dAtA, i, uint64(len(m.TimeoutSlash))) - i-- - dAtA[i] = 0x32 - } - if len(m.UploadSlash) > 0 { - i -= len(m.UploadSlash) - copy(dAtA[i:], m.UploadSlash) - i = encodeVarintOldParams(dAtA, i, uint64(len(m.UploadSlash))) - i-- - dAtA[i] = 0x2a - } - if len(m.VoteSlash) > 0 { - i -= len(m.VoteSlash) - copy(dAtA[i:], m.VoteSlash) - i = encodeVarintOldParams(dAtA, i, uint64(len(m.VoteSlash))) - i-- - dAtA[i] = 0x22 - } - if m.RedelegationMaxAmount != 0 { - i = encodeVarintOldParams(dAtA, i, uint64(m.RedelegationMaxAmount)) - i-- - dAtA[i] = 0x18 - } - if m.RedelegationCooldown != 0 { - i = encodeVarintOldParams(dAtA, i, uint64(m.RedelegationCooldown)) - i-- - dAtA[i] = 0x10 - } - if m.UnbondingDelegationTime != 0 { - i = encodeVarintOldParams(dAtA, i, uint64(m.UnbondingDelegationTime)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func encodeVarintOldParams(dAtA []byte, offset int, v uint64) int { - offset -= sovOldParams(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *OldBundlesParams) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.UploadTimeout != 0 { - n += 1 + sovOldParams(uint64(m.UploadTimeout)) - } - l = m.StorageCost.Size() - n += 1 + l + sovOldParams(uint64(l)) - l = len(m.NetworkFee) - if l > 0 { - n += 1 + l + sovOldParams(uint64(l)) - } - if m.MaxPoints != 0 { - n += 1 + sovOldParams(uint64(m.MaxPoints)) - } - return n -} - -func (m *OldDelegationParams) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.UnbondingDelegationTime != 0 { - n += 1 + sovOldParams(uint64(m.UnbondingDelegationTime)) - } - if m.RedelegationCooldown != 0 { - n += 1 + sovOldParams(uint64(m.RedelegationCooldown)) - } - if m.RedelegationMaxAmount != 0 { - n += 1 + sovOldParams(uint64(m.RedelegationMaxAmount)) - } - l = len(m.VoteSlash) - if l > 0 { - n += 1 + l + sovOldParams(uint64(l)) - } - l = len(m.UploadSlash) - if l > 0 { - n += 1 + l + sovOldParams(uint64(l)) - } - l = len(m.TimeoutSlash) - if l > 0 { - n += 1 + l + sovOldParams(uint64(l)) - } - return n -} - -func sovOldParams(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozOldParams(x uint64) (n int) { - return sovOldParams(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *OldBundlesParams) 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 ErrIntOverflowOldParams - } - 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: OldBundlesParams: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: OldBundlesParams: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field UploadTimeout", wireType) - } - m.UploadTimeout = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowOldParams - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.UploadTimeout |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field StorageCost", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowOldParams - } - 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 ErrInvalidLengthOldParams - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthOldParams - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.StorageCost.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NetworkFee", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowOldParams - } - 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 ErrInvalidLengthOldParams - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthOldParams - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.NetworkFee = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MaxPoints", wireType) - } - m.MaxPoints = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowOldParams - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.MaxPoints |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipOldParams(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthOldParams - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *OldDelegationParams) 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 ErrIntOverflowOldParams - } - 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: OldDelegationParams: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: OldDelegationParams: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field UnbondingDelegationTime", wireType) - } - m.UnbondingDelegationTime = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowOldParams - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.UnbondingDelegationTime |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field RedelegationCooldown", wireType) - } - m.RedelegationCooldown = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowOldParams - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.RedelegationCooldown |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field RedelegationMaxAmount", wireType) - } - m.RedelegationMaxAmount = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowOldParams - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.RedelegationMaxAmount |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field VoteSlash", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowOldParams - } - 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 ErrInvalidLengthOldParams - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthOldParams - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.VoteSlash = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field UploadSlash", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowOldParams - } - 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 ErrInvalidLengthOldParams - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthOldParams - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.UploadSlash = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TimeoutSlash", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowOldParams - } - 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 ErrInvalidLengthOldParams - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthOldParams - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.TimeoutSlash = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipOldParams(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthOldParams - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipOldParams(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, ErrIntOverflowOldParams - } - 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, ErrIntOverflowOldParams - } - 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, ErrIntOverflowOldParams - } - 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, ErrInvalidLengthOldParams - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupOldParams - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthOldParams - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthOldParams = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowOldParams = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupOldParams = fmt.Errorf("proto: unexpected end of group") -) diff --git a/app/upgrades/v1_1/types/old_stakers.pb.go b/app/upgrades/v1_1/types/old_stakers.pb.go deleted file mode 100644 index 6ba7a5ce..00000000 --- a/app/upgrades/v1_1/types/old_stakers.pb.go +++ /dev/null @@ -1,839 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: kyve/upgrades/v1beta1/old_stakers.proto - -package types - -import ( - fmt "fmt" - proto "github.com/gogo/protobuf/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 - -// OldStaker contains all metadata for a staker -// Every address can only create one staker (itself) -type OldStaker struct { - // address ... - Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` - // commission ... - Commission string `protobuf:"bytes,2,opt,name=commission,proto3" json:"commission,omitempty"` - // moniker ... - Moniker string `protobuf:"bytes,3,opt,name=moniker,proto3" json:"moniker,omitempty"` - // website ... - Website string `protobuf:"bytes,4,opt,name=website,proto3" json:"website,omitempty"` - // logo ... - Logo string `protobuf:"bytes,5,opt,name=logo,proto3" json:"logo,omitempty"` -} - -func (m *OldStaker) Reset() { *m = OldStaker{} } -func (m *OldStaker) String() string { return proto.CompactTextString(m) } -func (*OldStaker) ProtoMessage() {} -func (*OldStaker) Descriptor() ([]byte, []int) { - return fileDescriptor_df012f4fad4151e2, []int{0} -} -func (m *OldStaker) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *OldStaker) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_OldStaker.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 *OldStaker) XXX_Merge(src proto.Message) { - xxx_messageInfo_OldStaker.Merge(m, src) -} -func (m *OldStaker) XXX_Size() int { - return m.Size() -} -func (m *OldStaker) XXX_DiscardUnknown() { - xxx_messageInfo_OldStaker.DiscardUnknown(m) -} - -var xxx_messageInfo_OldStaker proto.InternalMessageInfo - -func (m *OldStaker) GetAddress() string { - if m != nil { - return m.Address - } - return "" -} - -func (m *OldStaker) GetCommission() string { - if m != nil { - return m.Commission - } - return "" -} - -func (m *OldStaker) GetMoniker() string { - if m != nil { - return m.Moniker - } - return "" -} - -func (m *OldStaker) GetWebsite() string { - if m != nil { - return m.Website - } - return "" -} - -func (m *OldStaker) GetLogo() string { - if m != nil { - return m.Logo - } - return "" -} - -// OldCommissionChangeEntry stores the information for an -// upcoming commission change. A commission change is never -// instant, so delegators have time to redelegate in case -// they don't agree with the new commission. -type OldCommissionChangeEntry struct { - // index is needed for the queue-algorithm which - // processes the commission changes - Index uint64 `protobuf:"varint,1,opt,name=index,proto3" json:"index,omitempty"` - // staker is the address of the affected staker - Staker string `protobuf:"bytes,2,opt,name=staker,proto3" json:"staker,omitempty"` - // commission is the new commission which will - // be applied after the waiting time is over. - Commission string `protobuf:"bytes,3,opt,name=commission,proto3" json:"commission,omitempty"` - // creation_date is the UNIX-timestamp in seconds - // when the entry was created. - CreationDate int64 `protobuf:"varint,4,opt,name=creation_date,json=creationDate,proto3" json:"creation_date,omitempty"` -} - -func (m *OldCommissionChangeEntry) Reset() { *m = OldCommissionChangeEntry{} } -func (m *OldCommissionChangeEntry) String() string { return proto.CompactTextString(m) } -func (*OldCommissionChangeEntry) ProtoMessage() {} -func (*OldCommissionChangeEntry) Descriptor() ([]byte, []int) { - return fileDescriptor_df012f4fad4151e2, []int{1} -} -func (m *OldCommissionChangeEntry) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *OldCommissionChangeEntry) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_OldCommissionChangeEntry.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 *OldCommissionChangeEntry) XXX_Merge(src proto.Message) { - xxx_messageInfo_OldCommissionChangeEntry.Merge(m, src) -} -func (m *OldCommissionChangeEntry) XXX_Size() int { - return m.Size() -} -func (m *OldCommissionChangeEntry) XXX_DiscardUnknown() { - xxx_messageInfo_OldCommissionChangeEntry.DiscardUnknown(m) -} - -var xxx_messageInfo_OldCommissionChangeEntry proto.InternalMessageInfo - -func (m *OldCommissionChangeEntry) GetIndex() uint64 { - if m != nil { - return m.Index - } - return 0 -} - -func (m *OldCommissionChangeEntry) GetStaker() string { - if m != nil { - return m.Staker - } - return "" -} - -func (m *OldCommissionChangeEntry) GetCommission() string { - if m != nil { - return m.Commission - } - return "" -} - -func (m *OldCommissionChangeEntry) GetCreationDate() int64 { - if m != nil { - return m.CreationDate - } - return 0 -} - -func init() { - proto.RegisterType((*OldStaker)(nil), "kyve.upgrades.v1beta1.OldStaker") - proto.RegisterType((*OldCommissionChangeEntry)(nil), "kyve.upgrades.v1beta1.OldCommissionChangeEntry") -} - -func init() { - proto.RegisterFile("kyve/upgrades/v1beta1/old_stakers.proto", fileDescriptor_df012f4fad4151e2) -} - -var fileDescriptor_df012f4fad4151e2 = []byte{ - // 311 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x64, 0x91, 0xcb, 0x4a, 0x33, 0x31, - 0x14, 0xc7, 0x3b, 0x5f, 0x2f, 0x1f, 0x0d, 0xba, 0x09, 0x2a, 0x59, 0x05, 0xd1, 0x85, 0xae, 0x26, - 0x14, 0x7d, 0x02, 0x6b, 0x57, 0x42, 0x0b, 0x15, 0x04, 0xdd, 0x94, 0xcc, 0xe4, 0x30, 0x0d, 0x33, - 0x93, 0x0c, 0x49, 0xda, 0xda, 0x87, 0x10, 0x7c, 0x2c, 0x97, 0x5d, 0xba, 0x94, 0xf6, 0x45, 0x64, - 0x32, 0xa9, 0x14, 0xdd, 0xe5, 0x7f, 0x39, 0xe1, 0x77, 0x38, 0xe8, 0x2a, 0x5f, 0x2f, 0x81, 0x2d, - 0xaa, 0xcc, 0x70, 0x01, 0x96, 0x2d, 0x07, 0x09, 0x38, 0x3e, 0x60, 0xba, 0x10, 0x33, 0xeb, 0x78, - 0x0e, 0xc6, 0xc6, 0x95, 0xd1, 0x4e, 0xe3, 0xd3, 0xba, 0x18, 0xef, 0x8b, 0x71, 0x28, 0x5e, 0xbc, - 0x45, 0xa8, 0x3f, 0x29, 0xc4, 0xa3, 0xef, 0x62, 0x82, 0xfe, 0x73, 0x21, 0x0c, 0x58, 0x4b, 0xa2, - 0xf3, 0xe8, 0xba, 0x3f, 0xdd, 0x4b, 0x4c, 0x11, 0x4a, 0x75, 0x59, 0x4a, 0x6b, 0xa5, 0x56, 0xe4, - 0x9f, 0x0f, 0x0f, 0x9c, 0x7a, 0xb2, 0xd4, 0x4a, 0xe6, 0x60, 0x48, 0xbb, 0x99, 0x0c, 0xb2, 0x4e, - 0x56, 0x90, 0x58, 0xe9, 0x80, 0x74, 0x9a, 0x24, 0x48, 0x8c, 0x51, 0xa7, 0xd0, 0x99, 0x26, 0x5d, - 0x6f, 0xfb, 0x77, 0xcd, 0x43, 0x26, 0x85, 0x18, 0xfe, 0xfc, 0x3c, 0x9c, 0x73, 0x95, 0xc1, 0x48, - 0x39, 0xb3, 0xc6, 0x27, 0xa8, 0x2b, 0x95, 0x80, 0x57, 0x0f, 0xd7, 0x99, 0x36, 0x02, 0x9f, 0xa1, - 0x5e, 0xb3, 0x6a, 0xc0, 0x0a, 0xea, 0x17, 0x72, 0xfb, 0x0f, 0xf2, 0x25, 0x3a, 0x4e, 0x0d, 0x70, - 0x27, 0xb5, 0x9a, 0x09, 0x1e, 0xf0, 0xda, 0xd3, 0xa3, 0xbd, 0x79, 0xcf, 0x1d, 0xdc, 0x8d, 0x3f, - 0xb6, 0x34, 0xda, 0x6c, 0x69, 0xf4, 0xb5, 0xa5, 0xd1, 0xfb, 0x8e, 0xb6, 0x36, 0x3b, 0xda, 0xfa, - 0xdc, 0xd1, 0xd6, 0xcb, 0x6d, 0x26, 0xdd, 0x7c, 0x91, 0xc4, 0xa9, 0x2e, 0xd9, 0xc3, 0xf3, 0xd3, - 0x68, 0x0c, 0x6e, 0xa5, 0x4d, 0xce, 0xd2, 0x39, 0x97, 0x8a, 0xf1, 0xaa, 0x3a, 0xbc, 0xca, 0x6c, - 0xc0, 0xdc, 0xba, 0x02, 0x9b, 0xf4, 0xfc, 0x35, 0x6e, 0xbe, 0x03, 0x00, 0x00, 0xff, 0xff, 0x16, - 0x23, 0x0e, 0xb6, 0xb8, 0x01, 0x00, 0x00, -} - -func (m *OldStaker) 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 *OldStaker) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *OldStaker) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Logo) > 0 { - i -= len(m.Logo) - copy(dAtA[i:], m.Logo) - i = encodeVarintOldStakers(dAtA, i, uint64(len(m.Logo))) - i-- - dAtA[i] = 0x2a - } - if len(m.Website) > 0 { - i -= len(m.Website) - copy(dAtA[i:], m.Website) - i = encodeVarintOldStakers(dAtA, i, uint64(len(m.Website))) - i-- - dAtA[i] = 0x22 - } - if len(m.Moniker) > 0 { - i -= len(m.Moniker) - copy(dAtA[i:], m.Moniker) - i = encodeVarintOldStakers(dAtA, i, uint64(len(m.Moniker))) - i-- - dAtA[i] = 0x1a - } - if len(m.Commission) > 0 { - i -= len(m.Commission) - copy(dAtA[i:], m.Commission) - i = encodeVarintOldStakers(dAtA, i, uint64(len(m.Commission))) - i-- - dAtA[i] = 0x12 - } - if len(m.Address) > 0 { - i -= len(m.Address) - copy(dAtA[i:], m.Address) - i = encodeVarintOldStakers(dAtA, i, uint64(len(m.Address))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *OldCommissionChangeEntry) 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 *OldCommissionChangeEntry) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *OldCommissionChangeEntry) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.CreationDate != 0 { - i = encodeVarintOldStakers(dAtA, i, uint64(m.CreationDate)) - i-- - dAtA[i] = 0x20 - } - if len(m.Commission) > 0 { - i -= len(m.Commission) - copy(dAtA[i:], m.Commission) - i = encodeVarintOldStakers(dAtA, i, uint64(len(m.Commission))) - i-- - dAtA[i] = 0x1a - } - if len(m.Staker) > 0 { - i -= len(m.Staker) - copy(dAtA[i:], m.Staker) - i = encodeVarintOldStakers(dAtA, i, uint64(len(m.Staker))) - i-- - dAtA[i] = 0x12 - } - if m.Index != 0 { - i = encodeVarintOldStakers(dAtA, i, uint64(m.Index)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func encodeVarintOldStakers(dAtA []byte, offset int, v uint64) int { - offset -= sovOldStakers(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *OldStaker) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Address) - if l > 0 { - n += 1 + l + sovOldStakers(uint64(l)) - } - l = len(m.Commission) - if l > 0 { - n += 1 + l + sovOldStakers(uint64(l)) - } - l = len(m.Moniker) - if l > 0 { - n += 1 + l + sovOldStakers(uint64(l)) - } - l = len(m.Website) - if l > 0 { - n += 1 + l + sovOldStakers(uint64(l)) - } - l = len(m.Logo) - if l > 0 { - n += 1 + l + sovOldStakers(uint64(l)) - } - return n -} - -func (m *OldCommissionChangeEntry) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Index != 0 { - n += 1 + sovOldStakers(uint64(m.Index)) - } - l = len(m.Staker) - if l > 0 { - n += 1 + l + sovOldStakers(uint64(l)) - } - l = len(m.Commission) - if l > 0 { - n += 1 + l + sovOldStakers(uint64(l)) - } - if m.CreationDate != 0 { - n += 1 + sovOldStakers(uint64(m.CreationDate)) - } - return n -} - -func sovOldStakers(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozOldStakers(x uint64) (n int) { - return sovOldStakers(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *OldStaker) 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 ErrIntOverflowOldStakers - } - 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: OldStaker: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: OldStaker: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - 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 ErrIntOverflowOldStakers - } - 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 ErrInvalidLengthOldStakers - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthOldStakers - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Address = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Commission", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowOldStakers - } - 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 ErrInvalidLengthOldStakers - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthOldStakers - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Commission = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - 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 ErrIntOverflowOldStakers - } - 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 ErrInvalidLengthOldStakers - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthOldStakers - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Moniker = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Website", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowOldStakers - } - 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 ErrInvalidLengthOldStakers - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthOldStakers - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Website = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Logo", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowOldStakers - } - 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 ErrInvalidLengthOldStakers - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthOldStakers - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Logo = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipOldStakers(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthOldStakers - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *OldCommissionChangeEntry) 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 ErrIntOverflowOldStakers - } - 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: OldCommissionChangeEntry: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: OldCommissionChangeEntry: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Index", wireType) - } - m.Index = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowOldStakers - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Index |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Staker", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowOldStakers - } - 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 ErrInvalidLengthOldStakers - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthOldStakers - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Staker = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Commission", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowOldStakers - } - 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 ErrInvalidLengthOldStakers - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthOldStakers - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Commission = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field CreationDate", wireType) - } - m.CreationDate = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowOldStakers - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.CreationDate |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipOldStakers(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthOldStakers - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipOldStakers(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, ErrIntOverflowOldStakers - } - 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, ErrIntOverflowOldStakers - } - 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, ErrIntOverflowOldStakers - } - 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, ErrInvalidLengthOldStakers - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupOldStakers - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthOldStakers - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthOldStakers = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowOldStakers = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupOldStakers = fmt.Errorf("proto: unexpected end of group") -) diff --git a/app/upgrades/v1_1/upgrade.go b/app/upgrades/v1_1/upgrade.go deleted file mode 100644 index ed419a82..00000000 --- a/app/upgrades/v1_1/upgrade.go +++ /dev/null @@ -1,222 +0,0 @@ -package v1_1 - -import ( - "github.com/KYVENetwork/chain/app/upgrades/v1_1/types" - "github.com/cosmos/cosmos-sdk/codec" - "github.com/cosmos/cosmos-sdk/store/prefix" - storeTypes "github.com/cosmos/cosmos-sdk/store/types" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/module" - - // Auth - authKeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" - authTypes "github.com/cosmos/cosmos-sdk/x/auth/types" - vestingExported "github.com/cosmos/cosmos-sdk/x/auth/vesting/exported" - vestingTypes "github.com/cosmos/cosmos-sdk/x/auth/vesting/types" - // Bundles - bundlesTypes "github.com/KYVENetwork/chain/x/bundles/types" - // Delegation - delegationTypes "github.com/KYVENetwork/chain/x/delegation/types" - // IBC Transfer - transferKeeper "github.com/cosmos/ibc-go/v6/modules/apps/transfer/keeper" - transferTypes "github.com/cosmos/ibc-go/v6/modules/apps/transfer/types" - // ICA Controller - icaControllerKeeper "github.com/cosmos/ibc-go/v6/modules/apps/27-interchain-accounts/controller/keeper" - icaControllerTypes "github.com/cosmos/ibc-go/v6/modules/apps/27-interchain-accounts/controller/types" - // ICA Host - icaHostKeeper "github.com/cosmos/ibc-go/v6/modules/apps/27-interchain-accounts/host/keeper" - icaHostTypes "github.com/cosmos/ibc-go/v6/modules/apps/27-interchain-accounts/host/types" - // Stakers - stakersTypes "github.com/KYVENetwork/chain/x/stakers/types" - // Upgrade - upgradeTypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" -) - -func CreateUpgradeHandler( - mm *module.Manager, - configurator module.Configurator, - cdc codec.BinaryCodec, - bundlesStoreKey storeTypes.StoreKey, - delegationStoreKey storeTypes.StoreKey, - stakersStoreKey storeTypes.StoreKey, - accountKeeper authKeeper.AccountKeeper, - icaControllerKeeper icaControllerKeeper.Keeper, - icaHostKeeper icaHostKeeper.Keeper, - transferKeeper transferKeeper.Keeper, -) upgradeTypes.UpgradeHandler { - return func(ctx sdk.Context, _ upgradeTypes.Plan, vm module.VersionMap) (module.VersionMap, error) { - if ctx.ChainID() == MainnetChainID { - for _, address := range InvestorAccounts { - AdjustInvestorVesting(ctx, accountKeeper, sdk.MustAccAddressFromBech32(address)) - } - } - - EnableIBCTransfers(ctx, transferKeeper) - if ctx.ChainID() == TestnetChainID { - InitialiseICAControllerParams(ctx, icaControllerKeeper) - UpdateICAHostParams(ctx, icaHostKeeper) - } - - MigrateBundlesParameters(ctx, cdc, bundlesStoreKey) - MigrateDelegationParameters(ctx, cdc, delegationStoreKey) - - MigrateStakerMetadata(ctx, cdc, stakersStoreKey) - MigrateStakerCommissionEntries(ctx, cdc, stakersStoreKey) - - return mm.RunMigrations(ctx, configurator, vm) - } -} - -// AdjustInvestorVesting correctly adjusts the vesting schedules of investors -// from our second funding round. In genesis, the accounts were set up with an -// 18-month cliff instead of a 6-month cliff. -func AdjustInvestorVesting(ctx sdk.Context, keeper authKeeper.AccountKeeper, address sdk.AccAddress) { - rawAccount := keeper.GetAccount(ctx, address) - account := rawAccount.(vestingExported.VestingAccount) - - baseAccount := authTypes.NewBaseAccount( - account.GetAddress(), account.GetPubKey(), account.GetAccountNumber(), account.GetSequence(), - ) - updatedAccount := vestingTypes.NewContinuousVestingAccount( - baseAccount, account.GetOriginalVesting(), StartTime, EndTime, - ) - - keeper.SetAccount(ctx, updatedAccount) -} - -// EnableIBCTransfers updates the parameters of the IBC Transfer module to -// allow both sending and receiving of IBC tokens. Since the default parameters -// of the module have everything enabled, we simply switch to the defaults. -func EnableIBCTransfers(ctx sdk.Context, keeper transferKeeper.Keeper) { - params := transferTypes.DefaultParams() - keeper.SetParams(ctx, params) -} - -// InitialiseICAControllerParams initialises the parameters of the ICA -// Controller module. This is because when upgrading from IBC v5 to v6 on Kaon -// (our testnet), we didn't initialise the parameters. -func InitialiseICAControllerParams(ctx sdk.Context, keeper icaControllerKeeper.Keeper) { - params := icaControllerTypes.DefaultParams() - keeper.SetParams(ctx, params) -} - -// UpdateICAHostParams updates the parameters of the ICA Host module to allow -// all messages to be called. This configuration is the new default, which -// wasn't updated on Kaon (our testnet). -func UpdateICAHostParams(ctx sdk.Context, keeper icaHostKeeper.Keeper) { - params := icaHostTypes.DefaultParams() - keeper.SetParams(ctx, params) -} - -// MigrateBundlesParameters re-encodes all parameters of the Bundles module -// that were converted to sdk.Dec. -func MigrateBundlesParameters(ctx sdk.Context, cdc codec.BinaryCodec, bundlesStoreKey storeTypes.StoreKey) { - store := ctx.KVStore(bundlesStoreKey) - bz := store.Get(bundlesTypes.ParamsKey) - - var oldParams types.OldBundlesParams - cdc.MustUnmarshal(bz, &oldParams) - - newParams := bundlesTypes.Params{ - UploadTimeout: oldParams.UploadTimeout, - StorageCost: oldParams.StorageCost, - NetworkFee: sdk.MustNewDecFromStr(oldParams.NetworkFee), - MaxPoints: oldParams.MaxPoints, - } - - bz = cdc.MustMarshal(&newParams) - store.Set(bundlesTypes.ParamsKey, bz) -} - -// MigrateDelegationParameters re-encodes all parameters of the Delegation -// module that were converted to sdk.Dec. -func MigrateDelegationParameters(ctx sdk.Context, cdc codec.BinaryCodec, delegationStoreKey storeTypes.StoreKey) { - store := ctx.KVStore(delegationStoreKey) - bz := store.Get(delegationTypes.ParamsKey) - - var oldParams types.OldDelegationParams - cdc.MustUnmarshal(bz, &oldParams) - - newParams := delegationTypes.Params{ - UnbondingDelegationTime: oldParams.UnbondingDelegationTime, - RedelegationCooldown: oldParams.RedelegationCooldown, - RedelegationMaxAmount: oldParams.RedelegationMaxAmount, - VoteSlash: sdk.MustNewDecFromStr(oldParams.VoteSlash), - UploadSlash: sdk.MustNewDecFromStr(oldParams.UploadSlash), - TimeoutSlash: sdk.MustNewDecFromStr(oldParams.TimeoutSlash), - } - - bz = cdc.MustMarshal(&newParams) - store.Set(delegationTypes.ParamsKey, bz) -} - -// MigrateStakerMetadata migrates all existing staker metadata. The `Logo` -// field has been deprecated and replaced by the `Identity` field. This new -// field must be a valid hex string; therefore, must be set to empty for now. -func MigrateStakerMetadata(ctx sdk.Context, cdc codec.BinaryCodec, stakerStoreKey storeTypes.StoreKey) { - store := prefix.NewStore(ctx.KVStore(stakerStoreKey), stakersTypes.StakerKeyPrefix) - iterator := sdk.KVStorePrefixIterator(store, []byte{}) - - defer iterator.Close() - oldStakers := make([]types.OldStaker, 0) - - for ; iterator.Valid(); iterator.Next() { - var val types.OldStaker - cdc.MustUnmarshal(iterator.Value(), &val) - oldStakers = append(oldStakers, val) - } - - for _, oldStaker := range oldStakers { - - commission, err := sdk.NewDecFromStr(oldStaker.Commission) - if err != nil { - commission = stakersTypes.DefaultCommission - } - - newStaker := stakersTypes.Staker{ - Address: oldStaker.Address, - Commission: commission, - Moniker: oldStaker.Moniker, - Website: oldStaker.Website, - Identity: "", - SecurityContact: "", - Details: "", - } - - b := cdc.MustMarshal(&newStaker) - store.Set(stakersTypes.StakerKey(newStaker.Address), b) - } -} - -// MigrateStakerCommissionEntries re-encodes all CommissionChangeEntry -// entries from the Stakers module that were converted to sdk.Dec. -func MigrateStakerCommissionEntries(ctx sdk.Context, cdc codec.BinaryCodec, stakerStoreKey storeTypes.StoreKey) { - store := prefix.NewStore(ctx.KVStore(stakerStoreKey), stakersTypes.CommissionChangeEntryKeyPrefix) - iterator := sdk.KVStorePrefixIterator(store, []byte{}) - - defer iterator.Close() - oldCommissionChangeEntries := make([]types.OldCommissionChangeEntry, 0) - - for ; iterator.Valid(); iterator.Next() { - var val types.OldCommissionChangeEntry - cdc.MustUnmarshal(iterator.Value(), &val) - oldCommissionChangeEntries = append(oldCommissionChangeEntries, val) - } - - for _, oldCommissionEntry := range oldCommissionChangeEntries { - commission, err := sdk.NewDecFromStr(oldCommissionEntry.Commission) - if err != nil { - commission = stakersTypes.DefaultCommission - } - - newCommissionChangeEntry := stakersTypes.CommissionChangeEntry{ - Index: oldCommissionEntry.Index, - Staker: oldCommissionEntry.Staker, - Commission: commission, - CreationDate: oldCommissionEntry.CreationDate, - } - - b := cdc.MustMarshal(&newCommissionChangeEntry) - store.Set(stakersTypes.CommissionChangeEntryKey(newCommissionChangeEntry.Index), b) - } -} diff --git a/app/upgrades/v1_2/constants.go b/app/upgrades/v1_2/constants.go new file mode 100644 index 00000000..e6d65b86 --- /dev/null +++ b/app/upgrades/v1_2/constants.go @@ -0,0 +1,10 @@ +package v1_2 + +// UpgradeName is the name of this specific software upgrade used on-chain. +const UpgradeName = "v1.2.0" + +// TestnetChainID is the Chain ID of the KYVE testnet (Kaon). +const TestnetChainID = "kaon-1" + +// MainnetChainID is the Chain ID of the KYVE mainnet. +const MainnetChainID = "kyve-1" diff --git a/app/upgrades/v1_1/store.go b/app/upgrades/v1_2/store.go similarity index 96% rename from app/upgrades/v1_1/store.go rename to app/upgrades/v1_2/store.go index 2d95215a..92e0836e 100644 --- a/app/upgrades/v1_1/store.go +++ b/app/upgrades/v1_2/store.go @@ -1,4 +1,4 @@ -package v1_1 +package v1_2 import ( "github.com/cosmos/cosmos-sdk/baseapp" diff --git a/app/upgrades/v1_2/upgrade.go b/app/upgrades/v1_2/upgrade.go new file mode 100644 index 00000000..a7d45921 --- /dev/null +++ b/app/upgrades/v1_2/upgrade.go @@ -0,0 +1,16 @@ +package v1_2 + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/module" + upgradeTypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" +) + +func CreateUpgradeHandler( + mm *module.Manager, + configurator module.Configurator, +) upgradeTypes.UpgradeHandler { + return func(ctx sdk.Context, _ upgradeTypes.Plan, vm module.VersionMap) (module.VersionMap, error) { + return mm.RunMigrations(ctx, configurator, vm) + } +} diff --git a/proto/kyve/upgrades/v1beta1/README.md b/proto/kyve/upgrades/v1beta1/README.md deleted file mode 100644 index ee2aee63..00000000 --- a/proto/kyve/upgrades/v1beta1/README.md +++ /dev/null @@ -1,13 +0,0 @@ -# Upgrade Types - -When upgrading from `v1.0.0` to `v1.1.0`, a significant amount of internal -Protobuf types changed. This is mainly the change from `string` to `sdk.Dec`. - -Unfortunately, we can't decode strings that don't have the correct zero -padding. Therefore, all affected fields need to be updated manually. This -directory contains all the old Protobuf definitions so that we can correctly -decode the original values. - -These Protobuf definitions are directly built to `app/upgrades/v1_1/types`. - -After the `v1.1.0` upgrade, these definitions can be removed. diff --git a/proto/kyve/upgrades/v1beta1/old_params.proto b/proto/kyve/upgrades/v1beta1/old_params.proto deleted file mode 100644 index 4c40c10b..00000000 --- a/proto/kyve/upgrades/v1beta1/old_params.proto +++ /dev/null @@ -1,38 +0,0 @@ -syntax = "proto3"; - -package kyve.upgrades.v1beta1; - -import "gogoproto/gogo.proto"; - -option go_package = "github.com/KYVENetwork/chain/app/upgrades/v1_1/types"; - -// OldBundlesParams defines the bundles module parameters. -message OldBundlesParams { - // upload_timeout ... - uint64 upload_timeout = 1; - // storage_cost ... - string storage_cost = 2 [ - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", - (gogoproto.nullable) = false - ]; - // network_fee ... - string network_fee = 3; - // max_points ... - uint64 max_points = 4; -} - -// OldDelegationParams defines the delegation module parameters. -message OldDelegationParams { - // unbonding_delegation_time ... - uint64 unbonding_delegation_time = 1; - // unbonding_delegation_time ... - uint64 redelegation_cooldown = 2; - // unbonding_delegation_time ... - uint64 redelegation_max_amount = 3; - // vote_slash ... - string vote_slash = 4; - // upload_slash ... - string upload_slash = 5; - // timeout_slash ... - string timeout_slash = 6; -} diff --git a/proto/kyve/upgrades/v1beta1/old_stakers.proto b/proto/kyve/upgrades/v1beta1/old_stakers.proto deleted file mode 100644 index c40a3001..00000000 --- a/proto/kyve/upgrades/v1beta1/old_stakers.proto +++ /dev/null @@ -1,38 +0,0 @@ -syntax = "proto3"; - -package kyve.upgrades.v1beta1; - -option go_package = "github.com/KYVENetwork/chain/app/upgrades/v1_1/types"; - -// OldStaker contains all metadata for a staker -// Every address can only create one staker (itself) -message OldStaker { - // address ... - string address = 1; - // commission ... - string commission = 2; - // moniker ... - string moniker = 3; - // website ... - string website = 4; - // logo ... - string logo = 5; -} - -// OldCommissionChangeEntry stores the information for an -// upcoming commission change. A commission change is never -// instant, so delegators have time to redelegate in case -// they don't agree with the new commission. -message OldCommissionChangeEntry { - // index is needed for the queue-algorithm which - // processes the commission changes - uint64 index = 1; - // staker is the address of the affected staker - string staker = 2; - // commission is the new commission which will - // be applied after the waiting time is over. - string commission = 3; - // creation_date is the UNIX-timestamp in seconds - // when the entry was created. - int64 creation_date = 4; -}