From 2d9dd7c7fcf5f8f2d5b36eeeccb85ef8862fb52f Mon Sep 17 00:00:00 2001 From: Lukasz Rozmej Date: Fri, 26 Jul 2024 13:38:11 +0200 Subject: [PATCH] update known chain sizes (#7291) --- .../KnownChainSizesTests.cs | 2 +- .../Nethermind.Blockchain/KnownChainSizes.cs | 48 ++++++++----------- 2 files changed, 20 insertions(+), 30 deletions(-) diff --git a/src/Nethermind/Nethermind.Blockchain.Test/KnownChainSizesTests.cs b/src/Nethermind/Nethermind.Blockchain.Test/KnownChainSizesTests.cs index 9367267797b..a0f92ecb46b 100644 --- a/src/Nethermind/Nethermind.Blockchain.Test/KnownChainSizesTests.cs +++ b/src/Nethermind/Nethermind.Blockchain.Test/KnownChainSizesTests.cs @@ -15,7 +15,7 @@ public void Update_known_chain_sizes() { // Pruning size have to be updated frequently ChainSizes.CreateChainSizeInfo(BlockchainIds.Mainnet).PruningSize.Should().BeLessThan(240.GB()); - ChainSizes.CreateChainSizeInfo(BlockchainIds.Sepolia).PruningSize.Should().BeLessThan(24.GB()); + ChainSizes.CreateChainSizeInfo(BlockchainIds.Sepolia).PruningSize.Should().BeLessThan(60.GB()); ChainSizes.CreateChainSizeInfo(BlockchainIds.Chiado).PruningSize.Should().Be(null); ChainSizes.CreateChainSizeInfo(BlockchainIds.Gnosis).PruningSize.Should().Be(null); diff --git a/src/Nethermind/Nethermind.Blockchain/KnownChainSizes.cs b/src/Nethermind/Nethermind.Blockchain/KnownChainSizes.cs index 0e1fe59bca9..3cadd797ff0 100644 --- a/src/Nethermind/Nethermind.Blockchain/KnownChainSizes.cs +++ b/src/Nethermind/Nethermind.Blockchain/KnownChainSizes.cs @@ -23,19 +23,13 @@ public class UnknownChain : IChainEstimations public static readonly IChainEstimations Instance = new UnknownChain(); } - private class ChainEstimations : IChainEstimations + private class ChainEstimations( + LinearExtrapolation? stateSizeEstimator = null, + LinearExtrapolation? prunedStateEstimator = null) + : IChainEstimations { - private readonly LinearExtrapolation? _stateSizeEstimator; - private readonly LinearExtrapolation? _prunedStateEstimator; - - public ChainEstimations(LinearExtrapolation? stateSizeEstimator = null, LinearExtrapolation? prunedStateEstimator = null) - { - _stateSizeEstimator = stateSizeEstimator; - _prunedStateEstimator = prunedStateEstimator; - } - - public long? StateSize => _stateSizeEstimator?.Estimate; - public long? PruningSize => _prunedStateEstimator?.Estimate; + public long? StateSize => stateSizeEstimator?.Estimate; + public long? PruningSize => prunedStateEstimator?.Estimate; } private class LinearExtrapolation @@ -68,23 +62,19 @@ public static IChainEstimations CreateChainSizeInfo(ulong chainId) { return chainId switch { - BlockchainIds.Mainnet => new ChainEstimations( - new LinearExtrapolation(167.GB(), 70.MB(), new DateTime(2023, 07, 14)), - new LinearExtrapolation( - 177439054863, new DateTime(2023, 06, 8, 02, 36, 0), - 188742060333, new DateTime(2023, 09, 26, 19, 32, 0))), - BlockchainIds.Gnosis => new ChainEstimations( - new LinearExtrapolation(18000.MB(), 48.MB(), new DateTime(2021, 12, 7))), - BlockchainIds.EnergyWeb => new ChainEstimations( - new LinearExtrapolation(15300.MB(), 15.MB(), new DateTime(2021, 12, 7))), - BlockchainIds.Volta => new ChainEstimations( - new LinearExtrapolation(17500.MB(), 10.MB(), new DateTime(2021, 11, 7))), - BlockchainIds.PoaCore => new ChainEstimations( - new LinearExtrapolation(13900.MB(), 4.MB(), new DateTime(2021, 12, 7))), - BlockchainIds.Sepolia => new ChainEstimations(null, - new LinearExtrapolation( - 3699505976, new(2023, 04, 28, 20, 18, 0), - 5407426707, new(2023, 06, 07, 23, 10, 0))), + BlockchainIds.Mainnet => new ChainEstimations(new LinearExtrapolation(156.GB(), 90.MB(), new DateTime(2024, 07, 17)), + new LinearExtrapolation(180.GB(), 95.MB(), new DateTime(2024, 07, 17))), + BlockchainIds.Sepolia => new ChainEstimations(new LinearExtrapolation(38.GB(), 90.MB(), new DateTime(2024, 07, 17)), + new LinearExtrapolation(45.GB(), 95.MB(), new DateTime(2024, 07, 17))), + + BlockchainIds.Holesky => new ChainEstimations(new LinearExtrapolation(17.GB(), 30.MB(), new DateTime(2024, 07, 17))), + + BlockchainIds.Gnosis => new ChainEstimations(new LinearExtrapolation(64.GB(), 90.MB(), new DateTime(2024, 07, 17))), + BlockchainIds.Chiado => new ChainEstimations(new LinearExtrapolation(3.GB(), 5.MB(), new DateTime(2024, 07, 17))), + + BlockchainIds.EnergyWeb => new ChainEstimations(new LinearExtrapolation(26.GB(), 10.MB(), new DateTime(2024, 07, 17))), + BlockchainIds.Volta => new ChainEstimations(new LinearExtrapolation(34.GB(), 10.MB(), new DateTime(2024, 07, 17))), + _ => UnknownChain.Instance }; }