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

fix(x/authz): non utf-8 characters in logs #19923

3 changes: 2 additions & 1 deletion x/authz/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,8 @@ func (k Keeper) DeleteGrant(ctx context.Context, grantee, granter sdk.AccAddress
skey := grantStoreKey(grantee, granter, msgType)
grant, found := k.getGrant(ctx, skey)
if !found {
return errorsmod.Wrapf(authz.ErrNoAuthorizationFound, "failed to delete grant with key %s", string(skey))
return errorsmod.Wrapf(authz.ErrNoAuthorizationFound,
sontrinh16 marked this conversation as resolved.
Show resolved Hide resolved
"failed to delete grant with key %s given granter: %s, grantee: %s & msgType: %s ", granter.String(), grantee.String(), msgType)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider using fmt.Errorf instead of errorsmod.Wrapf for consistency with the rest of the Cosmos SDK codebase and to improve readability.

- return errorsmod.Wrapf(authz.ErrNoAuthorizationFound,
+ return fmt.Errorf("failed to delete grant with key %s given granter: %s, grantee: %s & msgType: %s: %w", granter.String(), grantee.String(), msgType, authz.ErrNoAuthorizationFound)

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
return errorsmod.Wrapf(authz.ErrNoAuthorizationFound,
"failed to delete grant with key %s given granter: %s, grantee: %s & msgType: %s ", granter.String(), grantee.String(), msgType)
return fmt.Errorf("failed to delete grant with key %s given granter: %s, grantee: %s & msgType: %s: %w", granter.String(), grantee.String(), msgType, authz.ErrNoAuthorizationFound)

}

if grant.Expiration != nil {
Expand Down
Loading