public JsonRpcResponse response(final JsonRpcRequestContext requestContext) {

    final Optional<BlockParameter> startBlockParameter;
    try {
      startBlockParameter = requestContext.getOptionalParameter(0, BlockParameter.class);
    } catch (JsonRpcParameterException e) {
      throw new InvalidJsonRpcParameters(
          "Invalid start block parameter (index 0)", RpcErrorType.INVALID_BLOCK_NUMBER_PARAMS, e);
    }
    final Optional<BlockParameter> endBlockParameter;
    try {
      endBlockParameter = requestContext.getOptionalParameter(1, BlockParameter.class);
    } catch (JsonRpcParameterException e) {
      throw new InvalidJsonRpcParameters(
          "Invalid end block parameter (index 1)", RpcErrorType.INVALID_BLOCK_NUMBER_PARAMS, e);
    }

    final long fromBlockNumber = getFromBlockNumber(startBlockParameter);
    final long toBlockNumber = getEndBlockNumber(endBlockParameter);

    if (!isValidParameters(fromBlockNumber, toBlockNumber)) {
      return new JsonRpcErrorResponse(
          requestContext.getRequest().getId(), RpcErrorType.INVALID_BLOCK_NUMBER_PARAMS);
    }

    final Map<Address, SignerMetricResult> proposersMap = new HashMap<>();
    final long lastBlockIndex = toBlockNumber - 1;

    // go through each block (startBlock is inclusive and endBlock is exclusive)
    LongStream.range(fromBlockNumber, toBlockNumber)
        .forEach(
            currentIndex -> {
              final Optional<BlockHeader> blockHeaderByNumber =
                  blockchainQueries.getBlockHeaderByNumber(currentIndex);

              // Get the number of blocks from each proposer in a given block range.
              blockHeaderByNumber.ifPresent(
                  header -> {
                    final Address proposerAddress = blockInterface.getProposerOfBlock(header);
                    final SignerMetricResult signerMetric =
                        proposersMap.computeIfAbsent(proposerAddress, SignerMetricResult::new);
                    signerMetric.incrementeNbBlock();
                    // Add the block number of the last block proposed by each validator
                    signerMetric.setLastProposedBlockNumber(currentIndex);

                    // Get All validators present in the last block of the range even
                    // if they didn't propose a block
                    if (currentIndex == lastBlockIndex) {
                      validatorProvider
                          .getValidatorsAfterBlock(header)
                          .forEach(
                              address ->
                                  proposersMap.computeIfAbsent(address, SignerMetricResult::new));
                    }
                  });
            });

    return new JsonRpcSuccessResponse(
        requestContext.getRequest().getId(), new ArrayList<>(proposersMap.values()));
  }
Response.

@param requestContext the request context
@return the json rpc response
consensus/common/src/main/java/org/hyperledger/besu/consensus/common/jsonrpc/AbstractGetSignerMetricsMethod.java