diff --git a/CHANGELOG.md b/CHANGELOG.md index 667ea9ce90ce..350a871ef228 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,8 +24,8 @@ The format is based on Keep a Changelog, and this project adheres to Semantic Ve - "Submitted builder validator registration settings for custom builders" log message moved to debug level. - config: Genesis validator root is now hardcoded in params.BeaconConfig() - `grpc-gateway-host` is renamed to http-host. The old name can still be used as an alias. -- `grpc-gateway-port` is renamed to http-port. -- `grpc-gateway-corsdomain` is renamed to http-cors-domain. +- `grpc-gateway-port` is renamed to http-port. The old name can still be used as an alias. +- `grpc-gateway-corsdomain` is renamed to http-cors-domain. The old name can still be used as an alias. - `api-timeout` is changed from int flag to duration flag, default value updated. ### Deprecated diff --git a/beacon-chain/node/config_test.go b/beacon-chain/node/config_test.go index f2c08f380b51..4c045f4dcd1b 100644 --- a/beacon-chain/node/config_test.go +++ b/beacon-chain/node/config_test.go @@ -228,3 +228,26 @@ func TestConfigureInterop(t *testing.T) { }) } } + +func TestAliasFlag(t *testing.T) { + // Create a new app with the flag + app := &cli.App{ + Flags: []cli.Flag{flags.HTTPServerHost}, + Action: func(c *cli.Context) error { + // Test if the alias works and sets the flag correctly + if c.IsSet("grpc-gateway-host") && c.IsSet("http-host") { + return nil + } + return cli.Exit("Alias or flag not set", 1) + }, + } + + // Simulate command line arguments that include the alias + args := []string{"app", "--grpc-gateway-host", "config.yml"} + + // Run the app with the simulated arguments + err := app.Run(args) + + // Check if the alias set the flag correctly + assert.NoError(t, err) +} diff --git a/cmd/validator/flags/flags.go b/cmd/validator/flags/flags.go index fbacc9ca9752..e873d16c3f20 100644 --- a/cmd/validator/flags/flags.go +++ b/cmd/validator/flags/flags.go @@ -120,7 +120,7 @@ var ( } // HTTPServerCorsDomain adds accepted cross origin request addresses. HTTPServerCorsDomain = &cli.StringFlag{ - Name: "corsdomain", + Name: "http-cors-domain", Usage: `Comma separated list of domains from which to accept cross origin requests (browser enforced).`, Value: "http://localhost:7500,http://127.0.0.1:7500,http://0.0.0.0:7500,http://localhost:4242,http://127.0.0.1:4242,http://localhost:4200,http://0.0.0.0:4242,http://127.0.0.1:4200,http://0.0.0.0:4200,http://localhost:3000,http://0.0.0.0:3000,http://127.0.0.1:3000", Aliases: []string{"grpc-gateway-corsdomain"}, diff --git a/testing/endtoend/components/validator.go b/testing/endtoend/components/validator.go index 580b74be8fff..4135c99539c0 100644 --- a/testing/endtoend/components/validator.go +++ b/testing/endtoend/components/validator.go @@ -221,12 +221,13 @@ func (v *ValidatorNode) Start(ctx context.Context) error { if err != nil { return err } + portFlagName := "grpc-gateway-port" // TODO: replace port flag name with flags.HTTPServerPort.Name in a future release args := []string{ fmt.Sprintf("--%s=%s/eth2-val-%d", cmdshared.DataDirFlag.Name, e2e.TestParams.TestPath, index), fmt.Sprintf("--%s=%s", cmdshared.LogFileName.Name, logFile.Name()), fmt.Sprintf("--%s=%s", flags.GraffitiFileFlag.Name, gFile), fmt.Sprintf("--%s=%d", flags.MonitoringPortFlag.Name, e2e.TestParams.Ports.ValidatorMetricsPort+index), - fmt.Sprintf("--%s=%d", flags.HTTPServerPort.Name, e2e.TestParams.Ports.ValidatorHTTPPort+index), + fmt.Sprintf("--%s=%d", portFlagName, e2e.TestParams.Ports.ValidatorHTTPPort+index), fmt.Sprintf("--%s=localhost:%d", flags.BeaconRPCProviderFlag.Name, beaconRPCPort), fmt.Sprintf("--%s=%s", flags.GRPCHeadersFlag.Name, "dummy=value,foo=bar"), // Sending random headers shouldn't break anything.