Skip to content

Commit 89e2eab

Browse files
authored
chore(dashmate): update Core to version 22 (#2107)
2 parents 92dd8f9 + e165edc commit 89e2eab

File tree

5 files changed

+54
-159
lines changed

5 files changed

+54
-159
lines changed

packages/dashmate/configs/defaults/getBaseConfigFactory.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ export default function getBaseConfigFactory() {
5353
port: 3001,
5454
},
5555
docker: {
56-
image: 'dashpay/dashd:21',
56+
image: 'dashpay/dashd:22.0.0-rc.1',
5757
commandArgs: [],
5858
},
5959
p2p: {

packages/dashmate/configs/getConfigFileMigrationsFactory.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1032,6 +1032,13 @@ export default function getConfigFileMigrationsFactory(homeDir, defaultConfigs)
10321032
});
10331033
return configFile;
10341034
},
1035+
'1.6.0': (configFile) => {
1036+
Object.entries(configFile.configs)
1037+
.forEach(([, options]) => {
1038+
options.core.docker.image = 'dashpay/dashd:22.0.0-rc.1';
1039+
});
1040+
return configFile;
1041+
},
10351042
};
10361043
}
10371044

packages/dashmate/src/listr/tasks/setup/local/configureCoreTaskFactory.js

Lines changed: 44 additions & 151 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { Listr } from 'listr2';
22
import { Observable } from 'rxjs';
33
import DashCoreLib from '@dashevo/dashcore-lib';
44
import waitForNodesToHaveTheSameHeight from '../../../../core/waitForNodesToHaveTheSameHeight.js';
5-
import waitForNodesToHaveTheSameSporks from '../../../../core/waitForNodesToHaveTheSameSporks.js';
65

76
import { NETWORK_LOCAL, HPMN_COLLATERAL_AMOUNT } from '../../../../constants.js';
87

@@ -93,9 +92,40 @@ export default function configureCoreTaskFactory(
9392
},
9493
},
9594
{
96-
title: 'Activating DIP3',
95+
title: 'Create wallet',
96+
task: async () => {
97+
const disablePrivateKeys = false;
98+
const createBlankWallet = false;
99+
const walletPassphrase = '';
100+
const avoidReuse = false;
101+
const loadOnStartup = true;
102+
const descriptors = false;
103+
104+
await ctx.coreService.getRpcClient().createWallet(
105+
'main',
106+
disablePrivateKeys,
107+
createBlankWallet,
108+
walletPassphrase,
109+
avoidReuse,
110+
descriptors,
111+
loadOnStartup,
112+
);
113+
},
114+
},
115+
{
116+
title: 'Generating funds to use as a collateral for masternodes',
117+
task: () => {
118+
const amount = HPMN_COLLATERAL_AMOUNT * configGroup.length;
119+
return generateToAddressTask(
120+
configGroup.find((c) => c.getName() === 'local_seed'),
121+
amount,
122+
);
123+
},
124+
},
125+
{
126+
title: 'Activating v19 and v20',
97127
task: () => new Observable(async (observer) => {
98-
const dip3ActivationHeight = 1000;
128+
const dip3ActivationHeight = 901;
99129
const blocksToGenerateInOneStep = 10;
100130

101131
let blocksGenerated = 0;
@@ -126,37 +156,6 @@ export default function configureCoreTaskFactory(
126156
return this;
127157
}),
128158
},
129-
{
130-
title: 'Create wallet',
131-
task: async () => {
132-
const disablePrivateKeys = false;
133-
const createBlankWallet = false;
134-
const walletPassphrase = '';
135-
const avoidReuse = false;
136-
const loadOnStartup = true;
137-
const descriptors = false;
138-
139-
await ctx.coreService.getRpcClient().createWallet(
140-
'main',
141-
disablePrivateKeys,
142-
createBlankWallet,
143-
walletPassphrase,
144-
avoidReuse,
145-
descriptors,
146-
loadOnStartup,
147-
);
148-
},
149-
},
150-
{
151-
title: 'Generating funds to use as a collateral for masternodes',
152-
task: () => {
153-
const amount = HPMN_COLLATERAL_AMOUNT * configGroup.length;
154-
return generateToAddressTask(
155-
configGroup.find((c) => c.getName() === 'local_seed'),
156-
amount,
157-
);
158-
},
159-
},
160159
{
161160
title: 'Register masternodes',
162161
task: async () => {
@@ -276,51 +275,6 @@ export default function configureCoreTaskFactory(
276275
);
277276
},
278277
},
279-
{
280-
title: 'Wait for nodes to have the same sporks',
281-
task: () => waitForNodesToHaveTheSameSporks(ctx.coreServices),
282-
},
283-
{
284-
title: 'Activating DIP8 to enable ChainLocks',
285-
task: () => new Observable(async (observer) => {
286-
let isDip8Activated = false;
287-
let blockchainInfo;
288-
289-
let blocksGenerated = 0;
290-
291-
const blocksToGenerateInOneStep = 10;
292-
293-
do {
294-
({
295-
result: blockchainInfo,
296-
} = await ctx.seedCoreService.getRpcClient().getBlockchainInfo());
297-
298-
isDip8Activated = blockchainInfo.softforks.dip0008.active;
299-
300-
if (isDip8Activated) {
301-
break;
302-
}
303-
304-
await generateBlocks(
305-
ctx.seedCoreService,
306-
blocksToGenerateInOneStep,
307-
NETWORK_LOCAL,
308-
// eslint-disable-next-line no-loop-func
309-
(blocks) => {
310-
blocksGenerated += blocks;
311-
312-
observer.next(`${blocksGenerated} blocks generated`);
313-
},
314-
);
315-
} while (!isDip8Activated);
316-
317-
observer.next(`DIP8 has been activated at height ${blockchainInfo.softforks.dip0008.height}`);
318-
319-
observer.complete();
320-
321-
return this;
322-
}),
323-
},
324278
{
325279
title: 'Wait for nodes to have the same height',
326280
task: () => waitForNodesToHaveTheSameHeight(
@@ -347,47 +301,6 @@ export default function configureCoreTaskFactory(
347301
title: 'Wait for quorums to be enabled',
348302
task: () => enableCoreQuorumsTask(),
349303
},
350-
{
351-
title: 'Activating V20 fork',
352-
task: () => new Observable(async (observer) => {
353-
let isV20Activated = false;
354-
let blockchainInfo;
355-
356-
let blocksGenerated = 0;
357-
358-
const blocksToGenerateInOneStep = 10;
359-
360-
do {
361-
({
362-
result: blockchainInfo,
363-
} = await ctx.seedCoreService.getRpcClient().getBlockchainInfo());
364-
365-
isV20Activated = blockchainInfo.softforks && blockchainInfo.softforks.v20
366-
&& blockchainInfo.softforks.v20.active;
367-
if (isV20Activated) {
368-
break;
369-
}
370-
371-
await generateBlocks(
372-
ctx.seedCoreService,
373-
blocksToGenerateInOneStep,
374-
NETWORK_LOCAL,
375-
// eslint-disable-next-line no-loop-func
376-
(blocks) => {
377-
blocksGenerated += blocks;
378-
379-
observer.next(`${blocksGenerated} blocks generated`);
380-
},
381-
);
382-
} while (!isV20Activated);
383-
384-
observer.next(`V20 fork has been activated at height ${blockchainInfo.softforks.v20.height}`);
385-
386-
observer.complete();
387-
388-
return this;
389-
}),
390-
},
391304
{
392305
title: 'Wait for nodes to have the same height',
393306
task: () => waitForNodesToHaveTheSameHeight(
@@ -396,41 +309,23 @@ export default function configureCoreTaskFactory(
396309
),
397310
},
398311
{
399-
title: 'Enable EHF spork',
400-
task: async () => new Observable(async (observer) => {
401-
const seedRpcClient = ctx.seedCoreService.getRpcClient();
402-
const {
403-
result: initialCoreChainLockedHeight,
404-
} = await seedRpcClient.getBlockCount();
405-
406-
await activateCoreSpork(
407-
seedRpcClient,
408-
'SPORK_24_TEST_EHF',
409-
initialCoreChainLockedHeight,
410-
);
411-
412-
let isEhfActivated = false;
413-
let blockchainInfo;
312+
title: 'Activating v21 fork',
313+
task: () => new Observable(async (observer) => {
314+
const dip3ActivationHeight = 1001;
315+
const blocksToGenerateInOneStep = 10;
414316

415317
let blocksGenerated = 0;
416-
417-
const blocksToGenerateInOneStep = 48;
318+
let {
319+
result: currentBlockHeight,
320+
} = await ctx.coreService.getRpcClient().getBlockCount();
418321

419322
do {
420323
({
421-
result: blockchainInfo,
422-
} = await ctx.seedCoreService.getRpcClient().getBlockchainInfo());
423-
424-
isEhfActivated = blockchainInfo.softforks && blockchainInfo.softforks.mn_rr
425-
&& blockchainInfo.softforks.mn_rr.active;
426-
if (isEhfActivated) {
427-
break;
428-
}
429-
430-
await ctx.bumpMockTime(blocksToGenerateInOneStep);
324+
result: currentBlockHeight,
325+
} = await ctx.coreService.getRpcClient().getBlockCount());
431326

432327
await generateBlocks(
433-
ctx.seedCoreService,
328+
ctx.coreService,
434329
blocksToGenerateInOneStep,
435330
NETWORK_LOCAL,
436331
// eslint-disable-next-line no-loop-func
@@ -440,9 +335,7 @@ export default function configureCoreTaskFactory(
440335
observer.next(`${blocksGenerated} blocks generated`);
441336
},
442337
);
443-
} while (!isEhfActivated);
444-
445-
observer.next(`EHF has been activated at height ${blockchainInfo.softforks.mn_rr.height}`);
338+
} while (dip3ActivationHeight > currentBlockHeight);
446339

447340
observer.complete();
448341

packages/dashmate/src/status/scopes/platform.js

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import prettyMs from 'pretty-ms';
21
import { PortStateEnum } from '../enums/portState.js';
32
import DockerComposeError from '../../docker/errors/DockerComposeError.js';
43
import providers from '../providers.js';
@@ -312,11 +311,7 @@ export default function getPlatformScopeFactory(
312311
if (mnRRSoftFork.active) {
313312
scope.platformActivation = `Activated (at height ${mnRRSoftFork.height})`;
314313
} else {
315-
const startTime = mnRRSoftFork.bip9.start_time;
316-
317-
const diff = (new Date().getTime() - startTime) / 1000;
318-
319-
scope.platformActivation = `Waiting for activation (approximately in ${prettyMs(diff, { compact: true })})`;
314+
scope.platformActivation = `Waiting for activation on height ${mnRRSoftFork.height}`;
320315
}
321316

322317
const [tenderdash, drive] = await Promise.all([

packages/dashmate/templates/core/dash.conf.dot

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ debuglogfile=/var/log/dash/debug.log
3131
# JSON RPC
3232
server=1
3333
rpcwallet=main
34-
deprecatedrpc=hpmn
3534
rpcworkqueue=64
3635
rpcthreads=16
3736
rpcwhitelistdefault=0
@@ -93,6 +92,7 @@ fallbackfee=0.00001
9392
{{?? it.network === 'local'}}
9493
regtest=1
9594
[regtest]
95+
testactivationheight=mn_rr@1000
9696
{{? it.core.spork.address}}sporkaddr={{=it.core.spork.address}}{{?}}
9797
{{? it.core.spork.privateKey}}sporkkey={{=it.core.spork.privateKey}}{{?}}
9898
{{? it.core.miner.mediantime}}mocktime={{=it.core.miner.mediantime}}{{?}}

0 commit comments

Comments
 (0)