Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions tests/benchmark/compute/instruction/test_account_query.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
"""
Benchmark operations that require querying the account state, either on the
current executing account or on a target account.

Supported Opcodes:
- SELFBALANCE
- CODESIZE
- CODECOPY
- EXTCODESIZE
- EXTCODEHASH
- EXTCODECOPY
- BALANCE
"""

import math
Expand Down
27 changes: 17 additions & 10 deletions tests/benchmark/compute/instruction/test_arithmetic.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,20 @@
"""Benchmark arithmetic instructions."""
"""
Benchmark arithmetic instructions.

Supported Opcodes:
- ADD
- ADDMOD
- MUL
- MULMOD
- SUB
- SUBMOD
- DIV
- SDIV
- MOD
- SMOD
- EXP
- SIGNEXTEND
"""

import operator
import random
Expand All @@ -16,15 +32,6 @@

from tests.benchmark.compute.helpers import DEFAULT_BINOP_ARGS, make_dup, neg

# Arithmetic instructions:
# ADD, ADDMOD
# SUB, SUBMOD
# MUL, MULMOD
# DIV, SDIV
# MOD, SMOD
# EXP
# SIGNEXTEND


@pytest.mark.parametrize(
"opcode,opcode_args",
Expand Down
18 changes: 14 additions & 4 deletions tests/benchmark/compute/instruction/test_bitwise.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,17 @@
"""Benchmark bitwise instructions."""
"""
Benchmark bitwise instructions.

Supported Opcodes:
- AND
- OR
- XOR
- NOT
- BYTE
- SHL
- SHR
- SAR
- CLZ
"""

import random
from typing import Callable
Expand All @@ -22,9 +35,6 @@
shr,
)

# Bitwise instructions:
# AND, OR, XOR, NOT, BYTE, SHL, SHR, SAR, CLZ


@pytest.mark.parametrize(
"opcode,opcode_args",
Expand Down
19 changes: 14 additions & 5 deletions tests/benchmark/compute/instruction/test_block_context.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,17 @@
"""Benchmark block context instructions."""
"""
Benchmark block context instructions.

Supported Opcodes:
- BLOCKHASH
- COINBASE
- TIMESTAMP
- NUMBER
- PREVRANDAO
- GASLIMIT
- CHAINID
- BASEFEE
- BLOBBASEFEE
"""

import pytest
from execution_testing import (
Expand All @@ -8,10 +21,6 @@
Op,
)

# Block context instructions:
# BLOCKHASH, COINBASE, TIMESTAMP, NUMBER, PREVRANDAO, GASLIMIT, CHAINID,
# BASEFEE, BLOBBASEFEE


@pytest.mark.parametrize(
"opcode",
Expand Down
14 changes: 13 additions & 1 deletion tests/benchmark/compute/instruction/test_call_context.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,16 @@
"""Benchmark call frame context instructions."""
"""
Benchmark call frame context instructions.

Supported Opcodes:
- ADDRESS
- CALLER
- CALLVALUE
- CALLDATASIZE
- CALLDATACOPY
- CALLDATALOAD
- RETURNDATASIZE
- RETURNDATACOPY
"""

import pytest
from execution_testing import (
Expand Down
15 changes: 11 additions & 4 deletions tests/benchmark/compute/instruction/test_comparison.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
"""Benchmark comparison instructions."""
"""
Benchmark comparison instructions.

Supported Opcodes:
- LT
- SLT
- GT
- SGT
- EQ
- ISZERO
"""

import pytest
from execution_testing import (
Expand All @@ -7,9 +17,6 @@
Op,
)

# Comparison instructions:
# LT, SLT, GT, SGT, EQ, ISZERO


@pytest.mark.parametrize(
"opcode,opcode_args",
Expand Down
12 changes: 11 additions & 1 deletion tests/benchmark/compute/instruction/test_control_flow.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
"""Benchmark control flow instructions."""
"""
Benchmark control flow instructions.

Supported Opcodes:
- STOP
- JUMP
- JUMPI
- PC
- GAS
- JUMPDEST
"""

from execution_testing import (
Alloc,
Expand Down
10 changes: 6 additions & 4 deletions tests/benchmark/compute/instruction/test_keccak.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
"""Benchmark keccak instructions."""
"""
Benchmark keccak instructions.

Supported Opcodes:
- KECCAK256
"""

import math

Expand All @@ -9,9 +14,6 @@
Op,
)

# Keccak instructions:
# KECCAK256

KECCAK_RATE = 136


Expand Down
14 changes: 10 additions & 4 deletions tests/benchmark/compute/instruction/test_log.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
"""Benchmark log instructions."""
"""
Benchmark log instructions.

Supported Opcodes:
- LOG0
- LOG1
- LOG2
- LOG3
- LOG4
"""

import pytest
from execution_testing import (
Expand All @@ -8,9 +17,6 @@
Op,
)

# Log instructions:
# LOG0, LOG1, LOG2, LOG3, LOG4


@pytest.mark.parametrize(
"opcode",
Expand Down
14 changes: 10 additions & 4 deletions tests/benchmark/compute/instruction/test_memory.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
"""Benchmark memory instructions."""
"""
Benchmark memory instructions.

Supported Opcodes:
- MSTORE
- MSTORE8
- MLOAD
- MSIZE
- MCOPY
"""

import pytest
from execution_testing import (
Expand All @@ -9,9 +18,6 @@
Op,
)

# Memory instructions:
# MSTORE, MSTORE8, MLOAD, MSIZE, MCOPY


@pytest.mark.parametrize("mem_size", [0, 1, 1_000, 100_000, 1_000_000])
def test_msize(
Expand Down
13 changes: 9 additions & 4 deletions tests/benchmark/compute/instruction/test_stack.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
"""Benchmark stack instructions."""
"""
Benchmark stack instructions.

Supported Opcodes:
- POP
- PUSHx
- DUPx
- SWAPx
"""

import pytest
from execution_testing import (
Expand All @@ -10,9 +18,6 @@
Op,
)

# Stack instructions:
# POP, PUSHx, DUPx, SWAPx


@pytest.mark.parametrize(
"opcode",
Expand Down
13 changes: 9 additions & 4 deletions tests/benchmark/compute/instruction/test_storage.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
"""Benchmark storage instructions."""
"""
Benchmark storage instructions.

Supported Opcodes:
- SLOAD
- SSTORE
- TLOAD
- TSTORE
"""

import pytest
from execution_testing import (
Expand All @@ -18,9 +26,6 @@

from tests.benchmark.compute.helpers import StorageAction, TransactionResult

# Storage instructions:
# SLOAD, SSTORE, TLOAD, TSTORE


# `key_mut` indicates the key isn't fixed.
@pytest.mark.parametrize("key_mut", [True, False])
Expand Down
20 changes: 14 additions & 6 deletions tests/benchmark/compute/instruction/test_system.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,17 @@
"""Benchmark system instructions."""
"""
Benchmark system instructions.

Supported Opcodes:
- CREATE
- CREATE2
- RETURN
- REVERT
- CALL
- CALLCODE
- DELEGATECALL
- STATICCALL
- SELFDESTRUCT
"""

import math

Expand All @@ -24,11 +37,6 @@

from tests.benchmark.compute.helpers import XOR_TABLE

# System instructions:
# CREATE, CREATE2
# RETURN, REVERT
# CALL, CALLCODE, SELFDESTRUCT, DELEGATECALL, STATICCALL


@pytest.mark.parametrize(
"opcode",
Expand Down
9 changes: 8 additions & 1 deletion tests/benchmark/compute/instruction/test_tx_context.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
"""Benchmark transaction context instructions."""
"""
Benchmark transaction context instructions.

Supported Opcodes:
- ORIGIN
- GASPRICE
- BLOBHASH
"""

from typing import Any, Dict

Expand Down
Loading