diff --git a/crates/dips/src/lib.rs b/crates/dips/src/lib.rs index 5fe6f912b..ca23e2d9f 100644 --- a/crates/dips/src/lib.rs +++ b/crates/dips/src/lib.rs @@ -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 { + 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: diff --git a/crates/dips/src/server.rs b/crates/dips/src/server.rs index caef201c8..84a10682c 100644 --- a/crates/dips/src/server.rs +++ b/crates/dips/src/server.rs @@ -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, @@ -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(),