ethereum / tests

Common tests for all Ethereum implementations

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

mcopy test vectors changed

winsvega opened this issue · comments

@chfast can't regenerate this vectors check if its ok

:label src1_size44767
- :label src1_size44768
- :label src1_size44769
- :label src31_size44767
- :label src31_size44768
- :label src31_size44769
- :label src32_size44768
- :label src32_size44769
- :label src32_size44767

#1313

I see, this yul oog depends on solc optimisations.
we try to disable solc optimisations and make tests on yul that do no optimisations
because with each new version solc introduces new optimisations that mess up the test code
such as here

d 13 no optimise

N         OPNAME   GASCOST  TOTALGAS REMAINGAS     STACK
0-1          PUSH1         3         0     34405
1-1          PUSH0         2         3     34402    1:[1,]
2-1         SSTORE     22100         5     34400    2:[1,0,]
              SSTORE [0x0] = 0x1
3-1          PUSH1         3     22105     12300
4-1          PUSH2         3     22108     12297    1:[1,]
5-1         MSTORE      8039     22111     12294    2:[1,af00,]
              MSTORE [0xaf00] = 0x1
6-1          PUSH1         3     30150      4255
7-1          PUSH1         3     30153      4252    1:[15,]
8-1   CALLDATALOAD         3     30156      4249    2:[15,20,]
9-1          PUSH0         2     30159      4246    2:[15,aedf,]
10-1   CALLDATALOAD         3     30161      4244    3:[15,aedf,0,]
11-1          PUSH0         2     30164      4241    3:[15,aedf,1,]
12-1          PUSH1         3     30166      4239    4:[15,aedf,1,0,]
13-1           JUMP         8     30169      4236    5:[15,aedf,1,0,17,]
14-1       JUMPDEST         1     30177      4228    4:[15,aedf,1,0,]
15-1          MCOPY      4200     30178      4227    4:[15,aedf,1,0,]
16-1           JUMP         8     34378        27    1:[15,]
17-1       JUMPDEST         1     34386        19
18-1           STOP         0     34387        18



d 13 optimise
N         OPNAME   GASCOST  TOTALGAS REMAINGAS     STACK
0-1          PUSH1         3         0     34405
1-1           JUMP         8         3     34402    1:[c,]
2-1       JUMPDEST         1        11     34394
3-1          PUSH1         3        12     34393
4-1          PUSH0         2        15     34390    1:[1,]
5-1         SSTORE     22100        17     34388    2:[1,0,]
              SSTORE [0x0] = 0x1
6-1          PUSH1         3     22117     12288
7-1          PUSH2         3     22120     12285    1:[1,]
8-1         MSTORE      8039     22123     12282    2:[1,af00,]
              MSTORE [0xaf00] = 0x1
9-1          PUSH1         3     30162      4243
10-1          PUSH1         3     30165      4240    1:[22,]
11-1   CALLDATALOAD         3     30168      4237    2:[22,20,]
12-1          PUSH0         2     30171      4234    2:[22,aedf,]
13-1   CALLDATALOAD         3     30173      4232    3:[22,aedf,0,]
14-1          PUSH0         2     30176      4229    3:[22,aedf,1,]
15-1          PUSH1         3     30178      4227    4:[22,aedf,1,0,]
16-1           JUMP         8     30181      4224    5:[22,aedf,1,0,3,]
17-1       JUMPDEST         1     30189      4216    4:[22,aedf,1,0,]
18-1           DUP3         3     30190      4215    4:[22,aedf,1,0,]
19-1           DUP3         3     30193      4212    5:[22,aedf,1,0,aedf,]
20-1           DUP3         3     30196      4209    6:[22,aedf,1,0,aedf,1,]
21-1          MCOPY      4200     30199      4206    7:[22,aedf,1,0,aedf,1,0,]
22-1            POP         2     34399         6    4:[22,aedf,1,0,]
23-1            POP         2     34401         4    3:[22,aedf,1,]
24-1            POP         2     34403         2    2:[22,aedf,]
25-1           JUMP         8     34405         0    1:[22,]
Detected error: out of gas

@chfast
is this the expected behaviour?

because solc optimisations might change consumed gas in the future versions of solidity.
it is better to fix this test

It is hard to change it if you want OOG happen while copying bytes and not for any other reason.