Skip to content

Commit

Permalink
add debug_chainConfig endpoint (#14346)
Browse files Browse the repository at this point in the history
  • Loading branch information
siosw authored Feb 9, 2025
1 parent d57535c commit 46d63e8
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 1 deletion.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions crates/rpc/rpc-api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ alloy-rpc-types-admin.workspace = true
alloy-serde.workspace = true
alloy-rpc-types-beacon.workspace = true
alloy-rpc-types-engine.workspace = true
alloy-genesis.workspace = true

# misc
jsonrpsee = { workspace = true, features = ["server", "macros"] }
Expand Down
5 changes: 5 additions & 0 deletions crates/rpc/rpc-api/src/debug.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use alloy_eips::{BlockId, BlockNumberOrTag};
use alloy_genesis::ChainConfig;
use alloy_primitives::{Address, Bytes, B256};
use alloy_rpc_types_debug::ExecutionWitness;
use alloy_rpc_types_eth::{transaction::TransactionRequest, Block, Bundle, StateContext};
Expand Down Expand Up @@ -186,6 +187,10 @@ pub trait DebugApi {
#[method(name = "chaindbCompact")]
async fn debug_chaindb_compact(&self) -> RpcResult<()>;

/// Returns the current chain config.
#[method(name = "chainConfig")]
async fn debug_chain_config(&self) -> RpcResult<ChainConfig>;

/// Returns leveldb properties of the key-value database.
#[method(name = "chaindbProperty")]
async fn debug_chaindb_property(&self, property: String) -> RpcResult<()>;
Expand Down
7 changes: 6 additions & 1 deletion crates/rpc/rpc/src/debug.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use alloy_consensus::BlockHeader;
use alloy_eips::{eip2718::Encodable2718, BlockId, BlockNumberOrTag};
use alloy_genesis::ChainConfig;
use alloy_primitives::{Address, Bytes, B256, U256};
use alloy_rlp::{Decodable, Encodable};
use alloy_rpc_types_debug::ExecutionWitness;
Expand All @@ -14,7 +15,7 @@ use alloy_rpc_types_trace::geth::{
};
use async_trait::async_trait;
use jsonrpsee::core::RpcResult;
use reth_chainspec::EthereumHardforks;
use reth_chainspec::{EthChainSpec, EthereumHardforks};
use reth_evm::{
env::EvmEnv,
execute::{BlockExecutorProvider, Executor},
Expand Down Expand Up @@ -1035,6 +1036,10 @@ where
Ok(())
}

async fn debug_chain_config(&self) -> RpcResult<ChainConfig> {
Ok(self.provider().chain_spec().genesis().config.clone())
}

async fn debug_chaindb_property(&self, _property: String) -> RpcResult<()> {
Ok(())
}
Expand Down

0 comments on commit 46d63e8

Please sign in to comment.