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
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ on:
jobs:
lint:
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
steps:
- uses: actions/checkout@v5
- name: Set up Python 3.8
uses: actions/setup-python@v5
with:
python-version: 3.8
- name: Lint
if: github.event_name == 'pull_request'
env:
BASE_SHA: ${{ github.event.pull_request.base.sha }}
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
Expand All @@ -25,7 +25,7 @@ jobs:
pip install mypy
pip install -e .
black --version
black pyevmasm
black --check pyevmasm
mypy --version
mypy pyevmasm

Expand Down
15 changes: 15 additions & 0 deletions pyevmasm/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,18 @@
from .evmasm import block_to_fork, DEFAULT_FORK
from .evmasm import assemble, assemble_all, assemble_hex, assemble_one
from .evmasm import disassemble, disassemble_all, disassemble_hex, disassemble_one

__all__ = [
"instruction_tables",
"Instruction",
"block_to_fork",
"DEFAULT_FORK",
"assemble",
"assemble_all",
"assemble_hex",
"assemble_one",
"disassemble",
"disassemble_all",
"disassemble_hex",
"disassemble_one",
]
36 changes: 9 additions & 27 deletions pyevmasm/evmasm.py
Original file line number Diff line number Diff line change
Expand Up @@ -989,9 +989,7 @@ def __repr__(self):
"Message-call into this account with an alternative account's code, but persisting into this account with an alternative account's code.",
)
}
homestead_instruction_table = InstructionTable( # type: ignore
homestead_instruction_table, previous_fork=frontier_instruction_table
)
homestead_instruction_table = InstructionTable(homestead_instruction_table, previous_fork=frontier_instruction_table) # type: ignore

tangerine_whistle_instruction_table = {
0x3B: ("EXTCODESIZE", 0, 1, 1, 700, "Get size of an account's code."),
Expand Down Expand Up @@ -1025,14 +1023,10 @@ def __repr__(self):
"Halt execution and register account for later deletion.",
),
}
tangerine_whistle_instruction_table = InstructionTable( # type: ignore
tangerine_whistle_instruction_table, previous_fork=homestead_instruction_table
)
tangerine_whistle_instruction_table = InstructionTable(tangerine_whistle_instruction_table, previous_fork=homestead_instruction_table) # type: ignore

spurious_dragon_instruction_table = {} # type: ignore
spurious_dragon_instruction_table = InstructionTable( # type: ignore
spurious_dragon_instruction_table, previous_fork=tangerine_whistle_instruction_table
)
spurious_dragon_instruction_table = InstructionTable(spurious_dragon_instruction_table, previous_fork=tangerine_whistle_instruction_table) # type: ignore

byzantium_instruction_table = {
0x3D: (
Expand Down Expand Up @@ -1061,9 +1055,7 @@ def __repr__(self):
"Stop execution and revert state changes, without consuming all provided gas and providing a reason.",
),
}
byzantium_instruction_table = InstructionTable( # type: ignore
byzantium_instruction_table, previous_fork=spurious_dragon_instruction_table
)
byzantium_instruction_table = InstructionTable(byzantium_instruction_table, previous_fork=spurious_dragon_instruction_table) # type: ignore

constantinople_instruction_table = {
0x1B: ("SHL", 0, 2, 1, 3, "Shift left."),
Expand All @@ -1079,9 +1071,7 @@ def __repr__(self):
"Behaves identically to CREATE, except using keccak256( 0xff ++ address ++ salt ++ keccak256(init_code)))[12:] as the address where the contract is initialized at",
),
}
constantinople_instruction_table = InstructionTable( # type: ignore
constantinople_instruction_table, previous_fork=byzantium_instruction_table
)
constantinople_instruction_table = InstructionTable(constantinople_instruction_table, previous_fork=byzantium_instruction_table) # type: ignore

serenity_instruction_table = InstructionTable(
{}, previous_fork=constantinople_instruction_table
Expand All @@ -1094,23 +1084,17 @@ def __repr__(self):
0x47: ("SELFBALANCE", 0, 0, 1, 5, "Balance of the current address."),
0x54: ("SLOAD", 0, 1, 1, 800, "Load word from storage."),
}
istanbul_instruction_table = InstructionTable( # type: ignore
istanbul_instruction_table, previous_fork=serenity_instruction_table
)
istanbul_instruction_table = InstructionTable(istanbul_instruction_table, previous_fork=serenity_instruction_table) # type: ignore

london_instruction_table = {0x48: ("BASEFEE", 0, 0, 1, 2, "Base fee in wei")}

london_instruction_table = InstructionTable( # type: ignore
london_instruction_table, previous_fork=istanbul_instruction_table
)
london_instruction_table = InstructionTable(london_instruction_table, previous_fork=istanbul_instruction_table) # type: ignore

shanghai_instruction_table = {
0x5F: ("PUSH", 0, 0, 1, 2, "Place 0 constant byte item on stack.")
}

shanghai_instruction_table = InstructionTable( # type: ignore
shanghai_instruction_table, previous_fork=london_instruction_table
)
shanghai_instruction_table = InstructionTable(shanghai_instruction_table, previous_fork=london_instruction_table) # type: ignore

cancun_instruction_table = {
0x49: ("BLOBHASH", 0, 1, 1, 3, "Get versioned hashes"),
Expand All @@ -1127,9 +1111,7 @@ def __repr__(self):
0x5E: ("MCOPY", 0, 3, 0, 3, "Copy memory areas"),
}

cancun_instruction_table = InstructionTable( # type: ignore
cancun_instruction_table, previous_fork=shanghai_instruction_table
)
cancun_instruction_table = InstructionTable(cancun_instruction_table, previous_fork=shanghai_instruction_table) # type: ignore

accepted_forks = (
"frontier",
Expand Down
5 changes: 3 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,12 @@ test = ["nose", "coverage"]
packages = ["pyevmasm"]

[tool.black]
line-length = 160
line-length = 88
target-version = ['py38']

[tool.flake8]
max-line-length = 160
max-line-length = 88
extend-ignore = "E501"
exclude = [".tox", ".*.egg", ".git", "docs/", "examples/", "scripts/", "tests/", ".venv/"]

[tool.coverage.run]
Expand Down