From a786830bb481782cf56f8ecca82fe1e8c18731af Mon Sep 17 00:00:00 2001 From: Marko Date: Fri, 26 Feb 2021 15:41:48 +0000 Subject: [PATCH] auth: allow 0 coin accounts in genesis (#8714) * allow zero accounts * fix test * fix test --- x/bank/types/balance.go | 5 ----- x/bank/types/balance_test.go | 2 +- x/bank/types/genesis_test.go | 4 ++-- 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/x/bank/types/balance.go b/x/bank/types/balance.go index 49330bc06a..6150679023 100644 --- a/x/bank/types/balance.go +++ b/x/bank/types/balance.go @@ -34,11 +34,6 @@ func (b Balance) Validate() error { if err != nil { return err } - - if len(b.Coins) == 0 { - return fmt.Errorf("empty or nil coins for address %s", b.Address) - } - seenDenoms := make(map[string]bool) // NOTE: we perform a custom validation since the coins.Validate function diff --git a/x/bank/types/balance_test.go b/x/bank/types/balance_test.go index 6282b2478b..3987f5189e 100644 --- a/x/bank/types/balance_test.go +++ b/x/bank/types/balance_test.go @@ -29,7 +29,7 @@ func TestBalanceValidate(t *testing.T) { bank.Balance{ Address: "cosmos1yq8lgssgxlx9smjhes6ryjasmqmd3ts2559g0t", }, - true, + false, }, { "dup coins", diff --git a/x/bank/types/genesis_test.go b/x/bank/types/genesis_test.go index a177ddcdab..fa1c836c9c 100644 --- a/x/bank/types/genesis_test.go +++ b/x/bank/types/genesis_test.go @@ -72,7 +72,7 @@ func TestGenesisStateValidate(t *testing.T) { true, }, { - "invalid balance", + "0 balance", GenesisState{ Balances: []Balance{ { @@ -80,7 +80,7 @@ func TestGenesisStateValidate(t *testing.T) { }, }, }, - true, + false, }, { "dup Metadata",