Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/dashmate/configs/defaults/getBaseConfigFactory.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export default function getBaseConfigFactory() {
port: 3001,
},
docker: {
image: 'dashpay/dashd:22.0.0-rc.1',
image: 'dashpay/dashd:21',
commandArgs: [],
},
p2p: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1037,7 +1037,6 @@ export default function getConfigFileMigrationsFactory(homeDir, defaultConfigs)
.forEach(([, options]) => {
options.platform.drive.abci.docker.image = 'dashpay/drive:1-dev';
options.platform.dapi.api.docker.image = 'dashpay/dapi:1-dev';
options.core.docker.image = 'dashpay/dashd:22.0.0-rc.1';
});
return configFile;
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ 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';

Expand Down Expand Up @@ -92,40 +93,9 @@ export default function configureCoreTaskFactory(
},
},
{
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',
title: 'Activating DIP3',
task: () => new Observable(async (observer) => {
const dip3ActivationHeight = 901;
const dip3ActivationHeight = 1000;
const blocksToGenerateInOneStep = 10;

let blocksGenerated = 0;
Expand Down Expand Up @@ -156,6 +126,37 @@ 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 () => {
Expand Down Expand Up @@ -275,6 +276,51 @@ 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(
Expand All @@ -301,6 +347,47 @@ 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(
Expand All @@ -309,23 +396,41 @@ export default function configureCoreTaskFactory(
),
},
{
title: 'Activating v21 fork',
task: () => new Observable(async (observer) => {
const dip3ActivationHeight = 1001;
const blocksToGenerateInOneStep = 10;
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;

let blocksGenerated = 0;
let {
result: currentBlockHeight,
} = await ctx.coreService.getRpcClient().getBlockCount();

const blocksToGenerateInOneStep = 48;

do {
({
result: currentBlockHeight,
} = await ctx.coreService.getRpcClient().getBlockCount());
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);

await generateBlocks(
ctx.coreService,
ctx.seedCoreService,
blocksToGenerateInOneStep,
NETWORK_LOCAL,
// eslint-disable-next-line no-loop-func
Expand All @@ -335,7 +440,9 @@ export default function configureCoreTaskFactory(
observer.next(`${blocksGenerated} blocks generated`);
},
);
} while (dip3ActivationHeight > currentBlockHeight);
} while (!isEhfActivated);

observer.next(`EHF has been activated at height ${blockchainInfo.softforks.mn_rr.height}`);

observer.complete();

Expand Down
7 changes: 6 additions & 1 deletion packages/dashmate/src/status/scopes/platform.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import prettyMs from 'pretty-ms';
import { PortStateEnum } from '../enums/portState.js';
import DockerComposeError from '../../docker/errors/DockerComposeError.js';
import providers from '../providers.js';
Expand Down Expand Up @@ -311,7 +312,11 @@ export default function getPlatformScopeFactory(
if (mnRRSoftFork.active) {
scope.platformActivation = `Activated (at height ${mnRRSoftFork.height})`;
} else {
scope.platformActivation = `Waiting for activation on height ${mnRRSoftFork.height}`;
const startTime = mnRRSoftFork.bip9.start_time;

const diff = (new Date().getTime() - startTime) / 1000;

scope.platformActivation = `Waiting for activation (approximately in ${prettyMs(diff, { compact: true })})`;
}

const [tenderdash, drive] = await Promise.all([
Expand Down
2 changes: 1 addition & 1 deletion packages/dashmate/templates/core/dash.conf.dot
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ debuglogfile=/var/log/dash/debug.log
# JSON RPC
server=1
rpcwallet=main
deprecatedrpc=hpmn
rpcworkqueue=64
rpcthreads=16
rpcwhitelistdefault=0
Expand Down Expand Up @@ -92,7 +93,6 @@ 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}}{{?}}
Expand Down
Loading