Adds BlockBatchLimitBurstFactor flag (#5825)

* adds BlockBatchLimitBurstFactor flag
* Merge branch 'master' into burst-factor-flag
This commit is contained in:
Victor Farazdagi 2020-05-12 14:31:10 +03:00 committed by GitHub
parent 79ce15df63
commit baf9ec60eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 11 additions and 1 deletions

View File

@ -124,6 +124,12 @@ var (
Usage: "The amount of blocks the local peer is bounded to request and respond to in a batch.",
Value: 64,
}
// BlockBatchLimitBurstFactor specifies the factor by which block batch size may increase.
BlockBatchLimitBurstFactor = &cli.IntFlag{
Name: "block-batch-limit-burst-factor",
Usage: "The factor by which block batch limit may increase on burst.",
Value: 10,
}
// EnableDebugRPCEndpoints as /v1/beacon/state.
EnableDebugRPCEndpoints = &cli.BoolFlag{
Name: "enable-debug-rpc-endpoints",

View File

@ -19,6 +19,7 @@ type GlobalFlags struct {
MaxPageSize int
DeploymentBlock int
BlockBatchLimit int
BlockBatchLimitBurstFactor int
}
var globalConfig *GlobalFlags
@ -59,6 +60,7 @@ func ConfigureGlobalFlags(ctx *cli.Context) {
cfg.DisableDiscv5 = true
}
cfg.BlockBatchLimit = ctx.Int(BlockBatchLimit.Name)
cfg.BlockBatchLimitBurstFactor = ctx.Int(BlockBatchLimitBurstFactor.Name)
cfg.MaxPageSize = ctx.Int(RPCMaxPageSize.Name)
cfg.DeploymentBlock = ctx.Int(ContractDeploymentBlock.Name)
configureMinimumPeers(ctx, cfg)

View File

@ -41,6 +41,7 @@ var appFlags = []cli.Flag{
flags.UnsafeSync,
flags.DisableDiscv5,
flags.BlockBatchLimit,
flags.BlockBatchLimitBurstFactor,
flags.InteropMockEth1DataVotesFlag,
flags.InteropGenesisStateFlag,
flags.InteropNumValidatorsFlag,

View File

@ -110,7 +110,7 @@ type Service struct {
func NewRegularSync(cfg *Config) *Service {
// Intialize block limits.
allowedBlocksPerSecond = float64(flags.Get().BlockBatchLimit)
allowedBlocksBurst = int64(10 * allowedBlocksPerSecond)
allowedBlocksBurst = int64(flags.Get().BlockBatchLimitBurstFactor * flags.Get().BlockBatchLimit)
ctx, cancel := context.WithCancel(context.Background())
r := &Service{

View File

@ -96,6 +96,7 @@ var appHelpFlagGroups = []flagGroup{
flags.SlotsPerArchivedPoint,
flags.DisableDiscv5,
flags.BlockBatchLimit,
flags.BlockBatchLimitBurstFactor,
flags.EnableDebugRPCEndpoints,
},
},