Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(dashmate): update Core to version 22 #2107

Merged
merged 20 commits into from
Nov 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
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:21',
image: 'dashpay/dashd:22.0.0-rc.1',
shumkov marked this conversation as resolved.
Show resolved Hide resolved
commandArgs: [],
},
p2p: {
Expand Down
7 changes: 7 additions & 0 deletions packages/dashmate/configs/getConfigFileMigrationsFactory.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
},
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -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,
);
},
},
shumkov marked this conversation as resolved.
Show resolved Hide resolved
{
title: 'Activating v19 and v20',
task: () => new Observable(async (observer) => {
const dip3ActivationHeight = 1000;
const dip3ActivationHeight = 901;
const blocksToGenerateInOneStep = 10;

let blocksGenerated = 0;
Expand Down Expand Up @@ -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 () => {
Expand Down Expand Up @@ -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(
Expand All @@ -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(
Expand All @@ -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
Expand All @@ -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();

Expand Down
7 changes: 1 addition & 6 deletions packages/dashmate/src/status/scopes/platform.js
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -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([
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,7 +31,6 @@ debuglogfile=/var/log/dash/debug.log
# JSON RPC
server=1
rpcwallet=main
deprecatedrpc=hpmn
rpcworkqueue=64
rpcthreads=16
rpcwhitelistdefault=0
Expand Down Expand Up @@ -93,6 +92,7 @@ fallbackfee=0.00001
{{?? it.network === 'local'}}
regtest=1
[regtest]
testactivationheight=mn_rr@1000
shumkov marked this conversation as resolved.
Show resolved Hide resolved
{{? 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