Skip to content

Commit

Permalink
chore(e2e): start local-network with alternate db-sync configuration
Browse files Browse the repository at this point in the history
Because db-sync 13.2.0.1 uses older conway.json config file format than
Cardano Node 8.9.0.
  • Loading branch information
mirceahasegan committed Mar 27, 2024
1 parent 6f865e1 commit d411e8d
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/e2e/docker-compose.yml
Expand Up @@ -20,6 +20,7 @@ services:
CARDANO_NODE_LOG_LEVEL: ${CARDANO_NODE_LOG_LEVEL:-Info}
CARDANO_NODE_CHAINDB_LOG_LEVEL: ${CARDANO_NODE_CHAINDB_LOG_LEVEL:-Notice}
PRE_CONWAY: ${PRE_CONWAY}
DB_SYNC_ALT_CFG_FOLDER: $DB_SYNC_ALT_CFG_FOLDER
ports:
- 3001:3001
volumes:
Expand Down Expand Up @@ -64,7 +65,7 @@ services:
condition: service_healthy
command: ['--config', '/config/cardano-db-sync/config.json', '--socket-path', '/node-ipc/node.socket']
volumes:
- ./local-network/config/network:/config
- ./local-network/config/${DB_SYNC_ALT_CFG_FOLDER:-network}:/config

cardano-submit-api:
volumes:
Expand Down
17 changes: 17 additions & 0 deletions packages/e2e/local-network/scripts/make-babbage.sh
Expand Up @@ -315,6 +315,23 @@ cp "${ROOT}"/genesis/shelley/genesis.alonzo.json ./config/network/genesis/alonzo
cp "${ROOT}"/genesis/shelley/genesis.conway.json ./config/network/cardano-node/genesis/conway.json
cp "${ROOT}"/genesis/shelley/genesis.conway.json ./config/network/genesis/conway.json

# TODO: All this is done for db-sync 13.2.0.1. Remove once db-sync version uses same config files as cardano-node.
# We want to use an alternative conway config for db-sync, so we need to create another folder for it
# The default folder is 'network', so if DB_SYNC_ALT_CFG_FOLDER is 'network', it means no alt cfg is needed
if [ -n "$PRE_CONWAY" ] && [ -n "$DB_SYNC_ALT_CFG_FOLDER" ] && [ "$DB_SYNC_ALT_CFG_FOLDER" != "network" ]; then
# Copy the configurations to the alternative cfg folder
cp -fr ./config/network ./config/$DB_SYNC_ALT_CFG_FOLDER

# Replace the conway.json config file with the custom one for db-sync
CONWAY_GENESIS_DB_SYNC=./templates/babbage/conway-babbage-test-genesis-dbsync.json
cp $CONWAY_GENESIS_DB_SYNC ./config/${DB_SYNC_ALT_CFG_FOLDER}/cardano-node/genesis/conway.json
cp $CONWAY_GENESIS_DB_SYNC ./config/${DB_SYNC_ALT_CFG_FOLDER}/genesis/conway.json

# Compute the hash of the modified conway genesis and update the node config.json
conwayDbSyncGenesisHash=$(cardano-cli genesis hash --genesis $CONWAY_GENESIS_DB_SYNC)
$SED -i -E "s/\"ConwayGenesisHash\": \".*\"/\"ConwayGenesisHash\": \"${conwayDbSyncGenesisHash}\"/" ./config/${DB_SYNC_ALT_CFG_FOLDER}/cardano-node/config.json
fi

mkdir -p "${ROOT}/run"

echo "#!/usr/bin/env bash" >"${ROOT}/run/all.sh"
Expand Down
@@ -0,0 +1,37 @@
{
"poolVotingThresholds": {
"pvtCommitteeNormal": 0.51,
"pvtCommitteeNoConfidence": 0.51,
"pvtHardForkInitiation": 0.51,
"pvtMotionNoConfidence": 0.51
},
"dRepVotingThresholds": {
"dvtMotionNoConfidence": 0.51,
"dvtCommitteeNormal": 0.51,
"dvtCommitteeNoConfidence": 0.51,
"dvtUpdateToConstitution": 0.51,
"dvtHardForkInitiation": 0.51,
"dvtPPNetworkGroup": 0.51,
"dvtPPEconomicGroup": 0.51,
"dvtPPTechnicalGroup": 0.51,
"dvtPPGovGroup": 0.51,
"dvtTreasuryWithdrawal": 0.51
},
"committeeMinSize": 0,
"committeeMaxTermLength": 200,
"govActionLifetime": 2,
"govActionDeposit": 0,
"dRepDeposit": 0,
"dRepActivity": 0,
"constitution": {
"anchor": {
"url": "",
"dataHash": "0000000000000000000000000000000000000000000000000000000000000000"
}
},
"committee": {
"members": {
},
"quorum": 0
}
}

0 comments on commit d411e8d

Please sign in to comment.