Skip to content

Commit 7f62c82

Browse files
authored
Backport bloatnet EL --chain=bloatnet support (#19095)
This is a backport of `--chain=bloatnet` support added in the `performance-stable` branch. It should be pretty isolated from mainnet settings now, so it is safe to backport to main in order to minimize branch differences. With that PR, you should be able to do `erigon --chain=bloatnet` and all network settings of the shadowfork should be applied, no custom overrides must be necessary (treat them as a bug if you find some). External CL is necessary (I have a separate PR with caplin support). You may encounter some webseeds warnings on start, but I have concluded that's a separate issue happening in main already: #19094
1 parent 1e50a8a commit 7f62c82

File tree

12 files changed

+111
-10
lines changed

12 files changed

+111
-10
lines changed

cl/clparams/config.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1362,6 +1362,10 @@ func GetConfigsByNetworkName(net string) (*NetworkConfig, *BeaconChainConfig, Ne
13621362
case networkname.Hoodi:
13631363
networkCfg, beaconCfg := GetConfigsByNetwork(chainspec.HoodiChainID)
13641364
return networkCfg, beaconCfg, chainspec.HoodiChainID, nil
1365+
case networkname.Bloatnet:
1366+
// Bloatnet uses mainnet CL config but on isolated network
1367+
networkCfg, beaconCfg := GetConfigsByNetwork(chainspec.MainnetChainID)
1368+
return networkCfg, beaconCfg, chainspec.MainnetChainID, nil
13651369
default:
13661370
return nil, nil, chainspec.MainnetChainID, errors.New("chain not found")
13671371
}

cmd/utils/flags.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1909,7 +1909,12 @@ func SetEthConfig(ctx *cli.Context, nodeConfig *nodecfg.Config, cfg *ethconfig.C
19091909
Fatalf("chain name is not recognized: %s", chain)
19101910
return
19111911
}
1912-
cfg.NetworkID = spec.Config.ChainID.Uint64()
1912+
// Use custom NetworkID from spec if set, otherwise use ChainID
1913+
if spec.NetworkID != 0 {
1914+
cfg.NetworkID = spec.NetworkID
1915+
} else {
1916+
cfg.NetworkID = spec.Config.ChainID.Uint64()
1917+
}
19131918
}
19141919

19151920
cfg.Dirs = nodeConfig.Dirs

db/snapcfg/util.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ var registry = &preverifiedRegistry{
6767
networkname.Gnosis: fromEmbeddedToml(snapshothashes.Gnosis),
6868
networkname.Chiado: fromEmbeddedToml(snapshothashes.Chiado),
6969
networkname.Hoodi: fromEmbeddedToml(snapshothashes.Hoodi),
70+
networkname.Bloatnet: fromEmbeddedToml(snapshothashes.Bloatnet),
7071
},
7172
cached: make(map[string]*Cfg),
7273
}
@@ -494,6 +495,7 @@ var KnownWebseeds = map[string][]string{
494495
networkname.Gnosis: webseedsParse(webseed.Gnosis),
495496
networkname.Chiado: webseedsParse(webseed.Chiado),
496497
networkname.Hoodi: webseedsParse(webseed.Hoodi),
498+
networkname.Bloatnet: webseedsParse(webseed.Bloatnet),
497499
}
498500

499501
func webseedsParse(in []byte) (res []string) {
@@ -544,6 +546,7 @@ func LoadRemotePreverified(ctx context.Context) (err error) {
544546
networkname.Gnosis: webseedsParse(webseed.Gnosis),
545547
networkname.Chiado: webseedsParse(webseed.Chiado),
546548
networkname.Hoodi: webseedsParse(webseed.Hoodi),
549+
networkname.Bloatnet: webseedsParse(webseed.Bloatnet),
547550
}
548551

549552
// Re-load the preverified hashes
@@ -555,6 +558,7 @@ func LoadRemotePreverified(ctx context.Context) (err error) {
555558
networkname.Gnosis: fromEmbeddedToml(snapshothashes.Gnosis),
556559
networkname.Chiado: fromEmbeddedToml(snapshothashes.Chiado),
557560
networkname.Hoodi: fromEmbeddedToml(snapshothashes.Hoodi),
561+
networkname.Bloatnet: fromEmbeddedToml(snapshothashes.Bloatnet),
558562
})
559563
return
560564
}
@@ -581,6 +585,8 @@ func GetToml(networkName string) []byte {
581585
return snapshothashes.Chiado
582586
case networkname.Hoodi:
583587
return snapshothashes.Hoodi
588+
case networkname.Bloatnet:
589+
return snapshothashes.Bloatnet
584590
default:
585591
return nil
586592
}

db/snaptype2/block_types.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ func init() {
4848
snapcfg.RegisterKnownTypes(networkname.Gnosis, ethereumTypes)
4949
snapcfg.RegisterKnownTypes(networkname.Chiado, ethereumTypes)
5050
snapcfg.RegisterKnownTypes(networkname.Hoodi, ethereumTypes)
51+
snapcfg.RegisterKnownTypes(networkname.Bloatnet, ethereumTypes)
5152
}
5253

5354
var Enums = struct {

execution/chain/networkname/network_name.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ const (
3434
BorE2ETestChain2Val = "bor-e2e-test-2Val"
3535
Chiado = "chiado"
3636
Test = "test"
37+
Bloatnet = "bloatnet"
3738
)
3839

3940
var All = []string{
@@ -47,6 +48,7 @@ var All = []string{
4748
Gnosis,
4849
Chiado,
4950
Test,
51+
Bloatnet,
5052
}
5153

5254
// Supported checks if the given network name is supported by Erigon.

execution/chain/spec/bootnodes.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,17 @@ var mainnetBootnodes = []string{
3131
"enode://4aeb4ab6c14b23e2c4cfdce879c04b0748a20d8e9b59e25ded2a08143e265c6c25936e74cbc8e641e3312ca288673d91f2f93f8e277de3cfa444ecdaaf982052@157.90.35.166:30303", // bootnode-hetzner-fsn
3232
}
3333

34+
// bloatnetBootnodes are the enode URLs of the P2P bootstrap nodes running on
35+
// the bloatnet (perfdevnet-2) network.
36+
var bloatnetBootnodes = []string{
37+
// ethpandaops bootnodes
38+
"enode://22c1dd13d7738ae461740bbe1340733bdabe88c0682b5788bb308bb80f0d6281085196600416f187dc0f1d5d9613b1c2590e6e5b4003329a464910f613bd096a@157.180.14.229:30303",
39+
"enode://d220de2edb15e5170383435fa9e55d9e2997c9dd4c8a07f6414ca46ac178375eec0274cd2fbcb70967c8f46b1d5150b5cac54a33907a47d6d954a0fdc477e2ad@157.180.14.230:30303",
40+
"enode://3ba5f46aa1a9d863de4ce5ff67ec46704c43b2a1d5100e272dbfec5e56b350113018d3e67c400f09db60d4ec55df025bd209802c67826717a33a48acbe13b305@157.180.14.226:30303",
41+
"enode://6867a722d721cc444ae26f58d896844694264f7532b409f1d31797e77c5603728cc834b46b1e8f0d8dcd734e50280dc711cfab8c5fc5211430894c5fbcf0a86e@157.180.14.225:30303",
42+
"enode://d38286e50eea1bb75da0f89a65fa8236255d0e52b2980998c7d903be4c69e3477f9f0e54f6039c2308d8e3c41123f3d1aeee2ad4f2811ebd48557a3dc406a273@157.180.14.228:30303",
43+
}
44+
3445
// hoodiBootnodes are the enode URLs of the P2P bootstrap nodes running on the
3546
// Hoodi test network.
3647
var hoodiBootnodes = []string{
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
{
2+
"chainName": "bloatnet",
3+
"chainId": 1,
4+
"consensus": "ethash",
5+
"homesteadBlock": 1150000,
6+
"daoForkBlock": 1920000,
7+
"eip150Block": 2463000,
8+
"eip155Block": 2675000,
9+
"byzantiumBlock": 4370000,
10+
"constantinopleBlock": 7280000,
11+
"petersburgBlock": 7280000,
12+
"istanbulBlock": 9069000,
13+
"muirGlacierBlock": 9200000,
14+
"berlinBlock": 12244000,
15+
"londonBlock": 12965000,
16+
"arrowGlacierBlock": 13773000,
17+
"grayGlacierBlock": 15050000,
18+
"terminalTotalDifficulty": 58750000000000000000000,
19+
"terminalTotalDifficultyPassed": true,
20+
"mergeBlock": 15537394,
21+
"shanghaiTime": 1681338455,
22+
"cancunTime": 1710338135,
23+
"pragueTime": 1746612311,
24+
"blobSchedule": {
25+
"cancun": {
26+
"target": 3,
27+
"max": 6,
28+
"baseFeeUpdateFraction": 3338477
29+
},
30+
"prague": {
31+
"target": 6,
32+
"max": 9,
33+
"baseFeeUpdateFraction": 5007716
34+
}
35+
},
36+
"depositContractAddress": "0x00000000219ab540356cBB839Cbe05303d7705Fa",
37+
"ethash": {},
38+
"defaultBlockGasLimit": 60000000
39+
}

execution/chain/spec/config.go

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ func init() {
4141
RegisterChainSpec(networkname.Gnosis, Gnosis)
4242
RegisterChainSpec(networkname.Chiado, Chiado)
4343
RegisterChainSpec(networkname.Test, Test)
44+
RegisterChainSpec(networkname.Bloatnet, Bloatnet)
4445

4546
// verify registered chains
4647
for _, spec := range registeredChainsByName {
@@ -118,7 +119,13 @@ func ChainSpecByGenesisHash(genesisHash common.Hash) (Spec, error) {
118119
// If the name already exists, it will be overwritten.
119120
func RegisterChainSpec(name string, spec Spec) {
120121
registeredChainsByName[name] = spec
121-
NetworkNameByID[spec.Config.ChainID.Uint64()] = name
122+
123+
// Use custom NetworkID if specified, otherwise use ChainID
124+
networkID := spec.NetworkID
125+
if networkID == 0 {
126+
networkID = spec.Config.ChainID.Uint64()
127+
}
128+
NetworkNameByID[networkID] = name
122129

123130
if spec.GenesisHash != (common.Hash{}) {
124131
registeredChainsByGenesisHash[spec.GenesisHash] = spec
@@ -133,6 +140,7 @@ type Spec struct {
133140
Config *chain.Config
134141
Bootnodes []string // list of bootnodes for the chain, if any
135142
DNSNetwork string // address of a public DNS-based node list. See https://github.com/ethereum/discv4-dns-lists for more information.
143+
NetworkID uint64 // Optional custom network ID (defaults to ChainID if 0)
136144
}
137145

138146
func (cs Spec) IsEmpty() bool {
@@ -204,6 +212,16 @@ var (
204212
//Bootnodes: TestBootnodes,
205213
Genesis: TestGenesisBlock(),
206214
}
215+
216+
Bloatnet = Spec{
217+
Name: networkname.Bloatnet,
218+
GenesisHash: common.HexToHash("0xd4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3"), // Same as mainnet
219+
Bootnodes: bloatnetBootnodes,
220+
Config: ReadChainConfig(chainspecs, "chainspecs/bloatnet.json"),
221+
Genesis: BloatnetGenesisBlock(),
222+
DNSNetwork: "", // No DNS discovery
223+
NetworkID: 12159,
224+
}
207225
)
208226

209227
var chainNamesPoS = []string{

execution/chain/spec/genesis.go

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,12 @@ func ReadPrealloc(fileSys fs.FS, filename string) types.GenesisAlloc {
5656
var (
5757
// to preserve same pointer in genesis.Config and Spec.Config, init once and reuse configs
5858

59-
mainnetChainConfig = ReadChainConfig(chainspecs, "chainspecs/mainnet.json")
60-
sepoliaChainConfig = ReadChainConfig(chainspecs, "chainspecs/sepolia.json")
61-
hoodiChainConfig = ReadChainConfig(chainspecs, "chainspecs/hoodi.json")
62-
gnosisChainConfig = ReadChainConfig(chainspecs, "chainspecs/gnosis.json")
63-
chiadoChainConfig = ReadChainConfig(chainspecs, "chainspecs/chiado.json")
59+
mainnetChainConfig = ReadChainConfig(chainspecs, "chainspecs/mainnet.json")
60+
sepoliaChainConfig = ReadChainConfig(chainspecs, "chainspecs/sepolia.json")
61+
hoodiChainConfig = ReadChainConfig(chainspecs, "chainspecs/hoodi.json")
62+
gnosisChainConfig = ReadChainConfig(chainspecs, "chainspecs/gnosis.json")
63+
chiadoChainConfig = ReadChainConfig(chainspecs, "chainspecs/chiado.json")
64+
bloatnetChainConfig = ReadChainConfig(chainspecs, "chainspecs/bloatnet.json")
6465
)
6566

6667
// MainnetGenesisBlock returns the Ethereum main net genesis block.
@@ -75,6 +76,18 @@ func MainnetGenesisBlock() *types.Genesis {
7576
}
7677
}
7778

79+
// BloatnetGenesisBlock returns the bloatnet genesis block (identical to mainnet).
80+
func BloatnetGenesisBlock() *types.Genesis {
81+
return &types.Genesis{
82+
Config: bloatnetChainConfig,
83+
Nonce: 66,
84+
ExtraData: hexutil.MustDecode("0x11bbe8db4e347b4e8c937c1c8370e4b5ed33adb3db69cbdb7a38e1e50b1b82fa"),
85+
GasLimit: 5000,
86+
Difficulty: big.NewInt(17179869184),
87+
Alloc: ReadPrealloc(allocs, "allocs/mainnet.json"),
88+
}
89+
}
90+
7891
// SepoliaGenesisBlock returns the Sepolia network genesis block.
7992
func SepoliaGenesisBlock() *types.Genesis {
8093
return &types.Genesis{

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ replace github.com/holiman/bloomfilter/v2 => github.com/AskAlexSharov/bloomfilte
77
replace github.com/holiman/uint256 => github.com/erigontech/uint256 v0.0.0-20260128213548-c9ef4c05bfe3
88

99
require (
10-
github.com/erigontech/erigon-snapshot v1.3.1-0.20260105114333-2f59a10db72b
10+
github.com/erigontech/erigon-snapshot v1.3.1-0.20260210221902-e495954c7e78
1111
github.com/erigontech/erigonwatch v0.0.0-20240718131902-b6576bde1116
1212
github.com/erigontech/mdbx-go v0.39.12
1313
github.com/erigontech/secp256k1 v1.2.0

0 commit comments

Comments
 (0)