Clean up QuicTransportVersion use

This CL does not change any behavior, it simply replaces some uses of QuicTransportVersion with ParsedQuicVersion. This is another step towards removing access to QuicTransportVersion in favor of ParsedQuicVersion.

PiperOrigin-RevId: 345274837
Change-Id: I2edf3620e966d6ffac3a78441850dbe7570054ab
diff --git a/quic/core/crypto/quic_crypto_client_config.cc b/quic/core/crypto/quic_crypto_client_config.cc
index 1026781..e968e86 100644
--- a/quic/core/crypto/quic_crypto_client_config.cc
+++ b/quic/core/crypto/quic_crypto_client_config.cc
@@ -498,8 +498,7 @@
   QUIC_BUG_IF(!QuicUtils::IsConnectionIdValidForVersion(
       connection_id, preferred_version.transport_version))
       << "FillClientHello: attempted to use connection ID " << connection_id
-      << " which is invalid with version "
-      << QuicVersionToString(preferred_version.transport_version);
+      << " which is invalid with version " << preferred_version;
 
   FillInchoateClientHello(server_id, preferred_version, cached, rand,
                           /* demand_x509_proof= */ true, out_params, out);
diff --git a/quic/core/crypto/quic_crypto_client_config_test.cc b/quic/core/crypto/quic_crypto_client_config_test.cc
index d7625cd..abdaa41 100644
--- a/quic/core/crypto/quic_crypto_client_config_test.cc
+++ b/quic/core/crypto/quic_crypto_client_config_test.cc
@@ -486,10 +486,12 @@
       new QuicCryptoNegotiatedParameters);
   std::string error;
   QuicCryptoClientConfig config(crypto_test_utils::ProofVerifierForTesting());
-  EXPECT_THAT(config.ProcessRejection(rej, QuicWallTime::FromUNIXSeconds(0),
-                                      AllSupportedTransportVersions().front(),
-                                      "", &cached, out_params, &error),
-              IsQuicNoError());
+  EXPECT_THAT(
+      config.ProcessRejection(
+          rej, QuicWallTime::FromUNIXSeconds(0),
+          AllSupportedVersionsWithQuicCrypto().front().transport_version, "",
+          &cached, out_params, &error),
+      IsQuicNoError());
   EXPECT_FALSE(cached.has_server_nonce());
 }
 
@@ -506,10 +508,12 @@
       new QuicCryptoNegotiatedParameters);
   std::string error;
   QuicCryptoClientConfig config(crypto_test_utils::ProofVerifierForTesting());
-  EXPECT_THAT(config.ProcessRejection(rej, QuicWallTime::FromUNIXSeconds(0),
-                                      AllSupportedTransportVersions().front(),
-                                      "", &cached, out_params, &error),
-              IsQuicNoError());
+  EXPECT_THAT(
+      config.ProcessRejection(
+          rej, QuicWallTime::FromUNIXSeconds(0),
+          AllSupportedVersionsWithQuicCrypto().front().transport_version, "",
+          &cached, out_params, &error),
+      IsQuicNoError());
   cached.SetProofValid();
   EXPECT_FALSE(cached.IsComplete(QuicWallTime::FromUNIXSeconds(long_ttl)));
   EXPECT_FALSE(
diff --git a/quic/core/crypto/quic_crypto_server_config.cc b/quic/core/crypto/quic_crypto_server_config.cc
index b929dcc..3995c58 100644
--- a/quic/core/crypto/quic_crypto_server_config.cc
+++ b/quic/core/crypto/quic_crypto_server_config.cc
@@ -742,7 +742,7 @@
       context->connection_id(), context->transport_version()))
       << "ProcessClientHelloAfterGetProof: attempted to use connection ID "
       << context->connection_id() << " which is invalid with version "
-      << QuicVersionToString(context->transport_version());
+      << context->version();
 
   if (found_error) {
     context->Fail(QUIC_HANDSHAKE_FAILED, "Failed to get proof");
@@ -830,7 +830,7 @@
       << "ProcessClientHelloAfterCalculateSharedKeys:"
          " attempted to use connection ID "
       << context->connection_id() << " which is invalid with version "
-      << QuicVersionToString(context->transport_version());
+      << context->version();
 
   if (found_error) {
     // If we are already using the fallback config, or there is no fallback
diff --git a/quic/core/http/quic_spdy_client_session_test.cc b/quic/core/http/quic_spdy_client_session_test.cc
index 5444c9d..93d3e58 100644
--- a/quic/core/http/quic_spdy_client_session_test.cc
+++ b/quic/core/http/quic_spdy_client_session_test.cc
@@ -230,10 +230,7 @@
 
 std::string ParamNameFormatter(
     const testing::TestParamInfo<QuicSpdyClientSessionTest::ParamType>& info) {
-  const ParsedQuicVersion& version = info.param;
-  return quiche::QuicheStrCat(
-      QuicVersionToString(version.transport_version), "_",
-      HandshakeProtocolToString(version.handshake_protocol));
+  return ParsedQuicVersionToString(info.param);
 }
 
 INSTANTIATE_TEST_SUITE_P(Tests,
@@ -583,7 +580,7 @@
       QuicConnectionPeer::GetFramer(connection_), destination_connection_id);
   bool version_flag = false;
   QuicConnectionIdIncluded scid_included = CONNECTION_ID_ABSENT;
-  if (VersionHasIetfInvariantHeader(version.transport_version)) {
+  if (version.HasIetfInvariantHeader()) {
     version_flag = true;
     source_connection_id = destination_connection_id;
     scid_included = CONNECTION_ID_PRESENT;
diff --git a/quic/core/quic_connection.cc b/quic/core/quic_connection.cc
index f864140..c8c4960 100644
--- a/quic/core/quic_connection.cc
+++ b/quic/core/quic_connection.cc
@@ -323,8 +323,7 @@
       peer_max_packet_size_(kDefaultMaxPacketSizeTransportParam),
       largest_received_packet_size_(0),
       write_error_occurred_(false),
-      no_stop_waiting_frames_(
-          VersionHasIetfInvariantHeader(transport_version())),
+      no_stop_waiting_frames_(version().HasIetfInvariantHeader()),
       consecutive_num_packets_with_no_retransmittable_frames_(0),
       max_consecutive_num_packets_with_no_retransmittable_frames_(
           kMaxConsecutiveNonRetransmittablePackets),
@@ -373,8 +372,7 @@
   QUIC_BUG_IF(!QuicUtils::IsConnectionIdValidForVersion(server_connection_id,
                                                         transport_version()))
       << "QuicConnection: attempted to use server connection ID "
-      << server_connection_id << " which is invalid with version "
-      << QuicVersionToString(transport_version());
+      << server_connection_id << " which is invalid with version " << version();
   framer_.set_visitor(this);
   stats_.connection_creation_time = clock_->ApproximateNow();
   // TODO(ianswett): Supply the NetworkChangeVisitor as a constructor argument
@@ -857,7 +855,7 @@
   // here.  (Check for a bug regression.)
   DCHECK_EQ(server_connection_id_, packet.connection_id);
   DCHECK_EQ(perspective_, Perspective::IS_CLIENT);
-  DCHECK(!VersionHasIetfInvariantHeader(transport_version()));
+  DCHECK(!version().HasIetfInvariantHeader());
   if (debug_visitor_ != nullptr) {
     debug_visitor_->OnPublicResetPacket(packet);
   }
@@ -1940,7 +1938,7 @@
     const QuicIetfStatelessResetPacket& /*packet*/) {
   // TODO(fayang): Add OnAuthenticatedIetfStatelessResetPacket to
   // debug_visitor_.
-  DCHECK(VersionHasIetfInvariantHeader(transport_version()));
+  DCHECK(version().HasIetfInvariantHeader());
   DCHECK_EQ(perspective_, Perspective::IS_CLIENT);
   if (!visitor_->ValidateStatelessReset(last_packet_destination_address_,
                                         last_packet_source_address_)) {
@@ -2538,7 +2536,7 @@
   if (!version_negotiated_) {
     if (perspective_ == Perspective::IS_CLIENT) {
       DCHECK(!header.version_flag || header.form != GOOGLE_QUIC_PACKET);
-      if (!VersionHasIetfInvariantHeader(framer_.transport_version())) {
+      if (!version().HasIetfInvariantHeader()) {
         // If the client gets a packet without the version flag from the server
         // it should stop sending version since the version negotiation is done.
         // IETF QUIC stops sending version once encryption level switches to
@@ -3347,7 +3345,7 @@
       break;
     default:
       // We can't send an error as the socket is presumably borked.
-      if (VersionHasIetfInvariantHeader(transport_version())) {
+      if (version().HasIetfInvariantHeader()) {
         QUIC_CODE_COUNT(quic_tear_down_local_connection_on_write_error_ietf);
       } else {
         QUIC_CODE_COUNT(
@@ -3381,7 +3379,7 @@
     // loop here.
     // TODO(ianswett): This is actually an internal error, not an
     // encryption failure.
-    if (VersionHasIetfInvariantHeader(transport_version())) {
+    if (version().HasIetfInvariantHeader()) {
       QUIC_CODE_COUNT(
           quic_tear_down_local_connection_on_serialized_packet_ietf);
     } else {
@@ -3408,7 +3406,7 @@
                                           const std::string& error_details) {
   // The packet creator or generator encountered an unrecoverable error: tear
   // down local connection state immediately.
-  if (VersionHasIetfInvariantHeader(transport_version())) {
+  if (version().HasIetfInvariantHeader()) {
     QUIC_CODE_COUNT(
         quic_tear_down_local_connection_on_unrecoverable_error_ietf);
   } else {
@@ -4875,7 +4873,7 @@
   }
   if (framer_.HasEncrypterOfEncryptionLevel(ENCRYPTION_ZERO_RTT)) {
     if (encryption_level_ != ENCRYPTION_ZERO_RTT) {
-      if (VersionHasIetfInvariantHeader(transport_version())) {
+      if (version().HasIetfInvariantHeader()) {
         QUIC_CODE_COUNT(quic_wrong_encryption_level_connection_close_ietf);
       } else {
         QUIC_CODE_COUNT(quic_wrong_encryption_level_connection_close);
diff --git a/quic/core/quic_connection_test.cc b/quic/core/quic_connection_test.cc
index 52d4d84..b3dc2d8 100644
--- a/quic/core/quic_connection_test.cc
+++ b/quic/core/quic_connection_test.cc
@@ -574,8 +574,7 @@
          {AckResponse::kDefer, AckResponse::kImmediate}) {
       params.push_back(
           TestParams(all_supported_versions[i], ack_response, true));
-      if (!VersionHasIetfInvariantHeader(
-              all_supported_versions[i].transport_version)) {
+      if (!all_supported_versions[i].HasIetfInvariantHeader()) {
         params.push_back(
             TestParams(all_supported_versions[i], ack_response, false));
       }
@@ -659,7 +658,7 @@
         QuicConnectionPeer::GetFramer(&connection_), connection_id_);
     QuicFramerPeer::SetLastWrittenPacketNumberLength(
         QuicConnectionPeer::GetFramer(&connection_), packet_number_length_);
-    if (VersionHasIetfInvariantHeader(version().transport_version)) {
+    if (version().HasIetfInvariantHeader()) {
       EXPECT_TRUE(QuicConnectionPeer::GetNoStopWaitingFrames(&connection_));
     } else {
       QuicConnectionPeer::SetNoStopWaitingFrames(&connection_,
@@ -1118,7 +1117,7 @@
   QuicPacketHeader ConstructPacketHeader(uint64_t number,
                                          EncryptionLevel level) {
     QuicPacketHeader header;
-    if (VersionHasIetfInvariantHeader(peer_framer_.transport_version()) &&
+    if (peer_framer_.version().HasIetfInvariantHeader() &&
         level < ENCRYPTION_FORWARD_SECURE) {
       // Set long header type accordingly.
       header.version_flag = true;
@@ -1142,7 +1141,7 @@
       header.destination_connection_id = connection_id_;
       header.destination_connection_id_included = connection_id_included_;
     }
-    if (VersionHasIetfInvariantHeader(peer_framer_.transport_version()) &&
+    if (peer_framer_.version().HasIetfInvariantHeader() &&
         peer_framer_.perspective() == Perspective::IS_SERVER) {
       header.destination_connection_id_included = CONNECTION_ID_ABSENT;
       if (header.version_flag) {
@@ -1192,12 +1191,12 @@
     if (peer_framer_.perspective() == Perspective::IS_SERVER) {
       header.source_connection_id = connection_id_;
       header.destination_connection_id_included = CONNECTION_ID_ABSENT;
-      if (!VersionHasIetfInvariantHeader(peer_framer_.transport_version())) {
+      if (!peer_framer_.version().HasIetfInvariantHeader()) {
         header.source_connection_id_included = CONNECTION_ID_PRESENT;
       }
     } else {
       header.destination_connection_id = connection_id_;
-      if (VersionHasIetfInvariantHeader(peer_framer_.transport_version())) {
+      if (peer_framer_.version().HasIetfInvariantHeader()) {
         header.destination_connection_id_included = CONNECTION_ID_ABSENT;
       }
     }
@@ -2455,8 +2454,7 @@
   // switched to ENCRYPTION_FORWARD_SECURE in SendStreamDataToPeer.
   EXPECT_CALL(*send_algorithm_,
               OnPacketSent(_, _, _,
-                           VersionHasIetfInvariantHeader(
-                               GetParam().version.transport_version)
+                           GetParam().version.HasIetfInvariantHeader()
                                ? packet_size
                                : packet_size - kQuicVersionSize,
                            _))
@@ -2674,7 +2672,7 @@
 }
 
 TEST_P(QuicConnectionTest, LeastUnackedLower) {
-  if (VersionHasIetfInvariantHeader(GetParam().version.transport_version)) {
+  if (GetParam().version.HasIetfInvariantHeader()) {
     return;
   }
   EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_));
@@ -3493,8 +3491,7 @@
   // switched to ENCRYPTION_FORWARD_SECURE in SendStreamDataToPeer.
   EXPECT_CALL(*send_algorithm_,
               OnPacketSent(_, _, _,
-                           VersionHasIetfInvariantHeader(
-                               GetParam().version.transport_version)
+                           GetParam().version.HasIetfInvariantHeader()
                                ? packet_size
                                : packet_size - kQuicVersionSize,
                            _));
@@ -5800,7 +5797,7 @@
 
 TEST_P(QuicConnectionTest, LoopThroughSendingPacketsWithTruncation) {
   set_perspective(Perspective::IS_SERVER);
-  if (!VersionHasIetfInvariantHeader(GetParam().version.transport_version)) {
+  if (!GetParam().version.HasIetfInvariantHeader()) {
     // For IETF QUIC, encryption level will be switched to FORWARD_SECURE in
     // SendStreamDataWithString.
     QuicPacketCreatorPeer::SetSendVersionInPacket(creator_, false);
@@ -5826,7 +5823,7 @@
   EXPECT_EQ(payload.size(),
             connection_.SendStreamDataWithString(3, payload, 1350, NO_FIN)
                 .bytes_consumed);
-  if (VersionHasIetfInvariantHeader(connection_.transport_version())) {
+  if (connection_.version().HasIetfInvariantHeader()) {
     // Short header packets sent from server omit connection ID already, and
     // stream offset size increases from 0 to 2.
     EXPECT_EQ(non_truncated_packet_size, writer_->last_packet_size() - 2);
@@ -6457,7 +6454,7 @@
 }
 
 TEST_P(QuicConnectionTest, PublicReset) {
-  if (VersionHasIetfInvariantHeader(GetParam().version.transport_version)) {
+  if (GetParam().version.HasIetfInvariantHeader()) {
     return;
   }
   QuicPublicResetPacket header;
@@ -6476,7 +6473,7 @@
 }
 
 TEST_P(QuicConnectionTest, IetfStatelessReset) {
-  if (!VersionHasIetfInvariantHeader(GetParam().version.transport_version)) {
+  if (!GetParam().version.HasIetfInvariantHeader()) {
     return;
   }
   const QuicUint128 kTestStatelessResetToken = 1010101;
@@ -6544,7 +6541,7 @@
 }
 
 TEST_P(QuicConnectionTest, MissingPacketsBeforeLeastUnacked) {
-  if (VersionHasIetfInvariantHeader(GetParam().version.transport_version)) {
+  if (GetParam().version.HasIetfInvariantHeader()) {
     return;
   }
   // Set the packet number of the ack packet to be least unacked (4).
@@ -6567,7 +6564,7 @@
   std::unique_ptr<QuicEncryptedPacket> encrypted(
       QuicFramer::BuildVersionNegotiationPacket(
           connection_id_, EmptyQuicConnectionId(),
-          VersionHasIetfInvariantHeader(connection_.transport_version()),
+          connection_.version().HasIetfInvariantHeader(),
           connection_.version().HasLengthPrefixedConnectionIds(), versions));
   std::unique_ptr<QuicReceivedPacket> received(
       ConstructReceivedPacket(*encrypted, QuicTime::Zero()));
@@ -6590,7 +6587,7 @@
   std::unique_ptr<QuicEncryptedPacket> encrypted(
       QuicFramer::BuildVersionNegotiationPacket(
           connection_id_, EmptyQuicConnectionId(),
-          VersionHasIetfInvariantHeader(connection_.transport_version()),
+          connection_.version().HasIetfInvariantHeader(),
           connection_.version().HasLengthPrefixedConnectionIds(),
           AllSupportedVersions()));
   std::unique_ptr<QuicReceivedPacket> received(
@@ -6647,9 +6644,7 @@
   // For IETF QUIC, version is not included as the encryption level switches to
   // FORWARD_SECURE in SendStreamDataWithString.
   size_t save_on_version =
-      VersionHasIetfInvariantHeader(GetParam().version.transport_version)
-          ? 0
-          : kQuicVersionSize;
+      GetParam().version.HasIetfInvariantHeader() ? 0 : kQuicVersionSize;
   EXPECT_EQ(3 * first_packet_size + 2 * second_packet_size - save_on_version,
             stats.bytes_sent);
   EXPECT_EQ(5u, stats.packets_sent);
@@ -6666,12 +6661,12 @@
   if (peer_framer_.perspective() == Perspective::IS_SERVER) {
     header.source_connection_id = connection_id_;
     header.destination_connection_id_included = CONNECTION_ID_ABSENT;
-    if (!VersionHasIetfInvariantHeader(peer_framer_.transport_version())) {
+    if (!peer_framer_.version().HasIetfInvariantHeader()) {
       header.source_connection_id_included = CONNECTION_ID_PRESENT;
     }
   } else {
     header.destination_connection_id = connection_id_;
-    if (VersionHasIetfInvariantHeader(peer_framer_.transport_version())) {
+    if (peer_framer_.version().HasIetfInvariantHeader()) {
       header.destination_connection_id_included = CONNECTION_ID_ABSENT;
     }
   }
@@ -6779,7 +6774,7 @@
 TEST_P(QuicConnectionTest, OnPacketHeaderDebugVisitor) {
   QuicPacketHeader header;
   header.packet_number = QuicPacketNumber(1);
-  if (VersionHasIetfInvariantHeader(GetParam().version.transport_version)) {
+  if (GetParam().version.HasIetfInvariantHeader()) {
     header.form = IETF_QUIC_LONG_HEADER_PACKET;
   }
 
diff --git a/quic/core/quic_crypto_stream_test.cc b/quic/core/quic_crypto_stream_test.cc
index c67a5dc..5593e53 100644
--- a/quic/core/quic_crypto_stream_test.cc
+++ b/quic/core/quic_crypto_stream_test.cc
@@ -576,20 +576,22 @@
 
 // Regression test for bugfix of GetPacketHeaderSize.
 TEST_F(QuicCryptoStreamTest, CryptoMessageFramingOverhead) {
-  for (auto version : AllSupportedTransportVersions()) {
+  for (const ParsedQuicVersion& version :
+       AllSupportedVersionsWithQuicCrypto()) {
     SCOPED_TRACE(version);
     QuicByteCount expected_overhead = 48;
-    if (VersionHasIetfInvariantHeader(version)) {
+    if (version.HasIetfInvariantHeader()) {
       expected_overhead += 4;
     }
-    if (QuicVersionHasLongHeaderLengths(version)) {
+    if (version.HasLongHeaderLengths()) {
       expected_overhead += 3;
     }
-    if (VersionHasLengthPrefixedConnectionIds(version)) {
+    if (version.HasLengthPrefixedConnectionIds()) {
       expected_overhead += 1;
     }
-    EXPECT_EQ(expected_overhead, QuicCryptoStream::CryptoMessageFramingOverhead(
-                                     version, TestConnectionId()));
+    EXPECT_EQ(expected_overhead,
+              QuicCryptoStream::CryptoMessageFramingOverhead(
+                  version.transport_version, TestConnectionId()));
   }
 }
 
diff --git a/quic/core/quic_dispatcher.cc b/quic/core/quic_dispatcher.cc
index 148c73b..3e0846c 100644
--- a/quic/core/quic_dispatcher.cc
+++ b/quic/core/quic_dispatcher.cc
@@ -749,7 +749,7 @@
     action = QuicTimeWaitListManager::SEND_CONNECTION_CLOSE_PACKETS;
   } else {
     if (!connection->IsHandshakeComplete()) {
-      if (!VersionHasIetfInvariantHeader(connection->transport_version())) {
+      if (!connection->version().HasIetfInvariantHeader()) {
         QUIC_CODE_COUNT(gquic_add_to_time_wait_list_with_handshake_failed);
       } else {
         QUIC_CODE_COUNT(quic_v44_add_to_time_wait_list_with_handshake_failed);
@@ -759,7 +759,7 @@
       // QUIC_HANDSHAKE_FAILED and adds the connection to the time wait list.
       StatelesslyTerminateConnection(
           connection->connection_id(),
-          VersionHasIetfInvariantHeader(connection->transport_version())
+          connection->version().HasIetfInvariantHeader()
               ? IETF_QUIC_LONG_HEADER_PACKET
               : GOOGLE_QUIC_PACKET,
           /*version_flag=*/true,
@@ -778,7 +778,7 @@
   time_wait_list_manager_->AddConnectionIdToTimeWait(
       it->first, action,
       TimeWaitConnectionInfo(
-          VersionHasIetfInvariantHeader(connection->transport_version()),
+          connection->version().HasIetfInvariantHeader(),
           connection->termination_packets(),
           connection->sent_packet_manager().GetRttStats()->smoothed_rtt()));
   session_map_.erase(it);
diff --git a/quic/core/quic_framer.cc b/quic/core/quic_framer.cc
index be14a0b..4862d35 100644
--- a/quic/core/quic_framer.cc
+++ b/quic/core/quic_framer.cc
@@ -887,8 +887,7 @@
                                    char* buffer,
                                    size_t packet_length,
                                    EncryptionLevel level) {
-  QUIC_BUG_IF(header.version_flag &&
-              VersionHasIetfInvariantHeader(transport_version()) &&
+  QUIC_BUG_IF(header.version_flag && version().HasIetfInvariantHeader() &&
               header.long_packet_type == RETRY && !frames.empty())
       << "IETF RETRY packets cannot contain frames " << header;
   QuicDataWriter writer(packet_length, buffer);
@@ -1439,8 +1438,7 @@
 
   bool packet_has_ietf_packet_header = false;
   if (infer_packet_header_type_from_version_) {
-    packet_has_ietf_packet_header =
-        VersionHasIetfInvariantHeader(version_.transport_version);
+    packet_has_ietf_packet_header = version_.HasIetfInvariantHeader();
   } else if (!reader.IsDoneReading()) {
     uint8_t type = reader.PeekByte();
     packet_has_ietf_packet_header = QuicUtils::IsIetfPacketHeader(type);
@@ -2085,7 +2083,7 @@
 bool QuicFramer::AppendPacketHeader(const QuicPacketHeader& header,
                                     QuicDataWriter* writer,
                                     size_t* length_field_offset) {
-  if (VersionHasIetfInvariantHeader(transport_version())) {
+  if (version().HasIetfInvariantHeader()) {
     return AppendIetfPacketHeader(header, writer, length_field_offset);
   }
   QUIC_DVLOG(1) << ENDPOINT << "Appending header: " << header;
@@ -2126,7 +2124,7 @@
           server_connection_id, transport_version()))
           << "AppendPacketHeader: attempted to use connection ID "
           << server_connection_id << " which is invalid with version "
-          << QuicVersionToString(transport_version());
+          << version();
 
       public_flags |= PACKET_PUBLIC_FLAGS_8BYTE_CONNECTION_ID;
       if (perspective_ == Perspective::IS_CLIENT) {
@@ -2189,8 +2187,7 @@
   QUIC_BUG_IF(!QuicUtils::IsConnectionIdValidForVersion(server_connection_id,
                                                         transport_version()))
       << "AppendIetfPacketHeader: attempted to use connection ID "
-      << server_connection_id << " which is invalid with version "
-      << QuicVersionToString(transport_version());
+      << server_connection_id << " which is invalid with version " << version();
   if (!AppendIetfHeaderTypeByte(header, writer)) {
     return false;
   }
@@ -2715,12 +2712,12 @@
     std::string detailed_error;
     QuicErrorCode parse_result = QuicFramer::ParsePublicHeader(
         reader, expected_destination_connection_id_length,
-        VersionHasIetfInvariantHeader(version_.transport_version),
-        &header->type_byte, &header->form, &header->version_flag,
-        &has_length_prefix, &version_label, &header->version,
-        &header->destination_connection_id, &header->source_connection_id,
-        &header->long_packet_type, &header->retry_token_length_length,
-        &header->retry_token, &detailed_error);
+        version_.HasIetfInvariantHeader(), &header->type_byte, &header->form,
+        &header->version_flag, &has_length_prefix, &version_label,
+        &header->version, &header->destination_connection_id,
+        &header->source_connection_id, &header->long_packet_type,
+        &header->retry_token_length_length, &header->retry_token,
+        &detailed_error);
     if (parse_result != QUIC_NO_ERROR) {
       set_detailed_error(detailed_error);
       return false;
@@ -5618,7 +5615,7 @@
 bool QuicFramer::AppendStopWaitingFrame(const QuicPacketHeader& header,
                                         const QuicStopWaitingFrame& frame,
                                         QuicDataWriter* writer) {
-  DCHECK(!VersionHasIetfInvariantHeader(version_.transport_version));
+  DCHECK(!version_.HasIetfInvariantHeader());
   DCHECK(frame.least_unacked.IsInitialized());
   DCHECK_GE(header.packet_number, frame.least_unacked);
   const uint64_t least_unacked_delta =
diff --git a/quic/core/quic_framer_test.cc b/quic/core/quic_framer_test.cc
index 04eca30..dfaf811 100644
--- a/quic/core/quic_framer_test.cc
+++ b/quic/core/quic_framer_test.cc
@@ -1362,11 +1362,10 @@
   const QuicErrorCode parse_error = QuicFramer::ParsePublicHeader(
       &reader, kQuicDefaultConnectionIdLength,
       /*ietf_format=*/
-      VersionHasIetfInvariantHeader(framer_.transport_version()), &first_byte,
-      &format, &version_present, &has_length_prefix, &version_label,
-      &parsed_version, &destination_connection_id, &source_connection_id,
-      &long_packet_type, &retry_token_length_length, &retry_token,
-      &detailed_error);
+      framer_.version().HasIetfInvariantHeader(), &first_byte, &format,
+      &version_present, &has_length_prefix, &version_label, &parsed_version,
+      &destination_connection_id, &source_connection_id, &long_packet_type,
+      &retry_token_length_length, &retry_token, &detailed_error);
   EXPECT_THAT(parse_error, IsQuicNoError());
   EXPECT_EQ("", detailed_error);
   EXPECT_EQ(p[0], first_byte);
@@ -1379,7 +1378,7 @@
   EXPECT_EQ(EmptyQuicConnectionId(), source_connection_id);
   EXPECT_EQ(VARIABLE_LENGTH_INTEGER_LENGTH_0, retry_token_length_length);
   EXPECT_EQ(absl::string_view(), retry_token);
-  if (VersionHasIetfInvariantHeader(framer_.transport_version())) {
+  if (framer_.version().HasIetfInvariantHeader()) {
     EXPECT_EQ(IETF_QUIC_LONG_HEADER_PACKET, format);
     EXPECT_EQ(HANDSHAKE, long_packet_type);
   } else {
@@ -2763,7 +2762,7 @@
   // If IETF frames are in use then we must also have the IETF
   // header invariants.
   if (VersionHasIetfQuicFrames(framer_.transport_version())) {
-    DCHECK(VersionHasIetfInvariantHeader(framer_.transport_version()));
+    DCHECK(framer_.version().HasIetfInvariantHeader());
   }
 
   SetDecrypterLevel(ENCRYPTION_ZERO_RTT);
diff --git a/quic/core/quic_packet_creator.cc b/quic/core/quic_packet_creator.cc
index e1e3478..a9d95b3 100644
--- a/quic/core/quic_packet_creator.cc
+++ b/quic/core/quic_packet_creator.cc
@@ -221,7 +221,7 @@
 // maximum packet size if we stop sending version before it is serialized.
 void QuicPacketCreator::StopSendingVersion() {
   DCHECK(send_version_in_packet_);
-  DCHECK(!VersionHasIetfInvariantHeader(framer_->transport_version()));
+  DCHECK(!version().HasIetfInvariantHeader());
   send_version_in_packet_ = false;
   if (packet_size_ > 0) {
     DCHECK_LT(kQuicVersionSize, packet_size_);
@@ -1785,7 +1785,7 @@
 }
 
 bool QuicPacketCreator::IncludeVersionInHeader() const {
-  if (VersionHasIetfInvariantHeader(framer_->transport_version())) {
+  if (version().HasIetfInvariantHeader()) {
     return packet_.encryption_level < ENCRYPTION_FORWARD_SECURE;
   }
   return send_version_in_packet_;
@@ -1908,7 +1908,7 @@
 }
 
 bool QuicPacketCreator::HasIetfLongHeader() const {
-  return VersionHasIetfInvariantHeader(framer_->transport_version()) &&
+  return version().HasIetfInvariantHeader() &&
          packet_.encryption_level < ENCRYPTION_FORWARD_SECURE;
 }
 
diff --git a/quic/core/quic_packet_creator_test.cc b/quic/core/quic_packet_creator_test.cc
index 91dbf24..e2154c1 100644
--- a/quic/core/quic_packet_creator_test.cc
+++ b/quic/core/quic_packet_creator_test.cc
@@ -102,7 +102,7 @@
                     SimpleDataProducer* producer)
       : QuicPacketCreator(connection_id, framer, delegate),
         producer_(producer),
-        version_(framer->transport_version()) {}
+        version_(framer->version()) {}
 
   bool ConsumeDataToFillCurrentPacket(QuicStreamId id,
                                       const struct iovec* iov,
@@ -125,7 +125,7 @@
   }
 
   void StopSendingVersion() {
-    if (VersionHasIetfInvariantHeader(version_)) {
+    if (version_.HasIetfInvariantHeader()) {
       set_encryption_level(ENCRYPTION_FORWARD_SECURE);
       return;
     }
@@ -133,7 +133,7 @@
   }
 
   SimpleDataProducer* producer_;
-  QuicTransportVersion version_;
+  ParsedQuicVersion version_;
 };
 
 class QuicPacketCreatorTest : public QuicTestWithParam<TestParams> {
@@ -1166,7 +1166,7 @@
 }
 
 TEST_P(QuicPacketCreatorTest, UpdatePacketSequenceNumberLengthLeastAwaiting) {
-  if (VersionHasIetfInvariantHeader(creator_.transport_version()) &&
+  if (creator_.version().HasIetfInvariantHeader() &&
       !GetParam().version.SendsVariableLengthPacketNumberInLongHeader()) {
     EXPECT_EQ(PACKET_4BYTE_PACKET_NUMBER,
               QuicPacketCreatorPeer::GetPacketNumberLength(&creator_));
@@ -1204,7 +1204,7 @@
 
 TEST_P(QuicPacketCreatorTest, UpdatePacketSequenceNumberLengthCwnd) {
   QuicPacketCreatorPeer::SetPacketNumber(&creator_, 1);
-  if (VersionHasIetfInvariantHeader(creator_.transport_version()) &&
+  if (creator_.version().HasIetfInvariantHeader() &&
       !GetParam().version.SendsVariableLengthPacketNumberInLongHeader()) {
     EXPECT_EQ(PACKET_4BYTE_PACKET_NUMBER,
               QuicPacketCreatorPeer::GetPacketNumberLength(&creator_));
@@ -1238,7 +1238,7 @@
 
 TEST_P(QuicPacketCreatorTest, SkipNPacketNumbers) {
   QuicPacketCreatorPeer::SetPacketNumber(&creator_, 1);
-  if (VersionHasIetfInvariantHeader(creator_.transport_version()) &&
+  if (creator_.version().HasIetfInvariantHeader() &&
       !GetParam().version.SendsVariableLengthPacketNumberInLongHeader()) {
     EXPECT_EQ(PACKET_4BYTE_PACKET_NUMBER,
               QuicPacketCreatorPeer::GetPacketNumberLength(&creator_));
@@ -3230,7 +3230,7 @@
 
   for (size_t i = 1; i < 10; i++) {
     creator_.SetServerConnectionIdLength(i);
-    if (VersionHasIetfInvariantHeader(framer_.transport_version())) {
+    if (framer_.version().HasIetfInvariantHeader()) {
       EXPECT_EQ(PACKET_0BYTE_CONNECTION_ID,
                 creator_.GetDestinationConnectionIdLength());
     } else {
diff --git a/quic/core/quic_received_packet_manager_test.cc b/quic/core/quic_received_packet_manager_test.cc
index c8d1638..41de03c 100644
--- a/quic/core/quic_received_packet_manager_test.cc
+++ b/quic/core/quic_received_packet_manager_test.cc
@@ -41,28 +41,7 @@
 const QuicTime::Delta kDelayedAckTime =
     QuicTime::Delta::FromMilliseconds(kDefaultDelayedAckTimeMs);
 
-struct TestParams {
-  explicit TestParams(QuicTransportVersion version) : version(version) {}
-
-  QuicTransportVersion version;
-};
-
-// Used by ::testing::PrintToStringParamName().
-std::string PrintToString(const TestParams& p) {
-  return QuicVersionToString(p.version);
-}
-
-std::vector<TestParams> GetTestParams() {
-  std::vector<TestParams> params;
-  QuicTransportVersionVector all_supported_versions =
-      AllSupportedTransportVersions();
-  for (size_t i = 0; i < all_supported_versions.size(); ++i) {
-    params.push_back(TestParams(all_supported_versions[i]));
-  }
-  return params;
-}
-
-class QuicReceivedPacketManagerTest : public QuicTestWithParam<TestParams> {
+class QuicReceivedPacketManagerTest : public QuicTest {
  protected:
   QuicReceivedPacketManagerTest() : received_manager_(&stats_) {
     clock_.AdvanceTime(QuicTime::Delta::FromSeconds(1));
@@ -108,12 +87,7 @@
   QuicReceivedPacketManager received_manager_;
 };
 
-INSTANTIATE_TEST_SUITE_P(QuicReceivedPacketManagerTest,
-                         QuicReceivedPacketManagerTest,
-                         ::testing::ValuesIn(GetTestParams()),
-                         ::testing::PrintToStringParamName());
-
-TEST_P(QuicReceivedPacketManagerTest, DontWaitForPacketsBefore) {
+TEST_F(QuicReceivedPacketManagerTest, DontWaitForPacketsBefore) {
   QuicPacketHeader header;
   header.packet_number = QuicPacketNumber(2u);
   received_manager_.RecordPacketReceived(header, QuicTime::Zero());
@@ -126,7 +100,7 @@
   EXPECT_TRUE(received_manager_.IsAwaitingPacket(QuicPacketNumber(6u)));
 }
 
-TEST_P(QuicReceivedPacketManagerTest, GetUpdatedAckFrame) {
+TEST_F(QuicReceivedPacketManagerTest, GetUpdatedAckFrame) {
   QuicPacketHeader header;
   header.packet_number = QuicPacketNumber(2u);
   QuicTime two_ms = QuicTime::Zero() + QuicTime::Delta::FromMilliseconds(2);
@@ -168,7 +142,7 @@
   EXPECT_EQ(2u, ack.ack_frame->received_packet_times.size());
 }
 
-TEST_P(QuicReceivedPacketManagerTest, UpdateReceivedConnectionStats) {
+TEST_F(QuicReceivedPacketManagerTest, UpdateReceivedConnectionStats) {
   EXPECT_FALSE(received_manager_.ack_frame_updated());
   RecordPacketReceipt(1);
   EXPECT_TRUE(received_manager_.ack_frame_updated());
@@ -181,7 +155,7 @@
   EXPECT_EQ(1u, stats_.packets_reordered);
 }
 
-TEST_P(QuicReceivedPacketManagerTest, LimitAckRanges) {
+TEST_F(QuicReceivedPacketManagerTest, LimitAckRanges) {
   received_manager_.set_max_ack_ranges(10);
   EXPECT_FALSE(received_manager_.ack_frame_updated());
   for (int i = 0; i < 100; ++i) {
@@ -203,7 +177,7 @@
   }
 }
 
-TEST_P(QuicReceivedPacketManagerTest, IgnoreOutOfOrderTimestamps) {
+TEST_F(QuicReceivedPacketManagerTest, IgnoreOutOfOrderTimestamps) {
   EXPECT_FALSE(received_manager_.ack_frame_updated());
   RecordPacketReceipt(1, QuicTime::Zero());
   EXPECT_TRUE(received_manager_.ack_frame_updated());
@@ -215,7 +189,7 @@
   EXPECT_EQ(2u, received_manager_.ack_frame().received_packet_times.size());
 }
 
-TEST_P(QuicReceivedPacketManagerTest, HasMissingPackets) {
+TEST_F(QuicReceivedPacketManagerTest, HasMissingPackets) {
   EXPECT_QUIC_BUG(received_manager_.PeerFirstSendingPacketNumber(),
                   "No packets have been received yet");
   RecordPacketReceipt(4, QuicTime::Zero());
@@ -236,7 +210,7 @@
   EXPECT_FALSE(received_manager_.HasMissingPackets());
 }
 
-TEST_P(QuicReceivedPacketManagerTest, OutOfOrderReceiptCausesAckSent) {
+TEST_F(QuicReceivedPacketManagerTest, OutOfOrderReceiptCausesAckSent) {
   EXPECT_FALSE(HasPendingAck());
 
   RecordPacketReceipt(3, clock_.ApproximateNow());
@@ -269,7 +243,7 @@
   CheckAckTimeout(clock_.ApproximateNow());
 }
 
-TEST_P(QuicReceivedPacketManagerTest, OutOfOrderReceiptCausesAckSent1Ack) {
+TEST_F(QuicReceivedPacketManagerTest, OutOfOrderReceiptCausesAckSent1Ack) {
   QuicReceivedPacketManagerPeer::SetOneImmediateAck(&received_manager_, true);
   EXPECT_FALSE(HasPendingAck());
 
@@ -303,7 +277,7 @@
   CheckAckTimeout(clock_.ApproximateNow() + kDelayedAckTime);
 }
 
-TEST_P(QuicReceivedPacketManagerTest, OutOfOrderAckReceiptCausesNoAck) {
+TEST_F(QuicReceivedPacketManagerTest, OutOfOrderAckReceiptCausesNoAck) {
   EXPECT_FALSE(HasPendingAck());
 
   RecordPacketReceipt(2, clock_.ApproximateNow());
@@ -315,7 +289,7 @@
   EXPECT_FALSE(HasPendingAck());
 }
 
-TEST_P(QuicReceivedPacketManagerTest, AckReceiptCausesAckSend) {
+TEST_F(QuicReceivedPacketManagerTest, AckReceiptCausesAckSend) {
   EXPECT_FALSE(HasPendingAck());
 
   RecordPacketReceipt(1, clock_.ApproximateNow());
@@ -342,7 +316,7 @@
   EXPECT_FALSE(HasPendingAck());
 }
 
-TEST_P(QuicReceivedPacketManagerTest, AckSentEveryNthPacket) {
+TEST_F(QuicReceivedPacketManagerTest, AckSentEveryNthPacket) {
   EXPECT_FALSE(HasPendingAck());
   received_manager_.set_ack_frequency(3);
 
@@ -358,7 +332,7 @@
   }
 }
 
-TEST_P(QuicReceivedPacketManagerTest, AckDecimationReducesAcks) {
+TEST_F(QuicReceivedPacketManagerTest, AckDecimationReducesAcks) {
   EXPECT_FALSE(HasPendingAck());
 
   // Start ack decimation from 10th packet.
@@ -391,7 +365,7 @@
   CheckAckTimeout(clock_.ApproximateNow());
 }
 
-TEST_P(QuicReceivedPacketManagerTest, SendDelayedAckDecimation) {
+TEST_F(QuicReceivedPacketManagerTest, SendDelayedAckDecimation) {
   EXPECT_FALSE(HasPendingAck());
   // The ack time should be based on min_rtt * 1/4, since it's less than the
   // default delayed ack time.
@@ -422,7 +396,7 @@
   CheckAckTimeout(clock_.ApproximateNow());
 }
 
-TEST_P(QuicReceivedPacketManagerTest, SendDelayedAckDecimationMin1ms) {
+TEST_F(QuicReceivedPacketManagerTest, SendDelayedAckDecimationMin1ms) {
   if (!GetQuicReloadableFlag(quic_ack_delay_alarm_granularity)) {
     return;
   }
@@ -458,7 +432,7 @@
   CheckAckTimeout(clock_.ApproximateNow());
 }
 
-TEST_P(QuicReceivedPacketManagerTest,
+TEST_F(QuicReceivedPacketManagerTest,
        SendDelayedAckDecimationUnlimitedAggregation) {
   EXPECT_FALSE(HasPendingAck());
   QuicConfig config;
@@ -499,7 +473,7 @@
   CheckAckTimeout(ack_time);
 }
 
-TEST_P(QuicReceivedPacketManagerTest, SendDelayedAckDecimationEighthRtt) {
+TEST_F(QuicReceivedPacketManagerTest, SendDelayedAckDecimationEighthRtt) {
   EXPECT_FALSE(HasPendingAck());
   QuicReceivedPacketManagerPeer::SetAckDecimationDelay(&received_manager_,
                                                        0.125);
diff --git a/quic/core/quic_time_wait_list_manager_test.cc b/quic/core/quic_time_wait_list_manager_test.cc
index 34c2b1e..8e69dc3 100644
--- a/quic/core/quic_time_wait_list_manager_test.cc
+++ b/quic/core/quic_time_wait_list_manager_test.cc
@@ -164,8 +164,7 @@
       std::vector<std::unique_ptr<QuicEncryptedPacket>>* packets) {
     time_wait_list_manager_.AddConnectionIdToTimeWait(
         connection_id, action,
-        TimeWaitConnectionInfo(
-            VersionHasIetfInvariantHeader(version.transport_version), packets));
+        TimeWaitConnectionInfo(version.HasIetfInvariantHeader(), packets));
   }
 
   bool IsConnectionIdInTimeWait(QuicConnectionId connection_id) {
diff --git a/quic/core/quic_versions.cc b/quic/core/quic_versions.cc
index 05b9918..af6bd18 100644
--- a/quic/core/quic_versions.cc
+++ b/quic/core/quic_versions.cc
@@ -326,24 +326,22 @@
     return UnsupportedQuicVersion();
   }
   int quic_version_number = 0;
+  const ParsedQuicVersionVector supported_versions = AllSupportedVersions();
   if (absl::SimpleAtoi(version_string, &quic_version_number) &&
       quic_version_number > 0) {
     QuicTransportVersion transport_version =
         static_cast<QuicTransportVersion>(quic_version_number);
-    bool transport_version_is_supported = false;
-    for (QuicTransportVersion transport_vers : SupportedTransportVersions()) {
-      if (transport_vers == transport_version) {
-        transport_version_is_supported = true;
-        break;
-      }
-    }
-    if (!transport_version_is_supported ||
-        !ParsedQuicVersionIsValid(PROTOCOL_QUIC_CRYPTO, transport_version)) {
+    if (!ParsedQuicVersionIsValid(PROTOCOL_QUIC_CRYPTO, transport_version)) {
       return UnsupportedQuicVersion();
     }
-    return ParsedQuicVersion(PROTOCOL_QUIC_CRYPTO, transport_version);
+    ParsedQuicVersion version(PROTOCOL_QUIC_CRYPTO, transport_version);
+    if (std::find(supported_versions.begin(), supported_versions.end(),
+                  version) != supported_versions.end()) {
+      return version;
+    }
+    return UnsupportedQuicVersion();
   }
-  for (const ParsedQuicVersion& version : AllSupportedVersions()) {
+  for (const ParsedQuicVersion& version : supported_versions) {
     if (version_string == ParsedQuicVersionToString(version) ||
         version_string == AlpnForVersion(version) ||
         (version.handshake_protocol == PROTOCOL_QUIC_CRYPTO &&
@@ -351,13 +349,13 @@
       return version;
     }
   }
-    for (const ParsedQuicVersion& version : AllSupportedVersions()) {
-      if (version.UsesHttp3() &&
-          version_string ==
-              QuicVersionLabelToString(CreateQuicVersionLabel(version))) {
-        return version;
-      }
+  for (const ParsedQuicVersion& version : supported_versions) {
+    if (version.UsesHttp3() &&
+        version_string ==
+            QuicVersionLabelToString(CreateQuicVersionLabel(version))) {
+      return version;
     }
+  }
   // Reading from the client so this should not be considered an ERROR.
   QUIC_DLOG(INFO) << "Unsupported QUIC version string: \"" << version_string
                   << "\".";
@@ -383,10 +381,14 @@
 }
 
 QuicTransportVersionVector AllSupportedTransportVersions() {
-  constexpr auto supported_transport_versions = SupportedTransportVersions();
-  QuicTransportVersionVector supported_versions(
-      supported_transport_versions.begin(), supported_transport_versions.end());
-  return supported_versions;
+  QuicTransportVersionVector transport_versions;
+  for (const ParsedQuicVersion& version : AllSupportedVersions()) {
+    if (std::find(transport_versions.begin(), transport_versions.end(),
+                  version.transport_version) == transport_versions.end()) {
+      transport_versions.push_back(version.transport_version);
+    }
+  }
+  return transport_versions;
 }
 
 ParsedQuicVersionVector AllSupportedVersions() {
@@ -432,19 +434,6 @@
   return filtered_versions;
 }
 
-QuicTransportVersionVector VersionOfIndex(
-    const QuicTransportVersionVector& versions,
-    int index) {
-  QuicTransportVersionVector version;
-  int version_count = versions.size();
-  if (index >= 0 && index < version_count) {
-    version.push_back(versions[index]);
-  } else {
-    version.push_back(QUIC_VERSION_UNSUPPORTED);
-  }
-  return version;
-}
-
 ParsedQuicVersionVector ParsedVersionOfIndex(
     const ParsedQuicVersionVector& versions,
     int index) {
@@ -458,22 +447,6 @@
   return version;
 }
 
-QuicTransportVersionVector ParsedVersionsToTransportVersions(
-    const ParsedQuicVersionVector& versions) {
-  QuicTransportVersionVector transport_versions;
-  transport_versions.resize(versions.size());
-  for (size_t i = 0; i < versions.size(); ++i) {
-    transport_versions[i] = versions[i].transport_version;
-  }
-  return transport_versions;
-}
-
-QuicVersionLabel QuicVersionToQuicVersionLabel(
-    QuicTransportVersion transport_version) {
-  return CreateQuicVersionLabel(
-      ParsedQuicVersion(PROTOCOL_QUIC_CRYPTO, transport_version));
-}
-
 std::string QuicVersionLabelToString(QuicVersionLabel version_label) {
   return QuicTagToString(quiche::QuicheEndian::HostToNet32(version_label));
 }
@@ -497,23 +470,11 @@
   return result;
 }
 
-QuicTransportVersion QuicVersionLabelToQuicVersion(
-    QuicVersionLabel version_label) {
-  return ParseQuicVersionLabel(version_label).transport_version;
-}
-
-HandshakeProtocol QuicVersionLabelToHandshakeProtocol(
-    QuicVersionLabel version_label) {
-  return ParseQuicVersionLabel(version_label).handshake_protocol;
-}
-
 #define RETURN_STRING_LITERAL(x) \
   case x:                        \
     return #x
 
 std::string QuicVersionToString(QuicTransportVersion transport_version) {
-  static_assert(SupportedTransportVersions().size() == 5u,
-                "Supported versions out of sync");
   switch (transport_version) {
     RETURN_STRING_LITERAL(QUIC_VERSION_43);
     RETURN_STRING_LITERAL(QUIC_VERSION_46);
diff --git a/quic/core/quic_versions.h b/quic/core/quic_versions.h
index 60d50bf..003424d 100644
--- a/quic/core/quic_versions.h
+++ b/quic/core/quic_versions.h
@@ -26,6 +26,7 @@
 #include <string>
 #include <vector>
 
+#include "absl/base/macros.h"
 #include "absl/strings/string_view.h"
 #include "net/third_party/quiche/src/quic/core/quic_tag.h"
 #include "net/third_party/quiche/src/quic/core/quic_types.h"
@@ -134,16 +135,6 @@
   QUIC_VERSION_RESERVED_FOR_NEGOTIATION = 999,
 };
 
-// This array contains QUIC transport versions which we currently support.
-// DEPRECATED. Use SupportedVersions() instead.
-constexpr std::array<QuicTransportVersion, 5> SupportedTransportVersions() {
-  return {QUIC_VERSION_IETF_DRAFT_29,
-          QUIC_VERSION_51,
-          QUIC_VERSION_50,
-          QUIC_VERSION_46,
-          QUIC_VERSION_43};
-}
-
 // Helper function which translates from a QuicTransportVersion to a string.
 // Returns strings corresponding to enum names (e.g. QUIC_VERSION_6).
 QUIC_EXPORT_PRIVATE std::string QuicVersionToString(
@@ -177,18 +168,20 @@
 QUIC_EXPORT_PRIVATE constexpr bool ParsedQuicVersionIsValid(
     HandshakeProtocol handshake_protocol,
     QuicTransportVersion transport_version) {
-  bool transport_version_is_valid =
-      transport_version == QUIC_VERSION_UNSUPPORTED ||
-      transport_version == QUIC_VERSION_RESERVED_FOR_NEGOTIATION;
-  if (!transport_version_is_valid) {
-    // Iterators are not constexpr in C++14 which Chrome uses.
-    constexpr auto supported_transport_versions = SupportedTransportVersions();
-    for (size_t i = 0; i < supported_transport_versions.size(); ++i) {
-      const QuicTransportVersion& trans_vers = supported_transport_versions[i];
-      if (trans_vers == transport_version) {
-        transport_version_is_valid = true;
-        break;
-      }
+  bool transport_version_is_valid = false;
+  constexpr QuicTransportVersion valid_transport_versions[] = {
+      QUIC_VERSION_IETF_DRAFT_29,
+      QUIC_VERSION_51,
+      QUIC_VERSION_50,
+      QUIC_VERSION_46,
+      QUIC_VERSION_43,
+      QUIC_VERSION_RESERVED_FOR_NEGOTIATION,
+      QUIC_VERSION_UNSUPPORTED,
+  };
+  for (size_t i = 0; i < ABSL_ARRAYSIZE(valid_transport_versions); ++i) {
+    if (transport_version == valid_transport_versions[i]) {
+      transport_version_is_valid = true;
+      break;
     }
   }
   if (!transport_version_is_valid) {
@@ -424,16 +417,11 @@
     std::ostream& os,
     const QuicTransportVersionVector& transport_versions);
 
-// Returns a vector of QUIC versions in kSupportedTransportVersions.
-QUIC_EXPORT_PRIVATE QuicTransportVersionVector AllSupportedTransportVersions();
-
-// Returns a vector of QUIC versions that is the cartesian product of
-// kSupportedTransportVersions and kSupportedHandshakeProtocols.
+// Returns a vector of supported QUIC versions.
 QUIC_EXPORT_PRIVATE ParsedQuicVersionVector AllSupportedVersions();
 
-// Returns a vector of QUIC versions that is the cartesian product of
-// kSupportedTransportVersions and kSupportedHandshakeProtocols, with any
-// versions disabled by flags excluded.
+// Returns a vector of supported QUIC versions, with any versions disabled by
+// flags excluded.
 QUIC_EXPORT_PRIVATE ParsedQuicVersionVector CurrentSupportedVersions();
 
 // Returns a vector of QUIC versions from |versions| which exclude any versions
@@ -462,22 +450,10 @@
 QUIC_EXPORT_PRIVATE ParsedQuicVersionVector CurrentSupportedVersionsWithTls();
 
 // Returns QUIC version of |index| in result of |versions|. Returns
-// QUIC_VERSION_UNSUPPORTED if |index| is out of bounds.
-QUIC_EXPORT_PRIVATE QuicTransportVersionVector
-VersionOfIndex(const QuicTransportVersionVector& versions, int index);
-
-// Returns QUIC version of |index| in result of |versions|. Returns
 // UnsupportedQuicVersion() if |index| is out of bounds.
 QUIC_EXPORT_PRIVATE ParsedQuicVersionVector
 ParsedVersionOfIndex(const ParsedQuicVersionVector& versions, int index);
 
-// Returns a vector of QuicTransportVersions corresponding to just the transport
-// versions in |versions|. If the input vector contains multiple parsed versions
-// with different handshake protocols (but the same transport version), that
-// transport version will appear in the resulting vector multiple times.
-QUIC_EXPORT_PRIVATE QuicTransportVersionVector
-ParsedVersionsToTransportVersions(const ParsedQuicVersionVector& versions);
-
 // QuicVersionLabel is written to and read from the wire, but we prefer to use
 // the more readable ParsedQuicVersion at other levels.
 // Helper function which translates from a QuicVersionLabel to a
@@ -498,6 +474,10 @@
 ParseQuicVersionVectorString(absl::string_view versions_string);
 
 // Constructs a QuicVersionLabel from the provided ParsedQuicVersion.
+// QuicVersionLabel is written to and read from the wire, but we prefer to use
+// the more readable ParsedQuicVersion at other levels.
+// Helper function which translates from a ParsedQuicVersion to a
+// QuicVersionLabel. Returns 0 if |parsed_version| is unsupported.
 QUIC_EXPORT_PRIVATE QuicVersionLabel
 CreateQuicVersionLabel(ParsedQuicVersion parsed_version);
 
@@ -506,13 +486,6 @@
 QUIC_EXPORT_PRIVATE QuicVersionLabelVector
 CreateQuicVersionLabelVector(const ParsedQuicVersionVector& versions);
 
-// QuicVersionLabel is written to and read from the wire, but we prefer to use
-// the more readable QuicTransportVersion at other levels.
-// Helper function which translates from a QuicTransportVersion to a
-// QuicVersionLabel. Returns 0 if |version| is unsupported.
-QUIC_EXPORT_PRIVATE QuicVersionLabel
-QuicVersionToQuicVersionLabel(QuicTransportVersion transport_version);
-
 // Helper function which translates from a QuicVersionLabel to a string.
 QUIC_EXPORT_PRIVATE std::string QuicVersionLabelToString(
     QuicVersionLabel version_label);
@@ -533,21 +506,15 @@
                                         std::numeric_limits<size_t>::max());
 }
 
-// Returns appropriate QuicTransportVersion from a QuicVersionLabel.
-// Returns QUIC_VERSION_UNSUPPORTED if |version_label| cannot be understood.
-QUIC_EXPORT_PRIVATE QuicTransportVersion
-QuicVersionLabelToQuicVersion(QuicVersionLabel version_label);
-
-// Returns the HandshakeProtocol used with the given |version_label|, returning
-// PROTOCOL_UNSUPPORTED if it is unknown.
-QUIC_EXPORT_PRIVATE HandshakeProtocol
-QuicVersionLabelToHandshakeProtocol(QuicVersionLabel version_label);
-
 // Helper function which translates from a ParsedQuicVersion to a string.
 // Returns strings corresponding to the on-the-wire tag.
 QUIC_EXPORT_PRIVATE std::string ParsedQuicVersionToString(
     ParsedQuicVersion version);
 
+// Returns a vector of supported QUIC transport versions. DEPRECATED, use
+// AllSupportedVersions instead.
+QUIC_EXPORT_PRIVATE QuicTransportVersionVector AllSupportedTransportVersions();
+
 // Returns comma separated list of string representations of
 // QuicTransportVersion enum values in the supplied |versions| vector.
 QUIC_EXPORT_PRIVATE std::string QuicTransportVersionVectorToString(
diff --git a/quic/core/quic_versions_test.cc b/quic/core/quic_versions_test.cc
index fe4e227..f0f0801 100644
--- a/quic/core/quic_versions_test.cc
+++ b/quic/core/quic_versions_test.cc
@@ -26,32 +26,7 @@
   }
 };
 
-TEST_F(QuicVersionsTest, QuicVersionToQuicVersionLabel) {
-  // If you add a new version to the QuicTransportVersion enum you will need to
-  // add a new case to QuicVersionToQuicVersionLabel, otherwise this test will
-  // fail.
-
-  // Any logs would indicate an unsupported version which we don't expect.
-  CREATE_QUIC_MOCK_LOG(log);
-  EXPECT_QUIC_LOG_CALL(log).Times(0);
-  log.StartCapturingLogs();
-
-  // Explicitly test a specific version.
-  EXPECT_EQ(MakeQuicTag('3', '4', '0', 'Q'),
-            QuicVersionToQuicVersionLabel(QUIC_VERSION_43));
-
-  // Loop over all supported versions and make sure that we never hit the
-  // default case (i.e. all supported versions should be successfully converted
-  // to valid QuicVersionLabels).
-  for (QuicTransportVersion transport_version : SupportedTransportVersions()) {
-    if (!ParsedQuicVersionIsValid(PROTOCOL_QUIC_CRYPTO, transport_version)) {
-      continue;
-    }
-    EXPECT_LT(0u, QuicVersionToQuicVersionLabel(transport_version));
-  }
-}
-
-TEST_F(QuicVersionsTest, QuicVersionToQuicVersionLabelUnsupported) {
+TEST_F(QuicVersionsTest, CreateQuicVersionLabelUnsupported) {
   EXPECT_QUIC_BUG(
       CreateQuicVersionLabel(UnsupportedQuicVersion()),
       "Unsupported version QUIC_VERSION_UNSUPPORTED PROTOCOL_UNSUPPORTED");
@@ -143,63 +118,6 @@
   EXPECT_FALSE(parsed_version_draft_29.UsesQuicCrypto());
 }
 
-TEST_F(QuicVersionsTest, QuicVersionLabelToQuicTransportVersion) {
-  // If you add a new version to the QuicTransportVersion enum you will need to
-  // add a new case to QuicVersionLabelToQuicTransportVersion, otherwise this
-  // test will fail.
-
-  // Any logs would indicate an unsupported version which we don't expect.
-  CREATE_QUIC_MOCK_LOG(log);
-  EXPECT_QUIC_LOG_CALL(log).Times(0);
-  log.StartCapturingLogs();
-
-  // Explicitly test specific versions.
-  EXPECT_EQ(QUIC_VERSION_43,
-            QuicVersionLabelToQuicVersion(MakeQuicTag('3', '4', '0', 'Q')));
-
-  for (QuicTransportVersion transport_version : SupportedTransportVersions()) {
-    if (!ParsedQuicVersionIsValid(PROTOCOL_QUIC_CRYPTO, transport_version)) {
-      continue;
-    }
-
-    // Get the label from the version (we can loop over QuicVersions easily).
-    QuicVersionLabel version_label =
-        QuicVersionToQuicVersionLabel(transport_version);
-    EXPECT_LT(0u, version_label);
-
-    // Now try converting back.
-    QuicTransportVersion label_to_transport_version =
-        QuicVersionLabelToQuicVersion(version_label);
-    EXPECT_EQ(transport_version, label_to_transport_version);
-    EXPECT_NE(QUIC_VERSION_UNSUPPORTED, label_to_transport_version);
-  }
-}
-
-TEST_F(QuicVersionsTest, QuicVersionLabelToQuicVersionUnsupported) {
-  CREATE_QUIC_MOCK_LOG(log);
-  if (QUIC_DLOG_INFO_IS_ON()) {
-    EXPECT_QUIC_LOG_CALL_CONTAINS(log, INFO,
-                                  "Unsupported QuicVersionLabel version: EKAF")
-        .Times(1);
-  }
-  log.StartCapturingLogs();
-
-  EXPECT_EQ(QUIC_VERSION_UNSUPPORTED,
-            QuicVersionLabelToQuicVersion(MakeQuicTag('F', 'A', 'K', 'E')));
-}
-
-TEST_F(QuicVersionsTest, QuicVersionLabelToHandshakeProtocol) {
-  CREATE_QUIC_MOCK_LOG(log);
-  EXPECT_QUIC_LOG_CALL(log).Times(0);
-  log.StartCapturingLogs();
-
-  for (const ParsedQuicVersion& version : AllSupportedVersions()) {
-    QuicVersionLabel version_label = CreateQuicVersionLabel(version);
-    EXPECT_EQ(version.handshake_protocol,
-              QuicVersionLabelToHandshakeProtocol(version_label));
-  }
-}
-
 TEST_F(QuicVersionsTest, ParseQuicVersionLabel) {
   EXPECT_EQ(ParsedQuicVersion::Q043(),
             ParseQuicVersionLabel(MakeVersionLabel('Q', '0', '4', '3')));
@@ -378,9 +296,9 @@
             QuicTransportVersionVectorToString(versions_vector));
 
   // Make sure that all supported versions are present in QuicVersionToString.
-  for (QuicTransportVersion transport_version : SupportedTransportVersions()) {
+  for (const ParsedQuicVersion& version : AllSupportedVersions()) {
     EXPECT_NE("QUIC_VERSION_UNSUPPORTED",
-              QuicVersionToString(transport_version));
+              QuicVersionToString(version.transport_version));
   }
 
   std::ostringstream os;
@@ -444,19 +362,6 @@
             FilterSupportedVersions(AllSupportedVersions()));
 }
 
-TEST_F(QuicVersionsTest, LookUpVersionByIndex) {
-  QuicTransportVersionVector all_versions = {QUIC_VERSION_43};
-  int version_count = all_versions.size();
-  for (int i = -5; i <= version_count + 1; ++i) {
-    QuicTransportVersionVector index = VersionOfIndex(all_versions, i);
-    if (i >= 0 && i < version_count) {
-      EXPECT_EQ(all_versions[i], index[0]);
-    } else {
-      EXPECT_EQ(QUIC_VERSION_UNSUPPORTED, index[0]);
-    }
-  }
-}
-
 TEST_F(QuicVersionsTest, LookUpParsedVersionByIndex) {
   ParsedQuicVersionVector all_versions = AllSupportedVersions();
   int version_count = all_versions.size();
@@ -470,21 +375,11 @@
   }
 }
 
-TEST_F(QuicVersionsTest, ParsedVersionsToTransportVersions) {
-  ParsedQuicVersionVector all_versions = AllSupportedVersions();
-  QuicTransportVersionVector transport_versions =
-      ParsedVersionsToTransportVersions(all_versions);
-  ASSERT_EQ(all_versions.size(), transport_versions.size());
-  for (size_t i = 0; i < all_versions.size(); ++i) {
-    EXPECT_EQ(transport_versions[i], all_versions[i].transport_version);
-  }
-}
-
 // This test may appear to be so simplistic as to be unnecessary,
 // yet a typo was made in doing the #defines and it was caught
 // only in some test far removed from here... Better safe than sorry.
 TEST_F(QuicVersionsTest, CheckTransportVersionNumbersForTypos) {
-  static_assert(SupportedTransportVersions().size() == 5u,
+  static_assert(SupportedVersions().size() == 5u,
                 "Supported versions out of sync");
   EXPECT_EQ(QUIC_VERSION_43, 43);
   EXPECT_EQ(QUIC_VERSION_46, 46);
@@ -516,18 +411,18 @@
 TEST_F(QuicVersionsTest, ReservedForNegotiation) {
   EXPECT_EQ(QUIC_VERSION_RESERVED_FOR_NEGOTIATION,
             QuicVersionReservedForNegotiation().transport_version);
-  // QUIC_VERSION_RESERVED_FOR_NEGOTIATION MUST NOT be added to
-  // kSupportedTransportVersions.
-  for (QuicTransportVersion transport_version : SupportedTransportVersions()) {
-    EXPECT_NE(QUIC_VERSION_RESERVED_FOR_NEGOTIATION, transport_version);
+  // QUIC_VERSION_RESERVED_FOR_NEGOTIATION MUST NOT be supported.
+  for (const ParsedQuicVersion& version : AllSupportedVersions()) {
+    EXPECT_NE(QUIC_VERSION_RESERVED_FOR_NEGOTIATION, version.transport_version);
   }
 }
 
 TEST_F(QuicVersionsTest, SupportedVersionsHasCorrectList) {
   size_t index = 0;
   for (HandshakeProtocol handshake_protocol : SupportedHandshakeProtocols()) {
-    for (QuicTransportVersion transport_version :
-         SupportedTransportVersions()) {
+    for (int trans_vers = 255; trans_vers > 0; trans_vers--) {
+      QuicTransportVersion transport_version =
+          static_cast<QuicTransportVersion>(trans_vers);
       SCOPED_TRACE(index);
       if (ParsedQuicVersionIsValid(handshake_protocol, transport_version)) {
         ParsedQuicVersion version = SupportedVersions()[index];
diff --git a/quic/test_tools/crypto_test_utils.cc b/quic/test_tools/crypto_test_utils.cc
index 960f1d9..8303487 100644
--- a/quic/test_tools/crypto_test_utils.cc
+++ b/quic/test_tools/crypto_test_utils.cc
@@ -452,7 +452,7 @@
   bool ok = false;
   proof_source->GetProof(
       server_address, client_address, "", "",
-      AllSupportedTransportVersions().front(), "",
+      AllSupportedVersionsWithQuicCrypto().front().transport_version, "",
       std::unique_ptr<ProofSource::Callback>(new Callback(&ok, &chain)));
   if (!ok || chain->certs.empty()) {
     DCHECK(false) << "Proof generation failed";
@@ -814,7 +814,8 @@
        {"PUBS", GenerateClientPublicValuesHex().c_str()},
        {"NONC", GenerateClientNonceHex(clock, crypto_config).c_str()},
        {"VER\0", QuicVersionLabelToString(
-           QuicVersionToQuicVersionLabel(version)).c_str()}},
+           CreateQuicVersionLabel(
+            ParsedQuicVersion(PROTOCOL_QUIC_CRYPTO, version))).c_str()}},
       kClientHelloMinimumSize);
   // clang-format on
 }
diff --git a/quic/test_tools/crypto_test_utils_test.cc b/quic/test_tools/crypto_test_utils_test.cc
index 0769da4..e12814b 100644
--- a/quic/test_tools/crypto_test_utils_test.cc
+++ b/quic/test_tools/crypto_test_utils_test.cc
@@ -165,8 +165,9 @@
        {"COPT", "SREJ"},
        {"PUBS", pub_hex},
        {"NONC", nonce_hex},
-       {"VER\0", QuicVersionLabelToString(
-                     QuicVersionToQuicVersionLabel(transport_version))}},
+       {"VER\0",
+        QuicVersionLabelToString(CreateQuicVersionLabel(
+            ParsedQuicVersion(PROTOCOL_QUIC_CRYPTO, transport_version)))}},
       kClientHelloMinimumSize);
 
   crypto_test_utils::GenerateFullCHLO(inchoate_chlo, &crypto_config,
diff --git a/quic/test_tools/fuzzing/quic_framer_process_data_packet_fuzzer.cc b/quic/test_tools/fuzzing/quic_framer_process_data_packet_fuzzer.cc
index 2ceef38..a5f7b74 100644
--- a/quic/test_tools/fuzzing/quic_framer_process_data_packet_fuzzer.cc
+++ b/quic/test_tools/fuzzing/quic_framer_process_data_packet_fuzzer.cc
@@ -48,7 +48,7 @@
 
 PacketHeaderFormat ConsumePacketHeaderFormat(FuzzedDataProvider* provider,
                                              ParsedQuicVersion version) {
-  if (!VersionHasIetfInvariantHeader(version.transport_version)) {
+  if (!version.HasIetfInvariantHeader()) {
     return quic::GOOGLE_QUIC_PACKET;
   }
   return provider->ConsumeBool() ? quic::IETF_QUIC_LONG_HEADER_PACKET
diff --git a/quic/tools/quic_packet_printer_bin.cc b/quic/tools/quic_packet_printer_bin.cc
index f7e05e5..1332cff 100644
--- a/quic/tools/quic_packet_printer_bin.cc
+++ b/quic/tools/quic_packet_printer_bin.cc
@@ -270,13 +270,10 @@
   quic::QuicTime start(quic::QuicTime::Zero());
   quic::QuicFramer framer(versions, start, perspective,
                           quic::kQuicDefaultConnectionIdLength);
-  if (!GetQuicFlag(FLAGS_quic_version).empty()) {
-    for (const quic::ParsedQuicVersion& version : versions) {
-      if (quic::QuicVersionToString(version.transport_version) ==
-          GetQuicFlag(FLAGS_quic_version)) {
-        framer.set_version(version);
-      }
-    }
+  const quic::ParsedQuicVersion& version =
+      quic::ParseQuicVersionString(GetQuicFlag(FLAGS_quic_version));
+  if (version != quic::ParsedQuicVersion::Unsupported()) {
+    framer.set_version(version);
   }
   quic::QuicPacketPrinter visitor(&framer);
   framer.set_visitor(&visitor);