From e8608a54e770666a034842360a81769ca7fd0fcb Mon Sep 17 00:00:00 2001 From: nakul1010 Date: Tue, 8 Aug 2023 13:04:54 +0530 Subject: [PATCH] fix: update runtime --- Cargo.lock | 52 ++++++++++++++------------- parachain/Cargo.toml | 2 ++ parachain/runtime/interlay/src/lib.rs | 6 ++-- parachain/runtime/kintsugi/src/lib.rs | 6 ++-- parachain/src/chain_spec/interlay.rs | 11 +++++- parachain/src/chain_spec/kintsugi.rs | 11 +++++- parachain/src/service.rs | 44 +++++++++++++++++++---- 7 files changed, 92 insertions(+), 40 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 3743982aa1..49cfbd18a1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5133,11 +5133,13 @@ dependencies = [ "sc-executor", "sc-network", "sc-network-sync", + "sc-offchain", "sc-rpc", "sc-service", "sc-telemetry", "sc-tracing", "sc-transaction-pool", + "sc-transaction-pool-api", "serde", "serde_json", "sp-api", @@ -18003,6 +18005,31 @@ name = "asset-hub-polkadot-runtime" version = "0.9.420" source = "git+https://github.com/paritytech//cumulus?rev=0d17cf6bef320f156f2859d6d2b0abd4154ae1d5#0d17cf6bef320f156f2859d6d2b0abd4154ae1d5" +[[patch.unused]] +name = "fc-cli" +version = "1.0.0-dev" +source = "git+https://github.com/paritytech//frontier?branch=polkadot-v1.0.0#b520b749eb90df15177144dbece3fbd3622a2b19" + +[[patch.unused]] +name = "fp-dynamic-fee" +version = "1.0.0" +source = "git+https://github.com/paritytech//frontier?branch=polkadot-v1.0.0#b520b749eb90df15177144dbece3fbd3622a2b19" + +[[patch.unused]] +name = "pallet-dynamic-fee" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech//frontier?branch=polkadot-v1.0.0#b520b749eb90df15177144dbece3fbd3622a2b19" + +[[patch.unused]] +name = "pallet-evm-test-vector-support" +version = "1.0.0-dev" +source = "git+https://github.com/paritytech//frontier?branch=polkadot-v1.0.0#b520b749eb90df15177144dbece3fbd3622a2b19" + +[[patch.unused]] +name = "pallet-hotfix-sufficients" +version = "1.0.0" +source = "git+https://github.com/paritytech//frontier?branch=polkadot-v1.0.0#b520b749eb90df15177144dbece3fbd3622a2b19" + [[patch.unused]] name = "pallet-nfts" version = "4.0.0-dev" @@ -18032,28 +18059,3 @@ source = "git+https://github.com/paritytech//substrate?rev=948fbd2fd1233dc26dbb9 name = "substrate-test-utils-derive" version = "0.10.0-dev" source = "git+https://github.com/paritytech//substrate?rev=948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" - -[[patch.unused]] -name = "fc-cli" -version = "1.0.0-dev" -source = "git+https://github.com/paritytech//frontier?branch=polkadot-v1.0.0#b520b749eb90df15177144dbece3fbd3622a2b19" - -[[patch.unused]] -name = "fp-dynamic-fee" -version = "1.0.0" -source = "git+https://github.com/paritytech//frontier?branch=polkadot-v1.0.0#b520b749eb90df15177144dbece3fbd3622a2b19" - -[[patch.unused]] -name = "pallet-dynamic-fee" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech//frontier?branch=polkadot-v1.0.0#b520b749eb90df15177144dbece3fbd3622a2b19" - -[[patch.unused]] -name = "pallet-evm-test-vector-support" -version = "1.0.0-dev" -source = "git+https://github.com/paritytech//frontier?branch=polkadot-v1.0.0#b520b749eb90df15177144dbece3fbd3622a2b19" - -[[patch.unused]] -name = "pallet-hotfix-sufficients" -version = "1.0.0" -source = "git+https://github.com/paritytech//frontier?branch=polkadot-v1.0.0#b520b749eb90df15177144dbece3fbd3622a2b19" diff --git a/parachain/Cargo.toml b/parachain/Cargo.toml index 19cf529a79..8bdc336c87 100644 --- a/parachain/Cargo.toml +++ b/parachain/Cargo.toml @@ -48,6 +48,8 @@ dex-general-rpc-runtime-api = { path = "../crates/dex-general/rpc/runtime-api" } dex-stable-rpc-runtime-api = { path = "../crates/dex-stable/rpc/runtime-api" } # Substrate dependencies +sc-transaction-pool-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.31" } +sc-offchain = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.31" } sc-cli = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.31" } sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.31" } sc-consensus = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.31" } diff --git a/parachain/runtime/interlay/src/lib.rs b/parachain/runtime/interlay/src/lib.rs index c64498a86b..39eec4e133 100644 --- a/parachain/runtime/interlay/src/lib.rs +++ b/parachain/runtime/interlay/src/lib.rs @@ -1212,13 +1212,13 @@ construct_runtime! { Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent} = 1, Sudo: pallet_sudo::{Pallet, Call, Storage, Config, Event} = 2, Utility: pallet_utility::{Pallet, Call, Event} = 3, - TransactionPayment: pallet_transaction_payment::{Pallet, Storage, Config, Event} = 4, + TransactionPayment: pallet_transaction_payment::{Pallet, Storage, Event} = 4, Scheduler: pallet_scheduler::{Pallet, Call, Storage, Event} = 5, Preimage: pallet_preimage::{Pallet, Call, Storage, Event} = 6, Multisig: pallet_multisig::{Pallet, Call, Storage, Event} = 7, Identity: pallet_identity::{Pallet, Call, Storage, Event} = 8, Proxy: pallet_proxy::{Pallet, Call, Storage, Event} = 9, - TxPause: tx_pause::{Pallet, Call, Config, Storage, Event} = 10, + TxPause: tx_pause::{Pallet, Call, Storage, Event} = 10, // # Tokens & Balances Currency: currency::{Pallet} = 20, @@ -1272,7 +1272,7 @@ construct_runtime! { // # XCM Helpers XcmpQueue: cumulus_pallet_xcmp_queue::{Pallet, Call, Storage, Event} = 90, - PolkadotXcm: pallet_xcm::{Pallet, Call, Storage, Event, Origin} = 91, + PolkadotXcm: pallet_xcm::{Pallet, Call, Storage, Event, Origin, Config} = 91, CumulusXcm: cumulus_pallet_xcm::{Pallet, Call, Event, Origin} = 92, DmpQueue: cumulus_pallet_dmp_queue::{Pallet, Call, Storage, Event} = 93, diff --git a/parachain/runtime/kintsugi/src/lib.rs b/parachain/runtime/kintsugi/src/lib.rs index b15cb86159..1dfe7151e9 100644 --- a/parachain/runtime/kintsugi/src/lib.rs +++ b/parachain/runtime/kintsugi/src/lib.rs @@ -1211,14 +1211,14 @@ construct_runtime! { System: frame_system::{Pallet, Call, Config, Storage, Event} = 0, Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent} = 1, Utility: pallet_utility::{Pallet, Call, Event} = 2, - TransactionPayment: pallet_transaction_payment::{Pallet, Storage, Config, Event} = 3, + TransactionPayment: pallet_transaction_payment::{Pallet, Storage, Event} = 3, Scheduler: pallet_scheduler::{Pallet, Call, Storage, Event} = 4, Preimage: pallet_preimage::{Pallet, Call, Storage, Event} = 5, Multisig: pallet_multisig::{Pallet, Call, Storage, Event} = 6, Identity: pallet_identity::{Pallet, Call, Storage, Event} = 7, Proxy: pallet_proxy::{Pallet, Call, Storage, Event} = 8, Sudo: pallet_sudo::{Pallet, Call, Storage, Config, Event} = 9, - TxPause: tx_pause::{Pallet, Call, Storage, Config, Event} = 10, + TxPause: tx_pause::{Pallet, Call, Storage, Event} = 10, // # Tokens & Balances Currency: currency::{Pallet} = 20, @@ -1273,7 +1273,7 @@ construct_runtime! { // # XCM helpers. XcmpQueue: cumulus_pallet_xcmp_queue::{Pallet, Call, Storage, Event} = 90, - PolkadotXcm: pallet_xcm::{Pallet, Call, Storage, Event, Origin} = 91, + PolkadotXcm: pallet_xcm::{Pallet, Call, Storage, Event, Origin, Config} = 91, CumulusXcm: cumulus_pallet_xcm::{Pallet, Call, Event, Origin} = 92, DmpQueue: cumulus_pallet_dmp_queue::{Pallet, Call, Storage, Event} = 93, diff --git a/parachain/src/chain_spec/interlay.rs b/parachain/src/chain_spec/interlay.rs index dbc72c474c..9b8f760de5 100644 --- a/parachain/src/chain_spec/interlay.rs +++ b/parachain/src/chain_spec/interlay.rs @@ -174,12 +174,16 @@ pub fn interlay_genesis( ); interlay_runtime::RuntimeGenesisConfig { system: interlay_runtime::SystemConfig { + _config: Default::default(), code: interlay_runtime::WASM_BINARY .expect("WASM binary was not build, please build it!") .to_vec(), }, parachain_system: Default::default(), - parachain_info: interlay_runtime::ParachainInfoConfig { parachain_id: id }, + parachain_info: interlay_runtime::ParachainInfoConfig { + _config: Default::default(), + parachain_id: id, + }, collator_selection: interlay_runtime::CollatorSelectionConfig { invulnerables: invulnerables.iter().cloned().map(|(acc, _)| acc).collect(), candidacy_bond: Zero::zero(), @@ -262,6 +266,7 @@ pub fn interlay_genesis( replace_griefing_collateral: FixedU128::checked_from_rational(1, 10).unwrap(), // 10% }, nomination: interlay_runtime::NominationConfig { + _marker: Default::default(), is_nomination_enabled: false, }, technical_committee: Default::default(), @@ -274,16 +279,19 @@ pub fn interlay_genesis( inflation: FixedU128::checked_from_rational(2, 100).unwrap(), // 2% }, polkadot_xcm: interlay_runtime::PolkadotXcmConfig { + _config: Default::default(), safe_xcm_version: Some(3), }, sudo: interlay_runtime::SudoConfig { key: root_key }, loans: interlay_runtime::LoansConfig { + _marker: Default::default(), max_exchange_rate: Rate::from_inner(loans::DEFAULT_MAX_EXCHANGE_RATE), min_exchange_rate: Rate::from_inner(loans::DEFAULT_MIN_EXCHANGE_RATE), }, base_fee: Default::default(), ethereum: Default::default(), evm: kintsugi_runtime::EVMConfig { + _marker: Default::default(), // we need _some_ code inserted at the precompile address so that // the evm will actually call the address. accounts: interlay_runtime::evm::Precompiles::used_addresses() @@ -302,6 +310,7 @@ pub fn interlay_genesis( .collect(), }, evm_chain_id: kintsugi_runtime::EVMChainIdConfig { + _marker: Default::default(), chain_id: chain_id.into(), }, } diff --git a/parachain/src/chain_spec/kintsugi.rs b/parachain/src/chain_spec/kintsugi.rs index b439a12743..029d959ef9 100644 --- a/parachain/src/chain_spec/kintsugi.rs +++ b/parachain/src/chain_spec/kintsugi.rs @@ -178,12 +178,16 @@ pub fn kintsugi_genesis( ); kintsugi_runtime::RuntimeGenesisConfig { system: kintsugi_runtime::SystemConfig { + _config: Default::default(), code: kintsugi_runtime::WASM_BINARY .expect("WASM binary was not build, please build it!") .to_vec(), }, parachain_system: Default::default(), - parachain_info: kintsugi_runtime::ParachainInfoConfig { parachain_id: id }, + parachain_info: kintsugi_runtime::ParachainInfoConfig { + _config: Default::default(), + parachain_id: id, + }, collator_selection: kintsugi_runtime::CollatorSelectionConfig { invulnerables: invulnerables.iter().cloned().map(|(acc, _)| acc).collect(), candidacy_bond: Zero::zero(), @@ -290,6 +294,7 @@ pub fn kintsugi_genesis( replace_griefing_collateral: FixedU128::checked_from_rational(1, 10).unwrap(), // 10% }, nomination: kintsugi_runtime::NominationConfig { + _marker: Default::default(), is_nomination_enabled: false, }, technical_committee: Default::default(), @@ -302,16 +307,19 @@ pub fn kintsugi_genesis( inflation: FixedU128::checked_from_rational(2, 100).unwrap(), // 2% }, polkadot_xcm: kintsugi_runtime::PolkadotXcmConfig { + _config: Default::default(), safe_xcm_version: Some(3), }, sudo: kintsugi_runtime::SudoConfig { key: root_key }, loans: kintsugi_runtime::LoansConfig { + _marker: Default::default(), max_exchange_rate: Rate::from_inner(loans::DEFAULT_MAX_EXCHANGE_RATE), min_exchange_rate: Rate::from_inner(loans::DEFAULT_MIN_EXCHANGE_RATE), }, base_fee: Default::default(), ethereum: Default::default(), evm: kintsugi_runtime::EVMConfig { + _marker: Default::default(), // we need _some_ code inserted at the precompile address so that // the evm will actually call the address. accounts: kintsugi_runtime::evm::Precompiles::used_addresses() @@ -330,6 +338,7 @@ pub fn kintsugi_genesis( .collect(), }, evm_chain_id: kintsugi_runtime::EVMChainIdConfig { + _marker: Default::default(), chain_id: chain_id.into(), }, } diff --git a/parachain/src/service.rs b/parachain/src/service.rs index 17a6233137..61025311bc 100644 --- a/parachain/src/service.rs +++ b/parachain/src/service.rs @@ -13,13 +13,14 @@ use cumulus_relay_chain_minimal_node::build_minimal_relay_chain_node; use futures::StreamExt; use polkadot_service::CollatorPair; use primitives::*; -use sc_client_api::{HeaderBackend, StateBackendFor}; +use sc_client_api::{Backend, HeaderBackend, StateBackendFor}; use sc_consensus::{ImportQueue, LongestChain}; use sc_executor::{HeapAllocStrategy, NativeElseWasmExecutor, WasmExecutor, DEFAULT_HEAP_ALLOC_STRATEGY}; use sc_network::NetworkBlock; use sc_network_sync::SyncingService; use sc_service::{Configuration, PartialComponents, RpcHandlers, TFullBackend, TFullClient, TaskManager}; use sc_telemetry::{Telemetry, TelemetryHandle, TelemetryWorker, TelemetryWorkerHandle}; +use sc_transaction_pool_api::OffchainTransactionPoolFactory; use sp_api::ConstructRuntimeApi; use sp_consensus_aura::{ sr25519::{AuthorityId as AuraId, AuthorityPair as AuraPair}, @@ -488,11 +489,23 @@ where }; if parachain_config.offchain_worker.enabled { - sc_service::build_offchain_workers( - ¶chain_config, - task_manager.spawn_handle(), - client.clone(), - network.clone(), + use futures::FutureExt; + + task_manager.spawn_handle().spawn( + "offchain-workers-runner", + "offchain-work", + sc_offchain::OffchainWorkers::new(sc_offchain::OffchainWorkerOptions { + runtime_api_provider: client.clone(), + keystore: Some(params.keystore_container.keystore()), + offchain_db: backend.offchain_storage(), + transaction_pool: Some(OffchainTransactionPoolFactory::new(transaction_pool.clone())), + network_provider: network.clone(), + is_validator: parachain_config.role.is_authority(), + enable_http_requests: false, + custom_extensions: move |_| vec![], + }) + .run(client.clone(), task_manager.spawn_handle()) + .boxed(), ); }; @@ -723,7 +736,24 @@ where })?; if config.offchain_worker.enabled { - sc_service::build_offchain_workers(&config, task_manager.spawn_handle(), client.clone(), network.clone()); + use futures::FutureExt; + + task_manager.spawn_handle().spawn( + "offchain-workers-runner", + "offchain-work", + sc_offchain::OffchainWorkers::new(sc_offchain::OffchainWorkerOptions { + runtime_api_provider: client.clone(), + keystore: None, + offchain_db: backend.offchain_storage(), + transaction_pool: Some(OffchainTransactionPoolFactory::new(transaction_pool.clone())), + network_provider: network.clone(), + is_validator: config.role.is_authority(), + enable_http_requests: false, + custom_extensions: move |_| vec![], + }) + .run(client.clone(), task_manager.spawn_handle()) + .boxed(), + ); }; let prometheus_registry = config.prometheus_registry().cloned();