testutils

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: May 13, 2024 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Overview

package tests contains tests and test helper functions To run the tests, a local network with default configuration is expected to be running. You can use algokit to start one with `algokit localnet start` Custom configuration can be set by changing the exposed variables at the top of the algosdkwrapper/setup.go file.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CompileWithPuyaPy added in v0.1.4

func CompileWithPuyaPy(filepath string, options string) error

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

func CreateDirectoryIfNeeded

func CreateDirectoryIfNeeded(dir string) error

CreateDirectoryIfNeeded creates `dir` if it does not exist

func DeserializeCompiledCircuit added in v0.1.4

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

DeserializeCompiledCircuit deserializes a compiled circuit from file

func RandomBigInt

func RandomBigInt(maxBits int64) *big.Int

RandomBigInt returns a random big integer bigger than 1 of up to maxBits bits. If maxBits is less than 1, it defaults to 32.

func RenamePuyaPyOutput added in v0.1.4

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 added in v0.1.4

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

SerializeCompiledCircuit serializes a compiled circuit to file

func ShouldRecompile added in v0.1.4

func ShouldRecompile(sourcePath, outputPath string) bool

ShouldRecompile returns true if sourcePath is more recent than outputPath or if it encounters an error

func Substitute added in v0.1.4

func Substitute(filepath string, mapping map[string]string) error

Substitute replaces all instances of `mapping` keys with their values overwriting `filepath`

func TestCircuitWithGnark

func TestCircuitWithGnark(circuit frontend.Circuit, assignment frontend.Circuit,
	curve ecc.ID) (*ap.CompiledCircuit, *ap.VerifiedProof, error)

TestCircuitWithGnark compiles a circuit and verifies a proof from an assignment using gnark (no interaction with the AVM)

Types

type CompiledCircuitBytes added in v0.1.4

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

CompiledCircuitBytes contains the compiled circuit pre-serialized to bytes

Directories

Path Synopsis
package algosdkwrapper provides utility functions to interact with an Algorand local network wrapping the go-algorand-sdk.
package algosdkwrapper provides utility functions to interact with an Algorand local network wrapping the go-algorand-sdk.

Jump to

Keyboard shortcuts

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