Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use default gas price as the base fee #1258

Merged
merged 3 commits into from
Oct 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions chain/chain_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
3 changes: 2 additions & 1 deletion cmd/utils/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion consensus/misc/eip1559.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down
2 changes: 2 additions & 0 deletions consensus/misc/eip1559_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ func copyConfig(original *chain.Config) *chain.Config {
func config() *chain.Config {
config := copyConfig(params.TestChainConfig)
config.LondonBlock = big.NewInt(5)
// setting the default expected fee for tests
config.ZkDefaultGasPrice = params.InitialBaseFee
return config
}

Expand Down
1 change: 1 addition & 0 deletions eth/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
8 changes: 5 additions & 3 deletions zk/tests/unwinds/unwind.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ dataPath="./datadir"
firstStop=11204
stopBlock=11315
unwindBatch=70
firstTimeout=120s
secondTimeout=60s

rm -rf "$dataPath/rpc-datadir"
rm -rf "$dataPath/phase1-dump1"
Expand All @@ -31,7 +33,7 @@ timeout 300s go run ./zk/debug_tools/datastream-host --file="$(pwd)/zk/tests/unw
sleep 5

# run erigon for a while to sync to the unwind point to capture the dump
timeout 40s ./build/bin/cdk-erigon \
timeout $firstTimeout ./build/bin/cdk-erigon \
--datadir="$dataPath/rpc-datadir" \
--config=./dynamic-integration8.yaml \
--zkevm.sync-limit=${firstStop}
Expand All @@ -40,7 +42,7 @@ timeout 40s ./build/bin/cdk-erigon \
go run ./cmd/hack --action=dumpAll --chaindata="$dataPath/rpc-datadir/chaindata" --output="$dataPath/phase1-dump1"

# now run to the final stop block
timeout 15s ./build/bin/cdk-erigon \
timeout $secondTimeout ./build/bin/cdk-erigon \
--datadir="$dataPath/rpc-datadir" \
--config=./dynamic-integration8.yaml \
--zkevm.sync-limit=${stopBlock}
Expand All @@ -59,7 +61,7 @@ go run ./cmd/integration state_stages_zkevm \
go run ./cmd/hack --action=dumpAll --chaindata="$dataPath/rpc-datadir/chaindata" --output="$dataPath/phase1-dump2"

# now sync again
timeout 15s ./build/bin/cdk-erigon \
timeout $secondTimeout ./build/bin/cdk-erigon \
--datadir="$dataPath/rpc-datadir" \
--config=./dynamic-integration8.yaml \
--zkevm.sync-limit=${stopBlock}
Expand Down
Loading