refactor(ethexe/node-loader): simplify process_events loop and watch promises from injected messages#5268
refactor(ethexe/node-loader): simplify process_events loop and watch promises from injected messages#5268
Conversation
…promises from send_injected_message
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 refactors the node-loader's event processing logic to better support injected transactions. By leveraging promise-based replies for injected messages, the system can now resolve outcomes more efficiently. Additionally, the change cleans up event parsing by removing unnecessary statistics tracking and streamlining the logging infrastructure for better performance and clarity. 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. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request refactors the batch processing logic in the node loader to improve efficiency and logging. Key changes include the integration of Promise handling for injected transactions, which allows for immediate resolution of message statuses from RPC responses, and the removal of the ProcessEventsStats and BlockProcessStats tracking structures. Additionally, the PR transitions to structured logging and renames RPC methods to better reflect their functionality. A critical logic error was identified in the process_events function where a successful message outcome from mirror logs could be incorrectly overwritten by an error status from router transitions; a fix was suggested to ensure the more canonical source of truth is preserved.
| let entry = results.entry(mid).or_insert(Some("UNKNOWN".to_string())); | ||
| match (&entry, &status) { | ||
| (Some(current), None) if current == "UNKNOWN" => *entry = None, | ||
| (None, Some(_)) => *entry = status, |
There was a problem hiding this comment.
This logic incorrectly overwrites a successful outcome from mirror logs with an error from router transitions. If mirror logs indicate a message was successful (*entry is None), but transitions indicate an error (status is Some(error)), the success status is replaced by the error. This can lead to incorrect reporting of batch outcomes. It's safer to trust the mirror logs as the more canonical source of truth. Note that per repository guidelines, logging of this discrepancy should be handled by the outer processor rather than at this call site to avoid duplication.
| (None, Some(_)) => *entry = status, | |
| (None, Some(_)) => {}, |
References
- Error handling, such as logging, can be centralized in an outer component (e.g., an 'outer processor') rather than being duplicated at every call site.
@gear-tech/dev