Delete Role from MoQT.

PiperOrigin-RevId: 721846494
diff --git a/quiche/quic/moqt/moqt_framer.cc b/quiche/quic/moqt/moqt_framer.cc
index f4bbe47..e06183a 100644
--- a/quiche/quic/moqt/moqt_framer.cc
+++ b/quiche/quic/moqt/moqt_framer.cc
@@ -376,10 +376,6 @@
     const MoqtClientSetup& message) {
   absl::InlinedVector<IntParameter, 1> int_parameters;
   absl::InlinedVector<StringParameter, 1> string_parameters;
-  if (message.role.has_value()) {
-    int_parameters.push_back(
-        IntParameter(MoqtSetupParameter::kRole, *message.role));
-  }
   if (message.max_subscribe_id.has_value()) {
     int_parameters.push_back(IntParameter(MoqtSetupParameter::kMaxSubscribeId,
                                           *message.max_subscribe_id));
@@ -404,10 +400,6 @@
 quiche::QuicheBuffer MoqtFramer::SerializeServerSetup(
     const MoqtServerSetup& message) {
   absl::InlinedVector<IntParameter, 1> int_parameters;
-  if (message.role.has_value()) {
-    int_parameters.push_back(
-        IntParameter(MoqtSetupParameter::kRole, *message.role));
-  }
   if (message.max_subscribe_id.has_value()) {
     int_parameters.push_back(IntParameter(MoqtSetupParameter::kMaxSubscribeId,
                                           *message.max_subscribe_id));
diff --git a/quiche/quic/moqt/moqt_messages.h b/quiche/quic/moqt/moqt_messages.h
index 4fa07e6..e022e28 100644
--- a/quiche/quic/moqt/moqt_messages.h
+++ b/quiche/quic/moqt/moqt_messages.h
@@ -133,13 +133,6 @@
     0x01;
 inline constexpr webtransport::StreamErrorCode kResetCodeTimedOut = 0x02;
 
-enum class QUICHE_EXPORT MoqtRole : uint64_t {
-  kPublisher = 0x1,
-  kSubscriber = 0x2,
-  kPubSub = 0x3,
-  kRoleMax = 0x3,
-};
-
 enum class QUICHE_EXPORT MoqtSetupParameter : uint64_t {
   kRole = 0x0,
   kPath = 0x1,
@@ -319,7 +312,6 @@
 
 struct QUICHE_EXPORT MoqtClientSetup {
   std::vector<MoqtVersion> supported_versions;
-  std::optional<MoqtRole> role;
   std::optional<std::string> path;
   std::optional<uint64_t> max_subscribe_id;
   bool supports_object_ack = false;
@@ -327,7 +319,6 @@
 
 struct QUICHE_EXPORT MoqtServerSetup {
   MoqtVersion selected_version;
-  std::optional<MoqtRole> role;
   std::optional<uint64_t> max_subscribe_id;
   bool supports_object_ack = false;
 };
diff --git a/quiche/quic/moqt/moqt_parser.cc b/quiche/quic/moqt/moqt_parser.cc
index 4253209..d1ab1f2 100644
--- a/quiche/quic/moqt/moqt_parser.cc
+++ b/quiche/quic/moqt/moqt_parser.cc
@@ -259,21 +259,6 @@
     }
     auto key = static_cast<MoqtSetupParameter>(type);
     switch (key) {
-      case MoqtSetupParameter::kRole:
-        if (setup.role.has_value()) {
-          ParseError("ROLE parameter appears twice in SETUP");
-          return 0;
-        }
-        uint64_t index;
-        if (!StringViewToVarInt(value, index)) {
-          return 0;
-        }
-        if (index > static_cast<uint64_t>(MoqtRole::kRoleMax)) {
-          ParseError("Invalid ROLE parameter");
-          return 0;
-        }
-        setup.role = static_cast<MoqtRole>(index);
-        break;
       case MoqtSetupParameter::kPath:
         if (uses_web_transport_) {
           ParseError(
@@ -311,10 +296,6 @@
         break;
     }
   }
-  if (!setup.role.has_value()) {
-    ParseError("ROLE parameter missing from CLIENT_SETUP message");
-    return 0;
-  }
   if (!uses_web_transport_ && !setup.path.has_value()) {
     ParseError("PATH SETUP parameter missing from Client message over QUIC");
     return 0;
@@ -343,21 +324,6 @@
     }
     auto key = static_cast<MoqtSetupParameter>(type);
     switch (key) {
-      case MoqtSetupParameter::kRole:
-        if (setup.role.has_value()) {
-          ParseError("ROLE parameter appears twice in SETUP");
-          return 0;
-        }
-        uint64_t index;
-        if (!StringViewToVarInt(value, index)) {
-          return 0;
-        }
-        if (index > static_cast<uint64_t>(MoqtRole::kRoleMax)) {
-          ParseError("Invalid ROLE parameter");
-          return 0;
-        }
-        setup.role = static_cast<MoqtRole>(index);
-        break;
       case MoqtSetupParameter::kPath:
         ParseError("PATH parameter in SERVER_SETUP");
         return 0;
@@ -386,10 +352,6 @@
         break;
     }
   }
-  if (!setup.role.has_value()) {
-    ParseError("ROLE parameter missing from SERVER_SETUP message");
-    return 0;
-  }
   visitor_.OnServerSetupMessage(setup);
   return reader.PreviouslyReadPayload().length();
 }
diff --git a/quiche/quic/moqt/moqt_parser_test.cc b/quiche/quic/moqt/moqt_parser_test.cc
index 6293f82..dc2b0c2 100644
--- a/quiche/quic/moqt/moqt_parser_test.cc
+++ b/quiche/quic/moqt/moqt_parser_test.cc
@@ -523,73 +523,11 @@
   EXPECT_FALSE(visitor_.parsing_error_.has_value());
 }
 
-TEST_F(MoqtMessageSpecificTest, ClientSetupRoleIsInvalid) {
-  MoqtControlParser parser(kRawQuic, visitor_);
-  char setup[] = {
-      0x40, 0x40, 0x0c, 0x02, 0x01, 0x02,  // versions
-      0x03,                                // 3 params
-      0x00, 0x01, 0x04,                    // role = invalid
-      0x01, 0x03, 0x66, 0x6f, 0x6f         // path = "foo"
-  };
-  parser.ProcessData(absl::string_view(setup, sizeof(setup)), false);
-  EXPECT_EQ(visitor_.messages_received_, 0);
-  EXPECT_TRUE(visitor_.parsing_error_.has_value());
-  EXPECT_EQ(*visitor_.parsing_error_, "Invalid ROLE parameter");
-  EXPECT_EQ(visitor_.parsing_error_code_, MoqtError::kProtocolViolation);
-}
-
-TEST_F(MoqtMessageSpecificTest, ServerSetupRoleIsInvalid) {
-  MoqtControlParser parser(kRawQuic, visitor_);
-  char setup[] = {
-      0x40, 0x41, 0x0a, 0x01,
-      0x01,                         // 1 param
-      0x00, 0x01, 0x04,             // role = invalid
-      0x01, 0x03, 0x66, 0x6f, 0x6f  // path = "foo"
-  };
-  parser.ProcessData(absl::string_view(setup, sizeof(setup)), false);
-  EXPECT_EQ(visitor_.messages_received_, 0);
-  EXPECT_TRUE(visitor_.parsing_error_.has_value());
-  EXPECT_EQ(*visitor_.parsing_error_, "Invalid ROLE parameter");
-  EXPECT_EQ(visitor_.parsing_error_code_, MoqtError::kProtocolViolation);
-}
-
-TEST_F(MoqtMessageSpecificTest, SetupRoleAppearsTwice) {
+TEST_F(MoqtMessageSpecificTest, ClientSetupMaxSubscribeIdAppearsTwice) {
   MoqtControlParser parser(kRawQuic, visitor_);
   char setup[] = {
       0x40, 0x40, 0x0f, 0x02, 0x01, 0x02,  // versions
       0x03,                                // 3 params
-      0x00, 0x01, 0x03,                    // role = PubSub
-      0x00, 0x01, 0x03,                    // role = PubSub
-      0x01, 0x03, 0x66, 0x6f, 0x6f         // path = "foo"
-  };
-  parser.ProcessData(absl::string_view(setup, sizeof(setup)), false);
-  EXPECT_EQ(visitor_.messages_received_, 0);
-  EXPECT_TRUE(visitor_.parsing_error_.has_value());
-  EXPECT_EQ(*visitor_.parsing_error_, "ROLE parameter appears twice in SETUP");
-  EXPECT_EQ(visitor_.parsing_error_code_, MoqtError::kProtocolViolation);
-}
-
-TEST_F(MoqtMessageSpecificTest, ClientSetupRoleIsMissing) {
-  MoqtControlParser parser(kRawQuic, visitor_);
-  char setup[] = {
-      0x40, 0x40, 0x09, 0x02, 0x01, 0x02,  // versions = 1, 2
-      0x01,                                // 1 param
-      0x01, 0x03, 0x66, 0x6f, 0x6f,        // path = "foo"
-  };
-  parser.ProcessData(absl::string_view(setup, sizeof(setup)), false);
-  EXPECT_EQ(visitor_.messages_received_, 0);
-  EXPECT_TRUE(visitor_.parsing_error_.has_value());
-  EXPECT_EQ(*visitor_.parsing_error_,
-            "ROLE parameter missing from CLIENT_SETUP message");
-  EXPECT_EQ(visitor_.parsing_error_code_, MoqtError::kProtocolViolation);
-}
-
-TEST_F(MoqtMessageSpecificTest, ClientSetupMaxSubscribeIdAppearsTwice) {
-  MoqtControlParser parser(kRawQuic, visitor_);
-  char setup[] = {
-      0x40, 0x40, 0x12, 0x02, 0x01, 0x02,  // versions
-      0x04,                                // 4 params
-      0x00, 0x01, 0x03,                    // role = PubSub
       0x01, 0x03, 0x66, 0x6f, 0x6f,        // path = "foo"
       0x02, 0x01, 0x32,                    // max_subscribe_id = 50
       0x02, 0x01, 0x32,                    // max_subscribe_id = 50
@@ -602,37 +540,6 @@
   EXPECT_EQ(visitor_.parsing_error_code_, MoqtError::kProtocolViolation);
 }
 
-TEST_F(MoqtMessageSpecificTest, ServerSetupRoleIsMissing) {
-  MoqtControlParser parser(kRawQuic, visitor_);
-  char setup[] = {
-      0x40, 0x41, 0x02, 0x01, 0x00,  // 1 param
-  };
-  parser.ProcessData(absl::string_view(setup, sizeof(setup)), false);
-  EXPECT_EQ(visitor_.messages_received_, 0);
-  EXPECT_TRUE(visitor_.parsing_error_.has_value());
-  EXPECT_EQ(*visitor_.parsing_error_,
-            "ROLE parameter missing from SERVER_SETUP message");
-  EXPECT_EQ(visitor_.parsing_error_code_, MoqtError::kProtocolViolation);
-}
-
-TEST_F(MoqtMessageSpecificTest, SetupRoleVarintLengthIsWrong) {
-  MoqtControlParser parser(kRawQuic, visitor_);
-  char setup[] = {
-      0x40, 0x40, 0x0c,             // type
-      0x02, 0x01, 0x02,             // versions
-      0x02,                         // 2 parameters
-      0x00, 0x02, 0x03,             // role = PubSub, but length is 2
-      0x01, 0x03, 0x66, 0x6f, 0x6f  // path = "foo"
-  };
-  parser.ProcessData(absl::string_view(setup, sizeof(setup)), false);
-  EXPECT_EQ(visitor_.messages_received_, 0);
-  EXPECT_TRUE(visitor_.parsing_error_.has_value());
-  EXPECT_EQ(*visitor_.parsing_error_,
-            "Parameter length does not match varint encoding");
-
-  EXPECT_EQ(visitor_.parsing_error_code_, MoqtError::kParameterLengthMismatch);
-}
-
 TEST_F(MoqtMessageSpecificTest, SetupPathFromServer) {
   MoqtControlParser parser(kRawQuic, visitor_);
   char setup[] = {
@@ -651,9 +558,8 @@
 TEST_F(MoqtMessageSpecificTest, SetupPathAppearsTwice) {
   MoqtControlParser parser(kRawQuic, visitor_);
   char setup[] = {
-      0x40, 0x40, 0x11, 0x02, 0x01, 0x02,  // versions = 1, 2
-      0x03,                                // 3 params
-      0x00, 0x01, 0x03,                    // role = PubSub
+      0x40, 0x40, 0x0e, 0x02, 0x01, 0x02,  // versions = 1, 2
+      0x02,                                // 2 params
       0x01, 0x03, 0x66, 0x6f, 0x6f,        // path = "foo"
       0x01, 0x03, 0x66, 0x6f, 0x6f,        // path = "foo"
   };
@@ -668,9 +574,8 @@
 TEST_F(MoqtMessageSpecificTest, SetupPathOverWebtrans) {
   MoqtControlParser parser(kWebTrans, visitor_);
   char setup[] = {
-      0x40, 0x40, 0x0b, 0x02, 0x01, 0x02,  // versions = 1, 2
-      0x02,                                // 2 params
-      0x00, 0x01, 0x03,                    // role = PubSub
+      0x40, 0x40, 0x09, 0x02, 0x01, 0x02,  // versions = 1, 2
+      0x01,                                // 1 param
       0x01, 0x03, 0x66, 0x6f, 0x6f,        // path = "foo"
   };
   parser.ProcessData(absl::string_view(setup, sizeof(setup)), false);
@@ -684,9 +589,8 @@
 TEST_F(MoqtMessageSpecificTest, SetupPathMissing) {
   MoqtControlParser parser(kRawQuic, visitor_);
   char setup[] = {
-      0x40, 0x40, 0x07, 0x02, 0x01, 0x02,  // versions = 1, 2
-      0x01,                                // 1 param
-      0x00, 0x01, 0x03,                    // role = PubSub
+      0x40, 0x40, 0x04, 0x02, 0x01, 0x02,  // versions = 1, 2
+      0x00,                                // no param
   };
   parser.ProcessData(absl::string_view(setup, sizeof(setup)), false);
   EXPECT_EQ(visitor_.messages_received_, 0);
@@ -699,9 +603,8 @@
 TEST_F(MoqtMessageSpecificTest, ServerSetupMaxSubscribeIdAppearsTwice) {
   MoqtControlParser parser(kRawQuic, visitor_);
   char setup[] = {
-      0x40, 0x40, 0x12, 0x02, 0x01, 0x02,  // versions = 1, 2
-      0x04,                                // 4 params
-      0x00, 0x01, 0x03,                    // role = PubSub
+      0x40, 0x40, 0x0f, 0x02, 0x01, 0x02,  // versions = 1, 2
+      0x03,                                // 4 params
       0x01, 0x03, 0x66, 0x6f, 0x6f,        // path = "foo"
       0x02, 0x01, 0x32,                    // max_subscribe_id = 50
       0x02, 0x01, 0x32,                    // max_subscribe_id = 50
diff --git a/quiche/quic/moqt/moqt_session.cc b/quiche/quic/moqt/moqt_session.cc
index 9f28960..6d5e4d7 100644
--- a/quiche/quic/moqt/moqt_session.cc
+++ b/quiche/quic/moqt/moqt_session.cc
@@ -147,7 +147,6 @@
   control_stream_ = control_stream->GetStreamId();
   MoqtClientSetup setup = MoqtClientSetup{
       .supported_versions = std::vector<MoqtVersion>{parameters_.version},
-      .role = MoqtRole::kPubSub,
       .max_subscribe_id = parameters_.max_subscribe_id,
       .supports_object_ack = parameters_.support_object_acks,
   };
@@ -244,11 +243,6 @@
     FullTrackName track_namespace,
     MoqtOutgoingSubscribeAnnouncesCallback callback,
     MoqtSubscribeParameters parameters) {
-  if (peer_role_ == MoqtRole::kSubscriber) {
-    std::move(callback)(track_namespace, SubscribeErrorCode::kInternalError,
-                        "SUBSCRIBE_ANNOUNCES cannot be sent to subscriber");
-    return false;
-  }
   MoqtSubscribeAnnounces message;
   message.track_namespace = track_namespace;
   message.parameters = std::move(parameters);
@@ -274,13 +268,6 @@
 
 void MoqtSession::Announce(FullTrackName track_namespace,
                            MoqtOutgoingAnnounceCallback announce_callback) {
-  if (peer_role_ == MoqtRole::kPublisher) {
-    std::move(announce_callback)(
-        track_namespace,
-        MoqtAnnounceErrorReason{MoqtAnnounceErrorCode::kInternalError,
-                                "ANNOUNCE cannot be sent to Publisher"});
-    return;
-  }
   if (outgoing_announces_.contains(track_namespace)) {
     std::move(announce_callback)(
         track_namespace,
@@ -314,9 +301,6 @@
 void MoqtSession::CancelAnnounce(FullTrackName track_namespace,
                                  MoqtAnnounceErrorCode code,
                                  absl::string_view reason) {
-  if (peer_role_ == MoqtRole::kSubscriber) {
-    return;
-  }
   MoqtAnnounceCancel message{track_namespace, code, std::string(reason)};
 
   SendControlMessage(framer_.SerializeAnnounceCancel(message));
@@ -438,10 +422,6 @@
                         MoqtPriority priority,
                         std::optional<MoqtDeliveryOrder> delivery_order,
                         MoqtSubscribeParameters parameters) {
-  if (peer_role_ == MoqtRole::kSubscriber) {
-    QUIC_DLOG(INFO) << ENDPOINT << "Tried to send FETCH to subscriber peer";
-    return false;
-  }
   // TODO(martinduke): support authorization info
   if (next_subscribe_id_ >= peer_max_subscribe_id_) {
     QUIC_DLOG(INFO) << ENDPOINT << "Tried to send FETCH with ID "
@@ -542,10 +522,6 @@
 bool MoqtSession::Subscribe(MoqtSubscribe& message,
                             SubscribeRemoteTrack::Visitor* visitor,
                             std::optional<uint64_t> provided_track_alias) {
-  if (peer_role_ == MoqtRole::kSubscriber) {
-    QUIC_DLOG(INFO) << ENDPOINT << "Tried to send SUBSCRIBE to subscriber peer";
-    return false;
-  }
   // TODO(martinduke): support authorization info
   if (next_subscribe_id_ >= peer_max_subscribe_id_) {
     QUIC_DLOG(INFO) << ENDPOINT << "Tried to send SUBSCRIBE with ID "
@@ -729,11 +705,6 @@
 }
 
 bool MoqtSession::ValidateSubscribeId(uint64_t subscribe_id) {
-  if (peer_role_ == MoqtRole::kPublisher) {
-    QUIC_DLOG(INFO) << ENDPOINT << "Publisher peer sent SUBSCRIBE";
-    Error(MoqtError::kProtocolViolation, "Received SUBSCRIBE from publisher");
-    return false;
-  }
   if (subscribe_id >= local_max_subscribe_id_) {
     QUIC_DLOG(INFO) << ENDPOINT << "Received SUBSCRIBE with too large ID";
     Error(MoqtError::kTooManySubscribes,
@@ -812,18 +783,16 @@
   if (session_->parameters_.perspective == Perspective::IS_SERVER) {
     MoqtServerSetup response;
     response.selected_version = session_->parameters_.version;
-    response.role = MoqtRole::kPubSub;
     response.max_subscribe_id = session_->parameters_.max_subscribe_id;
     response.supports_object_ack = session_->parameters_.support_object_acks;
     SendOrBufferMessage(session_->framer_.SerializeServerSetup(response));
     QUIC_DLOG(INFO) << ENDPOINT << "Sent the SETUP message";
   }
-  // TODO: handle role and path.
+  // TODO: handle path.
   if (message.max_subscribe_id.has_value()) {
     session_->peer_max_subscribe_id_ = *message.max_subscribe_id;
   }
   std::move(session_->callbacks_.session_established_callback)();
-  session_->peer_role_ = *message.role;
 }
 
 void MoqtSession::ControlStream::OnServerSetupMessage(
@@ -842,12 +811,11 @@
   }
   session_->peer_supports_object_ack_ = message.supports_object_ack;
   QUIC_DLOG(INFO) << ENDPOINT << "Received the SETUP message";
-  // TODO: handle role and path.
+  // TODO: handle path.
   if (message.max_subscribe_id.has_value()) {
     session_->peer_max_subscribe_id_ = *message.max_subscribe_id;
   }
   std::move(session_->callbacks_.session_established_callback)();
-  session_->peer_role_ = *message.role;
 }
 
 void MoqtSession::ControlStream::SendSubscribeError(
@@ -1040,12 +1008,6 @@
 
 void MoqtSession::ControlStream::OnAnnounceMessage(
     const MoqtAnnounce& message) {
-  if (session_->peer_role_ == MoqtRole::kSubscriber) {
-    QUIC_DLOG(INFO) << ENDPOINT << "Subscriber peer sent SUBSCRIBE";
-    session_->Error(MoqtError::kProtocolViolation,
-                    "Received ANNOUNCE from Subscriber");
-    return;
-  }
   std::optional<MoqtAnnounceErrorReason> error =
       session_->callbacks_.incoming_announce_callback(message.track_namespace,
                                                       AnnounceEvent::kAnnounce);
@@ -1172,12 +1134,6 @@
 
 void MoqtSession::ControlStream::OnMaxSubscribeIdMessage(
     const MoqtMaxSubscribeId& message) {
-  if (session_->peer_role_ == MoqtRole::kSubscriber) {
-    QUIC_DLOG(INFO) << ENDPOINT << "Subscriber peer sent MAX_SUBSCRIBE_ID";
-    session_->Error(MoqtError::kProtocolViolation,
-                    "Received MAX_SUBSCRIBE_ID from Subscriber");
-    return;
-  }
   if (message.max_subscribe_id < session_->peer_max_subscribe_id_) {
     QUIC_DLOG(INFO) << ENDPOINT
                     << "Peer sent MAX_SUBSCRIBE_ID message with "
diff --git a/quiche/quic/moqt/moqt_session.h b/quiche/quic/moqt/moqt_session.h
index 864e0de..be9800c 100644
--- a/quiche/quic/moqt/moqt_session.h
+++ b/quiche/quic/moqt/moqt_session.h
@@ -671,11 +671,6 @@
   absl::flat_hash_map<FullTrackName, MoqtOutgoingSubscribeAnnouncesCallback>
       outgoing_subscribe_announces_;
 
-  // The role the peer advertised in its SETUP message. Initialize it to avoid
-  // an uninitialized value if no SETUP arrives or it arrives with no Role
-  // parameter, and other checks have changed/been disabled.
-  MoqtRole peer_role_ = MoqtRole::kPubSub;
-
   // The minimum subscribe ID the peer can use that is monotonically increasing.
   uint64_t next_incoming_subscribe_id_ = 0;
   // The maximum subscribe ID sent to the peer. Peer-generated IDs must be less
diff --git a/quiche/quic/moqt/moqt_session_test.cc b/quiche/quic/moqt/moqt_session_test.cc
index 53e2d87..5230311 100644
--- a/quiche/quic/moqt/moqt_session_test.cc
+++ b/quiche/quic/moqt/moqt_session_test.cc
@@ -135,7 +135,6 @@
   // Handle the server setup
   MoqtServerSetup setup = {
       kDefaultMoqtVersion,
-      MoqtRole::kPubSub,
   };
   EXPECT_CALL(session_callbacks_.session_established_callback, Call()).Times(1);
   stream_input->OnServerSetupMessage(setup);
@@ -150,7 +149,6 @@
       MoqtSessionPeer::CreateControlStream(&server_session, &mock_stream);
   MoqtClientSetup setup = {
       /*supported_versions=*/{kDefaultMoqtVersion},
-      /*role=*/MoqtRole::kPubSub,
       /*path=*/std::nullopt,
   };
   EXPECT_CALL(mock_stream,
@@ -1451,7 +1449,6 @@
       MoqtSessionPeer::CreateControlStream(&server_session, &mock_stream);
   MoqtClientSetup setup = {
       /*supported_versions*/ {kDefaultMoqtVersion},
-      /*role=*/MoqtRole::kPubSub,
       /*path=*/std::nullopt,
   };
   EXPECT_CALL(mock_stream,
@@ -1615,47 +1612,6 @@
   session_.OnDatagramReceived(absl::string_view(datagram, sizeof(datagram)));
 }
 
-TEST_F(MoqtSessionTest, AnnounceToPublisher) {
-  MoqtSessionPeer::set_peer_role(&session_, MoqtRole::kPublisher);
-  testing::MockFunction<void(
-      FullTrackName track_namespace,
-      std::optional<MoqtAnnounceErrorReason> error_message)>
-      announce_resolved_callback;
-  EXPECT_CALL(announce_resolved_callback, Call(_, _)).Times(1);
-  session_.Announce(FullTrackName{"foo"},
-                    announce_resolved_callback.AsStdFunction());
-}
-
-TEST_F(MoqtSessionTest, SubscribeFromPublisher) {
-  MoqtSessionPeer::set_peer_role(&session_, MoqtRole::kPublisher);
-  webtransport::test::MockStream mock_stream;
-  std::unique_ptr<MoqtControlParserVisitor> stream_input =
-      MoqtSessionPeer::CreateControlStream(&session_, &mock_stream);
-  // Request for track returns Protocol Violation.
-  EXPECT_CALL(mock_session_,
-              CloseSession(static_cast<uint64_t>(MoqtError::kProtocolViolation),
-                           "Received SUBSCRIBE from publisher"))
-      .Times(1);
-  EXPECT_CALL(session_callbacks_.session_terminated_callback, Call(_)).Times(1);
-  stream_input->OnSubscribeMessage(DefaultSubscribe());
-}
-
-TEST_F(MoqtSessionTest, AnnounceFromSubscriber) {
-  MoqtSessionPeer::set_peer_role(&session_, MoqtRole::kSubscriber);
-  webtransport::test::MockStream mock_stream;
-  std::unique_ptr<MoqtControlParserVisitor> stream_input =
-      MoqtSessionPeer::CreateControlStream(&session_, &mock_stream);
-  MoqtAnnounce announce = {
-      /*track_namespace=*/FullTrackName{"foo"},
-  };
-  EXPECT_CALL(mock_session_,
-              CloseSession(static_cast<uint64_t>(MoqtError::kProtocolViolation),
-                           "Received ANNOUNCE from Subscriber"))
-      .Times(1);
-  EXPECT_CALL(session_callbacks_.session_terminated_callback, Call(_)).Times(1);
-  stream_input->OnAnnounceMessage(announce);
-}
-
 TEST_F(MoqtSessionTest, QueuedStreamsOpenedInOrder) {
   FullTrackName ftn("foo", "bar");
   auto track = SetupPublisher(ftn, MoqtForwardingPreference::kSubgroup,
@@ -2480,7 +2436,6 @@
 // TODO: re-enable this test once this behavior is re-implemented.
 #if 0
 TEST_F(MoqtSessionTest, SubscribeUpdateClosesSubscription) {
-  MoqtSessionPeer::set_peer_role(&session_, MoqtRole::kSubscriber);
   FullTrackName ftn("foo", "bar");
   MockLocalTrackVisitor track_visitor;
   session_.AddLocalTrack(ftn, MoqtForwardingPreference::kSubgroup,
diff --git a/quiche/quic/moqt/test_tools/moqt_session_peer.h b/quiche/quic/moqt/test_tools/moqt_session_peer.h
index dc94e7b..46c8121 100644
--- a/quiche/quic/moqt/test_tools/moqt_session_peer.h
+++ b/quiche/quic/moqt/test_tools/moqt_session_peer.h
@@ -121,10 +121,6 @@
         priority);
   }
 
-  static void set_peer_role(MoqtSession* session, MoqtRole role) {
-    session->peer_role_ = role;
-  }
-
   static SubscribeRemoteTrack* remote_track(MoqtSession* session,
                                             uint64_t track_alias) {
     return session->RemoteTrackByAlias(track_alias);
diff --git a/quiche/quic/moqt/test_tools/moqt_test_message.h b/quiche/quic/moqt/test_tools/moqt_test_message.h
index 41652e2..64732c4 100644
--- a/quiche/quic/moqt/test_tools/moqt_test_message.h
+++ b/quiche/quic/moqt/test_tools/moqt_test_message.h
@@ -330,8 +330,8 @@
     if (webtrans) {
       // Should not send PATH.
       client_setup_.path = std::nullopt;
-      raw_packet_[2] = 0x0a;  // adjust payload length (-5)
-      raw_packet_[6] = 0x02;  // only two parameters
+      raw_packet_[2] = 0x07;  // adjust payload length (-5)
+      raw_packet_[6] = 0x01;  // only two parameters
       SetWireImage(raw_packet_, sizeof(raw_packet_) - 5);
     } else {
       SetWireImage(raw_packet_, sizeof(raw_packet_));
@@ -352,10 +352,6 @@
         return false;
       }
     }
-    if (cast.role != client_setup_.role) {
-      QUIC_LOG(INFO) << "CLIENT_SETUP role mismatch";
-      return false;
-    }
     if (cast.path != client_setup_.path) {
       QUIC_LOG(INFO) << "CLIENT_SETUP path mismatch";
       return false;
@@ -369,11 +365,11 @@
 
   void ExpandVarints() override {
     if (client_setup_.path.has_value()) {
-      ExpandVarintsImpl("--vvvvvvv-vv-vv---");
+      ExpandVarintsImpl("--vvvvvvv-vv---");
       // first two bytes are already a 2B varint. Also, don't expand parameter
       // varints because that messes up the parameter length field.
     } else {
-      ExpandVarintsImpl("--vvvvvvv-vv-");
+      ExpandVarintsImpl("--vvvvvvv-");
     }
   }
 
@@ -382,18 +378,16 @@
   }
 
  private:
-  uint8_t raw_packet_[18] = {
-      0x40, 0x40, 0x0f,              // type
+  uint8_t raw_packet_[15] = {
+      0x40, 0x40, 0x0c,              // type
       0x02, 0x01, 0x02,              // versions
-      0x03,                          // 3 parameters
-      0x00, 0x01, 0x03,              // role = PubSub
+      0x02,                          // 3 parameters
       0x02, 0x01, 0x32,              // max_subscribe_id = 50
       0x01, 0x03, 0x66, 0x6f, 0x6f,  // path = "foo"
   };
   MoqtClientSetup client_setup_ = {
       /*supported_versions=*/std::vector<MoqtVersion>(
           {static_cast<MoqtVersion>(1), static_cast<MoqtVersion>(2)}),
-      /*role=*/MoqtRole::kPubSub,
       /*path=*/"foo",
       /*max_subscribe_id=*/50,
   };
@@ -411,10 +405,6 @@
       QUIC_LOG(INFO) << "SERVER_SETUP selected version mismatch";
       return false;
     }
-    if (cast.role != server_setup_.role) {
-      QUIC_LOG(INFO) << "SERVER_SETUP role mismatch";
-      return false;
-    }
     if (cast.max_subscribe_id != server_setup_.max_subscribe_id) {
       QUIC_LOG(INFO) << "SERVER_SETUP max_subscribe_id mismatch";
       return false;
@@ -423,8 +413,8 @@
   }
 
   void ExpandVarints() override {
-    ExpandVarintsImpl("--vvvvv-vv-");  // first two bytes are already a 2b
-                                       // varint
+    ExpandVarintsImpl("--vvvvv-");  // first two bytes are already a 2b
+                                    // varint
   }
 
   MessageStructuredData structured_data() const override {
@@ -432,15 +422,13 @@
   }
 
  private:
-  uint8_t raw_packet_[11] = {
-      0x40, 0x41, 0x08,  // type
-      0x01, 0x02,        // version, two parameters
-      0x00, 0x01, 0x03,  // role = PubSub
+  uint8_t raw_packet_[8] = {
+      0x40, 0x41, 0x05,  // type
+      0x01, 0x01,        // version, two parameters
       0x02, 0x01, 0x32,  // max_subscribe_id = 50
   };
   MoqtServerSetup server_setup_ = {
       /*selected_version=*/static_cast<MoqtVersion>(1),
-      /*role=*/MoqtRole::kPubSub,
       /*max_subscribe_id=*/50,
   };
 };