Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Oct 23, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading