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

feat: make js-feature non default #10447

Merged
merged 3 commits into from
Aug 22, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
4 changes: 2 additions & 2 deletions Cargo.lock

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

1 change: 0 additions & 1 deletion crates/rpc/rpc-eth-api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down
1 change: 0 additions & 1 deletion crates/rpc/rpc-eth-types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -59,5 +59,4 @@ serde_json.workspace = true


[features]
default = ["js-tracer"]
js-tracer = ["revm-inspectors/js-tracer"]
1 change: 0 additions & 1 deletion crates/rpc/rpc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
32 changes: 22 additions & 10 deletions crates/rpc/rpc/src/debug.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();

Expand All @@ -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)
Expand Down Expand Up @@ -671,7 +676,8 @@ where
opts: GethDebugTracingOptions,
env: EnvWithHandlerCfg,
db: &mut StateCacheDb<'_>,
transaction_context: Option<TransactionContext>,
#[cfg(not(feature = "js-tracer"))] _transaction_context: Option<TransactionContext>,
#[cfg(feature = "js-tracer")] transaction_context: Option<TransactionContext>,
) -> Result<(GethTrace, revm_primitives::EvmState), Eth::Error> {
let GethDebugTracingOptions { config, tracer, tracer_config, .. } = opts;

Expand Down Expand Up @@ -737,14 +743,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();
Expand Down
Loading