Skip to content

TEAL - allow backward jumps or indirect jumps #1211

Closed
@jeapostrophe

Description

TEAL does not allow backward jumps.

This is enforced by the assembler --- https://github.com/algorand/go-algorand/blob/master/data/transactions/logic/assembler.go#L1061 --- and implicitly by the evaluator treating offsets as positive increases in the program counter --- e.g., https://github.com/algorand/go-algorand/blob/master/data/transactions/logic/eval.go#L1078

I believe that TEAL is consciously designed with this limitation in an attempt to ensure that programs do not run arbitrarily long and exhaust computational resources. However, program total execution is separately limited by the cost (LogicSigMaxCost and MaxAppProgramCost) so it is not necessary to also restrict the structure of TEAL programs.

If this restriction were removed, then it would be easier to share code in TEAL programs, especially if indirect jumps or call/ret opcodes were available. If we could share code, then we would be able to decrease the size of TEAL programs.

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions