mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-09 21:38:05 -05:00
* `CreateTestVerifiedRoDataColumnSidecars`: Use consistent block root. * peerDAS: Implement `dataColumnSidecarByRootRPCHandler`. * Fix James' comment. * Fix James' comment.
78 lines
2.1 KiB
Go
78 lines
2.1 KiB
Go
package flags
|
|
|
|
import (
|
|
"github.com/OffchainLabs/prysm/v6/cmd"
|
|
"github.com/urfave/cli/v2"
|
|
)
|
|
|
|
// GlobalFlags specifies all the global flags for the
|
|
// beacon node.
|
|
type GlobalFlags struct {
|
|
SubscribeToAllSubnets bool
|
|
SubscribeAllDataSubnets bool
|
|
MinimumSyncPeers int
|
|
MinimumPeersPerSubnet int
|
|
MaxConcurrentDials int
|
|
BlockBatchLimit int
|
|
BlockBatchLimitBurstFactor int
|
|
BlobBatchLimit int
|
|
DataColumnBatchLimit int
|
|
BlobBatchLimitBurstFactor int
|
|
}
|
|
|
|
var globalConfig *GlobalFlags
|
|
|
|
// Get retrieves the global config.
|
|
func Get() *GlobalFlags {
|
|
if globalConfig == nil {
|
|
return &GlobalFlags{}
|
|
}
|
|
return globalConfig
|
|
}
|
|
|
|
// Init sets the global config equal to the config that is passed in.
|
|
func Init(c *GlobalFlags) {
|
|
globalConfig = c
|
|
}
|
|
|
|
// ConfigureGlobalFlags initializes the global config.
|
|
// based on the provided cli context.
|
|
func ConfigureGlobalFlags(ctx *cli.Context) {
|
|
cfg := &GlobalFlags{}
|
|
|
|
if ctx.Bool(SubscribeToAllSubnets.Name) {
|
|
log.Warn("Subscribing to All Attestation Subnets")
|
|
cfg.SubscribeToAllSubnets = true
|
|
}
|
|
|
|
if ctx.Bool(SubscribeAllDataSubnets.Name) {
|
|
log.Warning("Subscribing to all data subnets")
|
|
cfg.SubscribeAllDataSubnets = true
|
|
}
|
|
|
|
cfg.BlockBatchLimit = ctx.Int(BlockBatchLimit.Name)
|
|
cfg.BlockBatchLimitBurstFactor = ctx.Int(BlockBatchLimitBurstFactor.Name)
|
|
cfg.BlobBatchLimit = ctx.Int(BlobBatchLimit.Name)
|
|
cfg.BlobBatchLimitBurstFactor = ctx.Int(BlobBatchLimitBurstFactor.Name)
|
|
cfg.DataColumnBatchLimit = ctx.Int(DataColumnBatchLimit.Name)
|
|
cfg.MinimumPeersPerSubnet = ctx.Int(MinPeersPerSubnet.Name)
|
|
cfg.MaxConcurrentDials = ctx.Int(MaxConcurrentDials.Name)
|
|
configureMinimumPeers(ctx, cfg)
|
|
|
|
Init(cfg)
|
|
}
|
|
|
|
// MaxDialIsActive checks if the user has enabled the max dial flag.
|
|
func MaxDialIsActive() bool {
|
|
return Get().MaxConcurrentDials > 0
|
|
}
|
|
|
|
func configureMinimumPeers(ctx *cli.Context, cfg *GlobalFlags) {
|
|
cfg.MinimumSyncPeers = ctx.Int(MinSyncPeers.Name)
|
|
maxPeers := ctx.Int(cmd.P2PMaxPeers.Name)
|
|
if cfg.MinimumSyncPeers > maxPeers {
|
|
log.Warnf("Changing Minimum Sync Peers to %d", maxPeers)
|
|
cfg.MinimumSyncPeers = maxPeers
|
|
}
|
|
}
|