Update to Discovery V5.1 (#7302)

* discoveryV5.1

* add seed node

* fix up

* checkpoint

* Add workaround for discv5.1 signature curve. Add discv5.1 catdog ENR

* remove dead code

* Add another catdog

* Fix bootnode

* fix docker img

Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
Co-authored-by: Preston Van Loon <preston@prysmaticlabs.com>
This commit is contained in:
Nishant Das
2020-10-20 12:05:48 +08:00
committed by GitHub
parent bec91d348e
commit 05678b6724
12 changed files with 75 additions and 45 deletions

View File

@@ -19,6 +19,7 @@ go_library(
"//shared/params:go_default_library",
"//shared/runutil:go_default_library",
"//shared/version:go_default_library",
"@com_github_ethereum_go_ethereum//crypto:go_default_library",
"@com_github_ethereum_go_ethereum//log:go_default_library",
"@com_github_ethereum_go_ethereum//p2p/discover:go_default_library",
"@com_github_ethereum_go_ethereum//p2p/enode:go_default_library",
@@ -51,6 +52,7 @@ go_image(
"//shared/bytesutil:go_default_library",
"//shared/runutil:go_default_library",
"//shared/version:go_default_library",
"@com_github_ethereum_go_ethereum//crypto:go_default_library",
"@com_github_btcsuite_btcd//btcec:go_default_library",
"@com_github_ethereum_go_ethereum//log:go_default_library",
"@com_github_ethereum_go_ethereum//p2p/discover:go_default_library",

View File

@@ -22,6 +22,7 @@ import (
"os"
"time"
gcrypto "github.com/ethereum/go-ethereum/crypto"
gethlog "github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/p2p/discover"
"github.com/ethereum/go-ethereum/p2p/enode"
@@ -52,6 +53,7 @@ var (
externalIP = flag.String("external-ip", "", "External IP for the bootnode")
forkVersion = flag.String("fork-version", "", "Fork Version that the bootnode uses")
genesisValidatorRoot = flag.String("genesis-root", "", "Genesis Validator Root the beacon node uses")
seedNode = flag.String("seed-node", "", "External node to connect to")
log = logrus.WithField("prefix", "bootnode")
discv5PeersCount = promauto.NewGauge(prometheus.GaugeOpts{
Name: "bootstrap_node_discv5_peers",
@@ -91,6 +93,14 @@ func main() {
cfg := discover.Config{
PrivateKey: privKey,
}
if *seedNode != "" {
log.Debugf("Adding seed node %s", *seedNode)
node, err := enode.Parse(enode.ValidSchemes, *seedNode)
if err != nil {
log.Fatal(err)
}
cfg.Bootnodes = []*enode.Node{node}
}
ipAddr, err := iputils.ExternalIP()
if err != nil {
log.Fatal(err)
@@ -255,6 +265,7 @@ func extractPrivateKey() *ecdsa.PrivateKey {
}
log.Debugf("Private key %x", b)
}
privKey.Curve = gcrypto.S256()
return privKey
}