mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2025-01-12 12:40:05 +00:00
Fixed a Prev Boundary Epoch Attestation Bug (#1547)
* fixed epoch_processing * test p2p * fixed PrevBoundaryAttestations and its tests
This commit is contained in:
parent
3dc6d3a2e6
commit
b5e2a49dac
@ -121,7 +121,7 @@ func PrevBoundaryAttestations(
|
||||
|
||||
var prevBoundaryAttestations []*pb.PendingAttestationRecord
|
||||
prevBoundaryBlockRoot, err := block.BlockRoot(state,
|
||||
helpers.PrevEpoch(state))
|
||||
helpers.StartSlot(helpers.PrevEpoch(state)))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -221,9 +221,9 @@ func TestPrevEpochBoundaryAttestations(t *testing.T) {
|
||||
epochAttestations := []*pb.PendingAttestationRecord{
|
||||
{Data: &pb.AttestationData{EpochBoundaryRootHash32: []byte{100}}},
|
||||
{Data: &pb.AttestationData{EpochBoundaryRootHash32: []byte{0}}},
|
||||
{Data: &pb.AttestationData{EpochBoundaryRootHash32: []byte{2}}}, // selected
|
||||
{Data: &pb.AttestationData{EpochBoundaryRootHash32: []byte{128}}}, // selected
|
||||
{Data: &pb.AttestationData{EpochBoundaryRootHash32: []byte{55}}},
|
||||
{Data: &pb.AttestationData{EpochBoundaryRootHash32: []byte{2}}}, // selected
|
||||
{Data: &pb.AttestationData{EpochBoundaryRootHash32: []byte{128}}}, // selected
|
||||
}
|
||||
|
||||
var latestBlockRootHash [][]byte
|
||||
@ -241,14 +241,13 @@ func TestPrevEpochBoundaryAttestations(t *testing.T) {
|
||||
t.Fatalf("EpochBoundaryAttestations failed: %v", err)
|
||||
}
|
||||
|
||||
// 64 is selected because we start off with 3 epochs (192 slots)
|
||||
// The prev epoch boundary slot is 192 - 2 * epoch_length = 64
|
||||
if !bytes.Equal(prevEpochBoundaryAttestation[0].Data.EpochBoundaryRootHash32, []byte{2}) {
|
||||
t.Errorf("Wanted justified block hash [64] for epoch boundary attestation, got: %v",
|
||||
//128 is selected because that's the start root of prev boundary epoch.
|
||||
if !bytes.Equal(prevEpochBoundaryAttestation[0].Data.EpochBoundaryRootHash32, []byte{128}) {
|
||||
t.Errorf("Wanted justified block hash [128] for epoch boundary attestation, got: %v",
|
||||
prevEpochBoundaryAttestation[0].Data.EpochBoundaryRootHash32)
|
||||
}
|
||||
if !bytes.Equal(prevEpochBoundaryAttestation[1].Data.EpochBoundaryRootHash32, []byte{2}) {
|
||||
t.Errorf("Wanted justified block hash [64] for epoch boundary attestation, got: %v",
|
||||
if !bytes.Equal(prevEpochBoundaryAttestation[1].Data.EpochBoundaryRootHash32, []byte{128}) {
|
||||
t.Errorf("Wanted justified block hash [128] for epoch boundary attestation, got: %v",
|
||||
prevEpochBoundaryAttestation[1].Data.EpochBoundaryRootHash32)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user