mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-22 03:30:35 +00:00
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:
parent
bec91d348e
commit
05678b6724
@ -59,6 +59,7 @@ go_library(
|
||||
"//shared/traceutil:go_default_library",
|
||||
"//shared/version:go_default_library",
|
||||
"@com_github_dgraph_io_ristretto//:go_default_library",
|
||||
"@com_github_ethereum_go_ethereum//crypto:go_default_library",
|
||||
"@com_github_ethereum_go_ethereum//p2p/discover:go_default_library",
|
||||
"@com_github_ethereum_go_ethereum//p2p/enode:go_default_library",
|
||||
"@com_github_ethereum_go_ethereum//p2p/enr:go_default_library",
|
||||
|
@ -13,6 +13,7 @@ import (
|
||||
"path"
|
||||
"time"
|
||||
|
||||
gcrypto "github.com/ethereum/go-ethereum/crypto"
|
||||
"github.com/ethereum/go-ethereum/p2p/enr"
|
||||
"github.com/libp2p/go-libp2p-core/crypto"
|
||||
"github.com/pkg/errors"
|
||||
@ -40,6 +41,7 @@ func SerializeENR(record *enr.Record) (string, error) {
|
||||
|
||||
func convertFromInterfacePrivKey(privkey crypto.PrivKey) *ecdsa.PrivateKey {
|
||||
typeAssertedKey := (*ecdsa.PrivateKey)(privkey.(*crypto.Secp256k1PrivateKey))
|
||||
typeAssertedKey.Curve = gcrypto.S256() // Temporary hack, so libp2p Secp256k1 is recognized as geth Secp256k1 in disc v5.1.
|
||||
return typeAssertedKey
|
||||
}
|
||||
|
||||
|
@ -15,16 +15,10 @@ func UnpackDepositLogData(data []byte) (pubkey, withdrawalCredentials, amount, s
|
||||
return nil, nil, nil, nil, nil, errors.Wrap(err, "unable to generate contract abi")
|
||||
}
|
||||
|
||||
unpackedLogs := []interface{}{
|
||||
&pubkey,
|
||||
&withdrawalCredentials,
|
||||
&amount,
|
||||
&signature,
|
||||
&index,
|
||||
}
|
||||
if err := contractAbi.Unpack(&unpackedLogs, "DepositEvent", data); err != nil {
|
||||
unpackedLogs, err := contractAbi.Unpack("DepositEvent", data)
|
||||
if err != nil {
|
||||
return nil, nil, nil, nil, nil, errors.Wrap(err, "unable to unpack logs")
|
||||
}
|
||||
|
||||
return pubkey, withdrawalCredentials, amount, signature, index, nil
|
||||
return unpackedLogs[0].([]byte), unpackedLogs[1].([]byte), unpackedLogs[2].([]byte), unpackedLogs[3].([]byte), unpackedLogs[4].([]byte), nil
|
||||
}
|
||||
|
File diff suppressed because one or more lines are too long
@ -154,7 +154,7 @@ func bindDepositContract(address common.Address, caller bind.ContractCaller, tra
|
||||
// sets the output to result. The result type might be a single field for simple
|
||||
// returns, a slice of interfaces for anonymous returns and a struct for named
|
||||
// returns.
|
||||
func (_DepositContract *DepositContractRaw) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error {
|
||||
func (_DepositContract *DepositContractRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error {
|
||||
return _DepositContract.Contract.DepositContractCaller.contract.Call(opts, result, method, params...)
|
||||
}
|
||||
|
||||
@ -173,7 +173,7 @@ func (_DepositContract *DepositContractRaw) Transact(opts *bind.TransactOpts, me
|
||||
// sets the output to result. The result type might be a single field for simple
|
||||
// returns, a slice of interfaces for anonymous returns and a struct for named
|
||||
// returns.
|
||||
func (_DepositContract *DepositContractCallerRaw) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error {
|
||||
func (_DepositContract *DepositContractCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error {
|
||||
return _DepositContract.Contract.contract.Call(opts, result, method, params...)
|
||||
}
|
||||
|
||||
@ -192,12 +192,17 @@ func (_DepositContract *DepositContractTransactorRaw) Transact(opts *bind.Transa
|
||||
//
|
||||
// Solidity: function drain_address() returns(address out)
|
||||
func (_DepositContract *DepositContractCaller) DrainAddress(opts *bind.CallOpts) (common.Address, error) {
|
||||
var (
|
||||
ret0 = new(common.Address)
|
||||
)
|
||||
out := ret0
|
||||
err := _DepositContract.contract.Call(opts, out, "drain_address")
|
||||
return *ret0, err
|
||||
var out []interface{}
|
||||
err := _DepositContract.contract.Call(opts, &out, "drain_address")
|
||||
|
||||
if err != nil {
|
||||
return *new(common.Address), err
|
||||
}
|
||||
|
||||
out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address)
|
||||
|
||||
return out0, err
|
||||
|
||||
}
|
||||
|
||||
// DrainAddress is a free data retrieval call binding the contract method 0x8ba35cdf.
|
||||
@ -218,12 +223,17 @@ func (_DepositContract *DepositContractCallerSession) DrainAddress() (common.Add
|
||||
//
|
||||
// Solidity: function get_deposit_count() returns(bytes out)
|
||||
func (_DepositContract *DepositContractCaller) GetDepositCount(opts *bind.CallOpts) ([]byte, error) {
|
||||
var (
|
||||
ret0 = new([]byte)
|
||||
)
|
||||
out := ret0
|
||||
err := _DepositContract.contract.Call(opts, out, "get_deposit_count")
|
||||
return *ret0, err
|
||||
var out []interface{}
|
||||
err := _DepositContract.contract.Call(opts, &out, "get_deposit_count")
|
||||
|
||||
if err != nil {
|
||||
return *new([]byte), err
|
||||
}
|
||||
|
||||
out0 := *abi.ConvertType(out[0], new([]byte)).(*[]byte)
|
||||
|
||||
return out0, err
|
||||
|
||||
}
|
||||
|
||||
// GetDepositCount is a free data retrieval call binding the contract method 0x621fd130.
|
||||
@ -244,12 +254,17 @@ func (_DepositContract *DepositContractCallerSession) GetDepositCount() ([]byte,
|
||||
//
|
||||
// Solidity: function get_deposit_root() returns(bytes32 out)
|
||||
func (_DepositContract *DepositContractCaller) GetDepositRoot(opts *bind.CallOpts) ([32]byte, error) {
|
||||
var (
|
||||
ret0 = new([32]byte)
|
||||
)
|
||||
out := ret0
|
||||
err := _DepositContract.contract.Call(opts, out, "get_deposit_root")
|
||||
return *ret0, err
|
||||
var out []interface{}
|
||||
err := _DepositContract.contract.Call(opts, &out, "get_deposit_root")
|
||||
|
||||
if err != nil {
|
||||
return *new([32]byte), err
|
||||
}
|
||||
|
||||
out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte)
|
||||
|
||||
return out0, err
|
||||
|
||||
}
|
||||
|
||||
// GetDepositRoot is a free data retrieval call binding the contract method 0xc5f2892f.
|
||||
|
18
deps.bzl
18
deps.bzl
@ -54,15 +54,15 @@ def prysm_deps():
|
||||
build_file_generation = "off",
|
||||
importpath = "github.com/prysmaticlabs/bazel-go-ethereum",
|
||||
replace = "github.com/ethereum/go-ethereum",
|
||||
sum = "h1:yoOj4FD6uNdWDjgZqlKGxmUYnR6tI9zN1NrE8tJ3/xE=",
|
||||
version = "v0.0.0-20200922100503-3794d0d7ca25",
|
||||
sum = "h1:+AspXGWVJzMtcy24DkGEJqut1grik397nnb7JybNBy8=",
|
||||
version = "v0.0.0-20201016095414-974cbc1dd92e",
|
||||
)
|
||||
|
||||
# Note: It is required to define com_github_ethereum_go_ethereum like this for some reason...
|
||||
# Note: The keep directives help gazelle leave this alone.
|
||||
go_repository(
|
||||
name = "com_github_ethereum_go_ethereum",
|
||||
commit = "3794d0d7ca257542c40a8c55e35fe218cc216717", # keep
|
||||
commit = "974cbc1dd92e929f7856092b29d3f725dfab9803", # keep
|
||||
importpath = "github.com/ethereum/go-ethereum", # keep
|
||||
# Note: go-ethereum is not bazel-friendly with regards to cgo. We have a
|
||||
# a fork that has resolved these issues by disabling HID/USB support and
|
||||
@ -590,8 +590,8 @@ def prysm_deps():
|
||||
go_repository(
|
||||
name = "com_github_go_sql_driver_mysql",
|
||||
importpath = "github.com/go-sql-driver/mysql",
|
||||
sum = "h1:ozyZYNQW3x3HtqT1jira07DN2PArx2v7/mN66gGcHOs=",
|
||||
version = "v1.5.0",
|
||||
sum = "h1:g24URVg0OFbNUTx9qqY1IRZ9D9z3iPyi5zKhQZpNwpA=",
|
||||
version = "v1.4.1",
|
||||
)
|
||||
go_repository(
|
||||
name = "com_github_golang_protobuf",
|
||||
@ -784,8 +784,8 @@ def prysm_deps():
|
||||
go_repository(
|
||||
name = "com_github_jmespath_go_jmespath",
|
||||
importpath = "github.com/jmespath/go-jmespath",
|
||||
sum = "h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg=",
|
||||
version = "v0.4.0",
|
||||
sum = "h1:pmfjZENx5imkbgOkpRUYLnmbU7UEFbjtDA2hxJ1ichM=",
|
||||
version = "v0.0.0-20180206201540-c2b33e8439af",
|
||||
)
|
||||
go_repository(
|
||||
name = "com_github_jrick_logrotate",
|
||||
@ -1916,8 +1916,8 @@ def prysm_deps():
|
||||
go_repository(
|
||||
name = "com_github_aws_aws_sdk_go",
|
||||
importpath = "github.com/aws/aws-sdk-go",
|
||||
sum = "h1:FHMhVhyc/9jljgFAcGkQDYjpC9btM0B8VfkLBfctdNE=",
|
||||
version = "v1.35.7",
|
||||
sum = "h1:J82DYDGZHOKHdhx6hD24Tm30c2C3GchYGfN0mf9iKUk=",
|
||||
version = "v1.25.48",
|
||||
)
|
||||
go_repository(
|
||||
name = "com_github_beorn7_perks",
|
||||
|
2
go.mod
2
go.mod
@ -125,6 +125,6 @@ require (
|
||||
k8s.io/utils v0.0.0-20200520001619-278ece378a50 // indirect
|
||||
)
|
||||
|
||||
replace github.com/ethereum/go-ethereum => github.com/prysmaticlabs/bazel-go-ethereum v0.0.0-20200922100503-3794d0d7ca25
|
||||
replace github.com/ethereum/go-ethereum => github.com/prysmaticlabs/bazel-go-ethereum v0.0.0-20201016095414-974cbc1dd92e
|
||||
|
||||
replace github.com/json-iterator/go => github.com/prestonvanloon/go v1.1.7-0.20190722034630-4f2e55fcf87b
|
||||
|
4
go.sum
4
go.sum
@ -912,8 +912,8 @@ github.com/prometheus/tsdb v0.10.0/go.mod h1:oi49uRhEe9dPUTlS3JRZOwJuVi6tmh10QSg
|
||||
github.com/protolambda/zssz v0.1.3/go.mod h1:a4iwOX5FE7/JkKA+J/PH0Mjo9oXftN6P8NZyL28gpag=
|
||||
github.com/protolambda/zssz v0.1.5 h1:7fjJjissZIIaa2QcvmhS/pZISMX21zVITt49sW1ouek=
|
||||
github.com/protolambda/zssz v0.1.5/go.mod h1:a4iwOX5FE7/JkKA+J/PH0Mjo9oXftN6P8NZyL28gpag=
|
||||
github.com/prysmaticlabs/bazel-go-ethereum v0.0.0-20200922100503-3794d0d7ca25 h1:yoOj4FD6uNdWDjgZqlKGxmUYnR6tI9zN1NrE8tJ3/xE=
|
||||
github.com/prysmaticlabs/bazel-go-ethereum v0.0.0-20200922100503-3794d0d7ca25/go.mod h1:FQjK3ZwD8C5DYn7ukTmFee36rq1dOMESiUfXr5RUc1w=
|
||||
github.com/prysmaticlabs/bazel-go-ethereum v0.0.0-20201016095414-974cbc1dd92e h1:+AspXGWVJzMtcy24DkGEJqut1grik397nnb7JybNBy8=
|
||||
github.com/prysmaticlabs/bazel-go-ethereum v0.0.0-20201016095414-974cbc1dd92e/go.mod h1:JIfVb6esrqALTExdz9hRYvrP0xBDf6wCncIu1hNwHpM=
|
||||
github.com/prysmaticlabs/ethereumapis v0.0.0-20201003171600-a72e5f77d233 h1:dGeuKeaXxCepTbwsz7kYSfP1yazw1uRMn58CqNCcPP4=
|
||||
github.com/prysmaticlabs/ethereumapis v0.0.0-20201003171600-a72e5f77d233/go.mod h1:k7b2dxy6RppCG6kmOJkNOXzRpEoTdsPygc2aQhsUsZk=
|
||||
github.com/prysmaticlabs/go-bitfield v0.0.0-20191017011753-53b773adde52/go.mod h1:hCwmef+4qXWjv0jLDbQdWnL0Ol7cS7/lCSS26WR+u6s=
|
||||
|
@ -84,7 +84,12 @@ var (
|
||||
BootstrapNode = &cli.StringSliceFlag{
|
||||
Name: "bootstrap-node",
|
||||
Usage: "The address of bootstrap node. Beacon node will connect for peer discovery via DHT. Multiple nodes can be passed by using the flag multiple times but not comma-separated. You can also pass YAML files containing multiple nodes.",
|
||||
Value: cli.NewStringSlice("enr:-Ku4QMKVC_MowDsmEa20d5uGjrChI0h8_KsKXDmgVQbIbngZV0idV6_RL7fEtZGo-kTNZ5o7_EJI_vCPJ6scrhwX0Z4Bh2F0dG5ldHOIAAAAAAAAAACEZXRoMpD1pf1CAAAAAP__________gmlkgnY0gmlwhBLf22SJc2VjcDI1NmsxoQJxCnE6v_x2ekgY_uoE1rtwzvGy40mq9eD66XfHPBWgIIN1ZHCCD6A"),
|
||||
Value: cli.NewStringSlice(
|
||||
// Discv5
|
||||
"enr:-Ku4QMKVC_MowDsmEa20d5uGjrChI0h8_KsKXDmgVQbIbngZV0idV6_RL7fEtZGo-kTNZ5o7_EJI_vCPJ6scrhwX0Z4Bh2F0dG5ldHOIAAAAAAAAAACEZXRoMpD1pf1CAAAAAP__________gmlkgnY0gmlwhBLf22SJc2VjcDI1NmsxoQJxCnE6v_x2ekgY_uoE1rtwzvGy40mq9eD66XfHPBWgIIN1ZHCCD6A",
|
||||
// Discv5.1
|
||||
"enr:-Ku4QOnVSyvzS3VbF87J8MubaRuTyfPi6B67XQg6-5eAV_uILAhn9geTTQmfqDIOcIeAxWHUUajQp6lYniAXPWncp6UBh2F0dG5ldHOIAAAAAAAAAACEZXRoMpAYrkzLAAAAAf__________gmlkgnY0gmlwhBLf22SJc2VjcDI1NmsxoQKekYKqUtwbaJKKCct_srE5-g7tBUm68mj_jpeSb7CCqYN1ZHCCC7g",
|
||||
),
|
||||
}
|
||||
// RelayNode tells the beacon node which relay node to connect to.
|
||||
RelayNode = &cli.StringFlag{
|
||||
|
@ -11,9 +11,9 @@ func UseMedallaNetworkConfig() {
|
||||
// Medalla Bootstrap Nodes
|
||||
cfg.BootstrapNodes = []string{
|
||||
// Prylabs Bootnodes
|
||||
"enr:-Ku4QLglCMIYAgHd51uFUqejD9DWGovHOseHQy7Od1SeZnHnQ3fSpE4_nbfVs8lsy8uF07ae7IgrOOUFU0NFvZp5D4wBh2F0dG5ldHOIAAAAAAAAAACEZXRoMpAYrkzLAAAAAf__________gmlkgnY0gmlwhBLf22SJc2VjcDI1NmsxoQJxCnE6v_x2ekgY_uoE1rtwzvGy40mq9eD66XfHPBWgIIN1ZHCCD6A",
|
||||
"enr:-Ku4QOnVSyvzS3VbF87J8MubaRuTyfPi6B67XQg6-5eAV_uILAhn9geTTQmfqDIOcIeAxWHUUajQp6lYniAXPWncp6UBh2F0dG5ldHOIAAAAAAAAAACEZXRoMpAYrkzLAAAAAf__________gmlkgnY0gmlwhBLf22SJc2VjcDI1NmsxoQKekYKqUtwbaJKKCct_srE5-g7tBUm68mj_jpeSb7CCqYN1ZHCCC7g",
|
||||
"enr:-Ku4QOdk3u7rXI5YvqwmEbApW_OLlRkq_yzmmhdlrJMcfviacLWwSm-tr1BOvamuRQqfc6lnMeec4E4ddOhd3KqCB98Bh2F0dG5ldHOIAAAAAAAAAACEZXRoMpAYrkzLAAAAAf__________gmlkgnY0gmlwhBLf22SJc2VjcDI1NmsxoQKH3lxnglLqrA7L6sl5r7XFnckr3XCnlZMaBTYSdE8SHIN1ZHCCG1g",
|
||||
"enr:-Ku4QOVrqhlmsh9m2MGSnvVz8XPfjwHWBuOcgVQvWwBhN0-NI0XVhSerujBBwIeLpc-OES0C9iAzJhiCgRZ0xH13DgEBh2F0dG5ldHOIAAAAAAAAAACEZXRoMpAYrkzLAAAAAf__________gmlkgnY0gmlwhBLf22SJc2VjcDI1NmsxoQLEq16KLm1vPjUKYGkHq296D60i7y209NYPUpwZPXDVgYN1ZHCCF3A",
|
||||
"enr:-Ku4QHWezvidY_m0dWEwERrNrqjEQWrlIx7b8K4EIxGgTrLmUxHCZPW5-t8PsS8nFxAJ8k8YacKP5zPRk5gbsTSsRTQBh2F0dG5ldHOIAAAAAAAAAACEZXRoMpAYrkzLAAAAAf__________gmlkgnY0gmlwhBLf22SJc2VjcDI1NmsxoQMypP_ODwTuBq2v0oIdjPGCEyu9Hb_jHDbuIX_iNvBRGoN1ZHCCGWQ",
|
||||
// External Bootnodes
|
||||
"enr:-Ku4QFVactU18ogiqPPasKs3jhUm5ISszUrUMK2c6SUPbGtANXVJ2wFapsKwVEVnVKxZ7Gsr9yEc4PYF-a14ahPa1q0Bh2F0dG5ldHOIAAAAAAAAAACEZXRoMpAYrkzLAAAAAf__________gmlkgnY0gmlwhGQbAHyJc2VjcDI1NmsxoQILF-Ya2i5yowVkQtlnZLjG0kqC4qtwmSk8ha7tKLuME4N1ZHCCIyg",
|
||||
"enr:-KG4QFuKQ9eeXDTf8J4tBxFvs3QeMrr72mvS7qJgL9ieO6k9Rq5QuGqtGK4VlXMNHfe34Khhw427r7peSoIbGcN91fUDhGV0aDKQD8XYjwAAAAH__________4JpZIJ2NIJpcIQDhMExiXNlY3AyNTZrMaEDESplmV9c2k73v0DjxVXJ6__2bWyP-tK28_80lf7dUhqDdGNwgiMog3VkcIIjKA",
|
||||
|
@ -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",
|
||||
|
@ -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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user