Documentation ¶
Index ¶
- Constants
- Variables
- func CheckContract(program []byte, params *EvalParams) error
- func CheckSignature(gi int, params *EvalParams) error
- func ComputeMinTealVersion(group []transactions.SignedTxnWithAD, inner bool) uint64
- func Disassemble(program []byte) (text string, err error)
- func EvalApp(program []byte, gi int, aid basics.AppIndex, params *EvalParams) (bool, error)
- func EvalSignature(gi int, params *EvalParams) (pass bool, err error)
- func GetProgramID(program []byte) string
- func HasStatefulOps(program []byte) (bool, error)
- func HashProgram(program []byte) crypto.Digest
- func OnCompletionDescription(value uint64) string
- func OpDoc(opName string) string
- func OpDocExtra(opName string) string
- func OpImmediateNote(opName string) string
- func OpStackEffects(opName string) string
- func TxnFieldToTealValue(txn *transactions.Transaction, groupIndex int, field TxnField, ...) (basics.TealValue, error)
- func TxnaFieldNames() []string
- type AcctParamsField
- type AppParamsField
- type AssetHoldingField
- type AssetParamsField
- type Base64Encoding
- type ClearStateBudgetError
- type DebugState
- type DebuggerHook
- type EcdsaCurve
- type EvalContext
- type EvalParams
- type FieldSpec
- type GlobalField
- type LedgerForLogic
- type Msg
- type OnCompletionConstType
- type OpCost
- type OpSpec
- type OpStream
- func (ops *OpStream) ByteLiteral(val []byte)
- func (ops *OpStream) Bytec(constIndex uint)
- func (ops *OpStream) Intc(constIndex uint)
- func (ops *OpStream) RecordSourceLine()
- func (ops *OpStream) ReferToLabel(pc int, label string)
- func (ops *OpStream) ReportProblems(fname string, writer io.Writer)
- func (ops *OpStream) Uint(val uint64)
- type PCOffset
- type PanicError
- type Program
- type StackType
- type StackTypes
- type TxnField
- type WebDebuggerHook
- type Writer
Constants ¶
const AssemblerDefaultVersion = 1
AssemblerDefaultVersion what version of code do we emit by default AssemblerDefaultVersion is set to 1 on puprose to prevent accidental building of v1 official templates with version 2 because these templates are not aware of rekeying.
const AssemblerMaxVersion = LogicVersion
AssemblerMaxVersion is a maximum supported assembler version
const EvalMaxVersion = LogicVersion
EvalMaxVersion is the max version we can interpret and run
const LogicVersion = 6
LogicVersion defines default assembler and max eval versions
const MaxByteMathSize = 64
MaxByteMathSize is the limit of byte strings supplied as input to byte math opcodes
const MaxLogCalls = 32
MaxLogCalls is the limit of total log calls during a program execution
const MaxLogSize = 1024
MaxLogSize is the limit of total log size from n log calls in a program
const MaxStackDepth = 1000
MaxStackDepth should not change unless gated by a teal version change / consensus upgrade.
const MaxStringSize = 4096
MaxStringSize is the limit of byte string length in an AVM value
const OnCompletionPreamble = "" /* 184-byte string literal not displayed */
OnCompletionPreamble describes what the OnCompletion constants represent.
Variables ¶
var AcctParamsFieldNames []string
AcctParamsFieldNames are arguments to the 'acct_params_get' opcode
var AcctParamsFieldSpecByName acctNameSpecMap
AcctParamsFieldSpecByName gives access to the field specs by field name
var AppParamsFieldNames []string
AppParamsFieldNames are arguments to the 'app_params_get' opcode
var AppParamsFieldSpecByName appNameSpecMap
AppParamsFieldSpecByName gives access to the field specs by field name
var AssetHoldingFieldNames []string
AssetHoldingFieldNames are arguments to the 'asset_holding_get' opcode
var AssetHoldingFieldSpecByName ahfNameSpecMap
AssetHoldingFieldSpecByName gives access to the field specs by field name
var AssetParamsFieldNames []string
AssetParamsFieldNames are arguments to the 'asset_params_get' opcode
var AssetParamsFieldSpecByName apfNameSpecMap
AssetParamsFieldSpecByName gives access to the field specs by field name
var EcdsaCurveDocs = map[string]string{
"Secp256k1": "secp256k1 curve",
}
EcdsaCurveDocs are notes on curves available in `ecdsa_` opcodes
var EcdsaCurveNames []string
EcdsaCurveNames are arguments to the 'ecdsa_' opcode
var EcdsaCurveSpecByName ecDsaCurveNameSpecMap
EcdsaCurveSpecByName gives access to the field specs by field name
var GlobalFieldNames []string
GlobalFieldNames are arguments to the 'global' opcode
var GlobalFieldSpecByName gfNameSpecMap
GlobalFieldSpecByName gives access to the field specs by field name
var OnCompletionNames []string
OnCompletionNames is the string names of Txn.OnCompletion, array index is the const value
var OpGroups = map[string][]string{
"Arithmetic": {"sha256", "keccak256", "sha512_256", "ed25519verify", "ecdsa_verify", "ecdsa_pk_recover", "ecdsa_pk_decompress", "+", "-", "/", "*", "<", ">", "<=", ">=", "&&", "||", "shl", "shr", "sqrt", "bitlen", "exp", "==", "!=", "!", "len", "itob", "btoi", "%", "|", "&", "^", "~", "mulw", "addw", "divw", "divmodw", "expw", "getbit", "setbit", "getbyte", "setbyte", "concat"},
"Byte Array Manipulation": {"substring", "substring3", "extract", "extract3", "extract_uint16", "extract_uint32", "extract_uint64", "base64_decode"},
"Byte Array Arithmetic": {"b+", "b-", "b/", "b*", "b<", "b>", "b<=", "b>=", "b==", "b!=", "b%", "bsqrt"},
"Byte Array Logic": {"b|", "b&", "b^", "b~"},
"Loading Values": {"intcblock", "intc", "intc_0", "intc_1", "intc_2", "intc_3", "pushint", "bytecblock", "bytec", "bytec_0", "bytec_1", "bytec_2", "bytec_3", "pushbytes", "bzero", "arg", "arg_0", "arg_1", "arg_2", "arg_3", "args", "txn", "gtxn", "txna", "txnas", "gtxna", "gtxnas", "gtxns", "gtxnsa", "gtxnsas", "global", "load", "loads", "store", "stores", "gload", "gloads", "gloadss", "gaid", "gaids"},
"Flow Control": {"err", "bnz", "bz", "b", "return", "pop", "dup", "dup2", "dig", "cover", "uncover", "swap", "select", "assert", "callsub", "retsub"},
"State Access": {"balance", "min_balance", "app_opted_in", "app_local_get", "app_local_get_ex", "app_global_get", "app_global_get_ex", "app_local_put", "app_global_put", "app_local_del", "app_global_del", "asset_holding_get", "asset_params_get", "app_params_get", "acct_params_get", "log"},
"Inner Transactions": {"itxn_begin", "itxn_next", "itxn_field", "itxn_submit", "itxn", "itxna", "itxnas", "gitxn", "gitxna", "gitxnas"},
}
OpGroups is groupings of ops for documentation purposes. The order here is the order args opcodes are presented, so place related opcodes consecutively, even if their opcode values are not.
var OpSpecs = []OpSpec{}/* 163 elements not displayed */
OpSpecs is the table of operations that can be assembled and evaluated.
Any changes should be reflected in README_in.md which serves as the language spec.
Note: assembly can specialize an Any return type if known at assembly-time, with ops.returns()
var OpsByName [LogicVersion + 1]map[string]OpSpec
OpsByName map for each each version, mapping opcode name to OpSpec
var TxnFieldNames []string
TxnFieldNames are arguments to the 'txn' and 'txnById' opcodes
var TxnFieldSpecByName tfNameSpecMap
TxnFieldSpecByName gives access to the field specs by field name
var TxnTypeNames = []string{ string(protocol.UnknownTx), string(protocol.PaymentTx), string(protocol.KeyRegistrationTx), string(protocol.AssetConfigTx), string(protocol.AssetTransferTx), string(protocol.AssetFreezeTx), string(protocol.ApplicationCallTx), string(protocol.AddressPrintTx), }
TxnTypeNames is the values of Txn.Type in enum order
var TypeNameDescriptions = map[string]string{ string(protocol.UnknownTx): "Unknown type. Invalid transaction", string(protocol.PaymentTx): "Payment", string(protocol.KeyRegistrationTx): "KeyRegistration", string(protocol.AssetConfigTx): "AssetConfig", string(protocol.AssetTransferTx): "AssetTransfer", string(protocol.AssetFreezeTx): "AssetFreeze", string(protocol.ApplicationCallTx): "ApplicationCall", string(protocol.AddressPrintTx): "AddressPrint", }
TypeNameDescriptions contains extra description about a low level protocol transaction Type string, and provide a friendlier type constant name in assembler.
Functions ¶
func CheckContract ¶
func CheckContract(program []byte, params *EvalParams) error
CheckContract should be faster than EvalContract. It can perform static checks and reject programs that are invalid. Prior to v4, these static checks include a cost estimate that must be low enough (controlled by params.Proto).
func CheckSignature ¶
func CheckSignature(gi int, params *EvalParams) error
CheckSignature should be faster than EvalSignature. It can perform static checks and reject programs that are invalid. Prior to v4, these static checks include a cost estimate that must be low enough (controlled by params.Proto).
func ComputeMinTealVersion ¶
func ComputeMinTealVersion(group []transactions.SignedTxnWithAD, inner bool) uint64
ComputeMinTealVersion calculates the minimum safe TEAL version that may be used by a transaction in this group. It is important to prevent newly-introduced transaction fields from breaking assumptions made by older versions of TEAL. If one of the transactions in a group will execute a TEAL program whose version predates a given field, that field must not be set anywhere in the transaction group, or the group will be rejected. In addition, inner app calls must not call teal from before inner app calls were introduced.
func Disassemble ¶
Disassemble produces a text form of program bytes. AssembleString(Disassemble()) should result in the same program bytes.
func EvalSignature ¶
func EvalSignature(gi int, params *EvalParams) (pass bool, err error)
EvalSignature evaluates the logicsig of the ith transaction in params. A program passes successfully if it finishes with one int element on the stack that is non-zero.
func GetProgramID ¶
GetProgramID returns program or execution ID that is string representation of sha256 checksum. It is used later to link program on the user-facing side of the debugger with TEAL evaluator.
func HasStatefulOps ¶
HasStatefulOps checks if the program has stateful opcodes
func HashProgram ¶
HashProgram takes program bytes and returns the Digest This Digest can be used as an Address for a logic controlled account.
func OnCompletionDescription ¶
OnCompletionDescription returns extra description about OnCompletion constants
func OpDocExtra ¶
OpDocExtra returns extra documentation text about an op
func OpImmediateNote ¶
OpImmediateNote returns a short string about immediate data which follows the op byte
func OpStackEffects ¶
OpStackEffects returns a "stack pattern" for opcodes that do not have a derivable effect
func TxnFieldToTealValue ¶
func TxnFieldToTealValue(txn *transactions.Transaction, groupIndex int, field TxnField, arrayFieldIdx uint64, inner bool) (basics.TealValue, error)
TxnFieldToTealValue is a thin wrapper for txnFieldToStack for external use
func TxnaFieldNames ¶
func TxnaFieldNames() []string
TxnaFieldNames are arguments to the 'txna' opcode It need not be fast, as it's only used for doc generation.
Types ¶
type AcctParamsField ¶
type AcctParamsField int
AcctParamsField is an enum for `acct_params_get` opcode
const ( // AcctBalance is the blance, with pending rewards AcctBalance AcctParamsField = iota // AcctMinBalance is algos needed for this accounts apps and assets AcctMinBalance //AcctAuthAddr is the rekeyed address if any, else ZeroAddress AcctAuthAddr )
func (AcctParamsField) String ¶
func (i AcctParamsField) String() string
type AppParamsField ¶
type AppParamsField int
AppParamsField is an enum for `app_params_get` opcode
const ( // AppApprovalProgram AppParams.ApprovalProgram AppApprovalProgram AppParamsField = iota // AppClearStateProgram AppParams.ClearStateProgram AppClearStateProgram // AppGlobalNumUint AppParams.StateSchemas.GlobalStateSchema.NumUint AppGlobalNumUint // AppGlobalNumByteSlice AppParams.StateSchemas.GlobalStateSchema.NumByteSlice AppGlobalNumByteSlice // AppLocalNumUint AppParams.StateSchemas.LocalStateSchema.NumUint AppLocalNumUint // AppLocalNumByteSlice AppParams.StateSchemas.LocalStateSchema.NumByteSlice AppLocalNumByteSlice // AppExtraProgramPages AppParams.ExtraProgramPages AppExtraProgramPages // AppCreator is not *in* the Params, but it is uniquely determined. AppCreator // AppAddress is also not *in* the Params, but can be derived AppAddress )
func (AppParamsField) String ¶
func (i AppParamsField) String() string
type AssetHoldingField ¶
type AssetHoldingField int
AssetHoldingField is an enum for `asset_holding_get` opcode
const ( // AssetBalance AssetHolding.Amount AssetBalance AssetHoldingField = iota // AssetFrozen AssetHolding.Frozen AssetFrozen )
func (AssetHoldingField) String ¶
func (i AssetHoldingField) String() string
type AssetParamsField ¶
type AssetParamsField int
AssetParamsField is an enum for `asset_params_get` opcode
const ( // AssetTotal AssetParams.Total AssetTotal AssetParamsField = iota // AssetDecimals AssetParams.Decimals AssetDecimals // AssetDefaultFrozen AssetParams.AssetDefaultFrozen AssetDefaultFrozen // AssetUnitName AssetParams.UnitName AssetUnitName // AssetName AssetParams.AssetName AssetName // AssetURL AssetParams.URL AssetURL // AssetMetadataHash AssetParams.MetadataHash AssetMetadataHash // AssetManager AssetParams.Manager AssetManager // AssetReserve AssetParams.Reserve AssetReserve // AssetFreeze AssetParams.Freeze AssetFreeze // AssetClawback AssetParams.Clawback AssetClawback // AssetCreator is not *in* the Params, but it is uniquely determined. AssetCreator )
func (AssetParamsField) String ¶
func (i AssetParamsField) String() string
type Base64Encoding ¶
type Base64Encoding int
Base64Encoding is an enum for the `base64decode` opcode
const ( // URLEncoding represents the base64url encoding defined in https://www.rfc-editor.org/rfc/rfc4648.html URLEncoding Base64Encoding = iota // StdEncoding represents the standard encoding of the RFC StdEncoding )
func (Base64Encoding) String ¶
func (i Base64Encoding) String() string
type ClearStateBudgetError ¶
type ClearStateBudgetError struct {
// contains filtered or unexported fields
}
ClearStateBudgetError allows evaluation to signal that the caller should reject the transaction. Normally, an error in evaluation would not cause a ClearState txn to fail. However, callers fail a txn for ClearStateBudgetError because the transaction has not provided enough budget to let ClearState do its job.
func (ClearStateBudgetError) Error ¶
func (e ClearStateBudgetError) Error() string
type DebugState ¶
type DebugState struct { // fields set once on Register ExecID string `codec:"execid"` Disassembly string `codec:"disasm"` PCOffset []PCOffset `codec:"pctooffset"` TxnGroup []transactions.SignedTxnWithAD `codec:"txngroup"` GroupIndex int `codec:"gindex"` Proto *config.ConsensusParams `codec:"proto"` Globals []basics.TealValue `codec:"globals"` // fields updated every step PC int `codec:"pc"` Line int `codec:"line"` Stack []basics.TealValue `codec:"stack"` Scratch []basics.TealValue `codec:"scratch"` Error string `codec:"error"` OpcodeBudget int `codec:"budget"` // global/local state changes are updated every step. Stateful TEAL only. transactions.EvalDelta }
DebugState is a representation of the evaluation context that we encode to json and send to tealdbg
func (*DebugState) LineToPC ¶
func (d *DebugState) LineToPC(line int) int
LineToPC converts line to pc Return 0 on unsuccess
func (*DebugState) PCToLine ¶
func (d *DebugState) PCToLine(pc int) int
PCToLine converts pc to line Return 0 on unsuccess
type DebuggerHook ¶
type DebuggerHook interface { // Register is fired on program creation Register(state *DebugState) error // Update is fired on every step Update(state *DebugState) error // Complete is called when the program exits Complete(state *DebugState) error }
DebuggerHook functions are called by eval function during TEAL program execution if provided
type EcdsaCurve ¶
type EcdsaCurve int
EcdsaCurve is an enum for `ecdsa_` opcodes
const ( // Secp256k1 curve for bitcoin/ethereum Secp256k1 EcdsaCurve = iota )
func (EcdsaCurve) String ¶
func (i EcdsaCurve) String() string
type EvalContext ¶
type EvalContext struct { *EvalParams // the index of the transaction being evaluated GroupIndex int // the transaction being evaluated (initialized from GroupIndex + ep.TxnGroup) Txn *transactions.SignedTxnWithAD // contains filtered or unexported fields }
EvalContext is the execution context of AVM bytecode. It contains the full state of the running program, and tracks some of the things that the program has done, like log messages and inner transactions.
func EvalContract ¶
func EvalContract(program []byte, gi int, aid basics.AppIndex, params *EvalParams) (bool, *EvalContext, error)
EvalContract executes stateful TEAL program as the gi'th transaction in params
func (*EvalContext) PcDetails ¶
func (cx *EvalContext) PcDetails() (pc int, dis string)
PcDetails return PC and disassembled instructions at PC up to 2 opcodes back
type EvalParams ¶
type EvalParams struct { Proto *config.ConsensusParams Trace *strings.Builder TxnGroup []transactions.SignedTxnWithAD Ledger LedgerForLogic // optional debugger Debugger DebuggerHook // MinTealVersion is the minimum allowed TEAL version of this program. // The program must reject if its version is less than this version. If // MinTealVersion is nil, we will compute it ourselves MinTealVersion *uint64 // Amount "overpaid" by the transactions of the group. Often 0. When // positive, it can be spent by inner transactions. Shared across a group's // txns, so that it can be updated (including upward, by overpaying inner // transactions). nil is treated as 0 (used before fee pooling is enabled). FeeCredit *uint64 Specials *transactions.SpecialAddresses // Total pool of app call budget in a group transaction (nil before budget pooling enabled) PooledApplicationBudget *int // contains filtered or unexported fields }
EvalParams contains data that comes into condition evaluation.
func NewEvalParams ¶
func NewEvalParams(txgroup []transactions.SignedTxnWithAD, proto *config.ConsensusParams, specials *transactions.SpecialAddresses) *EvalParams
NewEvalParams creates an EvalParams to use while evaluating a top-level txgroup
func NewInnerEvalParams ¶
func NewInnerEvalParams(txg []transactions.SignedTxnWithAD, caller *EvalContext) *EvalParams
NewInnerEvalParams creates an EvalParams to be used while evaluating an inner group txgroup
func (*EvalParams) RecordAD ¶
func (ep *EvalParams) RecordAD(gi int, ad transactions.ApplyData)
RecordAD notes ApplyData information that was derived outside of the logic package. For example, after a acfg transaction is processed, the AD created by the acfg is added to the EvalParams this way.
type GlobalField ¶
type GlobalField uint64
GlobalField is an enum for `global` opcode
const ( // MinTxnFee ConsensusParams.MinTxnFee MinTxnFee GlobalField = iota // MinBalance ConsensusParams.MinBalance MinBalance // MaxTxnLife ConsensusParams.MaxTxnLife MaxTxnLife // ZeroAddress [32]byte{0...} ZeroAddress // GroupSize len(txn group) GroupSize // LogicSigVersion ConsensusParams.LogicSigVersion LogicSigVersion // Round basics.Round Round // LatestTimestamp uint64 LatestTimestamp // CurrentApplicationID uint64 CurrentApplicationID // CreatorAddress [32]byte CreatorAddress // CurrentApplicationAddress [32]byte CurrentApplicationAddress // GroupID [32]byte GroupID // OpcodeBudget The remaining budget available for execution OpcodeBudget // CallerApplicationID The ID of the caller app, else 0 CallerApplicationID // CallerApplicationAddress The Address of the caller app, else ZeroAddress CallerApplicationAddress )
func (GlobalField) String ¶
func (i GlobalField) String() string
type LedgerForLogic ¶
type LedgerForLogic interface { AccountData(addr basics.Address) (basics.AccountData, error) Authorizer(addr basics.Address) (basics.Address, error) Round() basics.Round LatestTimestamp() int64 AssetHolding(addr basics.Address, assetIdx basics.AssetIndex) (basics.AssetHolding, error) AssetParams(aidx basics.AssetIndex) (basics.AssetParams, basics.Address, error) AppParams(aidx basics.AppIndex) (basics.AppParams, basics.Address, error) OptedIn(addr basics.Address, appIdx basics.AppIndex) (bool, error) GetLocal(addr basics.Address, appIdx basics.AppIndex, key string, accountIdx uint64) (value basics.TealValue, exists bool, err error) SetLocal(addr basics.Address, appIdx basics.AppIndex, key string, value basics.TealValue, accountIdx uint64) error DelLocal(addr basics.Address, appIdx basics.AppIndex, key string, accountIdx uint64) error GetGlobal(appIdx basics.AppIndex, key string) (value basics.TealValue, exists bool, err error) SetGlobal(appIdx basics.AppIndex, key string, value basics.TealValue) error DelGlobal(appIdx basics.AppIndex, key string) error Perform(gi int, ep *EvalParams) error Counter() uint64 }
LedgerForLogic represents ledger API for Stateful TEAL program
type Msg ¶
type Msg struct { ProgramHash crypto.Digest `codec:"p"` Data []byte `codec:"d"` // contains filtered or unexported fields }
Msg is data meant to be signed and then verified with the ed25519verify opcode.
type OnCompletionConstType ¶
type OnCompletionConstType transactions.OnCompletion
OnCompletionConstType is the same as transactions.OnCompletion
const ( // NoOp = transactions.NoOpOC NoOp OnCompletionConstType = OnCompletionConstType(transactions.NoOpOC) // OptIn = transactions.OptInOC OptIn OnCompletionConstType = OnCompletionConstType(transactions.OptInOC) // CloseOut = transactions.CloseOutOC CloseOut OnCompletionConstType = OnCompletionConstType(transactions.CloseOutOC) // ClearState = transactions.ClearStateOC ClearState OnCompletionConstType = OnCompletionConstType(transactions.ClearStateOC) // UpdateApplication = transactions.UpdateApplicationOC UpdateApplication OnCompletionConstType = OnCompletionConstType(transactions.UpdateApplicationOC) // DeleteApplication = transactions.DeleteApplicationOC DeleteApplication OnCompletionConstType = OnCompletionConstType(transactions.DeleteApplicationOC) )
func (OnCompletionConstType) String ¶
func (i OnCompletionConstType) String() string
type OpCost ¶
OpCost indicates the cost of an operation over the range of LogicVersions from From to To.
func OpAllCosts ¶
OpAllCosts returns an array of the cost score for an op by version. Each entry indicates the cost over a range of versions, so if the cost has remained constant, there is only one result, otherwise each entry shows the cost for a consecutive range of versions, inclusive.
type OpSpec ¶
type OpSpec struct { Opcode byte Name string Args StackTypes // what gets popped from the stack Returns StackTypes // what gets pushed to the stack Version uint64 // TEAL version opcode introduced Modes runMode // if non-zero, then (mode & Modes) != 0 to allow Details opDetails // Special cost or bytecode layout considerations // contains filtered or unexported fields }
OpSpec defines an opcode
func OpcodesByVersion ¶
OpcodesByVersion returns list of opcodes available in a specific version of TEAL by copying v1 opcodes to v2, and then on to v3 to create a full list
type OpStream ¶
type OpStream struct { Version uint64 Trace io.Writer Warnings []error // informational warnings, shouldn't stop assembly Errors []*lineError // errors that should prevent final assembly Program []byte // Final program bytes. Will stay nil if any errors // map opcode offsets to source line OffsetToLine map[int]int HasStatefulOps bool // contains filtered or unexported fields }
OpStream is destination for program and scratch space
func AssembleString ¶
AssembleString takes an entire program in a string and assembles it to bytecode using AssemblerDefaultVersion
func AssembleStringWithVersion ¶
AssembleStringWithVersion takes an entire program in a string and assembles it to bytecode using the assembler version specified. If version is assemblerNoVersion it uses #pragma version or fallsback to AssemblerDefaultVersion. OpStream is returned to allow access to warnings, (multiple) errors, or the PC to source line mapping. Note that AssemblerDefaultVersion is not the latest supported version, and therefore we might need to pass in explicitly a higher version.
func (*OpStream) ByteLiteral ¶
ByteLiteral writes opcodes and data for loading a []byte literal Values are accumulated so that they can be put into a bytecblock
func (*OpStream) RecordSourceLine ¶
func (ops *OpStream) RecordSourceLine()
RecordSourceLine adds an entry to pc to line mapping
func (*OpStream) ReferToLabel ¶
ReferToLabel records an opcode label refence to resolve later
func (*OpStream) ReportProblems ¶
ReportProblems issues accumulated warnings and outputs errors to an io.Writer.
type PCOffset ¶
PCOffset stores the mapping from a program counter value to an offset in the disassembly of the bytecode
type PanicError ¶
type PanicError struct { PanicValue interface{} StackTrace string }
PanicError wraps a recover() catching a panic()
func (PanicError) Error ¶
func (pe PanicError) Error() string
type Program ¶
type Program []byte
Program is byte code to be interpreted for validating transactions.
type StackType ¶
type StackType byte
StackType describes the type of a value on the operand stack
const ( // StackNone in an OpSpec shows that the op pops or yields nothing StackNone StackType = iota // StackAny in an OpSpec shows that the op pops or yield any type StackAny // StackUint64 in an OpSpec shows that the op pops or yields a uint64 StackUint64 // StackBytes in an OpSpec shows that the op pops or yields a []byte StackBytes )
type StackTypes ¶
type StackTypes []StackType
StackTypes is an alias for a list of StackType with syntactic sugar
type TxnField ¶
type TxnField int
TxnField is an enum type for `txn` and `gtxn`
const ( // Sender Transaction.Sender Sender TxnField = iota // Fee Transaction.Fee Fee // FirstValid Transaction.FirstValid FirstValid // FirstValidTime panic FirstValidTime // LastValid Transaction.LastValid LastValid // Note Transaction.Note Note // Lease Transaction.Lease Lease // Receiver Transaction.Receiver Receiver // Amount Transaction.Amount Amount // CloseRemainderTo Transaction.CloseRemainderTo CloseRemainderTo // VotePK Transaction.VotePK VotePK // SelectionPK Transaction.SelectionPK SelectionPK // VoteFirst Transaction.VoteFirst VoteFirst // VoteLast Transaction.VoteLast VoteLast // VoteKeyDilution Transaction.VoteKeyDilution VoteKeyDilution // Type Transaction.Type Type // TypeEnum int(Transaction.Type) TypeEnum // XferAsset Transaction.XferAsset XferAsset // AssetAmount Transaction.AssetAmount AssetAmount // AssetSender Transaction.AssetSender AssetSender // AssetReceiver Transaction.AssetReceiver AssetReceiver // AssetCloseTo Transaction.AssetCloseTo AssetCloseTo // GroupIndex i for txngroup[i] == Txn GroupIndex // TxID Transaction.ID() TxID // ApplicationID basics.AppIndex ApplicationID // OnCompletion OnCompletion OnCompletion // ApplicationArgs [][]byte ApplicationArgs // NumAppArgs len(ApplicationArgs) NumAppArgs // Accounts []basics.Address Accounts // NumAccounts len(Accounts) NumAccounts // ApprovalProgram []byte ApprovalProgram // ClearStateProgram []byte ClearStateProgram // RekeyTo basics.Address RekeyTo // ConfigAsset basics.AssetIndex ConfigAsset // ConfigAssetTotal AssetParams.Total ConfigAssetTotal // ConfigAssetDecimals AssetParams.Decimals ConfigAssetDecimals // ConfigAssetDefaultFrozen AssetParams.AssetDefaultFrozen ConfigAssetDefaultFrozen // ConfigAssetUnitName AssetParams.UnitName ConfigAssetUnitName // ConfigAssetName AssetParams.AssetName ConfigAssetName // ConfigAssetURL AssetParams.URL ConfigAssetURL // ConfigAssetMetadataHash AssetParams.MetadataHash ConfigAssetMetadataHash // ConfigAssetManager AssetParams.Manager ConfigAssetManager // ConfigAssetReserve AssetParams.Reserve ConfigAssetReserve // ConfigAssetFreeze AssetParams.Freeze ConfigAssetFreeze // ConfigAssetClawback AssetParams.Clawback ConfigAssetClawback //FreezeAsset basics.AssetIndex FreezeAsset // FreezeAssetAccount basics.Address FreezeAssetAccount // FreezeAssetFrozen bool FreezeAssetFrozen // Assets []basics.AssetIndex Assets // NumAssets len(ForeignAssets) NumAssets // Applications []basics.AppIndex Applications // NumApplications len(ForeignApps) NumApplications // GlobalNumUint uint64 GlobalNumUint // GlobalNumByteSlice uint64 GlobalNumByteSlice // LocalNumUint uint64 LocalNumUint // LocalNumByteSlice uint64 LocalNumByteSlice // ExtraProgramPages AppParams.ExtraProgramPages ExtraProgramPages // Nonparticipation Transaction.Nonparticipation Nonparticipation // Logs Transaction.ApplyData.EvalDelta.Logs Logs // NumLogs len(Logs) NumLogs // CreatedAssetID Transaction.ApplyData.EvalDelta.ConfigAsset CreatedAssetID // CreatedApplicationID Transaction.ApplyData.EvalDelta.ApplicationID CreatedApplicationID // LastLog Logs[len(Logs)-1] LastLog // StateProofPK Transaction.StateProofPK StateProofPK )
type WebDebuggerHook ¶
type WebDebuggerHook struct {
URL string
}
WebDebuggerHook represents a connection to tealdbg
func (*WebDebuggerHook) Complete ¶
func (dbg *WebDebuggerHook) Complete(state *DebugState) error
Complete sends state to remote debugger
func (*WebDebuggerHook) Register ¶
func (dbg *WebDebuggerHook) Register(state *DebugState) error
Register sends state to remote debugger
func (*WebDebuggerHook) Update ¶
func (dbg *WebDebuggerHook) Update(state *DebugState) error
Update sends state to remote debugger