-
Notifications
You must be signed in to change notification settings - Fork 2
107 lines (87 loc) · 4.96 KB
/
deploy-latest-contracts.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
name: Deploy latest contracts
on:
push:
branches: [ "main" ]
jobs:
deploy-latest-contracts:
runs-on: ubuntu-latest
timeout-minutes: 7
steps:
# Checkout Hydro repository
- name: Checkout repository
uses: actions/checkout@v4
# Download specific neutrond binary and add it to the PATH so it can be used by other scripts
- name: Download Neutron chain binary
run: |
curl -L -o neutrond https://github.com/neutron-org/neutron/releases/download/v5.0.2/neutrond-linux-amd64
chmod +x neutrond
echo "$(pwd)" >> $GITHUB_PATH
# Checkout Neutron ICQ relayer repository
- name: Checkout Neutron ICQ relayer repository
uses: actions/checkout@v4
with:
repository: neutron-org/neutron-query-relayer
path: ./neutron-query-relayer # directory to checkout the repo into
ref: 'refs/tags/v0.3.0' # tag to checkout
# Run scripts to store the codes, instantiate contracts and create proposals with tributes
- name: Deploy contracts
env:
TESTNET_MNEMONIC: ${{ secrets.E2E_TESTS_MNEMONIC }}
run: |
CONFIG_FILE="./tools/deployment/config_testnet.json"
TX_SENDER_WALLET=$(jq -r '.tx_sender_wallet' $CONFIG_FILE)
echo $TESTNET_MNEMONIC | neutrond keys add $TX_SENDER_WALLET --keyring-backend test --recover
chmod +x ./tools/deployment/store_instantiate.sh
chmod +x ./tools/deployment/populate_contracts.sh
source ./tools/deployment/store_instantiate.sh $CONFIG_FILE true
source ./tools/deployment/populate_contracts.sh $CONFIG_FILE $HYDRO_CONTRACT_ADDRESS $TRIBUTE_CONTRACT_ADDRESS
# Run tools/relaying.sh to create validator ICQs in the contract and run the ICQ relayer to
# get the results into the contract
- name: Run ICQs setup script
run: |
cd neutron-query-relayer
go build -ldflags "${LDFLAGS}" -o build/neutron_query_relayer ./cmd/neutron_query_relayer/*.go
cd ..
cd ./tools
go build -o build/icq-tool ./*.go
cd ..
cp ./tools/build/icq-tool .
cp ./neutron-query-relayer/build/neutron_query_relayer .
cp ./tools/relaying.sh .
chmod +x relaying.sh
CONFIG_FILE="./tools/deployment/config_testnet.json"
CHAIN_ID=$(echo $(jq -r '.chain_id' $CONFIG_FILE) | sed -E 's/([][\/.*?$^&|])/\\\1/g')
NEUTRON_RPC_NODE=$(echo $(jq -r '.neutron_rpc_node' $CONFIG_FILE) | sed -E 's/([][\/.*?$^&|])/\\\1/g')
NEUTRON_API_NODE=$(echo $(jq -r '.neutron_api_node' $CONFIG_FILE) | sed -E 's/([][\/.*?$^&|])/\\\1/g')
TX_SENDER_WALLET=$(echo $(jq -r '.tx_sender_wallet' $CONFIG_FILE) | sed -E 's/([][\/.*?$^&|])/\\\1/g')
HUB_CONNECTION_ID=$(echo $(jq -r '.hub_connection_id' $CONFIG_FILE) | sed -E 's/([][\/.*?$^&|])/\\\1/g')
HUB_RPC_NODE=$(echo $(jq -r '.hub_rpc_node' $CONFIG_FILE) | sed -E 's/([][\/.*?$^&|])/\\\1/g')
HUB_API_NODE=$(echo $(jq -r '.hub_api_node' $CONFIG_FILE) | sed -E 's/([][\/.*?$^&|])/\\\1/g')
sed -i "s|^RELAYER_REPO_PATH=.*$|RELAYER_REPO_PATH=\.\/neutron-query-relayer|" ./relaying.sh
sed -i "s/^export NEUTRON_CHAIN_ID=.*$/export NEUTRON_CHAIN_ID=$CHAIN_ID/" ./relaying.sh
sed -i "s/^export RELAYER_NEUTRON_CHAIN_RPC_ADDR=.*$/export RELAYER_NEUTRON_CHAIN_RPC_ADDR=$NEUTRON_RPC_NODE/" ./relaying.sh
sed -i "s/^export RELAYER_NEUTRON_CHAIN_REST_ADDR=.*$/export RELAYER_NEUTRON_CHAIN_REST_ADDR=$NEUTRON_API_NODE/" ./relaying.sh
sed -i "s/^export RELAYER_NEUTRON_CHAIN_SIGN_KEY_NAME=.*$/export RELAYER_NEUTRON_CHAIN_SIGN_KEY_NAME=$TX_SENDER_WALLET/" ./relaying.sh
sed -i "s/^export RELAYER_NEUTRON_CHAIN_CONNECTION_ID=.*$/export RELAYER_NEUTRON_CHAIN_CONNECTION_ID=$HUB_CONNECTION_ID/" ./relaying.sh
sed -i "s/^export RELAYER_TARGET_CHAIN_RPC_ADDR=.*$/export RELAYER_TARGET_CHAIN_RPC_ADDR=$HUB_RPC_NODE/" ./relaying.sh
sed -i "s/^export RELAYER_TARGET_CHAIN_API_ADDR=.*$/export RELAYER_TARGET_CHAIN_API_ADDR=$HUB_API_NODE/" ./relaying.sh
sed -i "s/^export BATCH_SIZE=.*$/export BATCH_SIZE=5/" ./relaying.sh
sed -i "s/^export RELAYER_STORAGE_PATH=.*$/export RELAYER_STORAGE_PATH=\.neutron_queries_relayer\/leveldb/" ./relaying.sh
sed -i "s|^go run main\.go.*$|go run \./tools/main\.go|" ./relaying.sh
stop_icq_relayer() {
sleep 60
killall neutron_query_relayer
}
stop_icq_relayer &
bash ./relaying.sh $HYDRO_CONTRACT_ADDRESS 5
echo 'Latest contracts are deployed and ready for testing!'
echo 'Hydro contract address:' $HYDRO_CONTRACT_ADDRESS
echo 'Tribute contract address:' $TRIBUTE_CONTRACT_ADDRESS
- name: Archive log files
uses: actions/upload-artifact@v4
if: failure()
with:
name: logs
path: |
*_res.json
*_tx.json