Skip to content

Commit 85b9765

Browse files
committed
core, node, graph: Manipulate raw manifest instead of passing
ignore_graft_base This reverts commit b5bbf93.
1 parent 1423ae3 commit 85b9765

File tree

2 files changed

+26
-33
lines changed

2 files changed

+26
-33
lines changed

core/src/subgraph/registrar.rs

Lines changed: 25 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -293,18 +293,27 @@ where
293293
.map_err(SubgraphRegistrarError::Unknown)?,
294294
);
295295

296-
let raw: serde_yaml::Mapping = {
297-
let file_bytes = resolver
298-
.cat(&logger, &hash.to_ipfs_link())
299-
.await
300-
.map_err(|e| {
301-
SubgraphRegistrarError::ResolveError(
302-
SubgraphManifestResolveError::ResolveError(e),
303-
)
304-
})?;
305-
306-
serde_yaml::from_slice(&file_bytes)
307-
.map_err(|e| SubgraphRegistrarError::ResolveError(e.into()))?
296+
let raw = {
297+
let mut raw: serde_yaml::Mapping = {
298+
let file_bytes =
299+
resolver
300+
.cat(&logger, &hash.to_ipfs_link())
301+
.await
302+
.map_err(|e| {
303+
SubgraphRegistrarError::ResolveError(
304+
SubgraphManifestResolveError::ResolveError(e),
305+
)
306+
})?;
307+
308+
serde_yaml::from_slice(&file_bytes)
309+
.map_err(|e| SubgraphRegistrarError::ResolveError(e.into()))?
310+
};
311+
312+
if ignore_graft_base {
313+
raw.remove("graft");
314+
}
315+
316+
raw
308317
};
309318

310319
let kind = BlockchainKind::from_manifest(&raw).map_err(|e| {
@@ -331,7 +340,6 @@ where
331340
self.version_switching_mode,
332341
&resolver,
333342
history_blocks,
334-
ignore_graft_base,
335343
)
336344
.await?
337345
}
@@ -350,7 +358,6 @@ where
350358
self.version_switching_mode,
351359
&resolver,
352360
history_blocks,
353-
ignore_graft_base,
354361
)
355362
.await?
356363
}
@@ -369,7 +376,6 @@ where
369376
self.version_switching_mode,
370377
&resolver,
371378
history_blocks,
372-
ignore_graft_base,
373379
)
374380
.await?
375381
}
@@ -388,7 +394,6 @@ where
388394
self.version_switching_mode,
389395
&resolver,
390396
history_blocks,
391-
ignore_graft_base,
392397
)
393398
.await?
394399
}
@@ -575,7 +580,6 @@ async fn create_subgraph_version<C: Blockchain, S: SubgraphStore>(
575580
version_switching_mode: SubgraphVersionSwitchingMode,
576581
resolver: &Arc<dyn LinkResolver>,
577582
history_blocks_override: Option<i32>,
578-
ignore_graft_base: bool,
579583
) -> Result<DeploymentLocator, SubgraphRegistrarError> {
580584
let raw_string = serde_yaml::to_string(&raw).unwrap();
581585

@@ -597,21 +601,10 @@ async fn create_subgraph_version<C: Blockchain, S: SubgraphStore>(
597601
Err(StoreError::DeploymentNotFound(_)) => true,
598602
Err(e) => return Err(SubgraphRegistrarError::StoreError(e)),
599603
};
600-
601-
let manifest = {
602-
let should_validate = should_validate && !ignore_graft_base;
603-
604-
let mut manifest = unvalidated
605-
.validate(store.cheap_clone(), should_validate)
606-
.await
607-
.map_err(SubgraphRegistrarError::ManifestValidationError)?;
608-
609-
if ignore_graft_base {
610-
manifest.graft = None;
611-
}
612-
613-
manifest
614-
};
604+
let manifest = unvalidated
605+
.validate(store.cheap_clone(), should_validate)
606+
.await
607+
.map_err(SubgraphRegistrarError::ManifestValidationError)?;
615608

616609
let network_name: Word = manifest.network_name().into();
617610

node/src/dev/helpers.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ async fn deploy_subgraph(
5353
start_block,
5454
None,
5555
None,
56-
true
56+
true,
5757
)
5858
.await
5959
.and_then(|locator| {

0 commit comments

Comments
 (0)