prysm-pulse/shared/testutil/state_test.go
Preston Van Loon b7175b3482
Update fastssz: Attempt 2 (#7115)
* Revert "Revert "Update fastssz" (#7100)"

This reverts commit b954db9704.
* Preston's patch
* Merge branch 'master' of github.com:prysmaticlabs/prysm into revert-7100-revert-6760-update-fssz
* Update fssz, add regression test case
* more HTR with fssz
* fix some tests
* only one test left
* Make it so that HTR will work
* gofmt, imports
* gofmt, imports
* fix
* Merge branch 'master' of github.com:prysmaticlabs/prysm into revert-7100-revert-6760-update-fssz
* fix
* Merge branch 'master' into revert-7100-revert-6760-update-fssz
* Merge refs/heads/master into revert-7100-revert-6760-update-fssz
* gaz
* Merge branch 'revert-7100-revert-6760-update-fssz' of github.com:prysmaticlabs/prysm into revert-7100-revert-6760-update-fssz
* Merge refs/heads/master into revert-7100-revert-6760-update-fssz
* fix test
* Merge branch 'revert-7100-revert-6760-update-fssz' of github.com:prysmaticlabs/prysm into revert-7100-revert-6760-update-fssz
* Merge refs/heads/master into revert-7100-revert-6760-update-fssz
2020-08-27 18:13:32 +00:00

30 lines
730 B
Go

package testutil
import (
"context"
"reflect"
"testing"
pb "github.com/prysmaticlabs/prysm/proto/beacon/p2p/v1"
"github.com/prysmaticlabs/prysm/shared/testutil/require"
)
func TestNewBeaconState(t *testing.T) {
st := NewBeaconState()
b, err := st.InnerStateUnsafe().MarshalSSZ()
require.NoError(t, err)
got := &pb.BeaconState{}
require.NoError(t, got.UnmarshalSSZ(b))
if !reflect.DeepEqual(st.InnerStateUnsafe(), got) {
t.Fatal("State did not match after round trip marshal")
}
}
func TestNewBeaconState_HashTreeRoot(t *testing.T) {
_, err := st.HashTreeRoot(context.Background())
require.NoError(t, err)
state := NewBeaconState()
_, err = state.HashTreeRoot(context.Background())
require.NoError(t, err)
}