Skip to content

feat: add --skip-merkle flag to correct-last-epoch command #271

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

pcarranzav
Copy link
Member

Summary

  • Adds --skip-merkle flag to the correct-last-epoch command that skips merkle root computation
  • Uses a zero merkle root (32 bytes of zeros) when the flag is enabled
  • Optimizes RPC client initialization to only set up the target chain when needed

Motivation

This feature is useful when multiple networks need correction. Previously, if we tried to fetch the last reported block for a network and it was a non-existent block, the script would fail. With --skip-merkle, we can bypass fetching blocks from other chains entirely, avoiding these failures.

Changes

  • Added --skip-merkle CLI flag to CorrectLastEpoch command
  • Modified RPC client initialization logic:
    • When --skip-merkle is set and block number is provided: skip all RPC initialization
    • When --skip-merkle is set but block number needs auto-detection: only initialize target chain RPC
    • When --skip-merkle is not set: initialize all RPCs (existing behavior)
  • Skip epoch block collection and merkle computation when flag is set
  • Use 32 zero bytes as the merkle root when skipping

Test plan

  • Test normal correction without --skip-merkle flag
  • Test correction with --skip-merkle and explicit block number
  • Test correction with --skip-merkle and auto-detected block number
  • Verify zero merkle root is correctly formatted in the output

🤖 Generated with Claude Code

Adds a new --skip-merkle flag that skips merkle root computation and uses
a zero merkle root (32 bytes of zeros) instead. This is useful when multiple
networks need correction, as it avoids potential failures when fetching
non-existent blocks from other chains.

The implementation:
- Skips RPC client initialization for non-target chains when flag is set
- Still initializes target chain RPC if block number needs auto-detection
- Uses 0x0000...0000 (32 bytes) as the merkle root
- Maintains all other validation and output formatting

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
@pcarranzav pcarranzav requested a review from Maikol August 8, 2025 15:38
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.

1 participant