-
Notifications
You must be signed in to change notification settings - Fork 204
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
Requester and resolver light client #6413
Conversation
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 |
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.
identifierReceipt := factory.ReceiptTopic | |
identifierReceipt := factory.ReceiptTopic + srcf.shardCoordinator.CommunicationIdentifier(selfShardID) |
in order to make it intra shard
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
dataRetriever/factory/resolverscontainer/baseResolversContainerFactory.go
Outdated
Show resolved
Hide resolved
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) |
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 more ore less duplicated with requestByHashes
method.. why not simply reduce it to one line call:
rrh.requestByHashes(rrh.shardID, receiptsHashes, factory.ReceiptTopic, uniqueReceiptSuffix)
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.
refactored
ArgBaseRequester | ||
} | ||
|
||
type receiptRequester struct { |
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.
missing unittests
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
|
||
var errFetch error | ||
errorsFound := 0 | ||
mbsBuffSlice := make([][]byte, 0, len(hashes)) |
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.
mbsBuffSlice := make([][]byte, 0, len(hashes)) | |
rcpBuffSlice := make([][]byte, 0, len(hashes)) |
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
|
||
continue | ||
} | ||
mbsBuffSlice = append(mbsBuffSlice, mb) |
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.
mbsBuffSlice = append(mbsBuffSlice, mb) | |
rcpBuffSlice = append(rcpBuffSlice, mb) |
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
mbsBuffSlice = append(mbsBuffSlice, mb) | ||
} | ||
|
||
buffsToSend, errPack := rcRes.dataPacker.PackDataInChunks(mbsBuffSlice, maxBuffToSendBulkMiniblocks) |
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.
buffsToSend, errPack := rcRes.dataPacker.PackDataInChunks(mbsBuffSlice, maxBuffToSendBulkMiniblocks) | |
buffsToSend, errPack := rcRes.dataPacker.PackDataInChunks(rcpBuffSlice, maxBuffToSendBulkMiniblocks) |
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.
perhaps add a new const instead of maxBuffToSendBulkMiniblocks, specific to receipt?
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
} | ||
|
||
if errFetch != nil { | ||
errFetch = fmt.Errorf("resolveMbRequestByHashArray last error %w from %d encountered errors", errFetch, errorsFound) |
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.
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) |
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
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:
feat
branch created?feat
branch merging, do all satellite projects have a proper tag insidego.mod
?