-
Notifications
You must be signed in to change notification settings - Fork 122
staticaddr: poll deposits on block arrival #1003
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Summary of Changes
Hello @hieblmi, 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 deposit polling mechanism within the static address manager to improve efficiency. By transitioning from a time-based polling system to one that reacts to new block arrivals, the system reduces unnecessary resource consumption and ensures that deposit checks are performed only when relevant updates are expected.
Highlights
- Polling Mechanism Change: The method for polling new deposits has been updated from a continuous, ticker-based approach to an event-driven one, triggered by the arrival of new blocks.
- Resource Optimization: This change eliminates wasteful continuous polling, leading to more efficient resource utilization by only checking for deposits when relevant blockchain events occur.
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 in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.
| 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 issue 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
-
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. ↩
There was a problem hiding this 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 deposit polling mechanism to trigger on new block arrivals instead of a fixed ticker, which is a good efficiency improvement. However, the implementation introduces a critical race condition by potentially running multiple deposit polling operations concurrently. My review includes a comment detailing this issue and suggests a fix to ensure safe concurrent execution.
4f5d84c to
36e4ff3
Compare
|
/gemini review |
There was a problem hiding this 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 deposit polling mechanism from a time-based ticker to an event-driven approach, triggering a poll on each new block arrival. This is a good optimization to reduce wasteful polling. The implementation uses a semaphore to prevent concurrent polling, which is well-executed. My main feedback is to consider re-introducing an initial poll at startup to ensure timely detection of deposits that occurred while the service was offline.
36e4ff3 to
4dcb882
Compare
|
/gemini review |
There was a problem hiding this 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 deposit polling mechanism, moving from a time-based ticker to a more efficient block-arrival trigger. The implementation is robust, introducing a pollingGate semaphore to prevent concurrent reconciliation runs, which is a great pattern for this kind of event-driven logic. The changes are clear, correct, and represent a significant improvement in efficiency by eliminating unnecessary polling cycles. The code quality is high, and I have no further suggestions for improvement.
4dcb882 to
0b1b4e4
Compare
|
/gemini review |
There was a problem hiding this 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 deposit polling mechanism to be triggered by new block arrivals instead of a time-based ticker, which is a good efficiency improvement. My review focuses on potential resource leaks related to context cancellation and improving error handling in the new polling logic. I've identified a couple of places where context.CancelFunc is not called correctly, which could lead to leaks, and I've also suggested a way to make the new error handling more robust and its API less misleading.
0b1b4e4 to
a0a8bcc
Compare
|
/gemini review |
There was a problem hiding this 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 deposit polling mechanism, moving from a time-based ticker to an event-driven approach that triggers on new block arrivals. This is a significant improvement as it reduces wasteful polling. The implementation correctly uses contexts with timeouts for the polling operations. My review has identified a minor grammatical issue in a code comment, for which I've provided a suggestion to improve clarity.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🎉
3c031ff to
8fc87a2
Compare
|
/gemini review |
There was a problem hiding this 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 good improvement, replacing wasteful ticker-based polling for new deposits with a more efficient approach of polling upon the arrival of new blocks. The implementation correctly removes the old polling logic and integrates deposit reconciliation into the block processing flow. I have one suggestion to improve the responsiveness of new deposit discovery by reordering operations within the block handler.
8fc87a2 to
b36f165
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
THANK YOU!
In this commit we remove the ticker-based polling
of new deposits as this is wasteful, and we replace
it by polling on the arrival of new blocks.