Skip to content

Commit

Permalink
changes
Browse files Browse the repository at this point in the history
  • Loading branch information
nilaysaha committed Sep 25, 2023
1 parent 0f69511 commit 5492ecb
Show file tree
Hide file tree
Showing 10 changed files with 55 additions and 46 deletions.
6 changes: 3 additions & 3 deletions exec/ff-node-shelly-mainnet-relay.v2
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ stop() {
choice() { i=$1; shift; eval "echo \${$((i + 1))}"; }

cexec() {
BASE_CONFIG="${SCRIPTDIR}/../src/tconfig/mainnet-config.json"
TOPOLOGY_CONFIG="${SCRIPTDIR}/../src/tconfig/mainnet-topology.json"
BASE_CONFIG="${SCRIPTDIR}/../src/tconfig/mainnet/config.json"
TOPOLOGY_CONFIG="${SCRIPTDIR}/../src/tconfig/mainnet/topology.json"
CARDANO_NODE="/home/nsaha/.cabal/bin/cardano-node"
HOST_IP="$(wget http://ipecho.net/plain -O - -q ; echo)"
HOST_IP="$(hostname -I|cut -d' ' -f1)"
PORT=3001
DB_DIR="${NODE_DIR}/db-ff"
SOCKET="${NODE_DIR}/node.socket"
Expand Down
8 changes: 4 additions & 4 deletions exec/ff-node-shelly-mainnet.v2
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ stop() {
choice() { i=$1; shift; eval "echo \${$((i + 1))}"; }

cexec() {
BASE_CONFG="${SCRIPTDIR}/../src/tconfig/mainnet-config.json"
TOPOLOGY_CONFIG="${SCRIPTDIR}/../src/tconfig/mainnet-topology.json"
GENESIS_CONFIG="${SCRIPTDIR}/../src/tconfig/mainnet-genesis.json"
BASE_CONFG="${SCRIPTDIR}/../src/tconfig/mainnet/config.json"
TOPOLOGY_CONFIG="${SCRIPTDIR}/../src/tconfig/mainnet/topology.json"
GENESIS_CONFIG="${SCRIPTDIR}/../src/tconfig/mainnet/genesis.json"
KES_SKEY="${SCRIPTDIR}/../src/kaddr_run/kes.skey"
VRF_SKEY="${SCRIPTDIR}/../src/kaddr_run/vrf.skey"
NODE_CERT="${SCRIPTDIR}/../src/kaddr_run/node.cert"

CARDANO_NODE="/home/nsaha/.cabal/bin/cardano-node"
HOST_IP="$(wget http://ipecho.net/plain -O - -q ; echo)"
HOST_IP="$(hostname -I|cut -d' ' -f1)"
PORT=3001
DB_DIR="${NODE_DIR}/db-ff"
SOCKET="${NODE_DIR}/node.socket"
Expand Down
2 changes: 1 addition & 1 deletion src/config/pool_stakeData.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"amount": 5000000000,
"cost": 340000000,
"margin": 0.99
"margin": 0.25
}
5 changes: 3 additions & 2 deletions src/create_keys_addr.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
'alonzo-genesis':os.path.join( CWD, 'tconfig/mainnet/alonzo-genesis.json'),
'submit-api-config':os.path.join( CWD, 'tconfig/mainnet/submit-api-config.json'),
'db-sync-config':os.path.join( CWD, 'tconfig/mainnet/db-sync-config.json'),
'conway-genesis':os.path.join( CWD, 'tconfig/mainnet/conway-genesis.json'),
},
'preview':{
'config':os.path.join( CWD, 'tconfig/preview/config.json'),
Expand All @@ -30,7 +31,7 @@
'alonzo-genesis':os.path.join( CWD, 'tconfig/preview/alonzo-genesis.json'),
'submit-api-config':os.path.join( CWD, 'tconfig/preview/submit-api-config.json'),
'db-sync-config':os.path.join( CWD, 'tconfig/preview/db-sync-config.json'),

'conway-genesis':os.path.join( CWD, 'tconfig/mainnet/conway-genesis.json'),
}
}
}
Expand Down Expand Up @@ -62,7 +63,7 @@ def fetch_init_files(network='mainnet'):
"""
print(f"fetch_init_files")
try:
fnames = [f'{network}/config.json', f'{network}/topology.json', f'{network}/shelley-genesis.json',f'{network}/byron-genesis.json',f'{network}/alonzo-genesis.json', f'{network}/db-sync-config.json', f'{network}/submit-api-config.json' ]
fnames = [f'{network}/config.json', f'{network}/topology.json', f'{network}/shelley-genesis.json',f'{network}/byron-genesis.json',f'{network}/alonzo-genesis.json', f'{network}/conway-genesis.json', f'{network}/db-sync-config.json', f'{network}/submit-api-config.json' ]
for c in fnames:
turl = BASE_URL+c
print(f"fetched content url:{turl}")
Expand Down
9 changes: 4 additions & 5 deletions src/cscripts/download_and_install_binaries.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ BASE_BINARY_DIR="$HOME/.cabal/bin"
./download_binaries.sh $VERSION_ID

#Now backup the current .cabal directory
DATE=$(date +%d/%m/%y)
DATE=$(date %s)
BACKUP_BIN_DIR="$HOME/.cabal/bin_$DATE"


Expand All @@ -28,12 +28,11 @@ fi
mv $BASE_BINARY_DIR/* $BACKUP_BIN_DIR/.

#And move the latest binary
mv $STORAGE_DIR/* $BASE_BINARY_DIR/.
for i in `ls $BASE_BINARY_DIR`
for i in `find ${STORAGE_DIR} -executable`
do
chmod +x $BASE_BINARY_DIR/$i
cp $i $BASE_BINARY_DIR/.
done


#Now restart the blockchain
#sudo systemctl stop shelly-cardano
Expand Down
11 changes: 8 additions & 3 deletions src/cscripts/download_binaries.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ if [ ! -d "$STORAGE_DIR" ]; then
mkdir -p $STORAGE_DIR
fi

aws s3 cp s3://stake-pool/cardano-cli-${VERSION_ID} $STORAGE_DIR/cardano-cli
aws s3 cp s3://stake-pool/cardano-node-${VERSION_ID} $STORAGE_DIR/cardano-node
aws s3 cp s3://stake-pool/cardano-node-chairman-${VERSION_ID} $STORAGE_DIR/cardano-node-chairman
cd $STORAGE_DIR
BINARY_FILENAME=cardano-node-${VERSION_ID}-linux.tar.gz
wget https://github.com/input-output-hk/cardano-node/releases/download/${VERSION_ID}/${BINARY_FILENAME}
tar xvfz $BINARY_FILENAME

# aws s3 cp s3://stake-pool/cardano-cli-${VERSION_ID} $STORAGE_DIR/cardano-cli
# aws s3 cp s3://stake-pool/cardano-node-${VERSION_ID} $STORAGE_DIR/cardano-node
# aws s3 cp s3://stake-pool/cardano-node-chairman-${VERSION_ID} $STORAGE_DIR/cardano-node-chairman
50 changes: 26 additions & 24 deletions src/cscripts/env
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
CNODEBIN="${HOME}/.cabal/bin/cardano-node" # Override automatic detection of cardano-node executable
CCLI="${HOME}/.cabal/bin/cardano-cli" # Override automatic detection of cardano-cli executable
#CNCLI="${HOME}/.cargo/bin/cncli" # Override automatic detection of executable (https://github.com/AndrewWestberg/cncli)
CNODE_HOME="$HOME/projects/cardano-scripts/src/tconfig" # Override default CNODE_HOME path (defaults to /opt/cardano/cnode)
CNODE_HOME="$HOME/projects/cardano-scripts/src/tconfig/mainnet" # Override default CNODE_HOME path (defaults to /opt/cardano/cnode)
CNODE_EXEC_HOME="$HOME/projects/cardano-scripts/exec/state-node-shelly-mainnet/" # Override default CNODE_HOME path (defaults to /opt/cardano/cnode)
CNODE_PORT=3001 # Set node port
CONFIG="${CNODE_HOME}/mainnet-config.json" # Override automatic detection of node config path
CONFIG="${CNODE_HOME}/config.json" # Override automatic detection of node config path
SOCKET="${CNODE_EXEC_HOME}/node.socket" # Override automatic detection of path to socket
TOPOLOGY="${CNODE_HOME}/mainnet-topology.json" # Override default topology.json path
LOG_DIR="${CNODE_HOME}/exec/logs" # Folder where your logs will be sent to (must pre-exist)
Expand Down Expand Up @@ -78,6 +78,7 @@ POOL_NAME="REIT" # Set the pool's name
#G_ACCOUNT="cardano-community" # Override default github repository if you forked project
#USESYSVARS="N" # Whether to use environment variable from shell session for TCONFIG_HOME
#POOL_HW_COLDKEY_SK_FILENAME="cold.hwsfile"
#CIP0094_POLL_URL="https://raw.githubusercontent.com/cardano-foundation/CIP-0094-polls/main/networks/polls.json" # URL for polls to vote against

######################################
# Do NOT modify code below #
Expand Down Expand Up @@ -155,7 +156,7 @@ checkUpdate() {
if ! curl -s -f -m ${CURL_TIMEOUT} "${URL_RAW}/LICENSE" -o /dev/null ; then
echo -e "WARN!! The folder was configured against ${BRANCH} branch - which does not exist anymore, falling back to master branch"
BRANCH=master
echo "${BRANCH}" > "${TCONFIG_HOME}"/scripts/.env_branch
echo "${BRANCH}" > "${CNODE_HOME}"/scripts/.env_branch
fi
fi
[[ -n $5 ]] && URL="${URL_RAW}/scripts/$5" || URL="${URL_RAW}/scripts/cnode-helper-scripts"
Expand Down Expand Up @@ -187,7 +188,7 @@ checkUpdate() {
GIT_VERSION=$(grep -r ^GLV_VERSION= "${dname}/${fname}".tmp | cut -d'=' -f2)
fi
if ! versionCheck ${GIT_VERSION} ${CUR_VERSION}; then
[[ ${fname} = cntools.library ]] && script_name="CNTools" || script_name="Guild LiveView"
[[ ${fname} = cntools.library ]] && script_name="Koios CNTools" || script_name="Koios gLiveView"
update_msg="\nA new version of ${script_name} is available."
update_msg="${update_msg}\nInstalled Version : ${FG_LGRAY}${CUR_VERSION}${NC}"
update_msg="${update_msg}\nAvailable Version : ${FG_GREEN}${GIT_VERSION}${NC}"
Expand Down Expand Up @@ -707,9 +708,9 @@ getEraIdentifier() {
Shelley) ERA_IDENTIFIER="--shelley-era" ;;
Allegra) ERA_IDENTIFIER="--allegra-era" ;;
Mary) ERA_IDENTIFIER="--mary-era" ;;
#Alonzo) ERA_IDENTIFIER="--alonzo-era" ;;
#Babbage) ERA_IDENTIFIER="--babbage-era" ;;
*) ERA_IDENTIFIER="--mary-era" # use mary era as default
Alonzo) ERA_IDENTIFIER="--alonzo-era" ;;
Babbage) ERA_IDENTIFIER="--babbage-era" ;;
*) ERA_IDENTIFIER="--babbage-era" # use mary era as default
[[ ${OFFLINE_MODE} = "N" ]] && return 1
esac
return 0
Expand All @@ -726,7 +727,7 @@ telegramSend() {
set_default_vars() {
[[ "${USESYSVARS}" != "Y" ]] && unset TCONFIG_HOME
[[ "${USESYSVARS}" != "Y" ]] && unset CNODE_HOME
[[ $(basename $0 2>/dev/null) = "cnode.sh" ]] && OFFLINE_MODE='Y' # for backwards compatibility
[[ $(basename $0 2>/dev/null) = "topologyUpdater.sh" ]] && OFFLINE_MODE='Y' # for backwards compatibility
Expand All @@ -741,24 +742,24 @@ set_default_vars() {
date () { gdate "$@"; }
fi
[[ -z ${CURL_TIMEOUT} ]] && CURL_TIMEOUT=10
[[ -z "${TCONFIG_HOME}" ]] && TCONFIG_HOME="$(readlink -f ${PARENT}/..)"
CNODE_NAME="$(basename ${TCONFIG_HOME})"
[[ -z "${CNODE_HOME}" ]] && CNODE_HOME="$(readlink -f ${PARENT}/..)"
CNODE_NAME="$(basename ${CNODE_HOME})"
CNODE_VNAME=$(tr '[:upper:]' '[:lower:]' <<< ${CNODE_NAME//_HOME/})
CNODE_VNAME_UPPERCASE=$(tr '[:lower:]' '[:upper:]' <<< ${CNODE_VNAME})
[[ -z "${CNODE_PORT}" ]] && CNODE_PORT=6000
[[ -z ${UPDATE_CHECK} ]] && UPDATE_CHECK="Y"
[[ -z ${TOPOLOGY} ]] && TOPOLOGY="${TCONFIG_HOME}/files/topology.json"
[[ -z ${TOPOLOGY} ]] && TOPOLOGY="${CNODE_HOME}/files/topology.json"
[[ -n ${CNODE_TOPOLOGY} ]] && TOPOLOGY="${CNODE_TOPOLOGY}" # compatibility with older topologyUpdater
[[ -z ${LOG_DIR} ]] && LOG_DIR="${TCONFIG_HOME}/logs"
[[ -z ${LOG_DIR} ]] && LOG_DIR="${CNODE_HOME}/logs"
[[ -n ${CNODE_LOG_DIR} ]] && LOG_DIR="${CNODE_LOG_DIR}" # compatibility with older topologyUpdater
[[ -z ${DB_DIR} ]] && DB_DIR="${TCONFIG_HOME}/db"
[[ -z ${TMP_DIR} ]] && TMP_DIR="/tmp/$(basename "${TCONFIG_HOME}")"
[[ -z ${DB_DIR} ]] && DB_DIR="${CNODE_HOME}/db"
[[ -z ${TMP_DIR} ]] && TMP_DIR="/tmp/$(basename "${CNODE_HOME}")"
if ! mkdir -p "${TMP_DIR}" 2>/dev/null; then echo "ERROR: Failed to create directory for temporary files, please set TMP_DIR to a valid folder in 'env', current folder: ${TMP_DIR}" && exit 1; fi
[[ -z ${TIMEOUT_LEDGER_STATE} ]] && TIMEOUT_LEDGER_STATE=300
[[ -z ${ENABLE_KOIOS} ]] && ENABLE_KOIOS="Y"
[[ -z ${DBSYNC_QUERY_FOLDER} ]] && DBSYNC_QUERY_FOLDER="${TCONFIG_HOME}/files/dbsync/queries"
[[ -z ${WALLET_FOLDER} ]] && WALLET_FOLDER="${TCONFIG_HOME}/priv/wallet"
[[ -z ${POOL_FOLDER} ]] && POOL_FOLDER="${TCONFIG_HOME}/priv/pool"
[[ -z ${DBSYNC_QUERY_FOLDER} ]] && DBSYNC_QUERY_FOLDER="${CNODE_HOME}/files/dbsync/queries"
[[ -z ${WALLET_FOLDER} ]] && WALLET_FOLDER="${CNODE_HOME}/priv/wallet"
[[ -z ${POOL_FOLDER} ]] && POOL_FOLDER="${CNODE_HOME}/priv/pool"
[[ -z ${POOL_NAME} ]] && POOL_NAME="CHANGE_ME"
[[ -z ${POOL_DIR} ]] && POOL_DIR="${POOL_FOLDER}/${POOL_NAME}"
[[ -z ${WALLET_PAY_VK_FILENAME} ]] && WALLET_PAY_VK_FILENAME="payment.vkey"
Expand Down Expand Up @@ -787,11 +788,12 @@ set_default_vars() {
[[ -z ${POOL_REGCERT_FILENAME} ]] && POOL_REGCERT_FILENAME="pool.cert"
[[ -z ${POOL_CURRENT_KES_START} ]] && POOL_CURRENT_KES_START="kes.start"
[[ -z ${POOL_DEREGCERT_FILENAME} ]] && POOL_DEREGCERT_FILENAME="pool.dereg"
[[ -z ${ASSET_FOLDER} ]] && ASSET_FOLDER="${TCONFIG_HOME}/priv/asset"
[[ -z ${ASSET_FOLDER} ]] && ASSET_FOLDER="${CNODE_HOME}/priv/asset"
[[ -z ${ASSET_POLICY_VK_FILENAME} ]] && ASSET_POLICY_VK_FILENAME="policy.vkey"
[[ -z ${ASSET_POLICY_SK_FILENAME} ]] && ASSET_POLICY_SK_FILENAME="policy.skey"
[[ -z ${ASSET_POLICY_SCRIPT_FILENAME} ]] && ASSET_POLICY_SCRIPT_FILENAME="policy.script"
[[ -z ${ASSET_POLICY_ID_FILENAME} ]] && ASSET_POLICY_ID_FILENAME="policy.id"
[[ -z ${CIP0094_POLL_URL} ]] && CIP0094_POLL_URL="https://raw.githubusercontent.com/cardano-foundation/CIP-0094-polls/main/networks/polls.json"
FG_BLACK='\e[30m'
FG_RED='\e[31m'
FG_GREEN='\e[32m'
Expand Down Expand Up @@ -850,7 +852,7 @@ if [[ -z "${SOCKET}" ]]; then
if [[ "$(ps -ef | grep "$(basename ${CNODEBIN}).*.port ${CNODE_PORT}" | grep -v grep)" =~ --socket-path[[:space:]]([^[:space:]]+) ]]; then
export CARDANO_NODE_SOCKET_PATH="${BASH_REMATCH[1]}"
elif [[ ${OFFLINE_MODE} = "Y" ]]; then
export CARDANO_NODE_SOCKET_PATH="${TCONFIG_HOME}/sockets/node0.socket"
export CARDANO_NODE_SOCKET_PATH="${CNODE_HOME}/sockets/node0.socket"
else
echo "Node socket not set in env file and automatic detection failed! [source: $(basename $0 2>/dev/null)]"
return 1
Expand All @@ -863,8 +865,8 @@ export SOCKET="${CARDANO_NODE_SOCKET_PATH}" # For compatibility with those who h
if [[ -z "${CONFIG}" ]]; then
if [[ "$(ps -ef | grep "$(basename ${CNODEBIN}).*.port ${CNODE_PORT}" | grep -v grep)" =~ --config[[:space:]]([^[:space:]]+) ]]; then
CONFIG=${BASH_REMATCH[1]}
elif [[ -f "${TCONFIG_HOME}/files/config.json" ]]; then
CONFIG="${TCONFIG_HOME}/files/config.json"
elif [[ -f "${CNODE_HOME}/files/config.json" ]]; then
CONFIG="${CNODE_HOME}/files/config.json"
else
echo "Node config not set in env file and automatic detection failed!"
return 1
Expand Down Expand Up @@ -955,7 +957,7 @@ elif [[ ! ${PROM_PORT} =~ ^[0-9]+$ ]]; then
return 1
fi
[[ -z ${BLOCKLOG_DIR} ]] && BLOCKLOG_DIR="${TCONFIG_HOME}/guild-db/blocklog"
[[ -z ${BLOCKLOG_DIR} ]] && BLOCKLOG_DIR="${CNODE_HOME}/guild-db/blocklog"
BLOCKLOG_DB="${BLOCKLOG_DIR}/blocklog.db"
[[ -z ${BLOCKLOG_TZ} ]] && BLOCKLOG_TZ="UTC"
[[ -z ${CNODE_PORT} ]] && CNODE_PORT=6000
Expand All @@ -979,8 +981,8 @@ if [[ -n "${CNODE_PID}" ]]; then
fi
node_version="$(${CCLI} version | head -1 | cut -d' ' -f2)"
if ! versionCheck "1.35.5" "${node_version}"; then
echo -e "\nGuild scripts has now been upgraded to support cardano-node 1.35.5 or higher (${node_version} found).\nPlease update cardano-node (note that you should ideally update your config too) or use tagged branches for older node version.\n\n"
if ! versionCheck "8.1.2" "${node_version}"; then
echo -e "\nKoios scripts has now been upgraded to support cardano-node 8.1.2 or higher (${node_version} found).\nPlease update cardano-node (note that you should ideally update your config too) or use tagged branches for older node version.\n\n"
return 1
fi
Expand Down
4 changes: 2 additions & 2 deletions src/ogmios/run_ogmios.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/bin/bash

OGMIOS=/home/nsaha/local/bin/ogmios
CARDANO_NODE_SOCKET=/home/nsaha/projects/cardano-scripts/exec/cardano-chain-data-store/node.socket
CARDANO_CONFIG=/home/nsaha/projects/cardano-scripts/src/tconfig/preview/config.json
CARDANO_NODE_SOCKET=/home/nsaha/projects/cardano-scripts/exec/state-node-shelly-mainnet/node.socket
CARDANO_CONFIG=/home/nsaha/projects/cardano-scripts/src/tconfig/mainnet/config.json
HOST="0.0.0.0"

$OGMIOS --node-socket $CARDANO_NODE_SOCKET --node-config $CARDANO_CONFIG --host $HOST
4 changes: 2 additions & 2 deletions src/process_certs.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,8 @@ def calculate_min_fees(tx_in, ttl, options={"raw_transaction":False}):
print(command)
s = subprocess.check_output(command,stderr=True, universal_newlines=True)
print(f"output of command:{command} output is:{s}")
min_fee = s.split(" ")[0]
return min_fee
min_fee = 2*int(s.split(" ")[0])
return str(min_fee)
except:
logging.exception("Failed to calculate min fees")

Expand Down
2 changes: 2 additions & 0 deletions src/tconfig/mainnet/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
"ApplicationVersion": 1,
"ByronGenesisFile": "byron-genesis.json",
"ByronGenesisHash": "5f20df933584822601f9e3f8c024eb5eb252fe8cefb24d1317dc3d432e940ebb",
"ConwayGenesisFile": "conway-genesis.json",
"ConwayGenesisHash": "f28f1c1280ea0d32f8cd3143e268650d6c1a8e221522ce4a7d20d62fc09783e1",
"LastKnownBlockVersion-Alt": 0,
"LastKnownBlockVersion-Major": 3,
"LastKnownBlockVersion-Minor": 0,
Expand Down

0 comments on commit 5492ecb

Please sign in to comment.