gitmachtl / scripts

StakePool Operator Scripts. Learn how to create and manage your StakePool / manage your DRep stuff / do Governance Actions with these simple scripts. Hardware-Ledger/Trezor Support, Token/Asset Sending, Offline-Mode and much more...
MIT License
270 stars 94 forks source link

Running into strange errors when executing ./00_common.sh or ./05e_checkPoolOnChain.sh #51

Closed DLTS-FD closed 1 week ago

DLTS-FD commented 1 week ago

Environment: MacOS 14.6.1 (23G93) Mode: light mode (no local cardano node)

I want to check my pool status in order to conduct a pool de-registration.

In the mainnet -folder, I update the file ./00_common.sh to use in "light" mode. I also added a path to a cardano-cli in version 9.1.0 just in case.

When I try to run ./00_common.sh

It gives me an error:

-n 
./00_common.sh: line 179: ${network,,}: bad substitution
-e \e[97m

-e          _ ._  _ , _ ._
        (_ ' ( `  )_  .__)
      ( (  (    )   `)  ) _)
     (__ (_   (_ . _) _) ,__)
         `~~`\ ' . /`~~`
              ;   ;
              /   \ 
_____________/_ __ \___________________________________________

-e \e[35mThe 'magicparam', 'addrformat' or 'byronToShelleyEpochs' is not set!
Or maybe you have set the wrong parameter network="mainnet" ?
List of preconfigured network-names: mainnet, preprod, preview, sancho, guildnet

If you think all is right at your side, please check the GitHub repo if there
is a newer version/bugfix available, thx: https://github.com/gitmachtl/scripts\e[0m

When I check line 179 it shows to me

case "${network,,}" in

         "mainnet" )
                 network="Mainnet"               #nicer name for info-display
                 _magicparam="--mainnet"         #MagicParameter Extension --mainnet / --testnet-magic xxx
                 _addrformat="--mainnet"         #Addressformat for the address generation, normally the same as magicparam
                 _byronToShelleyEpochs=208       #The number of Byron Epochs before the Chain forks to Shelley-Era
                 _tokenMetaServer="https://tokens.cardano.org/metadata/"         #Token Metadata API URLs -> autoresolve into ${tokenMetaServer}/
                 _transactionExplorer="https://cardanoscan.io/transaction/"      #URLS for the Transaction-Explorers -> autoresolve into ${transactionExplorer}/
                 _koiosAPI="https://api.koios.rest/api/v1"                       #Koios-API URLs -> autoresolve into ${koiosAPI}
                 _adahandlePolicyID="f0ff48bbb7bbe9d59a40f1ce90e9e9d0ff5002ec48f232b49ca0fb9a"   #PolicyIDs for the adaHandles -> autoresolve into ${adahandlePolicyID}
                 _adahandleAPI="https://api.handle.me"                           #Adahandle-API URLs -> autoresolve into ${adahandleAPI}
                 _catalystAPI="https://api.projectcatalyst.io/api/v1"    #Catalyst-API URLs -> autoresolve into ${catalystAPI}
                 _lightModeParametersURL="https://uptime.live/data/cardano/parms/mainnet-parameters.json"        #Parameters-JSON-File with current informations about cardano-cli version, tip, era, protocol-parameters
                 ;;

Which makes we wonder if the two commas in case "${network,,} are wrong.

gitmachtl commented 1 week ago

hi, 00_common.sh is not supposed to be run by its own. its automatically sourced by the other scripts.

which bash version do you run? i know that on some macs the bash version is just too old to use all the functions. in your case its complaining about the ${network,,} variables. which basically does represent the content of the network-variable, but in lower-case format.

can you check your bash version by running the command: bash --version on the command line please?

thx!

DLTS-FD commented 1 week ago

Hey @gitmachtl , that's right I don't intend to run 00_common.sh on it's own but it is the same behaviour as when I call ./05e_checkPoolOnChain.sh PoolTicker because it will run 00_common.sh first.

Good point, actually I was using zsh, not bash (mac OS default terminal). When I check the available bash version it shows GNU bash, version 3.2.57(1)-release (arm64-apple-darwin23)

Probably I have to run the scripts on bash, not on zsh, right?

DLTS-FD commented 1 week ago

Using bash 3.2 it still behaves the same

bash-3.2$ ./00_common.sh 
./00_common.sh: line 179: ${network,,}: bad substitution
\e[97m

         _ ._  _ , _ ._
        (_ ' ( `  )_  .__)
      ( (  (    )   `)  ) _)
     (__ (_   (_ . _) _) ,__)
         `~~`\ ' . /`~~`
              ;   ;
              /   \ 
_____________/_ __ \___________________________________________

\e[35mThe 'magicparam', 'addrformat' or 'byronToShelleyEpochs' is not set!
Or maybe you have set the wrong parameter network="mainnet" ?
List of preconfigured network-names: mainnet, preprod, preview, sancho, guildnet

If you think all is right at your side, please check the GitHub repo if there
is a newer version/bugfix available, thx: https://github.com/gitmachtl/scripts\e[0m
DLTS-FD commented 1 week ago

Upgraded to bash 5. The error is not popping up any more :-)

Now it complains about wrong file path for my cardano-cli, so I will check my settings again.

Conclusion: MacOs is insane for not automatically upgrade from bash 3 to bash 5 😁

DLTS-FD commented 1 week ago

Hey @gitmachtl,

now I get the error message my cardano-cli would be too old but I downloaded the latest cardano node from https://github.com/IntersectMBO/cardano-node/releases where the cardano-cli is inside the "bin" folder.

$ ./00_common.sh 

         _ ._  _ , _ ._
        (_ ' ( `  )_  .__)
      ( (  (    )   `)  ) _)
     (__ (_   (_ . _) _) ,__)
         `~~`\ ' . /`~~`
              ;   ;
              /   \ 
_____________/_ __ \___________________________________________

Version 9.2.1.0 ERROR - Please use a cardano-cli version 9.3.0 or higher !
Older versions are not supported for compatibility issues, please upgrade - thx.

If you think all is right at your side, please check the GitHub repo if there
is a newer version/bugfix available, thx: https://github.com/gitmachtl/scripts
gitmachtl commented 1 week ago

yes, thats expected. please download and copy over the latest cardano-cli release 9.3.0.0

https://github.com/IntersectMBO/cardano-cli/releases/tag/cardano-cli-9.3.0.0

DLTS-FD commented 1 week ago

hey @gitmachtl thanks for support! Finally I gave up on running the scripts on a mac and moved back to good old linux machine :)