Skip to content

Commit

Permalink
update known chain sizes (NethermindEth#7291)
Browse files Browse the repository at this point in the history
  • Loading branch information
LukaszRozmej committed Jul 26, 2024
1 parent 7b0a0dd commit 2d9dd7c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
48 changes: 19 additions & 29 deletions src/Nethermind/Nethermind.Blockchain/KnownChainSizes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
};
}
Expand Down

0 comments on commit 2d9dd7c

Please sign in to comment.