2021-09-23 01:10:25 +00:00
|
|
|
package v2
|
|
|
|
|
|
|
|
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-09-23 01:10:25 +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.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
|
|
|
}
|