diff --git a/CHANGELOG.md b/CHANGELOG.md index 3460ff7f..3ed499ea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,6 +29,7 @@ An '!' indicates a state machine breaking change. ### Improvements +- ! (`x/pool`) [#190](https://github.com/KYVENetwork/chain/pull/190) Make inflation-share-weight a decimal. - [#182](https://github.com/KYVENetwork/chain/pull/182) Make release builds reproducible. - ! [#183](https://github.com/KYVENetwork/chain/pull/183) Only charge coins which are whitelisted. - ! (deps) [#174](https://github.com/KYVENetwork/chain/pull/174) Add mainnet KYVE image to interchain tests. diff --git a/app/app.go b/app/app.go index 316179f8..72c8126a 100644 --- a/app/app.go +++ b/app/app.go @@ -410,6 +410,9 @@ func New( app.appCodec, app.GetStoreKeys(), app.BundlesKeeper, + app.DelegationKeeper, + app.FundersKeeper, + app.StakersKeeper, app.PoolKeeper, ), ) diff --git a/app/upgrades/v1_5/upgrade.go b/app/upgrades/v1_5/upgrade.go index fdffb067..7408dffc 100644 --- a/app/upgrades/v1_5/upgrade.go +++ b/app/upgrades/v1_5/upgrade.go @@ -4,15 +4,30 @@ import ( "context" "fmt" + poolKeeper "github.com/KYVENetwork/chain/x/pool/keeper" + poolTypes "github.com/KYVENetwork/chain/x/pool/types" + + "github.com/KYVENetwork/chain/app/upgrades/v1_5/v1_4_types/bundles" + "github.com/KYVENetwork/chain/app/upgrades/v1_5/v1_4_types/delegation" + "github.com/KYVENetwork/chain/app/upgrades/v1_5/v1_4_types/funders" + v1_4_pool "github.com/KYVENetwork/chain/app/upgrades/v1_5/v1_4_types/pool" + "github.com/KYVENetwork/chain/app/upgrades/v1_5/v1_4_types/stakers" + delegationKeeper "github.com/KYVENetwork/chain/x/delegation/keeper" + delegationTypes "github.com/KYVENetwork/chain/x/delegation/types" + fundersKeeper "github.com/KYVENetwork/chain/x/funders/keeper" + funderTypes "github.com/KYVENetwork/chain/x/funders/types" + fundersTypes "github.com/KYVENetwork/chain/x/funders/types" + globalTypes "github.com/KYVENetwork/chain/x/global/types" + stakersKeeper "github.com/KYVENetwork/chain/x/stakers/keeper" + stakersTypes "github.com/KYVENetwork/chain/x/stakers/types" + "cosmossdk.io/math" storetypes "cosmossdk.io/store/types" upgradetypes "cosmossdk.io/x/upgrade/types" - "github.com/KYVENetwork/chain/app/upgrades/v1_5/v1_4_types" - "github.com/KYVENetwork/chain/x/bundles/keeper" - bundlestypes "github.com/KYVENetwork/chain/x/bundles/types" - poolkeeper "github.com/KYVENetwork/chain/x/pool/keeper" + bundlesKeeper "github.com/KYVENetwork/chain/x/bundles/keeper" + bundlesTypes "github.com/KYVENetwork/chain/x/bundles/types" "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" @@ -22,56 +37,207 @@ const ( UpgradeName = "v1.5.0" ) -func CreateUpgradeHandler(mm *module.Manager, configurator module.Configurator, cdc codec.Codec, storeKeys []storetypes.StoreKey, bundlesKeeper keeper.Keeper, poolKeeper *poolkeeper.Keeper) upgradetypes.UpgradeHandler { +func CreateUpgradeHandler(mm *module.Manager, configurator module.Configurator, cdc codec.Codec, storeKeys []storetypes.StoreKey, bundlesKeeper bundlesKeeper.Keeper, delegationKeeper delegationKeeper.Keeper, fundersKeeper fundersKeeper.Keeper, stakersKeeper *stakersKeeper.Keeper, poolKeeper *poolKeeper.Keeper) upgradetypes.UpgradeHandler { return func(ctx context.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) { sdkCtx := sdk.UnwrapSDKContext(ctx) logger := sdkCtx.Logger().With("upgrade", UpgradeName) logger.Info(fmt.Sprintf("performing upgrade %v", UpgradeName)) - if err := migrateStorageCosts(sdkCtx, bundlesKeeper, poolKeeper, storeKeys, cdc); err != nil { - return nil, err - } - // TODO: migrate gov params + // TODO emit events if necessary + + // migrate fundings + MigrateFundersModule(sdkCtx, cdc, MustGetStoreKey(storeKeys, fundersTypes.StoreKey), fundersKeeper) - // TODO: migrate fundings + // migrate delegations + migrateDelegationModule(sdkCtx, cdc, MustGetStoreKey(storeKeys, delegationTypes.StoreKey), delegationKeeper) - // TODO: migrate delegation outstanding rewards + // migrate stakers + migrateStakersModule(sdkCtx, cdc, MustGetStoreKey(storeKeys, stakersTypes.StoreKey), stakersKeeper) - // TODO: migrate network fee and whitelist weights + // migrate bundles + migrateBundlesModule(sdkCtx, cdc, MustGetStoreKey(storeKeys, bundlesTypes.StoreKey), bundlesKeeper) - // TODO: migrate MaxVotingPowerPerPool in pool params + // migrate pool + migrateMaxVotingPowerInPool(sdkCtx, cdc, MustGetStoreKey(storeKeys, poolTypes.StoreKey), *poolKeeper) + migrateInflationShareWeight(sdkCtx, cdc, MustGetStoreKey(storeKeys, poolTypes.StoreKey), poolKeeper) return mm.RunMigrations(ctx, configurator, fromVM) } } -func migrateStorageCosts(sdkCtx sdk.Context, bundlesKeeper keeper.Keeper, poolKeeper *poolkeeper.Keeper, storeKeys []storetypes.StoreKey, cdc codec.Codec) error { - var bundlesStoreKey storetypes.StoreKey +func MustGetStoreKey(storeKeys []storetypes.StoreKey, storeName string) storetypes.StoreKey { for _, k := range storeKeys { - if k.Name() == "bundles" { - bundlesStoreKey = k - break + if k.Name() == storeName { + return k } } - if bundlesStoreKey == nil { - return fmt.Errorf("store key not found: bundles") + + panic(fmt.Sprintf("failed to find store key: %s", fundersTypes.StoreKey)) +} + +func MigrateFundersModule(sdkCtx sdk.Context, cdc codec.Codec, fundersStoreKey storetypes.StoreKey, fundersKeeper fundersKeeper.Keeper) { + // migrate params + // TODO: define final prices and initial whitelisted coins + oldParams := funders.GetParams(sdkCtx, cdc, fundersStoreKey) + fundersKeeper.SetParams(sdkCtx, fundersTypes.Params{ + CoinWhitelist: []*fundersTypes.WhitelistCoinEntry{ + { + CoinDenom: globalTypes.Denom, + MinFundingAmount: oldParams.MinFundingAmount, + MinFundingAmountPerBundle: oldParams.MinFundingAmountPerBundle, + CoinWeight: math.LegacyMustNewDecFromStr("0.06"), + }, + }, + MinFundingMultiple: oldParams.MinFundingMultiple, + }) + + // migrate fundings + oldFundings := funders.GetAllFundings(sdkCtx, cdc, fundersStoreKey) + for _, f := range oldFundings { + fundersKeeper.SetFunding(sdkCtx, &funderTypes.Funding{ + FunderAddress: f.FunderAddress, + PoolId: f.PoolId, + Amounts: sdk.NewCoins(sdk.NewInt64Coin(globalTypes.Denom, int64(f.Amount))), + AmountsPerBundle: sdk.NewCoins(sdk.NewInt64Coin(globalTypes.Denom, int64(f.AmountPerBundle))), + TotalFunded: sdk.NewCoins(sdk.NewInt64Coin(globalTypes.Denom, int64(f.TotalFunded))), + }) + } +} + +func migrateDelegationModule(sdkCtx sdk.Context, cdc codec.Codec, delegationStoreKey storetypes.StoreKey, delegationKeeper delegationKeeper.Keeper) { + // migrate delegation entries + oldDelegationEntries := delegation.GetAllDelegationEntries(sdkCtx, cdc, delegationStoreKey) + for _, d := range oldDelegationEntries { + delegationKeeper.SetDelegationEntry(sdkCtx, delegationTypes.DelegationEntry{ + Staker: d.Staker, + KIndex: d.KIndex, + Value: sdk.NewDecCoins(sdk.NewDecCoinFromDec(globalTypes.Denom, d.Value)), + }) + } + + // migrate delegation data + oldDelegationData := delegation.GetAllDelegationData(sdkCtx, cdc, delegationStoreKey) + for _, d := range oldDelegationData { + delegationKeeper.SetDelegationData(sdkCtx, delegationTypes.DelegationData{ + Staker: d.Staker, + CurrentRewards: sdk.NewCoins(sdk.NewInt64Coin(globalTypes.Denom, int64(d.CurrentRewards))), + TotalDelegation: d.TotalDelegation, + LatestIndexK: d.LatestIndexK, + DelegatorCount: d.DelegatorCount, + LatestIndexWasUndelegation: d.LatestIndexWasUndelegation, + }) + } +} + +func migrateStakersModule(sdkCtx sdk.Context, cdc codec.Codec, stakersStoreKey storetypes.StoreKey, stakersKeeper *stakersKeeper.Keeper) { + // migrate stakers + oldStakers := stakers.GetAllStakers(sdkCtx, cdc, stakersStoreKey) + for _, s := range oldStakers { + stakersKeeper.Migration_SetStaker(sdkCtx, stakersTypes.Staker{ + Address: s.Address, + Commission: s.Commission, + Moniker: s.Moniker, + Website: s.Website, + Identity: s.Identity, + SecurityContact: s.SecurityContact, + Details: s.Details, + CommissionRewards: sdk.NewCoins(sdk.NewInt64Coin(globalTypes.Denom, int64(s.CommissionRewards))), + }) } +} + +func migrateBundlesModule(sdkCtx sdk.Context, cdc codec.Codec, bundlesStoreKey storetypes.StoreKey, bundlesKeeper bundlesKeeper.Keeper) { + oldParams := bundles.GetParams(sdkCtx, cdc, bundlesStoreKey) - // Copy storage cost from old params to new params - // The storage cost of all storage providers will be the same after this migration - oldParams := v1_4_types.GetParams(sdkCtx, bundlesStoreKey, cdc) - newParams := bundlestypes.Params{ + // TODO: define final storage cost prices + bundlesKeeper.SetParams(sdkCtx, bundlesTypes.Params{ UploadTimeout: oldParams.UploadTimeout, - StorageCosts: []bundlestypes.StorageCost{ - // TODO: define value for storage provider id 1 and 2 - {StorageProviderId: 1, Cost: math.LegacyMustNewDecFromStr("0.00")}, - {StorageProviderId: 2, Cost: math.LegacyMustNewDecFromStr("0.00")}, + StorageCosts: []bundlesTypes.StorageCost{ + // Arweave: https://arweave.net/price/1048576 -> 699 winston/byte * 40 USD/AR * 1.5 / 10**12 + {StorageProviderId: 1, Cost: math.LegacyMustNewDecFromStr("0.000000004194")}, + // Irys: https://node1.bundlr.network/price/1048576 -> 1048 winston/byte * 40 USD/AR * 1.5 / 10**12 + {StorageProviderId: 2, Cost: math.LegacyMustNewDecFromStr("0.000000006288")}, + // KYVE Storage Provider: zero since it is free to use for testnet participants + {StorageProviderId: 3, Cost: math.LegacyMustNewDecFromStr("0.00")}, }, NetworkFee: oldParams.NetworkFee, MaxPoints: oldParams.MaxPoints, - } + }) +} + +func migrateMaxVotingPowerInPool(sdkCtx sdk.Context, cdc codec.Codec, poolStoreKey storetypes.StoreKey, poolKeeper poolKeeper.Keeper) { + oldParams := v1_4_pool.GetParams(sdkCtx, cdc, poolStoreKey) - bundlesKeeper.SetParams(sdkCtx, newParams) - return nil + poolKeeper.SetParams(sdkCtx, poolTypes.Params{ + ProtocolInflationShare: oldParams.ProtocolInflationShare, + PoolInflationPayoutRate: oldParams.PoolInflationPayoutRate, + MaxVotingPowerPerPool: math.LegacyMustNewDecFromStr("0.5"), + }) +} + +func migrateInflationShareWeight(sdkCtx sdk.Context, cdc codec.Codec, poolStoreKey storetypes.StoreKey, poolKeeper *poolKeeper.Keeper) { + pools := v1_4_pool.GetAllPools(sdkCtx, poolStoreKey, cdc) + for _, pool := range pools { + var newPool poolTypes.Pool + + var protocol *poolTypes.Protocol + if pool.Protocol != nil { + protocol = &poolTypes.Protocol{ + Version: pool.Protocol.Version, + Binaries: pool.Protocol.Binaries, + LastUpgrade: pool.Protocol.LastUpgrade, + } + } + var upgradePlan *poolTypes.UpgradePlan + if pool.UpgradePlan != nil { + upgradePlan = &poolTypes.UpgradePlan{ + Version: pool.UpgradePlan.Version, + Binaries: pool.UpgradePlan.Binaries, + ScheduledAt: pool.UpgradePlan.ScheduledAt, + Duration: pool.UpgradePlan.Duration, + } + } + + newPool = poolTypes.Pool{ + Id: pool.Id, + Name: pool.Name, + Runtime: pool.Runtime, + Logo: pool.Logo, + Config: pool.Config, + StartKey: pool.StartKey, + CurrentKey: pool.CurrentKey, + CurrentSummary: pool.CurrentSummary, + CurrentIndex: pool.CurrentIndex, + TotalBundles: pool.TotalBundles, + UploadInterval: pool.UploadInterval, + // Currently all pools have int64(1_000_000) as inflation_share weight. + // Set this to 1 as we now support decimals + InflationShareWeight: math.LegacyMustNewDecFromStr("1"), + MinDelegation: pool.MinDelegation, + MaxBundleSize: pool.MaxBundleSize, + Disabled: pool.Disabled, + Protocol: protocol, + UpgradePlan: upgradePlan, + CurrentStorageProviderId: pool.CurrentStorageProviderId, + CurrentCompressionId: pool.CurrentCompressionId, + EndKey: pool.EndKey, + } + poolKeeper.SetPool(sdkCtx, newPool) + + _ = sdkCtx.EventManager().EmitTypedEvent(&poolTypes.EventPoolUpdated{ + Id: pool.Id, + RawUpdateString: "{\"inflation_share_weight\":\"1.0\"}", + Name: pool.Name, + Runtime: pool.Runtime, + Logo: pool.Logo, + Config: pool.Config, + UploadInterval: pool.UploadInterval, + InflationShareWeight: math.LegacyMustNewDecFromStr("1"), + MinDelegation: pool.MinDelegation, + MaxBundleSize: pool.MaxBundleSize, + StorageProviderId: pool.CurrentStorageProviderId, + CompressionId: pool.CurrentCompressionId, + }) + } } diff --git a/app/upgrades/v1_5/v1_4_types/getters_params.go b/app/upgrades/v1_5/v1_4_types/bundles/getters_params.go similarity index 77% rename from app/upgrades/v1_5/v1_4_types/getters_params.go rename to app/upgrades/v1_5/v1_4_types/bundles/getters_params.go index d3f98bef..f2e9aac6 100644 --- a/app/upgrades/v1_5/v1_4_types/getters_params.go +++ b/app/upgrades/v1_5/v1_4_types/bundles/getters_params.go @@ -1,4 +1,4 @@ -package v1_4_types +package bundles import ( storeTypes "cosmossdk.io/store/types" @@ -8,7 +8,7 @@ import ( ) // GetParams returns the current x/bundles module parameters. -func GetParams(ctx sdk.Context, storeKey storeTypes.StoreKey, cdc codec.Codec) (params Params) { +func GetParams(ctx sdk.Context, cdc codec.Codec, storeKey storeTypes.StoreKey) (params Params) { store := ctx.KVStore(storeKey) bz := store.Get(types.ParamsPrefix) diff --git a/app/upgrades/v1_5/v1_4_types/params.pb.go b/app/upgrades/v1_5/v1_4_types/bundles/params.pb.go similarity index 97% rename from app/upgrades/v1_5/v1_4_types/params.pb.go rename to app/upgrades/v1_5/v1_4_types/bundles/params.pb.go index d57b8070..1385f7c3 100644 --- a/app/upgrades/v1_5/v1_4_types/params.pb.go +++ b/app/upgrades/v1_5/v1_4_types/bundles/params.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: kyve/bundles/v1beta1/params.proto +// source: kyve/bundles/legacy/params.proto -package v1_4_types +package bundles import ( cosmossdk_io_math "cosmossdk.io/math" @@ -84,10 +84,10 @@ func (m *Params) GetMaxPoints() uint64 { } func init() { - proto.RegisterType((*Params)(nil), "kyve.bundles.v1beta1.Params") + proto.RegisterType((*Params)(nil), "kyve.bundles.legacy.Params") } -func init() { proto.RegisterFile("kyve/bundles/v1beta1/params.proto", fileDescriptor_cfd3a74b72a01aaa) } +func init() { proto.RegisterFile("kyve/bundles/legacy/params.proto", fileDescriptor_cfd3a74b72a01aaa) } var fileDescriptor_cfd3a74b72a01aaa = []byte{ // 300 bytes of a gzipped FileDescriptorProto diff --git a/app/upgrades/v1_5/v1_4_types/delegation/delegation.pb.go b/app/upgrades/v1_5/v1_4_types/delegation/delegation.pb.go new file mode 100644 index 00000000..812e72fc --- /dev/null +++ b/app/upgrades/v1_5/v1_4_types/delegation/delegation.pb.go @@ -0,0 +1,2121 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: kyve/delegation/legacy/delegation.proto + +package delegation + +import ( + cosmossdk_io_math "cosmossdk.io/math" + 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 + +// SlashType ... +type SlashType int32 + +const ( + // SLASH_TYPE_UNSPECIFIED ... + SLASH_TYPE_UNSPECIFIED SlashType = 0 + // SLASH_TYPE_TIMEOUT ... + SLASH_TYPE_TIMEOUT SlashType = 1 + // SLASH_TYPE_VOTE ... + SLASH_TYPE_VOTE SlashType = 2 + // SLASH_TYPE_UPLOAD ... + SLASH_TYPE_UPLOAD SlashType = 3 +) + +var SlashType_name = map[int32]string{ + 0: "SLASH_TYPE_UNSPECIFIED", + 1: "SLASH_TYPE_TIMEOUT", + 2: "SLASH_TYPE_VOTE", + 3: "SLASH_TYPE_UPLOAD", +} + +var SlashType_value = map[string]int32{ + "SLASH_TYPE_UNSPECIFIED": 0, + "SLASH_TYPE_TIMEOUT": 1, + "SLASH_TYPE_VOTE": 2, + "SLASH_TYPE_UPLOAD": 3, +} + +func (x SlashType) String() string { + return proto.EnumName(SlashType_name, int32(x)) +} + +func (SlashType) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_e07f10cb3da486ac, []int{0} +} + +// Delegator stores the information that one address has delegated to another address +// It stores important information for the F1-Fee distribution algorithm +type Delegator struct { + // staker corresponds to a KYVE-staker on the protocol-side + Staker string `protobuf:"bytes,1,opt,name=staker,proto3" json:"staker,omitempty"` + // delegator the user who delegate to the staker. + // If staker and delegator are the same we call it: self-delegation + Delegator string `protobuf:"bytes,2,opt,name=delegator,proto3" json:"delegator,omitempty"` + // k_index is an internal index for the f1-distribution algorithm + KIndex uint64 `protobuf:"varint,3,opt,name=k_index,json=kIndex,proto3" json:"k_index,omitempty"` + // initial_amount of stake the user had when it delegated. + // slashes can cause that the actual stake is lower. + InitialAmount uint64 `protobuf:"varint,4,opt,name=initial_amount,json=initialAmount,proto3" json:"initial_amount,omitempty"` +} + +func (m *Delegator) Reset() { *m = Delegator{} } +func (m *Delegator) String() string { return proto.CompactTextString(m) } +func (*Delegator) ProtoMessage() {} +func (*Delegator) Descriptor() ([]byte, []int) { + return fileDescriptor_e07f10cb3da486ac, []int{0} +} +func (m *Delegator) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Delegator) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Delegator.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 *Delegator) XXX_Merge(src proto.Message) { + xxx_messageInfo_Delegator.Merge(m, src) +} +func (m *Delegator) XXX_Size() int { + return m.Size() +} +func (m *Delegator) XXX_DiscardUnknown() { + xxx_messageInfo_Delegator.DiscardUnknown(m) +} + +var xxx_messageInfo_Delegator proto.InternalMessageInfo + +func (m *Delegator) GetStaker() string { + if m != nil { + return m.Staker + } + return "" +} + +func (m *Delegator) GetDelegator() string { + if m != nil { + return m.Delegator + } + return "" +} + +func (m *Delegator) GetKIndex() uint64 { + if m != nil { + return m.KIndex + } + return 0 +} + +func (m *Delegator) GetInitialAmount() uint64 { + if m != nil { + return m.InitialAmount + } + return 0 +} + +// DelegationEntry represents an entry according to the F1-Fee-Distribution algorithm. +// Take a look at x/delegation/keeper/logic_f1distribution.go for more details +type DelegationEntry struct { + // staker on protocol level + Staker string `protobuf:"bytes,1,opt,name=staker,proto3" json:"staker,omitempty"` + // k_index is the of the period this entry ends + KIndex uint64 `protobuf:"varint,2,opt,name=k_index,json=kIndex,proto3" json:"k_index,omitempty"` + // value is the quotient of collected rewards and total stake according to F1-distribution + Value cosmossdk_io_math.LegacyDec `protobuf:"bytes,3,opt,name=value,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"value"` +} + +func (m *DelegationEntry) Reset() { *m = DelegationEntry{} } +func (m *DelegationEntry) String() string { return proto.CompactTextString(m) } +func (*DelegationEntry) ProtoMessage() {} +func (*DelegationEntry) Descriptor() ([]byte, []int) { + return fileDescriptor_e07f10cb3da486ac, []int{1} +} +func (m *DelegationEntry) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *DelegationEntry) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_DelegationEntry.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 *DelegationEntry) XXX_Merge(src proto.Message) { + xxx_messageInfo_DelegationEntry.Merge(m, src) +} +func (m *DelegationEntry) XXX_Size() int { + return m.Size() +} +func (m *DelegationEntry) XXX_DiscardUnknown() { + xxx_messageInfo_DelegationEntry.DiscardUnknown(m) +} + +var xxx_messageInfo_DelegationEntry proto.InternalMessageInfo + +func (m *DelegationEntry) GetStaker() string { + if m != nil { + return m.Staker + } + return "" +} + +func (m *DelegationEntry) GetKIndex() uint64 { + if m != nil { + return m.KIndex + } + return 0 +} + +// DelegationPoolData stores general delegation information for every staker +type DelegationData struct { + // Every staker has one DelegationData + Staker string `protobuf:"bytes,1,opt,name=staker,proto3" json:"staker,omitempty"` + // current_rewards ... + CurrentRewards uint64 `protobuf:"varint,2,opt,name=current_rewards,json=currentRewards,proto3" json:"current_rewards,omitempty"` + // total_delegation ... + TotalDelegation uint64 `protobuf:"varint,3,opt,name=total_delegation,json=totalDelegation,proto3" json:"total_delegation,omitempty"` + // latest_index_k ... + LatestIndexK uint64 `protobuf:"varint,4,opt,name=latest_index_k,json=latestIndexK,proto3" json:"latest_index_k,omitempty"` + // delegator_count the amount of different addresses delegating to the staker + DelegatorCount uint64 `protobuf:"varint,5,opt,name=delegator_count,json=delegatorCount,proto3" json:"delegator_count,omitempty"` + // latest_index_was_undelegation helps indicates when an entry can be deleted + LatestIndexWasUndelegation bool `protobuf:"varint,6,opt,name=latest_index_was_undelegation,json=latestIndexWasUndelegation,proto3" json:"latest_index_was_undelegation,omitempty"` +} + +func (m *DelegationData) Reset() { *m = DelegationData{} } +func (m *DelegationData) String() string { return proto.CompactTextString(m) } +func (*DelegationData) ProtoMessage() {} +func (*DelegationData) Descriptor() ([]byte, []int) { + return fileDescriptor_e07f10cb3da486ac, []int{2} +} +func (m *DelegationData) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *DelegationData) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_DelegationData.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 *DelegationData) XXX_Merge(src proto.Message) { + xxx_messageInfo_DelegationData.Merge(m, src) +} +func (m *DelegationData) XXX_Size() int { + return m.Size() +} +func (m *DelegationData) XXX_DiscardUnknown() { + xxx_messageInfo_DelegationData.DiscardUnknown(m) +} + +var xxx_messageInfo_DelegationData proto.InternalMessageInfo + +func (m *DelegationData) GetStaker() string { + if m != nil { + return m.Staker + } + return "" +} + +func (m *DelegationData) GetCurrentRewards() uint64 { + if m != nil { + return m.CurrentRewards + } + return 0 +} + +func (m *DelegationData) GetTotalDelegation() uint64 { + if m != nil { + return m.TotalDelegation + } + return 0 +} + +func (m *DelegationData) GetLatestIndexK() uint64 { + if m != nil { + return m.LatestIndexK + } + return 0 +} + +func (m *DelegationData) GetDelegatorCount() uint64 { + if m != nil { + return m.DelegatorCount + } + return 0 +} + +func (m *DelegationData) GetLatestIndexWasUndelegation() bool { + if m != nil { + return m.LatestIndexWasUndelegation + } + return false +} + +// DelegationSlash represents an f1-slash +// these entries needs to be iterated to obtain the current amount of the actual stake +// Every staker can have n slash-entries +type DelegationSlash struct { + // staker who got slashed + Staker string `protobuf:"bytes,1,opt,name=staker,proto3" json:"staker,omitempty"` + // k_index for f1-algorithm + KIndex uint64 `protobuf:"varint,2,opt,name=k_index,json=kIndex,proto3" json:"k_index,omitempty"` + // fraction that got slashed + Fraction cosmossdk_io_math.LegacyDec `protobuf:"bytes,3,opt,name=fraction,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"fraction"` +} + +func (m *DelegationSlash) Reset() { *m = DelegationSlash{} } +func (m *DelegationSlash) String() string { return proto.CompactTextString(m) } +func (*DelegationSlash) ProtoMessage() {} +func (*DelegationSlash) Descriptor() ([]byte, []int) { + return fileDescriptor_e07f10cb3da486ac, []int{3} +} +func (m *DelegationSlash) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *DelegationSlash) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_DelegationSlash.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 *DelegationSlash) XXX_Merge(src proto.Message) { + xxx_messageInfo_DelegationSlash.Merge(m, src) +} +func (m *DelegationSlash) XXX_Size() int { + return m.Size() +} +func (m *DelegationSlash) XXX_DiscardUnknown() { + xxx_messageInfo_DelegationSlash.DiscardUnknown(m) +} + +var xxx_messageInfo_DelegationSlash proto.InternalMessageInfo + +func (m *DelegationSlash) GetStaker() string { + if m != nil { + return m.Staker + } + return "" +} + +func (m *DelegationSlash) GetKIndex() uint64 { + if m != nil { + return m.KIndex + } + return 0 +} + +// UndelegationQueueEntry ... +type UndelegationQueueEntry struct { + // index ... + Index uint64 `protobuf:"varint,1,opt,name=index,proto3" json:"index,omitempty"` + // staker ... + Staker string `protobuf:"bytes,2,opt,name=staker,proto3" json:"staker,omitempty"` + // delegator ... + Delegator string `protobuf:"bytes,3,opt,name=delegator,proto3" json:"delegator,omitempty"` + // amount ... + Amount uint64 `protobuf:"varint,4,opt,name=amount,proto3" json:"amount,omitempty"` + // creation_time ... + CreationTime uint64 `protobuf:"varint,5,opt,name=creation_time,json=creationTime,proto3" json:"creation_time,omitempty"` +} + +func (m *UndelegationQueueEntry) Reset() { *m = UndelegationQueueEntry{} } +func (m *UndelegationQueueEntry) String() string { return proto.CompactTextString(m) } +func (*UndelegationQueueEntry) ProtoMessage() {} +func (*UndelegationQueueEntry) Descriptor() ([]byte, []int) { + return fileDescriptor_e07f10cb3da486ac, []int{4} +} +func (m *UndelegationQueueEntry) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *UndelegationQueueEntry) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_UndelegationQueueEntry.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 *UndelegationQueueEntry) XXX_Merge(src proto.Message) { + xxx_messageInfo_UndelegationQueueEntry.Merge(m, src) +} +func (m *UndelegationQueueEntry) XXX_Size() int { + return m.Size() +} +func (m *UndelegationQueueEntry) XXX_DiscardUnknown() { + xxx_messageInfo_UndelegationQueueEntry.DiscardUnknown(m) +} + +var xxx_messageInfo_UndelegationQueueEntry proto.InternalMessageInfo + +func (m *UndelegationQueueEntry) GetIndex() uint64 { + if m != nil { + return m.Index + } + return 0 +} + +func (m *UndelegationQueueEntry) GetStaker() string { + if m != nil { + return m.Staker + } + return "" +} + +func (m *UndelegationQueueEntry) GetDelegator() string { + if m != nil { + return m.Delegator + } + return "" +} + +func (m *UndelegationQueueEntry) GetAmount() uint64 { + if m != nil { + return m.Amount + } + return 0 +} + +func (m *UndelegationQueueEntry) GetCreationTime() uint64 { + if m != nil { + return m.CreationTime + } + return 0 +} + +// QueueState ... +type QueueState struct { + // low_index ... + LowIndex uint64 `protobuf:"varint,1,opt,name=low_index,json=lowIndex,proto3" json:"low_index,omitempty"` + // high_index ... + HighIndex uint64 `protobuf:"varint,2,opt,name=high_index,json=highIndex,proto3" json:"high_index,omitempty"` +} + +func (m *QueueState) Reset() { *m = QueueState{} } +func (m *QueueState) String() string { return proto.CompactTextString(m) } +func (*QueueState) ProtoMessage() {} +func (*QueueState) Descriptor() ([]byte, []int) { + return fileDescriptor_e07f10cb3da486ac, []int{5} +} +func (m *QueueState) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueueState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueueState.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 *QueueState) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueueState.Merge(m, src) +} +func (m *QueueState) XXX_Size() int { + return m.Size() +} +func (m *QueueState) XXX_DiscardUnknown() { + xxx_messageInfo_QueueState.DiscardUnknown(m) +} + +var xxx_messageInfo_QueueState proto.InternalMessageInfo + +func (m *QueueState) GetLowIndex() uint64 { + if m != nil { + return m.LowIndex + } + return 0 +} + +func (m *QueueState) GetHighIndex() uint64 { + if m != nil { + return m.HighIndex + } + return 0 +} + +// RedelegationCooldown ... +type RedelegationCooldown struct { + // low_index ... + Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` + // high_index ... + CreationDate uint64 `protobuf:"varint,2,opt,name=creation_date,json=creationDate,proto3" json:"creation_date,omitempty"` +} + +func (m *RedelegationCooldown) Reset() { *m = RedelegationCooldown{} } +func (m *RedelegationCooldown) String() string { return proto.CompactTextString(m) } +func (*RedelegationCooldown) ProtoMessage() {} +func (*RedelegationCooldown) Descriptor() ([]byte, []int) { + return fileDescriptor_e07f10cb3da486ac, []int{6} +} +func (m *RedelegationCooldown) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *RedelegationCooldown) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_RedelegationCooldown.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 *RedelegationCooldown) XXX_Merge(src proto.Message) { + xxx_messageInfo_RedelegationCooldown.Merge(m, src) +} +func (m *RedelegationCooldown) XXX_Size() int { + return m.Size() +} +func (m *RedelegationCooldown) XXX_DiscardUnknown() { + xxx_messageInfo_RedelegationCooldown.DiscardUnknown(m) +} + +var xxx_messageInfo_RedelegationCooldown proto.InternalMessageInfo + +func (m *RedelegationCooldown) GetAddress() string { + if m != nil { + return m.Address + } + return "" +} + +func (m *RedelegationCooldown) GetCreationDate() uint64 { + if m != nil { + return m.CreationDate + } + return 0 +} + +func init() { + proto.RegisterEnum("kyve.delegation.legacy.SlashType", SlashType_name, SlashType_value) + proto.RegisterType((*Delegator)(nil), "kyve.delegation.legacy.Delegator") + proto.RegisterType((*DelegationEntry)(nil), "kyve.delegation.legacy.DelegationEntry") + proto.RegisterType((*DelegationData)(nil), "kyve.delegation.legacy.DelegationData") + proto.RegisterType((*DelegationSlash)(nil), "kyve.delegation.legacy.DelegationSlash") + proto.RegisterType((*UndelegationQueueEntry)(nil), "kyve.delegation.legacy.UndelegationQueueEntry") + proto.RegisterType((*QueueState)(nil), "kyve.delegation.legacy.QueueState") + proto.RegisterType((*RedelegationCooldown)(nil), "kyve.delegation.legacy.RedelegationCooldown") +} + +func init() { + proto.RegisterFile("kyve/delegation/legacy/delegation.proto", fileDescriptor_e07f10cb3da486ac) +} + +var fileDescriptor_e07f10cb3da486ac = []byte{ + // 664 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x54, 0x4d, 0x4f, 0xdb, 0x40, + 0x10, 0x8d, 0x03, 0x04, 0x3c, 0x82, 0x24, 0xdd, 0xd2, 0x10, 0x85, 0x62, 0x90, 0x69, 0xd5, 0xb4, + 0x87, 0x58, 0xa8, 0xa7, 0x9e, 0xaa, 0x80, 0x5d, 0x11, 0x41, 0x81, 0xe6, 0x83, 0x8a, 0x5e, 0xac, + 0xc5, 0xde, 0x26, 0x96, 0x1d, 0x2f, 0xb5, 0xd7, 0x84, 0x1c, 0x7a, 0xa8, 0x7a, 0xe9, 0xa9, 0xea, + 0x5f, 0xa8, 0xfa, 0x67, 0x38, 0x72, 0xac, 0x7a, 0x40, 0x15, 0xfc, 0x91, 0x2a, 0x6b, 0xe3, 0x6c, + 0x2a, 0x45, 0x6a, 0x6f, 0x9e, 0x37, 0xe3, 0x79, 0x6f, 0xde, 0x8c, 0x16, 0xaa, 0xee, 0xf0, 0x9c, + 0x68, 0x36, 0xf1, 0x48, 0x17, 0x33, 0x87, 0xfa, 0xda, 0xf9, 0xd6, 0x29, 0x61, 0x78, 0x4b, 0x80, + 0x6a, 0x67, 0x01, 0x65, 0x14, 0xad, 0x8c, 0x2a, 0x6b, 0x02, 0x9c, 0x54, 0x56, 0x96, 0xbb, 0xb4, + 0x4b, 0x79, 0x8d, 0x36, 0xfa, 0x8a, 0xcb, 0xd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13, 0xe3, 0xef, 0xc2, 0x09, 0x81, 0x36, 0x66, 0x24, 0xe9, 0x99, + 0x0a, 0xd4, 0x31, 0x23, 0xcf, 0x3e, 0x80, 0xcc, 0xf7, 0xd7, 0x1e, 0x9e, 0x11, 0x54, 0x81, 0x52, + 0x6b, 0xbf, 0xde, 0xda, 0x35, 0xdb, 0x27, 0x47, 0x86, 0xd9, 0x39, 0x68, 0x1d, 0x19, 0x3b, 0x8d, + 0x57, 0x0d, 0x43, 0x2f, 0x66, 0x50, 0x09, 0x90, 0x90, 0x6b, 0x37, 0x5e, 0x1b, 0x87, 0x9d, 0x76, + 0x51, 0x42, 0xf7, 0xa1, 0x20, 0xe0, 0xc7, 0x87, 0x6d, 0xa3, 0x98, 0x45, 0x0f, 0xe0, 0x9e, 0xd8, + 0xe8, 0x68, 0xff, 0xb0, 0xae, 0x17, 0x67, 0x2a, 0xb3, 0x5f, 0x7e, 0x28, 0x99, 0xed, 0xc6, 0xe5, + 0x8d, 0x22, 0x5d, 0xdd, 0x28, 0xd2, 0xef, 0x1b, 0x45, 0xfa, 0x76, 0xab, 0x64, 0xae, 0x6e, 0x95, + 0xcc, 0xcf, 0x5b, 0x25, 0xf3, 0x4e, 0xeb, 0x3a, 0xac, 0x17, 0x9d, 0xd6, 0x2c, 0xda, 0xd7, 0xf6, + 0x4e, 0x8e, 0x8d, 0x03, 0xc2, 0x06, 0x34, 0x70, 0x35, 0xab, 0x87, 0x1d, 0x5f, 0xbb, 0x10, 0x9f, + 0x37, 0x36, 0x3c, 0x23, 0xe1, 0x69, 0x8e, 0xbf, 0x51, 0xcf, 0xff, 0x04, 0x00, 0x00, 0xff, 0xff, + 0x71, 0xb7, 0xbb, 0xf9, 0xfe, 0x04, 0x00, 0x00, +} + +func (m *Delegator) 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 *Delegator) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Delegator) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.InitialAmount != 0 { + i = encodeVarintDelegation(dAtA, i, uint64(m.InitialAmount)) + i-- + dAtA[i] = 0x20 + } + if m.KIndex != 0 { + i = encodeVarintDelegation(dAtA, i, uint64(m.KIndex)) + i-- + dAtA[i] = 0x18 + } + if len(m.Delegator) > 0 { + i -= len(m.Delegator) + copy(dAtA[i:], m.Delegator) + i = encodeVarintDelegation(dAtA, i, uint64(len(m.Delegator))) + i-- + dAtA[i] = 0x12 + } + if len(m.Staker) > 0 { + i -= len(m.Staker) + copy(dAtA[i:], m.Staker) + i = encodeVarintDelegation(dAtA, i, uint64(len(m.Staker))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *DelegationEntry) 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 *DelegationEntry) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *DelegationEntry) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size := m.Value.Size() + i -= size + if _, err := m.Value.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintDelegation(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + if m.KIndex != 0 { + i = encodeVarintDelegation(dAtA, i, uint64(m.KIndex)) + i-- + dAtA[i] = 0x10 + } + if len(m.Staker) > 0 { + i -= len(m.Staker) + copy(dAtA[i:], m.Staker) + i = encodeVarintDelegation(dAtA, i, uint64(len(m.Staker))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *DelegationData) 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 *DelegationData) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *DelegationData) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.LatestIndexWasUndelegation { + i-- + if m.LatestIndexWasUndelegation { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x30 + } + if m.DelegatorCount != 0 { + i = encodeVarintDelegation(dAtA, i, uint64(m.DelegatorCount)) + i-- + dAtA[i] = 0x28 + } + if m.LatestIndexK != 0 { + i = encodeVarintDelegation(dAtA, i, uint64(m.LatestIndexK)) + i-- + dAtA[i] = 0x20 + } + if m.TotalDelegation != 0 { + i = encodeVarintDelegation(dAtA, i, uint64(m.TotalDelegation)) + i-- + dAtA[i] = 0x18 + } + if m.CurrentRewards != 0 { + i = encodeVarintDelegation(dAtA, i, uint64(m.CurrentRewards)) + i-- + dAtA[i] = 0x10 + } + if len(m.Staker) > 0 { + i -= len(m.Staker) + copy(dAtA[i:], m.Staker) + i = encodeVarintDelegation(dAtA, i, uint64(len(m.Staker))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *DelegationSlash) 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 *DelegationSlash) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *DelegationSlash) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size := m.Fraction.Size() + i -= size + if _, err := m.Fraction.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintDelegation(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + if m.KIndex != 0 { + i = encodeVarintDelegation(dAtA, i, uint64(m.KIndex)) + i-- + dAtA[i] = 0x10 + } + if len(m.Staker) > 0 { + i -= len(m.Staker) + copy(dAtA[i:], m.Staker) + i = encodeVarintDelegation(dAtA, i, uint64(len(m.Staker))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *UndelegationQueueEntry) 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 *UndelegationQueueEntry) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *UndelegationQueueEntry) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.CreationTime != 0 { + i = encodeVarintDelegation(dAtA, i, uint64(m.CreationTime)) + i-- + dAtA[i] = 0x28 + } + if m.Amount != 0 { + i = encodeVarintDelegation(dAtA, i, uint64(m.Amount)) + i-- + dAtA[i] = 0x20 + } + if len(m.Delegator) > 0 { + i -= len(m.Delegator) + copy(dAtA[i:], m.Delegator) + i = encodeVarintDelegation(dAtA, i, uint64(len(m.Delegator))) + i-- + dAtA[i] = 0x1a + } + if len(m.Staker) > 0 { + i -= len(m.Staker) + copy(dAtA[i:], m.Staker) + i = encodeVarintDelegation(dAtA, i, uint64(len(m.Staker))) + i-- + dAtA[i] = 0x12 + } + if m.Index != 0 { + i = encodeVarintDelegation(dAtA, i, uint64(m.Index)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *QueueState) 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 *QueueState) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueueState) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.HighIndex != 0 { + i = encodeVarintDelegation(dAtA, i, uint64(m.HighIndex)) + i-- + dAtA[i] = 0x10 + } + if m.LowIndex != 0 { + i = encodeVarintDelegation(dAtA, i, uint64(m.LowIndex)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *RedelegationCooldown) 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 *RedelegationCooldown) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *RedelegationCooldown) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.CreationDate != 0 { + i = encodeVarintDelegation(dAtA, i, uint64(m.CreationDate)) + i-- + dAtA[i] = 0x10 + } + if len(m.Address) > 0 { + i -= len(m.Address) + copy(dAtA[i:], m.Address) + i = encodeVarintDelegation(dAtA, i, uint64(len(m.Address))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintDelegation(dAtA []byte, offset int, v uint64) int { + offset -= sovDelegation(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *Delegator) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Staker) + if l > 0 { + n += 1 + l + sovDelegation(uint64(l)) + } + l = len(m.Delegator) + if l > 0 { + n += 1 + l + sovDelegation(uint64(l)) + } + if m.KIndex != 0 { + n += 1 + sovDelegation(uint64(m.KIndex)) + } + if m.InitialAmount != 0 { + n += 1 + sovDelegation(uint64(m.InitialAmount)) + } + return n +} + +func (m *DelegationEntry) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Staker) + if l > 0 { + n += 1 + l + sovDelegation(uint64(l)) + } + if m.KIndex != 0 { + n += 1 + sovDelegation(uint64(m.KIndex)) + } + l = m.Value.Size() + n += 1 + l + sovDelegation(uint64(l)) + return n +} + +func (m *DelegationData) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Staker) + if l > 0 { + n += 1 + l + sovDelegation(uint64(l)) + } + if m.CurrentRewards != 0 { + n += 1 + sovDelegation(uint64(m.CurrentRewards)) + } + if m.TotalDelegation != 0 { + n += 1 + sovDelegation(uint64(m.TotalDelegation)) + } + if m.LatestIndexK != 0 { + n += 1 + sovDelegation(uint64(m.LatestIndexK)) + } + if m.DelegatorCount != 0 { + n += 1 + sovDelegation(uint64(m.DelegatorCount)) + } + if m.LatestIndexWasUndelegation { + n += 2 + } + return n +} + +func (m *DelegationSlash) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Staker) + if l > 0 { + n += 1 + l + sovDelegation(uint64(l)) + } + if m.KIndex != 0 { + n += 1 + sovDelegation(uint64(m.KIndex)) + } + l = m.Fraction.Size() + n += 1 + l + sovDelegation(uint64(l)) + return n +} + +func (m *UndelegationQueueEntry) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Index != 0 { + n += 1 + sovDelegation(uint64(m.Index)) + } + l = len(m.Staker) + if l > 0 { + n += 1 + l + sovDelegation(uint64(l)) + } + l = len(m.Delegator) + if l > 0 { + n += 1 + l + sovDelegation(uint64(l)) + } + if m.Amount != 0 { + n += 1 + sovDelegation(uint64(m.Amount)) + } + if m.CreationTime != 0 { + n += 1 + sovDelegation(uint64(m.CreationTime)) + } + return n +} + +func (m *QueueState) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.LowIndex != 0 { + n += 1 + sovDelegation(uint64(m.LowIndex)) + } + if m.HighIndex != 0 { + n += 1 + sovDelegation(uint64(m.HighIndex)) + } + return n +} + +func (m *RedelegationCooldown) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Address) + if l > 0 { + n += 1 + l + sovDelegation(uint64(l)) + } + if m.CreationDate != 0 { + n += 1 + sovDelegation(uint64(m.CreationDate)) + } + return n +} + +func sovDelegation(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozDelegation(x uint64) (n int) { + return sovDelegation(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Delegator) 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 ErrIntOverflowDelegation + } + 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: Delegator: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Delegator: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + 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 ErrIntOverflowDelegation + } + 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 ErrInvalidLengthDelegation + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthDelegation + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Staker = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Delegator", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDelegation + } + 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 ErrInvalidLengthDelegation + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthDelegation + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Delegator = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field KIndex", wireType) + } + m.KIndex = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDelegation + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.KIndex |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field InitialAmount", wireType) + } + m.InitialAmount = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDelegation + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.InitialAmount |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipDelegation(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthDelegation + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *DelegationEntry) 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 ErrIntOverflowDelegation + } + 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: DelegationEntry: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DelegationEntry: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + 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 ErrIntOverflowDelegation + } + 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 ErrInvalidLengthDelegation + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthDelegation + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Staker = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field KIndex", wireType) + } + m.KIndex = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDelegation + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.KIndex |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDelegation + } + 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 ErrInvalidLengthDelegation + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthDelegation + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Value.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipDelegation(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthDelegation + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *DelegationData) 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 ErrIntOverflowDelegation + } + 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: DelegationData: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DelegationData: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + 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 ErrIntOverflowDelegation + } + 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 ErrInvalidLengthDelegation + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthDelegation + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Staker = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field CurrentRewards", wireType) + } + m.CurrentRewards = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDelegation + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.CurrentRewards |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TotalDelegation", wireType) + } + m.TotalDelegation = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDelegation + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.TotalDelegation |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field LatestIndexK", wireType) + } + m.LatestIndexK = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDelegation + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.LatestIndexK |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field DelegatorCount", wireType) + } + m.DelegatorCount = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDelegation + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.DelegatorCount |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field LatestIndexWasUndelegation", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDelegation + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.LatestIndexWasUndelegation = bool(v != 0) + default: + iNdEx = preIndex + skippy, err := skipDelegation(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthDelegation + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *DelegationSlash) 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 ErrIntOverflowDelegation + } + 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: DelegationSlash: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DelegationSlash: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + 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 ErrIntOverflowDelegation + } + 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 ErrInvalidLengthDelegation + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthDelegation + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Staker = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field KIndex", wireType) + } + m.KIndex = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDelegation + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.KIndex |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Fraction", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDelegation + } + 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 ErrInvalidLengthDelegation + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthDelegation + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Fraction.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipDelegation(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthDelegation + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *UndelegationQueueEntry) 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 ErrIntOverflowDelegation + } + 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: UndelegationQueueEntry: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: UndelegationQueueEntry: 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 ErrIntOverflowDelegation + } + 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 ErrIntOverflowDelegation + } + 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 ErrInvalidLengthDelegation + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthDelegation + } + 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 Delegator", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDelegation + } + 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 ErrInvalidLengthDelegation + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthDelegation + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Delegator = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + } + m.Amount = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDelegation + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Amount |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field CreationTime", wireType) + } + m.CreationTime = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDelegation + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.CreationTime |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipDelegation(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthDelegation + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueueState) 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 ErrIntOverflowDelegation + } + 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: QueueState: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueueState: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field LowIndex", wireType) + } + m.LowIndex = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDelegation + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.LowIndex |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field HighIndex", wireType) + } + m.HighIndex = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDelegation + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.HighIndex |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipDelegation(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthDelegation + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *RedelegationCooldown) 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 ErrIntOverflowDelegation + } + 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: RedelegationCooldown: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RedelegationCooldown: 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 ErrIntOverflowDelegation + } + 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 ErrInvalidLengthDelegation + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthDelegation + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Address = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + 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 ErrIntOverflowDelegation + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.CreationDate |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipDelegation(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthDelegation + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipDelegation(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, ErrIntOverflowDelegation + } + 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, ErrIntOverflowDelegation + } + 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, ErrIntOverflowDelegation + } + 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, ErrInvalidLengthDelegation + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupDelegation + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthDelegation + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthDelegation = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowDelegation = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupDelegation = fmt.Errorf("proto: unexpected end of group") +) diff --git a/app/upgrades/v1_5/v1_4_types/delegation/getters_delegation.go b/app/upgrades/v1_5/v1_4_types/delegation/getters_delegation.go new file mode 100644 index 00000000..79e120a8 --- /dev/null +++ b/app/upgrades/v1_5/v1_4_types/delegation/getters_delegation.go @@ -0,0 +1,41 @@ +package delegation + +import ( + "cosmossdk.io/store/prefix" + storeTypes "cosmossdk.io/store/types" + delegationTypes "github.com/KYVENetwork/chain/x/delegation/types" + "github.com/cosmos/cosmos-sdk/codec" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +func GetAllDelegationEntries(ctx sdk.Context, cdc codec.Codec, storeKey storeTypes.StoreKey) (list []DelegationEntry) { + store := prefix.NewStore(ctx.KVStore(storeKey), delegationTypes.DelegationEntriesKeyPrefix) + + iterator := storeTypes.KVStorePrefixIterator(store, []byte{}) + + defer iterator.Close() + + for ; iterator.Valid(); iterator.Next() { + var val DelegationEntry + cdc.MustUnmarshal(iterator.Value(), &val) + list = append(list, val) + } + + return +} + +// GetAllDelegationData returns all delegationData entries +func GetAllDelegationData(ctx sdk.Context, cdc codec.Codec, storeKey storeTypes.StoreKey) (list []DelegationData) { + store := prefix.NewStore(ctx.KVStore(storeKey), delegationTypes.DelegationDataKeyPrefix) + + iterator := storeTypes.KVStorePrefixIterator(store, []byte{}) + defer iterator.Close() + + for ; iterator.Valid(); iterator.Next() { + var val DelegationData + cdc.MustUnmarshal(iterator.Value(), &val) + list = append(list, val) + } + + return +} diff --git a/app/upgrades/v1_5/v1_4_types/funders/funders.pb.go b/app/upgrades/v1_5/v1_4_types/funders/funders.pb.go new file mode 100644 index 00000000..4fae8e43 --- /dev/null +++ b/app/upgrades/v1_5/v1_4_types/funders/funders.pb.go @@ -0,0 +1,1124 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: kyve/funders/legacy/funders.proto + +package funders + +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 + +// Funder is the object which holds info about a single pool funder +type Funder struct { + // address ... + Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` + // moniker ... + Moniker string `protobuf:"bytes,2,opt,name=moniker,proto3" json:"moniker,omitempty"` + // identity is the 64 bit keybase.io identity string + Identity string `protobuf:"bytes,3,opt,name=identity,proto3" json:"identity,omitempty"` + // website ... + Website string `protobuf:"bytes,4,opt,name=website,proto3" json:"website,omitempty"` + // contact ... + Contact string `protobuf:"bytes,5,opt,name=contact,proto3" json:"contact,omitempty"` + // description are some additional notes the funder finds important + Description string `protobuf:"bytes,6,opt,name=description,proto3" json:"description,omitempty"` +} + +func (m *Funder) Reset() { *m = Funder{} } +func (m *Funder) String() string { return proto.CompactTextString(m) } +func (*Funder) ProtoMessage() {} +func (*Funder) Descriptor() ([]byte, []int) { + return fileDescriptor_252d80f89b0fa299, []int{0} +} +func (m *Funder) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Funder) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Funder.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 *Funder) XXX_Merge(src proto.Message) { + xxx_messageInfo_Funder.Merge(m, src) +} +func (m *Funder) XXX_Size() int { + return m.Size() +} +func (m *Funder) XXX_DiscardUnknown() { + xxx_messageInfo_Funder.DiscardUnknown(m) +} + +var xxx_messageInfo_Funder proto.InternalMessageInfo + +func (m *Funder) GetAddress() string { + if m != nil { + return m.Address + } + return "" +} + +func (m *Funder) GetMoniker() string { + if m != nil { + return m.Moniker + } + return "" +} + +func (m *Funder) GetIdentity() string { + if m != nil { + return m.Identity + } + return "" +} + +func (m *Funder) GetWebsite() string { + if m != nil { + return m.Website + } + return "" +} + +func (m *Funder) GetContact() string { + if m != nil { + return m.Contact + } + return "" +} + +func (m *Funder) GetDescription() string { + if m != nil { + return m.Description + } + return "" +} + +// Funding is the object which holds info about the current funding +// funder_address and pool_id (m2m) are unique together which means that +// a funder can only fund each pool once and a pool can only be funded +// by each funder once. However, a funder can update the amount of funds. +type Funding struct { + // funder_id is the id of the funder + FunderAddress string `protobuf:"bytes,1,opt,name=funder_address,json=funderAddress,proto3" json:"funder_address,omitempty"` + // pool_id is the id of the pool this funding is for + PoolId uint64 `protobuf:"varint,2,opt,name=pool_id,json=poolId,proto3" json:"pool_id,omitempty"` + // amount is the amount of funds in ukyve the funder has left + Amount uint64 `protobuf:"varint,3,opt,name=amount,proto3" json:"amount,omitempty"` + // amount_per_bundle is the amount of funds in ukyve the funder pays per bundle + AmountPerBundle uint64 `protobuf:"varint,4,opt,name=amount_per_bundle,json=amountPerBundle,proto3" json:"amount_per_bundle,omitempty"` + // total_funded is the total amount of funds in ukyve the funder has funded + TotalFunded uint64 `protobuf:"varint,5,opt,name=total_funded,json=totalFunded,proto3" json:"total_funded,omitempty"` +} + +func (m *Funding) Reset() { *m = Funding{} } +func (m *Funding) String() string { return proto.CompactTextString(m) } +func (*Funding) ProtoMessage() {} +func (*Funding) Descriptor() ([]byte, []int) { + return fileDescriptor_252d80f89b0fa299, []int{1} +} +func (m *Funding) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Funding) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Funding.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 *Funding) XXX_Merge(src proto.Message) { + xxx_messageInfo_Funding.Merge(m, src) +} +func (m *Funding) XXX_Size() int { + return m.Size() +} +func (m *Funding) XXX_DiscardUnknown() { + xxx_messageInfo_Funding.DiscardUnknown(m) +} + +var xxx_messageInfo_Funding proto.InternalMessageInfo + +func (m *Funding) GetFunderAddress() string { + if m != nil { + return m.FunderAddress + } + return "" +} + +func (m *Funding) GetPoolId() uint64 { + if m != nil { + return m.PoolId + } + return 0 +} + +func (m *Funding) GetAmount() uint64 { + if m != nil { + return m.Amount + } + return 0 +} + +func (m *Funding) GetAmountPerBundle() uint64 { + if m != nil { + return m.AmountPerBundle + } + return 0 +} + +func (m *Funding) GetTotalFunded() uint64 { + if m != nil { + return m.TotalFunded + } + return 0 +} + +// FundingState is the object which holds info about the funding state of a pool +type FundingState struct { + // pool_id is the id of the pool this funding is for + PoolId uint64 `protobuf:"varint,1,opt,name=pool_id,json=poolId,proto3" json:"pool_id,omitempty"` + // active_funder_addresses is the list of all active fundings + ActiveFunderAddresses []string `protobuf:"bytes,2,rep,name=active_funder_addresses,json=activeFunderAddresses,proto3" json:"active_funder_addresses,omitempty"` +} + +func (m *FundingState) Reset() { *m = FundingState{} } +func (m *FundingState) String() string { return proto.CompactTextString(m) } +func (*FundingState) ProtoMessage() {} +func (*FundingState) Descriptor() ([]byte, []int) { + return fileDescriptor_252d80f89b0fa299, []int{2} +} +func (m *FundingState) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *FundingState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_FundingState.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 *FundingState) XXX_Merge(src proto.Message) { + xxx_messageInfo_FundingState.Merge(m, src) +} +func (m *FundingState) XXX_Size() int { + return m.Size() +} +func (m *FundingState) XXX_DiscardUnknown() { + xxx_messageInfo_FundingState.DiscardUnknown(m) +} + +var xxx_messageInfo_FundingState proto.InternalMessageInfo + +func (m *FundingState) GetPoolId() uint64 { + if m != nil { + return m.PoolId + } + return 0 +} + +func (m *FundingState) GetActiveFunderAddresses() []string { + if m != nil { + return m.ActiveFunderAddresses + } + return nil +} + +func init() { + proto.RegisterType((*Funder)(nil), "kyve.funders.legacy.Funder") + proto.RegisterType((*Funding)(nil), "kyve.funders.legacy.Funding") + proto.RegisterType((*FundingState)(nil), "kyve.funders.legacy.FundingState") +} + +func init() { + proto.RegisterFile("kyve/funders/legacy/funders.proto", fileDescriptor_252d80f89b0fa299) +} + +var fileDescriptor_252d80f89b0fa299 = []byte{ + // 386 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x54, 0x92, 0xd1, 0x8a, 0xd3, 0x40, + 0x14, 0x86, 0x3b, 0xbb, 0x31, 0x75, 0x67, 0x57, 0xc5, 0x41, 0xdd, 0xc1, 0x8b, 0x50, 0x03, 0xc2, + 0x22, 0xd2, 0xb0, 0x08, 0xde, 0x5b, 0xb0, 0x20, 0x82, 0x48, 0x04, 0x41, 0x6f, 0xc2, 0x24, 0x73, + 0x6c, 0x87, 0xb6, 0x33, 0x61, 0xe6, 0xa4, 0xb5, 0x6f, 0xe1, 0x93, 0x88, 0x8f, 0xe1, 0x65, 0x2f, + 0xbd, 0x94, 0xf6, 0x45, 0x96, 0xcc, 0xa4, 0xa5, 0xbd, 0xcb, 0xff, 0xff, 0xe7, 0x90, 0xef, 0x1f, + 0x0e, 0x4d, 0x67, 0xeb, 0x25, 0x64, 0x3f, 0x1a, 0x2d, 0xc1, 0xba, 0x6c, 0x79, 0x5b, 0x02, 0x8a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0x69, 0x41, 0xaf, 0x3a, 0xe2, 0x2f, 0x28, 0x10, 0x8e, 0x79, 0xc8, + 0x09, 0xcf, 0x5b, 0x7a, 0x2d, 0x2a, 0x54, 0x4b, 0x28, 0x4e, 0x6b, 0x81, 0xe3, 0x67, 0x83, 0xf3, + 0x9b, 0x8b, 0xfc, 0x69, 0x88, 0xc7, 0xc7, 0xf5, 0xc0, 0x8d, 0xc6, 0x7f, 0xb7, 0x09, 0xd9, 0x6c, + 0x13, 0xf2, 0x7f, 0x9b, 0x90, 0x5f, 0xbb, 0xa4, 0xb7, 0xd9, 0x25, 0xbd, 0x7f, 0xbb, 0xa4, 0xf7, + 0xfd, 0xf5, 0x44, 0xe1, 0xb4, 0x29, 0x87, 0x95, 0x59, 0x64, 0x1f, 0xbf, 0x7d, 0x7d, 0xff, 0x09, + 0x70, 0x65, 0xec, 0x2c, 0xab, 0xa6, 0x42, 0xe9, 0xec, 0xe7, 0xe1, 0x64, 0x70, 0x5d, 0x83, 0x2b, + 0x63, 0x7f, 0x29, 0x6f, 0xee, 0x02, 0x00, 0x00, 0xff, 0xff, 0xf6, 0x1c, 0xef, 0x4f, 0x4f, 0x02, + 0x00, 0x00, +} + +func (m *Funder) 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 *Funder) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Funder) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Description) > 0 { + i -= len(m.Description) + copy(dAtA[i:], m.Description) + i = encodeVarintFunders(dAtA, i, uint64(len(m.Description))) + i-- + dAtA[i] = 0x32 + } + if len(m.Contact) > 0 { + i -= len(m.Contact) + copy(dAtA[i:], m.Contact) + i = encodeVarintFunders(dAtA, i, uint64(len(m.Contact))) + i-- + dAtA[i] = 0x2a + } + if len(m.Website) > 0 { + i -= len(m.Website) + copy(dAtA[i:], m.Website) + i = encodeVarintFunders(dAtA, i, uint64(len(m.Website))) + i-- + dAtA[i] = 0x22 + } + if len(m.Identity) > 0 { + i -= len(m.Identity) + copy(dAtA[i:], m.Identity) + i = encodeVarintFunders(dAtA, i, uint64(len(m.Identity))) + i-- + dAtA[i] = 0x1a + } + if len(m.Moniker) > 0 { + i -= len(m.Moniker) + copy(dAtA[i:], m.Moniker) + i = encodeVarintFunders(dAtA, i, uint64(len(m.Moniker))) + i-- + dAtA[i] = 0x12 + } + if len(m.Address) > 0 { + i -= len(m.Address) + copy(dAtA[i:], m.Address) + i = encodeVarintFunders(dAtA, i, uint64(len(m.Address))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Funding) 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 *Funding) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Funding) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.TotalFunded != 0 { + i = encodeVarintFunders(dAtA, i, uint64(m.TotalFunded)) + i-- + dAtA[i] = 0x28 + } + if m.AmountPerBundle != 0 { + i = encodeVarintFunders(dAtA, i, uint64(m.AmountPerBundle)) + i-- + dAtA[i] = 0x20 + } + if m.Amount != 0 { + i = encodeVarintFunders(dAtA, i, uint64(m.Amount)) + i-- + dAtA[i] = 0x18 + } + if m.PoolId != 0 { + i = encodeVarintFunders(dAtA, i, uint64(m.PoolId)) + i-- + dAtA[i] = 0x10 + } + if len(m.FunderAddress) > 0 { + i -= len(m.FunderAddress) + copy(dAtA[i:], m.FunderAddress) + i = encodeVarintFunders(dAtA, i, uint64(len(m.FunderAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *FundingState) 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 *FundingState) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *FundingState) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.ActiveFunderAddresses) > 0 { + for iNdEx := len(m.ActiveFunderAddresses) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.ActiveFunderAddresses[iNdEx]) + copy(dAtA[i:], m.ActiveFunderAddresses[iNdEx]) + i = encodeVarintFunders(dAtA, i, uint64(len(m.ActiveFunderAddresses[iNdEx]))) + i-- + dAtA[i] = 0x12 + } + } + if m.PoolId != 0 { + i = encodeVarintFunders(dAtA, i, uint64(m.PoolId)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func encodeVarintFunders(dAtA []byte, offset int, v uint64) int { + offset -= sovFunders(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *Funder) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Address) + if l > 0 { + n += 1 + l + sovFunders(uint64(l)) + } + l = len(m.Moniker) + if l > 0 { + n += 1 + l + sovFunders(uint64(l)) + } + l = len(m.Identity) + if l > 0 { + n += 1 + l + sovFunders(uint64(l)) + } + l = len(m.Website) + if l > 0 { + n += 1 + l + sovFunders(uint64(l)) + } + l = len(m.Contact) + if l > 0 { + n += 1 + l + sovFunders(uint64(l)) + } + l = len(m.Description) + if l > 0 { + n += 1 + l + sovFunders(uint64(l)) + } + return n +} + +func (m *Funding) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.FunderAddress) + if l > 0 { + n += 1 + l + sovFunders(uint64(l)) + } + if m.PoolId != 0 { + n += 1 + sovFunders(uint64(m.PoolId)) + } + if m.Amount != 0 { + n += 1 + sovFunders(uint64(m.Amount)) + } + if m.AmountPerBundle != 0 { + n += 1 + sovFunders(uint64(m.AmountPerBundle)) + } + if m.TotalFunded != 0 { + n += 1 + sovFunders(uint64(m.TotalFunded)) + } + return n +} + +func (m *FundingState) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.PoolId != 0 { + n += 1 + sovFunders(uint64(m.PoolId)) + } + if len(m.ActiveFunderAddresses) > 0 { + for _, s := range m.ActiveFunderAddresses { + l = len(s) + n += 1 + l + sovFunders(uint64(l)) + } + } + return n +} + +func sovFunders(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozFunders(x uint64) (n int) { + return sovFunders(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Funder) 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 ErrIntOverflowFunders + } + 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: Funder: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Funder: 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 ErrIntOverflowFunders + } + 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 ErrInvalidLengthFunders + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthFunders + } + 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 Moniker", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFunders + } + 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 ErrInvalidLengthFunders + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthFunders + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Moniker = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Identity", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFunders + } + 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 ErrInvalidLengthFunders + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthFunders + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Identity = 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 ErrIntOverflowFunders + } + 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 ErrInvalidLengthFunders + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthFunders + } + 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 Contact", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFunders + } + 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 ErrInvalidLengthFunders + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthFunders + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Contact = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFunders + } + 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 ErrInvalidLengthFunders + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthFunders + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Description = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipFunders(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthFunders + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Funding) 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 ErrIntOverflowFunders + } + 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: Funding: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Funding: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FunderAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFunders + } + 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 ErrInvalidLengthFunders + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthFunders + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.FunderAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field PoolId", wireType) + } + m.PoolId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFunders + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.PoolId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + } + m.Amount = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFunders + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Amount |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field AmountPerBundle", wireType) + } + m.AmountPerBundle = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFunders + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.AmountPerBundle |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TotalFunded", wireType) + } + m.TotalFunded = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFunders + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.TotalFunded |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipFunders(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthFunders + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *FundingState) 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 ErrIntOverflowFunders + } + 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: FundingState: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: FundingState: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field PoolId", wireType) + } + m.PoolId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFunders + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.PoolId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ActiveFunderAddresses", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFunders + } + 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 ErrInvalidLengthFunders + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthFunders + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ActiveFunderAddresses = append(m.ActiveFunderAddresses, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipFunders(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthFunders + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipFunders(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, ErrIntOverflowFunders + } + 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, ErrIntOverflowFunders + } + 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, ErrIntOverflowFunders + } + 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, ErrInvalidLengthFunders + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupFunders + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthFunders + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthFunders = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowFunders = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupFunders = fmt.Errorf("proto: unexpected end of group") +) diff --git a/app/upgrades/v1_5/v1_4_types/funders/getters_funding.go b/app/upgrades/v1_5/v1_4_types/funders/getters_funding.go new file mode 100644 index 00000000..c7f3a642 --- /dev/null +++ b/app/upgrades/v1_5/v1_4_types/funders/getters_funding.go @@ -0,0 +1,25 @@ +package funders + +import ( + "cosmossdk.io/store/prefix" + storeTypes "cosmossdk.io/store/types" + fundersTypes "github.com/KYVENetwork/chain/x/funders/types" + "github.com/cosmos/cosmos-sdk/codec" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// GetAllFundings returns all fundings +func GetAllFundings(ctx sdk.Context, cdc codec.Codec, storeKey storeTypes.StoreKey) (fundings []Funding) { + store := prefix.NewStore(ctx.KVStore(storeKey), fundersTypes.FundingKeyPrefixByFunder) + iterator := storeTypes.KVStorePrefixIterator(store, []byte{}) + + //goland:noinspection GoUnhandledErrorResult + defer iterator.Close() + for ; iterator.Valid(); iterator.Next() { + var val Funding + cdc.MustUnmarshal(iterator.Value(), &val) + fundings = append(fundings, val) + } + + return fundings +} diff --git a/app/upgrades/v1_5/v1_4_types/funders/getters_params.go b/app/upgrades/v1_5/v1_4_types/funders/getters_params.go new file mode 100644 index 00000000..22c35bf9 --- /dev/null +++ b/app/upgrades/v1_5/v1_4_types/funders/getters_params.go @@ -0,0 +1,28 @@ +package funders + +import ( + storeTypes "cosmossdk.io/store/types" + "github.com/KYVENetwork/chain/x/funders/types" + "github.com/cosmos/cosmos-sdk/codec" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// GetParams get all parameters as types.Params +func GetParams(ctx sdk.Context, cdc codec.Codec, storeKey storeTypes.StoreKey) (params Params) { + store := ctx.KVStore(storeKey) + + bz := store.Get(types.ParamsKey) + if bz == nil { + return params + } + + cdc.MustUnmarshal(bz, ¶ms) + return params +} + +// SetParams set the params +func SetParams(ctx sdk.Context, cdc codec.Codec, storeKey storeTypes.StoreKey, params Params) { + store := ctx.KVStore(storeKey) + bz := cdc.MustMarshal(¶ms) + store.Set(types.ParamsKey, bz) +} diff --git a/app/upgrades/v1_5/v1_4_types/funders/params.pb.go b/app/upgrades/v1_5/v1_4_types/funders/params.pb.go new file mode 100644 index 00000000..90273155 --- /dev/null +++ b/app/upgrades/v1_5/v1_4_types/funders/params.pb.go @@ -0,0 +1,380 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: kyve/funders/legacy/params.proto + +package funders + +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 + +// Params defines the funders module parameters. +type Params struct { + // Minimum amount of tokens that can be funded. + MinFundingAmount uint64 `protobuf:"varint,1,opt,name=min_funding_amount,json=minFundingAmount,proto3" json:"min_funding_amount,omitempty"` + // Minimum amount of tokens that can be funded per bundle. + MinFundingAmountPerBundle uint64 `protobuf:"varint,2,opt,name=min_funding_amount_per_bundle,json=minFundingAmountPerBundle,proto3" json:"min_funding_amount_per_bundle,omitempty"` + // Minimum ratio between the funded amount and the amount_per_bundle. + // In other words this param ensures, that a funder provides at least funding for + // `min_funding_multiple` bundles. + MinFundingMultiple uint64 `protobuf:"varint,3,opt,name=min_funding_multiple,json=minFundingMultiple,proto3" json:"min_funding_multiple,omitempty"` +} + +func (m *Params) Reset() { *m = Params{} } +func (m *Params) String() string { return proto.CompactTextString(m) } +func (*Params) ProtoMessage() {} +func (*Params) Descriptor() ([]byte, []int) { + return fileDescriptor_906a9a55094dc984, []int{0} +} +func (m *Params) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Params.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 *Params) XXX_Merge(src proto.Message) { + xxx_messageInfo_Params.Merge(m, src) +} +func (m *Params) XXX_Size() int { + return m.Size() +} +func (m *Params) XXX_DiscardUnknown() { + xxx_messageInfo_Params.DiscardUnknown(m) +} + +var xxx_messageInfo_Params proto.InternalMessageInfo + +func (m *Params) GetMinFundingAmount() uint64 { + if m != nil { + return m.MinFundingAmount + } + return 0 +} + +func (m *Params) GetMinFundingAmountPerBundle() uint64 { + if m != nil { + return m.MinFundingAmountPerBundle + } + return 0 +} + +func (m *Params) GetMinFundingMultiple() uint64 { + if m != nil { + return m.MinFundingMultiple + } + return 0 +} + +func init() { + proto.RegisterType((*Params)(nil), "kyve.funders.legacy.Params") +} + +func init() { proto.RegisterFile("kyve/funders/legacy/params.proto", fileDescriptor_906a9a55094dc984) } + +var fileDescriptor_906a9a55094dc984 = []byte{ + // 241 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0xcc, 0xae, 0x2c, 0x4b, + 0xd5, 0x4f, 0x2b, 0xcd, 0x4b, 0x49, 0x2d, 0x2a, 0xd6, 0x2f, 0x33, 0x4c, 0x4a, 0x2d, 0x49, 0x34, + 0xd4, 0x2f, 0x48, 0x2c, 0x4a, 0xcc, 0x2d, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x01, + 0x29, 0xd1, 0x83, 0x2a, 0xd1, 0x83, 0x2a, 0x51, 0x5a, 0xc5, 0xc8, 0xc5, 0x16, 0x00, 0x56, 0x26, + 0xa4, 0xc3, 0x25, 0x94, 0x9b, 0x99, 0x17, 0x0f, 0x52, 0x91, 0x99, 0x97, 0x1e, 0x9f, 0x98, 0x9b, + 0x5f, 0x9a, 0x57, 0x22, 0xc1, 0xa8, 0xc0, 0xa8, 0xc1, 0x12, 0x24, 0x90, 0x9b, 0x99, 0xe7, 0x06, + 0x91, 0x70, 0x04, 0x8b, 0x0b, 0x39, 0x70, 0xc9, 0x62, 0xaa, 0x8e, 0x2f, 0x48, 0x2d, 0x8a, 0x4f, + 0x2a, 0xcd, 0x4b, 0xc9, 0x49, 0x95, 0x60, 0x02, 0x6b, 0x94, 0x44, 0xd7, 0x18, 0x90, 0x5a, 0xe4, + 0x04, 0x56, 0x20, 0x64, 0xc0, 0x25, 0x82, 0x6c, 0x42, 0x6e, 0x69, 0x4e, 0x49, 0x66, 0x41, 0x4e, + 0xaa, 0x04, 0x33, 0x58, 0xa3, 0x10, 0x42, 0xa3, 0x2f, 0x54, 0xc6, 0xc9, 0xed, 0xc4, 0x23, 0x39, + 0xc6, 0x0b, 0x8f, 0xe4, 0x18, 0x1f, 0x3c, 0x92, 0x63, 0x9c, 0xf0, 0x58, 0x8e, 0xe1, 0xc2, 0x63, + 0x39, 0x86, 0x1b, 0x8f, 0xe5, 0x18, 0xa2, 0x74, 0xd2, 0x33, 0x4b, 0x32, 0x4a, 0x93, 0xf4, 0x92, + 0xf3, 0x73, 0xf5, 0xbd, 0x23, 0xc3, 0x5c, 0xfd, 0x52, 0x4b, 0xca, 0xf3, 0x8b, 0xb2, 0xf5, 0x93, + 0x33, 0x12, 0x33, 0xf3, 0xf4, 0x2b, 0xe0, 0x21, 0x53, 0x52, 0x59, 0x90, 0x5a, 0x9c, 0xc4, 0x06, + 0x0e, 0x11, 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0x66, 0xb6, 0xfa, 0xe0, 0x36, 0x01, 0x00, + 0x00, +} + +func (m *Params) 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 *Params) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.MinFundingMultiple != 0 { + i = encodeVarintParams(dAtA, i, uint64(m.MinFundingMultiple)) + i-- + dAtA[i] = 0x18 + } + if m.MinFundingAmountPerBundle != 0 { + i = encodeVarintParams(dAtA, i, uint64(m.MinFundingAmountPerBundle)) + i-- + dAtA[i] = 0x10 + } + if m.MinFundingAmount != 0 { + i = encodeVarintParams(dAtA, i, uint64(m.MinFundingAmount)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func encodeVarintParams(dAtA []byte, offset int, v uint64) int { + offset -= sovParams(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *Params) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.MinFundingAmount != 0 { + n += 1 + sovParams(uint64(m.MinFundingAmount)) + } + if m.MinFundingAmountPerBundle != 0 { + n += 1 + sovParams(uint64(m.MinFundingAmountPerBundle)) + } + if m.MinFundingMultiple != 0 { + n += 1 + sovParams(uint64(m.MinFundingMultiple)) + } + return n +} + +func sovParams(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozParams(x uint64) (n int) { + return sovParams(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Params) 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 ErrIntOverflowParams + } + 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: Params: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MinFundingAmount", wireType) + } + m.MinFundingAmount = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MinFundingAmount |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MinFundingAmountPerBundle", wireType) + } + m.MinFundingAmountPerBundle = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MinFundingAmountPerBundle |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MinFundingMultiple", wireType) + } + m.MinFundingMultiple = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MinFundingMultiple |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipParams(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthParams + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipParams(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, ErrIntOverflowParams + } + 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, ErrIntOverflowParams + } + 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, ErrIntOverflowParams + } + 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, ErrInvalidLengthParams + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupParams + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthParams + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthParams = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowParams = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupParams = fmt.Errorf("proto: unexpected end of group") +) diff --git a/app/upgrades/v1_5/v1_4_types/pool/getters_pool.go b/app/upgrades/v1_5/v1_4_types/pool/getters_pool.go new file mode 100644 index 00000000..19b5102c --- /dev/null +++ b/app/upgrades/v1_5/v1_4_types/pool/getters_pool.go @@ -0,0 +1,35 @@ +package pool + +import ( + "cosmossdk.io/store/prefix" + storeTypes "cosmossdk.io/store/types" + "github.com/KYVENetwork/chain/x/pool/types" + "github.com/cosmos/cosmos-sdk/codec" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// GetParams returns the x/pool params from state. +func GetParams(ctx sdk.Context, cdc codec.Codec, storeKey storeTypes.StoreKey) (params types.Params) { + bz := ctx.KVStore(storeKey).Get(types.ParamsKey) + if bz != nil { + cdc.MustUnmarshal(bz, ¶ms) + } + + return +} + +// GetAllPools returns all pools +func GetAllPools(ctx sdk.Context, storeKey storeTypes.StoreKey, cdc codec.Codec) (list []Pool) { + store := prefix.NewStore(ctx.KVStore(storeKey), types.PoolKey) + iterator := storeTypes.KVStorePrefixIterator(store, []byte{}) + + defer iterator.Close() + + for ; iterator.Valid(); iterator.Next() { + var val Pool + cdc.MustUnmarshal(iterator.Value(), &val) + list = append(list, val) + } + + return +} diff --git a/app/upgrades/v1_5/v1_4_types/pool/params.pb.go b/app/upgrades/v1_5/v1_4_types/pool/params.pb.go new file mode 100644 index 00000000..1441026d --- /dev/null +++ b/app/upgrades/v1_5/v1_4_types/pool/params.pb.go @@ -0,0 +1,367 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: kyve/pool/v1beta1/params.proto + +package pool + +import ( + math "cosmossdk.io/math" + fmt "fmt" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/gogo/protobuf/proto" + io "io" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf + +// 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 + +// Params defines the pool module parameters. +type Params struct { + // protocol_inflation_share ... + ProtocolInflationShare math.LegacyDec `protobuf:"bytes,1,opt,name=protocol_inflation_share,json=protocolInflationShare,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"protocol_inflation_share"` + // pool_inflation_payout_rate ... + PoolInflationPayoutRate math.LegacyDec `protobuf:"bytes,2,opt,name=pool_inflation_payout_rate,json=poolInflationPayoutRate,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"pool_inflation_payout_rate"` +} + +func (m *Params) Reset() { *m = Params{} } +func (m *Params) String() string { return proto.CompactTextString(m) } +func (*Params) ProtoMessage() {} +func (*Params) Descriptor() ([]byte, []int) { + return fileDescriptor_7d8646dfa6da3b4d, []int{0} +} +func (m *Params) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Params.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 *Params) XXX_Merge(src proto.Message) { + xxx_messageInfo_Params.Merge(m, src) +} +func (m *Params) XXX_Size() int { + return m.Size() +} +func (m *Params) XXX_DiscardUnknown() { + xxx_messageInfo_Params.DiscardUnknown(m) +} + +var xxx_messageInfo_Params proto.InternalMessageInfo + +func init() { + proto.RegisterType((*Params)(nil), "kyve.pool.legacy.Params") +} + +func init() { proto.RegisterFile("kyve/pool/legacy/params.proto", fileDescriptor_7d8646dfa6da3b4d) } + +var fileDescriptor_7d8646dfa6da3b4d = []byte{ + // 268 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0xcb, 0xae, 0x2c, 0x4b, + 0xd5, 0x2f, 0xc8, 0xcf, 0xcf, 0xd1, 0x2f, 0x33, 0x4c, 0x4a, 0x2d, 0x49, 0x34, 0xd4, 0x2f, 0x48, + 0x2c, 0x4a, 0xcc, 0x2d, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x04, 0xc9, 0xeb, 0x81, + 0xe4, 0xf5, 0xa0, 0xf2, 0x52, 0x22, 0xe9, 0xf9, 0xe9, 0xf9, 0x60, 0x59, 0x7d, 0x10, 0x0b, 0xa2, + 0x50, 0xe9, 0x3e, 0x23, 0x17, 0x5b, 0x00, 0x58, 0xa7, 0x50, 0x06, 0x97, 0x04, 0x58, 0x2c, 0x39, + 0x3f, 0x27, 0x3e, 0x33, 0x2f, 0x2d, 0x27, 0xb1, 0x24, 0x33, 0x3f, 0x2f, 0xbe, 0x38, 0x23, 0xb1, + 0x28, 0x55, 0x82, 0x51, 0x81, 0x51, 0x83, 0xd3, 0x49, 0xef, 0xc4, 0x3d, 0x79, 0x86, 0x5b, 0xf7, + 0xe4, 0xd5, 0xd2, 0x33, 0x4b, 0x32, 0x4a, 0x93, 0xf4, 0x92, 0xf3, 0x73, 0xf5, 0x93, 0xf3, 0x8b, + 0x73, 0xf3, 0x8b, 0xa1, 0x94, 0x6e, 0x71, 0x4a, 0xb6, 0x7e, 0x49, 0x65, 0x41, 0x6a, 0xb1, 0x9e, + 0x4b, 0x6a, 0x72, 0x90, 0x18, 0xcc, 0x3c, 0x4f, 0x98, 0x71, 0xc1, 0x20, 0xd3, 0x84, 0xb2, 0xb9, + 0xa4, 0x40, 0x4e, 0x43, 0xb2, 0xa5, 0x20, 0xb1, 0x32, 0xbf, 0xb4, 0x24, 0xbe, 0x28, 0xb1, 0x24, + 0x55, 0x82, 0x89, 0x2c, 0xbb, 0xc4, 0x41, 0x26, 0xc2, 0xed, 0x09, 0x00, 0x9b, 0x17, 0x94, 0x58, + 0x92, 0xea, 0xe4, 0x7c, 0xe2, 0x91, 0x1c, 0xe3, 0x85, 0x47, 0x72, 0x8c, 0x0f, 0x1e, 0xc9, 0x31, + 0x4e, 0x78, 0x2c, 0xc7, 0x70, 0xe1, 0xb1, 0x1c, 0xc3, 0x8d, 0xc7, 0x72, 0x0c, 0x51, 0x9a, 0x48, + 0x46, 0x7b, 0x47, 0x86, 0xb9, 0xfa, 0xa5, 0x96, 0x94, 0xe7, 0x17, 0x65, 0xeb, 0x27, 0x67, 0x24, + 0x66, 0xe6, 0xe9, 0x57, 0x40, 0x82, 0x17, 0x6c, 0x43, 0x12, 0x1b, 0xd8, 0x27, 0xc6, 0x80, 0x00, + 0x00, 0x00, 0xff, 0xff, 0xd3, 0x1a, 0xf2, 0x59, 0x78, 0x01, 0x00, 0x00, +} + +func (m *Params) 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 *Params) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size := m.PoolInflationPayoutRate.Size() + i -= size + if _, err := m.PoolInflationPayoutRate.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintParams(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + { + size := m.ProtocolInflationShare.Size() + i -= size + if _, err := m.ProtocolInflationShare.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintParams(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func encodeVarintParams(dAtA []byte, offset int, v uint64) int { + offset -= sovParams(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *Params) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.ProtocolInflationShare.Size() + n += 1 + l + sovParams(uint64(l)) + l = m.PoolInflationPayoutRate.Size() + n += 1 + l + sovParams(uint64(l)) + return n +} + +func sovParams(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozParams(x uint64) (n int) { + return sovParams(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Params) 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 ErrIntOverflowParams + } + 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: Params: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ProtocolInflationShare", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + 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 ErrInvalidLengthParams + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthParams + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ProtocolInflationShare.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PoolInflationPayoutRate", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + 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 ErrInvalidLengthParams + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthParams + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.PoolInflationPayoutRate.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipParams(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthParams + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipParams(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, ErrIntOverflowParams + } + 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, ErrIntOverflowParams + } + 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, ErrIntOverflowParams + } + 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, ErrInvalidLengthParams + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupParams + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthParams + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthParams = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowParams = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupParams = fmt.Errorf("proto: unexpected end of group") +) diff --git a/app/upgrades/v1_5/v1_4_types/pool/pool.pb.go b/app/upgrades/v1_5/v1_4_types/pool/pool.pb.go new file mode 100644 index 00000000..4a03e3fa --- /dev/null +++ b/app/upgrades/v1_5/v1_4_types/pool/pool.pb.go @@ -0,0 +1,1838 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: kyve/pool/v1beta1/pool.proto + +package pool + +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 + +// PoolStatus ... +type PoolStatus int32 + +const ( + // POOL_STATUS_UNSPECIFIED indicates an unknown status, likely + // due to an error + POOL_STATUS_UNSPECIFIED PoolStatus = 0 + // POOL_STATUS_ACTIVE indicates, that the pool is running + // normally + POOL_STATUS_ACTIVE PoolStatus = 1 + // POOL_STATUS_DISABLED indicates, that the pool was disabled + // by the governance and does not continue until it is enabled + // by the governance again + POOL_STATUS_DISABLED PoolStatus = 2 + // POOL_STATUS_NO_FUNDS indicates, that the pool currently has no + // funds, but is continuing normally anyway, due to inflation splitting + POOL_STATUS_NO_FUNDS PoolStatus = 3 + // POOL_STATUS_NOT_ENOUGH_DELEGATION indicates, that the min delegation + // requirement has not been met and that the pool is halted + POOL_STATUS_NOT_ENOUGH_DELEGATION PoolStatus = 4 + // POOL_STATUS_UPGRADING indicates, that the runtime is currently + // being upgraded and that the pool is halted + POOL_STATUS_UPGRADING PoolStatus = 5 + // POOL_STATUS_VOTING_POWER_TOO_HIGH indicates, that one validator + // has more than 50% voting power and that the pool is halted + POOL_STATUS_VOTING_POWER_TOO_HIGH PoolStatus = 6 + // POOL_STATUS_END_KEY_REACHED indicates, that the end key has been + // reached and that the pool is halted + POOL_STATUS_END_KEY_REACHED PoolStatus = 7 +) + +var PoolStatus_name = map[int32]string{ + 0: "POOL_STATUS_UNSPECIFIED", + 1: "POOL_STATUS_ACTIVE", + 2: "POOL_STATUS_DISABLED", + 3: "POOL_STATUS_NO_FUNDS", + 4: "POOL_STATUS_NOT_ENOUGH_DELEGATION", + 5: "POOL_STATUS_UPGRADING", + 6: "POOL_STATUS_VOTING_POWER_TOO_HIGH", + 7: "POOL_STATUS_END_KEY_REACHED", +} + +var PoolStatus_value = map[string]int32{ + "POOL_STATUS_UNSPECIFIED": 0, + "POOL_STATUS_ACTIVE": 1, + "POOL_STATUS_DISABLED": 2, + "POOL_STATUS_NO_FUNDS": 3, + "POOL_STATUS_NOT_ENOUGH_DELEGATION": 4, + "POOL_STATUS_UPGRADING": 5, + "POOL_STATUS_VOTING_POWER_TOO_HIGH": 6, + "POOL_STATUS_END_KEY_REACHED": 7, +} + +func (x PoolStatus) String() string { + return proto.EnumName(PoolStatus_name, int32(x)) +} + +func (PoolStatus) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_40c1730f47ff2ef8, []int{0} +} + +// Protocol holds all info about the current pool version and the +// available binaries for participating as a validator in a pool +type Protocol struct { + // version holds the current software version tag of the pool binaries + Version string `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"` + // binaries is a stringified json object which holds binaries in the + // current version for multiple platforms and architectures + Binaries string `protobuf:"bytes,2,opt,name=binaries,proto3" json:"binaries,omitempty"` + // last_upgrade is the unix time the pool was upgraded the last time + LastUpgrade uint64 `protobuf:"varint,3,opt,name=last_upgrade,json=lastUpgrade,proto3" json:"last_upgrade,omitempty"` +} + +func (m *Protocol) Reset() { *m = Protocol{} } +func (m *Protocol) String() string { return proto.CompactTextString(m) } +func (*Protocol) ProtoMessage() {} +func (*Protocol) Descriptor() ([]byte, []int) { + return fileDescriptor_40c1730f47ff2ef8, []int{0} +} +func (m *Protocol) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Protocol) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Protocol.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 *Protocol) XXX_Merge(src proto.Message) { + xxx_messageInfo_Protocol.Merge(m, src) +} +func (m *Protocol) XXX_Size() int { + return m.Size() +} +func (m *Protocol) XXX_DiscardUnknown() { + xxx_messageInfo_Protocol.DiscardUnknown(m) +} + +var xxx_messageInfo_Protocol proto.InternalMessageInfo + +func (m *Protocol) GetVersion() string { + if m != nil { + return m.Version + } + return "" +} + +func (m *Protocol) GetBinaries() string { + if m != nil { + return m.Binaries + } + return "" +} + +func (m *Protocol) GetLastUpgrade() uint64 { + if m != nil { + return m.LastUpgrade + } + return 0 +} + +// Upgrade holds all info when a pool has a scheduled upgrade +type UpgradePlan struct { + // version is the new software version tag of the upgrade + Version string `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"` + // binaries is the new stringified json object which holds binaries in the + // upgrade version for multiple platforms and architectures + Binaries string `protobuf:"bytes,2,opt,name=binaries,proto3" json:"binaries,omitempty"` + // scheduled_at is the unix time the upgrade is supposed to be done + ScheduledAt uint64 `protobuf:"varint,3,opt,name=scheduled_at,json=scheduledAt,proto3" json:"scheduled_at,omitempty"` + // duration is the time in seconds how long the pool should halt + // during the upgrade to give all validators a chance of switching + // to the new binaries + Duration uint64 `protobuf:"varint,4,opt,name=duration,proto3" json:"duration,omitempty"` +} + +func (m *UpgradePlan) Reset() { *m = UpgradePlan{} } +func (m *UpgradePlan) String() string { return proto.CompactTextString(m) } +func (*UpgradePlan) ProtoMessage() {} +func (*UpgradePlan) Descriptor() ([]byte, []int) { + return fileDescriptor_40c1730f47ff2ef8, []int{1} +} +func (m *UpgradePlan) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *UpgradePlan) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_UpgradePlan.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 *UpgradePlan) XXX_Merge(src proto.Message) { + xxx_messageInfo_UpgradePlan.Merge(m, src) +} +func (m *UpgradePlan) XXX_Size() int { + return m.Size() +} +func (m *UpgradePlan) XXX_DiscardUnknown() { + xxx_messageInfo_UpgradePlan.DiscardUnknown(m) +} + +var xxx_messageInfo_UpgradePlan proto.InternalMessageInfo + +func (m *UpgradePlan) GetVersion() string { + if m != nil { + return m.Version + } + return "" +} + +func (m *UpgradePlan) GetBinaries() string { + if m != nil { + return m.Binaries + } + return "" +} + +func (m *UpgradePlan) GetScheduledAt() uint64 { + if m != nil { + return m.ScheduledAt + } + return 0 +} + +func (m *UpgradePlan) GetDuration() uint64 { + if m != nil { + return m.Duration + } + return 0 +} + +// Pool ... +type Pool struct { + // id - unique identifier of the pool, can not be changed + Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + // name is a human readable name for the pool + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + // runtime specified which protocol and which version needs is required + Runtime string `protobuf:"bytes,3,opt,name=runtime,proto3" json:"runtime,omitempty"` + // logo is a link to an image file + Logo string `protobuf:"bytes,4,opt,name=logo,proto3" json:"logo,omitempty"` + // config is either a JSON encoded string or a link to an external storage provider. + // This is up to the implementation of the protocol node. + Config string `protobuf:"bytes,5,opt,name=config,proto3" json:"config,omitempty"` + // start_key ... + StartKey string `protobuf:"bytes,6,opt,name=start_key,json=startKey,proto3" json:"start_key,omitempty"` + // current_key ... + CurrentKey string `protobuf:"bytes,7,opt,name=current_key,json=currentKey,proto3" json:"current_key,omitempty"` + // current_summary ... + CurrentSummary string `protobuf:"bytes,8,opt,name=current_summary,json=currentSummary,proto3" json:"current_summary,omitempty"` + // current_index ... + CurrentIndex uint64 `protobuf:"varint,9,opt,name=current_index,json=currentIndex,proto3" json:"current_index,omitempty"` + // total_bundles is the number of total finalized bundles + TotalBundles uint64 `protobuf:"varint,10,opt,name=total_bundles,json=totalBundles,proto3" json:"total_bundles,omitempty"` + // upload_interval ... + UploadInterval uint64 `protobuf:"varint,11,opt,name=upload_interval,json=uploadInterval,proto3" json:"upload_interval,omitempty"` + // inflation_share_weight ... + InflationShareWeight uint64 `protobuf:"varint,12,opt,name=inflation_share_weight,json=inflationShareWeight,proto3" json:"inflation_share_weight,omitempty"` + // min_delegation ... + MinDelegation uint64 `protobuf:"varint,13,opt,name=min_delegation,json=minDelegation,proto3" json:"min_delegation,omitempty"` + // max_bundle_size ... + MaxBundleSize uint64 `protobuf:"varint,14,opt,name=max_bundle_size,json=maxBundleSize,proto3" json:"max_bundle_size,omitempty"` + // disabled is true when the pool is disabled. + // Can only be done via governance. + Disabled bool `protobuf:"varint,15,opt,name=disabled,proto3" json:"disabled,omitempty"` + // protocol ... + Protocol *Protocol `protobuf:"bytes,16,opt,name=protocol,proto3" json:"protocol,omitempty"` + // upgrade_plan ... + UpgradePlan *UpgradePlan `protobuf:"bytes,17,opt,name=upgrade_plan,json=upgradePlan,proto3" json:"upgrade_plan,omitempty"` + // storage_provider_id ... + CurrentStorageProviderId uint32 `protobuf:"varint,18,opt,name=current_storage_provider_id,json=currentStorageProviderId,proto3" json:"current_storage_provider_id,omitempty"` + // compression_id ... + CurrentCompressionId uint32 `protobuf:"varint,19,opt,name=current_compression_id,json=currentCompressionId,proto3" json:"current_compression_id,omitempty"` + // end_key is the last key before the pool should stop indexing, it is + // inclusive + EndKey string `protobuf:"bytes,20,opt,name=end_key,json=endKey,proto3" json:"end_key,omitempty"` +} + +func (m *Pool) Reset() { *m = Pool{} } +func (m *Pool) String() string { return proto.CompactTextString(m) } +func (*Pool) ProtoMessage() {} +func (*Pool) Descriptor() ([]byte, []int) { + return fileDescriptor_40c1730f47ff2ef8, []int{2} +} +func (m *Pool) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Pool) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Pool.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 *Pool) XXX_Merge(src proto.Message) { + xxx_messageInfo_Pool.Merge(m, src) +} +func (m *Pool) XXX_Size() int { + return m.Size() +} +func (m *Pool) XXX_DiscardUnknown() { + xxx_messageInfo_Pool.DiscardUnknown(m) +} + +var xxx_messageInfo_Pool proto.InternalMessageInfo + +func (m *Pool) GetId() uint64 { + if m != nil { + return m.Id + } + return 0 +} + +func (m *Pool) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *Pool) GetRuntime() string { + if m != nil { + return m.Runtime + } + return "" +} + +func (m *Pool) GetLogo() string { + if m != nil { + return m.Logo + } + return "" +} + +func (m *Pool) GetConfig() string { + if m != nil { + return m.Config + } + return "" +} + +func (m *Pool) GetStartKey() string { + if m != nil { + return m.StartKey + } + return "" +} + +func (m *Pool) GetCurrentKey() string { + if m != nil { + return m.CurrentKey + } + return "" +} + +func (m *Pool) GetCurrentSummary() string { + if m != nil { + return m.CurrentSummary + } + return "" +} + +func (m *Pool) GetCurrentIndex() uint64 { + if m != nil { + return m.CurrentIndex + } + return 0 +} + +func (m *Pool) GetTotalBundles() uint64 { + if m != nil { + return m.TotalBundles + } + return 0 +} + +func (m *Pool) GetUploadInterval() uint64 { + if m != nil { + return m.UploadInterval + } + return 0 +} + +func (m *Pool) GetInflationShareWeight() uint64 { + if m != nil { + return m.InflationShareWeight + } + return 0 +} + +func (m *Pool) GetMinDelegation() uint64 { + if m != nil { + return m.MinDelegation + } + return 0 +} + +func (m *Pool) GetMaxBundleSize() uint64 { + if m != nil { + return m.MaxBundleSize + } + return 0 +} + +func (m *Pool) GetDisabled() bool { + if m != nil { + return m.Disabled + } + return false +} + +func (m *Pool) GetProtocol() *Protocol { + if m != nil { + return m.Protocol + } + return nil +} + +func (m *Pool) GetUpgradePlan() *UpgradePlan { + if m != nil { + return m.UpgradePlan + } + return nil +} + +func (m *Pool) GetCurrentStorageProviderId() uint32 { + if m != nil { + return m.CurrentStorageProviderId + } + return 0 +} + +func (m *Pool) GetCurrentCompressionId() uint32 { + if m != nil { + return m.CurrentCompressionId + } + return 0 +} + +func (m *Pool) GetEndKey() string { + if m != nil { + return m.EndKey + } + return "" +} + +var fileDescriptor_40c1730f47ff2ef8 = []byte{ + // 820 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x94, 0x41, 0x6f, 0xdb, 0x36, + 0x14, 0xc7, 0x2d, 0xd7, 0x49, 0x6c, 0x3a, 0x71, 0x5c, 0xce, 0x4b, 0xb9, 0x78, 0x70, 0xdd, 0x0c, + 0xdd, 0xbc, 0x1d, 0x6c, 0x74, 0x1b, 0xb0, 0xd3, 0x0e, 0x8e, 0xa5, 0x3a, 0x42, 0x02, 0xc9, 0x90, + 0xec, 0x14, 0xdd, 0x85, 0xa0, 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x58, 0x54, + 0xbc, 0xe5, 0xc9, 0xcd, 0x60, 0xb1, 0x24, 0x2c, 0x1a, 0xdc, 0xe6, 0x3f, 0x59, 0xb1, 0x8e, 0x69, + 0x3a, 0xdf, 0x57, 0x73, 0xf2, 0xdd, 0x3f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x06, 0x44, 0xea, 0xbf, + 0x7e, 0x05, 0x00, 0x00, +} + +func (m *Protocol) 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 *Protocol) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Protocol) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.LastUpgrade != 0 { + i = encodeVarintPool(dAtA, i, uint64(m.LastUpgrade)) + i-- + dAtA[i] = 0x18 + } + if len(m.Binaries) > 0 { + i -= len(m.Binaries) + copy(dAtA[i:], m.Binaries) + i = encodeVarintPool(dAtA, i, uint64(len(m.Binaries))) + i-- + dAtA[i] = 0x12 + } + if len(m.Version) > 0 { + i -= len(m.Version) + copy(dAtA[i:], m.Version) + i = encodeVarintPool(dAtA, i, uint64(len(m.Version))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *UpgradePlan) 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 *UpgradePlan) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *UpgradePlan) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Duration != 0 { + i = encodeVarintPool(dAtA, i, uint64(m.Duration)) + i-- + dAtA[i] = 0x20 + } + if m.ScheduledAt != 0 { + i = encodeVarintPool(dAtA, i, uint64(m.ScheduledAt)) + i-- + dAtA[i] = 0x18 + } + if len(m.Binaries) > 0 { + i -= len(m.Binaries) + copy(dAtA[i:], m.Binaries) + i = encodeVarintPool(dAtA, i, uint64(len(m.Binaries))) + i-- + dAtA[i] = 0x12 + } + if len(m.Version) > 0 { + i -= len(m.Version) + copy(dAtA[i:], m.Version) + i = encodeVarintPool(dAtA, i, uint64(len(m.Version))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Pool) 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 *Pool) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Pool) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.EndKey) > 0 { + i -= len(m.EndKey) + copy(dAtA[i:], m.EndKey) + i = encodeVarintPool(dAtA, i, uint64(len(m.EndKey))) + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0xa2 + } + if m.CurrentCompressionId != 0 { + i = encodeVarintPool(dAtA, i, uint64(m.CurrentCompressionId)) + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0x98 + } + if m.CurrentStorageProviderId != 0 { + i = encodeVarintPool(dAtA, i, uint64(m.CurrentStorageProviderId)) + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0x90 + } + if m.UpgradePlan != nil { + { + size, err := m.UpgradePlan.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintPool(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0x8a + } + if m.Protocol != nil { + { + size, err := m.Protocol.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintPool(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0x82 + } + if m.Disabled { + i-- + if m.Disabled { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x78 + } + if m.MaxBundleSize != 0 { + i = encodeVarintPool(dAtA, i, uint64(m.MaxBundleSize)) + i-- + dAtA[i] = 0x70 + } + if m.MinDelegation != 0 { + i = encodeVarintPool(dAtA, i, uint64(m.MinDelegation)) + i-- + dAtA[i] = 0x68 + } + if m.InflationShareWeight != 0 { + i = encodeVarintPool(dAtA, i, uint64(m.InflationShareWeight)) + i-- + dAtA[i] = 0x60 + } + if m.UploadInterval != 0 { + i = encodeVarintPool(dAtA, i, uint64(m.UploadInterval)) + i-- + dAtA[i] = 0x58 + } + if m.TotalBundles != 0 { + i = encodeVarintPool(dAtA, i, uint64(m.TotalBundles)) + i-- + dAtA[i] = 0x50 + } + if m.CurrentIndex != 0 { + i = encodeVarintPool(dAtA, i, uint64(m.CurrentIndex)) + i-- + dAtA[i] = 0x48 + } + if len(m.CurrentSummary) > 0 { + i -= len(m.CurrentSummary) + copy(dAtA[i:], m.CurrentSummary) + i = encodeVarintPool(dAtA, i, uint64(len(m.CurrentSummary))) + i-- + dAtA[i] = 0x42 + } + if len(m.CurrentKey) > 0 { + i -= len(m.CurrentKey) + copy(dAtA[i:], m.CurrentKey) + i = encodeVarintPool(dAtA, i, uint64(len(m.CurrentKey))) + i-- + dAtA[i] = 0x3a + } + if len(m.StartKey) > 0 { + i -= len(m.StartKey) + copy(dAtA[i:], m.StartKey) + i = encodeVarintPool(dAtA, i, uint64(len(m.StartKey))) + i-- + dAtA[i] = 0x32 + } + if len(m.Config) > 0 { + i -= len(m.Config) + copy(dAtA[i:], m.Config) + i = encodeVarintPool(dAtA, i, uint64(len(m.Config))) + i-- + dAtA[i] = 0x2a + } + if len(m.Logo) > 0 { + i -= len(m.Logo) + copy(dAtA[i:], m.Logo) + i = encodeVarintPool(dAtA, i, uint64(len(m.Logo))) + i-- + dAtA[i] = 0x22 + } + if len(m.Runtime) > 0 { + i -= len(m.Runtime) + copy(dAtA[i:], m.Runtime) + i = encodeVarintPool(dAtA, i, uint64(len(m.Runtime))) + i-- + dAtA[i] = 0x1a + } + if len(m.Name) > 0 { + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintPool(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0x12 + } + if m.Id != 0 { + i = encodeVarintPool(dAtA, i, uint64(m.Id)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func encodeVarintPool(dAtA []byte, offset int, v uint64) int { + offset -= sovPool(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *Protocol) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Version) + if l > 0 { + n += 1 + l + sovPool(uint64(l)) + } + l = len(m.Binaries) + if l > 0 { + n += 1 + l + sovPool(uint64(l)) + } + if m.LastUpgrade != 0 { + n += 1 + sovPool(uint64(m.LastUpgrade)) + } + return n +} + +func (m *UpgradePlan) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Version) + if l > 0 { + n += 1 + l + sovPool(uint64(l)) + } + l = len(m.Binaries) + if l > 0 { + n += 1 + l + sovPool(uint64(l)) + } + if m.ScheduledAt != 0 { + n += 1 + sovPool(uint64(m.ScheduledAt)) + } + if m.Duration != 0 { + n += 1 + sovPool(uint64(m.Duration)) + } + return n +} + +func (m *Pool) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Id != 0 { + n += 1 + sovPool(uint64(m.Id)) + } + l = len(m.Name) + if l > 0 { + n += 1 + l + sovPool(uint64(l)) + } + l = len(m.Runtime) + if l > 0 { + n += 1 + l + sovPool(uint64(l)) + } + l = len(m.Logo) + if l > 0 { + n += 1 + l + sovPool(uint64(l)) + } + l = len(m.Config) + if l > 0 { + n += 1 + l + sovPool(uint64(l)) + } + l = len(m.StartKey) + if l > 0 { + n += 1 + l + sovPool(uint64(l)) + } + l = len(m.CurrentKey) + if l > 0 { + n += 1 + l + sovPool(uint64(l)) + } + l = len(m.CurrentSummary) + if l > 0 { + n += 1 + l + sovPool(uint64(l)) + } + if m.CurrentIndex != 0 { + n += 1 + sovPool(uint64(m.CurrentIndex)) + } + if m.TotalBundles != 0 { + n += 1 + sovPool(uint64(m.TotalBundles)) + } + if m.UploadInterval != 0 { + n += 1 + sovPool(uint64(m.UploadInterval)) + } + if m.InflationShareWeight != 0 { + n += 1 + sovPool(uint64(m.InflationShareWeight)) + } + if m.MinDelegation != 0 { + n += 1 + sovPool(uint64(m.MinDelegation)) + } + if m.MaxBundleSize != 0 { + n += 1 + sovPool(uint64(m.MaxBundleSize)) + } + if m.Disabled { + n += 2 + } + if m.Protocol != nil { + l = m.Protocol.Size() + n += 2 + l + sovPool(uint64(l)) + } + if m.UpgradePlan != nil { + l = m.UpgradePlan.Size() + n += 2 + l + sovPool(uint64(l)) + } + if m.CurrentStorageProviderId != 0 { + n += 2 + sovPool(uint64(m.CurrentStorageProviderId)) + } + if m.CurrentCompressionId != 0 { + n += 2 + sovPool(uint64(m.CurrentCompressionId)) + } + l = len(m.EndKey) + if l > 0 { + n += 2 + l + sovPool(uint64(l)) + } + return n +} + +func sovPool(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozPool(x uint64) (n int) { + return sovPool(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Protocol) 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 ErrIntOverflowPool + } + 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: Protocol: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Protocol: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Version", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPool + } + 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 ErrInvalidLengthPool + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthPool + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Version = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Binaries", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPool + } + 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 ErrInvalidLengthPool + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthPool + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Binaries = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field LastUpgrade", wireType) + } + m.LastUpgrade = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPool + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.LastUpgrade |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipPool(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthPool + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *UpgradePlan) 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 ErrIntOverflowPool + } + 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: UpgradePlan: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: UpgradePlan: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Version", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPool + } + 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 ErrInvalidLengthPool + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthPool + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Version = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Binaries", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPool + } + 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 ErrInvalidLengthPool + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthPool + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Binaries = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ScheduledAt", wireType) + } + m.ScheduledAt = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPool + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ScheduledAt |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Duration", wireType) + } + m.Duration = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPool + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Duration |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipPool(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthPool + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Pool) 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 ErrIntOverflowPool + } + 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: Pool: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Pool: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) + } + m.Id = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPool + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Id |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPool + } + 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 ErrInvalidLengthPool + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthPool + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Runtime", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPool + } + 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 ErrInvalidLengthPool + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthPool + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Runtime = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + 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 ErrIntOverflowPool + } + 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 ErrInvalidLengthPool + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthPool + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Logo = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Config", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPool + } + 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 ErrInvalidLengthPool + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthPool + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Config = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field StartKey", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPool + } + 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 ErrInvalidLengthPool + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthPool + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.StartKey = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CurrentKey", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPool + } + 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 ErrInvalidLengthPool + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthPool + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.CurrentKey = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CurrentSummary", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPool + } + 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 ErrInvalidLengthPool + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthPool + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.CurrentSummary = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 9: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field CurrentIndex", wireType) + } + m.CurrentIndex = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPool + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.CurrentIndex |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 10: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TotalBundles", wireType) + } + m.TotalBundles = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPool + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.TotalBundles |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 11: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field UploadInterval", wireType) + } + m.UploadInterval = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPool + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.UploadInterval |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 12: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field InflationShareWeight", wireType) + } + m.InflationShareWeight = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPool + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.InflationShareWeight |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 13: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MinDelegation", wireType) + } + m.MinDelegation = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPool + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MinDelegation |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 14: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MaxBundleSize", wireType) + } + m.MaxBundleSize = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPool + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MaxBundleSize |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 15: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Disabled", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPool + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Disabled = bool(v != 0) + case 16: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Protocol", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPool + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthPool + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthPool + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Protocol == nil { + m.Protocol = &Protocol{} + } + if err := m.Protocol.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 17: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field UpgradePlan", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPool + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthPool + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthPool + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.UpgradePlan == nil { + m.UpgradePlan = &UpgradePlan{} + } + if err := m.UpgradePlan.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 18: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field CurrentStorageProviderId", wireType) + } + m.CurrentStorageProviderId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPool + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.CurrentStorageProviderId |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 19: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field CurrentCompressionId", wireType) + } + m.CurrentCompressionId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPool + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.CurrentCompressionId |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 20: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field EndKey", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPool + } + 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 ErrInvalidLengthPool + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthPool + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.EndKey = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipPool(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthPool + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipPool(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, ErrIntOverflowPool + } + 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, ErrIntOverflowPool + } + 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, ErrIntOverflowPool + } + 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, ErrInvalidLengthPool + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupPool + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthPool + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthPool = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowPool = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupPool = fmt.Errorf("proto: unexpected end of group") +) diff --git a/app/upgrades/v1_5/v1_4_types/stakers/getters_staker.go b/app/upgrades/v1_5/v1_4_types/stakers/getters_staker.go new file mode 100644 index 00000000..331ae6a8 --- /dev/null +++ b/app/upgrades/v1_5/v1_4_types/stakers/getters_staker.go @@ -0,0 +1,27 @@ +package stakers + +import ( + "cosmossdk.io/store/prefix" + storeTypes "cosmossdk.io/store/types" + stakersTypes "github.com/KYVENetwork/chain/x/stakers/types" + "github.com/cosmos/cosmos-sdk/codec" + + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// GetAllStakers returns all staker +func GetAllStakers(ctx sdk.Context, cdc codec.Codec, storeKey storeTypes.StoreKey) (list []Staker) { + store := prefix.NewStore(ctx.KVStore(storeKey), stakersTypes.StakerKeyPrefix) + + iterator := storeTypes.KVStorePrefixIterator(store, []byte{}) + + defer iterator.Close() + + for ; iterator.Valid(); iterator.Next() { + var val Staker + cdc.MustUnmarshal(iterator.Value(), &val) + list = append(list, val) + } + + return +} diff --git a/app/upgrades/v1_5/v1_4_types/stakers/stakers.pb.go b/app/upgrades/v1_5/v1_4_types/stakers/stakers.pb.go new file mode 100644 index 00000000..32a2751b --- /dev/null +++ b/app/upgrades/v1_5/v1_4_types/stakers/stakers.pb.go @@ -0,0 +1,1811 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: kyve/stakers/legacy/stakers.proto + +package stakers + +import ( + cosmossdk_io_math "cosmossdk.io/math" + 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 + +// Staker contains all metadata for a staker +// Every address can only create one staker (itself) +type Staker struct { + // address ... + Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` + // commission ... + Commission cosmossdk_io_math.LegacyDec `protobuf:"bytes,2,opt,name=commission,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"commission"` + // 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"` + // identity is the 64 bit keybase.io identity string + Identity string `protobuf:"bytes,5,opt,name=identity,proto3" json:"identity,omitempty"` + // security_contact ... + SecurityContact string `protobuf:"bytes,6,opt,name=security_contact,json=securityContact,proto3" json:"security_contact,omitempty"` + // details are some additional notes the staker finds important + Details string `protobuf:"bytes,7,opt,name=details,proto3" json:"details,omitempty"` + // commission_rewards are the rewards in $KYVE earned through commission + CommissionRewards uint64 `protobuf:"varint,8,opt,name=commission_rewards,json=commissionRewards,proto3" json:"commission_rewards,omitempty"` +} + +func (m *Staker) Reset() { *m = Staker{} } +func (m *Staker) String() string { return proto.CompactTextString(m) } +func (*Staker) ProtoMessage() {} +func (*Staker) Descriptor() ([]byte, []int) { + return fileDescriptor_d209d1a2a74d375d, []int{0} +} +func (m *Staker) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Staker) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Staker.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 *Staker) XXX_Merge(src proto.Message) { + xxx_messageInfo_Staker.Merge(m, src) +} +func (m *Staker) XXX_Size() int { + return m.Size() +} +func (m *Staker) XXX_DiscardUnknown() { + xxx_messageInfo_Staker.DiscardUnknown(m) +} + +var xxx_messageInfo_Staker proto.InternalMessageInfo + +func (m *Staker) GetAddress() string { + if m != nil { + return m.Address + } + return "" +} + +func (m *Staker) GetMoniker() string { + if m != nil { + return m.Moniker + } + return "" +} + +func (m *Staker) GetWebsite() string { + if m != nil { + return m.Website + } + return "" +} + +func (m *Staker) GetIdentity() string { + if m != nil { + return m.Identity + } + return "" +} + +func (m *Staker) GetSecurityContact() string { + if m != nil { + return m.SecurityContact + } + return "" +} + +func (m *Staker) GetDetails() string { + if m != nil { + return m.Details + } + return "" +} + +func (m *Staker) GetCommissionRewards() uint64 { + if m != nil { + return m.CommissionRewards + } + return 0 +} + +// Valaccount gets authorized by a staker to +// vote in a given pool by favor of the staker. +type Valaccount struct { + // pool_id defines the pool in which the address + // is allowed to vote in. + PoolId uint64 `protobuf:"varint,1,opt,name=pool_id,json=poolId,proto3" json:"pool_id,omitempty"` + // staker is the address the valaccount is voting for. + Staker string `protobuf:"bytes,2,opt,name=staker,proto3" json:"staker,omitempty"` + // valaddress is the account stored on the protocol + // node which votes for the staker in the given pool + Valaddress string `protobuf:"bytes,3,opt,name=valaddress,proto3" json:"valaddress,omitempty"` + // When a node is inactive (does not vote at all) + // A point is added, after a certain amount of points + // is reached the node gets kicked out. + Points uint64 `protobuf:"varint,4,opt,name=points,proto3" json:"points,omitempty"` + // isLeaving indicates if a staker is leaving the given pool. + IsLeaving bool `protobuf:"varint,5,opt,name=is_leaving,json=isLeaving,proto3" json:"is_leaving,omitempty"` +} + +func (m *Valaccount) Reset() { *m = Valaccount{} } +func (m *Valaccount) String() string { return proto.CompactTextString(m) } +func (*Valaccount) ProtoMessage() {} +func (*Valaccount) Descriptor() ([]byte, []int) { + return fileDescriptor_d209d1a2a74d375d, []int{1} +} +func (m *Valaccount) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Valaccount) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Valaccount.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 *Valaccount) XXX_Merge(src proto.Message) { + xxx_messageInfo_Valaccount.Merge(m, src) +} +func (m *Valaccount) XXX_Size() int { + return m.Size() +} +func (m *Valaccount) XXX_DiscardUnknown() { + xxx_messageInfo_Valaccount.DiscardUnknown(m) +} + +var xxx_messageInfo_Valaccount proto.InternalMessageInfo + +func (m *Valaccount) GetPoolId() uint64 { + if m != nil { + return m.PoolId + } + return 0 +} + +func (m *Valaccount) GetStaker() string { + if m != nil { + return m.Staker + } + return "" +} + +func (m *Valaccount) GetValaddress() string { + if m != nil { + return m.Valaddress + } + return "" +} + +func (m *Valaccount) GetPoints() uint64 { + if m != nil { + return m.Points + } + return 0 +} + +func (m *Valaccount) GetIsLeaving() bool { + if m != nil { + return m.IsLeaving + } + return false +} + +// CommissionChangeEntry 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 CommissionChangeEntry 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 cosmossdk_io_math.LegacyDec `protobuf:"bytes,3,opt,name=commission,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"commission"` + // 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 *CommissionChangeEntry) Reset() { *m = CommissionChangeEntry{} } +func (m *CommissionChangeEntry) String() string { return proto.CompactTextString(m) } +func (*CommissionChangeEntry) ProtoMessage() {} +func (*CommissionChangeEntry) Descriptor() ([]byte, []int) { + return fileDescriptor_d209d1a2a74d375d, []int{2} +} +func (m *CommissionChangeEntry) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *CommissionChangeEntry) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_CommissionChangeEntry.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 *CommissionChangeEntry) XXX_Merge(src proto.Message) { + xxx_messageInfo_CommissionChangeEntry.Merge(m, src) +} +func (m *CommissionChangeEntry) XXX_Size() int { + return m.Size() +} +func (m *CommissionChangeEntry) XXX_DiscardUnknown() { + xxx_messageInfo_CommissionChangeEntry.DiscardUnknown(m) +} + +var xxx_messageInfo_CommissionChangeEntry proto.InternalMessageInfo + +func (m *CommissionChangeEntry) GetIndex() uint64 { + if m != nil { + return m.Index + } + return 0 +} + +func (m *CommissionChangeEntry) GetStaker() string { + if m != nil { + return m.Staker + } + return "" +} + +func (m *CommissionChangeEntry) GetCreationDate() int64 { + if m != nil { + return m.CreationDate + } + return 0 +} + +// LeavePoolEntry stores the information for an upcoming +// pool leave. A staker can't leave a pool instantly. +// Instead a the `LeaveTime` needs to be awaited. +// If a staker start to leave a pool, it will be shown +// in the UI to the delegators. +type LeavePoolEntry 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"` + // pool_id indicates the pool the staker wants to leave + PoolId uint64 `protobuf:"varint,3,opt,name=pool_id,json=poolId,proto3" json:"pool_id,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 *LeavePoolEntry) Reset() { *m = LeavePoolEntry{} } +func (m *LeavePoolEntry) String() string { return proto.CompactTextString(m) } +func (*LeavePoolEntry) ProtoMessage() {} +func (*LeavePoolEntry) Descriptor() ([]byte, []int) { + return fileDescriptor_d209d1a2a74d375d, []int{3} +} +func (m *LeavePoolEntry) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *LeavePoolEntry) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_LeavePoolEntry.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 *LeavePoolEntry) XXX_Merge(src proto.Message) { + xxx_messageInfo_LeavePoolEntry.Merge(m, src) +} +func (m *LeavePoolEntry) XXX_Size() int { + return m.Size() +} +func (m *LeavePoolEntry) XXX_DiscardUnknown() { + xxx_messageInfo_LeavePoolEntry.DiscardUnknown(m) +} + +var xxx_messageInfo_LeavePoolEntry proto.InternalMessageInfo + +func (m *LeavePoolEntry) GetIndex() uint64 { + if m != nil { + return m.Index + } + return 0 +} + +func (m *LeavePoolEntry) GetStaker() string { + if m != nil { + return m.Staker + } + return "" +} + +func (m *LeavePoolEntry) GetPoolId() uint64 { + if m != nil { + return m.PoolId + } + return 0 +} + +func (m *LeavePoolEntry) GetCreationDate() int64 { + if m != nil { + return m.CreationDate + } + return 0 +} + +// UnbondingState stores the state for the unbonding of stakes and delegations. +type QueueState struct { + // low_index is the tail of the queue. It is the + // oldest entry in the queue. If this entry isn't + // due, non of the other entries is. + LowIndex uint64 `protobuf:"varint,1,opt,name=low_index,json=lowIndex,proto3" json:"low_index,omitempty"` + // high_index is the head of the queue. New entries + // are added to the top. + HighIndex uint64 `protobuf:"varint,2,opt,name=high_index,json=highIndex,proto3" json:"high_index,omitempty"` +} + +func (m *QueueState) Reset() { *m = QueueState{} } +func (m *QueueState) String() string { return proto.CompactTextString(m) } +func (*QueueState) ProtoMessage() {} +func (*QueueState) Descriptor() ([]byte, []int) { + return fileDescriptor_d209d1a2a74d375d, []int{4} +} +func (m *QueueState) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueueState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueueState.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 *QueueState) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueueState.Merge(m, src) +} +func (m *QueueState) XXX_Size() int { + return m.Size() +} +func (m *QueueState) XXX_DiscardUnknown() { + xxx_messageInfo_QueueState.DiscardUnknown(m) +} + +var xxx_messageInfo_QueueState proto.InternalMessageInfo + +func (m *QueueState) GetLowIndex() uint64 { + if m != nil { + return m.LowIndex + } + return 0 +} + +func (m *QueueState) GetHighIndex() uint64 { + if m != nil { + return m.HighIndex + } + return 0 +} + +func init() { + proto.RegisterType((*Staker)(nil), "kyve.stakers.legacy.Staker") + proto.RegisterType((*Valaccount)(nil), "kyve.stakers.legacy.Valaccount") + proto.RegisterType((*CommissionChangeEntry)(nil), "kyve.stakers.legacy.CommissionChangeEntry") + proto.RegisterType((*LeavePoolEntry)(nil), "kyve.stakers.legacy.LeavePoolEntry") + proto.RegisterType((*QueueState)(nil), "kyve.stakers.legacy.QueueState") +} + +func init() { + proto.RegisterFile("kyve/stakers/legacy/stakers.proto", fileDescriptor_d209d1a2a74d375d) +} + +var fileDescriptor_d209d1a2a74d375d = []byte{ + // 536 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x53, 0xcb, 0x6a, 0xdb, 0x40, + 0x14, 0xb5, 0x62, 0xc7, 0x8f, 0x4b, 0x9f, 0x83, 0xdb, 0x8a, 0x84, 0x28, 0xc1, 0xd9, 0xa4, 0xd0, + 0x5a, 0x84, 0xfe, 0x41, 0x9c, 0x94, 0x86, 0x86, 0xd2, 0x2a, 0x10, 0x68, 0x37, 0x66, 0x3c, 0xba, + 0x48, 0x83, 0x25, 0x8d, 0xd1, 0x8c, 0xed, 0x08, 0xfa, 0x11, 0x5d, 0xf4, 0x2f, 0xba, 0xe8, 0x6f, + 0x64, 0x99, 0x65, 0xe9, 0x22, 0x14, 0xfb, 0x47, 0xca, 0xcc, 0x48, 0x8e, 0xb3, 0x28, 0x94, 0xec, + 0x74, 0x1e, 0xba, 0xf7, 0x70, 0x2e, 0x03, 0xbd, 0x71, 0x31, 0x43, 0x5f, 0x2a, 0x3a, 0xc6, 0x5c, + 0xfa, 0xb3, 0xc3, 0x11, 0x2a, 0x7a, 0x58, 0xe1, 0xfe, 0x24, 0x17, 0x4a, 0x90, 0xae, 0xf6, 0xf4, + 0x2b, 0xae, 0xf4, 0x6c, 0x75, 0x23, 0x11, 0x09, 0x63, 0xf0, 0xf5, 0x97, 0xf5, 0xf6, 0x7e, 0x6c, + 0x40, 0xf3, 0xdc, 0x38, 0x89, 0x0b, 0x2d, 0x1a, 0x86, 0x39, 0x4a, 0xe9, 0x3a, 0x7b, 0xce, 0x41, + 0x27, 0xa8, 0x20, 0x19, 0x00, 0x30, 0x91, 0xa6, 0x5c, 0x4a, 0x2e, 0x32, 0x77,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6f, 0xfe, 0x06, 0x00, 0x00, 0xff, 0xff, + 0xcb, 0x5e, 0xbc, 0x8d, 0xdf, 0x03, 0x00, 0x00, +} + +func (m *Staker) 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 *Staker) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Staker) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.CommissionRewards != 0 { + i = encodeVarintStakers(dAtA, i, uint64(m.CommissionRewards)) + i-- + dAtA[i] = 0x40 + } + if len(m.Details) > 0 { + i -= len(m.Details) + copy(dAtA[i:], m.Details) + i = encodeVarintStakers(dAtA, i, uint64(len(m.Details))) + i-- + dAtA[i] = 0x3a + } + if len(m.SecurityContact) > 0 { + i -= len(m.SecurityContact) + copy(dAtA[i:], m.SecurityContact) + i = encodeVarintStakers(dAtA, i, uint64(len(m.SecurityContact))) + i-- + dAtA[i] = 0x32 + } + if len(m.Identity) > 0 { + i -= len(m.Identity) + copy(dAtA[i:], m.Identity) + i = encodeVarintStakers(dAtA, i, uint64(len(m.Identity))) + i-- + dAtA[i] = 0x2a + } + if len(m.Website) > 0 { + i -= len(m.Website) + copy(dAtA[i:], m.Website) + i = encodeVarintStakers(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 = encodeVarintStakers(dAtA, i, uint64(len(m.Moniker))) + i-- + dAtA[i] = 0x1a + } + { + size := m.Commission.Size() + i -= size + if _, err := m.Commission.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintStakers(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if len(m.Address) > 0 { + i -= len(m.Address) + copy(dAtA[i:], m.Address) + i = encodeVarintStakers(dAtA, i, uint64(len(m.Address))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Valaccount) 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 *Valaccount) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Valaccount) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.IsLeaving { + i-- + if m.IsLeaving { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x28 + } + if m.Points != 0 { + i = encodeVarintStakers(dAtA, i, uint64(m.Points)) + i-- + dAtA[i] = 0x20 + } + if len(m.Valaddress) > 0 { + i -= len(m.Valaddress) + copy(dAtA[i:], m.Valaddress) + i = encodeVarintStakers(dAtA, i, uint64(len(m.Valaddress))) + i-- + dAtA[i] = 0x1a + } + if len(m.Staker) > 0 { + i -= len(m.Staker) + copy(dAtA[i:], m.Staker) + i = encodeVarintStakers(dAtA, i, uint64(len(m.Staker))) + i-- + dAtA[i] = 0x12 + } + if m.PoolId != 0 { + i = encodeVarintStakers(dAtA, i, uint64(m.PoolId)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *CommissionChangeEntry) 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 *CommissionChangeEntry) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *CommissionChangeEntry) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.CreationDate != 0 { + i = encodeVarintStakers(dAtA, i, uint64(m.CreationDate)) + i-- + dAtA[i] = 0x20 + } + { + size := m.Commission.Size() + i -= size + if _, err := m.Commission.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintStakers(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + if len(m.Staker) > 0 { + i -= len(m.Staker) + copy(dAtA[i:], m.Staker) + i = encodeVarintStakers(dAtA, i, uint64(len(m.Staker))) + i-- + dAtA[i] = 0x12 + } + if m.Index != 0 { + i = encodeVarintStakers(dAtA, i, uint64(m.Index)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *LeavePoolEntry) 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 *LeavePoolEntry) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *LeavePoolEntry) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.CreationDate != 0 { + i = encodeVarintStakers(dAtA, i, uint64(m.CreationDate)) + i-- + dAtA[i] = 0x20 + } + if m.PoolId != 0 { + i = encodeVarintStakers(dAtA, i, uint64(m.PoolId)) + i-- + dAtA[i] = 0x18 + } + if len(m.Staker) > 0 { + i -= len(m.Staker) + copy(dAtA[i:], m.Staker) + i = encodeVarintStakers(dAtA, i, uint64(len(m.Staker))) + i-- + dAtA[i] = 0x12 + } + if m.Index != 0 { + i = encodeVarintStakers(dAtA, i, uint64(m.Index)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *QueueState) 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 *QueueState) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueueState) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.HighIndex != 0 { + i = encodeVarintStakers(dAtA, i, uint64(m.HighIndex)) + i-- + dAtA[i] = 0x10 + } + if m.LowIndex != 0 { + i = encodeVarintStakers(dAtA, i, uint64(m.LowIndex)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func encodeVarintStakers(dAtA []byte, offset int, v uint64) int { + offset -= sovStakers(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *Staker) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Address) + if l > 0 { + n += 1 + l + sovStakers(uint64(l)) + } + l = m.Commission.Size() + n += 1 + l + sovStakers(uint64(l)) + l = len(m.Moniker) + if l > 0 { + n += 1 + l + sovStakers(uint64(l)) + } + l = len(m.Website) + if l > 0 { + n += 1 + l + sovStakers(uint64(l)) + } + l = len(m.Identity) + if l > 0 { + n += 1 + l + sovStakers(uint64(l)) + } + l = len(m.SecurityContact) + if l > 0 { + n += 1 + l + sovStakers(uint64(l)) + } + l = len(m.Details) + if l > 0 { + n += 1 + l + sovStakers(uint64(l)) + } + if m.CommissionRewards != 0 { + n += 1 + sovStakers(uint64(m.CommissionRewards)) + } + return n +} + +func (m *Valaccount) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.PoolId != 0 { + n += 1 + sovStakers(uint64(m.PoolId)) + } + l = len(m.Staker) + if l > 0 { + n += 1 + l + sovStakers(uint64(l)) + } + l = len(m.Valaddress) + if l > 0 { + n += 1 + l + sovStakers(uint64(l)) + } + if m.Points != 0 { + n += 1 + sovStakers(uint64(m.Points)) + } + if m.IsLeaving { + n += 2 + } + return n +} + +func (m *CommissionChangeEntry) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Index != 0 { + n += 1 + sovStakers(uint64(m.Index)) + } + l = len(m.Staker) + if l > 0 { + n += 1 + l + sovStakers(uint64(l)) + } + l = m.Commission.Size() + n += 1 + l + sovStakers(uint64(l)) + if m.CreationDate != 0 { + n += 1 + sovStakers(uint64(m.CreationDate)) + } + return n +} + +func (m *LeavePoolEntry) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Index != 0 { + n += 1 + sovStakers(uint64(m.Index)) + } + l = len(m.Staker) + if l > 0 { + n += 1 + l + sovStakers(uint64(l)) + } + if m.PoolId != 0 { + n += 1 + sovStakers(uint64(m.PoolId)) + } + if m.CreationDate != 0 { + n += 1 + sovStakers(uint64(m.CreationDate)) + } + return n +} + +func (m *QueueState) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.LowIndex != 0 { + n += 1 + sovStakers(uint64(m.LowIndex)) + } + if m.HighIndex != 0 { + n += 1 + sovStakers(uint64(m.HighIndex)) + } + return n +} + +func sovStakers(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozStakers(x uint64) (n int) { + return sovStakers(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Staker) 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 ErrIntOverflowStakers + } + 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: Staker: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Staker: 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 ErrIntOverflowStakers + } + 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 ErrInvalidLengthStakers + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthStakers + } + 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 ErrIntOverflowStakers + } + 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 ErrInvalidLengthStakers + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthStakers + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Commission.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + 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 ErrIntOverflowStakers + } + 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 ErrInvalidLengthStakers + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthStakers + } + 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 ErrIntOverflowStakers + } + 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 ErrInvalidLengthStakers + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthStakers + } + 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 Identity", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStakers + } + 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 ErrInvalidLengthStakers + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthStakers + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Identity = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SecurityContact", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStakers + } + 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 ErrInvalidLengthStakers + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthStakers + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SecurityContact = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Details", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStakers + } + 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 ErrInvalidLengthStakers + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthStakers + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Details = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 8: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field CommissionRewards", wireType) + } + m.CommissionRewards = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStakers + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.CommissionRewards |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipStakers(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthStakers + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Valaccount) 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 ErrIntOverflowStakers + } + 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: Valaccount: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Valaccount: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field PoolId", wireType) + } + m.PoolId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStakers + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.PoolId |= 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 ErrIntOverflowStakers + } + 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 ErrInvalidLengthStakers + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthStakers + } + 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 Valaddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStakers + } + 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 ErrInvalidLengthStakers + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthStakers + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Valaddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Points", wireType) + } + m.Points = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStakers + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Points |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field IsLeaving", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStakers + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.IsLeaving = bool(v != 0) + default: + iNdEx = preIndex + skippy, err := skipStakers(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthStakers + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *CommissionChangeEntry) 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 ErrIntOverflowStakers + } + 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: CommissionChangeEntry: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CommissionChangeEntry: 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 ErrIntOverflowStakers + } + 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 ErrIntOverflowStakers + } + 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 ErrInvalidLengthStakers + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthStakers + } + 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 ErrIntOverflowStakers + } + 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 ErrInvalidLengthStakers + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthStakers + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Commission.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + 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 ErrIntOverflowStakers + } + 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 := skipStakers(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthStakers + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *LeavePoolEntry) 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 ErrIntOverflowStakers + } + 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: LeavePoolEntry: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: LeavePoolEntry: 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 ErrIntOverflowStakers + } + 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 ErrIntOverflowStakers + } + 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 ErrInvalidLengthStakers + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthStakers + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Staker = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field PoolId", wireType) + } + m.PoolId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStakers + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.PoolId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + 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 ErrIntOverflowStakers + } + 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 := skipStakers(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthStakers + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueueState) 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 ErrIntOverflowStakers + } + 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: QueueState: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueueState: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field LowIndex", wireType) + } + m.LowIndex = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStakers + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.LowIndex |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field HighIndex", wireType) + } + m.HighIndex = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStakers + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.HighIndex |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipStakers(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthStakers + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipStakers(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, ErrIntOverflowStakers + } + 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, ErrIntOverflowStakers + } + 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, ErrIntOverflowStakers + } + 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, ErrInvalidLengthStakers + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupStakers + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthStakers + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthStakers = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowStakers = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupStakers = fmt.Errorf("proto: unexpected end of group") +) diff --git a/docs/static/openapi.yml b/docs/static/openapi.yml index 76f8394c..28e6a2ca 100644 --- a/docs/static/openapi.yml +++ b/docs/static/openapi.yml @@ -694,7 +694,6 @@ paths: title: logo of the pool inflation_share_weight: type: string - format: uint64 title: >- inflation_share_weight is the base payout for each bundle reward @@ -1127,7 +1126,6 @@ paths: title: logo of the pool inflation_share_weight: type: string - format: uint64 title: >- inflation_share_weight is the base payout for each bundle reward @@ -4028,7 +4026,6 @@ paths: title: logo of the pool inflation_share_weight: type: string - format: uint64 title: >- inflation_share_weight is the base payout for each bundle reward @@ -5054,7 +5051,6 @@ paths: description: upload_interval ... inflation_share_weight: type: string - format: uint64 description: inflation_share_weight ... min_delegation: type: string @@ -5642,7 +5638,6 @@ paths: description: upload_interval ... inflation_share_weight: type: string - format: uint64 description: inflation_share_weight ... min_delegation: type: string @@ -6403,7 +6398,6 @@ paths: title: logo of the pool inflation_share_weight: type: string - format: uint64 title: >- inflation_share_weight is the base payout for each bundle reward @@ -6861,7 +6855,6 @@ paths: title: logo of the pool inflation_share_weight: type: string - format: uint64 title: >- inflation_share_weight is the base payout for each bundle reward @@ -7430,7 +7423,6 @@ paths: title: logo of the pool inflation_share_weight: type: string - format: uint64 title: >- inflation_share_weight is the base payout for each bundle reward @@ -7932,7 +7924,6 @@ paths: title: logo of the pool inflation_share_weight: type: string - format: uint64 title: >- inflation_share_weight is the base payout for each bundle reward diff --git a/proto/kyve/pool/v1beta1/events.proto b/proto/kyve/pool/v1beta1/events.proto index 9b060641..e15c453b 100644 --- a/proto/kyve/pool/v1beta1/events.proto +++ b/proto/kyve/pool/v1beta1/events.proto @@ -40,7 +40,10 @@ message EventCreatePool { uint64 upload_interval = 7; // inflation_share_weight is the fixed cost which gets paid out // to every successful uploader - uint64 inflation_share_weight = 8; + string inflation_share_weight = 8 [ + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", + (gogoproto.nullable) = false + ]; // min_delegation is the minimum amount of $KYVE the pool has // to have in order to produce bundles uint64 min_delegation = 9; @@ -126,7 +129,10 @@ message EventPoolUpdated { uint64 upload_interval = 7; // inflation_share_weight is the fixed cost which gets paid out // to every successful uploader - uint64 inflation_share_weight = 8; + string inflation_share_weight = 8 [ + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", + (gogoproto.nullable) = false + ]; // min_delegation is the minimum amount of $KYVE the pool has // to have in order to produce bundles uint64 min_delegation = 9; diff --git a/proto/kyve/pool/v1beta1/pool.proto b/proto/kyve/pool/v1beta1/pool.proto index 6989df43..bf5730d9 100644 --- a/proto/kyve/pool/v1beta1/pool.proto +++ b/proto/kyve/pool/v1beta1/pool.proto @@ -93,7 +93,10 @@ message Pool { // upload_interval ... uint64 upload_interval = 11; // inflation_share_weight ... - uint64 inflation_share_weight = 12; + string inflation_share_weight = 12 [ + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", + (gogoproto.nullable) = false + ]; // min_delegation ... uint64 min_delegation = 13; // max_bundle_size ... diff --git a/proto/kyve/pool/v1beta1/tx.proto b/proto/kyve/pool/v1beta1/tx.proto index 5b20a63a..4068ab6c 100644 --- a/proto/kyve/pool/v1beta1/tx.proto +++ b/proto/kyve/pool/v1beta1/tx.proto @@ -4,6 +4,7 @@ package kyve.pool.v1beta1; import "cosmos/msg/v1/msg.proto"; import "cosmos_proto/cosmos.proto"; +import "gogoproto/gogo.proto"; option go_package = "github.com/KYVENetwork/chain/x/pool/types"; @@ -51,7 +52,10 @@ message MsgCreatePool { // upload_interval ... uint64 upload_interval = 7; // inflation_share_weight ... - uint64 inflation_share_weight = 8; + string inflation_share_weight = 8 [ + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", + (gogoproto.nullable) = false + ]; // min_delegation ... uint64 min_delegation = 9; // max_bundle_size ... diff --git a/proto/kyve/query/v1beta1/query.proto b/proto/kyve/query/v1beta1/query.proto index 7181f232..18a0dd2b 100644 --- a/proto/kyve/query/v1beta1/query.proto +++ b/proto/kyve/query/v1beta1/query.proto @@ -41,7 +41,10 @@ message BasicPool { string logo = 4; // inflation_share_weight is the base payout for each bundle reward - uint64 inflation_share_weight = 5; + string inflation_share_weight = 5 [ + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", + (gogoproto.nullable) = false + ]; // upload_interval is the interval bundles get created uint64 upload_interval = 6; diff --git a/x/bundles/abci.go b/x/bundles/abci.go index 243583e0..0dbf3180 100644 --- a/x/bundles/abci.go +++ b/x/bundles/abci.go @@ -41,17 +41,17 @@ func SplitInflation(ctx sdk.Context, k bundlesKeeper.Keeper, bk util.BankKeeper, distributed := uint64(0) // calculate total inflation share weight of pools to get each pool's reward share - totalInflationShareWeight := uint64(0) + totalInflationShareWeight := math.LegacyZeroDec() for _, pool := range pk.GetAllPools(ctx) { // only include active pools if err := k.AssertPoolCanRun(ctx, pool.Id); err == nil { - totalInflationShareWeight += pool.InflationShareWeight + totalInflationShareWeight = totalInflationShareWeight.Add(pool.InflationShareWeight) } } // if the total inflation share weight is zero all rewards go the chain - if totalInflationShareWeight == 0 { + if totalInflationShareWeight.IsZero() { return } @@ -59,8 +59,8 @@ func SplitInflation(ctx sdk.Context, k bundlesKeeper.Keeper, bk util.BankKeeper, // only include active pools if err := k.AssertPoolCanRun(ctx, pool.Id); err == nil { // calculate pool share based of inflation share weight - amount := uint64(math.LegacyNewDec(int64(pool.InflationShareWeight)). - Quo(math.LegacyNewDec(int64(totalInflationShareWeight))). + amount := uint64(pool.InflationShareWeight. + Quo(totalInflationShareWeight). Mul(math.LegacyNewDec(protocolBlockProvision)). TruncateInt64()) diff --git a/x/bundles/keeper/abci_protocol_split_test.go b/x/bundles/keeper/abci_protocol_split_test.go index ba1280cc..d0c1da2f 100644 --- a/x/bundles/keeper/abci_protocol_split_test.go +++ b/x/bundles/keeper/abci_protocol_split_test.go @@ -44,7 +44,7 @@ var _ = Describe("abci.go", Ordered, func() { Config: "ar://DgdB-2hLrxjhyEEbCML__dgZN5_uS7T6Z5XDkaFh3P0", StartKey: "0", UploadInterval: 60, - InflationShareWeight: 1_000_000, + InflationShareWeight: math.LegacyNewDec(1_000_000), MinDelegation: 100 * i.KYVE, MaxBundleSize: 100, Version: "0.0.0", @@ -124,7 +124,7 @@ var _ = Describe("abci.go", Ordered, func() { Config: "ar://DgdB-2hLrxjhyEEbCML__dgZN5_uS7T6Z5XDkaFh3P0", StartKey: "0", UploadInterval: 60, - InflationShareWeight: 2_000_000, + InflationShareWeight: math.LegacyNewDec(2_000_000), MinDelegation: 100 * i.KYVE, MaxBundleSize: 100, Version: "0.0.0", @@ -191,7 +191,7 @@ var _ = Describe("abci.go", Ordered, func() { Config: "ar://DgdB-2hLrxjhyEEbCML__dgZN5_uS7T6Z5XDkaFh3P0", StartKey: "0", UploadInterval: 60, - InflationShareWeight: 0, + InflationShareWeight: math.LegacyZeroDec(), MinDelegation: 100 * i.KYVE, MaxBundleSize: 100, Version: "0.0.0", @@ -240,7 +240,7 @@ var _ = Describe("abci.go", Ordered, func() { It("every pool has zero inflation share weight", func() { // ARRANGE pool1, _ := s.App().PoolKeeper.GetPool(s.Ctx(), 0) - pool1.InflationShareWeight = 0 + pool1.InflationShareWeight = math.LegacyZeroDec() s.App().PoolKeeper.SetPool(s.Ctx(), pool1) msg := &pooltypes.MsgCreatePool{ @@ -251,7 +251,7 @@ var _ = Describe("abci.go", Ordered, func() { Config: "ar://DgdB-2hLrxjhyEEbCML__dgZN5_uS7T6Z5XDkaFh3P0", StartKey: "0", UploadInterval: 60, - InflationShareWeight: 0, + InflationShareWeight: math.LegacyZeroDec(), MinDelegation: 100 * i.KYVE, MaxBundleSize: 100, Version: "0.0.0", diff --git a/x/bundles/keeper/keeper_suite_dropped_bundles_test.go b/x/bundles/keeper/keeper_suite_dropped_bundles_test.go index 110735bf..3a1a4b31 100644 --- a/x/bundles/keeper/keeper_suite_dropped_bundles_test.go +++ b/x/bundles/keeper/keeper_suite_dropped_bundles_test.go @@ -1,6 +1,7 @@ package keeper_test import ( + "cosmossdk.io/math" funderstypes "github.com/KYVENetwork/chain/x/funders/types" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" @@ -42,7 +43,7 @@ var _ = Describe("dropped bundles", Ordered, func() { Config: "ar://DgdB-2hLrxjhyEEbCML__dgZN5_uS7T6Z5XDkaFh3P0", StartKey: "0", UploadInterval: 60, - InflationShareWeight: 10_000, + InflationShareWeight: math.LegacyNewDec(10_000), MinDelegation: 100 * i.KYVE, MaxBundleSize: 100, Version: "0.0.0", diff --git a/x/bundles/keeper/keeper_suite_funding_bundles_test.go b/x/bundles/keeper/keeper_suite_funding_bundles_test.go index 4db8e354..e8ff2a30 100644 --- a/x/bundles/keeper/keeper_suite_funding_bundles_test.go +++ b/x/bundles/keeper/keeper_suite_funding_bundles_test.go @@ -1,6 +1,7 @@ package keeper_test import ( + "cosmossdk.io/math" i "github.com/KYVENetwork/chain/testutil/integration" bundletypes "github.com/KYVENetwork/chain/x/bundles/types" funderstypes "github.com/KYVENetwork/chain/x/funders/types" @@ -50,7 +51,7 @@ var _ = Describe("funding bundles", Ordered, func() { Config: "ar://DgdB-2hLrxjhyEEbCML__dgZN5_uS7T6Z5XDkaFh3P0", StartKey: "0", UploadInterval: 60, - InflationShareWeight: 10_000, + InflationShareWeight: math.LegacyNewDec(10_000), MinDelegation: 100 * i.KYVE, MaxBundleSize: 100, Version: "0.0.0", diff --git a/x/bundles/keeper/keeper_suite_inflation_splitting_test.go b/x/bundles/keeper/keeper_suite_inflation_splitting_test.go index 0f572548..f136578a 100644 --- a/x/bundles/keeper/keeper_suite_inflation_splitting_test.go +++ b/x/bundles/keeper/keeper_suite_inflation_splitting_test.go @@ -8,6 +8,8 @@ import ( globalTypes "github.com/KYVENetwork/chain/x/global/types" pooltypes "github.com/KYVENetwork/chain/x/pool/types" stakertypes "github.com/KYVENetwork/chain/x/stakers/types" + teamTypes "github.com/KYVENetwork/chain/x/team/types" + "github.com/cosmos/cosmos-sdk/types" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" ) @@ -32,6 +34,10 @@ TEST CASES - inflation splitting * Produce a valid bundle with some insufficient funders and 10% inflation splitting * Produce a valid bundle with some insufficient funders and 100% inflation splitting +* Produce a valid bundle with no funders, 0% inflation splitting and 0 inflation-share-weight +* Produce a valid bundle with no funders, 10% inflation splitting and pool-0 = 0.1 weight and pool-1 = 1.0 weight +* Produce a valid bundle with no funders, 10% inflation splitting and pool-0 = 1.0 weight and pool-1 = 1.0 weight + */ var _ = Describe("inflation splitting", Ordered, func() { @@ -51,7 +57,7 @@ var _ = Describe("inflation splitting", Ordered, func() { Config: "ar://DgdB-2hLrxjhyEEbCML__dgZN5_uS7T6Z5XDkaFh3P0", StartKey: "0", UploadInterval: 60, - InflationShareWeight: 10_000, + InflationShareWeight: math.LegacyNewDec(10_000), MinDelegation: 100 * i.KYVE, MaxBundleSize: 100, Version: "0.0.0", @@ -106,6 +112,12 @@ var _ = Describe("inflation splitting", Ordered, func() { }) s.CommitAfterSeconds(60) + + // Important: Reset changes of global variables as they will not be reverted by the s.NewCleanChain() + originalTeamAllocation := teamTypes.TEAM_ALLOCATION + DeferCleanup(func() { + teamTypes.TEAM_ALLOCATION = originalTeamAllocation + }) }) AfterEach(func() { @@ -465,17 +477,17 @@ var _ = Describe("inflation splitting", Ordered, func() { totalPayout := pool.InflationShareWeight networkFee := s.App().BundlesKeeper.GetNetworkFee(s.Ctx()) - treasuryReward := uint64(math.LegacyNewDec(int64(totalPayout)).Mul(networkFee).TruncateInt64()) - storageReward := uint64(s.App().BundlesKeeper.GetStorageCost(s.Ctx(), pool.GetCurrentStorageProviderId()).MulInt64(100).TruncateInt64()) - totalUploaderReward := totalPayout - treasuryReward - storageReward + treasuryReward := totalPayout.Mul(networkFee) + storageReward := s.App().BundlesKeeper.GetStorageCost(s.Ctx(), pool.GetCurrentStorageProviderId()).MulInt64(100) + totalUploaderReward := totalPayout.Sub(treasuryReward).Sub(storageReward) - uploaderPayoutReward := uint64(math.LegacyNewDec(int64(totalUploaderReward)).Mul(uploader.Commission).TruncateInt64()) - uploaderDelegationReward := totalUploaderReward - uploaderPayoutReward + uploaderPayoutReward := totalUploaderReward.Mul(uploader.Commission) + uploaderDelegationReward := totalUploaderReward.Sub(uploaderPayoutReward) // assert commission rewards - Expect(uploader.CommissionRewards.AmountOf(globalTypes.Denom).Uint64()).To(Equal(uploaderPayoutReward + storageReward)) + Expect(uploader.CommissionRewards.AmountOf(globalTypes.Denom).ToLegacyDec()).To(Equal(uploaderPayoutReward.Add(storageReward))) // assert uploader self delegation rewards - Expect(s.App().DelegationKeeper.GetOutstandingRewards(s.Ctx(), i.STAKER_0, i.STAKER_0).AmountOf(globalTypes.Denom).Uint64()).To(Equal(uploaderDelegationReward)) + Expect(s.App().DelegationKeeper.GetOutstandingRewards(s.Ctx(), i.STAKER_0, i.STAKER_0).AmountOf(globalTypes.Denom).ToLegacyDec()).To(Equal(uploaderDelegationReward)) fundingState, _ := s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) @@ -534,7 +546,7 @@ var _ = Describe("inflation splitting", Ordered, func() { s.CommitAfterSeconds(60) - b1 := s.GetBalanceFromPool(0) + b1 := math.LegacyNewDec(int64(s.GetBalanceFromPool(0))) // ACT s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ @@ -559,30 +571,30 @@ var _ = Describe("inflation splitting", Ordered, func() { Expect(pool.CurrentKey).To(Equal("99")) // assert pool balance - b2 := s.GetBalanceFromPool(0) - Expect(b1).To(BeNumerically(">", b2)) + b2 := math.LegacyNewDec(int64(s.GetBalanceFromPool(0))) + Expect(b1.TruncateInt64()).To(BeNumerically(">", b2.TruncateInt64())) - payout := uint64(math.LegacyNewDec(int64(b1)).Mul(s.App().PoolKeeper.GetPoolInflationPayoutRate(s.Ctx())).TruncateInt64()) - Expect(b1 - b2).To(Equal(payout)) + payout := b1.Mul(s.App().PoolKeeper.GetPoolInflationPayoutRate(s.Ctx())).TruncateDec() + Expect(b1.Sub(b2)).To(Equal(payout)) // assert bundle reward uploader, _ := s.App().StakersKeeper.GetStaker(s.Ctx(), i.STAKER_0) // the total payout is the inflation share weight plus the inflation payout - totalPayout := pool.InflationShareWeight + payout + totalPayout := pool.InflationShareWeight.Add(payout) networkFee := s.App().BundlesKeeper.GetNetworkFee(s.Ctx()) - treasuryReward := uint64(math.LegacyNewDec(int64(totalPayout)).Mul(networkFee).TruncateInt64()) - storageReward := uint64(s.App().BundlesKeeper.GetStorageCost(s.Ctx(), pool.GetCurrentStorageProviderId()).MulInt64(100).TruncateInt64()) - totalUploaderReward := totalPayout - treasuryReward - storageReward + treasuryReward := totalPayout.Mul(networkFee).TruncateDec() + storageReward := s.App().BundlesKeeper.GetStorageCost(s.Ctx(), pool.GetCurrentStorageProviderId()).MulInt64(100).TruncateDec() + totalUploaderReward := totalPayout.Sub(treasuryReward).Sub(storageReward) - uploaderPayoutReward := uint64(math.LegacyNewDec(int64(totalUploaderReward)).Mul(uploader.Commission).TruncateInt64()) - uploaderDelegationReward := totalUploaderReward - uploaderPayoutReward + uploaderPayoutReward := totalUploaderReward.Mul(uploader.Commission).TruncateDec() + uploaderDelegationReward := totalUploaderReward.Sub(uploaderPayoutReward) // assert commission rewards - Expect(uploader.CommissionRewards.AmountOf(globalTypes.Denom).Uint64()).To(Equal(uploaderPayoutReward + storageReward)) + Expect(uploader.CommissionRewards.AmountOf(globalTypes.Denom).ToLegacyDec()).To(Equal(uploaderPayoutReward.Add(storageReward))) // assert uploader self delegation rewards - Expect(s.App().DelegationKeeper.GetOutstandingRewards(s.Ctx(), i.STAKER_0, i.STAKER_0).AmountOf(globalTypes.Denom).Uint64()).To(Equal(uploaderDelegationReward)) + Expect(s.App().DelegationKeeper.GetOutstandingRewards(s.Ctx(), i.STAKER_0, i.STAKER_0).AmountOf(globalTypes.Denom).ToLegacyDec()).To(Equal(uploaderDelegationReward)) fundingState, _ := s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) @@ -641,7 +653,7 @@ var _ = Describe("inflation splitting", Ordered, func() { s.CommitAfterSeconds(60) - b1 := s.GetBalanceFromPool(0) + b1 := math.LegacyNewDec(int64(s.GetBalanceFromPool(0))) // ACT s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ @@ -666,30 +678,30 @@ var _ = Describe("inflation splitting", Ordered, func() { Expect(pool.CurrentKey).To(Equal("99")) // assert pool balance - b2 := s.GetBalanceFromPool(0) - Expect(b1).To(BeNumerically(">", b2)) + b2 := math.LegacyNewDec(int64(s.GetBalanceFromPool(0))) + Expect(b1.TruncateInt64()).To(BeNumerically(">", b2.TruncateInt64())) - payout := uint64(math.LegacyNewDec(int64(b1)).Mul(s.App().PoolKeeper.GetPoolInflationPayoutRate(s.Ctx())).TruncateInt64()) - Expect(b1 - b2).To(Equal(payout)) + payout := b1.Mul(s.App().PoolKeeper.GetPoolInflationPayoutRate(s.Ctx())).TruncateDec() + Expect(b1.Sub(b2)).To(Equal(payout)) // assert bundle reward uploader, _ := s.App().StakersKeeper.GetStaker(s.Ctx(), i.STAKER_0) // the total payout is the inflation share weight plus the inflation payout - totalPayout := pool.InflationShareWeight + payout + totalPayout := pool.InflationShareWeight.Add(payout) networkFee := s.App().BundlesKeeper.GetNetworkFee(s.Ctx()) - treasuryReward := uint64(math.LegacyNewDec(int64(totalPayout)).Mul(networkFee).TruncateInt64()) - storageReward := uint64(s.App().BundlesKeeper.GetStorageCost(s.Ctx(), pool.GetCurrentStorageProviderId()).MulInt64(100).TruncateInt64()) - totalUploaderReward := totalPayout - treasuryReward - storageReward + treasuryReward := totalPayout.Mul(networkFee).TruncateDec() + storageReward := s.App().BundlesKeeper.GetStorageCost(s.Ctx(), pool.GetCurrentStorageProviderId()).MulInt64(100).TruncateDec() + totalUploaderReward := totalPayout.Sub(treasuryReward).Sub(storageReward) - uploaderPayoutReward := uint64(math.LegacyNewDec(int64(totalUploaderReward)).Mul(uploader.Commission).TruncateInt64()) - uploaderDelegationReward := totalUploaderReward - uploaderPayoutReward + uploaderPayoutReward := totalUploaderReward.Mul(uploader.Commission).TruncateDec() + uploaderDelegationReward := totalUploaderReward.Sub(uploaderPayoutReward) // assert commission rewards - Expect(uploader.CommissionRewards.AmountOf(globalTypes.Denom).Uint64()).To(Equal(uploaderPayoutReward + storageReward)) + Expect(uploader.CommissionRewards.AmountOf(globalTypes.Denom).ToLegacyDec()).To(Equal(uploaderPayoutReward.Add(storageReward))) // assert uploader self delegation rewards - Expect(s.App().DelegationKeeper.GetOutstandingRewards(s.Ctx(), i.STAKER_0, i.STAKER_0).AmountOf(globalTypes.Denom).Uint64()).To(Equal(uploaderDelegationReward)) + Expect(s.App().DelegationKeeper.GetOutstandingRewards(s.Ctx(), i.STAKER_0, i.STAKER_0).AmountOf(globalTypes.Denom).ToLegacyDec()).To(Equal(uploaderDelegationReward)) fundingState, _ := s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) @@ -781,20 +793,20 @@ var _ = Describe("inflation splitting", Ordered, func() { uploader, _ := s.App().StakersKeeper.GetStaker(s.Ctx(), i.STAKER_0) // the total payout is the total funds - totalPayout := uint64(300) + totalPayout := math.LegacyNewDec(300) networkFee := s.App().BundlesKeeper.GetNetworkFee(s.Ctx()) - treasuryReward := uint64(math.LegacyNewDec(int64(totalPayout)).Mul(networkFee).TruncateInt64()) - storageReward := uint64(s.App().BundlesKeeper.GetStorageCost(s.Ctx(), pool.GetCurrentStorageProviderId()).MulInt64(100).TruncateInt64()) - totalUploaderReward := totalPayout - treasuryReward - storageReward + treasuryReward := totalPayout.Mul(networkFee).TruncateDec() + storageReward := s.App().BundlesKeeper.GetStorageCost(s.Ctx(), pool.GetCurrentStorageProviderId()).MulInt64(100).TruncateDec() + totalUploaderReward := totalPayout.Sub(treasuryReward).Sub(storageReward) - uploaderPayoutReward := uint64(math.LegacyNewDec(int64(totalUploaderReward)).Mul(uploader.Commission).TruncateInt64()) - uploaderDelegationReward := totalUploaderReward - uploaderPayoutReward + uploaderPayoutReward := totalUploaderReward.Mul(uploader.Commission).TruncateDec() + uploaderDelegationReward := totalUploaderReward.Sub(uploaderPayoutReward) // assert commission rewards - Expect(uploader.CommissionRewards.AmountOf(globalTypes.Denom).Uint64()).To(Equal(uploaderPayoutReward + storageReward)) + Expect(uploader.CommissionRewards.AmountOf(globalTypes.Denom).ToLegacyDec()).To(Equal(uploaderPayoutReward.Add(storageReward))) // assert uploader self delegation rewards - Expect(s.App().DelegationKeeper.GetOutstandingRewards(s.Ctx(), i.STAKER_0, i.STAKER_0).AmountOf(globalTypes.Denom).Uint64()).To(Equal(uploaderDelegationReward)) + Expect(s.App().DelegationKeeper.GetOutstandingRewards(s.Ctx(), i.STAKER_0, i.STAKER_0).AmountOf(globalTypes.Denom).ToLegacyDec()).To(Equal(uploaderDelegationReward)) fundingState, _ := s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) @@ -853,7 +865,7 @@ var _ = Describe("inflation splitting", Ordered, func() { s.CommitAfterSeconds(60) - b1 := s.GetBalanceFromPool(0) + b1 := math.LegacyNewDec(int64(s.GetBalanceFromPool(0))) // ACT s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ @@ -878,30 +890,30 @@ var _ = Describe("inflation splitting", Ordered, func() { Expect(pool.CurrentKey).To(Equal("99")) // assert pool balance - b2 := s.GetBalanceFromPool(0) - Expect(b1).To(BeNumerically(">", b2)) + b2 := math.LegacyNewDec(int64(s.GetBalanceFromPool(0))) + Expect(b1.TruncateInt64()).To(BeNumerically(">", b2.TruncateInt64())) - payout := uint64(math.LegacyNewDec(int64(b1)).Mul(s.App().PoolKeeper.GetPoolInflationPayoutRate(s.Ctx())).TruncateInt64()) - Expect(b1 - b2).To(Equal(payout)) + payout := b1.Mul(s.App().PoolKeeper.GetPoolInflationPayoutRate(s.Ctx())).TruncateDec() + Expect(b1.Sub(b2)).To(Equal(payout)) // assert bundle reward uploader, _ := s.App().StakersKeeper.GetStaker(s.Ctx(), i.STAKER_0) // the total payout is the inflation share weight plus the inflation payout - totalPayout := 300 + payout + totalPayout := payout.Add(math.LegacyNewDec(300)) networkFee := s.App().BundlesKeeper.GetNetworkFee(s.Ctx()) - treasuryReward := uint64(math.LegacyNewDec(int64(totalPayout)).Mul(networkFee).TruncateInt64()) - storageReward := uint64(s.App().BundlesKeeper.GetStorageCost(s.Ctx(), pool.GetCurrentStorageProviderId()).MulInt64(100).TruncateInt64()) - totalUploaderReward := totalPayout - treasuryReward - storageReward + treasuryReward := totalPayout.Mul(networkFee).TruncateDec() + storageReward := s.App().BundlesKeeper.GetStorageCost(s.Ctx(), pool.GetCurrentStorageProviderId()).MulInt64(100).TruncateDec() + totalUploaderReward := totalPayout.Sub(treasuryReward).Sub(storageReward) - uploaderPayoutReward := uint64(math.LegacyNewDec(int64(totalUploaderReward)).Mul(uploader.Commission).TruncateInt64()) - uploaderDelegationReward := totalUploaderReward - uploaderPayoutReward + uploaderPayoutReward := totalUploaderReward.Mul(uploader.Commission).TruncateDec() + uploaderDelegationReward := totalUploaderReward.Sub(uploaderPayoutReward) // assert commission rewards - Expect(uploader.CommissionRewards.AmountOf(globalTypes.Denom).Uint64()).To(Equal(uploaderPayoutReward + storageReward)) + Expect(uploader.CommissionRewards.AmountOf(globalTypes.Denom).ToLegacyDec()).To(Equal(uploaderPayoutReward.Add(storageReward))) // assert uploader self delegation rewards - Expect(s.App().DelegationKeeper.GetOutstandingRewards(s.Ctx(), i.STAKER_0, i.STAKER_0).AmountOf(globalTypes.Denom).Uint64()).To(Equal(uploaderDelegationReward)) + Expect(s.App().DelegationKeeper.GetOutstandingRewards(s.Ctx(), i.STAKER_0, i.STAKER_0).AmountOf(globalTypes.Denom).ToLegacyDec()).To(Equal(uploaderDelegationReward)) fundingState, _ := s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) @@ -960,7 +972,7 @@ var _ = Describe("inflation splitting", Ordered, func() { s.CommitAfterSeconds(60) - b1 := s.GetBalanceFromPool(0) + b1 := math.LegacyNewDec(int64(s.GetBalanceFromPool(0))) // ACT s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ @@ -985,30 +997,30 @@ var _ = Describe("inflation splitting", Ordered, func() { Expect(pool.CurrentKey).To(Equal("99")) // assert pool balance - b2 := s.GetBalanceFromPool(0) - Expect(b1).To(BeNumerically(">", b2)) + b2 := math.LegacyNewDec(int64(s.GetBalanceFromPool(0))) + Expect(b1.TruncateInt64()).To(BeNumerically(">", b2.TruncateInt64())) - payout := uint64(math.LegacyNewDec(int64(b1)).Mul(s.App().PoolKeeper.GetPoolInflationPayoutRate(s.Ctx())).TruncateInt64()) - Expect(b1 - b2).To(Equal(payout)) + payout := b1.Mul(s.App().PoolKeeper.GetPoolInflationPayoutRate(s.Ctx())).TruncateDec() + Expect(b1.Sub(b2)).To(Equal(payout)) // assert bundle reward uploader, _ := s.App().StakersKeeper.GetStaker(s.Ctx(), i.STAKER_0) // the total payout is the inflation share weight plus the inflation payout - totalPayout := 300 + payout + totalPayout := payout.Add(math.LegacyNewDec(300)) networkFee := s.App().BundlesKeeper.GetNetworkFee(s.Ctx()) - treasuryReward := uint64(math.LegacyNewDec(int64(totalPayout)).Mul(networkFee).TruncateInt64()) - storageReward := uint64(s.App().BundlesKeeper.GetStorageCost(s.Ctx(), pool.GetCurrentStorageProviderId()).MulInt64(100).TruncateInt64()) - totalUploaderReward := totalPayout - treasuryReward - storageReward + treasuryReward := totalPayout.Mul(networkFee).TruncateDec() + storageReward := s.App().BundlesKeeper.GetStorageCost(s.Ctx(), pool.GetCurrentStorageProviderId()).MulInt64(100).TruncateDec() + totalUploaderReward := totalPayout.Sub(treasuryReward).Sub(storageReward) - uploaderPayoutReward := uint64(math.LegacyNewDec(int64(totalUploaderReward)).Mul(uploader.Commission).TruncateInt64()) - uploaderDelegationReward := totalUploaderReward - uploaderPayoutReward + uploaderPayoutReward := totalUploaderReward.Mul(uploader.Commission).TruncateDec() + uploaderDelegationReward := totalUploaderReward.Sub(uploaderPayoutReward) // assert commission rewards - Expect(uploader.CommissionRewards.AmountOf(globalTypes.Denom).Uint64()).To(Equal(uploaderPayoutReward + storageReward)) + Expect(uploader.CommissionRewards.AmountOf(globalTypes.Denom).ToLegacyDec()).To(Equal(uploaderPayoutReward.Add(storageReward))) // assert uploader self delegation rewards - Expect(s.App().DelegationKeeper.GetOutstandingRewards(s.Ctx(), i.STAKER_0, i.STAKER_0).AmountOf(globalTypes.Denom).Uint64()).To(Equal(uploaderDelegationReward)) + Expect(s.App().DelegationKeeper.GetOutstandingRewards(s.Ctx(), i.STAKER_0, i.STAKER_0).AmountOf(globalTypes.Denom).ToLegacyDec()).To(Equal(uploaderDelegationReward)) fundingState, _ := s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) @@ -1100,20 +1112,20 @@ var _ = Describe("inflation splitting", Ordered, func() { uploader, _ := s.App().StakersKeeper.GetStaker(s.Ctx(), i.STAKER_0) // the total payout is the total funds - totalPayout := (pool.InflationShareWeight / 2) + 200 + totalPayout := pool.InflationShareWeight.Quo(math.LegacyNewDec(2)).Add(math.LegacyNewDec(200)) networkFee := s.App().BundlesKeeper.GetNetworkFee(s.Ctx()) - treasuryReward := uint64(math.LegacyNewDec(int64(totalPayout)).Mul(networkFee).TruncateInt64()) - storageReward := uint64(s.App().BundlesKeeper.GetStorageCost(s.Ctx(), pool.GetCurrentStorageProviderId()).MulInt64(100).TruncateInt64()) - totalUploaderReward := totalPayout - treasuryReward - storageReward + treasuryReward := totalPayout.Mul(networkFee).TruncateDec() + storageReward := s.App().BundlesKeeper.GetStorageCost(s.Ctx(), pool.GetCurrentStorageProviderId()).MulInt64(100).TruncateDec() + totalUploaderReward := totalPayout.Sub(treasuryReward).Sub(storageReward) - uploaderPayoutReward := uint64(math.LegacyNewDec(int64(totalUploaderReward)).Mul(uploader.Commission).TruncateInt64()) - uploaderDelegationReward := totalUploaderReward - uploaderPayoutReward + uploaderPayoutReward := totalUploaderReward.Mul(uploader.Commission).TruncateDec() + uploaderDelegationReward := totalUploaderReward.Sub(uploaderPayoutReward) // assert commission rewards - Expect(uploader.CommissionRewards.AmountOf(globalTypes.Denom).Uint64()).To(Equal(uploaderPayoutReward + storageReward)) + Expect(uploader.CommissionRewards.AmountOf(globalTypes.Denom).ToLegacyDec()).To(Equal(uploaderPayoutReward.Add(storageReward))) // assert uploader self delegation rewards - Expect(s.App().DelegationKeeper.GetOutstandingRewards(s.Ctx(), i.STAKER_0, i.STAKER_0).AmountOf(globalTypes.Denom).Uint64()).To(Equal(uploaderDelegationReward)) + Expect(s.App().DelegationKeeper.GetOutstandingRewards(s.Ctx(), i.STAKER_0, i.STAKER_0).AmountOf(globalTypes.Denom).ToLegacyDec()).To(Equal(uploaderDelegationReward)) fundingState, _ := s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) @@ -1172,7 +1184,7 @@ var _ = Describe("inflation splitting", Ordered, func() { s.CommitAfterSeconds(60) - b1 := s.GetBalanceFromPool(0) + b1 := math.LegacyNewDec(int64(s.GetBalanceFromPool(0))) // ACT s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ @@ -1197,30 +1209,30 @@ var _ = Describe("inflation splitting", Ordered, func() { Expect(pool.CurrentKey).To(Equal("99")) // assert pool balance - b2 := s.GetBalanceFromPool(0) - Expect(b1).To(BeNumerically(">", b2)) + b2 := math.LegacyNewDec(int64(s.GetBalanceFromPool(0))) + Expect(b1.TruncateInt64()).To(BeNumerically(">", b2.TruncateInt64())) - payout := uint64(math.LegacyNewDec(int64(b1)).Mul(s.App().PoolKeeper.GetPoolInflationPayoutRate(s.Ctx())).TruncateInt64()) - Expect(b1 - b2).To(Equal(payout)) + payout := b1.Mul(s.App().PoolKeeper.GetPoolInflationPayoutRate(s.Ctx())).TruncateDec() + Expect(b1.Sub(b2)).To(Equal(payout)) // assert bundle reward uploader, _ := s.App().StakersKeeper.GetStaker(s.Ctx(), i.STAKER_0) // the total payout is the inflation share weight plus the inflation payout - totalPayout := (pool.InflationShareWeight / 2) + 200 + payout + totalPayout := pool.InflationShareWeight.Quo(math.LegacyNewDec(2)).Add(math.LegacyNewDec(200)).Add(payout) networkFee := s.App().BundlesKeeper.GetNetworkFee(s.Ctx()) - treasuryReward := uint64(math.LegacyNewDec(int64(totalPayout)).Mul(networkFee).TruncateInt64()) - storageReward := uint64(s.App().BundlesKeeper.GetStorageCost(s.Ctx(), pool.GetCurrentStorageProviderId()).MulInt64(100).TruncateInt64()) - totalUploaderReward := totalPayout - treasuryReward - storageReward + treasuryReward := totalPayout.Mul(networkFee).TruncateDec() + storageReward := s.App().BundlesKeeper.GetStorageCost(s.Ctx(), pool.GetCurrentStorageProviderId()).MulInt64(100).TruncateDec() + totalUploaderReward := totalPayout.Sub(treasuryReward).Sub(storageReward) - uploaderPayoutReward := uint64(math.LegacyNewDec(int64(totalUploaderReward)).Mul(uploader.Commission).TruncateInt64()) - uploaderDelegationReward := totalUploaderReward - uploaderPayoutReward + uploaderPayoutReward := totalUploaderReward.Mul(uploader.Commission).TruncateDec() + uploaderDelegationReward := totalUploaderReward.Sub(uploaderPayoutReward) // assert commission rewards - Expect(uploader.CommissionRewards.AmountOf(globalTypes.Denom).Uint64()).To(Equal(uploaderPayoutReward + storageReward)) + Expect(uploader.CommissionRewards.AmountOf(globalTypes.Denom).ToLegacyDec()).To(Equal(uploaderPayoutReward.Add(storageReward))) // assert uploader self delegation rewards - Expect(s.App().DelegationKeeper.GetOutstandingRewards(s.Ctx(), i.STAKER_0, i.STAKER_0).AmountOf(globalTypes.Denom).Uint64()).To(Equal(uploaderDelegationReward)) + Expect(s.App().DelegationKeeper.GetOutstandingRewards(s.Ctx(), i.STAKER_0, i.STAKER_0).AmountOf(globalTypes.Denom).ToLegacyDec()).To(Equal(uploaderDelegationReward)) fundingState, _ := s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) @@ -1279,7 +1291,7 @@ var _ = Describe("inflation splitting", Ordered, func() { s.CommitAfterSeconds(60) - b1 := s.GetBalanceFromPool(0) + b1 := math.LegacyNewDec(int64(s.GetBalanceFromPool(0))) // ACT s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ @@ -1304,30 +1316,30 @@ var _ = Describe("inflation splitting", Ordered, func() { Expect(pool.CurrentKey).To(Equal("99")) // assert pool balance - b2 := s.GetBalanceFromPool(0) - Expect(b1).To(BeNumerically(">", b2)) + b2 := math.LegacyNewDec(int64(s.GetBalanceFromPool(0))) + Expect(b1.TruncateInt64()).To(BeNumerically(">", b2.TruncateInt64())) - payout := uint64(math.LegacyNewDec(int64(b1)).Mul(s.App().PoolKeeper.GetPoolInflationPayoutRate(s.Ctx())).TruncateInt64()) - Expect(b1 - b2).To(Equal(payout)) + payout := b1.Mul(s.App().PoolKeeper.GetPoolInflationPayoutRate(s.Ctx())).TruncateDec() + Expect(b1.Sub(b2)).To(Equal(payout)) // assert bundle reward uploader, _ := s.App().StakersKeeper.GetStaker(s.Ctx(), i.STAKER_0) // the total payout is the inflation share weight plus the inflation payout - totalPayout := (pool.InflationShareWeight / 2) + 200 + payout + totalPayout := pool.InflationShareWeight.Quo(math.LegacyNewDec(2)).Add(math.LegacyNewDec(200)).Add(payout) networkFee := s.App().BundlesKeeper.GetNetworkFee(s.Ctx()) - treasuryReward := uint64(math.LegacyNewDec(int64(totalPayout)).Mul(networkFee).TruncateInt64()) - storageReward := uint64(s.App().BundlesKeeper.GetStorageCost(s.Ctx(), pool.GetCurrentStorageProviderId()).MulInt64(100).TruncateInt64()) - totalUploaderReward := totalPayout - treasuryReward - storageReward + treasuryReward := totalPayout.Mul(networkFee).TruncateDec() + storageReward := s.App().BundlesKeeper.GetStorageCost(s.Ctx(), pool.GetCurrentStorageProviderId()).MulInt64(100).TruncateDec() + totalUploaderReward := totalPayout.Sub(treasuryReward).Sub(storageReward) - uploaderPayoutReward := uint64(math.LegacyNewDec(int64(totalUploaderReward)).Mul(uploader.Commission).TruncateInt64()) - uploaderDelegationReward := totalUploaderReward - uploaderPayoutReward + uploaderPayoutReward := totalUploaderReward.Mul(uploader.Commission).TruncateDec() + uploaderDelegationReward := totalUploaderReward.Sub(uploaderPayoutReward) // assert commission rewards - Expect(uploader.CommissionRewards.AmountOf(globalTypes.Denom).Uint64()).To(Equal(uploaderPayoutReward + storageReward)) + Expect(uploader.CommissionRewards.AmountOf(globalTypes.Denom).ToLegacyDec()).To(Equal(uploaderPayoutReward.Add(storageReward))) // assert uploader self delegation rewards - Expect(s.App().DelegationKeeper.GetOutstandingRewards(s.Ctx(), i.STAKER_0, i.STAKER_0).AmountOf(globalTypes.Denom).Uint64()).To(Equal(uploaderDelegationReward)) + Expect(s.App().DelegationKeeper.GetOutstandingRewards(s.Ctx(), i.STAKER_0, i.STAKER_0).AmountOf(globalTypes.Denom).ToLegacyDec()).To(Equal(uploaderDelegationReward)) fundingState, _ := s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) @@ -1335,4 +1347,389 @@ var _ = Describe("inflation splitting", Ordered, func() { Expect(s.App().FundersKeeper.GetTotalActiveFunding(s.Ctx(), fundingState.PoolId)[0].Amount.Uint64()).To(Equal(100*i.KYVE - 5_000)) Expect(fundingState.ActiveFunderAddresses).To(HaveLen(1)) }) + + It("Produce a valid bundle with no funders, 0% inflation splitting and 0 inflation-share-weight", func() { + // ARRANGE + params := pooltypes.DefaultParams() + params.ProtocolInflationShare = math.LegacyMustNewDecFromStr("0") + params.PoolInflationPayoutRate = math.LegacyMustNewDecFromStr("0.1") + s.App().PoolKeeper.SetParams(s.Ctx(), params) + + pool, _ := s.App().PoolKeeper.GetPool(s.Ctx(), 0) + pool.InflationShareWeight = math.LegacyNewDec(0) + s.App().PoolKeeper.SetPool(s.Ctx(), pool) + + // mine some blocks + for i := 1; i < 100; i++ { + s.Commit() + } + + s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ + Creator: i.VALADDRESS_0_A, + Staker: i.STAKER_0, + PoolId: 0, + StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", + DataSize: 100, + DataHash: "test_hash", + FromIndex: 0, + BundleSize: 100, + FromKey: "0", + ToKey: "99", + BundleSummary: "test_value", + }) + + s.RunTxBundlesSuccess(&bundletypes.MsgVoteBundleProposal{ + Creator: i.VALADDRESS_1_A, + Staker: i.STAKER_1, + PoolId: 0, + StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", + Vote: 1, + }) + + s.CommitAfterSeconds(60) + + b1 := s.GetBalanceFromPool(0) + + // ACT + s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ + Creator: i.VALADDRESS_1_A, + Staker: i.STAKER_1, + PoolId: 0, + StorageId: "P9edn0bjEfMU_lecFDIPLvGO2v2ltpFNUMWp5kgPddg", + DataSize: 100, + DataHash: "test_hash2", + FromIndex: 100, + BundleSize: 100, + FromKey: "100", + ToKey: "199", + BundleSummary: "test_value2", + }) + + // ASSERT + pool, _ = s.App().PoolKeeper.GetPool(s.Ctx(), 0) + + // assert if bundle go finalized + Expect(pool.TotalBundles).To(Equal(uint64(1))) + Expect(pool.CurrentKey).To(Equal("99")) + + // assert pool balance + b2 := s.GetBalanceFromPool(0) + Expect(b1).To(BeZero()) + Expect(b2).To(BeZero()) + + // assert bundle reward + uploader, _ := s.App().StakersKeeper.GetStaker(s.Ctx(), i.STAKER_0) + + // assert commission rewards + Expect(uploader.CommissionRewards).To(BeEmpty()) + // assert uploader self delegation rewards + Expect(s.App().DelegationKeeper.GetOutstandingRewards(s.Ctx(), i.STAKER_0, i.STAKER_0)).To(BeEmpty()) + + fundingState, _ := s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) + + // assert total pool funds + Expect(s.App().FundersKeeper.GetTotalActiveFunding(s.Ctx(), fundingState.PoolId)).To(BeZero()) + Expect(fundingState.ActiveFunderAddresses).To(BeEmpty()) + }) + + It("Produce a valid bundle with no funders, 10% inflation splitting and pool-0 = 0.1 weight and pool-1 = 1.0 weight", func() { + // ARRANGE + + // Enable inflation share for pools + params := pooltypes.DefaultParams() + params.ProtocolInflationShare = math.LegacyMustNewDecFromStr("0.1") + params.PoolInflationPayoutRate = math.LegacyMustNewDecFromStr("0.1") + s.App().PoolKeeper.SetParams(s.Ctx(), params) + + // set team-share to zero to not interfere with inflation splitting + teamTypes.TEAM_ALLOCATION = 0 + _ = s.App().BankKeeper.SendCoinsFromModuleToAccount(s.Ctx(), "team", types.MustAccAddressFromBech32(i.CHARLIE), s.GetCoinsFromModule("team")) + + pool, _ := s.App().PoolKeeper.GetPool(s.Ctx(), 0) + pool.InflationShareWeight = math.LegacyMustNewDecFromStr("0.1") + s.App().PoolKeeper.SetPool(s.Ctx(), pool) + + // Add a second pool + gov := s.App().GovKeeper.GetGovernanceAccount(s.Ctx()).GetAddress().String() + msg := &pooltypes.MsgCreatePool{ + Authority: gov, + Name: "PoolTest 2", + Runtime: "@kyve/test", + Logo: "ar://Tewyv2P5VEG8EJ6AUQORdqNTectY9hlOrWPK8wwo-aU", + Config: "ar://DgdB-2hLrxjhyEEbCML__dgZN5_uS7T6Z5XDkaFh3P0", + StartKey: "0", + UploadInterval: 60, + InflationShareWeight: math.LegacyMustNewDecFromStr("1"), + MinDelegation: 100 * i.KYVE, + MaxBundleSize: 100, + Version: "0.0.0", + Binaries: "{}", + StorageProviderId: 2, + CompressionId: 1, + } + s.RunTxPoolSuccess(msg) + + s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ + Creator: i.STAKER_0, + PoolId: 1, + Valaddress: i.VALADDRESS_0_B, + }) + s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ + Creator: i.STAKER_1, + PoolId: 1, + Valaddress: i.VALADDRESS_1_B, + }) + + preMineBalance := s.App().BankKeeper.GetSupply(s.Ctx(), globalTypes.Denom) + // mine some blocks + for i := 1; i < 100; i++ { + s.Commit() + } + + s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ + Creator: i.VALADDRESS_0_A, + Staker: i.STAKER_0, + PoolId: 0, + StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", + DataSize: 100, + DataHash: "test_hash", + FromIndex: 0, + BundleSize: 100, + FromKey: "0", + ToKey: "99", + BundleSummary: "test_value", + }) + + s.RunTxBundlesSuccess(&bundletypes.MsgVoteBundleProposal{ + Creator: i.VALADDRESS_1_A, + Staker: i.STAKER_1, + PoolId: 0, + StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", + Vote: 1, + }) + + s.CommitAfterSeconds(60) + + postMineBalance := s.App().BankKeeper.GetSupply(s.Ctx(), globalTypes.Denom) + + // ACT + s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ + Creator: i.VALADDRESS_1_A, + Staker: i.STAKER_1, + PoolId: 0, + StorageId: "P9edn0bjEfMU_lecFDIPLvGO2v2ltpFNUMWp5kgPddg", + DataSize: 100, + DataHash: "test_hash2", + FromIndex: 100, + BundleSize: 100, + FromKey: "100", + ToKey: "199", + BundleSummary: "test_value2", + }) + + // ASSERT + + inflationAmount := postMineBalance.Sub(preMineBalance) + // Reward calculation: + // (inflationAmount - teamRewards) * protocolInflationShare -> Both pools equally + // (340112344399tkyve - 847940tkyve) * 0.1 -> rewards for both pools, but it is split according to the different weights + // teamAuthority rewards are hard to set to zero from this test-suite without using reflection. + // therefore we ignore the small amount. + Expect(inflationAmount.String()).To(Equal("340112344399tkyve")) + + // assert if bundle go finalized + pool, _ = s.App().PoolKeeper.GetPool(s.Ctx(), 0) + Expect(pool.TotalBundles).To(Equal(uint64(1))) + Expect(pool.CurrentKey).To(Equal("99")) + + // assert pool balance + finalBalancePool0 := s.GetBalanceFromPool(0) + finalBalancePool1 := s.GetBalanceFromPool(1) + // First pool has weight: 0.1, second pool has weight 1 + // additionally, pool-0 produced a bundle -> subtract PoolInflationPayoutRate (1 - 0.1 = 0.9) + // formula: (inflation - teamRewards) * inflationShare * inflationShareWeighOfPool * (1-PoolInflationPayoutRate) + // (340112344399 - 847940) * 0.1 * 1 / 11 * 0.9 + // Evaluates to 2782730425, however due to multiple roundings to actual amount is 2782730381 + // second pool + // (340112344399 - 847940) * 0.1 * 10 / 11 + // Evaluates to 30919226950 + Expect(finalBalancePool0).To(Equal(uint64(2782730381))) + Expect(finalBalancePool1).To(Equal(uint64(30919226950))) + + // assert bundle reward + uploader, _ := s.App().StakersKeeper.GetStaker(s.Ctx(), i.STAKER_0) + + // the total payout is here just the inflation payout + // (inflation - teamRewards)*inflationShare - balancePool0 - balancePool1 + // (340112344399 - 847940) * 0.1 * 1 / 11 * 0.1 + // evaluates to 309192269, due to multiple rounding: 309192264 + totalPayout := math.LegacyNewDec(309192264) + + networkFee := s.App().BundlesKeeper.GetNetworkFee(s.Ctx()) + treasuryReward := totalPayout.Mul(networkFee).TruncateDec() + storageReward := s.App().BundlesKeeper.GetStorageCost(s.Ctx(), pool.GetCurrentStorageProviderId()).MulInt64(100).TruncateDec() + totalUploaderReward := totalPayout.Sub(treasuryReward).Sub(storageReward) + + uploaderPayoutReward := totalUploaderReward.Mul(uploader.Commission).TruncateDec() + uploaderDelegationReward := totalUploaderReward.Sub(uploaderPayoutReward) + + // assert commission rewards + Expect(uploader.CommissionRewards.AmountOf(globalTypes.Denom).ToLegacyDec()).To(Equal(uploaderPayoutReward.Add(storageReward))) + // assert uploader self delegation rewards + Expect(s.App().DelegationKeeper.GetOutstandingRewards(s.Ctx(), i.STAKER_0, i.STAKER_0).AmountOf(globalTypes.Denom).ToLegacyDec()).To(Equal(uploaderDelegationReward)) + + fundingState, _ := s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) + + // assert total pool funds + Expect(s.App().FundersKeeper.GetTotalActiveFunding(s.Ctx(), fundingState.PoolId)).To(BeZero()) + Expect(fundingState.ActiveFunderAddresses).To(BeEmpty()) + }) + + It("Produce a valid bundle with no funders, 10% inflation splitting and pool-0 = 1.0 weight and pool-1 = 1.0 weight", func() { + // ARRANGE + + // Enable inflation share for pools + params := pooltypes.DefaultParams() + params.ProtocolInflationShare = math.LegacyMustNewDecFromStr("0.1") + params.PoolInflationPayoutRate = math.LegacyMustNewDecFromStr("0.2") + s.App().PoolKeeper.SetParams(s.Ctx(), params) + + // set team-share to zero to not interfere with inflation splitting + teamTypes.TEAM_ALLOCATION = 0 + _ = s.App().BankKeeper.SendCoinsFromModuleToAccount(s.Ctx(), "team", types.MustAccAddressFromBech32(i.CHARLIE), s.GetCoinsFromModule("team")) + + pool, _ := s.App().PoolKeeper.GetPool(s.Ctx(), 0) + pool.InflationShareWeight = math.LegacyMustNewDecFromStr("1") + s.App().PoolKeeper.SetPool(s.Ctx(), pool) + + // Add a second pool + gov := s.App().GovKeeper.GetGovernanceAccount(s.Ctx()).GetAddress().String() + msg := &pooltypes.MsgCreatePool{ + Authority: gov, + Name: "PoolTest 2", + Runtime: "@kyve/test", + Logo: "ar://Tewyv2P5VEG8EJ6AUQORdqNTectY9hlOrWPK8wwo-aU", + Config: "ar://DgdB-2hLrxjhyEEbCML__dgZN5_uS7T6Z5XDkaFh3P0", + StartKey: "0", + UploadInterval: 60, + InflationShareWeight: math.LegacyMustNewDecFromStr("1"), + MinDelegation: 100 * i.KYVE, + MaxBundleSize: 100, + Version: "0.0.0", + Binaries: "{}", + StorageProviderId: 2, + CompressionId: 1, + } + s.RunTxPoolSuccess(msg) + + s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ + Creator: i.STAKER_0, + PoolId: 1, + Valaddress: i.VALADDRESS_0_B, + }) + s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ + Creator: i.STAKER_1, + PoolId: 1, + Valaddress: i.VALADDRESS_1_B, + }) + + // Both pools now have inflation_share=1 and zero balance + + preMineBalance := s.App().BankKeeper.GetSupply(s.Ctx(), globalTypes.Denom) + // mine some blocks + for i := 1; i < 100; i++ { + s.Commit() + } + + // Prepare bundle proposal + s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ + Creator: i.VALADDRESS_0_A, + Staker: i.STAKER_0, + PoolId: 0, + StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", + DataSize: 100, + DataHash: "test_hash", + FromIndex: 0, + BundleSize: 100, + FromKey: "0", + ToKey: "99", + BundleSummary: "test_value", + }) + + s.RunTxBundlesSuccess(&bundletypes.MsgVoteBundleProposal{ + Creator: i.VALADDRESS_1_A, + Staker: i.STAKER_1, + PoolId: 0, + StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", + Vote: 1, + }) + + s.CommitAfterSeconds(60) + + postMineBalance := s.App().BankKeeper.GetSupply(s.Ctx(), globalTypes.Denom) + + // ACT + s.RunTxBundlesSuccess(&bundletypes.MsgSubmitBundleProposal{ + Creator: i.VALADDRESS_1_A, + Staker: i.STAKER_1, + PoolId: 0, + StorageId: "P9edn0bjEfMU_lecFDIPLvGO2v2ltpFNUMWp5kgPddg", + DataSize: 100, + DataHash: "test_hash2", + FromIndex: 100, + BundleSize: 100, + FromKey: "100", + ToKey: "199", + BundleSummary: "test_value2", + }) + + // ASSERT + + inflationAmount := postMineBalance.Sub(preMineBalance) + // Reward calculation: + // (inflationAmount - teamRewards) * protocolInflationShare -> Both pools equally + // (340112344399tkyve - 847940tkyve) * 0.1 -> (//2) -> 17005574822 for both pools + // teamAuthority rewards are hard to set to zero from this test-suite without using reflection. + // therefore we ignore the small amount. + Expect(inflationAmount.String()).To(Equal("340112344399tkyve")) + + // assert if bundle go finalized + pool, _ = s.App().PoolKeeper.GetPool(s.Ctx(), 0) + Expect(pool.TotalBundles).To(Equal(uint64(1))) + Expect(pool.CurrentKey).To(Equal("99")) + + // assert pool balance + finalBalancePool0 := s.GetBalanceFromPool(0) + finalBalancePool1 := s.GetBalanceFromPool(1) + // Both pools have inflation-weight 1 + // however, pool-0 produced a bundle -> subtract PoolInflationPayoutRate (1 - 0.2 = 0.8) + // 17005574822 * 0.8 + Expect(finalBalancePool0).To(Equal(uint64(13604459858))) + Expect(finalBalancePool1).To(Equal(uint64(17005574822))) + + // assert bundle reward + uploader, _ := s.App().StakersKeeper.GetStaker(s.Ctx(), i.STAKER_0) + + // the total payout is here just the inflation payout + totalPayout := math.LegacyNewDec(17005574822 - 13604459858) + + networkFee := s.App().BundlesKeeper.GetNetworkFee(s.Ctx()) + treasuryReward := totalPayout.Mul(networkFee).TruncateDec() + storageReward := s.App().BundlesKeeper.GetStorageCost(s.Ctx(), pool.GetCurrentStorageProviderId()).MulInt64(100).TruncateDec() + totalUploaderReward := totalPayout.Sub(treasuryReward).Sub(storageReward) + + uploaderPayoutReward := totalUploaderReward.Mul(uploader.Commission).TruncateDec() + uploaderDelegationReward := totalUploaderReward.Sub(uploaderPayoutReward) + + // assert commission rewards + Expect(uploader.CommissionRewards.AmountOf(globalTypes.Denom).ToLegacyDec()).To(Equal(uploaderPayoutReward.Add(storageReward))) + // assert uploader self delegation rewards + Expect(s.App().DelegationKeeper.GetOutstandingRewards(s.Ctx(), i.STAKER_0, i.STAKER_0).AmountOf(globalTypes.Denom).ToLegacyDec()).To(Equal(uploaderDelegationReward)) + + fundingState, _ := s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) + + // assert total pool funds + Expect(s.App().FundersKeeper.GetTotalActiveFunding(s.Ctx(), fundingState.PoolId)).To(BeZero()) + Expect(fundingState.ActiveFunderAddresses).To(BeEmpty()) + }) }) diff --git a/x/bundles/keeper/keeper_suite_invalid_bundles_test.go b/x/bundles/keeper/keeper_suite_invalid_bundles_test.go index 96d4884a..277a6d16 100644 --- a/x/bundles/keeper/keeper_suite_invalid_bundles_test.go +++ b/x/bundles/keeper/keeper_suite_invalid_bundles_test.go @@ -49,7 +49,7 @@ var _ = Describe("invalid bundles", Ordered, func() { Config: "ar://DgdB-2hLrxjhyEEbCML__dgZN5_uS7T6Z5XDkaFh3P0", StartKey: "0", UploadInterval: 60, - InflationShareWeight: 10_000, + InflationShareWeight: math.LegacyNewDec(10_000), MinDelegation: 100 * i.KYVE, MaxBundleSize: 100, Version: "0.0.0", diff --git a/x/bundles/keeper/keeper_suite_points_test.go b/x/bundles/keeper/keeper_suite_points_test.go index 7073612a..b02e4a24 100644 --- a/x/bundles/keeper/keeper_suite_points_test.go +++ b/x/bundles/keeper/keeper_suite_points_test.go @@ -43,7 +43,7 @@ var _ = Describe("points", Ordered, func() { Config: "ar://DgdB-2hLrxjhyEEbCML__dgZN5_uS7T6Z5XDkaFh3P0", StartKey: "0", UploadInterval: 60, - InflationShareWeight: 10_000, + InflationShareWeight: math.LegacyNewDec(10_000), MinDelegation: 100 * i.KYVE, MaxBundleSize: 100, Version: "0.0.0", diff --git a/x/bundles/keeper/keeper_suite_stakers_leave_test.go b/x/bundles/keeper/keeper_suite_stakers_leave_test.go index 2c0c831b..0633b5a5 100644 --- a/x/bundles/keeper/keeper_suite_stakers_leave_test.go +++ b/x/bundles/keeper/keeper_suite_stakers_leave_test.go @@ -45,7 +45,7 @@ var _ = Describe("stakers leave", Ordered, func() { Config: "ar://DgdB-2hLrxjhyEEbCML__dgZN5_uS7T6Z5XDkaFh3P0", StartKey: "0", UploadInterval: 60, - InflationShareWeight: 10_000, + InflationShareWeight: math.LegacyNewDec(10_000), MinDelegation: 0 * i.KYVE, MaxBundleSize: 100, Version: "0.0.0", @@ -244,19 +244,19 @@ var _ = Describe("stakers leave", Ordered, func() { // calculate uploader rewards networkFee := s.App().BundlesKeeper.GetNetworkFee(s.Ctx()) - treasuryReward := uint64(math.LegacyNewDec(int64(pool.InflationShareWeight)).Mul(networkFee).TruncateInt64()) - storageReward := uint64(s.App().BundlesKeeper.GetStorageCost(s.Ctx(), pool.CurrentStorageProviderId).MulInt64(100).TruncateInt64()) - totalUploaderReward := pool.InflationShareWeight - treasuryReward - storageReward + treasuryReward := pool.InflationShareWeight.Mul(networkFee) + storageReward := s.App().BundlesKeeper.GetStorageCost(s.Ctx(), pool.CurrentStorageProviderId).MulInt64(100) + totalUploaderReward := pool.InflationShareWeight.Sub(treasuryReward).Sub(storageReward) - uploaderPayoutReward := uint64(math.LegacyNewDec(int64(totalUploaderReward)).Mul(uploader.Commission).TruncateInt64()) - uploaderDelegationReward := totalUploaderReward - uploaderPayoutReward + uploaderPayoutReward := totalUploaderReward.Mul(uploader.Commission) + uploaderDelegationReward := totalUploaderReward.Sub(uploaderPayoutReward) // assert payout transfer Expect(balanceUploader).To(Equal(initialBalanceStaker0)) // assert commission rewards - Expect(uploader.CommissionRewards.AmountOf(globalTypes.Denom).Uint64()).To(Equal(uploaderPayoutReward + storageReward)) + Expect(uploader.CommissionRewards.AmountOf(globalTypes.Denom).Uint64()).To(Equal(uint64(uploaderPayoutReward.Add(storageReward).TruncateInt64()))) // assert uploader self delegation rewards - Expect(s.App().DelegationKeeper.GetOutstandingRewards(s.Ctx(), i.STAKER_0, i.STAKER_0).AmountOf(globalTypes.Denom).Uint64()).To(Equal(uploaderDelegationReward)) + Expect(s.App().DelegationKeeper.GetOutstandingRewards(s.Ctx(), i.STAKER_0, i.STAKER_0).AmountOf(globalTypes.Denom).Uint64()).To(Equal(uint64(uploaderDelegationReward.TruncateInt64()))) }) It("Staker leaves, although he was the uploader of the previous round and should get slashed", func() { diff --git a/x/bundles/keeper/keeper_suite_valid_bundles_test.go b/x/bundles/keeper/keeper_suite_valid_bundles_test.go index 5963aec8..1cf3dc0c 100644 --- a/x/bundles/keeper/keeper_suite_valid_bundles_test.go +++ b/x/bundles/keeper/keeper_suite_valid_bundles_test.go @@ -56,7 +56,7 @@ var _ = Describe("valid bundles", Ordered, func() { Config: "ar://DgdB-2hLrxjhyEEbCML__dgZN5_uS7T6Z5XDkaFh3P0", StartKey: "0", UploadInterval: 60, - InflationShareWeight: 10_000, + InflationShareWeight: math.LegacyNewDec(10_000), MinDelegation: 0 * i.KYVE, MaxBundleSize: 100, Version: "0.0.0", @@ -235,19 +235,19 @@ var _ = Describe("valid bundles", Ordered, func() { // calculate uploader rewards // calculate uploader rewards networkFee := s.App().BundlesKeeper.GetNetworkFee(s.Ctx()) - treasuryReward := uint64(math.LegacyNewDec(int64(pool.InflationShareWeight)).Mul(networkFee).TruncateInt64()) - storageReward := uint64(s.App().BundlesKeeper.GetStorageCost(s.Ctx(), pool.CurrentStorageProviderId).MulInt64(100).TruncateInt64()) - totalUploaderReward := pool.InflationShareWeight - treasuryReward - storageReward + treasuryReward := pool.InflationShareWeight.Mul(networkFee) + storageReward := s.App().BundlesKeeper.GetStorageCost(s.Ctx(), pool.CurrentStorageProviderId).MulInt64(100) + totalUploaderReward := pool.InflationShareWeight.Sub(treasuryReward).Sub(storageReward) - uploaderPayoutReward := uint64(math.LegacyNewDec(int64(totalUploaderReward)).Mul(uploader.Commission).TruncateInt64()) - uploaderDelegationReward := totalUploaderReward - uploaderPayoutReward + uploaderPayoutReward := totalUploaderReward.Mul(uploader.Commission) + uploaderDelegationReward := totalUploaderReward.Sub(uploaderPayoutReward) // assert payout transfer Expect(balanceUploader).To(Equal(initialBalanceStaker0)) // assert commission rewards - Expect(uploader.CommissionRewards.AmountOf(globalTypes.Denom).Uint64()).To(Equal(uploaderPayoutReward + storageReward)) + Expect(uploader.CommissionRewards.AmountOf(globalTypes.Denom).Uint64()).To(Equal(uint64(uploaderPayoutReward.Add(storageReward).TruncateInt64()))) // assert uploader self delegation rewards - Expect(s.App().DelegationKeeper.GetOutstandingRewards(s.Ctx(), i.STAKER_0, i.STAKER_0).AmountOf(globalTypes.Denom).Uint64()).To(Equal(uploaderDelegationReward)) + Expect(s.App().DelegationKeeper.GetOutstandingRewards(s.Ctx(), i.STAKER_0, i.STAKER_0).AmountOf(globalTypes.Denom).Uint64()).To(Equal(uint64(uploaderDelegationReward.TruncateInt64()))) fundingState, _ := s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) @@ -380,25 +380,25 @@ var _ = Describe("valid bundles", Ordered, func() { // calculate uploader rewards networkFee := s.App().BundlesKeeper.GetNetworkFee(s.Ctx()) - treasuryReward := uint64(math.LegacyNewDec(int64(pool.InflationShareWeight)).Mul(networkFee).TruncateInt64()) - storageReward := uint64(s.App().BundlesKeeper.GetStorageCost(s.Ctx(), pool.CurrentStorageProviderId).MulInt64(100).TruncateInt64()) - totalUploaderReward := pool.InflationShareWeight - treasuryReward - storageReward + treasuryReward := pool.InflationShareWeight.Mul(networkFee) + storageReward := s.App().BundlesKeeper.GetStorageCost(s.Ctx(), pool.CurrentStorageProviderId).MulInt64(100) + totalUploaderReward := pool.InflationShareWeight.Sub(treasuryReward).Sub(storageReward) - uploaderPayoutReward := uint64(math.LegacyNewDec(int64(totalUploaderReward)).Mul(uploader.Commission).TruncateInt64()) - totalDelegationReward := totalUploaderReward - uploaderPayoutReward + uploaderPayoutReward := totalUploaderReward.Mul(uploader.Commission) + totalDelegationReward := totalUploaderReward.Sub(uploaderPayoutReward) // divide with 4 because uploader only has 25% of total delegation - uploaderDelegationReward := uint64(math.LegacyNewDec(int64(totalDelegationReward)).Quo(math.LegacyNewDec(4)).TruncateInt64()) - delegatorDelegationReward := uint64(math.LegacyNewDec(int64(totalDelegationReward)).Quo(math.LegacyNewDec(4)).Mul(math.LegacyNewDec(3)).TruncateInt64()) + uploaderDelegationReward := totalDelegationReward.Quo(math.LegacyNewDec(4)) + delegatorDelegationReward := totalDelegationReward.Quo(math.LegacyNewDec(4)).Mul(math.LegacyNewDec(3)) // assert payout transfer Expect(balanceUploader).To(Equal(initialBalanceStaker0)) // assert commission rewards - Expect(uploader.CommissionRewards.AmountOf(globalTypes.Denom).Uint64()).To(Equal(uploaderPayoutReward + storageReward)) + Expect(uploader.CommissionRewards.AmountOf(globalTypes.Denom).Uint64()).To(Equal(uint64(uploaderPayoutReward.Add(storageReward).TruncateInt64()))) // assert uploader self delegation rewards - Expect(s.App().DelegationKeeper.GetOutstandingRewards(s.Ctx(), i.STAKER_0, i.STAKER_0).AmountOf(globalTypes.Denom).Uint64()).To(Equal(uploaderDelegationReward)) + Expect(s.App().DelegationKeeper.GetOutstandingRewards(s.Ctx(), i.STAKER_0, i.STAKER_0).AmountOf(globalTypes.Denom).Uint64()).To(Equal(uint64(uploaderDelegationReward.TruncateInt64()))) // assert delegator delegation rewards - Expect(s.App().DelegationKeeper.GetOutstandingRewards(s.Ctx(), i.STAKER_0, i.ALICE).AmountOf(globalTypes.Denom).Uint64()).To(Equal(delegatorDelegationReward)) + Expect(s.App().DelegationKeeper.GetOutstandingRewards(s.Ctx(), i.STAKER_0, i.ALICE).AmountOf(globalTypes.Denom).Uint64()).To(Equal(uint64(delegatorDelegationReward.TruncateInt64()))) // check voter rewards Expect(s.App().DelegationKeeper.GetOutstandingRewards(s.Ctx(), i.STAKER_1, i.BOB)).To(BeEmpty()) @@ -406,9 +406,9 @@ var _ = Describe("valid bundles", Ordered, func() { // assert payout transfer Expect(balanceUploader).To(Equal(initialBalanceStaker0)) // assert commission rewards - Expect(uploader.CommissionRewards.AmountOf(globalTypes.Denom).Uint64()).To(Equal(uploaderPayoutReward + storageReward)) + Expect(uploader.CommissionRewards.AmountOf(globalTypes.Denom).Uint64()).To(Equal(uint64(uploaderPayoutReward.Add(storageReward).TruncateInt64()))) // assert uploader self delegation rewards - Expect(s.App().DelegationKeeper.GetOutstandingRewards(s.Ctx(), i.STAKER_0, i.STAKER_0).AmountOf(globalTypes.Denom).Uint64()).To(Equal(uploaderDelegationReward)) + Expect(s.App().DelegationKeeper.GetOutstandingRewards(s.Ctx(), i.STAKER_0, i.STAKER_0).AmountOf(globalTypes.Denom).Uint64()).To(Equal(uint64(uploaderDelegationReward.TruncateInt64()))) fundingState, _ := s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) @@ -558,25 +558,25 @@ var _ = Describe("valid bundles", Ordered, func() { // calculate uploader rewards networkFee := s.App().BundlesKeeper.GetNetworkFee(s.Ctx()) - treasuryReward := uint64(math.LegacyNewDec(int64(pool.InflationShareWeight)).Mul(networkFee).TruncateInt64()) - storageReward := uint64(s.App().BundlesKeeper.GetStorageCost(s.Ctx(), pool.CurrentStorageProviderId).MulInt64(100).TruncateInt64()) - totalUploaderReward := pool.InflationShareWeight - treasuryReward - storageReward + treasuryReward := pool.InflationShareWeight.Mul(networkFee) + storageReward := s.App().BundlesKeeper.GetStorageCost(s.Ctx(), pool.CurrentStorageProviderId).MulInt64(100) + totalUploaderReward := pool.InflationShareWeight.Sub(treasuryReward).Sub(storageReward) - uploaderPayoutReward := uint64(math.LegacyNewDec(int64(totalUploaderReward)).Mul(uploader.Commission).TruncateInt64()) - totalDelegationReward := totalUploaderReward - uploaderPayoutReward + uploaderPayoutReward := totalUploaderReward.Mul(uploader.Commission) + totalDelegationReward := totalUploaderReward.Sub(uploaderPayoutReward) // divide with 4 because uploader only has 25% of total delegation - uploaderDelegationReward := uint64(math.LegacyNewDec(int64(totalDelegationReward)).Quo(math.LegacyNewDec(4)).TruncateInt64()) - delegatorDelegationReward := uint64(math.LegacyNewDec(int64(totalDelegationReward)).Quo(math.LegacyNewDec(4)).Mul(math.LegacyNewDec(3)).TruncateInt64()) + uploaderDelegationReward := totalDelegationReward.Quo(math.LegacyNewDec(4)) + delegatorDelegationReward := totalDelegationReward.Quo(math.LegacyNewDec(4)).Mul(math.LegacyNewDec(3)) // assert payout transfer Expect(balanceUploader).To(Equal(initialBalanceStaker0)) // assert commission rewards - Expect(uploader.CommissionRewards.AmountOf(globalTypes.Denom).Uint64()).To(Equal(uploaderPayoutReward + storageReward)) + Expect(uploader.CommissionRewards.AmountOf(globalTypes.Denom).Uint64()).To(Equal(uint64(uploaderPayoutReward.Add(storageReward).TruncateInt64()))) // assert uploader self delegation rewards - Expect(s.App().DelegationKeeper.GetOutstandingRewards(s.Ctx(), i.STAKER_0, i.STAKER_0).AmountOf(globalTypes.Denom).Uint64()).To(Equal(uploaderDelegationReward)) + Expect(s.App().DelegationKeeper.GetOutstandingRewards(s.Ctx(), i.STAKER_0, i.STAKER_0).AmountOf(globalTypes.Denom).Uint64()).To(Equal(uint64(uploaderDelegationReward.TruncateInt64()))) // assert delegator delegation rewards - Expect(s.App().DelegationKeeper.GetOutstandingRewards(s.Ctx(), i.STAKER_0, i.ALICE).AmountOf(globalTypes.Denom).Uint64()).To(Equal(delegatorDelegationReward)) + Expect(s.App().DelegationKeeper.GetOutstandingRewards(s.Ctx(), i.STAKER_0, i.ALICE).AmountOf(globalTypes.Denom).Uint64()).To(Equal(uint64(delegatorDelegationReward.TruncateInt64()))) // check voter rewards Expect(s.App().DelegationKeeper.GetOutstandingRewards(s.Ctx(), i.STAKER_2, i.CHARLIE)).To(BeEmpty()) @@ -737,25 +737,25 @@ var _ = Describe("valid bundles", Ordered, func() { // calculate uploader rewards networkFee := s.App().BundlesKeeper.GetNetworkFee(s.Ctx()) - treasuryReward := uint64(math.LegacyNewDec(int64(pool.InflationShareWeight)).Mul(networkFee).TruncateInt64()) - storageReward := uint64(s.App().BundlesKeeper.GetStorageCost(s.Ctx(), pool.CurrentStorageProviderId).MulInt64(100).TruncateInt64()) - totalUploaderReward := pool.InflationShareWeight - treasuryReward - storageReward + treasuryReward := pool.InflationShareWeight.Mul(networkFee) + storageReward := s.App().BundlesKeeper.GetStorageCost(s.Ctx(), pool.CurrentStorageProviderId).MulInt64(100) + totalUploaderReward := pool.InflationShareWeight.Sub(treasuryReward).Sub(storageReward) - uploaderPayoutReward := uint64(math.LegacyNewDec(int64(totalUploaderReward)).Mul(uploader.Commission).TruncateInt64()) - totalDelegationReward := totalUploaderReward - uploaderPayoutReward + uploaderPayoutReward := totalUploaderReward.Mul(uploader.Commission) + totalDelegationReward := totalUploaderReward.Sub(uploaderPayoutReward) // divide with 4 because uploader only has 25% of total delegation - uploaderDelegationReward := uint64(math.LegacyNewDec(int64(totalDelegationReward)).Quo(math.LegacyNewDec(4)).TruncateInt64()) - delegatorDelegationReward := uint64(math.LegacyNewDec(int64(totalDelegationReward)).Quo(math.LegacyNewDec(4)).Mul(math.LegacyNewDec(3)).TruncateInt64()) + uploaderDelegationReward := totalDelegationReward.Quo(math.LegacyNewDec(4)) + delegatorDelegationReward := totalDelegationReward.Quo(math.LegacyNewDec(4)).Mul(math.LegacyNewDec(3)) // assert payout transfer Expect(balanceUploader).To(Equal(initialBalanceStaker0)) // assert commission rewards - Expect(uploader.CommissionRewards.AmountOf(globalTypes.Denom).Uint64()).To(Equal(uploaderPayoutReward + storageReward)) + Expect(uploader.CommissionRewards.AmountOf(globalTypes.Denom).Uint64()).To(Equal(uint64(uploaderPayoutReward.Add(storageReward).TruncateInt64()))) // assert uploader self delegation rewards - Expect(s.App().DelegationKeeper.GetOutstandingRewards(s.Ctx(), i.STAKER_0, i.STAKER_0).AmountOf(globalTypes.Denom).Uint64()).To(Equal(uploaderDelegationReward)) + Expect(s.App().DelegationKeeper.GetOutstandingRewards(s.Ctx(), i.STAKER_0, i.STAKER_0).AmountOf(globalTypes.Denom).Uint64()).To(Equal(uint64(uploaderDelegationReward.TruncateInt64()))) // assert delegator delegation rewards - Expect(s.App().DelegationKeeper.GetOutstandingRewards(s.Ctx(), i.STAKER_0, i.ALICE).AmountOf(globalTypes.Denom).Uint64()).To(Equal(delegatorDelegationReward)) + Expect(s.App().DelegationKeeper.GetOutstandingRewards(s.Ctx(), i.STAKER_0, i.ALICE).AmountOf(globalTypes.Denom).Uint64()).To(Equal(uint64(delegatorDelegationReward.TruncateInt64()))) // check voter rewards Expect(s.App().DelegationKeeper.GetOutstandingRewards(s.Ctx(), i.STAKER_2, i.CHARLIE)).To(BeEmpty()) @@ -926,25 +926,25 @@ var _ = Describe("valid bundles", Ordered, func() { // calculate uploader rewards networkFee := s.App().BundlesKeeper.GetNetworkFee(s.Ctx()) - treasuryReward := uint64(math.LegacyNewDec(int64(pool.InflationShareWeight)).Mul(networkFee).TruncateInt64()) - storageReward := uint64(s.App().BundlesKeeper.GetStorageCost(s.Ctx(), pool.CurrentStorageProviderId).MulInt64(100).TruncateInt64()) - totalUploaderReward := pool.InflationShareWeight - treasuryReward - storageReward + treasuryReward := pool.InflationShareWeight.Mul(networkFee) + storageReward := s.App().BundlesKeeper.GetStorageCost(s.Ctx(), pool.CurrentStorageProviderId).MulInt64(100) + totalUploaderReward := pool.InflationShareWeight.Sub(treasuryReward).Sub(storageReward) - uploaderPayoutReward := uint64(math.LegacyNewDec(int64(totalUploaderReward)).Mul(uploader.Commission).TruncateInt64()) - totalDelegationReward := totalUploaderReward - uploaderPayoutReward + uploaderPayoutReward := totalUploaderReward.Mul(uploader.Commission) + totalDelegationReward := totalUploaderReward.Sub(uploaderPayoutReward) // divide with 4 because uploader only has 25% of total delegation - uploaderDelegationReward := uint64(math.LegacyNewDec(int64(totalDelegationReward)).Quo(math.LegacyNewDec(4)).TruncateInt64()) - delegatorDelegationReward := uint64(math.LegacyNewDec(int64(totalDelegationReward)).Quo(math.LegacyNewDec(4)).Mul(math.LegacyNewDec(3)).TruncateInt64()) + uploaderDelegationReward := totalDelegationReward.Quo(math.LegacyNewDec(4)) + delegatorDelegationReward := totalDelegationReward.Quo(math.LegacyNewDec(4)).Mul(math.LegacyNewDec(3)) // assert payout transfer Expect(balanceUploader).To(Equal(initialBalanceStaker0)) // assert commission rewards - Expect(uploader.CommissionRewards.AmountOf(globalTypes.Denom).Uint64()).To(Equal(uploaderPayoutReward + storageReward)) + Expect(uploader.CommissionRewards.AmountOf(globalTypes.Denom).Uint64()).To(Equal(uint64(uploaderPayoutReward.Add(storageReward).TruncateInt64()))) // assert uploader self delegation rewards - Expect(s.App().DelegationKeeper.GetOutstandingRewards(s.Ctx(), i.STAKER_0, i.STAKER_0).AmountOf(globalTypes.Denom).Uint64()).To(Equal(uploaderDelegationReward)) + Expect(s.App().DelegationKeeper.GetOutstandingRewards(s.Ctx(), i.STAKER_0, i.STAKER_0).AmountOf(globalTypes.Denom).Uint64()).To(Equal(uint64(uploaderDelegationReward.TruncateInt64()))) // assert delegator delegation rewards - Expect(s.App().DelegationKeeper.GetOutstandingRewards(s.Ctx(), i.STAKER_0, i.ALICE).AmountOf(globalTypes.Denom).Uint64()).To(Equal(delegatorDelegationReward)) + Expect(s.App().DelegationKeeper.GetOutstandingRewards(s.Ctx(), i.STAKER_0, i.ALICE).AmountOf(globalTypes.Denom).Uint64()).To(Equal(uint64(delegatorDelegationReward.TruncateInt64()))) // check voter rewards Expect(s.App().DelegationKeeper.GetOutstandingRewards(s.Ctx(), i.STAKER_2, i.CHARLIE)).To(BeEmpty()) @@ -1079,21 +1079,21 @@ var _ = Describe("valid bundles", Ordered, func() { // calculate uploader rewards networkFee := s.App().BundlesKeeper.GetNetworkFee(s.Ctx()) whitelist := s.App().FundersKeeper.GetCoinWhitelistMap(s.Ctx()) - treasuryReward := uint64(math.LegacyNewDec(int64(pool.InflationShareWeight)).Mul(networkFee).TruncateInt64()) - storageReward := uint64(s.App().BundlesKeeper.GetStorageCost(s.Ctx(), storageProviderId).Quo(whitelist[globalTypes.Denom].CoinWeight).MulInt64(100).TruncateInt64()) - totalUploaderReward := pool.InflationShareWeight - treasuryReward - storageReward + treasuryReward := pool.InflationShareWeight.Mul(networkFee) + storageReward := s.App().BundlesKeeper.GetStorageCost(s.Ctx(), storageProviderId).Quo(whitelist[globalTypes.Denom].CoinWeight).MulInt64(100) + totalUploaderReward := pool.InflationShareWeight.Sub(treasuryReward).Sub(storageReward) - uploaderPayoutReward := uint64(math.LegacyNewDec(int64(totalUploaderReward)).Mul(uploader.Commission).TruncateInt64()) - uploaderDelegationReward := totalUploaderReward - uploaderPayoutReward + uploaderPayoutReward := totalUploaderReward.Mul(uploader.Commission) + uploaderDelegationReward := totalUploaderReward.Sub(uploaderPayoutReward) // assert storage reward -> 0.9 * 100 - Expect(storageReward).To(Equal(uint64(90))) + Expect(storageReward.TruncateInt64()).To(Equal(int64(90))) // assert payout transfer Expect(balanceUploader).To(Equal(initialBalanceStaker0)) // assert commission rewards - Expect(uploader.CommissionRewards.AmountOf(globalTypes.Denom).Uint64()).To(Equal(uploaderPayoutReward + storageReward)) + Expect(uploader.CommissionRewards.AmountOf(globalTypes.Denom).Uint64()).To(Equal(uint64(uploaderPayoutReward.Add(storageReward).TruncateInt64()))) // assert uploader self delegation rewards - Expect(s.App().DelegationKeeper.GetOutstandingRewards(s.Ctx(), i.STAKER_0, i.STAKER_0).AmountOf(globalTypes.Denom).Uint64()).To(Equal(uploaderDelegationReward)) + Expect(s.App().DelegationKeeper.GetOutstandingRewards(s.Ctx(), i.STAKER_0, i.STAKER_0).AmountOf(globalTypes.Denom).Uint64()).To(Equal(uint64(uploaderDelegationReward.TruncateInt64()))) fundingState, _ := s.App().FundersKeeper.GetFundingState(s.Ctx(), 0) diff --git a/x/bundles/keeper/keeper_suite_zero_delegation_test.go b/x/bundles/keeper/keeper_suite_zero_delegation_test.go index 19b164d3..73dd0939 100644 --- a/x/bundles/keeper/keeper_suite_zero_delegation_test.go +++ b/x/bundles/keeper/keeper_suite_zero_delegation_test.go @@ -51,7 +51,7 @@ var _ = Describe("zero delegation", Ordered, func() { Config: "ar://DgdB-2hLrxjhyEEbCML__dgZN5_uS7T6Z5XDkaFh3P0", StartKey: "0", UploadInterval: 60, - InflationShareWeight: 10_000, + InflationShareWeight: math.LegacyNewDec(10_000), MinDelegation: 0 * i.KYVE, MaxBundleSize: 100, Version: "0.0.0", @@ -464,16 +464,16 @@ var _ = Describe("zero delegation", Ordered, func() { // calculate uploader rewards networkFee := s.App().BundlesKeeper.GetNetworkFee(s.Ctx()) - treasuryReward := uint64(math.LegacyNewDec(int64(pool.InflationShareWeight)).Mul(networkFee).TruncateInt64()) - storageReward := uint64(s.App().BundlesKeeper.GetStorageCost(s.Ctx(), pool.CurrentStorageProviderId).MulInt64(100).TruncateInt64()) - totalUploaderReward := pool.InflationShareWeight - treasuryReward - storageReward + treasuryReward := pool.InflationShareWeight.Mul(networkFee) + storageReward := s.App().BundlesKeeper.GetStorageCost(s.Ctx(), pool.CurrentStorageProviderId).MulInt64(100) + totalUploaderReward := pool.InflationShareWeight.Sub(treasuryReward).Sub(storageReward) uploader, _ := s.App().StakersKeeper.GetStaker(s.Ctx(), i.STAKER_0) // assert payout transfer Expect(balanceUploader).To(Equal(initialBalanceStaker0)) // assert commission rewards - Expect(uploader.CommissionRewards.AmountOf(globaltypes.Denom).Uint64()).To(Equal(totalUploaderReward + storageReward)) + Expect(uploader.CommissionRewards.AmountOf(globaltypes.Denom).Uint64()).To(Equal(uint64(totalUploaderReward.Add(storageReward).TruncateInt64()))) // assert uploader self delegation rewards Expect(s.App().DelegationKeeper.GetOutstandingRewards(s.Ctx(), i.STAKER_0, i.STAKER_0)).To(BeEmpty()) diff --git a/x/bundles/keeper/logic_bundles_test.go b/x/bundles/keeper/logic_bundles_test.go index c08e34bc..d6a1fd23 100644 --- a/x/bundles/keeper/logic_bundles_test.go +++ b/x/bundles/keeper/logic_bundles_test.go @@ -59,7 +59,7 @@ var _ = Describe("logic_bundles.go", Ordered, func() { Config: "ar://DgdB-2hLrxjhyEEbCML__dgZN5_uS7T6Z5XDkaFh3P0", StartKey: "0", UploadInterval: 60, - InflationShareWeight: 2 * i.KYVE, + InflationShareWeight: math.LegacyNewDec(int64(2 * i.KYVE)), MinDelegation: 100 * i.KYVE, MaxBundleSize: 100, Version: "0.0.0", @@ -211,7 +211,7 @@ var _ = Describe("logic_bundles.go", Ordered, func() { Config: "ar://DgdB-2hLrxjhyEEbCML__dgZN5_uS7T6Z5XDkaFh3P0", StartKey: "0", UploadInterval: 60, - InflationShareWeight: 10_000, + InflationShareWeight: math.LegacyNewDec(10_000), MinDelegation: 100 * i.KYVE, MaxBundleSize: 100, Version: "0.0.0", @@ -262,7 +262,7 @@ var _ = Describe("logic_bundles.go", Ordered, func() { Config: "ar://DgdB-2hLrxjhyEEbCML__dgZN5_uS7T6Z5XDkaFh3P0", StartKey: "0", UploadInterval: 60, - InflationShareWeight: 10_000, + InflationShareWeight: math.LegacyNewDec(10_000), MinDelegation: 100 * i.KYVE, MaxBundleSize: 100, Version: "0.0.0", @@ -329,7 +329,7 @@ var _ = Describe("logic_bundles.go", Ordered, func() { Config: "ar://DgdB-2hLrxjhyEEbCML__dgZN5_uS7T6Z5XDkaFh3P0", StartKey: "0", UploadInterval: 60, - InflationShareWeight: 10_000, + InflationShareWeight: math.LegacyNewDec(10_000), MinDelegation: 100 * i.KYVE, MaxBundleSize: 100, Version: "0.0.0", @@ -425,7 +425,7 @@ var _ = Describe("logic_bundles.go", Ordered, func() { Config: "ar://DgdB-2hLrxjhyEEbCML__dgZN5_uS7T6Z5XDkaFh3P0", StartKey: "0", UploadInterval: 60, - InflationShareWeight: 2 * i.KYVE, + InflationShareWeight: math.LegacyNewDec(int64(2 * i.KYVE)), MinDelegation: 100, MaxBundleSize: 100, Version: "0.0.0", diff --git a/x/bundles/keeper/logic_end_block_handle_upload_timeout_test.go b/x/bundles/keeper/logic_end_block_handle_upload_timeout_test.go index 75191aa3..100b3e54 100644 --- a/x/bundles/keeper/logic_end_block_handle_upload_timeout_test.go +++ b/x/bundles/keeper/logic_end_block_handle_upload_timeout_test.go @@ -57,7 +57,7 @@ var _ = Describe("logic_end_block_handle_upload_timeout.go", Ordered, func() { Config: "ar://DgdB-2hLrxjhyEEbCML__dgZN5_uS7T6Z5XDkaFh3P0", StartKey: "0", UploadInterval: 60, - InflationShareWeight: 10_000, + InflationShareWeight: math.LegacyNewDec(10_000), MinDelegation: 100 * i.KYVE, MaxBundleSize: 100, Version: "0.0.0", @@ -1212,7 +1212,7 @@ var _ = Describe("logic_end_block_handle_upload_timeout.go", Ordered, func() { Config: "ar://DgdB-2hLrxjhyEEbCML__dgZN5_uS7T6Z5XDkaFh3P0", StartKey: "0", UploadInterval: 60, - InflationShareWeight: 10_000, + InflationShareWeight: math.LegacyNewDec(10_000), MinDelegation: 100 * i.KYVE, MaxBundleSize: 100, Version: "0.0.0", diff --git a/x/bundles/keeper/logic_round_robin_test.go b/x/bundles/keeper/logic_round_robin_test.go index 31ea27e7..eef1b3b4 100644 --- a/x/bundles/keeper/logic_round_robin_test.go +++ b/x/bundles/keeper/logic_round_robin_test.go @@ -3,6 +3,8 @@ package keeper_test import ( "sort" + "cosmossdk.io/math" + i "github.com/KYVENetwork/chain/testutil/integration" pooltypes "github.com/KYVENetwork/chain/x/pool/types" stakertypes "github.com/KYVENetwork/chain/x/stakers/types" @@ -73,7 +75,7 @@ var _ = Describe("logic_round_robin.go", Ordered, func() { Config: "ar://DgdB-2hLrxjhyEEbCML__dgZN5_uS7T6Z5XDkaFh3P0", StartKey: "0", UploadInterval: 60, - InflationShareWeight: 2 * i.KYVE, + InflationShareWeight: math.LegacyNewDec(int64(2 * i.KYVE)), MinDelegation: 1_000_000 * i.KYVE, MaxBundleSize: 100, Version: "0.0.0", diff --git a/x/bundles/keeper/msg_server_claim_uploader_role_test.go b/x/bundles/keeper/msg_server_claim_uploader_role_test.go index 59f63b2c..c7227a49 100644 --- a/x/bundles/keeper/msg_server_claim_uploader_role_test.go +++ b/x/bundles/keeper/msg_server_claim_uploader_role_test.go @@ -1,6 +1,7 @@ package keeper_test import ( + "cosmossdk.io/math" funderstypes "github.com/KYVENetwork/chain/x/funders/types" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" @@ -41,7 +42,7 @@ var _ = Describe("msg_server_claim_uploader_role.go", Ordered, func() { Config: "ar://DgdB-2hLrxjhyEEbCML__dgZN5_uS7T6Z5XDkaFh3P0", StartKey: "0", UploadInterval: 60, - InflationShareWeight: 10_000, + InflationShareWeight: math.LegacyNewDec(10_000), MinDelegation: 100 * i.KYVE, MaxBundleSize: 100, Version: "0.0.0", @@ -194,7 +195,7 @@ var _ = Describe("msg_server_claim_uploader_role.go", Ordered, func() { Config: "ar://DgdB-2hLrxjhyEEbCML__dgZN5_uS7T6Z5XDkaFh3P0", StartKey: "0", UploadInterval: 60, - InflationShareWeight: 10_000, + InflationShareWeight: math.LegacyNewDec(10_000), MinDelegation: 100 * i.KYVE, MaxBundleSize: 100, Version: "0.0.0", diff --git a/x/bundles/keeper/msg_server_skip_uploader_role_test.go b/x/bundles/keeper/msg_server_skip_uploader_role_test.go index 36e9b134..7ab91d7c 100644 --- a/x/bundles/keeper/msg_server_skip_uploader_role_test.go +++ b/x/bundles/keeper/msg_server_skip_uploader_role_test.go @@ -1,6 +1,7 @@ package keeper_test import ( + "cosmossdk.io/math" i "github.com/KYVENetwork/chain/testutil/integration" bundletypes "github.com/KYVENetwork/chain/x/bundles/types" funderstypes "github.com/KYVENetwork/chain/x/funders/types" @@ -39,7 +40,7 @@ var _ = Describe("msg_server_skip_uploader_role.go", Ordered, func() { Config: "ar://DgdB-2hLrxjhyEEbCML__dgZN5_uS7T6Z5XDkaFh3P0", StartKey: "0", UploadInterval: 60, - InflationShareWeight: 10_000, + InflationShareWeight: math.LegacyNewDec(10_000), MinDelegation: 0 * i.KYVE, MaxBundleSize: 100, Version: "0.0.0", diff --git a/x/bundles/keeper/msg_server_submit_bundle_proposal_test.go b/x/bundles/keeper/msg_server_submit_bundle_proposal_test.go index bbd42cf4..b933277a 100644 --- a/x/bundles/keeper/msg_server_submit_bundle_proposal_test.go +++ b/x/bundles/keeper/msg_server_submit_bundle_proposal_test.go @@ -1,6 +1,7 @@ package keeper_test import ( + "cosmossdk.io/math" funderstypes "github.com/KYVENetwork/chain/x/funders/types" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" @@ -45,7 +46,7 @@ var _ = Describe("msg_server_submit_bundle_proposal.go", Ordered, func() { Config: "ar://DgdB-2hLrxjhyEEbCML__dgZN5_uS7T6Z5XDkaFh3P0", StartKey: "0", UploadInterval: 60, - InflationShareWeight: 10_000, + InflationShareWeight: math.LegacyNewDec(10_000), MinDelegation: 0 * i.KYVE, MaxBundleSize: 100, Version: "0.0.0", diff --git a/x/bundles/keeper/msg_server_vote_bundle_proposal_test.go b/x/bundles/keeper/msg_server_vote_bundle_proposal_test.go index 899bb46e..e6eb4fb9 100644 --- a/x/bundles/keeper/msg_server_vote_bundle_proposal_test.go +++ b/x/bundles/keeper/msg_server_vote_bundle_proposal_test.go @@ -1,6 +1,7 @@ package keeper_test import ( + "cosmossdk.io/math" funderstypes "github.com/KYVENetwork/chain/x/funders/types" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" @@ -40,7 +41,7 @@ var _ = Describe("msg_server_vote_bundle_proposal.go", Ordered, func() { Config: "ar://DgdB-2hLrxjhyEEbCML__dgZN5_uS7T6Z5XDkaFh3P0", StartKey: "0", UploadInterval: 60, - InflationShareWeight: 10_000, + InflationShareWeight: math.LegacyNewDec(10_000), MinDelegation: 0 * i.KYVE, MaxBundleSize: 100, Version: "0.0.0", diff --git a/x/delegation/keeper/keeper_suite_test.go b/x/delegation/keeper/keeper_suite_test.go index f2841edc..b5000332 100644 --- a/x/delegation/keeper/keeper_suite_test.go +++ b/x/delegation/keeper/keeper_suite_test.go @@ -4,6 +4,8 @@ import ( "fmt" "testing" + "cosmossdk.io/math" + mintTypes "github.com/cosmos/cosmos-sdk/x/mint/types" sdk "github.com/cosmos/cosmos-sdk/types" @@ -41,7 +43,7 @@ func CreatePool(s *i.KeeperTestSuite) { Config: "ar://DgdB-2hLrxjhyEEbCML__dgZN5_uS7T6Z5XDkaFh3P0", StartKey: "0", UploadInterval: 60, - InflationShareWeight: 10_000, + InflationShareWeight: math.LegacyNewDec(10_000), MinDelegation: 100 * i.KYVE, MaxBundleSize: 100, Version: "0.0.0", diff --git a/x/delegation/keeper/msg_server_redelegate_test.go b/x/delegation/keeper/msg_server_redelegate_test.go index 596f8498..46f4595d 100644 --- a/x/delegation/keeper/msg_server_redelegate_test.go +++ b/x/delegation/keeper/msg_server_redelegate_test.go @@ -1,6 +1,7 @@ package keeper_test import ( + "cosmossdk.io/math" pooltypes "github.com/KYVENetwork/chain/x/pool/types" stakerstypes "github.com/KYVENetwork/chain/x/stakers/types" . "github.com/onsi/ginkgo/v2" @@ -43,7 +44,7 @@ var _ = Describe("Delegation - Redelegation", Ordered, func() { Config: "ar://DgdB-2hLrxjhyEEbCML__dgZN5_uS7T6Z5XDkaFh3P0", StartKey: "0", UploadInterval: 60, - InflationShareWeight: 10_000, + InflationShareWeight: math.LegacyNewDec(10_000), MinDelegation: 1_000 * i.KYVE, MaxBundleSize: 100, Version: "0.0.0", diff --git a/x/delegation/keeper/msg_server_undelegate_test.go b/x/delegation/keeper/msg_server_undelegate_test.go index 77f2f3f6..40ffc41a 100644 --- a/x/delegation/keeper/msg_server_undelegate_test.go +++ b/x/delegation/keeper/msg_server_undelegate_test.go @@ -60,7 +60,7 @@ var _ = Describe("msg_server_undelegate.go", Ordered, func() { Config: "ar://DgdB-2hLrxjhyEEbCML__dgZN5_uS7T6Z5XDkaFh3P0", StartKey: "0", UploadInterval: 60, - InflationShareWeight: 10_000, + InflationShareWeight: math.LegacyNewDec(10_000), MinDelegation: 100 * i.KYVE, MaxBundleSize: 100, Version: "0.0.0", diff --git a/x/funders/keeper/keeper_test.go b/x/funders/keeper/keeper_test.go index 6d2ee851..281c350a 100644 --- a/x/funders/keeper/keeper_test.go +++ b/x/funders/keeper/keeper_test.go @@ -4,7 +4,7 @@ import ( "fmt" "testing" - "github.com/KYVENetwork/chain/x/team/types" + "github.com/KYVENetwork/chain/x/funders/types" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" diff --git a/x/funders/keeper/logic_funders_test.go b/x/funders/keeper/logic_funders_test.go index b56ca74c..e79528b1 100644 --- a/x/funders/keeper/logic_funders_test.go +++ b/x/funders/keeper/logic_funders_test.go @@ -47,7 +47,7 @@ var _ = Describe("logic_funders.go", Ordered, func() { Config: "ar://DgdB-2hLrxjhyEEbCML__dgZN5_uS7T6Z5XDkaFh3P0", StartKey: "0", UploadInterval: 60, - InflationShareWeight: 10_000, + InflationShareWeight: math.LegacyNewDec(10_000), MinDelegation: 100 * i.KYVE, MaxBundleSize: 100, Version: "0.0.0", diff --git a/x/funders/keeper/msg_server_defund_pool_test.go b/x/funders/keeper/msg_server_defund_pool_test.go index 582da49d..f1876173 100644 --- a/x/funders/keeper/msg_server_defund_pool_test.go +++ b/x/funders/keeper/msg_server_defund_pool_test.go @@ -52,7 +52,7 @@ var _ = Describe("msg_server_defund_pool.go", Ordered, func() { Config: "ar://DgdB-2hLrxjhyEEbCML__dgZN5_uS7T6Z5XDkaFh3P0", StartKey: "0", UploadInterval: 60, - InflationShareWeight: 10_000, + InflationShareWeight: math.LegacyNewDec(10_000), MinDelegation: 100 * i.KYVE, MaxBundleSize: 100, Version: "0.0.0", diff --git a/x/funders/keeper/msg_server_fund_pool_test.go b/x/funders/keeper/msg_server_fund_pool_test.go index 140fb58e..58a21d64 100644 --- a/x/funders/keeper/msg_server_fund_pool_test.go +++ b/x/funders/keeper/msg_server_fund_pool_test.go @@ -66,7 +66,7 @@ var _ = Describe("msg_server_fund_pool.go", Ordered, func() { Config: "ar://DgdB-2hLrxjhyEEbCML__dgZN5_uS7T6Z5XDkaFh3P0", StartKey: "0", UploadInterval: 60, - InflationShareWeight: 10_000, + InflationShareWeight: math.LegacyNewDec(10_000), MinDelegation: 100 * i.KYVE, MaxBundleSize: 100, Version: "0.0.0", diff --git a/x/pool/keeper/keeper_utils_test.go b/x/pool/keeper/keeper_utils_test.go index 8ca6035c..b7b563f4 100644 --- a/x/pool/keeper/keeper_utils_test.go +++ b/x/pool/keeper/keeper_utils_test.go @@ -1,6 +1,7 @@ package keeper_test import ( + "cosmossdk.io/math" i "github.com/KYVENetwork/chain/testutil/integration" "github.com/KYVENetwork/chain/x/pool/types" sdk "github.com/cosmos/cosmos-sdk/types" @@ -29,10 +30,11 @@ func BuildGovernanceTxs(s *i.KeeperTestSuite, msgs []sdk.Msg) (govV1Types.MsgSub func createPoolWithEmptyValues(s *i.KeeperTestSuite) { gov := s.App().GovKeeper.GetGovernanceAccount(s.Ctx()).GetAddress().String() msg := &types.MsgCreatePool{ - Authority: gov, - UploadInterval: 60, - MaxBundleSize: 100, - Binaries: "{}", + Authority: gov, + UploadInterval: 60, + MaxBundleSize: 100, + InflationShareWeight: math.LegacyZeroDec(), + Binaries: "{}", } s.RunTxPoolSuccess(msg) diff --git a/x/pool/keeper/logic_end_block_handle_pool_upgrades_test.go b/x/pool/keeper/logic_end_block_handle_pool_upgrades_test.go index 4d05d370..812c36ed 100644 --- a/x/pool/keeper/logic_end_block_handle_pool_upgrades_test.go +++ b/x/pool/keeper/logic_end_block_handle_pool_upgrades_test.go @@ -1,6 +1,7 @@ package keeper_test import ( + "cosmossdk.io/math" i "github.com/KYVENetwork/chain/testutil/integration" pooltypes "github.com/KYVENetwork/chain/x/pool/types" . "github.com/onsi/ginkgo/v2" @@ -37,7 +38,7 @@ var _ = Describe("logic_end_block_handle_pool_upgrades.go", Ordered, func() { Config: "ar://DgdB-2hLrxjhyEEbCML__dgZN5_uS7T6Z5XDkaFh3P0", StartKey: "0", UploadInterval: 60, - InflationShareWeight: 10_000, + InflationShareWeight: math.LegacyNewDec(10_000), MinDelegation: 100 * i.KYVE, MaxBundleSize: 100, Version: "0.0.0", diff --git a/x/pool/keeper/msg_server_create_pool_test.go b/x/pool/keeper/msg_server_create_pool_test.go index 57818d96..224dab2e 100644 --- a/x/pool/keeper/msg_server_create_pool_test.go +++ b/x/pool/keeper/msg_server_create_pool_test.go @@ -1,6 +1,7 @@ package keeper_test import ( + "cosmossdk.io/math" i "github.com/KYVENetwork/chain/testutil/integration" funderstypes "github.com/KYVENetwork/chain/x/funders/types" sdk "github.com/cosmos/cosmos-sdk/types" @@ -49,7 +50,7 @@ var _ = Describe("msg_server_create_pool.go", Ordered, func() { Config: "ar://DgdB-2hLrxjhyEEbCML__dgZN5_uS7T6Z5XDkaFh3P0", StartKey: "0", UploadInterval: 60, - InflationShareWeight: 10000, + InflationShareWeight: math.LegacyNewDec(10_000), MinDelegation: 100 * i.KYVE, MaxBundleSize: 100, Version: "0.0.0", @@ -75,7 +76,7 @@ var _ = Describe("msg_server_create_pool.go", Ordered, func() { Config: "ar://DgdB-2hLrxjhyEEbCML__dgZN5_uS7T6Z5XDkaFh3P0", StartKey: "0", UploadInterval: 60, - InflationShareWeight: 10000, + InflationShareWeight: math.LegacyNewDec(10_000), MinDelegation: 100 * i.KYVE, MaxBundleSize: 100, Version: "0.0.0", @@ -104,7 +105,7 @@ var _ = Describe("msg_server_create_pool.go", Ordered, func() { StartKey: "0", EndKey: "100", UploadInterval: 60, - InflationShareWeight: 10000, + InflationShareWeight: math.LegacyNewDec(10_000), MinDelegation: 100 * i.KYVE, MaxBundleSize: 100, Version: "0.0.0", @@ -144,7 +145,7 @@ var _ = Describe("msg_server_create_pool.go", Ordered, func() { CurrentIndex: 0, TotalBundles: 0, UploadInterval: 60, - InflationShareWeight: 10000, + InflationShareWeight: math.LegacyNewDec(10_000), MinDelegation: 100 * i.KYVE, MaxBundleSize: 100, Disabled: false, @@ -180,7 +181,7 @@ var _ = Describe("msg_server_create_pool.go", Ordered, func() { Config: "ar://DgdB-2hLrxjhyEEbCML__dgZN5_uS7T6Z5XDkaFh3P0", StartKey: "0", UploadInterval: 60, - InflationShareWeight: 10000, + InflationShareWeight: math.LegacyNewDec(10_000), MinDelegation: 100 * i.KYVE, MaxBundleSize: 100, Version: "0.0.0", @@ -213,7 +214,7 @@ var _ = Describe("msg_server_create_pool.go", Ordered, func() { Config: "ar://DgdB-2hLrxjhyEEbCML__dgZN5_uS7T6Z5XDkaFh3P0", StartKey: "0", UploadInterval: 60, - InflationShareWeight: 10000, + InflationShareWeight: math.LegacyNewDec(10_000), MinDelegation: 100 * i.KYVE, MaxBundleSize: 100, Version: "0.0.0", @@ -252,7 +253,7 @@ var _ = Describe("msg_server_create_pool.go", Ordered, func() { CurrentIndex: 0, TotalBundles: 0, UploadInterval: 60, - InflationShareWeight: 10000, + InflationShareWeight: math.LegacyNewDec(10_000), MinDelegation: 100 * i.KYVE, MaxBundleSize: 100, Disabled: false, @@ -288,7 +289,7 @@ var _ = Describe("msg_server_create_pool.go", Ordered, func() { Config: "ar://DgdB-2hLrxjhyEEbCML__dgZN5_uS7T6Z5XDkaFh3P0", StartKey: "0", UploadInterval: 60, - InflationShareWeight: 10000, + InflationShareWeight: math.LegacyNewDec(10_000), MinDelegation: 100 * i.KYVE, MaxBundleSize: 100, Version: "0.0.0", diff --git a/x/pool/keeper/msg_server_disable_pool_test.go b/x/pool/keeper/msg_server_disable_pool_test.go index 426bab03..d21ace72 100644 --- a/x/pool/keeper/msg_server_disable_pool_test.go +++ b/x/pool/keeper/msg_server_disable_pool_test.go @@ -54,7 +54,7 @@ var _ = Describe("msg_server_disable_pool.go", Ordered, func() { Config: "ar://DgdB-2hLrxjhyEEbCML__dgZN5_uS7T6Z5XDkaFh3P0", StartKey: "0", UploadInterval: 60, - InflationShareWeight: 10_000, + InflationShareWeight: math.LegacyNewDec(10_000), MinDelegation: 100 * i.KYVE, MaxBundleSize: 100, Version: "0.0.0", @@ -84,7 +84,7 @@ var _ = Describe("msg_server_disable_pool.go", Ordered, func() { Config: "ar://DgdB-2hLrxjhyEEbCML__dgZN5_uS7T6Z5XDkaFh3P0", StartKey: "0", UploadInterval: 60, - InflationShareWeight: 10_000, + InflationShareWeight: math.LegacyNewDec(10_000), MinDelegation: 100 * i.KYVE, MaxBundleSize: 100, Version: "0.0.0", diff --git a/x/pool/keeper/msg_server_update_pool_test.go b/x/pool/keeper/msg_server_update_pool_test.go index 9bf3d3d7..6de46373 100644 --- a/x/pool/keeper/msg_server_update_pool_test.go +++ b/x/pool/keeper/msg_server_update_pool_test.go @@ -1,6 +1,7 @@ package keeper_test import ( + "cosmossdk.io/math" i "github.com/KYVENetwork/chain/testutil/integration" sdk "github.com/cosmos/cosmos-sdk/types" govV1Types "github.com/cosmos/cosmos-sdk/x/gov/types/v1" @@ -46,7 +47,7 @@ var _ = Describe("msg_server_update_pool.go", Ordered, func() { msg := &types.MsgUpdatePool{ Authority: i.DUMMY[0], Id: 0, - Payload: "{\"Name\":\"TestPool\",\"Runtime\":\"@kyve/test\",\"Logo\":\"ar://Tewyv2P5VEG8EJ6AUQORdqNTectY9hlOrWPK8wwo-aU\",\"Config\":\"ar://DgdB-2hLrxjhyEEbCML__dgZN5_uS7T6Z5XDkaFh3P0\",\"StartKey\":\"0\",\"UploadInterval\":60,\"InflationShareWeight\":10000,\"MinDelegation\":\"100000000000\",\"MaxBundleSize\":100,\"Version\":\"0.0.0\",\"Binaries\":\"{}\",\"StorageProviderId\":2,\"CompressionId\":1,\"EndKey\":\"1\"}", + Payload: "{\"Name\":\"TestPool\",\"Runtime\":\"@kyve/test\",\"Logo\":\"ar://Tewyv2P5VEG8EJ6AUQORdqNTectY9hlOrWPK8wwo-aU\",\"Config\":\"ar://DgdB-2hLrxjhyEEbCML__dgZN5_uS7T6Z5XDkaFh3P0\",\"StartKey\":\"0\",\"UploadInterval\":60,\"InflationShareWeight\":\"10000\",\"MinDelegation\":\"100000000000\",\"MaxBundleSize\":100,\"Version\":\"0.0.0\",\"Binaries\":\"{}\",\"StorageProviderId\":2,\"CompressionId\":1,\"EndKey\":\"1\"}", } // ACT @@ -61,7 +62,7 @@ var _ = Describe("msg_server_update_pool.go", Ordered, func() { msg := &types.MsgUpdatePool{ Authority: i.DUMMY[0], Id: 0, - Payload: "{\"Name\":\"TestPool\",\"Runtime\":\"@kyve/test\",\"Logo\":\"ar://Tewyv2P5VEG8EJ6AUQORdqNTectY9hlOrWPK8wwo-aU\",\"Config\":\"ar://DgdB-2hLrxjhyEEbCML__dgZN5_uS7T6Z5XDkaFh3P0\",\"StartKey\":\"0\",\"UploadInterval\":60,\"InflationShareWeight\":10000,\"MinDelegation\":\"100000000000\",\"MaxBundleSize\":100,\"Version\":\"0.0.0\",\"Binaries\":\"{}\",\"StorageProviderId\":2,\"CompressionId\":1,\"EndKey\":\"1\"}", + Payload: "{\"Name\":\"TestPool\",\"Runtime\":\"@kyve/test\",\"Logo\":\"ar://Tewyv2P5VEG8EJ6AUQORdqNTectY9hlOrWPK8wwo-aU\",\"Config\":\"ar://DgdB-2hLrxjhyEEbCML__dgZN5_uS7T6Z5XDkaFh3P0\",\"StartKey\":\"0\",\"UploadInterval\":60,\"InflationShareWeight\":\"10000\",\"MinDelegation\":\"100000000000\",\"MaxBundleSize\":100,\"Version\":\"0.0.0\",\"Binaries\":\"{}\",\"StorageProviderId\":2,\"CompressionId\":1,\"EndKey\":\"1\"}", } proposal, _ := BuildGovernanceTxs(s, []sdk.Msg{msg}) @@ -78,7 +79,7 @@ var _ = Describe("msg_server_update_pool.go", Ordered, func() { msg := &types.MsgUpdatePool{ Authority: gov, Id: 0, - Payload: "{\"Name\":\"TestPool\",\"Runtime\":\"@kyve/test\",\"Logo\":\"ar://Tewyv2P5VEG8EJ6AUQORdqNTectY9hlOrWPK8wwo-aU\",\"Config\":\"ar://DgdB-2hLrxjhyEEbCML__dgZN5_uS7T6Z5XDkaFh3P0\",\"StartKey\":\"0\",\"UploadInterval\":60,\"InflationShareWeight\":10000,\"MinDelegation\":100000000000,\"MaxBundleSize\":100,\"Version\":\"0.0.0\",\"Binaries\":\"{}\",\"StorageProviderId\":2,\"CompressionId\":1,\"EndKey\":\"1\"}", + Payload: "{\"Name\":\"TestPool\",\"Runtime\":\"@kyve/test\",\"Logo\":\"ar://Tewyv2P5VEG8EJ6AUQORdqNTectY9hlOrWPK8wwo-aU\",\"Config\":\"ar://DgdB-2hLrxjhyEEbCML__dgZN5_uS7T6Z5XDkaFh3P0\",\"StartKey\":\"0\",\"UploadInterval\":60,\"InflationShareWeight\":\"10000\",\"MinDelegation\":100000000000,\"MaxBundleSize\":100,\"Version\":\"0.0.0\",\"Binaries\":\"{}\",\"StorageProviderId\":2,\"CompressionId\":1,\"EndKey\":\"1\"}", } p, v := BuildGovernanceTxs(s, []sdk.Msg{msg}) @@ -111,7 +112,7 @@ var _ = Describe("msg_server_update_pool.go", Ordered, func() { CurrentIndex: 0, TotalBundles: 0, UploadInterval: 60, - InflationShareWeight: 10000, + InflationShareWeight: math.LegacyNewDec(10_000), MinDelegation: 100 * i.KYVE, MaxBundleSize: 100, Disabled: false, @@ -170,7 +171,7 @@ var _ = Describe("msg_server_update_pool.go", Ordered, func() { CurrentIndex: 0, TotalBundles: 0, UploadInterval: 0, - InflationShareWeight: 0, + InflationShareWeight: math.LegacyZeroDec(), MinDelegation: 0, MaxBundleSize: 0, Disabled: false, @@ -199,7 +200,7 @@ var _ = Describe("msg_server_update_pool.go", Ordered, func() { msg := &types.MsgUpdatePool{ Authority: gov, Id: 1, - Payload: "{\"Name\":\"TestPool2\",\"Runtime\":\"@kyve/test\",\"Logo\":\"ar://Tewyv2P5VEG8EJ6AUQORdqNTectY9hlOrWPK8wwo-aU\",\"Config\":\"ar://DgdB-2hLrxjhyEEbCML__dgZN5_uS7T6Z5XDkaFh3P0\",\"StartKey\":\"0\",\"UploadInterval\":60,\"InflationShareWeight\":10000,\"MinDelegation\":100000000000,\"MaxBundleSize\":100,\"Version\":\"0.0.0\",\"Binaries\":\"{}\",\"StorageProviderId\":2,\"CompressionId\":1,\"EndKey\":\"1\"}", + Payload: "{\"Name\":\"TestPool2\",\"Runtime\":\"@kyve/test\",\"Logo\":\"ar://Tewyv2P5VEG8EJ6AUQORdqNTectY9hlOrWPK8wwo-aU\",\"Config\":\"ar://DgdB-2hLrxjhyEEbCML__dgZN5_uS7T6Z5XDkaFh3P0\",\"StartKey\":\"0\",\"UploadInterval\":60,\"InflationShareWeight\":\"10000\",\"MinDelegation\":100000000000,\"MaxBundleSize\":100,\"Version\":\"0.0.0\",\"Binaries\":\"{}\",\"StorageProviderId\":2,\"CompressionId\":1,\"EndKey\":\"1\"}", } p, v := BuildGovernanceTxs(s, []sdk.Msg{msg}) @@ -231,7 +232,7 @@ var _ = Describe("msg_server_update_pool.go", Ordered, func() { CurrentIndex: 0, TotalBundles: 0, UploadInterval: 60, - InflationShareWeight: 10000, + InflationShareWeight: math.LegacyNewDec(10_000), MinDelegation: 100 * i.KYVE, MaxBundleSize: 100, Disabled: false, @@ -257,7 +258,7 @@ var _ = Describe("msg_server_update_pool.go", Ordered, func() { msg := &types.MsgUpdatePool{ Authority: gov, Id: 1, - Payload: "invalid_json_payload\",\"Runtime\":\"@kyve/test\",\"Logo\":\"ar://Tewyv2P5VEG8EJ6AUQORdqNTectY9hlOrWPK8wwo-aU\",\"Config\":\"ar://DgdB-2hLrxjhyEEbCML__dgZN5_uS7T6Z5XDkaFh3P0\",\"StartKey\":\"0\",\"UploadInterval\":60,\"InflationShareWeight\":10000,\"MinDelegation\":100000000000,\"MaxBundleSize\":100,\"Version\":\"0.0.0\",\"Binaries\":\"{}\",\"StorageProviderId\":2,\"CompressionId\":1,\"EndKey\":\"1\"}", + Payload: "invalid_json_payload\",\"Runtime\":\"@kyve/test\",\"Logo\":\"ar://Tewyv2P5VEG8EJ6AUQORdqNTectY9hlOrWPK8wwo-aU\",\"Config\":\"ar://DgdB-2hLrxjhyEEbCML__dgZN5_uS7T6Z5XDkaFh3P0\",\"StartKey\":\"0\",\"UploadInterval\":60,\"InflationShareWeight\":\"10000\",\"MinDelegation\":100000000000,\"MaxBundleSize\":100,\"Version\":\"0.0.0\",\"Binaries\":\"{}\",\"StorageProviderId\":2,\"CompressionId\":1,\"EndKey\":\"1\"}", } p, _ := BuildGovernanceTxs(s, []sdk.Msg{msg}) @@ -299,7 +300,7 @@ var _ = Describe("msg_server_update_pool.go", Ordered, func() { msg := &types.MsgUpdatePool{ Authority: gov, Id: 1, - Payload: "{\"InflationShareWeight\": -1}", + Payload: "{\"InflationShareWeight\": \"-1\"}", } p, _ := BuildGovernanceTxs(s, []sdk.Msg{msg}) diff --git a/x/pool/types/events.pb.go b/x/pool/types/events.pb.go index 3ecaed5d..58b66c37 100644 --- a/x/pool/types/events.pb.go +++ b/x/pool/types/events.pb.go @@ -4,6 +4,7 @@ package types import ( + cosmossdk_io_math "cosmossdk.io/math" fmt "fmt" _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/cosmos/gogoproto/proto" @@ -110,7 +111,7 @@ type EventCreatePool struct { UploadInterval uint64 `protobuf:"varint,7,opt,name=upload_interval,json=uploadInterval,proto3" json:"upload_interval,omitempty"` // inflation_share_weight is the fixed cost which gets paid out // to every successful uploader - InflationShareWeight uint64 `protobuf:"varint,8,opt,name=inflation_share_weight,json=inflationShareWeight,proto3" json:"inflation_share_weight,omitempty"` + InflationShareWeight cosmossdk_io_math.LegacyDec `protobuf:"bytes,8,opt,name=inflation_share_weight,json=inflationShareWeight,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"inflation_share_weight"` // min_delegation is the minimum amount of $KYVE the pool has // to have in order to produce bundles MinDelegation uint64 `protobuf:"varint,9,opt,name=min_delegation,json=minDelegation,proto3" json:"min_delegation,omitempty"` @@ -214,13 +215,6 @@ func (m *EventCreatePool) GetUploadInterval() uint64 { return 0 } -func (m *EventCreatePool) GetInflationShareWeight() uint64 { - if m != nil { - return m.InflationShareWeight - } - return 0 -} - func (m *EventCreatePool) GetMinDelegation() uint64 { if m != nil { return m.MinDelegation @@ -536,7 +530,7 @@ type EventPoolUpdated struct { UploadInterval uint64 `protobuf:"varint,7,opt,name=upload_interval,json=uploadInterval,proto3" json:"upload_interval,omitempty"` // inflation_share_weight is the fixed cost which gets paid out // to every successful uploader - InflationShareWeight uint64 `protobuf:"varint,8,opt,name=inflation_share_weight,json=inflationShareWeight,proto3" json:"inflation_share_weight,omitempty"` + InflationShareWeight cosmossdk_io_math.LegacyDec `protobuf:"bytes,8,opt,name=inflation_share_weight,json=inflationShareWeight,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"inflation_share_weight"` // min_delegation is the minimum amount of $KYVE the pool has // to have in order to produce bundles MinDelegation uint64 `protobuf:"varint,9,opt,name=min_delegation,json=minDelegation,proto3" json:"min_delegation,omitempty"` @@ -633,13 +627,6 @@ func (m *EventPoolUpdated) GetUploadInterval() uint64 { return 0 } -func (m *EventPoolUpdated) GetInflationShareWeight() uint64 { - if m != nil { - return m.InflationShareWeight - } - return 0 -} - func (m *EventPoolUpdated) GetMinDelegation() uint64 { if m != nil { return m.MinDelegation @@ -747,56 +734,58 @@ func init() { func init() { proto.RegisterFile("kyve/pool/v1beta1/events.proto", fileDescriptor_c1828a100d789238) } var fileDescriptor_c1828a100d789238 = []byte{ - // 777 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x55, 0xcf, 0x6e, 0x33, 0x35, - 0x10, 0xcf, 0x26, 0x69, 0xda, 0x38, 0x4d, 0x42, 0x96, 0x52, 0x96, 0x82, 0x42, 0x08, 0x2a, 0x14, - 0x0e, 0x89, 0x0a, 0x9c, 0x91, 0xe8, 0x1f, 0xa4, 0xa8, 0x12, 0xaa, 0x12, 0x15, 0x04, 0x17, 0xcb, - 0x89, 0x27, 0x1b, 0xab, 0xbb, 0xf6, 0xca, 0xf6, 0x26, 0x4d, 0x9f, 0x82, 0x17, 0xe9, 0x7b, 0xf4, - 0xd8, 0x03, 0x07, 0x4e, 0x08, 0xb5, 0x57, 0x1e, 0x02, 0xd9, 0xbb, 0x9b, 0x2f, 0x69, 0xf7, 0xfb, - 0xd4, 0xeb, 0x77, 0xf3, 0xcc, 0xef, 0x37, 0xe3, 0xf1, 0x6f, 0x66, 0x76, 0x51, 0xfb, 0x7a, 0x39, - 0x87, 0x7e, 0x24, 0x44, 0xd0, 0x9f, 0x1f, 0x8f, 0x41, 0x93, 0xe3, 0x3e, 0xcc, 0x81, 0x6b, 0xd5, - 0x8b, 0xa4, 0xd0, 0xc2, 0x6d, 0x19, 0xbc, 0x67, 0xf0, 0x5e, 0x8a, 0x1f, 0xec, 0xf9, 0xc2, 0x17, - 0x16, 0xed, 0x9b, 0x53, 0x42, 0x3c, 0xc8, 0x49, 0x14, 0x11, 0x49, 0xc2, 0x34, 0x51, 0xf7, 0xce, - 0x41, 0xad, 0x73, 0x93, 0xf9, 0x2a, 0xa2, 0x44, 0xc3, 0xa5, 0xc5, 0xdc, 0x1f, 0x11, 0x12, 0x01, - 0xc5, 0x09, 0xd3, 0x73, 0x3a, 0xce, 0x51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, 0x2e, 0x3c, 0x3c, 0xb5, 0x0b, - 0x7f, 0x3f, 0xb5, 0x0b, 0x7f, 0x7c, 0xe3, 0x33, 0x3d, 0x8b, 0xc7, 0xbd, 0x89, 0x08, 0xfb, 0x17, - 0xbf, 0xff, 0x7a, 0xfe, 0x0b, 0xe8, 0x85, 0x90, 0xd7, 0xfd, 0xc9, 0x8c, 0x30, 0xde, 0xbf, 0x49, - 0xfe, 0x43, 0x7a, 0x19, 0x81, 0x1a, 0x57, 0xec, 0xff, 0xe7, 0xfb, 0xff, 0x03, 0x00, 0x00, 0xff, - 0xff, 0x25, 0xc2, 0xe8, 0xb7, 0xea, 0x06, 0x00, 0x00, + // 809 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x55, 0xdd, 0x6e, 0xe3, 0x44, + 0x14, 0xae, 0x53, 0x37, 0x6d, 0xa6, 0x6d, 0x42, 0xcd, 0xb2, 0x98, 0x2e, 0xca, 0x96, 0xac, 0x16, + 0x0a, 0x17, 0xb6, 0x16, 0xee, 0x91, 0xe8, 0x0f, 0x52, 0x54, 0x84, 0x56, 0x8e, 0x16, 0xb4, 0xdc, + 0x8c, 0x26, 0x9e, 0x13, 0x67, 0x14, 0x7b, 0xc6, 0x9a, 0x19, 0x27, 0xcd, 0x3e, 0x05, 0x3c, 0x08, + 0xef, 0xb1, 0x97, 0x2b, 0xc4, 0x05, 0xe2, 0x62, 0x85, 0xda, 0x17, 0x41, 0x33, 0xb6, 0x43, 0xb2, + 0x35, 0xa8, 0xd7, 0xdc, 0xcd, 0xf9, 0xfb, 0xe6, 0xcc, 0x77, 0xce, 0x67, 0xa3, 0xfe, 0x6c, 0x39, + 0x87, 0x30, 0x17, 0x22, 0x0d, 0xe7, 0xcf, 0xc6, 0xa0, 0xc9, 0xb3, 0x10, 0xe6, 0xc0, 0xb5, 0x0a, + 0x72, 0x29, 0xb4, 0xf0, 0x8e,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ac, 0x60, 0xb7, 0x59, 0xc1, 0x3b, 0x8d, 0x0a, + 0x6e, 0x6f, 0x28, 0xf8, 0x7f, 0x28, 0xd2, 0x7f, 0x91, 0xdb, 0xfe, 0xfd, 0xe5, 0x76, 0xd0, 0x20, + 0xb7, 0xc1, 0x18, 0x7d, 0xb0, 0x9a, 0xe9, 0xb7, 0x05, 0xa7, 0x6a, 0x94, 0x12, 0x35, 0x05, 0xab, + 0x43, 0xb3, 0x0b, 0x78, 0x35, 0xdd, 0xb6, 0x31, 0x87, 0x76, 0x8f, 0x08, 0xa5, 0x06, 0xa1, 0xd6, + 0x40, 0x65, 0x9a, 0x69, 0x90, 0x4c, 0x14, 0xbc, 0xde, 0xfe, 0xca, 0x3a, 0x3b, 0x7f, 0x7d, 0xd3, + 0x77, 0xde, 0xdc, 0xf4, 0x9d, 0xbf, 0x6e, 0xfa, 0xce, 0xcf, 0xb7, 0xfd, 0xad, 0x37, 0xb7, 0xfd, + 0xad, 0x3f, 0x6e, 0xfb, 0x5b, 0x3f, 0x7d, 0x9e, 0x30, 0x3d, 0x2d, 0xc6, 0x41, 0x2c, 0xb2, 0xf0, + 0xea, 0xe5, 0x0f, 0x97, 0xdf, 0x83, 0x5e, 0x08, 0x39, 0x0b, 0xe3, 0x29, 0x61, 0x3c, 0xbc, 0x2e, + 0xff, 0x68, 0x7a, 0x99, 0x83, 0x1a, 0xb7, 0xed, 0x9f, 0xec, 0xab, 0xbf, 0x03, 0x00, 0x00, 0xff, + 0xff, 0x29, 0x41, 0xad, 0xe9, 0x34, 0x07, 0x00, 0x00, } func (m *EventUpdateParams) Marshal() (dAtA []byte, err error) { @@ -910,11 +899,16 @@ func (m *EventCreatePool) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x48 } - if m.InflationShareWeight != 0 { - i = encodeVarintEvents(dAtA, i, uint64(m.InflationShareWeight)) - i-- - dAtA[i] = 0x40 + { + size := m.InflationShareWeight.Size() + i -= size + if _, err := m.InflationShareWeight.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintEvents(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0x42 if m.UploadInterval != 0 { i = encodeVarintEvents(dAtA, i, uint64(m.UploadInterval)) i-- @@ -1179,11 +1173,16 @@ func (m *EventPoolUpdated) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x48 } - if m.InflationShareWeight != 0 { - i = encodeVarintEvents(dAtA, i, uint64(m.InflationShareWeight)) - i-- - dAtA[i] = 0x40 + { + size := m.InflationShareWeight.Size() + i -= size + if _, err := m.InflationShareWeight.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintEvents(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0x42 if m.UploadInterval != 0 { i = encodeVarintEvents(dAtA, i, uint64(m.UploadInterval)) i-- @@ -1332,9 +1331,8 @@ func (m *EventCreatePool) Size() (n int) { if m.UploadInterval != 0 { n += 1 + sovEvents(uint64(m.UploadInterval)) } - if m.InflationShareWeight != 0 { - n += 1 + sovEvents(uint64(m.InflationShareWeight)) - } + l = m.InflationShareWeight.Size() + n += 1 + l + sovEvents(uint64(l)) if m.MinDelegation != 0 { n += 1 + sovEvents(uint64(m.MinDelegation)) } @@ -1472,9 +1470,8 @@ func (m *EventPoolUpdated) Size() (n int) { if m.UploadInterval != 0 { n += 1 + sovEvents(uint64(m.UploadInterval)) } - if m.InflationShareWeight != 0 { - n += 1 + sovEvents(uint64(m.InflationShareWeight)) - } + l = m.InflationShareWeight.Size() + n += 1 + l + sovEvents(uint64(l)) if m.MinDelegation != 0 { n += 1 + sovEvents(uint64(m.MinDelegation)) } @@ -1891,10 +1888,10 @@ func (m *EventCreatePool) Unmarshal(dAtA []byte) error { } } case 8: - if wireType != 0 { + if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field InflationShareWeight", wireType) } - m.InflationShareWeight = 0 + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowEvents @@ -1904,11 +1901,26 @@ func (m *EventCreatePool) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.InflationShareWeight |= uint64(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEvents + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.InflationShareWeight.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex case 9: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field MinDelegation", wireType) @@ -2886,10 +2898,10 @@ func (m *EventPoolUpdated) Unmarshal(dAtA []byte) error { } } case 8: - if wireType != 0 { + if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field InflationShareWeight", wireType) } - m.InflationShareWeight = 0 + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowEvents @@ -2899,11 +2911,26 @@ func (m *EventPoolUpdated) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.InflationShareWeight |= uint64(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEvents + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.InflationShareWeight.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex case 9: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field MinDelegation", wireType) diff --git a/x/pool/types/msgs.go b/x/pool/types/msgs.go index 8edc9e71..fcee43eb 100644 --- a/x/pool/types/msgs.go +++ b/x/pool/types/msgs.go @@ -3,6 +3,8 @@ package types import ( "encoding/json" + "cosmossdk.io/math" + "cosmossdk.io/errors" "github.com/KYVENetwork/chain/util" @@ -36,7 +38,7 @@ func (msg *MsgCreatePool) ValidateBasic() error { return errors.Wrapf(errorsTypes.ErrInvalidRequest, "invalid upload interval") } - if err := util.ValidateNumber(msg.InflationShareWeight); err != nil { + if err := util.ValidateDecimal(msg.InflationShareWeight); err != nil { return errors.Wrapf(errorsTypes.ErrInvalidRequest, "invalid inflation share weight") } @@ -64,7 +66,7 @@ type PoolUpdate struct { Logo *string Config *string UploadInterval *uint64 - InflationShareWeight *uint64 + InflationShareWeight *math.LegacyDec MinDelegation *uint64 MaxBundleSize *uint64 StorageProviderId *uint32 @@ -90,7 +92,7 @@ func (msg *MsgUpdatePool) ValidateBasic() error { } if payload.InflationShareWeight != nil { - if err := util.ValidateNumber(*payload.InflationShareWeight); err != nil { + if err := util.ValidateDecimal(*payload.InflationShareWeight); err != nil { return errors.Wrapf(errorsTypes.ErrInvalidRequest, "invalid inflation share weight") } } diff --git a/x/pool/types/pool.pb.go b/x/pool/types/pool.pb.go index ad02386f..8e166a46 100644 --- a/x/pool/types/pool.pb.go +++ b/x/pool/types/pool.pb.go @@ -4,6 +4,7 @@ package types import ( + cosmossdk_io_math "cosmossdk.io/math" fmt "fmt" _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/cosmos/gogoproto/proto" @@ -252,7 +253,7 @@ type Pool struct { // upload_interval ... UploadInterval uint64 `protobuf:"varint,11,opt,name=upload_interval,json=uploadInterval,proto3" json:"upload_interval,omitempty"` // inflation_share_weight ... - InflationShareWeight uint64 `protobuf:"varint,12,opt,name=inflation_share_weight,json=inflationShareWeight,proto3" json:"inflation_share_weight,omitempty"` + InflationShareWeight cosmossdk_io_math.LegacyDec `protobuf:"bytes,12,opt,name=inflation_share_weight,json=inflationShareWeight,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"inflation_share_weight"` // min_delegation ... MinDelegation uint64 `protobuf:"varint,13,opt,name=min_delegation,json=minDelegation,proto3" json:"min_delegation,omitempty"` // max_bundle_size ... @@ -383,13 +384,6 @@ func (m *Pool) GetUploadInterval() uint64 { return 0 } -func (m *Pool) GetInflationShareWeight() uint64 { - if m != nil { - return m.InflationShareWeight - } - return 0 -} - func (m *Pool) GetMinDelegation() uint64 { if m != nil { return m.MinDelegation @@ -456,59 +450,61 @@ func init() { func init() { proto.RegisterFile("kyve/pool/v1beta1/pool.proto", fileDescriptor_40c1730f47ff2ef8) } var fileDescriptor_40c1730f47ff2ef8 = []byte{ - // 820 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x94, 0x41, 0x6f, 0xdb, 0x36, - 0x14, 0xc7, 0x2d, 0xd7, 0x49, 0x6c, 0x3a, 0x71, 0x5c, 0xce, 0x4b, 0xb9, 0x78, 0x70, 0xdd, 0x0c, - 0xdd, 0xbc, 0x1d, 0x6c, 0x74, 0x1b, 0xb0, 0xd3, 0x0e, 0x8e, 0xa5, 0x3a, 0x42, 0x02, 0xc9, 0x90, - 0xec, 0x14, 0xdd, 0x85, 0xa0, 0x2d, 0x56, 0x26, 0x22, 0x89, 0x82, 0x44, 0xb9, 0x71, 0x8f, 0x03, - 0x06, 0xec, 0xb8, 0xef, 0xb0, 0x2f, 0xb3, 0x63, 0x8f, 0x3b, 0x0e, 0xc9, 0x67, 0xd8, 0x7d, 0x20, - 0x25, 0x7b, 0x6e, 0xb6, 0x53, 0x6f, 0xef, 0xfd, 0xfe, 0xff, 0xc7, 0x47, 0x8a, 0x8f, 0x02, 0x9f, - 0xdf, 0xac, 0x57, 0x74, 0x10, 0x73, 0x1e, 0x0c, 0x56, 0x2f, 0xe6, 0x54, 0x90, 0x17, 0x2a, 0xe9, - 0xc7, 0x09, 0x17, 0x1c, 0x3e, 0x96, 0x6a, 0x5f, 0x81, 0x42, 0x3d, 0x6d, 0xf9, 0xdc, 0xe7, 0x4a, - 0x1d, 0xc8, 0x28, 0x37, 0x9e, 0x2d, 0x40, 0x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0xfa, 0xc1, 0x7e, 0x26, - 0x63, 0x67, 0xa8, 0x9b, 0xd6, 0xb8, 0xb9, 0xf7, 0x70, 0x85, 0x6b, 0x7b, 0x6a, 0x5a, 0x63, 0x3c, - 0xb1, 0x5f, 0x19, 0x0e, 0x9e, 0xda, 0x36, 0xbe, 0x30, 0xc7, 0x17, 0xcd, 0x7d, 0xf8, 0x14, 0xb4, - 0x77, 0x6d, 0x86, 0xa5, 0xe3, 0x4b, 0xe3, 0x35, 0x76, 0x8c, 0xe1, 0xe8, 0xc2, 0xd0, 0x9b, 0x07, - 0xa7, 0x95, 0x5f, 0x7f, 0xef, 0x94, 0xce, 0x47, 0x7f, 0xdc, 0x75, 0xb4, 0xf7, 0x77, 0x1d, 0xed, - 0xaf, 0xbb, 0x8e, 0xf6, 0xdb, 0x7d, 0xa7, 0xf4, 0xfe, 0xbe, 0x53, 0xfa, 0xf3, 0xbe, 0x53, 0xfa, - 0xe9, 0x6b, 0x9f, 0x89, 0x65, 0x36, 0xef, 0x2f, 0x78, 0x38, 0xb8, 0x7c, 0x7d, 0x6d, 0x58, 0x54, - 0xbc, 0xe5, 0xc9, 0xcd, 0x60, 0xb1, 0x24, 0x2c, 0x1a, 0xdc, 0xe6, 0x3f, 0x59, 0xb1, 0x8e, 0x69, - 0x3a, 0xdf, 0x57, 0x73, 0xf2, 0xdd, 0x3f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x06, 0x44, 0xea, 0xbf, - 0x7e, 0x05, 0x00, 0x00, + // 855 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x54, 0xcf, 0x8f, 0xda, 0x46, + 0x14, 0xc6, 0x84, 0xb0, 0x30, 0xec, 0xb2, 0x64, 0x4a, 0x37, 0xd3, 0xa5, 0x62, 0xc9, 0x46, 0x69, + 0x69, 0x0f, 0xa0, 0xb4, 0x95, 0x7a, 0xea, 0x81, 0xc5, 0x0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0x7a, 0xeb, 0x9f, 0xfe, 0x56, 0x06, 0xa5, 0xa9, 0x10, 0x1e, 0xac, 0x83, 0x22, 0xa7, 0xaa, 0x70, + 0xc9, 0x2a, 0x72, 0x0a, 0x21, 0x28, 0x05, 0xc4, 0x67, 0x79, 0x3d, 0x65, 0xa7, 0x1d, 0x46, 0x49, + 0x20, 0xb9, 0x9f, 0xcd, 0x53, 0xb5, 0x36, 0x6e, 0xaa, 0xf6, 0x84, 0x2b, 0x54, 0xfa, 0xaa, 0xa5, + 0x6c, 0x78, 0x04, 0xca, 0x8e, 0x08, 0x5e, 0x71, 0x17, 0x3d, 0x54, 0x68, 0xee, 0xc1, 0x16, 0xa8, + 0xc6, 0x92, 0x44, 0x12, 0xdf, 0xb0, 0x35, 0x2a, 0x67, 0xe3, 0x28, 0xe0, 0x82, 0xad, 0xe1, 0x09, + 0xa8, 0x39, 0x49, 0x14, 0xb1, 0x20, 0xa3, 0xf7, 0x14, 0x0d, 0x72, 0x28, 0x15, 0x7c, 0x09, 0x0e, + 0x37, 0x82, 0x38, 0xf1, 0x7d, 0x12, 0xad, 0x51, 0x45, 0x89, 0xea, 0x39, 0x6c, 0x67, 0x28, 0x7c, + 0x0a, 0x0e, 0x36, 0x42, 0x1e, 0x50, 0x76, 0x8b, 0xaa, 0x6a, 0xb6, 0xfd, 0x1c, 0x34, 0x53, 0x2c, + 0x15, 0x49, 0x21, 0x89, 0x87, 0x17, 0x49, 0x40, 0x3d, 0x16, 0x23, 0x90, 0x89, 0x14, 0x78, 0x96, + 0x61, 0x69, 0xc9, 0x24, 0xf4, 0x04, 0xa1, 0x98, 0x07, 0x92, 0x45, 0x2b, 0xe2, 0xa1, 0x9a, 0x92, + 0xd5, 0x33, 0xd8, 0xcc, 0x51, 0x78, 0x0d, 0x8e, 0x78, 0xf0, 0xca, 0x53, 0x5f, 0x16, 0xc7, 0x4b, + 0x12, 0x31, 0xfc, 0x9a, 0x71, 0x77, 0x29, 0xd1, 0x7e, 0xda, 0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 0xf9, 0xbd, 0x5d, 0x38, 0x1b, 0xbe, 0xbd, 0x6b, 0x6b, 0xef, + 0xee, 0xda, 0xda, 0x5f, 0x77, 0x6d, 0xed, 0xd7, 0xfb, 0x76, 0xe1, 0xdd, 0x7d, 0xbb, 0xf0, 0xc7, + 0x7d, 0xbb, 0xf0, 0xe3, 0x57, 0x2e, 0x97, 0xcb, 0x64, 0xd1, 0x73, 0x84, 0xdf, 0xbf, 0xb8, 0xbe, + 0x32, 0xc6, 0x4c, 0xbe, 0x16, 0xd1, 0x4d, 0xdf, 0x59, 0x12, 0x1e, 0xf4, 0x6f, 0xb3, 0x3f, 0xb1, + 0x5c, 0x87, 0x2c, 0x5e, 0x94, 0xd5, 0x9e, 0x7c, 0xfb, 0x77, 0x00, 0x00, 0x00, 0xff, 0xff, 0xf5, + 0x7e, 0x8c, 0x21, 0xa3, 0x05, 0x00, 0x00, } func (m *Protocol) Marshal() (dAtA []byte, err error) { @@ -691,11 +687,16 @@ func (m *Pool) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x68 } - if m.InflationShareWeight != 0 { - i = encodeVarintPool(dAtA, i, uint64(m.InflationShareWeight)) - i-- - dAtA[i] = 0x60 + { + size := m.InflationShareWeight.Size() + i -= size + if _, err := m.InflationShareWeight.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintPool(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0x62 if m.UploadInterval != 0 { i = encodeVarintPool(dAtA, i, uint64(m.UploadInterval)) i-- @@ -868,9 +869,8 @@ func (m *Pool) Size() (n int) { if m.UploadInterval != 0 { n += 1 + sovPool(uint64(m.UploadInterval)) } - if m.InflationShareWeight != 0 { - n += 1 + sovPool(uint64(m.InflationShareWeight)) - } + l = m.InflationShareWeight.Size() + n += 1 + l + sovPool(uint64(l)) if m.MinDelegation != 0 { n += 1 + sovPool(uint64(m.MinDelegation)) } @@ -1522,10 +1522,10 @@ func (m *Pool) Unmarshal(dAtA []byte) error { } } case 12: - if wireType != 0 { + if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field InflationShareWeight", wireType) } - m.InflationShareWeight = 0 + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowPool @@ -1535,11 +1535,26 @@ func (m *Pool) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.InflationShareWeight |= uint64(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthPool + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthPool + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.InflationShareWeight.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex case 13: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field MinDelegation", wireType) diff --git a/x/pool/types/tx.pb.go b/x/pool/types/tx.pb.go index 76953d6e..770b235e 100644 --- a/x/pool/types/tx.pb.go +++ b/x/pool/types/tx.pb.go @@ -5,9 +5,11 @@ package types import ( context "context" + cosmossdk_io_math "cosmossdk.io/math" fmt "fmt" _ "github.com/cosmos/cosmos-proto" _ "github.com/cosmos/cosmos-sdk/types/msgservice" + _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/cosmos/gogoproto/grpc" proto "github.com/cosmos/gogoproto/proto" grpc "google.golang.org/grpc" @@ -46,7 +48,7 @@ type MsgCreatePool struct { // upload_interval ... UploadInterval uint64 `protobuf:"varint,7,opt,name=upload_interval,json=uploadInterval,proto3" json:"upload_interval,omitempty"` // inflation_share_weight ... - InflationShareWeight uint64 `protobuf:"varint,8,opt,name=inflation_share_weight,json=inflationShareWeight,proto3" json:"inflation_share_weight,omitempty"` + InflationShareWeight cosmossdk_io_math.LegacyDec `protobuf:"bytes,8,opt,name=inflation_share_weight,json=inflationShareWeight,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"inflation_share_weight"` // min_delegation ... MinDelegation uint64 `protobuf:"varint,9,opt,name=min_delegation,json=minDelegation,proto3" json:"min_delegation,omitempty"` // max_bundle_size ... @@ -145,13 +147,6 @@ func (m *MsgCreatePool) GetUploadInterval() uint64 { return 0 } -func (m *MsgCreatePool) GetInflationShareWeight() uint64 { - if m != nil { - return m.InflationShareWeight - } - return 0 -} - func (m *MsgCreatePool) GetMinDelegation() uint64 { if m != nil { return m.MinDelegation @@ -855,62 +850,64 @@ func init() { func init() { proto.RegisterFile("kyve/pool/v1beta1/tx.proto", fileDescriptor_20ddefdf83388ddc) } var fileDescriptor_20ddefdf83388ddc = []byte{ - // 867 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x56, 0x4f, 0x6f, 0x1b, 0x45, - 0x14, 0xcf, 0x3a, 0xce, 0xbf, 0x97, 0xd8, 0x51, 0x87, 0x90, 0x6c, 0x16, 0xc9, 0x24, 0x41, 0x40, - 0x1a, 0x81, 0x57, 0x29, 0x15, 0x07, 0x6e, 0x4d, 0xdb, 0x43, 0x14, 0x05, 0x55, 0x8e, 0xca, 0x5f, - 0x89, 0xd5, 0xd8, 0x33, 0x5d, 0x8f, 0xb2, 0x3b, 0xb3, 0x9a, 0x19, 0xbb, 0x71, 0xe1, 0x00, 0x7c, - 0x02, 0x3e, 0x03, 0x9f, 0xa0, 0x07, 0x3e, 0x04, 0x17, 0xa4, 0x8a, 0x13, 0x47, 0x94, 0x1c, 0x7a, - 0xe7, 0x13, 0xa0, 0x99, 0x5d, 0xaf, 0x77, 0x65, 0x6f, 0x03, 0x94, 0x9c, 0xec, 0xf7, 0x7e, 0xbf, - 0x9d, 0xf7, 0x9b, 0x37, 0xef, 0x37, 0xbb, 0xe0, 0x9d, 0x8f, 0x86, 0xd4, 0x4f, 0x84, 0x88, 0xfc, - 0xe1, 0x61, 0x97, 0x6a, 0x7c, 0x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, - 0x45, 0xfb, 0x19, 0xf5, 0xd1, 0xdf, 0x01, 0x00, 0x00, 0xff, 0xff, 0x98, 0x35, 0x21, 0xbd, 0xab, - 0x09, 0x00, 0x00, + // 907 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x56, 0x4f, 0x6f, 0xdc, 0x44, + 0x14, 0x8f, 0x37, 0x9b, 0x7f, 0x93, 0xec, 0x46, 0x35, 0x21, 0x71, 0x5c, 0x69, 0xf3, 0xa7, 0x02, + 0xd2, 0x08, 0x6c, 0xa5, 0x20, 0x0e, 0xdc, 0x9a, 0xa6, 0x87, 0x28, 0x04, 0x55, 0x8e, 0x0a, 0x14, + 0x24, 0xac, 0x59, 0xcf, 0x74, 0x76, 0x14, 0x7b, 0xc6, 0x9a, 0x99, 0xdd, 0xee, 0x16, 0x0e, 0xc0, + 0x27, 0xe0, 0xa3, 0xf4, 0xc0, 0x77, 0xa0, 0x17, 0xa4, 0x8a, 0x13, 0xe2, 0x50, 0xa1, 0xe4, 0xd0, + 0x3b, 0x9f, 0x00, 0xcd, 0xd8, 0xeb, 0xf5, 0x6a, 0xd7, 0x0d, 0x50, 0x72, 0x5a, 0xbf, 0xf7, 0x7e, + 0xfb, 0xde, 0x6f, 0xde, 0x7b, 0xbf, 0xb1, 0x81, 0x7b, 0x3e, 0xe8, 0x61, 0x3f, 0xe5, 0x3c, 0xf6, + 0x7b, 0x07, 0x6d, 0xac, 0xe0, 0x81, 0xaf, 0xfa, 0x5e, 0x2a, 0xb8, 0xe2, 0xf6, 0x0d, 0x1d, 0xf3, + 0x74, 0xcc, 0xcb, 0x63, 0xee, 0x46, 0xc4, 0x65, 0xc2, 0xa5, 0x9f, 0x48, 0xe2, 0xf7, 0x0e, 0xf4, + 0x4f, 0x86, 0x75, 0x37, 0xb3, 0x40, 0x68, 0x2c, 0x3f, 0x33, 0xf2, 0xd0, 0x1a, 0xe1, 0x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6, 0x5b, 0xeb, 0xc3, 0xbf, 0x03, 0x00, + 0x00, 0xff, 0xff, 0xfd, 0x1d, 0x19, 0xf0, 0xe6, 0x09, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1298,11 +1295,16 @@ func (m *MsgCreatePool) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x48 } - if m.InflationShareWeight != 0 { - i = encodeVarintTx(dAtA, i, uint64(m.InflationShareWeight)) - i-- - dAtA[i] = 0x40 + { + size := m.InflationShareWeight.Size() + i -= size + if _, err := m.InflationShareWeight.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTx(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0x42 if m.UploadInterval != 0 { i = encodeVarintTx(dAtA, i, uint64(m.UploadInterval)) i-- @@ -1805,9 +1807,8 @@ func (m *MsgCreatePool) Size() (n int) { if m.UploadInterval != 0 { n += 1 + sovTx(uint64(m.UploadInterval)) } - if m.InflationShareWeight != 0 { - n += 1 + sovTx(uint64(m.InflationShareWeight)) - } + l = m.InflationShareWeight.Size() + n += 1 + l + sovTx(uint64(l)) if m.MinDelegation != 0 { n += 1 + sovTx(uint64(m.MinDelegation)) } @@ -2262,10 +2263,10 @@ func (m *MsgCreatePool) Unmarshal(dAtA []byte) error { } } case 8: - if wireType != 0 { + if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field InflationShareWeight", wireType) } - m.InflationShareWeight = 0 + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -2275,11 +2276,26 @@ func (m *MsgCreatePool) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.InflationShareWeight |= uint64(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.InflationShareWeight.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex case 9: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field MinDelegation", wireType) diff --git a/x/query/keeper/grpc_account_redelegation_test.go b/x/query/keeper/grpc_account_redelegation_test.go index 4774f56a..e9c27aca 100644 --- a/x/query/keeper/grpc_account_redelegation_test.go +++ b/x/query/keeper/grpc_account_redelegation_test.go @@ -1,6 +1,7 @@ package keeper_test import ( + "cosmossdk.io/math" i "github.com/KYVENetwork/chain/testutil/integration" delegationtypes "github.com/KYVENetwork/chain/x/delegation/types" pooltypes "github.com/KYVENetwork/chain/x/pool/types" @@ -30,11 +31,12 @@ var _ = Describe("grpc_account_redelegation.go", Ordered, func() { // create 2 pools gov := s.App().GovKeeper.GetGovernanceAccount(s.Ctx()).GetAddress().String() msg := &pooltypes.MsgCreatePool{ - Authority: gov, - MinDelegation: 200 * i.KYVE, - UploadInterval: 60, - MaxBundleSize: 100, - Binaries: "{}", + Authority: gov, + MinDelegation: 200 * i.KYVE, + UploadInterval: 60, + MaxBundleSize: 100, + InflationShareWeight: math.LegacyZeroDec(), + Binaries: "{}", } s.RunTxPoolSuccess(msg) s.RunTxPoolSuccess(msg) diff --git a/x/query/keeper/grpc_query_can_propose_test.go b/x/query/keeper/grpc_query_can_propose_test.go index 99920d8f..8f58eeaf 100644 --- a/x/query/keeper/grpc_query_can_propose_test.go +++ b/x/query/keeper/grpc_query_can_propose_test.go @@ -2,6 +2,7 @@ package keeper_test import ( "cosmossdk.io/errors" + "cosmossdk.io/math" i "github.com/KYVENetwork/chain/testutil/integration" bundletypes "github.com/KYVENetwork/chain/x/bundles/types" delegationtypes "github.com/KYVENetwork/chain/x/delegation/types" @@ -40,11 +41,12 @@ var _ = Describe("grpc_query_can_propose.go", Ordered, func() { gov := s.App().GovKeeper.GetGovernanceAccount(s.Ctx()).GetAddress().String() msg := &pooltypes.MsgCreatePool{ - Authority: gov, - MinDelegation: 200 * i.KYVE, - UploadInterval: 60, - MaxBundleSize: 100, - Binaries: "{}", + Authority: gov, + MinDelegation: 200 * i.KYVE, + UploadInterval: 60, + MaxBundleSize: 100, + InflationShareWeight: math.LegacyZeroDec(), + Binaries: "{}", } s.RunTxPoolSuccess(msg) diff --git a/x/query/keeper/grpc_query_can_validate_test.go b/x/query/keeper/grpc_query_can_validate_test.go index 681255c0..fd6a4209 100644 --- a/x/query/keeper/grpc_query_can_validate_test.go +++ b/x/query/keeper/grpc_query_can_validate_test.go @@ -2,6 +2,7 @@ package keeper_test import ( "cosmossdk.io/errors" + "cosmossdk.io/math" i "github.com/KYVENetwork/chain/testutil/integration" pooltypes "github.com/KYVENetwork/chain/x/pool/types" querytypes "github.com/KYVENetwork/chain/x/query/types" @@ -31,11 +32,12 @@ var _ = Describe("grpc_query_can_validate.go", Ordered, func() { // create 2 pools gov := s.App().GovKeeper.GetGovernanceAccount(s.Ctx()).GetAddress().String() msg := &pooltypes.MsgCreatePool{ - Authority: gov, - MinDelegation: 200 * i.KYVE, - UploadInterval: 60, - MaxBundleSize: 100, - Binaries: "{}", + Authority: gov, + MinDelegation: 200 * i.KYVE, + UploadInterval: 60, + MaxBundleSize: 100, + InflationShareWeight: math.LegacyZeroDec(), + Binaries: "{}", } s.RunTxPoolSuccess(msg) s.RunTxPoolSuccess(msg) diff --git a/x/query/keeper/grpc_query_can_vote_test.go b/x/query/keeper/grpc_query_can_vote_test.go index ede75f43..0561506e 100644 --- a/x/query/keeper/grpc_query_can_vote_test.go +++ b/x/query/keeper/grpc_query_can_vote_test.go @@ -2,6 +2,7 @@ package keeper_test import ( "cosmossdk.io/errors" + "cosmossdk.io/math" i "github.com/KYVENetwork/chain/testutil/integration" bundletypes "github.com/KYVENetwork/chain/x/bundles/types" delegationtypes "github.com/KYVENetwork/chain/x/delegation/types" @@ -41,11 +42,12 @@ var _ = Describe("grpc_query_can_vote.go", Ordered, func() { gov := s.App().GovKeeper.GetGovernanceAccount(s.Ctx()).GetAddress().String() msg := &pooltypes.MsgCreatePool{ - Authority: gov, - MinDelegation: 200 * i.KYVE, - UploadInterval: 60, - MaxBundleSize: 100, - Binaries: "{}", + Authority: gov, + MinDelegation: 200 * i.KYVE, + UploadInterval: 60, + MaxBundleSize: 100, + InflationShareWeight: math.LegacyZeroDec(), + Binaries: "{}", } s.RunTxPoolSuccess(msg) diff --git a/x/query/types/query.pb.go b/x/query/types/query.pb.go index e910a714..d1e5a6c1 100644 --- a/x/query/types/query.pb.go +++ b/x/query/types/query.pb.go @@ -41,7 +41,7 @@ type BasicPool struct { // logo of the pool Logo string `protobuf:"bytes,4,opt,name=logo,proto3" json:"logo,omitempty"` // inflation_share_weight is the base payout for each bundle reward - InflationShareWeight uint64 `protobuf:"varint,5,opt,name=inflation_share_weight,json=inflationShareWeight,proto3" json:"inflation_share_weight,omitempty"` + InflationShareWeight cosmossdk_io_math.LegacyDec `protobuf:"bytes,5,opt,name=inflation_share_weight,json=inflationShareWeight,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"inflation_share_weight"` // upload_interval is the interval bundles get created UploadInterval uint64 `protobuf:"varint,6,opt,name=upload_interval,json=uploadInterval,proto3" json:"upload_interval,omitempty"` // total_funds of the pool. If the pool runs @@ -115,13 +115,6 @@ func (m *BasicPool) GetLogo() string { return "" } -func (m *BasicPool) GetInflationShareWeight() uint64 { - if m != nil { - return m.InflationShareWeight - } - return 0 -} - func (m *BasicPool) GetUploadInterval() uint64 { if m != nil { return m.UploadInterval @@ -523,62 +516,62 @@ func init() { func init() { proto.RegisterFile("kyve/query/v1beta1/query.proto", fileDescriptor_6b41255feae93a15) } var fileDescriptor_6b41255feae93a15 = []byte{ - // 869 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x55, 0x41, 0x6f, 0xdc, 0x44, - 0x14, 0x8e, 0xb3, 0x9b, 0x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0x4b, 0xc5, 0x37, 0xd0, 0xf6, 0x4c, 0x30, - 0xae, 0x95, 0xcd, 0xd1, 0x25, 0xb5, 0x85, 0x6f, 0x21, 0xc4, 0x54, 0x5c, 0x00, 0x9d, 0x9b, 0x8d, - 0x33, 0x73, 0xd4, 0x23, 0x7d, 0xa6, 0x1e, 0x39, 0x00, 0x07, 0x08, 0xcd, 0x69, 0xd1, 0xbc, 0x25, - 0xdc, 0x2c, 0x2d, 0x21, 0x66, 0x44, 0x12, 0x5a, 0x50, 0x9e, 0x42, 0xbd, 0x7a, 0x8d, 0x79, 0x7a, - 0xf6, 0xec, 0x32, 0xf0, 0x9e, 0x5f, 0x06, 0xde, 0xdf, 0x97, 0x81, 0xf7, 0xc3, 0x55, 0xb0, 0xf1, - 0xfc, 0x2a, 0xd8, 0xf8, 0xfd, 0x2a, 0xd8, 0xf8, 0xe6, 0xde, 0x52, 0x5b, 0x3e, 0xfd, 0xfa, 0xcb, - 0x07, 0x9f, 0x81, 0xbe, 0x10, 0x72, 0x1a, 0xa5, 0x13, 0xca, 0x78, 0xf4, 0x6d, 0xfd, 0x39, 0xb3, - 0xed, 0x49, 0xb6, 0xed, 0xc7, 0xe4, 0xfd, 0x7f, 0x03, 0x00, 0x00, 0xff, 0xff, 0x00, 0xa0, 0xc6, - 0xe4, 0xe9, 0x06, 0x00, 0x00, + // 871 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x55, 0x4f, 0x6f, 0x1b, 0x45, + 0x14, 0xcf, 0xc6, 0x4e, 0x62, 0x4f, 0xc0, 0xa1, 0xa3, 0xd2, 0x6e, 0x02, 0xdd, 0x44, 0xee, 0xa1, + 0x6e, 0x25, 0x76, 0x95, 0xa0, 0x4a, 0x88, 0x03, 0x87, 0x38, 0xad, 0x84, 0x68, 0x11, 0x9a, 0x0a, + 0x50, 0xb9, 0xac, 0x66, 0x77, 0x5f, 0xd6,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0x8b, + 0xe6, 0x95, 0xb0, 0xb3, 0xb4, 0x84, 0xe8, 0x11, 0x49, 0x68, 0x41, 0x79, 0x0a, 0x6e, 0xf5, 0x1a, + 0xf1, 0xf4, 0xec, 0xf9, 0x65, 0xe0, 0xbd, 0xb8, 0x0c, 0xbc, 0x3f, 0x2f, 0x03, 0xef, 0xbb, 0xab, + 0x60, 0xe3, 0xc5, 0x55, 0xb0, 0xf1, 0xeb, 0x55, 0xb0, 0xf1, 0xd5, 0xbd, 0xa5, 0xb6, 0x7c, 0xf2, + 0xf4, 0x8b, 0x07, 0x9f, 0x82, 0xba, 0x10, 0xd5, 0x34, 0x4a, 0x27, 0x94, 0xf1, 0xe8, 0x6b, 0xf7, + 0xcd, 0x33, 0xed, 0x49, 0xb6, 0xcd, 0x17, 0xe7, 0xfd, 0xbf, 0x03, 0x00, 0x00, 0xff, 0xff, 0xea, + 0xce, 0x18, 0xb8, 0x0e, 0x07, 0x00, 0x00, } func (m *BasicPool) Marshal() (dAtA []byte, err error) { @@ -630,11 +623,16 @@ func (m *BasicPool) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x30 } - if m.InflationShareWeight != 0 { - i = encodeVarintQuery(dAtA, i, uint64(m.InflationShareWeight)) - i-- - dAtA[i] = 0x28 + { + size := m.InflationShareWeight.Size() + i -= size + if _, err := m.InflationShareWeight.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintQuery(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0x2a if len(m.Logo) > 0 { i -= len(m.Logo) copy(dAtA[i:], m.Logo) @@ -966,9 +964,8 @@ func (m *BasicPool) Size() (n int) { if l > 0 { n += 1 + l + sovQuery(uint64(l)) } - if m.InflationShareWeight != 0 { - n += 1 + sovQuery(uint64(m.InflationShareWeight)) - } + l = m.InflationShareWeight.Size() + n += 1 + l + sovQuery(uint64(l)) if m.UploadInterval != 0 { n += 1 + sovQuery(uint64(m.UploadInterval)) } @@ -1254,10 +1251,10 @@ func (m *BasicPool) Unmarshal(dAtA []byte) error { m.Logo = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 5: - if wireType != 0 { + if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field InflationShareWeight", wireType) } - m.InflationShareWeight = 0 + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -1267,11 +1264,26 @@ func (m *BasicPool) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.InflationShareWeight |= uint64(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.InflationShareWeight.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex case 6: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field UploadInterval", wireType) diff --git a/x/stakers/keeper/exported_functions_test.go b/x/stakers/keeper/exported_functions_test.go index 71eacd08..0dd34728 100644 --- a/x/stakers/keeper/exported_functions_test.go +++ b/x/stakers/keeper/exported_functions_test.go @@ -3,6 +3,8 @@ package keeper_test import ( "strconv" + "cosmossdk.io/math" + "github.com/cosmos/cosmos-sdk/x/gov/keeper" pooltypes "github.com/KYVENetwork/chain/x/pool/types" @@ -59,10 +61,11 @@ var _ = Describe("Protocol Governance Voting", Ordered, func() { // Create and join a pool. gov := s.App().GovKeeper.GetGovernanceAccount(s.Ctx()).GetAddress().String() msg := &pooltypes.MsgCreatePool{ - Authority: gov, - UploadInterval: 60, - MaxBundleSize: 100, - Binaries: "{}", + Authority: gov, + UploadInterval: 60, + MaxBundleSize: 100, + InflationShareWeight: math.LegacyZeroDec(), + Binaries: "{}", } s.RunTxPoolSuccess(msg) diff --git a/x/stakers/keeper/keeper.go b/x/stakers/keeper/keeper.go index 8d362475..6a850686 100644 --- a/x/stakers/keeper/keeper.go +++ b/x/stakers/keeper/keeper.go @@ -3,6 +3,8 @@ package keeper import ( "fmt" + sdk "github.com/cosmos/cosmos-sdk/types" + "cosmossdk.io/core/store" "github.com/KYVENetwork/chain/util" @@ -68,3 +70,8 @@ func SetDelegationKeeper(k *Keeper, delegationKeeper delegationKeeper.Keeper) { func (k Keeper) Logger() log.Logger { return k.logger.With("module", fmt.Sprintf("x/%s", types.ModuleName)) } + +// TODO: remove after migration +func (k Keeper) Migration_SetStaker(ctx sdk.Context, staker types.Staker) { + k.setStaker(ctx, staker) +} diff --git a/x/stakers/keeper/msg_server_claim_commission_rewards_test.go b/x/stakers/keeper/msg_server_claim_commission_rewards_test.go index 58d23ddd..227f9e65 100644 --- a/x/stakers/keeper/msg_server_claim_commission_rewards_test.go +++ b/x/stakers/keeper/msg_server_claim_commission_rewards_test.go @@ -86,7 +86,7 @@ var _ = Describe("msg_server_claim_commission_rewards.go", Ordered, func() { Config: "ar://DgdB-2hLrxjhyEEbCML__dgZN5_uS7T6Z5XDkaFh3P0", StartKey: "0", UploadInterval: 60, - InflationShareWeight: 10_000, + InflationShareWeight: math.LegacyNewDec(10_000), MinDelegation: 100 * i.KYVE, MaxBundleSize: 100, Version: "0.0.0", diff --git a/x/stakers/keeper/msg_server_join_pool_test.go b/x/stakers/keeper/msg_server_join_pool_test.go index 6277d38f..c4aa9a1c 100644 --- a/x/stakers/keeper/msg_server_join_pool_test.go +++ b/x/stakers/keeper/msg_server_join_pool_test.go @@ -1,6 +1,7 @@ package keeper_test import ( + "cosmossdk.io/math" delegationtypes "github.com/KYVENetwork/chain/x/delegation/types" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" @@ -54,10 +55,11 @@ var _ = Describe("msg_server_join_pool.go", Ordered, func() { // create pool msg := &pooltypes.MsgCreatePool{ - Authority: gov, - UploadInterval: 60, - MaxBundleSize: 100, - Binaries: "{}", + Authority: gov, + UploadInterval: 60, + MaxBundleSize: 100, + InflationShareWeight: math.LegacyZeroDec(), + Binaries: "{}", } s.RunTxPoolSuccess(msg) @@ -175,10 +177,11 @@ var _ = Describe("msg_server_join_pool.go", Ordered, func() { It("Join disabled pool", func() { // ARRANGE msg := &pooltypes.MsgCreatePool{ - Authority: gov, - UploadInterval: 60, - MaxBundleSize: 100, - Binaries: "{}", + Authority: gov, + UploadInterval: 60, + MaxBundleSize: 100, + InflationShareWeight: math.LegacyZeroDec(), + Binaries: "{}", } s.RunTxPoolSuccess(msg) @@ -394,10 +397,11 @@ var _ = Describe("msg_server_join_pool.go", Ordered, func() { }) msg := &pooltypes.MsgCreatePool{ - Authority: gov, - UploadInterval: 60, - MaxBundleSize: 100, - Binaries: "{}", + Authority: gov, + UploadInterval: 60, + MaxBundleSize: 100, + InflationShareWeight: math.LegacyZeroDec(), + Binaries: "{}", } s.RunTxPoolSuccess(msg) @@ -417,10 +421,11 @@ var _ = Describe("msg_server_join_pool.go", Ordered, func() { It("Try to join pool with a valaddress that is already used by another staker", func() { // ARRANGE msg := &pooltypes.MsgCreatePool{ - Authority: gov, - UploadInterval: 60, - MaxBundleSize: 100, - Binaries: "{}", + Authority: gov, + UploadInterval: 60, + MaxBundleSize: 100, + InflationShareWeight: math.LegacyZeroDec(), + Binaries: "{}", } s.RunTxPoolSuccess(msg) @@ -486,10 +491,11 @@ var _ = Describe("msg_server_join_pool.go", Ordered, func() { }) msg := &pooltypes.MsgCreatePool{ - Authority: gov, - UploadInterval: 60, - MaxBundleSize: 100, - Binaries: "{}", + Authority: gov, + UploadInterval: 60, + MaxBundleSize: 100, + InflationShareWeight: math.LegacyZeroDec(), + Binaries: "{}", } s.RunTxPoolSuccess(msg) diff --git a/x/stakers/keeper/msg_server_leave_pool_test.go b/x/stakers/keeper/msg_server_leave_pool_test.go index 347bc6d1..6e218183 100644 --- a/x/stakers/keeper/msg_server_leave_pool_test.go +++ b/x/stakers/keeper/msg_server_leave_pool_test.go @@ -1,6 +1,7 @@ package keeper_test import ( + "cosmossdk.io/math" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" @@ -31,10 +32,11 @@ var _ = Describe("msg_server_leave_pool.go", Ordered, func() { // create pool msg := &pooltypes.MsgCreatePool{ - Authority: gov, - UploadInterval: 60, - MaxBundleSize: 100, - Binaries: "{}", + Authority: gov, + UploadInterval: 60, + MaxBundleSize: 100, + InflationShareWeight: math.LegacyZeroDec(), + Binaries: "{}", } s.RunTxPoolSuccess(msg) @@ -208,10 +210,11 @@ var _ = Describe("msg_server_leave_pool.go", Ordered, func() { It("Leave one of multiple pools a staker has previously joined", func() { // ARRANGE msg := &pooltypes.MsgCreatePool{ - Authority: gov, - UploadInterval: 60, - MaxBundleSize: 100, - Binaries: "{}", + Authority: gov, + UploadInterval: 60, + MaxBundleSize: 100, + InflationShareWeight: math.LegacyZeroDec(), + Binaries: "{}", } s.RunTxPoolSuccess(msg)