-
Notifications
You must be signed in to change notification settings - Fork 32
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
feat(listener): listener safe, finalized, latest block numbers #2762
Conversation
Warning Rate limit exceeded@golangisfun123 has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 53 minutes and 45 seconds before requesting another review. How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. WalkthroughThe updates to the Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant ChainListener
Client->>ChainListener: NewChainListener(opts...)
ChainListener->>ChainListener: set finalityMode, blockWait
Note right of ChainListener: Initialize chainListener with options
Client->>ChainListener: Start listening for events
ChainListener->>ChainListener: doPoll method
ChainListener->>ChainListener: getBlockNumber()
Note right of ChainListener: Retrieve block number considering finalityMode and blockWait
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
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.
PR Summary
- Introduced
finalityMode
andblockWait
parameters tochainListener
- Added
getBlockNumber
method for enhanced block retrieval - Updated tests to cover new finality modes (
safe
,finalized
) - Added options for setting finality mode and block wait time
3 file(s) reviewed, no comment(s)
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.
Actionable comments posted: 0
Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Files selected for processing (3)
- ethergo/listener/listener.go (5 hunks)
- ethergo/listener/listener_test.go (3 hunks)
- ethergo/listener/options.go (2 hunks)
Additional comments not posted (7)
ethergo/listener/options.go (2)
30-42
: LGTM!The
WithFinalityMode
function is implemented correctly and handles different modes appropriately.
44-49
: LGTM!The
WithBlockWait
function is implemented correctly and sets theblockWait
field appropriately.ethergo/listener/listener_test.go (1)
Line range hint
41-118
: Well-structured test for new configurations.The adjustments in the
TestListenForEvents
function are well-implemented. It correctly tests the newWithFinalityMode
andWithBlockWait
options, ensuring different configurations lead to expected differences in behavior.ethergo/listener/listener.go (4)
52-53
: Struct modifications are appropriate and well-integrated.The addition of
finalityMode
andblockWait
fields to thechainListener
struct is well-executed. These fields are crucial for the new functionality related to block number handling.
72-73
: Proper use of functional options pattern in constructor.The changes to the
NewChainListener
function to incorporate functional options for settingfinalityMode
andblockWait
are correctly implemented and follow best practices in Go.
140-140
: Good abstraction of block number fetching.The modification in the
doPoll
method to use thegetBlockNumber
method for fetching the block number enhances modularity and maintainability.
191-204
: Correct implementation of block number fetching logic.The
getBlockNumber
method is well-implemented, correctly handling different finality modes and adjusting the block number based on theblockWait
. This method is crucial for the new functionality related to block number handling.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2762 +/- ##
===================================================
+ Coverage 25.94208% 26.20226% +0.26017%
===================================================
Files 737 737
Lines 52729 52755 +26
Branches 80 80
===================================================
+ Hits 13679 13823 +144
+ Misses 37639 37522 -117
+ Partials 1411 1410 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Deploying sanguine-fe with Cloudflare Pages
|
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.
PR Summary
(updates since last review)
- Introduced
finalityMode
andblockWait
fields inchainListener
struct - Enhanced block number fetching mechanism considering finality and block wait settings
- Improved error handling in
getBlockNumber
method for better clarity
1 file(s) reviewed, no comment(s)
Description
A clear and concise description of the features you're adding in this pull request.
Additional context
Add any other context about the problem you're solving.
Metadata
Summary by CodeRabbit
New Features
Bug Fixes