Skip to content

Commit

Permalink
CNTools 12.0.1 (#1727)
Browse files Browse the repository at this point in the history
Funds > Send had a regression introduced in 12.0.0 thats now fixed
(thanks Homer :)

---------

Co-authored-by: RdLrT <[email protected]>
  • Loading branch information
Scitz0 and rdlrt authored Jan 27, 2024
1 parent 7edd08d commit c479870
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 9 deletions.
4 changes: 4 additions & 0 deletions docs/Scripts/cntools-changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ All notable changes to this tool will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [12.0.1] - 2024-01-26
#### Fixed
- Funds > Send had a regression introduced in 12.0.0 thats now fixed (thanks Homer :)

## [12.0.0] - 2024-01-19
#### Changed
- Minimum version bumps
Expand Down
11 changes: 8 additions & 3 deletions scripts/cnode-helper-scripts/cncli.sh
Original file line number Diff line number Diff line change
Expand Up @@ -132,12 +132,14 @@ getKoiosData() {
echo "ERROR: Koios pool_stake_snapshot query failed: curl -sSL -f -d _pool_bech32=${POOL_ID_BECH32} ${KOIOS_API}/pool_stake_snapshot"
return 1
fi
read -ra stake_mark <<<"$(jq -r '.[] | select(.snapshot=="Mark") | [.pool_stake, .active_stake] | @tsv' <<< ${stake_snapshot})"
read -ra stake_set <<<"$(jq -r '.[] | select(.snapshot=="Set") | [.pool_stake, .active_stake] | @tsv' <<< ${stake_snapshot})"
read -ra stake_mark <<<"$(jq -r '.[] | select(.snapshot=="Mark") | [.pool_stake, .active_stake, .nonce] | @tsv' <<< ${stake_snapshot})"
read -ra stake_set <<<"$(jq -r '.[] | select(.snapshot=="Set") | [.pool_stake, .active_stake, .nonce] | @tsv' <<< ${stake_snapshot})"
pool_stake_mark=${stake_mark[0]}
active_stake_mark=${stake_mark[1]}
nonce_mark=${stake_mark[2]}
pool_stake_set=${stake_set[0]}
active_stake_set=${stake_set[1]}
nonce_set=${stake_set[2]}
return 0
}

Expand Down Expand Up @@ -279,6 +281,7 @@ cncliLeaderlog() {
getLedgerData || exit 1
fi
stake_param_current="--active-stake ${active_stake_set} --pool-stake ${pool_stake_set}"
[[ -z "${nonce_set}" ]] && stake_param_current="${stake_param_current} --nonce ${nonce_set}"
cncli_leaderlog=$(${CNCLI} leaderlog --consensus "${consensus}" --db "${CNCLI_DB}" --byron-genesis "${BYRON_GENESIS_JSON}" --shelley-genesis "${GENESIS_JSON}" --ledger-set current ${stake_param_current} --pool-id "${POOL_ID}" --pool-vrf-skey "${POOL_VRF_SKEY}" --tz UTC)
if [[ $(jq -r .status <<< "${cncli_leaderlog}") != ok ]]; then
error_msg=$(jq -r .errorMessage <<< "${cncli_leaderlog}")
Expand Down Expand Up @@ -332,7 +335,8 @@ cncliLeaderlog() {
slot_for_next_nonce=$(echo "(${slotnum} - ${slot_in_epoch} + ${EPOCH_LENGTH}) - (3 * ${BYRON_K} / ${ACTIVE_SLOTS_COEFF})" | bc) # firstSlotOfNextEpoch - stabilityWindow(3 * k / f)
curr_epoch=${epochnum}
next_epoch=$((curr_epoch+1))
if [[ ${slotnum} -gt ${slot_for_next_nonce} ]]; then # Run leaderlogs for next epoch
koios_delay=$( [[ -z ${KOIOS_API} ]] && echo 0 || echo $(( SLOT_LENGTH * 600 )) ) # 600 adds a delay of 10min to let Koios populate values.
if [[ ${slotnum} -gt $(( slot_for_next_nonce + koios_delay )) ]]; then # Run leaderlogs for next epoch
if [[ $(sqlite3 "${BLOCKLOG_DB}" "SELECT COUNT(*) FROM epochdata WHERE epoch=${next_epoch};" 2>/dev/null) -eq 1 ]]; then # Leaderlogs already calculated for next epoch, skipping!
if [[ -t 1 ]]; then # manual execution
[[ ${subarg} != "force" ]] && echo "Leaderlogs already calculated for epoch ${next_epoch}, skipping!" && break
Expand All @@ -345,6 +349,7 @@ cncliLeaderlog() {
if ! getLedgerData; then sleep 300; continue; fi # Sleep for 5 min before retrying to query stake snapshot in case of error
fi
stake_param_next="--active-stake ${active_stake_mark} --pool-stake ${pool_stake_mark}"
[[ -z "${nonce_mark}" ]] && stake_param_next="${stake_param_next} --nonce ${nonce_mark}"
cncli_leaderlog=$(${CNCLI} leaderlog --consensus "${consensus}" --db "${CNCLI_DB}" --byron-genesis "${BYRON_GENESIS_JSON}" --shelley-genesis "${GENESIS_JSON}" --ledger-set next ${stake_param_next} --pool-id "${POOL_ID}" --pool-vrf-skey "${POOL_VRF_SKEY}" --tz UTC)
if [[ $(jq -r .status <<< "${cncli_leaderlog}") != ok ]]; then
error_msg=$(jq -r .errorMessage <<< "${cncli_leaderlog}")
Expand Down
2 changes: 1 addition & 1 deletion scripts/cnode-helper-scripts/cntools.library
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ CNTOOLS_MAJOR_VERSION=12
# Minor: Changes and features of minor character that can be applied without breaking existing functionality or workflow
CNTOOLS_MINOR_VERSION=0
# Patch: Backwards compatible bug fixes. No additional functionality or major changes
CNTOOLS_PATCH_VERSION=0
CNTOOLS_PATCH_VERSION=1

CNTOOLS_VERSION="${CNTOOLS_MAJOR_VERSION}.${CNTOOLS_MINOR_VERSION}.${CNTOOLS_PATCH_VERSION}"

Expand Down
10 changes: 5 additions & 5 deletions scripts/cnode-helper-scripts/cntools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1405,7 +1405,7 @@ function main {
amountADA="${amountADA//,}"
echo
if [[ ${amountADA} != "all" ]]; then
if ! amount_lovelace=$(AdaToLovelace "${amountADA}" >/dev/null); then waitForInput && continue; fi
if ! amount_lovelace=$(AdaToLovelace "${amountADA}"); then waitForInput && continue; fi
[[ ${amount_lovelace} -gt ${assets[lovelace]} ]] && println ERROR "${FG_RED}ERROR${NC}: not enough funds on address, ${FG_LBLUE}$(formatLovelace ${assets[lovelace]})${NC} Ada available but trying to send ${FG_LBLUE}$(formatLovelace ${amount_lovelace})${NC} Ada" && waitForInput && continue
if [[ ${amount_lovelace} -lt ${assets[lovelace]} ]]; then
println DEBUG "Fee payed by sender? [else amount sent is reduced]"
Expand Down Expand Up @@ -1596,8 +1596,8 @@ function main {
esac
stake_vk_file="${WALLET_FOLDER}/${wallet_name}/${WALLET_STAKE_VK_FILENAME}"
pool_delegcert_file="${WALLET_FOLDER}/${wallet_name}/${WALLET_DELEGCERT_FILENAME}"
println ACTION "${CCLI} ${NETWORK_ERA} stake-address delegation-certificate --stake-verification-key-file ${stake_vk_file} --stake-pool-id ${pool_id} --out-file ${pool_delegcert_file}"
${CCLI} ${NETWORK_ERA} stake-address delegation-certificate --stake-verification-key-file "${stake_vk_file}" --stake-pool-id "${pool_id}" --out-file "${pool_delegcert_file}"
println ACTION "${CCLI} ${NETWORK_ERA} stake-address stake-delegation-certificate --stake-verification-key-file ${stake_vk_file} --stake-pool-id ${pool_id} --out-file ${pool_delegcert_file}"
${CCLI} ${NETWORK_ERA} stake-address stake-delegation-certificate --stake-verification-key-file "${stake_vk_file}" --stake-pool-id "${pool_id}" --out-file "${pool_delegcert_file}"
if ! delegate; then
if [[ ${op_mode} = "online" ]]; then
echo && println ERROR "${FG_RED}ERROR${NC}: failure during delegation, removing newly created delegation certificate file"
Expand Down Expand Up @@ -2336,8 +2336,8 @@ function main {
waitForInput "press any key to continue"
else
println LOG "creating delegation certificate for main owner wallet"
println ACTION "${CCLI} ${NETWORK_ERA} stake-address delegation-certificate --stake-verification-key-file ${owner_stake_vk_file} --cold-verification-key-file ${pool_coldkey_vk_file} --out-file ${owner_delegation_cert_file}"
${CCLI} ${NETWORK_ERA} stake-address delegation-certificate --stake-verification-key-file "${owner_stake_vk_file}" --cold-verification-key-file "${pool_coldkey_vk_file}" --out-file "${owner_delegation_cert_file}"
println ACTION "${CCLI} ${NETWORK_ERA} stake-address stake-delegation-certificate --stake-verification-key-file ${owner_stake_vk_file} --cold-verification-key-file ${pool_coldkey_vk_file} --out-file ${owner_delegation_cert_file}"
${CCLI} ${NETWORK_ERA} stake-address stake-delegation-certificate --stake-verification-key-file "${owner_stake_vk_file}" --cold-verification-key-file "${pool_coldkey_vk_file}" --out-file "${owner_delegation_cert_file}"
delegate_owner_wallet='Y'
if [[ "${owner_wallets[0]}" != "${reward_wallet}" ]]; then
println DEBUG "\n${FG_BLUE}INFO${NC}: reward wallet not the same as owner, automatic reward wallet delegation disabled"
Expand Down

0 comments on commit c479870

Please sign in to comment.