feat(ethexe-consensus): Limits for BatchCommitment production#5214
feat(ethexe-consensus): Limits for BatchCommitment production#5214ecol-master wants to merge 4 commits intomasterfrom
ethexe-consensus): Limits for BatchCommitment production#5214Conversation
Changed Files
|
Summary of ChangesHello, 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 Highlights
Changelog
Activity
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.
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.
| // TODO: remove this pub here | ||
| pub at_block_hash: H256, | ||
| pub at_timestamp: u64, | ||
| pub max_validators: u32, | ||
| } |
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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:
- Remove
chain_deepness_thresholdandcommitment_delay_limitfromValidatorCore. - In
ValidatorCore::validate_batch_commitment_request, useself.batch_builder.limits.commitment_delay_limit. This will require makinglimitsinBatchBuilderaccessible (e.g.,pub(crate)). - Update the initialization of
ValidatorCorehere and inmock.rsto remove the redundant fields.
Resolves #5205, #4791
@grishasobol @breathx