Skip to content

Commit b5bbf93

Browse files
committed
core, node, graph: Ignore graft base in dev mode
1 parent caaf26c commit b5bbf93

File tree

7 files changed

+27
-4
lines changed

7 files changed

+27
-4
lines changed

core/src/subgraph/registrar.rs

+21-4
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,7 @@ where
278278
start_block_override: Option<BlockPtr>,
279279
graft_block_override: Option<BlockPtr>,
280280
history_blocks: Option<i32>,
281+
ignore_graft_base: bool,
281282
) -> Result<DeploymentLocator, SubgraphRegistrarError> {
282283
// We don't have a location for the subgraph yet; that will be
283284
// assigned when we deploy for real. For logging purposes, make up a
@@ -330,6 +331,7 @@ where
330331
self.version_switching_mode,
331332
&resolver,
332333
history_blocks,
334+
ignore_graft_base,
333335
)
334336
.await?
335337
}
@@ -348,6 +350,7 @@ where
348350
self.version_switching_mode,
349351
&resolver,
350352
history_blocks,
353+
ignore_graft_base,
351354
)
352355
.await?
353356
}
@@ -366,6 +369,7 @@ where
366369
self.version_switching_mode,
367370
&resolver,
368371
history_blocks,
372+
ignore_graft_base,
369373
)
370374
.await?
371375
}
@@ -384,6 +388,7 @@ where
384388
self.version_switching_mode,
385389
&resolver,
386390
history_blocks,
391+
ignore_graft_base,
387392
)
388393
.await?
389394
}
@@ -570,6 +575,7 @@ async fn create_subgraph_version<C: Blockchain, S: SubgraphStore>(
570575
version_switching_mode: SubgraphVersionSwitchingMode,
571576
resolver: &Arc<dyn LinkResolver>,
572577
history_blocks_override: Option<i32>,
578+
ignore_graft_base: bool,
573579
) -> Result<DeploymentLocator, SubgraphRegistrarError> {
574580
let raw_string = serde_yaml::to_string(&raw).unwrap();
575581

@@ -591,10 +597,21 @@ async fn create_subgraph_version<C: Blockchain, S: SubgraphStore>(
591597
Err(StoreError::DeploymentNotFound(_)) => true,
592598
Err(e) => return Err(SubgraphRegistrarError::StoreError(e)),
593599
};
594-
let manifest = unvalidated
595-
.validate(store.cheap_clone(), should_validate)
596-
.await
597-
.map_err(SubgraphRegistrarError::ManifestValidationError)?;
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+
};
598615

599616
let network_name: Word = manifest.network_name().into();
600617

graph/src/components/subgraph/registrar.rs

+1
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ pub trait SubgraphRegistrar: Send + Sync + 'static {
4545
start_block_block: Option<BlockPtr>,
4646
graft_block_override: Option<BlockPtr>,
4747
history_blocks: Option<i32>,
48+
ignore_graft_base: bool,
4849
) -> Result<DeploymentLocator, SubgraphRegistrarError>;
4950

5051
async fn remove_subgraph(&self, name: SubgraphName) -> Result<(), SubgraphRegistrarError>;

node/src/dev/helpers.rs

+1
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ async fn deploy_subgraph(
5555
start_block,
5656
None,
5757
None,
58+
true
5859
)
5960
.await
6061
.and_then(|locator| {

node/src/launcher.rs

+1
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,7 @@ fn deploy_subgraph_from_flag(
253253
start_block,
254254
None,
255255
None,
256+
false,
256257
)
257258
.await
258259
}

node/src/manager/commands/run.rs

+1
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,7 @@ pub async fn run(
213213
None,
214214
None,
215215
None,
216+
false,
216217
)
217218
.await?;
218219

server/json-rpc/src/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ impl<R: SubgraphRegistrar> ServerState<R> {
133133
None,
134134
None,
135135
params.history_blocks,
136+
false,
136137
)
137138
.await
138139
{

tests/src/fixture/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -612,6 +612,7 @@ pub async fn setup_inner<C: Blockchain>(
612612
None,
613613
graft_block,
614614
None,
615+
false,
615616
)
616617
.await
617618
.expect("failed to create subgraph version");

0 commit comments

Comments
 (0)