diff --git a/nimbus/chain_config.nim b/nimbus/chain_config.nim index 802677e81..8c13c1259 100644 --- a/nimbus/chain_config.nim +++ b/nimbus/chain_config.nim @@ -136,6 +136,7 @@ const RinkebyNet* = 4.NetworkId GoerliNet* = 5.NetworkId KovanNet* = 42.NetworkId + SepoliaNet* = 11155111.NetworkId proc read(rlp: var Rlp, x: var AddressBalance, _: type EthAddress): EthAddress {.gcsafe, raises: [Defect,RlpError].} = @@ -453,6 +454,13 @@ proc chainConfigForNetwork(id: NetworkId): ChainConfig = arrowGlacierBlock: high(BlockNumber), # No current plan mergeForkBlock: none(BlockNumber), ) + of SepoliaNet: + ChainConfig( + poaEngine: false, + chainId: SepoliaNet.ChainId, + arrowGlacierBlock: high(BlockNumber), # No current plan + mergeForkBlock: none(BlockNumber), + ) else: ChainConfig() @@ -493,6 +501,15 @@ proc genesisBlockForNetwork(id: NetworkId): Genesis difficulty: 1.u256, alloc: decodePrealloc(goerliAllocData) ) + of SepoliaNet: + Genesis( + nonce: 0.toBlockNonce, + timestamp: initTime(0x6159af19, 0), + extraData: hexToSeqByte("0x5365706f6c69612c20417468656e732c204174746963612c2047726565636521"), + gasLimit: 0x1c9c380, + difficulty: 0x20000.u256, + alloc: decodePrealloc(sepoliaAllocData) + ) else: Genesis() diff --git a/nimbus/config.nim b/nimbus/config.nim index 2673a3b9d..8d7fdcdbb 100644 --- a/nimbus/config.nim +++ b/nimbus/config.nim @@ -36,6 +36,16 @@ const GitRevision ] + # This entry can savely be deleted if the latest `p2p/bootnodes` version for + # the `master` branch is available in which case `nim` will moan about + # duplicate names. + # + # As of 01/07/2022, the latest `master` branch did not cleanly compile + # after the `bearssl` split api update. + SepoliaBootnodes* = [ + "enode://9246d00bc8fd1742e5ad2428b80fc4dc45d786283e05ef6edbd9002cbc335d40998444732fbe921cb88e1d2c73d1b1de53bae6a2237996e9bfe14f871baf7066@18.168.182.86:30303", + "enode://ec66ddcf1a974950bd4c782789a7e04f8aa7110a72569b6e65fcd51e937e74eed303b1ea734e4d19cfaec9fbff9b6ee65bf31dcb50ba79acce9dd63a6aca61c7@52.14.151.177:30303"] + let # e.g.: Copyright (c) 2018-2021 Status Research & Development GmbH NimbusCopyright* = "Copyright (c) 2018-" & @@ -182,13 +192,14 @@ type network {. separator: "\pETHEREUM NETWORK OPTIONS:" - desc: "Name or id number of Ethereum network(mainnet(1), ropsten(3), rinkeby(4), goerli(5), kovan(42), other=custom)" + desc: "Name or id number of Ethereum network(mainnet(1), ropsten(3), rinkeby(4), goerli(5), kovan(42), sepolia(11155111), other=custom)" longDesc: "- mainnet: Ethereum main network\n" & "- ropsten: Test network (proof-of-work, the one most like Ethereum mainnet)\n" & "- rinkeby: Test network (proof-of-authority, for those running Geth clients)\n" & - "- görli : Test network (proof-of-authority, works across all clients)\n" & - "- kovan : Test network (proof-of-authority, for those running OpenEthereum clients)" + "- goerli: Test network (proof-of-authority, works across all clients)\n" & + "- kovan: Test network (proof-of-authority, for those running OpenEthereum clients)\n" & + "- sepolia: Test network (proof-of-work)" defaultValue: "" # the default value is set in makeConfig defaultValueDesc: "mainnet(1)" abbr: "i" @@ -569,6 +580,7 @@ proc getNetworkId(conf: NimbusConf): Option[NetworkId] = of "rinkeby": return some RinkebyNet of "goerli" : return some GoerliNet of "kovan" : return some KovanNet + of "sepolia": return some SepoliaNet else: try: some parseInt(network).NetworkId @@ -620,6 +632,8 @@ proc getBootNodes*(conf: NimbusConf): seq[ENode] = result.setBootnodes(GoerliBootnodes) of KovanNet: result.setBootnodes(KovanBootnodes) + of SepoliaNet: + result.setBootnodes(SepoliaBootnodes) else: # custom network id discard diff --git a/nimbus/genesis_alloc.nim b/nimbus/genesis_alloc.nim index 4fb76755a..4fbf49c37 100644 --- a/nimbus/genesis_alloc.nim +++ b/nimbus/genesis_alloc.nim @@ -10,3 +10,4 @@ const testnetAllocData* = toData"f903a4c28001c20101c20201c20301c20401c20501c20601c20701c20801c20901c20a80c20b80c20c80c20d80c20e80c20f80c21080c21180c21280c21380c21480c21580c21680c21780c21880c21980c21a80c21b80c21c80c21d80c21e80c21f80c22080c22180c22280c22380c22480c22580c22680c22780c22880c22980c22a80c22b80c22c80c22d80c22e80c22f80c23080c23180c23280c23380c23480c23580c23680c23780c23880c23980c23a80c23b80c23c80c23d80c23e80c23f80c24080c24180c24280c24380c24480c24580c24680c24780c24880c24980c24a80c24b80c24c80c24d80c24e80c24f80c25080c25180c25280c25380c25480c25580c25680c25780c25880c25980c25a80c25b80c25c80c25d80c25e80c25f80c26080c26180c26280c26380c26480c26580c26680c26780c26880c26980c26a80c26b80c26c80c26d80c26e80c26f80c27080c27180c27280c27380c27480c27580c27680c27780c27880c27980c27a80c27b80c27c80c27d80c27e80c27f80c3818080c3818180c3818280c3818380c3818480c3818580c3818680c3818780c3818880c3818980c3818a80c3818b80c3818c80c3818d80c3818e80c3818f80c3819080c3819180c3819280c3819380c3819480c3819580c3819680c3819780c3819880c3819980c3819a80c3819b80c3819c80c3819d80c3819e80c3819f80c381a080c381a180c381a280c381a380c381a480c381a580c381a680c381a780c381a880c381a980c381aa80c381ab80c381ac80c381ad80c381ae80c381af80c381b080c381b180c381b280c381b380c381b480c381b580c381b680c381b780c381b880c381b980c381ba80c381bb80c381bc80c381bd80c381be80c381bf80c381c080c381c180c381c280c381c380c381c480c381c580c381c680c381c780c381c880c381c980c381ca80c381cb80c381cc80c381cd80c381ce80c381cf80c381d080c381d180c381d280c381d380c381d480c381d580c381d680c381d780c381d880c381d980c381da80c381db80c381dc80c381dd80c381de80c381df80c381e080c381e180c381e280c381e380c381e480c381e580c381e680c381e780c381e880c381e980c381ea80c381eb80c381ec80c381ed80c381ee80c381ef80c381f080c381f180c381f280c381f380c381f480c381f580c381f680c381f780c381f880c381f980c381fa80c381fb80c381fc80c381fd80c381fe80c381ff80e394874b54a8bd152966d63f706bae1ffeb0411921e58d0c9f2c9cd04674edea40000000" rinkebyAllocData* = toData"f903b7c28001c20101c20201c20301c20401c20501c20601c20701c20801c20901c20a01c20b01c20c01c20d01c20e01c20f01c21001c21101c21201c21301c21401c21501c21601c21701c21801c21901c21a01c21b01c21c01c21d01c21e01c21f01c22001c22101c22201c22301c22401c22501c22601c22701c22801c22901c22a01c22b01c22c01c22d01c22e01c22f01c23001c23101c23201c23301c23401c23501c23601c23701c23801c23901c23a01c23b01c23c01c23d01c23e01c23f01c24001c24101c24201c24301c24401c24501c24601c24701c24801c24901c24a01c24b01c24c01c24d01c24e01c24f01c25001c25101c25201c25301c25401c25501c25601c25701c25801c25901c25a01c25b01c25c01c25d01c25e01c25f01c26001c26101c26201c26301c26401c26501c26601c26701c26801c26901c26a01c26b01c26c01c26d01c26e01c26f01c27001c27101c27201c27301c27401c27501c27601c27701c27801c27901c27a01c27b01c27c01c27d01c27e01c27f01c3818001c3818101c3818201c3818301c3818401c3818501c3818601c3818701c3818801c3818901c3818a01c3818b01c3818c01c3818d01c3818e01c3818f01c3819001c3819101c3819201c3819301c3819401c3819501c3819601c3819701c3819801c3819901c3819a01c3819b01c3819c01c3819d01c3819e01c3819f01c381a001c381a101c381a201c381a301c381a401c381a501c381a601c381a701c381a801c381a901c381aa01c381ab01c381ac01c381ad01c381ae01c381af01c381b001c381b101c381b201c381b301c381b401c381b501c381b601c381b701c381b801c381b901c381ba01c381bb01c381bc01c381bd01c381be01c381bf01c381c001c381c101c381c201c381c301c381c401c381c501c381c601c381c701c381c801c381c901c381ca01c381cb01c381cc01c381cd01c381ce01c381cf01c381d001c381d101c381d201c381d301c381d401c381d501c381d601c381d701c381d801c381d901c381da01c381db01c381dc01c381dd01c381de01c381df01c381e001c381e101c381e201c381e301c381e401c381e501c381e601c381e701c381e801c381e901c381ea01c381eb01c381ec01c381ed01c381ee01c381ef01c381f001c381f101c381f201c381f301c381f401c381f501c381f601c381f701c381f801c381f901c381fa01c381fb01c381fc01c381fd01c381fe01c381ff01f69431b98d14007bdee637298086988a0bbd31184523a00200000000000000000000000000000000000000000000000000000000000000" goerliAllocData* = toData"f90406c28001c20101c20201c20301c20401c20501c20601c20701c20801c20901c20a01c20b01c20c01c20d01c20e01c20f01c21001c21101c21201c21301c21401c21501c21601c21701c21801c21901c21a01c21b01c21c01c21d01c21e01c21f01c22001c22101c22201c22301c22401c22501c22601c22701c22801c22901c22a01c22b01c22c01c22d01c22e01c22f01c23001c23101c23201c23301c23401c23501c23601c23701c23801c23901c23a01c23b01c23c01c23d01c23e01c23f01c24001c24101c24201c24301c24401c24501c24601c24701c24801c24901c24a01c24b01c24c01c24d01c24e01c24f01c25001c25101c25201c25301c25401c25501c25601c25701c25801c25901c25a01c25b01c25c01c25d01c25e01c25f01c26001c26101c26201c26301c26401c26501c26601c26701c26801c26901c26a01c26b01c26c01c26d01c26e01c26f01c27001c27101c27201c27301c27401c27501c27601c27701c27801c27901c27a01c27b01c27c01c27d01c27e01c27f01c3818001c3818101c3818201c3818301c3818401c3818501c3818601c3818701c3818801c3818901c3818a01c3818b01c3818c01c3818d01c3818e01c3818f01c3819001c3819101c3819201c3819301c3819401c3819501c3819601c3819701c3819801c3819901c3819a01c3819b01c3819c01c3819d01c3819e01c3819f01c381a001c381a101c381a201c381a301c381a401c381a501c381a601c381a701c381a801c381a901c381aa01c381ab01c381ac01c381ad01c381ae01c381af01c381b001c381b101c381b201c381b301c381b401c381b501c381b601c381b701c381b801c381b901c381ba01c381bb01c381bc01c381bd01c381be01c381bf01c381c001c381c101c381c201c381c301c381c401c381c501c381c601c381c701c381c801c381c901c381ca01c381cb01c381cc01c381cd01c381ce01c381cf01c381d001c381d101c381d201c381d301c381d401c381d501c381d601c381d701c381d801c381d901c381da01c381db01c381dc01c381dd01c381de01c381df01c381e001c381e101c381e201c381e301c381e401c381e501c381e601c381e701c381e801c381e901c381ea01c381eb01c381ec01c381ed01c381ee01c381ef01c381f001c381f101c381f201c381f301c381f401c381f501c381f601c381f701c381f801c381f901c381fa01c381fb01c381fc01c381fd01c381fe01c381ff01e0944c2ae482593505f0163cdefc073e81c63cda41078a152d02c7e14af6800000e094a8e8f14732658e4b51e8711931053a8a69baf2b18a152d02c7e14af6800000e194d9a5179f091d85051d3c982785efd1455cec86998b084595161401484a000000e194e0a2bd4258d2768837baa26a28fe71dc079f84c78b4a47e3c12448f4ad000000" + sepoliaAllocData* = toData"f901eede94799d329e5f583419167cd722962485926e338f4a880de0b6b3a7640000e094beef32ca5b9a198d27b4e02f4c70439fe60356cf8ad3c21bcecceda1000000e0947cf5b79bfe291a67ab02b393e456ccc4c266f7538ad3c21bcecceda1000000e19410f5d45854e038071485ac9e402308cf80d2d2fe8b52b7d2dcc80cd2e4000000e0948b7f0977bb4f0fbe7076fa22bc24aca043583f5e8ad3c21bcecceda1000000e094d7eddb78ed295b3c9629240e8924fb8d8874ddd88ad3c21bcecceda1000000e094a2a6d93439144ffe4d27c9e088dcd8b7839462638ad3c21bcecceda1000000e094aaec86394441f915bce3e6ab399977e9906f3b698ad3c21bcecceda1000000e094e2e2659028143784d557bcec6ff3a0721048880a8ad3c21bcecceda1000000e094d9a5179f091d85051d3c982785efd1455cec86998ad3c21bcecceda1000000e194b21c33de1fab3fa15499c62b59fe0cc3250020d18b52b7d2dcc80cd2e4000000e094f47cae1cf79ca6758bfc787dbd21e6bdbe7112b88ad3c21bcecceda1000000e194d7d76c58b3a519e9fa6cc4d22dc017259bc49f1e8b52b7d2dcc80cd2e4000000e094bc11295936aa79d594139de1b2e12629414f3bdb8ad3c21bcecceda1000000de916916a87b82333f4245046623b23794c65c8b084595161401484a000000" diff --git a/tests/test_genesis.nim b/tests/test_genesis.nim index f02c11eec..f9c558344 100644 --- a/tests/test_genesis.nim +++ b/tests/test_genesis.nim @@ -33,6 +33,10 @@ proc genesisTest() = let b = networkParams(GoerliNet).toGenesisHeader check(b.blockHash == "bf7e331f7f7c1dd2e05159666b3bf8bc7a8a3a9eb1d518969eab529dd9b88c1a".toDigest) + test "Correct sepolia hash": + let b = networkParams(SepoliaNet).toGenesisHeader + check b.blockHash == "25a5cc106eea7138acab33231d7160d69cb777ee0c2c553fcddf5138993e6dd9".toDigest + proc customGenesisTest() = suite "Custom Genesis": test "loadCustomGenesis":