OpenSTFoundation/openst-platform

Scripts: variables/members are appended and not overwritten

Closed this issue · 0 comments

When open_st_env_vars.sh is updated by run_complete_test_deploy.sh, the env vars are appended to the file rather than overwriting, so the vars like OST_VALUE_DEPLOYER_ADDR are defined multiple times within the file, depending on how frequently the script has been executed.

Similarly, an Acme member is added to the config.json on each run through the local development steps, such as may happen when troubleshooting one's way through. Consequently, when moving on to staking and minting, one may encounter a menu like this:

 Welcome to Staking And Minting Tool 
 Please choose member to fund. 
1 ' for ' 'Acme Coin' '(' 'ACME' ')'
2 ' for ' 'Acme Coin' '(' 'ACME' ')'

2 is not actually an option because that branded token was deployed/registered on different chains than the ones currently running. If 2 is selected, one will see:

 Get Member ST Balance 
0x0000000000000000000000000000000000000000000000000000000000000000
 Acme Coin has 0 ST 
Please mention the Simple Tokens to Assign.

Given the question, despite the stated 0 balance, a user might enter a value:

>1
askStakingAmount :: readlineInterface :: line 1
bigNumStakeAmount BigNumber { s: 1, e: 0, c: [ 1 ] }
 Member does not have sufficient SimpleTokens to stake 0.000000000000000001 ST 

At which point the app hangs indefinitely.

The README should be updated to clarify why or the scripts should be revised to prevent:

  • defining env vars multiple times in open_st_env_vars.sh
  • being presented with:
    • members/coins that do not exist as options
    • questions that are invalid (can't stake if there is a 0 balance)
  • encountering a dead end