Skip to content

refactor(engine): simplify InvalidBlockWitnessHook::on_invalid_block for better testability #18513

@yongkangc

Description

@yongkangc

Current implementation spans 180+ lines handling execution, state collection, proof generation, and witness assembly in a single function.

https://github.com/paradigmxyz/reth/blob/main/crates/engine/invalid-block-hooks/src/witness.rs#L141-L322

Problem:

  • Difficult to test individual logic paths without full database setup
  • Multiple nested data transformations obscure core witness generation logic

Goal:

  • Decompose into smaller functions with clear responsibilities
  • Enable testing with mock state providers instead of requiring full StateProviderDatabase
  • Each extracted component should be testable with minimal fixture setup

Please add tests for this

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions