From 4e7f1e5174e7640ea3f1c5136c8693430da92746 Mon Sep 17 00:00:00 2001 From: rapha Date: Wed, 24 Apr 2024 15:00:50 +0200 Subject: [PATCH 1/8] feat: tally bundle proposal also when calling SkipUploaderRole --- x/bundles/keeper/logic_bundles.go | 99 +++++++++++++++++++ .../keeper/msg_server_skip_uploader_role.go | 32 +++++- .../msg_server_submit_bundle_proposal.go | 95 +++--------------- x/bundles/types/types.go | 16 +++ 4 files changed, 154 insertions(+), 88 deletions(-) diff --git a/x/bundles/keeper/logic_bundles.go b/x/bundles/keeper/logic_bundles.go index da1f5f0d..432730bd 100644 --- a/x/bundles/keeper/logic_bundles.go +++ b/x/bundles/keeper/logic_bundles.go @@ -3,6 +3,7 @@ package keeper import ( "cosmossdk.io/errors" "cosmossdk.io/math" + poolTypes "github.com/KYVENetwork/chain/x/pool/types" delegationTypes "github.com/KYVENetwork/chain/x/delegation/types" @@ -510,3 +511,101 @@ func (k Keeper) GetVoteDistribution(ctx sdk.Context, poolId uint64) (voteDistrib return } + +// tallyBundleProposal evaluates the votes of a bundle proposal and determines the outcome +func (k msgServer) tallyBundleProposal(ctx sdk.Context, bundleProposal types.BundleProposal, poolId uint64) (types.TallyResult, error) { + // Increase points of stakers who did not vote at all + slash + remove if necessary. + // The protocol requires everybody to stay always active. + k.handleNonVoters(ctx, poolId) + + // evaluate all votes and determine status based on the votes weighted with stake + delegation + voteDistribution := k.GetVoteDistribution(ctx, poolId) + + // Handle tally outcome + switch voteDistribution.Status { + case types.BUNDLE_STATUS_VALID: + // If a bundle is valid the following things happen: + // 1. Funders and Inflation Pool are charged. The total payout is divided + // between the uploader, its delegators and the treasury. + // The appropriate funds are deducted from the total pool funds + // 2. The next uploader is randomly selected based on everybody who + // voted valid on this bundle. + // 3. The bundle is finalized by added it permanently to the state. + // 4. The sender immediately starts the next round by registering + // his new bundle proposal. + + // charge the funders of the pool + fundersPayout, err := k.fundersKeeper.ChargeFundersOfPool(ctx, poolId) + if err != nil { + return types.TallyResult{}, err + } + + // charge the inflation pool + inflationPayout, err := k.poolKeeper.ChargeInflationPool(ctx, poolId) + if err != nil { + return types.TallyResult{}, err + } + + // calculate payouts to the different stakeholders like treasury, uploader and delegators + bundleReward := k.calculatePayouts(ctx, poolId, fundersPayout+inflationPayout) + + // payout rewards to treasury + if err := util.TransferFromModuleToTreasury(k.accountKeeper, k.distrkeeper, ctx, poolTypes.ModuleName, bundleReward.Treasury); err != nil { + return types.TallyResult{}, err + } + + // payout rewards to uploader through commission rewards + if err := k.stakerKeeper.IncreaseStakerCommissionRewards(ctx, bundleProposal.Uploader, bundleReward.Uploader); err != nil { + return types.TallyResult{}, err + } + + // payout rewards to delegators through delegation rewards + if err := k.delegationKeeper.PayoutRewards(ctx, bundleProposal.Uploader, bundleReward.Delegation, poolTypes.ModuleName); err != nil { + return types.TallyResult{}, err + } + + // slash stakers who voted incorrectly + for _, voter := range bundleProposal.VotersInvalid { + k.slashDelegatorsAndRemoveStaker(ctx, poolId, voter, delegationTypes.SLASH_TYPE_VOTE) + } + + return types.TallyResult{ + Status: types.TallyResultValid, + VoteDistribution: voteDistribution, + FundersPayout: fundersPayout, + InflationPayout: inflationPayout, + BundleReward: bundleReward, + }, nil + case types.BUNDLE_STATUS_INVALID: + // If the bundles is invalid, everybody who voted incorrectly gets slashed. + // The bundle provided by the message-sender is of no mean, because the previous bundle + // turned out to be incorrect. + // There this round needs to start again and the message-sender stays uploader. + + // slash stakers who voted incorrectly - uploader receives upload slash + for _, voter := range bundleProposal.VotersValid { + if voter == bundleProposal.Uploader { + k.slashDelegatorsAndRemoveStaker(ctx, poolId, voter, delegationTypes.SLASH_TYPE_UPLOAD) + } else { + k.slashDelegatorsAndRemoveStaker(ctx, poolId, voter, delegationTypes.SLASH_TYPE_VOTE) + } + } + + return types.TallyResult{ + Status: types.TallyResultInvalid, + VoteDistribution: voteDistribution, + FundersPayout: 0, + InflationPayout: 0, + BundleReward: types.BundleReward{}, + }, nil + default: + // If the bundle is neither valid nor invalid the quorum has not been reached yet. + return types.TallyResult{ + Status: types.TallyResultNoQuorum, + VoteDistribution: voteDistribution, + FundersPayout: 0, + InflationPayout: 0, + BundleReward: types.BundleReward{}, + }, nil + } +} diff --git a/x/bundles/keeper/msg_server_skip_uploader_role.go b/x/bundles/keeper/msg_server_skip_uploader_role.go index 34bff46f..94e5345c 100644 --- a/x/bundles/keeper/msg_server_skip_uploader_role.go +++ b/x/bundles/keeper/msg_server_skip_uploader_role.go @@ -15,19 +15,43 @@ func (k msgServer) SkipUploaderRole(goCtx context.Context, msg *types.MsgSkipUpl return nil, err } - pool, _ := k.poolKeeper.GetPool(ctx, msg.PoolId) bundleProposal, _ := k.GetBundleProposal(ctx, msg.PoolId) // reset points of uploader as node has proven to be active k.resetPoints(ctx, msg.PoolId, msg.Staker) + // Previous round contains a bundle which needs to be validated now + result, err := k.tallyBundleProposal(ctx, bundleProposal, msg.PoolId) + if err != nil { + return nil, err + } + // Get next uploader, except the one who skipped nextUploader := k.chooseNextUploader(ctx, msg.PoolId, msg.Staker) - bundleProposal.NextUploader = nextUploader - bundleProposal.UpdatedAt = uint64(ctx.BlockTime().Unix()) + switch result.Status { + case types.TallyResultValid: + // Register the current bundle and finalize it + k.finalizeCurrentBundleProposal(ctx, msg.PoolId, result.VoteDistribution, result.FundersPayout, result.InflationPayout, result.BundleReward, nextUploader) - k.SetBundleProposal(ctx, bundleProposal) + // Register empty bundle with next uploader + bundleProposal = types.BundleProposal{ + PoolId: msg.PoolId, + NextUploader: nextUploader, + UpdatedAt: uint64(ctx.BlockTime().Unix()), + } + k.SetBundleProposal(ctx, bundleProposal) + case types.TallyResultInvalid: + // Drop current bundle. + k.dropCurrentBundleProposal(ctx, msg.PoolId, result.VoteDistribution, nextUploader) + case types.TallyResultNoQuorum: + // Set next uploader and update the bundle proposal + bundleProposal.NextUploader = nextUploader + bundleProposal.UpdatedAt = uint64(ctx.BlockTime().Unix()) + k.SetBundleProposal(ctx, bundleProposal) + } + + pool, _ := k.poolKeeper.GetPool(ctx, msg.PoolId) _ = ctx.EventManager().EmitTypedEvent(&types.EventSkippedUploaderRole{ PoolId: msg.PoolId, diff --git a/x/bundles/keeper/msg_server_submit_bundle_proposal.go b/x/bundles/keeper/msg_server_submit_bundle_proposal.go index 2185b45e..1dc39955 100644 --- a/x/bundles/keeper/msg_server_submit_bundle_proposal.go +++ b/x/bundles/keeper/msg_server_submit_bundle_proposal.go @@ -3,14 +3,8 @@ package keeper import ( "context" - "github.com/KYVENetwork/chain/util" "github.com/KYVENetwork/chain/x/bundles/types" sdk "github.com/cosmos/cosmos-sdk/types" - - // Delegation - delegationTypes "github.com/KYVENetwork/chain/x/delegation/types" - // Pool - poolTypes "github.com/KYVENetwork/chain/x/pool/types" ) // SubmitBundleProposal handles the logic of an SDK message that allows protocol nodes to submit a new bundle proposal. @@ -42,99 +36,32 @@ func (k msgServer) SubmitBundleProposal(goCtx context.Context, msg *types.MsgSub } // Previous round contains a bundle which needs to be validated now. + result, err := k.tallyBundleProposal(ctx, bundleProposal, msg.PoolId) + if err != nil { + return nil, err + } - // Increase points of stakers who did not vote at all + slash + remove if necessary. - // The protocol requires everybody to stay always active. - k.handleNonVoters(ctx, msg.PoolId) - - // evaluate all votes and determine status based on the votes weighted with stake + delegation - voteDistribution := k.GetVoteDistribution(ctx, msg.PoolId) - - // Handle tally outcome - switch voteDistribution.Status { - - case types.BUNDLE_STATUS_VALID: - // If a bundle is valid the following things happen: - // 1. Funders and Inflation Pool are charged. The total payout is divided - // between the uploader, its delegators and the treasury. - // The appropriate funds are deducted from the total pool funds - // 2. The next uploader is randomly selected based on everybody who - // voted valid on this bundle. - // 3. The bundle is finalized by added it permanently to the state. - // 4. The sender immediately starts the next round by registering - // his new bundle proposal. - - pool, _ := k.poolKeeper.GetPool(ctx, msg.PoolId) - - // charge the funders of the pool - fundersPayout, err := k.fundersKeeper.ChargeFundersOfPool(ctx, msg.PoolId) - if err != nil { - return &types.MsgSubmitBundleProposalResponse{}, err - } - - // charge the inflation pool - inflationPayout, err := k.poolKeeper.ChargeInflationPool(ctx, msg.PoolId) - if err != nil { - return &types.MsgSubmitBundleProposalResponse{}, err - } - - // calculate payouts to the different stakeholders like treasury, uploader and delegators - bundleReward := k.calculatePayouts(ctx, msg.PoolId, fundersPayout+inflationPayout) - - // payout rewards to treasury - if err := util.TransferFromModuleToTreasury(k.accountKeeper, k.distrkeeper, ctx, poolTypes.ModuleName, bundleReward.Treasury); err != nil { - return nil, err - } - - // payout rewards to uploader through commission rewards - if err := k.stakerKeeper.IncreaseStakerCommissionRewards(ctx, bundleProposal.Uploader, bundleReward.Uploader); err != nil { - return nil, err - } - - // payout rewards to delegators through delegation rewards - if err := k.delegationKeeper.PayoutRewards(ctx, bundleProposal.Uploader, bundleReward.Delegation, poolTypes.ModuleName); err != nil { - return nil, err - } - - // slash stakers who voted incorrectly - for _, voter := range bundleProposal.VotersInvalid { - k.slashDelegatorsAndRemoveStaker(ctx, msg.PoolId, voter, delegationTypes.SLASH_TYPE_VOTE) - } - + switch result.Status { + case types.TallyResultValid: // Determine next uploader and register next bundle // Get next uploader from stakers who voted `valid` nextUploader := k.chooseNextUploaderFromList(ctx, msg.PoolId, bundleProposal.VotersValid) - k.finalizeCurrentBundleProposal(ctx, pool.Id, voteDistribution, fundersPayout, inflationPayout, bundleReward, nextUploader) + k.finalizeCurrentBundleProposal(ctx, msg.PoolId, result.VoteDistribution, result.FundersPayout, result.InflationPayout, result.BundleReward, nextUploader) // Register the provided bundle as a new proposal for the next round k.registerBundleProposalFromUploader(ctx, msg, nextUploader) return &types.MsgSubmitBundleProposalResponse{}, nil - case types.BUNDLE_STATUS_INVALID: - // If the bundles is invalid, everybody who voted incorrectly gets slashed. - // The bundle provided by the message-sender is of no mean, because the previous bundle - // turned out to be incorrect. - // There this round needs to start again and the message-sender stays uploader. - - // slash stakers who voted incorrectly - uploader receives upload slash - for _, voter := range bundleProposal.VotersValid { - if voter == bundleProposal.Uploader { - k.slashDelegatorsAndRemoveStaker(ctx, msg.PoolId, voter, delegationTypes.SLASH_TYPE_UPLOAD) - } else { - k.slashDelegatorsAndRemoveStaker(ctx, msg.PoolId, voter, delegationTypes.SLASH_TYPE_VOTE) - } - } - + case types.TallyResultInvalid: // Drop current bundle. Can't register the provided bundle because the previous bundles // needs to be resubmitted first. - k.dropCurrentBundleProposal(ctx, msg.PoolId, voteDistribution, bundleProposal.NextUploader) + k.dropCurrentBundleProposal(ctx, msg.PoolId, result.VoteDistribution, bundleProposal.NextUploader) return &types.MsgSubmitBundleProposalResponse{}, nil - - default: - // If the bundle is neither valid nor invalid the quorum has not been reached yet. + case types.TallyResultNoQuorum: return nil, types.ErrQuorumNotReached } + return nil, types.ErrQuorumNotReached } diff --git a/x/bundles/types/types.go b/x/bundles/types/types.go index 64ed1d6b..2d2cdce7 100644 --- a/x/bundles/types/types.go +++ b/x/bundles/types/types.go @@ -35,3 +35,19 @@ func (bundleVersionMap BundleVersionMap) GetMap() (versionMap map[int32]uint64) } return } + +type TallyResultStatus uint32 + +const ( + TallyResultValid TallyResultStatus = iota + TallyResultInvalid + TallyResultNoQuorum +) + +type TallyResult struct { + Status TallyResultStatus + VoteDistribution VoteDistribution + FundersPayout uint64 + InflationPayout uint64 + BundleReward BundleReward +} From 9f0637b264c804a400525eaa9c28fd2a5ba8bedf Mon Sep 17 00:00:00 2001 From: rapha Date: Wed, 24 Apr 2024 16:11:15 +0200 Subject: [PATCH 2/8] chore: add tests --- .../msg_server_skip_uploader_role_test.go | 129 +++++++++++++++++- 1 file changed, 127 insertions(+), 2 deletions(-) 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 8cc5c1f0..a1c5aa0f 100644 --- a/x/bundles/keeper/msg_server_skip_uploader_role_test.go +++ b/x/bundles/keeper/msg_server_skip_uploader_role_test.go @@ -17,6 +17,8 @@ TEST CASES - msg_server_skip_uploader_role.go * Skip uploader role on data bundle if staker is next uploader * Skip uploader on data bundle after uploader role has already been skipped * Skip uploader role on dropped bundle +* Skip uploader role on data bundle with current round containing a valid bundle +* Skip uploader role on data bundle with current round containing an invalid bundle */ @@ -87,6 +89,17 @@ var _ = Describe("msg_server_skip_uploader_role.go", Ordered, func() { PoolId: 0, }) + s.RunTxStakersSuccess(&stakertypes.MsgCreateStaker{ + Creator: i.STAKER_2, + Amount: 100 * i.KYVE, + }) + + s.RunTxStakersSuccess(&stakertypes.MsgJoinPool{ + Creator: i.STAKER_2, + PoolId: 0, + Valaddress: i.VALADDRESS_2_A, + }) + s.Commit() s.WaitSeconds(60) @@ -142,6 +155,10 @@ var _ = Describe("msg_server_skip_uploader_role.go", Ordered, func() { // here the next uploader should be always be different after skipping Expect(bundleProposal.NextUploader).To(Equal(i.STAKER_0)) + + // check that the bundle is not finalized + _, found = s.App().BundlesKeeper.GetFinalizedBundle(s.Ctx(), 0, 0) + Expect(found).To(BeFalse()) }) It("Skip uploader on data bundle after uploader role has already been skipped", func() { @@ -186,7 +203,11 @@ var _ = Describe("msg_server_skip_uploader_role.go", Ordered, func() { Expect(bundleProposal.VotersAbstain).To(BeEmpty()) // here the next uploader should be always be different after skipping - Expect(bundleProposal.NextUploader).To(Equal(i.STAKER_1)) + Expect(bundleProposal.NextUploader).NotTo(Equal(i.STAKER_0)) + + // check that the bundle is not finalized + _, found = s.App().BundlesKeeper.GetFinalizedBundle(s.Ctx(), 0, 0) + Expect(found).To(BeFalse()) }) It("Skip uploader role on dropped bundle", func() { @@ -225,6 +246,110 @@ var _ = Describe("msg_server_skip_uploader_role.go", Ordered, func() { Expect(bundleProposal.VotersAbstain).To(BeEmpty()) // here the next uploader should be always be different after skipping - Expect(bundleProposal.NextUploader).To(Equal(i.STAKER_1)) + Expect(bundleProposal.NextUploader).NotTo(Equal(i.STAKER_0)) + + // check that the bundle is not finalized + _, found = s.App().BundlesKeeper.GetFinalizedBundle(s.Ctx(), 0, 0) + Expect(found).To(BeFalse()) + }) + + It("Skip uploader role on data bundle with current round containing a valid bundle", func() { + // ARRANGE + s.RunTxBundlesSuccess(&bundletypes.MsgVoteBundleProposal{ + Creator: i.VALADDRESS_1_A, + Staker: i.STAKER_1, + PoolId: 0, + StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", + Vote: bundletypes.VOTE_TYPE_VALID, + }) + + s.Commit() + s.WaitSeconds(60) + + // ACT + s.RunTxBundlesSuccess(&bundletypes.MsgSkipUploaderRole{ + Creator: i.VALADDRESS_1_A, + Staker: i.STAKER_1, + PoolId: 0, + FromIndex: 100, + }) + + // ASSERT + bundleProposal, found := s.App().BundlesKeeper.GetBundleProposal(s.Ctx(), 0) + Expect(found).To(BeTrue()) + + Expect(bundleProposal.PoolId).To(Equal(uint64(0))) + Expect(bundleProposal.NextUploader).To(Equal(i.STAKER_0)) + Expect(bundleProposal.UpdatedAt).NotTo(BeZero()) + Expect(bundleProposal.StorageId).To(BeEmpty()) + Expect(bundleProposal.Uploader).To(BeEmpty()) + Expect(bundleProposal.DataSize).To(BeZero()) + Expect(bundleProposal.DataHash).To(BeEmpty()) + Expect(bundleProposal.BundleSize).To(BeZero()) + Expect(bundleProposal.FromKey).To(BeEmpty()) + Expect(bundleProposal.ToKey).To(BeEmpty()) + Expect(bundleProposal.BundleSummary).To(BeEmpty()) + Expect(bundleProposal.UpdatedAt).NotTo(BeZero()) + Expect(bundleProposal.VotersValid).To(BeEmpty()) + Expect(bundleProposal.VotersInvalid).To(BeEmpty()) + Expect(bundleProposal.VotersAbstain).To(BeEmpty()) + + finalizedBundle, found := s.App().BundlesKeeper.GetFinalizedBundle(s.Ctx(), 0, 0) + Expect(found).To(BeTrue()) + + Expect(finalizedBundle.PoolId).To(Equal(uint64(0))) + Expect(finalizedBundle.Uploader).To(Equal(i.STAKER_0)) + }) + + It("Skip uploader role on data bundle with current round containing an invalid bundle", func() { + // ARRANGE + s.RunTxBundlesSuccess(&bundletypes.MsgVoteBundleProposal{ + Creator: i.VALADDRESS_1_A, + Staker: i.STAKER_1, + PoolId: 0, + StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", + Vote: bundletypes.VOTE_TYPE_INVALID, + }) + s.RunTxBundlesSuccess(&bundletypes.MsgVoteBundleProposal{ + Creator: i.VALADDRESS_2_A, + Staker: i.STAKER_2, + PoolId: 0, + StorageId: "y62A3tfbSNcNYDGoL-eXwzyV-Zc9Q0OVtDvR1biJmNI", + Vote: bundletypes.VOTE_TYPE_INVALID, + }) + + s.Commit() + s.WaitSeconds(60) + + // ACT + s.RunTxBundlesSuccess(&bundletypes.MsgSkipUploaderRole{ + Creator: i.VALADDRESS_1_A, + Staker: i.STAKER_1, + PoolId: 0, + FromIndex: 100, + }) + + // ASSERT + bundleProposal, found := s.App().BundlesKeeper.GetBundleProposal(s.Ctx(), 0) + Expect(found).To(BeTrue()) + + Expect(bundleProposal.PoolId).To(Equal(uint64(0))) + Expect(bundleProposal.NextUploader).To(Equal(i.STAKER_2)) + Expect(bundleProposal.StorageId).To(BeEmpty()) + Expect(bundleProposal.Uploader).To(BeEmpty()) + Expect(bundleProposal.DataSize).To(BeZero()) + Expect(bundleProposal.DataHash).To(BeEmpty()) + Expect(bundleProposal.BundleSize).To(BeZero()) + Expect(bundleProposal.FromKey).To(BeEmpty()) + Expect(bundleProposal.ToKey).To(BeEmpty()) + Expect(bundleProposal.BundleSummary).To(BeEmpty()) + Expect(bundleProposal.UpdatedAt).NotTo(BeZero()) + Expect(bundleProposal.VotersValid).To(BeEmpty()) + Expect(bundleProposal.VotersInvalid).To(BeEmpty()) + Expect(bundleProposal.VotersAbstain).To(BeEmpty()) + + // check that the bundle is not finalized + _, found = s.App().BundlesKeeper.GetFinalizedBundle(s.Ctx(), 0, 0) + Expect(found).To(BeFalse()) }) }) From 49a095ba1b42d4069c70d81130f47efbbd5648e3 Mon Sep 17 00:00:00 2001 From: rapha Date: Thu, 25 Apr 2024 10:40:50 +0200 Subject: [PATCH 3/8] feat: add endKey to pool --- docs/static/openapi.yml | 15 +++ proto/kyve/pool/v1beta1/pool.proto | 6 + x/bundles/keeper/logic_bundles.go | 5 + x/bundles/keeper/logic_bundles_test.go | 15 +++ x/bundles/types/errors.go | 1 + x/pool/types/pool.pb.go | 162 +++++++++++++++++-------- x/query/keeper/helper.go | 2 + 7 files changed, 156 insertions(+), 50 deletions(-) diff --git a/docs/static/openapi.yml b/docs/static/openapi.yml index 8b1374fa..6a90abf0 100644 --- a/docs/static/openapi.yml +++ b/docs/static/openapi.yml @@ -669,6 +669,7 @@ paths: - POOL_STATUS_NOT_ENOUGH_DELEGATION - POOL_STATUS_UPGRADING - POOL_STATUS_VOTING_POWER_TOO_HIGH + - POOL_STATUS_END_KEY_REACHED default: POOL_STATUS_UNSPECIFIED points: type: string @@ -1067,6 +1068,7 @@ paths: - POOL_STATUS_NOT_ENOUGH_DELEGATION - POOL_STATUS_UPGRADING - POOL_STATUS_VOTING_POWER_TOO_HIGH + - POOL_STATUS_END_KEY_REACHED default: POOL_STATUS_UNSPECIFIED title: >- BasicPool contains the necessary properties need for a @@ -3912,6 +3914,7 @@ paths: - POOL_STATUS_NOT_ENOUGH_DELEGATION - POOL_STATUS_UPGRADING - POOL_STATUS_VOTING_POWER_TOO_HIGH + - POOL_STATUS_END_KEY_REACHED default: POOL_STATUS_UNSPECIFIED points: type: string @@ -4905,6 +4908,9 @@ paths: type: integer format: int64 description: compression_id ... + end_key: + type: string + description: end_key ... bundle_proposal: description: bundle_proposal ... type: object @@ -5022,6 +5028,7 @@ paths: - POOL_STATUS_NOT_ENOUGH_DELEGATION - POOL_STATUS_UPGRADING - POOL_STATUS_VOTING_POWER_TOO_HIGH + - POOL_STATUS_END_KEY_REACHED default: POOL_STATUS_UNSPECIFIED account: type: string @@ -5438,6 +5445,9 @@ paths: type: integer format: int64 description: compression_id ... + end_key: + type: string + description: end_key ... bundle_proposal: description: bundle_proposal ... type: object @@ -5555,6 +5565,7 @@ paths: - POOL_STATUS_NOT_ENOUGH_DELEGATION - POOL_STATUS_UPGRADING - POOL_STATUS_VOTING_POWER_TOO_HIGH + - POOL_STATUS_END_KEY_REACHED default: POOL_STATUS_UNSPECIFIED account: type: string @@ -6073,6 +6084,7 @@ paths: - POOL_STATUS_NOT_ENOUGH_DELEGATION - POOL_STATUS_UPGRADING - POOL_STATUS_VOTING_POWER_TOO_HIGH + - POOL_STATUS_END_KEY_REACHED default: POOL_STATUS_UNSPECIFIED points: type: string @@ -6500,6 +6512,7 @@ paths: - POOL_STATUS_NOT_ENOUGH_DELEGATION - POOL_STATUS_UPGRADING - POOL_STATUS_VOTING_POWER_TOO_HIGH + - POOL_STATUS_END_KEY_REACHED default: POOL_STATUS_UNSPECIFIED points: type: string @@ -7040,6 +7053,7 @@ paths: - POOL_STATUS_NOT_ENOUGH_DELEGATION - POOL_STATUS_UPGRADING - POOL_STATUS_VOTING_POWER_TOO_HIGH + - POOL_STATUS_END_KEY_REACHED default: POOL_STATUS_UNSPECIFIED points: type: string @@ -7509,6 +7523,7 @@ paths: - POOL_STATUS_NOT_ENOUGH_DELEGATION - POOL_STATUS_UPGRADING - POOL_STATUS_VOTING_POWER_TOO_HIGH + - POOL_STATUS_END_KEY_REACHED default: POOL_STATUS_UNSPECIFIED points: type: string diff --git a/proto/kyve/pool/v1beta1/pool.proto b/proto/kyve/pool/v1beta1/pool.proto index c82e9305..df5a16fb 100644 --- a/proto/kyve/pool/v1beta1/pool.proto +++ b/proto/kyve/pool/v1beta1/pool.proto @@ -32,6 +32,9 @@ enum PoolStatus { // 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 = 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 = 7; } // Protocol holds all info about the current pool version and the @@ -109,4 +112,7 @@ message Pool { uint32 current_storage_provider_id = 18; // compression_id ... uint32 current_compression_id = 19; + + // end_key ... + string end_key = 20; } diff --git a/x/bundles/keeper/logic_bundles.go b/x/bundles/keeper/logic_bundles.go index 432730bd..e0ac0255 100644 --- a/x/bundles/keeper/logic_bundles.go +++ b/x/bundles/keeper/logic_bundles.go @@ -30,6 +30,11 @@ func (k Keeper) AssertPoolCanRun(ctx sdk.Context, poolId uint64) error { return types.ErrPoolDisabled } + // Error if the end key is reached + if pool.EndKey != "" && pool.CurrentKey == pool.EndKey { + return types.ErrEndKeyReached + } + // Get the total and the highest delegation of a single validator in the pool totalDelegation, highestDelegation := k.delegationKeeper.GetTotalAndHighestDelegationOfPool(ctx, poolId) diff --git a/x/bundles/keeper/logic_bundles_test.go b/x/bundles/keeper/logic_bundles_test.go index 3d7d6195..f4e9d06d 100644 --- a/x/bundles/keeper/logic_bundles_test.go +++ b/x/bundles/keeper/logic_bundles_test.go @@ -20,6 +20,7 @@ TEST CASES - logic_bundles.go * Assert pool can run while min delegation is not reached * Assert pool can run * Assert pool can run while pool has no funds +* Assert pool can run when endKey is reached * Assert can vote if sender is no staker * Assert can vote if bundle is dropped @@ -331,6 +332,20 @@ var _ = Describe("logic_bundles.go", Ordered, func() { Expect(err).NotTo(HaveOccurred()) }) + It("Assert pool can run when endKey is reached", func() { + // ASSERT + pool, _ := s.App().PoolKeeper.GetPool(s.Ctx(), 0) + pool.EndKey = "0" + pool.CurrentKey = "0" + s.App().PoolKeeper.SetPool(s.Ctx(), pool) + + // ACT + err := s.App().BundlesKeeper.AssertPoolCanRun(s.Ctx(), 0) + + // ASSERT + Expect(err).To(Equal(bundlesTypes.ErrEndKeyReached)) + }) + // ASSERT CAN VOTE It("Assert can vote if sender is no staker", func() { diff --git a/x/bundles/types/errors.go b/x/bundles/types/errors.go index 9a30d74a..d295426c 100644 --- a/x/bundles/types/errors.go +++ b/x/bundles/types/errors.go @@ -23,4 +23,5 @@ var ( ErrAlreadyVotedInvalid = errors.Register(ModuleName, 1205, "already voted invalid on bundle proposal") ErrAlreadyVotedAbstain = errors.Register(ModuleName, 1206, "already voted abstain on bundle proposal") ErrVotingPowerTooHigh = errors.Register(ModuleName, 1207, "staker in pool has more than 50% voting power") + ErrEndKeyReached = errors.Register(ModuleName, 1208, "end key reached") ) diff --git a/x/pool/types/pool.pb.go b/x/pool/types/pool.pb.go index a02bd2e7..3f9cc5c4 100644 --- a/x/pool/types/pool.pb.go +++ b/x/pool/types/pool.pb.go @@ -49,6 +49,9 @@ const ( // 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{ @@ -59,6 +62,7 @@ var PoolStatus_name = map[int32]string{ 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{ @@ -69,6 +73,7 @@ var PoolStatus_value = map[string]int32{ "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 { @@ -263,6 +268,8 @@ type Pool struct { 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 ... + EndKey string `protobuf:"bytes,20,opt,name=end_key,json=endKey,proto3" json:"end_key,omitempty"` } func (m *Pool) Reset() { *m = Pool{} } @@ -431,6 +438,13 @@ func (m *Pool) GetCurrentCompressionId() uint32 { return 0 } +func (m *Pool) GetEndKey() string { + if m != nil { + return m.EndKey + } + return "" +} + func init() { proto.RegisterEnum("kyve.pool.v1beta1.PoolStatus", PoolStatus_name, PoolStatus_value) proto.RegisterType((*Protocol)(nil), "kyve.pool.v1beta1.Protocol") @@ -441,56 +455,59 @@ func init() { func init() { proto.RegisterFile("kyve/pool/v1beta1/pool.proto", fileDescriptor_40c1730f47ff2ef8) } var fileDescriptor_40c1730f47ff2ef8 = []byte{ - // 784 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x94, 0xcf, 0x73, 0xe3, 0x34, - 0x14, 0xc7, 0xe3, 0x6e, 0xda, 0x4d, 0x94, 0x36, 0xcd, 0x8a, 0x52, 0x44, 0xcb, 0x84, 0x6c, 0x99, - 0x85, 0xc0, 0x21, 0x99, 0x05, 0x66, 0x38, 0x71, 0x48, 0x1b, 0x6f, 0xea, 0xd9, 0x4e, 0x9c, 0xb1, - 0x93, 0xee, 0xc0, 0x45, 0xa3, 0xd8, 0x5a, 0x47, 0x53, 0xdb, 0xf2, 0xc8, 0x72, 0xb6, 0xd9, 0x23, - 0x27, 0x8e, 0xfc, 0x0f, 0xfc, 0x33, 0x1c, 0xf7, 0xc8, 0x81, 0x03, 0xd3, 0xf2, 0x87, 0x30, 0x92, - 0x7f, 0x90, 0x2d, 0x9c, 0xb8, 0xbd, 0xf7, 0xf9, 0x7e, 0x9f, 0x9e, 0x94, 0xf7, 0x1c, 0xf0, 0xc9, - 0xcd, 0x66, 0x4d, 0x87, 0x09, 0xe7, 0xe1, 0x70, 0xfd, 0x7c, 0x49, 0x25, 0x79, 0xae, 0x93, 0x41, - 0x22, 0xb8, 0xe4, 0xf0, 0x89, 0x52, 0x07, 0x1a, 0x14, 0xea, 0xc9, 0x51, 0xc0, 0x03, 0xae, 0xd5, - 0xa1, 0x8a, 0x72, 0xe3, 0x99, 0x07, 0x1a, 0x33, 0x15, 0x78, 0x3c, 0x84, 0x08, 0x3c, 0x5e, 0x53, - 0x91, 0x32, 0x1e, 0x23, 0xa3, 0x67, 0xf4, 0x9b, 0x4e, 0x99, 0xc2, 0x13, 0xd0, 0x58, 0xb2, 0x98, - 0x08, 0x46, 0x53, 0xb4, 0xa3, 0xa5, 0x2a, 0x87, 0x4f, 0xc1, 0x7e, 0x48, 0x52, 0x89, 0xb3, 0x24, - 0x10, 0xc4, 0xa7, 0xe8, 0x51, 0xcf, 0xe8, 0xd7, 0x9d, 0x96, 0x62, 0x8b, 0x1c, 0x9d, 0xfd, 0x64, - 0x80, 0x56, 0x11, 0xcf, 0x42, 0x12, 0xff, 0xff, 0x46, 0xa9, 0xb7, 0xa2, 0x7e, 0x16, 0x52, 0x1f, - 0x13, 0x59, 0x36, 0xaa, 0xd8, 0x48, 0xaa, 0x72, 0x3f, 0x13, 0x44, 0xaa, 0x93, 0xeb, 0x5a, 0xae, - 0xf2, 0xb3, 0x3f, 0x76, 0x41, 0x7d, 0xc6, 0x79, 0x08, 0xdb, 0x60, 0x87, 0xf9, 0xba, 0x71, 0xdd, - 0xd9, 0x61, 0x3e, 0x84, 0xa0, 0x1e, 0x93, 0x88, 0x16, 0xfd, 0x74, 0xac, 0x6e, 0x28, 0xb2, 0x58, - 0xb2, 0x28, 0x7f, 0x4f, 0xd3, 0x29, 0x53, 0xe5, 0x0e, 0x79, 0xc0, 0xf5, 0xf1, 0x4d, 0x47, 0xc7, - 0xf0, 0x18, 0xec, 0x79, 0x3c, 0x7e, 0xcd, 0x02, 0xb4, 0xab, 0x69, 0x91, 0xc1, 0x53, 0xd0, 0x4c, - 0x25, 0x11, 0x12, 0xdf, 0xd0, 0x0d, 0xda, 0xcb, 0x9f, 0xa3, 0xc1, 0x4b, 0xba, 0x81, 0x9f, 0x82, - 0x96, 0x97, 0x09, 0x41, 0xe3, 0x5c, 0x7e, 0xac, 0x65, 0x50, 0x20, 0x65, 0xf8, 0x02, 0x1c, 0x96, - 0x86, 0x34, 0x8b, 0x22, 0x22, 0x36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6, 0x2b, 0xd3, 0xc1, 0x73, 0xdb, 0xc6, 0x97, 0xd6, 0xe4, 0xb2, 0xb3, 0x77, 0x52, 0xff, 0xf9, - 0xd7, 0x6e, 0xed, 0xfc, 0xe2, 0xb7, 0xbb, 0xae, 0xf1, 0xee, 0xae, 0x6b, 0xfc, 0x79, 0xd7, 0x35, - 0x7e, 0xb9, 0xef, 0xd6, 0xde, 0xdd, 0x77, 0x6b, 0xbf, 0xdf, 0x77, 0x6b, 0x3f, 0x7e, 0x19, 0x30, - 0xb9, 0xca, 0x96, 0x03, 0x8f, 0x47, 0xc3, 0x97, 0x3f, 0x5c, 0x9b, 0x53, 0x2a, 0xdf, 0x70, 0x71, - 0x33, 0xf4, 0x56, 0x84, 0xc5, 0xc3, 0xdb, 0xfc, 0xaf, 0x52, 0x6e, 0x12, 0x9a, 0x2e, 0xf7, 0xf4, - 0xb4, 0xbf, 0xf9, 0x3b, 0x00, 0x00, 0xff, 0xff, 0x76, 0xe7, 0x4a, 0x49, 0x44, 0x05, 0x00, 0x00, + // 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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ff, 0x06, 0x44, 0xea, 0xbf, + 0x7e, 0x05, 0x00, 0x00, } func (m *Protocol) Marshal() (dAtA []byte, err error) { @@ -602,6 +619,15 @@ func (m *Pool) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = 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-- @@ -867,6 +893,10 @@ func (m *Pool) Size() (n int) { 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 } @@ -1677,6 +1707,38 @@ func (m *Pool) Unmarshal(dAtA []byte) error { 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:]) diff --git a/x/query/keeper/helper.go b/x/query/keeper/helper.go index 8847f21e..2472639d 100644 --- a/x/query/keeper/helper.go +++ b/x/query/keeper/helper.go @@ -92,6 +92,8 @@ func (k Keeper) GetPoolStatus(ctx sdk.Context, pool *pooltypes.Pool) pooltypes.P poolStatus = pooltypes.POOL_STATUS_UPGRADING } else if pool.Disabled { poolStatus = pooltypes.POOL_STATUS_DISABLED + } else if pool.EndKey != "" && pool.EndKey == pool.CurrentKey { + poolStatus = pooltypes.POOL_STATUS_END_KEY_REACHED } else if totalDelegation < pool.MinDelegation { poolStatus = pooltypes.POOL_STATUS_NOT_ENOUGH_DELEGATION } else if highestDelegation*2 > totalDelegation { From 1abb38d322d62544f08c464b02ebe4c9c708c671 Mon Sep 17 00:00:00 2001 From: rapha Date: Thu, 25 Apr 2024 10:47:42 +0200 Subject: [PATCH 4/8] feat: make EndKey updatable --- x/pool/keeper/msg_server_update_pool.go | 3 +++ x/pool/keeper/msg_server_update_pool_test.go | 13 ++++++++----- x/pool/types/msgs.go | 1 + 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/x/pool/keeper/msg_server_update_pool.go b/x/pool/keeper/msg_server_update_pool.go index 41f452f1..1e65b276 100644 --- a/x/pool/keeper/msg_server_update_pool.go +++ b/x/pool/keeper/msg_server_update_pool.go @@ -59,6 +59,9 @@ func (k msgServer) UpdatePool(goCtx context.Context, req *types.MsgUpdatePool) ( if update.CompressionId != nil { pool.CurrentCompressionId = *update.CompressionId } + if update.EndKey != nil { + pool.EndKey = *update.EndKey + } k.SetPool(ctx, pool) diff --git a/x/pool/keeper/msg_server_update_pool_test.go b/x/pool/keeper/msg_server_update_pool_test.go index c711c133..9bf3d3d7 100644 --- a/x/pool/keeper/msg_server_update_pool_test.go +++ b/x/pool/keeper/msg_server_update_pool_test.go @@ -46,7 +46,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}", + 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 +61,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}", + 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 +78,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}", + 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}) @@ -128,6 +128,7 @@ var _ = Describe("msg_server_update_pool.go", Ordered, func() { }, CurrentStorageProviderId: 2, CurrentCompressionId: 1, + EndKey: "1", })) }) @@ -186,6 +187,7 @@ var _ = Describe("msg_server_update_pool.go", Ordered, func() { }, CurrentStorageProviderId: 0, CurrentCompressionId: 0, + EndKey: "", })) }) @@ -197,7 +199,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}", + 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}) @@ -246,6 +248,7 @@ var _ = Describe("msg_server_update_pool.go", Ordered, func() { }, CurrentStorageProviderId: 2, CurrentCompressionId: 1, + EndKey: "1", })) }) @@ -254,7 +257,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}", + 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}) diff --git a/x/pool/types/msgs.go b/x/pool/types/msgs.go index 3996bc6e..8edc9e71 100644 --- a/x/pool/types/msgs.go +++ b/x/pool/types/msgs.go @@ -69,6 +69,7 @@ type PoolUpdate struct { MaxBundleSize *uint64 StorageProviderId *uint32 CompressionId *uint32 + EndKey *string } // ValidateBasic does a sanity check on the provided data. From bbaaa17b62544b1ab3be117ae37f60499df6d6ab Mon Sep 17 00:00:00 2001 From: rapha Date: Wed, 1 May 2024 10:39:12 +0200 Subject: [PATCH 5/8] fix: typo --- x/bundles/keeper/logic_bundles_test.go | 36 +++++++++++++------------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/x/bundles/keeper/logic_bundles_test.go b/x/bundles/keeper/logic_bundles_test.go index f4e9d06d..4f10e384 100644 --- a/x/bundles/keeper/logic_bundles_test.go +++ b/x/bundles/keeper/logic_bundles_test.go @@ -85,7 +85,7 @@ var _ = Describe("logic_bundles.go", Ordered, func() { // ASSERT POOL CAN RUN It("Assert pool can run while pool is upgrading", func() { - // ASSERT + // ARRANGE pool, _ := s.App().PoolKeeper.GetPool(s.Ctx(), 0) pool.UpgradePlan = &pooltypes.UpgradePlan{ Version: "1.0.0", @@ -127,7 +127,7 @@ var _ = Describe("logic_bundles.go", Ordered, func() { }) It("Assert pool can run while pool is disabled", func() { - // ASSERT + // ARRANGE s.RunTxStakersSuccess(&stakertypes.MsgCreateStaker{ Creator: i.STAKER_0, Amount: 100 * i.KYVE, @@ -165,7 +165,7 @@ var _ = Describe("logic_bundles.go", Ordered, func() { }) It("Assert pool can run while min delegation is not reached", func() { - // ASSERT + // ARRANGE s.RunTxStakersSuccess(&stakertypes.MsgCreateStaker{ Creator: i.STAKER_0, Amount: 20 * i.KYVE, @@ -198,7 +198,7 @@ var _ = Describe("logic_bundles.go", Ordered, func() { }) It("Assert pool can run while voting power of one node is too high", func() { - // ASSERT + // ARRANGE msg := &pooltypes.MsgCreatePool{ Authority: gov, Name: "PoolTest", @@ -249,7 +249,7 @@ var _ = Describe("logic_bundles.go", Ordered, func() { }) It("Assert pool can run", func() { - // ASSERT + // ARRANGE s.RunTxStakersSuccess(&stakertypes.MsgCreateStaker{ Creator: i.STAKER_0, Amount: 50 * i.KYVE, @@ -282,7 +282,7 @@ var _ = Describe("logic_bundles.go", Ordered, func() { }) It("Assert pool can run while pool has no funds", func() { - // ASSERT + // ARRANGE msg := &pooltypes.MsgCreatePool{ Authority: gov, Name: "PoolTest", @@ -333,7 +333,7 @@ var _ = Describe("logic_bundles.go", Ordered, func() { }) It("Assert pool can run when endKey is reached", func() { - // ASSERT + // ARRANGE pool, _ := s.App().PoolKeeper.GetPool(s.Ctx(), 0) pool.EndKey = "0" pool.CurrentKey = "0" @@ -349,7 +349,7 @@ var _ = Describe("logic_bundles.go", Ordered, func() { // ASSERT CAN VOTE It("Assert can vote if sender is no staker", func() { - // ASSERT + // ARRANGE s.RunTxStakersSuccess(&stakertypes.MsgCreateStaker{ Creator: i.STAKER_0, Amount: 100 * i.KYVE, @@ -411,7 +411,7 @@ var _ = Describe("logic_bundles.go", Ordered, func() { }) It("Assert can vote if bundle is dropped", func() { - // ASSERT + // ARRANGE s.RunTxStakersSuccess(&stakertypes.MsgCreateStaker{ Creator: i.STAKER_0, Amount: 100 * i.KYVE, @@ -470,7 +470,7 @@ var _ = Describe("logic_bundles.go", Ordered, func() { }) It("Assert can vote if storage id does not match", func() { - // ASSERT + // ARRANGE s.RunTxStakersSuccess(&stakertypes.MsgCreateStaker{ Creator: i.STAKER_0, Amount: 100 * i.KYVE, @@ -528,7 +528,7 @@ var _ = Describe("logic_bundles.go", Ordered, func() { }) It("Assert can vote if sender has already voted valid", func() { - // ASSERT + // ARRANGE s.RunTxStakersSuccess(&stakertypes.MsgCreateStaker{ Creator: i.STAKER_0, Amount: 100 * i.KYVE, @@ -595,7 +595,7 @@ var _ = Describe("logic_bundles.go", Ordered, func() { }) It("Assert can vote if sender has already voted invalid", func() { - // ASSERT + // ARRANGE s.RunTxStakersSuccess(&stakertypes.MsgCreateStaker{ Creator: i.STAKER_0, Amount: 100 * i.KYVE, @@ -662,7 +662,7 @@ var _ = Describe("logic_bundles.go", Ordered, func() { }) It("Assert can vote", func() { - // ASSERT + // ARRANGE s.RunTxStakersSuccess(&stakertypes.MsgCreateStaker{ Creator: i.STAKER_0, Amount: 100 * i.KYVE, @@ -723,7 +723,7 @@ var _ = Describe("logic_bundles.go", Ordered, func() { // ASSERT CAN PROPOSE It("Assert can propose if sender is no staker", func() { - // ASSERT + // ARRANGE s.RunTxStakersSuccess(&stakertypes.MsgCreateStaker{ Creator: i.STAKER_0, Amount: 100 * i.KYVE, @@ -765,7 +765,7 @@ var _ = Describe("logic_bundles.go", Ordered, func() { }) It("Assert can propose if sender is not next uploader", func() { - // ASSERT + // ARRANGE s.RunTxStakersSuccess(&stakertypes.MsgCreateStaker{ Creator: i.STAKER_0, Amount: 100 * i.KYVE, @@ -807,7 +807,7 @@ var _ = Describe("logic_bundles.go", Ordered, func() { }) It("Assert can propose if upload interval has not passed", func() { - // ASSERT + // ARRANGE s.RunTxStakersSuccess(&stakertypes.MsgCreateStaker{ Creator: i.STAKER_0, Amount: 100 * i.KYVE, @@ -852,7 +852,7 @@ var _ = Describe("logic_bundles.go", Ordered, func() { }) It("Assert can propose if index does not match", func() { - // ASSERT + // ARRANGE s.RunTxStakersSuccess(&stakertypes.MsgCreateStaker{ Creator: i.STAKER_0, Amount: 100 * i.KYVE, @@ -894,7 +894,7 @@ var _ = Describe("logic_bundles.go", Ordered, func() { }) It("Assert can propose", func() { - // ASSERT + // ARRANGE s.RunTxStakersSuccess(&stakertypes.MsgCreateStaker{ Creator: i.STAKER_0, Amount: 100 * i.KYVE, From 6c3a23f91eb8502179a4b23a76104648b574f8a4 Mon Sep 17 00:00:00 2001 From: rapha Date: Thu, 2 May 2024 17:14:23 +0200 Subject: [PATCH 6/8] feat: add EndKey to MsgCreatePool/EventCreatePool --- proto/kyve/pool/v1beta1/events.proto | 2 + proto/kyve/pool/v1beta1/tx.proto | 2 + x/pool/keeper/msg_server_create_pool.go | 2 + x/pool/keeper/msg_server_create_pool_test.go | 3 + x/pool/types/events.pb.go | 143 ++++++++++------ x/pool/types/tx.pb.go | 161 ++++++++++++------- 6 files changed, 214 insertions(+), 99 deletions(-) diff --git a/proto/kyve/pool/v1beta1/events.proto b/proto/kyve/pool/v1beta1/events.proto index 2c0d83fc..18571628 100644 --- a/proto/kyve/pool/v1beta1/events.proto +++ b/proto/kyve/pool/v1beta1/events.proto @@ -57,6 +57,8 @@ message EventCreatePool { // compression_id is the unique id of the compression type the bundles // get compressed with uint32 compression_id = 14; + // end_key is the last key before the pool should stop indexing + string end_key = 15; } // EventPoolEnabled ... diff --git a/proto/kyve/pool/v1beta1/tx.proto b/proto/kyve/pool/v1beta1/tx.proto index f211f738..5b20a63a 100644 --- a/proto/kyve/pool/v1beta1/tx.proto +++ b/proto/kyve/pool/v1beta1/tx.proto @@ -64,6 +64,8 @@ message MsgCreatePool { uint32 storage_provider_id = 13; // compression_id ... uint32 compression_id = 14; + // end_key ... + string end_key = 15; } // MsgCreatePoolResponse defines the Msg/CreatePool response type. diff --git a/x/pool/keeper/msg_server_create_pool.go b/x/pool/keeper/msg_server_create_pool.go index 2aaa5ee4..16a647dc 100644 --- a/x/pool/keeper/msg_server_create_pool.go +++ b/x/pool/keeper/msg_server_create_pool.go @@ -32,6 +32,7 @@ func (k msgServer) CreatePool(goCtx context.Context, req *types.MsgCreatePool) ( Logo: req.Logo, Config: req.Config, StartKey: req.StartKey, + EndKey: req.EndKey, UploadInterval: req.UploadInterval, InflationShareWeight: req.InflationShareWeight, MinDelegation: req.MinDelegation, @@ -56,6 +57,7 @@ func (k msgServer) CreatePool(goCtx context.Context, req *types.MsgCreatePool) ( Logo: req.Logo, Config: req.Config, StartKey: req.StartKey, + EndKey: req.EndKey, UploadInterval: req.UploadInterval, InflationShareWeight: req.InflationShareWeight, MinDelegation: req.MinDelegation, diff --git a/x/pool/keeper/msg_server_create_pool_test.go b/x/pool/keeper/msg_server_create_pool_test.go index eb33578d..57818d96 100644 --- a/x/pool/keeper/msg_server_create_pool_test.go +++ b/x/pool/keeper/msg_server_create_pool_test.go @@ -102,6 +102,7 @@ var _ = Describe("msg_server_create_pool.go", Ordered, func() { Logo: "ar://Tewyv2P5VEG8EJ6AUQORdqNTectY9hlOrWPK8wwo-aU", Config: "ar://DgdB-2hLrxjhyEEbCML__dgZN5_uS7T6Z5XDkaFh3P0", StartKey: "0", + EndKey: "100", UploadInterval: 60, InflationShareWeight: 10000, MinDelegation: 100 * i.KYVE, @@ -137,6 +138,7 @@ var _ = Describe("msg_server_create_pool.go", Ordered, func() { Logo: "ar://Tewyv2P5VEG8EJ6AUQORdqNTectY9hlOrWPK8wwo-aU", Config: "ar://DgdB-2hLrxjhyEEbCML__dgZN5_uS7T6Z5XDkaFh3P0", StartKey: "0", + EndKey: "100", CurrentKey: "", CurrentSummary: "", CurrentIndex: 0, @@ -244,6 +246,7 @@ var _ = Describe("msg_server_create_pool.go", Ordered, func() { Logo: "ar://Tewyv2P5VEG8EJ6AUQORdqNTectY9hlOrWPK8wwo-aU", Config: "ar://DgdB-2hLrxjhyEEbCML__dgZN5_uS7T6Z5XDkaFh3P0", StartKey: "0", + EndKey: "", CurrentKey: "", CurrentSummary: "", CurrentIndex: 0, diff --git a/x/pool/types/events.pb.go b/x/pool/types/events.pb.go index 35d7e1a4..8ab58a3d 100644 --- a/x/pool/types/events.pb.go +++ b/x/pool/types/events.pb.go @@ -127,6 +127,8 @@ type EventCreatePool struct { // compression_id is the unique id of the compression type the bundles // get compressed with CompressionId uint32 `protobuf:"varint,14,opt,name=compression_id,json=compressionId,proto3" json:"compression_id,omitempty"` + // end_key is the last key before the pool should stop indexing + EndKey string `protobuf:"bytes,15,opt,name=end_key,json=endKey,proto3" json:"end_key,omitempty"` } func (m *EventCreatePool) Reset() { *m = EventCreatePool{} } @@ -260,6 +262,13 @@ func (m *EventCreatePool) GetCompressionId() uint32 { return 0 } +func (m *EventCreatePool) GetEndKey() string { + if m != nil { + return m.EndKey + } + return "" +} + // EventPoolEnabled ... // emitted_by: EndBlock(gov) type EventPoolEnabled struct { @@ -737,55 +746,56 @@ func init() { func init() { proto.RegisterFile("kyve/pool/v1beta1/events.proto", fileDescriptor_c1828a100d789238) } var fileDescriptor_c1828a100d789238 = []byte{ - // 763 bytes of a gzipped FileDescriptorProto + // 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, - 0x58, 0x09, 0x0e, 0x9c, 0x10, 0x6a, 0x5f, 0x04, 0xd9, 0xbb, 0x9b, 0x2f, 0x69, 0xf7, 0xfb, 0xd4, - 0xeb, 0x77, 0xf3, 0xcc, 0xef, 0x37, 0xe3, 0xf1, 0xcc, 0xfc, 0x76, 0x51, 0xfb, 0x7a, 0x39, 0x87, - 0x7e, 0x24, 0x44, 0xd0, 0x9f, 0x1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 0x58, 0x7a, 0x15, - 0x0b, 0xed, 0x58, 0xc7, 0x05, 0x2c, 0xdd, 0xaf, 0x51, 0x33, 0x8e, 0x4c, 0x91, 0x98, 0x71, 0x0d, - 0x72, 0x4e, 0x02, 0x6f, 0xdb, 0xd6, 0xd4, 0x48, 0xdc, 0x83, 0xd4, 0xeb, 0xfe, 0x80, 0xf6, 0x19, - 0x9f, 0x06, 0x44, 0x33, 0xc1, 0xb1, 0x9a, 0x11, 0x09, 0x78, 0x01, 0xcc, 0x9f, 0x69, 0x6f, 0xc7, - 0xf2, 0xf7, 0x56, 0xe8, 0xc8, 0x80, 0xbf, 0x59, 0xcc, 0x3d, 0x44, 0x8d, 0x90, 0x71, 0x4c, 0x21, - 0x00, 0xdf, 0x82, 0x5e, 0xd5, 0xb2, 0xeb, 0x21, 0xe3, 0x67, 0x2b, 0xa7, 0xfb, 0x15, 0x6a, 0x86, - 0xe4, 0x06, 0x8f, 0x63, 0x4e, 0x03, 0xc0, 0x8a, 0xdd, 0x82, 0x87, 0x52, 0x1e, 0xb9, 0x39, 0xb1, - 0xde, 0x11, 0xbb, 0xb5, 0x0d, 0x99, 0x83, 0x54, 0x26, 0x4f, 0x2d, 0x69, 0x48, 0x6a, 0xba, 0x07, - 0x68, 0x67, 0xcc, 0x38, 0x91, 0x0c, 0x94, 0xb7, 0x9b, 0xbc, 0x31, 0xb3, 0xdd, 0x1e, 0xfa, 0x50, - 0x69, 0x21, 0x89, 0x0f, 0x38, 0x92, 0x62, 0xce, 0x28, 0x48, 0xcc, 0xa8, 0x57, 0xef, 0x38, 0x47, - 0xf5, 0x61, 0x2b, 0x85, 0x2e, 0x53, 0x64, 0x40, 0x4d, 0xd1, 0x13, 0x11, 0x46, 0x12, 0x94, 0x49, - 0x6d, 0xa8, 0x0d, 0x4b, 0xad, 0xaf, 0x79, 0x07, 0xb4, 0xdb, 0x45, 0x1f, 0xd8, 0xa1, 0x9a, 0x71, - 0x9e, 0x73, 0x32, 0x0e, 0x80, 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8e, 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, } func (m *EventUpdateParams) Marshal() (dAtA []byte, err error) { @@ -858,6 +868,13 @@ func (m *EventCreatePool) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.EndKey) > 0 { + i -= len(m.EndKey) + copy(dAtA[i:], m.EndKey) + i = encodeVarintEvents(dAtA, i, uint64(len(m.EndKey))) + i-- + dAtA[i] = 0x7a + } if m.CompressionId != 0 { i = encodeVarintEvents(dAtA, i, uint64(m.CompressionId)) i-- @@ -1337,6 +1354,10 @@ func (m *EventCreatePool) Size() (n int) { if m.CompressionId != 0 { n += 1 + sovEvents(uint64(m.CompressionId)) } + l = len(m.EndKey) + if l > 0 { + n += 1 + l + sovEvents(uint64(l)) + } return n } @@ -2027,6 +2048,38 @@ func (m *EventCreatePool) Unmarshal(dAtA []byte) error { break } } + case 15: + 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 ErrIntOverflowEvents + } + 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 ErrInvalidLengthEvents + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.EndKey = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipEvents(dAtA[iNdEx:]) diff --git a/x/pool/types/tx.pb.go b/x/pool/types/tx.pb.go index f7c6ab36..76953d6e 100644 --- a/x/pool/types/tx.pb.go +++ b/x/pool/types/tx.pb.go @@ -59,6 +59,8 @@ type MsgCreatePool struct { StorageProviderId uint32 `protobuf:"varint,13,opt,name=storage_provider_id,json=storageProviderId,proto3" json:"storage_provider_id,omitempty"` // compression_id ... CompressionId uint32 `protobuf:"varint,14,opt,name=compression_id,json=compressionId,proto3" json:"compression_id,omitempty"` + // end_key ... + EndKey string `protobuf:"bytes,15,opt,name=end_key,json=endKey,proto3" json:"end_key,omitempty"` } func (m *MsgCreatePool) Reset() { *m = MsgCreatePool{} } @@ -192,6 +194,13 @@ func (m *MsgCreatePool) GetCompressionId() uint32 { return 0 } +func (m *MsgCreatePool) GetEndKey() string { + if m != nil { + return m.EndKey + } + return "" +} + // MsgCreatePoolResponse defines the Msg/CreatePool response type. type MsgCreatePoolResponse struct { } @@ -846,60 +855,61 @@ func init() { func init() { proto.RegisterFile("kyve/pool/v1beta1/tx.proto", fileDescriptor_20ddefdf83388ddc) } var fileDescriptor_20ddefdf83388ddc = []byte{ - // 851 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x56, 0xcf, 0x6f, 0xdb, 0x36, - 0x14, 0x8e, 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, 0xdd, 0xc2, - 0xd4, 0xb7, 0x5e, 0x79, 0xcc, 0x86, 0x63, 0x77, 0xae, 0xe6, 0xcc, 0xd7, 0xb7, 0x37, 0xbe, 0x7f, - 0xf9, 0xbc, 0x63, 0x9d, 0xde, 0xfb, 0xf5, 0xa2, 0x61, 0xbd, 0xb8, 0x68, 0x58, 0x7f, 0x5e, 0x34, - 0xac, 0x9f, 0x2f, 0x1b, 0x6b, 0x2f, 0x2e, 0x1b, 0x6b, 0x7f, 0x5c, 0x36, 0xd6, 0xbe, 0xba, 0xe5, - 0x33, 0x35, 0x1a, 0x0f, 0xba, 0x43, 0x1e, 0x3a, 0x0f, 0xbf, 0xfc, 0xec, 0xc1, 0xa7, 0x54, 0x3d, - 0xe5, 0xe2, 0xdc, 0x19, 0x8e, 0x30, 0x8b, 0x9c, 0x69, 0xf2, 0xe1, 0xa5, 0x66, 0x31, 0x95, 0x83, - 0x4d, 0xf3, 0xb5, 0xf4, 0xd1, 0xdf, 0x01, 0x00, 0x00, 0xff, 0xff, 0x62, 0x52, 0x92, 0x7f, 0x92, + // 867 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x56, 0x4f, 0x6f, 0x1b, 0x45, + 0x14, 0xcf, 0x3a, 0xce, 0xbf, 0x97, 0xd8, 0x51, 0x87, 0x90, 0x6c, 0x16, 0xc9, 0x24, 0x41, 0x40, + 0x1a, 0x81, 0x57, 0x29, 0x15, 0x07, 0x6e, 0x4d, 0xdb, 0x43, 0x14, 0x05, 0x55, 0x8e, 0xca, 0x5f, + 0x89, 0xd5, 0xd8, 0x33, 0x5d, 0x8f, 0xb2, 0x3b, 0xb3, 0x9a, 0x19, 0xbb, 0x71, 0xe1, 0x00, 0x7c, + 0x02, 0x3e, 0x03, 0x9f, 0xa0, 0x07, 0x3e, 0x04, 0x17, 0xa4, 0x8a, 0x13, 0x47, 0x94, 0x1c, 0x7a, +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b8, 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, } @@ -1247,6 +1257,13 @@ func (m *MsgCreatePool) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.EndKey) > 0 { + i -= len(m.EndKey) + copy(dAtA[i:], m.EndKey) + i = encodeVarintTx(dAtA, i, uint64(len(m.EndKey))) + i-- + dAtA[i] = 0x7a + } if m.CompressionId != 0 { i = encodeVarintTx(dAtA, i, uint64(m.CompressionId)) i-- @@ -1811,6 +1828,10 @@ func (m *MsgCreatePool) Size() (n int) { if m.CompressionId != 0 { n += 1 + sovTx(uint64(m.CompressionId)) } + l = len(m.EndKey) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } return n } @@ -2399,6 +2420,38 @@ func (m *MsgCreatePool) Unmarshal(dAtA []byte) error { break } } + case 15: + 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 ErrIntOverflowTx + } + 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 ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.EndKey = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:]) From d7f4681f9933c77fde3d8577aee50b12bee70797 Mon Sep 17 00:00:00 2001 From: Troy Kessler Date: Fri, 3 May 2024 14:42:09 +0200 Subject: [PATCH 7/8] chore: added more detailed descriptions --- docs/static/openapi.yml | 12 ++++++++++-- proto/kyve/pool/v1beta1/events.proto | 3 ++- proto/kyve/pool/v1beta1/pool.proto | 3 ++- x/bundles/keeper/logic_bundles.go | 4 +++- x/pool/types/events.pb.go | 3 ++- x/pool/types/pool.pb.go | 3 ++- 6 files changed, 21 insertions(+), 7 deletions(-) diff --git a/docs/static/openapi.yml b/docs/static/openapi.yml index 1e7d442f..85e92e68 100644 --- a/docs/static/openapi.yml +++ b/docs/static/openapi.yml @@ -4990,7 +4990,11 @@ paths: description: compression_id ... end_key: type: string - description: end_key ... + title: >- + end_key is the last key before the pool should stop + indexing, it is + + inclusive bundle_proposal: description: bundle_proposal ... type: object @@ -5527,7 +5531,11 @@ paths: description: compression_id ... end_key: type: string - description: end_key ... + title: >- + end_key is the last key before the pool should stop + indexing, it is + + inclusive bundle_proposal: description: bundle_proposal ... type: object diff --git a/proto/kyve/pool/v1beta1/events.proto b/proto/kyve/pool/v1beta1/events.proto index 18571628..9b060641 100644 --- a/proto/kyve/pool/v1beta1/events.proto +++ b/proto/kyve/pool/v1beta1/events.proto @@ -57,7 +57,8 @@ message EventCreatePool { // compression_id is the unique id of the compression type the bundles // get compressed with uint32 compression_id = 14; - // end_key is the last key before the pool should stop indexing + // end_key is the last key before the pool should stop indexing, it is + // inclusive string end_key = 15; } diff --git a/proto/kyve/pool/v1beta1/pool.proto b/proto/kyve/pool/v1beta1/pool.proto index df5a16fb..6989df43 100644 --- a/proto/kyve/pool/v1beta1/pool.proto +++ b/proto/kyve/pool/v1beta1/pool.proto @@ -113,6 +113,7 @@ message Pool { // compression_id ... uint32 current_compression_id = 19; - // end_key ... + // end_key is the last key before the pool should stop indexing, it is + // inclusive string end_key = 20; } diff --git a/x/bundles/keeper/logic_bundles.go b/x/bundles/keeper/logic_bundles.go index c0947102..c7311594 100644 --- a/x/bundles/keeper/logic_bundles.go +++ b/x/bundles/keeper/logic_bundles.go @@ -31,7 +31,9 @@ func (k Keeper) AssertPoolCanRun(ctx sdk.Context, poolId uint64) error { return types.ErrPoolDisabled } - // Error if the end key is reached + // Error if the end key is reached. The chain will simply halt if this is the case, + // it is the responsibility of the protocol nodes to reach final consensus and that + // a bundle does not exceed the end_key if pool.EndKey != "" && pool.CurrentKey == pool.EndKey { return types.ErrEndKeyReached } diff --git a/x/pool/types/events.pb.go b/x/pool/types/events.pb.go index 8ab58a3d..3ecaed5d 100644 --- a/x/pool/types/events.pb.go +++ b/x/pool/types/events.pb.go @@ -127,7 +127,8 @@ type EventCreatePool struct { // compression_id is the unique id of the compression type the bundles // get compressed with CompressionId uint32 `protobuf:"varint,14,opt,name=compression_id,json=compressionId,proto3" json:"compression_id,omitempty"` - // end_key is the last key before the pool should stop indexing + // end_key is the last key before the pool should stop indexing, it is + // inclusive EndKey string `protobuf:"bytes,15,opt,name=end_key,json=endKey,proto3" json:"end_key,omitempty"` } diff --git a/x/pool/types/pool.pb.go b/x/pool/types/pool.pb.go index 3f9cc5c4..ad02386f 100644 --- a/x/pool/types/pool.pb.go +++ b/x/pool/types/pool.pb.go @@ -268,7 +268,8 @@ type Pool struct { 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 ... + // 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"` } From a0802e736cbf5f61da58a09672f74a279b5f9872 Mon Sep 17 00:00:00 2001 From: Troy Kessler Date: Fri, 3 May 2024 14:48:54 +0200 Subject: [PATCH 8/8] fix: correct comment --- x/bundles/keeper/logic_bundles.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/bundles/keeper/logic_bundles.go b/x/bundles/keeper/logic_bundles.go index c7311594..517841dd 100644 --- a/x/bundles/keeper/logic_bundles.go +++ b/x/bundles/keeper/logic_bundles.go @@ -31,7 +31,7 @@ func (k Keeper) AssertPoolCanRun(ctx sdk.Context, poolId uint64) error { return types.ErrPoolDisabled } - // Error if the end key is reached. The chain will simply halt if this is the case, + // Error if the end key is reached. The pool will simply halt if this is the case, // it is the responsibility of the protocol nodes to reach final consensus and that // a bundle does not exceed the end_key if pool.EndKey != "" && pool.CurrentKey == pool.EndKey {