forked from project-ubin/ubin-quorum
-
Notifications
You must be signed in to change notification settings - Fork 0
/
integration_test.sh
executable file
·190 lines (190 loc) · 8.16 KB
/
integration_test.sh
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
echo "[*] Deploy contracts and initializing states"
truffle exec --network mas dapps/init.js
echo "[*] Stashes now have balances as private states"
truffle exec --network a dapps/bal.js
truffle exec --network b dapps/bal.js
truffle exec --network c dapps/bal.js
sleep 1
echo "[*] Submit a payment when there's enough liquidity"
truffle exec --network a dapps/checkAgentState.js
truffle exec --network a dapps/submit_1.js
echo "[*] Positions are updated"
truffle exec --network a dapps/bal.js
truffle exec --network b dapps/bal.js
truffle exec --network c dapps/bal.js
echo "[*] Payment are placed in the participating parties in pending state"
truffle exec --network a dapps/pmt.js
truffle exec --network b dapps/pmt.js
truffle exec --network c dapps/pmt.js
echo "[*] Checking gridlock queue - should be empty"
truffle exec --network a dapps/gridlockQ.js
truffle exec --network b dapps/gridlockQ.js
truffle exec --network c dapps/gridlockQ.js
echo "[*] Confirm queued payment"
truffle exec --network a dapps/confirm.js
echo "[*] Balances are updated"
truffle exec --network a dapps/bal.js
truffle exec --network b dapps/bal.js
truffle exec --network c dapps/bal.js
echo "[*] Payment state is updated"
truffle exec --network a dapps/pmt.js
truffle exec --network b dapps/pmt.js
truffle exec --network c dapps/pmt.js
echo "[*] Submit a set of gridlocking payments"
truffle exec --network a dapps/checkAgentState.js
truffle exec --network b dapps/checkAgentState.js
truffle exec --network c dapps/checkAgentState.js
truffle exec --network a dapps/submit_gridlocked.js
# truffle exec --network a dapps/add2GQ.js
truffle exec --network a dapps/checkAgentState.js
truffle exec --network b dapps/checkAgentState.js
truffle exec --network c dapps/checkAgentState.js
truffle exec --network b dapps/submit_gridlocked.js
# truffle exec --network b dapps/add2GQ.js
truffle exec --network a dapps/checkAgentState.js
truffle exec --network b dapps/checkAgentState.js
truffle exec --network c dapps/checkAgentState.js
truffle exec --network c dapps/submit_gridlocked.js
# truffle exec --network c dapps/add2GQ.js
echo "[*] Positions are updated"
truffle exec --network a dapps/bal.js
truffle exec --network b dapps/bal.js
truffle exec --network c dapps/bal.js
echo "[*] Payments are queued into private gridlock queue"
truffle exec --network a dapps/gridlockQ.js
truffle exec --network b dapps/gridlockQ.js
truffle exec --network c dapps/gridlockQ.js
echo "[*] Payments are committed into global gridlock queue"
truffle exec --network a dapps/globalQ.js
truffle exec --network b dapps/globalQ.js
truffle exec --network c dapps/globalQ.js
echo "[*] Line should be open now - Agent state should be Lineopen"
truffle exec --network a dapps/checkAgentState.js
truffle exec --network b dapps/checkAgentState.js
truffle exec --network c dapps/checkAgentState.js
echo "[*] Participants are lining up"
truffle exec --network a dapps/lineup.js
truffle exec --network b dapps/lineup.js
truffle exec --network c dapps/lineup.js
wait
echo "[*] Resolve sequence is decided"
truffle exec --network a dapps/resolveSeq.js
truffle exec --network b dapps/resolveSeq.js
truffle exec --network c dapps/resolveSeq.js
echo "[*] Participants do gridlock resolution in round robin"
truffle exec --network a dapps/checkAgentState.js
truffle exec --network a dapps/doResolve.js
truffle exec --network a dapps/globalQ.js
# truffle exec --network a dapps/checkDone.js
truffle exec --network b dapps/globalQ.js
# truffle exec --network b dapps/checkDone.js
truffle exec --network c dapps/globalQ.js
# truffle exec --network c dapps/checkDone.js
truffle exec --network b dapps/checkAgentState.js
truffle exec --network b dapps/doResolve.js
truffle exec --network a dapps/globalQ.js
# truffle exec --network a dapps/checkDone.js
truffle exec --network b dapps/globalQ.js
# truffle exec --network b dapps/checkDone.js
truffle exec --network c dapps/globalQ.js
# truffle exec --network c dapps/checkDone.js
truffle exec --network c dapps/checkAgentState.js
truffle exec --network c dapps/doResolve.js
truffle exec --network a dapps/globalQ.js
# truffle exec --network a dapps/checkDone.js
truffle exec --network b dapps/globalQ.js
# truffle exec --network b dapps/checkDone.js
truffle exec --network c dapps/globalQ.js
# truffle exec --network c dapps/checkDone.js
echo "[*] Balance before netting"
truffle exec --network a dapps/bal.js
truffle exec --network b dapps/bal.js
truffle exec --network c dapps/bal.js
echo "[*] Agent state moved to Settling"
truffle exec --network a dapps/checkAgentState.js
truffle exec --network b dapps/checkAgentState.js
truffle exec --network c dapps/checkAgentState.js
echo "[*] Next participant kick off the settling process"
truffle exec --network a dapps/settle.js
echo "[*] Netting result"
truffle exec --network a dapps/bal.js
truffle exec --network b dapps/bal.js
truffle exec --network c dapps/bal.js
truffle exec --network a dapps/pmt.js
truffle exec --network b dapps/pmt.js
truffle exec --network c dapps/pmt.js
truffle exec --network a dapps/globalQ.js
truffle exec --network b dapps/globalQ.js
truffle exec --network c dapps/globalQ.js
echo "[*] Regulator reset gridlock trigger (for the next test)"
truffle exec --network mas dapps/setThreshold.js
echo "[*] Submit a set of deadlocking payments"
truffle exec --network a dapps/checkAgentState.js
truffle exec --network a dapps/submit_deadlocked.js
truffle exec --network a dapps/add2GQ_deadlocked.js
truffle exec --network b dapps/checkAgentState.js
truffle exec --network b dapps/submit_deadlocked.js
truffle exec --network b dapps/add2GQ_deadlocked.js
truffle exec --network c dapps/checkAgentState.js
truffle exec --network c dapps/submit_deadlocked.js
truffle exec --network c dapps/add2GQ_deadlocked.js
echo "[*] Positions are updated"
truffle exec --network a dapps/bal.js
truffle exec --network b dapps/bal.js
truffle exec --network c dapps/bal.js
echo "[*] Payments are queued into private gridlock queue"
truffle exec --network a dapps/pmt.js
truffle exec --network b dapps/pmt.js
truffle exec --network c dapps/pmt.js
echo "[*] Payments are queued into global gridlock queue"
truffle exec --network a dapps/globalQ.js
truffle exec --network b dapps/globalQ.js
truffle exec --network c dapps/globalQ.js
echo "[*] Line should be open now - Agent state should be Lineopen"
truffle exec --network a dapps/checkAgentState.js
truffle exec --network b dapps/checkAgentState.js
truffle exec --network c dapps/checkAgentState.js
echo "[*] Participants are lining up"
truffle exec --network a dapps/lineup.js
truffle exec --network b dapps/lineup.js
truffle exec --network c dapps/lineup.js
echo "[*] Resolve sequence is decided"
truffle exec --network a dapps/resolveSeq.js
truffle exec --network b dapps/resolveSeq.js
truffle exec --network c dapps/resolveSeq.js
echo "[*] Participants do gridlock resolution in round robin"
truffle exec --network a dapps/checkAgentState.js
truffle exec --network a dapps/doResolve.js
truffle exec --network a dapps/globalQ.js
truffle exec --network b dapps/globalQ.js
truffle exec --network c dapps/globalQ.js
truffle exec --network b dapps/checkAgentState.js
truffle exec --network b dapps/doResolve.js
truffle exec --network a dapps/globalQ.js
truffle exec --network b dapps/globalQ.js
truffle exec --network c dapps/globalQ.js
truffle exec --network c dapps/checkAgentState.js
truffle exec --network c dapps/doResolve.js
truffle exec --network a dapps/globalQ.js
truffle exec --network b dapps/globalQ.js
truffle exec --network c dapps/globalQ.js
echo "[*] Agent state moved to Settling"
truffle exec --network a dapps/checkAgentState.js
truffle exec --network b dapps/checkAgentState.js
truffle exec --network c dapps/checkAgentState.js
echo "[*] Balance before netting"
truffle exec --network a dapps/bal.js
truffle exec --network b dapps/bal.js
truffle exec --network c dapps/bal.js
echo "[*] Next participant kick off the settling process"
truffle exec --network a dapps/settle.js
echo "[*] Netting result"
truffle exec --network a dapps/bal.js
truffle exec --network b dapps/bal.js
truffle exec --network c dapps/bal.js
truffle exec --network a dapps/pmt.js
truffle exec --network b dapps/pmt.js
truffle exec --network c dapps/pmt.js
truffle exec --network a dapps/globalQ.js
truffle exec --network b dapps/globalQ.js
truffle exec --network c dapps/globalQ.js