diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 190dfc4f524..7dc8cfc4c84 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -66,7 +66,7 @@ jobs: run: ./scripts/gear.sh init cargo - name: "Build: Gear" - run: ./scripts/gear.sh build gear --locked --release + run: ./scripts/gear.sh build gear -F gear-cli/dev --locked --release - name: "Build fuzzer" run: ./scripts/gear.sh build fuzz --locked --release @@ -96,7 +96,7 @@ jobs: - name: "Test: Runtime benchmarks and benchmark tests work" run: | - cargo build -p gear-cli --release --features=runtime-benchmarks,runtime-benchmarks-checkers + cargo build -p gear-cli --release --features=dev,runtime-benchmarks,runtime-benchmarks-checkers # check that perf benchmarks works. `--steps=20` need to test, that benchmarks works for different input number. ./target/release/gear benchmark pallet --chain=dev --pallet=pallet_gear --steps=20 --extrinsic="*" --execution=wasm --wasm-execution=compiled --heap-pages=4096 # check that read_big_state benchmarks works @@ -111,11 +111,11 @@ jobs: - name: "Test: `try-runtime` feature tests" run: | - cargo test -p "pallet-*" --features try-runtime --release --locked + cargo test -p "pallet-*" --features try-runtime,dev --release --locked - name: "Test: Try runtime migrations" run: | - cargo build -p gear-cli --features try-runtime --release --locked + cargo build -p gear-cli --features try-runtime,dev --release --locked ./target/release/gear try-runtime --runtime ./target/release/wbuild/gear-runtime/gear_runtime.wasm on-runtime-upgrade --checks live --uri wss://rpc-private-testnet.gear-tech.io:443 env: RUST_LOG: info diff --git a/.github/workflows/test-measurements.yaml b/.github/workflows/test-measurements.yaml index 1368cadb136..b9c3a16a657 100644 --- a/.github/workflows/test-measurements.yaml +++ b/.github/workflows/test-measurements.yaml @@ -42,7 +42,7 @@ jobs: tar -xf /cache/check_cargo_registry_${{ github.ref_name }}.tar -C / - name: "Build: Gear" - run: ./scripts/gear.sh build gear --release --locked --features=runtime-benchmarks,lazy-pages + run: ./scripts/gear.sh build gear --release --locked --features=dev,runtime-benchmarks,lazy-pages - name: "Collect: Gear workspace tests" run: | diff --git a/Cargo.lock b/Cargo.lock index f51d1120230..108999619f0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3745,6 +3745,7 @@ dependencies = [ "gear-common", "gear-node-testing", "gear-runtime-primitives", + "gear-service", "log", "pallet-balances", "pallet-gear", @@ -4046,6 +4047,7 @@ dependencies = [ "gear-runtime", "gear-runtime-interface", "gear-runtime-primitives", + "gear-service", "log", "pallet-gear-rpc-runtime-api", "parity-scale-codec", diff --git a/node/authorship/Cargo.toml b/node/authorship/Cargo.toml index 041944ca157..7b474e043a6 100644 --- a/node/authorship/Cargo.toml +++ b/node/authorship/Cargo.toml @@ -58,3 +58,4 @@ testing = {workspace = true, features = ["vara-native"] } vara-runtime = { workspace = true, features = ["std", "dev"] } demo-mul-by-const.workspace = true env_logger.workspace = true +service = { workspace = true, features = ["dev", "vara-native"] } diff --git a/node/service/src/chain_spec/vara.rs b/node/service/src/chain_spec/vara.rs index 95bb0eb244f..3245ae1aef5 100644 --- a/node/service/src/chain_spec/vara.rs +++ b/node/service/src/chain_spec/vara.rs @@ -27,11 +27,13 @@ use sp_consensus_babe::AuthorityId as BabeId; use sp_consensus_grandpa::AuthorityId as GrandpaId; use sp_core::{crypto::UncheckedInto, sr25519}; use sp_runtime::{Perbill, Perquintill}; +#[cfg(feature = "dev")] +use vara_runtime::SudoConfig; use vara_runtime::{ constants::currency::{ECONOMIC_UNITS, EXISTENTIAL_DEPOSIT, UNITS as TOKEN}, AuthorityDiscoveryConfig, BabeConfig, BalancesConfig, GenesisConfig, GrandpaConfig, ImOnlineConfig, NominationPoolsConfig, SessionConfig, SessionKeys, StakerStatus, StakingConfig, - StakingRewardsConfig, SudoConfig, SystemConfig, VestingConfig, WASM_BINARY, + StakingRewardsConfig, SystemConfig, VestingConfig, WASM_BINARY, }; /// Specialized `ChainSpec`. This is a specialization of the general Substrate ChainSpec type. @@ -558,6 +560,9 @@ fn testnet_genesis( bank_account: AccountId, _enable_println: bool, ) -> GenesisConfig { + #[cfg(not(feature = "dev"))] + let _ = root_key; + const ENDOWMENT: u128 = 1_000_000 * TOKEN; const STASH: u128 = 100 * TOKEN; const MIN_NOMINATOR_BOND: u128 = 50 * TOKEN; @@ -609,6 +614,7 @@ fn testnet_genesis( min_nominator_bond: MIN_NOMINATOR_BOND, ..Default::default() }, + #[cfg(feature = "dev")] sudo: SudoConfig { // Assign network admin rights. key: Some(root_key), diff --git a/node/testing/Cargo.toml b/node/testing/Cargo.toml index 8607639dc26..6706a388f32 100644 --- a/node/testing/Cargo.toml +++ b/node/testing/Cargo.toml @@ -25,6 +25,7 @@ pallet-gear-rpc-runtime-api.workspace = true gear-runtime = { workspace = true, optional = true } vara-runtime = { workspace = true, optional = true } gear-runtime-interface.workspace = true +service = { workspace = true, features = ["dev"] } # Substrate Client sc-block-builder.workspace = true @@ -72,5 +73,5 @@ std = [ "gear-runtime?/std", "vara-runtime?/std", ] -gear-native = ["gear-runtime/dev"] -vara-native = ["vara-runtime/dev"] +gear-native = ["gear-runtime/dev", "service/gear-native"] +vara-native = ["vara-runtime/dev", "service/vara-native"] diff --git a/runtime/vara/Cargo.toml b/runtime/vara/Cargo.toml index 74551fefa6d..f179c2bd346 100644 --- a/runtime/vara/Cargo.toml +++ b/runtime/vara/Cargo.toml @@ -49,7 +49,7 @@ pallet-referenda.workspace = true pallet-scheduler.workspace = true pallet-session = { workspace = true, features = [ "historical" ] } pallet-staking.workspace = true -pallet-sudo.workspace = true +pallet-sudo = { workspace = true, optional = true } pallet-timestamp.workspace = true pallet-transaction-payment.workspace = true pallet-treasury.workspace = true @@ -157,7 +157,7 @@ std = [ "pallet-session/std", "pallet-scheduler/std", "pallet-staking/std", - "pallet-sudo/std", + "pallet-sudo?/std", "pallet-timestamp/std", "pallet-transaction-payment/std", "pallet-transaction-payment-rpc-runtime-api/std", @@ -245,7 +245,7 @@ try-runtime = [ "pallet-scheduler/try-runtime", "pallet-session/try-runtime", "pallet-staking/try-runtime", - "pallet-sudo/try-runtime", + "pallet-sudo?/try-runtime", "pallet-timestamp/try-runtime", "pallet-transaction-payment/try-runtime", "pallet-treasury/try-runtime", @@ -255,7 +255,11 @@ try-runtime = [ "pallet-bags-list/try-runtime", "runtime-common/try-runtime", ] -dev = ["pallet-gear-debug", "pallet-gear-program/dev"] +dev = [ + "pallet-gear-debug", + "pallet-gear-program/dev", + "pallet-sudo", +] lazy-pages = [ "pallet-gear/lazy-pages", "pallet-gear-payment/lazy-pages", diff --git a/runtime/vara/src/lib.rs b/runtime/vara/src/lib.rs index 7b9f86b4447..fee12da3048 100644 --- a/runtime/vara/src/lib.rs +++ b/runtime/vara/src/lib.rs @@ -98,7 +98,7 @@ pub use frame_system::Call as SystemCall; pub use pallet_balances::Call as BalancesCall; #[cfg(any(feature = "std", test))] pub use pallet_staking::StakerStatus; -#[cfg(any(feature = "std", test))] +#[cfg(all(feature = "dev", any(feature = "std", test)))] pub use pallet_sudo::Call as SudoCall; #[cfg(any(feature = "std", test))] pub use sp_runtime::BuildStorage; @@ -798,6 +798,7 @@ impl pallet_identity::Config for Runtime { type WeightInfo = pallet_identity::weights::SubstrateWeight; } +#[cfg(feature = "dev")] impl pallet_sudo::Config for Runtime { type RuntimeEvent = RuntimeEvent; type RuntimeCall = RuntimeCall; @@ -869,13 +870,23 @@ impl InstanceFilter for ProxyType { fn filter(&self, c: &RuntimeCall) -> bool { match self { ProxyType::Any => true, - ProxyType::NonTransfer => !matches!( - c, - RuntimeCall::Balances(..) - | RuntimeCall::Sudo(..) - | RuntimeCall::Vesting(pallet_vesting::Call::vested_transfer { .. }) - | RuntimeCall::Vesting(pallet_vesting::Call::force_vested_transfer { .. }) - ), + ProxyType::NonTransfer => { + #[cfg(feature = "dev")] + return !matches!( + c, + RuntimeCall::Balances(..) + | RuntimeCall::Sudo(..) + | RuntimeCall::Vesting(pallet_vesting::Call::vested_transfer { .. }) + | RuntimeCall::Vesting(pallet_vesting::Call::force_vested_transfer { .. }) + ); + #[cfg(not(feature = "dev"))] + return !matches!( + c, + RuntimeCall::Balances(..) + | RuntimeCall::Vesting(pallet_vesting::Call::vested_transfer { .. }) + | RuntimeCall::Vesting(pallet_vesting::Call::force_vested_transfer { .. }) + ); + } ProxyType::Governance => matches!( c, RuntimeCall::Treasury(..) @@ -1158,7 +1169,6 @@ construct_runtime!( GearVoucher: pallet_gear_voucher = 107, GearBank: pallet_gear_bank = 108, - // TODO: Remove in stage 3 Sudo: pallet_sudo = 99, // NOTE (!): `pallet_airdrop` used to be idx(198). @@ -1222,9 +1232,7 @@ construct_runtime!( GearVoucher: pallet_gear_voucher = 107, GearBank: pallet_gear_bank = 108, - // TODO: Remove in stage 3 - Sudo: pallet_sudo = 99, - + // NOTE (!): `pallet_sudo` used to be idx(99). // NOTE (!): `pallet_airdrop` used to be idx(198). } ); diff --git a/scripts/benchmarking/run_all_benchmarks.sh b/scripts/benchmarking/run_all_benchmarks.sh index 87c957ca3f4..caa838da4f2 100755 --- a/scripts/benchmarking/run_all_benchmarks.sh +++ b/scripts/benchmarking/run_all_benchmarks.sh @@ -58,7 +58,7 @@ done if [ "$skip_build" != true ] then echo "[+] Compiling Gear benchmarks..." - cargo build --profile=production --locked --features=runtime-benchmarks + cargo build --profile=production --locked --features=dev,runtime-benchmarks fi # The executable to use.