diff --git a/consensus/beacon/consensus.go b/consensus/beacon/consensus.go index b594bf3b04..d64b125c72 100644 --- a/consensus/beacon/consensus.go +++ b/consensus/beacon/consensus.go @@ -235,6 +235,12 @@ func (beacon *Beacon) verifyHeader(chain consensus.ChainHeaderReader, header, pa if len(header.Extra) > int(params.MaximumExtraDataSize) { return fmt.Errorf("extra-data longer than 32 bytes (%d)", len(header.Extra)) } + // Validate Optimism extraData format + if chain.Config().IsOptimism() { + if err := eip1559.ValidateOptimismExtraData(chain.Config(), header.Time, header.Extra); err != nil { + return fmt.Errorf("invalid optimism extraData: %w", err) + } + } // Verify the seal parts. Ensure the nonce and uncle hash are the expected value. if header.Nonce != beaconNonce { return errInvalidNonce diff --git a/ethclient/ethclient_test.go b/ethclient/ethclient_test.go index f98829967e..2acd384aa6 100644 --- a/ethclient/ethclient_test.go +++ b/ethclient/ethclient_test.go @@ -238,7 +238,6 @@ func newTestBackend(t *testing.T, config *node.Config, enableHistoricalState boo func generateTestChain(genesis *core.Genesis, length int) []*types.Block { generate := func(i int, g *core.BlockGen) { g.OffsetTime(5) - g.SetExtra([]byte("test")) if i == 1 { // Test transactions are included in block #2. if genesis.Config.Optimism != nil && genesis.Config.IsBedrock(big.NewInt(1)) {