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
32 changes: 0 additions & 32 deletions .flake8

This file was deleted.

2 changes: 1 addition & 1 deletion eest_tests/execution-spec-tests
2 changes: 1 addition & 1 deletion network-upgrades/mainnet-upgrades/dao-fork.md
Original file line number Diff line number Diff line change
Expand Up @@ -199,4 +199,4 @@ Blocks with block numbers in the range [1_920_000, 1_920_009] **MUST** have `0x6

## Copyright

Copyright and related rights waived via [CC0](https://creativecommons.org/publicdomain/zero/1.0/).
Copyright and related rights waived via [CC0](https://creativecommons.org/publicdomain/zero/1.0/).
142 changes: 120 additions & 22 deletions pyproject.toml
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the build-system table need to be changed to support uv?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't believe so. UV should be able to hand off to setuptools to build the wheel without any additional configuration.

Original file line number Diff line number Diff line change
Expand Up @@ -163,19 +163,12 @@ test = [
"requests",
"requests-cache>=1.2.1,<2",
]

lint = [
"isort==5.13.2",
"codespell==2.4.1",
"mypy==1.17.0",
"black==23.12.0",
"flake8==6.1.0",
"flake8-bugbear==23.12.2",
"flake8-docstrings==1.7.0",
"flake8-spellcheck==0.28.0",
"flake8-unused-arguments==0.0.13",
"ruff==0.11.8",
"vulture==2.14.0",
]

tools = [
"platformdirs>=4.2,<5",
]
Expand All @@ -188,7 +181,6 @@ optimized = [
"ethash>=1.1.0,<2",
]


[tool.setuptools.dynamic]
version = { attr = "ethereum.__version__" }

Expand All @@ -211,14 +203,6 @@ ethereum-spec-fill = "cli.pytest_commands.fill:fill"
"ethereum_spec_tools.docc:BeforeNode" = "ethereum_spec_tools.docc:render_before_after"
"ethereum_spec_tools.docc:AfterNode" = "ethereum_spec_tools.docc:render_before_after"

[tool.isort]
profile = "black"
multi_line_output = 3
line_length = 79

[tool.black]
line-length = 79

[tool.pytest.ini_options]
markers = [
"slow: marks tests as slow (deselect with '-m \"not slow\"')",
Expand All @@ -241,7 +225,6 @@ context = [
"docc.search.context",
"docc.html.context",
]

discovery = [
"docc.search.discover",
"docc.html.discover",
Expand All @@ -250,15 +233,13 @@ discovery = [
"docc.listing.discover",
"docc.files.discover",
]

build = [
"docc.search.build",
"ethereum_spec_tools.docc.build",
"docc.files.build",
"docc.listing.build",
"docc.resources.build",
]

transform = [
"docc.python.transform",
"docc.verbatim.transform",
Expand All @@ -280,7 +261,6 @@ excluded_references = [
paths = [
"src",
]

excluded_paths = [
"src/ethereum_optimized",
"src/ethereum_spec_tools",
Expand All @@ -299,3 +279,121 @@ files = [
[tool.docc.output]
path = "docs"
extension = ".html"

[tool.vulture]
exclude = ["tests/fixtures/", "eest_tests/"]
ignore_names = ["pytest_*"]

[tool.ruff]
extend-exclude = [
".cache/",
".git/",
".pytest_cache/",
".ruff_cache/",
".tox/",
".venv/",
".vscode/",
"tests/fixtures/*",
"tests/json_infra/fixtures/*",
"eest_tests/*",
"vulture_whitelist.py",
]
line-length = 79

[tool.ruff.lint]
select = [
"E", # pycodestyle errors
"F", # Pyflakes
"B", # flake8-bugbear
"W", # pycodestyle warnings
"I", # isort
"A", # flake8-builtins
"N", # pep8-naming
"ARG", # flake8-unused-arguments
]
fixable = [
"E", # pycodestyle errors
"F", # Pyflakes
"B", # flake8-bugbear
"W", # pycodestyle warnings
"I", # isort
"D", # pydocstyle
]
ignore = [
# Common to STEEL
"D205", # Missing blank line after summary
"D203", # 1 blank line required before class docstring
"D212", # Multi-line docstring summary should start at the first line
"D415", # First line should end with a ".", "?", or "!"

# Specific to EELS
"D107", # Missing docstring in __init__
"D200", # One-line docstring should fit on one line with quotes
"D205", # 1 blank line required between summary and description
"D400", # First line should end with a period
"D401", # First line should be in imperative mood ("Do", not "Does")
"D410", # Missing blank line after last section (Args, Returns, Raises)
"D411", # Missing blank line before last section
"D412", # No blank lines between sections
"D413", # Missing blank line after last section (same as 410)
"D414", # Section should end with a period
"D416", # Section names should be in the correct order
"E203", # Whitespace before ':'
]

[tool.ruff.lint.per-file-ignores]
"tests/*" = [
"D100", # Missing docstring in public module
"D101", # Missing docstring in public class
"D103", # Missing docstring in public function
"D104", # Missing docstring in public package
"E501", # Line too long
]
"src/ethereum_spec_tools/evm_tools/loaders/fork_loader.py" = [
"N802" # Property names do not need to be lowercase
]
"src/ethereum_spec_tools/lint/*" = [
"N802" # Special linting code absolved of function naming reqs
]
"src/ethereum/crypto/*" = [
"N806", # Special crypto code absolved of variable naming reqs
"N802" # Special crypto code absolved of function naming reqs
]
"src/ethereum_spec_tools/evm_tools/t8n/evm_trace/eip3155.py" = [
"N815" # The traces must use camel case in JSON property names
]
"src/ethereum_spec_tools/evm_tools/t8n/evm_trace.py" = [
"N815" # The traces must use camel case in JSON property names
]

[tool.ruff.lint.mccabe]
# Set the maximum allowed cyclomatic complexity. C901 default is 10.
max-complexity = 7

[tool.codespell]
builtin = "clear,code,usage" # Built-in dictionaries to use
skip = [ # Don't check these files/folders
".git/*",
".tox/*",
".venv/*",
"build/*",
"dist/*",
"*.pyc",
"ethereum_execution.egg-info/*",
"*.coverage*",
"__pycache__",
".ruff_cache",
"fixtures.*",
"tests/fixtures",
"tests/json_infra/fixtures",
"eest_tests",
"src/ethereum_spec_tools/evm_tools/t8n" # Temporary while being re-written
]
count = true # Display counts of errors
check-hidden = false # Don't check hidden files (starting with .)

[tool.uv]
required-version = ">=0.7.0"

[tool.uv.sources]
"ethereum-spec-evm-resolver" = { git = "https://github.com/spencer-tb/ethereum-spec-evm-resolver", rev = "aec6a628b8d0f1c791a8378c5417a089566135ac" }
4 changes: 2 additions & 2 deletions src/ethereum/arrow_glacier/bloom.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,14 @@ def add_to_bloom(bloom: bytearray, bloom_entry: Bytes) -> None:
bloom_entry :
An entry which is to be added to bloom filter.
"""
hash = keccak256(bloom_entry)
hashed = keccak256(bloom_entry)

for idx in (0, 2, 4):
# Obtain the least significant 11 bits from the pair of bytes
# (16 bits), and set this bit in bloom bytearray.
# The obtained bit is 0-indexed in the bloom filter from the least
# significant bit to the most significant bit.
bit_to_set = Uint.from_be_bytes(hash[idx : idx + 2]) & Uint(0x07FF)
bit_to_set = Uint.from_be_bytes(hashed[idx : idx + 2]) & Uint(0x07FF)
# Below is the index of the bit in the bytearray (where 0-indexed
# byte is the most significant byte)
bit_index = 0x07FF - int(bit_to_set)
Expand Down
2 changes: 1 addition & 1 deletion src/ethereum/arrow_glacier/fork_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
Introduction
------------
Types re-used throughout the specification, which are specific to Ethereum.
Types reused throughout the specification, which are specific to Ethereum.
"""

from dataclasses import dataclass
Expand Down
4 changes: 2 additions & 2 deletions src/ethereum/arrow_glacier/trie.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,13 @@
#
# keccak256(RLP(b''))
# ==
# 56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421 # noqa: E501,SC10
# 56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421 # noqa: E501
#
# also:
#
# keccak256(RLP(()))
# ==
# 1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347 # noqa: E501,SC10
# 1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347 # noqa: E501
#
# which is the sha3Uncles hash in block header with no uncles
EMPTY_TRIE_ROOT = Root(
Expand Down
4 changes: 2 additions & 2 deletions src/ethereum/arrow_glacier/vm/gas.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,8 @@ def calculate_memory_gas_cost(size_in_bytes: Uint) -> Uint:
total_gas_cost = linear_cost + quadratic_cost
try:
return total_gas_cost
except ValueError:
raise OutOfGasError
except ValueError as e:
raise OutOfGasError from e


def calculate_gas_extend_memory(
Expand Down
6 changes: 3 additions & 3 deletions src/ethereum/arrow_glacier/vm/instructions/block.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,13 @@ def block_hash(evm: Evm) -> None:
# Default hash to 0, if the block of interest is not yet on the chain
# (including the block which has the current executing transaction),
# or if the block's age is more than 256.
hash = b"\x00"
current_block_hash = b"\x00"
else:
hash = evm.message.block_env.block_hashes[
current_block_hash = evm.message.block_env.block_hashes[
-(current_block_number - block_number)
]

push(evm.stack, U256.from_be_bytes(hash))
push(evm.stack, U256.from_be_bytes(current_block_hash))

# PROGRAM COUNTER
evm.pc += Uint(1)
Expand Down
4 changes: 2 additions & 2 deletions src/ethereum/arrow_glacier/vm/instructions/keccak.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ def keccak(evm: Evm) -> None:
# OPERATION
evm.memory += b"\x00" * extend_memory.expand_by
data = memory_read_bytes(evm.memory, memory_start_index, size)
hash = keccak256(data)
hashed = keccak256(data)

push(evm.stack, U256.from_be_bytes(hash))
push(evm.stack, U256.from_be_bytes(hashed))

# PROGRAM COUNTER
evm.pc += Uint(1)
4 changes: 2 additions & 2 deletions src/ethereum/arrow_glacier/vm/interpreter.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,8 +289,8 @@ def execute_code(message: Message) -> Evm:
while evm.running and evm.pc < ulen(evm.code):
try:
op = Ops(evm.code[evm.pc])
except ValueError:
raise InvalidOpcode(evm.code[evm.pc])
except ValueError as e:
raise InvalidOpcode(evm.code[evm.pc]) from e

evm_trace(evm, OpStart(op))
op_implementation[op](evm)
Expand Down
4 changes: 2 additions & 2 deletions src/ethereum/berlin/bloom.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,14 @@ def add_to_bloom(bloom: bytearray, bloom_entry: Bytes) -> None:
bloom_entry :
An entry which is to be added to bloom filter.
"""
hash = keccak256(bloom_entry)
hashed = keccak256(bloom_entry)

for idx in (0, 2, 4):
# Obtain the least significant 11 bits from the pair of bytes
# (16 bits), and set this bit in bloom bytearray.
# The obtained bit is 0-indexed in the bloom filter from the least
# significant bit to the most significant bit.
bit_to_set = Uint.from_be_bytes(hash[idx : idx + 2]) & Uint(0x07FF)
bit_to_set = Uint.from_be_bytes(hashed[idx : idx + 2]) & Uint(0x07FF)
# Below is the index of the bit in the bytearray (where 0-indexed
# byte is the most significant byte)
bit_index = 0x07FF - int(bit_to_set)
Expand Down
2 changes: 1 addition & 1 deletion src/ethereum/berlin/fork_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
Introduction
------------
Types re-used throughout the specification, which are specific to Ethereum.
Types reused throughout the specification, which are specific to Ethereum.
"""

from dataclasses import dataclass
Expand Down
4 changes: 2 additions & 2 deletions src/ethereum/berlin/trie.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,13 @@
#
# keccak256(RLP(b''))
# ==
# 56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421 # noqa: E501,SC10
# 56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421 # noqa: E501
#
# also:
#
# keccak256(RLP(()))
# ==
# 1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347 # noqa: E501,SC10
# 1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347 # noqa: E501
#
# which is the sha3Uncles hash in block header with no uncles
EMPTY_TRIE_ROOT = Root(
Expand Down
4 changes: 2 additions & 2 deletions src/ethereum/berlin/vm/gas.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,8 @@ def calculate_memory_gas_cost(size_in_bytes: Uint) -> Uint:
total_gas_cost = linear_cost + quadratic_cost
try:
return total_gas_cost
except ValueError:
raise OutOfGasError
except ValueError as e:
raise OutOfGasError from e


def calculate_gas_extend_memory(
Expand Down
Loading
Loading