diff --git a/.github/workflows/ci-main.yml b/.github/workflows/ci-main.yml index 1e661292a..0f4a232ed 100644 --- a/.github/workflows/ci-main.yml +++ b/.github/workflows/ci-main.yml @@ -81,17 +81,17 @@ jobs: token: ${{ secrets.GITHUB_TOKEN }} version: ${{ env.RUSTUP_NIGHTLY_VERSION }} -# - name: Run Tests for Pallets -# run: | -# bash ./scripts/cmd-pallets test "+${{ env.RUSTUP_NIGHTLY_VERSION }} test" "--release" + - name: Run Tests for Pallets + run: | + bash ./scripts/cmd-pallets test "+${{ env.RUSTUP_NIGHTLY_VERSION }} test" "--release" - name: Run Tests for Other Libraries run: | bash ./scripts/cmd-pallets test "+${{ env.RUSTUP_NIGHTLY_VERSION }} test" "--release" -# - name: Run Tests for Clients -# run: | -# bash ./scripts/cmd-clients test "+${{ env.RUSTUP_NIGHTLY_VERSION }} test" "--release" + - name: Run Tests for Clients + run: | + bash ./scripts/cmd-clients test "+${{ env.RUSTUP_NIGHTLY_VERSION }} test" "--release" cargo-test-vault: name: Run Tests for Vault diff --git a/Cargo.lock b/Cargo.lock index 84a14489b..59db399ff 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6539,7 +6539,7 @@ dependencies = [ [[package]] name = "orml-currencies" version = "0.7.0" -source = "git+https://github.com/gianfra-t/open-runtime-module-library.git?branch=polkadot-v1.6.0#886ba6201da8f3a4bf3b89f9116f10cd2ca40f6a" +source = "git+https://github.com/pendulum-chain/open-runtime-module-library.git?branch=polkadot-v1.6.0#8d89db82cefb9003ebfe01d863aba9aecfc65873" dependencies = [ "frame-support", "frame-system", @@ -6556,7 +6556,7 @@ dependencies = [ [[package]] name = "orml-oracle" version = "0.7.0" -source = "git+https://github.com/gianfra-t/open-runtime-module-library.git?branch=polkadot-v1.6.0#886ba6201da8f3a4bf3b89f9116f10cd2ca40f6a" +source = "git+https://github.com/pendulum-chain/open-runtime-module-library.git?branch=polkadot-v1.6.0#8d89db82cefb9003ebfe01d863aba9aecfc65873" dependencies = [ "frame-support", "frame-system", @@ -6574,7 +6574,7 @@ dependencies = [ [[package]] name = "orml-tokens" version = "0.7.0" -source = "git+https://github.com/gianfra-t/open-runtime-module-library.git?branch=polkadot-v1.6.0#886ba6201da8f3a4bf3b89f9116f10cd2ca40f6a" +source = "git+https://github.com/pendulum-chain/open-runtime-module-library.git?branch=polkadot-v1.6.0#8d89db82cefb9003ebfe01d863aba9aecfc65873" dependencies = [ "frame-support", "frame-system", @@ -6591,7 +6591,7 @@ dependencies = [ [[package]] name = "orml-traits" version = "0.7.0" -source = "git+https://github.com/gianfra-t/open-runtime-module-library.git?branch=polkadot-v1.6.0#886ba6201da8f3a4bf3b89f9116f10cd2ca40f6a" +source = "git+https://github.com/pendulum-chain/open-runtime-module-library.git?branch=polkadot-v1.6.0#8d89db82cefb9003ebfe01d863aba9aecfc65873" dependencies = [ "frame-support", "impl-trait-for-tuples", @@ -6611,7 +6611,7 @@ dependencies = [ [[package]] name = "orml-utilities" version = "0.7.0" -source = "git+https://github.com/gianfra-t/open-runtime-module-library.git?branch=polkadot-v1.6.0#886ba6201da8f3a4bf3b89f9116f10cd2ca40f6a" +source = "git+https://github.com/pendulum-chain/open-runtime-module-library.git?branch=polkadot-v1.6.0#8d89db82cefb9003ebfe01d863aba9aecfc65873" dependencies = [ "frame-support", "parity-scale-codec", @@ -11541,7 +11541,7 @@ dependencies = [ name = "spacewalk-standalone" version = "1.0.13" dependencies = [ - "clap 3.2.25", + "clap 4.5.4", "frame-benchmarking", "frame-benchmarking-cli", "frame-support", @@ -11560,6 +11560,7 @@ dependencies = [ "pallet-transaction-payment-rpc", "parity-scale-codec", "sc-basic-authorship", + "sc-chain-spec", "sc-cli", "sc-client-api", "sc-consensus", diff --git a/Cargo.toml b/Cargo.toml index 12dcfc2ba..587dcc46e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -160,6 +160,7 @@ sc-telemetry = { git = "https://github.com/paritytech/polkadot-sdk", branch = "r pallet-transaction-payment-rpc = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.6.0", default-features = false } sc-transaction-pool = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.6.0", default-features = false } sc-transaction-pool-api = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.6.0", default-features = false } +sc-chain-spec = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.6.0", default-features = false } sp-consensus = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.6.0", default-features = false } sc-consensus-aura = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.6.0", default-features = false } sc-rpc = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.6.0", default-features = false } @@ -172,10 +173,10 @@ substrate-frame-rpc-system = { git = "https://github.com/paritytech/polkadot-sdk # Orml dependencies -orml-currencies = { package = "orml-currencies", git = "https://github.com/gianfra-t/open-runtime-module-library.git", default-features = false, branch = "polkadot-v1.6.0" } -orml-tokens = { package = "orml-tokens", git = "https://github.com/gianfra-t/open-runtime-module-library.git", default-features = false, branch = "polkadot-v1.6.0" } -orml-traits = { package = "orml-traits", git = "https://github.com/gianfra-t/open-runtime-module-library.git", default-features = false, branch = "polkadot-v1.6.0" } -orml-oracle = { package = "orml-oracle", git = "https://github.com/gianfra-t/open-runtime-module-library.git", default-features = false, branch = "polkadot-v1.6.0" } +orml-currencies = { package = "orml-currencies", git = "https://github.com/pendulum-chain/open-runtime-module-library.git", default-features = false, branch = "polkadot-v1.6.0" } +orml-tokens = { package = "orml-tokens", git = "https://github.com/pendulum-chain/open-runtime-module-library.git", default-features = false, branch = "polkadot-v1.6.0" } +orml-traits = { package = "orml-traits", git = "https://github.com/pendulum-chain/open-runtime-module-library.git", default-features = false, branch = "polkadot-v1.6.0" } +orml-oracle = { package = "orml-oracle", git = "https://github.com/pendulum-chain/open-runtime-module-library.git", default-features = false, branch = "polkadot-v1.6.0" } # Git dependency from Pendulum Chain diff --git a/clients/runtime/Cargo.toml b/clients/runtime/Cargo.toml index 9aa040840..0abf68752 100644 --- a/clients/runtime/Cargo.toml +++ b/clients/runtime/Cargo.toml @@ -57,7 +57,7 @@ primitives = { path = "../../primitives", package = "spacewalk-primitives" } # Dependencies for the testing utils for integration tests oracle = { path = "../../pallets/oracle", optional = true } rand = { workspace = true, default-features = true, optional = true } -tempdir = { workspace = true, default-features = true, optional = true } +tempdir = { workspace = true, optional = true } testchain = { package = "spacewalk-standalone", path = "../../testchain/node", optional = true } testchain-runtime = { package = "spacewalk-runtime-standalone-testnet", path = "../../testchain/runtime/testnet", optional = true } mainnet-runtime = { package = "spacewalk-runtime-standalone-mainnet", path = "../../testchain/runtime/mainnet", optional = true } diff --git a/clients/runtime/src/integration/mod.rs b/clients/runtime/src/integration/mod.rs index 70f4a76a0..ade08cc88 100644 --- a/clients/runtime/src/integration/mod.rs +++ b/clients/runtime/src/integration/mod.rs @@ -87,7 +87,7 @@ pub async fn default_provider_client( role: Role::Authority(key), telemetry: None, wasm_method: WasmExecutionMethod::Compiled { - instantiation_strategy: WasmtimeInstantiationStrategy::LegacyInstanceReuse, + instantiation_strategy: WasmtimeInstantiationStrategy::PoolingCopyOnWrite, }, tokio_handle: tokio::runtime::Handle::current(), }; diff --git a/testchain/node/Cargo.toml b/testchain/node/Cargo.toml index 0e2161f67..4ccfea0b4 100644 --- a/testchain/node/Cargo.toml +++ b/testchain/node/Cargo.toml @@ -15,7 +15,7 @@ name = "spacewalk-standalone" substrate-build-script-utils = { workspace = true } [dependencies] -clap = { workspace = true, features = ["derive"] } +clap = { version = "4.5.3", features = [ "derive" ] } codec = { workspace = true, default-features = true, version = "3.0.0" } hex-literal = { workspace = true, default-features = true } log = { workspace = true, default-features = true } @@ -38,6 +38,7 @@ sc-consensus = { workspace = true, default-features = true } sc-consensus-aura = { workspace = true, default-features = true } sc-consensus-manual-seal = { workspace = true, default-features = true } sc-executor = { workspace = true, default-features = true } +sc-chain-spec = { workspace = true, default-features = true} sc-consensus-grandpa = { workspace = true, default-features = true } sc-keystore = { workspace = true, default-features = true } sc-network = { workspace = true, default-features = true } diff --git a/testchain/node/src/chain_spec.rs b/testchain/node/src/chain_spec.rs index 12764fc88..b37798452 100644 --- a/testchain/node/src/chain_spec.rs +++ b/testchain/node/src/chain_spec.rs @@ -78,77 +78,62 @@ fn get_properties() -> Map { } pub fn mainnet_config() -> ChainSpec { - ChainSpec::from_genesis( - "spacewalk", - "dev_mainnet", - ChainType::Development, - move || { - genesis( - get_account_id_from_seed::("Alice"), - vec![authority_keys_from_seed("Alice")], - vec![ - get_account_id_from_seed::("Alice"), - get_account_id_from_seed::("Bob"), - get_account_id_from_seed::("Charlie"), - get_account_id_from_seed::("Dave"), - get_account_id_from_seed::("Eve"), - get_account_id_from_seed::("Ferdie"), - get_account_id_from_seed::("Alice//stash"), - get_account_id_from_seed::("Bob//stash"), - get_account_id_from_seed::("Charlie//stash"), - get_account_id_from_seed::("Dave//stash"), - get_account_id_from_seed::("Eve//stash"), - get_account_id_from_seed::("Ferdie//stash"), - ], - vec![get_account_id_from_seed::("Bob")], - false, - true, - ) - }, - Vec::new(), - None, - None, - None, - Some(get_properties()), - None, - ) + ChainSpec::builder(spacewalk_runtime_mainnet::WASM_BINARY.expect("WASM binary was not built, please build it!"), Default::default()) + .with_name("spacewalk") + .with_id("dev_mainnet") + .with_chain_type(ChainType::Development) + .with_properties(get_properties()) + .with_genesis_config(genesis( + get_account_id_from_seed::("Alice"), + vec![authority_keys_from_seed("Alice")], + vec![ + get_account_id_from_seed::("Alice"), + get_account_id_from_seed::("Bob"), + get_account_id_from_seed::("Charlie"), + get_account_id_from_seed::("Dave"), + get_account_id_from_seed::("Eve"), + get_account_id_from_seed::("Ferdie"), + get_account_id_from_seed::("Alice//stash"), + get_account_id_from_seed::("Bob//stash"), + get_account_id_from_seed::("Charlie//stash"), + get_account_id_from_seed::("Dave//stash"), + get_account_id_from_seed::("Eve//stash"), + get_account_id_from_seed::("Ferdie//stash"), + ], + vec![get_account_id_from_seed::("Bob")], + false, + true, + )) + .build() } - pub fn testnet_config() -> ChainSpec { - ChainSpec::from_genesis( - "spacewalk", - "dev_testnet", - ChainType::Development, - move || { - genesis( + ChainSpec::builder(spacewalk_runtime_mainnet::WASM_BINARY.expect("WASM binary was not built, please build it!"), Default::default()) + .with_name("spacewalk") + .with_id("dev_mainnet") + .with_chain_type(ChainType::Development) + .with_properties(get_properties()) + .with_genesis_config(genesis( + get_account_id_from_seed::("Alice"), + vec![authority_keys_from_seed("Alice")], + vec![ get_account_id_from_seed::("Alice"), - vec![authority_keys_from_seed("Alice")], - vec![ - get_account_id_from_seed::("Alice"), - get_account_id_from_seed::("Bob"), - get_account_id_from_seed::("Charlie"), - get_account_id_from_seed::("Dave"), - get_account_id_from_seed::("Eve"), - get_account_id_from_seed::("Ferdie"), - get_account_id_from_seed::("Alice//stash"), - get_account_id_from_seed::("Bob//stash"), - get_account_id_from_seed::("Charlie//stash"), - get_account_id_from_seed::("Dave//stash"), - get_account_id_from_seed::("Eve//stash"), - get_account_id_from_seed::("Ferdie//stash"), - ], - vec![get_account_id_from_seed::("Bob")], - false, - false, - ) - }, - Vec::new(), - None, - None, - None, - Some(get_properties()), - None, - ) + get_account_id_from_seed::("Bob"), + get_account_id_from_seed::("Charlie"), + get_account_id_from_seed::("Dave"), + get_account_id_from_seed::("Eve"), + get_account_id_from_seed::("Ferdie"), + get_account_id_from_seed::("Alice//stash"), + get_account_id_from_seed::("Bob//stash"), + get_account_id_from_seed::("Charlie//stash"), + get_account_id_from_seed::("Dave//stash"), + get_account_id_from_seed::("Eve//stash"), + get_account_id_from_seed::("Ferdie//stash"), + ], + vec![get_account_id_from_seed::("Bob")], + false, + false, + )) + .build() } fn default_pair(currency_id: CurrencyId, is_public_network: bool) -> VaultCurrencyPair { @@ -176,23 +161,15 @@ fn genesis( authorized_oracles: Vec, start_shutdown: bool, is_public_network: bool, -) -> RuntimeGenesisConfig { +) -> serde_json::Value { let default_wrapped_currency = if is_public_network { WRAPPED_CURRENCY_ID_STELLAR_MAINNET } else { WRAPPED_CURRENCY_ID_STELLAR_TESTNET }; - // It's very important that we use the correct wasm binary - let wasm_binary = if is_public_network { - spacewalk_runtime_mainnet::WASM_BINARY - } else { - spacewalk_runtime_testnet::WASM_BINARY - }; - - RuntimeGenesisConfig { + let genesis_config = RuntimeGenesisConfig { system: SystemConfig { - code: wasm_binary.expect("WASM binary was not build, please build it!").to_vec(), ..Default::default() }, aura: AuraConfig { @@ -384,9 +361,12 @@ fn genesis( batching_api: b"https://dia-00.pendulumchain.tech:8070/currencies".to_vec(), coin_infos_map: vec![], }, - } + }; + + serde_json::to_value(genesis_config).expect("Serialization of genesis config should work") } + fn create_stellar_testnet_config() -> StellarRelayConfig { let old_validators = Vec::new(); let old_organizations = Vec::new(); diff --git a/testchain/node/src/cli.rs b/testchain/node/src/cli.rs index 15ceaa062..880d51ecf 100644 --- a/testchain/node/src/cli.rs +++ b/testchain/node/src/cli.rs @@ -1,4 +1,5 @@ use sc_cli::RunCmd; +use clap::Parser; #[derive(Debug, clap::Parser)] pub struct Cli { diff --git a/testchain/node/src/service.rs b/testchain/node/src/service.rs index 3c44553aa..a2eeaa03f 100644 --- a/testchain/node/src/service.rs +++ b/testchain/node/src/service.rs @@ -349,9 +349,9 @@ pub fn new_full(config: Configuration) -> Result<(TaskManager, RpcHandlers), Ser let mut net_config = sc_network::config::FullNetworkConfiguration::new(&config.network); - net_config.add_notification_protocol(sc_consensus_grandpa::grandpa_peers_set_config( - grandpa_protocol_name.clone(), - )); + let (grandpa_protocol_config, grandpa_notification_service) = + sc_consensus_grandpa::grandpa_peers_set_config(grandpa_protocol_name.clone()); + net_config.add_notification_protocol(grandpa_protocol_config); let (network, system_rpc_tx, tx_handler_controller, network_starter, sync_service) = sc_service::build_network(sc_service::BuildNetworkParams { @@ -363,6 +363,7 @@ pub fn new_full(config: Configuration) -> Result<(TaskManager, RpcHandlers), Ser import_queue, block_announce_validator_builder: None, warp_sync_params: None, + block_relay: None })?; if config.offchain_worker.enabled { @@ -514,6 +515,7 @@ pub fn new_full(config: Configuration) -> Result<(TaskManager, RpcHandlers), Ser shared_voter_state: SharedVoterState::empty(), telemetry: telemetry.as_ref().map(|x| x.handle()), offchain_tx_pool_factory: OffchainTransactionPoolFactory::new(transaction_pool), + notification_service: grandpa_notification_service }; // the GRANDPA voter task is considered infallible, i.e. @@ -556,6 +558,7 @@ pub async fn start_instant_mainnet( import_queue, block_announce_validator_builder: None, warp_sync_params: None, + block_relay: None, })?; if config.offchain_worker.enabled { @@ -693,6 +696,7 @@ pub async fn start_instant_testnet( import_queue, block_announce_validator_builder: None, warp_sync_params: None, + block_relay: None })?; if config.offchain_worker.enabled { diff --git a/testchain/runtime/mainnet/src/lib.rs b/testchain/runtime/mainnet/src/lib.rs index 6230f4bc1..bc249e999 100644 --- a/testchain/runtime/mainnet/src/lib.rs +++ b/testchain/runtime/mainnet/src/lib.rs @@ -2,6 +2,10 @@ // `construct_runtime!` does a lot of recursion and requires us to increase the limit to 256. #![recursion_limit = "256"] +// // Make the WASM binary available. +// #[cfg(feature = "std")] +// include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs")); + #[cfg(feature = "runtime-benchmarks")] #[macro_use] extern crate frame_benchmarking; diff --git a/testchain/runtime/testnet/src/lib.rs b/testchain/runtime/testnet/src/lib.rs index 55361e17c..9fac95a0b 100644 --- a/testchain/runtime/testnet/src/lib.rs +++ b/testchain/runtime/testnet/src/lib.rs @@ -2,6 +2,10 @@ // `construct_runtime!` does a lot of recursion and requires us to increase the limit to 256. #![recursion_limit = "256"] +// // Make the WASM binary available. +// #[cfg(feature = "std")] +// include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs")); + #[cfg(feature = "runtime-benchmarks")] #[macro_use] extern crate frame_benchmarking;