Skip to content

Commit

Permalink
disable flood publish by default
Browse files Browse the repository at this point in the history
  • Loading branch information
tbenr committed Sep 30, 2024
1 parent 85793dc commit 2086449
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 13 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
- Implemented [PostAggregateAndProofsV2](https://ethereum.github.io/beacon-APIs/?urls.primaryName=dev#/Validator/publishAggregateAndProofsV2) (adding support for Electra)
- Added support for [Ephemery Testnet](https://github.com/ephemery.dev) `--network=ephemery`
- Updated bootnodes for Holesky network
- Added new `--p2p-flood-publish-enabled` parameter to control whenever flood publishing behaviour is enabled (applies to all subnets). Previous teku versions always had this behaviour enabled. Default is `true`.
- Disabled flood publish behaviour on all p2p subnets. New `--p2p-flood-publish-enabled` parameter can be used to re-enable it, restoring previous behaviour.
- Add a fix for [CVE-2024-7254](https://avd.aquasec.com/nvd/2024/cve-2024-7254/)
- Updated LUKSO configuration with Deneb fork scheduled for epoch 123075 (November 20, 2024, 16:20:00 UTC)
- Support for `IDONTWANT` libp2p protocol messages
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
package tech.pegasys.teku.networking.eth2;

import static com.google.common.base.Preconditions.checkNotNull;
import static tech.pegasys.teku.networking.p2p.gossip.config.GossipConfig.DEFAULT_FLOOD_PUBLISH_ENABLED;

import java.time.Duration;
import java.util.OptionalInt;
Expand All @@ -23,7 +24,6 @@
import tech.pegasys.teku.networking.eth2.gossip.config.GossipConfigurator;
import tech.pegasys.teku.networking.eth2.gossip.encoding.GossipEncoding;
import tech.pegasys.teku.networking.p2p.discovery.DiscoveryConfig;
import tech.pegasys.teku.networking.p2p.gossip.config.GossipConfig;
import tech.pegasys.teku.networking.p2p.network.config.NetworkConfig;
import tech.pegasys.teku.spec.Spec;
import tech.pegasys.teku.spec.config.NetworkingSpecConfig;
Expand Down Expand Up @@ -175,7 +175,7 @@ public static class Builder {
private boolean batchVerifyStrictThreadLimitEnabled =
DEFAULT_BATCH_VERIFY_STRICT_THREAD_LIMIT_ENABLED;
private boolean allTopicsFilterEnabled = DEFAULT_PEER_ALL_TOPIC_FILTER_ENABLED;
private Boolean isFloodPublishEnabled = GossipConfig.DEFAULT_FLOOD_PUBLISH_ENABLED;
private boolean isFloodPublishEnabled = DEFAULT_FLOOD_PUBLISH_ENABLED;

private Builder() {}

Expand Down Expand Up @@ -287,8 +287,7 @@ public Builder peerRequestLimit(final Integer peerRequestLimit) {
return this;
}

public Builder isFloodPublishEnabled(final Boolean floodPublishEnabled) {
checkNotNull(floodPublishEnabled);
public Builder isFloodPublishEnabled(final boolean floodPublishEnabled) {
this.isFloodPublishEnabled = floodPublishEnabled;
return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public class GossipConfig {
// After EIP-7045, attestations are valid for up to 2 full epochs, so TTL is 65
// slots 1115 * HEARTBEAT = 1115 * 0.7 / 12 = 65.125
static final Duration DEFAULT_SEEN_TTL = DEFAULT_HEARTBEAT_INTERVAL.multipliedBy(1115);
public static final Boolean DEFAULT_FLOOD_PUBLISH_ENABLED = Boolean.TRUE;
public static final Boolean DEFAULT_FLOOD_PUBLISH_ENABLED = false;

private final int d;
private final int dLow;
Expand All @@ -47,7 +47,7 @@ public class GossipConfig {
private final int history;
private final Duration heartbeatInterval;
private final Duration seenTTL;
private final Boolean floodPublishEnabled;
private final boolean floodPublishEnabled;
private final GossipScoringConfig scoringConfig;

private GossipConfig(
Expand All @@ -60,7 +60,7 @@ private GossipConfig(
final int history,
final Duration heartbeatInterval,
final Duration seenTTL,
final Boolean floodPublishEnabled,
final boolean floodPublishEnabled,
final GossipScoringConfig scoringConfig) {
this.d = d;
this.dLow = dLow;
Expand Down Expand Up @@ -139,7 +139,7 @@ public static class Builder {
private Integer history = DEFAULT_HISTORY;
private Duration heartbeatInterval = DEFAULT_HEARTBEAT_INTERVAL;
private Duration seenTTL = DEFAULT_SEEN_TTL;
private Boolean floodPublishEnabled = DEFAULT_FLOOD_PUBLISH_ENABLED;
private boolean floodPublishEnabled = DEFAULT_FLOOD_PUBLISH_ENABLED;

private Builder() {}

Expand Down Expand Up @@ -227,7 +227,7 @@ public Builder seenTTL(final Duration seenTTL) {
return this;
}

public Builder floodPublishEnabled(final Boolean floodPublishEnabled) {
public Builder floodPublishEnabled(final boolean floodPublishEnabled) {
this.floodPublishEnabled = floodPublishEnabled;
return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -340,9 +340,8 @@ public void allSubnetsShouldNotOverrideQueuesIfExplicitlySet() {
}

@Test
public void floodPublishEnabled_isSetCorrectly() {
final TekuConfiguration config =
getTekuConfigurationFromArguments("--p2p-flood-publish-enabled");
public void floodPublishEnabled_defaultIsSetCorrectly() {
final TekuConfiguration config = getTekuConfigurationFromArguments();
assertThat(config.network().getGossipConfig().isFloodPublishEnabled())
.isEqualTo(DEFAULT_FLOOD_PUBLISH_ENABLED);
}
Expand Down

0 comments on commit 2086449

Please sign in to comment.