Skip to content

feat(ethexe-consensus): Limits for BatchCommitment production#5214

Draft
ecol-master wants to merge 4 commits intomasterfrom
5205-ethexe-set-limits-for-batch-commitment-production
Draft

feat(ethexe-consensus): Limits for BatchCommitment production#5214
ecol-master wants to merge 4 commits intomasterfrom
5205-ethexe-set-limits-for-batch-commitment-production

Conversation

@ecol-master
Copy link
Member

@ecol-master ecol-master commented Mar 11, 2026

@ecol-master ecol-master linked an issue Mar 11, 2026 that may be closed by this pull request
@semanticdiff-com
Copy link

semanticdiff-com bot commented Mar 11, 2026

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello, 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 introduces a significant refactoring to the ethexe-consensus module by extracting the complex logic responsible for aggregating different types of commitments into a BatchCommitment into a new, dedicated BatchBuilder component. This change enhances modularity, improves code organization, and centralizes batch production configuration through the new BatchLimits struct, making the system more maintainable and easier to understand.

Highlights

  • Refactored Batch Commitment Aggregation: The logic for aggregating various commitments (chain, code, validators, rewards) into a BatchCommitment has been moved from ValidatorCore to a new dedicated BatchBuilder struct.
  • Introduced BatchBuilder and BatchLimits: A new batch.rs module was added, defining BatchBuilder to encapsulate batch commitment creation and BatchLimits to centralize configuration parameters like chain_deepness_threshold and commitment_delay_limit.
  • Delegation in ValidatorCore: ValidatorCore now includes an instance of BatchBuilder and delegates all batch commitment aggregation tasks to it, simplifying ValidatorCore's responsibilities.
Changelog
  • ethexe/consensus/src/validator/batch.rs
    • New file added, containing BatchBuilder and BatchLimits structs, and the logic for aggregating various commitments.
  • ethexe/consensus/src/validator/core.rs
    • Refactored ValidatorCore to remove batch commitment aggregation methods and delegate them to BatchBuilder.
    • Updated imports and ElectionRequest fields.
  • ethexe/consensus/src/validator/mock.rs
    • Updated mock context to initialize and use the new BatchBuilder.
  • ethexe/consensus/src/validator/mod.rs
    • Updated module structure and ValidatorService initialization to incorporate BatchBuilder and BatchLimits.
  • ethexe/consensus/src/validator/producer.rs
    • Modified Producer to use the BatchBuilder for aggregating batch commitments.
Activity
  • No specific 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
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 is a solid refactoring that extracts the logic for creating BatchCommitment into a new BatchBuilder. This improves the code's structure and modularity. My review includes a couple of suggestions to further improve the design by removing some redundant configuration fields and improving encapsulation.

Comment on lines +329 to 333
// TODO: remove this pub here
pub at_block_hash: H256,
pub at_timestamp: u64,
pub max_validators: u32,
}
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

Instead of making the fields public and adding a TODO, consider keeping them private and adding a pub(crate) constructor (new). This is a more idiomatic way to handle this in Rust as it improves encapsulation. You would also need to add pub(crate) getters for the fields that are accessed from other modules within the crate.

committer: committer.into(),
middleware: MiddlewareWrapper::from_inner(election_provider),
middleware,
batch_builder,
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

Now that batch_builder is part of ValidatorCore, the chain_deepness_threshold and commitment_delay_limit fields on ValidatorCore are redundant. These are already configured in BatchLimits inside batch_builder.

To avoid duplication and have a single source of truth, I suggest:

  1. Remove chain_deepness_threshold and commitment_delay_limit from ValidatorCore.
  2. In ValidatorCore::validate_batch_commitment_request, use self.batch_builder.limits.commitment_delay_limit. This will require making limits in BatchBuilder accessible (e.g., pub(crate)).
  3. Update the initialization of ValidatorCore here and in mock.rs to remove the redundant fields.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ethexe: set limits for batch commitment production

1 participant