-
Notifications
You must be signed in to change notification settings - Fork 142
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
Resolve multiple BB audit issues #1478
Conversation
WalkthroughThe changes encompass various improvements in the codebase. They include adding deferred calls to stop timers for proper resource management, restructuring logic for publishing data with error handling, consolidating cleanup logic to reduce code duplication, and introducing validation checks for data integrity. These changes aim to enhance the reliability and robustness of the system. Changes
Assessment against linked issues
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.
Review Status
Actionable comments generated: 2
Configuration used: CodeRabbit UI
Files selected for processing (3)
- block/manager.go (2 hunks)
- store/store.go (1 hunks)
- types/block.go (1 hunks)
Additional comments: 3
types/block.go (1)
- 105-107: The added validation logic in
ValidateBasic
method ofCommit
struct correctly checks if the first signature is empty and returns an error if it is. This change aligns with the PR objectives to enhance signature validation.store/store.go (1)
- 80-80: The introduction of
defer bb.Discard(ctx)
before error checks is a good practice to ensure resources are cleaned up properly. This change reduces code duplication and ensures thatbb.Discard(ctx)
is always called, even if an error occurs or a return statement is reached before the end of the function.block/manager.go (1)
- 265-265: The addition of
defer timer.Stop()
in theAggregationLoop
method is a good practice to prevent potential resource leaks by ensuring that the timer is stopped when the function exits, regardless of the exit path.
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #1478 +/- ##
==========================================
+ Coverage 50.87% 51.09% +0.22%
==========================================
Files 52 52
Lines 6717 6717
==========================================
+ Hits 3417 3432 +15
+ Misses 2951 2939 -12
+ Partials 349 346 -3 ☔ View full report in Codecov by Sentry. |
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.
Review Status
Actionable comments generated: 0
Configuration used: CodeRabbit UI
Files selected for processing (1)
- block/manager.go (5 hunks)
Files skipped from review as they are similar to previous changes (1)
- block/manager.go
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! 👍
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.
ProxyUtAck
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.
Can we discuss the select statement changes offline?
Those are reverting back to conditions that previously caused test failures.
Let's make sure we aren't re-introducing those or if the other updates, like the shutdown coordination, has resolved the underlying issue.
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.
Review Status
Actionable comments generated: 0
Configuration used: CodeRabbit UI
Files selected for processing (1)
- block/manager.go (4 hunks)
Files skipped from review as they are similar to previous changes (1)
- block/manager.go
94d79ba
to
06a4204
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.
Review Status
Actionable comments generated: 0
Configuration used: CodeRabbit UI
Files selected for processing (5)
- block/manager.go (4 hunks)
- store/store.go (1 hunks)
- types/block.go (1 hunks)
- types/signed_header.go (1 hunks)
- types/signed_header_test.go (1 hunks)
Files skipped from review as they are similar to previous changes (3)
- block/manager.go
- store/store.go
- types/block.go
Additional comments: 4
types/signed_header.go (2)
- 101-105: Added new error variables
ErrNoSignatures
andErrSignatureEmpty
to handle cases when there are no signatures or the signature is empty. This is a good practice for explicit error handling and improves the clarity of error conditions.- 100-105: The new error variables
ErrNoSignatures
andErrSignatureEmpty
should be used in theValidateBasic
method to handle the respective error conditions. Ensure that the logic inValidateBasic
is updated to return these errors when appropriate.types/signed_header_test.go (2)
- 238-259: New test cases have been added to validate the absence of signatures and empty signature values. This is a good practice to ensure that the new error conditions are properly tested.
- 238-259: The new test cases for
ErrNoSignatures
andErrSignatureEmpty
are correctly set up to expect these errors when the conditions are met. This ensures that the error handling is properly tested.
Overview
Resolves #1477, resolves #1475, resolves #1474
Checklist
Summary by CodeRabbit