Skip to content

Commit

Permalink
Revert "remove constants"
Browse files Browse the repository at this point in the history
This reverts commit b44ceab.
  • Loading branch information
StefanBratanov committed Dec 5, 2024
1 parent 78bf817 commit fff5517
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,16 @@ public int getMaxChunkSize() {
return specConfig.getMaxChunkSize();
}

@Override
public int getTtfbTimeout() {
return specConfig.getTtfbTimeout();
}

@Override
public int getRespTimeout() {
return specConfig.getRespTimeout();
}

@Override
public int getAttestationPropagationSlotRange() {
return specConfig.getAttestationPropagationSlotRange();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ public interface NetworkingSpecConfig {

int getMinEpochsForBlockRequests();

// in seconds
int getTtfbTimeout();

// in seconds
int getRespTimeout();

int getAttestationPropagationSlotRange();

// in millis
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ public class SpecConfigPhase0 implements SpecConfig {
private final int maxRequestBlocks;
private final int epochsPerSubnetSubscription;
private final int minEpochsForBlockRequests;
private final int ttfbTimeout;
private final int respTimeout;
private final int attestationPropagationSlotRange;
private final int maximumGossipClockDisparity;
private final Bytes4 messageDomainInvalidSnappy;
Expand Down Expand Up @@ -177,6 +179,8 @@ public SpecConfigPhase0(
final int maxRequestBlocks,
final int epochsPerSubnetSubscription,
final int minEpochsForBlockRequests,
final int ttfbTimeout,
final int respTimeout,
final int attestationPropagationSlotRange,
final int maximumGossipClockDisparity,
final Bytes4 messageDomainInvalidSnappy,
Expand Down Expand Up @@ -245,6 +249,8 @@ public SpecConfigPhase0(
this.maxRequestBlocks = maxRequestBlocks;
this.epochsPerSubnetSubscription = epochsPerSubnetSubscription;
this.minEpochsForBlockRequests = minEpochsForBlockRequests;
this.ttfbTimeout = ttfbTimeout;
this.respTimeout = respTimeout;
this.attestationPropagationSlotRange = attestationPropagationSlotRange;
this.maximumGossipClockDisparity = maximumGossipClockDisparity;
this.messageDomainInvalidSnappy = messageDomainInvalidSnappy;
Expand Down Expand Up @@ -579,6 +585,16 @@ public int getMinEpochsForBlockRequests() {
return minEpochsForBlockRequests;
}

@Override
public int getTtfbTimeout() {
return ttfbTimeout;
}

@Override
public int getRespTimeout() {
return respTimeout;
}

@Override
public int getAttestationPropagationSlotRange() {
return attestationPropagationSlotRange;
Expand Down Expand Up @@ -675,6 +691,8 @@ public boolean equals(final Object o) {
&& attestationSubnetCount == that.attestationSubnetCount
&& attestationSubnetExtraBits == that.attestationSubnetExtraBits
&& attestationSubnetPrefixBits == that.attestationSubnetPrefixBits
&& ttfbTimeout == that.ttfbTimeout
&& respTimeout == that.respTimeout
&& attestationPropagationSlotRange == that.attestationPropagationSlotRange
&& maximumGossipClockDisparity == that.maximumGossipClockDisparity
&& Objects.equals(eth1FollowDistance, that.eth1FollowDistance)
Expand Down Expand Up @@ -754,6 +772,8 @@ public int hashCode() {
maxChunkSize,
maxRequestBlocks,
epochsPerSubnetSubscription,
ttfbTimeout,
respTimeout,
attestationPropagationSlotRange,
maximumGossipClockDisparity,
messageDomainInvalidSnappy,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ public class SpecConfigBuilder {
private Integer maxChunkSize;
private Integer maxRequestBlocks;
private Integer epochsPerSubnetSubscription;
private Integer ttfbTimeout;
private Integer respTimeout;
private Integer attestationPropagationSlotRange;
private Integer maximumGossipClockDisparity;
private Bytes4 messageDomainInvalidSnappy;
Expand Down Expand Up @@ -203,6 +205,8 @@ public SpecConfigAndParent<SpecConfigElectra> build() {
maxRequestBlocks,
epochsPerSubnetSubscription,
minEpochsForBlockRequests,
ttfbTimeout,
respTimeout,
attestationPropagationSlotRange,
maximumGossipClockDisparity,
messageDomainInvalidSnappy,
Expand Down Expand Up @@ -275,6 +279,8 @@ private Map<String, Object> getValidationMap() {
constants.put("maxRequestBlocks", maxRequestBlocks);
constants.put("epochsPerSubnetSubscription", epochsPerSubnetSubscription);
constants.put("minEpochsForBlockRequests", minEpochsForBlockRequests);
constants.put("ttfbTimeout", ttfbTimeout);
constants.put("respTimeout", respTimeout);
constants.put("attestationPropagationSlotRange", attestationPropagationSlotRange);
constants.put("maximumGossipClockDisparity", maximumGossipClockDisparity);
constants.put("messageDomainInvalidSnappy", messageDomainInvalidSnappy);
Expand Down Expand Up @@ -645,6 +651,16 @@ public SpecConfigBuilder minEpochsForBlockRequests(final Integer minEpochsForBlo
return this;
}

public SpecConfigBuilder ttfbTimeout(final Integer ttfbTimeout) {
this.ttfbTimeout = ttfbTimeout;
return this;
}

public SpecConfigBuilder respTimeout(final Integer respTimeout) {
this.respTimeout = respTimeout;
return this;
}

public SpecConfigBuilder attestationPropagationSlotRange(
final Integer attestationPropagationSlotRange) {
this.attestationPropagationSlotRange = attestationPropagationSlotRange;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ void shouldDefaultNetworkConfigThatMovedFromConstants() throws IOException {
assertThat(specConfig.getMaxRequestBlocks()).isEqualTo(1024);
assertThat(specConfig.getEpochsPerSubnetSubscription()).isEqualTo(256);
assertThat(specConfig.getMinEpochsForBlockRequests()).isEqualTo(33024);
assertThat(specConfig.getTtfbTimeout()).isEqualTo(5);
assertThat(specConfig.getRespTimeout()).isEqualTo(10);
assertThat(specConfig.getAttestationPropagationSlotRange()).isEqualTo(32);
assertThat(specConfig.getMaximumGossipClockDisparity()).isEqualTo(500);
}
Expand Down

0 comments on commit fff5517

Please sign in to comment.