Skip to content
This repository has been archived by the owner on Nov 13, 2024. It is now read-only.

Commit

Permalink
7311: Add feature toggle for enabling use of the peertask system wher…
Browse files Browse the repository at this point in the history
…e available (hyperledger#7633)

Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
  • Loading branch information
Matilda-Clerke authored Sep 24, 2024
1 parent 0d63955 commit 4f07e76
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,13 @@ public void parseBlockPropagationRange(final String arg) {
description = "Snap sync enabled for BFT chains (default: ${DEFAULT-VALUE})")
private Boolean snapsyncBftEnabled = SnapSyncConfiguration.DEFAULT_SNAP_SYNC_BFT_ENABLED;

@CommandLine.Option(
names = {"--Xpeertask-system-enabled"},
hidden = true,
description =
"Temporary feature toggle to enable using the new peertask system (default: ${DEFAULT-VALUE})")
private final Boolean isPeerTaskSystemEnabled = false;

private SynchronizerOptions() {}

/**
Expand All @@ -334,6 +341,15 @@ public boolean isSnapSyncBftEnabled() {
return snapsyncBftEnabled;
}

/**
* Flag to indicate whether the peer task system should be used where available
*
* @return true if the peer task system should be used where available
*/
public boolean isPeerTaskSystemEnabled() {
return isPeerTaskSystemEnabled;
}

/**
* Create synchronizer options.
*
Expand Down Expand Up @@ -420,7 +436,7 @@ public SynchronizerConfiguration.Builder toDomainObject() {
.isSnapSyncBftEnabled(snapsyncBftEnabled)
.build());
builder.checkpointPostMergeEnabled(checkpointPostMergeSyncEnabled);

builder.isPeerTaskSystemEnabled(isPeerTaskSystemEnabled);
return builder;
}

Expand Down
1 change: 1 addition & 0 deletions besu/src/test/resources/everything_config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ Xsecp256k1-native-enabled=false
Xaltbn128-native-enabled=false
Xsnapsync-server-enabled=true
Xbonsai-full-flat-db-enabled=true
Xpeertask-system-enabled=false

# compatibility flags
compatibility-eth64-forkid-enabled=false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ public class SynchronizerConfiguration {
private final int maxTrailingPeers;
private final long worldStateMinMillisBeforeStalling;
private final long propagationManagerGetBlockTimeoutMillis;
private final boolean isPeerTaskSystemEnabled;

private SynchronizerConfiguration(
final int syncPivotDistance,
Expand All @@ -108,7 +109,8 @@ private SynchronizerConfiguration(
final int computationParallelism,
final int maxTrailingPeers,
final long propagationManagerGetBlockTimeoutMillis,
final boolean checkpointPostMergeEnabled) {
final boolean checkpointPostMergeEnabled,
final boolean isPeerTaskSystemEnabled) {
this.syncPivotDistance = syncPivotDistance;
this.fastSyncFullValidationRate = fastSyncFullValidationRate;
this.syncMinimumPeerCount = syncMinimumPeerCount;
Expand All @@ -131,6 +133,7 @@ private SynchronizerConfiguration(
this.maxTrailingPeers = maxTrailingPeers;
this.propagationManagerGetBlockTimeoutMillis = propagationManagerGetBlockTimeoutMillis;
this.checkpointPostMergeEnabled = checkpointPostMergeEnabled;
this.isPeerTaskSystemEnabled = isPeerTaskSystemEnabled;
}

public static Builder builder() {
Expand Down Expand Up @@ -256,6 +259,10 @@ public long getPropagationManagerGetBlockTimeoutMillis() {
return propagationManagerGetBlockTimeoutMillis;
}

public boolean isPeerTaskSystemEnabled() {
return isPeerTaskSystemEnabled;
}

public static class Builder {
private SyncMode syncMode = SyncMode.FULL;
private int syncMinimumPeerCount = DEFAULT_SYNC_MINIMUM_PEERS;
Expand All @@ -280,6 +287,7 @@ public static class Builder {
DEFAULT_WORLD_STATE_MAX_REQUESTS_WITHOUT_PROGRESS;
private long worldStateMinMillisBeforeStalling = DEFAULT_WORLD_STATE_MIN_MILLIS_BEFORE_STALLING;
private int worldStateTaskCacheSize = DEFAULT_WORLD_STATE_TASK_CACHE_SIZE;
private boolean isPeerTaskSystemEnabled = false;

private long propagationManagerGetBlockTimeoutMillis =
DEFAULT_PROPAGATION_MANAGER_GET_BLOCK_TIMEOUT_MILLIS;
Expand Down Expand Up @@ -406,6 +414,11 @@ public Builder checkpointPostMergeEnabled(final boolean checkpointPostMergeEnabl
return this;
}

public Builder isPeerTaskSystemEnabled(final boolean isPeerTaskSystemEnabled) {
this.isPeerTaskSystemEnabled = isPeerTaskSystemEnabled;
return this;
}

public SynchronizerConfiguration build() {
return new SynchronizerConfiguration(
syncPivotDistance,
Expand All @@ -429,7 +442,8 @@ public SynchronizerConfiguration build() {
computationParallelism,
maxTrailingPeers,
propagationManagerGetBlockTimeoutMillis,
checkpointPostMergeEnabled);
checkpointPostMergeEnabled,
isPeerTaskSystemEnabled);
}
}
}

0 comments on commit 4f07e76

Please sign in to comment.