Skip to content

Commit

Permalink
add dv extra flags feature
Browse files Browse the repository at this point in the history
  • Loading branch information
sugh01 committed Aug 12, 2024
1 parent 0d280e5 commit ad0fe03
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 1 deletion.
2 changes: 2 additions & 0 deletions cli/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ type GenCmdFlags struct {
elExtraFlags []string
clExtraFlags []string
vlExtraFlags []string
dvExtraFlags []string
relayURLs []string
mevBoostUrl string
executionApiUrl string
Expand Down Expand Up @@ -292,6 +293,7 @@ func runGenCmd(out io.Writer, flags *GenCmdFlags, sedgeAction actions.SedgeActio
ElExtraFlags: flags.elExtraFlags,
ClExtraFlags: flags.clExtraFlags,
VlExtraFlags: flags.vlExtraFlags,
DvExtraFlags: flags.dvExtraFlags,
MapAllPorts: flags.mapAllPorts,
Mev: !flags.noMev && utils.Contains(services, validator) && utils.Contains(services, consensus) && !flags.noValidator,
MevImage: flags.mevImage,
Expand Down
1 change: 1 addition & 0 deletions cli/sub_gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ Additionally, you can use this syntax '<CLIENT>:<DOCKER_IMAGE>' to override the
cmd.Flags().StringArrayVar(&flags.elExtraFlags, "el-extra-flag", []string{}, "Additional flag to configure the execution client service in the generated docker-compose script. Example: 'sedge generate full-node --el-extra-flag \"<flag1>=value1\" --el-extra-flag \"<flag2>=\\\"value2\\\"\"'")
cmd.Flags().StringArrayVar(&flags.clExtraFlags, "cl-extra-flag", []string{}, "Additional flag to configure the consensus client service in the generated docker-compose script. Example: 'sedge generate full-node --cl-extra-flag \"<flag1>=value1\" --cl-extra-flag \"<flag2>=\\\"value2\\\"\"'")
cmd.Flags().StringArrayVar(&flags.vlExtraFlags, "vl-extra-flag", []string{}, "Additional flag to configure the validator client service in the generated docker-compose script. Example: 'sedge generate full-node --vl-extra-flag \"<flag1>=value1\" --vl-extra-flag \"<flag2>=\\\"value2\\\"\"'")
cmd.Flags().StringArrayVar(&flags.dvExtraFlags, "dv-extra-flag", []string{}, "Additional flag to configure the distributed validator client service in the generated docker-compose script. Example: 'sedge generate full-node --distributed --dv-extra-flag \"<flag1>=value1\" --dv-extra-flag \"<flag2>=\\\"value2\\\"\"'")
cmd.Flags().StringVar(&flags.customChainSpec, "custom-chainSpec", "", "File path or url to use as custom network chainSpec for execution client.")
cmd.Flags().StringVar(&flags.customNetworkConfig, "custom-config", "", "File path or url to use as custom network config file for consensus client.")
cmd.Flags().StringVar(&flags.customGenesis, "custom-genesis", "", "File path or url to use as custom network genesis for consensus client.")
Expand Down
1 change: 1 addition & 0 deletions docs/docs/commands/generate.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ Flags:
--el-extra-flag stringArray Additional flag to configure the execution client service in the generated docker-compose script. Example: 'sedge generate full-node --el-extra-flag "<flag1>=value1" --el-extra-flag "<flag2>=\"value2\""'
--cl-extra-flag stringArray Additional flag to configure the consensus client service in the generated docker-compose script. Example: 'sedge generate full-node --cl-extra-flag "<flag1>=value1" --cl-extra-flag "<flag2>=\"value2\""'
--vl-extra-flag stringArray Additional flag to configure the validator client service in the generated docker-compose script. Example: 'sedge generate full-node --vl-extra-flag "<flag1>=value1" --vl-extra-flag "<flag2>=\"value2\""'
--dv-extra-flag stringArray Additional flag to configure the distributed validator client service in the generated docker-compose script. Example: 'sedge generate full-node --distributed --dv-extra-flag "<flag1>=value1" --dv-extra-flag "CHARON_FEATURE_SET=\"alpha\""'
--custom-chainSpec string File path or url to use as custom network chainSpec for execution client.
--custom-config string File path or url to use as custom network config file for consensus client.
--custom-genesis string File path or url to use as custom network genesis for consensus client.
Expand Down
1 change: 1 addition & 0 deletions internal/pkg/generate/generate_scripts.go
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,7 @@ func ComposeFile(gd *GenData, at io.Writer) error {
ElExtraFlags: gd.ElExtraFlags,
ClExtraFlags: gd.ClExtraFlags,
VlExtraFlags: gd.VlExtraFlags,
DvExtraFlags: gd.DvExtraFlags,
ECBootnodes: strings.Join(gd.ECBootnodes, ","),
CCBootnodes: strings.Join(gd.CCBootnodes, ","),
CCBootnodesList: gd.CCBootnodes,
Expand Down
1 change: 1 addition & 0 deletions internal/pkg/generate/generate_scripts_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,7 @@ func TestGenerateComposeServices(t *testing.T) {
Distributed: true,
Network: "holesky",
Services: []string{execution, consensus, validator, distributedValidator},
DvExtraFlags: []string{"extra", "flag"},
},
CheckFunctions: []CheckFunc{defaultFunc, checkValidatorBlocker},
},
Expand Down
2 changes: 2 additions & 0 deletions internal/pkg/generate/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ type GenData struct {
ElExtraFlags []string
ClExtraFlags []string
VlExtraFlags []string
DvExtraFlags []string
MapAllPorts bool
Mev bool
RelayURLs []string
Expand Down Expand Up @@ -116,6 +117,7 @@ type DockerComposeData struct {
ElExtraFlags []string
ClExtraFlags []string
VlExtraFlags []string
DvExtraFlags []string
ECBootnodes string
CCBootnodes string
CCBootnodesList []string
Expand Down
5 changes: 4 additions & 1 deletion templates/services/merge/distributedValidator/charon.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@
- CHARON_P2P_TCP_ADDRESS=0.0.0.0:{{.DVDiscoveryPort}}
- CHARON_VALIDATOR_API_ADDRESS=127.0.0.1:{{.DVApiPort}}
- CHARON_MONITORING_ADDRESS=0.0.0.0:{{.DVMetricsPort}}{{if .MevBoostOnValidator}}
- CHARON_BUILDER_API={{.MevBoostOnValidator}}{{end}}
- CHARON_BUILDER_API={{.MevBoostOnValidator}}{{end}}
{{- range $i, $flag := .DvExtraFlags }}
- {{$flag}}
{{- end }}
ports:
- ${CHARON_PORT_P2P_TCP:-{{.DVDiscoveryPort}}}:${CHARON_PORT_P2P_TCP:-{{.DVDiscoveryPort}}}/tcp
expose:
Expand Down

0 comments on commit ad0fe03

Please sign in to comment.