Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: not able to call get_type_hints on *Node types #1049

Open
ClementWalter opened this issue Dec 6, 2024 · 0 comments
Open

bug: not able to call get_type_hints on *Node types #1049

ClementWalter opened this issue Dec 6, 2024 · 0 comments
Labels
A-tool Area: tooling C-bug Category: this is a bug, deviation, or other problem. E-easy Experience: easy, good for newcomers

Comments

@ClementWalter
Copy link

See this MWE

from typing import get_type_hints
from ethereum.cancun.trie import BranchNode

get_type_hints(BranchNode)

This raises because the nodes use rlp.Extended as a type annotation instead of Extended.

Doing in rlp.py

from ..rlp import Extended

# ...

@slotted_freezable
@dataclass
class LeafNode:
    """Leaf node in the Merkle Trie"""

    rest_of_key: Bytes
    value: Extended


@slotted_freezable
@dataclass
class ExtensionNode:
    """Extension node in the Merkle Trie"""

    key_segment: Bytes
    subnode: Extended


@slotted_freezable
@dataclass
class BranchNode:
    """Branch node in the Merkle Trie"""

    subnodes: List[Extended]
    value: Extended

solves the issue.

@SamWilsn SamWilsn added A-tool Area: tooling C-bug Category: this is a bug, deviation, or other problem. E-easy Experience: easy, good for newcomers labels Dec 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-tool Area: tooling C-bug Category: this is a bug, deviation, or other problem. E-easy Experience: easy, good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants