-
Notifications
You must be signed in to change notification settings - Fork 829
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
286 additions
and
38 deletions.
There are no files selected for viewing
26 changes: 26 additions & 0 deletions
26
...ive/rpc/.sqlx/query-2fcbf357b3993c0065141859e5ad8c11bd7800e3e6d22e8383ab9ac8bbec25b1.json
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
mod debug_apis; | ||
pub use debug_apis::*; | ||
|
||
mod execution_apis; | ||
pub use execution_apis::*; | ||
|
||
mod health_api; | ||
pub use health_api::*; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
use crate::*; | ||
use jsonrpsee::{core::RpcResult, proc_macros::rpc}; | ||
|
||
/// Debug Ethererum JSON-RPC apis. | ||
#[rpc(server, client)] | ||
pub trait DebugRpc { | ||
/// Returns the tracing of the execution of a specific block using its number. | ||
/// | ||
/// ## References | ||
/// | ||
/// - https://geth.ethereum.org/docs/interacting-with-geth/rpc/ns-debug#debugtraceblockbynumber | ||
/// - https://docs.alchemy.com/reference/what-is-trace_block | ||
/// - https://docs.chainstack.com/reference/ethereum-traceblockbynumber | ||
#[method(name = "debug_traceBlockByNumber")] | ||
async fn trace_block_by_number( | ||
&self, | ||
block: Option<BlockNumberOrTag>, | ||
tracer_config: TracerConfig, | ||
) -> RpcResult<Vec<TransactionTrace>>; | ||
|
||
/// Returns a transaction's traces by replaying it. This method provides a detailed | ||
/// breakdown of every step in the execution of a transaction | ||
/// | ||
/// ## References | ||
/// | ||
/// - https://geth.ethereum.org/docs/interacting-with-geth/rpc/ns-debug#debugtracetransaction | ||
/// - https://docs.alchemy.com/reference/debug-tracetransaction | ||
/// - https://docs.chainstack.com/reference/ethereum-tracetransaction | ||
#[method(name = "debug_traceTransaction")] | ||
async fn trace_transaction( | ||
&self, | ||
transaction_hash: H256, | ||
tracer_config: TracerConfig, | ||
) -> RpcResult<CallTrace<U256, Bytes>>; | ||
} | ||
|
||
pub struct DebugRpcServerImpl { | ||
client: client::Client, | ||
} | ||
|
||
impl DebugRpcServerImpl { | ||
pub fn new(client: client::Client) -> Self { | ||
Self { client } | ||
} | ||
} | ||
|
||
#[async_trait] | ||
impl DebugRpcServer for DebugRpcServerImpl { | ||
async fn trace_block_by_number( | ||
&self, | ||
block: Option<BlockNumberOrTag>, | ||
tracer_config: TracerConfig, | ||
) -> RpcResult<Vec<TransactionTrace>> { | ||
let traces = self.client.trace_block_by_number(block, tracer_config).await?; | ||
Ok(traces) | ||
} | ||
|
||
async fn trace_transaction( | ||
&self, | ||
transaction_hash: H256, | ||
tracer_config: TracerConfig, | ||
) -> RpcResult<CallTrace<U256, Bytes>> { | ||
let traces = self.client.trace_transaction(transaction_hash, tracer_config).await?; | ||
Ok(traces) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.