func ShardTransactionFromProto(st *pb.ShardTransaction) (*ShardTransaction, error) {
	return &ShardTransaction{
		TransactionData: st.TransactionData,
	}, nil
}
ShardTransactionFromProto converts a protobuf representation of a shard transaction to a shard transaction.
package primitives
import (
	"errors"
	"fmt"
	"github.com/prysmaticlabs/go-ssz"
	"github.com/phoreproject/synapse/chainhash"
	"github.com/phoreproject/synapse/pb"
)
type ShardBlockHeader struct {
	PreviousBlockHash   chainhash.Hash
	Slot                uint64
	Validator           uint32
	Signature           [48]byte
	ValidatorProof      ValidatorProof
	StateRoot           chainhash.Hash
	TransactionRoot     chainhash.Hash
	FinalizedBeaconHash chainhash.Hash
}
func (sb *ShardBlockHeader) ToProto() *pb.ShardBlockHeader {
	return &pb.ShardBlockHeader{
		PreviousBlockHash:   sb.PreviousBlockHash[:],
		Slot:                sb.Slot,
		Signature:           sb.Signature[:],
		StateRoot:           sb.StateRoot[:],
		TransactionRoot:     sb.TransactionRoot[:],
		FinalizedBeaconHash: sb.FinalizedBeaconHash[:],
		Validator:           sb.Validator,
		ValidatorProof:      sb.ValidatorProof.ToProto(),
	}
}
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 (sb *ShardBlockHeader) Copy() ShardBlockHeader {
	return *sb
}
type ShardTransaction struct {
	TransactionData []byte
}
func (st *ShardTransaction) ToProto() *pb.ShardTransaction {
	return &pb.ShardTransaction{
		TransactionData: st.TransactionData,
	}
}