Skip to content

run contender #185

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

Merged
merged 5 commits into from
Jul 24, 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
4 changes: 3 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ var networkName string
var labels playground.MapStringFlag
var disableLogs bool
var platform string
var contenderEnabled bool

var rootCmd = &cobra.Command{
Use: "playground",
Expand Down Expand Up @@ -179,6 +180,7 @@ func main() {
recipeCmd.Flags().Var(&labels, "labels", "list of labels to apply to the resources")
recipeCmd.Flags().BoolVar(&disableLogs, "disable-logs", false, "disable logs")
recipeCmd.Flags().StringVar(&platform, "platform", "", "docker platform to use")
recipeCmd.Flags().BoolVar(&contenderEnabled, "contender", false, "spam nodes with contender")

cookCmd.AddCommand(recipeCmd)
}
Expand Down Expand Up @@ -224,7 +226,7 @@ func runIt(recipe playground.Recipe) error {
return err
}

svcManager := recipe.Apply(&playground.ExContext{LogLevel: logLevel}, artifacts)
svcManager := recipe.Apply(&playground.ExContext{LogLevel: logLevel, ContenderEnabled: contenderEnabled}, artifacts)
if err := svcManager.Validate(); err != nil {
return fmt.Errorf("failed to validate manifest: %w", err)
}
Expand Down
1 change: 1 addition & 0 deletions playground/catalog.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ func init() {
register(&nullService{})
register(&OpRbuilder{})
register(&FlashblocksRPC{})
register(&Contender{})
}

func FindComponent(name string) ServiceGen {
Expand Down
22 changes: 22 additions & 0 deletions playground/components.go
Original file line number Diff line number Diff line change
Expand Up @@ -717,3 +717,25 @@ func (n *nullService) Run(service *Service, ctx *ExContext) {
func (n *nullService) Name() string {
return "null"
}

type Contender struct {
}

func (c *Contender) Name() string {
return "contender"
}

func (c *Contender) Run(service *Service, ctx *ExContext) {
args := []string{
"spam",
"-l", // loop indefinitely
"--min-balance", "10 ether", // give each spammer 10 ether (sender must have 100 ether because default number of spammers is 10)
"-r", Connect("el", "http"), // connect to whatever EL node is available
"--tps", "20", // send 20 txs per second
}
service.WithImage("flashbots/contender").
WithTag("latest").
WithArgs(args...).
DependsOnHealthy("beacon")

}
2 changes: 2 additions & 0 deletions playground/manifest.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ type ExContext struct {
// Bootnode reference for EL nodes.
// TODO: Extend for CL nodes too
Bootnode *BootnodeRef

ContenderEnabled bool
}

type BootnodeRef struct {
Expand Down
4 changes: 4 additions & 0 deletions playground/recipe_buildernet.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ func (b *BuilderNetRecipe) Apply(ctx *ExContext, artifacts *Artifacts) *Manifest
})
}

if ctx.ContenderEnabled {
svcManager.AddService("contender", &Contender{})
}

return svcManager
}

Expand Down
5 changes: 5 additions & 0 deletions playground/recipe_l1.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,11 @@ func (l *L1Recipe) Apply(ctx *ExContext, artifacts *Artifacts) *Manifest {
ValidationServer: mevBoostValidationServer,
})
}

if ctx.ContenderEnabled {
svcManager.AddService("contender", &Contender{})
}

return svcManager
}

Expand Down
5 changes: 5 additions & 0 deletions playground/recipe_opstack.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,11 @@ func (o *OpRecipe) Apply(ctx *ExContext, artifacts *Artifacts) *Manifest {
RollupNode: "op-node",
MaxChannelDuration: o.batcherMaxChannelDuration,
})

if ctx.ContenderEnabled {
svcManager.AddService("contender", &Contender{})
}

return svcManager
}

Expand Down