From 78033b684aab16a92cb2d7a765cd1c48662ce28b Mon Sep 17 00:00:00 2001 From: Martin Kourim Date: Fri, 25 Oct 2024 19:07:21 +0200 Subject: [PATCH] feat(cluster): add DRep support to cluster scripts Setup DReps in cluster scripts instead of in the framework. - Introduced NUM_DREPS and DREP_DELEGATED variables. - Added logic to generate DRep keys and registration certificates. - Updated transaction building to include DRep registration. - Modified governance setup to load DReps and DRep users. - Adjusted protocol parameters and transaction amounts. --- .../cluster_scripts/conway/start-cluster | 182 +++++++++++++----- .../cluster_scripts/conway_fast/start-cluster | 85 +++++++- cardano_node_tests/utils/governance_setup.py | 91 ++++++--- 3 files changed, 271 insertions(+), 87 deletions(-) diff --git a/cardano_node_tests/cluster_scripts/conway/start-cluster b/cardano_node_tests/cluster_scripts/conway/start-cluster index f3ebf64b7..78b071d4a 100644 --- a/cardano_node_tests/cluster_scripts/conway/start-cluster +++ b/cardano_node_tests/cluster_scripts/conway/start-cluster @@ -25,10 +25,12 @@ fi NUM_BFT_NODES=1 NUM_POOLS=%%NUM_POOLS%% NUM_CC=5 +NUM_DREPS=5 TX_SUBMISSION_DELAY=60 PROPOSAL_DELAY=5 SUBMIT_DELAY=5 POOL_PLEDGE=1000000000000 +DREP_DELEGATED=500000000000 FEE=5000000 @@ -260,8 +262,9 @@ jq -r ' cat "$STATE_CLUSTER/shelley/genesis.json_jq" > "$STATE_CLUSTER/shelley/genesis.json" rm -f "$STATE_CLUSTER/shelley/genesis.json_jq" -# Create committee keys mkdir -p "$STATE_CLUSTER/governance_data" + +# Create committee keys if [ -z "${NO_CC:-""}" ]; then for i in $(seq 1 "$NUM_CC"); do cardano_cli_log conway governance committee key-gen-cold \ @@ -533,6 +536,54 @@ mv "$STATE_CLUSTER/shelley/utxo-keys/utxo1.vkey" "$STATE_CLUSTER/shelley/genesis mv "$STATE_CLUSTER/shelley/utxo-keys/utxo1.skey" "$STATE_CLUSTER/shelley/genesis-utxo.skey" rmdir "$STATE_CLUSTER/shelley/utxo-keys" +KEY_DEPOSIT="$(jq '.protocolParams.keyDeposit' \ + < "$STATE_CLUSTER/shelley/genesis.json")" +DREP_DEPOSIT="$(jq '.dRepDeposit' \ + < "$STATE_CLUSTER/shelley/genesis.conway.json")" + +for i in $(seq 1 "$NUM_DREPS"); do + # DRep + cardano_cli_log conway governance drep key-gen \ + --signing-key-file "$STATE_CLUSTER/governance_data/default_drep_${i}_drep.skey" \ + --verification-key-file "$STATE_CLUSTER/governance_data/default_drep_${i}_drep.vkey" + + # DRep registration + cardano_cli_log conway governance drep registration-certificate \ + --drep-verification-key-file "$STATE_CLUSTER/governance_data/default_drep_${i}_drep.vkey" \ + --key-reg-deposit-amt "$DREP_DEPOSIT" \ + --out-file "$STATE_CLUSTER/governance_data/default_drep_${i}_drep_reg.cert" + + # delegatee payment keys + cardano_cli_log conway address key-gen \ + --signing-key-file "$STATE_CLUSTER/governance_data/vote_stake_addr${i}.skey" \ + --verification-key-file "$STATE_CLUSTER/governance_data/vote_stake_addr${i}.vkey" + + # delegatee stake keys + cardano_cli_log conway stake-address key-gen \ + --signing-key-file "$STATE_CLUSTER/governance_data/vote_stake_addr${i}_stake.skey" \ + --verification-key-file "$STATE_CLUSTER/governance_data/vote_stake_addr${i}_stake.vkey" + + # delegatee payment address + cardano_cli_log conway address build \ + --payment-verification-key-file "$STATE_CLUSTER/governance_data/vote_stake_addr${i}.vkey" \ + --stake-verification-key-file "$STATE_CLUSTER/governance_data/vote_stake_addr${i}_stake.vkey" \ + --testnet-magic "$NETWORK_MAGIC" \ + --out-file "$STATE_CLUSTER/governance_data/vote_stake_addr${i}.addr" + + # delegatee stake address + cardano_cli_log conway stake-address build \ + --stake-verification-key-file "$STATE_CLUSTER/governance_data/vote_stake_addr${i}_stake.vkey" \ + --testnet-magic "$NETWORK_MAGIC" \ + --out-file "$STATE_CLUSTER/governance_data/vote_stake_addr${i}_stake.addr" + + # delegatee stake address registration and vote delegation cert + cardano_cli_log conway stake-address registration-and-vote-delegation-certificate \ + --stake-verification-key-file "$STATE_CLUSTER/governance_data/vote_stake_addr${i}_stake.vkey" \ + --drep-verification-key-file "$STATE_CLUSTER/governance_data/default_drep_${i}_drep.vkey" \ + --key-reg-deposit-amt "$KEY_DEPOSIT" \ + --out-file "$STATE_CLUSTER/governance_data/vote_stake_addr${i}_stake.reg_vote_deleg.cert" +done + # create scripts for cluster starting / stopping printf "#!/bin/sh\n\nsupervisorctl -s http://127.0.0.1:%%SUPERVISOR_PORT%% start all" > "$STATE_CLUSTER/supervisorctl_start" printf "#!/bin/sh\n\nsupervisorctl -s http://127.0.0.1:%%SUPERVISOR_PORT%% restart nodes:" > "$STATE_CLUSTER/supervisorctl_restart_nodes" @@ -1198,63 +1249,90 @@ PROTOCOL_VERSION="$(jq ".protocolVersion.major" < "$STATE_CLUSTER/pparams.json") [ "$PROTOCOL_VERSION" = 9 ] || { echo "Unexpected protocol version '$PROTOCOL_VERSION' on line $LINENO" >&2; exit 1; } # assert -# Register committee members -if [ -z "${NO_CC:-""}" ]; then - STOP_TXIN_AMOUNT=$FEE - - TXINS=() - TXIN_COUNT=0 - TXIN_AMOUNT=0 - while read -r txhash txix amount _; do - TXIN_AMOUNT="$((TXIN_AMOUNT + amount))" - TXIN_COUNT="$((TXIN_COUNT + 1))" - TXINS+=("--tx-in" "${txhash}#${txix}") - if [ "$TXIN_AMOUNT" -ge "$STOP_TXIN_AMOUNT" ]; then - break - fi - done <<< "$(cardano_cli_log latest query utxo --testnet-magic \ - "$NETWORK_MAGIC" \ - --address "$FAUCET_ADDR" | - grep -E "lovelace \+ TxOutDatumNone$")" +# Register CC members, DReps, all in one big transaction: - TXOUT_AMOUNT="$((TXIN_AMOUNT - FEE))" +DREP_DEPOSIT="$((KEY_DEPOSIT + DREP_DEPOSIT))" +DREP_NEEDED_AMOUNT="$(( (DREP_DELEGATED + DREP_DEPOSIT) * NUM_DREPS ))" +STOP_TXIN_AMOUNT="$(( FEE + DREP_NEEDED_AMOUNT))" - V9_TX_NAME="reg_cc_members" +TXINS=() +TXIN_COUNT=0 +TXIN_AMOUNT=0 +while read -r txhash txix amount _; do + TXIN_AMOUNT="$((TXIN_AMOUNT + amount))" + TXIN_COUNT="$((TXIN_COUNT + 1))" + TXINS+=("--tx-in" "${txhash}#${txix}") + if [ "$TXIN_AMOUNT" -ge "$STOP_TXIN_AMOUNT" ]; then + break + fi +done <<< "$(cardano_cli_log latest query utxo --testnet-magic \ + "$NETWORK_MAGIC" \ + --address "$FAUCET_ADDR" | + grep -E "lovelace \+ TxOutDatumNone$")" - CC_ARGS=() - for f in "$STATE_CLUSTER"/governance_data/cc_member*_committee_hot_auth.cert; do - CC_ARGS+=( "--certificate-file" "$f" ) - done +TXOUT_AMOUNT="$((TXIN_AMOUNT - STOP_TXIN_AMOUNT))" - CC_SIGNING=() - for f in "$STATE_CLUSTER"/governance_data/cc_member*_committee_cold.skey; do - CC_SIGNING+=( "--signing-key-file" "$f" ) - done +V9_TX_NAME="setup_governance" - cardano_cli_log conway transaction build-raw \ - --fee "$FEE" \ - "${TXINS[@]}" \ - "${CC_ARGS[@]}" \ - --tx-out "$FAUCET_ADDR+$TXOUT_AMOUNT" \ - --out-file "${V9_TX_NAME}-tx.txbody" - - cardano_cli_log conway transaction sign \ - --signing-key-file "$FAUCET_SKEY" \ - "${CC_SIGNING[@]}" \ - --testnet-magic "$NETWORK_MAGIC" \ - --tx-body-file "${V9_TX_NAME}-tx.txbody" \ - --out-file "${V9_TX_NAME}-tx.tx" - - cardano_cli_log conway transaction submit \ - --tx-file "${V9_TX_NAME}-tx.tx" \ - --testnet-magic "$NETWORK_MAGIC" - - sleep "$SUBMIT_DELAY" - if ! check_spend_success "${TXINS[@]}"; then - echo "Failed to spend Tx inputs, line $LINENO" >&2 # assert - exit 1 - fi +# TODO: delegate pools stake to alwaysAbstain + +CC_ARGS=() +for f in "$STATE_CLUSTER"/governance_data/cc_member*_committee_hot_auth.cert; do + [ -e "$f" ] || continue + CC_ARGS+=( "--certificate-file" "$f" ) +done + +CC_SIGNING=() +for f in "$STATE_CLUSTER"/governance_data/cc_member*_committee_cold.skey; do + [ -e "$f" ] || continue + CC_SIGNING+=( "--signing-key-file" "$f" ) +done + +DREPS_ARGS=() +for i in $(seq 1 "$NUM_DREPS"); do + DREPS_ARGS+=( \ + "--tx-out" "$(<"$STATE_CLUSTER/governance_data/vote_stake_addr${i}.addr")+$DREP_DELEGATED" \ + "--certificate-file" "$STATE_CLUSTER/governance_data/default_drep_${i}_drep_reg.cert" \ + "--certificate-file" "$STATE_CLUSTER/governance_data/vote_stake_addr${i}_stake.reg_vote_deleg.cert" \ + ) +done + +DREPS_SIGNING=() +for i in $(seq 1 "$NUM_DREPS"); do + DREPS_SIGNING+=( \ + "--signing-key-file" "$STATE_CLUSTER/governance_data/default_drep_${i}_drep.skey" \ + "--signing-key-file" "$STATE_CLUSTER/governance_data/vote_stake_addr${i}.skey" \ + "--signing-key-file" "$STATE_CLUSTER/governance_data/vote_stake_addr${i}_stake.skey" \ + ) +done +cardano_cli_log conway transaction build-raw \ + --fee "$FEE" \ + "${TXINS[@]}" \ + "${CC_ARGS[@]}" \ + "${DREPS_ARGS[@]}" \ + --tx-out "$FAUCET_ADDR+$TXOUT_AMOUNT" \ + --out-file "${V9_TX_NAME}-tx.txbody" + +cardano_cli_log conway transaction sign \ + --signing-key-file "$FAUCET_SKEY" \ + "${CC_SIGNING[@]}" \ + "${DREPS_SIGNING[@]}" \ + --testnet-magic "$NETWORK_MAGIC" \ + --tx-body-file "${V9_TX_NAME}-tx.txbody" \ + --out-file "${V9_TX_NAME}-tx.tx" + +cardano_cli_log conway transaction submit \ + --tx-file "${V9_TX_NAME}-tx.tx" \ + --testnet-magic "$NETWORK_MAGIC" + +sleep "$SUBMIT_DELAY" +if ! check_spend_success "${TXINS[@]}"; then + echo "Failed to spend Tx inputs, line $LINENO" >&2 # assert + exit 1 +fi + +if [ -z "${NO_CC:-""}" ]; then cc_size="$(cardano-cli conway query committee-state --active --testnet-magic "$NETWORK_MAGIC" | grep -c '"status": "Active"')" [ "$cc_size" -ge "$NUM_CC" ] || \ diff --git a/cardano_node_tests/cluster_scripts/conway_fast/start-cluster b/cardano_node_tests/cluster_scripts/conway_fast/start-cluster index fb2806601..2559610a4 100644 --- a/cardano_node_tests/cluster_scripts/conway_fast/start-cluster +++ b/cardano_node_tests/cluster_scripts/conway_fast/start-cluster @@ -26,9 +26,11 @@ fi NUM_BFT_NODES=1 NUM_POOLS=%%NUM_POOLS%% NUM_CC=5 +NUM_DREPS=5 TX_SUBMISSION_DELAY=60 SUBMIT_DELAY=5 POOL_PLEDGE=1000000000000 +DREP_DELEGATED=500000000000 BYRON_INIT_SUPPLY=10020000000 PROTOCOL_VERSION=9 if [ -n "${PV10:-""}" ]; then @@ -193,8 +195,9 @@ cardano_cli_log legacy genesis create-staked \ --supply-delegated "$DELEG_SUPPLY" \ --start-time "$START_TIME_SHELLEY" -# Create committee keys mkdir -p "$STATE_CLUSTER/governance_data" + +# Create committee keys if [ -z "${NO_CC:-""}" ]; then for i in $(seq 1 "$NUM_CC"); do cardano_cli_log conway governance committee key-gen-cold \ @@ -427,6 +430,52 @@ done rm -rf "$STATE_CLUSTER/shelley/create_staked" +DREP_DEPOSIT="$(jq '.dRepDeposit' \ + < "$STATE_CLUSTER/shelley/genesis.conway.json")" + +for i in $(seq 1 "$NUM_DREPS"); do + # DRep + cardano_cli_log conway governance drep key-gen \ + --signing-key-file "$STATE_CLUSTER/governance_data/default_drep_${i}_drep.skey" \ + --verification-key-file "$STATE_CLUSTER/governance_data/default_drep_${i}_drep.vkey" + + # DRep registration + cardano_cli_log conway governance drep registration-certificate \ + --drep-verification-key-file "$STATE_CLUSTER/governance_data/default_drep_${i}_drep.vkey" \ + --key-reg-deposit-amt "$DREP_DEPOSIT" \ + --out-file "$STATE_CLUSTER/governance_data/default_drep_${i}_drep_reg.cert" + + # delegatee payment keys + cardano_cli_log conway address key-gen \ + --signing-key-file "$STATE_CLUSTER/governance_data/vote_stake_addr${i}.skey" \ + --verification-key-file "$STATE_CLUSTER/governance_data/vote_stake_addr${i}.vkey" + + # delegatee stake keys + cardano_cli_log conway stake-address key-gen \ + --signing-key-file "$STATE_CLUSTER/governance_data/vote_stake_addr${i}_stake.skey" \ + --verification-key-file "$STATE_CLUSTER/governance_data/vote_stake_addr${i}_stake.vkey" + + # delegatee payment address + cardano_cli_log conway address build \ + --payment-verification-key-file "$STATE_CLUSTER/governance_data/vote_stake_addr${i}.vkey" \ + --stake-verification-key-file "$STATE_CLUSTER/governance_data/vote_stake_addr${i}_stake.vkey" \ + --testnet-magic "$NETWORK_MAGIC" \ + --out-file "$STATE_CLUSTER/governance_data/vote_stake_addr${i}.addr" + + # delegatee stake address + cardano_cli_log conway stake-address build \ + --stake-verification-key-file "$STATE_CLUSTER/governance_data/vote_stake_addr${i}_stake.vkey" \ + --testnet-magic "$NETWORK_MAGIC" \ + --out-file "$STATE_CLUSTER/governance_data/vote_stake_addr${i}_stake.addr" + + # delegatee stake address registration and vote delegation cert + cardano_cli_log conway stake-address registration-and-vote-delegation-certificate \ + --stake-verification-key-file "$STATE_CLUSTER/governance_data/vote_stake_addr${i}_stake.vkey" \ + --drep-verification-key-file "$STATE_CLUSTER/governance_data/default_drep_${i}_drep.vkey" \ + --key-reg-deposit-amt "$KEY_DEPOSIT" \ + --out-file "$STATE_CLUSTER/governance_data/vote_stake_addr${i}_stake.reg_vote_deleg.cert" +done + # create scripts for cluster starting / stopping printf "#!/bin/sh\n\nsupervisorctl -s http://127.0.0.1:%%SUPERVISOR_PORT%% start all" > "$STATE_CLUSTER/supervisorctl_start" printf "#!/bin/sh\n\nsupervisorctl -s http://127.0.0.1:%%SUPERVISOR_PORT%% restart nodes:" > "$STATE_CLUSTER/supervisorctl_restart_nodes" @@ -507,7 +556,7 @@ fi echo "Sleeping for initial Tx submission delay of $TX_SUBMISSION_DELAY seconds" sleep "$TX_SUBMISSION_DELAY" -echo "Re-registering pools" +echo "Re-registering pools, creating CC members and DReps" GENESIS_SIGNING=() for skey in "$STATE_CLUSTER"/shelley/genesis-keys/genesis?.skey; do @@ -519,15 +568,19 @@ for skey in "$STATE_CLUSTER"/shelley/delegate-keys/delegate?.skey; do DELEGATE_SIGNING+=("--signing-key-file" "$skey") done -# Transfer funds, register stake addresses and pools, all in one big transaction: +# Transfer funds, register stake addresses and pools, CC members, DReps, all in one big transaction: cardano_cli_log conway query protocol-parameters \ --testnet-magic "$NETWORK_MAGIC" \ --out-file "$STATE_CLUSTER/pparams.json" +POOL_DEPOSIT="$((KEY_DEPOSIT * 2))" +POOL_NEEDED_AMOUNT="$(( (POOL_PLEDGE + POOL_DEPOSIT) * NUM_POOLS ))" +DREP_DEPOSIT="$((KEY_DEPOSIT + DREP_DEPOSIT))" +DREP_NEEDED_AMOUNT="$(( (DREP_DELEGATED + DREP_DEPOSIT) * NUM_DREPS ))" +NEEDED_AMOUNT="$(( POOL_NEEDED_AMOUNT + DREP_NEEDED_AMOUNT))" + TXIN_ADDR="$(<"$STATE_CLUSTER"/shelley/genesis-utxo.addr)" -DEPOSITS="$((KEY_DEPOSIT * 2))" -NEEDED_AMOUNT="$(( (POOL_PLEDGE + DEPOSITS) * NUM_POOLS ))" FEE_BUFFER=100000000 STOP_TXIN_AMOUNT="$((NEEDED_AMOUNT + FEE_BUFFER))" @@ -578,13 +631,32 @@ for f in "$STATE_CLUSTER"/governance_data/cc_member*_committee_cold.skey; do CC_SIGNING+=( "--signing-key-file" "$f" ) done -WITNESS_COUNT="$((${#POOL_SIGNING[@]} + ${#GENESIS_SIGNING[@]} + ${#DELEGATE_SIGNING[@]} + ${#CC_SIGNING[@]} + 1))" +DREPS_ARGS=() +for i in $(seq 1 "$NUM_DREPS"); do + DREPS_ARGS+=( \ + "--tx-out" "$(<"$STATE_CLUSTER/governance_data/vote_stake_addr${i}.addr")+$DREP_DELEGATED" \ + "--certificate-file" "$STATE_CLUSTER/governance_data/default_drep_${i}_drep_reg.cert" \ + "--certificate-file" "$STATE_CLUSTER/governance_data/vote_stake_addr${i}_stake.reg_vote_deleg.cert" \ + ) +done + +DREPS_SIGNING=() +for i in $(seq 1 "$NUM_DREPS"); do + DREPS_SIGNING+=( \ + "--signing-key-file" "$STATE_CLUSTER/governance_data/default_drep_${i}_drep.skey" \ + "--signing-key-file" "$STATE_CLUSTER/governance_data/vote_stake_addr${i}.skey" \ + "--signing-key-file" "$STATE_CLUSTER/governance_data/vote_stake_addr${i}_stake.skey" \ + ) +done + +WITNESS_COUNT="$((${#POOL_SIGNING[@]} + ${#GENESIS_SIGNING[@]} + ${#DELEGATE_SIGNING[@]} + ${#CC_SIGNING[@]} + ${#DREPS_SIGNING[@]} + 1))" cardano_cli_log conway transaction build \ "${TXINS[@]}" \ --change-address "$TXIN_ADDR" \ "${POOL_ARGS[@]}" \ "${CC_ARGS[@]}" \ + "${DREPS_ARGS[@]}" \ --witness-override "$WITNESS_COUNT" \ --testnet-magic "$NETWORK_MAGIC" \ --out-file "$STATE_CLUSTER/shelley/transfer-register-delegate-tx.txbody" @@ -594,6 +666,7 @@ cardano_cli_log conway transaction sign \ "${GENESIS_SIGNING[@]}" \ "${DELEGATE_SIGNING[@]}" \ "${CC_SIGNING[@]}" \ + "${DREPS_SIGNING[@]}" \ --signing-key-file "$STATE_CLUSTER/shelley/genesis-utxo.skey" \ --testnet-magic "$NETWORK_MAGIC" \ --tx-body-file "$STATE_CLUSTER/shelley/transfer-register-delegate-tx.txbody" \ diff --git a/cardano_node_tests/utils/governance_setup.py b/cardano_node_tests/utils/governance_setup.py index b8d6a4522..90d97b55e 100644 --- a/cardano_node_tests/utils/governance_setup.py +++ b/cardano_node_tests/utils/governance_setup.py @@ -156,44 +156,75 @@ def load_committee(cluster_obj: clusterlib.ClusterLib) -> tp.List[governance_uti return cc_members +def load_dreps(cluster_obj: clusterlib.ClusterLib) -> tp.List[governance_utils.DRepRegistration]: + """Load DReps from the state directory.""" + data_dir = cluster_obj.state_dir / GOV_DATA_DIR + deposit_amt = cluster_obj.conway_genesis["dRepDeposit"] + + dreps = [] + for vkey_file in sorted(data_dir.glob("default_drep_*_drep.vkey")): + skey_file = vkey_file.with_suffix(".skey") + fpath = vkey_file.parent + reg_cert = fpath / vkey_file.name.replace(".vkey", "_reg.cert") + drep_id = cluster_obj.g_conway_governance.drep.get_id( + drep_vkey_file=vkey_file, + out_format="hex", + ) + dreps.append( + governance_utils.DRepRegistration( + registration_cert=reg_cert, + key_pair=clusterlib.KeyPair(vkey_file=vkey_file, skey_file=skey_file), + drep_id=drep_id, + deposit=deposit_amt, + ) + ) + + return dreps + + +def load_drep_users(cluster_obj: clusterlib.ClusterLib) -> tp.List[clusterlib.PoolUser]: + """Load DReps users from the state directory.""" + data_dir = cluster_obj.state_dir / GOV_DATA_DIR + + users = [] + for stake_vkey_file in sorted(data_dir.glob("vote_stake_addr*_stake.vkey")): + fpath = stake_vkey_file.parent + + stake_skey_file = stake_vkey_file.with_suffix(".skey") + stake_address = clusterlib.read_address_from_file(stake_vkey_file.with_suffix(".addr")) + + payment_vkey_file = fpath / stake_vkey_file.name.replace("_stake.vkey", ".vkey") + payment_skey_file = payment_vkey_file.with_suffix(".skey") + payment_address = clusterlib.read_address_from_file(payment_vkey_file.with_suffix(".addr")) + + users.append( + clusterlib.PoolUser( + payment=clusterlib.AddressRecord( + address=payment_address, + vkey_file=payment_vkey_file, + skey_file=payment_skey_file, + ), + stake=clusterlib.AddressRecord( + address=stake_address, vkey_file=stake_vkey_file, skey_file=stake_skey_file + ), + ) + ) + + return users + + def setup( cluster_manager: cluster_management.ClusterManager, cluster_obj: clusterlib.ClusterLib, - destination_dir: clusterlib.FileType = ".", ) -> governance_utils.GovernanceRecords: cc_members = load_committee(cluster_obj=cluster_obj) - vote_stake = create_vote_stake( - name_template="vote_stake", - cluster_manager=cluster_manager, - cluster_obj=cluster_obj, - no_of_addr=DREPS_NUM, - destination_dir=destination_dir, - ) - drep_reg_records, drep_users = governance_utils.create_dreps( - name_template="default_drep", - num=DREPS_NUM, - cluster_obj=cluster_obj, - payment_addr=vote_stake[0].payment, - pool_users=vote_stake, - destination_dir=destination_dir, - ) + drep_reg_records = load_dreps(cluster_obj=cluster_obj) + drep_users = load_drep_users(cluster_obj=cluster_obj) node_cold_records = [ cluster_manager.cache.addrs_data[pn]["cold_key_pair"] for pn in cluster_management.Resources.ALL_POOLS ] - cluster_obj.wait_for_new_epoch(padding_seconds=5) - - # Check delegation to DReps - deleg_state = clusterlib_utils.get_delegation_state(cluster_obj=cluster_obj) - drep_id = drep_reg_records[0].drep_id - stake_addr_hash = cluster_obj.g_stake_address.get_stake_vkey_hash( - stake_vkey_file=drep_users[0].stake.vkey_file - ) - governance_utils.check_drep_delegation( - deleg_state=deleg_state, drep_id=drep_id, stake_addr_hash=stake_addr_hash - ) - gov_data = save_default_governance( dreps_reg=drep_reg_records, drep_delegators=drep_users, @@ -201,6 +232,9 @@ def setup( pools_cold=node_cold_records, ) + # TODO: check `cardano-cli conway query drep-stake-distribution` instead + cluster_obj.wait_for_epoch(epoch_no=1, padding_seconds=5) + return gov_data @@ -221,7 +255,6 @@ def _setup_gov() -> tp.Optional[governance_utils.GovernanceRecords]: return setup( cluster_obj=cluster_obj, cluster_manager=cluster_manager, - destination_dir=gov_data_dir, ) if not gov_data_store.exists():