algorand / algorand/pyteal

Add ability to create dynamically sized `abi.DynamicArray`s

オープン
#603 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
Team Scytale
主要言語
Python
スター
288
フォーク
138
PR マージ指標
30日以内にマージされた PR はありません

説明

## Problem
Contract methods which return dynamic arrays likely do not know the size of the array they need to return at compile time.

Unfortunately, the only way to initialize/modify an `abi.DynamicArray` value is with the `set` method: https://github.com/algorand/pyteal/blob/a3b5b297cbc638ea19fb582d0f402f8ebb3ced4e/pyteal/ast/abi/array_dynamic.py#L55-L58

This method only allows `values` to be a compile-time sequence of values, or to be another dynamic array. As a consequence of this, it's not currently possible to create an array of arbitrary length at runtime in PyTeal.

## Possible Solutions
There are two possible solutions that could address this problem.

1. Add the ability to append new elements to an existing dynamic array. #604 is the start of a PR to do this.
2. If implemented in conjunction with #602, add the ability to create an arbitrary-sized dynamic array at runtime, perhaps with a default value to fill the array with. This would be similar in spirit to languages like Go or C, where you can dynamically allocate an array of a certain size and then set its elements individually.

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。