Skip to content

Commit

Permalink
refactor(x/authz): extend validate genesis (#18042)
Browse files Browse the repository at this point in the history
(cherry picked from commit 26277eb)
  • Loading branch information
tac0turtle authored and mergify[bot] committed Oct 23, 2023
1 parent ee589c8 commit 35542fc
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions x/authz/genesis.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package authz

import (
fmt "fmt"

cdctypes "github.com/cosmos/cosmos-sdk/codec/types"
)

Expand All @@ -13,6 +15,15 @@ func NewGenesisState(entries []GrantAuthorization) *GenesisState {

// ValidateGenesis check the given genesis state has no integrity issues
func ValidateGenesis(data GenesisState) error {
for i, a := range data.Authorization {
if a.Grantee == "" {
return fmt.Errorf("authorization: %d, missing grantee", i)
}
if a.Granter == "" {
return fmt.Errorf("authorization: %d,missing granter", i)
}

}
return nil
}

Expand Down

0 comments on commit 35542fc

Please sign in to comment.