Skip to content

Conversation

MegaRedHand
Copy link
Collaborator

@MegaRedHand MegaRedHand commented Sep 25, 2025

Blocked by #4620

Motivation

The main components of chain state are account balance and contract storage. Testing reorgs affect those as expected is important.

Description

This PR adds a reorg test using a simple contract that sets a storage slot as received by calldata.

NOTE: this is currently failing due to issues with full-sync header requests

@MegaRedHand MegaRedHand requested a review from a team as a code owner September 25, 2025 18:53
@github-actions github-actions bot added the L1 Ethereum client label Sep 25, 2025
Copy link

github-actions bot commented Sep 25, 2025

Lines of code report

Total lines added: 165
Total lines removed: 0
Total lines changed: 165

Detailed view
+----------------------------------------+-------+------+
| File                                   | Lines | Diff |
+----------------------------------------+-------+------+
| ethrex/tooling/reorgs/src/main.rs      | 224   | +76  |
+----------------------------------------+-------+------+
| ethrex/tooling/reorgs/src/simulator.rs | 448   | +89  |
+----------------------------------------+-------+------+

@MegaRedHand MegaRedHand moved this to Blocked in ethrex_l1 Sep 25, 2025
Base automatically changed from add-reorg-framework to main September 26, 2025 16:32
@Copilot Copilot AI review requested due to automatic review settings September 26, 2025 19:01
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Adds a storage slot reorg test to verify that contract storage state is properly handled during blockchain reorganizations. The test deploys a simple contract that sets storage slots based on calldata parameters and verifies that different storage values are correctly maintained across divergent chains.

Key changes:

  • Enhanced simulator with test-specific data directory structure and contract deployment/interaction methods
  • Added new reorg test that verifies storage slot consistency across chain forks
  • Added utility methods for contract deployment and storage querying

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
tooling/reorgs/src/simulator.rs Added test name parameter, contract interaction methods, and test-specific data directories
tooling/reorgs/src/main.rs Added new storage slot reorg test function and integrated it into test runner
Comments suppressed due to low confidence (1)

tooling/reorgs/src/simulator.rs:1

  • [nitpick] The calldata construction using to_big_endian() and concat() creates intermediate allocations. Consider using a more efficient approach like pre-allocating a 64-byte array and copying the values directly.
use std::{fs::File, io::Read, path::PathBuf, process::Stdio, time::Duration};

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@MegaRedHand MegaRedHand moved this from Blocked to In Progress in ethrex_l1 Sep 26, 2025
@MegaRedHand MegaRedHand moved this from In Progress to In Review in ethrex_l1 Sep 26, 2025
@MegaRedHand MegaRedHand marked this pull request as draft September 26, 2025 21:14
@MegaRedHand MegaRedHand moved this from In Review to Blocked in ethrex_l1 Sep 26, 2025
@ethrex-project-sync ethrex-project-sync bot moved this from Blocked to In Progress in ethrex_l1 Sep 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
L1 Ethereum client
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

2 participants