diff --git a/Cargo.lock b/Cargo.lock index f3c40d8afe9a..408972b00cce 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8950,9 +8950,9 @@ dependencies = [ [[package]] name = "revm-inspectors" -version = "0.5.6" +version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43cbb1576a147317c6990cf69d6cd5ef402df99f638616ba911006e9ec45866b" +checksum = "ec16f9b9d3cdaaf2f4b7ceaf004eb2c89df04e7ea29622584c0a6ec676bd0a83" dependencies = [ "alloy-primitives", "alloy-rpc-types", diff --git a/crates/rpc/rpc-builder/Cargo.toml b/crates/rpc/rpc-builder/Cargo.toml index d410268a2df2..1e693ceb0d9f 100644 --- a/crates/rpc/rpc-builder/Cargo.toml +++ b/crates/rpc/rpc-builder/Cargo.toml @@ -17,7 +17,7 @@ reth-ipc.workspace = true reth-network-api.workspace = true reth-node-core.workspace = true reth-provider.workspace = true -reth-rpc.workspace = true +reth-rpc = { workspace = true, features = ["js-tracer"] } reth-rpc-api.workspace = true reth-rpc-eth-api.workspace = true reth-rpc-layer.workspace = true diff --git a/crates/rpc/rpc-eth-api/Cargo.toml b/crates/rpc/rpc-eth-api/Cargo.toml index af747fb322ef..d571e4f82f48 100644 --- a/crates/rpc/rpc-eth-api/Cargo.toml +++ b/crates/rpc/rpc-eth-api/Cargo.toml @@ -50,7 +50,6 @@ dyn-clone.workspace = true tracing.workspace = true [features] -default = ["js-tracer"] js-tracer = ["revm-inspectors/js-tracer", "reth-rpc-eth-types/js-tracer"] client = ["jsonrpsee/client", "jsonrpsee/async-client"] optimism = [ diff --git a/crates/rpc/rpc-eth-types/Cargo.toml b/crates/rpc/rpc-eth-types/Cargo.toml index d2460a276301..25be4a246735 100644 --- a/crates/rpc/rpc-eth-types/Cargo.toml +++ b/crates/rpc/rpc-eth-types/Cargo.toml @@ -59,5 +59,4 @@ serde_json.workspace = true [features] -default = ["js-tracer"] js-tracer = ["revm-inspectors/js-tracer"] \ No newline at end of file diff --git a/crates/rpc/rpc/Cargo.toml b/crates/rpc/rpc/Cargo.toml index 572f59b81867..0142545f45c9 100644 --- a/crates/rpc/rpc/Cargo.toml +++ b/crates/rpc/rpc/Cargo.toml @@ -84,7 +84,6 @@ jsonrpsee-types.workspace = true jsonrpsee = { workspace = true, features = ["client"] } [features] -default = ["js-tracer"] js-tracer = ["revm-inspectors/js-tracer", "reth-rpc-eth-types/js-tracer"] optimism = [ "reth-primitives/optimism", diff --git a/crates/rpc/rpc/src/debug.rs b/crates/rpc/rpc/src/debug.rs index d41c986128ea..d467392a4dfa 100644 --- a/crates/rpc/rpc/src/debug.rs +++ b/crates/rpc/rpc/src/debug.rs @@ -34,8 +34,7 @@ use revm::{ StateBuilder, }; use revm_inspectors::tracing::{ - js::{JsInspector, TransactionContext}, - FourByteInspector, MuxInspector, TracingInspector, TracingInspectorConfig, + FourByteInspector, MuxInspector, TracingInspector, TracingInspectorConfig, TransactionContext, }; use revm_primitives::{keccak256, HashMap}; use std::sync::Arc; @@ -388,6 +387,11 @@ where return Ok(frame) } }, + #[cfg(not(feature = "js-tracer"))] + GethDebugTracerType::JsTracer(_) => { + Err(EthApiError::Unsupported("JS Tracer is not enabled").into()) + } + #[cfg(feature = "js-tracer")] GethDebugTracerType::JsTracer(code) => { let config = tracer_config.into_json(); @@ -402,7 +406,8 @@ where let db = db.0; let mut inspector = - JsInspector::new(code, config).map_err(Eth::Error::from_eth_err)?; + revm_inspectors::tracing::js::JsInspector::new(code, config) + .map_err(Eth::Error::from_eth_err)?; let (res, _) = this.eth_api().inspect(&mut *db, env.clone(), &mut inspector)?; inspector.json_result(res, &env, db).map_err(Eth::Error::from_eth_err) @@ -671,7 +676,7 @@ where opts: GethDebugTracingOptions, env: EnvWithHandlerCfg, db: &mut StateCacheDb<'_>, - transaction_context: Option, + _transaction_context: Option, ) -> Result<(GethTrace, revm_primitives::EvmState), Eth::Error> { let GethDebugTracingOptions { config, tracer, tracer_config, .. } = opts; @@ -737,14 +742,20 @@ where return Ok((frame.into(), res.state)) } }, + #[cfg(not(feature = "js-tracer"))] + GethDebugTracerType::JsTracer(_) => { + Err(EthApiError::Unsupported("JS Tracer is not enabled").into()) + } + #[cfg(feature = "js-tracer")] GethDebugTracerType::JsTracer(code) => { let config = tracer_config.into_json(); - let mut inspector = JsInspector::with_transaction_context( - code, - config, - transaction_context.unwrap_or_default(), - ) - .map_err(Eth::Error::from_eth_err)?; + let mut inspector = + revm_inspectors::tracing::js::JsInspector::with_transaction_context( + code, + config, + _transaction_context.unwrap_or_default(), + ) + .map_err(Eth::Error::from_eth_err)?; let (res, env) = self.eth_api().inspect(&mut *db, env, &mut inspector)?; let state = res.state.clone(); diff --git a/crates/rpc/rpc/src/lib.rs b/crates/rpc/rpc/src/lib.rs index eec14981bf57..8954dd305a1e 100644 --- a/crates/rpc/rpc/src/lib.rs +++ b/crates/rpc/rpc/src/lib.rs @@ -2,6 +2,9 @@ //! //! Provides the implementation of all RPC interfaces. //! +//! ## Feature Flags +//! +//! - `js-tracer`: Enables support for `debug_` Javascript tracer. //! //! ## Note on blocking behaviour //!