Skip to content

Add "suffix" operand #450

@gidonkatten

Description

@gidonkatten

Problem

The TEAL opcode extract has the syntax:

extract S L where S: start position, L: length
A range of bytes from A starting at S up to but not including S+L. 
If L is 0, then extract to the end of the string. If S or S+L is larger than the array length, the program fails

The behavior of L=0 isn't immediately obvious.

Solution

Introduce a new op named suffix with same behavior as https://pyteal.readthedocs.io/en/stable/api.html#pyteal.Suffix.

Instead of writting op.extract(..., 7, 0), you would write op.suffix(..., 7)

Proposal

The new op.suffix(..., 7) would compile to TEAL extract 7 0

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions