-
Notifications
You must be signed in to change notification settings - Fork 473
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
Reject invalid attributes #562
Conversation
Codecov Report
@@ Coverage Diff @@
## master #562 +/- ##
==========================================
+ Coverage 59.59% 59.65% +0.06%
==========================================
Files 45 45
Lines 5242 5260 +18
==========================================
+ Hits 3124 3138 +14
- Misses 1890 1892 +2
- Partials 228 230 +2
|
} | ||
value := strings.TrimSpace(l.Value) | ||
if len(value) == 0 { | ||
return nil, sdkerrors.Wrap(types.ErrInvalidEvent, fmt.Sprintf("Empty attribute value. Key: %s", key)) |
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.
Why is this check needed? Can't you have contracts that always set an attribute that is potentially empty (e.g. custom note)
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.
There is no way to search for this if it is empty. The syntax is <type>.<key> = <value>
I guess this might be allowed, I should check on the sdk side.
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.
I added a TODO and asked the sdk team if it is valid.
Shall we make the decision before merge?
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.
Alright. I'm fine either way and do not know what the best way to handle this is.
Closes #560
Return error on invalid events/attributes returned from contracts