Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
93c5a4d to
203ce70
Compare
added 13 commits
April 24, 2025 17:35
holgerd77
reviewed
May 8, 2025
holgerd77
left a comment
Member
There was a problem hiding this comment.
Really nice rework and optimization, another LGTM! 🙂👍
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TxIndex
TxIndexclassTxIndexlogic from ReceiptsManagereth_getTransactionByHashby removing unnecessary receipt lookupdebug_getRawTransactionby removing unnecessary receipt lookupminer.spec.tstesttxIndex.spec.tstesttxIndexinitialization inVMExecutionTxIndexrefers to a database mapping of a transactionhashto itsblockhashandposition(index) within the block transactions array.This allows lookup of transaction data by hash without directly storing each transaction by hash in the DB.
e.g.:
The current setup only included a
TxIndexas part ofReceiptsManager, which only exists if--saveReceiptsis set to true. While it is the case that some methods inReceiptsManagerrequire aTxIndex, the inverse is not true. A user may want to keep aTxIndexwithout needing to save receipts.This PR extracts all of the indexing logic out of
ReceiptsManagerand moves it to a new class calledTxIndex.TxIndexcan exist independently ofReceiptsManageras a separate attribute ofVMExecution.TxIndexwill initialize as long asthis.MetaDBexists, and will still be restricted by--txLookupLimit.The method
receiptsManager.getReceiptByTxHashhas been changed togetReceiptsByTxHashIndex. This method is only called by RPCgetTransactionmethods, which now separately callTxIndex.getIndex.eth_getTransactionByHashanddebug_getRawTransactionDecoupling receipts and txIndex allowed for optimizing
eth_getTransactionByHashanddebug_getRawTransaction. These methods had involved an extra DB lookup for the block receipts, which was never used and not part of looking up the transaction.Test fix:
The only test for
saveReceiptsexisted inminer.spec.ts, and was producing false positives.The test was calling
receiptsManager.getReceiptsusing transaction hashes instead of block hashes. Even though this should have failed, thegetReceiptsmethod returns an empty array when fails, which allowed the test'sassert.isDefinedto pass, even though the expected result was not retrieved.This test was fixed, and updated to also test the transaction indexing.