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

NFT issuer does not need whitelisting #414

Merged
merged 15 commits into from
Mar 8, 2023

Conversation

wojtek-coreum
Copy link
Collaborator

@wojtek-coreum wojtek-coreum commented Feb 28, 2023

This change is Reviewable

miladz68
miladz68 previously approved these changes Feb 28, 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 r1, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @dzmitryhil, @silverspase, and @ysv)

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 1 of 1 files at r2, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @dzmitryhil, @silverspase, and @ysv)

miladz68
miladz68 previously approved these changes Mar 1, 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 1 of 1 files at r2, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @dzmitryhil, @silverspase, 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 1 of 2 files at r1, 1 of 1 files at r2, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @dzmitryhil, @silverspase, and @wojtek-coreum)


x/asset/nft/keeper/keeper.go line 469 at r2 (raw file):

	}

	if classDefinition.Issuer == account.String() {

IMO this check should be moved to CheckFeatureAllowed method
I think it is implemented in the same way in FT

Copy link
Collaborator Author

@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.

Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @dzmitryhil, @silverspase, and @ysv)


x/asset/nft/keeper/keeper.go line 469 at r2 (raw file):

Previously, ysv (Yaroslav Savchuk) wrote…

IMO this check should be moved to CheckFeatureAllowed method
I think it is implemented in the same way in FT

Nope, in FT it done in SetWhitelistedBalance:

	if def.IsIssuer(addr) {
		return sdkerrors.Wrap(sdkerrors.ErrUnauthorized, "issuer's balance can't be whitelisted")
	}

I followed that convention in NFT

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.

Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @dzmitryhil and @silverspase)

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.

Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @dzmitryhil, @silverspase, and @wojtek-coreum)


x/asset/nft/keeper/keeper.go line 469 at r2 (raw file):

Previously, wojtek-coreum (Wojtek) wrote…

Nope, in FT it done in SetWhitelistedBalance:

	if def.IsIssuer(addr) {
		return sdkerrors.Wrap(sdkerrors.ErrUnauthorized, "issuer's balance can't be whitelisted")
	}

I followed that convention in NFT

Then IMO it is logical to move this logic to CheckFeature allowed in both FT & NFT (freezing & whitelisting) to have centralised place controlling permissions of these features

Copy link
Contributor

@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, 1 unresolved discussion (waiting on @silverspase and @ysv)


x/asset/nft/keeper/keeper.go line 469 at r2 (raw file):

Previously, ysv (Yaroslav Savchuk) wrote…

Then IMO it is logical to move this logic to CheckFeature allowed in both FT & NFT (freezing & whitelisting) to have centralised place controlling permissions of these features

Agree, but we have similar check in the Is Feature Allowed so probably that func would be better.

Copy link
Collaborator Author

@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.

Reviewable status: 0 of 3 files reviewed, 1 unresolved discussion (waiting on @miladz68, @silverspase, and @ysv)


x/asset/nft/keeper/keeper.go line 469 at r2 (raw file):

Previously, dzmitryhil (Dzmitry Hil) wrote…

Agree, but we have similar check in the Is Feature Allowed so probably that func would be better.

This is not possible. CheckFeatureAllowed is called by all the features and it acts based on issuer/sender account only. Here the decision is made based on the account address. Passing this address to that function doesn't make sense because it is specific to whitelisting only.

Copy link
Contributor

@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.

Reviewed 1 of 2 files at r1, 1 of 1 files at r2.
Reviewable status: 0 of 3 files reviewed, 1 unresolved discussion (waiting on @miladz68, @silverspase, 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, 1 of 1 files at r4, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @silverspase and @wojtek-coreum)


x/asset/nft/keeper/keeper.go line 469 at r2 (raw file):

Previously, wojtek-coreum (Wojtek) wrote…

This is not possible. CheckFeatureAllowed is called by all the features and it acts based on issuer/sender account only. Here the decision is made based on the account address. Passing this address to that function doesn't make sense because it is specific to whitelisting only.

I see what you mean
Decission in usually based on sender but here it should be based on destination

ok resolving it


x/asset/nft/types/token.go line 120 at r4 (raw file):

// CheckFeatureAllowed returns error if feature isn't allowed for the address.
func (nftd ClassDefinition) CheckFeatureAllowed(addr sdk.AccAddress, feature ClassFeature) error {
	switch {

I personally prefer if version

Copy link
Collaborator Author

@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.

Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @silverspase and @ysv)


x/asset/nft/types/token.go line 120 at r4 (raw file):

Previously, ysv (Yaroslav Savchuk) wrote…

I personally prefer if version

Done.

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 1 of 1 files at r5, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @silverspase)

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, 1 of 1 files at r5, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @silverspase)

@wojtek-coreum wojtek-coreum merged commit 9ed8369 into master Mar 8, 2023
@wojtek-coreum wojtek-coreum deleted the wojtek/nft-issuer-whitelisting branch March 8, 2023 15:40
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.

4 participants