diff --git a/crates/torii/indexer/src/engine.rs b/crates/torii/indexer/src/engine.rs index 68cbca4d5f..92da5cf474 100644 --- a/crates/torii/indexer/src/engine.rs +++ b/crates/torii/indexer/src/engine.rs @@ -890,14 +890,14 @@ impl Engine

{ "ModelRegistered" | "EventRegistered" => { let mut hasher = DefaultHasher::new(); event.keys.iter().for_each(|k| k.hash(&mut hasher)); - let hash = hasher.finish() & 0x00FFFFFFFFFFFFFF; + let hash = hasher.finish(); (0usize, hash) // Priority 0 (highest) for model/event registration } "StoreSetRecord" | "StoreUpdateRecord" | "StoreUpdateMember" | "StoreDelRecord" => { let mut hasher = DefaultHasher::new(); event.keys[1].hash(&mut hasher); event.keys[2].hash(&mut hasher); - let hash = hasher.finish() & 0x00FFFFFFFFFFFFFF; + let hash = hasher.finish(); (2usize, hash) // Priority 2 (lower) for store operations } _ => (0, 0) // No parallelization for other events diff --git a/crates/torii/indexer/src/processors/store_del_record.rs b/crates/torii/indexer/src/processors/store_del_record.rs index e109f069d7..c92b6961f0 100644 --- a/crates/torii/indexer/src/processors/store_del_record.rs +++ b/crates/torii/indexer/src/processors/store_del_record.rs @@ -35,7 +35,7 @@ where block_timestamp: u64, event_id: &str, event: &Event, - _config: &EventProcessorConfig, + config: &EventProcessorConfig, ) -> Result<(), Error> { // Torii version is coupled to the world version, so we can expect the event to be well // formed. @@ -55,7 +55,7 @@ where // This can happen if only specific namespaces are indexed. let model = match db.model(event.selector).await { Ok(m) => m, - Err(e) if e.to_string().contains("no rows") => { + Err(e) if e.to_string().contains("no rows") && !config.namespaces.is_empty() => { debug!( target: LOG_TARGET, selector = %event.selector, @@ -63,7 +63,13 @@ where ); return Ok(()); } - Err(e) => return Err(e), + Err(e) => { + return Err(anyhow::anyhow!( + "Failed to retrieve model with selector {:#x}: {}", + event.selector, + e + )) + } }; info!( diff --git a/crates/torii/indexer/src/processors/store_set_record.rs b/crates/torii/indexer/src/processors/store_set_record.rs index c564cb3968..eb73f17f2b 100644 --- a/crates/torii/indexer/src/processors/store_set_record.rs +++ b/crates/torii/indexer/src/processors/store_set_record.rs @@ -36,7 +36,7 @@ where block_timestamp: u64, event_id: &str, event: &Event, - _config: &EventProcessorConfig, + config: &EventProcessorConfig, ) -> Result<(), Error> { // Torii version is coupled to the world version, so we can expect the event to be well // formed. @@ -56,7 +56,7 @@ where // This can happen if only specific namespaces are indexed. let model = match db.model(event.selector).await { Ok(m) => m, - Err(e) if e.to_string().contains("no rows") => { + Err(e) if e.to_string().contains("no rows") && !config.namespaces.is_empty() => { debug!( target: LOG_TARGET, selector = %event.selector, @@ -64,7 +64,13 @@ where ); return Ok(()); } - Err(e) => return Err(e), + Err(e) => { + return Err(anyhow::anyhow!( + "Failed to retrieve model with selector {:#x}: {}", + event.selector, + e + )) + } }; info!( diff --git a/crates/torii/indexer/src/processors/store_update_member.rs b/crates/torii/indexer/src/processors/store_update_member.rs index 776d61d9cb..b5662a21bd 100644 --- a/crates/torii/indexer/src/processors/store_update_member.rs +++ b/crates/torii/indexer/src/processors/store_update_member.rs @@ -7,7 +7,7 @@ use starknet::core::types::Event; use starknet::core::utils::get_selector_from_name; use starknet::providers::Provider; use torii_sqlite::Sql; -use tracing::info; +use tracing::{debug, info}; use super::{EventProcessor, EventProcessorConfig}; @@ -37,7 +37,7 @@ where block_timestamp: u64, event_id: &str, event: &Event, - _config: &EventProcessorConfig, + config: &EventProcessorConfig, ) -> Result<(), Error> { // Torii version is coupled to the world version, so we can expect the event to be well // formed. @@ -61,11 +61,20 @@ where // This can happen if only specific namespaces are indexed. let model = match db.model(model_selector).await { Ok(m) => m, + Err(e) if e.to_string().contains("no rows") && !config.namespaces.is_empty() => { + debug!( + target: LOG_TARGET, + selector = %model_selector, + "Model does not exist, skipping." + ); + return Ok(()); + } Err(e) => { - if e.to_string().contains("no rows") { - return Ok(()); - } - return Err(e); + return Err(anyhow::anyhow!( + "Failed to retrieve model with selector {:#x}: {}", + event.selector, + e + )) } }; diff --git a/crates/torii/indexer/src/processors/store_update_record.rs b/crates/torii/indexer/src/processors/store_update_record.rs index b92344849d..5cf5a96dea 100644 --- a/crates/torii/indexer/src/processors/store_update_record.rs +++ b/crates/torii/indexer/src/processors/store_update_record.rs @@ -36,7 +36,7 @@ where block_timestamp: u64, event_id: &str, event: &Event, - _config: &EventProcessorConfig, + config: &EventProcessorConfig, ) -> Result<(), Error> { // Torii version is coupled to the world version, so we can expect the event to be well // formed. @@ -59,7 +59,7 @@ where // This can happen if only specific namespaces are indexed. let model = match db.model(event.selector).await { Ok(m) => m, - Err(e) if e.to_string().contains("no rows") => { + Err(e) if e.to_string().contains("no rows") && !config.namespaces.is_empty() => { debug!( target: LOG_TARGET, selector = %event.selector, @@ -67,7 +67,13 @@ where ); return Ok(()); } - Err(e) => return Err(e), + Err(e) => { + return Err(anyhow::anyhow!( + "Failed to retrieve model with selector {:#x}: {}", + event.selector, + e + )) + } }; info!(