Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added support for back and forth send #12

Closed
wants to merge 22 commits into from
Closed
Changes from 10 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 51 additions & 7 deletions load-test/send_load.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,59 @@ then
PORT=16657
fi

balance_query() {
balance=$("${DAEMON}" q bank balances $1 --node $RPC --output json)
balanceres=$(echo "${balance}" | jq -r '.balances')
return "$balanceres"
}

RPC="http://${IP}:${PORT}"
num_txs=35
num_msgs=30
acc1=$($DAEMON keys show account$FROM -a --home $DAEMON_HOME-1 --keyring-backend test)
acc2=$($DAEMON keys show account$TO -a --home $DAEMON_HOME-1 --keyring-backend test)
seq1=$("${DAEMON}" q account "${acc1}" --node $RPC --output json)
seq1no=$(echo "${seq1}" | jq -r '.sequence')
bound=`expr 10000 + $seq1no`
for (( a=$seq1no; a<$bound; a++ ))
echo "** Balance of Account 1 before send_load :: **"
balance_query "$acc1"
echo "** Balance of Account 2 before send_load :: **"
balance_query "$acc2"
cd ~/
for (( a=0; a<$num_txs; a++ ))
do
sTx=$("${DAEMON}" tx bank send "${acc1}" "${acc2}" 1000000"${DENOM}" --chain-id "${CHAINID}" --keyring-backend test --home $DAEMON_HOME-1 --node $RPC --output json -y --sequence $a)
sTxHash=$(echo "${sTx}" | jq -r '.txhash')
echo "** TX HASH :: $sTxHash **"
unsignedTx=$("${DAEMON}" tx bank send "${acc1}" "${acc2}" 1000000"${DENOM}" --chain-id "${CHAINID}" --output json --generate-only --gas 500000 > unsigned.json)
unsignedTxres=$(echo "${unsignedTx}")
for (( b=0; b<$num_msgs; b++))
do
cat unsigned.json | jq '.body.messages |= . + [.[-1]]' > unsigned.json.bk
mv unsigned.json.bk unsigned.json
done
seq1=$("${DAEMON}" q account "${acc1}" --node $RPC --output json)
seq1no=$(echo "${seq1}" | jq -r '.sequence')
signTx=$("${DAEMON}" tx sign unsigned.json --from "${acc1}" --chain-id "${CHAINID}" --keyring-backend test --home $DAEMON_HOME-1 --node $RPC --signature-only=false --sequence $seq1no --gas 500000 > signed.json)
signTxres=$(echo "${signTx}")
broadcast=$("${DAEMON}" tx broadcast signed.json --output json --chain-id "${CHAINID}" --gas 500000 --node $RPC --broadcast-mode async)
broadcastRes=$(echo "${broadcast}" | jq .txhash)
echo $broadcastRes
done

for (( a=0; a<$num_txs; a++ ))
do
unsignedTx=$("${DAEMON}" tx bank send "${acc2}" "${acc1}" 1000000"${DENOM}" --chain-id "${CHAINID}" --output json --generate-only --gas 500000 > unsigned.json)
unsignedTxres=$(echo "${unsignedTx}")
for (( b=0; b<$num_msgs; b++))
do
cat unsigned.json | jq '.body.messages |= . + [.[-1]]' > unsigned.json.bk && mv unsigned.json.bk unsigned.json
done
seq2=$("${DAEMON}" q account "${acc2}" --node $RPC --output json)
seq2no=$(echo "${seq2}" | jq -r '.sequence')
signTx=$("${DAEMON}" tx sign unsigned.json --from "${acc2}" --chain-id "${CHAINID}" --keyring-backend test --home $DAEMON_HOME-1 --node $RPC --signature-only=false --sequence $seq1no --gas 500000 > signed.json)
signTxres=$(echo "${signTx}")
broadcast=$("${DAEMON}" tx broadcast signed.json --output json --chain-id "${CHAINID}" --gas 500000 --node $RPC --broadcast-mode async)
broadcastRes=$(echo "${broadcast}" | jq .txhash)
echo $broadcastRes
done

sleep 7s
echo "** Balance of Account 1 after send_load :: **"
balance_query $acc1
echo "** Balance of Account 2 after send_load :: **"
balance_query $acc2