From dd37b9066f3031f26e894b1e9e4af05aaa34ee29 Mon Sep 17 00:00:00 2001 From: sashass1315 Date: Thu, 13 Nov 2025 12:50:38 +0200 Subject: [PATCH] eth/catalyst: handle crypto/rand error when generating prevRandao --- eth/catalyst/simulated_beacon.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/eth/catalyst/simulated_beacon.go b/eth/catalyst/simulated_beacon.go index d9f01240a7..5e5041e3d5 100644 --- a/eth/catalyst/simulated_beacon.go +++ b/eth/catalyst/simulated_beacon.go @@ -21,6 +21,7 @@ import ( "crypto/sha256" "errors" "fmt" + "io" "math" "sync" "time" @@ -193,7 +194,9 @@ func (c *SimulatedBeacon) sealBlock(withdrawals []*types.Withdrawal, timestamp u version := payloadVersion(c.eth.BlockChain().Config(), timestamp) var random [32]byte - rand.Read(random[:]) + if _, err := io.ReadFull(rand.Reader, random[:]); err != nil { + return fmt.Errorf("failed to read randomness: %w", err) + } fcResponse, err := c.engineAPI.forkchoiceUpdated(c.curForkchoiceState, &engine.PayloadAttributes{ Timestamp: timestamp, SuggestedFeeRecipient: feeRecipient,