fix: various improvements and fixes
This commit is contained in:
		
							parent
							
								
									363c629faf
								
							
						
					
					
						commit
						3ea7d162db
					
				
					 9 changed files with 67 additions and 57 deletions
				
			
		
							
								
								
									
										18
									
								
								Cargo.lock
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										18
									
								
								Cargo.lock
									
									
									
										generated
									
									
									
								
							|  | @ -1623,6 +1623,7 @@ dependencies = [ | |||
| [[package]] | ||||
| name = "ruma" | ||||
| version = "0.0.2" | ||||
| source = "git+https://github.com/ruma/ruma?rev=f196f5b6f164973d6b343af31ab4e0457f743675#f196f5b6f164973d6b343af31ab4e0457f743675" | ||||
| dependencies = [ | ||||
|  "assign", | ||||
|  "js_int", | ||||
|  | @ -1642,6 +1643,7 @@ dependencies = [ | |||
| [[package]] | ||||
| name = "ruma-api" | ||||
| version = "0.17.0-alpha.2" | ||||
| source = "git+https://github.com/ruma/ruma?rev=f196f5b6f164973d6b343af31ab4e0457f743675#f196f5b6f164973d6b343af31ab4e0457f743675" | ||||
| dependencies = [ | ||||
|  "http", | ||||
|  "percent-encoding", | ||||
|  | @ -1656,6 +1658,7 @@ dependencies = [ | |||
| [[package]] | ||||
| name = "ruma-api-macros" | ||||
| version = "0.17.0-alpha.2" | ||||
| source = "git+https://github.com/ruma/ruma?rev=f196f5b6f164973d6b343af31ab4e0457f743675#f196f5b6f164973d6b343af31ab4e0457f743675" | ||||
| dependencies = [ | ||||
|  "proc-macro-crate", | ||||
|  "proc-macro2", | ||||
|  | @ -1666,6 +1669,7 @@ dependencies = [ | |||
| [[package]] | ||||
| name = "ruma-appservice-api" | ||||
| version = "0.2.0-alpha.2" | ||||
| source = "git+https://github.com/ruma/ruma?rev=f196f5b6f164973d6b343af31ab4e0457f743675#f196f5b6f164973d6b343af31ab4e0457f743675" | ||||
| dependencies = [ | ||||
|  "ruma-api", | ||||
|  "ruma-common", | ||||
|  | @ -1679,6 +1683,7 @@ dependencies = [ | |||
| [[package]] | ||||
| name = "ruma-client-api" | ||||
| version = "0.10.0-alpha.2" | ||||
| source = "git+https://github.com/ruma/ruma?rev=f196f5b6f164973d6b343af31ab4e0457f743675#f196f5b6f164973d6b343af31ab4e0457f743675" | ||||
| dependencies = [ | ||||
|  "assign", | ||||
|  "http", | ||||
|  | @ -1697,6 +1702,7 @@ dependencies = [ | |||
| [[package]] | ||||
| name = "ruma-common" | ||||
| version = "0.3.0-alpha.1" | ||||
| source = "git+https://github.com/ruma/ruma?rev=f196f5b6f164973d6b343af31ab4e0457f743675#f196f5b6f164973d6b343af31ab4e0457f743675" | ||||
| dependencies = [ | ||||
|  "js_int", | ||||
|  "maplit", | ||||
|  | @ -1709,6 +1715,7 @@ dependencies = [ | |||
| [[package]] | ||||
| name = "ruma-events" | ||||
| version = "0.22.0-alpha.2" | ||||
| source = "git+https://github.com/ruma/ruma?rev=f196f5b6f164973d6b343af31ab4e0457f743675#f196f5b6f164973d6b343af31ab4e0457f743675" | ||||
| dependencies = [ | ||||
|  "js_int", | ||||
|  "ruma-common", | ||||
|  | @ -1722,6 +1729,7 @@ dependencies = [ | |||
| [[package]] | ||||
| name = "ruma-events-macros" | ||||
| version = "0.22.0-alpha.2" | ||||
| source = "git+https://github.com/ruma/ruma?rev=f196f5b6f164973d6b343af31ab4e0457f743675#f196f5b6f164973d6b343af31ab4e0457f743675" | ||||
| dependencies = [ | ||||
|  "proc-macro-crate", | ||||
|  "proc-macro2", | ||||
|  | @ -1732,6 +1740,7 @@ dependencies = [ | |||
| [[package]] | ||||
| name = "ruma-federation-api" | ||||
| version = "0.1.0-alpha.1" | ||||
| source = "git+https://github.com/ruma/ruma?rev=f196f5b6f164973d6b343af31ab4e0457f743675#f196f5b6f164973d6b343af31ab4e0457f743675" | ||||
| dependencies = [ | ||||
|  "js_int", | ||||
|  "ruma-api", | ||||
|  | @ -1746,6 +1755,7 @@ dependencies = [ | |||
| [[package]] | ||||
| name = "ruma-identifiers" | ||||
| version = "0.18.0-alpha.1" | ||||
| source = "git+https://github.com/ruma/ruma?rev=f196f5b6f164973d6b343af31ab4e0457f743675#f196f5b6f164973d6b343af31ab4e0457f743675" | ||||
| dependencies = [ | ||||
|  "paste", | ||||
|  "rand", | ||||
|  | @ -1759,6 +1769,7 @@ dependencies = [ | |||
| [[package]] | ||||
| name = "ruma-identifiers-macros" | ||||
| version = "0.18.0-alpha.1" | ||||
| source = "git+https://github.com/ruma/ruma?rev=f196f5b6f164973d6b343af31ab4e0457f743675#f196f5b6f164973d6b343af31ab4e0457f743675" | ||||
| dependencies = [ | ||||
|  "proc-macro2", | ||||
|  "quote", | ||||
|  | @ -1769,10 +1780,12 @@ dependencies = [ | |||
| [[package]] | ||||
| name = "ruma-identifiers-validation" | ||||
| version = "0.2.0" | ||||
| source = "git+https://github.com/ruma/ruma?rev=f196f5b6f164973d6b343af31ab4e0457f743675#f196f5b6f164973d6b343af31ab4e0457f743675" | ||||
| 
 | ||||
| [[package]] | ||||
| name = "ruma-identity-service-api" | ||||
| version = "0.0.1" | ||||
| source = "git+https://github.com/ruma/ruma?rev=f196f5b6f164973d6b343af31ab4e0457f743675#f196f5b6f164973d6b343af31ab4e0457f743675" | ||||
| dependencies = [ | ||||
|  "ruma-api", | ||||
|  "ruma-common", | ||||
|  | @ -1785,6 +1798,7 @@ dependencies = [ | |||
| [[package]] | ||||
| name = "ruma-push-gateway-api" | ||||
| version = "0.0.1" | ||||
| source = "git+https://github.com/ruma/ruma?rev=f196f5b6f164973d6b343af31ab4e0457f743675#f196f5b6f164973d6b343af31ab4e0457f743675" | ||||
| dependencies = [ | ||||
|  "js_int", | ||||
|  "ruma-api", | ||||
|  | @ -1799,6 +1813,7 @@ dependencies = [ | |||
| [[package]] | ||||
| name = "ruma-serde" | ||||
| version = "0.3.0" | ||||
| source = "git+https://github.com/ruma/ruma?rev=f196f5b6f164973d6b343af31ab4e0457f743675#f196f5b6f164973d6b343af31ab4e0457f743675" | ||||
| dependencies = [ | ||||
|  "form_urlencoded", | ||||
|  "itoa", | ||||
|  | @ -1811,6 +1826,7 @@ dependencies = [ | |||
| [[package]] | ||||
| name = "ruma-serde-macros" | ||||
| version = "0.3.0" | ||||
| source = "git+https://github.com/ruma/ruma?rev=f196f5b6f164973d6b343af31ab4e0457f743675#f196f5b6f164973d6b343af31ab4e0457f743675" | ||||
| dependencies = [ | ||||
|  "proc-macro-crate", | ||||
|  "proc-macro2", | ||||
|  | @ -1821,6 +1837,7 @@ dependencies = [ | |||
| [[package]] | ||||
| name = "ruma-signatures" | ||||
| version = "0.6.0-alpha.1" | ||||
| source = "git+https://github.com/ruma/ruma?rev=f196f5b6f164973d6b343af31ab4e0457f743675#f196f5b6f164973d6b343af31ab4e0457f743675" | ||||
| dependencies = [ | ||||
|  "base64 0.13.0", | ||||
|  "ring", | ||||
|  | @ -2088,6 +2105,7 @@ checksum = "3015a7d0a5fd5105c91c3710d42f9ccf0abfb287d62206484dcc67f9569a6483" | |||
| [[package]] | ||||
| name = "state-res" | ||||
| version = "0.1.0" | ||||
| source = "git+https://github.com/ruma/state-res?rev=34cd1cb4dcdd5fb84b5df9e48e63b2e4669a2488#34cd1cb4dcdd5fb84b5df9e48e63b2e4669a2488" | ||||
| dependencies = [ | ||||
|  "itertools 0.10.0", | ||||
|  "log", | ||||
|  |  | |||
|  | @ -18,15 +18,16 @@ rocket = { git = "https://github.com/SergioBenitez/Rocket.git", rev = "93e62c86e | |||
| #rocket = { git = "https://github.com/timokoesters/Rocket.git", branch = "empty_parameters", default-features = false, features = ["tls"] } | ||||
| 
 | ||||
| # Used for matrix spec type definitions and helpers | ||||
| #ruma = { git = "https://github.com/ruma/ruma", features = ["rand", "appservice-api", "client-api", "federation-api", "push-gateway-api", "unstable-pre-spec", "unstable-synapse-quirks", "unstable-exhaustive-types"], rev = "f196f5b6f164973d6b343af31ab4e0457f743675" } | ||||
| ruma = { git = "https://github.com/ruma/ruma", features = ["rand", "appservice-api", "client-api", "federation-api", "push-gateway-api", "unstable-pre-spec", "unstable-synapse-quirks", "unstable-exhaustive-types"], rev = "f196f5b6f164973d6b343af31ab4e0457f743675" } | ||||
| #ruma = { git = "https://github.com/DevinR528/ruma", features = ["rand", "client-api", "federation-api", "push-gateway-api", "unstable-exhaustive-types", "unstable-pre-spec", "unstable-synapse-quirks"], branch = "verified-export" } | ||||
| ruma = { path = "../ruma/ruma", features = ["unstable-exhaustive-types", "rand", "client-api", "federation-api", "push-gateway-api", "unstable-pre-spec", "unstable-synapse-quirks"] } | ||||
| #ruma = { path = "../ruma/ruma", features = ["unstable-exhaustive-types", "rand", "client-api", "federation-api", "push-gateway-api", "unstable-pre-spec", "unstable-synapse-quirks"] } | ||||
| 
 | ||||
| # Used when doing state resolution | ||||
| # state-res = { git = "https://github.com/timokoesters/state-res", branch = "timo-spec-comp", features = ["unstable-pre-spec"] } | ||||
| # TODO: remove the gen-eventid feature | ||||
| #state-res = { git = "https://github.com/ruma/state-res", rev = "34cd1cb4dcdd5fb84b5df9e48e63b2e4669a2488", features = ["unstable-pre-spec", "gen-eventid"] } | ||||
| state-res = { path = "../state-res", features = ["unstable-pre-spec", "gen-eventid"] } | ||||
| #state-res = { git = "https://github.com/ruma/state-res", branch = "main", features = ["unstable-pre-spec", "gen-eventid"] } | ||||
| state-res = { git = "https://github.com/ruma/state-res", rev = "34cd1cb4dcdd5fb84b5df9e48e63b2e4669a2488", features = ["unstable-pre-spec", "gen-eventid"] } | ||||
| #state-res = { path = "../state-res", features = ["unstable-pre-spec", "gen-eventid"] } | ||||
| 
 | ||||
| # Used for long polling and federation sender, should be the same as rocket::tokio | ||||
| tokio = "1.2.0" | ||||
|  |  | |||
|  | @ -24,20 +24,25 @@ pub async fn get_context_route( | |||
|         )); | ||||
|     } | ||||
| 
 | ||||
|     let base_pdu_id = db | ||||
|         .rooms | ||||
|         .get_pdu_id(&body.event_id)? | ||||
|         .ok_or(Error::BadRequest( | ||||
|             ErrorKind::NotFound, | ||||
|             "Base event id not found.", | ||||
|         ))?; | ||||
| 
 | ||||
|     let base_token = db.rooms.pdu_count(&base_pdu_id)?; | ||||
| 
 | ||||
|     let base_event = db | ||||
|         .rooms | ||||
|         .get_pdu(&body.event_id)? | ||||
|         .get_pdu_from_id(&base_pdu_id)? | ||||
|         .ok_or(Error::BadRequest( | ||||
|             ErrorKind::NotFound, | ||||
|             "Base event not found.", | ||||
|         ))? | ||||
|         .to_room_event(); | ||||
| 
 | ||||
|     let base_token = db | ||||
|         .rooms | ||||
|         .get_pdu_count(&body.event_id)? | ||||
|         .expect("event still exists"); | ||||
| 
 | ||||
|     let events_before = db | ||||
|         .rooms | ||||
|         .pdus_until(&sender_user, &body.room_id, base_token) | ||||
|  |  | |||
|  | @ -120,7 +120,7 @@ impl Database { | |||
|                 token_userdeviceid: db.open_tree("token_userdeviceid")?, | ||||
|                 onetimekeyid_onetimekeys: db.open_tree("onetimekeyid_onetimekeys")?, | ||||
|                 userid_lastonetimekeyupdate: db.open_tree("userid_lastonetimekeyupdate")?, | ||||
|                 keychangeid_userid: db.open_tree("devicekeychangeid_userid")?, | ||||
|                 keychangeid_userid: db.open_tree("keychangeid_userid")?, | ||||
|                 keyid_key: db.open_tree("keyid_key")?, | ||||
|                 userid_masterkeyid: db.open_tree("userid_masterkeyid")?, | ||||
|                 userid_selfsigningkeyid: db.open_tree("userid_selfsigningkeyid")?, | ||||
|  | @ -135,7 +135,7 @@ impl Database { | |||
|                     readreceiptid_readreceipt: db.open_tree("readreceiptid_readreceipt")?, | ||||
|                     roomuserid_privateread: db.open_tree("roomuserid_privateread")?, // "Private" read receipt
 | ||||
|                     roomuserid_lastprivatereadupdate: db | ||||
|                         .open_tree("roomid_lastprivatereadupdate")?, | ||||
|                         .open_tree("roomuserid_lastprivatereadupdate")?, | ||||
|                     typingid_userid: db.open_tree("typingid_userid")?, | ||||
|                     roomid_lasttypingupdate: db.open_tree("roomid_lasttypingupdate")?, | ||||
|                     presenceid_presence: db.open_tree("presenceid_presence")?, | ||||
|  | @ -146,7 +146,7 @@ impl Database { | |||
|                 roomid_pduleaves: db.open_tree("roomid_pduleaves")?, | ||||
| 
 | ||||
|                 alias_roomid: db.open_tree("alias_roomid")?, | ||||
|                 aliasid_alias: db.open_tree("alias_roomid")?, | ||||
|                 aliasid_alias: db.open_tree("aliasid_alias")?, | ||||
|                 publicroomids: db.open_tree("publicroomids")?, | ||||
| 
 | ||||
|                 tokenids: db.open_tree("tokenids")?, | ||||
|  | @ -163,11 +163,11 @@ impl Database { | |||
|                 stateid_shorteventid: db.open_tree("stateid_shorteventid")?, | ||||
|                 eventid_shorteventid: db.open_tree("eventid_shorteventid")?, | ||||
|                 shorteventid_eventid: db.open_tree("shorteventid_eventid")?, | ||||
|                 shorteventid_shortstatehash: db.open_tree("eventid_shortstatehash")?, | ||||
|                 shorteventid_shortstatehash: db.open_tree("shorteventid_shortstatehash")?, | ||||
|                 roomid_shortstatehash: db.open_tree("roomid_shortstatehash")?, | ||||
|                 statehash_shortstatehash: db.open_tree("statehash_shortstatehash")?, | ||||
| 
 | ||||
|                 eventid_outlierpdu: db.open_tree("roomeventid_outlierpdu")?, | ||||
|                 eventid_outlierpdu: db.open_tree("eventid_outlierpdu")?, | ||||
|                 prevevent_parent: db.open_tree("prevevent_parent")?, | ||||
|             }, | ||||
|             account_data: account_data::AccountData { | ||||
|  | @ -179,7 +179,7 @@ impl Database { | |||
|             key_backups: key_backups::KeyBackups { | ||||
|                 backupid_algorithm: db.open_tree("backupid_algorithm")?, | ||||
|                 backupid_etag: db.open_tree("backupid_etag")?, | ||||
|                 backupkeyid_backup: db.open_tree("backupkeyid_backupmetadata")?, | ||||
|                 backupkeyid_backup: db.open_tree("backupkeyid_backup")?, | ||||
|             }, | ||||
|             transaction_ids: transaction_ids::TransactionIds { | ||||
|                 userdevicetxnid_response: db.open_tree("userdevicetxnid_response")?, | ||||
|  |  | |||
|  | @ -469,7 +469,7 @@ async fn send_notice( | |||
|     name: &str, | ||||
| ) -> Result<()> { | ||||
|     // TODO: email
 | ||||
|     if pusher.kind == Some(PusherKind::Http) { | ||||
|     if pusher.kind == Some(PusherKind::Email) { | ||||
|         return Ok(()); | ||||
|     } | ||||
| 
 | ||||
|  |  | |||
|  | @ -1524,7 +1524,7 @@ impl Rooms { | |||
|             let mut aliasid = room_id.as_bytes().to_vec(); | ||||
|             aliasid.push(0xff); | ||||
|             aliasid.extend_from_slice(&globals.next_count()?.to_be_bytes()); | ||||
|             self.aliasid_alias.insert(aliasid, &*alias.alias())?; | ||||
|             self.aliasid_alias.insert(aliasid, &*alias.as_bytes())?; | ||||
|         } else { | ||||
|             // room_id=None means remove alias
 | ||||
|             let room_id = self | ||||
|  |  | |||
|  | @ -108,7 +108,6 @@ impl Sending { | |||
| 
 | ||||
|             let mut subscriber = servernamepduids.watch_prefix(b""); | ||||
|             loop { | ||||
|                 println!("."); | ||||
|                 select! { | ||||
|                     Some(response) = futures.next() => { | ||||
|                         match response { | ||||
|  | @ -262,8 +261,6 @@ impl Sending { | |||
|                                 servercurrentpdus.insert(&key, &[]).unwrap(); | ||||
|                                 servernamepduids.remove(&key).unwrap(); | ||||
| 
 | ||||
|                                 dbg!("there is a future"); | ||||
| 
 | ||||
|                                 futures.push( | ||||
|                                     Self::handle_event( | ||||
|                                         outgoing_kind, | ||||
|  | @ -292,7 +289,6 @@ impl Sending { | |||
| 
 | ||||
|     #[tracing::instrument(skip(self))] | ||||
|     pub fn send_pdu(&self, server: &ServerName, pdu_id: &[u8]) -> Result<()> { | ||||
|         dbg!(&server); | ||||
|         let mut key = server.as_bytes().to_vec(); | ||||
|         key.push(0xff); | ||||
|         key.extend_from_slice(pdu_id); | ||||
|  | @ -350,7 +346,6 @@ impl Sending { | |||
|                     .collect::<Vec<_>>(); | ||||
|                 let permit = db.sending.maximum_requests.acquire().await; | ||||
| 
 | ||||
|                 error!("sending pdus to {}: {:#?}", server, pdu_jsons); | ||||
|                 let response = appservice_server::send_request( | ||||
|                     &db.globals, | ||||
|                     db.appservice | ||||
|  | @ -458,7 +453,6 @@ impl Sending { | |||
| 
 | ||||
|                     let permit = db.sending.maximum_requests.acquire().await; | ||||
| 
 | ||||
|                     error!("sending pdu to {}: {:#?}", userid, pdu); | ||||
|                     let _response = pusher::send_push_notice( | ||||
|                         &userid, | ||||
|                         unread, | ||||
|  | @ -506,7 +500,6 @@ impl Sending { | |||
| 
 | ||||
|                 let permit = db.sending.maximum_requests.acquire().await; | ||||
| 
 | ||||
|                 error!("sending pdus to {}: {:#?}", server, pdu_jsons); | ||||
|                 let response = server_server::send_request( | ||||
|                     &db.globals, | ||||
|                     &*server, | ||||
|  | @ -523,7 +516,7 @@ impl Sending { | |||
|                 ) | ||||
|                 .await | ||||
|                 .map(|response| { | ||||
|                     error!("server response: {:?}", response); | ||||
|                     info!("server response: {:?}", response); | ||||
|                     kind.clone() | ||||
|                 }) | ||||
|                 .map_err(|e| (kind, e)); | ||||
|  |  | |||
|  | @ -219,6 +219,7 @@ where | |||
|                     "Access-Control-Allow-Headers", | ||||
|                     "Origin, X-Requested-With, Content-Type, Accept, Authorization", | ||||
|                 ); | ||||
|                 response.raw_header("Access-Control-Max-Age", "86400"); | ||||
|                 response.ok() | ||||
|             } | ||||
|             Err(_) => Err(Status::InternalServerError), | ||||
|  |  | |||
|  | @ -863,8 +863,6 @@ pub async fn send_transaction_message_route<'a>( | |||
|                     .map(|(_, pdu)| (pdu.event_id().clone(), pdu)), | ||||
|             ); | ||||
| 
 | ||||
|             debug!("auth events: {:?}", auth_cache); | ||||
| 
 | ||||
|             let res = match state_res::StateResolution::resolve( | ||||
|                 pdu.room_id(), | ||||
|                 &RoomVersionId::Version6, | ||||
|  | @ -952,7 +950,7 @@ type AsyncRecursiveResult<'a, T> = Pin<Box<dyn Future<Output = StdResult<T, Stri | |||
| /// 5. reject "due to auth events" if the event doesn't pass auth based on the auth events
 | ||||
| /// 7. if not timeline event: stop
 | ||||
| /// 8. fetch any missing prev events doing all checks listed here starting at 1. These are timeline events
 | ||||
| #[tracing::instrument(skip(db))] | ||||
| #[tracing::instrument(skip(db, pub_key_map, auth_cache))] | ||||
| fn validate_event<'a>( | ||||
|     db: &'a Database, | ||||
|     value: CanonicalJsonObject, | ||||
|  | @ -998,29 +996,26 @@ fn validate_event<'a>( | |||
|                 } | ||||
|             }; | ||||
| 
 | ||||
|             pub_key_map.insert(dbg!(signature_server.clone()), dbg!(keys)); | ||||
|             pub_key_map.insert(signature_server.clone(), keys); | ||||
|         } | ||||
| 
 | ||||
|         let mut val = match ruma::signatures::verify_event( | ||||
|             dbg!(&pub_key_map), | ||||
|             &value, | ||||
|             &RoomVersionId::Version5, | ||||
|         ) { | ||||
|             Ok(ver) => { | ||||
|                 if let ruma::signatures::Verified::Signatures = ver { | ||||
|                     match ruma::signatures::redact(&value, &RoomVersionId::Version6) { | ||||
|                         Ok(obj) => obj, | ||||
|                         Err(_) => return Err("Redaction failed".to_string()), | ||||
|         let mut val = | ||||
|             match ruma::signatures::verify_event(&pub_key_map, &value, &RoomVersionId::Version5) { | ||||
|                 Ok(ver) => { | ||||
|                     if let ruma::signatures::Verified::Signatures = ver { | ||||
|                         match ruma::signatures::redact(&value, &RoomVersionId::Version6) { | ||||
|                             Ok(obj) => obj, | ||||
|                             Err(_) => return Err("Redaction failed".to_string()), | ||||
|                         } | ||||
|                     } else { | ||||
|                         value | ||||
|                     } | ||||
|                 } else { | ||||
|                     value | ||||
|                 } | ||||
|             } | ||||
|             Err(_e) => { | ||||
|                 error!("{}", _e); | ||||
|                 return Err("Signature verification failed".to_string()); | ||||
|             } | ||||
|         }; | ||||
|                 Err(e) => { | ||||
|                     error!("{:?}: {}", value, e); | ||||
|                     return Err("Signature verification failed".to_string()); | ||||
|                 } | ||||
|             }; | ||||
| 
 | ||||
|         // Now that we have checked the signature and hashes we can add the eventID and convert
 | ||||
|         // to our PduEvent type also finally verifying the first step listed above
 | ||||
|  | @ -1085,7 +1080,7 @@ fn validate_event<'a>( | |||
|     }) | ||||
| } | ||||
| 
 | ||||
| #[tracing::instrument(skip(db))] | ||||
| #[tracing::instrument(skip(db, key_map, auth_cache))] | ||||
| async fn fetch_check_auth_events( | ||||
|     db: &Database, | ||||
|     origin: &ServerName, | ||||
|  | @ -1108,7 +1103,7 @@ async fn fetch_check_auth_events( | |||
| ///
 | ||||
| /// If the event is unknown to the `auth_cache` it is added. This guarantees that any
 | ||||
| /// event we need to know of will be present.
 | ||||
| #[tracing::instrument(skip(db))] | ||||
| //#[tracing::instrument(skip(db, key_map, auth_cache))]
 | ||||
| pub(crate) async fn fetch_events( | ||||
|     db: &Database, | ||||
|     origin: &ServerName, | ||||
|  | @ -1175,11 +1170,8 @@ pub(crate) async fn fetch_signing_keys( | |||
|     origin: &ServerName, | ||||
|     signature_ids: Vec<&String>, | ||||
| ) -> Result<BTreeMap<String, String>> { | ||||
|     let contains_all_ids = |keys: &BTreeMap<String, String>| { | ||||
|         signature_ids | ||||
|             .iter() | ||||
|             .all(|&id| dbg!(dbg!(&keys).contains_key(dbg!(id)))) | ||||
|     }; | ||||
|     let contains_all_ids = | ||||
|         |keys: &BTreeMap<String, String>| signature_ids.iter().all(|&id| keys.contains_key(id)); | ||||
| 
 | ||||
|     let mut result = db | ||||
|         .globals | ||||
|  | @ -1273,7 +1265,7 @@ pub(crate) async fn calculate_forward_extremities( | |||
|     db: &Database, | ||||
|     pdu: &PduEvent, | ||||
| ) -> Result<Vec<EventId>> { | ||||
|     let mut current_leaves = dbg!(db.rooms.get_pdu_leaves(pdu.room_id())?); | ||||
|     let mut current_leaves = db.rooms.get_pdu_leaves(pdu.room_id())?; | ||||
| 
 | ||||
|     let mut is_incoming_leaf = true; | ||||
|     // Make sure the incoming event is not already a forward extremity
 | ||||
|  | @ -1344,7 +1336,7 @@ pub(crate) async fn build_forward_extremity_snapshots( | |||
|             Some(leave_pdu) => { | ||||
|                 let pdu_shortstatehash = db | ||||
|                     .rooms | ||||
|                     .pdu_shortstatehash(dbg!(&leave_pdu.event_id))? | ||||
|                     .pdu_shortstatehash(&leave_pdu.event_id)? | ||||
|                     .ok_or_else(|| Error::bad_database("Found pdu with no statehash in db."))?; | ||||
| 
 | ||||
|                 if current_shortstatehash.as_ref() == Some(&pdu_shortstatehash) { | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue