Finschia / finschia-sdk

A framework for building blockchains based Finschia Mainnet that is forked from cosmos-sdk
Apache License 2.0
63 stars 30 forks source link

fix: add nft id validation to MsgSendNFT #1287

Closed ulbqb closed 4 months ago

ulbqb commented 4 months ago

Description

closes: #XXXX

This PR adds nft id validation to MsgSendNFT.

Motivation and context

The ValidateBasic() method of message MsgSendNFT is used to check the validity of the message during the stateless validation process. The current implementation of ValidateBasic() checks whether the provided IDs are valid TokenIDs with function ValidateTokenID():

It is insufficient as it allows Fungible tokens to pass through, potentially leading to unexpected errors since Fungible tokens are not intended to be processed by this function.

How has this been tested?

Screenshots (if appropriate):

Checklist:

codecov[bot] commented 4 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 69.74%. Comparing base (47a5e9f) to head (5b47966). Report is 1 commits behind head on main.

Additional details and impacted files [![Impacted file tree graph](https://app.codecov.io/gh/Finschia/finschia-sdk/pull/1287/graphs/tree.svg?width=650&height=150&src=pr&token=m16qfzIPO7&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Finschia)](https://app.codecov.io/gh/Finschia/finschia-sdk/pull/1287?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Finschia) ```diff @@ Coverage Diff @@ ## main #1287 +/- ## ======================================= Coverage 69.74% 69.74% ======================================= Files 643 643 Lines 67261 67266 +5 ======================================= + Hits 46909 46917 +8 + Misses 18179 18177 -2 + Partials 2173 2172 -1 ``` | [Files](https://app.codecov.io/gh/Finschia/finschia-sdk/pull/1287?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Finschia) | Coverage Δ | | |---|---|---| | [x/collection/msgs.go](https://app.codecov.io/gh/Finschia/finschia-sdk/pull/1287?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Finschia#diff-eC9jb2xsZWN0aW9uL21zZ3MuZ28=) | `97.24% <100.00%> (+0.41%)` | :arrow_up: |