Requester and resolver light client#6413
Merged
miiu96 merged 10 commits intofeat/light-clientfrom Sep 11, 2024
Merged
Conversation
sstanculeanu
reviewed
Sep 2, 2024
dataRetriever/factory/requestersContainer/metaRequestersContainerFactory.go
Outdated
Show resolved
Hide resolved
| func (srcf *shardRequestersContainerFactory) generateReceiptRequesters() error { | ||
| // only one receipts topic | ||
| selfShardID := srcf.shardCoordinator.SelfId() | ||
| identifierReceipt := factory.ReceiptTopic |
Collaborator
There was a problem hiding this comment.
Suggested change
| identifierReceipt := factory.ReceiptTopic | |
| identifierReceipt := factory.ReceiptTopic + srcf.shardCoordinator.CommunicationIdentifier(selfShardID) |
in order to make it intra shard
dataRetriever/factory/resolverscontainer/baseResolversContainerFactory.go
Outdated
Show resolved
Hide resolved
Comment on lines
+121
to
+156
| unrequestedHashes := rrh.getUnrequestedHashes(receiptsHashes, uniqueReceiptSuffix) | ||
| if len(unrequestedHashes) == 0 { | ||
| return | ||
| } | ||
|
|
||
| log.Debug("requesting receipts from network", | ||
| "topic", factory.ReceiptTopic, | ||
| "num receipts", len(unrequestedHashes), | ||
| ) | ||
|
|
||
| requester, err := rrh.requestersFinder.IntraShardRequester(factory.ReceiptTopic) | ||
| if err != nil { | ||
| log.Error("requestByHashes.CrossShardRequester", | ||
| "error", err.Error(), | ||
| "topic", factory.ReceiptTopic, | ||
| ) | ||
| return | ||
| } | ||
|
|
||
| receiptRequester, ok := requester.(HashSliceRequester) | ||
| if !ok { | ||
| log.Warn("wrong assertion type when creating receipts requester") | ||
| return | ||
| } | ||
|
|
||
| for _, txHash := range receiptsHashes { | ||
| log.Trace("requestByHashes", "hash", txHash, "topic", factory.ReceiptTopic, | ||
| "num txs", len(unrequestedHashes), | ||
| "stack", string(debug.Stack())) | ||
| } | ||
|
|
||
| rrh.whiteList.Add(unrequestedHashes) | ||
|
|
||
| go rrh.requestHashesWithDataSplit(unrequestedHashes, receiptRequester) | ||
|
|
||
| rrh.addRequestedItems(unrequestedHashes, uniqueReceiptSuffix) |
Collaborator
There was a problem hiding this comment.
this is more ore less duplicated with requestByHashes method.. why not simply reduce it to one line call:
rrh.requestByHashes(rrh.shardID, receiptsHashes, factory.ReceiptTopic, uniqueReceiptSuffix)| ArgBaseRequester | ||
| } | ||
|
|
||
| type receiptRequester struct { |
|
|
||
| var errFetch error | ||
| errorsFound := 0 | ||
| mbsBuffSlice := make([][]byte, 0, len(hashes)) |
Collaborator
There was a problem hiding this comment.
Suggested change
| mbsBuffSlice := make([][]byte, 0, len(hashes)) | |
| rcpBuffSlice := make([][]byte, 0, len(hashes)) |
|
|
||
| continue | ||
| } | ||
| mbsBuffSlice = append(mbsBuffSlice, mb) |
Collaborator
There was a problem hiding this comment.
Suggested change
| mbsBuffSlice = append(mbsBuffSlice, mb) | |
| rcpBuffSlice = append(rcpBuffSlice, mb) |
| mbsBuffSlice = append(mbsBuffSlice, mb) | ||
| } | ||
|
|
||
| buffsToSend, errPack := rcRes.dataPacker.PackDataInChunks(mbsBuffSlice, maxBuffToSendBulkMiniblocks) |
Collaborator
There was a problem hiding this comment.
Suggested change
| buffsToSend, errPack := rcRes.dataPacker.PackDataInChunks(mbsBuffSlice, maxBuffToSendBulkMiniblocks) | |
| buffsToSend, errPack := rcRes.dataPacker.PackDataInChunks(rcpBuffSlice, maxBuffToSendBulkMiniblocks) |
Collaborator
There was a problem hiding this comment.
perhaps add a new const instead of maxBuffToSendBulkMiniblocks, specific to receipt?
| } | ||
|
|
||
| if errFetch != nil { | ||
| errFetch = fmt.Errorf("resolveMbRequestByHashArray last error %w from %d encountered errors", errFetch, errorsFound) |
Collaborator
There was a problem hiding this comment.
Suggested change
| errFetch = fmt.Errorf("resolveMbRequestByHashArray last error %w from %d encountered errors", errFetch, errorsFound) | |
| errFetch = fmt.Errorf("resolveReceiptRequestByHashArray last error %w from %d encountered errors", errFetch, errorsFound) |
sstanculeanu
previously approved these changes
Sep 3, 2024
AdoAdoAdo
reviewed
Sep 11, 2024
dataRetriever/factory/requestersContainer/shardRequestersContainerFactory.go
Outdated
Show resolved
Hide resolved
dataRetriever/factory/requestersContainer/metaRequestersContainerFactory.go
Outdated
Show resolved
Hide resolved
sstanculeanu
previously approved these changes
Sep 11, 2024
sstanculeanu
approved these changes
Sep 11, 2024
AdoAdoAdo
approved these changes
Sep 11, 2024
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.
Reasoning behind the pull request
Pre-requisites
Based on the Contributing Guidelines the PR author and the reviewers must check the following requirements are met:
featbranch created?featbranch merging, do all satellite projects have a proper tag insidego.mod?