From cd07fd4d78e604017470da749a33b94c85acce83 Mon Sep 17 00:00:00 2001 From: Ivan Shumkov Date: Fri, 19 Jul 2024 21:13:24 +0700 Subject: [PATCH 1/2] fix(drive): drive and tenderdash are constantly restarting (#1978) --- .../initialization/init_chain/v0/mod.rs | 24 ++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/packages/rs-drive-abci/src/execution/engine/initialization/init_chain/v0/mod.rs b/packages/rs-drive-abci/src/execution/engine/initialization/init_chain/v0/mod.rs index 08beb8c762..5a1c4b9225 100644 --- a/packages/rs-drive-abci/src/execution/engine/initialization/init_chain/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/engine/initialization/init_chain/v0/mod.rs @@ -31,9 +31,27 @@ where request, )?; - // We get core height early, as this also verifies mn_rr fork - let core_height = - self.initial_core_height(request.initial_core_height, platform_version)?; + // Wait until we have an initial core height to start the chain + let core_height = loop { + match self.initial_core_height(request.initial_core_height, platform_version) { + Ok(height) => break height, + Err(e) => match e { + Error::Execution(ExecutionError::InitializationForkNotActive(_)) + | Error::Execution(ExecutionError::InitializationBadCoreLockedHeight { + .. + }) => { + tracing::warn!( + error = ?e, + "Failed to obtain deterministic initial core height to start the chain. Retrying in 30 seconds.", + ); + + // We need to wait for the fork to be active + std::thread::sleep(std::time::Duration::from_secs(30)); + } + e => return Err(e), + }, + } + }; let genesis_time = request.genesis_time; From 811817a3e8e33148f2b0df7bb6ee72862f253a03 Mon Sep 17 00:00:00 2001 From: Ivan Shumkov Date: Fri, 19 Jul 2024 21:35:50 +0700 Subject: [PATCH 2/2] fix(dashmate): configure devnet quorums (#1979) --- .../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..ce212f1de7 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_dip0024', + 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}}