forked from babylonchain/networks
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.yml
195 lines (171 loc) · 6.9 KB
/
config.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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
version: 2.1
orbs:
go: circleci/[email protected]
jobs:
build-eotsd:
machine:
image: ubuntu-2204:2024.01.1
steps:
- restore_cache:
keys:
- eotsd-ae30623a634450db81ce1755839754cc822bf5e5
- go/install:
version: "1.21.4"
- run:
name: Build eotsd
command: |
if [ ! -f /home/circleci/.go_workspace/bin/eotsd ]; then
git clone https://github.com/babylonchain/finality-provider.git
cd finality-provider
git checkout ae30623a634450db81ce1755839754cc822bf5e5
mkdir -p /home/circleci/go/bin/
make install
fi
- save_cache:
key: eotsd-ae30623a634450db81ce1755839754cc822bf5e5
paths:
- /home/circleci/.go_workspace/bin/eotsd
build-stakercli:
machine:
image: ubuntu-2204:2024.01.1
steps:
- restore_cache:
keys:
- stakercli-f2a83d1c3b00d8de2c8cf7cc3dda9d446201a8ce
- go/install:
version: "1.21.4"
- run:
name: Build stakercli
command: |
if [ ! -f /home/circleci/.go_workspace/bin/stakercli ]; then
git clone https://github.com/babylonchain/btc-staker.git
cd btc-staker
git checkout f2a83d1c3b00d8de2c8cf7cc3dda9d446201a8ce
mkdir -p /home/circleci/go/bin/
make install
fi
- save_cache:
key: stakercli-f2a83d1c3b00d8de2c8cf7cc3dda9d446201a8ce
paths:
- /home/circleci/.go_workspace/bin/stakercli
verify-sig:
machine:
image: ubuntu-2204:2024.01.1
steps:
- checkout
- restore_cache:
keys:
- fpdiff-{{ epoch }}
- eotsd-ae30623a634450db81ce1755839754cc822bf5e5
- run:
name: Verify signature
command: |
currBranch=$(git rev-parse --abbrev-ref HEAD)
if [ "main" == "$currBranch" ]; then
ALL_CHANGED_FILES=$(git diff HEAD~1 --name-only **/finality-providers/registry/)
else
ALL_CHANGED_FILES=$(git diff main --name-only **/finality-providers/registry/)
fi
echo "ALL_CHANGED_FILES" $ALL_CHANGED_FILES
for filePathRegistryFP in ${ALL_CHANGED_FILES}; do
echo "verify" "$filePathRegistryFP"
moniker=$(cat "$filePathRegistryFP" | jq -r '.description.moniker')
echo "fp moniker:" $moniker
if [ ${#moniker} -lt 3 ]; then
echo $moniker "has less than 3 characteres"
exit 1
fi
nickname=$(basename "$filePathRegistryFP" .json)
echo "fp nickname:" $nickname
btcPk=$(cat "$filePathRegistryFP" | jq -r '.btc_pk')
echo "fp btcpk:" $btcPk
baseDir=$(dirname $filePathRegistryFP)
signature=$(cat "$baseDir/../sigs/$nickname.sig" | xargs)
echo "fp signature:" $signature
/home/circleci/.go_workspace/bin/eotsd verify-schnorr-sig "$filePathRegistryFP" --btc-pk $btcPk --signature $signature
echo
echo "✅ '${nickname}' is a valid fp"
done
verify-offchain-signed-tx:
machine:
image: ubuntu-2204:2024.01.1
steps:
- checkout
- restore_cache:
keys:
- stakercli-f2a83d1c3b00d8de2c8cf7cc3dda9d446201a8ce
- run:
name: Verify offchain signed transaction
command: |
currBranch=$(git rev-parse --abbrev-ref HEAD)
if [ "main" == "$currBranch" ]; then
ALL_CHANGED_FILES=$(git diff HEAD~1 --name-only **/finality-providers/registry/)
else
ALL_CHANGED_FILES=$(git diff main --name-only **/finality-providers/registry/)
fi
echo "ALL_CHANGED_FILES" $ALL_CHANGED_FILES
if [ -z "$ALL_CHANGED_FILES" ]; then
echo "No finality provider modified"
else
sudo wget https://github.com/CosmWasm/wasmvm/releases/download/v1.5.2/libwasmvm.x86_64.so \
-O /lib/libwasmvm.x86_64.so
export LD_LIBRARY_PATH=/lib/libwasmvm.x86_64.so:$LD_LIBRARY_PATH
for filePathRegistryFP in ${ALL_CHANGED_FILES}; do
echo "verify" "$filePathRegistryFP"
signedTx=$(cat "$filePathRegistryFP" | jq -r '.deposit.signed_tx')
btcPk=$(cat "$filePathRegistryFP" | jq -r '.btc_pk')
/home/circleci/.go_workspace/bin/stakercli transaction check-phase1-staking-transaction \
--covenant-committee-pks 50929b74c1a04954b78b4b6035e97a5e078a5a0f28ec96d547bfee9ace803ac0 --covenant-quorum 1 \
--magic-bytes 62627434 --network signet --staking-transaction $signedTx --finality-provider-pk $btcPk \
--staking-time 52560 --staking-amount=10000000
nickname=$(basename "$filePathRegistryFP" .json)
echo
echo "✅ '${nickname}' has a valid self locking deposit"
done
fi
verify-onchain-BTC-tx:
machine:
image: ubuntu-2204:2024.01.1
steps:
- checkout
- run:
name: Verify onchain BTC transaction
command: |
currBranch=$(git rev-parse --abbrev-ref HEAD)
if [ "main" == "$currBranch" ]; then
ALL_CHANGED_FILES=$(git diff HEAD~1 --name-only **/finality-providers/registry/)
else
ALL_CHANGED_FILES=$(git diff main --name-only **/finality-providers/registry/)
fi
echo "ALL_CHANGED_FILES" $ALL_CHANGED_FILES
for filePathRegistryFP in ${ALL_CHANGED_FILES}; do
echo "verify" "$filePathRegistryFP"
signedTx=$(cat "$filePathRegistryFP" | jq -r '.deposit.signed_tx')
txHash=$(cat "$filePathRegistryFP" | jq -r '.deposit.tx_hash')
onchainTx=$(curl https://signet.bitcoinexplorer.org/api/tx/$txHash | jq)
confirmations=$(echo $onchainTx | jq -r '.confirmations')
signedTxOnChain=$(echo $onchainTx | jq -r '.hex')
if [[ "$confirmations" -lt "6" ]]; then
echo "The tx ${txHash} has ${confirmations} confirmations, it should have at least 6"
exit 1
fi
if [[ $signedTx != $signedTxOnChain ]]; then
echo "Signed tx in json ${signedTx} is different than signed tx on signet ${signedTxOnChain}"
exit 1
fi
nickname=$(basename "$filePathRegistryFP" .json)
echo
echo "✅ '${nickname}' has a valid on chain btc tx"
done
workflows:
New-FP:
jobs:
- build-eotsd
- build-stakercli
- verify-onchain-BTC-tx
- verify-sig:
requires:
- build-eotsd
- verify-offchain-signed-tx:
requires:
- build-stakercli