Testing without a testnet

I am not a test engineer - in my total career my job spec only said test engineer for a total of two 12-week contracts and most of that was highly automated testing of Cisco VOIP kit. So a real test engineer may well laugh at this. Fine - lets hear how it should be done - so here goes anyway.

Many are frustrated at the lack of a testnet,
Don’t be.
We can do something useful while we are waiting. We can develop our tests from home using local baby-fleming networks and then apply what we learn when we get a real testnet to play with.

@dirvine stated ( ref to be supplied) a month or so back that he wanted to see DBCs flogged to death or some such phrase.
We can collaborate to write test scripts that will set up a consistent test environment, create a number of wallets, each associated with its own keypair and then fill these wallets from the genesis DBC.
Next we instruct these wallets to begin transacting with others in various ways and try to discover the best way to get the max amount of transactions in a given time. Because all Tx will be local, we can expect good numbers here and hopefully zero errors. We should be looking to get consistent results with numbers that vary only due to the actual hardware in use. We will get far better results here than in a real testnet due to near-zero latency and assured connectivity. The idea is to refine how and what we test so that when a testnet or comnet is available, we have a set of scripts to exercise DBCs in the real world. And a set of expected results.

The latest build has an issue so I reverted to the last release for now
So far I have a script that sets up a 20node local network created the initial keypair and a wallet and deposits the genesis DBC.

10 Likes

is updated. Assistance, advice and PRs warmly welcomed.

3 Likes

Looks good, from my limited bash knowledge. I’ll try them in a bit.

This may be out of date on populate.sh?


export SAFE_ROOT=$HOME/.safe
export SAFE_BIN=$SAFE_ROOT/cli

DBC-baby-init.sh is correct.

export SAFE_ROOT=$HOME/.safe
export SAFE_BIN=/usr/local/bin
1 Like

Yes well spotted

My intention is to have 3 scripts which will likely be concatted into one

set up the network and init the master wallet
create n wallets and keypairs and store this info to a json file ← other approaches considered
read that file and deposit from the master wallet some amount of SNT to each “account”

populate.sh will give an error similar to this for now WIP

{"account_6668" :"safe://hyryygyzqy17s4r45wd4gez1mnbrpd759hq6tnqrg1syi7ngrr9ps5dk3zon7a" ,
"publicKey" : "a8032e53a35e5f22ca259940f5d380b271fc1c61e34302bdc0334d333dbb19d4161442ce97f5fd6c34749679658b2539",
"walletUrl" : "safe://hyryynyuemx5baxkfed4h7kecbu1i5z4g5syw1qhskh47tbqwrkank1aqjwb6o"},
{"account_6669" :"safe://hyryygysmard7ksefikkfhtdbw1j88maf1uy7fn6hadx74sijca7a7ba98wn7a" ,
"publicKey" : "ae3354e50b23d24bf57f0a9d16a06543d82b067de184969b96b4dd306dfd49b94940ed83a1891c97f882fc466348dd15",
"walletUrl" : "safe://hyryynywpb1zzodt9wkh794a4uihji1d7o83o17reptszoqwe6gybxsmezyb6o"},
]}
parse error: Expected another array element at line 14, column 1
1 Like

dbc_baby_init works a treat :vulcan_salute: (at least once I remembered to copy sn_node back into the directory). May be worth mentioning in the readme that having the ~/.safe/node directory safe and sn_node in the right place is a prerequisite.

Also minor thing but Mint doesn’t have trash installed by default.

I didn’t get your error :point_up_2: running populate.sh (after dbc_baby_init) but I got another one:

./populate.sh: line 20: [: missing `]'
New NRS Map created for "safe://account_1"
The container for the map is located at safe://hyryygytz5t7d9p88hmj49pd18xq1h3x5tehjd3qzrf8qw69af1kow57hfon7a
+---+-----------+------------------+
| + | account_1 | safe://account_1 |
+---+-----------+------------------+
./populate.sh: line 30: jq: command not found
The Safe CLI had a problem and crashed. To help us diagnose the problem you can send us a crash report.

We have generated a report file at "/tmp/report-3a690617-8fc2-4f7c-94ee-8fad22397cb9.toml". Please submit an issue, including the report as an attachment, at https://github.com/maidsafe/sn_cli.
Alternatively, you can report it on our dev forum at: https://forum.safedev.org

This seems to be the offending line.

echo '"publicKey" : '$($SAFE_BIN/safe keys create --json| jq '.[0]')',' >> accounts.json

2 Likes

I was also playing around with this but you’ve got further than me. Here’s some code to allow user to select number of nodes (1-50). I don’t know how to do a pull request.

# Choose how many nodes you want
# Check for valid input: a number between 1 and 50

while :; do
  read -p "How many nodes (1 - 50)?: " NODES_QTY
  [[ $NODES_QTY =~ ^[0-9]+$ ]] || { echo "Enter a valid number"; continue; }
     if ((NODES_QTY >= 1 && NODES_QTY <= 50)); then
       echo "OK"
       break
     else
       echo "Number out of range, try again"
     fi
done
1 Like

When you’re ready! :crazy_face: here’s what I think is the easy way…

First you need to be working in a fork of the repo you want to contribute to.

So on GitHub fork that repo and clone it to your local system. Make your changes, (ideally on a branch) in your local fork of that repo and push them to your GitHub repo.

Now on GitHub you can submit those changes as a PR. Search their docs for specifics and ask if you get stuck.

Assuming you want to try :wink:

4 Likes

Thank you
set the default to 20 perhaps?

1 Like

ah — some over zealour pre-comit tidying took out
#sudo apt install trash-cli jq

commented out cos I was sick of the already installed msgs
Ill put that back

jq is complaining cos I havent assembled the json correctly,
I still havent sussed out the proper way to do this or if there is a simpler way to get this done.
Should I not be thinking about storing this array of accounts in the network itself?
Still got lots to learn re nrs to take that any further

trash-cli to send to Trash rather than rm -rf cos that takes forever deleting the chunks.

while :; do
  read -p "How many nodes [20]?: " NODES_QTY
  NODES_QTY=${NODES_QTY:-20} 
  [[ $NODES_QTY =~ ^[0-9]+$ ]] || { echo "Enter a valid number"; continue; }
     if ((NODES_QTY >= 11 && NODES_QTY <= 50)); then
       echo "OK"
       break
     else
       echo "Choose between 11 and 50 nodes"
     fi
done

Seems to work. Changed the min to 11 too - not much point in having a 1-node network…

2 Likes

Excellent
Are you going to submit a PR? :slight_smile:

One day perhaps…

1 Like

I’ll create a JPL branch then :slight_smile:

1 Like

Latest attempts at GitHub - safenetforum-community/DBC-testing: scripts to refine test procedures for community testnets

Payout to wallets is working now, thanks @JPL but I havent worked out why the DBC data is getting displayed after each run.

If you play with this yourself, you will need to change the loop params at line 22

for i in {1..5}
to another range on subsequent runs

OR run DBC-baby-init again and takes some time

The safe nrs register command seems really slow compared to other commands. I wonder why this is?


----------------------------------------------------
"safe://hyryygyoj5srrmjptpj1cmw5zhrwdufxuthc37ipz3oy9xtpa8nbixjdspen7a"
"a09509e1d339168295baf7ea67b805709d1cd5ff1fec5320dce14a3244adb4899501102670f523f1c3c41e76f5c05056"
safe://hyryynyztbs8uqbr1wuz9pnfttx1z75mdkap4uw7sgmz5by3qnobbmhmfgrb6o
[
  "safe://hyryynyztbs8uqbr1wuz9pnfttx1z75mdkap4uw7sgmz5by3qnobbmhmfgrb6o",
  "dbc-8f9bb780"
]
Wallet at "safe://hyryynyigoffes3gnueby6q4c5y3ttbbj5676i1ekcitmwtdnnt9xjkfozeb6o" has a total balance of 4525524107.433631200 safecoins
Wallet at "safe://hyryynyztbs8uqbr1wuz9pnfttx1z75mdkap4uw7sgmz5by3qnobbmhmfgrb6o" has a total balance of 3.141592200 safecoins
----------------------------------------------------
----------------------------------------------------
"safe://hyryygyu3brn9k4bg3aqu97z51d7e7egiuuy4f5c5h1qr7s7gtkyp6df5nyn7a"
"8624d9c7f99d971807e1884cd4bc097eca2b816332f19041a7131a9f8d69c2e09d7b4687cbcb4b0add7a1da1c1e16967"
safe://hyryynyuybf5ygbroxpqkyjkhiytiu5cm5a33fwcqe7dh69pizzdyfidqbwb6o
[
  "safe://hyryynyuybf5ygbroxpqkyjkhiytiu5cm5a33fwcqe7dh69pizzdyfidqbwb6o",
  "dbc-dd49b783"
]
Wallet at "safe://hyryynyigoffes3gnueby6q4c5y3ttbbj5676i1ekcitmwtdnnt9xjkfozeb6o" has a total balance of 4525524104.292039000 safecoins
Wallet at "safe://hyryynyuybf5ygbroxpqkyjkhiytiu5cm5a33fwcqe7dh69pizzdyfidqbwb6o" has a total balance of 3.141592200 safecoins
----------------------------------------------------
----------------------------------------------------
b8de2e1b6cab18a31ddaf1e82e07dd6d02cf9e25d5391b89bf88f5c72013a2a6536a7ffa950235da991e21fd5dce8ea01c3810a8152a0776e4deb0a507ff9b8b3a172a264d85ee6a2ec730ce9593c7821b15c78ef1572d70030b2f8d674f533f189c3aeb9617dac09533fc02e21e1af217bb68e8482ccc9aef680a3e5e26fec71dfe0bc43465886fb69d26fbd0f7701c78ab37af3b2142bb0242ac3eb22c4db3cabfb809c4822ef7d8450c057c8ddfb43611a55483d07a5c51d9792276fcb4793f695470700446bb3439b86ad3465c8716528ede1700

How can I name the DBC somethng other than “dbc-8f9bb780” etc? I cant see anything in --help for
safe wallet reissue ?

willie@gagarin:~/projects/maidsafe/DBC-testing$ safe cat safe://hyryynyztbs8uqbr1wuz9pnfttx1z75mdkap4uw7sgmz5by3qnobbmhmfgrb6o
Spendable balances of wallet at "safe://hyryynyztbs8uqbr1wuz9pnfttx1z75mdkap4uw7sgmz5by3qnobbmhmfgrb6o":
+------------------------+-------------+-----------------+---------------------+
| Spendable balance name | Balance     | Owner           | DBC Data            |
|------------------------+-------------+-----------------+---------------------|
| dbc-8f9bb780           | 3.141592200 | ad9501...6928d1 | 1dabb6dd...00000000 |
+------------------------+-------------+-----------------+---------------------+

populate.sh now creates wallets and puts SNT into each one.
Its very slow, took 14 mins to do 100 wallets

-----  account_100  --------------------------------------


 Payout to : safe://hyryynytif4fcom4czpoqhz3trnrkjsu7dzp16r4wtka5tcp9fo7154bntcb6o
[
  "safe://hyryynytif4fcom4czpoqhz3trnrkjsu7dzp16r4wtka5tcp9fo7154bntcb6o",
  "dbc-c3ca2c3e"
]
Master Wallet at "safe://hyryynyzmgwf5uk3hwh67n6gfpxb89kzeiaka1a9k6w7rrefnnja467939hb6o" has a total balance of 4525523805.840780000 safecoins
----------------------------------------------------
Wallet at "safe://hyryynytif4fcom4czpoqhz3trnrkjsu7dzp16r4wtka5tcp9fo7154bntcb6o" has a total balance of 3.141592200 safecoins
----------------------------------------------------

real	14m10.863s
user	1m7.534s
sys	0m8.415s

Changes will be pushed to GitHub - safenetforum-community/DBC-testing: scripts to refine test procedures for community testnets shortly.

TODO:

  • Make the payout amount configurable, right now its hardcoded to 3.1415922 SNT cos everyone deserves a slice of pie

  • Make the menu choice of NODES_QTY actually work - right now this is configured at line 48 for i in {1..100}

  • Do something useful with the nrs address that is created

4 Likes