From 26277eb9e689382d19f6441e38af71a2a9e88b22 Mon Sep 17 00:00:00 2001 From: Marko Date: Wed, 11 Oct 2023 16:01:35 +0200 Subject: [PATCH] refactor(x/authz): extend validate genesis (#18042) --- x/authz/genesis.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/x/authz/genesis.go b/x/authz/genesis.go index d14bbbb18a..169684e073 100644 --- a/x/authz/genesis.go +++ b/x/authz/genesis.go @@ -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 }