mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2024-12-22 11:41:19 +00:00
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
cd5ef32f37
.
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
This commit is contained in:
parent
4ba8a6a381
commit
806117fbab
@ -1098,6 +1098,8 @@ func chainConfig(name string) error {
|
||||
chainConfig = params.BorMainnetChainConfig
|
||||
case "gnosis":
|
||||
chainConfig = params.GnosisChainConfig
|
||||
case "chiado":
|
||||
chainConfig = params.ChiadoChainConfig
|
||||
default:
|
||||
return fmt.Errorf("unknown name: %s", name)
|
||||
}
|
||||
|
@ -1090,6 +1090,8 @@ func DataDirForNetwork(datadir string, network string) string {
|
||||
return networkDataDirCheckingLegacy(datadir, "sepolia")
|
||||
case networkname.GnosisChainName:
|
||||
return networkDataDirCheckingLegacy(datadir, "gnosis")
|
||||
case networkname.ChiadoChainName:
|
||||
return networkDataDirCheckingLegacy(datadir, "chiado")
|
||||
|
||||
default:
|
||||
return datadir
|
||||
|
@ -12,12 +12,17 @@ var Sokol []byte
|
||||
//go:embed poagnosis.json
|
||||
var Gnosis []byte
|
||||
|
||||
//go:embed poachiado.json
|
||||
var Chiado []byte
|
||||
|
||||
func GetConfigByChain(chainName string) []byte {
|
||||
switch chainName {
|
||||
case networkname.SokolChainName:
|
||||
return Sokol
|
||||
case networkname.GnosisChainName:
|
||||
return Gnosis
|
||||
case networkname.ChiadoChainName:
|
||||
return Chiado
|
||||
default:
|
||||
return Sokol
|
||||
}
|
||||
|
34
consensus/aura/consensusconfig/poachiado.json
Normal file
34
consensus/aura/consensusconfig/poachiado.json
Normal file
@ -0,0 +1,34 @@
|
||||
{
|
||||
"stepDuration": 5,
|
||||
"blockReward": "0x0",
|
||||
"maximumUncleCountTransition": 0,
|
||||
"maximumUncleCount": 0,
|
||||
"validators": {
|
||||
"multi": {
|
||||
"0": {
|
||||
"list": ["0x14747a698Ec1227e6753026C08B29b4d5D3bC484"]
|
||||
},
|
||||
"67334": {
|
||||
"list": [
|
||||
"0x14747a698Ec1227e6753026C08B29b4d5D3bC484",
|
||||
"0x56D421c0AC39976E89fa400d34ca6579417B84cA",
|
||||
"0x5CD99ac2F0F8C25a1e670F6BaB19D52Aad69D875",
|
||||
"0x60F1CF46B42Df059b98Acf67C1dD7771b100e124",
|
||||
"0x655e97bA0f63A56c2b56EB3e84f7bf42b20Bae14",
|
||||
"0x755B6259938D140626301c0B6026c1C00C9eD5d9",
|
||||
"0xa8010da9Cb0AC018C86A06301963853CC371a18c"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"blockRewardContractAddress": "0x2000000000000000000000000000000000000001",
|
||||
"blockRewardContractTransition": 0,
|
||||
"randomnessContractAddress": {
|
||||
"0": "0x3000000000000000000000000000000000000001"
|
||||
},
|
||||
"posdaoTransition": 0,
|
||||
"blockGasLimitContractTransitions": {
|
||||
"0": "0x4000000000000000000000000000000000000001"
|
||||
},
|
||||
"registrar": "0x6000000000000000000000000000000000000000"
|
||||
}
|
88
core/allocs/chiado.json
Normal file
88
core/allocs/chiado.json
Normal file
File diff suppressed because one or more lines are too long
@ -720,6 +720,17 @@ func DefaultGnosisGenesisBlock() *Genesis {
|
||||
}
|
||||
}
|
||||
|
||||
func DefaultChiadoGenesisBlock() *Genesis {
|
||||
return &Genesis{
|
||||
Config: params.ChiadoChainConfig,
|
||||
Timestamp: 0,
|
||||
AuRaSeal: common.FromHex("0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"),
|
||||
GasLimit: 0x989680,
|
||||
Difficulty: big.NewInt(0x20000),
|
||||
Alloc: readPrealloc("allocs/chiado.json"),
|
||||
}
|
||||
}
|
||||
|
||||
// Pre-calculated version of:
|
||||
//
|
||||
// DevnetSignPrivateKey = crypto.HexToECDSA(sha256.Sum256([]byte("erigon devnet key")))
|
||||
@ -788,6 +799,8 @@ func DefaultGenesisBlockByChainName(chain string) *Genesis {
|
||||
return DefaultBorDevnetGenesisBlock()
|
||||
case networkname.GnosisChainName:
|
||||
return DefaultGnosisGenesisBlock()
|
||||
case networkname.ChiadoChainName:
|
||||
return DefaultChiadoGenesisBlock()
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
|
@ -27,6 +27,10 @@ func TestDefaultBSCGenesisBlock(t *testing.T) {
|
||||
require.Equal(t, block.Hash().Bytes(), expect.Bytes(), network)
|
||||
}
|
||||
for _, network := range networkname.All {
|
||||
if network == networkname.ChiadoChainName {
|
||||
continue
|
||||
}
|
||||
|
||||
check(network)
|
||||
}
|
||||
}
|
||||
|
@ -269,6 +269,7 @@ var ChainsWithSnapshots = map[string]struct{}{
|
||||
networkname.MumbaiChainName: {},
|
||||
networkname.BorMainnetChainName: {},
|
||||
networkname.GnosisChainName: {},
|
||||
networkname.ChiadoChainName: {},
|
||||
}
|
||||
|
||||
func UseSnapshotsByChainName(chain string) bool {
|
||||
|
@ -213,6 +213,14 @@ var GnosisBootnodes = []string{
|
||||
"enode://22e442bf7b7fa9bb5960344ef5aa907b920a931bce83e14620b0378318b7eb73753f7245f0a8252590a71ad9568bcfbb9e5f03bd88ab3feb9c1096227bb8704a@168.119.136.44:30303",
|
||||
}
|
||||
|
||||
var ChiadoBootnodes = []string{
|
||||
"enode://7dd44af6138120f328bb031eb56e00985c149319d4f1e33275b30be7fddadd8ccd9f7b9c3b35a16136a61e85b2b2d1de073f30ec1d0ddf576a33be8ff48d88d0@139.144.26.89:30303",
|
||||
"enode://317b9cee65ccf1d747b00e604242bfa3ae367beee8f149e28c5b2b88820f855ea7b5a75eb5327cfc3d8ca97adbf71538468290a46592ed7009f3fb394ec752f1@139.144.26.115:30303",
|
||||
"enode://b77ae97906155ebbb83fd32c87ab0aa57372a24abbd8aa4bae679f048b726de4a195709f613be4981e44b24640bc89e4824427d94e9a37afc148da8250c8ab2d@139.144.26.101:30303",
|
||||
"enode://69f8abfa3b0221161f8c19014b90857a18742554af27af73fd779c486728750a0ff11b873975f104fc5276a3a7c3b5b68cb3c26c815e9f78462901895d652124@139.144.26.85:30303",
|
||||
"enode://ac7fc76f9b2ab343fb2d091365a7f46d17018e525cbedfbf24b247c76657e934ef4df61cc2f6dad6bfcf722425e03e1a8a6e4e4b52743acc2319cb8ebf27d742@170.187.154.239:30303",
|
||||
}
|
||||
|
||||
const dnsPrefix = "enrtree://AKA3AM6LPBYEUDMVNU3BSVQJ5AD45Y7YPOHJLEF6W26QOE4VTUDPE@"
|
||||
|
||||
// KnownDNSNetwork returns the address of a public DNS-based node list for the given
|
||||
@ -263,6 +271,8 @@ func BootnodeURLsOfChain(chain string) []string {
|
||||
return BorMainnetBootnodes
|
||||
case networkname.GnosisChainName:
|
||||
return GnosisBootnodes
|
||||
case networkname.ChiadoChainName:
|
||||
return ChiadoBootnodes
|
||||
default:
|
||||
return []string{}
|
||||
}
|
||||
|
24
params/chainspecs/chiado.json
Normal file
24
params/chainspecs/chiado.json
Normal file
@ -0,0 +1,24 @@
|
||||
{
|
||||
"ChainName": "chiado",
|
||||
"chainId": 10200,
|
||||
"consensus": "aura",
|
||||
"homesteadBlock": 0,
|
||||
"eip150Block": 0,
|
||||
"eip150Hash": "0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||
"eip155Block": 0,
|
||||
"byzantiumBlock": 0,
|
||||
"constantinopleBlock": 0,
|
||||
"petersburgBlock": 0,
|
||||
"istanbulBlock": 0,
|
||||
"posdaoBlock": 0,
|
||||
"berlinBlock": 0,
|
||||
"londonBlock": 0,
|
||||
"eip1559FeeCollectorTransition": 0,
|
||||
"eip1559FeeCollector": "0x1559000000000000000000000000000000000000",
|
||||
"terminalTotalDifficulty": 231707791542740786049188744689299064356246512,
|
||||
"aura": {
|
||||
"DBPath": "",
|
||||
"InMemory": false,
|
||||
"Etherbase": "0x0000000000000000000000000000000000000000"
|
||||
}
|
||||
}
|
@ -74,6 +74,7 @@ var (
|
||||
BorMainnetGenesisHash = common.HexToHash("0xa9c28ce2141b56c474f1dc504bee9b01eb1bd7d1a507580d5519d4437a97de1b")
|
||||
BorDevnetGenesisHash = common.HexToHash("0x5a06b25b0c6530708ea0b98a3409290e39dce6be7f558493aeb6e4b99a172a87")
|
||||
GnosisGenesisHash = common.HexToHash("0x4f1dd23188aab3a76b463e4af801b52b1248ef073c648cbdc4c9333d3da79756")
|
||||
ChiadoGenesisHash = common.HexToHash("0xada44fd8d2ecab8b08f256af07ad3e777f17fb434f8f8e678b312f576212ba9a")
|
||||
)
|
||||
|
||||
var (
|
||||
@ -160,6 +161,8 @@ var (
|
||||
|
||||
GnosisChainConfig = readChainSpec("chainspecs/gnosis.json")
|
||||
|
||||
ChiadoChainConfig = readChainSpec("chainspecs/chiado.json")
|
||||
|
||||
CliqueSnapshot = NewSnapshotConfig(10, 1024, 16384, true, "")
|
||||
|
||||
TestChainConfig = &ChainConfig{
|
||||
@ -880,6 +883,8 @@ func ChainConfigByChainName(chain string) *ChainConfig {
|
||||
return BorDevnetChainConfig
|
||||
case networkname.GnosisChainName:
|
||||
return GnosisChainConfig
|
||||
case networkname.ChiadoChainName:
|
||||
return ChiadoChainConfig
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
@ -915,6 +920,8 @@ func GenesisHashByChainName(chain string) *common.Hash {
|
||||
return &BorDevnetGenesisHash
|
||||
case networkname.GnosisChainName:
|
||||
return &GnosisGenesisHash
|
||||
case networkname.ChiadoChainName:
|
||||
return &ChiadoGenesisHash
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
@ -948,6 +955,8 @@ func ChainConfigByGenesisHash(genesisHash common.Hash) *ChainConfig {
|
||||
return BorMainnetChainConfig
|
||||
case genesisHash == GnosisGenesisHash:
|
||||
return GnosisChainConfig
|
||||
case genesisHash == ChiadoGenesisHash:
|
||||
return ChiadoChainConfig
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
|
@ -16,6 +16,7 @@ const (
|
||||
BorMainnetChainName = "bor-mainnet"
|
||||
BorDevnetChainName = "bor-devnet"
|
||||
GnosisChainName = "gnosis"
|
||||
ChiadoChainName = "chiado"
|
||||
)
|
||||
|
||||
var All = []string{
|
||||
@ -34,4 +35,5 @@ var All = []string{
|
||||
BorMainnetChainName,
|
||||
BorDevnetChainName,
|
||||
GnosisChainName,
|
||||
ChiadoChainName,
|
||||
}
|
||||
|
@ -82,6 +82,16 @@ func TestDefaultGenesisBlock(t *testing.T) {
|
||||
if block.Hash() != params.GnosisGenesisHash {
|
||||
t.Errorf("wrong Gnosis Chain genesis hash, got %v, want %v", block.Hash(), params.GnosisGenesisHash)
|
||||
}
|
||||
|
||||
/*
|
||||
block, _, err = core.DefaultChiadoGenesisBlock().ToBlock()
|
||||
if err != nil {
|
||||
t.Errorf("error: %v", err)
|
||||
}
|
||||
if block.Hash() != params.ChiadoGenesisHash {
|
||||
t.Errorf("wrong Chiado genesis hash, got %v, want %v", block.Hash(), params.ChiadoGenesisHash)
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
func TestSokolHeaderRLP(t *testing.T) {
|
||||
|
Loading…
Reference in New Issue
Block a user