From 87d35f00457addb37dc6624a096d538acdce68af Mon Sep 17 00:00:00 2001 From: Jared Wasinger Date: Mon, 17 Mar 2025 11:51:31 +0100 Subject: [PATCH] eth/catalyst: sanitize simulated beacon period to avoid overflowing the time.Duration it will occupy --- eth/catalyst/simulated_beacon.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/eth/catalyst/simulated_beacon.go b/eth/catalyst/simulated_beacon.go index dd9d8f9062..9dd215783e 100644 --- a/eth/catalyst/simulated_beacon.go +++ b/eth/catalyst/simulated_beacon.go @@ -124,6 +124,14 @@ func NewSimulatedBeacon(period uint64, feeRecipient common.Address, eth *eth.Eth return nil, err } } + + // cap the dev mode period to a reasonable maximum value to avoid overflowing the time.Duration (int64) that it will occupy + var maxPeriod uint64 = 9223372036 // math.Floor(math.MaxInt64 / 1000000000) + if period > maxPeriod { + log.Warn(fmt.Sprintf("period exceeds maximum possible value (have: %d, max: %d). Sanitizing period to maximum possible value.", period, maxPeriod)) + period = maxPeriod + } + return &SimulatedBeacon{ eth: eth, period: period,