Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass-by-Ref / Dynamic Scratch Variables via the loads and stores opcodes #198

Merged
merged 87 commits into from
Mar 1, 2022
Merged
Show file tree
Hide file tree
Changes from 84 commits
Commits
Show all changes
87 commits
Select commit Hold shift + click to select a range
ca75dbf
Fresh Start: Dynamic Scratch Variables
Feb 14, 2022
21ea026
TDD. Stuck at dynamic_scratch.py: line 58
Feb 14, 2022
ccd3a8b
Next, get past dynamic_scratch.py: line 66 - need an index()
Feb 14, 2022
91e10e4
compiler doesn't recognize DynamicSlot - and it shouldn't have to
Feb 14, 2022
26ce3af
fixed load but store still reaches compiler
Feb 14, 2022
b395734
pass the TDD and even a more ambitions dynamic_scratch_2 case
Feb 14, 2022
becd971
fix incorrect comment, and make the wilt comment into a real test
Feb 14, 2022
c1aaa45
pass mypy... but did we cast too much?
Feb 14, 2022
8e9659e
more assertive and precise type casting
Feb 14, 2022
126ac76
new e2e circle test
Feb 14, 2022
1159ba6
ready for review... but it's also time for unit tests
Feb 15, 2022
0e5bccc
fix test logic error, plus better comments in wilt TEAL
Feb 15, 2022
a0a351d
unnecessary todo - given successful e2e tests
Feb 15, 2022
e6b9f0b
TDD: Only type Expr is allowed - so need to expand the subroutine par…
Feb 15, 2022
c35f017
got through a couple more exceptions hurdles
Feb 15, 2022
1d365f3
almost ready to load the scratchvar's
Feb 15, 2022
e94e9cd
commit before selectively rolling back
Feb 16, 2022
07a98e0
a bunch of comments
Feb 17, 2022
4fa0bfd
final touches before pause
Feb 17, 2022
968b9b2
good place to commit - working... but need to refactor
Feb 17, 2022
ca22c63
cleanup
Feb 17, 2022
097a2ac
add logcat test, remove stale tests, and hopefully pass on circle
Feb 17, 2022
8bff58b
ready to refactor
Feb 17, 2022
a7ac275
rip out before clean up
Feb 17, 2022
8f162c5
cleanup
Feb 17, 2022
6fa17cb
cleanup
Feb 17, 2022
004b5f5
cleanup
Feb 17, 2022
4c92425
cleaunp
Feb 17, 2022
40f473b
Merge branch 'master' of github.com:algorand/pyteal into pass-by-ref
Feb 17, 2022
40f818e
merge head add in missing and re-alphabetize imports
Feb 17, 2022
285980d
revert
Feb 17, 2022
8e52b60
revert
Feb 17, 2022
6eca022
pass unit tests locally
Feb 17, 2022
f67947a
mypy
Feb 17, 2022
992d7dd
comments
Feb 18, 2022
3c14bc4
better comment
Feb 18, 2022
1c6916d
better wording
Feb 18, 2022
eb33cfe
grammar
Feb 18, 2022
f3bcc6b
remove mistakenly included file
Feb 18, 2022
48adcae
better workding
Feb 18, 2022
92d0b93
wording
Feb 18, 2022
34cf121
wording
Feb 18, 2022
ecb2cc8
remove empty line
Feb 18, 2022
ba92401
dedupe bad merge in init's
Feb 18, 2022
1efbae8
per CR comments
Feb 18, 2022
9bc3539
pass the compiler options thru so can be backwards compatible with ne…
Feb 18, 2022
988ef0f
mypy
Feb 18, 2022
c0eb0fd
unit test_scratch_index()
Feb 18, 2022
80ee8d6
dynamicScratchvar unit tests with closer adherance to ScratchVar's API
Feb 18, 2022
6e69735
mypy
Feb 18, 2022
f4e16e7
maybe pylance has a bug. Remove Bytes anyway
Feb 18, 2022
cceca7a
bump up mypy to 0.931
Feb 18, 2022
5584158
ahh Bytes missing from .pyi
Feb 18, 2022
c829fa2
unit tests for storing/loading via an index_expression
Feb 18, 2022
d2ec80c
unit tests for dynamic scratchvar load/store
Feb 18, 2022
8444dbd
typo
Feb 18, 2022
42200ab
allow skipping new version in tests
Feb 18, 2022
daa4cf6
mid-refactor, lets run against Circle
Feb 18, 2022
8fa2d4a
per cr catch: better assumption about argument types with a new e2e c…
Feb 18, 2022
07c9431
more leniency on annotations
Feb 18, 2022
5ecf72e
mypy
Feb 18, 2022
49b1284
try on circle
Feb 18, 2022
9068277
mypy
Feb 18, 2022
f5221db
get rid of options that I had added
Feb 18, 2022
35bb603
remove comments
Feb 18, 2022
61055b7
remove comments
Feb 18, 2022
0f0ab39
remove comments
Feb 18, 2022
51cd869
remove comments
Feb 18, 2022
05e774b
Make DynamicScratchVar a subclass of ScratchVar and ensure with a tes…
Feb 18, 2022
9555455
make the invalid subroutine definition tests pass in python 3.6 also
Feb 18, 2022
57013d9
assert no setting index to a dynamic scratchvar
Feb 19, 2022
6335d6d
Update pyteal/ast/scratchvar.py
tzaffi Feb 28, 2022
87d8644
Per CR comments - make the expected teal's in e2e tests valid TEAL
Feb 28, 2022
4b707b5
per CR comments
Mar 1, 2022
70e08c8
per CR suggestions: disallow Expr subtypes as subroutine return annot…
Mar 1, 2022
9962651
Per CR suggestions: tightening up SubroutineDefinition annotation typ…
Mar 1, 2022
9291792
sort and uniquify output of generate_init
Mar 1, 2022
cc3fffc
Merge remote-tracking branch 'origin/master' into pass-by-ref
Mar 1, 2022
74e05b3
revert ast/__init__.py's __all__
Mar 1, 2022
cfd5ce5
per CR suggestions: better validation and __str__() for ScratchLoad/S…
Mar 1, 2022
0d40db1
per CR comments: clearer tests
Mar 1, 2022
4f39f5b
per CR suggestion: tighter Dynamic/ScratchVar class hierarchy
Mar 1, 2022
69a50e6
revert
Mar 1, 2022
d982a3f
space
Mar 1, 2022
8680b48
Update pyteal/ast/subroutine_test.py
tzaffi Mar 1, 2022
cb34355
per CR comment: abort when dupe imports dectected
Mar 1, 2022
1749738
Refactor SubroutineDefinition parameter validation into method with e…
michaeldiamant Mar 1, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
250 changes: 126 additions & 124 deletions pyteal/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -17,156 +17,158 @@ from .errors import TealInternalError, TealTypeError, TealInputError, TealCompil
from .config import MAX_GROUP_SIZE, NUM_SLOTS

__all__ = [
"Expr",
tzaffi marked this conversation as resolved.
Show resolved Hide resolved
"LeafExpr",
"AccountParam",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file changed mostly as a result of getting the generator to sort and uniquify __all__

"Add",
"Addr",
"Bytes",
"Int",
"EnumInt",
"MethodSignature",
"Arg",
"TxnType",
"TxnField",
"TxnExpr",
"TxnaExpr",
"TxnArray",
"TxnObject",
"Txn",
"GtxnExpr",
"GtxnaExpr",
"TxnGroup",
"Gtxn",
"GeneratedID",
"ImportScratchValue",
"Global",
"GlobalField",
"And",
"App",
"AppField",
"OnComplete",
"AppParam",
"Approve",
"Arg",
"Array",
"Assert",
"AssetHolding",
"AssetParam",
"AccountParam",
"InnerTxnBuilder",
"InnerTxn",
"InnerTxnAction",
"Gitxn",
"GitxnExpr",
"GitxnaExpr",
"InnerTxnGroup",
"Array",
"Tmpl",
"Nonce",
"UnaryExpr",
"Btoi",
"Itob",
"Len",
"BitLen",
"Sha256",
"Sha512_256",
"Keccak256",
"Not",
"BitwiseNot",
"Sqrt",
"Pop",
"Balance",
"MinBalance",
"BinaryExpr",
"Add",
"Minus",
"Mul",
"Div",
"Mod",
"Exp",
"Divw",
"BitLen",
"BitwiseAnd",
"BitwiseNot",
"BitwiseOr",
"BitwiseXor",
"ShiftLeft",
"ShiftRight",
"Eq",
"Neq",
"Lt",
"Le",
"Gt",
"Ge",
"GetBit",
"GetByte",
"Ed25519Verify",
"Substring",
"Extract",
"Suffix",
"SetBit",
"SetByte",
"NaryExpr",
"And",
"Or",
"Concat",
"WideRatio",
"If",
"Cond",
"Seq",
"Assert",
"Err",
"Return",
"Approve",
"Reject",
"Subroutine",
"SubroutineDefinition",
"SubroutineDeclaration",
"SubroutineCall",
"SubroutineFnWrapper",
"ScratchSlot",
"ScratchLoad",
"ScratchStore",
"ScratchStackStore",
"ScratchVar",
"MaybeValue",
"MultiValue",
"Break",
"Btoi",
"Bytes",
"BytesAdd",
"BytesMinus",
"BytesDiv",
"BytesMul",
"BytesMod",
"BytesAnd",
"BytesOr",
"BytesXor",
"BytesDiv",
"BytesEq",
"BytesNeq",
"BytesLt",
"BytesLe",
"BytesGt",
"BytesGe",
"BytesGt",
"BytesLe",
"BytesLt",
"BytesMinus",
"BytesMod",
"BytesMul",
"BytesNeq",
"BytesNot",
"BytesOr",
"BytesSqrt",
"BytesXor",
"BytesZero",
"CompileOptions",
"Concat",
"Cond",
"Continue",
"DEFAULT_TEAL_VERSION",
"Div",
"Divw",
"DynamicScratchVar",
"Ed25519Verify",
"EnumInt",
"Eq",
"Err",
"Exp",
"Expr",
"Extract",
"ExtractUint16",
"ExtractUint32",
"ExtractUint64",
"Log",
"While",
"For",
"Break",
"Continue",
"Op",
"Ge",
"GeneratedID",
"GetBit",
"GetByte",
"Gitxn",
"GitxnExpr",
"GitxnaExpr",
"Global",
"GlobalField",
"Gt",
"Gtxn",
"GtxnExpr",
"GtxnaExpr",
"If",
"ImportScratchValue",
"InnerTxn",
"InnerTxnAction",
"InnerTxnBuilder",
"InnerTxnGroup",
"Int",
"Itob",
"Keccak256",
"LabelReference",
"Le",
"LeafExpr",
"Len",
"Log",
"Lt",
"MAX_GROUP_SIZE",
"MAX_TEAL_VERSION",
"MIN_TEAL_VERSION",
"MaybeValue",
"MethodSignature",
"MinBalance",
"Minus",
"Mod",
"Mode",
"Mul",
"MultiValue",
"NUM_SLOTS",
"NaryExpr",
"Neq",
"Nonce",
"Not",
"OnComplete",
"Op",
"Or",
"Pop",
"Reject",
"Return",
"ScratchIndex",
"ScratchLoad",
"ScratchSlot",
"ScratchStackStore",
"ScratchStore",
"ScratchVar",
"Seq",
"SetBit",
"SetByte",
"Sha256",
"Sha512_256",
"ShiftLeft",
"ShiftRight",
"Sqrt",
"Subroutine",
"SubroutineCall",
"SubroutineDeclaration",
"SubroutineDefinition",
"SubroutineFnWrapper",
"Substring",
"Suffix",
"TealBlock",
"TealCompileError",
"TealComponent",
"TealOp",
"TealConditionalBlock",
"TealInputError",
"TealInternalError",
"TealLabel",
"TealBlock",
"TealOp",
"TealSimpleBlock",
"TealConditionalBlock",
"LabelReference",
"MAX_TEAL_VERSION",
"MIN_TEAL_VERSION",
"DEFAULT_TEAL_VERSION",
"CompileOptions",
"compileTeal",
"TealType",
"TealInternalError",
"TealTypeError",
"TealInputError",
"TealCompileError",
"MAX_GROUP_SIZE",
"NUM_SLOTS",
"Tmpl",
"Txn",
"TxnArray",
"TxnExpr",
"TxnField",
"TxnGroup",
"TxnObject",
"TxnType",
"TxnaExpr",
"UnaryExpr",
"While",
"WideRatio",
"compileTeal",
]
16 changes: 12 additions & 4 deletions pyteal/ast/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,14 @@


# misc
from .scratch import ScratchSlot, ScratchLoad, ScratchStore, ScratchStackStore
from .scratchvar import ScratchVar
from .scratch import (
tzaffi marked this conversation as resolved.
Show resolved Hide resolved
ScratchIndex,
ScratchLoad,
ScratchSlot,
ScratchStackStore,
ScratchStore,
)
from .scratchvar import DynamicScratchVar, ScratchVar
from .maybe import MaybeValue
from .multi import MultiValue

Expand Down Expand Up @@ -225,10 +231,12 @@
"SubroutineDeclaration",
"SubroutineCall",
"SubroutineFnWrapper",
"ScratchSlot",
"ScratchIndex",
"ScratchLoad",
"ScratchStore",
"ScratchSlot",
"ScratchStackStore",
"ScratchStore",
"DynamicScratchVar",
"ScratchVar",
"MaybeValue",
"MultiValue",
Expand Down
6 changes: 1 addition & 5 deletions pyteal/ast/multi_test.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
import pytest

from .. import *
from typing import List

# this is not necessary but mypy complains if it's not included
from .. import CompileOptions
from .. import *

options = CompileOptions()

Expand Down
Loading