-
Notifications
You must be signed in to change notification settings - Fork 2
/
sktest_snapshot_restart.py
66 lines (51 loc) · 1.58 KB
/
sktest_snapshot_restart.py
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
import os
import time
from sktest import LocalStarter, Node, SChain
if os.geteuid() != 0:
print("Please run with sudo")
exit(1)
global sktest_exe
sktest_exe = os.getenv("SKTEST_EXE",
"/home/dimalit/skaled/build-no-mp/skaled/skaled")
emptyBlockIntervalMs = 1
snapshotIntervalSec = 10
run_container = os.getenv('RUN_CONTAINER')
n1 = Node(emptyBlockIntervalMs=emptyBlockIntervalMs,
snapshotInterval=snapshotIntervalSec)
n2 = Node(emptyBlockIntervalMs=emptyBlockIntervalMs,
snapshotInterval=snapshotIntervalSec)
n3 = Node(emptyBlockIntervalMs=emptyBlockIntervalMs,
snapshotInterval=snapshotIntervalSec)
n4 = Node(emptyBlockIntervalMs=emptyBlockIntervalMs,
snapshotInterval=snapshotIntervalSec,
snapshottedStartSeconds=90) # 90 # 18
starter = LocalStarter(sktest_exe)
ch = SChain(
[n1, n2, n3, n4],
starter,
prefill=[1000000000000000000, 2000000000000000000],
emptyBlockIntervalMs=emptyBlockIntervalMs,
snapshotIntervalSec=snapshotIntervalSec,
bls=True
)
ch.start(start_timeout=300, restart_option=True) # 300
print("Waiting for full catch-up")
# while True:
for _ in range(50):
bn1 = n1.eth.blockNumber
bn2 = n2.eth.blockNumber
bn3 = n3.eth.blockNumber
try:
bn4 = n4.eth.blockNumber
except Exception:
bn4 = None
print(f"blockNumber's: {bn1} {bn2} {bn3} {bn4}")
if bn1 == bn2 and bn2 == bn3 and bn3 == bn4:
break
try:
ch.transaction_async()
except:
pass # already exists
time.sleep(0.6)
print("Exiting")
ch.stop()