-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Subject of the issue
Given a struct such as
class FixedArrayUInt64(Struct):
length: arc4.UInt16
arr: arc4.StaticArray[arc4.UInt64, typing.Literal[4095]]
when constructing it using from_bytes
method with a value that cannot be decoded as that type e.g.
foo = FixedArrayUInt64.from_bytes(b"\x00\x00")
This results immediately in a ValueError
, where as in a compiled AVM program this would not error until an operation was performed on that value that would be outside the valid bounds of the underlying bytes e.g.
assert foo.length == 0, "this passes in AVM compiled code"
assert foo.arr[0] == 0, "this would error in AVM compiled code"
Expected behaviour
An error should only be thrown when accessing data beyond the underlying bytes
Actual behaviour
ValueError
with error message input string is not long enough to be decoded
is thrown in the algopy testing implementation
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working