func (pk *ProvingKey) WriteTo(w io.Writer) (n int64, err error) {
	n, err = pk.Vk.WriteTo(w)
	if err != nil {
		return
	}
	n2, err := pk.DomainNum.WriteTo(w)
	if err != nil {
		return
	}
	n += n2
	n2, err = pk.DomainH.WriteTo(w)
	if err != nil {
		return
	}
	n += n2
	if len(pk.Permutation) != (3 * int(pk.DomainNum.Cardinality)) {
		return n, errors.New("invalid permutation size, expected 3*domain cardinality")
	}
	enc := curve.NewEncoder(w)
	toEncode := []interface{}{
		([]fr.Element)(pk.Ql),
		([]fr.Element)(pk.Qr),
		([]fr.Element)(pk.Qm),
		([]fr.Element)(pk.Qo),
		([]fr.Element)(pk.CQk),
		([]fr.Element)(pk.LQk),
		([]fr.Element)(pk.LS1),
		([]fr.Element)(pk.LS2),
		([]fr.Element)(pk.LS3),
		([]fr.Element)(pk.CS1),
		([]fr.Element)(pk.CS2),
		([]fr.Element)(pk.CS3),
		pk.Permutation,
	}
	for _, v := range toEncode {
		if err := enc.Encode(v); err != nil {
			return n + enc.BytesWritten(), err
		}
	}
	return n + enc.BytesWritten(), nil
}
WriteTo writes binary encoding of ProvingKey to w
package plonk
import (
	curve "github.com/consensys/gnark-crypto/ecc/bn254"
	"errors"
	"github.com/consensys/gnark-crypto/ecc/bn254/fr"
	"io"
)
func (proof *Proof) WriteTo(w io.Writer) (int64, error) {
	enc := curve.NewEncoder(w)
	toEncode := []interface{}{
		&proof.LRO[0],
		&proof.LRO[1],
		&proof.LRO[2],
		&proof.Z,
		&proof.H[0],
		&proof.H[1],
		&proof.H[2],
	}
	for _, v := range toEncode {
		if err := enc.Encode(v); err != nil {
			return enc.BytesWritten(), err
		}
	}
	n, err := proof.BatchedProof.WriteTo(w)
	if err != nil {
		return n + enc.BytesWritten(), err
	}
	n2, err := proof.ZShiftedOpening.WriteTo(w)
	return n + n2 + enc.BytesWritten(), err
}
func (proof *Proof) ReadFrom(r io.Reader) (int64, error) {
	dec := curve.NewDecoder(r)
	toDecode := []interface{}{
		&proof.LRO[0],
		&proof.LRO[1],
		&proof.LRO[2],
		&proof.Z,
		&proof.H[0],
		&proof.H[1],
		&proof.H[2],
	}
	for _, v := range toDecode {
		if err := dec.Decode(v); err != nil {
			return dec.BytesRead(), err
		}
	}
	n, err := proof.BatchedProof.ReadFrom(r)
	if err != nil {
		return n + dec.BytesRead(), err
	}
	n2, err := proof.ZShiftedOpening.ReadFrom(r)
	return n + n2 + dec.BytesRead(), err
}