Skip to content

Commit 14a3590

Browse files
committed
fix(dips): re-add the manifest network check
1 parent 421df79 commit 14a3590

File tree

1 file changed

+16
-13
lines changed

1 file changed

+16
-13
lines changed

crates/dips/src/lib.rs

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -325,19 +325,6 @@ pub async fn validate_and_create_agreement(
325325
decoded_voucher.validate(signer_validator, domain, expected_payee, allowed_payers)?;
326326

327327
let manifest = ipfs_fetcher.fetch(&metadata.subgraphDeploymentId).await?;
328-
match manifest.network() {
329-
Some(network_name) => {
330-
tracing::debug!("Subgraph manifest network: {}", network_name);
331-
// TODO: Check if the network is supported
332-
// This will require a mapping of network names to chain IDs
333-
// by querying the supported networks from the EBO subgraph
334-
}
335-
None => {
336-
return Err(DipsError::InvalidSubgraphManifest(
337-
metadata.subgraphDeploymentId,
338-
))
339-
}
340-
}
341328

342329
let network = match registry.get_network_by_id(&metadata.chainId) {
343330
Some(network) => network.id.clone(),
@@ -347,6 +334,22 @@ pub async fn validate_and_create_agreement(
347334
},
348335
};
349336

337+
match manifest.network() {
338+
Some(manifest_network_name) => {
339+
tracing::debug!("Subgraph manifest network: {}", manifest_network_name);
340+
if manifest_network_name != network {
341+
return Err(DipsError::InvalidSubgraphManifest(
342+
metadata.subgraphDeploymentId,
343+
));
344+
}
345+
}
346+
None => {
347+
return Err(DipsError::InvalidSubgraphManifest(
348+
metadata.subgraphDeploymentId,
349+
))
350+
}
351+
}
352+
350353
let offered_epoch_price = metadata.basePricePerEpoch;
351354
match price_calculator.get_minimum_price(&metadata.chainId) {
352355
Some(price) if offered_epoch_price.lt(&Uint::from(price)) => {

0 commit comments

Comments
 (0)