-
Notifications
You must be signed in to change notification settings - Fork 0
/
testhelper.py
67 lines (52 loc) · 1.08 KB
/
testhelper.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
67
from pyethereum import tester as t
import logging
logger = logging.getLogger()
#logger.setLevel(logging.INFO)
s = t.state(fond=long(10**75))
bet = 1000000000
def ls():
global c
c = s.contract("lotte.se")
def send(c, data, p=0):
return s.send(t.k0, c, p, data)
def get(c, n):
return s.block.get_storage_data(c, n)
def test():
ls()
send(c, [0], bet)
send(c, [0], bet)
send(c, [0], bet)
s.mine()
s.mine()
send(c, [0])
def sha3(s1):
h = hashlib.new("sha3_512")
h.update(s1)
print h.hexdigest()
print int(h.hexdigest(), 16)
return h
def ppath(h):
p = 0
i = 0
while i < 8:
r = h % 2
h = h /2
p = p + r* 2**i
i +=1
print r,
print "\n"+str(p)
def ls():
global c
c = s.contract("solve.se")
def ld():
global c3
c3 = s.contract("dropbox.se")
s.mine()
def lh():
global c2
c2 = s.contract("sha3.se")
def build():
global data
data = []
for i in range(10000, 10010):
data.append(get(c, i))