Skip to content

Commit

Permalink
Merge branch 'refs/heads/v1.0-dev' into chore/secure-core-rpc
Browse files Browse the repository at this point in the history
# Conflicts:
#	packages/dashmate/configs/getConfigFileMigrationsFactory.js
  • Loading branch information
shumkov committed Jun 23, 2024
2 parents 3f50539 + a89d854 commit 15d2384
Show file tree
Hide file tree
Showing 91 changed files with 3,491 additions and 1,305 deletions.
2 changes: 1 addition & 1 deletion .github/actions/rust/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ inputs:
toolchain:
description: Rust toolchain to use, stable / nightly / beta, or exact version
# The same as in /README.md
default: "stable"
default: "1.76"
target:
description: Target Rust platform
required: false
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests-rs-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ jobs:
cache: false

- name: Check formatting
run: exit `cargo fmt --check --package=${{ inputs.package }} | wc -l`
run: cargo fmt --check --package=${{ inputs.package }}

unused_deps:
name: Unused dependencies
Expand Down
114 changes: 57 additions & 57 deletions .pnp.cjs

Large diffs are not rendered by default.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed .yarn/cache/ws-npm-7.5.5-8f4a2a84a8-2e91fd634b.zip
Binary file not shown.
Binary file removed .yarn/cache/ws-npm-8.11.0-ab72116a01-f759ea19e4.zip
Binary file not shown.
Binary file not shown.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@
"cacache": "18.0.0",
"node-gyp": "10.0.1",
"follow-redirects": "^1.15.5",
"socks": "^2.8.1"
"socks": "^2.8.1",
"ws": "^8.17.1"
},
"dependencies": {
"node-gyp": "^10.0.1"
Expand Down
2 changes: 1 addition & 1 deletion packages/dapi/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"lru-cache": "^5.1.1",
"pino": "^8.16.2",
"pino-pretty": "^10.2.3",
"ws": "^7.5.3"
"ws": "^8.17.1"
},
"devDependencies": {
"@babel/core": "^7.23.3",
Expand Down
29 changes: 23 additions & 6 deletions packages/dashmate/configs/defaults/getBaseConfigFactory.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ import semver from 'semver';

import fs from 'fs';
import {
NETWORK_TESTNET, PACKAGE_ROOT_DIR,
NETWORK_MAINNET,
PACKAGE_ROOT_DIR,
} from '../../src/constants.js';
import Config from '../../src/config/Config.js';

Expand Down Expand Up @@ -282,12 +283,28 @@ export default function getBaseConfigFactory(homeDir) {
retention: 60 * 3,
},
validatorSet: {
llmqType: 4,
quorum: {
llmqType: 4,
dkgInterval: 24,
activeSigners: 24,
rotation: false,
},
},
chainLock: {
llmqType: 2,
dkgInterval: 288,
llmqSize: 400,
quorum: {
llmqType: 2,
dkgInterval: 288,
activeSigners: 4,
rotation: false,
},
},
instantLock: {
quorum: {
llmqType: 5,
dkgInterval: 288,
activeSigners: 32,
rotation: true,
},
},
metrics: {
enabled: false,
Expand Down Expand Up @@ -462,7 +479,7 @@ export default function getBaseConfigFactory(homeDir) {
},
},
externalIp: null,
network: NETWORK_TESTNET,
network: NETWORK_MAINNET,
environment: 'production',
};

Expand Down
24 changes: 20 additions & 4 deletions packages/dashmate/configs/defaults/getLocalConfigFactory.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,28 @@ export default function getLocalConfigFactory(getBaseConfig) {
},
abci: {
validatorSet: {
llmqType: 106,
quorum: {
llmqType: 106,
dkgInterval: 24,
activeSigners: 2,
rotation: false,
},
},
chainLock: {
llmqType: 100,
dkgInterval: 24,
llmqSize: 3,
quorum: {
llmqType: 100,
dkgInterval: 24,
activeSigners: 2,
rotation: false,
},
},
instantLock: {
quorum: {
llmqType: 104,
dkgInterval: 24,
activeSigners: 2,
rotation: false,
},
},
},
},
Expand Down
24 changes: 20 additions & 4 deletions packages/dashmate/configs/defaults/getTestnetConfigFactory.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,28 @@ export default function getTestnetConfigFactory(homeDir, getBaseConfig) {
abci: {
epochTime: 3600,
validatorSet: {
llmqType: 6,
quorum: {
llmqType: 6,
dkgInterval: 24,
activeSigners: 24,
rotation: false,
},
},
chainLock: {
llmqType: 1,
dkgInterval: 24,
llmqSize: 50,
quorum: {
llmqType: 1,
dkgInterval: 24,
activeSigners: 24,
rotation: false,
},
},
instantLock: {
quorum: {
llmqType: 5,
dkgInterval: 288,
activeSigners: 32,
rotation: true,
},
},
},
tenderdash: {
Expand Down
53 changes: 52 additions & 1 deletion packages/dashmate/configs/getConfigFileMigrationsFactory.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,20 @@ export default function getConfigFileMigrationsFactory(homeDir, defaultConfigs)
return defaultConfigs.get(baseConfigName);
}

function getDefaultConfigByNetwork(network) {
if (network === NETWORK_MAINNET) {
return defaultConfigs.get('mainnet');
}
if (network === NETWORK_TESTNET) {
return defaultConfigs.get('testnet');
}
if (network === NETWORK_LOCAL) {
return defaultConfigs.get('local');
}

return defaultConfigs.get('base');
}

return {
'0.24.0': (configFile) => {
Object.entries(configFile.configs)
Expand Down Expand Up @@ -615,7 +629,44 @@ export default function getConfigFileMigrationsFactory(homeDir, defaultConfigs)
},
'1.0.0-dev.16': (configFile) => {
Object.entries(configFile.configs)
.forEach(([, options]) => {
.forEach(([name, options]) => {
// Update Drive's quorum configuration
if (name === 'base') {
options.network = NETWORK_MAINNET;
}

const networkConfig = getDefaultConfigByNetwork(options.network);

options.platform.drive.abci.chainLock.quorum = {
llmqType: networkConfig.get('platform.drive.abci.chainLock.quorum.llmqType'),
dkgInterval: networkConfig.get('platform.drive.abci.chainLock.quorum.dkgInterval'),
activeSigners: networkConfig.get('platform.drive.abci.chainLock.quorum.activeSigners'),
rotation: networkConfig.get('platform.drive.abci.chainLock.quorum.rotation'),
};

delete options.platform.drive.abci.chainLock.llmqType;
delete options.platform.drive.abci.chainLock.llmqSize;
delete options.platform.drive.abci.chainLock.dkgInterval;

options.platform.drive.abci.validatorSet.quorum = {
llmqType: networkConfig.get('platform.drive.abci.validatorSet.quorum.llmqType'),
dkgInterval: networkConfig.get('platform.drive.abci.validatorSet.quorum.dkgInterval'),
activeSigners: networkConfig.get('platform.drive.abci.validatorSet.quorum.activeSigners'),
rotation: networkConfig.get('platform.drive.abci.validatorSet.quorum.rotation'),
};

delete options.platform.drive.abci.validatorSet.llmqType;

options.platform.drive.abci.instantLock = {
quorum: {
llmqType: networkConfig.get('platform.drive.abci.instantLock.quorum.llmqType'),
dkgInterval: networkConfig.get('platform.drive.abci.instantLock.quorum.dkgInterval'),
activeSigners: networkConfig.get('platform.drive.abci.instantLock.quorum.activeSigners'),
rotation: networkConfig.get('platform.drive.abci.instantLock.quorum.rotation'),
},
};

// Update Core RPC auth configuration
options.core.rpc.users = base.get('core.rpc.users');
options.core.rpc.users.dashmate = options.core.rpc.password;

Expand Down
16 changes: 12 additions & 4 deletions packages/dashmate/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,18 @@ services:
- MASTERNODE_REWARD_SHARES_SECOND_PUBLIC_KEY=${PLATFORM_MASTERNODE_REWARD_SHARES_SECOND_PUBLIC_KEY}
- WITHDRAWALS_MASTER_PUBLIC_KEY=${PLATFORM_WITHDRAWALS_MASTER_PUBLIC_KEY}
- WITHDRAWALS_SECOND_PUBLIC_KEY=${PLATFORM_WITHDRAWALS_SECOND_PUBLIC_KEY}
- VALIDATOR_SET_QUORUM_TYPE=${PLATFORM_DRIVE_ABCI_VALIDATOR_SET_LLMQ_TYPE:?err}
- CHAIN_LOCK_QUORUM_TYPE=${PLATFORM_DRIVE_ABCI_CHAIN_LOCK_LLMQ_TYPE:?err}
- CHAIN_LOCK_QUORUM_WINDOW=${PLATFORM_DRIVE_ABCI_CHAIN_LOCK_DKG_INTERVAL:?err}
- CHAIN_LOCK_QUORUM_SIZE=${PLATFORM_DRIVE_ABCI_CHAIN_LOCK_LLMQ_SIZE:?err}
- VALIDATOR_SET_QUORUM_TYPE=${PLATFORM_DRIVE_ABCI_VALIDATOR_SET_QUORUM_LLMQ_TYPE:?err}
- VALIDATOR_SET_QUORUM_WINDOW=${PLATFORM_DRIVE_ABCI_VALIDATOR_SET_QUORUM_DKG_INTERVAL:?err}
- VALIDATOR_SET_QUORUM_ACTIVE_SIGNERS=${PLATFORM_DRIVE_ABCI_VALIDATOR_SET_QUORUM_ACTIVE_SIGNERS:?err}
- VALIDATOR_SET_QUORUM_ROTATION=${PLATFORM_DRIVE_ABCI_VALIDATOR_SET_QUORUM_ROTATION:?err}
- CHAIN_LOCK_QUORUM_TYPE=${PLATFORM_DRIVE_ABCI_CHAIN_LOCK_QUORUM_LLMQ_TYPE:?err}
- CHAIN_LOCK_QUORUM_WINDOW=${PLATFORM_DRIVE_ABCI_CHAIN_LOCK_QUORUM_DKG_INTERVAL:?err}
- CHAIN_LOCK_QUORUM_ACTIVE_SIGNERS=${PLATFORM_DRIVE_ABCI_CHAIN_LOCK_QUORUM_ACTIVE_SIGNERS:?err}
- CHAIN_LOCK_QUORUM_ROTATION=${PLATFORM_DRIVE_ABCI_CHAIN_LOCK_QUORUM_ROTATION:?err}
- INSTANT_LOCK_QUORUM_TYPE=${PLATFORM_DRIVE_ABCI_INSTANT_LOCK_QUORUM_LLMQ_TYPE:?err}
- INSTANT_LOCK_QUORUM_WINDOW=${PLATFORM_DRIVE_ABCI_INSTANT_LOCK_QUORUM_DKG_INTERVAL:?err}
- INSTANT_LOCK_QUORUM_ACTIVE_SIGNERS=${PLATFORM_DRIVE_ABCI_INSTANT_LOCK_QUORUM_ACTIVE_SIGNERS:?err}
- INSTANT_LOCK_QUORUM_ROTATION=${PLATFORM_DRIVE_ABCI_INSTANT_LOCK_QUORUM_ROTATION:?err}
- DB_PATH=/var/lib/dash/rs-drive-abci/db
- ABCI_CONSENSUS_BIND_ADDRESS=tcp://0.0.0.0:26658
- GRPC_BIND_ADDRESS=0.0.0.0:26670
Expand Down
54 changes: 37 additions & 17 deletions packages/dashmate/src/config/configJsonSchema.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,28 @@ export default {
additionalProperties: false,
required: ['enabled', 'host', 'port'],
},
quorum: {
type: 'object',
properties: {
llmqType: {
type: 'integer',
enum: [1, 2, 3, 4, 5, 6, 100, 101, 102, 103, 104, 105, 106, 107],
},
dkgInterval: {
type: 'integer',
minimum: 1,
},
activeSigners: {
type: 'integer',
minimum: 1,
},
rotation: {
type: 'boolean',
},
},
required: ['llmqType', 'dkgInterval', 'activeSigners', 'rotation'],
additionalProperties: false,
},
},
properties: {
description: {
Expand Down Expand Up @@ -788,34 +810,32 @@ export default {
validatorSet: {
type: 'object',
properties: {
llmqType: {
type: 'number',
// https://github.com/dashpay/dashcore-lib/blob/843176fed9fc81feae43ccf319d99e2dd942fe1f/lib/constants/index.js#L50-L99
enum: [1, 2, 3, 4, 5, 6, 100, 101, 102, 103, 104, 105, 106, 107],
quorum: {
$ref: '#/definitions/quorum',
},
},
additionalProperties: false,
required: ['llmqType'],
required: ['quorum'],
},
chainLock: {
type: 'object',
properties: {
llmqType: {
type: 'number',
// https://github.com/dashpay/dashcore-lib/blob/843176fed9fc81feae43ccf319d99e2dd942fe1f/lib/constants/index.js#L50-L99
enum: [1, 2, 3, 4, 5, 6, 100, 101, 102, 103, 104, 105, 106, 107],
},
llmqSize: {
type: 'integer',
minimum: 0,
quorum: {
$ref: '#/definitions/quorum',
},
dkgInterval: {
type: 'integer',
minimum: 0,
},
additionalProperties: false,
required: ['quorum'],
},
instantLock: {
type: 'object',
properties: {
quorum: {
$ref: '#/definitions/quorum',
},
},
additionalProperties: false,
required: ['llmqType', 'llmqSize', 'dkgInterval'],
required: ['quorum'],
},
epochTime: {
type: 'integer',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ export default function scheduleRenewZeroSslCertificateFactory(

await tasks.run({
expirationDays: Certificate.EXPIRATION_LIMIT_DAYS,
noRetry: true,
});

// Write config files
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export default function configureTenderdashTaskFactory() {

config.set(
'platform.drive.tenderdash.genesis.validator_quorum_type',
config.get('platform.drive.abci.validatorSet.llmqType'),
config.get('platform.drive.abci.validatorSet.quorum.llmqType'),
);
});
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ export default function enableCoreQuorumsTaskFactory(generateBlocks) {
// eslint-disable-next-line prefer-destructuring
ctx.quorumHash = quorumList[LLMQ_TYPE_TEST_PLATFORM][0];

const llmqType = ctx.masternodeCoreServices[0].getConfig().get('platform.drive.abci.validatorSet.llmqType');
const llmqType = ctx.masternodeCoreServices[0].getConfig().get('platform.drive.abci.validatorSet.quorum.llmqType');

const { result: quorumInfo } = await ctx.seedRpcClient.quorum('info', llmqType, ctx.quorumHash);

Expand Down
8 changes: 4 additions & 4 deletions packages/dashmate/test/unit/commands/config/set.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,18 +42,18 @@ describe('Config set command', () => {
const command = new ConfigSetCommand();

await command.runWithDependencies({
option: 'platform.drive.abci.validatorSet.llmqType',
option: 'platform.drive.abci.validatorSet.quorum.llmqType',
value: 107,
}, flags, config);

expect(config.get('platform.drive.abci.validatorSet.llmqType')).to.equal(107);
expect(config.get('platform.drive.abci.validatorSet.quorum.llmqType')).to.equal(107);

await command.runWithDependencies({
option: 'platform.drive.abci.validatorSet.llmqType',
option: 'platform.drive.abci.validatorSet.quorum.llmqType',
value: '107',
}, flags, config);

expect(config.get('platform.drive.abci.validatorSet.llmqType')).to.equal(107);
expect(config.get('platform.drive.abci.validatorSet.quorum.llmqType')).to.equal(107);
});

it('should allow setting booleans', async () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/js-dapi-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
"eslint-plugin-import": "^2.29.0",
"eslint-plugin-jsdoc": "^46.9.0",
"events": "^3.3.0",
"karma": "^6.4.1",
"karma": "^6.4.3",
"karma-chai": "^0.1.0",
"karma-chrome-launcher": "^3.1.0",
"karma-firefox-launcher": "^2.1.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/js-dash-sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
"eslint-plugin-import": "^2.29.0",
"events": "^3.3.0",
"https-browserify": "^1.0.0",
"karma": "^6.4.1",
"karma": "^6.4.3",
"karma-chai": "^0.1.0",
"karma-chrome-launcher": "^3.1.0",
"karma-firefox-launcher": "^2.1.2",
Expand Down
Loading

0 comments on commit 15d2384

Please sign in to comment.