2021-07-22 22:31:14 +00:00
|
|
|
package v1
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
2022-08-16 12:20:13 +00:00
|
|
|
"github.com/prysmaticlabs/prysm/v3/beacon-chain/state"
|
|
|
|
testtmpl "github.com/prysmaticlabs/prysm/v3/beacon-chain/state/testing"
|
|
|
|
ethpb "github.com/prysmaticlabs/prysm/v3/proto/prysm/v1alpha1"
|
2021-07-22 22:31:14 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func TestBeaconState_LatestBlockHeader(t *testing.T) {
|
2022-03-15 18:32:09 +00:00
|
|
|
testtmpl.VerifyBeaconStateLatestBlockHeader(
|
|
|
|
t,
|
|
|
|
func() (state.BeaconState, error) {
|
|
|
|
return InitializeFromProto(ðpb.BeaconState{})
|
|
|
|
},
|
|
|
|
func(BH *ethpb.BeaconBlockHeader) (state.BeaconState, error) {
|
|
|
|
return InitializeFromProto(ðpb.BeaconState{LatestBlockHeader: BH})
|
|
|
|
},
|
|
|
|
)
|
2021-07-22 22:31:14 +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.BeaconState{})
|
|
|
|
},
|
|
|
|
func(BR [][]byte) (state.BeaconState, error) {
|
|
|
|
return InitializeFromProto(ðpb.BeaconState{BlockRoots: BR})
|
|
|
|
},
|
|
|
|
)
|
2021-07-22 22:31:14 +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.BeaconState{})
|
|
|
|
},
|
|
|
|
func(BR [][]byte) (state.BeaconState, error) {
|
|
|
|
return InitializeFromProto(ðpb.BeaconState{BlockRoots: BR})
|
|
|
|
},
|
|
|
|
)
|
2021-07-22 22:31:14 +00:00
|
|
|
}
|