From cbb1ecabbe26ec2e8cb4edf0f5d12b2c84d433c8 Mon Sep 17 00:00:00 2001 From: Darioush Jalali Date: Fri, 2 Aug 2024 09:02:48 -0700 Subject: [PATCH 1/2] nits, update comments --- params/avalanche_params.go | 10 +++++----- params/config.go | 6 ++++-- params/config_extra.go | 9 +++++++-- plugin/evm/vm.go | 2 +- plugin/evm/vm_test.go | 2 +- 5 files changed, 18 insertions(+), 11 deletions(-) diff --git a/params/avalanche_params.go b/params/avalanche_params.go index c222034fd1..836accbf9e 100644 --- a/params/avalanche_params.go +++ b/params/avalanche_params.go @@ -21,12 +21,12 @@ const ( ApricotPhase1GasLimit uint64 = 8_000_000 CortinaGasLimit uint64 = 15_000_000 - ApricotPhase3MinBaseFee int64 = 75_000_000_000 - ApricotPhase3MaxBaseFee int64 = 225_000_000_000 - ApricotPhase3InitialBaseFee int64 = 225_000_000_000 + ApricotPhase3MinBaseFee int64 = 75 * GWei + ApricotPhase3MaxBaseFee int64 = 225 * GWei + ApricotPhase3InitialBaseFee int64 = 225 * GWei ApricotPhase3TargetGas uint64 = 10_000_000 - ApricotPhase4MinBaseFee int64 = 25_000_000_000 - ApricotPhase4MaxBaseFee int64 = 1_000_000_000_000 + ApricotPhase4MinBaseFee int64 = 25 * GWei + ApricotPhase4MaxBaseFee int64 = 1_000 * GWei ApricotPhase4BaseFeeChangeDenominator uint64 = 12 ApricotPhase5TargetGas uint64 = 15_000_000 ApricotPhase5BaseFeeChangeDenominator uint64 = 36 diff --git a/params/config.go b/params/config.go index 331446d2d4..646cc048d0 100644 --- a/params/config.go +++ b/params/config.go @@ -539,8 +539,10 @@ 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 on the Avalanche network. (nil = no fork, 0 = already activated) - // It activates Cancun and reduces the min base fee. + // EUpgrade 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"` // Cancun activates the Cancun upgrade from Ethereum. (nil = no fork, 0 = already activated) diff --git a/params/config_extra.go b/params/config_extra.go index 0e86411b19..82d9e3df40 100644 --- a/params/config_extra.go +++ b/params/config_extra.go @@ -130,8 +130,13 @@ func getUpgradeTime(networkID uint32, upgradeTimes map[uint32]time.Time) *uint64 return utils.NewUint64(0) } -// SetEVMUpgrades sets the mapped upgrades (Avalanche > EVM upgrades) for the chain config. -func (c *ChainConfig) SetEVMUpgrades() { +// SetEthUpgrades enables Etheruem network upgrades using the same time as +// the Avalanche network upgrade that enables them. +// +// TODO: Prior to Cancun, Avalanche upgrades are referenced inline in the +// 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) } diff --git a/plugin/evm/vm.go b/plugin/evm/vm.go index 5a76f08e28..cca7605c99 100644 --- a/plugin/evm/vm.go +++ b/plugin/evm/vm.go @@ -490,7 +490,7 @@ func (vm *VM) Initialize( vm.chainID = g.Config.ChainID - g.Config.SetEVMUpgrades() + g.Config.SetEthUpgrades() vm.ethConfig = ethconfig.NewDefaultConfig() vm.ethConfig.Genesis = g diff --git a/plugin/evm/vm_test.go b/plugin/evm/vm_test.go index ecd5fc626a..e14b04ddc0 100644 --- a/plugin/evm/vm_test.go +++ b/plugin/evm/vm_test.go @@ -4113,7 +4113,7 @@ func TestNoBlobsAllowed(t *testing.T) { Gas: params.TxGas, To: testEthAddrs[0], BlobFeeCap: uint256.NewInt(1), - BlobHashes: []common.Hash{{1}}, + BlobHashes: []common.Hash{{1}}, // This blob is expected to cause verification to fail Value: new(uint256.Int), }), signer, testKeys[0].ToECDSA()) require.NoError(err) From a4568197f1d424729e59962eeaba883dd3994e12 Mon Sep 17 00:00:00 2001 From: Darioush Jalali Date: Fri, 2 Aug 2024 09:11:50 -0700 Subject: [PATCH 2/2] pr comment --- params/avalanche_params.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/params/avalanche_params.go b/params/avalanche_params.go index 836accbf9e..6faf835809 100644 --- a/params/avalanche_params.go +++ b/params/avalanche_params.go @@ -13,8 +13,8 @@ import ( const ( // MinGasPrice is the number of nAVAX required per gas unit for a // transaction to be valid, measured in wei - LaunchMinGasPrice int64 = 470_000_000_000 - ApricotPhase1MinGasPrice int64 = 225_000_000_000 + LaunchMinGasPrice int64 = 470 * GWei + ApricotPhase1MinGasPrice int64 = 225 * GWei AvalancheAtomicTxFee = units.MilliAvax