From 6ff76af7c6d8808d77dbf53e5e5891d1e09c55d7 Mon Sep 17 00:00:00 2001 From: Guruprasad Kamath Date: Sun, 2 Apr 2023 09:21:47 +0200 Subject: [PATCH] set parent block number Currently the t8n tool uses the same block number for the current block and its parent while calculating the base fee. This causes incorrect base fee calculation for the london fork block. This commit sets the parent block number to be one less than the current block number --- cmd/evm/internal/t8ntool/transition.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/evm/internal/t8ntool/transition.go b/cmd/evm/internal/t8ntool/transition.go index cb7466d86cae..f63635687b9b 100644 --- a/cmd/evm/internal/t8ntool/transition.go +++ b/cmd/evm/internal/t8ntool/transition.go @@ -250,9 +250,9 @@ func Transition(ctx *cli.Context) error { if chainConfig.IsLondon(big.NewInt(int64(prestate.Env.Number))) { if prestate.Env.BaseFee != nil { // Already set, base fee has precedent over parent base fee. - } else if prestate.Env.ParentBaseFee != nil { + } else if prestate.Env.ParentBaseFee != nil && prestate.Env.Number != 0 { parent := &types.Header{ - Number: new(big.Int).SetUint64(prestate.Env.Number), + Number: new(big.Int).SetUint64(prestate.Env.Number - 1), BaseFee: prestate.Env.ParentBaseFee, GasUsed: prestate.Env.ParentGasUsed, GasLimit: prestate.Env.ParentGasLimit,