diff --git a/substrate/frame/revive/src/benchmarking/call_builder.rs b/substrate/frame/revive/src/benchmarking/call_builder.rs index 020a578c3a3a6029d89b08902aaa293790f0db1f..8a859a3a5089933c4aa8c7420a54c315f106babc 100644 --- a/substrate/frame/revive/src/benchmarking/call_builder.rs +++ b/substrate/frame/revive/src/benchmarking/call_builder.rs @@ -22,14 +22,11 @@ use crate::{ storage::meter::Meter, transient_storage::MeterEntry, wasm::{ApiVersion, PreparedCall, Runtime}, - BalanceOf, Config, DebugBuffer, Error, GasMeter, MomentOf, Origin, TypeInfo, WasmBlob, Weight, + BalanceOf, Config, DebugBuffer, Error, GasMeter, MomentOf, Origin, WasmBlob, Weight, }; use alloc::{vec, vec::Vec}; -use codec::{Encode, HasCompact}; -use core::fmt::Debug; use frame_benchmarking::benchmarking; -use frame_support::traits::IsType; -use sp_core::{H256, U256}; +use sp_core::U256; type StackExt<'a, T> = Stack<'a, T, WasmBlob<T>>; @@ -49,9 +46,7 @@ pub struct CallSetup<T: Config> { impl<T> Default for CallSetup<T> where T: Config + pallet_balances::Config, - <BalanceOf<T> as HasCompact>::Type: Clone + Eq + PartialEq + Debug + TypeInfo + Encode, BalanceOf<T>: Into<U256> + TryFrom<U256>, - T::Hash: IsType<H256>, MomentOf<T>: Into<U256>, { fn default() -> Self { @@ -62,8 +57,6 @@ where impl<T> CallSetup<T> where T: Config + pallet_balances::Config, - T::Hash: IsType<H256>, - <BalanceOf<T> as HasCompact>::Type: Clone + Eq + PartialEq + Debug + TypeInfo + Encode, BalanceOf<T>: Into<U256> + TryFrom<U256>, MomentOf<T>: Into<U256>, { diff --git a/substrate/frame/revive/src/benchmarking/mod.rs b/substrate/frame/revive/src/benchmarking/mod.rs index ed4f8f362e3df7f7cd29c48cfe51703f2f90faac..332c425d714ed13a96a61c9ee1d50d305522e52a 100644 --- a/substrate/frame/revive/src/benchmarking/mod.rs +++ b/substrate/frame/revive/src/benchmarking/mod.rs @@ -68,10 +68,8 @@ struct Contract<T: Config> { impl<T> Contract<T> where T: Config + pallet_balances::Config, - <BalanceOf<T> as HasCompact>::Type: Clone + Eq + PartialEq + Debug + TypeInfo + Encode, BalanceOf<T>: Into<U256> + TryFrom<U256>, MomentOf<T>: Into<U256>, - T::Hash: IsType<H256>, { /// Returns the address of the contract. fn address(&self) -> H160 { @@ -221,12 +219,10 @@ fn default_deposit_limit<T: Config>() -> BalanceOf<T> { #[benchmarks( where - <BalanceOf<T> as HasCompact>::Type: Clone + Eq + PartialEq + Debug + TypeInfo + Encode, - BalanceOf<T>: From<<pallet_balances::Pallet<T> as Currency<T::AccountId>>::Balance> + Into<U256> + TryFrom<U256>, + BalanceOf<T>: Into<U256> + TryFrom<U256>, T: Config + pallet_balances::Config, MomentOf<T>: Into<U256>, <T as frame_system::Config>::RuntimeEvent: From<pallet::Event<T>>, - T::Hash: IsType<H256>, <pallet_balances::Pallet<T> as Currency<T::AccountId>>::Balance: From<BalanceOf<T>>, )] mod benchmarks { diff --git a/substrate/frame/revive/src/exec.rs b/substrate/frame/revive/src/exec.rs index b065adb4675674621c24530676166e924accfe9d..233658696c8fa968aab32972e25b1b91ce8642c4 100644 --- a/substrate/frame/revive/src/exec.rs +++ b/substrate/frame/revive/src/exec.rs @@ -37,7 +37,7 @@ use frame_support::{ traits::{ fungible::{Inspect, Mutate}, tokens::{Fortitude, Preservation}, - Contains, IsType, OriginTrait, Time, + Contains, OriginTrait, Time, }, weights::Weight, Blake2_128Concat, BoundedVec, StorageHasher, @@ -699,7 +699,6 @@ impl<T: Config> CachedContract<T> { impl<'a, T, E> Stack<'a, T, E> where T: Config, - T::Hash: IsType<H256>, BalanceOf<T>: Into<U256> + TryFrom<U256>, MomentOf<T>: Into<U256>, E: Executable<T>, @@ -1271,7 +1270,6 @@ where impl<'a, T, E> Ext for Stack<'a, T, E> where T: Config, - T::Hash: IsType<H256>, E: Executable<T>, BalanceOf<T>: Into<U256> + TryFrom<U256>, MomentOf<T>: Into<U256>, diff --git a/substrate/frame/revive/src/lib.rs b/substrate/frame/revive/src/lib.rs index d1e17fb7b390c51443bf809f3d7b5ad98322456b..1cc77a673b1712b6b4a0485b1825310421b44b36 100644 --- a/substrate/frame/revive/src/lib.rs +++ b/substrate/frame/revive/src/lib.rs @@ -50,8 +50,7 @@ use crate::{ storage::{meter::Meter as StorageMeter, ContractInfo, DeletionQueueManager}, wasm::{CodeInfo, RuntimeCosts, WasmBlob}, }; -use codec::{Codec, Decode, Encode, HasCompact}; -use core::fmt::Debug; +use codec::{Codec, Decode, Encode}; use environmental::*; use frame_support::{ dispatch::{ @@ -597,10 +596,7 @@ pub mod pallet { } #[pallet::hooks] - impl<T: Config> Hooks<BlockNumberFor<T>> for Pallet<T> - where - T::Hash: IsType<H256>, - { + impl<T: Config> Hooks<BlockNumberFor<T>> for Pallet<T> { fn on_idle(_block: BlockNumberFor<T>, limit: Weight) -> Weight { let mut meter = WeightMeter::with_limit(limit); ContractInfo::<T>::process_deletion_queue_batch(&mut meter); @@ -734,8 +730,6 @@ pub mod pallet { #[pallet::call] impl<T: Config> Pallet<T> where - T::Hash: IsType<H256>, - <BalanceOf<T> as HasCompact>::Type: Clone + Eq + PartialEq + Debug + TypeInfo + Encode, BalanceOf<T>: Into<U256> + TryFrom<U256>, MomentOf<T>: Into<U256>, { @@ -987,7 +981,6 @@ impl<T: Config> Pallet<T> where BalanceOf<T>: Into<U256> + TryFrom<U256>, MomentOf<T>: Into<U256>, - T::Hash: IsType<H256>, { /// A generalized version of [`Self::call`]. /// @@ -1175,11 +1168,7 @@ where } } -impl<T> Pallet<T> -where - T: Config, - T::Hash: IsType<H256>, -{ +impl<T: Config> Pallet<T> { /// Return the existential deposit of [`Config::Currency`]. fn min_balance() -> BalanceOf<T> { <T::Currency as Inspect<AccountIdOf<T>>>::minimum_balance() diff --git a/substrate/frame/revive/src/storage.rs b/substrate/frame/revive/src/storage.rs index 9939de1dfd195b77ac3779b0d9a88c7ad9570799..ef7ce2db32cff0715bc6c6254b89c8b70168cd3a 100644 --- a/substrate/frame/revive/src/storage.rs +++ b/substrate/frame/revive/src/storage.rs @@ -33,12 +33,11 @@ use codec::{Decode, Encode, MaxEncodedLen}; use core::marker::PhantomData; use frame_support::{ storage::child::{self, ChildInfo}, - traits::IsType, weights::{Weight, WeightMeter}, CloneNoBound, DefaultNoBound, }; use scale_info::TypeInfo; -use sp_core::{ConstU32, Get, H160, H256}; +use sp_core::{ConstU32, Get, H160}; use sp_io::KillStorageResult; use sp_runtime::{ traits::{Hash, Saturating, Zero}, @@ -78,10 +77,7 @@ pub struct ContractInfo<T: Config> { delegate_dependencies: DelegateDependencyMap<T>, } -impl<T: Config> ContractInfo<T> -where - T::Hash: IsType<H256>, -{ +impl<T: Config> ContractInfo<T> { /// Constructs a new contract info **without** writing it to storage. /// /// This returns an `Err` if an contract with the supplied `account` already exists diff --git a/substrate/frame/revive/src/storage/meter.rs b/substrate/frame/revive/src/storage/meter.rs index 9d70ddf85870c478d040361498a9a8991ee584a0..a2ece03f9aaf95d2ca771475bfd9e820a45b40ea 100644 --- a/substrate/frame/revive/src/storage/meter.rs +++ b/substrate/frame/revive/src/storage/meter.rs @@ -27,11 +27,10 @@ use frame_support::{ traits::{ fungible::{Mutate, MutateHold}, tokens::{Fortitude, Fortitude::Polite, Precision, Preservation, Restriction}, - Get, IsType, + Get, }, DefaultNoBound, RuntimeDebugNoBound, }; -use sp_core::H256; use sp_runtime::{ traits::{Saturating, Zero}, DispatchError, FixedPointNumber, FixedU128, @@ -397,12 +396,7 @@ where } /// Functions that only apply to the nested state. -impl<T, E> RawMeter<T, E, Nested> -where - T: Config, - T::Hash: IsType<H256>, - E: Ext<T>, -{ +impl<T: Config, E: Ext<T>> RawMeter<T, E, Nested> { /// Charges `diff` from the meter. pub fn charge(&mut self, diff: &Diff) { match &mut self.own_contribution { @@ -504,10 +498,7 @@ where } } -impl<T: Config> Ext<T> for ReservingExt -where - T::Hash: IsType<H256>, -{ +impl<T: Config> Ext<T> for ReservingExt { fn check_limit( origin: &T::AccountId, limit: BalanceOf<T>, diff --git a/substrate/frame/revive/src/test_utils/builder.rs b/substrate/frame/revive/src/test_utils/builder.rs index b17d7628fb80923820d20429ab1302ce6b8865bc..d361590df95ae8d1b3aedaec391c4b5f772e266e 100644 --- a/substrate/frame/revive/src/test_utils/builder.rs +++ b/substrate/frame/revive/src/test_utils/builder.rs @@ -21,11 +21,8 @@ use crate::{ ContractExecResult, ContractInstantiateResult, DebugInfo, EventRecordOf, ExecReturnValue, InstantiateReturnValue, OriginFor, Pallet, Weight, }; -use codec::{Encode, HasCompact}; -use core::fmt::Debug; use frame_support::pallet_prelude::DispatchResultWithPostInfo; use paste::paste; -use scale_info::TypeInfo; use sp_core::H160; /// Helper macro to generate a builder for contract API calls. @@ -53,7 +50,6 @@ macro_rules! builder { #[allow(dead_code)] impl<T: Config> $name<T> where - <BalanceOf<T> as HasCompact>::Type: Clone + Eq + PartialEq + Debug + TypeInfo + Encode, BalanceOf<T>: Into<sp_core::U256> + TryFrom<sp_core::U256>, crate::MomentOf<T>: Into<sp_core::U256>, T::Hash: frame_support::traits::IsType<sp_core::H256>, diff --git a/substrate/frame/revive/src/wasm/mod.rs b/substrate/frame/revive/src/wasm/mod.rs index 5813903326bff18448dbd3a02833a7a97786d2ee..b8f6eef126b27f6ddf61c948358cf2ba90a4d9f2 100644 --- a/substrate/frame/revive/src/wasm/mod.rs +++ b/substrate/frame/revive/src/wasm/mod.rs @@ -45,9 +45,9 @@ use codec::{Decode, Encode, MaxEncodedLen}; use frame_support::{ dispatch::DispatchResult, ensure, - traits::{fungible::MutateHold, tokens::Precision::BestEffort, IsType}, + traits::{fungible::MutateHold, tokens::Precision::BestEffort}, }; -use sp_core::{Get, H256, U256}; +use sp_core::{Get, U256}; use sp_runtime::DispatchError; /// Validated Wasm module ready for execution. @@ -125,7 +125,6 @@ impl<T: Config> Token<T> for CodeLoadToken { impl<T: Config> WasmBlob<T> where - T::Hash: IsType<H256>, BalanceOf<T>: Into<U256> + TryFrom<U256>, { /// We only check for size and nothing else when the code is uploaded.