Commit 1138ec5
feat(cli): Blocktest builder (#2190)
* Initial commit
* Some refactoring
* Add batch mode
* Support blob gas fields in genesis
* Don't default to gasPrice=1 to not error on blob tx
* Fix setcodetx translation
* Parallelize
* Per file progress meter
* Fix auth translation
* refactor(fuzzer-bridge): address PR feedback and improve architecture
- Remove incorrect venv activation instructions from CLAUDE.md
- Replace ASCII art with Mermaid diagram in README
- Add fuzzer_bridge as CLI entry point in pyproject.toml
- Create comprehensive documentation in docs/writing_tests/
- Add Pydantic models for type-safe fuzzer output parsing
- Add BlockchainTest.from_fuzzer() classmethod for better integration
- Simplify BlocktestBuilder to use new architecture
- Fix README inconsistencies (punctuation, references, sections)
This refactoring aligns the fuzzer bridge with EEST code standards
and makes it more maintainable and future-proof.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>
* fix(fuzzer-bridge): apply linting and formatting fixes
- Add ruff noqa comment for mixedCase variables in Pydantic models
- Fix line length issues in performance_utils.py
- Replace bare except with specific Exception handling
- Apply automated formatting from ruff
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>
* fix: resolve CI errors for linting, formatting, and type checking
- Fix markdown linting errors in fuzzer_bridge.md documentation
- Apply ruff formatting to blockchain.py
- Fix mypy type errors in fuzzer bridge modules:
- Make orjson import optional with proper error handling
- Fix TransitionTool instantiation to use GethTransitionTool
- Correct EOA usage and add missing class attributes
- Fix json.dump parameter usage to avoid kwargs issues
- Fix docstring line lengths to comply with 79-char limit
- Fix line length issues in function signatures
All linting (ruff) and type checking (mypy) now pass successfully.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>
* Fix docs link
* feat(fuzzer_bridge): add EIP-7702 and EIP-4788 support
Add support for two critical Ethereum features in the fuzzer bridge:
1. EIP-7702 Authorization Lists (Prague+)
- Add FuzzerAuthorization model for authorization tuples
- Parse authorizationList from transactions
- Translate to AuthorizationTuple in from_fuzzer()
- Enables testing of SetCode transactions (tx type 0x04)
2. EIP-4788 Parent Beacon Block Root (Cancun+)
- Add parentBeaconBlockRoot as top-level field in FuzzerOutput
- Pass to Block during creation in from_fuzzer()
- Must be 32-byte hash from consensus layer
- Enables testing of beacon root contract (EIP-4788)
These changes close significant coverage gaps in geth core validation:
- tx_setcode.go: Authorization validation paths
- block_validator.go: Beacon root handling
- state_transition.go: Beacon root system contract calls
The implementation follows existing patterns (similar to blob sidecar
handling) and maintains backwards compatibility through optional fields.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>
* feat(fuzzer-bridge): add multi-block blockchain test generation
Add support for splitting fuzzer transactions across multiple blocks
to enable testing of state transitions and block boundaries.
New CLI Options:
- --num-blocks: Number of blocks to generate (default: 1)
- --block-strategy: Transaction distribution strategy
- "distribute": Sequential chunks preserving nonce order
- "first-block": All txs in first block, rest empty
- --block-time: Seconds between blocks (default: 12)
Implementation:
- Sequential distribution maintains nonce ordering per account
- Timestamps increment by block_time for each block
- Only first block receives parent_beacon_block_root
- Fully backward compatible (single-block default)
Example Usage:
fuzzer_bridge --num-blocks 3 --block-strategy distribute \
--fork Osaka input.json output/
This enables testing multi-block scenarios like:
- State evolution across blocks
- Transaction dependencies spanning blocks
- Block time-sensitive operations
- Cross-block state transitions
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>
* feat(fuzzer-bridge): add random block count selection
Add --random-blocks flag to enable intelligent automatic selection of
block counts for comprehensive testing coverage.
New Feature:
- --random-blocks: Randomly choose number of blocks (1 to min(num_txs, 10))
Implementation:
- choose_random_num_blocks() helper with uniform distribution
- Each file gets independent random selection in parallel mode
- Edge case handling: empty blocks (0 txs → 1 block)
- Cap at 10 blocks to prevent fixture bloat with large tx counts
Algorithm Rationale:
- Uniform distribution provides equal coverage for testing
- Max of 10 blocks balances thoroughness with practicality
- Independent per-file randomization maximizes corpus diversity
Example Usage:
# Random mode - each file gets random block count
fuzzer_bridge --random-blocks --fork Osaka input/ output/
# Still works with fixed mode
fuzzer_bridge --num-blocks 3 --fork Osaka input/ output/
Benefits:
- Automated testing of various block configurations
- Discovers edge cases in block boundary handling
- Comprehensive multi-block scenario coverage
- Zero configuration needed for random testing
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>
* Add batch mode for improved perf
* test(fuzzer-bridge): add comprehensive test suite with DTO pattern
Implements complete testing infrastructure for fuzzer bridge with 25
comprehensive tests achieving 98% code coverage on core modules.
Changes:
- Add test_fuzzer_bridge.py with 25 tests covering DTO parsing,
conversion, BlockchainTest generation, EIP features, and error
handling
- Refactor models.py to use DTO pattern with clean separation
between external JSON-RPC format and internal EEST domain models
- Create converter.py module with pure transformation functions
(eliminates circular dependencies from blockchain.py)
- Add 5 test vectors from real fuzzer outputs (Osaka fork, EIP-7702,
EIP-4788)
- Update README with comprehensive DTO architecture documentation
including Mermaid diagram, field mappings, and design rationale
- Simplify blocktest_builder.py by delegating conversion to
converter module
- Update examples with current fuzzer outputs and detailed README
Architecture:
- DTOs (models.py): Parse external format without side effects
- Converters (converter.py): Explicit field transformations
- Domain Models (EEST): Internal business logic with validation
- Benefits: 98% test coverage, no circular dependencies, explicit
mappings, prevents TestAddress pollution
Test Coverage:
- 25 tests pass in 0.46s
- models.py: 100% coverage
- converter.py: 97% coverage
- Core modules combined: 98% coverage
Key Features Tested:
- EIP-7702 authorization lists
- EIP-4788 parent beacon block root
- Multi-block generation strategies
- EOA creation from private keys
- Field mapping (gas → gas_limit, from → sender)
- Error handling and validation
All quality checks pass:
- Linting: ✓ (ruff check, format, W505)
- Type checking: ✓ (mypy)
- All CLI tests: ✓ (256/256 pass, no regressions)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>
---------
Co-authored-by: Claude <[email protected]>1 parent 18fc570 commit 1138ec5
File tree
24 files changed
+7432
-1
lines changed- docs
- writing_tests
- src/cli
- fuzzer_bridge
- examples
- tests
- vectors
24 files changed
+7432
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | | - | |
| 29 | + | |
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
| 44 | + | |
44 | 45 | | |
45 | 46 | | |
46 | 47 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
109 | 109 | | |
110 | 110 | | |
111 | 111 | | |
| 112 | + | |
112 | 113 | | |
113 | 114 | | |
114 | 115 | | |
| |||
0 commit comments