-
Notifications
You must be signed in to change notification settings - Fork 275
mandatory network upgrades #640
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
Changes from 2 commits
41bc6f9
5a8277e
57ae650
e296ee0
c7c42af
0f3b91e
a5d1b00
5f0b046
975b74e
28ed33a
0fb40f4
584498e
053b72c
297474c
11e649e
fe3d9f8
8173f2c
2565137
d130ce0
74f82e6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -290,6 +290,10 @@ func (vm *VM) Initialize( | |
g.Config = params.SubnetEVMDefaultChainConfig | ||
} | ||
|
||
// We enforce network upgrades here, regardless of the chain config | ||
// provided in the genesis file. | ||
g.Config.NetworkUpgrades = params.GetNetworkUpgrades(chainCtx.NetworkID) | ||
|
||
// Load airdrop file if provided | ||
if vm.config.AirdropFile != "" { | ||
g.AirdropData, err = os.ReadFile(vm.config.AirdropFile) | ||
|
@@ -310,6 +314,10 @@ func (vm *VM) Initialize( | |
|
||
vm.ethConfig = ethconfig.NewDefaultConfig() | ||
vm.ethConfig.Genesis = g | ||
// NetworkID of EVM is equal to the ChainID | ||
// But this is different than Avalanche's NetworkID | ||
// which represents the Avalanche network the EVM is running on | ||
// like Fuji, Mainnet, Local, etc. | ||
|
||
vm.ethConfig.NetworkId = g.Config.ChainID.Uint64() | ||
|
||
// Set minimum price for mining and default gas price oracle value to the min | ||
|
@@ -376,14 +384,6 @@ func (vm *VM) Initialize( | |
vm.chainConfig = g.Config | ||
vm.networkID = vm.ethConfig.NetworkId | ||
|
||
// TODO: remove SkipSubnetEVMUpgradeCheck after next network upgrade | ||
if !vm.config.SkipSubnetEVMUpgradeCheck { | ||
// check that subnetEVM upgrade is enabled from genesis before upgradeBytes | ||
if !vm.chainConfig.IsSubnetEVM(common.Big0) { | ||
return errSubnetEVMUpgradeNotEnabled | ||
} | ||
} | ||
|
||
// Apply upgradeBytes (if any) by unmarshalling them into [chainConfig.UpgradeConfig]. | ||
// Initializing the chain will verify upgradeBytes are compatible with existing values. | ||
if len(upgradeBytes) > 0 { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we needed to add a network upgrade where the timestamp was set by each instance of Subnet-EVM as opposed to being hardcoded in Subnet-EVM for official Avalanche network-wide upgrades, how would we do that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are 2 different options:
1- Allow these timestamps to be overriden by genesis/external upgrades
2- Allow separate optional network upgrades.
There could be some problems allowing overrides for avalanche network-wide upgrades. Like AvalancheGo versions, a critical bug etc etc.
I can revert changes that removes specifiable network upgrades, and convert them to "Optional" network upgrades. In any case we should keep this mandatory network upgrade notion in the code, without expecting to be activated by genesis/upgrade files.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added optional network upgrades