2021-09-23 01:10:25 +00:00
|
|
|
package v2
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
2022-03-15 18:32:09 +00:00
|
|
|
"github.com/prysmaticlabs/prysm/beacon-chain/state"
|
|
|
|
testtmpl "github.com/prysmaticlabs/prysm/beacon-chain/state/testing"
|
2021-09-23 01:10:25 +00:00
|
|
|
ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestBeaconState_LatestBlockHeader(t *testing.T) {
|
2022-03-15 18:32:09 +00:00
|
|
|
testtmpl.VerifyBeaconStateLatestBlockHeader(
|
|
|
|
t,
|
|
|
|
func() (state.BeaconState, error) {
|
|
|
|
return InitializeFromProto(ðpb.BeaconStateAltair{})
|
|
|
|
},
|
|
|
|
func(BH *ethpb.BeaconBlockHeader) (state.BeaconState, error) {
|
|
|
|
return InitializeFromProto(ðpb.BeaconStateAltair{LatestBlockHeader: BH})
|
|
|
|
},
|
|
|
|
)
|
2021-09-23 01:10:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func TestBeaconState_BlockRoots(t *testing.T) {
|
2022-03-15 18:32:09 +00:00
|
|
|
testtmpl.VerifyBeaconStateBlockRoots(
|
|
|
|
t,
|
|
|
|
func() (state.BeaconState, error) {
|
|
|
|
return InitializeFromProto(ðpb.BeaconStateAltair{})
|
|
|
|
},
|
|
|
|
func(BR [][]byte) (state.BeaconState, error) {
|
|
|
|
return InitializeFromProto(ðpb.BeaconStateAltair{BlockRoots: BR})
|
|
|
|
},
|
|
|
|
)
|
2021-09-23 01:10:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func TestBeaconState_BlockRootAtIndex(t *testing.T) {
|
2022-03-15 18:32:09 +00:00
|
|
|
testtmpl.VerifyBeaconStateBlockRootAtIndex(
|
|
|
|
t,
|
|
|
|
func() (state.BeaconState, error) {
|
|
|
|
return InitializeFromProto(ðpb.BeaconStateAltair{})
|
|
|
|
},
|
|
|
|
func(BR [][]byte) (state.BeaconState, error) {
|
|
|
|
return InitializeFromProto(ðpb.BeaconStateAltair{BlockRoots: BR})
|
|
|
|
},
|
|
|
|
)
|
2021-09-23 01:10:25 +00:00
|
|
|
}
|