From 38029e89f17d79243d5ab1aa2e8dfa59d946c670 Mon Sep 17 00:00:00 2001 From: Youngtaek Yoon Date: Tue, 29 Aug 2023 14:19:52 +0900 Subject: [PATCH 1/5] Reject modifying NFT class with token index filled --- x/collection/msgs.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/x/collection/msgs.go b/x/collection/msgs.go index 8cec98f884..71f3c2ec9e 100644 --- a/x/collection/msgs.go +++ b/x/collection/msgs.go @@ -962,6 +962,10 @@ func (m MsgModify) ValidateBasic() error { if err := ValidateTokenID(tokenID); err != nil { return ErrInvalidTokenIndex.Wrap(err.Error()) } + // reject modifying nft class with token index filled (daphne compat.) + if ValidateLegacyNFTID(tokenID) == nil && ValidateFTID(tokenID) == nil { + return ErrInvalidTokenIndex.Wrap("cannot modify nft class with index filled") + } } validator := validateTokenClassChange From e2b2b1c61cdf983472a6f1795323e3052b5f8d86 Mon Sep 17 00:00:00 2001 From: Youngtaek Yoon Date: Tue, 29 Aug 2023 14:20:08 +0900 Subject: [PATCH 2/5] Update the corresponding unit test --- x/collection/msgs_test.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/x/collection/msgs_test.go b/x/collection/msgs_test.go index 2ed8c4b187..254d82eac4 100644 --- a/x/collection/msgs_test.go +++ b/x/collection/msgs_test.go @@ -1238,6 +1238,14 @@ func TestMsgModify(t *testing.T) { owner: addrs[0], changes: changes, }, + "invalid nft class modification": { + contractID: "deadbeef", + tokenType: "deadbeef", + tokenIndex: "00000000", + owner: addrs[0], + changes: changes, + err: collection.ErrInvalidTokenIndex, + }, "valid nft modification": { contractID: "deadbeef", tokenType: "deadbeef", From 836c30a0a383edef72a99f8582de371676a56cb4 Mon Sep 17 00:00:00 2001 From: Youngtaek Yoon Date: Tue, 29 Aug 2023 14:28:29 +0900 Subject: [PATCH 3/5] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a0e9ea758a..3109ca84aa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -55,6 +55,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ * (x/foundation) [\#1053](https://github.com/Finschia/finschia-sdk/pull/1053) Make x/foundation MsgExec propagate events * (baseapp) [\#1091](https://github.com/cosmos/cosmos-sdk/pull/1091) Add `events.GetAttributes` and `event.GetAttribute` methods to simplify the retrieval of an attribute from event(s) (backport #1075) * (baseapp) [\#1092](https://github.com/cosmos/cosmos-sdk/pull/1092) Do not add `module` attribute in case of ibc messages (backport #1079) +* (x/collection) [\#1102](https://github.com/finschia/finschia-sdk/pull/1102) Reject modifying NFT class with token index filled in MsgModify ### Removed From 48e1718fd7af9110636a1c25b32a977968e15a75 Mon Sep 17 00:00:00 2001 From: Youngtaek Yoon Date: Tue, 29 Aug 2023 14:29:02 +0900 Subject: [PATCH 4/5] Update CHANGELOG.md of other PRs --- CHANGELOG.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3109ca84aa..7fa281d968 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -53,8 +53,8 @@ Ref: https://keepachangelog.com/en/1.0.0/ ### Bug Fixes * (ledger) [\#1040](https://github.com/Finschia/finschia-sdk/pull/1040) Fix a bug(unable to connect nano S plus ledger on ubuntu) * (x/foundation) [\#1053](https://github.com/Finschia/finschia-sdk/pull/1053) Make x/foundation MsgExec propagate events -* (baseapp) [\#1091](https://github.com/cosmos/cosmos-sdk/pull/1091) Add `events.GetAttributes` and `event.GetAttribute` methods to simplify the retrieval of an attribute from event(s) (backport #1075) -* (baseapp) [\#1092](https://github.com/cosmos/cosmos-sdk/pull/1092) Do not add `module` attribute in case of ibc messages (backport #1079) +* (baseapp) [\#1091](https://github.com/finschia/finschia-sdk/pull/1091) Add `events.GetAttributes` and `event.GetAttribute` methods to simplify the retrieval of an attribute from event(s) (backport #1075) +* (baseapp) [\#1092](https://github.com/finschia/finschia-sdk/pull/1092) Do not add `module` attribute in case of ibc messages (backport #1079) * (x/collection) [\#1102](https://github.com/finschia/finschia-sdk/pull/1102) Reject modifying NFT class with token index filled in MsgModify ### Removed From cc480bfe74ac74d17e2b6c82925a5c443c4de9e7 Mon Sep 17 00:00:00 2001 From: Youngtaek Yoon Date: Wed, 30 Aug 2023 10:59:08 +0900 Subject: [PATCH 5/5] Update CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7fa281d968..f0ab927712 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -55,7 +55,6 @@ Ref: https://keepachangelog.com/en/1.0.0/ * (x/foundation) [\#1053](https://github.com/Finschia/finschia-sdk/pull/1053) Make x/foundation MsgExec propagate events * (baseapp) [\#1091](https://github.com/finschia/finschia-sdk/pull/1091) Add `events.GetAttributes` and `event.GetAttribute` methods to simplify the retrieval of an attribute from event(s) (backport #1075) * (baseapp) [\#1092](https://github.com/finschia/finschia-sdk/pull/1092) Do not add `module` attribute in case of ibc messages (backport #1079) -* (x/collection) [\#1102](https://github.com/finschia/finschia-sdk/pull/1102) Reject modifying NFT class with token index filled in MsgModify ### Removed @@ -64,6 +63,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ * (refactor) [\#1090](https://github.com/Finschia/finschia-sdk/pull/1090) Automate EventTypeMessage inclusion in every message execution (backport #1063) * (x/bank) [#1093](https://github.com/Finschia/finschia-sdk/pull/1093) Remove message events including `sender` attribute whose information is already present in the relevant events (backport #1066) * (ostracon) [\#1099](https://github.com/Finschia/finschia-sdk/pull/1099) feat!: remove libsodium vrf library. +* (x/collection) [\#1102](https://github.com/finschia/finschia-sdk/pull/1102) Reject modifying NFT class with token index filled in MsgModify ### Build, CI * (build,ci) [\#1043](https://github.com/Finschia/finschia-sdk/pull/1043) Update golang version to 1.20