Skip to content

Conversation

@cdiielsi
Copy link
Contributor

@cdiielsi cdiielsi commented Nov 6, 2025

Motivation

Stop having all the dummy() functions that create non-working components spread all around the code.

Description

This pr brings all test utils in the rpc crate into a single test_utils module, including all the dummy() functions that were spread all around the code.

This pr only focuses in the rpc crate to tackle issue #5070 since it's the only one that had a test_utils module and required having a dummy instance of a component to be created for testing.

Closes #5070

@github-actions github-actions bot added the L1 Ethereum client label Nov 6, 2025
@github-actions
Copy link

github-actions bot commented Nov 6, 2025

Lines of code report

Total lines added: 299
Total lines removed: 323
Total lines changed: 622

Detailed view
+------------------------------------------------------+-------+------+
| File                                                 | Lines | Diff |
+------------------------------------------------------+-------+------+
| ethrex/crates/networking/p2p/network.rs              | 362   | -25  |
+------------------------------------------------------+-------+------+
| ethrex/crates/networking/p2p/peer_handler.rs         | 1756  | -6   |
+------------------------------------------------------+-------+------+
| ethrex/crates/networking/p2p/rlpx/initiator.rs       | 111   | -7   |
+------------------------------------------------------+-------+------+
| ethrex/crates/networking/p2p/sync.rs                 | 1368  | -13  |
+------------------------------------------------------+-------+------+
| ethrex/crates/networking/p2p/sync_manager.rs         | 123   | -9   |
+------------------------------------------------------+-------+------+
| ethrex/crates/networking/rpc/eth/filter.rs           | 541   | -1   |
+------------------------------------------------------+-------+------+
| ethrex/crates/networking/rpc/eth/max_priority_fee.rs | 98    | -1   |
+------------------------------------------------------+-------+------+
| ethrex/crates/networking/rpc/eth/mod.rs              | 10    | -173 |
+------------------------------------------------------+-------+------+
| ethrex/crates/networking/rpc/lib.rs                  | 28    | +2   |
+------------------------------------------------------+-------+------+
| ethrex/crates/networking/rpc/test_utils.rs           | 297   | +297 |
+------------------------------------------------------+-------+------+
| ethrex/crates/networking/rpc/utils.rs                | 296   | -88  |
+------------------------------------------------------+-------+------+

@cdiielsi cdiielsi changed the title refactor(l1): take all dummies into a test_util dir refactor(l1): bring all test modules in the rpc crate into a single test_util modeule Nov 6, 2025
@cdiielsi cdiielsi changed the title refactor(l1): bring all test modules in the rpc crate into a single test_util modeule refactor(l1): bring all test modules in the rpc crate into a single test_util module Nov 6, 2025
@cdiielsi cdiielsi marked this pull request as ready for review November 6, 2025 20:25
@cdiielsi cdiielsi requested a review from a team as a code owner November 6, 2025 20:25
@ethrex-project-sync ethrex-project-sync bot moved this to In Review in ethrex_l1 Nov 6, 2025
@cdiielsi cdiielsi marked this pull request as draft November 6, 2025 22:44
@ethrex-project-sync ethrex-project-sync bot moved this from In Review to In Progress in ethrex_l1 Nov 6, 2025
@cdiielsi cdiielsi marked this pull request as ready for review November 7, 2025 13:22
@ethrex-project-sync ethrex-project-sync bot moved this from In Progress to In Review in ethrex_l1 Nov 7, 2025
Copy link
Contributor

@ElFantasma ElFantasma left a comment

Choose a reason for hiding this comment

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

I think it improves code quality 👍

@cdiielsi cdiielsi added this pull request to the merge queue Nov 7, 2025
Merged via the queue into main with commit ee07397 Nov 7, 2025
42 checks passed
@cdiielsi cdiielsi deleted the test_util_for_dummies branch November 7, 2025 17:46
@github-project-automation github-project-automation bot moved this from In Review to Done in ethrex_l1 Nov 7, 2025
xqft pushed a commit that referenced this pull request Nov 11, 2025
…est_util module (#5213)

**Motivation**

Stop having all the dummy() functions that create non-working components
spread all around the code.

**Description**

This pr brings all test utils in the rpc crate into a single test_utils
module, including all the dummy() functions that were spread all around
the code.

This pr only focuses in the rpc crate to tackle issue #5070 since it's
the only one that had a test_utils module and required having a dummy
instance of a component to be created for testing.

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

Labels

L1 Ethereum client

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Refactor: Put all mock object creation in a single test_util module

4 participants