Skip to content

Commit

Permalink
Resolve merge issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Nashatyrev committed Oct 15, 2024
1 parent eba5f2a commit 95708f9
Showing 1 changed file with 12 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
import java.util.stream.Collectors;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.tuweni.bytes.Bytes32;
import tech.pegasys.teku.infrastructure.unsigned.UInt64;
import tech.pegasys.teku.spec.Spec;
import tech.pegasys.teku.spec.SpecMilestone;
Expand Down Expand Up @@ -57,7 +56,7 @@ public class GossipForkManager {
private static final Logger LOG = LogManager.getLogger();
private static final int EPOCHS_PRIOR_TO_FORK_TO_ACTIVATE = 2;
private final Spec spec;
private final Bytes32 genesisValidatorsRoot;
private final RecentChainData recentChainData;
private final NavigableMap<UInt64, GossipForkSubscriptions> forksByActivationEpoch;
private final Set<GossipForkSubscriptions> activeSubscriptions = new HashSet<>();
private final IntSet currentAttestationSubnets = new IntOpenHashSet();
Expand All @@ -68,13 +67,12 @@ public class GossipForkManager {

private GossipForkManager(
final Spec spec,
final Bytes32 genesisValidatorsRoot,
final boolean isHeadOptimistic,
final RecentChainData recentChainData,
final NavigableMap<UInt64, GossipForkSubscriptions> forksByActivationEpoch) {
this.spec = spec;
this.genesisValidatorsRoot = genesisValidatorsRoot;
this.isHeadOptimistic = isHeadOptimistic;
this.recentChainData = recentChainData;
this.forksByActivationEpoch = forksByActivationEpoch;
this.isHeadOptimistic = recentChainData.isChainHeadOptimistic();
}

public static GossipForkManager.Builder builder() {
Expand Down Expand Up @@ -150,7 +148,10 @@ public synchronized void onOptimisticHeadChanged(final boolean isHeadOptimistic)
activeSubscriptions.forEach(GossipForkSubscriptions::stopGossipForOptimisticSync);
} else {
activeSubscriptions.forEach(
subscriptions -> subscriptions.startGossip(genesisValidatorsRoot, false));
subscriptions ->
subscriptions.startGossip(
recentChainData.getGenesisData().orElseThrow().getGenesisValidatorsRoot(),
false));
}
}

Expand Down Expand Up @@ -279,7 +280,9 @@ private boolean isActive(final GossipForkSubscriptions subscriptions) {

private void startSubscriptions(final GossipForkSubscriptions subscription) {
if (activeSubscriptions.add(subscription)) {
subscription.startGossip(genesisValidatorsRoot, isHeadOptimistic);
subscription.startGossip(
recentChainData.getGenesisData().orElseThrow().getGenesisValidatorsRoot(),
isHeadOptimistic);
currentAttestationSubnets.forEach(subscription::subscribeToAttestationSubnetId);
currentSyncCommitteeSubnets.forEach(subscription::subscribeToSyncCommitteeSubnet);
}
Expand Down Expand Up @@ -330,11 +333,7 @@ public GossipForkManager build() {
checkNotNull(spec, "Must supply spec");
checkNotNull(recentChainData, "Must supply recentChainData");
checkState(!forksByActivationEpoch.isEmpty(), "Must specify at least one fork");
return new GossipForkManager(
spec,
recentChainData.getGenesisData().orElseThrow().getGenesisValidatorsRoot(),
recentChainData.isChainHeadOptimistic(),
forksByActivationEpoch);
return new GossipForkManager(spec, recentChainData, forksByActivationEpoch);
}
}
}

0 comments on commit 95708f9

Please sign in to comment.