Migration from GFE_BUG_V2 (and friends) to GFE_BUG

Per go/gfe-bug-improvements GFE_BUGs are getting stable IDs to allow for monitoring and alerting. To achieve that, a temporary set of V2 macros was added and the codebase was migrated to using the V2 macros. Now that migration is complete, the old-style (sans _V2) macros were changed to also take bug_id parameter, which makes the V2 set obsolete. To complete the transition, the codebase is being migrated back to GFE_BUG macros. Once done, V2 macros will be removed.

PiperOrigin-RevId: 363279776
Change-Id: I887914dbf69be02d3b7a2d11031f8bf8af928a6a
diff --git a/quic/core/tls_chlo_extractor.cc b/quic/core/tls_chlo_extractor.cc
index d11b95c..ae85b07 100644
--- a/quic/core/tls_chlo_extractor.cc
+++ b/quic/core/tls_chlo_extractor.cc
@@ -129,8 +129,8 @@
 bool TlsChloExtractor::OnProtocolVersionMismatch(ParsedQuicVersion version) {
   // This should never be called because we already check versions in
   // IngestPacket.
-  QUIC_BUG_V2(quic_bug_10855_1) << "Unexpected version mismatch, expected "
-                                << framer_->version() << ", got " << version;
+  QUIC_BUG(quic_bug_10855_1) << "Unexpected version mismatch, expected "
+                             << framer_->version() << ", got " << version;
   return false;
 }
 
@@ -156,7 +156,7 @@
   if (frame.level != ENCRYPTION_INITIAL) {
     // Since we drop non-INITIAL packets in OnUnauthenticatedPublicHeader,
     // we should never receive any CRYPTO frames at other encryption levels.
-    QUIC_BUG_V2(quic_bug_10855_2) << "Parsed bad-level CRYPTO frame " << frame;
+    QUIC_BUG(quic_bug_10855_2) << "Parsed bad-level CRYPTO frame " << frame;
     return false;
   }
   // parsed_crypto_frame_in_this_packet_ is checked in IngestPacket to allow
@@ -242,7 +242,7 @@
     const std::string& callback_name) {
   std::string error_details =
       absl::StrCat("Unexpected callback ", callback_name);
-  QUIC_BUG_V2(quic_bug_10855_3) << error_details;
+  QUIC_BUG(quic_bug_10855_3) << error_details;
   HandleUnrecoverableError(error_details);
 }
 
@@ -311,7 +311,7 @@
   } else if (state_ == State::kParsedPartialChloFragment) {
     state_ = State::kParsedFullMultiPacketChlo;
   } else {
-    QUIC_BUG_V2(quic_bug_10855_4)
+    QUIC_BUG(quic_bug_10855_4)
         << "Unexpected state on successful parse " << StateToString(state_);
   }
 }
diff --git a/quic/core/tls_client_handshaker.cc b/quic/core/tls_client_handshaker.cc
index f3e404b..b157500 100644
--- a/quic/core/tls_client_handshaker.cc
+++ b/quic/core/tls_client_handshaker.cc
@@ -58,7 +58,7 @@
     // TODO(b/154162689) add PSK support to QUIC+TLS.
     std::string error_details =
         "QUIC client pre-shared keys not yet supported with TLS";
-    QUIC_BUG_V2(quic_bug_10576_1) << error_details;
+    QUIC_BUG(quic_bug_10576_1) << error_details;
     CloseConnection(QUIC_HANDSHAKE_FAILED, error_details);
     return false;
   }
@@ -116,7 +116,7 @@
       handshaker_delegate()->ProcessTransportParameters(
           *(cached_state->transport_params),
           /*is_resumption = */ true, &error_details) != QUIC_NO_ERROR) {
-    QUIC_BUG_V2(quic_bug_10576_2)
+    QUIC_BUG(quic_bug_10576_2)
         << "Unable to parse cached transport parameters.";
     CloseConnection(QUIC_HANDSHAKE_FAILED,
                     "Client failed to parse cached Transport Parameters.");
@@ -131,8 +131,7 @@
     if (!cached_state->application_state ||
         !session()->ResumeApplicationState(
             cached_state->application_state.get())) {
-      QUIC_BUG_V2(quic_bug_10576_3)
-          << "Unable to parse cached application state.";
+      QUIC_BUG(quic_bug_10576_3) << "Unable to parse cached application state.";
       CloseConnection(QUIC_HANDSHAKE_FAILED,
                       "Client failed to parse cached application state.");
       return false;
@@ -152,11 +151,11 @@
       return true;
     }
 
-    QUIC_BUG_V2(quic_bug_10576_4) << "ALPN missing";
+    QUIC_BUG(quic_bug_10576_4) << "ALPN missing";
     return false;
   }
   if (!std::all_of(alpns.begin(), alpns.end(), IsValidAlpn)) {
-    QUIC_BUG_V2(quic_bug_10576_5) << "ALPN too long";
+    QUIC_BUG(quic_bug_10576_5) << "ALPN too long";
     return false;
   }
 
@@ -172,7 +171,7 @@
   success =
       success && (SSL_set_alpn_protos(ssl(), alpn, alpn_writer.length()) == 0);
   if (!success) {
-    QUIC_BUG_V2(quic_bug_10576_6)
+    QUIC_BUG(quic_bug_10576_6)
         << "Failed to set ALPN: "
         << quiche::QuicheTextUtils::HexDump(
                absl::string_view(alpn_writer.data(), alpn_writer.length()));
@@ -189,7 +188,7 @@
       if (SSL_add_application_settings(
               ssl(), reinterpret_cast<const uint8_t*>(alpn_string.data()),
               alpn_string.size(), nullptr, /* settings_len = */ 0) != 1) {
-        QUIC_BUG_V2(quic_bug_10576_7) << "Failed to enable ALPS.";
+        QUIC_BUG(quic_bug_10576_7) << "Failed to enable ALPS.";
         return false;
       }
     }
@@ -288,12 +287,12 @@
 }
 
 bool TlsClientHandshaker::IsResumption() const {
-  QUIC_BUG_IF_V2(quic_bug_12736_1, !one_rtt_keys_available());
+  QUIC_BUG_IF(quic_bug_12736_1, !one_rtt_keys_available());
   return SSL_session_reused(ssl()) == 1;
 }
 
 bool TlsClientHandshaker::EarlyDataAccepted() const {
-  QUIC_BUG_IF_V2(quic_bug_12736_2, !one_rtt_keys_available());
+  QUIC_BUG_IF(quic_bug_12736_2, !one_rtt_keys_available());
   return SSL_early_data_accepted(ssl()) == 1;
 }
 
@@ -302,7 +301,7 @@
 }
 
 bool TlsClientHandshaker::ReceivedInchoateReject() const {
-  QUIC_BUG_IF_V2(quic_bug_12736_3, !one_rtt_keys_available());
+  QUIC_BUG_IF(quic_bug_12736_3, !one_rtt_keys_available());
   // REJ messages are a QUIC crypto feature, so TLS always returns false.
   return false;
 }
@@ -556,7 +555,7 @@
 
 void TlsClientHandshaker::InsertSession(bssl::UniquePtr<SSL_SESSION> session) {
   if (!received_transport_params_) {
-    QUIC_BUG_V2(quic_bug_10576_8) << "Transport parameters isn't received";
+    QUIC_BUG(quic_bug_10576_8) << "Transport parameters isn't received";
     return;
   }
   if (session_cache_ == nullptr) {
diff --git a/quic/core/tls_handshaker.cc b/quic/core/tls_handshaker.cc
index b76fbcc..56110c7 100644
--- a/quic/core/tls_handshaker.cc
+++ b/quic/core/tls_handshaker.cc
@@ -251,7 +251,7 @@
       one_rtt_read_header_protection_key_.empty() ||
       one_rtt_write_header_protection_key_.empty()) {
     std::string error_details = "1-RTT secret(s) not set yet.";
-    QUIC_BUG_V2(quic_bug_10312_1) << error_details;
+    QUIC_BUG(quic_bug_10312_1) << error_details;
     CloseConnection(QUIC_INTERNAL_ERROR, error_details);
     return nullptr;
   }
@@ -276,7 +276,7 @@
   if (latest_write_secret_.empty() ||
       one_rtt_write_header_protection_key_.empty()) {
     std::string error_details = "1-RTT write secret not set yet.";
-    QUIC_BUG_V2(quic_bug_10312_2) << error_details;
+    QUIC_BUG(quic_bug_10312_2) << error_details;
     CloseConnection(QUIC_INTERNAL_ERROR, error_details);
     return nullptr;
   }
diff --git a/quic/core/tls_server_handshaker.cc b/quic/core/tls_server_handshaker.cc
index d21be71..cc536e7 100644
--- a/quic/core/tls_server_handshaker.cc
+++ b/quic/core/tls_server_handshaker.cc
@@ -64,7 +64,7 @@
     const std::vector<uint8_t>& /*quic_transport_params*/,
     const absl::optional<std::vector<uint8_t>>& /*early_data_context*/) {
   if (!handshaker_ || !proof_source_) {
-    QUIC_BUG_V2(quic_bug_10341_1)
+    QUIC_BUG(quic_bug_10341_1)
         << "SelectCertificate called on a detached handle";
     return QUIC_FAILURE;
   }
@@ -75,7 +75,7 @@
   handshaker_->OnSelectCertificateDone(
       /*ok=*/true, /*is_sync=*/true, chain.get());
   if (!handshaker_->select_cert_status().has_value()) {
-    QUIC_BUG_V2(quic_bug_12423_1)
+    QUIC_BUG(quic_bug_12423_1)
         << "select_cert_status() has no value after a synchronous select cert";
     // Return success to continue the handshake.
     return QUIC_SUCCESS;
@@ -91,13 +91,13 @@
     absl::string_view in,
     size_t max_signature_size) {
   if (!handshaker_ || !proof_source_) {
-    QUIC_BUG_V2(quic_bug_10341_2)
+    QUIC_BUG(quic_bug_10341_2)
         << "ComputeSignature called on a detached handle";
     return QUIC_FAILURE;
   }
 
   if (signature_callback_) {
-    QUIC_BUG_V2(quic_bug_10341_3) << "ComputeSignature called while pending";
+    QUIC_BUG(quic_bug_10341_3) << "ComputeSignature called while pending";
     return QUIC_FAILURE;
   }
 
@@ -500,7 +500,7 @@
     std::vector<uint8_t> early_data_context;
     if (!SerializeTransportParametersForTicket(
             server_params, *application_state_, &early_data_context)) {
-      QUIC_BUG_V2(quic_bug_10341_4)
+      QUIC_BUG(quic_bug_10341_4)
           << "Failed to serialize Transport Parameters for ticket.";
       result.early_data_context = std::vector<uint8_t>();
       return result;
@@ -582,7 +582,7 @@
     std::unique_ptr<ProofVerifyDetails>* /*details*/,
     uint8_t* /*out_alert*/,
     std::unique_ptr<ProofVerifierCallback> /*callback*/) {
-  QUIC_BUG_V2(quic_bug_10341_5)
+  QUIC_BUG(quic_bug_10341_5)
       << "Client certificates are not yet supported on the server";
   return QUIC_FAILURE;
 }
@@ -700,7 +700,7 @@
   QUICHE_DCHECK(proof_source_->GetTicketCrypter());
   std::vector<uint8_t> ticket = proof_source_->GetTicketCrypter()->Encrypt(in);
   if (max_out_len < ticket.size()) {
-    QUIC_BUG_V2(quic_bug_12423_2)
+    QUIC_BUG(quic_bug_12423_2)
         << "TicketCrypter returned " << ticket.size()
         << " bytes of ciphertext, which is larger than its max overhead of "
         << max_out_len;
@@ -811,7 +811,7 @@
 
   if (!pre_shared_key_.empty()) {
     // TODO(b/154162689) add PSK support to QUIC+TLS.
-    QUIC_BUG_V2(quic_bug_10341_6)
+    QUIC_BUG(quic_bug_10341_6)
         << "QUIC server pre-shared keys not yet supported with TLS";
     return ssl_select_cert_error;
   }
diff --git a/quic/core/uber_received_packet_manager.cc b/quic/core/uber_received_packet_manager.cc
index 9c3c003..5ed0e08 100644
--- a/quic/core/uber_received_packet_manager.cc
+++ b/quic/core/uber_received_packet_manager.cc
@@ -108,12 +108,12 @@
 void UberReceivedPacketManager::EnableMultiplePacketNumberSpacesSupport(
     Perspective perspective) {
   if (supports_multiple_packet_number_spaces_) {
-    QUIC_BUG_V2(quic_bug_10495_1)
+    QUIC_BUG(quic_bug_10495_1)
         << "Multiple packet number spaces has already been enabled";
     return;
   }
   if (received_packet_managers_[0].GetLargestObserved().IsInitialized()) {
-    QUIC_BUG_V2(quic_bug_10495_2)
+    QUIC_BUG(quic_bug_10495_2)
         << "Try to enable multiple packet number spaces support after any "
            "packet has been received.";
     return;
@@ -238,7 +238,7 @@
 void UberReceivedPacketManager::OnAckFrequencyFrame(
     const QuicAckFrequencyFrame& frame) {
   if (!supports_multiple_packet_number_spaces_) {
-    QUIC_BUG_V2(quic_bug_10495_3)
+    QUIC_BUG(quic_bug_10495_3)
         << "Received AckFrequencyFrame when multiple packet number spaces "
            "is not supported";
     return;