Skip to content

Conversation

@letypequividelespoubelles
Copy link
Contributor

@letypequividelespoubelles letypequividelespoubelles commented Nov 14, 2025

This PR implements issue(s) #

Checklist

  • I wrote new tests for my new core changes.
  • I have successfully ran tests, style checker and build against my new changes locally.
  • I have informed the team of any breaking changes if there are any.

Note

Replace switch-case hardfork-to-tracer mapping with fromMainnetHardforkIdToTracerFork across sequencer components.

  • Tracing/Sequencer:
    • Replace manual switch mapping of HardforkId.MainnetHardforkId to tracer Fork with fromMainnetHardforkIdToTracerFork(...) in:
      • rpc/methods/LineaEstimateGas#createLineCountingTracer
      • txpoolvalidation/validators/SimulationValidator#createLineCountingTracer
      • txselection/selectors/TraceLineLimitTransactionSelector.LineCountingTracerWithLog constructor
    • Explicitly cast getNextBlockHardforkId(...) to HardforkId.MainnetHardforkId and simplify tracer instantiation (ZkTracer/ZkCounter).

Written by Cursor Bugbot for commit 50fed93. This will update automatically on new commits. Configure here.

final HardforkId.MainnetHardforkId forkId =
(HardforkId.MainnetHardforkId)
blockchainService.getNextBlockHardforkId(
blockchainService.getChainHeadHeader(), Instant.now().getEpochSecond());
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Unsafe Hardfork Cast Breaks Future Compatibility

The unsafe cast from HardforkId to HardforkId.MainnetHardforkId will throw a ClassCastException if getNextBlockHardforkId returns a non-mainnet hardfork ID, such as testnet forks or new fork types. The previous switch statement with a default case provided clearer error handling for unknown fork IDs.

Fix in Cursor Fix in Web

Copy link
Collaborator

@fab-10 fab-10 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is fine, but at some time I would like to use HardforkId.MainnetHardforkId everywhere, also in the Tracer, to avoid having to do the conversion

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants