Skip to content

Commit

Permalink
Merge pull request #259 from paritytech/polkadot-stable2412
Browse files Browse the repository at this point in the history
Polkadot stable2412
  • Loading branch information
Moliholy authored Jan 16, 2025
2 parents e6bf30d + effd8e7 commit b8e0174
Show file tree
Hide file tree
Showing 65 changed files with 4,140 additions and 3,277 deletions.
3,676 changes: 2,510 additions & 1,166 deletions Cargo.lock

Large diffs are not rendered by default.

199 changes: 98 additions & 101 deletions Cargo.toml

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ hex-literal = { workspace = true }
testnet-runtime = { workspace = true }
mainnet-runtime = { workspace = true }
runtime-common = { workspace = true }
custom-pool = { workspace = true }

# Substrate
frame-benchmarking = { workspace = true }
Expand Down
4 changes: 2 additions & 2 deletions node/src/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ pub mod testnet {
.into_iter()
.map(|(acc, aura)| {
(
acc.clone(), // account id
acc, // account id
acc, // validator id
testnet_session_keys(aura), // session keys
)
Expand Down Expand Up @@ -393,7 +393,7 @@ pub mod mainnet {
.into_iter()
.map(|(acc, aura)| {
(
acc.clone(), // account id
acc, // account id
acc, // validator id
mainnet_session_keys(aura), // session keys
)
Expand Down
26 changes: 12 additions & 14 deletions node/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,19 +171,19 @@ macro_rules! construct_async_run {
match runner.config().chain_spec.runtime() {
Runtime::Testnet | Runtime::Default => {
runner.async_run(|$config| {
let $components = new_partial::<testnet_runtime::RuntimeApi, TestnetRuntimeExecutor, _>(
let $components = new_partial::<testnet_runtime::RuntimeApi, _>(
&$config,
crate::service::build_import_queue::<testnet_runtime::RuntimeApi, TestnetRuntimeExecutor>,
crate::service::build_import_queue::<testnet_runtime::RuntimeApi>,
)?;
let task_manager = $components.task_manager;
{ $( $code )* }.map(|v| (v, task_manager))
})
}
Runtime::Mainnet => {
runner.async_run(|$config| {
let $components = new_partial::<mainnet_runtime::RuntimeApi, MainnetRuntimeExecutor, _>(
let $components = new_partial::<mainnet_runtime::RuntimeApi, _>(
&$config,
crate::service::build_import_queue::<mainnet_runtime::RuntimeApi, MainnetRuntimeExecutor>,
crate::service::build_import_queue::<mainnet_runtime::RuntimeApi>,
)?;
let task_manager = $components.task_manager;
{ $( $code )* }.map(|v| (v, task_manager))
Expand All @@ -197,19 +197,17 @@ macro_rules! construct_benchmark_partials {
($config:expr, |$partials:ident| $code:expr) => {
match $config.chain_spec.runtime() {
Runtime::Testnet | Runtime::Default => {
let $partials =
new_partial::<testnet_runtime::RuntimeApi, TestnetRuntimeExecutor, _>(
&$config,
crate::service::build_import_queue::<_, TestnetRuntimeExecutor>,
)?;
let $partials = new_partial::<testnet_runtime::RuntimeApi, _>(
&$config,
crate::service::build_import_queue::<_>,
)?;
$code
},
Runtime::Mainnet => {
let $partials =
new_partial::<mainnet_runtime::RuntimeApi, MainnetRuntimeExecutor, _>(
&$config,
crate::service::build_import_queue::<_, MainnetRuntimeExecutor>,
)?;
let $partials = new_partial::<mainnet_runtime::RuntimeApi, _>(
&$config,
crate::service::build_import_queue::<_>,
)?;
$code
},
}
Expand Down
51 changes: 27 additions & 24 deletions node/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ type ParachainBlockImport<RuntimeApi> =
/// Use this macro if you don't actually need the full service, but just the builder in order to
/// be able to perform chain operations.
#[allow(clippy::type_complexity)]
pub fn new_partial<RuntimeApi, Executor, BIQ>(
pub fn new_partial<RuntimeApi, BIQ>(
config: &Configuration,
build_import_queue: BIQ,
) -> Result<
Expand All @@ -101,7 +101,7 @@ pub fn new_partial<RuntimeApi, Executor, BIQ>(
ParachainBackend,
(),
sc_consensus::DefaultImportQueue<Block>,
sc_transaction_pool::FullPool<Block, ParachainClient<RuntimeApi>>,
sc_transaction_pool::TransactionPoolHandle<Block, ParachainClient<RuntimeApi>>,
(ParachainBlockImport<RuntimeApi>, Option<Telemetry>, Option<TelemetryWorkerHandle>),
>,
sc_service::Error,
Expand All @@ -117,7 +117,6 @@ where
+ sp_block_builder::BlockBuilder<Block>,
sc_client_api::StateBackendFor<TFullBackend<Block>, Block>:
sc_client_api::StateBackend<BlakeTwo256>,
Executor: NativeExecutionDispatch + 'static,
BIQ: FnOnce(
Arc<ParachainClient<RuntimeApi>>,
ParachainBlockImport<RuntimeApi>,
Expand Down Expand Up @@ -166,12 +165,15 @@ where
telemetry
});

let transaction_pool = sc_transaction_pool::BasicPool::new_full(
config.transaction_pool.clone(),
config.role.is_authority().into(),
config.prometheus_registry(),
task_manager.spawn_essential_handle(),
client.clone(),
let transaction_pool = Arc::from(
sc_transaction_pool::Builder::new(
task_manager.spawn_essential_handle(),
client.clone(),
config.role.is_authority().into(),
)
.with_options(config.transaction_pool.clone())
.with_prometheus(config.prometheus_registry())
.build(),
);

let block_import = ParachainBlockImport::<RuntimeApi>::new(client.clone(), backend.clone());
Expand Down Expand Up @@ -244,7 +246,7 @@ where
Option<TelemetryHandle>,
&TaskManager,
Arc<dyn RelayChainInterface>,
Arc<sc_transaction_pool::FullPool<Block, ParachainClient<RuntimeApi>>>,
Arc<sc_transaction_pool::TransactionPoolHandle<Block, ParachainClient<RuntimeApi>>>,
KeystorePtr,
Duration,
ParaId,
Expand All @@ -256,7 +258,7 @@ where
{
let parachain_config = prepare_node_config(parachain_config);

let params = new_partial::<RuntimeApi, Executor, BIQ>(&parachain_config, build_import_queue)?;
let params = new_partial::<RuntimeApi, BIQ>(&parachain_config, build_import_queue)?;
let (block_import, mut telemetry, telemetry_worker_handle) = params.other;
let prometheus_registry = parachain_config.prometheus_registry().cloned();
let net_config = sc_network::config::FullNetworkConfiguration::<_, _, Net>::new(
Expand Down Expand Up @@ -301,9 +303,7 @@ where
if parachain_config.offchain_worker.enabled {
use futures::FutureExt;

task_manager.spawn_handle().spawn(
"offchain-workers-runner",
"offchain-work",
let offchain_workers =
sc_offchain::OffchainWorkers::new(sc_offchain::OffchainWorkerOptions {
runtime_api_provider: client.clone(),
keystore: Some(params.keystore_container.keystore()),
Expand All @@ -315,9 +315,11 @@ where
is_validator: parachain_config.role.is_authority(),
enable_http_requests: false,
custom_extensions: move |_| vec![],
})
.run(client.clone(), task_manager.spawn_handle())
.boxed(),
})?;
task_manager.spawn_handle().spawn(
"offchain-workers-runner",
"offchain-work",
offchain_workers.run(client.clone(), task_manager.spawn_handle()).boxed(),
);
}

Expand Down Expand Up @@ -427,7 +429,7 @@ where

/// Build the import queue for the parachain runtime.
#[allow(clippy::type_complexity)]
pub(crate) fn build_import_queue<RuntimeApi, Executor: NativeExecutionDispatch + 'static>(
pub(crate) fn build_import_queue<RuntimeApi>(
client: Arc<ParachainClient<RuntimeApi>>,
block_import: ParachainBlockImport<RuntimeApi>,
config: &Configuration,
Expand Down Expand Up @@ -466,15 +468,17 @@ where
}

#[allow(clippy::too_many_arguments)]
fn start_consensus<RuntimeApi, Executor>(
fn start_consensus<RuntimeApi>(
client: Arc<ParachainClient<RuntimeApi>>,
backend: Arc<ParachainBackend>,
block_import: ParachainBlockImport<RuntimeApi>,
prometheus_registry: Option<&Registry>,
telemetry: Option<TelemetryHandle>,
task_manager: &TaskManager,
relay_chain_interface: Arc<dyn RelayChainInterface>,
transaction_pool: Arc<sc_transaction_pool::FullPool<Block, ParachainClient<RuntimeApi>>>,
transaction_pool: Arc<
sc_transaction_pool::TransactionPoolHandle<Block, ParachainClient<RuntimeApi>>,
>,
keystore: KeystorePtr,
relay_chain_slot_duration: Duration,
para_id: ParaId,
Expand All @@ -495,7 +499,6 @@ where
+ cumulus_primitives_core::CollectCollationInfo<Block>
+ pallet_transaction_payment_rpc::TransactionPaymentRuntimeApi<Block, Balance>
+ substrate_frame_rpc_system::AccountNonceApi<Block, AccountId, Nonce>,
Executor: NativeExecutionDispatch + 'static,
{
// NOTE: because we use Aura here explicitly, we can use `CollatorSybilResistance::Resistant`
// when starting the network.
Expand All @@ -504,7 +507,7 @@ where
let proposer_factory = sc_basic_authorship::ProposerFactory::with_proof_recording(
task_manager.spawn_handle(),
client.clone(),
Arc::new(custom_pool::CustomPool::new(transaction_pool)),
transaction_pool,
prometheus_registry,
telemetry.clone(),
);
Expand Down Expand Up @@ -574,8 +577,8 @@ where
polkadot_config,
collator_options,
para_id,
build_import_queue::<RuntimeApi, Executor>,
start_consensus::<RuntimeApi, Executor>,
build_import_queue::<RuntimeApi>,
start_consensus::<RuntimeApi>,
hwbench,
)
.await
Expand Down
1 change: 1 addition & 0 deletions pallets/dmarket/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ impl pallet_balances::Config for Test {
type RuntimeFreezeReason = ();
type FreezeIdentifier = ();
type MaxFreezes = ();
type DoneSlashHandler = ();
}

impl pallet_timestamp::Config for Test {
Expand Down
1 change: 1 addition & 0 deletions pallets/marketplace/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ impl pallet_balances::Config for Test {
type RuntimeFreezeReason = ();
type FreezeIdentifier = ();
type MaxFreezes = ();
type DoneSlashHandler = ();
}

impl pallet_timestamp::Config for Test {
Expand Down
4 changes: 2 additions & 2 deletions pallets/multibatching/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ pub mod pallet {
#[pallet::weight({
let dispatch_infos = calls.iter().map(|call| call.call.get_dispatch_info()).collect::<Vec<_>>();
let dispatch_weight = dispatch_infos.iter()
.map(|di| di.weight)
.map(|di| di.call_weight)
.fold(Weight::zero(), |total: Weight, weight: Weight| total.saturating_add(weight))
.saturating_add(<T as Config>::WeightInfo::batch(calls.len() as u32, approvals.len() as u32));
let dispatch_class = {
Expand Down Expand Up @@ -327,7 +327,7 @@ pub mod pallet {
#[pallet::weight({
let dispatch_infos = calls.iter().map(|call| call.call.get_dispatch_info()).collect::<Vec<_>>();
let dispatch_weight = dispatch_infos.iter()
.map(|di| di.weight)
.map(|di| di.call_weight)
.fold(Weight::zero(), |total: Weight, weight: Weight| total.saturating_add(weight))
.saturating_add(<T as Config>::WeightInfo::batch_v2(calls.len() as u32, approvals.len() as u32));
let dispatch_class = {
Expand Down
2 changes: 1 addition & 1 deletion pallets/myth-proxy/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ pub mod pallet {
#[pallet::call_index(1)]
#[pallet::weight({
let di = call.get_dispatch_info();
T::WeightInfo::proxy().saturating_add(di.weight)
T::WeightInfo::proxy().saturating_add(di.call_weight)
})]
pub fn proxy(
origin: OriginFor<T>,
Expand Down
2 changes: 1 addition & 1 deletion pallets/myth-proxy/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ macro_rules! assert_proxy_error {
DispatchErrorWithPostInfo {
error: $expected_error.into(),
post_info: PostDispatchInfo {
actual_weight: Some(info.weight),
actual_weight: Some(info.call_weight),
pays_fee: Pays::Yes
},
}
Expand Down
1 change: 1 addition & 0 deletions pallets/nfts/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ impl pallet_balances::Config for Test {
type MaxFreezes = ();
type RuntimeHoldReason = ();
type RuntimeFreezeReason = ();
type DoneSlashHandler = ();
}

parameter_types! {
Expand Down
1 change: 1 addition & 0 deletions primitives/account/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ use sp_core::{ecdsa, H160};

pub use serde::{de::DeserializeOwned, Deserialize, Serialize};
use sp_core::crypto::AccountId32;
#[cfg(feature = "std")]
use sp_io::hashing::keccak_256;
use sp_runtime::MultiSignature;

Expand Down
19 changes: 0 additions & 19 deletions primitives/custom-pool/Cargo.toml

This file was deleted.

Loading

0 comments on commit b8e0174

Please sign in to comment.