Skip to content

Commit

Permalink
Try fix the compile
Browse files Browse the repository at this point in the history
  • Loading branch information
boundless-forest committed Apr 22, 2024
1 parent 9aaf0a3 commit f43f826
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 9 deletions.
4 changes: 3 additions & 1 deletion template/node/src/eth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ use futures::{future, prelude::*};
use sc_client_api::BlockchainEvents;
use sc_executor::NativeExecutionDispatch;
use sc_network_sync::SyncingService;
use sp_blockchain::HeaderBackend;
use sc_service::{error::Error as ServiceError, Configuration, TaskManager};
use sp_api::ConstructRuntimeApi;
// Frontier
Expand Down Expand Up @@ -126,7 +127,7 @@ pub async fn spawn_frontier_tasks<RuntimeApi, Executor>(
task_manager: &TaskManager,
client: Arc<FullClient<RuntimeApi, Executor>>,
backend: Arc<FullBackend>,
frontier_backend: FrontierBackend<Arc<FullClient<RuntimeApi, Executor>>>,
frontier_backend: FrontierBackend<FullClient<RuntimeApi, Executor>>,
filter_pool: Option<FilterPool>,
overrides: Arc<OverrideHandle<Block>>,
fee_history_cache: FeeHistoryCache,
Expand All @@ -142,6 +143,7 @@ pub async fn spawn_frontier_tasks<RuntimeApi, Executor>(
RuntimeApi: Send + Sync + 'static,
RuntimeApi::RuntimeApi: EthCompatRuntimeApiCollection,
Executor: NativeExecutionDispatch + 'static,
FullClient<RuntimeApi, Executor>: HeaderBackend<Block>,
{
// Spawn main mapping sync worker background task.
match frontier_backend {
Expand Down
6 changes: 4 additions & 2 deletions template/node/src/rpc/eth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@ pub use fc_rpc_core::types::{FeeHistoryCache, FeeHistoryCacheLimit, FilterPool};
pub use fc_storage::overrides_handle;
use fp_rpc::{ConvertTransaction, ConvertTransactionRuntimeApi, EthereumRuntimeRPCApi};

use crate::eth::FrontierBackend;

/// Extra dependencies for Ethereum compatibility.
pub struct EthDeps<B: BlockT, C, P, A: ChainApi, CT, CIDP> {
pub struct EthDeps<B: BlockT, C: HeaderBackend<B>, P, A: ChainApi, CT, CIDP> {
/// The client instance to use.
pub client: Arc<C>,
/// Transaction pool instance.
Expand All @@ -44,7 +46,7 @@ pub struct EthDeps<B: BlockT, C, P, A: ChainApi, CT, CIDP> {
/// Chain syncing service
pub sync: Arc<SyncingService<B>>,
/// Frontier Backend.
pub frontier_backend: Arc<dyn fc_api::Backend<B>>,
pub frontier_backend: Arc<FrontierBackend<C>>,
/// Ethereum data access overrides.
pub overrides: Arc<OverrideHandle<B>>,
/// Cache for Ethereum block data.
Expand Down
2 changes: 1 addition & 1 deletion template/node/src/rpc/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ mod eth;
pub use self::eth::{create_eth, overrides_handle, EthDeps};

/// Full client dependencies.
pub struct FullDeps<C, P, A: ChainApi, CT, CIDP> {
pub struct FullDeps<C: HeaderBackend<Block>, P, A: ChainApi, CT, CIDP> {
/// The client instance to use.
pub client: Arc<C>,
/// Transaction pool instance.
Expand Down
15 changes: 10 additions & 5 deletions template/node/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ use sc_service::{error::Error as ServiceError, Configuration, PartialComponents,
use sc_telemetry::{Telemetry, TelemetryHandle, TelemetryWorker};
use sc_transaction_pool_api::OffchainTransactionPoolFactory;
use sp_api::ConstructRuntimeApi;
use sp_blockchain::HeaderBackend;
use sp_consensus_aura::sr25519::AuthorityPair as AuraPair;
use sp_core::U256;
// Runtime
Expand Down Expand Up @@ -267,6 +268,7 @@ where
RuntimeApi: Send + Sync + 'static,
RuntimeApi::RuntimeApi: RuntimeApiCollection,
Executor: NativeExecutionDispatch + 'static,
FullClient<RuntimeApi, Executor>: HeaderBackend<Block>,
{
let build_import_queue = if sealing.is_some() {
build_manual_seal_import_queue::<RuntimeApi, Executor>
Expand Down Expand Up @@ -366,6 +368,7 @@ where
// for ethereum-compatibility rpc.
config.rpc_id_provider = Some(Box::new(fc_rpc::EthereumSubIdProvider));

let frontier_backend_arc: Arc<FrontierBackend<FullClient<RuntimeApi, Executor>>> = Arc::new(frontier_backend);
let rpc_builder = {
let client = client.clone();
let pool = transaction_pool.clone();
Expand All @@ -377,7 +380,8 @@ where
let max_past_logs = eth_config.max_past_logs;
let execute_gas_limit_multiplier = eth_config.execute_gas_limit_multiplier;
let filter_pool = filter_pool.clone();
let frontier_backend = frontier_backend.clone();
let frontier_backend = frontier_backend_arc.clone();
// let frontier_backend = frontier_backend.clone();
let pubsub_notification_sinks = pubsub_notification_sinks.clone();
let overrides = overrides.clone();
let fee_history_cache = fee_history_cache.clone();
Expand Down Expand Up @@ -413,10 +417,11 @@ where
enable_dev_signer,
network: network.clone(),
sync: sync_service.clone(),
frontier_backend: match frontier_backend.clone() {
fc_db::Backend::KeyValue(b) => Arc::new(b),
fc_db::Backend::Sql(b) => Arc::new(b),
},
// frontier_backend: match frontier_backend.clone() {
// fc_db::Backend::KeyValue(b) => Arc::new(b),
// fc_db::Backend::Sql(b) => Arc::new(b.into()),
// },
frontier_backend: frontier_backend_arc.clone(),
overrides: overrides.clone(),
block_data_cache: block_data_cache.clone(),
filter_pool: filter_pool.clone(),
Expand Down

0 comments on commit f43f826

Please sign in to comment.