mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-25 04:47:18 +00:00
f89fce9bd7
* add fork choice helpers * LMD GHOST basic implementation * add todos * add in the initial test and finalize rest of functions * added tests * more simulation, adding trivial case with only one option for a head * panics * begin helper function tests * more helper tests * higher vote wins * LMD Ghost full test * comment * add types * optimize * prepared * deposits for chain * lint * use the hash beacon block util * rem unnecessary db methods * comments * setup works
36 lines
653 B
Go
36 lines
653 B
Go
package hashutil_test
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/gogo/protobuf/proto"
|
|
pb "github.com/prysmaticlabs/prysm/proto/beacon/p2p/v1"
|
|
"github.com/prysmaticlabs/prysm/shared/hashutil"
|
|
)
|
|
|
|
func TestHashBeaconBlock_doesntMutate(t *testing.T) {
|
|
a := &pb.BeaconBlock{
|
|
Body: &pb.BeaconBlockBody{
|
|
Attestations: []*pb.Attestation{
|
|
{
|
|
Data: &pb.AttestationData{
|
|
Slot: 123,
|
|
Shard: 456,
|
|
},
|
|
},
|
|
},
|
|
},
|
|
Signature: [][]byte{{'S', 'I', 'G'}},
|
|
}
|
|
b := proto.Clone(a).(*pb.BeaconBlock)
|
|
|
|
_, err := hashutil.HashBeaconBlock(b)
|
|
if err != nil {
|
|
t.Error(err)
|
|
}
|
|
|
|
if !proto.Equal(a, b) {
|
|
t.Error("Protos are not equal!")
|
|
}
|
|
}
|