Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add lilynext flag #526

Merged
merged 1 commit into from
Mar 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions cmd/lilypad/jobcreator.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,12 @@ func newJobCreatorCmd() *cobra.Command {
RunE: func(cmd *cobra.Command, args []string) error {

network, _ := cmd.Flags().GetString("network")
lilynext, _ := cmd.Flags().GetBool("lilynext")
options, err := optionsfactory.ProcessOnChainJobCreatorOptions(options, args, network)
if err != nil {
return err
}
return runJobCreator(cmd, options, network)
return runJobCreator(cmd, options, network, lilynext)
},
}

Expand All @@ -33,10 +34,14 @@ func newJobCreatorCmd() *cobra.Command {
return solverCmd
}

func runJobCreator(cmd *cobra.Command, options jobcreator.JobCreatorOptions, network string) error {
func runJobCreator(cmd *cobra.Command, options jobcreator.JobCreatorOptions, network string, lilynext bool) error {
commandCtx := system.NewCommandContext(cmd)
defer commandCtx.Cleanup()

if lilynext {
log.Info().Msg("🍃 Running the new lilypad protocol")
}

telemetry, err := configureTelemetry(commandCtx.Ctx, system.JobCreatorService, network, options.Telemetry, nil, options.Web3)
if err != nil {
log.Warn().Msgf("failed to setup opentelemetry: %s", err)
Expand Down
9 changes: 7 additions & 2 deletions cmd/lilypad/resource-provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,14 @@ func newResourceProviderCmd() *cobra.Command {
Example: "",
RunE: func(cmd *cobra.Command, _ []string) error {
network, _ := cmd.Flags().GetString("network")
lilynext, _ := cmd.Flags().GetBool("lilynext")
options, err := optionsfactory.ProcessResourceProviderOptions(options, network)
if err != nil {
return err
}
cmd.SilenceUsage = true

return runResourceProvider(cmd, options, network)
return runResourceProvider(cmd, options, network, lilynext)
},
}

Expand All @@ -35,10 +36,14 @@ func newResourceProviderCmd() *cobra.Command {
return resourceProviderCmd
}

func runResourceProvider(cmd *cobra.Command, options resourceprovider.ResourceProviderOptions, network string) error {
func runResourceProvider(cmd *cobra.Command, options resourceprovider.ResourceProviderOptions, network string, lilynext bool) error {
commandCtx := system.NewCommandContext(cmd)
defer commandCtx.Cleanup()

if lilynext {
log.Info().Msg("🍃 Running the new lilypad protocol")
}

telemetry, err := configureTelemetry(commandCtx.Ctx, system.ResourceProviderService, network, options.Telemetry, nil, options.Web3)
if err != nil {
log.Warn().Msgf("failed to setup opentelemetry: %s", err)
Expand Down
2 changes: 2 additions & 0 deletions cmd/lilypad/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ func NewRootCmd() *cobra.Command {
}

var network string
var lilynext bool
RootCmd.PersistentFlags().StringVarP(&network, "network", "n", "testnet", "Sets a target network configuration")
RootCmd.PersistentFlags().BoolVar(&lilynext, "lilynext", false, "Use the new Lilypad protocol")

RootCmd.AddCommand(newSolverCmd())
RootCmd.AddCommand(newResourceProviderCmd())
Expand Down
9 changes: 7 additions & 2 deletions cmd/lilypad/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,14 @@ func newRunCmd() *cobra.Command {
Example: "run cowsay:v0.0.1 -i Message=moo",
RunE: func(cmd *cobra.Command, args []string) error {
network, _ := cmd.Flags().GetString("network")
lilynext, _ := cmd.Flags().GetBool("lilynext")
options, err := optionsfactory.ProcessJobCreatorOptions(options, args, network)
if err != nil {
return err
}
cmd.SilenceUsage = true

return runJob(cmd, options, network)
return runJob(cmd, options, network, lilynext)
},
}

Expand All @@ -44,7 +45,7 @@ func newRunCmd() *cobra.Command {
return runCmd
}

func runJob(cmd *cobra.Command, options jobcreator.JobCreatorOptions, network string) error {
func runJob(cmd *cobra.Command, options jobcreator.JobCreatorOptions, network string, lilynext bool) error {
c := color.New(color.FgCyan).Add(color.Bold)
header := `
⠀⠀⠀⠀⠀⠀⣀⣤⣤⢠⣤⣀⠀⠀⠀⠀⠀
Expand Down Expand Up @@ -86,6 +87,10 @@ func runJob(cmd *cobra.Command, options jobcreator.JobCreatorOptions, network st
commandCtx := system.NewCommandContext(cmd)
defer commandCtx.Cleanup()

if lilynext {
log.Info().Msg("🍃 Running the new lilypad protocol")
}

telemetry, err := configureTelemetry(commandCtx.Ctx, system.JobCreatorService, network, options.Telemetry, nil, options.Web3)
if err != nil {
log.Warn().Msgf("failed to setup opentelemetry: %s", err)
Expand Down
9 changes: 7 additions & 2 deletions cmd/lilypad/solver.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,14 @@ func newSolverCmd() *cobra.Command {
Example: "",
RunE: func(cmd *cobra.Command, _ []string) error {
network, _ := cmd.Flags().GetString("network")
lilynext, _ := cmd.Flags().GetBool("lilynext")
options, err := optionsfactory.ProcessSolverOptions(options, network)
if err != nil {
return err
}
cmd.SilenceUsage = true

return runSolver(cmd, options, network)
return runSolver(cmd, options, network, lilynext)
},
}

Expand All @@ -40,10 +41,14 @@ func newSolverCmd() *cobra.Command {
return solverCmd
}

func runSolver(cmd *cobra.Command, options solver.SolverOptions, network string) error {
func runSolver(cmd *cobra.Command, options solver.SolverOptions, network string, lilynext bool) error {
commandCtx := system.NewCommandContext(cmd)
defer commandCtx.Cleanup()

if lilynext {
log.Info().Msg("🍃 Running the new lilypad protocol")
}

telemetry, err := configureTelemetry(commandCtx.Ctx, system.SolverService, network, options.Telemetry, &options.Metrics, options.Web3)
if err != nil {
log.Warn().Msgf("failed to setup opentelemetry: %s", err)
Expand Down
Loading