diff --git a/src/ethereum/prague/trie.py b/src/ethereum/prague/trie.py index 120aca5a26..18d7352d74 100644 --- a/src/ethereum/prague/trie.py +++ b/src/ethereum/prague/trie.py @@ -26,7 +26,6 @@ Sequence, TypeVar, Union, - cast, ) from ethereum.cancun import trie as previous_trie @@ -81,7 +80,7 @@ class LeafNode: """Leaf node in the Merkle Trie""" rest_of_key: Bytes - value: rlp.RLP + value: rlp.Extended @slotted_freezable @@ -90,7 +89,7 @@ class ExtensionNode: """Extension node in the Merkle Trie""" key_segment: Bytes - subnode: rlp.RLP + subnode: rlp.Extended @slotted_freezable @@ -98,14 +97,14 @@ class ExtensionNode: class BranchNode: """Branch node in the Merkle Trie""" - subnodes: List[rlp.RLP] - value: rlp.RLP + subnodes: List[rlp.Extended] + value: rlp.Extended InternalNode = Union[LeafNode, ExtensionNode, BranchNode] -def encode_internal_node(node: Optional[InternalNode]) -> rlp.RLP: +def encode_internal_node(node: Optional[InternalNode]) -> rlp.Extended: """ Encodes a Merkle Trie node into its RLP form. The RLP will then be serialized into a `Bytes` and hashed unless it is less that 32 bytes @@ -121,10 +120,10 @@ def encode_internal_node(node: Optional[InternalNode]) -> rlp.RLP: Returns ------- - encoded : `rlp.RLP` + encoded : `rlp.Extended` The node encoded as RLP. """ - unencoded: rlp.RLP + unencoded: rlp.Extended if node is None: unencoded = b"" elif isinstance(node, LeafNode): @@ -159,7 +158,7 @@ def encode_node(node: Node, storage_root: Optional[Bytes] = None) -> Bytes: assert storage_root is not None return encode_account(node, storage_root) elif isinstance(node, (LegacyTransaction, Receipt, Withdrawal, U256)): - return rlp.encode(cast(rlp.RLP, node)) + return rlp.encode(node) elif isinstance(node, Bytes): return node else: