diff --git a/src/Nethermind/Nethermind.Consensus.Clique/BlockHeaderExtensions.cs b/src/Nethermind/Nethermind.Consensus.Clique/BlockHeaderExtensions.cs index 6c1bf551641a..9ad3590d1392 100644 --- a/src/Nethermind/Nethermind.Consensus.Clique/BlockHeaderExtensions.cs +++ b/src/Nethermind/Nethermind.Consensus.Clique/BlockHeaderExtensions.cs @@ -1,8 +1,6 @@ // SPDX-FileCopyrightText: 2022 Demerzel Solutions Limited // SPDX-License-Identifier: LGPL-3.0-only -using System; -using Nethermind.Blockchain; using Nethermind.Core; namespace Nethermind.Consensus.Clique @@ -13,23 +11,6 @@ public static bool IsInTurn(this BlockHeader header) { return header.Difficulty == Clique.DifficultyInTurn; } - - internal static Address[] ExtractSigners(BlockHeader blockHeader) - { - if (blockHeader.ExtraData is null) - { - throw new BlockchainException("Block header ExtraData cannot be null when extracting signers"); - } - - Span signersData = blockHeader.ExtraData.AsSpan(Clique.ExtraVanityLength, (blockHeader.ExtraData.Length - Clique.ExtraSealLength)); - Address[] signers = new Address[signersData.Length / Address.Size]; - for (int i = 0; i < signers.Length; i++) - { - signers[i] = new Address(signersData.Slice(i * 20, 20).ToArray()); - } - - return signers; - } } internal static class BlockExtensions diff --git a/src/Nethermind/Nethermind.Consensus/Processing/IOverridableTxProcessingScope.cs b/src/Nethermind/Nethermind.Consensus/Processing/IOverridableTxProcessingScope.cs deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/src/Nethermind/Nethermind.Consensus/Processing/IOverridableTxProcessorSource.cs b/src/Nethermind/Nethermind.Consensus/Processing/IOverridableTxProcessorSource.cs deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/src/Nethermind/Nethermind.Consensus/Processing/OverridableTxProcessingScope.cs b/src/Nethermind/Nethermind.Consensus/Processing/OverridableTxProcessingScope.cs deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/src/Nethermind/Nethermind.Core/Buffers/CappedArrayMemoryManager.cs b/src/Nethermind/Nethermind.Core/Buffers/CappedArrayMemoryManager.cs deleted file mode 100644 index 1f499890f03c..000000000000 --- a/src/Nethermind/Nethermind.Core/Buffers/CappedArrayMemoryManager.cs +++ /dev/null @@ -1,45 +0,0 @@ -// SPDX-FileCopyrightText: 2024 Demerzel Solutions Limited -// SPDX-License-Identifier: LGPL-3.0-only - -using System; -using System.Buffers; - -namespace Nethermind.Core.Buffers; - -public class CappedArrayMemoryManager(CappedArray? data) : MemoryManager -{ - private readonly CappedArray _data = data ?? throw new ArgumentNullException(nameof(data)); - private bool _isDisposed; - - public override Span GetSpan() - { - ObjectDisposedException.ThrowIf(_isDisposed, this); - return _data.AsSpan(); - } - - public override MemoryHandle Pin(int elementIndex = 0) - { - ObjectDisposedException.ThrowIf(_isDisposed, this); - ArgumentOutOfRangeException.ThrowIfGreaterThanOrEqual((uint)elementIndex, (uint)_data.Length); - // Pinning is a no-op in this managed implementation - return default; - } - - public override void Unpin() - { - ObjectDisposedException.ThrowIf(_isDisposed, this); - // Unpinning is a no-op in this managed implementation - } - - protected override void Dispose(bool disposing) - { - _isDisposed = true; - } - - protected override bool TryGetArray(out ArraySegment segment) - { - ObjectDisposedException.ThrowIf(_isDisposed, this); - segment = _data.AsArraySegment(); - return true; - } -} diff --git a/src/Nethermind/Nethermind.Core/Caching/ISpanCache.cs b/src/Nethermind/Nethermind.Core/Caching/ISpanCache.cs deleted file mode 100644 index c7b56ebd2a8f..000000000000 --- a/src/Nethermind/Nethermind.Core/Caching/ISpanCache.cs +++ /dev/null @@ -1,36 +0,0 @@ -// SPDX-FileCopyrightText: 2022 Demerzel Solutions Limited -// SPDX-License-Identifier: LGPL-3.0-only - -using System; - -namespace Nethermind.Core.Caching -{ - /// - /// Its like `ICache` but you can index the key by span - /// - /// - /// - public interface ISpanCache - { - void Clear(); - TValue? Get(ReadOnlySpan key); - bool TryGet(ReadOnlySpan key, out TValue? value); - - /// - /// Sets value in the cache. - /// - /// - /// - /// True if key didn't exist in the cache, otherwise false. - bool Set(ReadOnlySpan key, TValue val); - - /// - /// Delete key from cache. - /// - /// - /// True if key existed in the cache, otherwise false. - bool Delete(ReadOnlySpan key); - bool Contains(ReadOnlySpan key); - int Count { get; } - } -} diff --git a/src/Nethermind/Nethermind.Core/Collections/HashHelpers.cs b/src/Nethermind/Nethermind.Core/Collections/HashHelpers.cs deleted file mode 100644 index e998398d5e13..000000000000 --- a/src/Nethermind/Nethermind.Core/Collections/HashHelpers.cs +++ /dev/null @@ -1,132 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -using System; -using System.Diagnostics; -using System.Runtime.CompilerServices; -using System.Runtime.Serialization; -using System.Threading; - -namespace Nethermind.Core.Collections -{ - /// - /// Adapted from .net source code. - /// - internal static class HashHelpers - { - public const uint HashCollisionThreshold = 100; - - // This is the maximum prime smaller than Array.MaxLength. - public const int MaxPrimeArrayLength = 0x7FFFFFC3; - - public const int HashPrime = 101; - - // Table of prime numbers to use as hash table sizes. - // A typical resize algorithm would pick the smallest prime number in this array - // that is larger than twice the previous capacity. - // Suppose our Hashtable currently has capacity x and enough elements are added - // such that a resize needs to occur. Resizing first computes 2x then finds the - // first prime in the table greater than 2x, i.e. if primes are ordered - // p_1, p_2, ..., p_i, ..., it finds p_n such that p_n-1 < 2x < p_n. - // Doubling is important for preserving the asymptotic complexity of the - // hashtable operations such as add. Having a prime guarantees that double - // hashing does not lead to infinite loops. IE, your hash function will be - // h1(key) + i*h2(key), 0 <= i < size. h2 and the size must be relatively prime. - // We prefer the low computation costs of higher prime numbers over the increased - // memory allocation of a fixed prime number i.e. when right sizing a HashSet. - private static readonly int[] s_primes = - { - 3, 7, 11, 17, 23, 29, 37, 47, 59, 71, 89, 107, 131, 163, 197, 239, 293, 353, 431, 521, 631, 761, 919, - 1103, 1327, 1597, 1931, 2333, 2801, 3371, 4049, 4861, 5839, 7013, 8419, 10103, 12143, 14591, - 17519, 21023, 25229, 30293, 36353, 43627, 52361, 62851, 75431, 90523, 108631, 130363, 156437, - 187751, 225307, 270371, 324449, 389357, 467237, 560689, 672827, 807403, 968897, 1162687, 1395263, - 1674319, 2009191, 2411033, 2893249, 3471899, 4166287, 4999559, 5999471, 7199369 - }; - - public static bool IsPrime(int candidate) - { - if ((candidate & 1) != 0) - { - int limit = (int)Math.Sqrt(candidate); - for (int divisor = 3; divisor <= limit; divisor += 2) - { - if ((candidate % divisor) == 0) - return false; - } - return true; - } - return candidate == 2; - } - - public static int GetPrime(int min) - { - if (min < 0) - throw new ArgumentException("Hashtable's capacity overflowed and went negative. Check load factor, capacity and the current size of the table."); - - foreach (int prime in s_primes) - { - if (prime >= min) - return prime; - } - - // Outside of our predefined table. Compute the hard way. - for (int i = (min | 1); i < int.MaxValue; i += 2) - { - if (IsPrime(i) && ((i - 1) % HashPrime != 0)) - return i; - } - return min; - } - - // Returns size of hashtable to grow to. - public static int ExpandPrime(int oldSize) - { - int newSize = 2 * oldSize; - - // Allow the hashtables to grow to maximum possible size (~2G elements) before encountering capacity overflow. - // Note that this check works even when _items.Length overflowed thanks to the (uint) cast - if ((uint)newSize > MaxPrimeArrayLength && MaxPrimeArrayLength > oldSize) - { - Debug.Assert(MaxPrimeArrayLength == GetPrime(MaxPrimeArrayLength), "Invalid MaxPrimeArrayLength"); - return MaxPrimeArrayLength; - } - - return GetPrime(newSize); - } - - /// Returns approximate reciprocal of the divisor: ceil(2**64 / divisor). - /// This should only be used on 64-bit. - public static ulong GetFastModMultiplier(uint divisor) => - ulong.MaxValue / divisor + 1; - - /// Performs a mod operation using the multiplier pre-computed with . - /// This should only be used on 64-bit. - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static uint FastMod(uint value, uint divisor, ulong multiplier) - { - // We use modified Daniel Lemire's fastmod algorithm (https://github.com/dotnet/runtime/pull/406), - // which allows to avoid the long multiplication if the divisor is less than 2**31. - Debug.Assert(divisor <= int.MaxValue); - - // This is equivalent of (uint)Math.BigMul(multiplier * value, divisor, out _). This version - // is faster than BigMul currently because we only need the high bits. - uint highbits = (uint)(((((multiplier * value) >> 32) + 1) * divisor) >> 32); - - Debug.Assert(highbits == value % divisor); - return highbits; - } - - private static ConditionalWeakTable? s_serializationInfoTable; - - public static ConditionalWeakTable SerializationInfoTable - { - get - { - if (s_serializationInfoTable is null) - Interlocked.CompareExchange(ref s_serializationInfoTable, new ConditionalWeakTable(), null); - - return s_serializationInfoTable; - } - } - } -} diff --git a/src/Nethermind/Nethermind.Core/Collections/InsertionBehavior.cs b/src/Nethermind/Nethermind.Core/Collections/InsertionBehavior.cs deleted file mode 100644 index 90f4431ec102..000000000000 --- a/src/Nethermind/Nethermind.Core/Collections/InsertionBehavior.cs +++ /dev/null @@ -1,9 +0,0 @@ -// SPDX-FileCopyrightText: 2023 Demerzel Solutions Limited -// SPDX-License-Identifier: LGPL-3.0-only - -internal enum InsertionBehavior : byte -{ - None, - OverwriteExisting, - ThrowOnExisting, -} diff --git a/src/Nethermind/Nethermind.Core/Collections/SortedRealList.cs b/src/Nethermind/Nethermind.Core/Collections/SortedRealList.cs deleted file mode 100644 index 02d66af6e651..000000000000 --- a/src/Nethermind/Nethermind.Core/Collections/SortedRealList.cs +++ /dev/null @@ -1,80 +0,0 @@ -// SPDX-FileCopyrightText: 2022 Demerzel Solutions Limited -// SPDX-License-Identifier: LGPL-3.0-only - -using System.Collections.Generic; - -namespace Nethermind.Core.Collections -{ - public class SortedRealList : SortedList, IList> where TKey : notnull - { - // Constructs a new sorted list. The sorted list is initially empty and has - // a capacity of zero. Upon adding the first element to the sorted list the - // capacity is increased to DefaultCapacity, and then increased in multiples of two as - // required. The elements of the sorted list are ordered according to the - // IComparable interface, which must be implemented by the keys of - // all entries added to the sorted list. - public SortedRealList() { } - - // Constructs a new sorted list. The sorted list is initially empty and has - // a capacity of zero. Upon adding the first element to the sorted list the - // capacity is increased to 16, and then increased in multiples of two as - // required. The elements of the sorted list are ordered according to the - // IComparable interface, which must be implemented by the keys of - // all entries added to the sorted list. - // - public SortedRealList(int capacity) : base(capacity) { } - - // Constructs a new sorted list with a given IComparer - // implementation. The sorted list is initially empty and has a capacity of - // zero. Upon adding the first element to the sorted list the capacity is - // increased to 16, and then increased in multiples of two as required. The - // elements of the sorted list are ordered according to the given - // IComparer implementation. If comparer is null, the - // elements are compared to each other using the IComparable - // interface, which in that case must be implemented by the keys of all - // entries added to the sorted list. - // - public SortedRealList(IComparer? comparer) : base(comparer) - { - } - - // Constructs a new sorted dictionary with a given IComparer - // implementation and a given initial capacity. The sorted list is - // initially empty, but will have room for the given number of elements - // before any reallocations are required. The elements of the sorted list - // are ordered according to the given IComparer implementation. If - // comparer is null, the elements are compared to each other using - // the IComparable interface, which in that case must be implemented - // by the keys of all entries added to the sorted list. - // - public SortedRealList(int capacity, IComparer? comparer) : base(capacity, comparer) { } - - // Constructs a new sorted list containing a copy of the entries in the - // given dictionary. The elements of the sorted list are ordered according - // to the IComparable interface, which must be implemented by the - // keys of all entries in the given dictionary as well as keys - // subsequently added to the sorted list. - // - public SortedRealList(IDictionary dictionary) : base(dictionary) { } - - // Constructs a new sorted list containing a copy of the entries in the - // given dictionary. The elements of the sorted list are ordered according - // to the given IComparer implementation. If comparer is - // null, the elements are compared to each other using the - // IComparable interface, which in that case must be implemented - // by the keys of all entries in the given dictionary as well as keys - // subsequently added to the sorted list. - // - public SortedRealList(IDictionary dictionary, IComparer? comparer) : base(dictionary, comparer) { } - - public int IndexOf(KeyValuePair item) => IndexOfKey(item.Key); - - public void Insert(int index, KeyValuePair item) => this.TryAdd(item.Key, item.Value); - - public KeyValuePair this[int index] - { - get => new(Keys[index], Values[index]); - set => this.TryAdd(value.Key, value.Value); - } - } -} diff --git a/src/Nethermind/Nethermind.Core/PubSub/CompositePublisher.cs b/src/Nethermind/Nethermind.Core/PubSub/CompositePublisher.cs deleted file mode 100644 index a59bf7aadbe2..000000000000 --- a/src/Nethermind/Nethermind.Core/PubSub/CompositePublisher.cs +++ /dev/null @@ -1,30 +0,0 @@ -// SPDX-FileCopyrightText: 2022 Demerzel Solutions Limited -// SPDX-License-Identifier: LGPL-3.0-only - -using System.Threading.Tasks; -using Nethermind.Core.Collections; - -namespace Nethermind.Core.PubSub -{ - public class CompositePublisher(params IPublisher[] publishers) : IPublisher - { - public async Task PublishAsync(T data) where T : class - { - using ArrayPoolList tasks = new(publishers.Length); - for (int i = 0; i < publishers.Length; i++) - { - tasks.Add(publishers[i].PublishAsync(data)); - } - - await Task.WhenAll(tasks.AsSpan()); - } - - public void Dispose() - { - foreach (IPublisher publisher in publishers) - { - publisher.Dispose(); - } - } - } -} diff --git a/src/Nethermind/Nethermind.Core/Utils/ConcurrentWriteBatcher.cs b/src/Nethermind/Nethermind.Core/Utils/ConcurrentWriteBatcher.cs deleted file mode 100644 index a6c80ed33fc7..000000000000 --- a/src/Nethermind/Nethermind.Core/Utils/ConcurrentWriteBatcher.cs +++ /dev/null @@ -1,85 +0,0 @@ -// SPDX-FileCopyrightText: 2024 Demerzel Solutions Limited -// SPDX-License-Identifier: LGPL-3.0-only - -using System; -using System.Collections.Concurrent; -using System.Threading; - -namespace Nethermind.Core.Utils; - -/// -/// Batches writes into a set of concurrent batches. For cases where throughput matter, but not atomicity. -/// -public class ConcurrentWriteBatcher : IWriteBatch -{ - private const long PersistEveryNWrite = 10000; - - private long _counter = 0; - private readonly ConcurrentQueue _batches = new(); - private readonly IKeyValueStoreWithBatching _underlyingDb; - private bool _disposing = false; - - public ConcurrentWriteBatcher(IKeyValueStoreWithBatching underlyingDb) - { - _underlyingDb = underlyingDb; - } - - public void Dispose() - { - _disposing = true; - foreach (IWriteBatch batch in _batches) - { - batch.Dispose(); - } - } - - public void PutSpan(ReadOnlySpan key, ReadOnlySpan value, WriteFlags flags = WriteFlags.None) - { - IWriteBatch currentBatch = RentWriteBatch(); - currentBatch.PutSpan(key, value, flags); - ReturnWriteBatch(currentBatch); - } - - public void Merge(ReadOnlySpan key, ReadOnlySpan value, WriteFlags flags = WriteFlags.None) - { - IWriteBatch currentBatch = RentWriteBatch(); - currentBatch.Merge(key, value, flags); - ReturnWriteBatch(currentBatch); - } - - public void Clear() - { - throw new NotSupportedException($"{nameof(ConcurrentWriteBatcher)} can not be cancelled."); - } - - public void Set(ReadOnlySpan key, byte[]? value, WriteFlags flags = WriteFlags.None) - { - IWriteBatch currentBatch = RentWriteBatch(); - currentBatch.Set(key, value, flags); - ReturnWriteBatch(currentBatch); - } - - private void ReturnWriteBatch(IWriteBatch currentBatch) - { - long val = Interlocked.Increment(ref _counter); - if (val % PersistEveryNWrite == 0) - { - currentBatch.Dispose(); - } - else - { - _batches.Enqueue(currentBatch); - } - } - - private IWriteBatch RentWriteBatch() - { - if (_disposing) throw new InvalidOperationException("Trying to set while disposing"); - if (!_batches.TryDequeue(out IWriteBatch? currentBatch)) - { - currentBatch = _underlyingDb.StartWriteBatch(); - } - - return currentBatch; - } -} diff --git a/src/Nethermind/Nethermind.Evm/BadInstructionException.cs b/src/Nethermind/Nethermind.Evm/BadInstructionException.cs deleted file mode 100644 index e8caed45f5cd..000000000000 --- a/src/Nethermind/Nethermind.Evm/BadInstructionException.cs +++ /dev/null @@ -1,9 +0,0 @@ -// SPDX-FileCopyrightText: 2025 Demerzel Solutions Limited -// SPDX-License-Identifier: LGPL-3.0-only - -namespace Nethermind.Evm; - -public class BadInstructionException : EvmException -{ - public override EvmExceptionType ExceptionType => EvmExceptionType.BadInstruction; -} diff --git a/src/Nethermind/Nethermind.Evm/InvalidCodeException.cs b/src/Nethermind/Nethermind.Evm/InvalidCodeException.cs deleted file mode 100644 index e7c662416c3d..000000000000 --- a/src/Nethermind/Nethermind.Evm/InvalidCodeException.cs +++ /dev/null @@ -1,10 +0,0 @@ -// SPDX-FileCopyrightText: 2022 Demerzel Solutions Limited -// SPDX-License-Identifier: LGPL-3.0-only - -namespace Nethermind.Evm -{ - public class InvalidCodeException : EvmException - { - public override EvmExceptionType ExceptionType => EvmExceptionType.InvalidCode; - } -} diff --git a/src/Nethermind/Nethermind.Evm/TransactionCollisionException.cs b/src/Nethermind/Nethermind.Evm/TransactionCollisionException.cs deleted file mode 100644 index 0c577ef83c04..000000000000 --- a/src/Nethermind/Nethermind.Evm/TransactionCollisionException.cs +++ /dev/null @@ -1,10 +0,0 @@ -// SPDX-FileCopyrightText: 2022 Demerzel Solutions Limited -// SPDX-License-Identifier: LGPL-3.0-only - -namespace Nethermind.Evm -{ - public class TransactionCollisionException : EvmException - { - public override EvmExceptionType ExceptionType => EvmExceptionType.TransactionCollision; - } -} diff --git a/src/Nethermind/Nethermind.Init/Steps/InitializeBlockchain.cs b/src/Nethermind/Nethermind.Init/Steps/InitializeBlockchain.cs index aa64b11639b8..8e866c3ac38a 100644 --- a/src/Nethermind/Nethermind.Init/Steps/InitializeBlockchain.cs +++ b/src/Nethermind/Nethermind.Init/Steps/InitializeBlockchain.cs @@ -32,7 +32,6 @@ namespace Nethermind.Init.Steps public class InitializeBlockchain(INethermindApi api, IChainHeadInfoProvider chainHeadInfoProvider) : IStep { private readonly INethermindApi _api = api; - private ILogManager _logManager = api.LogManager; public async Task Execute(CancellationToken _) { diff --git a/src/Nethermind/Nethermind.JsonRpc/ErrorCodes.cs b/src/Nethermind/Nethermind.JsonRpc/ErrorCodes.cs index 248dd56e28db..47bc3b4dc769 100644 --- a/src/Nethermind/Nethermind.JsonRpc/ErrorCodes.cs +++ b/src/Nethermind/Nethermind.JsonRpc/ErrorCodes.cs @@ -62,21 +62,11 @@ public static class ErrorCodes /// public const int AccountLocked = -32020; - /// - /// Method is not implemented - /// - public const int MethodNotSupported = -32004; - /// /// Request exceeds defined limit /// public const int LimitExceeded = -32005; - /// - /// - /// - public const int ExecutionError = -32015; - /// /// Request exceeds defined timeout limit /// @@ -107,16 +97,6 @@ public static class ErrorCodes /// public const int InvalidInputTooManyBlocks = -38026; - /// - /// Invalid RPC simulate call Not enough gas provided to pay for intrinsic gas for a transaction - /// - public const int InsufficientIntrinsicGas = -38013; - - /// - /// Invalid RPC simulate call transaction - /// - public const int InvalidTransaction = -38014; - /// /// Too many blocks for simulation /// @@ -132,16 +112,6 @@ public static class ErrorCodes /// public const int Default = -32000; - /// - /// Transaction.Nonce is bigger than expected nonce - /// - public const int NonceTooHigh = -38011; - - /// - /// Transaction.Nonce is smaller than expected nonce - /// - public const int NonceTooLow = -38010; - /// /// Invalid intrinsic gas. Miner premium is negative /// @@ -157,21 +127,6 @@ public static class ErrorCodes /// public const int BlockGasLimitReached = -38015; - /// - /// Invalid block number - /// - public const int BlockNumberInvalid = -38020; - - /// - /// Invalid block timestamp - /// - public const int BlockTimestampInvalid = -38021; - - /// - /// Transaction.Sender is not an EOA - /// - public const int SenderIsNotEOA = -38024; - /// /// EIP-3860. Code size is to big /// @@ -186,7 +141,5 @@ public static class ErrorCodes /// Error during EVM execution /// public const int VMError = -32015; - public const int TxSyncTimeout = 4; - public const int ClientLimitExceeded = -38026; } } diff --git a/src/Nethermind/Nethermind.JsonRpc/IJsonRpcResult.cs b/src/Nethermind/Nethermind.JsonRpc/IJsonRpcResult.cs deleted file mode 100644 index 845540f0d11e..000000000000 --- a/src/Nethermind/Nethermind.JsonRpc/IJsonRpcResult.cs +++ /dev/null @@ -1,10 +0,0 @@ -// SPDX-FileCopyrightText: 2022 Demerzel Solutions Limited -// SPDX-License-Identifier: LGPL-3.0-only - -namespace Nethermind.JsonRpc -{ - public interface IJsonRpcResult - { - object ToJson(); - } -} diff --git a/src/Nethermind/Nethermind.Merge.Plugin.Test/EngineModuleTests.Synchronization.cs b/src/Nethermind/Nethermind.Merge.Plugin.Test/EngineModuleTests.Synchronization.cs index 2c00637b395e..1b2580b8591f 100644 --- a/src/Nethermind/Nethermind.Merge.Plugin.Test/EngineModuleTests.Synchronization.cs +++ b/src/Nethermind/Nethermind.Merge.Plugin.Test/EngineModuleTests.Synchronization.cs @@ -1054,8 +1054,7 @@ private MultiSyncModeSelector CreateMultiSyncModeSelector(MergeTestBlockchain ch Substitute.For>(), Substitute.For>(), Substitute.For>(), - Substitute.For>(), - LimboLogs.Instance); + Substitute.For>()); MultiSyncModeSelector multiSyncModeSelector = new(syncProgressResolver, syncPeerPool, new SyncConfig(), No.BeaconSync, diff --git a/src/Nethermind/Nethermind.Network.Discovery/Serializers/IDiscoveryMsgSerializersProvider.cs b/src/Nethermind/Nethermind.Network.Discovery/Serializers/IDiscoveryMsgSerializersProvider.cs deleted file mode 100644 index ea094cec0d7e..000000000000 --- a/src/Nethermind/Nethermind.Network.Discovery/Serializers/IDiscoveryMsgSerializersProvider.cs +++ /dev/null @@ -1,9 +0,0 @@ -// SPDX-FileCopyrightText: 2022 Demerzel Solutions Limited -// SPDX-License-Identifier: LGPL-3.0-only - -namespace Nethermind.Network.Discovery.Serializers; - -public interface IDiscoveryMsgSerializersProvider -{ - void RegisterDiscoverySerializers(); -} diff --git a/src/Nethermind/Nethermind.Network/PeerEqualityComparer.cs b/src/Nethermind/Nethermind.Network/PeerEqualityComparer.cs deleted file mode 100644 index 68a0ad6649d3..000000000000 --- a/src/Nethermind/Nethermind.Network/PeerEqualityComparer.cs +++ /dev/null @@ -1,22 +0,0 @@ -// SPDX-FileCopyrightText: 2022 Demerzel Solutions Limited -// SPDX-License-Identifier: LGPL-3.0-only - -using System.Collections.Generic; - -namespace Nethermind.Network -{ - internal class PeerEqualityComparer : IEqualityComparer - { - public bool Equals(Peer x, Peer y) - { - if (x is null || y is null) - { - return false; - } - - return x.Node.Id.Equals(y.Node.Id); - } - - public int GetHashCode(Peer obj) => obj?.Node is null ? 0 : obj.Node.GetHashCode(); - } -} diff --git a/src/Nethermind/Nethermind.Optimism/CL/L1Bridge/EthereumL1Bridge.cs b/src/Nethermind/Nethermind.Optimism/CL/L1Bridge/EthereumL1Bridge.cs index 879b6044d189..7ca731bd5a3d 100644 --- a/src/Nethermind/Nethermind.Optimism/CL/L1Bridge/EthereumL1Bridge.cs +++ b/src/Nethermind/Nethermind.Optimism/CL/L1Bridge/EthereumL1Bridge.cs @@ -17,9 +17,6 @@ namespace Nethermind.Optimism.CL.L1Bridge; public class EthereumL1Bridge : IL1Bridge { - private const int L1EpochSlotSize = 32; - private const int L1SlotTimeMilliseconds = 12000; - private const int L1EpochTimeMilliseconds = L1EpochSlotSize * L1SlotTimeMilliseconds; private readonly IEthApi _ethL1Api; private readonly IBeaconApi _beaconApi; private readonly ILogger _logger; @@ -224,11 +221,6 @@ private DaDataSource ProcessCalldataBatcherTransaction(L1Transaction transaction return _unfinalizedL1BlocksQueue.Count == 0 ? null : _unfinalizedL1BlocksQueue.Dequeue(); } - private void LogReorg() - { - if (_logger.IsInfo) _logger.Info("L1 reorg detected. Resetting pipeline"); - } - public async Task GetBlock(ulong blockNumber, CancellationToken token) => await RetryGetBlock(async () => await _ethL1Api.GetBlockByNumber(blockNumber, true), token); diff --git a/src/Nethermind/Nethermind.Runner/Ethereum/EthereumRunner.cs b/src/Nethermind/Nethermind.Runner/Ethereum/EthereumRunner.cs index 9cb196730d2c..75ec67da4646 100644 --- a/src/Nethermind/Nethermind.Runner/Ethereum/EthereumRunner.cs +++ b/src/Nethermind/Nethermind.Runner/Ethereum/EthereumRunner.cs @@ -1,7 +1,6 @@ // SPDX-FileCopyrightText: 2022 Demerzel Solutions Limited // SPDX-License-Identifier: LGPL-3.0-only -using System; using System.Threading; using System.Threading.Tasks; using Autofac; @@ -41,18 +40,4 @@ public async Task StopAsync() _logger.Info("Ethereum runner stopped"); } } - - private Task Stop(Func stopAction, string description) - { - try - { - if (_logger.IsInfo) _logger.Info(description); - return stopAction() ?? Task.CompletedTask; - } - catch (Exception e) - { - if (_logger.IsError) _logger.Error($"{description} shutdown error.", e); - return Task.CompletedTask; - } - } } diff --git a/src/Nethermind/Nethermind.Serialization.Json/CountingTextReader.cs b/src/Nethermind/Nethermind.Serialization.Json/CountingTextReader.cs deleted file mode 100644 index fa57f6b5a795..000000000000 --- a/src/Nethermind/Nethermind.Serialization.Json/CountingTextReader.cs +++ /dev/null @@ -1,83 +0,0 @@ -// SPDX-FileCopyrightText: 2022 Demerzel Solutions Limited -// SPDX-License-Identifier: LGPL-3.0-only - -using System; -using System.IO; -using System.Threading; -using System.Threading.Tasks; - -namespace Nethermind.Serialization.Json -{ - public class CountingTextReader : TextReader - { - private readonly TextReader _innerReader; - public int Length { get; private set; } - - public CountingTextReader(TextReader innerReader) - { - _innerReader = innerReader; - } - - public override void Close() - { - base.Close(); - _innerReader.Close(); - } - - protected override void Dispose(bool disposing) - { - base.Dispose(disposing); - if (disposing) - { - _innerReader.Dispose(); - } - } - - public override int Peek() => _innerReader.Peek(); - - public override int Read() - { - Length++; - return _innerReader.Read(); - } - - public override int Read(char[] buffer, int index, int count) => IncrementLength(_innerReader.Read(buffer, index, count)); - - public override int Read(Span buffer) => IncrementLength(_innerReader.Read(buffer)); - - public override async Task ReadAsync(char[] buffer, int index, int count) => IncrementLength(await _innerReader.ReadAsync(buffer, index, count)); - - public override async ValueTask ReadAsync(Memory buffer, CancellationToken cancellationToken = default) => IncrementLength(await _innerReader.ReadAsync(buffer, cancellationToken)); - - public override int ReadBlock(char[] buffer, int index, int count) => IncrementLength(_innerReader.ReadBlock(buffer, index, count)); - - public override int ReadBlock(Span buffer) => IncrementLength(_innerReader.ReadBlock(buffer)); - - public override string ReadLine() => IncrementLength(_innerReader.ReadLine()); - - public override async ValueTask ReadBlockAsync(Memory buffer, CancellationToken cancellationToken = default) => IncrementLength(await _innerReader.ReadBlockAsync(buffer, cancellationToken)); - - public override async Task ReadBlockAsync(char[] buffer, int index, int count) => IncrementLength(await _innerReader.ReadBlockAsync(buffer, index, count)); - - public override async Task ReadLineAsync() => IncrementLength(await _innerReader.ReadLineAsync()); - - public override string ReadToEnd() => IncrementLength(_innerReader.ReadToEnd()); - - public override async Task ReadToEndAsync() => IncrementLength(await _innerReader.ReadToEndAsync()); - - private string IncrementLength(in string read) - { - if (!string.IsNullOrEmpty(read)) - { - Length += read.Length; - } - return read; - } - - private int IncrementLength(in int read) - { - Length += read; - return read; - } - } -} diff --git a/src/Nethermind/Nethermind.Serialization.Json/CountingTextWriter.cs b/src/Nethermind/Nethermind.Serialization.Json/CountingTextWriter.cs deleted file mode 100644 index 16beb11721d9..000000000000 --- a/src/Nethermind/Nethermind.Serialization.Json/CountingTextWriter.cs +++ /dev/null @@ -1,42 +0,0 @@ -// SPDX-FileCopyrightText: 2022 Demerzel Solutions Limited -// SPDX-License-Identifier: LGPL-3.0-only - -using System; -using System.IO; -using System.Text; - -namespace Nethermind.Serialization.Json -{ - public class CountingTextWriter : TextWriter - { - private readonly TextWriter _textWriter; - - public long Size { get; private set; } - - public CountingTextWriter(TextWriter textWriter) - { - _textWriter = textWriter ?? throw new ArgumentNullException(nameof(textWriter)); - } - - public override Encoding Encoding => _textWriter.Encoding; - - public override void Write(char value) - { - _textWriter.Write(value); - Size++; - } - - public override void Flush() - { - _textWriter.Flush(); - } - - protected override void Dispose(bool disposing) - { - if (disposing) - { - _textWriter.Dispose(); - } - } - } -} diff --git a/src/Nethermind/Nethermind.Serialization.Json/PubSub/LogPublisher.cs b/src/Nethermind/Nethermind.Serialization.Json/PubSub/LogPublisher.cs deleted file mode 100644 index 75a0807cca7d..000000000000 --- a/src/Nethermind/Nethermind.Serialization.Json/PubSub/LogPublisher.cs +++ /dev/null @@ -1,31 +0,0 @@ -// SPDX-FileCopyrightText: 2022 Demerzel Solutions Limited -// SPDX-License-Identifier: LGPL-3.0-only - -using System.Threading.Tasks; -using Nethermind.Core.PubSub; -using Nethermind.Logging; - -namespace Nethermind.Serialization.Json.PubSub -{ - public class LogPublisher : IPublisher - { - private readonly ILogger _logger; - private readonly IJsonSerializer _jsonSerializer; - - public LogPublisher(IJsonSerializer jsonSerializer, ILogManager logManager) - { - _logger = logManager.GetClassLogger(); - _jsonSerializer = jsonSerializer; - } - - public Task PublishAsync(T data) where T : class - { - if (_logger.IsInfo) _logger.Info(_jsonSerializer.Serialize(data)); - return Task.CompletedTask; - } - - public void Dispose() - { - } - } -} diff --git a/src/Nethermind/Nethermind.Serialization.Ssz/Ssz.BasicTypes.cs b/src/Nethermind/Nethermind.Serialization.Ssz/Ssz.BasicTypes.cs index f95471e7864e..41bd474e5c5a 100644 --- a/src/Nethermind/Nethermind.Serialization.Ssz/Ssz.BasicTypes.cs +++ b/src/Nethermind/Nethermind.Serialization.Ssz/Ssz.BasicTypes.cs @@ -15,6 +15,8 @@ namespace Nethermind.Serialization.Ssz; /// public static partial class Ssz { + private const int VarOffsetSize = sizeof(uint); + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static void Encode(Span span, byte[] value, ref int offset) { diff --git a/src/Nethermind/Nethermind.Serialization.Ssz/Ssz.Containers.cs b/src/Nethermind/Nethermind.Serialization.Ssz/Ssz.Containers.cs deleted file mode 100644 index 3055b6038a62..000000000000 --- a/src/Nethermind/Nethermind.Serialization.Ssz/Ssz.Containers.cs +++ /dev/null @@ -1,18 +0,0 @@ -// SPDX-FileCopyrightText: 2022 Demerzel Solutions Limited -// SPDX-License-Identifier: LGPL-3.0-only - -using System; - -namespace Nethermind.Serialization.Ssz; - -public partial class Ssz -{ - private const int VarOffsetSize = sizeof(uint); - - private static void DecodeDynamicOffset(ReadOnlySpan span, ref int offset, out int dynamicOffset) - { - dynamicOffset = (int)DecodeUInt(span.Slice(offset, VarOffsetSize)); - offset += sizeof(uint); - } - -} diff --git a/src/Nethermind/Nethermind.State/PersistentStorageProvider.cs b/src/Nethermind/Nethermind.State/PersistentStorageProvider.cs index f74d9a3f5d46..85bf38a4e6ca 100644 --- a/src/Nethermind/Nethermind.State/PersistentStorageProvider.cs +++ b/src/Nethermind/Nethermind.State/PersistentStorageProvider.cs @@ -452,7 +452,6 @@ public void UnmarkClear() private sealed class PerContractState : IReturnable { - private static readonly Func _loadFromTreeStorageFunc = LoadFromTreeStorage; private IWorldStateScopeProvider.IStorageTree? _backend; private readonly DefaultableDictionary BlockChange = new(); diff --git a/src/Nethermind/Nethermind.Synchronization.Test/SyncProgressResolverTests.cs b/src/Nethermind/Nethermind.Synchronization.Test/SyncProgressResolverTests.cs index af08c2f41a61..ffc7eb77719a 100644 --- a/src/Nethermind/Nethermind.Synchronization.Test/SyncProgressResolverTests.cs +++ b/src/Nethermind/Nethermind.Synchronization.Test/SyncProgressResolverTests.cs @@ -6,7 +6,6 @@ using Nethermind.Core; using Nethermind.Core.Crypto; using Nethermind.Core.Test.Builders; -using Nethermind.Logging; using Nethermind.State; using Nethermind.Synchronization.FastBlocks; using Nethermind.Synchronization.ParallelSync; @@ -31,7 +30,7 @@ public void Header_block_is_0_when_no_header_was_suggested() PivotNumber = 1, }; - SyncProgressResolver syncProgressResolver = CreateProgressResolver(blockTree, stateReader, false, syncConfig, LimboLogs.Instance); + SyncProgressResolver syncProgressResolver = CreateProgressResolver(blockTree, stateReader, false, syncConfig); blockTree.BestSuggestedHeader.ReturnsNull(); Assert.That(syncProgressResolver.FindBestHeader(), Is.EqualTo(0)); } @@ -46,7 +45,7 @@ public void Best_block_is_0_when_no_block_was_suggested() PivotNumber = 1, }; - SyncProgressResolver syncProgressResolver = CreateProgressResolver(blockTree, stateReader, false, syncConfig, LimboLogs.Instance); + SyncProgressResolver syncProgressResolver = CreateProgressResolver(blockTree, stateReader, false, syncConfig); blockTree.BestSuggestedBody.ReturnsNull(); Assert.That(syncProgressResolver.FindBestFullBlock(), Is.EqualTo(0)); } @@ -61,7 +60,7 @@ public void Best_state_is_head_when_there_are_no_suggested_blocks() PivotNumber = 1, }; - SyncProgressResolver syncProgressResolver = CreateProgressResolver(blockTree, stateReader, false, syncConfig, LimboLogs.Instance); + SyncProgressResolver syncProgressResolver = CreateProgressResolver(blockTree, stateReader, false, syncConfig); Block head = Build.A.Block.WithHeader(Build.A.BlockHeader.WithNumber(5).WithStateRoot(TestItem.KeccakA).TestObject).TestObject; blockTree.Head.Returns(head); blockTree.BestSuggestedHeader.Returns(head.Header); @@ -79,7 +78,7 @@ public void Best_state_is_suggested_if_there_is_suggested_block_with_state() PivotNumber = 1, }; - SyncProgressResolver syncProgressResolver = CreateProgressResolver(blockTree, stateReader, false, syncConfig, LimboLogs.Instance); + SyncProgressResolver syncProgressResolver = CreateProgressResolver(blockTree, stateReader, false, syncConfig); Block head = Build.A.Block.WithHeader(Build.A.BlockHeader.WithNumber(5).WithStateRoot(TestItem.KeccakA).TestObject).TestObject; BlockHeader suggested = Build.A.BlockHeader.WithNumber(6).WithStateRoot(TestItem.KeccakB).TestObject; blockTree.Head.Returns(head); @@ -101,7 +100,7 @@ public void Best_state_is_head_if_there_is_suggested_block_without_state() PivotNumber = 1, }; - SyncProgressResolver syncProgressResolver = CreateProgressResolver(blockTree, stateReader, false, syncConfig, LimboLogs.Instance); + SyncProgressResolver syncProgressResolver = CreateProgressResolver(blockTree, stateReader, false, syncConfig); Block head = Build.A.Block.WithHeader(Build.A.BlockHeader.WithNumber(5).WithStateRoot(TestItem.KeccakA).TestObject).TestObject; BlockHeader suggested = Build.A.BlockHeader.WithNumber(6).WithStateRoot(TestItem.KeccakB).TestObject; blockTree.Head.Returns(head); @@ -123,7 +122,7 @@ public void Is_fast_block_finished_returns_true_when_no_fast_sync_is_used() PivotNumber = 1, }; - SyncProgressResolver syncProgressResolver = CreateProgressResolver(blockTree, stateReader, false, syncConfig, LimboLogs.Instance); + SyncProgressResolver syncProgressResolver = CreateProgressResolver(blockTree, stateReader, false, syncConfig); Assert.That(syncProgressResolver.IsFastBlocksHeadersFinished(), Is.True); Assert.That(syncProgressResolver.IsFastBlocksBodiesFinished(), Is.True); Assert.That(syncProgressResolver.IsFastBlocksReceiptsFinished(), Is.True); @@ -145,7 +144,7 @@ public void Is_fast_block_bodies_finished_returns_false_when_blocks_not_download blockTree.LowestInsertedHeader.Returns(Build.A.BlockHeader.WithNumber(1).WithStateRoot(TestItem.KeccakA).TestObject); - SyncProgressResolver syncProgressResolver = CreateProgressResolver(blockTree, stateReader, false, syncConfig, LimboLogs.Instance); + SyncProgressResolver syncProgressResolver = CreateProgressResolver(blockTree, stateReader, false, syncConfig); Assert.That(syncProgressResolver.IsFastBlocksBodiesFinished(), Is.False); } @@ -164,12 +163,12 @@ public void Is_fast_block_receipts_finished_returns_true_when_receipts_not_downl blockTree.LowestInsertedHeader.Returns(Build.A.BlockHeader.WithNumber(1).WithStateRoot(TestItem.KeccakA).TestObject); - SyncProgressResolver syncProgressResolver = CreateProgressResolver(blockTree, stateReader, true, syncConfig, LimboLogs.Instance); + SyncProgressResolver syncProgressResolver = CreateProgressResolver(blockTree, stateReader, true, syncConfig); Assert.That(syncProgressResolver.IsFastBlocksReceiptsFinished(), Is.True); } - private SyncProgressResolver CreateProgressResolver(IBlockTree blockTree, IStateReader stateReader, bool isReceiptFinished, SyncConfig syncConfig, LimboLogs limboLogs) + private SyncProgressResolver CreateProgressResolver(IBlockTree blockTree, IStateReader stateReader, bool isReceiptFinished, SyncConfig syncConfig) { ISyncFeed receiptFeed = Substitute.For>(); receiptFeed.IsFinished.Returns(isReceiptFinished); @@ -181,8 +180,7 @@ private SyncProgressResolver CreateProgressResolver(IBlockTree blockTree, IState Substitute.For>(), Substitute.For>(), receiptFeed, - Substitute.For>(), - limboLogs + Substitute.For>() ); } } diff --git a/src/Nethermind/Nethermind.Synchronization/ParallelSync/SyncProgressResolver.cs b/src/Nethermind/Nethermind.Synchronization/ParallelSync/SyncProgressResolver.cs index 0f2c9cd0b1a2..1eaf7d0d9cd1 100644 --- a/src/Nethermind/Nethermind.Synchronization/ParallelSync/SyncProgressResolver.cs +++ b/src/Nethermind/Nethermind.Synchronization/ParallelSync/SyncProgressResolver.cs @@ -8,7 +8,6 @@ using Nethermind.Core; using Nethermind.Core.Crypto; using Nethermind.Int256; -using Nethermind.Logging; using Nethermind.Synchronization.FastBlocks; using Nethermind.Synchronization.SnapSync; @@ -21,9 +20,6 @@ public class SyncProgressResolver : ISyncProgressResolver private readonly ISyncConfig _syncConfig; private readonly IFullStateFinder _fullStateFinder; - // ReSharper disable once NotAccessedField.Local - private readonly ILogger _logger; - private readonly ISyncFeed _headersSyncFeed; private readonly ISyncFeed _bodiesSyncFeed; private readonly ISyncFeed _receiptsSyncFeed; @@ -36,10 +32,8 @@ public SyncProgressResolver( [KeyFilter(nameof(HeadersSyncFeed))] ISyncFeed headersSyncFeed, ISyncFeed bodiesSyncFeed, ISyncFeed receiptsSyncFeed, - ISyncFeed snapSyncFeed, - ILogManager logManager) + ISyncFeed snapSyncFeed) { - _logger = logManager?.GetClassLogger() ?? throw new ArgumentNullException(nameof(logManager)); _blockTree = blockTree ?? throw new ArgumentNullException(nameof(blockTree)); _fullStateFinder = fullStateFinder ?? throw new ArgumentNullException(nameof(fullStateFinder)); _syncConfig = syncConfig ?? throw new ArgumentNullException(nameof(syncConfig)); diff --git a/src/Nethermind/Nethermind.Synchronization/Peers/AllocationStrategies/ClientTypeStrategy.cs b/src/Nethermind/Nethermind.Synchronization/Peers/AllocationStrategies/ClientTypeStrategy.cs deleted file mode 100644 index 142c2ff819c8..000000000000 --- a/src/Nethermind/Nethermind.Synchronization/Peers/AllocationStrategies/ClientTypeStrategy.cs +++ /dev/null @@ -1,44 +0,0 @@ -// SPDX-FileCopyrightText: 2022 Demerzel Solutions Limited -// SPDX-License-Identifier: LGPL-3.0-only - -using System.Collections.Generic; -using System.Linq; -using Nethermind.Blockchain; -using Nethermind.Stats; -using Nethermind.Stats.Model; - -namespace Nethermind.Synchronization.Peers.AllocationStrategies; - -public class ClientTypeStrategy : IPeerAllocationStrategy -{ - private readonly IPeerAllocationStrategy _strategy; - private readonly bool _allowOtherIfNone; - private readonly HashSet _supportedClientTypes; - - public ClientTypeStrategy(IPeerAllocationStrategy strategy, bool allowOtherIfNone, params NodeClientType[] supportedClientTypes) - : this(strategy, allowOtherIfNone, (IEnumerable)supportedClientTypes) - { - } - - public ClientTypeStrategy(IPeerAllocationStrategy strategy, bool allowOtherIfNone, IEnumerable supportedClientTypes) - { - _strategy = strategy; - _allowOtherIfNone = allowOtherIfNone; - _supportedClientTypes = new HashSet(supportedClientTypes); - } - - public PeerInfo? Allocate(PeerInfo? currentPeer, IEnumerable peers, INodeStatsManager nodeStatsManager, IBlockTree blockTree) - { - IEnumerable originalPeers = peers; - peers = peers.Where(p => _supportedClientTypes.Contains(p.PeerClientType)); - - if (_allowOtherIfNone) - { - if (!peers.Any()) - { - peers = originalPeers; - } - } - return _strategy.Allocate(currentPeer, peers, nodeStatsManager, blockTree); - } -} diff --git a/src/Nethermind/Nethermind.Synchronization/Peers/AllocationStrategies/NullStrategy.cs b/src/Nethermind/Nethermind.Synchronization/Peers/AllocationStrategies/NullStrategy.cs deleted file mode 100644 index fcf28b1a4a45..000000000000 --- a/src/Nethermind/Nethermind.Synchronization/Peers/AllocationStrategies/NullStrategy.cs +++ /dev/null @@ -1,26 +0,0 @@ -// SPDX-FileCopyrightText: 2022 Demerzel Solutions Limited -// SPDX-License-Identifier: LGPL-3.0-only - -using System.Collections.Generic; -using Nethermind.Blockchain; -using Nethermind.Stats; - -namespace Nethermind.Synchronization.Peers.AllocationStrategies -{ - /// - /// used only for failed allocations - /// - public class NullStrategy : IPeerAllocationStrategy - { - private NullStrategy() - { - } - - public static IPeerAllocationStrategy Instance { get; } = new NullStrategy(); - - public PeerInfo? Allocate(PeerInfo? currentPeer, IEnumerable peers, INodeStatsManager nodeStatsManager, IBlockTree blockTree) - { - return null; - } - } -} diff --git a/src/Nethermind/Nethermind.Synchronization/Peers/AllocationStrategies/StaticStrategy.cs b/src/Nethermind/Nethermind.Synchronization/Peers/AllocationStrategies/StaticStrategy.cs deleted file mode 100644 index 7d9a5b4de624..000000000000 --- a/src/Nethermind/Nethermind.Synchronization/Peers/AllocationStrategies/StaticStrategy.cs +++ /dev/null @@ -1,24 +0,0 @@ -// SPDX-FileCopyrightText: 2022 Demerzel Solutions Limited -// SPDX-License-Identifier: LGPL-3.0-only - -using System.Collections.Generic; -using Nethermind.Blockchain; -using Nethermind.Stats; - -namespace Nethermind.Synchronization.Peers.AllocationStrategies -{ - public class StaticStrategy : IPeerAllocationStrategy - { - private readonly PeerInfo _peerInfo; - - public StaticStrategy(PeerInfo peerInfo) - { - _peerInfo = peerInfo; - } - - public PeerInfo Allocate(PeerInfo? currentPeer, IEnumerable peers, INodeStatsManager nodeStatsManager, IBlockTree blockTree) - { - return _peerInfo; - } - } -} diff --git a/src/Nethermind/Nethermind.Synchronization/Peers/AllocationStrategies/StrategySelectionType.cs b/src/Nethermind/Nethermind.Synchronization/Peers/AllocationStrategies/StrategySelectionType.cs deleted file mode 100644 index c20046181c27..000000000000 --- a/src/Nethermind/Nethermind.Synchronization/Peers/AllocationStrategies/StrategySelectionType.cs +++ /dev/null @@ -1,11 +0,0 @@ -// SPDX-FileCopyrightText: 2025 Demerzel Solutions Limited -// SPDX-License-Identifier: LGPL-3.0-only - -namespace Nethermind.Synchronization.Peers.AllocationStrategies; - -public enum StrategySelectionType -{ - Better = 1, - AtLeastTheSame = 0, - CanBeSlightlyWorse = -1 -} diff --git a/src/Nethermind/Nethermind.Synchronization/SyncPeerEventArgs.cs b/src/Nethermind/Nethermind.Synchronization/SyncPeerEventArgs.cs deleted file mode 100644 index 3d5fbf168612..000000000000 --- a/src/Nethermind/Nethermind.Synchronization/SyncPeerEventArgs.cs +++ /dev/null @@ -1,20 +0,0 @@ -// SPDX-FileCopyrightText: 2022 Demerzel Solutions Limited -// SPDX-License-Identifier: LGPL-3.0-only - -using Nethermind.Synchronization.Peers; - -namespace Nethermind.Synchronization -{ - public class AllocationChangeEventArgs - { - public AllocationChangeEventArgs(PeerInfo? previous, PeerInfo? current) - { - Previous = previous; - Current = current; - } - - public PeerInfo? Previous { get; } - - public PeerInfo? Current { get; } - } -} diff --git a/src/Nethermind/Nethermind.Taiko/Tdx/TdxsClient.cs b/src/Nethermind/Nethermind.Taiko/Tdx/TdxsClient.cs index 081e33262199..999fabaa0f41 100644 --- a/src/Nethermind/Nethermind.Taiko/Tdx/TdxsClient.cs +++ b/src/Nethermind/Nethermind.Taiko/Tdx/TdxsClient.cs @@ -6,7 +6,6 @@ using System.Net.Sockets; using System.Text; using System.Text.Json; -using Nethermind.Logging; namespace Nethermind.Taiko.Tdx; @@ -14,9 +13,8 @@ namespace Nethermind.Taiko.Tdx; /// Client for communicating with the tdxs daemon via Unix socket. /// Protocol: JSON request/response over Unix socket. /// -public class TdxsClient(ISurgeTdxConfig config, ILogManager logManager) : ITdxsClient +public class TdxsClient(ISurgeTdxConfig config) : ITdxsClient { - private readonly ILogger _logger = logManager.GetClassLogger(); public byte[] Issue(byte[] userData, byte[] nonce) { diff --git a/src/Nethermind/Nethermind.Trie/PatriciaTree.cs b/src/Nethermind/Nethermind.Trie/PatriciaTree.cs index 08b96d207fc8..d42c85a23f6e 100644 --- a/src/Nethermind/Nethermind.Trie/PatriciaTree.cs +++ b/src/Nethermind/Nethermind.Trie/PatriciaTree.cs @@ -6,7 +6,6 @@ using System.Collections.Generic; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; -using System.IO; using System.Runtime.CompilerServices; using System.Threading; using System.Threading.Tasks; @@ -25,7 +24,6 @@ namespace Nethermind.Trie public partial class PatriciaTree { private const int MaxKeyStackAlloc = 64; - private readonly static byte[][] _singleByteKeys = [[0], [1], [2], [3], [4], [5], [6], [7], [8], [9], [10], [11], [12], [13], [14], [15]]; private readonly ILogger _logger; @@ -1003,25 +1001,5 @@ bool TryGetRootRef(out TrieNode? rootRef) [DoesNotReturn, StackTraceHidden] static void ThrowReadOnlyTrieException() => throw new TrieException("Commits are not allowed on this trie."); - - [DoesNotReturn, StackTraceHidden] - private static void ThrowInvalidDataException(TrieNode originalNode) - { - throw new InvalidDataException( - $"Extension {originalNode.Keccak} has no child."); - } - - [DoesNotReturn, StackTraceHidden] - private static void ThrowMissingChildException(TrieNode node) - { - throw new TrieException( - $"Found an {nameof(NodeType.Extension)} {node.Keccak} that is missing a child."); - } - - [DoesNotReturn, StackTraceHidden] - private static void ThrowMissingPrefixException() - { - throw new InvalidDataException("An attempt to visit a node without a prefix path."); - } } } diff --git a/src/Nethermind/Nethermind.Trie/Pruning/TrieStore.cs b/src/Nethermind/Nethermind.Trie/Pruning/TrieStore.cs index a53f33528f54..abd7da715b18 100644 --- a/src/Nethermind/Nethermind.Trie/Pruning/TrieStore.cs +++ b/src/Nethermind/Nethermind.Trie/Pruning/TrieStore.cs @@ -1228,11 +1228,6 @@ public bool IsNoLongerNeeded(long lastCommit) && lastCommit < LatestCommittedBlockNumber - _maxDepth; } - private bool IsStillNeeded(long lastCommit) - { - return !IsNoLongerNeeded(lastCommit); - } - private void AnnounceReorgBoundaries() { if (LatestCommittedBlockNumber < 1) diff --git a/src/Nethermind/Nethermind.Trie/TrieNode.cs b/src/Nethermind/Nethermind.Trie/TrieNode.cs index 52dc5e0b1c9b..e660f86c5d87 100644 --- a/src/Nethermind/Nethermind.Trie/TrieNode.cs +++ b/src/Nethermind/Nethermind.Trie/TrieNode.cs @@ -32,7 +32,6 @@ public sealed partial class TrieNode #endif private static readonly object _nullNode = new(); - private static readonly TrieNodeDecoder _nodeDecoder = new(); private static readonly AccountDecoder _accountDecoder = new(); private const byte _dirtyMask = 0b001; diff --git a/src/Nethermind/Nethermind.Trie/VisitContext.cs b/src/Nethermind/Nethermind.Trie/VisitContext.cs index 5d8f3f0c0c7e..e636efd9557d 100644 --- a/src/Nethermind/Nethermind.Trie/VisitContext.cs +++ b/src/Nethermind/Nethermind.Trie/VisitContext.cs @@ -58,7 +58,6 @@ public SmallTrieVisitContext(TrieVisitContext trieVisitContext) } public byte Level { get; internal set; } - private byte _branchChildIndex = 255; private byte _flags = 0; private const byte StorageFlag = 1; diff --git a/src/Nethermind/Nethermind.TxPool/TxNonceTxPoolReserveSealer.cs b/src/Nethermind/Nethermind.TxPool/TxNonceTxPoolReserveSealer.cs deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/src/Nethermind/Nethermind.TxPool/TxPool.NonceInfo.cs b/src/Nethermind/Nethermind.TxPool/TxPool.NonceInfo.cs deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/src/Nethermind/Nethermind.Xdc/Errors/QuorumCertificateException.cs b/src/Nethermind/Nethermind.Xdc/Errors/QuorumCertificateException.cs deleted file mode 100644 index 09cf944eeb3f..000000000000 --- a/src/Nethermind/Nethermind.Xdc/Errors/QuorumCertificateException.cs +++ /dev/null @@ -1,12 +0,0 @@ -// SPDX-FileCopyrightText: 2025 Demerzel Solutions Limited -// SPDX-License-Identifier: LGPL-3.0-only - -using Nethermind.Blockchain; -using Nethermind.Xdc.Types; - -namespace Nethermind.Xdc.Errors; - -internal class QuorumCertificateException(QuorumCertificate certificate, string message) : BlockchainException(message) -{ - public QuorumCertificate Certificate { get; } = certificate; -} diff --git a/src/Nethermind/Nethermind.Xdc/IXdcSealer.cs b/src/Nethermind/Nethermind.Xdc/IXdcSealer.cs deleted file mode 100644 index cab6b4eb0b52..000000000000 --- a/src/Nethermind/Nethermind.Xdc/IXdcSealer.cs +++ /dev/null @@ -1,11 +0,0 @@ -// SPDX-FileCopyrightText: 2025 Demerzel Solutions Limited -// SPDX-License-Identifier: LGPL-3.0-only - -using Nethermind.Consensus; - -namespace Nethermind.Xdc; - -internal interface IXdcSealer : ISealer -{ - bool CanSeal(ulong round, XdcBlockHeader parentHash); -} diff --git a/src/Nethermind/Nethermind.Xdc/XdcDbNames.cs b/src/Nethermind/Nethermind.Xdc/XdcDbNames.cs deleted file mode 100644 index 720beedcc121..000000000000 --- a/src/Nethermind/Nethermind.Xdc/XdcDbNames.cs +++ /dev/null @@ -1,12 +0,0 @@ -// SPDX-FileCopyrightText: 2025 Demerzel Solutions Limited -// SPDX-License-Identifier: LGPL-3.0-only - -namespace Nethermind.Xdc; - -internal class XdcDbNames -{ - public static long HighestQcKey = 2000; - public static long HighestTimeoutCertKey = 2001; - public static long LockQcKey = 2002; - public static long HighestVotedRoundKey = 2004; -}