Skip to content

chore!(ethexe-network): Unique protocol versioning#5147

Merged
ark0f merged 4 commits intomasterfrom
al/ethexe/unique-versions
Feb 13, 2026
Merged

chore!(ethexe-network): Unique protocol versioning#5147
ark0f merged 4 commits intomasterfrom
al/ethexe/unique-versions

Conversation

@ark0f
Copy link
Member

@ark0f ark0f commented Feb 12, 2026

No description provided.

@ark0f ark0f added A0-pleasereview PR is ready to be reviewed by the team D8-ethexe ethexe-related PR labels Feb 12, 2026
@semanticdiff-com
Copy link

semanticdiff-com bot commented Feb 12, 2026

Review changes with  SemanticDiff

Changed Files
File Status
  ethexe/network/src/db_sync/mod.rs  36% smaller
  ethexe/network/src/kad.rs  32% smaller
  ethexe/network/src/injected.rs  25% smaller
  ethexe/network/src/lib.rs  11% smaller
  ethexe/network/src/gossipsub.rs  0% smaller
  ethexe/network/src/peer_score.rs  0% smaller

@gemini-code-assist
Copy link

Summary of Changes

Hello @ark0f, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request standardizes network protocol versioning by hardcoding "1.0.0" for key services, moving away from dynamic package versioning. It also refines the peer scoring system by removing explicit penalties for unsupported protocols, focusing instead on data integrity and network behavior. Furthermore, the Kademlia DHT implementation has been improved to be more resilient to unknown record types, enhancing backward compatibility and future extensibility.

Highlights

  • Explicit Protocol Versioning: Network protocols for db-sync, injected-tx, and kad now use hardcoded "1.0.0" versions instead of dynamically generated CARGO_PKG_VERSION, ensuring stable and explicit protocol identification across the network.
  • Refined Peer Scoring: The concept of "unsupported protocol" has been removed from the peer scoring mechanism. Peers are no longer penalized for simply not supporting a specific protocol, shifting the focus of scoring to data validity and excessive data usage.
  • Kademlia Record Backward Compatibility: The Kademlia DHT implementation (kad.rs) has been enhanced to gracefully handle unknown record types during decoding, returning None instead of an error. This improves backward compatibility and allows for future protocol extensions without breaking older nodes.
  • Simplified Network Behaviour Initialization: The db_sync and injected network behaviours no longer require a peer_score::Handle during their initialization, streamlining their setup and reducing direct dependencies on the peer scoring system.
Changelog
  • ethexe/network/src/db_sync/mod.rs
    • Updated the STREAM_PROTOCOL constant to use a hardcoded version string "/ethexe/db-sync/1.0.0".
    • Removed the peer_score_handle field from the Behaviour struct.
    • Removed the peer_score_handle argument from the Behaviour's new function.
    • Removed calls to self.peer_score_handle.unsupported_protocol.
  • ethexe/network/src/gossipsub.rs
    • Removed the call to self.peer_score.unsupported_protocol when a peer doesn't support gossipsub.
  • ethexe/network/src/injected.rs
    • Removed the import for peer_score.
    • Updated the STREAM_PROTOCOL constant to use a hardcoded version string "/ethexe/injected-tx/1.0.0".
    • Removed the peer_score field from the Behaviour struct.
    • Modified the Behaviour::new function to no longer accept a peer_score::Handle.
    • Removed calls to self.peer_score.unsupported_protocol.
    • Updated test cases to reflect the change in Behaviour::new signature.
  • ethexe/network/src/kad.rs
    • Added Input trait import from parity_scale_codec.
    • Updated the KAD_PROTOCOL_NAME constant to use a hardcoded version string "/ethexe/kad/1.0.0".
    • Introduced MaybeRecordKey struct to facilitate backward-compatible decoding of RecordKey.
    • Modified RecordKey::new to return Result<Option<Self>, _> to handle unknown record types.
    • Modified Record::new to return anyhow::Result<Option<Self>> and handle None for unknown record types.
    • Updated Record::into_kad_record to use RecordKey::into_kad_key.
    • Adjusted Behaviour::poll logic to handle Ok(None) when decoding unknown Kademlia record types.
    • Updated existing test cases and added a new test unknown_record_type to verify the new handling.
  • ethexe/network/src/lib.rs
    • Removed the PROTOCOL_VERSION and AGENT_VERSION checks within the identify::Event::Received handler.
    • Updated the injected::Behaviour::new call to match its new signature (no peer_score_handle).
    • Modified a test case to call peer_score_handle.invalid_data multiple times instead of unsupported_protocol.
  • ethexe/network/src/peer_score.rs
    • Removed the UnsupportedProtocol variant from the ScoreDecreaseReason enum.
    • Removed the unsupported_protocol method from the Handle struct.
    • Removed the unsupported_protocol field from the Config struct and its new function.
Activity
  • No human activity has been recorded for this pull request yet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces several improvements to the network layer. The main change is hardcoding protocol versions for sub-protocols like db-sync, injected-tx, and kad, decoupling them from the crate version. This enhances protocol stability.

In line with this, the concept of penalizing peers for UnsupportedProtocol has been removed entirely, including the identify protocol version check. This allows for more flexible peer connections where nodes with different versions can still communicate over shared sub-protocols.

Additionally, this PR improves forward compatibility in the Kademlia implementation by gracefully handling unknown record types, which is a valuable enhancement for future updates.

The changes are well-implemented. I have one suggestion to improve the clarity of a test case, which is included in the specific comments.

@ark0f ark0f changed the title chore(ethexe-network): Unique protocol versioning chore!(ethexe-network): Unique protocol versioning Feb 13, 2026
@ark0f ark0f merged commit 5a1ac23 into master Feb 13, 2026
68 of 69 checks passed
@ark0f ark0f deleted the al/ethexe/unique-versions branch February 13, 2026 05:20
grishasobol added a commit that referenced this pull request Feb 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A0-pleasereview PR is ready to be reviewed by the team D8-ethexe ethexe-related PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants