2020-10-13 22:00:01 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"math"
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/filecoin-project/go-state-types/abi"
|
|
|
|
|
|
|
|
"github.com/filecoin-project/lotus/build"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestProtocolCodenames(t *testing.T) {
|
|
|
|
if height := abi.ChainEpoch(100); GetProtocolCodename(height) != "genesis" {
|
|
|
|
t.Fatal("expected genesis codename")
|
|
|
|
}
|
|
|
|
|
|
|
|
if height := abi.ChainEpoch(build.UpgradeBreezeHeight + 1); GetProtocolCodename(height) != "breeze" {
|
|
|
|
t.Fatal("expected breeze codename")
|
|
|
|
}
|
|
|
|
|
2021-01-05 05:43:37 +00:00
|
|
|
if height := build.UpgradeActorsV2Height + 1; GetProtocolCodename(abi.ChainEpoch(height)) != "actorsv2" {
|
2020-10-13 22:00:01 +00:00
|
|
|
t.Fatal("expected actorsv2 codename")
|
|
|
|
}
|
|
|
|
|
|
|
|
if height := abi.ChainEpoch(math.MaxInt64); GetProtocolCodename(height) != ProtocolCodenames[len(ProtocolCodenames)-1].name {
|
|
|
|
t.Fatal("expected last codename")
|
|
|
|
}
|
|
|
|
}
|