-
Notifications
You must be signed in to change notification settings - Fork 27
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
Implemented the whitelisting for the entire class #672
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.
Reviewed 25 of 25 files at r1, 6 of 6 files at r2, all commit messages.
Reviewable status: all files reviewed, 5 unresolved discussions (waiting on @dzmitryhil, @miladz68, and @wojtek-coreum)
docs/api.md
line 73 at r1 (raw file):
- [coreum/asset/nft/v1/event.proto](#coreum/asset/nft/v1/event.proto) - [EventAddedToClassWhitelist](#coreum.asset.nft.v1.EventAddedToClassWhitelist)
I had a few comments about renaming but decided to group all them here
It depends on how we word it either: ClassWhitelist or ClassAdded/removedFromWhitelist everywhere.
Maybe lets discuss one more time
ideas for renaming:
EventAddedToClassWhitelist -> EventNFTClassAddedToWhitelist or EventClassAddedToWhitelist ?
MsgAddToClassWhitelist -> MsgAddClassToWhitelist
?
docs/api.md
line 83 at r1 (raw file):
- [coreum/asset/nft/v1/genesis.proto](#coreum/asset/nft/v1/genesis.proto) - [BurntNFT](#coreum.asset.nft.v1.BurntNFT) - [ClassWhitelistedAccounts](#coreum.asset.nft.v1.ClassWhitelistedAccounts)
what about:
WhitelistedNFTClassAccounts
to follow existing even name logic: (WhitelistedNFTAccounts)
integration-tests/modules/assetnft_test.go
line 1500 at r1 (raw file):
// TestAssetNFTClassWhitelist tests nft class whitelisting. func TestAssetNFTClassWhitelist(t *testing.T) {
good test cases
I would also add a few where you try both class & single NFT whitelisting and check how they interact together (here or inside a separate func)
e.g:
1 add both class & nft whitelist -> OK
2 remove nft whitelist (keep class) -> OK
3 remove class whitelist (keep nft) -> OK for this NFT not ok for other
IDK if it makes sense
integration-tests/modules/assetnft_test.go
line 1736 at r1 (raw file):
// assert the unwhitelisting event unWhitelistedEvents, err := event.FindTypedEvents[*assetnfttypes.EventRemovedFromClassWhitelist](res.Events)
nit: unwhitelisted is a single word
x/asset/nft/keeper/keeper.go
line 891 at r1 (raw file):
} func (k Keeper) addToWhitelistOrRemoveFromWhitelistClass(ctx sdk.Context, classID string, sender, account sdk.AccAddress, setWhitelisted bool) error {
addOrRemoveClassFromWhitelist addOrRemoveFromClassWhitelist ?
x/asset/nft/types/msgs.go
line 29 at r1 (raw file):
) type msgAndLegacyMsg interface {
nice 👍
could also be sdkAndLegacyMsg
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.
Reviewable status: all files reviewed, 5 unresolved discussions (waiting on @dzmitryhil, @wojtek-coreum, and @ysv)
docs/api.md
line 73 at r1 (raw file):
Previously, ysv (Yaroslav Savchuk) wrote…
I had a few comments about renaming but decided to group all them here
It depends on how we word it either: ClassWhitelist or ClassAdded/removedFromWhitelist everywhere.
Maybe lets discuss one more timeideas for renaming:
EventAddedToClassWhitelist -> EventNFTClassAddedToWhitelist or EventClassAddedToWhitelist ?
MsgAddToClassWhitelist ->MsgAddClassToWhitelist
?
well my thinking is that we have 2 concepts, whitelist
and classWhitelist
. Otherwise we will add the class
word at the begining and sometime at the end, which will be confusing.
docs/api.md
line 83 at r1 (raw file):
Previously, ysv (Yaroslav Savchuk) wrote…
what about:
WhitelistedNFTClassAccounts
to follow existing even name logic: (WhitelistedNFTAccounts)
let's discuss
integration-tests/modules/assetnft_test.go
line 1500 at r1 (raw file):
Previously, ysv (Yaroslav Savchuk) wrote…
good test cases
I would also add a few where you try both class & single NFT whitelisting and check how they interact together (here or inside a separate func)e.g:
1 add both class & nft whitelist -> OK
2 remove nft whitelist (keep class) -> OK
3 remove class whitelist (keep nft) -> OK for this NFT not ok for otherIDK if it makes sense
Added test to keeper_test.go
integration-tests/modules/assetnft_test.go
line 1736 at r1 (raw file):
Previously, ysv (Yaroslav Savchuk) wrote…
nit: unwhitelisted is a single word
Fixed everywhere
x/asset/nft/keeper/keeper.go
line 891 at r1 (raw file):
Previously, ysv (Yaroslav Savchuk) wrote…
addOrRemoveClassFromWhitelist addOrRemoveFromClassWhitelist ?
let's disccuss in daily
x/asset/nft/types/msgs.go
line 29 at r1 (raw file):
Previously, ysv (Yaroslav Savchuk) wrote…
nice 👍
could also be
sdkAndLegacyMsg
both Msg and LegacyMsg are part of the sdk, so it would be sdkMsgAndSdkLegacyMsg
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.
Reviewable status: 26 of 28 files reviewed, 5 unresolved discussions (waiting on @dzmitryhil, @wojtek-coreum, and @ysv)
docs/api.md
line 73 at r1 (raw file):
Previously, miladz68 (milad) wrote…
well my thinking is that we have 2 concepts,
whitelist
andclassWhitelist
. Otherwise we will add theclass
word at the begining and sometime at the end, which will be confusing.
discussed and decided to keep as is.
x/asset/nft/keeper/keeper.go
line 891 at r1 (raw file):
Previously, miladz68 (milad) wrote…
let's disccuss in daily
decided on addOrRemoveFromClassWhitelist
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.
Reviewable status: 26 of 28 files reviewed, 9 unresolved discussions (waiting on @miladz68, @wojtek-coreum, and @ysv)
proto/coreum/asset/nft/v1/genesis.proto
line 34 at r3 (raw file):
} message ClassWhitelistedAccounts {
You use two name for the same - ClassWhitelistedAccounts
and WhitelistedAccountsForClass
, let's take just on and use it everywhere.
x/asset/nft/client/cli/query.go
line 218 at r3 (raw file):
Example: $ %s query %s whitelisted-accounts [class-id] [id]
Breaking change ? I'm ok with it but we need to add to the change-log for the upgrade.
x/asset/nft/client/cli/query.go
line 259 at r3 (raw file):
Use: "class-whitelisted-accounts [class-id]", Args: cobra.ExactArgs(1), Short: "Query for the list whitelisted accounts for a class of non-fungible tokens",
list whitelisted
-> list of whitelisted
? Or use same as in Long.
x/asset/nft/keeper/keeper.go
line 582 at r3 (raw file):
} if bytes.Equal(ctx.KVStore(k.storeKey).Get(classKey), asset.StoreTrue) {
I know that it is not your change, but let's re-think the usage of the helper.go in the root. It looks really ugly.
@miladz68 @ysv @wojtek-coreum .
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.
Reviewable status: 26 of 28 files reviewed, 10 unresolved discussions (waiting on @miladz68, @wojtek-coreum, and @ysv)
x/deterministicgas/spec/README.md
line 84 at r3 (raw file):
| `/coreum.asset.ft.v1.MsgUnfreeze` | 8500 | | `/coreum.asset.ft.v1.MsgUpgradeTokenV1` | 25000 | | `/coreum.asset.nft.v1.MsgAddToClassWhitelist` | 7000 |
Did you compute that or just took from the nearest value?
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.
Reviewable status: 26 of 28 files reviewed, 10 unresolved discussions (waiting on @miladz68, @wojtek-coreum, and @ysv)
x/deterministicgas/spec/README.md
line 84 at r3 (raw file):
Previously, dzmitryhil (Dzmitry Hil) wrote…
Did you compute that or just took from the nearest value?
Same for the second message
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.
Reviewed 2 of 2 files at r3, all commit messages.
Reviewable status: all files reviewed, 5 unresolved discussions (waiting on @dzmitryhil, @miladz68, and @wojtek-coreum)
proto/coreum/asset/nft/v1/genesis.proto
line 34 at r3 (raw file):
Previously, dzmitryhil (Dzmitry Hil) wrote…
You use two name for the same -
ClassWhitelistedAccounts
andWhitelistedAccountsForClass
, let's take just on and use it everywhere.
agree
x/asset/nft/keeper/keeper.go
line 582 at r3 (raw file):
Previously, dzmitryhil (Dzmitry Hil) wrote…
I know that it is not your change, but let's re-think the usage of the helper.go in the root. It looks really ugly.
@miladz68 @ysv @wojtek-coreum .
Could you be more specific ?
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.
Reviewable status: all files reviewed, 5 unresolved discussions (waiting on @dzmitryhil and @wojtek-coreum)
proto/coreum/asset/nft/v1/genesis.proto
line 34 at r3 (raw file):
Previously, ysv (Yaroslav Savchuk) wrote…
agree
We have whitelisting
and class-whitelisting
so with that logic we should name it ClassWhitelistedNFTAccounts
but the NFT
is redundant. It is redundant in the previous naming as well, and we
x/asset/nft/client/cli/query.go
line 218 at r3 (raw file):
Previously, dzmitryhil (Dzmitry Hil) wrote…
Breaking change ? I'm ok with it but we need to add to the change-log for the upgrade.
it is not a breaking change, the description was incorrect so I fixed it.
x/asset/nft/client/cli/query.go
line 259 at r3 (raw file):
Previously, dzmitryhil (Dzmitry Hil) wrote…
list whitelisted
->list of whitelisted
? Or use same as in Long.
removed the list
to match with description.
x/asset/nft/keeper/keeper.go
line 582 at r3 (raw file):
Previously, ysv (Yaroslav Savchuk) wrote…
Could you be more specific ?
which helper? you mean bytes.Equal
?
x/deterministicgas/spec/README.md
line 84 at r3 (raw file):
Previously, dzmitryhil (Dzmitry Hil) wrote…
Same for the second message
I tool the value from the integration 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.
Reviewable status: 21 of 28 files reviewed, 5 unresolved discussions (waiting on @dzmitryhil, @wojtek-coreum, and @ysv)
proto/coreum/asset/nft/v1/genesis.proto
line 34 at r3 (raw file):
Previously, miladz68 (milad) wrote…
We have
whitelisting
andclass-whitelisting
so with that logic we should name itClassWhitelistedNFTAccounts
but theNFT
is redundant. It is redundant in the previous naming as well, and we
Actually I read your comment again and I understand it better now. I fixed the query name in proto.
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.
Reviewed 14 of 25 files at r1, 5 of 6 files at r2, 2 of 2 files at r3, 7 of 7 files at r4, all commit messages.
Reviewable status: all files reviewed, 6 unresolved discussions (waiting on @dzmitryhil and @miladz68)
integration-tests/modules/assetnft_test.go
line 1519 at r4 (raw file):
&assetnfttypes.MsgAddToClassWhitelist{}, &assetnfttypes.MsgAddToClassWhitelist{}, &assetnfttypes.MsgRemoveFromWhitelist{},
It should be MsgRemoveFromClassWhitelist
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.
Reviewable status: 26 of 28 files reviewed, 6 unresolved discussions (waiting on @dzmitryhil, @wojtek-coreum, and @ysv)
integration-tests/modules/assetnft_test.go
line 1519 at r4 (raw file):
Previously, wojtek-coreum (Wojtek) wrote…
It should be
MsgRemoveFromClassWhitelist
Done.
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.
Reviewed 2 of 2 files at r5, all commit messages.
Reviewable status: all files reviewed, 6 unresolved discussions (waiting on @dzmitryhil and @miladz68)
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.
Reviewable status: all files reviewed, 5 unresolved discussions (waiting on @dzmitryhil)
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.
Reviewable status: 25 of 28 files reviewed, 2 unresolved discussions (waiting on @miladz68, @wojtek-coreum, and @ysv)
proto/coreum/asset/nft/v1/genesis.proto
line 34 at r3 (raw file):
Previously, miladz68 (milad) wrote…
Actually I read your comment again and I understand it better now. I fixed the query name in proto.
Seach by WhitelistedAccountsForClass
, you still use it in the method names.
x/asset/nft/client/cli/query.go
line 218 at r3 (raw file):
Previously, miladz68 (milad) wrote…
it is not a breaking change, the description was incorrect so I fixed it.
Got you.
x/asset/nft/keeper/keeper.go
line 582 at r3 (raw file):
Previously, miladz68 (milad) wrote…
which helper? you mean
bytes.Equal
?
asset.StoreTrue
- in the assets root heler file with one constant.
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.
Reviewed 13 of 25 files at r1, 3 of 6 files at r2, 1 of 2 files at r3, 7 of 7 files at r4, 1 of 2 files at r5, 3 of 3 files at r6, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @miladz68 and @ysv)
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.
Reviewable status: 24 of 28 files reviewed, 2 unresolved discussions (waiting on @dzmitryhil, @wojtek-coreum, and @ysv)
proto/coreum/asset/nft/v1/genesis.proto
line 34 at r3 (raw file):
Previously, dzmitryhil (Dzmitry Hil) wrote…
Seach by
WhitelistedAccountsForClass
, you still use it in the method names.
Done.
x/asset/nft/keeper/keeper.go
line 582 at r3 (raw file):
Previously, dzmitryhil (Dzmitry Hil) wrote…
asset.StoreTrue
- in the assets root heler file with one constant.
let's discuss it with yaroslav.
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.
Reviewed 6 of 7 files at r4, 1 of 2 files at r5, 2 of 3 files at r6, 4 of 4 files at r7, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @dzmitryhil)
x/asset/nft/keeper/keeper.go
line 582 at r3 (raw file):
Previously, miladz68 (milad) wrote…
let's discuss it with yaroslav.
will discuss after daily
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.
Reviewed 2 of 3 files at r6, 4 of 4 files at r7, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @dzmitryhil)
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.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @dzmitryhil)
x/asset/nft/keeper/keeper.go
line 582 at r3 (raw file):
Previously, ysv (Yaroslav Savchuk) wrote…
will discuss after daily
Done.
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.
Reviewed 3 of 4 files at r7, 5 of 5 files at r8, all commit messages.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @miladz68)
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.
Reviewed 5 of 5 files at r8, all commit messages.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @miladz68)
Description
This PR provides the functionality to whitelist an entire class, instead of every nft individually.
Reviewers checklist:
Authors checklist
This change is