2023-11-01 03:32:09 +00:00
|
|
|
# Nimbus
|
2024-02-23 09:17:24 +00:00
|
|
|
# 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.
|
|
|
|
|
2023-03-22 11:18:37 +00:00
|
|
|
import
|
|
|
|
std/[macros, strutils],
|
|
|
|
macro_assembler, unittest2
|
2019-01-30 12:29:04 +00:00
|
|
|
|
2024-02-23 09:17:24 +00:00
|
|
|
# Currently fails on `AristoDb*`
|
|
|
|
macro_assembler.coreDbType = LegacyDbMemory
|
|
|
|
|
2019-09-21 05:45:23 +00:00
|
|
|
proc opMemoryMain*() =
|
|
|
|
suite "Memory Opcodes":
|
2024-03-20 07:35:38 +00:00
|
|
|
assembler: # Push1 OP
|
|
|
|
title: "Push1"
|
2019-09-21 05:45:23 +00:00
|
|
|
code:
|
2024-03-20 07:35:38 +00:00
|
|
|
Push1 "0xa0"
|
2019-09-21 05:45:23 +00:00
|
|
|
stack: "0x00000000000000000000000000000000000000000000000000000000000000A0"
|
|
|
|
|
2024-03-20 07:35:38 +00:00
|
|
|
assembler: # Push2 OP
|
|
|
|
title: "Push2"
|
2019-09-21 05:45:23 +00:00
|
|
|
code:
|
2024-03-20 07:35:38 +00:00
|
|
|
Push2 "0xa0b0"
|
2019-09-21 05:45:23 +00:00
|
|
|
stack: "0x000000000000000000000000000000000000000000000000000000000000A0B0"
|
|
|
|
|
2024-03-20 07:35:38 +00:00
|
|
|
assembler: # Push3 OP
|
|
|
|
title: "Push3"
|
2019-09-21 05:45:23 +00:00
|
|
|
code:
|
2024-03-20 07:35:38 +00:00
|
|
|
Push3 "0xA0B0C0"
|
2019-09-21 05:45:23 +00:00
|
|
|
stack: "0x0000000000000000000000000000000000000000000000000000000000A0B0C0"
|
|
|
|
|
2024-03-20 07:35:38 +00:00
|
|
|
assembler: # Push4 OP
|
|
|
|
title: "Push4"
|
2019-09-21 05:45:23 +00:00
|
|
|
code:
|
2024-03-20 07:35:38 +00:00
|
|
|
Push4 "0xA0B0C0D0"
|
2019-09-21 05:45:23 +00:00
|
|
|
stack: "0x00000000000000000000000000000000000000000000000000000000A0B0C0D0"
|
|
|
|
|
2024-03-20 07:35:38 +00:00
|
|
|
assembler: # Push5 OP
|
|
|
|
title: "Push5"
|
2019-09-21 05:45:23 +00:00
|
|
|
code:
|
2024-03-20 07:35:38 +00:00
|
|
|
Push5 "0xA0B0C0D0E0"
|
2019-09-21 05:45:23 +00:00
|
|
|
stack: "0x000000000000000000000000000000000000000000000000000000A0B0C0D0E0"
|
|
|
|
|
2024-03-20 07:35:38 +00:00
|
|
|
assembler: # Push6 OP
|
|
|
|
title: "Push6"
|
2019-09-21 05:45:23 +00:00
|
|
|
code:
|
2024-03-20 07:35:38 +00:00
|
|
|
Push6 "0xA0B0C0D0E0F0"
|
2019-09-21 05:45:23 +00:00
|
|
|
stack: "0x0000000000000000000000000000000000000000000000000000A0B0C0D0E0F0"
|
|
|
|
|
2024-03-20 07:35:38 +00:00
|
|
|
assembler: # Push7 OP
|
|
|
|
title: "Push7"
|
2019-09-21 05:45:23 +00:00
|
|
|
code:
|
2024-03-20 07:35:38 +00:00
|
|
|
Push7 "0xA0B0C0D0E0F0A1"
|
2019-09-21 05:45:23 +00:00
|
|
|
stack: "0x00000000000000000000000000000000000000000000000000A0B0C0D0E0F0A1"
|
|
|
|
|
2024-03-20 07:35:38 +00:00
|
|
|
assembler: # Push8 OP
|
|
|
|
title: "Push8"
|
2019-09-21 05:45:23 +00:00
|
|
|
code:
|
2024-03-20 07:35:38 +00:00
|
|
|
Push8 "0xA0B0C0D0E0F0A1B1"
|
2019-09-21 05:45:23 +00:00
|
|
|
stack: "0x000000000000000000000000000000000000000000000000A0B0C0D0E0F0A1B1"
|
|
|
|
|
2024-03-20 07:35:38 +00:00
|
|
|
assembler: # Push9 OP
|
|
|
|
title: "Push9"
|
2019-09-21 05:45:23 +00:00
|
|
|
code:
|
2024-03-20 07:35:38 +00:00
|
|
|
Push9 "0xA0B0C0D0E0F0A1B1C1"
|
2019-09-21 05:45:23 +00:00
|
|
|
stack: "0x0000000000000000000000000000000000000000000000A0B0C0D0E0F0A1B1C1"
|
|
|
|
|
2024-03-20 07:35:38 +00:00
|
|
|
assembler: # Push10 OP
|
|
|
|
title: "Push10"
|
2019-09-21 05:45:23 +00:00
|
|
|
code:
|
2024-03-20 07:35:38 +00:00
|
|
|
Push10 "0xA0B0C0D0E0F0A1B1C1D1"
|
2019-09-21 05:45:23 +00:00
|
|
|
stack: "0x00000000000000000000000000000000000000000000A0B0C0D0E0F0A1B1C1D1"
|
|
|
|
|
2024-03-20 07:35:38 +00:00
|
|
|
assembler: # Push11 OP
|
|
|
|
title: "Push11"
|
2019-09-21 05:45:23 +00:00
|
|
|
code:
|
2024-03-20 07:35:38 +00:00
|
|
|
Push11 "0xA0B0C0D0E0F0A1B1C1D1E1"
|
2019-09-21 05:45:23 +00:00
|
|
|
stack: "0x000000000000000000000000000000000000000000A0B0C0D0E0F0A1B1C1D1E1"
|
|
|
|
|
2024-03-20 07:35:38 +00:00
|
|
|
assembler: # Push12 OP
|
|
|
|
title: "Push12"
|
2019-09-21 05:45:23 +00:00
|
|
|
code:
|
2024-03-20 07:35:38 +00:00
|
|
|
Push12 "0xA0B0C0D0E0F0A1B1C1D1E1F1"
|
2019-09-21 05:45:23 +00:00
|
|
|
stack: "0x0000000000000000000000000000000000000000A0B0C0D0E0F0A1B1C1D1E1F1"
|
|
|
|
|
2024-03-20 07:35:38 +00:00
|
|
|
assembler: # Push13 OP
|
|
|
|
title: "Push13"
|
2019-09-21 05:45:23 +00:00
|
|
|
code:
|
2024-03-20 07:35:38 +00:00
|
|
|
Push13 "0xA0B0C0D0E0F0A1B1C1D1E1F1A2"
|
2019-09-21 05:45:23 +00:00
|
|
|
stack: "0x00000000000000000000000000000000000000A0B0C0D0E0F0A1B1C1D1E1F1A2"
|
|
|
|
|
2024-03-20 07:35:38 +00:00
|
|
|
assembler: # Push14 OP
|
|
|
|
title: "Push14"
|
2019-09-21 05:45:23 +00:00
|
|
|
code:
|
2024-03-20 07:35:38 +00:00
|
|
|
Push14 "0xA0B0C0D0E0F0A1B1C1D1E1F1A2B2"
|
2019-09-21 05:45:23 +00:00
|
|
|
stack: "0x000000000000000000000000000000000000A0B0C0D0E0F0A1B1C1D1E1F1A2B2"
|
|
|
|
|
2024-03-20 07:35:38 +00:00
|
|
|
assembler: # Push15 OP
|
|
|
|
title: "Push15"
|
2019-09-21 05:45:23 +00:00
|
|
|
code:
|
2024-03-20 07:35:38 +00:00
|
|
|
Push15 "0xA0B0C0D0E0F0A1B1C1D1E1F1A2B2C2"
|
2019-09-21 05:45:23 +00:00
|
|
|
stack: "0x0000000000000000000000000000000000A0B0C0D0E0F0A1B1C1D1E1F1A2B2C2"
|
|
|
|
|
2024-03-20 07:35:38 +00:00
|
|
|
assembler: # Push16 OP
|
|
|
|
title: "Push16"
|
2019-09-21 05:45:23 +00:00
|
|
|
code:
|
2024-03-20 07:35:38 +00:00
|
|
|
Push16 "0xA0B0C0D0E0F0A1B1C1D1E1F1A2B2C2D2"
|
2019-09-21 05:45:23 +00:00
|
|
|
stack: "0x00000000000000000000000000000000A0B0C0D0E0F0A1B1C1D1E1F1A2B2C2D2"
|
|
|
|
|
2024-03-20 07:35:38 +00:00
|
|
|
assembler: # Push17 OP
|
|
|
|
title: "Push17"
|
2019-09-21 05:45:23 +00:00
|
|
|
code:
|
2024-03-20 07:35:38 +00:00
|
|
|
Push17 "0xA0B0C0D0E0F0A1B1C1D1E1F1A2B2C2D2E2"
|
2019-09-21 05:45:23 +00:00
|
|
|
stack: "0x000000000000000000000000000000A0B0C0D0E0F0A1B1C1D1E1F1A2B2C2D2E2"
|
|
|
|
|
2024-03-20 07:35:38 +00:00
|
|
|
assembler: # Push18 OP
|
|
|
|
title: "Push18"
|
2019-09-21 05:45:23 +00:00
|
|
|
code:
|
2024-03-20 07:35:38 +00:00
|
|
|
Push18 "0xA0B0C0D0E0F0A1B1C1D1E1F1A2B2C2D2E2F2"
|
2019-09-21 05:45:23 +00:00
|
|
|
stack: "0x0000000000000000000000000000A0B0C0D0E0F0A1B1C1D1E1F1A2B2C2D2E2F2"
|
|
|
|
|
2024-03-20 07:35:38 +00:00
|
|
|
assembler: # Push19 OP
|
|
|
|
title: "Push19"
|
2019-09-21 05:45:23 +00:00
|
|
|
code:
|
2024-03-20 07:35:38 +00:00
|
|
|
Push19 "0xA0B0C0D0E0F0A1B1C1D1E1F1A2B2C2D2E2F2A3"
|
2019-09-21 05:45:23 +00:00
|
|
|
stack: "0x00000000000000000000000000A0B0C0D0E0F0A1B1C1D1E1F1A2B2C2D2E2F2A3"
|
|
|
|
|
2024-03-20 07:35:38 +00:00
|
|
|
assembler: # Push20 OP
|
|
|
|
title: "Push20"
|
2019-09-21 05:45:23 +00:00
|
|
|
code:
|
2024-03-20 07:35:38 +00:00
|
|
|
Push20 "0xA0B0C0D0E0F0A1B1C1D1E1F1A2B2C2D2E2F2A3B3"
|
2019-09-21 05:45:23 +00:00
|
|
|
stack: "0x000000000000000000000000A0B0C0D0E0F0A1B1C1D1E1F1A2B2C2D2E2F2A3B3"
|
|
|
|
|
2024-03-20 07:35:38 +00:00
|
|
|
assembler: # Push21 OP
|
|
|
|
title: "Push21"
|
2019-09-21 05:45:23 +00:00
|
|
|
code:
|
2024-03-20 07:35:38 +00:00
|
|
|
Push21 "0xA0B0C0D0E0F0A1B1C1D1E1F1A2B2C2D2E2F2A3B3C3"
|
2019-09-21 05:45:23 +00:00
|
|
|
stack: "0x0000000000000000000000A0B0C0D0E0F0A1B1C1D1E1F1A2B2C2D2E2F2A3B3C3"
|
|
|
|
|
2024-03-20 07:35:38 +00:00
|
|
|
assembler: # Push22 OP
|
|
|
|
title: "Push22"
|
2019-09-21 05:45:23 +00:00
|
|
|
code:
|
2024-03-20 07:35:38 +00:00
|
|
|
Push22 "0xA0B0C0D0E0F0A1B1C1D1E1F1A2B2C2D2E2F2A3B3C3D3"
|
2019-09-21 05:45:23 +00:00
|
|
|
stack: "0x00000000000000000000A0B0C0D0E0F0A1B1C1D1E1F1A2B2C2D2E2F2A3B3C3D3"
|
|
|
|
|
2024-03-20 07:35:38 +00:00
|
|
|
assembler: # Push23 OP
|
|
|
|
title: "Push23"
|
2019-09-21 05:45:23 +00:00
|
|
|
code:
|
2024-03-20 07:35:38 +00:00
|
|
|
Push23 "0xA0B0C0D0E0F0A1B1C1D1E1F1A2B2C2D2E2F2A3B3C3D3E3"
|
2019-09-21 05:45:23 +00:00
|
|
|
stack: "0x000000000000000000A0B0C0D0E0F0A1B1C1D1E1F1A2B2C2D2E2F2A3B3C3D3E3"
|
|
|
|
|
2024-03-20 07:35:38 +00:00
|
|
|
assembler: # Push24 OP
|
|
|
|
title: "Push24"
|
2019-09-21 05:45:23 +00:00
|
|
|
code:
|
2024-03-20 07:35:38 +00:00
|
|
|
Push24 "0xA0B0C0D0E0F0A1B1C1D1E1F1A2B2C2D2E2F2A3B3C3D3E3F3"
|
2019-09-21 05:45:23 +00:00
|
|
|
stack: "0x0000000000000000A0B0C0D0E0F0A1B1C1D1E1F1A2B2C2D2E2F2A3B3C3D3E3F3"
|
|
|
|
|
2024-03-20 07:35:38 +00:00
|
|
|
assembler: # Push25 OP
|
|
|
|
title: "Push25"
|
2019-09-21 05:45:23 +00:00
|
|
|
code:
|
2024-03-20 07:35:38 +00:00
|
|
|
Push25 "0xA0B0C0D0E0F0A1B1C1D1E1F1A2B2C2D2E2F2A3B3C3D3E3F3A4"
|
2019-09-21 05:45:23 +00:00
|
|
|
stack: "0x00000000000000A0B0C0D0E0F0A1B1C1D1E1F1A2B2C2D2E2F2A3B3C3D3E3F3A4"
|
|
|
|
|
2024-03-20 07:35:38 +00:00
|
|
|
assembler: # Push26 OP
|
|
|
|
title: "Push26"
|
2019-09-21 05:45:23 +00:00
|
|
|
code:
|
2024-03-20 07:35:38 +00:00
|
|
|
Push26 "0xA0B0C0D0E0F0A1B1C1D1E1F1A2B2C2D2E2F2A3B3C3D3E3F3A4B4"
|
2019-09-21 05:45:23 +00:00
|
|
|
stack: "0x000000000000A0B0C0D0E0F0A1B1C1D1E1F1A2B2C2D2E2F2A3B3C3D3E3F3A4B4"
|
|
|
|
|
2024-03-20 07:35:38 +00:00
|
|
|
assembler: # Push27 OP
|
|
|
|
title: "Push27"
|
2019-09-21 05:45:23 +00:00
|
|
|
code:
|
2024-03-20 07:35:38 +00:00
|
|
|
Push27 "0xA0B0C0D0E0F0A1B1C1D1E1F1A2B2C2D2E2F2A3B3C3D3E3F3A4B4C4"
|
2019-09-21 05:45:23 +00:00
|
|
|
stack: "0x0000000000A0B0C0D0E0F0A1B1C1D1E1F1A2B2C2D2E2F2A3B3C3D3E3F3A4B4C4"
|
|
|
|
|
2024-03-20 07:35:38 +00:00
|
|
|
assembler: # Push28 OP
|
|
|
|
title: "Push28"
|
2019-09-21 05:45:23 +00:00
|
|
|
code:
|
2024-03-20 07:35:38 +00:00
|
|
|
Push28 "0xA0B0C0D0E0F0A1B1C1D1E1F1A2B2C2D2E2F2A3B3C3D3E3F3A4B4C4D4"
|
2019-09-21 05:45:23 +00:00
|
|
|
stack: "0x00000000A0B0C0D0E0F0A1B1C1D1E1F1A2B2C2D2E2F2A3B3C3D3E3F3A4B4C4D4"
|
|
|
|
|
2024-03-20 07:35:38 +00:00
|
|
|
assembler: # Push29 OP
|
|
|
|
title: "Push29"
|
2019-09-21 05:45:23 +00:00
|
|
|
code:
|
2024-03-20 07:35:38 +00:00
|
|
|
Push29 "0xA0B0C0D0E0F0A1B1C1D1E1F1A2B2C2D2E2F2A3B3C3D3E3F3A4B4C4D4E4"
|
2019-09-21 05:45:23 +00:00
|
|
|
stack: "0x000000A0B0C0D0E0F0A1B1C1D1E1F1A2B2C2D2E2F2A3B3C3D3E3F3A4B4C4D4E4"
|
|
|
|
|
2024-03-20 07:35:38 +00:00
|
|
|
assembler: # Push30 OP
|
|
|
|
title: "Push30"
|
2019-09-21 05:45:23 +00:00
|
|
|
code:
|
2024-03-20 07:35:38 +00:00
|
|
|
Push30 "0xA0B0C0D0E0F0A1B1C1D1E1F1A2B2C2D2E2F2A3B3C3D3E3F3A4B4C4D4E4F4"
|
2019-09-21 05:45:23 +00:00
|
|
|
stack: "0x0000A0B0C0D0E0F0A1B1C1D1E1F1A2B2C2D2E2F2A3B3C3D3E3F3A4B4C4D4E4F4"
|
|
|
|
|
2024-03-20 07:35:38 +00:00
|
|
|
assembler: # Push31 OP
|
|
|
|
title: "Push31"
|
2019-09-21 05:45:23 +00:00
|
|
|
code:
|
2024-03-20 07:35:38 +00:00
|
|
|
Push31 "0xA0B0C0D0E0F0A1B1C1D1E1F1A2B2C2D2E2F2A3B3C3D3E3F3A4B4C4D4E4F4A1"
|
2019-09-21 05:45:23 +00:00
|
|
|
stack: "0x00A0B0C0D0E0F0A1B1C1D1E1F1A2B2C2D2E2F2A3B3C3D3E3F3A4B4C4D4E4F4A1"
|
|
|
|
|
2024-03-20 07:35:38 +00:00
|
|
|
assembler: # Push32 OP
|
|
|
|
title: "Push32"
|
2019-09-21 05:45:23 +00:00
|
|
|
code:
|
2024-03-20 07:35:38 +00:00
|
|
|
Push32 "0xA0B0C0D0E0F0A1B1C1D1E1F1A2B2C2D2E2F2A3B3C3D3E3F3A4B4C4D4E4F4A1B1"
|
2019-09-21 05:45:23 +00:00
|
|
|
stack: "0xA0B0C0D0E0F0A1B1C1D1E1F1A2B2C2D2E2F2A3B3C3D3E3F3A4B4C4D4E4F4A1B1"
|
|
|
|
|
|
|
|
# macro assembler prevented this
|
2024-03-20 07:35:38 +00:00
|
|
|
#assembler: # PushN OP not enough data
|
|
|
|
# title: "PushN_1"
|
2019-09-21 05:45:23 +00:00
|
|
|
# code:
|
2024-03-20 07:35:38 +00:00
|
|
|
# Push2 "0xAA"
|
2019-09-21 05:45:23 +00:00
|
|
|
# stack: "0x000000000000000000000000000000000000000000000000000000000000AA00"
|
|
|
|
# success: false
|
|
|
|
#
|
2024-03-20 07:35:38 +00:00
|
|
|
#assembler: # PushN OP not enough data
|
|
|
|
# title: "PushN_2"
|
2019-09-21 05:45:23 +00:00
|
|
|
# code:
|
2024-03-20 07:35:38 +00:00
|
|
|
# Push32 "0xAABB"
|
2019-09-21 05:45:23 +00:00
|
|
|
# stack: "0xAABB000000000000000000000000000000000000000000000000000000000000"
|
|
|
|
# success: false
|
|
|
|
|
2024-03-20 07:35:38 +00:00
|
|
|
assembler: # Pop OP
|
|
|
|
title: "Pop_1"
|
2019-09-21 05:45:23 +00:00
|
|
|
code:
|
2024-03-20 07:35:38 +00:00
|
|
|
Push2 "0x0000"
|
|
|
|
Push1 "0x01"
|
|
|
|
Push3 "0x000002"
|
|
|
|
Pop
|
2019-09-21 05:45:23 +00:00
|
|
|
stack:
|
|
|
|
"0x0000000000000000000000000000000000000000000000000000000000000000"
|
|
|
|
"0x0000000000000000000000000000000000000000000000000000000000000001"
|
|
|
|
|
2024-03-20 07:35:38 +00:00
|
|
|
assembler: # Pop OP
|
|
|
|
title: "Pop_2"
|
2019-09-21 05:45:23 +00:00
|
|
|
code:
|
2024-03-20 07:35:38 +00:00
|
|
|
Push2 "0x0000"
|
|
|
|
Push1 "0x01"
|
|
|
|
Push3 "0x000002"
|
|
|
|
Pop
|
|
|
|
Pop
|
2019-09-21 05:45:23 +00:00
|
|
|
stack: "0x0000000000000000000000000000000000000000000000000000000000000000"
|
|
|
|
|
2024-03-20 07:35:38 +00:00
|
|
|
assembler:# Pop OP mal data
|
|
|
|
title: "Pop_3"
|
2019-09-21 05:45:23 +00:00
|
|
|
code:
|
2024-03-20 07:35:38 +00:00
|
|
|
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))
|
2024-03-20 07:35:38 +00:00
|
|
|
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`
|
2019-01-30 12:29:04 +00:00
|
|
|
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:
|
2024-03-20 07:35:38 +00:00
|
|
|
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))
|
2024-03-20 07:35:38 +00:00
|
|
|
let pushIdent = ident("Push1")
|
2019-09-21 05:45:23 +00:00
|
|
|
var body = newStmtList()
|
|
|
|
var stack = newStmtList()
|
|
|
|
|
|
|
|
for x in countDown(i, 0):
|
|
|
|
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:
|
2024-03-20 07:35:38 +00:00
|
|
|
Swap1
|
2019-09-21 05:45:23 +00:00
|
|
|
success: false
|
|
|
|
|
2024-03-20 07:35:38 +00:00
|
|
|
assembler: # Mstore OP
|
|
|
|
title: "Mstore_1"
|
2019-09-21 05:45:23 +00:00
|
|
|
code:
|
2024-03-20 07:35:38 +00:00
|
|
|
Push2 "0x1234"
|
|
|
|
Push1 "0x00"
|
|
|
|
Mstore
|
2019-09-21 05:45:23 +00:00
|
|
|
memory: "0x0000000000000000000000000000000000000000000000000000000000001234"
|
|
|
|
|
2024-03-20 07:35:38 +00:00
|
|
|
assembler: # Mstore OP
|
|
|
|
title: "Mstore_2"
|
2019-09-21 05:45:23 +00:00
|
|
|
code:
|
2024-03-20 07:35:38 +00:00
|
|
|
Push2 "0x1234"
|
|
|
|
Push1 "0x00"
|
|
|
|
Mstore
|
|
|
|
Push2 "0x5566"
|
|
|
|
Push1 "0x20"
|
|
|
|
Mstore
|
2019-09-21 05:45:23 +00:00
|
|
|
memory:
|
|
|
|
"0x0000000000000000000000000000000000000000000000000000000000001234"
|
|
|
|
"0x0000000000000000000000000000000000000000000000000000000000005566"
|
|
|
|
|
2024-03-20 07:35:38 +00:00
|
|
|
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"
|
|
|
|
|
2024-03-20 07:35:38 +00:00
|
|
|
assembler: # Mstore OP
|
|
|
|
title: "Mstore_4"
|
2019-09-21 05:45:23 +00:00
|
|
|
code:
|
2024-03-20 07:35:38 +00:00
|
|
|
Push2 "0x1234"
|
|
|
|
Push1 "0xA0"
|
|
|
|
Mstore
|
2019-09-21 05:45:23 +00:00
|
|
|
memory:
|
|
|
|
"0x0000000000000000000000000000000000000000000000000000000000000000"
|
|
|
|
"0x0000000000000000000000000000000000000000000000000000000000000000"
|
|
|
|
"0x0000000000000000000000000000000000000000000000000000000000000000"
|
|
|
|
"0x0000000000000000000000000000000000000000000000000000000000000000"
|
|
|
|
"0x0000000000000000000000000000000000000000000000000000000000000000"
|
|
|
|
"0x0000000000000000000000000000000000000000000000000000000000001234"
|
|
|
|
|
2024-03-20 07:35:38 +00:00
|
|
|
assembler: # Mstore OP
|
|
|
|
title: "Mstore_5"
|
2019-09-21 05:45:23 +00:00
|
|
|
code:
|
2024-03-20 07:35:38 +00:00
|
|
|
Push2 "0x1234"
|
|
|
|
Mstore
|
2019-09-21 05:45:23 +00:00
|
|
|
success: false
|
|
|
|
stack: "0x1234"
|
|
|
|
|
2024-03-20 07:35:38 +00:00
|
|
|
assembler: # Mload OP
|
|
|
|
title: "Mload_1"
|
2019-09-21 05:45:23 +00:00
|
|
|
code:
|
2024-03-20 07:35:38 +00:00
|
|
|
Push1 "0x00"
|
|
|
|
Mload
|
2019-09-21 05:45:23 +00:00
|
|
|
memory: "0x0000000000000000000000000000000000000000000000000000000000000000"
|
|
|
|
stack: "0x0000000000000000000000000000000000000000000000000000000000000000"
|
|
|
|
|
2024-03-20 07:35:38 +00:00
|
|
|
assembler: # Mload OP
|
|
|
|
title: "Mload_2"
|
2019-09-21 05:45:23 +00:00
|
|
|
code:
|
2024-03-20 07:35:38 +00:00
|
|
|
Push1 "0x22"
|
|
|
|
Mload
|
2019-09-21 05:45:23 +00:00
|
|
|
memory:
|
|
|
|
"0x0000000000000000000000000000000000000000000000000000000000000000"
|
|
|
|
"0x0000000000000000000000000000000000000000000000000000000000000000"
|
|
|
|
"0x0000000000000000000000000000000000000000000000000000000000000000"
|
|
|
|
stack: "0x0000000000000000000000000000000000000000000000000000000000000000"
|
|
|
|
|
2024-03-20 07:35:38 +00:00
|
|
|
assembler: # Mload OP
|
|
|
|
title: "Mload_3"
|
2019-09-21 05:45:23 +00:00
|
|
|
code:
|
2024-03-20 07:35:38 +00:00
|
|
|
Push1 "0x20"
|
|
|
|
Mload
|
2019-09-21 05:45:23 +00:00
|
|
|
memory:
|
|
|
|
"0x0000000000000000000000000000000000000000000000000000000000000000"
|
|
|
|
"0x0000000000000000000000000000000000000000000000000000000000000000"
|
|
|
|
stack: "0x0000000000000000000000000000000000000000000000000000000000000000"
|
|
|
|
|
2024-03-20 07:35:38 +00:00
|
|
|
assembler: # Mload OP
|
|
|
|
title: "Mload_4"
|
2019-09-21 05:45:23 +00:00
|
|
|
code:
|
2024-03-20 07:35:38 +00:00
|
|
|
Push2 "0x1234"
|
|
|
|
Push1 "0x20"
|
|
|
|
Mstore
|
|
|
|
Push1 "0x20"
|
|
|
|
Mload
|
2019-09-21 05:45:23 +00:00
|
|
|
memory:
|
|
|
|
"0x0000000000000000000000000000000000000000000000000000000000000000"
|
|
|
|
"0x0000000000000000000000000000000000000000000000000000000000001234"
|
|
|
|
stack: "0x0000000000000000000000000000000000000000000000000000000000001234"
|
|
|
|
|
2024-03-20 07:35:38 +00:00
|
|
|
assembler: # Mload OP
|
|
|
|
title: "Mload_5"
|
2019-09-21 05:45:23 +00:00
|
|
|
code:
|
2024-03-20 07:35:38 +00:00
|
|
|
Push2 "0x1234"
|
|
|
|
Push1 "0x20"
|
|
|
|
Mstore
|
|
|
|
Push1 "0x1F"
|
|
|
|
Mload
|
2019-09-21 05:45:23 +00:00
|
|
|
memory:
|
|
|
|
"0x0000000000000000000000000000000000000000000000000000000000000000"
|
|
|
|
"0x0000000000000000000000000000000000000000000000000000000000001234"
|
|
|
|
stack: "0x0000000000000000000000000000000000000000000000000000000000000012"
|
|
|
|
|
2024-03-20 07:35:38 +00:00
|
|
|
assembler: # Mload OP mal data
|
|
|
|
title: "Mload_6"
|
2019-09-21 05:45:23 +00:00
|
|
|
code:
|
2024-03-20 07:35:38 +00:00
|
|
|
Mload
|
2019-09-21 05:45:23 +00:00
|
|
|
success: false
|
|
|
|
|
2024-03-20 07:35:38 +00:00
|
|
|
assembler: # Mstore8 OP
|
|
|
|
title: "Mstore8_1"
|
2019-09-21 05:45:23 +00:00
|
|
|
code:
|
2024-03-20 07:35:38 +00:00
|
|
|
Push1 "0x11"
|
|
|
|
Push1 "0x00"
|
|
|
|
Mstore8
|
2019-09-21 05:45:23 +00:00
|
|
|
memory: "0x1100000000000000000000000000000000000000000000000000000000000000"
|
|
|
|
|
2024-03-20 07:35:38 +00:00
|
|
|
assembler: # Mstore8 OP
|
|
|
|
title: "Mstore8_2"
|
2019-09-21 05:45:23 +00:00
|
|
|
code:
|
2024-03-20 07:35:38 +00:00
|
|
|
Push1 "0x22"
|
|
|
|
Push1 "0x01"
|
|
|
|
Mstore8
|
2019-09-21 05:45:23 +00:00
|
|
|
memory: "0x0022000000000000000000000000000000000000000000000000000000000000"
|
|
|
|
|
2024-03-20 07:35:38 +00:00
|
|
|
assembler: # Mstore8 OP
|
|
|
|
title: "Mstore8_3"
|
2019-09-21 05:45:23 +00:00
|
|
|
code:
|
2024-03-20 07:35:38 +00:00
|
|
|
Push1 "0x22"
|
|
|
|
Push1 "0x21"
|
|
|
|
Mstore8
|
2019-09-21 05:45:23 +00:00
|
|
|
memory:
|
|
|
|
"0x0000000000000000000000000000000000000000000000000000000000000000"
|
|
|
|
"0x0022000000000000000000000000000000000000000000000000000000000000"
|
|
|
|
|
2024-03-20 07:35:38 +00:00
|
|
|
assembler: # Mstore8 OP mal
|
|
|
|
title: "Mstore8_4"
|
2019-09-21 05:45:23 +00:00
|
|
|
code:
|
2024-03-20 07:35:38 +00:00
|
|
|
Push1 "0x22"
|
|
|
|
Mstore8
|
2019-09-21 05:45:23 +00:00
|
|
|
success: false
|
|
|
|
stack: "0x22"
|
|
|
|
|
2024-03-20 07:35:38 +00:00
|
|
|
assembler: # Sstore OP
|
|
|
|
title: "Sstore_1"
|
2019-09-21 05:45:23 +00:00
|
|
|
code:
|
2024-03-20 07:35:38 +00:00
|
|
|
Push1 "0x22"
|
|
|
|
Push1 "0xAA"
|
|
|
|
Sstore
|
2019-09-21 05:45:23 +00:00
|
|
|
storage:
|
|
|
|
"0xAA": "0x22"
|
|
|
|
|
2024-03-20 07:35:38 +00:00
|
|
|
assembler: # Sstore OP
|
|
|
|
title: "Sstore_2"
|
2019-09-21 05:45:23 +00:00
|
|
|
code:
|
2024-03-20 07:35:38 +00:00
|
|
|
Push1 "0x22"
|
|
|
|
Push1 "0xAA"
|
|
|
|
Sstore
|
|
|
|
Push1 "0x22"
|
|
|
|
Push1 "0xBB"
|
|
|
|
Sstore
|
2019-09-21 05:45:23 +00:00
|
|
|
storage:
|
|
|
|
"0xAA": "0x22"
|
|
|
|
"0xBB": "0x22"
|
|
|
|
|
2024-03-20 07:35:38 +00:00
|
|
|
assembler: # Sstore OP
|
|
|
|
title: "Sstore_3"
|
2019-09-21 05:45:23 +00:00
|
|
|
code:
|
2024-03-20 07:35:38 +00:00
|
|
|
Push1 "0x22"
|
|
|
|
Sstore
|
2019-09-21 05:45:23 +00:00
|
|
|
success: false
|
|
|
|
stack: "0x22"
|
2023-03-22 11:18:37 +00:00
|
|
|
|
2024-03-20 07:35:38 +00:00
|
|
|
assembler: # Sstore EIP1283
|
|
|
|
title: "Sstore_NET_1"
|
2019-09-21 05:45:23 +00:00
|
|
|
code: "60006000556000600055"
|
2023-03-22 11:18:37 +00:00
|
|
|
fork: Constantinople
|
|
|
|
gasUsed: 412
|
2019-09-21 05:45:23 +00:00
|
|
|
|
2024-03-20 07:35:38 +00:00
|
|
|
assembler: # Sstore EIP1283
|
|
|
|
title: "Sstore_NET_2"
|
2019-09-21 05:45:23 +00:00
|
|
|
code: "60006000556001600055"
|
2023-03-22 11:18:37 +00:00
|
|
|
fork: Constantinople
|
|
|
|
gasUsed: 20212
|
2019-09-21 05:45:23 +00:00
|
|
|
|
2024-03-20 07:35:38 +00:00
|
|
|
assembler: # Sstore EIP1283
|
|
|
|
title: "Sstore_NET_3"
|
2019-09-21 05:45:23 +00:00
|
|
|
code: "60016000556000600055"
|
2023-03-22 11:18:37 +00:00
|
|
|
fork: Constantinople
|
|
|
|
gasUsed: 20212
|
2019-09-21 05:45:23 +00:00
|
|
|
|
2024-03-20 07:35:38 +00:00
|
|
|
assembler: # Sstore EIP1283
|
|
|
|
title: "Sstore_NET_4"
|
2019-09-21 05:45:23 +00:00
|
|
|
code: "60016000556002600055"
|
2023-03-22 11:18:37 +00:00
|
|
|
fork: Constantinople
|
|
|
|
gasUsed: 20212
|
2019-09-21 05:45:23 +00:00
|
|
|
|
2024-03-20 07:35:38 +00:00
|
|
|
assembler: # Sstore EIP1283
|
|
|
|
title: "Sstore_NET_5"
|
2019-09-21 05:45:23 +00:00
|
|
|
code: "60016000556001600055"
|
2023-03-22 11:18:37 +00:00
|
|
|
fork: Constantinople
|
|
|
|
gasUsed: 20212
|
2024-03-20 07:35:38 +00:00
|
|
|
|
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"
|
2023-03-22 11:18:37 +00:00
|
|
|
# fork: Constantinople
|
2019-09-21 05:45:23 +00:00
|
|
|
# invoke.getRepository().commit()
|
|
|
|
# invoke.setOrigRepository(invoke.getRepository())
|
|
|
|
|
2024-03-20 07:35:38 +00:00
|
|
|
assembler: # Sstore EIP1283
|
|
|
|
title: "Sstore_NET_6"
|
2019-09-21 05:45:23 +00:00
|
|
|
code: "60006000556000600055"
|
2023-03-22 11:18:37 +00:00
|
|
|
fork: Constantinople
|
2024-03-20 07:35:38 +00:00
|
|
|
gasUsed: 412
|
2019-09-21 05:45:23 +00:00
|
|
|
|
2024-03-20 07:35:38 +00:00
|
|
|
assembler: # Sstore EIP1283
|
|
|
|
title: "Sstore_NET_7"
|
2019-09-21 05:45:23 +00:00
|
|
|
code: "60006000556001600055"
|
2023-03-22 11:18:37 +00:00
|
|
|
fork: Constantinople
|
2024-03-20 07:35:38 +00:00
|
|
|
gasUsed: 20212
|
2019-09-21 05:45:23 +00:00
|
|
|
|
2024-03-20 07:35:38 +00:00
|
|
|
assembler: # Sstore EIP1283
|
|
|
|
title: "Sstore_NET_8"
|
2019-09-21 05:45:23 +00:00
|
|
|
code: "60006000556002600055"
|
2023-03-22 11:18:37 +00:00
|
|
|
fork: Constantinople
|
2024-03-20 07:35:38 +00:00
|
|
|
gasUsed: 20212
|
2019-09-21 05:45:23 +00:00
|
|
|
|
2024-03-20 07:35:38 +00:00
|
|
|
assembler: # Sstore EIP1283
|
|
|
|
title: "Sstore_NET_9"
|
2019-09-21 05:45:23 +00:00
|
|
|
code: "60026000556000600055"
|
2023-03-22 11:18:37 +00:00
|
|
|
fork: Constantinople
|
2024-03-20 07:35:38 +00:00
|
|
|
gasUsed: 20212
|
2019-09-21 05:45:23 +00:00
|
|
|
|
2024-03-20 07:35:38 +00:00
|
|
|
assembler: # Sstore EIP1283
|
|
|
|
title: "Sstore_NET_10"
|
2019-09-21 05:45:23 +00:00
|
|
|
code: "60026000556003600055"
|
2023-03-22 11:18:37 +00:00
|
|
|
fork: Constantinople
|
2024-03-20 07:35:38 +00:00
|
|
|
gasUsed: 20212
|
2019-09-21 05:45:23 +00:00
|
|
|
|
2024-03-20 07:35:38 +00:00
|
|
|
assembler: # Sstore EIP1283
|
|
|
|
title: "Sstore_NET_11"
|
2019-09-21 05:45:23 +00:00
|
|
|
code: "60026000556001600055"
|
2023-03-22 11:18:37 +00:00
|
|
|
fork: Constantinople
|
2024-03-20 07:35:38 +00:00
|
|
|
gasUsed: 20212
|
2019-09-21 05:45:23 +00:00
|
|
|
|
2024-03-20 07:35:38 +00:00
|
|
|
assembler: # Sstore EIP1283
|
|
|
|
title: "Sstore_NET_12"
|
2019-09-21 05:45:23 +00:00
|
|
|
code: "60026000556002600055"
|
2023-03-22 11:18:37 +00:00
|
|
|
fork: Constantinople
|
2024-03-20 07:35:38 +00:00
|
|
|
gasUsed: 20212
|
2019-09-21 05:45:23 +00:00
|
|
|
|
2024-03-20 07:35:38 +00:00
|
|
|
assembler: # Sstore EIP1283
|
|
|
|
title: "Sstore_NET_13"
|
2019-09-21 05:45:23 +00:00
|
|
|
code: "60016000556000600055"
|
2023-03-22 11:18:37 +00:00
|
|
|
fork: Constantinople
|
2024-03-20 07:35:38 +00:00
|
|
|
gasUsed: 20212
|
2019-09-21 05:45:23 +00:00
|
|
|
|
2024-03-20 07:35:38 +00:00
|
|
|
assembler: # Sstore EIP1283
|
|
|
|
title: "Sstore_NET_14"
|
2019-09-21 05:45:23 +00:00
|
|
|
code: "60016000556002600055"
|
2023-03-22 11:18:37 +00:00
|
|
|
fork: Constantinople
|
2024-03-20 07:35:38 +00:00
|
|
|
gasUsed: 20212
|
2019-09-21 05:45:23 +00:00
|
|
|
|
2024-03-20 07:35:38 +00:00
|
|
|
assembler: # Sstore EIP1283
|
|
|
|
title: "Sstore_NET_15"
|
2019-09-21 05:45:23 +00:00
|
|
|
code: "60016000556001600055"
|
2023-03-22 11:18:37 +00:00
|
|
|
fork: Constantinople
|
2024-03-20 07:35:38 +00:00
|
|
|
gasUsed: 20212
|
2019-09-21 05:45:23 +00:00
|
|
|
|
2024-03-20 07:35:38 +00:00
|
|
|
assembler: # Sstore EIP1283
|
|
|
|
title: "Sstore_NET_16"
|
2019-09-21 05:45:23 +00:00
|
|
|
code: "600160005560006000556001600055"
|
2023-03-22 11:18:37 +00:00
|
|
|
fork: Constantinople
|
|
|
|
gasUsed: 40218
|
2019-09-21 05:45:23 +00:00
|
|
|
|
2024-03-20 07:35:38 +00:00
|
|
|
assembler: # Sstore EIP1283
|
|
|
|
title: "Sstore_NET_17"
|
2019-09-21 05:45:23 +00:00
|
|
|
code: "600060005560016000556000600055"
|
2023-03-22 11:18:37 +00:00
|
|
|
fork: Constantinople
|
2024-03-20 07:35:38 +00:00
|
|
|
gasUsed: 20418
|
|
|
|
|
|
|
|
assembler: # Sload OP
|
|
|
|
title: "Sload_1"
|
2019-09-21 05:45:23 +00:00
|
|
|
code:
|
2024-03-20 07:35:38 +00:00
|
|
|
Push1 "0xAA"
|
|
|
|
Sload
|
2023-03-22 11:18:37 +00:00
|
|
|
stack: "0x0000000000000000000000000000000000000000000000000000000000000000"
|
2019-09-21 05:45:23 +00:00
|
|
|
|
2024-03-20 07:35:38 +00:00
|
|
|
assembler: # Sload OP
|
|
|
|
title: "Sload_2"
|
2019-09-21 05:45:23 +00:00
|
|
|
code:
|
2024-03-20 07:35:38 +00:00
|
|
|
Push1 "0x22"
|
|
|
|
Push1 "0xAA"
|
|
|
|
Sstore
|
|
|
|
Push1 "0xAA"
|
|
|
|
Sload
|
2019-09-21 05:45:23 +00:00
|
|
|
stack: "0x0000000000000000000000000000000000000000000000000000000000000022"
|
|
|
|
|
2024-03-20 07:35:38 +00:00
|
|
|
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"
|
|
|
|
|
2024-03-20 07:35:38 +00:00
|
|
|
assembler: # Sload OP
|
|
|
|
title: "Sload_4"
|
|
|
|
code: Sload
|
2019-09-21 05:45:23 +00:00
|
|
|
success: false
|
|
|
|
|
2024-03-20 07:35:38 +00:00
|
|
|
assembler: # Pc OP
|
|
|
|
title: "Pc_1"
|
|
|
|
code: Pc
|
2019-09-21 05:45:23 +00:00
|
|
|
stack:
|
|
|
|
"0x0000000000000000000000000000000000000000000000000000000000000000"
|
|
|
|
|
2024-03-20 07:35:38 +00:00
|
|
|
assembler: # Pc OP
|
|
|
|
title: "Pc_2"
|
2019-09-21 05:45:23 +00:00
|
|
|
code:
|
2024-03-20 07:35:38 +00:00
|
|
|
Push1 "0x22"
|
|
|
|
Push1 "0xAA"
|
|
|
|
Mstore
|
|
|
|
Push1 "0xAA"
|
|
|
|
Sload
|
|
|
|
Pc
|
2019-09-21 05:45:23 +00:00
|
|
|
stack:
|
2023-03-22 11:18:37 +00:00
|
|
|
"0x0000000000000000000000000000000000000000000000000000000000000000"
|
2019-09-21 05:45:23 +00:00
|
|
|
"0x0000000000000000000000000000000000000000000000000000000000000008"
|
|
|
|
memory:
|
|
|
|
"0x00"
|
|
|
|
"0x00"
|
|
|
|
"0x00"
|
|
|
|
"0x00"
|
|
|
|
"0x00"
|
|
|
|
"0x00"
|
|
|
|
"0x0000000000000000002200000000000000000000000000000000000000000000"
|
|
|
|
|
2024-03-20 07:35:38 +00:00
|
|
|
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
|
|
|
|
|
2024-03-20 07:35:38 +00:00
|
|
|
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"
|
|
|
|
|
2024-03-20 07:35:38 +00:00
|
|
|
assembler: # JumpI OP
|
|
|
|
title: "JumpI_1"
|
2019-09-21 05:45:23 +00:00
|
|
|
code:
|
2024-03-20 07:35:38 +00:00
|
|
|
Push1 "0x01"
|
|
|
|
Push1 "0x05"
|
|
|
|
JumpI
|
|
|
|
JumpDest
|
|
|
|
Push1 "0xCC"
|
2019-09-21 05:45:23 +00:00
|
|
|
stack: "0x00000000000000000000000000000000000000000000000000000000000000CC"
|
|
|
|
|
2024-03-20 07:35:38 +00:00
|
|
|
assembler: # JumpI OP
|
|
|
|
title: "JumpI_2"
|
2019-09-21 05:45:23 +00:00
|
|
|
code:
|
2024-03-20 07:35:38 +00:00
|
|
|
Push4 "0x00000000"
|
|
|
|
Push1 "0x44"
|
|
|
|
JumpI
|
|
|
|
Push1 "0xCC"
|
|
|
|
Push1 "0xDD"
|
2019-09-21 05:45:23 +00:00
|
|
|
stack:
|
|
|
|
"0x00000000000000000000000000000000000000000000000000000000000000CC"
|
|
|
|
"0x00000000000000000000000000000000000000000000000000000000000000DD"
|
|
|
|
|
2024-03-20 07:35:38 +00:00
|
|
|
assembler: # JumpI OP mal
|
|
|
|
title: "JumpI_3"
|
2019-09-21 05:45:23 +00:00
|
|
|
code:
|
2024-03-20 07:35:38 +00:00
|
|
|
Push1 "0x01"
|
|
|
|
JumpI
|
2019-09-21 05:45:23 +00:00
|
|
|
success: false
|
|
|
|
stack: "0x01"
|
|
|
|
|
2024-03-20 07:35:38 +00:00
|
|
|
assembler: # JumpI OP mal
|
|
|
|
title: "JumpI_4"
|
2019-09-21 05:45:23 +00:00
|
|
|
code:
|
2024-03-20 07:35:38 +00:00
|
|
|
Push1 "0x01"
|
|
|
|
Push1 "0x22"
|
|
|
|
Swap1
|
|
|
|
Swap1
|
|
|
|
JumpI
|
2019-09-21 05:45:23 +00:00
|
|
|
success: false
|
|
|
|
|
2024-03-20 07:35:38 +00:00
|
|
|
assembler: # Jump OP mal data
|
|
|
|
title: "JumpDest_1"
|
2019-09-21 05:45:23 +00:00
|
|
|
code:
|
2024-03-20 07:35:38 +00:00
|
|
|
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?
|
2024-03-20 07:35:38 +00:00
|
|
|
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"
|
|
|
|
|
2024-03-20 07:35:38 +00:00
|
|
|
assembler: # Msize OP
|
|
|
|
title: "Msize_1"
|
2019-09-21 05:45:23 +00:00
|
|
|
code:
|
2024-03-20 07:35:38 +00:00
|
|
|
Msize
|
2019-09-21 05:45:23 +00:00
|
|
|
stack: "0x0000000000000000000000000000000000000000000000000000000000000000"
|
|
|
|
|
2024-03-20 07:35:38 +00:00
|
|
|
assembler: # Msize OP
|
|
|
|
title: "Msize_2"
|
2019-09-21 05:45:23 +00:00
|
|
|
code:
|
2024-03-20 07:35:38 +00:00
|
|
|
Push1 "0x20"
|
|
|
|
Push1 "0x30"
|
|
|
|
Mstore
|
|
|
|
Msize
|
2019-09-21 05:45:23 +00:00
|
|
|
stack:
|
|
|
|
"0x60"
|
|
|
|
memory:
|
|
|
|
"0x00"
|
|
|
|
"0x00"
|
|
|
|
"0x0000000000000000000000000000002000000000000000000000000000000000"
|
2020-06-01 06:58:14 +00:00
|
|
|
|
2023-06-26 09:58:59 +00:00
|
|
|
assembler:
|
2024-03-20 07:35:38 +00:00
|
|
|
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:
|
2024-03-20 07:35:38 +00:00
|
|
|
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:
|
2024-03-20 07:35:38 +00:00
|
|
|
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:
|
2024-03-20 07:35:38 +00:00
|
|
|
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
|
|
|
|
|
2023-09-20 13:10:40 +00:00
|
|
|
assembler:
|
2024-03-20 07:35:38 +00:00
|
|
|
title: "Tstore/Tload"
|
2023-09-20 13:10:40 +00:00
|
|
|
code:
|
2024-03-20 07:35:38 +00:00
|
|
|
Push1 "0xAA"
|
|
|
|
Push1 "0xBB"
|
|
|
|
Tstore
|
|
|
|
Push1 "0xBB"
|
|
|
|
Tload
|
2023-09-20 13:10:40 +00:00
|
|
|
stack:
|
|
|
|
"0x00000000000000000000000000000000000000000000000000000000000000AA"
|
|
|
|
fork: Cancun
|
|
|
|
|
|
|
|
assembler:
|
2024-03-20 07:35:38 +00:00
|
|
|
title: "Tload stack underflow not crash"
|
2023-09-20 13:10:40 +00:00
|
|
|
code:
|
2024-03-20 07:35:38 +00:00
|
|
|
Push1 "0xAA"
|
|
|
|
Push1 "0xBB"
|
|
|
|
Tstore
|
|
|
|
Tload
|
2023-09-20 13:10:40 +00:00
|
|
|
success: false
|
|
|
|
fork: Cancun
|
|
|
|
|
2020-06-01 06:58:14 +00:00
|
|
|
when isMainModule:
|
|
|
|
opMemoryMain()
|