Skip to content

Commit

Permalink
update to polkadot-v0.9.40
Browse files Browse the repository at this point in the history
  • Loading branch information
weezy20 committed Jul 4, 2023
1 parent 1965eaf commit 576fdbd
Show file tree
Hide file tree
Showing 16 changed files with 1,936 additions and 1,179 deletions.
2,435 changes: 1,498 additions & 937 deletions Cargo.lock

Large diffs are not rendered by default.

115 changes: 58 additions & 57 deletions node/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "frontier-parachain-node"
version = "0.9.390"
version = "0.9.400"
authors = ["Anonymous"]
description = "A new Cumulus FRAME-based Substrate Node, ready for hacking together a parachain."
license = "Unlicense"
Expand All @@ -22,70 +22,71 @@ jsonrpsee = { version = "0.16.2", features = ["server", "macros"] }
frontier-parachain-runtime = { path = "../runtime" }

# Substrate
frame-benchmarking = { git = "https://github.com/paritytech/substrate", "branch" = "polkadot-v0.9.39" }
frame-benchmarking-cli = { git = "https://github.com/paritytech/substrate", "branch" = "polkadot-v0.9.39" }
pallet-transaction-payment-rpc = { git = "https://github.com/paritytech/substrate", "branch" = "polkadot-v0.9.39" }
sc-basic-authorship = { git = "https://github.com/paritytech/substrate", "branch" = "polkadot-v0.9.39" }
sc-chain-spec = { git = "https://github.com/paritytech/substrate", "branch" = "polkadot-v0.9.39" }
sc-cli = { git = "https://github.com/paritytech/substrate", "branch" = "polkadot-v0.9.39" }
sc-client-api = { git = "https://github.com/paritytech/substrate", "branch" = "polkadot-v0.9.39" }
sc-consensus = { git = "https://github.com/paritytech/substrate", "branch" = "polkadot-v0.9.39" }
sc-executor = { git = "https://github.com/paritytech/substrate", "branch" = "polkadot-v0.9.39" }
sc-network = { git = "https://github.com/paritytech/substrate", "branch" = "polkadot-v0.9.39" }
sc-network-common = { git = "https://github.com/paritytech/substrate", "branch" = "polkadot-v0.9.39" }
sc-rpc = { git = "https://github.com/paritytech/substrate", "branch" = "polkadot-v0.9.39" }
sc-service = { git = "https://github.com/paritytech/substrate", "branch" = "polkadot-v0.9.39" }
sc-sysinfo = { git = "https://github.com/paritytech/substrate", "branch" = "polkadot-v0.9.39" }
sc-telemetry = { git = "https://github.com/paritytech/substrate", "branch" = "polkadot-v0.9.39" }
sc-tracing = { git = "https://github.com/paritytech/substrate", "branch" = "polkadot-v0.9.39" }
sc-transaction-pool = { git = "https://github.com/paritytech/substrate", "branch" = "polkadot-v0.9.39" }
sc-transaction-pool-api = { git = "https://github.com/paritytech/substrate", "branch" = "polkadot-v0.9.39" }
sp-api = { git = "https://github.com/paritytech/substrate", "branch" = "polkadot-v0.9.39" }
sp-block-builder = { git = "https://github.com/paritytech/substrate", "branch" = "polkadot-v0.9.39" }
sp-blockchain = { git = "https://github.com/paritytech/substrate", "branch" = "polkadot-v0.9.39" }
sp-consensus-aura = { git = "https://github.com/paritytech/substrate", "branch" = "polkadot-v0.9.39" }
sp-core = { git = "https://github.com/paritytech/substrate", "branch" = "polkadot-v0.9.39" }
sp-keystore = { git = "https://github.com/paritytech/substrate", "branch" = "polkadot-v0.9.39" }
sp-offchain = { git = "https://github.com/paritytech/substrate", "branch" = "polkadot-v0.9.39" }
sp-io = { git = "https://github.com/paritytech/substrate", "branch" = "polkadot-v0.9.39" }
sp-runtime = { git = "https://github.com/paritytech/substrate", "branch" = "polkadot-v0.9.39" }
sp-session = { git = "https://github.com/paritytech/substrate", "branch" = "polkadot-v0.9.39" }
sp-timestamp = { git = "https://github.com/paritytech/substrate", "branch" = "polkadot-v0.9.39" }
sp-transaction-pool = { git = "https://github.com/paritytech/substrate", "branch" = "polkadot-v0.9.39" }
substrate-frame-rpc-system = { git = "https://github.com/paritytech/substrate", "branch" = "polkadot-v0.9.39" }
substrate-prometheus-endpoint = { git = "https://github.com/paritytech/substrate", "branch" = "polkadot-v0.9.39" }
try-runtime-cli = { git = "https://github.com/paritytech/substrate", optional = true , "branch" = "polkadot-v0.9.39" }
frame-benchmarking = { git = "https://github.com/paritytech/substrate", "branch" = "polkadot-v0.9.40" }
frame-benchmarking-cli = { git = "https://github.com/paritytech/substrate", "branch" = "polkadot-v0.9.40" }
pallet-transaction-payment-rpc = { git = "https://github.com/paritytech/substrate", "branch" = "polkadot-v0.9.40" }
sc-basic-authorship = { git = "https://github.com/paritytech/substrate", "branch" = "polkadot-v0.9.40" }
sc-chain-spec = { git = "https://github.com/paritytech/substrate", "branch" = "polkadot-v0.9.40" }
sc-cli = { git = "https://github.com/paritytech/substrate", "branch" = "polkadot-v0.9.40" }
sc-client-api = { git = "https://github.com/paritytech/substrate", "branch" = "polkadot-v0.9.40" }
sc-consensus = { git = "https://github.com/paritytech/substrate", "branch" = "polkadot-v0.9.40" }
sc-executor = { git = "https://github.com/paritytech/substrate", "branch" = "polkadot-v0.9.40" }
sc-network = { git = "https://github.com/paritytech/substrate", "branch" = "polkadot-v0.9.40" }
sc-network-common = { git = "https://github.com/paritytech/substrate", "branch" = "polkadot-v0.9.40" }
sc-network-sync = { git = "https://github.com/paritytech/substrate", "branch" = "polkadot-v0.9.40" }
sc-rpc = { git = "https://github.com/paritytech/substrate", "branch" = "polkadot-v0.9.40" }
sc-service = { git = "https://github.com/paritytech/substrate", "branch" = "polkadot-v0.9.40" }
sc-sysinfo = { git = "https://github.com/paritytech/substrate", "branch" = "polkadot-v0.9.40" }
sc-telemetry = { git = "https://github.com/paritytech/substrate", "branch" = "polkadot-v0.9.40" }
sc-tracing = { git = "https://github.com/paritytech/substrate", "branch" = "polkadot-v0.9.40" }
sc-transaction-pool = { git = "https://github.com/paritytech/substrate", "branch" = "polkadot-v0.9.40" }
sc-transaction-pool-api = { git = "https://github.com/paritytech/substrate", "branch" = "polkadot-v0.9.40" }
sp-api = { git = "https://github.com/paritytech/substrate", "branch" = "polkadot-v0.9.40" }
sp-block-builder = { git = "https://github.com/paritytech/substrate", "branch" = "polkadot-v0.9.40" }
sp-blockchain = { git = "https://github.com/paritytech/substrate", "branch" = "polkadot-v0.9.40" }
sp-consensus-aura = { git = "https://github.com/paritytech/substrate", "branch" = "polkadot-v0.9.40" }
sp-core = { git = "https://github.com/paritytech/substrate", "branch" = "polkadot-v0.9.40" }
sp-keystore = { git = "https://github.com/paritytech/substrate", "branch" = "polkadot-v0.9.40" }
sp-offchain = { git = "https://github.com/paritytech/substrate", "branch" = "polkadot-v0.9.40" }
sp-io = { git = "https://github.com/paritytech/substrate", "branch" = "polkadot-v0.9.40" }
sp-runtime = { git = "https://github.com/paritytech/substrate", "branch" = "polkadot-v0.9.40" }
sp-session = { git = "https://github.com/paritytech/substrate", "branch" = "polkadot-v0.9.40" }
sp-timestamp = { git = "https://github.com/paritytech/substrate", "branch" = "polkadot-v0.9.40" }
sp-transaction-pool = { git = "https://github.com/paritytech/substrate", "branch" = "polkadot-v0.9.40" }
substrate-frame-rpc-system = { git = "https://github.com/paritytech/substrate", "branch" = "polkadot-v0.9.40" }
substrate-prometheus-endpoint = { git = "https://github.com/paritytech/substrate", "branch" = "polkadot-v0.9.40" }
try-runtime-cli = { git = "https://github.com/paritytech/substrate", optional = true , "branch" = "polkadot-v0.9.40" }

# Polkadot
polkadot-cli = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.39" }
polkadot-primitives = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.39" }
polkadot-service = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.39" }
xcm = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "release-v0.9.39" }
polkadot-cli = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.40" }
polkadot-primitives = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.40" }
polkadot-service = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.40" }
xcm = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "release-v0.9.40" }

# Cumulus
cumulus-client-cli = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.39" }
cumulus-client-consensus-aura = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.39" }
cumulus-client-consensus-common = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.39" }
cumulus-client-network = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.39" }
cumulus-client-service = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.39" }
cumulus-primitives-core = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.39" }
cumulus-primitives-parachain-inherent = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.39" }
cumulus-relay-chain-interface = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.39" }
cumulus-client-cli = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.40" }
cumulus-client-consensus-aura = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.40" }
cumulus-client-consensus-common = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.40" }
cumulus-client-network = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.40" }
cumulus-client-service = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.40" }
cumulus-primitives-core = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.40" }
cumulus-primitives-parachain-inherent = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.40" }
cumulus-relay-chain-interface = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.40" }

# Frontier
fc-cli = { git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.39" }
fc-consensus = { git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.39" }
fc-db = { git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.39" }
fc-mapping-sync = { git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.39" }
fc-rpc = { git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.39", features = [ "rpc-binary-search-estimate" ] }
fc-rpc-core = { git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.39" }
fp-dynamic-fee = { git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.39" }
fp-evm = { git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.39" }
fp-rpc = { git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.39" }
fc-storage = { git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.39" }
fc-cli = { git = "https://github.com/paritytech/frontier", branch = "fpt/polkadot-v0.9.40" }
fc-consensus = { git = "https://github.com/paritytech/frontier", branch = "fpt/polkadot-v0.9.40" }
fc-db = { git = "https://github.com/paritytech/frontier", branch = "fpt/polkadot-v0.9.40" }
fc-mapping-sync = { git = "https://github.com/paritytech/frontier", branch = "fpt/polkadot-v0.9.40" }
fc-rpc = { git = "https://github.com/paritytech/frontier", branch = "fpt/polkadot-v0.9.40", features = [ "rpc-binary-search-estimate" ] }
fc-rpc-core = { git = "https://github.com/paritytech/frontier", branch = "fpt/polkadot-v0.9.40" }
fp-dynamic-fee = { git = "https://github.com/paritytech/frontier", branch = "fpt/polkadot-v0.9.40" }
fp-evm = { git = "https://github.com/paritytech/frontier", branch = "fpt/polkadot-v0.9.40" }
fp-rpc = { git = "https://github.com/paritytech/frontier", branch = "fpt/polkadot-v0.9.40" }
fc-storage = { git = "https://github.com/paritytech/frontier", branch = "fpt/polkadot-v0.9.40" }

[build-dependencies]
substrate-build-script-utils = { git = "https://github.com/paritytech/substrate", "branch" = "polkadot-v0.9.39" }
substrate-build-script-utils = { git = "https://github.com/paritytech/substrate", "branch" = "polkadot-v0.9.40" }

[features]
default = []
Expand Down
21 changes: 14 additions & 7 deletions node/src/command.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use std::net::SocketAddr;
use std::{net::SocketAddr, sync::Arc};

use codec::Encode;
use cumulus_client_cli::generate_genesis_block;
Expand All @@ -10,7 +10,10 @@ use sc_cli::{
ChainSpec, CliConfiguration, DefaultConfigurationValues, ImportParams, KeystoreParams,
NetworkParams, Result, RuntimeVersion, SharedParams, SubstrateCli,
};
use sc_service::config::{BasePath, /*DatabaseSource,*/ PrometheusConfig};
use sc_service::{
config::{BasePath, /*DatabaseSource,*/ PrometheusConfig},
PartialComponents,
};
use sp_core::hexdisplay::HexDisplay;
use sp_runtime::traits::{AccountIdConversion, Block as BlockT};
// Frontier
Expand Down Expand Up @@ -73,7 +76,7 @@ impl SubstrateCli for Cli {

impl SubstrateCli for RelayChainCli {
fn impl_name() -> String {
"Parachain Collator Template".into()
"Frontier Parachain Collator Template".into()
}

fn impl_version() -> String {
Expand All @@ -82,7 +85,7 @@ impl SubstrateCli for RelayChainCli {

fn description() -> String {
format!(
"Parachain Collator Template\n\nThe command-line arguments provided first will be \
"Frontier Parachain Collator Template\n\nThe command-line arguments provided first will be \
passed to the parachain node, while the arguments provided after -- will be passed \
to the relay chain node.\n\n\
{} <parachain-args> -- <relay-chain-args>",
Expand Down Expand Up @@ -285,9 +288,13 @@ pub fn run() -> Result<()> {
Some(Subcommand::FrontierDb(cmd)) => {
let runner = cli.create_runner(cmd)?;
runner.sync_run(|config| {
let params = crate::service::new_partial(&config, &cli.eth)?;
let client = params.client;
let (_, _, _, frontier_backend) = params.other;
let PartialComponents { client, other, .. } =
crate::service::new_partial(&config, &cli.eth)?;
let (_, _, _, frontier_backend, _) = other;
let frontier_backend = match frontier_backend {
fc_db::Backend::KeyValue(kv) => Arc::new(kv),
_ => panic!("Only fc_db::Backend::KeyValue supported"),
};
cmd.run(client, frontier_backend)
})
},
Expand Down
116 changes: 95 additions & 21 deletions node/src/eth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ use futures::{future, prelude::*};
use sc_client_api::{BlockchainEvents, StateBackendFor};
use sc_executor::{NativeElseWasmExecutor, NativeExecutionDispatch};

use sc_network_sync::SyncingService;
use sc_service::{
error::Error as ServiceError, BasePath, Configuration, TFullBackend, TFullClient, TaskManager,
};
use sp_api::ConstructRuntimeApi;
use sp_runtime::traits::BlakeTwo256;
// Frontier
pub use fc_consensus::FrontierBlockImport;
pub use fc_db::frontier_database_dir;
use fc_mapping_sync::{MappingSyncWorker, SyncStrategy};
use fc_mapping_sync::{kv::MappingSyncWorker, SyncStrategy};
use fc_rpc::{EthTask, OverrideHandle};
pub use fc_rpc_core::types::{FeeHistoryCache, FeeHistoryCacheLimit, FilterPool};
// Local
Expand All @@ -38,6 +38,21 @@ pub fn db_config_dir(config: &Configuration) -> PathBuf {
})
}

/// Avalailable frontier backend types.
#[derive(Debug, Copy, Clone, clap::ValueEnum)]
pub enum BackendType {
/// Either RocksDb or ParityDb as per inherited from the global backend settings.
KeyValue,
/// Sql database with custom log indexing.
Sql,
}

impl Default for BackendType {
fn default() -> BackendType {
BackendType::KeyValue
}
}

/// The ethereum-compatibility configuration used to run a node.
#[derive(Clone, Debug, clap::Parser)]
pub struct EthConfiguration {
Expand Down Expand Up @@ -68,6 +83,27 @@ pub struct EthConfiguration {
/// Size in bytes of the LRU cache for transactions statuses data.
#[arg(long, default_value = "50")]
pub eth_statuses_cache: usize,

/// Sets the frontier backend type (KeyValue or Sql)
#[arg(long, value_enum, ignore_case = true, default_value_t = BackendType::default())]
pub frontier_backend_type: BackendType,

// Sets the SQL backend's pool size.
#[arg(long, default_value = "100")]
pub frontier_sql_backend_pool_size: u32,

/// Sets the SQL backend's query timeout in number of VM ops.
#[arg(long, default_value = "10000000")]
pub frontier_sql_backend_num_ops_timeout: u32,

/// Sets the SQL backend's auxiliary thread limit.
#[arg(long, default_value = "4")]
pub frontier_sql_backend_thread_count: u32,

/// Sets the SQL backend's query timeout in number of VM ops.
/// Default value is 200MB.
#[arg(long, default_value = "209715200")]
pub frontier_sql_backend_cache_size: u64,
}

pub struct FrontierPartialComponents {
Expand Down Expand Up @@ -105,15 +141,21 @@ where
{
}

pub fn spawn_frontier_tasks<RuntimeApi, Executor>(
pub async fn spawn_frontier_tasks<RuntimeApi, Executor>(
task_manager: &TaskManager,
client: Arc<TFullClient<Block, RuntimeApi, NativeElseWasmExecutor<Executor>>>,
backend: Arc<TFullBackend<Block>>,
frontier_backend: Arc<FrontierBackend>,
frontier_backend: FrontierBackend,
filter_pool: Option<FilterPool>,
overrides: Arc<OverrideHandle<Block>>,
fee_history_cache: FeeHistoryCache,
fee_history_cache_limit: FeeHistoryCacheLimit,
sync: Arc<SyncingService<Block>>,
pubsub_notification_sinks: Arc<
fc_mapping_sync::EthereumBlockNotificationSinks<
fc_mapping_sync::EthereumBlockNotification<Block>,
>,
>,
) where
RuntimeApi: ConstructRuntimeApi<
Block,
Expand All @@ -124,22 +166,49 @@ pub fn spawn_frontier_tasks<RuntimeApi, Executor>(
EthCompatRuntimeApiCollection<StateBackend = StateBackendFor<TFullBackend<Block>, Block>>,
Executor: NativeExecutionDispatch + 'static,
{
task_manager.spawn_essential_handle().spawn(
"frontier-mapping-sync-worker",
Some("frontier"),
MappingSyncWorker::new(
client.import_notification_stream(),
Duration::new(6, 0),
client.clone(),
backend,
overrides.clone(),
frontier_backend,
3,
0,
SyncStrategy::Parachain,
)
.for_each(|()| future::ready(())),
);
// Spawn main mapping sync worker background task.

match frontier_backend {
fc_db::Backend::KeyValue(b) => {
task_manager.spawn_essential_handle().spawn(
"frontier-mapping-sync-worker",
Some("frontier"),
MappingSyncWorker::new(
client.import_notification_stream(),
Duration::new(6, 0),
client.clone(),
backend,
overrides.clone(),
Arc::new(b),
3,
0,
SyncStrategy::Parachain,
sync,
pubsub_notification_sinks,
)
.for_each(|()| future::ready(())),
);
},
fc_db::Backend::Sql(b) => {
task_manager.spawn_essential_handle().spawn_blocking(
"frontier-mapping-sync-worker",
Some("frontier"),
fc_mapping_sync::sql::SyncWorker::run(
client.clone(),
backend,
Arc::new(b),
client.import_notification_stream(),
fc_mapping_sync::sql::SyncWorkerConfig {
read_notification_timeout: Duration::from_secs(10),
check_indexed_blocks_interval: Duration::from_secs(60),
},
fc_mapping_sync::SyncStrategy::Parachain,
sync,
pubsub_notification_sinks,
),
);
},
}

// Spawn Frontier EthFilterApi maintenance task.
if let Some(filter_pool) = filter_pool {
Expand All @@ -156,6 +225,11 @@ pub fn spawn_frontier_tasks<RuntimeApi, Executor>(
task_manager.spawn_essential_handle().spawn(
"frontier-fee-history",
Some("frontier"),
EthTask::fee_history_task(client, overrides, fee_history_cache, fee_history_cache_limit),
EthTask::fee_history_task(
client,
overrides,
fee_history_cache,
fee_history_cache_limit
),
);
}
Loading

0 comments on commit 576fdbd

Please sign in to comment.