func ShardBlockHeaderFromProto(header *pb.ShardBlockHeader) (*ShardBlockHeader, error) {
	if len(header.Signature) > 48 {
		return nil, errors.New("signature should be 48 bytes long")
	}
	newHeader := &ShardBlockHeader{
		Slot:      header.Slot,
		Validator: header.Validator,
	}

	copy(newHeader.Signature[:], header.Signature)

	err := newHeader.PreviousBlockHash.SetBytes(header.PreviousBlockHash)
	if err != nil {
		return nil, err
	}

	err = newHeader.StateRoot.SetBytes(header.StateRoot)
	if err != nil {
		return nil, err
	}

	err = newHeader.TransactionRoot.SetBytes(header.TransactionRoot)
	if err != nil {
		return nil, err
	}

	err = newHeader.FinalizedBeaconHash.SetBytes(header.FinalizedBeaconHash)
	if err != nil {
		return nil, err
	}

	proof, err := ValidatorProofFromProto(header.ValidatorProof)
	if err != nil {
		return nil, err
	}
	newHeader.ValidatorProof = *proof

	return newHeader, nil
}
// ShardBlockHeaderFromProto converts a protobuf representation of a shard block header to a shard block header.
ShardBlockHeaderFromProto converts a protobuf representation of a shard block header to a shard block header.
// ShardBlockHeaderFromProto converts a protobuf representation of a shard block header to a shard block header .
func ShardBlockHeaderFromProto(header *pb.ShardBlockHeader) (*ShardBlockHeader, error) {
	if len(header.Signature) > 48 {
		return nil, errors.New("signature should be 48 bytes long")
	}
	newHeader := &ShardBlockHeader{
		Slot:      header.Slot,
		Validator: header.Validator,
	}
	copy(newHeader.Signature[:], header.Signature)
	err := newHeader.PreviousBlockHash.SetBytes(header.PreviousBlockHash)
	if err != nil {
		return nil, err
	}
	err = newHeader.StateRoot.SetBytes(header.StateRoot)
	if err != nil {
		return nil, err
	}
	err = newHeader.TransactionRoot.SetBytes(header.TransactionRoot)
	if err != nil {
		return nil, err
	}
	err = newHeader.FinalizedBeaconHash.SetBytes(header.FinalizedBeaconHash)
	if err != nil {
		return nil, err
	}
	proof, err := ValidatorProofFromProto(header.ValidatorProof)
	if err != nil {
		return nil, err
	}
	newHeader.ValidatorProof = *proof
	return newHeader, nil
}
func ShardBlockHeaderFromProto ( header * pb . ShardBlockHeader ) ( * ShardBlockHeader , error ) { if len ( header . Signature ) > 48 { return nil , errors . New ( " " ) } newHeader := & ShardBlockHeader { Slot : header . Slot , Validator : header . Validator , } copy ( newHeader . Signature [ : ] , header . Signature ) err := newHeader . PreviousBlockHash . SetBytes ( header . PreviousBlockHash ) if err != nil { return nil , err } err = newHeader . StateRoot . SetBytes ( header . StateRoot ) if err != nil { return nil , err } err = newHeader . TransactionRoot . SetBytes ( header . TransactionRoot ) if err != nil { return nil , err } err = newHeader . FinalizedBeaconHash . SetBytes ( header . FinalizedBeaconHash ) if err != nil { return nil , err } proof , err := ValidatorProofFromProto ( header . ValidatorProof ) if err != nil { return nil , err } newHeader . ValidatorProof = * proof return newHeader , nil }
ShardBlockHeaderFromProto converts a protobuf representation of a shard block header to a shard block header.
ShardBlockHeaderFromProto converts a protobuf representation of a shard block header to a shard block header .