Skip to content

Commit

Permalink
fix: assert that governance module has >= total deposits on startup
Browse files Browse the repository at this point in the history
People will deposit tokens into gov for, for instance, ICAs, so we
really can't expect it to exactly equal the deposits.
  • Loading branch information
fastfadingviolets committed Dec 11, 2024
1 parent 7cb3727 commit ca2ff56
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions x/gov/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,9 @@ func InitGenesis(ctx context.Context, ak types.AccountKeeper, bk types.BankKeepe
ak.SetModuleAccount(ctx, moduleAcc)
}

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

0 comments on commit ca2ff56

Please sign in to comment.