Skip to content

Commit 40e4802

Browse files
committed
revert scripts for cp issue
1 parent d0c1d9f commit 40e4802

File tree

3 files changed

+70
-3
lines changed

3 files changed

+70
-3
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/bash
2+
3+
host='localhost'
4+
5+
echo "Transferring 1 ETH from ganache account[0] to all others..."
6+
7+
signersFile="matic-cli/devnet/devnet/signer-dump.json"
8+
signersDump=$(jq . $signersFile)
9+
signersLength=$(jq '. | length' $signersFile)
10+
11+
rootChainWeb3="http://${host}:9545"
12+
13+
for ((i = 1; i < signersLength; i++)); do
14+
to_address=$(echo "$signersDump" | jq -r ".[$i].address")
15+
from_address=$(echo "$signersDump" | jq -r ".[0].address")
16+
txReceipt=$(curl $rootChainWeb3 -X POST --data '{"jsonrpc":"2.0","method":"eth_sendTransaction","params":[{"to":"'"$to_address"'","from":"'"$from_address"'","value":"0xDE0B6B3A7640000"}],"id":1}' -H "Content-Type: application/json")
17+
txHash=$(echo "$txReceipt" | jq -r '.result')
18+
echo "Funds transferred from $from_address to $to_address with txHash: $txHash"
19+
done
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#!/bin/bash
2+
set -e
3+
4+
balanceInit=$(docker exec bor0 bash -c "bor attach /var/lib/bor/data/bor.ipc -exec 'Math.round(web3.fromWei(eth.getBalance(eth.accounts[0])))'")
5+
6+
stateSyncFound="false"
7+
checkpointFound="false"
8+
SECONDS=0
9+
start_time=$SECONDS
10+
11+
while true
12+
do
13+
14+
balance=$(docker exec bor0 bash -c "bor attach /var/lib/bor/data/bor.ipc -exec 'Math.round(web3.fromWei(eth.getBalance(eth.accounts[0])))'")
15+
16+
if ! [[ "$balance" =~ ^[0-9]+$ ]]; then
17+
echo "Something is wrong! Can't find the balance of first account in bor network."
18+
exit 1
19+
fi
20+
21+
if (( balance > balanceInit )); then
22+
if [ "$stateSyncFound" != "true" ]; then
23+
stateSyncTime=$(( SECONDS - start_time ))
24+
stateSyncFound="true"
25+
fi
26+
fi
27+
28+
checkpointID=$(curl -sL http://localhost:1317/checkpoints/latest | jq .result.id)
29+
30+
if [ "$checkpointID" != "null" ]; then
31+
if [ "$checkpointFound" != "true" ]; then
32+
checkpointTime=$(( SECONDS - start_time ))
33+
checkpointFound="true"
34+
fi
35+
fi
36+
37+
if [ "$stateSyncFound" == "true" ] && [ "$checkpointFound" == "true" ]; then
38+
break
39+
fi
40+
41+
done
42+
echo "Both state sync and checkpoint went through. All tests have passed!"
43+
echo "Time taken for state sync: $(printf '%02dm:%02ds\n' $((stateSyncTime%3600/60)) $((stateSyncTime%60)))"
44+
echo "Time taken for checkpoint: $(printf '%02dm:%02ds\n' $((checkpointTime%3600/60)) $((checkpointTime%60)))"

.github/workflows/ci.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -242,9 +242,13 @@ jobs:
242242
243243
- name: Run smoke tests
244244
run: |
245-
cd matic-cli/devnet
246-
timeout 10m bash ../util-scripts/docker/fund_ganache_accounts.sh
247-
timeout 60m bash ../util-scripts/docker/smoke_test.sh
245+
echo "Funding ganache accounts..."
246+
timeout 10m bash bor/integration-tests/fund_ganache_accounts.sh
247+
echo "Deposit 100 matic for each account to bor network"
248+
cd matic-cli/devnet/code/contracts
249+
npm run truffle exec scripts/deposit.js -- --network development $(jq -r .root.tokens.MaticToken contractAddresses.json) 100000000000000000000
250+
cd -
251+
timeout 60m bash bor/integration-tests/smoke_test.sh
248252
249253
- name: Upload logs
250254
if: always()

0 commit comments

Comments
 (0)