Skip to content

Commit

Permalink
P-681 Merge EVM and non-EVM code (#2644)
Browse files Browse the repository at this point in the history
* feat: try fake litentry/litmus evm implementation

* debug: remove usage of reuse

* debug: reuse code

* debug: fake cargo toml part

* debug: 	add fake pending_block

* debug: quick fix

* debug: missing cargo.toml

* remove evm mod

---------

Co-authored-by: Kailai Wang <Kailai.Wang@hotmail.com>
  • Loading branch information
wangminqi and Kailai-Wang committed Apr 23, 2024
1 parent 532c502 commit 5188d35
Show file tree
Hide file tree
Showing 9 changed files with 1,455 additions and 1,499 deletions.
14 changes: 14 additions & 0 deletions Cargo.lock

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

54 changes: 33 additions & 21 deletions node/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,7 @@
use crate::{
chain_specs,
cli::{Cli, RelayChainCli, Subcommand},
service::{
evm::{
new_partial, AdditionalConfig, LitentryParachainRuntimeExecutor,
LitmusParachainRuntimeExecutor, RococoParachainRuntimeExecutor,
},
*,
},
service::*,
};
use cumulus_client_cli::generate_genesis_block;
use cumulus_primitives_core::ParaId;
Expand Down Expand Up @@ -221,17 +215,31 @@ impl SubstrateCli for RelayChainCli {
macro_rules! construct_benchmark_partials {
($config:expr, |$partials:ident| $code:expr) => {
if $config.chain_spec.is_litmus() {
let $partials = no_evm::new_partial::<litmus_parachain_runtime::RuntimeApi, _>(
let $partials = new_partial::<
litmus_parachain_runtime::RuntimeApi,
LitmusParachainRuntimeExecutor,
_,
>(
&$config,
false,
crate::service::no_evm::build_import_queue::<litmus_parachain_runtime::RuntimeApi>,
crate::service::build_import_queue::<
litmus_parachain_runtime::RuntimeApi,
LitmusParachainRuntimeExecutor,
>,
)?;
$code
} else if $config.chain_spec.is_litentry() {
let $partials = no_evm::new_partial::<litentry_parachain_runtime::RuntimeApi, _>(
let $partials = new_partial::<
litentry_parachain_runtime::RuntimeApi,
LitentryParachainRuntimeExecutor,
_,
>(
&$config,
false,
crate::service::no_evm::build_import_queue::<litentry_parachain_runtime::RuntimeApi>,
crate::service::build_import_queue::<
litentry_parachain_runtime::RuntimeApi,
LitentryParachainRuntimeExecutor,
>,
)?;
$code
} else if $config.chain_spec.is_rococo() {
Expand All @@ -242,7 +250,7 @@ macro_rules! construct_benchmark_partials {
>(
&$config,
false,
crate::service::evm::build_import_queue::<
crate::service::build_import_queue::<
rococo_parachain_runtime::RuntimeApi,
RococoParachainRuntimeExecutor,
>,
Expand All @@ -260,26 +268,28 @@ macro_rules! construct_async_run {

if runner.config().chain_spec.is_litmus() {
runner.async_run(|$config| {
let $components = no_evm::new_partial::<
let $components = new_partial::<
litmus_parachain_runtime::RuntimeApi,
LitmusParachainRuntimeExecutor,
_
>(
&$config,
false,
crate::service::no_evm::build_import_queue::<litmus_parachain_runtime::RuntimeApi>,
crate::service::build_import_queue::<litmus_parachain_runtime::RuntimeApi, LitmusParachainRuntimeExecutor>,
)?;
let task_manager = $components.task_manager;
{ $( $code )* }.map(|v| (v, task_manager))
})
} else if runner.config().chain_spec.is_litentry() {
runner.async_run(|$config| {
let $components = no_evm::new_partial::<
let $components = new_partial::<
litentry_parachain_runtime::RuntimeApi,
LitentryParachainRuntimeExecutor,
_
>(
&$config,
false,
crate::service::no_evm::build_import_queue::<litentry_parachain_runtime::RuntimeApi>,
crate::service::build_import_queue::<litentry_parachain_runtime::RuntimeApi, LitentryParachainRuntimeExecutor>,
)?;
let task_manager = $components.task_manager;
{ $( $code )* }.map(|v| (v, task_manager))
Expand All @@ -293,7 +303,7 @@ macro_rules! construct_async_run {
>(
&$config,
false,
crate::service::evm::build_import_queue::<rococo_parachain_runtime::RuntimeApi, RococoParachainRuntimeExecutor>,
crate::service::build_import_queue::<rococo_parachain_runtime::RuntimeApi, RococoParachainRuntimeExecutor>,
)?;
let task_manager = $components.task_manager;
{ $( $code )* }.map(|v| (v, task_manager))
Expand Down Expand Up @@ -499,7 +509,7 @@ pub fn run() -> Result<()> {

runner.run_node_until_exit(|config| async move {
if is_standalone {
return crate::service::evm::start_standalone_node::<rococo_parachain_runtime::RuntimeApi, RococoParachainRuntimeExecutor>(
return crate::service::start_standalone_node::<rococo_parachain_runtime::RuntimeApi, RococoParachainRuntimeExecutor>(
config,
evm_tracing_config
)
Expand Down Expand Up @@ -557,29 +567,31 @@ pub fn run() -> Result<()> {
};

if config.chain_spec.is_litmus() {
crate::service::no_evm::start_node::<litmus_parachain_runtime::RuntimeApi>(
crate::service::start_node::<litmus_parachain_runtime::RuntimeApi, LitmusParachainRuntimeExecutor>(
config,
polkadot_config,
collator_options,
id,
additional_config,
hwbench,
)
.await
.map(|r| r.0)
.map_err(Into::into)
} else if config.chain_spec.is_litentry() {
crate::service::no_evm::start_node::<litentry_parachain_runtime::RuntimeApi>(
crate::service::start_node::<litentry_parachain_runtime::RuntimeApi, LitentryParachainRuntimeExecutor>(
config,
polkadot_config,
collator_options,
id,
additional_config,
hwbench,
)
.await
.map(|r| r.0)
.map_err(Into::into)
} else if config.chain_spec.is_rococo() {
crate::service::evm::start_node::<rococo_parachain_runtime::RuntimeApi, RococoParachainRuntimeExecutor>(
crate::service::start_node::<rococo_parachain_runtime::RuntimeApi, RococoParachainRuntimeExecutor>(
config,
polkadot_config,
collator_options,
Expand Down
Loading

0 comments on commit 5188d35

Please sign in to comment.