diff --git a/src/zkevm_specs/evm/typing.py b/src/zkevm_specs/evm/typing.py index 1d6f3de6a..f3bce88fa 100644 --- a/src/zkevm_specs/evm/typing.py +++ b/src/zkevm_specs/evm/typing.py @@ -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 @@ -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)) ]