fc_rpc_core/debug.rs
1// This file is part of Frontier.
2
3// Copyright (C) Parity Technologies (UK) Ltd.
4// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
5
6// This program is free software: you can redistribute it and/or modify
7// it under the terms of the GNU General Public License as published by
8// the Free Software Foundation, either version 3 of the License, or
9// (at your option) any later version.
10
11// This program is distributed in the hope that it will be useful,
12// but WITHOUT ANY WARRANTY; without even the implied warranty of
13// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14// GNU General Public License for more details.
15
16// You should have received a copy of the GNU General Public License
17// along with this program. If not, see <https://www.gnu.org/licenses/>.
18
19//! Debug rpc interface.
20
21use ethereum_types::H256;
22use jsonrpsee::{core::RpcResult, proc_macros::rpc};
23
24use crate::types::{BlockNumberOrHash, Bytes};
25
26/// Net rpc interface.
27#[rpc(server)]
28#[async_trait]
29pub trait DebugApi {
30 /// Returns an RLP-encoded header with the given number or hash.
31 #[method(name = "debug_getRawHeader")]
32 async fn raw_header(&self, number: BlockNumberOrHash) -> RpcResult<Option<Bytes>>;
33
34 /// Returns an RLP-encoded block with the given number or hash.
35 #[method(name = "debug_getRawBlock")]
36 async fn raw_block(&self, number: BlockNumberOrHash) -> RpcResult<Option<Bytes>>;
37
38 /// Returns a EIP-2718 binary-encoded transaction with the given hash.
39 #[method(name = "debug_getRawTransaction")]
40 async fn raw_transaction(&self, hash: H256) -> RpcResult<Option<Bytes>>;
41
42 /// Returns an array of EIP-2718 binary-encoded receipts with the given number of hash.
43 #[method(name = "debug_getRawReceipts")]
44 async fn raw_receipts(&self, number: BlockNumberOrHash) -> RpcResult<Vec<Bytes>>;
45
46 /// Returns an array of recent bad blocks that the client has seen on the network.
47 #[method(name = "debug_getBadBlocks")]
48 fn bad_blocks(&self, number: BlockNumberOrHash) -> RpcResult<Vec<()>>;
49}