diff --git a/Cargo.dev.toml b/Cargo.dev.toml index b7b6f1430..13a411d59 100644 --- a/Cargo.dev.toml +++ b/Cargo.dev.toml @@ -36,35 +36,35 @@ scale-info = { version = "2.10.0", default-features = false, features = ["derive serde = { version = "1.0.214" } parity-scale-codec = { version = "3.6.12", default-features = false, features = ["max-encoded-len"] } -cumulus-pallet-xcm = { version = "0.19.1", default-features = false } -cumulus-primitives-core = { version = "0.18.1", default-features = false } -frame-benchmarking = { version = "40.0.0", default-features = false } -frame-support = { version = "40.1.0", default-features = false } -frame-system = { version = "40.1.0", default-features = false } -pallet-balances = { version = "41.1.0", default-features = false } -pallet-elections-phragmen = { version = "41.1.0", default-features = false } -pallet-message-queue = { version = "43.1.0", default-features = false } -pallet-preimage = { version = "40.0.0", default-features = false } -pallet-root-testing = { version = "16.0.0", default-features = false } -pallet-scheduler = { version = "41.0.0", default-features = false } -pallet-timestamp = { version = "39.0.0", default-features = false } -pallet-treasury = { version = "39.0.0", default-features = false } -pallet-xcm = { version = "19.1.0", default-features = false } -polkadot-parachain-primitives = { version = "16.1.0", default-features = false } -polkadot-runtime-common = { version = "19.1.0", default-features = false } -polkadot-runtime-parachains = { version = "19.1.0", default-features = false } -sp-api = { version = "36.0.1", default-features = false } -sp-application-crypto = { version = "40.1.0", default-features = false } -sp-arithmetic = { version = "26.1.0", default-features = false } -sp-core = { version = "36.1.0", default-features = false } -sp-io = { version = "40.0.0", default-features = false } -sp-runtime = { version = "41.1.0", default-features = false } -sp-runtime-interface = { version = "29.0.1", default-features = false } -sp-staking = { version = "38.0.0", default-features = false } +cumulus-pallet-xcm = { version = "0.20.0", default-features = false } +cumulus-primitives-core = { version = "0.19.0", default-features = false } +frame-benchmarking = { version = "41.0.0", default-features = false } +frame-support = { version = "41.0.0", default-features = false } +frame-system = { version = "41.0.0", default-features = false } +pallet-balances = { version = "42.0.0", default-features = false } +pallet-elections-phragmen = { version = "42.0.0", default-features = false } +pallet-message-queue = { version = "44.0.0", default-features = false } +pallet-preimage = { version = "41.0.0", default-features = false } +pallet-root-testing = { version = "17.0.0", default-features = false } +pallet-scheduler = { version = "42.0.0", default-features = false } +pallet-timestamp = { version = "40.0.0", default-features = false } +pallet-treasury = { version = "40.0.0", default-features = false } +pallet-xcm = { version = "20.1.0", default-features = false } +polkadot-parachain-primitives = { version = "17.0.0", default-features = false } +polkadot-runtime-common = { version = "20.0.0", default-features = false } +polkadot-runtime-parachains = { version = "20.0.1", default-features = false } +sp-api = { version = "37.0.0", default-features = false } +sp-application-crypto = { version = "41.0.0", default-features = false } +sp-arithmetic = { version = "27.0.0", default-features = false } +sp-core = { version = "37.0.0", default-features = false } +sp-io = { version = "41.0.1", default-features = false } +sp-runtime = { version = "42.0.0", default-features = false } +sp-runtime-interface = { version = "30.0.0", default-features = false } +sp-staking = { version = "39.0.0", default-features = false } sp-std = { version = "14.0.0", default-features = false } sp-storage = { version = "22.0.0", default-features = false } -xcm = { version = "16.1.0", package = "staging-xcm", default-features = false } -xcm-builder = { version = "20.0.0", package = "staging-xcm-builder", default-features = false } -xcm-executor = { version = "19.1.0", package = "staging-xcm-executor", default-features = false } +xcm = { version = "17.0.0", package = "staging-xcm", default-features = false } +xcm-builder = { version = "21.0.0", package = "staging-xcm-builder", default-features = false } +xcm-executor = { version = "20.0.0", package = "staging-xcm-executor", default-features = false } -xcm-simulator = { version = "20.0.0" } +xcm-simulator = { version = "21.0.0" } diff --git a/Makefile b/Makefile index e9613911c..072e1cce9 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ check: githooks - ./scripts/run.sh check --no-default-features --target=wasm32v1-none + RUSTFLAGS="${RUSTFLAGS:-} --cfg substrate_runtime" ./scripts/run.sh check --no-default-features --target=wasm32v1-none check-tests: githooks ./scripts/run.sh check --tests diff --git a/asset-registry/src/lib.rs b/asset-registry/src/lib.rs index 1f16ce894..9a5ca695d 100644 --- a/asset-registry/src/lib.rs +++ b/asset-registry/src/lib.rs @@ -34,8 +34,6 @@ pub mod module { #[pallet::config] pub trait Config: frame_system::Config { - type RuntimeEvent: From> + IsType<::RuntimeEvent>; - /// Additional non-standard metadata to store for each asset type CustomMetadata: Parameter + Member + TypeInfo + MaxEncodedLen; diff --git a/asset-registry/src/mock/para.rs b/asset-registry/src/mock/para.rs index 30223af7b..6f7df77f2 100644 --- a/asset-registry/src/mock/para.rs +++ b/asset-registry/src/mock/para.rs @@ -69,7 +69,6 @@ parameter_type_with_key! { } impl orml_tokens::Config for Runtime { - type RuntimeEvent = RuntimeEvent; type Balance = Balance; type Amount = Amount; type CurrencyId = CurrencyId; @@ -124,7 +123,6 @@ parameter_types! { } impl orml_asset_registry::Config for Runtime { - type RuntimeEvent = RuntimeEvent; type Balance = Balance; type AssetId = ParaAssetId; type AuthorityOrigin = AssetAuthority; @@ -319,7 +317,6 @@ parameter_type_with_key! { } impl orml_xtokens::Config for Runtime { - type RuntimeEvent = RuntimeEvent; type Balance = Balance; type CurrencyId = CurrencyId; type CurrencyIdConvert = CurrencyIdConvert; @@ -338,12 +335,10 @@ impl orml_xtokens::Config for Runtime { } impl orml_xcm::Config for Runtime { - type RuntimeEvent = RuntimeEvent; type SovereignOrigin = EnsureRoot; } impl orml_xcm_mock_message_queue::Config for Runtime { - type RuntimeEvent = RuntimeEvent; type XcmExecutor = XcmExecutor; } diff --git a/auction/src/lib.rs b/auction/src/lib.rs index 09fc61908..c0b6a2f34 100644 --- a/auction/src/lib.rs +++ b/auction/src/lib.rs @@ -35,8 +35,6 @@ pub mod module { #[pallet::config] pub trait Config: frame_system::Config { - type RuntimeEvent: From> + IsType<::RuntimeEvent>; - /// The balance type for bidding. type Balance: Parameter + Member diff --git a/auction/src/mock.rs b/auction/src/mock.rs index 712e65b90..9f5dff7c6 100644 --- a/auction/src/mock.rs +++ b/auction/src/mock.rs @@ -48,7 +48,6 @@ impl AuctionHandler for Handler { } impl Config for Runtime { - type RuntimeEvent = RuntimeEvent; type Balance = Balance; type AuctionId = AuctionId; type Handler = Handler; diff --git a/authority/src/lib.rs b/authority/src/lib.rs index b6f024ec3..8d4c15b75 100644 --- a/authority/src/lib.rs +++ b/authority/src/lib.rs @@ -205,9 +205,6 @@ pub mod module { #[pallet::config] pub trait Config: frame_system::Config { - /// The overarching event type. - type RuntimeEvent: From> + IsType<::RuntimeEvent>; - /// The outer origin type. type RuntimeOrigin: From, ::PalletsOrigin>> + IsType<::RuntimeOrigin> diff --git a/authority/src/mock.rs b/authority/src/mock.rs index 7535de905..da8e5e720 100644 --- a/authority/src/mock.rs +++ b/authority/src/mock.rs @@ -138,7 +138,6 @@ impl AsOriginId for MockAsOriginId { } impl Config for Runtime { - type RuntimeEvent = RuntimeEvent; type RuntimeOrigin = RuntimeOrigin; type PalletsOrigin = OriginCaller; type Scheduler = Scheduler; diff --git a/benchmarking/src/lib.rs b/benchmarking/src/lib.rs index 4d0db9d07..c543f0d44 100644 --- a/benchmarking/src/lib.rs +++ b/benchmarking/src/lib.rs @@ -6,7 +6,7 @@ mod tests; pub use frame_benchmarking::{ - benchmarking, whitelisted_caller, BenchmarkBatch, BenchmarkConfig, BenchmarkError, BenchmarkList, + benchmarking, current_time, whitelisted_caller, BenchmarkBatch, BenchmarkConfig, BenchmarkError, BenchmarkList, BenchmarkMetadata, BenchmarkParameter, BenchmarkRecording, BenchmarkResult, Benchmarking, BenchmarkingSetup, Recording, }; @@ -836,9 +836,9 @@ macro_rules! impl_benchmark { ); // Time the storage root recalculation. - let start_storage_root = $crate::benchmarking::current_time(); + let start_storage_root = $crate::current_time(); $crate::storage_root($crate::StateVersion::V0); - let finish_storage_root = $crate::benchmarking::current_time(); + let finish_storage_root = $crate::current_time(); let elapsed_storage_root = finish_storage_root - start_storage_root; let skip_meta = [ $( stringify!($name_skip_meta).as_ref() ),* ]; diff --git a/currencies/src/mock.rs b/currencies/src/mock.rs index 7d7270578..f08ca1b41 100644 --- a/currencies/src/mock.rs +++ b/currencies/src/mock.rs @@ -75,7 +75,6 @@ where } impl orml_tokens::Config for Runtime { - type RuntimeEvent = RuntimeEvent; type Balance = Balance; type Amount = i64; type CurrencyId = CurrencyId; diff --git a/gradually-update/src/lib.rs b/gradually-update/src/lib.rs index 6573ffbe7..f8a4396c9 100644 --- a/gradually-update/src/lib.rs +++ b/gradually-update/src/lib.rs @@ -69,8 +69,6 @@ pub mod module { #[pallet::config] pub trait Config: frame_system::Config { - type RuntimeEvent: From> + IsType<::RuntimeEvent>; - /// The frequency of updating values between blocks #[pallet::constant] type UpdateFrequency: Get>; diff --git a/gradually-update/src/mock.rs b/gradually-update/src/mock.rs index c5e9264e6..27d62b324 100644 --- a/gradually-update/src/mock.rs +++ b/gradually-update/src/mock.rs @@ -22,7 +22,6 @@ impl frame_system::Config for Runtime { } impl Config for Runtime { - type RuntimeEvent = RuntimeEvent; type UpdateFrequency = ConstU64<10>; type DispatchOrigin = frame_system::EnsureRoot; type WeightInfo = (); diff --git a/oracle/src/lib.rs b/oracle/src/lib.rs index 09bdf1408..dc5041f8a 100644 --- a/oracle/src/lib.rs +++ b/oracle/src/lib.rs @@ -100,8 +100,6 @@ pub mod module { #[pallet::config] pub trait Config: frame_system::Config { - type RuntimeEvent: From> + IsType<::RuntimeEvent>; - /// Hook on new data received type OnNewData: OnNewData; diff --git a/oracle/src/mock.rs b/oracle/src/mock.rs index d289439f3..9c20ed91b 100644 --- a/oracle/src/mock.rs +++ b/oracle/src/mock.rs @@ -64,7 +64,6 @@ impl SortedMembers for Members { } impl Config for Test { - type RuntimeEvent = RuntimeEvent; type OnNewData = (); type CombineData = DefaultCombineData, ConstU32<600>>; type Time = Timestamp; diff --git a/parameters/src/lib.rs b/parameters/src/lib.rs index 8ef2b7137..153cef96b 100644 --- a/parameters/src/lib.rs +++ b/parameters/src/lib.rs @@ -23,8 +23,6 @@ pub mod module { #[pallet::config] pub trait Config: frame_system::Config { - type RuntimeEvent: From> + IsType<::RuntimeEvent>; - /// The key value type for parameters. Usually created by /// orml_traits::parameters::define_aggregrated_parameters type AggregratedKeyValue: AggregratedKeyValue; diff --git a/parameters/src/mock.rs b/parameters/src/mock.rs index bdee5e041..8ff49021d 100644 --- a/parameters/src/mock.rs +++ b/parameters/src/mock.rs @@ -68,7 +68,6 @@ impl EnsureOriginWithArg for EnsureOriginIm } impl Config for Runtime { - type RuntimeEvent = RuntimeEvent; type AggregratedKeyValue = RuntimeParameters; type AdminOrigin = EnsureOriginImpl; type WeightInfo = (); diff --git a/payments/src/lib.rs b/payments/src/lib.rs index 58d447fad..b179940e9 100644 --- a/payments/src/lib.rs +++ b/payments/src/lib.rs @@ -110,9 +110,6 @@ pub mod pallet { #[pallet::config] pub trait Config: frame_system::Config { - /// Because this pallet emits events, it depends on the runtime's - /// definition of an event. - type RuntimeEvent: From> + IsType<::RuntimeEvent>; /// the type of assets this pallet can hold in payment type Asset: MultiReservableCurrency; /// Dispute resolution account diff --git a/payments/src/mock.rs b/payments/src/mock.rs index 039291c78..956568cee 100644 --- a/payments/src/mock.rs +++ b/payments/src/mock.rs @@ -67,7 +67,6 @@ impl orml_tokens::Config for Test { type Amount = i64; type Balance = Balance; type CurrencyId = u32; - type RuntimeEvent = RuntimeEvent; type ExistentialDeposits = ExistentialDeposits; type CurrencyHooks = (); type WeightInfo = (); @@ -107,7 +106,6 @@ parameter_types! { } impl payment::Config for Test { - type RuntimeEvent = RuntimeEvent; type Asset = Tokens; type DisputeResolver = MockDisputeResolver; type IncentivePercentage = IncentivePercentage; diff --git a/rate-limit/src/lib.rs b/rate-limit/src/lib.rs index c25959f24..6e1d6870d 100644 --- a/rate-limit/src/lib.rs +++ b/rate-limit/src/lib.rs @@ -92,8 +92,6 @@ pub mod module { #[pallet::config] pub trait Config: frame_system::Config { - type RuntimeEvent: From> + IsType<::RuntimeEvent>; - /// Origin represented Governance. type GovernanceOrigin: EnsureOrigin; diff --git a/rate-limit/src/mock.rs b/rate-limit/src/mock.rs index 24e588600..a5298de8f 100644 --- a/rate-limit/src/mock.rs +++ b/rate-limit/src/mock.rs @@ -44,7 +44,6 @@ impl pallet_timestamp::Config for Runtime { } impl Config for Runtime { - type RuntimeEvent = RuntimeEvent; type GovernanceOrigin = EnsureRoot; type RateLimiterId = RateLimiterId; type MaxWhitelistFilterCount = ConstU32<3>; diff --git a/tokens/src/lib.rs b/tokens/src/lib.rs index d9f7327f5..9f6a03ee3 100644 --- a/tokens/src/lib.rs +++ b/tokens/src/lib.rs @@ -181,8 +181,6 @@ pub mod module { #[pallet::config] pub trait Config: frame_system::Config { - type RuntimeEvent: From> + IsType<::RuntimeEvent>; - /// The balance type type Balance: frame_support::traits::tokens::Balance; diff --git a/tokens/src/mock.rs b/tokens/src/mock.rs index 956c591e6..5e1c62392 100644 --- a/tokens/src/mock.rs +++ b/tokens/src/mock.rs @@ -376,7 +376,6 @@ where } impl Config for Runtime { - type RuntimeEvent = RuntimeEvent; type Balance = Balance; type Amount = i64; type CurrencyId = CurrencyId; diff --git a/unknown-tokens/src/lib.rs b/unknown-tokens/src/lib.rs index c5e9bd749..df8752aeb 100644 --- a/unknown-tokens/src/lib.rs +++ b/unknown-tokens/src/lib.rs @@ -17,9 +17,7 @@ pub mod module { use super::*; #[pallet::config] - pub trait Config: frame_system::Config { - type RuntimeEvent: From + IsType<::RuntimeEvent>; - } + pub trait Config: frame_system::Config {} #[pallet::event] #[pallet::generate_deposit(pub(crate) fn deposit_event)] diff --git a/unknown-tokens/src/mock.rs b/unknown-tokens/src/mock.rs index d845a2fe7..f8b17a083 100644 --- a/unknown-tokens/src/mock.rs +++ b/unknown-tokens/src/mock.rs @@ -17,9 +17,7 @@ impl frame_system::Config for Runtime { type Block = Block; } -impl Config for Runtime { - type RuntimeEvent = RuntimeEvent; -} +impl Config for Runtime {} type Block = frame_system::mocking::MockBlock; diff --git a/vesting/src/lib.rs b/vesting/src/lib.rs index 0f6863967..dfe6e61ce 100644 --- a/vesting/src/lib.rs +++ b/vesting/src/lib.rs @@ -126,8 +126,6 @@ pub mod module { #[pallet::config] pub trait Config: frame_system::Config { - type RuntimeEvent: From> + IsType<::RuntimeEvent>; - type Currency: LockableCurrency>; #[pallet::constant] diff --git a/vesting/src/mock.rs b/vesting/src/mock.rs index 121f2b396..0e7094fa4 100644 --- a/vesting/src/mock.rs +++ b/vesting/src/mock.rs @@ -74,7 +74,6 @@ impl BlockNumberProvider for MockBlockNumberProvider { } impl Config for Runtime { - type RuntimeEvent = RuntimeEvent; type Currency = PalletBalances; type MinVestedTransfer = ConstU64<5>; type VestedTransferOrigin = EnsureAliceOrBob; diff --git a/xcm-mock-message-queue/src/lib.rs b/xcm-mock-message-queue/src/lib.rs index 9ee53eaaa..d1dafaa15 100644 --- a/xcm-mock-message-queue/src/lib.rs +++ b/xcm-mock-message-queue/src/lib.rs @@ -22,7 +22,6 @@ pub mod module { #[pallet::config] pub trait Config: frame_system::Config { - type RuntimeEvent: From> + IsType<::RuntimeEvent>; type XcmExecutor: ExecuteXcm; } @@ -96,11 +95,14 @@ pub mod module { max_weight, Weight::zero(), ) { - Outcome::Error { error } => (Err(error), Event::Fail(Some(hash), error)), + Outcome::Error(InstructionError { error, .. }) => (Err(error), Event::Fail(Some(hash), error)), Outcome::Complete { used } => (Ok(used), Event::Success(Some(hash))), // As far as the caller is concerned, this was dispatched without error, so // we just report the weight used. - Outcome::Incomplete { used, error } => (Ok(used), Event::Fail(Some(hash), error)), + Outcome::Incomplete { + used, + error: InstructionError { error, .. }, + } => (Ok(used), Event::Fail(Some(hash), error)), } } Err(()) => (Err(XcmError::UnhandledXcmVersion), Event::BadVersion(Some(hash))), diff --git a/xcm/src/lib.rs b/xcm/src/lib.rs index d6ac66f40..fcc3156e3 100644 --- a/xcm/src/lib.rs +++ b/xcm/src/lib.rs @@ -16,8 +16,6 @@ pub mod module { #[pallet::config] pub trait Config: frame_system::Config + pallet_xcm::Config { - type RuntimeEvent: From> + IsType<::RuntimeEvent>; - /// The required origin for sending XCM as parachain sovereign. /// /// Typically root or the majority of collective. diff --git a/xtokens/src/lib.rs b/xtokens/src/lib.rs index 5467cc2b0..9aa22afe7 100644 --- a/xtokens/src/lib.rs +++ b/xtokens/src/lib.rs @@ -77,8 +77,6 @@ pub mod module { #[pallet::config] pub trait Config: frame_system::Config { - type RuntimeEvent: From> + IsType<::RuntimeEvent>; - /// The balance type. type Balance: Parameter + Member @@ -685,7 +683,7 @@ pub mod module { }; let mut hash = msg.using_encoded(sp_io::hashing::blake2_256); - let weight = T::Weigher::weight(&mut msg).map_err(|()| Error::::UnweighableMessage)?; + let weight = T::Weigher::weight(&mut msg, Weight::MAX).map_err(|_| Error::::UnweighableMessage)?; T::XcmExecutor::prepare_and_execute(origin_location, msg, &mut hash, weight, weight) .ensure_complete() .map_err(|error| { @@ -898,7 +896,7 @@ pub mod module { }, ]), }; - return T::Weigher::weight(&mut msg) + return T::Weigher::weight(&mut msg, Weight::MAX) .map_or(Weight::max_value(), |w| T::BaseXcmWeight::get().saturating_add(w)); } } @@ -965,7 +963,7 @@ pub mod module { }, ]), }; - return T::Weigher::weight(&mut msg) + return T::Weigher::weight(&mut msg, Weight::MAX) .map_or(Weight::max_value(), |w| T::BaseXcmWeight::get().saturating_add(w)); } } diff --git a/xtokens/src/mock/para.rs b/xtokens/src/mock/para.rs index 83ff62b78..2482b0de5 100644 --- a/xtokens/src/mock/para.rs +++ b/xtokens/src/mock/para.rs @@ -66,7 +66,6 @@ parameter_type_with_key! { } impl orml_tokens::Config for Runtime { - type RuntimeEvent = RuntimeEvent; type Balance = Balance; type Amount = Amount; type CurrencyId = CurrencyId; @@ -295,7 +294,6 @@ parameter_types! { } impl orml_xtokens::Config for Runtime { - type RuntimeEvent = RuntimeEvent; type Balance = Balance; type CurrencyId = CurrencyId; type CurrencyIdConvert = CurrencyIdConvert; @@ -314,12 +312,10 @@ impl orml_xtokens::Config for Runtime { } impl orml_xcm::Config for Runtime { - type RuntimeEvent = RuntimeEvent; type SovereignOrigin = EnsureRoot; } impl orml_xcm_mock_message_queue::Config for Runtime { - type RuntimeEvent = RuntimeEvent; type XcmExecutor = XcmExecutor; } diff --git a/xtokens/src/mock/para_relative_view.rs b/xtokens/src/mock/para_relative_view.rs index 17e14f04a..70a679921 100644 --- a/xtokens/src/mock/para_relative_view.rs +++ b/xtokens/src/mock/para_relative_view.rs @@ -62,7 +62,6 @@ parameter_type_with_key! { } impl orml_tokens::Config for Runtime { - type RuntimeEvent = RuntimeEvent; type Balance = Balance; type Amount = Amount; type CurrencyId = CurrencyId; @@ -367,7 +366,6 @@ parameter_type_with_key! { } impl orml_xtokens::Config for Runtime { - type RuntimeEvent = RuntimeEvent; type Balance = Balance; type CurrencyId = CurrencyId; type CurrencyIdConvert = RelativeCurrencyIdConvert; @@ -386,12 +384,10 @@ impl orml_xtokens::Config for Runtime { } impl orml_xcm::Config for Runtime { - type RuntimeEvent = RuntimeEvent; type SovereignOrigin = EnsureRoot; } impl orml_xcm_mock_message_queue::Config for Runtime { - type RuntimeEvent = RuntimeEvent; type XcmExecutor = XcmExecutor; } diff --git a/xtokens/src/mock/para_teleport.rs b/xtokens/src/mock/para_teleport.rs index b6ab52f0d..fb7e4efb8 100644 --- a/xtokens/src/mock/para_teleport.rs +++ b/xtokens/src/mock/para_teleport.rs @@ -59,7 +59,6 @@ parameter_type_with_key! { } impl orml_tokens::Config for Runtime { - type RuntimeEvent = RuntimeEvent; type Balance = Balance; type Amount = Amount; type CurrencyId = CurrencyId; @@ -215,7 +214,6 @@ impl Contains for ParentOrParachains { } impl orml_xtokens::Config for Runtime { - type RuntimeEvent = RuntimeEvent; type Balance = Balance; type CurrencyId = CurrencyId; type CurrencyIdConvert = CurrencyIdConvert; @@ -234,12 +232,10 @@ impl orml_xtokens::Config for Runtime { } impl orml_xcm::Config for Runtime { - type RuntimeEvent = RuntimeEvent; type SovereignOrigin = EnsureRoot; } impl orml_xcm_mock_message_queue::Config for Runtime { - type RuntimeEvent = RuntimeEvent; type XcmExecutor = XcmExecutor; }