refactor(ethexe/db): move announces from BlockMeta to AnnounceStorage#5060
refactor(ethexe/db): move announces from BlockMeta to AnnounceStorage#5060
Conversation
Changed Files
|
Summary of ChangesHello @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 Highlights
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 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.
| f: impl FnOnce(&mut BTreeSet<HashOf<Announce>>), | ||
| ); | ||
|
|
||
| fn take_block_announces(&self, block_hash: H256) -> Option<BTreeSet<HashOf<Announce>>>; |
There was a problem hiding this comment.
take_block_announces is not safe to be used - remove it please
| 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); | ||
| } |
There was a problem hiding this comment.
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
Resolves #4945
@gear-tech/dev