Skip to content

feat(ethexe): Producer provides only promises hashes, instead of its full body #5132

Open
ecol-master wants to merge 13 commits intomasterfrom
kuzmindev/feat/producer-send-promises-hashes
Open

feat(ethexe): Producer provides only promises hashes, instead of its full body #5132
ecol-master wants to merge 13 commits intomasterfrom
kuzmindev/feat/producer-send-promises-hashes

Conversation

@ecol-master
Copy link
Member

No description provided.

@semanticdiff-com
Copy link

semanticdiff-com bot commented Feb 6, 2026

Review changes with  SemanticDiff

Changed Files
File Status
  ethexe/service/src/tests/utils/events.rs  65% smaller
  ethexe/network/src/lib.rs  57% smaller
  ethexe/rpc/src/lib.rs  42% smaller
  ethexe/network/src/validator/topic.rs  36% smaller
  ethexe/rpc/src/tests.rs  34% smaller
  ethexe/consensus/src/validator/producer.rs  31% smaller
  ethexe/service/src/tests/mod.rs  30% smaller
  ethexe/common/src/mock.rs  14% smaller
  ethexe/rpc/src/apis/injected.rs  14% smaller
  ethexe/db/src/database.rs  12% smaller
  ethexe/common/src/injected.rs  9% smaller
  ethexe/consensus/src/validator/mod.rs  5% smaller
  ethexe/consensus/src/lib.rs  2% smaller
  ethexe/compute/src/compute.rs  1% smaller
  ethexe/common/src/db.rs  1% smaller
  Cargo.lock Unsupported file format
  ethexe/consensus/src/utils.rs  0% smaller
  ethexe/db/Cargo.toml Unsupported file format
  ethexe/network/src/gossipsub.rs  0% smaller
  ethexe/rpc/Cargo.toml Unsupported file format
  ethexe/service/src/lib.rs Unsupported file format

@gemini-code-assist
Copy link

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 refactors the handling and propagation of transaction promises within the ethexe system to improve network efficiency. Instead of transmitting the full body of signed promises, producers now send a compact bundle containing only the hashes of promises along with their signatures. The complete promise data is stored locally in the database and retrieved by RPC services as needed, optimizing bandwidth usage and streamlining the data flow for promises.

Highlights

  • Network Efficiency: Producers now transmit PromisesNetworkBundle containing CompactSignedPromise (transaction hash, address, signature) instead of full SignedPromise objects, significantly reducing network payload size.
  • Database Integration for Promises: New InjectedStorageRO/RW trait methods and their implementation in ethexe-db allow Promise objects to be stored and retrieved by their transaction hash, enabling local persistence of full promise bodies.
  • RPC API Adaptation: The RPC API (InjectedApi) is updated to handle PromisesNetworkBundle and now fetches the full Promise body from the database when a compact signed promise is received for a subscriber, ensuring data completeness while maintaining network efficiency.
  • Consensus Layer Update: The consensus event ConsensusEvent::Promises now carries a PromisesNetworkBundle, aligning the consensus layer with the new network transmission model.
  • Test Refactoring: Mock services and tests across the codebase have been updated to reflect the new promise bundling and database interaction logic, ensuring correctness of the new implementation.
Changelog
  • ethexe/common/src/db.rs
    • Added Promise type to injected module imports.
    • Extended InjectedStorageRO trait with promise method to retrieve a Promise by its transaction hash.
    • Extended InjectedStorageRW trait with set_promise method to store a Promise.
  • ethexe/common/src/injected.rs
    • Introduced PromisesNetworkBundle struct for bundling compact signed promises.
    • Introduced CompactSignedPromise struct to represent a signed promise using only the transaction hash, address, and signature.
    • Added utility methods (create, create_from_private_key, tx_hash, into_parts) to CompactSignedPromise.
  • ethexe/common/src/mock.rs
    • Implemented Mock trait for Promise to facilitate testing.
  • ethexe/compute/src/compute.rs
    • Updated ComputeSubService to store computed Promise objects in the database using the new set_promise method.
  • ethexe/consensus/src/lib.rs
    • Updated ConsensusEvent::Promises to use PromisesNetworkBundle instead of Vec<SignedPromise>.
  • ethexe/consensus/src/validator/producer.rs
    • Modified producer logic to create and emit PromisesNetworkBundle containing CompactSignedPromise instances.
  • ethexe/db/src/database.rs
    • Added Promise as a new Key type for database storage.
    • Implemented InjectedStorageRO::promise and InjectedStorageRW::set_promise for database interaction with Promise objects.
  • ethexe/network/src/gossipsub.rs
    • Refactored Message enum to use PromisesBundle(PromisesNetworkBundle) instead of Promise(SignedPromise).
    • Adjusted message encoding and decoding for the new bundle type.
  • ethexe/network/src/lib.rs
    • Updated NetworkEvent to include PromisesBundle.
    • Modified NetworkService to publish and handle PromisesNetworkBundle.
  • ethexe/network/src/validator/topic.rs
    • Adapted verification methods to accept PromisesNetworkBundle.
    • Temporarily commented out detailed promise verification logic and related tests for future implementation.
  • ethexe/rpc/src/apis/injected.rs
    • Added database dependency to InjectedApi.
    • Introduced receive_promises_bundle for handling incoming bundles.
    • Modified send_promise to retrieve full Promise from DB using CompactSignedPromise data.
  • ethexe/rpc/src/lib.rs
    • Updated RpcServer initialization to pass database to InjectedApi.
    • Replaced individual promise provision methods with provide_promises_bundle.
  • ethexe/rpc/src/tests.rs
    • Updated mock service and test cases to use PromisesNetworkBundle and interact with the mock database for promises.
  • ethexe/service/src/lib.rs
    • Adjusted event handling to process PromisesNetworkBundle from network and consensus events.
  • ethexe/service/src/tests/mod.rs
    • Updated injected_tx_fungible_token test to verify promises via the database using the new bundle structure.
  • ethexe/service/src/tests/utils/events.rs
    • Updated TestingNetworkEvent to reflect the PromisesNetworkBundle type.
Activity
  • The pull request was created by ecol-master.
  • The primary goal is to optimize network communication by sending only promise hashes instead of full promise bodies.
  • Changes involve significant refactoring across common data structures, database interactions, network protocols, and RPC APIs to support this new approach.
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 refactors the handling of promises by the producer to send compact, signed promise hashes instead of the full promise body, which is a good optimization for network bandwidth. The changes are spread across multiple crates, introducing PromisesNetworkBundle and CompactSignedPromise and updating the database, consensus, and network layers to support this new flow.

However, the implementation appears to be incomplete and contains several critical issues that must be addressed:

  • The verification logic for promise bundles in ethexe/network/src/validator/topic.rs is commented out, which poses a significant security risk.
  • The associated tests for this verification are also disabled.
  • The RPC API implementation in ethexe/rpc/src/apis/injected.rs contains multiple todo! placeholders for crucial logic and error handling.

These issues suggest the feature is not ready for merging. I've left specific comments on these points. Additionally, I've suggested a minor performance improvement in ethexe/compute/src/compute.rs.

@ecol-master ecol-master force-pushed the kuzmindev/feat/producer-send-promises-hashes branch from 77cdb86 to a1e405c Compare February 6, 2026 08:44
@ecol-master ecol-master marked this pull request as ready for review February 11, 2026 07:44
@ecol-master ecol-master added the A0-pleasereview PR is ready to be reviewed by the team label Feb 11, 2026
@ecol-master ecol-master self-assigned this Feb 11, 2026
@grishasobol grishasobol added the D8-ethexe ethexe-related PR label Feb 12, 2026
Copy link
Member

@grishasobol grishasobol left a comment

Choose a reason for hiding this comment

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

LGTM , but please wait for @ark0f approve


/// The hashes of [`Promise`].
#[derive(Debug, Clone, Encode, Decode, PartialEq, Eq)]
pub struct CompactPromiseHashes {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
pub struct CompactPromiseHashes {
pub struct CompactPromise {

///
/// [`CompactPromiseHashes`] is a lightweight version of [`SignedPromise`], that is
/// needed to reduce the amount of data transferred in network between validators.
pub type CompactSignedPromise = SignedMessage<CompactPromiseHashes>;
Copy link
Member

Choose a reason for hiding this comment

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

For naming compatibility I think better to use SignedCompactPromise (using Signed as prefix)

Comment on lines +157 to +164
pub fn provide_compact_promise(&self, compact_promise: CompactSignedPromise) {
self.injected_api.receive_compact_promise(compact_promise);
}

pub fn provide_compact_promises(&self, compact_promises: Vec<CompactSignedPromise>) {
compact_promises
.into_iter()
.for_each(|compact_promise| self.provide_compact_promise(compact_promise));
Copy link
Member

Choose a reason for hiding this comment

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

I'm not insisting, but I think receive_compact_promises is better naming. You even have the same for injected_api.

Or maybe something like handle_compact_promises or process_compact_promises

Comment on lines +61 to +65
#[method(name = "getTransactionPromise")]
async fn get_transaction_promise(
&self,
tx_hash: HashOf<InjectedTransaction>,
) -> RpcResult<Option<SignedPromise>>;
Copy link
Member

Choose a reason for hiding this comment

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

Not important. I think for RPC call it's better to return error in None cases

Comment on lines +171 to +173
promises.clone().into_iter().for_each(|promise| {
db.set_promise(promise);
});
Copy link
Member

Choose a reason for hiding this comment

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

Could we move this to RPC? as I can see it's completely useless except if it's RPC. So, better to avoid useless cross services guaranties (in this case compute guaranties for RPC that promises are set in database)

.collect::<Result<_, _>>()?;
let (signer, public_key) = (&self.ctx.core.signer, self.ctx.core.pub_key);
let signed_promises =
sign_announce_promises(signer, public_key, computed_data.promises)?;
Copy link
Member

Choose a reason for hiding this comment

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

not important, for me is much more clear without sign_announce_promises - the logic is too specific and trivial to move it to separate function

// TODO: rename to `Validators`
Commitments(SignedValidatorMessage),
Promise(SignedPromise),
Promise(CompactSignedPromise),
Copy link
Member

Choose a reason for hiding this comment

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

@ark0f whether we should bump network version

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.

4 participants