-
Notifications
You must be signed in to change notification settings - Fork 238
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
Problem: performance is not optimal when blocklist is empty #1658
Conversation
WalkthroughThe pull request introduces several updates across different components of the project. Key changes include bug fixes for validator benchmarks, node shutdown signals, state overwrites in debug trace APIs, and benchmark transaction conflicts. Improvements allow for parallel test transaction generation, enhanced load generation with error retries, and optimizations for empty block-lists. The Changes
Possibly related PRs
Suggested reviewers
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 using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Signed-off-by: yihuang <[email protected]>
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.
👍🏻
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1658 +/- ##
===========================================
+ Coverage 16.64% 34.91% +18.27%
===========================================
Files 72 123 +51
Lines 6212 11811 +5599
===========================================
+ Hits 1034 4124 +3090
- Misses 5055 7273 +2218
- Partials 123 414 +291
|
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: 1
🧹 Outside diff range and nitpick comments (2)
app/proposal.go (1)
127-130
: Consider comprehensive testing strategy for fast paths.The fast path optimizations in both
ValidateTransaction
andProcessProposalHandler
are well-designed and will improve performance when the blocklist is empty. However, these critical paths need comprehensive testing to ensure reliability.Consider adding the following test scenarios:
- Empty blocklist behavior
- Transition from non-empty to empty blocklist
- Performance benchmarks comparing with/without optimization
Would you like me to help create a test suite covering these scenarios?
Also applies to: 155-158
🧰 Tools
🪛 GitHub Check: codecov/patch
[warning] 127-130: app/proposal.go#L127-L130
Added lines #L127 - L130 were not covered by testsCHANGELOG.md (1)
19-19
: Consider making the changelog entry more descriptive.The current entry could be more descriptive about the specific optimization being made. Based on the PR objectives and AI summary, consider expanding it to better reflect that this optimizes transaction validation and proposal processing when the blocklist is empty.
-* [#1658](https://github.com/crypto-org-chain/cronos/pull/1658) Optimize when block-list is empty. +* [#1658](https://github.com/crypto-org-chain/cronos/pull/1658) Optimize transaction validation and proposal processing when block-list is empty.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (2)
- CHANGELOG.md (1 hunks)
- app/proposal.go (2 hunks)
🧰 Additional context used
🪛 GitHub Check: codecov/patch
app/proposal.go
[warning] 127-130: app/proposal.go#L127-L130
Added lines #L127 - L130 were not covered by tests
[warning] 155-158: app/proposal.go#L155-L158
Added lines #L155 - L158 were not covered by tests
🔇 Additional comments (1)
app/proposal.go (1)
127-130
: LGTM! Fast path optimization looks good.The early return when blocklist is empty is a good optimization that avoids unnecessary signature verification and address checks.
Let's verify the test coverage:
#!/bin/bash # Search for tests covering the ValidateTransaction method rg -A 5 "func.*Test.*ValidateTransaction"Consider adding a comment explaining the performance benefit:
+ // Fast path: when blocklist is empty, all transactions are valid + // This avoids expensive signature verification and address checks if len(h.blocklist) == 0 { return nil }🧰 Tools
🪛 GitHub Check: codecov/patch
[warning] 127-130: app/proposal.go#L127-L130
Added lines #L127 - L130 were not covered by tests
8a698f4
👮🏻👮🏻👮🏻 !!!! REFERENCE THE PROBLEM YOUR ARE SOLVING IN THE PR TITLE AND DESCRIBE YOUR SOLUTION HERE !!!! DO NOT FORGET !!!! 👮🏻👮🏻👮🏻
PR Checklist:
make
)make test
)go fmt
)golangci-lint run
)go list -json -m all | nancy sleuth
)Thank you for your code, it's appreciated! :)
Summary by CodeRabbit
New Features
Bug Fixes
Documentation
CHANGELOG.md
to reflect changes, improvements, and the release date of October 14, 2024.