diff --git a/packages/dashmate/configs/defaults/getBaseConfigFactory.js b/packages/dashmate/configs/defaults/getBaseConfigFactory.js index e26e67ca504..d3784f6f3cf 100644 --- a/packages/dashmate/configs/defaults/getBaseConfigFactory.js +++ b/packages/dashmate/configs/defaults/getBaseConfigFactory.js @@ -53,7 +53,7 @@ export default function getBaseConfigFactory() { port: 3001, }, docker: { - image: 'dashpay/dashd:21', + image: 'dashpay/dashd:22.0.0-rc.1', commandArgs: [], }, p2p: { diff --git a/packages/dashmate/configs/getConfigFileMigrationsFactory.js b/packages/dashmate/configs/getConfigFileMigrationsFactory.js index 862f3abee37..bed2e0ef2e6 100644 --- a/packages/dashmate/configs/getConfigFileMigrationsFactory.js +++ b/packages/dashmate/configs/getConfigFileMigrationsFactory.js @@ -1032,6 +1032,13 @@ export default function getConfigFileMigrationsFactory(homeDir, defaultConfigs) }); return configFile; }, + '1.6.0': (configFile) => { + Object.entries(configFile.configs) + .forEach(([, options]) => { + options.core.docker.image = 'dashpay/dashd:22.0.0-rc.1'; + }); + return configFile; + }, }; } diff --git a/packages/dashmate/src/listr/tasks/setup/local/configureCoreTaskFactory.js b/packages/dashmate/src/listr/tasks/setup/local/configureCoreTaskFactory.js index d059e9c8606..522509b7397 100644 --- a/packages/dashmate/src/listr/tasks/setup/local/configureCoreTaskFactory.js +++ b/packages/dashmate/src/listr/tasks/setup/local/configureCoreTaskFactory.js @@ -2,7 +2,6 @@ import { Listr } from 'listr2'; import { Observable } from 'rxjs'; import DashCoreLib from '@dashevo/dashcore-lib'; import waitForNodesToHaveTheSameHeight from '../../../../core/waitForNodesToHaveTheSameHeight.js'; -import waitForNodesToHaveTheSameSporks from '../../../../core/waitForNodesToHaveTheSameSporks.js'; import { NETWORK_LOCAL, HPMN_COLLATERAL_AMOUNT } from '../../../../constants.js'; @@ -93,9 +92,40 @@ export default function configureCoreTaskFactory( }, }, { - title: 'Activating DIP3', + title: 'Create wallet', + task: async () => { + const disablePrivateKeys = false; + const createBlankWallet = false; + const walletPassphrase = ''; + const avoidReuse = false; + const loadOnStartup = true; + const descriptors = false; + + await ctx.coreService.getRpcClient().createWallet( + 'main', + disablePrivateKeys, + createBlankWallet, + walletPassphrase, + avoidReuse, + descriptors, + loadOnStartup, + ); + }, + }, + { + title: 'Generating funds to use as a collateral for masternodes', + task: () => { + const amount = HPMN_COLLATERAL_AMOUNT * configGroup.length; + return generateToAddressTask( + configGroup.find((c) => c.getName() === 'local_seed'), + amount, + ); + }, + }, + { + title: 'Activating v19 and v20', task: () => new Observable(async (observer) => { - const dip3ActivationHeight = 1000; + const dip3ActivationHeight = 901; const blocksToGenerateInOneStep = 10; let blocksGenerated = 0; @@ -126,37 +156,6 @@ export default function configureCoreTaskFactory( return this; }), }, - { - title: 'Create wallet', - task: async () => { - const disablePrivateKeys = false; - const createBlankWallet = false; - const walletPassphrase = ''; - const avoidReuse = false; - const loadOnStartup = true; - const descriptors = false; - - await ctx.coreService.getRpcClient().createWallet( - 'main', - disablePrivateKeys, - createBlankWallet, - walletPassphrase, - avoidReuse, - descriptors, - loadOnStartup, - ); - }, - }, - { - title: 'Generating funds to use as a collateral for masternodes', - task: () => { - const amount = HPMN_COLLATERAL_AMOUNT * configGroup.length; - return generateToAddressTask( - configGroup.find((c) => c.getName() === 'local_seed'), - amount, - ); - }, - }, { title: 'Register masternodes', task: async () => { @@ -276,51 +275,6 @@ export default function configureCoreTaskFactory( ); }, }, - { - title: 'Wait for nodes to have the same sporks', - task: () => waitForNodesToHaveTheSameSporks(ctx.coreServices), - }, - { - title: 'Activating DIP8 to enable ChainLocks', - task: () => new Observable(async (observer) => { - let isDip8Activated = false; - let blockchainInfo; - - let blocksGenerated = 0; - - const blocksToGenerateInOneStep = 10; - - do { - ({ - result: blockchainInfo, - } = await ctx.seedCoreService.getRpcClient().getBlockchainInfo()); - - isDip8Activated = blockchainInfo.softforks.dip0008.active; - - if (isDip8Activated) { - break; - } - - await generateBlocks( - ctx.seedCoreService, - blocksToGenerateInOneStep, - NETWORK_LOCAL, - // eslint-disable-next-line no-loop-func - (blocks) => { - blocksGenerated += blocks; - - observer.next(`${blocksGenerated} blocks generated`); - }, - ); - } while (!isDip8Activated); - - observer.next(`DIP8 has been activated at height ${blockchainInfo.softforks.dip0008.height}`); - - observer.complete(); - - return this; - }), - }, { title: 'Wait for nodes to have the same height', task: () => waitForNodesToHaveTheSameHeight( @@ -347,47 +301,6 @@ export default function configureCoreTaskFactory( title: 'Wait for quorums to be enabled', task: () => enableCoreQuorumsTask(), }, - { - title: 'Activating V20 fork', - task: () => new Observable(async (observer) => { - let isV20Activated = false; - let blockchainInfo; - - let blocksGenerated = 0; - - const blocksToGenerateInOneStep = 10; - - do { - ({ - result: blockchainInfo, - } = await ctx.seedCoreService.getRpcClient().getBlockchainInfo()); - - isV20Activated = blockchainInfo.softforks && blockchainInfo.softforks.v20 - && blockchainInfo.softforks.v20.active; - if (isV20Activated) { - break; - } - - await generateBlocks( - ctx.seedCoreService, - blocksToGenerateInOneStep, - NETWORK_LOCAL, - // eslint-disable-next-line no-loop-func - (blocks) => { - blocksGenerated += blocks; - - observer.next(`${blocksGenerated} blocks generated`); - }, - ); - } while (!isV20Activated); - - observer.next(`V20 fork has been activated at height ${blockchainInfo.softforks.v20.height}`); - - observer.complete(); - - return this; - }), - }, { title: 'Wait for nodes to have the same height', task: () => waitForNodesToHaveTheSameHeight( @@ -396,41 +309,23 @@ export default function configureCoreTaskFactory( ), }, { - title: 'Enable EHF spork', - task: async () => new Observable(async (observer) => { - const seedRpcClient = ctx.seedCoreService.getRpcClient(); - const { - result: initialCoreChainLockedHeight, - } = await seedRpcClient.getBlockCount(); - - await activateCoreSpork( - seedRpcClient, - 'SPORK_24_TEST_EHF', - initialCoreChainLockedHeight, - ); - - let isEhfActivated = false; - let blockchainInfo; + title: 'Activating v21 fork', + task: () => new Observable(async (observer) => { + const dip3ActivationHeight = 1001; + const blocksToGenerateInOneStep = 10; let blocksGenerated = 0; - - const blocksToGenerateInOneStep = 48; + let { + result: currentBlockHeight, + } = await ctx.coreService.getRpcClient().getBlockCount(); do { ({ - result: blockchainInfo, - } = await ctx.seedCoreService.getRpcClient().getBlockchainInfo()); - - isEhfActivated = blockchainInfo.softforks && blockchainInfo.softforks.mn_rr - && blockchainInfo.softforks.mn_rr.active; - if (isEhfActivated) { - break; - } - - await ctx.bumpMockTime(blocksToGenerateInOneStep); + result: currentBlockHeight, + } = await ctx.coreService.getRpcClient().getBlockCount()); await generateBlocks( - ctx.seedCoreService, + ctx.coreService, blocksToGenerateInOneStep, NETWORK_LOCAL, // eslint-disable-next-line no-loop-func @@ -440,9 +335,7 @@ export default function configureCoreTaskFactory( observer.next(`${blocksGenerated} blocks generated`); }, ); - } while (!isEhfActivated); - - observer.next(`EHF has been activated at height ${blockchainInfo.softforks.mn_rr.height}`); + } while (dip3ActivationHeight > currentBlockHeight); observer.complete(); diff --git a/packages/dashmate/src/status/scopes/platform.js b/packages/dashmate/src/status/scopes/platform.js index c3fe48d8e88..4cb70187c13 100644 --- a/packages/dashmate/src/status/scopes/platform.js +++ b/packages/dashmate/src/status/scopes/platform.js @@ -1,4 +1,3 @@ -import prettyMs from 'pretty-ms'; import { PortStateEnum } from '../enums/portState.js'; import DockerComposeError from '../../docker/errors/DockerComposeError.js'; import providers from '../providers.js'; @@ -312,11 +311,7 @@ export default function getPlatformScopeFactory( if (mnRRSoftFork.active) { scope.platformActivation = `Activated (at height ${mnRRSoftFork.height})`; } else { - const startTime = mnRRSoftFork.bip9.start_time; - - const diff = (new Date().getTime() - startTime) / 1000; - - scope.platformActivation = `Waiting for activation (approximately in ${prettyMs(diff, { compact: true })})`; + scope.platformActivation = `Waiting for activation on height ${mnRRSoftFork.height}`; } const [tenderdash, drive] = await Promise.all([ diff --git a/packages/dashmate/templates/core/dash.conf.dot b/packages/dashmate/templates/core/dash.conf.dot index cbc0b933735..c63987d4ae2 100644 --- a/packages/dashmate/templates/core/dash.conf.dot +++ b/packages/dashmate/templates/core/dash.conf.dot @@ -31,7 +31,6 @@ debuglogfile=/var/log/dash/debug.log # JSON RPC server=1 rpcwallet=main -deprecatedrpc=hpmn rpcworkqueue=64 rpcthreads=16 rpcwhitelistdefault=0 @@ -93,6 +92,7 @@ fallbackfee=0.00001 {{?? it.network === 'local'}} regtest=1 [regtest] +testactivationheight=mn_rr@1000 {{? it.core.spork.address}}sporkaddr={{=it.core.spork.address}}{{?}} {{? it.core.spork.privateKey}}sporkkey={{=it.core.spork.privateKey}}{{?}} {{? it.core.miner.mediantime}}mocktime={{=it.core.miner.mediantime}}{{?}}