erigon-pulse/params/config.go

313 lines
11 KiB
Go
Raw Normal View History

// Copyright 2016 The go-ethereum Authors
// This file is part of the go-ethereum library.
//
// The go-ethereum library is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// The go-ethereum library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
package params
import (
"embed"
"encoding/json"
"fmt"
"math/big"
"path"
"github.com/ledgerwatch/erigon-lib/chain"
"github.com/ledgerwatch/erigon-lib/chain/networkname"
libcommon "github.com/ledgerwatch/erigon-lib/common"
"github.com/ledgerwatch/erigon/common/paths"
)
//go:embed chainspecs
var chainspecs embed.FS
func readChainSpec(filename string) *chain.Config {
f, err := chainspecs.Open(filename)
if err != nil {
panic(fmt.Sprintf("Could not open chainspec for %s: %v", filename, err))
}
defer f.Close()
decoder := json.NewDecoder(f)
spec := &chain.Config{}
err = decoder.Decode(&spec)
if err != nil {
panic(fmt.Sprintf("Could not parse chainspec for %s: %v", filename, err))
}
return spec
}
// Genesis hashes to enforce below configs on.
var (
MainnetGenesisHash = libcommon.HexToHash("0xd4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3")
2023-09-18 22:36:13 +00:00
HoleskyGenesisHash = libcommon.HexToHash("0xb5f7f912443c940f21fd611f12828d75b534364ed9e95ca4e307729a4661bde4")
SepoliaGenesisHash = libcommon.HexToHash("0x25a5cc106eea7138acab33231d7160d69cb777ee0c2c553fcddf5138993e6dd9")
GoerliGenesisHash = libcommon.HexToHash("0xbf7e331f7f7c1dd2e05159666b3bf8bc7a8a3a9eb1d518969eab529dd9b88c1a")
MumbaiGenesisHash = libcommon.HexToHash("0x7b66506a9ebdbf30d32b43c5f15a3b1216269a1ec3a75aa3182b86176a2b1ca7")
BorMainnetGenesisHash = libcommon.HexToHash("0xa9c28ce2141b56c474f1dc504bee9b01eb1bd7d1a507580d5519d4437a97de1b")
BorDevnetGenesisHash = libcommon.HexToHash("0x5a06b25b0c6530708ea0b98a3409290e39dce6be7f558493aeb6e4b99a172a87")
GnosisGenesisHash = libcommon.HexToHash("0x4f1dd23188aab3a76b463e4af801b52b1248ef073c648cbdc4c9333d3da79756")
ChiadoGenesisHash = libcommon.HexToHash("0xada44fd8d2ecab8b08f256af07ad3e777f17fb434f8f8e678b312f576212ba9a")
)
var (
GnosisGenesisStateRoot = libcommon.HexToHash("0x40cf4430ecaa733787d1a65154a3b9efb560c95d9e324a23b97f0609b539133b")
ChiadoGenesisStateRoot = libcommon.HexToHash("0x9ec3eaf4e6188dfbdd6ade76eaa88289b57c63c9a2cde8d35291d5a29e143d31")
)
var (
// MainnetChainConfig is the chain parameters to run a node on the main network.
MainnetChainConfig = readChainSpec("chainspecs/mainnet.json")
2023-08-26 10:31:29 +00:00
// HoleskyChainConfi contains the chain parameters to run a node on the Holesky test network.
HoleskyChainConfig = readChainSpec("chainspecs/holesky.json")
// SepoliaChainConfig contains the chain parameters to run a node on the Sepolia test network.
SepoliaChainConfig = readChainSpec("chainspecs/sepolia.json")
2022-05-13 20:22:48 +00:00
// GoerliChainConfig contains the chain parameters to run a node on the Görli test network.
GoerliChainConfig = readChainSpec("chainspecs/goerli.json")
// AllProtocolChanges contains every protocol change (EIPs) introduced
// and accepted by the Ethereum core developers into the main net protocol.
AllProtocolChanges = &chain.Config{
ChainID: big.NewInt(1337),
Consensus: chain.EtHashConsensus,
HomesteadBlock: big.NewInt(0),
TangerineWhistleBlock: big.NewInt(0),
SpuriousDragonBlock: big.NewInt(0),
ByzantiumBlock: big.NewInt(0),
ConstantinopleBlock: big.NewInt(0),
PetersburgBlock: big.NewInt(0),
IstanbulBlock: big.NewInt(0),
MuirGlacierBlock: big.NewInt(0),
BerlinBlock: big.NewInt(0),
LondonBlock: big.NewInt(0),
ArrowGlacierBlock: big.NewInt(0),
GrayGlacierBlock: big.NewInt(0),
TerminalTotalDifficulty: big.NewInt(0),
TerminalTotalDifficultyPassed: true,
ShanghaiTime: big.NewInt(0),
CancunTime: big.NewInt(0),
Ethash: new(chain.EthashConfig),
}
// AllCliqueProtocolChanges contains every protocol change (EIPs) introduced
// and accepted by the Ethereum core developers into the Clique consensus.
AllCliqueProtocolChanges = &chain.Config{
ChainID: big.NewInt(1337),
Consensus: chain.CliqueConsensus,
HomesteadBlock: big.NewInt(0),
TangerineWhistleBlock: big.NewInt(0),
SpuriousDragonBlock: big.NewInt(0),
ByzantiumBlock: big.NewInt(0),
ConstantinopleBlock: big.NewInt(0),
PetersburgBlock: big.NewInt(0),
IstanbulBlock: big.NewInt(0),
MuirGlacierBlock: big.NewInt(0),
BerlinBlock: big.NewInt(0),
LondonBlock: big.NewInt(0),
Clique: &chain.CliqueConfig{Period: 0, Epoch: 30000},
}
MumbaiChainConfig = readChainSpec("chainspecs/mumbai.json")
Merging Turbo bor into devel (#3372) * implemented bor consensus * add bor flags to default * change bucket into snapshot to clique * enable stateSync * bypass reciept checks * fix receipt calculation and bor logs * fix: contract call wrt bor * Update mumbai config * Add: bor-mainnet flag and config * Add bor consensus to integration * use header coinbase in block context * london fork mumbai changes * fix genesis error * Jaipur fork for mumbai * add sysCall to verifyHeader * added bor related rpc method implementation * added bor specific rpc extensions * fixes in snapshot implementation, major refactor for bor rpc * modify consensus specific db path for bor * fix: remove parallel compute for get root hash rpc method * Added bor-receipt flow * Use turbo-bor-lib and bor tables * Use bor table in RPC snapshot * Update README.md * Update README.md * Update README.md * Update README.md * update rpc readme * link rpc docs in readme * Update Readme * Update Readme * move erigon namespace rpc methods to eth * rm: erigon namespace * rm: erigon namespace, update list of available rpc methods, add example * fix: binary name in rpc readme * fix: max db size * Add london to bor-mainnet * updated node.go * add system req to readme * golang version fix readme * added networknames in correct place * nil * ran gofmt * erigon * fixed fake.go * dont need turbor-lib * old readme * fixing readme * half * other half * changed return * fixing return * fixed return * fixed flags * gofmt * merge with devel * latest erigon-lib * fixed context.coinbase * took out syscall * fixed params in hash * bor type now is consensus.Engine * parlia is consensus.Engine * missing arg and repeated importation * repeated importation * fixed eth_receipts.go * deleted duplicate issuance * part of consensus.Engine type * added eth_api issuance * networkname * added erigon_system file * fork struct taken out * added erigon block * getLogByHash for erigonImpl * gofmt * fixed lint * ops * gofmt * gofmt * added APIImple functions * fixed clique test * took out print * fixed state added balance * fixed README * fixed rpcDaemon README * fixed integration README * updated blockchain.go * lint * added bor back into blockchain.go * took out comment * lint * updated daemon * updated wtb * removed duplicate * removed VerifyHeaders * prevent use of wrong Transfer * fixed state_processor.go * fixed state_transition.go * fixed headers * returning err * error handling in bor read tx look up * put for txLookUp * dealing with error * lint * traces * more traces * fixed receipt in execution * getTrasanction receipt for bor or others * nil * lint * ops * deleted syscall * took out else * Merge branch 'devel * tests syscalls * changed borReceipt to receipt * reset header algos * arguments fix * took out prefixes * lint * erigon-named * borReceiptKey = blocknumber * reverts e3b60c2e159d03efcb855f7ab3da5a098dd60c33. * correct hashing tx * dont need it here * lint * added txlookup for bor * change to uint256 * outputs for isBor * wrapper * added isBor and isParlia * isBor * fixed BorTransfer * not readBody * correct prefix * added blockNum * added readStorageBody * readStorageBody * lint * got rid of unnecessary bor_receipt func * onlny if bor * use clone * append * writeToSlice * added isBor flag * fixed writeToSlice * normal sorting * lint * Reset erigon-snapshots * Move bor prefix into if Co-authored-by: Krishna Upadhyaya <krishnau1604@gmail.com> Co-authored-by: Manav Darji <manavdarji.india@gmail.com> Co-authored-by: Uttam Singh <uttamkhanduja@yahoo.in> Co-authored-by: Giulio Rebuffo <giulio.rebuffo@gmail.com> Co-authored-by: Alex Sharp <alexsharp@Alexs-MacBook-Pro.local>
2022-02-07 21:30:46 +00:00
BorMainnetChainConfig = readChainSpec("chainspecs/bor-mainnet.json")
Merging Turbo bor into devel (#3372) * implemented bor consensus * add bor flags to default * change bucket into snapshot to clique * enable stateSync * bypass reciept checks * fix receipt calculation and bor logs * fix: contract call wrt bor * Update mumbai config * Add: bor-mainnet flag and config * Add bor consensus to integration * use header coinbase in block context * london fork mumbai changes * fix genesis error * Jaipur fork for mumbai * add sysCall to verifyHeader * added bor related rpc method implementation * added bor specific rpc extensions * fixes in snapshot implementation, major refactor for bor rpc * modify consensus specific db path for bor * fix: remove parallel compute for get root hash rpc method * Added bor-receipt flow * Use turbo-bor-lib and bor tables * Use bor table in RPC snapshot * Update README.md * Update README.md * Update README.md * Update README.md * update rpc readme * link rpc docs in readme * Update Readme * Update Readme * move erigon namespace rpc methods to eth * rm: erigon namespace * rm: erigon namespace, update list of available rpc methods, add example * fix: binary name in rpc readme * fix: max db size * Add london to bor-mainnet * updated node.go * add system req to readme * golang version fix readme * added networknames in correct place * nil * ran gofmt * erigon * fixed fake.go * dont need turbor-lib * old readme * fixing readme * half * other half * changed return * fixing return * fixed return * fixed flags * gofmt * merge with devel * latest erigon-lib * fixed context.coinbase * took out syscall * fixed params in hash * bor type now is consensus.Engine * parlia is consensus.Engine * missing arg and repeated importation * repeated importation * fixed eth_receipts.go * deleted duplicate issuance * part of consensus.Engine type * added eth_api issuance * networkname * added erigon_system file * fork struct taken out * added erigon block * getLogByHash for erigonImpl * gofmt * fixed lint * ops * gofmt * gofmt * added APIImple functions * fixed clique test * took out print * fixed state added balance * fixed README * fixed rpcDaemon README * fixed integration README * updated blockchain.go * lint * added bor back into blockchain.go * took out comment * lint * updated daemon * updated wtb * removed duplicate * removed VerifyHeaders * prevent use of wrong Transfer * fixed state_processor.go * fixed state_transition.go * fixed headers * returning err * error handling in bor read tx look up * put for txLookUp * dealing with error * lint * traces * more traces * fixed receipt in execution * getTrasanction receipt for bor or others * nil * lint * ops * deleted syscall * took out else * Merge branch 'devel * tests syscalls * changed borReceipt to receipt * reset header algos * arguments fix * took out prefixes * lint * erigon-named * borReceiptKey = blocknumber * reverts e3b60c2e159d03efcb855f7ab3da5a098dd60c33. * correct hashing tx * dont need it here * lint * added txlookup for bor * change to uint256 * outputs for isBor * wrapper * added isBor and isParlia * isBor * fixed BorTransfer * not readBody * correct prefix * added blockNum * added readStorageBody * readStorageBody * lint * got rid of unnecessary bor_receipt func * onlny if bor * use clone * append * writeToSlice * added isBor flag * fixed writeToSlice * normal sorting * lint * Reset erigon-snapshots * Move bor prefix into if Co-authored-by: Krishna Upadhyaya <krishnau1604@gmail.com> Co-authored-by: Manav Darji <manavdarji.india@gmail.com> Co-authored-by: Uttam Singh <uttamkhanduja@yahoo.in> Co-authored-by: Giulio Rebuffo <giulio.rebuffo@gmail.com> Co-authored-by: Alex Sharp <alexsharp@Alexs-MacBook-Pro.local>
2022-02-07 21:30:46 +00:00
BorDevnetChainConfig = readChainSpec("chainspecs/bor-devnet.json")
GnosisChainConfig = readChainSpec("chainspecs/gnosis.json")
feat: add chiado config (#6058) Hey guys, I'm trying to add the Chiado network ([Gnosis' testnet](https://docs.gnosischain.com/about/networks/chiado)) now that Gnosis can be synced fully with Erigon, so we can test it on the testnet as well. This is mostly inspired from https://github.com/ledgerwatch/erigon/commit/cd5ef32f379ff51043b7ce1b0c3c471e18b99459. Probably missing: - [ ] The right consensus config (currently only a copy of Gnosis) - [ ] Fixes to the chainspec? - [ ] Presumably something in `cl/clparams/config.go` Current state: ``` $ ./build/bin/erigon --chain=chiado --log.console.verbosity=debug WARN[11-16|11:52:28.188] no log dir set, console logging only WARN[11-16|11:52:28.193] no log dir set, console logging only INFO[11-16|11:52:28.193] Build info git_branch=feat/chiado git_tag=v2021.10.03-2291-g17fae73f8 git_commit=17fae73f8af5348ba7c04684f2a2978daf81b67e INFO[11-16|11:52:28.193] Starting Erigon on devnet=chiado INFO[11-16|11:52:28.194] Maximum peer count ETH=100 total=100 INFO[11-16|11:52:28.194] starting HTTP APIs APIs=eth,erigon,engine INFO[11-16|11:52:28.194] torrent verbosity level=WRN INFO[11-16|11:52:30.300] Set global gas cap cap=50000000 INFO[11-16|11:52:30.302] Opening Database label=chaindata path=/home/filoozom/.local/share/erigon/chiado/chaindata INFO[11-16|11:52:30.310] Initialised chain configuration config="{ChainID: 10200, Homestead: 0, DAO: <nil>, DAO Support: false, Tangerine Whistle: 0, Spurious Dragon: 0, Byzantium: 0, Constantinople: 0, Petersburg: 0, Istanbul: 0, Muir Glacier: <nil>, Berlin: 0, London: 0, Arrow Glacier: <nil>, Gray Glacier: <nil>, Terminal Total Difficulty: <nil>, Merge Netsplit: <nil>, Shanghai: <nil>, Cancun: <nil>, Engine: aura}" genesis=0xf463abeb7ee27fa62be3ac36a264e8174ee3458da451e6403df47618fd2cf415 WARN[11-16|11:52:30.311] Incorrect snapshot enablement got=true change_to=false INFO[11-16|11:52:30.311] Effective prune_flags= snapshot_flags= history.v3=false INFO[11-16|11:52:30.312] Initialising Ethereum protocol network=10200 INFO[11-16|11:52:30.329] Starting private RPC server on=127.0.0.1:9090 INFO[11-16|11:52:30.329] new subscription to logs established INFO[11-16|11:52:30.329] rpc filters: subscribing to Erigon events DBUG[11-16|11:52:30.330] Establishing event subscription channel with the RPC daemon ... INFO[11-16|11:52:30.330] New txs subscriber joined INFO[11-16|11:52:30.330] new subscription to newHeaders established INFO[11-16|11:52:30.330] Reading JWT secret path=/home/filoozom/.local/share/erigon/chiado/jwt.hex INFO[11-16|11:52:30.331] HTTP endpoint opened for Engine API url=localhost:8551 ws=true ws.compression=true INFO[11-16|11:52:30.332] HTTP endpoint opened url=localhost:8545 ws=false ws.compression=true grpc=false DBUG[11-16|11:52:30.336] Couldn't add port mapping proto=tcp extport=30304 intport=30304 interface="UPnP or NAT-PMP" err="no UPnP or NAT-PMP router discovered" DBUG[11-16|11:52:30.336] Couldn't add port mapping proto=udp extport=30304 intport=30304 interface="UPnP or NAT-PMP" err="no UPnP or NAT-PMP router discovered" DBUG[11-16|11:52:30.336] QuerySeeds read nodes from the node DB count=0 DBUG[11-16|11:52:30.341] [1/16 Snapshots] DONE in=134.7µs INFO[11-16|11:52:30.341] [txpool] Started INFO[11-16|11:52:30.341] [2/16 Headers] Waiting for headers... from=0 DBUG[11-16|11:52:30.341] [Downloader] Request skeleton anchors=0 top seen height=0 highestInDb=0 DBUG[11-16|11:52:30.343] Couldn't add port mapping proto=tcp extport=30303 intport=30303 interface="UPnP or NAT-PMP" err="no UPnP or NAT-PMP router discovered" DBUG[11-16|11:52:30.343] Couldn't add port mapping proto=udp extport=30303 intport=30303 interface="UPnP or NAT-PMP" err="no UPnP or NAT-PMP router discovered" DBUG[11-16|11:52:30.344] QuerySeeds read nodes from the node DB count=0 DBUG[11-16|11:52:30.346] QuerySeeds read nodes from the node DB count=0 INFO[11-16|11:52:30.347] Started P2P networking version=67 self=enode://47d2e31d90fe140bfd967f147c1d4e8a4834b4c6b895a4bb7082100be60aa5e9a73e98e996da9b0257f02f9ad39b683755abe6ca3e9aefe0170a478a8559dcfb@127.0.0.1:30304 name=erigon/v2.30.0-dev-17fae73f/linux-amd64/go1.18.1 DBUG[11-16|11:52:30.351] QuerySeeds read nodes from the node DB count=0 INFO[11-16|11:52:30.351] Started P2P networking version=66 self=enode://47d2e31d90fe140bfd967f147c1d4e8a4834b4c6b895a4bb7082100be60aa5e9a73e98e996da9b0257f02f9ad39b683755abe6ca3e9aefe0170a478a8559dcfb@127.0.0.1:30303 name=erigon/v2.30.0-dev-17fae73f/linux-amd64/go1.18.1 DBUG[11-16|11:52:31.342] [Downloader] Request skeleton anchors=0 top seen height=0 highestInDb=0 [...] DBUG[11-16|11:52:32.342] [Downloader] Request skeleton anchors=0 top seen height=0 highestInDb=0 INFO[11-16|11:37:00.062] [p2p] GoodPeers eth66=0 eth67=0 INFO[11-16|11:37:00.077] [txpool] stat block=0 pending=0 baseFee=0 queued=0 alloc=42.7MB sys=79.5MB INFO[11-16|11:37:00.089] [2/16 Headers] No block headers to write in this log period block number=0 INFO[11-16|11:37:00.089] Req/resp stats req=0 reqMin=0 reqMax=0 skel=0 skelMin=0 skelMax=0 resp=0 respMin=0 respMax=0 dups=0 DBUG[11-16|11:37:00.089] [Downloader] Queue sizes anchors=0 links=0 persisted=1 DBUG[11-16|11:37:00.089] [Downloader] Request skeleton anchors=0 top seen height=0 highestInDb=0 [...] DBUG[11-16|11:37:06.095] [Downloader] Request skeleton anchors=0 top seen height=0 highestInDb=0 ``` I guess it comes down to: ``` --- FAIL: TestDefaultBSCGenesisBlock (0.34s) genesis_test.go:27: Error Trace: /home/filoozom/projects/erigon/core/genesis_test.go:27 /home/filoozom/projects/erigon/core/genesis_test.go:30 Error: Not equal: expected: []byte{0xe8, 0x72, 0x46, 0x2c, 0x6b, 0xd5, 0xf4, 0x2, 0xec, 0x81, 0xde, 0x7c, 0x5b, 0xd2, 0x82, 0x3e, 0x13, 0x7c, 0x66, 0x6b, 0x78, 0xe8, 0x2b, 0x7e, 0xb0, 0xbe, 0x95, 0xaf, 0x5e, 0xce, 0xa1, 0x8d} actual : []byte{0xad, 0xa4, 0x4f, 0xd8, 0xd2, 0xec, 0xab, 0x8b, 0x8, 0xf2, 0x56, 0xaf, 0x7, 0xad, 0x3e, 0x77, 0x7f, 0x17, 0xfb, 0x43, 0x4f, 0x8f, 0x8e, 0x67, 0x8b, 0x31, 0x2f, 0x57, 0x62, 0x12, 0xba, 0x9a} Diff: --- Expected +++ Actual @@ -1,4 +1,4 @@ ([]uint8) (len=32) { - 00000000 e8 72 46 2c 6b d5 f4 02 ec 81 de 7c 5b d2 82 3e |.rF,k......|[..>| - 00000010 13 7c 66 6b 78 e8 2b 7e b0 be 95 af 5e ce a1 8d |.|fkx.+~....^...| + 00000000 ad a4 4f d8 d2 ec ab 8b 08 f2 56 af 07 ad 3e 77 |..O.......V...>w| + 00000010 7f 17 fb 43 4f 8f 8e 67 8b 31 2f 57 62 12 ba 9a |...CO..g.1/Wb...| } Test: TestDefaultBSCGenesisBlock Messages: chiado FAIL FAIL github.com/ledgerwatch/erigon/core 0.823s ``` ---------- Turns out that the `code` in Erigon's chainspec is not the same as `constructor` in Nethermind for example. Comparison for Sokol: - Erigon: https://github.com/ledgerwatch/erigon/blob/devel/core/allocs/sokol.json#L20-L34 - Nethermind: https://github.com/NethermindEth/nethermind/blob/master/src/Nethermind/Chains/sokol.json#L248-L252
2022-11-18 11:54:18 +00:00
ChiadoChainConfig = readChainSpec("chainspecs/chiado.json")
2021-06-16 10:57:58 +00:00
CliqueSnapshot = NewSnapshotConfig(10, 1024, 16384, true, "")
TestChainConfig = &chain.Config{
ChainID: big.NewInt(1337),
Consensus: chain.EtHashConsensus,
HomesteadBlock: big.NewInt(0),
TangerineWhistleBlock: big.NewInt(0),
SpuriousDragonBlock: big.NewInt(0),
ByzantiumBlock: big.NewInt(0),
ConstantinopleBlock: big.NewInt(0),
PetersburgBlock: big.NewInt(0),
IstanbulBlock: big.NewInt(0),
MuirGlacierBlock: big.NewInt(0),
BerlinBlock: big.NewInt(0),
Ethash: new(chain.EthashConfig),
}
TestChainAuraConfig = &chain.Config{
ChainID: big.NewInt(1),
Consensus: chain.AuRaConsensus,
HomesteadBlock: big.NewInt(0),
TangerineWhistleBlock: big.NewInt(0),
SpuriousDragonBlock: big.NewInt(0),
ByzantiumBlock: big.NewInt(0),
ConstantinopleBlock: big.NewInt(0),
PetersburgBlock: big.NewInt(0),
IstanbulBlock: big.NewInt(0),
MuirGlacierBlock: big.NewInt(0),
BerlinBlock: big.NewInt(0),
LondonBlock: big.NewInt(0),
Aura: &chain.AuRaConfig{},
}
TestRules = TestChainConfig.Rules(0, 0)
)
type ConsensusSnapshotConfig struct {
CheckpointInterval uint64 // Number of blocks after which to save the vote snapshot to the database
InmemorySnapshots int // Number of recent vote snapshots to keep in memory
InmemorySignatures int // Number of recent block signatures to keep in memory
DBPath string
InMemory bool
}
const cliquePath = "clique"
func NewSnapshotConfig(checkpointInterval uint64, inmemorySnapshots int, inmemorySignatures int, inmemory bool, dbPath string) *ConsensusSnapshotConfig {
if len(dbPath) == 0 {
dbPath = paths.DefaultDataDir()
}
return &ConsensusSnapshotConfig{
checkpointInterval,
inmemorySnapshots,
inmemorySignatures,
path.Join(dbPath, cliquePath),
inmemory,
}
}
func ChainConfigByChainName(chain string) *chain.Config {
switch chain {
case networkname.MainnetChainName:
return MainnetChainConfig
case networkname.DevChainName:
return AllCliqueProtocolChanges
2023-08-26 10:31:29 +00:00
case networkname.HoleskyChainName:
return HoleskyChainConfig
case networkname.SepoliaChainName:
return SepoliaChainConfig
case networkname.GoerliChainName:
return GoerliChainConfig
case networkname.MumbaiChainName:
return MumbaiChainConfig
case networkname.BorMainnetChainName:
return BorMainnetChainConfig
case networkname.BorDevnetChainName:
return BorDevnetChainConfig
case networkname.GnosisChainName:
return GnosisChainConfig
feat: add chiado config (#6058) Hey guys, I'm trying to add the Chiado network ([Gnosis' testnet](https://docs.gnosischain.com/about/networks/chiado)) now that Gnosis can be synced fully with Erigon, so we can test it on the testnet as well. This is mostly inspired from https://github.com/ledgerwatch/erigon/commit/cd5ef32f379ff51043b7ce1b0c3c471e18b99459. Probably missing: - [ ] The right consensus config (currently only a copy of Gnosis) - [ ] Fixes to the chainspec? - [ ] Presumably something in `cl/clparams/config.go` Current state: ``` $ ./build/bin/erigon --chain=chiado --log.console.verbosity=debug WARN[11-16|11:52:28.188] no log dir set, console logging only WARN[11-16|11:52:28.193] no log dir set, console logging only INFO[11-16|11:52:28.193] Build info git_branch=feat/chiado git_tag=v2021.10.03-2291-g17fae73f8 git_commit=17fae73f8af5348ba7c04684f2a2978daf81b67e INFO[11-16|11:52:28.193] Starting Erigon on devnet=chiado INFO[11-16|11:52:28.194] Maximum peer count ETH=100 total=100 INFO[11-16|11:52:28.194] starting HTTP APIs APIs=eth,erigon,engine INFO[11-16|11:52:28.194] torrent verbosity level=WRN INFO[11-16|11:52:30.300] Set global gas cap cap=50000000 INFO[11-16|11:52:30.302] Opening Database label=chaindata path=/home/filoozom/.local/share/erigon/chiado/chaindata INFO[11-16|11:52:30.310] Initialised chain configuration config="{ChainID: 10200, Homestead: 0, DAO: <nil>, DAO Support: false, Tangerine Whistle: 0, Spurious Dragon: 0, Byzantium: 0, Constantinople: 0, Petersburg: 0, Istanbul: 0, Muir Glacier: <nil>, Berlin: 0, London: 0, Arrow Glacier: <nil>, Gray Glacier: <nil>, Terminal Total Difficulty: <nil>, Merge Netsplit: <nil>, Shanghai: <nil>, Cancun: <nil>, Engine: aura}" genesis=0xf463abeb7ee27fa62be3ac36a264e8174ee3458da451e6403df47618fd2cf415 WARN[11-16|11:52:30.311] Incorrect snapshot enablement got=true change_to=false INFO[11-16|11:52:30.311] Effective prune_flags= snapshot_flags= history.v3=false INFO[11-16|11:52:30.312] Initialising Ethereum protocol network=10200 INFO[11-16|11:52:30.329] Starting private RPC server on=127.0.0.1:9090 INFO[11-16|11:52:30.329] new subscription to logs established INFO[11-16|11:52:30.329] rpc filters: subscribing to Erigon events DBUG[11-16|11:52:30.330] Establishing event subscription channel with the RPC daemon ... INFO[11-16|11:52:30.330] New txs subscriber joined INFO[11-16|11:52:30.330] new subscription to newHeaders established INFO[11-16|11:52:30.330] Reading JWT secret path=/home/filoozom/.local/share/erigon/chiado/jwt.hex INFO[11-16|11:52:30.331] HTTP endpoint opened for Engine API url=localhost:8551 ws=true ws.compression=true INFO[11-16|11:52:30.332] HTTP endpoint opened url=localhost:8545 ws=false ws.compression=true grpc=false DBUG[11-16|11:52:30.336] Couldn't add port mapping proto=tcp extport=30304 intport=30304 interface="UPnP or NAT-PMP" err="no UPnP or NAT-PMP router discovered" DBUG[11-16|11:52:30.336] Couldn't add port mapping proto=udp extport=30304 intport=30304 interface="UPnP or NAT-PMP" err="no UPnP or NAT-PMP router discovered" DBUG[11-16|11:52:30.336] QuerySeeds read nodes from the node DB count=0 DBUG[11-16|11:52:30.341] [1/16 Snapshots] DONE in=134.7µs INFO[11-16|11:52:30.341] [txpool] Started INFO[11-16|11:52:30.341] [2/16 Headers] Waiting for headers... from=0 DBUG[11-16|11:52:30.341] [Downloader] Request skeleton anchors=0 top seen height=0 highestInDb=0 DBUG[11-16|11:52:30.343] Couldn't add port mapping proto=tcp extport=30303 intport=30303 interface="UPnP or NAT-PMP" err="no UPnP or NAT-PMP router discovered" DBUG[11-16|11:52:30.343] Couldn't add port mapping proto=udp extport=30303 intport=30303 interface="UPnP or NAT-PMP" err="no UPnP or NAT-PMP router discovered" DBUG[11-16|11:52:30.344] QuerySeeds read nodes from the node DB count=0 DBUG[11-16|11:52:30.346] QuerySeeds read nodes from the node DB count=0 INFO[11-16|11:52:30.347] Started P2P networking version=67 self=enode://47d2e31d90fe140bfd967f147c1d4e8a4834b4c6b895a4bb7082100be60aa5e9a73e98e996da9b0257f02f9ad39b683755abe6ca3e9aefe0170a478a8559dcfb@127.0.0.1:30304 name=erigon/v2.30.0-dev-17fae73f/linux-amd64/go1.18.1 DBUG[11-16|11:52:30.351] QuerySeeds read nodes from the node DB count=0 INFO[11-16|11:52:30.351] Started P2P networking version=66 self=enode://47d2e31d90fe140bfd967f147c1d4e8a4834b4c6b895a4bb7082100be60aa5e9a73e98e996da9b0257f02f9ad39b683755abe6ca3e9aefe0170a478a8559dcfb@127.0.0.1:30303 name=erigon/v2.30.0-dev-17fae73f/linux-amd64/go1.18.1 DBUG[11-16|11:52:31.342] [Downloader] Request skeleton anchors=0 top seen height=0 highestInDb=0 [...] DBUG[11-16|11:52:32.342] [Downloader] Request skeleton anchors=0 top seen height=0 highestInDb=0 INFO[11-16|11:37:00.062] [p2p] GoodPeers eth66=0 eth67=0 INFO[11-16|11:37:00.077] [txpool] stat block=0 pending=0 baseFee=0 queued=0 alloc=42.7MB sys=79.5MB INFO[11-16|11:37:00.089] [2/16 Headers] No block headers to write in this log period block number=0 INFO[11-16|11:37:00.089] Req/resp stats req=0 reqMin=0 reqMax=0 skel=0 skelMin=0 skelMax=0 resp=0 respMin=0 respMax=0 dups=0 DBUG[11-16|11:37:00.089] [Downloader] Queue sizes anchors=0 links=0 persisted=1 DBUG[11-16|11:37:00.089] [Downloader] Request skeleton anchors=0 top seen height=0 highestInDb=0 [...] DBUG[11-16|11:37:06.095] [Downloader] Request skeleton anchors=0 top seen height=0 highestInDb=0 ``` I guess it comes down to: ``` --- FAIL: TestDefaultBSCGenesisBlock (0.34s) genesis_test.go:27: Error Trace: /home/filoozom/projects/erigon/core/genesis_test.go:27 /home/filoozom/projects/erigon/core/genesis_test.go:30 Error: Not equal: expected: []byte{0xe8, 0x72, 0x46, 0x2c, 0x6b, 0xd5, 0xf4, 0x2, 0xec, 0x81, 0xde, 0x7c, 0x5b, 0xd2, 0x82, 0x3e, 0x13, 0x7c, 0x66, 0x6b, 0x78, 0xe8, 0x2b, 0x7e, 0xb0, 0xbe, 0x95, 0xaf, 0x5e, 0xce, 0xa1, 0x8d} actual : []byte{0xad, 0xa4, 0x4f, 0xd8, 0xd2, 0xec, 0xab, 0x8b, 0x8, 0xf2, 0x56, 0xaf, 0x7, 0xad, 0x3e, 0x77, 0x7f, 0x17, 0xfb, 0x43, 0x4f, 0x8f, 0x8e, 0x67, 0x8b, 0x31, 0x2f, 0x57, 0x62, 0x12, 0xba, 0x9a} Diff: --- Expected +++ Actual @@ -1,4 +1,4 @@ ([]uint8) (len=32) { - 00000000 e8 72 46 2c 6b d5 f4 02 ec 81 de 7c 5b d2 82 3e |.rF,k......|[..>| - 00000010 13 7c 66 6b 78 e8 2b 7e b0 be 95 af 5e ce a1 8d |.|fkx.+~....^...| + 00000000 ad a4 4f d8 d2 ec ab 8b 08 f2 56 af 07 ad 3e 77 |..O.......V...>w| + 00000010 7f 17 fb 43 4f 8f 8e 67 8b 31 2f 57 62 12 ba 9a |...CO..g.1/Wb...| } Test: TestDefaultBSCGenesisBlock Messages: chiado FAIL FAIL github.com/ledgerwatch/erigon/core 0.823s ``` ---------- Turns out that the `code` in Erigon's chainspec is not the same as `constructor` in Nethermind for example. Comparison for Sokol: - Erigon: https://github.com/ledgerwatch/erigon/blob/devel/core/allocs/sokol.json#L20-L34 - Nethermind: https://github.com/NethermindEth/nethermind/blob/master/src/Nethermind/Chains/sokol.json#L248-L252
2022-11-18 11:54:18 +00:00
case networkname.ChiadoChainName:
return ChiadoChainConfig
default:
return nil
}
}
func GenesisHashByChainName(chain string) *libcommon.Hash {
switch chain {
case networkname.MainnetChainName:
return &MainnetGenesisHash
2023-08-26 10:31:29 +00:00
case networkname.HoleskyChainName:
return &HoleskyGenesisHash
case networkname.SepoliaChainName:
return &SepoliaGenesisHash
case networkname.GoerliChainName:
return &GoerliGenesisHash
case networkname.MumbaiChainName:
return &MumbaiGenesisHash
case networkname.BorMainnetChainName:
return &BorMainnetGenesisHash
case networkname.BorDevnetChainName:
return &BorDevnetGenesisHash
case networkname.GnosisChainName:
return &GnosisGenesisHash
feat: add chiado config (#6058) Hey guys, I'm trying to add the Chiado network ([Gnosis' testnet](https://docs.gnosischain.com/about/networks/chiado)) now that Gnosis can be synced fully with Erigon, so we can test it on the testnet as well. This is mostly inspired from https://github.com/ledgerwatch/erigon/commit/cd5ef32f379ff51043b7ce1b0c3c471e18b99459. Probably missing: - [ ] The right consensus config (currently only a copy of Gnosis) - [ ] Fixes to the chainspec? - [ ] Presumably something in `cl/clparams/config.go` Current state: ``` $ ./build/bin/erigon --chain=chiado --log.console.verbosity=debug WARN[11-16|11:52:28.188] no log dir set, console logging only WARN[11-16|11:52:28.193] no log dir set, console logging only INFO[11-16|11:52:28.193] Build info git_branch=feat/chiado git_tag=v2021.10.03-2291-g17fae73f8 git_commit=17fae73f8af5348ba7c04684f2a2978daf81b67e INFO[11-16|11:52:28.193] Starting Erigon on devnet=chiado INFO[11-16|11:52:28.194] Maximum peer count ETH=100 total=100 INFO[11-16|11:52:28.194] starting HTTP APIs APIs=eth,erigon,engine INFO[11-16|11:52:28.194] torrent verbosity level=WRN INFO[11-16|11:52:30.300] Set global gas cap cap=50000000 INFO[11-16|11:52:30.302] Opening Database label=chaindata path=/home/filoozom/.local/share/erigon/chiado/chaindata INFO[11-16|11:52:30.310] Initialised chain configuration config="{ChainID: 10200, Homestead: 0, DAO: <nil>, DAO Support: false, Tangerine Whistle: 0, Spurious Dragon: 0, Byzantium: 0, Constantinople: 0, Petersburg: 0, Istanbul: 0, Muir Glacier: <nil>, Berlin: 0, London: 0, Arrow Glacier: <nil>, Gray Glacier: <nil>, Terminal Total Difficulty: <nil>, Merge Netsplit: <nil>, Shanghai: <nil>, Cancun: <nil>, Engine: aura}" genesis=0xf463abeb7ee27fa62be3ac36a264e8174ee3458da451e6403df47618fd2cf415 WARN[11-16|11:52:30.311] Incorrect snapshot enablement got=true change_to=false INFO[11-16|11:52:30.311] Effective prune_flags= snapshot_flags= history.v3=false INFO[11-16|11:52:30.312] Initialising Ethereum protocol network=10200 INFO[11-16|11:52:30.329] Starting private RPC server on=127.0.0.1:9090 INFO[11-16|11:52:30.329] new subscription to logs established INFO[11-16|11:52:30.329] rpc filters: subscribing to Erigon events DBUG[11-16|11:52:30.330] Establishing event subscription channel with the RPC daemon ... INFO[11-16|11:52:30.330] New txs subscriber joined INFO[11-16|11:52:30.330] new subscription to newHeaders established INFO[11-16|11:52:30.330] Reading JWT secret path=/home/filoozom/.local/share/erigon/chiado/jwt.hex INFO[11-16|11:52:30.331] HTTP endpoint opened for Engine API url=localhost:8551 ws=true ws.compression=true INFO[11-16|11:52:30.332] HTTP endpoint opened url=localhost:8545 ws=false ws.compression=true grpc=false DBUG[11-16|11:52:30.336] Couldn't add port mapping proto=tcp extport=30304 intport=30304 interface="UPnP or NAT-PMP" err="no UPnP or NAT-PMP router discovered" DBUG[11-16|11:52:30.336] Couldn't add port mapping proto=udp extport=30304 intport=30304 interface="UPnP or NAT-PMP" err="no UPnP or NAT-PMP router discovered" DBUG[11-16|11:52:30.336] QuerySeeds read nodes from the node DB count=0 DBUG[11-16|11:52:30.341] [1/16 Snapshots] DONE in=134.7µs INFO[11-16|11:52:30.341] [txpool] Started INFO[11-16|11:52:30.341] [2/16 Headers] Waiting for headers... from=0 DBUG[11-16|11:52:30.341] [Downloader] Request skeleton anchors=0 top seen height=0 highestInDb=0 DBUG[11-16|11:52:30.343] Couldn't add port mapping proto=tcp extport=30303 intport=30303 interface="UPnP or NAT-PMP" err="no UPnP or NAT-PMP router discovered" DBUG[11-16|11:52:30.343] Couldn't add port mapping proto=udp extport=30303 intport=30303 interface="UPnP or NAT-PMP" err="no UPnP or NAT-PMP router discovered" DBUG[11-16|11:52:30.344] QuerySeeds read nodes from the node DB count=0 DBUG[11-16|11:52:30.346] QuerySeeds read nodes from the node DB count=0 INFO[11-16|11:52:30.347] Started P2P networking version=67 self=enode://47d2e31d90fe140bfd967f147c1d4e8a4834b4c6b895a4bb7082100be60aa5e9a73e98e996da9b0257f02f9ad39b683755abe6ca3e9aefe0170a478a8559dcfb@127.0.0.1:30304 name=erigon/v2.30.0-dev-17fae73f/linux-amd64/go1.18.1 DBUG[11-16|11:52:30.351] QuerySeeds read nodes from the node DB count=0 INFO[11-16|11:52:30.351] Started P2P networking version=66 self=enode://47d2e31d90fe140bfd967f147c1d4e8a4834b4c6b895a4bb7082100be60aa5e9a73e98e996da9b0257f02f9ad39b683755abe6ca3e9aefe0170a478a8559dcfb@127.0.0.1:30303 name=erigon/v2.30.0-dev-17fae73f/linux-amd64/go1.18.1 DBUG[11-16|11:52:31.342] [Downloader] Request skeleton anchors=0 top seen height=0 highestInDb=0 [...] DBUG[11-16|11:52:32.342] [Downloader] Request skeleton anchors=0 top seen height=0 highestInDb=0 INFO[11-16|11:37:00.062] [p2p] GoodPeers eth66=0 eth67=0 INFO[11-16|11:37:00.077] [txpool] stat block=0 pending=0 baseFee=0 queued=0 alloc=42.7MB sys=79.5MB INFO[11-16|11:37:00.089] [2/16 Headers] No block headers to write in this log period block number=0 INFO[11-16|11:37:00.089] Req/resp stats req=0 reqMin=0 reqMax=0 skel=0 skelMin=0 skelMax=0 resp=0 respMin=0 respMax=0 dups=0 DBUG[11-16|11:37:00.089] [Downloader] Queue sizes anchors=0 links=0 persisted=1 DBUG[11-16|11:37:00.089] [Downloader] Request skeleton anchors=0 top seen height=0 highestInDb=0 [...] DBUG[11-16|11:37:06.095] [Downloader] Request skeleton anchors=0 top seen height=0 highestInDb=0 ``` I guess it comes down to: ``` --- FAIL: TestDefaultBSCGenesisBlock (0.34s) genesis_test.go:27: Error Trace: /home/filoozom/projects/erigon/core/genesis_test.go:27 /home/filoozom/projects/erigon/core/genesis_test.go:30 Error: Not equal: expected: []byte{0xe8, 0x72, 0x46, 0x2c, 0x6b, 0xd5, 0xf4, 0x2, 0xec, 0x81, 0xde, 0x7c, 0x5b, 0xd2, 0x82, 0x3e, 0x13, 0x7c, 0x66, 0x6b, 0x78, 0xe8, 0x2b, 0x7e, 0xb0, 0xbe, 0x95, 0xaf, 0x5e, 0xce, 0xa1, 0x8d} actual : []byte{0xad, 0xa4, 0x4f, 0xd8, 0xd2, 0xec, 0xab, 0x8b, 0x8, 0xf2, 0x56, 0xaf, 0x7, 0xad, 0x3e, 0x77, 0x7f, 0x17, 0xfb, 0x43, 0x4f, 0x8f, 0x8e, 0x67, 0x8b, 0x31, 0x2f, 0x57, 0x62, 0x12, 0xba, 0x9a} Diff: --- Expected +++ Actual @@ -1,4 +1,4 @@ ([]uint8) (len=32) { - 00000000 e8 72 46 2c 6b d5 f4 02 ec 81 de 7c 5b d2 82 3e |.rF,k......|[..>| - 00000010 13 7c 66 6b 78 e8 2b 7e b0 be 95 af 5e ce a1 8d |.|fkx.+~....^...| + 00000000 ad a4 4f d8 d2 ec ab 8b 08 f2 56 af 07 ad 3e 77 |..O.......V...>w| + 00000010 7f 17 fb 43 4f 8f 8e 67 8b 31 2f 57 62 12 ba 9a |...CO..g.1/Wb...| } Test: TestDefaultBSCGenesisBlock Messages: chiado FAIL FAIL github.com/ledgerwatch/erigon/core 0.823s ``` ---------- Turns out that the `code` in Erigon's chainspec is not the same as `constructor` in Nethermind for example. Comparison for Sokol: - Erigon: https://github.com/ledgerwatch/erigon/blob/devel/core/allocs/sokol.json#L20-L34 - Nethermind: https://github.com/NethermindEth/nethermind/blob/master/src/Nethermind/Chains/sokol.json#L248-L252
2022-11-18 11:54:18 +00:00
case networkname.ChiadoChainName:
return &ChiadoGenesisHash
default:
return nil
}
}
func ChainConfigByGenesisHash(genesisHash libcommon.Hash) *chain.Config {
switch {
case genesisHash == MainnetGenesisHash:
return MainnetChainConfig
2023-08-26 10:31:29 +00:00
case genesisHash == HoleskyGenesisHash:
return HoleskyChainConfig
case genesisHash == SepoliaGenesisHash:
return SepoliaChainConfig
case genesisHash == GoerliGenesisHash:
return GoerliChainConfig
case genesisHash == MumbaiGenesisHash:
return MumbaiChainConfig
case genesisHash == BorMainnetGenesisHash:
return BorMainnetChainConfig
case genesisHash == BorDevnetGenesisHash:
return BorDevnetChainConfig
case genesisHash == GnosisGenesisHash:
return GnosisChainConfig
feat: add chiado config (#6058) Hey guys, I'm trying to add the Chiado network ([Gnosis' testnet](https://docs.gnosischain.com/about/networks/chiado)) now that Gnosis can be synced fully with Erigon, so we can test it on the testnet as well. This is mostly inspired from https://github.com/ledgerwatch/erigon/commit/cd5ef32f379ff51043b7ce1b0c3c471e18b99459. Probably missing: - [ ] The right consensus config (currently only a copy of Gnosis) - [ ] Fixes to the chainspec? - [ ] Presumably something in `cl/clparams/config.go` Current state: ``` $ ./build/bin/erigon --chain=chiado --log.console.verbosity=debug WARN[11-16|11:52:28.188] no log dir set, console logging only WARN[11-16|11:52:28.193] no log dir set, console logging only INFO[11-16|11:52:28.193] Build info git_branch=feat/chiado git_tag=v2021.10.03-2291-g17fae73f8 git_commit=17fae73f8af5348ba7c04684f2a2978daf81b67e INFO[11-16|11:52:28.193] Starting Erigon on devnet=chiado INFO[11-16|11:52:28.194] Maximum peer count ETH=100 total=100 INFO[11-16|11:52:28.194] starting HTTP APIs APIs=eth,erigon,engine INFO[11-16|11:52:28.194] torrent verbosity level=WRN INFO[11-16|11:52:30.300] Set global gas cap cap=50000000 INFO[11-16|11:52:30.302] Opening Database label=chaindata path=/home/filoozom/.local/share/erigon/chiado/chaindata INFO[11-16|11:52:30.310] Initialised chain configuration config="{ChainID: 10200, Homestead: 0, DAO: <nil>, DAO Support: false, Tangerine Whistle: 0, Spurious Dragon: 0, Byzantium: 0, Constantinople: 0, Petersburg: 0, Istanbul: 0, Muir Glacier: <nil>, Berlin: 0, London: 0, Arrow Glacier: <nil>, Gray Glacier: <nil>, Terminal Total Difficulty: <nil>, Merge Netsplit: <nil>, Shanghai: <nil>, Cancun: <nil>, Engine: aura}" genesis=0xf463abeb7ee27fa62be3ac36a264e8174ee3458da451e6403df47618fd2cf415 WARN[11-16|11:52:30.311] Incorrect snapshot enablement got=true change_to=false INFO[11-16|11:52:30.311] Effective prune_flags= snapshot_flags= history.v3=false INFO[11-16|11:52:30.312] Initialising Ethereum protocol network=10200 INFO[11-16|11:52:30.329] Starting private RPC server on=127.0.0.1:9090 INFO[11-16|11:52:30.329] new subscription to logs established INFO[11-16|11:52:30.329] rpc filters: subscribing to Erigon events DBUG[11-16|11:52:30.330] Establishing event subscription channel with the RPC daemon ... INFO[11-16|11:52:30.330] New txs subscriber joined INFO[11-16|11:52:30.330] new subscription to newHeaders established INFO[11-16|11:52:30.330] Reading JWT secret path=/home/filoozom/.local/share/erigon/chiado/jwt.hex INFO[11-16|11:52:30.331] HTTP endpoint opened for Engine API url=localhost:8551 ws=true ws.compression=true INFO[11-16|11:52:30.332] HTTP endpoint opened url=localhost:8545 ws=false ws.compression=true grpc=false DBUG[11-16|11:52:30.336] Couldn't add port mapping proto=tcp extport=30304 intport=30304 interface="UPnP or NAT-PMP" err="no UPnP or NAT-PMP router discovered" DBUG[11-16|11:52:30.336] Couldn't add port mapping proto=udp extport=30304 intport=30304 interface="UPnP or NAT-PMP" err="no UPnP or NAT-PMP router discovered" DBUG[11-16|11:52:30.336] QuerySeeds read nodes from the node DB count=0 DBUG[11-16|11:52:30.341] [1/16 Snapshots] DONE in=134.7µs INFO[11-16|11:52:30.341] [txpool] Started INFO[11-16|11:52:30.341] [2/16 Headers] Waiting for headers... from=0 DBUG[11-16|11:52:30.341] [Downloader] Request skeleton anchors=0 top seen height=0 highestInDb=0 DBUG[11-16|11:52:30.343] Couldn't add port mapping proto=tcp extport=30303 intport=30303 interface="UPnP or NAT-PMP" err="no UPnP or NAT-PMP router discovered" DBUG[11-16|11:52:30.343] Couldn't add port mapping proto=udp extport=30303 intport=30303 interface="UPnP or NAT-PMP" err="no UPnP or NAT-PMP router discovered" DBUG[11-16|11:52:30.344] QuerySeeds read nodes from the node DB count=0 DBUG[11-16|11:52:30.346] QuerySeeds read nodes from the node DB count=0 INFO[11-16|11:52:30.347] Started P2P networking version=67 self=enode://47d2e31d90fe140bfd967f147c1d4e8a4834b4c6b895a4bb7082100be60aa5e9a73e98e996da9b0257f02f9ad39b683755abe6ca3e9aefe0170a478a8559dcfb@127.0.0.1:30304 name=erigon/v2.30.0-dev-17fae73f/linux-amd64/go1.18.1 DBUG[11-16|11:52:30.351] QuerySeeds read nodes from the node DB count=0 INFO[11-16|11:52:30.351] Started P2P networking version=66 self=enode://47d2e31d90fe140bfd967f147c1d4e8a4834b4c6b895a4bb7082100be60aa5e9a73e98e996da9b0257f02f9ad39b683755abe6ca3e9aefe0170a478a8559dcfb@127.0.0.1:30303 name=erigon/v2.30.0-dev-17fae73f/linux-amd64/go1.18.1 DBUG[11-16|11:52:31.342] [Downloader] Request skeleton anchors=0 top seen height=0 highestInDb=0 [...] DBUG[11-16|11:52:32.342] [Downloader] Request skeleton anchors=0 top seen height=0 highestInDb=0 INFO[11-16|11:37:00.062] [p2p] GoodPeers eth66=0 eth67=0 INFO[11-16|11:37:00.077] [txpool] stat block=0 pending=0 baseFee=0 queued=0 alloc=42.7MB sys=79.5MB INFO[11-16|11:37:00.089] [2/16 Headers] No block headers to write in this log period block number=0 INFO[11-16|11:37:00.089] Req/resp stats req=0 reqMin=0 reqMax=0 skel=0 skelMin=0 skelMax=0 resp=0 respMin=0 respMax=0 dups=0 DBUG[11-16|11:37:00.089] [Downloader] Queue sizes anchors=0 links=0 persisted=1 DBUG[11-16|11:37:00.089] [Downloader] Request skeleton anchors=0 top seen height=0 highestInDb=0 [...] DBUG[11-16|11:37:06.095] [Downloader] Request skeleton anchors=0 top seen height=0 highestInDb=0 ``` I guess it comes down to: ``` --- FAIL: TestDefaultBSCGenesisBlock (0.34s) genesis_test.go:27: Error Trace: /home/filoozom/projects/erigon/core/genesis_test.go:27 /home/filoozom/projects/erigon/core/genesis_test.go:30 Error: Not equal: expected: []byte{0xe8, 0x72, 0x46, 0x2c, 0x6b, 0xd5, 0xf4, 0x2, 0xec, 0x81, 0xde, 0x7c, 0x5b, 0xd2, 0x82, 0x3e, 0x13, 0x7c, 0x66, 0x6b, 0x78, 0xe8, 0x2b, 0x7e, 0xb0, 0xbe, 0x95, 0xaf, 0x5e, 0xce, 0xa1, 0x8d} actual : []byte{0xad, 0xa4, 0x4f, 0xd8, 0xd2, 0xec, 0xab, 0x8b, 0x8, 0xf2, 0x56, 0xaf, 0x7, 0xad, 0x3e, 0x77, 0x7f, 0x17, 0xfb, 0x43, 0x4f, 0x8f, 0x8e, 0x67, 0x8b, 0x31, 0x2f, 0x57, 0x62, 0x12, 0xba, 0x9a} Diff: --- Expected +++ Actual @@ -1,4 +1,4 @@ ([]uint8) (len=32) { - 00000000 e8 72 46 2c 6b d5 f4 02 ec 81 de 7c 5b d2 82 3e |.rF,k......|[..>| - 00000010 13 7c 66 6b 78 e8 2b 7e b0 be 95 af 5e ce a1 8d |.|fkx.+~....^...| + 00000000 ad a4 4f d8 d2 ec ab 8b 08 f2 56 af 07 ad 3e 77 |..O.......V...>w| + 00000010 7f 17 fb 43 4f 8f 8e 67 8b 31 2f 57 62 12 ba 9a |...CO..g.1/Wb...| } Test: TestDefaultBSCGenesisBlock Messages: chiado FAIL FAIL github.com/ledgerwatch/erigon/core 0.823s ``` ---------- Turns out that the `code` in Erigon's chainspec is not the same as `constructor` in Nethermind for example. Comparison for Sokol: - Erigon: https://github.com/ledgerwatch/erigon/blob/devel/core/allocs/sokol.json#L20-L34 - Nethermind: https://github.com/NethermindEth/nethermind/blob/master/src/Nethermind/Chains/sokol.json#L248-L252
2022-11-18 11:54:18 +00:00
case genesisHash == ChiadoGenesisHash:
return ChiadoChainConfig
default:
return nil
}
}
func NetworkIDByChainName(chain string) uint64 {
config := ChainConfigByChainName(chain)
if config == nil {
return 0
}
return config.ChainID.Uint64()
}
func IsChainPoS(chainConfig *chain.Config, currentTDProvider func() *big.Int) bool {
return isChainIDPoS(chainConfig.ChainID) || hasChainPassedTerminalTD(chainConfig, currentTDProvider)
}
func isChainIDPoS(chainID *big.Int) bool {
ids := []*big.Int{
MainnetChainConfig.ChainID,
HoleskyChainConfig.ChainID,
GoerliChainConfig.ChainID,
SepoliaChainConfig.ChainID,
GnosisChainConfig.ChainID,
ChiadoChainConfig.ChainID,
}
for _, id := range ids {
if id.Cmp(chainID) == 0 {
return true
}
}
return false
}
func hasChainPassedTerminalTD(chainConfig *chain.Config, currentTDProvider func() *big.Int) bool {
if chainConfig.TerminalTotalDifficultyPassed {
return true
}
terminalTD := chainConfig.TerminalTotalDifficulty
if terminalTD == nil {
return false
}
currentTD := currentTDProvider()
return (currentTD != nil) && (terminalTD.Cmp(currentTD) <= 0)
}