Skip to content

Commit baf9ec6

Browse files
authored
Adds BlockBatchLimitBurstFactor flag (#5825)
* adds BlockBatchLimitBurstFactor flag * Merge branch 'master' into burst-factor-flag
1 parent 79ce15d commit baf9ec6

File tree

5 files changed

+11
-1
lines changed

5 files changed

+11
-1
lines changed

beacon-chain/flags/base.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,12 @@ var (
124124
Usage: "The amount of blocks the local peer is bounded to request and respond to in a batch.",
125125
Value: 64,
126126
}
127+
// BlockBatchLimitBurstFactor specifies the factor by which block batch size may increase.
128+
BlockBatchLimitBurstFactor = &cli.IntFlag{
129+
Name: "block-batch-limit-burst-factor",
130+
Usage: "The factor by which block batch limit may increase on burst.",
131+
Value: 10,
132+
}
127133
// EnableDebugRPCEndpoints as /v1/beacon/state.
128134
EnableDebugRPCEndpoints = &cli.BoolFlag{
129135
Name: "enable-debug-rpc-endpoints",

beacon-chain/flags/config.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ type GlobalFlags struct {
1919
MaxPageSize int
2020
DeploymentBlock int
2121
BlockBatchLimit int
22+
BlockBatchLimitBurstFactor int
2223
}
2324

2425
var globalConfig *GlobalFlags
@@ -59,6 +60,7 @@ func ConfigureGlobalFlags(ctx *cli.Context) {
5960
cfg.DisableDiscv5 = true
6061
}
6162
cfg.BlockBatchLimit = ctx.Int(BlockBatchLimit.Name)
63+
cfg.BlockBatchLimitBurstFactor = ctx.Int(BlockBatchLimitBurstFactor.Name)
6264
cfg.MaxPageSize = ctx.Int(RPCMaxPageSize.Name)
6365
cfg.DeploymentBlock = ctx.Int(ContractDeploymentBlock.Name)
6466
configureMinimumPeers(ctx, cfg)

beacon-chain/main.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ var appFlags = []cli.Flag{
4141
flags.UnsafeSync,
4242
flags.DisableDiscv5,
4343
flags.BlockBatchLimit,
44+
flags.BlockBatchLimitBurstFactor,
4445
flags.InteropMockEth1DataVotesFlag,
4546
flags.InteropGenesisStateFlag,
4647
flags.InteropNumValidatorsFlag,

beacon-chain/sync/service.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ type Service struct {
110110
func NewRegularSync(cfg *Config) *Service {
111111
// Intialize block limits.
112112
allowedBlocksPerSecond = float64(flags.Get().BlockBatchLimit)
113-
allowedBlocksBurst = int64(10 * allowedBlocksPerSecond)
113+
allowedBlocksBurst = int64(flags.Get().BlockBatchLimitBurstFactor * flags.Get().BlockBatchLimit)
114114

115115
ctx, cancel := context.WithCancel(context.Background())
116116
r := &Service{

beacon-chain/usage.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ var appHelpFlagGroups = []flagGroup{
9696
flags.SlotsPerArchivedPoint,
9797
flags.DisableDiscv5,
9898
flags.BlockBatchLimit,
99+
flags.BlockBatchLimitBurstFactor,
99100
flags.EnableDebugRPCEndpoints,
100101
},
101102
},

0 commit comments

Comments
 (0)