-
Notifications
You must be signed in to change notification settings - Fork 222
chore(rpc): Fetch only block number for TransactionByBlockIDAndIndex #3296
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
chore(rpc): Fetch only block number for TransactionByBlockIDAndIndex #3296
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.
Pull request overview
This PR optimizes the TransactionByBlockIDAndIndex method by fetching only the block number instead of the full block header. It introduces a new BlockNumberByHash method in the blockchain reader interface to support this optimization. However, the implementation has critical bugs that break existing functionality for latest and l1Accepted block ID types.
- Adds
BlockNumberByHashmethod to blockchain reader interface for efficient block number lookup - Refactors
TransactionByBlockIDAndIndexto avoid fetching full headers for hash-based lookups - Introduces bugs for
latestandl1Acceptedblock ID types
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| rpc/v9/transaction.go | Refactors TransactionByBlockIDAndIndex to use block number directly instead of fetching full header, but incorrectly returns ErrBlockNotFound for latest and l1Accepted block types |
| blockchain/blockchain.go | Adds BlockNumberByHash interface method and implementation to retrieve block number from hash without fetching full header |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3296 +/- ##
==========================================
- Coverage 76.20% 76.19% -0.01%
==========================================
Files 350 350
Lines 33177 33232 +55
==========================================
+ Hits 25281 25320 +39
- Misses 6088 6105 +17
+ Partials 1808 1807 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
008aa87 to
7c449a5
Compare
Co-authored-by: Dat Duong <DuongDat.Informatics@rocketmail.com> Signed-off-by: Yaroslav Kukharuk <i.kukharuk@gmail.com>
7c449a5 to
85c4b99
Compare
…only-block-number
…only-block-number
fixes #3257