Skip to content

Commit

Permalink
auth: allow 0 coin accounts in genesis (bp #8714) (#8716)
Browse files Browse the repository at this point in the history
* auth: allow 0 coin accounts in genesis (#8714)

* allow zero accounts

* fix test

* fix test

(cherry picked from commit a786830)

Co-authored-by: Marko <marbar3778@yahoo.com>
  • Loading branch information
mergify[bot] and tac0turtle committed Feb 26, 2021
1 parent ce82077 commit 16fbb50
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 8 deletions.
5 changes: 0 additions & 5 deletions x/bank/types/balance.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion x/bank/types/balance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func TestBalanceValidate(t *testing.T) {
bank.Balance{
Address: "cosmos1yq8lgssgxlx9smjhes6ryjasmqmd3ts2559g0t",
},
true,
false,
},
{
"dup coins",
Expand Down
4 changes: 2 additions & 2 deletions x/bank/types/genesis_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,15 @@ func TestGenesisStateValidate(t *testing.T) {
true,
},
{
"invalid balance",
"0 balance",
types.GenesisState{
Balances: []types.Balance{
{
Address: "cosmos1yq8lgssgxlx9smjhes6ryjasmqmd3ts2559g0t",
},
},
},
true,
false,
},
{
"dup Metadata",
Expand Down

0 comments on commit 16fbb50

Please sign in to comment.