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

Fetch data columns from multiple peers instead of just supernodes #14977

Open
wants to merge 27 commits into
base: peerDAS
Choose a base branch
from

Conversation

niran
Copy link

@niran niran commented Feb 21, 2025

What type of PR is this?

Feature

What does this PR do? Why is it needed?

The initial implementation of data column sampling required all columns to be retrieved from the same peer (typically a supernode). This PR extracts the peer selection logic from the initial sync's block fetcher to be used when pending blocks are received as well. Requests for subsets of data columns are sent to each selected peer.

Which issues(s) does this PR fix?

Implements a portion of #14129

Other notes for review

Acknowledgements

@niran niran requested a review from a team as a code owner February 21, 2025 23:25
@niran niran requested review from terencechain, rkapka and dB2510 and removed request for a team February 21, 2025 23:25
@CLAassistant
Copy link

CLAassistant commented Feb 21, 2025

CLA assistant check
All committers have signed the CLA.

Copy link
Contributor

@nalepae nalepae left a comment

Choose a reason for hiding this comment

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

I think we can remove all instances of AdmissibleCustodySamplingPeers.

@niran niran changed the title WIP: Fetch data columns from multiple peers instead of just supernodes Fetch data columns from multiple peers instead of just supernodes Feb 28, 2025
@nalepae nalepae added the peerDAS label Mar 4, 2025

for len(peers) > len(badPeers) && len(remainingColumns) > 0 {
// Filter out bad peers from the admissible peers
filteredDataColumnsByAdmissiblePeer := make(map[peer.ID]map[uint64]bool)
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of having dataColumnsByAdmissiblePeer, badPeers and filteredDataColumnsByAdmissiblePeer, what about having only dataColumnsByAdmissiblePeer and goodPeers?
At the end of the loop, we remove a peer from the goodPeers list if some columns from the peer are missing. It then avoid this:

		for p, cols := range dataColumnsByAdmissiblePeer {
			if !badPeers[p] {
				filteredDataColumnsByAdmissiblePeer[p] = cols
			}
		}

}

if len(remainingColumns) == 0 {
break
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of breaking here (which is the happy path), I think it's better to put all the code after

// Validate the received sidecars

So, exiting the for loop is the unhappy path, and does not need to test any more

if len(remainingColumns) > 0

Copy link
Author

Choose a reason for hiding this comment

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

That check was leftover from a previous iteration and isn't needed at all anymore. But I don't understand what you were suggesting about moving code around. I just removed it for now but let me know if there was something else you were looking for!

// RequestDataColumnSidecars sends a data column sidecars by root request to one
// or more peers that can provide the needed data columns.
func RequestDataColumnSidecars(
ctx context.Context,
Copy link
Contributor

Choose a reason for hiding this comment

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

This function is not tested at all.
I agree it's the kind of function hard to test.
You can look at the test that have been done for data columns by range to see how to create fake peers etc...

Copy link
Author

Choose a reason for hiding this comment

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

Yep, started working on this already based on the blocks fetcher tests. Will be done today!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants