Skip to content

feat(tooling,fw): improve type checking dev experience for pydantic models, e.g. Storage #1219

Open
@danceratopz

Description

@danceratopz

This would reduce friction for test implementers unfamiliar with the EEST codebase.

Here's an example: If a Storage object is defined in test cases, mypy fails to detect that int is a valid type as a dict key or value. Currently, such Storage definitions need to be either marked as type:ingore or expliclitly cast to HashInt, e.g. Storage(cast(Storage.StorageDictType, {1,1})).

Here, for example, type checking is manually disabled inline:

storage = Storage({k: 0 for k in range(4)}) # type: ignore

Otherwise, mypy returns the following two errors:

tests/cancun/eip4788_beacon_root/spec.py:61: error: Key expression in dictionary comprehension has incompatible type "int"; expected type "HashInt"  [misc]
tests/cancun/eip4788_beacon_root/spec.py:61: error: Value expression in dictionary comprehension has incompatible type "int"; expected type "HashInt"  [misc]

Metadata

Metadata

Assignees

Labels

scope:fwScope: Framework (evm|tools|forks|pytest)scope:toolingScope: Python tools (uv, ruff, tox,...)type:feattype: Feature

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions