Skip to content

refactor(ethexe/db): move announces from BlockMeta to AnnounceStorage#5060

Open
playX18 wants to merge 16 commits intomasterfrom
ap-move-anounces
Open

refactor(ethexe/db): move announces from BlockMeta to AnnounceStorage#5060
playX18 wants to merge 16 commits intomasterfrom
ap-move-anounces

Conversation

@playX18
Copy link
Member

@playX18 playX18 commented Jan 7, 2026

Resolves #4945

@gear-tech/dev

@playX18 playX18 self-assigned this Jan 7, 2026
@playX18 playX18 added the A0-pleasereview PR is ready to be reviewed by the team label Jan 7, 2026
@semanticdiff-com
Copy link

semanticdiff-com bot commented Jan 7, 2026

Review changes with  SemanticDiff

Changed Files
File Status
  ethexe/processor/src/tests.rs  84% smaller
  ethexe/consensus/src/validator/core.rs  83% smaller
  ethexe/compute/src/tests.rs  73% smaller
  ethexe/consensus/src/announces.rs  70% smaller
  ethexe/service/src/tests/mod.rs  56% smaller
  ethexe/network/src/db_sync/responses.rs  54% smaller
  ethexe/rpc/src/utils.rs  53% smaller
  ethexe/consensus/src/validator/initial.rs  42% smaller
  ethexe/network/src/db_sync/mod.rs  37% smaller
  ethexe/db/src/verifier.rs  35% smaller
  ethexe/common/src/mock.rs  16% smaller
  ethexe/db/src/database.rs  1% smaller
  ethexe/common/src/utils.rs  1% smaller
  ethexe/common/src/db.rs  0% smaller
  ethexe/db/src/iterator.rs  0% smaller
  gsdk/src/api.rs  0% smaller

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @playX18, 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 storage mechanism for 'announces' data by moving it out of the BlockMeta structure and into a dedicated storage solution. This change addresses technical debt by enhancing modularity and clarifying data ownership within the database layer. The 'announces' are now managed through specific read and write interfaces on the AnnounceStorage trait, which improves the overall organization and maintainability of the codebase.

Highlights

  • Data Relocation: The 'announces' field, previously part of the BlockMeta struct, has been removed to improve data organization.
  • Dedicated Announce Storage: New methods (block_announces, set_block_announces, mutate_block_announces) have been added to the AnnounceStorageRO and AnnounceStorageRW traits, providing a dedicated interface for managing block-specific announces.
  • New Database Key: A new database key, Key::BlockAnnounces, has been introduced in ethexe/db/src/database.rs to store block announces independently, separate from BlockMeta.
  • Codebase Update: All existing references and operations on BlockMeta.announces across the codebase have been updated to utilize the new AnnounceStorage interfaces, ensuring consistency with the refactored data structure.
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 refactors the database schema to move the announces field from BlockMeta into its own AnnounceStorage. The changes are extensive, touching many parts of the codebase that interact with block announces. The refactoring is well-executed, with the new database access patterns correctly implemented in most places. I've identified a critical issue regarding error handling in the database layer that could lead to a panic, and a logic change in a test file that should be addressed for correctness. Overall, this is a solid refactoring that improves the database design.

@playX18 playX18 added the D8-ethexe ethexe-related PR label Jan 8, 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.

Requires a migration

f: impl FnOnce(&mut BTreeSet<HashOf<Announce>>),
);

fn take_block_announces(&self, block_hash: H256) -> Option<BTreeSet<HashOf<Announce>>>;
Copy link
Member

Choose a reason for hiding this comment

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

take_block_announces is not safe to be used - remove it please

Comment on lines +425 to +430
if let Some(announces) = announces {
db.set_block_announces(hash, announces);
} else {
// take announces, might've been set-up by previous test.
db.take_block_announces(hash);
}
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 to consider this case. This is for testing perporses only and if test creator wanna to do something like this - he must clean database and make a setup for empty database

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.

ethexe: move announces from BlockMeta to announce storage in database

3 participants