refactor(x/authz): extend validate genesis (#18042)

This commit is contained in:
Marko 2023-10-11 16:01:35 +02:00 committed by GitHub
parent f28a93a063
commit 26277eb9e6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,6 +1,8 @@
package authz
import (
fmt "fmt"
cdctypes "github.com/cosmos/cosmos-sdk/codec/types"
)
@ -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
}