diff --git a/eth/backend.go b/eth/backend.go index 71af88d2ae..676052107a 100644 --- a/eth/backend.go +++ b/eth/backend.go @@ -136,11 +136,22 @@ func New(stack *node.Node, config *ethconfig.Config) (*Ethereum, error) { // Transfer mining-related config to the ethash config. ethashConfig := config.Ethash 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) if err != nil { return nil, err } - engine := ethconfig.CreateConsensusEngine(stack, ðashConfig, cliqueConfig, config.Miner.Notify, config.Miner.Noverify, chainDb) + + //engine := ethconfig.CreateConsensusEngine(stack, ðashConfig, cliqueConfig, eccpowConfig, config.Miner.Notify, config.Miner.Noverify, chainDb) + engine := ethconfig.CreateConsensusEngine(stack, ðashConfig, cliqueConfig, &eccpowConfig, config.Miner.Notify, config.Miner.Noverify, chainDb) + eth := &Ethereum{ config: config, @@ -275,7 +286,7 @@ func makeExtraData(extra []byte) []byte { // create default extradata extra, _ = rlp.EncodeToBytes([]interface{}{ uint(params.VersionMajor<<16 | params.VersionMinor<<8 | params.VersionPatch), - "geth", + "worldland", runtime.Version(), runtime.GOOS, }) diff --git a/eth/ethconfig/config.go b/eth/ethconfig/config.go index cf8f452485..a7580338af 100644 --- a/eth/ethconfig/config.go +++ b/eth/ethconfig/config.go @@ -73,7 +73,7 @@ var Defaults = Config{ DatasetsOnDisk: 2, DatasetsLockMmap: false, }, - NetworkId: 1, + NetworkId: 103, TxLookupLimit: 2350000, LightPeers: 100, UltraLightFraction: 75, @@ -182,6 +182,10 @@ type Config struct { // Ethash options Ethash ethash.Config + // Ethash options + Eccpow eccpow.Config + + // Transaction pool options TxPool core.TxPoolConfig @@ -218,11 +222,13 @@ type Config struct { } // 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 var engine consensus.Engine if cliqueConfig != nil { engine = clique.New(cliqueConfig, db) + } else if eccpowConfig != nil { + engine = eccpow.New(eccpow.Config{}, notify, noverify) } else { switch ethashConfig.PowMode { case ethash.ModeFake: @@ -246,5 +252,9 @@ func CreateConsensusEngine(stack *node.Node, ethashConfig *ethash.Config, clique }, notify, noverify) 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) } diff --git a/les/client.go b/les/client.go index 7a23fba881..549688e18c 100644 --- a/les/client.go +++ b/les/client.go @@ -128,7 +128,7 @@ func New(stack *node.Node, config *ethconfig.Config) (*LightEthereum, error) { reqDist: newRequestDistributor(peers, &mclock.System{}), accountManager: stack.AccountManager(), 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), bloomIndexer: core.NewBloomIndexer(chainDb, params.BloomBitsBlocksClient, params.HelperTrieConfirmations), p2pServer: stack.Server(), diff --git a/mobile/geth.go b/mobile/geth.go index 8aee585ff3..9dcb2aab6a 100644 --- a/mobile/geth.go +++ b/mobile/geth.go @@ -187,6 +187,28 @@ func NewNode(datadir string, config *NodeConfig) (stack *Node, _ error) { 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 if config.EthereumEnabled { diff --git a/mobile/geth_android.go b/mobile/geth_android.go index cfdf1c28c9..88f9d3d5c0 100644 --- a/mobile/geth_android.go +++ b/mobile/geth_android.go @@ -20,4 +20,4 @@ package geth // clientIdentifier is a hard coded identifier to report into the network. -var clientIdentifier = "GethDroid" +var clientIdentifier = "WorldlandDroid" diff --git a/mobile/geth_ios.go b/mobile/geth_ios.go index aab839727f..2840872542 100644 --- a/mobile/geth_ios.go +++ b/mobile/geth_ios.go @@ -20,4 +20,4 @@ package geth // clientIdentifier is a hard coded identifier to report into the network. -var clientIdentifier = "iGeth" +var clientIdentifier = "iWorldland" diff --git a/mobile/geth_other.go b/mobile/geth_other.go index c5cad4a7ba..a2e5cc7333 100644 --- a/mobile/geth_other.go +++ b/mobile/geth_other.go @@ -20,4 +20,4 @@ package geth // clientIdentifier is a hard coded identifier to report into the network. -var clientIdentifier = "GethMobile" +var clientIdentifier = "WorldlandMobile" diff --git a/mobile/params.go b/mobile/params.go index 50a38362e1..9069612b3c 100644 --- a/mobile/params.go +++ b/mobile/params.go @@ -68,6 +68,33 @@ func GoerliGenesis() string { 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 // by the foundation running the V5 discovery protocol. func FoundationBootnodes() *Enodes { diff --git a/mobile/types.go b/mobile/types.go index 880693f313..c6da148606 100644 --- a/mobile/types.go +++ b/mobile/types.go @@ -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) GetNonce() *Nonce { return &Nonce{h.header.Nonce} } 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. 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) GetNonce() int64 { return int64(b.block.Nonce()) } 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) GetUncles() *Headers { return &Headers{b.block.Uncles()} } func (b *Block) GetTransactions() *Transactions { return &Transactions{b.block.Transactions()} } diff --git a/node/config.go b/node/config.go index 8d62954170..f9658c60fb 100644 --- a/node/config.go +++ b/node/config.go @@ -290,9 +290,13 @@ func (c *Config) ExtRPCEnabled() bool { func (c *Config) NodeName() string { name := c.name() // Backwards compatibility: previous versions used title-cased "Geth", keep that. - if name == "geth" || name == "geth-testnet" { - name = "Geth" + /*if name == "geth" || name == "geth-testnet" { + //name = "Geth" + }*/ + if name == "worldland" || name == "worldland-testnet" { + name = "Worldland" } + if c.UserIdent != "" { name += "/" + c.UserIdent } diff --git a/params/bootnodes.go b/params/bootnodes.go index 05c3b034a5..1282725f55 100644 --- a/params/bootnodes.go +++ b/params/bootnodes.go @@ -30,6 +30,16 @@ var MainnetBootnodes = []string{ "enode://5d6d7cd20d6da4bb83a1d28cadb5d409b64edf314c0335df658c1a54e32c7c4a7ab7823d57c39b6a757556e68ff1df17c748b698544a55cb488b52479a92b60f@104.42.217.25:30303", // bootnode-azure-westus-001 "enode://2b252ab6a1d0f971d9722cb839a42cb81db019ba44c08754628ab4a823487071b5695317c8ccd085219c3a03af063495b2f1da8d18218da2d6a82981b45e6ffc@65.108.70.101:30303", // bootnode-hetzner-hel "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 @@ -58,6 +68,39 @@ var RinkebyBootnodes = []string{ "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 // Görli test network. var GoerliBootnodes = []string{ @@ -118,6 +161,12 @@ func KnownDNSNetwork(genesis common.Hash, protocol string) string { net = "goerli" case SepoliaGenesisHash: net = "sepolia" + case LveGenesisHash: + net = "lve" + case GwangjuGenesisHash: + net = "gwangju" + case SeoulGenesisHash: + net = "seoul" default: return "" } diff --git a/params/config.go b/params/config.go index 922a288cf7..615ee629a2 100644 --- a/params/config.go +++ b/params/config.go @@ -33,6 +33,10 @@ var ( RinkebyGenesisHash = common.HexToHash("0x6341fd3daf94b748c72ced5a5b26028f2474f5f00d824504e4fa37a75767e177") GoerliGenesisHash = common.HexToHash("0xbf7e331f7f7c1dd2e05159666b3bf8bc7a8a3a9eb1d518969eab529dd9b88c1a") 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 @@ -43,6 +47,10 @@ var TrustedCheckpoints = map[common.Hash]*TrustedCheckpoint{ SepoliaGenesisHash: SepoliaTrustedCheckpoint, RinkebyGenesisHash: RinkebyTrustedCheckpoint, GoerliGenesisHash: GoerliTrustedCheckpoint, + + //LveGenesisHash: LveTrustedCheckpoint, + //SeoulGenesisHash: SeoulTrustedCheckpoint, + //GwangjuGenesisHash: GwangjuTrustedCheckpoint, } // CheckpointOracles associates each known checkpoint oracles with the genesis hash of @@ -52,32 +60,39 @@ var CheckpointOracles = map[common.Hash]*CheckpointOracleConfig{ RopstenGenesisHash: RopstenCheckpointOracle, RinkebyGenesisHash: RinkebyCheckpointOracle, GoerliGenesisHash: GoerliCheckpointOracle, + + //update + //LveGenesisHash: LveCheckpointOracle, + //SeoulGenesisHash: SeoulCheckpointOracle, + //GwangjuGenesisHash: GwangjuCheckpointOracle, } var ( 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 = &ChainConfig{ - ChainID: big.NewInt(1), - 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), + ChainID: big.NewInt(1), + 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), + //WorldlandBlock: big.NewInt(15_500_000), TerminalTotalDifficulty: MainnetTerminalTotalDifficulty, // 58_750_000_000_000_000_000_000 Ethash: new(EthashConfig), + //working... + Eccpow: new(EccpowConfig), } // MainnetTrustedCheckpoint contains the light client trusted checkpoint for the main network. @@ -264,23 +279,194 @@ var ( 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 // and accepted by the Ethereum core developers into the Ethash consensus. // // This configuration is intentionally not using keyed fields to force anyone // 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 // and accepted by the Ethereum core developers into the Clique consensus. // // This configuration is intentionally not using keyed fields to force anyone // 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} - 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} - TestRules = TestChainConfig.Rules(new(big.Int), false) + 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, nil} + TestRules = TestChainConfig.Rules(new(big.Int), false) ) // NetworkNames are user friendly names to use in the chain spec banner. @@ -290,6 +476,9 @@ var NetworkNames = map[string]string{ RinkebyChainConfig.ChainID.String(): "rinkeby", GoerliChainConfig.ChainID.String(): "goerli", 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 @@ -373,6 +562,10 @@ type ChainConfig struct { 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) + 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 // the network that triggers the consensus upgrade. TerminalTotalDifficulty *big.Int `json:"terminalTotalDifficulty,omitempty"` @@ -385,16 +578,25 @@ type ChainConfig struct { // Various consensus engines Ethash *EthashConfig `json:"ethash,omitempty"` Clique *CliqueConfig `json:"clique,omitempty"` + Eccpow *EccpowConfig `json:"eccpow,omitempty"` } // EthashConfig is the consensus engine configs for proof-of-work based sealing. 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. func (c *EthashConfig) String() string { 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. type CliqueConfig struct { Period uint64 `json:"period"` // Number of seconds between blocks to enforce @@ -433,15 +635,23 @@ func (c *ChainConfig) String() string { } else { 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: banner += "Consensus: unknown\n" } - banner += "\n" + //banner += "\n" // 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 // 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) 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) @@ -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(" - 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 { 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 { 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" - + */ // 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 += " - Hard-fork specification: https://github.com/ethereum/execution-specs/blob/master/network-upgrades/mainnet-upgrades/paris.md" } 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(" - Total terminal difficulty: %v\n", c.TerminalTotalDifficulty) banner += fmt.Sprintf(" - Merge netsplit block: %-8v", c.MergeNetsplitBlock) - } + }*/ return banner } @@ -576,6 +794,29 @@ func (c *ChainConfig) IsCancun(num *big.Int) bool { 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 // with a mismatching chain configuration. 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: "shanghaiBlock", block: c.ShanghaiBlock, 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 != "" { // 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) { 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 } @@ -722,6 +971,28 @@ func isForked(s, head *big.Int) bool { 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 { if x == nil { return y == nil @@ -774,6 +1045,8 @@ type Rules struct { IsByzantium, IsConstantinople, IsPetersburg, IsIstanbul bool IsBerlin, IsLondon bool IsMerge, IsShanghai, isCancun bool + IsWorldland bool + IsSeoul bool } // Rules ensures c's ChainID is not nil. @@ -797,5 +1070,7 @@ func (c *ChainConfig) Rules(num *big.Int, isMerge bool) Rules { IsMerge: isMerge, IsShanghai: c.IsShanghai(num), isCancun: c.IsCancun(num), + IsWorldland: c.IsWorldland(num), + IsSeoul: c.IsSeoul(num), } }