-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcheck_results_against_expected.py
64 lines (49 loc) · 2.07 KB
/
check_results_against_expected.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
# check the analysis results for block 0 - ... against what was reported in
# {link}
redeployed = {}
with open("analysis-results/genesis-to-12799316/creators-of-redeployed-addrs.csv", "r") as f:
for line in f:
break
for line in f:
csv_line_parts = line.strip('\n').split(',')
if csv_line_parts[0] in redeployed:
raise Exception("should not happen")
redeployed[csv_line_parts[0]] = int(csv_line_parts[1])
redeployed_prev = {}
redeployed_address_count_expected = 0
with open("analysis-results/previous-results/redeployed.csv", "r") as f:
for line in f:
break
for line in f:
csv_line_parts = line.strip("\n").split(",")
if csv_line_parts[6] != '0':
continue
redeployed_address_count_expected += int(csv_line_parts[8])
if redeployed["0x" + csv_line_parts[2]] != int(csv_line_parts[8]):
raise Exception("bad result")
with open("analysis-results/genesis-to-12799316/redeployed-addrs.csv", "r") as f:
redeployed_address_count = len(f.readlines())
delta_allowed = 4 # dunno why these 4 addresses were not picked up by my script
if abs(redeployed_address_count_expected - redeployed_address_count) > delta_allowed:
raise Exception("more redeployed addresses missing than expected")
ephemeral_prev = set()
with open("analysis-results/previous-results/ephemeral.csv", "r") as f:
for line in f:
break
for line in f:
parts = line.split(',')
if parts[0] == 'true' and parts[6] != '0':
if parts[2] in ephemeral_prev:
raise Exception("should not happen")
ephemeral_prev.add("0x"+parts[2])
ephemeral = set()
with open("analysis-results/genesis-to-12799316/ephemeral-addrs.csv", 'r') as f:
for line in f:
parts = line.split(',')
if parts[0] in ephemeral:
raise Exception("should not happen")
ephemeral.add(parts[0])
for item in ephemeral_prev:
if not item in ephemeral:
raise Exception("expected not found in current results: {}".format(item))
print("Ok")