-
Notifications
You must be signed in to change notification settings - Fork 197
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
Integrate indexer to work with partial executed mini-blocks #4052
Conversation
miiu96
commented
May 3, 2022
•
edited
edited
- Updated elastic indexer in order to index correctly partial mini-blocks
- Fix the API block in order to return only executed transactions in case of partial-execution
@@ -106,13 +106,19 @@ func (bap *baseAPIBlockProcessor) prepareAPIMiniblock(miniblock *block.MiniBlock | |||
DestinationShard: miniblock.ReceiverShardID, | |||
} | |||
if withTxs { | |||
bap.getAndAttachTxsToMbByEpoch(mbHash, miniblock, epoch, miniblockAPI) | |||
firstProcessed := int32(0) |
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.
since this is correct for the intrashard miniblock, let's rename prepareAPIMiniblock to something like prepareAPIMiniblockForIntrashard and extractMbsFromBatch to something like extractIntrashardMbsFromBatch
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.
renamed
node/external/blockAPI/baseBlock.go
Outdated
|
||
func extractExecutedTxHashes(mbTxHashes [][]byte, firstProcessed, lastProcessed int32) [][]byte { | ||
executedTxHashes := make([][]byte, 0) | ||
for txIndex, txHash := range mbTxHashes { |
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.
this is a little bit of CPU processing time. A slightly optimized variant:
invalidIndexes := firstProcessed < 0 || lastProcessed >= len(mbTxHashes) || firstProcessed > lastProcessed
if invalidIndexes {
log.Warn("extractExecutedTxHashes encountered invalid indexes", "firstProcessed", firstProcessed,
"lastProcessed", lastProcessed, "len(mbTxHashes)", len(mbTxHashes))
return executedTxHashes
}
for txIndex := executedTxHashes; txIndex <= lastProcessed; txIndex++{
executedTxHashes = append(executedTxHashes, mbTxHashes[txIndex])
}
return executedTxHashes
+add edgecases tests
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.
done
go.mod
Outdated
@@ -8,7 +8,7 @@ require ( | |||
github.com/ElrondNetwork/arwen-wasm-vm/v1_4 v1.4.51 | |||
github.com/ElrondNetwork/concurrent-map v0.1.3 | |||
github.com/ElrondNetwork/covalent-indexer-go v1.0.6 | |||
github.com/ElrondNetwork/elastic-indexer-go v1.2.25 | |||
github.com/ElrondNetwork/elastic-indexer-go v1.2.29-0.20220530074622-4a44bb8e4c7b |
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.
proper release before merging?
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.
will do
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.
added proper release
node/external/blockAPI/baseBlock.go
Outdated
func extractExecutedTxHashes(mbTxHashes [][]byte, firstProcessed, lastProcessed int32) [][]byte { | ||
invalidIndexes := firstProcessed < 0 || lastProcessed >= int32(len(mbTxHashes)) || firstProcessed > lastProcessed | ||
if invalidIndexes { | ||
log.Warn("extractExecutedTxHashes encountered invalid indexes", "firstProcessed", firstProcessed, |
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.
optional: indices instead of indexes
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.
done.
res = extractExecutedTxHashes(array, 0, int32(len(array))+1) | ||
require.Equal(t, res, array) | ||
|
||
res = extractExecutedTxHashes(array, 0, int32(len(array))+1) |
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.
duplicated check: res = extractExecutedTxHashes(array, 0, int32(len(array))+1)
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.
removed
Codecov Report
@@ Coverage Diff @@
## development #4052 +/- ##
===============================================
+ Coverage 75.25% 75.83% +0.58%
===============================================
Files 614 644 +30
Lines 82115 85082 +2967
===============================================
+ Hits 61794 64523 +2729
- Misses 15643 15773 +130
- Partials 4678 4786 +108
Continue to review full report at Codecov.
|
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.
@@ Log scanner @@
integrate-indexer-partion-exec
================================================================================
- Known Warnings 22
- New Warnings 8
- Known Errors 0
- New Errors 2
- Panics 3
================================================================================