diff --git a/src/core/matrix/state_res/mod.rs b/src/core/matrix/state_res/mod.rs index 719d8cb7..d82f7399 100644 --- a/src/core/matrix/state_res/mod.rs +++ b/src/core/matrix/state_res/mod.rs @@ -97,7 +97,7 @@ where | V2 | V3 | V4 | V5 | V6 | V7 | V8 | V9 | V10 | V11 => 2.0, | _ => 2.1, }; - debug!("State resolution starting"); + debug!(version = ?stateres_version, "State resolution starting"); // Split non-conflicting and conflicting state let (clean, conflicting) = separate(state_sets.into_iter()); @@ -220,8 +220,11 @@ where // Add unconflicted state to the resolved state // We priorities the unconflicting state resolved_state.extend(clean); - resolved_state.extend(resolved_control); // TODO(hydra): this feels disgusting and wrong but it allows - // the state to resolve properly? + if stateres_version == 2.1 { + resolved_state.extend(resolved_control); + // TODO(hydra): this feels disgusting and wrong but it allows + // the state to resolve properly? + } debug!("state resolution finished"); trace!( map = ?resolved_state, "final resolved state" ); diff --git a/src/service/rooms/event_handler/upgrade_outlier_pdu.rs b/src/service/rooms/event_handler/upgrade_outlier_pdu.rs index 46a63150..7675e478 100644 --- a/src/service/rooms/event_handler/upgrade_outlier_pdu.rs +++ b/src/service/rooms/event_handler/upgrade_outlier_pdu.rs @@ -306,6 +306,7 @@ where ); // assert!(extremities.is_empty(), "soft_fail extremities empty"); let extremities = extremities.iter().map(Borrow::borrow); + assert!(extremities.clone().count() > 0, "extremities not empty"); self.services .timeline @@ -340,6 +341,7 @@ where .iter() .map(Borrow::borrow) .chain(once(incoming_pdu.event_id())); + assert!(extremities.clone().count() > 0, "extremities not empty"); let pdu_id = self .services diff --git a/src/service/rooms/timeline/append.rs b/src/service/rooms/timeline/append.rs index d3700092..32605c10 100644 --- a/src/service/rooms/timeline/append.rs +++ b/src/service/rooms/timeline/append.rs @@ -3,6 +3,7 @@ use std::{ sync::Arc, }; +use conduwuit::trace; use conduwuit_core::{ Result, err, error, implement, matrix::{ @@ -61,10 +62,10 @@ where .pdu_metadata .mark_as_referenced(room_id, pdu.prev_events.iter().map(AsRef::as_ref)); - self.services - .state - .set_forward_extremities(room_id, new_room_leaves, state_lock) - .await; + // self.services + // .state + // .set_forward_extremities(room_id, new_room_leaves, state_lock) + // .await; return Ok(None); } @@ -156,6 +157,7 @@ where .pdu_metadata .mark_as_referenced(room_id, pdu.prev_events().map(AsRef::as_ref)); + trace!("setting forward extremities"); self.services .state .set_forward_extremities(room_id, leaves, state_lock) diff --git a/src/service/rooms/timeline/create.rs b/src/service/rooms/timeline/create.rs index 31046680..1924bb9c 100644 --- a/src/service/rooms/timeline/create.rs +++ b/src/service/rooms/timeline/create.rs @@ -148,18 +148,18 @@ pub async fn create_hash_and_sign_event( } } - if event_type != TimelineEventType::RoomCreate && prev_events.is_empty() { - return Err!(Request(Unknown("Event incorrectly had zero prev_events."))); - } - if state_key.is_none() && depth.lt(&uint!(2)) { - // The first two events in a room are always m.room.create and m.room.member, - // so any other events with that same depth are illegal. - warn!( - "Had unsafe depth {depth} when creating non-state event in {}. Cowardly aborting", - room_id.expect("room_id is Some here").as_str() - ); - return Err!(Request(Unknown("Unsafe depth for non-state event."))); - } + // if event_type != TimelineEventType::RoomCreate && prev_events.is_empty() { + // return Err!(Request(Unknown("Event incorrectly had zero prev_events."))); + // } + // if state_key.is_none() && depth.lt(&uint!(2)) { + // // The first two events in a room are always m.room.create and + // m.room.member, // so any other events with that same depth are illegal. + // warn!( + // "Had unsafe depth {depth} when creating non-state event in {}. Cowardly + // aborting", room_id.expect("room_id is Some here").as_str() + // ); + // return Err!(Request(Unknown("Unsafe depth for non-state event."))); + // } let mut pdu = PduEvent { event_id: ruma::event_id!("$thiswillbefilledinlater").into(),