From ea5a295f7055e9a2001581270e85cce8bf345da7 Mon Sep 17 00:00:00 2001 From: unparalleled-js Date: Mon, 31 Oct 2022 16:29:06 -0500 Subject: [PATCH] fix: issue with memory --- .pre-commit-config.yaml | 6 +++--- evm_trace/base.py | 2 +- setup.py | 6 +++--- tests/test_trace_frame.py | 5 +++++ 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b40096a..24efb07 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -10,18 +10,18 @@ repos: - id: isort - repo: https://github.com/psf/black - rev: 22.6.0 + rev: 22.10.0 hooks: - id: black name: black - repo: https://gitlab.com/pycqa/flake8 - rev: 4.0.1 + rev: 5.0.4 hooks: - id: flake8 - repo: https://github.com/pre-commit/mirrors-mypy - rev: v0.971 + rev: v0.982 hooks: - id: mypy additional_dependencies: [types-PyYAML, types-requests] diff --git a/evm_trace/base.py b/evm_trace/base.py index 60382b0..d4e1394 100644 --- a/evm_trace/base.py +++ b/evm_trace/base.py @@ -16,7 +16,7 @@ class TraceFrame(BaseModel): gas_cost: int = Field(alias="gasCost") depth: int stack: List[HexBytes] - memory: List[HexBytes] + memory: List[HexBytes] = [] storage: Dict[HexBytes, HexBytes] = {} diff --git a/setup.py b/setup.py index 1f7638e..011757d 100644 --- a/setup.py +++ b/setup.py @@ -11,9 +11,9 @@ "eth-hash[pysha3]", # For eth-utils address checksumming ], "lint": [ - "black>=22.6.0", # auto-formatter and linter - "mypy>=0.971", # Static type analyzer - "flake8>=4.0.1", # Style linter + "black>=22.10.0", # auto-formatter and linter + "mypy>=0.982", # Static type analyzer + "flake8>=5.0.4", # Style linter "isort>=5.10.1", # Import sorting linter ], "release": [ # `release` GitHub Action job uses this diff --git a/tests/test_trace_frame.py b/tests/test_trace_frame.py index cd22699..68c6c4f 100644 --- a/tests/test_trace_frame.py +++ b/tests/test_trace_frame.py @@ -9,6 +9,11 @@ def test_trace_frame_validation_passes(trace_frame_data): assert frame +def test_trace_no_memory(): + raw_frame = {"pc": 0, "op": "PUSH1", "gas": 4732305, "gasCost": 3, "depth": 1, "stack": []} + assert TraceFrame(**raw_frame) + + @pytest.mark.parametrize( "test_data", (