Skip to content

Commit

Permalink
Merge branch 'v1.3-dev' into feat/emergencyVersionUpgrades
Browse files Browse the repository at this point in the history
  • Loading branch information
QuantumExplorer authored Sep 18, 2024
2 parents daf3b28 + f2ded52 commit f762bcc
Show file tree
Hide file tree
Showing 53 changed files with 3,008 additions and 677 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ const {
GetTotalCreditsInPlatformResponse: PBJSGetTotalCreditsInPlatformResponse,
GetStatusRequest: PBJSGetStatusRequest,
GetStatusResponse: PBJSGetStatusResponse,
GetIdentityBalanceRequest: PBJSGetIdentityBalanceRequest,
GetIdentityBalanceResponse: PBJSGetIdentityBalanceResponse,
},
},
},
Expand All @@ -88,6 +90,7 @@ const {
GetIdentityKeysResponse: ProtocGetIdentityKeysResponse,
GetTotalCreditsInPlatformResponse: ProtocGetTotalCreditsInPlatformResponse,
GetStatusResponse: ProtocGetStatusResponse,
GetIdentityBalanceResponse: ProtocGetIdentityBalanceResponse,
} = require('./platform_protoc');

const getPlatformDefinition = require('../../../../lib/getPlatformDefinition');
Expand Down Expand Up @@ -186,6 +189,10 @@ class PlatformPromiseClient {
this.client.getStatus.bind(this.client),
);

this.client.getIdentityBalance = promisify(
this.client.getIdentityBalance.bind(this.client),
);

this.protocolVersion = undefined;
}

Expand Down Expand Up @@ -762,6 +769,35 @@ class PlatformPromiseClient {
);
}

getIdentityBalance(
getIdentityBalanceRequest,
metadata = {},
options = {},
) {
if (!isObject(metadata)) {
throw new Error('metadata must be an object');
}

return this.client.getIdentityBalance(
getIdentityBalanceRequest,
convertObjectToMetadata(metadata),
{
interceptors: [
jsonToProtobufInterceptorFactory(
jsonToProtobufFactory(
ProtocGetIdentityBalanceResponse,
PBJSGetIdentityBalanceResponse,
),
protobufToJsonFactory(
PBJSGetIdentityBalanceRequest,
),
),
],
...options,
},
);
}

/**
* @param {string} protocolVersion
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ describe('PlatformPromiseClient', () => {
getIdentityContractNonce: this.sinon.stub().resolves(response),
getIdentityNonce: this.sinon.stub().resolves(response),
getIdentityKeys: this.sinon.stub().resolves(response),
getIdentityBalance: this.sinon.stub().resolves(response),
};
});

Expand Down Expand Up @@ -170,4 +171,14 @@ describe('PlatformPromiseClient', () => {
.to.be.calledOnceWith(request);
});
});

describe('#getIdentityBalance', () => {
it('should get identity balance', async () => {
const result = await platformPromiseClient.getIdentityBalance(request);

expect(result).to.equal(response);
expect(platformPromiseClient.client.getIdentityBalance)
.to.be.calledOnceWith(request);
});
});
});
73 changes: 50 additions & 23 deletions packages/dashmate/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ Distribution package for Dash node installation
- [Restart node](#restart-node)
- [Show node status](#show-node-status)
- [Execute Core CLI command](#execute-core-cli-command)
- [Doctor](#doctor)
- [Reset node data](#reset-node-data)
- [Full node](#full-node)
- [Node groups](#node-groups)
Expand Down Expand Up @@ -277,6 +278,55 @@ $ dashmate core cli "getblockcount"
1337
```

### Doctor

The `doctor` command analyzes the node configuration and state to provide a list of potential problems and solutions.

```
Dashmate node diagnostic. Bring your node to the doctor
USAGE
$ dashmate doctor [--config <value>] [-v] [-s <value>]
FLAGS
-s, --samples=<value> path to the samples archive
-v, --verbose use verbose mode for output
--config=<value> configuration name to use
DESCRIPTION
Dashmate node diagnostic. Bring your node to the doctor
COMMANDS
doctor report Dashmate node diagnostic report
```

The `doctor report` command collects all useful debugging info into a `.tar.gz` archive in your current working directory.

The archive will include:

- System information
- The node configuration
- Service logs, metrics and status

Collected data will not contain any private information which is already not available publicly.
All sensitive data like private keys or passwords is obfuscated.

```
Dashmate node diagnostic report
USAGE
$ dashmate doctor report [--config <value>] [-v]
FLAGS
-v, --verbose use verbose mode for output
--config=<value> configuration name to use
DESCRIPTION
Dashmate node diagnostic report
The command collects diagnostic information and creates an obfuscated archive for further investigation
```

### Reset node data

The `reset` command removes all data corresponding to the specified config and allows you to start a node from scratch.
Expand Down Expand Up @@ -340,29 +390,6 @@ DESCRIPTION
Reindex Core data
```

### Full node
It is also possible to start a full node instead of a masternode. Modify the config setting as follows:
```bash
dashmate config set core.masternode.enable false
```
### Doctor

The `doctor` command collects all useful debugging info into a .tar archive in your current working directory.

Archive will contain all core and platform debugging data and logs for each running service.

```
USAGE
$ dashmate doctor [--config <value>] [-v]
FLAGS
-v, --verbose use verbose mode for output
--config=<value> configuration name to use
DESCRIPTION
Generate a report about masternode
```

### Full node
It is also possible to start a full node instead of a masternode. Modify the config setting as follows:
```bash
Expand Down
15 changes: 10 additions & 5 deletions packages/dashmate/configs/defaults/getBaseConfigFactory.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const { version } = JSON.parse(fs.readFileSync(path.join(PACKAGE_ROOT_DIR, 'pack
* @param {HomeDir} homeDir
* @returns {getBaseConfig}
*/
export default function getBaseConfigFactory(homeDir) {
export default function getBaseConfigFactory() {
const prereleaseTag = semver.prerelease(version) === null ? '' : `-${semver.prerelease(version)[0]}`;
const dockerImageVersion = `${semver.major(version)}${prereleaseTag}`;

Expand Down Expand Up @@ -134,12 +134,17 @@ export default function getBaseConfigFactory(homeDir) {
},
},
log: {
file: {
categories: [],
path: homeDir.joinPath('logs', 'base', 'core.log'),
filePath: null,
debug: {
enabled: false,
ips: false,
sourceLocations: false,
threadNames: false,
timeMicros: false,
includeOnly: [],
exclude: [],
},
},
logIps: 0,
indexes: [],
},
platform: {
Expand Down
7 changes: 0 additions & 7 deletions packages/dashmate/configs/defaults/getMainnetConfigFactory.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,6 @@ export default function getMainnetConfigFactory(homeDir, getBaseConfig) {
subnet: '172.26.24.0/24',
},
},
core: {
log: {
file: {
path: homeDir.joinPath('logs', 'mainnet', 'core.log'),
},
},
},
network: NETWORK_MAINNET,
platform: {
enable: false,
Expand Down
5 changes: 0 additions & 5 deletions packages/dashmate/configs/defaults/getTestnetConfigFactory.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,6 @@ export default function getTestnetConfigFactory(homeDir, getBaseConfig) {
rpc: {
port: 19998,
},
log: {
file: {
path: homeDir.joinPath('logs', 'testnet', 'core.log'),
},
},
spork: {
address: 'yjPtiKh2uwk3bDutTEA2q9mCtXyiZRWn55',
},
Expand Down
27 changes: 26 additions & 1 deletion packages/dashmate/configs/getConfigFileMigrationsFactory.js
Original file line number Diff line number Diff line change
Expand Up @@ -853,11 +853,36 @@ export default function getConfigFileMigrationsFactory(homeDir, defaultConfigs)
});
return configFile;
},
'1.3.0-dev.2': (configFile) => {
'1.3.0-dev.3': (configFile) => {
Object.entries(configFile.configs)
.forEach(([, options]) => {
options.platform.drive.abci.docker.image = 'dashpay/drive:1-dev';
options.platform.dapi.api.docker.image = 'dashpay/dapi:1-dev';

// Update core log settings
options.core.log.filePath = null;
options.core.log.debug = {
enabled: false,
ips: !!options.core.logIps,
sourceLocations: false,
threadNames: false,
timeMicros: false,
includeOnly: [],
exclude: [],
};

// If debug log was enabled
if (options.core.log.file.categories.length > 0) {
options.core.log.filePath = options.core.log.file.path;
options.core.log.debug.enabled = true;

if (!options.core.log.file.categories.includes('all')) {
options.core.log.debug.includeOnly = options.core.log.file.categories;
}
}

delete options.core.log.file;
delete options.core.logIps;
});
return configFile;
},
Expand Down
2 changes: 0 additions & 2 deletions packages/dashmate/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ services:
volumes:
- core_data:/home/dash
- ${DASHMATE_HOME_DIR:?err}/${CONFIG_NAME:?err}/core/dash.conf:/home/dash/.dashcore/dash.conf:ro
- ${CORE_LOG_DIRECTORY_PATH:?err}:/var/log/dash
command:
- dashd
stop_grace_period: 30s
Expand Down Expand Up @@ -123,7 +122,6 @@ services:
volumes:
- drive_tenderdash:/tenderdash
- ${DASHMATE_HOME_DIR:?err}/${CONFIG_NAME:?err}/platform/drive/tenderdash:/tenderdash/config:ro
- ${PLATFORM_DRIVE_TENDERDASH_LOG_DIRECTORY_PATH:?err}:/var/log/tenderdash
stop_grace_period: 10s
profiles:
- platform
Expand Down
3 changes: 3 additions & 0 deletions packages/dashmate/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,9 @@
},
"wallet": {
"description": "Wallet related commands"
},
"doctor": {
"description": "Node diagnostics and reporting"
}
},
"topicSeparator": " "
Expand Down
Loading

0 comments on commit f762bcc

Please sign in to comment.