feat(dashmate): expose Tenderdash consensus DoS rate-limit knobs - #4274
Draft
shumkov wants to merge 1 commit into
Draft
feat(dashmate): expose Tenderdash consensus DoS rate-limit knobs#4274shumkov wants to merge 1 commit into
shumkov wants to merge 1 commit into
Conversation
Plumb three Tenderdash [consensus] rate-limit config keys through dashmate so operators can override them from dashmate config: - verification-rate-limit (verificationRateLimit, default 300) - peer-vote-rate-limit (peerVoteRateLimit, default 600) - peer-data-rate-limit (peerDataRateLimit, default 500) Changes: - config.toml.dot: emit the three keys as bare numbers in [consensus] - getBaseConfigFactory.js: add the three defaults (300/600/500) - configJsonSchema.js: add three number properties (minimum 0) and extend the consensus required array (consensus is additionalProperties:false) - getConfigFileMigrationsFactory.js: backfill migration so existing configs gain the now-required keys These keys are absent today; a Tenderdash node with the keys omitted falls back to its compiled-in defaults, so this is preparation for later limit tuning, not required for a node to run. NOTE: the migration is keyed at 4.2.0 as a placeholder for the release that ships this change. It must be set to the actual shipping dashmate version before release. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Contributor
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Exposes three Tenderdash
[consensus]rate-limit knobs through dashmate so operators can override them from dashmate config. The keys map:config.toml)verification-rate-limitverificationRateLimit300peer-vote-rate-limitpeerVoteRateLimit600peer-data-rate-limitpeerDataRateLimit500These are node-wide / per-peer verification-work budgets used by Tenderdash's consensus DoS-hardening. They did not exist in dashmate before this PR (0 hits for all spellings).
Why (this is prep, not urgent)
A Tenderdash node with these keys omitted falls back to its compiled-in defaults (
300 / 600 / 500), because the generatedconfig.tomlis unmarshalled on top of the default config struct. So dashmate-managed nodes already run the correct defaults today, and nothing here is required for a node or a devnet to run. This PR is preparation so the limits can be tuned (e.g. limit sweeps) later without hand-editingconfig.toml.Changes (4 files, all in
packages/dashmate)templates/platform/drive/tenderdash/config.toml.dot— emit the three keys as bare numbers (they are floats) in the[consensus]block.configs/defaults/getBaseConfigFactory.js— add the three defaults (300 / 600 / 500) to theconsensusobject.src/config/configJsonSchema.js— add threenumberproperties (minimum: 0) and extend the consensusrequiredarray. The consensus object isadditionalProperties: false, so both the properties and therequirededit are mandatory or a config carrying the keys fails validation.configs/getConfigFileMigrationsFactory.js— a backfill migration so an existing (pre-this-release) config gains the now-required keys and keeps validating after upgrade.Schema enforces only
minimum: 0. The stricter "0or>= 33" rule forverificationRateLimitis left to Tenderdash's ownValidateBasicat node start, consistent with how dashmate treats other Tenderdash-validated numbers.The migration is keyed at
4.2.0as a placeholder for the release that will actually ship this change.getConfigFormatVersionmakes the newest migration key the effective config-format version, so this key both drives the backfill and stamps the format. Set this key to the real shipping dashmate version before merge/release. Currentpackages/dashmateversion is4.1.0.Verification
Full monorepo
yarn install(Rust/wasm native builds) was not run in this environment. Instead the JS was checked directly:node --checkon all three edited.jsfiles — pass.getBaseConfigFactory()→new Config('base', options)validates the defaults against the schema (Ajv) on construction — pass (proves the defaults ⇄ schemarequired/additionalProperties:falseedits are consistent).Config.set(re-validates) — result matches defaults300 / 600 / 500— pass.verificationRateLimitis rejected by the schema with arequirederror — pass (confirms therequirededit actually bites; the positive check is not tautological).Recommend running
packages/dashmateyarn test:unitin CI — in particulartest/unit/config/configFile/migrateConfigFileFactory.spec.js, which migrates an old config fixture to the latest and asserts deep-equality with the freshly built default config (exercises the migration + defaults together).Dependency order
This is the top of a three-repo chain (prep only):
platform (this PR) → a dashmate release carrying these keys →
dash-network-deployansible plumbing → per-networkdash-network-configsoverride.The downstream
dash-network-deploychange is BLOCKED-ON a dashmate release that contains this PR (itsdashmate_versionmust be bumped to that release). None of this blocks a first devnet, which runs the built-in defaults.🤖 Generated with Claude Code