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

Add feature uniqueness check on the FT and NFT asset issuance. #481

Merged
merged 4 commits into from
May 3, 2023

Conversation

dzmitryhil
Copy link
Contributor

@dzmitryhil dzmitryhil commented May 1, 2023

This change is Reviewable

Copy link
Collaborator

@wojtek-coreum wojtek-coreum left a comment

Choose a reason for hiding this comment

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

Reviewed 5 of 5 files at r1, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @dzmitryhil, @miladz68, @silverspase, and @ysv)


x/asset/ft/types/msgs.go line 58 at r1 (raw file):

	featuresSet := make(map[Feature]struct{})
	for _, feature := range msg.Features {
		if _, ok := featuresSet[feature]; ok {

ok -> exists, because it is not "ok" if value exists


x/asset/nft/types/msgs.go line 63 at r1 (raw file):

	featuresSet := make(map[ClassFeature]struct{})
	for _, feature := range msg.Features {
		if _, ok := featuresSet[feature]; ok {

ok -> exists

Copy link
Contributor Author

@dzmitryhil dzmitryhil left a comment

Choose a reason for hiding this comment

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

Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @miladz68, @silverspase, @wojtek-coreum, and @ysv)


x/asset/ft/types/msgs.go line 58 at r1 (raw file):

Previously, wojtek-coreum (Wojtek) wrote…

ok -> exists, because it is not "ok" if value exists

Didn't get your comment.

Copy link
Contributor

@miladz68 miladz68 left a comment

Choose a reason for hiding this comment

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

Reviewed 5 of 5 files at r1, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @dzmitryhil, @silverspase, @wojtek-coreum, and @ysv)


x/asset/ft/types/msgs.go line 58 at r1 (raw file):

Previously, dzmitryhil (Dzmitry Hil) wrote…

Didn't get your comment.

I think wojtek means that exists is a better name than ok, and I agree


x/asset/nft/types/msgs.go line 63 at r1 (raw file):

Previously, wojtek-coreum (Wojtek) wrote…

ok -> exists

agreed

miladz68
miladz68 previously approved these changes May 2, 2023
Copy link
Contributor

@miladz68 miladz68 left a comment

Choose a reason for hiding this comment

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

Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @dzmitryhil, @silverspase, @wojtek-coreum, and @ysv)

Copy link
Contributor Author

@dzmitryhil dzmitryhil left a comment

Choose a reason for hiding this comment

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

Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @miladz68, @silverspase, @wojtek-coreum, and @ysv)


x/asset/ft/types/msgs.go line 58 at r1 (raw file):

Previously, miladz68 (milad) wrote…

I think wojtek means that exists is a better name than ok, and I agree

Ok, updated.

@ysv ysv requested review from miladz68 and wojtek-coreum May 2, 2023 11:16
Copy link
Contributor

@ysv ysv left a comment

Choose a reason for hiding this comment

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

Reviewed 3 of 5 files at r1, 2 of 2 files at r2, all commit messages.
Reviewable status: all files reviewed, 4 unresolved discussions (waiting on @dzmitryhil, @miladz68, @silverspase, and @wojtek-coreum)


x/asset/ft/types/msgs.go line 59 at r2 (raw file):

	for _, feature := range msg.Features {
		if _, exists := featuresSet[feature]; exists {
			return sdkerrors.Wrapf(ErrInvalidInput, "duplicated features in the features list")

I propose to use lo.FindDuplicates instead of duplicating this logic in FT & NFT


x/asset/ft/types/msgs.go line 59 at r2 (raw file):

	for _, feature := range msg.Features {
		if _, exists := featuresSet[feature]; exists {
			return sdkerrors.Wrapf(ErrInvalidInput, "duplicated features in the features list")

I think it would be beneficial to include features which are duplicated in this error ?

miladz68
miladz68 previously approved these changes May 2, 2023
Copy link
Contributor

@miladz68 miladz68 left a comment

Choose a reason for hiding this comment

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

Reviewed 2 of 2 files at r2, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @dzmitryhil, @silverspase, and @wojtek-coreum)

Copy link
Contributor Author

@dzmitryhil dzmitryhil left a comment

Choose a reason for hiding this comment

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

Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @silverspase, @wojtek-coreum, and @ysv)


x/asset/ft/types/msgs.go line 59 at r2 (raw file):

Previously, ysv (Yaroslav Savchuk) wrote…

I propose to use lo.FindDuplicates instead of duplicating this logic in FT & NFT

Done.

Code quote:

exists := featuresSet[feature]; exis

x/asset/ft/types/msgs.go line 59 at r2 (raw file):

Previously, ysv (Yaroslav Savchuk) wrote…

I think it would be beneficial to include features which are duplicated in this error ?

Done.

Copy link
Contributor

@miladz68 miladz68 left a comment

Choose a reason for hiding this comment

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

Reviewed 2 of 2 files at r3, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @silverspase, @wojtek-coreum, and @ysv)

Copy link
Contributor

@ysv ysv left a comment

Choose a reason for hiding this comment

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

Reviewed 2 of 2 files at r3, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @silverspase and @wojtek-coreum)

Copy link
Contributor

@vertex451 vertex451 left a comment

Choose a reason for hiding this comment

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

Reviewed 3 of 5 files at r1, 2 of 2 files at r3, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @wojtek-coreum)

@dzmitryhil dzmitryhil merged commit 5558802 into master May 3, 2023
@dzmitryhil dzmitryhil deleted the dzmitryhil/uniq-features-list-on-issue branch May 3, 2023 10:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants