mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-10 13:58:09 -05:00
Disable libp2p TLS security protocols for now (#2622)
* Disable security protocols for now * Enabling security for test only. See https://github.com/libp2p/go-libp2p-swarm/issues/124 * Fix spacing
This commit is contained in:
@@ -9,6 +9,12 @@ import (
|
||||
"github.com/prysmaticlabs/prysm/shared/iputils"
|
||||
)
|
||||
|
||||
// Using package global for test. Swarm testing does not allow testing with
|
||||
// NoSecurity option enabled. If this is resolved upstream, we can set up swarm
|
||||
// with security disabled in the pubsub tests and remove this package global.
|
||||
// https://github.com/libp2p/go-libp2p-swarm/issues/124
|
||||
var disableSecurity = true
|
||||
|
||||
// buildOptions for the libp2p host.
|
||||
// TODO(287): Expand on these options and provide the option configuration via flags.
|
||||
// Currently, this is a random port and a (seemingly) consistent private key
|
||||
@@ -24,9 +30,15 @@ func buildOptions(port, maxPeers int) []libp2p.Option {
|
||||
log.Errorf("Failed to p2p listen: %v", err)
|
||||
}
|
||||
|
||||
return []libp2p.Option{
|
||||
opts := []libp2p.Option{
|
||||
libp2p.ListenAddrs(listen),
|
||||
libp2p.EnableRelay(), // Allows dialing to peers via relay.
|
||||
optionConnectionManager(maxPeers),
|
||||
}
|
||||
|
||||
if disableSecurity {
|
||||
opts = append(opts, libp2p.NoSecurity)
|
||||
}
|
||||
|
||||
return opts
|
||||
}
|
||||
|
||||
@@ -37,6 +37,10 @@ const testTopic = "test_topic"
|
||||
|
||||
func init() {
|
||||
logrus.SetLevel(logrus.DebugLevel)
|
||||
|
||||
// Security required for swarm testing.
|
||||
// https://github.com/libp2p/go-libp2p-swarm/issues/124
|
||||
disableSecurity = false
|
||||
}
|
||||
|
||||
func TestNewServer_InvalidMultiaddress(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user