From fa9283a2d4e0303081800f227b2d9035c692e030 Mon Sep 17 00:00:00 2001 From: Nikolai Golub Date: Thu, 8 Aug 2024 11:23:19 +0200 Subject: [PATCH 1/6] Do not import `JsInspectorError` by default --- crates/rpc/rpc-eth-types/Cargo.toml | 7 ++++++- crates/rpc/rpc-eth-types/src/error.rs | 5 ++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/crates/rpc/rpc-eth-types/Cargo.toml b/crates/rpc/rpc-eth-types/Cargo.toml index 5add0b976d3b..b8d996698942 100644 --- a/crates/rpc/rpc-eth-types/Cargo.toml +++ b/crates/rpc/rpc-eth-types/Cargo.toml @@ -31,7 +31,7 @@ reth-trie.workspace = true # ethereum alloy-sol-types.workspace = true revm.workspace = true -revm-inspectors = { workspace = true, features = ["js-tracer"] } +revm-inspectors = { workspace = true } revm-primitives = { workspace = true, features = ["dev"] } # rpc @@ -56,3 +56,8 @@ tracing.workspace = true [dev-dependencies] serde_json.workspace = true + + +[features] +default = ["js_tracer_errors"] +js_tracer_errors = ["revm-inspectors/js-tracer"] \ No newline at end of file diff --git a/crates/rpc/rpc-eth-types/src/error.rs b/crates/rpc/rpc-eth-types/src/error.rs index a6d07b76e05a..d5daf53de761 100644 --- a/crates/rpc/rpc-eth-types/src/error.rs +++ b/crates/rpc/rpc-eth-types/src/error.rs @@ -16,7 +16,9 @@ use reth_transaction_pool::error::{ PoolTransactionError, }; use revm::primitives::{EVMError, ExecutionResult, HaltReason, OutOfGasError}; -use revm_inspectors::tracing::{js::JsInspectorError, MuxError}; +use revm_inspectors::tracing::MuxError; +#[cfg(feature = "js_tracer_errors")] +use revm_inspectors::tracing::{js::JsInspectorError}; use tracing::error; /// Result alias @@ -191,6 +193,7 @@ impl From for jsonrpsee_types::error::ErrorObject<'static> { } } +#[cfg(feature = "js_tracer_errors")] impl From for EthApiError { fn from(error: JsInspectorError) -> Self { match error { From 0e490e15ba47a21eaf68365cbaccd9c805d924c4 Mon Sep 17 00:00:00 2001 From: Nikolai Golub Date: Thu, 8 Aug 2024 11:41:56 +0200 Subject: [PATCH 2/6] Fix formatting --- crates/rpc/rpc-eth-types/src/error.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/rpc/rpc-eth-types/src/error.rs b/crates/rpc/rpc-eth-types/src/error.rs index d5daf53de761..1e0e0729555b 100644 --- a/crates/rpc/rpc-eth-types/src/error.rs +++ b/crates/rpc/rpc-eth-types/src/error.rs @@ -16,9 +16,9 @@ use reth_transaction_pool::error::{ PoolTransactionError, }; use revm::primitives::{EVMError, ExecutionResult, HaltReason, OutOfGasError}; -use revm_inspectors::tracing::MuxError; #[cfg(feature = "js_tracer_errors")] -use revm_inspectors::tracing::{js::JsInspectorError}; +use revm_inspectors::tracing::js::JsInspectorError; +use revm_inspectors::tracing::MuxError; use tracing::error; /// Result alias From 892c8c46d43de979d8ed6ca0e642e4cdfc8be40c Mon Sep 17 00:00:00 2001 From: Nikolai Golub Date: Thu, 8 Aug 2024 13:14:00 +0200 Subject: [PATCH 3/6] Update crates/rpc/rpc-eth-types/Cargo.toml Co-authored-by: Matthias Seitz --- crates/rpc/rpc-eth-types/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/rpc/rpc-eth-types/Cargo.toml b/crates/rpc/rpc-eth-types/Cargo.toml index b8d996698942..b09af8498492 100644 --- a/crates/rpc/rpc-eth-types/Cargo.toml +++ b/crates/rpc/rpc-eth-types/Cargo.toml @@ -31,7 +31,7 @@ reth-trie.workspace = true # ethereum alloy-sol-types.workspace = true revm.workspace = true -revm-inspectors = { workspace = true } +revm-inspectors.workspace revm-primitives = { workspace = true, features = ["dev"] } # rpc From 2b79e2a20b8bbbca8b432a39b616c1e07eab2c0a Mon Sep 17 00:00:00 2001 From: Nikolai Golub Date: Thu, 8 Aug 2024 13:15:23 +0200 Subject: [PATCH 4/6] Rename feature --- crates/rpc/rpc-eth-types/Cargo.toml | 4 ++-- crates/rpc/rpc-eth-types/src/error.rs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/crates/rpc/rpc-eth-types/Cargo.toml b/crates/rpc/rpc-eth-types/Cargo.toml index b09af8498492..8f59e7b7da56 100644 --- a/crates/rpc/rpc-eth-types/Cargo.toml +++ b/crates/rpc/rpc-eth-types/Cargo.toml @@ -59,5 +59,5 @@ serde_json.workspace = true [features] -default = ["js_tracer_errors"] -js_tracer_errors = ["revm-inspectors/js-tracer"] \ No newline at end of file +default = ["js-tracer"] +js-tracer = ["revm-inspectors/js-tracer"] \ No newline at end of file diff --git a/crates/rpc/rpc-eth-types/src/error.rs b/crates/rpc/rpc-eth-types/src/error.rs index 1e0e0729555b..25e76b2db44b 100644 --- a/crates/rpc/rpc-eth-types/src/error.rs +++ b/crates/rpc/rpc-eth-types/src/error.rs @@ -16,7 +16,7 @@ use reth_transaction_pool::error::{ PoolTransactionError, }; use revm::primitives::{EVMError, ExecutionResult, HaltReason, OutOfGasError}; -#[cfg(feature = "js_tracer_errors")] +#[cfg(feature = "js-tracer")] use revm_inspectors::tracing::js::JsInspectorError; use revm_inspectors::tracing::MuxError; use tracing::error; @@ -193,7 +193,7 @@ impl From for jsonrpsee_types::error::ErrorObject<'static> { } } -#[cfg(feature = "js_tracer_errors")] +#[cfg(feature = "js-tracer")] impl From for EthApiError { fn from(error: JsInspectorError) -> Self { match error { From 83c59f3e1dbacac73b49accb245119b6d688ceba Mon Sep 17 00:00:00 2001 From: Nikolai Golub Date: Thu, 8 Aug 2024 13:22:15 +0200 Subject: [PATCH 5/6] Import js-tracer only where it is needed --- Cargo.toml | 2 +- crates/rpc/rpc-eth-api/Cargo.toml | 3 ++- crates/rpc/rpc-eth-types/Cargo.toml | 2 +- crates/rpc/rpc/Cargo.toml | 1 + 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 0eeb57e5dd98..408b8ee328d3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -357,7 +357,7 @@ reth-rpc-api-testing-util = { path = "crates/rpc/rpc-testing-util" } reth-rpc-builder = { path = "crates/rpc/rpc-builder" } reth-rpc-engine-api = { path = "crates/rpc/rpc-engine-api" } reth-rpc-eth-api = { path = "crates/rpc/rpc-eth-api" } -reth-rpc-eth-types = { path = "crates/rpc/rpc-eth-types" } +reth-rpc-eth-types = { path = "crates/rpc/rpc-eth-types", default-features = false } reth-rpc-layer = { path = "crates/rpc/rpc-layer" } reth-rpc-server-types = { path = "crates/rpc/rpc-server-types" } reth-rpc-types = { path = "crates/rpc/rpc-types" } diff --git a/crates/rpc/rpc-eth-api/Cargo.toml b/crates/rpc/rpc-eth-api/Cargo.toml index 06b193cf5915..82fbacf6d99b 100644 --- a/crates/rpc/rpc-eth-api/Cargo.toml +++ b/crates/rpc/rpc-eth-api/Cargo.toml @@ -55,4 +55,5 @@ optimism = [ "reth-primitives/optimism", "revm/optimism", "reth-provider/optimism", -] + "reth-rpc-eth-types/js-tracer", +] \ No newline at end of file diff --git a/crates/rpc/rpc-eth-types/Cargo.toml b/crates/rpc/rpc-eth-types/Cargo.toml index 8f59e7b7da56..d2460a276301 100644 --- a/crates/rpc/rpc-eth-types/Cargo.toml +++ b/crates/rpc/rpc-eth-types/Cargo.toml @@ -31,7 +31,7 @@ reth-trie.workspace = true # ethereum alloy-sol-types.workspace = true revm.workspace = true -revm-inspectors.workspace +revm-inspectors.workspace = true revm-primitives = { workspace = true, features = ["dev"] } # rpc diff --git a/crates/rpc/rpc/Cargo.toml b/crates/rpc/rpc/Cargo.toml index 68df91e0bca7..ac802cb49d46 100644 --- a/crates/rpc/rpc/Cargo.toml +++ b/crates/rpc/rpc/Cargo.toml @@ -91,4 +91,5 @@ optimism = [ "reth-provider/optimism", "reth-rpc-eth-api/optimism", "reth-revm/optimism", + "reth-rpc-eth-types/js-tracer", ] From 2646c5593fe4b0b5da3d02faa65556be91d01439 Mon Sep 17 00:00:00 2001 From: Nikolai Golub Date: Thu, 8 Aug 2024 14:06:46 +0200 Subject: [PATCH 6/6] Explicitly set feature --- crates/rpc/rpc-eth-api/Cargo.toml | 3 +-- crates/rpc/rpc/Cargo.toml | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/crates/rpc/rpc-eth-api/Cargo.toml b/crates/rpc/rpc-eth-api/Cargo.toml index 82fbacf6d99b..5cd79c27c6fc 100644 --- a/crates/rpc/rpc-eth-api/Cargo.toml +++ b/crates/rpc/rpc-eth-api/Cargo.toml @@ -27,7 +27,7 @@ reth-tasks = { workspace = true, features = ["rayon"] } reth-transaction-pool.workspace = true reth-chainspec.workspace = true reth-execution-types.workspace = true -reth-rpc-eth-types.workspace = true +reth-rpc-eth-types = { workspace = true, features = ["js-tracer"] } reth-rpc-server-types.workspace = true reth-network-api.workspace = true @@ -55,5 +55,4 @@ optimism = [ "reth-primitives/optimism", "revm/optimism", "reth-provider/optimism", - "reth-rpc-eth-types/js-tracer", ] \ No newline at end of file diff --git a/crates/rpc/rpc/Cargo.toml b/crates/rpc/rpc/Cargo.toml index ac802cb49d46..02636508af49 100644 --- a/crates/rpc/rpc/Cargo.toml +++ b/crates/rpc/rpc/Cargo.toml @@ -30,7 +30,7 @@ reth-rpc-types-compat.workspace = true revm-inspectors = { workspace = true, features = ["js-tracer"] } reth-network-peers = { workspace = true, features = ["secp256k1"] } reth-evm.workspace = true -reth-rpc-eth-types.workspace = true +reth-rpc-eth-types = { workspace = true, features = ["js-tracer"] } reth-rpc-server-types.workspace = true reth-node-api.workspace = true reth-network-types.workspace = true @@ -91,5 +91,4 @@ optimism = [ "reth-provider/optimism", "reth-rpc-eth-api/optimism", "reth-revm/optimism", - "reth-rpc-eth-types/js-tracer", ]