ui/shared/src/main/java/com/squareup/subzero/shared/SubzeroUtils.java
private static void validateSignTxCommandRequest(CommandRequest.SignTxRequest request)
      throws VerificationException {
    validateTxInputs(request.getInputsList());
    if (request.getOutputsCount() > Constants.OUTPUTS_COUNT_MAX) {
      throw new VerificationException(ERROR_OUTPUTS_COUNT);
    }

    // Validate that outputs are either CHANGE or GATEWAY. For outputs, the isChange attribute
    // of the path is redundant, so perform a consistency check.
    for (TxOutput output : request.getOutputsList()) {
      switch (output.getDestination()) {
        case CHANGE:
          if (!output.getPathOrThrow().getIsChangeOrThrow()) {
            throw new VerificationException(ERROR_INCONSISTENT_IS_CHANGE);
          }
          break;
        case GATEWAY:
          if (output.getPathOrThrow().getIsChangeOrThrow()) {
            throw new VerificationException(ERROR_INCONSISTENT_IS_CHANGE);
          }
          break;
        default:
          throw new VerificationException(ERROR_INVALID_DESTINATION);
      }
    }
  }
/**
   * Verifies size/count limits for SignTx request proto fields
   * These checks are done to align with limits set in the Codesafe module
   * This version is for external protos
   * @param request SignTxRequest to validate
   * @throws VerificationException in the event of a field exceeding a required limit
   */
Verifies size/count limits for SignTx request proto fields
These checks are done to align with limits set in the Codesafe module
This version is for external protos
@param request SignTxRequest to validate
@throws VerificationException in the event of a field exceeding a required limit
Verifies size / count limits for SignTx request proto fields These checks are done to align with limits set in the Codesafe module This version is for external protos @param request SignTxRequest to validate @throws VerificationException in the event of a field exceeding a required limit
private static void validateSignTxCommandRequest(CommandRequest.SignTxRequest request)
      throws VerificationException {
    validateTxInputs(request.getInputsList());
    if (request.getOutputsCount() > Constants.OUTPUTS_COUNT_MAX) {
      throw new VerificationException(ERROR_OUTPUTS_COUNT);
    }
    for (TxOutput output : request.getOutputsList()) {
      switch (output.getDestination()) {
        case CHANGE:
          if (!output.getPathOrThrow().getIsChangeOrThrow()) {
            throw new VerificationException(ERROR_INCONSISTENT_IS_CHANGE);
          }
          break;
        case GATEWAY:
          if (output.getPathOrThrow().getIsChangeOrThrow()) {
            throw new VerificationException(ERROR_INCONSISTENT_IS_CHANGE);
          }
          break;
        default:
          throw new VerificationException(ERROR_INVALID_DESTINATION);
      }
    }
  }
private static void validateSignTxCommandRequest ( CommandRequest . SignTxRequest request ) throws VerificationException { validateTxInputs ( request . getInputsList ( ) ) ; if ( request . getOutputsCount ( ) > Constants . OUTPUTS_COUNT_MAX ) { throw new VerificationException ( ERROR_OUTPUTS_COUNT ) ; } for ( TxOutput output : request . getOutputsList ( ) ) { switch ( output . getDestination ( ) ) { case CHANGE : if ( ! output . getPathOrThrow ( ) . getIsChangeOrThrow ( ) ) { throw new VerificationException ( ERROR_INCONSISTENT_IS_CHANGE ) ; } break ; case GATEWAY : if ( output . getPathOrThrow ( ) . getIsChangeOrThrow ( ) ) { throw new VerificationException ( ERROR_INCONSISTENT_IS_CHANGE ) ; } break ; default : throw new VerificationException ( ERROR_INVALID_DESTINATION ) ; } } }
Verifies size/count limits for SignTx request proto fields
 These checks are done to align with limits set in the Codesafe module
 This version is for external protos
 @param request SignTxRequest to validate
 @throws VerificationException in the event of a field exceeding a required limit
Verifies size / count limits for SignTx request proto fields These checks are done to align with limits set in the Codesafe module This version is for external protos @param request SignTxRequest to validate @throws VerificationException in the event of a field exceeding a required limit
// Validate that outputs are either CHANGE or GATEWAY. For outputs, the isChange attribute // of the path is redundant, so perform a consistency check.