mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
fix(rpc): use u64 for gas (#3004)
This commit is contained in:
@ -4,9 +4,8 @@ use crate::tracing::{
|
||||
types::{CallTraceNode, CallTraceStepStackItem},
|
||||
TracingInspectorConfig,
|
||||
};
|
||||
use reth_primitives::{Address, JsonU256, H256, U256};
|
||||
use reth_primitives::{Address, H256};
|
||||
use reth_rpc_types::trace::geth::*;
|
||||
|
||||
use std::collections::{BTreeMap, HashMap, VecDeque};
|
||||
|
||||
/// A type for creating geth style traces
|
||||
@ -85,7 +84,7 @@ impl GethTraceBuilder {
|
||||
pub fn geth_traces(
|
||||
&self,
|
||||
// TODO(mattsse): This should be the total gas used, or gas used by last CallTrace?
|
||||
receipt_gas_used: U256,
|
||||
receipt_gas_used: u64,
|
||||
opts: GethDefaultTracingOptions,
|
||||
) -> DefaultFrame {
|
||||
if self.nodes.is_empty() {
|
||||
@ -102,7 +101,7 @@ impl GethTraceBuilder {
|
||||
DefaultFrame {
|
||||
// If the top-level trace succeeded, then it was a success
|
||||
failed: !main_trace.success,
|
||||
gas: JsonU256(receipt_gas_used),
|
||||
gas: receipt_gas_used,
|
||||
return_value: main_trace.output.clone().into(),
|
||||
struct_logs,
|
||||
}
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
//! Geth tracing types
|
||||
#![allow(missing_docs)]
|
||||
|
||||
use crate::{state::StateOverride, BlockOverrides};
|
||||
/// Geth tracing types
|
||||
use reth_primitives::{Bytes, JsonU256, H256, U256};
|
||||
use reth_primitives::{Bytes, H256, U256};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::collections::BTreeMap;
|
||||
|
||||
@ -41,7 +41,7 @@ pub struct BlockTraceResult {
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct DefaultFrame {
|
||||
pub failed: bool,
|
||||
pub gas: JsonU256,
|
||||
pub gas: u64,
|
||||
pub return_value: Bytes,
|
||||
pub struct_logs: Vec<StructLog>,
|
||||
}
|
||||
|
||||
@ -9,7 +9,7 @@ use crate::{
|
||||
};
|
||||
use async_trait::async_trait;
|
||||
use jsonrpsee::core::RpcResult;
|
||||
use reth_primitives::{Block, BlockId, BlockNumberOrTag, Bytes, TransactionSigned, H256, U256};
|
||||
use reth_primitives::{Block, BlockId, BlockNumberOrTag, Bytes, TransactionSigned, H256};
|
||||
use reth_provider::{BlockProviderIdExt, HeaderProvider, ReceiptProviderIdExt, StateProviderBox};
|
||||
use reth_revm::{
|
||||
database::{State, SubState},
|
||||
@ -317,7 +317,7 @@ where
|
||||
self.inner.eth_api.inspect_call_at(call, at, state_overrides, &mut inspector).await?;
|
||||
let gas_used = res.result.gas_used();
|
||||
|
||||
let frame = inspector.into_geth_builder().geth_traces(U256::from(gas_used), config);
|
||||
let frame = inspector.into_geth_builder().geth_traces(gas_used, config);
|
||||
|
||||
Ok(frame.into())
|
||||
}
|
||||
@ -549,7 +549,7 @@ fn trace_transaction(
|
||||
let (res, _) = inspect(db, env, &mut inspector)?;
|
||||
let gas_used = res.result.gas_used();
|
||||
|
||||
let frame = inspector.into_geth_builder().geth_traces(U256::from(gas_used), config);
|
||||
let frame = inspector.into_geth_builder().geth_traces(gas_used, config);
|
||||
|
||||
Ok((frame.into(), res.state))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user