Skip to content

[Enhancement]: Skip length check when encoding a fixed array with correct types #344

@joe-p

Description

@joe-p

Problem

Currently a FixedArray will do length check on all of its elements even if the elements are already the correct type.

For example: https://github.com/joe-p/snarkjs-algorand/blob/77e947e51dbbeed69852a5445328e5b0bef43a5f/contracts/out/Groth16Bls12381Verifier.approval.teal#L229-L229

Source: https://github.com/joe-p/snarkjs-algorand/blob/77e947e51dbbeed69852a5445328e5b0bef43a5f/contracts/groth16_bls12381.algo.ts#L187-L187

In this scenario I would expect the FixedArray to essentially be the same as concatting the bytes together, but FixedArray ends up eating more program size and budget

Solution

For now just concatting bytes works

Proposal

Skip size checks when the types are known to be the correct type

Pros & Cons

No response

Dependencies

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions