mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-25 12:57:18 +00:00
Replaced block and state roots construction to SlotsPerHistoricalRoot
(#3160)
This commit is contained in:
parent
b3e29399aa
commit
32c426ed1b
@ -40,7 +40,7 @@ func TestApplyForkChoice_ChainSplitReorg(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatalf("Can't generate genesis state: %v", err)
|
||||
}
|
||||
justifiedState.StateRoots = make([][]byte, params.BeaconConfig().HistoricalRootsLimit)
|
||||
justifiedState.StateRoots = make([][]byte, params.BeaconConfig().SlotsPerHistoricalRoot)
|
||||
justifiedState.LatestBlockHeader = ðpb.BeaconBlockHeader{
|
||||
StateRoot: []byte{},
|
||||
}
|
||||
|
@ -1546,7 +1546,7 @@ func setupFFGTest(t *testing.T) ([32]byte, *ethpb.BeaconBlock, *pb.BeaconState,
|
||||
}
|
||||
gState := &pb.BeaconState{
|
||||
Slot: genesisSlot,
|
||||
BlockRoots: make([][]byte, params.BeaconConfig().HistoricalRootsLimit),
|
||||
BlockRoots: make([][]byte, params.BeaconConfig().SlotsPerHistoricalRoot),
|
||||
RandaoMixes: latestRandaoMixes,
|
||||
ActiveIndexRoots: make([][]byte, params.BeaconConfig().EpochsPerHistoricalVector),
|
||||
Slashings: make([]uint64, params.BeaconConfig().EpochsPerSlashingsVector),
|
||||
|
@ -12,7 +12,7 @@ import (
|
||||
func TestBlockRootAtSlot_CorrectBlockRoot(t *testing.T) {
|
||||
var blockRoots [][]byte
|
||||
|
||||
for i := uint64(0); i < params.BeaconConfig().HistoricalRootsLimit; i++ {
|
||||
for i := uint64(0); i < params.BeaconConfig().SlotsPerHistoricalRoot; i++ {
|
||||
blockRoots = append(blockRoots, []byte{byte(i)})
|
||||
}
|
||||
s := &pb.BeaconState{
|
||||
@ -76,7 +76,7 @@ func TestBlockRootAtSlot_CorrectBlockRoot(t *testing.T) {
|
||||
func TestBlockRootAtSlot_OutOfBounds(t *testing.T) {
|
||||
var blockRoots [][]byte
|
||||
|
||||
for i := uint64(0); i < params.BeaconConfig().HistoricalRootsLimit; i++ {
|
||||
for i := uint64(0); i < params.BeaconConfig().SlotsPerHistoricalRoot; i++ {
|
||||
blockRoots = append(blockRoots, []byte{byte(i)})
|
||||
}
|
||||
state := &pb.BeaconState{
|
||||
@ -102,7 +102,7 @@ func TestBlockRootAtSlot_OutOfBounds(t *testing.T) {
|
||||
// Edge case where stateSlot is over slots per historical root and
|
||||
// slot is not within (stateSlot - HistoricalRootsLimit, statSlot]
|
||||
slot: 1,
|
||||
stateSlot: params.BeaconConfig().HistoricalRootsLimit + 2,
|
||||
stateSlot: params.BeaconConfig().SlotsPerHistoricalRoot + 2,
|
||||
expectedErr: "slot out of bounds",
|
||||
},
|
||||
}
|
||||
|
@ -360,7 +360,7 @@ func TestProcessBlock_IncorrectProcessExits(t *testing.T) {
|
||||
},
|
||||
}
|
||||
var blockRoots [][]byte
|
||||
for i := uint64(0); i < params.BeaconConfig().HistoricalRootsLimit; i++ {
|
||||
for i := uint64(0); i < params.BeaconConfig().SlotsPerHistoricalRoot; i++ {
|
||||
blockRoots = append(blockRoots, []byte{byte(i)})
|
||||
}
|
||||
beaconState.BlockRoots = blockRoots
|
||||
@ -549,7 +549,7 @@ func TestProcessBlock_PassesProcessingConditions(t *testing.T) {
|
||||
}
|
||||
|
||||
var blockRoots [][]byte
|
||||
for i := uint64(0); i < params.BeaconConfig().HistoricalRootsLimit; i++ {
|
||||
for i := uint64(0); i < params.BeaconConfig().SlotsPerHistoricalRoot; i++ {
|
||||
blockRoots = append(blockRoots, []byte{byte(i)})
|
||||
}
|
||||
beaconState.BlockRoots = blockRoots
|
||||
|
@ -108,7 +108,7 @@ func TestRequestAttestation_OK(t *testing.T) {
|
||||
|
||||
beaconState := &pbp2p.BeaconState{
|
||||
Slot: 3*params.BeaconConfig().SlotsPerEpoch + 1,
|
||||
BlockRoots: make([][]byte, params.BeaconConfig().HistoricalRootsLimit),
|
||||
BlockRoots: make([][]byte, params.BeaconConfig().SlotsPerHistoricalRoot),
|
||||
CurrentCrosslinks: []*ethpb.Crosslink{
|
||||
{
|
||||
DataRoot: []byte("A"),
|
||||
@ -228,7 +228,7 @@ func TestAttestationDataAtSlot_handlesFarAwayJustifiedEpoch(t *testing.T) {
|
||||
}
|
||||
beaconState := &pbp2p.BeaconState{
|
||||
Slot: 10000,
|
||||
BlockRoots: make([][]byte, params.BeaconConfig().HistoricalRootsLimit),
|
||||
BlockRoots: make([][]byte, params.BeaconConfig().SlotsPerHistoricalRoot),
|
||||
PreviousCrosslinks: []*ethpb.Crosslink{
|
||||
{
|
||||
DataRoot: []byte("A"),
|
||||
|
Loading…
Reference in New Issue
Block a user