diff --git a/Cargo.lock b/Cargo.lock index 1e655c4488..581b6b3526 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6906,7 +6906,6 @@ dependencies = [ "pallet-fees", "pallet-timestamp", "parity-scale-codec 3.4.0", - "runtime-common", "scale-info", "sp-core", "sp-io", @@ -7023,7 +7022,6 @@ dependencies = [ "pallet-timestamp", "pallet-uniques", "parity-scale-codec 3.4.0", - "runtime-common", "scale-info", "serde", "sp-core", @@ -7432,7 +7430,6 @@ dependencies = [ "pallet-balances", "pallet-restricted-tokens", "parity-scale-codec 3.4.0", - "runtime-common", "scale-info", "serde", "sp-arithmetic", @@ -10690,6 +10687,7 @@ dependencies = [ "cfg-traits", "cfg-types", "cfg-utils", + "fp-self-contained", "frame-support", "frame-system", "hex-literal 0.2.2", diff --git a/ci/script.sh b/ci/script.sh index d3d9b18939..7b576d984e 100755 --- a/ci/script.sh +++ b/ci/script.sh @@ -17,9 +17,9 @@ rustup --version cargo --version case $TARGET in - build-node) - cargo build --release "$@" - ;; + build-node) + cargo build --release "$@" + ;; build-runtime) export RUSTC_VERSION=$RUST_TOOLCHAIN diff --git a/libs/mock-builder/Cargo.toml b/libs/mock-builder/Cargo.toml index fccf0205ff..50bbcf11c3 100644 --- a/libs/mock-builder/Cargo.toml +++ b/libs/mock-builder/Cargo.toml @@ -11,7 +11,7 @@ version = "0.0.1" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38" } +frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38", default-features = false } [dev-dependencies] codec = { package = "parity-scale-codec", version = "3.0.0", features = ["derive"] } @@ -20,3 +20,17 @@ scale-info = { version = "2.3.0", features = ["derive"] } sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38" } sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38" } sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38" } + +[features] +default = ["std"] +std = [ + "frame-support/std", +] +runtime-benchmarks = [ + "frame-support/runtime-benchmarks", + "frame-system/runtime-benchmarks", +] +try-runtime = [ + "frame-support/try-runtime", + "frame-system/try-runtime", +] diff --git a/libs/traits/Cargo.toml b/libs/traits/Cargo.toml index 82bfe38418..a675829fff 100644 --- a/libs/traits/Cargo.toml +++ b/libs/traits/Cargo.toml @@ -22,7 +22,7 @@ sp-std = { git = "https://github.com/paritytech/substrate", default-features = f [dev-dependencies] cfg-mocks = { path = "../mocks" } -cfg-types = { path = "../types", default-features = true } +cfg-types = { path = "../types" } mock-builder = { path = "../../libs/mock-builder" } [features] @@ -31,6 +31,9 @@ runtime-benchmarks = [ "cfg-primitives/runtime-benchmarks", "frame-support/runtime-benchmarks", "sp-runtime/runtime-benchmarks", + "cfg-mocks/runtime-benchmarks", + "cfg-types/runtime-benchmarks", + "mock-builder/runtime-benchmarks", ] std = [ "codec/std", @@ -45,4 +48,5 @@ try-runtime = [ "frame-support/try-runtime", "cfg-primitives/try-runtime", "sp-runtime/try-runtime", + "mock-builder/try-runtime", ] diff --git a/pallets/anchors/Cargo.toml b/pallets/anchors/Cargo.toml index 349d60aeab..a049cac8fa 100644 --- a/pallets/anchors/Cargo.toml +++ b/pallets/anchors/Cargo.toml @@ -31,11 +31,11 @@ frame-benchmarking = { git = "https://github.com/paritytech/substrate", default- pallet-aura = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.38" } [dev-dependencies] -pallet-authorship = { git = "https://github.com/paritytech/substrate", default-features = true, branch = "polkadot-v0.9.38" } -pallet-balances = { git = "https://github.com/paritytech/substrate", default-features = true, branch = "polkadot-v0.9.38" } -pallet-randomness-collective-flip = { git = "https://github.com/paritytech/substrate", default-features = true, branch = "polkadot-v0.9.38" } -sp-consensus-aura = { git = "https://github.com/paritytech/substrate", default-features = true, branch = "polkadot-v0.9.38" } -sp-io = { git = "https://github.com/paritytech/substrate", default-features = true, branch = "polkadot-v0.9.38" } +pallet-authorship = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38" } +pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38" } +pallet-randomness-collective-flip = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38" } +sp-consensus-aura = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38" } +sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38" } cfg-mocks = { path = "../../libs/mocks" } @@ -46,17 +46,23 @@ runtime-benchmarks = [ "pallet-timestamp/runtime-benchmarks", "cfg-utils/runtime-benchmarks", "cfg-traits/runtime-benchmarks", + "cfg-mocks/runtime-benchmarks", "frame-support/runtime-benchmarks", "frame-system/runtime-benchmarks", "sp-runtime/runtime-benchmarks", + "pallet-balances/runtime-benchmarks", ] try-runtime = [ "cfg-utils/try-runtime", "cfg-traits/try-runtime", + "cfg-mocks/try-runtime", "frame-support/try-runtime", "frame-system/try-runtime", "pallet-aura/try-runtime", "pallet-timestamp/try-runtime", + "pallet-authorship/try-runtime", + "pallet-balances/try-runtime", + "pallet-randomness-collective-flip/try-runtime", "sp-runtime/try-runtime", ] std = [ diff --git a/pallets/bridge/Cargo.toml b/pallets/bridge/Cargo.toml index e6aebe71c3..a204c21501 100644 --- a/pallets/bridge/Cargo.toml +++ b/pallets/bridge/Cargo.toml @@ -30,7 +30,6 @@ pallet-authorship = { git = "https://github.com/paritytech/substrate", branch = pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38" } pallet-fees = { path = "../fees" } pallet-timestamp = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38" } -runtime-common = { path = "../../runtime/common" } sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38" } sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38" } sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38" } @@ -41,7 +40,10 @@ runtime-benchmarks = [ "chainbridge/runtime-benchmarks", "frame-support/runtime-benchmarks", "cfg-traits/runtime-benchmarks", + "cfg-types/runtime-benchmarks", + "cfg-primitives/runtime-benchmarks", "frame-system/runtime-benchmarks", + "pallet-balances/runtime-benchmarks", ] std = [ "codec/std", @@ -58,5 +60,7 @@ try-runtime = [ "cfg-traits/try-runtime", "frame-support/try-runtime", "chainbridge/try-runtime", + "cfg-types/try-runtime", + "cfg-primitives/try-runtime", "frame-system/try-runtime", ] diff --git a/pallets/claims/Cargo.toml b/pallets/claims/Cargo.toml index 2e3397f6e9..edf221cf0a 100644 --- a/pallets/claims/Cargo.toml +++ b/pallets/claims/Cargo.toml @@ -47,3 +47,10 @@ try-runtime = [ "pallet-balances/try-runtime", "sp-runtime/try-runtime", ] +runtime-benchmarks = [ + "cfg-primitives/runtime-benchmarks", + "cfg-types/runtime-benchmarks", + "frame-support/runtime-benchmarks", + "frame-system/runtime-benchmarks", + "pallet-balances/runtime-benchmarks", +] diff --git a/pallets/connectors/Cargo.toml b/pallets/connectors/Cargo.toml index 4be04c4b36..19e5566118 100644 --- a/pallets/connectors/Cargo.toml +++ b/pallets/connectors/Cargo.toml @@ -58,9 +58,6 @@ sp-io = { git = "https://github.com/paritytech/substrate", default-features = tr orml-tokens = { git = "https://github.com/open-web3-stack/open-runtime-module-library", default-features = true, branch = "polkadot-v0.9.38" } orml-traits = { git = "https://github.com/open-web3-stack/open-runtime-module-library", default-features = true, branch = "polkadot-v0.9.38" } -# Local crates -runtime-common = { path = "../../runtime/common", default-features = true } - [features] default = ["std"] runtime-benchmarks = [ @@ -89,7 +86,6 @@ std = [ "orml-tokens/std", "orml-traits/std", "pallet-balances/std", - "runtime-common/std", "xcm/std", "pallet-ethereum/std", "xcm-primitives/std", diff --git a/pallets/crowdloan-reward/Cargo.toml b/pallets/crowdloan-reward/Cargo.toml index 05ea01b6f1..60cc293492 100644 --- a/pallets/crowdloan-reward/Cargo.toml +++ b/pallets/crowdloan-reward/Cargo.toml @@ -29,11 +29,11 @@ sp-std = { git = "https://github.com/paritytech/substrate", default-features = f cfg-traits = { path = "../../libs/traits", default_features = false } [dev-dependencies] -cfg-types = { path = "../../libs/types", default_features = true } -pallet-vesting = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.38" } +cfg-types = { path = "../../libs/types" } +pallet-vesting = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38" } serde = { version = "1.0.119" } -sp-core = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.38" } -sp-io = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.38" } +sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38" } +sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38" } [features] default = ["std"] @@ -44,6 +44,7 @@ runtime-benchmarks = [ "frame-system/runtime-benchmarks", "pallet-balances/runtime-benchmarks", "sp-runtime/runtime-benchmarks", + "cfg-types/runtime-benchmarks", ] std = [ "codec/std", @@ -58,6 +59,7 @@ std = [ "sp-runtime/std", ] try-runtime = [ + "cfg-types/try-runtime", "cfg-traits/try-runtime", "frame-support/try-runtime", "frame-system/try-runtime", diff --git a/pallets/investments/Cargo.toml b/pallets/investments/Cargo.toml index 2575a11c7e..1ba2a1cbc8 100644 --- a/pallets/investments/Cargo.toml +++ b/pallets/investments/Cargo.toml @@ -27,21 +27,20 @@ sp-std = { git = "https://github.com/paritytech/substrate", default-features = f frame-benchmarking = { git = "https://github.com/paritytech/substrate", default-features = false, optional = true, branch = "polkadot-v0.9.38" } [dev-dependencies] -cfg-test-utils = { path = "../../libs/test-utils", default-features = true } -cfg-types = { path = "../../libs/types", default-features = true } -orml-tokens = { git = "https://github.com/open-web3-stack/open-runtime-module-library", default-features = true, branch = "polkadot-v0.9.38" } -orml-traits = { git = "https://github.com/open-web3-stack/open-runtime-module-library", default-features = true, branch = "polkadot-v0.9.38" } -pallet-balances = { git = "https://github.com/paritytech/substrate", default-features = true, branch = "polkadot-v0.9.38" } -pallet-restricted-tokens = { path = "../../pallets/restricted-tokens", default-features = true } -runtime-common = { path = "../../runtime/common", default-features = true } -sp-arithmetic = { git = "https://github.com/paritytech/substrate", default-features = true, branch = "polkadot-v0.9.38" } -sp-core = { git = "https://github.com/paritytech/substrate", default-features = true, branch = "polkadot-v0.9.38" } -sp-io = { git = "https://github.com/paritytech/substrate", default-features = true, branch = "polkadot-v0.9.38" } +cfg-test-utils = { path = "../../libs/test-utils" } +cfg-types = { path = "../../libs/types" } +orml-tokens = { git = "https://github.com/open-web3-stack/open-runtime-module-library", branch = "polkadot-v0.9.38" } +orml-traits = { git = "https://github.com/open-web3-stack/open-runtime-module-library", branch = "polkadot-v0.9.38" } +pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38" } +pallet-restricted-tokens = { path = "../../pallets/restricted-tokens" } +sp-arithmetic = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38" } +sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38" } +sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38" } [features] default = ["std"] runtime-benchmarks = [ - "frame-benchmarking/runtime-benchmarks", + "frame-benchmarking", "frame-system/runtime-benchmarks", "frame-support/runtime-benchmarks", "sp-runtime/runtime-benchmarks", @@ -49,6 +48,7 @@ runtime-benchmarks = [ "cfg-traits/runtime-benchmarks", "cfg-types/runtime-benchmarks", "cfg-primitives/runtime-benchmarks", + "pallet-balances/runtime-benchmarks", ] std = [ "cfg-primitives/std", @@ -64,6 +64,7 @@ std = [ "serde/std", ] try-runtime = [ + "cfg-test-utils/try-runtime", "cfg-primitives/try-runtime", "cfg-traits/try-runtime", "frame-support/try-runtime", diff --git a/pallets/migration/src/benchmarking.rs b/pallets/migration/src/benchmarking.rs index eaf89cc7c2..9210444c4c 100644 --- a/pallets/migration/src/benchmarking.rs +++ b/pallets/migration/src/benchmarking.rs @@ -108,6 +108,7 @@ benchmarks! { assert_eq!(vesting_info, storage_vesting_info); } } + migrate_proxy_proxies{ let n in 1 .. ::MigrationMaxProxies::get(); @@ -189,7 +190,9 @@ fn inject_total_issuance() { } fn inject_system_accounts() { - let accounts = test_data::system_account::SYSTEM_ACCOUNT; + // We need to put the array into the stack (with a vec) to avoid stack overflow + // here + let accounts = test_data::system_account::SYSTEM_ACCOUNT.to_vec(); for account in accounts { storage::unhashed::put_raw(&account.key[..], &account.value[..]); diff --git a/pallets/migration/src/test_data/system_account.rs b/pallets/migration/src/test_data/system_account.rs index 2cd295ef54..94a9b693b3 100644 --- a/pallets/migration/src/test_data/system_account.rs +++ b/pallets/migration/src/test_data/system_account.rs @@ -24009,6 +24009,7 @@ pub const SYSTEM_ACCOUNT: [AccountKeyValue; 1715] = [ }, ]; +#[derive(Clone)] pub struct AccountKeyValue { pub key: [u8; 80], pub value: [u8; 80], diff --git a/pallets/nft-sales/Cargo.toml b/pallets/nft-sales/Cargo.toml index aae22d1e07..94e595387e 100644 --- a/pallets/nft-sales/Cargo.toml +++ b/pallets/nft-sales/Cargo.toml @@ -29,32 +29,34 @@ pallet-uniques = { git = "https://github.com/paritytech/substrate", default-feat [dev-dependencies] # Substrate crates & pallets -pallet-balances = { git = "https://github.com/paritytech/substrate", default-features = true, branch = "polkadot-v0.9.38" } -pallet-uniques = { git = "https://github.com/paritytech/substrate", default-features = true, branch = "polkadot-v0.9.38" } -sp-core = { git = "https://github.com/paritytech/substrate", default-features = true, branch = "polkadot-v0.9.38" } -sp-io = { git = "https://github.com/paritytech/substrate", default-features = true, branch = "polkadot-v0.9.38" } +pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38" } +pallet-uniques = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38" } +sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38" } +sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38" } # Orml crates -orml-tokens = { git = "https://github.com/open-web3-stack/open-runtime-module-library", default-features = true, branch = "polkadot-v0.9.38" } -orml-traits = { git = "https://github.com/open-web3-stack/open-runtime-module-library", default-features = true, branch = "polkadot-v0.9.38" } +orml-tokens = { git = "https://github.com/open-web3-stack/open-runtime-module-library", branch = "polkadot-v0.9.38" } +orml-traits = { git = "https://github.com/open-web3-stack/open-runtime-module-library", branch = "polkadot-v0.9.38" } # Local crates -cfg-primitives = { path = "../../libs/primitives", default-features = true } -cfg-types = { path = "../../libs/types", default-features = true } +cfg-primitives = { path = "../../libs/primitives" } +cfg-types = { path = "../../libs/types" } [features] default = ["std"] runtime-benchmarks = [ "frame-benchmarking", - "pallet-balances", - "pallet-uniques", - "cfg-types", - "cfg-primitives", - "orml-tokens", + "pallet-balances/runtime-benchmarks", + "pallet-uniques/runtime-benchmarks", + "cfg-types/runtime-benchmarks", + "cfg-primitives/runtime-benchmarks", "orml-traits", + "orml-tokens/runtime-benchmarks", "frame-support/runtime-benchmarks", "frame-system/runtime-benchmarks", "sp-runtime/runtime-benchmarks", + "pallet-balances/runtime-benchmarks", + "pallet-uniques/runtime-benchmarks", ] std = [ "codec/std", diff --git a/pallets/nft/Cargo.toml b/pallets/nft/Cargo.toml index 8b0f8537f9..0fa97cf9f9 100644 --- a/pallets/nft/Cargo.toml +++ b/pallets/nft/Cargo.toml @@ -48,14 +48,17 @@ cfg-mocks = { path = "../../libs/mocks" } [features] default = ["std"] runtime-benchmarks = [ - "chainbridge/runtime-benchmarks", "frame-benchmarking", + "chainbridge/runtime-benchmarks", "cfg-primitives/runtime-benchmarks", "cfg-traits/runtime-benchmarks", "cfg-types/runtime-benchmarks", "frame-support/runtime-benchmarks", "frame-system/runtime-benchmarks", "pallet-balances/runtime-benchmarks", + "cfg-mocks/runtime-benchmarks", + "pallet-anchors/runtime-benchmarks", + "pallet-timestamp/runtime-benchmarks", ] std = [ "codec/std", diff --git a/pallets/permissions/Cargo.toml b/pallets/permissions/Cargo.toml index 816751fc75..3f4f0d3517 100644 --- a/pallets/permissions/Cargo.toml +++ b/pallets/permissions/Cargo.toml @@ -32,7 +32,7 @@ bitflags = "1.3" default = ["std"] runtime-benchmarks = [ "frame-benchmarking", - "cfg-types", + "cfg-types/runtime-benchmarks", "cfg-traits/runtime-benchmarks", "frame-support/runtime-benchmarks", "frame-system/runtime-benchmarks", diff --git a/pallets/pool-registry/src/mock.rs b/pallets/pool-registry/src/mock.rs index 208b3f903e..aab5e2623f 100644 --- a/pallets/pool-registry/src/mock.rs +++ b/pallets/pool-registry/src/mock.rs @@ -26,8 +26,9 @@ use frame_support::{ }; use frame_system::EnsureSigned; use orml_traits::{asset_registry::AssetMetadata, parameter_type_with_key}; +#[cfg(feature = "runtime-benchmarks")] +use pallet_pool_system::benchmarking::create_pool; use pallet_pool_system::{ - benchmarking::create_pool, pool_types::{PoolChanges, PoolDetails, ScheduledUpdateDetails}, tranches::TrancheInput, }; @@ -222,6 +223,7 @@ impl< _currency: ::CurrencyId, _max_reserve: ::Balance, ) -> DispatchResult { + #[cfg(feature = "runtime-benchmarks")] create_pool::(tranche_inputs.len() as u32, admin)?; Ok(()) } diff --git a/pallets/restricted-tokens/Cargo.toml b/pallets/restricted-tokens/Cargo.toml index f6599e1a72..69bf4e0fb2 100644 --- a/pallets/restricted-tokens/Cargo.toml +++ b/pallets/restricted-tokens/Cargo.toml @@ -16,38 +16,38 @@ codec = { package = "parity-scale-codec", version = "3.0.0", features = ["derive scale-info = { version = "2.3.0", default-features = false, features = ["derive"] } serde = { version = "1.0.119" } +cfg-primitives = { path = "../../libs/primitives", default-features = false } cfg-traits = { path = "../../libs/traits", default-features = false } -frame-benchmarking = { git = "https://github.com/paritytech/substrate", default-features = false, optional = true, branch = "polkadot-v0.9.38" } frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.38" } frame-system = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.38" } -sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, optional = true, branch = "polkadot-v0.9.38" } +sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.38" } sp-std = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.38" } -## Benchmarkind dependencies -cfg-primitives = { path = "../../libs/primitives", default-features = false, optional = false } +## Benchmarking dependencies cfg-types = { path = "../../libs/types", default-features = false, optional = true } +frame-benchmarking = { git = "https://github.com/paritytech/substrate", default-features = false, optional = true, branch = "polkadot-v0.9.38" } orml-tokens = { git = "https://github.com/open-web3-stack/open-runtime-module-library", default-features = false, optional = true, branch = "polkadot-v0.9.38" } orml-traits = { git = "https://github.com/open-web3-stack/open-runtime-module-library", default-features = false, optional = true, branch = "polkadot-v0.9.38" } pallet-balances = { git = "https://github.com/paritytech/substrate", default-features = false, optional = true, branch = "polkadot-v0.9.38" } pallet-permissions = { path = "../permissions", default-features = false, optional = true } [dev-dependencies] -cfg-types = { path = "../../libs/types", default-features = true } -orml-tokens = { git = "https://github.com/open-web3-stack/open-runtime-module-library", default-features = true, branch = "polkadot-v0.9.38" } -orml-traits = { git = "https://github.com/open-web3-stack/open-runtime-module-library", default-features = true, branch = "polkadot-v0.9.38" } -pallet-balances = { git = "https://github.com/paritytech/substrate", default-features = true, branch = "polkadot-v0.9.38" } -sp-io = { git = "https://github.com/paritytech/substrate", default-features = true, branch = "polkadot-v0.9.38" } +cfg-types = { path = "../../libs/types" } +orml-tokens = { git = "https://github.com/open-web3-stack/open-runtime-module-library", branch = "polkadot-v0.9.38" } +orml-traits = { git = "https://github.com/open-web3-stack/open-runtime-module-library", branch = "polkadot-v0.9.38" } +pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38" } +sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38" } [features] default = ["std"] runtime-benchmarks = [ - "frame-benchmarking", - "pallet-balances", - "sp-runtime", - "orml-tokens", + "frame-benchmarking/runtime-benchmarks", + "pallet-balances/runtime-benchmarks", + "orml-tokens/runtime-benchmarks", "orml-traits", - "pallet-permissions", - "cfg-types", + "pallet-permissions/runtime-benchmarks", + "cfg-types/runtime-benchmarks", + "sp-runtime/runtime-benchmarks", "cfg-primitives/runtime-benchmarks", "cfg-traits/runtime-benchmarks", "frame-support/runtime-benchmarks", diff --git a/pallets/rewards/Cargo.toml b/pallets/rewards/Cargo.toml index 3d8c4b5ec9..88a5fb731b 100644 --- a/pallets/rewards/Cargo.toml +++ b/pallets/rewards/Cargo.toml @@ -52,3 +52,10 @@ std = [ "cfg-types/std", "scale-info/std", ] +runtime-benchmarks = [ + "cfg-traits/runtime-benchmarks", + "frame-support/runtime-benchmarks", + "frame-system/runtime-benchmarks", + "sp-runtime/runtime-benchmarks", + "cfg-types/runtime-benchmarks", +] diff --git a/pallets/transfer-allowlist/Cargo.toml b/pallets/transfer-allowlist/Cargo.toml index a71712292c..43c4ba0cd1 100644 --- a/pallets/transfer-allowlist/Cargo.toml +++ b/pallets/transfer-allowlist/Cargo.toml @@ -42,6 +42,8 @@ runtime-benchmarks = [ 'sp-runtime/runtime-benchmarks', 'cfg-types/runtime-benchmarks', 'cfg-traits/runtime-benchmarks', + 'cfg-mocks/runtime-benchmarks', + 'pallet-balances/runtime-benchmarks', ] std = [ 'codec/std', diff --git a/runtime/common/Cargo.toml b/runtime/common/Cargo.toml index 9b4f583a26..7ef6df6dab 100644 --- a/runtime/common/Cargo.toml +++ b/runtime/common/Cargo.toml @@ -40,6 +40,11 @@ pallet-evm = { git = "https://github.com/PureStake/frontier", default-features = pallet-evm-chain-id = { git = "https://github.com/PureStake/frontier", default-features = false, branch = "moonbeam-polkadot-v0.9.38" } pallet-evm-precompile-dispatch = { git = "https://github.com/PureStake/frontier", default-features = false, branch = "moonbeam-polkadot-v0.9.38" } +# There is a bug in the frontier repo that adds pallet-ethereum without a try-runtime dependency +# for this crate which makes our compilation fail with the i_know_what_i_am_doing error. +# It seem fixed in 0.9.39, and this dependency can be removed from this file safely. +fp-self-contained = { git = "https://github.com/PureStake/frontier", default-features = false, branch = "moonbeam-polkadot-v0.9.38" } + # Local Dependencies cfg-primitives = { path = "../../libs/primitives", default-features = false } cfg-traits = { path = "../../libs/traits", default-features = false } @@ -89,6 +94,7 @@ std = [ "serde/std", "scale-info/std", "xcm/std", + "fp-self-contained/std", ] runtime-benchmarks = [ "frame-support/runtime-benchmarks", @@ -132,4 +138,5 @@ try-runtime = [ "sp-runtime/try-runtime", "pallet-ethereum/try-runtime", "pallet-evm-chain-id/try-runtime", + "fp-self-contained/try-runtime", ] diff --git a/scripts/tests.sh b/scripts/tests.sh new file mode 100755 index 0000000000..e7b575b84b --- /dev/null +++ b/scripts/tests.sh @@ -0,0 +1,76 @@ +#!/usr/bin/env bash + +# NOTE +# If some crate fails, you can continue the testing after fixing it as follows: +# ./scripts/tests.sh + +start_from=$1 + +all_crates=$( + cargo workspaces list +) + +cargo_action() { + action=$1 + package=$2 + features=$3 + + echo -e "$testing_prompt cargo $action -p $package $features" + cargo $action -p $package $features + + if [[ $1 -ne 0 ]]; then + echo "Aborting!" + exit 1 + fi +} + +ESC="\033" +testing_prompt="$ESC[1;36m Testing$ESC[0m" +go=0 + +if [[ -z "$start_from" ]]; then + go=1 +fi + +cargo workspaces list > /dev/null +if [[ $1 -ne 0 ]]; then + echo try: \'cargo install cargo-workspaces\' before using this crate +fi + + +for crate in $all_crates +do + if [[ "$start_from" == "$crate" ]]; then + go=1 + fi + + if [[ $go -eq 0 ]]; then + # Skipping until found a crate as starting point + continue + fi + + cargo_action check $crate + cargo_action test $crate --no-run + + if [[ "$crate" == "proofs" ]]; then + # proofs does not have either try-runtime or runtime-benchmarks features + continue + fi + + cargo_action check $crate "-F runtime-benchmarks" + cargo_action test $crate "-F runtime-benchmarks" --no-run + + if [[ "$crate" == "runtime-integration-tests" ]]; then + # runtime-integration-test does not have try-runtime feature + continue + fi + + cargo_action check $crate "-F try-runtime" + cargo_action test $crate "-F try-runtime" --no-run + + cargo_action check $crate "-F runtime-benchmarks,try-runtime" + cargo_action test $crate "-F runtime-benchmarks,try-runtime" --no-run +done + +# Run all tests all +cargo test -workspace -F runtime-benchmarks,try-runtime