@@ -341,13 +341,13 @@ def test_hedge():
341
341
c2 = s .abi_contract (hedge_code , sender = tester .k0 )
342
342
# Have the first party register, sending 10^16 wei and
343
343
# asking for a hedge using currency code 500
344
- o1 = c2 .main (c .address , 500 , value = 10 ** 16 )
344
+ o1 = c2 .main (c .address , 500 , value = 10 ** 16 )
345
345
assert o1 == 1
346
346
# Have the second party register. It should receive the
347
347
# amount of units of the second currency that it is
348
348
# entitled to. Note that from the previous test this is
349
349
# set to 726
350
- o2 = c2 .main (0 , 0 , value = 10 ** 16 , sender = tester .k2 )
350
+ o2 = c2 .main (0 , 0 , value = 10 ** 16 , sender = tester .k2 )
351
351
assert o2 == 7260000000000000000
352
352
snapshot = s .snapshot ()
353
353
# Set the price of the asset down to 300 wei
@@ -466,12 +466,12 @@ def recurse():
466
466
467
467
def test_reverter ():
468
468
s = tester .state ()
469
- c = s .abi_contract (reverter_code , endowment = 10 ** 15 )
469
+ c = s .abi_contract (reverter_code , endowment = 10 ** 15 )
470
470
c .entry ()
471
471
assert s .block .get_storage_data (c .address , 8080 ) == 4040
472
- assert s .block .get_balance (decode_hex ('0' * 39 + '7' )) == 9
472
+ assert s .block .get_balance (decode_hex ('0' * 39 + '7' )) == 9
473
473
assert s .block .get_storage_data (c .address , 8081 ) == 0
474
- assert s .block .get_balance (decode_hex ('0' * 39 + '8' )) == 0
474
+ assert s .block .get_balance (decode_hex ('0' * 39 + '8' )) == 0
475
475
476
476
# Test stateless contracts
477
477
@@ -932,7 +932,6 @@ def kall():
932
932
"""
933
933
934
934
935
-
936
935
def test_saveload ():
937
936
s = tester .state ()
938
937
c = s .abi_contract (saveload_code )
@@ -1077,8 +1076,8 @@ def test_indirect_sort():
1077
1076
s = tester .state ()
1078
1077
open (filename9 , 'w' ).write (sort_code )
1079
1078
c = s .abi_contract (sort_tester_code )
1080
- assert c .test ([80 , 234 , 112 , 112 , 29 ]) == [29 , 80 , 112 , 112 , 234 ]
1081
1079
os .remove (filename9 )
1080
+ assert c .test ([80 , 234 , 112 , 112 , 29 ]) == [29 , 80 , 112 , 112 , 234 ]
1082
1081
1083
1082
multiarg_code = """
1084
1083
def kall(a:arr, b, c:arr, d:str, e):
@@ -1232,12 +1231,12 @@ def test_sha256():
1232
1231
s = tester .state ()
1233
1232
c = s .abi_contract (sha256_code )
1234
1233
assert c .main () == [
1235
- 0xe3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 - 2 ** 256 ,
1236
- 0xd9147961436944f43cd99d28b2bbddbf452ef872b30c8279e255e7daafc7f946 - 2 ** 256 ,
1237
- 0xcd6357efdd966de8c0cb2f876cc89ec74ce35f0968e11743987084bd42fb8944 - 2 ** 256 ,
1238
- 0xcd6357efdd966de8c0cb2f876cc89ec74ce35f0968e11743987084bd42fb8944 - 2 ** 256 ,
1239
- 0xb393978842a0fa3d3e1470196f098f473f9678e72463cb65ec4ab5581856c2e4 - 2 ** 256 ,
1240
- 0xb393978842a0fa3d3e1470196f098f473f9678e72463cb65ec4ab5581856c2e4 - 2 ** 256
1234
+ 0xe3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 - 2 ** 256 ,
1235
+ 0xd9147961436944f43cd99d28b2bbddbf452ef872b30c8279e255e7daafc7f946 - 2 ** 256 ,
1236
+ 0xcd6357efdd966de8c0cb2f876cc89ec74ce35f0968e11743987084bd42fb8944 - 2 ** 256 ,
1237
+ 0xcd6357efdd966de8c0cb2f876cc89ec74ce35f0968e11743987084bd42fb8944 - 2 ** 256 ,
1238
+ 0xb393978842a0fa3d3e1470196f098f473f9678e72463cb65ec4ab5581856c2e4 - 2 ** 256 ,
1239
+ 0xb393978842a0fa3d3e1470196f098f473f9678e72463cb65ec4ab5581856c2e4 - 2 ** 256
1241
1240
]
1242
1241
1243
1242
sha3_code = """
@@ -1250,12 +1249,12 @@ def test_sha3():
1250
1249
s = tester .state ()
1251
1250
c = s .abi_contract (sha3_code )
1252
1251
assert c .main () == [
1253
- 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 - 2 ** 256 ,
1254
- 0xc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b - 2 ** 256 ,
1252
+ 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 - 2 ** 256 ,
1253
+ 0xc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b - 2 ** 256 ,
1255
1254
0x41791102999c339c844880b23950704cc43aa840f3739e365323cda4dfa89e7a ,
1256
1255
0x41791102999c339c844880b23950704cc43aa840f3739e365323cda4dfa89e7a ,
1257
- 0xdfded4ed5ac76ba7379cfe7b3b0f53e768dca8d45a34854e649cfc3c18cbd9cd - 2 ** 256 ,
1258
- 0xdfded4ed5ac76ba7379cfe7b3b0f53e768dca8d45a34854e649cfc3c18cbd9cd - 2 ** 256
1256
+ 0xdfded4ed5ac76ba7379cfe7b3b0f53e768dca8d45a34854e649cfc3c18cbd9cd - 2 ** 256 ,
1257
+ 0xdfded4ed5ac76ba7379cfe7b3b0f53e768dca8d45a34854e649cfc3c18cbd9cd - 2 ** 256
1259
1258
]
1260
1259
1261
1260
types_in_functions_code = """
@@ -1316,21 +1315,22 @@ def get_prevhashes(k):
1316
1315
return(o:arr)
1317
1316
"""
1318
1317
1318
+
1319
1319
@pytest .mark .timeout (100 )
1320
1320
def test_prevhashes ():
1321
1321
s = tester .state ()
1322
1322
c = s .abi_contract (prevhashes_code )
1323
1323
s .mine (7 )
1324
1324
# Hashes of last 14 blocks including existing one
1325
- o1 = [x % 2 ** 256 for x in c .get_prevhashes (14 )]
1325
+ o1 = [x % 2 ** 256 for x in c .get_prevhashes (14 )]
1326
1326
# hash of self = 0, hash of blocks back to genesis block as is, hash of
1327
1327
# blocks before genesis block = 0
1328
1328
t1 = [0 ] + [utils .big_endian_to_int (b .hash ) for b in s .blocks [- 2 ::- 1 ]] \
1329
1329
+ [0 ] * 6
1330
1330
assert o1 == t1
1331
1331
s .mine (256 )
1332
1332
# Test 256 limit: only 1 <= g <= 256 generation ancestors get hashes shown
1333
- o2 = [x % 2 ** 256 for x in c .get_prevhashes (270 )]
1333
+ o2 = [x % 2 ** 256 for x in c .get_prevhashes (270 )]
1334
1334
t2 = [0 ] + [utils .big_endian_to_int (b .hash ) for b in s .blocks [- 2 :- 258 :- 1 ]] \
1335
1335
+ [0 ] * 13
1336
1336
assert o2 == t2
0 commit comments