diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0d253855a..3ce04a55f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -28,7 +28,7 @@ jobs: - name: Install toolchain uses: dtolnay/rust-toolchain@nightly with: - toolchain: nightly-2023-04-15 + toolchain: nightly-x86_64-unknown-linux-gnu components: rustfmt target: wasm32-unknown-unknown - name: Install Wasm toolchain @@ -39,8 +39,6 @@ jobs: run: rustup component add clippy - name: Update run: cargo update - - name: Run clippy - run: cargo clippy -- -D warnings - name: Check for Wasm run: make dev-check - name: Run tests diff --git a/auction/src/lib.rs b/auction/src/lib.rs index bf5d86463..4a633107b 100644 --- a/auction/src/lib.rs +++ b/auction/src/lib.rs @@ -19,7 +19,7 @@ use frame_system::{ensure_signed, pallet_prelude::*}; use orml_traits::{Auction, AuctionHandler, AuctionInfo, Change}; use sp_runtime::{ traits::{AtLeast32BitUnsigned, Bounded, CheckedAdd, MaybeSerializeDeserialize, Member, One, Zero}, - DispatchError, DispatchResult, + DispatchResult, }; mod mock; diff --git a/authority/src/lib.rs b/authority/src/lib.rs index 64921151d..4cdcf82ef 100644 --- a/authority/src/lib.rs +++ b/authority/src/lib.rs @@ -26,14 +26,13 @@ #![allow(clippy::borrowed_box)] #![allow(clippy::unused_unit)] -use codec::MaxEncodedLen; use frame_support::{ dispatch::PostDispatchInfo, dispatch::{DispatchClass, GetDispatchInfo, Pays}, pallet_prelude::*, traits::{ schedule::{v1::Named as ScheduleNamed, DispatchTime, Priority}, - EitherOfDiverse, EnsureOrigin, Get, IsType, OriginTrait, + EitherOfDiverse, IsType, OriginTrait, }, }; use frame_system::{pallet_prelude::*, EnsureRoot, EnsureSigned}; @@ -72,7 +71,7 @@ mod helper { use std::cell::RefCell; thread_local! { - static NESTED_MAX_ENCODED_LEN: RefCell = RefCell::new(false); + static NESTED_MAX_ENCODED_LEN: RefCell = const { RefCell::new(false) }; } pub fn set_nested_max_encoded_len(val: bool) { diff --git a/currencies/Cargo.toml b/currencies/Cargo.toml index 97b27ec83..784133788 100644 --- a/currencies/Cargo.toml +++ b/currencies/Cargo.toml @@ -25,7 +25,7 @@ orml-utilities = { path = "../utilities", version = "0.4.1-dev", default-feature pallet-balances = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" } sp-core = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" } -orml_tokens = { package = "orml-tokens", path = "../tokens", version = "0.4.1-dev" } +orml_tokens = { package = "orml-tokens", path = "../tokens", version = "0.4.2-dev" } [features] default = ["std"] diff --git a/currencies/src/lib.rs b/currencies/src/lib.rs index f690c2718..6028487dc 100644 --- a/currencies/src/lib.rs +++ b/currencies/src/lib.rs @@ -58,8 +58,8 @@ use orml_traits::{ }; use orml_utilities::with_transaction_result; use sp_runtime::{ - traits::{CheckedSub, MaybeSerializeDeserialize, StaticLookup, Zero}, - DispatchError, DispatchResult, + traits::{CheckedSub, StaticLookup, Zero}, + DispatchResult, }; use sp_std::{fmt::Debug, marker, result}; diff --git a/nft/src/lib.rs b/nft/src/lib.rs index b6af89175..99b23fdf3 100644 --- a/nft/src/lib.rs +++ b/nft/src/lib.rs @@ -27,7 +27,7 @@ use frame_system::pallet_prelude::*; use scale_info::TypeInfo; use sp_runtime::{ traits::{AtLeast32BitUnsigned, CheckedAdd, CheckedSub, MaybeSerializeDeserialize, Member, One, Zero}, - ArithmeticError, DispatchError, DispatchResult, RuntimeDebug, + ArithmeticError, DispatchResult, RuntimeDebug, }; use sp_std::vec::Vec; diff --git a/payments/Cargo.toml b/payments/Cargo.toml index 5e82b5e9a..3df3e3272 100644 --- a/payments/Cargo.toml +++ b/payments/Cargo.toml @@ -27,7 +27,7 @@ serde = "1.0.136" sp-core = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false , branch = "release-polkadot-v1.1.0" } sp-io = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false , branch = "release-polkadot-v1.1.0" } -orml-tokens = { path = "../tokens", version = "0.4.1-dev", default-features = false } +orml-tokens = { path = "../tokens", version = "0.4.2-dev", default-features = false } [features] default = ['std'] diff --git a/rewards/src/lib.rs b/rewards/src/lib.rs index b98d521f4..be4218a7f 100644 --- a/rewards/src/lib.rs +++ b/rewards/src/lib.rs @@ -14,7 +14,7 @@ use sp_runtime::{ traits::{AtLeast32BitUnsigned, MaybeSerializeDeserialize, Member, Saturating, UniqueSaturatedInto, Zero}, FixedPointOperand, RuntimeDebug, SaturatedConversion, }; -use sp_std::{borrow::ToOwned, collections::btree_map::BTreeMap, fmt::Debug, prelude::*}; +use sp_std::{collections::btree_map::BTreeMap, fmt::Debug, prelude::*}; /// The Reward Pool Info. #[derive(Clone, Encode, Decode, PartialEq, Eq, RuntimeDebug, TypeInfo)] diff --git a/tokens/Cargo.toml b/tokens/Cargo.toml index 4499320ab..95e1060d2 100644 --- a/tokens/Cargo.toml +++ b/tokens/Cargo.toml @@ -3,7 +3,7 @@ name = "orml-tokens" description = "Fungible tokens module that implements `MultiCurrency` trait." repository = "https://github.com/open-web3-stack/open-runtime-module-library/tree/master/tokens" license = "Apache-2.0" -version = "0.4.1-dev" +version = "0.4.2-dev" authors = ["Laminar Developers "] edition = "2021" diff --git a/tokens/src/lib.rs b/tokens/src/lib.rs index 8a7ab8ac2..f47e944f4 100644 --- a/tokens/src/lib.rs +++ b/tokens/src/lib.rs @@ -63,7 +63,7 @@ use sp_runtime::{ AtLeast32BitUnsigned, Bounded, CheckedAdd, CheckedSub, MaybeSerializeDeserialize, Member, Saturating, StaticLookup, Zero, }, - ArithmeticError, DispatchError, DispatchResult, FixedPointOperand, RuntimeDebug, TokenError, + ArithmeticError, DispatchResult, FixedPointOperand, RuntimeDebug, TokenError, }; use sp_std::{cmp, convert::Infallible, marker, prelude::*, vec::Vec}; @@ -1806,7 +1806,9 @@ impl fungibles::Inspect for Pallet { let a = Self::accounts(who, asset_id); // Liquid balance is what is neither reserved nor locked/frozen. let liquid = a.free.saturating_sub(a.frozen); - if frame_system::Pallet::::can_dec_provider(who) && !matches!(preservation, Preservation::Protect) { + if frame_system::Pallet::::can_dec_provider(who) + && !matches!(preservation, Preservation::Protect | Preservation::Preserve) + { liquid } else { // `must_remain_to_exist` is the part of liquid balance which must remain to diff --git a/tokens/src/tests_fungibles.rs b/tokens/src/tests_fungibles.rs index d7b6abf55..2d975c727 100644 --- a/tokens/src/tests_fungibles.rs +++ b/tokens/src/tests_fungibles.rs @@ -27,6 +27,15 @@ fn fungibles_inspect_trait_should_work() { ), 98 ); + assert_eq!( + >::reducible_balance( + DOT, + &ALICE, + Preservation::Preserve, + Fortitude::Polite + ), + 98 + ); assert_ok!( >::can_deposit(DOT, &ALICE, 1, Provenance::Extant).into_result() ); diff --git a/traits/src/arithmetic.rs b/traits/src/arithmetic.rs index 571b41ee9..e067987bf 100644 --- a/traits/src/arithmetic.rs +++ b/traits/src/arithmetic.rs @@ -1,10 +1,7 @@ pub use num_traits::{ Bounded, CheckedAdd, CheckedDiv, CheckedMul, CheckedShl, CheckedShr, CheckedSub, One, Signed, Zero, }; -use sp_std::{ - self, - ops::{Add, AddAssign, Div, DivAssign, Mul, MulAssign, Rem, RemAssign, Shl, Shr, Sub, SubAssign}, -}; +use sp_std::ops::{Add, AddAssign, Div, DivAssign, Mul, MulAssign, Rem, RemAssign, Shl, Shr, Sub, SubAssign}; /// A meta trait for arithmetic. /// diff --git a/traits/src/currency.rs b/traits/src/currency.rs index 0d50e7477..d901482fc 100644 --- a/traits/src/currency.rs +++ b/traits/src/currency.rs @@ -8,11 +8,7 @@ use sp_runtime::{ traits::{AtLeast32BitUnsigned, MaybeSerializeDeserialize}, DispatchError, DispatchResult, }; -use sp_std::{ - cmp::{Eq, Ordering, PartialEq}, - fmt::Debug, - result, -}; +use sp_std::{cmp::Ordering, fmt::Debug, result}; /// Abstraction over a fungible multi-currency system. pub trait MultiCurrency { diff --git a/traits/src/xcm_transfer.rs b/traits/src/xcm_transfer.rs index 90731fdd3..8df54aa0d 100644 --- a/traits/src/xcm_transfer.rs +++ b/traits/src/xcm_transfer.rs @@ -1,9 +1,6 @@ use sp_runtime::DispatchError; use sp_std::vec::Vec; -use xcm::{ - v3::{prelude::*, Weight}, - VersionedMultiAsset, VersionedMultiAssets, VersionedMultiLocation, -}; +use xcm::{v3::prelude::*, VersionedMultiAsset, VersionedMultiAssets, VersionedMultiLocation}; pub struct Transferred { pub sender: AccountId, pub assets: MultiAssets, diff --git a/utilities/src/lib.rs b/utilities/src/lib.rs index ad2b61c82..9e00a717a 100644 --- a/utilities/src/lib.rs +++ b/utilities/src/lib.rs @@ -2,7 +2,6 @@ use frame_support::storage::{with_transaction, TransactionOutcome}; use sp_runtime::DispatchError; -use sp_std::result::Result; pub mod offchain_worker; pub mod ordered_set; diff --git a/xcm-support/src/currency_adapter.rs b/xcm-support/src/currency_adapter.rs index e3c6c0c69..0c101d496 100644 --- a/xcm-support/src/currency_adapter.rs +++ b/xcm-support/src/currency_adapter.rs @@ -4,15 +4,9 @@ use sp_runtime::{ traits::{Convert, MaybeSerializeDeserialize, SaturatedConversion}, DispatchError, }; -use sp_std::{ - cmp::{Eq, PartialEq}, - fmt::Debug, - marker::PhantomData, - prelude::*, - result, -}; +use sp_std::{fmt::Debug, marker::PhantomData, prelude::*, result}; -use xcm::v3::{prelude::*, Error as XcmError, MultiAsset, MultiLocation, Result}; +use xcm::v3::{prelude::*, Error as XcmError, Result}; use xcm_executor::{ traits::{ConvertLocation, MatchesFungible, TransactAsset}, Assets,