From c0f94ee4a1393365dbd082d4405599ce6aa91779 Mon Sep 17 00:00:00 2001 From: Ceyhun Onur Date: Mon, 12 Aug 2024 22:18:38 +0300 Subject: [PATCH] rename etna (#632) --- consensus/dummy/dynamic_fees.go | 8 ++--- consensus/dummy/dynamic_fees_test.go | 8 ++--- core/txpool/blobpool/blobpool_test.go | 6 ++-- params/avalanche_params.go | 2 +- params/config.go | 50 +++++++++++++-------------- params/config_extra.go | 4 +-- params/network_upgrades.go | 6 ++-- plugin/evm/vm.go | 22 ++++++------ plugin/evm/vm_test.go | 16 ++++----- 9 files changed, 61 insertions(+), 61 deletions(-) diff --git a/consensus/dummy/dynamic_fees.go b/consensus/dummy/dynamic_fees.go index b7edc851ef..72fb03cbfd 100644 --- a/consensus/dummy/dynamic_fees.go +++ b/consensus/dummy/dynamic_fees.go @@ -21,7 +21,7 @@ var ( ApricotPhase4MinBaseFee = big.NewInt(params.ApricotPhase4MinBaseFee) ApricotPhase4MaxBaseFee = big.NewInt(params.ApricotPhase4MaxBaseFee) ApricotPhase3InitialBaseFee = big.NewInt(params.ApricotPhase3InitialBaseFee) - EUpgradeMinBaseFee = big.NewInt(params.EUpgradeMinBaseFee) + EtnaMinBaseFee = big.NewInt(params.EtnaMinBaseFee) ApricotPhase4BaseFeeChangeDenominator = new(big.Int).SetUint64(params.ApricotPhase4BaseFeeChangeDenominator) ApricotPhase5BaseFeeChangeDenominator = new(big.Int).SetUint64(params.ApricotPhase5BaseFeeChangeDenominator) @@ -46,7 +46,7 @@ func CalcBaseFee(config *params.ChainConfig, parent *types.Header, timestamp uin isApricotPhase3 = config.IsApricotPhase3(parent.Time) isApricotPhase4 = config.IsApricotPhase4(parent.Time) isApricotPhase5 = config.IsApricotPhase5(parent.Time) - isEUpgrade = config.IsEUpgrade(parent.Time) + isEtna = config.IsEtna(parent.Time) ) if !isApricotPhase3 || parent.Number.Cmp(common.Big0) == 0 { initialSlice := make([]byte, params.DynamicFeeExtraDataSize) @@ -179,8 +179,8 @@ func CalcBaseFee(config *params.ChainConfig, parent *types.Header, timestamp uin // Ensure that the base fee does not increase/decrease outside of the bounds switch { - case isEUpgrade: - baseFee = selectBigWithinBounds(EUpgradeMinBaseFee, baseFee, nil) + case isEtna: + baseFee = selectBigWithinBounds(EtnaMinBaseFee, baseFee, nil) case isApricotPhase5: baseFee = selectBigWithinBounds(ApricotPhase4MinBaseFee, baseFee, nil) case isApricotPhase4: diff --git a/consensus/dummy/dynamic_fees_test.go b/consensus/dummy/dynamic_fees_test.go index 2fb90c84db..3ed5401f32 100644 --- a/consensus/dummy/dynamic_fees_test.go +++ b/consensus/dummy/dynamic_fees_test.go @@ -539,14 +539,14 @@ func TestCalcBlockGasCost(t *testing.T) { } } -func TestDynamicFeesEUpgrade(t *testing.T) { +func TestDynamicFeesEtna(t *testing.T) { require := require.New(t) header := &types.Header{ Number: big.NewInt(0), } timestamp := uint64(1) - extra, nextBaseFee, err := CalcBaseFee(params.TestEUpgradeChainConfig, header, timestamp) + extra, nextBaseFee, err := CalcBaseFee(params.TestEtnaChainConfig, header, timestamp) require.NoError(err) // Genesis matches the initial base fee require.Equal(params.ApricotPhase3InitialBaseFee, nextBaseFee.Int64()) @@ -558,9 +558,9 @@ func TestDynamicFeesEUpgrade(t *testing.T) { BaseFee: nextBaseFee, Extra: extra, } - _, nextBaseFee, err = CalcBaseFee(params.TestEUpgradeChainConfig, header, timestamp) + _, nextBaseFee, err = CalcBaseFee(params.TestEtnaChainConfig, header, timestamp) require.NoError(err) - // After some time has passed in the EUpgrade phase, the base fee should drop + // After some time has passed in the Etna phase, the base fee should drop // lower than the prior base fee minimum. require.Less(nextBaseFee.Int64(), params.ApricotPhase4MinBaseFee) } diff --git a/core/txpool/blobpool/blobpool_test.go b/core/txpool/blobpool/blobpool_test.go index aaff113f4a..b4c4591836 100644 --- a/core/txpool/blobpool/blobpool_test.go +++ b/core/txpool/blobpool/blobpool_test.go @@ -91,9 +91,9 @@ func init() { // overrideMinFee sets the minimum base fee to 1 wei for the duration of the test. func overrideMinFee(t *testing.T) { - orig := dummy.EUpgradeMinBaseFee - dummy.EUpgradeMinBaseFee = big.NewInt(1) - t.Cleanup(func() { dummy.EUpgradeMinBaseFee = orig }) + orig := dummy.EtnaMinBaseFee + dummy.EtnaMinBaseFee = big.NewInt(1) + t.Cleanup(func() { dummy.EtnaMinBaseFee = orig }) } // testBlockChain is a mock of the live chain for testing the pool. diff --git a/params/avalanche_params.go b/params/avalanche_params.go index 6faf835809..897fb318f2 100644 --- a/params/avalanche_params.go +++ b/params/avalanche_params.go @@ -30,7 +30,7 @@ const ( ApricotPhase4BaseFeeChangeDenominator uint64 = 12 ApricotPhase5TargetGas uint64 = 15_000_000 ApricotPhase5BaseFeeChangeDenominator uint64 = 36 - EUpgradeMinBaseFee int64 = GWei + EtnaMinBaseFee int64 = GWei DynamicFeeExtraDataSize = 80 RollupWindow uint64 = 10 diff --git a/params/config.go b/params/config.go index 8688b6e4a8..1ea63328d9 100644 --- a/params/config.go +++ b/params/config.go @@ -89,7 +89,7 @@ var ( BanffBlockTimestamp: utils.NewUint64(0), CortinaBlockTimestamp: utils.NewUint64(0), DurangoBlockTimestamp: utils.NewUint64(0), - EUpgradeTime: utils.NewUint64(0), + EtnaTime: utils.NewUint64(0), } TestLaunchConfig = &ChainConfig{ @@ -117,7 +117,7 @@ var ( BanffBlockTimestamp: nil, CortinaBlockTimestamp: nil, DurangoBlockTimestamp: nil, - EUpgradeTime: nil, + EtnaTime: nil, } TestApricotPhase1Config = &ChainConfig{ @@ -145,7 +145,7 @@ var ( BanffBlockTimestamp: nil, CortinaBlockTimestamp: nil, DurangoBlockTimestamp: nil, - EUpgradeTime: nil, + EtnaTime: nil, } TestApricotPhase2Config = &ChainConfig{ @@ -173,7 +173,7 @@ var ( BanffBlockTimestamp: nil, CortinaBlockTimestamp: nil, DurangoBlockTimestamp: nil, - EUpgradeTime: nil, + EtnaTime: nil, } TestApricotPhase3Config = &ChainConfig{ @@ -201,7 +201,7 @@ var ( BanffBlockTimestamp: nil, CortinaBlockTimestamp: nil, DurangoBlockTimestamp: nil, - EUpgradeTime: nil, + EtnaTime: nil, } TestApricotPhase4Config = &ChainConfig{ @@ -229,7 +229,7 @@ var ( BanffBlockTimestamp: nil, CortinaBlockTimestamp: nil, DurangoBlockTimestamp: nil, - EUpgradeTime: nil, + EtnaTime: nil, } TestApricotPhase5Config = &ChainConfig{ @@ -257,7 +257,7 @@ var ( BanffBlockTimestamp: nil, CortinaBlockTimestamp: nil, DurangoBlockTimestamp: nil, - EUpgradeTime: nil, + EtnaTime: nil, } TestApricotPhasePre6Config = &ChainConfig{ @@ -285,7 +285,7 @@ var ( BanffBlockTimestamp: nil, CortinaBlockTimestamp: nil, DurangoBlockTimestamp: nil, - EUpgradeTime: nil, + EtnaTime: nil, } TestApricotPhase6Config = &ChainConfig{ @@ -313,7 +313,7 @@ var ( BanffBlockTimestamp: nil, CortinaBlockTimestamp: nil, DurangoBlockTimestamp: nil, - EUpgradeTime: nil, + EtnaTime: nil, } TestApricotPhasePost6Config = &ChainConfig{ @@ -341,7 +341,7 @@ var ( BanffBlockTimestamp: nil, CortinaBlockTimestamp: nil, DurangoBlockTimestamp: nil, - EUpgradeTime: nil, + EtnaTime: nil, } TestBanffChainConfig = &ChainConfig{ @@ -369,7 +369,7 @@ var ( BanffBlockTimestamp: utils.NewUint64(0), CortinaBlockTimestamp: nil, DurangoBlockTimestamp: nil, - EUpgradeTime: nil, + EtnaTime: nil, } TestCortinaChainConfig = &ChainConfig{ @@ -397,7 +397,7 @@ var ( BanffBlockTimestamp: utils.NewUint64(0), CortinaBlockTimestamp: utils.NewUint64(0), DurangoBlockTimestamp: nil, - EUpgradeTime: nil, + EtnaTime: nil, } TestDurangoChainConfig = &ChainConfig{ @@ -425,10 +425,10 @@ var ( BanffBlockTimestamp: utils.NewUint64(0), CortinaBlockTimestamp: utils.NewUint64(0), DurangoBlockTimestamp: utils.NewUint64(0), - EUpgradeTime: nil, + EtnaTime: nil, } - TestEUpgradeChainConfig = &ChainConfig{ + TestEtnaChainConfig = &ChainConfig{ AvalancheContext: AvalancheContext{utils.TestSnowContext()}, ChainID: big.NewInt(1), HomesteadBlock: big.NewInt(0), @@ -453,7 +453,7 @@ var ( BanffBlockTimestamp: utils.NewUint64(0), CortinaBlockTimestamp: utils.NewUint64(0), DurangoBlockTimestamp: utils.NewUint64(0), - EUpgradeTime: utils.NewUint64(0), + EtnaTime: utils.NewUint64(0), } TestRules = TestChainConfig.Rules(new(big.Int), 0) @@ -485,7 +485,7 @@ func getChainConfig(networkID uint32, chainID *big.Int) *ChainConfig { BanffBlockTimestamp: utils.TimeToNewUint64(agoUpgrade.BanffTime), CortinaBlockTimestamp: utils.TimeToNewUint64(agoUpgrade.CortinaTime), DurangoBlockTimestamp: utils.TimeToNewUint64(agoUpgrade.DurangoTime), - EUpgradeTime: utils.TimeToNewUint64(agoUpgrade.EtnaTime), + EtnaTime: utils.TimeToNewUint64(agoUpgrade.EtnaTime), } } @@ -540,11 +540,11 @@ type ChainConfig struct { // and Avalanche Warp Messaging. (nil = no fork, 0 = already activated) // Note: EIP-4895 is excluded since withdrawals are not relevant to the Avalanche C-Chain or Subnets running the EVM. DurangoBlockTimestamp *uint64 `json:"durangoBlockTimestamp,omitempty"` - // EUpgrade activates Cancun from Ethereum (https://github.com/ethereum/execution-specs/blob/master/network-upgrades/mainnet-upgrades/cancun.md#included-eips) + // Etna activates Cancun from Ethereum (https://github.com/ethereum/execution-specs/blob/master/network-upgrades/mainnet-upgrades/cancun.md#included-eips) // and reduces the min base fee. (nil = no fork, 0 = already activated) // Note: EIP-4844 BlobTxs are not enabled in the mempool and blocks are not // allowed to contain them. For details see https://github.com/avalanche-foundation/ACPs/pull/131 - EUpgradeTime *uint64 `json:"eUpgradeTime,omitempty"` + EtnaTime *uint64 `json:"etnaTime,omitempty"` // Cancun activates the Cancun upgrade from Ethereum. (nil = no fork, 0 = already activated) CancunTime *uint64 `json:"cancunTime,omitempty"` @@ -596,7 +596,7 @@ func (c *ChainConfig) Description() string { banner += fmt.Sprintf(" - Banff Timestamp: @%-10v (https://github.com/ava-labs/avalanchego/releases/tag/v1.9.0)\n", ptrToString(c.BanffBlockTimestamp)) banner += fmt.Sprintf(" - Cortina Timestamp: @%-10v (https://github.com/ava-labs/avalanchego/releases/tag/v1.10.0)\n", ptrToString(c.CortinaBlockTimestamp)) banner += fmt.Sprintf(" - Durango Timestamp: @%-10v (https://github.com/ava-labs/avalanchego/releases/tag/v1.11.0)\n", ptrToString(c.DurangoBlockTimestamp)) - banner += fmt.Sprintf(" - EUpgrade Timestamp: @%-10v (https://github.com/ava-labs/avalanchego/releases/tag/v1.12.0)\n", ptrToString(c.EUpgradeTime)) + banner += fmt.Sprintf(" - Etna Timestamp: @%-10v (https://github.com/ava-labs/avalanchego/releases/tag/v1.12.0)\n", ptrToString(c.EtnaTime)) banner += "\n" upgradeConfigBytes, err := json.Marshal(c.UpgradeConfig) @@ -728,10 +728,10 @@ func (c *ChainConfig) IsDurango(time uint64) bool { return utils.IsTimestampForked(c.DurangoBlockTimestamp, time) } -// IsEUpgrade returns whether [time] represents a block -// with a timestamp after the EUpgrade upgrade time. -func (c *ChainConfig) IsEUpgrade(time uint64) bool { - return utils.IsTimestampForked(c.EUpgradeTime, time) +// IsEtna returns whether [time] represents a block +// with a timestamp after the Etna upgrade time. +func (c *ChainConfig) IsEtna(time uint64) bool { + return utils.IsTimestampForked(c.EtnaTime, time) } // IsCancun returns whether [time] represents a block @@ -964,8 +964,8 @@ func (c *ChainConfig) checkCompatible(newcfg *ChainConfig, height *big.Int, time if isForkTimestampIncompatible(c.DurangoBlockTimestamp, newcfg.DurangoBlockTimestamp, time) { return newTimestampCompatError("Durango fork block timestamp", c.DurangoBlockTimestamp, newcfg.DurangoBlockTimestamp) } - if isForkTimestampIncompatible(c.EUpgradeTime, newcfg.EUpgradeTime, time) { - return newTimestampCompatError("EUpgrade fork block timestamp", c.EUpgradeTime, newcfg.EUpgradeTime) + if isForkTimestampIncompatible(c.EtnaTime, newcfg.EtnaTime, time) { + return newTimestampCompatError("Etna fork block timestamp", c.EtnaTime, newcfg.EtnaTime) } if isForkTimestampIncompatible(c.CancunTime, newcfg.CancunTime, time) { return newTimestampCompatError("Cancun fork block timestamp", c.CancunTime, newcfg.CancunTime) diff --git a/params/config_extra.go b/params/config_extra.go index 24cd7ff0d5..c752bf1a4f 100644 --- a/params/config_extra.go +++ b/params/config_extra.go @@ -127,7 +127,7 @@ func (c *ChainConfig) ToWithUpgradesJSON() *ChainConfigWithUpgradesJSON { // code in place of their Ethereum counterparts. The original Ethereum names // should be restored for maintainability. func (c *ChainConfig) SetEthUpgrades() { - if c.EUpgradeTime != nil { - c.CancunTime = utils.NewUint64(*c.EUpgradeTime) + if c.EtnaTime != nil { + c.CancunTime = utils.NewUint64(*c.EtnaTime) } } diff --git a/params/network_upgrades.go b/params/network_upgrades.go index 5845339ef3..41456c789e 100644 --- a/params/network_upgrades.go +++ b/params/network_upgrades.go @@ -16,7 +16,7 @@ func (c *ChainConfig) forkOrder() []fork { {name: "banffBlockTimestamp", timestamp: c.BanffBlockTimestamp}, {name: "cortinaBlockTimestamp", timestamp: c.CortinaBlockTimestamp}, {name: "durangoBlockTimestamp", timestamp: c.DurangoBlockTimestamp}, - {name: "eUpgradeTime", timestamp: c.EUpgradeTime}, + {name: "etnaTime", timestamp: c.EtnaTime}, } } @@ -26,7 +26,7 @@ type AvalancheRules struct { IsBanff bool IsCortina bool IsDurango bool - IsEUpgrade bool + IsEtna bool } func (c *ChainConfig) GetAvalancheRules(timestamp uint64) AvalancheRules { @@ -42,7 +42,7 @@ func (c *ChainConfig) GetAvalancheRules(timestamp uint64) AvalancheRules { rules.IsBanff = c.IsBanff(timestamp) rules.IsCortina = c.IsCortina(timestamp) rules.IsDurango = c.IsDurango(timestamp) - rules.IsEUpgrade = c.IsEUpgrade(timestamp) + rules.IsEtna = c.IsEtna(timestamp) return rules } diff --git a/plugin/evm/vm.go b/plugin/evm/vm.go index d9a53f14dd..69c4ab3b88 100644 --- a/plugin/evm/vm.go +++ b/plugin/evm/vm.go @@ -702,22 +702,22 @@ func (vm *VM) initializeChain(lastAcceptedHash common.Hash) error { // Set the gas parameters for the tx pool to the minimum gas price for the // latest upgrade. vm.txPool.SetGasTip(big.NewInt(0)) - vm.setMinFeeAtEUpgrade() + vm.setMinFeeAtEtna() vm.eth.Start() return vm.initChainState(vm.blockChain.LastAcceptedBlock()) } -// TODO: remove this after EUpgrade is activated -func (vm *VM) setMinFeeAtEUpgrade() { +// TODO: remove this after Etna is activated +func (vm *VM) setMinFeeAtEtna() { now := vm.clock.Time() - if vm.chainConfig.EUpgradeTime == nil { - // If EUpgrade is not set, set the min fee according to the latest upgrade + if vm.chainConfig.EtnaTime == nil { + // If Etna is not set, set the min fee according to the latest upgrade vm.txPool.SetMinFee(big.NewInt(params.ApricotPhase4MinBaseFee)) return - } else if vm.chainConfig.IsEUpgrade(uint64(now.Unix())) { - // If EUpgrade is activated, set the min fee to the EUpgrade min fee - vm.txPool.SetMinFee(big.NewInt(params.EUpgradeMinBaseFee)) + } else if vm.chainConfig.IsEtna(uint64(now.Unix())) { + // If Etna is activated, set the min fee to the Etna min fee + vm.txPool.SetMinFee(big.NewInt(params.EtnaMinBaseFee)) return } @@ -726,11 +726,11 @@ func (vm *VM) setMinFeeAtEUpgrade() { go func() { defer vm.shutdownWg.Done() - wait := utils.Uint64ToTime(vm.chainConfig.EUpgradeTime).Sub(now) + wait := utils.Uint64ToTime(vm.chainConfig.EtnaTime).Sub(now) t := time.NewTimer(wait) select { - case <-t.C: // Wait for EUpgrade to be activated - vm.txPool.SetMinFee(big.NewInt(params.EUpgradeMinBaseFee)) + case <-t.C: // Wait for Etna to be activated + vm.txPool.SetMinFee(big.NewInt(params.EtnaMinBaseFee)) case <-vm.shutdownChan: } t.Stop() diff --git a/plugin/evm/vm_test.go b/plugin/evm/vm_test.go index 05574fdbf8..197f584b5d 100644 --- a/plugin/evm/vm_test.go +++ b/plugin/evm/vm_test.go @@ -117,9 +117,9 @@ var ( return &cpy } - activateEUpgrade = func(cfg *params.ChainConfig, eUpgradeTime uint64) *params.ChainConfig { + activateEtna = func(cfg *params.ChainConfig, etnaTime uint64) *params.ChainConfig { cpy := *cfg - cpy.EUpgradeTime = &eUpgradeTime + cpy.EtnaTime = &etnaTime return &cpy } @@ -135,8 +135,8 @@ var ( genesisJSONBanff = genesisJSON(params.TestBanffChainConfig) genesisJSONCortina = genesisJSON(params.TestCortinaChainConfig) genesisJSONDurango = genesisJSON(params.TestDurangoChainConfig) - genesisJSONEUpgrade = genesisJSON(params.TestEUpgradeChainConfig) - genesisJSONLatest = genesisJSONEUpgrade + genesisJSONEtna = genesisJSON(params.TestEtnaChainConfig) + genesisJSONLatest = genesisJSONEtna genesisJSONCancun = genesisJSON(activateCancun(params.TestChainConfig)) @@ -4138,13 +4138,13 @@ func TestNoBlobsAllowed(t *testing.T) { require.ErrorContains(err, "blobs not enabled on avalanche networks") } -func TestMinFeeSetAtEUpgrade(t *testing.T) { +func TestMinFeeSetAtEtna(t *testing.T) { require := require.New(t) now := time.Now() - eUpgradeTime := uint64(now.Add(1 * time.Second).Unix()) + etnaTime := uint64(now.Add(1 * time.Second).Unix()) genesis := genesisJSON( - activateEUpgrade(params.TestEUpgradeChainConfig, eUpgradeTime), + activateEtna(params.TestEtnaChainConfig, etnaTime), ) clock := mockable.Clock{} clock.Set(now) @@ -4154,7 +4154,7 @@ func TestMinFeeSetAtEUpgrade(t *testing.T) { require.Equal(params.ApricotPhase4MinBaseFee, initial.Int64()) require.Eventually( - func() bool { return params.EUpgradeMinBaseFee == vm.txPool.MinFee().Int64() }, + func() bool { return params.EtnaMinBaseFee == vm.txPool.MinFee().Int64() }, 5*time.Second, 1*time.Second, )