Try it Live
Run Hardfork examples in the interactive playground
Range Direction
Forward Range (start < end)
Returns hardforks in chronological order:Reverse Range (start > end)
Returns hardforks in reverse chronological order:Single Hardfork (start === end)
Returns array with single element:Usage Patterns
Upgrade Path
Get hardforks to upgrade through:Feature Changes
List features introduced in range:Migration Planning
Plan network upgrade:Version Range Validation
Check if fork is in supported range:Breaking Changes Detection
Find breaking changes in range:Network Configuration
Generate network upgrade timeline:Edge Cases
Empty Range
When start > end but reverse=false not supported, returns empty or throws:Invalid Hardforks
If hardforks don’t exist in order, anInvalidFormatError is thrown:
Error Handling
Therange function throws InvalidFormatError when given invalid hardfork values:
| Error Type | Code | When Thrown |
|---|---|---|
InvalidFormatError | HARDFORK_INVALID_RANGE | Start or end hardfork is not a valid hardfork ID |
Performance
Time Complexity: O(n) where n = range size Typical Time: ~100ns + (50ns × range size) Example Ranges:- BERLIN → LONDON: 2 hardforks (~150ns)
- BERLIN → CANCUN: 7 hardforks (~450ns)
- FRONTIER → OSAKA: 19 hardforks (~1050ns)

