Skip to content
New issue

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

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

Already on GitHub? # to your account

use collections contains when checking client type is in allow list #4196

Merged
merged 2 commits into from
Jul 28, 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
8 changes: 2 additions & 6 deletions modules/core/02-client/types/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"fmt"
"strings"

"github.com/cosmos/ibc-go/v7/internal/collections"
"github.com/cosmos/ibc-go/v7/modules/core/exported"
)

Expand All @@ -29,12 +30,7 @@ func (p Params) Validate() error {

// IsAllowedClient checks if the given client type is registered on the allowlist.
func (p Params) IsAllowedClient(clientType string) bool {
for _, allowedClient := range p.AllowedClients {
if allowedClient == clientType {
return true
}
}
return false
return collections.Contains(clientType, p.AllowedClients)
}

// validateClients checks that the given clients are not blank.
Expand Down