Skip to content

feat(ethexe-rpc): Serialize ReplyCode as hex string of bytes. #5048

Merged
ecol-master merged 4 commits intomasterfrom
kuzmindev/feat/reply-code-to-json
Dec 21, 2025
Merged

feat(ethexe-rpc): Serialize ReplyCode as hex string of bytes. #5048
ecol-master merged 4 commits intomasterfrom
kuzmindev/feat/reply-code-to-json

Conversation

@ecol-master
Copy link
Member

@ecol-master ecol-master commented Dec 19, 2025

Promise serialization before PR:

{"tx_hash"
{"hash":"0x0000000000000000000000000000000000000000000000000000000000000000"},"reply":{"payload":"0x01020304","value":1000,
"code":{"Success":"Manual"}}}

Now:

{"tx_hash":{"hash":"0x0000000000000000000000000000000000000000000000000000000000000000"},"reply":{"payload":"0x01020304","value":1000,
"code":"0x00010000"}}

Note: in another pull request I will fix the problem with serializing tx_hash: {"hash": "0x00.."}}.

@osipov-mit @breathx

@semanticdiff-com
Copy link

semanticdiff-com bot commented Dec 19, 2025

Review changes with  SemanticDiff

Changed Files
File Status
  core/src/rpc.rs  0% smaller

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @ecol-master, 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 the representation of ReplyCode in RPC responses by serializing it as a consistent hex string of bytes. This change improves the predictability and machine-readability of RPC data, moving away from a more complex object structure to a simpler, uniform byte-based representation.

Highlights

  • ReplyCode Serialization Format: The serialization format for ReplyCode within ethexe-rpc has been changed from an object representation (e.g., {"Success":"Manual"}) to a hex string of its byte representation (e.g., "0x00010000").
  • Custom Serializer/Deserializer: A new module, serialize_reply_code, has been introduced in core/src/rpc.rs to handle the custom serialization and deserialization logic for ReplyCode.
  • Conditional Compilation: The custom serialization is applied conditionally using #[cfg_attr(feature = "std", serde(with = "serialize_reply_code"))], ensuring it's only active when the std feature is enabled.
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.

@ecol-master ecol-master marked this pull request as ready for review December 19, 2025 12:02
@ecol-master ecol-master self-assigned this Dec 19, 2025
@ecol-master ecol-master added A0-pleasereview PR is ready to be reviewed by the team javascript Pull requests that update Javascript code D8-ethexe ethexe-related PR labels Dec 19, 2025
@ecol-master ecol-master force-pushed the kuzmindev/feat/reply-code-to-json branch from efa86f0 to 55a5256 Compare December 19, 2025 12:06
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 custom serialization for ReplyCode to a hex string, which is a good improvement for RPC communication. The implementation is solid, and the provided suggestions for optimizing both serialization and deserialization by avoiding heap allocations using stack-allocated buffers will make the code more efficient.

@ecol-master
Copy link
Member Author

/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 changes the serialization of ReplyCode to be a hex string, which is a good improvement for RPC interfaces. I've added a couple of suggestions. One is to optimize the serialization to reduce string allocations, and the other is to improve an error message in the deserialization logic for better clarity. Overall, the changes are well-implemented.

@ecol-master
Copy link
Member Author

/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 custom serialization for ReplyCode to represent it as a hex string in JSON, which is a good improvement for RPC consistency. The implementation is sound, but I've suggested an optimization in the serialize function to avoid heap allocations by using a stack-based buffer. This will improve performance and memory efficiency.

@ecol-master ecol-master merged commit d20ae27 into master Dec 21, 2025
31 checks passed
@ecol-master ecol-master deleted the kuzmindev/feat/reply-code-to-json branch December 21, 2025 18:44
grishasobol added a commit that referenced this pull request Jan 22, 2026
grishasobol added a commit that referenced this pull request Jan 22, 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 javascript Pull requests that update Javascript code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants