-
Notifications
You must be signed in to change notification settings - Fork 276
Add requirement that Subnet-evm upgrade is enabled at genesis #419
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
Conversation
plugin/evm/vm_test.go
Outdated
} | ||
|
||
func TestSubnetEVMUpgradeNotEnabledAtGenesis(t *testing.T) { | ||
ctx, dbManager, genesisBytes, issuer := setupGenesis(t, genesisJSONSubnetEVMLateEnablement) |
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.
alternatively we can parse the json for genesisJSONSubnetEVM
and modify the value in the test.
Need to fix some existing tests. With this new guard in place, it should no longer be possible to abort an Subnet-EVM upgrade as it is a requirement |
plugin/evm/vm_upgrade_bytes_test.go
Outdated
// Get a json specifying a Network upgrade at genesis | ||
// to apply as upgradeBytes. | ||
subnetEVMTimestamp := time.Unix(10, 0) | ||
subnetEVMTimestamp := big.NewInt(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.
subnetEVMTimestamp must be 0 to be activated at genesis
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.
Can we require that this is set directly in the genesis rather than in the upgrade bytes to make this simpler?
plugin/evm/vm_upgrade_bytes_test.go
Outdated
|
||
// abort a fork specified in genesis | ||
upgradeConfig.NetworkUpgrades.SubnetEVMTimestamp = nil | ||
upgradeConfig.NetworkUpgrades = nil |
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.
no longer testing abort, but now testing the fallback genesis bytes
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.
LGTM
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.
code generally lgtm. I just wonder if we should add a flag to avago-chain config to skip this check? We can emphasize this is just for testing purposes and should not be used in producion. it can also still be used for chains that are bot upgraded to subnet-evm.
plugin/evm/vm.go
Outdated
if !vm.chainConfig.IsSubnetEVM(common.Big0) { | ||
return errSubnetEVMUpgradeNotEnabled | ||
} | ||
|
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.
Shall we move this below to upgradeBytes
parsing, in case this was activated by a upgrade at genesis? Could this be a possibility? @aaronbuchwald @darioush
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.
They could include it in the upgrade bytes to activate at timestamp 0, but it SHOULD always be included in the genesis, so I think it's preferable to error here rather than after applying the upgradeBytes
. I actually asked @anusha-ctrl to make this change to put it here.
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.
just thinking someone might want to fix their genesis via this method (or by removing the checks via config flag).
Good idea, this way we do not need to create a new release if anyone runs into this unexpectedly. I confirmed in https://github.com/ava-labs/public-chain-assets/ that none of the networks here should be impacted. @anusha-ctrl could you add a config flag that will allow a user to override this check in case anyone runs into it along with a TODO to remove once we confirm that there are no complaints after making this change? |
…/subnet-evm into add-upgrade-requirement
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.
Nice 👍
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.
LGTM
Why this should be merged
How this works
SubnetEVMTimestamp
.SubnetEVMTimestamp
should be set to 0 so the SubnetEVM upgrade is enabled at genesis.genesisJSON
did not includesubnetEVMTimestamp
orsubnetEVMTimestamp
was set to some timestamp > 0Here is an example of the chain config
How this was tested