diff --git a/src/Nethermind/Nethermind.AccountAbstraction.Test/AccountAbstractionPeerManagerTests.cs b/src/Nethermind/Nethermind.AccountAbstraction.Test/AccountAbstractionPeerManagerTests.cs
index b274ceb01ef..4c242b20cc6 100644
--- a/src/Nethermind/Nethermind.AccountAbstraction.Test/AccountAbstractionPeerManagerTests.cs
+++ b/src/Nethermind/Nethermind.AccountAbstraction.Test/AccountAbstractionPeerManagerTests.cs
@@ -26,16 +26,16 @@ namespace Nethermind.AccountAbstraction.Test
[TestFixture]
public class AccountAbstractionPeerManagerTests
{
- private IDictionary
_userOperationPools = new Dictionary();
- private IUserOperationSimulator _simulator = Substitute.For();
- private IBlockTree _blockTree = Substitute.For();
- private ILogger _logger = Substitute.For();
- private ILogFinder _logFinder = Substitute.For();
- private IWorldState _stateProvider = Substitute.For();
- private ISpecProvider _specProvider = Substitute.For();
+ private readonly IDictionary _userOperationPools = new Dictionary();
+ private readonly IUserOperationSimulator _simulator = Substitute.For();
+ private readonly IBlockTree _blockTree = Substitute.For();
+ private readonly ILogger _logger = Substitute.For();
+ private readonly ILogFinder _logFinder = Substitute.For();
+ private readonly IWorldState _stateProvider = Substitute.For();
+ private readonly ISpecProvider _specProvider = Substitute.For();
private readonly ISigner _signer = Substitute.For();
private readonly string[] _entryPointContractAddress = { "0x8595dd9e0438640b5e1254f9df579ac12a86865f", "0x96cc609c8f5458fb8a7da4d94b678e38ebf3d04e" };
- private static Address _notAnAddress = new("0x373f2D08b1C195fF08B9AbEdE3C78575FAAC2aCf");
+ private static readonly Address _notAnAddress = new("0x373f2D08b1C195fF08B9AbEdE3C78575FAAC2aCf");
[Test]
public void should_add_peers()
diff --git a/src/Nethermind/Nethermind.AccountAbstraction.Test/AccountAbstractionRpcModuleTests.TestAccountAbstractionRpcBlockchain.cs b/src/Nethermind/Nethermind.AccountAbstraction.Test/AccountAbstractionRpcModuleTests.TestAccountAbstractionRpcBlockchain.cs
index 3e8f29490ab..78ef9773988 100644
--- a/src/Nethermind/Nethermind.AccountAbstraction.Test/AccountAbstractionRpcModuleTests.TestAccountAbstractionRpcBlockchain.cs
+++ b/src/Nethermind/Nethermind.AccountAbstraction.Test/AccountAbstractionRpcModuleTests.TestAccountAbstractionRpcBlockchain.cs
@@ -80,7 +80,7 @@ public TestAccountAbstractionRpcBlockchain(UInt256? initialBaseFeePerGas)
public IAccountAbstractionRpcModule AccountAbstractionRpcModule { get; set; } = Substitute.For();
public ManualGasLimitCalculator GasLimitCalculator = new() { GasLimit = 10_000_000 };
- private AccountAbstractionConfig _accountAbstractionConfig = new AccountAbstractionConfig()
+ private readonly AccountAbstractionConfig _accountAbstractionConfig = new AccountAbstractionConfig()
{
Enabled = true,
EntryPointContractAddresses = "0xb0894727fe4ff102e1f1c8a16f38afc7b859f215,0x96cc609c8f5458fb8a7da4d94b678e38ebf3d04e",
diff --git a/src/Nethermind/Nethermind.AccountAbstraction.Test/AccountAbstractionRpcModuleTests.cs b/src/Nethermind/Nethermind.AccountAbstraction.Test/AccountAbstractionRpcModuleTests.cs
index 9adf2ceb376..fca2101ad3f 100644
--- a/src/Nethermind/Nethermind.AccountAbstraction.Test/AccountAbstractionRpcModuleTests.cs
+++ b/src/Nethermind/Nethermind.AccountAbstraction.Test/AccountAbstractionRpcModuleTests.cs
@@ -31,9 +31,9 @@ namespace Nethermind.AccountAbstraction.Test;
[TestFixture]
public partial class AccountAbstractionRpcModuleTests
{
- private Contracts _contracts = new();
- private AbiEncoder _encoder = new();
- private static int entryPointNum = 2;
+ private readonly Contracts _contracts = new();
+ private readonly AbiEncoder _encoder = new();
+ private static readonly int entryPointNum = 2;
public class Contracts
{
@@ -43,7 +43,7 @@ public class Contracts
internal AbiDefinition TestCounterAbi;
internal AbiDefinition TokenPaymasterAbi;
- private AbiEncoder _encoder = new();
+ private readonly AbiEncoder _encoder = new();
public Contracts()
{
diff --git a/src/Nethermind/Nethermind.AccountAbstraction.Test/UserOperationPoolTests.cs b/src/Nethermind/Nethermind.AccountAbstraction.Test/UserOperationPoolTests.cs
index 094100155fd..b66eddd16fa 100644
--- a/src/Nethermind/Nethermind.AccountAbstraction.Test/UserOperationPoolTests.cs
+++ b/src/Nethermind/Nethermind.AccountAbstraction.Test/UserOperationPoolTests.cs
@@ -36,16 +36,16 @@ public class UserOperationPoolTests
#pragma warning disable NUnit1032
private IUserOperationPool _userOperationPool = Substitute.For();
#pragma warning restore NUnit1032
- private IUserOperationSimulator _simulator = Substitute.For();
- private IBlockTree _blockTree = Substitute.For();
- private IReceiptFinder _receiptFinder = Substitute.For();
- private ILogFinder _logFinder = Substitute.For();
- private IWorldState _stateProvider = Substitute.For();
- private ISpecProvider _specProvider = Substitute.For();
+ private readonly IUserOperationSimulator _simulator = Substitute.For();
+ private readonly IBlockTree _blockTree = Substitute.For();
+ private readonly IReceiptFinder _receiptFinder = Substitute.For();
+ private readonly ILogFinder _logFinder = Substitute.For();
+ private readonly IWorldState _stateProvider = Substitute.For();
+ private readonly ISpecProvider _specProvider = Substitute.For();
private readonly ISigner _signer = Substitute.For();
private readonly Hash256 _userOperationEventTopic = new("0x33fd4d1f25a5461bea901784a6571de6debc16cd0831932c22c6969cd73ba994");
private readonly string _entryPointContractAddress = "0x8595dd9e0438640b5e1254f9df579ac12a86865f";
- private static Address _notAnAddress = new("0x373f2D08b1C195fF08B9AbEdE3C78575FAAC2aCf");
+ private static readonly Address _notAnAddress = new("0x373f2D08b1C195fF08B9AbEdE3C78575FAAC2aCf");
[Test]
public void Can_add_user_operation_correctly()
diff --git a/src/Nethermind/Nethermind.AccountAbstraction.Test/UserOperationSubscribeTests.cs b/src/Nethermind/Nethermind.AccountAbstraction.Test/UserOperationSubscribeTests.cs
index 3d7e6ce7bef..409ed0d0beb 100644
--- a/src/Nethermind/Nethermind.AccountAbstraction.Test/UserOperationSubscribeTests.cs
+++ b/src/Nethermind/Nethermind.AccountAbstraction.Test/UserOperationSubscribeTests.cs
@@ -49,11 +49,11 @@ public class UserOperationSubscribeTests
private IJsonRpcDuplexClient _jsonRpcDuplexClient = null!;
private IJsonSerializer _jsonSerializer = null!;
private ISpecProvider _specProvider = null!;
- private ISyncConfig _syncConfig = new SyncConfig();
- private IDictionary _userOperationPools = new Dictionary();
+ private readonly ISyncConfig _syncConfig = new SyncConfig();
+ private readonly IDictionary _userOperationPools = new Dictionary();
//Any test pool and entry point addresses should work for testing.
- private Address _testPoolAddress = Address.Zero;
- private Address _entryPointAddress = new("0x90f3e1105e63c877bf9587de5388c23cdb702c6b");
+ private readonly Address _testPoolAddress = Address.Zero;
+ private readonly Address _entryPointAddress = new("0x90f3e1105e63c877bf9587de5388c23cdb702c6b");
[SetUp]
public void Setup()
diff --git a/src/Nethermind/Nethermind.AccountAbstraction/Bundler/MevBundler.cs b/src/Nethermind/Nethermind.AccountAbstraction/Bundler/MevBundler.cs
index b4e3fa82b42..2a295a5b1cf 100644
--- a/src/Nethermind/Nethermind.AccountAbstraction/Bundler/MevBundler.cs
+++ b/src/Nethermind/Nethermind.AccountAbstraction/Bundler/MevBundler.cs
@@ -12,10 +12,10 @@ namespace Nethermind.AccountAbstraction.Bundler
{
public class MevBundler : IBundler
{
- private IBundleTrigger _trigger;
- private ITxSource _txSource;
- private IBundlePool _bundlePool;
- private ILogger _logger;
+ private readonly IBundleTrigger _trigger;
+ private readonly ITxSource _txSource;
+ private readonly IBundlePool _bundlePool;
+ private readonly ILogger _logger;
public MevBundler(IBundleTrigger trigger, ITxSource txSource, IBundlePool bundlePool, ILogger logger)
{
diff --git a/src/Nethermind/Nethermind.AccountAbstraction/Network/AaProtocolHandler.cs b/src/Nethermind/Nethermind.AccountAbstraction/Network/AaProtocolHandler.cs
index 7ae364d1e66..ea6832c043a 100644
--- a/src/Nethermind/Nethermind.AccountAbstraction/Network/AaProtocolHandler.cs
+++ b/src/Nethermind/Nethermind.AccountAbstraction/Network/AaProtocolHandler.cs
@@ -26,7 +26,7 @@ namespace Nethermind.AccountAbstraction.Network
public class AaProtocolHandler : ProtocolHandlerBase, IZeroProtocolHandler, IUserOperationPoolPeer
{
private readonly ISession _session;
- private IDictionary _userOperationPools;
+ private readonly IDictionary _userOperationPools;
private readonly IAccountAbstractionPeerManager _peerManager;
public AaProtocolHandler(ISession session,
diff --git a/src/Nethermind/Nethermind.AccountAbstraction/Network/AccountAbstractionPeerManager.cs b/src/Nethermind/Nethermind.AccountAbstraction/Network/AccountAbstractionPeerManager.cs
index 833b53dab31..f9dbce52af7 100644
--- a/src/Nethermind/Nethermind.AccountAbstraction/Network/AccountAbstractionPeerManager.cs
+++ b/src/Nethermind/Nethermind.AccountAbstraction/Network/AccountAbstractionPeerManager.cs
@@ -14,7 +14,7 @@ namespace Nethermind.AccountAbstraction.Network
{
public class AccountAbstractionPeerManager : IAccountAbstractionPeerManager
{
- private IDictionary _userOperationPools;
+ private readonly IDictionary _userOperationPools;
private readonly IUserOperationBroadcaster _broadcaster;
private readonly ILogger _logger;
diff --git a/src/Nethermind/Nethermind.AccountAbstraction/Network/UserOperationsMessageSerializer.cs b/src/Nethermind/Nethermind.AccountAbstraction/Network/UserOperationsMessageSerializer.cs
index 510fb503852..1a3e9de316b 100644
--- a/src/Nethermind/Nethermind.AccountAbstraction/Network/UserOperationsMessageSerializer.cs
+++ b/src/Nethermind/Nethermind.AccountAbstraction/Network/UserOperationsMessageSerializer.cs
@@ -10,7 +10,7 @@ namespace Nethermind.AccountAbstraction.Network
{
public class UserOperationsMessageSerializer : IZeroInnerMessageSerializer
{
- private UserOperationDecoder _decoder = new();
+ private readonly UserOperationDecoder _decoder = new();
public void Serialize(IByteBuffer byteBuffer, UserOperationsMessage message)
{
diff --git a/src/Nethermind/Nethermind.Analytics/RewardsVerifier.cs b/src/Nethermind/Nethermind.Analytics/RewardsVerifier.cs
index c53e26f8a0d..ac876d041d0 100644
--- a/src/Nethermind/Nethermind.Analytics/RewardsVerifier.cs
+++ b/src/Nethermind/Nethermind.Analytics/RewardsVerifier.cs
@@ -15,12 +15,12 @@ namespace Nethermind.Analytics
{
public class RewardsVerifier : IBlockTreeVisitor
{
- private ILogger _logger;
+ private readonly ILogger _logger;
public bool PreventsAcceptingNewBlocks => true;
public long StartLevelInclusive => 0;
public long EndLevelExclusive { get; }
- private UInt256 _genesisAllocations = UInt256.Parse("72009990499480000000000000");
+ private readonly UInt256 _genesisAllocations = UInt256.Parse("72009990499480000000000000");
private UInt256 _uncles;
public UInt256 BlockRewards { get; private set; }
diff --git a/src/Nethermind/Nethermind.Analytics/SupplyVerifier.cs b/src/Nethermind/Nethermind.Analytics/SupplyVerifier.cs
index bfe07c8ef0a..513ace3ff10 100644
--- a/src/Nethermind/Nethermind.Analytics/SupplyVerifier.cs
+++ b/src/Nethermind/Nethermind.Analytics/SupplyVerifier.cs
@@ -14,7 +14,7 @@ namespace Nethermind.Analytics
public class SupplyVerifier : ITreeVisitor
{
private readonly ILogger _logger;
- private HashSet _ignoreThisOne = new HashSet();
+ private readonly HashSet _ignoreThisOne = new HashSet();
private int _accountsVisited;
private int _nodesVisited;
diff --git a/src/Nethermind/Nethermind.AuRa.Test/Transactions/PermissionTxComparerTests.cs b/src/Nethermind/Nethermind.AuRa.Test/Transactions/PermissionTxComparerTests.cs
index 9fee91bac4b..66804baf543 100644
--- a/src/Nethermind/Nethermind.AuRa.Test/Transactions/PermissionTxComparerTests.cs
+++ b/src/Nethermind/Nethermind.AuRa.Test/Transactions/PermissionTxComparerTests.cs
@@ -27,7 +27,7 @@ namespace Nethermind.AuRa.Test.Transactions
{
public class PermissionTxComparerTests
{
- private static Address[] WhitelistedSenders = new[] { TestItem.AddressC, TestItem.AddressD };
+ private static readonly Address[] WhitelistedSenders = new[] { TestItem.AddressC, TestItem.AddressD };
public static IEnumerable OrderingTests
{
diff --git a/src/Nethermind/Nethermind.AuRa.Test/Validators/ContractBasedValidatorTests.cs b/src/Nethermind/Nethermind.AuRa.Test/Validators/ContractBasedValidatorTests.cs
index f1b18c2789e..91dad8e1fc5 100644
--- a/src/Nethermind/Nethermind.AuRa.Test/Validators/ContractBasedValidatorTests.cs
+++ b/src/Nethermind/Nethermind.AuRa.Test/Validators/ContractBasedValidatorTests.cs
@@ -45,7 +45,7 @@ public class ContractBasedValidatorTests
private BlockHeader _parentHeader;
private IReadOnlyTransactionProcessor _transactionProcessor;
private IAuRaBlockFinalizationManager _blockFinalizationManager;
- private static Address _contractAddress = Address.FromNumber(1000);
+ private static readonly Address _contractAddress = Address.FromNumber(1000);
private (Address Sender, byte[] TransactionData) _getValidatorsData = (Address.Zero, new byte[] { 0, 1, 2 });
private (Address Sender, byte[] TransactionData) _finalizeChangeData = (Address.SystemUser, new byte[] { 3, 4, 5 });
private Address[] _initialValidators;
diff --git a/src/Nethermind/Nethermind.Blockchain.Test/BlockTreeTests.cs b/src/Nethermind/Nethermind.Blockchain.Test/BlockTreeTests.cs
index 03d3b870be0..abf91c29860 100644
--- a/src/Nethermind/Nethermind.Blockchain.Test/BlockTreeTests.cs
+++ b/src/Nethermind/Nethermind.Blockchain.Test/BlockTreeTests.cs
@@ -1215,7 +1215,7 @@ public void Loads_lowest_inserted_body_correctly(long beginIndex, long insertedB
}
- private static object[] SourceOfBSearchTestCases =
+ private static readonly object[] SourceOfBSearchTestCases =
{
new object[] {1L, 0L},
new object[] {1L, 1L},
diff --git a/src/Nethermind/Nethermind.Blockchain.Test/BlockchainProcessorTests.cs b/src/Nethermind/Nethermind.Blockchain.Test/BlockchainProcessorTests.cs
index 054b47e4296..aa50d09e96d 100644
--- a/src/Nethermind/Nethermind.Blockchain.Test/BlockchainProcessorTests.cs
+++ b/src/Nethermind/Nethermind.Blockchain.Test/BlockchainProcessorTests.cs
@@ -33,17 +33,17 @@ public class BlockchainProcessorTests
{
private class ProcessingTestContext
{
- private ILogManager _logManager = LimboLogs.Instance;
+ private readonly ILogManager _logManager = LimboLogs.Instance;
private class BlockProcessorMock : IBlockProcessor
{
- private ILogger _logger;
+ private readonly ILogger _logger;
- private HashSet _allowed = new();
+ private readonly HashSet _allowed = new();
- private HashSet _allowedToFail = new();
+ private readonly HashSet _allowedToFail = new();
- private HashSet _rootProcessed = new();
+ private readonly HashSet _rootProcessed = new();
public BlockProcessorMock(ILogManager logManager, IStateReader stateReader)
{
diff --git a/src/Nethermind/Nethermind.Blockchain.Test/Consensus/SinglePendingTxSelectorTests.cs b/src/Nethermind/Nethermind.Blockchain.Test/Consensus/SinglePendingTxSelectorTests.cs
index f8d509b7e5d..de48f000265 100644
--- a/src/Nethermind/Nethermind.Blockchain.Test/Consensus/SinglePendingTxSelectorTests.cs
+++ b/src/Nethermind/Nethermind.Blockchain.Test/Consensus/SinglePendingTxSelectorTests.cs
@@ -14,7 +14,7 @@ namespace Nethermind.Blockchain.Test.Consensus
{
public class SinglePendingTxSelectorTests
{
- private BlockHeader _anyParent = Build.A.BlockHeader.TestObject;
+ private readonly BlockHeader _anyParent = Build.A.BlockHeader.TestObject;
[Test, Timeout(Timeout.MaxTestTime)]
public void To_string_does_not_throw()
diff --git a/src/Nethermind/Nethermind.Blockchain.Test/Receipts/ReceiptsIteratorTests.cs b/src/Nethermind/Nethermind.Blockchain.Test/Receipts/ReceiptsIteratorTests.cs
index 6201e017336..da658279ddc 100644
--- a/src/Nethermind/Nethermind.Blockchain.Test/Receipts/ReceiptsIteratorTests.cs
+++ b/src/Nethermind/Nethermind.Blockchain.Test/Receipts/ReceiptsIteratorTests.cs
@@ -17,7 +17,7 @@ namespace Nethermind.Blockchain.Test.Receipts;
public class ReceiptsIteratorTests
{
- ReceiptArrayStorageDecoder _decoder = ReceiptArrayStorageDecoder.Instance;
+ readonly ReceiptArrayStorageDecoder _decoder = ReceiptArrayStorageDecoder.Instance;
[Test]
public void SmokeTestWithRecovery()
diff --git a/src/Nethermind/Nethermind.Blockchain.Test/Validators/TestTransactionValidator.cs b/src/Nethermind/Nethermind.Blockchain.Test/Validators/TestTransactionValidator.cs
index 34a939e8f0f..61f1ce96815 100644
--- a/src/Nethermind/Nethermind.Blockchain.Test/Validators/TestTransactionValidator.cs
+++ b/src/Nethermind/Nethermind.Blockchain.Test/Validators/TestTransactionValidator.cs
@@ -14,7 +14,7 @@ public class TestTxValidator : ITxValidator
public static TestTxValidator NeverValid = new(false);
private readonly Queue _validationResults = new();
- private bool? _alwaysSameResult;
+ private readonly bool? _alwaysSameResult;
public TestTxValidator(Queue validationResults)
{
diff --git a/src/Nethermind/Nethermind.Blockchain/BlockTree.cs b/src/Nethermind/Nethermind.Blockchain/BlockTree.cs
index 52207849d4a..1cd26959893 100644
--- a/src/Nethermind/Nethermind.Blockchain/BlockTree.cs
+++ b/src/Nethermind/Nethermind.Blockchain/BlockTree.cs
@@ -33,7 +33,7 @@ public partial class BlockTree : IBlockTree
{
// there is not much logic in the addressing here
public static readonly byte[] LowestInsertedBodyNumberDbEntryAddress = ((long)0).ToBigEndianByteArrayWithoutLeadingZeros();
- private static byte[] StateHeadHashDbEntryAddress = new byte[16];
+ private static readonly byte[] StateHeadHashDbEntryAddress = new byte[16];
internal static Hash256 DeletePointerAddressInDb = new(new BitArray(32 * 8, true).ToBytes());
internal static Hash256 HeadAddressInDb = Keccak.Zero;
diff --git a/src/Nethermind/Nethermind.Blockchain/BlockhashProvider.cs b/src/Nethermind/Nethermind.Blockchain/BlockhashProvider.cs
index 02a1343acaf..065211ac7a2 100644
--- a/src/Nethermind/Nethermind.Blockchain/BlockhashProvider.cs
+++ b/src/Nethermind/Nethermind.Blockchain/BlockhashProvider.cs
@@ -13,7 +13,7 @@ namespace Nethermind.Blockchain
{
public class BlockhashProvider : IBlockhashProvider
{
- private static int _maxDepth = 256;
+ private static readonly int _maxDepth = 256;
private readonly IBlockTree _blockTree;
private readonly ILogger _logger;
diff --git a/src/Nethermind/Nethermind.Blockchain/FullPruning/CopyTreeVisitor.cs b/src/Nethermind/Nethermind.Blockchain/FullPruning/CopyTreeVisitor.cs
index ef271982b0b..ee85beb5d79 100644
--- a/src/Nethermind/Nethermind.Blockchain/FullPruning/CopyTreeVisitor.cs
+++ b/src/Nethermind/Nethermind.Blockchain/FullPruning/CopyTreeVisitor.cs
@@ -26,7 +26,7 @@ public class CopyTreeVisitor : ITreeVisitor, IDisposable
private readonly Stopwatch _stopwatch;
private long _persistedNodes = 0;
private bool _finished = false;
- private WriteFlags _writeFlags;
+ private readonly WriteFlags _writeFlags;
private readonly CancellationToken _cancellationToken;
private const int Million = 1_000_000;
diff --git a/src/Nethermind/Nethermind.Blockchain/Receipts/LogEntriesIterator.cs b/src/Nethermind/Nethermind.Blockchain/Receipts/LogEntriesIterator.cs
index b240a5367ae..62a1cfff39f 100644
--- a/src/Nethermind/Nethermind.Blockchain/Receipts/LogEntriesIterator.cs
+++ b/src/Nethermind/Nethermind.Blockchain/Receipts/LogEntriesIterator.cs
@@ -12,7 +12,7 @@ public ref struct LogEntriesIterator
private readonly LogEntry[]? _logs;
private readonly int _length;
private Rlp.ValueDecoderContext _decoderContext;
- private IReceiptRefDecoder _receiptRefDecoder;
+ private readonly IReceiptRefDecoder _receiptRefDecoder;
public long Index { get; private set; }
public LogEntriesIterator(Span data, IReceiptRefDecoder receiptRefDecoder)
diff --git a/src/Nethermind/Nethermind.Blockchain/Receipts/ReceiptsIterator.cs b/src/Nethermind/Nethermind.Blockchain/Receipts/ReceiptsIterator.cs
index 03f482f2e68..141952a117d 100644
--- a/src/Nethermind/Nethermind.Blockchain/Receipts/ReceiptsIterator.cs
+++ b/src/Nethermind/Nethermind.Blockchain/Receipts/ReceiptsIterator.cs
@@ -15,14 +15,14 @@ public ref struct ReceiptsIterator
private readonly IDb _blocksDb;
private readonly int _length;
private Rlp.ValueDecoderContext _decoderContext;
- private int _startingPosition;
+ private readonly int _startingPosition;
private readonly TxReceipt[]? _receipts;
private int _receiptIndex;
private readonly Func? _recoveryContextFactory;
private IReceiptsRecovery.IRecoveryContext? _recoveryContext;
- private IReceiptRefDecoder _receiptRefDecoder;
+ private readonly IReceiptRefDecoder _receiptRefDecoder;
private bool _recoveryContextConfigured;
public ReceiptsIterator(scoped in Span receiptsData, IDb blocksDb, Func? recoveryContextFactory, IReceiptRefDecoder receiptRefDecoder)
diff --git a/src/Nethermind/Nethermind.Blockchain/Visitors/StartupBlockTreeFixer.cs b/src/Nethermind/Nethermind.Blockchain/Visitors/StartupBlockTreeFixer.cs
index 2dc9658cb99..9d00840036c 100644
--- a/src/Nethermind/Nethermind.Blockchain/Visitors/StartupBlockTreeFixer.cs
+++ b/src/Nethermind/Nethermind.Blockchain/Visitors/StartupBlockTreeFixer.cs
@@ -22,8 +22,8 @@ public class StartupBlockTreeFixer : IBlockTreeVisitor
private readonly IBlockTree _blockTree;
private readonly IStateReader _stateReader;
private readonly ILogger _logger;
- private long _startNumber;
- private long _blocksToLoad;
+ private readonly long _startNumber;
+ private readonly long _blocksToLoad;
private ChainLevelInfo _currentLevel;
private long _currentLevelNumber;
diff --git a/src/Nethermind/Nethermind.Cli.Test/ProofCliModuleTests.cs b/src/Nethermind/Nethermind.Cli.Test/ProofCliModuleTests.cs
index eecfdf18ccc..dac449f4a53 100644
--- a/src/Nethermind/Nethermind.Cli.Test/ProofCliModuleTests.cs
+++ b/src/Nethermind/Nethermind.Cli.Test/ProofCliModuleTests.cs
@@ -19,7 +19,7 @@ namespace Nethermind.Cli.Test
{
public class ProofCliModuleTests
{
- private ICliConsole _cliConsole = Substitute.For();
+ private readonly ICliConsole _cliConsole = Substitute.For();
private EthereumJsonSerializer _serializer;
private IJsonRpcClient _jsonRpcClient;
private CliEngine _engine;
diff --git a/src/Nethermind/Nethermind.Cli/Modules/CliModuleLoader.cs b/src/Nethermind/Nethermind.Cli/Modules/CliModuleLoader.cs
index 21ac2e6079e..2f8d1860054 100644
--- a/src/Nethermind/Nethermind.Cli/Modules/CliModuleLoader.cs
+++ b/src/Nethermind/Nethermind.Cli/Modules/CliModuleLoader.cs
@@ -217,7 +217,7 @@ public void LoadModule(Type type)
}
}
- private Dictionary _objects = new Dictionary();
+ private readonly Dictionary _objects = new Dictionary();
private static void AddMethod(ObjectInstance instance, string name, DelegateWrapper delegateWrapper)
{
diff --git a/src/Nethermind/Nethermind.Clique.Test/CliqueBlockProducerTests.cs b/src/Nethermind/Nethermind.Clique.Test/CliqueBlockProducerTests.cs
index b0205e5430e..2b90cea30dc 100644
--- a/src/Nethermind/Nethermind.Clique.Test/CliqueBlockProducerTests.cs
+++ b/src/Nethermind/Nethermind.Clique.Test/CliqueBlockProducerTests.cs
@@ -46,18 +46,18 @@ public class CliqueBlockProducerTests
{
private class On
{
- private ILogManager _logManager = LimboLogs.Instance;
+ private readonly ILogManager _logManager = LimboLogs.Instance;
// private ILogManager _logManager = new OneLoggerLogManager(new ConsoleAsyncLogger(LogLevel.Debug));
- private ILogger _logger;
- private static ITimestamper _timestamper = Timestamper.Default;
- private CliqueConfig _cliqueConfig;
- private EthereumEcdsa _ethereumEcdsa = new(BlockchainIds.Goerli, LimboLogs.Instance);
- private Dictionary _logManagers = new();
- private Dictionary _snapshotManager = new();
- private Dictionary _blockTrees = new();
- private Dictionary _blockEvents = new();
- private Dictionary _producers = new();
- private Dictionary _pools = new();
+ private readonly ILogger _logger;
+ private static readonly ITimestamper _timestamper = Timestamper.Default;
+ private readonly CliqueConfig _cliqueConfig;
+ private readonly EthereumEcdsa _ethereumEcdsa = new(BlockchainIds.Goerli, LimboLogs.Instance);
+ private readonly Dictionary _logManagers = new();
+ private readonly Dictionary _snapshotManager = new();
+ private readonly Dictionary _blockTrees = new();
+ private readonly Dictionary _blockEvents = new();
+ private readonly Dictionary _producers = new();
+ private readonly Dictionary _pools = new();
private On()
: this(15)
@@ -198,9 +198,9 @@ public On CreateNode(PrivateKey privateKey, bool withGenesisAlreadyProcessed = f
public static On FastGoerli => new(1);
- private Block _genesis3Validators;
+ private readonly Block _genesis3Validators;
- private Block _genesis;
+ private readonly Block _genesis;
private Block GetGenesis(int validatorsCount = 2)
{
@@ -438,7 +438,7 @@ public async Task StopNode(PrivateKey privateKeyA)
return this;
}
- private UInt256 _currentNonce = 0;
+ private readonly UInt256 _currentNonce = 0;
public On AddPendingTransaction(PrivateKey nodeKey)
{
@@ -553,7 +553,7 @@ public On Wait(int i)
}
}
- private static int _timeout = 2000; // this has to cover block period of second + wiggle of up to 500ms * (signers - 1) + 100ms delay of the block readiness check
+ private static readonly int _timeout = 2000; // this has to cover block period of second + wiggle of up to 500ms * (signers - 1) + 100ms delay of the block readiness check
[Test]
public async Task Can_produce_block_with_transactions()
diff --git a/src/Nethermind/Nethermind.Clique.Test/SnapshotManagerTests.cs b/src/Nethermind/Nethermind.Clique.Test/SnapshotManagerTests.cs
index d826d8481bc..e48acbab9c9 100644
--- a/src/Nethermind/Nethermind.Clique.Test/SnapshotManagerTests.cs
+++ b/src/Nethermind/Nethermind.Clique.Test/SnapshotManagerTests.cs
@@ -20,7 +20,7 @@ namespace Nethermind.Clique.Test
[TestFixture]
public class SnapshotManagerTests
{
- private IDb _snapshotDb = new MemDb();
+ private readonly IDb _snapshotDb = new MemDb();
private const string Block1Rlp = "f9025bf90256a06341fd3daf94b748c72ced5a5b26028f2474f5f00d824504e4fa37a75767e177a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347940000000000000000000000000000000000000000a053580584816f617295ea26c0e17641e0120cab2f0a8ffb53a866fd53aa8e8c2da056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b901000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002018347c94c808458ee45dab861d783010600846765746887676f312e372e33856c696e757800000000000000009f1efa1efa72af138c915966c639544a0255e6288e188c22ce9168c10dbe46da3d88b4aa065930119fb886210bf01a084fde5d3bc48d8aa38bca92e4fcc5215100a00000000000000000000000000000000000000000000000000000000000000000880000000000000000c0c0";
private const string Block2Rlp = "f9025bf90256a0a7684ac44d48494670b2e0d9085b7750e7341620f0a271db146ed5e70c1db854a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347940000000000000000000000000000000000000000a053580584816f617295ea26c0e17641e0120cab2f0a8ffb53a866fd53aa8e8c2da056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b901000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002028347db3d808458ee45eab861d783010600846765746887676f312e372e33856c696e75780000000000000000b5a4a624d2e19fdab62ff7f4d2f2b80dfab4c518761beb56c2319c4224dd156f698bb1a2750c7edf12d61c4022079622062039637f40fb817e2cce0f0a4dae9c01a00000000000000000000000000000000000000000000000000000000000000000880000000000000000c0c0";
diff --git a/src/Nethermind/Nethermind.Config.Test/StandardConfigTests.cs b/src/Nethermind/Nethermind.Config.Test/StandardConfigTests.cs
index 7f2e9781129..15443b22a45 100644
--- a/src/Nethermind/Nethermind.Config.Test/StandardConfigTests.cs
+++ b/src/Nethermind/Nethermind.Config.Test/StandardConfigTests.cs
@@ -14,7 +14,7 @@ namespace Nethermind.Config.Test
{
public static class StandardConfigTests
{
- private static JsonSerializerOptions _jsonOptions = new() { Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping };
+ private static readonly JsonSerializerOptions _jsonOptions = new() { Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping };
public static void ValidateDefaultValues()
{
diff --git a/src/Nethermind/Nethermind.Config/EnvConfigSource.cs b/src/Nethermind/Nethermind.Config/EnvConfigSource.cs
index 24246cc39eb..fd28c23b195 100644
--- a/src/Nethermind/Nethermind.Config/EnvConfigSource.cs
+++ b/src/Nethermind/Nethermind.Config/EnvConfigSource.cs
@@ -9,7 +9,7 @@ namespace Nethermind.Config
{
public class EnvConfigSource : IConfigSource
{
- private IEnvironment _environmentWrapper;
+ private readonly IEnvironment _environmentWrapper;
public EnvConfigSource() : this(new EnvironmentWrapper())
{
diff --git a/src/Nethermind/Nethermind.Config/JsonConfigProvider.cs b/src/Nethermind/Nethermind.Config/JsonConfigProvider.cs
index f986072bf01..46034a6f097 100644
--- a/src/Nethermind/Nethermind.Config/JsonConfigProvider.cs
+++ b/src/Nethermind/Nethermind.Config/JsonConfigProvider.cs
@@ -7,7 +7,7 @@ namespace Nethermind.Config
{
public class JsonConfigProvider : IConfigProvider
{
- private ConfigProvider _provider = new();
+ private readonly ConfigProvider _provider = new();
public JsonConfigProvider(string jsonConfigFile)
{
diff --git a/src/Nethermind/Nethermind.Consensus.AuRa/Contracts/RegisterContract.cs b/src/Nethermind/Nethermind.Consensus.AuRa/Contracts/RegisterContract.cs
index a81bbc521c9..6d7d3e67960 100644
--- a/src/Nethermind/Nethermind.Consensus.AuRa/Contracts/RegisterContract.cs
+++ b/src/Nethermind/Nethermind.Consensus.AuRa/Contracts/RegisterContract.cs
@@ -21,7 +21,7 @@ public interface IRegisterContract
///
public class RegisterContract : Contract, IRegisterContract
{
- private static Address MissingAddress = Address.Zero;
+ private static readonly Address MissingAddress = Address.Zero;
private static readonly object[] MissingGetAddressResult = { MissingAddress };
///
diff --git a/src/Nethermind/Nethermind.Consensus.Clique/CliqueSealValidator.cs b/src/Nethermind/Nethermind.Consensus.Clique/CliqueSealValidator.cs
index e400297aa41..3089eac04c4 100644
--- a/src/Nethermind/Nethermind.Consensus.Clique/CliqueSealValidator.cs
+++ b/src/Nethermind/Nethermind.Consensus.Clique/CliqueSealValidator.cs
@@ -12,7 +12,7 @@ internal class CliqueSealValidator : ISealValidator
{
private readonly ICliqueConfig _cliqueConfig;
private readonly ISnapshotManager _snapshotManager;
- private ILogger _logger;
+ private readonly ILogger _logger;
public CliqueSealValidator(ICliqueConfig cliqueConfig, ISnapshotManager snapshotManager, ILogManager logManager)
{
diff --git a/src/Nethermind/Nethermind.Consensus.Clique/SnapshotManager.cs b/src/Nethermind/Nethermind.Consensus.Clique/SnapshotManager.cs
index 5474bc8e533..0d801cd18ae 100644
--- a/src/Nethermind/Nethermind.Consensus.Clique/SnapshotManager.cs
+++ b/src/Nethermind/Nethermind.Consensus.Clique/SnapshotManager.cs
@@ -21,15 +21,15 @@ namespace Nethermind.Consensus.Clique
{
public class SnapshotManager : ISnapshotManager
{
- private static byte[] _snapshotBytes = Encoding.UTF8.GetBytes("snapshot-");
+ private static readonly byte[] _snapshotBytes = Encoding.UTF8.GetBytes("snapshot-");
private readonly IBlockTree _blockTree;
private readonly ICliqueConfig _cliqueConfig;
private readonly ILogger _logger;
private readonly LruCache _signatures;
private readonly IEthereumEcdsa _ecdsa;
- private IDb _blocksDb;
+ private readonly IDb _blocksDb;
private ulong _lastSignersCount = 0;
- private LruCache _snapshotCache = new(Clique.InMemorySnapshots, "clique snapshots");
+ private readonly LruCache _snapshotCache = new(Clique.InMemorySnapshots, "clique snapshots");
public SnapshotManager(ICliqueConfig cliqueConfig, IDb blocksDb, IBlockTree blockTree, IEthereumEcdsa ecdsa, ILogManager logManager)
{
@@ -84,7 +84,7 @@ public static Hash256 CalculateCliqueHeaderHash(BlockHeader blockHeader)
return sigHash;
}
- private object _snapshotCreationLock = new();
+ private readonly object _snapshotCreationLock = new();
public ulong GetLastSignersCount() => _lastSignersCount;
@@ -226,7 +226,7 @@ private static Hash256 GetSnapshotKey(Hash256 blockHash)
return new Hash256(keyBytes);
}
- private SnapshotDecoder _decoder = new();
+ private readonly SnapshotDecoder _decoder = new();
[Todo(Improve.Refactor, "I guess it was only added here because of the use of blocksdb")]
private Snapshot? LoadSnapshot(Hash256 hash)
diff --git a/src/Nethermind/Nethermind.Consensus.Ethash/Ethash.cs b/src/Nethermind/Nethermind.Consensus.Ethash/Ethash.cs
index 8ba606c652d..f3f5813e2eb 100644
--- a/src/Nethermind/Nethermind.Consensus.Ethash/Ethash.cs
+++ b/src/Nethermind/Nethermind.Consensus.Ethash/Ethash.cs
@@ -24,7 +24,7 @@ namespace Nethermind.Consensus.Ethash
{
internal class Ethash : IEthash
{
- private HintBasedCache _hintBasedCache;
+ private readonly HintBasedCache _hintBasedCache;
private readonly ILogger _logger;
@@ -208,7 +208,7 @@ public void HintRange(Guid guid, long start, long end)
_hintBasedCache.Hint(guid, start, end);
}
- private Guid _hintBasedCacheUser = Guid.Empty;
+ private readonly Guid _hintBasedCacheUser = Guid.Empty;
public bool Validate(BlockHeader header)
{
@@ -251,7 +251,7 @@ private IEthashDataSet BuildCache(uint epoch)
return dataSet;
}
- private static HeaderDecoder _headerDecoder = new();
+ private static readonly HeaderDecoder _headerDecoder = new();
private static Hash256 GetTruncatedHash(BlockHeader header)
{
diff --git a/src/Nethermind/Nethermind.Consensus.Ethash/EthashCache.cs b/src/Nethermind/Nethermind.Consensus.Ethash/EthashCache.cs
index a3de622c77c..33d06038295 100644
--- a/src/Nethermind/Nethermind.Consensus.Ethash/EthashCache.cs
+++ b/src/Nethermind/Nethermind.Consensus.Ethash/EthashCache.cs
@@ -57,7 +57,7 @@ public static Bucket Xor(Bucket a, Bucket b)
}
}
- private ArrayPool _arrayPool = ArrayPool.Create(1024 * 1024 * 2, 50);
+ private readonly ArrayPool _arrayPool = ArrayPool.Create(1024 * 1024 * 2, 50);
private Bucket[] Data { get; set; }
diff --git a/src/Nethermind/Nethermind.Consensus.Ethash/HintBasedCache.cs b/src/Nethermind/Nethermind.Consensus.Ethash/HintBasedCache.cs
index bf9f0a42f21..1794b8bcc14 100644
--- a/src/Nethermind/Nethermind.Consensus.Ethash/HintBasedCache.cs
+++ b/src/Nethermind/Nethermind.Consensus.Ethash/HintBasedCache.cs
@@ -14,10 +14,10 @@ namespace Nethermind.Consensus.Ethash
{
internal class HintBasedCache
{
- private Dictionary> _epochsPerGuid = new();
- private Dictionary _epochRefs = new();
- private Dictionary> _cachedSets = new();
- private Dictionary _recent = new();
+ private readonly Dictionary> _epochsPerGuid = new();
+ private readonly Dictionary _epochRefs = new();
+ private readonly Dictionary> _cachedSets = new();
+ private readonly Dictionary _recent = new();
private struct DataSetWithTime
{
@@ -36,7 +36,7 @@ public DataSetWithTime(DateTimeOffset timestamp, Task dataSet)
public int CachedEpochsCount => _cachedEpochsCount;
private readonly Func _createDataSet;
- private ILogger _logger;
+ private readonly ILogger _logger;
public HintBasedCache(Func createDataSet, ILogManager logManager)
{
diff --git a/src/Nethermind/Nethermind.Consensus/Processing/OneTimeProcessor.cs b/src/Nethermind/Nethermind.Consensus/Processing/OneTimeProcessor.cs
index b2d0b8c14a8..7742620dde6 100644
--- a/src/Nethermind/Nethermind.Consensus/Processing/OneTimeProcessor.cs
+++ b/src/Nethermind/Nethermind.Consensus/Processing/OneTimeProcessor.cs
@@ -17,7 +17,7 @@ public class OneTimeChainProcessor : IBlockchainProcessor
private readonly IBlockchainProcessor _processor;
private readonly IWorldState _worldState;
- private object _lock = new();
+ private readonly object _lock = new();
public OneTimeChainProcessor(IWorldState worldState, IBlockchainProcessor processor)
{
diff --git a/src/Nethermind/Nethermind.Consensus/Processing/ProcessingStats.cs b/src/Nethermind/Nethermind.Consensus/Processing/ProcessingStats.cs
index 5d36900eb83..5f29f9af04e 100644
--- a/src/Nethermind/Nethermind.Consensus/Processing/ProcessingStats.cs
+++ b/src/Nethermind/Nethermind.Consensus/Processing/ProcessingStats.cs
@@ -35,7 +35,7 @@ internal class ProcessingStats
private long _lastSelfDestructs;
private long _maxMemory;
private long _totalBlocks;
- private bool _isDebugMode = false;
+ private readonly bool _isDebugMode = false;
private decimal _processingMicroseconds;
private long _lastTotalCreates;
private long _lastReportMs;
diff --git a/src/Nethermind/Nethermind.Core.Test/Blockchain/TestBlockchain.cs b/src/Nethermind/Nethermind.Core.Test/Blockchain/TestBlockchain.cs
index 1163effe3da..e23c0705e0d 100644
--- a/src/Nethermind/Nethermind.Core.Test/Blockchain/TestBlockchain.cs
+++ b/src/Nethermind/Nethermind.Core.Test/Blockchain/TestBlockchain.cs
@@ -93,7 +93,7 @@ protected TestBlockchain()
public static Address AccountC = TestItem.AddressC;
public SemaphoreSlim _resetEvent = null!;
private ManualResetEvent _suggestedBlockResetEvent = null!;
- private AutoResetEvent _oneAtATime = new(true);
+ private readonly AutoResetEvent _oneAtATime = new(true);
private IBlockFinder _blockFinder = null!;
public static readonly UInt256 InitialValue = 1000.Ether();
diff --git a/src/Nethermind/Nethermind.Core.Test/Builders/PrivateKeyBuilder.cs b/src/Nethermind/Nethermind.Core.Test/Builders/PrivateKeyBuilder.cs
index d9ee47e3ff9..2d2dfa5f227 100644
--- a/src/Nethermind/Nethermind.Core.Test/Builders/PrivateKeyBuilder.cs
+++ b/src/Nethermind/Nethermind.Core.Test/Builders/PrivateKeyBuilder.cs
@@ -7,7 +7,7 @@ namespace Nethermind.Core.Test.Builders
{
public class PrivateKeyBuilder : BuilderBase
{
- private PrivateKeyGenerator _generator = new();
+ private readonly PrivateKeyGenerator _generator = new();
public PrivateKeyBuilder()
{
diff --git a/src/Nethermind/Nethermind.Core.Test/Encoding/BlockDecoderTests.cs b/src/Nethermind/Nethermind.Core.Test/Encoding/BlockDecoderTests.cs
index 1de97dd9f91..bf378f9d01c 100644
--- a/src/Nethermind/Nethermind.Core.Test/Encoding/BlockDecoderTests.cs
+++ b/src/Nethermind/Nethermind.Core.Test/Encoding/BlockDecoderTests.cs
@@ -17,7 +17,7 @@ namespace Nethermind.Core.Test.Encoding;
[TestFixture]
public class BlockDecoderTests
{
- private Block[] _scenarios;
+ private readonly Block[] _scenarios;
public BlockDecoderTests()
{
@@ -99,7 +99,7 @@ public void Can_do_roundtrip_null([Values(true, false)] bool valueDecoder)
Assert.IsNull(decoded);
}
- private string regression5644 = "f902cff9025aa05297f2a4a699ba7d038a229a8eb7ab29d0073b37376ff0311f2bd9c608411830a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347940000000000000000000000000000000000000000a0fe77dd4ad7c2a3fa4c11868a00e4d728adcdfef8d2e3c13b256b06cbdbb02ec9a00d0abe08c162e4e0891e7a45a8107a98ae44ed47195c2d041fe574de40272df0a0056b23fbba480696b65fe5a59b8f2148a1299103c4f57df839233af2cf4ca2d2b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000182160c837a1200825208845c54648eb8613078366336393733363936653733366236390000000000000000000000000000f3ec96e458292ccea72a1e53e95f94c28051ab51880b7e03d933f7fa78c9692f635ae55ac3899c9c6999d33c758b5248a05894a3471282333bcd76067c5d391300a00000000000000000000000000000000000000000000000000000000000000000880000000000000000f86ff86d80843b9aca008252089422ea9f6b28db76a7162054c05ed812deb2f519cd8a152d02c7e14af6800000802da0f67424c67d9f91a87b5437db1bdaa05e29bd020ab474b2f67f7be163c9f650dda02f90ab34b44165d776ae04449b15210076d6a72abe2bda2903d4b87f0d1ce541c0";
+ private readonly string regression5644 = "f902cff9025aa05297f2a4a699ba7d038a229a8eb7ab29d0073b37376ff0311f2bd9c608411830a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347940000000000000000000000000000000000000000a0fe77dd4ad7c2a3fa4c11868a00e4d728adcdfef8d2e3c13b256b06cbdbb02ec9a00d0abe08c162e4e0891e7a45a8107a98ae44ed47195c2d041fe574de40272df0a0056b23fbba480696b65fe5a59b8f2148a1299103c4f57df839233af2cf4ca2d2b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000182160c837a1200825208845c54648eb8613078366336393733363936653733366236390000000000000000000000000000f3ec96e458292ccea72a1e53e95f94c28051ab51880b7e03d933f7fa78c9692f635ae55ac3899c9c6999d33c758b5248a05894a3471282333bcd76067c5d391300a00000000000000000000000000000000000000000000000000000000000000000880000000000000000f86ff86d80843b9aca008252089422ea9f6b28db76a7162054c05ed812deb2f519cd8a152d02c7e14af6800000802da0f67424c67d9f91a87b5437db1bdaa05e29bd020ab474b2f67f7be163c9f650dda02f90ab34b44165d776ae04449b15210076d6a72abe2bda2903d4b87f0d1ce541c0";
[Test]
public void Can_do_roundtrip_regression([Values(true, false)] bool valueDecoder)
diff --git a/src/Nethermind/Nethermind.Core.Test/Json/BigIntegerConverterTests.cs b/src/Nethermind/Nethermind.Core.Test/Json/BigIntegerConverterTests.cs
index 02f86072dd6..0ac2270dfda 100644
--- a/src/Nethermind/Nethermind.Core.Test/Json/BigIntegerConverterTests.cs
+++ b/src/Nethermind/Nethermind.Core.Test/Json/BigIntegerConverterTests.cs
@@ -14,8 +14,8 @@ namespace Nethermind.Core.Test.Json
[TestFixture]
public class BigIntegerConverterTests : ConverterTestBase
{
- static BigIntegerConverter converter = new BigIntegerConverter();
- static JsonSerializerOptions options = new JsonSerializerOptions { Converters = { converter } };
+ static readonly BigIntegerConverter converter = new BigIntegerConverter();
+ static readonly JsonSerializerOptions options = new JsonSerializerOptions { Converters = { converter } };
public void Test_roundtrip()
{
diff --git a/src/Nethermind/Nethermind.Core.Test/Json/Hash256ConverterTests.cs b/src/Nethermind/Nethermind.Core.Test/Json/Hash256ConverterTests.cs
index 336070222c6..66ae46b8e72 100644
--- a/src/Nethermind/Nethermind.Core.Test/Json/Hash256ConverterTests.cs
+++ b/src/Nethermind/Nethermind.Core.Test/Json/Hash256ConverterTests.cs
@@ -14,8 +14,8 @@ namespace Nethermind.Core.Test.Json
[TestFixture]
public class Hash256ConverterTests
{
- static Hash256Converter converter = new();
- static JsonSerializerOptions options = new JsonSerializerOptions { Converters = { converter } };
+ static readonly Hash256Converter converter = new();
+ static readonly JsonSerializerOptions options = new JsonSerializerOptions { Converters = { converter } };
[Test]
public void Can_read_null()
diff --git a/src/Nethermind/Nethermind.Core.Test/Json/LongConverterTests.cs b/src/Nethermind/Nethermind.Core.Test/Json/LongConverterTests.cs
index b7ecf8cc1b7..49eaa264371 100644
--- a/src/Nethermind/Nethermind.Core.Test/Json/LongConverterTests.cs
+++ b/src/Nethermind/Nethermind.Core.Test/Json/LongConverterTests.cs
@@ -14,8 +14,8 @@ namespace Nethermind.Core.Test.Json
[TestFixture]
public class LongConverterTests : ConverterTestBase
{
- static LongConverter converter = new();
- static JsonSerializerOptions options = new JsonSerializerOptions { Converters = { converter } };
+ static readonly LongConverter converter = new();
+ static readonly JsonSerializerOptions options = new JsonSerializerOptions { Converters = { converter } };
public void Test_roundtrip()
{
diff --git a/src/Nethermind/Nethermind.Core.Test/Json/NullableBigIntegerConverterTests.cs b/src/Nethermind/Nethermind.Core.Test/Json/NullableBigIntegerConverterTests.cs
index dd29a2f7c38..eb0c8bb5bf5 100644
--- a/src/Nethermind/Nethermind.Core.Test/Json/NullableBigIntegerConverterTests.cs
+++ b/src/Nethermind/Nethermind.Core.Test/Json/NullableBigIntegerConverterTests.cs
@@ -14,8 +14,8 @@ namespace Nethermind.Core.Test.Json
[TestFixture]
public class NullableBigIntegerConverterTests : ConverterTestBase
{
- static NullableBigIntegerConverter converter = new NullableBigIntegerConverter();
- static JsonSerializerOptions options = new JsonSerializerOptions { Converters = { converter } };
+ static readonly NullableBigIntegerConverter converter = new NullableBigIntegerConverter();
+ static readonly JsonSerializerOptions options = new JsonSerializerOptions { Converters = { converter } };
public void Test_roundtrip()
{
TestConverter(null, (integer, bigInteger) => integer.Equals(bigInteger), converter);
diff --git a/src/Nethermind/Nethermind.Core.Test/Json/NullableLongConverterTests.cs b/src/Nethermind/Nethermind.Core.Test/Json/NullableLongConverterTests.cs
index 70917d3f953..1bcc127f0c7 100644
--- a/src/Nethermind/Nethermind.Core.Test/Json/NullableLongConverterTests.cs
+++ b/src/Nethermind/Nethermind.Core.Test/Json/NullableLongConverterTests.cs
@@ -14,8 +14,8 @@ namespace Nethermind.Core.Test.Json
[TestFixture]
public class NullableLongConverterTests : ConverterTestBase
{
- static NullableLongConverter converter = new();
- static JsonSerializerOptions options = new JsonSerializerOptions { Converters = { converter } };
+ static readonly NullableLongConverter converter = new();
+ static readonly JsonSerializerOptions options = new JsonSerializerOptions { Converters = { converter } };
public void Test_roundtrip()
{
diff --git a/src/Nethermind/Nethermind.Core.Test/Json/NullableUInt256ConverterTests.cs b/src/Nethermind/Nethermind.Core.Test/Json/NullableUInt256ConverterTests.cs
index b15ef87ae15..ebdaaf2a549 100644
--- a/src/Nethermind/Nethermind.Core.Test/Json/NullableUInt256ConverterTests.cs
+++ b/src/Nethermind/Nethermind.Core.Test/Json/NullableUInt256ConverterTests.cs
@@ -13,8 +13,8 @@ namespace Nethermind.Core.Test.Json
[TestFixture]
public class NullableUInt256ConverterTests : ConverterTestBase
{
- static NullableUInt256Converter converter = new();
- static JsonSerializerOptions options = new JsonSerializerOptions { Converters = { converter } };
+ static readonly NullableUInt256Converter converter = new();
+ static readonly JsonSerializerOptions options = new JsonSerializerOptions { Converters = { converter } };
[TestCase(NumberConversion.Hex)]
[TestCase(NumberConversion.Decimal)]
diff --git a/src/Nethermind/Nethermind.Core.Test/Json/NullableUlongConverterTests.cs b/src/Nethermind/Nethermind.Core.Test/Json/NullableUlongConverterTests.cs
index 373cd9ef080..3199608c669 100644
--- a/src/Nethermind/Nethermind.Core.Test/Json/NullableUlongConverterTests.cs
+++ b/src/Nethermind/Nethermind.Core.Test/Json/NullableUlongConverterTests.cs
@@ -13,8 +13,8 @@ namespace Nethermind.Core.Test.Json
[TestFixture]
public class NullableULongConverterTests : ConverterTestBase
{
- static NullableULongConverter converter = new();
- static JsonSerializerOptions options = new JsonSerializerOptions { Converters = { converter } };
+ static readonly NullableULongConverter converter = new();
+ static readonly JsonSerializerOptions options = new JsonSerializerOptions { Converters = { converter } };
[TestCase(NumberConversion.Hex)]
[TestCase(NumberConversion.Decimal)]
diff --git a/src/Nethermind/Nethermind.Core.Test/Json/UInt256ConverterTests.cs b/src/Nethermind/Nethermind.Core.Test/Json/UInt256ConverterTests.cs
index c5686aeec28..c0f771b8091 100644
--- a/src/Nethermind/Nethermind.Core.Test/Json/UInt256ConverterTests.cs
+++ b/src/Nethermind/Nethermind.Core.Test/Json/UInt256ConverterTests.cs
@@ -15,8 +15,8 @@ namespace Nethermind.Core.Test.Json
[TestFixture]
public class UInt256ConverterTests : ConverterTestBase
{
- static UInt256Converter converter = new();
- static JsonSerializerOptions options = new JsonSerializerOptions { Converters = { converter } };
+ static readonly UInt256Converter converter = new();
+ static readonly JsonSerializerOptions options = new JsonSerializerOptions { Converters = { converter } };
[TestCase(NumberConversion.Hex)]
[TestCase(NumberConversion.Decimal)]
diff --git a/src/Nethermind/Nethermind.Core.Test/TestMemDb.cs b/src/Nethermind/Nethermind.Core.Test/TestMemDb.cs
index 89a1ce1bc6a..bd7795430d6 100644
--- a/src/Nethermind/Nethermind.Core.Test/TestMemDb.cs
+++ b/src/Nethermind/Nethermind.Core.Test/TestMemDb.cs
@@ -16,10 +16,10 @@ namespace Nethermind.Core.Test;
///
public class TestMemDb : MemDb, ITunableDb
{
- private List<(byte[], ReadFlags)> _readKeys = new();
- private List<((byte[], byte[]?), WriteFlags)> _writes = new();
- private List _removedKeys = new();
- private List _tuneTypes = new();
+ private readonly List<(byte[], ReadFlags)> _readKeys = new();
+ private readonly List<((byte[], byte[]?), WriteFlags)> _writes = new();
+ private readonly List _removedKeys = new();
+ private readonly List _tuneTypes = new();
public Func? ReadFunc { get; set; }
public Func? WriteFunc { get; set; }
diff --git a/src/Nethermind/Nethermind.Core/Buffers/CappedArray.cs b/src/Nethermind/Nethermind.Core/Buffers/CappedArray.cs
index ae665b44c9a..c6e4ba1ab39 100644
--- a/src/Nethermind/Nethermind.Core/Buffers/CappedArray.cs
+++ b/src/Nethermind/Nethermind.Core/Buffers/CappedArray.cs
@@ -15,7 +15,7 @@ namespace Nethermind.Core.Buffers;
///
public struct CappedArray
{
- private T[]? _array = null;
+ private readonly T[]? _array = null;
private int _length = 0;
public CappedArray(T[]? array, int length)
diff --git a/src/Nethermind/Nethermind.Core/Collections/ClampedReadOnlyList.cs b/src/Nethermind/Nethermind.Core/Collections/ClampedReadOnlyList.cs
index d81dbbf1a2c..4dfe379329b 100644
--- a/src/Nethermind/Nethermind.Core/Collections/ClampedReadOnlyList.cs
+++ b/src/Nethermind/Nethermind.Core/Collections/ClampedReadOnlyList.cs
@@ -10,7 +10,7 @@ namespace Nethermind.Core.Test.Collections;
public class ClampedReadOnlyList : IReadOnlyList
{
- private IReadOnlyList _baseImplementation;
+ private readonly IReadOnlyList _baseImplementation;
public ClampedReadOnlyList(IReadOnlyList toClampList, int maxSize)
{
diff --git a/src/Nethermind/Nethermind.Core/Collections/CompactStack.cs b/src/Nethermind/Nethermind.Core/Collections/CompactStack.cs
index bcade1d9fde..84a9778c78e 100644
--- a/src/Nethermind/Nethermind.Core/Collections/CompactStack.cs
+++ b/src/Nethermind/Nethermind.Core/Collections/CompactStack.cs
@@ -48,7 +48,7 @@ public bool Return(Node obj)
}
}
- private ObjectPool _nodePool;
+ private readonly ObjectPool _nodePool;
private Node? _head = null;
public CompactStack(ObjectPool? nodePool = null)
diff --git a/src/Nethermind/Nethermind.Core/Crypto/KeccakHash.cs b/src/Nethermind/Nethermind.Core/Crypto/KeccakHash.cs
index 3ca0d2f0dfe..f2609cc4508 100644
--- a/src/Nethermind/Nethermind.Core/Crypto/KeccakHash.cs
+++ b/src/Nethermind/Nethermind.Core/Crypto/KeccakHash.cs
@@ -643,7 +643,7 @@ public void ResetTo(KeccakHash original)
private static class Pool
{
private const int MaxPooled = 24;
- private static ConcurrentQueue s_remainderCache = new();
+ private static readonly ConcurrentQueue s_remainderCache = new();
public static byte[] RentRemainder() => s_remainderCache.TryDequeue(out byte[]? remainder) ? remainder : new byte[STATE_SIZE];
public static void ReturnRemainder(ref byte[] remainder)
{
@@ -658,7 +658,7 @@ public static void ReturnRemainder(ref byte[] remainder)
remainder = Array.Empty();
}
- private static ConcurrentQueue s_stateCache = new();
+ private static readonly ConcurrentQueue s_stateCache = new();
public static ulong[] RentState() => s_stateCache.TryDequeue(out ulong[]? state) ? state : new ulong[STATE_SIZE / sizeof(ulong)];
public static void ReturnState(ref ulong[] state)
{
diff --git a/src/Nethermind/Nethermind.Core/Crypto/PublicKey.cs b/src/Nethermind/Nethermind.Core/Crypto/PublicKey.cs
index ba7f359825f..ad29ff3b5b5 100644
--- a/src/Nethermind/Nethermind.Core/Crypto/PublicKey.cs
+++ b/src/Nethermind/Nethermind.Core/Crypto/PublicKey.cs
@@ -20,7 +20,7 @@ public class PublicKey : IEquatable
private Address? _address;
private byte[]? _prefixedBytes;
- private int _hashCode;
+ private readonly int _hashCode;
public PublicKey(string? hexString)
: this(Core.Extensions.Bytes.FromHexString(hexString ?? throw new ArgumentNullException(nameof(hexString))))
diff --git a/src/Nethermind/Nethermind.Core/MemorySizes.cs b/src/Nethermind/Nethermind.Core/MemorySizes.cs
index 5f10e1dcaae..20f8494aa4c 100644
--- a/src/Nethermind/Nethermind.Core/MemorySizes.cs
+++ b/src/Nethermind/Nethermind.Core/MemorySizes.cs
@@ -27,7 +27,7 @@ public static long Align(long unalignedSize)
// public const int LargeObjectOverhead = 32; // just guessing, 20 on 32bit
public const int ArrayOverhead = 24;
- private static BitArray _isPrime = ESieve(1024 * 1024); // 1MB in memory
+ private static readonly BitArray _isPrime = ESieve(1024 * 1024); // 1MB in memory
public static int FindNextPrime(int number)
{
diff --git a/src/Nethermind/Nethermind.Core/ThisNodeInfo.cs b/src/Nethermind/Nethermind.Core/ThisNodeInfo.cs
index 2e8ba4f0b5e..d103715e51c 100644
--- a/src/Nethermind/Nethermind.Core/ThisNodeInfo.cs
+++ b/src/Nethermind/Nethermind.Core/ThisNodeInfo.cs
@@ -9,7 +9,7 @@ namespace Nethermind.Core
{
public static class ThisNodeInfo
{
- private static ConcurrentDictionary _nodeInfoItems = new();
+ private static readonly ConcurrentDictionary _nodeInfoItems = new();
public static void AddInfo(string infoDescription, string value)
{
diff --git a/src/Nethermind/Nethermind.Crypto/EciesCipher.cs b/src/Nethermind/Nethermind.Crypto/EciesCipher.cs
index cf756db5ef3..9dadad24833 100644
--- a/src/Nethermind/Nethermind.Crypto/EciesCipher.cs
+++ b/src/Nethermind/Nethermind.Crypto/EciesCipher.cs
@@ -20,7 +20,7 @@ public class EciesCipher : IEciesCipher
{
private const int KeySize = 128;
private readonly ICryptoRandom _cryptoRandom;
- private PrivateKeyGenerator _keyGenerator;
+ private readonly PrivateKeyGenerator _keyGenerator;
public EciesCipher(ICryptoRandom cryptoRandom)
{
@@ -68,7 +68,7 @@ public byte[] Encrypt(PublicKey recipientPublicKey, byte[] plainText, byte[] mac
return outputArray;
}
- private OptimizedKdf _optimizedKdf = new();
+ private readonly OptimizedKdf _optimizedKdf = new();
private byte[] Decrypt(PublicKey ephemeralPublicKey, PrivateKey privateKey, byte[] iv, byte[] ciphertextBody, byte[] macData)
{
@@ -76,7 +76,7 @@ private byte[] Decrypt(PublicKey ephemeralPublicKey, PrivateKey privateKey, byte
return iesEngine.ProcessBlock(ciphertextBody, 0, ciphertextBody.Length, macData);
}
- private static IesParameters _iesParameters = new IesWithCipherParameters(Array.Empty(), Array.Empty(), KeySize, KeySize);
+ private static readonly IesParameters _iesParameters = new IesWithCipherParameters(Array.Empty(), Array.Empty(), KeySize, KeySize);
private IIesEngine MakeIesEngine(bool isEncrypt, PublicKey publicKey, PrivateKey privateKey, byte[] iv)
{
diff --git a/src/Nethermind/Nethermind.Crypto/EthereumIesEngine.cs b/src/Nethermind/Nethermind.Crypto/EthereumIesEngine.cs
index 1bfb9c08cac..5520deab0fc 100644
--- a/src/Nethermind/Nethermind.Crypto/EthereumIesEngine.cs
+++ b/src/Nethermind/Nethermind.Crypto/EthereumIesEngine.cs
@@ -21,9 +21,9 @@ public class EthereumIesEngine : IIesEngine
{
private bool _forEncryption;
private byte[] _kdfKey;
- private IDigest _hash;
- private IMac _mac;
- private BufferedBlockCipher _cipher;
+ private readonly IDigest _hash;
+ private readonly IMac _mac;
+ private readonly BufferedBlockCipher _cipher;
private IesParameters _iesParameters;
private byte[] _iv;
diff --git a/src/Nethermind/Nethermind.Db.Rocks/ColumnDb.cs b/src/Nethermind/Nethermind.Db.Rocks/ColumnDb.cs
index 2d144068455..63c44fce165 100644
--- a/src/Nethermind/Nethermind.Db.Rocks/ColumnDb.cs
+++ b/src/Nethermind/Nethermind.Db.Rocks/ColumnDb.cs
@@ -17,7 +17,7 @@ public class ColumnDb : IDb
internal readonly DbOnTheRocks _mainDb;
internal readonly ColumnFamilyHandle _columnFamily;
- private DbOnTheRocks.ManagedIterators _readaheadIterators = new();
+ private readonly DbOnTheRocks.ManagedIterators _readaheadIterators = new();
public ColumnDb(RocksDb rocksDb, DbOnTheRocks mainDb, string name)
{
diff --git a/src/Nethermind/Nethermind.Db.Rocks/ColumnsDb.cs b/src/Nethermind/Nethermind.Db.Rocks/ColumnsDb.cs
index 3a9dd620db8..f73091856b6 100644
--- a/src/Nethermind/Nethermind.Db.Rocks/ColumnsDb.cs
+++ b/src/Nethermind/Nethermind.Db.Rocks/ColumnsDb.cs
@@ -72,7 +72,7 @@ protected override void ApplyOptions(IDictionary options)
private class RocksColumnsWriteBatch : IColumnsWriteBatch
{
internal RocksDbWriteBatch _writeBatch;
- private ColumnsDb _columnsDb;
+ private readonly ColumnsDb _columnsDb;
public RocksColumnsWriteBatch(ColumnsDb columnsDb)
{
diff --git a/src/Nethermind/Nethermind.Db.Rocks/DbOnTheRocks.cs b/src/Nethermind/Nethermind.Db.Rocks/DbOnTheRocks.cs
index 1dcc79ff0b6..df0e1e4603a 100644
--- a/src/Nethermind/Nethermind.Db.Rocks/DbOnTheRocks.cs
+++ b/src/Nethermind/Nethermind.Db.Rocks/DbOnTheRocks.cs
@@ -66,9 +66,9 @@ public class DbOnTheRocks : IDb, ITunableDb
private string CorruptMarkerPath => Path.Join(_fullPath, "corrupt.marker");
- private List _metricsUpdaters = new();
+ private readonly List _metricsUpdaters = new();
- private ManagedIterators _readaheadIterators = new();
+ private readonly ManagedIterators _readaheadIterators = new();
internal long _allocatedSpan = 0;
diff --git a/src/Nethermind/Nethermind.Db.Rocks/RocksDbFactory.cs b/src/Nethermind/Nethermind.Db.Rocks/RocksDbFactory.cs
index a5639382c77..e346e0ea418 100644
--- a/src/Nethermind/Nethermind.Db.Rocks/RocksDbFactory.cs
+++ b/src/Nethermind/Nethermind.Db.Rocks/RocksDbFactory.cs
@@ -15,7 +15,7 @@ public class RocksDbFactory : IRocksDbFactory
private readonly string _basePath;
- private IntPtr _sharedCache;
+ private readonly IntPtr _sharedCache;
public RocksDbFactory(IDbConfig dbConfig, ILogManager logManager, string basePath)
{
diff --git a/src/Nethermind/Nethermind.Db.Test/DbOnTheRocksTests.cs b/src/Nethermind/Nethermind.Db.Test/DbOnTheRocksTests.cs
index a72b594674b..5e70338d5e1 100644
--- a/src/Nethermind/Nethermind.Db.Test/DbOnTheRocksTests.cs
+++ b/src/Nethermind/Nethermind.Db.Test/DbOnTheRocksTests.cs
@@ -204,7 +204,7 @@ public class DbOnTheRocksDbTests
private IDb _db = null!;
IDisposable? _dbDisposable = null!;
- private bool _useColumnDb = false;
+ private readonly bool _useColumnDb = false;
public DbOnTheRocksDbTests(bool useColumnDb)
{
diff --git a/src/Nethermind/Nethermind.Db.Test/MemDbTests.cs b/src/Nethermind/Nethermind.Db.Test/MemDbTests.cs
index 21f5e36665a..ba3ef5fc7ef 100644
--- a/src/Nethermind/Nethermind.Db.Test/MemDbTests.cs
+++ b/src/Nethermind/Nethermind.Db.Test/MemDbTests.cs
@@ -23,7 +23,7 @@ public void Simple_set_get_is_fine()
retrievedBytes.Should().BeEquivalentTo(bytes);
}
- private byte[] _sampleValue = { 1, 2, 3 };
+ private readonly byte[] _sampleValue = { 1, 2, 3 };
[Test]
public void Can_create_with_delays()
diff --git a/src/Nethermind/Nethermind.Db/FullPruning/FullPruningDb.cs b/src/Nethermind/Nethermind.Db/FullPruning/FullPruningDb.cs
index 9175ba9b9e9..e610a94e49f 100755
--- a/src/Nethermind/Nethermind.Db/FullPruning/FullPruningDb.cs
+++ b/src/Nethermind/Nethermind.Db/FullPruning/FullPruningDb.cs
@@ -224,7 +224,7 @@ private class PruningContext : IPruningContext
private readonly FullPruningDb _db;
private long _counter = 0;
- private ConcurrentQueue _batches = new();
+ private readonly ConcurrentQueue _batches = new();
public PruningContext(FullPruningDb db, IDb cloningDb, bool duplicateReads)
{
diff --git a/src/Nethermind/Nethermind.Db/InMemoryColumnBatch.cs b/src/Nethermind/Nethermind.Db/InMemoryColumnBatch.cs
index 5c1c78b7128..9cff6e2fa95 100644
--- a/src/Nethermind/Nethermind.Db/InMemoryColumnBatch.cs
+++ b/src/Nethermind/Nethermind.Db/InMemoryColumnBatch.cs
@@ -8,7 +8,7 @@ namespace Nethermind.Db
{
public class InMemoryColumnWriteBatch : IColumnsWriteBatch
{
- private IList _underlyingBatch = new List();
+ private readonly IList _underlyingBatch = new List();
private readonly IColumnsDb _columnsDb;
public InMemoryColumnWriteBatch(IColumnsDb columnsDb)
diff --git a/src/Nethermind/Nethermind.Evm.Test/Eip6780Tests.cs b/src/Nethermind/Nethermind.Evm.Test/Eip6780Tests.cs
index 55281021029..2384a375c7a 100644
--- a/src/Nethermind/Nethermind.Evm.Test/Eip6780Tests.cs
+++ b/src/Nethermind/Nethermind.Evm.Test/Eip6780Tests.cs
@@ -39,8 +39,8 @@ public class Eip6780Tests : VirtualMachineTestsBase
private byte[] _selfDestructCode;
private Address _contractAddress;
private byte[] _initCode;
- private long _gasLimit = 1000000;
- private EthereumEcdsa _ecdsa = new(1, LimboLogs.Instance);
+ private readonly long _gasLimit = 1000000;
+ private readonly EthereumEcdsa _ecdsa = new(1, LimboLogs.Instance);
[SetUp]
public override void Setup()
diff --git a/src/Nethermind/Nethermind.Evm.Test/InvalidOpcodeTests.cs b/src/Nethermind/Nethermind.Evm.Test/InvalidOpcodeTests.cs
index 40e91fe7ec6..c1592e11c84 100644
--- a/src/Nethermind/Nethermind.Evm.Test/InvalidOpcodeTests.cs
+++ b/src/Nethermind/Nethermind.Evm.Test/InvalidOpcodeTests.cs
@@ -112,7 +112,7 @@ public class InvalidOpcodeTests : VirtualMachineTestsBase
}
).ToArray();
- private Dictionary _validOpcodes
+ private readonly Dictionary _validOpcodes
= new()
{
{(ForkActivation)0, FrontierInstructions},
diff --git a/src/Nethermind/Nethermind.Evm/CodeAnalysis/CodeInfo.cs b/src/Nethermind/Nethermind.Evm/CodeAnalysis/CodeInfo.cs
index d8cec2c0adb..ec8df2a5870 100644
--- a/src/Nethermind/Nethermind.Evm/CodeAnalysis/CodeInfo.cs
+++ b/src/Nethermind/Nethermind.Evm/CodeAnalysis/CodeInfo.cs
@@ -11,7 +11,7 @@ public class CodeInfo
private const int SampledCodeLength = 10_001;
private const int PercentageOfPush1 = 40;
private const int NumberOfSamples = 100;
- private static Random _rand = new();
+ private static readonly Random _rand = new();
public byte[] MachineCode { get; set; }
public IPrecompile? Precompile { get; set; }
diff --git a/src/Nethermind/Nethermind.Evm/Precompiles/Blake2FPrecompile.cs b/src/Nethermind/Nethermind.Evm/Precompiles/Blake2FPrecompile.cs
index 3688f39f8c2..14534399d3f 100644
--- a/src/Nethermind/Nethermind.Evm/Precompiles/Blake2FPrecompile.cs
+++ b/src/Nethermind/Nethermind.Evm/Precompiles/Blake2FPrecompile.cs
@@ -13,7 +13,7 @@ public class Blake2FPrecompile : IPrecompile
{
private const int RequiredInputLength = 213;
- private Blake2Compression _blake = new();
+ private readonly Blake2Compression _blake = new();
public static readonly Blake2FPrecompile Instance = new Blake2FPrecompile();
diff --git a/src/Nethermind/Nethermind.Evm/Precompiles/Bls/Discount.cs b/src/Nethermind/Nethermind.Evm/Precompiles/Bls/Discount.cs
index f5fe0a53f31..a84d69d1d06 100644
--- a/src/Nethermind/Nethermind.Evm/Precompiles/Bls/Discount.cs
+++ b/src/Nethermind/Nethermind.Evm/Precompiles/Bls/Discount.cs
@@ -20,7 +20,7 @@ public static int For(int k)
};
}
- private static Dictionary _discountTable = new()
+ private static readonly Dictionary _discountTable = new()
{
{ 1, 1200 },
{ 2, 888 },
diff --git a/src/Nethermind/Nethermind.Evm/Precompiles/Sha256Precompile.cs b/src/Nethermind/Nethermind.Evm/Precompiles/Sha256Precompile.cs
index 9946514d023..4aa42639104 100644
--- a/src/Nethermind/Nethermind.Evm/Precompiles/Sha256Precompile.cs
+++ b/src/Nethermind/Nethermind.Evm/Precompiles/Sha256Precompile.cs
@@ -11,7 +11,7 @@ namespace Nethermind.Evm.Precompiles
{
public class Sha256Precompile : IPrecompile
{
- private static ThreadLocal _sha256 = new();
+ private static readonly ThreadLocal _sha256 = new();
public static readonly Sha256Precompile Instance = new Sha256Precompile();
diff --git a/src/Nethermind/Nethermind.Evm/Tracing/GethStyle/GethLikeBlockFileTracer.cs b/src/Nethermind/Nethermind.Evm/Tracing/GethStyle/GethLikeBlockFileTracer.cs
index e70a0c5b25b..79c35a0f7d2 100644
--- a/src/Nethermind/Nethermind.Evm/Tracing/GethStyle/GethLikeBlockFileTracer.cs
+++ b/src/Nethermind/Nethermind.Evm/Tracing/GethStyle/GethLikeBlockFileTracer.cs
@@ -21,7 +21,7 @@ public class GethLikeBlockFileTracer : BlockTracerBase _fileNames = new();
- private IFileSystem _fileSystem;
+ private readonly IFileSystem _fileSystem;
private Utf8JsonWriter _jsonWriter;
private readonly GethTraceOptions _options;
private readonly JsonSerializerOptions _serializerOptions = new();
diff --git a/src/Nethermind/Nethermind.Evm/Tracing/ParityStyle/ParityAccountStateChangeJsonConverter.cs b/src/Nethermind/Nethermind.Evm/Tracing/ParityStyle/ParityAccountStateChangeJsonConverter.cs
index d82c1540a79..af98fb2662b 100644
--- a/src/Nethermind/Nethermind.Evm/Tracing/ParityStyle/ParityAccountStateChangeJsonConverter.cs
+++ b/src/Nethermind/Nethermind.Evm/Tracing/ParityStyle/ParityAccountStateChangeJsonConverter.cs
@@ -14,7 +14,7 @@ namespace Nethermind.Evm.Tracing.ParityStyle;
public class ParityAccountStateChangeJsonConverter : JsonConverter
{
- private Bytes32Converter _32BytesConverter = new();
+ private readonly Bytes32Converter _32BytesConverter = new();
public override ParityAccountStateChange Read(
ref Utf8JsonReader reader,
diff --git a/src/Nethermind/Nethermind.Evm/VirtualMachine.cs b/src/Nethermind/Nethermind.Evm/VirtualMachine.cs
index a9107e307fe..c168656d7ba 100644
--- a/src/Nethermind/Nethermind.Evm/VirtualMachine.cs
+++ b/src/Nethermind/Nethermind.Evm/VirtualMachine.cs
@@ -129,9 +129,9 @@ public interface IIsTracing { }
internal sealed class VirtualMachine : IVirtualMachine
where TLogger : struct, IIsTracing
{
- private UInt256 P255Int = (UInt256)System.Numerics.BigInteger.Pow(2, 255);
+ private readonly UInt256 P255Int = (UInt256)System.Numerics.BigInteger.Pow(2, 255);
private UInt256 P255 => P255Int;
- private UInt256 BigInt256 = 256;
+ private readonly UInt256 BigInt256 = 256;
public UInt256 BigInt32 = 32;
internal byte[] BytesZero = { 0 };
diff --git a/src/Nethermind/Nethermind.Facade/Filters/FilterStore.cs b/src/Nethermind/Nethermind.Facade/Filters/FilterStore.cs
index d434245ac30..b6af25caa12 100644
--- a/src/Nethermind/Nethermind.Facade/Filters/FilterStore.cs
+++ b/src/Nethermind/Nethermind.Facade/Filters/FilterStore.cs
@@ -18,7 +18,7 @@ namespace Nethermind.Blockchain.Filters
public class FilterStore : IFilterStore
{
private int _currentFilterId = -1;
- private object _locker = new object();
+ private readonly object _locker = new object();
private readonly ConcurrentDictionary _filters = new();
diff --git a/src/Nethermind/Nethermind.Hive/HiveRunner.cs b/src/Nethermind/Nethermind.Hive/HiveRunner.cs
index eeb6c4b6c73..ce5006938e7 100644
--- a/src/Nethermind/Nethermind.Hive/HiveRunner.cs
+++ b/src/Nethermind/Nethermind.Hive/HiveRunner.cs
@@ -27,7 +27,7 @@ public class HiveRunner
private readonly IConfigProvider _configurationProvider;
private readonly IFileSystem _fileSystem;
private readonly IBlockValidator _blockValidator;
- private SemaphoreSlim _resetEvent;
+ private readonly SemaphoreSlim _resetEvent;
private bool BlockSuggested;
public HiveRunner(
diff --git a/src/Nethermind/Nethermind.Init/MemoryHintMan.cs b/src/Nethermind/Nethermind.Init/MemoryHintMan.cs
index c5b47d218ba..62927f0d803 100644
--- a/src/Nethermind/Nethermind.Init/MemoryHintMan.cs
+++ b/src/Nethermind/Nethermind.Init/MemoryHintMan.cs
@@ -22,8 +22,8 @@ namespace Nethermind.Init
///
public class MemoryHintMan
{
- private ILogger _logger;
- private MallocHelper _mallocHelper;
+ private readonly ILogger _logger;
+ private readonly MallocHelper _mallocHelper;
public MemoryHintMan(ILogManager logManager, MallocHelper? mallocHelper = null)
{
diff --git a/src/Nethermind/Nethermind.Init/Steps/ApplyMemoryHint.cs b/src/Nethermind/Nethermind.Init/Steps/ApplyMemoryHint.cs
index 64bb227dcd0..d9a279eb78f 100644
--- a/src/Nethermind/Nethermind.Init/Steps/ApplyMemoryHint.cs
+++ b/src/Nethermind/Nethermind.Init/Steps/ApplyMemoryHint.cs
@@ -16,11 +16,11 @@ namespace Nethermind.Init.Steps
public sealed class ApplyMemoryHint : IStep
{
private readonly INethermindApi _api;
- private IInitConfig _initConfig;
- private IDbConfig _dbConfig;
- private INetworkConfig _networkConfig;
- private ISyncConfig _syncConfig;
- private ITxPoolConfig _txPoolConfig;
+ private readonly IInitConfig _initConfig;
+ private readonly IDbConfig _dbConfig;
+ private readonly INetworkConfig _networkConfig;
+ private readonly ISyncConfig _syncConfig;
+ private readonly ITxPoolConfig _txPoolConfig;
public ApplyMemoryHint(INethermindApi api)
{
diff --git a/src/Nethermind/Nethermind.Init/Steps/EthereumStepsManager.cs b/src/Nethermind/Nethermind.Init/Steps/EthereumStepsManager.cs
index c713f5b0fbb..6baa25ed061 100644
--- a/src/Nethermind/Nethermind.Init/Steps/EthereumStepsManager.cs
+++ b/src/Nethermind/Nethermind.Init/Steps/EthereumStepsManager.cs
@@ -17,9 +17,9 @@ namespace Nethermind.Init.Steps
{
public class EthereumStepsManager
{
- private ILogger _logger;
+ private readonly ILogger _logger;
- private AutoResetEvent _autoResetEvent = new AutoResetEvent(true);
+ private readonly AutoResetEvent _autoResetEvent = new AutoResetEvent(true);
private readonly INethermindApi _api;
private readonly List _allSteps;
private readonly Dictionary _allStepsByBaseType;
diff --git a/src/Nethermind/Nethermind.Init/Steps/InitializeBlockProducer.cs b/src/Nethermind/Nethermind.Init/Steps/InitializeBlockProducer.cs
index 0fa117e656e..fe8d01a22ed 100644
--- a/src/Nethermind/Nethermind.Init/Steps/InitializeBlockProducer.cs
+++ b/src/Nethermind/Nethermind.Init/Steps/InitializeBlockProducer.cs
@@ -15,7 +15,7 @@ namespace Nethermind.Init.Steps
[RunnerStepDependencies(typeof(StartBlockProcessor), typeof(SetupKeyStore), typeof(InitializeNetwork), typeof(ReviewBlockTree))]
public class InitializeBlockProducer : IStep
{
- private IApiWithBlockchain _api;
+ private readonly IApiWithBlockchain _api;
public InitializeBlockProducer(INethermindApi api)
{
diff --git a/src/Nethermind/Nethermind.Init/Steps/ReviewBlockTree.cs b/src/Nethermind/Nethermind.Init/Steps/ReviewBlockTree.cs
index b9dd8fb4797..2a200190434 100644
--- a/src/Nethermind/Nethermind.Init/Steps/ReviewBlockTree.cs
+++ b/src/Nethermind/Nethermind.Init/Steps/ReviewBlockTree.cs
@@ -14,7 +14,7 @@ namespace Nethermind.Init.Steps
public class ReviewBlockTree : IStep
{
private readonly IApiWithBlockchain _api;
- private ILogger _logger;
+ private readonly ILogger _logger;
public ReviewBlockTree(INethermindApi api)
{
diff --git a/src/Nethermind/Nethermind.JsonRpc.Test/ConsensusHelperTests.cs b/src/Nethermind/Nethermind.JsonRpc.Test/ConsensusHelperTests.cs
index cc9a940ec4f..ede281b37ad 100644
--- a/src/Nethermind/Nethermind.JsonRpc.Test/ConsensusHelperTests.cs
+++ b/src/Nethermind/Nethermind.JsonRpc.Test/ConsensusHelperTests.cs
@@ -27,7 +27,7 @@ namespace Nethermind.JsonRpc.Test
[Explicit]
public partial class ConsensusHelperTests
{
- private static Func, EquivalencyAssertionOptions> ReceiptOptions =
+ private static readonly Func, EquivalencyAssertionOptions> ReceiptOptions =
options => options.WithStrictOrdering()
.IncludingNestedObjects()
.Including(r => r.TransactionHash)
diff --git a/src/Nethermind/Nethermind.JsonRpc.Test/JsonRpcLocalStats.cs b/src/Nethermind/Nethermind.JsonRpc.Test/JsonRpcLocalStats.cs
index e735a5fbe51..be18b1fa3a2 100644
--- a/src/Nethermind/Nethermind.JsonRpc.Test/JsonRpcLocalStats.cs
+++ b/src/Nethermind/Nethermind.JsonRpc.Test/JsonRpcLocalStats.cs
@@ -16,11 +16,11 @@ public class JsonRpcLocalStatsTests
{
private TestLogger _testLogger = null!;
- private JsonRpcConfig _config = new();
+ private readonly JsonRpcConfig _config = new();
private ManualTimestamper _manualTimestamper = null!;
- private DateTime _startTime = DateTime.MinValue;
+ private readonly DateTime _startTime = DateTime.MinValue;
private OneLoggerLogManager _logManager = null!;
[SetUp]
diff --git a/src/Nethermind/Nethermind.JsonRpc.Test/Modules/DebugModuleTests.cs b/src/Nethermind/Nethermind.JsonRpc.Test/Modules/DebugModuleTests.cs
index 217a9f9b563..dabb9c414e0 100644
--- a/src/Nethermind/Nethermind.JsonRpc.Test/Modules/DebugModuleTests.cs
+++ b/src/Nethermind/Nethermind.JsonRpc.Test/Modules/DebugModuleTests.cs
@@ -28,8 +28,8 @@ namespace Nethermind.JsonRpc.Test.Modules;
[TestFixture]
public class DebugModuleTests
{
- private IJsonRpcConfig jsonRpcConfig = new JsonRpcConfig();
- private IDebugBridge debugBridge = Substitute.For();
+ private readonly IJsonRpcConfig jsonRpcConfig = new JsonRpcConfig();
+ private readonly IDebugBridge debugBridge = Substitute.For();
[Test]
public async Task Get_from_db()
diff --git a/src/Nethermind/Nethermind.JsonRpc/Modules/DebugModule/DebugModuleFactory.cs b/src/Nethermind/Nethermind.JsonRpc/Modules/DebugModule/DebugModuleFactory.cs
index 7b36aa1930b..e9664e06f0d 100644
--- a/src/Nethermind/Nethermind.JsonRpc/Modules/DebugModule/DebugModuleFactory.cs
+++ b/src/Nethermind/Nethermind.JsonRpc/Modules/DebugModule/DebugModuleFactory.cs
@@ -40,7 +40,7 @@ public class DebugModuleFactory : ModuleFactoryBase
private readonly IReadOnlyBlockTree _blockTree;
private readonly ISyncModeSelector _syncModeSelector;
private readonly IFileSystem _fileSystem;
- private ILogger _logger;
+ private readonly ILogger _logger;
public DebugModuleFactory(
IWorldStateManager worldStateManager,
diff --git a/src/Nethermind/Nethermind.JsonRpc/Modules/Net/NetRpcModule.cs b/src/Nethermind/Nethermind.JsonRpc/Modules/Net/NetRpcModule.cs
index 89a8d4875ca..a6a0f354289 100644
--- a/src/Nethermind/Nethermind.JsonRpc/Modules/Net/NetRpcModule.cs
+++ b/src/Nethermind/Nethermind.JsonRpc/Modules/Net/NetRpcModule.cs
@@ -10,7 +10,7 @@ namespace Nethermind.JsonRpc.Modules.Net
public class NetRpcModule : INetRpcModule
{
private readonly INetBridge _netBridge;
- private string _netVersionString;
+ private readonly string _netVersionString;
public NetRpcModule(ILogManager logManager, INetBridge netBridge)
{
diff --git a/src/Nethermind/Nethermind.JsonRpc/Modules/NullModuleProvider.cs b/src/Nethermind/Nethermind.JsonRpc/Modules/NullModuleProvider.cs
index 8ebedcb9f9f..91e023557d9 100644
--- a/src/Nethermind/Nethermind.JsonRpc/Modules/NullModuleProvider.cs
+++ b/src/Nethermind/Nethermind.JsonRpc/Modules/NullModuleProvider.cs
@@ -14,7 +14,7 @@ namespace Nethermind.JsonRpc.Modules
public class NullModuleProvider : IRpcModuleProvider
{
public static NullModuleProvider Instance = new();
- private static Task Null = Task.FromResult(default(IRpcModule));
+ private static readonly Task Null = Task.FromResult(default(IRpcModule));
private NullModuleProvider()
{
diff --git a/src/Nethermind/Nethermind.JsonRpc/Modules/Personal/PersonalRpcModule.cs b/src/Nethermind/Nethermind.JsonRpc/Modules/Personal/PersonalRpcModule.cs
index e0a09e6ecec..1070270a9d5 100644
--- a/src/Nethermind/Nethermind.JsonRpc/Modules/Personal/PersonalRpcModule.cs
+++ b/src/Nethermind/Nethermind.JsonRpc/Modules/Personal/PersonalRpcModule.cs
@@ -15,7 +15,7 @@ namespace Nethermind.JsonRpc.Modules.Personal
{
public class PersonalRpcModule : IPersonalRpcModule
{
- private Encoding _messageEncoding = Encoding.UTF8;
+ private readonly Encoding _messageEncoding = Encoding.UTF8;
private readonly IEcdsa _ecdsa;
private readonly IWallet _wallet;
private readonly IKeyStore _keyStore;
diff --git a/src/Nethermind/Nethermind.JsonRpc/Modules/Trace/ParityTxTraceFromReplay.cs b/src/Nethermind/Nethermind.JsonRpc/Modules/Trace/ParityTxTraceFromReplay.cs
index 65267360b6c..a3d258984de 100644
--- a/src/Nethermind/Nethermind.JsonRpc/Modules/Trace/ParityTxTraceFromReplay.cs
+++ b/src/Nethermind/Nethermind.JsonRpc/Modules/Trace/ParityTxTraceFromReplay.cs
@@ -126,7 +126,7 @@ public override void Write(
public class ParityTxTraceFromReplayJsonConverter : JsonConverter
{
- ParityTraceActionFromReplayJsonConverter _actionConverter = new();
+ readonly ParityTraceActionFromReplayJsonConverter _actionConverter = new();
public override ParityTxTraceFromReplay Read(
ref Utf8JsonReader reader,
Type typeToConvert,
diff --git a/src/Nethermind/Nethermind.JsonRpc/Recorder.cs b/src/Nethermind/Nethermind.JsonRpc/Recorder.cs
index 7374551f4cd..b26fee1579f 100644
--- a/src/Nethermind/Nethermind.JsonRpc/Recorder.cs
+++ b/src/Nethermind/Nethermind.JsonRpc/Recorder.cs
@@ -10,14 +10,14 @@ namespace Nethermind.JsonRpc
{
internal class Recorder
{
- private string _recorderBaseFilePath;
+ private readonly string _recorderBaseFilePath;
private readonly IFileSystem _fileSystem;
private readonly ILogger _logger;
private int _recorderFileCounter;
private string _currentRecorderFilePath;
private int _currentRecorderFileLength;
private bool _isEnabled = true;
- private object _recorderSync = new();
+ private readonly object _recorderSync = new();
public Recorder(string basePath, IFileSystem fileSystem, ILogger logger)
{
diff --git a/src/Nethermind/Nethermind.KeyStore.Test/FilePasswordProviderTests.cs b/src/Nethermind/Nethermind.KeyStore.Test/FilePasswordProviderTests.cs
index 47a50155d65..917b147286e 100644
--- a/src/Nethermind/Nethermind.KeyStore.Test/FilePasswordProviderTests.cs
+++ b/src/Nethermind/Nethermind.KeyStore.Test/FilePasswordProviderTests.cs
@@ -11,7 +11,7 @@ namespace Nethermind.KeyStore.Test
{
public class FilePasswordProviderTests
{
- private static List<(string Name, string Content)> _files = new List<(string Name, string Content)>()
+ private static readonly List<(string Name, string Content)> _files = new List<(string Name, string Content)>()
{
("TestingPasswordProviderFileF1", "PF1"),
("TestingPasswordProviderFileF2", "P F2"),
diff --git a/src/Nethermind/Nethermind.KeyStore.Test/KeyStorePasswordProviderTests.cs b/src/Nethermind/Nethermind.KeyStore.Test/KeyStorePasswordProviderTests.cs
index 0f57ad1111e..4d664ac4a35 100644
--- a/src/Nethermind/Nethermind.KeyStore.Test/KeyStorePasswordProviderTests.cs
+++ b/src/Nethermind/Nethermind.KeyStore.Test/KeyStorePasswordProviderTests.cs
@@ -18,7 +18,7 @@ namespace Nethermind.KeyStore.Test
{
public class KeyStorePasswordProviderTests
{
- private static List<(string Name, string Content)> _files = new List<(string Name, string Content)>()
+ private static readonly List<(string Name, string Content)> _files = new List<(string Name, string Content)>()
{
("TestingPasswordProviderFileF1", "PF1"),
("TestingPasswordProviderFileF2", "P F2"),
diff --git a/src/Nethermind/Nethermind.Logging.NLog/NLogManager.cs b/src/Nethermind/Nethermind.Logging.NLog/NLogManager.cs
index 20ad3867675..0b25b336fc0 100644
--- a/src/Nethermind/Nethermind.Logging.NLog/NLogManager.cs
+++ b/src/Nethermind/Nethermind.Logging.NLog/NLogManager.cs
@@ -57,8 +57,8 @@ private static string SetupLogDirectory(string logDirectory)
return logDirectory;
}
- private ConcurrentDictionary _loggers = new();
- private EventHandler _logManagerOnConfigurationChanged;
+ private readonly ConcurrentDictionary _loggers = new();
+ private readonly EventHandler _logManagerOnConfigurationChanged;
private NLogLogger BuildLogger(Type type) => new(type);
diff --git a/src/Nethermind/Nethermind.Logging/ConsoleAsyncLogger.cs b/src/Nethermind/Nethermind.Logging/ConsoleAsyncLogger.cs
index ac6226ecbc1..f2fb30bf4a8 100644
--- a/src/Nethermind/Nethermind.Logging/ConsoleAsyncLogger.cs
+++ b/src/Nethermind/Nethermind.Logging/ConsoleAsyncLogger.cs
@@ -22,7 +22,7 @@ public void Flush()
_task.Wait();
}
- private Task _task;
+ private readonly Task _task;
public ConsoleAsyncLogger(LogLevel logLevel, string prefix = null)
{
diff --git a/src/Nethermind/Nethermind.Merge.Plugin.Test/InvalidChainTracker/InvalidHeaderSealInterceptorTest.cs b/src/Nethermind/Nethermind.Merge.Plugin.Test/InvalidChainTracker/InvalidHeaderSealInterceptorTest.cs
index a7fda193665..97663767f3f 100644
--- a/src/Nethermind/Nethermind.Merge.Plugin.Test/InvalidChainTracker/InvalidHeaderSealInterceptorTest.cs
+++ b/src/Nethermind/Nethermind.Merge.Plugin.Test/InvalidChainTracker/InvalidHeaderSealInterceptorTest.cs
@@ -16,9 +16,9 @@ public class InvalidHeaderSealInterceptorTest
{
private class Context
{
- private BlockHeader _blockHeader = Build.A.BlockHeader.TestObject;
- private ISealValidator _baseValidator = Substitute.For();
- private IInvalidChainTracker _invalidChainTracker = Substitute.For();
+ private readonly BlockHeader _blockHeader = Build.A.BlockHeader.TestObject;
+ private readonly ISealValidator _baseValidator = Substitute.For();
+ private readonly IInvalidChainTracker _invalidChainTracker = Substitute.For();
public Context OnValidateSeal()
{
diff --git a/src/Nethermind/Nethermind.Merge.Plugin.Test/MergeSealValidatorTests.cs b/src/Nethermind/Nethermind.Merge.Plugin.Test/MergeSealValidatorTests.cs
index 234b1159252..4053c503d7b 100644
--- a/src/Nethermind/Nethermind.Merge.Plugin.Test/MergeSealValidatorTests.cs
+++ b/src/Nethermind/Nethermind.Merge.Plugin.Test/MergeSealValidatorTests.cs
@@ -12,9 +12,9 @@ public class MergeSealValidatorTests
{
private class Context
{
- private BlockHeader _blockHeader = Build.A.BlockHeader.TestObject;
- private IPoSSwitcher _poSSwitcher = Substitute.For();
- private ISealValidator _baseValidator = Substitute.For();
+ private readonly BlockHeader _blockHeader = Build.A.BlockHeader.TestObject;
+ private readonly IPoSSwitcher _poSSwitcher = Substitute.For();
+ private readonly ISealValidator _baseValidator = Substitute.For();
public Context WhenHeaderIsTerminalBlock()
{
diff --git a/src/Nethermind/Nethermind.Merge.Plugin/InvalidChainTracker/InvalidBlockInterceptor.cs b/src/Nethermind/Nethermind.Merge.Plugin/InvalidChainTracker/InvalidBlockInterceptor.cs
index 71034535de8..e72a4ad4bd6 100644
--- a/src/Nethermind/Nethermind.Merge.Plugin/InvalidChainTracker/InvalidBlockInterceptor.cs
+++ b/src/Nethermind/Nethermind.Merge.Plugin/InvalidChainTracker/InvalidBlockInterceptor.cs
@@ -9,9 +9,9 @@ namespace Nethermind.Merge.Plugin.InvalidChainTracker;
public class InvalidBlockInterceptor : IBlockValidator
{
- private IBlockValidator _baseValidator;
- private IInvalidChainTracker _invalidChainTracker;
- private ILogger _logger;
+ private readonly IBlockValidator _baseValidator;
+ private readonly IInvalidChainTracker _invalidChainTracker;
+ private readonly ILogger _logger;
public InvalidBlockInterceptor(
IBlockValidator headerValidator,
diff --git a/src/Nethermind/Nethermind.Merkleization/MemMerkleTreeStore.cs b/src/Nethermind/Nethermind.Merkleization/MemMerkleTreeStore.cs
index 416bb5ffb97..bfc85711d2f 100644
--- a/src/Nethermind/Nethermind.Merkleization/MemMerkleTreeStore.cs
+++ b/src/Nethermind/Nethermind.Merkleization/MemMerkleTreeStore.cs
@@ -8,7 +8,7 @@ namespace Nethermind.Merkleization;
public class MemMerkleTreeStore : IKeyValueStore
{
- private Dictionary _dictionary = new Dictionary();
+ private readonly Dictionary _dictionary = new Dictionary();
public byte[]? this[ulong key]
{
diff --git a/src/Nethermind/Nethermind.Merkleization/Merkle.Containers.cs b/src/Nethermind/Nethermind.Merkleization/Merkle.Containers.cs
index 679bbdc7e38..a16b088d6e7 100644
--- a/src/Nethermind/Nethermind.Merkleization/Merkle.Containers.cs
+++ b/src/Nethermind/Nethermind.Merkleization/Merkle.Containers.cs
@@ -316,7 +316,7 @@ public static partial class Merkle
// merkleizer.CalculateRoot(out root);
//}
- private static UInt256 RootOfNull;
+ private static readonly UInt256 RootOfNull;
//public static void Ize(out UInt256 root, ProposerSlashing container)
//{
diff --git a/src/Nethermind/Nethermind.Merkleization/MerkleTree.cs b/src/Nethermind/Nethermind.Merkleization/MerkleTree.cs
index cbede0536f0..5df4e71f782 100644
--- a/src/Nethermind/Nethermind.Merkleization/MerkleTree.cs
+++ b/src/Nethermind/Nethermind.Merkleization/MerkleTree.cs
@@ -22,7 +22,7 @@ public abstract class MerkleTree : IMerkleList
private readonly IKeyValueStore _keyValueStore;
- private static ulong _countKey = ulong.MaxValue;
+ private static readonly ulong _countKey = ulong.MaxValue;
public readonly ref struct Index
{
@@ -267,7 +267,7 @@ public void Insert(Bytes32 leaf)
StoreCountInTheDb();
}
- private byte[] _countBytes = new byte[32];
+ private readonly byte[] _countBytes = new byte[32];
///
/// Check if 'leaf' at 'index' verifies against the Merkle 'root' and 'branch'
diff --git a/src/Nethermind/Nethermind.Merkleization/Merkleizer.cs b/src/Nethermind/Nethermind.Merkleization/Merkleizer.cs
index 364b4b69880..200391191cc 100644
--- a/src/Nethermind/Nethermind.Merkleization/Merkleizer.cs
+++ b/src/Nethermind/Nethermind.Merkleization/Merkleizer.cs
@@ -28,7 +28,7 @@ public void UnsetKthBit(int k)
_filled &= ~((ulong)1 << k);
}
- private Span _chunks;
+ private readonly Span _chunks;
private ulong _filled;
public UInt256 PartChunk
diff --git a/src/Nethermind/Nethermind.Mev.Test/MevRpcModuleTests.TestMevRpcBlockchain.cs b/src/Nethermind/Nethermind.Mev.Test/MevRpcModuleTests.TestMevRpcBlockchain.cs
index 6824ebb1800..b87338a918b 100644
--- a/src/Nethermind/Nethermind.Mev.Test/MevRpcModuleTests.TestMevRpcBlockchain.cs
+++ b/src/Nethermind/Nethermind.Mev.Test/MevRpcModuleTests.TestMevRpcBlockchain.cs
@@ -58,7 +58,7 @@ public class TestMevRpcBlockchain : TestRpcBlockchain
private ITracerFactory _tracerFactory = null!;
public TestBundlePool BundlePool { get; private set; } = null!;
- private MevConfig _mevConfig;
+ private readonly MevConfig _mevConfig;
public TestMevRpcBlockchain(int maxMergedBundles, UInt256? initialBaseFeePerGas, Address[]? relayAddresses)
{
diff --git a/src/Nethermind/Nethermind.Mev.Test/MevRpcModuleTests.cs b/src/Nethermind/Nethermind.Mev.Test/MevRpcModuleTests.cs
index cdfcfb51641..ef4b4b913a3 100644
--- a/src/Nethermind/Nethermind.Mev.Test/MevRpcModuleTests.cs
+++ b/src/Nethermind/Nethermind.Mev.Test/MevRpcModuleTests.cs
@@ -65,7 +65,7 @@ public static class Contracts
// WARNING be careful when using PrivateKeyC
// make sure keys from A to D are funded with test ether
- private static PrivateKey ContractCreatorPrivateKey = TestItem.PrivateKeyC;
+ private static readonly PrivateKey ContractCreatorPrivateKey = TestItem.PrivateKeyC;
public static async Task Deploy(TestMevRpcBlockchain chain, string code, ulong nonce = 0, int value = 1)
{
diff --git a/src/Nethermind/Nethermind.Mev.Test/TestBundlePool.cs b/src/Nethermind/Nethermind.Mev.Test/TestBundlePool.cs
index d350a274e77..7320a09bfe5 100644
--- a/src/Nethermind/Nethermind.Mev.Test/TestBundlePool.cs
+++ b/src/Nethermind/Nethermind.Mev.Test/TestBundlePool.cs
@@ -18,7 +18,7 @@ namespace Nethermind.Mev.Test
{
public class TestBundlePool : BundlePool
{
- private BlockingCollection<(MevBundle Bundle, SimulatedMevBundleContext? Context)> _queue = new(new ConcurrentQueue<(MevBundle, SimulatedMevBundleContext?)>());
+ private readonly BlockingCollection<(MevBundle Bundle, SimulatedMevBundleContext? Context)> _queue = new(new ConcurrentQueue<(MevBundle, SimulatedMevBundleContext?)>());
public TestBundlePool(IBlockTree blockTree,
IBundleSimulator simulator,
diff --git a/src/Nethermind/Nethermind.Mining.Test/HintBasedCacheTests.cs b/src/Nethermind/Nethermind.Mining.Test/HintBasedCacheTests.cs
index aa2fe9e20de..a48d9c6b7d6 100644
--- a/src/Nethermind/Nethermind.Mining.Test/HintBasedCacheTests.cs
+++ b/src/Nethermind/Nethermind.Mining.Test/HintBasedCacheTests.cs
@@ -37,9 +37,9 @@ public void Without_hint_return_null()
}
}
- private Guid _guidA = Guid.NewGuid();
- private Guid _guidB = Guid.NewGuid();
- private Guid _guidC = Guid.NewGuid();
+ private readonly Guid _guidA = Guid.NewGuid();
+ private readonly Guid _guidB = Guid.NewGuid();
+ private readonly Guid _guidC = Guid.NewGuid();
[Test]
public async Task With_hint_returns_value()
diff --git a/src/Nethermind/Nethermind.Network.Discovery.Test/NodeLifecycleManagerTests.cs b/src/Nethermind/Nethermind.Network.Discovery.Test/NodeLifecycleManagerTests.cs
index d30f74bbde4..7ab3007f1e4 100644
--- a/src/Nethermind/Nethermind.Network.Discovery.Test/NodeLifecycleManagerTests.cs
+++ b/src/Nethermind/Nethermind.Network.Discovery.Test/NodeLifecycleManagerTests.cs
@@ -42,8 +42,8 @@ public class NodeLifecycleManagerTests
private INodeTable _nodeTable = null!;
private IEvictionManager _evictionManagerMock = null!;
private ILogger _loggerMock = null!;
- private int _port = 1;
- private string _host = "192.168.1.27";
+ private readonly int _port = 1;
+ private readonly string _host = "192.168.1.27";
[SetUp]
public void Setup()
diff --git a/src/Nethermind/Nethermind.Network.Discovery.Test/RoutingTable/NodeBucketTests.cs b/src/Nethermind/Nethermind.Network.Discovery.Test/RoutingTable/NodeBucketTests.cs
index 256c4e9dcdf..d5038f6374e 100644
--- a/src/Nethermind/Nethermind.Network.Discovery.Test/RoutingTable/NodeBucketTests.cs
+++ b/src/Nethermind/Nethermind.Network.Discovery.Test/RoutingTable/NodeBucketTests.cs
@@ -15,9 +15,9 @@ namespace Nethermind.Network.Discovery.Test.RoutingTable
[TestFixture]
public class NodeBucketTests
{
- private Node _node = new(TestItem.PublicKeyA, IPAddress.Broadcast.ToString(), 30000);
- private Node _node2 = new(TestItem.PublicKeyB, IPAddress.Broadcast.ToString(), 3000);
- private Node _node3 = new(TestItem.PublicKeyC, IPAddress.Broadcast.ToString(), 3000);
+ private readonly Node _node = new(TestItem.PublicKeyA, IPAddress.Broadcast.ToString(), 30000);
+ private readonly Node _node2 = new(TestItem.PublicKeyB, IPAddress.Broadcast.ToString(), 3000);
+ private readonly Node _node3 = new(TestItem.PublicKeyC, IPAddress.Broadcast.ToString(), 3000);
[Test]
public void Bonded_count_is_tracked()
diff --git a/src/Nethermind/Nethermind.Network.Discovery/RoutingTable/NodeAddResult.cs b/src/Nethermind/Nethermind.Network.Discovery/RoutingTable/NodeAddResult.cs
index 2c5064c4116..3ebdff63a7b 100644
--- a/src/Nethermind/Nethermind.Network.Discovery/RoutingTable/NodeAddResult.cs
+++ b/src/Nethermind/Nethermind.Network.Discovery/RoutingTable/NodeAddResult.cs
@@ -9,8 +9,8 @@ public class NodeAddResult
public NodeBucketItem? EvictionCandidate { get; private init; }
- private static NodeAddResult? _added = null;
- private static NodeAddResult? _dropped = null;
+ private static readonly NodeAddResult? _added = null;
+ private static readonly NodeAddResult? _dropped = null;
public static NodeAddResult Added()
{
diff --git a/src/Nethermind/Nethermind.Network.Test/P2P/P2PProtocolHandlerTests.cs b/src/Nethermind/Nethermind.Network.Test/P2P/P2PProtocolHandlerTests.cs
index 4e2f8f3bb86..305d92937c2 100644
--- a/src/Nethermind/Nethermind.Network.Test/P2P/P2PProtocolHandlerTests.cs
+++ b/src/Nethermind/Nethermind.Network.Test/P2P/P2PProtocolHandlerTests.cs
@@ -40,7 +40,7 @@ public void Setup()
private ISession _session;
private IMessageSerializationService _serializer;
- private Node node = new(TestItem.PublicKeyA, "127.0.0.1", 30303);
+ private readonly Node node = new(TestItem.PublicKeyA, "127.0.0.1", 30303);
private INodeStatsManager _nodeStatsManager;
private Regex? _clientIdPattern;
diff --git a/src/Nethermind/Nethermind.Network.Test/PeerManagerTests.cs b/src/Nethermind/Nethermind.Network.Test/PeerManagerTests.cs
index aac19d165d0..4dda0b92184 100644
--- a/src/Nethermind/Nethermind.Network.Test/PeerManagerTests.cs
+++ b/src/Nethermind/Nethermind.Network.Test/PeerManagerTests.cs
@@ -408,10 +408,10 @@ public async Task IfPeerAdded_with_invalid_chain_then_do_not_connect()
ctx.PeerPool.ActivePeers.Count.Should().Be(0);
}
- private int _travisDelay = 500;
+ private readonly int _travisDelay = 500;
- private int _travisDelayLong = 1000;
- private int _travisDelayLonger = 3000;
+ private readonly int _travisDelayLong = 1000;
+ private readonly int _travisDelayLonger = 3000;
[Test]
[Ignore("Behaviour changed that allows peers to go over max if awaiting response")]
diff --git a/src/Nethermind/Nethermind.Network.Test/ProtocolsManagerTests.cs b/src/Nethermind/Nethermind.Network.Test/ProtocolsManagerTests.cs
index 9b72d269f19..7eab2dfa091 100644
--- a/src/Nethermind/Nethermind.Network.Test/ProtocolsManagerTests.cs
+++ b/src/Nethermind/Nethermind.Network.Test/ProtocolsManagerTests.cs
@@ -47,27 +47,27 @@ public void SetUp()
public class Context
{
- private int _localPort = 30312;
- private int _remotePort = 30000;
- private string _remoteHost = "35.0.0.1";
+ private readonly int _localPort = 30312;
+ private readonly int _remotePort = 30000;
+ private readonly string _remoteHost = "35.0.0.1";
private ISession _currentSession;
- private IDiscoveryApp _discoveryApp;
- private IRlpxHost _rlpxHost;
- private ProtocolsManager _manager;
- private INodeStatsManager _nodeStatsManager;
- private INetworkStorage _peerStorage;
- private IProtocolValidator _protocolValidator;
- private IMessageSerializationService _serializer;
- private ISyncServer _syncServer;
- private ISyncPeerPool _syncPeerPool;
- private ITxPool _txPool;
- private IPooledTxsRequestor _pooledTxsRequestor;
- private IChannelHandlerContext _channelHandlerContext;
- private IChannel _channel;
- private IChannelPipeline _pipeline;
- private IPacketSender _packetSender;
- private IBlockTree _blockTree;
- private IGossipPolicy _gossipPolicy;
+ private readonly IDiscoveryApp _discoveryApp;
+ private readonly IRlpxHost _rlpxHost;
+ private readonly ProtocolsManager _manager;
+ private readonly INodeStatsManager _nodeStatsManager;
+ private readonly INetworkStorage _peerStorage;
+ private readonly IProtocolValidator _protocolValidator;
+ private readonly IMessageSerializationService _serializer;
+ private readonly ISyncServer _syncServer;
+ private readonly ISyncPeerPool _syncPeerPool;
+ private readonly ITxPool _txPool;
+ private readonly IPooledTxsRequestor _pooledTxsRequestor;
+ private readonly IChannelHandlerContext _channelHandlerContext;
+ private readonly IChannel _channel;
+ private readonly IChannelPipeline _pipeline;
+ private readonly IPacketSender _packetSender;
+ private readonly IBlockTree _blockTree;
+ private readonly IGossipPolicy _gossipPolicy;
public Context()
{
diff --git a/src/Nethermind/Nethermind.Network.Test/SnapProtocolHandlerTests.cs b/src/Nethermind/Nethermind.Network.Test/SnapProtocolHandlerTests.cs
index 0d6726ad6ba..a150ac86b90 100644
--- a/src/Nethermind/Nethermind.Network.Test/SnapProtocolHandlerTests.cs
+++ b/src/Nethermind/Nethermind.Network.Test/SnapProtocolHandlerTests.cs
@@ -65,7 +65,7 @@ public SnapProtocolHandler SnapProtocolHandler
public TimeSpan SimulatedLatency { get; set; } = TimeSpan.Zero;
- private List _recordedResponseBytesLength = new();
+ private readonly List _recordedResponseBytesLength = new();
public Context WithResponseBytesRecorder
{
get
diff --git a/src/Nethermind/Nethermind.Network/P2P/PacketSender.cs b/src/Nethermind/Nethermind.Network/P2P/PacketSender.cs
index 1321dc672e5..7edf47360ac 100644
--- a/src/Nethermind/Nethermind.Network/P2P/PacketSender.cs
+++ b/src/Nethermind/Nethermind.Network/P2P/PacketSender.cs
@@ -15,7 +15,7 @@ public class PacketSender : ChannelHandlerAdapter, IPacketSender
private readonly IMessageSerializationService _messageSerializationService;
private readonly ILogger _logger;
private IChannelHandlerContext _context;
- private TimeSpan _sendLatency;
+ private readonly TimeSpan _sendLatency;
public PacketSender(IMessageSerializationService messageSerializationService, ILogManager logManager,
TimeSpan sendLatency)
diff --git a/src/Nethermind/Nethermind.Network/P2P/Session.cs b/src/Nethermind/Nethermind.Network/P2P/Session.cs
index 8b1bbda7e85..d9ab8c9bb6e 100644
--- a/src/Nethermind/Nethermind.Network/P2P/Session.cs
+++ b/src/Nethermind/Nethermind.Network/P2P/Session.cs
@@ -426,7 +426,7 @@ bool ShouldDisconnectStaticNode()
MarkDisconnected(disconnectReason, DisconnectType.Local, details);
}
- private object _sessionStateLock = new();
+ private readonly object _sessionStateLock = new();
public byte P2PVersion { get; private set; }
private SessionState _state;
diff --git a/src/Nethermind/Nethermind.Network/P2P/Subprotocols/Eth/V62/Messages/BlockHeadersMessageSerializer.cs b/src/Nethermind/Nethermind.Network/P2P/Subprotocols/Eth/V62/Messages/BlockHeadersMessageSerializer.cs
index dcb6cab2b8e..9a016430478 100644
--- a/src/Nethermind/Nethermind.Network/P2P/Subprotocols/Eth/V62/Messages/BlockHeadersMessageSerializer.cs
+++ b/src/Nethermind/Nethermind.Network/P2P/Subprotocols/Eth/V62/Messages/BlockHeadersMessageSerializer.cs
@@ -9,7 +9,7 @@ namespace Nethermind.Network.P2P.Subprotocols.Eth.V62.Messages
{
public class BlockHeadersMessageSerializer : IZeroInnerMessageSerializer
{
- private HeaderDecoder _headerDecoder = new();
+ private readonly HeaderDecoder _headerDecoder = new();
public void Serialize(IByteBuffer byteBuffer, BlockHeadersMessage message)
{
diff --git a/src/Nethermind/Nethermind.Network/P2P/Subprotocols/Eth/V62/Messages/NewBlockMessageSerializer.cs b/src/Nethermind/Nethermind.Network/P2P/Subprotocols/Eth/V62/Messages/NewBlockMessageSerializer.cs
index ebccfd90825..89bce75712b 100644
--- a/src/Nethermind/Nethermind.Network/P2P/Subprotocols/Eth/V62/Messages/NewBlockMessageSerializer.cs
+++ b/src/Nethermind/Nethermind.Network/P2P/Subprotocols/Eth/V62/Messages/NewBlockMessageSerializer.cs
@@ -9,7 +9,7 @@ namespace Nethermind.Network.P2P.Subprotocols.Eth.V62.Messages
{
public class NewBlockMessageSerializer : IZeroInnerMessageSerializer
{
- private BlockDecoder _blockDecoder = new();
+ private readonly BlockDecoder _blockDecoder = new();
public void Serialize(IByteBuffer byteBuffer, NewBlockMessage message)
{
diff --git a/src/Nethermind/Nethermind.Network/P2P/Subprotocols/Eth/V62/Messages/TransactionsMessageSerializer.cs b/src/Nethermind/Nethermind.Network/P2P/Subprotocols/Eth/V62/Messages/TransactionsMessageSerializer.cs
index 87cadefb349..a3c23bbfecb 100644
--- a/src/Nethermind/Nethermind.Network/P2P/Subprotocols/Eth/V62/Messages/TransactionsMessageSerializer.cs
+++ b/src/Nethermind/Nethermind.Network/P2P/Subprotocols/Eth/V62/Messages/TransactionsMessageSerializer.cs
@@ -9,7 +9,7 @@ namespace Nethermind.Network.P2P.Subprotocols.Eth.V62.Messages
{
public class TransactionsMessageSerializer : IZeroInnerMessageSerializer
{
- private TxDecoder _decoder = new();
+ private readonly TxDecoder _decoder = new();
public void Serialize(IByteBuffer byteBuffer, TransactionsMessage message)
{
diff --git a/src/Nethermind/Nethermind.Network/PeerPool.cs b/src/Nethermind/Nethermind.Network/PeerPool.cs
index e4958a54a24..6d074f97e6a 100644
--- a/src/Nethermind/Nethermind.Network/PeerPool.cs
+++ b/src/Nethermind/Nethermind.Network/PeerPool.cs
@@ -42,8 +42,8 @@ public class PeerPool : IPeerPool
private readonly CancellationTokenSource _cancellationTokenSource = new();
- Func Statics), Peer> _createNewNodePeer;
- Func Statics), Peer> _createNewNetworkNodePeer;
+ readonly Func Statics), Peer> _createNewNodePeer;
+ readonly Func Statics), Peer> _createNewNetworkNodePeer;
public PeerPool(
INodeSource nodeSource,
diff --git a/src/Nethermind/Nethermind.Network/ProtocolValidator.cs b/src/Nethermind/Nethermind.Network/ProtocolValidator.cs
index 41e855a05d4..d34d8c71cdb 100644
--- a/src/Nethermind/Nethermind.Network/ProtocolValidator.cs
+++ b/src/Nethermind/Nethermind.Network/ProtocolValidator.cs
@@ -20,7 +20,7 @@ public class ProtocolValidator : IProtocolValidator
private readonly INodeStatsManager _nodeStatsManager;
private readonly IBlockTree _blockTree;
private readonly ForkInfo _forkInfo;
- private ILogger _logger;
+ private readonly ILogger _logger;
public ProtocolValidator(INodeStatsManager nodeStatsManager, IBlockTree blockTree, ForkInfo forkInfo, ILogManager? logManager)
{
diff --git a/src/Nethermind/Nethermind.Network/Rlpx/FrameMacProcessor.cs b/src/Nethermind/Nethermind.Network/Rlpx/FrameMacProcessor.cs
index 3c5d40f4ec6..e13301f70e7 100644
--- a/src/Nethermind/Nethermind.Network/Rlpx/FrameMacProcessor.cs
+++ b/src/Nethermind/Nethermind.Network/Rlpx/FrameMacProcessor.cs
@@ -104,10 +104,10 @@ public void AddMac(byte[] input, int offset, int length, byte[] output, int outp
}
}
- private byte[] _addMacBuffer;
- private byte[] _checkMacBuffer;
- private byte[] _ingressAesBlockBuffer;
- private byte[] _egressAesBlockBuffer;
+ private readonly byte[] _addMacBuffer;
+ private readonly byte[] _checkMacBuffer;
+ private readonly byte[] _ingressAesBlockBuffer;
+ private readonly byte[] _egressAesBlockBuffer;
public bool CheckMac(byte[] mac, bool isHeader)
{
diff --git a/src/Nethermind/Nethermind.Network/Rlpx/Handshake/HandshakeService.cs b/src/Nethermind/Nethermind.Network/Rlpx/Handshake/HandshakeService.cs
index dfc33b9e60e..f1657f241a2 100644
--- a/src/Nethermind/Nethermind.Network/Rlpx/Handshake/HandshakeService.cs
+++ b/src/Nethermind/Nethermind.Network/Rlpx/Handshake/HandshakeService.cs
@@ -18,8 +18,8 @@ namespace Nethermind.Network.Rlpx.Handshake
///
public class HandshakeService : IHandshakeService
{
- private static int MacBitsSize = 256;
- private static int MacBytesSize = MacBitsSize / 8;
+ private static readonly int MacBitsSize = 256;
+ private static readonly int MacBytesSize = MacBitsSize / 8;
private readonly IPrivateKeyGenerator _ephemeralGenerator;
private readonly ICryptoRandom _cryptoRandom;
diff --git a/src/Nethermind/Nethermind.Network/Rlpx/NettyHandshakeHandler.cs b/src/Nethermind/Nethermind.Network/Rlpx/NettyHandshakeHandler.cs
index 4a87da592f1..59869c891cd 100644
--- a/src/Nethermind/Nethermind.Network/Rlpx/NettyHandshakeHandler.cs
+++ b/src/Nethermind/Nethermind.Network/Rlpx/NettyHandshakeHandler.cs
@@ -33,7 +33,7 @@ public class NettyHandshakeHandler : SimpleChannelInboundHandler
private PublicKey RemoteId => _session.RemoteNodeId;
private readonly TaskCompletionSource