all: update network and consensus configuration

This commit is contained in:
Your Name 2024-04-23 13:39:48 +09:00
parent 54c066bbd7
commit 68a038ae6a
12 changed files with 441 additions and 39 deletions

View file

@ -136,11 +136,22 @@ func New(stack *node.Node, config *ethconfig.Config) (*Ethereum, error) {
// Transfer mining-related config to the ethash config. // Transfer mining-related config to the ethash config.
ethashConfig := config.Ethash ethashConfig := config.Ethash
ethashConfig.NotifyFull = config.Miner.NotifyFull ethashConfig.NotifyFull = config.Miner.NotifyFull
eccpowConfig := config.Eccpow
/*
eccpowConfig, err := core.LoadEccpowConfig(chainDb, config.Genesis)
if err != nil {
return nil, err
}*/
cliqueConfig, err := core.LoadCliqueConfig(chainDb, config.Genesis) cliqueConfig, err := core.LoadCliqueConfig(chainDb, config.Genesis)
if err != nil { if err != nil {
return nil, err return nil, err
} }
engine := ethconfig.CreateConsensusEngine(stack, &ethashConfig, cliqueConfig, config.Miner.Notify, config.Miner.Noverify, chainDb)
//engine := ethconfig.CreateConsensusEngine(stack, &ethashConfig, cliqueConfig, eccpowConfig, config.Miner.Notify, config.Miner.Noverify, chainDb)
engine := ethconfig.CreateConsensusEngine(stack, &ethashConfig, cliqueConfig, &eccpowConfig, config.Miner.Notify, config.Miner.Noverify, chainDb)
eth := &Ethereum{ eth := &Ethereum{
config: config, config: config,
@ -275,7 +286,7 @@ func makeExtraData(extra []byte) []byte {
// create default extradata // create default extradata
extra, _ = rlp.EncodeToBytes([]interface{}{ extra, _ = rlp.EncodeToBytes([]interface{}{
uint(params.VersionMajor<<16 | params.VersionMinor<<8 | params.VersionPatch), uint(params.VersionMajor<<16 | params.VersionMinor<<8 | params.VersionPatch),
"geth", "worldland",
runtime.Version(), runtime.Version(),
runtime.GOOS, runtime.GOOS,
}) })

View file

@ -73,7 +73,7 @@ var Defaults = Config{
DatasetsOnDisk: 2, DatasetsOnDisk: 2,
DatasetsLockMmap: false, DatasetsLockMmap: false,
}, },
NetworkId: 1, NetworkId: 103,
TxLookupLimit: 2350000, TxLookupLimit: 2350000,
LightPeers: 100, LightPeers: 100,
UltraLightFraction: 75, UltraLightFraction: 75,
@ -182,6 +182,10 @@ type Config struct {
// Ethash options // Ethash options
Ethash ethash.Config Ethash ethash.Config
// Ethash options
Eccpow eccpow.Config
// Transaction pool options // Transaction pool options
TxPool core.TxPoolConfig TxPool core.TxPoolConfig
@ -218,11 +222,13 @@ type Config struct {
} }
// CreateConsensusEngine creates a consensus engine for the given chain configuration. // CreateConsensusEngine creates a consensus engine for the given chain configuration.
func CreateConsensusEngine(stack *node.Node, ethashConfig *ethash.Config, cliqueConfig *params.CliqueConfig, notify []string, noverify bool, db ethdb.Database) consensus.Engine { func CreateConsensusEngine(stack *node.Node, ethashConfig *ethash.Config, cliqueConfig *params.CliqueConfig, eccpowConfig *eccpow.Config, notify []string, noverify bool, db ethdb.Database) consensus.Engine {
// If proof-of-authority is requested, set it up // If proof-of-authority is requested, set it up
var engine consensus.Engine var engine consensus.Engine
if cliqueConfig != nil { if cliqueConfig != nil {
engine = clique.New(cliqueConfig, db) engine = clique.New(cliqueConfig, db)
} else if eccpowConfig != nil {
engine = eccpow.New(eccpow.Config{}, notify, noverify)
} else { } else {
switch ethashConfig.PowMode { switch ethashConfig.PowMode {
case ethash.ModeFake: case ethash.ModeFake:
@ -246,5 +252,9 @@ func CreateConsensusEngine(stack *node.Node, ethashConfig *ethash.Config, clique
}, notify, noverify) }, notify, noverify)
engine.(*ethash.Ethash).SetThreads(-1) // Disable CPU mining engine.(*ethash.Ethash).SetThreads(-1) // Disable CPU mining
} }
//return engine , add worldland hardfork consensus.
//return beacon.New(engine, eccpow.New(eccpow.Config{}, nil, false))
return beacon.New(engine) return beacon.New(engine)
} }

View file

@ -128,7 +128,7 @@ func New(stack *node.Node, config *ethconfig.Config) (*LightEthereum, error) {
reqDist: newRequestDistributor(peers, &mclock.System{}), reqDist: newRequestDistributor(peers, &mclock.System{}),
accountManager: stack.AccountManager(), accountManager: stack.AccountManager(),
merger: merger, merger: merger,
engine: ethconfig.CreateConsensusEngine(stack, &config.Ethash, chainConfig.Clique, nil, false, chainDb), engine: ethconfig.CreateConsensusEngine(stack, &config.Ethash, chainConfig.Clique, &config.Eccpow, nil, false, chainDb),
bloomRequests: make(chan chan *bloombits.Retrieval), bloomRequests: make(chan chan *bloombits.Retrieval),
bloomIndexer: core.NewBloomIndexer(chainDb, params.BloomBitsBlocksClient, params.HelperTrieConfirmations), bloomIndexer: core.NewBloomIndexer(chainDb, params.BloomBitsBlocksClient, params.HelperTrieConfirmations),
p2pServer: stack.Server(), p2pServer: stack.Server(),

View file

@ -187,6 +187,28 @@ func NewNode(datadir string, config *NodeConfig) (stack *Node, _ error) {
config.EthereumNetworkID = 5 config.EthereumNetworkID = 5
} }
} }
if config.EthereumGenesis == LveGenesis() {
genesis.Config = params.LveChainConfig
if config.EthereumNetworkID == 1 {
config.EthereumNetworkID = 12345
}
}
if config.EthereumGenesis == SeoulGenesis() {
genesis.Config = params.SeoulChainConfig
if config.EthereumNetworkID == 1 {
config.EthereumNetworkID = 103
}
}
if config.EthereumGenesis == GwangjuGenesis() {
genesis.Config = params.GwangjuChainConfig
if config.EthereumNetworkID == 1 {
config.EthereumNetworkID = 10395
}
}
} }
// Register the Ethereum protocol if requested // Register the Ethereum protocol if requested
if config.EthereumEnabled { if config.EthereumEnabled {

View file

@ -20,4 +20,4 @@
package geth package geth
// clientIdentifier is a hard coded identifier to report into the network. // clientIdentifier is a hard coded identifier to report into the network.
var clientIdentifier = "GethDroid" var clientIdentifier = "WorldlandDroid"

View file

@ -20,4 +20,4 @@
package geth package geth
// clientIdentifier is a hard coded identifier to report into the network. // clientIdentifier is a hard coded identifier to report into the network.
var clientIdentifier = "iGeth" var clientIdentifier = "iWorldland"

View file

@ -20,4 +20,4 @@
package geth package geth
// clientIdentifier is a hard coded identifier to report into the network. // clientIdentifier is a hard coded identifier to report into the network.
var clientIdentifier = "GethMobile" var clientIdentifier = "WorldlandMobile"

View file

@ -68,6 +68,33 @@ func GoerliGenesis() string {
return string(enc) return string(enc)
} }
// LveGenesis returns the JSON spec to use for the LVE network
func LveGenesis() string {
enc, err := json.Marshal(core.DefaultLveGenesisBlock())
if err != nil {
panic(err)
}
return string(enc)
}
// SeoulGenesis returns the JSON spec to use for the LVE TEST network
func SeoulGenesis() string {
enc, err := json.Marshal(core.DefaultSeoulGenesisBlock())
if err != nil {
panic(err)
}
return string(enc)
}
// GwangjuGenesis returns the JSON spec to use for the LVE TEST network
func GwangjuGenesis() string {
enc, err := json.Marshal(core.DefaultGwangjuGenesisBlock())
if err != nil {
panic(err)
}
return string(enc)
}
// FoundationBootnodes returns the enode URLs of the P2P bootstrap nodes operated // FoundationBootnodes returns the enode URLs of the P2P bootstrap nodes operated
// by the foundation running the V5 discovery protocol. // by the foundation running the V5 discovery protocol.
func FoundationBootnodes() *Enodes { func FoundationBootnodes() *Enodes {

View file

@ -142,6 +142,8 @@ func (h *Header) GetExtra() []byte { return h.header.Extra }
func (h *Header) GetMixDigest() *Hash { return &Hash{h.header.MixDigest} } func (h *Header) GetMixDigest() *Hash { return &Hash{h.header.MixDigest} }
func (h *Header) GetNonce() *Nonce { return &Nonce{h.header.Nonce} } func (h *Header) GetNonce() *Nonce { return &Nonce{h.header.Nonce} }
func (h *Header) GetHash() *Hash { return &Hash{h.header.Hash()} } func (h *Header) GetHash() *Hash { return &Hash{h.header.Hash()} }
func (h *Header) GetCodeword() []byte { return h.header.Codeword }
func (h *Header) GetCodeLength() int64 { return int64(h.header.CodeLength) }
// Headers represents a slice of headers. // Headers represents a slice of headers.
type Headers struct{ headers []*types.Header } type Headers struct{ headers []*types.Header }
@ -218,6 +220,8 @@ func (b *Block) GetExtra() []byte { return b.block.Extra() }
func (b *Block) GetMixDigest() *Hash { return &Hash{b.block.MixDigest()} } func (b *Block) GetMixDigest() *Hash { return &Hash{b.block.MixDigest()} }
func (b *Block) GetNonce() int64 { return int64(b.block.Nonce()) } func (b *Block) GetNonce() int64 { return int64(b.block.Nonce()) }
func (b *Block) GetHash() *Hash { return &Hash{b.block.Hash()} } func (b *Block) GetHash() *Hash { return &Hash{b.block.Hash()} }
func (b *Block) GetCodeword() []byte { return b.block.Codeword() }
func (b *Block) GetCodeLength() int64 { return int64(b.block.CodeLength()) }
func (b *Block) GetHeader() *Header { return &Header{b.block.Header()} } func (b *Block) GetHeader() *Header { return &Header{b.block.Header()} }
func (b *Block) GetUncles() *Headers { return &Headers{b.block.Uncles()} } func (b *Block) GetUncles() *Headers { return &Headers{b.block.Uncles()} }
func (b *Block) GetTransactions() *Transactions { return &Transactions{b.block.Transactions()} } func (b *Block) GetTransactions() *Transactions { return &Transactions{b.block.Transactions()} }

View file

@ -290,9 +290,13 @@ func (c *Config) ExtRPCEnabled() bool {
func (c *Config) NodeName() string { func (c *Config) NodeName() string {
name := c.name() name := c.name()
// Backwards compatibility: previous versions used title-cased "Geth", keep that. // Backwards compatibility: previous versions used title-cased "Geth", keep that.
if name == "geth" || name == "geth-testnet" { /*if name == "geth" || name == "geth-testnet" {
name = "Geth" //name = "Geth"
}*/
if name == "worldland" || name == "worldland-testnet" {
name = "Worldland"
} }
if c.UserIdent != "" { if c.UserIdent != "" {
name += "/" + c.UserIdent name += "/" + c.UserIdent
} }

View file

@ -30,6 +30,16 @@ var MainnetBootnodes = []string{
"enode://5d6d7cd20d6da4bb83a1d28cadb5d409b64edf314c0335df658c1a54e32c7c4a7ab7823d57c39b6a757556e68ff1df17c748b698544a55cb488b52479a92b60f@104.42.217.25:30303", // bootnode-azure-westus-001 "enode://5d6d7cd20d6da4bb83a1d28cadb5d409b64edf314c0335df658c1a54e32c7c4a7ab7823d57c39b6a757556e68ff1df17c748b698544a55cb488b52479a92b60f@104.42.217.25:30303", // bootnode-azure-westus-001
"enode://2b252ab6a1d0f971d9722cb839a42cb81db019ba44c08754628ab4a823487071b5695317c8ccd085219c3a03af063495b2f1da8d18218da2d6a82981b45e6ffc@65.108.70.101:30303", // bootnode-hetzner-hel "enode://2b252ab6a1d0f971d9722cb839a42cb81db019ba44c08754628ab4a823487071b5695317c8ccd085219c3a03af063495b2f1da8d18218da2d6a82981b45e6ffc@65.108.70.101:30303", // bootnode-hetzner-hel
"enode://4aeb4ab6c14b23e2c4cfdce879c04b0748a20d8e9b59e25ded2a08143e265c6c25936e74cbc8e641e3312ca288673d91f2f93f8e277de3cfa444ecdaaf982052@157.90.35.166:30303", // bootnode-hetzner-fsn "enode://4aeb4ab6c14b23e2c4cfdce879c04b0748a20d8e9b59e25ded2a08143e265c6c25936e74cbc8e641e3312ca288673d91f2f93f8e277de3cfa444ecdaaf982052@157.90.35.166:30303", // bootnode-hetzner-fsn
"enode://b9c1e675cd63f93f81a0a34f813ca5235fb80b7859cf0f38be7aebaffafa2607c174c7210d650a6fc1c0e7388f8a3c2eb4fa2752ffda878bef712991d4f459c0@54.90.67.185:30303", // bootnode-US EAST(N. Virginia)
"enode://90913f13fb511de0a239ff09dc6b5285bf64246bee591586fb6ab378f777db57751e6c3dc68b5877c60b558bec566f4769ebaa77390123aa48547ea08b08dd80@18.191.247.176:30303", // bootnode-US EAST(Ohio)
"enode://6f20b438f270e58c127cac9be2fb207c4cf46268d77dc441d1f60cdb7dacc9a77d1a32382e3b7fc3e2528b03e844ad05781d1edf4e0cae1d2553c071ae224cfa@54.193.233.245:30303", // bootnode-US WEST(N. California)
"enode://195ce0bebda69801ed2ed7e155e2c94a3332dd8266bd01f8802b9f56b4fbfe7c757cefaae47e83ce02955147c9f9c71b3a5037eba740421e30841ee8e0b7083d@35.88.132.17:30303", // bootnode-US WEST(Oregon)
"enode://fce6be61c4dc6f0cd363bb39382e42e8d27bb482af47e0f4a2e3036428e8a99d12afe8db900c668ad2be154e0811a391263c082e2e68289ad39503a64d8361cc@3.75.87.235:30303", // bootnode-EU Frankfurt
"enode://a3195014477e7035476ce06f763f9f8c949fecdccbe91acd39dca018600ea57d2547607cbd7751ba0e8af10bf89717b5c1cb8ca5704abc27b396ec77c4591041@3.250.170.177:30303", // bootnode-EU Ireland
"enode://60d24b1122f8c3233aa44e18b871a92991f006c463bd199592728eab16ffb28cccd626a80369a59c486195ac126747eb4043791d3fc9aa3b9f979aaafef26b98@18.170.212.3:30303", // bootnode-EU London
"enode://4f0f2a5d723f46b93bf258eff8febfc88a20ccd007218a168b53057852446ccb4614c7e53549163faa1212f2a211dcd42aa9d060c6bd7243b470ca7db73b52d8@35.180.65.141:30303", // bootnode-EU Paris
"enode://df4d94020b1f9b024aa2f0e6bf785b3895290247c8a34d3b1b7f5cc626d70d1a7112c52b650794319963247ca2547acd97adbc23dc5b7c27cdbcc8adb5dfe6e3@13.48.248.67:30303", // bootnode-EU Stockholm
} }
// RopstenBootnodes are the enode URLs of the P2P bootstrap nodes running on the // RopstenBootnodes are the enode URLs of the P2P bootstrap nodes running on the
@ -58,6 +68,39 @@ var RinkebyBootnodes = []string{
"enode://b6b28890b006743680c52e64e0d16db57f28124885595fa03a562be1d2bf0f3a1da297d56b13da25fb992888fd556d4c1a27b1f39d531bde7de1921c90061cc6@159.89.28.211:30303", // AKASHA "enode://b6b28890b006743680c52e64e0d16db57f28124885595fa03a562be1d2bf0f3a1da297d56b13da25fb992888fd556d4c1a27b1f39d531bde7de1921c90061cc6@159.89.28.211:30303", // AKASHA
} }
// LveBootnodes are the enode URLs of the P2P bootstrap nodes running on the
// Lve network.
var LveBootnodes = []string{
"enode://cf69273d0e4514ab18e17c154b0fed66a8a91ebf25b36cced53bcd530cf4cd032c4b14801f692719abe2ebf84d454ee453775bb76ec3c49c440d359a16b24c50@43.200.141.6:30303",
"enode://922cc8c431841ba4742b8434cd79b76b1952eb8a4ee04dc2c34cb5887d781cb857c39fc2292d0aa08cff7c1ae135ad12d78ec245a35babf4a7af16564ce01a44@35.76.71.80:30301",
"enode://11d3dafc1773cdf6cea238dc649ea6f9b4b3b793315b71b8f37814510413ab6778dc5b1a67b904336fda3e9886248c7a4312911fea79e35763db44b50d1ed0a6@3.39.197.118:30303",
"enode://e4f833468b61c913c932e7b28bd7d6e7c9e5ff7210455d217e74fb1fe0a7605e7d860765685257a3ed0204bb52c6d20b6c74e468d9c2ea174ffab82ec6dcfc40@3.39.39.150:30303",
"enode://c7d8921a939fba36b440ba2bf890013aec7c9236464a616bc812108ed42932f5e15eecc036a5f94912665225b3afb606402331f77b847cb64149b1462518250b@3.36.252.183:30303",
"enode://11692b68fef3db3feb495a5bfd0796fc3863e726e241dfe452c4835342ccbc8f560a4977ae3d4e794e92d5925540eabdec407f6386239b5dec699d9ab4a8464f@3.1.96.244:30303",
"enode://adbe0b88a3cb886583ab77e2d7ec96110642bd163f76303e82a7f5355a707d970e906308fde226c2d98ce8057f22bb40adb2f270df357428f78668d25e5366ec@13.215.97.146:30303",
}
// SeoulBootnodes are the enode URLs of the P2P bootstrap nodes running on the
// Seoul network.
var SeoulBootnodes = []string{
"enode://551bb6345ee3ffac9ea202f01043de80d1481bc56e717ce521452f98b26d6aa00a817518c33ceea8b0b07deef9752acae4fcd284599cfbba73d80e94ba8d0278@3.39.197.118:30303",
"enode://89d5457f55c596253c8c5679ba3fa8b15109073cf9b25de0fb5630a1c8eaee8b3fecf0adfc79ba0f7cb8dd9c59706d33cc7688598e9c324b163b8494b781506d@18.141.201.245:30303",
"enode://4f83cbe244e3af619f1001e9190f45d7c251f5811a18ce6fd66be9dd5d6213e5977b7d69497b6fdef0181c87a6830198faef238d3510ce5187d6bd4bdaa8261a@13.200.114.1:30303",
"enode://21da5ff755a2413870ae4f81cc50fbc7d7dbaefe1d7ca76f8e365f3f214bfad02cd51d77e21759956ea8ea55156ee92ce60224b0fc763fa0412e68adc2e6dd49@13.209.255.10:30303",
"enode://bdc60856dc70a150a482e6b23abcbe6e19bdfd30e72b093a4362bfee9c4c6c401b9c020257ae8aa7cb23855d92167f91624f45a0ddaacebfbe53f528ed69180d@43.200.141.6:30303",
"enode://df1dc98b1c43f0eaf81826014918e919393ce4d7bcdc0ab1dc11ac506ee73346cd60a85b93057d135836aa7984a94a729e684ebaf1a169c2280a129372614203@3.36.213.125:30303",
"enode://e81977baa0bc991dec2f314924cbdaf1ed6516d9156677cfef56cef2585e18928bd68abab78ca31af6bac11059780ed503bf963842f748eb8668c5b97807ebf5@52.78.15.179:30303",
}
// Gwangju Bootnodes are the enode URLs of the P2P bootstrap nodes running on the
// Gwangju network.
var GwangjuBootnodes = []string{
"enode://4f4be8c67ac7b1fcfceb21a374a62c68f7f0528988f3b3d322bd6d94aeb745667f0c8e847881bbaeeba52eb1d346166301243222d5e22dd16ce70c57214178ca@43.200.52.189:30303",
"enode://bbbf2734ce12b7aa258dd1e92e9cec7ea6b2ca6766f5741272c934904f3d182e08688aef3a368684c4c06b6adc2711c51e517bb9033824b2816c9d038c256cf9@3.36.252.183:30303",
"enode://911771c7894782bced03377a13f1d8a4e8450d05e03eabab1d6daae70e1b91b6074c346d42ac4fae53d98d273efedd6cdd37d2f6715302de9736b29cc4aa7da2@13.250.246.202:30303",
}
// GoerliBootnodes are the enode URLs of the P2P bootstrap nodes running on the // GoerliBootnodes are the enode URLs of the P2P bootstrap nodes running on the
// Görli test network. // Görli test network.
var GoerliBootnodes = []string{ var GoerliBootnodes = []string{
@ -118,6 +161,12 @@ func KnownDNSNetwork(genesis common.Hash, protocol string) string {
net = "goerli" net = "goerli"
case SepoliaGenesisHash: case SepoliaGenesisHash:
net = "sepolia" net = "sepolia"
case LveGenesisHash:
net = "lve"
case GwangjuGenesisHash:
net = "gwangju"
case SeoulGenesisHash:
net = "seoul"
default: default:
return "" return ""
} }

View file

@ -33,6 +33,10 @@ var (
RinkebyGenesisHash = common.HexToHash("0x6341fd3daf94b748c72ced5a5b26028f2474f5f00d824504e4fa37a75767e177") RinkebyGenesisHash = common.HexToHash("0x6341fd3daf94b748c72ced5a5b26028f2474f5f00d824504e4fa37a75767e177")
GoerliGenesisHash = common.HexToHash("0xbf7e331f7f7c1dd2e05159666b3bf8bc7a8a3a9eb1d518969eab529dd9b88c1a") GoerliGenesisHash = common.HexToHash("0xbf7e331f7f7c1dd2e05159666b3bf8bc7a8a3a9eb1d518969eab529dd9b88c1a")
KilnGenesisHash = common.HexToHash("0x51c7fe41be669f69c45c33a56982cbde405313342d9e2b00d7c91a7b284dd4f8") KilnGenesisHash = common.HexToHash("0x51c7fe41be669f69c45c33a56982cbde405313342d9e2b00d7c91a7b284dd4f8")
LveGenesisHash = common.HexToHash("0x7c5cb1a45d2424a2be1155c22979bbe384aff07810260041d5609a87bc3c58cc")
SeoulGenesisHash = common.HexToHash("0x5bd83be2a4c3a01b45e48fe181de1e6173d92cf5b54790fe64962dd2a7f25abb")
GwangjuGenesisHash = common.HexToHash("0x64130a2624d46bda6aacf0c1ec34ab3d926e31b8438141a10e7412070064f0bf")
) )
// TrustedCheckpoints associates each known checkpoint with the genesis hash of // TrustedCheckpoints associates each known checkpoint with the genesis hash of
@ -43,6 +47,10 @@ var TrustedCheckpoints = map[common.Hash]*TrustedCheckpoint{
SepoliaGenesisHash: SepoliaTrustedCheckpoint, SepoliaGenesisHash: SepoliaTrustedCheckpoint,
RinkebyGenesisHash: RinkebyTrustedCheckpoint, RinkebyGenesisHash: RinkebyTrustedCheckpoint,
GoerliGenesisHash: GoerliTrustedCheckpoint, GoerliGenesisHash: GoerliTrustedCheckpoint,
//LveGenesisHash: LveTrustedCheckpoint,
//SeoulGenesisHash: SeoulTrustedCheckpoint,
//GwangjuGenesisHash: GwangjuTrustedCheckpoint,
} }
// CheckpointOracles associates each known checkpoint oracles with the genesis hash of // CheckpointOracles associates each known checkpoint oracles with the genesis hash of
@ -52,11 +60,15 @@ var CheckpointOracles = map[common.Hash]*CheckpointOracleConfig{
RopstenGenesisHash: RopstenCheckpointOracle, RopstenGenesisHash: RopstenCheckpointOracle,
RinkebyGenesisHash: RinkebyCheckpointOracle, RinkebyGenesisHash: RinkebyCheckpointOracle,
GoerliGenesisHash: GoerliCheckpointOracle, GoerliGenesisHash: GoerliCheckpointOracle,
//update
//LveGenesisHash: LveCheckpointOracle,
//SeoulGenesisHash: SeoulCheckpointOracle,
//GwangjuGenesisHash: GwangjuCheckpointOracle,
} }
var ( var (
MainnetTerminalTotalDifficulty, _ = new(big.Int).SetString("58_750_000_000_000_000_000_000", 0) MainnetTerminalTotalDifficulty, _ = new(big.Int).SetString("58_750_000_000_000_000_000_000", 0)
// MainnetChainConfig is the chain parameters to run a node on the main network. // MainnetChainConfig is the chain parameters to run a node on the main network.
MainnetChainConfig = &ChainConfig{ MainnetChainConfig = &ChainConfig{
ChainID: big.NewInt(1), ChainID: big.NewInt(1),
@ -75,9 +87,12 @@ var (
BerlinBlock: big.NewInt(12_244_000), BerlinBlock: big.NewInt(12_244_000),
LondonBlock: big.NewInt(12_965_000), LondonBlock: big.NewInt(12_965_000),
ArrowGlacierBlock: big.NewInt(13_773_000), ArrowGlacierBlock: big.NewInt(13_773_000),
GrayGlacierBlock: big.NewInt(15_050_000), //GrayGlacierBlock: big.NewInt(15_050_000),
//WorldlandBlock: big.NewInt(15_500_000),
TerminalTotalDifficulty: MainnetTerminalTotalDifficulty, // 58_750_000_000_000_000_000_000 TerminalTotalDifficulty: MainnetTerminalTotalDifficulty, // 58_750_000_000_000_000_000_000
Ethash: new(EthashConfig), Ethash: new(EthashConfig),
//working...
Eccpow: new(EccpowConfig),
} }
// MainnetTrustedCheckpoint contains the light client trusted checkpoint for the main network. // MainnetTrustedCheckpoint contains the light client trusted checkpoint for the main network.
@ -264,22 +279,193 @@ var (
Threshold: 2, Threshold: 2,
} }
// LveChainConfig contains the chain parameters to run a node on the Görli test network.
LveChainConfig = &ChainConfig{
ChainID: big.NewInt(12345),
HomesteadBlock: big.NewInt(0),
EIP150Block: big.NewInt(0),
EIP150Hash: common.HexToHash("0x0000000000000000000000000000000000000000000000000000000000000000"),
EIP155Block: big.NewInt(0),
EIP158Block: big.NewInt(0),
ByzantiumBlock: big.NewInt(0),
ConstantinopleBlock: big.NewInt(0),
PetersburgBlock: big.NewInt(0),
IstanbulBlock: big.NewInt(0),
MuirGlacierBlock: nil,
BerlinBlock: big.NewInt(0),
LondonBlock: big.NewInt(0),
//SeoulBlock: big.NewInt(220000),
ArrowGlacierBlock: nil,
GrayGlacierBlock: nil,
Eccpow: new(EccpowConfig),
}
/*
// LveTrustedCheckpoint contains the light client trusted checkpoint for the Görli test network.
LveTrustedCheckpoint = &TrustedCheckpoint{
SectionIndex: 32,
SectionHead: common.HexToHash("0x50eaedd8361fa9edd0ac2dec410310b9bdf67b963b60f3b1dce47f84b30670f9"),
CHTRoot: common.HexToHash("0x6504db73139f75ffa9102ae980e41b361cf3d5b66cea06c79cde9f457368820c"),
BloomRoot: common.HexToHash("0x7551ae027bb776252a20ded51ee2ff0cbfbd1d8d57261b9161cc1f2f80237001"),
}
// LveCheckpointOracle contains a set of configs for the Lve test network oracle.
LveCheckpointOracle = &CheckpointOracleConfig{
Address: common.HexToAddress("0x18CA0E045F0D772a851BC7e48357Bcaab0a0795D"),
Signers: []common.Address{
common.HexToAddress("0x4769bcaD07e3b938B7f43EB7D278Bc7Cb9efFb38"), // Peter
common.HexToAddress("0x78d1aD571A1A09D60D9BBf25894b44e4C8859595"), // Martin
common.HexToAddress("0x286834935f4A8Cfb4FF4C77D5770C2775aE2b0E7"), // Zsolt
common.HexToAddress("0xb86e2B0Ab5A4B1373e40c51A7C712c70Ba2f9f8E"), // Gary
common.HexToAddress("0x0DF8fa387C602AE62559cC4aFa4972A7045d6707"), // Guillaume
},
Threshold: 2,
}*/
SeoulChainConfig = &ChainConfig{
ChainID: big.NewInt(103),
HomesteadBlock: big.NewInt(0),
DAOForkBlock: nil,
DAOForkSupport: true,
EIP150Block: big.NewInt(0),
EIP155Block: big.NewInt(0),
EIP158Block: big.NewInt(0),
ByzantiumBlock: big.NewInt(0),
ConstantinopleBlock: big.NewInt(0),
PetersburgBlock: big.NewInt(0),
IstanbulBlock: big.NewInt(0),
BerlinBlock: big.NewInt(0),
LondonBlock: big.NewInt(0),
WorldlandBlock: big.NewInt(0),
SeoulBlock: big.NewInt(0),
HalvingEndTime: big.NewInt(25228800),
Eccpow: new(EccpowConfig),
}
/* SeoulTrustedCheckpoint contains the light client trusted checkpoint for the Görli test network.
SeoulTrustedCheckpoint = &TrustedCheckpoint{
SectionIndex: 32,
SectionHead: common.HexToHash("0x50eaedd8361fa9edd0ac2dec410310b9bdf67b963b60f3b1dce47f84b30670f9"),
CHTRoot: common.HexToHash("0x6504db73139f75ffa9102ae980e41b361cf3d5b66cea06c79cde9f457368820c"),
BloomRoot: common.HexToHash("0x7551ae027bb776252a20ded51ee2ff0cbfbd1d8d57261b9161cc1f2f80237001"),
}
// SeoulCheckpointOracle contains a set of configs for the Lve test network oracle.
SeoulCheckpointOracle = &CheckpointOracleConfig{
Address: common.HexToAddress("0x18CA0E045F0D772a851BC7e48357Bcaab0a0795D"),
Signers: []common.Address{
common.HexToAddress("0x4769bcaD07e3b938B7f43EB7D278Bc7Cb9efFb38"), // Peter
common.HexToAddress("0x78d1aD571A1A09D60D9BBf25894b44e4C8859595"), // Martin
common.HexToAddress("0x286834935f4A8Cfb4FF4C77D5770C2775aE2b0E7"), // Zsolt
common.HexToAddress("0xb86e2B0Ab5A4B1373e40c51A7C712c70Ba2f9f8E"), // Gary
common.HexToAddress("0x0DF8fa387C602AE62559cC4aFa4972A7045d6707"), // Guillaume
},
Threshold: 2,
}*/
GwangjuChainConfig = &ChainConfig{
ChainID: big.NewInt(10395),
HomesteadBlock: big.NewInt(0),
DAOForkBlock: nil,
DAOForkSupport: true,
EIP150Block: big.NewInt(0),
EIP155Block: big.NewInt(0),
EIP158Block: big.NewInt(0),
ByzantiumBlock: big.NewInt(0),
ConstantinopleBlock: big.NewInt(0),
PetersburgBlock: big.NewInt(0),
IstanbulBlock: big.NewInt(0),
BerlinBlock: big.NewInt(0),
LondonBlock: big.NewInt(0),
WorldlandBlock: big.NewInt(0),
SeoulBlock: big.NewInt(0),
HalvingEndTime: big.NewInt(25228800),
Eccpow: new(EccpowConfig),
}
/* SeoulTrustedCheckpoint contains the light client trusted checkpoint for the Görli test network.
SeoulTrustedCheckpoint = &TrustedCheckpoint{
SectionIndex: 32,
SectionHead: common.HexToHash("0x50eaedd8361fa9edd0ac2dec410310b9bdf67b963b60f3b1dce47f84b30670f9"),
CHTRoot: common.HexToHash("0x6504db73139f75ffa9102ae980e41b361cf3d5b66cea06c79cde9f457368820c"),
BloomRoot: common.HexToHash("0x7551ae027bb776252a20ded51ee2ff0cbfbd1d8d57261b9161cc1f2f80237001"),
}
// SeoulCheckpointOracle contains a set of configs for the Lve test network oracle.
SeoulCheckpointOracle = &CheckpointOracleConfig{
Address: common.HexToAddress("0x18CA0E045F0D772a851BC7e48357Bcaab0a0795D"),
Signers: []common.Address{
common.HexToAddress("0x4769bcaD07e3b938B7f43EB7D278Bc7Cb9efFb38"), // Peter
common.HexToAddress("0x78d1aD571A1A09D60D9BBf25894b44e4C8859595"), // Martin
common.HexToAddress("0x286834935f4A8Cfb4FF4C77D5770C2775aE2b0E7"), // Zsolt
common.HexToAddress("0xb86e2B0Ab5A4B1373e40c51A7C712c70Ba2f9f8E"), // Gary
common.HexToAddress("0x0DF8fa387C602AE62559cC4aFa4972A7045d6707"), // Guillaume
},
Threshold: 2,
}*/
/*
WorldlandtestChainConfig = &ChainConfig{
ChainID: big.NewInt(1), //10001
HomesteadBlock: big.NewInt(1_150_000),
DAOForkBlock: big.NewInt(1_920_000),
DAOForkSupport: true,
EIP150Block: big.NewInt(2_463_000),
EIP150Hash: common.HexToHash("0x2086799aeebeae135c246c65021c82b4e15a2c451340993aacfd2751886514f0"),
EIP155Block: big.NewInt(2_675_000),
EIP158Block: big.NewInt(2_675_000),
ByzantiumBlock: big.NewInt(4_370_000),
ConstantinopleBlock: big.NewInt(7_280_000),
PetersburgBlock: big.NewInt(7_280_000),
IstanbulBlock: big.NewInt(9_069_000),
MuirGlacierBlock: big.NewInt(9_200_000),
BerlinBlock: big.NewInt(12_244_000),
LondonBlock: big.NewInt(12_965_000),
ArrowGlacierBlock: big.NewInt(13_773_000),
GrayGlacierBlock: big.NewInt(15_050_000),
//EthPoWForkBlock: big.NewInt(15_537_394),
//EthPoWForkSupport: true,
//ChainID_ALT: big.NewInt(10001), //10001
TerminalTotalDifficulty: nil, // 58_750_000_000_000_000_000_000
Ethash: new(EthashConfig),
}
// MainnetTrustedCheckpoint contains the light client trusted checkpoint for the main network.
WorldlandtestTrustedCheckpoint = &TrustedCheckpoint{
SectionIndex: 451,
SectionHead: common.HexToHash("0xe47f84b9967eb2ad2afff74d59901b63134660011822fdababaf8fdd18a75aa6"),
CHTRoot: common.HexToHash("0xc31e0462ca3d39a46111bb6b63ac4e1cac84089472b7474a319d582f72b3f0c0"),
BloomRoot: common.HexToHash("0x7c9f25ce3577a3ab330d52a7343f801899cf9d4980c69f81de31ccc1a055c809"),
}
// MainnetCheckpointOracle contains a set of configs for the main network oracle.
WorldlandtestCheckpointOracle = &CheckpointOracleConfig{
Address: common.HexToAddress("0x9a9070028361F7AAbeB3f2F2Dc07F82C4a98A02a"),
Signers: []common.Address{
common.HexToAddress("0x1b2C260efc720BE89101890E4Db589b44E950527"), // Peter
common.HexToAddress("0x78d1aD571A1A09D60D9BBf25894b44e4C8859595"), // Martin
common.HexToAddress("0x286834935f4A8Cfb4FF4C77D5770C2775aE2b0E7"), // Zsolt
common.HexToAddress("0xb86e2B0Ab5A4B1373e40c51A7C712c70Ba2f9f8E"), // Gary
common.HexToAddress("0x0DF8fa387C602AE62559cC4aFa4972A7045d6707"), // Guillaume
},
Threshold: 2,
}*/
// AllEthashProtocolChanges contains every protocol change (EIPs) introduced // AllEthashProtocolChanges contains every protocol change (EIPs) introduced
// and accepted by the Ethereum core developers into the Ethash consensus. // and accepted by the Ethereum core developers into the Ethash consensus.
// //
// This configuration is intentionally not using keyed fields to force anyone // This configuration is intentionally not using keyed fields to force anyone
// adding flags to the config to also have to set these fields. // adding flags to the config to also have to set these fields.
AllEthashProtocolChanges = &ChainConfig{big.NewInt(1337), big.NewInt(0), nil, false, big.NewInt(0), common.Hash{}, big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), nil, nil, nil, nil, false, new(EthashConfig), nil} AllEthashProtocolChanges = &ChainConfig{big.NewInt(1337), big.NewInt(0), nil, false, big.NewInt(0), common.Hash{}, big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), nil, nil, nil, nil, nil, nil, nil, false, new(EthashConfig), nil, nil}
// AllCliqueProtocolChanges contains every protocol change (EIPs) introduced // AllCliqueProtocolChanges contains every protocol change (EIPs) introduced
// and accepted by the Ethereum core developers into the Clique consensus. // and accepted by the Ethereum core developers into the Clique consensus.
// //
// This configuration is intentionally not using keyed fields to force anyone // This configuration is intentionally not using keyed fields to force anyone
// adding flags to the config to also have to set these fields. // adding flags to the config to also have to set these fields.
AllCliqueProtocolChanges = &ChainConfig{big.NewInt(1337), big.NewInt(0), nil, false, big.NewInt(0), common.Hash{}, big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), nil, nil, nil, nil, nil, nil, false, nil, &CliqueConfig{Period: 0, Epoch: 30000}} AllCliqueProtocolChanges = &ChainConfig{big.NewInt(1337), big.NewInt(0), nil, false, big.NewInt(0), common.Hash{}, big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), nil, nil, nil, nil, nil, nil, nil, nil, nil, false, nil, &CliqueConfig{Period: 0, Epoch: 30000}, nil}
TestChainConfig = &ChainConfig{big.NewInt(1), big.NewInt(0), nil, false, big.NewInt(0), common.Hash{}, big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), nil, nil, nil, nil, false, new(EthashConfig), nil} TestChainConfig = &ChainConfig{big.NewInt(1), big.NewInt(0), nil, false, big.NewInt(0), common.Hash{}, big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), nil, nil, nil, nil, nil, nil, nil, false, new(EthashConfig), nil, nil}
NonActivatedConfig = &ChainConfig{big.NewInt(1), nil, nil, false, nil, common.Hash{}, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, false, new(EthashConfig), nil} //NonActivatedConfig = &ChainConfig{big.NewInt(1), nil, nil, false, nil, common.Hash{}, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, false, new(EthashConfig), nil, nil}
TestRules = TestChainConfig.Rules(new(big.Int), false) TestRules = TestChainConfig.Rules(new(big.Int), false)
) )
@ -290,6 +476,9 @@ var NetworkNames = map[string]string{
RinkebyChainConfig.ChainID.String(): "rinkeby", RinkebyChainConfig.ChainID.String(): "rinkeby",
GoerliChainConfig.ChainID.String(): "goerli", GoerliChainConfig.ChainID.String(): "goerli",
SepoliaChainConfig.ChainID.String(): "sepolia", SepoliaChainConfig.ChainID.String(): "sepolia",
LveChainConfig.ChainID.String(): "lve",
SeoulChainConfig.ChainID.String(): "seoul",
GwangjuChainConfig.ChainID.String(): "gwangju",
} }
// TrustedCheckpoint represents a set of post-processed trie roots (CHT and // TrustedCheckpoint represents a set of post-processed trie roots (CHT and
@ -373,6 +562,10 @@ type ChainConfig struct {
ShanghaiBlock *big.Int `json:"shanghaiBlock,omitempty"` // Shanghai switch block (nil = no fork, 0 = already on shanghai) ShanghaiBlock *big.Int `json:"shanghaiBlock,omitempty"` // Shanghai switch block (nil = no fork, 0 = already on shanghai)
CancunBlock *big.Int `json:"cancunBlock,omitempty"` // Cancun switch block (nil = no fork, 0 = already on cancun) CancunBlock *big.Int `json:"cancunBlock,omitempty"` // Cancun switch block (nil = no fork, 0 = already on cancun)
WorldlandBlock *big.Int `json:"worldlandBlock,omitempty"` // worldrand switch block (nil = no fork, 0 = already on worldland)
HalvingEndTime *big.Int `json:"HalvingEndTime,omitempty"`
SeoulBlock *big.Int `json:"seoulBlock,omitempty"`
// TerminalTotalDifficulty is the amount of total difficulty reached by // TerminalTotalDifficulty is the amount of total difficulty reached by
// the network that triggers the consensus upgrade. // the network that triggers the consensus upgrade.
TerminalTotalDifficulty *big.Int `json:"terminalTotalDifficulty,omitempty"` TerminalTotalDifficulty *big.Int `json:"terminalTotalDifficulty,omitempty"`
@ -385,16 +578,25 @@ type ChainConfig struct {
// Various consensus engines // Various consensus engines
Ethash *EthashConfig `json:"ethash,omitempty"` Ethash *EthashConfig `json:"ethash,omitempty"`
Clique *CliqueConfig `json:"clique,omitempty"` Clique *CliqueConfig `json:"clique,omitempty"`
Eccpow *EccpowConfig `json:"eccpow,omitempty"`
} }
// EthashConfig is the consensus engine configs for proof-of-work based sealing. // EthashConfig is the consensus engine configs for proof-of-work based sealing.
type EthashConfig struct{} type EthashConfig struct{}
// EccpowConfig is the consensus engine configs for proof-of-work based sealing.
type EccpowConfig struct{}
// String implements the stringer interface, returning the consensus engine details. // String implements the stringer interface, returning the consensus engine details.
func (c *EthashConfig) String() string { func (c *EthashConfig) String() string {
return "ethash" return "ethash"
} }
// String implements the stringer interface, returning the consensus engine details.
func (c *EccpowConfig) String() string {
return "eccpow"
}
// CliqueConfig is the consensus engine configs for proof-of-authority based sealing. // CliqueConfig is the consensus engine configs for proof-of-authority based sealing.
type CliqueConfig struct { type CliqueConfig struct {
Period uint64 `json:"period"` // Number of seconds between blocks to enforce Period uint64 `json:"period"` // Number of seconds between blocks to enforce
@ -433,15 +635,23 @@ func (c *ChainConfig) String() string {
} else { } else {
banner += "Consensus: Beacon (proof-of-stake), merged from Clique (proof-of-authority)\n" banner += "Consensus: Beacon (proof-of-stake), merged from Clique (proof-of-authority)\n"
} }
case c.Eccpow != nil:
if c.TerminalTotalDifficulty == nil {
banner += "Consensus: Eccpow (proof-of-work)\n"
} else if !c.TerminalTotalDifficultyPassed {
banner += "Consensus: Beacon (proof-of-stake), merging from Eccpow (proof-of-work)\n"
} else {
banner += "Consensus: Beacon (proof-of-stake), merged from Eccpow (proof-of-work)\n"
}
default: default:
banner += "Consensus: unknown\n" banner += "Consensus: unknown\n"
} }
banner += "\n" //banner += "\n"
// Create a list of forks with a short description of them. Forks that only // Create a list of forks with a short description of them. Forks that only
// makes sense for mainnet should be optional at printing to avoid bloating // makes sense for mainnet should be optional at printing to avoid bloating
// the output for testnets and private networks. // the output for testnets and private networks.
banner += "Pre-Merge hard forks:\n" /*banner += "Hard forks:\n"
banner += fmt.Sprintf(" - Homestead: %-8v (https://github.com/ethereum/execution-specs/blob/master/network-upgrades/mainnet-upgrades/homestead.md)\n", c.HomesteadBlock) banner += fmt.Sprintf(" - Homestead: %-8v (https://github.com/ethereum/execution-specs/blob/master/network-upgrades/mainnet-upgrades/homestead.md)\n", c.HomesteadBlock)
if c.DAOForkBlock != nil { if c.DAOForkBlock != nil {
banner += fmt.Sprintf(" - DAO Fork: %-8v (https://github.com/ethereum/execution-specs/blob/master/network-upgrades/mainnet-upgrades/dao-fork.md)\n", c.DAOForkBlock) banner += fmt.Sprintf(" - DAO Fork: %-8v (https://github.com/ethereum/execution-specs/blob/master/network-upgrades/mainnet-upgrades/dao-fork.md)\n", c.DAOForkBlock)
@ -457,7 +667,8 @@ func (c *ChainConfig) String() string {
banner += fmt.Sprintf(" - Muir Glacier: %-8v (https://github.com/ethereum/execution-specs/blob/master/network-upgrades/mainnet-upgrades/muir-glacier.md)\n", c.MuirGlacierBlock) banner += fmt.Sprintf(" - Muir Glacier: %-8v (https://github.com/ethereum/execution-specs/blob/master/network-upgrades/mainnet-upgrades/muir-glacier.md)\n", c.MuirGlacierBlock)
} }
banner += fmt.Sprintf(" - Berlin: %-8v (https://github.com/ethereum/execution-specs/blob/master/network-upgrades/mainnet-upgrades/berlin.md)\n", c.BerlinBlock) banner += fmt.Sprintf(" - Berlin: %-8v (https://github.com/ethereum/execution-specs/blob/master/network-upgrades/mainnet-upgrades/berlin.md)\n", c.BerlinBlock)
banner += fmt.Sprintf(" - London: %-8v (https://github.com/ethereum/execution-specs/blob/master/network-upgrades/mainnet-upgrades/london.md)\n", c.LondonBlock) banner += fmt.Sprintf("...\n")
banner += fmt.Sprintf(" - London: %-8v\n", c.LondonBlock)
if c.ArrowGlacierBlock != nil { if c.ArrowGlacierBlock != nil {
banner += fmt.Sprintf(" - Arrow Glacier: %-8v (https://github.com/ethereum/execution-specs/blob/master/network-upgrades/mainnet-upgrades/arrow-glacier.md)\n", c.ArrowGlacierBlock) banner += fmt.Sprintf(" - Arrow Glacier: %-8v (https://github.com/ethereum/execution-specs/blob/master/network-upgrades/mainnet-upgrades/arrow-glacier.md)\n", c.ArrowGlacierBlock)
} }
@ -469,11 +680,18 @@ func (c *ChainConfig) String() string {
} }
if c.CancunBlock != nil { if c.CancunBlock != nil {
banner += fmt.Sprintf(" - Cancun: %-8v\n", c.CancunBlock) banner += fmt.Sprintf(" - Cancun: %-8v\n", c.CancunBlock)
}*/
/*
if c.WorldlandBlock != nil {
banner += fmt.Sprintf(" - Worldland: %-8v\n", c.WorldlandBlock)
}
if c.SeoulBlock != nil {
banner += fmt.Sprintf(" - Seoul: %-8v\n", c.SeoulBlock)
} }
banner += "\n" banner += "\n"
*/
// Add a special section for the merge as it's non-obvious // Add a special section for the merge as it's non-obvious
if c.TerminalTotalDifficulty == nil { /*if c.TerminalTotalDifficulty == nil {
banner += "The Merge is not yet available for this network!\n" banner += "The Merge is not yet available for this network!\n"
banner += " - Hard-fork specification: https://github.com/ethereum/execution-specs/blob/master/network-upgrades/mainnet-upgrades/paris.md" banner += " - Hard-fork specification: https://github.com/ethereum/execution-specs/blob/master/network-upgrades/mainnet-upgrades/paris.md"
} else { } else {
@ -482,7 +700,7 @@ func (c *ChainConfig) String() string {
banner += fmt.Sprintf(" - Network known to be merged: %v\n", c.TerminalTotalDifficultyPassed) banner += fmt.Sprintf(" - Network known to be merged: %v\n", c.TerminalTotalDifficultyPassed)
banner += fmt.Sprintf(" - Total terminal difficulty: %v\n", c.TerminalTotalDifficulty) banner += fmt.Sprintf(" - Total terminal difficulty: %v\n", c.TerminalTotalDifficulty)
banner += fmt.Sprintf(" - Merge netsplit block: %-8v", c.MergeNetsplitBlock) banner += fmt.Sprintf(" - Merge netsplit block: %-8v", c.MergeNetsplitBlock)
} }*/
return banner return banner
} }
@ -576,6 +794,29 @@ func (c *ChainConfig) IsCancun(num *big.Int) bool {
return isForked(c.CancunBlock, num) return isForked(c.CancunBlock, num)
} }
// IsWorldland returns whether num is either equ`al to the Worldland fork block or greater.
func (c *ChainConfig) IsWorldland(num *big.Int) bool {
return isForked(c.WorldlandBlock, num)
}
// IsWorldlandMerge returns whether num is either equal to the Worldland fork block.
func (c *ChainConfig) IsWorldlandMerge(num *big.Int) bool {
return isMerged(c.WorldlandBlock, num)
}
func (c *ChainConfig) IsWorldLandHalving(num *big.Int) bool {
return isHalving(c.HalvingEndTime, num)
}
func (c *ChainConfig) IsWorldLandMaturity(num *big.Int) bool {
return isMatured(c.HalvingEndTime, num)
}
// IsSeoul returns whether num is either equ`al to the Seoul fork block or greater.
func (c *ChainConfig) IsSeoul(num *big.Int) bool {
return isForked(c.SeoulBlock, num)
}
// CheckCompatible checks whether scheduled fork transitions have been imported // CheckCompatible checks whether scheduled fork transitions have been imported
// with a mismatching chain configuration. // with a mismatching chain configuration.
func (c *ChainConfig) CheckCompatible(newcfg *ChainConfig, height uint64) *ConfigCompatError { func (c *ChainConfig) CheckCompatible(newcfg *ChainConfig, height uint64) *ConfigCompatError {
@ -621,6 +862,8 @@ func (c *ChainConfig) CheckConfigForkOrder() error {
{name: "mergeNetsplitBlock", block: c.MergeNetsplitBlock, optional: true}, {name: "mergeNetsplitBlock", block: c.MergeNetsplitBlock, optional: true},
{name: "shanghaiBlock", block: c.ShanghaiBlock, optional: true}, {name: "shanghaiBlock", block: c.ShanghaiBlock, optional: true},
{name: "cancunBlock", block: c.CancunBlock, optional: true}, {name: "cancunBlock", block: c.CancunBlock, optional: true},
{name: "worldlandBlock", block: c.WorldlandBlock, optional: true},
{name: "seoulBlock", block: c.SeoulBlock, optional: true},
} { } {
if lastFork.name != "" { if lastFork.name != "" {
// Next one must be higher number // Next one must be higher number
@ -705,6 +948,12 @@ func (c *ChainConfig) checkCompatible(newcfg *ChainConfig, head *big.Int) *Confi
if isForkIncompatible(c.CancunBlock, newcfg.CancunBlock, head) { if isForkIncompatible(c.CancunBlock, newcfg.CancunBlock, head) {
return newCompatError("Cancun fork block", c.CancunBlock, newcfg.CancunBlock) return newCompatError("Cancun fork block", c.CancunBlock, newcfg.CancunBlock)
} }
if isForkIncompatible(c.WorldlandBlock, newcfg.WorldlandBlock, head) {
return newCompatError("Worldland fork block", c.WorldlandBlock, newcfg.WorldlandBlock)
}
if isForkIncompatible(c.SeoulBlock, newcfg.SeoulBlock, head) {
return newCompatError("Seoul fork block", c.SeoulBlock, newcfg.SeoulBlock)
}
return nil return nil
} }
@ -722,6 +971,28 @@ func isForked(s, head *big.Int) bool {
return s.Cmp(head) <= 0 return s.Cmp(head) <= 0
} }
// isMerged
func isMerged(s, head *big.Int) bool {
if s == nil || head == nil {
return false
}
return s.Cmp(head) == 0
}
func isHalving(HalvingEndTime, head *big.Int) bool {
if HalvingEndTime == nil || head == nil {
return false
}
return HalvingEndTime.Cmp(head) >= 0
}
func isMatured(HalvingEndTime, head *big.Int) bool {
if HalvingEndTime == nil || head == nil {
return false
}
return HalvingEndTime.Cmp(head) < 0
}
func configNumEqual(x, y *big.Int) bool { func configNumEqual(x, y *big.Int) bool {
if x == nil { if x == nil {
return y == nil return y == nil
@ -774,6 +1045,8 @@ type Rules struct {
IsByzantium, IsConstantinople, IsPetersburg, IsIstanbul bool IsByzantium, IsConstantinople, IsPetersburg, IsIstanbul bool
IsBerlin, IsLondon bool IsBerlin, IsLondon bool
IsMerge, IsShanghai, isCancun bool IsMerge, IsShanghai, isCancun bool
IsWorldland bool
IsSeoul bool
} }
// Rules ensures c's ChainID is not nil. // Rules ensures c's ChainID is not nil.
@ -797,5 +1070,7 @@ func (c *ChainConfig) Rules(num *big.Int, isMerge bool) Rules {
IsMerge: isMerge, IsMerge: isMerge,
IsShanghai: c.IsShanghai(num), IsShanghai: c.IsShanghai(num),
isCancun: c.IsCancun(num), isCancun: c.IsCancun(num),
IsWorldland: c.IsWorldland(num),
IsSeoul: c.IsSeoul(num),
} }
} }