Skip to content

Conversation

@0xKarl98
Copy link
Contributor

@0xKarl98 0xKarl98 commented Dec 7, 2025

This targets on issue #20123 , as below :

Add a shared BadBlockStore (bounded, deduped, newest-first) and wire it into DebugApi
Implement debug_getBadBlocks to expose recent invalid blocks with full transactions, hash, and RLP
Listen for ConsensusEngineEvent::InvalidBlock, recover the sealed block with senders, and cache it for the debug API
cc @mattsse @klkvr @Rjected

Copy link
Member

@klkvr klkvr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would prefer us to avoid doing breaking changes for this

Comment on lines 1029 to 1043
// keep track of invalid blocks for `debug_getBadBlocks` only if debug RPC is enabled
if debug_enabled {
let bad_block_store = registry.bad_block_store().clone();
let mut engine_events_stream = engine_events.new_listener();
node.task_executor().spawn(Box::pin(async move {
while let Some(event) = engine_events_stream.next().await {
if let ConsensusEngineEvent::InvalidBlock(block) = event &&
let Ok(recovered) =
RecoveredBlock::try_recover_sealed(block.as_ref().clone())
{
bad_block_store.insert(recovered);
}
}
}));
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm can we not have this being handled by DebugApi itself?

Copy link
Contributor Author

@0xKarl98 0xKarl98 Dec 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have moved this part of logic to inside DebugApi

Comment on lines 19 to 33
pub trait EthApiTypes: RpcNodeCore + Send + Sync + Clone {
/// Extension of [`FromEthApiError`], with network specific errors.
type Error: Into<jsonrpsee_types::error::ErrorObject<'static>>
+ FromEthApiError
+ AsEthApiError
+ From<<Self::RpcConvert as RpcConvert>::Error>
+ Error
+ Send
+ Sync;
/// Blockchain primitive types, specific to network, e.g. block and transaction.
type NetworkTypes: RpcTypes;
/// Conversion methods for transaction RPC type.
type RpcConvert: RpcConvert<Network = Self::NetworkTypes>;
/// Provider block type used by RPC.
type ProviderBlock: BlockTrait;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would prefer us to avoid changing this trait

Copy link
Contributor Author

@0xKarl98 0xKarl98 Dec 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have revert changes to this trait , it remains the same as before

Comment on lines +70 to +73
+ reth_ethereum::rpc::eth::RpcNodeCore<
Provider = Node::Provider,
Primitives = <Node::Types as NodeTypes>::Primitives,
>,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm unclear why this is needed. I know that those bounds are sometimes problematic but we need to figure out solutions for this that don't break such user-facing APIs

@0xKarl98 0xKarl98 marked this pull request as draft December 8, 2025 07:18
@mattsse mattsse marked this pull request as ready for review December 8, 2025 10:08
@mattsse mattsse added the C-enhancement New feature or request label Dec 8, 2025
@mattsse mattsse added the A-rpc Related to the RPC implementation label Dec 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-rpc Related to the RPC implementation C-enhancement New feature or request

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

3 participants