mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2024-12-25 13:07:17 +00:00
327 lines
25 KiB
Go
327 lines
25 KiB
Go
// 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"
|
|
libcommon "github.com/ledgerwatch/erigon-lib/common"
|
|
"github.com/ledgerwatch/erigon-lib/common/hexutility"
|
|
|
|
"github.com/ledgerwatch/erigon/common/paths"
|
|
"github.com/ledgerwatch/erigon/params/networkname"
|
|
)
|
|
|
|
//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")
|
|
SepoliaGenesisHash = libcommon.HexToHash("0x25a5cc106eea7138acab33231d7160d69cb777ee0c2c553fcddf5138993e6dd9")
|
|
RinkebyGenesisHash = libcommon.HexToHash("0x6341fd3daf94b748c72ced5a5b26028f2474f5f00d824504e4fa37a75767e177")
|
|
GoerliGenesisHash = libcommon.HexToHash("0xbf7e331f7f7c1dd2e05159666b3bf8bc7a8a3a9eb1d518969eab529dd9b88c1a")
|
|
SokolGenesisHash = libcommon.HexToHash("0x5b28c1bfd3a15230c9a46b399cd0f9a6920d432e85381cc6a140b06e8410112f")
|
|
BSCGenesisHash = libcommon.HexToHash("0x0d21840abff46b96c84b2ac9e10e4f5cdaeb5693cb665db62a2f3b02d2d57b5b")
|
|
ChapelGenesisHash = libcommon.HexToHash("0x6d3c66c5357ec91d5c43af47e234a939b22557cbb552dc45bebbceeed90fbe34")
|
|
RialtoGenesisHash = libcommon.HexToHash("0xee835a629f9cf5510b48b6ba41d69e0ff7d6ef10f977166ef939db41f59f5501")
|
|
MumbaiGenesisHash = libcommon.HexToHash("0x7b66506a9ebdbf30d32b43c5f15a3b1216269a1ec3a75aa3182b86176a2b1ca7")
|
|
BorMainnetGenesisHash = libcommon.HexToHash("0xa9c28ce2141b56c474f1dc504bee9b01eb1bd7d1a507580d5519d4437a97de1b")
|
|
BorDevnetGenesisHash = libcommon.HexToHash("0x5a06b25b0c6530708ea0b98a3409290e39dce6be7f558493aeb6e4b99a172a87")
|
|
GnosisGenesisHash = libcommon.HexToHash("0x4f1dd23188aab3a76b463e4af801b52b1248ef073c648cbdc4c9333d3da79756")
|
|
ChiadoGenesisHash = libcommon.HexToHash("0xada44fd8d2ecab8b08f256af07ad3e777f17fb434f8f8e678b312f576212ba9a")
|
|
)
|
|
|
|
var (
|
|
SokolGenesisEpochProof = hexutility.FromHex("0xf91a8c80b91a87f91a84f9020da00000000000000000000000000000000000000000000000000000000000000000a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347940000000000000000000000000000000000000000a0fad4af258fd11939fae0c6c6eec9d340b1caac0b0196fd9a1bc3f489c5bf00b3a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b9010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000830200008083663be080808080b8410000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f91871b914c26060604052600436106100fc576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806303aca79214610101578063108552691461016457806340a141ff1461019d57806340c9cdeb146101d65780634110a489146101ff57806345199e0a1461025757806349285b58146102c15780634d238c8e14610316578063752862111461034f578063900eb5a8146103645780639a573786146103c7578063a26a47d21461041c578063ae4b1b5b14610449578063b3f05b971461049e578063b7ab4db5146104cb578063d3e848f114610535578063fa81b2001461058a578063facd743b146105df575b600080fd5b341561010c57600080fd5b6101226004808035906020019091905050610630565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561016f57600080fd5b61019b600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061066f565b005b34156101a857600080fd5b6101d4600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610807565b005b34156101e157600080fd5b6101e9610bb7565b6040518082815260200191505060405180910390f35b341561020a57600080fd5b610236600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610bbd565b60405180831515151581526020018281526020019250505060405180910390f35b341561026257600080fd5b61026a610bee565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156102ad578082015181840152602081019050610292565b505050509050019250505060405180910390f35b34156102cc57600080fd5b6102d4610c82565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561032157600080fd5b61034d600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610d32565b005b341561035a57600080fd5b610362610fcc565b005b341561036f57600080fd5b61038560048080359060200190919050506110fc565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156103d257600080fd5b6103da61113b565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561042757600080fd5b61042f6111eb565b604051808215151515815260200191505060405180910390f35b341561045457600080fd5b61045c6111fe565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156104a957600080fd5b6104b1611224565b604051808215151515815260200191505060405180910390f35b34156104d657600080fd5b6104de611237565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b83811015610521578082015181840152602081019050610506565b505050509050019250505060405180910390f35b341561054057600080fd5b6105486112cb565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561059557600080fd5b61059d6112f1565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156105ea57600080fd5b610616600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611317565b604051808215151515815260200191505060405180910390f35b60078181548110151561063f57fe5b90600052602060002090016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600460029054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156106cb57600080fd5b600460019054906101000a900460ff161515156106e757600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415151561072357600080fd5b80600a60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506001600460016101000a81548160ff0219169083151502179055507f600bcf04a13e752d1e3670a5a9f1c21177ca2a93c6f5391d4f1298d098097c22600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a150565b600080600061081461113b565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561084d57600080fd5b83600960008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160009054906101000a900460ff1615156108a957600080fd5b600960008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101549350600160078054905003925060078381548110151561090857fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1691508160078581548110151561094657fe5b906000526020600020900160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555083600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101819055506007838154811015156109e557fe5b906000526020600020900160006101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690556000600780549050111515610a2757600080fd5b6007805480919060019003610a3c9190611370565b506000600960008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101819055506000600960008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160006101000a81548160ff0219169083151502179055506000600460006101000a81548160ff0219169083151502179055506001430340600019167f55252fa6eee4741b4e24a74a70e9c11fd2c2281df8d6ea13126ff845f7825c89600760405180806020018281038252838181548152602001915080548015610ba257602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019060010190808311610b58575b50509250505060405180910390a25050505050565b60085481565b60096020528060005260406000206000915090508060000160009054906101000a900460ff16908060010154905082565b610bf661139c565b6007805480602002602001604051908101604052809291908181526020018280548015610c7857602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019060010190808311610c2e575b5050505050905090565b6000600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166349285b586000604051602001526040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b1515610d1257600080fd5b6102c65a03f11515610d2357600080fd5b50505060405180519050905090565b610d3a61113b565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610d7357600080fd5b80600960008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160009054906101000a900460ff16151515610dd057600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614151515610e0c57600080fd5b6040805190810160405280600115158152602001600780549050815250600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008201518160000160006101000a81548160ff0219169083151502179055506020820151816001015590505060078054806001018281610ea991906113b0565b9160005260206000209001600084909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550506000600460006101000a81548160ff0219169083151502179055506001430340600019167f55252fa6eee4741b4e24a74a70e9c11fd2c2281df8d6ea13126ff845f7825c89600760405180806020018281038252838181548152602001915080548015610fba57602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019060010190808311610f70575b50509250505060405180910390a25050565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161480156110365750600460009054906101000a900460ff16155b151561104157600080fd5b6001600460006101000a81548160ff0219169083151502179055506007600690805461106e9291906113dc565b506006805490506008819055507f8564cd629b15f47dc310d45bcbfc9bcf5420b0d51bf0659a16c67f91d27632536110a4611237565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156110e75780820151818401526020810190506110cc565b505050509050019250505060405180910390a1565b60068181548110151561110b57fe5b90600052602060002090016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16639a5737866000604051602001526040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b15156111cb57600080fd5b6102c65a03f115156111dc57600080fd5b50505060405180519050905090565b600460019054906101000a900460ff1681565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600460009054906101000a900460ff1681565b61123f61139c565b60068054806020026020016040519081016040528092919081815260200182805480156112c157602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019060010190808311611277575b5050505050905090565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600460029054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600960008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160009054906101000a900460ff169050919050565b81548183558181151161139757818360005260206000209182019101611396919061142e565b5b505050565b602060405190810160405280600081525090565b8154818355818115116113d7578183600052602060002091820191016113d6919061142e565b5b505050565b82805482825590600052602060002090810192821561141d5760005260206000209182015b8281111561141c578254825591600101919060010190611401565b5b50905061142a9190611453565b5090565b61145091905b8082111561144c576000816000905550600101611434565b5090565b90565b61149391905b8082111561148f57600081816101000a81549073ffffffffffffffffffffffffffffffffffffffff021916905550600101611459565b5090565b905600a165627a7a7230582036ea35935c8246b68074adece2eab70c40e69a0193c08a6277ce06e5b25188510029b86bf869a033aa5d69545785694b808840be50c182dad2ec3636dfccbe6572fb69828742c0b846f8440101a0663ce0d171e545a26aa67e4ca66f72ba96bb48287dbcc03beea282867f80d44ba01f0e7726926cb43c03a0abf48197dba78522ec8ba1b158e2aa30da7d2a2c6f9eb8f3f8f1a08023c0d95fc2364e0bf7593f5ff32e1db8ef9f4b41c0bd474eae62d1af896e99808080a0b47b4f0b3e73b5edc8f9a9da1cbcfed562eb06bf54619b6aefeadebf5b3604c280a0da6ec08940a924cb08c947dd56cdb40076b29a6f0ea4dba4e2d02d9a9a72431b80a030cc4138c9e74b6cf79d624b4b5612c0fd888e91f55316cfee7d1694e1a90c0b80a0c5d54b915b56a888eee4e6eeb3141e778f9b674d1d322962eed900f02c29990aa017256b36ef47f907c6b1378a2636942ce894c17075e56fc054d4283f6846659e808080a03340bbaeafcda3a8672eb83099231dbbfab8dae02a1e8ec2f7180538fac207e080b838f7a03868bdfa8727775661e4ccf117824a175a33f8703d728c04488fbfffcafda9f99594e8ddc5c7a2d2f0d7a9798459c0104fdf5e987acab853f851808080a07bb75cabebdcbd1dbb4331054636d0c6d7a2b08483b9e04df057395a7434c9e080808080808080a0e61e567237b49c44d8f906ceea49027260b4010c10a547b38d8b131b9d3b6f848080808080b853f851808080a0a87d9bb950836582673aa0eecc0ff64aac607870637a2dd2012b8b1b31981f698080a08da6d5c36a404670c553a2c9052df7cd604f04e3863c4c7b9e0027bfd54206d680808080808080808080b86bf869a02080c7b7ae81a58eb98d9c78de4a1fd7fd9535fc953ed2be602daaa41767312ab846f8448080a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a0c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470b8d3f8d1a0dc277c93a9f9dcee99aac9b8ba3cfa4c51821998522469c37715644e8fbac0bfa0ab8cdb808c8303bb61fb48e276217be9770fa83ecf3f90f2234d558885f5abf1808080a0fe137c3a474fbde41d89a59dd76da4c55bf696b86d3af64a55632f76cf30786780808080a06301b39b2ea8a44df8b0356120db64b788e71f52e1d7a6309d0d2e5b86fee7cb80a0da5d8b08dea0c5a4799c0f44d8a24d7cdf209f9b7a5588c1ecafb5361f6b9f07a01b7779e149cadf24d4ffb77ca7e11314b8db7097e4d70b2a173493153ca2e5a0808080a3e2a02052222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d3f0180")
|
|
)
|
|
|
|
var (
|
|
SokolGenesisStateRoot = libcommon.HexToHash("0xfad4af258fd11939fae0c6c6eec9d340b1caac0b0196fd9a1bc3f489c5bf00b3")
|
|
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")
|
|
|
|
// SepoliaChainConfig contains the chain parameters to run a node on the Sepolia test network.
|
|
SepoliaChainConfig = readChainSpec("chainspecs/sepolia.json")
|
|
|
|
// RinkebyChainConfig contains the chain parameters to run a node on the Rinkeby test network.
|
|
RinkebyChainConfig = readChainSpec("chainspecs/rinkeby.json")
|
|
|
|
// GoerliChainConfig contains the chain parameters to run a node on the Görli test network.
|
|
GoerliChainConfig = readChainSpec("chainspecs/goerli.json")
|
|
|
|
BSCChainConfig = readChainSpec("chainspecs/bsc.json")
|
|
|
|
ChapelChainConfig = readChainSpec("chainspecs/chapel.json")
|
|
|
|
RialtoChainConfig = readChainSpec("chainspecs/rialto.json")
|
|
|
|
SokolChainConfig = readChainSpec("chainspecs/sokol.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),
|
|
TangerineWhistleHash: libcommon.Hash{},
|
|
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),
|
|
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),
|
|
TangerineWhistleHash: libcommon.Hash{},
|
|
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")
|
|
|
|
BorMainnetChainConfig = readChainSpec("chainspecs/bor-mainnet.json")
|
|
|
|
BorDevnetChainConfig = readChainSpec("chainspecs/bor-devnet.json")
|
|
|
|
GnosisChainConfig = readChainSpec("chainspecs/gnosis.json")
|
|
|
|
ChiadoChainConfig = readChainSpec("chainspecs/chiado.json")
|
|
|
|
CliqueSnapshot = NewSnapshotConfig(10, 1024, 16384, true, "")
|
|
|
|
TestChainConfig = &chain.Config{
|
|
ChainID: big.NewInt(1337),
|
|
Consensus: chain.EtHashConsensus,
|
|
HomesteadBlock: big.NewInt(0),
|
|
TangerineWhistleBlock: big.NewInt(0),
|
|
TangerineWhistleHash: libcommon.Hash{},
|
|
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),
|
|
TangerineWhistleHash: libcommon.Hash{},
|
|
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),
|
|
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.SepoliaChainName:
|
|
return SepoliaChainConfig
|
|
case networkname.RinkebyChainName:
|
|
return RinkebyChainConfig
|
|
case networkname.GoerliChainName:
|
|
return GoerliChainConfig
|
|
case networkname.SokolChainName:
|
|
return SokolChainConfig
|
|
case networkname.BSCChainName:
|
|
return BSCChainConfig
|
|
case networkname.ChapelChainName:
|
|
return ChapelChainConfig
|
|
case networkname.RialtoChainName:
|
|
return RialtoChainConfig
|
|
case networkname.MumbaiChainName:
|
|
return MumbaiChainConfig
|
|
case networkname.BorMainnetChainName:
|
|
return BorMainnetChainConfig
|
|
case networkname.BorDevnetChainName:
|
|
return BorDevnetChainConfig
|
|
case networkname.GnosisChainName:
|
|
return GnosisChainConfig
|
|
case networkname.ChiadoChainName:
|
|
return ChiadoChainConfig
|
|
default:
|
|
return nil
|
|
}
|
|
}
|
|
|
|
func GenesisHashByChainName(chain string) *libcommon.Hash {
|
|
switch chain {
|
|
case networkname.MainnetChainName:
|
|
return &MainnetGenesisHash
|
|
case networkname.SepoliaChainName:
|
|
return &SepoliaGenesisHash
|
|
case networkname.RinkebyChainName:
|
|
return &RinkebyGenesisHash
|
|
case networkname.GoerliChainName:
|
|
return &GoerliGenesisHash
|
|
case networkname.SokolChainName:
|
|
return &SokolGenesisHash
|
|
case networkname.BSCChainName:
|
|
return &BSCGenesisHash
|
|
case networkname.ChapelChainName:
|
|
return &ChapelGenesisHash
|
|
case networkname.RialtoChainName:
|
|
return &RialtoGenesisHash
|
|
case networkname.MumbaiChainName:
|
|
return &MumbaiGenesisHash
|
|
case networkname.BorMainnetChainName:
|
|
return &BorMainnetGenesisHash
|
|
case networkname.BorDevnetChainName:
|
|
return &BorDevnetGenesisHash
|
|
case networkname.GnosisChainName:
|
|
return &GnosisGenesisHash
|
|
case networkname.ChiadoChainName:
|
|
return &ChiadoGenesisHash
|
|
default:
|
|
return nil
|
|
}
|
|
}
|
|
|
|
func ChainConfigByGenesisHash(genesisHash libcommon.Hash) *chain.Config {
|
|
switch {
|
|
case genesisHash == MainnetGenesisHash:
|
|
return MainnetChainConfig
|
|
case genesisHash == SepoliaGenesisHash:
|
|
return SepoliaChainConfig
|
|
case genesisHash == RinkebyGenesisHash:
|
|
return RinkebyChainConfig
|
|
case genesisHash == GoerliGenesisHash:
|
|
return GoerliChainConfig
|
|
case genesisHash == SokolGenesisHash:
|
|
return SokolChainConfig
|
|
case genesisHash == BSCGenesisHash:
|
|
return BSCChainConfig
|
|
case genesisHash == ChapelGenesisHash:
|
|
return ChapelChainConfig
|
|
case genesisHash == RialtoGenesisHash:
|
|
return RialtoChainConfig
|
|
case genesisHash == MumbaiGenesisHash:
|
|
return MumbaiChainConfig
|
|
case genesisHash == BorMainnetGenesisHash:
|
|
return BorMainnetChainConfig
|
|
case genesisHash == BorDevnetGenesisHash:
|
|
return BorDevnetChainConfig
|
|
case genesisHash == GnosisGenesisHash:
|
|
return GnosisChainConfig
|
|
case genesisHash == ChiadoGenesisHash:
|
|
return ChiadoChainConfig
|
|
default:
|
|
return nil
|
|
}
|
|
}
|
|
|
|
func NetworkIDByChainName(chain string) uint64 {
|
|
switch chain {
|
|
case networkname.RialtoChainName:
|
|
return 97
|
|
case networkname.DevChainName:
|
|
return 1337
|
|
default:
|
|
config := ChainConfigByChainName(chain)
|
|
if config == nil {
|
|
return 0
|
|
}
|
|
return config.ChainID.Uint64()
|
|
}
|
|
}
|