diff --git a/Makefile b/Makefile index afee442fda58fb2eff173304bd7749eb4fc1dfd5..9b45dce09c631bab692bb04e7a716cd898b92e99 100644 --- a/Makefile +++ b/Makefile @@ -6,7 +6,6 @@ check-tests: githooks test: githooks ./scripts/run.sh test - cargo test --manifest-path nft/Cargo.toml -p orml-nft --features disable-tokens-by-owner GITHOOKS_SRC = $(wildcard githooks/*) GITHOOKS_DEST = $(patsubst githooks/%, $(GITHOOK)/%, $(GITHOOKS_SRC)) @@ -48,4 +47,3 @@ dev-check-tests: Cargo.toml dev-test: Cargo.toml cargo test --all - cargo test --manifest-path nft/Cargo.toml -p orml-nft --features disable-tokens-by-owner diff --git a/auction/src/mock.rs b/auction/src/mock.rs index 25558c2eb95d0dd3d66dd9fb0dd12861aa4759e0..718c251640ab61370fe7a681cf9d5d11495f6621 100644 --- a/auction/src/mock.rs +++ b/auction/src/mock.rs @@ -42,6 +42,7 @@ impl frame_system::Config for Runtime { type BaseCallFilter = (); type SystemWeightInfo = (); type SS58Prefix = (); + type OnSetCode = (); } pub struct Handler; diff --git a/authority/src/mock.rs b/authority/src/mock.rs index 069f994a82e69b89762f2f9c1350b9cf5c49fdb0..593710bc632227e017baaa00c6aa4623ee33c85a 100644 --- a/authority/src/mock.rs +++ b/authority/src/mock.rs @@ -51,6 +51,7 @@ impl frame_system::Config for Runtime { type BaseCallFilter = (); type SystemWeightInfo = (); type SS58Prefix = (); + type OnSetCode = (); } parameter_types! { diff --git a/benchmarking/src/tests.rs b/benchmarking/src/tests.rs index 5068c81469a2fc4ccff99649bbe50d991759d0b0..333a776cb73cc7b0e6092f24c9f2cf36a0bae5b8 100644 --- a/benchmarking/src/tests.rs +++ b/benchmarking/src/tests.rs @@ -76,6 +76,7 @@ impl frame_system::Config for Test { type BaseCallFilter = (); type SystemWeightInfo = (); type SS58Prefix = (); + type OnSetCode = (); } impl tests::test::Config for Test { diff --git a/currencies/src/mock.rs b/currencies/src/mock.rs index a71a81f239007dda5cebd0ac09719f7de015b64f..6eb8d883e5d735f2ff08054c07b8d217f750f368 100644 --- a/currencies/src/mock.rs +++ b/currencies/src/mock.rs @@ -42,6 +42,7 @@ impl frame_system::Config for Runtime { type BaseCallFilter = (); type SystemWeightInfo = (); type SS58Prefix = (); + type OnSetCode = (); } type CurrencyId = u32; diff --git a/gradually-update/src/mock.rs b/gradually-update/src/mock.rs index d837e6367068ea28061f8f4eaf58357910e53523..410cb935d94a314a2633957a45ef7ba0f5c5e68e 100644 --- a/gradually-update/src/mock.rs +++ b/gradually-update/src/mock.rs @@ -39,6 +39,7 @@ impl frame_system::Config for Runtime { type BaseCallFilter = (); type SystemWeightInfo = (); type SS58Prefix = (); + type OnSetCode = (); } parameter_types! { diff --git a/nft/Cargo.toml b/nft/Cargo.toml index 27fb6a4144c84656eeaa863b54fcc2afb1741cd2..35f1b3cee0e03c0462bedb7093962f7305394342 100644 --- a/nft/Cargo.toml +++ b/nft/Cargo.toml @@ -32,4 +32,3 @@ std = [ "frame-support/std", "frame-system/std", ] -disable-tokens-by-owner = [] diff --git a/nft/src/lib.rs b/nft/src/lib.rs index 706a7600044083276b40b4f8f9841e01aabd95f5..19110231bcb8dd8b116510d31dd4b571349780ce 100644 --- a/nft/src/lib.rs +++ b/nft/src/lib.rs @@ -136,9 +136,6 @@ pub mod module { StorageDoubleMap<_, Twox64Concat, T::ClassId, Twox64Concat, T::TokenId, TokenInfoOf<T>>; /// Token existence check by owner and class ID. - // TODO: pallet macro doesn't support conditional compiling. Always having `TokensByOwner` storage doesn't hurt but - // it could be removed once conditional compiling supported. - // #[cfg(not(feature = "disable-tokens-by-owner"))] #[pallet::storage] #[pallet::getter(fn tokens_by_owner)] pub type TokensByOwner<T: Config> = @@ -216,11 +213,8 @@ impl<T: Config> Pallet<T> { info.owner = to.clone(); - #[cfg(not(feature = "disable-tokens-by-owner"))] - { - TokensByOwner::<T>::remove(from, token); - TokensByOwner::<T>::insert(to, token, ()); - } + TokensByOwner::<T>::remove(from, token); + TokensByOwner::<T>::insert(to, token, ()); Ok(()) }) @@ -252,7 +246,6 @@ impl<T: Config> Pallet<T> { data, }; Tokens::<T>::insert(class_id, token_id, token_info); - #[cfg(not(feature = "disable-tokens-by-owner"))] TokensByOwner::<T>::insert(owner, (class_id, token_id), ()); Ok(token_id) @@ -274,7 +267,6 @@ impl<T: Config> Pallet<T> { Ok(()) })?; - #[cfg(not(feature = "disable-tokens-by-owner"))] TokensByOwner::<T>::remove(owner, token); Ok(()) @@ -295,10 +287,6 @@ impl<T: Config> Pallet<T> { } pub fn is_owner(account: &T::AccountId, token: (T::ClassId, T::TokenId)) -> bool { - #[cfg(feature = "disable-tokens-by-owner")] - return Tokens::<T>::get(token.0, token.1).map_or(false, |token| token.owner == *account); - - #[cfg(not(feature = "disable-tokens-by-owner"))] TokensByOwner::<T>::contains_key(account, token) } } diff --git a/nft/src/mock.rs b/nft/src/mock.rs index cf4bac4f213eca792f8965ef5ba005a1aca8a079..915f67561e64e7e6471a3e55df8df191533c7c7c 100644 --- a/nft/src/mock.rs +++ b/nft/src/mock.rs @@ -40,6 +40,7 @@ impl frame_system::Config for Runtime { type BaseCallFilter = (); type SystemWeightInfo = (); type SS58Prefix = (); + type OnSetCode = (); } impl Config for Runtime { diff --git a/oracle/src/mock.rs b/oracle/src/mock.rs index c7ea7487f2a47d829b278d031ca7530ba4a17bdd..569dcdc6a74e781f31246991ad11edf163c0573e 100644 --- a/oracle/src/mock.rs +++ b/oracle/src/mock.rs @@ -45,6 +45,7 @@ impl frame_system::Config for Test { type BaseCallFilter = (); type SystemWeightInfo = (); type SS58Prefix = (); + type OnSetCode = (); } thread_local! { diff --git a/rewards/src/mock.rs b/rewards/src/mock.rs index d088983b2c93eb6d76db4debb7ea2cac15fc8732..2a34337b34b6cfe5deb1d6561726f0ed41cc8088 100644 --- a/rewards/src/mock.rs +++ b/rewards/src/mock.rs @@ -49,6 +49,7 @@ impl frame_system::Config for Runtime { type BaseCallFilter = (); type SystemWeightInfo = (); type SS58Prefix = (); + type OnSetCode = (); } thread_local! { diff --git a/tokens/src/mock.rs b/tokens/src/mock.rs index bc430b16a526103db493408c83b86d3d1779fc92..6076939409924dbd4ecbaae1868f8ebbce1223fd 100644 --- a/tokens/src/mock.rs +++ b/tokens/src/mock.rs @@ -54,6 +54,7 @@ impl frame_system::Config for Runtime { type BaseCallFilter = (); type SystemWeightInfo = (); type SS58Prefix = (); + type OnSetCode = (); } thread_local! { diff --git a/unknown-tokens/src/mock.rs b/unknown-tokens/src/mock.rs index 1a68d01c40d54fa76580def3cc201d880234d3e3..b8e297a15893e9b1a41e92713404cd1ddfe35ce4 100644 --- a/unknown-tokens/src/mock.rs +++ b/unknown-tokens/src/mock.rs @@ -38,6 +38,7 @@ impl frame_system::Config for Runtime { type BaseCallFilter = (); type SystemWeightInfo = (); type SS58Prefix = (); + type OnSetCode = (); } impl Config for Runtime { diff --git a/vesting/src/mock.rs b/vesting/src/mock.rs index c99f500592e72f5e5bac1c086fd69d0c82a70bcf..e3b250191fa549078c1d8f6fdac59a07a1d0c4c2 100644 --- a/vesting/src/mock.rs +++ b/vesting/src/mock.rs @@ -38,6 +38,7 @@ impl frame_system::Config for Runtime { type BaseCallFilter = (); type SystemWeightInfo = (); type SS58Prefix = (); + type OnSetCode = (); } type Balance = u64;