mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
fix: gas and gasUsed in trace root only for ParityTrace (#9761)
Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
This commit is contained in:
4
Cargo.lock
generated
4
Cargo.lock
generated
@ -8905,9 +8905,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "revm-inspectors"
|
||||
version = "0.5.3"
|
||||
version = "0.5.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "af2dc001e37ac3b061dc9087876aea91e28756c188a97cd99416d23a5562ca73"
|
||||
checksum = "5296ccad8d7ccbeb6c5a037a57bfe1ff27e81d8c4efbd3ae7df0a554eb1a818a"
|
||||
dependencies = [
|
||||
"alloy-primitives",
|
||||
"alloy-rpc-types",
|
||||
|
||||
@ -320,8 +320,9 @@ where
|
||||
.inner
|
||||
.eth_api
|
||||
.spawn_with_call_at(call, at, overrides, move |db, env| {
|
||||
let (res, _) = this.eth_api().inspect(db, env, &mut inspector)?;
|
||||
let (res, env) = this.eth_api().inspect(db, env, &mut inspector)?;
|
||||
let frame = inspector
|
||||
.with_transaction_gas_limit(env.tx.gas_limit)
|
||||
.into_geth_builder()
|
||||
.geth_call_traces(call_config, res.result.gas_used());
|
||||
Ok(frame.into())
|
||||
@ -345,9 +346,10 @@ where
|
||||
// see <https://github.com/rust-lang/rust/issues/100013>
|
||||
let db = db.0;
|
||||
|
||||
let (res, _) =
|
||||
let (res, env) =
|
||||
this.eth_api().inspect(&mut *db, env, &mut inspector)?;
|
||||
let frame = inspector
|
||||
.with_transaction_gas_limit(env.tx.gas_limit)
|
||||
.into_geth_builder()
|
||||
.geth_prestate_traces(&res, prestate_config, db)
|
||||
.map_err(Eth::Error::from_eth_err)?;
|
||||
@ -415,17 +417,20 @@ where
|
||||
|
||||
let mut inspector = TracingInspector::new(inspector_config);
|
||||
|
||||
let (res, inspector) = self
|
||||
let (res, tx_gas_limit, inspector) = self
|
||||
.inner
|
||||
.eth_api
|
||||
.spawn_with_call_at(call, at, overrides, move |db, env| {
|
||||
let (res, _) = this.eth_api().inspect(db, env, &mut inspector)?;
|
||||
Ok((res, inspector))
|
||||
let (res, env) = this.eth_api().inspect(db, env, &mut inspector)?;
|
||||
Ok((res, env.tx.gas_limit, inspector))
|
||||
})
|
||||
.await?;
|
||||
let gas_used = res.result.gas_used();
|
||||
let return_value = res.result.into_output().unwrap_or_default();
|
||||
let frame = inspector.into_geth_builder().geth_traces(gas_used, return_value, config);
|
||||
let frame = inspector
|
||||
.with_transaction_gas_limit(tx_gas_limit)
|
||||
.into_geth_builder()
|
||||
.geth_traces(gas_used, return_value, config);
|
||||
|
||||
Ok(frame.into())
|
||||
}
|
||||
@ -578,9 +583,10 @@ where
|
||||
TracingInspectorConfig::from_geth_call_config(&call_config),
|
||||
);
|
||||
|
||||
let (res, _) = self.eth_api().inspect(db, env, &mut inspector)?;
|
||||
let (res, env) = self.eth_api().inspect(db, env, &mut inspector)?;
|
||||
|
||||
let frame = inspector
|
||||
.with_transaction_gas_limit(env.tx.gas_limit)
|
||||
.into_geth_builder()
|
||||
.geth_call_traces(call_config, res.result.gas_used());
|
||||
|
||||
@ -594,9 +600,10 @@ where
|
||||
let mut inspector = TracingInspector::new(
|
||||
TracingInspectorConfig::from_geth_prestate_config(&prestate_config),
|
||||
);
|
||||
let (res, _) = self.eth_api().inspect(&mut *db, env, &mut inspector)?;
|
||||
let (res, env) = self.eth_api().inspect(&mut *db, env, &mut inspector)?;
|
||||
|
||||
let frame = inspector
|
||||
.with_transaction_gas_limit(env.tx.gas_limit)
|
||||
.into_geth_builder()
|
||||
.geth_prestate_traces(&res, prestate_config, db)
|
||||
.map_err(Eth::Error::from_eth_err)?;
|
||||
@ -644,10 +651,13 @@ where
|
||||
|
||||
let mut inspector = TracingInspector::new(inspector_config);
|
||||
|
||||
let (res, _) = self.eth_api().inspect(db, env, &mut inspector)?;
|
||||
let (res, env) = self.eth_api().inspect(db, env, &mut inspector)?;
|
||||
let gas_used = res.result.gas_used();
|
||||
let return_value = res.result.into_output().unwrap_or_default();
|
||||
let frame = inspector.into_geth_builder().geth_traces(gas_used, return_value, config);
|
||||
let frame = inspector
|
||||
.with_transaction_gas_limit(env.tx.gas_limit)
|
||||
.into_geth_builder()
|
||||
.geth_traces(gas_used, return_value, config);
|
||||
|
||||
Ok((frame.into(), res.state))
|
||||
}
|
||||
|
||||
@ -306,17 +306,15 @@ where
|
||||
num.into(),
|
||||
Some(highest_idx),
|
||||
TracingInspectorConfig::default_parity(),
|
||||
move |tx_info, inspector, res, _, _| {
|
||||
move |tx_info, inspector, _, _, _| {
|
||||
if let Some(idx) = tx_info.index {
|
||||
if !indices.contains(&idx) {
|
||||
// only record traces for relevant transactions
|
||||
return Ok(None)
|
||||
}
|
||||
}
|
||||
let traces = inspector
|
||||
.with_transaction_gas_used(res.gas_used())
|
||||
.into_parity_builder()
|
||||
.into_localized_transaction_traces(tx_info);
|
||||
let traces =
|
||||
inspector.into_parity_builder().into_localized_transaction_traces(tx_info);
|
||||
Ok(Some(traces))
|
||||
},
|
||||
);
|
||||
@ -372,11 +370,9 @@ where
|
||||
.spawn_trace_transaction_in_block(
|
||||
hash,
|
||||
TracingInspectorConfig::default_parity(),
|
||||
move |tx_info, inspector, res, _| {
|
||||
let traces = inspector
|
||||
.with_transaction_gas_used(res.result.gas_used())
|
||||
.into_parity_builder()
|
||||
.into_localized_transaction_traces(tx_info);
|
||||
move |tx_info, inspector, _, _| {
|
||||
let traces =
|
||||
inspector.into_parity_builder().into_localized_transaction_traces(tx_info);
|
||||
Ok(traces)
|
||||
},
|
||||
)
|
||||
@ -391,11 +387,9 @@ where
|
||||
let traces = self.inner.eth_api.trace_block_with(
|
||||
block_id,
|
||||
TracingInspectorConfig::default_parity(),
|
||||
|tx_info, inspector, res, _, _| {
|
||||
let traces = inspector
|
||||
.with_transaction_gas_used(res.gas_used())
|
||||
.into_parity_builder()
|
||||
.into_localized_transaction_traces(tx_info);
|
||||
|tx_info, inspector, _, _, _| {
|
||||
let traces =
|
||||
inspector.into_parity_builder().into_localized_transaction_traces(tx_info);
|
||||
Ok(traces)
|
||||
},
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user