diff --git a/src/ethereum/arrow_glacier/trie.py b/src/ethereum/arrow_glacier/trie.py index 069b8127e2..4353ab8963 100644 --- a/src/ethereum/arrow_glacier/trie.py +++ b/src/ethereum/arrow_glacier/trie.py @@ -24,6 +24,7 @@ MutableMapping, Optional, Sequence, + Tuple, TypeVar, Union, ) @@ -97,7 +98,7 @@ class ExtensionNode: class BranchNode: """Branch node in the Merkle Trie""" - subnodes: List[rlp.Extended] + subnodes: Tuple[rlp.Extended, ...] value: rlp.Extended @@ -137,7 +138,7 @@ def encode_internal_node(node: Optional[InternalNode]) -> rlp.Extended: node.subnode, ) elif isinstance(node, BranchNode): - unencoded = node.subnodes + [node.value] + unencoded = list(node.subnodes) + [node.value] else: raise AssertionError(f"Invalid internal node type {type(node)}!") @@ -459,9 +460,9 @@ def patricialize( branches[key[level]][key] = obj[key] return BranchNode( - [ + ( encode_internal_node(patricialize(branches[k], level + Uint(1))) for k in range(16) - ], + ), value, ) diff --git a/src/ethereum/berlin/trie.py b/src/ethereum/berlin/trie.py index 5ab348f521..e42d136aef 100644 --- a/src/ethereum/berlin/trie.py +++ b/src/ethereum/berlin/trie.py @@ -24,6 +24,7 @@ MutableMapping, Optional, Sequence, + Tuple, TypeVar, Union, ) @@ -97,7 +98,7 @@ class ExtensionNode: class BranchNode: """Branch node in the Merkle Trie""" - subnodes: List[rlp.Extended] + subnodes: Tuple[rlp.Extended, ...] value: rlp.Extended @@ -137,7 +138,7 @@ def encode_internal_node(node: Optional[InternalNode]) -> rlp.Extended: node.subnode, ) elif isinstance(node, BranchNode): - unencoded = node.subnodes + [node.value] + unencoded = list(node.subnodes) + [node.value] else: raise AssertionError(f"Invalid internal node type {type(node)}!") @@ -459,9 +460,9 @@ def patricialize( branches[key[level]][key] = obj[key] return BranchNode( - [ + ( encode_internal_node(patricialize(branches[k], level + Uint(1))) for k in range(16) - ], + ), value, ) diff --git a/src/ethereum/byzantium/trie.py b/src/ethereum/byzantium/trie.py index 9d2a8f256e..10377dfddd 100644 --- a/src/ethereum/byzantium/trie.py +++ b/src/ethereum/byzantium/trie.py @@ -24,6 +24,7 @@ MutableMapping, Optional, Sequence, + Tuple, TypeVar, Union, ) @@ -97,7 +98,7 @@ class ExtensionNode: class BranchNode: """Branch node in the Merkle Trie""" - subnodes: List[rlp.Extended] + subnodes: Tuple[rlp.Extended, ...] value: rlp.Extended @@ -137,7 +138,7 @@ def encode_internal_node(node: Optional[InternalNode]) -> rlp.Extended: node.subnode, ) elif isinstance(node, BranchNode): - unencoded = node.subnodes + [node.value] + unencoded = list(node.subnodes) + [node.value] else: raise AssertionError(f"Invalid internal node type {type(node)}!") @@ -459,9 +460,9 @@ def patricialize( branches[key[level]][key] = obj[key] return BranchNode( - [ + ( encode_internal_node(patricialize(branches[k], level + Uint(1))) for k in range(16) - ], + ), value, ) diff --git a/src/ethereum/cancun/trie.py b/src/ethereum/cancun/trie.py index db0394cdb2..268050ca1a 100644 --- a/src/ethereum/cancun/trie.py +++ b/src/ethereum/cancun/trie.py @@ -24,6 +24,7 @@ MutableMapping, Optional, Sequence, + Tuple, TypeVar, Union, ) @@ -100,7 +101,7 @@ class ExtensionNode: class BranchNode: """Branch node in the Merkle Trie""" - subnodes: List[rlp.Extended] + subnodes: Tuple[rlp.Extended, ...] value: rlp.Extended @@ -140,7 +141,7 @@ def encode_internal_node(node: Optional[InternalNode]) -> rlp.Extended: node.subnode, ) elif isinstance(node, BranchNode): - unencoded = node.subnodes + [node.value] + unencoded = list(node.subnodes) + [node.value] else: raise AssertionError(f"Invalid internal node type {type(node)}!") @@ -462,9 +463,9 @@ def patricialize( branches[key[level]][key] = obj[key] return BranchNode( - [ + ( encode_internal_node(patricialize(branches[k], level + Uint(1))) for k in range(16) - ], + ), value, ) diff --git a/src/ethereum/constantinople/trie.py b/src/ethereum/constantinople/trie.py index 6d61f3aaa9..3687231873 100644 --- a/src/ethereum/constantinople/trie.py +++ b/src/ethereum/constantinople/trie.py @@ -24,6 +24,7 @@ MutableMapping, Optional, Sequence, + Tuple, TypeVar, Union, ) @@ -97,7 +98,7 @@ class ExtensionNode: class BranchNode: """Branch node in the Merkle Trie""" - subnodes: List[rlp.Extended] + subnodes: Tuple[rlp.Extended, ...] value: rlp.Extended @@ -137,7 +138,7 @@ def encode_internal_node(node: Optional[InternalNode]) -> rlp.Extended: node.subnode, ) elif isinstance(node, BranchNode): - unencoded = node.subnodes + [node.value] + unencoded = list(node.subnodes) + [node.value] else: raise AssertionError(f"Invalid internal node type {type(node)}!") @@ -459,9 +460,9 @@ def patricialize( branches[key[level]][key] = obj[key] return BranchNode( - [ + ( encode_internal_node(patricialize(branches[k], level + Uint(1))) for k in range(16) - ], + ), value, ) diff --git a/src/ethereum/dao_fork/trie.py b/src/ethereum/dao_fork/trie.py index 0b1bd95d96..40b70ad9e3 100644 --- a/src/ethereum/dao_fork/trie.py +++ b/src/ethereum/dao_fork/trie.py @@ -24,6 +24,7 @@ MutableMapping, Optional, Sequence, + Tuple, TypeVar, Union, ) @@ -97,7 +98,7 @@ class ExtensionNode: class BranchNode: """Branch node in the Merkle Trie""" - subnodes: List[rlp.Extended] + subnodes: Tuple[rlp.Extended, ...] value: rlp.Extended @@ -137,7 +138,7 @@ def encode_internal_node(node: Optional[InternalNode]) -> rlp.Extended: node.subnode, ) elif isinstance(node, BranchNode): - unencoded = node.subnodes + [node.value] + unencoded = list(node.subnodes) + [node.value] else: raise AssertionError(f"Invalid internal node type {type(node)}!") @@ -459,9 +460,9 @@ def patricialize( branches[key[level]][key] = obj[key] return BranchNode( - [ + ( encode_internal_node(patricialize(branches[k], level + Uint(1))) for k in range(16) - ], + ), value, ) diff --git a/src/ethereum/frontier/trie.py b/src/ethereum/frontier/trie.py index 587e811172..d4cd75ab4c 100644 --- a/src/ethereum/frontier/trie.py +++ b/src/ethereum/frontier/trie.py @@ -24,6 +24,7 @@ MutableMapping, Optional, Sequence, + Tuple, TypeVar, Union, ) @@ -96,7 +97,7 @@ class ExtensionNode: class BranchNode: """Branch node in the Merkle Trie""" - subnodes: List[rlp.Extended] + subnodes: Tuple[rlp.Extended, ...] value: rlp.Extended @@ -136,7 +137,7 @@ def encode_internal_node(node: Optional[InternalNode]) -> rlp.Extended: node.subnode, ) elif isinstance(node, BranchNode): - unencoded = node.subnodes + [node.value] + unencoded = list(node.subnodes) + [node.value] else: raise AssertionError(f"Invalid internal node type {type(node)}!") @@ -460,9 +461,9 @@ def patricialize( branches[key[level]][key] = obj[key] return BranchNode( - [ + ( encode_internal_node(patricialize(branches[k], level + Uint(1))) for k in range(16) - ], + ), value, ) diff --git a/src/ethereum/gray_glacier/trie.py b/src/ethereum/gray_glacier/trie.py index e6ee3e9bef..84f0beaabf 100644 --- a/src/ethereum/gray_glacier/trie.py +++ b/src/ethereum/gray_glacier/trie.py @@ -24,6 +24,7 @@ MutableMapping, Optional, Sequence, + Tuple, TypeVar, Union, ) @@ -97,7 +98,7 @@ class ExtensionNode: class BranchNode: """Branch node in the Merkle Trie""" - subnodes: List[rlp.Extended] + subnodes: Tuple[rlp.Extended, ...] value: rlp.Extended @@ -137,7 +138,7 @@ def encode_internal_node(node: Optional[InternalNode]) -> rlp.Extended: node.subnode, ) elif isinstance(node, BranchNode): - unencoded = node.subnodes + [node.value] + unencoded = list(node.subnodes) + [node.value] else: raise AssertionError(f"Invalid internal node type {type(node)}!") @@ -459,9 +460,9 @@ def patricialize( branches[key[level]][key] = obj[key] return BranchNode( - [ + ( encode_internal_node(patricialize(branches[k], level + Uint(1))) for k in range(16) - ], + ), value, ) diff --git a/src/ethereum/homestead/trie.py b/src/ethereum/homestead/trie.py index 5294a2ba0d..2bdf78b9be 100644 --- a/src/ethereum/homestead/trie.py +++ b/src/ethereum/homestead/trie.py @@ -24,6 +24,7 @@ MutableMapping, Optional, Sequence, + Tuple, TypeVar, Union, ) @@ -97,7 +98,7 @@ class ExtensionNode: class BranchNode: """Branch node in the Merkle Trie""" - subnodes: List[rlp.Extended] + subnodes: Tuple[rlp.Extended, ...] value: rlp.Extended @@ -137,7 +138,7 @@ def encode_internal_node(node: Optional[InternalNode]) -> rlp.Extended: node.subnode, ) elif isinstance(node, BranchNode): - unencoded = node.subnodes + [node.value] + unencoded = list(node.subnodes) + [node.value] else: raise AssertionError(f"Invalid internal node type {type(node)}!") @@ -459,9 +460,9 @@ def patricialize( branches[key[level]][key] = obj[key] return BranchNode( - [ + ( encode_internal_node(patricialize(branches[k], level + Uint(1))) for k in range(16) - ], + ), value, ) diff --git a/src/ethereum/istanbul/trie.py b/src/ethereum/istanbul/trie.py index a1a4cfbf98..347ffb0bd0 100644 --- a/src/ethereum/istanbul/trie.py +++ b/src/ethereum/istanbul/trie.py @@ -24,6 +24,7 @@ MutableMapping, Optional, Sequence, + Tuple, TypeVar, Union, ) @@ -97,7 +98,7 @@ class ExtensionNode: class BranchNode: """Branch node in the Merkle Trie""" - subnodes: List[rlp.Extended] + subnodes: Tuple[rlp.Extended, ...] value: rlp.Extended @@ -137,7 +138,7 @@ def encode_internal_node(node: Optional[InternalNode]) -> rlp.Extended: node.subnode, ) elif isinstance(node, BranchNode): - unencoded = node.subnodes + [node.value] + unencoded = list(node.subnodes) + [node.value] else: raise AssertionError(f"Invalid internal node type {type(node)}!") @@ -459,9 +460,9 @@ def patricialize( branches[key[level]][key] = obj[key] return BranchNode( - [ + ( encode_internal_node(patricialize(branches[k], level + Uint(1))) for k in range(16) - ], + ), value, ) diff --git a/src/ethereum/london/trie.py b/src/ethereum/london/trie.py index 03e230531c..b84ed19f71 100644 --- a/src/ethereum/london/trie.py +++ b/src/ethereum/london/trie.py @@ -24,6 +24,7 @@ MutableMapping, Optional, Sequence, + Tuple, TypeVar, Union, ) @@ -97,7 +98,7 @@ class ExtensionNode: class BranchNode: """Branch node in the Merkle Trie""" - subnodes: List[rlp.Extended] + subnodes: Tuple[rlp.Extended, ...] value: rlp.Extended @@ -137,7 +138,7 @@ def encode_internal_node(node: Optional[InternalNode]) -> rlp.Extended: node.subnode, ) elif isinstance(node, BranchNode): - unencoded = node.subnodes + [node.value] + unencoded = list(node.subnodes) + [node.value] else: raise AssertionError(f"Invalid internal node type {type(node)}!") @@ -459,9 +460,9 @@ def patricialize( branches[key[level]][key] = obj[key] return BranchNode( - [ + ( encode_internal_node(patricialize(branches[k], level + Uint(1))) for k in range(16) - ], + ), value, ) diff --git a/src/ethereum/muir_glacier/trie.py b/src/ethereum/muir_glacier/trie.py index f2e4f29460..be99b895ce 100644 --- a/src/ethereum/muir_glacier/trie.py +++ b/src/ethereum/muir_glacier/trie.py @@ -24,6 +24,7 @@ MutableMapping, Optional, Sequence, + Tuple, TypeVar, Union, ) @@ -97,7 +98,7 @@ class ExtensionNode: class BranchNode: """Branch node in the Merkle Trie""" - subnodes: List[rlp.Extended] + subnodes: Tuple[rlp.Extended, ...] value: rlp.Extended @@ -137,7 +138,7 @@ def encode_internal_node(node: Optional[InternalNode]) -> rlp.Extended: node.subnode, ) elif isinstance(node, BranchNode): - unencoded = node.subnodes + [node.value] + unencoded = list(node.subnodes) + [node.value] else: raise AssertionError(f"Invalid internal node type {type(node)}!") @@ -459,9 +460,9 @@ def patricialize( branches[key[level]][key] = obj[key] return BranchNode( - [ + ( encode_internal_node(patricialize(branches[k], level + Uint(1))) for k in range(16) - ], + ), value, ) diff --git a/src/ethereum/paris/trie.py b/src/ethereum/paris/trie.py index ccd99a17af..cd23509958 100644 --- a/src/ethereum/paris/trie.py +++ b/src/ethereum/paris/trie.py @@ -24,6 +24,7 @@ MutableMapping, Optional, Sequence, + Tuple, TypeVar, Union, ) @@ -97,7 +98,7 @@ class ExtensionNode: class BranchNode: """Branch node in the Merkle Trie""" - subnodes: List[rlp.Extended] + subnodes: Tuple[rlp.Extended, ...] value: rlp.Extended @@ -137,7 +138,7 @@ def encode_internal_node(node: Optional[InternalNode]) -> rlp.Extended: node.subnode, ) elif isinstance(node, BranchNode): - unencoded = node.subnodes + [node.value] + unencoded = list(node.subnodes) + [node.value] else: raise AssertionError(f"Invalid internal node type {type(node)}!") @@ -459,9 +460,9 @@ def patricialize( branches[key[level]][key] = obj[key] return BranchNode( - [ + ( encode_internal_node(patricialize(branches[k], level + Uint(1))) for k in range(16) - ], + ), value, ) diff --git a/src/ethereum/shanghai/trie.py b/src/ethereum/shanghai/trie.py index 020e9900c4..7ce098e547 100644 --- a/src/ethereum/shanghai/trie.py +++ b/src/ethereum/shanghai/trie.py @@ -24,6 +24,7 @@ MutableMapping, Optional, Sequence, + Tuple, TypeVar, Union, ) @@ -100,7 +101,7 @@ class ExtensionNode: class BranchNode: """Branch node in the Merkle Trie""" - subnodes: List[rlp.Extended] + subnodes: Tuple[rlp.Extended, ...] value: rlp.Extended @@ -140,7 +141,7 @@ def encode_internal_node(node: Optional[InternalNode]) -> rlp.Extended: node.subnode, ) elif isinstance(node, BranchNode): - unencoded = node.subnodes + [node.value] + unencoded = list(node.subnodes) + [node.value] else: raise AssertionError(f"Invalid internal node type {type(node)}!") @@ -462,9 +463,9 @@ def patricialize( branches[key[level]][key] = obj[key] return BranchNode( - [ + ( encode_internal_node(patricialize(branches[k], level + Uint(1))) for k in range(16) - ], + ), value, ) diff --git a/src/ethereum/spurious_dragon/trie.py b/src/ethereum/spurious_dragon/trie.py index 1b13975d22..3e7f78a498 100644 --- a/src/ethereum/spurious_dragon/trie.py +++ b/src/ethereum/spurious_dragon/trie.py @@ -24,6 +24,7 @@ MutableMapping, Optional, Sequence, + Tuple, TypeVar, Union, ) @@ -97,7 +98,7 @@ class ExtensionNode: class BranchNode: """Branch node in the Merkle Trie""" - subnodes: List[rlp.Extended] + subnodes: Tuple[rlp.Extended, ...] value: rlp.Extended @@ -137,7 +138,7 @@ def encode_internal_node(node: Optional[InternalNode]) -> rlp.Extended: node.subnode, ) elif isinstance(node, BranchNode): - unencoded = node.subnodes + [node.value] + unencoded = list(node.subnodes) + [node.value] else: raise AssertionError(f"Invalid internal node type {type(node)}!") @@ -459,9 +460,9 @@ def patricialize( branches[key[level]][key] = obj[key] return BranchNode( - [ + ( encode_internal_node(patricialize(branches[k], level + Uint(1))) for k in range(16) - ], + ), value, ) diff --git a/src/ethereum/tangerine_whistle/trie.py b/src/ethereum/tangerine_whistle/trie.py index 884faff508..f75172df62 100644 --- a/src/ethereum/tangerine_whistle/trie.py +++ b/src/ethereum/tangerine_whistle/trie.py @@ -24,6 +24,7 @@ MutableMapping, Optional, Sequence, + Tuple, TypeVar, Union, ) @@ -97,7 +98,7 @@ class ExtensionNode: class BranchNode: """Branch node in the Merkle Trie""" - subnodes: List[rlp.Extended] + subnodes: Tuple[rlp.Extended, ...] value: rlp.Extended @@ -137,7 +138,7 @@ def encode_internal_node(node: Optional[InternalNode]) -> rlp.Extended: node.subnode, ) elif isinstance(node, BranchNode): - unencoded = node.subnodes + [node.value] + unencoded = list(node.subnodes) + [node.value] else: raise AssertionError(f"Invalid internal node type {type(node)}!") @@ -459,9 +460,9 @@ def patricialize( branches[key[level]][key] = obj[key] return BranchNode( - [ + ( encode_internal_node(patricialize(branches[k], level + Uint(1))) for k in range(16) - ], + ), value, )