builtin

package
v0.0.13 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2025 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const MaxDefaultFunction byte = 93

Smallest DefaultFunction

View Source
const MinDefaultFunction byte = 0

Smallest DefaultFunction

View Source
const TotalBuiltinCount byte = MaxDefaultFunction + 1

Total Builtin Count

Variables

View Source
var Builtins map[string]DefaultFunction = map[string]DefaultFunction{

	"addInteger":            AddInteger,
	"subtractInteger":       SubtractInteger,
	"multiplyInteger":       MultiplyInteger,
	"divideInteger":         DivideInteger,
	"quotientInteger":       QuotientInteger,
	"remainderInteger":      RemainderInteger,
	"modInteger":            ModInteger,
	"equalsInteger":         EqualsInteger,
	"lessThanInteger":       LessThanInteger,
	"lessThanEqualsInteger": LessThanEqualsInteger,

	"appendByteString":         AppendByteString,
	"consByteString":           ConsByteString,
	"sliceByteString":          SliceByteString,
	"lengthOfByteString":       LengthOfByteString,
	"indexByteString":          IndexByteString,
	"equalsByteString":         EqualsByteString,
	"lessThanByteString":       LessThanByteString,
	"lessThanEqualsByteString": LessThanEqualsByteString,

	"sha2_256":                        Sha2_256,
	"sha3_256":                        Sha3_256,
	"blake2b_256":                     Blake2b_256,
	"keccak_256":                      Keccak_256,
	"blake2b_224":                     Blake2b_224,
	"verifyEd25519Signature":          VerifyEd25519Signature,
	"verifyEcdsaSecp256k1Signature":   VerifyEcdsaSecp256k1Signature,
	"verifySchnorrSecp256k1Signature": VerifySchnorrSecp256k1Signature,

	"appendString": AppendString,
	"equalsString": EqualsString,
	"encodeUtf8":   EncodeUtf8,
	"decodeUtf8":   DecodeUtf8,

	"ifThenElse": IfThenElse,

	"chooseUnit": ChooseUnit,

	"trace": Trace,

	"fstPair": FstPair,
	"sndPair": SndPair,

	"chooseList": ChooseList,
	"mkCons":     MkCons,
	"headList":   HeadList,
	"tailList":   TailList,
	"nullList":   NullList,

	"chooseData":    ChooseData,
	"constrData":    ConstrData,
	"mapData":       MapData,
	"listData":      ListData,
	"iData":         IData,
	"bData":         BData,
	"unConstrData":  UnConstrData,
	"unMapData":     UnMapData,
	"unListData":    UnListData,
	"unIData":       UnIData,
	"unBData":       UnBData,
	"equalsData":    EqualsData,
	"serialiseData": SerialiseData,

	"mkPairData":    MkPairData,
	"mkNilData":     MkNilData,
	"mkNilPairData": MkNilPairData,

	"bls12_381_G1_add":         Bls12_381_G1_Add,
	"bls12_381_G1_neg":         Bls12_381_G1_Neg,
	"bls12_381_G1_scalarMul":   Bls12_381_G1_ScalarMul,
	"bls12_381_G1_equal":       Bls12_381_G1_Equal,
	"bls12_381_G1_compress":    Bls12_381_G1_Compress,
	"bls12_381_G1_uncompress":  Bls12_381_G1_Uncompress,
	"bls12_381_G1_hashToGroup": Bls12_381_G1_HashToGroup,
	"bls12_381_G2_add":         Bls12_381_G2_Add,
	"bls12_381_G2_neg":         Bls12_381_G2_Neg,
	"bls12_381_G2_scalarMul":   Bls12_381_G2_ScalarMul,
	"bls12_381_G2_equal":       Bls12_381_G2_Equal,
	"bls12_381_G2_compress":    Bls12_381_G2_Compress,
	"bls12_381_G2_uncompress":  Bls12_381_G2_Uncompress,
	"bls12_381_G2_hashToGroup": Bls12_381_G2_HashToGroup,
	"bls12_381_millerLoop":     Bls12_381_MillerLoop,
	"bls12_381_mulMlResult":    Bls12_381_MulMlResult,
	"bls12_381_finalVerify":    Bls12_381_FinalVerify,

	"integerToByteString": IntegerToByteString,
	"byteStringToInteger": ByteStringToInteger,

	"andByteString":        AndByteString,
	"orByteString":         OrByteString,
	"xorByteString":        XorByteString,
	"complementByteString": ComplementByteString,
	"readBit":              ReadBit,
	"writeBits":            WriteBits,
	"replicateByte":        ReplicateByte,

	"shiftByteString":  ShiftByteString,
	"rotateByteString": RotateByteString,
	"countSetBits":     CountSetBits,
	"findFirstSetBit":  FindFirstSetBit,

	"ripemd_160": Ripemd_160,

	"expModInteger": ExpModInteger,
	"caseList":      CaseList,
	"caseData":      CaseData,
	"dropList":      DropList,

	"lengthOfArray": LengthOfArray,
	"listToArray":   ListToArray,
	"indexArray":    IndexArray,
}

Functions

This section is empty.

Types

type DefaultFunction

type DefaultFunction uint8
const (
	// Integer functions
	AddInteger            DefaultFunction = 0
	SubtractInteger       DefaultFunction = 1
	MultiplyInteger       DefaultFunction = 2
	DivideInteger         DefaultFunction = 3
	QuotientInteger       DefaultFunction = 4
	RemainderInteger      DefaultFunction = 5
	ModInteger            DefaultFunction = 6
	EqualsInteger         DefaultFunction = 7
	LessThanInteger       DefaultFunction = 8
	LessThanEqualsInteger DefaultFunction = 9
	// ByteString functions
	AppendByteString         DefaultFunction = 10
	ConsByteString           DefaultFunction = 11
	SliceByteString          DefaultFunction = 12
	LengthOfByteString       DefaultFunction = 13
	IndexByteString          DefaultFunction = 14
	EqualsByteString         DefaultFunction = 15
	LessThanByteString       DefaultFunction = 16
	LessThanEqualsByteString DefaultFunction = 17
	// Cryptography and hash functions
	Sha2_256                        DefaultFunction = 18
	Sha3_256                        DefaultFunction = 19
	Blake2b_256                     DefaultFunction = 20
	Keccak_256                      DefaultFunction = 71
	Blake2b_224                     DefaultFunction = 72
	VerifyEd25519Signature          DefaultFunction = 21
	VerifyEcdsaSecp256k1Signature   DefaultFunction = 52
	VerifySchnorrSecp256k1Signature DefaultFunction = 53
	// String functions
	AppendString DefaultFunction = 22
	EqualsString DefaultFunction = 23
	EncodeUtf8   DefaultFunction = 24
	DecodeUtf8   DefaultFunction = 25
	// Bool function
	IfThenElse DefaultFunction = 26
	// Unit function
	ChooseUnit DefaultFunction = 27
	// Tracing function
	Trace DefaultFunction = 28
	// Pairs functions
	FstPair DefaultFunction = 29
	SndPair DefaultFunction = 30
	// List functions
	ChooseList DefaultFunction = 31
	MkCons     DefaultFunction = 32
	HeadList   DefaultFunction = 33
	TailList   DefaultFunction = 34
	NullList   DefaultFunction = 35
	// Data functions
	// It is convenient to have a "choosing" function for a data type that has more than two
	// constructors to get pattern matching over it and we may end up having multiple such data
	// types hence we include the name of the data type as a suffix.
	ChooseData    DefaultFunction = 36
	ConstrData    DefaultFunction = 37
	MapData       DefaultFunction = 38
	ListData      DefaultFunction = 39
	IData         DefaultFunction = 40
	BData         DefaultFunction = 41
	UnConstrData  DefaultFunction = 42
	UnMapData     DefaultFunction = 43
	UnListData    DefaultFunction = 44
	UnIData       DefaultFunction = 45
	UnBData       DefaultFunction = 46
	EqualsData    DefaultFunction = 47
	SerialiseData DefaultFunction = 51
	// Misc constructors
	// Constructors that we need for constructing e.g. Data. Polymorphic builtin
	// constructors are often problematic (See note [Representable built-in
	// functions over polymorphic built-in types])
	MkPairData    DefaultFunction = 48
	MkNilData     DefaultFunction = 49
	MkNilPairData DefaultFunction = 50

	// BLS Builtins
	Bls12_381_G1_Add         DefaultFunction = 54
	Bls12_381_G1_Neg         DefaultFunction = 55
	Bls12_381_G1_ScalarMul   DefaultFunction = 56
	Bls12_381_G1_Equal       DefaultFunction = 57
	Bls12_381_G1_Compress    DefaultFunction = 58
	Bls12_381_G1_Uncompress  DefaultFunction = 59
	Bls12_381_G1_HashToGroup DefaultFunction = 60
	Bls12_381_G2_Add         DefaultFunction = 61
	Bls12_381_G2_Neg         DefaultFunction = 62
	Bls12_381_G2_ScalarMul   DefaultFunction = 63
	Bls12_381_G2_Equal       DefaultFunction = 64
	Bls12_381_G2_Compress    DefaultFunction = 65
	Bls12_381_G2_Uncompress  DefaultFunction = 66
	Bls12_381_G2_HashToGroup DefaultFunction = 67
	Bls12_381_MillerLoop     DefaultFunction = 68
	Bls12_381_MulMlResult    DefaultFunction = 69
	Bls12_381_FinalVerify    DefaultFunction = 70

	// Conversions
	IntegerToByteString DefaultFunction = 73
	ByteStringToInteger DefaultFunction = 74

	// Logical
	AndByteString        DefaultFunction = 75
	OrByteString         DefaultFunction = 76
	XorByteString        DefaultFunction = 77
	ComplementByteString DefaultFunction = 78
	ReadBit              DefaultFunction = 79
	WriteBits            DefaultFunction = 80
	ReplicateByte        DefaultFunction = 81

	// Bitwise
	ShiftByteString  DefaultFunction = 82
	RotateByteString DefaultFunction = 83
	CountSetBits     DefaultFunction = 84
	FindFirstSetBit  DefaultFunction = 85

	// Ripemd_160
	Ripemd_160 DefaultFunction = 86

	// Batch 6
	ExpModInteger DefaultFunction = 87
	CaseList      DefaultFunction = 88
	CaseData      DefaultFunction = 89
	DropList      DefaultFunction = 90

	// Arrays
	LengthOfArray DefaultFunction = 91
	ListToArray   DefaultFunction = 92
	IndexArray    DefaultFunction = 93
)

func FromByte

func FromByte(tag byte) (DefaultFunction, error)

func (DefaultFunction) Arity

func (f DefaultFunction) Arity() uint

func (DefaultFunction) ForceCount

func (f DefaultFunction) ForceCount() uint

func (DefaultFunction) String

func (f DefaultFunction) String() string

Jump to

Keyboard shortcuts

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