Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 4 additions & 1 deletion cl/clparams/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -1065,7 +1065,10 @@ func EmbeddedEnabledByDefault(id uint64) bool {
}

func SupportBackfilling(networkId uint64) bool {
return networkId == uint64(MainnetNetwork) || networkId == uint64(SepoliaNetwork) || networkId == uint64(GnosisNetwork)
return networkId == uint64(MainnetNetwork) ||
networkId == uint64(SepoliaNetwork) ||
networkId == uint64(GnosisNetwork) ||
networkId == uint64(HoleskyNetwork)
}

func EpochToPaths(slot uint64, config *BeaconChainConfig, suffix string) (string, string) {
Expand Down
28 changes: 27 additions & 1 deletion cl/clparams/initial_state/initial_state.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,29 @@ package initial_state

import (
_ "embed"
"fmt"
"io"
"net/http"

"github.com/erigontech/erigon/cl/phase1/core/state"

"github.com/erigontech/erigon/cl/clparams"
)

func downloadGenesisState(url string) ([]byte, error) {
// Download genesis state by wget the url. MUST NOT RETURN NIL thorugh GET request. use go stnadard library
resp, err := http.Get(url)
if err != nil {
return nil, err
}
defer resp.Body.Close()
if resp.StatusCode != http.StatusOK {
return nil, fmt.Errorf("failed to download genesis state: %s", resp.Status)
}
return io.ReadAll(resp.Body)

}

//go:embed mainnet.state.ssz
var mainnetStateSSZ []byte

Expand Down Expand Up @@ -51,12 +68,21 @@ func GetGenesisState(network clparams.NetworkType) (*state.CachingBeaconState, e
if err := returnState.DecodeSSZ(gnosisStateSSZ, int(clparams.Phase0Version)); err != nil {
return nil, err
}
case clparams.HoleskyNetwork:
// Download genesis state by wget the url
encodedState, err := downloadGenesisState("https://github.com/eth-clients/holesky/raw/main/metadata/genesis.ssz")
if err != nil {
return nil, err
}
if err := returnState.DecodeSSZ(encodedState, int(clparams.BellatrixVersion)); err != nil {
return nil, err
}
default:
return nil, nil
}
return returnState, nil
}

func IsGenesisStateSupported(network clparams.NetworkType) bool {
return network == clparams.MainnetNetwork || network == clparams.SepoliaNetwork || network == clparams.GnosisNetwork
return network == clparams.MainnetNetwork || network == clparams.SepoliaNetwork || network == clparams.GnosisNetwork || network == clparams.HoleskyNetwork
}
1 change: 1 addition & 0 deletions core/snaptype/block_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ func init() {
snapcfg.RegisterKnownTypes(networkname.SepoliaChainName, ethereumTypes)
snapcfg.RegisterKnownTypes(networkname.GnosisChainName, ethereumTypes)
snapcfg.RegisterKnownTypes(networkname.ChiadoChainName, ethereumTypes)
snapcfg.RegisterKnownTypes(networkname.HoleskyChainName, ethereumTypes)
}

var Enums = struct {
Expand Down
12 changes: 7 additions & 5 deletions erigon-lib/chain/snapcfg/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package snapcfg
import (
_ "embed"
"encoding/json"
"fmt"
"path/filepath"
"slices"
"sort"
Expand All @@ -36,8 +37,8 @@ import (
)

var (
Mainnet = fromToml(snapshothashes.Mainnet)
// Holesky = fromToml(snapshothashes.Holesky)
Mainnet = fromToml(snapshothashes.Mainnet)
Holesky = fromToml(snapshothashes.Holesky)
Sepolia = fromToml(snapshothashes.Sepolia)
Mumbai = fromToml(snapshothashes.Mumbai)
Amoy = fromToml(snapshothashes.Amoy)
Expand Down Expand Up @@ -357,8 +358,8 @@ func (c Cfg) MergeLimit(t snaptype.Enum, fromBlock uint64) uint64 {
}

var knownPreverified = map[string]Preverified{
networkname.MainnetChainName: Mainnet,
// networkname.HoleskyChainName: HoleskyChainSnapshotCfg,
networkname.MainnetChainName: Mainnet,
networkname.HoleskyChainName: Holesky,
networkname.SepoliaChainName: Sepolia,
networkname.MumbaiChainName: Mumbai,
networkname.AmoyChainName: Amoy,
Expand Down Expand Up @@ -413,7 +414,7 @@ func MergeSteps(networkName string, snapType snaptype.Enum, fromBlock uint64) []
// KnownCfg return list of preverified hashes for given network, but apply whiteList filter if it's not empty
func KnownCfg(networkName string) *Cfg {
c, ok := knownPreverified[networkName]

fmt.Println(networkName, c, ok)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oops

if !ok {
return newCfg(networkName, Preverified{})
}
Expand All @@ -438,6 +439,7 @@ var KnownWebseeds = map[string][]string{
networkname.BorMainnetChainName: webseedsParse(webseed.BorMainnet),
networkname.GnosisChainName: webseedsParse(webseed.Gnosis),
networkname.ChiadoChainName: webseedsParse(webseed.Chiado),
networkname.HoleskyChainName: webseedsParse(webseed.Holesky),
}

func webseedsParse(in []byte) (res []string) {
Expand Down
2 changes: 1 addition & 1 deletion erigon-lib/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/erigontech/erigon-lib
go 1.21.5

require (
github.com/erigontech/erigon-snapshot v1.3.1-0.20240717150728-8e0fa991b894
github.com/erigontech/erigon-snapshot v1.3.1-0.20240720122906-e073fcdeca33
github.com/erigontech/interfaces v0.0.0-20240716134413-fc4152088ee6
github.com/erigontech/mdbx-go v0.38.4
github.com/erigontech/secp256k1 v1.1.0
Expand Down
4 changes: 2 additions & 2 deletions erigon-lib/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,8 @@ github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymF
github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98=
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
github.com/erigontech/erigon-snapshot v1.3.1-0.20240717150728-8e0fa991b894 h1:7ykEB96Z1HUYBuvAiawJkdXSvsmp1uv0BrGDhTD5nOA=
github.com/erigontech/erigon-snapshot v1.3.1-0.20240717150728-8e0fa991b894/go.mod h1:ooHlCl+eEYzebiPu+FP6Q6SpPUeMADn8Jxabv3IKb9M=
github.com/erigontech/erigon-snapshot v1.3.1-0.20240720122906-e073fcdeca33 h1:LDj3PcKBduXQLD9PzvdCr6Ks94lB4p0/5+Y1/Gb73eQ=
github.com/erigontech/erigon-snapshot v1.3.1-0.20240720122906-e073fcdeca33/go.mod h1:ooHlCl+eEYzebiPu+FP6Q6SpPUeMADn8Jxabv3IKb9M=
github.com/erigontech/interfaces v0.0.0-20240716134413-fc4152088ee6 h1:R1AYJT2FeMEwvBcAuYw7QTezk8DpXTQjCN1y5o0YBvI=
github.com/erigontech/interfaces v0.0.0-20240716134413-fc4152088ee6/go.mod h1:N7OUkhkcagp9+7yb4ycHsG2VWCOmuJ1ONBecJshxtLE=
github.com/erigontech/mdbx-go v0.38.4 h1:S9T7mTe9KPcFe4dOoOtVdI6gPzht9y7wMnYfUBgrQLo=
Expand Down
24 changes: 6 additions & 18 deletions eth/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -926,24 +926,12 @@ func New(ctx context.Context, stack *node.Node, config *ethconfig.Config, logger
executionRpc := direct.NewExecutionClientDirect(backend.eth1ExecutionServer)

var executionEngine executionclient.ExecutionEngine
caplinUseEngineAPI := config.NetworkID == uint64(clparams.HoleskyNetwork)
// Gnosis has too few blocks on his network for phase2 to work. Once we have proper snapshot automation, it can go back to normal.
if caplinUseEngineAPI {
// Read the jwt secret
jwtSecret, err := cli.ObtainJWTSecret(&stack.Config().Http, logger)
if err != nil {
return nil, err
}
executionEngine, err = executionclient.NewExecutionClientRPC(jwtSecret, stack.Config().Http.AuthRpcHTTPListenAddress, stack.Config().Http.AuthRpcPort)
if err != nil {
return nil, err
}
} else {
executionEngine, err = executionclient.NewExecutionClientDirect(eth1_chain_reader.NewChainReaderEth1(chainConfig, executionRpc, 1000))
if err != nil {
return nil, err
}

executionEngine, err = executionclient.NewExecutionClientDirect(eth1_chain_reader.NewChainReaderEth1(chainConfig, executionRpc, 1000))
if err != nil {
return nil, err
}

engineBackendRPC := engineapi.NewEngineServer(
logger,
chainConfig,
Expand All @@ -953,7 +941,7 @@ func New(ctx context.Context, stack *node.Node, config *ethconfig.Config, logger
logger, backend.sentriesClient.Hd, executionRpc,
backend.sentriesClient.Bd, backend.sentriesClient.BroadcastNewBlock, backend.sentriesClient.SendBodyRequest, blockReader,
backend.chainDB, chainConfig, tmpdir, config.Sync),
config.InternalCL && !caplinUseEngineAPI, // If the chain supports the engine API, then we should not make the server fail.
config.InternalCL, // If the chain supports the engine API, then we should not make the server fail.
false,
config.Miner.EnabledPOS)
backend.engineBackendRPC = engineBackendRPC
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ require (
github.com/docker/go-units v0.5.0 // indirect
github.com/dustin/go-humanize v1.0.1 // indirect
github.com/elastic/gosigar v0.14.2 // indirect
github.com/erigontech/erigon-snapshot v1.3.1-0.20240717150728-8e0fa991b894 // indirect
github.com/erigontech/erigon-snapshot v1.3.1-0.20240720122906-e073fcdeca33 // indirect
github.com/flynn/noise v1.1.0 // indirect
github.com/francoispqt/gojay v1.2.13 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -268,8 +268,8 @@ github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1m
github.com/envoyproxy/go-control-plane v0.9.7/go.mod h1:cwu0lG7PUMfa9snN8LXBig5ynNVH9qI8YYLbd1fK2po=
github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk=
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
github.com/erigontech/erigon-snapshot v1.3.1-0.20240717150728-8e0fa991b894 h1:7ykEB96Z1HUYBuvAiawJkdXSvsmp1uv0BrGDhTD5nOA=
github.com/erigontech/erigon-snapshot v1.3.1-0.20240717150728-8e0fa991b894/go.mod h1:ooHlCl+eEYzebiPu+FP6Q6SpPUeMADn8Jxabv3IKb9M=
github.com/erigontech/erigon-snapshot v1.3.1-0.20240720122906-e073fcdeca33 h1:LDj3PcKBduXQLD9PzvdCr6Ks94lB4p0/5+Y1/Gb73eQ=
github.com/erigontech/erigon-snapshot v1.3.1-0.20240720122906-e073fcdeca33/go.mod h1:ooHlCl+eEYzebiPu+FP6Q6SpPUeMADn8Jxabv3IKb9M=
github.com/erigontech/erigonwatch v0.0.0-20240718131902-b6576bde1116 h1:KCFa2uXEfZoBjV4buzjWmCmoqVLXiGCq0ZmQ2OjeRvQ=
github.com/erigontech/erigonwatch v0.0.0-20240718131902-b6576bde1116/go.mod h1:8vQ+VjvLu2gkPs8EwdPrOTAAo++WuLuBi54N7NuAF0I=
github.com/erigontech/mdbx-go v0.38.4 h1:S9T7mTe9KPcFe4dOoOtVdI6gPzht9y7wMnYfUBgrQLo=
Expand All @@ -278,10 +278,10 @@ github.com/erigontech/secp256k1 v1.1.0 h1:mO3YJMUSoASE15Ya//SoHiisptUhdXExuMUN1M
github.com/erigontech/secp256k1 v1.1.0/go.mod h1:GokhPepsMB+EYDs7I5JZCprxHW6+yfOcJKaKtoZ+Fls=
github.com/erigontech/silkworm-go v0.18.0 h1:j56p61xZHBFhZGH1OixlGU8KcfjHzcw9pjAfjmVsOZA=
github.com/erigontech/silkworm-go v0.18.0/go.mod h1:O50ux0apICEVEGyRWiE488K8qz8lc3PA/SXbQQAc8SU=
github.com/erigontech/torrent v1.54.2-alpha-32 h1:Ly8W2JvD7r1o5TklXxKEV9D9Tr664tSrgj5OPpOrlWg=
github.com/erigontech/torrent v1.54.2-alpha-32/go.mod h1:QtK2WLdEz1Iy1Dh/325UltdHU0nA1xujh2rN6aov6y0=
github.com/erigontech/speedtest v0.0.2 h1:W9Cvky/8AMUtUONwkLA/dZjeQ2XfkBdYfJzvhMZUO+U=
github.com/erigontech/speedtest v0.0.2/go.mod h1:vulsRNiM51BmSTbVtch4FWxKxx53pS2D35lZTtao0bw=
github.com/erigontech/torrent v1.54.2-alpha-32 h1:Ly8W2JvD7r1o5TklXxKEV9D9Tr664tSrgj5OPpOrlWg=
github.com/erigontech/torrent v1.54.2-alpha-32/go.mod h1:QtK2WLdEz1Iy1Dh/325UltdHU0nA1xujh2rN6aov6y0=
github.com/fatih/color v1.16.0 h1:zmkK9Ngbjj+K0yRhTVONQh1p/HknKYSlNT+vZCzyokM=
github.com/fatih/color v1.16.0/go.mod h1:fL2Sau1YI5c0pdGEVCbKQbLXB6edEj1ZgiY4NijnWvE=
github.com/fjl/gencodec v0.0.0-20220412091415-8bb9e558978c h1:CndMRAH4JIwxbW8KYq6Q+cGWcGHz0FjGR3QqcInWcW0=
Expand Down
1 change: 1 addition & 0 deletions params/chainspecs/holesky.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"chainName": "holesky",
"chainId": 17000,
"homesteadBlock": 0,
"eip150Block": 0,
Expand Down
1 change: 1 addition & 0 deletions turbo/snapshotsync/snapshotsync.go
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@ func WaitForDownloader(ctx context.Context, logPrefix string, headerchain, blobs
// send all hashes to the Downloader service
snapCfg := snapcfg.KnownCfg(cc.ChainName)
preverifiedBlockSnapshots := snapCfg.Preverified
fmt.Println(snapCfg)
downloadRequest := make([]services.DownloadRequest, 0, len(preverifiedBlockSnapshots))

blockPrune, historyPrune := computeBlocksToPrune(blockReader, prune)
Expand Down