Skip to content

Commit

Permalink
refactor(x/authz): extend validate genesis (backport #18042) (#18207)
Browse files Browse the repository at this point in the history
Co-authored-by: Marko <[email protected]>
  • Loading branch information
mergify[bot] and tac0turtle authored Oct 23, 2023
1 parent 026631c commit 5604342
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 5604342

Please sign in to comment.