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

Calculate the correct number for block hash in table assignment #84

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/zkevm_specs/evm/typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,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 @@ -46,7 +46,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