Rename web3 provider flag to execution endpoint (#11133)

* Rename web3 provider flag to execution endpoint

* Fix test

* Add aliase and update default port

* Rm alias
This commit is contained in:
terencechain
2022-08-11 13:39:55 -07:00
committed by GitHub
parent 6b42a0a3a1
commit d72e42bbb8
6 changed files with 16 additions and 22 deletions

View File

@@ -64,20 +64,14 @@ func parseJWTSecretFromFile(c *cli.Context) ([]byte, error) {
}
func parseExecutionChainEndpoint(c *cli.Context) []string {
if c.String(flags.HTTPWeb3ProviderFlag.Name) == "" && len(c.StringSlice(flags.FallbackWeb3ProviderFlag.Name)) == 0 {
if c.String(flags.ExecutionEngineEndpoint.Name) == "" && len(c.StringSlice(flags.FallbackWeb3ProviderFlag.Name)) == 0 {
log.Error(
"No ETH1 node specified to run with the beacon node. " +
"Please consider running your own Ethereum proof-of-work node for better uptime, " +
"security, and decentralization of Ethereum. Visit " +
"No execution engine specified to run with the beacon node. " +
"You must specified an execution client in order to participate. Visit " +
"https://docs.prylabs.network/docs/prysm-usage/setup-eth1 for more information",
)
log.Error(
"You will need to specify --http-web3provider and/or --fallback-web3provider to attach " +
"an eth1 node to the prysm node. Without an eth1 node block proposals for your " +
"validator will be affected and the beacon node will not be able to initialize the genesis state",
)
}
endpoints := []string{c.String(flags.HTTPWeb3ProviderFlag.Name)}
endpoints := []string{c.String(flags.ExecutionEngineEndpoint.Name)}
endpoints = append(endpoints, c.StringSlice(flags.FallbackWeb3ProviderFlag.Name)...)
return endpoints
}

View File

@@ -18,7 +18,7 @@ import (
func TestExecutionchainCmd(t *testing.T) {
app := cli.App{}
set := flag.NewFlagSet("test", 0)
set.String(flags.HTTPWeb3ProviderFlag.Name, "primary", "")
set.String(flags.ExecutionEngineEndpoint.Name, "primary", "")
fallback := cli.StringSlice{}
err := fallback.Set("fallback1")
require.NoError(t, err)
@@ -101,10 +101,10 @@ func TestPowchainPreregistration_EmptyWeb3Provider(t *testing.T) {
hook := logTest.NewGlobal()
app := cli.App{}
set := flag.NewFlagSet("test", 0)
set.String(flags.HTTPWeb3ProviderFlag.Name, "", "")
set.String(flags.ExecutionEngineEndpoint.Name, "", "")
fallback := cli.StringSlice{}
set.Var(&fallback, flags.FallbackWeb3ProviderFlag.Name, "")
ctx := cli.NewContext(&app, set, nil)
parseExecutionChainEndpoint(ctx)
assert.LogsContain(t, hook, "No ETH1 node specified to run with the beacon node")
assert.LogsContain(t, hook, "No execution engine specified to run with the beacon node. You must specified an execution client in order to participate")
}

View File

@@ -16,11 +16,11 @@ var (
Usage: "A MEV builder relay string http endpoint, this wil be used to interact MEV builder network using API defined in: https://ethereum.github.io/builder-specs/#/Builder",
Value: "",
}
// HTTPWeb3ProviderFlag provides an HTTP access endpoint to an ETH 1.0 RPC.
HTTPWeb3ProviderFlag = &cli.StringFlag{
Name: "http-web3provider",
Usage: "A mainchain web3 provider string http endpoint. Can contain auth header as well in the format --http-web3provider=\"https://goerli.infura.io/v3/xxxx,Basic xxx\" for project secret (base64 encoded) and --http-web3provider=\"https://goerli.infura.io/v3/xxxx,Bearer xxx\" for jwt use",
Value: "http://localhost:8545",
// ExecutionEngineEndpoint provides an HTTP access endpoint to connect to an execution client on the execution layer
ExecutionEngineEndpoint = &cli.StringFlag{
Name: "execution-endpoint",
Usage: "An execution client http endpoint. Can contain auth header as well in the format",
Value: "http://localhost:8551",
}
// ExecutionJWTSecretFlag provides a path to a file containing a hex-encoded string representing a 32 byte secret
// used to authenticate with an execution node via HTTP. This is required if using an HTTP connection, otherwise all requests

View File

@@ -37,7 +37,7 @@ import (
var appFlags = []cli.Flag{
flags.DepositContractFlag,
flags.HTTPWeb3ProviderFlag,
flags.ExecutionEngineEndpoint,
flags.ExecutionJWTSecretFlag,
flags.FallbackWeb3ProviderFlag,
flags.RPCHost,
@@ -186,7 +186,7 @@ func main() {
log.WithError(err).Error("Failed to configuring logging to disk.")
}
}
if err := cmd.ExpandSingleEndpointIfFile(ctx, flags.HTTPWeb3ProviderFlag); err != nil {
if err := cmd.ExpandSingleEndpointIfFile(ctx, flags.ExecutionEngineEndpoint); err != nil {
return err
}
if err := cmd.ExpandWeb3EndpointsIfFile(ctx, flags.FallbackWeb3ProviderFlag); err != nil {

View File

@@ -108,7 +108,7 @@ var appHelpFlagGroups = []flagGroup{
flags.GRPCGatewayHost,
flags.GRPCGatewayPort,
flags.GPRCGatewayCorsDomain,
flags.HTTPWeb3ProviderFlag,
flags.ExecutionEngineEndpoint,
flags.ExecutionJWTSecretFlag,
flags.FallbackWeb3ProviderFlag,
flags.SetGCPercent,

View File

@@ -196,7 +196,7 @@ func (node *BeaconNode) Start(ctx context.Context) error {
fmt.Sprintf("--%s=%s", cmdshared.LogFileName.Name, stdOutFile.Name()),
fmt.Sprintf("--%s=%s", flags.DepositContractFlag.Name, e2e.TestParams.ContractAddress.Hex()),
fmt.Sprintf("--%s=%d", flags.RPCPort.Name, e2e.TestParams.Ports.PrysmBeaconNodeRPCPort+index),
fmt.Sprintf("--%s=http://127.0.0.1:%d", flags.HTTPWeb3ProviderFlag.Name, e2e.TestParams.Ports.Eth1ProxyPort+index),
fmt.Sprintf("--%s=http://127.0.0.1:%d", flags.ExecutionEngineEndpoint.Name, e2e.TestParams.Ports.Eth1ProxyPort+index),
fmt.Sprintf("--%s=%s", flags.ExecutionJWTSecretFlag.Name, jwtPath),
fmt.Sprintf("--%s=%d", flags.MinSyncPeers.Name, 1),
fmt.Sprintf("--%s=%d", cmdshared.P2PUDPPort.Name, e2e.TestParams.Ports.PrysmBeaconNodeUDPPort+index),