Skip to content

Commit

Permalink
Feat/polkadot v0.9.43 uplift (#978)
Browse files Browse the repository at this point in the history
* Init dep bump

* Progress

* Progress 2

* Progress 3

* Progress 4

* Progress 5

* Checkpoint

* Progress 6

* Tracing

* Compile & tests should work

* Integration tests

* contract migrations

* precompiles

* Fixed precompiles

* toml format

* XCM origin derivation change

* Xcm tools adapt

* Some fixes

* Adapt for weightv2

* Small updates

* Update contracts

* Update contracts

* Deps fix

* Address PR comments

* Update weights

* license

* Fix

* Adapt xcm tools

* Bump versions

* Small changes

* PR comments
  • Loading branch information
Dinonard committed Jul 26, 2023
1 parent c80457b commit b83fea8
Show file tree
Hide file tree
Showing 75 changed files with 3,203 additions and 1,816 deletions.
2,062 changes: 1,216 additions & 846 deletions Cargo.lock

Large diffs are not rendered by default.

296 changes: 148 additions & 148 deletions Cargo.toml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion bin/collator/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "astar-collator"
version = "5.13.0"
version = "5.15.0"
description = "Astar collator implementation in Rust."
build = "build.rs"
default-run = "astar-collator"
Expand Down
9 changes: 3 additions & 6 deletions bin/collator/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,14 +130,11 @@ impl RelayChainCli {
) -> Self {
let extension = crate::parachain::chain_spec::Extensions::try_get(&*para_config.chain_spec);
let chain_id = extension.map(|e| e.relay_chain.clone());
let base_path = para_config
.base_path
.as_ref()
.map(|x| x.path().join("polkadot"));
let base_path = para_config.base_path.path().join("polkadot");
Self {
base_path,
chain_id,
base: polkadot_cli::RunCmd::parse_from(relay_chain_args),
chain_id,
base_path: Some(base_path),
}
}
}
22 changes: 5 additions & 17 deletions bin/collator/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -962,14 +962,10 @@ impl DefaultConfigurationValues for RelayChainCli {
30334
}

fn rpc_ws_listen_port() -> u16 {
fn rpc_listen_port() -> u16 {
9945
}

fn rpc_http_listen_port() -> u16 {
9934
}

fn prometheus_listen_port() -> u16 {
9616
}
Expand Down Expand Up @@ -999,16 +995,8 @@ impl CliConfiguration<Self> for RelayChainCli {
.or_else(|| self.base_path.clone().map(Into::into)))
}

fn rpc_http(&self, default_listen_port: u16) -> Result<Option<SocketAddr>> {
self.base.base.rpc_http(default_listen_port)
}

fn rpc_ipc(&self) -> Result<Option<String>> {
self.base.base.rpc_ipc()
}

fn rpc_ws(&self, default_listen_port: u16) -> Result<Option<SocketAddr>> {
self.base.base.rpc_ws(default_listen_port)
fn rpc_addr(&self, default_listen_port: u16) -> Result<Option<SocketAddr>> {
self.base.base.rpc_addr(default_listen_port)
}

fn prometheus_config(
Expand Down Expand Up @@ -1060,8 +1048,8 @@ impl CliConfiguration<Self> for RelayChainCli {
self.base.base.rpc_methods()
}

fn rpc_ws_max_connections(&self) -> Result<Option<usize>> {
self.base.base.rpc_ws_max_connections()
fn rpc_max_connections(&self) -> Result<u32> {
self.base.base.rpc_max_connections()
}

fn rpc_cors(&self, is_dev: bool) -> Result<Option<Vec<String>>> {
Expand Down
43 changes: 17 additions & 26 deletions bin/collator/src/local/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,17 +79,11 @@ pub fn new_partial(
>,
sc_consensus_grandpa::LinkHalf<Block, FullClient, FullSelectChain>,
Option<Telemetry>,
Arc<fc_db::Backend<Block>>,
Arc<fc_db::kv::Backend<Block>>,
),
>,
ServiceError,
> {
if config.keystore_remote.is_some() {
return Err(ServiceError::Other(
"Remote Keystores are not supported.".to_string(),
));
}

let telemetry = config
.telemetry_endpoints
.clone()
Expand All @@ -100,12 +94,8 @@ pub fn new_partial(
Ok((worker, telemetry))
})
.transpose()?;
let executor = sc_executor::NativeElseWasmExecutor::<Executor>::new(
config.wasm_method,
config.default_heap_pages,
config.max_runtime_instances,
config.runtime_cache_size,
);

let executor = sc_service::new_native_or_wasm_executor(&config);

let (client, backend, keystore_container, task_manager) =
sc_service::new_full_parts::<Block, RuntimeApi, _>(
Expand Down Expand Up @@ -135,11 +125,8 @@ pub fn new_partial(
telemetry.as_ref().map(|x| x.handle()),
)?;
let frontier_backend = crate::rpc::open_frontier_backend(client.clone(), config)?;
let frontier_block_import = FrontierBlockImport::new(
grandpa_block_import.clone(),
client.clone(),
frontier_backend.clone(),
);
let frontier_block_import =
FrontierBlockImport::new(grandpa_block_import.clone(), client.clone());
let slot_duration = sc_consensus_aura::slot_duration(&*client)?;
let import_queue = sc_consensus_aura::import_queue::<AuraPair, _, _, _, _, _>(
ImportQueueParams {
Expand Down Expand Up @@ -208,10 +195,12 @@ pub fn start_node(
.expect("Genesis block exists; qed"),
&config.chain_spec,
);
let net_config = sc_network::config::FullNetworkConfiguration::new(&config.network);

let (network, system_rpc_tx, tx_handler_controller, network_starter, sync_service) =
sc_service::build_network(sc_service::BuildNetworkParams {
config: &config,
net_config,
client: client.clone(),
transaction_pool: transaction_pool.clone(),
spawn_handle: task_manager.spawn_handle(),
Expand Down Expand Up @@ -268,7 +257,7 @@ pub fn start_node(
task_manager.spawn_essential_handle().spawn(
"frontier-mapping-sync-worker",
Some("frontier"),
fc_mapping_sync::MappingSyncWorker::new(
fc_mapping_sync::kv::MappingSyncWorker::new(
client.import_notification_stream(),
Duration::new(6, 0),
client.clone(),
Expand Down Expand Up @@ -368,7 +357,7 @@ pub fn start_node(
let _rpc_handlers = sc_service::spawn_tasks(sc_service::SpawnTasksParams {
network: network.clone(),
client: client.clone(),
keystore: keystore_container.sync_keystore(),
keystore: keystore_container.keystore(),
task_manager: &mut task_manager,
transaction_pool: transaction_pool.clone(),
rpc_builder: rpc_extensions_builder,
Expand Down Expand Up @@ -411,7 +400,7 @@ pub fn start_node(
},
force_authoring,
backoff_authoring_blocks,
keystore: keystore_container.sync_keystore(),
keystore: keystore_container.keystore(),
sync_oracle: sync_service.clone(),
justification_sync_link: sync_service.clone(),
block_proposal_slot_portion: SlotProportion::new(2f32 / 3f32),
Expand All @@ -431,7 +420,7 @@ pub fn start_node(
// if the node isn't actively participating in consensus then it doesn't
// need a keystore, regardless of which protocol we use below.
let keystore = if role.is_authority() {
Some(keystore_container.sync_keystore())
Some(keystore_container.keystore())
} else {
None
};
Expand Down Expand Up @@ -501,10 +490,12 @@ pub fn start_node(config: Configuration) -> Result<TaskManager, ServiceError> {
.expect("Genesis block exists; qed"),
&config.chain_spec,
);
let net_config = sc_network::config::FullNetworkConfiguration::new(&config.network);

let (network, system_rpc_tx, tx_handler_controller, network_starter, sync_service) =
sc_service::build_network(sc_service::BuildNetworkParams {
config: &config,
net_config,
client: client.clone(),
transaction_pool: transaction_pool.clone(),
spawn_handle: task_manager.spawn_handle(),
Expand Down Expand Up @@ -540,7 +531,7 @@ pub fn start_node(config: Configuration) -> Result<TaskManager, ServiceError> {
task_manager.spawn_essential_handle().spawn(
"frontier-mapping-sync-worker",
Some("frontier"),
fc_mapping_sync::MappingSyncWorker::new(
fc_mapping_sync::kv::MappingSyncWorker::new(
client.import_notification_stream(),
Duration::new(6, 0),
client.clone(),
Expand Down Expand Up @@ -630,7 +621,7 @@ pub fn start_node(config: Configuration) -> Result<TaskManager, ServiceError> {
let _rpc_handlers = sc_service::spawn_tasks(sc_service::SpawnTasksParams {
network: network.clone(),
client: client.clone(),
keystore: keystore_container.sync_keystore(),
keystore: keystore_container.keystore(),
task_manager: &mut task_manager,
transaction_pool: transaction_pool.clone(),
rpc_builder: rpc_extensions_builder,
Expand Down Expand Up @@ -673,7 +664,7 @@ pub fn start_node(config: Configuration) -> Result<TaskManager, ServiceError> {
},
force_authoring,
backoff_authoring_blocks,
keystore: keystore_container.sync_keystore(),
keystore: keystore_container.keystore(),
sync_oracle: sync_service.clone(),
justification_sync_link: sync_service.clone(),
block_proposal_slot_portion: SlotProportion::new(2f32 / 3f32),
Expand All @@ -693,7 +684,7 @@ pub fn start_node(config: Configuration) -> Result<TaskManager, ServiceError> {
// if the node isn't actively participating in consensus then it doesn't
// need a keystore, regardless of which protocol we use below.
let keystore = if role.is_authority() {
Some(keystore_container.sync_keystore())
Some(keystore_container.keystore())
} else {
None
};
Expand Down
42 changes: 22 additions & 20 deletions bin/collator/src/parachain/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ use sc_service::{Configuration, PartialComponents, TFullBackend, TFullClient, Ta
use sc_telemetry::{Telemetry, TelemetryHandle, TelemetryWorker, TelemetryWorkerHandle};
use sp_api::ConstructRuntimeApi;
use sp_consensus_aura::sr25519::AuthorityId as AuraId;
use sp_keystore::SyncCryptoStorePtr;
use sp_keystore::KeystorePtr;
use sp_runtime::traits::BlakeTwo256;
use sp_runtime::Percent;
use std::{collections::BTreeMap, sync::Arc, time::Duration};
Expand Down Expand Up @@ -155,7 +155,7 @@ pub fn new_partial<RuntimeApi, Executor, BIQ>(
>,
Option<Telemetry>,
Option<TelemetryWorkerHandle>,
Arc<fc_db::Backend<Block>>,
Arc<fc_db::kv::Backend<Block>>,
),
>,
sc_service::Error,
Expand Down Expand Up @@ -209,12 +209,7 @@ where
})
.transpose()?;

let executor = sc_executor::NativeElseWasmExecutor::<Executor>::new(
config.wasm_method,
config.default_heap_pages,
config.max_runtime_instances,
config.runtime_cache_size,
);
let executor = sc_service::new_native_or_wasm_executor(&config);

let (client, backend, keystore_container, task_manager) =
sc_service::new_full_parts::<Block, RuntimeApi, _>(
Expand Down Expand Up @@ -242,8 +237,7 @@ where
);

let frontier_backend = crate::rpc::open_frontier_backend(client.clone(), config)?;
let frontier_block_import =
FrontierBlockImport::new(client.clone(), client.clone(), frontier_backend.clone());
let frontier_block_import = FrontierBlockImport::new(client.clone(), client.clone());

let parachain_block_import: ParachainBlockImport<_, _, _> =
ParachainBlockImport::new(frontier_block_import, backend.clone());
Expand Down Expand Up @@ -382,7 +376,7 @@ where
>,
>,
Arc<SyncingService<Block>>,
SyncCryptoStorePtr,
KeystorePtr,
bool,
) -> Result<Box<dyn ParachainConsensus<Block>>, sc_service::Error>,
{
Expand All @@ -391,6 +385,7 @@ where
let params = new_partial::<RuntimeApi, Executor, BIQ>(&parachain_config, build_import_queue)?;
let (parachain_block_import, mut telemetry, telemetry_worker_handle, frontier_backend) =
params.other;
let net_config = sc_network::config::FullNetworkConfiguration::new(&parachain_config.network);

let client = params.client.clone();
let backend = params.backend.clone();
Expand All @@ -414,6 +409,7 @@ where
let (network, system_rpc_tx, tx_handler_controller, start_network, sync_service) =
cumulus_client_service::build_network(BuildNetworkParams {
parachain_config: &parachain_config,
net_config,
para_id: id,
client: client.clone(),
transaction_pool: transaction_pool.clone(),
Expand Down Expand Up @@ -441,7 +437,7 @@ where
task_manager.spawn_essential_handle().spawn(
"frontier-mapping-sync-worker",
Some("frontier"),
fc_mapping_sync::MappingSyncWorker::new(
fc_mapping_sync::kv::MappingSyncWorker::new(
client.import_notification_stream(),
Duration::new(6, 0),
client.clone(),
Expand Down Expand Up @@ -527,7 +523,7 @@ where
transaction_pool: transaction_pool.clone(),
task_manager: &mut task_manager,
config: parachain_config,
keystore: params.keystore_container.sync_keystore(),
keystore: params.keystore_container.keystore(),
backend: backend.clone(),
network: network.clone(),
system_rpc_tx,
Expand Down Expand Up @@ -556,8 +552,8 @@ where
&task_manager,
relay_chain_interface.clone(),
transaction_pool,
sync_service,
params.keystore_container.sync_keystore(),
sync_service.clone(),
params.keystore_container.keystore(),
force_authoring,
)?;

Expand All @@ -576,6 +572,7 @@ where
collator_key: collator_key.expect("Command line arguments do not allow this. qed"),
relay_chain_slot_duration,
recovery_handle: Box::new(overseer_handle),
sync_service,
};

start_collator(params).await?;
Expand All @@ -589,6 +586,7 @@ where
relay_chain_slot_duration,
import_queue: import_queue_service,
recovery_handle: Box::new(overseer_handle),
sync_service,
};

start_full_node(params)?;
Expand Down Expand Up @@ -698,7 +696,7 @@ where
>,
>,
Arc<SyncingService<Block>>,
SyncCryptoStorePtr,
KeystorePtr,
bool,
) -> Result<Box<dyn ParachainConsensus<Block>>, sc_service::Error>,
{
Expand All @@ -707,6 +705,7 @@ where
let params = new_partial::<RuntimeApi, Executor, BIQ>(&parachain_config, build_import_queue)?;
let (parachain_block_import, mut telemetry, telemetry_worker_handle, frontier_backend) =
params.other;
let net_config = sc_network::config::FullNetworkConfiguration::new(&parachain_config.network);

let client = params.client.clone();
let backend = params.backend.clone();
Expand All @@ -730,6 +729,7 @@ where
let (network, system_rpc_tx, tx_handler_controller, start_network, sync_service) =
cumulus_client_service::build_network(BuildNetworkParams {
parachain_config: &parachain_config,
net_config,
para_id: id,
client: client.clone(),
transaction_pool: transaction_pool.clone(),
Expand Down Expand Up @@ -778,7 +778,7 @@ where
task_manager.spawn_essential_handle().spawn(
"frontier-mapping-sync-worker",
Some("frontier"),
fc_mapping_sync::MappingSyncWorker::new(
fc_mapping_sync::kv::MappingSyncWorker::new(
client.import_notification_stream(),
Duration::new(6, 0),
client.clone(),
Expand Down Expand Up @@ -874,7 +874,7 @@ where
transaction_pool: transaction_pool.clone(),
task_manager: &mut task_manager,
config: parachain_config,
keystore: params.keystore_container.sync_keystore(),
keystore: params.keystore_container.keystore(),
backend: backend.clone(),
network: network.clone(),
system_rpc_tx,
Expand Down Expand Up @@ -903,8 +903,8 @@ where
&task_manager,
relay_chain_interface.clone(),
transaction_pool,
sync_service,
params.keystore_container.sync_keystore(),
sync_service.clone(),
params.keystore_container.keystore(),
force_authoring,
)?;

Expand All @@ -923,6 +923,7 @@ where
collator_key: collator_key.expect("Command line arguments do not allow this. qed"),
relay_chain_slot_duration,
recovery_handle: Box::new(overseer_handle),
sync_service,
};

start_collator(params).await?;
Expand All @@ -936,6 +937,7 @@ where
relay_chain_slot_duration,
import_queue: import_queue_service,
recovery_handle: Box::new(overseer_handle),
sync_service,
};

start_full_node(params)?;
Expand Down
Loading

0 comments on commit b83fea8

Please sign in to comment.