Skip to content

feat(l1): properly format client version #2564

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

Merged
merged 44 commits into from
Apr 30, 2025

Conversation

mechanix97
Copy link
Contributor

@mechanix97 mechanix97 commented Apr 23, 2025

Motivation

The client version was hardcoded in the rpc crate

It was used in the client RPC msg, in the admin_info RPC msg and in the helloMsg in P2P

Description

Added vergen crate to include more environment variables at build time in the ethrex main package.

It can be tested using the following cast commands

 cast client --rpc-url localhost:8545
 cast rpc admin_nodeInfo --rpc-url http://localhost:8545

Modified the P2PContext struct to include the client_info
Also added it in the struct RLPxConnection to pass it to the helloMessage struct when doing the handshake

Modified the test to use the functions with a dummy client_info

The version can now be retrieved by using ethrex --version

Closes #2548

@mechanix97 mechanix97 changed the title feat() properly format client version feat(L1): properly format client version Apr 23, 2025
@mechanix97 mechanix97 changed the title feat(L1): properly format client version feat(l1): properly format client version Apr 23, 2025
Copy link

github-actions bot commented Apr 23, 2025

Lines of code report

Total lines added: 45
Total lines removed: 2
Total lines changed: 47

Detailed view
+------------------------------------------------------+-------+------+
| File                                                 | Lines | Diff |
+------------------------------------------------------+-------+------+
| ethrex/cmd/ethrex/build.rs                           | 7     | +7   |
+------------------------------------------------------+-------+------+
| ethrex/cmd/ethrex/cli.rs                             | 331   | -1   |
+------------------------------------------------------+-------+------+
| ethrex/cmd/ethrex/initializers.rs                    | 379   | +5   |
+------------------------------------------------------+-------+------+
| ethrex/cmd/ethrex/utils.rs                           | 128   | +10  |
+------------------------------------------------------+-------+------+
| ethrex/crates/networking/p2p/discv4/server.rs        | 682   | +1   |
+------------------------------------------------------+-------+------+
| ethrex/crates/networking/p2p/network.rs              | 177   | +4   |
+------------------------------------------------------+-------+------+
| ethrex/crates/networking/p2p/rlpx/connection.rs      | 540   | +5   |
+------------------------------------------------------+-------+------+
| ethrex/crates/networking/p2p/rlpx/handshake.rs       | 426   | +2   |
+------------------------------------------------------+-------+------+
| ethrex/crates/networking/p2p/rlpx/p2p.rs             | 240   | +3   |
+------------------------------------------------------+-------+------+
| ethrex/crates/networking/rpc/admin/mod.rs            | 58    | +1   |
+------------------------------------------------------+-------+------+
| ethrex/crates/networking/rpc/eth/max_priority_fee.rs | 130   | +1   |
+------------------------------------------------------+-------+------+
| ethrex/crates/networking/rpc/lib.rs                  | 15    | -1   |
+------------------------------------------------------+-------+------+
| ethrex/crates/networking/rpc/rpc.rs                  | 647   | +4   |
+------------------------------------------------------+-------+------+
| ethrex/crates/networking/rpc/utils.rs                | 413   | +2   |
+------------------------------------------------------+-------+------+

@mechanix97 mechanix97 added the L1 Ethereum client label Apr 23, 2025
@mechanix97 mechanix97 added the p2p Issues related to p2p network label Apr 24, 2025
@mechanix97 mechanix97 marked this pull request as ready for review April 24, 2025 14:56
@mechanix97 mechanix97 requested a review from a team as a code owner April 24, 2025 14:56
Copy link
Member

@MarcosNicolau MarcosNicolau left a comment

Choose a reason for hiding this comment

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

Shouldn't we also update this in the p2p HelloMessage exchange, see here.

@mechanix97 mechanix97 moved this to In Progress in ethrex_l1 Apr 24, 2025
@mechanix97 mechanix97 removed this from ethrex_l1 Apr 24, 2025
Copy link
Collaborator

@mpaulucci mpaulucci left a comment

Choose a reason for hiding this comment

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

This looks good, but Im not convinced we should add this to the common crate. I think it should be in the p2p crate probably, and there should be a way for the rpc crate to ask this info from the p2p crate. This requires a bigger refactor which is out of scope of this PR. Let's think about it for a minute and then we can go back to this.

@mechanix97 mechanix97 marked this pull request as ready for review April 28, 2025 18:12
Copy link
Collaborator

@rodrigo-o rodrigo-o left a comment

Choose a reason for hiding this comment

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

Looking good so far, left some comments

@mechanix97 mechanix97 enabled auto-merge April 30, 2025 21:52
@mechanix97 mechanix97 added this pull request to the merge queue Apr 30, 2025
Merged via the queue into main with commit 084204c Apr 30, 2025
21 checks passed
@mechanix97 mechanix97 deleted the feat/properly-format-client-version branch April 30, 2025 22:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
L1 Ethereum client p2p Issues related to p2p network
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Properly format client version
4 participants