Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bin/dipper-service/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
29 changes: 8 additions & 21 deletions bin/dipper-service/src/network/service/chain_listener.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -2200,23 +2200,6 @@ mod tests {
Ok(())
}

async fn get_cancelling_agreements(
&self,
_batch_size: i64,
_max_attempts: u32,
_min_age_minutes: i32,
) -> RegistryResult<Vec<crate::registry::CancellingAgreement>> {
Ok(Vec::new())
}

async fn record_cancel_check(
&self,
_id: &IndexingAgreementId,
failed_attempts: u32,
) -> RegistryResult<u32> {
Ok(failed_attempts)
}

async fn record_cancel_audit(
&self,
agreement_id: &IndexingAgreementId,
Expand Down Expand Up @@ -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)
Expand Down
130 changes: 5 additions & 125 deletions bin/dipper-service/src/worker/handlers/reassess_indexing_request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand Down Expand Up @@ -1089,26 +1088,14 @@ mod lifecycle_event_tests {
}

#[async_trait]
impl AgreementRegistry for MockRegistry {
async fn get_indexing_agreement_by_id(
&self,
_id: &IndexingAgreementId,
) -> RegistryResult<Option<IndexingAgreement>> {
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,
_deployment_id: &DeploymentId,
) -> RegistryResult<Vec<IndexingAgreement>> {
Ok(self.active_agreements.clone())
}
async fn get_indexing_agreements_by_indexer_id(
&self,
_indexer_id: &IndexerId,
) -> RegistryResult<Vec<IndexingAgreement>> {
unimplemented!()
}
// gather_selection_context: no pending agreements.
async fn get_pending_agreement_indexers_by_deployment(
&self,
Expand All @@ -1126,12 +1113,6 @@ mod lifecycle_event_tests {
) -> RegistryResult<HashMap<DeploymentId, Vec<IndexerId>>> {
Ok(HashMap::new())
}
async fn get_indexing_agreements_by_indexing_request_id(
&self,
_request_id: &IndexingRequestId,
) -> RegistryResult<Vec<IndexingAgreement>> {
unimplemented!()
}
// The handler's current-state baseline for the diff.
async fn get_active_indexing_agreements_by_indexing_request_id(
&self,
Expand Down Expand Up @@ -1166,24 +1147,11 @@ mod lifecycle_event_tests {
) -> RegistryResult<Vec<IndexerId>> {
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<IndexerId, u64>, 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,
Expand All @@ -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<Vec<crate::registry::CancellingAgreement>> {
Ok(Vec::new())
}

async fn record_cancel_check(
&self,
_id: &IndexingAgreementId,
failed_attempts: u32,
) -> RegistryResult<u32> {
Ok(failed_attempts)
}
async fn apply_reconciliation(
&self,
_id: &IndexingAgreementId,
_apply_accept: bool,
_cancel: Option<CancelKind>,
) -> RegistryResult<ReconciliationOutcome> {
unimplemented!()
}
async fn apply_reconciliation_batch(
&self,
_items: &[ReconciliationItem],
) -> RegistryResult<HashMap<IndexingAgreementId, ReconciliationOutcome>> {
unimplemented!()
}
async fn get_expired_created_agreements(
&self,
_batch_size: i64,
_chain_timestamp: u64,
) -> RegistryResult<Vec<IndexingAgreement>> {
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<Vec<IndexingAgreement>> {
unimplemented!()
}
async fn get_agreements_pending_chain_cancel(
&self,
_batch_size: i64,
) -> RegistryResult<Vec<IndexingAgreement>> {
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<HashMap<DeploymentId, usize>> {
unimplemented!()
}
async fn mark_indexing_agreement_as_abandoned(
&self,
_id: &IndexingAgreementId,
) -> RegistryResult<IndexingAgreement> {
unimplemented!()
}
// gather_selection_context: optimistic DIPs fees (none).
async fn get_agreement_fee_rates(&self) -> RegistryResult<Vec<AgreementFeeRate>> {
Ok(Vec::new())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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<Vec<crate::registry::CancellingAgreement>> {
Ok(Vec::new())
}

async fn record_cancel_check(
&self,
_id: &IndexingAgreementId,
failed_attempts: u32,
) -> crate::registry::Result<u32> {
Ok(failed_attempts)
}

async fn apply_reconciliation(
&self,
_id: &IndexingAgreementId,
Expand Down
Loading