diff --git a/bin/dipper-service/src/config.rs b/bin/dipper-service/src/config.rs index 740974f3..73ee033a 100644 --- a/bin/dipper-service/src/config.rs +++ b/bin/dipper-service/src/config.rs @@ -1204,7 +1204,7 @@ pub struct IndexingAgreementConfig { #[cfg(test)] impl IndexingAgreementConfig { - /// Zero addresses and limits, with permissive breaker and cache settings, for tests + /// Addresses and limits all set to 0, with permissive breaker and cache settings, for tests /// to adjust the fields they care about. pub fn for_tests() -> Self { Self { diff --git a/bin/dipper-service/src/network/service/chain_listener.rs b/bin/dipper-service/src/network/service/chain_listener.rs index 585626ca..80111bad 100644 --- a/bin/dipper-service/src/network/service/chain_listener.rs +++ b/bin/dipper-service/src/network/service/chain_listener.rs @@ -2063,7 +2063,7 @@ mod tests { } #[async_trait::async_trait] - impl AgreementRegistry for MockRegistry { + impl crate::registry::StubAgreementRegistry for MockRegistry { async fn get_indexing_agreement_by_id( &self, id: &IndexingAgreementId, @@ -2200,23 +2200,6 @@ mod tests { Ok(()) } - async fn get_cancelling_agreements( - &self, - _batch_size: i64, - _max_attempts: u32, - _min_age_minutes: i32, - ) -> RegistryResult> { - Ok(Vec::new()) - } - - async fn record_cancel_check( - &self, - _id: &IndexingAgreementId, - failed_attempts: u32, - ) -> RegistryResult { - Ok(failed_attempts) - } - async fn record_cancel_audit( &self, agreement_id: &IndexingAgreementId, @@ -2345,9 +2328,13 @@ mod tests { } let mut outcomes = std::collections::HashMap::with_capacity(items.len()); for item in items { - let outcome = self - .apply_reconciliation(&item.agreement_id, item.apply_accept, item.cancel) - .await?; + let outcome = crate::registry::StubAgreementRegistry::apply_reconciliation( + self, + &item.agreement_id, + item.apply_accept, + item.cancel, + ) + .await?; outcomes.insert(item.agreement_id, outcome); } Ok(outcomes) diff --git a/bin/dipper-service/src/worker/handlers/reassess_indexing_request.rs b/bin/dipper-service/src/worker/handlers/reassess_indexing_request.rs index b9897a4f..d2cf1d2a 100644 --- a/bin/dipper-service/src/worker/handlers/reassess_indexing_request.rs +++ b/bin/dipper-service/src/worker/handlers/reassess_indexing_request.rs @@ -839,11 +839,10 @@ mod lifecycle_event_tests { }, }, registry::{ - AgreementFeeRate, AgreementRegistry, CancelKind, Indexer, IndexerDenylistRegistry, - IndexingAgreement, IndexingAgreementStatus, IndexingAgreementTerms, - IndexingAgreementTermsMetadata, IndexingRequest, IndexingRequestRegistry, - NewAgreementParams, PendingCancellation, PendingCancellationRegistry, - ReconciliationItem, ReconciliationOutcome, Result as RegistryResult, SetTargetOutcome, + AgreementFeeRate, Indexer, IndexerDenylistRegistry, IndexingAgreement, + IndexingAgreementStatus, IndexingAgreementTerms, IndexingAgreementTermsMetadata, + IndexingRequest, IndexingRequestRegistry, NewAgreementParams, PendingCancellation, + PendingCancellationRegistry, Result as RegistryResult, SetTargetOutcome, }, signing::eip712::Eip712Signer, test_support::{CapturedEvent, CapturingEventsProducer}, @@ -1089,13 +1088,7 @@ mod lifecycle_event_tests { } #[async_trait] - impl AgreementRegistry for MockRegistry { - async fn get_indexing_agreement_by_id( - &self, - _id: &IndexingAgreementId, - ) -> RegistryResult> { - unimplemented!() - } + impl crate::registry::StubAgreementRegistry for MockRegistry { // gather_selection_context: all active agreements for the deployment. async fn get_indexing_agreements_by_deployment_id( &self, @@ -1103,12 +1096,6 @@ mod lifecycle_event_tests { ) -> RegistryResult> { Ok(self.active_agreements.clone()) } - async fn get_indexing_agreements_by_indexer_id( - &self, - _indexer_id: &IndexerId, - ) -> RegistryResult> { - unimplemented!() - } // gather_selection_context: no pending agreements. async fn get_pending_agreement_indexers_by_deployment( &self, @@ -1126,12 +1113,6 @@ mod lifecycle_event_tests { ) -> RegistryResult>> { Ok(HashMap::new()) } - async fn get_indexing_agreements_by_indexing_request_id( - &self, - _request_id: &IndexingRequestId, - ) -> RegistryResult> { - unimplemented!() - } // The handler's current-state baseline for the diff. async fn get_active_indexing_agreements_by_indexing_request_id( &self, @@ -1166,24 +1147,11 @@ mod lifecycle_event_tests { ) -> RegistryResult> { Ok(Vec::new()) } - async fn mark_indexing_agreement_as_unresponsive( - &self, - _id: &IndexingAgreementId, - ) -> RegistryResult<()> { - unimplemented!() - } async fn count_created_agreements_by_indexer( &self, ) -> RegistryResult<(std::collections::HashMap, u64)> { Ok((std::collections::HashMap::new(), 0)) } - async fn update_offer_tx_hash( - &self, - _id: &IndexingAgreementId, - _tx_hash: &[u8; 32], - ) -> RegistryResult<()> { - unimplemented!() - } // Cancel path: pre-mark the local row terminal. async fn mark_indexing_agreement_as_canceled_by_requester( &self, @@ -1200,94 +1168,6 @@ mod lifecycle_event_tests { Ok(()) } - async fn reopen_indexing_agreement_cancel( - &self, - _id: &IndexingAgreementId, - ) -> crate::registry::Result<()> { - unimplemented!() - } - - async fn get_cancelling_agreements( - &self, - _batch_size: i64, - _max_attempts: u32, - _min_age_minutes: i32, - ) -> RegistryResult> { - Ok(Vec::new()) - } - - async fn record_cancel_check( - &self, - _id: &IndexingAgreementId, - failed_attempts: u32, - ) -> RegistryResult { - Ok(failed_attempts) - } - async fn apply_reconciliation( - &self, - _id: &IndexingAgreementId, - _apply_accept: bool, - _cancel: Option, - ) -> RegistryResult { - unimplemented!() - } - async fn apply_reconciliation_batch( - &self, - _items: &[ReconciliationItem], - ) -> RegistryResult> { - unimplemented!() - } - async fn get_expired_created_agreements( - &self, - _batch_size: i64, - _chain_timestamp: u64, - ) -> RegistryResult> { - unimplemented!() - } - async fn mark_indexing_agreement_as_expired( - &self, - _id: &IndexingAgreementId, - ) -> RegistryResult<()> { - unimplemented!() - } - async fn mark_indexing_agreement_as_rejected( - &self, - _id: &IndexingAgreementId, - _rejection_reason: Option<&str>, - ) -> RegistryResult<()> { - unimplemented!() - } - async fn get_accepted_on_chain_agreements( - &self, - _batch_size: i64, - ) -> RegistryResult> { - unimplemented!() - } - async fn get_agreements_pending_chain_cancel( - &self, - _batch_size: i64, - ) -> RegistryResult> { - unimplemented!() - } - async fn update_agreement_sync_progress( - &self, - _id: &IndexingAgreementId, - _block_height: u64, - _progress_at: OffsetDateTime, - ) -> RegistryResult<()> { - unimplemented!() - } - async fn count_active_agreements_by_deployment( - &self, - ) -> RegistryResult> { - unimplemented!() - } - async fn mark_indexing_agreement_as_abandoned( - &self, - _id: &IndexingAgreementId, - ) -> RegistryResult { - unimplemented!() - } // gather_selection_context: optimistic DIPs fees (none). async fn get_agreement_fee_rates(&self) -> RegistryResult> { Ok(Vec::new()) diff --git a/bin/dipper-service/src/worker/handlers/send_indexing_agreement_proposal.rs b/bin/dipper-service/src/worker/handlers/send_indexing_agreement_proposal.rs index a3139803..1022faff 100644 --- a/bin/dipper-service/src/worker/handlers/send_indexing_agreement_proposal.rs +++ b/bin/dipper-service/src/worker/handlers/send_indexing_agreement_proposal.rs @@ -415,7 +415,7 @@ mod tests { } #[async_trait] - impl AgreementRegistry for MockRegistry { + impl crate::registry::StubAgreementRegistry for MockRegistry { async fn get_indexing_agreement_by_id( &self, _id: &IndexingAgreementId, @@ -529,30 +529,6 @@ mod tests { Ok(()) } - async fn reopen_indexing_agreement_cancel( - &self, - _id: &IndexingAgreementId, - ) -> crate::registry::Result<()> { - unimplemented!() - } - - async fn get_cancelling_agreements( - &self, - _batch_size: i64, - _max_attempts: u32, - _min_age_minutes: i32, - ) -> crate::registry::Result> { - Ok(Vec::new()) - } - - async fn record_cancel_check( - &self, - _id: &IndexingAgreementId, - failed_attempts: u32, - ) -> crate::registry::Result { - Ok(failed_attempts) - } - async fn apply_reconciliation( &self, _id: &IndexingAgreementId,