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 query NFT classes with migration. #484

Merged
merged 17 commits into from
May 16, 2023

Conversation

dzmitryhil
Copy link
Contributor

@dzmitryhil dzmitryhil commented May 9, 2023

This change is Reviewable

@dzmitryhil dzmitryhil marked this pull request as ready for review May 9, 2023 12:29
dzmitryhil and others added 2 commits May 9, 2023 15:56
* Improve the CI caching 
* Add cron run on Mon and week based caching for docker.
* Adjust release workflow to the current behaviour of crust

* Merge master into wojtek/allign-release

* Merge master into wojtek/allign-release

* Merge remote-tracking branch 'origin/master' into wojtek/allign-release
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 28 of 28 files at r1, all commit messages.
Reviewable status: all files reviewed, 6 unresolved discussions (waiting on @dzmitryhil, @miladz68, @silverspase, and @ysv)

a discussion (no related file):
It would be nice to have a full upgrade integration test



x/asset/nft/keeper/keeper_test.go line 69 at r1 (raw file):

	requireT.True(types.ErrInvalidInput.Is(err))

	// try to get non-invalid class

non-invalid?


x/asset/nft/keeper/keeper_test.go line 73 at r1 (raw file):

	requireT.ErrorIs(err, types.ErrInvalidInput)

	//// try to get nonexistent class

//// -> //


x/asset/nft/keeper/keeper_test.go line 128 at r1 (raw file):

	for i := range classes {
		requireClassSettingsEqualClass(requireT, allSettings[i], classes[i])

can't you compare slices using built-in functions?


x/asset/nft/legacy/v1/store.go line 32 at r1 (raw file):

	}

	return oldStoreIter.Close()

Close() should be called in defer` present immediately after creating the iterator


x/asset/nft/types/keys.go line 45 at r1 (raw file):

// CreateIssuerClassPrefix constructs the key for the non-fungible token class for the specific issuer.
func CreateIssuerClassPrefix(issuer sdk.AccAddress) []byte {
	return store.JoinKeys(NFTClassKeyPrefix, issuer)

I think we should use length here. This is what comos sdk always does when address is part of the key

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, 6 unresolved discussions (waiting on @miladz68, @silverspase, @wojtek-coreum, and @ysv)

a discussion (no related file):

Previously, wojtek-coreum (Wojtek) wrote…

It would be nice to have a full upgrade integration test

It will be, I'm blocked by muti step upgrade task.



x/asset/nft/keeper/keeper_test.go line 69 at r1 (raw file):

Previously, wojtek-coreum (Wojtek) wrote…

non-invalid?

Done.


x/asset/nft/keeper/keeper_test.go line 73 at r1 (raw file):

Previously, wojtek-coreum (Wojtek) wrote…

//// -> //

Done.


x/asset/nft/keeper/keeper_test.go line 128 at r1 (raw file):

Previously, wojtek-coreum (Wojtek) wrote…

can't you compare slices using built-in functions?

Nope, since we compare the Class and ClassSettings


x/asset/nft/legacy/v1/store.go line 32 at r1 (raw file):

Previously, wojtek-coreum (Wojtek) wrote…

Close() should be called in defer` present immediately after creating the iterator

But in that case you won't get an error. Or you will have to use the naming returns.


x/asset/nft/types/keys.go line 45 at r1 (raw file):

Previously, wojtek-coreum (Wojtek) wrote…

I think we should use length here. This is what comos sdk always does when address is part of the key

In that case we won't be able to search by address.

dzmitryhil and others added 3 commits May 10, 2023 17:09
* Revert "Remove IBC integration (#420)"
This reverts commit d72ee0e.
* Add IBC integration test
* Add timeout to IBC tests

* fixes

* Use correct channel IDs

* leftover
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 1 of 28 files at r1, 1 of 1 files at r2, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @dzmitryhil, @miladz68, @silverspase, and @ysv)


x/asset/nft/legacy/v1/store.go line 32 at r1 (raw file):

Previously, dzmitryhil (Dzmitry Hil) wrote…

But in that case you won't get an error. Or you will have to use the naming returns.

But in this implementation iterator stays open if error is returned in the loop


x/asset/nft/types/keys.go line 45 at r1 (raw file):

Previously, dzmitryhil (Dzmitry Hil) wrote…

In that case we won't be able to search by address.

why? during the search you just add the length to the prefix too

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/nft/legacy/v1/store.go line 32 at r1 (raw file):

Previously, wojtek-coreum (Wojtek) wrote…

But in this implementation iterator stays open if error is returned in the loop

Agree, update to defer


x/asset/nft/types/keys.go line 45 at r1 (raw file):

Previously, wojtek-coreum (Wojtek) wrote…

why? during the search you just add the length to the prefix too

Missed that, agree, updated.

wojtek-coreum
wojtek-coreum previously approved these changes May 15, 2023
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 4 of 4 files at r3, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @miladz68, @silverspase, and @ysv)

miladz68
miladz68 previously approved these changes May 15, 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 24 of 28 files at r1, 1 of 1 files at r2, 4 of 4 files at r3, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @silverspase and @ysv)

miladz68 and others added 2 commits May 15, 2023 12:03
* added v2 upgrade handler
Co-authored-by: Dzmitry Hil <dzmitryhil@gmail.com>
@dzmitryhil dzmitryhil dismissed stale reviews from miladz68 and wojtek-coreum via 9419166 May 15, 2023 13:22
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 7 of 7 files at r4, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @silverspase and @ysv)

* Refactor integration tests
* Fetch address prefix, chainID, and denom form the chain VIA GRPC.
* Instantiate multiple chains for the testing (coreum, gaia).
* Update the testing utils to support the submission of the TXs using the sdk.Account with different prefixes.
* Integrate the faucet for the gaia chain.
* Refactor IBC helpers and add 2-way integration tests.
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 7 of 7 files at r4, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @silverspase and @ysv)

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

@dzmitryhil dzmitryhil merged commit da3eb41 into master May 16, 2023
@dzmitryhil dzmitryhil deleted the dzmitryhil/nft-classes-by-issuer-query branch May 16, 2023 08:52
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.

3 participants