Skip to content

Commit edef7cc

Browse files
committed
minor bugfix
The PR#1099 was merged assuming that EEST is going to send block_hash keys as hex string sin the future. But this seems to not be the case atleast thus far.
1 parent 89cb769 commit edef7cc

File tree

1 file changed

+5
-10
lines changed
  • src/ethereum_spec_tools/evm_tools/t8n

1 file changed

+5
-10
lines changed

src/ethereum_spec_tools/evm_tools/t8n/env.py

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -294,22 +294,17 @@ def read_block_hashes(self, data: Any, t8n: "T8N") -> None:
294294
# Read the block hashes
295295
block_hashes: List[Any] = []
296296

297-
# The hex key strings provided might not have standard formatting
298-
clean_block_hashes: Dict[int, Hash32] = {}
299-
if "blockHashes" in data:
300-
for key, value in data["blockHashes"].items():
301-
int_key = int(key, 16)
302-
clean_block_hashes[int_key] = Hash32(hex_to_bytes(value))
303-
304297
# Store a maximum of 256 block hashes.
305298
max_blockhash_count = min(Uint(256), self.block_number)
306299
for number in range(
307300
self.block_number - max_blockhash_count, self.block_number
308301
):
309-
if number in clean_block_hashes.keys():
310-
block_hashes.append(clean_block_hashes[number])
302+
if "blockHashes" in data and str(number) in data["blockHashes"]:
303+
block_hashes.append(
304+
Hash32(hex_to_bytes(data["blockHashes"][str(number)]))
305+
)
311306
else:
312-
block_hashes.append(None)
307+
block_hashes.append(None)
313308

314309
self.block_hashes = block_hashes
315310

0 commit comments

Comments
 (0)