Skip to content

Commit

Permalink
chore(dashmate): add migration for the version param
Browse files Browse the repository at this point in the history
  • Loading branch information
shumkov committed Oct 5, 2024
1 parent 5c99b08 commit 27bb92f
Showing 1 changed file with 288 additions and 5 deletions.
293 changes: 288 additions & 5 deletions packages/dashmate/configs/getConfigFileMigrationsFactory.js
Original file line number Diff line number Diff line change
Expand Up @@ -448,12 +448,151 @@ export default function getConfigFileMigrationsFactory(homeDir, defaultConfigs)
return configFile;
},
'1.0.0-dev.2': (configFile) => {
const genesis = {
base: {
consensus_params: {
block: {
max_bytes: '2097152',
max_gas: '57631392000',
time_iota_ms: '5000',
},
evidence: {
max_age: '100000',
max_age_num_blocks: '100000',
max_age_duration: '172800000000000',
},
validator: {
pub_key_types: ['bls12381'],
},
timeout: {
propose: '50000000000',
propose_delta: '5000000000',
vote: '10000000000',
vote_delta: '1000000000',
},
synchrony: {
message_delay: '70000000000',
precision: '1000000000',
},
abci: {
recheck_tx: true,
},
version: {
app_version: '1',
},
},
},
local: {
consensus_params: {
block: {
max_bytes: '2097152',
max_gas: '57631392000',
time_iota_ms: '5000',
},
evidence: {
max_age: '100000',
max_age_num_blocks: '100000',
max_age_duration: '172800000000000',
},
validator: {
pub_key_types: ['bls12381'],
},
timeout: {
propose: '50000000000',
propose_delta: '5000000000',
vote: '10000000000',
vote_delta: '1000000000',
},
synchrony: {
message_delay: '70000000000',
precision: '1000000000',
},
abci: {
recheck_tx: true,
},
version: {
app_version: '1',
},
},
},
testnet: {
chain_id: 'dash-testnet-51',
validator_quorum_type: 6,
consensus_params: {
block: {
max_bytes: '2097152',
max_gas: '57631392000',
time_iota_ms: '5000',
},
evidence: {
max_age: '100000',
max_age_num_blocks: '100000',
max_age_duration: '172800000000000',
},
validator: {
pub_key_types: ['bls12381'],
},
timeout: {
propose: '50000000000',
propose_delta: '5000000000',
vote: '10000000000',
vote_delta: '1000000000',
},
synchrony: {
message_delay: '70000000000',
precision: '1000000000',
},
abci: {
recheck_tx: true,
},
version: {
app_version: '1',
},
},
},
mainnet: {
chain_id: 'evo1',
validator_quorum_type: 4,
consensus_params: {
block: {
max_bytes: '2097152',
max_gas: '57631392000',
time_iota_ms: '5000',
},
evidence: {
max_age: '100000',
max_age_num_blocks: '100000',
max_age_duration: '172800000000000',
},
validator: {
pub_key_types: ['bls12381'],
},
timeout: {
propose: '50000000000',
propose_delta: '5000000000',
vote: '10000000000',
vote_delta: '1000000000',
},
synchrony: {
message_delay: '70000000000',
precision: '1000000000',
},
abci: {
recheck_tx: true,
},
version: {
app_version: '1',
},
},
},
};

Object.entries(configFile.configs)
.forEach(([name, options]) => {
if (defaultConfigs.has(name)) {
options.platform.drive.tenderdash.genesis = defaultConfigs.get(name)
.get('platform.drive.tenderdash.genesis');
if (genesis[name]) {
options.platform.drive.tenderdash.genesis = genesis[name];
}

options.platform.dapi.api.docker.deploy = base.get('platform.dapi.api.docker.deploy');

let baseConfigName = name;
Expand Down Expand Up @@ -774,6 +913,133 @@ export default function getConfigFileMigrationsFactory(homeDir, defaultConfigs)
return configFile;
},
'1.1.0-dev.1': (configFile) => {
const consensusParams = {
base: {
block: {
max_bytes: '2097152',
max_gas: '57631392000',
time_iota_ms: '5000',
},
evidence: {
max_age: '100000',
max_age_num_blocks: '100000',
max_age_duration: '172800000000000',
},
validator: {
pub_key_types: ['bls12381'],
},
timeout: {
propose: '50000000000',
propose_delta: '5000000000',
vote: '10000000000',
vote_delta: '1000000000',
},
synchrony: {
message_delay: '70000000000',
precision: '1000000000',
},
abci: {
recheck_tx: true,
},
version: {
app_version: '1',
},
},
local: {
block: {
max_bytes: '2097152',
max_gas: '57631392000',
time_iota_ms: '5000',
},
evidence: {
max_age: '100000',
max_age_num_blocks: '100000',
max_age_duration: '172800000000000',
},
validator: {
pub_key_types: ['bls12381'],
},
timeout: {
propose: '50000000000',
propose_delta: '5000000000',
vote: '10000000000',
vote_delta: '1000000000',
},
synchrony: {
message_delay: '70000000000',
precision: '1000000000',
},
abci: {
recheck_tx: true,
},
version: {
app_version: '1',
},
},
testnet: {
block: {
max_bytes: '2097152',
max_gas: '57631392000',
time_iota_ms: '5000',
},
evidence: {
max_age: '100000',
max_age_num_blocks: '100000',
max_age_duration: '172800000000000',
},
validator: {
pub_key_types: ['bls12381'],
},
timeout: {
propose: '50000000000',
propose_delta: '5000000000',
vote: '10000000000',
vote_delta: '1000000000',
},
synchrony: {
message_delay: '70000000000',
precision: '1000000000',
},
abci: {
recheck_tx: true,
},
version: {
app_version: '1',
},
},
mainnet: {
block: {
max_bytes: '2097152',
max_gas: '57631392000',
time_iota_ms: '5000',
},
evidence: {
max_age: '100000',
max_age_num_blocks: '100000',
max_age_duration: '172800000000000',
},
validator: {
pub_key_types: ['bls12381'],
},
timeout: {
propose: '50000000000',
propose_delta: '5000000000',
vote: '10000000000',
vote_delta: '1000000000',
},
synchrony: {
message_delay: '70000000000',
precision: '1000000000',
},
abci: {
recheck_tx: true,
},
version: {
app_version: '1',
},
},
};

Object.entries(configFile.configs)
.forEach(([name, options]) => {
if (name === 'local') {
Expand All @@ -792,8 +1058,12 @@ export default function getConfigFileMigrationsFactory(homeDir, defaultConfigs)

options.platform.drive.tenderdash.p2p.maxConnections = 64;
options.platform.drive.tenderdash.p2p.maxOutgoingConnections = 30;
options.platform.drive.tenderdash.genesis
.consensus_params = base.get('platform.drive.tenderdash.genesis.consensus_params');

if (consensusParams[name]) {
options.platform.drive.tenderdash.genesis
.consensus_params = consensusParams[name];
}

options.platform.drive.tenderdash.docker.image = base.get('platform.drive.tenderdash.docker.image');
});
return configFile;
Expand Down Expand Up @@ -911,6 +1181,19 @@ export default function getConfigFileMigrationsFactory(homeDir, defaultConfigs)
});
return configFile;
},
'1.4.0-dev.4': (configFile) => {
Object.entries(configFile.configs)
.forEach(([name, options]) => {
if (name === 'base' || name === 'local') {
delete options.platform.drive.tenderdash.genesis.consensus_params.version;
} else if (options.network === NETWORK_TESTNET) {
options.platform.drive.tenderdash.genesis.consensus_params.version = {
app_version: '1',
};
}
});
return configFile;
},
};
}

Expand Down

0 comments on commit 27bb92f

Please sign in to comment.