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

p2p: Capabilities Advertisement for Archival/Catchpoints #5702

Merged
merged 41 commits into from
Nov 2, 2023

Conversation

Eric-Warehime
Copy link
Contributor

Summary

PR is currently WIP. There are a few bits which are still being implemented.

This adds libp2p-kad-dht to go-algorand. In this PR it is wrapped in a cache and has some backoff logic included.

At a high level it is using the Content Provider interfaces in the DHT spec in a basic way. It sets up common namespaces for 2 basic capabilities (archival and catchpoints), and advertises those capabilities to bootstrap peers on node startup.

Next Steps (Not in this PR)

  • Integrate the peer store and provider stores with the catchup and fast catchup services in order to use them as the source of peer info (with SRV entries as a fallback).

  • In order for non-relay nodes to be able to use the DHT for capabilities advertisement, we'll need the relays to enable it--since the relays in the SRV list will be used as initial peers.

Test Plan

More testing to be added as the PR progresses. I'll update here.

@codecov
Copy link

codecov bot commented Aug 23, 2023

Codecov Report

Merging #5702 (ee634b4) into master (02b99bb) will increase coverage by 0.08%.
Report is 77 commits behind head on master.
The diff coverage is 72.84%.

@@            Coverage Diff             @@
##           master    #5702      +/-   ##
==========================================
+ Coverage   55.54%   55.62%   +0.08%     
==========================================
  Files         476      478       +2     
  Lines       66853    66980     +127     
==========================================
+ Hits        37131    37256     +125     
+ Misses      27193    27184       -9     
- Partials     2529     2540      +11     
Files Coverage Δ
config/config.go 50.60% <ø> (ø)
ledger/acctupdates.go 70.80% <ø> (+0.11%) ⬆️
network/p2p/dht/dht.go 100.00% <100.00%> (ø)
config/localTemplate.go 72.02% <94.73%> (+2.89%) ⬆️
network/p2p/p2p.go 32.91% <50.00%> (+19.92%) ⬆️
ledger/catchpointtracker.go 60.73% <42.85%> (-0.11%) ⬇️
network/p2p/capabilities.go 75.71% <75.71%> (ø)
node/node.go 22.08% <0.00%> (-0.52%) ⬇️

... and 12 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@Eric-Warehime
Copy link
Contributor Author

Still need to add testing, merge from master, add some docs, etc. But feel free to give early feedback at this point if anyone has some.

@Eric-Warehime Eric-Warehime requested review from a team, winder, tzaffi, shiqizng, algochoi, cce and iansuvak and removed request for a team August 29, 2023 00:03
ledger/catchpointtracker.go Show resolved Hide resolved
config/localTemplate.go Outdated Show resolved Hide resolved
config/localTemplate.go Show resolved Hide resolved
network/p2p/capabilities.go Outdated Show resolved Hide resolved
config/config.go Outdated Show resolved Hide resolved
ledger/catchpointtracker.go Outdated Show resolved Hide resolved
@@ -581,6 +581,9 @@ type Local struct {

// DisableAPIAuth turns off authentication for public (non-admin) API endpoints.
DisableAPIAuth bool `version[30]:"false"`

// EnableDHT will turn on the hash table for use with capabilities advertisement
EnableDHTProviders bool `version[30]:"false"`
Copy link
Contributor

Choose a reason for hiding this comment

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

v31

@@ -41,6 +41,7 @@
"EnableBlockService": false,
"EnableBlockServiceFallbackToArchiver": true,
"EnableCatchupFromArchiveServers": false,
"EnableDHTProviders": false,
Copy link
Contributor

Choose a reason for hiding this comment

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

v30 should not be modified

node/node.go Outdated Show resolved Hide resolved
@@ -152,6 +156,8 @@ type AlgorandFullNode struct {
tracer messagetracer.MessageTracer

stateProofWorker *stateproof.Worker

capabilitiesDiscovery *p2p.CapabilitiesDiscovery
Copy link
Contributor

Choose a reason for hiding this comment

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

is it possible to have node free of p2p dependency/implementation detail?

iansuvak and others added 6 commits September 1, 2023 13:40
…creation (algorand#5672)

goal network pregen [-p] [-t]: Generates genesis.json, root and part keys based on the template file [-t].
[-p] (pregendir) is where the genesis files are saved (since this is an inherited required flag),
and it must be empty or command will error.

goal network create [-r] [-t] [-p]: Imports files from pregendir to networkDir.
Importing keys was already possible, but this explicitly copies over the keys from another directory,
because network directories are wiped if there is an error during creation.
@Eric-Warehime Eric-Warehime self-assigned this Sep 5, 2023
@cce cce reopened this Nov 2, 2023
@cce cce changed the base branch from master to feature/p2p November 2, 2023 19:25
@cce cce marked this pull request as ready for review November 2, 2023 19:25
@cce cce merged commit 175a7e1 into algorand:feature/p2p Nov 2, 2023
10 checks passed
@algorandskiy algorandskiy added the p2p Work related to the p2p project label Jan 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement p2p Work related to the p2p project
Projects
None yet
Development

Successfully merging this pull request may close these issues.

p2p: DHT Capabilities Advertisements