From a95b26ddf4b4b91d522278719ad5f67e349a24c2 Mon Sep 17 00:00:00 2001 From: Quantum Explorer Date: Fri, 9 Oct 2026 05:56:25 +0200 Subject: [PATCH] fix(dashmate): reload the local quorum list every second The quorum list service answers from a copy of Core's quorum lists that it reloads every 60 seconds (since quorum-list-server 0.7.0, which the floating `latest` image moved to on 2026-09-23; 0.6.0 read Core on every request). Platform signs with a newly formed quorum seconds after Core mines it, so for up to a minute the service does not list the quorum every proof is signed with. The test suite's proof verifier takes its keys from this service, and any transition it verifies in that window fails with "Quorum not found in cache"; the SDK then blames and bans every node in turn. The CI local network snapshot made by the 5.0.0-beta.3 bump ends at the block a platform quorum DKG starts at, so that quorum activates near the end of every Test Suite run and the window hit identity creation, an identity top-up and a DPNS hook deterministically. New option platform.quorumList.cacheTtlSeconds, passed to the service as QUORUM_CACHE_TTL_SECONDS: 1 on the local preset, 60 (the service default) everywhere else. The 5.0.0-beta.4 migration adds it to existing configs by network and keeps a value already set. Co-Authored-By: Claude Opus 5.5 --- .../configs/defaults/getBaseConfigFactory.js | 4 +++ .../configs/defaults/getLocalConfigFactory.js | 5 ++++ .../configs/getConfigFileMigrationsFactory.js | 15 ++++++++++ packages/dashmate/docker-compose.yml | 1 + .../dashmate/docs/services/quorum_list.md | 1 + .../dashmate/src/config/configJsonSchema.js | 7 ++++- .../migrateConfigFileFactory.spec.js | 30 +++++++++++++++++++ 7 files changed, 62 insertions(+), 1 deletion(-) diff --git a/packages/dashmate/configs/defaults/getBaseConfigFactory.js b/packages/dashmate/configs/defaults/getBaseConfigFactory.js index 3722703b6fc..ff1b3cc4a77 100644 --- a/packages/dashmate/configs/defaults/getBaseConfigFactory.js +++ b/packages/dashmate/configs/defaults/getBaseConfigFactory.js @@ -190,6 +190,10 @@ export default function getBaseConfigFactory() { port: 2444, }, previousBlocksOffset: 8, + // How often the service reloads the quorum lists from Core. It answers + // requests from that copy only, so a quorum formed since the last reload + // is missing from its answers until the next one. + cacheTtlSeconds: 60, versionCheckHost: '', addressHostOverride: '', }, diff --git a/packages/dashmate/configs/defaults/getLocalConfigFactory.js b/packages/dashmate/configs/defaults/getLocalConfigFactory.js index 3ce6adc4851..ac91c0224fc 100644 --- a/packages/dashmate/configs/defaults/getLocalConfigFactory.js +++ b/packages/dashmate/configs/defaults/getLocalConfigFactory.js @@ -57,6 +57,11 @@ export default function getLocalConfigFactory(getBaseConfig) { api: { port: 22444, }, + // Platform signs with a new quorum seconds after Core mines it. With the + // base 60 s reload, SDKs that take keys from this service (the test suite + // among them) fail to verify every proof signed in between. Releases of + // the service before 0.7.0 read Core on every request. + cacheTtlSeconds: 1, }, gateway: { ssl: { diff --git a/packages/dashmate/configs/getConfigFileMigrationsFactory.js b/packages/dashmate/configs/getConfigFileMigrationsFactory.js index bba15f5f96c..8a818a54793 100644 --- a/packages/dashmate/configs/getConfigFileMigrationsFactory.js +++ b/packages/dashmate/configs/getConfigFileMigrationsFactory.js @@ -1791,6 +1791,21 @@ export default function getConfigFileMigrationsFactory(homeDir, defaultConfigs) return configFile; }, + '5.0.0-beta.4': (configFile) => { + Object.entries(configFile.configs) + .forEach(([, options]) => { + // The quorum list service reloads from Core on this interval and answers + // from that copy only. Local networks take the short interval of the local + // preset; every other network keeps the service's own 60 s. + const quorumList = options.platform?.quorumList; + if (quorumList && quorumList.cacheTtlSeconds === undefined) { + quorumList.cacheTtlSeconds = getDefaultConfigByNetwork(options.network) + .get('platform.quorumList.cacheTtlSeconds'); + } + }); + + return configFile; + }, }; } diff --git a/packages/dashmate/docker-compose.yml b/packages/dashmate/docker-compose.yml index 0f0384e2aaa..c81076900b9 100644 --- a/packages/dashmate/docker-compose.yml +++ b/packages/dashmate/docker-compose.yml @@ -233,6 +233,7 @@ services: - DASH_RPC_USER=quorum_list - DASH_RPC_PASSWORD=${CORE_RPC_USERS_QUORUM_LIST_PASSWORD:?err} - QUORUM_PREVIOUS_BLOCKS_OFFSET=${PLATFORM_QUORUM_LIST_PREVIOUS_BLOCKS_OFFSET:?err} + - QUORUM_CACHE_TTL_SECONDS=${PLATFORM_QUORUM_LIST_CACHE_TTL_SECONDS:?err} - DASH_NETWORK=${DASH_CORE_NETWORK:?err} - VERSION_CHECK_HOST=${PLATFORM_QUORUM_LIST_VERSION_CHECK_HOST:-} - ADDRESS_HOST_OVERRIDE=${PLATFORM_QUORUM_LIST_ADDRESS_HOST_OVERRIDE:-} diff --git a/packages/dashmate/docs/services/quorum_list.md b/packages/dashmate/docs/services/quorum_list.md index 765100188a4..0a530bab981 100644 --- a/packages/dashmate/docs/services/quorum_list.md +++ b/packages/dashmate/docs/services/quorum_list.md @@ -17,6 +17,7 @@ The quorum list sidecar exposes the local LLMQ list over HTTP for SDKs and funct | `platform.quorumList.api.host` | `127.0.0.1` | Host interface to bind the API | | `platform.quorumList.api.port` | `2444` (mainnet), `12444` (testnet), `22444` (local) | Port for the HTTP API | | `platform.quorumList.previousBlocksOffset` | `8` | Number of previous blocks to consider for quorum lookups | +| `platform.quorumList.cacheTtlSeconds` | `60`, `1` (local) | Seconds between reloads of the quorum lists from Core. The service answers from the last reload only, so a new quorum is missing from its answers until the next one | | `platform.quorumList.versionCheckHost` | `""` | Host for version checking (set to `host.docker.internal` locally)| | `platform.quorumList.addressHostOverride` | `""` | Override for address host (set to `127.0.0.1` locally) | diff --git a/packages/dashmate/src/config/configJsonSchema.js b/packages/dashmate/src/config/configJsonSchema.js index 34f7081d4aa..66cddade75a 100644 --- a/packages/dashmate/src/config/configJsonSchema.js +++ b/packages/dashmate/src/config/configJsonSchema.js @@ -579,6 +579,11 @@ export default { type: 'integer', minimum: 0, }, + cacheTtlSeconds: { + type: 'integer', + minimum: 1, + description: 'Seconds between reloads of the quorum lists from Core', + }, versionCheckHost: { type: 'string', description: 'Host to use for version checking (used in local networks)', @@ -588,7 +593,7 @@ export default { description: 'Override for address host (used in local networks)', }, }, - required: ['enabled', 'docker', 'api', 'previousBlocksOffset', 'versionCheckHost', 'addressHostOverride'], + required: ['enabled', 'docker', 'api', 'previousBlocksOffset', 'cacheTtlSeconds', 'versionCheckHost', 'addressHostOverride'], additionalProperties: false, }, gateway: { diff --git a/packages/dashmate/test/unit/config/configFile/migrateConfigFileFactory.spec.js b/packages/dashmate/test/unit/config/configFile/migrateConfigFileFactory.spec.js index 57f051f0565..24aecb9cb57 100644 --- a/packages/dashmate/test/unit/config/configFile/migrateConfigFileFactory.spec.js +++ b/packages/dashmate/test/unit/config/configFile/migrateConfigFileFactory.spec.js @@ -342,6 +342,36 @@ describe('migrateConfigFileFactory', () => { }); }); + it('should add the quorum list reload interval to a 5.0.0-beta.3 config, short only on local networks', async () => { + // Loading is what fails without it: the schema requires the option. + const fromVersion = '5.0.0-beta.3'; + const { version } = JSON.parse(fs.readFileSync(path.join(PACKAGE_ROOT_DIR, 'package.json'), 'utf8')); + + const configFileData = createConfigFile().toObject(); + configFileData.configFormatVersion = fromVersion; + // `dashmate setup local` runs the service on `local_seed`, a config of its + // own next to the `local` preset. + configFileData.configs.local_seed = structuredClone(configFileData.configs.local); + configFileData.configs.local_seed.group = 'local'; + for (const options of Object.values(configFileData.configs)) { + delete options.platform.quorumList.cacheTtlSeconds; + } + configFileData.configs.testnet.platform.quorumList.cacheTtlSeconds = 5; + + const migrated = migrateConfigFile(configFileData, fromVersion, version); + + expect(migrated.configs.local.platform.quorumList.cacheTtlSeconds).to.equal(1); + expect(migrated.configs.local_seed.platform.quorumList.cacheTtlSeconds).to.equal(1); + expect(migrated.configs.base.platform.quorumList.cacheTtlSeconds).to.equal(60); + expect(migrated.configs.mainnet.platform.quorumList.cacheTtlSeconds).to.equal(60); + // An interval the operator chose is left alone. + expect(migrated.configs.testnet.platform.quorumList.cacheTtlSeconds).to.equal(5); + + for (const [name, options] of Object.entries(migrated.configs)) { + expect(() => new Config(name, options), `migrated ${name} config does not load`).to.not.throw(); + } + }); + it('should keep an operator image that predates the 4.0.0 re-pin', async () => { // Every config older than 4.0.0 crosses the unconditional re-pin in that // migration, so it is the first place operator intent can be respected. It