From c8d7e5262dfa315ebe996696c609ca82bea33488 Mon Sep 17 00:00:00 2001 From: Ivan Shumkov Date: Fri, 19 Jul 2024 18:28:16 +0700 Subject: [PATCH] fix(dashmate): configure devnet quorums --- .../configs/defaults/getBaseConfigFactory.js | 6 ++++ .../configs/getConfigFileMigrationsFactory.js | 7 ++++ .../dashmate/src/config/configJsonSchema.js | 33 +++++++++++++++++++ .../prompts/createPlatformNodeKeyInput.js | 6 ++-- .../dashmate/templates/core/dash.conf.dot | 8 ++--- 5 files changed, 54 insertions(+), 6 deletions(-) diff --git a/packages/dashmate/configs/defaults/getBaseConfigFactory.js b/packages/dashmate/configs/defaults/getBaseConfigFactory.js index 9a47b7b0ef..383c2f4f81 100644 --- a/packages/dashmate/configs/defaults/getBaseConfigFactory.js +++ b/packages/dashmate/configs/defaults/getBaseConfigFactory.js @@ -152,6 +152,12 @@ export default function getBaseConfigFactory(homeDir) { name: null, minimumDifficultyBlocks: 0, powTargetSpacing: 150, + llmq: { + chainLocks: 'llmq_devnet', + instantSend: 'llmq_devnet', + platform: 'llmq_devnet_platform', + mnhf: 'llmq_devnet', + }, }, log: { file: { diff --git a/packages/dashmate/configs/getConfigFileMigrationsFactory.js b/packages/dashmate/configs/getConfigFileMigrationsFactory.js index 1d0ac6f305..9f8fcfae16 100644 --- a/packages/dashmate/configs/getConfigFileMigrationsFactory.js +++ b/packages/dashmate/configs/getConfigFileMigrationsFactory.js @@ -688,6 +688,13 @@ export default function getConfigFileMigrationsFactory(homeDir, defaultConfigs) }); return configFile; }, + '1.0.0-beta.4': (configFile) => { + Object.entries(configFile.configs) + .forEach(([, options]) => { + options.core.devnet.llmq = base.get('core.devnet.llmq'); + }); + return configFile; + }, }; } diff --git a/packages/dashmate/src/config/configJsonSchema.js b/packages/dashmate/src/config/configJsonSchema.js index aef111c82f..ad078c4368 100644 --- a/packages/dashmate/src/config/configJsonSchema.js +++ b/packages/dashmate/src/config/configJsonSchema.js @@ -127,6 +127,20 @@ export default { required: ['llmqType', 'dkgInterval', 'activeSigners', 'rotation'], additionalProperties: false, }, + quorumName: { + type: 'string', + enum: [ + 'llmq_devnet', + 'llmq_devnet_dip0024', + 'llmq_devnet_platform', + 'llmq_50_60', + 'llmq_60_75', + 'llmq_400_60', + 'llmq_400_85', + 'llmq_100_67', + 'llmq_25_67', + ], + }, }, properties: { description: { @@ -361,6 +375,25 @@ export default { type: 'integer', minimum: 1, }, + llmq: { + type: 'object', + properties: { + chainLocks: { + $ref: '#/definitions/quorumName', + }, + instantSend: { + $ref: '#/definitions/quorumName', + }, + platform: { + $ref: '#/definitions/quorumName', + }, + mnhf: { + $ref: '#/definitions/quorumName', + }, + }, + required: ['chainLocks', 'instantSend', 'platform', 'mnhf'], + additionalProperties: false, + }, }, additionalProperties: false, required: ['name', 'minimumDifficultyBlocks', 'powTargetSpacing'], diff --git a/packages/dashmate/src/listr/prompts/createPlatformNodeKeyInput.js b/packages/dashmate/src/listr/prompts/createPlatformNodeKeyInput.js index 024bfd2c37..50fa9209c3 100644 --- a/packages/dashmate/src/listr/prompts/createPlatformNodeKeyInput.js +++ b/packages/dashmate/src/listr/prompts/createPlatformNodeKeyInput.js @@ -8,8 +8,11 @@ import generateTenderdashNodeKey from '../../tenderdash/generateTenderdashNodeKe */ export default function createPlatformNodeKeyInput(options = {}) { let { initial } = options; + let additionalMessage = ''; if (initial === null || initial === undefined) { initial = generateTenderdashNodeKey(); + additionalMessage = ' You can provide a key, or a new key will be\n automatically generated' + + ' for you.'; } return { @@ -19,8 +22,7 @@ export default function createPlatformNodeKeyInput(options = {}) { This key is used to uniquely identify your Dash Platform node. The node key is derived from a standard Ed25519 cryptographic key pair, presented in a cached - format specific to Tenderdash. You can provide a key, or a new key will be - automatically generated for you.\n`, + format specific to Tenderdash.${additionalMessage}\n`, message: 'Enter Ed25519 node key', hint: 'Base64 encoded', initial, diff --git a/packages/dashmate/templates/core/dash.conf.dot b/packages/dashmate/templates/core/dash.conf.dot index 8e599ee3de..08130ee33a 100644 --- a/packages/dashmate/templates/core/dash.conf.dot +++ b/packages/dashmate/templates/core/dash.conf.dot @@ -89,10 +89,10 @@ powtargetspacing={{=it.core.devnet.powTargetSpacing}} minimumdifficultyblocks={{=it.core.devnet.minimumDifficultyBlocks}} highsubsidyblocks=500 highsubsidyfactor=10 -llmqchainlocks=llmq_devnet -llmqinstantsend=llmq_devnet -llmqinstantsenddip0024=llmq_devnet_dip0024 -llmqplatform=llmq_devnet_platform{{?}} +llmqchainlocks={{=it.core.devnet.llmq.chainLocks}} +llmqinstantsenddip0024={{=it.core.devnet.llmq.instantSend}} +llmqplatform={{=it.core.devnet.llmq.platform}} +llmqmnhf={{=it.core.devnet.llmq.mnhf}} {{?}} {{~it.core.p2p.seeds :seed}}