Skip to content
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

feat(l1): add p2p context #1794

Merged
merged 4 commits into from
Jan 24, 2025
Merged

feat(l1): add p2p context #1794

merged 4 commits into from
Jan 24, 2025

Conversation

Arkenan
Copy link
Collaborator

@Arkenan Arkenan commented Jan 23, 2025

Motivation

There are many shared attributes in all p2p tasks:

  • Local node
  • Signer
  • TCP and UDP addresses
  • RLPX message Broadcaster.
  • Kademlia table.

This makes the number of arguments big in all calls, and sometimes even repeated (e.g. addresses + node). Additionally, Adding a new argument related to all, like the broadcaster, also requires adding it everywhere.

Changes

This PR adds a Context struct with all the mentioned common fields and uses it instead of the individual fields. There's also 2 new helpers in the Node struct, for udp and tcp addresses.

Copy link

github-actions bot commented Jan 23, 2025

| File                                                           | Lines | Diff |
+----------------------------------------------------------------+-------+------+
| /home/runner/work/ethrex/ethrex/crates/networking/p2p/net.rs   | 1113  | -18  |
+----------------------------------------------------------------+-------+------+
| /home/runner/work/ethrex/ethrex/crates/networking/p2p/types.rs | 235   | +6   |
+----------------------------------------------------------------+-------+------+

Total lines added: +6
Total lines removed: 18
Total lines changed: 24

@Arkenan Arkenan changed the title Add p2p context feat(l1): add p2p context Jan 23, 2025
@Arkenan Arkenan marked this pull request as ready for review January 24, 2025 15:11
@Arkenan Arkenan requested a review from a team as a code owner January 24, 2025 15:11
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.

Nice!

@Arkenan Arkenan added this pull request to the merge queue Jan 24, 2025
Merged via the queue into main with commit 11dd8f8 Jan 24, 2025
19 checks passed
@Arkenan Arkenan deleted the p2p-context-refactor branch January 24, 2025 15:44
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.

2 participants