Skip to content

Commit f530772

Browse files
gurukamathshekhirin
authored andcommitted
cmd/evm: use correct parent number for t8n base fee calculation (ethereum#27032)
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
1 parent a60bb13 commit f530772

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

cmd/evm/internal/t8ntool/transition.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -250,9 +250,9 @@ func Transition(ctx *cli.Context) error {
250250
if chainConfig.IsLondon(big.NewInt(int64(prestate.Env.Number))) {
251251
if prestate.Env.BaseFee != nil {
252252
// Already set, base fee has precedent over parent base fee.
253-
} else if prestate.Env.ParentBaseFee != nil {
253+
} else if prestate.Env.ParentBaseFee != nil && prestate.Env.Number != 0 {
254254
parent := &types.Header{
255-
Number: new(big.Int).SetUint64(prestate.Env.Number),
255+
Number: new(big.Int).SetUint64(prestate.Env.Number - 1),
256256
BaseFee: prestate.Env.ParentBaseFee,
257257
GasUsed: prestate.Env.ParentGasUsed,
258258
GasLimit: prestate.Env.ParentGasLimit,

0 commit comments

Comments
 (0)