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
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
ce487ee
Initial commit of adding kad-dht/discovery
Eric-Warehime Aug 22, 2023
eac5f77
Add licenses
Eric-Warehime Aug 23, 2023
1f91286
Fix circular import in tests
Eric-Warehime Aug 23, 2023
eacd32b
Update bootstrap
Eric-Warehime Aug 28, 2023
b879a9d
partition test
Eric-Warehime Aug 28, 2023
26376d1
Add capabilities advertisement
Eric-Warehime Aug 28, 2023
998ad9e
Run initial advertisement immediately
Eric-Warehime Aug 28, 2023
4cb649c
Integrate capabilities retrieval
Eric-Warehime Aug 28, 2023
fb0b53d
Fix lint
Eric-Warehime Aug 28, 2023
dd79fb4
Refactor catchpoint storing capability
Eric-Warehime Aug 30, 2023
0f75566
Remove circular import
Eric-Warehime Aug 31, 2023
d8dfb52
Add test
Eric-Warehime Aug 31, 2023
0780dd5
Merge remote-tracking branch 'upstream/master' into introduce-dht
Eric-Warehime Aug 31, 2023
4071d55
Make tidy
Eric-Warehime Aug 31, 2023
a440359
Make generate
Eric-Warehime Aug 31, 2023
b0ac19b
Merge remote-tracking branch 'upstream/master' into introduce-dht
Eric-Warehime Aug 31, 2023
0e67a0b
p2p: peerstore backed phonebook (#5710)
shiqizng Aug 31, 2023
55f6430
docker: fix typo in README.md (#5707)
eltociear Aug 31, 2023
ade30a8
scripts(configure_dev): conditional tap homebrew (#5573)
emg110 Aug 31, 2023
3c77a7f
p2p: Return non-loopback multiaddr from Address() if available (#5716)
iansuvak Sep 1, 2023
b212f94
Feature: Disable EnableBlockServiceFallbackToArchiver by default. (#5…
gmalouf Sep 1, 2023
ba92ba3
merklearray: simplify single-leaf proofs (#5703)
zeldovich Sep 1, 2023
caf472a
p2p: Make p2p listen address configurable via config.NetAddress (#5721)
iansuvak Sep 1, 2023
4780a87
chore: fix misspelled filename (#5717)
bbroder-algo Sep 1, 2023
c4dfc1b
goal: Add export and import options for genesis files during network …
algochoi Sep 1, 2023
02b99bb
Simulate: Return application initial states accessed during simulatio…
ahangsu Sep 1, 2023
91c5b1c
Convert to addressTTL
Eric-Warehime Sep 1, 2023
c1bc2b6
Refactor catchpoint tracking logic into config
Eric-Warehime Sep 1, 2023
3e26bab
Add TracksCatchpoints
Eric-Warehime Sep 1, 2023
9bccbf2
Add partitiontest
Eric-Warehime Sep 5, 2023
0c6fd25
Add force catchpoint tracking comment to localTemplate
Eric-Warehime Sep 5, 2023
031f10f
Rename default values CatchpointTracking
Eric-Warehime Sep 5, 2023
9bc7474
Merge branch 'refactor-catchpoint-storing-config' into introduce-dht
Eric-Warehime Sep 5, 2023
3ddf71a
Fix listenAddr refactoring
Eric-Warehime Sep 5, 2023
11d0e67
Don't close ledger in node.Stop
Eric-Warehime Sep 5, 2023
eba2f75
Remove unused test
Eric-Warehime Sep 5, 2023
e5a8aec
Add tests, filter out self in capability peers
Eric-Warehime Sep 5, 2023
89ef9ab
Move forceCatchpointFileGenerationTrackingMode to internal logic
Eric-Warehime Sep 5, 2023
fa24be2
Merge branch 'refactor-catchpoint-storing-config' into introduce-dht
Eric-Warehime Sep 5, 2023
9481a1f
Add invalid addr dht bootstrap test
Eric-Warehime Sep 5, 2023
ee634b4
Avoid name conflict
Eric-Warehime Sep 5, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,10 @@ const MaxGenesisIDLen = 128
// MaxEvalDeltaTotalLogSize is the maximum size of the sum of all log sizes in a single eval delta.
const MaxEvalDeltaTotalLogSize = 1024

// ForceCatchpointFileGenerationTrackingMode defines the CatchpointTracking mode that would be used to
// force a node to generate catchpoint files.
const ForceCatchpointFileGenerationTrackingMode = 99
Eric-Warehime marked this conversation as resolved.
Show resolved Hide resolved

// LoadConfigFromDisk returns a Local config structure based on merging the defaults
// with settings loaded from the config file from the custom dir. If the custom file
// cannot be loaded, the default config is returned (with the error from loading the
Expand Down
33 changes: 33 additions & 0 deletions config/localTemplate.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"strings"
"time"

"github.com/algorand/go-algorand/logging"
"github.com/algorand/go-algorand/protocol"
"github.com/algorand/go-algorand/util/codecs"
)
Expand Down Expand Up @@ -535,6 +536,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

}

// DNSBootstrapArray returns an array of one or more DNS Bootstrap identifiers
Expand Down Expand Up @@ -672,3 +676,32 @@ func (cfg *Local) AdjustConnectionLimits(requiredFDs, maxFDs uint64) bool {

return true
}

// StoresCatchpoints returns true if the node is configured to store catchpoints
func (cfg *Local) StoresCatchpoints() bool {
switch cfg.CatchpointTracking {
case -1:
// No catchpoints.
default:
// Give a warning, then fall through to case 0.
logging.Base().Warnf("the CatchpointTracking field in the config.json file contains an invalid value (%d). The default value of 0 would be used instead.", cfg.CatchpointTracking)
fallthrough
case 0:
if cfg.Archival && (cfg.CatchpointInterval > 0) {
return true
}
case 1:
if cfg.CatchpointInterval > 0 && cfg.Archival {
return true
}
case 2:
if cfg.CatchpointInterval > 0 {
return true
}
Eric-Warehime marked this conversation as resolved.
Show resolved Hide resolved
case ForceCatchpointFileGenerationTrackingMode:
if cfg.CatchpointInterval > 0 {
return true
}
Eric-Warehime marked this conversation as resolved.
Show resolved Hide resolved
}
return false
}
1 change: 1 addition & 0 deletions config/local_defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ var defaultLocal = Local{
EnableBlockService: false,
EnableBlockServiceFallbackToArchiver: true,
EnableCatchupFromArchiveServers: false,
EnableDHTProviders: false,
EnableDeveloperAPI: false,
EnableExperimentalAPI: false,
EnableFollowMode: false,
Expand Down
70 changes: 66 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,12 @@ require (
github.com/google/go-cmp v0.5.9
github.com/google/go-querystring v1.0.0
github.com/gorilla/mux v1.8.0
github.com/ipfs/go-log v1.0.5
github.com/jmoiron/sqlx v1.2.0
github.com/karalabe/usb v0.0.2
github.com/labstack/echo/v4 v4.9.1
github.com/libp2p/go-libp2p v0.29.1
github.com/libp2p/go-libp2p-kad-dht v0.24.3
github.com/mattn/go-sqlite3 v1.14.16
github.com/miekg/dns v1.1.55
github.com/multiformats/go-multiaddr v0.10.1
Expand All @@ -48,39 +50,79 @@ require (

require (
github.com/apapsch/go-jsonmerge/v2 v2.0.0 // indirect
github.com/benbjohnson/clock v1.3.5 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/cockroachdb/errors v1.8.1 // indirect
github.com/cockroachdb/logtags v0.0.0-20190617123548-eb05cc24525f // indirect
github.com/cockroachdb/redact v1.0.8 // indirect
github.com/cockroachdb/sentry-go v0.6.1-cockroachdb.2 // indirect
github.com/cockroachdb/tokenbucket v0.0.0-20230613231145-182959a1fad6 // indirect
github.com/containerd/cgroups v1.1.0 // indirect
github.com/coreos/go-systemd/v22 v22.5.0 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.1 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 // indirect
github.com/docker/go-units v0.5.0 // indirect
github.com/elastic/gosigar v0.14.2 // indirect
github.com/flynn/noise v1.0.0 // indirect
github.com/fortytw2/leaktest v1.3.0 // indirect
github.com/francoispqt/gojay v1.2.13 // indirect
github.com/go-logr/logr v1.2.4 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-openapi/jsonpointer v0.19.5 // indirect
github.com/go-openapi/swag v0.19.5 // indirect
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect
github.com/godbus/dbus/v5 v5.1.0 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang-jwt/jwt v3.2.2+incompatible // indirect
github.com/golang/mock v1.6.0 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/google/gopacket v1.1.19 // indirect
github.com/google/pprof v0.0.0-20230705174524-200ffdc848b8 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/gorilla/websocket v1.5.0 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/hashicorp/golang-lru v0.5.4 // indirect
github.com/hashicorp/golang-lru/v2 v2.0.2 // indirect
github.com/huin/goupnp v1.2.0 // indirect
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/invopop/yaml v0.1.0 // indirect
github.com/ipfs/boxo v0.10.0 // indirect
github.com/ipfs/go-cid v0.4.1 // indirect
github.com/ipfs/go-datastore v0.6.0 // indirect
github.com/ipfs/go-log/v2 v2.5.1 // indirect
github.com/ipld/go-ipld-prime v0.20.0 // indirect
github.com/jackpal/go-nat-pmp v1.0.2 // indirect
github.com/jbenet/go-temp-err-catcher v0.1.0 // indirect
github.com/jbenet/goprocess v0.1.4 // indirect
github.com/jmespath/go-jmespath v0.3.0 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/klauspost/compress v1.16.7 // indirect
github.com/klauspost/cpuid/v2 v2.2.5 // indirect
github.com/kr/pretty v0.2.1 // indirect
github.com/koron/go-ssdp v0.0.4 // indirect
github.com/kr/pretty v0.3.1 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/labstack/gommon v0.4.0 // indirect
github.com/libp2p/go-buffer-pool v0.1.0 // indirect
github.com/libp2p/go-cidranger v1.1.0 // indirect
github.com/libp2p/go-flow-metrics v0.1.0 // indirect
github.com/libp2p/go-libp2p-asn-util v0.3.0 // indirect
github.com/libp2p/go-libp2p-kbucket v0.6.3 // indirect
github.com/libp2p/go-libp2p-record v0.2.0 // indirect
github.com/libp2p/go-msgio v0.3.0 // indirect
github.com/libp2p/go-nat v0.2.0 // indirect
github.com/libp2p/go-netroute v0.2.1 // indirect
github.com/libp2p/go-reuseport v0.3.0 // indirect
github.com/libp2p/go-yamux/v4 v4.0.1 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/marten-seemann/tcp v0.0.0-20210406111302-dfbc87cc63fd // indirect
github.com/mattn/go-colorable v0.1.12 // indirect
github.com/mattn/go-isatty v0.0.19 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
github.com/mikioh/tcpinfo v0.0.0-20190314235526-30a79bb1804b // indirect
github.com/mikioh/tcpopt v0.0.0-20190314235656-172688c1accc // indirect
github.com/minio/sha256-simd v1.0.1 // indirect
github.com/mmcloughlin/addchain v0.4.0 // indirect
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect
Expand All @@ -93,29 +135,49 @@ require (
github.com/multiformats/go-multihash v0.2.3 // indirect
github.com/multiformats/go-multistream v0.4.1 // indirect
github.com/multiformats/go-varint v0.0.7 // indirect
github.com/onsi/ginkgo/v2 v2.11.0 // indirect
github.com/opencontainers/runtime-spec v1.0.2 // indirect
github.com/opentracing/opentracing-go v1.2.0 // indirect
github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58 // indirect
github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/polydawn/refmt v0.89.0 // indirect
github.com/prometheus/client_golang v1.14.0 // indirect
github.com/prometheus/client_model v0.4.0 // indirect
github.com/prometheus/common v0.37.0 // indirect
github.com/prometheus/procfs v0.8.0 // indirect
github.com/prometheus/common v0.42.0 // indirect
github.com/prometheus/procfs v0.9.0 // indirect
github.com/quic-go/qpack v0.4.0 // indirect
github.com/quic-go/qtls-go1-19 v0.3.3 // indirect
github.com/quic-go/qtls-go1-20 v0.2.3 // indirect
github.com/quic-go/quic-go v0.36.3 // indirect
github.com/quic-go/webtransport-go v0.5.3 // indirect
github.com/raulk/go-watchdog v1.3.0 // indirect
github.com/rogpeppe/go-internal v1.9.0 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/spaolacci/murmur3 v1.1.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/stretchr/objx v0.5.0 // indirect
github.com/valyala/bytebufferpool v1.0.0 // indirect
github.com/valyala/fasttemplate v1.2.1 // indirect
github.com/whyrusleeping/go-keyspace v0.0.0-20160322163242-5b898ac5add1 // indirect
go.opencensus.io v0.24.0 // indirect
go.opentelemetry.io/otel v1.16.0 // indirect
go.opentelemetry.io/otel/metric v1.16.0 // indirect
go.opentelemetry.io/otel/trace v1.16.0 // indirect
go.uber.org/atomic v1.11.0 // indirect
go.uber.org/dig v1.17.0 // indirect
go.uber.org/fx v1.20.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.24.0 // indirect
golang.org/x/mod v0.12.0 // indirect
golang.org/x/net v0.12.0 // indirect
golang.org/x/sync v0.3.0 // indirect
golang.org/x/term v0.10.0 // indirect
golang.org/x/time v0.0.0-20201208040808-7e3f01d25324 // indirect
golang.org/x/tools v0.11.0 // indirect
gonum.org/v1/gonum v0.13.0 // indirect
google.golang.org/protobuf v1.30.0 // indirect
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
lukechampine.com/blake3 v1.2.1 // indirect
Expand Down
Loading