diff --git a/core/genesis.go b/core/genesis.go index b5f844724741..c25faa24f6a0 100644 --- a/core/genesis.go +++ b/core/genesis.go @@ -475,6 +475,9 @@ func (g *Genesis) ToBlock() *types.Block { head.BaseFee = new(big.Int).SetUint64(params.InitialBaseFee) } } + if g.Config != nil && g.Config.IsShanghai(big.NewInt(int64(g.Timestamp))) { + head.WithdrawalsHash = &types.EmptyRootHash + } return types.NewBlock(head, nil, nil, nil, trie.NewStackTrie(nil)) } diff --git a/eth/catalyst/api_test.go b/eth/catalyst/api_test.go index 41d16027d522..a7bf1c69b763 100644 --- a/eth/catalyst/api_test.go +++ b/eth/catalyst/api_test.go @@ -998,7 +998,7 @@ func TestSimultaneousNewBlock(t *testing.T) { // includes zero withdrawals and the second includes two. func TestWithdrawals(t *testing.T) { genesis, blocks := generateMergeChain(10, true) - genesis.Config.ShanghaiBlock = big.NewInt(11) + genesis.Config.ShanghaiTime = big.NewInt(11) genesis.Config.TerminalTotalDifficulty.Sub(genesis.Config.TerminalTotalDifficulty, blocks[0].Difficulty()) n, ethservice := startEthService(t, genesis, blocks) diff --git a/eth/fetcher/block_fetcher_test.go b/eth/fetcher/block_fetcher_test.go index 05c2c642dcd4..3b99af585e58 100644 --- a/eth/fetcher/block_fetcher_test.go +++ b/eth/fetcher/block_fetcher_test.go @@ -64,7 +64,7 @@ func init() { ArrowGlacierBlock: big.NewInt(0), GrayGlacierBlock: big.NewInt(0), MergeNetsplitBlock: big.NewInt(0), - ShanghaiBlock: big.NewInt(0), + ShanghaiTime: big.NewInt(0), TerminalTotalDifficulty: big.NewInt(0), TerminalTotalDifficultyPassed: true, Ethash: new(params.EthashConfig), diff --git a/eth/protocols/eth/handler_test.go b/eth/protocols/eth/handler_test.go index f28b4ed9b853..b1145a3bd433 100644 --- a/eth/protocols/eth/handler_test.go +++ b/eth/protocols/eth/handler_test.go @@ -90,7 +90,7 @@ func newTestBackendWithGenerator(blocks int, shanghai bool, generator func(int, ArrowGlacierBlock: big.NewInt(0), GrayGlacierBlock: big.NewInt(0), MergeNetsplitBlock: big.NewInt(0), - ShanghaiBlock: big.NewInt(0), + ShanghaiTime: big.NewInt(0), TerminalTotalDifficulty: big.NewInt(0), TerminalTotalDifficultyPassed: true, Ethash: new(params.EthashConfig), diff --git a/internal/ethapi/api.go b/internal/ethapi/api.go index be40bb777530..314d062482c6 100644 --- a/internal/ethapi/api.go +++ b/internal/ethapi/api.go @@ -1208,6 +1208,10 @@ func RPCMarshalHeader(head *types.Header) map[string]interface{} { result["baseFeePerGas"] = (*hexutil.Big)(head.BaseFee) } + if head.WithdrawalsHash != nil { + result["withdrawalsRoot"] = head.WithdrawalsHash + } + return result } diff --git a/tests/init.go b/tests/init.go index 5f8196512bc4..b0d0f61d2444 100644 --- a/tests/init.go +++ b/tests/init.go @@ -246,7 +246,7 @@ var Forks = map[string]*params.ChainConfig{ ArrowGlacierBlock: big.NewInt(0), MergeNetsplitBlock: big.NewInt(0), TerminalTotalDifficulty: big.NewInt(0), - ShanghaiBlock: big.NewInt(0), + ShanghaiTime: big.NewInt(0), }, }