@Override
  public Hash apply(final MessageFrame frame, final Long blockNumber) {
    final Hash cachedHash = hashByNumber.get(blockNumber);
    if (cachedHash != null) {
      return cachedHash;
    }

    final WorldUpdater worldUpdater = frame.getWorldUpdater();
    Account account = worldUpdater.get(contractAddress);
    if (account == null) {
      LOG.error("cannot query system contract {}", contractAddress);
      return ZERO;
    }

    UInt256 slot = UInt256.valueOf(blockNumber % historyServeWindow);
    final UInt256 value = account.getStorageValue(slot);
    LOG.atTrace()
        .log(
            () ->
                String.format(
                    "Read block %s for account %s returned value %s",
                    account.getAddress(), slot.toDecimalString(), value.toString()));
    Hash blockHash = Hash.wrap(value);
    hashByNumber.put(blockNumber, blockHash);
    return blockHash;
  }
Constructs a Eip7709BlockHashLookup with a specified blockHashServeWindow. This constructor is
only used for testing.

@param contractAddress the address of the contract storing the history.
@param historyServeWindow the number of blocks for which history should be saved.
@param blockHashServeWindow the number of block for which contract can serve the BLOCKHASH
    opcode.
ethereum/core/src/main/java/org/hyperledger/besu/ethereum/vm/Eip7709BlockHashLookup.java