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

Problem: No module to do NFT transfers via IBC #860

Merged
merged 18 commits into from
Sep 23, 2022

Conversation

devashishdxt
Copy link
Collaborator

@devashishdxt devashishdxt commented Sep 19, 2022

Solution: Add nft-transfer module.

Note: Have to include ibc-go git submodule for building protobuf files. Can be removed once this issue is closed: cosmos/ibc-go#1345

@devashishdxt devashishdxt requested a review from a team as a code owner September 19, 2022 00:32
@codecov
Copy link

codecov bot commented Sep 19, 2022

Codecov Report

Merging #860 (bb0e6e5) into master (d86e35e) will increase coverage by 1.42%.
The diff coverage is 5.43%.

@@            Coverage Diff             @@
##           master     #860      +/-   ##
==========================================
+ Coverage   15.50%   16.92%   +1.42%     
==========================================
  Files         105      119      +14     
  Lines       15516    14367    -1149     
==========================================
+ Hits         2405     2432      +27     
+ Misses      12622    11441    -1181     
- Partials      489      494       +5     
Flag Coverage Δ
integration_tests 14.28% <3.98%> (-2.29%) ⬇️
unit_tests 6.48% <2.58%> (+0.04%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
x/nft-transfer/ibc_module.go 0.00% <0.00%> (ø)
x/nft-transfer/keeper/grpc_query.go 0.00% <0.00%> (ø)
x/nft-transfer/keeper/msg_server.go 0.00% <0.00%> (ø)
x/nft-transfer/keeper/packet.go 0.00% <0.00%> (ø)
x/nft-transfer/keeper/relay.go 0.00% <0.00%> (ø)
x/nft-transfer/keeper/trace.go 0.00% <0.00%> (ø)
x/nft-transfer/simulation/decoder.go 0.00% <0.00%> (ø)
x/nft-transfer/simulation/genesis.go 0.00% <0.00%> (ø)
x/nft-transfer/types/ack.go 0.00% <0.00%> (ø)
x/nft-transfer/types/keys.go 0.00% <0.00%> (ø)
... and 43 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

Copy link
Contributor

@tomtau tomtau left a comment

Choose a reason for hiding this comment

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

/runsim

integration_tests/ibc_utils.py Outdated Show resolved Hide resolved
proto/nft_transfer/v1/tx.proto Show resolved Hide resolved
x/nft-transfer/ibc_module.go Outdated Show resolved Hide resolved
x/nft-transfer/ibc_module.go Show resolved Hide resolved
x/nft-transfer/ibc_module.go Outdated Show resolved Hide resolved
x/nft-transfer/keeper/packet.go Show resolved Hide resolved
x/nft-transfer/keeper/packet.go Show resolved Hide resolved
x/nft-transfer/keeper/packet.go Show resolved Hide resolved
x/nft/client/cli/query.go Outdated Show resolved Hide resolved
@tomtau
Copy link
Contributor

tomtau commented Sep 19, 2022

/runsim

@github-actions
Copy link

Simulation tests started and triggered by /runsim.
Will update here when it succeeds or fails.
Can further check progress here

@github-actions
Copy link

/runsim simulation test has succeeded 🎉
Can further check here

Copy link
Contributor

@tomtau tomtau left a comment

Choose a reason for hiding this comment

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

I had a quick read against https://github.com/cosmos/ibc/tree/main/spec/app/ics-721-nft-transfer and it looks all right; the integration test is also good that it checks that previously created NFTs will continue working post-upgrade.

Currently, I find three things missing:

  1. the test coverage is low. At least from what I can see, some of the spec logic doesn't appear to be covered, so it'll be good to add at least a few Keeper unit tests for it. (Off the top of my mind: covering those multi-hop-related logic A->B->C and going back, as there are always Else branches for the NFTs that weren't from the origin... and covering timeouts/refunds)
  2. doc/spec -- maybe it can be in a separate PR... mostly to point to a specific revision https://github.com/cosmos/ibc/tree/main/spec/app/ics-721-nft-transfer and update https://github.com/crypto-org-chain/chain-main/blob/master/doc/architecture/adr-004.md (I guess either a new ADR and supersede that one, or updates in it)
  3. app wiring for ICS29 -- I assume the NFT transfer won't be automatically covered by ICS29, so it may need extra code for the middleware... also not sure how complex -- maybe better in a separate PR.

otherwise it seems good to go, but ideally it's good to get a second pair of eyes to look at it, given it's not a trivial PR (@yihuang @adu-crypto @damoncro @JayT106 @leejw51crypto @thomas-nguy @mmsqe)

)

assert rsp["uri"] == tokenuri, rsp
assert rsp["owner"] == addr_src, rsp
Copy link
Contributor

Choose a reason for hiding this comment

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

adding some tests which ensure bad arguments not working.
such as
very long length tokenid, denomid?
some invalid data

x/nft-transfer/types/packet.go Show resolved Hide resolved
x/nft-transfer/client/cli/tx.go Show resolved Hide resolved
@devashishdxt
Copy link
Collaborator Author

  1. the test coverage is low. At least from what I can see, some of the spec logic doesn't appear to be covered, so it'll be good to add at least a few Keeper unit tests for it. (Off the top of my mind: covering those multi-hop-related logic A->B->C and going back

Added integration tests for multi-hop nft transfer

@devashishdxt
Copy link
Collaborator Author

3. app wiring for ICS29 -- I assume the NFT transfer won't be automatically covered by ICS29, so it may need extra code for the middleware

Current implementation already wires ICS29 with nft-transfer module

@tomtau
Copy link
Contributor

tomtau commented Sep 21, 2022

are those number conversion warnings false positives?

@devashishdxt
Copy link
Collaborator Author

are those number conversion warnings false positives?

Yes. One is converting 10 minutes to nanoseconds and storing it in uint64. Other is on cli client side so does not affect the blockchain.

@devashishdxt
Copy link
Collaborator Author

  1. and covering timeouts/refunds

Added timeout test

integration_tests/test_nft_transfer.py Outdated Show resolved Hide resolved
@tomtau
Copy link
Contributor

tomtau commented Sep 22, 2022

/runsim

@github-actions
Copy link

Simulation tests started and triggered by /runsim.
Will update here when it succeeds or fails.
Can further check progress here

@github-actions
Copy link

/runsim simulation test has succeeded 🎉
Can further check here

@tomtau tomtau merged commit 3e3d7ee into crypto-org-chain:master Sep 23, 2022
devashishdxt added a commit to devashishdxt/chain-main that referenced this pull request Sep 23, 2022
Solution: Add nft-transfer module.

Note: Have to include ibc-go git submodule for building protobuf files. Can be removed once this issue is closed: cosmos/ibc-go#1345
tomtau pushed a commit that referenced this pull request Sep 23, 2022
Solution: Add nft-transfer module.

Note: Have to include ibc-go git submodule for building protobuf files. Can be removed once this issue is closed: cosmos/ibc-go#1345
@devashishdxt devashishdxt deleted the nft-transfer branch October 21, 2022 04:03
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.

Publish the proto module on BSR
7 participants