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
42 changes: 21 additions & 21 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion packages/dapi-grpc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ serde = ["dep:serde", "dep:serde_bytes", "tenderdash-proto/serde"]
mocks = ["serde", "dep:serde_json"]

[dependencies]
tenderdash-proto = { git = "https://github.com/dashpay/rs-tenderdash-abci", tag = "v1.8.1", default-features = false }
tenderdash-proto = { git = "https://github.com/dashpay/rs-tenderdash-abci", tag = "v2.0.0-dev.2", default-features = false }

prost = { version = "0.14" }
futures-core = "0.3.30"
Expand Down
2 changes: 1 addition & 1 deletion packages/dashmate/configs/defaults/getBaseConfigFactory.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*/
export default function getBaseConfigFactory() {
const prereleaseTag = semver.prerelease(version) === null ? '' : `-${semver.prerelease(version)[0]}`;
const dockerImageVersion = `${semver.major(version)}${prereleaseTag}`;

Check warning on line 19 in packages/dashmate/configs/defaults/getBaseConfigFactory.js

View workflow job for this annotation

GitHub Actions / JS packages / Linting

'dockerImageVersion' is assigned a value but never used

/**
* @typedef {function} getBaseConfig
Expand Down Expand Up @@ -379,7 +379,7 @@
tenderdash: {
mode: 'full',
docker: {
image: 'dashpay/tenderdash:1.8',
image: 'dashpay/tenderdash:2.0.0-dev.2',
},
p2p: {
host: '0.0.0.0',
Expand Down
25 changes: 25 additions & 0 deletions packages/dashmate/configs/getConfigFileMigrationsFactory.js
Original file line number Diff line number Diff line change
Expand Up @@ -1899,6 +1899,31 @@ export default function getConfigFileMigrationsFactory(homeDir, defaultConfigs)

return configFile;
},
// Sorts after every 5.1 prerelease key, so it runs for configs stamped by any 5.1
// prerelease build. Configs stamped 5.1.0 skip any 5.1 prerelease key added later.
'5.1.0': (configFile) => {
Object.entries(configFile.configs)
.forEach(([, options]) => {
const tenderdash = options.platform?.drive?.tenderdash;

if (tenderdash?.docker) {
tenderdash.docker.image = base.get('platform.drive.tenderdash.docker.image');
}

// Tenderdash 2.0 validates the P2P section on start and refuses to run
// with an empty packet payload or more outgoing than total connections.
const p2p = tenderdash?.p2p;
if (p2p?.maxPacketMsgPayloadSize === 0) {
p2p.maxPacketMsgPayloadSize = getDefaultConfigByNetwork(options.network)
.get('platform.drive.tenderdash.p2p.maxPacketMsgPayloadSize');
}
if (p2p?.maxOutgoingConnections > p2p?.maxConnections) {
p2p.maxOutgoingConnections = p2p.maxConnections;
}
});

return configFile;
},
};
}

Expand Down
3 changes: 2 additions & 1 deletion packages/dashmate/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,8 @@ services:
volumes:
- drive_tenderdash:/tenderdash
- ${DASHMATE_HOME_DIR:?err}/${CONFIG_NAME:?err}/platform/drive/tenderdash:/tenderdash/config:ro
stop_grace_period: 10s
# Longer than Tenderdash's 30s --shutdown-timeout, so cleanup can finish before SIGKILL.
stop_grace_period: 40s
profiles:
- platform

Expand Down
2 changes: 1 addition & 1 deletion packages/dashmate/docs/config/tenderdash.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Tenderdash can operate in different modes depending on the node's role in the ne

| Option | Description | Default | Example |
|--------|-------------|---------|---------|
| `platform.drive.tenderdash.docker.image` | Docker image for Tenderdash | `dashpay/tenderdash:1.8` | `dashpay/tenderdash:latest` |
| `platform.drive.tenderdash.docker.image` | Docker image for Tenderdash | `dashpay/tenderdash:2.0.0-dev.2` | `dashpay/tenderdash:latest` |

## P2P

Expand Down
2 changes: 1 addition & 1 deletion packages/dashmate/src/config/configJsonSchema.js
Original file line number Diff line number Diff line change
Expand Up @@ -1169,7 +1169,7 @@ export default {
},
maxPacketMsgPayloadSize: {
type: 'integer',
minimum: 0,
minimum: 1,
},
sendRate: {
type: 'integer',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -541,14 +541,9 @@ unsafe-vote-timeout-delta-override = "{{= it.platform.drive.tenderdash.consensus
# Options:
# 1) "null" (default) - no indexer services.
# 2) "kv" - a simple indexer backed by key-value storage (see DBBackend)
# 3) "psql" - the indexer services backed by PostgreSQL.
# When "kv" or "psql" is chosen "tx.height" and "tx.hash" will always be indexed.
# When "kv" is chosen "tx.height" and "tx.hash" will always be indexed.
indexer = ["kv"]

# The PostgreSQL connection configuration, the connection format:
# postgresql://<user>:<password>@<host>:<port>/<db>?<opts>
psql-conn = ""

#######################################################
### Instrumentation Configuration Options ###
#######################################################
Expand Down
Original file line number Diff line number Diff line change
@@ -1,29 +1,36 @@
import fs from 'fs';
import path from 'path';
import getBaseConfigFactory from '../../../../configs/defaults/getBaseConfigFactory.js';
import getLocalConfigFactory from '../../../../configs/defaults/getLocalConfigFactory.js';
import getConfigFileMigrationsFactory from '../../../../configs/getConfigFileMigrationsFactory.js';
import InvalidOptionError from '../../../../src/config/errors/InvalidOptionError.js';
import getConfigFormatVersion from '../../../../src/config/configFile/getConfigFormatVersion.js';
import migrateConfigFileFactory from '../../../../src/config/configFile/migrateConfigFileFactory.js';
import { PACKAGE_ROOT_DIR } from '../../../../src/constants.js';

describe('Tenderdash image migration', () => {
const { version } = JSON.parse(fs.readFileSync(path.join(PACKAGE_ROOT_DIR, 'package.json'), 'utf8'));
const base = getBaseConfigFactory()();
const defaults = new Map(['base', 'mainnet', 'testnet'].map((name) => [name, base]));
const getBaseConfig = getBaseConfigFactory();
const base = getBaseConfig();
const local = getLocalConfigFactory(getBaseConfig)();
const defaults = new Map([
...['base', 'mainnet', 'testnet'].map((name) => [name, base]),
['local', local],
]);
const getMigrations = getConfigFileMigrationsFactory(null, defaults);
const migrateConfigFile = migrateConfigFileFactory(getMigrations);

it('should use the floating 1.8 tag for new configurations', () => {
expect(base.get('platform.drive.tenderdash.docker.image')).to.equal('dashpay/tenderdash:1.8');
it('should use the Tenderdash 2.0.0-dev.2 image for new configurations', () => {
expect(base.get('platform.drive.tenderdash.docker.image')).to.equal('dashpay/tenderdash:2.0.0-dev.2');
});

for (const fromVersion of ['4.2.0-dev.1', '4.2.0-beta.3']) {
for (const fromVersion of ['4.2.0-dev.1', '4.2.0-beta.3', '5.0.0-rc.3', '5.0.3']) {
it(`should migrate pinned images from config format ${fromVersion}`, () => {
const configFileData = {
configFormatVersion: fromVersion,
configs: {
mainnet: { platform: { drive: { tenderdash: { docker: { image: 'dashpay/tenderdash:1.8.0' } } } } },
testnet: { platform: { drive: { tenderdash: { docker: { image: 'dashpay/tenderdash:1.7' } } } } },
mainnet: { platform: { drive: { tenderdash: { docker: { image: 'dashpay/tenderdash:1.8' } } } } },
testnet: { platform: { drive: { tenderdash: { docker: { image: 'dashpay/tenderdash:1.8.2' } } } } },
withoutPlatform: {},
withoutDocker: { platform: { drive: { tenderdash: {} } } },
},
Expand All @@ -33,7 +40,7 @@ describe('Tenderdash image migration', () => {

for (const name of ['mainnet', 'testnet']) {
expect(migrated.configs[name].platform.drive.tenderdash.docker.image)
.to.equal('dashpay/tenderdash:1.8');
.to.equal('dashpay/tenderdash:2.0.0-dev.2');
}
expect(migrated.configs.withoutPlatform).to.deep.equal({});
expect(migrated.configs.withoutDocker).to.deep.equal({
Expand All @@ -46,4 +53,45 @@ describe('Tenderdash image migration', () => {
expect(migrateConfigFile(migrated, migrated.configFormatVersion, version)).to.equal(migrated);
});
}

describe('P2P settings Tenderdash 2.0 refuses to start with', () => {
function migrateP2p(configs) {
return migrateConfigFile({ configFormatVersion: '5.0.3', configs }, '5.0.3', version).configs;
}

function p2pConfig(network, p2p) {
return { network, platform: { drive: { tenderdash: { docker: {}, p2p } } } };
}

it('should reject a zero maxPacketMsgPayloadSize', () => {
const config = getBaseConfig();

expect(() => config.set('platform.drive.tenderdash.p2p.maxPacketMsgPayloadSize', 0))
.to.throw(InvalidOptionError);
});

it('should reset a zero maxPacketMsgPayloadSize to the network default', () => {
const configs = migrateP2p({
mainnet: p2pConfig('mainnet', { maxPacketMsgPayloadSize: 0 }),
local: p2pConfig('local', { maxPacketMsgPayloadSize: 0 }),
custom: p2pConfig('testnet', { maxPacketMsgPayloadSize: 4096 }),
});

expect(configs.mainnet.platform.drive.tenderdash.p2p.maxPacketMsgPayloadSize).to.equal(10240);
expect(configs.local.platform.drive.tenderdash.p2p.maxPacketMsgPayloadSize).to.equal(1024);
expect(configs.custom.platform.drive.tenderdash.p2p.maxPacketMsgPayloadSize).to.equal(4096);
});

it('should cap maxOutgoingConnections at maxConnections', () => {
const configs = migrateP2p({
above: p2pConfig('mainnet', { maxConnections: 20, maxOutgoingConnections: 30 }),
equal: p2pConfig('mainnet', { maxConnections: 30, maxOutgoingConnections: 30 }),
below: p2pConfig('mainnet', { maxConnections: 64, maxOutgoingConnections: 30 }),
});

expect(configs.above.platform.drive.tenderdash.p2p.maxOutgoingConnections).to.equal(20);
expect(configs.equal.platform.drive.tenderdash.p2p.maxOutgoingConnections).to.equal(30);
expect(configs.below.platform.drive.tenderdash.p2p.maxOutgoingConnections).to.equal(30);
});
});
});
2 changes: 1 addition & 1 deletion packages/rs-drive-abci/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ tracing-subscriber = { version = "0.3.22", default-features = false, features =
"registry",
"tracing-log",
], optional = false }
tenderdash-abci = { git = "https://github.com/dashpay/rs-tenderdash-abci", tag = "v1.8.1", features = [
tenderdash-abci = { git = "https://github.com/dashpay/rs-tenderdash-abci", tag = "v2.0.0-dev.2", features = [
"grpc",
] }
time = { version = "0.3", optional = true, features = [
Expand Down
Loading
Loading