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 #18042

Merged
merged 4 commits into from
Oct 11, 2023
Merged
Changes from 3 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 (
"errors"

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 _, a := range data.Authorization {
if a.Grantee == "" {
return errors.New("missing grantee")
tac0turtle marked this conversation as resolved.
Show resolved Hide resolved
}
if a.Granter == "" {
return errors.New("missing granter")
}

}
return nil
}

Expand Down
Loading