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
@klkvr klkvr force-pushed the debug_getBadBlock branch from ae4f855 to 8dfee06 Compare December 10, 2025 18:57
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.

pending @mattsse

@github-project-automation github-project-automation bot moved this from Backlog to In Progress in Reth Tracker Dec 10, 2025
@mattsse mattsse added this pull request to the merge queue Dec 10, 2025
Merged via the queue into paradigmxyz:main with commit af82606 Dec 10, 2025
45 checks passed
@github-project-automation github-project-automation bot moved this from In Progress to Done in Reth Tracker Dec 10, 2025
@mattsse mattsse added the M-changelog This change should be included in the changelog label Dec 11, 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 M-changelog This change should be included in the changelog

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants