From 0c54f29bbd36ab2cf0eb52c34d5fb6b34b1dfb83 Mon Sep 17 00:00:00 2001 From: Marko Baricevic Date: Fri, 26 Feb 2021 15:40:12 +0100 Subject: [PATCH 1/3] allow zero accounts --- x/bank/types/balance.go | 5 ----- 1 file changed, 5 deletions(-) diff --git a/x/bank/types/balance.go b/x/bank/types/balance.go index 49330bc06af1..6150679023b8 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 From 5c89c2396f7c3c9ede47fdaa310957d61f59a26b Mon Sep 17 00:00:00 2001 From: Marko Baricevic Date: Fri, 26 Feb 2021 15:59:34 +0100 Subject: [PATCH 2/3] fix test --- x/bank/types/genesis_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/x/bank/types/genesis_test.go b/x/bank/types/genesis_test.go index a177ddcdab5c..fa1c836c9cbe 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", From c22751659bdecc194adda3f1c09cd48a23704fa1 Mon Sep 17 00:00:00 2001 From: Marko Baricevic Date: Fri, 26 Feb 2021 16:30:45 +0100 Subject: [PATCH 3/3] fix test --- x/bank/types/balance_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/bank/types/balance_test.go b/x/bank/types/balance_test.go index 6282b2478b19..3987f5189ef0 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",