Skip to content

Commit

Permalink
The Merge configs (#4427)
Browse files Browse the repository at this point in the history
* The Merge configs

* fix strange error 'Integral constant is too large'

* cosmetic

* more configs

* fix tests

* cosmetic

* fix mainnet_aa.cfg

* add SnapSync as default to AA and MEV

* fix test
  • Loading branch information
marcindsobczak authored Aug 17, 2022
1 parent 10ac0e8 commit ebc8a5c
Show file tree
Hide file tree
Showing 10 changed files with 77 additions and 22 deletions.
5 changes: 3 additions & 2 deletions src/Nethermind/Chains/foundation.json
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,8 @@
"eip1559Transition": "0xC5D488",
"eip3198Transition": "0xC5D488",
"eip3529Transition": "0xC5D488",
"eip3541Transition": "0xC5D488"
"eip3541Transition": "0xC5D488",
"terminalTotalDifficulty": "C70D808A128D7380000"
},
"genesis": {
"seal": {
Expand Down Expand Up @@ -30658,4 +30659,4 @@
"balance": "0xad78ebc5ac6200000"
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public void Initial_TTD_should_be_null()
{
UInt256? expectedTtd = null;
IBlockTree blockTree = Substitute.For<IBlockTree>();
PoSSwitcher poSSwitcher = new(new MergeConfig(), new SyncConfig(), new MemDb(), blockTree, MainnetSpecProvider.Instance, LimboLogs.Instance);
PoSSwitcher poSSwitcher = new(new MergeConfig(), new SyncConfig(), new MemDb(), blockTree, TestSpecProvider.Instance, LimboLogs.Instance);

Assert.AreEqual(expectedTtd, poSSwitcher.TerminalTotalDifficulty);
}
Expand Down
7 changes: 4 additions & 3 deletions src/Nethermind/Nethermind.Runner.Test/ConfigFilesTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,8 @@ public void Tx_pool_defaults_are_correct(string configWildcard, int poolSize)
[TestCase("spaceneth", true)]
[TestCase("ropsten", true)]
[TestCase("goerli", true)]
[TestCase("^spaceneth ^baseline ^ropsten ^goerli", false)]
[TestCase("mainnet", true)]
[TestCase("^spaceneth ^baseline ^ropsten ^goerli ^mainnet", false)]
public void Json_defaults_are_correct(string configWildcard, bool jsonEnabled)
{
Test<IJsonRpcConfig, bool>(configWildcard, c => c.Enabled, jsonEnabled);
Expand Down Expand Up @@ -301,8 +302,8 @@ public void Snap_sync_settings_as_expected(string configWildcard, bool enabled)
Test<ISyncConfig, bool>(configWildcard, c => c.SnapSync, enabled);
}

[TestCase("^aura ^ropsten ^sepolia ^goerli", false)]
[TestCase("aura ^archive ropsten sepolia goerli", true)]
[TestCase("^aura ^ropsten ^sepolia ^goerli ^mainnet", false)]
[TestCase("aura ^archive ropsten sepolia goerli mainnet", true)]
public void Stays_on_full_sync(string configWildcard, bool stickToFullSyncAfterFastSync)
{
Test<ISyncConfig, long?>(configWildcard, c => c.FastSyncCatchUpHeightDelta, stickToFullSyncAfterFastSync ? 10_000_000_000 : 8192);
Expand Down
17 changes: 15 additions & 2 deletions src/Nethermind/Nethermind.Runner/configs/mainnet.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,25 @@
"FastBlocks": true,
"AncientBodiesBarrier": 11052984,
"AncientReceiptsBarrier": 11052984,
"WitnessProtocolEnabled": true
"WitnessProtocolEnabled": true,
"FastSyncCatchUpHeightDelta": "10000000000"
},
"EthStats": {
"Server": "wss://ethstats.net/api"
},
"Metrics": {
"NodeName": "Mainnet"
},
"JsonRpc": {
"Enabled": true,
"Timeout": 20000,
"Host": "127.0.0.1",
"Port": 8545,
"AdditionalRpcUrls": [
"http://localhost:8551|http;ws|net;eth;subscribe;engine;web3;client"
]
},
"Merge": {
"Enabled": true
}
}
}
12 changes: 10 additions & 2 deletions src/Nethermind/Nethermind.Runner/configs/mainnet_aa.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
"EnabledModules": [
"Eth",
"AccountAbstraction"
],
"AdditionalRpcUrls": [
"http://localhost:8551|http;ws|net;eth;subscribe;engine;web3;client"
]
},
"AccountAbstraction": {
Expand All @@ -25,18 +28,23 @@
},
"Sync": {
"FastSync": true,
"SnapSync": true,
"PivotNumber": 15335000,
"PivotHash": "0xde3bca488cce75bee9aabbfab6fc15aa56bc04e715f3197537a1d411af7b9708",
"PivotTotalDifficulty": "56285312641338818488948",
"FastBlocks": true,
"AncientBodiesBarrier": 11052984,
"AncientReceiptsBarrier": 11052984,
"WitnessProtocolEnabled": true
"WitnessProtocolEnabled": true,
"FastSyncCatchUpHeightDelta": "10000000000"
},
"EthStats": {
"Server": "wss://ethstats.net/api"
},
"Metrics": {
"NodeName": "Mainnet"
},
"Merge": {
"Enabled": true
}
}
}
14 changes: 13 additions & 1 deletion src/Nethermind/Nethermind.Runner/configs/mainnet_archive.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,17 @@
},
"Pruning": {
"Mode": "None"
},
"JsonRpc": {
"Enabled": true,
"Timeout": 20000,
"Host": "127.0.0.1",
"Port": 8545,
"AdditionalRpcUrls": [
"http://localhost:8551|http;ws|net;eth;subscribe;engine;web3;client"
]
},
"Merge": {
"Enabled": true
}
}
}
18 changes: 16 additions & 2 deletions src/Nethermind/Nethermind.Runner/configs/mainnet_mev.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@
},
"Sync": {
"FastSync": true,
"SnapSync": true,
"PivotNumber": 15335000,
"PivotHash": "0xde3bca488cce75bee9aabbfab6fc15aa56bc04e715f3197537a1d411af7b9708",
"PivotTotalDifficulty": "56285312641338818488948",
"FastBlocks": true,
"AncientBodiesBarrier": 11052984,
"AncientReceiptsBarrier": 11052984,
"WitnessProtocolEnabled": true
"WitnessProtocolEnabled": true,
"FastSyncCatchUpHeightDelta": "10000000000"
},
"EthStats": {
"Server": "wss://ethstats.net/api"
Expand All @@ -25,5 +27,17 @@
"Mev": {
"Enabled": true,
"MaxMergedBundles": 3
},
"JsonRpc": {
"Enabled": true,
"Timeout": 20000,
"Host": "127.0.0.1",
"Port": 8545,
"AdditionalRpcUrls": [
"http://localhost:8551|http;ws|net;eth;subscribe;engine;web3;client"
]
},
"Merge": {
"Enabled": true
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ public void Mainnet_loads_properly()
Assert.AreEqual(10_700_000, provider.GetSpec(15_049_999).DifficultyBombDelay);
Assert.AreEqual(11_400_000, provider.GetSpec(15_050_000).DifficultyBombDelay);
Assert.AreEqual(11_400_000, provider.GetSpec(99_414_000).DifficultyBombDelay);
Assert.AreEqual(MainnetSpecProvider.Instance.TerminalTotalDifficulty, provider.TerminalTotalDifficulty);
}

private static void CompareSpecProviders(
Expand Down
11 changes: 6 additions & 5 deletions src/Nethermind/Nethermind.Specs/MainNetSpecProvider.cs
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
// Copyright (c) 2021 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/>.

Expand All @@ -23,17 +23,18 @@ namespace Nethermind.Specs
public class MainnetSpecProvider : ISpecProvider
{
private long? _theMergeBlock = null;
private UInt256? _terminalTotalDifficulty = UInt256.Parse("58750000000000000000000");

public void UpdateMergeTransitionInfo(long? blockNumber, UInt256? terminalTotalDifficulty = null)
{
if (blockNumber != null)
_theMergeBlock = blockNumber;
if (terminalTotalDifficulty != null)
TerminalTotalDifficulty = terminalTotalDifficulty;
_terminalTotalDifficulty = terminalTotalDifficulty;
}

public long? MergeBlockNumber => _theMergeBlock;
public UInt256? TerminalTotalDifficulty { get; private set; }
public UInt256? TerminalTotalDifficulty => _terminalTotalDifficulty;
public IReleaseSpec GenesisSpec => Frontier.Instance;

public IReleaseSpec GetSpec(long blockNumber) =>
Expand Down
12 changes: 8 additions & 4 deletions src/Nethermind/Nethermind.Specs/TestSpecProvider.cs
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
// Copyright (c) 2021 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/>.

Expand All @@ -28,7 +28,7 @@ public TestSpecProvider(IReleaseSpec initialSpecToReturn)
SpecToReturn = initialSpecToReturn;
GenesisSpec = initialSpecToReturn;
}

public void UpdateMergeTransitionInfo(long? blockNumber, UInt256? terminalTotalDifficulty = null)
{
if (blockNumber != null)
Expand All @@ -50,5 +50,9 @@ public void UpdateMergeTransitionInfo(long? blockNumber, UInt256? terminalTotalD
public ulong ChainId { get; set; }
public long[] TransitionBlocks { get; set; } = new long[] {0};
public bool AllowTestChainOverride { get; set; } = true;

private TestSpecProvider() { }

public static readonly TestSpecProvider Instance = new();
}
}

0 comments on commit ebc8a5c

Please sign in to comment.