@SuppressWarnings("ReferenceEquality")
  public static EOFLayout parseEOF(final Bytes container, final boolean strictSize) {
    Queue<EOFParseStep> parseQueue = new ArrayDeque<>();
    parseQueue.add(new EOFParseStep(container, strictSize, -1, null, null));
    EOFLayout result = null;
    while (true) {
      EOFParseStep step = parseQueue.remove();
      var parsedContainer = parseEOF(step, parseQueue);
      if (result == null) {
        result = parsedContainer;
      }

      if (!parsedContainer.isValid()) {
        return invalidLayout(
            container,
            result.version,
            step.index == -1
                ? parsedContainer.invalidReason
                : "Invalid subcontainer "
                    + step.subcontainerIndex()
                    + " - "
                    + parsedContainer.invalidReason);
      }
      // This ReferenceEquality check is correct
      if ((strictSize || result != parsedContainer)
          && step.container.size() != parsedContainer.container.size()) {
        return invalidLayout(
            container,
            parsedContainer.version,
            "invalid_section_bodies_size subcontainer size mismatch");
      }
      if (step.index >= 0) {
        step.parentSubcontainers[step.index] = parsedContainer;
      }
      if (parseQueue.isEmpty()) {
        return result;
      }
    }
  }
Parse EOF.

@param container the container
@param strictSize Require the container to fill all bytes, a validation error will result if
    strict and excess data is in the container
@return the eof layout
evm/src/main/java/org/hyperledger/besu/evm/code/EOFLayout.java