Skip to content

Commit

Permalink
Add missing peer types to limits (#5838)
Browse files Browse the repository at this point in the history
* Add missing peer types to limits

* Add Reth

* Flaky test
  • Loading branch information
benaadams authored Jun 20, 2023
1 parent 162d666 commit 71d71fe
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 5 deletions.
4 changes: 4 additions & 0 deletions src/Nethermind/Nethermind.Network.Stats/Model/Node.cs
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,10 @@ public static NodeClientType RecognizeClientType(string clientId)
{
return NodeClientType.Erigon;
}
else if (clientId.Contains(nameof(NodeClientType.Reth), StringComparison.OrdinalIgnoreCase))
{
return NodeClientType.Reth;
}
else if (clientId.Contains(nameof(NodeClientType.Parity), StringComparison.OrdinalIgnoreCase))
{
return NodeClientType.Parity;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@ public enum NodeClientType
OpenEthereum,
Trinity,
Erigon,
Reth,
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,7 @@ public SyncingContext PeerCountIs(long i)

public SyncingContext PeerCountEventuallyIs(long i)
{
Assert.That(() => SyncPeerPool.AllPeers.Count(), Is.EqualTo(i).After(1000, 100), "peer count");
Assert.That(() => SyncPeerPool.AllPeers.Count(), Is.EqualTo(i).After(5000, 100), "peer count");
return this;
}

Expand Down Expand Up @@ -820,7 +820,7 @@ public void Will_not_add_same_peer_twice()
.BestSuggestedBlockHasNumber(1).Stop();
}

[Test, Retry(3)]
[Test, Retry(5)]
public void Will_remove_peer_when_init_fails()
{
SyncPeerMock peerA = new("A", true, true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@ public static int MaxBodiesPerRequest(this PeerInfo peer)
NodeClientType.Parity => ParitySyncLimits.MaxBodyFetch,
NodeClientType.OpenEthereum => ParitySyncLimits.MaxBodyFetch,
NodeClientType.Trinity => GethSyncLimits.MaxBodyFetch,
NodeClientType.Erigon => GethSyncLimits.MaxBodyFetch,
NodeClientType.Reth => GethSyncLimits.MaxBodyFetch,
NodeClientType.Unknown => 32,
_ => throw new ArgumentOutOfRangeException()
_ => throw new ArgumentOutOfRangeException(nameof(peer.PeerClientType), peer.PeerClientType, null)
};
}

Expand All @@ -34,8 +36,11 @@ public static int MaxReceiptsPerRequest(this PeerInfo peer)
NodeClientType.Nethermind => NethermindSyncLimits.MaxReceiptFetch,
NodeClientType.Parity => ParitySyncLimits.MaxReceiptFetch,
NodeClientType.OpenEthereum => ParitySyncLimits.MaxReceiptFetch,
NodeClientType.Trinity => GethSyncLimits.MaxReceiptFetch,
NodeClientType.Erigon => GethSyncLimits.MaxReceiptFetch,
NodeClientType.Reth => GethSyncLimits.MaxReceiptFetch,
NodeClientType.Unknown => 128,
_ => throw new ArgumentOutOfRangeException()
_ => throw new ArgumentOutOfRangeException(nameof(peer.PeerClientType), peer.PeerClientType, null)
};
}

Expand All @@ -48,8 +53,11 @@ public static int MaxHeadersPerRequest(this PeerInfo peer)
NodeClientType.Nethermind => NethermindSyncLimits.MaxHeaderFetch,
NodeClientType.Parity => ParitySyncLimits.MaxHeaderFetch,
NodeClientType.OpenEthereum => ParitySyncLimits.MaxHeaderFetch,
NodeClientType.Trinity => GethSyncLimits.MaxHeaderFetch,
NodeClientType.Erigon => GethSyncLimits.MaxHeaderFetch,
NodeClientType.Reth => GethSyncLimits.MaxHeaderFetch,
NodeClientType.Unknown => 192,
_ => throw new ArgumentOutOfRangeException()
_ => throw new ArgumentOutOfRangeException(nameof(peer.PeerClientType), peer.PeerClientType, null)
};
}
}
Expand Down

0 comments on commit 71d71fe

Please sign in to comment.