Skip to content

Commit

Permalink
WIP:
Browse files Browse the repository at this point in the history
  • Loading branch information
dkuanyshbaev committed Nov 6, 2024
1 parent dca462e commit 3988a3e
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 19 deletions.
47 changes: 30 additions & 17 deletions node/service/src/parachain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ use robonomics_primitives::{AccountId, Balance, Block, Nonce};
use sc_consensus::ImportQueue;
use sc_executor::{HeapAllocStrategy, WasmExecutor, DEFAULT_HEAP_ALLOC_STRATEGY};
use sc_network::{config::FullNetworkConfiguration, NetworkBlock};
use sc_network_sync::SyncingService;
use sc_network_sync::{service::network::Network, SyncingService};
use sc_service::{Configuration, PartialComponents, TFullBackend, TFullClient, TaskManager};
use sc_telemetry::{Telemetry, TelemetryHandle, TelemetryWorker, TelemetryWorkerHandle};
use sp_api::{ApiExt, ConstructRuntimeApi, Metadata};
Expand Down Expand Up @@ -101,9 +101,10 @@ pub fn build_open_import_queue<RuntimeApi>(
) -> Result<sc_consensus::DefaultImportQueue<Block>, sc_service::Error>
where
RuntimeApi: ConstructRuntimeApi<Block, ParachainClient<RuntimeApi>> + Send + Sync + 'static,
RuntimeApi::RuntimeApi: RuntimeApiCollection<
StateBackend = sc_client_api::StateBackendFor<ParachainBackend, Block>,
>,
RuntimeApi::RuntimeApi: RuntimeApiCollection,
// RuntimeApi::RuntimeApi: RuntimeApiCollection<
// StateBackend = sc_client_api::StateBackendFor<ParachainBackend, Block>,
// >,
{
let registry = config.prometheus_registry();
cumulus_client_consensus_relay_chain::import_queue(
Expand Down Expand Up @@ -136,9 +137,10 @@ pub fn build_open_consensus<RuntimeApi>(
) -> Result<Box<dyn ParachainConsensus<Block>>, sc_service::Error>
where
RuntimeApi: ConstructRuntimeApi<Block, ParachainClient<RuntimeApi>> + Send + Sync + 'static,
RuntimeApi::RuntimeApi: RuntimeApiCollection<
StateBackend = sc_client_api::StateBackendFor<ParachainBackend, Block>,
>,
RuntimeApi::RuntimeApi: RuntimeApiCollection,
// RuntimeApi::RuntimeApi: RuntimeApiCollection<
// StateBackend = sc_client_api::StateBackendFor<ParachainBackend, Block>,
// >,
{
let proposer_factory = sc_basic_authorship::ProposerFactory::with_proof_recording(
task_manager.spawn_handle(),
Expand Down Expand Up @@ -213,9 +215,10 @@ pub fn new_partial<RuntimeApi, BIQ>(
>
where
RuntimeApi: ConstructRuntimeApi<Block, ParachainClient<RuntimeApi>> + Send + Sync + 'static,
RuntimeApi::RuntimeApi: RuntimeApiCollection<
StateBackend = sc_client_api::StateBackendFor<ParachainBackend, Block>,
>,
RuntimeApi::RuntimeApi: RuntimeApiCollection,
// RuntimeApi::RuntimeApi: RuntimeApiCollection<
// StateBackend = sc_client_api::StateBackendFor<ParachainBackend, Block>,
// >,
BIQ: FnOnce(
Arc<ParachainClient<RuntimeApi>>,
ParachainBlockImport<RuntimeApi>,
Expand Down Expand Up @@ -310,9 +313,10 @@ pub async fn new_service<RuntimeApi, RB, BIQ, BIC>(
) -> sc_service::error::Result<(TaskManager, Arc<ParachainClient<RuntimeApi>>)>
where
RuntimeApi: ConstructRuntimeApi<Block, ParachainClient<RuntimeApi>> + Send + Sync + 'static,
RuntimeApi::RuntimeApi: RuntimeApiCollection<
StateBackend = sc_client_api::StateBackendFor<ParachainBackend, Block>,
>,
RuntimeApi::RuntimeApi: RuntimeApiCollection,
// RuntimeApi::RuntimeApi: RuntimeApiCollection<
// StateBackend = sc_client_api::StateBackendFor<ParachainBackend, Block>,
// >,
RB: Fn(Arc<ParachainClient<RuntimeApi>>) -> Result<jsonrpsee::RpcModule<()>, sc_service::Error>
+ 'static,
BIQ: FnOnce(
Expand Down Expand Up @@ -362,7 +366,15 @@ where
let prometheus_registry = parachain_config.prometheus_registry().cloned();
let transaction_pool = params.transaction_pool.clone();
let import_queue_service = params.import_queue.service();
let net_config = FullNetworkConfiguration::new(&parachain_config.network);

// let net_config = FullNetworkConfiguration::new(&parachain_config.network);
let mut net_config = FullNetworkConfiguration::<_, _, Network>::new(
&parachain_config.network,
parachain_config
.prometheus_config
.as_ref()
.map(|cfg| cfg.registry.clone()),
);

let (network, system_rpc_tx, tx_handler_controller, start_network, sync_service) =
build_network(BuildNetworkParams {
Expand Down Expand Up @@ -501,9 +513,10 @@ pub async fn start_generic_robonomics_parachain<RuntimeApi>(
) -> sc_service::error::Result<TaskManager>
where
RuntimeApi: ConstructRuntimeApi<Block, ParachainClient<RuntimeApi>> + Send + Sync + 'static,
RuntimeApi::RuntimeApi: RuntimeApiCollection<
StateBackend = sc_client_api::StateBackendFor<ParachainBackend, Block>,
>,
RuntimeApi::RuntimeApi: RuntimeApiCollection,
// RuntimeApi::RuntimeApi: RuntimeApiCollection<
// StateBackend = sc_client_api::StateBackendFor<ParachainBackend, Block>,
// >,
{
new_service::<RuntimeApi, _, _, _>(
parachain_config,
Expand Down
4 changes: 2 additions & 2 deletions runtime/dev/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ use sp_runtime::traits::{
use sp_runtime::transaction_validity::{TransactionSource, TransactionValidity};
use sp_runtime::{
create_runtime_str, generic, impl_opaque_keys, ApplyExtrinsicResult, BoundedVec,
FixedPointNumber, Perbill, Permill, Perquintill,
ExtrinsicInclusionMode, FixedPointNumber, Perbill, Permill, Perquintill,
};
use sp_std::prelude::*;
#[cfg(feature = "std")]
Expand Down Expand Up @@ -681,7 +681,7 @@ impl_runtime_apis! {
Executive::execute_block(block)
}

fn initialize_block(header: &<Block as BlockT>::Header) {
fn initialize_block(header: &<Block as BlockT>::Header) -> ExtrinsicInclusionMode {
Executive::initialize_block(header)
}
}
Expand Down

0 comments on commit 3988a3e

Please sign in to comment.