Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .nancy-ignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
CVE-2024-34478 # "CWE-754: Improper Check for Unusual or Exceptional Conditions." This vulnerability is BTC only, BSC does not have the issue.
CVE-2021-43668 # "CWE-476: NULL Pointer Dereference", the repo: syndtr/goleveldb is not actively maintained, seems there is no fix for this crash yet, BSC used pebbleDB to replaced levelDB, so ignore this vulnerability.
CVE-2025-47908 # "CWE-400: Uncontrolled Resource Consumption ('Resource Exhaustion')", This vulnerability is only for RPC nodes which have specifically enabled malicous Cors options, which is unlikely to happen.
CVE-2025-64702 # "CWE-770: Allocation of Resources Without Limits or Throttling". Attack vector is unreachable as QUIC/HTTP3 is not enabled in BSC's P2P configuration.
23 changes: 15 additions & 8 deletions miner/minerconfig/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,21 @@ var (
defaultRecommit = 10 * time.Second
defaultMaxWaitProposalInSecs = uint64(45)

defaultGasCeil = uint64(55_000_000)
// Extra time for finalizing and committing blocks (excludes writing to disk).
defaultDelayLeftOver = 25 * time.Millisecond
defaultBidSimulationLeftOver = 30 * time.Millisecond
// For estimation, assume 500 Mgas/s:
// (100M gas / 500 Mgas/s) * 1000 ms + 10 ms buffer + defaultDelayLeftOver ≈ 235 ms.
defaultNoInterruptLeftOver = 235 * time.Millisecond
defaultDelayLeftOver = 15 * time.Millisecond
defaultBidSimulationLeftOver = 20 * time.Millisecond
)

func getDefaultNoInterruptLeftOver() *time.Duration {
expectedProcessingSpeed := 500_000_000 // For estimation, assume 500 Mgas/s
bidProcessing := float64(defaultGasCeil) / float64(expectedProcessingSpeed)
buffer := 10 * time.Millisecond
noInterruptLeftOver := time.Duration(bidProcessing*float64(time.Second)) + buffer + defaultDelayLeftOver

return &noInterruptLeftOver
}

// Other default MEV-related configurations
var (
defaultMevEnabled = false
Expand Down Expand Up @@ -68,7 +75,7 @@ type Config struct {

// DefaultConfig contains default settings for miner.
var DefaultConfig = Config{
GasCeil: 100000000,
GasCeil: defaultGasCeil,
GasPrice: big.NewInt(params.GWei),
// The default recommit time is chosen as two seconds since
// consensus-layer usually will wait a half slot of time(6s)
Expand Down Expand Up @@ -109,7 +116,7 @@ var DefaultMevConfig = MevConfig{
Builders: nil,
ValidatorCommission: &defaultValidatorCommission,
BidSimulationLeftOver: &defaultBidSimulationLeftOver,
NoInterruptLeftOver: &defaultNoInterruptLeftOver,
NoInterruptLeftOver: getDefaultNoInterruptLeftOver(),
MaxBidsPerBuilder: &defaultMaxBidsPerBuilder,
}

Expand Down Expand Up @@ -155,7 +162,7 @@ func ApplyDefaultMinerConfig(cfg *Config) {
log.Info("ApplyDefaultMinerConfig", "Mev.BidSimulationLeftOver", *cfg.Mev.BidSimulationLeftOver)
}
if cfg.Mev.NoInterruptLeftOver == nil {
cfg.Mev.NoInterruptLeftOver = &defaultNoInterruptLeftOver
cfg.Mev.NoInterruptLeftOver = getDefaultNoInterruptLeftOver()
log.Info("ApplyDefaultMinerConfig", "Mev.NoInterruptLeftOver", *cfg.Mev.NoInterruptLeftOver)
}
if cfg.Mev.MaxBidsPerBuilder == nil {
Expand Down
Loading