nimbus-eth1/tests/test_op_memory.nim

967 lines
25 KiB
Nim
Raw Permalink Normal View History

2023-11-01 03:32:09 +00:00
# Nimbus
# Copyright (c) 2019-2024 Status Research & Development GmbH
2023-11-01 03:32:09 +00:00
# Licensed under either of
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or
# http://www.apache.org/licenses/LICENSE-2.0)
# * MIT license ([LICENSE-MIT](LICENSE-MIT) or
# http://opensource.org/licenses/MIT)
# at your option. This file may not be copied, modified, or distributed except
# according to those terms.
import
std/[macros, strutils],
unittest2,
./macro_assembler
2019-09-21 05:45:23 +00:00
proc opMemoryMain*() =
suite "Memory Opcodes":
assembler: # Push1 OP
title: "Push1"
2019-09-21 05:45:23 +00:00
code:
Push1 "0xa0"
2019-09-21 05:45:23 +00:00
stack: "0x00000000000000000000000000000000000000000000000000000000000000A0"
assembler: # Push2 OP
title: "Push2"
2019-09-21 05:45:23 +00:00
code:
Push2 "0xa0b0"
2019-09-21 05:45:23 +00:00
stack: "0x000000000000000000000000000000000000000000000000000000000000A0B0"
assembler: # Push3 OP
title: "Push3"
2019-09-21 05:45:23 +00:00
code:
Push3 "0xA0B0C0"
2019-09-21 05:45:23 +00:00
stack: "0x0000000000000000000000000000000000000000000000000000000000A0B0C0"
assembler: # Push4 OP
title: "Push4"
2019-09-21 05:45:23 +00:00
code:
Push4 "0xA0B0C0D0"
2019-09-21 05:45:23 +00:00
stack: "0x00000000000000000000000000000000000000000000000000000000A0B0C0D0"
assembler: # Push5 OP
title: "Push5"
2019-09-21 05:45:23 +00:00
code:
Push5 "0xA0B0C0D0E0"
2019-09-21 05:45:23 +00:00
stack: "0x000000000000000000000000000000000000000000000000000000A0B0C0D0E0"
assembler: # Push6 OP
title: "Push6"
2019-09-21 05:45:23 +00:00
code:
Push6 "0xA0B0C0D0E0F0"
2019-09-21 05:45:23 +00:00
stack: "0x0000000000000000000000000000000000000000000000000000A0B0C0D0E0F0"
assembler: # Push7 OP
title: "Push7"
2019-09-21 05:45:23 +00:00
code:
Push7 "0xA0B0C0D0E0F0A1"
2019-09-21 05:45:23 +00:00
stack: "0x00000000000000000000000000000000000000000000000000A0B0C0D0E0F0A1"
assembler: # Push8 OP
title: "Push8"
2019-09-21 05:45:23 +00:00
code:
Push8 "0xA0B0C0D0E0F0A1B1"
2019-09-21 05:45:23 +00:00
stack: "0x000000000000000000000000000000000000000000000000A0B0C0D0E0F0A1B1"
assembler: # Push9 OP
title: "Push9"
2019-09-21 05:45:23 +00:00
code:
Push9 "0xA0B0C0D0E0F0A1B1C1"
2019-09-21 05:45:23 +00:00
stack: "0x0000000000000000000000000000000000000000000000A0B0C0D0E0F0A1B1C1"
assembler: # Push10 OP
title: "Push10"
2019-09-21 05:45:23 +00:00
code:
Push10 "0xA0B0C0D0E0F0A1B1C1D1"
2019-09-21 05:45:23 +00:00
stack: "0x00000000000000000000000000000000000000000000A0B0C0D0E0F0A1B1C1D1"
assembler: # Push11 OP
title: "Push11"
2019-09-21 05:45:23 +00:00
code:
Push11 "0xA0B0C0D0E0F0A1B1C1D1E1"
2019-09-21 05:45:23 +00:00
stack: "0x000000000000000000000000000000000000000000A0B0C0D0E0F0A1B1C1D1E1"
assembler: # Push12 OP
title: "Push12"
2019-09-21 05:45:23 +00:00
code:
Push12 "0xA0B0C0D0E0F0A1B1C1D1E1F1"
2019-09-21 05:45:23 +00:00
stack: "0x0000000000000000000000000000000000000000A0B0C0D0E0F0A1B1C1D1E1F1"
assembler: # Push13 OP
title: "Push13"
2019-09-21 05:45:23 +00:00
code:
Push13 "0xA0B0C0D0E0F0A1B1C1D1E1F1A2"
2019-09-21 05:45:23 +00:00
stack: "0x00000000000000000000000000000000000000A0B0C0D0E0F0A1B1C1D1E1F1A2"
assembler: # Push14 OP
title: "Push14"
2019-09-21 05:45:23 +00:00
code:
Push14 "0xA0B0C0D0E0F0A1B1C1D1E1F1A2B2"
2019-09-21 05:45:23 +00:00
stack: "0x000000000000000000000000000000000000A0B0C0D0E0F0A1B1C1D1E1F1A2B2"
assembler: # Push15 OP
title: "Push15"
2019-09-21 05:45:23 +00:00
code:
Push15 "0xA0B0C0D0E0F0A1B1C1D1E1F1A2B2C2"
2019-09-21 05:45:23 +00:00
stack: "0x0000000000000000000000000000000000A0B0C0D0E0F0A1B1C1D1E1F1A2B2C2"
assembler: # Push16 OP
title: "Push16"
2019-09-21 05:45:23 +00:00
code:
Push16 "0xA0B0C0D0E0F0A1B1C1D1E1F1A2B2C2D2"
2019-09-21 05:45:23 +00:00
stack: "0x00000000000000000000000000000000A0B0C0D0E0F0A1B1C1D1E1F1A2B2C2D2"
assembler: # Push17 OP
title: "Push17"
2019-09-21 05:45:23 +00:00
code:
Push17 "0xA0B0C0D0E0F0A1B1C1D1E1F1A2B2C2D2E2"
2019-09-21 05:45:23 +00:00
stack: "0x000000000000000000000000000000A0B0C0D0E0F0A1B1C1D1E1F1A2B2C2D2E2"
assembler: # Push18 OP
title: "Push18"
2019-09-21 05:45:23 +00:00
code:
Push18 "0xA0B0C0D0E0F0A1B1C1D1E1F1A2B2C2D2E2F2"
2019-09-21 05:45:23 +00:00
stack: "0x0000000000000000000000000000A0B0C0D0E0F0A1B1C1D1E1F1A2B2C2D2E2F2"
assembler: # Push19 OP
title: "Push19"
2019-09-21 05:45:23 +00:00
code:
Push19 "0xA0B0C0D0E0F0A1B1C1D1E1F1A2B2C2D2E2F2A3"
2019-09-21 05:45:23 +00:00
stack: "0x00000000000000000000000000A0B0C0D0E0F0A1B1C1D1E1F1A2B2C2D2E2F2A3"
assembler: # Push20 OP
title: "Push20"
2019-09-21 05:45:23 +00:00
code:
Push20 "0xA0B0C0D0E0F0A1B1C1D1E1F1A2B2C2D2E2F2A3B3"
2019-09-21 05:45:23 +00:00
stack: "0x000000000000000000000000A0B0C0D0E0F0A1B1C1D1E1F1A2B2C2D2E2F2A3B3"
assembler: # Push21 OP
title: "Push21"
2019-09-21 05:45:23 +00:00
code:
Push21 "0xA0B0C0D0E0F0A1B1C1D1E1F1A2B2C2D2E2F2A3B3C3"
2019-09-21 05:45:23 +00:00
stack: "0x0000000000000000000000A0B0C0D0E0F0A1B1C1D1E1F1A2B2C2D2E2F2A3B3C3"
assembler: # Push22 OP
title: "Push22"
2019-09-21 05:45:23 +00:00
code:
Push22 "0xA0B0C0D0E0F0A1B1C1D1E1F1A2B2C2D2E2F2A3B3C3D3"
2019-09-21 05:45:23 +00:00
stack: "0x00000000000000000000A0B0C0D0E0F0A1B1C1D1E1F1A2B2C2D2E2F2A3B3C3D3"
assembler: # Push23 OP
title: "Push23"
2019-09-21 05:45:23 +00:00
code:
Push23 "0xA0B0C0D0E0F0A1B1C1D1E1F1A2B2C2D2E2F2A3B3C3D3E3"
2019-09-21 05:45:23 +00:00
stack: "0x000000000000000000A0B0C0D0E0F0A1B1C1D1E1F1A2B2C2D2E2F2A3B3C3D3E3"
assembler: # Push24 OP
title: "Push24"
2019-09-21 05:45:23 +00:00
code:
Push24 "0xA0B0C0D0E0F0A1B1C1D1E1F1A2B2C2D2E2F2A3B3C3D3E3F3"
2019-09-21 05:45:23 +00:00
stack: "0x0000000000000000A0B0C0D0E0F0A1B1C1D1E1F1A2B2C2D2E2F2A3B3C3D3E3F3"
assembler: # Push25 OP
title: "Push25"
2019-09-21 05:45:23 +00:00
code:
Push25 "0xA0B0C0D0E0F0A1B1C1D1E1F1A2B2C2D2E2F2A3B3C3D3E3F3A4"
2019-09-21 05:45:23 +00:00
stack: "0x00000000000000A0B0C0D0E0F0A1B1C1D1E1F1A2B2C2D2E2F2A3B3C3D3E3F3A4"
assembler: # Push26 OP
title: "Push26"
2019-09-21 05:45:23 +00:00
code:
Push26 "0xA0B0C0D0E0F0A1B1C1D1E1F1A2B2C2D2E2F2A3B3C3D3E3F3A4B4"
2019-09-21 05:45:23 +00:00
stack: "0x000000000000A0B0C0D0E0F0A1B1C1D1E1F1A2B2C2D2E2F2A3B3C3D3E3F3A4B4"
assembler: # Push27 OP
title: "Push27"
2019-09-21 05:45:23 +00:00
code:
Push27 "0xA0B0C0D0E0F0A1B1C1D1E1F1A2B2C2D2E2F2A3B3C3D3E3F3A4B4C4"
2019-09-21 05:45:23 +00:00
stack: "0x0000000000A0B0C0D0E0F0A1B1C1D1E1F1A2B2C2D2E2F2A3B3C3D3E3F3A4B4C4"
assembler: # Push28 OP
title: "Push28"
2019-09-21 05:45:23 +00:00
code:
Push28 "0xA0B0C0D0E0F0A1B1C1D1E1F1A2B2C2D2E2F2A3B3C3D3E3F3A4B4C4D4"
2019-09-21 05:45:23 +00:00
stack: "0x00000000A0B0C0D0E0F0A1B1C1D1E1F1A2B2C2D2E2F2A3B3C3D3E3F3A4B4C4D4"
assembler: # Push29 OP
title: "Push29"
2019-09-21 05:45:23 +00:00
code:
Push29 "0xA0B0C0D0E0F0A1B1C1D1E1F1A2B2C2D2E2F2A3B3C3D3E3F3A4B4C4D4E4"
2019-09-21 05:45:23 +00:00
stack: "0x000000A0B0C0D0E0F0A1B1C1D1E1F1A2B2C2D2E2F2A3B3C3D3E3F3A4B4C4D4E4"
assembler: # Push30 OP
title: "Push30"
2019-09-21 05:45:23 +00:00
code:
Push30 "0xA0B0C0D0E0F0A1B1C1D1E1F1A2B2C2D2E2F2A3B3C3D3E3F3A4B4C4D4E4F4"
2019-09-21 05:45:23 +00:00
stack: "0x0000A0B0C0D0E0F0A1B1C1D1E1F1A2B2C2D2E2F2A3B3C3D3E3F3A4B4C4D4E4F4"
assembler: # Push31 OP
title: "Push31"
2019-09-21 05:45:23 +00:00
code:
Push31 "0xA0B0C0D0E0F0A1B1C1D1E1F1A2B2C2D2E2F2A3B3C3D3E3F3A4B4C4D4E4F4A1"
2019-09-21 05:45:23 +00:00
stack: "0x00A0B0C0D0E0F0A1B1C1D1E1F1A2B2C2D2E2F2A3B3C3D3E3F3A4B4C4D4E4F4A1"
assembler: # Push32 OP
title: "Push32"
2019-09-21 05:45:23 +00:00
code:
Push32 "0xA0B0C0D0E0F0A1B1C1D1E1F1A2B2C2D2E2F2A3B3C3D3E3F3A4B4C4D4E4F4A1B1"
2019-09-21 05:45:23 +00:00
stack: "0xA0B0C0D0E0F0A1B1C1D1E1F1A2B2C2D2E2F2A3B3C3D3E3F3A4B4C4D4E4F4A1B1"
# macro assembler prevented this
#assembler: # PushN OP not enough data
# title: "PushN_1"
2019-09-21 05:45:23 +00:00
# code:
# Push2 "0xAA"
2019-09-21 05:45:23 +00:00
# stack: "0x000000000000000000000000000000000000000000000000000000000000AA00"
# success: false
#
#assembler: # PushN OP not enough data
# title: "PushN_2"
2019-09-21 05:45:23 +00:00
# code:
# Push32 "0xAABB"
2019-09-21 05:45:23 +00:00
# stack: "0xAABB000000000000000000000000000000000000000000000000000000000000"
# success: false
assembler: # Pop OP
title: "Pop_1"
2019-09-21 05:45:23 +00:00
code:
Push2 "0x0000"
Push1 "0x01"
Push3 "0x000002"
Pop
2019-09-21 05:45:23 +00:00
stack:
"0x0000000000000000000000000000000000000000000000000000000000000000"
"0x0000000000000000000000000000000000000000000000000000000000000001"
assembler: # Pop OP
title: "Pop_2"
2019-09-21 05:45:23 +00:00
code:
Push2 "0x0000"
Push1 "0x01"
Push3 "0x000002"
Pop
Pop
2019-09-21 05:45:23 +00:00
stack: "0x0000000000000000000000000000000000000000000000000000000000000000"
assembler:# Pop OP mal data
title: "Pop_3"
2019-09-21 05:45:23 +00:00
code:
Push2 "0x0000"
Push1 "0x01"
Push3 "0x000002"
Pop
Pop
Pop
Pop
2019-09-21 05:45:23 +00:00
success: false
macro generateDUPS(): untyped =
result = newStmtList()
for i in 1 .. 16:
let title = newStmtList(newLit("DUP_" & $i))
let pushIdent = ident("Push1")
2019-09-21 05:45:23 +00:00
var body = newStmtList()
var stack = newStmtList()
for x in 0 ..< i:
let val = newLit("0x" & toHex(x+10, 2))
body.add quote do:
`pushIdent` `val`
stack.add quote do:
`val`
2019-09-21 05:45:23 +00:00
let stackVal = newLit("0x" & toHex(10, 2))
stack.add quote do:
`stackVal`
let dupIdent = ident("DUP" & $i)
body.add quote do:
`dupIdent`
let titleCall = newCall(ident("title"), title)
let codeCall = newCall(ident("code"), body)
let stackCall = newCall(ident("stack"), stack)
result.add quote do:
assembler:
`titleCall`
`codeCall`
`stackCall`
generateDUPS()
assembler: # DUPN OP mal data
title: "DUPN_2"
code:
Dup1
2019-09-21 05:45:23 +00:00
success: false
macro generateSWAPS(): untyped =
result = newStmtList()
for i in 1 .. 16:
let title = newStmtList(newLit("SWAP_" & $i))
let pushIdent = ident("Push1")
2019-09-21 05:45:23 +00:00
var body = newStmtList()
var stack = newStmtList()
for x in countdown(i, 0):
2019-09-21 05:45:23 +00:00
let val = newLit("0x" & toHex(x+10, 2))
body.add quote do:
`pushIdent` `val`
if x == i:
let val = newLit("0x" & toHex(0+10, 2))
stack.add quote do:
`val`
elif x == 0:
let val = newLit("0x" & toHex(i+10, 2))
stack.add quote do:
`val`
else:
stack.add quote do:
`val`
let swapIdent = ident("SWAP" & $i)
body.add quote do:
`swapIdent`
let titleCall = newCall(ident("title"), title)
let codeCall = newCall(ident("code"), body)
let stackCall = newCall(ident("stack"), stack)
result.add quote do:
assembler:
`titleCall`
`codeCall`
`stackCall`
generateSWAPS()
assembler:# SWAPN OP mal data
title: "SWAPN_2"
code:
Swap1
2019-09-21 05:45:23 +00:00
success: false
assembler: # Mstore OP
title: "Mstore_1"
2019-09-21 05:45:23 +00:00
code:
Push2 "0x1234"
Push1 "0x00"
Mstore
2019-09-21 05:45:23 +00:00
memory: "0x0000000000000000000000000000000000000000000000000000000000001234"
assembler: # Mstore OP
title: "Mstore_2"
2019-09-21 05:45:23 +00:00
code:
Push2 "0x1234"
Push1 "0x00"
Mstore
Push2 "0x5566"
Push1 "0x20"
Mstore
2019-09-21 05:45:23 +00:00
memory:
"0x0000000000000000000000000000000000000000000000000000000000001234"
"0x0000000000000000000000000000000000000000000000000000000000005566"
assembler: # Mstore OP
title: "Mstore_3"
code:
Push2 "0x1234"
Push1 "0x00"
Mstore
Push2 "0x5566"
Push1 "0x20"
Mstore
Push2 "0x8888"
Push1 "0x00"
Mstore
2019-09-21 05:45:23 +00:00
memory:
"0x0000000000000000000000000000000000000000000000000000000000008888"
"0x0000000000000000000000000000000000000000000000000000000000005566"
assembler: # Mstore OP
title: "Mstore_4"
2019-09-21 05:45:23 +00:00
code:
Push2 "0x1234"
Push1 "0xA0"
Mstore
2019-09-21 05:45:23 +00:00
memory:
"0x0000000000000000000000000000000000000000000000000000000000000000"
"0x0000000000000000000000000000000000000000000000000000000000000000"
"0x0000000000000000000000000000000000000000000000000000000000000000"
"0x0000000000000000000000000000000000000000000000000000000000000000"
"0x0000000000000000000000000000000000000000000000000000000000000000"
"0x0000000000000000000000000000000000000000000000000000000000001234"
assembler: # Mstore OP
title: "Mstore_5"
2019-09-21 05:45:23 +00:00
code:
Push2 "0x1234"
Mstore
2019-09-21 05:45:23 +00:00
success: false
stack: "0x1234"
assembler: # Mload OP
title: "Mload_1"
2019-09-21 05:45:23 +00:00
code:
Push1 "0x00"
Mload
2019-09-21 05:45:23 +00:00
memory: "0x0000000000000000000000000000000000000000000000000000000000000000"
stack: "0x0000000000000000000000000000000000000000000000000000000000000000"
assembler: # Mload OP
title: "Mload_2"
2019-09-21 05:45:23 +00:00
code:
Push1 "0x22"
Mload
2019-09-21 05:45:23 +00:00
memory:
"0x0000000000000000000000000000000000000000000000000000000000000000"
"0x0000000000000000000000000000000000000000000000000000000000000000"
"0x0000000000000000000000000000000000000000000000000000000000000000"
stack: "0x0000000000000000000000000000000000000000000000000000000000000000"
assembler: # Mload OP
title: "Mload_3"
2019-09-21 05:45:23 +00:00
code:
Push1 "0x20"
Mload
2019-09-21 05:45:23 +00:00
memory:
"0x0000000000000000000000000000000000000000000000000000000000000000"
"0x0000000000000000000000000000000000000000000000000000000000000000"
stack: "0x0000000000000000000000000000000000000000000000000000000000000000"
assembler: # Mload OP
title: "Mload_4"
2019-09-21 05:45:23 +00:00
code:
Push2 "0x1234"
Push1 "0x20"
Mstore
Push1 "0x20"
Mload
2019-09-21 05:45:23 +00:00
memory:
"0x0000000000000000000000000000000000000000000000000000000000000000"
"0x0000000000000000000000000000000000000000000000000000000000001234"
stack: "0x0000000000000000000000000000000000000000000000000000000000001234"
assembler: # Mload OP
title: "Mload_5"
2019-09-21 05:45:23 +00:00
code:
Push2 "0x1234"
Push1 "0x20"
Mstore
Push1 "0x1F"
Mload
2019-09-21 05:45:23 +00:00
memory:
"0x0000000000000000000000000000000000000000000000000000000000000000"
"0x0000000000000000000000000000000000000000000000000000000000001234"
stack: "0x0000000000000000000000000000000000000000000000000000000000000012"
assembler: # Mload OP mal data
title: "Mload_6"
2019-09-21 05:45:23 +00:00
code:
Mload
2019-09-21 05:45:23 +00:00
success: false
assembler: # Mstore8 OP
title: "Mstore8_1"
2019-09-21 05:45:23 +00:00
code:
Push1 "0x11"
Push1 "0x00"
Mstore8
2019-09-21 05:45:23 +00:00
memory: "0x1100000000000000000000000000000000000000000000000000000000000000"
assembler: # Mstore8 OP
title: "Mstore8_2"
2019-09-21 05:45:23 +00:00
code:
Push1 "0x22"
Push1 "0x01"
Mstore8
2019-09-21 05:45:23 +00:00
memory: "0x0022000000000000000000000000000000000000000000000000000000000000"
assembler: # Mstore8 OP
title: "Mstore8_3"
2019-09-21 05:45:23 +00:00
code:
Push1 "0x22"
Push1 "0x21"
Mstore8
2019-09-21 05:45:23 +00:00
memory:
"0x0000000000000000000000000000000000000000000000000000000000000000"
"0x0022000000000000000000000000000000000000000000000000000000000000"
assembler: # Mstore8 OP mal
title: "Mstore8_4"
2019-09-21 05:45:23 +00:00
code:
Push1 "0x22"
Mstore8
2019-09-21 05:45:23 +00:00
success: false
stack: "0x22"
assembler: # Sstore OP
title: "Sstore_1"
2019-09-21 05:45:23 +00:00
code:
Push1 "0x22"
Push1 "0xAA"
Sstore
2019-09-21 05:45:23 +00:00
storage:
"0xAA": "0x22"
assembler: # Sstore OP
title: "Sstore_2"
2019-09-21 05:45:23 +00:00
code:
Push1 "0x22"
Push1 "0xAA"
Sstore
Push1 "0x22"
Push1 "0xBB"
Sstore
2019-09-21 05:45:23 +00:00
storage:
"0xAA": "0x22"
"0xBB": "0x22"
assembler: # Sstore OP
title: "Sstore_3"
2019-09-21 05:45:23 +00:00
code:
Push1 "0x22"
Sstore
2019-09-21 05:45:23 +00:00
success: false
stack: "0x22"
assembler: # Sstore EIP1283
title: "Sstore_NET_1"
2019-09-21 05:45:23 +00:00
code: "60006000556000600055"
fork: Constantinople
gasUsed: 412
2019-09-21 05:45:23 +00:00
assembler: # Sstore EIP1283
title: "Sstore_NET_2"
2019-09-21 05:45:23 +00:00
code: "60006000556001600055"
fork: Constantinople
gasUsed: 20212
2019-09-21 05:45:23 +00:00
assembler: # Sstore EIP1283
title: "Sstore_NET_3"
2019-09-21 05:45:23 +00:00
code: "60016000556000600055"
fork: Constantinople
gasUsed: 20212
2019-09-21 05:45:23 +00:00
assembler: # Sstore EIP1283
title: "Sstore_NET_4"
2019-09-21 05:45:23 +00:00
code: "60016000556002600055"
fork: Constantinople
gasUsed: 20212
2019-09-21 05:45:23 +00:00
assembler: # Sstore EIP1283
title: "Sstore_NET_5"
2019-09-21 05:45:23 +00:00
code: "60016000556001600055"
fork: Constantinople
gasUsed: 20212
2019-09-21 05:45:23 +00:00
# Sets Storage row on "cow" address:
# 0: 1
# private void setStorageToOne(VM vm) {
# # Sets storage value to 1 and commits
# code: "60006000556001600055"
# fork: Constantinople
2019-09-21 05:45:23 +00:00
# invoke.getRepository().commit()
# invoke.setOrigRepository(invoke.getRepository())
assembler: # Sstore EIP1283
title: "Sstore_NET_6"
2019-09-21 05:45:23 +00:00
code: "60006000556000600055"
fork: Constantinople
gasUsed: 412
2019-09-21 05:45:23 +00:00
assembler: # Sstore EIP1283
title: "Sstore_NET_7"
2019-09-21 05:45:23 +00:00
code: "60006000556001600055"
fork: Constantinople
gasUsed: 20212
2019-09-21 05:45:23 +00:00
assembler: # Sstore EIP1283
title: "Sstore_NET_8"
2019-09-21 05:45:23 +00:00
code: "60006000556002600055"
fork: Constantinople
gasUsed: 20212
2019-09-21 05:45:23 +00:00
assembler: # Sstore EIP1283
title: "Sstore_NET_9"
2019-09-21 05:45:23 +00:00
code: "60026000556000600055"
fork: Constantinople
gasUsed: 20212
2019-09-21 05:45:23 +00:00
assembler: # Sstore EIP1283
title: "Sstore_NET_10"
2019-09-21 05:45:23 +00:00
code: "60026000556003600055"
fork: Constantinople
gasUsed: 20212
2019-09-21 05:45:23 +00:00
assembler: # Sstore EIP1283
title: "Sstore_NET_11"
2019-09-21 05:45:23 +00:00
code: "60026000556001600055"
fork: Constantinople
gasUsed: 20212
2019-09-21 05:45:23 +00:00
assembler: # Sstore EIP1283
title: "Sstore_NET_12"
2019-09-21 05:45:23 +00:00
code: "60026000556002600055"
fork: Constantinople
gasUsed: 20212
2019-09-21 05:45:23 +00:00
assembler: # Sstore EIP1283
title: "Sstore_NET_13"
2019-09-21 05:45:23 +00:00
code: "60016000556000600055"
fork: Constantinople
gasUsed: 20212
2019-09-21 05:45:23 +00:00
assembler: # Sstore EIP1283
title: "Sstore_NET_14"
2019-09-21 05:45:23 +00:00
code: "60016000556002600055"
fork: Constantinople
gasUsed: 20212
2019-09-21 05:45:23 +00:00
assembler: # Sstore EIP1283
title: "Sstore_NET_15"
2019-09-21 05:45:23 +00:00
code: "60016000556001600055"
fork: Constantinople
gasUsed: 20212
2019-09-21 05:45:23 +00:00
assembler: # Sstore EIP1283
title: "Sstore_NET_16"
2019-09-21 05:45:23 +00:00
code: "600160005560006000556001600055"
fork: Constantinople
gasUsed: 40218
2019-09-21 05:45:23 +00:00
assembler: # Sstore EIP1283
title: "Sstore_NET_17"
2019-09-21 05:45:23 +00:00
code: "600060005560016000556000600055"
fork: Constantinople
gasUsed: 20418
assembler: # Sload OP
title: "Sload_1"
2019-09-21 05:45:23 +00:00
code:
Push1 "0xAA"
Sload
stack: "0x0000000000000000000000000000000000000000000000000000000000000000"
2019-09-21 05:45:23 +00:00
assembler: # Sload OP
title: "Sload_2"
2019-09-21 05:45:23 +00:00
code:
Push1 "0x22"
Push1 "0xAA"
Sstore
Push1 "0xAA"
Sload
2019-09-21 05:45:23 +00:00
stack: "0x0000000000000000000000000000000000000000000000000000000000000022"
assembler: # Sload OP
title: "Sload_3"
code:
Push1 "0x22"
Push1 "0xAA"
Sstore
Push1 "0x33"
Push1 "0xCC"
Sstore
Push1 "0xCC"
Sload
2019-09-21 05:45:23 +00:00
stack: "0x0000000000000000000000000000000000000000000000000000000000000033"
assembler: # Sload OP
title: "Sload_4"
code: Sload
2019-09-21 05:45:23 +00:00
success: false
assembler: # Pc OP
title: "Pc_1"
code: Pc
2019-09-21 05:45:23 +00:00
stack:
"0x0000000000000000000000000000000000000000000000000000000000000000"
assembler: # Pc OP
title: "Pc_2"
2019-09-21 05:45:23 +00:00
code:
Push1 "0x22"
Push1 "0xAA"
Mstore
Push1 "0xAA"
Sload
Pc
2019-09-21 05:45:23 +00:00
stack:
"0x0000000000000000000000000000000000000000000000000000000000000000"
2019-09-21 05:45:23 +00:00
"0x0000000000000000000000000000000000000000000000000000000000000008"
memory:
"0x00"
"0x00"
"0x00"
"0x00"
"0x00"
"0x00"
"0x0000000000000000002200000000000000000000000000000000000000000000"
assembler: # Jump OP mal data
title: "Jump_1"
code:
Push1 "0xAA"
Push1 "0xBB"
Push1 "0x0E"
Jump
Push1 "0xCC"
Push1 "0xDD"
Push1 "0xEE"
JumpDest
Push1 "0xFF"
2019-09-21 05:45:23 +00:00
stack:
"0xaa"
"0x00000000000000000000000000000000000000000000000000000000000000bb"
success: false
assembler: # Jump OP mal data
title: "Jump_2"
code:
Push1 "0x0C"
Push1 "0x0C"
Swap1
Jump
Push1 "0xCC"
Push1 "0xDD"
Push1 "0xEE"
Push1 "0xFF"
2019-09-21 05:45:23 +00:00
success: false
stack : "0x0C"
assembler: # JumpI OP
title: "JumpI_1"
2019-09-21 05:45:23 +00:00
code:
Push1 "0x01"
Push1 "0x05"
JumpI
JumpDest
Push1 "0xCC"
2019-09-21 05:45:23 +00:00
stack: "0x00000000000000000000000000000000000000000000000000000000000000CC"
assembler: # JumpI OP
title: "JumpI_2"
2019-09-21 05:45:23 +00:00
code:
Push4 "0x00000000"
Push1 "0x44"
JumpI
Push1 "0xCC"
Push1 "0xDD"
2019-09-21 05:45:23 +00:00
stack:
"0x00000000000000000000000000000000000000000000000000000000000000CC"
"0x00000000000000000000000000000000000000000000000000000000000000DD"
assembler: # JumpI OP mal
title: "JumpI_3"
2019-09-21 05:45:23 +00:00
code:
Push1 "0x01"
JumpI
2019-09-21 05:45:23 +00:00
success: false
stack: "0x01"
assembler: # JumpI OP mal
title: "JumpI_4"
2019-09-21 05:45:23 +00:00
code:
Push1 "0x01"
Push1 "0x22"
Swap1
Swap1
JumpI
2019-09-21 05:45:23 +00:00
success: false
assembler: # Jump OP mal data
title: "JumpDest_1"
2019-09-21 05:45:23 +00:00
code:
Push1 "0x23"
Push1 "0x08"
Jump
Push1 "0x01"
JumpDest
Push1 "0x02"
Sstore
2019-09-21 05:45:23 +00:00
storage:
"0x02": "0x00"
stack: "0x23"
success: false
# success or not?
assembler: # JumpDest OP for JumpI
title: "JumpDest_2"
code:
Push1 "0x23"
Push1 "0x01"
Push1 "0x09"
JumpI
Push1 "0x01"
JumpDest
Push1 "0x02"
Sstore
2019-09-21 05:45:23 +00:00
#success: false
storage:
"0x02": "0x23"
assembler: # Msize OP
title: "Msize_1"
2019-09-21 05:45:23 +00:00
code:
Msize
2019-09-21 05:45:23 +00:00
stack: "0x0000000000000000000000000000000000000000000000000000000000000000"
assembler: # Msize OP
title: "Msize_2"
2019-09-21 05:45:23 +00:00
code:
Push1 "0x20"
Push1 "0x30"
Mstore
Msize
2019-09-21 05:45:23 +00:00
stack:
"0x60"
memory:
"0x00"
"0x00"
"0x0000000000000000000000000000002000000000000000000000000000000000"
2023-06-26 09:58:59 +00:00
assembler:
title: "Mcopy 1"
code:
Push32 "0x0000000000000000000000000000000000000000000000000000000000000000"
Push1 "0x00"
Mstore
Push32 "0x000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f"
Push1 "0x20"
Mstore
Push1 "0x20" # len
Push1 "0x20" # src
Push1 "0x00" # dst
Mcopy
2023-06-26 09:58:59 +00:00
memory:
"0x000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f"
"0x000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f"
fork: Cancun
assembler:
title: "Mcopy 2: Overlap"
code:
Push32 "0x0101010101010101010101010101010101010101010101010101010101010101"
Push1 "0x00"
Mstore
Push1 "0x20" # len
Push1 "0x00" # src
Push1 "0x00" # dst
Mcopy
2023-06-26 09:58:59 +00:00
memory:
"0x0101010101010101010101010101010101010101010101010101010101010101"
fork: Cancun
assembler:
title: "Mcopy 3"
code:
Push1 "0x00"
Push1 "0x00"
Mstore8
Push1 "0x01"
Push1 "0x01"
Mstore8
Push1 "0x02"
Push1 "0x02"
Mstore8
Push1 "0x03"
Push1 "0x03"
Mstore8
Push1 "0x04"
Push1 "0x04"
Mstore8
Push1 "0x05"
Push1 "0x05"
Mstore8
Push1 "0x06"
Push1 "0x06"
Mstore8
Push1 "0x07"
Push1 "0x07"
Mstore8
Push1 "0x08"
Push1 "0x08"
Mstore8
Push1 "0x08" # len
Push1 "0x01" # src
Push1 "0x00" # dst
Mcopy
2023-06-26 09:58:59 +00:00
memory:
"0x0102030405060708080000000000000000000000000000000000000000000000"
fork: Cancun
assembler:
title: "Mcopy 4"
code:
Push1 "0x00"
Push1 "0x00"
Mstore8
Push1 "0x01"
Push1 "0x01"
Mstore8
Push1 "0x02"
Push1 "0x02"
Mstore8
Push1 "0x03"
Push1 "0x03"
Mstore8
Push1 "0x04"
Push1 "0x04"
Mstore8
Push1 "0x05"
Push1 "0x05"
Mstore8
Push1 "0x06"
Push1 "0x06"
Mstore8
Push1 "0x07"
Push1 "0x07"
Mstore8
Push1 "0x08"
Push1 "0x08"
Mstore8
Push1 "0x08" # len
Push1 "0x00" # src
Push1 "0x01" # dst
Mcopy
2023-06-26 09:58:59 +00:00
memory:
"0x0000010203040506070000000000000000000000000000000000000000000000"
fork: Cancun
assembler:
title: "Tstore/Tload"
code:
Push1 "0xAA"
Push1 "0xBB"
Tstore
Push1 "0xBB"
Tload
stack:
"0x00000000000000000000000000000000000000000000000000000000000000AA"
fork: Cancun
assembler:
title: "Tload stack underflow not crash"
code:
Push1 "0xAA"
Push1 "0xBB"
Tstore
Tload
success: false
fork: Cancun
assembler:
title: "Code bytes: invalidPositions out of bound crash issue #2522"
code:
Push1 "0x01" # 0: ok to jump
Push1 "0x06" # 2: jump to pc 6
JumpI # 4
"0x695b00" # 5: PUSH10 First byte is jumpDestOp but operand is too short
success: false
when isMainModule:
opMemoryMain()