Skip to content

Commit

Permalink
move sdk denom validation to top of validateibcdenom (#7917)
Browse files Browse the repository at this point in the history
  • Loading branch information
colin-axner authored Nov 12, 2020
1 parent 96f239d commit 956e1cf
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion x/ibc/applications/transfer/types/trace.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,10 @@ func ValidatePrefixedDenom(denom string) error {
// - A valid base denomination (eg: 'uatom')
// - A valid fungible token representation (i.e 'ibc/{hash}') per ADR 001 https://github.com/cosmos/cosmos-sdk/blob/master/docs/architecture/adr-001-coin-source-tracing.md
func ValidateIBCDenom(denom string) error {
if err := sdk.ValidateDenom(denom); err != nil {
return err
}

denomSplit := strings.SplitN(denom, "/", 2)

switch {
Expand All @@ -173,7 +177,7 @@ func ValidateIBCDenom(denom string) error {
return sdkerrors.Wrapf(ErrInvalidDenomForTransfer, "denomination should be prefixed with the format 'ibc/{hash(trace + \"/\" + %s)}'", denom)

case denomSplit[0] == denom && strings.TrimSpace(denom) != "":
return sdk.ValidateDenom(denom)
return nil
}

if _, err := ParseHexHash(denomSplit[1]); err != nil {
Expand Down

0 comments on commit 956e1cf

Please sign in to comment.