From dd9a191da2bc02d030cede632554e02686775e02 Mon Sep 17 00:00:00 2001 From: Scott Fairclough <70711990+hexoscott@users.noreply.github.com> Date: Wed, 2 Oct 2024 09:10:18 +0100 Subject: [PATCH] use default gas price as the base fee --- chain/chain_config.go | 1 + cmd/utils/flags.go | 3 ++- consensus/misc/eip1559.go | 2 +- eth/backend.go | 1 + 4 files changed, 5 insertions(+), 2 deletions(-) diff --git a/chain/chain_config.go b/chain/chain_config.go index 9537b67c03a..f4ab83c0d28 100644 --- a/chain/chain_config.go +++ b/chain/chain_config.go @@ -103,6 +103,7 @@ type Config struct { ForkID12BananaBlock *big.Int `json:"forkID12BananaBlock,omitempty"` AllowFreeTransactions bool `json:"allowFreeTransactions,omitempty"` + ZkDefaultGasPrice uint64 `json:"zkDefaultGasFee,omitempty"` } func (c *Config) String() string { diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go index f10bd0ab063..021553ec9fa 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -630,7 +630,8 @@ var ( DefaultGasPrice = cli.Uint64Flag{ Name: "zkevm.default-gas-price", Usage: "Set the default/min gas price", - Value: 0, + // 0.01 gwei + Value: 10000000, } MaxGasPrice = cli.Uint64Flag{ Name: "zkevm.max-gas-price", diff --git a/consensus/misc/eip1559.go b/consensus/misc/eip1559.go index a1d771870ed..546b043a453 100644 --- a/consensus/misc/eip1559.go +++ b/consensus/misc/eip1559.go @@ -59,7 +59,7 @@ func VerifyEip1559Header(config *chain.Config, parent, header *types.Header) err func CalcBaseFee(config *chain.Config, parent *types.Header) *big.Int { // If the current block is the first EIP-1559 block, return the InitialBaseFee. if !config.IsLondon(parent.Number.Uint64()) { - return new(big.Int).SetUint64(params.InitialBaseFee) + return new(big.Int).SetUint64(config.ZkDefaultGasPrice) } var ( diff --git a/eth/backend.go b/eth/backend.go index 1f066e7c071..6f3b2bc3489 100644 --- a/eth/backend.go +++ b/eth/backend.go @@ -761,6 +761,7 @@ func New(stack *node.Node, config *ethconfig.Config) (*Ethereum, error) { cfg := backend.config backend.chainConfig.AllowFreeTransactions = cfg.AllowFreeTransactions + backend.chainConfig.ZkDefaultGasPrice = cfg.DefaultGasPrice l1Urls := strings.Split(cfg.L1RpcUrl, ",") if cfg.Zk.L1CacheEnabled {