Skip to content

Commit ae27d8b

Browse files
authored
Merge branch 'ethereum:master' into portal
2 parents d5ca1a8 + 0a2f339 commit ae27d8b

File tree

2 files changed

+19
-3
lines changed

2 files changed

+19
-3
lines changed

eth/catalyst/simulated_beacon.go

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ package catalyst
1818

1919
import (
2020
"crypto/rand"
21+
"crypto/sha256"
2122
"errors"
2223
"math/big"
2324
"sync"
@@ -27,6 +28,7 @@ import (
2728
"github.com/ethereum/go-ethereum/common"
2829
"github.com/ethereum/go-ethereum/core/txpool"
2930
"github.com/ethereum/go-ethereum/core/types"
31+
"github.com/ethereum/go-ethereum/crypto/kzg4844"
3032
"github.com/ethereum/go-ethereum/eth"
3133
"github.com/ethereum/go-ethereum/log"
3234
"github.com/ethereum/go-ethereum/node"
@@ -161,14 +163,14 @@ func (c *SimulatedBeacon) sealBlock(withdrawals []*types.Withdrawal, timestamp u
161163
SuggestedFeeRecipient: feeRecipient,
162164
Withdrawals: withdrawals,
163165
Random: random,
164-
}, engine.PayloadV2, true)
166+
BeaconRoot: &common.Hash{},
167+
}, engine.PayloadV3, true)
165168
if err != nil {
166169
return err
167170
}
168171
if fcResponse == engine.STATUS_SYNCING {
169172
return errors.New("chain rewind prevented invocation of payload creation")
170173
}
171-
172174
envelope, err := c.engineAPI.getPayload(*fcResponse.PayloadID, true)
173175
if err != nil {
174176
return err
@@ -186,8 +188,21 @@ func (c *SimulatedBeacon) sealBlock(withdrawals []*types.Withdrawal, timestamp u
186188
}
187189
}
188190

191+
// Independently calculate the blob hashes from sidecars.
192+
blobHashes := make([]common.Hash, 0)
193+
if envelope.BlobsBundle != nil {
194+
hasher := sha256.New()
195+
for _, commit := range envelope.BlobsBundle.Commitments {
196+
var c kzg4844.Commitment
197+
if len(commit) != len(c) {
198+
return errors.New("invalid commitment length")
199+
}
200+
copy(c[:], commit)
201+
blobHashes = append(blobHashes, kzg4844.CalcBlobHashV1(hasher, &c))
202+
}
203+
}
189204
// Mark the payload as canon
190-
if _, err = c.engineAPI.NewPayloadV2(*payload); err != nil {
205+
if _, err = c.engineAPI.NewPayloadV3(*payload, blobHashes, &common.Hash{}); err != nil {
191206
return err
192207
}
193208
c.setCurrentState(payload.BlockHash, finalizedHash)

params/config.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@ var (
183183
ArrowGlacierBlock: big.NewInt(0),
184184
GrayGlacierBlock: big.NewInt(0),
185185
ShanghaiTime: newUint64(0),
186+
CancunTime: newUint64(0),
186187
TerminalTotalDifficulty: big.NewInt(0),
187188
TerminalTotalDifficultyPassed: true,
188189
}

0 commit comments

Comments
 (0)