feat: add debug functions

This commit is contained in:
Matthias Seitz
2022-10-03 15:18:22 +02:00
parent eeda03a3f3
commit 8b7bef4f48
2 changed files with 30 additions and 2 deletions

View File

@ -0,0 +1,27 @@
use jsonrpsee::{core::RpcResult as Result, proc_macros::rpc};
use reth_primitives::{BlockId, Bytes, H256};
use reth_rpc_types::RichBlock;
/// Debug rpc interface.
#[rpc(server)]
pub trait DebugApi {
/// Returns an RLP-encoded header.
#[method(name = "debug_getRawHeader")]
async fn raw_header(&self, block_id: BlockId) -> Result<Bytes>;
/// Returns an RLP-encoded block.
#[method(name = "debug_getRawBlock")]
async fn raw_block(&self, block_id: BlockId) -> Result<Bytes>;
/// Returns a EIP-2718 binary-encoded transaction.
#[method(name = "debug_getRawTransaction")]
async fn raw_transaction(&self, hash: H256) -> Result<Bytes>;
/// Returns an array of EIP-2718 binary-encoded receipts.
#[method(name = "debug_getRawReceipts")]
async fn raw_receipts(&self, block_id: BlockId) -> Result<Vec<Bytes>>;
/// Returns an array of recent bad blocks that the client has seen on the network.
#[method(name = "debug_getRawReceipts")]
async fn bad_blocks(&self) -> Result<Vec<RichBlock>>;
}

View File

@ -9,6 +9,7 @@
//! //!
//! Provides all RPC interfaces. //! Provides all RPC interfaces.
mod debug;
mod eth; mod eth;
mod eth_filter; mod eth_filter;
mod eth_pubsub; mod eth_pubsub;
@ -17,6 +18,6 @@ mod trace;
mod web3; mod web3;
pub use self::{ pub use self::{
eth::EthApiServer, eth_filter::EthFilterApiServer, eth_pubsub::EthPubSubApiServer, debug::DebugApiServer, eth::EthApiServer, eth_filter::EthFilterApiServer,
net::NetApiServer, web3::Web3ApiServer, eth_pubsub::EthPubSubApiServer, net::NetApiServer, web3::Web3ApiServer,
}; };