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

POS-2399: ganache bug workaround to reduce smoke_test time in CI #1141

Merged
merged 6 commits into from
Mar 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,8 @@ jobs:

- name: Run smoke tests
run: |
echo "Funding ganache accounts..."
timeout 10m bash heimdall/integration-tests/fund_ganache_accounts.sh
echo "Deposit 100 matic for each account to bor network"
cd matic-cli/devnet/code/contracts
npm run truffle exec scripts/deposit.js -- --network development $(jq -r .root.tokens.MaticToken contractAddresses.json) 100000000000000000000
Expand Down
19 changes: 19 additions & 0 deletions integration-tests/fund_ganache_accounts.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash

host='localhost'

echo "Transferring 1 ETH from ganache account[0] to all others..."

signersFile="matic-cli/devnet/devnet/signer-dump.json"
signersDump=$(jq . $signersFile)
signersLength=$(jq '. | length' $signersFile)

rootChainWeb3="http://${host}:9545"

for ((i = 1; i < signersLength; i++)); do
to_address=$(echo "$signersDump" | jq -r ".[$i].address")
from_address=$(echo "$signersDump" | jq -r ".[0].address")
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")
txHash=$(echo "$txReceipt" | jq -r '.result')
echo "Funds transferred from $from_address to $to_address with txHash: $txHash"
done
Loading