Skip to content
This repository has been archived by the owner on Jul 5, 2024. It is now read-only.

Commit

Permalink
fix: calculate the correct number for block hash in block table assig…
Browse files Browse the repository at this point in the history
…nment (#84)
  • Loading branch information
han0110 authored Jan 12, 2022
1 parent 2fd3a29 commit 7e05f75
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/zkevm_specs/evm/typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def __init__(
base_fee: U256 = int(1e9),
history_hashes: Sequence[U256] = [],
) -> None:
assert len(history_hashes) <= 256
assert len(history_hashes) <= min(256, block_number)

self.coinbase = coinbase
self.gas_limit = gas_limit
Expand All @@ -58,7 +58,7 @@ def table_assignments(self, rlc_store: RLCStore) -> Sequence[Array3]:
(BlockContextFieldTag.Difficulty, 0, rlc_store.to_rlc(self.difficulty, 32)),
(BlockContextFieldTag.BaseFee, 0, rlc_store.to_rlc(self.base_fee, 32)),
] + [
(BlockContextFieldTag.BlockHash, self.block_number + idx - 1, rlc_store.to_rlc(block_hash, 32))
(BlockContextFieldTag.BlockHash, self.block_number - idx - 1, rlc_store.to_rlc(block_hash, 32))
for idx, block_hash in enumerate(reversed(self.history_hashes))
]

Expand Down

0 comments on commit 7e05f75

Please sign in to comment.