Skip to content

Commit

Permalink
Enable Genesis mode - transitory approach
Browse files Browse the repository at this point in the history
  • Loading branch information
saratomaz committed Jan 17, 2025
1 parent 9203720 commit 0f1d040
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 23 deletions.
20 changes: 10 additions & 10 deletions .buildkite/node_sync_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,18 @@ echo " ==== importing packages from nix (https://search.nixos.org/packages)"
python3 -c "import requests, pandas, psutil, pymysql;"

env=$1
build_mode=$2
node_rev1=$3
tag_no1=$4
node_topology1=$5
node_start_arguments1=$6
node_rev2=$7
tag_no2=$8
node_topology2=$9
node_start_arguments2=${10}
node_rev1=$2
tag_no1=$3
node_topology1=$4
node_start_arguments1=$5
node_rev2=$6
tag_no2=$7
node_topology2=$8
node_start_arguments2=$9
use_genesis_mode=${10}

echo " ==== start sync test"
python ./sync_tests/tests/node_sync_test.py -b "$build_mode" -e "$env" -t1 "$tag_no1" -t2 "$tag_no2" -r1 "$node_rev1" -r2 "$node_rev2" -n1 "$node_topology1" -n2 "$node_topology2" -a1="$node_start_arguments1" -a2="$node_start_arguments2"
python ./sync_tests/tests/node_sync_test.py -e "$env" -t1 "$tag_no1" -t2 "$tag_no2" -r1 "$node_rev1" -r2 "$node_rev2" -n1 "$node_topology1" -n2 "$node_topology2" -a1="$node_start_arguments1" -a2="$node_start_arguments2" -g "${use_genesis_mode}"

echo "--- Prepare for adding sync test results to the AWS Database"
python ./sync_tests/tests/node_write_sync_values_to_db.py -e "$env"
2 changes: 1 addition & 1 deletion .buildkite/node_sync_tests.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
steps:
- label: ':drum_with_drumsticks: Run the Cardano node sync test on Mainnet using a Linux machine'
commands:
- nix develop --accept-flake-config .#python --command python ./sync_tests/tests/node_sync_test.py -b "${build_mode}" -e "${env}" -t1 "${tag_no1}" -t2 "${tag_no2}" -r1 "${node_rev1}" -r2 "${node_rev2}" -n1 "${node_topology1}" -n2 "${node_topology2}" -a1 "${node_start_arguments1}" -a2 "${node_start_arguments2}"
- nix develop --accept-flake-config .#python --command python ./sync_tests/tests/node_sync_test.py -e "${env}" -t1 "${tag_no1}" -t2 "${tag_no2}" -r1 "${node_rev1}" -r2 "${node_rev2}" -n1 "${node_topology1}" -n2 "${node_topology2}" -a1 "${node_start_arguments1}" -a2 "${node_start_arguments2}" -g "${use_genesis_mode}"
timeout_in_minutes: 3000
agents:
system: x86_64-linux
Expand Down
15 changes: 6 additions & 9 deletions .github/workflows/node_sync_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,6 @@ on:
- preview
- shelley-qa
default: preprod
build_mode:
description: "build-mode"
type: choice
options:
- nix
default: nix
tag_no1:
description: "Initial sync - Graph axis label"
required: true
Expand Down Expand Up @@ -56,6 +50,9 @@ on:
description: "Upgrade node - Extra arguments when starting the node"
required: false
default: "None"
use_genesis_mode:
description: "Use Ouroboros Genesis mode"
default: false


jobs:
Expand Down Expand Up @@ -100,7 +97,6 @@ jobs:
BLOCKFROST_API_KEY: ${{ secrets.BLOCKFROST_API_KEY }}
BUILD_ENV_VARS: '{
"env":"${{ github.event.inputs.environment }}",
"build_mode":"${{ github.event.inputs.build_mode }}",
"node_rev1":"${{ steps.get_tag.outputs.node_rev1 }}",
"node_rev2":"${{ github.event.inputs.node_rev2 }}",
"tag_no1":"${{ github.event.inputs.tag_no1 }}",
Expand All @@ -109,6 +105,7 @@ jobs:
"node_topology2":"${{ github.event.inputs.node_topology2 }}",
"node_start_arguments1":"${{ github.event.inputs.node_start_arguments1 }}",
"node_start_arguments2":"${{ github.event.inputs.node_start_arguments2 }}",
"use_genesis_mode":"${{ github.event.inputs.use_genesis_mode }}",
"BLOCKFROST_API_KEY":"${{ secrets.BLOCKFROST_API_KEY }}",
"AWS_DB_USERNAME":"${{ secrets.AWS_DB_USERNAME }}",
Expand Down Expand Up @@ -165,15 +162,15 @@ jobs:
run: |
nix develop --accept-flake-config .#python --command python -m sync_tests.tests.node_sync_test \
-e ${{ matrix.env }} \
-b ${{ github.event.inputs.build_mode }} \
-t1 "${{ github.event.inputs.tag_no1 }}" \
-t2 "${{ github.event.inputs.tag_no2 }}" \
-r1 "${{ github.event.inputs.node_rev1 }}" \
-r2 "${{ github.event.inputs.node_rev2 }}" \
-n1 "${{ github.event.inputs.node_topology1 }}" \
-n2 "${{ github.event.inputs.node_topology2 }}" \
-a1="${{ github.event.inputs.node_start_arguments1 }}" \
-a2="${{ github.event.inputs.node_start_arguments2 }}"
-a2="${{ github.event.inputs.node_start_arguments2 }}"\
-g="${{ github.event.inputs.use_genesis_mode }}"
- name: Write the test results into the database
env:
Expand Down
22 changes: 19 additions & 3 deletions sync_tests/tests/node_sync_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,16 @@ def disable_p2p_node_config():
update_config('config.json', updates)


def enable_genesis_mode():
os.chdir(Path(ROOT_TEST_PATH))
current_directory = Path.cwd()
print(f"current_directory: {current_directory}")
print(f" - listdir current_directory: {os.listdir(current_directory)}")

update_config(file_name="config.json", updates={"ConsensusMode": "GenesisMode"})
update_config(file_name="topology.json", updates={"peerSnapshotFile": "/path/to/snapshot.json"})


def rm_node_config_files() -> None:
utils.print_message(type="info_warn", message='Removing existing config files')
os.chdir(Path(ROOT_TEST_PATH))
Expand All @@ -103,7 +113,7 @@ def download_config_file(env: str, file_name: str, save_as: str = None) -> None:
urllib.request.urlretrieve(url, save_as)


def get_node_config_files(env, node_topology_type):
def get_node_config_files(env, node_topology_type, use_genesis_mode=False):
os.chdir(Path(ROOT_TEST_PATH))
current_directory = Path.cwd()
print(f"current_directory: {current_directory}")
Expand All @@ -120,6 +130,10 @@ def get_node_config_files(env, node_topology_type):
disable_p2p_node_config()
else:
download_config_file(env, 'topology.json')

if use_genesis_mode:
enable_genesis_mode()

print(f" - listdir current_directory: {os.listdir(current_directory)}")
utils.print_message(type="info_warn", message=" Config File Content: ")
utils.print_file_content('config.json')
Expand Down Expand Up @@ -753,7 +767,7 @@ def main():
utils.print_message(type="info", message=f"Test start time: {start_test_time}")
utils.print_message(type="warn", message='Test parameters:')
env = utils.get_arg_value(args=args, key="environment")
node_build_mode = utils.get_arg_value(args=args, key="build_mode")
node_build_mode = "nix"
node_rev1 = utils.get_arg_value(args=args, key="node_rev1")
node_rev2 = utils.get_arg_value(args=args, key="node_rev2")
tag_no1 = utils.get_arg_value(args=args, key="tag_no1")
Expand All @@ -762,6 +776,7 @@ def main():
node_topology_type2 = utils.get_arg_value(args=args, key="node_topology2")
node_start_arguments1 = utils.get_arg_value(args=args, key="node_start_arguments1")
node_start_arguments2 = utils.get_arg_value(args=args, key="node_start_arguments2")
use_genesis_mode = utils.get_arg_value(args=args, key="use_genesis_mode")
repository = None
print(f"- env: {env}")
print(f"- node_build_mode: {node_build_mode}")
Expand All @@ -773,6 +788,7 @@ def main():
print(f"- node_topology_type2: {node_topology_type2}")
print(f"- node_start_arguments1: {node_start_arguments1}")
print(f"- node_start_arguments2: {node_start_arguments2}")
print(f"- use_genesis_mode: {use_genesis_mode}")

platform_system, platform_release, platform_version = utils.get_os_type()
print(f"- platform: {platform_system, platform_release, platform_version}")
Expand Down Expand Up @@ -800,7 +816,7 @@ def main():
print('--- Get the node configuration files')
rm_node_config_files()
# TO DO: change the default to P2P when full P2P will be supported on Mainnet
get_node_config_files(env, node_topology_type1)
get_node_config_files(env, node_topology_type1, use_genesis_mode)

print('Enabling the desired cardano node tracers')
enable_cardano_node_resources_monitoring('config.json')
Expand Down

0 comments on commit 0f1d040

Please sign in to comment.