Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: CrossAccountId moved to up-common, RuntimeApiDep and node simplified #1055

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 20 additions & 18 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 14 additions & 14 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -69,22 +69,22 @@ quartz-runtime = { path = "runtime/quartz" }
unique-runtime = { path = "runtime/unique" }

# Frontier (Unique patches over the Parity version)
fc-api = { default-features = false, git = "https://github.com/uniquenetwork/unique-frontier", branch = "unique-polkadot-v1.3.0" }
fc-consensus = { git = "https://github.com/uniquenetwork/unique-frontier", branch = "unique-polkadot-v1.3.0" }
fc-db = { default-features = false, git = "https://github.com/uniquenetwork/unique-frontier", branch = "unique-polkadot-v1.3.0" }
fc-mapping-sync = { git = "https://github.com/uniquenetwork/unique-frontier", branch = "unique-polkadot-v1.3.0" }
fc-rpc = { default-features = false, git = "https://github.com/uniquenetwork/unique-frontier", branch = "unique-polkadot-v1.3.0" }
fc-rpc-core = { default-features = false, git = "https://github.com/uniquenetwork/unique-frontier", branch = "unique-polkadot-v1.3.0" }
fp-evm = { default-features = false, git = "https://github.com/uniquenetwork/unique-frontier", branch = "unique-polkadot-v1.3.0" }
fp-rpc = { default-features = false, git = "https://github.com/uniquenetwork/unique-frontier", branch = "unique-polkadot-v1.3.0" }
fc-api = { default-features = false, git = "https://github.com/uniquenetwork/unique-frontier", branch = "unique-polkadot-v1.3.0-newbcci" }
fc-consensus = { git = "https://github.com/uniquenetwork/unique-frontier", branch = "unique-polkadot-v1.3.0-newbcci" }
fc-db = { default-features = false, git = "https://github.com/uniquenetwork/unique-frontier", branch = "unique-polkadot-v1.3.0-newbcci" }
fc-mapping-sync = { git = "https://github.com/uniquenetwork/unique-frontier", branch = "unique-polkadot-v1.3.0-newbcci" }
fc-rpc = { default-features = false, git = "https://github.com/uniquenetwork/unique-frontier", branch = "unique-polkadot-v1.3.0-newbcci" }
fc-rpc-core = { default-features = false, git = "https://github.com/uniquenetwork/unique-frontier", branch = "unique-polkadot-v1.3.0-newbcci" }
fp-evm = { default-features = false, git = "https://github.com/uniquenetwork/unique-frontier", branch = "unique-polkadot-v1.3.0-newbcci" }
fp-rpc = { default-features = false, git = "https://github.com/uniquenetwork/unique-frontier", branch = "unique-polkadot-v1.3.0-newbcci" }
fp-self-contained = { default-features = false, features = [
"serde",
], git = "https://github.com/uniquenetwork/unique-frontier", branch = "unique-polkadot-v1.3.0" }
fp-storage = { default-features = false, git = "https://github.com/uniquenetwork/unique-frontier", branch = "unique-polkadot-v1.3.0" }
pallet-base-fee = { default-features = false, git = "https://github.com/uniquenetwork/unique-frontier", branch = "unique-polkadot-v1.3.0" }
pallet-ethereum = { default-features = false, git = "https://github.com/uniquenetwork/unique-frontier", branch = "unique-polkadot-v1.3.0" }
pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/unique-frontier", branch = "unique-polkadot-v1.3.0" }
pallet-evm-precompile-simple = { default-features = false, git = "https://github.com/uniquenetwork/unique-frontier", branch = "unique-polkadot-v1.3.0" }
], git = "https://github.com/uniquenetwork/unique-frontier", branch = "unique-polkadot-v1.3.0-newbcci" }
fp-storage = { default-features = false, git = "https://github.com/uniquenetwork/unique-frontier", branch = "unique-polkadot-v1.3.0-newbcci" }
pallet-base-fee = { default-features = false, git = "https://github.com/uniquenetwork/unique-frontier", branch = "unique-polkadot-v1.3.0-newbcci" }
pallet-ethereum = { default-features = false, git = "https://github.com/uniquenetwork/unique-frontier", branch = "unique-polkadot-v1.3.0-newbcci" }
pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/unique-frontier", branch = "unique-polkadot-v1.3.0-newbcci" }
pallet-evm-precompile-simple = { default-features = false, git = "https://github.com/uniquenetwork/unique-frontier", branch = "unique-polkadot-v1.3.0-newbcci" }

# Parity
codec = { default-features = false, features = ['derive'], package = 'parity-scale-codec', version = "3.6.5" }
Expand Down
41 changes: 12 additions & 29 deletions node/cli/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,16 +163,14 @@ impl SubstrateCli for RelayChainCli {

macro_rules! async_run_with_runtime {
(
$runtime:path, $runtime_api:path, $executor:path,
$runtime_api:path, $executor:path,
$runner:ident, $components:ident, $cli:ident, $cmd:ident, $config:ident,
$( $code:tt )*
) => {
$runner.async_run(|$config| {
let $components = new_partial::<
$runtime, $runtime_api, $executor, _
>(
let $components = new_partial::<$runtime_api, $executor, _>(
&$config,
crate::service::parachain_build_import_queue::<$runtime, _, _>,
crate::service::parachain_build_import_queue,
)?;
let task_manager = $components.task_manager;

Expand All @@ -188,18 +186,18 @@ macro_rules! construct_async_run {
match runner.config().chain_spec.runtime_id() {
#[cfg(feature = "unique-runtime")]
RuntimeId::Unique => async_run_with_runtime!(
unique_runtime::Runtime, unique_runtime::RuntimeApi, UniqueRuntimeExecutor,
unique_runtime::RuntimeApi, UniqueRuntimeExecutor,
runner, $components, $cli, $cmd, $config, $( $code )*
),

#[cfg(feature = "quartz-runtime")]
RuntimeId::Quartz => async_run_with_runtime!(
quartz_runtime::Runtime, quartz_runtime::RuntimeApi, QuartzRuntimeExecutor,
quartz_runtime::RuntimeApi, QuartzRuntimeExecutor,
runner, $components, $cli, $cmd, $config, $( $code )*
),

RuntimeId::Opal => async_run_with_runtime!(
opal_runtime::Runtime, opal_runtime::RuntimeApi, OpalRuntimeExecutor,
opal_runtime::RuntimeApi, OpalRuntimeExecutor,
runner, $components, $cli, $cmd, $config, $( $code )*
),

Expand All @@ -215,11 +213,9 @@ macro_rules! sync_run_with_runtime {
$( $code:tt )*
) => {
$runner.sync_run(|$config| {
let $components = new_partial::<
$runtime, $runtime_api, $executor, _
>(
let $components = new_partial::<$runtime_api, $executor, _>(
&$config,
crate::service::parachain_build_import_queue::<$runtime, _, _>,
crate::service::parachain_build_import_queue,
)?;

$( $code )*
Expand Down Expand Up @@ -259,20 +255,17 @@ macro_rules! start_node_using_chain_runtime {
match $config.chain_spec.runtime_id() {
#[cfg(feature = "unique-runtime")]
RuntimeId::Unique => $start_node_fn::<
unique_runtime::Runtime,
unique_runtime::RuntimeApi,
UniqueRuntimeExecutor,
>($config $(, $($args),+)?) $($code)*,

#[cfg(feature = "quartz-runtime")]
RuntimeId::Quartz => $start_node_fn::<
quartz_runtime::Runtime,
quartz_runtime::RuntimeApi,
QuartzRuntimeExecutor,
>($config $(, $($args),+)?) $($code)*,

RuntimeId::Opal => $start_node_fn::<
opal_runtime::Runtime,
opal_runtime::RuntimeApi,
OpalRuntimeExecutor,
>($config $(, $($args),+)?) $($code)*,
Expand Down Expand Up @@ -361,26 +354,16 @@ pub fn run() -> Result<()> {
runner.sync_run(|config| cmd.run::<Block, SubstrateHostFunctions>(config))
}
BenchmarkCmd::Block(cmd) => runner.sync_run(|config| {
let partials = new_partial::<
opal_runtime::Runtime,
opal_runtime::RuntimeApi,
OpalRuntimeExecutor,
_,
>(
let partials = new_partial::<opal_runtime::RuntimeApi, OpalRuntimeExecutor, _>(
&config,
crate::service::parachain_build_import_queue::<opal_runtime::Runtime, _, _>,
crate::service::parachain_build_import_queue,
)?;
cmd.run(partials.client)
}),
BenchmarkCmd::Storage(cmd) => runner.sync_run(|config| {
let partials = new_partial::<
opal_runtime::Runtime,
opal_runtime::RuntimeApi,
OpalRuntimeExecutor,
_,
>(
let partials = new_partial::<opal_runtime::RuntimeApi, OpalRuntimeExecutor, _>(
&config,
crate::service::parachain_build_import_queue::<opal_runtime::Runtime, _, _>,
crate::service::parachain_build_import_queue,
)?;
let db = partials.backend.expose_db();
let storage = partials.backend.expose_storage();
Expand Down
12 changes: 4 additions & 8 deletions node/cli/src/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ pub struct FullDeps<C, P, SC> {
}

/// Instantiate all Full RPC extensions.
pub fn create_full<C, P, SC, R, B>(
pub fn create_full<C, P, SC, B>(
io: &mut RpcModule<()>,
deps: FullDeps<C, P, SC>,
) -> Result<(), Box<dyn std::error::Error + Send + Sync>>
Expand All @@ -74,18 +74,15 @@ where
C: HeaderBackend<Block> + HeaderMetadata<Block, Error = BlockChainError> + 'static,
C: Send + Sync + 'static,
C: BlockchainEvents<Block>,
C::Api: RuntimeApiDep<R>,
C::Api: RuntimeApiDep,
B: sc_client_api::Backend<Block> + Send + Sync + 'static,
P: TransactionPool<Block = Block> + 'static,
R: RuntimeInstance + Send + Sync + 'static,
<R as RuntimeInstance>::CrossAccountId: serde::Serialize,
C: sp_api::CallApiAt<
sp_runtime::generic::Block<
sp_runtime::generic::Header<u32, BlakeTwo256>,
sp_runtime::OpaqueExtrinsic,
>,
>,
for<'de> <R as RuntimeInstance>::CrossAccountId: serde::Deserialize<'de>,
{
// use pallet_contracts_rpc::{Contracts, ContractsApi};
use pallet_transaction_payment_rpc::{TransactionPayment, TransactionPaymentApiServer};
Expand Down Expand Up @@ -165,7 +162,7 @@ pub struct EthDeps<C, P, CA: ChainApi, CIDP> {
pub pending_create_inherent_data_providers: CIDP,
}

pub fn create_eth<C, R, P, CA, B, CIDP, EC>(
pub fn create_eth<C, P, CA, B, CIDP, EC>(
io: &mut RpcModule<()>,
deps: EthDeps<C, P, CA, CIDP>,
subscription_task_executor: SubscriptionTaskExecutor,
Expand All @@ -176,14 +173,13 @@ where
C: Send + Sync + 'static,
C: BlockchainEvents<Block>,
C: UsageProvider<Block>,
C::Api: RuntimeApiDep<R>,
C::Api: RuntimeApiDep,
P: TransactionPool<Block = Block> + 'static,
CA: ChainApi<Block = Block> + 'static,
B: sc_client_api::Backend<Block> + Send + Sync + 'static,
C: sp_api::CallApiAt<Block>,
CIDP: CreateInherentDataProviders<Block, ()> + Send + 'static,
EC: EthConfig<Block, C>,
R: RuntimeInstance,
{
use fc_rpc::{
Eth, EthApiServer, EthDevSigner, EthFilter, EthFilterApiServer, EthPubSub,
Expand Down
Loading
Loading