Skip to content

provider: network operations #1115

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

Open
wants to merge 2 commits into
base: provider-queues
Choose a base branch
from

Conversation

guillaumemichel
Copy link
Contributor

Part of #1095

Depends on #1114


Network operations performed by the provider.

@guillaumemichel guillaumemichel requested a review from a team as a code owner July 24, 2025 10:10
Copy link
Contributor

@gammazero gammazero left a comment

Choose a reason for hiding this comment

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

Please simplify code by using package github.com/ipfs/go-test/random
After that, ok to merge

Comment on lines +36 to +42
func genRandPeerID(t *testing.T) peer.ID {
_, pub, err := crypto.GenerateKeyPair(crypto.Ed25519, -1)
require.NoError(t, err)
pid, err := peer.IDFromPublicKey(pub)
require.NoError(t, err)
return pid
}
Copy link
Contributor

Choose a reason for hiding this comment

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

This can be replaced by random.Peers

Comment on lines +109 to +114
peers := make([]peer.ID, nPeers)
peersTrie := trie.New[bit256.Key, peer.ID]()
for i := range peers {
peers[i] = genRandPeerID(t)
peersTrie.Add(keyspace.PeerIDToBit256(peers[i]), peers[i])
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
peers := make([]peer.ID, nPeers)
peersTrie := trie.New[bit256.Key, peer.ID]()
for i := range peers {
peers[i] = genRandPeerID(t)
peersTrie.Add(keyspace.PeerIDToBit256(peers[i]), peers[i])
}
peers := random.Peers(nPeers)
peersTrie := trie.New[bit256.Key, peer.ID]()
for _, peer := range peers {
peersTrie.Add(keyspace.PeerIDToBit256(peer), peer)
}

type SweepingProvider struct {
// TODO: implement me
// TODO: complete me
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe comment out the unused members so that linter does not complain.

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.

2 participants