-
Notifications
You must be signed in to change notification settings - Fork 28
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
Modify NFT contract to use new protos for updatable NFTs and include examples #812
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #812 +/- ##
=======================================
Coverage 36.79% 36.79%
=======================================
Files 165 165
Lines 49342 49342
=======================================
Hits 18156 18156
Misses 27742 27742
Partials 3444 3444
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
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: 0 of 6 files reviewed, 1 unresolved discussion (waiting on @keyleu, @masihyeganeh, @miladz68, and @ysv)
integration-tests/contracts/modules/nft/src/contract.rs
line 174 at r2 (raw file):
let mint_bytes = mint.to_proto_bytes(); let msg = CosmosMsg::Stargate {
What about the migration of other messages to use the CosmosMsg::Stargate
?
And what about the coreum SDK, what will it provide?
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: 0 of 6 files reviewed, 1 unresolved discussion (waiting on @dzmitryhil, @masihyeganeh, @miladz68, and @ysv)
integration-tests/contracts/modules/nft/src/contract.rs
line 174 at r2 (raw file):
Previously, dzmitryhil (Dzmitry Hil) wrote…
What about the migration of other messages to use the
CosmosMsg::Stargate
?
And what about the coreum SDK, what will it provide?
-
There is no need for migration, all messages work using Stargate/Grpc using the right proto structures, which we will have in the wasm sdk (we have them there already because they are used for test tube)
-
Coreum wasm SDK provides all the proto structures required and will be updated/regenerated with every upgrade (we have a tool for that), and also api for queries (unless you guys want to start whitelisting like other chains do then we don't even need this). And also some constants that are useful, for example the values of the features for both assetft and nft (minting, burning, soulbound etc).
All current msg structures can be kept there for people who are already using them and since we will keep the wasm handler because we need backward compatibility we can keep those messages in the wasm sdk too.
Actually the wasm handler is not needed for anything, because queries can be whitelisted.
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: 0 of 6 files reviewed, 1 unresolved discussion (waiting on @dzmitryhil, @masihyeganeh, @miladz68, and @ysv)
integration-tests/contracts/modules/nft/src/contract.rs
line 174 at r2 (raw file):
Previously, keyleu (Keyne) wrote…
There is no need for migration, all messages work using Stargate/Grpc using the right proto structures, which we will have in the wasm sdk (we have them there already because they are used for test tube)
Coreum wasm SDK provides all the proto structures required and will be updated/regenerated with every upgrade (we have a tool for that), and also api for queries (unless you guys want to start whitelisting like other chains do then we don't even need this). And also some constants that are useful, for example the values of the features for both assetft and nft (minting, burning, soulbound etc).
All current msg structures can be kept there for people who are already using them and since we will keep the wasm handler because we need backward compatibility we can keep those messages in the wasm sdk too.Actually the wasm handler is not needed for anything, because queries can be whitelisted.
I meant the wasm handler was not really needed for anything, now it's needed because we need backward compatibility
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: 0 of 6 files reviewed, 1 unresolved discussion (waiting on @keyleu, @masihyeganeh, @miladz68, and @ysv)
integration-tests/modules/wasm_test.go
line 1687 at r2 (raw file):
requireT.NoError(err) // FIXME: When minting an NFT with empty data it creates an []byte{} in the data
Here is the fix for the test.
emptyData, err := codectypes.NewAnyWithValue(&assetnfttypes.DataBytes{Data: nil})
requireT.NoError(err)
expectedNFT := &nfttypes.NFT{
ClassId: classIDNoWhitelist,
Id: mintImmutableNFTReq.ID,
Data: emptyData,
}
gotNFT := nftResp.Nft
// encode the data `from` and `to` proto.Any to load same state as `codectypes.NewAnyWithValue` does
var gotNFTDataBytes assetnfttypes.DataBytes
requireT.NoError(gotNFTDataBytes.Unmarshal(gotNFT.Data.Value))
gotNFTData, err := codectypes.NewAnyWithValue(&gotNFTDataBytes)
requireT.NoError(err)
gotNFT.Data = gotNFTData
requireT.Equal(
expectedNFT, gotNFT,
)
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 4 of 6 files at r1, 2 of 2 files at r2, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @keyleu, @masihyeganeh, 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: 5 of 6 files reviewed, 1 unresolved discussion (waiting on @dzmitryhil, @masihyeganeh, @miladz68, and @ysv)
integration-tests/modules/wasm_test.go
line 1687 at r2 (raw file):
Previously, dzmitryhil (Dzmitry Hil) wrote…
Here is the fix for the test.
emptyData, err := codectypes.NewAnyWithValue(&assetnfttypes.DataBytes{Data: nil}) requireT.NoError(err) expectedNFT := &nfttypes.NFT{ ClassId: classIDNoWhitelist, Id: mintImmutableNFTReq.ID, Data: emptyData, } gotNFT := nftResp.Nft // encode the data `from` and `to` proto.Any to load same state as `codectypes.NewAnyWithValue` does var gotNFTDataBytes assetnfttypes.DataBytes requireT.NoError(gotNFTDataBytes.Unmarshal(gotNFT.Data.Value)) gotNFTData, err := codectypes.NewAnyWithValue(&gotNFTDataBytes) requireT.NoError(err) gotNFT.Data = gotNFTData requireT.Equal( expectedNFT, gotNFT, )
Thanks for this! Changed it.
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: 5 of 6 files reviewed, all discussions resolved (waiting on @masihyeganeh, @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.
Reviewed 1 of 1 files at r3, all commit messages.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @masihyeganeh and @ysv)
Description
This PR uses the new generated rust proto types (which are in a temporary branch of the coreum-wasm-sdk until we upgrade) in the integration tests contracts to mint and update NFT data. Remarks:
Reviewers checklist:
Authors checklist
This change is