Skip to content

Commit

Permalink
fix 'substreams run' detection of output_module
Browse files Browse the repository at this point in the history
  • Loading branch information
sduchesneau committed Nov 11, 2024
1 parent 441f7e6 commit 977e922
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion cmd/substreams/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,15 @@ func runRun(cmd *cobra.Command, args []string) error {
}

readerOptions := []manifest.Option{
manifest.WithOverrideOutputModule(outputModule),
manifest.WithOverrideNetwork(network),
manifest.WithParams(params),
manifest.WithRegistryURL(getSubstreamsRegistryEndpoint()),
}

if outputModule != "" {
readerOptions = append(readerOptions, manifest.WithOverrideOutputModule(outputModule))
}

if sflags.MustGetBool(cmd, "skip-package-validation") {
readerOptions = append(readerOptions, manifest.SkipPackageValidationReader())
}
Expand Down Expand Up @@ -130,6 +134,14 @@ func runRun(cmd *cobra.Command, args []string) error {
return fmt.Errorf("stop block: %w", err)
}

if outputModule == "" {
mods, ok := pkgBundle.Graph.TopologicalSort()
if ok {
outputModule = mods[0].Name
fmt.Printf("Selected output module: %s\n", outputModule)
}
}

if readFromModule {
sb, err := pkgBundle.Graph.ModuleInitialBlock(outputModule)
if err != nil {
Expand Down

0 comments on commit 977e922

Please sign in to comment.