Skip to content

Commit edef222

Browse files
authored
Slow down consensus (increase timeouts) when vertex store is close to being full (#859)
2 parents 04a9e6b + cac0fae commit edef222

20 files changed

+252
-365
lines changed

core/src/main/java/com/radixdlt/RadixNodeModule.java

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@
7676
import com.radixdlt.consensus.ProposalLimitsConfig;
7777
import com.radixdlt.consensus.bft.*;
7878
import com.radixdlt.consensus.epoch.EpochsConsensusModule;
79+
import com.radixdlt.consensus.liveness.PacemakerTimeoutCalculatorConfig;
7980
import com.radixdlt.consensus.sync.BFTSyncPatienceMillis;
8081
import com.radixdlt.consensus.vertexstore.VertexStoreConfig;
8182
import com.radixdlt.environment.*;
@@ -156,11 +157,14 @@ protected void configure() {
156157
.annotatedWith(BFTSyncPatienceMillis.class)
157158
.to(properties.get("bft.sync.patience", 200));
158159

159-
// Max timeout = (1.2^8)×3 ~= 13s
160-
bindConstant().annotatedWith(PacemakerBaseTimeoutMs.class).to(3000L);
161-
bindConstant().annotatedWith(PacemakerBackoffRate.class).to(1.2);
162-
bindConstant().annotatedWith(PacemakerMaxExponent.class).to(8);
163-
bindConstant().annotatedWith(AdditionalRoundTimeIfProposalReceivedMs.class).to(30_000L);
160+
bind(PacemakerTimeoutCalculatorConfig.class)
161+
.toInstance(PacemakerTimeoutCalculatorConfig.defaultConfig());
162+
163+
// Delayed resolution is disabled for now because we cannot create QCs on fallback vertices,
164+
// because we don't just sign the ledger header, but also the BFT header,
165+
// which captures the previous certificate chain,
166+
// and all the nodes have a different certificate chain for their fallback vertex.
167+
// TODO: consider reviving this feature or clean it up
164168
bindConstant().annotatedWith(TimeoutQuorumResolutionDelayMs.class).to(0L);
165169

166170
final var vertexStoreConfig =

core/src/main/java/com/radixdlt/api/system/routes/ConfigurationHandler.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@
7070
import com.radixdlt.api.system.generated.models.BFTConfiguration;
7171
import com.radixdlt.api.system.generated.models.MempoolConfiguration;
7272
import com.radixdlt.api.system.generated.models.SystemConfigurationResponse;
73-
import com.radixdlt.consensus.bft.PacemakerBaseTimeoutMs;
7473
import com.radixdlt.consensus.bft.Self;
74+
import com.radixdlt.consensus.liveness.PacemakerTimeoutCalculatorConfig;
7575
import com.radixdlt.consensus.sync.BFTSyncPatienceMillis;
7676
import com.radixdlt.crypto.ECDSASecp256k1PublicKey;
7777
import com.radixdlt.mempool.MempoolThrottleMs;
@@ -81,7 +81,7 @@
8181

8282
public final class ConfigurationHandler extends SystemJsonHandler<SystemConfigurationResponse> {
8383

84-
private final long pacemakerTimeout;
84+
private final PacemakerTimeoutCalculatorConfig pacemakerTimeoutCalculatorConfig;
8585
private final int bftSyncPatienceMillis;
8686
private final long mempoolThrottleMs;
8787
private final SyncRelayConfig syncRelayConfig;
@@ -93,7 +93,7 @@ public final class ConfigurationHandler extends SystemJsonHandler<SystemConfigur
9393
@Inject
9494
ConfigurationHandler(
9595
@Self ECDSASecp256k1PublicKey self,
96-
@PacemakerBaseTimeoutMs long pacemakerTimeout,
96+
PacemakerTimeoutCalculatorConfig pacemakerTimeoutCalculatorConfig,
9797
@BFTSyncPatienceMillis int bftSyncPatienceMillis,
9898
@MempoolThrottleMs long mempoolThrottleMs,
9999
SyncRelayConfig syncRelayConfig,
@@ -102,7 +102,7 @@ public final class ConfigurationHandler extends SystemJsonHandler<SystemConfigur
102102
ProtocolConfig protocolConfig) {
103103
super();
104104
this.self = self;
105-
this.pacemakerTimeout = pacemakerTimeout;
105+
this.pacemakerTimeoutCalculatorConfig = pacemakerTimeoutCalculatorConfig;
106106
this.bftSyncPatienceMillis = bftSyncPatienceMillis;
107107
this.mempoolThrottleMs = mempoolThrottleMs;
108108
this.syncRelayConfig = syncRelayConfig;
@@ -120,7 +120,7 @@ public SystemConfigurationResponse handleRequest() {
120120
.bft(
121121
new BFTConfiguration()
122122
.bftSyncPatience(bftSyncPatienceMillis)
123-
.pacemakerTimeout(pacemakerTimeout))
123+
.pacemakerTimeout(pacemakerTimeoutCalculatorConfig.baseTimeoutMs()))
124124
.mempool(new MempoolConfiguration().maxSize(0).throttle(mempoolThrottleMs))
125125
.sync(systemModelMapper.syncConfiguration(syncRelayConfig))
126126
.networking(systemModelMapper.networkingConfiguration(self, p2PConfig))

core/src/main/java/com/radixdlt/consensus/bft/AdditionalRoundTimeIfProposalReceivedMs.java

Lines changed: 0 additions & 83 deletions
This file was deleted.

core/src/main/java/com/radixdlt/consensus/bft/PacemakerBackoffRate.java

Lines changed: 0 additions & 83 deletions
This file was deleted.

core/src/main/java/com/radixdlt/consensus/bft/PacemakerMaxExponent.java

Lines changed: 0 additions & 80 deletions
This file was deleted.

core/src/main/java/com/radixdlt/consensus/epoch/EpochsConsensusModule.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,8 @@
9595
public class EpochsConsensusModule extends AbstractModule {
9696
@Override
9797
protected void configure() {
98-
bind(ExponentialPacemakerTimeoutCalculator.class).in(Scopes.SINGLETON);
99-
bind(PacemakerTimeoutCalculator.class).to(ExponentialPacemakerTimeoutCalculator.class);
98+
bind(MultiFactorPacemakerTimeoutCalculator.class).in(Scopes.SINGLETON);
99+
bind(PacemakerTimeoutCalculator.class).to(MultiFactorPacemakerTimeoutCalculator.class);
100100

101101
OptionalBinder.newOptionalBinder(
102102
binder(), EpochManager.class); // So that this is consistent with tests

0 commit comments

Comments
 (0)