eth/catalyst: handle crypto/rand error when generating prevRandao

This commit is contained in:
sashass1315 2025-11-13 12:50:38 +02:00 committed by GitHub
parent 488d987fc4
commit dd37b9066f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -21,6 +21,7 @@ import (
"crypto/sha256" "crypto/sha256"
"errors" "errors"
"fmt" "fmt"
"io"
"math" "math"
"sync" "sync"
"time" "time"
@ -193,7 +194,9 @@ func (c *SimulatedBeacon) sealBlock(withdrawals []*types.Withdrawal, timestamp u
version := payloadVersion(c.eth.BlockChain().Config(), timestamp) version := payloadVersion(c.eth.BlockChain().Config(), timestamp)
var random [32]byte 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{ fcResponse, err := c.engineAPI.forkchoiceUpdated(c.curForkchoiceState, &engine.PayloadAttributes{
Timestamp: timestamp, Timestamp: timestamp,
SuggestedFeeRecipient: feeRecipient, SuggestedFeeRecipient: feeRecipient,