Release 23.10.3 (#6237)

* revert (#6232)

Signed-off-by: stefan.pingel@consensys.net <stefan.pingel@consensys.net>
Signed-off-by: Justin Florentine <justin+github@florentine.us>

* uprev to RC2

Signed-off-by: Justin Florentine <justin+github@florentine.us>

* Update Gradle verification metadata (#6236)

Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>

---------

Signed-off-by: stefan.pingel@consensys.net <stefan.pingel@consensys.net>
Signed-off-by: Justin Florentine <justin+github@florentine.us>
Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
Co-authored-by: Stefan Pingel <16143240+pinges@users.noreply.github.com>
Co-authored-by: Fabio Di Fabio <fabio.difabio@consensys.net>
pull/6333/head
Justin Florentine 12 months ago committed by GitHub
parent 9e988c6111
commit b0cda3c316
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/manager/EthPeers.java
  2. 50
      ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/manager/PeerReputation.java
  3. 9
      ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/manager/PeerReputationTest.java
  4. 2
      gradle.properties
  5. 10
      gradle/verification-metadata.xml

@ -197,7 +197,7 @@ public class EthPeers {
disconnectCallbacks.forEach(callback -> callback.onDisconnect(peer));
peer.handleDisconnect();
abortPendingRequestsAssignedToDisconnectedPeers();
LOG.debug("Disconnected EthPeer {}...", peer.getShortNodeId());
LOG.debug("Disconnected EthPeer {}", peer.getShortNodeId());
LOG.trace("Disconnected EthPeer {}", peer);
}
}
@ -391,7 +391,7 @@ public class EthPeers {
peer -> {
LOG.atDebug()
.setMessage(
"disconnecting peer {}... Waiting for better peers. Current {} of max {}")
"disconnecting peer {}. Waiting for better peers. Current {} of max {}")
.addArgument(peer::getShortNodeId)
.addArgument(this::peerCount)
.addArgument(this::getMaxPeers)

@ -34,13 +34,10 @@ import org.slf4j.LoggerFactory;
public class PeerReputation implements Comparable<PeerReputation> {
static final long USELESS_RESPONSE_WINDOW_IN_MILLIS =
TimeUnit.MILLISECONDS.convert(1, TimeUnit.MINUTES);
static final int DEFAULT_MAX_SCORE = 200;
// how much above the initial score you need to be to not get disconnected for timeouts/useless
// responses
private final int hasBeenUsefulThreshold;
static final int DEFAULT_MAX_SCORE = 150;
static final int DEFAULT_INITIAL_SCORE = 100;
private static final Logger LOG = LoggerFactory.getLogger(PeerReputation.class);
private static final int TIMEOUT_THRESHOLD = 5;
private static final int TIMEOUT_THRESHOLD = 3;
private static final int USELESS_RESPONSE_THRESHOLD = 5;
private final ConcurrentMap<Integer, AtomicInteger> timeoutCountByRequestType =
@ -48,7 +45,8 @@ public class PeerReputation implements Comparable<PeerReputation> {
private final Queue<Long> uselessResponseTimes = new ConcurrentLinkedQueue<>();
private static final int SMALL_ADJUSTMENT = 1;
private static final int LARGE_ADJUSTMENT = 5;
private static final int LARGE_ADJUSTMENT = 10;
private int score;
private final int maxScore;
@ -61,37 +59,22 @@ public class PeerReputation implements Comparable<PeerReputation> {
checkArgument(
initialScore <= maxScore, "Initial score must be less than or equal to max score");
this.maxScore = maxScore;
this.hasBeenUsefulThreshold = Math.min(maxScore, initialScore + 10);
this.score = initialScore;
}
public Optional<DisconnectReason> recordRequestTimeout(final int requestCode) {
final int newTimeoutCount = getOrCreateTimeoutCount(requestCode).incrementAndGet();
if (newTimeoutCount >= TIMEOUT_THRESHOLD) {
score -= LARGE_ADJUSTMENT;
// don't trigger disconnect if this peer has a sufficiently high reputation score
if (peerHasNotBeenUseful()) {
LOG.debug(
"Disconnection triggered by {} repeated timeouts for requestCode {}, peer score {}",
newTimeoutCount,
requestCode,
score);
return Optional.of(DisconnectReason.TIMEOUT);
}
LOG.trace(
"Not triggering disconnect for {} repeated timeouts for requestCode {} because peer has high score {}",
LOG.debug(
"Disconnection triggered by {} repeated timeouts for requestCode {}",
newTimeoutCount,
requestCode,
score);
requestCode);
score -= LARGE_ADJUSTMENT;
return Optional.of(DisconnectReason.TIMEOUT);
} else {
score -= SMALL_ADJUSTMENT;
return Optional.empty();
}
return Optional.empty();
}
private boolean peerHasNotBeenUseful() {
return score < hasBeenUsefulThreshold;
}
public void resetTimeoutCount(final int requestCode) {
@ -113,19 +96,12 @@ public class PeerReputation implements Comparable<PeerReputation> {
}
if (uselessResponseTimes.size() >= USELESS_RESPONSE_THRESHOLD) {
score -= LARGE_ADJUSTMENT;
// don't trigger disconnect if this peer has a sufficiently high reputation score
if (peerHasNotBeenUseful()) {
LOG.debug(
"Disconnection triggered by exceeding useless response threshold, score {}", score);
return Optional.of(DisconnectReason.USELESS_PEER);
}
LOG.trace(
"Not triggering disconnect for exceeding useless response threshold because peer has high score {}",
score);
LOG.debug("Disconnection triggered by exceeding useless response threshold");
return Optional.of(DisconnectReason.USELESS_PEER);
} else {
score -= SMALL_ADJUSTMENT;
return Optional.empty();
}
return Optional.empty();
}
public void recordUsefulResponse() {

@ -36,8 +36,6 @@ public class PeerReputationTest {
@Test
public void shouldOnlyDisconnectWhenTimeoutLimitReached() {
assertThat(reputation.recordRequestTimeout(EthPV62.GET_BLOCK_HEADERS)).isEmpty();
assertThat(reputation.recordRequestTimeout(EthPV62.GET_BLOCK_HEADERS)).isEmpty();
assertThat(reputation.recordRequestTimeout(EthPV62.GET_BLOCK_HEADERS)).isEmpty();
assertThat(reputation.recordRequestTimeout(EthPV62.GET_BLOCK_HEADERS)).isEmpty();
assertThat(reputation.recordRequestTimeout(EthPV62.GET_BLOCK_HEADERS)).contains(TIMEOUT);
@ -47,11 +45,6 @@ public class PeerReputationTest {
public void shouldTrackTimeoutsSeparatelyForDifferentRequestTypes() {
assertThat(reputation.recordRequestTimeout(EthPV62.GET_BLOCK_HEADERS)).isEmpty();
assertThat(reputation.recordRequestTimeout(EthPV62.GET_BLOCK_HEADERS)).isEmpty();
assertThat(reputation.recordRequestTimeout(EthPV62.GET_BLOCK_HEADERS)).isEmpty();
assertThat(reputation.recordRequestTimeout(EthPV62.GET_BLOCK_HEADERS)).isEmpty();
assertThat(reputation.recordRequestTimeout(EthPV62.GET_BLOCK_BODIES)).isEmpty();
assertThat(reputation.recordRequestTimeout(EthPV62.GET_BLOCK_BODIES)).isEmpty();
assertThat(reputation.recordRequestTimeout(EthPV62.GET_BLOCK_BODIES)).isEmpty();
assertThat(reputation.recordRequestTimeout(EthPV62.GET_BLOCK_BODIES)).isEmpty();
@ -64,8 +57,6 @@ public class PeerReputationTest {
assertThat(reputation.recordRequestTimeout(EthPV62.GET_BLOCK_HEADERS)).isEmpty();
assertThat(reputation.recordRequestTimeout(EthPV62.GET_BLOCK_HEADERS)).isEmpty();
assertThat(reputation.recordRequestTimeout(EthPV62.GET_BLOCK_BODIES)).isEmpty();
assertThat(reputation.recordRequestTimeout(EthPV62.GET_BLOCK_BODIES)).isEmpty();
assertThat(reputation.recordRequestTimeout(EthPV62.GET_BLOCK_BODIES)).isEmpty();
assertThat(reputation.recordRequestTimeout(EthPV62.GET_BLOCK_BODIES)).isEmpty();

@ -1,4 +1,4 @@
version=23.10.3-RC1
version=23.10.3-RC2
org.gradle.welcome=never
# Set exports/opens flags required by Google Java Format and ErrorProne plugins. (JEP-396)

@ -3989,6 +3989,11 @@
<sha256 value="5f7e01a94adbd52546c0d03af525697197165e36b73d914c6a05e3aab8905e6e" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="org.eclipse.platform" name="org.eclipse.core.expressions" version="3.9.200">
<artifact name="org.eclipse.core.expressions-3.9.200.pom">
<sha256 value="74e5f0e9f0d7fc442396ca959e738d1ad9b622e945ad3cd9a323bb8cdfea9826" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="org.eclipse.platform" name="org.eclipse.core.filesystem" version="1.9.100">
<artifact name="org.eclipse.core.filesystem-1.9.100.jar">
<sha256 value="36e802c4d9a2c864e7d6b22b8d06f59927d113475ea04b3fd9bf6312d5a97ff6" origin="Generated by Gradle"/>
@ -4082,6 +4087,11 @@
<sha256 value="e6a79e8bc53281ecbe3433a52c713b75ba8fa06e03b9f279b027f68ba078085e" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="org.eclipse.platform" name="org.eclipse.swt" version="3.124.200">
<artifact name="org.eclipse.swt-3.124.200.pom">
<sha256 value="4d87cb2d94dab15fba1564ae574b60988939c76176d86882847332dcea6a3f77" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="org.eclipse.platform" name="org.eclipse.text" version="3.12.0">
<artifact name="org.eclipse.text-3.12.0.jar">
<sha256 value="457c1f8af07e870acce65130a2d9aa1e0fd95c92a7667bbd2db5bf7f9f19dd31" origin="Generated by Gradle"/>

Loading…
Cancel
Save