Skip to content
Open
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
2 changes: 2 additions & 0 deletions plugin/evm/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ type Config struct {
// default to use the parent block's target gas per second.
GasTarget *gas.Gas `json:"gas-target,omitempty"`

InitialTargetExcess *gas.Gas `json:"initial-target-excess,omitempty"`

// Coreth APIs
AdminAPIEnabled bool `json:"admin-api-enabled"`
AdminAPIDir string `json:"admin-api-dir"`
Expand Down
7 changes: 7 additions & 0 deletions plugin/evm/config/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@ _Integer_

The target gas per second that this node will attempt to use when creating blocks. If this config is not specified, the node will default to use the parent block's target gas per second. Defaults to using the parent block's target.

### `initial-target-excess`

_Integer_

The initial target excess that this node will start the chain with. If this
config is not specified, the initial target excess defaults to `0`.

## State Sync

### `state-sync-enabled`
Expand Down
4 changes: 3 additions & 1 deletion plugin/evm/header/dynamic_fee_state.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import (
"github.com/ava-labs/libevm/core/types"
)

var InitialTargetExcess gas.Gas

// feeStateBeforeBlock takes the previous header and the timestamp of its child
// block and calculates the fee state before the child block is executed.
func feeStateBeforeBlock(
Expand All @@ -29,7 +31,7 @@ func feeStateBeforeBlock(
)
}

var state acp176.State
var state acp176.State = acp176.State{TargetExcess: InitialTargetExcess}
Copy link
Collaborator

@ceyonur ceyonur Jul 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this won't result in the desired effect if you also set desiredTargetExcess (even if it does we should not use it like that). We should set MaxTargetExcessDiff to a higher value (or disable smoothing here)

if config.IsFortuna(parent.Time) && parent.Number.Cmp(common.Big0) != 0 {
// If the parent block was running with ACP-176, we start with the
// resulting fee state from the parent block. It is assumed that the
Expand Down
5 changes: 5 additions & 0 deletions plugin/evm/vm.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
"github.com/ava-labs/coreth/network"
"github.com/ava-labs/coreth/plugin/evm/extension"
"github.com/ava-labs/coreth/plugin/evm/gossip"
"github.com/ava-labs/coreth/plugin/evm/header"
"github.com/ava-labs/coreth/plugin/evm/vmerrors"
"github.com/prometheus/client_golang/prometheus"

Expand Down Expand Up @@ -531,6 +532,10 @@ func (vm *VM) initializeChain(lastAcceptedHash common.Hash) error {
*desiredTargetExcess = acp176.DesiredTargetExcess(*vm.config.GasTarget)
}

if vm.config.InitialTargetExcess != nil {
header.InitialTargetExcess = *vm.config.InitialTargetExcess
}

vm.eth, err = eth.New(
node,
&vm.ethConfig,
Expand Down
Loading