diff --git a/Cargo.lock b/Cargo.lock index 7f1bd37f9e..6fc983e8d5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -174,7 +174,7 @@ checksum = "9b34d609dfbaf33d6889b2b7106d3ca345eacad44200913df5ba02bfd31d2ba9" [[package]] name = "astar-collator" -version = "4.44.0" +version = "4.45.0" dependencies = [ "astar-runtime", "async-trait", @@ -264,7 +264,7 @@ dependencies = [ [[package]] name = "astar-runtime" -version = "4.44.0" +version = "4.45.0" dependencies = [ "array-bytes 6.0.0", "cumulus-pallet-aura-ext", @@ -4702,7 +4702,7 @@ checksum = "f051f77a7c8e6957c0696eac88f26b0117e54f52d3fc682ab19397a8812846a4" [[package]] name = "local-runtime" -version = "4.44.0" +version = "4.45.0" dependencies = [ "array-bytes 6.0.0", "fp-rpc", @@ -10745,7 +10745,7 @@ dependencies = [ [[package]] name = "shibuya-runtime" -version = "4.44.0" +version = "4.45.0" dependencies = [ "array-bytes 6.0.0", "cumulus-pallet-aura-ext", @@ -10845,7 +10845,7 @@ dependencies = [ [[package]] name = "shiden-runtime" -version = "4.44.0" +version = "4.45.0" dependencies = [ "array-bytes 6.0.0", "cumulus-pallet-aura-ext", diff --git a/bin/collator/Cargo.toml b/bin/collator/Cargo.toml index 17f2072312..7bf560bdab 100644 --- a/bin/collator/Cargo.toml +++ b/bin/collator/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "astar-collator" -version = "4.44.0" +version = "4.45.0" authors = ["Stake Technologies "] description = "Astar collator implementation in Rust." build = "build.rs" diff --git a/bin/collator/src/cli.rs b/bin/collator/src/cli.rs index aff17db6a3..271e7e9c3a 100644 --- a/bin/collator/src/cli.rs +++ b/bin/collator/src/cli.rs @@ -30,6 +30,10 @@ pub struct Cli { #[clap(flatten)] pub run: cumulus_client_cli::RunCmd, + /// Enable Ethereum compatible JSON-RPC servers (disabled by default). + #[clap(name = "enable-evm-rpc")] + pub enable_evm_rpc: bool, + /// Relaychain arguments #[clap(raw = true)] pub relaychain_args: Vec, diff --git a/bin/collator/src/command.rs b/bin/collator/src/command.rs index 0c10f86e0f..c12febe9ee 100644 --- a/bin/collator/src/command.rs +++ b/bin/collator/src/command.rs @@ -701,17 +701,17 @@ pub fn run() -> Result<()> { ); if config.chain_spec.is_astar() { - start_astar_node(config, polkadot_config, collator_options, para_id) + start_astar_node(config, polkadot_config, collator_options, para_id, cli.enable_evm_rpc) .await .map(|r| r.0) .map_err(Into::into) } else if config.chain_spec.is_shiden() { - start_shiden_node(config, polkadot_config, collator_options, para_id) + start_shiden_node(config, polkadot_config, collator_options, para_id, cli.enable_evm_rpc) .await .map(|r| r.0) .map_err(Into::into) } else if config.chain_spec.is_shibuya() { - start_shibuya_node(config, polkadot_config, collator_options, para_id) + start_shibuya_node(config, polkadot_config, collator_options, para_id, cli.enable_evm_rpc) .await .map(|r| r.0) .map_err(Into::into) diff --git a/bin/collator/src/local/service.rs b/bin/collator/src/local/service.rs index a69259ce53..2b5fa191da 100644 --- a/bin/collator/src/local/service.rs +++ b/bin/collator/src/local/service.rs @@ -305,6 +305,7 @@ pub fn start_node(config: Configuration) -> Result { fee_history_cache: fee_history_cache.clone(), block_data_cache: block_data_cache.clone(), overrides: overrides.clone(), + enable_evm_rpc: true, // enable EVM RPC for dev node by default }; crate::rpc::create_full(deps, subscription).map_err::(Into::into) diff --git a/bin/collator/src/parachain/service.rs b/bin/collator/src/parachain/service.rs index 17e881d1d6..4d5d0a2f76 100644 --- a/bin/collator/src/parachain/service.rs +++ b/bin/collator/src/parachain/service.rs @@ -299,6 +299,7 @@ async fn start_node_impl( polkadot_config: Configuration, collator_options: CollatorOptions, id: ParaId, + enable_evm_rpc: bool, build_import_queue: BIQ, build_consensus: BIC, ) -> sc_service::error::Result<( @@ -484,6 +485,7 @@ where fee_history_cache: fee_history_cache.clone(), block_data_cache: block_data_cache.clone(), overrides: overrides.clone(), + enable_evm_rpc, }; crate::rpc::create_full(deps, subscription).map_err(Into::into) @@ -657,6 +659,7 @@ pub async fn start_astar_node( polkadot_config: Configuration, collator_options: CollatorOptions, id: ParaId, + enable_evm_rpc: bool, ) -> sc_service::error::Result<( TaskManager, Arc>>, @@ -666,6 +669,7 @@ pub async fn start_astar_node( polkadot_config, collator_options, id, + enable_evm_rpc, |client, block_import, config, @@ -785,6 +789,7 @@ pub async fn start_shiden_node( polkadot_config: Configuration, collator_options: CollatorOptions, id: ParaId, + enable_evm_rpc: bool, ) -> sc_service::error::Result<( TaskManager, Arc>>, @@ -794,6 +799,7 @@ pub async fn start_shiden_node( polkadot_config, collator_options, id, + enable_evm_rpc, |client, block_import, config, @@ -913,6 +919,7 @@ pub async fn start_shibuya_node( polkadot_config: Configuration, collator_options: CollatorOptions, id: ParaId, + enable_evm_rpc: bool, ) -> sc_service::error::Result<( TaskManager, Arc>>, @@ -922,6 +929,7 @@ pub async fn start_shibuya_node( polkadot_config, collator_options, id, + enable_evm_rpc, |client, block_import, config, diff --git a/bin/collator/src/rpc.rs b/bin/collator/src/rpc.rs index 3f1abece5e..54e3c89988 100644 --- a/bin/collator/src/rpc.rs +++ b/bin/collator/src/rpc.rs @@ -132,6 +132,8 @@ pub struct FullDeps { pub overrides: Arc>, /// Cache for Ethereum block data. pub block_data_cache: Arc>, + /// Enable EVM RPC servers + pub enable_evm_rpc: bool, } /// Instantiate all RPC extensions. @@ -175,10 +177,16 @@ where fee_history_cache, overrides, block_data_cache, + enable_evm_rpc, } = deps; io.merge(System::new(client.clone(), pool.clone(), deny_unsafe).into_rpc())?; io.merge(TransactionPayment::new(client.clone()).into_rpc())?; + io.merge(sc_rpc::dev::Dev::new(client.clone(), deny_unsafe).into_rpc())?; + + if !enable_evm_rpc { + return Ok(io); + } let no_tx_converter: Option = None; @@ -220,8 +228,6 @@ where io.merge(Web3::new(client.clone()).into_rpc())?; - io.merge(sc_rpc::dev::Dev::new(client.clone(), deny_unsafe).into_rpc())?; - io.merge( EthPubSub::new(pool, client, network, subscription_task_executor, overrides).into_rpc(), )?; diff --git a/runtime/astar/Cargo.toml b/runtime/astar/Cargo.toml index 8ed43686ec..717a6a11bb 100644 --- a/runtime/astar/Cargo.toml +++ b/runtime/astar/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "astar-runtime" -version = "4.44.0" +version = "4.45.0" authors = ["Stake Technologies "] edition = "2021" build = "build.rs" diff --git a/runtime/local/Cargo.toml b/runtime/local/Cargo.toml index 2e625bf985..f69344b734 100644 --- a/runtime/local/Cargo.toml +++ b/runtime/local/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "local-runtime" -version = "4.44.0" +version = "4.45.0" authors = ["Stake Technologies "] edition = "2021" build = "build.rs" diff --git a/runtime/shibuya/Cargo.toml b/runtime/shibuya/Cargo.toml index ae51f0b8f4..dff4b6c7e4 100644 --- a/runtime/shibuya/Cargo.toml +++ b/runtime/shibuya/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "shibuya-runtime" -version = "4.44.0" +version = "4.45.0" authors = ["Stake Technologies "] edition = "2021" build = "build.rs" diff --git a/runtime/shiden/Cargo.toml b/runtime/shiden/Cargo.toml index c878243a82..e75955f442 100644 --- a/runtime/shiden/Cargo.toml +++ b/runtime/shiden/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "shiden-runtime" -version = "4.44.0" +version = "4.45.0" authors = ["Stake Technologies "] edition = "2021" build = "build.rs" diff --git a/third-party/zombienet/multi_parachains.toml b/third-party/zombienet/multi_parachains.toml index aa09ad10d5..2c1043abff 100644 --- a/third-party/zombienet/multi_parachains.toml +++ b/third-party/zombienet/multi_parachains.toml @@ -35,7 +35,7 @@ cumulus_based = true name = "collator1" command = "./astar-collator" rpc_port = 8545 - args = [ "-l=xcm=trace" ] + args = [ "-l=xcm=trace", "--enable-evm-rpc" ] # For this one you can download or build some other para and run it. # In this example, `astar-collator` is reused but `shiden-dev` chain is used @@ -47,7 +47,7 @@ cumulus_based = true [[parachains.collators]] name = "collator2" command = "./astar-collator" - args = [ "-l=xcm=trace" ] + args = [ "-l=xcm=trace", "--enable-evm-rpc" ] [[hrmp_channels]] sender = 2000 diff --git a/third-party/zombienet/single_parachain.toml b/third-party/zombienet/single_parachain.toml index 1ce9fccc75..43f3eae13c 100644 --- a/third-party/zombienet/single_parachain.toml +++ b/third-party/zombienet/single_parachain.toml @@ -34,9 +34,10 @@ cumulus_based = true [[parachains.collators]] name = "collator1" command = "./astar-collator" - args = [ "-l=xcm=trace" ] + args = [ "-l=xcm=trace", "--enable-evm-rpc" ] [[parachains.collators]] name = "collator2" command = "./astar-collator" + args = [ "--enable-evm-rpc" ]