From f110b2893e44aaec31e086a816c384a5bc26f031 Mon Sep 17 00:00:00 2001 From: marbar3778 Date: Mon, 24 Jan 2022 15:30:09 +0100 Subject: [PATCH 1/4] remove burning of deposits in gov --- x/gov/abci.go | 2 +- x/gov/keeper/tally.go | 2 +- x/gov/keeper/tally_test.go | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/x/gov/abci.go b/x/gov/abci.go index 36fea6f2c0e9..b2fef65c1784 100644 --- a/x/gov/abci.go +++ b/x/gov/abci.go @@ -20,7 +20,7 @@ func EndBlocker(ctx sdk.Context, keeper keeper.Keeper) { // delete dead proposals from store and burn 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 v1beta2.Proposal) bool { keeper.DeleteProposal(ctx, proposal.ProposalId) - keeper.DeleteAndBurnDeposits(ctx, proposal.ProposalId) + keeper.RefundAndDeleteDeposits(ctx, proposal.ProposalId) // refund deposit if proposal got removed without getting 100% of the proposal // called when proposal become inactive keeper.AfterProposalFailedMinDeposit(ctx, proposal.ProposalId) diff --git a/x/gov/keeper/tally.go b/x/gov/keeper/tally.go index 2cabec0cf5bc..470af87088ba 100644 --- a/x/gov/keeper/tally.go +++ b/x/gov/keeper/tally.go @@ -105,7 +105,7 @@ func (keeper Keeper) Tally(ctx sdk.Context, proposal v1beta2.Proposal) (passes b percentVoting := totalVotingPower.Quo(keeper.sk.TotalBondedTokens(ctx).ToDec()) quorum, _ := sdk.NewDecFromStr(tallyParams.Quorum) if percentVoting.LT(quorum) { - return false, true, tallyResults + return false, false, tallyResults } // If no one votes (everyone abstains), proposal fails diff --git a/x/gov/keeper/tally_test.go b/x/gov/keeper/tally_test.go index b98dd7e1376c..555a8be9854b 100644 --- a/x/gov/keeper/tally_test.go +++ b/x/gov/keeper/tally_test.go @@ -31,7 +31,7 @@ func TestTallyNoOneVotes(t *testing.T) { passes, burnDeposits, tallyResults := app.GovKeeper.Tally(ctx, proposal) require.False(t, passes) - require.True(t, burnDeposits) + require.False(t, burnDeposits) require.True(t, tallyResults.Equals(v1beta2.EmptyTallyResult())) } From ef6170e5aaad3b28667d64e644a68993a5bff4b4 Mon Sep 17 00:00:00 2001 From: marbar3778 Date: Wed, 26 Jan 2022 19:01:45 +0100 Subject: [PATCH 2/4] fix tests --- x/gov/keeper/tally_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/gov/keeper/tally_test.go b/x/gov/keeper/tally_test.go index 1171fc59d901..a7e3176e18ea 100644 --- a/x/gov/keeper/tally_test.go +++ b/x/gov/keeper/tally_test.go @@ -57,7 +57,7 @@ func TestTallyNoQuorum(t *testing.T) { require.True(t, ok) passes, burnDeposits, _ := app.GovKeeper.Tally(ctx, proposal) require.False(t, passes) - require.True(t, burnDeposits) + require.False(t, burnDeposits) } func TestTallyOnlyValidatorsAllYes(t *testing.T) { From e8614f14c5aec23e84127ff51ca04898aafb02c2 Mon Sep 17 00:00:00 2001 From: marbar3778 Date: Wed, 26 Jan 2022 19:05:46 +0100 Subject: [PATCH 3/4] changelog entry --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9e17643146d1..c36c6b714b46 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -192,6 +192,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ * [#10763](https://github.com/cosmos/cosmos-sdk/pull/10763) modify the fields in `TallyParams` to use `string` instead of `bytes` * [#10770](https://github.com/cosmos/cosmos-sdk/pull/10770) revert tx when block gas limit exceeded * [\#10868](https://github.com/cosmos/cosmos-sdk/pull/10868) Bump gov to v1beta2. Both v1beta1 and v1beta2 queries and Msgs are accepted. +* [\#11011](https://github.com/cosmos/cosmos-sdk/pull/11011) Remove burning of deposits when qourum is not reached on a governance proposal and when the deposit is not fully met. ### Deprecated From 442356556cc6f901f175d04330daba69b6c65ba0 Mon Sep 17 00:00:00 2001 From: marbar3778 Date: Wed, 26 Jan 2022 19:06:24 +0100 Subject: [PATCH 4/4] fix comment --- x/gov/abci.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/gov/abci.go b/x/gov/abci.go index b2fef65c1784..5876358ef493 100644 --- a/x/gov/abci.go +++ b/x/gov/abci.go @@ -17,7 +17,7 @@ func EndBlocker(ctx sdk.Context, keeper keeper.Keeper) { logger := keeper.Logger(ctx) - // delete dead proposals from store and burn theirs deposits. A proposal is dead when it's inactive and didn't get enough deposit on time to get into voting phase. + // 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 v1beta2.Proposal) bool { keeper.DeleteProposal(ctx, proposal.ProposalId) keeper.RefundAndDeleteDeposits(ctx, proposal.ProposalId) // refund deposit if proposal got removed without getting 100% of the proposal