Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions packages/dashmate/configs/defaults/getBaseConfigFactory.js
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,9 @@ export default function getBaseConfigFactory() {
gossipSleepDuration: '100ms',
queryMaj23SleepDuration: '2s',
},
verificationRateLimit: 300,
peerVoteRateLimit: 600,
peerDataRateLimit: 500,
unsafeOverride: {
propose: {
timeout: null,
Expand Down
30 changes: 30 additions & 0 deletions packages/dashmate/configs/getConfigFileMigrationsFactory.js
Original file line number Diff line number Diff line change
Expand Up @@ -1701,6 +1701,36 @@ export default function getConfigFileMigrationsFactory(homeDir, defaultConfigs)

return configFile;
},
'4.2.0': (configFile) => {
// Backfill the Tenderdash consensus rate-limit defaults so a regenerated
// config.toml carries the new [consensus] keys. The schema now requires
// them, so an existing config that predates them would fail validation
// until it gains the values.
//
// Keyed at the release that ships these keys: the runner skips a
// migration whose version equals the operator's current version, so a
// key equal to the version an operator already runs never fires and only
// configs written before this release are backfilled.
Object.entries(configFile.configs)
.forEach(([name, options]) => {
const defaultConfig = getDefaultConfigByNameOrGroup(name, options.group);
const consensus = options.platform?.drive?.tenderdash?.consensus;
if (!consensus) {
return;
}
if (typeof consensus.verificationRateLimit === 'undefined') {
consensus.verificationRateLimit = defaultConfig.getStored('platform.drive.tenderdash.consensus.verificationRateLimit');
}
if (typeof consensus.peerVoteRateLimit === 'undefined') {
consensus.peerVoteRateLimit = defaultConfig.getStored('platform.drive.tenderdash.consensus.peerVoteRateLimit');
}
if (typeof consensus.peerDataRateLimit === 'undefined') {
consensus.peerDataRateLimit = defaultConfig.getStored('platform.drive.tenderdash.consensus.peerDataRateLimit');
}
});

return configFile;
},
};
}

Expand Down
14 changes: 13 additions & 1 deletion packages/dashmate/src/config/configJsonSchema.js
Original file line number Diff line number Diff line change
Expand Up @@ -1211,6 +1211,18 @@ export default {
additionalProperties: false,
required: ['gossipSleepDuration', 'queryMaj23SleepDuration'],
},
verificationRateLimit: {
type: 'number',
minimum: 0,
},
peerVoteRateLimit: {
type: 'number',
minimum: 0,
},
peerDataRateLimit: {
type: 'number',
minimum: 0,
},
unsafeOverride: {
type: 'object',
properties: {
Expand Down Expand Up @@ -1259,7 +1271,7 @@ export default {
},
},
additionalProperties: false,
required: ['createEmptyBlocks', 'createEmptyBlocksInterval', 'peer', 'unsafeOverride'],
required: ['createEmptyBlocks', 'createEmptyBlocksInterval', 'peer', 'unsafeOverride', 'verificationRateLimit', 'peerVoteRateLimit', 'peerDataRateLimit'],
},
log: {
type: 'object',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,13 @@ create-empty-blocks-interval = "{{= it.platform.drive.tenderdash.consensus.creat
peer-gossip-sleep-duration = "{{= it.platform.drive.tenderdash.consensus.peer.gossipSleepDuration }}"
peer-query-maj23-sleep-duration = "{{= it.platform.drive.tenderdash.consensus.peer.queryMaj23SleepDuration }}"

# Per-peer vote-channel budget (verification-work/sec). 0 disables.
peer-vote-rate-limit = {{= it.platform.drive.tenderdash.consensus.peerVoteRateLimit }}
# Node-wide BLS verification budget (ops/sec). Must be 0 or >= 33.
verification-rate-limit = {{= it.platform.drive.tenderdash.consensus.verificationRateLimit }}
# Per-peer data-channel budget (verification-work/sec). 0 disables.
peer-data-rate-limit = {{= it.platform.drive.tenderdash.consensus.peerDataRateLimit }}

### Unsafe Timeout Overrides ###

# These fields provide temporary overrides for the Timeout consensus parameters.
Expand Down
Loading