Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: clean-up of #15151 #15219

Merged
merged 5 commits into from
Mar 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions api/cosmos/gov/v1/gov.pulsar.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 2 additions & 6 deletions proto/cosmos/gov/v1/gov.proto
Original file line number Diff line number Diff line change
Expand Up @@ -245,15 +245,11 @@ message Params {
repeated cosmos.base.v1beta1.Coin expedited_min_deposit = 12 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true];

// burn deposits if a proposal does not meet quorum
//
// Since: cosmos-sdk 0.47
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is said on the message itself.

bool burn_vote_quorum = 13;

// burn deposits if the proposal does not enter voting period
//
// Since: cosmos-sdk 0.47
bool burn_proposal_deposit_prevote = 14;

// burn deposits if quorum with vote type no_veto is met
//
// Since: cosmos-sdk 0.47
bool burn_vote_veto = 15;
}
5 changes: 3 additions & 2 deletions x/gov/abci.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ func EndBlocker(ctx sdk.Context, keeper *keeper.Keeper) {
keeper.IterateInactiveProposalsQueue(ctx, ctx.BlockHeader().Time, func(proposal v1.Proposal) bool {
keeper.DeleteProposal(ctx, proposal.Id)

if !keeper.GetParams(ctx).BurnProposalDepositPrevote {
params := keeper.GetParams(ctx)
if !params.BurnProposalDepositPrevote {
keeper.RefundAndDeleteDeposits(ctx, proposal.Id) // refund deposit if proposal got removed without getting 100% of the proposal
} else {
keeper.DeleteAndBurnDeposits(ctx, proposal.Id) // burn the deposit if proposal got removed without getting 100% of the proposal
Expand All @@ -43,7 +44,7 @@ func EndBlocker(ctx sdk.Context, keeper *keeper.Keeper) {
"proposal", proposal.Id,
"expedited", proposal.Expedited,
"title", proposal.Title,
"min_deposit", sdk.NewCoins(proposal.GetMinDepositFromParams(keeper.GetParams(ctx))...).String(),
"min_deposit", sdk.NewCoins(proposal.GetMinDepositFromParams(params)...).String(),
"total_deposit", sdk.NewCoins(proposal.TotalDeposit...).String(),
)

Expand Down
4 changes: 2 additions & 2 deletions x/gov/keeper/tally.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ func (keeper Keeper) Tally(ctx sdk.Context, proposal v1.Proposal) (passes bool,
percentVoting := totalVotingPower.Quo(sdk.NewDecFromInt(keeper.sk.TotalBondedTokens(ctx)))
quorum, _ := sdk.NewDecFromStr(params.Quorum)
if percentVoting.LT(quorum) {
return false, keeper.GetParams(ctx).BurnVoteQuorum, tallyResults
return false, params.BurnVoteQuorum, tallyResults
}

// If no one votes (everyone abstains), proposal fails
Expand All @@ -113,7 +113,7 @@ func (keeper Keeper) Tally(ctx sdk.Context, proposal v1.Proposal) (passes bool,
// If more than 1/3 of voters veto, proposal fails
vetoThreshold, _ := sdk.NewDecFromStr(params.VetoThreshold)
if results[v1.OptionNoWithVeto].Quo(totalVotingPower).GT(vetoThreshold) {
return false, keeper.GetParams(ctx).BurnVoteVeto, tallyResults
return false, params.BurnVoteVeto, tallyResults
}

// If more than 1/2 of non-abstaining voters vote Yes, proposal passes
Expand Down
6 changes: 3 additions & 3 deletions x/gov/migrations/v4/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ func migrateParams(ctx sdk.Context, storeKey storetypes.StoreKey, legacySubspace
tp.Threshold,
defaultParams.ExpeditedThreshold,
tp.VetoThreshold,
sdk.ZeroDec().String(),
sdk.ZeroDec().String(),
"",
defaultParams.MinInitialDepositRatio,
defaultParams.ProposalCancelRatio,
defaultParams.ProposalCancelDest,
defaultParams.BurnProposalDepositPrevote,
defaultParams.BurnVoteQuorum,
defaultParams.BurnVoteVeto,
Expand Down
5 changes: 2 additions & 3 deletions x/gov/migrations/v5/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,8 @@ func MigrateStore(ctx sdk.Context, storeKey storetypes.StoreKey, cdc codec.Binar
params.ExpeditedMinDeposit = defaultParams.ExpeditedMinDeposit
params.ExpeditedVotingPeriod = defaultParams.ExpeditedVotingPeriod
params.ExpeditedThreshold = defaultParams.ExpeditedThreshold
params.BurnProposalDepositPrevote = defaultParams.BurnProposalDepositPrevote
tac0turtle marked this conversation as resolved.
Show resolved Hide resolved
params.BurnVoteQuorum = defaultParams.BurnVoteQuorum
params.BurnVoteVeto = defaultParams.BurnVoteVeto
params.ProposalCancelRatio = defaultParams.ProposalCancelRatio
params.ProposalCancelDest = defaultParams.ProposalCancelDest

bz, err := cdc.Marshal(&params)
if err != nil {
Expand Down
6 changes: 0 additions & 6 deletions x/gov/types/v1/gov.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.