func (e *Exit) ToProto() *pb.Exit {
	newE := &pb.Exit{
		Slot:           e.Slot,
		ValidatorIndex: e.ValidatorIndex,
	}
	newE.Signature = e.Signature[:]
	return newE
}
ToProto gets the protobuf representation of the exit.
package primitives
import (
	"errors"
	"github.com/phoreproject/synapse/chainhash"
	"github.com/phoreproject/synapse/pb"
)
type DepositParameters struct {
	PubKey                [96]byte
	ProofOfPossession     [48]byte
	WithdrawalCredentials chainhash.Hash
}
func (dp *DepositParameters) Copy() DepositParameters {
	return *dp
}
func (dp *DepositParameters) ToProto() *pb.DepositParameters {
	newDp := &pb.DepositParameters{
		WithdrawalCredentials: dp.WithdrawalCredentials[:],
	}
	newDp.PublicKey = dp.PubKey[:]
	newDp.ProofOfPossession = dp.ProofOfPossession[:]
	return newDp
}
func DepositParametersFromProto(parameters *pb.DepositParameters) (*DepositParameters, error) {
	if len(parameters.PublicKey) > 96 {
		return nil, errors.New("public key should be 96 bytes")
	}
	if len(parameters.ProofOfPossession) > 48 {
		return nil, errors.New("proof of possession signature should be 48 bytes")
	}
	dp := &DepositParameters{}
	copy(dp.PubKey[:], parameters.PublicKey)
	copy(dp.ProofOfPossession[:], parameters.ProofOfPossession)
	err := dp.WithdrawalCredentials.SetBytes(parameters.WithdrawalCredentials)
	if err != nil {
		return nil, err
	}
	return dp, nil
}
type Deposit struct {
	Parameters DepositParameters
}
func (d Deposit) ToProto() *pb.Deposit {
	return &pb.Deposit{
		Parameters: d.Parameters.ToProto(),
	}
}
func DepositFromProto(deposit *pb.Deposit) (*Deposit, error) {
	parameters, err := DepositParametersFromProto(deposit.Parameters)
	if err != nil {
		return nil, err
	}
	return &Deposit{*parameters}, nil
}
func (d Deposit) Copy() Deposit {
	return Deposit{d.Parameters.Copy()}
}
type Exit struct {
	Slot           uint64
	ValidatorIndex uint64
	Signature      [48]byte
}
func (e *Exit) Copy() Exit {
	return *e
}