Skip to content
Open
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
10 changes: 10 additions & 0 deletions crates/dips/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,16 @@ fn bytes32_to_ipfs_hash(bytes: &[u8; 32]) -> String {
bs58::encode(&multihash).into_string()
}

/// Try to extract the deployment ID from raw signed RCA bytes.
///
/// Best-effort: returns `None` if any decoding step fails.
pub(crate) fn try_extract_deployment_id(rca_bytes: &[u8]) -> Option<String> {
let signed_rca = SignedRecurringCollectionAgreement::abi_decode(rca_bytes).ok()?;
let metadata =
AcceptIndexingAgreementMetadata::abi_decode(signed_rca.agreement.metadata.as_ref()).ok()?;
Some(bytes32_to_ipfs_hash(&metadata.subgraphDeploymentId.0))
}

/// Validate and create a RecurringCollectionAgreement.
///
/// Performs validation:
Expand Down
8 changes: 7 additions & 1 deletion crates/dips/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ impl IndexerDipsService for DipsServer {

// Validate and store RCA
let domain = crate::rca_eip712_domain(self.chain_id, self.recurring_collector);
let deployment_id = crate::try_extract_deployment_id(&signed_voucher);
match crate::validate_and_create_rca(
self.ctx.clone(),
&domain,
Expand All @@ -169,7 +170,12 @@ impl IndexerDipsService for DipsServer {
}
Err(e) => {
let reject_reason = reject_reason_from_error(&e);
tracing::warn!(error = %e, reason = ?reject_reason, "RCA rejected");
tracing::info!(
error = %e,
reason = ?reject_reason,
deployment_id = deployment_id.as_deref().unwrap_or("unknown"),
"RCA proposal rejected"
);
Ok(Response::new(SubmitAgreementProposalResponse {
response: ProposalResponse::Reject.into(),
reject_reason: reject_reason.into(),
Expand Down
Loading