From 72449b97a1e51427ed043d39112909e3dac11492 Mon Sep 17 00:00:00 2001 From: redhdx Date: Mon, 26 Feb 2024 16:31:48 +0800 Subject: [PATCH] fix(op-node): fix basefee when start new chain with fermat --- op-chain-ops/genesis/config.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/op-chain-ops/genesis/config.go b/op-chain-ops/genesis/config.go index 468ea11da7..8d95b3747c 100644 --- a/op-chain-ops/genesis/config.go +++ b/op-chain-ops/genesis/config.go @@ -734,6 +734,13 @@ func NewL2StorageConfig(config *DeployConfig, block *types.Block) (state.Storage // return storage, errors.New("block base fee not set") //} + var baseFee *big.Int + if config.Fermat != nil && config.Fermat.Cmp(big.NewInt(0)) <= 0 { + baseFee = bsc.BaseFeeByNetworks(big.NewInt(int64(config.L2ChainID))) + } else { + baseFee = bsc.BaseFeeByTransactions(block.Transactions()) + } + storage["L2ToL1MessagePasser"] = state.StorageValues{ "msgNonce": 0, } @@ -751,7 +758,7 @@ func NewL2StorageConfig(config *DeployConfig, block *types.Block) (state.Storage storage["L1Block"] = state.StorageValues{ "number": block.Number(), "timestamp": block.Time(), - "basefee": bsc.BaseFeeByTransactions(block.Transactions()), + "basefee": baseFee, "hash": block.Hash(), "sequenceNumber": 0, "batcherHash": eth.AddressAsLeftPaddedHash(config.BatchSenderAddress),