Skip to content

Commit

Permalink
Merge pull request ethereum-optimism#127 from redhdx/fix/new_chain_wi…
Browse files Browse the repository at this point in the history
…th_fermat

fix(op-node): fix basefee when start new chain with fermat
  • Loading branch information
redhdx authored Feb 27, 2024
2 parents 480dac4 + 72449b9 commit 6ab3225
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion op-chain-ops/genesis/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
Expand All @@ -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),
Expand Down

0 comments on commit 6ab3225

Please sign in to comment.