Skip to content

Commit

Permalink
refactor(x/authz): extend validate genesis (#18042)
Browse files Browse the repository at this point in the history
  • Loading branch information
tac0turtle authored Oct 11, 2023
1 parent f28a93a commit 26277eb
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 26277eb

Please sign in to comment.