Skip to content

Commit 5a4d71b

Browse files
fix: assert that governance module has >= total deposits on startup
People will deposit tokens into gov for, for instance, ICAs, so we really can't expect it to exactly equal the deposits.
1 parent 7cb3727 commit 5a4d71b

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

x/distribution/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
3131

3232
### Improvements
3333

34+
* [#22832](https://github.com/cosmos/cosmos-sdk/pull/22832) Ensure the distribution module has at least as many tokens as outstanding rewards at genesis import
3435
* [#20790](https://github.com/cosmos/cosmos-sdk/pull/20790) `x/distribution` does not depend on `x/protocolpool` anymore, now `x/distribution` only does token transfers and `x/protocolpool` does the rest.
3536

3637
### API Breaking Changes

x/gov/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
3838

3939
### Improvements
4040

41+
* [#22832](https://github.com/cosmos/cosmos-sdk/pull/22832) Ensure the governance module has at least as many tokens as are deposited at genesis import.
4142
* [#20521](https://github.com/cosmos/cosmos-sdk/pull/20521) Legacy proposals can now access the `appmodule.Environment` present in the `context.Context` of the handler. This is useful when migrating to server/v2 and removing the sdk context dependency.
4243
* [#19741](https://github.com/cosmos/cosmos-sdk/pull/19741) Add `ExpeditedQuorum` parameter specifying a minimum quorum for expedited proposals, that can differ from the regular quorum.
4344
* [#19352](https://github.com/cosmos/cosmos-sdk/pull/19352) `TallyResult` include vote options counts. Those counts replicates the now deprecated (but not removed) yes, no, abstain and veto count fields.

x/gov/genesis.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,9 @@ func InitGenesis(ctx context.Context, ak types.AccountKeeper, bk types.BankKeepe
7979
ak.SetModuleAccount(ctx, moduleAcc)
8080
}
8181

82-
// check if total deposits equals balance, if it doesn't return an error
83-
if !balance.Equal(totalDeposits) {
84-
return fmt.Errorf("expected module account was %s but we got %s", balance.String(), totalDeposits.String())
82+
// check if the module account can cover the total deposits
83+
if !balance.IsAllGTE(totalDeposits) {
84+
panic(fmt.Sprintf("expected module to hold at least %s, but it holds %s", totalDeposits, balance))
8585
}
8686
return nil
8787
}

0 commit comments

Comments
 (0)