Skip to content
This repository was archived by the owner on May 23, 2023. It is now read-only.

Commit 5d2dd67

Browse files
committed
Fixed bug in modexp implementation
1 parent 5e8e5a9 commit 5d2dd67

File tree

5 files changed

+99
-97
lines changed

5 files changed

+99
-97
lines changed

ethereum/specials.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ def proc_modexp(ext, msg):
7878
baselen = msg.data.extract32(0)
7979
explen = msg.data.extract32(32)
8080
modlen = msg.data.extract32(64)
81-
first_exp_bytes = msg.data.extract32(96 + baselen)
81+
first_exp_bytes = msg.data.extract32(96 + baselen) >> (8 * max(32 - explen, 0))
8282
bitlength = -1
8383
while first_exp_bytes:
8484
bitlength += 1

ethereum/tests/test_state.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,10 @@ def main():
5252
for testname, testdata in list(tests.items()):
5353
if len(sys.argv) < 3 or testname == sys.argv[2]:
5454
print("Testing: %s %s" % (filename, testname))
55-
try:
56-
checker(testdata)
57-
except new_statetest_utils.EnvNotFoundException:
58-
pass
55+
# try:
56+
checker(testdata)
57+
# except new_statetest_utils.EnvNotFoundException:
58+
# pass
5959

6060

6161
if __name__ == '__main__':

fixtures

Submodule fixtures updated 99 files

precompile_tests_temp/modexp_tests.json

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@
199199
"post": {
200200
"Metropolis": [
201201
{
202-
"hash": "0x3008400b5740a117f455f697d9067c82872c0a282af4518d5be45f5cb011c95f",
202+
"hash": "0x6e4ac1910b666f49a10026acad50b424b233b7851fc851c6d9b125ad3eafcbb4",
203203
"indexes": {
204204
"data": 0,
205205
"gas": 0,
@@ -304,7 +304,7 @@
304304
"post": {
305305
"Metropolis": [
306306
{
307-
"hash": "0x3008400b5740a117f455f697d9067c82872c0a282af4518d5be45f5cb011c95f",
307+
"hash": "0x6e4ac1910b666f49a10026acad50b424b233b7851fc851c6d9b125ad3eafcbb4",
308308
"indexes": {
309309
"data": 0,
310310
"gas": 0,
@@ -409,7 +409,7 @@
409409
"post": {
410410
"Metropolis": [
411411
{
412-
"hash": "0x3008400b5740a117f455f697d9067c82872c0a282af4518d5be45f5cb011c95f",
412+
"hash": "0x6e4ac1910b666f49a10026acad50b424b233b7851fc851c6d9b125ad3eafcbb4",
413413
"indexes": {
414414
"data": 0,
415415
"gas": 0,
@@ -514,7 +514,7 @@
514514
"post": {
515515
"Metropolis": [
516516
{
517-
"hash": "0x3008400b5740a117f455f697d9067c82872c0a282af4518d5be45f5cb011c95f",
517+
"hash": "0x6e4ac1910b666f49a10026acad50b424b233b7851fc851c6d9b125ad3eafcbb4",
518518
"indexes": {
519519
"data": 0,
520520
"gas": 0,
@@ -619,7 +619,7 @@
619619
"post": {
620620
"Metropolis": [
621621
{
622-
"hash": "0x3008400b5740a117f455f697d9067c82872c0a282af4518d5be45f5cb011c95f",
622+
"hash": "0x6e4ac1910b666f49a10026acad50b424b233b7851fc851c6d9b125ad3eafcbb4",
623623
"indexes": {
624624
"data": 0,
625625
"gas": 0,
@@ -1459,7 +1459,7 @@
14591459
"post": {
14601460
"Metropolis": [
14611461
{
1462-
"hash": "0xd0bf11d69418b4eda7a2c6c6e0352f8878f2241fb0875af356634977f4a35884",
1462+
"hash": "0xdacade500da9d396a3311376858dac04e8c9c820a3ee9d8b87a18a7acabb66c9",
14631463
"indexes": {
14641464
"data": 0,
14651465
"gas": 0,
@@ -1564,7 +1564,7 @@
15641564
"post": {
15651565
"Metropolis": [
15661566
{
1567-
"hash": "0xd0bf11d69418b4eda7a2c6c6e0352f8878f2241fb0875af356634977f4a35884",
1567+
"hash": "0xdacade500da9d396a3311376858dac04e8c9c820a3ee9d8b87a18a7acabb66c9",
15681568
"indexes": {
15691569
"data": 0,
15701570
"gas": 0,
@@ -1669,7 +1669,7 @@
16691669
"post": {
16701670
"Metropolis": [
16711671
{
1672-
"hash": "0xd0bf11d69418b4eda7a2c6c6e0352f8878f2241fb0875af356634977f4a35884",
1672+
"hash": "0xdacade500da9d396a3311376858dac04e8c9c820a3ee9d8b87a18a7acabb66c9",
16731673
"indexes": {
16741674
"data": 0,
16751675
"gas": 0,
@@ -1774,7 +1774,7 @@
17741774
"post": {
17751775
"Metropolis": [
17761776
{
1777-
"hash": "0xd0bf11d69418b4eda7a2c6c6e0352f8878f2241fb0875af356634977f4a35884",
1777+
"hash": "0xdacade500da9d396a3311376858dac04e8c9c820a3ee9d8b87a18a7acabb66c9",
17781778
"indexes": {
17791779
"data": 0,
17801780
"gas": 0,
@@ -1879,7 +1879,7 @@
18791879
"post": {
18801880
"Metropolis": [
18811881
{
1882-
"hash": "0xd0bf11d69418b4eda7a2c6c6e0352f8878f2241fb0875af356634977f4a35884",
1882+
"hash": "0xdacade500da9d396a3311376858dac04e8c9c820a3ee9d8b87a18a7acabb66c9",
18831883
"indexes": {
18841884
"data": 0,
18851885
"gas": 0,
@@ -3979,7 +3979,7 @@
39793979
"post": {
39803980
"Metropolis": [
39813981
{
3982-
"hash": "0xd0bf11d69418b4eda7a2c6c6e0352f8878f2241fb0875af356634977f4a35884",
3982+
"hash": "0xdacade500da9d396a3311376858dac04e8c9c820a3ee9d8b87a18a7acabb66c9",
39833983
"indexes": {
39843984
"data": 0,
39853985
"gas": 0,
@@ -4084,7 +4084,7 @@
40844084
"post": {
40854085
"Metropolis": [
40864086
{
4087-
"hash": "0xd0bf11d69418b4eda7a2c6c6e0352f8878f2241fb0875af356634977f4a35884",
4087+
"hash": "0xdacade500da9d396a3311376858dac04e8c9c820a3ee9d8b87a18a7acabb66c9",
40884088
"indexes": {
40894089
"data": 0,
40904090
"gas": 0,
@@ -4189,7 +4189,7 @@
41894189
"post": {
41904190
"Metropolis": [
41914191
{
4192-
"hash": "0xd0bf11d69418b4eda7a2c6c6e0352f8878f2241fb0875af356634977f4a35884",
4192+
"hash": "0xdacade500da9d396a3311376858dac04e8c9c820a3ee9d8b87a18a7acabb66c9",
41934193
"indexes": {
41944194
"data": 0,
41954195
"gas": 0,
@@ -4294,7 +4294,7 @@
42944294
"post": {
42954295
"Metropolis": [
42964296
{
4297-
"hash": "0xd0bf11d69418b4eda7a2c6c6e0352f8878f2241fb0875af356634977f4a35884",
4297+
"hash": "0xdacade500da9d396a3311376858dac04e8c9c820a3ee9d8b87a18a7acabb66c9",
42984298
"indexes": {
42994299
"data": 0,
43004300
"gas": 0,
@@ -4399,7 +4399,7 @@
43994399
"post": {
44004400
"Metropolis": [
44014401
{
4402-
"hash": "0xd0bf11d69418b4eda7a2c6c6e0352f8878f2241fb0875af356634977f4a35884",
4402+
"hash": "0xdacade500da9d396a3311376858dac04e8c9c820a3ee9d8b87a18a7acabb66c9",
44034403
"indexes": {
44044404
"data": 0,
44054405
"gas": 0,
@@ -4609,7 +4609,7 @@
46094609
"post": {
46104610
"Metropolis": [
46114611
{
4612-
"hash": "0x3511d77d8bc66c502aeb153df540a7b86c4357dead7eabc876c515c6d793e674",
4612+
"hash": "0x717fe2475b80f8ee48136c3e7051158fdb400525450890bd2a00fe937657567d",
46134613
"indexes": {
46144614
"data": 0,
46154615
"gas": 0,
@@ -4714,7 +4714,7 @@
47144714
"post": {
47154715
"Metropolis": [
47164716
{
4717-
"hash": "0x4759993af069dcbd81d8759655f92049dd26c4cde1e763e8588005c0cf0b52c4",
4717+
"hash": "0x717fe2475b80f8ee48136c3e7051158fdb400525450890bd2a00fe937657567d",
47184718
"indexes": {
47194719
"data": 0,
47204720
"gas": 0,
@@ -4819,7 +4819,7 @@
48194819
"post": {
48204820
"Metropolis": [
48214821
{
4822-
"hash": "0x4759993af069dcbd81d8759655f92049dd26c4cde1e763e8588005c0cf0b52c4",
4822+
"hash": "0x717fe2475b80f8ee48136c3e7051158fdb400525450890bd2a00fe937657567d",
48234823
"indexes": {
48244824
"data": 0,
48254825
"gas": 0,
@@ -4924,7 +4924,7 @@
49244924
"post": {
49254925
"Metropolis": [
49264926
{
4927-
"hash": "0x4759993af069dcbd81d8759655f92049dd26c4cde1e763e8588005c0cf0b52c4",
4927+
"hash": "0x717fe2475b80f8ee48136c3e7051158fdb400525450890bd2a00fe937657567d",
49284928
"indexes": {
49294929
"data": 0,
49304930
"gas": 0,
@@ -5029,7 +5029,7 @@
50295029
"post": {
50305030
"Metropolis": [
50315031
{
5032-
"hash": "0x4759993af069dcbd81d8759655f92049dd26c4cde1e763e8588005c0cf0b52c4",
5032+
"hash": "0x717fe2475b80f8ee48136c3e7051158fdb400525450890bd2a00fe937657567d",
50335033
"indexes": {
50345034
"data": 0,
50355035
"gas": 0,
@@ -8389,7 +8389,7 @@
83898389
"post": {
83908390
"Metropolis": [
83918391
{
8392-
"hash": "0x40a9d4af7288cc11a4904d54cf9852ac9160379d1cca4c1a89bc32ac641cdf26",
8392+
"hash": "0x28984fd862291b29c481d50eb7e2d25c65da464f47f46759295bb874b590f29a",
83938393
"indexes": {
83948394
"data": 0,
83958395
"gas": 0,
@@ -8494,7 +8494,7 @@
84948494
"post": {
84958495
"Metropolis": [
84968496
{
8497-
"hash": "0x40a9d4af7288cc11a4904d54cf9852ac9160379d1cca4c1a89bc32ac641cdf26",
8497+
"hash": "0x28984fd862291b29c481d50eb7e2d25c65da464f47f46759295bb874b590f29a",
84988498
"indexes": {
84998499
"data": 0,
85008500
"gas": 0,
@@ -8599,7 +8599,7 @@
85998599
"post": {
86008600
"Metropolis": [
86018601
{
8602-
"hash": "0x40a9d4af7288cc11a4904d54cf9852ac9160379d1cca4c1a89bc32ac641cdf26",
8602+
"hash": "0x28984fd862291b29c481d50eb7e2d25c65da464f47f46759295bb874b590f29a",
86038603
"indexes": {
86048604
"data": 0,
86058605
"gas": 0,
@@ -8704,7 +8704,7 @@
87048704
"post": {
87058705
"Metropolis": [
87068706
{
8707-
"hash": "0x40a9d4af7288cc11a4904d54cf9852ac9160379d1cca4c1a89bc32ac641cdf26",
8707+
"hash": "0x28984fd862291b29c481d50eb7e2d25c65da464f47f46759295bb874b590f29a",
87088708
"indexes": {
87098709
"data": 0,
87108710
"gas": 0,
@@ -8809,7 +8809,7 @@
88098809
"post": {
88108810
"Metropolis": [
88118811
{
8812-
"hash": "0x40a9d4af7288cc11a4904d54cf9852ac9160379d1cca4c1a89bc32ac641cdf26",
8812+
"hash": "0x28984fd862291b29c481d50eb7e2d25c65da464f47f46759295bb874b590f29a",
88138813
"indexes": {
88148814
"data": 0,
88158815
"gas": 0,
@@ -9019,7 +9019,7 @@
90199019
"post": {
90209020
"Metropolis": [
90219021
{
9022-
"hash": "0xe47897040db9354eedac51a3701e95819076a12b8bc2087b3b79a3c6d0022dd2",
9022+
"hash": "0x5ed22d476cbd50da5d14a61f4972dfe1f8f0f1bf2ee4af9eabb15c60796ce854",
90239023
"indexes": {
90249024
"data": 0,
90259025
"gas": 0,
@@ -9124,7 +9124,7 @@
91249124
"post": {
91259125
"Metropolis": [
91269126
{
9127-
"hash": "0xe47897040db9354eedac51a3701e95819076a12b8bc2087b3b79a3c6d0022dd2",
9127+
"hash": "0x5ed22d476cbd50da5d14a61f4972dfe1f8f0f1bf2ee4af9eabb15c60796ce854",
91289128
"indexes": {
91299129
"data": 0,
91309130
"gas": 0,
@@ -9229,7 +9229,7 @@
92299229
"post": {
92309230
"Metropolis": [
92319231
{
9232-
"hash": "0xe47897040db9354eedac51a3701e95819076a12b8bc2087b3b79a3c6d0022dd2",
9232+
"hash": "0x5ed22d476cbd50da5d14a61f4972dfe1f8f0f1bf2ee4af9eabb15c60796ce854",
92339233
"indexes": {
92349234
"data": 0,
92359235
"gas": 0,
@@ -9334,7 +9334,7 @@
93349334
"post": {
93359335
"Metropolis": [
93369336
{
9337-
"hash": "0xe47897040db9354eedac51a3701e95819076a12b8bc2087b3b79a3c6d0022dd2",
9337+
"hash": "0x5ed22d476cbd50da5d14a61f4972dfe1f8f0f1bf2ee4af9eabb15c60796ce854",
93389338
"indexes": {
93399339
"data": 0,
93409340
"gas": 0,
@@ -9439,7 +9439,7 @@
94399439
"post": {
94409440
"Metropolis": [
94419441
{
9442-
"hash": "0xe47897040db9354eedac51a3701e95819076a12b8bc2087b3b79a3c6d0022dd2",
9442+
"hash": "0x5ed22d476cbd50da5d14a61f4972dfe1f8f0f1bf2ee4af9eabb15c60796ce854",
94439443
"indexes": {
94449444
"data": 0,
94459445
"gas": 0,

0 commit comments

Comments
 (0)