Skip to content

[Enhancement]: Enable Uint construction from fixed bytes #332

@joe-p

Description

@joe-p

Problem

Currently Uint256 cannot be constructed directly from a bytes<32>. This means you must go from bytes<32> -> biguint -> Uint256. This works, but it increases opcode cost due to the usage of b| because we loose the length information when going to biguint. For example, here is the diff of the TEAL when switching a type from bytes<32> to Uint256:

Image

Part of them problem here is also that the compiler does not seem to know the length of the output of bzero, which is should when the argument is a constant.

Solution

No response

Proposal

Allow a bytes<32> to be passed to the ctor of Uint256. This also applies to all other UintN types

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