Skip to content
This repository was archived by the owner on Nov 25, 2025. It is now read-only.

Commit 8469c81

Browse files
Remove avalanche_params.go (#817)
1 parent b0430f8 commit 8469c81

File tree

23 files changed

+159
-86
lines changed

23 files changed

+159
-86
lines changed

consensus/dummy/consensus.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ import (
2121
"github.com/ava-labs/coreth/utils"
2222
"github.com/ethereum/go-ethereum/common"
2323

24+
"github.com/ava-labs/coreth/plugin/evm/ap1"
25+
"github.com/ava-labs/coreth/plugin/evm/cortina"
2426
customheader "github.com/ava-labs/coreth/plugin/evm/header"
2527
)
2628

@@ -121,12 +123,12 @@ func (eng *DummyEngine) verifyHeaderGasFields(config *params.ChainConfig, header
121123
return fmt.Errorf("invalid gasUsed: have %d, gasLimit %d", header.GasUsed, header.GasLimit)
122124
}
123125
if config.IsCortina(header.Time) {
124-
if header.GasLimit != params.CortinaGasLimit {
125-
return fmt.Errorf("expected gas limit to be %d in Cortina, but found %d", params.CortinaGasLimit, header.GasLimit)
126+
if header.GasLimit != cortina.GasLimit {
127+
return fmt.Errorf("expected gas limit to be %d in Cortina, but found %d", cortina.GasLimit, header.GasLimit)
126128
}
127129
} else if config.IsApricotPhase1(header.Time) {
128-
if header.GasLimit != params.ApricotPhase1GasLimit {
129-
return fmt.Errorf("expected gas limit to be %d in ApricotPhase1, but found %d", params.ApricotPhase1GasLimit, header.GasLimit)
130+
if header.GasLimit != ap1.GasLimit {
131+
return fmt.Errorf("expected gas limit to be %d in ApricotPhase1, but found %d", ap1.GasLimit, header.GasLimit)
130132
}
131133
} else {
132134
// Verify that the gas limit remains within allowed bounds

core/chain_makers.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ import (
3737
"github.com/ava-labs/coreth/core/types"
3838
"github.com/ava-labs/coreth/core/vm"
3939
"github.com/ava-labs/coreth/params"
40+
"github.com/ava-labs/coreth/plugin/evm/ap1"
41+
"github.com/ava-labs/coreth/plugin/evm/cortina"
4042
"github.com/ava-labs/coreth/plugin/evm/header"
4143
"github.com/ava-labs/coreth/triedb"
4244
"github.com/ethereum/go-ethereum/common"
@@ -375,9 +377,9 @@ func (cm *chainMaker) makeHeader(parent *types.Block, gap uint64, state *state.S
375377

376378
var gasLimit uint64
377379
if cm.config.IsCortina(time) {
378-
gasLimit = params.CortinaGasLimit
380+
gasLimit = cortina.GasLimit
379381
} else if cm.config.IsApricotPhase1(time) {
380-
gasLimit = params.ApricotPhase1GasLimit
382+
gasLimit = ap1.GasLimit
381383
} else {
382384
gasLimit = CalcGasLimit(parent.GasUsed(), parent.GasLimit(), parent.GasLimit(), parent.GasLimit())
383385
}

core/state_processor_test.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@ import (
3939
"github.com/ava-labs/coreth/core/types"
4040
"github.com/ava-labs/coreth/core/vm"
4141
"github.com/ava-labs/coreth/params"
42+
"github.com/ava-labs/coreth/plugin/evm/ap1"
4243
"github.com/ava-labs/coreth/plugin/evm/ap3"
44+
"github.com/ava-labs/coreth/plugin/evm/cortina"
4345
"github.com/ava-labs/coreth/plugin/evm/header"
4446
"github.com/ava-labs/coreth/trie"
4547
"github.com/ava-labs/coreth/utils"
@@ -120,7 +122,7 @@ func TestStateProcessorErrors(t *testing.T) {
120122
Nonce: 0,
121123
},
122124
},
123-
GasLimit: params.CortinaGasLimit,
125+
GasLimit: cortina.GasLimit,
124126
}
125127
// FullFaker used to skip header verification that enforces no blobs.
126128
blockchain, _ = NewBlockChain(db, DefaultCacheConfig, gspec, dummy.NewFullFaker(), vm.Config{}, common.Hash{}, false)
@@ -281,7 +283,7 @@ func TestStateProcessorErrors(t *testing.T) {
281283
Nonce: 0,
282284
},
283285
},
284-
GasLimit: params.ApricotPhase1GasLimit,
286+
GasLimit: ap1.GasLimit,
285287
}
286288
blockchain, _ = NewBlockChain(db, DefaultCacheConfig, gspec, dummy.NewCoinbaseFaker(), vm.Config{}, common.Hash{}, false)
287289
)
@@ -321,7 +323,7 @@ func TestStateProcessorErrors(t *testing.T) {
321323
Code: common.FromHex("0xB0B0FACE"),
322324
},
323325
},
324-
GasLimit: params.CortinaGasLimit,
326+
GasLimit: cortina.GasLimit,
325327
}
326328
blockchain, _ = NewBlockChain(db, DefaultCacheConfig, gspec, dummy.NewCoinbaseFaker(), vm.Config{}, common.Hash{}, false)
327329
)

core/state_transition_test.go

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ import (
3737
"github.com/ava-labs/coreth/core/types"
3838
"github.com/ava-labs/coreth/core/vm"
3939
"github.com/ava-labs/coreth/params"
40+
"github.com/ava-labs/coreth/plugin/evm/ap0"
41+
"github.com/ava-labs/coreth/plugin/evm/ap1"
4042
"github.com/ethereum/go-ethereum/common"
4143
"github.com/ethereum/go-ethereum/crypto"
4244
ethCrypto "github.com/ethereum/go-ethereum/crypto"
@@ -104,7 +106,7 @@ func executeStateTransitionTest(t *testing.T, st stateTransitionTest) {
104106
Nonce: 0,
105107
},
106108
},
107-
GasLimit: params.ApricotPhase1GasLimit,
109+
GasLimit: ap1.GasLimit,
108110
}
109111
genesis = gspec.ToBlock()
110112
engine = dummy.NewFaker()
@@ -138,8 +140,8 @@ func TestNativeAssetContractCall(t *testing.T) {
138140

139141
contractAddr := ethCrypto.CreateAddress(testAddr, 0)
140142
txs := []*types.Transaction{
141-
makeContractTx(0, common.Big0, 500_000, big.NewInt(params.LaunchMinGasPrice), data),
142-
makeTx(1, contractAddr, common.Big0, 100_000, big.NewInt(params.LaunchMinGasPrice), nil), // No input data is necessary, since this will hit the contract's fallback function.
143+
makeContractTx(0, common.Big0, 500_000, big.NewInt(ap0.MinGasPrice), data),
144+
makeTx(1, contractAddr, common.Big0, 100_000, big.NewInt(ap0.MinGasPrice), nil), // No input data is necessary, since this will hit the contract's fallback function.
143145
}
144146

145147
tests := map[string]stateTransitionTest{
@@ -195,7 +197,7 @@ func TestNativeAssetContractConstructor(t *testing.T) {
195197
require.NoError(err)
196198

197199
txs := []*types.Transaction{
198-
makeContractTx(0, common.Big0, 100_000, big.NewInt(params.LaunchMinGasPrice), data),
200+
makeContractTx(0, common.Big0, 100_000, big.NewInt(ap0.MinGasPrice), data),
199201
}
200202

201203
phase6Tests := map[string]stateTransitionTest{
@@ -234,7 +236,7 @@ func TestNativeAssetContractConstructor(t *testing.T) {
234236

235237
func TestNativeAssetDirectEOACall(t *testing.T) {
236238
txs := []*types.Transaction{
237-
makeTx(0, vm.NativeAssetCallAddr, common.Big0, 100_000, big.NewInt(params.LaunchMinGasPrice), nil),
239+
makeTx(0, vm.NativeAssetCallAddr, common.Big0, 100_000, big.NewInt(ap0.MinGasPrice), nil),
238240
}
239241

240242
phase6Tests := map[string]stateTransitionTest{

eth/gasprice/gasprice_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ import (
3939
"github.com/ava-labs/coreth/core/types"
4040
"github.com/ava-labs/coreth/core/vm"
4141
"github.com/ava-labs/coreth/params"
42+
"github.com/ava-labs/coreth/plugin/evm/ap1"
4243
customheader "github.com/ava-labs/coreth/plugin/evm/header"
4344
"github.com/ava-labs/coreth/rpc"
4445
"github.com/ethereum/go-ethereum/common"
@@ -352,7 +353,7 @@ func TestSuggestGasPricePreAP3(t *testing.T) {
352353
b.SetCoinbase(common.Address{1})
353354

354355
signer := types.LatestSigner(params.TestApricotPhase2Config)
355-
gasPrice := big.NewInt(params.ApricotPhase1MinGasPrice)
356+
gasPrice := big.NewInt(ap1.MinGasPrice)
356357
for j := 0; j < 50; j++ {
357358
tx := types.NewTx(&types.LegacyTx{
358359
Nonce: b.TxNonce(addr),

ethclient/simulated/options_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import (
2626
"github.com/ava-labs/coreth/core/types"
2727
"github.com/ava-labs/coreth/interfaces"
2828
"github.com/ava-labs/coreth/params"
29+
"github.com/ava-labs/coreth/plugin/evm/cortina"
2930
)
3031

3132
// Tests that the simulator starts with the initial gas limit in the genesis block,
@@ -49,8 +50,8 @@ func TestWithBlockGasLimitOption(t *testing.T) {
4950
if err != nil {
5051
t.Fatalf("failed to retrieve head block: %v", err)
5152
}
52-
if head.GasLimit() != params.CortinaGasLimit {
53-
t.Errorf("head gas limit mismatch: have %v, want %v", head.GasLimit(), params.CortinaGasLimit)
53+
if head.GasLimit() != cortina.GasLimit {
54+
t.Errorf("head gas limit mismatch: have %v, want %v", head.GasLimit(), cortina.GasLimit)
5455
}
5556
}
5657

internal/ethapi/api.coreth.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ import (
88
"fmt"
99
"math/big"
1010

11-
"github.com/ava-labs/coreth/params"
11+
"github.com/ava-labs/coreth/plugin/evm/etna"
1212
"github.com/ethereum/go-ethereum/common/hexutil"
1313
"github.com/ethereum/go-ethereum/common/math"
1414
)
1515

1616
const (
1717
nAVAX = 1_000_000_000
1818

19-
minBaseFee = params.EtnaMinBaseFee // 1 nAVAX
19+
minBaseFee = etna.MinBaseFee // 1 nAVAX
2020
maxNormalBaseFee = 100 * nAVAX
2121

2222
minGasTip = 1 // 1 wei

miner/worker.go

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ import (
4646
"github.com/ava-labs/coreth/core/types"
4747
"github.com/ava-labs/coreth/core/vm"
4848
"github.com/ava-labs/coreth/params"
49+
"github.com/ava-labs/coreth/plugin/evm/ap1"
50+
"github.com/ava-labs/coreth/plugin/evm/cortina"
4951
"github.com/ava-labs/coreth/plugin/evm/header"
5052
"github.com/ava-labs/coreth/precompile/precompileconfig"
5153
"github.com/ava-labs/coreth/predicate"
@@ -148,13 +150,15 @@ func (w *worker) commitNewWork(predicateContext *precompileconfig.PredicateConte
148150

149151
var gasLimit uint64
150152
if w.chainConfig.IsCortina(timestamp) {
151-
gasLimit = params.CortinaGasLimit
153+
gasLimit = cortina.GasLimit
152154
} else if w.chainConfig.IsApricotPhase1(timestamp) {
153-
gasLimit = params.ApricotPhase1GasLimit
155+
gasLimit = ap1.GasLimit
154156
} else {
155-
// The gas limit is set in phase1 to ApricotPhase1GasLimit because the ceiling and floor were set to the same value
156-
// such that the gas limit converged to it. Since this is hardbaked now, we remove the ability to configure it.
157-
gasLimit = core.CalcGasLimit(parent.GasUsed, parent.GasLimit, params.ApricotPhase1GasLimit, params.ApricotPhase1GasLimit)
157+
// The gas limit is set in phase1 to [ap1.GasLimit] because the ceiling
158+
// and floor were set to the same value such that the gas limit
159+
// converged to it. Since this is hardcoded now, we remove the ability
160+
// to configure it.
161+
gasLimit = core.CalcGasLimit(parent.GasUsed, parent.GasLimit, ap1.GasLimit, ap1.GasLimit)
158162
}
159163

160164
extra, err := header.ExtraPrefix(w.chainConfig, parent, timestamp)

params/avalanche_params.go

Lines changed: 0 additions & 22 deletions
This file was deleted.

plugin/evm/ap0/params.go

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// (c) 2025, Ava Labs, Inc. All rights reserved.
2+
// See the file LICENSE for licensing terms.
3+
4+
// AP0 defines constants used during the initial network launch.
5+
package ap0
6+
7+
import (
8+
"github.com/ava-labs/avalanchego/utils/units"
9+
"github.com/ava-labs/coreth/utils"
10+
)
11+
12+
const (
13+
// MinGasPrice is the minimum gas price of a transaction.
14+
//
15+
// This value was modified by `ap1.MinGasPrice`.
16+
MinGasPrice = 470 * utils.GWei
17+
18+
// AtomicTxFee is the amount of AVAX that must be burned by an atomic tx.
19+
//
20+
// This value was replaced with the Apricot Phase 3 dynamic fee mechanism.
21+
AtomicTxFee = units.MilliAvax
22+
)

0 commit comments

Comments
 (0)