Skip to content

Commit d4fd55d

Browse files
Matilda-ClerkeWolmin
authored andcommitted
7311: Add feature toggle for enabling use of the peertask system where available (besu-eth#7633)
Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net> Signed-off-by: Wolmin <lamonos123@gmail.com>
1 parent 879aaf1 commit d4fd55d

File tree

3 files changed

+34
-3
lines changed

3 files changed

+34
-3
lines changed

besu/src/main/java/org/hyperledger/besu/cli/options/unstable/SynchronizerOptions.java

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,13 @@ public void parseBlockPropagationRange(final String arg) {
314314
description = "Snap sync enabled for BFT chains (default: ${DEFAULT-VALUE})")
315315
private Boolean snapsyncBftEnabled = SnapSyncConfiguration.DEFAULT_SNAP_SYNC_BFT_ENABLED;
316316

317+
@CommandLine.Option(
318+
names = {"--Xpeertask-system-enabled"},
319+
hidden = true,
320+
description =
321+
"Temporary feature toggle to enable using the new peertask system (default: ${DEFAULT-VALUE})")
322+
private final Boolean isPeerTaskSystemEnabled = false;
323+
317324
private SynchronizerOptions() {}
318325

319326
/**
@@ -334,6 +341,15 @@ public boolean isSnapSyncBftEnabled() {
334341
return snapsyncBftEnabled;
335342
}
336343

344+
/**
345+
* Flag to indicate whether the peer task system should be used where available
346+
*
347+
* @return true if the peer task system should be used where available
348+
*/
349+
public boolean isPeerTaskSystemEnabled() {
350+
return isPeerTaskSystemEnabled;
351+
}
352+
337353
/**
338354
* Create synchronizer options.
339355
*
@@ -420,7 +436,7 @@ public SynchronizerConfiguration.Builder toDomainObject() {
420436
.isSnapSyncBftEnabled(snapsyncBftEnabled)
421437
.build());
422438
builder.checkpointPostMergeEnabled(checkpointPostMergeSyncEnabled);
423-
439+
builder.isPeerTaskSystemEnabled(isPeerTaskSystemEnabled);
424440
return builder;
425441
}
426442

besu/src/test/resources/everything_config.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,7 @@ Xsecp256k1-native-enabled=false
226226
Xaltbn128-native-enabled=false
227227
Xsnapsync-server-enabled=true
228228
Xbonsai-full-flat-db-enabled=true
229+
Xpeertask-system-enabled=false
229230

230231
# compatibility flags
231232
compatibility-eth64-forkid-enabled=false

ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/sync/SynchronizerConfiguration.java

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ public class SynchronizerConfiguration {
8585
private final int maxTrailingPeers;
8686
private final long worldStateMinMillisBeforeStalling;
8787
private final long propagationManagerGetBlockTimeoutMillis;
88+
private final boolean isPeerTaskSystemEnabled;
8889

8990
private SynchronizerConfiguration(
9091
final int syncPivotDistance,
@@ -108,7 +109,8 @@ private SynchronizerConfiguration(
108109
final int computationParallelism,
109110
final int maxTrailingPeers,
110111
final long propagationManagerGetBlockTimeoutMillis,
111-
final boolean checkpointPostMergeEnabled) {
112+
final boolean checkpointPostMergeEnabled,
113+
final boolean isPeerTaskSystemEnabled) {
112114
this.syncPivotDistance = syncPivotDistance;
113115
this.fastSyncFullValidationRate = fastSyncFullValidationRate;
114116
this.syncMinimumPeerCount = syncMinimumPeerCount;
@@ -131,6 +133,7 @@ private SynchronizerConfiguration(
131133
this.maxTrailingPeers = maxTrailingPeers;
132134
this.propagationManagerGetBlockTimeoutMillis = propagationManagerGetBlockTimeoutMillis;
133135
this.checkpointPostMergeEnabled = checkpointPostMergeEnabled;
136+
this.isPeerTaskSystemEnabled = isPeerTaskSystemEnabled;
134137
}
135138

136139
public static Builder builder() {
@@ -256,6 +259,10 @@ public long getPropagationManagerGetBlockTimeoutMillis() {
256259
return propagationManagerGetBlockTimeoutMillis;
257260
}
258261

262+
public boolean isPeerTaskSystemEnabled() {
263+
return isPeerTaskSystemEnabled;
264+
}
265+
259266
public static class Builder {
260267
private SyncMode syncMode = SyncMode.FULL;
261268
private int syncMinimumPeerCount = DEFAULT_SYNC_MINIMUM_PEERS;
@@ -280,6 +287,7 @@ public static class Builder {
280287
DEFAULT_WORLD_STATE_MAX_REQUESTS_WITHOUT_PROGRESS;
281288
private long worldStateMinMillisBeforeStalling = DEFAULT_WORLD_STATE_MIN_MILLIS_BEFORE_STALLING;
282289
private int worldStateTaskCacheSize = DEFAULT_WORLD_STATE_TASK_CACHE_SIZE;
290+
private boolean isPeerTaskSystemEnabled = false;
283291

284292
private long propagationManagerGetBlockTimeoutMillis =
285293
DEFAULT_PROPAGATION_MANAGER_GET_BLOCK_TIMEOUT_MILLIS;
@@ -406,6 +414,11 @@ public Builder checkpointPostMergeEnabled(final boolean checkpointPostMergeEnabl
406414
return this;
407415
}
408416

417+
public Builder isPeerTaskSystemEnabled(final boolean isPeerTaskSystemEnabled) {
418+
this.isPeerTaskSystemEnabled = isPeerTaskSystemEnabled;
419+
return this;
420+
}
421+
409422
public SynchronizerConfiguration build() {
410423
return new SynchronizerConfiguration(
411424
syncPivotDistance,
@@ -429,7 +442,8 @@ public SynchronizerConfiguration build() {
429442
computationParallelism,
430443
maxTrailingPeers,
431444
propagationManagerGetBlockTimeoutMillis,
432-
checkpointPostMergeEnabled);
445+
checkpointPostMergeEnabled,
446+
isPeerTaskSystemEnabled);
433447
}
434448
}
435449
}

0 commit comments

Comments
 (0)