mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-10 05:47:59 -05:00
Compare commits
6 Commits
beacon-cha
...
v3.0.0-rc.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1c6fa65f7b | ||
|
|
eaa2566e90 | ||
|
|
6957f0637f | ||
|
|
01b1f15bdf | ||
|
|
b787fd877a | ||
|
|
2c89ce810d |
@@ -65,7 +65,6 @@ func (s *Service) pollConnectionStatus(ctx context.Context) {
|
||||
currClient := s.rpcClient
|
||||
if err := s.setupExecutionClientConnections(ctx, s.cfg.currHttpEndpoint); err != nil {
|
||||
errorLogger(err, "Could not connect to execution client endpoint")
|
||||
s.retryExecutionClientConnection(ctx, err)
|
||||
continue
|
||||
}
|
||||
// Close previous client, if connection was successful.
|
||||
|
||||
@@ -6,12 +6,6 @@ datadir: /var/lib/prysm/beacon
|
||||
# http-web3provider: ETH1 API endpoint, eg. http://localhost:8545 for a local geth service on the default port
|
||||
http-web3provider: http://localhost:8545
|
||||
|
||||
# fallback-web3provider: List of backup ETH1 API endpoints, used if above is not working
|
||||
# For example:
|
||||
# fallback-web3provider:
|
||||
# - https://mainnet.infura.io/v3/YOUR-PROJECT-ID
|
||||
# - https://eth-mainnet.alchemyapi.io/v2/YOUR-PROJECT-ID
|
||||
|
||||
|
||||
# Optional tuning parameters
|
||||
# For full list, see https://docs.prylabs.network/docs/prysm-usage/parameters
|
||||
|
||||
@@ -190,7 +190,7 @@ func (s *Service) writeBlockRangeToStream(ctx context.Context, startSlot, endSlo
|
||||
continue
|
||||
}
|
||||
if chunkErr := s.chunkBlockWriter(stream, b); chunkErr != nil {
|
||||
log.WithError(chunkErr).Error("Could not send a chunked response")
|
||||
log.WithError(chunkErr).Debug("Could not send a chunked response")
|
||||
s.writeErrorResponseToStream(responseCodeServerError, p2ptypes.ErrGeneric.Error(), stream)
|
||||
tracing.AnnotateError(span, chunkErr)
|
||||
return chunkErr
|
||||
|
||||
@@ -178,6 +178,7 @@ func (s *Service) Start() {
|
||||
s.processPendingBlocksQueue()
|
||||
s.processPendingAttsQueue()
|
||||
s.maintainPeerStatuses()
|
||||
s.resyncIfBehind()
|
||||
|
||||
// Update sync metrics.
|
||||
async.RunEvery(s.ctx, syncMetricsInterval, s.updateMetrics)
|
||||
|
||||
@@ -13,6 +13,7 @@ go_library(
|
||||
"//cmd/beacon-chain/flags:go_default_library",
|
||||
"//io/file:go_default_library",
|
||||
"@com_github_pkg_errors//:go_default_library",
|
||||
"@com_github_sirupsen_logrus//:go_default_library",
|
||||
"@com_github_urfave_cli_v2//:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
@@ -9,6 +9,7 @@ import (
|
||||
"github.com/prysmaticlabs/prysm/v3/beacon-chain/execution"
|
||||
"github.com/prysmaticlabs/prysm/v3/cmd/beacon-chain/flags"
|
||||
"github.com/prysmaticlabs/prysm/v3/io/file"
|
||||
log "github.com/sirupsen/logrus"
|
||||
"github.com/urfave/cli/v2"
|
||||
)
|
||||
|
||||
@@ -64,7 +65,8 @@ func parseJWTSecretFromFile(c *cli.Context) ([]byte, error) {
|
||||
}
|
||||
|
||||
func parseExecutionChainEndpoint(c *cli.Context) (string, error) {
|
||||
if c.String(flags.ExecutionEngineEndpoint.Name) == "" {
|
||||
aliasUsed := c.IsSet(flags.HTTPWeb3ProviderFlag.Name)
|
||||
if c.String(flags.ExecutionEngineEndpoint.Name) == "" && !aliasUsed {
|
||||
return "", fmt.Errorf(
|
||||
"you need to specify %s to provide a connection endpoint to an Ethereum execution client "+
|
||||
"for your Prysm beacon node. This is a requirement for running a node. You can read more about "+
|
||||
@@ -73,5 +75,12 @@ func parseExecutionChainEndpoint(c *cli.Context) (string, error) {
|
||||
flags.ExecutionEngineEndpoint.Name,
|
||||
)
|
||||
}
|
||||
// If users only declare the deprecated flag without setting the execution engine
|
||||
// flag, we fallback to using the deprecated flag value.
|
||||
if aliasUsed && !c.IsSet(flags.ExecutionEngineEndpoint.Name) {
|
||||
log.Warnf("The %s flag has been deprecated and will be removed in a future release,"+
|
||||
"please use the execution endpoint flag instead %s", flags.HTTPWeb3ProviderFlag.Name, flags.ExecutionEngineEndpoint.Name)
|
||||
return c.String(flags.HTTPWeb3ProviderFlag.Name), nil
|
||||
}
|
||||
return c.String(flags.ExecutionEngineEndpoint.Name), nil
|
||||
}
|
||||
|
||||
@@ -32,6 +32,13 @@ var (
|
||||
Usage: "An execution client http endpoint. Can contain auth header as well in the format",
|
||||
Value: "http://localhost:8551",
|
||||
}
|
||||
// Deprecated: HTTPWeb3ProviderFlag is a deprecated flag and is an alias for the ExecutionEngineEndpoint flag.
|
||||
HTTPWeb3ProviderFlag = &cli.StringFlag{
|
||||
Name: "http-web3provider",
|
||||
Usage: "DEPRECATED: 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:8551",
|
||||
Hidden: true,
|
||||
}
|
||||
// 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
|
||||
// to execution nodes for consensus-related calls will fail. This is not required if using an IPC connection.
|
||||
|
||||
@@ -38,6 +38,7 @@ import (
|
||||
var appFlags = []cli.Flag{
|
||||
flags.DepositContractFlag,
|
||||
flags.ExecutionEngineEndpoint,
|
||||
flags.HTTPWeb3ProviderFlag,
|
||||
flags.ExecutionJWTSecretFlag,
|
||||
flags.RPCHost,
|
||||
flags.RPCPort,
|
||||
|
||||
@@ -107,6 +107,7 @@ var appHelpFlagGroups = []flagGroup{
|
||||
flags.GRPCGatewayPort,
|
||||
flags.GPRCGatewayCorsDomain,
|
||||
flags.ExecutionEngineEndpoint,
|
||||
flags.HTTPWeb3ProviderFlag,
|
||||
flags.ExecutionJWTSecretFlag,
|
||||
flags.SetGCPercent,
|
||||
flags.SlotsPerArchivedPoint,
|
||||
|
||||
@@ -96,31 +96,3 @@ func ExpandSingleEndpointIfFile(ctx *cli.Context, flag *cli.StringFlag) error {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// ExpandWeb3EndpointsIfFile expands the path for --fallback-web3provider if specified as a file.
|
||||
func ExpandWeb3EndpointsIfFile(ctx *cli.Context, flags *cli.StringSliceFlag) error {
|
||||
// Return early if no flag value is set.
|
||||
if !ctx.IsSet(flags.Name) {
|
||||
return nil
|
||||
}
|
||||
rawFlags := ctx.StringSlice(flags.Name)
|
||||
for i, rawValue := range rawFlags {
|
||||
switch {
|
||||
case strings.HasPrefix(rawValue, "http://"):
|
||||
case strings.HasPrefix(rawValue, "https://"):
|
||||
case strings.HasPrefix(rawValue, "ws://"):
|
||||
case strings.HasPrefix(rawValue, "wss://"):
|
||||
default:
|
||||
web3endpoint, err := file.ExpandPath(rawValue)
|
||||
if err != nil {
|
||||
return errors.Wrapf(err, "could not expand path for %s", rawValue)
|
||||
}
|
||||
// Given that rawFlags is a pointer this will replace the unexpanded path
|
||||
// with the expanded one. Also there is no easy way to replace the string
|
||||
// slice flag value compared to other flag types. This is why we resort to
|
||||
// replacing it like this.
|
||||
rawFlags[i] = web3endpoint
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -111,43 +111,3 @@ func TestExpandSingleEndpointIfFile(t *testing.T) {
|
||||
require.NoError(t, ExpandSingleEndpointIfFile(context, HTTPWeb3ProviderFlag))
|
||||
require.Equal(t, curentdir+"/path.ipc", context.String(HTTPWeb3ProviderFlag.Name))
|
||||
}
|
||||
|
||||
func TestExpandWeb3EndpointsIfFile(t *testing.T) {
|
||||
app := cli.App{}
|
||||
set := flag.NewFlagSet("test", 0)
|
||||
HTTPWeb3ProviderFlag := &cli.StringSliceFlag{Name: "fallback-web3provider", Value: cli.NewStringSlice()}
|
||||
set.Var(cli.NewStringSlice(), HTTPWeb3ProviderFlag.Name, "")
|
||||
context := cli.NewContext(&app, set, nil)
|
||||
// with nothing set
|
||||
require.NoError(t, ExpandWeb3EndpointsIfFile(context, HTTPWeb3ProviderFlag))
|
||||
require.DeepEqual(t, []string{}, context.StringSlice(HTTPWeb3ProviderFlag.Name))
|
||||
|
||||
// with url scheme
|
||||
require.NoError(t, context.Set(HTTPWeb3ProviderFlag.Name, "http://localhost:8545"))
|
||||
require.NoError(t, ExpandWeb3EndpointsIfFile(context, HTTPWeb3ProviderFlag))
|
||||
require.DeepEqual(t, []string{"http://localhost:8545"}, context.StringSlice(HTTPWeb3ProviderFlag.Name))
|
||||
|
||||
// reset context
|
||||
set = flag.NewFlagSet("test", 0)
|
||||
set.Var(cli.NewStringSlice(), HTTPWeb3ProviderFlag.Name, "")
|
||||
context = cli.NewContext(&app, set, nil)
|
||||
|
||||
// relative user home path
|
||||
usr, err := user.Current()
|
||||
require.NoError(t, err)
|
||||
require.NoError(t, context.Set(HTTPWeb3ProviderFlag.Name, "~/relative/path.ipc"))
|
||||
require.NoError(t, ExpandWeb3EndpointsIfFile(context, HTTPWeb3ProviderFlag))
|
||||
require.DeepEqual(t, []string{usr.HomeDir + "/relative/path.ipc"}, context.StringSlice(HTTPWeb3ProviderFlag.Name))
|
||||
|
||||
// reset context
|
||||
set = flag.NewFlagSet("test", 0)
|
||||
set.Var(cli.NewStringSlice(), HTTPWeb3ProviderFlag.Name, "")
|
||||
context = cli.NewContext(&app, set, nil)
|
||||
|
||||
// current dir path
|
||||
curentdir, err := os.Getwd()
|
||||
require.NoError(t, err)
|
||||
require.NoError(t, context.Set(HTTPWeb3ProviderFlag.Name, "./path.ipc"))
|
||||
require.NoError(t, ExpandWeb3EndpointsIfFile(context, HTTPWeb3ProviderFlag))
|
||||
require.DeepEqual(t, []string{curentdir + "/path.ipc"}, context.StringSlice(HTTPWeb3ProviderFlag.Name))
|
||||
}
|
||||
|
||||
@@ -341,9 +341,10 @@ var (
|
||||
|
||||
// EnableBuilderFlag enables the periodic validator registration API calls that will update the custom builder with validator settings.
|
||||
EnableBuilderFlag = &cli.BoolFlag{
|
||||
Name: "enable-builder",
|
||||
Usage: "Enables Builder validator registration APIs for the validator client to update settings such as fee recipient and gas limit. Note* this flag is not required if using proposer settings config file",
|
||||
Value: false,
|
||||
Name: "enable-builder",
|
||||
Usage: "Enables Builder validator registration APIs for the validator client to update settings such as fee recipient and gas limit. Note* this flag is not required if using proposer settings config file",
|
||||
Value: false,
|
||||
Aliases: []string{"enable-validator-registration"},
|
||||
}
|
||||
|
||||
// BuilderGasLimitFlag defines the gas limit for the builder to use for constructing a payload.
|
||||
|
||||
@@ -12,8 +12,84 @@ var (
|
||||
Usage: deprecatedUsage,
|
||||
Hidden: true,
|
||||
}
|
||||
deprecatedBackupWebHookFlag = &cli.BoolFlag{
|
||||
Name: "enable-db-backup-webhook",
|
||||
Usage: deprecatedUsage,
|
||||
Hidden: true,
|
||||
}
|
||||
deprecatedBoltMmapFlag = &cli.StringFlag{
|
||||
Name: "bolt-mmap-initial-size",
|
||||
Usage: deprecatedUsage,
|
||||
Hidden: true,
|
||||
}
|
||||
deprecatedDisableDiscV5Flag = &cli.BoolFlag{
|
||||
Name: "disable-discv5",
|
||||
Usage: deprecatedUsage,
|
||||
Hidden: true,
|
||||
}
|
||||
deprecatedDisableAttHistoryCacheFlag = &cli.BoolFlag{
|
||||
Name: "disable-attesting-history-db-cache",
|
||||
Usage: deprecatedUsage,
|
||||
Hidden: true,
|
||||
}
|
||||
deprecatedEnableVectorizedHtr = &cli.BoolFlag{
|
||||
Name: "enable-vectorized-htr",
|
||||
Usage: deprecatedUsage,
|
||||
Hidden: true,
|
||||
}
|
||||
deprecatedEnablePeerScorer = &cli.BoolFlag{
|
||||
Name: "enable-peer-scorer",
|
||||
Usage: deprecatedUsage,
|
||||
Hidden: true,
|
||||
}
|
||||
deprecatedEnableForkchoiceDoublyLinkedTree = &cli.BoolFlag{
|
||||
Name: "enable-forkchoice-doubly-linked-tree",
|
||||
Usage: deprecatedUsage,
|
||||
Hidden: true,
|
||||
}
|
||||
deprecatedDutyCountdown = &cli.BoolFlag{
|
||||
Name: "enable-duty-count-down",
|
||||
Usage: deprecatedUsage,
|
||||
Hidden: true,
|
||||
}
|
||||
deprecatedHeadSync = &cli.BoolFlag{
|
||||
Name: "head-sync",
|
||||
Usage: deprecatedUsage,
|
||||
Hidden: true,
|
||||
}
|
||||
deprecatedGossipBatchAggregation = &cli.BoolFlag{
|
||||
Name: "enable-gossip-batch-aggregation",
|
||||
Usage: deprecatedUsage,
|
||||
Hidden: true,
|
||||
}
|
||||
deprecatedEnableLargerGossipHistory = &cli.BoolFlag{
|
||||
Name: "enable-larger-gossip-history",
|
||||
Usage: deprecatedUsage,
|
||||
Hidden: true,
|
||||
}
|
||||
deprecatedFallbackProvider = &cli.StringFlag{
|
||||
Name: "fallback-web3provider",
|
||||
Usage: deprecatedUsage,
|
||||
Hidden: true,
|
||||
}
|
||||
)
|
||||
|
||||
// Deprecated flags for both the beacon node and validator client.
|
||||
var deprecatedFlags = []cli.Flag{
|
||||
exampleDeprecatedFeatureFlag,
|
||||
deprecatedBoltMmapFlag,
|
||||
deprecatedDisableDiscV5Flag,
|
||||
deprecatedDisableAttHistoryCacheFlag,
|
||||
deprecatedEnableVectorizedHtr,
|
||||
deprecatedEnablePeerScorer,
|
||||
deprecatedEnableForkchoiceDoublyLinkedTree,
|
||||
deprecatedDutyCountdown,
|
||||
deprecatedHeadSync,
|
||||
deprecatedGossipBatchAggregation,
|
||||
deprecatedEnableLargerGossipHistory,
|
||||
deprecatedFallbackProvider,
|
||||
}
|
||||
|
||||
var deprecatedBeaconFlags = []cli.Flag{
|
||||
deprecatedBackupWebHookFlag,
|
||||
}
|
||||
|
||||
@@ -138,7 +138,7 @@ var E2EValidatorFlags = []string{
|
||||
}
|
||||
|
||||
// BeaconChainFlags contains a list of all the feature flags that apply to the beacon-chain client.
|
||||
var BeaconChainFlags = append(deprecatedFlags, []cli.Flag{
|
||||
var BeaconChainFlags = append(deprecatedBeaconFlags, append(deprecatedFlags, []cli.Flag{
|
||||
devModeFlag,
|
||||
writeSSZStateTransitionsFlag,
|
||||
disableGRPCConnectionLogging,
|
||||
@@ -156,7 +156,7 @@ var BeaconChainFlags = append(deprecatedFlags, []cli.Flag{
|
||||
disableForkChoiceDoublyLinkedTree,
|
||||
disableGossipBatchAggregation,
|
||||
EnableOnlyBlindedBeaconBlocks,
|
||||
}...)
|
||||
}...)...)
|
||||
|
||||
// E2EBeaconChainFlags contains a list of the beacon chain feature flags to be tested in E2E.
|
||||
var E2EBeaconChainFlags = []string{
|
||||
|
||||
Reference in New Issue
Block a user