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

Enable NOISE Handshake by Default v0.11 #5272

Merged
merged 20 commits into from
Apr 2, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
28481c0
noise handshakes by default
rauljordan Apr 1, 2020
6f2cdfb
Merge branch 'v0.11' into noise-default
rauljordan Apr 1, 2020
48eb40e
fix build
rauljordan Apr 1, 2020
77ee72d
Merge refs/heads/v0.11 into noise-default
prylabs-bulldozer[bot] Apr 1, 2020
0ef235d
Merge refs/heads/v0.11 into noise-default
prylabs-bulldozer[bot] Apr 1, 2020
7e69c8d
Merge branch 'v0.11' into noise-default
rauljordan Apr 1, 2020
48e0205
Merge branch 'noise-default' of github.com:prysmaticlabs/prysm into n…
rauljordan Apr 1, 2020
603947d
Merge refs/heads/v0.11 into noise-default
prylabs-bulldozer[bot] Apr 1, 2020
f5f6137
Merge refs/heads/v0.11 into noise-default
prylabs-bulldozer[bot] Apr 1, 2020
974270e
Merge refs/heads/v0.11 into noise-default
prylabs-bulldozer[bot] Apr 1, 2020
904e96c
Merge refs/heads/v0.11 into noise-default
prylabs-bulldozer[bot] Apr 1, 2020
787058f
Merge refs/heads/v0.11 into noise-default
prylabs-bulldozer[bot] Apr 1, 2020
7b412bd
noisy noise everywhere
rauljordan Apr 1, 2020
86c28bd
deprecated noisy noise flag with more noise
rauljordan Apr 1, 2020
c220b77
add secio as fallback
nisdas Apr 1, 2020
0674d92
Merge branch 'noise-default' of https://github.com/prysmaticlabs/geth…
nisdas Apr 1, 2020
804a18f
Merge refs/heads/v0.11 into noise-default
prylabs-bulldozer[bot] Apr 2, 2020
dd94fec
Merge refs/heads/v0.11 into noise-default
prylabs-bulldozer[bot] Apr 2, 2020
0e41e24
Merge refs/heads/v0.11 into noise-default
prylabs-bulldozer[bot] Apr 2, 2020
8f38c38
Merge refs/heads/v0.11 into noise-default
prylabs-bulldozer[bot] Apr 2, 2020
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
2 changes: 1 addition & 1 deletion beacon-chain/p2p/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ go_library(
"//beacon-chain/p2p/peers:go_default_library",
"//proto/beacon/p2p/v1:go_default_library",
"//shared:go_default_library",
"//shared/featureconfig:go_default_library",
"//shared/hashutil:go_default_library",
"//shared/iputils:go_default_library",
"//shared/params:go_default_library",
Expand Down Expand Up @@ -121,6 +120,7 @@ go_test(
"@com_github_libp2p_go_libp2p_core//host:go_default_library",
"@com_github_libp2p_go_libp2p_core//network:go_default_library",
"@com_github_libp2p_go_libp2p_core//peer:go_default_library",
"@com_github_libp2p_go_libp2p_noise//:go_default_library",
"@com_github_libp2p_go_libp2p_pubsub//:go_default_library",
"@com_github_libp2p_go_libp2p_swarm//testing:go_default_library",
"@com_github_multiformats_go_multiaddr//:go_default_library",
Expand Down
8 changes: 3 additions & 5 deletions beacon-chain/p2p/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import (
ma "github.com/multiformats/go-multiaddr"
"github.com/pkg/errors"
"github.com/prysmaticlabs/prysm/beacon-chain/p2p/connmgr"
"github.com/prysmaticlabs/prysm/shared/featureconfig"
)

// buildOptions for the libp2p host.
Expand All @@ -29,10 +28,9 @@ func buildOptions(cfg *Config, ip net.IP, priKey *ecdsa.PrivateKey) []libp2p.Opt
// Add one for the boot node and another for the relay, otherwise when we are close to maxPeers we will be above the high
// water mark and continually trigger pruning.
libp2p.ConnectionManager(connmgr.NewConnManager(int(cfg.MaxPeers+2), int(cfg.MaxPeers+2), 1*time.Second)),
}
if featureconfig.Get().EnableNoise {
// Enable NOISE for the beacon node
options = append(options, libp2p.Security(noise.ID, noise.New))
// Enable NOISE handshakes by default in the beacon node.
libp2p.Security(noise.ID, noise.New),
libp2p.DefaultSecurity,
}
nisdas marked this conversation as resolved.
Show resolved Hide resolved
if cfg.EnableUPnP {
options = append(options, libp2p.NATPortMap()) //Allow to use UPnP
Expand Down
9 changes: 8 additions & 1 deletion beacon-chain/p2p/service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
libp2p "github.com/libp2p/go-libp2p"
"github.com/libp2p/go-libp2p-core/host"
"github.com/libp2p/go-libp2p-core/peer"
noise "github.com/libp2p/go-libp2p-noise"
multiaddr "github.com/multiformats/go-multiaddr"
testDB "github.com/prysmaticlabs/prysm/beacon-chain/db/testing"
"github.com/prysmaticlabs/prysm/shared/testutil"
Expand Down Expand Up @@ -64,7 +65,13 @@ func createHost(t *testing.T, port int) (host.Host, *ecdsa.PrivateKey, net.IP) {
if err != nil {
t.Fatalf("Failed to p2p listen: %v", err)
}
h, err := libp2p.New(context.Background(), []libp2p.Option{privKeyOption(pkey), libp2p.ListenAddrs(listen)}...)
h, err := libp2p.New(
context.Background(),
[]libp2p.Option{
privKeyOption(pkey),
libp2p.ListenAddrs(listen),
libp2p.Security(noise.ID, noise.New),
}...)
if err != nil {
t.Fatal(err)
}
Expand Down
5 changes: 0 additions & 5 deletions shared/featureconfig/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ type Flags struct {
EnableDomainDataCache bool // EnableDomainDataCache caches validator calls to DomainData per epoch.
EnableStateGenSigVerify bool // EnableStateGenSigVerify verifies proposer and randao signatures during state gen.
CheckHeadState bool // CheckHeadState checks the current headstate before retrieving the desired state from the db.
EnableNoise bool // EnableNoise enables the beacon node to use NOISE instead of SECIO when performing a handshake with another peer.
DontPruneStateStartUp bool // DontPruneStateStartUp disables pruning state upon beacon node start up.
NewStateMgmt bool // NewStateMgmt enables the new experimental state mgmt service.
EnableInitSyncQueue bool // EnableInitSyncQueue enables the new initial sync implementation.
Expand Down Expand Up @@ -162,10 +161,6 @@ func ConfigureBeaconChain(ctx *cli.Context) {
log.Warn("Enabling check head state for chainservice")
cfg.CheckHeadState = true
}
if ctx.Bool(enableNoiseHandshake.Name) {
log.Warn("Enabling noise handshake for peer")
cfg.EnableNoise = true
}
if ctx.Bool(dontPruneStateStartUp.Name) {
log.Warn("Not enabling state pruning upon start up")
cfg.DontPruneStateStartUp = true
Expand Down
13 changes: 6 additions & 7 deletions shared/featureconfig/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,6 @@ var (
Name: "check-head-state",
Usage: "Enables the checking of head state in chainservice first before retrieving the desired state from the db.",
}
enableNoiseHandshake = &cli.BoolFlag{
Name: "enable-noise",
Usage: "This enables the beacon node to use NOISE instead of SECIO for performing handshakes between peers and " +
"securing transports between peers",
}
dontPruneStateStartUp = &cli.BoolFlag{
Name: "dont-prune-state-start-up",
Usage: "Don't prune historical states upon start up",
Expand Down Expand Up @@ -148,6 +143,11 @@ var (
const deprecatedUsage = "DEPRECATED. DO NOT USE."

var (
deprecatedEnableNoiseHandshake = &cli.BoolFlag{
Name: "enable-noise",
Usage: deprecatedUsage,
Hidden: true,
}
deprecatedEnableFinalizedBlockRootIndexFlag = &cli.BoolFlag{
Name: "enable-finalized-block-root-index",
Usage: deprecatedUsage,
Expand Down Expand Up @@ -193,7 +193,6 @@ var (
Usage: deprecatedUsage,
Hidden: true,
}

deprecatedEnableCustomStateSSZFlag = &cli.BoolFlag{
Name: "enable-custom-state-ssz",
Usage: deprecatedUsage,
Expand Down Expand Up @@ -272,6 +271,7 @@ var (
)

var deprecatedFlags = []cli.Flag{
deprecatedEnableNoiseHandshake,
deprecatedEnableFinalizedBlockRootIndexFlag,
deprecatedScatterFlag,
deprecatedPruneFinalizedStatesFlag,
Expand Down Expand Up @@ -332,7 +332,6 @@ var BeaconChainFlags = append(deprecatedFlags, []cli.Flag{
enableByteMempool,
enableStateGenSigVerify,
checkHeadState,
enableNoiseHandshake,
dontPruneStateStartUp,
broadcastSlashingFlag,
newStateMgmt,
Expand Down