-
Notifications
You must be signed in to change notification settings - Fork 131
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(feetiers): Reject malformed address in query #2653
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -58,7 +58,7 @@ func TestUserFeeTier(t *testing.T) { | |||||||||||||||||||||||||||||
}{ | ||||||||||||||||||||||||||||||
"Success": { | ||||||||||||||||||||||||||||||
req: &types.QueryUserFeeTierRequest{ | ||||||||||||||||||||||||||||||
User: "alice", | ||||||||||||||||||||||||||||||
User: "dydx199tqg4wdlnu4qjlxchpd7seg454937hjrknju4", | ||||||||||||||||||||||||||||||
}, | ||||||||||||||||||||||||||||||
res: &types.QueryUserFeeTierResponse{ | ||||||||||||||||||||||||||||||
Index: 0, | ||||||||||||||||||||||||||||||
|
@@ -78,6 +78,13 @@ func TestUserFeeTier(t *testing.T) { | |||||||||||||||||||||||||||||
res: nil, | ||||||||||||||||||||||||||||||
err: status.Error(codes.InvalidArgument, "invalid request"), | ||||||||||||||||||||||||||||||
}, | ||||||||||||||||||||||||||||||
"Malformed address": { | ||||||||||||||||||||||||||||||
req: &types.QueryUserFeeTierRequest{ | ||||||||||||||||||||||||||||||
User: "alice", | ||||||||||||||||||||||||||||||
}, | ||||||||||||||||||||||||||||||
res: nil, | ||||||||||||||||||||||||||||||
err: status.Error(codes.InvalidArgument, "user address is valid bech32 address"), | ||||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shouldn't the error message be saying the address is invalid? |
||||||||||||||||||||||||||||||
}, | ||||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Update error message to match implementation fix Once the error message is fixed in the implementation, update this test case to match the new message. Apply this fix after updating the implementation: - err: status.Error(codes.InvalidArgument, "user address is valid bech32 address"),
+ err: status.Error(codes.InvalidArgument, "user address is not a valid bech32 address"), 📝 Committable suggestion
Suggested change
|
||||||||||||||||||||||||||||||
} { | ||||||||||||||||||||||||||||||
t.Run(name, func(t *testing.T) { | ||||||||||||||||||||||||||||||
res, err := k.UserFeeTier(ctx, tc.req) | ||||||||||||||||||||||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix grammatical error in error message
The error message has incorrect grammar which could confuse users.
Apply this fix:
📝 Committable suggestion