use the correct network version in genesis

1. Version 0 upgrades happen _after_ genesis.
2. Get rid of UseNewestNetwork. It's not useful and quite dangerous.
This commit is contained in:
Steven Allen 2020-10-08 14:23:09 -07:00
parent bcabe7b3b5
commit 710ac9d544
2 changed files with 21 additions and 14 deletions

View File

@ -16,14 +16,6 @@ func DhtProtocolName(netName dtypes.NetworkName) protocol.ID {
return protocol.ID("/fil/kad/" + string(netName))
}
func UseNewestNetwork() bool {
// TODO: Put these in a container we can iterate over
if UpgradeBreezeHeight <= 0 && UpgradeSmokeHeight <= 0 && UpgradeActorsV2Height <= 0 {
return true
}
return false
}
func SetAddressNetwork(n address.Network) {
address.CurrentNetwork = n
}

View File

@ -50,12 +50,27 @@ func doExecValue(ctx context.Context, vm *vm.VM, to, from address.Address, value
return ret.Return, nil
}
var GenesisNetworkVersion = func() network.Version { // TODO: Get from build/
if build.UseNewestNetwork() { // TODO: Get from build/
return build.NewestNetworkVersion // TODO: Get from build/
} // TODO: Get from build/
return network.Version1 // TODO: Get from build/
}() // TODO: Get from build/
// TODO: Get from build
// TODO: make a list/schedule of these.
var GenesisNetworkVersion = func() network.Version {
// returns the version _before_ the first upgrade.
if build.UpgradeBreezeHeight >= 0 {
return network.Version0
}
if build.UpgradeSmokeHeight >= 0 {
return network.Version1
}
if build.UpgradeIgnitionHeight >= 0 {
return network.Version2
}
if build.UpgradeActorsV2Height >= 0 {
return network.Version3
}
if build.UpgradeLiftoffHeight >= 0 {
return network.Version3
}
return build.ActorUpgradeNetworkVersion - 1 // genesis requires actors v0.
}()
func genesisNetworkVersion(context.Context, abi.ChainEpoch) network.Version { // TODO: Get from build/
return GenesisNetworkVersion // TODO: Get from build/