-
Notifications
You must be signed in to change notification settings - Fork 5
feat: introduce initial version of the header for sails-binary protocol #1127
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
Conversation
Summary of ChangesHello @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
Using Gemini Code AssistThe 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
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 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
|
There was a problem hiding this 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
headermodule implementing the Sails binary protocol header with magic bytes ("GM"), version control, and message routing capabilities - Refactors
InterfaceIdfrom[u8; 8]to a structured type with serialization/deserialization methods - Updates all macro-generated code to use the new
InterfaceIdtype, accessing the underlying bytes via the.0field 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.
There was a problem hiding this 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.
|
/gemini review |
There was a problem hiding this 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.
No description provided.