Skip to content
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

Fixing hyperblock partial mb handling - part1 #5638

Conversation

iulianpascalau
Copy link
Contributor

Reasoning behind the pull request

  • added new components for handling miniblocks in dblookup extension sub-system

Proposed changes

Testing procedure

Pre-requisites

Based on the Contributing Guidelines the PR author and the reviewers must check the following requirements are met:

  • was the PR targeted to the correct branch?
  • if this is a larger feature that probably needs more than one PR, is there a feat branch created?
  • if this is a feat branch merging, do all satellite projects have a proper tag inside go.mod?

@iulianpascalau iulianpascalau marked this pull request as ready for review October 5, 2023 15:31
@codecov
Copy link

codecov bot commented Oct 5, 2023

Codecov Report

Attention: 23 lines in your changes are missing coverage. Please review.

Comparison is base (89c20ea) 80.16% compared to head (18b9ab8) 80.12%.
Report is 2 commits behind head on feat/dblookupext-partial-miniblocks.

❗ Current head 18b9ab8 differs from pull request most recent head 83a8bd2. Consider uploading reports for the commit 83a8bd2 to get more accurate results

Additional details and impacted files
@@                           Coverage Diff                           @@
##           feat/dblookupext-partial-miniblocks    #5638      +/-   ##
=======================================================================
- Coverage                                80.16%   80.12%   -0.04%     
=======================================================================
  Files                                      708      709       +1     
  Lines                                    93875    93982     +107     
=======================================================================
+ Hits                                     75254    75305      +51     
- Misses                                   13283    13328      +45     
- Partials                                  5338     5349      +11     
Files Coverage Δ
dblookupext/errors.go 0.00% <ø> (ø)
dblookupext/miniblocksHandler.go 78.50% <78.50%> (ø)

... and 2 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

dblookupext/miniblocksHandler.go Show resolved Hide resolved
dblookupext/miniblocksHandler.go Show resolved Hide resolved
dblookupext/miniblockMetadata.proto Show resolved Hide resolved
dblookupext/miniblockMetadata.proto Show resolved Hide resolved
dblookupext/miniblocksHandler.go Outdated Show resolved Hide resolved
Comment on lines +184 to +185
TxHashesWhenPartial: nil,
IndexOfFirstTxProcessed: 0,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-indexing (db lookup extensions) from the epoch that enabled partial miniblocks needed, though.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, to fix old, broken, miniblocks

dblookupext/miniblocksHandler_test.go Outdated Show resolved Hide resolved
dblookupext/miniblocksHandler_test.go Outdated Show resolved Hide resolved
mbHandler := createMockMiniblocksHandler()

header1 := &block.Header{
Epoch: 37,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🙈

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lucky 37 🍀

dblookupext/miniblocksHandler_test.go Outdated Show resolved Hide resolved
}

for index, mb := range blockBody.MiniBlocks {
miniblockHash, err := core.CalculateHash(mh.marshaller, mh.hasher, mb)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

L31-34 can be moved inside handleMiniblock func

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this will overcomplicate the returning errors on handleMiniblock as I want to know the miniblock hash when wrapping the error on L38

return nil
}

func (mh *miniblocksHandler) getExecutedTxHashes(miniblockHeader data.MiniBlockHeaderHandler, mb *block.MiniBlock) [][]byte {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getOrderedExecutedTxHashes ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

renamed

NumTxHashesInMiniblock: int32(len(mb.TxHashes)),
}

var txHasheshenPartial [][]byte
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

func (mh *miniblocksHandler) loadExistingMiniblocksMetadata(miniblockHash []byte, epoch uint32) (*MiniblockMetadataV2, error) {
multipleMiniblockMetadata := &MiniblockMetadataV2{}
buff, err := mh.miniblocksMetadataStorer.GetFromEpoch(miniblockHash, epoch)
if err == storage.ErrKeyNotFound {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use errors.Is

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

@iulianpascalau iulianpascalau merged commit bf8217d into feat/dblookupext-partial-miniblocks Oct 6, 2023
5 checks passed
@iulianpascalau iulianpascalau deleted the fixing-hyperblock-partial-mb-handling-part1 branch October 6, 2023 13:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants