Skip to content

Commit e46144d

Browse files
committed
Port #968 to prague
1 parent 90ce8d4 commit e46144d

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

src/ethereum/prague/trie.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
Sequence,
2727
TypeVar,
2828
Union,
29-
cast,
3029
)
3130

3231
from ethereum.cancun import trie as previous_trie
@@ -81,7 +80,7 @@ class LeafNode:
8180
"""Leaf node in the Merkle Trie"""
8281

8382
rest_of_key: Bytes
84-
value: rlp.RLP
83+
value: rlp.Extended
8584

8685

8786
@slotted_freezable
@@ -90,22 +89,22 @@ class ExtensionNode:
9089
"""Extension node in the Merkle Trie"""
9190

9291
key_segment: Bytes
93-
subnode: rlp.RLP
92+
subnode: rlp.Extended
9493

9594

9695
@slotted_freezable
9796
@dataclass
9897
class BranchNode:
9998
"""Branch node in the Merkle Trie"""
10099

101-
subnodes: List[rlp.RLP]
102-
value: rlp.RLP
100+
subnodes: List[rlp.Extended]
101+
value: rlp.Extended
103102

104103

105104
InternalNode = Union[LeafNode, ExtensionNode, BranchNode]
106105

107106

108-
def encode_internal_node(node: Optional[InternalNode]) -> rlp.RLP:
107+
def encode_internal_node(node: Optional[InternalNode]) -> rlp.Extended:
109108
"""
110109
Encodes a Merkle Trie node into its RLP form. The RLP will then be
111110
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:
121120
122121
Returns
123122
-------
124-
encoded : `rlp.RLP`
123+
encoded : `rlp.Extended`
125124
The node encoded as RLP.
126125
"""
127-
unencoded: rlp.RLP
126+
unencoded: rlp.Extended
128127
if node is None:
129128
unencoded = b""
130129
elif isinstance(node, LeafNode):
@@ -159,7 +158,7 @@ def encode_node(node: Node, storage_root: Optional[Bytes] = None) -> Bytes:
159158
assert storage_root is not None
160159
return encode_account(node, storage_root)
161160
elif isinstance(node, (LegacyTransaction, Receipt, Withdrawal, U256)):
162-
return rlp.encode(cast(rlp.RLP, node))
161+
return rlp.encode(node)
163162
elif isinstance(node, Bytes):
164163
return node
165164
else:

0 commit comments

Comments
 (0)