Skip to content

Commit

Permalink
#231 goerli specs and configs WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
tkstanczak committed Nov 12, 2018
1 parent e17f4ec commit 9a92473
Show file tree
Hide file tree
Showing 11 changed files with 1,048 additions and 133 deletions.
922 changes: 922 additions & 0 deletions src/Nethermind/Chains/goerli.json

Large diffs are not rendered by default.

67 changes: 0 additions & 67 deletions src/Nethermind/Chains/morden.json

This file was deleted.

57 changes: 0 additions & 57 deletions src/Nethermind/Chains/olympic.json

This file was deleted.

4 changes: 2 additions & 2 deletions src/Nethermind/Chains/rinkeby.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Rinkeby",
"dataDir": "rinkeby",
"name": "Görli",
"dataDir": "goerli",
"engine": {
"Clique": {
"params": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Numerics;
using Nethermind.Core.Crypto;
Expand Down Expand Up @@ -102,7 +103,18 @@ private static void LoadAllocations(ChainSpec chainSpec, ChainSpecJson chainSpec
{
if (account.Value.Balance != null)
{
chainSpec.Allocations[new Address(account.Key)] = UInt256.Parse(account.Value.Balance);
bool result = UInt256.TryParse(account.Value.Balance, out UInt256 allocationValue);
if (!result)
{
result = UInt256.TryParse(account.Value.Balance.Replace("0x", string.Empty), NumberStyles.HexNumber, CultureInfo.InvariantCulture, out allocationValue);
}

if (!result)
{
throw new InvalidDataException($"Cannot recognize allocation value format in {account.Value.Balance}");
}

chainSpec.Allocations[new Address(account.Key)] = allocationValue;
}
}
}
Expand Down
44 changes: 44 additions & 0 deletions src/Nethermind/Nethermind.Core/Specs/GoerliSpecProvider.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
* Copyright (c) 2018 Demerzel Solutions Limited
* This file is part of the Nethermind library.
*
* The Nethermind library is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* The Nethermind library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with the Nethermind. If not, see <http://www.gnu.org/licenses/>.
*/

using Nethermind.Dirichlet.Numerics;

namespace Nethermind.Core.Specs
{
public class GoerliSpecProvider : ISpecProvider
{
public static readonly GoerliSpecProvider Instance = new GoerliSpecProvider();

private GoerliSpecProvider()
{
}

public IReleaseSpec CurrentSpec => Constantinople.Instance;

public IReleaseSpec GenesisSpec => Constantinople.Instance;

public IReleaseSpec GetSpec(UInt256 blockNumber)
{
return Constantinople.Instance;
}

public UInt256? DaoBlockNumber { get; } = null;

public int ChainId => 0x188c;
}
}
9 changes: 5 additions & 4 deletions src/Nethermind/Nethermind.Runner/Runners/EthereumRunner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,8 @@
using System.Collections.Generic;
using System.IO;
using System.Reflection;
using System.Security;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Nethermind.Blockchain;
using Nethermind.Blockchain.Filters;
using Nethermind.Blockchain.Validators;
Expand All @@ -39,7 +37,6 @@
using Nethermind.Db.Config;
using Nethermind.Dirichlet.Numerics;
using Nethermind.Evm;
using Nethermind.JsonRpc.Client;
using Nethermind.JsonRpc.Module;
using Nethermind.KeyStore;
using Nethermind.Mining;
Expand All @@ -60,7 +57,6 @@
using Nethermind.Runner.Config;
using Nethermind.Stats;
using Nethermind.Store;
using Nethermind.Store.Rpc;
using Nethermind.Wallet;
using PingMessageSerializer = Nethermind.Network.P2P.PingMessageSerializer;
using PongMessageSerializer = Nethermind.Network.P2P.PongMessageSerializer;
Expand Down Expand Up @@ -264,6 +260,10 @@ private async Task InitBlockchain()
{
_specProvider = RinkebySpecProvider.Instance;
}
else if (chainSpec.ChainId == GoerliSpecProvider.Instance.ChainId)
{
_specProvider = GoerliSpecProvider.Instance;
}
else
{
_specProvider = new SingleReleaseSpecProvider(LatestRelease.Instance, chainSpec.ChainId);
Expand Down Expand Up @@ -303,6 +303,7 @@ private async Task InitBlockchain()
(_specProvider is MainNetSpecProvider) ? ConfigureSealEngine() :
(_specProvider is RopstenSpecProvider) ? ConfigureSealEngine() :
(_specProvider is RinkebySpecProvider) ? ConfigureCliqueSealEngine() :
(_specProvider is GoerliSpecProvider) ? ConfigureCliqueSealEngine() :
NullSealEngine.Instance;

/* validation */
Expand Down
30 changes: 30 additions & 0 deletions src/Nethermind/Nethermind.Runner/configs/goerli_posix.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
[
{
"ConfigModule": "InitConfig",
"ConfigItems": {
"JsonRpcEnabled": false,
"NetworkEnabled": true,
"DiscoveryEnabled": true,
"SynchronizationEnabled": true,
"ProcessingEnabled": true,
"IsMining": false,
"DiscoveryPort": 30312,
"P2PPort": 30312,
"HttpHost": "127.0.0.1",
"HttpPort": 8345,
"ChainSpecPath": "chainspec/goerli.json",
"GenesisHash": "",
"BaseDbPath": "nethermind_db/goerli",
"LogFileName": "goerli.logs.txt"
}
},
{
"ConfigModule": "DbConfig",
"ConfigItems": {
"WriteBufferSize": 67108864,
"WriteBufferNumber": 6,
"BlockCacheSize": 67108864,
"CacheIndexAndFilterBlocks": true
}
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
[
{
"ConfigModule": "InitConfig",
"ConfigItems": {
"JsonRpcEnabled": false,
"NetworkEnabled": true,
"DiscoveryEnabled": true,
"SynchronizationEnabled": true,
"ProcessingEnabled": true,
"IsMining": false,
"DiscoveryPort": 30312,
"P2PPort": 30312,
"HttpHost": "127.0.0.1",
"HttpPort": 8345,
"ChainSpecPath": "chainspec\\goerli.json",
"GenesisHash": "",
"BaseDbPath": "nethermind_db\\goerli",
"LogFileName": "goerli.logs.txt"
}
},
{
"ConfigModule": "DbConfig",
"ConfigItems": {
"WriteBufferSize": 67108864,
"WriteBufferNumber": 6,
"BlockCacheSize": 67108864,
"CacheIndexAndFilterBlocks": true
}
}
]
3 changes: 1 addition & 2 deletions src/Nethermind/Nethermind.sln
Original file line number Diff line number Diff line change
Expand Up @@ -81,15 +81,14 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Chains", "Chains", "{D75E83
ProjectSection(SolutionItems) = preProject
Chains\foundation.json = Chains\foundation.json
Chains\kovan.json = Chains\kovan.json
Chains\morden.json = Chains\morden.json
Chains\olympic.json = Chains\olympic.json
Chains\private_bootnode.json = Chains\private_bootnode.json
Chains\private_client.json = Chains\private_client.json
Chains\private_miner1.json = Chains\private_miner1.json
Chains\private_miner2.json = Chains\private_miner2.json
Chains\ropsten.json = Chains\ropsten.json
Chains\spaceneth.json = Chains\spaceneth.json
Chains\rinkeby.json = Chains\rinkeby.json
Chains\goerli.json = Chains\goerli.json
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Nethermind.RunnerSpawner", "Nethermind.RunnerSpawner\Nethermind.RunnerSpawner.csproj", "{7285ABAE-A946-437E-A6DD-F1DECFE7F8D5}"
Expand Down
1 change: 1 addition & 0 deletions src/Nethermind/Nethermind.sln.DotSettings
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<s:Boolean x:Key="/Default/UserDictionary/Words/=encrypter/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=ethereum/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=EXTCODEHASH/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Goerli/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=intra/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Kademlia/@EntryIndexedValue">True</s:Boolean>

Expand Down

0 comments on commit 9a92473

Please sign in to comment.