Skip to content

Commit

Permalink
Checkpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
Dinonard committed Jul 17, 2023
1 parent 8eb1c2d commit e9d5c0c
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 25 deletions.
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),
}
}
}
9 changes: 3 additions & 6 deletions bin/collator/src/local/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ 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,
Expand Down Expand Up @@ -125,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
5 changes: 2 additions & 3 deletions bin/collator/src/parachain/service.rs
Original file line number Diff line number Diff line change
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 @@ -237,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
15 changes: 5 additions & 10 deletions bin/collator/src/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,20 +66,14 @@ pub struct EvmTracingConfig {
pub fn open_frontier_backend<C>(
client: Arc<C>,
config: &sc_service::Configuration,
) -> Result<Arc<fc_db::Backend<Block>>, String>
) -> Result<Arc<fc_db::kv::Backend<Block>>, String>
where
C: sp_blockchain::HeaderBackend<Block>,
{
let config_dir = config
.base_path
.as_ref()
.map(|base_path| base_path.config_dir(config.chain_spec.id()))
.unwrap_or_else(|| {
sc_service::BasePath::from_project("", "", "astar").config_dir(config.chain_spec.id())
});
let config_dir = config.base_path.config_dir(config.chain_spec.id());
let path = config_dir.join("frontier").join("db");

Ok(Arc::new(fc_db::Backend::<Block>::new(
Ok(Arc::new(fc_db::kv::Backend::<Block>::new(
client,
&fc_db::kv::DatabaseSettings {
source: fc_db::DatabaseSource::RocksDb {
Expand Down Expand Up @@ -107,7 +101,7 @@ pub struct FullDeps<C, P, A: ChainApi> {
/// The Node authority flag
pub is_authority: bool,
/// Frontier Backend.
pub frontier_backend: Arc<fc_db::Backend<Block>>,
pub frontier_backend: Arc<dyn fc_db::BackendReader<Block> + Send + Sync>,
/// EthFilterApi pool.
pub filter_pool: FilterPool,
/// Maximum fee history cache size.
Expand Down Expand Up @@ -299,6 +293,7 @@ where
fee_history_limit,
// Allow 10x max allowed weight for non-transactional calls
10,
None,
)
.into_rpc(),
)?;
Expand Down

0 comments on commit e9d5c0c

Please sign in to comment.