Skip to content

Conversation

@techraed
Copy link
Contributor

@techraed techraed commented Dec 3, 2025

No description provided.

@techraed techraed self-assigned this Dec 3, 2025
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @techraed, 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 lays the groundwork for a more robust and traceable communication layer within the Sails protocol by introducing a standardized binary header. This header provides essential metadata for messages, such as protocol version, interface identification, and routing information, which is crucial for building reliable and interoperable services on IDLv2, particularly in a blockchain environment. The changes ensure that messages can be efficiently serialized, deserialized, and matched against known interfaces.

Highlights

  • New Binary Protocol Header: Introduced SailsMessageHeader and related components (Magic, Version, HeaderLength) to define a structured binary header for the Sails protocol, enabling better message tracing and program interaction.
  • Interface ID Refinement: The InterfaceId type in sails-idl-meta has been refactored from a raw [u8; 8] array into a newtype struct, now implementing parity-scale-codec's Encode and Decode traits for improved serialization and deserialization.
  • Macro and Snapshot Updates: Updated the service macro logic to correctly generate code using the new InterfaceId struct, and consequently, all relevant snapshot tests have been refreshed to reflect these changes.
  • Dependency Addition: Added parity-scale-codec as a new dependency to sails-idl-meta to facilitate efficient binary encoding and decoding of the new header components.
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

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

This PR introduces the initial version of a binary protocol header for Sails messages, enhancing the protocol with structured message identification and routing capabilities. The changes transform the InterfaceId from a raw byte array into a proper type and add comprehensive header serialization/deserialization support.

Key Changes:

  • Introduces a new header module implementing the Sails binary protocol header with magic bytes ("GM"), version control, and message routing capabilities
  • Refactors InterfaceId from [u8; 8] to a structured type with serialization/deserialization methods
  • Updates all macro-generated code to use the new InterfaceId type, accessing the underlying bytes via the .0 field where needed

Reviewed changes

Copilot reviewed 32 out of 34 changed files in this pull request and generated 12 comments.

Show a summary per file
File Description
rs/src/lib.rs Exports the new header module
rs/src/header.rs Implements the complete Sails message header protocol including builder pattern, serialization, and interface matching logic
rs/idl-meta/src/lib.rs Defines InterfaceId as a structured type with Encode/Decode implementations
rs/idl-meta/Cargo.toml Adds parity-scale-codec dependency for serialization
rs/macros/core/src/service/meta.rs Updates macro code generation to use InterfaceId type and access .0 field for base services
rs/macros/core/tests/snapshots/*.snap Updates all snapshot tests to reflect the new InterfaceId type in generated code
rs/ethexe/macros-tests/tests/snapshots/*.snap Updates ethexe snapshot tests for consistency
rs/idl-gen/tests/generator.rs Updates test fixtures to use the new InterfaceId type
Cargo.lock, rs/ethexe/Cargo.lock Lock file updates for the new dependency

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

@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 the initial version of the header for the sails-binary protocol, including InterfaceId struct and SailsMessageHeader with its components (Magic, Version, HeaderLength). The changes involve updating dependencies to include parity-scale-codec, refactoring macro-generated code to use the new InterfaceId struct, and adding a new module header.rs for the protocol header definition and serialization/deserialization logic. While the overall structure and builder pattern are well-designed, there is a critical issue in the Decode implementations for the header components that needs to be addressed for correct streaming deserialization.

@vobradovich
Copy link
Member

/gemini review

Copy link
Contributor

@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 an initial version of the header for the sails-binary protocol, which is a significant step forward. The introduction of a strongly-typed InterfaceId and the new header.rs module are great additions. My review focuses on improving correctness, efficiency, and maintainability in the new header implementation. I've identified a potential bug in the SailsMessageHeader::decode implementation regarding header length handling, as well as several opportunities to simplify and optimize the encoding/decoding logic. The test coverage is good, though I've suggested a minor clarification for one test case.

@techraed techraed merged commit 123d7dd into master-idl-v2 Dec 16, 2025
3 checks passed
@techraed techraed deleted the st-header-type-idlv2 branch December 16, 2025 12:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants