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