@SuppressWarnings(
      "ReferenceEquality") // comparison `container != layout` is deliberate and correct
  @Override
  public String validate(final EOFLayout layout) {
    if (layout.container().size() > maxContainerSize) {
      return "container_size_above_limit of " + maxContainerSize;
    }

    Queue<EOFLayout> workList = new ArrayDeque<>(layout.getSubcontainerCount());
    workList.add(layout);

    while (!workList.isEmpty()) {
      EOFLayout container = workList.poll();
      workList.addAll(List.of(container.subContainers()));
      if (container != layout && container.containerMode().get() == null) {
        return "orphan_subcontainer #" + layout.indexOfSubcontainer(container);
      }
      if (container.containerMode().get() != RUNTIME
          && container.data().size() != container.dataLength()) {
        return "Incomplete data section "
            + (container == layout
                ? " at root"
                : " in container #" + layout.indexOfSubcontainer(container));
      }

      final String codeValidationError = validateCode(container);
      if (codeValidationError != null) {
        return codeValidationError;
      }

      final String stackValidationError = validateStack(container);
      if (stackValidationError != null) {
        return stackValidationError;
      }
    }

    return null;
  }
Validates the code and stack for the EOF Layout, with optional deep consideration of the
containers.

@param layout The parsed EOFLayout of the code
@return either null, indicating no error, or a String describing the validation error.
evm/src/main/java/org/hyperledger/besu/evm/code/CodeV1Validation.java