-
Notifications
You must be signed in to change notification settings - Fork 106
test(l1): add reorg testing framework #4620
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
Conversation
Lines of code reportTotal lines added: Detailed view
|
name: Reorg Tests | ||
runs-on: ubuntu-latest | ||
if: ${{ github.event_name != 'merge_group' }} | ||
steps: | ||
- name: Checkout sources | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Rust Environment | ||
uses: ./.github/actions/setup-rust | ||
|
||
- name: Compile ethrex binary | ||
run: cargo build --bin ethrex | ||
|
||
- name: Run reorg tests | ||
run: cd tooling/reorgs && cargo run |
Check warning
Code scanning / CodeQL
Workflow does not contain permissions Medium
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 5 days ago
To fix the problem, we should explicitly set a permissions
block in the workflow to restrict the GITHUB_TOKEN permissions to the minimum needed. This can be set either at the workflow root or for individual jobs. As the workflow doesn't appear to require any write permissions (e.g., none of the steps push code, modify issues, or interact with pull requests), the safest minimal starting point is contents: read
. This should be added at the top level of the workflow YAML file (immediately after the name
and on
sections, before jobs:
), which will apply to all jobs that do not specify their own permissions
block.
No additional imports, methods, or definitions are needed for this YAML change.
-
Copy modified lines R11-R13
@@ -8,6 +8,9 @@ | ||
paths-ignore: | ||
- "crates/l2/**" # Behind a feature flag not used in this workflow | ||
|
||
permissions: | ||
contents: read | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | ||
cancel-in-progress: true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces a comprehensive reorg testing framework for the L1 chain, providing infrastructure to test chain reorganization scenarios. The implementation includes a simulator that can spawn multiple nodes, orchestrate blockchain operations, and verify reorg behavior.
Key changes:
- Adds a complete reorg testing framework with node simulation capabilities
- Implements chain manipulation tools for testing fork scenarios
- Integrates reorg tests into the CI pipeline for automated testing
Reviewed Changes
Copilot reviewed 9 out of 11 changed files in this pull request and generated 3 comments.
Show a summary per file
File | Description |
---|---|
tooling/reorgs/src/simulator.rs |
Core simulator implementation with node management and chain utilities |
tooling/reorgs/src/main.rs |
Main test runner with specific reorg test scenarios |
tooling/reorgs/README.md |
Documentation for running the reorg tests |
tooling/reorgs/Cargo.toml |
Package configuration and dependencies |
crates/networking/rpc/types/payload.rs |
Adds PartialEq and Eq traits to PayloadValidationStatus |
crates/networking/rpc/types/fork_choice.rs |
Adds Clone and Copy traits to ForkChoiceState |
cmd/ethrex/cli.rs |
Adds Clone trait to Options struct |
Cargo.toml |
Includes new reorgs package in workspace |
.github/workflows/pr-main_l1.yaml |
Adds reorg tests to CI pipeline |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Motivation
Hive tests are good for wide coverage, but having our own suite will let us iterate faster, adding our own regression tests or even fuzzing.
Description
This PR adds a new crate under
tooling/reorgs
with a reorgs testing framework. The README of the crate includes instructions on how to run:The package already includes a simple reorg test with two chains and a node going back and forth between the two, and another test similar to the reorg tests in Hive's "ethereum/engine" simulation, which does a reorg multiple blocks deep without sending all of the side-chain blocks to the node under test.