-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
refactor: remove class&nft id validation #13836
Conversation
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.
makes sense to me, could we get a changelog entry and update to the spec with this change so applications know they must handle validation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #13836 +/- ##
==========================================
+ Coverage 56.46% 56.68% +0.22%
==========================================
Files 648 642 -6
Lines 56221 55136 -1085
==========================================
- Hits 31747 31256 -491
+ Misses 21909 21350 -559
+ Partials 2565 2530 -35
|
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.
Can we instead update the validation rule to only check if not empty?
This way this avoids duplicating the error messages, and we are sure we validate the same way everywhere.
+1 for the changelog too.
EDIT: Actually, we could as well just set these errors (errors.Wrap(ErrInvalidID, "empty class id")
and errors.Wrap(ErrInvalidID, "empty nft id")
) as variable somewhere and use them.
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.
lgtm! Thank you!
Maybe in addition of the ADR changes, we could mention in the specs (https://github.com/cosmos/cosmos-sdk/blob/main/x/nft/README.md) that the app dev is supposed to handle the validation and in the UPGRADING.md.
I can do that in a follow-up too.
{ | ||
name: "class id does not exist", | ||
args: struct { | ||
ClassID string | ||
ID string | ||
}{ | ||
ClassID: "class", | ||
ID: ExpNFT.Id, | ||
}, | ||
expectErr: true, | ||
errorMsg: "not found nft", | ||
}, |
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.
nit: I think this one can be put back
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.
Just tested locally and it can be put back, but we can do a follow-up PR :)
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.
Merging then, I'll update the docs in a quick follow-up and re-add this test.
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.
Left a small nit, otherwise, LGTM 🚀
(cherry picked from commit 5f4350d)
Description
Closes: #13819
Author Checklist
All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.
I have...
!
to the type prefix if API or client breaking changeCHANGELOG.md
Reviewers Checklist
All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.
I have...
!
in the type prefix if API or client breaking change