diff --git a/tests/frontier/opcodes/test_calldatacopy.py b/tests/frontier/opcodes/test_calldatacopy.py index 41777f097a..a5ca03dee8 100644 --- a/tests/frontier/opcodes/test_calldatacopy.py +++ b/tests/frontier/opcodes/test_calldatacopy.py @@ -1,5 +1,7 @@ """test `CALLDATACOPY` opcode.""" +from re import M + import pytest from ethereum_test_forks import Fork @@ -15,52 +17,35 @@ ( ( Op.CALLDATACOPY(dest_offset=0, offset=1, size=2) - + Op.PUSH1[0x0] - + Op.MLOAD - + Op.PUSH1[0x0] - + Op.SSTORE + + Op.SSTORE(key=0x0, value=Op.MLOAD(offset=0)) + Op.RETURN(offset=0, size=Op.MSIZE) ), b"\x00", Account( - storage={ - 0x00: 0x3456000000000000000000000000000000000000000000000000000000000000 - } + storage={0x00: 0x3456000000000000000000000000000000000000000000000000000000000000} ), Account( - storage={ - 0x00: 0x3456000000000000000000000000000000000000000000000000000000000000 - } + storage={0x00: 0x3456000000000000000000000000000000000000000000000000000000000000} ), ), ( ( Op.CALLDATACOPY(dest_offset=0, offset=1, size=1) - + Op.PUSH1[0x0] - + Op.MLOAD - + Op.PUSH1[0x0] - + Op.SSTORE + + Op.SSTORE(key=0x0, value=Op.MLOAD(offset=0)) + Op.RETURN(offset=0, size=Op.MSIZE) ), b"\x01", Account( - storage={ - 0x00: 0x3400000000000000000000000000000000000000000000000000000000000000 - }, + storage={0x00: 0x3400000000000000000000000000000000000000000000000000000000000000}, ), Account( - storage={ - 0x00: 0x3400000000000000000000000000000000000000000000000000000000000000 - }, + storage={0x00: 0x3400000000000000000000000000000000000000000000000000000000000000}, ), ), ( ( Op.CALLDATACOPY(dest_offset=0, offset=1, size=0) - + Op.PUSH1[0x0] - + Op.MLOAD - + Op.PUSH1[0x0] - + Op.SSTORE + + Op.SSTORE(key=0x0, value=Op.MLOAD(offset=0)) + Op.RETURN(offset=0, size=Op.MSIZE) ), b"\x02", @@ -74,10 +59,7 @@ ( ( Op.CALLDATACOPY(dest_offset=0, offset=0, size=0) - + Op.PUSH1[0x0] - + Op.MLOAD - + Op.PUSH1[0x0] - + Op.SSTORE + + Op.SSTORE(key=0x0, value=Op.MLOAD(offset=0)) + Op.RETURN(offset=0, size=Op.MSIZE) ), b"\x03", @@ -95,10 +77,7 @@ offset=0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFA, size=0xFF, ) - + Op.PUSH1[0x0] - + Op.MLOAD - + Op.PUSH1[0x0] - + Op.SSTORE + + Op.SSTORE(key=0x0, value=Op.MLOAD(offset=0)) + Op.RETURN(offset=0, size=Op.MSIZE) ), b"\x04", @@ -112,10 +91,7 @@ offset=0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFA, size=0x9, ) - + Op.PUSH1[0x0] - + Op.MLOAD - + Op.PUSH1[0x0] - + Op.SSTORE + + Op.SSTORE(key=0x0, value=Op.MLOAD(offset=0)) + Op.RETURN(offset=0, size=Op.MSIZE) ), b"\x05", @@ -123,37 +99,24 @@ Account(storage={0x00: 0x00}), ), ( - ( - Op.PUSH1[0x1] - + Op.PUSH1[0x1] - + Op.SSTORE - + Op.PUSH1[0x1] - + Op.PUSH1[0x2] - + Op.CALLDATACOPY - ), + (Op.SSTORE(key=0x1, value=0x1) + Op.PUSH1[0x1] + Op.PUSH1[0x2] + Op.CALLDATACOPY), b"\x10", Account(storage={0x01: 0x00}), None, ), ( ( - Op.PUSH1[0x5] - + Op.JUMP + Op.JUMP(pc=0x5) + Op.JUMPDEST + Op.STOP + Op.JUMPDEST + Op.MSTORE8(offset=0x1F, value=0x42) + Op.CALLDATACOPY(dest_offset=0x1F, offset=0x0, size=0x103) - + Op.PUSH1[0x0] - + Op.MLOAD + + Op.MLOAD(offset=0x0) + Op.DUP1 + Op.PUSH1[0x60] - + Op.EQ - + Op.PUSH1[0x3] - + Op.JUMPI - + Op.PUSH5[0xBADC0FFEE] - + Op.PUSH1[0xFF] - + Op.SSTORE + + Op.JUMPI(pc=0x3, condition=Op.EQ) + + Op.SSTORE(key=0xFF, value=0xBADC0FFEE) ), b"\x11", Account(storage={0xFF: 0xBADC0FFEE}), @@ -188,29 +151,13 @@ def test_calldatacopy( code_address = pre.deploy_contract(code) to = pre.deploy_contract( code=( - Op.PUSH17[0x1234567890ABCDEF01234567890ABCDEF0] - + Op.PUSH1[0x0] - + Op.MSTORE - + Op.PUSH1[0x40] - + Op.PUSH1[0x20] - + Op.PUSH1[0x10] - + Op.PUSH1[0xF] - + Op.PUSH1[0x0] - + Op.PUSH1[0x4] - + Op.CALLDATALOAD - + Op.PUSH2[0x1000] - + Op.ADD - + Op.PUSH3[0xFFFFFF] - + Op.CALL + Op.MSTORE(offset=0x0, value=0x1234567890ABCDEF01234567890ABCDEF0) + + Op.CALL( + 0xFFFFFF, Op.ADD(0x1000, Op.CALLDATALOAD(offset=0x4)), 0x0, 0xF, 0x10, 0x20, 0x40 + ) + Op.POP - + Op.PUSH1[0x20] - + Op.MLOAD - + Op.PUSH1[0x0] - + Op.SSTORE - + Op.PUSH1[0x40] - + Op.MLOAD - + Op.PUSH1[0x1] - + Op.SSTORE + + Op.SSTORE(key=0x0, value=Op.MLOAD(offset=0x20)) + + Op.SSTORE(key=0x1, value=Op.MLOAD(offset=0x40)) + Op.STOP ), nonce=0,