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/upgrades/v1_5/upgrade.go b/app/upgrades/v1_5/upgrade.go index 7fa6d2b3..7408dffc 100644 --- a/app/upgrades/v1_5/upgrade.go +++ b/app/upgrades/v1_5/upgrade.go @@ -10,7 +10,7 @@ import ( "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" - "github.com/KYVENetwork/chain/app/upgrades/v1_5/v1_4_types/pool" + 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" @@ -60,6 +60,7 @@ func CreateUpgradeHandler(mm *module.Manager, configurator module.Configurator, // migrate pool migrateMaxVotingPowerInPool(sdkCtx, cdc, MustGetStoreKey(storeKeys, poolTypes.StoreKey), *poolKeeper) + migrateInflationShareWeight(sdkCtx, cdc, MustGetStoreKey(storeKeys, poolTypes.StoreKey), poolKeeper) return mm.RunMigrations(ctx, configurator, fromVM) } @@ -166,7 +167,7 @@ func migrateBundlesModule(sdkCtx sdk.Context, cdc codec.Codec, bundlesStoreKey s } func migrateMaxVotingPowerInPool(sdkCtx sdk.Context, cdc codec.Codec, poolStoreKey storetypes.StoreKey, poolKeeper poolKeeper.Keeper) { - oldParams := pool.GetParams(sdkCtx, cdc, poolStoreKey) + oldParams := v1_4_pool.GetParams(sdkCtx, cdc, poolStoreKey) poolKeeper.SetParams(sdkCtx, poolTypes.Params{ ProtocolInflationShare: oldParams.ProtocolInflationShare, @@ -174,3 +175,69 @@ func migrateMaxVotingPowerInPool(sdkCtx sdk.Context, cdc codec.Codec, poolStoreK 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/pool/getters_pool.go b/app/upgrades/v1_5/v1_4_types/pool/getters_pool.go index 4b66c4ce..19b5102c 100644 --- a/app/upgrades/v1_5/v1_4_types/pool/getters_pool.go +++ b/app/upgrades/v1_5/v1_4_types/pool/getters_pool.go @@ -1,6 +1,7 @@ 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" @@ -16,3 +17,19 @@ func GetParams(ctx sdk.Context, cdc codec.Codec, storeKey storeTypes.StoreKey) ( 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/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, 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, 0x75, 0x22, 0x83, 0x05, 0x0f, 0x20, 0x02, 0x07, 0x2b, + 0x9a, 0xa4, 0x8c, 0x47, 0x48, 0xeb, 0x6a, 0xbd,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 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, +} + +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/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/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, 0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, 0x56, 0x4d, 0x49, 0x16, 0x49, - 0xd8, 0xc8, 0xba, 0x57, 0xcb, 0x59, 0xca, 0x5f, 0xce, 0x72, 0xfe, 0x72, 0x6e, 0xe5, 0x2e, 0x67, - 0x65, 0x63, 0x39, 0xdf, 0xaf, 0xfd, 0x7b, 0xcb, 0x26, 0xd5, 0x5e, 0xbf, 0x49, 0xbb, 0x39, 0x9b, - 0xd4, 0x1d, 0xa3, 0x8f, 0x56, 0xed, 0xfa, 0x39, 0xe6, 0x54, 0x8d, 0x02, 0xa2, 0x66, 0x60, 0x57, - 0xcc, 0xb4, 0x19, 0xaf, 0x1a, 0x57, 0x31, 0xe6, 0xc0, 0x8e, 0x08, 0xa1, 0xd4, 0x64, 0xc8, 0xc6, - 0x3b, 0x35, 0x8d, 0xd0, 0x24, 0x14, 0x31, 0xcf, 0x06, 0x3b, 0xb5, 0x4e, 0x4e, 0xef, 0x1f, 0xdb, - 0xce, 0xc3, 0x63, 0xdb, 0xf9, 0xf7, 0xb1, 0xed, 0xfc, 0xf9, 0xd4, 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, 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, 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, 0x75, 0x22, 0x83, 0x05, 0x0f, 0x20, 0x02, 0x07, 0x2b, - 0x9a, 0xa4, 0x8c, 0x47, 0x48, 0xeb, 0x6a, 0xbd, 0x9a, 0xb3, 0x49, 0xe1, 0x29, 0xa8, 0xce, 0x59, - 0x44, 0x12, 0x46, 0x53, 0x54, 0x56, 0xd2, 0x36, 0x87, 0xcf, 0xc0, 0x61, 0x40, 0x52, 0x81, 0xb3, - 0xd8, 0x4f, 0x88, 0x47, 0xd1, 0xa3, 0xae, 0xd6, 0xab, 0x38, 0x75, 0xc9, 0x66, 0x39, 0x3a, 0xfb, - 0x59, 0x03, 0xf5, 0x22, 0x9e, 0x04, 0x24, 0xfa, 0xf8, 0x46, 0xe9, 0x62, 0x49, 0xbd, 0x2c, 0xa0, - 0x1e, 0x26, 0x62, 0xd3, 0x68, 0xcb, 0x86, 0x42, 0x96, 0x7b, 0x59, 0x42, 0x84, 0x5c, 0xb9, 0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 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, 0x0e, 0x6b, 0xed, 0x0a, 0x90, 0x0d, 0x1b, + 0x6d, 0x2f, 0xa3, 0xc1, 0x33, 0x31, 0xa3, 0xb5, 0x3d, 0x96, 0x3d, 0x26, 0x4b, 0x8e, 0x95, 0x2a, + 0xf5, 0xd8, 0x73, 0xaf, 0xfd, 0x67, 0x72, 0xcc, 0xb1, 0xea, 0x21, 0xaa, 0x76, 0xff, 0x91, 0xca, + 0x63, 0x43, 0x49, 0xda, 0x53, 0x6f, 0xef, 0x7d, 0xdf, 0xf7, 0x7e, 0x79, 0xde, 0x33, 0xf8, 0xfc, + 0x66, 0xbd, 0x62, 0xfd, 0x50, 0x08, 0xaf, 0xbf, 0x7a, 0xbe, 0x60, 0x92, 0x3c, 0x57, 0x4e, 0x2f, + 0x8c, 0x84, 0x14, 0xf0, 0x51, 0xca, 0xf6, 0x14, 0x90, 0xb3, 0xc7, 0x4d, 0x57, 0xb8, 0x42, 0xb1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b, 0x70, 0x76, 0x69, 0xe8, 0x8d, 0xe2, 0xc7, 0xcc, 0x78, 0x82, 0x5f, 0xcc, + 0xc7, 0xba, 0xdd, 0x78, 0x00, 0x9f, 0x81, 0x27, 0x1f, 0x32, 0x33, 0x6c, 0x8c, 0x27, 0xf3, 0xd1, + 0x39, 0xd6, 0x8d, 0x4b, 0x63, 0x34, 0x98, 0x99, 0x93, 0x71, 0xa3, 0x04, 0x3f, 0x03, 0x9f, 0x7e, + 0xd0, 0xcf, 0x74, 0x64, 0x0d, 0x74, 0x73, 0x3c, 0x6a, 0x3c, 0xfc, 0x38, 0xc3, 0xd5, 0x64, 0x66, + 0x8e, 0x47, 0x78, 0x3a, 0x79, 0x69, 0x58, 0x78, 0x36, 0x99, 0xe0, 0x73, 0x73, 0x74, 0xde, 0x28, + 0xc3, 0x13, 0xd0, 0xda, 0x95, 0x19, 0x63, 0x1d, 0x5f, 0x18, 0xd7, 0xd8, 0x32, 0x06, 0xc3, 0x73, + 0x43, 0x6f, 0xec, 0x1d, 0x97, 0x7e, 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, 0x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46, 0x95, 0xbb, 0x96, 0xee, 0x71, 0x1c, 0xa3, 0x36, 0xbc, 0xa1, 0xb4, 0x90, 0x38, 0xa4, - 0xe6, 0x08, 0x87, 0x8c, 0x50, 0x19, 0x30, 0xe2, 0x36, 0x76, 0x9c, 0xfd, 0x46, 0xe7, 0x56, 0x06, - 0x3d, 0xca, 0x90, 0x63, 0x62, 0x44, 0xf7, 0x44, 0x9c, 0x98, 0x73, 0x32, 0x9b, 0x65, 0xc4, 0x6d, - 0x5a, 0x6a, 0xa3, 0x90, 0x3d, 0x26, 0x68, 0x0b, 0x96, 0x28, 0x27, 0xb6, 0xab, 0xeb, 0x69, 0xc3, - 0x29, 0x27, 0x27, 0x74, 0xf4, 0x49, 0xf3, 0xc7, 0x97, 0xcf, 0x0f, 0x26, 0x47, 0xbb, 0xb7, 0x05, - 0x6f, 0x96, 0x66, 0xa4, 0x43, 0x55, 0x22, 0xb8, 0xa2, 0x7b, 0x3f, 0x38, 0x76, 0x7a, 0x1e, 0x27, - 0xe4, 0x75, 0xa7, 0xa7, 0x09, 0x35, 0x46, 0xec, 0xec, 0xd4, 0x3b, 0x35, 0x46, 0x4c, 0xa3, 0x12, - 0x3c, 0x32, 0x07, 0x38, 0x9e, 0x9c, 0x2c, 0xac, 0x10, 0x37, 0x91, 0x90, 0x8b, 0xeb, 0x43, 0xf3, - 0x54, 0x85, 0x0f, 0x98, 0xc2, 0xdd, 0xe8, 0x7f, 0x15, 0x37, 0x25, 0xc1, 0x85, 0xcd, 0x72, 0xa5, - 0x5c, 0x43, 0x68, 0xfb, 0xf3, 0x90, 0xdf, 0xb8, 0x84, 0xb4, 0x0b, 0x93, 0x42, 0xb9, 0x82, 0xbf, - 0x1c, 0xd8, 0x3e, 0x55, 0xe1, 0x59, 0xaf, 0x4f, 0xc9, 0x20, 0xa2, 0x9d, 0xd4, 0x7f, 0x8f, 0x93, - 0x50, 0x62, 0x42, 0xff, 0xb3, 0x9c, 0x82, 0xb1, 0x6b, 0x65, 0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0x2a, 0x0e, 0x74, 0x06, 0xd7, 0xbb, 0xf3, 0xcf, 0xb9, 0x79, 0xdd, 0x6f, 0x60, 0xad, 0x34, - 0xf5, 0x7b, 0xaf, 0x3c, 0x66, 0xcb, 0xf1, 0x0e, 0xae, 0xe7, 0x8c, 0xd7, 0xf7, 0x16, 0xbe, 0x7f, - 0xf9, 0xfc, 0xc0, 0x39, 0xba, 0xff, 0xeb, 0x65, 0xcb, 0x79, 0x71, 0xd9, 0x72, 0xfe, 0xbc, 0x6c, - 0x39, 0x3f, 0x5d, 0xb5, 0xe6, 0x5e, 0x5c, 0xb5, 0xe6, 0xfe, 0xb8, 0x6a, 0xcd, 0x7d, 0x75, 0x3b, - 0x64, 0xba, 0x3f, 0xe8, 0xb6, 0x7b, 0x22, 0xf6, 0x4f, 0xbe, 0xfc, 0xec, 0xe1, 0xa7, 0x54, 0x3f, - 0x15, 0xf2, 0xdc, 0xef, 0xf5, 0x31, 0xe3, 0xfe, 0x45, 0xfa, 0x45, 0xa6, 0x47, 0x09, 0x55, 0xdd, - 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, + 0x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xb3, 0x92, 0x35, 0x62, 0x68, + 0xdb, 0x1e, 0x78, 0x4b, 0x2a, 0x2e, 0x20, 0xc1, 0x7a, 0xfa, 0x3d, 0x8a, 0xb0, 0x08, 0x29, 0x72, + 0x1a, 0xdb, 0xd6, 0x5e, 0x23, 0xb8, 0x91, 0x87, 0x1e, 0xe4, 0x91, 0x63, 0xa4, 0x49, 0x47, 0x3c, + 0x49, 0xf5, 0x30, 0x75, 0x47, 0x28, 0x72, 0x9a, 0x06, 0xda, 0x28, 0x79, 0x8f, 0x91, 0xbd, 0x01, + 0x16, 0x30, 0x43, 0xa6, 0xf5, 0xab, 0xd9, 0x54, 0x30, 0x43, 0x27, 0x78, 0xf0, 0x49, 0xf3, 0xc7, + 0x57, 0xcf, 0xf6, 0x47, 0xf3, 0xdf, 0xdd, 0x00, 0x6f, 0x8f, 0x2d, 0x52, 0x80, 0x65, 0xca, 0x99, + 0xc4, 0xbb, 0x3f, 0x58, 0x66, 0xc5, 0x1e, 0xa6, 0xe8, 0x4d, 0x57, 0xac, 0x09, 0x6a, 0x14, 0x99, + 0x05, 0xab, 0x07, 0x35, 0x8a, 0x74, 0xa3, 0x52, 0x38, 0xd0, 0x53, 0x1e, 0xae, 0x57, 0x6e, 0x56, + 0x90, 0x1b, 0x51, 0x28, 0xc8, 0x75, 0x40, 0xf3, 0x54, 0x92, 0x23, 0x2a, 0x61, 0x3b, 0xfe, 0x5f, + 0xc9, 0x4d, 0x50, 0x70, 0xc0, 0xfa, 0x78, 0xa5, 0x82, 0x03, 0x31, 0xfd, 0xb9, 0xcf, 0xae, 0x9d, + 0x42, 0xd6, 0x85, 0x51, 0xa1, 0x82, 0xc1, 0x5f, 0x16, 0xd8, 0x3c, 0x95, 0xe4, 0x2c, 0xea, 0x60, + 0xd4, 0x8d, 0x71, 0x90, 0x89, 0xf4, 0x61, 0x4a, 0x04, 0x44, 0xf8, 0x3f, 0xd3, 0x29, 0xa9, 0xbf, + 0x36, 0xae, 0xfe, 0xd2, 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0c, 0x74, 0x0a, 0xd6, 0xbd, + 0xf3, 0xcf, 0xb1, 0x45, 0xdd, 0x6f, 0xc0, 0xca, 0xd8, 0xd6, 0xef, 0xbe, 0x76, 0xcc, 0x06, 0xe3, + 0xee, 0x5f, 0x8d, 0x19, 0xe6, 0x77, 0xe7, 0xbe, 0x7f, 0xf5, 0x6c, 0xdf, 0x3a, 0xbc, 0xf7, 0xfc, + 0xa2, 0x65, 0xbd, 0xb8, 0x68, 0x59, 0x7f, 0x5e, 0xb4, 0xac, 0x9f, 0x2e, 0x5b, 0x33, 0x2f, 0x2e, + 0x5b, 0x33, 0xbf, 0x5f, 0xb6, 0x66, 0xbe, 0xba, 0x4d, 0xa8, 0xea, 0x74, 0xdb, 0x5e, 0xc4, 0x13, + 0xff, 0xe4, 0xd1, 0xe7, 0xf7, 0x3f, 0xc3, 0xea, 0x09, 0x17, 0xe7, 0x7e, 0xd4, 0x81, 0x94, 0xf9, + 0xfd, 0xec, 0x63, 0x4e, 0x0d, 0x52, 0x2c, 0xdb, 0xf3, 0xe6, 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, 0x64, 0x77, 0x02, 0x1b, 0x3a, 0x2a, 0xad, 0x13, 0xa8, 0x13, 0x6d, 0x0f, - 0xdd, 0x56, 0xc2, 0x56, 0x02, 0x95, 0x10, 0x07, 0x0e, 0xd9, 0xb4, 0x12, 0xa2, 0x45, 0x68, 0x2a, - 0x40, 0x70, 0xb1, 0xc6, 0xf6, 0x8b, 0x77, 0xb4, 0xf6, 0xcc, 0x76, 0x66, 0xbc, 0x61, 0x4f, 0x88, - 0x7f, 0x00, 0xff, 0x02, 0x71, 0xe2, 0xc0, 0x8f, 0xe8, 0xb1, 0xe2, 0x04, 0x1c, 0x0a, 0x4a, 0x0e, - 0xfc, 0x0d, 0x34, 0x33, 0xb6, 0xbb, 0x5b, 0xf6, 0x48, 0x2f, 0xbb, 0xf3, 0xbe, 0xf7, 0xbd, 0x79, - 0xcf, 0xdf, 0x7b, 0xcf, 0x46, 0xc1, 0x74, 0x31, 0x87, 0xe8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xfa, 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, 0x23, 0xef, 0xce, 0xb8, 0x3b, 0xb3, 0x0e, 0x3e, 0x21, + 0xbe, 0x01, 0x1f, 0x03, 0x71, 0xe2, 0x80, 0xf8, 0x0c, 0x3d, 0x56, 0x9c, 0x80, 0x43, 0x41, 0xc9, + 0x81, 0xaf, 0x81, 0xe6, 0xcf, 0x6e, 0xed, 0xe2, 0x03, 0x07, 0xb8, 0xd8, 0xf3, 0x7e, 0xef, 0xef, + 0xfc, 0xde, 0x7b, 0xb3, 0x28, 0x98, 0x2e, 0xe6, 0x10, 0x3d, 0xab, 0xa1, 0x5a, 0x44, 0xf3, 0xe3, + 0x04, 0x14, 0x3d, 0xb6, 0x52, 0x38, 0xab, 0x84, 0x12, 0x18, 0x6b, 0x7d, 0x68, 0x11, 0xa7, 0x3f, + 0xb8, 0x46, 0x4b, 0xc6, 0x45, 0x64, 0x7e, 0xad, 0xd9, 0x41, 0x90, 0x0a, 0x59, 0x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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/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)