From 666b6bb1cd71e6346c0df8a2abb6370ec7f3dbfe Mon Sep 17 00:00:00 2001 From: cortze Date: Thu, 13 Apr 2023 12:09:12 +0200 Subject: [PATCH 1/4] update: config: req fork digest to beacon-node if endpoint provided --- pkg/config/ethereum_config.go | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/pkg/config/ethereum_config.go b/pkg/config/ethereum_config.go index ee7883b..3f774d0 100644 --- a/pkg/config/ethereum_config.go +++ b/pkg/config/ethereum_config.go @@ -112,20 +112,22 @@ func (c *EthereumCrawlerConfig) Apply(ctx *cli.Context) { if valid { c.ForkDigest = validForkDigest } - // check if fork-digest is not empty -> eth-cl endpoint - if forkDigest == "" && ctx.IsSet("remote-cl-endpoint") { - c.EthCLRemoteEndpoint = ctx.String("remote-cl-endpoint") - log.Warnf("fork_digest not provided - fetching latest one from %s", c.EthCLRemoteEndpoint) - clEndp, err := rendp.NewInfuraClient(c.EthCLRemoteEndpoint) - if err != nil { - log.Panic(errors.Wrap(err, "unable to determine the latest fork_digest")) - } - forkD, err := rendp.GetForkDigetsOfEth2Head(ctx.Context, &clEndp) - if err != nil { - log.Panic(errors.Wrap(err, "unable to retreive the fork_digests from given rndp")) - } - c.ForkDigest = forkD.String() + + } + + // Check if the eth-cl endpoint + if ctx.IsSet("remote-cl-endpoint") { + c.EthCLRemoteEndpoint = ctx.String("remote-cl-endpoint") + log.Warnf("fork_digest not provided - fetching latest one from %s", c.EthCLRemoteEndpoint) + clEndp, err := rendp.NewInfuraClient(c.EthCLRemoteEndpoint) + if err != nil { + log.Panic(errors.Wrap(err, "unable to determine the latest fork_digest")) + } + forkD, err := rendp.GetForkDigetsOfEth2Head(ctx.Context, &clEndp) + if err != nil { + log.Panic(errors.Wrap(err, "unable to retreive the fork_digests from given rndp")) } + c.ForkDigest = forkD.String() } // postgresql endpoint From 85c094c61b1e29d62c0433bcdfedb2c0c5812273 Mon Sep 17 00:00:00 2001 From: cortze Date: Thu, 13 Apr 2023 13:36:28 +0200 Subject: [PATCH 2/4] upgrade proto/zrnt --- go.mod | 2 +- go.sum | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/go.mod b/go.mod index a5a0d7c..0e6d588 100644 --- a/go.mod +++ b/go.mod @@ -21,7 +21,7 @@ require ( github.com/multiformats/go-multiaddr v0.4.0 github.com/pkg/errors v0.9.1 github.com/prometheus/client_golang v1.11.0 - github.com/protolambda/zrnt v0.28.0 + github.com/protolambda/zrnt v0.30.0 github.com/protolambda/ztyp v0.2.2 github.com/sirupsen/logrus v1.9.0 github.com/stretchr/testify v1.8.1 diff --git a/go.sum b/go.sum index ca2acd1..0d4bffe 100644 --- a/go.sum +++ b/go.sum @@ -1137,6 +1137,8 @@ github.com/protolambda/bls12-381-util v0.0.0-20210720105258-a772f2aac13e/go.mod github.com/protolambda/messagediff v1.4.0/go.mod h1:LboJp0EwIbJsePYpzh5Op/9G1/4mIztMRYzzwR0dR2M= github.com/protolambda/zrnt v0.28.0 h1:vdEL8JDqJ3wdzgqgh6Fhz1Wr3+AMGbUZ2nqoNt6QVX0= github.com/protolambda/zrnt v0.28.0/go.mod h1:qcdX9CXFeVNCQK/q0nswpzhd+31RHMk2Ax/2lMsJ4Jw= +github.com/protolambda/zrnt v0.30.0 h1:pHEn69ZgaDFGpLGGYG1oD7DvYI7RDirbMBPfbC+8p4g= +github.com/protolambda/zrnt v0.30.0/go.mod h1:qcdX9CXFeVNCQK/q0nswpzhd+31RHMk2Ax/2lMsJ4Jw= github.com/protolambda/ztyp v0.2.2 h1:rVcL3vBu9W/aV646zF6caLS/dyn9BN8NYiuJzicLNyY= github.com/protolambda/ztyp v0.2.2/go.mod h1:9bYgKGqg3wJqT9ac1gI2hnVb0STQq7p/1lapqrqY1dU= github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= From 56dff72d138cf2e3919dbe9f2f8684e538a27346 Mon Sep 17 00:00:00 2001 From: cortze Date: Thu, 13 Apr 2023 13:37:02 +0200 Subject: [PATCH 3/4] update block msg to capella block --- pkg/networks/ethereum/gossip_handlers.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/networks/ethereum/gossip_handlers.go b/pkg/networks/ethereum/gossip_handlers.go index a558581..2e6c9fc 100644 --- a/pkg/networks/ethereum/gossip_handlers.go +++ b/pkg/networks/ethereum/gossip_handlers.go @@ -8,7 +8,7 @@ import ( // bls "github.com/phoreproject/github.com/bls/g1pubs" "github.com/migalabs/armiarma/pkg/gossipsub" - "github.com/protolambda/zrnt/eth2/beacon/bellatrix" + "github.com/protolambda/zrnt/eth2/beacon/capella" "github.com/protolambda/zrnt/eth2/beacon/common" "github.com/protolambda/zrnt/eth2/beacon/phase0" "github.com/protolambda/zrnt/eth2/configs" @@ -123,7 +123,7 @@ func (mh *EthMessageHandler) BeaconBlockMessageHandler(msg *pubsub.Message) (gos return nil, err } msgBuf := bytes.NewBuffer(msgBytes) - bblock := new(bellatrix.SignedBeaconBlock) + bblock := new(capella.SignedBeaconBlock) err = bblock.Deserialize(configs.Mainnet, codec.NewDecodingReader(msgBuf, uint64(len(msgBuf.Bytes())))) if err != nil { From 6828263308f0a2dd3a5c8c5881dcb5bb9024414a Mon Sep 17 00:00:00 2001 From: cortze Date: Thu, 13 Apr 2023 13:37:39 +0200 Subject: [PATCH 4/4] fetch and update new ForkDigest for mainnet and prater --- pkg/networks/ethereum/network_info.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pkg/networks/ethereum/network_info.go b/pkg/networks/ethereum/network_info.go index 8b489b0..2a0582b 100644 --- a/pkg/networks/ethereum/network_info.go +++ b/pkg/networks/ethereum/network_info.go @@ -13,13 +13,14 @@ var ( BlockchainName string = "eth2" // default fork_digests - DefaultForkDigest string = ForkDigests[BellatrixKey] + DefaultForkDigest string = ForkDigests[CapellaKey] AllForkDigest string = "All" // Mainnet Phase0Key string = "Mainnet" AltairKey string = "Altair" BellatrixKey string = "Bellatrix" + CapellaKey string = "Capella" // Gnosis GnosisPhase0Key string = "GnosisPhase0" GnosisAltairKey string = "GnosisAltair" @@ -27,6 +28,7 @@ var ( // Goerli / Prater PraterPhase0Key string = "PraterPhase0" PraterBellatrixKey string = "PraterBellatrix" + PraterCapellaKey string = "PraterCapella" ForkDigests = map[string]string{ AllForkDigest: "all", @@ -34,12 +36,14 @@ var ( Phase0Key: "0xb5303f2a", AltairKey: "0xafcaaba0", BellatrixKey: "0x4a26c58b", + CapellaKey: "0xbba4da96", // Gnosis GnosisPhase0Key: "0xf925ddc5", GnosisBellatrixKey: "0x56fdb5e0", // Goerli PraterPhase0Key: "0x79df0428", PraterBellatrixKey: "0xc2ce3aa8", + PraterCapellaKey: "0x628941ef", } MessageTypes = []string{