lotus/build/builtin_actors_test.go

37 lines
1.0 KiB
Go
Raw Normal View History

package build_test
import (
"testing"
2022-06-14 15:00:51 +00:00
"github.com/stretchr/testify/require"
2022-09-06 15:49:29 +00:00
actorstypes "github.com/filecoin-project/go-state-types/actors"
"github.com/filecoin-project/lotus/build"
"github.com/filecoin-project/lotus/chain/actors"
)
// Test that the embedded metadata is correct.
func TestEmbeddedMetadata(t *testing.T) {
metadata, err := build.ReadEmbeddedBuiltinActorsMetadata()
require.NoError(t, err)
require.Equal(t, metadata, build.EmbeddedBuiltinActorsMetadata)
}
// Test that we're registering the manifest correctly.
func TestRegistration(t *testing.T) {
2022-09-06 15:49:29 +00:00
manifestCid, found := actors.GetManifest(actorstypes.Version8)
require.True(t, found)
require.True(t, manifestCid.Defined())
for _, key := range actors.GetBuiltinActorsKeys(actorstypes.Version8) {
2022-09-06 15:49:29 +00:00
actorCid, found := actors.GetActorCodeID(actorstypes.Version8, key)
require.True(t, found)
name, version, found := actors.GetActorMetaByCode(actorCid)
require.True(t, found)
2022-09-06 15:49:29 +00:00
require.Equal(t, actorstypes.Version8, version)
require.Equal(t, key, name)
}
}