git.delta.rocks / unique-network / refs/commits / 6f7886be8aab

difftreelog

fix make node build on 0.9.42

Yaroslav Bolyukin2023-05-22parent: #cbbf2e9.patch.diff
in: master

6 files changed

modifiedclient/rpc/src/pov_estimate.rsdiffbeforeafterboth
--- a/client/rpc/src/pov_estimate.rs
+++ b/client/rpc/src/pov_estimate.rs
@@ -213,12 +213,7 @@
 
 	let pre_root = *backend.root();
 
-	let executor = NativeElseWasmExecutor::<D>::new(
-		exec_params.wasm_method,
-		exec_params.default_heap_pages,
-		exec_params.max_runtime_instances,
-		exec_params.runtime_cache_size,
-	);
+	let executor = sc_service::new_native_or_wasm_executor(exec_params);
 	let execution = ExecutionStrategy::NativeElseWasm;
 
 	let mut results = Vec::new();
modifiednode/cli/Cargo.tomldiffbeforeafterboth
--- a/node/cli/Cargo.toml
+++ b/node/cli/Cargo.toml
@@ -100,30 +100,8 @@
 
 [features]
 default = ["opal-runtime"]
-all-runtimes = [
-	'opal-runtime',
-	'quartz-runtime',
-	'unique-runtime',
-]
-pov-estimate = [
-	'opal-runtime/pov-estimate',
-	'quartz-runtime?/pov-estimate',
-	'uc-rpc/pov-estimate',
-	'unique-rpc/pov-estimate',
-	'unique-runtime?/pov-estimate',
-]
-runtime-benchmarks = [
-	'opal-runtime/runtime-benchmarks',
-	'polkadot-cli/runtime-benchmarks',
-	'polkadot-service/runtime-benchmarks',
-	'quartz-runtime?/runtime-benchmarks',
-	'sc-service/runtime-benchmarks',
-	'unique-runtime?/runtime-benchmarks',
-]
+all-runtimes = ['opal-runtime', 'quartz-runtime', 'unique-runtime']
+pov-estimate = ['opal-runtime/pov-estimate', 'quartz-runtime?/pov-estimate', 'uc-rpc/pov-estimate', 'unique-rpc/pov-estimate', 'unique-runtime?/pov-estimate']
+runtime-benchmarks = ['opal-runtime/runtime-benchmarks', 'polkadot-cli/runtime-benchmarks', 'polkadot-service/runtime-benchmarks', 'quartz-runtime?/runtime-benchmarks', 'sc-service/runtime-benchmarks', 'unique-runtime?/runtime-benchmarks']
 sapphire-runtime = ['quartz-runtime', 'quartz-runtime/become-sapphire']
-try-runtime = [
-	'opal-runtime?/try-runtime',
-	'quartz-runtime?/try-runtime',
-	'try-runtime-cli/try-runtime',
-	'unique-runtime?/try-runtime',
-]
+try-runtime = ['opal-runtime?/try-runtime', 'quartz-runtime?/try-runtime', 'try-runtime-cli/try-runtime', 'unique-runtime?/try-runtime']
modifiednode/cli/src/command.rsdiffbeforeafterboth
--- a/node/cli/src/command.rs
+++ b/node/cli/src/command.rs
@@ -505,7 +505,10 @@
 
 				let para_id = ParaId::from(para_id);
 
-				let parachain_account = AccountIdConversion::<polkadot_primitives::v2::AccountId>::into_account_truncating(&para_id);
+				let parachain_account =
+					AccountIdConversion::<polkadot_primitives::AccountId>::into_account_truncating(
+						&para_id,
+					);
 
 				let state_version =
 					RelayChainCli::native_runtime_version(&config.chain_spec).state_version();
modifiednode/cli/src/service.rsdiffbeforeafterboth
26 stream::select,26 stream::select,
27 task::{Context, Poll},27 task::{Context, Poll},
28};28};
29use sp_keystore::KeystorePtr;
29use tokio::time::Interval;30use tokio::time::Interval;
3031
31use unique_rpc::overrides_handle;32use unique_rpc::overrides_handle;
55use sc_network_sync::SyncingService;56use sc_network_sync::SyncingService;
56use sc_service::{BasePath, Configuration, PartialComponents, TaskManager};57use sc_service::{BasePath, Configuration, PartialComponents, TaskManager};
57use sc_telemetry::{Telemetry, TelemetryHandle, TelemetryWorker, TelemetryWorkerHandle};58use sc_telemetry::{Telemetry, TelemetryHandle, TelemetryWorker, TelemetryWorkerHandle};
58use sp_keystore::SyncCryptoStorePtr;
59use sp_runtime::traits::BlakeTwo256;59use sp_runtime::traits::BlakeTwo256;
60use substrate_prometheus_endpoint::Registry;60use substrate_prometheus_endpoint::Registry;
61use sc_client_api::BlockchainEvents;61use sc_client_api::BlockchainEvents;
270 })270 })
271 .transpose()?;271 .transpose()?;
272272
273 let executor = NativeElseWasmExecutor::<ExecutorDispatch>::new(273 let executor = sc_service::new_native_or_wasm_executor(config);
274 config.wasm_method,
275 config.default_heap_pages,
276 config.max_runtime_instances,
277 config.runtime_cache_size,
278 );
279274
280 let (client, backend, keystore_container, task_manager) =275 let (client, backend, keystore_container, task_manager) =
366 }361 }
367}362}
363
364macro_rules! clone {
365 ($($i:ident),* $(,)?) => {
366 $(
367 let $i = $i.clone();
368 )*
369 };
370}
368371
369/// Start a node with the given parachain `Configuration` and relay chain `Configuration`.372/// Start a node with the given parachain `Configuration` and relay chain `Configuration`.
370///373///
422 Arc<dyn RelayChainInterface>,425 Arc<dyn RelayChainInterface>,
423 Arc<sc_transaction_pool::FullPool<Block, FullClient<RuntimeApi, ExecutorDispatch>>>,426 Arc<sc_transaction_pool::FullPool<Block, FullClient<RuntimeApi, ExecutorDispatch>>>,
424 Arc<SyncingService<Block>>,427 Arc<SyncingService<Block>>,
425 SyncCryptoStorePtr,428 KeystorePtr,
426 bool,429 bool,
427 ) -> Result<Box<dyn ParachainConsensus<Block>>, sc_service::Error>,430 ) -> Result<Box<dyn ParachainConsensus<Block>>, sc_service::Error>,
428{431{
469 warp_sync_params: None,472 warp_sync_params: None,
470 })?;473 })?;
471474
472 let rpc_client = client.clone();
473 let rpc_pool = transaction_pool.clone();
474 let select_chain = params.select_chain.clone();475 let select_chain = params.select_chain.clone();
475 let rpc_network = network.clone();
476 let rpc_sync_service = sync_service.clone();
477
478 let rpc_frontier_backend = frontier_backend.clone();
479476
480 let block_data_cache = Arc::new(fc_rpc::EthBlockDataCacheTask::new(477 let block_data_cache = Arc::new(fc_rpc::EthBlockDataCacheTask::new(
481 task_manager.spawn_handle(),478 task_manager.spawn_handle(),
485 prometheus_registry.clone(),482 prometheus_registry.clone(),
486 ));483 ));
484
485 let pubsub_notification_sinks: fc_mapping_sync::EthereumBlockNotificationSinks<
486 fc_mapping_sync::EthereumBlockNotification<Block>,
487 > = Default::default();
488 let pubsub_notification_sinks = Arc::new(pubsub_notification_sinks);
487489
488 task_manager.spawn_essential_handle().spawn(490 task_manager.spawn_essential_handle().spawn(
489 "frontier-mapping-sync-worker",491 "frontier-mapping-sync-worker",
490 None,492 Some("frontier"),
491 MappingSyncWorker::new(493 MappingSyncWorker::new(
492 client.import_notification_stream(),494 client.import_notification_stream(),
493 Duration::new(6, 0),495 Duration::new(6, 0),
498 3,500 3,
499 0,501 0,
500 SyncStrategy::Normal,502 SyncStrategy::Normal,
503 sync_service.clone(),
504 pubsub_notification_sinks.clone(),
501 )505 )
502 .for_each(|()| futures::future::ready(())),506 .for_each(|()| futures::future::ready(())),
503 );507 );
504
505 #[cfg(feature = "pov-estimate")]
506 let rpc_backend = backend.clone();
507508
508 let runtime_id = parachain_config.chain_spec.runtime_id();509 let runtime_id = parachain_config.chain_spec.runtime_id();
509510
510 let rpc_builder = Box::new(move |deny_unsafe, subscription_task_executor| {511 let rpc_builder = Box::new({
512 clone!(
513 client,
514 backend,
515 pubsub_notification_sinks,
516 transaction_pool,
517 network,
518 sync_service,
519 frontier_backend,
520 );
521 move |deny_unsafe, subscription_task_executor| {
522 clone!(
523 backend,
524 runtime_id,
525 client,
526 transaction_pool,
527 filter_pool,
528 network,
529 select_chain,
530 block_data_cache,
531 fee_history_cache,
532 pubsub_notification_sinks,
533 frontier_backend,
534 );
535
536 #[cfg(not(feature = "pov-estimate"))]
537 let _ = backend;
538
511 let full_deps = unique_rpc::FullDeps {539 let full_deps = unique_rpc::FullDeps {
512 runtime_id: runtime_id.clone(),540 runtime_id,
513541
514 #[cfg(feature = "pov-estimate")]542 #[cfg(feature = "pov-estimate")]
515 exec_params: uc_rpc::pov_estimate::ExecutorParams {543 exec_params: uc_rpc::pov_estimate::ExecutorParams {
520 },548 },
521549
522 #[cfg(feature = "pov-estimate")]550 #[cfg(feature = "pov-estimate")]
523 backend: rpc_backend.clone(),551 backend,
524552
525 eth_backend: rpc_frontier_backend.clone(),553 eth_backend: frontier_backend,
526 deny_unsafe,554 deny_unsafe,
527 client: rpc_client.clone(),555 client,
528 pool: rpc_pool.clone(),
529 graph: rpc_pool.pool().clone(),556 graph: transaction_pool.pool().clone(),
557 pool: transaction_pool,
530 // TODO: Unhardcode558 // TODO: Unhardcode
531 enable_dev_signer: false,559 enable_dev_signer: false,
532 filter_pool: filter_pool.clone(),560 filter_pool,
533 network: rpc_network.clone(),561 network,
534 sync: rpc_sync_service.clone(),562 sync: sync_service.clone(),
535 select_chain: select_chain.clone(),563 select_chain,
536 is_authority: validator,564 is_authority: validator,
537 // TODO: Unhardcode565 // TODO: Unhardcode
538 max_past_logs: 10000,566 max_past_logs: 10000,
539 block_data_cache: block_data_cache.clone(),567 block_data_cache,
540 fee_history_cache: fee_history_cache.clone(),568 fee_history_cache,
541 // TODO: Unhardcode569 // TODO: Unhardcode
542 fee_history_limit: 2048,570 fee_history_limit: 2048,
571 pubsub_notification_sinks,
543 };572 };
544573
545 unique_rpc::create_full::<_, _, _, _, Runtime, RuntimeApi, _>(574 unique_rpc::create_full::<_, _, _, _, Runtime, RuntimeApi, _>(
548 )577 )
549 .map_err(Into::into)578 .map_err(Into::into)
550 });579 }
580 });
551581
552 sc_service::spawn_tasks(sc_service::SpawnTasksParams {582 sc_service::spawn_tasks(sc_service::SpawnTasksParams {
553 rpc_builder,583 rpc_builder,
554 client: client.clone(),584 client: client.clone(),
555 transaction_pool: transaction_pool.clone(),585 transaction_pool: transaction_pool.clone(),
556 task_manager: &mut task_manager,586 task_manager: &mut task_manager,
557 config: parachain_config,587 config: parachain_config,
558 keystore: params.keystore_container.sync_keystore(),588 keystore: params.keystore_container.keystore(),
559 backend: backend.clone(),589 backend: backend.clone(),
560 network: network.clone(),590 network: network.clone(),
561 sync_service: sync_service.clone(),591 sync_service: sync_service.clone(),
600 relay_chain_interface.clone(),630 relay_chain_interface.clone(),
601 transaction_pool,631 transaction_pool,
602 sync_service.clone(),632 sync_service.clone(),
603 params.keystore_container.sync_keystore(),633 params.keystore_container.keystore(),
604 force_authoring,634 force_authoring,
605 )?;635 )?;
606636
619 relay_chain_interface,649 relay_chain_interface,
620 relay_chain_slot_duration,650 relay_chain_slot_duration,
621 recovery_handle: Box::new(overseer_handle),651 recovery_handle: Box::new(overseer_handle),
652 sync_service,
622 };653 };
623654
624 start_collator(params).await?;655 start_collator(params).await?;
632 relay_chain_interface,663 relay_chain_interface,
633 relay_chain_slot_duration,664 relay_chain_slot_duration,
634 recovery_handle: Box::new(overseer_handle),665 recovery_handle: Box::new(overseer_handle),
666 sync_service,
635 };667 };
636668
637 start_full_node(params)?;669 start_full_node(params)?;
897 prometheus_registry.clone(),929 prometheus_registry.clone(),
898 ));930 ));
931
932 let pubsub_notification_sinks: fc_mapping_sync::EthereumBlockNotificationSinks<
933 fc_mapping_sync::EthereumBlockNotification<Block>,
934 > = Default::default();
935 let pubsub_notification_sinks = Arc::new(pubsub_notification_sinks);
899936
900 let (network, system_rpc_tx, tx_handler_controller, network_starter, sync_service) =937 let (network, system_rpc_tx, tx_handler_controller, network_starter, sync_service) =
901 sc_service::build_network(sc_service::BuildNetworkParams {938 sc_service::build_network(sc_service::BuildNetworkParams {
1026 3,1063 3,
1027 0,1064 0,
1028 SyncStrategy::Normal,1065 SyncStrategy::Normal,
1066 sync_service.clone(),
1067 pubsub_notification_sinks.clone(),
1029 )1068 )
1030 .for_each(|()| futures::future::ready(())),1069 .for_each(|()| futures::future::ready(())),
1031 );1070 );
1032
1033 let rpc_client = client.clone();
1034 let rpc_pool = transaction_pool.clone();
1035 let rpc_network = network.clone();
1036 let rpc_sync_service = sync_service.clone();
1037 let rpc_frontier_backend = frontier_backend.clone();
10381071
1039 #[cfg(feature = "pov-estimate")]1072 #[cfg(feature = "pov-estimate")]
1040 let rpc_backend = backend.clone();1073 let rpc_backend = backend.clone();
10411074
1042 let runtime_id = config.chain_spec.runtime_id();1075 let runtime_id = config.chain_spec.runtime_id();
10431076
1044 let rpc_builder = Box::new(move |deny_unsafe, subscription_executor| {1077 let rpc_builder = Box::new({
1078 clone!(
1079 backend,
1080 client,
1081 sync_service,
1082 frontier_backend,
1083 network,
1084 transaction_pool,
1085 pubsub_notification_sinks
1086 );
1087 move |deny_unsafe, subscription_executor| {
1088 clone!(
1089 backend,
1090 block_data_cache,
1091 client,
1092 fee_history_cache,
1093 filter_pool,
1094 network,
1095 pubsub_notification_sinks,
1096 );
1097
1098 #[cfg(not(feature = "pov-estimate"))]
1099 let _ = backend;
1100
1045 let full_deps = unique_rpc::FullDeps {1101 let full_deps = unique_rpc::FullDeps {
1046 runtime_id: runtime_id.clone(),1102 runtime_id: runtime_id.clone(),
1054 },1110 },
10551111
1056 #[cfg(feature = "pov-estimate")]1112 #[cfg(feature = "pov-estimate")]
1057 backend: rpc_backend.clone(),1113 backend,
1058 eth_backend: rpc_frontier_backend.clone(),1114 eth_backend: frontier_backend.clone(),
1059 deny_unsafe,1115 deny_unsafe,
1060 client: rpc_client.clone(),1116 client,
1061 pool: rpc_pool.clone(),1117 pool: transaction_pool.clone(),
1062 graph: rpc_pool.pool().clone(),1118 graph: transaction_pool.pool().clone(),
1063 // TODO: Unhardcode1119 // TODO: Unhardcode
1064 enable_dev_signer: false,1120 enable_dev_signer: false,
1065 filter_pool: filter_pool.clone(),1121 filter_pool,
1066 network: rpc_network.clone(),1122 network,
1067 sync: rpc_sync_service.clone(),1123 sync: sync_service.clone(),
1068 select_chain: select_chain.clone(),1124 select_chain: select_chain.clone(),
1069 is_authority: collator,1125 is_authority: collator,
1070 // TODO: Unhardcode1126 // TODO: Unhardcode
1071 max_past_logs: 10000,1127 max_past_logs: 10000,
1072 block_data_cache: block_data_cache.clone(),1128 block_data_cache,
1073 fee_history_cache: fee_history_cache.clone(),1129 fee_history_cache,
1074 // TODO: Unhardcode1130 // TODO: Unhardcode
1075 fee_history_limit: 2048,1131 fee_history_limit: 2048,
1132 pubsub_notification_sinks,
1076 };1133 };
10771134
1078 unique_rpc::create_full::<_, _, _, _, Runtime, RuntimeApi, _>(1135 unique_rpc::create_full::<_, _, _, _, Runtime, RuntimeApi, _>(
1081 )1138 )
1082 .map_err(Into::into)1139 .map_err(Into::into)
1083 });1140 }
1141 });
10841142
1085 sc_service::spawn_tasks(sc_service::SpawnTasksParams {1143 sc_service::spawn_tasks(sc_service::SpawnTasksParams {
1086 network,1144 network,
1087 sync_service,1145 sync_service,
1088 client,1146 client,
1089 keystore: keystore_container.sync_keystore(),1147 keystore: keystore_container.keystore(),
1090 task_manager: &mut task_manager,1148 task_manager: &mut task_manager,
1091 transaction_pool,1149 transaction_pool,
1092 rpc_builder,1150 rpc_builder,
modifiednode/rpc/Cargo.tomldiffbeforeafterboth
--- a/node/rpc/Cargo.toml
+++ b/node/rpc/Cargo.toml
@@ -30,6 +30,7 @@
 fc-db = { workspace = true }
 fc-rpc = { workspace = true }
 fc-rpc-core = { workspace = true }
+fc-mapping-sync = { workspace = true }
 fp-rpc = { workspace = true }
 fp-storage = { workspace = true }
 
modifiednode/rpc/src/lib.rsdiffbeforeafterboth
--- a/node/rpc/src/lib.rs
+++ b/node/rpc/src/lib.rs
@@ -102,6 +102,12 @@
 	pub fee_history_cache: FeeHistoryCache,
 	/// Cache for Ethereum block data.
 	pub block_data_cache: Arc<EthBlockDataCacheTask<Block>>,
+
+	pub pubsub_notification_sinks: Arc<
+		fc_mapping_sync::EthereumBlockNotificationSinks<
+			fc_mapping_sync::EthereumBlockNotification<Block>,
+		>,
+	>,
 }
 
 pub fn overrides_handle<C, BE, R>(client: Arc<C>) -> Arc<OverrideHandle<Block>>
@@ -214,6 +220,7 @@
 
 		eth_backend,
 		max_past_logs,
+		pubsub_notification_sinks,
 	} = deps;
 
 	io.merge(System::new(Arc::clone(&client), Arc::clone(&pool), deny_unsafe).into_rpc())?;
@@ -244,6 +251,7 @@
 			fee_history_cache,
 			fee_history_limit,
 			execute_gas_limit_multiplier,
+			None,
 		)
 		.into_rpc(),
 	)?;
@@ -290,7 +298,17 @@
 
 	io.merge(Web3::new(client.clone()).into_rpc())?;
 
-	io.merge(EthPubSub::new(pool, client, sync, subscription_task_executor, overrides).into_rpc())?;
+	io.merge(
+		EthPubSub::new(
+			pool,
+			client,
+			sync,
+			subscription_task_executor,
+			overrides,
+			pubsub_notification_sinks,
+		)
+		.into_rpc(),
+	)?;
 
 	Ok(io)
 }