utils

package
v0.1.9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 6, 2025 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Overview

package utils contains functions and types to aid compilation and serialization / deserialization

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AbiEncodeProofAndPublicInputs

func AbiEncodeProofAndPublicInputs(proof []byte, publicInputs []byte) ([][]byte, error)

AbiEncodeProofAndPublicInputs takes a proof and public input binary blob and encodes them itto the ABI format expected by the verifiers

func CompileWithPuyaPy

func CompileWithPuyaPy(filepath string, options string) error

CompileWithPuyaPy compiles `filepath` with puyapy, with `options'. Leave `options` empty to not pass any options

func DeserializeCompiledCircuit

func DeserializeCompiledCircuit(filepath string) (*ap.CompiledCircuit, error)

DeserializeCompiledCircuit deserializes a compiled circuit from file

func ProofAndPublicInputsForAtomicComposer added in v0.1.8

func ProofAndPublicInputsForAtomicComposer(proof []byte, publicInputs []byte,
) ([]interface{}, error)

ProofAndPublicInputsForAtomicComposer takes a proof and public input binary blob and returns them in an []interface{} slice for AtomicTransactionComposer to make app args as expected by the verifiers

func RenamePuyaPyOutput

func RenamePuyaPyOutput(oldname string, newname string, dir string) error

RenamePuyaPyOutput renames puyapy output files, e.g., 'oldname.approval.teal' is renamed to 'newname.approval.teal'. It looks in `dir` for the files to rename, looking for these files: oldname.approval.teal, oldname.clear.teal, oldname.arc32.json, oldname.teal

func SerializeCompiledCircuit

func SerializeCompiledCircuit(cc *ap.CompiledCircuit, filepath string) error

SerializeCompiledCircuit serializes a compiled circuit to file

func ShouldRecompile added in v0.1.8

func ShouldRecompile(targetPath string, sourcePaths ...string) bool

shouldRecompile returns true if targetPath is more recent than any of the files in sourcePahts or if it encounters any error

Types

type CompiledCircuitBytes

type CompiledCircuitBytes struct {
	Ccs   []byte
	Pk    []byte
	Vk    []byte
	Curve ecc.ID
}

CompiledCircuitBytes contains the compiled circuit pre-serialized to bytes

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL