cfx_rpc_eth_api/
debug.rs

1use alloy_rpc_types_trace::geth::{
2    GethDebugTracingCallOptions, GethDebugTracingOptions, GethTrace,
3    TraceResult,
4};
5use cfx_rpc_eth_types::{BlockId, BlockProperties, TransactionRequest};
6use cfx_types::H256;
7use jsonrpsee::{core::RpcResult, proc_macros::rpc};
8
9#[rpc(server, namespace = "debug")]
10pub trait DebugApi {
11    #[method(name = "dbGet")]
12    async fn db_get(&self, key: String) -> RpcResult<Option<String>>;
13
14    /// The `debug_traceTransaction` debugging method will attempt to run the
15    /// transaction in the exact same manner as it was executed on the
16    /// network. It will replay any transaction that may have been executed
17    /// prior to this one before it will finally attempt to execute the
18    /// transaction that corresponds to the given hash.
19    #[method(name = "traceTransaction")]
20    async fn debug_trace_transaction(
21        &self, tx_hash: H256, opts: Option<GethDebugTracingOptions>,
22    ) -> RpcResult<GethTrace>;
23
24    #[method(name = "traceBlockByHash")]
25    async fn debug_trace_block_by_hash(
26        &self, block: H256, opts: Option<GethDebugTracingOptions>,
27    ) -> RpcResult<Vec<TraceResult>>;
28
29    #[method(name = "traceBlockByNumber")]
30    async fn debug_trace_block_by_number(
31        &self, block: BlockId, opts: Option<GethDebugTracingOptions>,
32    ) -> RpcResult<Vec<TraceResult>>;
33
34    #[method(name = "traceCall")]
35    async fn debug_trace_call(
36        &self, request: TransactionRequest, block_number: Option<BlockId>,
37        opts: Option<GethDebugTracingCallOptions>,
38    ) -> RpcResult<GethTrace>;
39
40    /// Returns block properties needed for validate transaction execution
41    /// This method will not return properties for phantom transactions
42    #[method(name = "blockProperties")]
43    async fn debug_block_properties(
44        &self, block_number: BlockId,
45    ) -> RpcResult<Option<Vec<BlockProperties>>>;
46}