From d516277d103d7526625308afc2d1509e265cff4c Mon Sep 17 00:00:00 2001 From: Giuseppe Natale <12249307+giunatale@users.noreply.github.com> Date: Mon, 2 Dec 2024 16:33:44 +0100 Subject: [PATCH 01/29] prototype `GetCurrentMinDeposit` --- x/gov/keeper/deposit.go | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/x/gov/keeper/deposit.go b/x/gov/keeper/deposit.go index 450487b3..9dd56e83 100644 --- a/x/gov/keeper/deposit.go +++ b/x/gov/keeper/deposit.go @@ -250,3 +250,41 @@ func (keeper Keeper) validateInitialDeposit(ctx sdk.Context, initialDeposit sdk. } return nil } + +// GetCurrentMinDeposit returns the (dynamic) minimum deposit currently required for a proposal +func (keeper Keeper) GetCurrentMinDeposit(ctx sdk.Context) (sdk.Coins, error) { + params := keeper.GetParams(ctx) + paramMinDeposit := params.MinDeposit + tick := params.MinDepositUpdatePeriod + targetActiveProposals := params.TargetActiveProposals + k := params.TargetPropsDistanceSensitivity + a := sdk.ZeroDec() + b := sdk.ZeroInt() + + numActiveProposals := keeper.GetNumActiveProposals(ctx) + + if numActiveProposals > targetActiveProposals { + a = params.DepositIncreaseRatio + } else { + a = params.DepositDecreaseRatio + b = sdk.OneInt() + } + + c1, err := numActiveProposals.Sub(targetActiveProposals).Sub(b).Abs().ToLegacyDec().ApproxRoot(k) + if err != nil { + return sdk.Coins{}, err + } + c := a.Mul(c1) + + lastMinDeposit, lastMinDepositTime := keeper.GetLastMinDeposit(ctx) + + // get number of ticks passed since last update + ticksPassed := ctx.BlockTime().Sub(lastMinDepositTime).Nanoseconds() / tick.Nanoseconds() + + currMinDeposit := lastMinDeposit.Mul(sdk.OneDec().Add(c.Power(ticksPassed))) + if currMinDeposit < paramMinDeposit { + currMinDeposit = paramMinDeposit + } + + return currMinDeposit +} From 4f6b7a7b18841a02b8537ffe2d26cb4bc5332ee9 Mon Sep 17 00:00:00 2001 From: Giuseppe Natale <12249307+giunatale@users.noreply.github.com> Date: Mon, 2 Dec 2024 18:30:27 +0100 Subject: [PATCH 02/29] move prototype to separate file --- x/gov/keeper/deposit.go | 38 ------------ x/gov/keeper/keeper.go | 4 ++ x/gov/keeper/min_deposit.go | 118 ++++++++++++++++++++++++++++++++++++ x/gov/types/keys.go | 15 +++++ 4 files changed, 137 insertions(+), 38 deletions(-) create mode 100644 x/gov/keeper/min_deposit.go diff --git a/x/gov/keeper/deposit.go b/x/gov/keeper/deposit.go index 9dd56e83..450487b3 100644 --- a/x/gov/keeper/deposit.go +++ b/x/gov/keeper/deposit.go @@ -250,41 +250,3 @@ func (keeper Keeper) validateInitialDeposit(ctx sdk.Context, initialDeposit sdk. } return nil } - -// GetCurrentMinDeposit returns the (dynamic) minimum deposit currently required for a proposal -func (keeper Keeper) GetCurrentMinDeposit(ctx sdk.Context) (sdk.Coins, error) { - params := keeper.GetParams(ctx) - paramMinDeposit := params.MinDeposit - tick := params.MinDepositUpdatePeriod - targetActiveProposals := params.TargetActiveProposals - k := params.TargetPropsDistanceSensitivity - a := sdk.ZeroDec() - b := sdk.ZeroInt() - - numActiveProposals := keeper.GetNumActiveProposals(ctx) - - if numActiveProposals > targetActiveProposals { - a = params.DepositIncreaseRatio - } else { - a = params.DepositDecreaseRatio - b = sdk.OneInt() - } - - c1, err := numActiveProposals.Sub(targetActiveProposals).Sub(b).Abs().ToLegacyDec().ApproxRoot(k) - if err != nil { - return sdk.Coins{}, err - } - c := a.Mul(c1) - - lastMinDeposit, lastMinDepositTime := keeper.GetLastMinDeposit(ctx) - - // get number of ticks passed since last update - ticksPassed := ctx.BlockTime().Sub(lastMinDepositTime).Nanoseconds() / tick.Nanoseconds() - - currMinDeposit := lastMinDeposit.Mul(sdk.OneDec().Add(c.Power(ticksPassed))) - if currMinDeposit < paramMinDeposit { - currMinDeposit = paramMinDeposit - } - - return currMinDeposit -} diff --git a/x/gov/keeper/keeper.go b/x/gov/keeper/keeper.go index 7d8ebf0a..e6ca9163 100644 --- a/x/gov/keeper/keeper.go +++ b/x/gov/keeper/keeper.go @@ -147,12 +147,16 @@ func (keeper Keeper) InsertActiveProposalQueue(ctx sdk.Context, proposalID uint6 store := ctx.KVStore(keeper.storeKey) bz := types.GetProposalIDBytes(proposalID) store.Set(types.ActiveProposalQueueKey(proposalID, endTime), bz) + + keeper.IncrementActiveProposalsNumber(ctx) } // RemoveFromActiveProposalQueue removes a proposalID from the Active Proposal Queue func (keeper Keeper) RemoveFromActiveProposalQueue(ctx sdk.Context, proposalID uint64, endTime time.Time) { store := ctx.KVStore(keeper.storeKey) store.Delete(types.ActiveProposalQueueKey(proposalID, endTime)) + + keeper.DecrementActiveProposalsNumber(ctx) } // InsertInactiveProposalQueue inserts a proposalID into the inactive proposal queue at endTime diff --git a/x/gov/keeper/min_deposit.go b/x/gov/keeper/min_deposit.go new file mode 100644 index 00000000..f863c626 --- /dev/null +++ b/x/gov/keeper/min_deposit.go @@ -0,0 +1,118 @@ +package keeper + +import ( + "time" + + "cosmossdk.io/math" + + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/atomone-hub/atomone/x/gov/types" +) + +// GetActiveProposalsNumber gets the number of active proposals +func (keeper Keeper) GetActiveProposalsNumber(ctx sdk.Context) (activeProposalsNumber uint64) { + store := ctx.KVStore(keeper.storeKey) + bz := store.Get(types.ActiveProposalsNumberKey) + if bz == nil { + return 0 + } + + activeProposalsNumber = types.GetActiveProposalsNumberFromBytes(bz) + return activeProposalsNumber +} + +// SetActiveProposalsNumber sets the new number of active proposals to the store +func (keeper Keeper) SetActiveProposalsNumber(ctx sdk.Context, activeProposalsNumber uint64) { + store := ctx.KVStore(keeper.storeKey) + store.Set(types.ActiveProposalsNumberKey, types.GetActiveProposalsNumberBytes(activeProposalsNumber)) +} + +// IncrementActiveProposalsNumber increments the number of active proposals by one +func (keeper Keeper) IncrementActiveProposalsNumber(ctx sdk.Context) { + activeProposalsNumber := keeper.GetActiveProposalsNumber(ctx) + keeper.SetActiveProposalsNumber(ctx, activeProposalsNumber+1) +} + +// DecrementActiveProposalsNumber decrements the number of active proposals by one +func (keeper Keeper) DecrementActiveProposalsNumber(ctx sdk.Context) { + activeProposalsNumber := keeper.GetActiveProposalsNumber(ctx) + keeper.SetActiveProposalsNumber(ctx, activeProposalsNumber-1) +} + +// SetLastMinDeposit updates the last min deposit and last min deposit time +// used to record these values the last time the number of active proposals changed +func (keeper Keeper) SetLastMinDeposit(ctx sdk.Context, minDeposit sdk.Coin) { + store := ctx.KVStore(keeper.storeKey) + bz, err := keeper.cdc.Marshal(&minDeposit) + if err != nil { + panic(err) + } + store.Set(types.LastMinDepositKey, bz) + + blockTime := ctx.BlockTime() + bz = sdk.FormatTimeBytes(blockTime) + store.Set(types.LastMinDepositTimeKey, bz) +} + +// GetLastMinDeposit returns the last min deposit and the time it was set +func (keeper Keeper) GetLastMinDeposit(ctx sdk.Context) (lastMinDeposit sdk.Coin, lastMinDepositTime time.Time) { + store := ctx.KVStore(keeper.storeKey) + bz := store.Get(types.LastMinDepositKey) + if bz == nil { + return sdk.Coin{}, time.Time{} + } + err := keeper.cdc.Unmarshal(bz, &lastMinDeposit) + if err != nil { + panic(err) + } + + bz = store.Get(types.LastMinDepositTimeKey) + if bz == nil { + return sdk.Coin{}, time.Time{} + } + lastMinDepositTime, err = sdk.ParseTimeBytes(bz) + if err != nil { + panic(err) + } + return lastMinDeposit, lastMinDepositTime +} + +// GetCurrentMinDeposit returns the (dynamic) minimum deposit currently required for a proposal +func (keeper Keeper) GetCurrentMinDeposit(ctx sdk.Context) (sdk.Coin, error) { + params := keeper.GetParams(ctx) + paramMinDeposit := params.MinDeposit[0] + tick := params.MinDepositUpdatePeriod + targetActiveProposals := math.NewIntFromUint64(params.TargetActiveProposals) + k := params.TargetPropsDistanceSensitivity + a := math.LegacyZeroDec() + b := math.ZeroInt() + + numActiveProposals := math.NewIntFromUint64(keeper.GetActiveProposalsNumber(ctx)) + + if numActiveProposals.GT(targetActiveProposals) { + a = params.DepositIncreaseRatio + } else { + a = params.DepositDecreaseRatio + b = math.OneInt() + } + + c1, err := numActiveProposals.Sub(targetActiveProposals).Sub(b).Abs().ToLegacyDec().ApproxRoot(k) + if err != nil { + return sdk.Coin{}, err + } + c := a.Mul(c1) + + lastMinDeposit, lastMinDepositTime := keeper.GetLastMinDeposit(ctx) + + // get number of ticks passed since last update + ticksPassed := ctx.BlockTime().Sub(lastMinDepositTime).Nanoseconds() / tick.Nanoseconds() + + currMinDepositAmt := lastMinDeposit.Amount.ToLegacyDec().Mul(math.LegacyOneDec().Add(c.Power(ticksPassed))).TruncateInt() + currMinDeposit := sdk.NewCoin(paramMinDeposit.Denom, currMinDepositAmt) + if currMinDepositAmt.LT(paramMinDeposit.Amount) { + currMinDeposit.Amount = paramMinDeposit.Amount + } + + return currMinDeposit, nil +} diff --git a/x/gov/types/keys.go b/x/gov/types/keys.go index 8d12a08b..e5ca5f66 100644 --- a/x/gov/types/keys.go +++ b/x/gov/types/keys.go @@ -45,6 +45,9 @@ var ( ProposalIDKey = []byte{0x03} VotingPeriodProposalKeyPrefix = []byte{0x04} QuorumCheckQueuePrefix = []byte{0x05} + ActiveProposalsNumberKey = []byte{0x06} + LastMinDepositKey = []byte{0x07} + LastMinDepositTimeKey = []byte{0x08} DepositsKeyPrefix = []byte{0x10} @@ -188,3 +191,15 @@ func splitKeyWithAddress(key []byte) (proposalID uint64, addr sdk.AccAddress) { addr = sdk.AccAddress(key[10:]) return } + +// GetActiveProposalsNumberBytes returns the byte representation of the activeProposalsNumber +func GetActiveProposalsNumberBytes(activeProposalsNumber uint64) (activeProposalsNumberBz []byte) { + activeProposalsNumberBz = make([]byte, 8) + binary.BigEndian.PutUint64(activeProposalsNumberBz, activeProposalsNumber) + return +} + +// GetActiveProposalsNumberFromBytes returns activeProposalsNumber in uint64 format from a byte array +func GetActiveProposalsNumberFromBytes(bz []byte) (activeProposalsNumber uint64) { + return binary.BigEndian.Uint64(bz) +} From 383396d06daeb9ccbcb5733cb866de6c70727069 Mon Sep 17 00:00:00 2001 From: Giuseppe Natale <12249307+giunatale@users.noreply.github.com> Date: Tue, 3 Dec 2024 13:19:42 +0100 Subject: [PATCH 03/29] draft implementation, still missing pieces --- proto/atomone/gov/v1/gov.proto | 40 +- x/gov/abci.go | 1 + x/gov/keeper/keeper.go | 4 - x/gov/keeper/min_deposit.go | 108 ++-- x/gov/keeper/params.go | 4 + x/gov/keeper/proposal.go | 1 + x/gov/types/keys.go | 25 +- x/gov/types/v1/gov.pb.go | 885 +++++++++++++++++++++++++++------ 8 files changed, 850 insertions(+), 218 deletions(-) diff --git a/proto/atomone/gov/v1/gov.proto b/proto/atomone/gov/v1/gov.proto index e40d259c..4e1fbfb1 100644 --- a/proto/atomone/gov/v1/gov.proto +++ b/proto/atomone/gov/v1/gov.proto @@ -48,6 +48,17 @@ message Deposit { [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ]; } +// LastMinDeposit is a record of the last time the minimum deposit +// was updated in the store, both its value and a timestamp +message LastMinDeposit { + // value is the value of the minimum deposit + repeated cosmos.base.v1beta1.Coin value = 1 + [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ]; + + // time is the time the minimum deposit was last updated + google.protobuf.Timestamp time = 2 [ (gogoproto.stdtime) = true ]; +} + // Proposal defines the core field members of a governance proposal. message Proposal { // id defines the unique id of the proposal. @@ -213,8 +224,10 @@ message TallyParams { // Since: cosmos-sdk 0.47 message Params { // Minimum deposit for a proposal to enter voting period. + // Deprecated: a dynamic system now determines the minimum deposit, + // min_deposit_floor repeated cosmos.base.v1beta1.Coin min_deposit = 1 - [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ]; + [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true, deprecated = true ]; // Maximum period for Atom holders to deposit on a proposal. Initial value: 2 // months. @@ -272,4 +285,29 @@ message Params { // Number of times a proposal should be checked for quorum after the quorum timeout // has elapsed. Used to compute the amount of time in between quorum checks. uint64 quorum_check_count = 22; + + // Floor value for the minimum deposit required for a proposal to enter the voting period. + repeated cosmos.base.v1beta1.Coin min_deposit_floor = 23 + [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ]; + + // Duration that dictates after how long the dynamic minimum deposit should be recalculated + // for time-based updates. + google.protobuf.Duration min_deposit_update_period = 24 [(gogoproto.stdduration) = true]; + + // The number of active proposals the dynamic minimum deposit should target. + uint64 target_active_proposals = 25; + + // The ratio of increase for the minimum deposit when the number of active proposals + // exceeds the target by 1. + string min_deposit_increase_ratio = 26 [(cosmos_proto.scalar) = "cosmos.Dec"]; + + // The ratio of decrease for the minimum deposit when the number of active proposals + // is equal to the target. + string min_deposit_decrease_ratio = 27 [(cosmos_proto.scalar) = "cosmos.Dec"]; + + // A positive integer representing the sensitivity of the dynamic minimum deposit + // increase/decrease to the distance from the target number of active proposals. + // The higher the number, the lower the sensitivity. A value of 1 represents the + // highest sensitivity. + uint64 min_deposit_sensitivity_target_distance = 28; } diff --git a/x/gov/abci.go b/x/gov/abci.go index 29fc35cd..9dcf78ed 100644 --- a/x/gov/abci.go +++ b/x/gov/abci.go @@ -190,6 +190,7 @@ func EndBlocker(ctx sdk.Context, keeper *keeper.Keeper) { keeper.SetProposal(ctx, proposal) keeper.RemoveFromActiveProposalQueue(ctx, proposal.Id, *proposal.VotingEndTime) + keeper.DecrementActiveProposalsNumber(ctx) // when proposal become active keeper.Hooks().AfterProposalVotingPeriodEnded(ctx, proposal.Id) diff --git a/x/gov/keeper/keeper.go b/x/gov/keeper/keeper.go index e6ca9163..7d8ebf0a 100644 --- a/x/gov/keeper/keeper.go +++ b/x/gov/keeper/keeper.go @@ -147,16 +147,12 @@ func (keeper Keeper) InsertActiveProposalQueue(ctx sdk.Context, proposalID uint6 store := ctx.KVStore(keeper.storeKey) bz := types.GetProposalIDBytes(proposalID) store.Set(types.ActiveProposalQueueKey(proposalID, endTime), bz) - - keeper.IncrementActiveProposalsNumber(ctx) } // RemoveFromActiveProposalQueue removes a proposalID from the Active Proposal Queue func (keeper Keeper) RemoveFromActiveProposalQueue(ctx sdk.Context, proposalID uint64, endTime time.Time) { store := ctx.KVStore(keeper.storeKey) store.Delete(types.ActiveProposalQueueKey(proposalID, endTime)) - - keeper.DecrementActiveProposalsNumber(ctx) } // InsertInactiveProposalQueue inserts a proposalID into the inactive proposal queue at endTime diff --git a/x/gov/keeper/min_deposit.go b/x/gov/keeper/min_deposit.go index f863c626..1aa4e334 100644 --- a/x/gov/keeper/min_deposit.go +++ b/x/gov/keeper/min_deposit.go @@ -8,6 +8,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/atomone-hub/atomone/x/gov/types" + v1 "github.com/atomone-hub/atomone/x/gov/types/v1" ) // GetActiveProposalsNumber gets the number of active proposals @@ -30,76 +31,75 @@ func (keeper Keeper) SetActiveProposalsNumber(ctx sdk.Context, activeProposalsNu // IncrementActiveProposalsNumber increments the number of active proposals by one func (keeper Keeper) IncrementActiveProposalsNumber(ctx sdk.Context) { - activeProposalsNumber := keeper.GetActiveProposalsNumber(ctx) - keeper.SetActiveProposalsNumber(ctx, activeProposalsNumber+1) + activeProposalsNumber := keeper.GetActiveProposalsNumber(ctx) + 1 + keeper.SetActiveProposalsNumber(ctx, activeProposalsNumber) + + currMinDeposit := keeper.GetMinDeposit(ctx) + keeper.SetLastMinDeposit(ctx, currMinDeposit) } // DecrementActiveProposalsNumber decrements the number of active proposals by one func (keeper Keeper) DecrementActiveProposalsNumber(ctx sdk.Context) { - activeProposalsNumber := keeper.GetActiveProposalsNumber(ctx) - keeper.SetActiveProposalsNumber(ctx, activeProposalsNumber-1) + currentActiveProposalsNumber := keeper.GetActiveProposalsNumber(ctx) + if currentActiveProposalsNumber > 0 { + activeProposalsNumber := currentActiveProposalsNumber - 1 + keeper.SetActiveProposalsNumber(ctx, activeProposalsNumber) + } else { + panic("number of active proposals should never be negative") + } + + currMinDeposit := keeper.GetMinDeposit(ctx) + keeper.SetLastMinDeposit(ctx, currMinDeposit) } -// SetLastMinDeposit updates the last min deposit and last min deposit time -// used to record these values the last time the number of active proposals changed -func (keeper Keeper) SetLastMinDeposit(ctx sdk.Context, minDeposit sdk.Coin) { +// SetLastMinDeposit updates the last min deposit and last min deposit time. +// Used to record these values the last time the number of active proposals changed +func (keeper Keeper) SetLastMinDeposit(ctx sdk.Context, minDeposit sdk.Coins) { store := ctx.KVStore(keeper.storeKey) - bz, err := keeper.cdc.Marshal(&minDeposit) - if err != nil { - panic(err) + blockTime := ctx.BlockTime() + lastMinDeposit := v1.LastMinDeposit{ + Value: minDeposit, + Time: &blockTime, } + bz := keeper.cdc.MustMarshal(&lastMinDeposit) store.Set(types.LastMinDepositKey, bz) - - blockTime := ctx.BlockTime() - bz = sdk.FormatTimeBytes(blockTime) - store.Set(types.LastMinDepositTimeKey, bz) } // GetLastMinDeposit returns the last min deposit and the time it was set -func (keeper Keeper) GetLastMinDeposit(ctx sdk.Context) (lastMinDeposit sdk.Coin, lastMinDepositTime time.Time) { +func (keeper Keeper) GetLastMinDeposit(ctx sdk.Context) (sdk.Coins, time.Time) { store := ctx.KVStore(keeper.storeKey) bz := store.Get(types.LastMinDepositKey) if bz == nil { - return sdk.Coin{}, time.Time{} + return sdk.Coins{}, time.Time{} } - err := keeper.cdc.Unmarshal(bz, &lastMinDeposit) - if err != nil { - panic(err) - } - - bz = store.Get(types.LastMinDepositTimeKey) - if bz == nil { - return sdk.Coin{}, time.Time{} - } - lastMinDepositTime, err = sdk.ParseTimeBytes(bz) - if err != nil { - panic(err) - } - return lastMinDeposit, lastMinDepositTime + var lastMinDeposit v1.LastMinDeposit + keeper.cdc.MustUnmarshal(bz, &lastMinDeposit) + return lastMinDeposit.Value, *lastMinDeposit.Time } -// GetCurrentMinDeposit returns the (dynamic) minimum deposit currently required for a proposal -func (keeper Keeper) GetCurrentMinDeposit(ctx sdk.Context) (sdk.Coin, error) { +// GetMinDeposit returns the (dynamic) minimum deposit currently required for a proposal +func (keeper Keeper) GetMinDeposit(ctx sdk.Context) sdk.Coins { params := keeper.GetParams(ctx) - paramMinDeposit := params.MinDeposit[0] + minDepositFloor := sdk.Coins(params.MinDepositFloor) tick := params.MinDepositUpdatePeriod targetActiveProposals := math.NewIntFromUint64(params.TargetActiveProposals) - k := params.TargetPropsDistanceSensitivity - a := math.LegacyZeroDec() + k := params.MinDepositSensitivityTargetDistance b := math.ZeroInt() + var a sdk.Dec numActiveProposals := math.NewIntFromUint64(keeper.GetActiveProposalsNumber(ctx)) if numActiveProposals.GT(targetActiveProposals) { - a = params.DepositIncreaseRatio + a = sdk.MustNewDecFromStr(params.MinDepositIncreaseRatio) } else { - a = params.DepositDecreaseRatio + a = sdk.MustNewDecFromStr(params.MinDepositDecreaseRatio) b = math.OneInt() } - c1, err := numActiveProposals.Sub(targetActiveProposals).Sub(b).Abs().ToLegacyDec().ApproxRoot(k) + c1, err := numActiveProposals.Sub(targetActiveProposals).Sub(b).ToLegacyDec().ApproxRoot(k) if err != nil { - return sdk.Coin{}, err + // in case of error bypass the sensitivity i.e. assume k = 1 + c1 = numActiveProposals.Sub(targetActiveProposals).Sub(b).ToLegacyDec() } c := a.Mul(c1) @@ -108,11 +108,31 @@ func (keeper Keeper) GetCurrentMinDeposit(ctx sdk.Context) (sdk.Coin, error) { // get number of ticks passed since last update ticksPassed := ctx.BlockTime().Sub(lastMinDepositTime).Nanoseconds() / tick.Nanoseconds() - currMinDepositAmt := lastMinDeposit.Amount.ToLegacyDec().Mul(math.LegacyOneDec().Add(c.Power(ticksPassed))).TruncateInt() - currMinDeposit := sdk.NewCoin(paramMinDeposit.Denom, currMinDepositAmt) - if currMinDepositAmt.LT(paramMinDeposit.Amount) { - currMinDeposit.Amount = paramMinDeposit.Amount + minDeposit := sdk.Coins{} + minDepositFloorDenomsSeen := make(map[string]bool) + for _, lastMinDepositCoin := range lastMinDeposit { + minDepositFloorCoinAmt := minDepositFloor.AmountOf(lastMinDepositCoin.Denom) + if minDepositFloorCoinAmt.IsZero() { + // minDepositFloor was changed and this coin was removed, + // reflect this also in the current min deposit, i.e. remove + // this coin + continue + } + minDepositFloorDenomsSeen[lastMinDepositCoin.Denom] = true + minDepositCoinAmt := lastMinDepositCoin.Amount.ToLegacyDec().Mul(math.LegacyOneDec().Add(c.Power(uint64(ticksPassed)))).TruncateInt() + if minDepositCoinAmt.LT(minDepositFloorCoinAmt) { + minDeposit = append(minDeposit, sdk.NewCoin(lastMinDepositCoin.Denom, minDepositFloorCoinAmt)) + } else { + minDeposit = append(minDeposit, sdk.NewCoin(lastMinDepositCoin.Denom, minDepositCoinAmt)) + } + } + + // make sure any new denoms in minDepositFloor are added to minDeposit + for _, minDepositFloorCoin := range minDepositFloor { + if _, seen := minDepositFloorDenomsSeen[minDepositFloorCoin.Denom]; !seen { + minDeposit = append(minDeposit, minDepositFloorCoin) + } } - return currMinDeposit, nil + return minDeposit } diff --git a/x/gov/keeper/params.go b/x/gov/keeper/params.go index b0fc33ca..3ea17199 100644 --- a/x/gov/keeper/params.go +++ b/x/gov/keeper/params.go @@ -9,6 +9,10 @@ import ( // SetParams sets the gov module's parameters. func (k Keeper) SetParams(ctx sdk.Context, params v1.Params) error { + // before params change, trigger an update of the last min deposit + minDeposit := k.GetMinDeposit(ctx) + k.SetLastMinDeposit(ctx, minDeposit) + store := ctx.KVStore(k.storeKey) bz, err := k.cdc.Marshal(¶ms) if err != nil { diff --git a/x/gov/keeper/proposal.go b/x/gov/keeper/proposal.go index 1aee0e6f..416d6240 100644 --- a/x/gov/keeper/proposal.go +++ b/x/gov/keeper/proposal.go @@ -293,6 +293,7 @@ func (keeper Keeper) ActivateVotingPeriod(ctx sdk.Context, proposal v1.Proposal) v1.NewQuorumCheckQueueEntry(quorumTimeoutTime, params.QuorumCheckCount), ) } + keeper.IncrementActiveProposalsNumber(ctx) } // MarshalProposal marshals the proposal and returns binary encoded bytes. diff --git a/x/gov/types/keys.go b/x/gov/types/keys.go index e5ca5f66..cf3bab94 100644 --- a/x/gov/types/keys.go +++ b/x/gov/types/keys.go @@ -47,7 +47,6 @@ var ( QuorumCheckQueuePrefix = []byte{0x05} ActiveProposalsNumberKey = []byte{0x06} LastMinDepositKey = []byte{0x07} - LastMinDepositTimeKey = []byte{0x08} DepositsKeyPrefix = []byte{0x10} @@ -114,6 +113,18 @@ func QuorumCheckQueueKey(proposalID uint64, endTime time.Time) []byte { return append(QuorumCheckByTimeKey(endTime), GetProposalIDBytes(proposalID)...) } +// GetActiveProposalsNumberBytes returns the byte representation of the activeProposalsNumber +func GetActiveProposalsNumberBytes(activeProposalsNumber uint64) (activeProposalsNumberBz []byte) { + activeProposalsNumberBz = make([]byte, 8) + binary.BigEndian.PutUint64(activeProposalsNumberBz, activeProposalsNumber) + return +} + +// GetActiveProposalsNumberFromBytes returns activeProposalsNumber in uint64 format from a byte array +func GetActiveProposalsNumberFromBytes(bz []byte) (activeProposalsNumber uint64) { + return binary.BigEndian.Uint64(bz) +} + // DepositsKey gets the first part of the deposits key based on the proposalID func DepositsKey(proposalID uint64) []byte { return append(DepositsKeyPrefix, GetProposalIDBytes(proposalID)...) @@ -191,15 +202,3 @@ func splitKeyWithAddress(key []byte) (proposalID uint64, addr sdk.AccAddress) { addr = sdk.AccAddress(key[10:]) return } - -// GetActiveProposalsNumberBytes returns the byte representation of the activeProposalsNumber -func GetActiveProposalsNumberBytes(activeProposalsNumber uint64) (activeProposalsNumberBz []byte) { - activeProposalsNumberBz = make([]byte, 8) - binary.BigEndian.PutUint64(activeProposalsNumberBz, activeProposalsNumber) - return -} - -// GetActiveProposalsNumberFromBytes returns activeProposalsNumber in uint64 format from a byte array -func GetActiveProposalsNumberFromBytes(bz []byte) (activeProposalsNumber uint64) { - return binary.BigEndian.Uint64(bz) -} diff --git a/x/gov/types/v1/gov.pb.go b/x/gov/types/v1/gov.pb.go index 4c2182c6..450c9ca1 100644 --- a/x/gov/types/v1/gov.pb.go +++ b/x/gov/types/v1/gov.pb.go @@ -238,6 +238,62 @@ func (m *Deposit) GetAmount() []types.Coin { return nil } +// LastMinDeposit is a record of the last time the minimum deposit +// was updated in the store, both its value and a timestamp +type LastMinDeposit struct { + // value is the value of the minimum deposit + Value []types.Coin `protobuf:"bytes,1,rep,name=value,proto3" json:"value"` + // time is the time the minimum deposit was last updated + Time *time.Time `protobuf:"bytes,2,opt,name=time,proto3,stdtime" json:"time,omitempty"` +} + +func (m *LastMinDeposit) Reset() { *m = LastMinDeposit{} } +func (m *LastMinDeposit) String() string { return proto.CompactTextString(m) } +func (*LastMinDeposit) ProtoMessage() {} +func (*LastMinDeposit) Descriptor() ([]byte, []int) { + return fileDescriptor_ecf0f9950ff6986c, []int{2} +} +func (m *LastMinDeposit) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *LastMinDeposit) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_LastMinDeposit.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 *LastMinDeposit) XXX_Merge(src proto.Message) { + xxx_messageInfo_LastMinDeposit.Merge(m, src) +} +func (m *LastMinDeposit) XXX_Size() int { + return m.Size() +} +func (m *LastMinDeposit) XXX_DiscardUnknown() { + xxx_messageInfo_LastMinDeposit.DiscardUnknown(m) +} + +var xxx_messageInfo_LastMinDeposit proto.InternalMessageInfo + +func (m *LastMinDeposit) GetValue() []types.Coin { + if m != nil { + return m.Value + } + return nil +} + +func (m *LastMinDeposit) GetTime() *time.Time { + if m != nil { + return m.Time + } + return nil +} + // Proposal defines the core field members of a governance proposal. type Proposal struct { // id defines the unique id of the proposal. @@ -280,7 +336,7 @@ func (m *Proposal) Reset() { *m = Proposal{} } func (m *Proposal) String() string { return proto.CompactTextString(m) } func (*Proposal) ProtoMessage() {} func (*Proposal) Descriptor() ([]byte, []int) { - return fileDescriptor_ecf0f9950ff6986c, []int{2} + return fileDescriptor_ecf0f9950ff6986c, []int{3} } func (m *Proposal) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -414,7 +470,7 @@ func (m *TallyResult) Reset() { *m = TallyResult{} } func (m *TallyResult) String() string { return proto.CompactTextString(m) } func (*TallyResult) ProtoMessage() {} func (*TallyResult) Descriptor() ([]byte, []int) { - return fileDescriptor_ecf0f9950ff6986c, []int{3} + return fileDescriptor_ecf0f9950ff6986c, []int{4} } func (m *TallyResult) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -481,7 +537,7 @@ func (m *Vote) Reset() { *m = Vote{} } func (m *Vote) String() string { return proto.CompactTextString(m) } func (*Vote) ProtoMessage() {} func (*Vote) Descriptor() ([]byte, []int) { - return fileDescriptor_ecf0f9950ff6986c, []int{4} + return fileDescriptor_ecf0f9950ff6986c, []int{5} } func (m *Vote) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -555,7 +611,7 @@ func (m *QuorumCheckQueueEntry) Reset() { *m = QuorumCheckQueueEntry{} } func (m *QuorumCheckQueueEntry) String() string { return proto.CompactTextString(m) } func (*QuorumCheckQueueEntry) ProtoMessage() {} func (*QuorumCheckQueueEntry) Descriptor() ([]byte, []int) { - return fileDescriptor_ecf0f9950ff6986c, []int{5} + return fileDescriptor_ecf0f9950ff6986c, []int{6} } func (m *QuorumCheckQueueEntry) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -618,7 +674,7 @@ func (m *DepositParams) Reset() { *m = DepositParams{} } func (m *DepositParams) String() string { return proto.CompactTextString(m) } func (*DepositParams) ProtoMessage() {} func (*DepositParams) Descriptor() ([]byte, []int) { - return fileDescriptor_ecf0f9950ff6986c, []int{6} + return fileDescriptor_ecf0f9950ff6986c, []int{7} } func (m *DepositParams) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -671,7 +727,7 @@ func (m *VotingParams) Reset() { *m = VotingParams{} } func (m *VotingParams) String() string { return proto.CompactTextString(m) } func (*VotingParams) ProtoMessage() {} func (*VotingParams) Descriptor() ([]byte, []int) { - return fileDescriptor_ecf0f9950ff6986c, []int{7} + return fileDescriptor_ecf0f9950ff6986c, []int{8} } func (m *VotingParams) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -728,7 +784,7 @@ func (m *TallyParams) Reset() { *m = TallyParams{} } func (m *TallyParams) String() string { return proto.CompactTextString(m) } func (*TallyParams) ProtoMessage() {} func (*TallyParams) Descriptor() ([]byte, []int) { - return fileDescriptor_ecf0f9950ff6986c, []int{8} + return fileDescriptor_ecf0f9950ff6986c, []int{9} } func (m *TallyParams) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -804,7 +860,9 @@ func (m *TallyParams) GetLawThreshold() string { // Since: cosmos-sdk 0.47 type Params struct { // Minimum deposit for a proposal to enter voting period. - MinDeposit []types.Coin `protobuf:"bytes,1,rep,name=min_deposit,json=minDeposit,proto3" json:"min_deposit"` + // Deprecated: a dynamic system now determines the minimum deposit, + // min_deposit_floor + MinDeposit []types.Coin `protobuf:"bytes,1,rep,name=min_deposit,json=minDeposit,proto3" json:"min_deposit"` // Deprecated: Do not use. // Maximum period for Atom holders to deposit on a proposal. Initial value: 2 // months. MaxDepositPeriod *time.Duration `protobuf:"bytes,2,opt,name=max_deposit_period,json=maxDepositPeriod,proto3,stdduration" json:"max_deposit_period,omitempty"` @@ -846,13 +904,31 @@ type Params struct { // Number of times a proposal should be checked for quorum after the quorum timeout // has elapsed. Used to compute the amount of time in between quorum checks. QuorumCheckCount uint64 `protobuf:"varint,22,opt,name=quorum_check_count,json=quorumCheckCount,proto3" json:"quorum_check_count,omitempty"` + // Floor value for the minimum deposit required for a proposal to enter the voting period. + MinDepositFloor []types.Coin `protobuf:"bytes,23,rep,name=min_deposit_floor,json=minDepositFloor,proto3" json:"min_deposit_floor"` + // Duration that dictates after how long the dynamic minimum deposit should be recalculated + // for time-based updates. + MinDepositUpdatePeriod *time.Duration `protobuf:"bytes,24,opt,name=min_deposit_update_period,json=minDepositUpdatePeriod,proto3,stdduration" json:"min_deposit_update_period,omitempty"` + // The number of active proposals the dynamic minimum deposit should target. + TargetActiveProposals uint64 `protobuf:"varint,25,opt,name=target_active_proposals,json=targetActiveProposals,proto3" json:"target_active_proposals,omitempty"` + // The ratio of increase for the minimum deposit when the number of active proposals + // exceeds the target by 1. + MinDepositIncreaseRatio string `protobuf:"bytes,26,opt,name=min_deposit_increase_ratio,json=minDepositIncreaseRatio,proto3" json:"min_deposit_increase_ratio,omitempty"` + // The ratio of decrease for the minimum deposit when the number of active proposals + // is equal to the target. + MinDepositDecreaseRatio string `protobuf:"bytes,27,opt,name=min_deposit_decrease_ratio,json=minDepositDecreaseRatio,proto3" json:"min_deposit_decrease_ratio,omitempty"` + // A positive integer representing the sensitivity of the dynamic minimum deposit + // increase/decrease to the distance from the target number of active proposals. + // The higher the number, the lower the sensitivity. A value of 1 represents the + // highest sensitivity. + MinDepositSensitivityTargetDistance uint64 `protobuf:"varint,28,opt,name=min_deposit_sensitivity_target_distance,json=minDepositSensitivityTargetDistance,proto3" json:"min_deposit_sensitivity_target_distance,omitempty"` } func (m *Params) Reset() { *m = Params{} } func (m *Params) String() string { return proto.CompactTextString(m) } func (*Params) ProtoMessage() {} func (*Params) Descriptor() ([]byte, []int) { - return fileDescriptor_ecf0f9950ff6986c, []int{9} + return fileDescriptor_ecf0f9950ff6986c, []int{10} } func (m *Params) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -881,6 +957,7 @@ func (m *Params) XXX_DiscardUnknown() { var xxx_messageInfo_Params proto.InternalMessageInfo +// Deprecated: Do not use. func (m *Params) GetMinDeposit() []types.Coin { if m != nil { return m.MinDeposit @@ -993,11 +1070,54 @@ func (m *Params) GetQuorumCheckCount() uint64 { return 0 } +func (m *Params) GetMinDepositFloor() []types.Coin { + if m != nil { + return m.MinDepositFloor + } + return nil +} + +func (m *Params) GetMinDepositUpdatePeriod() *time.Duration { + if m != nil { + return m.MinDepositUpdatePeriod + } + return nil +} + +func (m *Params) GetTargetActiveProposals() uint64 { + if m != nil { + return m.TargetActiveProposals + } + return 0 +} + +func (m *Params) GetMinDepositIncreaseRatio() string { + if m != nil { + return m.MinDepositIncreaseRatio + } + return "" +} + +func (m *Params) GetMinDepositDecreaseRatio() string { + if m != nil { + return m.MinDepositDecreaseRatio + } + return "" +} + +func (m *Params) GetMinDepositSensitivityTargetDistance() uint64 { + if m != nil { + return m.MinDepositSensitivityTargetDistance + } + return 0 +} + func init() { proto.RegisterEnum("atomone.gov.v1.VoteOption", VoteOption_name, VoteOption_value) proto.RegisterEnum("atomone.gov.v1.ProposalStatus", ProposalStatus_name, ProposalStatus_value) proto.RegisterType((*WeightedVoteOption)(nil), "atomone.gov.v1.WeightedVoteOption") proto.RegisterType((*Deposit)(nil), "atomone.gov.v1.Deposit") + proto.RegisterType((*LastMinDeposit)(nil), "atomone.gov.v1.LastMinDeposit") proto.RegisterType((*Proposal)(nil), "atomone.gov.v1.Proposal") proto.RegisterType((*TallyResult)(nil), "atomone.gov.v1.TallyResult") proto.RegisterType((*Vote)(nil), "atomone.gov.v1.Vote") @@ -1011,98 +1131,109 @@ func init() { func init() { proto.RegisterFile("atomone/gov/v1/gov.proto", fileDescriptor_ecf0f9950ff6986c) } var fileDescriptor_ecf0f9950ff6986c = []byte{ - // 1447 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x57, 0xbf, 0x6f, 0xdb, 0x46, - 0x14, 0x36, 0xf5, 0xcb, 0xf2, 0xb3, 0x2d, 0xd3, 0x67, 0x27, 0xa1, 0xed, 0x58, 0x76, 0x85, 0x22, - 0x70, 0xd3, 0x58, 0xaa, 0x9d, 0x22, 0x43, 0x91, 0x45, 0xb6, 0x98, 0x54, 0x41, 0x6a, 0x29, 0x94, - 0xe2, 0x36, 0x1d, 0x4a, 0x9c, 0xc4, 0x8b, 0x4c, 0x44, 0xe4, 0x29, 0xe4, 0xd1, 0xb6, 0xfe, 0x8b, - 0x4c, 0x45, 0xd1, 0xa9, 0x63, 0xc7, 0x0e, 0x01, 0xfa, 0x07, 0x14,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 0x38, 0xba, 0x0c, 0xda, 0xa8, 0xcd, 0xd0, 0xef, 0xe8, 0xfb, 0x75, - 0xbd, 0xa4, 0x26, 0xc6, 0x31, 0x6f, 0x15, 0xcb, 0x77, 0xf5, 0x92, 0x9a, 0xdc, 0xbb, 0xfd, 0xec, - 0x55, 0x56, 0x79, 0xfe, 0x2a, 0xab, 0xfc, 0xf5, 0x2a, 0xab, 0x3c, 0x79, 0x9d, 0x9d, 0x7a, 0xfe, - 0x3a, 0x3b, 0xf5, 0xfb, 0xeb, 0xec, 0xd4, 0xd7, 0xdb, 0x2d, 0x9b, 0x1d, 0x05, 0x8d, 0x7c, 0x93, - 0x3a, 0x05, 0xf9, 0xdb, 0x69, 0xfb, 0x28, 0x68, 0x44, 0xcf, 0x85, 0x53, 0xf1, 0x5d, 0xcc, 0xba, - 0x1d, 0xe2, 0xf3, 0x6f, 0xde, 0x94, 0xe8, 0xf3, 0xf5, 0x7f, 0x03, 0x00, 0x00, 0xff, 0xff, 0x62, - 0x28, 0x2b, 0x9a, 0x36, 0x0f, 0x00, 0x00, + // 1629 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x58, 0xbf, 0x6f, 0x1b, 0xc9, + 0x15, 0xd6, 0xf2, 0x97, 0xa8, 0x47, 0x89, 0xa2, 0x46, 0xbf, 0x56, 0x94, 0x45, 0x29, 0x4c, 0x70, + 0x51, 0x1c, 0x8b, 0x8c, 0xe4, 0x83, 0x8b, 0xc3, 0x35, 0x94, 0x48, 0x39, 0x74, 0x74, 0x22, 0x6f, + 0x49, 0x2b, 0xb9, 0x2b, 0xb2, 0x18, 0x72, 0xc7, 0xd4, 0xe2, 0xb8, 0x3b, 0xbc, 0x9d, 0x59, 0x4a, + 0x6c, 0xf3, 0x17, 0x5c, 0x19, 0xa4, 0x4a, 0x99, 0x32, 0xc5, 0x01, 0xf9, 0x03, 0x82, 0x00, 0x57, + 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0xee, 0x4f, 0xc4, 0x34, + 0xd0, 0xcf, 0x20, 0x69, 0x11, 0xc6, 0x70, 0x87, 0x30, 0x35, 0x22, 0x22, 0xda, 0xb8, 0x23, 0x5b, + 0xb2, 0x07, 0xda, 0x10, 0x85, 0x9e, 0x41, 0x82, 0x71, 0xcc, 0x5d, 0xa6, 0x46, 0x45, 0x49, 0x73, + 0x93, 0x25, 0x0d, 0x7c, 0x35, 0x04, 0x4a, 0x93, 0x68, 0x54, 0x05, 0xf4, 0xca, 0xb4, 0x71, 0x57, + 0xe7, 0xb8, 0xdb, 0x1d, 0xe8, 0x0e, 0x61, 0x6e, 0x97, 0xab, 0x31, 0x91, 0xca, 0xee, 0xa4, 0x46, + 0xd3, 0xc3, 0x68, 0x02, 0xa2, 0x65, 0x04, 0x2d, 0xb4, 0x82, 0x4a, 0x90, 0x62, 0x6e, 0xcb, 0x32, + 0xb9, 0x2e, 0xb6, 0x23, 0x3e, 0xe7, 0x76, 0x80, 0x4f, 0xf2, 0x96, 0xd1, 0x0b, 0xc8, 0xc8, 0x22, + 0xeb, 0xc4, 0x36, 0x7c, 0x9d, 0xc4, 0x9c, 0x3a, 0x69, 0xc9, 0xac, 0xd8, 0x86, 0xd0, 0xaa, 0xc2, + 0x0a, 0xa7, 0x1c, 0x77, 0x75, 0xb9, 0xae, 0x2e, 0x3e, 0xa0, 0xb4, 0xcb, 0x82, 0x1a, 0x74, 0xc7, + 0x05, 0xac, 0xf5, 0x29, 0x37, 0xed, 0x8e, 0xce, 0x38, 0x76, 0x64, 0x7e, 0xc9, 0x39, 0xe3, 0x5a, + 0xf5, 0xa9, 0x0d, 0x8f, 0x29, 0x02, 0xfb, 0x39, 0xc8, 0xa5, 0x51, 0x8e, 0x4b, 0x73, 0x6a, 0xad, + 0xf8, 0xc4, 0x20, 0xc5, 0xac, 0xd7, 0x26, 0x1c, 0x1b, 0x98, 0x63, 0x15, 0xbc, 0xe9, 0xd1, 0x86, + 0xef, 0x68, 0x03, 0xe2,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a8, 0x9c, 0x35, 0x2b, 0xe5, 0x4c, 0x6c, 0x1a, 0xf3, 0xbc, 0x54, 0xbd, 0xa8, 0x94, 0x33, 0xf1, + 0xd3, 0xe7, 0xdf, 0xbd, 0xcd, 0x29, 0xdf, 0xbf, 0xcd, 0x29, 0xff, 0x7c, 0x9b, 0x53, 0xbe, 0x79, + 0x97, 0x5b, 0xf8, 0xfe, 0x5d, 0x6e, 0xe1, 0x6f, 0xef, 0x72, 0x0b, 0x5f, 0x1e, 0x75, 0x4c, 0x7e, + 0xed, 0xb6, 0x0a, 0x6d, 0x6a, 0x15, 0xe5, 0x6f, 0xe2, 0xa3, 0x6b, 0xb7, 0x15, 0x3c, 0x17, 0x6f, + 0xc5, 0x1f, 0x5d, 0xf8, 0xa0, 0x47, 0x58, 0xb1, 0x7f, 0xdc, 0x4a, 0x88, 0xfe, 0x7e, 0xfa, 0xdf, + 0x00, 0x00, 0x00, 0xff, 0xff, 0x0a, 0x41, 0x04, 0x82, 0x93, 0x11, 0x00, 0x00, } func (m *WeightedVoteOption) Marshal() (dAtA []byte, err error) { @@ -1189,6 +1320,53 @@ func (m *Deposit) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *LastMinDeposit) 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 *LastMinDeposit) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *LastMinDeposit) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Time != nil { + n1, err1 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(*m.Time, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(*m.Time):]) + if err1 != nil { + return 0, err1 + } + i -= n1 + i = encodeVarintGov(dAtA, i, uint64(n1)) + i-- + dAtA[i] = 0x12 + } + if len(m.Value) > 0 { + for iNdEx := len(m.Value) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Value[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGov(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + func (m *Proposal) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -1238,22 +1416,22 @@ func (m *Proposal) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0x52 } if m.VotingEndTime != nil { - n1, err1 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(*m.VotingEndTime, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(*m.VotingEndTime):]) - if err1 != nil { - return 0, err1 + n2, err2 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(*m.VotingEndTime, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(*m.VotingEndTime):]) + if err2 != nil { + return 0, err2 } - i -= n1 - i = encodeVarintGov(dAtA, i, uint64(n1)) + i -= n2 + i = encodeVarintGov(dAtA, i, uint64(n2)) i-- dAtA[i] = 0x4a } if m.VotingStartTime != nil { - n2, err2 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(*m.VotingStartTime, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(*m.VotingStartTime):]) - if err2 != nil { - return 0, err2 + n3, err3 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(*m.VotingStartTime, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(*m.VotingStartTime):]) + if err3 != nil { + return 0, err3 } - i -= n2 - i = encodeVarintGov(dAtA, i, uint64(n2)) + i -= n3 + i = encodeVarintGov(dAtA, i, uint64(n3)) i-- dAtA[i] = 0x42 } @@ -1272,22 +1450,22 @@ func (m *Proposal) MarshalToSizedBuffer(dAtA []byte) (int, error) { } } if m.DepositEndTime != nil { - n3, err3 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(*m.DepositEndTime, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(*m.DepositEndTime):]) - if err3 != nil { - return 0, err3 + n4, err4 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(*m.DepositEndTime, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(*m.DepositEndTime):]) + if err4 != nil { + return 0, err4 } - i -= n3 - i = encodeVarintGov(dAtA, i, uint64(n3)) + i -= n4 + i = encodeVarintGov(dAtA, i, uint64(n4)) i-- dAtA[i] = 0x32 } if m.SubmitTime != nil { - n4, err4 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(*m.SubmitTime, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(*m.SubmitTime):]) - if err4 != nil { - return 0, err4 + n5, err5 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(*m.SubmitTime, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(*m.SubmitTime):]) + if err5 != nil { + return 0, err5 } - i -= n4 - i = encodeVarintGov(dAtA, i, uint64(n4)) + i -= n5 + i = encodeVarintGov(dAtA, i, uint64(n5)) i-- dAtA[i] = 0x2a } @@ -1461,12 +1639,12 @@ func (m *QuorumCheckQueueEntry) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0x10 } if m.QuorumTimeoutTime != nil { - n6, err6 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(*m.QuorumTimeoutTime, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(*m.QuorumTimeoutTime):]) - if err6 != nil { - return 0, err6 + n7, err7 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(*m.QuorumTimeoutTime, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(*m.QuorumTimeoutTime):]) + if err7 != nil { + return 0, err7 } - i -= n6 - i = encodeVarintGov(dAtA, i, uint64(n6)) + i -= n7 + i = encodeVarintGov(dAtA, i, uint64(n7)) i-- dAtA[i] = 0xa } @@ -1494,12 +1672,12 @@ func (m *DepositParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { var l int _ = l if m.MaxDepositPeriod != nil { - n7, err7 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(*m.MaxDepositPeriod, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(*m.MaxDepositPeriod):]) - if err7 != nil { - return 0, err7 + n8, err8 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(*m.MaxDepositPeriod, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(*m.MaxDepositPeriod):]) + if err8 != nil { + return 0, err8 } - i -= n7 - i = encodeVarintGov(dAtA, i, uint64(n7)) + i -= n8 + i = encodeVarintGov(dAtA, i, uint64(n8)) i-- dAtA[i] = 0x12 } @@ -1541,12 +1719,12 @@ func (m *VotingParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { var l int _ = l if m.VotingPeriod != nil { - n8, err8 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(*m.VotingPeriod, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(*m.VotingPeriod):]) - if err8 != nil { - return 0, err8 + n9, err9 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(*m.VotingPeriod, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(*m.VotingPeriod):]) + if err9 != nil { + return 0, err9 } - i -= n8 - i = encodeVarintGov(dAtA, i, uint64(n8)) + i -= n9 + i = encodeVarintGov(dAtA, i, uint64(n9)) i-- dAtA[i] = 0xa } @@ -1638,6 +1816,66 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.MinDepositSensitivityTargetDistance != 0 { + i = encodeVarintGov(dAtA, i, uint64(m.MinDepositSensitivityTargetDistance)) + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0xe0 + } + if len(m.MinDepositDecreaseRatio) > 0 { + i -= len(m.MinDepositDecreaseRatio) + copy(dAtA[i:], m.MinDepositDecreaseRatio) + i = encodeVarintGov(dAtA, i, uint64(len(m.MinDepositDecreaseRatio))) + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0xda + } + if len(m.MinDepositIncreaseRatio) > 0 { + i -= len(m.MinDepositIncreaseRatio) + copy(dAtA[i:], m.MinDepositIncreaseRatio) + i = encodeVarintGov(dAtA, i, uint64(len(m.MinDepositIncreaseRatio))) + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0xd2 + } + if m.TargetActiveProposals != 0 { + i = encodeVarintGov(dAtA, i, uint64(m.TargetActiveProposals)) + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0xc8 + } + if m.MinDepositUpdatePeriod != nil { + n10, err10 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(*m.MinDepositUpdatePeriod, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(*m.MinDepositUpdatePeriod):]) + if err10 != nil { + return 0, err10 + } + i -= n10 + i = encodeVarintGov(dAtA, i, uint64(n10)) + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0xc2 + } + if len(m.MinDepositFloor) > 0 { + for iNdEx := len(m.MinDepositFloor) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.MinDepositFloor[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGov(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0xba + } + } if m.QuorumCheckCount != 0 { i = encodeVarintGov(dAtA, i, uint64(m.QuorumCheckCount)) i-- @@ -1646,24 +1884,24 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0xb0 } if m.MaxVotingPeriodExtension != nil { - n9, err9 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(*m.MaxVotingPeriodExtension, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(*m.MaxVotingPeriodExtension):]) - if err9 != nil { - return 0, err9 + n11, err11 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(*m.MaxVotingPeriodExtension, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(*m.MaxVotingPeriodExtension):]) + if err11 != nil { + return 0, err11 } - i -= n9 - i = encodeVarintGov(dAtA, i, uint64(n9)) + i -= n11 + i = encodeVarintGov(dAtA, i, uint64(n11)) i-- dAtA[i] = 0x1 i-- dAtA[i] = 0xaa } if m.QuorumTimeout != nil { - n10, err10 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(*m.QuorumTimeout, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(*m.QuorumTimeout):]) - if err10 != nil { - return 0, err10 + n12, err12 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(*m.QuorumTimeout, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(*m.QuorumTimeout):]) + if err12 != nil { + return 0, err12 } - i -= n10 - i = encodeVarintGov(dAtA, i, uint64(n10)) + i -= n12 + i = encodeVarintGov(dAtA, i, uint64(n12)) i-- dAtA[i] = 0x1 i-- @@ -1754,22 +1992,22 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0x22 } if m.VotingPeriod != nil { - n11, err11 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(*m.VotingPeriod, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(*m.VotingPeriod):]) - if err11 != nil { - return 0, err11 + n13, err13 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(*m.VotingPeriod, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(*m.VotingPeriod):]) + if err13 != nil { + return 0, err13 } - i -= n11 - i = encodeVarintGov(dAtA, i, uint64(n11)) + i -= n13 + i = encodeVarintGov(dAtA, i, uint64(n13)) i-- dAtA[i] = 0x1a } if m.MaxDepositPeriod != nil { - n12, err12 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(*m.MaxDepositPeriod, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(*m.MaxDepositPeriod):]) - if err12 != nil { - return 0, err12 + n14, err14 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(*m.MaxDepositPeriod, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(*m.MaxDepositPeriod):]) + if err14 != nil { + return 0, err14 } - i -= n12 - i = encodeVarintGov(dAtA, i, uint64(n12)) + i -= n14 + i = encodeVarintGov(dAtA, i, uint64(n14)) i-- dAtA[i] = 0x12 } @@ -1839,6 +2077,25 @@ func (m *Deposit) Size() (n int) { return n } +func (m *LastMinDeposit) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Value) > 0 { + for _, e := range m.Value { + l = e.Size() + n += 1 + l + sovGov(uint64(l)) + } + } + if m.Time != nil { + l = github_com_cosmos_gogoproto_types.SizeOfStdTime(*m.Time) + n += 1 + l + sovGov(uint64(l)) + } + return n +} + func (m *Proposal) Size() (n int) { if m == nil { return 0 @@ -2102,6 +2359,30 @@ func (m *Params) Size() (n int) { if m.QuorumCheckCount != 0 { n += 2 + sovGov(uint64(m.QuorumCheckCount)) } + if len(m.MinDepositFloor) > 0 { + for _, e := range m.MinDepositFloor { + l = e.Size() + n += 2 + l + sovGov(uint64(l)) + } + } + if m.MinDepositUpdatePeriod != nil { + l = github_com_cosmos_gogoproto_types.SizeOfStdDuration(*m.MinDepositUpdatePeriod) + n += 2 + l + sovGov(uint64(l)) + } + if m.TargetActiveProposals != 0 { + n += 2 + sovGov(uint64(m.TargetActiveProposals)) + } + l = len(m.MinDepositIncreaseRatio) + if l > 0 { + n += 2 + l + sovGov(uint64(l)) + } + l = len(m.MinDepositDecreaseRatio) + if l > 0 { + n += 2 + l + sovGov(uint64(l)) + } + if m.MinDepositSensitivityTargetDistance != 0 { + n += 2 + sovGov(uint64(m.MinDepositSensitivityTargetDistance)) + } return n } @@ -2347,6 +2628,126 @@ func (m *Deposit) Unmarshal(dAtA []byte) error { } return nil } +func (m *LastMinDeposit) 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 ErrIntOverflowGov + } + 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: LastMinDeposit: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: LastMinDeposit: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Value = append(m.Value, types.Coin{}) + if err := m.Value[len(m.Value)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Time", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Time == nil { + m.Time = new(time.Time) + } + if err := github_com_cosmos_gogoproto_types.StdTimeUnmarshal(m.Time, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGov(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGov + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *Proposal) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -4218,6 +4619,178 @@ func (m *Params) Unmarshal(dAtA []byte) error { break } } + case 23: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MinDepositFloor", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.MinDepositFloor = append(m.MinDepositFloor, types.Coin{}) + if err := m.MinDepositFloor[len(m.MinDepositFloor)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 24: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MinDepositUpdatePeriod", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.MinDepositUpdatePeriod == nil { + m.MinDepositUpdatePeriod = new(time.Duration) + } + if err := github_com_cosmos_gogoproto_types.StdDurationUnmarshal(m.MinDepositUpdatePeriod, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 25: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TargetActiveProposals", wireType) + } + m.TargetActiveProposals = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.TargetActiveProposals |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 26: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MinDepositIncreaseRatio", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + 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 ErrInvalidLengthGov + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.MinDepositIncreaseRatio = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 27: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MinDepositDecreaseRatio", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + 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 ErrInvalidLengthGov + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.MinDepositDecreaseRatio = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 28: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MinDepositSensitivityTargetDistance", wireType) + } + m.MinDepositSensitivityTargetDistance = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MinDepositSensitivityTargetDistance |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := skipGov(dAtA[iNdEx:]) From a305b76504d5da143f0db7ce45dffc3a0ae9e701 Mon Sep 17 00:00:00 2001 From: Giuseppe Natale <12249307+giunatale@users.noreply.github.com> Date: Tue, 3 Dec 2024 13:57:37 +0100 Subject: [PATCH 04/29] add ways to activate proposals when deposit decreases --- proto/atomone/gov/v1/gov.proto | 2 +- tests/e2e/genesis_test.go | 4 +++- x/gov/abci.go | 10 +++++++++- x/gov/abci_test.go | 2 +- x/gov/keeper/deposit.go | 18 +++++++++++++----- x/gov/keeper/grpc_query.go | 1 + x/gov/simulation/operations.go | 2 +- x/gov/types/v1/params.go | 13 +++++++------ 8 files changed, 36 insertions(+), 16 deletions(-) diff --git a/proto/atomone/gov/v1/gov.proto b/proto/atomone/gov/v1/gov.proto index 4e1fbfb1..fd4c20c5 100644 --- a/proto/atomone/gov/v1/gov.proto +++ b/proto/atomone/gov/v1/gov.proto @@ -225,7 +225,7 @@ message TallyParams { message Params { // Minimum deposit for a proposal to enter voting period. // Deprecated: a dynamic system now determines the minimum deposit, - // min_deposit_floor + // min_deposit_floor. Setting this value has no effect. repeated cosmos.base.v1beta1.Coin min_deposit = 1 [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true, deprecated = true ]; diff --git a/tests/e2e/genesis_test.go b/tests/e2e/genesis_test.go index 3348cddb..e9b25030 100644 --- a/tests/e2e/genesis_test.go +++ b/tests/e2e/genesis_test.go @@ -176,6 +176,7 @@ func modifyGenesis(path, moniker, amountStr string, addrAll []sdk.AccAddress, de appState[minttypes.ModuleName] = mintGenStateBz // Refactor to separate method + // amnt := sdk.NewInt(10000) quorum, _ := sdk.NewDecFromStr("0.000000000000000001") threshold, _ := sdk.NewDecFromStr("0.000000000000000001") lawQuorum, _ := sdk.NewDecFromStr("0.000000000000000001") @@ -188,7 +189,8 @@ func modifyGenesis(path, moniker, amountStr string, addrAll []sdk.AccAddress, de govGenState := govv1.NewGenesisState(1, govv1.NewParams( - sdk.NewCoins(depositAmount), maxDepositPeriod, + // sdk.NewCoins(sdk.NewCoin(denom, amnt)), + maxDepositPeriod, votingPeriod, quorum.String(), threshold.String(), amendmentsQuorum.String(), amendmentsThreshold.String(), lawQuorum.String(), lawThreshold.String(), diff --git a/x/gov/abci.go b/x/gov/abci.go index 9dcf78ed..f47a4b4e 100644 --- a/x/gov/abci.go +++ b/x/gov/abci.go @@ -22,6 +22,14 @@ func EndBlocker(ctx sdk.Context, keeper *keeper.Keeper) { // delete dead proposals from store and returns theirs deposits. // A proposal is dead when it's inactive and didn't get enough deposit on time to get into voting phase. keeper.IterateInactiveProposalsQueue(ctx, ctx.BlockHeader().Time, func(proposal v1.Proposal) bool { + // before deleting, check one last time if the proposal has enough deposits to get into voting phase, + // maybe because min deposit decreased in the meantime. + minDeposit := keeper.GetMinDeposit(ctx) + if proposal.Status == v1.StatusDepositPeriod && sdk.NewCoins(proposal.TotalDeposit...).IsAllGTE(minDeposit) { + keeper.ActivateVotingPeriod(ctx, proposal) + return false + } + keeper.DeleteProposal(ctx, proposal.Id) params := keeper.GetParams(ctx) @@ -45,7 +53,7 @@ func EndBlocker(ctx sdk.Context, keeper *keeper.Keeper) { logger.Info( "proposal did not meet minimum deposit; deleted", "proposal", proposal.Id, - "min_deposit", sdk.NewCoins(params.MinDeposit...).String(), + "min_deposit", sdk.NewCoins(minDeposit...).String(), "total_deposit", sdk.NewCoins(proposal.TotalDeposit...).String(), ) diff --git a/x/gov/abci_test.go b/x/gov/abci_test.go index 6f7da033..78d44996 100644 --- a/x/gov/abci_test.go +++ b/x/gov/abci_test.go @@ -483,7 +483,7 @@ func TestEndBlockerQuorumCheck(t *testing.T) { require.NoError(t, err) require.NotNil(t, res) // Activate proposal - newDepositMsg := v1.NewMsgDeposit(addrs[1], res.ProposalId, params.MinDeposit) + newDepositMsg := v1.NewMsgDeposit(addrs[1], res.ProposalId, suite.GovKeeper.GetMinDeposit(ctx)) res1, err := govMsgSvr.Deposit(ctx, newDepositMsg) require.NoError(t, err) require.NotNil(t, res1) diff --git a/x/gov/keeper/deposit.go b/x/gov/keeper/deposit.go index 450487b3..dec086d1 100644 --- a/x/gov/keeper/deposit.go +++ b/x/gov/keeper/deposit.go @@ -122,12 +122,20 @@ func (keeper Keeper) AddDeposit(ctx sdk.Context, proposalID uint64, depositorAdd return false, sdkerrors.Wrapf(types.ErrInactiveProposal, "%d", proposalID) } + skipMinDepositRatioCheck := false + minDeposit := keeper.GetMinDeposit(ctx) + // Check if deposit has already sufficient total funds to transition the proposal into the voting period + // perhaps because the min deposit was lowered in the meantime. If so, the minDepositRatio check is skipped, + // the user is using this message to trigger activation for a proposal already meeting the minimum deposit. + if proposal.Status == v1.StatusDepositPeriod && sdk.NewCoins(proposal.TotalDeposit...).IsAllGTE(minDeposit) { + skipMinDepositRatioCheck = true + } + // Check coins to be deposited match the proposal's deposit params params := keeper.GetParams(ctx) // NOTE: backported from v50 // v47 does not have expedited proposals so we always use params.MinDeposit - minDepositAmount := params.MinDeposit minDepositRatio, err := sdk.NewDecFromStr(params.GetMinDepositRatio()) if err != nil { return false, err @@ -135,12 +143,12 @@ func (keeper Keeper) AddDeposit(ctx sdk.Context, proposalID uint64, depositorAdd // If minDepositRatio is set, the deposit must be equal or greater than minDepositAmount*minDepositRatio // for at least one denom. If minDepositRatio is zero we skip this check. - if !minDepositRatio.IsZero() { + if !minDepositRatio.IsZero() || !skipMinDepositRatioCheck { var ( depositThresholdMet bool thresholds []string ) - for _, minDep := range minDepositAmount { + for _, minDep := range minDeposit { // calculate the threshold for this denom, and hold a list to later return a useful error message threshold := sdk.NewCoin(minDep.GetDenom(), minDep.Amount.ToLegacyDec().Mul(minDepositRatio).TruncateInt()) thresholds = append(thresholds, threshold.String()) @@ -177,7 +185,7 @@ func (keeper Keeper) AddDeposit(ctx sdk.Context, proposalID uint64, depositorAdd // Check if deposit has provided sufficient total funds to transition the proposal into the voting period activatedVotingPeriod := false - if proposal.Status == v1.StatusDepositPeriod && sdk.NewCoins(proposal.TotalDeposit...).IsAllGTE(keeper.GetParams(ctx).MinDeposit) { + if proposal.Status == v1.StatusDepositPeriod && sdk.NewCoins(proposal.TotalDeposit...).IsAllGTE(minDeposit) { keeper.ActivateVotingPeriod(ctx, proposal) activatedVotingPeriod = true @@ -241,7 +249,7 @@ func (keeper Keeper) validateInitialDeposit(ctx sdk.Context, initialDeposit sdk. if minInitialDepositRatio.IsZero() { return nil } - minDepositCoins := params.MinDeposit + minDepositCoins := keeper.GetMinDeposit(ctx) for i := range minDepositCoins { minDepositCoins[i].Amount = sdk.NewDecFromInt(minDepositCoins[i].Amount).Mul(minInitialDepositRatio).RoundInt() } diff --git a/x/gov/keeper/grpc_query.go b/x/gov/keeper/grpc_query.go index 6290d681..805913a8 100644 --- a/x/gov/keeper/grpc_query.go +++ b/x/gov/keeper/grpc_query.go @@ -167,6 +167,7 @@ func (q Keeper) Params(c context.Context, req *v1.QueryParamsRequest) (*v1.Query ctx := sdk.UnwrapSDKContext(c) params := q.GetParams(ctx) + params.MinDeposit = q.GetMinDeposit(ctx) response := &v1.QueryParamsResponse{} diff --git a/x/gov/simulation/operations.go b/x/gov/simulation/operations.go index 66bc9997..62755232 100644 --- a/x/gov/simulation/operations.go +++ b/x/gov/simulation/operations.go @@ -443,7 +443,7 @@ func randomDeposit( } params := k.GetParams(ctx) - minDeposit := params.MinDeposit + minDeposit := k.GetMinDeposit(ctx) denomIndex := r.Intn(len(minDeposit)) denom := minDeposit[denomIndex].Denom diff --git a/x/gov/types/v1/params.go b/x/gov/types/v1/params.go index 9539e091..6768ccc4 100644 --- a/x/gov/types/v1/params.go +++ b/x/gov/types/v1/params.go @@ -72,13 +72,14 @@ func NewVotingParams(votingPeriod *time.Duration) VotingParams { // NewParams creates a new Params instance with given values. func NewParams( - minDeposit sdk.Coins, maxDepositPeriod, votingPeriod time.Duration, + // minDeposit sdk.Coins, // deprecated + maxDepositPeriod, votingPeriod time.Duration, quorum, threshold, constitutionAmendmentQuorum, constitutionAmendmentThreshold, lawQuorum, lawThreshold, minInitialDepositRatio string, burnProposalDeposit, burnVoteQuorum bool, minDepositRatio string, quorumTimeout, maxVotingPeriodExtension time.Duration, quorumCheckCount uint64, ) Params { return Params{ - MinDeposit: minDeposit, + // MinDeposit: minDeposit, // deprecated MaxDepositPeriod: &maxDepositPeriod, VotingPeriod: &votingPeriod, Quorum: quorum, @@ -100,7 +101,7 @@ func NewParams( // DefaultParams returns the default governance params func DefaultParams() Params { return NewParams( - sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, DefaultMinDepositTokens)), + // sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, DefaultMinDepositTokens)), DefaultDepositPeriod, DefaultVotingPeriod, DefaultQuorum.String(), @@ -121,9 +122,9 @@ func DefaultParams() Params { // ValidateBasic performs basic validation on governance parameters. func (p Params) ValidateBasic() error { - if minDeposit := sdk.Coins(p.MinDeposit); minDeposit.Empty() || !minDeposit.IsValid() { - return fmt.Errorf("invalid minimum deposit: %s", minDeposit) - } + // if minDeposit := sdk.Coins(p.MinDeposit); minDeposit.Empty() || !minDeposit.IsValid() { + // return fmt.Errorf("invalid minimum deposit: %s", minDeposit) + // } if p.MaxDepositPeriod == nil { return fmt.Errorf("maximum deposit period must not be nil: %d", p.MaxDepositPeriod) From e43d85aad626d815bb7b6221060a1726e341c8db Mon Sep 17 00:00:00 2001 From: Giuseppe Natale <12249307+giunatale@users.noreply.github.com> Date: Tue, 3 Dec 2024 18:44:51 +0100 Subject: [PATCH 05/29] make deposit stay stable when at target --- proto/atomone/gov/v1/gov.proto | 3 ++- x/gov/keeper/min_deposit.go | 15 +++++++++------ x/gov/types/v1/gov.pb.go | 3 ++- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/proto/atomone/gov/v1/gov.proto b/proto/atomone/gov/v1/gov.proto index fd4c20c5..2e20d9ba 100644 --- a/proto/atomone/gov/v1/gov.proto +++ b/proto/atomone/gov/v1/gov.proto @@ -225,7 +225,8 @@ message TallyParams { message Params { // Minimum deposit for a proposal to enter voting period. // Deprecated: a dynamic system now determines the minimum deposit, - // min_deposit_floor. Setting this value has no effect. + // see the other params starting with min_deposit_* and + // target_active_proposals. Setting this value has no effect. repeated cosmos.base.v1beta1.Coin min_deposit = 1 [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true, deprecated = true ]; diff --git a/x/gov/keeper/min_deposit.go b/x/gov/keeper/min_deposit.go index 1aa4e334..ff0e591b 100644 --- a/x/gov/keeper/min_deposit.go +++ b/x/gov/keeper/min_deposit.go @@ -84,7 +84,6 @@ func (keeper Keeper) GetMinDeposit(ctx sdk.Context) sdk.Coins { tick := params.MinDepositUpdatePeriod targetActiveProposals := math.NewIntFromUint64(params.TargetActiveProposals) k := params.MinDepositSensitivityTargetDistance - b := math.ZeroInt() var a sdk.Dec numActiveProposals := math.NewIntFromUint64(keeper.GetActiveProposalsNumber(ctx)) @@ -93,13 +92,12 @@ func (keeper Keeper) GetMinDeposit(ctx sdk.Context) sdk.Coins { a = sdk.MustNewDecFromStr(params.MinDepositIncreaseRatio) } else { a = sdk.MustNewDecFromStr(params.MinDepositDecreaseRatio) - b = math.OneInt() } - c1, err := numActiveProposals.Sub(targetActiveProposals).Sub(b).ToLegacyDec().ApproxRoot(k) + c1, err := numActiveProposals.Sub(targetActiveProposals).ToLegacyDec().ApproxRoot(k) if err != nil { - // in case of error bypass the sensitivity i.e. assume k = 1 - c1 = numActiveProposals.Sub(targetActiveProposals).Sub(b).ToLegacyDec() + // in case of error bypass the sensitivity, i.e. assume k = 1 + c1 = numActiveProposals.Sub(targetActiveProposals).ToLegacyDec() } c := a.Mul(c1) @@ -130,7 +128,12 @@ func (keeper Keeper) GetMinDeposit(ctx sdk.Context) sdk.Coins { // make sure any new denoms in minDepositFloor are added to minDeposit for _, minDepositFloorCoin := range minDepositFloor { if _, seen := minDepositFloorDenomsSeen[minDepositFloorCoin.Denom]; !seen { - minDeposit = append(minDeposit, minDepositFloorCoin) + minDepositCoinAmt := minDepositFloorCoin.Amount.ToLegacyDec().Mul(math.LegacyOneDec().Add(c.Power(uint64(ticksPassed)))).TruncateInt() + if minDepositCoinAmt.LT(minDepositFloorCoin.Amount) { + minDeposit = append(minDeposit, minDepositFloorCoin) + } else { + minDeposit = append(minDeposit, sdk.NewCoin(minDepositFloorCoin.Denom, minDepositCoinAmt)) + } } } diff --git a/x/gov/types/v1/gov.pb.go b/x/gov/types/v1/gov.pb.go index 450c9ca1..0bb9cd97 100644 --- a/x/gov/types/v1/gov.pb.go +++ b/x/gov/types/v1/gov.pb.go @@ -861,7 +861,8 @@ func (m *TallyParams) GetLawThreshold() string { type Params struct { // Minimum deposit for a proposal to enter voting period. // Deprecated: a dynamic system now determines the minimum deposit, - // min_deposit_floor + // see the other params starting with min_deposit_* and + // target_active_proposals. Setting this value has no effect. MinDeposit []types.Coin `protobuf:"bytes,1,rep,name=min_deposit,json=minDeposit,proto3" json:"min_deposit"` // Deprecated: Do not use. // Maximum period for Atom holders to deposit on a proposal. Initial value: 2 // months. From c0ba78506fc6edf9131e3904e1d3a62d8cda3c5f Mon Sep 17 00:00:00 2001 From: Giuseppe Natale <12249307+giunatale@users.noreply.github.com> Date: Wed, 4 Dec 2024 10:13:24 +0100 Subject: [PATCH 06/29] improve GetMinDeposit --- x/gov/keeper/min_deposit.go | 27 +++++++++++++++------------ x/gov/keeper/params.go | 4 ++++ x/gov/types/v1/params.go | 4 ++-- 3 files changed, 21 insertions(+), 14 deletions(-) diff --git a/x/gov/keeper/min_deposit.go b/x/gov/keeper/min_deposit.go index ff0e591b..ce99e513 100644 --- a/x/gov/keeper/min_deposit.go +++ b/x/gov/keeper/min_deposit.go @@ -87,6 +87,9 @@ func (keeper Keeper) GetMinDeposit(ctx sdk.Context) sdk.Coins { var a sdk.Dec numActiveProposals := math.NewIntFromUint64(keeper.GetActiveProposalsNumber(ctx)) + lastMinDeposit, lastMinDepositTime := keeper.GetLastMinDeposit(ctx) + // get number of ticks passed since last update + ticksPassed := ctx.BlockTime().Sub(lastMinDepositTime).Nanoseconds() / tick.Nanoseconds() if numActiveProposals.GT(targetActiveProposals) { a = sdk.MustNewDecFromStr(params.MinDepositIncreaseRatio) @@ -94,17 +97,17 @@ func (keeper Keeper) GetMinDeposit(ctx sdk.Context) sdk.Coins { a = sdk.MustNewDecFromStr(params.MinDepositDecreaseRatio) } - c1, err := numActiveProposals.Sub(targetActiveProposals).ToLegacyDec().ApproxRoot(k) - if err != nil { - // in case of error bypass the sensitivity, i.e. assume k = 1 - c1 = numActiveProposals.Sub(targetActiveProposals).ToLegacyDec() + distance := numActiveProposals.Sub(targetActiveProposals) + percChange := math.LegacyOneDec() + if !distance.IsZero() { + b, err := distance.ToLegacyDec().ApproxRoot(k) + if err != nil { + // in case of error bypass the sensitivity, i.e. assume k = 1 + b = numActiveProposals.Sub(targetActiveProposals).ToLegacyDec() + } + c := a.Mul(b) + percChange = percChange.Add(c.Power(uint64(ticksPassed))) } - c := a.Mul(c1) - - lastMinDeposit, lastMinDepositTime := keeper.GetLastMinDeposit(ctx) - - // get number of ticks passed since last update - ticksPassed := ctx.BlockTime().Sub(lastMinDepositTime).Nanoseconds() / tick.Nanoseconds() minDeposit := sdk.Coins{} minDepositFloorDenomsSeen := make(map[string]bool) @@ -117,7 +120,7 @@ func (keeper Keeper) GetMinDeposit(ctx sdk.Context) sdk.Coins { continue } minDepositFloorDenomsSeen[lastMinDepositCoin.Denom] = true - minDepositCoinAmt := lastMinDepositCoin.Amount.ToLegacyDec().Mul(math.LegacyOneDec().Add(c.Power(uint64(ticksPassed)))).TruncateInt() + minDepositCoinAmt := lastMinDepositCoin.Amount.ToLegacyDec().Mul(percChange).TruncateInt() if minDepositCoinAmt.LT(minDepositFloorCoinAmt) { minDeposit = append(minDeposit, sdk.NewCoin(lastMinDepositCoin.Denom, minDepositFloorCoinAmt)) } else { @@ -128,7 +131,7 @@ func (keeper Keeper) GetMinDeposit(ctx sdk.Context) sdk.Coins { // make sure any new denoms in minDepositFloor are added to minDeposit for _, minDepositFloorCoin := range minDepositFloor { if _, seen := minDepositFloorDenomsSeen[minDepositFloorCoin.Denom]; !seen { - minDepositCoinAmt := minDepositFloorCoin.Amount.ToLegacyDec().Mul(math.LegacyOneDec().Add(c.Power(uint64(ticksPassed)))).TruncateInt() + minDepositCoinAmt := minDepositFloorCoin.Amount.ToLegacyDec().Mul(percChange).TruncateInt() if minDepositCoinAmt.LT(minDepositFloorCoin.Amount) { minDeposit = append(minDeposit, minDepositFloorCoin) } else { diff --git a/x/gov/keeper/params.go b/x/gov/keeper/params.go index 3ea17199..3918a7d1 100644 --- a/x/gov/keeper/params.go +++ b/x/gov/keeper/params.go @@ -12,6 +12,10 @@ func (k Keeper) SetParams(ctx sdk.Context, params v1.Params) error { // before params change, trigger an update of the last min deposit minDeposit := k.GetMinDeposit(ctx) k.SetLastMinDeposit(ctx, minDeposit) + // params.MinDeposit is deprecated and therefore should not be set. + // Override any set value with the current min deposit, although + // since the value of this param is ignored it will have no effect. + params.MinDeposit = minDeposit store := ctx.KVStore(k.storeKey) bz, err := k.cdc.Marshal(¶ms) diff --git a/x/gov/types/v1/params.go b/x/gov/types/v1/params.go index 6768ccc4..de449c03 100644 --- a/x/gov/types/v1/params.go +++ b/x/gov/types/v1/params.go @@ -72,14 +72,14 @@ func NewVotingParams(votingPeriod *time.Duration) VotingParams { // NewParams creates a new Params instance with given values. func NewParams( - // minDeposit sdk.Coins, // deprecated + // minDeposit sdk.Coins, // Deprecated in favor of dynamic min deposit maxDepositPeriod, votingPeriod time.Duration, quorum, threshold, constitutionAmendmentQuorum, constitutionAmendmentThreshold, lawQuorum, lawThreshold, minInitialDepositRatio string, burnProposalDeposit, burnVoteQuorum bool, minDepositRatio string, quorumTimeout, maxVotingPeriodExtension time.Duration, quorumCheckCount uint64, ) Params { return Params{ - // MinDeposit: minDeposit, // deprecated + // MinDeposit: minDeposit, // Deprecated in favor of dynamic min deposit MaxDepositPeriod: &maxDepositPeriod, VotingPeriod: &votingPeriod, Quorum: quorum, From 48ae04854f1776b4e42f0e200483fc6824a425d1 Mon Sep 17 00:00:00 2001 From: Giuseppe Natale <12249307+giunatale@users.noreply.github.com> Date: Wed, 4 Dec 2024 10:26:43 +0100 Subject: [PATCH 07/29] add mindeposit query --- proto/atomone/gov/v1/query.proto | 17 ++ x/gov/client/cli/query.go | 33 +++ x/gov/keeper/grpc_query.go | 8 + x/gov/types/v1/query.pb.go | 483 ++++++++++++++++++++++++++----- x/gov/types/v1/query.pb.gw.go | 65 +++++ 5 files changed, 540 insertions(+), 66 deletions(-) diff --git a/proto/atomone/gov/v1/query.proto b/proto/atomone/gov/v1/query.proto index e8e595cd..233932b7 100644 --- a/proto/atomone/gov/v1/query.proto +++ b/proto/atomone/gov/v1/query.proto @@ -3,6 +3,8 @@ syntax = "proto3"; package atomone.gov.v1; +import "cosmos/base/v1beta1/coin.proto"; +import "gogoproto/gogo.proto"; import "cosmos/base/query/v1beta1/pagination.proto"; import "google/api/annotations.proto"; import "atomone/gov/v1/gov.proto"; @@ -61,6 +63,12 @@ service Query { option (google.api.http).get = "/atomone/gov/v1/proposals/{proposal_id}/tally"; } + + // MinDeposit queries the minimum deposit currently + // required for a proposal to enter voting period. + rpc MinDeposit(QueryMinDepositRequest) returns (QueryMinDepositResponse) { + option (google.api.http).get = "/atomone/gov/v1/mindeposit"; + } } // QueryConstitutionRequest is the request type for the Query/Constitution RPC method @@ -209,3 +217,12 @@ message QueryTallyResultResponse { // tally defines the requested tally. TallyResult tally = 1; } + +// QueryMinDepositRequest is the request type for the Query/MinDeposit RPC method. +message QueryMinDepositRequest {} + +// QueryMinDepositResponse is the response type for the Query/MinDeposit RPC method. +message QueryMinDepositResponse { + // min_deposit defines the minimum deposit required for a proposal to enter voting period. + repeated cosmos.base.v1beta1.Coin min_deposit = 1 [ (gogoproto.nullable) = false]; +} diff --git a/x/gov/client/cli/query.go b/x/gov/client/cli/query.go index 95e3de6e..6713c557 100644 --- a/x/gov/client/cli/query.go +++ b/x/gov/client/cli/query.go @@ -40,6 +40,7 @@ func GetQueryCmd() *cobra.Command { GetCmdQueryDeposits(), GetCmdQueryTally(), GetCmdConstitution(), + GetCmdQueryMinDeposit(), ) return govQueryCmd @@ -676,3 +677,35 @@ func GetCmdConstitution() *cobra.Command { }, } } + +// GetCmdQueryMinDeposit implements the query min deposit command. +func GetCmdQueryMinDeposit() *cobra.Command { + return &cobra.Command{ + Use: "min-deposit", + Args: cobra.ExactArgs(0), + Short: "Query the minimum deposit currently needed for a proposal to enter voting period", + Long: strings.TrimSpace( + fmt.Sprintf(`Query the minimum deposit needed for a proposal to enter voting period. + +Example: +$ %s query gov min-deposit +`, + version.AppName, + ), + ), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + queryClient := v1.NewQueryClient(clientCtx) + + resp, err := queryClient.MinDeposit(cmd.Context(), &v1.QueryMinDepositRequest{}) + if err != nil { + return err + } + + return clientCtx.PrintProto(resp) + }, + } +} diff --git a/x/gov/keeper/grpc_query.go b/x/gov/keeper/grpc_query.go index 805913a8..3faeb0a1 100644 --- a/x/gov/keeper/grpc_query.go +++ b/x/gov/keeper/grpc_query.go @@ -291,6 +291,14 @@ func (q Keeper) TallyResult(c context.Context, req *v1.QueryTallyResultRequest) return &v1.QueryTallyResultResponse{Tally: &tallyResult}, nil } +// MinDeposit returns the minimum deposit currently required for a proposal to enter voting period +func (q Keeper) MinDeposit(c context.Context, req *v1.QueryMinDepositRequest) (*v1.QueryMinDepositResponse, error) { + ctx := sdk.UnwrapSDKContext(c) + minDeposit := q.GetMinDeposit(ctx) + + return &v1.QueryMinDepositResponse{MinDeposit: minDeposit}, nil +} + var _ v1beta1.QueryServer = legacyQueryServer{} type legacyQueryServer struct { diff --git a/x/gov/types/v1/query.pb.go b/x/gov/types/v1/query.pb.go index 83c14285..1ba5c62d 100644 --- a/x/gov/types/v1/query.pb.go +++ b/x/gov/types/v1/query.pb.go @@ -7,7 +7,9 @@ import ( context "context" fmt "fmt" _ "github.com/cosmos/cosmos-proto" + types "github.com/cosmos/cosmos-sdk/types" query "github.com/cosmos/cosmos-sdk/types/query" + _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/cosmos/gogoproto/grpc" proto "github.com/cosmos/gogoproto/proto" _ "google.golang.org/genproto/googleapis/api/annotations" @@ -975,6 +977,89 @@ func (m *QueryTallyResultResponse) GetTally() *TallyResult { return nil } +// QueryMinDepositRequest is the request type for the Query/MinDeposit RPC method. +type QueryMinDepositRequest struct { +} + +func (m *QueryMinDepositRequest) Reset() { *m = QueryMinDepositRequest{} } +func (m *QueryMinDepositRequest) String() string { return proto.CompactTextString(m) } +func (*QueryMinDepositRequest) ProtoMessage() {} +func (*QueryMinDepositRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_2290d0188dd70223, []int{18} +} +func (m *QueryMinDepositRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryMinDepositRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryMinDepositRequest.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 *QueryMinDepositRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryMinDepositRequest.Merge(m, src) +} +func (m *QueryMinDepositRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryMinDepositRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryMinDepositRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryMinDepositRequest proto.InternalMessageInfo + +// QueryMinDepositResponse is the response type for the Query/MinDeposit RPC method. +type QueryMinDepositResponse struct { + // min_deposit defines the minimum deposit required for a proposal to enter voting period. + MinDeposit []types.Coin `protobuf:"bytes,1,rep,name=min_deposit,json=minDeposit,proto3" json:"min_deposit"` +} + +func (m *QueryMinDepositResponse) Reset() { *m = QueryMinDepositResponse{} } +func (m *QueryMinDepositResponse) String() string { return proto.CompactTextString(m) } +func (*QueryMinDepositResponse) ProtoMessage() {} +func (*QueryMinDepositResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_2290d0188dd70223, []int{19} +} +func (m *QueryMinDepositResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryMinDepositResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryMinDepositResponse.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 *QueryMinDepositResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryMinDepositResponse.Merge(m, src) +} +func (m *QueryMinDepositResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryMinDepositResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryMinDepositResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryMinDepositResponse proto.InternalMessageInfo + +func (m *QueryMinDepositResponse) GetMinDeposit() []types.Coin { + if m != nil { + return m.MinDeposit + } + return nil +} + func init() { proto.RegisterType((*QueryConstitutionRequest)(nil), "atomone.gov.v1.QueryConstitutionRequest") proto.RegisterType((*QueryConstitutionResponse)(nil), "atomone.gov.v1.QueryConstitutionResponse") @@ -994,77 +1079,85 @@ func init() { proto.RegisterType((*QueryDepositsResponse)(nil), "atomone.gov.v1.QueryDepositsResponse") proto.RegisterType((*QueryTallyResultRequest)(nil), "atomone.gov.v1.QueryTallyResultRequest") proto.RegisterType((*QueryTallyResultResponse)(nil), "atomone.gov.v1.QueryTallyResultResponse") + proto.RegisterType((*QueryMinDepositRequest)(nil), "atomone.gov.v1.QueryMinDepositRequest") + proto.RegisterType((*QueryMinDepositResponse)(nil), "atomone.gov.v1.QueryMinDepositResponse") } func init() { proto.RegisterFile("atomone/gov/v1/query.proto", fileDescriptor_2290d0188dd70223) } var fileDescriptor_2290d0188dd70223 = []byte{ - // 1030 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x57, 0x5d, 0x6f, 0xdc, 0x44, - 0x14, 0x8d, 0x37, 0x1f, 0xcd, 0xde, 0xa4, 0x01, 0x2e, 0xa1, 0x75, 0xdc, 0xb0, 0xb4, 0x26, 0x24, - 0x69, 0x45, 0x6c, 0x36, 0x25, 0x2d, 0x42, 0x14, 0x44, 0x28, 0x0d, 0x7d, 0x40, 0x0a, 0x6e, 0xc5, - 0x03, 0x2f, 0x91, 0x93, 0xb5, 0x5c, 0x4b, 0x1b, 0x8f, 0xbb, 0x33, 0xbb, 0x22, 0x0a, 0xab, 0x4a, - 0x48, 0x48, 0x94, 0xa7, 0x22, 0x84, 0x10, 0xfd, 0x1d, 0xfc, 0x08, 0x1e, 0x2b, 0x78, 0xe1, 0x11, - 0x25, 0xfc, 0x0e, 0x84, 0x3c, 0x73, 0xed, 0xb5, 0x1d, 0xef, 0x57, 0x55, 0xf1, 0xb8, 0x33, 0xe7, - 0x9e, 0x73, 0xe6, 0xce, 0x9d, 0x7b, 0xbd, 0x60, 0xb8, 0x82, 0x1d, 0xb2, 0xd0, 0xb3, 0x7d, 0xd6, - 0xb1, 0x3b, 0x75, 0xfb, 0x61, 0xdb, 0x6b, 0x1d, 0x59, 0x51, 0x8b,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83, 0x8f, 0x60, 0x86, 0xba, 0x69, 0xb9, 0x48, 0x6e, 0xfe, 0x18, 0x6f, 0x0e, 0xc4, - 0x90, 0x93, 0xb7, 0xa5, 0x93, 0x55, 0x5c, 0x39, 0xe3, 0x44, 0xe2, 0xec, 0xe3, 0xcc, 0x08, 0xeb, - 0xe2, 0x53, 0x0d, 0xce, 0x51, 0x7f, 0xc0, 0x72, 0xfa, 0x7c, 0xbb, 0x36, 0x56, 0x06, 0x83, 0xc8, - 0xc4, 0x6d, 0x69, 0xe2, 0x43, 0xfc, 0x60, 0xd4, 0x74, 0x24, 0xad, 0xc9, 0x3e, 0x4e, 0x1b, 0x78, - 0x17, 0x7f, 0xd4, 0x60, 0x36, 0x69, 0x78, 0x38, 0x50, 0x98, 0x0f, 0x7e, 0x3c, 0xc5, 0xae, 0x69, - 0xbe, 0x27, 0xfd, 0x6d, 0xe2, 0x3b, 0xe3, 0xfa, 0xc3, 0x5f, 0x34, 0x98, 0xcb, 0x74, 0x1f, 0x5c, - 0x2b, 0x15, 0x3c, 0xdb, 0x0f, 0x8d, 0xf5, 0xe1, 0xc0, 0xe7, 0xad, 0x25, 0xd9, 0x00, 0xb7, 0x77, - 0x7e, 0x3f, 0xa9, 0x69, 0xcf, 0x4e, 0x6a, 0xda, 0xdf, 0x27, 0x35, 0xed, 0xc9, 0x69, 0x6d, 0xe2, - 0xd9, 0x69, 0x6d, 0xe2, 0xaf, 0xd3, 0xda, 0xc4, 0x57, 0x1b, 0x7e, 0x20, 0x1e, 0xb4, 0xf7, 0xad, - 0x03, 0x76, 0x98, 0x50, 0x6e, 0x3c, 0x68, 0xef, 0xa7, 0xf4, 0x5f, 0x4b, 0x81, 0xb8, 0x20, 0x78, - 0xfc, 0x3f, 0x6d, 0x46, 0xfe, 0x8b, 0xba, 0xfe, 0x5f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x17, 0xab, - 0xa6, 0x19, 0xf2, 0x0d, 0x00, 0x00, + // 1121 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x57, 0x4b, 0x6f, 0xdc, 0x54, + 0x14, 0x8e, 0x27, 0x8f, 0x26, 0x67, 0xd2, 0x00, 0x87, 0xd0, 0x3a, 0x6e, 0x98, 0xb6, 0x26, 0x24, + 0x69, 0x45, 0x6c, 0x92, 0x92, 0x16, 0x21, 0xca, 0x23, 0x2d, 0x0d, 0x5d, 0x54, 0x0a, 0x6e, 0xc5, + 0x02, 0x16, 0x23, 0x67, 0xc6, 0x72, 0x2d, 0xcd, 0xf8, 0xba, 0xe3, 0x3b, 0x23, 0xa2, 0x30, 0xaa, + 0xa8, 0x84, 0x44, 0x59, 0x15, 0x21, 0x84, 0xe8, 0xef, 0xe0, 0x47, 0x74, 0x59, 0xc1, 0x86, 0x15, + 0x42, 0x09, 0x3f, 0x04, 0xf9, 0xde, 0x63, 0x8f, 0xed, 0xf1, 0x3c, 0x52, 0x55, 0xec, 0x92, 0x7b, + 0xbf, 0xf3, 0x9d, 0xef, 0x9e, 0xa7, 0x07, 0x34, 0x9b, 0xb3, 0x26, 0xf3, 0x1d, 0xd3, 0x65, 0x1d, + 0xb3, 0xb3, 0x69, 0x3e, 0x68, 0x3b, 0xad, 0x03, 0x23, 0x68, 0x31, 0xce, 0x70, 0x81, 0xee, 0x0c, + 0x97, 0x75, 0x8c, 0xce, 0xa6, 0x56, 0xa9, 0xb1, 0xb0, 0xc9, 0x42, 0x73, 0xdf, 0x0e, 0x1d, 0xb3, + 0xb3, 0xb9, 0xef, 0x70, 0x7b, 0xd3, 0xac, 0x31, 0xcf, 0x97, 0x78, 0x6d, 0xd1, 0x65, 0x2e, 0x13, + 0x7f, 0x9a, 0xd1, 0x5f, 0x74, 0x7a, 0x39, 0x6d, 0x25, 0xe8, 0x13, 0xdb, 0xc0, 0x76, 0x3d, 0xdf, + 0xe6, 0x1e, 0x8b, 0x19, 0x96, 0x5d, 0xc6, 0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x96, 0x84, 0xe1, + 0x55, 0x98, 0xab, 0x3b, 0x01, 0x0b, 0x3d, 0xce, 0x5a, 0xea, 0xe4, 0x08, 0x9b, 0x1e, 0x14, 0x6f, + 0x01, 0xf4, 0xca, 0x42, 0x9d, 0x12, 0x21, 0x58, 0x35, 0xc8, 0x2a, 0xaa, 0x21, 0x43, 0x96, 0x28, + 0xd5, 0x90, 0xb1, 0x67, 0xbb, 0x0e, 0x3d, 0xd6, 0x4a, 0x59, 0xea, 0xbf, 0x29, 0x70, 0x26, 0x1f, + 0x12, 0x8a, 0xf1, 0x55, 0x98, 0x8b, 0x1f, 0x17, 0x45, 0x63, 0x72, 0x68, 0x90, 0x7b, 0x50, 0xdc, + 0xcd, 0x48, 0x2b, 0x09, 0x69, 0x6b, 0x23, 0xa5, 0x49, 0xa7, 0x19, 0x6d, 0x35, 0x78, 0x55, 0x48, + 0xfb, 0x92, 0x71, 0x67, 0xdc, 0x92, 0x39, 0x69, 0x02, 0xf4, 0xeb, 0xf0, 0x5a, 0xca, 0x09, 0x3d, + 0x7d, 0x1d, 0xa6, 0xa2, 0x5b, 0x2a, 0xad, 0xc5, 0xfc, 0xab, 0x05, 0x56, 0x20, 0xf4, 0x6f, 0x53, + 0xe6, 0xe1, 0xd8, 0x22, 0x6f, 0x15, 0x84, 0xe8, 0x45, 0xb2, 0xf7, 0x58, 0x01, 0x4c, 0xbb, 0x27, + 0xf9, 0x97, 0x65, 0x0c, 0xe2, 0xac, 0x15, 0xeb, 0x97, 0x90, 0x97, 0x97, 0xad, 0x6d, 0x92, 0xb2, + 0x67, 0xb7, 0xec, 0x66, 0x26, 0x14, 0xe2, 0xa0, 0xca, 0x0f, 0x02, 0x87, 0xa6, 0x03, 0xc8, 0xa3, + 0x7b, 0x07, 0x81, 0xa3, 0x3f, 0x2d, 0xc1, 0xeb, 0x19, 0x3b, 0x7a, 0xc3, 0x67, 0x70, 0xba, 0xc3, + 0xb8, 0xe7, 0xbb, 0x55, 0x09, 0xa6, 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 0x82, 0x2d, 0x2a, 0xca, 0x30, 0xfa, 0x89, 0x3a, 0x23, + 0x7e, 0x40, 0x5e, 0xf9, 0x2f, 0x00, 0x00, 0xff, 0xff, 0x97, 0x80, 0xc3, 0xd4, 0x23, 0x0f, 0x00, + 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1097,6 +1190,9 @@ type QueryClient interface { Deposits(ctx context.Context, in *QueryDepositsRequest, opts ...grpc.CallOption) (*QueryDepositsResponse, error) // TallyResult queries the tally of a proposal vote. TallyResult(ctx context.Context, in *QueryTallyResultRequest, opts ...grpc.CallOption) (*QueryTallyResultResponse, error) + // MinDeposit queries the minimum deposit currently + // required for a proposal to enter voting period. + MinDeposit(ctx context.Context, in *QueryMinDepositRequest, opts ...grpc.CallOption) (*QueryMinDepositResponse, error) } type queryClient struct { @@ -1188,6 +1284,15 @@ func (c *queryClient) TallyResult(ctx context.Context, in *QueryTallyResultReque return out, nil } +func (c *queryClient) MinDeposit(ctx context.Context, in *QueryMinDepositRequest, opts ...grpc.CallOption) (*QueryMinDepositResponse, error) { + out := new(QueryMinDepositResponse) + err := c.cc.Invoke(ctx, "/atomone.gov.v1.Query/MinDeposit", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // QueryServer is the server API for Query service. type QueryServer interface { // Constitution queries the chain's constitution. @@ -1208,6 +1313,9 @@ type QueryServer interface { Deposits(context.Context, *QueryDepositsRequest) (*QueryDepositsResponse, error) // TallyResult queries the tally of a proposal vote. TallyResult(context.Context, *QueryTallyResultRequest) (*QueryTallyResultResponse, error) + // MinDeposit queries the minimum deposit currently + // required for a proposal to enter voting period. + MinDeposit(context.Context, *QueryMinDepositRequest) (*QueryMinDepositResponse, error) } // UnimplementedQueryServer can be embedded to have forward compatible implementations. @@ -1241,6 +1349,9 @@ func (*UnimplementedQueryServer) Deposits(ctx context.Context, req *QueryDeposit func (*UnimplementedQueryServer) TallyResult(ctx context.Context, req *QueryTallyResultRequest) (*QueryTallyResultResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method TallyResult not implemented") } +func (*UnimplementedQueryServer) MinDeposit(ctx context.Context, req *QueryMinDepositRequest) (*QueryMinDepositResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method MinDeposit not implemented") +} func RegisterQueryServer(s grpc1.Server, srv QueryServer) { s.RegisterService(&_Query_serviceDesc, srv) @@ -1408,6 +1519,24 @@ func _Query_TallyResult_Handler(srv interface{}, ctx context.Context, dec func(i return interceptor(ctx, in, info, handler) } +func _Query_MinDeposit_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryMinDepositRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).MinDeposit(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/atomone.gov.v1.Query/MinDeposit", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).MinDeposit(ctx, req.(*QueryMinDepositRequest)) + } + return interceptor(ctx, in, info, handler) +} + var _Query_serviceDesc = grpc.ServiceDesc{ ServiceName: "atomone.gov.v1.Query", HandlerType: (*QueryServer)(nil), @@ -1448,6 +1577,10 @@ var _Query_serviceDesc = grpc.ServiceDesc{ MethodName: "TallyResult", Handler: _Query_TallyResult_Handler, }, + { + MethodName: "MinDeposit", + Handler: _Query_MinDeposit_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "atomone/gov/v1/query.proto", @@ -2154,6 +2287,66 @@ func (m *QueryTallyResultResponse) MarshalToSizedBuffer(dAtA []byte) (int, error return len(dAtA) - i, nil } +func (m *QueryMinDepositRequest) 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 *QueryMinDepositRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryMinDepositRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *QueryMinDepositResponse) 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 *QueryMinDepositResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryMinDepositResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.MinDeposit) > 0 { + for iNdEx := len(m.MinDeposit) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.MinDeposit[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { offset -= sovQuery(v) base := offset @@ -2446,6 +2639,30 @@ func (m *QueryTallyResultResponse) Size() (n int) { return n } +func (m *QueryMinDepositRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryMinDepositResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.MinDeposit) > 0 { + for _, e := range m.MinDeposit { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + return n +} + func sovQuery(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -4283,6 +4500,140 @@ func (m *QueryTallyResultResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *QueryMinDepositRequest) 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 ErrIntOverflowQuery + } + 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: QueryMinDepositRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryMinDepositRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryMinDepositResponse) 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 ErrIntOverflowQuery + } + 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: QueryMinDepositResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryMinDepositResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MinDeposit", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.MinDeposit = append(m.MinDeposit, types.Coin{}) + if err := m.MinDeposit[len(m.MinDeposit)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipQuery(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/gov/types/v1/query.pb.gw.go b/x/gov/types/v1/query.pb.gw.go index c0047cfb..b4788f4f 100644 --- a/x/gov/types/v1/query.pb.gw.go +++ b/x/gov/types/v1/query.pb.gw.go @@ -545,6 +545,24 @@ func local_request_Query_TallyResult_0(ctx context.Context, marshaler runtime.Ma } +func request_Query_MinDeposit_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryMinDepositRequest + var metadata runtime.ServerMetadata + + msg, err := client.MinDeposit(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_MinDeposit_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryMinDepositRequest + var metadata runtime.ServerMetadata + + msg, err := server.MinDeposit(ctx, &protoReq) + return msg, metadata, err + +} + // RegisterQueryHandlerServer registers the http handlers for service Query to "mux". // UnaryRPC :call QueryServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. @@ -758,6 +776,29 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) + mux.Handle("GET", pattern_Query_MinDeposit_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_MinDeposit_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_MinDeposit_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -979,6 +1020,26 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) + mux.Handle("GET", pattern_Query_MinDeposit_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_MinDeposit_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_MinDeposit_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -1000,6 +1061,8 @@ var ( pattern_Query_Deposits_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 2, 5}, []string{"atomone", "gov", "v1", "proposals", "proposal_id", "deposits"}, "", runtime.AssumeColonVerbOpt(false))) pattern_Query_TallyResult_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 2, 5}, []string{"atomone", "gov", "v1", "proposals", "proposal_id", "tally"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_MinDeposit_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"atomone", "gov", "v1", "mindeposit"}, "", runtime.AssumeColonVerbOpt(false))) ) var ( @@ -1020,4 +1083,6 @@ var ( forward_Query_Deposits_0 = runtime.ForwardResponseMessage forward_Query_TallyResult_0 = runtime.ForwardResponseMessage + + forward_Query_MinDeposit_0 = runtime.ForwardResponseMessage ) From f21be704c1fffa972c0a16b208befd9cb40788ab Mon Sep 17 00:00:00 2001 From: Giuseppe Natale <12249307+giunatale@users.noreply.github.com> Date: Wed, 4 Dec 2024 10:37:15 +0100 Subject: [PATCH 08/29] add params validation --- x/gov/types/v1/params.go | 53 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/x/gov/types/v1/params.go b/x/gov/types/v1/params.go index de449c03..f24bbca0 100644 --- a/x/gov/types/v1/params.go +++ b/x/gov/types/v1/params.go @@ -237,6 +237,17 @@ func (p Params) ValidateBasic() error { return fmt.Errorf("mininum initial deposit ratio of proposal is too large: %s", minInitialDepositRatio) } + minDepositRatio, err := math.LegacyNewDecFromStr(p.MinDepositRatio) + if err != nil { + return fmt.Errorf("invalid mininum deposit ratio of proposal: %w", err) + } + if minDepositRatio.IsNegative() { + return fmt.Errorf("mininum deposit ratio of proposal must be positive: %s", minDepositRatio) + } + if minDepositRatio.GT(math.LegacyOneDec()) { + return fmt.Errorf("mininum deposit ratio of proposal is too large: %s", minDepositRatio) + } + if p.QuorumCheckCount > 0 { // If quorum check is enabled, validate quorum check params if p.QuorumTimeout == nil { @@ -257,5 +268,47 @@ func (p Params) ValidateBasic() error { } } + if minDepositFloor := sdk.Coins(p.MinDepositFloor); minDepositFloor.Empty() || !minDepositFloor.IsValid() { + return fmt.Errorf("invalid minimum deposit floor: %s", minDepositFloor) + } + + if p.MinDepositUpdatePeriod == nil { + return fmt.Errorf("minimum deposit update period must not be nil: %d", p.MinDepositUpdatePeriod) + } + + if p.MinDepositUpdatePeriod.Seconds() <= 0 { + return fmt.Errorf("minimum deposit update period must be positive: %d", p.MinDepositUpdatePeriod) + } + + if p.MinDepositUpdatePeriod.Seconds() > p.VotingPeriod.Seconds() { + return fmt.Errorf("minimum deposit update period must be less than or equal to the voting period: %d", p.MinDepositUpdatePeriod) + } + + if p.MinDepositSensitivityTargetDistance == 0 { + return fmt.Errorf("minimum deposit sensitivity target distance must be positive: %d", p.MinDepositSensitivityTargetDistance) + } + + minDepositIncreaseRation, err := sdk.NewDecFromStr(p.MinDepositIncreaseRatio) + if err != nil { + return fmt.Errorf("invalid minimum deposit increase ratio: %w", err) + } + if minDepositIncreaseRation.IsNegative() { + return fmt.Errorf("minimum deposit increase ratio must be positive: %s", minDepositIncreaseRation) + } + if minDepositIncreaseRation.GT(math.LegacyOneDec()) { + return fmt.Errorf("minimum deposit increase ratio too large: %s", minDepositIncreaseRation) + } + + minDepositDecreaseRatio, err := sdk.NewDecFromStr(p.MinDepositDecreaseRatio) + if err != nil { + return fmt.Errorf("invalid minimum deposit decrease ratio: %w", err) + } + if minDepositDecreaseRatio.IsNegative() { + return fmt.Errorf("minimum deposit decrease ratio must be positive: %s", minDepositDecreaseRatio) + } + if minDepositDecreaseRatio.GT(math.LegacyOneDec()) { + return fmt.Errorf("minimum deposit decrease ratio too large: %s", minDepositDecreaseRatio) + } + return nil } From ec45133fd20118900eddadeefd1e971eac3df873 Mon Sep 17 00:00:00 2001 From: Giuseppe Natale <12249307+giunatale@users.noreply.github.com> Date: Wed, 4 Dec 2024 10:55:36 +0100 Subject: [PATCH 09/29] params --- x/gov/simulation/genesis.go | 96 ++++++++++++++++++++++++++++++------- x/gov/types/v1/params.go | 56 +++++++++++++++------- 2 files changed, 118 insertions(+), 34 deletions(-) diff --git a/x/gov/simulation/genesis.go b/x/gov/simulation/genesis.go index 2dc910b7..42f4c719 100644 --- a/x/gov/simulation/genesis.go +++ b/x/gov/simulation/genesis.go @@ -20,16 +20,22 @@ import ( // Simulation parameter constants const ( - DepositParamsMinDeposit = "deposit_params_min_deposit" - DepositParamsDepositPeriod = "deposit_params_deposit_period" - DepositMinInitialRatio = "deposit_params_min_initial_ratio" - VotingParamsVotingPeriod = "voting_params_voting_period" - TallyParamsQuorum = "tally_params_quorum" - TallyParamsThreshold = "tally_params_threshold" - TallyParamsConstitutionAmendmentQuorum = "tally_params_constitution_amendment_quorum" - TallyParamsConstitutionAmendmentThreshold = "tally_params_constitution_amendment_threshold" - TallyParamsLawQuorum = "tally_params_law_quorum" - TallyParamsLawThreshold = "tally_params_law_threshold" + DepositParamsMinDeposit = "deposit_params_min_deposit" + DepositParamsDepositPeriod = "deposit_params_deposit_period" + DepositMinInitialRatio = "deposit_params_min_initial_ratio" + VotingParamsVotingPeriod = "voting_params_voting_period" + TallyParamsQuorum = "tally_params_quorum" + TallyParamsThreshold = "tally_params_threshold" + TallyParamsConstitutionAmendmentQuorum = "tally_params_constitution_amendment_quorum" + TallyParamsConstitutionAmendmentThreshold = "tally_params_constitution_amendment_threshold" + TallyParamsLawQuorum = "tally_params_law_quorum" + TallyParamsLawThreshold = "tally_params_law_threshold" + DepositParamsMinDepositFloor = "deposit_params_min_deposit_floor" + DepositParamsMinDepositUpdatePeriod = "deposit_params_min_deposit_update_period" + DepositParamsMinDepositSensitivityTargetDistance = "deposit_params_min_deposit_sensitivity_target_distance" + DepositParamsMinDepositIncreaseRatio = "deposit_params_min_deposit_increase_ratio" + DepositParamsMinDepositDecreaseRatio = "deposit_params_min_deposit_decrease_ratio" + TallyParamsTargetActiveProposals = "tally_params_target_active_proposals" // NOTE: backport from v50 MinDepositRatio = "min_deposit_ratio" @@ -101,15 +107,35 @@ func GenQuorumCheckCount(r *rand.Rand) uint64 { return uint64(simulation.RandIntBetween(r, 0, 30)) } +// GenDepositParamsMinDepositUpdatePeriod returns randomized DepositParamsMinDepositUpdatePeriod +func GenDepositParamsMinDepositUpdatePeriod(r *rand.Rand, votingPeriod time.Duration) time.Duration { + return time.Duration(simulation.RandIntBetween(r, 1, int(votingPeriod.Seconds()))) * time.Second +} + +// GenDepositParamsMinDepositSensitivityTargetDistance returns randomized DepositParamsMinDepositSensitivityTargetDistance +func GenDepositParamsMinDepositSensitivityTargetDistance(r *rand.Rand) uint64 { + return uint64(simulation.RandIntBetween(r, 1, 10)) +} + +// GenDepositParamsMinDepositChangeRatio returns randomized DepositParamsMinDepositChangeRatio +func GenDepositParamsMinDepositChangeRatio(r *rand.Rand) sdk.Dec { + return sdk.NewDecWithPrec(int64(simulation.RandIntBetween(r, 0, 100)), 2).Quo(sdk.NewDec(100)) +} + +// GenTallyParamsTargetActiveProposals returns randomized TallyParamsTargetActiveProposals +func GenTallyParamsTargetActiveProposals(r *rand.Rand) uint64 { + return uint64(simulation.RandIntBetween(r, 1, 100)) +} + // RandomizedGenState generates a random GenesisState for gov func RandomizedGenState(simState *module.SimulationState) { startingProposalID := uint64(simState.Rand.Intn(100)) - var minDeposit sdk.Coins - simState.AppParams.GetOrGenerate( - simState.Cdc, DepositParamsMinDeposit, &minDeposit, simState.Rand, - func(r *rand.Rand) { minDeposit = GenDepositParamsMinDeposit(r) }, - ) + // var minDeposit sdk.Coins + //simState.AppParams.GetOrGenerate( + // simState.Cdc, DepositParamsMinDeposit, &minDeposit, simState.Rand, + // func(r *rand.Rand) { minDeposit = GenDepositParamsMinDeposit(r) }, + //) var depositPeriod time.Duration simState.AppParams.GetOrGenerate( @@ -179,9 +205,47 @@ func RandomizedGenState(simState *module.SimulationState) { var quorumCheckCount uint64 simState.AppParams.GetOrGenerate(simState.Cdc, QuorumCheckCount, &quorumCheckCount, simState.Rand, func(r *rand.Rand) { quorumCheckCount = GenQuorumCheckCount(r) }) + var minDepositFloor sdk.Coins + simState.AppParams.GetOrGenerate( + simState.Cdc, DepositParamsMinDepositFloor, &minDepositFloor, simState.Rand, + func(r *rand.Rand) { minDepositFloor = GenDepositParamsMinDeposit(r) }, + ) + + var minDepositUpdatePeriod time.Duration + simState.AppParams.GetOrGenerate( + simState.Cdc, DepositParamsDepositPeriod, &minDepositUpdatePeriod, simState.Rand, + func(r *rand.Rand) { minDepositUpdatePeriod = GenDepositParamsMinDepositUpdatePeriod(r, votingPeriod) }, + ) + + var minDepositSensitivityTargetDistance uint64 + simState.AppParams.GetOrGenerate( + simState.Cdc, DepositParamsMinDepositSensitivityTargetDistance, &minDepositSensitivityTargetDistance, simState.Rand, + func(r *rand.Rand) { + minDepositSensitivityTargetDistance = GenDepositParamsMinDepositSensitivityTargetDistance(r) + }, + ) + + var minDepositIncreaseRatio sdk.Dec + simState.AppParams.GetOrGenerate( + simState.Cdc, DepositParamsMinDepositIncreaseRatio, &minDepositIncreaseRatio, simState.Rand, + func(r *rand.Rand) { minDepositIncreaseRatio = GenDepositParamsMinDepositChangeRatio(r) }, + ) + + var minDepositDecreaseRatio sdk.Dec + simState.AppParams.GetOrGenerate( + simState.Cdc, DepositParamsMinDepositDecreaseRatio, &minDepositDecreaseRatio, simState.Rand, + func(r *rand.Rand) { minDepositDecreaseRatio = GenDepositParamsMinDepositChangeRatio(r) }, + ) + + var targetActiveProposals uint64 + simState.AppParams.GetOrGenerate( + simState.Cdc, TallyParamsTargetActiveProposals, &targetActiveProposals, simState.Rand, + func(r *rand.Rand) { targetActiveProposals = GenTallyParamsTargetActiveProposals(r) }, + ) + govGenesis := v1.NewGenesisState( startingProposalID, - v1.NewParams(minDeposit, depositPeriod, votingPeriod, quorum.String(), threshold.String(), amendmentsQuorum.String(), amendmentsThreshold.String(), lawQuorum.String(), lawThreshold.String(), minInitialDepositRatio.String(), simState.Rand.Intn(2) == 0, simState.Rand.Intn(2) == 0, minDepositRatio.String(), quorumTimout, maxVotingPeriodExtension, quorumCheckCount), + v1.NewParams(depositPeriod, votingPeriod, quorum.String(), threshold.String(), amendmentsQuorum.String(), amendmentsThreshold.String(), lawQuorum.String(), lawThreshold.String(), minInitialDepositRatio.String(), simState.Rand.Intn(2) == 0, simState.Rand.Intn(2) == 0, minDepositRatio.String(), quorumTimout, maxVotingPeriodExtension, quorumCheckCount, minDepositFloor, minDepositUpdatePeriod, minDepositSensitivityTargetDistance, minDepositIncreaseRatio.String(), minDepositDecreaseRatio.String(), targetActiveProposals), ) bz, err := json.MarshalIndent(&govGenesis, "", " ") diff --git a/x/gov/types/v1/params.go b/x/gov/types/v1/params.go index f24bbca0..f10f6546 100644 --- a/x/gov/types/v1/params.go +++ b/x/gov/types/v1/params.go @@ -42,9 +42,15 @@ var ( DefaultBurnVoteQuorom = false // set to false to replicate behavior of when this change was made (0.47) DefaultMinDepositRatio = sdk.NewDecWithPrec(1, 2) // NOTE: backport from v50 - DefaultQuorumTimeout time.Duration = DefaultVotingPeriod - (time.Hour * 24 * 1) // disabled by default (DefaultQuorumCheckCount must be set to a non-zero value to enable) - DefaultMaxVotingPeriodExtension time.Duration = DefaultVotingPeriod - DefaultQuorumTimeout // disabled by default (DefaultQuorumCheckCount must be set to a non-zero value to enable) - DefaultQuorumCheckCount uint64 = 0 // disabled by default (0 means no check) + DefaultQuorumTimeout time.Duration = DefaultVotingPeriod - (time.Hour * 24 * 1) // disabled by default (DefaultQuorumCheckCount must be set to a non-zero value to enable) + DefaultMaxVotingPeriodExtension time.Duration = DefaultVotingPeriod - DefaultQuorumTimeout // disabled by default (DefaultQuorumCheckCount must be set to a non-zero value to enable) + DefaultQuorumCheckCount uint64 = 0 // disabled by default (0 means no check) + DefaultMinDepositFloor sdk.Coins = sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, DefaultMinDepositTokens)) + DefaultMinDepositUpdatePeriod time.Duration = time.Hour * 24 * 7 + DefaultMinDepositSensitivityTargetDistance uint64 = 2 + DefaultMinDepositIncreaseRatio = sdk.NewDecWithPrec(5, 2) + DefaultMinDepositDecreaseRatio = sdk.NewDecWithPrec(25, 3) + DefaultTargetActiveProposals uint64 = 2 ) // Deprecated: NewDepositParams creates a new DepositParams object @@ -77,24 +83,32 @@ func NewParams( quorum, threshold, constitutionAmendmentQuorum, constitutionAmendmentThreshold, lawQuorum, lawThreshold, minInitialDepositRatio string, burnProposalDeposit, burnVoteQuorum bool, minDepositRatio string, quorumTimeout, maxVotingPeriodExtension time.Duration, quorumCheckCount uint64, + minDepositFloor sdk.Coins, minDepositUpdatePeriod time.Duration, minDepositSensitivityTargetDistance uint64, + minDepositIncreaseRatio, minDepositDecreaseRatio string, targetActiveProposals uint64, ) Params { return Params{ // MinDeposit: minDeposit, // Deprecated in favor of dynamic min deposit - MaxDepositPeriod: &maxDepositPeriod, - VotingPeriod: &votingPeriod, - Quorum: quorum, - Threshold: threshold, - ConstitutionAmendmentQuorum: constitutionAmendmentQuorum, - ConstitutionAmendmentThreshold: constitutionAmendmentThreshold, - LawQuorum: lawQuorum, - LawThreshold: lawThreshold, - MinInitialDepositRatio: minInitialDepositRatio, - BurnProposalDepositPrevote: burnProposalDeposit, - BurnVoteQuorum: burnVoteQuorum, - MinDepositRatio: minDepositRatio, - QuorumTimeout: &quorumTimeout, - MaxVotingPeriodExtension: &maxVotingPeriodExtension, - QuorumCheckCount: quorumCheckCount, + MaxDepositPeriod: &maxDepositPeriod, + VotingPeriod: &votingPeriod, + Quorum: quorum, + Threshold: threshold, + ConstitutionAmendmentQuorum: constitutionAmendmentQuorum, + ConstitutionAmendmentThreshold: constitutionAmendmentThreshold, + LawQuorum: lawQuorum, + LawThreshold: lawThreshold, + MinInitialDepositRatio: minInitialDepositRatio, + BurnProposalDepositPrevote: burnProposalDeposit, + BurnVoteQuorum: burnVoteQuorum, + MinDepositRatio: minDepositRatio, + QuorumTimeout: &quorumTimeout, + MaxVotingPeriodExtension: &maxVotingPeriodExtension, + QuorumCheckCount: quorumCheckCount, + MinDepositFloor: minDepositFloor, + MinDepositUpdatePeriod: &minDepositUpdatePeriod, + MinDepositSensitivityTargetDistance: minDepositSensitivityTargetDistance, + MinDepositIncreaseRatio: minDepositIncreaseRatio, + MinDepositDecreaseRatio: minDepositDecreaseRatio, + TargetActiveProposals: targetActiveProposals, } } @@ -117,6 +131,12 @@ func DefaultParams() Params { DefaultQuorumTimeout, DefaultMaxVotingPeriodExtension, DefaultQuorumCheckCount, + DefaultMinDepositFloor, + DefaultMinDepositUpdatePeriod, + DefaultMinDepositSensitivityTargetDistance, + DefaultMinDepositIncreaseRatio.String(), + DefaultMinDepositDecreaseRatio.String(), + DefaultTargetActiveProposals, ) } From 47fdc9524a0ddea1f73f25a30631466efd392bff Mon Sep 17 00:00:00 2001 From: Giuseppe Natale <12249307+giunatale@users.noreply.github.com> Date: Wed, 4 Dec 2024 11:18:28 +0100 Subject: [PATCH 10/29] genesis --- proto/atomone/gov/v1/genesis.proto | 3 + x/gov/genesis.go | 13 ++++ x/gov/keeper/min_deposit.go | 9 +-- x/gov/keeper/params.go | 2 +- x/gov/simulation/genesis.go | 2 +- x/gov/types/v1/genesis.pb.go | 113 ++++++++++++++++++++++------- 6 files changed, 110 insertions(+), 32 deletions(-) diff --git a/proto/atomone/gov/v1/genesis.proto b/proto/atomone/gov/v1/genesis.proto index ebaddf79..5fdfa6cb 100644 --- a/proto/atomone/gov/v1/genesis.proto +++ b/proto/atomone/gov/v1/genesis.proto @@ -34,4 +34,7 @@ message GenesisState { // // Since: cosmos-sdk 0.48 string constitution = 9; + + // last updated value for the dynamic min deposit + LastMinDeposit last_min_deposit = 10; } diff --git a/x/gov/genesis.go b/x/gov/genesis.go index a1f221e0..ea86e3f0 100644 --- a/x/gov/genesis.go +++ b/x/gov/genesis.go @@ -77,6 +77,12 @@ func InitGenesis(ctx sdk.Context, ak types.AccountKeeper, bk types.BankKeeper, k if !balance.IsEqual(totalDeposits) { panic(fmt.Sprintf("expected module account was %s but we got %s", balance.String(), totalDeposits.String())) } + + if data.LastMinDeposit != nil { + k.SetLastMinDeposit(ctx, data.LastMinDeposit.Value, *data.LastMinDeposit.Time) + } else { + k.SetLastMinDeposit(ctx, data.Params.MinDepositFloor, ctx.BlockTime()) + } } // ExportGenesis - output genesis parameters @@ -96,6 +102,12 @@ func ExportGenesis(ctx sdk.Context, k *keeper.Keeper) *v1.GenesisState { proposalsVotes = append(proposalsVotes, votes...) } + blockTime := ctx.BlockTime() + lastMinDeposit := v1.LastMinDeposit{ + Value: k.GetMinDeposit(ctx), + Time: &blockTime, + } + return &v1.GenesisState{ StartingProposalId: startingProposalID, Deposits: proposalsDeposits, @@ -103,5 +115,6 @@ func ExportGenesis(ctx sdk.Context, k *keeper.Keeper) *v1.GenesisState { Proposals: proposals, Params: ¶ms, Constitution: constitution, + LastMinDeposit: &lastMinDeposit, } } diff --git a/x/gov/keeper/min_deposit.go b/x/gov/keeper/min_deposit.go index ce99e513..61b5b7d3 100644 --- a/x/gov/keeper/min_deposit.go +++ b/x/gov/keeper/min_deposit.go @@ -35,7 +35,7 @@ func (keeper Keeper) IncrementActiveProposalsNumber(ctx sdk.Context) { keeper.SetActiveProposalsNumber(ctx, activeProposalsNumber) currMinDeposit := keeper.GetMinDeposit(ctx) - keeper.SetLastMinDeposit(ctx, currMinDeposit) + keeper.SetLastMinDeposit(ctx, currMinDeposit, ctx.BlockTime()) } // DecrementActiveProposalsNumber decrements the number of active proposals by one @@ -49,17 +49,16 @@ func (keeper Keeper) DecrementActiveProposalsNumber(ctx sdk.Context) { } currMinDeposit := keeper.GetMinDeposit(ctx) - keeper.SetLastMinDeposit(ctx, currMinDeposit) + keeper.SetLastMinDeposit(ctx, currMinDeposit, ctx.BlockTime()) } // SetLastMinDeposit updates the last min deposit and last min deposit time. // Used to record these values the last time the number of active proposals changed -func (keeper Keeper) SetLastMinDeposit(ctx sdk.Context, minDeposit sdk.Coins) { +func (keeper Keeper) SetLastMinDeposit(ctx sdk.Context, minDeposit sdk.Coins, timeStamp time.Time) { store := ctx.KVStore(keeper.storeKey) - blockTime := ctx.BlockTime() lastMinDeposit := v1.LastMinDeposit{ Value: minDeposit, - Time: &blockTime, + Time: &timeStamp, } bz := keeper.cdc.MustMarshal(&lastMinDeposit) store.Set(types.LastMinDepositKey, bz) diff --git a/x/gov/keeper/params.go b/x/gov/keeper/params.go index 3918a7d1..eb4ef46e 100644 --- a/x/gov/keeper/params.go +++ b/x/gov/keeper/params.go @@ -11,7 +11,7 @@ import ( func (k Keeper) SetParams(ctx sdk.Context, params v1.Params) error { // before params change, trigger an update of the last min deposit minDeposit := k.GetMinDeposit(ctx) - k.SetLastMinDeposit(ctx, minDeposit) + k.SetLastMinDeposit(ctx, minDeposit, ctx.BlockTime()) // params.MinDeposit is deprecated and therefore should not be set. // Override any set value with the current min deposit, although // since the value of this param is ignored it will have no effect. diff --git a/x/gov/simulation/genesis.go b/x/gov/simulation/genesis.go index 42f4c719..8c43c81c 100644 --- a/x/gov/simulation/genesis.go +++ b/x/gov/simulation/genesis.go @@ -132,7 +132,7 @@ func RandomizedGenState(simState *module.SimulationState) { startingProposalID := uint64(simState.Rand.Intn(100)) // var minDeposit sdk.Coins - //simState.AppParams.GetOrGenerate( + // simState.AppParams.GetOrGenerate( // simState.Cdc, DepositParamsMinDeposit, &minDeposit, simState.Rand, // func(r *rand.Rand) { minDeposit = GenDepositParamsMinDeposit(r) }, //) diff --git a/x/gov/types/v1/genesis.pb.go b/x/gov/types/v1/genesis.pb.go index 3e6dc87b..a21a7134 100644 --- a/x/gov/types/v1/genesis.pb.go +++ b/x/gov/types/v1/genesis.pb.go @@ -49,6 +49,8 @@ type GenesisState struct { // // Since: cosmos-sdk 0.48 Constitution string `protobuf:"bytes,9,opt,name=constitution,proto3" json:"constitution,omitempty"` + // last updated value for the dynamic min deposit + LastMinDeposit *LastMinDeposit `protobuf:"bytes,10,opt,name=last_min_deposit,json=lastMinDeposit,proto3" json:"last_min_deposit,omitempty"` } func (m *GenesisState) Reset() { *m = GenesisState{} } @@ -150,6 +152,13 @@ func (m *GenesisState) GetConstitution() string { return "" } +func (m *GenesisState) GetLastMinDeposit() *LastMinDeposit { + if m != nil { + return m.LastMinDeposit + } + return nil +} + func init() { proto.RegisterType((*GenesisState)(nil), "atomone.gov.v1.GenesisState") } @@ -157,31 +166,33 @@ func init() { func init() { proto.RegisterFile("atomone/gov/v1/genesis.proto", fileDescriptor_7737a96fb154b10d) } var fileDescriptor_7737a96fb154b10d = []byte{ - // 380 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x92, 0xcf, 0xaa, 0xda, 0x40, - 0x14, 0xc6, 0x1d, 0xff, 0x55, 0xc7, 0xe8, 0x62, 0x90, 0x76, 0x68, 0x6d, 0x08, 0xae, 0x42, 0xc1, - 0xa4, 0x2a, 0xf4, 0x01, 0xa4, 0xc5, 0x76, 0x27, 0x69, 0xe9, 0xa2, 0x1b, 0x89, 0x66, 0x88, 0x01, - 0xcd, 0x09, 0x99, 0xe3, 0x50, 0xb7, 0x7d, 0x82, 0x3e, 0x56, 0x97, 0x2e, 0xbb, 0x2c, 0xfa, 0x22, - 0xc5, 0x49, 0x72, 0xd5, 0xdc, 0x7b, 0x77, 0xc3, 0xf9, 0x7e, 0xdf, 0x77, 0x3e, 0x0e, 0x43, 0x07, - 0x3e, 0xc2, 0x0e, 0x62, 0xe1, 0x86, 0xa0, 0x5c, 0x35, 0x76, 0x43, 0x11, 0x0b, 0x19, 0x49, 0x27, - 0x49, 0x01, 0x81, 0xf5, 0x72, 0xd5, 0x09, 0x41, 0x39, 0x6a, 0xfc, 0x9a, 0x97, 0x69, 0x50, 0x19, - 0x39, 0xfc, 0x55, 0xa7, 0xc6, 0x3c, 0xf3, 0x7e, 0x45, 0x1f, 0x05, 0x7b, 0x4f, 0xfb,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 0x77, 0x37, 0x9b, 0xcd, 0xff, 0x9c, 0x4c, 0x72, 0x3c, 0x99, 0xe4, - 0xdf, 0xc9, 0x24, 0xbf, 0xcf, 0x66, 0xe5, 0x78, 0x36, 0x2b, 0x7f, 0xcf, 0x66, 0xe5, 0xc7, 0x28, - 0x8c, 0x70, 0xb3, 0x5f, 0x39, 0x6b, 0xd8, 0xb9, 0xf9, 0x9e, 0xd1, 0x66, 0xbf, 0x2a, 0xde, 0xee, - 0x4f, 0xfd, 0xa3, 0xf0, 0x90, 0x08, 0xe9, 0xaa, 0xf1, 0xaa, 0xa9, 0x3f, 0xd5, 0xf4, 0x7f, 0x00, - 0x00, 0x00, 0xff, 0xff, 0x19, 0xfd, 0x88, 0xa5, 0x9e, 0x02, 0x00, 0x00, + // 413 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x92, 0x41, 0x8b, 0xd3, 0x40, + 0x14, 0xc7, 0x3b, 0xbb, 0xdd, 0xba, 0x9d, 0x66, 0x8b, 0x0c, 0x8b, 0x0e, 0xba, 0x86, 0xb0, 0xa7, + 0x20, 0x6c, 0x62, 0x77, 0xc1, 0x0f, 0x50, 0x94, 0x5d, 0x41, 0x61, 0x89, 0xe2, 0xc1, 0x4b, 0x98, + 0x6e, 0x86, 0x74, 0x20, 0xc9, 0x0b, 0x99, 0xd7, 0xc1, 0x7e, 0x0b, 0x3f, 0x96, 0x07, 0x0f, 0x3d, + 0x7a, 0x94, 0xf6, 0x8b, 0x48, 0x27, 0x89, 0x6d, 0xa3, 0xde, 0x92, 0xf7, 0x7e, 0xff, 0xdf, 0xbc, + 0xbc, 0x0c, 0xbd, 0x10, 0x08, 0x39, 0x14, 0x32, 0x4c, 0xc1, 0x84, 0x66, 0x12, 0xa6, 0xb2, 0x90, + 0x5a, 0xe9, 0xa0, 0xac, 0x00, 0x81, 0x8d, 0x9b, 0x6e, 0x90, 0x82, 0x09, 0xcc, 0xe4, 0x19, 0xef, + 0xd2, 0x60, 0x6a, 0xf2, 0xf2, 0x47, 0x9f, 0x3a, 0xb7, 0x75, 0xf6, 0x23, 0x0a, 0x94, 0xec, 0x15, + 0x3d, 0xd7, 0x28, 0x2a, 0x54, 0x45, 0x1a, 0x97, 0x15, 0x94, 0xa0, 0x45, 0x16, 0xab, 0x84, 0x13, + 0x8f, 0xf8, 0xfd, 0x88, 0xb5, 0xbd, 0xfb, 0xa6, 0xf5, 0x2e, 0x61, 0x37, 0xf4, 0x34, 0x91, 0x25, + 0x68, 0x85, 0x9a, 0x1f, 0x79, 0xc7, 0xfe, 0xe8, 0xfa, 0x69, 0x70, 0x78, 0x7e, 0xf0, 0xa6, 0xee, + 0x47, 0x7f, 0x40, 0xf6, 0x92, 0x9e, 0x18, 0x40, 0xa9, 0xf9, 0xb1, 0x4d, 0x9c, 0x77, 0x13, 0x9f, + 0x01, 0x65, 0x54, 0x23, 0xec, 0x35, 0x1d, 0xb6, 0x93, 0x68, 0xde, 0xb7, 0x3c, 0xef, 0xf2, 0xed, + 0x3c, 0xd1, 0x0e, 0x65, 0x77, 0x74, 0xdc, 0x9c, 0x17, 0x97, 0xa2, 0x12, 0xb9, 0xe6, 0x27, 0x1e, + 0xf1, 0x47, 0xd7, 0x2f, 0xfe, 0x33, 0xde, 0xbd, 0x85, 0xa6, 0x47, 0x9c, 0x44, 0x67, 0xc9, 0x7e, + 0x89, 0xbd, 0xa5, 0x67, 0x06, 0xea, 0x95, 0xd4, 0xa2, 0x81, 0x15, 0x5d, 0xfc, 0x63, 0xea, 0xed, + 0x6e, 0x76, 0x1e, 0xc7, 0xec, 0x55, 0xd8, 0x94, 0x3a, 0x28, 0xb2, 0x6c, 0xd9, 0x5a, 0x1e, 0x59, + 0xcb, 0xf3, 0xae, 0xe5, 0xd3, 0x96, 0xd9, 0x93, 0x8c, 0x70, 0x57, 0x60, 0x01, 0x1d, 0x34, 0xe9, + 0x53, 0x9b, 0x7e, 0xf2, 0xd7, 0x26, 0x6c, 0x37, 0x6a, 0x28, 0x76, 0x49, 0x9d, 0x07, 0x28, 0x34, + 0x2a, 0x5c, 0xa0, 0x82, 0x82, 0x0f, 0x3d, 0xe2, 0x0f, 0xa3, 0x83, 0x1a, 0xbb, 0xa3, 0x8f, 0x33, + 0xa1, 0x31, 0xce, 0x55, 0x11, 0x37, 0x1f, 0xce, 0xa9, 0xb5, 0xbb, 0x5d, 0xfb, 0x7b, 0xa1, 0xf1, + 0x83, 0x2a, 0xda, 0x1f, 0x3a, 0xce, 0x0e, 0xde, 0xa7, 0xb7, 0xdf, 0xd7, 0x2e, 0x59, 0xad, 0x5d, + 0xf2, 0x6b, 0xed, 0x92, 0x6f, 0x1b, 0xb7, 0xb7, 0xda, 0xb8, 0xbd, 0x9f, 0x1b, 0xb7, 0xf7, 0xe5, + 0x2a, 0x55, 0x38, 0x5f, 0xcc, 0x82, 0x07, 0xc8, 0xc3, 0xc6, 0x79, 0x35, 0x5f, 0xcc, 0xda, 0xe7, + 0xf0, 0xab, 0xbd, 0x9b, 0xb8, 0x2c, 0xa5, 0x0e, 0xcd, 0x64, 0x36, 0xb0, 0xd7, 0xf3, 0xe6, 0x77, + 0x00, 0x00, 0x00, 0xff, 0xff, 0xe5, 0x92, 0xc4, 0x2a, 0xe8, 0x02, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { @@ -204,6 +215,18 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.LastMinDeposit != nil { + { + size, err := m.LastMinDeposit.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x52 + } if len(m.Constitution) > 0 { i -= len(m.Constitution) copy(dAtA[i:], m.Constitution) @@ -367,6 +390,10 @@ func (m *GenesisState) Size() (n int) { if l > 0 { n += 1 + l + sovGenesis(uint64(l)) } + if m.LastMinDeposit != nil { + l = m.LastMinDeposit.Size() + n += 1 + l + sovGenesis(uint64(l)) + } return n } @@ -702,6 +729,42 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { } m.Constitution = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 10: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LastMinDeposit", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.LastMinDeposit == nil { + m.LastMinDeposit = &LastMinDeposit{} + } + if err := m.LastMinDeposit.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenesis(dAtA[iNdEx:]) From 55fa1589fbc8649d56215469f7faf0d6deeccb85 Mon Sep 17 00:00:00 2001 From: Giuseppe Natale <12249307+giunatale@users.noreply.github.com> Date: Tue, 10 Dec 2024 14:03:44 +0100 Subject: [PATCH 11/29] move out code from keeper.SetParams --- x/gov/keeper/msg_server.go | 9 +++++++++ x/gov/keeper/params.go | 8 -------- x/gov/simulation/genesis_test.go | 2 +- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/x/gov/keeper/msg_server.go b/x/gov/keeper/msg_server.go index 6ef0bc5d..2716cb85 100644 --- a/x/gov/keeper/msg_server.go +++ b/x/gov/keeper/msg_server.go @@ -182,6 +182,15 @@ func (k msgServer) UpdateParams(goCtx context.Context, msg *v1.MsgUpdateParams) } ctx := sdk.UnwrapSDKContext(goCtx) + + // before params change, trigger an update of the last min deposit + minDeposit := k.GetMinDeposit(ctx) + k.SetLastMinDeposit(ctx, minDeposit, ctx.BlockTime()) + // params.MinDeposit is deprecated and therefore should not be set. + // Override any set value with the current min deposit, although + // since the value of this param is ignored it will have no effect. + msg.Params.MinDeposit = minDeposit + if err := k.SetParams(ctx, msg.Params); err != nil { return nil, err } diff --git a/x/gov/keeper/params.go b/x/gov/keeper/params.go index eb4ef46e..b0fc33ca 100644 --- a/x/gov/keeper/params.go +++ b/x/gov/keeper/params.go @@ -9,14 +9,6 @@ import ( // SetParams sets the gov module's parameters. func (k Keeper) SetParams(ctx sdk.Context, params v1.Params) error { - // before params change, trigger an update of the last min deposit - minDeposit := k.GetMinDeposit(ctx) - k.SetLastMinDeposit(ctx, minDeposit, ctx.BlockTime()) - // params.MinDeposit is deprecated and therefore should not be set. - // Override any set value with the current min deposit, although - // since the value of this param is ignored it will have no effect. - params.MinDeposit = minDeposit - store := ctx.KVStore(k.storeKey) bz, err := k.cdc.Marshal(¶ms) if err != nil { diff --git a/x/gov/simulation/genesis_test.go b/x/gov/simulation/genesis_test.go index 7b42943b..a02945fe 100644 --- a/x/gov/simulation/genesis_test.go +++ b/x/gov/simulation/genesis_test.go @@ -53,7 +53,7 @@ func TestRandomizedGenState(t *testing.T) { minInitialDepositDec = "0.590000000000000000" ) - require.Equal(t, "905stake", govGenesis.Params.MinDeposit[0].String()) + require.Equal(t, nil, govGenesis.Params.MinDeposit) require.Equal(t, "77h26m10s", govGenesis.Params.MaxDepositPeriod.String()) require.Equal(t, float64(275567), govGenesis.Params.VotingPeriod.Seconds()) require.Equal(t, tallyQuorum, govGenesis.Params.Quorum) From 2a0f37613d797465bd261817328aabb7dae3d9fe Mon Sep 17 00:00:00 2001 From: Giuseppe Natale <12249307+giunatale@users.noreply.github.com> Date: Tue, 10 Dec 2024 17:08:03 +0100 Subject: [PATCH 12/29] fix sign of percChange --- x/gov/keeper/min_deposit.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/x/gov/keeper/min_deposit.go b/x/gov/keeper/min_deposit.go index 61b5b7d3..dbf5e592 100644 --- a/x/gov/keeper/min_deposit.go +++ b/x/gov/keeper/min_deposit.go @@ -105,7 +105,12 @@ func (keeper Keeper) GetMinDeposit(ctx sdk.Context) sdk.Coins { b = numActiveProposals.Sub(targetActiveProposals).ToLegacyDec() } c := a.Mul(b) - percChange = percChange.Add(c.Power(uint64(ticksPassed))) + cPow := c.Power(uint64(ticksPassed)) + if c.IsNegative() && !cPow.IsNegative() { + // ensure that the percentage change is negative if c is negative + cPow = cPow.Neg() + } + percChange = percChange.Add(cPow) } minDeposit := sdk.Coins{} From 0fc050c7df1ef2afbef6eeebbd46bac3eddf08c6 Mon Sep 17 00:00:00 2001 From: Giuseppe Natale <12249307+giunatale@users.noreply.github.com> Date: Fri, 13 Dec 2024 13:51:18 +0100 Subject: [PATCH 13/29] fix tests --- x/gov/genesis_test.go | 7 ++- x/gov/keeper/deposit_test.go | 4 +- x/gov/keeper/grpc_query_test.go | 1 + x/gov/keeper/hooks_test.go | 2 +- x/gov/keeper/min_deposit.go | 14 +++-- x/gov/keeper/msg_server_test.go | 88 ++++++++++++++++---------------- x/gov/simulation/genesis_test.go | 27 +++++----- x/gov/types/v1/genesis_test.go | 2 +- 8 files changed, 79 insertions(+), 66 deletions(-) diff --git a/x/gov/genesis_test.go b/x/gov/genesis_test.go index d45b848c..2c5e1aa6 100644 --- a/x/gov/genesis_test.go +++ b/x/gov/genesis_test.go @@ -26,6 +26,11 @@ func TestImportExportQueues_ErrorUnconsistentState(t *testing.T) { suite := createTestSuite(t) app := suite.App ctx := app.BaseApp.NewContext(false, tmproto.Header{}) + expectedGenState := v1.DefaultGenesisState() + expectedGenState.LastMinDeposit = &v1.LastMinDeposit{ + Value: sdk.NewCoins(expectedGenState.Params.MinDepositFloor...), + Time: &time.Time{}, + } require.Panics(t, func() { gov.InitGenesis(ctx, suite.AccountKeeper, suite.BankKeeper, suite.GovKeeper, &v1.GenesisState{ Deposits: v1.Deposits{ @@ -44,7 +49,7 @@ func TestImportExportQueues_ErrorUnconsistentState(t *testing.T) { }) gov.InitGenesis(ctx, suite.AccountKeeper, suite.BankKeeper, suite.GovKeeper, v1.DefaultGenesisState()) genState := gov.ExportGenesis(ctx, suite.GovKeeper) - require.Equal(t, genState, v1.DefaultGenesisState()) + require.Equal(t, genState, expectedGenState) } func TestInitGenesis(t *testing.T) { diff --git a/x/gov/keeper/deposit_test.go b/x/gov/keeper/deposit_test.go index 25e578d2..011d8db2 100644 --- a/x/gov/keeper/deposit_test.go +++ b/x/gov/keeper/deposit_test.go @@ -198,7 +198,7 @@ func TestValidateInitialDeposit(t *testing.T) { govKeeper, _, _, ctx := setupGovKeeper(t) params := v1.DefaultParams() - params.MinDeposit = tc.minDeposit + params.MinDepositFloor = tc.minDeposit params.MinInitialDepositRatio = sdk.NewDec(tc.minInitialDepositPercent).Quo(sdk.NewDec(100)).String() govKeeper.SetParams(ctx, params) @@ -273,7 +273,7 @@ func TestDepositAmount(t *testing.T) { params := v1.DefaultParams() params.MinDepositRatio = tc.minDepositRatio - params.MinDeposit = sdk.NewCoins(params.MinDeposit...).Add(sdk.NewCoin("zcoin", sdk.NewInt(10000))) // coins must be sorted by denom + params.MinDepositFloor = sdk.NewCoins(govKeeper.GetMinDeposit(ctx)...).Add(sdk.NewCoin("zcoin", sdk.NewInt(10000))) // coins must be sorted by denom err := govKeeper.SetParams(ctx, params) require.NoError(t, err) diff --git a/x/gov/keeper/grpc_query_test.go b/x/gov/keeper/grpc_query_test.go index 04f0d447..963a2d8d 100644 --- a/x/gov/keeper/grpc_query_test.go +++ b/x/gov/keeper/grpc_query_test.go @@ -799,6 +799,7 @@ func (suite *KeeperTestSuite) TestGRPCQueryParams() { queryClient := suite.queryClient params := v1.DefaultParams() + params.MinDeposit = params.MinDepositFloor var ( req *v1.QueryParamsRequest diff --git a/x/gov/keeper/hooks_test.go b/x/gov/keeper/hooks_test.go index e04091df..734ace13 100644 --- a/x/gov/keeper/hooks_test.go +++ b/x/gov/keeper/hooks_test.go @@ -47,9 +47,9 @@ func (h *MockGovHooksReceiver) AfterProposalVotingPeriodEnded(ctx sdk.Context, p } func TestHooks(t *testing.T) { - minDeposit := v1.DefaultParams().MinDeposit govKeeper, mocks, _, ctx := setupGovKeeper(t) bankKeeper, stakingKeeper := mocks.bankKeeper, mocks.stakingKeeper + minDeposit := govKeeper.GetMinDeposit(ctx) addrs := simtestutil.AddTestAddrs(bankKeeper, stakingKeeper, ctx, 1, minDeposit[0].Amount) govHooksReceiver := MockGovHooksReceiver{} diff --git a/x/gov/keeper/min_deposit.go b/x/gov/keeper/min_deposit.go index dbf5e592..8f6bf3d8 100644 --- a/x/gov/keeper/min_deposit.go +++ b/x/gov/keeper/min_deposit.go @@ -105,12 +105,16 @@ func (keeper Keeper) GetMinDeposit(ctx sdk.Context) sdk.Coins { b = numActiveProposals.Sub(targetActiveProposals).ToLegacyDec() } c := a.Mul(b) - cPow := c.Power(uint64(ticksPassed)) - if c.IsNegative() && !cPow.IsNegative() { - // ensure that the percentage change is negative if c is negative - cPow = cPow.Neg() + if ticksPassed != 0 { + cPow := c.Power(uint64(ticksPassed)) + if c.IsNegative() && !cPow.IsNegative() { + // ensure that the percentage change is negative if c is negative + cPow = cPow.Neg() + } + percChange = percChange.Add(cPow) + } else { + percChange = percChange.Add(c) } - percChange = percChange.Add(cPow) } minDeposit := sdk.Coins{} diff --git a/x/gov/keeper/msg_server_test.go b/x/gov/keeper/msg_server_test.go index 57d13ef9..893dcacb 100644 --- a/x/gov/keeper/msg_server_test.go +++ b/x/gov/keeper/msg_server_test.go @@ -23,7 +23,7 @@ func (suite *KeeperTestSuite) TestSubmitProposalReq() { coins := sdk.NewCoins(sdk.NewCoin("stake", sdk.NewInt(100000))) initialDeposit := coins - minDeposit := suite.govKeeper.GetParams(suite.ctx).MinDeposit + minDeposit := suite.govKeeper.GetMinDeposit(suite.ctx) bankMsg := &banktypes.MsgSend{ FromAddress: govAcct.String(), ToAddress: proposer.String(), @@ -142,7 +142,7 @@ func (suite *KeeperTestSuite) TestVoteReq() { proposer := addrs[0] coins := sdk.NewCoins(sdk.NewCoin("stake", sdk.NewInt(100000))) - minDeposit := suite.govKeeper.GetParams(suite.ctx).MinDeposit + minDeposit := suite.govKeeper.GetMinDeposit(suite.ctx) bankMsg := &banktypes.MsgSend{ FromAddress: govAcct.String(), ToAddress: proposer.String(), @@ -261,7 +261,7 @@ func (suite *KeeperTestSuite) TestVoteWeightedReq() { proposer := addrs[0] coins := sdk.NewCoins(sdk.NewCoin("stake", sdk.NewInt(100000))) - minDeposit := suite.govKeeper.GetParams(suite.ctx).MinDeposit + minDeposit := suite.govKeeper.GetMinDeposit(suite.ctx) bankMsg := &banktypes.MsgSend{ FromAddress: govAcct.String(), ToAddress: proposer.String(), @@ -380,7 +380,7 @@ func (suite *KeeperTestSuite) TestDepositReq() { proposer := addrs[0] coins := sdk.NewCoins(sdk.NewCoin("stake", sdk.NewInt(100000))) - minDeposit := sdk.Coins(suite.govKeeper.GetParams(suite.ctx).MinDeposit) + minDeposit := sdk.Coins(suite.govKeeper.GetMinDeposit(suite.ctx)) bankMsg := &banktypes.MsgSend{ FromAddress: govAcct.String(), ToAddress: proposer.String(), @@ -459,7 +459,7 @@ func (suite *KeeperTestSuite) TestLegacyMsgSubmitProposal() { coins := sdk.NewCoins(sdk.NewCoin("stake", sdk.NewInt(100000))) initialDeposit := coins - minDeposit := suite.govKeeper.GetParams(suite.ctx).MinDeposit + minDeposit := suite.govKeeper.GetMinDeposit(suite.ctx) cases := map[string]struct { preRun func() (*v1beta1.MsgSubmitProposal, error) @@ -507,8 +507,7 @@ func (suite *KeeperTestSuite) TestLegacyMsgVote() { addrs := suite.addrs proposer := addrs[0] - coins := sdk.NewCoins(sdk.NewCoin("stake", sdk.NewInt(100000))) - minDeposit := suite.govKeeper.GetParams(suite.ctx).MinDeposit + coins := sdk.NewCoins(sdk.NewCoin("stake", sdk.NewInt(150000))) bankMsg := &banktypes.MsgSend{ FromAddress: govAcct.String(), ToAddress: proposer.String(), @@ -517,7 +516,7 @@ func (suite *KeeperTestSuite) TestLegacyMsgVote() { msg, err := v1.NewMsgSubmitProposal( []sdk.Msg{bankMsg}, - minDeposit, + suite.govKeeper.GetMinDeposit(suite.ctx), proposer.String(), "", "Proposal", @@ -540,6 +539,7 @@ func (suite *KeeperTestSuite) TestLegacyMsgVote() { }{ "vote on inactive proposal": { preRun: func() uint64 { + bankMsg.Amount = suite.govKeeper.GetMinDeposit(suite.ctx) msg, err := v1.NewMsgSubmitProposal( []sdk.Msg{bankMsg}, coins, @@ -573,9 +573,10 @@ func (suite *KeeperTestSuite) TestLegacyMsgVote() { }, "all good": { preRun: func() uint64 { + bankMsg.Amount = suite.govKeeper.GetMinDeposit(suite.ctx) msg, err := v1.NewMsgSubmitProposal( []sdk.Msg{bankMsg}, - minDeposit, + suite.govKeeper.GetMinDeposit(suite.ctx), proposer.String(), "", "Proposal", @@ -617,7 +618,7 @@ func (suite *KeeperTestSuite) TestLegacyVoteWeighted() { proposer := addrs[0] coins := sdk.NewCoins(sdk.NewCoin("stake", sdk.NewInt(100000))) - minDeposit := suite.govKeeper.GetParams(suite.ctx).MinDeposit + minDeposit := suite.govKeeper.GetMinDeposit(suite.ctx) bankMsg := &banktypes.MsgSend{ FromAddress: govAcct.String(), ToAddress: proposer.String(), @@ -726,7 +727,7 @@ func (suite *KeeperTestSuite) TestLegacyMsgDeposit() { proposer := addrs[0] coins := sdk.NewCoins(sdk.NewCoin("stake", sdk.NewInt(100000))) - minDeposit := suite.govKeeper.GetParams(suite.ctx).MinDeposit + minDeposit := suite.govKeeper.GetMinDeposit(suite.ctx) bankMsg := &banktypes.MsgSend{ FromAddress: govAcct.String(), ToAddress: proposer.String(), @@ -821,37 +822,37 @@ func (suite *KeeperTestSuite) TestMsgUpdateParams() { expErr: true, expErrMsg: "invalid authority address", }, - { - name: "invalid min deposit", - input: func() *v1.MsgUpdateParams { - params1 := params - params1.MinDeposit = nil - - return &v1.MsgUpdateParams{ - Authority: authority, - Params: params1, - } - }, - expErr: true, - expErrMsg: "invalid minimum deposit", - }, - { - name: "negative deposit", - input: func() *v1.MsgUpdateParams { - params1 := params - params1.MinDeposit = sdk.Coins{{ - Denom: sdk.DefaultBondDenom, - Amount: sdk.NewInt(-100), - }} - - return &v1.MsgUpdateParams{ - Authority: authority, - Params: params1, - } - }, - expErr: true, - expErrMsg: "invalid minimum deposit", - }, + //{ + // name: "invalid min deposit", + // input: func() *v1.MsgUpdateParams { + // params1 := params + // params1.MinDeposit = nil + // + // return &v1.MsgUpdateParams{ + // Authority: authority, + // Params: params1, + // } + // }, + // expErr: true, + // expErrMsg: "invalid minimum deposit", + //}, + //{ + // name: "negative deposit", + // input: func() *v1.MsgUpdateParams { + // params1 := params + // params1.MinDeposit = sdk.Coins{{ + // Denom: sdk.DefaultBondDenom, + // Amount: sdk.NewInt(-100), + // }} + // + // return &v1.MsgUpdateParams{ + // Authority: authority, + // Params: params1, + // } + // }, + // expErr: true, + // expErrMsg: "invalid minimum deposit", + //}, { name: "invalid max deposit period", input: func() *v1.MsgUpdateParams { @@ -1283,9 +1284,10 @@ func (suite *KeeperTestSuite) TestSubmitProposal_InitialDeposit() { address := simtestutil.AddTestAddrs(suite.bankKeeper, suite.stakingKeeper, ctx, 1, tc.accountBalance[0].Amount)[0] params := v1.DefaultParams() - params.MinDeposit = tc.minDeposit + params.MinDepositFloor = tc.minDeposit params.MinInitialDepositRatio = tc.minInitialDepositRatio.String() govKeeper.SetParams(ctx, params) + govKeeper.SetLastMinDeposit(ctx, tc.minDeposit, ctx.BlockTime()) msg, err := v1.NewMsgSubmitProposal(TestProposal, tc.initialDeposit, address.String(), "test", "Proposal", "description of proposal") suite.Require().NoError(err) diff --git a/x/gov/simulation/genesis_test.go b/x/gov/simulation/genesis_test.go index a02945fe..3c7c4d32 100644 --- a/x/gov/simulation/genesis_test.go +++ b/x/gov/simulation/genesis_test.go @@ -11,6 +11,7 @@ import ( "github.com/cosmos/cosmos-sdk/codec" codectypes "github.com/cosmos/cosmos-sdk/codec/types" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" simtypes "github.com/cosmos/cosmos-sdk/types/simulation" @@ -44,18 +45,18 @@ func TestRandomizedGenState(t *testing.T) { simState.Cdc.MustUnmarshalJSON(simState.GenState[types.ModuleName], &govGenesis) const ( - tallyQuorum = "0.362000000000000000" - tallyThreshold = "0.639000000000000000" - amendmentQuorum = "0.579000000000000000" - amendmentThreshold = "0.895000000000000000" - lawQuorum = "0.552000000000000000" - lawThreshold = "0.816000000000000000" - minInitialDepositDec = "0.590000000000000000" + tallyQuorum = "0.311000000000000000" + tallyThreshold = "0.562000000000000000" + amendmentQuorum = "0.534000000000000000" + amendmentThreshold = "0.833000000000000000" + lawQuorum = "0.404000000000000000" + lawThreshold = "0.566000000000000000" + minInitialDepositDec = "0.060000000000000000" ) - require.Equal(t, nil, govGenesis.Params.MinDeposit) - require.Equal(t, "77h26m10s", govGenesis.Params.MaxDepositPeriod.String()) - require.Equal(t, float64(275567), govGenesis.Params.VotingPeriod.Seconds()) + require.Equal(t, []sdk.Coin{}, govGenesis.Params.MinDeposit) + require.Equal(t, "52h44m19s", govGenesis.Params.MaxDepositPeriod.String()) + require.Equal(t, float64(148296), govGenesis.Params.VotingPeriod.Seconds()) require.Equal(t, tallyQuorum, govGenesis.Params.Quorum) require.Equal(t, tallyThreshold, govGenesis.Params.Threshold) require.Equal(t, amendmentQuorum, govGenesis.Params.ConstitutionAmendmentQuorum) @@ -63,9 +64,9 @@ func TestRandomizedGenState(t *testing.T) { require.Equal(t, lawQuorum, govGenesis.Params.LawQuorum) require.Equal(t, lawThreshold, govGenesis.Params.LawThreshold) require.Equal(t, minInitialDepositDec, govGenesis.Params.MinInitialDepositRatio) - require.Equal(t, "7h46m6s", govGenesis.Params.QuorumTimeout.String()) - require.Equal(t, "82h43m30s", govGenesis.Params.MaxVotingPeriodExtension.String()) - require.Equal(t, uint64(5), govGenesis.Params.QuorumCheckCount) + require.Equal(t, "18h44m26s", govGenesis.Params.QuorumTimeout.String()) + require.Equal(t, "60h55m33s", govGenesis.Params.MaxVotingPeriodExtension.String()) + require.Equal(t, uint64(26), govGenesis.Params.QuorumCheckCount) require.Equal(t, uint64(0x28), govGenesis.StartingProposalId) require.Equal(t, []*v1.Deposit{}, govGenesis.Deposits) require.Equal(t, []*v1.Vote{}, govGenesis.Votes) diff --git a/x/gov/types/v1/genesis_test.go b/x/gov/types/v1/genesis_test.go index f5b3a030..ab4ed73b 100644 --- a/x/gov/types/v1/genesis_test.go +++ b/x/gov/types/v1/genesis_test.go @@ -43,7 +43,7 @@ func TestValidateGenesis(t *testing.T) { name: "invalid min deposit", genesisState: func() *v1.GenesisState { params1 := params - params1.MinDeposit = sdk.Coins{{ + params1.MinDepositFloor = sdk.Coins{{ Denom: sdk.DefaultBondDenom, Amount: sdk.NewInt(-100), }} From 2b95d87ee83c3e0ea257dce9049e5efe91d5e0b2 Mon Sep 17 00:00:00 2001 From: Giuseppe Natale <12249307+giunatale@users.noreply.github.com> Date: Mon, 16 Dec 2024 11:48:36 +0100 Subject: [PATCH 14/29] fix e2e tests --- tests/e2e/genesis_test.go | 6 +++++- x/gov/keeper/msg_server.go | 4 ---- x/gov/keeper/msg_server_test.go | 2 ++ x/gov/types/v1/params.go | 9 ++++++++- 4 files changed, 15 insertions(+), 6 deletions(-) diff --git a/tests/e2e/genesis_test.go b/tests/e2e/genesis_test.go index e9b25030..a64b584e 100644 --- a/tests/e2e/genesis_test.go +++ b/tests/e2e/genesis_test.go @@ -176,7 +176,7 @@ func modifyGenesis(path, moniker, amountStr string, addrAll []sdk.AccAddress, de appState[minttypes.ModuleName] = mintGenStateBz // Refactor to separate method - // amnt := sdk.NewInt(10000) + amnt := sdk.NewInt(10000) quorum, _ := sdk.NewDecFromStr("0.000000000000000001") threshold, _ := sdk.NewDecFromStr("0.000000000000000001") lawQuorum, _ := sdk.NewDecFromStr("0.000000000000000001") @@ -197,6 +197,10 @@ func modifyGenesis(path, moniker, amountStr string, addrAll []sdk.AccAddress, de sdk.ZeroDec().String(), false, false, govv1.DefaultMinDepositRatio.String(), govv1.DefaultQuorumTimeout, govv1.DefaultMaxVotingPeriodExtension, govv1.DefaultQuorumCheckCount, + sdk.NewCoins(sdk.NewCoin(denom, amnt)), govv1.DefaultMinDepositUpdatePeriod, + govv1.DefaultMinDepositSensitivityTargetDistance, + govv1.DefaultMinDepositIncreaseRatio.String(), govv1.DefaultMinDepositDecreaseRatio.String(), + govv1.DefaultTargetActiveProposals, ), ) govGenState.Constitution = "This is a test constitution" diff --git a/x/gov/keeper/msg_server.go b/x/gov/keeper/msg_server.go index 2716cb85..e7f1d919 100644 --- a/x/gov/keeper/msg_server.go +++ b/x/gov/keeper/msg_server.go @@ -186,10 +186,6 @@ func (k msgServer) UpdateParams(goCtx context.Context, msg *v1.MsgUpdateParams) // before params change, trigger an update of the last min deposit minDeposit := k.GetMinDeposit(ctx) k.SetLastMinDeposit(ctx, minDeposit, ctx.BlockTime()) - // params.MinDeposit is deprecated and therefore should not be set. - // Override any set value with the current min deposit, although - // since the value of this param is ignored it will have no effect. - msg.Params.MinDeposit = minDeposit if err := k.SetParams(ctx, msg.Params); err != nil { return nil, err diff --git a/x/gov/keeper/msg_server_test.go b/x/gov/keeper/msg_server_test.go index 893dcacb..e2221877 100644 --- a/x/gov/keeper/msg_server_test.go +++ b/x/gov/keeper/msg_server_test.go @@ -1287,6 +1287,8 @@ func (suite *KeeperTestSuite) TestSubmitProposal_InitialDeposit() { params.MinDepositFloor = tc.minDeposit params.MinInitialDepositRatio = tc.minInitialDepositRatio.String() govKeeper.SetParams(ctx, params) + // manually set last min deposit to test-case min deposit value and current block time + // so dynamic deposit system does not interfere with the test by increasing/decreasing the min deposit govKeeper.SetLastMinDeposit(ctx, tc.minDeposit, ctx.BlockTime()) msg, err := v1.NewMsgSubmitProposal(TestProposal, tc.initialDeposit, address.String(), "test", "Proposal", "description of proposal") diff --git a/x/gov/types/v1/params.go b/x/gov/types/v1/params.go index f10f6546..6bc2ac84 100644 --- a/x/gov/types/v1/params.go +++ b/x/gov/types/v1/params.go @@ -87,7 +87,7 @@ func NewParams( minDepositIncreaseRatio, minDepositDecreaseRatio string, targetActiveProposals uint64, ) Params { return Params{ - // MinDeposit: minDeposit, // Deprecated in favor of dynamic min deposit + // MinDeposit: minDeposit, // Deprecated in favor of dynamic min deposit MaxDepositPeriod: &maxDepositPeriod, VotingPeriod: &votingPeriod, Quorum: quorum, @@ -146,6 +146,13 @@ func (p Params) ValidateBasic() error { // return fmt.Errorf("invalid minimum deposit: %s", minDeposit) // } + // if mindeposit is set, return error as it is deprecated + // Q: is returning an error the best way to handle this? or perhaps just log a warning? + // after all this value is not used anymore in the codebase + if p.MinDeposit != nil { + return fmt.Errorf("manually setting min deposit is deprecated in favor of a dynamic min deposit") + } + if p.MaxDepositPeriod == nil { return fmt.Errorf("maximum deposit period must not be nil: %d", p.MaxDepositPeriod) } From 95b60281ec8e09003be224f29d39e0282c501625 Mon Sep 17 00:00:00 2001 From: Giuseppe Natale <12249307+giunatale@users.noreply.github.com> Date: Mon, 16 Dec 2024 16:14:29 +0100 Subject: [PATCH 15/29] fix formula for min deposit --- x/gov/keeper/min_deposit.go | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/x/gov/keeper/min_deposit.go b/x/gov/keeper/min_deposit.go index 8f6bf3d8..45c0e376 100644 --- a/x/gov/keeper/min_deposit.go +++ b/x/gov/keeper/min_deposit.go @@ -105,16 +105,10 @@ func (keeper Keeper) GetMinDeposit(ctx sdk.Context) sdk.Coins { b = numActiveProposals.Sub(targetActiveProposals).ToLegacyDec() } c := a.Mul(b) - if ticksPassed != 0 { - cPow := c.Power(uint64(ticksPassed)) - if c.IsNegative() && !cPow.IsNegative() { - // ensure that the percentage change is negative if c is negative - cPow = cPow.Neg() - } - percChange = percChange.Add(cPow) - } else { - percChange = percChange.Add(c) - } + percChange = percChange.Add(c) + } + if ticksPassed != 0 { + percChange = percChange.Power(uint64(ticksPassed)) } minDeposit := sdk.Coins{} From 5b8f2be4fa167517440e454fac73a775a80df67a Mon Sep 17 00:00:00 2001 From: Thomas Bruyelle Date: Mon, 16 Dec 2024 18:47:37 +0100 Subject: [PATCH 16/29] test(gov): GetMinDeposit() --- x/gov/keeper/min_deposit.go | 2 +- x/gov/keeper/min_deposit_test.go | 146 +++++++++++++++++++++++++++++++ 2 files changed, 147 insertions(+), 1 deletion(-) create mode 100644 x/gov/keeper/min_deposit_test.go diff --git a/x/gov/keeper/min_deposit.go b/x/gov/keeper/min_deposit.go index 45c0e376..f0978949 100644 --- a/x/gov/keeper/min_deposit.go +++ b/x/gov/keeper/min_deposit.go @@ -102,7 +102,7 @@ func (keeper Keeper) GetMinDeposit(ctx sdk.Context) sdk.Coins { b, err := distance.ToLegacyDec().ApproxRoot(k) if err != nil { // in case of error bypass the sensitivity, i.e. assume k = 1 - b = numActiveProposals.Sub(targetActiveProposals).ToLegacyDec() + b = distance.ToLegacyDec() } c := a.Mul(b) percChange = percChange.Add(c) diff --git a/x/gov/keeper/min_deposit_test.go b/x/gov/keeper/min_deposit_test.go new file mode 100644 index 00000000..84461240 --- /dev/null +++ b/x/gov/keeper/min_deposit_test.go @@ -0,0 +1,146 @@ +package keeper_test + +import ( + "testing" + "time" + + "github.com/stretchr/testify/assert" + + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/atomone-hub/atomone/x/gov/keeper" + v1 "github.com/atomone-hub/atomone/x/gov/types/v1" +) + +func TestGetMinDeposit(t *testing.T) { + var ( + minDepositFloor = v1.DefaultMinDepositFloor + minDepositFloorX2 = minDepositFloor.MulInt(sdk.NewInt(2)) + updatePeriod = v1.DefaultMinDepositUpdatePeriod + N = v1.DefaultTargetActiveProposals + + // Handy function used to compute the min deposit time according to the + // number of ticksPassed required. + minDepositTimeFromTicks = func(ticks int) time.Time { + return time.Now().Add(-updatePeriod*time.Duration(ticks) - time.Minute) + } + ) + tests := []struct { + name string + setup func(sdk.Context, *keeper.Keeper) + expectedMinDeposit string + }{ + { + name: "initial case no setup : expectedMinDeposit=minDepositFloor", + expectedMinDeposit: minDepositFloor.String(), + }, + { + name: "n=N-1 lastMinDeposit=minDepositFloor ticksPassed=0 : expectedMinDeposit=minDepositFloor", + setup: func(ctx sdk.Context, k *keeper.Keeper) { + k.SetActiveProposalsNumber(ctx, 0) + k.SetLastMinDeposit(ctx, minDepositFloor, minDepositTimeFromTicks(0)) + }, + expectedMinDeposit: minDepositFloor.String(), + }, + { + name: "n=N lastMinDeposit=minDepositFloor ticksPassed=0 : expectedMinDeposit=minDepositFloor", + setup: func(ctx sdk.Context, k *keeper.Keeper) { + k.SetActiveProposalsNumber(ctx, N) + k.SetLastMinDeposit(ctx, minDepositFloor, minDepositTimeFromTicks(0)) + }, + expectedMinDeposit: minDepositFloor.String(), + }, + { + name: "n=N+1 lastMinDeposit=minDepositFloor ticksPassed=0 : expectedMinDepositr>minDepositFloor", + setup: func(ctx sdk.Context, k *keeper.Keeper) { + k.SetActiveProposalsNumber(ctx, N+1) + k.SetLastMinDeposit(ctx, minDepositFloor, minDepositTimeFromTicks(0)) + }, + expectedMinDeposit: "10500000stake", + }, + { + name: "n=N-1 lastMinDeposit=minDepositFloor*2 ticksPassed=0 : minDepositlastMinDeposit*2", + setup: func(ctx sdk.Context, k *keeper.Keeper) { + k.SetActiveProposalsNumber(ctx, N+1) + k.SetLastMinDeposit(ctx, minDepositFloorX2, minDepositTimeFromTicks(0)) + }, + expectedMinDeposit: "21000000stake", + }, + { + name: "n=N-1 lastMinDeposit=minDepositFloor*2 ticksPassed=1 : expectedMinDepositlastMinDeposit*2", + setup: func(ctx sdk.Context, k *keeper.Keeper) { + k.SetActiveProposalsNumber(ctx, N+1) + k.SetLastMinDeposit(ctx, minDepositFloorX2, minDepositTimeFromTicks(1)) + }, + expectedMinDeposit: "21000000stake", + }, + { + name: "n=N-1 lastMinDeposit=minDepositFloor*2 ticksPassed=2 : expectedMinDeposit Date: Tue, 17 Dec 2024 16:11:03 +0100 Subject: [PATCH 17/29] update proto description --- proto/atomone/gov/v1/gov.proto | 2 +- x/gov/types/v1/gov.pb.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/proto/atomone/gov/v1/gov.proto b/proto/atomone/gov/v1/gov.proto index 2e20d9ba..ca301ae9 100644 --- a/proto/atomone/gov/v1/gov.proto +++ b/proto/atomone/gov/v1/gov.proto @@ -303,7 +303,7 @@ message Params { string min_deposit_increase_ratio = 26 [(cosmos_proto.scalar) = "cosmos.Dec"]; // The ratio of decrease for the minimum deposit when the number of active proposals - // is equal to the target. + // is 1 less than the target. string min_deposit_decrease_ratio = 27 [(cosmos_proto.scalar) = "cosmos.Dec"]; // A positive integer representing the sensitivity of the dynamic minimum deposit diff --git a/x/gov/types/v1/gov.pb.go b/x/gov/types/v1/gov.pb.go index 0bb9cd97..45e23c4b 100644 --- a/x/gov/types/v1/gov.pb.go +++ b/x/gov/types/v1/gov.pb.go @@ -916,7 +916,7 @@ type Params struct { // exceeds the target by 1. MinDepositIncreaseRatio string `protobuf:"bytes,26,opt,name=min_deposit_increase_ratio,json=minDepositIncreaseRatio,proto3" json:"min_deposit_increase_ratio,omitempty"` // The ratio of decrease for the minimum deposit when the number of active proposals - // is equal to the target. + // is 1 less than the target. MinDepositDecreaseRatio string `protobuf:"bytes,27,opt,name=min_deposit_decrease_ratio,json=minDepositDecreaseRatio,proto3" json:"min_deposit_decrease_ratio,omitempty"` // A positive integer representing the sensitivity of the dynamic minimum deposit // increase/decrease to the distance from the target number of active proposals. From 4b2b5b340a9dddc5909416ee726fe4722f5ad502 Mon Sep 17 00:00:00 2001 From: Giuseppe Natale <12249307+giunatale@users.noreply.github.com> Date: Thu, 19 Dec 2024 09:51:33 +0100 Subject: [PATCH 18/29] move throttler params into a struct --- proto/atomone/gov/v1/gov.proto | 52 +- x/gov/genesis.go | 2 +- x/gov/genesis_test.go | 10 +- x/gov/keeper/deposit_test.go | 4 +- x/gov/keeper/grpc_query_test.go | 2 +- x/gov/keeper/min_deposit.go | 12 +- x/gov/keeper/msg_server_test.go | 2 +- x/gov/types/v1/genesis_test.go | 4 +- x/gov/types/v1/gov.pb.go | 984 +++++++++++++++++++------------- x/gov/types/v1/params.go | 68 +-- 10 files changed, 661 insertions(+), 479 deletions(-) diff --git a/proto/atomone/gov/v1/gov.proto b/proto/atomone/gov/v1/gov.proto index ca301ae9..daa95e91 100644 --- a/proto/atomone/gov/v1/gov.proto +++ b/proto/atomone/gov/v1/gov.proto @@ -219,6 +219,33 @@ message TallyParams { string law_threshold = 6 [(cosmos_proto.scalar) = "cosmos.Dec"]; } +message MinDepositThrottler { + // Floor value for the minimum deposit required for a proposal to enter the voting period. + repeated cosmos.base.v1beta1.Coin floor_value = 1 + [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ]; + + // Duration that dictates after how long the dynamic minimum deposit should be recalculated + // for time-based updates. + google.protobuf.Duration update_period = 2 [(gogoproto.stdduration) = true]; + + // The number of active proposals the dynamic minimum deposit should target. + uint64 target_active_proposals = 3; + + // The ratio of increase for the minimum deposit when the number of active proposals + // exceeds the target by 1. + string increase_ratio = 4 [(cosmos_proto.scalar) = "cosmos.Dec"]; + + // The ratio of decrease for the minimum deposit when the number of active proposals + // is 1 less than the target. + string decrease_ratio = 5 [(cosmos_proto.scalar) = "cosmos.Dec"]; + + // A positive integer representing the sensitivity of the dynamic minimum deposit + // increase/decrease to the distance from the target number of active proposals. + // The higher the number, the lower the sensitivity. A value of 1 represents the + // highest sensitivity. + uint64 sensitivity_target_distance = 6; +} + // Params defines the parameters for the x/gov module. // // Since: cosmos-sdk 0.47 @@ -287,28 +314,5 @@ message Params { // has elapsed. Used to compute the amount of time in between quorum checks. uint64 quorum_check_count = 22; - // Floor value for the minimum deposit required for a proposal to enter the voting period. - repeated cosmos.base.v1beta1.Coin min_deposit_floor = 23 - [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ]; - - // Duration that dictates after how long the dynamic minimum deposit should be recalculated - // for time-based updates. - google.protobuf.Duration min_deposit_update_period = 24 [(gogoproto.stdduration) = true]; - - // The number of active proposals the dynamic minimum deposit should target. - uint64 target_active_proposals = 25; - - // The ratio of increase for the minimum deposit when the number of active proposals - // exceeds the target by 1. - string min_deposit_increase_ratio = 26 [(cosmos_proto.scalar) = "cosmos.Dec"]; - - // The ratio of decrease for the minimum deposit when the number of active proposals - // is 1 less than the target. - string min_deposit_decrease_ratio = 27 [(cosmos_proto.scalar) = "cosmos.Dec"]; - - // A positive integer representing the sensitivity of the dynamic minimum deposit - // increase/decrease to the distance from the target number of active proposals. - // The higher the number, the lower the sensitivity. A value of 1 represents the - // highest sensitivity. - uint64 min_deposit_sensitivity_target_distance = 28; + MinDepositThrottler min_deposit_throttler = 23; } diff --git a/x/gov/genesis.go b/x/gov/genesis.go index ea86e3f0..b66ccc6b 100644 --- a/x/gov/genesis.go +++ b/x/gov/genesis.go @@ -81,7 +81,7 @@ func InitGenesis(ctx sdk.Context, ak types.AccountKeeper, bk types.BankKeeper, k if data.LastMinDeposit != nil { k.SetLastMinDeposit(ctx, data.LastMinDeposit.Value, *data.LastMinDeposit.Time) } else { - k.SetLastMinDeposit(ctx, data.Params.MinDepositFloor, ctx.BlockTime()) + k.SetLastMinDeposit(ctx, data.Params.MinDepositThrottler.FloorValue, ctx.BlockTime()) } } diff --git a/x/gov/genesis_test.go b/x/gov/genesis_test.go index 2c5e1aa6..81f129ee 100644 --- a/x/gov/genesis_test.go +++ b/x/gov/genesis_test.go @@ -28,7 +28,7 @@ func TestImportExportQueues_ErrorUnconsistentState(t *testing.T) { ctx := app.BaseApp.NewContext(false, tmproto.Header{}) expectedGenState := v1.DefaultGenesisState() expectedGenState.LastMinDeposit = &v1.LastMinDeposit{ - Value: sdk.NewCoins(expectedGenState.Params.MinDepositFloor...), + Value: sdk.NewCoins(expectedGenState.Params.MinDepositThrottler.FloorValue...), Time: &time.Time{}, } require.Panics(t, func() { @@ -56,13 +56,17 @@ func TestInitGenesis(t *testing.T) { var ( testAddrs = simtestutil.CreateRandomAccounts(2) params = &v1.Params{ - MinDeposit: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdkmath.NewInt(42))), + MinDepositThrottler: &v1.MinDepositThrottler{ + FloorValue: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdkmath.NewInt(42))), + }, } quorumTimeout = time.Hour * 20 paramsWithQuorumCheckEnabled = &v1.Params{ - MinDeposit: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdkmath.NewInt(42))), QuorumCheckCount: 10, QuorumTimeout: &quorumTimeout, + MinDepositThrottler: &v1.MinDepositThrottler{ + FloorValue: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdkmath.NewInt(42))), + }, } depositAmount = sdk.Coins{ diff --git a/x/gov/keeper/deposit_test.go b/x/gov/keeper/deposit_test.go index 011d8db2..10f7275a 100644 --- a/x/gov/keeper/deposit_test.go +++ b/x/gov/keeper/deposit_test.go @@ -198,7 +198,7 @@ func TestValidateInitialDeposit(t *testing.T) { govKeeper, _, _, ctx := setupGovKeeper(t) params := v1.DefaultParams() - params.MinDepositFloor = tc.minDeposit + params.MinDepositThrottler.FloorValue = tc.minDeposit params.MinInitialDepositRatio = sdk.NewDec(tc.minInitialDepositPercent).Quo(sdk.NewDec(100)).String() govKeeper.SetParams(ctx, params) @@ -273,7 +273,7 @@ func TestDepositAmount(t *testing.T) { params := v1.DefaultParams() params.MinDepositRatio = tc.minDepositRatio - params.MinDepositFloor = sdk.NewCoins(govKeeper.GetMinDeposit(ctx)...).Add(sdk.NewCoin("zcoin", sdk.NewInt(10000))) // coins must be sorted by denom + params.MinDepositThrottler.FloorValue = sdk.NewCoins(govKeeper.GetMinDeposit(ctx)...).Add(sdk.NewCoin("zcoin", sdk.NewInt(10000))) // coins must be sorted by denom err := govKeeper.SetParams(ctx, params) require.NoError(t, err) diff --git a/x/gov/keeper/grpc_query_test.go b/x/gov/keeper/grpc_query_test.go index 963a2d8d..9fe0c6f9 100644 --- a/x/gov/keeper/grpc_query_test.go +++ b/x/gov/keeper/grpc_query_test.go @@ -799,7 +799,7 @@ func (suite *KeeperTestSuite) TestGRPCQueryParams() { queryClient := suite.queryClient params := v1.DefaultParams() - params.MinDeposit = params.MinDepositFloor + params.MinDeposit = params.MinDepositThrottler.FloorValue var ( req *v1.QueryParamsRequest diff --git a/x/gov/keeper/min_deposit.go b/x/gov/keeper/min_deposit.go index f0978949..a5ffeea2 100644 --- a/x/gov/keeper/min_deposit.go +++ b/x/gov/keeper/min_deposit.go @@ -79,10 +79,10 @@ func (keeper Keeper) GetLastMinDeposit(ctx sdk.Context) (sdk.Coins, time.Time) { // GetMinDeposit returns the (dynamic) minimum deposit currently required for a proposal func (keeper Keeper) GetMinDeposit(ctx sdk.Context) sdk.Coins { params := keeper.GetParams(ctx) - minDepositFloor := sdk.Coins(params.MinDepositFloor) - tick := params.MinDepositUpdatePeriod - targetActiveProposals := math.NewIntFromUint64(params.TargetActiveProposals) - k := params.MinDepositSensitivityTargetDistance + minDepositFloor := sdk.Coins(params.MinDepositThrottler.FloorValue) + tick := params.MinDepositThrottler.UpdatePeriod + targetActiveProposals := math.NewIntFromUint64(params.MinDepositThrottler.TargetActiveProposals) + k := params.MinDepositThrottler.SensitivityTargetDistance var a sdk.Dec numActiveProposals := math.NewIntFromUint64(keeper.GetActiveProposalsNumber(ctx)) @@ -91,9 +91,9 @@ func (keeper Keeper) GetMinDeposit(ctx sdk.Context) sdk.Coins { ticksPassed := ctx.BlockTime().Sub(lastMinDepositTime).Nanoseconds() / tick.Nanoseconds() if numActiveProposals.GT(targetActiveProposals) { - a = sdk.MustNewDecFromStr(params.MinDepositIncreaseRatio) + a = sdk.MustNewDecFromStr(params.MinDepositThrottler.IncreaseRatio) } else { - a = sdk.MustNewDecFromStr(params.MinDepositDecreaseRatio) + a = sdk.MustNewDecFromStr(params.MinDepositThrottler.DecreaseRatio) } distance := numActiveProposals.Sub(targetActiveProposals) diff --git a/x/gov/keeper/msg_server_test.go b/x/gov/keeper/msg_server_test.go index e2221877..38d0ecae 100644 --- a/x/gov/keeper/msg_server_test.go +++ b/x/gov/keeper/msg_server_test.go @@ -1284,7 +1284,7 @@ func (suite *KeeperTestSuite) TestSubmitProposal_InitialDeposit() { address := simtestutil.AddTestAddrs(suite.bankKeeper, suite.stakingKeeper, ctx, 1, tc.accountBalance[0].Amount)[0] params := v1.DefaultParams() - params.MinDepositFloor = tc.minDeposit + params.MinDepositThrottler.FloorValue = tc.minDeposit params.MinInitialDepositRatio = tc.minInitialDepositRatio.String() govKeeper.SetParams(ctx, params) // manually set last min deposit to test-case min deposit value and current block time diff --git a/x/gov/types/v1/genesis_test.go b/x/gov/types/v1/genesis_test.go index ab4ed73b..e4ec88bc 100644 --- a/x/gov/types/v1/genesis_test.go +++ b/x/gov/types/v1/genesis_test.go @@ -43,10 +43,12 @@ func TestValidateGenesis(t *testing.T) { name: "invalid min deposit", genesisState: func() *v1.GenesisState { params1 := params - params1.MinDepositFloor = sdk.Coins{{ + minDepositThrottler1 := *params.MinDepositThrottler + minDepositThrottler1.FloorValue = sdk.Coins{{ Denom: sdk.DefaultBondDenom, Amount: sdk.NewInt(-100), }} + params1.MinDepositThrottler = &minDepositThrottler1 return v1.NewGenesisState(v1.DefaultStartingProposalID, params1) }, diff --git a/x/gov/types/v1/gov.pb.go b/x/gov/types/v1/gov.pb.go index 45e23c4b..2e709671 100644 --- a/x/gov/types/v1/gov.pb.go +++ b/x/gov/types/v1/gov.pb.go @@ -855,6 +855,102 @@ func (m *TallyParams) GetLawThreshold() string { return "" } +type MinDepositThrottler struct { + // Floor value for the minimum deposit required for a proposal to enter the voting period. + FloorValue []types.Coin `protobuf:"bytes,1,rep,name=floor_value,json=floorValue,proto3" json:"floor_value"` + // Duration that dictates after how long the dynamic minimum deposit should be recalculated + // for time-based updates. + UpdatePeriod *time.Duration `protobuf:"bytes,2,opt,name=update_period,json=updatePeriod,proto3,stdduration" json:"update_period,omitempty"` + // The number of active proposals the dynamic minimum deposit should target. + TargetActiveProposals uint64 `protobuf:"varint,3,opt,name=target_active_proposals,json=targetActiveProposals,proto3" json:"target_active_proposals,omitempty"` + // The ratio of increase for the minimum deposit when the number of active proposals + // exceeds the target by 1. + IncreaseRatio string `protobuf:"bytes,4,opt,name=increase_ratio,json=increaseRatio,proto3" json:"increase_ratio,omitempty"` + // The ratio of decrease for the minimum deposit when the number of active proposals + // is 1 less than the target. + DecreaseRatio string `protobuf:"bytes,5,opt,name=decrease_ratio,json=decreaseRatio,proto3" json:"decrease_ratio,omitempty"` + // A positive integer representing the sensitivity of the dynamic minimum deposit + // increase/decrease to the distance from the target number of active proposals. + // The higher the number, the lower the sensitivity. A value of 1 represents the + // highest sensitivity. + SensitivityTargetDistance uint64 `protobuf:"varint,6,opt,name=sensitivity_target_distance,json=sensitivityTargetDistance,proto3" json:"sensitivity_target_distance,omitempty"` +} + +func (m *MinDepositThrottler) Reset() { *m = MinDepositThrottler{} } +func (m *MinDepositThrottler) String() string { return proto.CompactTextString(m) } +func (*MinDepositThrottler) ProtoMessage() {} +func (*MinDepositThrottler) Descriptor() ([]byte, []int) { + return fileDescriptor_ecf0f9950ff6986c, []int{10} +} +func (m *MinDepositThrottler) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MinDepositThrottler) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MinDepositThrottler.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 *MinDepositThrottler) XXX_Merge(src proto.Message) { + xxx_messageInfo_MinDepositThrottler.Merge(m, src) +} +func (m *MinDepositThrottler) XXX_Size() int { + return m.Size() +} +func (m *MinDepositThrottler) XXX_DiscardUnknown() { + xxx_messageInfo_MinDepositThrottler.DiscardUnknown(m) +} + +var xxx_messageInfo_MinDepositThrottler proto.InternalMessageInfo + +func (m *MinDepositThrottler) GetFloorValue() []types.Coin { + if m != nil { + return m.FloorValue + } + return nil +} + +func (m *MinDepositThrottler) GetUpdatePeriod() *time.Duration { + if m != nil { + return m.UpdatePeriod + } + return nil +} + +func (m *MinDepositThrottler) GetTargetActiveProposals() uint64 { + if m != nil { + return m.TargetActiveProposals + } + return 0 +} + +func (m *MinDepositThrottler) GetIncreaseRatio() string { + if m != nil { + return m.IncreaseRatio + } + return "" +} + +func (m *MinDepositThrottler) GetDecreaseRatio() string { + if m != nil { + return m.DecreaseRatio + } + return "" +} + +func (m *MinDepositThrottler) GetSensitivityTargetDistance() uint64 { + if m != nil { + return m.SensitivityTargetDistance + } + return 0 +} + // Params defines the parameters for the x/gov module. // // Since: cosmos-sdk 0.47 @@ -904,32 +1000,15 @@ type Params struct { MaxVotingPeriodExtension *time.Duration `protobuf:"bytes,21,opt,name=max_voting_period_extension,json=maxVotingPeriodExtension,proto3,stdduration" json:"max_voting_period_extension,omitempty"` // Number of times a proposal should be checked for quorum after the quorum timeout // has elapsed. Used to compute the amount of time in between quorum checks. - QuorumCheckCount uint64 `protobuf:"varint,22,opt,name=quorum_check_count,json=quorumCheckCount,proto3" json:"quorum_check_count,omitempty"` - // Floor value for the minimum deposit required for a proposal to enter the voting period. - MinDepositFloor []types.Coin `protobuf:"bytes,23,rep,name=min_deposit_floor,json=minDepositFloor,proto3" json:"min_deposit_floor"` - // Duration that dictates after how long the dynamic minimum deposit should be recalculated - // for time-based updates. - MinDepositUpdatePeriod *time.Duration `protobuf:"bytes,24,opt,name=min_deposit_update_period,json=minDepositUpdatePeriod,proto3,stdduration" json:"min_deposit_update_period,omitempty"` - // The number of active proposals the dynamic minimum deposit should target. - TargetActiveProposals uint64 `protobuf:"varint,25,opt,name=target_active_proposals,json=targetActiveProposals,proto3" json:"target_active_proposals,omitempty"` - // The ratio of increase for the minimum deposit when the number of active proposals - // exceeds the target by 1. - MinDepositIncreaseRatio string `protobuf:"bytes,26,opt,name=min_deposit_increase_ratio,json=minDepositIncreaseRatio,proto3" json:"min_deposit_increase_ratio,omitempty"` - // The ratio of decrease for the minimum deposit when the number of active proposals - // is 1 less than the target. - MinDepositDecreaseRatio string `protobuf:"bytes,27,opt,name=min_deposit_decrease_ratio,json=minDepositDecreaseRatio,proto3" json:"min_deposit_decrease_ratio,omitempty"` - // A positive integer representing the sensitivity of the dynamic minimum deposit - // increase/decrease to the distance from the target number of active proposals. - // The higher the number, the lower the sensitivity. A value of 1 represents the - // highest sensitivity. - MinDepositSensitivityTargetDistance uint64 `protobuf:"varint,28,opt,name=min_deposit_sensitivity_target_distance,json=minDepositSensitivityTargetDistance,proto3" json:"min_deposit_sensitivity_target_distance,omitempty"` + QuorumCheckCount uint64 `protobuf:"varint,22,opt,name=quorum_check_count,json=quorumCheckCount,proto3" json:"quorum_check_count,omitempty"` + MinDepositThrottler *MinDepositThrottler `protobuf:"bytes,23,opt,name=min_deposit_throttler,json=minDepositThrottler,proto3" json:"min_deposit_throttler,omitempty"` } func (m *Params) Reset() { *m = Params{} } func (m *Params) String() string { return proto.CompactTextString(m) } func (*Params) ProtoMessage() {} func (*Params) Descriptor() ([]byte, []int) { - return fileDescriptor_ecf0f9950ff6986c, []int{10} + return fileDescriptor_ecf0f9950ff6986c, []int{11} } func (m *Params) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1071,48 +1150,13 @@ func (m *Params) GetQuorumCheckCount() uint64 { return 0 } -func (m *Params) GetMinDepositFloor() []types.Coin { - if m != nil { - return m.MinDepositFloor - } - return nil -} - -func (m *Params) GetMinDepositUpdatePeriod() *time.Duration { +func (m *Params) GetMinDepositThrottler() *MinDepositThrottler { if m != nil { - return m.MinDepositUpdatePeriod + return m.MinDepositThrottler } return nil } -func (m *Params) GetTargetActiveProposals() uint64 { - if m != nil { - return m.TargetActiveProposals - } - return 0 -} - -func (m *Params) GetMinDepositIncreaseRatio() string { - if m != nil { - return m.MinDepositIncreaseRatio - } - return "" -} - -func (m *Params) GetMinDepositDecreaseRatio() string { - if m != nil { - return m.MinDepositDecreaseRatio - } - return "" -} - -func (m *Params) GetMinDepositSensitivityTargetDistance() uint64 { - if m != nil { - return m.MinDepositSensitivityTargetDistance - } - return 0 -} - func init() { proto.RegisterEnum("atomone.gov.v1.VoteOption", VoteOption_name, VoteOption_value) proto.RegisterEnum("atomone.gov.v1.ProposalStatus", ProposalStatus_name, ProposalStatus_value) @@ -1126,115 +1170,117 @@ func init() { proto.RegisterType((*DepositParams)(nil), "atomone.gov.v1.DepositParams") proto.RegisterType((*VotingParams)(nil), "atomone.gov.v1.VotingParams") proto.RegisterType((*TallyParams)(nil), "atomone.gov.v1.TallyParams") + proto.RegisterType((*MinDepositThrottler)(nil), "atomone.gov.v1.MinDepositThrottler") proto.RegisterType((*Params)(nil), "atomone.gov.v1.Params") } func init() { proto.RegisterFile("atomone/gov/v1/gov.proto", fileDescriptor_ecf0f9950ff6986c) } var fileDescriptor_ecf0f9950ff6986c = []byte{ - // 1629 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x58, 0xbf, 0x6f, 0x1b, 0xc9, - 0x15, 0xd6, 0xf2, 0x97, 0xa8, 0x47, 0x89, 0xa2, 0x46, 0xbf, 0x56, 0x94, 0x45, 0x29, 0x4c, 0x70, - 0x51, 0x1c, 0x8b, 0x8c, 0xe4, 0x83, 0x8b, 0xc3, 0x35, 0x94, 0x48, 0x39, 0x74, 0x74, 0x22, 0x6f, - 0x49, 0x2b, 0xb9, 0x2b, 0xb2, 0x18, 0x72, 0xc7, 0xd4, 0xe2, 0xb8, 0x3b, 0xbc, 0x9d, 0x59, 0x4a, - 0x6c, 0xf3, 0x17, 0x5c, 0x19, 0xa4, 0x4a, 0x99, 0x32, 0xc5, 0x01, 0xf9, 0x03, 0x82, 0x00, 0x57, - 0x05, 0x07, 0x57, 0x49, 0xe3, 0x04, 0x76, 0x11, 0xc0, 0x45, 0xba, 0xf4, 0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bd, 0xa8, 0x94, 0x33, 0xf1, - 0xd3, 0xe7, 0xdf, 0xbd, 0xcd, 0x29, 0xdf, 0xbf, 0xcd, 0x29, 0xff, 0x7c, 0x9b, 0x53, 0xbe, 0x79, - 0x97, 0x5b, 0xf8, 0xfe, 0x5d, 0x6e, 0xe1, 0x6f, 0xef, 0x72, 0x0b, 0x5f, 0x1e, 0x75, 0x4c, 0x7e, - 0xed, 0xb6, 0x0a, 0x6d, 0x6a, 0x15, 0xe5, 0x6f, 0xe2, 0xa3, 0x6b, 0xb7, 0x15, 0x3c, 0x17, 0x6f, - 0xc5, 0x1f, 0x5d, 0xf8, 0xa0, 0x47, 0x58, 0xb1, 0x7f, 0xdc, 0x4a, 0x88, 0xfe, 0x7e, 0xfa, 0xdf, - 0x00, 0x00, 0x00, 0xff, 0xff, 0x0a, 0x41, 0x04, 0x82, 0x93, 0x11, 0x00, 0x00, + // 1645 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x58, 0xbd, 0x6f, 0x23, 0xc7, + 0x15, 0xd7, 0xf2, 0x4b, 0xd4, 0xa3, 0x48, 0x51, 0x23, 0xe9, 0xb4, 0x92, 0x2c, 0x4a, 0x61, 0x02, + 0x43, 0xb9, 0x9c, 0xc8, 0x48, 0xe7, 0x5c, 0x61, 0x18, 0x01, 0x28, 0x91, 0x77, 0xe1, 0x41, 0x16, + 0xe9, 0x25, 0x2d, 0xc7, 0x29, 0xb2, 0x18, 0x72, 0xe7, 0xa8, 0x85, 0xb9, 0x3b, 0xf4, 0xce, 0x2c, + 0x25, 0xb6, 0xa9, 0x52, 0xba, 0x0c, 0x52, 0xa5, 0x4c, 0x99, 0xc2, 0x40, 0xfe, 0x80, 0x20, 0x80, + 0xab, 0xc0, 0x70, 0x95, 0x34, 0x97, 0xe0, 0xae, 0x08, 0xe0, 0x2e, 0x45, 0xfa, 0x60, 0x67, 0x66, + 0xf9,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97, 0x95, 0xf3, 0x66, 0xa5, 0x9c, 0x8d, 0xcd, 0x62, 0x3e, 0x2f, 0x55, 0x2f, 0x2a, 0xe5, 0x6c, + 0xfc, 0xec, 0xc5, 0x57, 0x6f, 0x72, 0xda, 0xd7, 0x6f, 0x72, 0xda, 0xbf, 0xde, 0xe4, 0xb4, 0x2f, + 0xde, 0xe6, 0x96, 0xbe, 0x7e, 0x9b, 0x5b, 0xfa, 0xfb, 0xdb, 0xdc, 0xd2, 0xaf, 0x8e, 0x3b, 0x36, + 0xbf, 0xf6, 0x5b, 0x85, 0x36, 0x75, 0x8a, 0x2a, 0x37, 0xc7, 0xd7, 0x7e, 0x2b, 0xfc, 0x2e, 0xde, + 0x8a, 0x3f, 0xc1, 0xf0, 0x41, 0x8f, 0xb0, 0x62, 0xff, 0xa4, 0x95, 0x10, 0x05, 0xf4, 0xf4, 0x7f, + 0x01, 0x00, 0x00, 0xff, 0xff, 0x25, 0xe0, 0x5e, 0x22, 0xa1, 0x11, 0x00, 0x00, } func (m *WeightedVoteOption) Marshal() (dAtA []byte, err error) { @@ -1797,7 +1843,7 @@ func (m *TallyParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *Params) Marshal() (dAtA []byte, err error) { +func (m *MinDepositThrottler) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1807,64 +1853,54 @@ func (m *Params) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *Params) MarshalTo(dAtA []byte) (int, error) { +func (m *MinDepositThrottler) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MinDepositThrottler) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if m.MinDepositSensitivityTargetDistance != 0 { - i = encodeVarintGov(dAtA, i, uint64(m.MinDepositSensitivityTargetDistance)) - i-- - dAtA[i] = 0x1 + if m.SensitivityTargetDistance != 0 { + i = encodeVarintGov(dAtA, i, uint64(m.SensitivityTargetDistance)) i-- - dAtA[i] = 0xe0 + dAtA[i] = 0x30 } - if len(m.MinDepositDecreaseRatio) > 0 { - i -= len(m.MinDepositDecreaseRatio) - copy(dAtA[i:], m.MinDepositDecreaseRatio) - i = encodeVarintGov(dAtA, i, uint64(len(m.MinDepositDecreaseRatio))) - i-- - dAtA[i] = 0x1 + if len(m.DecreaseRatio) > 0 { + i -= len(m.DecreaseRatio) + copy(dAtA[i:], m.DecreaseRatio) + i = encodeVarintGov(dAtA, i, uint64(len(m.DecreaseRatio))) i-- - dAtA[i] = 0xda + dAtA[i] = 0x2a } - if len(m.MinDepositIncreaseRatio) > 0 { - i -= len(m.MinDepositIncreaseRatio) - copy(dAtA[i:], m.MinDepositIncreaseRatio) - i = encodeVarintGov(dAtA, i, uint64(len(m.MinDepositIncreaseRatio))) + if len(m.IncreaseRatio) > 0 { + i -= len(m.IncreaseRatio) + copy(dAtA[i:], m.IncreaseRatio) + i = encodeVarintGov(dAtA, i, uint64(len(m.IncreaseRatio))) i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0xd2 + dAtA[i] = 0x22 } if m.TargetActiveProposals != 0 { i = encodeVarintGov(dAtA, i, uint64(m.TargetActiveProposals)) i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0xc8 + dAtA[i] = 0x18 } - if m.MinDepositUpdatePeriod != nil { - n10, err10 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(*m.MinDepositUpdatePeriod, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(*m.MinDepositUpdatePeriod):]) + if m.UpdatePeriod != nil { + n10, err10 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(*m.UpdatePeriod, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(*m.UpdatePeriod):]) if err10 != nil { return 0, err10 } i -= n10 i = encodeVarintGov(dAtA, i, uint64(n10)) i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0xc2 + dAtA[i] = 0x12 } - if len(m.MinDepositFloor) > 0 { - for iNdEx := len(m.MinDepositFloor) - 1; iNdEx >= 0; iNdEx-- { + if len(m.FloorValue) > 0 { + for iNdEx := len(m.FloorValue) - 1; iNdEx >= 0; iNdEx-- { { - size, err := m.MinDepositFloor[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + size, err := m.FloorValue[iNdEx].MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -1872,10 +1908,45 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintGov(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0xba + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *Params) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Params) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.MinDepositThrottler != nil { + { + size, err := m.MinDepositThrottler.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGov(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0xba } if m.QuorumCheckCount != 0 { i = encodeVarintGov(dAtA, i, uint64(m.QuorumCheckCount)) @@ -1885,24 +1956,24 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0xb0 } if m.MaxVotingPeriodExtension != nil { - n11, err11 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(*m.MaxVotingPeriodExtension, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(*m.MaxVotingPeriodExtension):]) - if err11 != nil { - return 0, err11 + n12, err12 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(*m.MaxVotingPeriodExtension, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(*m.MaxVotingPeriodExtension):]) + if err12 != nil { + return 0, err12 } - i -= n11 - i = encodeVarintGov(dAtA, i, uint64(n11)) + i -= n12 + i = encodeVarintGov(dAtA, i, uint64(n12)) i-- dAtA[i] = 0x1 i-- dAtA[i] = 0xaa } if m.QuorumTimeout != nil { - n12, err12 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(*m.QuorumTimeout, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(*m.QuorumTimeout):]) - if err12 != nil { - return 0, err12 + n13, err13 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(*m.QuorumTimeout, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(*m.QuorumTimeout):]) + if err13 != nil { + return 0, err13 } - i -= n12 - i = encodeVarintGov(dAtA, i, uint64(n12)) + i -= n13 + i = encodeVarintGov(dAtA, i, uint64(n13)) i-- dAtA[i] = 0x1 i-- @@ -1993,22 +2064,22 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0x22 } if m.VotingPeriod != nil { - n13, err13 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(*m.VotingPeriod, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(*m.VotingPeriod):]) - if err13 != nil { - return 0, err13 + n14, err14 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(*m.VotingPeriod, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(*m.VotingPeriod):]) + if err14 != nil { + return 0, err14 } - i -= n13 - i = encodeVarintGov(dAtA, i, uint64(n13)) + i -= n14 + i = encodeVarintGov(dAtA, i, uint64(n14)) i-- dAtA[i] = 0x1a } if m.MaxDepositPeriod != nil { - n14, err14 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(*m.MaxDepositPeriod, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(*m.MaxDepositPeriod):]) - if err14 != nil { - return 0, err14 + n15, err15 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(*m.MaxDepositPeriod, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(*m.MaxDepositPeriod):]) + if err15 != nil { + return 0, err15 } - i -= n14 - i = encodeVarintGov(dAtA, i, uint64(n14)) + i -= n15 + i = encodeVarintGov(dAtA, i, uint64(n15)) i-- dAtA[i] = 0x12 } @@ -2291,6 +2362,39 @@ func (m *TallyParams) Size() (n int) { return n } +func (m *MinDepositThrottler) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.FloorValue) > 0 { + for _, e := range m.FloorValue { + l = e.Size() + n += 1 + l + sovGov(uint64(l)) + } + } + if m.UpdatePeriod != nil { + l = github_com_cosmos_gogoproto_types.SizeOfStdDuration(*m.UpdatePeriod) + n += 1 + l + sovGov(uint64(l)) + } + if m.TargetActiveProposals != 0 { + n += 1 + sovGov(uint64(m.TargetActiveProposals)) + } + l = len(m.IncreaseRatio) + if l > 0 { + n += 1 + l + sovGov(uint64(l)) + } + l = len(m.DecreaseRatio) + if l > 0 { + n += 1 + l + sovGov(uint64(l)) + } + if m.SensitivityTargetDistance != 0 { + n += 1 + sovGov(uint64(m.SensitivityTargetDistance)) + } + return n +} + func (m *Params) Size() (n int) { if m == nil { return 0 @@ -2360,30 +2464,10 @@ func (m *Params) Size() (n int) { if m.QuorumCheckCount != 0 { n += 2 + sovGov(uint64(m.QuorumCheckCount)) } - if len(m.MinDepositFloor) > 0 { - for _, e := range m.MinDepositFloor { - l = e.Size() - n += 2 + l + sovGov(uint64(l)) - } - } - if m.MinDepositUpdatePeriod != nil { - l = github_com_cosmos_gogoproto_types.SizeOfStdDuration(*m.MinDepositUpdatePeriod) - n += 2 + l + sovGov(uint64(l)) - } - if m.TargetActiveProposals != 0 { - n += 2 + sovGov(uint64(m.TargetActiveProposals)) - } - l = len(m.MinDepositIncreaseRatio) - if l > 0 { - n += 2 + l + sovGov(uint64(l)) - } - l = len(m.MinDepositDecreaseRatio) - if l > 0 { + if m.MinDepositThrottler != nil { + l = m.MinDepositThrottler.Size() n += 2 + l + sovGov(uint64(l)) } - if m.MinDepositSensitivityTargetDistance != 0 { - n += 2 + sovGov(uint64(m.MinDepositSensitivityTargetDistance)) - } return n } @@ -4098,7 +4182,7 @@ func (m *TallyParams) Unmarshal(dAtA []byte) error { } return nil } -func (m *Params) Unmarshal(dAtA []byte) error { +func (m *MinDepositThrottler) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4121,15 +4205,15 @@ func (m *Params) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: Params: wiretype end group for non-group") + return fmt.Errorf("proto: MinDepositThrottler: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MinDepositThrottler: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MinDeposit", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field FloorValue", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -4156,14 +4240,14 @@ func (m *Params) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.MinDeposit = append(m.MinDeposit, types.Coin{}) - if err := m.MinDeposit[len(m.MinDeposit)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.FloorValue = append(m.FloorValue, types.Coin{}) + if err := m.FloorValue[len(m.FloorValue)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MaxDepositPeriod", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field UpdatePeriod", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -4190,18 +4274,18 @@ func (m *Params) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.MaxDepositPeriod == nil { - m.MaxDepositPeriod = new(time.Duration) + if m.UpdatePeriod == nil { + m.UpdatePeriod = new(time.Duration) } - if err := github_com_cosmos_gogoproto_types.StdDurationUnmarshal(m.MaxDepositPeriod, dAtA[iNdEx:postIndex]); err != nil { + if err := github_com_cosmos_gogoproto_types.StdDurationUnmarshal(m.UpdatePeriod, dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field VotingPeriod", wireType) + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TargetActiveProposals", wireType) } - var msglen int + m.TargetActiveProposals = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGov @@ -4211,31 +4295,14 @@ func (m *Params) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + m.TargetActiveProposals |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { - return ErrInvalidLengthGov - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGov - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.VotingPeriod == nil { - m.VotingPeriod = new(time.Duration) - } - if err := github_com_cosmos_gogoproto_types.StdDurationUnmarshal(m.VotingPeriod, dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex case 4: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Quorum", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field IncreaseRatio", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -4263,11 +4330,11 @@ func (m *Params) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Quorum = string(dAtA[iNdEx:postIndex]) + m.IncreaseRatio = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 5: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Threshold", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field DecreaseRatio", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -4295,13 +4362,82 @@ func (m *Params) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Threshold = string(dAtA[iNdEx:postIndex]) + m.DecreaseRatio = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 7: + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field SensitivityTargetDistance", wireType) + } + m.SensitivityTargetDistance = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.SensitivityTargetDistance |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipGov(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGov + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Params) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Params: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MinInitialDepositRatio", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field MinDeposit", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGov @@ -4311,29 +4447,31 @@ func (m *Params) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthGov } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthGov } if postIndex > l { return io.ErrUnexpectedEOF } - m.MinInitialDepositRatio = string(dAtA[iNdEx:postIndex]) + m.MinDeposit = append(m.MinDeposit, types.Coin{}) + if err := m.MinDeposit[len(m.MinDeposit)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex - case 13: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field BurnVoteQuorum", wireType) + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MaxDepositPeriod", wireType) } - var v int + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGov @@ -4343,17 +4481,33 @@ func (m *Params) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= int(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - m.BurnVoteQuorum = bool(v != 0) - case 14: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field BurnProposalDepositPrevote", wireType) + if msglen < 0 { + return ErrInvalidLengthGov } - var v int + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.MaxDepositPeriod == nil { + m.MaxDepositPeriod = new(time.Duration) + } + if err := github_com_cosmos_gogoproto_types.StdDurationUnmarshal(m.MaxDepositPeriod, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field VotingPeriod", wireType) + } + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGov @@ -4363,15 +4517,31 @@ func (m *Params) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= int(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - m.BurnProposalDepositPrevote = bool(v != 0) - case 15: + if msglen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.VotingPeriod == nil { + m.VotingPeriod = new(time.Duration) + } + if err := github_com_cosmos_gogoproto_types.StdDurationUnmarshal(m.VotingPeriod, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MinDepositRatio", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Quorum", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -4399,11 +4569,11 @@ func (m *Params) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.MinDepositRatio = string(dAtA[iNdEx:postIndex]) + m.Quorum = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 16: + case 5: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ConstitutionAmendmentQuorum", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Threshold", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -4431,11 +4601,11 @@ func (m *Params) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ConstitutionAmendmentQuorum = string(dAtA[iNdEx:postIndex]) + m.Threshold = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 17: + case 7: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ConstitutionAmendmentThreshold", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field MinInitialDepositRatio", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -4463,11 +4633,51 @@ func (m *Params) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ConstitutionAmendmentThreshold = string(dAtA[iNdEx:postIndex]) + m.MinInitialDepositRatio = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 18: + case 13: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field BurnVoteQuorum", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.BurnVoteQuorum = bool(v != 0) + case 14: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field BurnProposalDepositPrevote", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.BurnProposalDepositPrevote = bool(v != 0) + case 15: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field LawQuorum", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field MinDepositRatio", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -4495,11 +4705,11 @@ func (m *Params) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.LawQuorum = string(dAtA[iNdEx:postIndex]) + m.MinDepositRatio = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 19: + case 16: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field LawThreshold", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ConstitutionAmendmentQuorum", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -4527,13 +4737,13 @@ func (m *Params) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.LawThreshold = string(dAtA[iNdEx:postIndex]) + m.ConstitutionAmendmentQuorum = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 20: + case 17: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field QuorumTimeout", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ConstitutionAmendmentThreshold", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGov @@ -4543,33 +4753,29 @@ func (m *Params) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthGov } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthGov } if postIndex > l { return io.ErrUnexpectedEOF } - if m.QuorumTimeout == nil { - m.QuorumTimeout = new(time.Duration) - } - if err := github_com_cosmos_gogoproto_types.StdDurationUnmarshal(m.QuorumTimeout, dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.ConstitutionAmendmentThreshold = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 21: + case 18: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MaxVotingPeriodExtension", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field LawQuorum", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGov @@ -4579,33 +4785,29 @@ func (m *Params) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthGov } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthGov } if postIndex > l { return io.ErrUnexpectedEOF } - if m.MaxVotingPeriodExtension == nil { - m.MaxVotingPeriodExtension = new(time.Duration) - } - if err := github_com_cosmos_gogoproto_types.StdDurationUnmarshal(m.MaxVotingPeriodExtension, dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.LawQuorum = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 22: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field QuorumCheckCount", wireType) + case 19: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LawThreshold", wireType) } - m.QuorumCheckCount = 0 + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGov @@ -4615,14 +4817,27 @@ func (m *Params) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.QuorumCheckCount |= uint64(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - case 23: + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.LawThreshold = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 20: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MinDepositFloor", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field QuorumTimeout", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -4649,14 +4864,16 @@ func (m *Params) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.MinDepositFloor = append(m.MinDepositFloor, types.Coin{}) - if err := m.MinDepositFloor[len(m.MinDepositFloor)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if m.QuorumTimeout == nil { + m.QuorumTimeout = new(time.Duration) + } + if err := github_com_cosmos_gogoproto_types.StdDurationUnmarshal(m.QuorumTimeout, dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex - case 24: + case 21: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MinDepositUpdatePeriod", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field MaxVotingPeriodExtension", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -4683,18 +4900,18 @@ func (m *Params) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.MinDepositUpdatePeriod == nil { - m.MinDepositUpdatePeriod = new(time.Duration) + if m.MaxVotingPeriodExtension == nil { + m.MaxVotingPeriodExtension = new(time.Duration) } - if err := github_com_cosmos_gogoproto_types.StdDurationUnmarshal(m.MinDepositUpdatePeriod, dAtA[iNdEx:postIndex]); err != nil { + if err := github_com_cosmos_gogoproto_types.StdDurationUnmarshal(m.MaxVotingPeriodExtension, dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex - case 25: + case 22: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TargetActiveProposals", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field QuorumCheckCount", wireType) } - m.TargetActiveProposals = 0 + m.QuorumCheckCount = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGov @@ -4704,16 +4921,16 @@ func (m *Params) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.TargetActiveProposals |= uint64(b&0x7F) << shift + m.QuorumCheckCount |= uint64(b&0x7F) << shift if b < 0x80 { break } } - case 26: + case 23: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MinDepositIncreaseRatio", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field MinDepositThrottler", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGov @@ -4723,75 +4940,28 @@ func (m *Params) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthGov } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthGov } if postIndex > l { return io.ErrUnexpectedEOF } - m.MinDepositIncreaseRatio = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 27: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MinDepositDecreaseRatio", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGov - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } + if m.MinDepositThrottler == nil { + m.MinDepositThrottler = &MinDepositThrottler{} } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGov - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGov - } - if postIndex > l { - return io.ErrUnexpectedEOF + if err := m.MinDepositThrottler.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err } - m.MinDepositDecreaseRatio = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 28: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MinDepositSensitivityTargetDistance", wireType) - } - m.MinDepositSensitivityTargetDistance = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGov - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.MinDepositSensitivityTargetDistance |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } default: iNdEx = preIndex skippy, err := skipGov(dAtA[iNdEx:]) diff --git a/x/gov/types/v1/params.go b/x/gov/types/v1/params.go index 6bc2ac84..37c566e5 100644 --- a/x/gov/types/v1/params.go +++ b/x/gov/types/v1/params.go @@ -87,28 +87,30 @@ func NewParams( minDepositIncreaseRatio, minDepositDecreaseRatio string, targetActiveProposals uint64, ) Params { return Params{ - // MinDeposit: minDeposit, // Deprecated in favor of dynamic min deposit - MaxDepositPeriod: &maxDepositPeriod, - VotingPeriod: &votingPeriod, - Quorum: quorum, - Threshold: threshold, - ConstitutionAmendmentQuorum: constitutionAmendmentQuorum, - ConstitutionAmendmentThreshold: constitutionAmendmentThreshold, - LawQuorum: lawQuorum, - LawThreshold: lawThreshold, - MinInitialDepositRatio: minInitialDepositRatio, - BurnProposalDepositPrevote: burnProposalDeposit, - BurnVoteQuorum: burnVoteQuorum, - MinDepositRatio: minDepositRatio, - QuorumTimeout: &quorumTimeout, - MaxVotingPeriodExtension: &maxVotingPeriodExtension, - QuorumCheckCount: quorumCheckCount, - MinDepositFloor: minDepositFloor, - MinDepositUpdatePeriod: &minDepositUpdatePeriod, - MinDepositSensitivityTargetDistance: minDepositSensitivityTargetDistance, - MinDepositIncreaseRatio: minDepositIncreaseRatio, - MinDepositDecreaseRatio: minDepositDecreaseRatio, - TargetActiveProposals: targetActiveProposals, + // MinDeposit: minDeposit, // Deprecated in favor of dynamic min deposit + MaxDepositPeriod: &maxDepositPeriod, + VotingPeriod: &votingPeriod, + Quorum: quorum, + Threshold: threshold, + ConstitutionAmendmentQuorum: constitutionAmendmentQuorum, + ConstitutionAmendmentThreshold: constitutionAmendmentThreshold, + LawQuorum: lawQuorum, + LawThreshold: lawThreshold, + MinInitialDepositRatio: minInitialDepositRatio, + BurnProposalDepositPrevote: burnProposalDeposit, + BurnVoteQuorum: burnVoteQuorum, + MinDepositRatio: minDepositRatio, + QuorumTimeout: &quorumTimeout, + MaxVotingPeriodExtension: &maxVotingPeriodExtension, + QuorumCheckCount: quorumCheckCount, + MinDepositThrottler: &MinDepositThrottler{ + FloorValue: minDepositFloor, + UpdatePeriod: &minDepositUpdatePeriod, + SensitivityTargetDistance: minDepositSensitivityTargetDistance, + IncreaseRatio: minDepositIncreaseRatio, + DecreaseRatio: minDepositDecreaseRatio, + TargetActiveProposals: targetActiveProposals, + }, } } @@ -295,27 +297,27 @@ func (p Params) ValidateBasic() error { } } - if minDepositFloor := sdk.Coins(p.MinDepositFloor); minDepositFloor.Empty() || !minDepositFloor.IsValid() { + if minDepositFloor := sdk.Coins(p.MinDepositThrottler.FloorValue); minDepositFloor.Empty() || !minDepositFloor.IsValid() { return fmt.Errorf("invalid minimum deposit floor: %s", minDepositFloor) } - if p.MinDepositUpdatePeriod == nil { - return fmt.Errorf("minimum deposit update period must not be nil: %d", p.MinDepositUpdatePeriod) + if p.MinDepositThrottler.UpdatePeriod == nil { + return fmt.Errorf("minimum deposit update period must not be nil: %d", p.MinDepositThrottler.UpdatePeriod) } - if p.MinDepositUpdatePeriod.Seconds() <= 0 { - return fmt.Errorf("minimum deposit update period must be positive: %d", p.MinDepositUpdatePeriod) + if p.MinDepositThrottler.UpdatePeriod.Seconds() <= 0 { + return fmt.Errorf("minimum deposit update period must be positive: %d", p.MinDepositThrottler.UpdatePeriod) } - if p.MinDepositUpdatePeriod.Seconds() > p.VotingPeriod.Seconds() { - return fmt.Errorf("minimum deposit update period must be less than or equal to the voting period: %d", p.MinDepositUpdatePeriod) + if p.MinDepositThrottler.UpdatePeriod.Seconds() > p.VotingPeriod.Seconds() { + return fmt.Errorf("minimum deposit update period must be less than or equal to the voting period: %d", p.MinDepositThrottler.UpdatePeriod) } - if p.MinDepositSensitivityTargetDistance == 0 { - return fmt.Errorf("minimum deposit sensitivity target distance must be positive: %d", p.MinDepositSensitivityTargetDistance) + if p.MinDepositThrottler.SensitivityTargetDistance == 0 { + return fmt.Errorf("minimum deposit sensitivity target distance must be positive: %d", p.MinDepositThrottler.SensitivityTargetDistance) } - minDepositIncreaseRation, err := sdk.NewDecFromStr(p.MinDepositIncreaseRatio) + minDepositIncreaseRation, err := sdk.NewDecFromStr(p.MinDepositThrottler.IncreaseRatio) if err != nil { return fmt.Errorf("invalid minimum deposit increase ratio: %w", err) } @@ -326,7 +328,7 @@ func (p Params) ValidateBasic() error { return fmt.Errorf("minimum deposit increase ratio too large: %s", minDepositIncreaseRation) } - minDepositDecreaseRatio, err := sdk.NewDecFromStr(p.MinDepositDecreaseRatio) + minDepositDecreaseRatio, err := sdk.NewDecFromStr(p.MinDepositThrottler.DecreaseRatio) if err != nil { return fmt.Errorf("invalid minimum deposit decrease ratio: %w", err) } From d891a692e959c5ece73c03fbdce41197c8f60e61 Mon Sep 17 00:00:00 2001 From: Thomas Bruyelle Date: Fri, 20 Dec 2024 10:18:02 +0100 Subject: [PATCH 19/29] fix(gov): default genesis state is not valid MinDeposit cannot be nil even if not provided because it has a nullable false proto property. --- x/gov/types/v1/params.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/gov/types/v1/params.go b/x/gov/types/v1/params.go index 37c566e5..789a003e 100644 --- a/x/gov/types/v1/params.go +++ b/x/gov/types/v1/params.go @@ -151,7 +151,7 @@ func (p Params) ValidateBasic() error { // if mindeposit is set, return error as it is deprecated // Q: is returning an error the best way to handle this? or perhaps just log a warning? // after all this value is not used anymore in the codebase - if p.MinDeposit != nil { + if len(p.MinDeposit) > 0 { return fmt.Errorf("manually setting min deposit is deprecated in favor of a dynamic min deposit") } From 56931a9c9ae1c5f977dbb8598a5ee7138c651301 Mon Sep 17 00:00:00 2001 From: Thomas Bruyelle Date: Fri, 20 Dec 2024 11:07:58 +0100 Subject: [PATCH 20/29] test(gov): handle when lastMinDeposit has other coins than minDepositFloor --- x/gov/keeper/min_deposit_test.go | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/x/gov/keeper/min_deposit_test.go b/x/gov/keeper/min_deposit_test.go index 84461240..265b34aa 100644 --- a/x/gov/keeper/min_deposit_test.go +++ b/x/gov/keeper/min_deposit_test.go @@ -51,13 +51,25 @@ func TestGetMinDeposit(t *testing.T) { expectedMinDeposit: minDepositFloor.String(), }, { - name: "n=N+1 lastMinDeposit=minDepositFloor ticksPassed=0 : expectedMinDepositr>minDepositFloor", + name: "n=N+1 lastMinDeposit=minDepositFloor ticksPassed=0 : expectedMinDeposit>minDepositFloor", setup: func(ctx sdk.Context, k *keeper.Keeper) { k.SetActiveProposalsNumber(ctx, N+1) k.SetLastMinDeposit(ctx, minDepositFloor, minDepositTimeFromTicks(0)) }, expectedMinDeposit: "10500000stake", }, + { + name: "n=N+1 lastMinDeposit=otherCoins ticksPassed=0 : expectedMinDeposit>minDepositFloor", + setup: func(ctx sdk.Context, k *keeper.Keeper) { + k.SetActiveProposalsNumber(ctx, N+1) + k.SetLastMinDeposit(ctx, sdk.NewCoins( + sdk.NewInt64Coin("xxx", 1_000_000_000), + ), + minDepositTimeFromTicks(0), + ) + }, + expectedMinDeposit: "10500000stake", + }, { name: "n=N-1 lastMinDeposit=minDepositFloor*2 ticksPassed=0 : minDeposit Date: Fri, 20 Dec 2024 16:39:50 +0100 Subject: [PATCH 21/29] =?UTF-8?q?fix(x/gov):=20=CE=B1=20must=20be=20strict?= =?UTF-8?q?ly=20between=200=20and=201=20(#70)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Also add more tests cases --- x/gov/genesis_test.go | 20 ++++ x/gov/keeper/min_deposit_test.go | 17 +++ x/gov/keeper/msg_server_test.go | 4 +- x/gov/types/v1/genesis_test.go | 191 ++++++++++++++++++++++++++++++- x/gov/types/v1/params.go | 28 +++-- 5 files changed, 244 insertions(+), 16 deletions(-) diff --git a/x/gov/genesis_test.go b/x/gov/genesis_test.go index 81f129ee..679ebc11 100644 --- a/x/gov/genesis_test.go +++ b/x/gov/genesis_test.go @@ -99,6 +99,7 @@ func TestInitGenesis(t *testing.T) { Options: v1.NewNonSplitVoteOption(v1.OptionNo), }, } + utcTime = time.Now().UTC() depositEndTime = time.Now().Add(time.Hour * 8) votingStartTime = time.Now() votingEndTime = time.Now().Add(time.Hour * 24) @@ -171,6 +172,25 @@ func TestInitGenesis(t *testing.T) { t.Helper() p := s.GovKeeper.GetParams(ctx) assert.Equal(t, *params, p) + lmdCoins, lmdTime := s.GovKeeper.GetLastMinDeposit(ctx) + assert.EqualValues(t, p.MinDepositThrottler.FloorValue, lmdCoins) + assert.Equal(t, ctx.BlockTime(), lmdTime) + }, + }, + { + name: "ok: genesis with last min deposit", + genesis: v1.GenesisState{ + Params: params, + LastMinDeposit: &v1.LastMinDeposit{ + Value: sdk.NewCoins(sdk.NewInt64Coin("xxx", 1)), + Time: &utcTime, + }, + }, + assert: func(t *testing.T, ctx sdk.Context, s suite) { + t.Helper() + lmdCoins, lmdTime := s.GovKeeper.GetLastMinDeposit(ctx) + assert.EqualValues(t, sdk.NewCoins(sdk.NewInt64Coin("xxx", 1)), lmdCoins) + assert.Equal(t, utcTime, lmdTime) }, }, { diff --git a/x/gov/keeper/min_deposit_test.go b/x/gov/keeper/min_deposit_test.go index 265b34aa..05233772 100644 --- a/x/gov/keeper/min_deposit_test.go +++ b/x/gov/keeper/min_deposit_test.go @@ -12,6 +12,23 @@ import ( v1 "github.com/atomone-hub/atomone/x/gov/types/v1" ) +func TestActiveProposalNumber(t *testing.T) { + assert := assert.New(t) + k, _, _, ctx := setupGovKeeper(t) + + assert.EqualValues(0, k.GetActiveProposalsNumber(ctx)) + + k.IncrementActiveProposalsNumber(ctx) + k.IncrementActiveProposalsNumber(ctx) + assert.EqualValues(2, k.GetActiveProposalsNumber(ctx)) + + k.DecrementActiveProposalsNumber(ctx) + assert.EqualValues(1, k.GetActiveProposalsNumber(ctx)) + + k.SetActiveProposalsNumber(ctx, 42) + assert.EqualValues(42, k.GetActiveProposalsNumber(ctx)) +} + func TestGetMinDeposit(t *testing.T) { var ( minDepositFloor = v1.DefaultMinDepositFloor diff --git a/x/gov/keeper/msg_server_test.go b/x/gov/keeper/msg_server_test.go index 38d0ecae..f641de30 100644 --- a/x/gov/keeper/msg_server_test.go +++ b/x/gov/keeper/msg_server_test.go @@ -1120,7 +1120,7 @@ func (suite *KeeperTestSuite) TestMsgUpdateParams() { } }, expErr: true, - expErrMsg: "quorum timeout must not be nil: 0", + expErrMsg: "quorum timeout must not be nil", }, { name: "negative quorum timeout", @@ -1169,7 +1169,7 @@ func (suite *KeeperTestSuite) TestMsgUpdateParams() { } }, expErr: true, - expErrMsg: "max voting period extension must not be nil: 0", + expErrMsg: "max voting period extension must not be nil", }, { name: "voting period extension below voting period - quorum timeout", diff --git a/x/gov/types/v1/genesis_test.go b/x/gov/types/v1/genesis_test.go index e4ec88bc..12bbd228 100644 --- a/x/gov/types/v1/genesis_test.go +++ b/x/gov/types/v1/genesis_test.go @@ -2,6 +2,7 @@ package v1_test import ( "testing" + "time" "github.com/stretchr/testify/require" @@ -40,7 +41,16 @@ func TestValidateGenesis(t *testing.T) { expErrMsg: "starting proposal id must be greater than 0", }, { - name: "invalid min deposit", + name: "min deposit throttler is nil", + genesisState: func() *v1.GenesisState { + params1 := params + params1.MinDepositThrottler = nil + return v1.NewGenesisState(v1.DefaultStartingProposalID, params1) + }, + expErrMsg: "min deposit throttler must not be nil", + }, + { + name: "invalid min deposit throttler floor", genesisState: func() *v1.GenesisState { params1 := params minDepositThrottler1 := *params.MinDepositThrottler @@ -52,7 +62,184 @@ func TestValidateGenesis(t *testing.T) { return v1.NewGenesisState(v1.DefaultStartingProposalID, params1) }, - expErrMsg: "invalid minimum deposit", + expErrMsg: "invalid minimum deposit floor", + }, + { + name: "min deposit throttler update period is nil", + genesisState: func() *v1.GenesisState { + params1 := params + mdt := *params.MinDepositThrottler + mdt.UpdatePeriod = nil + params1.MinDepositThrottler = &mdt + return v1.NewGenesisState(v1.DefaultStartingProposalID, params1) + }, + expErrMsg: "minimum deposit update period must not be nil", + }, + { + name: "min deposit throttler update period is 0", + genesisState: func() *v1.GenesisState { + params1 := params + mdt := *params.MinDepositThrottler + d := time.Duration(0) + mdt.UpdatePeriod = &d + params1.MinDepositThrottler = &mdt + return v1.NewGenesisState(v1.DefaultStartingProposalID, params1) + }, + expErrMsg: "minimum deposit update period must be positive: 0s", + }, + { + name: "min deposit throttler update period is greater than voting period", + genesisState: func() *v1.GenesisState { + params1 := params + mdt := *params.MinDepositThrottler + d := *params.VotingPeriod + 1 + mdt.UpdatePeriod = &d + params1.MinDepositThrottler = &mdt + return v1.NewGenesisState(v1.DefaultStartingProposalID, params1) + }, + expErrMsg: "minimum deposit update period must be less than or equal to the voting period: 504h0m0.000000001s", + }, + { + name: "min deposit throttler sensitivity target distance is 0", + genesisState: func() *v1.GenesisState { + params1 := params + mdt := *params.MinDepositThrottler + mdt.SensitivityTargetDistance = 0 + params1.MinDepositThrottler = &mdt + return v1.NewGenesisState(v1.DefaultStartingProposalID, params1) + }, + expErrMsg: "minimum deposit sensitivity target distance must be positive: 0", + }, + { + name: "invalid min deposit throttler increase ratio", + genesisState: func() *v1.GenesisState { + params1 := params + mdt := *params.MinDepositThrottler + mdt.IncreaseRatio = "" + params1.MinDepositThrottler = &mdt + return v1.NewGenesisState(v1.DefaultStartingProposalID, params1) + }, + expErrMsg: "invalid minimum deposit increase ratio: decimal string cannot be empty", + }, + { + name: "min deposit throttler increase ratio is 0", + genesisState: func() *v1.GenesisState { + params1 := params + mdt := *params.MinDepositThrottler + mdt.IncreaseRatio = "0" + params1.MinDepositThrottler = &mdt + return v1.NewGenesisState(v1.DefaultStartingProposalID, params1) + }, + expErrMsg: "minimum deposit increase ratio must be positive: 0.000000000000000000", + }, + { + name: "min deposit throttler increase ratio is 1", + genesisState: func() *v1.GenesisState { + params1 := params + mdt := *params.MinDepositThrottler + mdt.IncreaseRatio = "1" + params1.MinDepositThrottler = &mdt + return v1.NewGenesisState(v1.DefaultStartingProposalID, params1) + }, + expErrMsg: "minimum deposit increase ratio too large: 1.000000000000000000", + }, + { + name: "invalid min deposit throttler decrease ratio", + genesisState: func() *v1.GenesisState { + params1 := params + mdt := *params.MinDepositThrottler + mdt.DecreaseRatio = "" + params1.MinDepositThrottler = &mdt + return v1.NewGenesisState(v1.DefaultStartingProposalID, params1) + }, + expErrMsg: "invalid minimum deposit decrease ratio: decimal string cannot be empty", + }, + { + name: "min deposit throttler decrease ratio is 0", + genesisState: func() *v1.GenesisState { + params1 := params + mdt := *params.MinDepositThrottler + mdt.DecreaseRatio = "0" + params1.MinDepositThrottler = &mdt + return v1.NewGenesisState(v1.DefaultStartingProposalID, params1) + }, + expErrMsg: "minimum deposit decrease ratio must be positive: 0.000000000000000000", + }, + { + name: "min deposit throttler decrease ratio is 1", + genesisState: func() *v1.GenesisState { + params1 := params + mdt := *params.MinDepositThrottler + mdt.DecreaseRatio = "1" + params1.MinDepositThrottler = &mdt + return v1.NewGenesisState(v1.DefaultStartingProposalID, params1) + }, + expErrMsg: "minimum deposit decrease ratio too large: 1.000000000000000000", + }, + { + name: "min deposit is deprecated", + genesisState: func() *v1.GenesisState { + params1 := params + params1.MinDeposit = sdk.NewCoins(sdk.NewInt64Coin("xxx", 1)) + + return v1.NewGenesisState(v1.DefaultStartingProposalID, params1) + }, + expErrMsg: "manually setting min deposit is deprecated in favor of a dynamic min deposit", + }, + { + name: "quorum timeout is nil", + genesisState: func() *v1.GenesisState { + params1 := params + params1.QuorumCheckCount = 1 + params1.QuorumTimeout = nil + + return v1.NewGenesisState(v1.DefaultStartingProposalID, params1) + }, + expErrMsg: "quorum timeout must not be nil", + }, + { + name: "quorum timeout is negative", + genesisState: func() *v1.GenesisState { + params1 := params + params1.QuorumCheckCount = 1 + d := time.Duration(-1) + params1.QuorumTimeout = &d + + return v1.NewGenesisState(v1.DefaultStartingProposalID, params1) + }, + expErrMsg: "quorum timeout must be 0 or greater: -1ns", + }, + { + name: "quorum timeout is equal to voting period", + genesisState: func() *v1.GenesisState { + params1 := params + params1.QuorumCheckCount = 1 + params1.QuorumTimeout = params.VotingPeriod + + return v1.NewGenesisState(v1.DefaultStartingProposalID, params1) + }, + expErrMsg: "quorum timeout 504h0m0s must be strictly less than the voting period 504h0m0s", + }, + { + name: "max voting period extension is nil", + genesisState: func() *v1.GenesisState { + params1 := params + params1.QuorumCheckCount = 1 + params1.MaxVotingPeriodExtension = nil + return v1.NewGenesisState(v1.DefaultStartingProposalID, params1) + }, + expErrMsg: "max voting period extension must not be nil", + }, + { + name: "max voting period extension less than voting period - quorum time out", + genesisState: func() *v1.GenesisState { + params1 := params + params1.QuorumCheckCount = 1 + d := time.Duration(-1) + params1.MaxVotingPeriodExtension = &d + return v1.NewGenesisState(v1.DefaultStartingProposalID, params1) + }, + expErrMsg: "max voting period extension -1ns must be greater than or equal to the difference between the voting period 504h0m0s and the quorum timeout 480h0m0s", }, { name: "invalid max deposit period", diff --git a/x/gov/types/v1/params.go b/x/gov/types/v1/params.go index 789a003e..1a4b120f 100644 --- a/x/gov/types/v1/params.go +++ b/x/gov/types/v1/params.go @@ -280,7 +280,7 @@ func (p Params) ValidateBasic() error { if p.QuorumCheckCount > 0 { // If quorum check is enabled, validate quorum check params if p.QuorumTimeout == nil { - return fmt.Errorf("quorum timeout must not be nil: %d", p.QuorumTimeout) + return fmt.Errorf("quorum timeout must not be nil") } if p.QuorumTimeout.Seconds() < 0 { return fmt.Errorf("quorum timeout must be 0 or greater: %s", p.QuorumTimeout) @@ -290,52 +290,56 @@ func (p Params) ValidateBasic() error { } if p.MaxVotingPeriodExtension == nil { - return fmt.Errorf("max voting period extension must not be nil: %d", p.MaxVotingPeriodExtension) + return fmt.Errorf("max voting period extension must not be nil") } if p.MaxVotingPeriodExtension.Nanoseconds() < p.VotingPeriod.Nanoseconds()-p.QuorumTimeout.Nanoseconds() { return fmt.Errorf("max voting period extension %s must be greater than or equal to the difference between the voting period %s and the quorum timeout %s", p.MaxVotingPeriodExtension, p.VotingPeriod, p.QuorumTimeout) } } + if p.MinDepositThrottler == nil { + return fmt.Errorf("min deposit throttler must not be nil") + } + if minDepositFloor := sdk.Coins(p.MinDepositThrottler.FloorValue); minDepositFloor.Empty() || !minDepositFloor.IsValid() { return fmt.Errorf("invalid minimum deposit floor: %s", minDepositFloor) } if p.MinDepositThrottler.UpdatePeriod == nil { - return fmt.Errorf("minimum deposit update period must not be nil: %d", p.MinDepositThrottler.UpdatePeriod) + return fmt.Errorf("minimum deposit update period must not be nil") } if p.MinDepositThrottler.UpdatePeriod.Seconds() <= 0 { - return fmt.Errorf("minimum deposit update period must be positive: %d", p.MinDepositThrottler.UpdatePeriod) + return fmt.Errorf("minimum deposit update period must be positive: %s", p.MinDepositThrottler.UpdatePeriod) } if p.MinDepositThrottler.UpdatePeriod.Seconds() > p.VotingPeriod.Seconds() { - return fmt.Errorf("minimum deposit update period must be less than or equal to the voting period: %d", p.MinDepositThrottler.UpdatePeriod) + return fmt.Errorf("minimum deposit update period must be less than or equal to the voting period: %s", p.MinDepositThrottler.UpdatePeriod) } if p.MinDepositThrottler.SensitivityTargetDistance == 0 { return fmt.Errorf("minimum deposit sensitivity target distance must be positive: %d", p.MinDepositThrottler.SensitivityTargetDistance) } - minDepositIncreaseRation, err := sdk.NewDecFromStr(p.MinDepositThrottler.IncreaseRatio) + minDepositIncreaseRatio, err := sdk.NewDecFromStr(p.MinDepositThrottler.IncreaseRatio) if err != nil { return fmt.Errorf("invalid minimum deposit increase ratio: %w", err) } - if minDepositIncreaseRation.IsNegative() { - return fmt.Errorf("minimum deposit increase ratio must be positive: %s", minDepositIncreaseRation) + if !minDepositIncreaseRatio.IsPositive() { + return fmt.Errorf("minimum deposit increase ratio must be positive: %s", minDepositIncreaseRatio) } - if minDepositIncreaseRation.GT(math.LegacyOneDec()) { - return fmt.Errorf("minimum deposit increase ratio too large: %s", minDepositIncreaseRation) + if minDepositIncreaseRatio.GTE(math.LegacyOneDec()) { + return fmt.Errorf("minimum deposit increase ratio too large: %s", minDepositIncreaseRatio) } minDepositDecreaseRatio, err := sdk.NewDecFromStr(p.MinDepositThrottler.DecreaseRatio) if err != nil { return fmt.Errorf("invalid minimum deposit decrease ratio: %w", err) } - if minDepositDecreaseRatio.IsNegative() { + if !minDepositDecreaseRatio.IsPositive() { return fmt.Errorf("minimum deposit decrease ratio must be positive: %s", minDepositDecreaseRatio) } - if minDepositDecreaseRatio.GT(math.LegacyOneDec()) { + if minDepositDecreaseRatio.GTE(math.LegacyOneDec()) { return fmt.Errorf("minimum deposit decrease ratio too large: %s", minDepositDecreaseRatio) } From 266436051b912dbea43b8a4bfc934eafdf542c4b Mon Sep 17 00:00:00 2001 From: Thomas Bruyelle Date: Fri, 20 Dec 2024 16:43:29 +0100 Subject: [PATCH 22/29] test(x/gov): assert ActivateVotingPeriod increments ActiveProposalNumber --- x/gov/keeper/proposal_test.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/x/gov/keeper/proposal_test.go b/x/gov/keeper/proposal_test.go index ccca4f59..73f0deb0 100644 --- a/x/gov/keeper/proposal_test.go +++ b/x/gov/keeper/proposal_test.go @@ -56,6 +56,7 @@ func (suite *KeeperTestSuite) TestActivateVotingPeriod() { params.MaxVotingPeriodExtension = &maxVotingPeriodExtension err := suite.govKeeper.SetParams(suite.ctx, params) suite.Require().NoError(err) + currentProposalNumber := suite.govKeeper.GetActiveProposalsNumber(suite.ctx) tp := TestProposal proposal, err := suite.govKeeper.SubmitProposal(suite.ctx, tp, "", "test", "summary", sdk.AccAddress("cosmos1ghekyjucln7y67ntx7cf27m9dpuxxemn4c8g4r")) @@ -65,6 +66,8 @@ func (suite *KeeperTestSuite) TestActivateVotingPeriod() { suite.govKeeper.ActivateVotingPeriod(suite.ctx, proposal) + suite.Require().Equal(currentProposalNumber+1, suite.govKeeper.GetActiveProposalsNumber(suite.ctx), + "active proposal number not incremented after proposal activation") proposal, ok := suite.govKeeper.GetProposal(suite.ctx, proposal.Id) suite.Require().True(ok) suite.Require().True(proposal.VotingStartTime.Equal(suite.ctx.BlockHeader().Time)) From 9c45704a904e398b211f4807214628d058d73587 Mon Sep 17 00:00:00 2001 From: Thomas Bruyelle Date: Fri, 20 Dec 2024 16:50:31 +0100 Subject: [PATCH 23/29] test(x/gov): assert EndBlocker decrements ActiveProposalNumber --- x/gov/abci_test.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/x/gov/abci_test.go b/x/gov/abci_test.go index 78d44996..33249c55 100644 --- a/x/gov/abci_test.go +++ b/x/gov/abci_test.go @@ -276,6 +276,7 @@ func TestTickPassedVotingPeriod(t *testing.T) { activeQueue = suite.GovKeeper.ActiveProposalQueueIterator(ctx, ctx.BlockHeader().Time) require.True(t, activeQueue.Valid()) + require.EqualValues(t, 1, suite.GovKeeper.GetActiveProposalsNumber(ctx)) activeProposalID := types.GetProposalIDFromBytes(activeQueue.Value()) proposal, ok := suite.GovKeeper.GetProposal(ctx, activeProposalID) require.True(t, ok) @@ -285,6 +286,7 @@ func TestTickPassedVotingPeriod(t *testing.T) { gov.EndBlocker(ctx, suite.GovKeeper) + require.EqualValues(t, 0, suite.GovKeeper.GetActiveProposalsNumber(ctx)) activeQueue = suite.GovKeeper.ActiveProposalQueueIterator(ctx, ctx.BlockHeader().Time) require.False(t, activeQueue.Valid()) activeQueue.Close() @@ -379,10 +381,12 @@ func TestEndBlockerProposalHandlerFailed(t *testing.T) { newHeader := ctx.BlockHeader() newHeader.Time = ctx.BlockHeader().Time.Add(*suite.GovKeeper.GetParams(ctx).MaxDepositPeriod).Add(*suite.GovKeeper.GetParams(ctx).VotingPeriod) ctx = ctx.WithBlockHeader(newHeader) + require.EqualValues(t, 1, suite.GovKeeper.GetActiveProposalsNumber(ctx)) // validate that the proposal fails/has been rejected gov.EndBlocker(ctx, suite.GovKeeper) + require.EqualValues(t, 0, suite.GovKeeper.GetActiveProposalsNumber(ctx)) proposal, ok := suite.GovKeeper.GetProposal(ctx, proposal.Id) require.True(t, ok) require.Equal(t, v1.StatusFailed, proposal.Status) From 85ec4c00b482f168cf1f3419398a953d9a5823ed Mon Sep 17 00:00:00 2001 From: Thomas Bruyelle Date: Fri, 20 Dec 2024 17:07:43 +0100 Subject: [PATCH 24/29] docs(x/gov): min_deposit deprecation details --- proto/atomone/gov/v1/gov.proto | 6 ++++-- x/gov/types/v1/gov.pb.go | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/proto/atomone/gov/v1/gov.proto b/proto/atomone/gov/v1/gov.proto index daa95e91..75f2d195 100644 --- a/proto/atomone/gov/v1/gov.proto +++ b/proto/atomone/gov/v1/gov.proto @@ -252,8 +252,10 @@ message MinDepositThrottler { message Params { // Minimum deposit for a proposal to enter voting period. // Deprecated: a dynamic system now determines the minimum deposit, - // see the other params starting with min_deposit_* and - // target_active_proposals. Setting this value has no effect. + // see the other params inside the min_deposit_throttler field. + // While setting this value returns an error, when queried it is set to the + // value of the current minimum deposit value as determined by the dynamic + // system for backward compatibility. repeated cosmos.base.v1beta1.Coin min_deposit = 1 [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true, deprecated = true ]; diff --git a/x/gov/types/v1/gov.pb.go b/x/gov/types/v1/gov.pb.go index 2e709671..f420d49a 100644 --- a/x/gov/types/v1/gov.pb.go +++ b/x/gov/types/v1/gov.pb.go @@ -957,8 +957,10 @@ func (m *MinDepositThrottler) GetSensitivityTargetDistance() uint64 { type Params struct { // Minimum deposit for a proposal to enter voting period. // Deprecated: a dynamic system now determines the minimum deposit, - // see the other params starting with min_deposit_* and - // target_active_proposals. Setting this value has no effect. + // see the other params inside the min_deposit_throttler field. + // While setting this value returns an error, when queried it is set to the + // value of the current minimum deposit value as determined by the dynamic + // system for backward compatibility. MinDeposit []types.Coin `protobuf:"bytes,1,rep,name=min_deposit,json=minDeposit,proto3" json:"min_deposit"` // Deprecated: Do not use. // Maximum period for Atom holders to deposit on a proposal. Initial value: 2 // months. From fb05dcaba40c7a1531a6806487fcd47a3e4aaef4 Mon Sep 17 00:00:00 2001 From: Giuseppe Natale <12249307+giunatale@users.noreply.github.com> Date: Tue, 14 Jan 2025 10:49:14 +0100 Subject: [PATCH 25/29] feat(x/gov): add dynamic min initial deposit (#72) This PR replicates the dynamic system implemented for the `MinDeposit` also for `MinInitialDeposit`. For proposals submissions now, since the `MinInitialDeposit` can be lower or higher than the `MinDeposit` due to the two system behaving independently, the `MinDepositRatio` check is skipped (since the `MinInitialDeposit` threshold is the one to check against to see if submission make the proposal enter deposit period). --- proto/atomone/gov/v1/genesis.proto | 3 + proto/atomone/gov/v1/gov.proto | 31 +- proto/atomone/gov/v1/query.proto | 15 + tests/e2e/genesis_test.go | 7 +- x/gov/abci.go | 2 + x/gov/abci_test.go | 17 + x/gov/client/cli/query.go | 33 + x/gov/client/cli/query_test.go | 60 ++ x/gov/genesis.go | 26 +- x/gov/genesis_test.go | 29 + x/gov/keeper/deposit.go | 35 +- x/gov/keeper/deposit_test.go | 18 +- x/gov/keeper/grpc_query.go | 8 + x/gov/keeper/hooks_test.go | 2 +- x/gov/keeper/min_initial_deposit.go | 148 +++++ x/gov/keeper/min_initial_deposit_test.go | 173 ++++++ x/gov/keeper/msg_server.go | 8 +- x/gov/keeper/msg_server_test.go | 8 +- x/gov/keeper/proposal.go | 3 + x/gov/simulation/genesis.go | 148 ++++- x/gov/simulation/genesis_test.go | 45 +- x/gov/simulation/operations.go | 19 +- x/gov/simulation/operations_test.go | 6 +- x/gov/types/keys.go | 14 + x/gov/types/v1/genesis.pb.go | 117 +++- x/gov/types/v1/gov.pb.go | 746 +++++++++++++++++++---- x/gov/types/v1/params.go | 140 ++++- x/gov/types/v1/query.pb.go | 491 ++++++++++++--- x/gov/types/v1/query.pb.gw.go | 65 ++ 29 files changed, 2069 insertions(+), 348 deletions(-) create mode 100644 x/gov/keeper/min_initial_deposit.go create mode 100644 x/gov/keeper/min_initial_deposit_test.go diff --git a/proto/atomone/gov/v1/genesis.proto b/proto/atomone/gov/v1/genesis.proto index 5fdfa6cb..29e78e27 100644 --- a/proto/atomone/gov/v1/genesis.proto +++ b/proto/atomone/gov/v1/genesis.proto @@ -37,4 +37,7 @@ message GenesisState { // last updated value for the dynamic min deposit LastMinDeposit last_min_deposit = 10; + + // last updated value for the dynamic min initial deposit + LastMinDeposit last_min_initial_deposit = 11; } diff --git a/proto/atomone/gov/v1/gov.proto b/proto/atomone/gov/v1/gov.proto index 75f2d195..b50e2ed9 100644 --- a/proto/atomone/gov/v1/gov.proto +++ b/proto/atomone/gov/v1/gov.proto @@ -246,6 +246,33 @@ message MinDepositThrottler { uint64 sensitivity_target_distance = 6; } +message MinInitialDepositThrottler { + // Floor value for the minimum initial deposit required for a proposal to enter the deposit period. + repeated cosmos.base.v1beta1.Coin floor_value = 1 + [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ]; + + // Duration that dictates after how long the dynamic minimum deposit should be recalculated + // for time-based updates. + google.protobuf.Duration update_period = 2 [(gogoproto.stdduration) = true]; + + // The number of proposals in deposit period the dynamic minimum initial deposit should target. + uint64 target_proposals = 3; + + // The ratio of increase for the minimum initial deposit when the number of proposals + // in deposit period exceeds the target by 1. + string increase_ratio = 4 [(cosmos_proto.scalar) = "cosmos.Dec"]; + + // The ratio of decrease for the minimum initial deposit when the number of proposals + // in deposit period is 1 less than the target. + string decrease_ratio = 5 [(cosmos_proto.scalar) = "cosmos.Dec"]; + + // A positive integer representing the sensitivity of the dynamic minimum initial + // deposit increase/decrease to the distance from the target number of proposals + // in deposit period. The higher the number, the lower the sensitivity. A value + // of 1 represents the highest sensitivity. + uint64 sensitivity_target_distance = 6; +} + // Params defines the parameters for the x/gov module. // // Since: cosmos-sdk 0.47 @@ -275,7 +302,7 @@ message Params { string threshold = 5 [(cosmos_proto.scalar) = "cosmos.Dec"]; // The ratio representing the proportion of the deposit value that must be paid at proposal submission. - string min_initial_deposit_ratio = 7 [(cosmos_proto.scalar) = "cosmos.Dec"]; + string min_initial_deposit_ratio = 7 [(cosmos_proto.scalar) = "cosmos.Dec", deprecated = true ]; // burn deposits if a proposal does not meet quorum bool burn_vote_quorum = 13; @@ -317,4 +344,6 @@ message Params { uint64 quorum_check_count = 22; MinDepositThrottler min_deposit_throttler = 23; + + MinInitialDepositThrottler min_initial_deposit_throttler = 24; } diff --git a/proto/atomone/gov/v1/query.proto b/proto/atomone/gov/v1/query.proto index 233932b7..3c7b274d 100644 --- a/proto/atomone/gov/v1/query.proto +++ b/proto/atomone/gov/v1/query.proto @@ -69,6 +69,12 @@ service Query { rpc MinDeposit(QueryMinDepositRequest) returns (QueryMinDepositResponse) { option (google.api.http).get = "/atomone/gov/v1/mindeposit"; } + + // MinInitialDeposit queries the minimum initial deposit + // currently required for a proposal to be submitted. + rpc MinInitialDeposit(QueryMinInitialDepositRequest) returns (QueryMinInitialDepositResponse) { + option (google.api.http).get = "/atomone/gov/v1/mininitialdeposit"; + } } // QueryConstitutionRequest is the request type for the Query/Constitution RPC method @@ -226,3 +232,12 @@ message QueryMinDepositResponse { // min_deposit defines the minimum deposit required for a proposal to enter voting period. repeated cosmos.base.v1beta1.Coin min_deposit = 1 [ (gogoproto.nullable) = false]; } + +// QueryMinInitialDepositRequest is the request type for the Query/MinInitialDeposit RPC method. +message QueryMinInitialDepositRequest {} + +// QueryMinInitialDepositResponse is the response type for the Query/MinInitialDeposit RPC method. +message QueryMinInitialDepositResponse { + // min_initial_deposit defines the minimum initial deposit required for a proposal to be submitted. + repeated cosmos.base.v1beta1.Coin min_initial_deposit = 1 [ (gogoproto.nullable) = false]; +} diff --git a/tests/e2e/genesis_test.go b/tests/e2e/genesis_test.go index a64b584e..74753049 100644 --- a/tests/e2e/genesis_test.go +++ b/tests/e2e/genesis_test.go @@ -177,6 +177,7 @@ func modifyGenesis(path, moniker, amountStr string, addrAll []sdk.AccAddress, de // Refactor to separate method amnt := sdk.NewInt(10000) + initialDepositAmnt := sdk.NewInt(100) quorum, _ := sdk.NewDecFromStr("0.000000000000000001") threshold, _ := sdk.NewDecFromStr("0.000000000000000001") lawQuorum, _ := sdk.NewDecFromStr("0.000000000000000001") @@ -194,13 +195,15 @@ func modifyGenesis(path, moniker, amountStr string, addrAll []sdk.AccAddress, de votingPeriod, quorum.String(), threshold.String(), amendmentsQuorum.String(), amendmentsThreshold.String(), lawQuorum.String(), lawThreshold.String(), - sdk.ZeroDec().String(), + // sdk.ZeroDec().String(), false, false, govv1.DefaultMinDepositRatio.String(), govv1.DefaultQuorumTimeout, govv1.DefaultMaxVotingPeriodExtension, govv1.DefaultQuorumCheckCount, sdk.NewCoins(sdk.NewCoin(denom, amnt)), govv1.DefaultMinDepositUpdatePeriod, govv1.DefaultMinDepositSensitivityTargetDistance, govv1.DefaultMinDepositIncreaseRatio.String(), govv1.DefaultMinDepositDecreaseRatio.String(), - govv1.DefaultTargetActiveProposals, + govv1.DefaultTargetActiveProposals, sdk.NewCoins(sdk.NewCoin(denom, initialDepositAmnt)), govv1.DefaultMinInitialDepositUpdatePeriod, + govv1.DefaultMinInitialDepositSensitivityTargetDistance, govv1.DefaultMinInitialDepositIncreaseRatio.String(), + govv1.DefaultMinInitialDepositDecreaseRatio.String(), govv1.DefaultTargetProposalsInDepositPeriod, ), ) govGenState.Constitution = "This is a test constitution" diff --git a/x/gov/abci.go b/x/gov/abci.go index f47a4b4e..091e1f64 100644 --- a/x/gov/abci.go +++ b/x/gov/abci.go @@ -39,6 +39,8 @@ func EndBlocker(ctx sdk.Context, keeper *keeper.Keeper) { keeper.DeleteAndBurnDeposits(ctx, proposal.Id) // burn the deposit if proposal got removed without getting 100% of the proposal } + keeper.DecrementInactiveProposalsNumber(ctx) + // called when proposal become inactive keeper.Hooks().AfterProposalFailedMinDeposit(ctx, proposal.Id) diff --git a/x/gov/abci_test.go b/x/gov/abci_test.go index 33249c55..cfbeffcf 100644 --- a/x/gov/abci_test.go +++ b/x/gov/abci_test.go @@ -71,12 +71,16 @@ func TestTickExpiredDepositPeriod(t *testing.T) { newHeader.Time = ctx.BlockHeader().Time.Add(*suite.GovKeeper.GetParams(ctx).MaxDepositPeriod) ctx = ctx.WithBlockHeader(newHeader) + require.EqualValues(t, 1, suite.GovKeeper.GetInactiveProposalsNumber(ctx)) + inactiveQueue = suite.GovKeeper.InactiveProposalQueueIterator(ctx, ctx.BlockHeader().Time) require.True(t, inactiveQueue.Valid()) inactiveQueue.Close() gov.EndBlocker(ctx, suite.GovKeeper) + require.EqualValues(t, 0, suite.GovKeeper.GetInactiveProposalsNumber(ctx)) + inactiveQueue = suite.GovKeeper.InactiveProposalQueueIterator(ctx, ctx.BlockHeader().Time) require.False(t, inactiveQueue.Valid()) inactiveQueue.Close() @@ -123,6 +127,8 @@ func TestTickMultipleExpiredDepositPeriod(t *testing.T) { require.False(t, inactiveQueue.Valid()) inactiveQueue.Close() + require.EqualValues(t, 1, suite.GovKeeper.GetInactiveProposalsNumber(ctx)) + newProposalMsg2, err := v1.NewMsgSubmitProposal( []sdk.Msg{mkTestLegacyContent(t)}, sdk.Coins{sdk.NewInt64Coin(sdk.DefaultBondDenom, 100000)}, @@ -145,6 +151,8 @@ func TestTickMultipleExpiredDepositPeriod(t *testing.T) { require.True(t, inactiveQueue.Valid()) inactiveQueue.Close() + require.EqualValues(t, 2, suite.GovKeeper.GetInactiveProposalsNumber(ctx)) + gov.EndBlocker(ctx, suite.GovKeeper) inactiveQueue = suite.GovKeeper.InactiveProposalQueueIterator(ctx, ctx.BlockHeader().Time) @@ -159,8 +167,12 @@ func TestTickMultipleExpiredDepositPeriod(t *testing.T) { require.True(t, inactiveQueue.Valid()) inactiveQueue.Close() + require.EqualValues(t, 1, suite.GovKeeper.GetInactiveProposalsNumber(ctx)) + gov.EndBlocker(ctx, suite.GovKeeper) + require.EqualValues(t, 0, suite.GovKeeper.GetInactiveProposalsNumber(ctx)) + inactiveQueue = suite.GovKeeper.InactiveProposalQueueIterator(ctx, ctx.BlockHeader().Time) require.False(t, inactiveQueue.Valid()) inactiveQueue.Close() @@ -212,6 +224,8 @@ func TestTickPassedDepositPeriod(t *testing.T) { require.False(t, inactiveQueue.Valid()) inactiveQueue.Close() + require.EqualValues(t, 1, suite.GovKeeper.GetInactiveProposalsNumber(ctx)) + newDepositMsg := v1.NewMsgDeposit(addrs[1], proposalID, sdk.Coins{sdk.NewInt64Coin(sdk.DefaultBondDenom, 100000)}) res1, err := govMsgSvr.Deposit(sdk.WrapSDKContext(ctx), newDepositMsg) @@ -221,6 +235,9 @@ func TestTickPassedDepositPeriod(t *testing.T) { activeQueue = suite.GovKeeper.ActiveProposalQueueIterator(ctx, ctx.BlockHeader().Time) require.False(t, activeQueue.Valid()) activeQueue.Close() + + require.EqualValues(t, 1, suite.GovKeeper.GetInactiveProposalsNumber(ctx)) + require.EqualValues(t, 0, suite.GovKeeper.GetActiveProposalsNumber(ctx)) } func TestTickPassedVotingPeriod(t *testing.T) { diff --git a/x/gov/client/cli/query.go b/x/gov/client/cli/query.go index 6713c557..32fb1ceb 100644 --- a/x/gov/client/cli/query.go +++ b/x/gov/client/cli/query.go @@ -41,6 +41,7 @@ func GetQueryCmd() *cobra.Command { GetCmdQueryTally(), GetCmdConstitution(), GetCmdQueryMinDeposit(), + GetCmdQueryMinInitialDeposit(), ) return govQueryCmd @@ -709,3 +710,35 @@ $ %s query gov min-deposit }, } } + +// GetCmdQueryMinInitialDeposit implements the query min initial deposit command. +func GetCmdQueryMinInitialDeposit() *cobra.Command { + return &cobra.Command{ + Use: "min-initial-deposit", + Args: cobra.ExactArgs(0), + Short: "Query the minimum initial deposit needed for a proposal to enter deposit period", + Long: strings.TrimSpace( + fmt.Sprintf(`Query the minimum initial deposit needed for a proposal to enter deposit period. + +Example: +$ %s query gov min-initial-deposit +`, + version.AppName, + ), + ), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + queryClient := v1.NewQueryClient(clientCtx) + + resp, err := queryClient.MinInitialDeposit(cmd.Context(), &v1.QueryMinInitialDepositRequest{}) + if err != nil { + return err + } + + return clientCtx.PrintProto(resp) + }, + } +} diff --git a/x/gov/client/cli/query_test.go b/x/gov/client/cli/query_test.go index 68bd901c..e9cb499c 100644 --- a/x/gov/client/cli/query_test.go +++ b/x/gov/client/cli/query_test.go @@ -406,3 +406,63 @@ func (s *CLITestSuite) TestCmdGetConstitution() { }) } } + +func (s *CLITestSuite) TestCmdQueryMinDeposit() { + testCases := []struct { + name string + args []string + expCmdOutput string + }{ + { + "query min deposit", + []string{}, + "", + }, + { + "query min deposit (json output)", + []string{ + fmt.Sprintf("--%s=json", flags.FlagOutput), + }, + "--output=json", + }, + } + + for _, tc := range testCases { + tc := tc + s.Run(tc.name, func() { + cmd := cli.GetCmdQueryMinDeposit() + cmd.SetArgs(tc.args) + s.Require().Contains(fmt.Sprint(cmd), strings.TrimSpace(tc.expCmdOutput)) + }) + } +} + +func (s *CLITestSuite) TestCmdQueryMinInitialDeposit() { + testCases := []struct { + name string + args []string + expCmdOutput string + }{ + { + "query min initial deposit", + []string{}, + "", + }, + { + "query min initial deposit (json output)", + []string{ + fmt.Sprintf("--%s=json", flags.FlagOutput), + }, + "--output=json", + }, + } + + for _, tc := range testCases { + tc := tc + s.Run(tc.name, func() { + cmd := cli.GetCmdQueryMinInitialDeposit() + cmd.SetArgs(tc.args) + s.Require().Contains(fmt.Sprint(cmd), strings.TrimSpace(tc.expCmdOutput)) + }) + } +} diff --git a/x/gov/genesis.go b/x/gov/genesis.go index b66ccc6b..d14a8378 100644 --- a/x/gov/genesis.go +++ b/x/gov/genesis.go @@ -83,6 +83,12 @@ func InitGenesis(ctx sdk.Context, ak types.AccountKeeper, bk types.BankKeeper, k } else { k.SetLastMinDeposit(ctx, data.Params.MinDepositThrottler.FloorValue, ctx.BlockTime()) } + + if data.LastMinInitialDeposit != nil { + k.SetLastMinInitialDeposit(ctx, data.LastMinInitialDeposit.Value, *data.LastMinInitialDeposit.Time) + } else { + k.SetLastMinInitialDeposit(ctx, data.Params.MinInitialDepositThrottler.FloorValue, ctx.BlockTime()) + } } // ExportGenesis - output genesis parameters @@ -108,13 +114,19 @@ func ExportGenesis(ctx sdk.Context, k *keeper.Keeper) *v1.GenesisState { Time: &blockTime, } + lastMinInitialDeposit := v1.LastMinDeposit{ + Value: k.GetMinInitialDeposit(ctx), + Time: &blockTime, + } + return &v1.GenesisState{ - StartingProposalId: startingProposalID, - Deposits: proposalsDeposits, - Votes: proposalsVotes, - Proposals: proposals, - Params: ¶ms, - Constitution: constitution, - LastMinDeposit: &lastMinDeposit, + StartingProposalId: startingProposalID, + Deposits: proposalsDeposits, + Votes: proposalsVotes, + Proposals: proposals, + Params: ¶ms, + Constitution: constitution, + LastMinDeposit: &lastMinDeposit, + LastMinInitialDeposit: &lastMinInitialDeposit, } } diff --git a/x/gov/genesis_test.go b/x/gov/genesis_test.go index 679ebc11..32460c35 100644 --- a/x/gov/genesis_test.go +++ b/x/gov/genesis_test.go @@ -31,6 +31,10 @@ func TestImportExportQueues_ErrorUnconsistentState(t *testing.T) { Value: sdk.NewCoins(expectedGenState.Params.MinDepositThrottler.FloorValue...), Time: &time.Time{}, } + expectedGenState.LastMinInitialDeposit = &v1.LastMinDeposit{ + Value: expectedGenState.Params.MinInitialDepositThrottler.FloorValue, + Time: &time.Time{}, + } require.Panics(t, func() { gov.InitGenesis(ctx, suite.AccountKeeper, suite.BankKeeper, suite.GovKeeper, &v1.GenesisState{ Deposits: v1.Deposits{ @@ -59,6 +63,9 @@ func TestInitGenesis(t *testing.T) { MinDepositThrottler: &v1.MinDepositThrottler{ FloorValue: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdkmath.NewInt(42))), }, + MinInitialDepositThrottler: &v1.MinInitialDepositThrottler{ + FloorValue: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdkmath.NewInt(42))), + }, } quorumTimeout = time.Hour * 20 paramsWithQuorumCheckEnabled = &v1.Params{ @@ -67,6 +74,9 @@ func TestInitGenesis(t *testing.T) { MinDepositThrottler: &v1.MinDepositThrottler{ FloorValue: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdkmath.NewInt(42))), }, + MinInitialDepositThrottler: &v1.MinInitialDepositThrottler{ + FloorValue: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdkmath.NewInt(42))), + }, } depositAmount = sdk.Coins{ @@ -175,6 +185,9 @@ func TestInitGenesis(t *testing.T) { lmdCoins, lmdTime := s.GovKeeper.GetLastMinDeposit(ctx) assert.EqualValues(t, p.MinDepositThrottler.FloorValue, lmdCoins) assert.Equal(t, ctx.BlockTime(), lmdTime) + lmidCoins, lmidTime := s.GovKeeper.GetLastMinInitialDeposit(ctx) + assert.EqualValues(t, p.MinInitialDepositThrottler.FloorValue, lmidCoins) + assert.Equal(t, ctx.BlockTime(), lmidTime) }, }, { @@ -193,6 +206,22 @@ func TestInitGenesis(t *testing.T) { assert.Equal(t, utcTime, lmdTime) }, }, + { + name: "ok: genesis with last min initial deposit", + genesis: v1.GenesisState{ + Params: params, + LastMinInitialDeposit: &v1.LastMinDeposit{ + Value: sdk.NewCoins(sdk.NewInt64Coin("xxx", 1)), + Time: &utcTime, + }, + }, + assert: func(t *testing.T, ctx sdk.Context, s suite) { + t.Helper() + lmidCoins, lmidTime := s.GovKeeper.GetLastMinInitialDeposit(ctx) + assert.EqualValues(t, sdk.NewCoins(sdk.NewInt64Coin("xxx", 1)), lmidCoins) + assert.Equal(t, utcTime, lmidTime) + }, + }, { name: "fail: genesis with deposits but module balance is not equal to total deposits", moduleBalance: depositAmount, diff --git a/x/gov/keeper/deposit.go b/x/gov/keeper/deposit.go index dec086d1..b501ec99 100644 --- a/x/gov/keeper/deposit.go +++ b/x/gov/keeper/deposit.go @@ -110,7 +110,7 @@ func (keeper Keeper) IterateDeposits(ctx sdk.Context, proposalID uint64, cb func // AddDeposit adds or updates a deposit of a specific depositor on a specific proposal. // Activates voting period when appropriate and returns true in that case, else returns false. -func (keeper Keeper) AddDeposit(ctx sdk.Context, proposalID uint64, depositorAddr sdk.AccAddress, depositAmount sdk.Coins) (bool, error) { +func (keeper Keeper) AddDeposit(ctx sdk.Context, proposalID uint64, depositorAddr sdk.AccAddress, depositAmount sdk.Coins, skipMinDepositRatioCheck bool) (bool, error) { // Checks to see if proposal exists proposal, ok := keeper.GetProposal(ctx, proposalID) if !ok { @@ -122,7 +122,6 @@ func (keeper Keeper) AddDeposit(ctx sdk.Context, proposalID uint64, depositorAdd return false, sdkerrors.Wrapf(types.ErrInactiveProposal, "%d", proposalID) } - skipMinDepositRatioCheck := false minDeposit := keeper.GetMinDeposit(ctx) // Check if deposit has already sufficient total funds to transition the proposal into the voting period // perhaps because the min deposit was lowered in the meantime. If so, the minDepositRatio check is skipped, @@ -238,23 +237,25 @@ func (keeper Keeper) RefundAndDeleteDeposits(ctx sdk.Context, proposalID uint64) // the deposit parameters. Returns nil on success, error otherwise. func (keeper Keeper) validateInitialDeposit(ctx sdk.Context, initialDeposit sdk.Coins) error { if !initialDeposit.IsValid() || initialDeposit.IsAnyNegative() { - return sdkerrors.Wrapf(sdkerrors1.ErrInvalidCoins, initialDeposit.String()) + return sdkerrors.Wrapf(sdkerrors1.ErrInvalidCoins, "%s", initialDeposit.String()) } - params := keeper.GetParams(ctx) - minInitialDepositRatio, err := sdk.NewDecFromStr(params.MinInitialDepositRatio) - if err != nil { - return err - } - if minInitialDepositRatio.IsZero() { - return nil - } - minDepositCoins := keeper.GetMinDeposit(ctx) - for i := range minDepositCoins { - minDepositCoins[i].Amount = sdk.NewDecFromInt(minDepositCoins[i].Amount).Mul(minInitialDepositRatio).RoundInt() - } - if !initialDeposit.IsAllGTE(minDepositCoins) { - return sdkerrors.Wrapf(types.ErrMinDepositTooSmall, "was (%s), need (%s)", initialDeposit, minDepositCoins) + // params := keeper.GetParams(ctx) + // minInitialDepositRatio, err := sdk.NewDecFromStr(params.MinInitialDepositRatio) + // if err != nil { + // return err + // } + // if minInitialDepositRatio.IsZero() { + // return nil + // } + // minDepositCoins := keeper.GetMinDeposit(ctx) + // for i := range minDepositCoins { + // minDepositCoins[i].Amount = sdk.NewDecFromInt(minDepositCoins[i].Amount).Mul(minInitialDepositRatio).RoundInt() + // } + + minInitialDepositCoins := keeper.GetMinInitialDeposit(ctx) + if !initialDeposit.IsAllGTE(minInitialDepositCoins) { + return sdkerrors.Wrapf(types.ErrMinDepositTooSmall, "was (%s), need (%s)", initialDeposit, minInitialDepositCoins) } return nil } diff --git a/x/gov/keeper/deposit_test.go b/x/gov/keeper/deposit_test.go index 10f7275a..b3a0aac6 100644 --- a/x/gov/keeper/deposit_test.go +++ b/x/gov/keeper/deposit_test.go @@ -3,6 +3,7 @@ package keeper_test import ( "testing" + "cosmossdk.io/math" "github.com/stretchr/testify/require" simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" @@ -43,7 +44,7 @@ func TestDeposits(t *testing.T) { require.Nil(t, proposal.VotingStartTime) // Check first deposit - votingStarted, err := govKeeper.AddDeposit(ctx, proposalID, TestAddrs[0], fourStake) + votingStarted, err := govKeeper.AddDeposit(ctx, proposalID, TestAddrs[0], fourStake, false) require.NoError(t, err) require.False(t, votingStarted) deposit, found = govKeeper.GetDeposit(ctx, proposalID, TestAddrs[0]) @@ -56,7 +57,7 @@ func TestDeposits(t *testing.T) { require.Equal(t, addr0Initial.Sub(fourStake...), bankKeeper.GetAllBalances(ctx, TestAddrs[0])) // Check a second deposit from same address - votingStarted, err = govKeeper.AddDeposit(ctx, proposalID, TestAddrs[0], fiveStake) + votingStarted, err = govKeeper.AddDeposit(ctx, proposalID, TestAddrs[0], fiveStake, false) require.NoError(t, err) require.False(t, votingStarted) deposit, found = govKeeper.GetDeposit(ctx, proposalID, TestAddrs[0]) @@ -69,7 +70,7 @@ func TestDeposits(t *testing.T) { require.Equal(t, addr0Initial.Sub(fourStake...).Sub(fiveStake...), bankKeeper.GetAllBalances(ctx, TestAddrs[0])) // Check third deposit from a new address - votingStarted, err = govKeeper.AddDeposit(ctx, proposalID, TestAddrs[1], fourStake) + votingStarted, err = govKeeper.AddDeposit(ctx, proposalID, TestAddrs[1], fourStake, false) require.NoError(t, err) require.True(t, votingStarted) deposit, found = govKeeper.GetDeposit(ctx, proposalID, TestAddrs[1]) @@ -110,7 +111,7 @@ func TestDeposits(t *testing.T) { proposal, err = govKeeper.SubmitProposal(ctx, tp, "", "title", "description", TestAddrs[0]) require.NoError(t, err) proposalID = proposal.Id - _, err = govKeeper.AddDeposit(ctx, proposalID, TestAddrs[0], fourStake) + _, err = govKeeper.AddDeposit(ctx, proposalID, TestAddrs[0], fourStake, false) require.NoError(t, err) govKeeper.DeleteAndBurnDeposits(ctx, proposalID) deposits = govKeeper.GetDeposits(ctx, proposalID) @@ -199,7 +200,12 @@ func TestValidateInitialDeposit(t *testing.T) { params := v1.DefaultParams() params.MinDepositThrottler.FloorValue = tc.minDeposit - params.MinInitialDepositRatio = sdk.NewDec(tc.minInitialDepositPercent).Quo(sdk.NewDec(100)).String() + // params.MinInitialDepositRatio = sdk.NewDec(tc.minInitialDepositPercent).Quo(sdk.NewDec(100)).String() + minInitialDepositFloor := sdk.NewCoins() + for _, coin := range tc.minDeposit { + minInitialDepositFloor = minInitialDepositFloor.Add(sdk.NewCoin(coin.Denom, sdk.NewDec(tc.minInitialDepositPercent).Quo(math.LegacyDec(sdk.NewDec(100))).MulInt(coin.Amount).TruncateInt())) + } + params.MinInitialDepositThrottler.FloorValue = minInitialDepositFloor govKeeper.SetParams(ctx, params) @@ -282,7 +288,7 @@ func TestDepositAmount(t *testing.T) { require.NoError(t, err) proposalID := proposal.Id - _, err = govKeeper.AddDeposit(ctx, proposalID, testAddrs[0], tc.deposit) + _, err = govKeeper.AddDeposit(ctx, proposalID, testAddrs[0], tc.deposit, false) if tc.err != "" { require.Error(t, err) require.Equal(t, tc.err, err.Error()) diff --git a/x/gov/keeper/grpc_query.go b/x/gov/keeper/grpc_query.go index 3faeb0a1..9335d4d8 100644 --- a/x/gov/keeper/grpc_query.go +++ b/x/gov/keeper/grpc_query.go @@ -299,6 +299,14 @@ func (q Keeper) MinDeposit(c context.Context, req *v1.QueryMinDepositRequest) (* return &v1.QueryMinDepositResponse{MinDeposit: minDeposit}, nil } +// MinInitialDeposit returns the minimum deposit required for a proposal to be submitted +func (q Keeper) MinInitialDeposit(c context.Context, req *v1.QueryMinInitialDepositRequest) (*v1.QueryMinInitialDepositResponse, error) { + ctx := sdk.UnwrapSDKContext(c) + minInitialDeposit := q.GetMinInitialDeposit(ctx) + + return &v1.QueryMinInitialDepositResponse{MinInitialDeposit: minInitialDeposit}, nil +} + var _ v1beta1.QueryServer = legacyQueryServer{} type legacyQueryServer struct { diff --git a/x/gov/keeper/hooks_test.go b/x/gov/keeper/hooks_test.go index 734ace13..6bee6458 100644 --- a/x/gov/keeper/hooks_test.go +++ b/x/gov/keeper/hooks_test.go @@ -79,7 +79,7 @@ func TestHooks(t *testing.T) { p2, err := govKeeper.SubmitProposal(ctx, tp, "", "test", "summary", sdk.AccAddress("cosmos1ghekyjucln7y67ntx7cf27m9dpuxxemn4c8g4r")) require.NoError(t, err) - activated, err := govKeeper.AddDeposit(ctx, p2.Id, addrs[0], minDeposit) + activated, err := govKeeper.AddDeposit(ctx, p2.Id, addrs[0], minDeposit, false) require.True(t, activated) require.NoError(t, err) require.True(t, govHooksReceiver.AfterProposalDepositValid) diff --git a/x/gov/keeper/min_initial_deposit.go b/x/gov/keeper/min_initial_deposit.go new file mode 100644 index 00000000..f85d2b54 --- /dev/null +++ b/x/gov/keeper/min_initial_deposit.go @@ -0,0 +1,148 @@ +package keeper + +import ( + "time" + + "cosmossdk.io/math" + + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/atomone-hub/atomone/x/gov/types" + v1 "github.com/atomone-hub/atomone/x/gov/types/v1" +) + +// GetInactiveProposalsNumber gets the number of inactive proposals +func (keeper Keeper) GetInactiveProposalsNumber(ctx sdk.Context) (inactiveProposalsNumber uint64) { + store := ctx.KVStore(keeper.storeKey) + bz := store.Get(types.InactiveProposalsNumberKey) + if bz == nil { + return 0 + } + + inactiveProposalsNumber = types.GetInactiveProposalsNumberFromBytes(bz) + return inactiveProposalsNumber +} + +// SetInactiveProposalsNumber sets the new number of inactive proposals to the store +func (keeper Keeper) SetInactiveProposalsNumber(ctx sdk.Context, inactiveProposalsNumber uint64) { + store := ctx.KVStore(keeper.storeKey) + store.Set(types.InactiveProposalsNumberKey, types.GetInactiveProposalsNumberBytes(inactiveProposalsNumber)) +} + +// IncrementInactiveProposalsNumber increments the number of inactive proposals by one +func (keeper Keeper) IncrementInactiveProposalsNumber(ctx sdk.Context) { + inactiveProposalsNumber := keeper.GetInactiveProposalsNumber(ctx) + 1 + keeper.SetInactiveProposalsNumber(ctx, inactiveProposalsNumber) + + currMinInitialDeposit := keeper.GetMinInitialDeposit(ctx) + keeper.SetLastMinInitialDeposit(ctx, currMinInitialDeposit, ctx.BlockTime()) +} + +// DecrementInactiveProposalsNumber decrements the number of inactive proposals by one +func (keeper Keeper) DecrementInactiveProposalsNumber(ctx sdk.Context) { + currentInactiveProposalsNumber := keeper.GetInactiveProposalsNumber(ctx) + if currentInactiveProposalsNumber > 0 { + inactiveProposalsNumber := currentInactiveProposalsNumber - 1 + keeper.SetInactiveProposalsNumber(ctx, inactiveProposalsNumber) + } else { + panic("number of inactive proposals should never be negative") + } + + currMinInitialDeposit := keeper.GetMinInitialDeposit(ctx) + keeper.SetLastMinInitialDeposit(ctx, currMinInitialDeposit, ctx.BlockTime()) +} + +// SetLastMinInitialDeposit updates the last min initial deposit and last min +// initial deposit time. +// Used to record these values the last time the number of inactive proposals changed +func (keeper Keeper) SetLastMinInitialDeposit(ctx sdk.Context, minInitialDeposit sdk.Coins, timeStamp time.Time) { + store := ctx.KVStore(keeper.storeKey) + lastMinInitialDeposit := v1.LastMinDeposit{ + Value: minInitialDeposit, + Time: &timeStamp, + } + bz := keeper.cdc.MustMarshal(&lastMinInitialDeposit) + store.Set(types.LastMinInitialDepositKey, bz) +} + +// GetLastMinInitialDeposit returns the last min initial deposit and the time it was set +func (keeper Keeper) GetLastMinInitialDeposit(ctx sdk.Context) (sdk.Coins, time.Time) { + store := ctx.KVStore(keeper.storeKey) + bz := store.Get(types.LastMinInitialDepositKey) + if bz == nil { + return sdk.Coins{}, time.Time{} + } + var lastMinInitialDeposit v1.LastMinDeposit + keeper.cdc.MustUnmarshal(bz, &lastMinInitialDeposit) + return lastMinInitialDeposit.Value, *lastMinInitialDeposit.Time +} + +// GetMinInitialDeposit returns the (dynamic) minimum initial deposit currently required for +// proposal submission +func (keeper Keeper) GetMinInitialDeposit(ctx sdk.Context) sdk.Coins { + params := keeper.GetParams(ctx) + minInitialDepositFloor := sdk.Coins(params.MinInitialDepositThrottler.FloorValue) + tick := params.MinInitialDepositThrottler.UpdatePeriod + targetInactiveProposals := math.NewIntFromUint64(params.MinInitialDepositThrottler.TargetProposals) + k := params.MinInitialDepositThrottler.SensitivityTargetDistance + var a sdk.Dec + + numInactiveProposals := math.NewIntFromUint64(keeper.GetInactiveProposalsNumber(ctx)) + lastMinInitialDeposit, lastMinInitialDepositTime := keeper.GetLastMinInitialDeposit(ctx) + // get number of ticks passed since last update + ticksPassed := ctx.BlockTime().Sub(lastMinInitialDepositTime).Nanoseconds() / tick.Nanoseconds() + + if numInactiveProposals.GT(targetInactiveProposals) { + a = sdk.MustNewDecFromStr(params.MinInitialDepositThrottler.IncreaseRatio) + } else { + a = sdk.MustNewDecFromStr(params.MinInitialDepositThrottler.DecreaseRatio) + } + + distance := numInactiveProposals.Sub(targetInactiveProposals) + percChange := math.LegacyOneDec() + if !distance.IsZero() { + b, err := distance.ToLegacyDec().ApproxRoot(k) + if err != nil { + // in case of error bypass the sensitivity, i.e. assume k = 1 + b = distance.ToLegacyDec() + } + c := a.Mul(b) + percChange = percChange.Add(c) + } + if ticksPassed != 0 { + percChange = percChange.Power(uint64(ticksPassed)) + } + + minInitialDeposit := sdk.Coins{} + minInitialDepositFloorDenomsSeen := make(map[string]bool) + for _, lastMinInitialDepositCoin := range lastMinInitialDeposit { + minInitialDepositFloorCoinAmt := minInitialDepositFloor.AmountOf(lastMinInitialDepositCoin.Denom) + if minInitialDepositFloorCoinAmt.IsZero() { + // minInitialDepositFloor was changed and this coin was removed, + // reflect this also in the current min initial deposit, + // i.e. remove this coin + continue + } + minInitialDepositFloorDenomsSeen[lastMinInitialDepositCoin.Denom] = true + minInitialDepositCoinAmt := lastMinInitialDepositCoin.Amount.ToLegacyDec().Mul(percChange).TruncateInt() + if minInitialDepositCoinAmt.LT(minInitialDepositFloorCoinAmt) { + minInitialDeposit = append(minInitialDeposit, sdk.NewCoin(lastMinInitialDepositCoin.Denom, minInitialDepositFloorCoinAmt)) + } else { + minInitialDeposit = append(minInitialDeposit, sdk.NewCoin(lastMinInitialDepositCoin.Denom, minInitialDepositCoinAmt)) + } + } + + // make sure any new denoms in minInitialDepositFloor are added to minInitialDeposit + for _, minInitialDepositFloorCoin := range minInitialDepositFloor { + if _, seen := minInitialDepositFloorDenomsSeen[minInitialDepositFloorCoin.Denom]; !seen { + minInitialDepositCoinAmt := minInitialDepositFloorCoin.Amount.ToLegacyDec().Mul(percChange).TruncateInt() + if minInitialDepositCoinAmt.LT(minInitialDepositFloorCoin.Amount) { + minInitialDeposit = append(minInitialDeposit, minInitialDepositFloorCoin) + } else { + minInitialDeposit = append(minInitialDeposit, sdk.NewCoin(minInitialDepositFloorCoin.Denom, minInitialDepositCoinAmt)) + } + } + } + + return minInitialDeposit +} diff --git a/x/gov/keeper/min_initial_deposit_test.go b/x/gov/keeper/min_initial_deposit_test.go new file mode 100644 index 00000000..23f2a0cf --- /dev/null +++ b/x/gov/keeper/min_initial_deposit_test.go @@ -0,0 +1,173 @@ +package keeper_test + +import ( + "testing" + "time" + + "github.com/stretchr/testify/assert" + + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/atomone-hub/atomone/x/gov/keeper" + v1 "github.com/atomone-hub/atomone/x/gov/types/v1" +) + +func TestInactiveProposalNumber(t *testing.T) { + assert := assert.New(t) + k, _, _, ctx := setupGovKeeper(t) + + assert.EqualValues(0, k.GetInactiveProposalsNumber(ctx)) + + k.IncrementInactiveProposalsNumber(ctx) + k.IncrementInactiveProposalsNumber(ctx) + assert.EqualValues(2, k.GetInactiveProposalsNumber(ctx)) + + k.DecrementInactiveProposalsNumber(ctx) + assert.EqualValues(1, k.GetInactiveProposalsNumber(ctx)) + + k.SetInactiveProposalsNumber(ctx, 42) + assert.EqualValues(42, k.GetInactiveProposalsNumber(ctx)) +} + +func TestGetMinInitialDeposit(t *testing.T) { + var ( + minInitialDepositFloor = v1.DefaultMinInitialDepositFloor + minInitialDepositFloorX2 = minInitialDepositFloor.MulInt(sdk.NewInt(2)) + updatePeriod = v1.DefaultMinInitialDepositUpdatePeriod + N = v1.DefaultTargetProposalsInDepositPeriod + + minInitialDepositTimeFromTicks = func(ticks int) time.Time { + return time.Now().Add(-updatePeriod*time.Duration(ticks) - time.Minute) + } + ) + tests := []struct { + name string + setup func(sdk.Context, *keeper.Keeper) + expectedMinInitialDeposit string + }{ + { + name: "initial case no setup : expectedMinInitialDeposit=minInitialDepositFloor", + expectedMinInitialDeposit: minInitialDepositFloor.String(), + }, + { + name: "n=N-1 lastMinInitialDeposit=minInitialDepositFloor ticksPassed=0 : expectedMinInitialDeposit=minInitialDepositFloor", + setup: func(ctx sdk.Context, k *keeper.Keeper) { + k.SetInactiveProposalsNumber(ctx, 0) + k.SetLastMinInitialDeposit(ctx, minInitialDepositFloor, minInitialDepositTimeFromTicks(0)) + }, + expectedMinInitialDeposit: minInitialDepositFloor.String(), + }, + { + name: "n=N lastMinInitialDeposit=minInitialDepositFloor ticksPassed=0 : expectedMinInitialDeposit=minInitialDepositFloor", + setup: func(ctx sdk.Context, k *keeper.Keeper) { + k.SetInactiveProposalsNumber(ctx, N) + k.SetLastMinInitialDeposit(ctx, minInitialDepositFloor, minInitialDepositTimeFromTicks(0)) + }, + expectedMinInitialDeposit: minInitialDepositFloor.String(), + }, + { + name: "n=N+1 lastMinInitialDeposit=minInitialDepositFloor ticksPassed=0 : expectedMinInitialDeposit>minInitialDepositFloor", + setup: func(ctx sdk.Context, k *keeper.Keeper) { + k.SetInactiveProposalsNumber(ctx, N+1) + k.SetLastMinInitialDeposit(ctx, minInitialDepositFloor, minInitialDepositTimeFromTicks(0)) + }, + expectedMinInitialDeposit: "101000stake", + }, + { + name: "n=N+1 lastMinInitialDeposit=otherCoins ticksPassed=0 : expectedMinInitialDeposit>minInitialDepositFloor", + setup: func(ctx sdk.Context, k *keeper.Keeper) { + k.SetInactiveProposalsNumber(ctx, N+1) + k.SetLastMinInitialDeposit(ctx, sdk.NewCoins( + sdk.NewInt64Coin("xxx", 1_000_000_000), + ), + minInitialDepositTimeFromTicks(0), + ) + }, + expectedMinInitialDeposit: "101000stake", + }, + { + name: "n=N-1 lastMinInitialDeposit=minInitialDepositFloor*2 ticksPassed=0 : minInitialDepositlastMinInitialDeposit*2", + setup: func(ctx sdk.Context, k *keeper.Keeper) { + k.SetInactiveProposalsNumber(ctx, N+1) + k.SetLastMinInitialDeposit(ctx, minInitialDepositFloorX2, minInitialDepositTimeFromTicks(0)) + }, + expectedMinInitialDeposit: "202000stake", + }, + { + name: "n=N-1 lastMinInitialDeposit=minInitialDepositFloor*2 ticksPassed=1 : expectedMinInitialDepositlastMinInitialDeposit*2", + setup: func(ctx sdk.Context, k *keeper.Keeper) { + k.SetInactiveProposalsNumber(ctx, N+1) + k.SetLastMinInitialDeposit(ctx, minInitialDepositFloorX2, minInitialDepositTimeFromTicks(1)) + }, + expectedMinInitialDeposit: "202000stake", + }, + { + name: "n=N-1 lastMinInitialDeposit=minInitialDepositFloor*2 ticksPassed=2 : expectedMinInitialDeposit 0 { // add proposal to quorum check queue diff --git a/x/gov/simulation/genesis.go b/x/gov/simulation/genesis.go index 8c43c81c..809fe372 100644 --- a/x/gov/simulation/genesis.go +++ b/x/gov/simulation/genesis.go @@ -20,22 +20,28 @@ import ( // Simulation parameter constants const ( - DepositParamsMinDeposit = "deposit_params_min_deposit" - DepositParamsDepositPeriod = "deposit_params_deposit_period" - DepositMinInitialRatio = "deposit_params_min_initial_ratio" - VotingParamsVotingPeriod = "voting_params_voting_period" - TallyParamsQuorum = "tally_params_quorum" - TallyParamsThreshold = "tally_params_threshold" - TallyParamsConstitutionAmendmentQuorum = "tally_params_constitution_amendment_quorum" - TallyParamsConstitutionAmendmentThreshold = "tally_params_constitution_amendment_threshold" - TallyParamsLawQuorum = "tally_params_law_quorum" - TallyParamsLawThreshold = "tally_params_law_threshold" - DepositParamsMinDepositFloor = "deposit_params_min_deposit_floor" - DepositParamsMinDepositUpdatePeriod = "deposit_params_min_deposit_update_period" - DepositParamsMinDepositSensitivityTargetDistance = "deposit_params_min_deposit_sensitivity_target_distance" - DepositParamsMinDepositIncreaseRatio = "deposit_params_min_deposit_increase_ratio" - DepositParamsMinDepositDecreaseRatio = "deposit_params_min_deposit_decrease_ratio" - TallyParamsTargetActiveProposals = "tally_params_target_active_proposals" + DepositParamsMinDeposit = "deposit_params_min_deposit" + DepositParamsDepositPeriod = "deposit_params_deposit_period" + // DepositMinInitialRatio = "deposit_params_min_initial_ratio" + VotingParamsVotingPeriod = "voting_params_voting_period" + TallyParamsQuorum = "tally_params_quorum" + TallyParamsThreshold = "tally_params_threshold" + TallyParamsConstitutionAmendmentQuorum = "tally_params_constitution_amendment_quorum" + TallyParamsConstitutionAmendmentThreshold = "tally_params_constitution_amendment_threshold" + TallyParamsLawQuorum = "tally_params_law_quorum" + TallyParamsLawThreshold = "tally_params_law_threshold" + DepositParamsMinDepositFloor = "deposit_params_min_deposit_floor" + DepositParamsMinDepositUpdatePeriod = "deposit_params_min_deposit_update_period" + DepositParamsMinDepositSensitivityTargetDistance = "deposit_params_min_deposit_sensitivity_target_distance" + DepositParamsMinDepositIncreaseRatio = "deposit_params_min_deposit_increase_ratio" + DepositParamsMinDepositDecreaseRatio = "deposit_params_min_deposit_decrease_ratio" + DepositParamsTargetActiveProposals = "deposit_params_target_active_proposals" + DepositParamsMinInitialDepositFloor = "deposit_params_min_initial_deposit_floor" + DepositParamsMinInitialDepositUpdatePeriod = "deposit_params_min_initial_deposit_update_period" + DepositParamsMinInitialDepositSensitivityTargetDistance = "deposit_params_min_initial_deposit_sensitivity_target_distance" + DepositParamsMinInitialDepositIncreaseRatio = "deposit_params_min_initial_deposit_increase_ratio" + DepositParamsMinInitialDepositDecreaseRatio = "deposit_params_min_initial_deposit_decrease_ratio" + DepositParamsMinInitialDepositTargetProposals = "deposit_params_min_initial_deposit_target_proposals" // NOTE: backport from v50 MinDepositRatio = "min_deposit_ratio" @@ -118,12 +124,31 @@ func GenDepositParamsMinDepositSensitivityTargetDistance(r *rand.Rand) uint64 { } // GenDepositParamsMinDepositChangeRatio returns randomized DepositParamsMinDepositChangeRatio -func GenDepositParamsMinDepositChangeRatio(r *rand.Rand) sdk.Dec { - return sdk.NewDecWithPrec(int64(simulation.RandIntBetween(r, 0, 100)), 2).Quo(sdk.NewDec(100)) +func GenDepositParamsMinDepositChangeRatio(r *rand.Rand, max, prec int) sdk.Dec { + return sdk.NewDecWithPrec(int64(simulation.RandIntBetween(r, 0, max)), int64(prec)) } -// GenTallyParamsTargetActiveProposals returns randomized TallyParamsTargetActiveProposals -func GenTallyParamsTargetActiveProposals(r *rand.Rand) uint64 { +// GenDepositParamsTargetActiveProposals returns randomized DepositParamsTargetActiveProposals +func GenDepositParamsTargetActiveProposals(r *rand.Rand) uint64 { + return uint64(simulation.RandIntBetween(r, 1, 100)) +} + +// GenDepositParamsMinInitialDepositUpdatePeriod returns randomized DepositParamsMinInitialDepositUpdatePeriod +func GenDepositParamsMinInitialDepositUpdatePeriod(r *rand.Rand, depositPeriod time.Duration) time.Duration { + return time.Duration(simulation.RandIntBetween(r, 1, int(depositPeriod.Seconds()))) * time.Second +} + +// GenDepositParamsMinInitialDepositSensitivityTargetDistance returns randomized DepositParamsMinInitialDepositSensitivityTargetDistance +func GenDepositParamsMinInitialDepositSensitivityTargetDistance(r *rand.Rand) uint64 { + return uint64(simulation.RandIntBetween(r, 1, 10)) +} + +// GenDepositParamsMinInitialDepositChangeRatio returns randomized DepositParamsMinInitialDepositChangeRatio +func GenDepositParamsMinInitialDepositChangeRatio(r *rand.Rand, max, prec int) sdk.Dec { + return sdk.NewDecWithPrec(int64(simulation.RandIntBetween(r, 0, max)), int64(prec)) +} + +func GenDepositParamsMinInitialDepositTargetProposals(r *rand.Rand) uint64 { return uint64(simulation.RandIntBetween(r, 1, 100)) } @@ -143,11 +168,11 @@ func RandomizedGenState(simState *module.SimulationState) { func(r *rand.Rand) { depositPeriod = GenDepositParamsDepositPeriod(r) }, ) - var minInitialDepositRatio sdk.Dec - simState.AppParams.GetOrGenerate( - simState.Cdc, DepositMinInitialRatio, &minInitialDepositRatio, simState.Rand, - func(r *rand.Rand) { minInitialDepositRatio = GenDepositMinInitialDepositRatio(r) }, - ) + // var minInitialDepositRatio sdk.Dec + // simState.AppParams.GetOrGenerate( + // simState.Cdc, DepositMinInitialRatio, &minInitialDepositRatio, simState.Rand, + // func(r *rand.Rand) { minInitialDepositRatio = GenDepositMinInitialDepositRatio(r) }, + // ) var votingPeriod time.Duration simState.AppParams.GetOrGenerate( @@ -228,24 +253,87 @@ func RandomizedGenState(simState *module.SimulationState) { var minDepositIncreaseRatio sdk.Dec simState.AppParams.GetOrGenerate( simState.Cdc, DepositParamsMinDepositIncreaseRatio, &minDepositIncreaseRatio, simState.Rand, - func(r *rand.Rand) { minDepositIncreaseRatio = GenDepositParamsMinDepositChangeRatio(r) }, + func(r *rand.Rand) { minDepositIncreaseRatio = GenDepositParamsMinDepositChangeRatio(r, 300, 3) }, ) var minDepositDecreaseRatio sdk.Dec simState.AppParams.GetOrGenerate( simState.Cdc, DepositParamsMinDepositDecreaseRatio, &minDepositDecreaseRatio, simState.Rand, - func(r *rand.Rand) { minDepositDecreaseRatio = GenDepositParamsMinDepositChangeRatio(r) }, + func(r *rand.Rand) { + minDepositDecreaseRatio = GenDepositParamsMinDepositChangeRatio(r, + int(minDepositIncreaseRatio.MulInt64(1000).QuoInt64(2).TruncateInt64()), 3) + }, ) var targetActiveProposals uint64 simState.AppParams.GetOrGenerate( - simState.Cdc, TallyParamsTargetActiveProposals, &targetActiveProposals, simState.Rand, - func(r *rand.Rand) { targetActiveProposals = GenTallyParamsTargetActiveProposals(r) }, + simState.Cdc, DepositParamsTargetActiveProposals, &targetActiveProposals, simState.Rand, + func(r *rand.Rand) { targetActiveProposals = GenDepositParamsTargetActiveProposals(r) }, + ) + + var minInitialDepositFloor sdk.Coins + simState.AppParams.GetOrGenerate( + simState.Cdc, DepositParamsMinInitialDepositFloor, &minInitialDepositFloor, simState.Rand, + func(r *rand.Rand) { + ratio := GenDepositMinInitialDepositRatio(r) + minInitialDepositFloor = sdk.NewCoins() + for _, coin := range minDepositFloor { + minInitialDepositFloor = append(minInitialDepositFloor, sdk.NewCoin(coin.Denom, ratio.MulInt(coin.Amount).TruncateInt())) + } + }, + ) + + var minInitialDepositUpdatePeriod time.Duration + simState.AppParams.GetOrGenerate( + simState.Cdc, DepositParamsMinInitialDepositUpdatePeriod, &minInitialDepositUpdatePeriod, simState.Rand, + func(r *rand.Rand) { + minInitialDepositUpdatePeriod = GenDepositParamsMinInitialDepositUpdatePeriod(r, depositPeriod) + }, + ) + + var minInitialDepositSensitivityTargetDistance uint64 + simState.AppParams.GetOrGenerate( + simState.Cdc, DepositParamsMinInitialDepositSensitivityTargetDistance, &minInitialDepositSensitivityTargetDistance, simState.Rand, + func(r *rand.Rand) { + minInitialDepositSensitivityTargetDistance = GenDepositParamsMinInitialDepositSensitivityTargetDistance(r) + }, + ) + + var minInitialDepositIncreaseRatio sdk.Dec + simState.AppParams.GetOrGenerate( + simState.Cdc, DepositParamsMinInitialDepositIncreaseRatio, &minInitialDepositIncreaseRatio, simState.Rand, + func(r *rand.Rand) { + minInitialDepositIncreaseRatio = GenDepositParamsMinInitialDepositChangeRatio(r, 300, 3) + }, + ) + + var minInitialDepositDecreaseRatio sdk.Dec + simState.AppParams.GetOrGenerate( + simState.Cdc, DepositParamsMinInitialDepositDecreaseRatio, &minInitialDepositDecreaseRatio, simState.Rand, + func(r *rand.Rand) { + minInitialDepositDecreaseRatio = GenDepositParamsMinInitialDepositChangeRatio(r, + int(minInitialDepositIncreaseRatio.MulInt64(1000).QuoInt64(2).TruncateInt64()), 3) + }, + ) + + var minInitialDepositTargetProposals uint64 + simState.AppParams.GetOrGenerate( + simState.Cdc, DepositParamsMinInitialDepositTargetProposals, &minInitialDepositTargetProposals, simState.Rand, + func(r *rand.Rand) { + minInitialDepositTargetProposals = GenDepositParamsMinInitialDepositTargetProposals(r) + }, ) govGenesis := v1.NewGenesisState( startingProposalID, - v1.NewParams(depositPeriod, votingPeriod, quorum.String(), threshold.String(), amendmentsQuorum.String(), amendmentsThreshold.String(), lawQuorum.String(), lawThreshold.String(), minInitialDepositRatio.String(), simState.Rand.Intn(2) == 0, simState.Rand.Intn(2) == 0, minDepositRatio.String(), quorumTimout, maxVotingPeriodExtension, quorumCheckCount, minDepositFloor, minDepositUpdatePeriod, minDepositSensitivityTargetDistance, minDepositIncreaseRatio.String(), minDepositDecreaseRatio.String(), targetActiveProposals), + v1.NewParams(depositPeriod, votingPeriod, quorum.String(), threshold.String(), amendmentsQuorum.String(), + amendmentsThreshold.String(), lawQuorum.String(), lawThreshold.String(), // minInitialDepositRatio.String(), + simState.Rand.Intn(2) == 0, simState.Rand.Intn(2) == 0, minDepositRatio.String(), quorumTimout, + maxVotingPeriodExtension, quorumCheckCount, minDepositFloor, minDepositUpdatePeriod, + minDepositSensitivityTargetDistance, minDepositIncreaseRatio.String(), minDepositDecreaseRatio.String(), + targetActiveProposals, minInitialDepositFloor, minInitialDepositUpdatePeriod, + minInitialDepositSensitivityTargetDistance, minInitialDepositIncreaseRatio.String(), + minInitialDepositDecreaseRatio.String(), minInitialDepositTargetProposals), ) bz, err := json.MarshalIndent(&govGenesis, "", " ") diff --git a/x/gov/simulation/genesis_test.go b/x/gov/simulation/genesis_test.go index 3c7c4d32..d9c0c6b7 100644 --- a/x/gov/simulation/genesis_test.go +++ b/x/gov/simulation/genesis_test.go @@ -4,6 +4,7 @@ import ( "encoding/json" "math/rand" "testing" + "time" "github.com/stretchr/testify/require" @@ -45,33 +46,53 @@ func TestRandomizedGenState(t *testing.T) { simState.Cdc.MustUnmarshalJSON(simState.GenState[types.ModuleName], &govGenesis) const ( - tallyQuorum = "0.311000000000000000" - tallyThreshold = "0.562000000000000000" - amendmentQuorum = "0.534000000000000000" - amendmentThreshold = "0.833000000000000000" - lawQuorum = "0.404000000000000000" - lawThreshold = "0.566000000000000000" - minInitialDepositDec = "0.060000000000000000" + tallyQuorum = "0.294000000000000000" + tallyThreshold = "0.611000000000000000" + amendmentQuorum = "0.568000000000000000" + amendmentThreshold = "0.933000000000000000" + lawQuorum = "0.540000000000000000" + lawThreshold = "0.931000000000000000" + ) + + var ( + minDepositUpdatePeriod = time.Duration(67011000000000) + minInitialDepositUpdatePeriod = time.Duration(66992000000000) ) require.Equal(t, []sdk.Coin{}, govGenesis.Params.MinDeposit) require.Equal(t, "52h44m19s", govGenesis.Params.MaxDepositPeriod.String()) - require.Equal(t, float64(148296), govGenesis.Params.VotingPeriod.Seconds()) + require.Equal(t, float64(278770), govGenesis.Params.VotingPeriod.Seconds()) require.Equal(t, tallyQuorum, govGenesis.Params.Quorum) require.Equal(t, tallyThreshold, govGenesis.Params.Threshold) require.Equal(t, amendmentQuorum, govGenesis.Params.ConstitutionAmendmentQuorum) require.Equal(t, amendmentThreshold, govGenesis.Params.ConstitutionAmendmentThreshold) require.Equal(t, lawQuorum, govGenesis.Params.LawQuorum) require.Equal(t, lawThreshold, govGenesis.Params.LawThreshold) - require.Equal(t, minInitialDepositDec, govGenesis.Params.MinInitialDepositRatio) - require.Equal(t, "18h44m26s", govGenesis.Params.QuorumTimeout.String()) - require.Equal(t, "60h55m33s", govGenesis.Params.MaxVotingPeriodExtension.String()) - require.Equal(t, uint64(26), govGenesis.Params.QuorumCheckCount) + require.Equal(t, "", govGenesis.Params.MinInitialDepositRatio) + require.Equal(t, "26h19m52s", govGenesis.Params.QuorumTimeout.String()) + require.Equal(t, "120h29m51s", govGenesis.Params.MaxVotingPeriodExtension.String()) + require.Equal(t, uint64(17), govGenesis.Params.QuorumCheckCount) require.Equal(t, uint64(0x28), govGenesis.StartingProposalId) require.Equal(t, []*v1.Deposit{}, govGenesis.Deposits) require.Equal(t, []*v1.Vote{}, govGenesis.Votes) require.Equal(t, []*v1.Proposal{}, govGenesis.Proposals) require.Equal(t, "", govGenesis.Constitution) + require.Equal(t, v1.MinDepositThrottler{ + FloorValue: sdk.NewCoins(sdk.NewCoin("stake", sdk.NewInt(915))), + UpdatePeriod: &minDepositUpdatePeriod, + TargetActiveProposals: 10, + SensitivityTargetDistance: 1, + IncreaseRatio: "0.128000000000000000", + DecreaseRatio: "0.018000000000000000", + }, *govGenesis.Params.MinDepositThrottler) + require.Equal(t, v1.MinInitialDepositThrottler{ + FloorValue: sdk.NewCoins(sdk.NewCoin("stake", sdk.NewInt(805))), + UpdatePeriod: &minInitialDepositUpdatePeriod, + TargetProposals: 23, + SensitivityTargetDistance: 2, + IncreaseRatio: "0.090000000000000000", + DecreaseRatio: "0.030000000000000000", + }, *govGenesis.Params.MinInitialDepositThrottler) } // TestRandomizedGenState tests abnormal scenarios of applying RandomizedGenState. diff --git a/x/gov/simulation/operations.go b/x/gov/simulation/operations.go index 62755232..6ebd1292 100644 --- a/x/gov/simulation/operations.go +++ b/x/gov/simulation/operations.go @@ -463,17 +463,20 @@ func randomDeposit( minAmount := sdk.ZeroInt() if useMinAmount { - minDepositPercent, err := sdk.NewDecFromStr(params.MinInitialDepositRatio) + // minDepositPercent, err := sdk.NewDecFromStr(params.MinInitialDepositRatio) + // if err != nil { + // return nil, false, err + // } + // minAmount = sdk.NewDecFromInt(minDepositAmount).Mul(minDepositPercent).TruncateInt() + minAmount = k.GetMinInitialDeposit(ctx)[denomIndex].Amount + } + + amount := sdk.ZeroInt() + if minDepositAmount.Sub(minAmount).GTE(sdk.OneInt()) { + amount, err = simtypes.RandPositiveInt(r, minDepositAmount.Sub(minAmount)) if err != nil { return nil, false, err } - - minAmount = sdk.NewDecFromInt(minDepositAmount).Mul(minDepositPercent).TruncateInt() - } - - amount, err := simtypes.RandPositiveInt(r, minDepositAmount.Sub(minAmount)) - if err != nil { - return nil, false, err } amount = amount.Add(minAmount) diff --git a/x/gov/simulation/operations_test.go b/x/gov/simulation/operations_test.go index 7a487789..179a8be4 100644 --- a/x/gov/simulation/operations_test.go +++ b/x/gov/simulation/operations_test.go @@ -155,7 +155,7 @@ func TestSimulateMsgSubmitProposal(t *testing.T) { require.True(t, operationMsg.OK) require.Equal(t, "cosmos1ghekyjucln7y67ntx7cf27m9dpuxxemn4c8g4r", msg.Proposer) require.NotEqual(t, len(msg.InitialDeposit), 0) - require.Equal(t, "1682907stake", msg.InitialDeposit[0].String()) + require.Equal(t, "1982907stake", msg.InitialDeposit[0].String()) require.Equal(t, simulation.TypeMsgSubmitProposal, sdk.MsgTypeURL(&msg)) } @@ -185,7 +185,7 @@ func TestSimulateMsgSubmitLegacyProposal(t *testing.T) { require.True(t, operationMsg.OK) require.Equal(t, "cosmos1p8wcgrjr4pjju90xg6u9cgq55dxwq8j7u4x9a0", msg.Proposer) require.NotEqual(t, len(msg.InitialDeposit), 0) - require.Equal(t, "8058033stake", msg.InitialDeposit[0].String()) + require.Equal(t, "8358033stake", msg.InitialDeposit[0].String()) require.Equal(t, "title-3: ZBSpYuLyYggwexjxusrBqDOTtGTOWeLrQKjLxzIivHSlcxgdXhhuTSkuxKGLwQvuyNhYFmBZHeAerqyNEUzXPFGkqEGqiQWIXnku", msg.Messages[0].GetCachedValue().(*v1.MsgExecLegacyContent).Content.GetCachedValue().(v1beta1.Content).GetTitle()) require.Equal(t, "description-3: NJWzHdBNpAXKJPHWQdrGYcAHSctgVlqwqHoLfHsXUdStwfefwzqLuKEhmMyYLdbZrcPgYqjNHxPexsruwEGStAneKbWkQDDIlCWBLSiAASNhZqNFlPtfqPJoxKsgMdzjWqLWdqKQuJqWPMvwPQWZUtVMOTMYKJbfdlZsjdsomuScvDmbDkgRualsxDvRJuCA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TclqfPOfeoVLbqcjcXCUEBgAGplrkgsmIEhWRZLlGPGCwKWRaCKMkBHTAcypUrYjWwCLtOPVygMwMANGoQwFnCqFrUGMCRZUGJKTZIGPyldsifauoMnJPLTcDHmilcmahlqOELaAUYDBuzsVywnDQfwRLGIWozYaOAilMBcObErwgTDNGWnwQMUgFFSKtPDMEoEQCTKVREqrXZSGLqwTMcxHfWotDllNkIJPMbXzjDVjPOOjCFuIvTyhXKLyhUScOXvYthRXpPfKwMhptXaxIxgqBoUqzrWbaoLTVpQoottZyPFfNOoMioXHRuFwMRYUiKvcWPkrayyTLOCFJlAyslDameIuqVAuxErqFPEWIScKpBORIuZqoXlZuTvAjEdlEWDODFRregDTqGNoFBIHxvimmIZwLfFyKUfEWAnNBdtdzDmTPXtpHRGdIbuucfTjOygZsTxPjfweXhSUkMhPjMaxKlMIJMOXcnQfyzeOcbWwNbeH", msg.Messages[0].GetCachedValue().(*v1.MsgExecLegacyContent).Content.GetCachedValue().(v1beta1.Content).GetDescription()) require.Equal(t, "gov", msg.Route()) @@ -263,6 +263,7 @@ func TestSimulateMsgVote(t *testing.T) { proposal, err := v1.NewProposal([]sdk.Msg{contentMsg}, 1, submitTime, submitTime.Add(*depositPeriod), "", "text proposal", "description", sdk.AccAddress("cosmos1ghekyjucln7y67ntx7cf27m9dpuxxemn4c8g4r")) require.NoError(t, err) + suite.GovKeeper.IncrementInactiveProposalsNumber(ctx) suite.GovKeeper.ActivateVotingPeriod(ctx, proposal) // begin a new block @@ -307,6 +308,7 @@ func TestSimulateMsgVoteWeighted(t *testing.T) { proposal, err := v1.NewProposal([]sdk.Msg{contentMsg}, 1, submitTime, submitTime.Add(*depositPeriod), "", "text proposal", "test", sdk.AccAddress("cosmos1ghekyjucln7y67ntx7cf27m9dpuxxemn4c8g4r")) require.NoError(t, err) + suite.GovKeeper.IncrementInactiveProposalsNumber(ctx) suite.GovKeeper.ActivateVotingPeriod(ctx, proposal) // begin a new block diff --git a/x/gov/types/keys.go b/x/gov/types/keys.go index cf3bab94..7784b25c 100644 --- a/x/gov/types/keys.go +++ b/x/gov/types/keys.go @@ -47,6 +47,8 @@ var ( QuorumCheckQueuePrefix = []byte{0x05} ActiveProposalsNumberKey = []byte{0x06} LastMinDepositKey = []byte{0x07} + InactiveProposalsNumberKey = []byte{0x08} + LastMinInitialDepositKey = []byte{0x09} DepositsKeyPrefix = []byte{0x10} @@ -125,6 +127,18 @@ func GetActiveProposalsNumberFromBytes(bz []byte) (activeProposalsNumber uint64) return binary.BigEndian.Uint64(bz) } +// GetInactiveProposalsNumberBytes returns the byte representation of the inactiveProposalsNumber +func GetInactiveProposalsNumberBytes(inactiveProposalsNumber uint64) (inactiveProposalsNumberBz []byte) { + inactiveProposalsNumberBz = make([]byte, 8) + binary.BigEndian.PutUint64(inactiveProposalsNumberBz, inactiveProposalsNumber) + return +} + +// GetInactiveProposalsNumberFromBytes returns inactiveProposalsNumber in uint64 format from a byte array +func GetInactiveProposalsNumberFromBytes(bz []byte) (inactiveProposalsNumber uint64) { + return binary.BigEndian.Uint64(bz) +} + // DepositsKey gets the first part of the deposits key based on the proposalID func DepositsKey(proposalID uint64) []byte { return append(DepositsKeyPrefix, GetProposalIDBytes(proposalID)...) diff --git a/x/gov/types/v1/genesis.pb.go b/x/gov/types/v1/genesis.pb.go index a21a7134..5f95e96a 100644 --- a/x/gov/types/v1/genesis.pb.go +++ b/x/gov/types/v1/genesis.pb.go @@ -51,6 +51,8 @@ type GenesisState struct { Constitution string `protobuf:"bytes,9,opt,name=constitution,proto3" json:"constitution,omitempty"` // last updated value for the dynamic min deposit LastMinDeposit *LastMinDeposit `protobuf:"bytes,10,opt,name=last_min_deposit,json=lastMinDeposit,proto3" json:"last_min_deposit,omitempty"` + // last updated value for the dynamic min initial deposit + LastMinInitialDeposit *LastMinDeposit `protobuf:"bytes,11,opt,name=last_min_initial_deposit,json=lastMinInitialDeposit,proto3" json:"last_min_initial_deposit,omitempty"` } func (m *GenesisState) Reset() { *m = GenesisState{} } @@ -159,6 +161,13 @@ func (m *GenesisState) GetLastMinDeposit() *LastMinDeposit { return nil } +func (m *GenesisState) GetLastMinInitialDeposit() *LastMinDeposit { + if m != nil { + return m.LastMinInitialDeposit + } + return nil +} + func init() { proto.RegisterType((*GenesisState)(nil), "atomone.gov.v1.GenesisState") } @@ -166,33 +175,35 @@ func init() { func init() { proto.RegisterFile("atomone/gov/v1/genesis.proto", fileDescriptor_7737a96fb154b10d) } var fileDescriptor_7737a96fb154b10d = []byte{ - // 413 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x92, 0x41, 0x8b, 0xd3, 0x40, - 0x14, 0xc7, 0x3b, 0xbb, 0xdd, 0xba, 0x9d, 0x66, 0x8b, 0x0c, 0x8b, 0x0e, 0xba, 0x86, 0xb0, 0xa7, - 0x20, 0x6c, 0x62, 0x77, 0xc1, 0x0f, 0x50, 0x94, 0x5d, 0x41, 0x61, 0x89, 0xe2, 0xc1, 0x4b, 0x98, - 0x6e, 0x86, 0x74, 0x20, 0xc9, 0x0b, 0x99, 0xd7, 0xc1, 0x7e, 0x0b, 0x3f, 0x96, 0x07, 0x0f, 0x3d, - 0x7a, 0x94, 0xf6, 0x8b, 0x48, 0x27, 0x89, 0x6d, 0xa3, 0xde, 0x92, 0xf7, 0x7e, 0xff, 0xdf, 0xbc, - 0xbc, 0x0c, 0xbd, 0x10, 0x08, 0x39, 0x14, 0x32, 0x4c, 0xc1, 0x84, 0x66, 0x12, 0xa6, 0xb2, 0x90, - 0x5a, 0xe9, 0xa0, 0xac, 0x00, 0x81, 0x8d, 0x9b, 0x6e, 0x90, 0x82, 0x09, 0xcc, 0xe4, 0x19, 0xef, - 0xd2, 0x60, 0x6a, 0xf2, 0xf2, 0x47, 0x9f, 0x3a, 0xb7, 0x75, 0xf6, 0x23, 0x0a, 0x94, 0xec, 0x15, - 0x3d, 0xd7, 0x28, 0x2a, 0x54, 0x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xa3, 0x8f, 0x33, - 0xa1, 0x31, 0xce, 0x55, 0x11, 0x37, 0x1f, 0xce, 0xa9, 0xb5, 0xbb, 0x5d, 0xfb, 0x7b, 0xa1, 0xf1, - 0x83, 0x2a, 0xda, 0x1f, 0x3a, 0xce, 0x0e, 0xde, 0xa7, 0xb7, 0xdf, 0xd7, 0x2e, 0x59, 0xad, 0x5d, - 0xf2, 0x6b, 0xed, 0x92, 0x6f, 0x1b, 0xb7, 0xb7, 0xda, 0xb8, 0xbd, 0x9f, 0x1b, 0xb7, 0xf7, 0xe5, - 0x2a, 0x55, 0x38, 0x5f, 0xcc, 0x82, 0x07, 0xc8, 0xc3, 0xc6, 0x79, 0x35, 0x5f, 0xcc, 0xda, 0xe7, - 0xf0, 0xab, 0xbd, 0x9b, 0xb8, 0x2c, 0xa5, 0x0e, 0xcd, 0x64, 0x36, 0xb0, 0xd7, 0xf3, 0xe6, 0x77, - 0x00, 0x00, 0x00, 0xff, 0xff, 0xe5, 0x92, 0xc4, 0x2a, 0xe8, 0x02, 0x00, 0x00, + // 436 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x92, 0xdf, 0x6a, 0xdb, 0x30, + 0x14, 0x87, 0xa3, 0xb6, 0xc9, 0x1a, 0x25, 0x0d, 0x43, 0x74, 0x9b, 0xd8, 0x3a, 0x13, 0x7a, 0x15, + 0x06, 0xb5, 0x97, 0x16, 0xf6, 0x00, 0x61, 0xa3, 0x2d, 0x6c, 0x50, 0xbc, 0xb1, 0xc1, 0x6e, 0x8c, + 0xd2, 0x08, 0x57, 0x60, 0xeb, 0x18, 0xeb, 0x44, 0xac, 0x6f, 0xb1, 0x97, 0xd8, 0xbb, 0xec, 0xb2, + 0x97, 0xbb, 0x1c, 0xc9, 0x8b, 0x8c, 0xca, 0x72, 0xfe, 0x78, 0x1b, 0xf4, 0xce, 0x3e, 0xe7, 0xfb, + 0x7d, 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 0x4d, 0x68, 0x1f, 0x45, 0x96, 0xdd, 0xd6, + 0x96, 0x47, 0xce, 0xf2, 0xa2, 0x69, 0xf9, 0x74, 0xcf, 0x6c, 0x48, 0x7a, 0xb8, 0x2e, 0xb0, 0x90, + 0x76, 0x7c, 0x7a, 0xdf, 0xa5, 0x9f, 0xfe, 0xb5, 0x09, 0xd7, 0x8d, 0x3d, 0xc5, 0x8e, 0x69, 0xff, + 0x1a, 0xb4, 0x41, 0x85, 0x73, 0x54, 0xa0, 0x79, 0x77, 0x48, 0x46, 0xdd, 0x78, 0xab, 0xc6, 0x2e, + 0xe8, 0xe3, 0x4c, 0x18, 0x4c, 0x72, 0xa5, 0x13, 0xff, 0xe1, 0x9c, 0x3a, 0x7b, 0xd0, 0xb4, 0xbf, + 0x17, 0x06, 0x3f, 0x28, 0x5d, 0xff, 0xd0, 0x41, 0xb6, 0xf5, 0xce, 0xbe, 0x50, 0xbe, 0x32, 0x29, + 0xad, 0x50, 0x89, 0x6c, 0x65, 0xec, 0x3d, 0xc8, 0xf8, 0xc4, 0x1b, 0x2f, 0xab, 0xb4, 0x2f, 0x4f, + 0xce, 0x7f, 0x2e, 0x02, 0x72, 0xb7, 0x08, 0xc8, 0xef, 0x45, 0x40, 0xbe, 0x2f, 0x83, 0xd6, 0xdd, + 0x32, 0x68, 0xfd, 0x5a, 0x06, 0xad, 0xaf, 0x27, 0xa9, 0xc2, 0x9b, 0xf9, 0x34, 0xbc, 0x86, 0x3c, + 0xf2, 0xea, 0x93, 0x9b, 0xf9, 0xb4, 0x7e, 0x8e, 0xbe, 0xb9, 0x4b, 0x8f, 0xb7, 0x85, 0x34, 0x91, + 0x1d, 0x4f, 0x3b, 0xee, 0xde, 0x9f, 0xfd, 0x09, 0x00, 0x00, 0xff, 0xff, 0x17, 0x14, 0x2b, 0xfd, + 0x41, 0x03, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { @@ -215,6 +226,18 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.LastMinInitialDeposit != nil { + { + size, err := m.LastMinInitialDeposit.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x5a + } if m.LastMinDeposit != nil { { size, err := m.LastMinDeposit.MarshalToSizedBuffer(dAtA[:i]) @@ -394,6 +417,10 @@ func (m *GenesisState) Size() (n int) { l = m.LastMinDeposit.Size() n += 1 + l + sovGenesis(uint64(l)) } + if m.LastMinInitialDeposit != nil { + l = m.LastMinInitialDeposit.Size() + n += 1 + l + sovGenesis(uint64(l)) + } return n } @@ -765,6 +792,42 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 11: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LastMinInitialDeposit", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.LastMinInitialDeposit == nil { + m.LastMinInitialDeposit = &LastMinDeposit{} + } + if err := m.LastMinInitialDeposit.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenesis(dAtA[iNdEx:]) diff --git a/x/gov/types/v1/gov.pb.go b/x/gov/types/v1/gov.pb.go index f420d49a..723329dc 100644 --- a/x/gov/types/v1/gov.pb.go +++ b/x/gov/types/v1/gov.pb.go @@ -951,6 +951,102 @@ func (m *MinDepositThrottler) GetSensitivityTargetDistance() uint64 { return 0 } +type MinInitialDepositThrottler struct { + // Floor value for the minimum initial deposit required for a proposal to enter the deposit period. + FloorValue []types.Coin `protobuf:"bytes,1,rep,name=floor_value,json=floorValue,proto3" json:"floor_value"` + // Duration that dictates after how long the dynamic minimum deposit should be recalculated + // for time-based updates. + UpdatePeriod *time.Duration `protobuf:"bytes,2,opt,name=update_period,json=updatePeriod,proto3,stdduration" json:"update_period,omitempty"` + // The number of proposals in deposit period the dynamic minimum initial deposit should target. + TargetProposals uint64 `protobuf:"varint,3,opt,name=target_proposals,json=targetProposals,proto3" json:"target_proposals,omitempty"` + // The ratio of increase for the minimum initial deposit when the number of proposals + // in deposit period exceeds the target by 1. + IncreaseRatio string `protobuf:"bytes,4,opt,name=increase_ratio,json=increaseRatio,proto3" json:"increase_ratio,omitempty"` + // The ratio of decrease for the minimum initial deposit when the number of proposals + // in deposit period is 1 less than the target. + DecreaseRatio string `protobuf:"bytes,5,opt,name=decrease_ratio,json=decreaseRatio,proto3" json:"decrease_ratio,omitempty"` + // A positive integer representing the sensitivity of the dynamic minimum initial + // deposit increase/decrease to the distance from the target number of proposals + // in deposit period. The higher the number, the lower the sensitivity. A value + // of 1 represents the highest sensitivity. + SensitivityTargetDistance uint64 `protobuf:"varint,6,opt,name=sensitivity_target_distance,json=sensitivityTargetDistance,proto3" json:"sensitivity_target_distance,omitempty"` +} + +func (m *MinInitialDepositThrottler) Reset() { *m = MinInitialDepositThrottler{} } +func (m *MinInitialDepositThrottler) String() string { return proto.CompactTextString(m) } +func (*MinInitialDepositThrottler) ProtoMessage() {} +func (*MinInitialDepositThrottler) Descriptor() ([]byte, []int) { + return fileDescriptor_ecf0f9950ff6986c, []int{11} +} +func (m *MinInitialDepositThrottler) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MinInitialDepositThrottler) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MinInitialDepositThrottler.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 *MinInitialDepositThrottler) XXX_Merge(src proto.Message) { + xxx_messageInfo_MinInitialDepositThrottler.Merge(m, src) +} +func (m *MinInitialDepositThrottler) XXX_Size() int { + return m.Size() +} +func (m *MinInitialDepositThrottler) XXX_DiscardUnknown() { + xxx_messageInfo_MinInitialDepositThrottler.DiscardUnknown(m) +} + +var xxx_messageInfo_MinInitialDepositThrottler proto.InternalMessageInfo + +func (m *MinInitialDepositThrottler) GetFloorValue() []types.Coin { + if m != nil { + return m.FloorValue + } + return nil +} + +func (m *MinInitialDepositThrottler) GetUpdatePeriod() *time.Duration { + if m != nil { + return m.UpdatePeriod + } + return nil +} + +func (m *MinInitialDepositThrottler) GetTargetProposals() uint64 { + if m != nil { + return m.TargetProposals + } + return 0 +} + +func (m *MinInitialDepositThrottler) GetIncreaseRatio() string { + if m != nil { + return m.IncreaseRatio + } + return "" +} + +func (m *MinInitialDepositThrottler) GetDecreaseRatio() string { + if m != nil { + return m.DecreaseRatio + } + return "" +} + +func (m *MinInitialDepositThrottler) GetSensitivityTargetDistance() uint64 { + if m != nil { + return m.SensitivityTargetDistance + } + return 0 +} + // Params defines the parameters for the x/gov module. // // Since: cosmos-sdk 0.47 @@ -973,7 +1069,7 @@ type Params struct { // Minimum proportion of Yes votes for proposal to pass. Default value: 2/3. Threshold string `protobuf:"bytes,5,opt,name=threshold,proto3" json:"threshold,omitempty"` // The ratio representing the proportion of the deposit value that must be paid at proposal submission. - MinInitialDepositRatio string `protobuf:"bytes,7,opt,name=min_initial_deposit_ratio,json=minInitialDepositRatio,proto3" json:"min_initial_deposit_ratio,omitempty"` + MinInitialDepositRatio string `protobuf:"bytes,7,opt,name=min_initial_deposit_ratio,json=minInitialDepositRatio,proto3" json:"min_initial_deposit_ratio,omitempty"` // Deprecated: Do not use. // burn deposits if a proposal does not meet quorum BurnVoteQuorum bool `protobuf:"varint,13,opt,name=burn_vote_quorum,json=burnVoteQuorum,proto3" json:"burn_vote_quorum,omitempty"` // burn deposits if the proposal does not enter voting period @@ -1002,15 +1098,16 @@ type Params struct { MaxVotingPeriodExtension *time.Duration `protobuf:"bytes,21,opt,name=max_voting_period_extension,json=maxVotingPeriodExtension,proto3,stdduration" json:"max_voting_period_extension,omitempty"` // Number of times a proposal should be checked for quorum after the quorum timeout // has elapsed. Used to compute the amount of time in between quorum checks. - QuorumCheckCount uint64 `protobuf:"varint,22,opt,name=quorum_check_count,json=quorumCheckCount,proto3" json:"quorum_check_count,omitempty"` - MinDepositThrottler *MinDepositThrottler `protobuf:"bytes,23,opt,name=min_deposit_throttler,json=minDepositThrottler,proto3" json:"min_deposit_throttler,omitempty"` + QuorumCheckCount uint64 `protobuf:"varint,22,opt,name=quorum_check_count,json=quorumCheckCount,proto3" json:"quorum_check_count,omitempty"` + MinDepositThrottler *MinDepositThrottler `protobuf:"bytes,23,opt,name=min_deposit_throttler,json=minDepositThrottler,proto3" json:"min_deposit_throttler,omitempty"` + MinInitialDepositThrottler *MinInitialDepositThrottler `protobuf:"bytes,24,opt,name=min_initial_deposit_throttler,json=minInitialDepositThrottler,proto3" json:"min_initial_deposit_throttler,omitempty"` } func (m *Params) Reset() { *m = Params{} } func (m *Params) String() string { return proto.CompactTextString(m) } func (*Params) ProtoMessage() {} func (*Params) Descriptor() ([]byte, []int) { - return fileDescriptor_ecf0f9950ff6986c, []int{11} + return fileDescriptor_ecf0f9950ff6986c, []int{12} } func (m *Params) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1075,6 +1172,7 @@ func (m *Params) GetThreshold() string { return "" } +// Deprecated: Do not use. func (m *Params) GetMinInitialDepositRatio() string { if m != nil { return m.MinInitialDepositRatio @@ -1159,6 +1257,13 @@ func (m *Params) GetMinDepositThrottler() *MinDepositThrottler { return nil } +func (m *Params) GetMinInitialDepositThrottler() *MinInitialDepositThrottler { + if m != nil { + return m.MinInitialDepositThrottler + } + return nil +} + func init() { proto.RegisterEnum("atomone.gov.v1.VoteOption", VoteOption_name, VoteOption_value) proto.RegisterEnum("atomone.gov.v1.ProposalStatus", ProposalStatus_name, ProposalStatus_value) @@ -1173,116 +1278,121 @@ func init() { proto.RegisterType((*VotingParams)(nil), "atomone.gov.v1.VotingParams") proto.RegisterType((*TallyParams)(nil), "atomone.gov.v1.TallyParams") proto.RegisterType((*MinDepositThrottler)(nil), "atomone.gov.v1.MinDepositThrottler") + proto.RegisterType((*MinInitialDepositThrottler)(nil), "atomone.gov.v1.MinInitialDepositThrottler") proto.RegisterType((*Params)(nil), "atomone.gov.v1.Params") } func init() { proto.RegisterFile("atomone/gov/v1/gov.proto", fileDescriptor_ecf0f9950ff6986c) } var fileDescriptor_ecf0f9950ff6986c = []byte{ - // 1645 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x58, 0xbd, 0x6f, 0x23, 0xc7, - 0x15, 0xd7, 0xf2, 0x4b, 0xd4, 0xa3, 0x48, 0x51, 0x23, 0xe9, 0xb4, 0x92, 0x2c, 0x4a, 0x61, 0x02, - 0x43, 0xb9, 0x9c, 0xc8, 0x48, 0xe7, 0x5c, 0x61, 0x18, 0x01, 0x28, 0x91, 0x77, 0xe1, 0x41, 0x16, - 0xe9, 0x25, 0x2d, 0xc7, 0x29, 0xb2, 0x18, 0x72, 0xe7, 0xa8, 0x85, 0xb9, 0x3b, 0xf4, 0xce, 0x2c, - 0x25, 0xb6, 0xa9, 0x52, 0xba, 0x0c, 0x52, 0xa5, 0x4c, 0x99, 0xc2, 0x40, 0xfe, 0x80, 0x20, 0x80, - 0xab, 0xc0, 0x70, 0x95, 0x34, 0x97, 0xe0, 0xae, 0x08, 0xe0, 0x2e, 0x45, 0xfa, 0x60, 0x67, 0x66, - 0xf9, 0x25, 0x0a, 0xa4, 0x8c, 0xb8, 0xb9, 0xdb, 0x99, 0xf7, 0xfb, 0xbd, 0xf7, 0xe6, 0x7d, 0xcd, - 0x50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c, 0xec, 0xc5, 0x57, 0x6f, 0x72, 0xda, 0xd7, 0x6f, 0x72, 0xda, 0xbf, 0xde, 0xe4, 0xb4, 0x2f, - 0xde, 0xe6, 0x96, 0xbe, 0x7e, 0x9b, 0x5b, 0xfa, 0xfb, 0xdb, 0xdc, 0xd2, 0xaf, 0x8e, 0x3b, 0x36, - 0xbf, 0xf6, 0x5b, 0x85, 0x36, 0x75, 0x8a, 0x2a, 0x37, 0xc7, 0xd7, 0x7e, 0x2b, 0xfc, 0x2e, 0xde, - 0x8a, 0x3f, 0xc1, 0xf0, 0x41, 0x8f, 0xb0, 0x62, 0xff, 0xa4, 0x95, 0x10, 0x05, 0xf4, 0xf4, 0x7f, - 0x01, 0x00, 0x00, 0xff, 0xff, 0x25, 0xe0, 0x5e, 0x22, 0xa1, 0x11, 0x00, 0x00, + // 1698 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x58, 0xcd, 0x6f, 0x1b, 0xc7, + 0x15, 0xd7, 0x8a, 0x1f, 0x92, 0x1e, 0x45, 0x6a, 0x35, 0x92, 0xed, 0x15, 0x15, 0x51, 0x2e, 0x5b, + 0x04, 0x8e, 0x6b, 0x91, 0x95, 0x9d, 0xfa, 0x10, 0x04, 0x05, 0x28, 0x91, 0x76, 0xe9, 0xda, 0x22, + 0xb3, 0x64, 0x94, 0xa6, 0x87, 0x2e, 0x86, 0xdc, 0x31, 0xb5, 0x08, 0x77, 0x87, 0xd9, 0x99, 0xa5, + 0xc5, 0x6b, 0x4e, 0x3d, 0xe6, 0x58, 0xf4, 0xd4, 0x63, 0x8f, 0x3d, 0x04, 0xe8, 0x1f, 0x50, 0x14, + 0xc8, 0xa9, 0x08, 0x72, 0x6a, 0x2f, 0x6e, 0x21, 0x1f, 0x0a, 0xe4, 0xde, 0x7b, 0xb1, 0x33, 0xb3, + 0xfc, 0xd2, 0x0a, 0xa2, 0x8c, 0x16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0x17, 0xfb, 0x23, 0x63, 0x5d, 0x9c, 0x47, 0x9f, 0xe8, 0x7d, 0x58, 0x95, + 0x8d, 0x49, 0x7c, 0x23, 0x7b, 0x4d, 0x27, 0x8e, 0x91, 0xc5, 0xdf, 0x69, 0x90, 0x99, 0xae, 0x81, + 0x1f, 0xc3, 0xda, 0x88, 0x30, 0xab, 0x2b, 0x7a, 0x53, 0xbb, 0x34, 0x28, 0xea, 0x1e, 0x37, 0x57, + 0x47, 0x84, 0x1d, 0x87, 0x72, 0xf4, 0x08, 0xb2, 0xb8, 0xc3, 0x38, 0x76, 0x3c, 0x45, 0x58, 0x8e, + 0x25, 0xac, 0x2b, 0x90, 0x24, 0xbd, 0x07, 0xab, 0x1e, 0x55, 0xf8, 0x44, 0x2c, 0x7e, 0xc5, 0xa3, + 0x02, 0x5a, 0xfc, 0x93, 0x06, 0xc9, 0x70, 0x92, 0x5d, 0x3f, 0x87, 0x4a, 0x90, 0x1a, 0x52, 0x4e, + 0xae, 0x9f, 0x41, 0x12, 0x86, 0x3e, 0x84, 0x15, 0x39, 0x16, 0x99, 0x91, 0x14, 0x55, 0x55, 0x9c, + 0x6f, 0x95, 0xcb, 0x53, 0xd7, 0x8c, 0x28, 0x33, 0x69, 0x4b, 0xcd, 0xa6, 0xed, 0x59, 0x72, 0x35, + 0xa1, 0x27, 0x8b, 0x7f, 0xd1, 0xe0, 0xd6, 0x47, 0x01, 0xf5, 0x03, 0xf7, 0xf8, 0x8c, 0x74, 0x3f, + 0xfb, 0x28, 0x20, 0x01, 0xa9, 0x79, 0xdc, 0x1f, 0xa1, 0x26, 0x6c, 0x7d, 0x2e, 0x04, 0xa2, 0x70, + 0x68, 0xa0, 0x8a, 0x51, 0x5b, 0xb0, 0x80, 0x36, 0x25, 0xb9, 0x2d, 0xb9, 0xa2, 0x88, 0x1e, 0x00, + 0x52, 0x1a, 0xbb, 0xa1, 0xad, 0xa9, 0x54, 0x24, 0x4d, 0xfd, 0xf3, 0x89, 0x13, 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0x56, 0x8b, 0x50, 0x98, 0x07, 0x54, 0x6b, 0xcd, 0x46, 0xab, 0xde, 0xb6, 0x9a, + 0x35, 0xb3, 0xde, 0xa8, 0xea, 0x1a, 0xfa, 0x01, 0xec, 0xcd, 0x63, 0x4e, 0x1b, 0xed, 0xfa, 0xc9, + 0xd3, 0x08, 0xb2, 0x8c, 0xf2, 0x70, 0x7b, 0x1e, 0xd2, 0xac, 0xb4, 0x5a, 0xb5, 0xaa, 0x9e, 0x40, + 0xef, 0x80, 0x31, 0x2f, 0x33, 0x6b, 0xcf, 0x6a, 0xc7, 0xed, 0x5a, 0x55, 0x4f, 0xc6, 0x31, 0x9f, + 0x54, 0xea, 0xcf, 0x6b, 0x55, 0x3d, 0x75, 0xf4, 0xf4, 0xeb, 0x8b, 0x82, 0xf6, 0xcd, 0x45, 0x41, + 0xfb, 0xe7, 0x45, 0x41, 0xfb, 0xf2, 0x4d, 0x61, 0xe9, 0x9b, 0x37, 0x85, 0xa5, 0xbf, 0xbd, 0x29, + 0x2c, 0xfd, 0xea, 0xa0, 0xe7, 0xf0, 0xb3, 0xa0, 0x53, 0xea, 0x52, 0xb7, 0xac, 0x32, 0x75, 0x70, + 0x16, 0x74, 0xa2, 0xdf, 0xe5, 0x73, 0xf1, 0x87, 0x37, 0x3e, 0x1a, 0x10, 0x56, 0x1e, 0x1e, 0x76, + 0xd2, 0xa2, 0x5e, 0x1f, 0xfd, 0x27, 0x00, 0x00, 0xff, 0xff, 0x62, 0x1f, 0xc8, 0x86, 0x97, 0x13, + 0x00, 0x00, } func (m *WeightedVoteOption) Marshal() (dAtA []byte, err error) { @@ -1916,6 +2026,77 @@ func (m *MinDepositThrottler) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *MinInitialDepositThrottler) 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 *MinInitialDepositThrottler) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MinInitialDepositThrottler) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.SensitivityTargetDistance != 0 { + i = encodeVarintGov(dAtA, i, uint64(m.SensitivityTargetDistance)) + i-- + dAtA[i] = 0x30 + } + if len(m.DecreaseRatio) > 0 { + i -= len(m.DecreaseRatio) + copy(dAtA[i:], m.DecreaseRatio) + i = encodeVarintGov(dAtA, i, uint64(len(m.DecreaseRatio))) + i-- + dAtA[i] = 0x2a + } + if len(m.IncreaseRatio) > 0 { + i -= len(m.IncreaseRatio) + copy(dAtA[i:], m.IncreaseRatio) + i = encodeVarintGov(dAtA, i, uint64(len(m.IncreaseRatio))) + i-- + dAtA[i] = 0x22 + } + if m.TargetProposals != 0 { + i = encodeVarintGov(dAtA, i, uint64(m.TargetProposals)) + i-- + dAtA[i] = 0x18 + } + if m.UpdatePeriod != nil { + n11, err11 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(*m.UpdatePeriod, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(*m.UpdatePeriod):]) + if err11 != nil { + return 0, err11 + } + i -= n11 + i = encodeVarintGov(dAtA, i, uint64(n11)) + i-- + dAtA[i] = 0x12 + } + if len(m.FloorValue) > 0 { + for iNdEx := len(m.FloorValue) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.FloorValue[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGov(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + func (m *Params) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -1936,6 +2117,20 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.MinInitialDepositThrottler != nil { + { + size, err := m.MinInitialDepositThrottler.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGov(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0xc2 + } if m.MinDepositThrottler != nil { { size, err := m.MinDepositThrottler.MarshalToSizedBuffer(dAtA[:i]) @@ -1958,24 +2153,24 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0xb0 } if m.MaxVotingPeriodExtension != nil { - n12, err12 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(*m.MaxVotingPeriodExtension, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(*m.MaxVotingPeriodExtension):]) - if err12 != nil { - return 0, err12 + n14, err14 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(*m.MaxVotingPeriodExtension, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(*m.MaxVotingPeriodExtension):]) + if err14 != nil { + return 0, err14 } - i -= n12 - i = encodeVarintGov(dAtA, i, uint64(n12)) + i -= n14 + i = encodeVarintGov(dAtA, i, uint64(n14)) i-- dAtA[i] = 0x1 i-- dAtA[i] = 0xaa } if m.QuorumTimeout != nil { - n13, err13 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(*m.QuorumTimeout, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(*m.QuorumTimeout):]) - if err13 != nil { - return 0, err13 + n15, err15 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(*m.QuorumTimeout, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(*m.QuorumTimeout):]) + if err15 != nil { + return 0, err15 } - i -= n13 - i = encodeVarintGov(dAtA, i, uint64(n13)) + i -= n15 + i = encodeVarintGov(dAtA, i, uint64(n15)) i-- dAtA[i] = 0x1 i-- @@ -2066,22 +2261,22 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0x22 } if m.VotingPeriod != nil { - n14, err14 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(*m.VotingPeriod, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(*m.VotingPeriod):]) - if err14 != nil { - return 0, err14 + n16, err16 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(*m.VotingPeriod, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(*m.VotingPeriod):]) + if err16 != nil { + return 0, err16 } - i -= n14 - i = encodeVarintGov(dAtA, i, uint64(n14)) + i -= n16 + i = encodeVarintGov(dAtA, i, uint64(n16)) i-- dAtA[i] = 0x1a } if m.MaxDepositPeriod != nil { - n15, err15 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(*m.MaxDepositPeriod, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(*m.MaxDepositPeriod):]) - if err15 != nil { - return 0, err15 + n17, err17 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(*m.MaxDepositPeriod, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(*m.MaxDepositPeriod):]) + if err17 != nil { + return 0, err17 } - i -= n15 - i = encodeVarintGov(dAtA, i, uint64(n15)) + i -= n17 + i = encodeVarintGov(dAtA, i, uint64(n17)) i-- dAtA[i] = 0x12 } @@ -2397,6 +2592,39 @@ func (m *MinDepositThrottler) Size() (n int) { return n } +func (m *MinInitialDepositThrottler) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.FloorValue) > 0 { + for _, e := range m.FloorValue { + l = e.Size() + n += 1 + l + sovGov(uint64(l)) + } + } + if m.UpdatePeriod != nil { + l = github_com_cosmos_gogoproto_types.SizeOfStdDuration(*m.UpdatePeriod) + n += 1 + l + sovGov(uint64(l)) + } + if m.TargetProposals != 0 { + n += 1 + sovGov(uint64(m.TargetProposals)) + } + l = len(m.IncreaseRatio) + if l > 0 { + n += 1 + l + sovGov(uint64(l)) + } + l = len(m.DecreaseRatio) + if l > 0 { + n += 1 + l + sovGov(uint64(l)) + } + if m.SensitivityTargetDistance != 0 { + n += 1 + sovGov(uint64(m.SensitivityTargetDistance)) + } + return n +} + func (m *Params) Size() (n int) { if m == nil { return 0 @@ -2470,6 +2698,10 @@ func (m *Params) Size() (n int) { l = m.MinDepositThrottler.Size() n += 2 + l + sovGov(uint64(l)) } + if m.MinInitialDepositThrottler != nil { + l = m.MinInitialDepositThrottler.Size() + n += 2 + l + sovGov(uint64(l)) + } return n } @@ -4406,6 +4638,228 @@ func (m *MinDepositThrottler) Unmarshal(dAtA []byte) error { } return nil } +func (m *MinInitialDepositThrottler) 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 ErrIntOverflowGov + } + 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: MinInitialDepositThrottler: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MinInitialDepositThrottler: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FloorValue", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.FloorValue = append(m.FloorValue, types.Coin{}) + if err := m.FloorValue[len(m.FloorValue)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field UpdatePeriod", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.UpdatePeriod == nil { + m.UpdatePeriod = new(time.Duration) + } + if err := github_com_cosmos_gogoproto_types.StdDurationUnmarshal(m.UpdatePeriod, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TargetProposals", wireType) + } + m.TargetProposals = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.TargetProposals |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field IncreaseRatio", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + 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 ErrInvalidLengthGov + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.IncreaseRatio = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DecreaseRatio", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + 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 ErrInvalidLengthGov + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DecreaseRatio = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field SensitivityTargetDistance", wireType) + } + m.SensitivityTargetDistance = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.SensitivityTargetDistance |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipGov(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGov + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *Params) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -4964,6 +5418,42 @@ func (m *Params) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 24: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MinInitialDepositThrottler", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.MinInitialDepositThrottler == nil { + m.MinInitialDepositThrottler = &MinInitialDepositThrottler{} + } + if err := m.MinInitialDepositThrottler.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGov(dAtA[iNdEx:]) diff --git a/x/gov/types/v1/params.go b/x/gov/types/v1/params.go index 1a4b120f..4db865d2 100644 --- a/x/gov/types/v1/params.go +++ b/x/gov/types/v1/params.go @@ -37,20 +37,26 @@ var ( DefaultConstitutionAmendmentThreshold = sdk.NewDecWithPrec(9, 1) DefaultLawQuorum = sdk.NewDecWithPrec(25, 2) DefaultLawThreshold = sdk.NewDecWithPrec(9, 1) - DefaultMinInitialDepositRatio = sdk.ZeroDec() - DefaultBurnProposalPrevote = false // set to false to replicate behavior of when this change was made (0.47) - DefaultBurnVoteQuorom = false // set to false to replicate behavior of when this change was made (0.47) - DefaultMinDepositRatio = sdk.NewDecWithPrec(1, 2) // NOTE: backport from v50 - - DefaultQuorumTimeout time.Duration = DefaultVotingPeriod - (time.Hour * 24 * 1) // disabled by default (DefaultQuorumCheckCount must be set to a non-zero value to enable) - DefaultMaxVotingPeriodExtension time.Duration = DefaultVotingPeriod - DefaultQuorumTimeout // disabled by default (DefaultQuorumCheckCount must be set to a non-zero value to enable) - DefaultQuorumCheckCount uint64 = 0 // disabled by default (0 means no check) - DefaultMinDepositFloor sdk.Coins = sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, DefaultMinDepositTokens)) - DefaultMinDepositUpdatePeriod time.Duration = time.Hour * 24 * 7 - DefaultMinDepositSensitivityTargetDistance uint64 = 2 - DefaultMinDepositIncreaseRatio = sdk.NewDecWithPrec(5, 2) - DefaultMinDepositDecreaseRatio = sdk.NewDecWithPrec(25, 3) - DefaultTargetActiveProposals uint64 = 2 + // DefaultMinInitialDepositRatio = sdk.ZeroDec() + DefaultBurnProposalPrevote = false // set to false to replicate behavior of when this change was made (0.47) + DefaultBurnVoteQuorom = false // set to false to replicate behavior of when this change was made (0.47) + DefaultMinDepositRatio = sdk.NewDecWithPrec(1, 2) // NOTE: backport from v50 + + DefaultQuorumTimeout time.Duration = DefaultVotingPeriod - (time.Hour * 24 * 1) // disabled by default (DefaultQuorumCheckCount must be set to a non-zero value to enable) + DefaultMaxVotingPeriodExtension time.Duration = DefaultVotingPeriod - DefaultQuorumTimeout // disabled by default (DefaultQuorumCheckCount must be set to a non-zero value to enable) + DefaultQuorumCheckCount uint64 = 0 // disabled by default (0 means no check) + DefaultMinDepositFloor sdk.Coins = sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, DefaultMinDepositTokens)) + DefaultMinDepositUpdatePeriod time.Duration = time.Hour * 24 * 7 + DefaultMinDepositSensitivityTargetDistance uint64 = 2 + DefaultMinDepositIncreaseRatio = sdk.NewDecWithPrec(5, 2) + DefaultMinDepositDecreaseRatio = sdk.NewDecWithPrec(25, 3) + DefaultTargetActiveProposals uint64 = 2 + DefaultMinInitialDepositFloor sdk.Coins = sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewDecWithPrec(1, 2).MulInt(DefaultMinDepositTokens).TruncateInt())) + DefaultMinInitialDepositUpdatePeriod time.Duration = time.Hour * 24 + DefaultMinInitialDepositSensitivityTargetDistance uint64 = 2 + DefaultMinInitialDepositIncreaseRatio = sdk.NewDecWithPrec(1, 2) + DefaultMinInitialDepositDecreaseRatio = sdk.NewDecWithPrec(5, 3) + DefaultTargetProposalsInDepositPeriod uint64 = 5 ) // Deprecated: NewDepositParams creates a new DepositParams object @@ -80,11 +86,14 @@ func NewVotingParams(votingPeriod *time.Duration) VotingParams { func NewParams( // minDeposit sdk.Coins, // Deprecated in favor of dynamic min deposit maxDepositPeriod, votingPeriod time.Duration, - quorum, threshold, constitutionAmendmentQuorum, constitutionAmendmentThreshold, lawQuorum, lawThreshold, minInitialDepositRatio string, + quorum, threshold, constitutionAmendmentQuorum, constitutionAmendmentThreshold, lawQuorum, lawThreshold string, + // minInitialDepositRatio string, // Deprecated in favor of dynamic min initial deposit burnProposalDeposit, burnVoteQuorum bool, minDepositRatio string, quorumTimeout, maxVotingPeriodExtension time.Duration, quorumCheckCount uint64, minDepositFloor sdk.Coins, minDepositUpdatePeriod time.Duration, minDepositSensitivityTargetDistance uint64, minDepositIncreaseRatio, minDepositDecreaseRatio string, targetActiveProposals uint64, + minInitialDepositFloor sdk.Coins, minInitialDepositUpdatePeriod time.Duration, minInitialDepositSensitivityTargetDistance uint64, + minInitialDepositIncreaseRatio, minInitialDepositDecreaseRatio string, targetProposalsInDepositPeriod uint64, ) Params { return Params{ // MinDeposit: minDeposit, // Deprecated in favor of dynamic min deposit @@ -96,13 +105,13 @@ func NewParams( ConstitutionAmendmentThreshold: constitutionAmendmentThreshold, LawQuorum: lawQuorum, LawThreshold: lawThreshold, - MinInitialDepositRatio: minInitialDepositRatio, - BurnProposalDepositPrevote: burnProposalDeposit, - BurnVoteQuorum: burnVoteQuorum, - MinDepositRatio: minDepositRatio, - QuorumTimeout: &quorumTimeout, - MaxVotingPeriodExtension: &maxVotingPeriodExtension, - QuorumCheckCount: quorumCheckCount, + // MinInitialDepositRatio: minInitialDepositRatio, // Deprecated in favor of dynamic min deposit + BurnProposalDepositPrevote: burnProposalDeposit, + BurnVoteQuorum: burnVoteQuorum, + MinDepositRatio: minDepositRatio, + QuorumTimeout: &quorumTimeout, + MaxVotingPeriodExtension: &maxVotingPeriodExtension, + QuorumCheckCount: quorumCheckCount, MinDepositThrottler: &MinDepositThrottler{ FloorValue: minDepositFloor, UpdatePeriod: &minDepositUpdatePeriod, @@ -111,6 +120,14 @@ func NewParams( DecreaseRatio: minDepositDecreaseRatio, TargetActiveProposals: targetActiveProposals, }, + MinInitialDepositThrottler: &MinInitialDepositThrottler{ + FloorValue: minInitialDepositFloor, + UpdatePeriod: &minInitialDepositUpdatePeriod, + SensitivityTargetDistance: minInitialDepositSensitivityTargetDistance, + IncreaseRatio: minInitialDepositIncreaseRatio, + DecreaseRatio: minInitialDepositDecreaseRatio, + TargetProposals: targetProposalsInDepositPeriod, + }, } } @@ -126,7 +143,7 @@ func DefaultParams() Params { DefaultConstitutionAmendmentThreshold.String(), DefaultLawQuorum.String(), DefaultLawThreshold.String(), - DefaultMinInitialDepositRatio.String(), + // DefaultMinInitialDepositRatio.String(), DefaultBurnProposalPrevote, DefaultBurnVoteQuorom, DefaultMinDepositRatio.String(), @@ -139,6 +156,12 @@ func DefaultParams() Params { DefaultMinDepositIncreaseRatio.String(), DefaultMinDepositDecreaseRatio.String(), DefaultTargetActiveProposals, + DefaultMinInitialDepositFloor, + DefaultMinInitialDepositUpdatePeriod, + DefaultMinInitialDepositSensitivityTargetDistance, + DefaultMinInitialDepositIncreaseRatio.String(), + DefaultMinInitialDepositDecreaseRatio.String(), + DefaultTargetProposalsInDepositPeriod, ) } @@ -255,15 +278,18 @@ func (p Params) ValidateBasic() error { return fmt.Errorf("voting period must be at least %s: %s", minVotingPeriod.String(), p.VotingPeriod.String()) } - minInitialDepositRatio, err := math.LegacyNewDecFromStr(p.MinInitialDepositRatio) - if err != nil { - return fmt.Errorf("invalid mininum initial deposit ratio of proposal: %w", err) - } - if minInitialDepositRatio.IsNegative() { - return fmt.Errorf("mininum initial deposit ratio of proposal must be positive: %s", minInitialDepositRatio) - } - if minInitialDepositRatio.GT(math.LegacyOneDec()) { - return fmt.Errorf("mininum initial deposit ratio of proposal is too large: %s", minInitialDepositRatio) + // minInitialDepositRatio, err := math.LegacyNewDecFromStr(p.MinInitialDepositRatio) + // if err != nil { + // return fmt.Errorf("invalid mininum initial deposit ratio of proposal: %w", err) + // } + // if minInitialDepositRatio.IsNegative() { + // return fmt.Errorf("mininum initial deposit ratio of proposal must be positive: %s", minInitialDepositRatio) + // } + // if minInitialDepositRatio.GT(math.LegacyOneDec()) { + // return fmt.Errorf("mininum initial deposit ratio of proposal is too large: %s", minInitialDepositRatio) + // } + if len(p.MinInitialDepositRatio) > 0 { + return fmt.Errorf("manually setting min initial deposit ratio is deprecated in favor of a dynamic min initial deposit") } minDepositRatio, err := math.LegacyNewDecFromStr(p.MinDepositRatio) @@ -343,5 +369,55 @@ func (p Params) ValidateBasic() error { return fmt.Errorf("minimum deposit decrease ratio too large: %s", minDepositDecreaseRatio) } + if p.MinInitialDepositThrottler == nil { + return fmt.Errorf("min initial deposit throttler must not be nil") + } + + if minInitialDepositFloor := sdk.Coins(p.MinInitialDepositThrottler.FloorValue); minInitialDepositFloor.Empty() || !minInitialDepositFloor.IsValid() { + return fmt.Errorf("invalid minimum initial deposit floor: %s", minInitialDepositFloor) + } + + if p.MinInitialDepositThrottler.UpdatePeriod == nil { + return fmt.Errorf("minimum initial deposit update period must not be nil") + } + + if p.MinInitialDepositThrottler.UpdatePeriod.Seconds() <= 0 { + return fmt.Errorf("minimum initial deposit update period must be positive: %s", p.MinInitialDepositThrottler.UpdatePeriod) + } + + if p.MinInitialDepositThrottler.UpdatePeriod.Seconds() > p.VotingPeriod.Seconds() { + return fmt.Errorf("minimum initial deposit update period must be less than or equal to the voting period: %s", p.MinInitialDepositThrottler.UpdatePeriod) + } + + if p.MinInitialDepositThrottler.SensitivityTargetDistance == 0 { + return fmt.Errorf("minimum initial deposit sensitivity target distance must be positive: %d", p.MinInitialDepositThrottler.SensitivityTargetDistance) + } + + minInitialDepositIncreaseRatio, err := sdk.NewDecFromStr(p.MinInitialDepositThrottler.IncreaseRatio) + if err != nil { + return fmt.Errorf("invalid minimum initial deposit increase ratio: %w", err) + } + + if !minInitialDepositIncreaseRatio.IsPositive() { + return fmt.Errorf("minimum initial deposit increase ratio must be positive: %s", minInitialDepositIncreaseRatio) + } + + if minInitialDepositIncreaseRatio.GTE(math.LegacyOneDec()) { + return fmt.Errorf("minimum initial deposit increase ratio too large: %s", minInitialDepositIncreaseRatio) + } + + minInitialDepositDecreaseRatio, err := sdk.NewDecFromStr(p.MinInitialDepositThrottler.DecreaseRatio) + if err != nil { + return fmt.Errorf("invalid minimum initial deposit decrease ratio: %w", err) + } + + if !minInitialDepositDecreaseRatio.IsPositive() { + return fmt.Errorf("minimum initial deposit decrease ratio must be positive: %s", minInitialDepositDecreaseRatio) + } + + if minInitialDepositDecreaseRatio.GTE(math.LegacyOneDec()) { + return fmt.Errorf("minimum initial deposit decrease ratio too large: %s", minInitialDepositDecreaseRatio) + } + return nil } diff --git a/x/gov/types/v1/query.pb.go b/x/gov/types/v1/query.pb.go index 1ba5c62d..ebabb452 100644 --- a/x/gov/types/v1/query.pb.go +++ b/x/gov/types/v1/query.pb.go @@ -1060,6 +1060,89 @@ func (m *QueryMinDepositResponse) GetMinDeposit() []types.Coin { return nil } +// QueryMinInitialDepositRequest is the request type for the Query/MinInitialDeposit RPC method. +type QueryMinInitialDepositRequest struct { +} + +func (m *QueryMinInitialDepositRequest) Reset() { *m = QueryMinInitialDepositRequest{} } +func (m *QueryMinInitialDepositRequest) String() string { return proto.CompactTextString(m) } +func (*QueryMinInitialDepositRequest) ProtoMessage() {} +func (*QueryMinInitialDepositRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_2290d0188dd70223, []int{20} +} +func (m *QueryMinInitialDepositRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryMinInitialDepositRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryMinInitialDepositRequest.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 *QueryMinInitialDepositRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryMinInitialDepositRequest.Merge(m, src) +} +func (m *QueryMinInitialDepositRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryMinInitialDepositRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryMinInitialDepositRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryMinInitialDepositRequest proto.InternalMessageInfo + +// QueryMinInitialDepositResponse is the response type for the Query/MinInitialDeposit RPC method. +type QueryMinInitialDepositResponse struct { + // min_initial_deposit defines the minimum initial deposit required for a proposal to be submitted. + MinInitialDeposit []types.Coin `protobuf:"bytes,1,rep,name=min_initial_deposit,json=minInitialDeposit,proto3" json:"min_initial_deposit"` +} + +func (m *QueryMinInitialDepositResponse) Reset() { *m = QueryMinInitialDepositResponse{} } +func (m *QueryMinInitialDepositResponse) String() string { return proto.CompactTextString(m) } +func (*QueryMinInitialDepositResponse) ProtoMessage() {} +func (*QueryMinInitialDepositResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_2290d0188dd70223, []int{21} +} +func (m *QueryMinInitialDepositResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryMinInitialDepositResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryMinInitialDepositResponse.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 *QueryMinInitialDepositResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryMinInitialDepositResponse.Merge(m, src) +} +func (m *QueryMinInitialDepositResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryMinInitialDepositResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryMinInitialDepositResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryMinInitialDepositResponse proto.InternalMessageInfo + +func (m *QueryMinInitialDepositResponse) GetMinInitialDeposit() []types.Coin { + if m != nil { + return m.MinInitialDeposit + } + return nil +} + func init() { proto.RegisterType((*QueryConstitutionRequest)(nil), "atomone.gov.v1.QueryConstitutionRequest") proto.RegisterType((*QueryConstitutionResponse)(nil), "atomone.gov.v1.QueryConstitutionResponse") @@ -1081,83 +1164,89 @@ func init() { proto.RegisterType((*QueryTallyResultResponse)(nil), "atomone.gov.v1.QueryTallyResultResponse") proto.RegisterType((*QueryMinDepositRequest)(nil), "atomone.gov.v1.QueryMinDepositRequest") proto.RegisterType((*QueryMinDepositResponse)(nil), "atomone.gov.v1.QueryMinDepositResponse") + proto.RegisterType((*QueryMinInitialDepositRequest)(nil), "atomone.gov.v1.QueryMinInitialDepositRequest") + proto.RegisterType((*QueryMinInitialDepositResponse)(nil), "atomone.gov.v1.QueryMinInitialDepositResponse") } func init() { proto.RegisterFile("atomone/gov/v1/query.proto", fileDescriptor_2290d0188dd70223) } var fileDescriptor_2290d0188dd70223 = []byte{ - // 1121 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x57, 0x4b, 0x6f, 0xdc, 0x54, - 0x14, 0x8e, 0x27, 0x8f, 0x26, 0x67, 0xd2, 0x00, 0x87, 0xd0, 0x3a, 0x6e, 0x98, 0xb6, 0x26, 0x24, - 0x69, 0x45, 0x6c, 0x92, 0x92, 0x16, 0x21, 0xca, 0x23, 0x2d, 0x0d, 0x5d, 0x54, 0x0a, 0x6e, 0xc5, - 0x02, 0x16, 0x23, 0x67, 0xc6, 0x72, 0x2d, 0xcd, 0xf8, 0xba, 0xe3, 0x3b, 0x23, 0xa2, 0x30, 0xaa, - 0xa8, 0x84, 0x44, 0x59, 0x15, 0x21, 0x84, 0xe8, 0xef, 0xe0, 0x47, 0x74, 0x59, 0xc1, 0x86, 0x15, - 0x42, 0x09, 0x3f, 0x04, 0xf9, 0xde, 0x63, 0x8f, 0xed, 0xf1, 0x3c, 0x52, 0x55, 0xec, 0x92, 0x7b, - 0xbf, 0xf3, 0x9d, 0xef, 0x9e, 0xa7, 0x07, 0x34, 0x9b, 0xb3, 0x26, 0xf3, 0x1d, 0xd3, 0x65, 0x1d, - 0xb3, 0xb3, 0x69, 0x3e, 0x68, 0x3b, 0xad, 0x03, 0x23, 0x68, 0x31, 0xce, 0x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xf7, 0x58, 0x01, 0x4c, 0xbb, 0x27, - 0xf9, 0x97, 0x65, 0x0c, 0xe2, 0xac, 0x15, 0xeb, 0x97, 0x90, 0x97, 0x97, 0xad, 0x6d, 0x92, 0xb2, - 0x67, 0xb7, 0xec, 0x66, 0x26, 0x14, 0xe2, 0xa0, 0xca, 0x0f, 0x02, 0x87, 0xa6, 0x03, 0xc8, 0xa3, - 0x7b, 0x07, 0x81, 0xa3, 0x3f, 0x2d, 0xc1, 0xeb, 0x19, 0x3b, 0x7a, 0xc3, 0x67, 0x70, 0xba, 0xc3, - 0xb8, 0xe7, 0xbb, 0x55, 0x09, 0xa6, 0x5c, 0x2c, 0x17, 0xbc, 0xc5, 0xf3, 0x5d, 0x69, 0xbc, 0x53, - 0x52, 0x15, 0x6b, 0xbe, 0x93, 0x3a, 0xc1, 0xcf, 0x61, 0x81, 0x9a, 0x26, 0xe6, 0x91, 0x4f, 0x7c, - 0x33, 0xcf, 0x73, 0x53, 0xa2, 0x52, 0x44, 0xa7, 0xeb, 0xe9, 0x23, 0xdc, 0x81, 0x79, 0x6e, 0x37, - 0x1a, 0x07, 0x31, 0xcf, 0xa4, 0xe0, 0x39, 0x97, 0xe7, 0xb9, 0x17, 0x61, 0x52, 0x2c, 0x65, 0xde, - 0x3b, 0x40, 0x03, 0x66, 0xc8, 0x5a, 0x76, 0xec, 0x99, 0xbe, 0x7e, 0x92, 0x41, 0x20, 0x94, 0xee, - 0x53, 0x6c, 0x48, 0xdc, 0xd8, 0xf5, 0x95, 0x99, 0x2a, 0xa5, 0xb1, 0xa7, 0x8a, 0x7e, 0x9b, 0x06, - 0x75, 0xe2, 0x8f, 0x92, 0xb1, 0x09, 0xa7, 0x08, 0x44, 0x69, 0x38, 0x3b, 0x20, 0x7c, 0x56, 0x8c, - 0xd3, 0x1f, 0x66, 0xa9, 0xfe, 0xff, 0xde, 0xf8, 0x45, 0xa1, 0x61, 0xdf, 0x53, 0x40, 0xaf, 0xb9, - 0x02, 0xb3, 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24, 0x8e, 0x64, 0xe9, - 0x42, 0xd6, 0x32, 0x6a, 0x79, 0x59, 0x4d, 0xcf, 0xa7, 0xf0, 0xec, 0xec, 0x3e, 0x3b, 0xaa, 0x28, - 0xcf, 0x8f, 0x2a, 0xca, 0x3f, 0x47, 0x15, 0xe5, 0xc9, 0x71, 0x65, 0xe2, 0xf9, 0x71, 0x65, 0xe2, - 0xaf, 0xe3, 0xca, 0xc4, 0x57, 0x1b, 0xae, 0xc7, 0xef, 0xb7, 0xf7, 0x8d, 0x1a, 0x6b, 0xc6, 0xf6, - 0x1b, 0xf7, 0xdb, 0xfb, 0x09, 0xd7, 0x37, 0x82, 0x2d, 0x2a, 0xca, 0x30, 0xfa, 0x89, 0x3a, 0x23, - 0x7e, 0x40, 0x5e, 0xf9, 0x2f, 0x00, 0x00, 0xff, 0xff, 0x97, 0x80, 0xc3, 0xd4, 0x23, 0x0f, 0x00, - 0x00, + // 1190 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x57, 0x5b, 0x6f, 0xdc, 0x44, + 0x14, 0x8e, 0xb7, 0x49, 0x9a, 0x9c, 0xa4, 0x81, 0x9c, 0x86, 0xd6, 0x71, 0xd3, 0x4d, 0x33, 0x0d, + 0xb9, 0x54, 0xc4, 0x26, 0x29, 0x69, 0x11, 0xa2, 0x5c, 0xd2, 0xd2, 0x90, 0x87, 0x8a, 0xb0, 0xad, + 0x78, 0x80, 0x87, 0xc8, 0xc9, 0x5a, 0xae, 0xa5, 0x5d, 0xcf, 0x66, 0x3d, 0xbb, 0x22, 0x0a, 0x51, + 0x05, 0x12, 0x12, 0xe5, 0xa9, 0x08, 0x21, 0x44, 0x25, 0x5e, 0xf8, 0x0d, 0xfc, 0x88, 0x3e, 0x56, + 0xf0, 0xc2, 0x13, 0x42, 0x09, 0x3f, 0x04, 0x79, 0xe6, 0xd8, 0x6b, 0x7b, 0xbd, 0x97,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x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1193,6 +1282,9 @@ type QueryClient interface { // MinDeposit queries the minimum deposit currently // required for a proposal to enter voting period. MinDeposit(ctx context.Context, in *QueryMinDepositRequest, opts ...grpc.CallOption) (*QueryMinDepositResponse, error) + // MinInitialDeposit queries the minimum initial deposit + // currently required for a proposal to be submitted. + MinInitialDeposit(ctx context.Context, in *QueryMinInitialDepositRequest, opts ...grpc.CallOption) (*QueryMinInitialDepositResponse, error) } type queryClient struct { @@ -1293,6 +1385,15 @@ func (c *queryClient) MinDeposit(ctx context.Context, in *QueryMinDepositRequest return out, nil } +func (c *queryClient) MinInitialDeposit(ctx context.Context, in *QueryMinInitialDepositRequest, opts ...grpc.CallOption) (*QueryMinInitialDepositResponse, error) { + out := new(QueryMinInitialDepositResponse) + err := c.cc.Invoke(ctx, "/atomone.gov.v1.Query/MinInitialDeposit", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // QueryServer is the server API for Query service. type QueryServer interface { // Constitution queries the chain's constitution. @@ -1316,6 +1417,9 @@ type QueryServer interface { // MinDeposit queries the minimum deposit currently // required for a proposal to enter voting period. MinDeposit(context.Context, *QueryMinDepositRequest) (*QueryMinDepositResponse, error) + // MinInitialDeposit queries the minimum initial deposit + // currently required for a proposal to be submitted. + MinInitialDeposit(context.Context, *QueryMinInitialDepositRequest) (*QueryMinInitialDepositResponse, error) } // UnimplementedQueryServer can be embedded to have forward compatible implementations. @@ -1352,6 +1456,9 @@ func (*UnimplementedQueryServer) TallyResult(ctx context.Context, req *QueryTall func (*UnimplementedQueryServer) MinDeposit(ctx context.Context, req *QueryMinDepositRequest) (*QueryMinDepositResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method MinDeposit not implemented") } +func (*UnimplementedQueryServer) MinInitialDeposit(ctx context.Context, req *QueryMinInitialDepositRequest) (*QueryMinInitialDepositResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method MinInitialDeposit not implemented") +} func RegisterQueryServer(s grpc1.Server, srv QueryServer) { s.RegisterService(&_Query_serviceDesc, srv) @@ -1537,6 +1644,24 @@ func _Query_MinDeposit_Handler(srv interface{}, ctx context.Context, dec func(in return interceptor(ctx, in, info, handler) } +func _Query_MinInitialDeposit_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryMinInitialDepositRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).MinInitialDeposit(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/atomone.gov.v1.Query/MinInitialDeposit", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).MinInitialDeposit(ctx, req.(*QueryMinInitialDepositRequest)) + } + return interceptor(ctx, in, info, handler) +} + var _Query_serviceDesc = grpc.ServiceDesc{ ServiceName: "atomone.gov.v1.Query", HandlerType: (*QueryServer)(nil), @@ -1581,6 +1706,10 @@ var _Query_serviceDesc = grpc.ServiceDesc{ MethodName: "MinDeposit", Handler: _Query_MinDeposit_Handler, }, + { + MethodName: "MinInitialDeposit", + Handler: _Query_MinInitialDeposit_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "atomone/gov/v1/query.proto", @@ -2347,6 +2476,66 @@ func (m *QueryMinDepositResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) return len(dAtA) - i, nil } +func (m *QueryMinInitialDepositRequest) 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 *QueryMinInitialDepositRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryMinInitialDepositRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *QueryMinInitialDepositResponse) 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 *QueryMinInitialDepositResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryMinInitialDepositResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.MinInitialDeposit) > 0 { + for iNdEx := len(m.MinInitialDeposit) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.MinInitialDeposit[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { offset -= sovQuery(v) base := offset @@ -2663,6 +2852,30 @@ func (m *QueryMinDepositResponse) Size() (n int) { return n } +func (m *QueryMinInitialDepositRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryMinInitialDepositResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.MinInitialDeposit) > 0 { + for _, e := range m.MinInitialDeposit { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + return n +} + func sovQuery(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -4634,6 +4847,140 @@ func (m *QueryMinDepositResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *QueryMinInitialDepositRequest) 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 ErrIntOverflowQuery + } + 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: QueryMinInitialDepositRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryMinInitialDepositRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryMinInitialDepositResponse) 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 ErrIntOverflowQuery + } + 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: QueryMinInitialDepositResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryMinInitialDepositResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MinInitialDeposit", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.MinInitialDeposit = append(m.MinInitialDeposit, types.Coin{}) + if err := m.MinInitialDeposit[len(m.MinInitialDeposit)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipQuery(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/gov/types/v1/query.pb.gw.go b/x/gov/types/v1/query.pb.gw.go index b4788f4f..82bdfff5 100644 --- a/x/gov/types/v1/query.pb.gw.go +++ b/x/gov/types/v1/query.pb.gw.go @@ -563,6 +563,24 @@ func local_request_Query_MinDeposit_0(ctx context.Context, marshaler runtime.Mar } +func request_Query_MinInitialDeposit_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryMinInitialDepositRequest + var metadata runtime.ServerMetadata + + msg, err := client.MinInitialDeposit(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_MinInitialDeposit_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryMinInitialDepositRequest + var metadata runtime.ServerMetadata + + msg, err := server.MinInitialDeposit(ctx, &protoReq) + return msg, metadata, err + +} + // RegisterQueryHandlerServer registers the http handlers for service Query to "mux". // UnaryRPC :call QueryServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. @@ -799,6 +817,29 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) + mux.Handle("GET", pattern_Query_MinInitialDeposit_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_MinInitialDeposit_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_MinInitialDeposit_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -1040,6 +1081,26 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) + mux.Handle("GET", pattern_Query_MinInitialDeposit_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_MinInitialDeposit_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_MinInitialDeposit_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -1063,6 +1124,8 @@ var ( pattern_Query_TallyResult_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 2, 5}, []string{"atomone", "gov", "v1", "proposals", "proposal_id", "tally"}, "", runtime.AssumeColonVerbOpt(false))) pattern_Query_MinDeposit_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"atomone", "gov", "v1", "mindeposit"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_MinInitialDeposit_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"atomone", "gov", "v1", "mininitialdeposit"}, "", runtime.AssumeColonVerbOpt(false))) ) var ( @@ -1085,4 +1148,6 @@ var ( forward_Query_TallyResult_0 = runtime.ForwardResponseMessage forward_Query_MinDeposit_0 = runtime.ForwardResponseMessage + + forward_Query_MinInitialDeposit_0 = runtime.ForwardResponseMessage ) From 1d88928a1dbac6ff30097f2043b05323fd60a8c2 Mon Sep 17 00:00:00 2001 From: Giuseppe Natale <12249307+giunatale@users.noreply.github.com> Date: Tue, 14 Jan 2025 12:01:13 +0100 Subject: [PATCH 26/29] use common variables --- tests/e2e/genesis_test.go | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/tests/e2e/genesis_test.go b/tests/e2e/genesis_test.go index 74753049..78def00b 100644 --- a/tests/e2e/genesis_test.go +++ b/tests/e2e/genesis_test.go @@ -176,8 +176,6 @@ func modifyGenesis(path, moniker, amountStr string, addrAll []sdk.AccAddress, de appState[minttypes.ModuleName] = mintGenStateBz // Refactor to separate method - amnt := sdk.NewInt(10000) - initialDepositAmnt := sdk.NewInt(100) quorum, _ := sdk.NewDecFromStr("0.000000000000000001") threshold, _ := sdk.NewDecFromStr("0.000000000000000001") lawQuorum, _ := sdk.NewDecFromStr("0.000000000000000001") @@ -190,7 +188,7 @@ func modifyGenesis(path, moniker, amountStr string, addrAll []sdk.AccAddress, de govGenState := govv1.NewGenesisState(1, govv1.NewParams( - // sdk.NewCoins(sdk.NewCoin(denom, amnt)), + // sdk.NewCoins(sdk.NewCoin(denom, depositAmount.Amount)), maxDepositPeriod, votingPeriod, quorum.String(), threshold.String(), @@ -198,10 +196,10 @@ func modifyGenesis(path, moniker, amountStr string, addrAll []sdk.AccAddress, de // sdk.ZeroDec().String(), false, false, govv1.DefaultMinDepositRatio.String(), govv1.DefaultQuorumTimeout, govv1.DefaultMaxVotingPeriodExtension, govv1.DefaultQuorumCheckCount, - sdk.NewCoins(sdk.NewCoin(denom, amnt)), govv1.DefaultMinDepositUpdatePeriod, + sdk.NewCoins(sdk.NewCoin(denom, depositAmount.Amount)), govv1.DefaultMinDepositUpdatePeriod, govv1.DefaultMinDepositSensitivityTargetDistance, govv1.DefaultMinDepositIncreaseRatio.String(), govv1.DefaultMinDepositDecreaseRatio.String(), - govv1.DefaultTargetActiveProposals, sdk.NewCoins(sdk.NewCoin(denom, initialDepositAmnt)), govv1.DefaultMinInitialDepositUpdatePeriod, + govv1.DefaultTargetActiveProposals, sdk.NewCoins(sdk.NewCoin(denom, initialDepositAmount.Amount)), govv1.DefaultMinInitialDepositUpdatePeriod, govv1.DefaultMinInitialDepositSensitivityTargetDistance, govv1.DefaultMinInitialDepositIncreaseRatio.String(), govv1.DefaultMinInitialDepositDecreaseRatio.String(), govv1.DefaultTargetProposalsInDepositPeriod, ), From 354908fe3117bb36717eaec558fef509de8c737d Mon Sep 17 00:00:00 2001 From: Giuseppe Natale <12249307+giunatale@users.noreply.github.com> Date: Thu, 16 Jan 2025 17:40:37 +0100 Subject: [PATCH 27/29] docs(x/gov): update documentation to include dynamic deposits (#75) --- x/gov/README.md | 450 ++++++++++++++++++++++++++++++++++++------------ 1 file changed, 336 insertions(+), 114 deletions(-) diff --git a/x/gov/README.md b/x/gov/README.md index 99519fc8..101c5689 100644 --- a/x/gov/README.md +++ b/x/gov/README.md @@ -17,12 +17,15 @@ on proposals on a 1 token 1 vote basis. Next is a list of features the module currently supports: * **Proposal submission:** Users can submit proposals with a deposit. Once the -minimum deposit is reached, the proposal enters voting period. The minimum deposit -can be reached by collecting deposits from different users (including proposer) within deposit period. -* **Vote:** Participants can vote on proposals that reached `MinDeposit` and entered voting period. + minimum deposit is reached, the proposal enters the voting period. The deposit + system is dynamic and can adjust automatically to discourage excessive + spam or an excessive number of simultaneous active proposals. +* **Vote:** Participants can vote on proposals that reached the dynamic minimum + deposit and entered the voting period. * **Claiming deposit:** Users that deposited on proposals can recover their -deposits if the proposal was accepted or rejected. If the proposal never entered voting period -(minimum deposit not reached within deposit period), the deposit is burned. + deposits if the proposal was accepted or rejected. If the proposal never entered + the voting period (the dynamic minimum deposit was never reached within the + deposit period), the deposit is burned. This module is in use in [AtomOne](https://github.com/atomone-hub/atomone)). Features that may be added in the future are described in [Future Improvements](#future-improvements). @@ -73,12 +76,11 @@ staking token of the chain. The governance process is divided in a few steps that are outlined below: -* **Proposal submission:** Proposal is submitted to the blockchain with a - deposit. -* **Vote:** Once deposit reaches a certain value (`MinDeposit`), proposal is - confirmed and vote opens. Bonded Atone holders can then send `MsgVote` +* **Proposal submission:** Proposal is submitted to the blockchain with a deposit. +* **Vote:** Once the deposit reaches the (dynamically set) `MinDeposit`, the proposal + is confirmed and voting opens. Bonded Atone holders can then send `MsgVote` transactions to vote on the proposal. -* **Execution** After a period of time, the votes are tallied and depending +* **Execution:** After a period of time, the votes are tallied and depending on the result, the messages in the proposal will be executed. ### Proposal submission @@ -90,33 +92,67 @@ Once a proposal is submitted, it is identified by its unique `proposalID`. #### Proposal Messages -A proposal includes an array of `sdk.Msg`s which are executed automatically if the -proposal passes. The messages are executed by the governance `ModuleAccount` itself. Modules -such as `x/upgrade`, that want to allow certain messages to be executed by governance -only should add a whitelist within the respective msg server, granting the governance -module the right to execute the message once a quorum has been reached. The governance -module uses the `MsgServiceRouter` to check that these messages are correctly constructed -and have a respective path to execute on but do not perform a full validity check. +A proposal includes an array of `sdk.Msgs` which are executed automatically if the +proposal passes. The messages are executed by the governance `ModuleAccount` itself. +Modules such as `x/upgrade`, that want to allow certain messages to be executed by +governance only should add a whitelist within the respective msg server, granting +the governance module the right to execute the message once a quorum has been +reached. The governance module uses the `MsgServiceRouter` to check that these +messages are correctly constructed and have a respective path to execute on but +do not perform a full validity check. ### Deposit -To prevent spam, proposals must be submitted with a deposit in the coins defined by -the `MinDeposit` param multiplied by the `MinInitialDepositRatio` param. - -When a proposal is submitted, it has to be accompanied with a deposit that must be -greater than the `MinDeposit` multiplied by the `MinInitialDepositRatio` param, -but can be inferior to `MinDeposit` (since `MinDepositRatio` is a percentage). -The submitter doesn't need to pay for the entire deposit on their own. The newly -created proposal is stored in an *inactive proposal queue* and stays there until -its deposit passes the `MinDeposit`. Other token holders can increase the proposal's -deposit by sending a `Deposit` transaction. Deposits from token holders must always be -greater than `MinDeposit` multiplied by the `MinDepositRatio` param, or they will be -rejected. If a proposal doesn't pass the `MinDeposit` before the deposit end time -(the time when deposits are no longer accepted), the proposal will be destroyed: the -proposal will be removed from state and the deposit will be burned (see x/gov -`EndBlocker`). When a proposal deposit passes the `MinDeposit` threshold -(even during the proposal submission) before the deposit end time, the proposal will -be moved into the *active proposal queue* and the voting period will begin. +To prevent spam, proposals must be submitted with an initial deposit in the +coins defined by the dynamic `MinInitialDeposit`. After the proposal is submitted, +the deposit from any token holder can increase until it meets or exceeds the current +dynamic `MinDeposit`. Once that threshold is reached (within the deposit period), +the proposal moves into the voting period. + +#### Dynamic MinInitialDeposit and MinDeposit + +In previous versions, `MinDeposit` was a fixed parameter and a fraction of it (called +`MinInitialDepositRatio`) was required at proposal submission. +Now, these parameters are determined by a dynamic system that can raise or +lower each threshold depending on the number of concurrent proposals in that state: + +- `MinInitialDeposit`: The minimum deposit required to create (submit) a proposal. + This threshold scales dynamically based on the number of proposals in the deposit + period. A floor value is set so that it cannot go below a certain amount, but it + can increase indefintely beyond that floor if many proposals enter deposit status + at once. + +- `MinDeposit`: The total deposit required for a proposal to enter the voting period. + This threshold also adapts to the current number of active (voting) proposals. + If the system detects too many simultaneous active proposals, the minimum deposit + can increase significantly, discouraging spam and helping the chain governance + remain more focused. + +Both dynamic deposit mechanisms have their own sets of parameters (see [Parameters](#parameters)), +can be queried via dedicated endpoints, and are individually updated as proposals +enter or exit the deposit or voting stages. They also continue adjusting as time +passes, ensuring that the system remains responsive to the current state of the chain. + +Threshold updates are triggered both by activation or deactivation of proposals ( +meaning when they enter/exit either the deposit or the voting periods) and by the +passage of time. More details on the mechanism and the update formulae available +in [ADR-003](../../docs/architecture/adr-003-governance-proposal-deposit-auto-throttler.md). + +#### Deposit process + +When a proposal is submitted, it must be accompanied by a deposit that is at least +the current `MinInitialDeposit` value. If the submitted deposit is valid, the +newly created proposal is placed in an *inactive proposal queue* (a.k.a. deposit +period queue). If the total deposit on the proposal is raised (through +`MsgDeposit`) to meet or exceed the current (dynamic) `MinDeposit` within +the deposit period, the proposal is immediately moved to the *active proposal +queue* and enters the voting period. + +If, by the end of the deposit period, the total deposit is still below the required +MinDeposit value, the proposal is removed from state and the entire deposit is +burned. However, at the end of the deposit period if for any reason the `MinDeposit` +was lowered and the proposal now meets the new threshold, the proposal is promoted +to voting period instead of being removed. The deposit is kept in escrow and held by the governance `ModuleAccount` until the proposal is finalized (passed or rejected). @@ -125,6 +161,8 @@ proposal is finalized (passed or rejected). When a proposal is finalized, the coins from the deposit are refunded regardless of wether the proposal is approved or rejected. +If the proposal never moved to the voting period, the deposit +is instead burned. All refunded or burned deposits are removed from the state. Events are issued when burning or refunding a deposit. @@ -132,20 +170,19 @@ when burning or refunding a deposit. #### Participants -*Participants* are users that have the right to vote on proposals. On the -AtomOne, participants are bonded Atone holders. Unbonded Atone holders and -other users do not get the right to participate in governance. However, they -can submit and deposit on proposals. +*Participants* are users that have the right to vote on proposals. On AtomOne, +participants are bonded Atone holders. Unbonded Atone holders and other users +do not get the right to participate in governance. However, they can still submit +and deposit on proposals. Note that when *participants* have bonded and unbonded Atones, their voting power is calculated from their bonded Atone holdings only. #### Voting period -Once a proposal reaches `MinDeposit`, it immediately enters `Voting period`. We -define `Voting period` as the interval between the moment the vote opens and -the moment the vote closes. `Voting period` should always be shorter than -`Unbonding period` to prevent double voting. The initial value of +Once a proposal reaches the dynamic `MinDeposit`, it immediately enters +`Voting period`. We define `Voting period` as the interval between the moment +the vote opens and the moment the vote closes. The initial value of `Voting period` is 3 weeks, which is also set as a hard lower bound. #### Option set @@ -294,8 +331,17 @@ be one active parameter set at any given time. If governance wants to change a parameter set, either to modify a value or add/remove a parameter field, a new parameter set has to be created and the previous one rendered inactive. +Due to the new dynamic depositfeature, the prior `MinDeposit` parameter is +deprecated and replaced by the dynamic mechanism defined via the +`MinDepositThrottler` struct. The same applies to `MinInitialDepositRatio`, +which is deprecated and replaced by a dynamic `MinInitialDeposit` +controlled via the `MinInitialDepositThrottler` struct. + #### DepositParams +*(`MinDeposit` inside the `DepositParams` is no longer used in code. Instead, see +[Params.min_deposit_throttler](#parameters).)* + ```protobuf reference https://github.com/atomone-hub/atomone/blob/b9631ed2e3b781cd82a14316f6086802d8cb4dcf/proto/atomone/gov/v1/gov.proto#L167-L181 ``` @@ -597,12 +643,31 @@ The `constitution` string will be updated by applying the patch defined in the ` An error will be returned if the `amendment` string is malformed, so constitution amendment proposals need to be crafted with care. +### Last Min Deposit and Last Min Initial Deposit + +The `LastMinDeposit` and `LastMinInitialDeposit` are used to store the last values +of the dynamic `MinDeposit` and `MinInitialDeposit` respectively upon proposals +activation or deactivation. These values are used to determine the current values +for the dynamic `MinDeposit` and `MinInitialDeposit` accounting also for the +passage of time as detailed in [ADR-003](../../docs/architecture/adr-003-governance-proposal-deposit-auto-throttler.md) + +**Store:** + +```protobuf reference +https://github.com/atomone-hub/atomone/blob/fb05dcaba40c7a1531a6806487fcd47a3e4aaef4/proto/atomone/gov/v1/gov.proto#L51-L60 +``` + ## Messages ### Proposal Submission Proposals can be submitted by any account via a `MsgSubmitProposal` transaction. +If the total deposit in the message is below the required dynamic `MinInitialDeposit` +at the time of submission, the transaction will fail. Otherwise, a new proposal +is created, the deposit is moved under governance escrow, and the proposal enters +the deposit period. + ```protobuf reference https://github.com/atomone-hub/atomone/blob/b9631ed2e3b781cd82a14316f6086802d8cb4dcf/proto/atomone/gov/v1/tx.proto#L53-L82 ``` @@ -619,7 +684,7 @@ must not be larger than the `maxMetadataLen` config passed into the gov keeper. * Initialise `Proposal`'s attributes * Decrease balance of sender by `InitialDeposit` * If `MinDeposit` is reached: - * Push `proposalID` in `ProposalProcessingQueue` + * Push `proposalID` in `ProposalProcessingQueue` * Transfer `InitialDeposit` from the `Proposer` to the governance `ModuleAccount` A `MsgSubmitProposal` transaction can be handled according to the following @@ -671,21 +736,19 @@ upon receiving txGovSubmitProposal from sender do Once a proposal is submitted, if `Proposal.TotalDeposit < ActiveParam.MinDeposit`, Atone holders can send -`MsgDeposit` transactions to increase the proposal's deposit. - -A proposal can only be sumbitted if the proposer deposits at least -`ActiveParam.MinDeposit` * `ActiveParam.MinInitialDepositRatio`, where -`ActiveParam.MinInitialDepositRatio` must be a valid percentage between 0 and 1. +`MsgDeposit` transactions to increase the proposal's deposit until the +proposal’s total deposit meets the dynamic `MinDeposit`. +If it surpasses the dynamic threshold within the deposit period, the +proposal is moved into the voting period immediately. Otherwise, the deposit +period eventually ends, and if the threshold is never met, the proposal is removed +from state and all deposits are burned. If however by the time the deposit +period ends the `MinDeposit` has been lowered and the proposal now meets the +new threshold, the proposal is activated instead of being removed. Any deposit from Atone holders (including the proposer) need to be of at least `ActiveParam.MinDeposit` * `ActiveParam.MinDepositRatio`, where `ActiveParam.MinDepositRatio` must be a valid percentage between 0 and 1. -Generally it is expected that -`ActiveParam.MinDepositRatio` <= `ActiveParam.MinInitialDepositRatio` - - - ```protobuf reference https://github.com/atomone-hub/atomone/blob/b9631ed2e3b781cd82a14316f6086802d8cb4dcf/proto/atomone/gov/v1/tx.proto#L150-L165 ``` @@ -696,7 +759,7 @@ https://github.com/atomone-hub/atomone/blob/b9631ed2e3b781cd82a14316f6086802d8cb * Add `deposit` of sender in `proposal.Deposits` * Increase `proposal.TotalDeposit` by sender's `deposit` * If `MinDeposit` is reached: - * Push `proposalID` in `ProposalProcessingQueueEnd` + * Push `proposalID` in `ProposalProcessingQueueEnd` * Transfer `Deposit` from the `proposer` to the governance `ModuleAccount` A `MsgDeposit` transaction has to go through a number of checks to be valid. @@ -861,31 +924,70 @@ The governance module emits the following events: ## Parameters -The governance module contains the following parameters: - -| Key | Type | Example | -|----------------------------------|------------------|-----------------------------------------| -| min_deposit | array (coins) | [{"denom":"uatone","amount":"10000000"}] | -| max_deposit_period | string (time ns) | "172800000000000" (17280s) | -| voting_period | string (time ns) | "172800000000000" (17280s) | -| quorum | string (dec) | "0.334000000000000000" | -| threshold | string (dec) | "0.500000000000000000" | -| burn_proposal_deposit_prevote | bool | false | -| burn_vote_quorum | bool | false | -| min_initial_deposit_ratio | string (dec) | "0.100000000000000000" | -| min_deposit_ratio | string (dec) | "0.010000000000000000" | -| constitution_amendment_quorum | string (dec) | "0.334000000000000000" | -| constitution_amendment_threshold | string (dec) | "0.900000000000000000" | -| law_quorum | string (dec) | "0.334000000000000000" | -| law_threshold | string (dec) | "0.900000000000000000" | -| quorum_timeout | string (time ns) | "172800000000000" (17280s) | -| max_voting_period_extension | string (time ns) | "172800000000000" (17280s) | -| quorum_check_count | uint64 | 2 | - - -**NOTE**: The governance module contains parameters that are objects unlike other -modules. If only a subset of parameters are desired to be changed, only they need -to be included and not the entire parameter object structure. +Below is an updated parameter set with new fields related to **dynamic deposit**. +Some older fields have been deprecated but remain in `gov.proto` for backward compatibility: + +| Key | Type | Example | +|----------------------------------|-------------------------------------------|-----------------------------------------| +| ~~min_deposit~~ | ~~array (coins)~~ **(deprecated)** | ~~[{"denom":"uatone","amount":"10000000"}]~~ | +| max_deposit_period | string (time ns) | "172800000000000" (17280s) | +| voting_period | string (time ns) | "172800000000000" (17280s) | +| quorum | string (dec) | "0.334000000000000000" | +| threshold | string (dec) | "0.500000000000000000" | +| burn_proposal_deposit_prevote | bool | false | +| burn_vote_quorum | bool | false | +| ~~min_initial_deposit_ratio~~ | ~~string (dec)~~ **(deprecated)** | ~~"0.100000000000000000"~~ | +| min_deposit_ratio | string (dec) | "0.010000000000000000" | +| constitution_amendment_quorum | string (dec) | "0.334000000000000000" | +| constitution_amendment_threshold | string (dec) | "0.900000000000000000" | +| law_quorum | string (dec) | "0.334000000000000000" | +| law_threshold | string (dec) | "0.900000000000000000" | +| quorum_timeout | string (time ns) | "172800000000000" (17280s) | +| max_voting_period_extension | string (time ns) | "172800000000000" (17280s) | +| quorum_check_count | uint64 | 2 | +| min_deposit_throttler | object (MinDepositThrottler) | _See below_ | +| min_initial_deposit_throttler | object (MinInitialDepositThrottler) | _See below_ | + +### MinDepositThrottler (dynamic MinDeposit) + +The `min_deposit_throttler` field in `Params` controls how `MinDeposit` is computed dynamically: + +- `floor_value`: The floor (lowest possible) deposit requirement. +- `update_period`: After how long the system should recalculate (time-based updates). +- `target_active_proposals`: The number of active proposals the dynamic deposit + tries to target. +- `increase_ratio` / `decrease_ratio`: How fast the min deposit goes up/down + relative to exceeding or being under that target. +- `sensitivity_target_distance`: A positive integer indicating how sensitive + the multiplier is to how far away we are from the target number of active proposals. + +### MinInitialDepositThrottler (dynamic MinInitialDeposit) + +Similarly, the `min_initial_deposit_throttler` sub-structure defines the dynamic +`MinInitialDeposit`: + +- `floor_value`: The floor (lowest possible) initial deposit requirement. +- `update_period`: After how long the system should recalculate (time-based + updates). +- `target_proposals`: The target number of proposals in the deposit period. +- `increase_ratio` / `decrease_ratio`: Rate of upward/downward adjustments when + the number of deposit-period proposals deviates from the target. +- `sensitivity_target_distance`: Like above, how sharply the required deposit + reacts to that deviation. + +:::note +Both dynamic thresholds are maintained internally and automatically updated +whenever proposals enter/exit their respective states (deposit or voting) +and with the passage of time. +At any time, one can do: + +```bash +atomoned query gov min-deposit +atomoned query gov min-initial-deposit +``` + +to see the current required deposit thresholds. +::: ## Client @@ -953,6 +1055,55 @@ pagination: total: "0" ``` + +##### min deposit + +The `min-deposit` command allows users to query the +dynamic minimum deposit required for a proposal +to enter voting period. + +```bash +atomoned query gov min-deposit [flags] +``` + +Example: + +```bash +atomoned query gov min-deposit +``` + +Example Output: + +```bash +min_deposit: +- amount: "10000000" + denom: atone +``` + +##### min initial deposit + +The `min-initial-deposit` command allows users to query the +dynamic minimum initial deposit required for a proposal to +be submitted. + +```bash +atomoned query gov min-initial-deposit [flags] +``` + +Example: + +```bash +atomoned query gov min-initial-deposit +``` + +Example Output: + +```bash +min_initial_deposit: +- amount: "10000000" + denom: atone +``` + ##### param The `param` command allows users to query a given parameter for the `gov` module. @@ -2028,13 +2179,13 @@ The `proposals` endpoint allows users to query a given proposal. Using legacy v1beta1: ```bash -/cosmos/gov/v1beta1/proposals/{proposal_id} +/atomone/gov/v1beta1/proposals/{proposal_id} ``` Example: ```bash -curl localhost:1317/cosmos/gov/v1beta1/proposals/1 +curl localhost:1317/atomone/gov/v1beta1/proposals/1 ``` Example Output: @@ -2067,13 +2218,13 @@ Example Output: Using v1: ```bash -/cosmos/gov/v1/proposals/{proposal_id} +/atomone/gov/v1/proposals/{proposal_id} ``` Example: ```bash -curl localhost:1317/cosmos/gov/v1/proposals/1 +curl localhost:1317/atomone/gov/v1/proposals/1 ``` Example Output: @@ -2125,13 +2276,13 @@ The `proposals` endpoint also allows users to query all proposals with optional Using legacy v1beta1: ```bash -/cosmos/gov/v1beta1/proposals +/atomone/gov/v1beta1/proposals ``` Example: ```bash -curl localhost:1317/cosmos/gov/v1beta1/proposals +curl localhost:1317/atomone/gov/v1beta1/proposals ``` Example Output: @@ -2190,13 +2341,13 @@ Example Output: Using v1: ```bash -/cosmos/gov/v1/proposals +/atomone/gov/v1/proposals ``` Example: ```bash -curl localhost:1317/cosmos/gov/v1/proposals +curl localhost:1317/atomone/gov/v1/proposals ``` Example Output: @@ -2289,13 +2440,13 @@ The `votes` endpoint allows users to query a vote for a given proposal. Using legacy v1beta1: ```bash -/cosmos/gov/v1beta1/proposals/{proposal_id}/votes/{voter} +/atomone/gov/v1beta1/proposals/{proposal_id}/votes/{voter} ``` Example: ```bash -curl localhost:1317/cosmos/gov/v1beta1/proposals/1/votes/atone1.. +curl localhost:1317/atomone/gov/v1beta1/proposals/1/votes/atone1.. ``` Example Output: @@ -2319,13 +2470,13 @@ Example Output: Using v1: ```bash -/cosmos/gov/v1/proposals/{proposal_id}/votes/{voter} +/atomone/gov/v1/proposals/{proposal_id}/votes/{voter} ``` Example: ```bash -curl localhost:1317/cosmos/gov/v1/proposals/1/votes/atone1.. +curl localhost:1317/atomone/gov/v1/proposals/1/votes/atone1.. ``` Example Output: @@ -2353,13 +2504,13 @@ The `votes` endpoint allows users to query all votes for a given proposal. Using legacy v1beta1: ```bash -/cosmos/gov/v1beta1/proposals/{proposal_id}/votes +/atomone/gov/v1beta1/proposals/{proposal_id}/votes ``` Example: ```bash -curl localhost:1317/cosmos/gov/v1beta1/proposals/1/votes +curl localhost:1317/atomone/gov/v1beta1/proposals/1/votes ``` Example Output: @@ -2389,13 +2540,13 @@ Example Output: Using v1: ```bash -/cosmos/gov/v1/proposals/{proposal_id}/votes +/atomone/gov/v1/proposals/{proposal_id}/votes ``` Example: ```bash -curl localhost:1317/cosmos/gov/v1/proposals/1/votes +curl localhost:1317/atomone/gov/v1/proposals/1/votes ``` Example Output: @@ -2431,13 +2582,13 @@ The `params` endpoint allows users to query all parameters for the `gov` module. Using legacy v1beta1: ```bash -/cosmos/gov/v1beta1/params/{params_type} +/atomone/gov/v1beta1/params/{params_type} ``` Example: ```bash -curl localhost:1317/cosmos/gov/v1beta1/params/voting +curl localhost:1317/atomone/gov/v1beta1/params/voting ``` Example Output: @@ -2462,13 +2613,13 @@ Example Output: Using v1: ```bash -/cosmos/gov/v1/params/{params_type} +/atomone/gov/v1/params/{params_type} ``` Example: ```bash -curl localhost:1317/cosmos/gov/v1/params/voting +curl localhost:1317/atomone/gov/v1/params/voting ``` Example Output: @@ -2490,6 +2641,66 @@ Example Output: } ``` +#### min deposit + +The `min_deposit` endpoint allows users to query the minimum deposit for a given proposal +to enter the voting period. + +Using v1: + +```bash +/atomone/gov/v1/mindeposit +``` + +Example: + +```bash +curl localhost:1317/atomone/gov/v1/mindeposit +``` + +Example Output: + +```bash +{ + "min_deposit": [ + { + "denom": "atone", + "amount": "10000000" + } + ] +} +``` + +#### min initial deposit + +The `min_initial_deposit` endpoint allows users to query the minimum deposit for +a given proposal to enter the voting period. + +Using v1: + +```bash +/atomone/gov/v1/mininitialdeposit +``` + +Example: + +```bash +curl localhost:1317/atomone/gov/v1/mininitialdeposit +``` + +Example Output: + +```bash +{ + "min_initial_deposit": [ + { + "denom": "atone", + "amount": "10000000" + } + ] +} +``` + #### deposits The `deposits` endpoint allows users to query a deposit for a given proposal from a given depositor. @@ -2497,13 +2708,13 @@ The `deposits` endpoint allows users to query a deposit for a given proposal fro Using legacy v1beta1: ```bash -/cosmos/gov/v1beta1/proposals/{proposal_id}/deposits/{depositor} +/atomone/gov/v1beta1/proposals/{proposal_id}/deposits/{depositor} ``` Example: ```bash -curl localhost:1317/cosmos/gov/v1beta1/proposals/1/deposits/atone1.. +curl localhost:1317/atomone/gov/v1beta1/proposals/1/deposits/atone1.. ``` Example Output: @@ -2526,13 +2737,13 @@ Example Output: Using v1: ```bash -/cosmos/gov/v1/proposals/{proposal_id}/deposits/{depositor} +/atomone/gov/v1/proposals/{proposal_id}/deposits/{depositor} ``` Example: ```bash -curl localhost:1317/cosmos/gov/v1/proposals/1/deposits/atone1.. +curl localhost:1317/atomone/gov/v1/proposals/1/deposits/atone1.. ``` Example Output: @@ -2559,13 +2770,13 @@ The `deposits` endpoint allows users to query all deposits for a given proposal. Using legacy v1beta1: ```bash -/cosmos/gov/v1beta1/proposals/{proposal_id}/deposits +/atomone/gov/v1beta1/proposals/{proposal_id}/deposits ``` Example: ```bash -curl localhost:1317/cosmos/gov/v1beta1/proposals/1/deposits +curl localhost:1317/atomone/gov/v1beta1/proposals/1/deposits ``` Example Output: @@ -2594,13 +2805,13 @@ Example Output: Using v1: ```bash -/cosmos/gov/v1/proposals/{proposal_id}/deposits +/atomone/gov/v1/proposals/{proposal_id}/deposits ``` Example: ```bash -curl localhost:1317/cosmos/gov/v1/proposals/1/deposits +curl localhost:1317/atomone/gov/v1/proposals/1/deposits ``` Example Output: @@ -2633,13 +2844,13 @@ The `tally` endpoint allows users to query the tally of a given proposal. Using legacy v1beta1: ```bash -/cosmos/gov/v1beta1/proposals/{proposal_id}/tally +/atomone/gov/v1beta1/proposals/{proposal_id}/tally ``` Example: ```bash -curl localhost:1317/cosmos/gov/v1beta1/proposals/1/tally +curl localhost:1317/atomone/gov/v1beta1/proposals/1/tally ``` Example Output: @@ -2657,13 +2868,13 @@ Example Output: Using v1: ```bash -/cosmos/gov/v1/proposals/{proposal_id}/tally +/atomone/gov/v1/proposals/{proposal_id}/tally ``` Example: ```bash -curl localhost:1317/cosmos/gov/v1/proposals/1/tally +curl localhost:1317/atomone/gov/v1/proposals/1/tally ``` Example Output: @@ -2681,7 +2892,16 @@ Example Output: ## Metadata -The gov module has two locations for metadata where users can provide further context about the on-chain actions they are taking. By default all metadata fields have a 255 character length field where metadata can be stored in json format, either on-chain or off-chain depending on the amount of data required. Here we provide a recommendation for the json structure and where the data should be stored. There are two important factors in making these recommendations. First, that the gov and group modules are consistent with one another, note the number of proposals made by all groups may be quite large. Second, that client applications such as block explorers and governance interfaces have confidence in the consistency of metadata structure accross chains. +The gov module has two locations for metadata where users can provide further +context about the on-chain actions they are taking. By default all metadata +fields have a 255 character length field where metadata can be stored in json +format, either on-chain or off-chain depending on the amount of data required. +Here we provide a recommendation for the json structure and where the data +should be stored. There are two important factors in making these recommendations. +First, that the gov and group modules are consistent with one another, note the +number of proposals made by all groups may be quite large. Second, that client +applications such as block explorers and governance interfaces have confidence +in the consistency of metadata structure accross chains. ### Proposal @@ -2699,8 +2919,10 @@ Location: off-chain as json object stored on IPFS (mirrors [group proposal](../g ``` :::note -The `authors` field is an array of strings, this is to allow for multiple authors to be listed in the metadata. -In v0.46, the `authors` field is a comma-separated string. Frontends are encouraged to support both formats for backwards compatibility. +The `authors` field is an array of strings, this is to allow for multiple authors +to be listed in the metadata. +In v0.46, the `authors` field is a comma-separated string. Frontends are encouraged +to support both formats for backwards compatibility. ::: ### Vote From b96f037708f1053135773ec81d0ccba153ffceec Mon Sep 17 00:00:00 2001 From: Giuseppe Natale <12249307+giunatale@users.noreply.github.com> Date: Thu, 16 Jan 2025 17:56:02 +0100 Subject: [PATCH 28/29] remove double space --- x/gov/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/gov/README.md b/x/gov/README.md index 101c5689..c89007ea 100644 --- a/x/gov/README.md +++ b/x/gov/README.md @@ -335,7 +335,7 @@ Due to the new dynamic depositfeature, the prior `MinDeposit` parameter is deprecated and replaced by the dynamic mechanism defined via the `MinDepositThrottler` struct. The same applies to `MinInitialDepositRatio`, which is deprecated and replaced by a dynamic `MinInitialDeposit` -controlled via the `MinInitialDepositThrottler` struct. +controlled via the `MinInitialDepositThrottler` struct. #### DepositParams From 454b99bebb5528ee70ecae554a7d289dd409082a Mon Sep 17 00:00:00 2001 From: Giuseppe Natale <12249307+giunatale@users.noreply.github.com> Date: Fri, 17 Jan 2025 11:52:51 +0100 Subject: [PATCH 29/29] Update adr-003 to "implemented" --- .../adr-003-governance-proposal-deposit-auto-throttler.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/architecture/adr-003-governance-proposal-deposit-auto-throttler.md b/docs/architecture/adr-003-governance-proposal-deposit-auto-throttler.md index 31f17de4..e01f1ec6 100755 --- a/docs/architecture/adr-003-governance-proposal-deposit-auto-throttler.md +++ b/docs/architecture/adr-003-governance-proposal-deposit-auto-throttler.md @@ -9,7 +9,7 @@ ## **Status[](https://docs.cosmos.network/main/architecture/adr-template#status)** -DRAFT +Implemented (https://github.com/atomone-hub/atomone/pull/69) ## **Abstract[](https://docs.cosmos.network/main/architecture/adr-template#abstract)**