diff --git a/src/Nethermind/Nethermind.Consensus.Clique/CliqueBlockProducer.cs b/src/Nethermind/Nethermind.Consensus.Clique/CliqueBlockProducer.cs
index 3a6c85f7516..3a249540dfb 100644
--- a/src/Nethermind/Nethermind.Consensus.Clique/CliqueBlockProducer.cs
+++ b/src/Nethermind/Nethermind.Consensus.Clique/CliqueBlockProducer.cs
@@ -379,7 +379,7 @@ bool IBlockProducer.IsProducingBlocks(ulong? maxProducingInterval)
// Assemble the voting snapshot to check which votes make sense
Snapshot snapshot = _snapshotManager.GetOrCreateSnapshot(number - 1, parentHeader.Hash);
bool isEpochBlock = (ulong)number % 30000 == 0;
- if (!isEpochBlock && _proposals.Any())
+ if (!isEpochBlock && !_proposals.IsEmpty)
{
// Gather all the proposals that make sense voting on
List
addresses = new();
diff --git a/src/Nethermind/Nethermind.Core/Extensions/EnumExtensions.cs b/src/Nethermind/Nethermind.Core/Extensions/EnumExtensions.cs
index 60d090c8308..97069e9dd14 100644
--- a/src/Nethermind/Nethermind.Core/Extensions/EnumExtensions.cs
+++ b/src/Nethermind/Nethermind.Core/Extensions/EnumExtensions.cs
@@ -25,7 +25,7 @@ public static IReadOnlyList AllValuesCombinations() where T : struct, Enum
// This bit converts to int[]
IReadOnlyList values = FastEnum.GetValues();
- if (!typeof(T).GetCustomAttributes(typeof(FlagsAttribute), false).Any())
+ if (typeof(T).GetCustomAttributes(typeof(FlagsAttribute), false).Length == 0)
{
// We don't have flags so just return the result of GetValues
return values;
diff --git a/src/Nethermind/Nethermind.Evm/TransactionProcessing/TransactionProcessor.cs b/src/Nethermind/Nethermind.Evm/TransactionProcessing/TransactionProcessor.cs
index 89f5725b558..8eb05afb4be 100644
--- a/src/Nethermind/Nethermind.Evm/TransactionProcessing/TransactionProcessor.cs
+++ b/src/Nethermind/Nethermind.Evm/TransactionProcessing/TransactionProcessor.cs
@@ -195,7 +195,7 @@ protected virtual void Execute(Transaction tx, BlockExecutionContext blCtx, ITxT
}
else
{
- LogEntry[] logs = substate.Logs.Any() ? substate.Logs.ToArray() : Array.Empty();
+ LogEntry[] logs = substate.Logs.Count != 0 ? substate.Logs.ToArray() : Array.Empty();
tracer.MarkAsSuccess(env.ExecutingAccount, spentGas, substate.Output.ToArray(), logs, stateRoot);
}
}
diff --git a/src/Nethermind/Nethermind.Mev.Test/MevRpcModuleTests.TestMevRpcBlockchain.cs b/src/Nethermind/Nethermind.Mev.Test/MevRpcModuleTests.TestMevRpcBlockchain.cs
index 6824ebb1800..029c7987f93 100644
--- a/src/Nethermind/Nethermind.Mev.Test/MevRpcModuleTests.TestMevRpcBlockchain.cs
+++ b/src/Nethermind/Nethermind.Mev.Test/MevRpcModuleTests.TestMevRpcBlockchain.cs
@@ -146,7 +146,7 @@ bool BundleLimitTriggerCondition(BlockProductionEventArgs e)
return new MevBlockProducer.MevBlockProducerInfo(producer, manualTrigger, new BeneficiaryTracer());
}
- int megabundleProducerCount = _relayAddresses.Any() ? 1 : 0;
+ int megabundleProducerCount = _relayAddresses.Length != 0 ? 1 : 0;
List blockProducers =
new(_maxMergedBundles + megabundleProducerCount + 1);
diff --git a/src/Nethermind/Nethermind.Network.Discovery/DiscoveryApp.cs b/src/Nethermind/Nethermind.Network.Discovery/DiscoveryApp.cs
index a4f7a2862f0..2cf631d6e3b 100644
--- a/src/Nethermind/Nethermind.Network.Discovery/DiscoveryApp.cs
+++ b/src/Nethermind/Nethermind.Network.Discovery/DiscoveryApp.cs
@@ -227,7 +227,7 @@ private async Task OnChannelActivated(CancellationToken cancellationToken)
//Check if we were able to communicate with any trusted nodes or persisted nodes
//if so no need to replay bootstrapping, we can start discovery process
- if (_discoveryManager.GetOrAddNodeLifecycleManagers(x => x.State == NodeLifecycleState.Active).Any())
+ if (_discoveryManager.GetOrAddNodeLifecycleManagers(x => x.State == NodeLifecycleState.Active).Count != 0)
{
break;
}
@@ -347,7 +347,7 @@ private async Task StopUdpChannelAsync()
private async Task InitializeBootnodes(CancellationToken cancellationToken)
{
NetworkNode[] bootnodes = NetworkNode.ParseNodes(_discoveryConfig.Bootnodes, _logger);
- if (!bootnodes.Any())
+ if (bootnodes.Length == 0)
{
if (_logger.IsWarn) _logger.Warn("No bootnodes specified in configuration");
return true;
@@ -389,7 +389,7 @@ private async Task InitializeBootnodes(CancellationToken cancellationToken
break;
}
- if (_discoveryManager.GetOrAddNodeLifecycleManagers(x => x.State == NodeLifecycleState.Active).Any())
+ if (_discoveryManager.GetOrAddNodeLifecycleManagers(x => x.State == NodeLifecycleState.Active).Count != 0)
{
if (_logger.IsTrace)
_logger.Trace(
diff --git a/src/Nethermind/Nethermind.Network.Discovery/Messages/NeighborsMsg.cs b/src/Nethermind/Nethermind.Network.Discovery/Messages/NeighborsMsg.cs
index a3ed8aeb6b5..be3bf530887 100644
--- a/src/Nethermind/Nethermind.Network.Discovery/Messages/NeighborsMsg.cs
+++ b/src/Nethermind/Nethermind.Network.Discovery/Messages/NeighborsMsg.cs
@@ -23,7 +23,7 @@ public NeighborsMsg(PublicKey farPublicKey, long expirationTime, Node[] nodes) :
public override string ToString()
{
- return base.ToString() + $", Nodes: {(Nodes.Any() ? string.Join(",", Nodes.Select(x => x.ToString())) : "empty")}";
+ return base.ToString() + $", Nodes: {(Nodes.Length != 0 ? string.Join(",", Nodes.Select(x => x.ToString())) : "empty")}";
}
public override MsgType MsgType => MsgType.Neighbors;
diff --git a/src/Nethermind/Nethermind.Network.Discovery/Serializers/NeighborsMsgSerializer.cs b/src/Nethermind/Nethermind.Network.Discovery/Serializers/NeighborsMsgSerializer.cs
index 5898d6db002..1c79dd90e81 100644
--- a/src/Nethermind/Nethermind.Network.Discovery/Serializers/NeighborsMsgSerializer.cs
+++ b/src/Nethermind/Nethermind.Network.Discovery/Serializers/NeighborsMsgSerializer.cs
@@ -27,7 +27,7 @@ public void Serialize(IByteBuffer byteBuffer, NeighborsMsg msg)
PrepareBufferForSerialization(byteBuffer, totalLength, (byte)msg.MsgType);
NettyRlpStream stream = new(byteBuffer);
stream.StartSequence(contentLength);
- if (msg.Nodes.Any())
+ if (msg.Nodes.Length != 0)
{
stream.StartSequence(nodesContentLength);
for (int i = 0; i < msg.Nodes.Length; i++)
@@ -100,7 +100,7 @@ public int GetLength(NeighborsMsg msg, out int contentLength)
{
int nodesContentLength = 0;
int contentLength = 0;
- if (msg.Nodes.Any())
+ if (msg.Nodes.Length != 0)
{
contentLength += GetNodesLength(msg.Nodes, out nodesContentLength);
}
diff --git a/src/Nethermind/Nethermind.Network.Test/Rlpx/HobbitTests.cs b/src/Nethermind/Nethermind.Network.Test/Rlpx/HobbitTests.cs
index 5aed6df6d97..6afab427888 100644
--- a/src/Nethermind/Nethermind.Network.Test/Rlpx/HobbitTests.cs
+++ b/src/Nethermind/Nethermind.Network.Test/Rlpx/HobbitTests.cs
@@ -179,7 +179,7 @@ private Packet Run(Packet packet, StackType inbound, StackType outbound, bool fr
embeddedChannel.WriteOutbound(packet);
}
- while (embeddedChannel.OutboundMessages.Any())
+ while (embeddedChannel.OutboundMessages.Count != 0)
{
IByteBuffer encodedPacket = embeddedChannel.ReadOutbound();
embeddedChannel.WriteInbound(encodedPacket);
diff --git a/src/Nethermind/Nethermind.Network.Test/Rlpx/TestWrappers/ZeroFrameDecoderTestWrapper.cs b/src/Nethermind/Nethermind.Network.Test/Rlpx/TestWrappers/ZeroFrameDecoderTestWrapper.cs
index 5318af7db82..91894ba8f99 100644
--- a/src/Nethermind/Nethermind.Network.Test/Rlpx/TestWrappers/ZeroFrameDecoderTestWrapper.cs
+++ b/src/Nethermind/Nethermind.Network.Test/Rlpx/TestWrappers/ZeroFrameDecoderTestWrapper.cs
@@ -37,7 +37,7 @@ public IByteBuffer Decode(IByteBuffer input, bool throwOnCorruptedFrames = true)
}
}
- if (result.Any())
+ if (result.Count != 0)
{
return (IByteBuffer)result[0];
}
diff --git a/src/Nethermind/Nethermind.Network.Test/Rlpx/TestWrappers/ZeroFrameMergerTestWrapper.cs b/src/Nethermind/Nethermind.Network.Test/Rlpx/TestWrappers/ZeroFrameMergerTestWrapper.cs
index 64294640d0e..0070e1c1d0a 100644
--- a/src/Nethermind/Nethermind.Network.Test/Rlpx/TestWrappers/ZeroFrameMergerTestWrapper.cs
+++ b/src/Nethermind/Nethermind.Network.Test/Rlpx/TestWrappers/ZeroFrameMergerTestWrapper.cs
@@ -29,7 +29,7 @@ public ZeroPacket Decode(IByteBuffer input)
base.Decode(_context, input, result);
}
- if (!result.Any())
+ if (result.Count == 0)
{
return null;
}
diff --git a/src/Nethermind/Nethermind.Network/NodesLoader.cs b/src/Nethermind/Nethermind.Network/NodesLoader.cs
index 8cc51e102d8..113a5059d55 100644
--- a/src/Nethermind/Nethermind.Network/NodesLoader.cs
+++ b/src/Nethermind/Nethermind.Network/NodesLoader.cs
@@ -95,7 +95,7 @@ private void LoadPeersFromDb(List peers)
private void LoadConfigPeers(List peers, string? enodesString, Action nodeUpdate)
{
- if (enodesString is null || !enodesString.Any())
+ if (enodesString is null || enodesString.Length == 0)
{
return;
}
diff --git a/src/Nethermind/Nethermind.Network/P2P/Session.cs b/src/Nethermind/Nethermind.Network/P2P/Session.cs
index d458e73556d..3612fec6633 100644
--- a/src/Nethermind/Nethermind.Network/P2P/Session.cs
+++ b/src/Nethermind/Nethermind.Network/P2P/Session.cs
@@ -405,7 +405,7 @@ bool ShouldDisconnectStaticNode()
if (_logger.IsDebug) _logger.Debug($"{this} initiating disconnect because {disconnectReason}, details: {details}");
//Trigger disconnect on each protocol handler (if p2p is initialized it will send disconnect message to the peer)
- if (_protocols.Any())
+ if (!_protocols.IsEmpty)
{
foreach (IProtocolHandler protocolHandler in _protocols.Values)
{
diff --git a/src/Nethermind/Nethermind.Network/PeerManager.cs b/src/Nethermind/Nethermind.Network/PeerManager.cs
index 3160a223052..b61cedde97d 100644
--- a/src/Nethermind/Nethermind.Network/PeerManager.cs
+++ b/src/Nethermind/Nethermind.Network/PeerManager.cs
@@ -825,7 +825,7 @@ private void DeactivatePeerIfDisconnected(Peer peer, string reason)
private string GetIncompatibleDesc(IReadOnlyCollection incompatibleNodes)
{
- if (!incompatibleNodes.Any())
+ if (incompatibleNodes.Count == 0)
{
return "0";
}
diff --git a/src/Nethermind/Nethermind.Sockets.Test/WebSocketExtensionsTests.cs b/src/Nethermind/Nethermind.Sockets.Test/WebSocketExtensionsTests.cs
index bfdf265df78..178f8e1facb 100644
--- a/src/Nethermind/Nethermind.Sockets.Test/WebSocketExtensionsTests.cs
+++ b/src/Nethermind/Nethermind.Sockets.Test/WebSocketExtensionsTests.cs
@@ -62,7 +62,7 @@ public override Task ReceiveAsync(ArraySegment buf
}
}
- if (!_receiveResults.Any() && ReturnTaskWithFaultOnEmptyQueue)
+ if (_receiveResults.Count == 0 && ReturnTaskWithFaultOnEmptyQueue)
{
Task a = new Task(() => throw new Exception());
a.Start();
diff --git a/src/Nethermind/Nethermind.Trie.Test/TrieTests.cs b/src/Nethermind/Nethermind.Trie.Test/TrieTests.cs
index 692c71bef1c..06a8da7b749 100644
--- a/src/Nethermind/Nethermind.Trie.Test/TrieTests.cs
+++ b/src/Nethermind/Nethermind.Trie.Test/TrieTests.cs
@@ -910,7 +910,7 @@ public void Fuzz_accounts_with_reorganizations(
rootQueue.Clear();
Stack stackCopy = new();
- while (rootStack.Any())
+ while (rootStack.Count != 0)
{
stackCopy.Push(rootStack.Pop());
}
diff --git a/src/Nethermind/Nethermind.TxPool/TxPoolInfoProvider.cs b/src/Nethermind/Nethermind.TxPool/TxPoolInfoProvider.cs
index d1034581fca..d19d2c24e61 100644
--- a/src/Nethermind/Nethermind.TxPool/TxPoolInfoProvider.cs
+++ b/src/Nethermind/Nethermind.TxPool/TxPoolInfoProvider.cs
@@ -49,12 +49,12 @@ public TxPoolInfo GetInfo()
}
}
- if (pending.Any())
+ if (pending.Count != 0)
{
pendingTransactions[address] = pending;
}
- if (queued.Any())
+ if (queued.Count != 0)
{
queuedTransactions[address] = queued;
}